tinacms 1.1.5 → 1.2.0
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/LICENSE +8 -0
- package/dist/admin/api.d.ts +9 -11
- package/dist/admin/components/AuthTemplate.d.ts +2 -10
- package/dist/admin/components/GetCMS.d.ts +2 -10
- package/dist/admin/components/GetCollection.d.ts +6 -12
- package/dist/admin/components/GetCollections.d.ts +2 -10
- package/dist/admin/components/GetDocument.d.ts +2 -10
- package/dist/admin/components/Layout.d.ts +2 -10
- package/dist/admin/components/LoadingPage.d.ts +2 -10
- package/dist/admin/components/Page.d.ts +1 -10
- package/dist/admin/components/Sidebar.d.ts +2 -10
- package/dist/admin/index.d.ts +2 -10
- package/dist/admin/pages/CollectionCreatePage.d.ts +2 -10
- package/dist/admin/pages/CollectionListPage.d.ts +2 -10
- package/dist/admin/pages/CollectionUpdatePage.d.ts +2 -10
- package/dist/admin/pages/DashboardPage.d.ts +2 -10
- package/dist/admin/pages/LoginPage.d.ts +2 -10
- package/dist/admin/pages/LogoutPage.d.ts +2 -10
- package/dist/admin/pages/ScreenPage.d.ts +2 -10
- package/dist/admin/plugins/route-mapping.d.ts +1 -10
- package/dist/admin/types.d.ts +1 -10
- package/dist/auth/AuthModal.d.ts +2 -10
- package/dist/auth/TinaCloudProvider.d.ts +1 -10
- package/dist/auth/authenticate.d.ts +3 -12
- package/dist/auth/index.d.ts +1 -10
- package/dist/auth/popupWindow.d.ts +1 -10
- package/dist/auth/useGenerator.d.ts +1 -10
- package/dist/auth/useTinaAuthRedirect.d.ts +1 -10
- package/dist/client.d.ts +1 -10
- package/dist/client.es.js +1 -29
- package/dist/client.js +3 -31
- package/dist/edit-state.d.ts +1 -10
- package/dist/hooks/create-page-plugin.d.ts +1 -10
- package/dist/hooks/formify/formify-utils.d.ts +1 -10
- package/dist/hooks/formify/formify.d.ts +1 -10
- package/dist/hooks/formify/index.d.ts +1 -10
- package/dist/hooks/formify/reducer.d.ts +1 -10
- package/dist/hooks/formify/spec/runner.d.ts +1 -10
- package/dist/hooks/formify/spec/util.d.ts +1 -10
- package/dist/hooks/formify/types.d.ts +1 -10
- package/dist/hooks/formify/util.d.ts +1 -10
- package/dist/hooks/use-content-creator.d.ts +1 -10
- package/dist/hooks/use-graphql-forms.d.ts +1 -10
- package/dist/index.d.ts +1 -10
- package/dist/index.es.js +325 -76
- package/dist/index.js +326 -77
- package/dist/internalClient/formify.d.ts +1 -10
- package/dist/internalClient/index.d.ts +2 -13
- package/dist/rich-text/index.d.ts +2 -10
- package/dist/rich-text/prism.d.ts +2 -10
- package/dist/style.css +38 -8
- package/dist/tina-cms.d.ts +2 -10
- package/dist/types/cms.d.ts +1 -10
- package/dist/unifiedClient/index.d.ts +1 -11
- package/dist/utils/client.d.ts +1 -10
- package/dist/utils/index.d.ts +1 -10
- package/package.json +5 -6
- package/dist/utils/parseUrl.d.ts +0 -18
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
(function(global, factory) {
|
|
2
|
-
typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("@tinacms/toolkit"), require("graphql"), require("lodash.set"), require("react"), require("final-form"), require("@tinacms/schema-tools"), require("graphql-tag"), require("yup"), require("@tinacms/sharedctx"), require("
|
|
3
|
-
})(this, function(exports2, toolkit, G, set, React, finalForm, schemaTools, gql$1, yup, sharedctx,
|
|
2
|
+
typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("@tinacms/toolkit"), require("graphql"), require("lodash.set"), require("react"), require("final-form"), require("@tinacms/schema-tools"), require("graphql-tag"), require("yup"), require("@tinacms/sharedctx"), require("react-router-dom"), require("@headlessui/react"), require("@react-hook/window-size")) : typeof define === "function" && define.amd ? define(["exports", "@tinacms/toolkit", "graphql", "lodash.set", "react", "final-form", "@tinacms/schema-tools", "graphql-tag", "yup", "@tinacms/sharedctx", "react-router-dom", "@headlessui/react", "@react-hook/window-size"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.tinacms = {}, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP, global.NOOP));
|
|
3
|
+
})(this, function(exports2, toolkit, G, set, React, finalForm, schemaTools, gql$1, yup, sharedctx, reactRouterDom, react, windowSize) {
|
|
4
4
|
"use strict";
|
|
5
5
|
function _interopDefaultLegacy(e) {
|
|
6
6
|
return e && typeof e === "object" && "default" in e ? e : { "default": e };
|
|
@@ -30,7 +30,6 @@
|
|
|
30
30
|
var React__default = /* @__PURE__ */ _interopDefaultLegacy(React);
|
|
31
31
|
var gql__default = /* @__PURE__ */ _interopDefaultLegacy(gql$1);
|
|
32
32
|
var yup__namespace = /* @__PURE__ */ _interopNamespace(yup);
|
|
33
|
-
var UrlPattern__default = /* @__PURE__ */ _interopDefaultLegacy(UrlPattern);
|
|
34
33
|
function popupWindow(url, title, window2, w, h) {
|
|
35
34
|
const y = window2.top.outerHeight / 2 + window2.top.screenY - h / 2;
|
|
36
35
|
const x = window2.top.outerWidth / 2 + window2.top.screenX - w / 2;
|
|
@@ -2133,7 +2132,7 @@
|
|
|
2133
2132
|
};
|
|
2134
2133
|
class Client {
|
|
2135
2134
|
constructor({ tokenStorage = "MEMORY", ...options }) {
|
|
2136
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
2135
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, _P;
|
|
2137
2136
|
this.events = new toolkit.EventBus();
|
|
2138
2137
|
this.addPendingContent = async (props) => {
|
|
2139
2138
|
const mutation = `#graphql
|
|
@@ -2183,6 +2182,15 @@ mutation addPendingDocumentMutation(
|
|
|
2183
2182
|
};
|
|
2184
2183
|
this.onLogin = (_d = (_c = (_b = (_a = options.schema) == null ? void 0 : _a.config) == null ? void 0 : _b.admin) == null ? void 0 : _c.auth) == null ? void 0 : _d.onLogin;
|
|
2185
2184
|
this.onLogout = (_h = (_g = (_f = (_e = options.schema) == null ? void 0 : _e.config) == null ? void 0 : _f.admin) == null ? void 0 : _g.auth) == null ? void 0 : _h.onLogout;
|
|
2185
|
+
if ((_l = (_k = (_j = (_i = options.schema) == null ? void 0 : _i.config) == null ? void 0 : _j.admin) == null ? void 0 : _k.auth) == null ? void 0 : _l.logout) {
|
|
2186
|
+
this.onLogout = (_p = (_o = (_n = (_m = options.schema) == null ? void 0 : _m.config) == null ? void 0 : _n.admin) == null ? void 0 : _o.auth) == null ? void 0 : _p.logout;
|
|
2187
|
+
}
|
|
2188
|
+
if ((_t = (_s = (_r = (_q = options.schema) == null ? void 0 : _q.config) == null ? void 0 : _r.admin) == null ? void 0 : _s.auth) == null ? void 0 : _t.getUser) {
|
|
2189
|
+
this.getUser = (_x = (_w = (_v = (_u = options.schema) == null ? void 0 : _u.config) == null ? void 0 : _v.admin) == null ? void 0 : _w.auth) == null ? void 0 : _x.getUser;
|
|
2190
|
+
}
|
|
2191
|
+
if ((_B = (_A = (_z = (_y = options.schema) == null ? void 0 : _y.config) == null ? void 0 : _z.admin) == null ? void 0 : _A.auth) == null ? void 0 : _B.authenticate) {
|
|
2192
|
+
this.authenticate = (_F = (_E = (_D = (_C = options.schema) == null ? void 0 : _C.config) == null ? void 0 : _D.admin) == null ? void 0 : _E.auth) == null ? void 0 : _F.authenticate;
|
|
2193
|
+
}
|
|
2186
2194
|
if (options.schema) {
|
|
2187
2195
|
const enrichedSchema = new schemaTools.TinaSchema({
|
|
2188
2196
|
version: { fullVersion: "", major: "", minor: "", patch: "" },
|
|
@@ -2192,6 +2200,9 @@ mutation addPendingDocumentMutation(
|
|
|
2192
2200
|
this.schema = enrichedSchema;
|
|
2193
2201
|
}
|
|
2194
2202
|
this.options = options;
|
|
2203
|
+
if ((_H = (_G = options.schema) == null ? void 0 : _G.config) == null ? void 0 : _H.contentApiUrlOverride) {
|
|
2204
|
+
this.options.customContentApiUrl = options.schema.config.contentApiUrlOverride;
|
|
2205
|
+
}
|
|
2195
2206
|
this.setBranch(options.branch);
|
|
2196
2207
|
this.events.subscribe("branch:change", ({ branchName }) => {
|
|
2197
2208
|
this.setBranch(branchName);
|
|
@@ -2238,6 +2249,9 @@ mutation addPendingDocumentMutation(
|
|
|
2238
2249
|
this.getToken = options.getTokenFn;
|
|
2239
2250
|
break;
|
|
2240
2251
|
}
|
|
2252
|
+
if ((_L = (_K = (_J = (_I = options.schema) == null ? void 0 : _I.config) == null ? void 0 : _J.admin) == null ? void 0 : _K.auth) == null ? void 0 : _L.getToken) {
|
|
2253
|
+
this.getToken = (_P = (_O = (_N = (_M = options.schema) == null ? void 0 : _M.config) == null ? void 0 : _N.admin) == null ? void 0 : _O.auth) == null ? void 0 : _P.getToken;
|
|
2254
|
+
}
|
|
2241
2255
|
}
|
|
2242
2256
|
get isLocalMode() {
|
|
2243
2257
|
return false;
|
|
@@ -2482,10 +2496,7 @@ mutation addPendingDocumentMutation(
|
|
|
2482
2496
|
localStorage.setItem(LOCAL_CLIENT_KEY, "true");
|
|
2483
2497
|
return { access_token: "LOCAL", id_token: "LOCAL", refresh_token: "LOCAL" };
|
|
2484
2498
|
}
|
|
2485
|
-
async
|
|
2486
|
-
return localStorage.getItem(LOCAL_CLIENT_KEY) === "true";
|
|
2487
|
-
}
|
|
2488
|
-
async isAuthenticated() {
|
|
2499
|
+
async getUser() {
|
|
2489
2500
|
return localStorage.getItem(LOCAL_CLIENT_KEY) === "true";
|
|
2490
2501
|
}
|
|
2491
2502
|
}
|
|
@@ -2566,17 +2577,50 @@ mutation addPendingDocumentMutation(
|
|
|
2566
2577
|
}
|
|
2567
2578
|
}`, { variables: { collection, relativePath } });
|
|
2568
2579
|
}
|
|
2569
|
-
async fetchCollection(collectionName, includeDocuments, after, sortKey, order) {
|
|
2580
|
+
async fetchCollection(collectionName, includeDocuments, after, sortKey, order, filterArgs) {
|
|
2581
|
+
let filter = null;
|
|
2582
|
+
const filterField = filterArgs == null ? void 0 : filterArgs.filterField;
|
|
2583
|
+
if (filterField) {
|
|
2584
|
+
filter = {
|
|
2585
|
+
[collectionName]: {
|
|
2586
|
+
[filterField]: {}
|
|
2587
|
+
}
|
|
2588
|
+
};
|
|
2589
|
+
}
|
|
2590
|
+
if (filterField && (filterArgs == null ? void 0 : filterArgs.startsWith)) {
|
|
2591
|
+
filter[collectionName][filterField] = {
|
|
2592
|
+
...filter[collectionName][filterField] || {},
|
|
2593
|
+
startsWith: filterArgs.startsWith
|
|
2594
|
+
};
|
|
2595
|
+
}
|
|
2596
|
+
if (filterField && (filterArgs == null ? void 0 : filterArgs.before)) {
|
|
2597
|
+
filter[collectionName][filterField] = {
|
|
2598
|
+
...filter[collectionName][filterField] || {},
|
|
2599
|
+
before: filterArgs.before
|
|
2600
|
+
};
|
|
2601
|
+
}
|
|
2602
|
+
if (filterField && (filterArgs == null ? void 0 : filterArgs.after)) {
|
|
2603
|
+
filter[collectionName][filterField] = {
|
|
2604
|
+
...filter[collectionName][filterField] || {},
|
|
2605
|
+
after: filterArgs.after
|
|
2606
|
+
};
|
|
2607
|
+
}
|
|
2608
|
+
if (filterField && (filterArgs == null ? void 0 : filterArgs.booleanEquals) !== null && (filterArgs == null ? void 0 : filterArgs.booleanEquals) !== void 0) {
|
|
2609
|
+
filter[collectionName][filterField] = {
|
|
2610
|
+
...filter[collectionName][filterField] || {},
|
|
2611
|
+
eq: filterArgs.booleanEquals
|
|
2612
|
+
};
|
|
2613
|
+
}
|
|
2570
2614
|
if (includeDocuments === true) {
|
|
2571
2615
|
const sort = sortKey || this.schema.getIsTitleFieldName(collectionName);
|
|
2572
2616
|
const response = order === "asc" ? await this.api.request(`#graphql
|
|
2573
|
-
query($collection: String!, $includeDocuments: Boolean!, $sort: String, $limit: Float, $after: String){
|
|
2617
|
+
query($collection: String!, $includeDocuments: Boolean!, $sort: String, $limit: Float, $after: String, $filter: DocumentFilter){
|
|
2574
2618
|
collection(collection: $collection){
|
|
2575
2619
|
name
|
|
2576
2620
|
label
|
|
2577
2621
|
format
|
|
2578
2622
|
templates
|
|
2579
|
-
documents(sort: $sort, after: $after, first: $limit) @include(if: $includeDocuments) {
|
|
2623
|
+
documents(sort: $sort, after: $after, first: $limit, filter: $filter) @include(if: $includeDocuments) {
|
|
2580
2624
|
totalCount
|
|
2581
2625
|
pageInfo {
|
|
2582
2626
|
hasPreviousPage
|
|
@@ -2608,16 +2652,17 @@ mutation addPendingDocumentMutation(
|
|
|
2608
2652
|
includeDocuments,
|
|
2609
2653
|
sort,
|
|
2610
2654
|
limit: 50,
|
|
2611
|
-
after
|
|
2655
|
+
after,
|
|
2656
|
+
filter
|
|
2612
2657
|
}
|
|
2613
2658
|
}) : await this.api.request(`#graphql
|
|
2614
|
-
query($collection: String!, $includeDocuments: Boolean!, $sort: String, $limit: Float, $after: String){
|
|
2659
|
+
query($collection: String!, $includeDocuments: Boolean!, $sort: String, $limit: Float, $after: String, $filter: DocumentFilter){
|
|
2615
2660
|
collection(collection: $collection){
|
|
2616
2661
|
name
|
|
2617
2662
|
label
|
|
2618
2663
|
format
|
|
2619
2664
|
templates
|
|
2620
|
-
documents(sort: $sort, before: $after, last: $limit) @include(if: $includeDocuments) {
|
|
2665
|
+
documents(sort: $sort, before: $after, last: $limit, filter: $filter) @include(if: $includeDocuments) {
|
|
2621
2666
|
totalCount
|
|
2622
2667
|
pageInfo {
|
|
2623
2668
|
hasPreviousPage
|
|
@@ -2649,7 +2694,8 @@ mutation addPendingDocumentMutation(
|
|
|
2649
2694
|
includeDocuments,
|
|
2650
2695
|
sort,
|
|
2651
2696
|
limit: 50,
|
|
2652
|
-
after
|
|
2697
|
+
after,
|
|
2698
|
+
filter
|
|
2653
2699
|
}
|
|
2654
2700
|
});
|
|
2655
2701
|
return response.collection;
|
|
@@ -2718,8 +2764,9 @@ mutation addPendingDocumentMutation(
|
|
|
2718
2764
|
loginScreen,
|
|
2719
2765
|
getModalActions
|
|
2720
2766
|
}) => {
|
|
2767
|
+
var _a, _b, _c, _d, _e;
|
|
2721
2768
|
const client = cms.api.tina;
|
|
2722
|
-
const
|
|
2769
|
+
const isTinaCloud = !client.isLocalMode && !((_e = (_d = (_c = (_b = (_a = client.schema) == null ? void 0 : _a.config) == null ? void 0 : _b.config) == null ? void 0 : _c.admin) == null ? void 0 : _d.auth) == null ? void 0 : _e.customAuth);
|
|
2723
2770
|
const [activeModal, setActiveModal] = React.useState(null);
|
|
2724
2771
|
const [showChildren, setShowChildren] = React.useState(false);
|
|
2725
2772
|
React__default["default"].useEffect(() => {
|
|
@@ -2748,8 +2795,8 @@ mutation addPendingDocumentMutation(
|
|
|
2748
2795
|
}
|
|
2749
2796
|
}) : [];
|
|
2750
2797
|
return /* @__PURE__ */ React__default["default"].createElement(React__default["default"].Fragment, null, activeModal === "authenticate" && /* @__PURE__ */ React__default["default"].createElement(ModalBuilder, {
|
|
2751
|
-
title:
|
|
2752
|
-
message:
|
|
2798
|
+
title: isTinaCloud ? "Tina Cloud Authorization" : "Enter into edit mode",
|
|
2799
|
+
message: isTinaCloud ? "To save edits, Tina Cloud authorization is required. On save, changes will get commited using your account." : "To save edits, enter into edit mode. On save, changes will saved to the local filesystem.",
|
|
2753
2800
|
close,
|
|
2754
2801
|
actions: [
|
|
2755
2802
|
...otherModalActions,
|
|
@@ -2762,7 +2809,7 @@ mutation addPendingDocumentMutation(
|
|
|
2762
2809
|
primary: false
|
|
2763
2810
|
},
|
|
2764
2811
|
{
|
|
2765
|
-
name:
|
|
2812
|
+
name: isTinaCloud ? "Continue to Tina Cloud" : "Enter Edit Mode",
|
|
2766
2813
|
action: async () => {
|
|
2767
2814
|
const token = await client.authenticate();
|
|
2768
2815
|
if (typeof (client == null ? void 0 : client.onLogin) === "function") {
|
|
@@ -3265,6 +3312,9 @@ mutation addPendingDocumentMutation(
|
|
|
3265
3312
|
.tina-tailwind .mt-2 {
|
|
3266
3313
|
margin-top: 8px;
|
|
3267
3314
|
}
|
|
3315
|
+
.tina-tailwind .ml-1\\.5 {
|
|
3316
|
+
margin-left: 6px;
|
|
3317
|
+
}
|
|
3268
3318
|
.tina-tailwind .mb-4 {
|
|
3269
3319
|
margin-bottom: 16px;
|
|
3270
3320
|
}
|
|
@@ -3292,6 +3342,9 @@ mutation addPendingDocumentMutation(
|
|
|
3292
3342
|
.tina-tailwind .table {
|
|
3293
3343
|
display: table;
|
|
3294
3344
|
}
|
|
3345
|
+
.tina-tailwind .grid {
|
|
3346
|
+
display: grid;
|
|
3347
|
+
}
|
|
3295
3348
|
.tina-tailwind .h-screen {
|
|
3296
3349
|
height: 100vh;
|
|
3297
3350
|
}
|
|
@@ -3402,9 +3455,18 @@ mutation addPendingDocumentMutation(
|
|
|
3402
3455
|
.tina-tailwind .cursor-pointer {
|
|
3403
3456
|
cursor: pointer;
|
|
3404
3457
|
}
|
|
3458
|
+
.tina-tailwind .grid-flow-col {
|
|
3459
|
+
grid-auto-flow: column;
|
|
3460
|
+
}
|
|
3405
3461
|
.tina-tailwind .flex-col {
|
|
3406
3462
|
flex-direction: column;
|
|
3407
3463
|
}
|
|
3464
|
+
.tina-tailwind .flex-wrap {
|
|
3465
|
+
flex-wrap: wrap;
|
|
3466
|
+
}
|
|
3467
|
+
.tina-tailwind .items-start {
|
|
3468
|
+
align-items: flex-start;
|
|
3469
|
+
}
|
|
3408
3470
|
.tina-tailwind .items-end {
|
|
3409
3471
|
align-items: flex-end;
|
|
3410
3472
|
}
|
|
@@ -3447,6 +3509,12 @@ mutation addPendingDocumentMutation(
|
|
|
3447
3509
|
--tw-divide-opacity: 1;
|
|
3448
3510
|
border-color: rgb(230 227 239 / var(--tw-divide-opacity));
|
|
3449
3511
|
}
|
|
3512
|
+
.tina-tailwind .self-end {
|
|
3513
|
+
align-self: flex-end;
|
|
3514
|
+
}
|
|
3515
|
+
.tina-tailwind .justify-self-end {
|
|
3516
|
+
justify-self: end;
|
|
3517
|
+
}
|
|
3450
3518
|
.tina-tailwind .overflow-hidden {
|
|
3451
3519
|
overflow: hidden;
|
|
3452
3520
|
}
|
|
@@ -3461,6 +3529,9 @@ mutation addPendingDocumentMutation(
|
|
|
3461
3529
|
.tina-tailwind .whitespace-normal {
|
|
3462
3530
|
white-space: normal;
|
|
3463
3531
|
}
|
|
3532
|
+
.tina-tailwind .whitespace-nowrap {
|
|
3533
|
+
white-space: nowrap;
|
|
3534
|
+
}
|
|
3464
3535
|
.tina-tailwind .rounded-lg {
|
|
3465
3536
|
border-radius: 8px;
|
|
3466
3537
|
}
|
|
@@ -3514,6 +3585,11 @@ mutation addPendingDocumentMutation(
|
|
|
3514
3585
|
--tw-gradient-to: rgb(29 44 108 / 0);
|
|
3515
3586
|
--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to);
|
|
3516
3587
|
}
|
|
3588
|
+
.tina-tailwind .from-gray-50\\/50 {
|
|
3589
|
+
--tw-gradient-from: rgb(246 246 249 / .5);
|
|
3590
|
+
--tw-gradient-to: rgb(246 246 249 / 0);
|
|
3591
|
+
--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to);
|
|
3592
|
+
}
|
|
3517
3593
|
.tina-tailwind .from-gray-800 {
|
|
3518
3594
|
--tw-gradient-from: #363145;
|
|
3519
3595
|
--tw-gradient-to: rgb(54 49 69 / 0);
|
|
@@ -3526,6 +3602,9 @@ mutation addPendingDocumentMutation(
|
|
|
3526
3602
|
.tina-tailwind .to-gray-900 {
|
|
3527
3603
|
--tw-gradient-to: #252336;
|
|
3528
3604
|
}
|
|
3605
|
+
.tina-tailwind .to-gray-50 {
|
|
3606
|
+
--tw-gradient-to: #F6F6F9;
|
|
3607
|
+
}
|
|
3529
3608
|
.tina-tailwind .to-black {
|
|
3530
3609
|
--tw-gradient-to: #000;
|
|
3531
3610
|
}
|
|
@@ -3549,6 +3628,10 @@ mutation addPendingDocumentMutation(
|
|
|
3549
3628
|
padding-left: 48px;
|
|
3550
3629
|
padding-right: 48px;
|
|
3551
3630
|
}
|
|
3631
|
+
.tina-tailwind .py-8 {
|
|
3632
|
+
padding-top: 32px;
|
|
3633
|
+
padding-bottom: 32px;
|
|
3634
|
+
}
|
|
3552
3635
|
.tina-tailwind .py-10 {
|
|
3553
3636
|
padding-top: 40px;
|
|
3554
3637
|
padding-bottom: 40px;
|
|
@@ -3580,11 +3663,8 @@ mutation addPendingDocumentMutation(
|
|
|
3580
3663
|
.tina-tailwind .pt-4 {
|
|
3581
3664
|
padding-top: 16px;
|
|
3582
3665
|
}
|
|
3583
|
-
.tina-tailwind .
|
|
3584
|
-
padding-
|
|
3585
|
-
}
|
|
3586
|
-
.tina-tailwind .pt-16 {
|
|
3587
|
-
padding-top: 64px;
|
|
3666
|
+
.tina-tailwind .pt-12 {
|
|
3667
|
+
padding-top: 48px;
|
|
3588
3668
|
}
|
|
3589
3669
|
.tina-tailwind .pr-3 {
|
|
3590
3670
|
padding-right: 12px;
|
|
@@ -3598,9 +3678,6 @@ mutation addPendingDocumentMutation(
|
|
|
3598
3678
|
.tina-tailwind .pl-5 {
|
|
3599
3679
|
padding-left: 20px;
|
|
3600
3680
|
}
|
|
3601
|
-
.tina-tailwind .pt-3 {
|
|
3602
|
-
padding-top: 12px;
|
|
3603
|
-
}
|
|
3604
3681
|
.tina-tailwind .pl-18 {
|
|
3605
3682
|
padding-left: 72px;
|
|
3606
3683
|
}
|
|
@@ -4092,26 +4169,6 @@ mutation addPendingDocumentMutation(
|
|
|
4092
4169
|
isLoading
|
|
4093
4170
|
};
|
|
4094
4171
|
}
|
|
4095
|
-
const parseURL = (url) => {
|
|
4096
|
-
if (url.includes("localhost")) {
|
|
4097
|
-
return { branch: null, isLocalClient: true, clientId: null };
|
|
4098
|
-
}
|
|
4099
|
-
const params = new URL(url);
|
|
4100
|
-
const pattern = new UrlPattern__default["default"]("/content/:clientId/github/*", {
|
|
4101
|
-
escapeChar: " "
|
|
4102
|
-
});
|
|
4103
|
-
const result = pattern.match(params.pathname);
|
|
4104
|
-
const branch = result == null ? void 0 : result._;
|
|
4105
|
-
const clientId = result == null ? void 0 : result.clientId;
|
|
4106
|
-
if (!branch || !clientId) {
|
|
4107
|
-
throw new Error(`Invalid URL format provided. Expected: https://content.tinajs.io/content/<ClientID>/github/<Branch> but but received ${url}`);
|
|
4108
|
-
}
|
|
4109
|
-
return {
|
|
4110
|
-
branch,
|
|
4111
|
-
clientId,
|
|
4112
|
-
isLocalClient: false
|
|
4113
|
-
};
|
|
4114
|
-
};
|
|
4115
4172
|
const errorButtonStyles = {
|
|
4116
4173
|
background: "#eb6337",
|
|
4117
4174
|
padding: "12px 18px",
|
|
@@ -4198,7 +4255,7 @@ mutation addPendingDocumentMutation(
|
|
|
4198
4255
|
schema,
|
|
4199
4256
|
...props
|
|
4200
4257
|
}) => {
|
|
4201
|
-
var _a;
|
|
4258
|
+
var _a, _b, _c, _d, _e;
|
|
4202
4259
|
React__default["default"].useEffect(() => {
|
|
4203
4260
|
console.warn(`
|
|
4204
4261
|
* Tina no longer requires wrapping your site in the TinaProvider
|
|
@@ -4209,12 +4266,13 @@ mutation addPendingDocumentMutation(
|
|
|
4209
4266
|
console.warn("The apiURL prop is deprecated. Please see https://tina.io/blog/tina-v-0.68.14 for information on how to upgrade to the new API");
|
|
4210
4267
|
}
|
|
4211
4268
|
const apiURL = ((_a = props == null ? void 0 : props.client) == null ? void 0 : _a.apiUrl) || (props == null ? void 0 : props.apiURL);
|
|
4212
|
-
const
|
|
4269
|
+
const isLocalOverride = (_d = (_c = (_b = schema == null ? void 0 : schema.config) == null ? void 0 : _b.admin) == null ? void 0 : _c.auth) == null ? void 0 : _d.useLocalAuth;
|
|
4270
|
+
const { branch, clientId, isLocalClient } = apiURL ? schemaTools.parseURL(apiURL) : {
|
|
4213
4271
|
branch: props.branch,
|
|
4214
4272
|
clientId: props.clientId,
|
|
4215
4273
|
isLocalClient: props == null ? void 0 : props.isLocalClient
|
|
4216
4274
|
};
|
|
4217
|
-
if (typeof isLocalClient === "undefined" || !isLocalClient && (!branch || !clientId)) {
|
|
4275
|
+
if (typeof isLocalClient === "undefined" || !isLocalClient && (!branch || !clientId) && !schema.config.contentApiUrlOverride) {
|
|
4218
4276
|
throw new Error("Invalid setup. See https://tina.io/docs/tina-cloud/connecting-site/ for more information.");
|
|
4219
4277
|
}
|
|
4220
4278
|
if (!schema) {
|
|
@@ -4222,9 +4280,9 @@ mutation addPendingDocumentMutation(
|
|
|
4222
4280
|
}
|
|
4223
4281
|
return /* @__PURE__ */ React__default["default"].createElement(React__default["default"].Fragment, null, /* @__PURE__ */ React__default["default"].createElement(TinaCloudProvider, {
|
|
4224
4282
|
branch,
|
|
4225
|
-
clientId,
|
|
4283
|
+
clientId: clientId || ((_e = schema == null ? void 0 : schema.config) == null ? void 0 : _e.clientId),
|
|
4226
4284
|
tinaioConfig: props.tinaioConfig,
|
|
4227
|
-
isLocalClient,
|
|
4285
|
+
isLocalClient: isLocalOverride || isLocalClient,
|
|
4228
4286
|
cmsCallback: props.cmsCallback,
|
|
4229
4287
|
mediaStore: props.mediaStore,
|
|
4230
4288
|
apiUrl: apiURL,
|
|
@@ -4568,9 +4626,15 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
4568
4626
|
function BiRename(props) {
|
|
4569
4627
|
return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "d": "M20.005 5.995h-1v2h1v8h-1v2h1c1.103 0 2-.897 2-2v-8c0-1.102-.898-2-2-2zm-14 4H15v4H6.005z" } }, { "tag": "path", "attr": { "d": "M17.005 17.995V4H20V2h-8v2h3.005v1.995h-11c-1.103 0-2 .897-2 2v8c0 1.103.897 2 2 2h11V20H12v2h8v-2h-2.995v-2.005zm-13-2v-8h11v8h-11z" } }] })(props);
|
|
4570
4628
|
}
|
|
4629
|
+
function BiSearch(props) {
|
|
4630
|
+
return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "d": "M10 18a7.952 7.952 0 0 0 4.897-1.688l4.396 4.396 1.414-1.414-4.396-4.396A7.952 7.952 0 0 0 18 10c0-4.411-3.589-8-8-8s-8 3.589-8 8 3.589 8 8 8zm0-14c3.309 0 6 2.691 6 6s-2.691 6-6 6-6-2.691-6-6 2.691-6 6-6z" } }] })(props);
|
|
4631
|
+
}
|
|
4571
4632
|
function BiTrash(props) {
|
|
4572
4633
|
return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "d": "M5 20a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8h2V6h-4V4a2 2 0 0 0-2-2H9a2 2 0 0 0-2 2v2H3v2h2zM9 4h6v2H9zM8 8h9v12H7V8z" } }, { "tag": "path", "attr": { "d": "M9 10h2v8H9zm4 0h2v8h-2z" } }] })(props);
|
|
4573
4634
|
}
|
|
4635
|
+
function BiX(props) {
|
|
4636
|
+
return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24" }, "child": [{ "tag": "path", "attr": { "d": "m16.192 6.344-4.243 4.242-4.242-4.242-1.414 1.414L10.535 12l-4.242 4.242 1.414 1.414 4.242-4.242 4.243 4.242 1.414-1.414L13.364 12l4.242-4.242z" } }] })(props);
|
|
4637
|
+
}
|
|
4574
4638
|
const slugify = (text) => {
|
|
4575
4639
|
return text.toString().toLowerCase().trim().replace(/[^\w\s-]/g, "").replace(/[\s_-]+/g, "_").replace(/^-+|-+$/g, "");
|
|
4576
4640
|
};
|
|
@@ -4829,14 +4893,14 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
4829
4893
|
children
|
|
4830
4894
|
}) => {
|
|
4831
4895
|
return /* @__PURE__ */ React__default["default"].createElement("div", {
|
|
4832
|
-
className: "relative left-0 w-full h-full bg-gray-50 shadow-2xl overflow-y-auto transition-opacity duration-300 ease-out flex flex-col opacity-100"
|
|
4896
|
+
className: "relative left-0 w-full h-full bg-gradient-to-b from-gray-50/50 to-gray-50 shadow-2xl overflow-y-auto transition-opacity duration-300 ease-out flex flex-col opacity-100"
|
|
4833
4897
|
}, children);
|
|
4834
4898
|
};
|
|
4835
4899
|
const PageHeader = ({
|
|
4836
4900
|
isLocalMode,
|
|
4837
4901
|
children
|
|
4838
4902
|
}) => /* @__PURE__ */ React__default["default"].createElement(React__default["default"].Fragment, null, isLocalMode && /* @__PURE__ */ React__default["default"].createElement(toolkit.LocalWarning, null), !isLocalMode && /* @__PURE__ */ React__default["default"].createElement(toolkit.BillingWarning, null), /* @__PURE__ */ React__default["default"].createElement("div", {
|
|
4839
|
-
className: "
|
|
4903
|
+
className: "pt-12 px-12"
|
|
4840
4904
|
}, /* @__PURE__ */ React__default["default"].createElement("div", {
|
|
4841
4905
|
className: "w-full mx-auto max-w-screen-xl"
|
|
4842
4906
|
}, /* @__PURE__ */ React__default["default"].createElement("div", {
|
|
@@ -4845,7 +4909,7 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
4845
4909
|
const PageBody = ({
|
|
4846
4910
|
children
|
|
4847
4911
|
}) => /* @__PURE__ */ React__default["default"].createElement("div", {
|
|
4848
|
-
className: "py-
|
|
4912
|
+
className: "py-8 px-12"
|
|
4849
4913
|
}, children);
|
|
4850
4914
|
const PageBodyNarrow = ({
|
|
4851
4915
|
children
|
|
@@ -4963,7 +5027,7 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
4963
5027
|
fontWeight: "normal"
|
|
4964
5028
|
}
|
|
4965
5029
|
}, "Please wait, Tina is loading data..."))));
|
|
4966
|
-
const useGetCollection = (cms, collectionName, includeDocuments = true, after = "", sortKey) => {
|
|
5030
|
+
const useGetCollection = (cms, collectionName, includeDocuments = true, after = "", sortKey, filterArgs) => {
|
|
4967
5031
|
const api = new TinaAdminApi(cms);
|
|
4968
5032
|
const schema = cms.api.tina.schema;
|
|
4969
5033
|
const collectionExtra = schema.getCollection(collectionName);
|
|
@@ -4978,7 +5042,7 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
4978
5042
|
const { name, order } = JSON.parse(sortKey || "{}");
|
|
4979
5043
|
const validSortKey = ((_a = collectionExtra.fields) == null ? void 0 : _a.map((x) => x.name).includes(name)) ? name : void 0;
|
|
4980
5044
|
try {
|
|
4981
|
-
const collection2 = await api.fetchCollection(collectionName, includeDocuments, after, validSortKey, order);
|
|
5045
|
+
const collection2 = await api.fetchCollection(collectionName, includeDocuments, after, validSortKey, order, filterArgs);
|
|
4982
5046
|
setCollection(collection2);
|
|
4983
5047
|
} catch (error2) {
|
|
4984
5048
|
cms.alerts.error(`[${error2.name}] GetCollection failed: ${error2.message}`);
|
|
@@ -5001,9 +5065,10 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
5001
5065
|
includeDocuments = true,
|
|
5002
5066
|
startCursor,
|
|
5003
5067
|
sortKey,
|
|
5004
|
-
children
|
|
5068
|
+
children,
|
|
5069
|
+
filterArgs
|
|
5005
5070
|
}) => {
|
|
5006
|
-
const { collection, loading, error, reFetchCollection, collectionExtra } = useGetCollection(cms, collectionName, includeDocuments, startCursor || "", sortKey) || {};
|
|
5071
|
+
const { collection, loading, error, reFetchCollection, collectionExtra } = useGetCollection(cms, collectionName, includeDocuments, startCursor || "", sortKey, filterArgs) || {};
|
|
5007
5072
|
if (error) {
|
|
5008
5073
|
return null;
|
|
5009
5074
|
}
|
|
@@ -5068,7 +5133,13 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
5068
5133
|
const [vars, setVars] = React__default["default"].useState({
|
|
5069
5134
|
collection: collectionName,
|
|
5070
5135
|
relativePath: "",
|
|
5071
|
-
newRelativePath: ""
|
|
5136
|
+
newRelativePath: "",
|
|
5137
|
+
filterField: "",
|
|
5138
|
+
startsWith: "",
|
|
5139
|
+
endsWith: "",
|
|
5140
|
+
before: "",
|
|
5141
|
+
after: "",
|
|
5142
|
+
booleanEquals: null
|
|
5072
5143
|
});
|
|
5073
5144
|
const [endCursor, setEndCursor] = React.useState("");
|
|
5074
5145
|
const [prevCursors, setPrevCursors] = React.useState([]);
|
|
@@ -5086,23 +5157,55 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
5086
5157
|
setEndCursor("");
|
|
5087
5158
|
setPrevCursors([]);
|
|
5088
5159
|
}, [loc]);
|
|
5160
|
+
React.useEffect(() => {
|
|
5161
|
+
setVars((old) => ({
|
|
5162
|
+
...old,
|
|
5163
|
+
collection: collectionName,
|
|
5164
|
+
relativePath: "",
|
|
5165
|
+
newRelativePath: "",
|
|
5166
|
+
filterField: "",
|
|
5167
|
+
startsWith: "",
|
|
5168
|
+
endsWith: "",
|
|
5169
|
+
before: "",
|
|
5170
|
+
after: "",
|
|
5171
|
+
booleanEquals: null
|
|
5172
|
+
}));
|
|
5173
|
+
}, [collectionName]);
|
|
5089
5174
|
return /* @__PURE__ */ React__default["default"].createElement(GetCMS, null, (cms) => {
|
|
5090
5175
|
return /* @__PURE__ */ React__default["default"].createElement(GetCollection, {
|
|
5091
5176
|
cms,
|
|
5092
5177
|
collectionName,
|
|
5093
5178
|
includeDocuments: true,
|
|
5094
5179
|
startCursor: endCursor,
|
|
5095
|
-
sortKey
|
|
5180
|
+
sortKey,
|
|
5181
|
+
filterArgs: collectionName === vars.collection ? vars : {
|
|
5182
|
+
collection: collectionName,
|
|
5183
|
+
relativePath: "",
|
|
5184
|
+
newRelativePath: "",
|
|
5185
|
+
filterField: "",
|
|
5186
|
+
startsWith: "",
|
|
5187
|
+
endsWith: "",
|
|
5188
|
+
before: "",
|
|
5189
|
+
after: "",
|
|
5190
|
+
booleanEquals: null
|
|
5191
|
+
}
|
|
5096
5192
|
}, (collection, _loading, reFetchCollection, collectionExtra) => {
|
|
5097
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
5193
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
5098
5194
|
const totalCount = collection.documents.totalCount;
|
|
5099
5195
|
const documents = collection.documents.edges;
|
|
5100
5196
|
const admin = cms.api.admin;
|
|
5101
5197
|
const pageInfo = collection.documents.pageInfo;
|
|
5102
5198
|
const fields = (_a = collectionExtra.fields) == null ? void 0 : _a.filter((x) => ["string", "number", "datetime", "boolean"].includes(x.type));
|
|
5199
|
+
const filterFields = (_b = collectionExtra.fields) == null ? void 0 : _b.filter((x) => {
|
|
5200
|
+
return ["string", "datetime", "boolean"].includes(x.type) && !x.list;
|
|
5201
|
+
});
|
|
5202
|
+
const filterField = filterFields == null ? void 0 : filterFields.find((x) => x.name === vars.filterField);
|
|
5203
|
+
const showStartsWith = (filterField == null ? void 0 : filterField.type) === "string" && !filterField.list;
|
|
5204
|
+
const showDateFilter = (filterField == null ? void 0 : filterField.type) === "datetime";
|
|
5205
|
+
const showBooleanToggle = (filterField == null ? void 0 : filterField.type) === "boolean" && !filterField.list;
|
|
5103
5206
|
const collectionDefinition = cms.api.tina.schema.getCollection(collection.name);
|
|
5104
|
-
const allowCreate = (
|
|
5105
|
-
const allowDelete = (
|
|
5207
|
+
const allowCreate = (_e = (_d = (_c = collectionDefinition == null ? void 0 : collectionDefinition.ui) == null ? void 0 : _c.allowedActions) == null ? void 0 : _d.create) != null ? _e : true;
|
|
5208
|
+
const allowDelete = (_h = (_g = (_f = collectionDefinition == null ? void 0 : collectionDefinition.ui) == null ? void 0 : _f.allowedActions) == null ? void 0 : _g.delete) != null ? _h : true;
|
|
5106
5209
|
return /* @__PURE__ */ React__default["default"].createElement(PageWrapper, null, /* @__PURE__ */ React__default["default"].createElement(React__default["default"].Fragment, null, deleteModalOpen && /* @__PURE__ */ React__default["default"].createElement(DeleteModal, {
|
|
5107
5210
|
filename: vars.relativePath,
|
|
5108
5211
|
deleteFunc: async () => {
|
|
@@ -5143,13 +5246,17 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
5143
5246
|
},
|
|
5144
5247
|
close: () => setRenameModalOpen(false)
|
|
5145
5248
|
}), /* @__PURE__ */ React__default["default"].createElement(PageHeader, {
|
|
5146
|
-
isLocalMode: (
|
|
5147
|
-
}, /* @__PURE__ */ React__default["default"].createElement(
|
|
5249
|
+
isLocalMode: (_j = (_i = cms == null ? void 0 : cms.api) == null ? void 0 : _i.tina) == null ? void 0 : _j.isLocalMode
|
|
5250
|
+
}, /* @__PURE__ */ React__default["default"].createElement("div", {
|
|
5251
|
+
className: "w-full grid grid-flow-col items-end gap-4"
|
|
5252
|
+
}, /* @__PURE__ */ React__default["default"].createElement("div", {
|
|
5148
5253
|
className: "flex flex-col gap-4"
|
|
5149
5254
|
}, /* @__PURE__ */ React__default["default"].createElement("h3", {
|
|
5150
5255
|
className: "font-sans text-2xl text-gray-700"
|
|
5151
5256
|
}, collection.label ? collection.label : collection.name), (fields == null ? void 0 : fields.length) > 0 && /* @__PURE__ */ React__default["default"].createElement("div", {
|
|
5152
|
-
className: "flex gap-
|
|
5257
|
+
className: "flex gap-4 items-end flex-wrap"
|
|
5258
|
+
}, /* @__PURE__ */ React__default["default"].createElement("div", {
|
|
5259
|
+
className: "flex flex-col gap-2 items-start"
|
|
5153
5260
|
}, /* @__PURE__ */ React__default["default"].createElement("label", {
|
|
5154
5261
|
htmlFor: "sort",
|
|
5155
5262
|
className: "block font-sans text-xs font-semibold text-gray-500 whitespace-normal"
|
|
@@ -5165,14 +5272,14 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
5165
5272
|
},
|
|
5166
5273
|
...fields.map((x) => [
|
|
5167
5274
|
{
|
|
5168
|
-
label: (x.label || x.name) + " (Ascending)",
|
|
5275
|
+
label: (x.label || x.name) + (x.type === "datetime" ? " (Oldest First)" : " (Ascending)"),
|
|
5169
5276
|
value: JSON.stringify({
|
|
5170
5277
|
name: x.name,
|
|
5171
5278
|
order: "asc"
|
|
5172
5279
|
})
|
|
5173
5280
|
},
|
|
5174
5281
|
{
|
|
5175
|
-
label: (x.label || x.name) + " (Descending)",
|
|
5282
|
+
label: (x.label || x.name) + (x.type === "datetime" ? " (Newest First)" : " (Descending)"),
|
|
5176
5283
|
value: JSON.stringify({
|
|
5177
5284
|
name: x.name,
|
|
5178
5285
|
order: "desc"
|
|
@@ -5193,14 +5300,154 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
5193
5300
|
setSortOrder(val.order);
|
|
5194
5301
|
}
|
|
5195
5302
|
}
|
|
5196
|
-
}))
|
|
5303
|
+
})), /* @__PURE__ */ React__default["default"].createElement("div", {
|
|
5304
|
+
className: "flex flex-wrap gap-4 items-end"
|
|
5305
|
+
}, /* @__PURE__ */ React__default["default"].createElement("div", {
|
|
5306
|
+
className: "flex flex-shrink-0 flex-col gap-2 items-start"
|
|
5307
|
+
}, /* @__PURE__ */ React__default["default"].createElement("label", {
|
|
5308
|
+
htmlFor: "filter",
|
|
5309
|
+
className: "block font-sans text-xs font-semibold text-gray-500 whitespace-normal"
|
|
5310
|
+
}, "Filter by"), /* @__PURE__ */ React__default["default"].createElement(toolkit.Select, {
|
|
5311
|
+
name: "filter",
|
|
5312
|
+
options: [
|
|
5313
|
+
{
|
|
5314
|
+
label: "None",
|
|
5315
|
+
value: ""
|
|
5316
|
+
},
|
|
5317
|
+
...filterFields.map((x) => ({
|
|
5318
|
+
label: x.label || x.name,
|
|
5319
|
+
value: x.name
|
|
5320
|
+
}))
|
|
5321
|
+
],
|
|
5322
|
+
input: {
|
|
5323
|
+
id: "filter",
|
|
5324
|
+
name: "filter",
|
|
5325
|
+
value: vars.filterField,
|
|
5326
|
+
onChange: (e) => {
|
|
5327
|
+
const val = e.target.value;
|
|
5328
|
+
setEndCursor("");
|
|
5329
|
+
setPrevCursors([]);
|
|
5330
|
+
setVars((old) => ({
|
|
5331
|
+
...old,
|
|
5332
|
+
filterField: val
|
|
5333
|
+
}));
|
|
5334
|
+
}
|
|
5335
|
+
}
|
|
5336
|
+
})), showStartsWith && /* @__PURE__ */ React__default["default"].createElement(React__default["default"].Fragment, null, /* @__PURE__ */ React__default["default"].createElement("div", {
|
|
5337
|
+
className: "flex flex-shrink-0 flex-col gap-2 items-start"
|
|
5338
|
+
}, /* @__PURE__ */ React__default["default"].createElement("label", {
|
|
5339
|
+
htmlFor: "startsWith",
|
|
5340
|
+
className: "block font-sans text-xs font-semibold text-gray-500 whitespace-normal"
|
|
5341
|
+
}, "Starts with"), /* @__PURE__ */ React__default["default"].createElement(toolkit.Input, {
|
|
5342
|
+
name: "startsWith",
|
|
5343
|
+
id: "startsWith",
|
|
5344
|
+
value: vars.startsWith,
|
|
5345
|
+
onChange: (e) => {
|
|
5346
|
+
const val = e.target.value;
|
|
5347
|
+
setVars((old) => ({
|
|
5348
|
+
...old,
|
|
5349
|
+
startsWith: val,
|
|
5350
|
+
after: "",
|
|
5351
|
+
before: "",
|
|
5352
|
+
booleanEquals: null
|
|
5353
|
+
}));
|
|
5354
|
+
}
|
|
5355
|
+
}))), showDateFilter && /* @__PURE__ */ React__default["default"].createElement("div", {
|
|
5356
|
+
className: "flex flex-shrink-0 gap-4"
|
|
5357
|
+
}, /* @__PURE__ */ React__default["default"].createElement("div", {
|
|
5358
|
+
className: "flex flex-col gap-2 items-start"
|
|
5359
|
+
}, /* @__PURE__ */ React__default["default"].createElement("label", {
|
|
5360
|
+
htmlFor: "dateAfter",
|
|
5361
|
+
className: "block font-sans text-xs font-semibold text-gray-500 whitespace-normal"
|
|
5362
|
+
}, "After"), /* @__PURE__ */ React__default["default"].createElement(toolkit.ReactDateTimeWithStyles, {
|
|
5363
|
+
inputProps: {
|
|
5364
|
+
className: toolkit.textFieldClasses
|
|
5365
|
+
},
|
|
5366
|
+
value: vars.after,
|
|
5367
|
+
onChange: (e) => {
|
|
5368
|
+
setVars((old) => ({
|
|
5369
|
+
...old,
|
|
5370
|
+
after: e.format(),
|
|
5371
|
+
booleanEquals: null,
|
|
5372
|
+
startsWith: ""
|
|
5373
|
+
}));
|
|
5374
|
+
}
|
|
5375
|
+
})), /* @__PURE__ */ React__default["default"].createElement("div", {
|
|
5376
|
+
className: "flex flex-col gap-2 items-start"
|
|
5377
|
+
}, /* @__PURE__ */ React__default["default"].createElement("label", {
|
|
5378
|
+
htmlFor: "dateBefore",
|
|
5379
|
+
className: "block font-sans text-xs font-semibold text-gray-500 whitespace-normal"
|
|
5380
|
+
}, "Before"), /* @__PURE__ */ React__default["default"].createElement(toolkit.ReactDateTimeWithStyles, {
|
|
5381
|
+
inputProps: {
|
|
5382
|
+
className: toolkit.textFieldClasses
|
|
5383
|
+
},
|
|
5384
|
+
value: vars.before,
|
|
5385
|
+
onChange: (e) => {
|
|
5386
|
+
setVars((old) => ({
|
|
5387
|
+
...old,
|
|
5388
|
+
before: e.format(),
|
|
5389
|
+
booleanEquals: null,
|
|
5390
|
+
startsWith: ""
|
|
5391
|
+
}));
|
|
5392
|
+
}
|
|
5393
|
+
}))), showBooleanToggle && /* @__PURE__ */ React__default["default"].createElement(React__default["default"].Fragment, null, /* @__PURE__ */ React__default["default"].createElement("div", {
|
|
5394
|
+
className: "flex flex-col gap-2 items-start"
|
|
5395
|
+
}, /* @__PURE__ */ React__default["default"].createElement("label", {
|
|
5396
|
+
htmlFor: "toggle",
|
|
5397
|
+
className: "block font-sans text-xs font-semibold text-gray-500 whitespace-normal"
|
|
5398
|
+
}, filterField.label || filterField.name), /* @__PURE__ */ React__default["default"].createElement(toolkit.Toggle, {
|
|
5399
|
+
field: filterField,
|
|
5400
|
+
input: {
|
|
5401
|
+
name: "toggle",
|
|
5402
|
+
value: (_k = vars.booleanEquals) != null ? _k : false,
|
|
5403
|
+
onChange: () => {
|
|
5404
|
+
setVars((old) => ({
|
|
5405
|
+
...old,
|
|
5406
|
+
booleanEquals: !old.booleanEquals,
|
|
5407
|
+
after: "",
|
|
5408
|
+
before: "",
|
|
5409
|
+
startsWith: ""
|
|
5410
|
+
}));
|
|
5411
|
+
}
|
|
5412
|
+
},
|
|
5413
|
+
name: "toggle"
|
|
5414
|
+
}))), (showStartsWith || showDateFilter || showBooleanToggle) && /* @__PURE__ */ React__default["default"].createElement("div", {
|
|
5415
|
+
className: "flex gap-3"
|
|
5416
|
+
}, /* @__PURE__ */ React__default["default"].createElement(toolkit.Button, {
|
|
5417
|
+
onClick: () => {
|
|
5418
|
+
setEndCursor("");
|
|
5419
|
+
setPrevCursors([]);
|
|
5420
|
+
reFetchCollection();
|
|
5421
|
+
},
|
|
5422
|
+
variant: "primary"
|
|
5423
|
+
}, "Search", " ", /* @__PURE__ */ React__default["default"].createElement(BiSearch, {
|
|
5424
|
+
className: "w-5 h-full ml-1.5 opacity-70"
|
|
5425
|
+
})), (vars.startsWith || vars.after || vars.before || vars.booleanEquals) && /* @__PURE__ */ React__default["default"].createElement(toolkit.Button, {
|
|
5426
|
+
onClick: () => {
|
|
5427
|
+
setVars((old) => ({
|
|
5428
|
+
...old,
|
|
5429
|
+
startsWith: "",
|
|
5430
|
+
after: "",
|
|
5431
|
+
before: "",
|
|
5432
|
+
booleanEquals: null
|
|
5433
|
+
}));
|
|
5434
|
+
setEndCursor("");
|
|
5435
|
+
setPrevCursors([]);
|
|
5436
|
+
reFetchCollection();
|
|
5437
|
+
},
|
|
5438
|
+
variant: "white"
|
|
5439
|
+
}, "Clear", " ", /* @__PURE__ */ React__default["default"].createElement(BiX, {
|
|
5440
|
+
className: "w-5 h-full ml-1 opacity-70"
|
|
5441
|
+
})))))), /* @__PURE__ */ React__default["default"].createElement("div", {
|
|
5442
|
+
className: "flex self-end justify-self-end"
|
|
5443
|
+
}, !collection.templates && allowCreate && /* @__PURE__ */ React__default["default"].createElement(reactRouterDom.Link, {
|
|
5197
5444
|
to: `new`,
|
|
5198
|
-
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
|
|
5445
|
+
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 whitespace-nowrap shadow text-white bg-blue-500 hover:bg-blue-600 focus:ring-blue-500 text-sm h-10 px-6"
|
|
5199
5446
|
}, "Create New", " ", /* @__PURE__ */ React__default["default"].createElement(BiPlus, {
|
|
5200
5447
|
className: "w-5 h-full ml-1 opacity-70"
|
|
5201
5448
|
})), collection.templates && allowCreate && /* @__PURE__ */ React__default["default"].createElement(TemplateMenu, {
|
|
5202
5449
|
templates: collection.templates
|
|
5203
|
-
}))), /* @__PURE__ */ React__default["default"].createElement(PageBody, null, /* @__PURE__ */ React__default["default"].createElement("div", {
|
|
5450
|
+
})))), /* @__PURE__ */ React__default["default"].createElement(PageBody, null, /* @__PURE__ */ React__default["default"].createElement("div", {
|
|
5204
5451
|
className: "w-full mx-auto max-w-screen-xl"
|
|
5205
5452
|
}, totalCount > 0 && /* @__PURE__ */ React__default["default"].createElement("table", {
|
|
5206
5453
|
className: "table-auto shadow bg-white border-b border-gray-200 w-full max-w-full rounded-lg"
|
|
@@ -5272,11 +5519,12 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
5272
5519
|
className: "text-red-500"
|
|
5273
5520
|
}),
|
|
5274
5521
|
onMouseDown: () => {
|
|
5275
|
-
setVars({
|
|
5522
|
+
setVars((old) => ({
|
|
5523
|
+
...old,
|
|
5276
5524
|
collection: collectionName,
|
|
5277
5525
|
relativePath: document.node._sys.breadcrumbs.join("/") + document.node._sys.extension,
|
|
5278
5526
|
newRelativePath: ""
|
|
5279
|
-
});
|
|
5527
|
+
}));
|
|
5280
5528
|
setDeleteModalOpen(true);
|
|
5281
5529
|
}
|
|
5282
5530
|
},
|
|
@@ -5288,18 +5536,19 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
5288
5536
|
className: "text-red-500"
|
|
5289
5537
|
}),
|
|
5290
5538
|
onMouseDown: () => {
|
|
5291
|
-
setVars({
|
|
5539
|
+
setVars((old) => ({
|
|
5540
|
+
...old,
|
|
5292
5541
|
collection: collectionName,
|
|
5293
5542
|
relativePath: document.node._sys.breadcrumbs.join("/") + document.node._sys.extension,
|
|
5294
5543
|
newRelativePath: ""
|
|
5295
|
-
});
|
|
5544
|
+
}));
|
|
5296
5545
|
setRenameModalOpen(true);
|
|
5297
5546
|
}
|
|
5298
5547
|
}
|
|
5299
5548
|
].filter(Boolean)
|
|
5300
5549
|
})));
|
|
5301
5550
|
}))), /* @__PURE__ */ React__default["default"].createElement("div", {
|
|
5302
|
-
className: "pt-
|
|
5551
|
+
className: "pt-4"
|
|
5303
5552
|
}, /* @__PURE__ */ React__default["default"].createElement(toolkit.CursorPaginator, {
|
|
5304
5553
|
variant: "white",
|
|
5305
5554
|
hasNext: sortOrder === "asc" ? pageInfo == null ? void 0 : pageInfo.hasNextPage : pageInfo.hasPreviousPage,
|