tinacms 1.5.2 → 1.5.4
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/admin/pages/CollectionListPage.d.ts +0 -3
- package/dist/index.es.js +23 -5
- package/dist/index.js +23 -5
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -3164,13 +3164,13 @@ const GetCollection = ({
|
|
|
3164
3164
|
const navigate = useNavigate();
|
|
3165
3165
|
const { collection, loading, error, reFetchCollection, collectionExtra } = useGetCollection(cms, collectionName, includeDocuments, folder, startCursor || "", sortKey, filterArgs) || {};
|
|
3166
3166
|
useEffect(() => {
|
|
3167
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
3167
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
3168
3168
|
if (loading)
|
|
3169
3169
|
return;
|
|
3170
3170
|
const collectionDefinition = cms.api.tina.schema.getCollection(collection.name);
|
|
3171
3171
|
const allowCreate = (_c = (_b = (_a = collectionDefinition == null ? void 0 : collectionDefinition.ui) == null ? void 0 : _a.allowedActions) == null ? void 0 : _b.create) != null ? _c : true;
|
|
3172
3172
|
const allowDelete = (_f = (_e = (_d = collectionDefinition == null ? void 0 : collectionDefinition.ui) == null ? void 0 : _d.allowedActions) == null ? void 0 : _e.delete) != null ? _f : true;
|
|
3173
|
-
if (!allowCreate && !allowDelete && ((_h = (_g = collection.documents) == null ? void 0 : _g.edges) == null ? void 0 : _h.length) === 1) {
|
|
3173
|
+
if (!allowCreate && !allowDelete && ((_h = (_g = collection.documents) == null ? void 0 : _g.edges) == null ? void 0 : _h.length) === 1 && ((_k = (_j = (_i = collection.documents) == null ? void 0 : _i.edges[0]) == null ? void 0 : _j.node) == null ? void 0 : _k.__typename) !== "Folder") {
|
|
3174
3174
|
const doc = collection.documents.edges[0].node;
|
|
3175
3175
|
handleNavigate(navigate, cms, collection, collectionDefinition, doc);
|
|
3176
3176
|
}
|
|
@@ -3221,7 +3221,11 @@ const useCollectionFolder = () => {
|
|
|
3221
3221
|
};
|
|
3222
3222
|
const LOCAL_STORAGE_KEY = "tinacms.admin.collection.list.page";
|
|
3223
3223
|
const isSSR = typeof window === "undefined";
|
|
3224
|
-
const TemplateMenu = ({
|
|
3224
|
+
const TemplateMenu = ({
|
|
3225
|
+
templates,
|
|
3226
|
+
folder,
|
|
3227
|
+
collectionName
|
|
3228
|
+
}) => {
|
|
3225
3229
|
return /* @__PURE__ */ React.createElement(Menu, {
|
|
3226
3230
|
as: "div",
|
|
3227
3231
|
className: "relative inline-block text-left"
|
|
@@ -3244,7 +3248,19 @@ const TemplateMenu = ({ templates }) => {
|
|
|
3244
3248
|
}, templates.map((template) => /* @__PURE__ */ React.createElement(Menu.Item, {
|
|
3245
3249
|
key: `${template.label}-${template.name}`
|
|
3246
3250
|
}, ({ active }) => /* @__PURE__ */ React.createElement(Link, {
|
|
3247
|
-
to:
|
|
3251
|
+
to: `/${folder.fullyQualifiedName ? [
|
|
3252
|
+
"collections",
|
|
3253
|
+
"new",
|
|
3254
|
+
collectionName,
|
|
3255
|
+
template.name,
|
|
3256
|
+
"~",
|
|
3257
|
+
folder.name
|
|
3258
|
+
].join("/") : [
|
|
3259
|
+
"collections",
|
|
3260
|
+
"new",
|
|
3261
|
+
collectionName,
|
|
3262
|
+
template.name
|
|
3263
|
+
].join("/")}`,
|
|
3248
3264
|
className: `w-full text-md px-4 py-2 tracking-wide flex items-center transition ease-out duration-100 ${active ? "text-blue-600 opacity-100 bg-gray-50" : "opacity-80 text-gray-600"}`
|
|
3249
3265
|
}, template.label))))))));
|
|
3250
3266
|
};
|
|
@@ -3608,7 +3624,9 @@ const CollectionListPage = () => {
|
|
|
3608
3624
|
}, "Create New", " ", /* @__PURE__ */ React.createElement(BiPlus, {
|
|
3609
3625
|
className: "w-5 h-full ml-1 opacity-70"
|
|
3610
3626
|
})), collection.templates && allowCreate && /* @__PURE__ */ React.createElement(TemplateMenu, {
|
|
3611
|
-
|
|
3627
|
+
collectionName,
|
|
3628
|
+
templates: collection.templates,
|
|
3629
|
+
folder
|
|
3612
3630
|
})))), /* @__PURE__ */ React.createElement(PageBody, null, /* @__PURE__ */ React.createElement("div", {
|
|
3613
3631
|
className: "w-full mx-auto max-w-screen-xl"
|
|
3614
3632
|
}, sortField && !sortField.required && /* @__PURE__ */ React.createElement("p", {
|
package/dist/index.js
CHANGED
|
@@ -3179,13 +3179,13 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
3179
3179
|
const navigate = reactRouterDom.useNavigate();
|
|
3180
3180
|
const { collection, loading, error, reFetchCollection, collectionExtra } = useGetCollection(cms, collectionName, includeDocuments, folder, startCursor || "", sortKey, filterArgs) || {};
|
|
3181
3181
|
React.useEffect(() => {
|
|
3182
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
3182
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
3183
3183
|
if (loading)
|
|
3184
3184
|
return;
|
|
3185
3185
|
const collectionDefinition = cms.api.tina.schema.getCollection(collection.name);
|
|
3186
3186
|
const allowCreate = (_c = (_b = (_a = collectionDefinition == null ? void 0 : collectionDefinition.ui) == null ? void 0 : _a.allowedActions) == null ? void 0 : _b.create) != null ? _c : true;
|
|
3187
3187
|
const allowDelete = (_f = (_e = (_d = collectionDefinition == null ? void 0 : collectionDefinition.ui) == null ? void 0 : _d.allowedActions) == null ? void 0 : _e.delete) != null ? _f : true;
|
|
3188
|
-
if (!allowCreate && !allowDelete && ((_h = (_g = collection.documents) == null ? void 0 : _g.edges) == null ? void 0 : _h.length) === 1) {
|
|
3188
|
+
if (!allowCreate && !allowDelete && ((_h = (_g = collection.documents) == null ? void 0 : _g.edges) == null ? void 0 : _h.length) === 1 && ((_k = (_j = (_i = collection.documents) == null ? void 0 : _i.edges[0]) == null ? void 0 : _j.node) == null ? void 0 : _k.__typename) !== "Folder") {
|
|
3189
3189
|
const doc = collection.documents.edges[0].node;
|
|
3190
3190
|
handleNavigate(navigate, cms, collection, collectionDefinition, doc);
|
|
3191
3191
|
}
|
|
@@ -3236,7 +3236,11 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
3236
3236
|
};
|
|
3237
3237
|
const LOCAL_STORAGE_KEY = "tinacms.admin.collection.list.page";
|
|
3238
3238
|
const isSSR = typeof window === "undefined";
|
|
3239
|
-
const TemplateMenu = ({
|
|
3239
|
+
const TemplateMenu = ({
|
|
3240
|
+
templates,
|
|
3241
|
+
folder,
|
|
3242
|
+
collectionName
|
|
3243
|
+
}) => {
|
|
3240
3244
|
return /* @__PURE__ */ React__default["default"].createElement(react.Menu, {
|
|
3241
3245
|
as: "div",
|
|
3242
3246
|
className: "relative inline-block text-left"
|
|
@@ -3259,7 +3263,19 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
3259
3263
|
}, templates.map((template) => /* @__PURE__ */ React__default["default"].createElement(react.Menu.Item, {
|
|
3260
3264
|
key: `${template.label}-${template.name}`
|
|
3261
3265
|
}, ({ active }) => /* @__PURE__ */ React__default["default"].createElement(reactRouterDom.Link, {
|
|
3262
|
-
to:
|
|
3266
|
+
to: `/${folder.fullyQualifiedName ? [
|
|
3267
|
+
"collections",
|
|
3268
|
+
"new",
|
|
3269
|
+
collectionName,
|
|
3270
|
+
template.name,
|
|
3271
|
+
"~",
|
|
3272
|
+
folder.name
|
|
3273
|
+
].join("/") : [
|
|
3274
|
+
"collections",
|
|
3275
|
+
"new",
|
|
3276
|
+
collectionName,
|
|
3277
|
+
template.name
|
|
3278
|
+
].join("/")}`,
|
|
3263
3279
|
className: `w-full text-md px-4 py-2 tracking-wide flex items-center transition ease-out duration-100 ${active ? "text-blue-600 opacity-100 bg-gray-50" : "opacity-80 text-gray-600"}`
|
|
3264
3280
|
}, template.label))))))));
|
|
3265
3281
|
};
|
|
@@ -3623,7 +3639,9 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
3623
3639
|
}, "Create New", " ", /* @__PURE__ */ React__default["default"].createElement(BiPlus, {
|
|
3624
3640
|
className: "w-5 h-full ml-1 opacity-70"
|
|
3625
3641
|
})), collection.templates && allowCreate && /* @__PURE__ */ React__default["default"].createElement(TemplateMenu, {
|
|
3626
|
-
|
|
3642
|
+
collectionName,
|
|
3643
|
+
templates: collection.templates,
|
|
3644
|
+
folder
|
|
3627
3645
|
})))), /* @__PURE__ */ React__default["default"].createElement(PageBody, null, /* @__PURE__ */ React__default["default"].createElement("div", {
|
|
3628
3646
|
className: "w-full mx-auto max-w-screen-xl"
|
|
3629
3647
|
}, sortField && !sortField.required && /* @__PURE__ */ React__default["default"].createElement("p", {
|