@compill/admin 1.0.72 → 1.0.74

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
@@ -8,15 +8,15 @@ var Link = require('next/link');
8
8
  var React = require('react');
9
9
  var adminApi = require('@compill/admin-api');
10
10
  var api = require('@compill/api');
11
+ var formik = require('formik');
11
12
  var reactRouterDom = require('react-router-dom');
13
+ var admin = require('@compill/admin');
12
14
  var reactToastify = require('react-toastify');
13
- var form = require('@compill/form');
14
- var formik = require('formik');
15
15
  require('react/jsx-runtime');
16
16
  var components = require('@compill/components');
17
+ var form = require('@compill/form');
17
18
  var react = require('@soperio/react');
18
19
  var editor = require('@compill/editor');
19
- var admin = require('@compill/admin');
20
20
  var reactDom = require('react-dom');
21
21
  var router = require('next/router');
22
22
  var table = require('@compill/table');
@@ -205,6 +205,43 @@ const ButtonBarButton = /*#__PURE__*/React__default["default"].forwardRef(functi
205
205
  }), children]
206
206
  }));
207
207
  });
208
+ const ButtonBarSubmitButton = /*#__PURE__*/React__default["default"].forwardRef(function (_a, ref) {
209
+ var _b;
210
+ var {
211
+ useDirty,
212
+ disabled,
213
+ icon,
214
+ children
215
+ } = _a,
216
+ props = __rest$1(_a, ["useDirty", "disabled", "icon", "children"]);
217
+ const {
218
+ dirty,
219
+ handleSubmit
220
+ } = (_b = formik.useFormikContext()) !== null && _b !== void 0 ? _b : {
221
+ dirty: false,
222
+ handleSubmit: undefined,
223
+ values: {}
224
+ };
225
+ const onSubmit = React__default["default"].useCallback(() => handleSubmit(), [handleSubmit]);
226
+ return jsxRuntime.jsxs(ui.Button, Object.assign({
227
+ scheme: "dark",
228
+ size: "sm",
229
+ aspectRatio: icon && !children ? "square" : undefined,
230
+ variant: "borderless",
231
+ dflex: true,
232
+ alignItems: "center",
233
+ placeContent: "center",
234
+ corners: "square",
235
+ gap: "2",
236
+ disabled: useDirty && !dirty || disabled,
237
+ onClick: onSubmit
238
+ }, props, {
239
+ ref: ref,
240
+ children: [icon && jsxRuntime.jsx(ui.Icon, {
241
+ path: icon
242
+ }), children]
243
+ }));
244
+ });
208
245
  function ButtonBarDialogButton(_a) {
209
246
  var {
210
247
  icon,
@@ -285,20 +322,12 @@ function PublishButton(_a) {
285
322
  mutation.reset();
286
323
  mutation.mutateAsync(queryId).then(() => reactToastify.toast.success(isDraft ? "Published!" : "Unpublished!")).catch(error => reactToastify.toast.error(`Error: ${error}`));
287
324
  }, [mutation, queryId]);
288
- return jsxRuntime.jsxs(ui.Button, Object.assign({
289
- scheme: "secondary",
290
- variant: "glass",
291
- size: "sm",
292
- px: "3",
325
+ return jsxRuntime.jsx(admin.ButtonBarButton, Object.assign({
293
326
  disabled: mutation.isLoading,
294
327
  onClick: publish,
295
- dflex: true,
296
- alignItems: "center",
297
- gap: "3"
328
+ icon: isDraft ? mdiEye : mdiEyeOff
298
329
  }, props, {
299
- children: [jsxRuntime.jsx(ui.Icon, {
300
- path: isDraft ? mdiEye : mdiEyeOff
301
- }), isDraft ? "Publish" : "Switch to draft"]
330
+ children: isDraft ? "Publish" : "Switch to draft"
302
331
  }));
303
332
  }
304
333
 
@@ -705,17 +734,10 @@ function UpdateButton(_a) {
705
734
  }, {
706
735
  preventDefault: true
707
736
  }, [dirty, props, handleSubmit]);
708
- return jsxRuntime.jsxs(form.SubmitButton, Object.assign({
709
- type: "submit",
710
- size: "sm",
711
- px: "3",
712
- dflex: true,
713
- alignItems: "center",
714
- gap: "3"
737
+ return jsxRuntime.jsx(admin.ButtonBarSubmitButton, Object.assign({
738
+ icon: mdiCloudUpload
715
739
  }, props, {
716
- children: [jsxRuntime.jsx(ui.Icon, {
717
- path: mdiCloudUpload
718
- }), "Update"]
740
+ children: "Update"
719
741
  }));
720
742
  }
721
743
 
@@ -938,12 +960,7 @@ function PageSidebarSection(_a) {
938
960
  } = _a,
939
961
  props = __rest$1(_a, ["title", "children"]);
940
962
  return jsxRuntime.jsxs("div", Object.assign({
941
- w: "full",
942
- bgColor: "white",
943
- rounded: "lg",
944
- p: "5",
945
- textSize: "sm",
946
- shadow: true
963
+ w: "full"
947
964
  }, props, {
948
965
  children: [title && jsxRuntime.jsx(admin.PageSectionTitle, {
949
966
  children: title
@@ -1124,13 +1141,15 @@ function Buttons$1({
1124
1141
  }), button.type === "invalidate" && jsxRuntime.jsx(InvalidateButton, {
1125
1142
  pathOrPermalink: button.pathOrPermalink
1126
1143
  }), button.type == "custom" && button.render(item)]
1127
- }, index)), jsxRuntime.jsx(PublishButton, {
1128
- api: api,
1129
- queryId: item.id,
1130
- status: item.status,
1131
- disabled: isLoading
1132
- }), jsxRuntime.jsx(UpdateButton, {
1133
- disabled: isLoading
1144
+ }, index)), jsxRuntime.jsxs(admin.ButtonBar, {
1145
+ children: [api instanceof adminApi.API && jsxRuntime.jsx(PublishButton, {
1146
+ api: api,
1147
+ queryId: item.id,
1148
+ status: item.status,
1149
+ disabled: isLoading
1150
+ }), jsxRuntime.jsx(UpdateButton, {
1151
+ disabled: isLoading
1152
+ })]
1134
1153
  })]
1135
1154
  });
1136
1155
  }
@@ -1182,18 +1201,18 @@ function Internal({
1182
1201
  tabbed,
1183
1202
  containerRef
1184
1203
  }) {
1204
+ var _a, _b, _c;
1205
+ const pScreen = react.runIfFn(screen, item);
1185
1206
  const {
1186
1207
  breadcrumbs,
1187
1208
  schema,
1188
1209
  initialValues,
1189
1210
  header,
1190
- editorFooter: editoFooter,
1191
1211
  sections,
1192
1212
  buttonBar,
1193
- editor,
1194
1213
  type,
1195
1214
  invalidateParentQueryKey
1196
- } = react.runIfFn(screen, item);
1215
+ } = pScreen;
1197
1216
  const mutation = api.useInvalidateParentMutation(api$1.update, invalidateParentQueryKey !== null && invalidateParentQueryKey !== void 0 ? invalidateParentQueryKey : api$1.queryKey, {
1198
1217
  networkMode: "always"
1199
1218
  });
@@ -1223,7 +1242,10 @@ function Internal({
1223
1242
  item: item,
1224
1243
  isLoading: mutation.isLoading,
1225
1244
  trackingRef: containerRef === null || containerRef === void 0 ? void 0 : containerRef.current
1226
- }), jsxRuntime.jsx("div", {
1245
+ }), type == "form" && (sections === null || sections === void 0 ? void 0 : sections.map((section, index) => jsxRuntime.jsx(Section, {
1246
+ section: section,
1247
+ item: item
1248
+ }, index))), (pScreen.type == "post" || pScreen.type == "section") && jsxRuntime.jsx("div", {
1227
1249
  p: "5",
1228
1250
  bgColor: "slate-100",
1229
1251
  rounded: "lg",
@@ -1239,7 +1261,7 @@ function Internal({
1239
1261
  flexCol: true,
1240
1262
  gap: "8",
1241
1263
  flexGrow: true,
1242
- children: [(editor === null || editor === void 0 ? void 0 : editor.type) != "textarea" &&
1264
+ children: [((_a = pScreen.editor) === null || _a === void 0 ? void 0 : _a.type) != "textarea" &&
1243
1265
  // TODO Find a way to make this editor shrink in width when resizing the window...
1244
1266
  jsxRuntime.jsx(PageContentEditor, {
1245
1267
  name: "content",
@@ -1247,8 +1269,8 @@ function Internal({
1247
1269
  minW: "144",
1248
1270
  shadow: true,
1249
1271
  rounded: "lg"
1250
- }), (editor === null || editor === void 0 ? void 0 : editor.type) == "textarea" && jsxRuntime.jsx(form.TextArea, {
1251
- name: editor === null || editor === void 0 ? void 0 : editor.name,
1272
+ }), ((_b = pScreen.editor) === null || _b === void 0 ? void 0 : _b.type) == "textarea" && jsxRuntime.jsx(form.TextArea, {
1273
+ name: (_c = pScreen.editor) === null || _c === void 0 ? void 0 : _c.name,
1252
1274
  maxW: editorMaxW,
1253
1275
  minW: editorMaxW,
1254
1276
  w: editorMaxW,
@@ -1259,11 +1281,12 @@ function Internal({
1259
1281
  shadow: true,
1260
1282
  p: "5",
1261
1283
  textColor: "slate-800"
1262
- }), editoFooter]
1284
+ }), pScreen.editorFooter]
1263
1285
  }), jsxRuntime.jsx(PageSidebar, {
1264
1286
  children: sections === null || sections === void 0 ? void 0 : sections.map((section, index) => jsxRuntime.jsx(Section, {
1265
1287
  section: section,
1266
- item: item
1288
+ item: item,
1289
+ cardStyle: true
1267
1290
  }, index))
1268
1291
  })]
1269
1292
  })]
@@ -1273,15 +1296,24 @@ function Internal({
1273
1296
  }
1274
1297
  function Section({
1275
1298
  section,
1276
- item
1299
+ item,
1300
+ cardStyle
1277
1301
  }) {
1278
1302
  if (section.type === "section") {
1279
- return jsxRuntime.jsx(PageSidebarSection, {
1280
- title: section.title,
1303
+ const style = cardStyle ? {
1304
+ bgColor: "white",
1305
+ rounded: "lg",
1306
+ p: "5",
1307
+ textSize: "sm",
1308
+ shadow: true
1309
+ } : {};
1310
+ return jsxRuntime.jsx(PageSidebarSection, Object.assign({
1311
+ title: section.title
1312
+ }, style, {
1281
1313
  children: jsxRuntime.jsx(form.FormRenderer, {
1282
1314
  form: react.runIfFn(section.form, item)
1283
1315
  })
1284
- });
1316
+ }));
1285
1317
  }
1286
1318
  if (section.type === "custom") return react.runIfFn(section.component, item);
1287
1319
  return null;
@@ -3644,6 +3676,7 @@ exports.Breadcrumbs = Breadcrumbs;
3644
3676
  exports.ButtonBar = ButtonBar;
3645
3677
  exports.ButtonBarButton = ButtonBarButton;
3646
3678
  exports.ButtonBarDialogButton = ButtonBarDialogButton;
3679
+ exports.ButtonBarSubmitButton = ButtonBarSubmitButton;
3647
3680
  exports.DialogButton = DialogButton;
3648
3681
  exports.FormActionDialog = FormActionDialog;
3649
3682
  exports.InvalidateButton = InvalidateButton;
package/index.esm.js CHANGED
@@ -2,17 +2,17 @@ import { jsx, jsxs, Fragment } from '@soperio/jsx-runtime';
2
2
  import { Icon, Button, IconButton, Container, Tile, Popover, Collapse, Modal, Checkbox, Badge } from '@valerya/ui';
3
3
  import Link from 'next/link';
4
4
  import React, { useRef, useCallback, useContext as useContext$2, useLayoutEffect, useEffect, createContext } from 'react';
5
- import { INVALIDATE_API } from '@compill/admin-api';
5
+ import { INVALIDATE_API, API } from '@compill/admin-api';
6
6
  import { useApiMutation, useMutate, useInvalidateMutation, useApiQuery, useInvalidateQuery, useInvalidateParentMutation, useApiQueries } from '@compill/api';
7
+ import { useFormikContext, Field, Formik, Form } from 'formik';
7
8
  import { useNavigate, useParams, Outlet, useLocation, useMatch, Link as Link$1 } from 'react-router-dom';
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';
8
10
  import { toast } from 'react-toastify';
9
- import { SubmitButton, FormProvider, TextArea, FormRenderer, mergeInitialFormValues, FieldLabel } from '@compill/form';
10
- import { useFormikContext, Field, Formik, Form } from 'formik';
11
11
  import 'react/jsx-runtime';
12
12
  import { FlexCenter, QueryLoadingState, RetryOnError, TabContainer, ModalLoadingOverlay } from '@compill/components';
13
+ import { FormProvider, TextArea, FormRenderer, mergeInitialFormValues, FieldLabel, SubmitButton } from '@compill/form';
13
14
  import { createContext as createContext$1, runIfFn, isFunction } from '@soperio/react';
14
15
  import { Editor } from '@compill/editor';
15
- import { PageSectionTitle as PageSectionTitle$1, ButtonBarDialogButton as ButtonBarDialogButton$1, TableRowActionButton as TableRowActionButton$1, DialogButton as DialogButton$1 } from '@compill/admin';
16
16
  import { createPortal } from 'react-dom';
17
17
  import { useRouter } from 'next/router';
18
18
  import { TableContextProvider, useTableContext, Table } from '@compill/table';
@@ -195,6 +195,43 @@ const ButtonBarButton = /*#__PURE__*/React.forwardRef(function (_a, ref) {
195
195
  }), children]
196
196
  }));
197
197
  });
198
+ const ButtonBarSubmitButton = /*#__PURE__*/React.forwardRef(function (_a, ref) {
199
+ var _b;
200
+ var {
201
+ useDirty,
202
+ disabled,
203
+ icon,
204
+ children
205
+ } = _a,
206
+ props = __rest$1(_a, ["useDirty", "disabled", "icon", "children"]);
207
+ const {
208
+ dirty,
209
+ handleSubmit
210
+ } = (_b = useFormikContext()) !== null && _b !== void 0 ? _b : {
211
+ dirty: false,
212
+ handleSubmit: undefined,
213
+ values: {}
214
+ };
215
+ const onSubmit = React.useCallback(() => handleSubmit(), [handleSubmit]);
216
+ return jsxs(Button, Object.assign({
217
+ scheme: "dark",
218
+ size: "sm",
219
+ aspectRatio: icon && !children ? "square" : undefined,
220
+ variant: "borderless",
221
+ dflex: true,
222
+ alignItems: "center",
223
+ placeContent: "center",
224
+ corners: "square",
225
+ gap: "2",
226
+ disabled: useDirty && !dirty || disabled,
227
+ onClick: onSubmit
228
+ }, props, {
229
+ ref: ref,
230
+ children: [icon && jsx(Icon, {
231
+ path: icon
232
+ }), children]
233
+ }));
234
+ });
198
235
  function ButtonBarDialogButton(_a) {
199
236
  var {
200
237
  icon,
@@ -275,20 +312,12 @@ function PublishButton(_a) {
275
312
  mutation.reset();
276
313
  mutation.mutateAsync(queryId).then(() => toast.success(isDraft ? "Published!" : "Unpublished!")).catch(error => toast.error(`Error: ${error}`));
277
314
  }, [mutation, queryId]);
278
- return jsxs(Button, Object.assign({
279
- scheme: "secondary",
280
- variant: "glass",
281
- size: "sm",
282
- px: "3",
315
+ return jsx(ButtonBarButton$1, Object.assign({
283
316
  disabled: mutation.isLoading,
284
317
  onClick: publish,
285
- dflex: true,
286
- alignItems: "center",
287
- gap: "3"
318
+ icon: isDraft ? mdiEye : mdiEyeOff
288
319
  }, props, {
289
- children: [jsx(Icon, {
290
- path: isDraft ? mdiEye : mdiEyeOff
291
- }), isDraft ? "Publish" : "Switch to draft"]
320
+ children: isDraft ? "Publish" : "Switch to draft"
292
321
  }));
293
322
  }
294
323
 
@@ -695,17 +724,10 @@ function UpdateButton(_a) {
695
724
  }, {
696
725
  preventDefault: true
697
726
  }, [dirty, props, handleSubmit]);
698
- return jsxs(SubmitButton, Object.assign({
699
- type: "submit",
700
- size: "sm",
701
- px: "3",
702
- dflex: true,
703
- alignItems: "center",
704
- gap: "3"
727
+ return jsx(ButtonBarSubmitButton$1, Object.assign({
728
+ icon: mdiCloudUpload
705
729
  }, props, {
706
- children: [jsx(Icon, {
707
- path: mdiCloudUpload
708
- }), "Update"]
730
+ children: "Update"
709
731
  }));
710
732
  }
711
733
 
@@ -928,12 +950,7 @@ function PageSidebarSection(_a) {
928
950
  } = _a,
929
951
  props = __rest$1(_a, ["title", "children"]);
930
952
  return jsxs("div", Object.assign({
931
- w: "full",
932
- bgColor: "white",
933
- rounded: "lg",
934
- p: "5",
935
- textSize: "sm",
936
- shadow: true
953
+ w: "full"
937
954
  }, props, {
938
955
  children: [title && jsx(PageSectionTitle$1, {
939
956
  children: title
@@ -1114,13 +1131,15 @@ function Buttons$1({
1114
1131
  }), button.type === "invalidate" && jsx(InvalidateButton, {
1115
1132
  pathOrPermalink: button.pathOrPermalink
1116
1133
  }), button.type == "custom" && button.render(item)]
1117
- }, index)), jsx(PublishButton, {
1118
- api: api,
1119
- queryId: item.id,
1120
- status: item.status,
1121
- disabled: isLoading
1122
- }), jsx(UpdateButton, {
1123
- disabled: isLoading
1134
+ }, index)), jsxs(ButtonBar$1, {
1135
+ children: [api instanceof API && jsx(PublishButton, {
1136
+ api: api,
1137
+ queryId: item.id,
1138
+ status: item.status,
1139
+ disabled: isLoading
1140
+ }), jsx(UpdateButton, {
1141
+ disabled: isLoading
1142
+ })]
1124
1143
  })]
1125
1144
  });
1126
1145
  }
@@ -1172,18 +1191,18 @@ function Internal({
1172
1191
  tabbed,
1173
1192
  containerRef
1174
1193
  }) {
1194
+ var _a, _b, _c;
1195
+ const pScreen = runIfFn(screen, item);
1175
1196
  const {
1176
1197
  breadcrumbs,
1177
1198
  schema,
1178
1199
  initialValues,
1179
1200
  header,
1180
- editorFooter: editoFooter,
1181
1201
  sections,
1182
1202
  buttonBar,
1183
- editor,
1184
1203
  type,
1185
1204
  invalidateParentQueryKey
1186
- } = runIfFn(screen, item);
1205
+ } = pScreen;
1187
1206
  const mutation = useInvalidateParentMutation(api.update, invalidateParentQueryKey !== null && invalidateParentQueryKey !== void 0 ? invalidateParentQueryKey : api.queryKey, {
1188
1207
  networkMode: "always"
1189
1208
  });
@@ -1213,7 +1232,10 @@ function Internal({
1213
1232
  item: item,
1214
1233
  isLoading: mutation.isLoading,
1215
1234
  trackingRef: containerRef === null || containerRef === void 0 ? void 0 : containerRef.current
1216
- }), jsx("div", {
1235
+ }), type == "form" && (sections === null || sections === void 0 ? void 0 : sections.map((section, index) => jsx(Section, {
1236
+ section: section,
1237
+ item: item
1238
+ }, index))), (pScreen.type == "post" || pScreen.type == "section") && jsx("div", {
1217
1239
  p: "5",
1218
1240
  bgColor: "slate-100",
1219
1241
  rounded: "lg",
@@ -1229,7 +1251,7 @@ function Internal({
1229
1251
  flexCol: true,
1230
1252
  gap: "8",
1231
1253
  flexGrow: true,
1232
- children: [(editor === null || editor === void 0 ? void 0 : editor.type) != "textarea" &&
1254
+ children: [((_a = pScreen.editor) === null || _a === void 0 ? void 0 : _a.type) != "textarea" &&
1233
1255
  // TODO Find a way to make this editor shrink in width when resizing the window...
1234
1256
  jsx(PageContentEditor, {
1235
1257
  name: "content",
@@ -1237,8 +1259,8 @@ function Internal({
1237
1259
  minW: "144",
1238
1260
  shadow: true,
1239
1261
  rounded: "lg"
1240
- }), (editor === null || editor === void 0 ? void 0 : editor.type) == "textarea" && jsx(TextArea, {
1241
- name: editor === null || editor === void 0 ? void 0 : editor.name,
1262
+ }), ((_b = pScreen.editor) === null || _b === void 0 ? void 0 : _b.type) == "textarea" && jsx(TextArea, {
1263
+ name: (_c = pScreen.editor) === null || _c === void 0 ? void 0 : _c.name,
1242
1264
  maxW: editorMaxW,
1243
1265
  minW: editorMaxW,
1244
1266
  w: editorMaxW,
@@ -1249,11 +1271,12 @@ function Internal({
1249
1271
  shadow: true,
1250
1272
  p: "5",
1251
1273
  textColor: "slate-800"
1252
- }), editoFooter]
1274
+ }), pScreen.editorFooter]
1253
1275
  }), jsx(PageSidebar, {
1254
1276
  children: sections === null || sections === void 0 ? void 0 : sections.map((section, index) => jsx(Section, {
1255
1277
  section: section,
1256
- item: item
1278
+ item: item,
1279
+ cardStyle: true
1257
1280
  }, index))
1258
1281
  })]
1259
1282
  })]
@@ -1263,15 +1286,24 @@ function Internal({
1263
1286
  }
1264
1287
  function Section({
1265
1288
  section,
1266
- item
1289
+ item,
1290
+ cardStyle
1267
1291
  }) {
1268
1292
  if (section.type === "section") {
1269
- return jsx(PageSidebarSection, {
1270
- title: section.title,
1293
+ const style = cardStyle ? {
1294
+ bgColor: "white",
1295
+ rounded: "lg",
1296
+ p: "5",
1297
+ textSize: "sm",
1298
+ shadow: true
1299
+ } : {};
1300
+ return jsx(PageSidebarSection, Object.assign({
1301
+ title: section.title
1302
+ }, style, {
1271
1303
  children: jsx(FormRenderer, {
1272
1304
  form: runIfFn(section.form, item)
1273
1305
  })
1274
- });
1306
+ }));
1275
1307
  }
1276
1308
  if (section.type === "custom") return runIfFn(section.component, item);
1277
1309
  return null;
@@ -3628,4 +3660,4 @@ function TableRowPublishPostButton(_a) {
3628
3660
  }, props));
3629
3661
  }
3630
3662
 
3631
- export { AdminLayout, AttachDialog, Breadcrumbs, ButtonBar, ButtonBarButton, ButtonBarDialogButton, DialogButton, FormActionDialog, InvalidateButton, ItemDeleteDialog, ItemEditDialog, Menu, NavigateButton, OrderCell, PageContainer, PageContentEditor, PageMain, PageQueryStateContainer, PageSectionTitle, PageSidebar, PageSidebarSection, PageStateContainer, PageSubSectionTitle, PageTabbedTopBar, PageTabbedTopBarProvider, PageTitle, PageTopBar, PageTopBarToolbar, PublishButton, ScreenRenderer, SectionTitle, StatusBadge, TableContainer, TableCreateButton, TableFilterButton, TableRowActionBar, TableRowActionButton, TableRowActionDialogButton, TableRowDeleteButton, TableRowEditButton, TableRowNavigateButton, TableRowPublishPostButton, TableRowViewButton, TableTopBar, UpdateButton, ViewButton };
3663
+ export { AdminLayout, AttachDialog, Breadcrumbs, ButtonBar, ButtonBarButton, ButtonBarDialogButton, ButtonBarSubmitButton, DialogButton, FormActionDialog, InvalidateButton, ItemDeleteDialog, ItemEditDialog, Menu, NavigateButton, OrderCell, PageContainer, PageContentEditor, PageMain, PageQueryStateContainer, PageSectionTitle, PageSidebar, PageSidebarSection, PageStateContainer, PageSubSectionTitle, PageTabbedTopBar, PageTabbedTopBarProvider, PageTitle, PageTopBar, PageTopBarToolbar, PublishButton, ScreenRenderer, SectionTitle, StatusBadge, TableContainer, TableCreateButton, TableFilterButton, TableRowActionBar, TableRowActionButton, TableRowActionDialogButton, TableRowDeleteButton, TableRowEditButton, TableRowNavigateButton, TableRowPublishPostButton, TableRowViewButton, TableTopBar, UpdateButton, ViewButton };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@compill/admin",
3
- "version": "1.0.72",
3
+ "version": "1.0.74",
4
4
  "module": "./index.esm.js",
5
5
  "main": "./index.cjs.js"
6
6
  }
@@ -2,11 +2,12 @@
2
2
  import { API } from "@compill/admin-api";
3
3
  import { Breadcrumb } from "../breadcrumbs/BreadCrumbs";
4
4
  import { DetailViewButton } from "./types/DetailsView";
5
+ import { CRUDAPI } from "@compill/api";
5
6
  interface ScreenTopBarProps {
6
7
  tabbed?: boolean;
7
8
  breadcrumbs?: Breadcrumb[];
8
9
  buttonBar?: DetailViewButton[];
9
- api: API<any>;
10
+ api: CRUDAPI<any> | API<any>;
10
11
  item: any;
11
12
  isLoading: boolean;
12
13
  trackingRef?: Element | null;
@@ -3,9 +3,10 @@ import { API } from "@compill/admin-api";
3
3
  import * as Yup from "yup";
4
4
  import { Breadcrumb } from "../../breadcrumbs/BreadCrumbs";
5
5
  import { FormRendererConfig } from "@compill/form";
6
+ import { CRUDAPI } from "@compill/api";
6
7
  export type DetailsViewConfig<T = any> = {
7
8
  type: "details";
8
- api: API<T>;
9
+ api: CRUDAPI<T> | API<T>;
9
10
  queryField: string;
10
11
  useNextRouter?: boolean;
11
12
  processInput?: (input: T) => any;
@@ -19,10 +20,13 @@ type Screen = {
19
20
  header?: React.ReactNode;
20
21
  sections?: DetailSection[];
21
22
  buttonBar?: DetailViewButton[];
23
+ } & ({
24
+ type: "form";
25
+ } | {
26
+ type?: "post" | "section";
22
27
  editor?: DetailEditor;
23
28
  editorFooter?: React.ReactNode;
24
- type?: "post" | "section";
25
- };
29
+ });
26
30
  type DetailEditor = {
27
31
  type?: "blockEditor";
28
32
  name: string;
@@ -32,7 +36,7 @@ type DetailEditor = {
32
36
  };
33
37
  export type DetailSection = {
34
38
  type: "section";
35
- title: string;
39
+ title?: string;
36
40
  form: FormRendererConfig | ((item: any) => FormRendererConfig);
37
41
  } | {
38
42
  type: "custom";
@@ -9,6 +9,10 @@ export type ButtonBarButtonProps = {
9
9
  export declare const ButtonBarButton: React.ForwardRefExoticComponent<{
10
10
  icon?: string | undefined;
11
11
  } & ButtonProps & React.RefAttributes<HTMLDivElement>>;
12
+ export interface ButtonBarSubmitButtonProps extends ButtonBarButtonProps {
13
+ useDirty?: boolean;
14
+ }
15
+ export declare const ButtonBarSubmitButton: React.ForwardRefExoticComponent<ButtonBarSubmitButtonProps & React.RefAttributes<HTMLDivElement>>;
12
16
  export type ButtonBarDialogButtonProps = {
13
17
  icon?: string;
14
18
  } & DialogButtonProps;