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.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useCMS, Form, GlobalFormPlugin, EventBus, Modal, ModalPopup, ModalHeader, ModalBody, ModalActions, Button, LoadingDots, useLocalStorage, TinaCMS, BranchSwitcherPlugin, BranchDataProvider, TinaProvider, TinaMediaStore, DummyMediaStore, Nav, LocalWarning, BillingWarning, Select, OverflowMenu, CursorPaginator, PopupModal, BaseTextField, wrapFieldsWithMeta, FormStatus, FormBuilder } from "@tinacms/toolkit";
|
|
1
|
+
import { useCMS, Form, GlobalFormPlugin, EventBus, Modal, ModalPopup, ModalHeader, ModalBody, ModalActions, Button, LoadingDots, useLocalStorage, TinaCMS, BranchSwitcherPlugin, BranchDataProvider, TinaProvider, TinaMediaStore, DummyMediaStore, Nav, LocalWarning, BillingWarning, Select, Input, ReactDateTimeWithStyles, textFieldClasses, Toggle, OverflowMenu, CursorPaginator, PopupModal, BaseTextField, wrapFieldsWithMeta, FormStatus, FormBuilder } from "@tinacms/toolkit";
|
|
2
2
|
export * from "@tinacms/toolkit";
|
|
3
3
|
export { MdxFieldPluginExtendible } from "@tinacms/toolkit";
|
|
4
4
|
import * as G from "graphql";
|
|
@@ -6,12 +6,11 @@ import { TypeInfo, visit, visitWithTypeInfo, getNamedType, GraphQLObjectType, is
|
|
|
6
6
|
import set from "lodash.set";
|
|
7
7
|
import React, { useState, useCallback, useEffect, Fragment, useMemo } from "react";
|
|
8
8
|
import { getIn, setIn } from "final-form";
|
|
9
|
-
import { resolveForm, TinaSchema, addNamespaceToSchema, validateSchema } from "@tinacms/schema-tools";
|
|
9
|
+
import { resolveForm, TinaSchema, addNamespaceToSchema, parseURL, validateSchema } from "@tinacms/schema-tools";
|
|
10
10
|
export { NAMER, resolveForm } from "@tinacms/schema-tools";
|
|
11
11
|
import gql$1 from "graphql-tag";
|
|
12
12
|
import * as yup from "yup";
|
|
13
13
|
import { setEditing, TinaDataContext, EditContext, useEditState } from "@tinacms/sharedctx";
|
|
14
|
-
import UrlPattern from "url-pattern";
|
|
15
14
|
import { NavLink, useSearchParams, useNavigate, useParams, useLocation, Link, HashRouter, Routes, Route } from "react-router-dom";
|
|
16
15
|
import { Transition, Menu } from "@headlessui/react";
|
|
17
16
|
import { useWindowWidth } from "@react-hook/window-size";
|
|
@@ -2117,7 +2116,7 @@ const parseRefForBranchName = (ref) => {
|
|
|
2117
2116
|
};
|
|
2118
2117
|
class Client {
|
|
2119
2118
|
constructor({ tokenStorage = "MEMORY", ...options }) {
|
|
2120
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
2119
|
+
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;
|
|
2121
2120
|
this.events = new EventBus();
|
|
2122
2121
|
this.addPendingContent = async (props) => {
|
|
2123
2122
|
const mutation = `#graphql
|
|
@@ -2167,6 +2166,15 @@ mutation addPendingDocumentMutation(
|
|
|
2167
2166
|
};
|
|
2168
2167
|
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;
|
|
2169
2168
|
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;
|
|
2169
|
+
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) {
|
|
2170
|
+
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;
|
|
2171
|
+
}
|
|
2172
|
+
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) {
|
|
2173
|
+
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;
|
|
2174
|
+
}
|
|
2175
|
+
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) {
|
|
2176
|
+
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;
|
|
2177
|
+
}
|
|
2170
2178
|
if (options.schema) {
|
|
2171
2179
|
const enrichedSchema = new TinaSchema({
|
|
2172
2180
|
version: { fullVersion: "", major: "", minor: "", patch: "" },
|
|
@@ -2176,6 +2184,9 @@ mutation addPendingDocumentMutation(
|
|
|
2176
2184
|
this.schema = enrichedSchema;
|
|
2177
2185
|
}
|
|
2178
2186
|
this.options = options;
|
|
2187
|
+
if ((_H = (_G = options.schema) == null ? void 0 : _G.config) == null ? void 0 : _H.contentApiUrlOverride) {
|
|
2188
|
+
this.options.customContentApiUrl = options.schema.config.contentApiUrlOverride;
|
|
2189
|
+
}
|
|
2179
2190
|
this.setBranch(options.branch);
|
|
2180
2191
|
this.events.subscribe("branch:change", ({ branchName }) => {
|
|
2181
2192
|
this.setBranch(branchName);
|
|
@@ -2222,6 +2233,9 @@ mutation addPendingDocumentMutation(
|
|
|
2222
2233
|
this.getToken = options.getTokenFn;
|
|
2223
2234
|
break;
|
|
2224
2235
|
}
|
|
2236
|
+
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) {
|
|
2237
|
+
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;
|
|
2238
|
+
}
|
|
2225
2239
|
}
|
|
2226
2240
|
get isLocalMode() {
|
|
2227
2241
|
return false;
|
|
@@ -2466,10 +2480,7 @@ class LocalClient extends Client {
|
|
|
2466
2480
|
localStorage.setItem(LOCAL_CLIENT_KEY, "true");
|
|
2467
2481
|
return { access_token: "LOCAL", id_token: "LOCAL", refresh_token: "LOCAL" };
|
|
2468
2482
|
}
|
|
2469
|
-
async
|
|
2470
|
-
return localStorage.getItem(LOCAL_CLIENT_KEY) === "true";
|
|
2471
|
-
}
|
|
2472
|
-
async isAuthenticated() {
|
|
2483
|
+
async getUser() {
|
|
2473
2484
|
return localStorage.getItem(LOCAL_CLIENT_KEY) === "true";
|
|
2474
2485
|
}
|
|
2475
2486
|
}
|
|
@@ -2550,17 +2561,50 @@ class TinaAdminApi {
|
|
|
2550
2561
|
}
|
|
2551
2562
|
}`, { variables: { collection, relativePath } });
|
|
2552
2563
|
}
|
|
2553
|
-
async fetchCollection(collectionName, includeDocuments, after, sortKey, order) {
|
|
2564
|
+
async fetchCollection(collectionName, includeDocuments, after, sortKey, order, filterArgs) {
|
|
2565
|
+
let filter = null;
|
|
2566
|
+
const filterField = filterArgs == null ? void 0 : filterArgs.filterField;
|
|
2567
|
+
if (filterField) {
|
|
2568
|
+
filter = {
|
|
2569
|
+
[collectionName]: {
|
|
2570
|
+
[filterField]: {}
|
|
2571
|
+
}
|
|
2572
|
+
};
|
|
2573
|
+
}
|
|
2574
|
+
if (filterField && (filterArgs == null ? void 0 : filterArgs.startsWith)) {
|
|
2575
|
+
filter[collectionName][filterField] = {
|
|
2576
|
+
...filter[collectionName][filterField] || {},
|
|
2577
|
+
startsWith: filterArgs.startsWith
|
|
2578
|
+
};
|
|
2579
|
+
}
|
|
2580
|
+
if (filterField && (filterArgs == null ? void 0 : filterArgs.before)) {
|
|
2581
|
+
filter[collectionName][filterField] = {
|
|
2582
|
+
...filter[collectionName][filterField] || {},
|
|
2583
|
+
before: filterArgs.before
|
|
2584
|
+
};
|
|
2585
|
+
}
|
|
2586
|
+
if (filterField && (filterArgs == null ? void 0 : filterArgs.after)) {
|
|
2587
|
+
filter[collectionName][filterField] = {
|
|
2588
|
+
...filter[collectionName][filterField] || {},
|
|
2589
|
+
after: filterArgs.after
|
|
2590
|
+
};
|
|
2591
|
+
}
|
|
2592
|
+
if (filterField && (filterArgs == null ? void 0 : filterArgs.booleanEquals) !== null && (filterArgs == null ? void 0 : filterArgs.booleanEquals) !== void 0) {
|
|
2593
|
+
filter[collectionName][filterField] = {
|
|
2594
|
+
...filter[collectionName][filterField] || {},
|
|
2595
|
+
eq: filterArgs.booleanEquals
|
|
2596
|
+
};
|
|
2597
|
+
}
|
|
2554
2598
|
if (includeDocuments === true) {
|
|
2555
2599
|
const sort = sortKey || this.schema.getIsTitleFieldName(collectionName);
|
|
2556
2600
|
const response = order === "asc" ? await this.api.request(`#graphql
|
|
2557
|
-
query($collection: String!, $includeDocuments: Boolean!, $sort: String, $limit: Float, $after: String){
|
|
2601
|
+
query($collection: String!, $includeDocuments: Boolean!, $sort: String, $limit: Float, $after: String, $filter: DocumentFilter){
|
|
2558
2602
|
collection(collection: $collection){
|
|
2559
2603
|
name
|
|
2560
2604
|
label
|
|
2561
2605
|
format
|
|
2562
2606
|
templates
|
|
2563
|
-
documents(sort: $sort, after: $after, first: $limit) @include(if: $includeDocuments) {
|
|
2607
|
+
documents(sort: $sort, after: $after, first: $limit, filter: $filter) @include(if: $includeDocuments) {
|
|
2564
2608
|
totalCount
|
|
2565
2609
|
pageInfo {
|
|
2566
2610
|
hasPreviousPage
|
|
@@ -2592,16 +2636,17 @@ class TinaAdminApi {
|
|
|
2592
2636
|
includeDocuments,
|
|
2593
2637
|
sort,
|
|
2594
2638
|
limit: 50,
|
|
2595
|
-
after
|
|
2639
|
+
after,
|
|
2640
|
+
filter
|
|
2596
2641
|
}
|
|
2597
2642
|
}) : await this.api.request(`#graphql
|
|
2598
|
-
query($collection: String!, $includeDocuments: Boolean!, $sort: String, $limit: Float, $after: String){
|
|
2643
|
+
query($collection: String!, $includeDocuments: Boolean!, $sort: String, $limit: Float, $after: String, $filter: DocumentFilter){
|
|
2599
2644
|
collection(collection: $collection){
|
|
2600
2645
|
name
|
|
2601
2646
|
label
|
|
2602
2647
|
format
|
|
2603
2648
|
templates
|
|
2604
|
-
documents(sort: $sort, before: $after, last: $limit) @include(if: $includeDocuments) {
|
|
2649
|
+
documents(sort: $sort, before: $after, last: $limit, filter: $filter) @include(if: $includeDocuments) {
|
|
2605
2650
|
totalCount
|
|
2606
2651
|
pageInfo {
|
|
2607
2652
|
hasPreviousPage
|
|
@@ -2633,7 +2678,8 @@ class TinaAdminApi {
|
|
|
2633
2678
|
includeDocuments,
|
|
2634
2679
|
sort,
|
|
2635
2680
|
limit: 50,
|
|
2636
|
-
after
|
|
2681
|
+
after,
|
|
2682
|
+
filter
|
|
2637
2683
|
}
|
|
2638
2684
|
});
|
|
2639
2685
|
return response.collection;
|
|
@@ -2702,8 +2748,9 @@ const AuthWallInner = ({
|
|
|
2702
2748
|
loginScreen,
|
|
2703
2749
|
getModalActions
|
|
2704
2750
|
}) => {
|
|
2751
|
+
var _a, _b, _c, _d, _e;
|
|
2705
2752
|
const client = cms.api.tina;
|
|
2706
|
-
const
|
|
2753
|
+
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);
|
|
2707
2754
|
const [activeModal, setActiveModal] = useState(null);
|
|
2708
2755
|
const [showChildren, setShowChildren] = useState(false);
|
|
2709
2756
|
React.useEffect(() => {
|
|
@@ -2732,8 +2779,8 @@ const AuthWallInner = ({
|
|
|
2732
2779
|
}
|
|
2733
2780
|
}) : [];
|
|
2734
2781
|
return /* @__PURE__ */ React.createElement(React.Fragment, null, activeModal === "authenticate" && /* @__PURE__ */ React.createElement(ModalBuilder, {
|
|
2735
|
-
title:
|
|
2736
|
-
message:
|
|
2782
|
+
title: isTinaCloud ? "Tina Cloud Authorization" : "Enter into edit mode",
|
|
2783
|
+
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.",
|
|
2737
2784
|
close,
|
|
2738
2785
|
actions: [
|
|
2739
2786
|
...otherModalActions,
|
|
@@ -2746,7 +2793,7 @@ const AuthWallInner = ({
|
|
|
2746
2793
|
primary: false
|
|
2747
2794
|
},
|
|
2748
2795
|
{
|
|
2749
|
-
name:
|
|
2796
|
+
name: isTinaCloud ? "Continue to Tina Cloud" : "Enter Edit Mode",
|
|
2750
2797
|
action: async () => {
|
|
2751
2798
|
const token = await client.authenticate();
|
|
2752
2799
|
if (typeof (client == null ? void 0 : client.onLogin) === "function") {
|
|
@@ -3249,6 +3296,9 @@ var styles = `.tina-tailwind {
|
|
|
3249
3296
|
.tina-tailwind .mt-2 {
|
|
3250
3297
|
margin-top: 8px;
|
|
3251
3298
|
}
|
|
3299
|
+
.tina-tailwind .ml-1\\.5 {
|
|
3300
|
+
margin-left: 6px;
|
|
3301
|
+
}
|
|
3252
3302
|
.tina-tailwind .mb-4 {
|
|
3253
3303
|
margin-bottom: 16px;
|
|
3254
3304
|
}
|
|
@@ -3276,6 +3326,9 @@ var styles = `.tina-tailwind {
|
|
|
3276
3326
|
.tina-tailwind .table {
|
|
3277
3327
|
display: table;
|
|
3278
3328
|
}
|
|
3329
|
+
.tina-tailwind .grid {
|
|
3330
|
+
display: grid;
|
|
3331
|
+
}
|
|
3279
3332
|
.tina-tailwind .h-screen {
|
|
3280
3333
|
height: 100vh;
|
|
3281
3334
|
}
|
|
@@ -3386,9 +3439,18 @@ var styles = `.tina-tailwind {
|
|
|
3386
3439
|
.tina-tailwind .cursor-pointer {
|
|
3387
3440
|
cursor: pointer;
|
|
3388
3441
|
}
|
|
3442
|
+
.tina-tailwind .grid-flow-col {
|
|
3443
|
+
grid-auto-flow: column;
|
|
3444
|
+
}
|
|
3389
3445
|
.tina-tailwind .flex-col {
|
|
3390
3446
|
flex-direction: column;
|
|
3391
3447
|
}
|
|
3448
|
+
.tina-tailwind .flex-wrap {
|
|
3449
|
+
flex-wrap: wrap;
|
|
3450
|
+
}
|
|
3451
|
+
.tina-tailwind .items-start {
|
|
3452
|
+
align-items: flex-start;
|
|
3453
|
+
}
|
|
3392
3454
|
.tina-tailwind .items-end {
|
|
3393
3455
|
align-items: flex-end;
|
|
3394
3456
|
}
|
|
@@ -3431,6 +3493,12 @@ var styles = `.tina-tailwind {
|
|
|
3431
3493
|
--tw-divide-opacity: 1;
|
|
3432
3494
|
border-color: rgb(230 227 239 / var(--tw-divide-opacity));
|
|
3433
3495
|
}
|
|
3496
|
+
.tina-tailwind .self-end {
|
|
3497
|
+
align-self: flex-end;
|
|
3498
|
+
}
|
|
3499
|
+
.tina-tailwind .justify-self-end {
|
|
3500
|
+
justify-self: end;
|
|
3501
|
+
}
|
|
3434
3502
|
.tina-tailwind .overflow-hidden {
|
|
3435
3503
|
overflow: hidden;
|
|
3436
3504
|
}
|
|
@@ -3445,6 +3513,9 @@ var styles = `.tina-tailwind {
|
|
|
3445
3513
|
.tina-tailwind .whitespace-normal {
|
|
3446
3514
|
white-space: normal;
|
|
3447
3515
|
}
|
|
3516
|
+
.tina-tailwind .whitespace-nowrap {
|
|
3517
|
+
white-space: nowrap;
|
|
3518
|
+
}
|
|
3448
3519
|
.tina-tailwind .rounded-lg {
|
|
3449
3520
|
border-radius: 8px;
|
|
3450
3521
|
}
|
|
@@ -3498,6 +3569,11 @@ var styles = `.tina-tailwind {
|
|
|
3498
3569
|
--tw-gradient-to: rgb(29 44 108 / 0);
|
|
3499
3570
|
--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to);
|
|
3500
3571
|
}
|
|
3572
|
+
.tina-tailwind .from-gray-50\\/50 {
|
|
3573
|
+
--tw-gradient-from: rgb(246 246 249 / .5);
|
|
3574
|
+
--tw-gradient-to: rgb(246 246 249 / 0);
|
|
3575
|
+
--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to);
|
|
3576
|
+
}
|
|
3501
3577
|
.tina-tailwind .from-gray-800 {
|
|
3502
3578
|
--tw-gradient-from: #363145;
|
|
3503
3579
|
--tw-gradient-to: rgb(54 49 69 / 0);
|
|
@@ -3510,6 +3586,9 @@ var styles = `.tina-tailwind {
|
|
|
3510
3586
|
.tina-tailwind .to-gray-900 {
|
|
3511
3587
|
--tw-gradient-to: #252336;
|
|
3512
3588
|
}
|
|
3589
|
+
.tina-tailwind .to-gray-50 {
|
|
3590
|
+
--tw-gradient-to: #F6F6F9;
|
|
3591
|
+
}
|
|
3513
3592
|
.tina-tailwind .to-black {
|
|
3514
3593
|
--tw-gradient-to: #000;
|
|
3515
3594
|
}
|
|
@@ -3533,6 +3612,10 @@ var styles = `.tina-tailwind {
|
|
|
3533
3612
|
padding-left: 48px;
|
|
3534
3613
|
padding-right: 48px;
|
|
3535
3614
|
}
|
|
3615
|
+
.tina-tailwind .py-8 {
|
|
3616
|
+
padding-top: 32px;
|
|
3617
|
+
padding-bottom: 32px;
|
|
3618
|
+
}
|
|
3536
3619
|
.tina-tailwind .py-10 {
|
|
3537
3620
|
padding-top: 40px;
|
|
3538
3621
|
padding-bottom: 40px;
|
|
@@ -3564,11 +3647,8 @@ var styles = `.tina-tailwind {
|
|
|
3564
3647
|
.tina-tailwind .pt-4 {
|
|
3565
3648
|
padding-top: 16px;
|
|
3566
3649
|
}
|
|
3567
|
-
.tina-tailwind .
|
|
3568
|
-
padding-
|
|
3569
|
-
}
|
|
3570
|
-
.tina-tailwind .pt-16 {
|
|
3571
|
-
padding-top: 64px;
|
|
3650
|
+
.tina-tailwind .pt-12 {
|
|
3651
|
+
padding-top: 48px;
|
|
3572
3652
|
}
|
|
3573
3653
|
.tina-tailwind .pr-3 {
|
|
3574
3654
|
padding-right: 12px;
|
|
@@ -3582,9 +3662,6 @@ var styles = `.tina-tailwind {
|
|
|
3582
3662
|
.tina-tailwind .pl-5 {
|
|
3583
3663
|
padding-left: 20px;
|
|
3584
3664
|
}
|
|
3585
|
-
.tina-tailwind .pt-3 {
|
|
3586
|
-
padding-top: 12px;
|
|
3587
|
-
}
|
|
3588
3665
|
.tina-tailwind .pl-18 {
|
|
3589
3666
|
padding-left: 72px;
|
|
3590
3667
|
}
|
|
@@ -4076,26 +4153,6 @@ function useTina({
|
|
|
4076
4153
|
isLoading
|
|
4077
4154
|
};
|
|
4078
4155
|
}
|
|
4079
|
-
const parseURL = (url) => {
|
|
4080
|
-
if (url.includes("localhost")) {
|
|
4081
|
-
return { branch: null, isLocalClient: true, clientId: null };
|
|
4082
|
-
}
|
|
4083
|
-
const params = new URL(url);
|
|
4084
|
-
const pattern = new UrlPattern("/content/:clientId/github/*", {
|
|
4085
|
-
escapeChar: " "
|
|
4086
|
-
});
|
|
4087
|
-
const result = pattern.match(params.pathname);
|
|
4088
|
-
const branch = result == null ? void 0 : result._;
|
|
4089
|
-
const clientId = result == null ? void 0 : result.clientId;
|
|
4090
|
-
if (!branch || !clientId) {
|
|
4091
|
-
throw new Error(`Invalid URL format provided. Expected: https://content.tinajs.io/content/<ClientID>/github/<Branch> but but received ${url}`);
|
|
4092
|
-
}
|
|
4093
|
-
return {
|
|
4094
|
-
branch,
|
|
4095
|
-
clientId,
|
|
4096
|
-
isLocalClient: false
|
|
4097
|
-
};
|
|
4098
|
-
};
|
|
4099
4156
|
const errorButtonStyles = {
|
|
4100
4157
|
background: "#eb6337",
|
|
4101
4158
|
padding: "12px 18px",
|
|
@@ -4182,7 +4239,7 @@ const TinaCMSProvider2 = ({
|
|
|
4182
4239
|
schema,
|
|
4183
4240
|
...props
|
|
4184
4241
|
}) => {
|
|
4185
|
-
var _a;
|
|
4242
|
+
var _a, _b, _c, _d, _e;
|
|
4186
4243
|
React.useEffect(() => {
|
|
4187
4244
|
console.warn(`
|
|
4188
4245
|
* Tina no longer requires wrapping your site in the TinaProvider
|
|
@@ -4193,12 +4250,13 @@ const TinaCMSProvider2 = ({
|
|
|
4193
4250
|
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");
|
|
4194
4251
|
}
|
|
4195
4252
|
const apiURL = ((_a = props == null ? void 0 : props.client) == null ? void 0 : _a.apiUrl) || (props == null ? void 0 : props.apiURL);
|
|
4253
|
+
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;
|
|
4196
4254
|
const { branch, clientId, isLocalClient } = apiURL ? parseURL(apiURL) : {
|
|
4197
4255
|
branch: props.branch,
|
|
4198
4256
|
clientId: props.clientId,
|
|
4199
4257
|
isLocalClient: props == null ? void 0 : props.isLocalClient
|
|
4200
4258
|
};
|
|
4201
|
-
if (typeof isLocalClient === "undefined" || !isLocalClient && (!branch || !clientId)) {
|
|
4259
|
+
if (typeof isLocalClient === "undefined" || !isLocalClient && (!branch || !clientId) && !schema.config.contentApiUrlOverride) {
|
|
4202
4260
|
throw new Error("Invalid setup. See https://tina.io/docs/tina-cloud/connecting-site/ for more information.");
|
|
4203
4261
|
}
|
|
4204
4262
|
if (!schema) {
|
|
@@ -4206,9 +4264,9 @@ const TinaCMSProvider2 = ({
|
|
|
4206
4264
|
}
|
|
4207
4265
|
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(TinaCloudProvider, {
|
|
4208
4266
|
branch,
|
|
4209
|
-
clientId,
|
|
4267
|
+
clientId: clientId || ((_e = schema == null ? void 0 : schema.config) == null ? void 0 : _e.clientId),
|
|
4210
4268
|
tinaioConfig: props.tinaioConfig,
|
|
4211
|
-
isLocalClient,
|
|
4269
|
+
isLocalClient: isLocalOverride || isLocalClient,
|
|
4212
4270
|
cmsCallback: props.cmsCallback,
|
|
4213
4271
|
mediaStore: props.mediaStore,
|
|
4214
4272
|
apiUrl: apiURL,
|
|
@@ -4552,9 +4610,15 @@ function BiPlus(props) {
|
|
|
4552
4610
|
function BiRename(props) {
|
|
4553
4611
|
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);
|
|
4554
4612
|
}
|
|
4613
|
+
function BiSearch(props) {
|
|
4614
|
+
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);
|
|
4615
|
+
}
|
|
4555
4616
|
function BiTrash(props) {
|
|
4556
4617
|
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);
|
|
4557
4618
|
}
|
|
4619
|
+
function BiX(props) {
|
|
4620
|
+
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);
|
|
4621
|
+
}
|
|
4558
4622
|
const slugify = (text) => {
|
|
4559
4623
|
return text.toString().toLowerCase().trim().replace(/[^\w\s-]/g, "").replace(/[\s_-]+/g, "_").replace(/^-+|-+$/g, "");
|
|
4560
4624
|
};
|
|
@@ -4813,14 +4877,14 @@ const PageWrapper = ({
|
|
|
4813
4877
|
children
|
|
4814
4878
|
}) => {
|
|
4815
4879
|
return /* @__PURE__ */ React.createElement("div", {
|
|
4816
|
-
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"
|
|
4880
|
+
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"
|
|
4817
4881
|
}, children);
|
|
4818
4882
|
};
|
|
4819
4883
|
const PageHeader = ({
|
|
4820
4884
|
isLocalMode,
|
|
4821
4885
|
children
|
|
4822
4886
|
}) => /* @__PURE__ */ React.createElement(React.Fragment, null, isLocalMode && /* @__PURE__ */ React.createElement(LocalWarning, null), !isLocalMode && /* @__PURE__ */ React.createElement(BillingWarning, null), /* @__PURE__ */ React.createElement("div", {
|
|
4823
|
-
className: "
|
|
4887
|
+
className: "pt-12 px-12"
|
|
4824
4888
|
}, /* @__PURE__ */ React.createElement("div", {
|
|
4825
4889
|
className: "w-full mx-auto max-w-screen-xl"
|
|
4826
4890
|
}, /* @__PURE__ */ React.createElement("div", {
|
|
@@ -4829,7 +4893,7 @@ const PageHeader = ({
|
|
|
4829
4893
|
const PageBody = ({
|
|
4830
4894
|
children
|
|
4831
4895
|
}) => /* @__PURE__ */ React.createElement("div", {
|
|
4832
|
-
className: "py-
|
|
4896
|
+
className: "py-8 px-12"
|
|
4833
4897
|
}, children);
|
|
4834
4898
|
const PageBodyNarrow = ({
|
|
4835
4899
|
children
|
|
@@ -4947,7 +5011,7 @@ const LoadingPage = () => /* @__PURE__ */ React.createElement(React.Fragment, nu
|
|
|
4947
5011
|
fontWeight: "normal"
|
|
4948
5012
|
}
|
|
4949
5013
|
}, "Please wait, Tina is loading data..."))));
|
|
4950
|
-
const useGetCollection = (cms, collectionName, includeDocuments = true, after = "", sortKey) => {
|
|
5014
|
+
const useGetCollection = (cms, collectionName, includeDocuments = true, after = "", sortKey, filterArgs) => {
|
|
4951
5015
|
const api = new TinaAdminApi(cms);
|
|
4952
5016
|
const schema = cms.api.tina.schema;
|
|
4953
5017
|
const collectionExtra = schema.getCollection(collectionName);
|
|
@@ -4962,7 +5026,7 @@ const useGetCollection = (cms, collectionName, includeDocuments = true, after =
|
|
|
4962
5026
|
const { name, order } = JSON.parse(sortKey || "{}");
|
|
4963
5027
|
const validSortKey = ((_a = collectionExtra.fields) == null ? void 0 : _a.map((x) => x.name).includes(name)) ? name : void 0;
|
|
4964
5028
|
try {
|
|
4965
|
-
const collection2 = await api.fetchCollection(collectionName, includeDocuments, after, validSortKey, order);
|
|
5029
|
+
const collection2 = await api.fetchCollection(collectionName, includeDocuments, after, validSortKey, order, filterArgs);
|
|
4966
5030
|
setCollection(collection2);
|
|
4967
5031
|
} catch (error2) {
|
|
4968
5032
|
cms.alerts.error(`[${error2.name}] GetCollection failed: ${error2.message}`);
|
|
@@ -4985,9 +5049,10 @@ const GetCollection = ({
|
|
|
4985
5049
|
includeDocuments = true,
|
|
4986
5050
|
startCursor,
|
|
4987
5051
|
sortKey,
|
|
4988
|
-
children
|
|
5052
|
+
children,
|
|
5053
|
+
filterArgs
|
|
4989
5054
|
}) => {
|
|
4990
|
-
const { collection, loading, error, reFetchCollection, collectionExtra } = useGetCollection(cms, collectionName, includeDocuments, startCursor || "", sortKey) || {};
|
|
5055
|
+
const { collection, loading, error, reFetchCollection, collectionExtra } = useGetCollection(cms, collectionName, includeDocuments, startCursor || "", sortKey, filterArgs) || {};
|
|
4991
5056
|
if (error) {
|
|
4992
5057
|
return null;
|
|
4993
5058
|
}
|
|
@@ -5052,7 +5117,13 @@ const CollectionListPage = () => {
|
|
|
5052
5117
|
const [vars, setVars] = React.useState({
|
|
5053
5118
|
collection: collectionName,
|
|
5054
5119
|
relativePath: "",
|
|
5055
|
-
newRelativePath: ""
|
|
5120
|
+
newRelativePath: "",
|
|
5121
|
+
filterField: "",
|
|
5122
|
+
startsWith: "",
|
|
5123
|
+
endsWith: "",
|
|
5124
|
+
before: "",
|
|
5125
|
+
after: "",
|
|
5126
|
+
booleanEquals: null
|
|
5056
5127
|
});
|
|
5057
5128
|
const [endCursor, setEndCursor] = useState("");
|
|
5058
5129
|
const [prevCursors, setPrevCursors] = useState([]);
|
|
@@ -5070,23 +5141,55 @@ const CollectionListPage = () => {
|
|
|
5070
5141
|
setEndCursor("");
|
|
5071
5142
|
setPrevCursors([]);
|
|
5072
5143
|
}, [loc]);
|
|
5144
|
+
useEffect(() => {
|
|
5145
|
+
setVars((old) => ({
|
|
5146
|
+
...old,
|
|
5147
|
+
collection: collectionName,
|
|
5148
|
+
relativePath: "",
|
|
5149
|
+
newRelativePath: "",
|
|
5150
|
+
filterField: "",
|
|
5151
|
+
startsWith: "",
|
|
5152
|
+
endsWith: "",
|
|
5153
|
+
before: "",
|
|
5154
|
+
after: "",
|
|
5155
|
+
booleanEquals: null
|
|
5156
|
+
}));
|
|
5157
|
+
}, [collectionName]);
|
|
5073
5158
|
return /* @__PURE__ */ React.createElement(GetCMS, null, (cms) => {
|
|
5074
5159
|
return /* @__PURE__ */ React.createElement(GetCollection, {
|
|
5075
5160
|
cms,
|
|
5076
5161
|
collectionName,
|
|
5077
5162
|
includeDocuments: true,
|
|
5078
5163
|
startCursor: endCursor,
|
|
5079
|
-
sortKey
|
|
5164
|
+
sortKey,
|
|
5165
|
+
filterArgs: collectionName === vars.collection ? vars : {
|
|
5166
|
+
collection: collectionName,
|
|
5167
|
+
relativePath: "",
|
|
5168
|
+
newRelativePath: "",
|
|
5169
|
+
filterField: "",
|
|
5170
|
+
startsWith: "",
|
|
5171
|
+
endsWith: "",
|
|
5172
|
+
before: "",
|
|
5173
|
+
after: "",
|
|
5174
|
+
booleanEquals: null
|
|
5175
|
+
}
|
|
5080
5176
|
}, (collection, _loading, reFetchCollection, collectionExtra) => {
|
|
5081
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
5177
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
5082
5178
|
const totalCount = collection.documents.totalCount;
|
|
5083
5179
|
const documents = collection.documents.edges;
|
|
5084
5180
|
const admin = cms.api.admin;
|
|
5085
5181
|
const pageInfo = collection.documents.pageInfo;
|
|
5086
5182
|
const fields = (_a = collectionExtra.fields) == null ? void 0 : _a.filter((x) => ["string", "number", "datetime", "boolean"].includes(x.type));
|
|
5183
|
+
const filterFields = (_b = collectionExtra.fields) == null ? void 0 : _b.filter((x) => {
|
|
5184
|
+
return ["string", "datetime", "boolean"].includes(x.type) && !x.list;
|
|
5185
|
+
});
|
|
5186
|
+
const filterField = filterFields == null ? void 0 : filterFields.find((x) => x.name === vars.filterField);
|
|
5187
|
+
const showStartsWith = (filterField == null ? void 0 : filterField.type) === "string" && !filterField.list;
|
|
5188
|
+
const showDateFilter = (filterField == null ? void 0 : filterField.type) === "datetime";
|
|
5189
|
+
const showBooleanToggle = (filterField == null ? void 0 : filterField.type) === "boolean" && !filterField.list;
|
|
5087
5190
|
const collectionDefinition = cms.api.tina.schema.getCollection(collection.name);
|
|
5088
|
-
const allowCreate = (
|
|
5089
|
-
const allowDelete = (
|
|
5191
|
+
const allowCreate = (_e = (_d = (_c = collectionDefinition == null ? void 0 : collectionDefinition.ui) == null ? void 0 : _c.allowedActions) == null ? void 0 : _d.create) != null ? _e : true;
|
|
5192
|
+
const allowDelete = (_h = (_g = (_f = collectionDefinition == null ? void 0 : collectionDefinition.ui) == null ? void 0 : _f.allowedActions) == null ? void 0 : _g.delete) != null ? _h : true;
|
|
5090
5193
|
return /* @__PURE__ */ React.createElement(PageWrapper, null, /* @__PURE__ */ React.createElement(React.Fragment, null, deleteModalOpen && /* @__PURE__ */ React.createElement(DeleteModal, {
|
|
5091
5194
|
filename: vars.relativePath,
|
|
5092
5195
|
deleteFunc: async () => {
|
|
@@ -5127,13 +5230,17 @@ const CollectionListPage = () => {
|
|
|
5127
5230
|
},
|
|
5128
5231
|
close: () => setRenameModalOpen(false)
|
|
5129
5232
|
}), /* @__PURE__ */ React.createElement(PageHeader, {
|
|
5130
|
-
isLocalMode: (
|
|
5131
|
-
}, /* @__PURE__ */ React.createElement(
|
|
5233
|
+
isLocalMode: (_j = (_i = cms == null ? void 0 : cms.api) == null ? void 0 : _i.tina) == null ? void 0 : _j.isLocalMode
|
|
5234
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
5235
|
+
className: "w-full grid grid-flow-col items-end gap-4"
|
|
5236
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
5132
5237
|
className: "flex flex-col gap-4"
|
|
5133
5238
|
}, /* @__PURE__ */ React.createElement("h3", {
|
|
5134
5239
|
className: "font-sans text-2xl text-gray-700"
|
|
5135
5240
|
}, collection.label ? collection.label : collection.name), (fields == null ? void 0 : fields.length) > 0 && /* @__PURE__ */ React.createElement("div", {
|
|
5136
|
-
className: "flex gap-
|
|
5241
|
+
className: "flex gap-4 items-end flex-wrap"
|
|
5242
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
5243
|
+
className: "flex flex-col gap-2 items-start"
|
|
5137
5244
|
}, /* @__PURE__ */ React.createElement("label", {
|
|
5138
5245
|
htmlFor: "sort",
|
|
5139
5246
|
className: "block font-sans text-xs font-semibold text-gray-500 whitespace-normal"
|
|
@@ -5149,14 +5256,14 @@ const CollectionListPage = () => {
|
|
|
5149
5256
|
},
|
|
5150
5257
|
...fields.map((x) => [
|
|
5151
5258
|
{
|
|
5152
|
-
label: (x.label || x.name) + " (Ascending)",
|
|
5259
|
+
label: (x.label || x.name) + (x.type === "datetime" ? " (Oldest First)" : " (Ascending)"),
|
|
5153
5260
|
value: JSON.stringify({
|
|
5154
5261
|
name: x.name,
|
|
5155
5262
|
order: "asc"
|
|
5156
5263
|
})
|
|
5157
5264
|
},
|
|
5158
5265
|
{
|
|
5159
|
-
label: (x.label || x.name) + " (Descending)",
|
|
5266
|
+
label: (x.label || x.name) + (x.type === "datetime" ? " (Newest First)" : " (Descending)"),
|
|
5160
5267
|
value: JSON.stringify({
|
|
5161
5268
|
name: x.name,
|
|
5162
5269
|
order: "desc"
|
|
@@ -5177,14 +5284,154 @@ const CollectionListPage = () => {
|
|
|
5177
5284
|
setSortOrder(val.order);
|
|
5178
5285
|
}
|
|
5179
5286
|
}
|
|
5180
|
-
}))
|
|
5287
|
+
})), /* @__PURE__ */ React.createElement("div", {
|
|
5288
|
+
className: "flex flex-wrap gap-4 items-end"
|
|
5289
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
5290
|
+
className: "flex flex-shrink-0 flex-col gap-2 items-start"
|
|
5291
|
+
}, /* @__PURE__ */ React.createElement("label", {
|
|
5292
|
+
htmlFor: "filter",
|
|
5293
|
+
className: "block font-sans text-xs font-semibold text-gray-500 whitespace-normal"
|
|
5294
|
+
}, "Filter by"), /* @__PURE__ */ React.createElement(Select, {
|
|
5295
|
+
name: "filter",
|
|
5296
|
+
options: [
|
|
5297
|
+
{
|
|
5298
|
+
label: "None",
|
|
5299
|
+
value: ""
|
|
5300
|
+
},
|
|
5301
|
+
...filterFields.map((x) => ({
|
|
5302
|
+
label: x.label || x.name,
|
|
5303
|
+
value: x.name
|
|
5304
|
+
}))
|
|
5305
|
+
],
|
|
5306
|
+
input: {
|
|
5307
|
+
id: "filter",
|
|
5308
|
+
name: "filter",
|
|
5309
|
+
value: vars.filterField,
|
|
5310
|
+
onChange: (e) => {
|
|
5311
|
+
const val = e.target.value;
|
|
5312
|
+
setEndCursor("");
|
|
5313
|
+
setPrevCursors([]);
|
|
5314
|
+
setVars((old) => ({
|
|
5315
|
+
...old,
|
|
5316
|
+
filterField: val
|
|
5317
|
+
}));
|
|
5318
|
+
}
|
|
5319
|
+
}
|
|
5320
|
+
})), showStartsWith && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", {
|
|
5321
|
+
className: "flex flex-shrink-0 flex-col gap-2 items-start"
|
|
5322
|
+
}, /* @__PURE__ */ React.createElement("label", {
|
|
5323
|
+
htmlFor: "startsWith",
|
|
5324
|
+
className: "block font-sans text-xs font-semibold text-gray-500 whitespace-normal"
|
|
5325
|
+
}, "Starts with"), /* @__PURE__ */ React.createElement(Input, {
|
|
5326
|
+
name: "startsWith",
|
|
5327
|
+
id: "startsWith",
|
|
5328
|
+
value: vars.startsWith,
|
|
5329
|
+
onChange: (e) => {
|
|
5330
|
+
const val = e.target.value;
|
|
5331
|
+
setVars((old) => ({
|
|
5332
|
+
...old,
|
|
5333
|
+
startsWith: val,
|
|
5334
|
+
after: "",
|
|
5335
|
+
before: "",
|
|
5336
|
+
booleanEquals: null
|
|
5337
|
+
}));
|
|
5338
|
+
}
|
|
5339
|
+
}))), showDateFilter && /* @__PURE__ */ React.createElement("div", {
|
|
5340
|
+
className: "flex flex-shrink-0 gap-4"
|
|
5341
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
5342
|
+
className: "flex flex-col gap-2 items-start"
|
|
5343
|
+
}, /* @__PURE__ */ React.createElement("label", {
|
|
5344
|
+
htmlFor: "dateAfter",
|
|
5345
|
+
className: "block font-sans text-xs font-semibold text-gray-500 whitespace-normal"
|
|
5346
|
+
}, "After"), /* @__PURE__ */ React.createElement(ReactDateTimeWithStyles, {
|
|
5347
|
+
inputProps: {
|
|
5348
|
+
className: textFieldClasses
|
|
5349
|
+
},
|
|
5350
|
+
value: vars.after,
|
|
5351
|
+
onChange: (e) => {
|
|
5352
|
+
setVars((old) => ({
|
|
5353
|
+
...old,
|
|
5354
|
+
after: e.format(),
|
|
5355
|
+
booleanEquals: null,
|
|
5356
|
+
startsWith: ""
|
|
5357
|
+
}));
|
|
5358
|
+
}
|
|
5359
|
+
})), /* @__PURE__ */ React.createElement("div", {
|
|
5360
|
+
className: "flex flex-col gap-2 items-start"
|
|
5361
|
+
}, /* @__PURE__ */ React.createElement("label", {
|
|
5362
|
+
htmlFor: "dateBefore",
|
|
5363
|
+
className: "block font-sans text-xs font-semibold text-gray-500 whitespace-normal"
|
|
5364
|
+
}, "Before"), /* @__PURE__ */ React.createElement(ReactDateTimeWithStyles, {
|
|
5365
|
+
inputProps: {
|
|
5366
|
+
className: textFieldClasses
|
|
5367
|
+
},
|
|
5368
|
+
value: vars.before,
|
|
5369
|
+
onChange: (e) => {
|
|
5370
|
+
setVars((old) => ({
|
|
5371
|
+
...old,
|
|
5372
|
+
before: e.format(),
|
|
5373
|
+
booleanEquals: null,
|
|
5374
|
+
startsWith: ""
|
|
5375
|
+
}));
|
|
5376
|
+
}
|
|
5377
|
+
}))), showBooleanToggle && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", {
|
|
5378
|
+
className: "flex flex-col gap-2 items-start"
|
|
5379
|
+
}, /* @__PURE__ */ React.createElement("label", {
|
|
5380
|
+
htmlFor: "toggle",
|
|
5381
|
+
className: "block font-sans text-xs font-semibold text-gray-500 whitespace-normal"
|
|
5382
|
+
}, filterField.label || filterField.name), /* @__PURE__ */ React.createElement(Toggle, {
|
|
5383
|
+
field: filterField,
|
|
5384
|
+
input: {
|
|
5385
|
+
name: "toggle",
|
|
5386
|
+
value: (_k = vars.booleanEquals) != null ? _k : false,
|
|
5387
|
+
onChange: () => {
|
|
5388
|
+
setVars((old) => ({
|
|
5389
|
+
...old,
|
|
5390
|
+
booleanEquals: !old.booleanEquals,
|
|
5391
|
+
after: "",
|
|
5392
|
+
before: "",
|
|
5393
|
+
startsWith: ""
|
|
5394
|
+
}));
|
|
5395
|
+
}
|
|
5396
|
+
},
|
|
5397
|
+
name: "toggle"
|
|
5398
|
+
}))), (showStartsWith || showDateFilter || showBooleanToggle) && /* @__PURE__ */ React.createElement("div", {
|
|
5399
|
+
className: "flex gap-3"
|
|
5400
|
+
}, /* @__PURE__ */ React.createElement(Button, {
|
|
5401
|
+
onClick: () => {
|
|
5402
|
+
setEndCursor("");
|
|
5403
|
+
setPrevCursors([]);
|
|
5404
|
+
reFetchCollection();
|
|
5405
|
+
},
|
|
5406
|
+
variant: "primary"
|
|
5407
|
+
}, "Search", " ", /* @__PURE__ */ React.createElement(BiSearch, {
|
|
5408
|
+
className: "w-5 h-full ml-1.5 opacity-70"
|
|
5409
|
+
})), (vars.startsWith || vars.after || vars.before || vars.booleanEquals) && /* @__PURE__ */ React.createElement(Button, {
|
|
5410
|
+
onClick: () => {
|
|
5411
|
+
setVars((old) => ({
|
|
5412
|
+
...old,
|
|
5413
|
+
startsWith: "",
|
|
5414
|
+
after: "",
|
|
5415
|
+
before: "",
|
|
5416
|
+
booleanEquals: null
|
|
5417
|
+
}));
|
|
5418
|
+
setEndCursor("");
|
|
5419
|
+
setPrevCursors([]);
|
|
5420
|
+
reFetchCollection();
|
|
5421
|
+
},
|
|
5422
|
+
variant: "white"
|
|
5423
|
+
}, "Clear", " ", /* @__PURE__ */ React.createElement(BiX, {
|
|
5424
|
+
className: "w-5 h-full ml-1 opacity-70"
|
|
5425
|
+
})))))), /* @__PURE__ */ React.createElement("div", {
|
|
5426
|
+
className: "flex self-end justify-self-end"
|
|
5427
|
+
}, !collection.templates && allowCreate && /* @__PURE__ */ React.createElement(Link, {
|
|
5181
5428
|
to: `new`,
|
|
5182
|
-
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
|
|
5429
|
+
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"
|
|
5183
5430
|
}, "Create New", " ", /* @__PURE__ */ React.createElement(BiPlus, {
|
|
5184
5431
|
className: "w-5 h-full ml-1 opacity-70"
|
|
5185
5432
|
})), collection.templates && allowCreate && /* @__PURE__ */ React.createElement(TemplateMenu, {
|
|
5186
5433
|
templates: collection.templates
|
|
5187
|
-
}))), /* @__PURE__ */ React.createElement(PageBody, null, /* @__PURE__ */ React.createElement("div", {
|
|
5434
|
+
})))), /* @__PURE__ */ React.createElement(PageBody, null, /* @__PURE__ */ React.createElement("div", {
|
|
5188
5435
|
className: "w-full mx-auto max-w-screen-xl"
|
|
5189
5436
|
}, totalCount > 0 && /* @__PURE__ */ React.createElement("table", {
|
|
5190
5437
|
className: "table-auto shadow bg-white border-b border-gray-200 w-full max-w-full rounded-lg"
|
|
@@ -5256,11 +5503,12 @@ const CollectionListPage = () => {
|
|
|
5256
5503
|
className: "text-red-500"
|
|
5257
5504
|
}),
|
|
5258
5505
|
onMouseDown: () => {
|
|
5259
|
-
setVars({
|
|
5506
|
+
setVars((old) => ({
|
|
5507
|
+
...old,
|
|
5260
5508
|
collection: collectionName,
|
|
5261
5509
|
relativePath: document.node._sys.breadcrumbs.join("/") + document.node._sys.extension,
|
|
5262
5510
|
newRelativePath: ""
|
|
5263
|
-
});
|
|
5511
|
+
}));
|
|
5264
5512
|
setDeleteModalOpen(true);
|
|
5265
5513
|
}
|
|
5266
5514
|
},
|
|
@@ -5272,18 +5520,19 @@ const CollectionListPage = () => {
|
|
|
5272
5520
|
className: "text-red-500"
|
|
5273
5521
|
}),
|
|
5274
5522
|
onMouseDown: () => {
|
|
5275
|
-
setVars({
|
|
5523
|
+
setVars((old) => ({
|
|
5524
|
+
...old,
|
|
5276
5525
|
collection: collectionName,
|
|
5277
5526
|
relativePath: document.node._sys.breadcrumbs.join("/") + document.node._sys.extension,
|
|
5278
5527
|
newRelativePath: ""
|
|
5279
|
-
});
|
|
5528
|
+
}));
|
|
5280
5529
|
setRenameModalOpen(true);
|
|
5281
5530
|
}
|
|
5282
5531
|
}
|
|
5283
5532
|
].filter(Boolean)
|
|
5284
5533
|
})));
|
|
5285
5534
|
}))), /* @__PURE__ */ React.createElement("div", {
|
|
5286
|
-
className: "pt-
|
|
5535
|
+
className: "pt-4"
|
|
5287
5536
|
}, /* @__PURE__ */ React.createElement(CursorPaginator, {
|
|
5288
5537
|
variant: "white",
|
|
5289
5538
|
hasNext: sortOrder === "asc" ? pageInfo == null ? void 0 : pageInfo.hasNextPage : pageInfo.hasPreviousPage,
|