@compill/admin 1.0.72 → 1.0.73
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 +27 -19
- package/index.esm.js +27 -19
- package/package.json +1 -1
- package/src/lib/json/types/DetailsView.d.ts +6 -3
package/index.cjs.js
CHANGED
@@ -938,12 +938,7 @@ function PageSidebarSection(_a) {
|
|
938
938
|
} = _a,
|
939
939
|
props = __rest$1(_a, ["title", "children"]);
|
940
940
|
return jsxRuntime.jsxs("div", Object.assign({
|
941
|
-
w: "full"
|
942
|
-
bgColor: "white",
|
943
|
-
rounded: "lg",
|
944
|
-
p: "5",
|
945
|
-
textSize: "sm",
|
946
|
-
shadow: true
|
941
|
+
w: "full"
|
947
942
|
}, props, {
|
948
943
|
children: [title && jsxRuntime.jsx(admin.PageSectionTitle, {
|
949
944
|
children: title
|
@@ -1182,18 +1177,18 @@ function Internal({
|
|
1182
1177
|
tabbed,
|
1183
1178
|
containerRef
|
1184
1179
|
}) {
|
1180
|
+
var _a, _b, _c;
|
1181
|
+
const pScreen = react.runIfFn(screen, item);
|
1185
1182
|
const {
|
1186
1183
|
breadcrumbs,
|
1187
1184
|
schema,
|
1188
1185
|
initialValues,
|
1189
1186
|
header,
|
1190
|
-
editorFooter: editoFooter,
|
1191
1187
|
sections,
|
1192
1188
|
buttonBar,
|
1193
|
-
editor,
|
1194
1189
|
type,
|
1195
1190
|
invalidateParentQueryKey
|
1196
|
-
} =
|
1191
|
+
} = pScreen;
|
1197
1192
|
const mutation = api.useInvalidateParentMutation(api$1.update, invalidateParentQueryKey !== null && invalidateParentQueryKey !== void 0 ? invalidateParentQueryKey : api$1.queryKey, {
|
1198
1193
|
networkMode: "always"
|
1199
1194
|
});
|
@@ -1223,7 +1218,10 @@ function Internal({
|
|
1223
1218
|
item: item,
|
1224
1219
|
isLoading: mutation.isLoading,
|
1225
1220
|
trackingRef: containerRef === null || containerRef === void 0 ? void 0 : containerRef.current
|
1226
|
-
}), jsxRuntime.jsx(
|
1221
|
+
}), type == "form" && (sections === null || sections === void 0 ? void 0 : sections.map((section, index) => jsxRuntime.jsx(Section, {
|
1222
|
+
section: section,
|
1223
|
+
item: item
|
1224
|
+
}, index))), (pScreen.type == "post" || pScreen.type == "section") && jsxRuntime.jsx("div", {
|
1227
1225
|
p: "5",
|
1228
1226
|
bgColor: "slate-100",
|
1229
1227
|
rounded: "lg",
|
@@ -1239,7 +1237,7 @@ function Internal({
|
|
1239
1237
|
flexCol: true,
|
1240
1238
|
gap: "8",
|
1241
1239
|
flexGrow: true,
|
1242
|
-
children: [(editor === null ||
|
1240
|
+
children: [((_a = pScreen.editor) === null || _a === void 0 ? void 0 : _a.type) != "textarea" &&
|
1243
1241
|
// TODO Find a way to make this editor shrink in width when resizing the window...
|
1244
1242
|
jsxRuntime.jsx(PageContentEditor, {
|
1245
1243
|
name: "content",
|
@@ -1247,8 +1245,8 @@ function Internal({
|
|
1247
1245
|
minW: "144",
|
1248
1246
|
shadow: true,
|
1249
1247
|
rounded: "lg"
|
1250
|
-
}), (editor === null ||
|
1251
|
-
name: editor === null ||
|
1248
|
+
}), ((_b = pScreen.editor) === null || _b === void 0 ? void 0 : _b.type) == "textarea" && jsxRuntime.jsx(form.TextArea, {
|
1249
|
+
name: (_c = pScreen.editor) === null || _c === void 0 ? void 0 : _c.name,
|
1252
1250
|
maxW: editorMaxW,
|
1253
1251
|
minW: editorMaxW,
|
1254
1252
|
w: editorMaxW,
|
@@ -1259,11 +1257,12 @@ function Internal({
|
|
1259
1257
|
shadow: true,
|
1260
1258
|
p: "5",
|
1261
1259
|
textColor: "slate-800"
|
1262
|
-
}),
|
1260
|
+
}), pScreen.editorFooter]
|
1263
1261
|
}), jsxRuntime.jsx(PageSidebar, {
|
1264
1262
|
children: sections === null || sections === void 0 ? void 0 : sections.map((section, index) => jsxRuntime.jsx(Section, {
|
1265
1263
|
section: section,
|
1266
|
-
item: item
|
1264
|
+
item: item,
|
1265
|
+
cardStyle: true
|
1267
1266
|
}, index))
|
1268
1267
|
})]
|
1269
1268
|
})]
|
@@ -1273,15 +1272,24 @@ function Internal({
|
|
1273
1272
|
}
|
1274
1273
|
function Section({
|
1275
1274
|
section,
|
1276
|
-
item
|
1275
|
+
item,
|
1276
|
+
cardStyle
|
1277
1277
|
}) {
|
1278
1278
|
if (section.type === "section") {
|
1279
|
-
|
1280
|
-
|
1279
|
+
const style = cardStyle ? {
|
1280
|
+
bgColor: "white",
|
1281
|
+
rounded: "lg",
|
1282
|
+
p: "5",
|
1283
|
+
textSize: "sm",
|
1284
|
+
shadow: true
|
1285
|
+
} : {};
|
1286
|
+
return jsxRuntime.jsx(PageSidebarSection, Object.assign({
|
1287
|
+
title: section.title
|
1288
|
+
}, style, {
|
1281
1289
|
children: jsxRuntime.jsx(form.FormRenderer, {
|
1282
1290
|
form: react.runIfFn(section.form, item)
|
1283
1291
|
})
|
1284
|
-
});
|
1292
|
+
}));
|
1285
1293
|
}
|
1286
1294
|
if (section.type === "custom") return react.runIfFn(section.component, item);
|
1287
1295
|
return null;
|
package/index.esm.js
CHANGED
@@ -928,12 +928,7 @@ function PageSidebarSection(_a) {
|
|
928
928
|
} = _a,
|
929
929
|
props = __rest$1(_a, ["title", "children"]);
|
930
930
|
return jsxs("div", Object.assign({
|
931
|
-
w: "full"
|
932
|
-
bgColor: "white",
|
933
|
-
rounded: "lg",
|
934
|
-
p: "5",
|
935
|
-
textSize: "sm",
|
936
|
-
shadow: true
|
931
|
+
w: "full"
|
937
932
|
}, props, {
|
938
933
|
children: [title && jsx(PageSectionTitle$1, {
|
939
934
|
children: title
|
@@ -1172,18 +1167,18 @@ function Internal({
|
|
1172
1167
|
tabbed,
|
1173
1168
|
containerRef
|
1174
1169
|
}) {
|
1170
|
+
var _a, _b, _c;
|
1171
|
+
const pScreen = runIfFn(screen, item);
|
1175
1172
|
const {
|
1176
1173
|
breadcrumbs,
|
1177
1174
|
schema,
|
1178
1175
|
initialValues,
|
1179
1176
|
header,
|
1180
|
-
editorFooter: editoFooter,
|
1181
1177
|
sections,
|
1182
1178
|
buttonBar,
|
1183
|
-
editor,
|
1184
1179
|
type,
|
1185
1180
|
invalidateParentQueryKey
|
1186
|
-
} =
|
1181
|
+
} = pScreen;
|
1187
1182
|
const mutation = useInvalidateParentMutation(api.update, invalidateParentQueryKey !== null && invalidateParentQueryKey !== void 0 ? invalidateParentQueryKey : api.queryKey, {
|
1188
1183
|
networkMode: "always"
|
1189
1184
|
});
|
@@ -1213,7 +1208,10 @@ function Internal({
|
|
1213
1208
|
item: item,
|
1214
1209
|
isLoading: mutation.isLoading,
|
1215
1210
|
trackingRef: containerRef === null || containerRef === void 0 ? void 0 : containerRef.current
|
1216
|
-
}),
|
1211
|
+
}), type == "form" && (sections === null || sections === void 0 ? void 0 : sections.map((section, index) => jsx(Section, {
|
1212
|
+
section: section,
|
1213
|
+
item: item
|
1214
|
+
}, index))), (pScreen.type == "post" || pScreen.type == "section") && jsx("div", {
|
1217
1215
|
p: "5",
|
1218
1216
|
bgColor: "slate-100",
|
1219
1217
|
rounded: "lg",
|
@@ -1229,7 +1227,7 @@ function Internal({
|
|
1229
1227
|
flexCol: true,
|
1230
1228
|
gap: "8",
|
1231
1229
|
flexGrow: true,
|
1232
|
-
children: [(editor === null ||
|
1230
|
+
children: [((_a = pScreen.editor) === null || _a === void 0 ? void 0 : _a.type) != "textarea" &&
|
1233
1231
|
// TODO Find a way to make this editor shrink in width when resizing the window...
|
1234
1232
|
jsx(PageContentEditor, {
|
1235
1233
|
name: "content",
|
@@ -1237,8 +1235,8 @@ function Internal({
|
|
1237
1235
|
minW: "144",
|
1238
1236
|
shadow: true,
|
1239
1237
|
rounded: "lg"
|
1240
|
-
}), (editor === null ||
|
1241
|
-
name: editor === null ||
|
1238
|
+
}), ((_b = pScreen.editor) === null || _b === void 0 ? void 0 : _b.type) == "textarea" && jsx(TextArea, {
|
1239
|
+
name: (_c = pScreen.editor) === null || _c === void 0 ? void 0 : _c.name,
|
1242
1240
|
maxW: editorMaxW,
|
1243
1241
|
minW: editorMaxW,
|
1244
1242
|
w: editorMaxW,
|
@@ -1249,11 +1247,12 @@ function Internal({
|
|
1249
1247
|
shadow: true,
|
1250
1248
|
p: "5",
|
1251
1249
|
textColor: "slate-800"
|
1252
|
-
}),
|
1250
|
+
}), pScreen.editorFooter]
|
1253
1251
|
}), jsx(PageSidebar, {
|
1254
1252
|
children: sections === null || sections === void 0 ? void 0 : sections.map((section, index) => jsx(Section, {
|
1255
1253
|
section: section,
|
1256
|
-
item: item
|
1254
|
+
item: item,
|
1255
|
+
cardStyle: true
|
1257
1256
|
}, index))
|
1258
1257
|
})]
|
1259
1258
|
})]
|
@@ -1263,15 +1262,24 @@ function Internal({
|
|
1263
1262
|
}
|
1264
1263
|
function Section({
|
1265
1264
|
section,
|
1266
|
-
item
|
1265
|
+
item,
|
1266
|
+
cardStyle
|
1267
1267
|
}) {
|
1268
1268
|
if (section.type === "section") {
|
1269
|
-
|
1270
|
-
|
1269
|
+
const style = cardStyle ? {
|
1270
|
+
bgColor: "white",
|
1271
|
+
rounded: "lg",
|
1272
|
+
p: "5",
|
1273
|
+
textSize: "sm",
|
1274
|
+
shadow: true
|
1275
|
+
} : {};
|
1276
|
+
return jsx(PageSidebarSection, Object.assign({
|
1277
|
+
title: section.title
|
1278
|
+
}, style, {
|
1271
1279
|
children: jsx(FormRenderer, {
|
1272
1280
|
form: runIfFn(section.form, item)
|
1273
1281
|
})
|
1274
|
-
});
|
1282
|
+
}));
|
1275
1283
|
}
|
1276
1284
|
if (section.type === "custom") return runIfFn(section.component, item);
|
1277
1285
|
return null;
|
package/package.json
CHANGED
@@ -19,10 +19,13 @@ type Screen = {
|
|
19
19
|
header?: React.ReactNode;
|
20
20
|
sections?: DetailSection[];
|
21
21
|
buttonBar?: DetailViewButton[];
|
22
|
+
} & ({
|
23
|
+
type: "form";
|
24
|
+
} | {
|
25
|
+
type?: "post" | "section";
|
22
26
|
editor?: DetailEditor;
|
23
27
|
editorFooter?: React.ReactNode;
|
24
|
-
|
25
|
-
};
|
28
|
+
});
|
26
29
|
type DetailEditor = {
|
27
30
|
type?: "blockEditor";
|
28
31
|
name: string;
|
@@ -32,7 +35,7 @@ type DetailEditor = {
|
|
32
35
|
};
|
33
36
|
export type DetailSection = {
|
34
37
|
type: "section";
|
35
|
-
title
|
38
|
+
title?: string;
|
36
39
|
form: FormRendererConfig | ((item: any) => FormRendererConfig);
|
37
40
|
} | {
|
38
41
|
type: "custom";
|