tinacms 0.70.1 → 0.70.2

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/dist/index.es.js CHANGED
@@ -5021,13 +5021,15 @@ const CollectionListPage = () => {
5021
5021
  startCursor: endCursor,
5022
5022
  sortKey
5023
5023
  }, (collection, _loading, reFetchCollection, collectionExtra) => {
5024
- var _a, _b, _c;
5024
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i;
5025
5025
  const totalCount = collection.documents.totalCount;
5026
5026
  const documents = collection.documents.edges;
5027
5027
  const admin = cms.api.admin;
5028
5028
  const pageInfo = collection.documents.pageInfo;
5029
5029
  const fields = (_a = collectionExtra.fields) == null ? void 0 : _a.filter((x) => ["string", "number", "datetime", "boolean"].includes(x.type));
5030
5030
  const collectionDefinition = cms.api.tina.schema.getCollection(collection.name);
5031
+ const allowCreate = (_d = (_c = (_b = collectionDefinition == null ? void 0 : collectionDefinition.ui) == null ? void 0 : _b.allowedActions) == null ? void 0 : _c.create) != null ? _d : true;
5032
+ const allowDelete = (_g = (_f = (_e = collectionDefinition == null ? void 0 : collectionDefinition.ui) == null ? void 0 : _e.allowedActions) == null ? void 0 : _f.delete) != null ? _g : true;
5031
5033
  return /* @__PURE__ */ React.createElement(PageWrapper, null, /* @__PURE__ */ React.createElement(React.Fragment, null, open && /* @__PURE__ */ React.createElement(DeleteModal, {
5032
5034
  filename: vars.relativePath,
5033
5035
  deleteFunc: async () => {
@@ -5043,7 +5045,7 @@ const CollectionListPage = () => {
5043
5045
  },
5044
5046
  close: () => setOpen(false)
5045
5047
  }), /* @__PURE__ */ React.createElement(PageHeader, {
5046
- isLocalMode: (_c = (_b = cms == null ? void 0 : cms.api) == null ? void 0 : _b.tina) == null ? void 0 : _c.isLocalMode
5048
+ isLocalMode: (_i = (_h = cms == null ? void 0 : cms.api) == null ? void 0 : _h.tina) == null ? void 0 : _i.isLocalMode
5047
5049
  }, /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", {
5048
5050
  className: "flex flex-col gap-4"
5049
5051
  }, /* @__PURE__ */ React.createElement("h3", {
@@ -5093,12 +5095,12 @@ const CollectionListPage = () => {
5093
5095
  setSortOrder(val.order);
5094
5096
  }
5095
5097
  }
5096
- }))), !collection.templates && /* @__PURE__ */ React.createElement(Link, {
5098
+ }))), !collection.templates && allowCreate && /* @__PURE__ */ React.createElement(Link, {
5097
5099
  to: `new`,
5098
5100
  className: "icon-parent inline-flex items-center font-medium focus:outline-none focus:ring-2 focus:shadow-outline text-center rounded-full justify-center transition-all duration-150 ease-out shadow text-white bg-blue-500 hover:bg-blue-600 focus:ring-blue-500 text-sm h-10 px-6"
5099
5101
  }, "Create New", " ", /* @__PURE__ */ React.createElement(BiPlus, {
5100
5102
  className: "w-5 h-full ml-1 opacity-70"
5101
- })), collection.templates && /* @__PURE__ */ React.createElement(TemplateMenu, {
5103
+ })), collection.templates && allowCreate && /* @__PURE__ */ React.createElement(TemplateMenu, {
5102
5104
  templates: collection.templates
5103
5105
  }))), /* @__PURE__ */ React.createElement(PageBody, null, /* @__PURE__ */ React.createElement("div", {
5104
5106
  className: "w-full mx-auto max-w-screen-xl"
@@ -5162,7 +5164,7 @@ const CollectionListPage = () => {
5162
5164
  navigate(`${document.node._sys.breadcrumbs.join("/")}`, { replace: true });
5163
5165
  }
5164
5166
  },
5165
- {
5167
+ allowDelete && {
5166
5168
  name: "delete",
5167
5169
  label: "Delete",
5168
5170
  Icon: /* @__PURE__ */ React.createElement(BiTrash, {
@@ -5177,7 +5179,7 @@ const CollectionListPage = () => {
5177
5179
  setOpen(true);
5178
5180
  }
5179
5181
  }
5180
- ]
5182
+ ].filter(Boolean)
5181
5183
  })));
5182
5184
  }))), /* @__PURE__ */ React.createElement("div", {
5183
5185
  className: "pt-3"
package/dist/index.js CHANGED
@@ -5037,13 +5037,15 @@ This will work when developing locally but NOT when deployed to production.
5037
5037
  startCursor: endCursor,
5038
5038
  sortKey
5039
5039
  }, (collection, _loading, reFetchCollection, collectionExtra) => {
5040
- var _a, _b, _c;
5040
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i;
5041
5041
  const totalCount = collection.documents.totalCount;
5042
5042
  const documents = collection.documents.edges;
5043
5043
  const admin = cms.api.admin;
5044
5044
  const pageInfo = collection.documents.pageInfo;
5045
5045
  const fields = (_a = collectionExtra.fields) == null ? void 0 : _a.filter((x) => ["string", "number", "datetime", "boolean"].includes(x.type));
5046
5046
  const collectionDefinition = cms.api.tina.schema.getCollection(collection.name);
5047
+ const allowCreate = (_d = (_c = (_b = collectionDefinition == null ? void 0 : collectionDefinition.ui) == null ? void 0 : _b.allowedActions) == null ? void 0 : _c.create) != null ? _d : true;
5048
+ const allowDelete = (_g = (_f = (_e = collectionDefinition == null ? void 0 : collectionDefinition.ui) == null ? void 0 : _e.allowedActions) == null ? void 0 : _f.delete) != null ? _g : true;
5047
5049
  return /* @__PURE__ */ React__default["default"].createElement(PageWrapper, null, /* @__PURE__ */ React__default["default"].createElement(React__default["default"].Fragment, null, open && /* @__PURE__ */ React__default["default"].createElement(DeleteModal, {
5048
5050
  filename: vars.relativePath,
5049
5051
  deleteFunc: async () => {
@@ -5059,7 +5061,7 @@ This will work when developing locally but NOT when deployed to production.
5059
5061
  },
5060
5062
  close: () => setOpen(false)
5061
5063
  }), /* @__PURE__ */ React__default["default"].createElement(PageHeader, {
5062
- isLocalMode: (_c = (_b = cms == null ? void 0 : cms.api) == null ? void 0 : _b.tina) == null ? void 0 : _c.isLocalMode
5064
+ isLocalMode: (_i = (_h = cms == null ? void 0 : cms.api) == null ? void 0 : _h.tina) == null ? void 0 : _i.isLocalMode
5063
5065
  }, /* @__PURE__ */ React__default["default"].createElement(React__default["default"].Fragment, null, /* @__PURE__ */ React__default["default"].createElement("div", {
5064
5066
  className: "flex flex-col gap-4"
5065
5067
  }, /* @__PURE__ */ React__default["default"].createElement("h3", {
@@ -5109,12 +5111,12 @@ This will work when developing locally but NOT when deployed to production.
5109
5111
  setSortOrder(val.order);
5110
5112
  }
5111
5113
  }
5112
- }))), !collection.templates && /* @__PURE__ */ React__default["default"].createElement(reactRouterDom.Link, {
5114
+ }))), !collection.templates && allowCreate && /* @__PURE__ */ React__default["default"].createElement(reactRouterDom.Link, {
5113
5115
  to: `new`,
5114
5116
  className: "icon-parent inline-flex items-center font-medium focus:outline-none focus:ring-2 focus:shadow-outline text-center rounded-full justify-center transition-all duration-150 ease-out shadow text-white bg-blue-500 hover:bg-blue-600 focus:ring-blue-500 text-sm h-10 px-6"
5115
5117
  }, "Create New", " ", /* @__PURE__ */ React__default["default"].createElement(BiPlus, {
5116
5118
  className: "w-5 h-full ml-1 opacity-70"
5117
- })), collection.templates && /* @__PURE__ */ React__default["default"].createElement(TemplateMenu, {
5119
+ })), collection.templates && allowCreate && /* @__PURE__ */ React__default["default"].createElement(TemplateMenu, {
5118
5120
  templates: collection.templates
5119
5121
  }))), /* @__PURE__ */ React__default["default"].createElement(PageBody, null, /* @__PURE__ */ React__default["default"].createElement("div", {
5120
5122
  className: "w-full mx-auto max-w-screen-xl"
@@ -5178,7 +5180,7 @@ This will work when developing locally but NOT when deployed to production.
5178
5180
  navigate(`${document.node._sys.breadcrumbs.join("/")}`, { replace: true });
5179
5181
  }
5180
5182
  },
5181
- {
5183
+ allowDelete && {
5182
5184
  name: "delete",
5183
5185
  label: "Delete",
5184
5186
  Icon: /* @__PURE__ */ React__default["default"].createElement(BiTrash, {
@@ -5193,7 +5195,7 @@ This will work when developing locally but NOT when deployed to production.
5193
5195
  setOpen(true);
5194
5196
  }
5195
5197
  }
5196
- ]
5198
+ ].filter(Boolean)
5197
5199
  })));
5198
5200
  }))), /* @__PURE__ */ React__default["default"].createElement("div", {
5199
5201
  className: "pt-3"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tinacms",
3
- "version": "0.70.1",
3
+ "version": "0.70.2",
4
4
  "main": "dist/index.js",
5
5
  "module": "./dist/index.es.js",
6
6
  "exports": {
@@ -55,7 +55,7 @@
55
55
  "@headlessui/react": "^1.5.0",
56
56
  "@heroicons/react": "^1.0.4",
57
57
  "@react-hook/window-size": "^3.0.7",
58
- "@tinacms/schema-tools": "0.2.1",
58
+ "@tinacms/schema-tools": "0.2.2",
59
59
  "@tinacms/sharedctx": "0.1.3",
60
60
  "@tinacms/toolkit": "0.58.5",
61
61
  "crypto-js": "^4.0.0",