@compill/admin 1.0.49 → 1.0.51
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 +1001 -966
- package/index.esm.js +999 -964
- package/package.json +1 -1
- package/src/index.d.ts +1 -0
- package/src/lib/buttons/InvalidateButton.d.ts +2 -2
- package/src/lib/json/table/RefreshButton.d.ts +4 -0
- package/src/lib/layout/ButtonBar.d.ts +8 -0
- package/src/lib/layout/PageTitleBar.d.ts +7 -0
package/index.cjs.js
CHANGED
@@ -161,6 +161,45 @@ function DialogButton(_a) {
|
|
161
161
|
});
|
162
162
|
}
|
163
163
|
|
164
|
+
function ButtonBar(_a) {
|
165
|
+
var {
|
166
|
+
children
|
167
|
+
} = _a,
|
168
|
+
props = __rest$1(_a, ["children"]);
|
169
|
+
return jsxRuntime.jsx("div", Object.assign({
|
170
|
+
dflex: true,
|
171
|
+
border: "1px",
|
172
|
+
borderColor: "zinc-200",
|
173
|
+
divideX: "1px",
|
174
|
+
divideColor: "zinc-200",
|
175
|
+
rounded: "lg",
|
176
|
+
overflow: "hidden"
|
177
|
+
}, props, {
|
178
|
+
children: children
|
179
|
+
}));
|
180
|
+
}
|
181
|
+
function ButtonBarButton(_a) {
|
182
|
+
var {
|
183
|
+
icon,
|
184
|
+
children
|
185
|
+
} = _a,
|
186
|
+
props = __rest$1(_a, ["icon", "children"]);
|
187
|
+
return jsxRuntime.jsxs(ui.Button, Object.assign({
|
188
|
+
scheme: "dark",
|
189
|
+
size: "sm",
|
190
|
+
aspectRatio: icon && !children ? "square" : undefined,
|
191
|
+
variant: "borderless",
|
192
|
+
dflex: true,
|
193
|
+
alignItems: "center",
|
194
|
+
placeContent: "center",
|
195
|
+
gap: "2"
|
196
|
+
}, props, {
|
197
|
+
children: [icon && jsxRuntime.jsx(ui.Icon, {
|
198
|
+
path: icon
|
199
|
+
}), children]
|
200
|
+
}));
|
201
|
+
}
|
202
|
+
|
164
203
|
function InvalidateButton(_a) {
|
165
204
|
var {
|
166
205
|
pathOrPermalink
|
@@ -171,12 +210,7 @@ function InvalidateButton(_a) {
|
|
171
210
|
const invalidate = api.useMutate(mutation, {
|
172
211
|
successMsg: "Page successfully invalidated"
|
173
212
|
});
|
174
|
-
return jsxRuntime.jsx(
|
175
|
-
scheme: "dark",
|
176
|
-
variant: "glass",
|
177
|
-
size: "md",
|
178
|
-
corners: "square",
|
179
|
-
aspectRatio: "square",
|
213
|
+
return jsxRuntime.jsx(ButtonBarButton, Object.assign({
|
180
214
|
title: "Regenerate",
|
181
215
|
disabled: mutation.isLoading,
|
182
216
|
onClick: invalidate,
|
@@ -1468,1004 +1502,1023 @@ function TableTopBar(_a) {
|
|
1468
1502
|
}));
|
1469
1503
|
}
|
1470
1504
|
|
1471
|
-
|
1472
|
-
|
1473
|
-
|
1474
|
-
|
1475
|
-
|
1476
|
-
|
1477
|
-
|
1478
|
-
|
1479
|
-
return data;
|
1505
|
+
function compareValues(a, b, order) {
|
1506
|
+
if (a < b) {
|
1507
|
+
return order === 'asc' ? -1 : 1;
|
1508
|
+
}
|
1509
|
+
if (a > b) {
|
1510
|
+
return order === 'asc' ? 1 : -1;
|
1511
|
+
}
|
1512
|
+
return 0;
|
1480
1513
|
}
|
1481
|
-
|
1482
|
-
|
1483
|
-
|
1484
|
-
|
1485
|
-
|
1486
|
-
|
1487
|
-
|
1488
|
-
|
1489
|
-
|
1490
|
-
|
1491
|
-
|
1492
|
-
|
1493
|
-
|
1494
|
-
|
1495
|
-
|
1496
|
-
|
1497
|
-
invalidateQueriesOnSuccess = true,
|
1498
|
-
invalidateQueryKey,
|
1499
|
-
retryText = "Retry",
|
1500
|
-
cancelLabel = "Cancel",
|
1501
|
-
saveLabel,
|
1502
|
-
size = "lg",
|
1503
|
-
title,
|
1504
|
-
form: form$1,
|
1505
|
-
show,
|
1506
|
-
onClose,
|
1507
|
-
formikProps
|
1508
|
-
} = _a,
|
1509
|
-
props = __rest$1(_a, ["initialValues", "itemLabel", "queryId", "api", "queryFetchOptions", "querySaveOptions", "onSuccess", "onFetchError", "fetchErrorMsg", "onSaveError", "saveErrorMsg", "fetchToFormData", "formToQueryData", "invalidateQueriesOnSuccess", "invalidateQueryKey", "retryText", "cancelLabel", "saveLabel", "size", "title", "form", "show", "onClose", "formikProps"]);
|
1510
|
-
const {
|
1511
|
-
isInitialLoading,
|
1512
|
-
isFetching,
|
1513
|
-
data,
|
1514
|
-
isError,
|
1515
|
-
error /*, error*/,
|
1516
|
-
refetch
|
1517
|
-
} = api.useApiQuery(api$1.queryKey, api$1.get, queryId, Object.assign({
|
1518
|
-
enabled: !( /*queryId == 0 || */queryId == "" || queryId == null || queryId == undefined),
|
1519
|
-
onError: onFetchError
|
1520
|
-
}, queryFetchOptions));
|
1521
|
-
// const [activeTab, setActiveTab] = React.useState(form && Array.isArray(form) ? form[0].key : "");
|
1522
|
-
// const [showTab, setShowTab] = React.useState(true);
|
1523
|
-
const mutation = invalidateQueriesOnSuccess ? api.useInvalidateParentMutation(api$1.upsert, invalidateQueryKey !== null && invalidateQueryKey !== void 0 ? invalidateQueryKey : api$1.queryKey, querySaveOptions) : api.useApiMutation(api$1.upsert, api$1.queryKey, queryId, querySaveOptions);
|
1524
|
-
const retry = React__default["default"].useCallback(() => refetch(), [refetch]);
|
1525
|
-
const saveItem = React__default["default"].useCallback((item, actions) => __awaiter(this, void 0, void 0, function* () {
|
1526
|
-
// Clear mutation error if any
|
1527
|
-
mutation.reset();
|
1528
|
-
const formItem = formToQueryData ? formToQueryData(item) : Object.assign({}, item);
|
1529
|
-
yield mutation.mutateAsync(formItem).then(response => {
|
1530
|
-
var _a;
|
1531
|
-
if (onSuccess) onSuccess(formItem, response);else reactToastify.toast.success(`${title ? title(formItem) : (_a = formItem.name) !== null && _a !== void 0 ? _a : formItem.title} ${queryId ? "saved" : "created"}`);
|
1532
|
-
// closing delete modal
|
1533
|
-
onClose === null || onClose === void 0 ? void 0 : onClose();
|
1534
|
-
}).catch(error => {
|
1535
|
-
var _a;
|
1536
|
-
console.error("on error", error);
|
1537
|
-
if (onSaveError) onSaveError(item);else reactToastify.toast.error(`Couldn't save ${title ? title(formItem) : (_a = formItem.name) !== null && _a !== void 0 ? _a : formItem.title}`);
|
1538
|
-
actions.setSubmitting(false);
|
1514
|
+
|
1515
|
+
function orderBy(arr, criteria, orders) {
|
1516
|
+
return arr.slice().sort((a, b) => {
|
1517
|
+
const ordersLength = orders.length;
|
1518
|
+
for (let i = 0; i < criteria.length; i++) {
|
1519
|
+
const order = ordersLength > i ? orders[i] : orders[ordersLength - 1];
|
1520
|
+
const criterion = criteria[i];
|
1521
|
+
const criterionIsFunction = typeof criterion === 'function';
|
1522
|
+
const valueA = criterionIsFunction ? criterion(a) : a[criterion];
|
1523
|
+
const valueB = criterionIsFunction ? criterion(b) : b[criterion];
|
1524
|
+
const result = compareValues(valueA, valueB, order);
|
1525
|
+
if (result !== 0) {
|
1526
|
+
return result;
|
1527
|
+
}
|
1528
|
+
}
|
1529
|
+
return 0;
|
1539
1530
|
});
|
1540
|
-
}), [mutation, formToQueryData, onSuccess, onSaveError, onClose]);
|
1541
|
-
// const switchTab = React.useCallback((tab: string) =>
|
1542
|
-
// {
|
1543
|
-
// setActiveTab(tab);
|
1544
|
-
// setShowTab(false);
|
1545
|
-
// setTimeout(function ()
|
1546
|
-
// {
|
1547
|
-
// setActiveTab(tab);
|
1548
|
-
// setShowTab(true);
|
1549
|
-
// }, 150);
|
1550
|
-
// }, [setActiveTab])
|
1551
|
-
return jsxRuntime.jsxs(ui.Modal, Object.assign({
|
1552
|
-
size: size,
|
1553
|
-
show: show,
|
1554
|
-
onClose: onClose,
|
1555
|
-
scheme: "light",
|
1556
|
-
transition: true
|
1557
|
-
}, props, {
|
1558
|
-
children: [jsxRuntime.jsxs(ui.Modal.Header, {
|
1559
|
-
children: [!isInitialLoading && queryId && `Edit ${title ? title(data) : (_d = (_c = (_b = data === null || data === void 0 ? void 0 : data["name"]) !== null && _b !== void 0 ? _b : data === null || data === void 0 ? void 0 : data["title"]) !== null && _c !== void 0 ? _c : data === null || data === void 0 ? void 0 : data["name"]) !== null && _d !== void 0 ? _d : ""}`, !queryId && `Create new ${itemLabel !== null && itemLabel !== void 0 ? itemLabel : "item"}`, Array.isArray(form$1) && jsxRuntime.jsx(jsxRuntime.Fragment, {})
|
1560
|
-
// <ul className="nav nav-bold nav-pills">
|
1561
|
-
// {form.map(item =>
|
1562
|
-
// <li key={item.key} className="nav-item cursor-pointer bg-hover-light rounded" onClick={() => switchTab(item.key)}>
|
1563
|
-
// <span className={clsx("nav-link", activeTab === item.key && "active")} data-toggle="tab">{item.label}</span>
|
1564
|
-
// </li>
|
1565
|
-
// )}
|
1566
|
-
// </ul>
|
1567
|
-
]
|
1568
|
-
}), isInitialLoading && jsxRuntime.jsx(ui.Modal.Body, {
|
1569
|
-
children: jsxRuntime.jsx(components.QueryLoadingState, {
|
1570
|
-
minW: "72"
|
1571
|
-
})
|
1572
|
-
}), isError && jsxRuntime.jsx(ui.Modal.Body, {
|
1573
|
-
children: jsxRuntime.jsx(components.RetryOnError, {
|
1574
|
-
label: `${fetchErrorMsg} ${error}`,
|
1575
|
-
onClick: retry
|
1576
|
-
})
|
1577
|
-
}), !isInitialLoading && !isError && jsxRuntime.jsx(jsxRuntime.Fragment, {
|
1578
|
-
children: jsxRuntime.jsx(formik.Formik
|
1579
|
-
// initialValues={fetchToFormData && queryId && data ? fetchToFormData(nonNullValues(data)) : nonNullValues(data) ?? initialValues(data) ?? {}}
|
1580
|
-
, Object.assign({
|
1581
|
-
// initialValues={fetchToFormData && queryId && data ? fetchToFormData(nonNullValues(data)) : nonNullValues(data) ?? initialValues(data) ?? {}}
|
1582
|
-
initialValues: fetchToFormData && queryId && data ? fetchToFormData(nonNullValues$1(data)) : (_e = nonNullValues$1(initialValues(data))) !== null && _e !== void 0 ? _e : {},
|
1583
|
-
onSubmit: saveItem
|
1584
|
-
}, formikProps, {
|
1585
|
-
children: ({
|
1586
|
-
setFieldValue,
|
1587
|
-
dirty,
|
1588
|
-
handleSubmit,
|
1589
|
-
isValid,
|
1590
|
-
values
|
1591
|
-
}) => jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
1592
|
-
children: [jsxRuntime.jsx(ui.Modal.Body, {
|
1593
|
-
pb: "6",
|
1594
|
-
children: jsxRuntime.jsxs(formik.Form, {
|
1595
|
-
children: [/*#__PURE__*/React__default["default"].isValidElement(form$1) && form$1, Array.isArray(form$1) && jsxRuntime.jsx(form.FormRenderer, {
|
1596
|
-
form: form$1
|
1597
|
-
}), react.isFunction(form$1) && jsxRuntime.jsx(form.FormRenderer, {
|
1598
|
-
form: form$1(data !== null && data !== void 0 ? data : values)
|
1599
|
-
})]
|
1600
|
-
})
|
1601
|
-
}), jsxRuntime.jsxs(ui.Modal.Footer, {
|
1602
|
-
dflex: true,
|
1603
|
-
placeContent: "end",
|
1604
|
-
spaceX: "3",
|
1605
|
-
children: [jsxRuntime.jsx(ui.Button, {
|
1606
|
-
disabled: mutation.isLoading,
|
1607
|
-
onClick: onClose,
|
1608
|
-
variant: "borderless",
|
1609
|
-
me: "2",
|
1610
|
-
children: cancelLabel
|
1611
|
-
}), jsxRuntime.jsx(ui.Button, {
|
1612
|
-
type: "submit",
|
1613
|
-
disabled: !dirty || mutation.isLoading /* || !isValid*/,
|
1614
|
-
onClick: () => handleSubmit(),
|
1615
|
-
children: saveLabel ? saveLabel : queryId ? "Update" : "Create"
|
1616
|
-
})]
|
1617
|
-
})]
|
1618
|
-
})
|
1619
|
-
}))
|
1620
|
-
}), mutation.isLoading && jsxRuntime.jsx(components.ModalLoadingOverlay, {})]
|
1621
|
-
}));
|
1622
1531
|
}
|
1623
1532
|
|
1624
|
-
function
|
1625
|
-
|
1626
|
-
fn,
|
1627
|
-
transformFn,
|
1628
|
-
config,
|
1629
|
-
onClose,
|
1630
|
-
queryId,
|
1631
|
-
invalidateQueryKey
|
1632
|
-
}) {
|
1633
|
-
const {
|
1634
|
-
data,
|
1635
|
-
isFetching
|
1636
|
-
} = api.useApiQuery(api$1.queryKey, fn === "get" || fn === "getTransformed" ? api$1.get : api$1.getAll, undefined, {
|
1637
|
-
retryOnMount: false,
|
1638
|
-
refetchOnMount: false,
|
1639
|
-
refetchOnWindowFocus: false
|
1640
|
-
});
|
1641
|
-
const transformedData = React__default["default"].useMemo(() => {
|
1642
|
-
if (data && (fn === "getTransformed" || fn === "getAllTransformed")) {
|
1643
|
-
if (!transformFn) console.warn(`QueryWrapperDialog: you forgot to pass transformFn as parameter for fn ${fn}`);
|
1644
|
-
// @ts-ignore
|
1645
|
-
return transformFn === null || transformFn === void 0 ? void 0 : transformFn(data);
|
1646
|
-
}
|
1647
|
-
return data;
|
1648
|
-
}, [data, fn, transformFn]);
|
1649
|
-
if (isFetching) return null;
|
1650
|
-
// @ts-ignore
|
1651
|
-
return jsxRuntime.jsx(ItemEditDialog$1, Object.assign({}, config(transformedData), {
|
1652
|
-
queryId: queryId,
|
1653
|
-
invalidateQueryKey: invalidateQueryKey,
|
1654
|
-
show: true,
|
1655
|
-
onClose: onClose
|
1656
|
-
}));
|
1533
|
+
function sortBy(arr, criteria) {
|
1534
|
+
return orderBy(arr, criteria, ['asc']);
|
1657
1535
|
}
|
1658
1536
|
|
1659
|
-
function
|
1660
|
-
|
1661
|
-
|
1662
|
-
|
1663
|
-
|
1664
|
-
|
1665
|
-
|
1666
|
-
|
1667
|
-
|
1668
|
-
isFetching,
|
1669
|
-
isError
|
1670
|
-
} = api.useApiQueries(queries.map(q => ({
|
1671
|
-
queryKey: q.api.queryKey,
|
1672
|
-
queryFn: q.fn == "get" ? q.api.get : q.api.getAll,
|
1673
|
-
queryOptions: {
|
1674
|
-
cacheTime: q.cache === false ? 0 : undefined,
|
1675
|
-
staleTime: q.cache === false ? 0 : undefined
|
1537
|
+
function noop() { }
|
1538
|
+
|
1539
|
+
function getSymbols(object) {
|
1540
|
+
return Object.getOwnPropertySymbols(object).filter(symbol => Object.prototype.propertyIsEnumerable.call(object, symbol));
|
1541
|
+
}
|
1542
|
+
|
1543
|
+
function getTag(value) {
|
1544
|
+
if (value == null) {
|
1545
|
+
return value === undefined ? '[object Undefined]' : '[object Null]';
|
1676
1546
|
}
|
1677
|
-
|
1678
|
-
const transformedData = React__default["default"].useMemo(() => {
|
1679
|
-
return data === null || data === void 0 ? void 0 : data.map((d, index) => {
|
1680
|
-
var _a, _b;
|
1681
|
-
return queries[index].transformFn ? (_b = (_a = queries[index]) === null || _a === void 0 ? void 0 : _a.transformFn) === null || _b === void 0 ? void 0 : _b.call(_a, d) : d;
|
1682
|
-
});
|
1683
|
-
}, [data, queries]);
|
1684
|
-
// TODO This is not really good
|
1685
|
-
// So instead, add a isPreloading and isPreloadingError to ItemEditDialog to handle the cases
|
1686
|
-
// if (isFetching)
|
1687
|
-
// return null
|
1688
|
-
// @ts-ignore
|
1689
|
-
return jsxRuntime.jsx(ItemEditDialog$1, Object.assign({
|
1690
|
-
isPreloading: isFetching
|
1691
|
-
}, config(...transformedData), {
|
1692
|
-
queryId: queryId,
|
1693
|
-
invalidateQueryKey: invalidateQueryKey,
|
1694
|
-
show: true,
|
1695
|
-
onClose: onClose
|
1696
|
-
}));
|
1547
|
+
return Object.prototype.toString.call(value);
|
1697
1548
|
}
|
1698
1549
|
|
1699
|
-
|
1700
|
-
|
1701
|
-
|
1702
|
-
|
1703
|
-
|
1704
|
-
|
1705
|
-
|
1706
|
-
|
1707
|
-
|
1708
|
-
|
1709
|
-
|
1710
|
-
|
1711
|
-
|
1712
|
-
|
1713
|
-
|
1714
|
-
|
1715
|
-
|
1716
|
-
|
1717
|
-
|
1718
|
-
|
1719
|
-
|
1720
|
-
|
1721
|
-
|
1722
|
-
|
1550
|
+
const regexpTag = '[object RegExp]';
|
1551
|
+
const stringTag = '[object String]';
|
1552
|
+
const numberTag = '[object Number]';
|
1553
|
+
const booleanTag = '[object Boolean]';
|
1554
|
+
const argumentsTag = '[object Arguments]';
|
1555
|
+
const symbolTag = '[object Symbol]';
|
1556
|
+
const dateTag = '[object Date]';
|
1557
|
+
const mapTag = '[object Map]';
|
1558
|
+
const setTag = '[object Set]';
|
1559
|
+
const arrayTag = '[object Array]';
|
1560
|
+
const functionTag = '[object Function]';
|
1561
|
+
const arrayBufferTag = '[object ArrayBuffer]';
|
1562
|
+
const objectTag = '[object Object]';
|
1563
|
+
const errorTag = '[object Error]';
|
1564
|
+
const dataViewTag = '[object DataView]';
|
1565
|
+
const uint8ArrayTag = '[object Uint8Array]';
|
1566
|
+
const uint8ClampedArrayTag = '[object Uint8ClampedArray]';
|
1567
|
+
const uint16ArrayTag = '[object Uint16Array]';
|
1568
|
+
const uint32ArrayTag = '[object Uint32Array]';
|
1569
|
+
const bigUint64ArrayTag = '[object BigUint64Array]';
|
1570
|
+
const int8ArrayTag = '[object Int8Array]';
|
1571
|
+
const int16ArrayTag = '[object Int16Array]';
|
1572
|
+
const int32ArrayTag = '[object Int32Array]';
|
1573
|
+
const bigInt64ArrayTag = '[object BigInt64Array]';
|
1574
|
+
const float32ArrayTag = '[object Float32Array]';
|
1575
|
+
const float64ArrayTag = '[object Float64Array]';
|
1576
|
+
|
1577
|
+
function isPlainObject(value) {
|
1578
|
+
if (!value || typeof value !== 'object') {
|
1579
|
+
return false;
|
1580
|
+
}
|
1581
|
+
const proto = Object.getPrototypeOf(value);
|
1582
|
+
const hasObjectPrototype = proto === null ||
|
1583
|
+
proto === Object.prototype ||
|
1584
|
+
Object.getPrototypeOf(proto) === null;
|
1585
|
+
if (!hasObjectPrototype) {
|
1586
|
+
return false;
|
1587
|
+
}
|
1588
|
+
return Object.prototype.toString.call(value) === '[object Object]';
|
1723
1589
|
}
|
1724
1590
|
|
1725
|
-
function
|
1726
|
-
|
1727
|
-
itemLabel,
|
1728
|
-
queryId = "",
|
1729
|
-
api: api$1,
|
1730
|
-
invalidateQueriesOnSuccess = true,
|
1731
|
-
invalidateQueryKey,
|
1732
|
-
size = "lg",
|
1733
|
-
show,
|
1734
|
-
onClose
|
1735
|
-
} = _a,
|
1736
|
-
props = __rest$1(_a, ["itemLabel", "queryId", "api", "invalidateQueriesOnSuccess", "invalidateQueryKey", "size", "show", "onClose"]);
|
1737
|
-
const mutation = invalidateQueriesOnSuccess ? api.useInvalidateParentMutation(api$1.delete, invalidateQueryKey !== null && invalidateQueryKey !== void 0 ? invalidateQueryKey : api$1.queryKey) : api.useApiMutation(api$1.upsert, api$1.queryKey);
|
1738
|
-
const mutate = api.useMutate(mutation, {
|
1739
|
-
onSuccess: () => onClose === null || onClose === void 0 ? void 0 : onClose()
|
1740
|
-
});
|
1741
|
-
const handleDelete = React__default["default"].useCallback(() => mutate(queryId), [mutate, queryId]);
|
1742
|
-
return jsxRuntime.jsxs(ui.Modal, Object.assign({
|
1743
|
-
size: size,
|
1744
|
-
show: show,
|
1745
|
-
onClose: onClose,
|
1746
|
-
scheme: "danger",
|
1747
|
-
variant: "glass",
|
1748
|
-
transition: true
|
1749
|
-
}, props, {
|
1750
|
-
children: [jsxRuntime.jsx(ui.Modal.Header, {
|
1751
|
-
children: `Delete ${itemLabel}`
|
1752
|
-
}), jsxRuntime.jsxs(ui.Modal.Body, {
|
1753
|
-
pb: "6",
|
1754
|
-
children: ["Do you really want to delete ", itemLabel, "?"]
|
1755
|
-
}), jsxRuntime.jsxs(ui.Modal.Footer, {
|
1756
|
-
dflex: true,
|
1757
|
-
placeContent: "end",
|
1758
|
-
spaceX: "3",
|
1759
|
-
children: [jsxRuntime.jsx(ui.Button, {
|
1760
|
-
disabled: mutation.isLoading,
|
1761
|
-
onClick: onClose,
|
1762
|
-
variant: "borderless",
|
1763
|
-
scheme: "secondary",
|
1764
|
-
me: "2",
|
1765
|
-
children: "Cancel"
|
1766
|
-
}), jsxRuntime.jsx(ui.Button, {
|
1767
|
-
scheme: "danger",
|
1768
|
-
disabled: mutation.isLoading,
|
1769
|
-
onClick: handleDelete,
|
1770
|
-
children: "Delete"
|
1771
|
-
})]
|
1772
|
-
}), mutation.isLoading && jsxRuntime.jsx(components.ModalLoadingOverlay, {})]
|
1773
|
-
}));
|
1591
|
+
function eq(value, other) {
|
1592
|
+
return value === other || (Number.isNaN(value) && Number.isNaN(other));
|
1774
1593
|
}
|
1775
1594
|
|
1776
|
-
|
1777
|
-
|
1778
|
-
|
1779
|
-
|
1780
|
-
|
1781
|
-
|
1782
|
-
|
1783
|
-
|
1784
|
-
|
1785
|
-
|
1786
|
-
|
1787
|
-
|
1788
|
-
|
1789
|
-
|
1790
|
-
|
1791
|
-
|
1792
|
-
|
1793
|
-
|
1794
|
-
|
1795
|
-
|
1796
|
-
|
1797
|
-
|
1798
|
-
|
1799
|
-
|
1800
|
-
|
1801
|
-
|
1802
|
-
setDialog(editView.render({
|
1803
|
-
show: true,
|
1804
|
-
onClose: onCloseDialog
|
1805
|
-
}));
|
1806
|
-
} else {
|
1807
|
-
setDialog(jsxRuntime.jsx(DialogRenderer, {
|
1808
|
-
onClose: onCloseDialog,
|
1809
|
-
config: editView,
|
1810
|
-
queryId: item.id,
|
1811
|
-
invalidateQueryKey: queryKey
|
1812
|
-
}));
|
1813
|
-
}
|
1814
|
-
break;
|
1815
|
-
}
|
1816
|
-
case "delete":
|
1817
|
-
{
|
1818
|
-
setDialog(jsxRuntime.jsx(ItemDeleteDialog, Object.assign({
|
1819
|
-
show: true,
|
1820
|
-
onClose: onCloseDialog,
|
1821
|
-
queryId: item.id,
|
1822
|
-
invalidateQueryKey: queryKey
|
1823
|
-
}, deleteItem, {
|
1824
|
-
itemLabel: react.runIfFn(deleteItem.itemLabel, item)
|
1825
|
-
})));
|
1826
|
-
// TODO
|
1827
|
-
// const { initialValues, ...props } = editItem!!
|
1828
|
-
// setDialog(<ItemEditDialog {...props} initialValues={runIfFn(initialValues, item)} show queryId={item?.id} onClose={onCloseDialog} />)
|
1829
|
-
break;
|
1595
|
+
function isEqualWith(a, b, areValuesEqual) {
|
1596
|
+
return isEqualWithImpl(a, b, undefined, undefined, undefined, undefined, areValuesEqual);
|
1597
|
+
}
|
1598
|
+
function isEqualWithImpl(a, b, property, aParent, bParent, stack, areValuesEqual) {
|
1599
|
+
const result = areValuesEqual(a, b, property, aParent, bParent, stack);
|
1600
|
+
if (result !== undefined) {
|
1601
|
+
return result;
|
1602
|
+
}
|
1603
|
+
if (typeof a === typeof b) {
|
1604
|
+
switch (typeof a) {
|
1605
|
+
case 'bigint':
|
1606
|
+
case 'string':
|
1607
|
+
case 'boolean':
|
1608
|
+
case 'symbol':
|
1609
|
+
case 'undefined': {
|
1610
|
+
return a === b;
|
1611
|
+
}
|
1612
|
+
case 'number': {
|
1613
|
+
return a === b || Object.is(a, b);
|
1614
|
+
}
|
1615
|
+
case 'function': {
|
1616
|
+
return a === b;
|
1617
|
+
}
|
1618
|
+
case 'object': {
|
1619
|
+
return areObjectsEqual(a, b, stack, areValuesEqual);
|
1620
|
+
}
|
1830
1621
|
}
|
1831
1622
|
}
|
1832
|
-
|
1833
|
-
const Provider = provider;
|
1834
|
-
const value = {
|
1835
|
-
dialog,
|
1836
|
-
onAction
|
1837
|
-
};
|
1838
|
-
return jsxRuntime.jsx(Provider, {
|
1839
|
-
value: value,
|
1840
|
-
children: children
|
1841
|
-
});
|
1623
|
+
return areObjectsEqual(a, b, stack, areValuesEqual);
|
1842
1624
|
}
|
1843
|
-
|
1844
|
-
|
1845
|
-
|
1846
|
-
|
1847
|
-
|
1848
|
-
|
1849
|
-
|
1850
|
-
|
1851
|
-
|
1852
|
-
|
1853
|
-
|
1854
|
-
|
1855
|
-
|
1856
|
-
|
1857
|
-
|
1858
|
-
|
1859
|
-
|
1860
|
-
|
1861
|
-
|
1862
|
-
|
1863
|
-
|
1864
|
-
|
1865
|
-
|
1866
|
-
|
1867
|
-
|
1868
|
-
|
1869
|
-
|
1870
|
-
|
1871
|
-
|
1872
|
-
|
1873
|
-
|
1874
|
-
|
1875
|
-
|
1876
|
-
|
1877
|
-
|
1878
|
-
|
1879
|
-
|
1880
|
-
|
1881
|
-
|
1882
|
-
|
1883
|
-
|
1884
|
-
|
1885
|
-
|
1886
|
-
|
1887
|
-
|
1888
|
-
|
1889
|
-
|
1890
|
-
|
1891
|
-
|
1892
|
-
|
1893
|
-
|
1894
|
-
|
1895
|
-
|
1896
|
-
|
1897
|
-
|
1898
|
-
|
1899
|
-
|
1900
|
-
|
1901
|
-
|
1902
|
-
|
1903
|
-
|
1904
|
-
|
1905
|
-
|
1906
|
-
|
1907
|
-
|
1908
|
-
|
1625
|
+
function areObjectsEqual(a, b, stack, areValuesEqual) {
|
1626
|
+
if (Object.is(a, b)) {
|
1627
|
+
return true;
|
1628
|
+
}
|
1629
|
+
let aTag = getTag(a);
|
1630
|
+
let bTag = getTag(b);
|
1631
|
+
if (aTag === argumentsTag) {
|
1632
|
+
aTag = objectTag;
|
1633
|
+
}
|
1634
|
+
if (bTag === argumentsTag) {
|
1635
|
+
bTag = objectTag;
|
1636
|
+
}
|
1637
|
+
if (aTag !== bTag) {
|
1638
|
+
return false;
|
1639
|
+
}
|
1640
|
+
switch (aTag) {
|
1641
|
+
case stringTag:
|
1642
|
+
return a.toString() === b.toString();
|
1643
|
+
case numberTag: {
|
1644
|
+
const x = a.valueOf();
|
1645
|
+
const y = b.valueOf();
|
1646
|
+
return eq(x, y);
|
1647
|
+
}
|
1648
|
+
case booleanTag:
|
1649
|
+
case dateTag:
|
1650
|
+
case symbolTag:
|
1651
|
+
return Object.is(a.valueOf(), b.valueOf());
|
1652
|
+
case regexpTag: {
|
1653
|
+
return a.source === b.source && a.flags === b.flags;
|
1654
|
+
}
|
1655
|
+
case functionTag: {
|
1656
|
+
return a === b;
|
1657
|
+
}
|
1658
|
+
}
|
1659
|
+
stack = stack ?? new Map();
|
1660
|
+
const aStack = stack.get(a);
|
1661
|
+
const bStack = stack.get(b);
|
1662
|
+
if (aStack != null && bStack != null) {
|
1663
|
+
return aStack === b;
|
1664
|
+
}
|
1665
|
+
stack.set(a, b);
|
1666
|
+
stack.set(b, a);
|
1667
|
+
try {
|
1668
|
+
switch (aTag) {
|
1669
|
+
case mapTag: {
|
1670
|
+
if (a.size !== b.size) {
|
1671
|
+
return false;
|
1672
|
+
}
|
1673
|
+
for (const [key, value] of a.entries()) {
|
1674
|
+
if (!b.has(key) || !isEqualWithImpl(value, b.get(key), key, a, b, stack, areValuesEqual)) {
|
1675
|
+
return false;
|
1676
|
+
}
|
1677
|
+
}
|
1678
|
+
return true;
|
1679
|
+
}
|
1680
|
+
case setTag: {
|
1681
|
+
if (a.size !== b.size) {
|
1682
|
+
return false;
|
1683
|
+
}
|
1684
|
+
const aValues = Array.from(a.values());
|
1685
|
+
const bValues = Array.from(b.values());
|
1686
|
+
for (let i = 0; i < aValues.length; i++) {
|
1687
|
+
const aValue = aValues[i];
|
1688
|
+
const index = bValues.findIndex(bValue => {
|
1689
|
+
return isEqualWithImpl(aValue, bValue, undefined, a, b, stack, areValuesEqual);
|
1690
|
+
});
|
1691
|
+
if (index === -1) {
|
1692
|
+
return false;
|
1693
|
+
}
|
1694
|
+
bValues.splice(index, 1);
|
1695
|
+
}
|
1696
|
+
return true;
|
1697
|
+
}
|
1698
|
+
case arrayTag:
|
1699
|
+
case uint8ArrayTag:
|
1700
|
+
case uint8ClampedArrayTag:
|
1701
|
+
case uint16ArrayTag:
|
1702
|
+
case uint32ArrayTag:
|
1703
|
+
case bigUint64ArrayTag:
|
1704
|
+
case int8ArrayTag:
|
1705
|
+
case int16ArrayTag:
|
1706
|
+
case int32ArrayTag:
|
1707
|
+
case bigInt64ArrayTag:
|
1708
|
+
case float32ArrayTag:
|
1709
|
+
case float64ArrayTag: {
|
1710
|
+
if (typeof Buffer !== 'undefined' && Buffer.isBuffer(a) !== Buffer.isBuffer(b)) {
|
1711
|
+
return false;
|
1712
|
+
}
|
1713
|
+
if (a.length !== b.length) {
|
1714
|
+
return false;
|
1715
|
+
}
|
1716
|
+
for (let i = 0; i < a.length; i++) {
|
1717
|
+
if (!isEqualWithImpl(a[i], b[i], i, a, b, stack, areValuesEqual)) {
|
1718
|
+
return false;
|
1719
|
+
}
|
1720
|
+
}
|
1721
|
+
return true;
|
1722
|
+
}
|
1723
|
+
case arrayBufferTag: {
|
1724
|
+
if (a.byteLength !== b.byteLength) {
|
1725
|
+
return false;
|
1726
|
+
}
|
1727
|
+
return areObjectsEqual(new Uint8Array(a), new Uint8Array(b), stack, areValuesEqual);
|
1728
|
+
}
|
1729
|
+
case dataViewTag: {
|
1730
|
+
if (a.byteLength !== b.byteLength || a.byteOffset !== b.byteOffset) {
|
1731
|
+
return false;
|
1732
|
+
}
|
1733
|
+
return areObjectsEqual(new Uint8Array(a), new Uint8Array(b), stack, areValuesEqual);
|
1734
|
+
}
|
1735
|
+
case errorTag: {
|
1736
|
+
return a.name === b.name && a.message === b.message;
|
1737
|
+
}
|
1738
|
+
case objectTag: {
|
1739
|
+
const areEqualInstances = areObjectsEqual(a.constructor, b.constructor, stack, areValuesEqual) ||
|
1740
|
+
(isPlainObject(a) && isPlainObject(b));
|
1741
|
+
if (!areEqualInstances) {
|
1742
|
+
return false;
|
1743
|
+
}
|
1744
|
+
const aKeys = [...Object.keys(a), ...getSymbols(a)];
|
1745
|
+
const bKeys = [...Object.keys(b), ...getSymbols(b)];
|
1746
|
+
if (aKeys.length !== bKeys.length) {
|
1747
|
+
return false;
|
1748
|
+
}
|
1749
|
+
for (let i = 0; i < aKeys.length; i++) {
|
1750
|
+
const propKey = aKeys[i];
|
1751
|
+
const aProp = a[propKey];
|
1752
|
+
if (!Object.hasOwn(b, propKey)) {
|
1753
|
+
return false;
|
1754
|
+
}
|
1755
|
+
const bProp = b[propKey];
|
1756
|
+
if (!isEqualWithImpl(aProp, bProp, propKey, a, b, stack, areValuesEqual)) {
|
1757
|
+
return false;
|
1758
|
+
}
|
1759
|
+
}
|
1760
|
+
return true;
|
1761
|
+
}
|
1762
|
+
default: {
|
1763
|
+
return false;
|
1764
|
+
}
|
1765
|
+
}
|
1766
|
+
}
|
1767
|
+
finally {
|
1768
|
+
stack.delete(a);
|
1769
|
+
stack.delete(b);
|
1770
|
+
}
|
1909
1771
|
}
|
1910
1772
|
|
1911
|
-
function
|
1912
|
-
|
1913
|
-
id,
|
1914
|
-
api: api$1,
|
1915
|
-
status,
|
1916
|
-
invalidateQueryKey
|
1917
|
-
} = _a,
|
1918
|
-
props = __rest$1(_a, ["id", "api", "status", "invalidateQueryKey"]);
|
1919
|
-
const isDraft = status == "draft";
|
1920
|
-
const mutation = api.useInvalidateParentMutation(isDraft ? api$1.publish : api$1.unpublish, invalidateQueryKey !== null && invalidateQueryKey !== void 0 ? invalidateQueryKey : api$1.queryKey, {
|
1921
|
-
networkMode: "always"
|
1922
|
-
});
|
1923
|
-
const publish = React__default["default"].useCallback(event => {
|
1924
|
-
event === null || event === void 0 ? void 0 : event.preventDefault();
|
1925
|
-
event === null || event === void 0 ? void 0 : event.stopPropagation();
|
1926
|
-
mutation.reset();
|
1927
|
-
mutation.mutateAsync(id).then(() => reactToastify.toast.success(isDraft ? "Published!" : "Unpublished!")).catch(error => reactToastify.toast.error(`Error: ${error}`));
|
1928
|
-
}, [mutation, id]);
|
1929
|
-
return jsxRuntime.jsx(ui.Button, Object.assign({
|
1930
|
-
variant: "borderless",
|
1931
|
-
corners: "square",
|
1932
|
-
scheme: "dark",
|
1933
|
-
onClick: publish
|
1934
|
-
}, props, {
|
1935
|
-
children: jsxRuntime.jsx(ui.Icon, {
|
1936
|
-
path: isDraft ? mdiPublish : mdiPublishOff,
|
1937
|
-
size: "sm"
|
1938
|
-
})
|
1939
|
-
}));
|
1773
|
+
function isEqual(a, b) {
|
1774
|
+
return isEqualWith(a, b, noop);
|
1940
1775
|
}
|
1941
1776
|
|
1942
|
-
function
|
1943
|
-
|
1944
|
-
|
1945
|
-
|
1946
|
-
|
1947
|
-
queryKey
|
1777
|
+
function TableFilters({
|
1778
|
+
form: form$1,
|
1779
|
+
initialValues,
|
1780
|
+
schema,
|
1781
|
+
processInput
|
1948
1782
|
}) {
|
1949
|
-
const
|
1950
|
-
|
1951
|
-
|
1952
|
-
|
1953
|
-
|
1954
|
-
|
1955
|
-
|
1956
|
-
|
1957
|
-
|
1958
|
-
|
1959
|
-
|
1960
|
-
|
1961
|
-
|
1962
|
-
|
1963
|
-
|
1964
|
-
|
1965
|
-
|
1966
|
-
|
1967
|
-
|
1968
|
-
|
1969
|
-
|
1783
|
+
const {
|
1784
|
+
showFilters
|
1785
|
+
} = useContext$1();
|
1786
|
+
const {
|
1787
|
+
getFilters,
|
1788
|
+
setFilters
|
1789
|
+
} = table.useTableContext();
|
1790
|
+
const handleSubmit = React__default["default"].useCallback((values, actions) => {
|
1791
|
+
var _a;
|
1792
|
+
const params = (_a = processInput === null || processInput === void 0 ? void 0 : processInput(values)) !== null && _a !== void 0 ? _a : values;
|
1793
|
+
if (!isEqual(params, getFilters())) setFilters(params);
|
1794
|
+
// setFilters(processInput?.(values) ?? values)
|
1795
|
+
actions.setSubmitting(false);
|
1796
|
+
}, [setFilters, processInput]);
|
1797
|
+
const handleReset = React__default["default"].useCallback(resetForm => {
|
1798
|
+
setFilters(initialValues);
|
1799
|
+
resetForm();
|
1800
|
+
}, [setFilters, initialValues]);
|
1801
|
+
React__default["default"].useEffect(() => setFilters(initialValues), []);
|
1802
|
+
return jsxRuntime.jsx(ui.Collapse, {
|
1803
|
+
in: showFilters,
|
1804
|
+
style: {
|
1805
|
+
overflow: showFilters ? "initial" : "hidden"
|
1806
|
+
},
|
1807
|
+
children: jsxRuntime.jsx("div", {
|
1808
|
+
p: "8",
|
1809
|
+
borderT: "px",
|
1810
|
+
borderB: "px",
|
1811
|
+
borderColor: "slate-100",
|
1812
|
+
children: jsxRuntime.jsx(form.FormProvider, {
|
1813
|
+
initialValues: form.mergeInitialFormValues(getFilters(), initialValues),
|
1814
|
+
onSubmit: handleSubmit,
|
1815
|
+
validationSchema: schema,
|
1816
|
+
enableReinitialize: true,
|
1817
|
+
children: props => jsxRuntime.jsxs("div", {
|
1818
|
+
dflex: true,
|
1819
|
+
gap: "3",
|
1820
|
+
placeContent: "start",
|
1821
|
+
children: [jsxRuntime.jsx(form.FormRenderer, {
|
1822
|
+
flexRow: true,
|
1823
|
+
w: "auto",
|
1824
|
+
form: form$1
|
1825
|
+
}), jsxRuntime.jsx(Buttons, {
|
1826
|
+
handleReset: () => handleReset(props.resetForm)
|
1827
|
+
})]
|
1970
1828
|
})
|
1971
|
-
})
|
1972
|
-
}
|
1829
|
+
})
|
1830
|
+
})
|
1973
1831
|
});
|
1974
1832
|
}
|
1975
|
-
function
|
1976
|
-
|
1977
|
-
|
1978
|
-
|
1979
|
-
props = __rest$1(_a, ["onClick"]);
|
1980
|
-
const handleClick = React__default["default"].useCallback(event => {
|
1981
|
-
event === null || event === void 0 ? void 0 : event.preventDefault();
|
1982
|
-
event === null || event === void 0 ? void 0 : event.stopPropagation();
|
1983
|
-
onClick === null || onClick === void 0 ? void 0 : onClick(event);
|
1984
|
-
}, [onClick]);
|
1985
|
-
return jsxRuntime.jsx(ui.Button, Object.assign({
|
1833
|
+
function Buttons({
|
1834
|
+
handleReset
|
1835
|
+
}) {
|
1836
|
+
return jsxRuntime.jsxs("div", {
|
1986
1837
|
dflex: true,
|
1987
|
-
|
1988
|
-
|
1989
|
-
|
1990
|
-
|
1991
|
-
|
1992
|
-
|
1993
|
-
|
1994
|
-
|
1995
|
-
|
1996
|
-
|
1997
|
-
}
|
1998
|
-
|
1999
|
-
|
2000
|
-
|
2001
|
-
|
2002
|
-
|
2003
|
-
|
2004
|
-
|
2005
|
-
|
2006
|
-
|
2007
|
-
|
2008
|
-
|
2009
|
-
|
2010
|
-
"delete": "dark",
|
2011
|
-
"publish": "dark",
|
2012
|
-
"custom": "dark"
|
2013
|
-
};
|
2014
|
-
|
2015
|
-
function useTableProps(api, table, rowActions) {
|
2016
|
-
const navigate = reactRouterDom.useNavigate();
|
2017
|
-
const openLink = hooks.useOpenLink();
|
2018
|
-
const {
|
2019
|
-
onAction
|
2020
|
-
} = useContext();
|
2021
|
-
const {
|
2022
|
-
onRowClick,
|
2023
|
-
columns: c
|
2024
|
-
} = table,
|
2025
|
-
props = __rest$1(table, ["onRowClick", "columns"]);
|
2026
|
-
const onRowClickHandler = React__default["default"].useCallback(item => {
|
2027
|
-
if ((onRowClick === null || onRowClick === void 0 ? void 0 : onRowClick.type) === "navigate") navigate(react.runIfFn(onRowClick.path, item));else if ((onRowClick === null || onRowClick === void 0 ? void 0 : onRowClick.type) == "link") openLink(`${process.env["NEXT_PUBLIC_WEBSITE_URL"]}/${react.runIfFn(onRowClick.path, item)}`);
|
2028
|
-
}, [navigate, onRowClick]);
|
2029
|
-
const columns = React__default["default"].useMemo(() => {
|
2030
|
-
const columns = table.columns.concat([]);
|
2031
|
-
if (rowActions) {
|
2032
|
-
columns.push(createColumnHelper().display({
|
2033
|
-
id: "actions",
|
2034
|
-
header: "Actions",
|
2035
|
-
cell: props => jsxRuntime.jsx(TableRowActionsView, {
|
2036
|
-
row: props.row,
|
2037
|
-
onAction: onAction,
|
2038
|
-
rowActions: rowActions,
|
2039
|
-
api: api,
|
2040
|
-
queryKey: api.queryKey
|
2041
|
-
})
|
2042
|
-
}));
|
2043
|
-
}
|
2044
|
-
return columns;
|
2045
|
-
}, [table]);
|
2046
|
-
const tableProps = Object.assign({}, props);
|
2047
|
-
tableProps.columns = columns;
|
2048
|
-
tableProps.onRowClick = onRowClickHandler;
|
2049
|
-
tableProps.queryKey = api.queryKey;
|
2050
|
-
tableProps.queryFn = api.search;
|
2051
|
-
return tableProps;
|
1838
|
+
gap: "3",
|
1839
|
+
children: [jsxRuntime.jsxs("div", {
|
1840
|
+
dflex: true,
|
1841
|
+
flexCol: true,
|
1842
|
+
children: [jsxRuntime.jsx(form.FieldLabel, {
|
1843
|
+
name: "",
|
1844
|
+
label: "\u00A0"
|
1845
|
+
}), jsxRuntime.jsx(form.SubmitButton, {
|
1846
|
+
children: "Filter"
|
1847
|
+
})]
|
1848
|
+
}), jsxRuntime.jsxs("div", {
|
1849
|
+
dflex: true,
|
1850
|
+
flexCol: true,
|
1851
|
+
children: [jsxRuntime.jsx(form.FieldLabel, {
|
1852
|
+
name: "",
|
1853
|
+
label: "\u00A0"
|
1854
|
+
}), jsxRuntime.jsx(ui.Button, {
|
1855
|
+
scheme: "neutral",
|
1856
|
+
onClick: handleReset,
|
1857
|
+
children: "Reset"
|
1858
|
+
})]
|
1859
|
+
})]
|
1860
|
+
});
|
2052
1861
|
}
|
2053
1862
|
|
2054
|
-
function
|
2055
|
-
|
2056
|
-
|
2057
|
-
|
2058
|
-
|
2059
|
-
|
2060
|
-
|
2061
|
-
|
1863
|
+
function ActionButton$1({
|
1864
|
+
label,
|
1865
|
+
buttonProps,
|
1866
|
+
icon,
|
1867
|
+
queryKey,
|
1868
|
+
queryFn,
|
1869
|
+
successMsg,
|
1870
|
+
errorMsg,
|
1871
|
+
invalidateParent
|
1872
|
+
}) {
|
1873
|
+
const mutation = invalidateParent ? api.useInvalidateParentMutation(queryFn, queryKey) : api.useApiMutation(queryFn, queryKey);
|
1874
|
+
const mutate = api.useMutate(mutation, {
|
1875
|
+
successMsg,
|
1876
|
+
errorMsg
|
1877
|
+
});
|
1878
|
+
return jsxRuntime.jsxs(ui.Button, Object.assign({
|
1879
|
+
display: "flex",
|
1880
|
+
alignItems: "center",
|
1881
|
+
gap: "3"
|
1882
|
+
}, buttonProps, {
|
1883
|
+
onClick: mutate,
|
1884
|
+
disabled: mutation.isLoading,
|
1885
|
+
children: [icon && jsxRuntime.jsx(ui.Icon, {
|
1886
|
+
path: icon
|
1887
|
+
}), label]
|
1888
|
+
}));
|
2062
1889
|
}
|
2063
1890
|
|
2064
|
-
function
|
2065
|
-
|
2066
|
-
|
2067
|
-
|
2068
|
-
|
2069
|
-
|
2070
|
-
|
2071
|
-
|
2072
|
-
|
2073
|
-
|
2074
|
-
|
2075
|
-
|
2076
|
-
|
2077
|
-
|
2078
|
-
|
2079
|
-
|
1891
|
+
function TableMassActions({
|
1892
|
+
actions
|
1893
|
+
}) {
|
1894
|
+
const {
|
1895
|
+
ids
|
1896
|
+
} = table.useTableContext();
|
1897
|
+
const showMassActions = ids && ids.length > 0;
|
1898
|
+
return jsxRuntime.jsx(ui.Collapse, {
|
1899
|
+
in: showMassActions,
|
1900
|
+
style: {
|
1901
|
+
overflow: showMassActions ? "initial" : "hidden"
|
1902
|
+
},
|
1903
|
+
children: jsxRuntime.jsx("div", {
|
1904
|
+
dflex: true,
|
1905
|
+
gap: "3",
|
1906
|
+
flexWrap: true,
|
1907
|
+
alignItems: "center",
|
1908
|
+
px: "8",
|
1909
|
+
pt: "5",
|
1910
|
+
children: actions.map((action, index) => jsxRuntime.jsx("div", {
|
1911
|
+
children: action.type == "button" && !action.showConfirmationDialog && jsxRuntime.jsx(ActionButton$1, {
|
1912
|
+
label: action.label,
|
1913
|
+
queryFn: action.queryFn,
|
1914
|
+
queryKey: action.queryKey,
|
1915
|
+
buttonProps: action.buttonProps
|
1916
|
+
})
|
1917
|
+
}, index))
|
1918
|
+
})
|
1919
|
+
});
|
2080
1920
|
}
|
2081
1921
|
|
2082
|
-
|
2083
|
-
|
1922
|
+
const defaultErrorMsg$2 = "Oops, something went wrong...";
|
1923
|
+
function nonNullValues$1(data) {
|
1924
|
+
var _a;
|
1925
|
+
if (data) {
|
1926
|
+
const nonNullData = Object.assign({}, data);
|
1927
|
+
for (const key in data) nonNullData[key] = (_a = nonNullData[key]) !== null && _a !== void 0 ? _a : "";
|
1928
|
+
return nonNullData;
|
1929
|
+
}
|
1930
|
+
return data;
|
2084
1931
|
}
|
2085
|
-
|
2086
|
-
|
2087
|
-
|
2088
|
-
|
2089
|
-
|
1932
|
+
function ItemEditDialog$1(_a) {
|
1933
|
+
var _b, _c, _d, _e;
|
1934
|
+
var {
|
1935
|
+
initialValues,
|
1936
|
+
itemLabel,
|
1937
|
+
queryId = "",
|
1938
|
+
api: api$1,
|
1939
|
+
queryFetchOptions,
|
1940
|
+
querySaveOptions,
|
1941
|
+
onSuccess,
|
1942
|
+
onFetchError,
|
1943
|
+
fetchErrorMsg = defaultErrorMsg$2,
|
1944
|
+
onSaveError,
|
1945
|
+
saveErrorMsg = defaultErrorMsg$2,
|
1946
|
+
fetchToFormData,
|
1947
|
+
formToQueryData,
|
1948
|
+
invalidateQueriesOnSuccess = true,
|
1949
|
+
invalidateQueryKey,
|
1950
|
+
retryText = "Retry",
|
1951
|
+
cancelLabel = "Cancel",
|
1952
|
+
saveLabel,
|
1953
|
+
size = "lg",
|
1954
|
+
title,
|
1955
|
+
form: form$1,
|
1956
|
+
show,
|
1957
|
+
onClose,
|
1958
|
+
formikProps
|
1959
|
+
} = _a,
|
1960
|
+
props = __rest$1(_a, ["initialValues", "itemLabel", "queryId", "api", "queryFetchOptions", "querySaveOptions", "onSuccess", "onFetchError", "fetchErrorMsg", "onSaveError", "saveErrorMsg", "fetchToFormData", "formToQueryData", "invalidateQueriesOnSuccess", "invalidateQueryKey", "retryText", "cancelLabel", "saveLabel", "size", "title", "form", "show", "onClose", "formikProps"]);
|
1961
|
+
const {
|
1962
|
+
isInitialLoading,
|
1963
|
+
isFetching,
|
1964
|
+
data,
|
1965
|
+
isError,
|
1966
|
+
error /*, error*/,
|
1967
|
+
refetch
|
1968
|
+
} = api.useApiQuery(api$1.queryKey, api$1.get, queryId, Object.assign({
|
1969
|
+
enabled: !( /*queryId == 0 || */queryId == "" || queryId == null || queryId == undefined),
|
1970
|
+
onError: onFetchError
|
1971
|
+
}, queryFetchOptions));
|
1972
|
+
// const [activeTab, setActiveTab] = React.useState(form && Array.isArray(form) ? form[0].key : "");
|
1973
|
+
// const [showTab, setShowTab] = React.useState(true);
|
1974
|
+
const mutation = invalidateQueriesOnSuccess ? api.useInvalidateParentMutation(api$1.upsert, invalidateQueryKey !== null && invalidateQueryKey !== void 0 ? invalidateQueryKey : api$1.queryKey, querySaveOptions) : api.useApiMutation(api$1.upsert, api$1.queryKey, queryId, querySaveOptions);
|
1975
|
+
const retry = React__default["default"].useCallback(() => refetch(), [refetch]);
|
1976
|
+
const saveItem = React__default["default"].useCallback((item, actions) => __awaiter(this, void 0, void 0, function* () {
|
1977
|
+
// Clear mutation error if any
|
1978
|
+
mutation.reset();
|
1979
|
+
const formItem = formToQueryData ? formToQueryData(item) : Object.assign({}, item);
|
1980
|
+
yield mutation.mutateAsync(formItem).then(response => {
|
1981
|
+
var _a;
|
1982
|
+
if (onSuccess) onSuccess(formItem, response);else reactToastify.toast.success(`${title ? title(formItem) : (_a = formItem.name) !== null && _a !== void 0 ? _a : formItem.title} ${queryId ? "saved" : "created"}`);
|
1983
|
+
// closing delete modal
|
1984
|
+
onClose === null || onClose === void 0 ? void 0 : onClose();
|
1985
|
+
}).catch(error => {
|
1986
|
+
var _a;
|
1987
|
+
console.error("on error", error);
|
1988
|
+
if (onSaveError) onSaveError(item);else reactToastify.toast.error(`Couldn't save ${title ? title(formItem) : (_a = formItem.name) !== null && _a !== void 0 ? _a : formItem.title}`);
|
1989
|
+
actions.setSubmitting(false);
|
1990
|
+
});
|
1991
|
+
}), [mutation, formToQueryData, onSuccess, onSaveError, onClose]);
|
1992
|
+
// const switchTab = React.useCallback((tab: string) =>
|
1993
|
+
// {
|
1994
|
+
// setActiveTab(tab);
|
1995
|
+
// setShowTab(false);
|
1996
|
+
// setTimeout(function ()
|
1997
|
+
// {
|
1998
|
+
// setActiveTab(tab);
|
1999
|
+
// setShowTab(true);
|
2000
|
+
// }, 150);
|
2001
|
+
// }, [setActiveTab])
|
2002
|
+
return jsxRuntime.jsxs(ui.Modal, Object.assign({
|
2003
|
+
size: size,
|
2004
|
+
show: show,
|
2005
|
+
onClose: onClose,
|
2006
|
+
scheme: "light",
|
2007
|
+
transition: true
|
2008
|
+
}, props, {
|
2009
|
+
children: [jsxRuntime.jsxs(ui.Modal.Header, {
|
2010
|
+
children: [!isInitialLoading && queryId && `Edit ${title ? title(data) : (_d = (_c = (_b = data === null || data === void 0 ? void 0 : data["name"]) !== null && _b !== void 0 ? _b : data === null || data === void 0 ? void 0 : data["title"]) !== null && _c !== void 0 ? _c : data === null || data === void 0 ? void 0 : data["name"]) !== null && _d !== void 0 ? _d : ""}`, !queryId && `Create new ${itemLabel !== null && itemLabel !== void 0 ? itemLabel : "item"}`, Array.isArray(form$1) && jsxRuntime.jsx(jsxRuntime.Fragment, {})
|
2011
|
+
// <ul className="nav nav-bold nav-pills">
|
2012
|
+
// {form.map(item =>
|
2013
|
+
// <li key={item.key} className="nav-item cursor-pointer bg-hover-light rounded" onClick={() => switchTab(item.key)}>
|
2014
|
+
// <span className={clsx("nav-link", activeTab === item.key && "active")} data-toggle="tab">{item.label}</span>
|
2015
|
+
// </li>
|
2016
|
+
// )}
|
2017
|
+
// </ul>
|
2018
|
+
]
|
2019
|
+
}), isInitialLoading && jsxRuntime.jsx(ui.Modal.Body, {
|
2020
|
+
children: jsxRuntime.jsx(components.QueryLoadingState, {
|
2021
|
+
minW: "72"
|
2022
|
+
})
|
2023
|
+
}), isError && jsxRuntime.jsx(ui.Modal.Body, {
|
2024
|
+
children: jsxRuntime.jsx(components.RetryOnError, {
|
2025
|
+
label: `${fetchErrorMsg} ${error}`,
|
2026
|
+
onClick: retry
|
2027
|
+
})
|
2028
|
+
}), !isInitialLoading && !isError && jsxRuntime.jsx(jsxRuntime.Fragment, {
|
2029
|
+
children: jsxRuntime.jsx(formik.Formik
|
2030
|
+
// initialValues={fetchToFormData && queryId && data ? fetchToFormData(nonNullValues(data)) : nonNullValues(data) ?? initialValues(data) ?? {}}
|
2031
|
+
, Object.assign({
|
2032
|
+
// initialValues={fetchToFormData && queryId && data ? fetchToFormData(nonNullValues(data)) : nonNullValues(data) ?? initialValues(data) ?? {}}
|
2033
|
+
initialValues: fetchToFormData && queryId && data ? fetchToFormData(nonNullValues$1(data)) : (_e = nonNullValues$1(initialValues(data))) !== null && _e !== void 0 ? _e : {},
|
2034
|
+
onSubmit: saveItem
|
2035
|
+
}, formikProps, {
|
2036
|
+
children: ({
|
2037
|
+
setFieldValue,
|
2038
|
+
dirty,
|
2039
|
+
handleSubmit,
|
2040
|
+
isValid,
|
2041
|
+
values
|
2042
|
+
}) => jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
2043
|
+
children: [jsxRuntime.jsx(ui.Modal.Body, {
|
2044
|
+
pb: "6",
|
2045
|
+
children: jsxRuntime.jsxs(formik.Form, {
|
2046
|
+
children: [/*#__PURE__*/React__default["default"].isValidElement(form$1) && form$1, Array.isArray(form$1) && jsxRuntime.jsx(form.FormRenderer, {
|
2047
|
+
form: form$1
|
2048
|
+
}), react.isFunction(form$1) && jsxRuntime.jsx(form.FormRenderer, {
|
2049
|
+
form: form$1(data !== null && data !== void 0 ? data : values)
|
2050
|
+
})]
|
2051
|
+
})
|
2052
|
+
}), jsxRuntime.jsxs(ui.Modal.Footer, {
|
2053
|
+
dflex: true,
|
2054
|
+
placeContent: "end",
|
2055
|
+
spaceX: "3",
|
2056
|
+
children: [jsxRuntime.jsx(ui.Button, {
|
2057
|
+
disabled: mutation.isLoading,
|
2058
|
+
onClick: onClose,
|
2059
|
+
variant: "borderless",
|
2060
|
+
me: "2",
|
2061
|
+
children: cancelLabel
|
2062
|
+
}), jsxRuntime.jsx(ui.Button, {
|
2063
|
+
type: "submit",
|
2064
|
+
disabled: !dirty || mutation.isLoading /* || !isValid*/,
|
2065
|
+
onClick: () => handleSubmit(),
|
2066
|
+
children: saveLabel ? saveLabel : queryId ? "Update" : "Create"
|
2067
|
+
})]
|
2068
|
+
})]
|
2069
|
+
})
|
2070
|
+
}))
|
2071
|
+
}), mutation.isLoading && jsxRuntime.jsx(components.ModalLoadingOverlay, {})]
|
2072
|
+
}));
|
2090
2073
|
}
|
2091
2074
|
|
2092
|
-
function
|
2093
|
-
|
2094
|
-
|
2075
|
+
function QueryWrapperDialog({
|
2076
|
+
api: api$1,
|
2077
|
+
fn,
|
2078
|
+
transformFn,
|
2079
|
+
config,
|
2080
|
+
onClose,
|
2081
|
+
queryId,
|
2082
|
+
invalidateQueryKey
|
2083
|
+
}) {
|
2084
|
+
const {
|
2085
|
+
data,
|
2086
|
+
isFetching
|
2087
|
+
} = api.useApiQuery(api$1.queryKey, fn === "get" || fn === "getTransformed" ? api$1.get : api$1.getAll, undefined, {
|
2088
|
+
retryOnMount: false,
|
2089
|
+
refetchOnMount: false,
|
2090
|
+
refetchOnWindowFocus: false
|
2091
|
+
});
|
2092
|
+
const transformedData = React__default["default"].useMemo(() => {
|
2093
|
+
if (data && (fn === "getTransformed" || fn === "getAllTransformed")) {
|
2094
|
+
if (!transformFn) console.warn(`QueryWrapperDialog: you forgot to pass transformFn as parameter for fn ${fn}`);
|
2095
|
+
// @ts-ignore
|
2096
|
+
return transformFn === null || transformFn === void 0 ? void 0 : transformFn(data);
|
2095
2097
|
}
|
2096
|
-
return
|
2098
|
+
return data;
|
2099
|
+
}, [data, fn, transformFn]);
|
2100
|
+
if (isFetching) return null;
|
2101
|
+
// @ts-ignore
|
2102
|
+
return jsxRuntime.jsx(ItemEditDialog$1, Object.assign({}, config(transformedData), {
|
2103
|
+
queryId: queryId,
|
2104
|
+
invalidateQueryKey: invalidateQueryKey,
|
2105
|
+
show: true,
|
2106
|
+
onClose: onClose
|
2107
|
+
}));
|
2097
2108
|
}
|
2098
2109
|
|
2099
|
-
|
2100
|
-
|
2101
|
-
|
2102
|
-
|
2103
|
-
|
2104
|
-
|
2105
|
-
|
2106
|
-
const
|
2107
|
-
|
2108
|
-
|
2109
|
-
|
2110
|
-
|
2111
|
-
|
2112
|
-
|
2113
|
-
|
2114
|
-
|
2115
|
-
|
2116
|
-
const uint16ArrayTag = '[object Uint16Array]';
|
2117
|
-
const uint32ArrayTag = '[object Uint32Array]';
|
2118
|
-
const bigUint64ArrayTag = '[object BigUint64Array]';
|
2119
|
-
const int8ArrayTag = '[object Int8Array]';
|
2120
|
-
const int16ArrayTag = '[object Int16Array]';
|
2121
|
-
const int32ArrayTag = '[object Int32Array]';
|
2122
|
-
const bigInt64ArrayTag = '[object BigInt64Array]';
|
2123
|
-
const float32ArrayTag = '[object Float32Array]';
|
2124
|
-
const float64ArrayTag = '[object Float64Array]';
|
2125
|
-
|
2126
|
-
function isPlainObject(value) {
|
2127
|
-
if (!value || typeof value !== 'object') {
|
2128
|
-
return false;
|
2129
|
-
}
|
2130
|
-
const proto = Object.getPrototypeOf(value);
|
2131
|
-
const hasObjectPrototype = proto === null ||
|
2132
|
-
proto === Object.prototype ||
|
2133
|
-
Object.getPrototypeOf(proto) === null;
|
2134
|
-
if (!hasObjectPrototype) {
|
2135
|
-
return false;
|
2110
|
+
function MultiQueryWrapperDialog({
|
2111
|
+
queries,
|
2112
|
+
config,
|
2113
|
+
onClose,
|
2114
|
+
queryId,
|
2115
|
+
invalidateQueryKey
|
2116
|
+
}) {
|
2117
|
+
const {
|
2118
|
+
data,
|
2119
|
+
isFetching,
|
2120
|
+
isError
|
2121
|
+
} = api.useApiQueries(queries.map(q => ({
|
2122
|
+
queryKey: q.api.queryKey,
|
2123
|
+
queryFn: q.fn == "get" ? q.api.get : q.api.getAll,
|
2124
|
+
queryOptions: {
|
2125
|
+
cacheTime: q.cache === false ? 0 : undefined,
|
2126
|
+
staleTime: q.cache === false ? 0 : undefined
|
2136
2127
|
}
|
2137
|
-
|
2128
|
+
})));
|
2129
|
+
const transformedData = React__default["default"].useMemo(() => {
|
2130
|
+
return data === null || data === void 0 ? void 0 : data.map((d, index) => {
|
2131
|
+
var _a, _b;
|
2132
|
+
return queries[index].transformFn ? (_b = (_a = queries[index]) === null || _a === void 0 ? void 0 : _a.transformFn) === null || _b === void 0 ? void 0 : _b.call(_a, d) : d;
|
2133
|
+
});
|
2134
|
+
}, [data, queries]);
|
2135
|
+
// TODO This is not really good
|
2136
|
+
// So instead, add a isPreloading and isPreloadingError to ItemEditDialog to handle the cases
|
2137
|
+
// if (isFetching)
|
2138
|
+
// return null
|
2139
|
+
// @ts-ignore
|
2140
|
+
return jsxRuntime.jsx(ItemEditDialog$1, Object.assign({
|
2141
|
+
isPreloading: isFetching
|
2142
|
+
}, config(...transformedData), {
|
2143
|
+
queryId: queryId,
|
2144
|
+
invalidateQueryKey: invalidateQueryKey,
|
2145
|
+
show: true,
|
2146
|
+
onClose: onClose
|
2147
|
+
}));
|
2138
2148
|
}
|
2139
2149
|
|
2140
|
-
function
|
2141
|
-
|
2150
|
+
function DialogRenderer({
|
2151
|
+
config,
|
2152
|
+
onClose,
|
2153
|
+
invalidateQueryKey,
|
2154
|
+
queryId
|
2155
|
+
}) {
|
2156
|
+
const props = __rest$1(config, ["type"]);
|
2157
|
+
if (config.type === "dialog") return jsxRuntime.jsx(ItemEditDialog$1, Object.assign({}, props, {
|
2158
|
+
queryId: queryId,
|
2159
|
+
invalidateQueryKey: invalidateQueryKey,
|
2160
|
+
show: true,
|
2161
|
+
onClose: onClose
|
2162
|
+
}));
|
2163
|
+
if (config.type === "query") return jsxRuntime.jsx(QueryWrapperDialog, Object.assign({}, props, {
|
2164
|
+
queryId: queryId,
|
2165
|
+
invalidateQueryKey: invalidateQueryKey,
|
2166
|
+
onClose: onClose
|
2167
|
+
}));
|
2168
|
+
if (config.type === "multiQuery") return jsxRuntime.jsx(MultiQueryWrapperDialog, Object.assign({}, props, {
|
2169
|
+
queryId: queryId,
|
2170
|
+
invalidateQueryKey: invalidateQueryKey,
|
2171
|
+
onClose: onClose
|
2172
|
+
}));
|
2173
|
+
return null;
|
2142
2174
|
}
|
2143
2175
|
|
2144
|
-
function
|
2145
|
-
|
2176
|
+
function RefreshButton({
|
2177
|
+
queryKey
|
2178
|
+
}) {
|
2179
|
+
const invalidate = api.useInvalidateQuery(queryKey);
|
2180
|
+
useHotkeys('ctrl+r', () => invalidate(), {
|
2181
|
+
preventDefault: true
|
2182
|
+
}, [invalidate]);
|
2183
|
+
return jsxRuntime.jsx(ButtonBarButton, {
|
2184
|
+
scheme: "dark",
|
2185
|
+
size: "sm",
|
2186
|
+
aspectRatio: "square",
|
2187
|
+
variant: "borderless",
|
2188
|
+
onClick: invalidate,
|
2189
|
+
children: jsxRuntime.jsx(ui.Icon, {
|
2190
|
+
path: mdiRefresh
|
2191
|
+
})
|
2192
|
+
});
|
2146
2193
|
}
|
2147
|
-
|
2148
|
-
|
2149
|
-
|
2150
|
-
|
2151
|
-
|
2152
|
-
|
2153
|
-
|
2154
|
-
|
2155
|
-
|
2156
|
-
|
2157
|
-
|
2158
|
-
|
2159
|
-
|
2160
|
-
|
2161
|
-
|
2162
|
-
|
2163
|
-
|
2164
|
-
|
2165
|
-
|
2166
|
-
|
2167
|
-
|
2168
|
-
|
2169
|
-
|
2170
|
-
|
2171
|
-
|
2172
|
-
|
2194
|
+
|
2195
|
+
function ItemDeleteDialog(_a) {
|
2196
|
+
var {
|
2197
|
+
itemLabel,
|
2198
|
+
queryId = "",
|
2199
|
+
api: api$1,
|
2200
|
+
invalidateQueriesOnSuccess = true,
|
2201
|
+
invalidateQueryKey,
|
2202
|
+
size = "lg",
|
2203
|
+
show,
|
2204
|
+
onClose
|
2205
|
+
} = _a,
|
2206
|
+
props = __rest$1(_a, ["itemLabel", "queryId", "api", "invalidateQueriesOnSuccess", "invalidateQueryKey", "size", "show", "onClose"]);
|
2207
|
+
const mutation = invalidateQueriesOnSuccess ? api.useInvalidateParentMutation(api$1.delete, invalidateQueryKey !== null && invalidateQueryKey !== void 0 ? invalidateQueryKey : api$1.queryKey) : api.useApiMutation(api$1.upsert, api$1.queryKey);
|
2208
|
+
const mutate = api.useMutate(mutation, {
|
2209
|
+
onSuccess: () => onClose === null || onClose === void 0 ? void 0 : onClose()
|
2210
|
+
});
|
2211
|
+
const handleDelete = React__default["default"].useCallback(() => mutate(queryId), [mutate, queryId]);
|
2212
|
+
return jsxRuntime.jsxs(ui.Modal, Object.assign({
|
2213
|
+
size: size,
|
2214
|
+
show: show,
|
2215
|
+
onClose: onClose,
|
2216
|
+
scheme: "danger",
|
2217
|
+
variant: "glass",
|
2218
|
+
transition: true
|
2219
|
+
}, props, {
|
2220
|
+
children: [jsxRuntime.jsx(ui.Modal.Header, {
|
2221
|
+
children: `Delete ${itemLabel}`
|
2222
|
+
}), jsxRuntime.jsxs(ui.Modal.Body, {
|
2223
|
+
pb: "6",
|
2224
|
+
children: ["Do you really want to delete ", itemLabel, "?"]
|
2225
|
+
}), jsxRuntime.jsxs(ui.Modal.Footer, {
|
2226
|
+
dflex: true,
|
2227
|
+
placeContent: "end",
|
2228
|
+
spaceX: "3",
|
2229
|
+
children: [jsxRuntime.jsx(ui.Button, {
|
2230
|
+
disabled: mutation.isLoading,
|
2231
|
+
onClick: onClose,
|
2232
|
+
variant: "borderless",
|
2233
|
+
scheme: "secondary",
|
2234
|
+
me: "2",
|
2235
|
+
children: "Cancel"
|
2236
|
+
}), jsxRuntime.jsx(ui.Button, {
|
2237
|
+
scheme: "danger",
|
2238
|
+
disabled: mutation.isLoading,
|
2239
|
+
onClick: handleDelete,
|
2240
|
+
children: "Delete"
|
2241
|
+
})]
|
2242
|
+
}), mutation.isLoading && jsxRuntime.jsx(components.ModalLoadingOverlay, {})]
|
2243
|
+
}));
|
2173
2244
|
}
|
2174
|
-
|
2175
|
-
|
2176
|
-
|
2177
|
-
|
2178
|
-
|
2179
|
-
|
2180
|
-
|
2181
|
-
|
2182
|
-
|
2183
|
-
|
2184
|
-
|
2185
|
-
|
2186
|
-
|
2187
|
-
|
2188
|
-
|
2189
|
-
|
2190
|
-
|
2191
|
-
|
2192
|
-
case numberTag: {
|
2193
|
-
const x = a.valueOf();
|
2194
|
-
const y = b.valueOf();
|
2195
|
-
return eq(x, y);
|
2245
|
+
|
2246
|
+
const [provider, useContext] = react.createContext();
|
2247
|
+
function TableViewProvider({
|
2248
|
+
editView,
|
2249
|
+
deleteItem,
|
2250
|
+
queryKey,
|
2251
|
+
children
|
2252
|
+
}) {
|
2253
|
+
const openLink = hooks.useOpenLink();
|
2254
|
+
const navigate = reactRouterDom.useNavigate();
|
2255
|
+
const [dialog, setDialog] = React__default["default"].useState(null);
|
2256
|
+
const onCloseDialog = React__default["default"].useCallback(() => setDialog(null), [setDialog]);
|
2257
|
+
const onAction = React__default["default"].useCallback((action, item) => {
|
2258
|
+
switch (action.type) {
|
2259
|
+
case "view":
|
2260
|
+
{
|
2261
|
+
navigate(react.runIfFn(action.path, item));
|
2262
|
+
break;
|
2196
2263
|
}
|
2197
|
-
|
2198
|
-
|
2199
|
-
|
2200
|
-
|
2201
|
-
case regexpTag: {
|
2202
|
-
return a.source === b.source && a.flags === b.flags;
|
2264
|
+
case "link":
|
2265
|
+
{
|
2266
|
+
openLink(`${process.env["NEXT_PUBLIC_WEBSITE_URL"]}/${react.runIfFn(action.path, item)}`);
|
2267
|
+
break;
|
2203
2268
|
}
|
2204
|
-
|
2205
|
-
|
2269
|
+
case "edit":
|
2270
|
+
{
|
2271
|
+
if (editView.type == "customDialog") {
|
2272
|
+
setDialog(editView.render({
|
2273
|
+
show: true,
|
2274
|
+
onClose: onCloseDialog
|
2275
|
+
}));
|
2276
|
+
} else {
|
2277
|
+
setDialog(jsxRuntime.jsx(DialogRenderer, {
|
2278
|
+
onClose: onCloseDialog,
|
2279
|
+
config: editView,
|
2280
|
+
queryId: item.id,
|
2281
|
+
invalidateQueryKey: queryKey
|
2282
|
+
}));
|
2283
|
+
}
|
2284
|
+
break;
|
2206
2285
|
}
|
2207
|
-
|
2208
|
-
|
2209
|
-
|
2210
|
-
|
2211
|
-
|
2212
|
-
|
2213
|
-
|
2214
|
-
|
2215
|
-
|
2216
|
-
|
2217
|
-
|
2218
|
-
|
2219
|
-
|
2220
|
-
|
2221
|
-
}
|
2222
|
-
for (const [key, value] of a.entries()) {
|
2223
|
-
if (!b.has(key) || !isEqualWithImpl(value, b.get(key), key, a, b, stack, areValuesEqual)) {
|
2224
|
-
return false;
|
2225
|
-
}
|
2226
|
-
}
|
2227
|
-
return true;
|
2228
|
-
}
|
2229
|
-
case setTag: {
|
2230
|
-
if (a.size !== b.size) {
|
2231
|
-
return false;
|
2232
|
-
}
|
2233
|
-
const aValues = Array.from(a.values());
|
2234
|
-
const bValues = Array.from(b.values());
|
2235
|
-
for (let i = 0; i < aValues.length; i++) {
|
2236
|
-
const aValue = aValues[i];
|
2237
|
-
const index = bValues.findIndex(bValue => {
|
2238
|
-
return isEqualWithImpl(aValue, bValue, undefined, a, b, stack, areValuesEqual);
|
2239
|
-
});
|
2240
|
-
if (index === -1) {
|
2241
|
-
return false;
|
2242
|
-
}
|
2243
|
-
bValues.splice(index, 1);
|
2244
|
-
}
|
2245
|
-
return true;
|
2246
|
-
}
|
2247
|
-
case arrayTag:
|
2248
|
-
case uint8ArrayTag:
|
2249
|
-
case uint8ClampedArrayTag:
|
2250
|
-
case uint16ArrayTag:
|
2251
|
-
case uint32ArrayTag:
|
2252
|
-
case bigUint64ArrayTag:
|
2253
|
-
case int8ArrayTag:
|
2254
|
-
case int16ArrayTag:
|
2255
|
-
case int32ArrayTag:
|
2256
|
-
case bigInt64ArrayTag:
|
2257
|
-
case float32ArrayTag:
|
2258
|
-
case float64ArrayTag: {
|
2259
|
-
if (typeof Buffer !== 'undefined' && Buffer.isBuffer(a) !== Buffer.isBuffer(b)) {
|
2260
|
-
return false;
|
2261
|
-
}
|
2262
|
-
if (a.length !== b.length) {
|
2263
|
-
return false;
|
2264
|
-
}
|
2265
|
-
for (let i = 0; i < a.length; i++) {
|
2266
|
-
if (!isEqualWithImpl(a[i], b[i], i, a, b, stack, areValuesEqual)) {
|
2267
|
-
return false;
|
2268
|
-
}
|
2269
|
-
}
|
2270
|
-
return true;
|
2271
|
-
}
|
2272
|
-
case arrayBufferTag: {
|
2273
|
-
if (a.byteLength !== b.byteLength) {
|
2274
|
-
return false;
|
2275
|
-
}
|
2276
|
-
return areObjectsEqual(new Uint8Array(a), new Uint8Array(b), stack, areValuesEqual);
|
2277
|
-
}
|
2278
|
-
case dataViewTag: {
|
2279
|
-
if (a.byteLength !== b.byteLength || a.byteOffset !== b.byteOffset) {
|
2280
|
-
return false;
|
2281
|
-
}
|
2282
|
-
return areObjectsEqual(new Uint8Array(a), new Uint8Array(b), stack, areValuesEqual);
|
2283
|
-
}
|
2284
|
-
case errorTag: {
|
2285
|
-
return a.name === b.name && a.message === b.message;
|
2286
|
-
}
|
2287
|
-
case objectTag: {
|
2288
|
-
const areEqualInstances = areObjectsEqual(a.constructor, b.constructor, stack, areValuesEqual) ||
|
2289
|
-
(isPlainObject(a) && isPlainObject(b));
|
2290
|
-
if (!areEqualInstances) {
|
2291
|
-
return false;
|
2292
|
-
}
|
2293
|
-
const aKeys = [...Object.keys(a), ...getSymbols(a)];
|
2294
|
-
const bKeys = [...Object.keys(b), ...getSymbols(b)];
|
2295
|
-
if (aKeys.length !== bKeys.length) {
|
2296
|
-
return false;
|
2297
|
-
}
|
2298
|
-
for (let i = 0; i < aKeys.length; i++) {
|
2299
|
-
const propKey = aKeys[i];
|
2300
|
-
const aProp = a[propKey];
|
2301
|
-
if (!Object.hasOwn(b, propKey)) {
|
2302
|
-
return false;
|
2303
|
-
}
|
2304
|
-
const bProp = b[propKey];
|
2305
|
-
if (!isEqualWithImpl(aProp, bProp, propKey, a, b, stack, areValuesEqual)) {
|
2306
|
-
return false;
|
2307
|
-
}
|
2308
|
-
}
|
2309
|
-
return true;
|
2310
|
-
}
|
2311
|
-
default: {
|
2312
|
-
return false;
|
2313
|
-
}
|
2286
|
+
case "delete":
|
2287
|
+
{
|
2288
|
+
setDialog(jsxRuntime.jsx(ItemDeleteDialog, Object.assign({
|
2289
|
+
show: true,
|
2290
|
+
onClose: onCloseDialog,
|
2291
|
+
queryId: item.id,
|
2292
|
+
invalidateQueryKey: queryKey
|
2293
|
+
}, deleteItem, {
|
2294
|
+
itemLabel: react.runIfFn(deleteItem.itemLabel, item)
|
2295
|
+
})));
|
2296
|
+
// TODO
|
2297
|
+
// const { initialValues, ...props } = editItem!!
|
2298
|
+
// setDialog(<ItemEditDialog {...props} initialValues={runIfFn(initialValues, item)} show queryId={item?.id} onClose={onCloseDialog} />)
|
2299
|
+
break;
|
2314
2300
|
}
|
2315
2301
|
}
|
2316
|
-
|
2317
|
-
|
2318
|
-
|
2319
|
-
|
2302
|
+
}, [navigate, editView, deleteItem]);
|
2303
|
+
const Provider = provider;
|
2304
|
+
const value = {
|
2305
|
+
dialog,
|
2306
|
+
onAction
|
2307
|
+
};
|
2308
|
+
return jsxRuntime.jsx(Provider, {
|
2309
|
+
value: value,
|
2310
|
+
children: children
|
2311
|
+
});
|
2320
2312
|
}
|
2321
2313
|
|
2322
|
-
|
2323
|
-
|
2324
|
-
|
2314
|
+
/**
|
2315
|
+
* table-core
|
2316
|
+
*
|
2317
|
+
* Copyright (c) TanStack
|
2318
|
+
*
|
2319
|
+
* This source code is licensed under the MIT license found in the
|
2320
|
+
* LICENSE.md file in the root directory of this source tree.
|
2321
|
+
*
|
2322
|
+
* @license MIT
|
2323
|
+
*/
|
2324
|
+
// type Person = {
|
2325
|
+
// firstName: string
|
2326
|
+
// lastName: string
|
2327
|
+
// age: number
|
2328
|
+
// visits: number
|
2329
|
+
// status: string
|
2330
|
+
// progress: number
|
2331
|
+
// createdAt: Date
|
2332
|
+
// nested: {
|
2333
|
+
// foo: [
|
2334
|
+
// {
|
2335
|
+
// bar: 'bar'
|
2336
|
+
// }
|
2337
|
+
// ]
|
2338
|
+
// bar: { subBar: boolean }[]
|
2339
|
+
// baz: {
|
2340
|
+
// foo: 'foo'
|
2341
|
+
// bar: {
|
2342
|
+
// baz: 'baz'
|
2343
|
+
// }
|
2344
|
+
// }
|
2345
|
+
// }
|
2346
|
+
// }
|
2325
2347
|
|
2326
|
-
|
2327
|
-
|
2328
|
-
|
2329
|
-
|
2330
|
-
|
2331
|
-
|
2332
|
-
|
2333
|
-
|
2334
|
-
|
2335
|
-
|
2336
|
-
|
2337
|
-
|
2338
|
-
|
2339
|
-
|
2340
|
-
|
2341
|
-
|
2342
|
-
|
2343
|
-
|
2344
|
-
|
2345
|
-
|
2346
|
-
|
2347
|
-
|
2348
|
-
|
2349
|
-
|
2350
|
-
|
2351
|
-
|
2352
|
-
|
2353
|
-
style: {
|
2354
|
-
overflow: showFilters ? "initial" : "hidden"
|
2348
|
+
// const test: DeepKeys<Person> = 'nested.foo.0.bar'
|
2349
|
+
// const test2: DeepKeys<Person> = 'nested.bar'
|
2350
|
+
|
2351
|
+
// const helper = createColumnHelper<Person>()
|
2352
|
+
|
2353
|
+
// helper.accessor('nested.foo', {
|
2354
|
+
// cell: info => info.getValue(),
|
2355
|
+
// })
|
2356
|
+
|
2357
|
+
// helper.accessor('nested.foo.0.bar', {
|
2358
|
+
// cell: info => info.getValue(),
|
2359
|
+
// })
|
2360
|
+
|
2361
|
+
// helper.accessor('nested.bar', {
|
2362
|
+
// cell: info => info.getValue(),
|
2363
|
+
// })
|
2364
|
+
|
2365
|
+
function createColumnHelper() {
|
2366
|
+
return {
|
2367
|
+
accessor: (accessor, column) => {
|
2368
|
+
return typeof accessor === 'function' ? {
|
2369
|
+
...column,
|
2370
|
+
accessorFn: accessor
|
2371
|
+
} : {
|
2372
|
+
...column,
|
2373
|
+
accessorKey: accessor
|
2374
|
+
};
|
2355
2375
|
},
|
2356
|
-
|
2357
|
-
|
2358
|
-
|
2359
|
-
|
2360
|
-
|
2361
|
-
|
2362
|
-
|
2363
|
-
|
2364
|
-
|
2365
|
-
|
2366
|
-
|
2367
|
-
|
2368
|
-
|
2369
|
-
|
2370
|
-
|
2371
|
-
|
2372
|
-
w: "auto",
|
2373
|
-
form: form$1
|
2374
|
-
}), jsxRuntime.jsx(Buttons, {
|
2375
|
-
handleReset: () => handleReset(props.resetForm)
|
2376
|
-
})]
|
2377
|
-
})
|
2378
|
-
})
|
2379
|
-
})
|
2376
|
+
display: column => column,
|
2377
|
+
group: column => column
|
2378
|
+
};
|
2379
|
+
}
|
2380
|
+
|
2381
|
+
function TableRowPublishPostButton$1(_a) {
|
2382
|
+
var {
|
2383
|
+
id,
|
2384
|
+
api: api$1,
|
2385
|
+
status,
|
2386
|
+
invalidateQueryKey
|
2387
|
+
} = _a,
|
2388
|
+
props = __rest$1(_a, ["id", "api", "status", "invalidateQueryKey"]);
|
2389
|
+
const isDraft = status == "draft";
|
2390
|
+
const mutation = api.useInvalidateParentMutation(isDraft ? api$1.publish : api$1.unpublish, invalidateQueryKey !== null && invalidateQueryKey !== void 0 ? invalidateQueryKey : api$1.queryKey, {
|
2391
|
+
networkMode: "always"
|
2380
2392
|
});
|
2393
|
+
const publish = React__default["default"].useCallback(event => {
|
2394
|
+
event === null || event === void 0 ? void 0 : event.preventDefault();
|
2395
|
+
event === null || event === void 0 ? void 0 : event.stopPropagation();
|
2396
|
+
mutation.reset();
|
2397
|
+
mutation.mutateAsync(id).then(() => reactToastify.toast.success(isDraft ? "Published!" : "Unpublished!")).catch(error => reactToastify.toast.error(`Error: ${error}`));
|
2398
|
+
}, [mutation, id]);
|
2399
|
+
return jsxRuntime.jsx(ui.Button, Object.assign({
|
2400
|
+
variant: "borderless",
|
2401
|
+
corners: "square",
|
2402
|
+
scheme: "dark",
|
2403
|
+
onClick: publish
|
2404
|
+
}, props, {
|
2405
|
+
children: jsxRuntime.jsx(ui.Icon, {
|
2406
|
+
path: isDraft ? mdiPublish : mdiPublishOff,
|
2407
|
+
size: "sm"
|
2408
|
+
})
|
2409
|
+
}));
|
2381
2410
|
}
|
2382
|
-
|
2383
|
-
|
2411
|
+
|
2412
|
+
function TableRowActionsView({
|
2413
|
+
row,
|
2414
|
+
onAction,
|
2415
|
+
rowActions,
|
2416
|
+
api,
|
2417
|
+
queryKey
|
2384
2418
|
}) {
|
2385
|
-
|
2419
|
+
const item = row.original;
|
2420
|
+
return jsxRuntime.jsx("div", {
|
2386
2421
|
dflex: true,
|
2387
|
-
|
2388
|
-
|
2389
|
-
|
2390
|
-
|
2391
|
-
|
2392
|
-
|
2393
|
-
|
2394
|
-
|
2395
|
-
|
2396
|
-
|
2397
|
-
|
2398
|
-
|
2399
|
-
|
2400
|
-
|
2401
|
-
|
2402
|
-
|
2403
|
-
|
2404
|
-
|
2405
|
-
|
2406
|
-
children: "Reset"
|
2422
|
+
w: "full",
|
2423
|
+
alignItems: "stretch",
|
2424
|
+
placeContent: "end",
|
2425
|
+
h: "full",
|
2426
|
+
children: rowActions === null || rowActions === void 0 ? void 0 : rowActions.map((action, index) => jsxRuntime.jsxs(React__default["default"].Fragment, {
|
2427
|
+
children: [action.type === "publish" && jsxRuntime.jsx(TableRowPublishPostButton$1, {
|
2428
|
+
id: item.id,
|
2429
|
+
api: api,
|
2430
|
+
status: item.status,
|
2431
|
+
invalidateQueryKey: queryKey
|
2432
|
+
}), action.type == "custom" && jsxRuntime.jsx(jsxRuntime.Fragment, {
|
2433
|
+
children: action.component(item, queryKey, action.icon, action.label)
|
2434
|
+
}), !["publish", "custom"].includes(action.type) && jsxRuntime.jsx(ActionButton, {
|
2435
|
+
onClick: () => onAction(action, item),
|
2436
|
+
scheme: schemes$1[action.type],
|
2437
|
+
children: jsxRuntime.jsx(ui.Icon, {
|
2438
|
+
path: icons[action.type],
|
2439
|
+
size: "sm"
|
2440
|
+
})
|
2407
2441
|
})]
|
2408
|
-
})
|
2442
|
+
}, index))
|
2409
2443
|
});
|
2410
2444
|
}
|
2411
|
-
|
2412
|
-
|
2413
|
-
|
2414
|
-
|
2415
|
-
|
2416
|
-
|
2417
|
-
|
2418
|
-
|
2419
|
-
|
2420
|
-
|
2421
|
-
|
2422
|
-
|
2423
|
-
|
2424
|
-
|
2425
|
-
|
2426
|
-
|
2427
|
-
|
2428
|
-
|
2429
|
-
|
2430
|
-
|
2431
|
-
|
2432
|
-
|
2433
|
-
disabled: mutation.isLoading,
|
2434
|
-
children: [icon && jsxRuntime.jsx(ui.Icon, {
|
2435
|
-
path: icon
|
2436
|
-
}), label]
|
2437
|
-
}));
|
2445
|
+
function ActionButton(_a) {
|
2446
|
+
var {
|
2447
|
+
onClick
|
2448
|
+
} = _a,
|
2449
|
+
props = __rest$1(_a, ["onClick"]);
|
2450
|
+
const handleClick = React__default["default"].useCallback(event => {
|
2451
|
+
event === null || event === void 0 ? void 0 : event.preventDefault();
|
2452
|
+
event === null || event === void 0 ? void 0 : event.stopPropagation();
|
2453
|
+
onClick === null || onClick === void 0 ? void 0 : onClick(event);
|
2454
|
+
}, [onClick]);
|
2455
|
+
return jsxRuntime.jsx(ui.Button, Object.assign({
|
2456
|
+
dflex: true,
|
2457
|
+
alignContent: "center",
|
2458
|
+
placeContent: "center",
|
2459
|
+
py: "2.5",
|
2460
|
+
px: "3",
|
2461
|
+
h: "full",
|
2462
|
+
size: "lg",
|
2463
|
+
variant: "borderless",
|
2464
|
+
corners: "default",
|
2465
|
+
onClick: handleClick
|
2466
|
+
}, props));
|
2438
2467
|
}
|
2468
|
+
const icons = {
|
2469
|
+
"link": mdiOpenInNew,
|
2470
|
+
"view": mdiEye,
|
2471
|
+
"edit": mdiPencil,
|
2472
|
+
"delete": mdiDelete,
|
2473
|
+
"publish": mdiDelete,
|
2474
|
+
"custom": ""
|
2475
|
+
};
|
2476
|
+
const schemes$1 = {
|
2477
|
+
"link": "dark",
|
2478
|
+
"view": "dark",
|
2479
|
+
"edit": "dark",
|
2480
|
+
"delete": "dark",
|
2481
|
+
"publish": "dark",
|
2482
|
+
"custom": "dark"
|
2483
|
+
};
|
2439
2484
|
|
2440
|
-
function
|
2441
|
-
|
2442
|
-
|
2485
|
+
function useTableProps(api, table, rowActions) {
|
2486
|
+
const navigate = reactRouterDom.useNavigate();
|
2487
|
+
const openLink = hooks.useOpenLink();
|
2443
2488
|
const {
|
2444
|
-
|
2445
|
-
} =
|
2446
|
-
const
|
2447
|
-
|
2448
|
-
|
2449
|
-
|
2450
|
-
|
2451
|
-
|
2452
|
-
|
2453
|
-
|
2454
|
-
|
2455
|
-
|
2456
|
-
|
2457
|
-
|
2458
|
-
|
2459
|
-
|
2460
|
-
|
2461
|
-
|
2462
|
-
|
2463
|
-
|
2464
|
-
|
2489
|
+
onAction
|
2490
|
+
} = useContext();
|
2491
|
+
const {
|
2492
|
+
onRowClick,
|
2493
|
+
columns: c
|
2494
|
+
} = table,
|
2495
|
+
props = __rest$1(table, ["onRowClick", "columns"]);
|
2496
|
+
const onRowClickHandler = React__default["default"].useCallback(item => {
|
2497
|
+
if ((onRowClick === null || onRowClick === void 0 ? void 0 : onRowClick.type) === "navigate") navigate(react.runIfFn(onRowClick.path, item));else if ((onRowClick === null || onRowClick === void 0 ? void 0 : onRowClick.type) == "link") openLink(`${process.env["NEXT_PUBLIC_WEBSITE_URL"]}/${react.runIfFn(onRowClick.path, item)}`);
|
2498
|
+
}, [navigate, onRowClick]);
|
2499
|
+
const columns = React__default["default"].useMemo(() => {
|
2500
|
+
const columns = table.columns.concat([]);
|
2501
|
+
if (rowActions) {
|
2502
|
+
columns.push(createColumnHelper().display({
|
2503
|
+
id: "actions",
|
2504
|
+
header: "Actions",
|
2505
|
+
cell: props => jsxRuntime.jsx(TableRowActionsView, {
|
2506
|
+
row: props.row,
|
2507
|
+
onAction: onAction,
|
2508
|
+
rowActions: rowActions,
|
2509
|
+
api: api,
|
2510
|
+
queryKey: api.queryKey
|
2465
2511
|
})
|
2466
|
-
}
|
2467
|
-
}
|
2468
|
-
|
2512
|
+
}));
|
2513
|
+
}
|
2514
|
+
return columns;
|
2515
|
+
}, [table]);
|
2516
|
+
const tableProps = Object.assign({}, props);
|
2517
|
+
tableProps.columns = columns;
|
2518
|
+
tableProps.onRowClick = onRowClickHandler;
|
2519
|
+
tableProps.queryKey = api.queryKey;
|
2520
|
+
tableProps.queryFn = api.search;
|
2521
|
+
return tableProps;
|
2469
2522
|
}
|
2470
2523
|
|
2471
2524
|
function useId(queryField) {
|
@@ -2528,7 +2581,7 @@ function TT({
|
|
2528
2581
|
breadcrumbs: breadcrumbs
|
2529
2582
|
}), jsxRuntime.jsx(TableTopBar, {
|
2530
2583
|
title: title,
|
2531
|
-
children: jsxRuntime.jsx(
|
2584
|
+
children: jsxRuntime.jsx(TableButtonBar, {
|
2532
2585
|
buttonBar: buttonBar,
|
2533
2586
|
createView: createView,
|
2534
2587
|
editView: editView,
|
@@ -2558,18 +2611,14 @@ function TT({
|
|
2558
2611
|
})]
|
2559
2612
|
});
|
2560
2613
|
}
|
2561
|
-
function
|
2614
|
+
function TableButtonBar({
|
2562
2615
|
buttonBar,
|
2563
2616
|
queryKey,
|
2564
2617
|
createView,
|
2565
2618
|
editView,
|
2566
|
-
api
|
2619
|
+
api,
|
2567
2620
|
children
|
2568
2621
|
}) {
|
2569
|
-
const invalidate = api.useInvalidateQuery(queryKey);
|
2570
|
-
useHotkeys('ctrl+r', () => invalidate(), {
|
2571
|
-
preventDefault: true
|
2572
|
-
}, [invalidate]);
|
2573
2622
|
const createDialog = React__default["default"].useCallback(onClose => {
|
2574
2623
|
const view = createView !== null && createView !== void 0 ? createView : editView;
|
2575
2624
|
if (view.type == "customDialog") return view.render({
|
@@ -2578,26 +2627,12 @@ function ButtonBar({
|
|
2578
2627
|
});else return jsxRuntime.jsx(DialogRenderer, {
|
2579
2628
|
config: view,
|
2580
2629
|
onClose: onClose,
|
2581
|
-
invalidateQueryKey: api
|
2630
|
+
invalidateQueryKey: api.queryKey
|
2582
2631
|
});
|
2583
|
-
}, [editView, api
|
2584
|
-
return jsxRuntime.jsxs(
|
2585
|
-
|
2586
|
-
|
2587
|
-
borderColor: "zinc-200",
|
2588
|
-
divideX: "1px",
|
2589
|
-
divideColor: "zinc-200",
|
2590
|
-
rounded: "lg",
|
2591
|
-
overflow: "hidden",
|
2592
|
-
children: [jsxRuntime.jsx(ui.Button, {
|
2593
|
-
scheme: "dark",
|
2594
|
-
size: "sm",
|
2595
|
-
aspectRatio: "square",
|
2596
|
-
variant: "borderless",
|
2597
|
-
onClick: invalidate,
|
2598
|
-
children: jsxRuntime.jsx(ui.Icon, {
|
2599
|
-
path: mdiRefresh
|
2600
|
-
})
|
2632
|
+
}, [editView, api]);
|
2633
|
+
return jsxRuntime.jsxs(ButtonBar, {
|
2634
|
+
children: [jsxRuntime.jsx(RefreshButton, {
|
2635
|
+
queryKey: queryKey
|
2601
2636
|
}), buttonBar && buttonBar.map((button, index) => jsxRuntime.jsxs(React__default["default"].Fragment, {
|
2602
2637
|
children: [button.type === "create" && editView && jsxRuntime.jsx(TableCreateButton, {
|
2603
2638
|
buildDialog: createDialog
|