@compill/admin 1.0.54 → 1.0.55
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 +36 -14
- package/index.esm.js +36 -14
- package/package.json +1 -1
package/index.cjs.js
CHANGED
@@ -2290,18 +2290,20 @@ function TableViewProvider({
|
|
2290
2290
|
case "edit":
|
2291
2291
|
{
|
2292
2292
|
const editConfig = react.runIfFn(editView, item);
|
2293
|
-
if (editConfig
|
2294
|
-
|
2295
|
-
|
2296
|
-
|
2297
|
-
|
2298
|
-
|
2299
|
-
|
2300
|
-
|
2301
|
-
|
2302
|
-
|
2303
|
-
|
2304
|
-
|
2293
|
+
if (editConfig) {
|
2294
|
+
if (editConfig.type == "customDialog") {
|
2295
|
+
setDialog(editConfig.render({
|
2296
|
+
show: true,
|
2297
|
+
onClose: onCloseDialog
|
2298
|
+
}));
|
2299
|
+
} else {
|
2300
|
+
setDialog(jsxRuntime.jsx(DialogRenderer, {
|
2301
|
+
onClose: onCloseDialog,
|
2302
|
+
config: editConfig,
|
2303
|
+
queryId: item.id,
|
2304
|
+
invalidateQueryKey: queryKey
|
2305
|
+
}));
|
2306
|
+
}
|
2305
2307
|
}
|
2306
2308
|
break;
|
2307
2309
|
}
|
@@ -2511,7 +2513,27 @@ function useTableProps(api, table, rowActions) {
|
|
2511
2513
|
} = table,
|
2512
2514
|
props = __rest$1(table, ["onRowClick", "columns"]);
|
2513
2515
|
const onRowClickHandler = React__default["default"].useCallback(item => {
|
2514
|
-
|
2516
|
+
var _a;
|
2517
|
+
const config = react.runIfFn(onRowClick, item);
|
2518
|
+
if (config) {
|
2519
|
+
switch (config.type) {
|
2520
|
+
case "navigate":
|
2521
|
+
{
|
2522
|
+
navigate((_a = react.runIfFn(config.path, item)) !== null && _a !== void 0 ? _a : "");
|
2523
|
+
break;
|
2524
|
+
}
|
2525
|
+
case "nextpush":
|
2526
|
+
{
|
2527
|
+
nextRouter.push(react.runIfFn(config.path, item));
|
2528
|
+
break;
|
2529
|
+
}
|
2530
|
+
case "link":
|
2531
|
+
{
|
2532
|
+
openLink(`${process.env["NEXT_PUBLIC_WEBSITE_URL"]}/${react.runIfFn(config.path, item)}`);
|
2533
|
+
break;
|
2534
|
+
}
|
2535
|
+
}
|
2536
|
+
}
|
2515
2537
|
}, [navigate, onRowClick]);
|
2516
2538
|
const columns = React__default["default"].useMemo(() => {
|
2517
2539
|
const columns = table.columns.concat([]);
|
@@ -2529,7 +2551,7 @@ function useTableProps(api, table, rowActions) {
|
|
2529
2551
|
}));
|
2530
2552
|
}
|
2531
2553
|
return columns;
|
2532
|
-
}, [table]);
|
2554
|
+
}, [table, onAction, rowActions, api]);
|
2533
2555
|
const tableProps = Object.assign({}, props);
|
2534
2556
|
tableProps.columns = columns;
|
2535
2557
|
tableProps.onRowClick = onRowClickHandler;
|
package/index.esm.js
CHANGED
@@ -2281,18 +2281,20 @@ function TableViewProvider({
|
|
2281
2281
|
case "edit":
|
2282
2282
|
{
|
2283
2283
|
const editConfig = runIfFn(editView, item);
|
2284
|
-
if (editConfig
|
2285
|
-
|
2286
|
-
|
2287
|
-
|
2288
|
-
|
2289
|
-
|
2290
|
-
|
2291
|
-
|
2292
|
-
|
2293
|
-
|
2294
|
-
|
2295
|
-
|
2284
|
+
if (editConfig) {
|
2285
|
+
if (editConfig.type == "customDialog") {
|
2286
|
+
setDialog(editConfig.render({
|
2287
|
+
show: true,
|
2288
|
+
onClose: onCloseDialog
|
2289
|
+
}));
|
2290
|
+
} else {
|
2291
|
+
setDialog(jsx(DialogRenderer, {
|
2292
|
+
onClose: onCloseDialog,
|
2293
|
+
config: editConfig,
|
2294
|
+
queryId: item.id,
|
2295
|
+
invalidateQueryKey: queryKey
|
2296
|
+
}));
|
2297
|
+
}
|
2296
2298
|
}
|
2297
2299
|
break;
|
2298
2300
|
}
|
@@ -2502,7 +2504,27 @@ function useTableProps(api, table, rowActions) {
|
|
2502
2504
|
} = table,
|
2503
2505
|
props = __rest$1(table, ["onRowClick", "columns"]);
|
2504
2506
|
const onRowClickHandler = React.useCallback(item => {
|
2505
|
-
|
2507
|
+
var _a;
|
2508
|
+
const config = runIfFn(onRowClick, item);
|
2509
|
+
if (config) {
|
2510
|
+
switch (config.type) {
|
2511
|
+
case "navigate":
|
2512
|
+
{
|
2513
|
+
navigate((_a = runIfFn(config.path, item)) !== null && _a !== void 0 ? _a : "");
|
2514
|
+
break;
|
2515
|
+
}
|
2516
|
+
case "nextpush":
|
2517
|
+
{
|
2518
|
+
nextRouter.push(runIfFn(config.path, item));
|
2519
|
+
break;
|
2520
|
+
}
|
2521
|
+
case "link":
|
2522
|
+
{
|
2523
|
+
openLink(`${process.env["NEXT_PUBLIC_WEBSITE_URL"]}/${runIfFn(config.path, item)}`);
|
2524
|
+
break;
|
2525
|
+
}
|
2526
|
+
}
|
2527
|
+
}
|
2506
2528
|
}, [navigate, onRowClick]);
|
2507
2529
|
const columns = React.useMemo(() => {
|
2508
2530
|
const columns = table.columns.concat([]);
|
@@ -2520,7 +2542,7 @@ function useTableProps(api, table, rowActions) {
|
|
2520
2542
|
}));
|
2521
2543
|
}
|
2522
2544
|
return columns;
|
2523
|
-
}, [table]);
|
2545
|
+
}, [table, onAction, rowActions, api]);
|
2524
2546
|
const tableProps = Object.assign({}, props);
|
2525
2547
|
tableProps.columns = columns;
|
2526
2548
|
tableProps.onRowClick = onRowClickHandler;
|