@compill/admin 1.0.41 → 1.0.43

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
@@ -1132,8 +1132,14 @@ function Internal({
1132
1132
  });
1133
1133
  const save = api.useMutate(mutation, {
1134
1134
  processInput,
1135
- successMsg: (item, values) => `${item.title} updated.`,
1136
- errorMsg: (error, item) => `Error updating ${item.title}: ${error}`
1135
+ successMsg: (item, values) => {
1136
+ var _a;
1137
+ return `${(_a = item.title) !== null && _a !== void 0 ? _a : item.name} updated.`;
1138
+ },
1139
+ errorMsg: (error, item) => {
1140
+ var _a;
1141
+ return `Error updating ${(_a = item.title) !== null && _a !== void 0 ? _a : item.name}: ${error}`;
1142
+ }
1137
1143
  });
1138
1144
  let editorMaxW = undefined;
1139
1145
  if (!type || type == "post") editorMaxW = "calc(1280px - 28rem)";else if (type == "section") editorMaxW = "calc(1280px - 22rem)";
@@ -1162,14 +1168,18 @@ function Internal({
1162
1168
  flexCol: true,
1163
1169
  gap: "8",
1164
1170
  flexGrow: true,
1165
- children: [(editor === null || editor === void 0 ? void 0 : editor.type) != "textarea" && jsxRuntime.jsx(PageContentEditor, {
1171
+ children: [(editor === null || editor === void 0 ? void 0 : editor.type) != "textarea" &&
1172
+ // TODO Find a way to make this editor shrink in width when resizing the window...
1173
+ jsxRuntime.jsx(PageContentEditor, {
1166
1174
  name: "content",
1175
+ w: editorMaxW,
1167
1176
  maxW: editorMaxW,
1168
1177
  minW: "144"
1169
1178
  }), (editor === null || editor === void 0 ? void 0 : editor.type) == "textarea" && jsxRuntime.jsx(form.TextArea, {
1170
1179
  name: editor === null || editor === void 0 ? void 0 : editor.name,
1171
1180
  maxW: editorMaxW,
1172
1181
  minW: editorMaxW,
1182
+ w: editorMaxW,
1173
1183
  minH: "128",
1174
1184
  rows: 25,
1175
1185
  bgColor: "white",
@@ -1493,7 +1503,7 @@ function nonNullValues$1(data) {
1493
1503
  return data;
1494
1504
  }
1495
1505
  function ItemEditDialog$1(_a) {
1496
- var _b, _c, _d;
1506
+ var _b, _c, _d, _e;
1497
1507
  var {
1498
1508
  initialValues,
1499
1509
  itemLabel,
@@ -1570,7 +1580,7 @@ function ItemEditDialog$1(_a) {
1570
1580
  transition: true
1571
1581
  }, props, {
1572
1582
  children: [jsxRuntime.jsxs(ui.Modal.Header, {
1573
- children: [!isInitialLoading && queryId && `Edit ${title ? title(data) : (_c = (_b = data === null || data === void 0 ? void 0 : data["name"]) !== null && _b !== void 0 ? _b : data === null || data === void 0 ? void 0 : data["title"]) !== null && _c !== void 0 ? _c : ""}`, !queryId && `Create new ${itemLabel !== null && itemLabel !== void 0 ? itemLabel : "item"}`, Array.isArray(form$1) && jsxRuntime.jsx(jsxRuntime.Fragment, {})
1583
+ children: [!isInitialLoading && queryId && `Edit ${title ? title(data) : (_d = (_c = (_b = data === null || data === void 0 ? void 0 : data["name"]) !== null && _b !== void 0 ? _b : data === null || data === void 0 ? void 0 : data["title"]) !== null && _c !== void 0 ? _c : data === null || data === void 0 ? void 0 : data["name"]) !== null && _d !== void 0 ? _d : ""}`, !queryId && `Create new ${itemLabel !== null && itemLabel !== void 0 ? itemLabel : "item"}`, Array.isArray(form$1) && jsxRuntime.jsx(jsxRuntime.Fragment, {})
1574
1584
  // <ul className="nav nav-bold nav-pills">
1575
1585
  // {form.map(item =>
1576
1586
  // <li key={item.key} className="nav-item cursor-pointer bg-hover-light rounded" onClick={() => switchTab(item.key)}>
@@ -1593,7 +1603,7 @@ function ItemEditDialog$1(_a) {
1593
1603
  // initialValues={fetchToFormData && queryId && data ? fetchToFormData(nonNullValues(data)) : nonNullValues(data) ?? initialValues(data) ?? {}}
1594
1604
  , Object.assign({
1595
1605
  // initialValues={fetchToFormData && queryId && data ? fetchToFormData(nonNullValues(data)) : nonNullValues(data) ?? initialValues(data) ?? {}}
1596
- initialValues: fetchToFormData && queryId && data ? fetchToFormData(nonNullValues$1(data)) : (_d = nonNullValues$1(initialValues(data))) !== null && _d !== void 0 ? _d : {},
1606
+ initialValues: fetchToFormData && queryId && data ? fetchToFormData(nonNullValues$1(data)) : (_e = nonNullValues$1(initialValues(data))) !== null && _e !== void 0 ? _e : {},
1597
1607
  onSubmit: saveItem
1598
1608
  }, formikProps, {
1599
1609
  children: ({
package/index.esm.js CHANGED
@@ -1123,8 +1123,14 @@ function Internal({
1123
1123
  });
1124
1124
  const save = useMutate(mutation, {
1125
1125
  processInput,
1126
- successMsg: (item, values) => `${item.title} updated.`,
1127
- errorMsg: (error, item) => `Error updating ${item.title}: ${error}`
1126
+ successMsg: (item, values) => {
1127
+ var _a;
1128
+ return `${(_a = item.title) !== null && _a !== void 0 ? _a : item.name} updated.`;
1129
+ },
1130
+ errorMsg: (error, item) => {
1131
+ var _a;
1132
+ return `Error updating ${(_a = item.title) !== null && _a !== void 0 ? _a : item.name}: ${error}`;
1133
+ }
1128
1134
  });
1129
1135
  let editorMaxW = undefined;
1130
1136
  if (!type || type == "post") editorMaxW = "calc(1280px - 28rem)";else if (type == "section") editorMaxW = "calc(1280px - 22rem)";
@@ -1153,14 +1159,18 @@ function Internal({
1153
1159
  flexCol: true,
1154
1160
  gap: "8",
1155
1161
  flexGrow: true,
1156
- children: [(editor === null || editor === void 0 ? void 0 : editor.type) != "textarea" && jsx(PageContentEditor, {
1162
+ children: [(editor === null || editor === void 0 ? void 0 : editor.type) != "textarea" &&
1163
+ // TODO Find a way to make this editor shrink in width when resizing the window...
1164
+ jsx(PageContentEditor, {
1157
1165
  name: "content",
1166
+ w: editorMaxW,
1158
1167
  maxW: editorMaxW,
1159
1168
  minW: "144"
1160
1169
  }), (editor === null || editor === void 0 ? void 0 : editor.type) == "textarea" && jsx(TextArea, {
1161
1170
  name: editor === null || editor === void 0 ? void 0 : editor.name,
1162
1171
  maxW: editorMaxW,
1163
1172
  minW: editorMaxW,
1173
+ w: editorMaxW,
1164
1174
  minH: "128",
1165
1175
  rows: 25,
1166
1176
  bgColor: "white",
@@ -1484,7 +1494,7 @@ function nonNullValues$1(data) {
1484
1494
  return data;
1485
1495
  }
1486
1496
  function ItemEditDialog$1(_a) {
1487
- var _b, _c, _d;
1497
+ var _b, _c, _d, _e;
1488
1498
  var {
1489
1499
  initialValues,
1490
1500
  itemLabel,
@@ -1561,7 +1571,7 @@ function ItemEditDialog$1(_a) {
1561
1571
  transition: true
1562
1572
  }, props, {
1563
1573
  children: [jsxs(Modal.Header, {
1564
- children: [!isInitialLoading && queryId && `Edit ${title ? title(data) : (_c = (_b = data === null || data === void 0 ? void 0 : data["name"]) !== null && _b !== void 0 ? _b : data === null || data === void 0 ? void 0 : data["title"]) !== null && _c !== void 0 ? _c : ""}`, !queryId && `Create new ${itemLabel !== null && itemLabel !== void 0 ? itemLabel : "item"}`, Array.isArray(form) && jsx(Fragment, {})
1574
+ children: [!isInitialLoading && queryId && `Edit ${title ? title(data) : (_d = (_c = (_b = data === null || data === void 0 ? void 0 : data["name"]) !== null && _b !== void 0 ? _b : data === null || data === void 0 ? void 0 : data["title"]) !== null && _c !== void 0 ? _c : data === null || data === void 0 ? void 0 : data["name"]) !== null && _d !== void 0 ? _d : ""}`, !queryId && `Create new ${itemLabel !== null && itemLabel !== void 0 ? itemLabel : "item"}`, Array.isArray(form) && jsx(Fragment, {})
1565
1575
  // <ul className="nav nav-bold nav-pills">
1566
1576
  // {form.map(item =>
1567
1577
  // <li key={item.key} className="nav-item cursor-pointer bg-hover-light rounded" onClick={() => switchTab(item.key)}>
@@ -1584,7 +1594,7 @@ function ItemEditDialog$1(_a) {
1584
1594
  // initialValues={fetchToFormData && queryId && data ? fetchToFormData(nonNullValues(data)) : nonNullValues(data) ?? initialValues(data) ?? {}}
1585
1595
  , Object.assign({
1586
1596
  // initialValues={fetchToFormData && queryId && data ? fetchToFormData(nonNullValues(data)) : nonNullValues(data) ?? initialValues(data) ?? {}}
1587
- initialValues: fetchToFormData && queryId && data ? fetchToFormData(nonNullValues$1(data)) : (_d = nonNullValues$1(initialValues(data))) !== null && _d !== void 0 ? _d : {},
1597
+ initialValues: fetchToFormData && queryId && data ? fetchToFormData(nonNullValues$1(data)) : (_e = nonNullValues$1(initialValues(data))) !== null && _e !== void 0 ? _e : {},
1588
1598
  onSubmit: saveItem
1589
1599
  }, formikProps, {
1590
1600
  children: ({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@compill/admin",
3
- "version": "1.0.41",
3
+ "version": "1.0.43",
4
4
  "module": "./index.esm.js",
5
5
  "main": "./index.cjs.js"
6
6
  }