@compill/admin 1.0.77 → 1.0.79

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.
Files changed (3) hide show
  1. package/index.cjs.js +10 -17
  2. package/index.esm.js +11 -18
  3. package/package.json +1 -1
package/index.cjs.js CHANGED
@@ -127,13 +127,12 @@ function BreadcrumbItem({
127
127
  breadcrumb,
128
128
  showSeparator
129
129
  }) {
130
- var _a;
131
130
  return jsxRuntime.jsxs(jsxRuntime.Fragment, {
132
131
  children: [showSeparator && jsxRuntime.jsx(ui.Icon, {
133
132
  path: mdiCircleSmall,
134
133
  mx: "1"
135
134
  }), jsxRuntime.jsx(Link__default["default"], {
136
- href: `/${(_a = breadcrumb.path) !== null && _a !== void 0 ? _a : "#"}`,
135
+ href: `/${breadcrumb.path || "#"}`,
137
136
  children: jsxRuntime.jsx("span", {
138
137
  // onClick={breadcrumb.path ? handleClick : undefined}
139
138
  hover_textDecoration: breadcrumb.path ? "underline" : undefined,
@@ -1218,14 +1217,8 @@ function Internal({
1218
1217
  });
1219
1218
  const save = api.useMutate(mutation, {
1220
1219
  processInput,
1221
- successMsg: (item, values) => {
1222
- var _a;
1223
- return `${(_a = item.title) !== null && _a !== void 0 ? _a : item.name} updated.`;
1224
- },
1225
- errorMsg: (error, item) => {
1226
- var _a;
1227
- return `Error updating ${(_a = item.title) !== null && _a !== void 0 ? _a : item.name}: ${error}`;
1228
- }
1220
+ successMsg: (item, values) => `${item.title || item.name} updated.`,
1221
+ errorMsg: (error, item) => `Error updating ${item.title || item.name}: ${error}`
1229
1222
  });
1230
1223
  let editorMaxW = undefined;
1231
1224
  if (!type || type == "post") editorMaxW = "calc(1280px - 28rem)";else if (type == "section") editorMaxW = "calc(1280px - 22rem)";
@@ -2288,7 +2281,7 @@ function ItemDeleteDialog(_a) {
2288
2281
  transition: true
2289
2282
  }, props, {
2290
2283
  children: [jsxRuntime.jsx(ui.Modal.Header, {
2291
- children: title !== null && title !== void 0 ? title : `Delete ${itemLabel}`
2284
+ children: title || `Delete ${itemLabel}`
2292
2285
  }), jsxRuntime.jsxs(ui.Modal.Body, {
2293
2286
  pb: "6",
2294
2287
  children: [!msg && `Do you really want to delete ${itemLabel}?`, msg && react.runIfFn(msg, itemLabel)]
@@ -2307,7 +2300,7 @@ function ItemDeleteDialog(_a) {
2307
2300
  scheme: "danger",
2308
2301
  disabled: mutation.isLoading,
2309
2302
  onClick: handleDelete,
2310
- children: actionButtonLabel !== null && actionButtonLabel !== void 0 ? actionButtonLabel : "Delete"
2303
+ children: actionButtonLabel || "Delete"
2311
2304
  })]
2312
2305
  }), mutation.isLoading && jsxRuntime.jsx(components.ModalLoadingOverlay, {})]
2313
2306
  }));
@@ -2333,7 +2326,7 @@ function TableViewProvider({
2333
2326
  }
2334
2327
  case "link":
2335
2328
  {
2336
- openLink(`${env.Env.websiteUrl()}/${react.runIfFn(action.path, item)}`);
2329
+ openLink(`${env.AppEnv.websiteUrl()}/${react.runIfFn(action.path, item)}`);
2337
2330
  break;
2338
2331
  }
2339
2332
  case "edit":
@@ -2578,7 +2571,7 @@ function useTableProps(api, table, rowActions) {
2578
2571
  }
2579
2572
  case "link":
2580
2573
  {
2581
- openLink(`${env.Env.websiteUrl()}/${react.runIfFn(config.path, item)}`);
2574
+ openLink(`${env.AppEnv.websiteUrl()}/${react.runIfFn(config.path, item)}`);
2582
2575
  break;
2583
2576
  }
2584
2577
  }
@@ -3087,7 +3080,7 @@ function Sidebar(_a) {
3087
3080
  darkMode: darkMode
3088
3081
  }), jsxRuntime.jsx("h1", {
3089
3082
  textSize: "md",
3090
- children: title !== null && title !== void 0 ? title : env.Env.appName()
3083
+ children: title !== null && title !== void 0 ? title : env.AppEnv.appName()
3091
3084
  })]
3092
3085
  }), jsxRuntime.jsx(Menu, {
3093
3086
  overflowY: "auto",
@@ -3108,7 +3101,7 @@ function Logo(_a) {
3108
3101
  return jsxRuntime.jsx("div", Object.assign({}, props, {
3109
3102
  children: jsxRuntime.jsx(Image__default["default"], {
3110
3103
  src: `/logo_${darkMode ? "light" : "dark"}.png`,
3111
- alt: env.Env.appName(),
3104
+ alt: env.AppEnv.appName(),
3112
3105
  width: width,
3113
3106
  height: height,
3114
3107
  priority: true,
@@ -3549,7 +3542,7 @@ function TableRowViewButton(_a) {
3549
3542
  const openPage = React__default["default"].useCallback(event => {
3550
3543
  event === null || event === void 0 ? void 0 : event.preventDefault();
3551
3544
  event === null || event === void 0 ? void 0 : event.stopPropagation();
3552
- window.open(`${env.Env.websiteUrl()}/${path}`, '_blank');
3545
+ window.open(`${env.AppEnv.websiteUrl()}/${path}`, '_blank');
3553
3546
  }, [path]);
3554
3547
  return jsxRuntime.jsx(TableRowActionButton, Object.assign({
3555
3548
  icon: mdiOpenInNew,
package/index.esm.js CHANGED
@@ -17,7 +17,7 @@ import { createPortal } from 'react-dom';
17
17
  import { useRouter } from 'next/router';
18
18
  import { TableContextProvider, useTableContext, Table } from '@compill/table';
19
19
  import { useOpenLink, useBoolean } from '@compill/hooks';
20
- import { Env } from '@compill/env';
20
+ import { AppEnv } from '@compill/env';
21
21
  import { useQueryClient } from '@tanstack/react-query';
22
22
  import Image from 'next/image';
23
23
 
@@ -117,13 +117,12 @@ function BreadcrumbItem({
117
117
  breadcrumb,
118
118
  showSeparator
119
119
  }) {
120
- var _a;
121
120
  return jsxs(Fragment, {
122
121
  children: [showSeparator && jsx(Icon, {
123
122
  path: mdiCircleSmall,
124
123
  mx: "1"
125
124
  }), jsx(Link, {
126
- href: `/${(_a = breadcrumb.path) !== null && _a !== void 0 ? _a : "#"}`,
125
+ href: `/${breadcrumb.path || "#"}`,
127
126
  children: jsx("span", {
128
127
  // onClick={breadcrumb.path ? handleClick : undefined}
129
128
  hover_textDecoration: breadcrumb.path ? "underline" : undefined,
@@ -1208,14 +1207,8 @@ function Internal({
1208
1207
  });
1209
1208
  const save = useMutate(mutation, {
1210
1209
  processInput,
1211
- successMsg: (item, values) => {
1212
- var _a;
1213
- return `${(_a = item.title) !== null && _a !== void 0 ? _a : item.name} updated.`;
1214
- },
1215
- errorMsg: (error, item) => {
1216
- var _a;
1217
- return `Error updating ${(_a = item.title) !== null && _a !== void 0 ? _a : item.name}: ${error}`;
1218
- }
1210
+ successMsg: (item, values) => `${item.title || item.name} updated.`,
1211
+ errorMsg: (error, item) => `Error updating ${item.title || item.name}: ${error}`
1219
1212
  });
1220
1213
  let editorMaxW = undefined;
1221
1214
  if (!type || type == "post") editorMaxW = "calc(1280px - 28rem)";else if (type == "section") editorMaxW = "calc(1280px - 22rem)";
@@ -2278,7 +2271,7 @@ function ItemDeleteDialog(_a) {
2278
2271
  transition: true
2279
2272
  }, props, {
2280
2273
  children: [jsx(Modal.Header, {
2281
- children: title !== null && title !== void 0 ? title : `Delete ${itemLabel}`
2274
+ children: title || `Delete ${itemLabel}`
2282
2275
  }), jsxs(Modal.Body, {
2283
2276
  pb: "6",
2284
2277
  children: [!msg && `Do you really want to delete ${itemLabel}?`, msg && runIfFn(msg, itemLabel)]
@@ -2297,7 +2290,7 @@ function ItemDeleteDialog(_a) {
2297
2290
  scheme: "danger",
2298
2291
  disabled: mutation.isLoading,
2299
2292
  onClick: handleDelete,
2300
- children: actionButtonLabel !== null && actionButtonLabel !== void 0 ? actionButtonLabel : "Delete"
2293
+ children: actionButtonLabel || "Delete"
2301
2294
  })]
2302
2295
  }), mutation.isLoading && jsx(ModalLoadingOverlay, {})]
2303
2296
  }));
@@ -2323,7 +2316,7 @@ function TableViewProvider({
2323
2316
  }
2324
2317
  case "link":
2325
2318
  {
2326
- openLink(`${Env.websiteUrl()}/${runIfFn(action.path, item)}`);
2319
+ openLink(`${AppEnv.websiteUrl()}/${runIfFn(action.path, item)}`);
2327
2320
  break;
2328
2321
  }
2329
2322
  case "edit":
@@ -2568,7 +2561,7 @@ function useTableProps(api, table, rowActions) {
2568
2561
  }
2569
2562
  case "link":
2570
2563
  {
2571
- openLink(`${Env.websiteUrl()}/${runIfFn(config.path, item)}`);
2564
+ openLink(`${AppEnv.websiteUrl()}/${runIfFn(config.path, item)}`);
2572
2565
  break;
2573
2566
  }
2574
2567
  }
@@ -3077,7 +3070,7 @@ function Sidebar(_a) {
3077
3070
  darkMode: darkMode
3078
3071
  }), jsx("h1", {
3079
3072
  textSize: "md",
3080
- children: title !== null && title !== void 0 ? title : Env.appName()
3073
+ children: title !== null && title !== void 0 ? title : AppEnv.appName()
3081
3074
  })]
3082
3075
  }), jsx(Menu, {
3083
3076
  overflowY: "auto",
@@ -3098,7 +3091,7 @@ function Logo(_a) {
3098
3091
  return jsx("div", Object.assign({}, props, {
3099
3092
  children: jsx(Image, {
3100
3093
  src: `/logo_${darkMode ? "light" : "dark"}.png`,
3101
- alt: Env.appName(),
3094
+ alt: AppEnv.appName(),
3102
3095
  width: width,
3103
3096
  height: height,
3104
3097
  priority: true,
@@ -3539,7 +3532,7 @@ function TableRowViewButton(_a) {
3539
3532
  const openPage = React.useCallback(event => {
3540
3533
  event === null || event === void 0 ? void 0 : event.preventDefault();
3541
3534
  event === null || event === void 0 ? void 0 : event.stopPropagation();
3542
- window.open(`${Env.websiteUrl()}/${path}`, '_blank');
3535
+ window.open(`${AppEnv.websiteUrl()}/${path}`, '_blank');
3543
3536
  }, [path]);
3544
3537
  return jsx(TableRowActionButton, Object.assign({
3545
3538
  icon: mdiOpenInNew,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@compill/admin",
3
- "version": "1.0.77",
3
+ "version": "1.0.79",
4
4
  "module": "./index.esm.js",
5
5
  "main": "./index.cjs.js"
6
6
  }