@compill/admin 1.0.42 → 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)";
@@ -1497,7 +1503,7 @@ function nonNullValues$1(data) {
1497
1503
  return data;
1498
1504
  }
1499
1505
  function ItemEditDialog$1(_a) {
1500
- var _b, _c, _d;
1506
+ var _b, _c, _d, _e;
1501
1507
  var {
1502
1508
  initialValues,
1503
1509
  itemLabel,
@@ -1574,7 +1580,7 @@ function ItemEditDialog$1(_a) {
1574
1580
  transition: true
1575
1581
  }, props, {
1576
1582
  children: [jsxRuntime.jsxs(ui.Modal.Header, {
1577
- 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, {})
1578
1584
  // <ul className="nav nav-bold nav-pills">
1579
1585
  // {form.map(item =>
1580
1586
  // <li key={item.key} className="nav-item cursor-pointer bg-hover-light rounded" onClick={() => switchTab(item.key)}>
@@ -1597,7 +1603,7 @@ function ItemEditDialog$1(_a) {
1597
1603
  // initialValues={fetchToFormData && queryId && data ? fetchToFormData(nonNullValues(data)) : nonNullValues(data) ?? initialValues(data) ?? {}}
1598
1604
  , Object.assign({
1599
1605
  // initialValues={fetchToFormData && queryId && data ? fetchToFormData(nonNullValues(data)) : nonNullValues(data) ?? initialValues(data) ?? {}}
1600
- 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 : {},
1601
1607
  onSubmit: saveItem
1602
1608
  }, formikProps, {
1603
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)";
@@ -1488,7 +1494,7 @@ function nonNullValues$1(data) {
1488
1494
  return data;
1489
1495
  }
1490
1496
  function ItemEditDialog$1(_a) {
1491
- var _b, _c, _d;
1497
+ var _b, _c, _d, _e;
1492
1498
  var {
1493
1499
  initialValues,
1494
1500
  itemLabel,
@@ -1565,7 +1571,7 @@ function ItemEditDialog$1(_a) {
1565
1571
  transition: true
1566
1572
  }, props, {
1567
1573
  children: [jsxs(Modal.Header, {
1568
- 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, {})
1569
1575
  // <ul className="nav nav-bold nav-pills">
1570
1576
  // {form.map(item =>
1571
1577
  // <li key={item.key} className="nav-item cursor-pointer bg-hover-light rounded" onClick={() => switchTab(item.key)}>
@@ -1588,7 +1594,7 @@ function ItemEditDialog$1(_a) {
1588
1594
  // initialValues={fetchToFormData && queryId && data ? fetchToFormData(nonNullValues(data)) : nonNullValues(data) ?? initialValues(data) ?? {}}
1589
1595
  , Object.assign({
1590
1596
  // initialValues={fetchToFormData && queryId && data ? fetchToFormData(nonNullValues(data)) : nonNullValues(data) ?? initialValues(data) ?? {}}
1591
- 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 : {},
1592
1598
  onSubmit: saveItem
1593
1599
  }, formikProps, {
1594
1600
  children: ({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@compill/admin",
3
- "version": "1.0.42",
3
+ "version": "1.0.43",
4
4
  "module": "./index.esm.js",
5
5
  "main": "./index.cjs.js"
6
6
  }