@compill/admin 1.0.84 → 1.0.86
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 +315 -257
- package/index.esm.js +316 -258
- package/package.json +1 -1
- package/src/lib/breadcrumbs/BreadCrumbs.d.ts +10 -3
- package/src/lib/json/types/TableView.d.ts +2 -2
- package/src/lib/page/PageTopBar.d.ts +2 -2
- package/src/lib/table/TableTopBar.d.ts +3 -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
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",
|
@@ -1488,9 +1786,10 @@ function TableFilterButton(_a) {
|
|
1488
1786
|
function TableTopBar(_a) {
|
1489
1787
|
var {
|
1490
1788
|
title,
|
1789
|
+
breadcrumbs,
|
1491
1790
|
children
|
1492
1791
|
} = _a,
|
1493
|
-
props = __rest(_a, ["title", "children"]);
|
1792
|
+
props = __rest(_a, ["title", "breadcrumbs", "children"]);
|
1494
1793
|
return jsxRuntime.jsxs("div", Object.assign({
|
1495
1794
|
dflex: true,
|
1496
1795
|
flexRow: true,
|
@@ -1498,12 +1797,16 @@ function TableTopBar(_a) {
|
|
1498
1797
|
gap: "3",
|
1499
1798
|
p: "8"
|
1500
1799
|
}, props, {
|
1501
|
-
children: [
|
1502
|
-
|
1503
|
-
|
1504
|
-
|
1505
|
-
|
1506
|
-
|
1800
|
+
children: [jsxRuntime.jsxs("div", {
|
1801
|
+
children: [title && jsxRuntime.jsx("h2", {
|
1802
|
+
textSize: "x2",
|
1803
|
+
fontWeight: "600",
|
1804
|
+
textColor: "#3f4254",
|
1805
|
+
textTransform: "capitalize",
|
1806
|
+
children: title
|
1807
|
+
}), breadcrumbs && jsxRuntime.jsx(admin.Breadcrumbs, {
|
1808
|
+
breadcrumbs: breadcrumbs
|
1809
|
+
})]
|
1507
1810
|
}), jsxRuntime.jsx("div", {
|
1508
1811
|
flexGrow: true,
|
1509
1812
|
children: "\u00A0"
|
@@ -1543,250 +1846,6 @@ function sortBy(arr, criteria) {
|
|
1543
1846
|
return orderBy(arr, criteria, ['asc']);
|
1544
1847
|
}
|
1545
1848
|
|
1546
|
-
function noop() { }
|
1547
|
-
|
1548
|
-
function getSymbols(object) {
|
1549
|
-
return Object.getOwnPropertySymbols(object).filter(symbol => Object.prototype.propertyIsEnumerable.call(object, symbol));
|
1550
|
-
}
|
1551
|
-
|
1552
|
-
function getTag(value) {
|
1553
|
-
if (value == null) {
|
1554
|
-
return value === undefined ? '[object Undefined]' : '[object Null]';
|
1555
|
-
}
|
1556
|
-
return Object.prototype.toString.call(value);
|
1557
|
-
}
|
1558
|
-
|
1559
|
-
const regexpTag = '[object RegExp]';
|
1560
|
-
const stringTag = '[object String]';
|
1561
|
-
const numberTag = '[object Number]';
|
1562
|
-
const booleanTag = '[object Boolean]';
|
1563
|
-
const argumentsTag = '[object Arguments]';
|
1564
|
-
const symbolTag = '[object Symbol]';
|
1565
|
-
const dateTag = '[object Date]';
|
1566
|
-
const mapTag = '[object Map]';
|
1567
|
-
const setTag = '[object Set]';
|
1568
|
-
const arrayTag = '[object Array]';
|
1569
|
-
const functionTag = '[object Function]';
|
1570
|
-
const arrayBufferTag = '[object ArrayBuffer]';
|
1571
|
-
const objectTag = '[object Object]';
|
1572
|
-
const errorTag = '[object Error]';
|
1573
|
-
const dataViewTag = '[object DataView]';
|
1574
|
-
const uint8ArrayTag = '[object Uint8Array]';
|
1575
|
-
const uint8ClampedArrayTag = '[object Uint8ClampedArray]';
|
1576
|
-
const uint16ArrayTag = '[object Uint16Array]';
|
1577
|
-
const uint32ArrayTag = '[object Uint32Array]';
|
1578
|
-
const bigUint64ArrayTag = '[object BigUint64Array]';
|
1579
|
-
const int8ArrayTag = '[object Int8Array]';
|
1580
|
-
const int16ArrayTag = '[object Int16Array]';
|
1581
|
-
const int32ArrayTag = '[object Int32Array]';
|
1582
|
-
const bigInt64ArrayTag = '[object BigInt64Array]';
|
1583
|
-
const float32ArrayTag = '[object Float32Array]';
|
1584
|
-
const float64ArrayTag = '[object Float64Array]';
|
1585
|
-
|
1586
|
-
function isPlainObject(value) {
|
1587
|
-
if (!value || typeof value !== 'object') {
|
1588
|
-
return false;
|
1589
|
-
}
|
1590
|
-
const proto = Object.getPrototypeOf(value);
|
1591
|
-
const hasObjectPrototype = proto === null ||
|
1592
|
-
proto === Object.prototype ||
|
1593
|
-
Object.getPrototypeOf(proto) === null;
|
1594
|
-
if (!hasObjectPrototype) {
|
1595
|
-
return false;
|
1596
|
-
}
|
1597
|
-
return Object.prototype.toString.call(value) === '[object Object]';
|
1598
|
-
}
|
1599
|
-
|
1600
|
-
function eq(value, other) {
|
1601
|
-
return value === other || (Number.isNaN(value) && Number.isNaN(other));
|
1602
|
-
}
|
1603
|
-
|
1604
|
-
function isEqualWith(a, b, areValuesEqual) {
|
1605
|
-
return isEqualWithImpl(a, b, undefined, undefined, undefined, undefined, areValuesEqual);
|
1606
|
-
}
|
1607
|
-
function isEqualWithImpl(a, b, property, aParent, bParent, stack, areValuesEqual) {
|
1608
|
-
const result = areValuesEqual(a, b, property, aParent, bParent, stack);
|
1609
|
-
if (result !== undefined) {
|
1610
|
-
return result;
|
1611
|
-
}
|
1612
|
-
if (typeof a === typeof b) {
|
1613
|
-
switch (typeof a) {
|
1614
|
-
case 'bigint':
|
1615
|
-
case 'string':
|
1616
|
-
case 'boolean':
|
1617
|
-
case 'symbol':
|
1618
|
-
case 'undefined': {
|
1619
|
-
return a === b;
|
1620
|
-
}
|
1621
|
-
case 'number': {
|
1622
|
-
return a === b || Object.is(a, b);
|
1623
|
-
}
|
1624
|
-
case 'function': {
|
1625
|
-
return a === b;
|
1626
|
-
}
|
1627
|
-
case 'object': {
|
1628
|
-
return areObjectsEqual(a, b, stack, areValuesEqual);
|
1629
|
-
}
|
1630
|
-
}
|
1631
|
-
}
|
1632
|
-
return areObjectsEqual(a, b, stack, areValuesEqual);
|
1633
|
-
}
|
1634
|
-
function areObjectsEqual(a, b, stack, areValuesEqual) {
|
1635
|
-
if (Object.is(a, b)) {
|
1636
|
-
return true;
|
1637
|
-
}
|
1638
|
-
let aTag = getTag(a);
|
1639
|
-
let bTag = getTag(b);
|
1640
|
-
if (aTag === argumentsTag) {
|
1641
|
-
aTag = objectTag;
|
1642
|
-
}
|
1643
|
-
if (bTag === argumentsTag) {
|
1644
|
-
bTag = objectTag;
|
1645
|
-
}
|
1646
|
-
if (aTag !== bTag) {
|
1647
|
-
return false;
|
1648
|
-
}
|
1649
|
-
switch (aTag) {
|
1650
|
-
case stringTag:
|
1651
|
-
return a.toString() === b.toString();
|
1652
|
-
case numberTag: {
|
1653
|
-
const x = a.valueOf();
|
1654
|
-
const y = b.valueOf();
|
1655
|
-
return eq(x, y);
|
1656
|
-
}
|
1657
|
-
case booleanTag:
|
1658
|
-
case dateTag:
|
1659
|
-
case symbolTag:
|
1660
|
-
return Object.is(a.valueOf(), b.valueOf());
|
1661
|
-
case regexpTag: {
|
1662
|
-
return a.source === b.source && a.flags === b.flags;
|
1663
|
-
}
|
1664
|
-
case functionTag: {
|
1665
|
-
return a === b;
|
1666
|
-
}
|
1667
|
-
}
|
1668
|
-
stack = stack ?? new Map();
|
1669
|
-
const aStack = stack.get(a);
|
1670
|
-
const bStack = stack.get(b);
|
1671
|
-
if (aStack != null && bStack != null) {
|
1672
|
-
return aStack === b;
|
1673
|
-
}
|
1674
|
-
stack.set(a, b);
|
1675
|
-
stack.set(b, a);
|
1676
|
-
try {
|
1677
|
-
switch (aTag) {
|
1678
|
-
case mapTag: {
|
1679
|
-
if (a.size !== b.size) {
|
1680
|
-
return false;
|
1681
|
-
}
|
1682
|
-
for (const [key, value] of a.entries()) {
|
1683
|
-
if (!b.has(key) || !isEqualWithImpl(value, b.get(key), key, a, b, stack, areValuesEqual)) {
|
1684
|
-
return false;
|
1685
|
-
}
|
1686
|
-
}
|
1687
|
-
return true;
|
1688
|
-
}
|
1689
|
-
case setTag: {
|
1690
|
-
if (a.size !== b.size) {
|
1691
|
-
return false;
|
1692
|
-
}
|
1693
|
-
const aValues = Array.from(a.values());
|
1694
|
-
const bValues = Array.from(b.values());
|
1695
|
-
for (let i = 0; i < aValues.length; i++) {
|
1696
|
-
const aValue = aValues[i];
|
1697
|
-
const index = bValues.findIndex(bValue => {
|
1698
|
-
return isEqualWithImpl(aValue, bValue, undefined, a, b, stack, areValuesEqual);
|
1699
|
-
});
|
1700
|
-
if (index === -1) {
|
1701
|
-
return false;
|
1702
|
-
}
|
1703
|
-
bValues.splice(index, 1);
|
1704
|
-
}
|
1705
|
-
return true;
|
1706
|
-
}
|
1707
|
-
case arrayTag:
|
1708
|
-
case uint8ArrayTag:
|
1709
|
-
case uint8ClampedArrayTag:
|
1710
|
-
case uint16ArrayTag:
|
1711
|
-
case uint32ArrayTag:
|
1712
|
-
case bigUint64ArrayTag:
|
1713
|
-
case int8ArrayTag:
|
1714
|
-
case int16ArrayTag:
|
1715
|
-
case int32ArrayTag:
|
1716
|
-
case bigInt64ArrayTag:
|
1717
|
-
case float32ArrayTag:
|
1718
|
-
case float64ArrayTag: {
|
1719
|
-
if (typeof Buffer !== 'undefined' && Buffer.isBuffer(a) !== Buffer.isBuffer(b)) {
|
1720
|
-
return false;
|
1721
|
-
}
|
1722
|
-
if (a.length !== b.length) {
|
1723
|
-
return false;
|
1724
|
-
}
|
1725
|
-
for (let i = 0; i < a.length; i++) {
|
1726
|
-
if (!isEqualWithImpl(a[i], b[i], i, a, b, stack, areValuesEqual)) {
|
1727
|
-
return false;
|
1728
|
-
}
|
1729
|
-
}
|
1730
|
-
return true;
|
1731
|
-
}
|
1732
|
-
case arrayBufferTag: {
|
1733
|
-
if (a.byteLength !== b.byteLength) {
|
1734
|
-
return false;
|
1735
|
-
}
|
1736
|
-
return areObjectsEqual(new Uint8Array(a), new Uint8Array(b), stack, areValuesEqual);
|
1737
|
-
}
|
1738
|
-
case dataViewTag: {
|
1739
|
-
if (a.byteLength !== b.byteLength || a.byteOffset !== b.byteOffset) {
|
1740
|
-
return false;
|
1741
|
-
}
|
1742
|
-
return areObjectsEqual(new Uint8Array(a), new Uint8Array(b), stack, areValuesEqual);
|
1743
|
-
}
|
1744
|
-
case errorTag: {
|
1745
|
-
return a.name === b.name && a.message === b.message;
|
1746
|
-
}
|
1747
|
-
case objectTag: {
|
1748
|
-
const areEqualInstances = areObjectsEqual(a.constructor, b.constructor, stack, areValuesEqual) ||
|
1749
|
-
(isPlainObject(a) && isPlainObject(b));
|
1750
|
-
if (!areEqualInstances) {
|
1751
|
-
return false;
|
1752
|
-
}
|
1753
|
-
const aKeys = [...Object.keys(a), ...getSymbols(a)];
|
1754
|
-
const bKeys = [...Object.keys(b), ...getSymbols(b)];
|
1755
|
-
if (aKeys.length !== bKeys.length) {
|
1756
|
-
return false;
|
1757
|
-
}
|
1758
|
-
for (let i = 0; i < aKeys.length; i++) {
|
1759
|
-
const propKey = aKeys[i];
|
1760
|
-
const aProp = a[propKey];
|
1761
|
-
if (!Object.hasOwn(b, propKey)) {
|
1762
|
-
return false;
|
1763
|
-
}
|
1764
|
-
const bProp = b[propKey];
|
1765
|
-
if (!isEqualWithImpl(aProp, bProp, propKey, a, b, stack, areValuesEqual)) {
|
1766
|
-
return false;
|
1767
|
-
}
|
1768
|
-
}
|
1769
|
-
return true;
|
1770
|
-
}
|
1771
|
-
default: {
|
1772
|
-
return false;
|
1773
|
-
}
|
1774
|
-
}
|
1775
|
-
}
|
1776
|
-
finally {
|
1777
|
-
stack.delete(a);
|
1778
|
-
stack.delete(b);
|
1779
|
-
}
|
1780
|
-
}
|
1781
|
-
|
1782
|
-
function isEqual(a, b) {
|
1783
|
-
return isEqualWith(a, b, noop);
|
1784
|
-
}
|
1785
|
-
|
1786
|
-
function capitalize(str) {
|
1787
|
-
return (str.charAt(0).toUpperCase() + str.slice(1).toLowerCase());
|
1788
|
-
}
|
1789
|
-
|
1790
1849
|
function TableFilters({
|
1791
1850
|
form: form$1,
|
1792
1851
|
initialValues,
|
@@ -2615,10 +2674,9 @@ function TT({
|
|
2615
2674
|
} = screen;
|
2616
2675
|
const tableApi = react.runIfFn(api, id !== null && id !== void 0 ? id : "");
|
2617
2676
|
return jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
2618
|
-
children: [
|
2619
|
-
breadcrumbs: breadcrumbs
|
2620
|
-
}), jsxRuntime.jsx(TableTopBar, {
|
2677
|
+
children: [jsxRuntime.jsx(TableTopBar, {
|
2621
2678
|
title: title,
|
2679
|
+
breadcrumbs: breadcrumbs,
|
2622
2680
|
children: jsxRuntime.jsx(TableButtonBar, {
|
2623
2681
|
buttonBar: buttonBar,
|
2624
2682
|
createView: createView,
|
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 {
|
9
|
-
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
|
+
import { ButtonBarButton as ButtonBarButton$1, ButtonBarSubmitButton as ButtonBarSubmitButton$1, PageSectionTitle as PageSectionTitle$1, ButtonBar as ButtonBar$1, ButtonBarDialogButton as ButtonBarDialogButton$1, Breadcrumbs as Breadcrumbs$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",
|
@@ -1478,9 +1776,10 @@ function TableFilterButton(_a) {
|
|
1478
1776
|
function TableTopBar(_a) {
|
1479
1777
|
var {
|
1480
1778
|
title,
|
1779
|
+
breadcrumbs,
|
1481
1780
|
children
|
1482
1781
|
} = _a,
|
1483
|
-
props = __rest(_a, ["title", "children"]);
|
1782
|
+
props = __rest(_a, ["title", "breadcrumbs", "children"]);
|
1484
1783
|
return jsxs("div", Object.assign({
|
1485
1784
|
dflex: true,
|
1486
1785
|
flexRow: true,
|
@@ -1488,12 +1787,16 @@ function TableTopBar(_a) {
|
|
1488
1787
|
gap: "3",
|
1489
1788
|
p: "8"
|
1490
1789
|
}, props, {
|
1491
|
-
children: [
|
1492
|
-
|
1493
|
-
|
1494
|
-
|
1495
|
-
|
1496
|
-
|
1790
|
+
children: [jsxs("div", {
|
1791
|
+
children: [title && jsx("h2", {
|
1792
|
+
textSize: "x2",
|
1793
|
+
fontWeight: "600",
|
1794
|
+
textColor: "#3f4254",
|
1795
|
+
textTransform: "capitalize",
|
1796
|
+
children: title
|
1797
|
+
}), breadcrumbs && jsx(Breadcrumbs$1, {
|
1798
|
+
breadcrumbs: breadcrumbs
|
1799
|
+
})]
|
1497
1800
|
}), jsx("div", {
|
1498
1801
|
flexGrow: true,
|
1499
1802
|
children: "\u00A0"
|
@@ -1533,250 +1836,6 @@ function sortBy(arr, criteria) {
|
|
1533
1836
|
return orderBy(arr, criteria, ['asc']);
|
1534
1837
|
}
|
1535
1838
|
|
1536
|
-
function noop() { }
|
1537
|
-
|
1538
|
-
function getSymbols(object) {
|
1539
|
-
return Object.getOwnPropertySymbols(object).filter(symbol => Object.prototype.propertyIsEnumerable.call(object, symbol));
|
1540
|
-
}
|
1541
|
-
|
1542
|
-
function getTag(value) {
|
1543
|
-
if (value == null) {
|
1544
|
-
return value === undefined ? '[object Undefined]' : '[object Null]';
|
1545
|
-
}
|
1546
|
-
return Object.prototype.toString.call(value);
|
1547
|
-
}
|
1548
|
-
|
1549
|
-
const regexpTag = '[object RegExp]';
|
1550
|
-
const stringTag = '[object String]';
|
1551
|
-
const numberTag = '[object Number]';
|
1552
|
-
const booleanTag = '[object Boolean]';
|
1553
|
-
const argumentsTag = '[object Arguments]';
|
1554
|
-
const symbolTag = '[object Symbol]';
|
1555
|
-
const dateTag = '[object Date]';
|
1556
|
-
const mapTag = '[object Map]';
|
1557
|
-
const setTag = '[object Set]';
|
1558
|
-
const arrayTag = '[object Array]';
|
1559
|
-
const functionTag = '[object Function]';
|
1560
|
-
const arrayBufferTag = '[object ArrayBuffer]';
|
1561
|
-
const objectTag = '[object Object]';
|
1562
|
-
const errorTag = '[object Error]';
|
1563
|
-
const dataViewTag = '[object DataView]';
|
1564
|
-
const uint8ArrayTag = '[object Uint8Array]';
|
1565
|
-
const uint8ClampedArrayTag = '[object Uint8ClampedArray]';
|
1566
|
-
const uint16ArrayTag = '[object Uint16Array]';
|
1567
|
-
const uint32ArrayTag = '[object Uint32Array]';
|
1568
|
-
const bigUint64ArrayTag = '[object BigUint64Array]';
|
1569
|
-
const int8ArrayTag = '[object Int8Array]';
|
1570
|
-
const int16ArrayTag = '[object Int16Array]';
|
1571
|
-
const int32ArrayTag = '[object Int32Array]';
|
1572
|
-
const bigInt64ArrayTag = '[object BigInt64Array]';
|
1573
|
-
const float32ArrayTag = '[object Float32Array]';
|
1574
|
-
const float64ArrayTag = '[object Float64Array]';
|
1575
|
-
|
1576
|
-
function isPlainObject(value) {
|
1577
|
-
if (!value || typeof value !== 'object') {
|
1578
|
-
return false;
|
1579
|
-
}
|
1580
|
-
const proto = Object.getPrototypeOf(value);
|
1581
|
-
const hasObjectPrototype = proto === null ||
|
1582
|
-
proto === Object.prototype ||
|
1583
|
-
Object.getPrototypeOf(proto) === null;
|
1584
|
-
if (!hasObjectPrototype) {
|
1585
|
-
return false;
|
1586
|
-
}
|
1587
|
-
return Object.prototype.toString.call(value) === '[object Object]';
|
1588
|
-
}
|
1589
|
-
|
1590
|
-
function eq(value, other) {
|
1591
|
-
return value === other || (Number.isNaN(value) && Number.isNaN(other));
|
1592
|
-
}
|
1593
|
-
|
1594
|
-
function isEqualWith(a, b, areValuesEqual) {
|
1595
|
-
return isEqualWithImpl(a, b, undefined, undefined, undefined, undefined, areValuesEqual);
|
1596
|
-
}
|
1597
|
-
function isEqualWithImpl(a, b, property, aParent, bParent, stack, areValuesEqual) {
|
1598
|
-
const result = areValuesEqual(a, b, property, aParent, bParent, stack);
|
1599
|
-
if (result !== undefined) {
|
1600
|
-
return result;
|
1601
|
-
}
|
1602
|
-
if (typeof a === typeof b) {
|
1603
|
-
switch (typeof a) {
|
1604
|
-
case 'bigint':
|
1605
|
-
case 'string':
|
1606
|
-
case 'boolean':
|
1607
|
-
case 'symbol':
|
1608
|
-
case 'undefined': {
|
1609
|
-
return a === b;
|
1610
|
-
}
|
1611
|
-
case 'number': {
|
1612
|
-
return a === b || Object.is(a, b);
|
1613
|
-
}
|
1614
|
-
case 'function': {
|
1615
|
-
return a === b;
|
1616
|
-
}
|
1617
|
-
case 'object': {
|
1618
|
-
return areObjectsEqual(a, b, stack, areValuesEqual);
|
1619
|
-
}
|
1620
|
-
}
|
1621
|
-
}
|
1622
|
-
return areObjectsEqual(a, b, stack, areValuesEqual);
|
1623
|
-
}
|
1624
|
-
function areObjectsEqual(a, b, stack, areValuesEqual) {
|
1625
|
-
if (Object.is(a, b)) {
|
1626
|
-
return true;
|
1627
|
-
}
|
1628
|
-
let aTag = getTag(a);
|
1629
|
-
let bTag = getTag(b);
|
1630
|
-
if (aTag === argumentsTag) {
|
1631
|
-
aTag = objectTag;
|
1632
|
-
}
|
1633
|
-
if (bTag === argumentsTag) {
|
1634
|
-
bTag = objectTag;
|
1635
|
-
}
|
1636
|
-
if (aTag !== bTag) {
|
1637
|
-
return false;
|
1638
|
-
}
|
1639
|
-
switch (aTag) {
|
1640
|
-
case stringTag:
|
1641
|
-
return a.toString() === b.toString();
|
1642
|
-
case numberTag: {
|
1643
|
-
const x = a.valueOf();
|
1644
|
-
const y = b.valueOf();
|
1645
|
-
return eq(x, y);
|
1646
|
-
}
|
1647
|
-
case booleanTag:
|
1648
|
-
case dateTag:
|
1649
|
-
case symbolTag:
|
1650
|
-
return Object.is(a.valueOf(), b.valueOf());
|
1651
|
-
case regexpTag: {
|
1652
|
-
return a.source === b.source && a.flags === b.flags;
|
1653
|
-
}
|
1654
|
-
case functionTag: {
|
1655
|
-
return a === b;
|
1656
|
-
}
|
1657
|
-
}
|
1658
|
-
stack = stack ?? new Map();
|
1659
|
-
const aStack = stack.get(a);
|
1660
|
-
const bStack = stack.get(b);
|
1661
|
-
if (aStack != null && bStack != null) {
|
1662
|
-
return aStack === b;
|
1663
|
-
}
|
1664
|
-
stack.set(a, b);
|
1665
|
-
stack.set(b, a);
|
1666
|
-
try {
|
1667
|
-
switch (aTag) {
|
1668
|
-
case mapTag: {
|
1669
|
-
if (a.size !== b.size) {
|
1670
|
-
return false;
|
1671
|
-
}
|
1672
|
-
for (const [key, value] of a.entries()) {
|
1673
|
-
if (!b.has(key) || !isEqualWithImpl(value, b.get(key), key, a, b, stack, areValuesEqual)) {
|
1674
|
-
return false;
|
1675
|
-
}
|
1676
|
-
}
|
1677
|
-
return true;
|
1678
|
-
}
|
1679
|
-
case setTag: {
|
1680
|
-
if (a.size !== b.size) {
|
1681
|
-
return false;
|
1682
|
-
}
|
1683
|
-
const aValues = Array.from(a.values());
|
1684
|
-
const bValues = Array.from(b.values());
|
1685
|
-
for (let i = 0; i < aValues.length; i++) {
|
1686
|
-
const aValue = aValues[i];
|
1687
|
-
const index = bValues.findIndex(bValue => {
|
1688
|
-
return isEqualWithImpl(aValue, bValue, undefined, a, b, stack, areValuesEqual);
|
1689
|
-
});
|
1690
|
-
if (index === -1) {
|
1691
|
-
return false;
|
1692
|
-
}
|
1693
|
-
bValues.splice(index, 1);
|
1694
|
-
}
|
1695
|
-
return true;
|
1696
|
-
}
|
1697
|
-
case arrayTag:
|
1698
|
-
case uint8ArrayTag:
|
1699
|
-
case uint8ClampedArrayTag:
|
1700
|
-
case uint16ArrayTag:
|
1701
|
-
case uint32ArrayTag:
|
1702
|
-
case bigUint64ArrayTag:
|
1703
|
-
case int8ArrayTag:
|
1704
|
-
case int16ArrayTag:
|
1705
|
-
case int32ArrayTag:
|
1706
|
-
case bigInt64ArrayTag:
|
1707
|
-
case float32ArrayTag:
|
1708
|
-
case float64ArrayTag: {
|
1709
|
-
if (typeof Buffer !== 'undefined' && Buffer.isBuffer(a) !== Buffer.isBuffer(b)) {
|
1710
|
-
return false;
|
1711
|
-
}
|
1712
|
-
if (a.length !== b.length) {
|
1713
|
-
return false;
|
1714
|
-
}
|
1715
|
-
for (let i = 0; i < a.length; i++) {
|
1716
|
-
if (!isEqualWithImpl(a[i], b[i], i, a, b, stack, areValuesEqual)) {
|
1717
|
-
return false;
|
1718
|
-
}
|
1719
|
-
}
|
1720
|
-
return true;
|
1721
|
-
}
|
1722
|
-
case arrayBufferTag: {
|
1723
|
-
if (a.byteLength !== b.byteLength) {
|
1724
|
-
return false;
|
1725
|
-
}
|
1726
|
-
return areObjectsEqual(new Uint8Array(a), new Uint8Array(b), stack, areValuesEqual);
|
1727
|
-
}
|
1728
|
-
case dataViewTag: {
|
1729
|
-
if (a.byteLength !== b.byteLength || a.byteOffset !== b.byteOffset) {
|
1730
|
-
return false;
|
1731
|
-
}
|
1732
|
-
return areObjectsEqual(new Uint8Array(a), new Uint8Array(b), stack, areValuesEqual);
|
1733
|
-
}
|
1734
|
-
case errorTag: {
|
1735
|
-
return a.name === b.name && a.message === b.message;
|
1736
|
-
}
|
1737
|
-
case objectTag: {
|
1738
|
-
const areEqualInstances = areObjectsEqual(a.constructor, b.constructor, stack, areValuesEqual) ||
|
1739
|
-
(isPlainObject(a) && isPlainObject(b));
|
1740
|
-
if (!areEqualInstances) {
|
1741
|
-
return false;
|
1742
|
-
}
|
1743
|
-
const aKeys = [...Object.keys(a), ...getSymbols(a)];
|
1744
|
-
const bKeys = [...Object.keys(b), ...getSymbols(b)];
|
1745
|
-
if (aKeys.length !== bKeys.length) {
|
1746
|
-
return false;
|
1747
|
-
}
|
1748
|
-
for (let i = 0; i < aKeys.length; i++) {
|
1749
|
-
const propKey = aKeys[i];
|
1750
|
-
const aProp = a[propKey];
|
1751
|
-
if (!Object.hasOwn(b, propKey)) {
|
1752
|
-
return false;
|
1753
|
-
}
|
1754
|
-
const bProp = b[propKey];
|
1755
|
-
if (!isEqualWithImpl(aProp, bProp, propKey, a, b, stack, areValuesEqual)) {
|
1756
|
-
return false;
|
1757
|
-
}
|
1758
|
-
}
|
1759
|
-
return true;
|
1760
|
-
}
|
1761
|
-
default: {
|
1762
|
-
return false;
|
1763
|
-
}
|
1764
|
-
}
|
1765
|
-
}
|
1766
|
-
finally {
|
1767
|
-
stack.delete(a);
|
1768
|
-
stack.delete(b);
|
1769
|
-
}
|
1770
|
-
}
|
1771
|
-
|
1772
|
-
function isEqual(a, b) {
|
1773
|
-
return isEqualWith(a, b, noop);
|
1774
|
-
}
|
1775
|
-
|
1776
|
-
function capitalize(str) {
|
1777
|
-
return (str.charAt(0).toUpperCase() + str.slice(1).toLowerCase());
|
1778
|
-
}
|
1779
|
-
|
1780
1839
|
function TableFilters({
|
1781
1840
|
form,
|
1782
1841
|
initialValues,
|
@@ -2605,10 +2664,9 @@ function TT({
|
|
2605
2664
|
} = screen;
|
2606
2665
|
const tableApi = runIfFn(api, id !== null && id !== void 0 ? id : "");
|
2607
2666
|
return jsxs(Fragment, {
|
2608
|
-
children: [
|
2609
|
-
breadcrumbs: breadcrumbs
|
2610
|
-
}), jsx(TableTopBar, {
|
2667
|
+
children: [jsx(TableTopBar, {
|
2611
2668
|
title: title,
|
2669
|
+
breadcrumbs: breadcrumbs,
|
2612
2670
|
children: jsx(TableButtonBar, {
|
2613
2671
|
buttonBar: buttonBar,
|
2614
2672
|
createView: createView,
|
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;
|
@@ -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;
|
@@ -1,7 +1,9 @@
|
|
1
1
|
/// <reference types="react" />
|
2
|
+
import { Breadcrumb, QueryBreadcrumbs } from "@compill/admin";
|
2
3
|
import { ParentComponent, SoperioComponent } from "@soperio/react";
|
3
4
|
interface TableTopBarProps extends SoperioComponent, ParentComponent {
|
4
5
|
title?: string;
|
6
|
+
breadcrumbs?: Breadcrumb[] | QueryBreadcrumbs;
|
5
7
|
}
|
6
|
-
export declare function TableTopBar({ title, children, ...props }: TableTopBarProps): JSX.Element;
|
8
|
+
export declare function TableTopBar({ title, breadcrumbs, children, ...props }: TableTopBarProps): JSX.Element;
|
7
9
|
export {};
|