tinacms 0.69.3 → 0.69.6
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/hooks/use-graphql-forms.d.ts +4 -1
- package/dist/index.es.js +40 -18
- package/dist/index.js +40 -18
- package/dist/internalClient/index.d.ts +10 -0
- package/package.json +3 -3
|
@@ -33,7 +33,10 @@ export declare const transformDocumentIntoMutationRequestPayload: (document: {
|
|
|
33
33
|
includeCollection?: boolean;
|
|
34
34
|
includeTemplate?: boolean;
|
|
35
35
|
}) => any;
|
|
36
|
-
export declare const generateFormCreators: (cms: TinaCMS, showInSidebar?: boolean
|
|
36
|
+
export declare const generateFormCreators: (cms: TinaCMS, showInSidebar?: boolean, global?: boolean | {
|
|
37
|
+
icon?: any;
|
|
38
|
+
layout: 'fullscreen' | 'popup';
|
|
39
|
+
}) => {
|
|
37
40
|
createForm: (formConfig: any) => Form<any, import("@tinacms/toolkit").AnyField>;
|
|
38
41
|
createGlobalForm: GlobalFormCreator;
|
|
39
42
|
};
|
package/dist/index.es.js
CHANGED
|
@@ -436,11 +436,16 @@ const transformParams = (data) => {
|
|
|
436
436
|
}
|
|
437
437
|
}
|
|
438
438
|
};
|
|
439
|
-
const generateFormCreators = (cms, showInSidebar) => {
|
|
439
|
+
const generateFormCreators = (cms, showInSidebar, global) => {
|
|
440
440
|
const createForm = (formConfig) => {
|
|
441
441
|
const form = new Form(formConfig);
|
|
442
442
|
if (showInSidebar) {
|
|
443
|
-
|
|
443
|
+
if (global) {
|
|
444
|
+
const options = typeof global === "boolean" ? [null, "fullscreen"] : [global.icon, global.layout];
|
|
445
|
+
cms.plugins.add(new GlobalFormPlugin(form, ...options));
|
|
446
|
+
} else {
|
|
447
|
+
cms.forms.add(form);
|
|
448
|
+
}
|
|
444
449
|
}
|
|
445
450
|
return form;
|
|
446
451
|
};
|
|
@@ -520,7 +525,11 @@ const getPathToChange = (documentBlueprint, formNode, event) => {
|
|
|
520
525
|
return accum.join(".");
|
|
521
526
|
};
|
|
522
527
|
const buildForm = (doc, cms, formify2, showInSidebar = false, onSubmit) => {
|
|
523
|
-
|
|
528
|
+
var _a;
|
|
529
|
+
const id = doc._internalSys.path;
|
|
530
|
+
const enrichedSchema = cms.api.tina.schema;
|
|
531
|
+
const collection = enrichedSchema.getCollection(doc._internalSys.collection.name);
|
|
532
|
+
const { createForm, createGlobalForm } = generateFormCreators(cms, showInSidebar, (_a = collection.ui) == null ? void 0 : _a.global);
|
|
524
533
|
const SKIPPED = "SKIPPED";
|
|
525
534
|
let form;
|
|
526
535
|
let skipped;
|
|
@@ -529,9 +538,6 @@ const buildForm = (doc, cms, formify2, showInSidebar = false, onSubmit) => {
|
|
|
529
538
|
};
|
|
530
539
|
if (skipped)
|
|
531
540
|
return;
|
|
532
|
-
const id = doc._internalSys.path;
|
|
533
|
-
const enrichedSchema = cms.api.tina.schema;
|
|
534
|
-
const collection = enrichedSchema.getCollection(doc._internalSys.collection.name);
|
|
535
541
|
const template = enrichedSchema.getTemplateForData({
|
|
536
542
|
collection,
|
|
537
543
|
data: doc._values
|
|
@@ -964,14 +970,16 @@ function buildPath({
|
|
|
964
970
|
}
|
|
965
971
|
const node = G.parse(`
|
|
966
972
|
query Sample {
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
973
|
+
...on Document {
|
|
974
|
+
_internalSys: _sys {
|
|
975
|
+
path
|
|
976
|
+
relativePath
|
|
977
|
+
collection {
|
|
978
|
+
name
|
|
979
|
+
}
|
|
980
|
+
}
|
|
981
|
+
_values
|
|
982
|
+
}
|
|
975
983
|
}`);
|
|
976
984
|
const metaFields = node.definitions[0].selectionSet.selections;
|
|
977
985
|
const getRelativeBlueprint = (path) => {
|
|
@@ -2286,6 +2294,15 @@ mutation addPendingDocumentMutation(
|
|
|
2286
2294
|
const jsonRes = await res.json();
|
|
2287
2295
|
return jsonRes;
|
|
2288
2296
|
}
|
|
2297
|
+
async fetchEvents(limit, cursor) {
|
|
2298
|
+
if (this.isLocalMode) {
|
|
2299
|
+
return {
|
|
2300
|
+
events: []
|
|
2301
|
+
};
|
|
2302
|
+
} else {
|
|
2303
|
+
return (await this.fetchWithToken(`${this.contentApiBase}/events/${this.clientId}/${this.branch}?limit=${limit || 1}${cursor ? `&cursor=${cursor}` : ""}`, { method: "GET" })).json();
|
|
2304
|
+
}
|
|
2305
|
+
}
|
|
2289
2306
|
parseJwt(token) {
|
|
2290
2307
|
const base64Url = token.split(".")[1];
|
|
2291
2308
|
const base64 = base64Url.replace(/-/g, "+").replace(/_/g, "/");
|
|
@@ -4818,10 +4835,14 @@ const TemplateMenu = ({ templates }) => {
|
|
|
4818
4835
|
className: `w-full text-md px-4 py-2 tracking-wide flex items-center opacity-80 text-gray-600 ${active && "text-gray-800 opacity-100"}`
|
|
4819
4836
|
}, template.label))))))));
|
|
4820
4837
|
};
|
|
4821
|
-
const handleNavigate = (navigate, cms, collection, document) => {
|
|
4838
|
+
const handleNavigate = (navigate, cms, collection, collectionDefinition, document) => {
|
|
4839
|
+
var _a, _b;
|
|
4822
4840
|
const plugins = cms.plugins.all("tina-admin");
|
|
4823
4841
|
const routeMapping = plugins.find(({ name }) => name === "route-mapping");
|
|
4824
|
-
const routeOverride =
|
|
4842
|
+
const routeOverride = ((_a = collectionDefinition.ui) == null ? void 0 : _a.router) ? (_b = collectionDefinition.ui) == null ? void 0 : _b.router({
|
|
4843
|
+
document,
|
|
4844
|
+
collection: collectionDefinition
|
|
4845
|
+
}) : routeMapping ? routeMapping.mapper(collection, document) : void 0;
|
|
4825
4846
|
if (routeOverride) {
|
|
4826
4847
|
window.location.href = routeOverride;
|
|
4827
4848
|
return null;
|
|
@@ -4866,7 +4887,8 @@ const CollectionListPage = () => {
|
|
|
4866
4887
|
const documents = collection.documents.edges;
|
|
4867
4888
|
const admin = cms.api.admin;
|
|
4868
4889
|
const pageInfo = collection.documents.pageInfo;
|
|
4869
|
-
const fields = (_a = collectionExtra.fields) == null ? void 0 : _a.filter((x) => ["string", "number", "datetime"].includes(x.type));
|
|
4890
|
+
const fields = (_a = collectionExtra.fields) == null ? void 0 : _a.filter((x) => ["string", "number", "datetime", "boolean"].includes(x.type));
|
|
4891
|
+
const collectionDefinition = cms.api.tina.schema.getCollection(collection.name);
|
|
4870
4892
|
return /* @__PURE__ */ React.createElement(PageWrapper, null, /* @__PURE__ */ React.createElement(React.Fragment, null, open && /* @__PURE__ */ React.createElement(DeleteModal, {
|
|
4871
4893
|
filename: vars.relativePath,
|
|
4872
4894
|
deleteFunc: async () => {
|
|
@@ -4957,7 +4979,7 @@ const CollectionListPage = () => {
|
|
|
4957
4979
|
}, /* @__PURE__ */ React.createElement("a", {
|
|
4958
4980
|
className: "text-blue-600 hover:text-blue-400 flex items-center gap-3 cursor-pointer",
|
|
4959
4981
|
onClick: () => {
|
|
4960
|
-
handleNavigate(navigate, cms, collection, document.node);
|
|
4982
|
+
handleNavigate(navigate, cms, collection, collectionDefinition, document.node);
|
|
4961
4983
|
}
|
|
4962
4984
|
}, /* @__PURE__ */ React.createElement(BiEdit, {
|
|
4963
4985
|
className: "inline-block h-6 w-auto opacity-70"
|
package/dist/index.js
CHANGED
|
@@ -454,11 +454,16 @@
|
|
|
454
454
|
}
|
|
455
455
|
}
|
|
456
456
|
};
|
|
457
|
-
const generateFormCreators = (cms, showInSidebar) => {
|
|
457
|
+
const generateFormCreators = (cms, showInSidebar, global) => {
|
|
458
458
|
const createForm = (formConfig) => {
|
|
459
459
|
const form = new toolkit.Form(formConfig);
|
|
460
460
|
if (showInSidebar) {
|
|
461
|
-
|
|
461
|
+
if (global) {
|
|
462
|
+
const options = typeof global === "boolean" ? [null, "fullscreen"] : [global.icon, global.layout];
|
|
463
|
+
cms.plugins.add(new toolkit.GlobalFormPlugin(form, ...options));
|
|
464
|
+
} else {
|
|
465
|
+
cms.forms.add(form);
|
|
466
|
+
}
|
|
462
467
|
}
|
|
463
468
|
return form;
|
|
464
469
|
};
|
|
@@ -538,7 +543,11 @@
|
|
|
538
543
|
return accum.join(".");
|
|
539
544
|
};
|
|
540
545
|
const buildForm = (doc, cms, formify2, showInSidebar = false, onSubmit) => {
|
|
541
|
-
|
|
546
|
+
var _a;
|
|
547
|
+
const id = doc._internalSys.path;
|
|
548
|
+
const enrichedSchema = cms.api.tina.schema;
|
|
549
|
+
const collection = enrichedSchema.getCollection(doc._internalSys.collection.name);
|
|
550
|
+
const { createForm, createGlobalForm } = generateFormCreators(cms, showInSidebar, (_a = collection.ui) == null ? void 0 : _a.global);
|
|
542
551
|
const SKIPPED = "SKIPPED";
|
|
543
552
|
let form;
|
|
544
553
|
let skipped;
|
|
@@ -547,9 +556,6 @@
|
|
|
547
556
|
};
|
|
548
557
|
if (skipped)
|
|
549
558
|
return;
|
|
550
|
-
const id = doc._internalSys.path;
|
|
551
|
-
const enrichedSchema = cms.api.tina.schema;
|
|
552
|
-
const collection = enrichedSchema.getCollection(doc._internalSys.collection.name);
|
|
553
559
|
const template = enrichedSchema.getTemplateForData({
|
|
554
560
|
collection,
|
|
555
561
|
data: doc._values
|
|
@@ -982,14 +988,16 @@
|
|
|
982
988
|
}
|
|
983
989
|
const node = G__namespace.parse(`
|
|
984
990
|
query Sample {
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
991
|
+
...on Document {
|
|
992
|
+
_internalSys: _sys {
|
|
993
|
+
path
|
|
994
|
+
relativePath
|
|
995
|
+
collection {
|
|
996
|
+
name
|
|
997
|
+
}
|
|
998
|
+
}
|
|
999
|
+
_values
|
|
1000
|
+
}
|
|
993
1001
|
}`);
|
|
994
1002
|
const metaFields = node.definitions[0].selectionSet.selections;
|
|
995
1003
|
const getRelativeBlueprint = (path) => {
|
|
@@ -2304,6 +2312,15 @@ mutation addPendingDocumentMutation(
|
|
|
2304
2312
|
const jsonRes = await res.json();
|
|
2305
2313
|
return jsonRes;
|
|
2306
2314
|
}
|
|
2315
|
+
async fetchEvents(limit, cursor) {
|
|
2316
|
+
if (this.isLocalMode) {
|
|
2317
|
+
return {
|
|
2318
|
+
events: []
|
|
2319
|
+
};
|
|
2320
|
+
} else {
|
|
2321
|
+
return (await this.fetchWithToken(`${this.contentApiBase}/events/${this.clientId}/${this.branch}?limit=${limit || 1}${cursor ? `&cursor=${cursor}` : ""}`, { method: "GET" })).json();
|
|
2322
|
+
}
|
|
2323
|
+
}
|
|
2307
2324
|
parseJwt(token) {
|
|
2308
2325
|
const base64Url = token.split(".")[1];
|
|
2309
2326
|
const base64 = base64Url.replace(/-/g, "+").replace(/_/g, "/");
|
|
@@ -4836,10 +4853,14 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
4836
4853
|
className: `w-full text-md px-4 py-2 tracking-wide flex items-center opacity-80 text-gray-600 ${active && "text-gray-800 opacity-100"}`
|
|
4837
4854
|
}, template.label))))))));
|
|
4838
4855
|
};
|
|
4839
|
-
const handleNavigate = (navigate, cms, collection, document) => {
|
|
4856
|
+
const handleNavigate = (navigate, cms, collection, collectionDefinition, document) => {
|
|
4857
|
+
var _a, _b;
|
|
4840
4858
|
const plugins = cms.plugins.all("tina-admin");
|
|
4841
4859
|
const routeMapping = plugins.find(({ name }) => name === "route-mapping");
|
|
4842
|
-
const routeOverride =
|
|
4860
|
+
const routeOverride = ((_a = collectionDefinition.ui) == null ? void 0 : _a.router) ? (_b = collectionDefinition.ui) == null ? void 0 : _b.router({
|
|
4861
|
+
document,
|
|
4862
|
+
collection: collectionDefinition
|
|
4863
|
+
}) : routeMapping ? routeMapping.mapper(collection, document) : void 0;
|
|
4843
4864
|
if (routeOverride) {
|
|
4844
4865
|
window.location.href = routeOverride;
|
|
4845
4866
|
return null;
|
|
@@ -4884,7 +4905,8 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
4884
4905
|
const documents = collection.documents.edges;
|
|
4885
4906
|
const admin = cms.api.admin;
|
|
4886
4907
|
const pageInfo = collection.documents.pageInfo;
|
|
4887
|
-
const fields = (_a = collectionExtra.fields) == null ? void 0 : _a.filter((x) => ["string", "number", "datetime"].includes(x.type));
|
|
4908
|
+
const fields = (_a = collectionExtra.fields) == null ? void 0 : _a.filter((x) => ["string", "number", "datetime", "boolean"].includes(x.type));
|
|
4909
|
+
const collectionDefinition = cms.api.tina.schema.getCollection(collection.name);
|
|
4888
4910
|
return /* @__PURE__ */ React__default["default"].createElement(PageWrapper, null, /* @__PURE__ */ React__default["default"].createElement(React__default["default"].Fragment, null, open && /* @__PURE__ */ React__default["default"].createElement(DeleteModal, {
|
|
4889
4911
|
filename: vars.relativePath,
|
|
4890
4912
|
deleteFunc: async () => {
|
|
@@ -4975,7 +4997,7 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
4975
4997
|
}, /* @__PURE__ */ React__default["default"].createElement("a", {
|
|
4976
4998
|
className: "text-blue-600 hover:text-blue-400 flex items-center gap-3 cursor-pointer",
|
|
4977
4999
|
onClick: () => {
|
|
4978
|
-
handleNavigate(navigate, cms, collection, document.node);
|
|
5000
|
+
handleNavigate(navigate, cms, collection, collectionDefinition, document.node);
|
|
4979
5001
|
}
|
|
4980
5002
|
}, /* @__PURE__ */ React__default["default"].createElement(BiEdit, {
|
|
4981
5003
|
className: "inline-block h-6 w-auto opacity-70"
|
|
@@ -93,6 +93,16 @@ export declare class Client {
|
|
|
93
93
|
}): Promise<{
|
|
94
94
|
assetsSyncing: string[];
|
|
95
95
|
}>;
|
|
96
|
+
fetchEvents(limit?: number, cursor?: string): Promise<{
|
|
97
|
+
events: {
|
|
98
|
+
message: string;
|
|
99
|
+
timestamp: number;
|
|
100
|
+
id: string;
|
|
101
|
+
isError: boolean;
|
|
102
|
+
isGlobal: boolean;
|
|
103
|
+
}[];
|
|
104
|
+
cursor?: string;
|
|
105
|
+
}>;
|
|
96
106
|
parseJwt(token: any): any;
|
|
97
107
|
getRefreshedToken(tokens: string): Promise<TokenObject>;
|
|
98
108
|
isAuthorized(): Promise<boolean>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tinacms",
|
|
3
|
-
"version": "0.69.
|
|
3
|
+
"version": "0.69.6",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"module": "./dist/index.es.js",
|
|
6
6
|
"exports": {
|
|
@@ -48,9 +48,9 @@
|
|
|
48
48
|
"@headlessui/react": "^1.5.0",
|
|
49
49
|
"@heroicons/react": "^1.0.4",
|
|
50
50
|
"@react-hook/window-size": "^3.0.7",
|
|
51
|
-
"@tinacms/schema-tools": "0.1.
|
|
51
|
+
"@tinacms/schema-tools": "0.1.2",
|
|
52
52
|
"@tinacms/sharedctx": "0.1.2",
|
|
53
|
-
"@tinacms/toolkit": "0.57.
|
|
53
|
+
"@tinacms/toolkit": "0.57.3",
|
|
54
54
|
"crypto-js": "^4.0.0",
|
|
55
55
|
"fetch-ponyfill": "^7.1.0",
|
|
56
56
|
"final-form": "4.20.1",
|