@compill/admin 1.0.74 → 1.0.76

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 CHANGED
@@ -2258,9 +2258,12 @@ function RefreshButton({
2258
2258
 
2259
2259
  function ItemDeleteDialog(_a) {
2260
2260
  var {
2261
+ title,
2262
+ actionButtonLabel,
2261
2263
  itemLabel,
2262
2264
  queryId = "",
2263
2265
  api: api$1,
2266
+ apiFn,
2264
2267
  invalidateQueriesOnSuccess = true,
2265
2268
  invalidateQueryKey,
2266
2269
  size = "lg",
@@ -2269,8 +2272,9 @@ function ItemDeleteDialog(_a) {
2269
2272
  show,
2270
2273
  onClose
2271
2274
  } = _a,
2272
- props = __rest$1(_a, ["itemLabel", "queryId", "api", "invalidateQueriesOnSuccess", "invalidateQueryKey", "size", "md_boxSizing", "msg", "show", "onClose"]);
2273
- const mutation = invalidateQueriesOnSuccess ? api.useInvalidateParentMutation(api$1.delete, invalidateQueryKey !== null && invalidateQueryKey !== void 0 ? invalidateQueryKey : api$1.queryKey) : api.useApiMutation(api$1.delete, api$1.queryKey);
2275
+ props = __rest$1(_a, ["title", "actionButtonLabel", "itemLabel", "queryId", "api", "apiFn", "invalidateQueriesOnSuccess", "invalidateQueryKey", "size", "md_boxSizing", "msg", "show", "onClose"]);
2276
+ const fn = apiFn ? api$1[apiFn] : api$1.delete;
2277
+ const mutation = invalidateQueriesOnSuccess ? api.useInvalidateParentMutation(fn, invalidateQueryKey !== null && invalidateQueryKey !== void 0 ? invalidateQueryKey : api$1.queryKey) : api.useApiMutation(fn, api$1.queryKey);
2274
2278
  const mutate = api.useMutate(mutation, {
2275
2279
  onSuccess: () => onClose === null || onClose === void 0 ? void 0 : onClose()
2276
2280
  });
@@ -2284,7 +2288,7 @@ function ItemDeleteDialog(_a) {
2284
2288
  transition: true
2285
2289
  }, props, {
2286
2290
  children: [jsxRuntime.jsx(ui.Modal.Header, {
2287
- children: `Delete ${itemLabel}`
2291
+ children: title !== null && title !== void 0 ? title : `Delete ${itemLabel}`
2288
2292
  }), jsxRuntime.jsxs(ui.Modal.Body, {
2289
2293
  pb: "6",
2290
2294
  children: [!msg && `Do you really want to delete ${itemLabel}?`, msg && react.runIfFn(msg, itemLabel)]
@@ -2303,7 +2307,7 @@ function ItemDeleteDialog(_a) {
2303
2307
  scheme: "danger",
2304
2308
  disabled: mutation.isLoading,
2305
2309
  onClick: handleDelete,
2306
- children: "Delete"
2310
+ children: "actionButtonLabel ?? Delete"
2307
2311
  })]
2308
2312
  }), mutation.isLoading && jsxRuntime.jsx(components.ModalLoadingOverlay, {})]
2309
2313
  }));
package/index.esm.js CHANGED
@@ -2248,9 +2248,12 @@ function RefreshButton({
2248
2248
 
2249
2249
  function ItemDeleteDialog(_a) {
2250
2250
  var {
2251
+ title,
2252
+ actionButtonLabel,
2251
2253
  itemLabel,
2252
2254
  queryId = "",
2253
2255
  api,
2256
+ apiFn,
2254
2257
  invalidateQueriesOnSuccess = true,
2255
2258
  invalidateQueryKey,
2256
2259
  size = "lg",
@@ -2259,8 +2262,9 @@ function ItemDeleteDialog(_a) {
2259
2262
  show,
2260
2263
  onClose
2261
2264
  } = _a,
2262
- props = __rest$1(_a, ["itemLabel", "queryId", "api", "invalidateQueriesOnSuccess", "invalidateQueryKey", "size", "md_boxSizing", "msg", "show", "onClose"]);
2263
- const mutation = invalidateQueriesOnSuccess ? useInvalidateParentMutation(api.delete, invalidateQueryKey !== null && invalidateQueryKey !== void 0 ? invalidateQueryKey : api.queryKey) : useApiMutation(api.delete, api.queryKey);
2265
+ props = __rest$1(_a, ["title", "actionButtonLabel", "itemLabel", "queryId", "api", "apiFn", "invalidateQueriesOnSuccess", "invalidateQueryKey", "size", "md_boxSizing", "msg", "show", "onClose"]);
2266
+ const fn = apiFn ? api[apiFn] : api.delete;
2267
+ const mutation = invalidateQueriesOnSuccess ? useInvalidateParentMutation(fn, invalidateQueryKey !== null && invalidateQueryKey !== void 0 ? invalidateQueryKey : api.queryKey) : useApiMutation(fn, api.queryKey);
2264
2268
  const mutate = useMutate(mutation, {
2265
2269
  onSuccess: () => onClose === null || onClose === void 0 ? void 0 : onClose()
2266
2270
  });
@@ -2274,7 +2278,7 @@ function ItemDeleteDialog(_a) {
2274
2278
  transition: true
2275
2279
  }, props, {
2276
2280
  children: [jsx(Modal.Header, {
2277
- children: `Delete ${itemLabel}`
2281
+ children: title !== null && title !== void 0 ? title : `Delete ${itemLabel}`
2278
2282
  }), jsxs(Modal.Body, {
2279
2283
  pb: "6",
2280
2284
  children: [!msg && `Do you really want to delete ${itemLabel}?`, msg && runIfFn(msg, itemLabel)]
@@ -2293,7 +2297,7 @@ function ItemDeleteDialog(_a) {
2293
2297
  scheme: "danger",
2294
2298
  disabled: mutation.isLoading,
2295
2299
  onClick: handleDelete,
2296
- children: "Delete"
2300
+ children: "actionButtonLabel ?? Delete"
2297
2301
  })]
2298
2302
  }), mutation.isLoading && jsx(ModalLoadingOverlay, {})]
2299
2303
  }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@compill/admin",
3
- "version": "1.0.74",
3
+ "version": "1.0.76",
4
4
  "module": "./index.esm.js",
5
5
  "main": "./index.cjs.js"
6
6
  }
@@ -5,8 +5,11 @@ export interface ItemDeleteDialogProps extends ModalProps {
5
5
  itemLabel: string;
6
6
  queryId: string;
7
7
  api: CRUDAPI<any>;
8
+ apiFn?: string;
8
9
  invalidateQueriesOnSuccess?: boolean;
9
10
  invalidateQueryKey?: string[];
10
11
  msg?: (itemLabel: string) => string | React.ReactNode;
12
+ actionButtonLabel?: string;
13
+ title?: string;
11
14
  }
12
- export declare function ItemDeleteDialog({ itemLabel, queryId, api, invalidateQueriesOnSuccess, invalidateQueryKey, size, md_boxSizing, msg, show, onClose, ...props }: ItemDeleteDialogProps): JSX.Element;
15
+ export declare function ItemDeleteDialog({ title, actionButtonLabel, itemLabel, queryId, api, apiFn, invalidateQueriesOnSuccess, invalidateQueryKey, size, md_boxSizing, msg, show, onClose, ...props }: ItemDeleteDialogProps): JSX.Element;