tinacms 0.69.11 → 0.69.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.es.js +23 -2
- package/dist/index.js +23 -2
- package/package.json +3 -3
package/dist/index.es.js
CHANGED
|
@@ -5157,7 +5157,7 @@ const CollectionCreatePage = () => {
|
|
|
5157
5157
|
}));
|
|
5158
5158
|
};
|
|
5159
5159
|
const RenderForm$1 = ({ cms, collection, templateName, mutationInfo }) => {
|
|
5160
|
-
var _a, _b;
|
|
5160
|
+
var _a, _b, _c, _d, _e;
|
|
5161
5161
|
const navigate = useNavigate();
|
|
5162
5162
|
const [formIsPristine, setFormIsPristine] = useState(true);
|
|
5163
5163
|
const schema = cms.api.tina.schema;
|
|
@@ -5172,8 +5172,28 @@ const RenderForm$1 = ({ cms, collection, templateName, mutationInfo }) => {
|
|
|
5172
5172
|
schema,
|
|
5173
5173
|
template
|
|
5174
5174
|
});
|
|
5175
|
+
let slugFunction = (_b = (_a = schemaCollection == null ? void 0 : schemaCollection.ui) == null ? void 0 : _a.filename) == null ? void 0 : _b.slugify;
|
|
5176
|
+
if (!slugFunction) {
|
|
5177
|
+
const titleField = (_c = schemaCollection.fields.find((x) => x.required && x.type === "string" && x.isTitle)) == null ? void 0 : _c.name;
|
|
5178
|
+
if (titleField) {
|
|
5179
|
+
slugFunction = (values) => {
|
|
5180
|
+
var _a2;
|
|
5181
|
+
return (_a2 = values[titleField]) == null ? void 0 : _a2.replace(/ /g, "-").replace(/[^a-zA-Z0-9-]/g, "");
|
|
5182
|
+
};
|
|
5183
|
+
}
|
|
5184
|
+
}
|
|
5175
5185
|
const form = useMemo(() => {
|
|
5186
|
+
var _a2, _b2;
|
|
5176
5187
|
return new Form({
|
|
5188
|
+
initialValues: typeof (schemaCollection == null ? void 0 : schemaCollection.defaultItem) === "function" ? schemaCollection.defaultItem() : schemaCollection == null ? void 0 : schemaCollection.defaultItem,
|
|
5189
|
+
extraSubscribeValues: { active: true, submitting: true, touched: true },
|
|
5190
|
+
onChange: (values) => {
|
|
5191
|
+
var _a3;
|
|
5192
|
+
if (slugFunction && (values == null ? void 0 : values.active) !== "filename" && !(values == null ? void 0 : values.submitting) && !((_a3 = values.touched) == null ? void 0 : _a3.filename)) {
|
|
5193
|
+
const value = slugFunction(values == null ? void 0 : values.values);
|
|
5194
|
+
form.finalForm.change("filename", value);
|
|
5195
|
+
}
|
|
5196
|
+
},
|
|
5177
5197
|
id: "create-form",
|
|
5178
5198
|
label: "form",
|
|
5179
5199
|
fields: [
|
|
@@ -5181,6 +5201,7 @@ const RenderForm$1 = ({ cms, collection, templateName, mutationInfo }) => {
|
|
|
5181
5201
|
name: "filename",
|
|
5182
5202
|
label: "Filename",
|
|
5183
5203
|
component: "text",
|
|
5204
|
+
disabled: (_b2 = (_a2 = schemaCollection == null ? void 0 : schemaCollection.ui) == null ? void 0 : _a2.filename) == null ? void 0 : _b2.disabled,
|
|
5184
5205
|
description: /* @__PURE__ */ React.createElement("span", null, "A unique filename for the content.", /* @__PURE__ */ React.createElement("br", null), "Examples: ", /* @__PURE__ */ React.createElement("code", null, "My_Document"), ", ", /* @__PURE__ */ React.createElement("code", null, "My_Document.en"), ",", " ", /* @__PURE__ */ React.createElement("code", null, "sub-folder/My_Document")),
|
|
5185
5206
|
placeholder: `My_Document`,
|
|
5186
5207
|
validate: (value, allValues, meta) => {
|
|
@@ -5214,7 +5235,7 @@ const RenderForm$1 = ({ cms, collection, templateName, mutationInfo }) => {
|
|
|
5214
5235
|
const windowWidth = useWindowWidth();
|
|
5215
5236
|
const renderNavToggle = windowWidth < navBreakpoint + 1;
|
|
5216
5237
|
const headerPadding = renderNavToggle ? "px-20" : "px-6";
|
|
5217
|
-
return /* @__PURE__ */ React.createElement(PageWrapper, null, /* @__PURE__ */ React.createElement(React.Fragment, null, ((
|
|
5238
|
+
return /* @__PURE__ */ React.createElement(PageWrapper, null, /* @__PURE__ */ React.createElement(React.Fragment, null, ((_e = (_d = cms == null ? void 0 : cms.api) == null ? void 0 : _d.tina) == null ? void 0 : _e.isLocalMode) && /* @__PURE__ */ React.createElement(LocalWarning, null), /* @__PURE__ */ React.createElement("div", {
|
|
5218
5239
|
className: `py-4 border-b border-gray-200 bg-white ${headerPadding}`
|
|
5219
5240
|
}, /* @__PURE__ */ React.createElement("div", {
|
|
5220
5241
|
className: "max-w-form mx-auto"
|
package/dist/index.js
CHANGED
|
@@ -5175,7 +5175,7 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
5175
5175
|
}));
|
|
5176
5176
|
};
|
|
5177
5177
|
const RenderForm$1 = ({ cms, collection, templateName, mutationInfo }) => {
|
|
5178
|
-
var _a, _b;
|
|
5178
|
+
var _a, _b, _c, _d, _e;
|
|
5179
5179
|
const navigate = reactRouterDom.useNavigate();
|
|
5180
5180
|
const [formIsPristine, setFormIsPristine] = React.useState(true);
|
|
5181
5181
|
const schema = cms.api.tina.schema;
|
|
@@ -5190,8 +5190,28 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
5190
5190
|
schema,
|
|
5191
5191
|
template
|
|
5192
5192
|
});
|
|
5193
|
+
let slugFunction = (_b = (_a = schemaCollection == null ? void 0 : schemaCollection.ui) == null ? void 0 : _a.filename) == null ? void 0 : _b.slugify;
|
|
5194
|
+
if (!slugFunction) {
|
|
5195
|
+
const titleField = (_c = schemaCollection.fields.find((x) => x.required && x.type === "string" && x.isTitle)) == null ? void 0 : _c.name;
|
|
5196
|
+
if (titleField) {
|
|
5197
|
+
slugFunction = (values) => {
|
|
5198
|
+
var _a2;
|
|
5199
|
+
return (_a2 = values[titleField]) == null ? void 0 : _a2.replace(/ /g, "-").replace(/[^a-zA-Z0-9-]/g, "");
|
|
5200
|
+
};
|
|
5201
|
+
}
|
|
5202
|
+
}
|
|
5193
5203
|
const form = React.useMemo(() => {
|
|
5204
|
+
var _a2, _b2;
|
|
5194
5205
|
return new toolkit.Form({
|
|
5206
|
+
initialValues: typeof (schemaCollection == null ? void 0 : schemaCollection.defaultItem) === "function" ? schemaCollection.defaultItem() : schemaCollection == null ? void 0 : schemaCollection.defaultItem,
|
|
5207
|
+
extraSubscribeValues: { active: true, submitting: true, touched: true },
|
|
5208
|
+
onChange: (values) => {
|
|
5209
|
+
var _a3;
|
|
5210
|
+
if (slugFunction && (values == null ? void 0 : values.active) !== "filename" && !(values == null ? void 0 : values.submitting) && !((_a3 = values.touched) == null ? void 0 : _a3.filename)) {
|
|
5211
|
+
const value = slugFunction(values == null ? void 0 : values.values);
|
|
5212
|
+
form.finalForm.change("filename", value);
|
|
5213
|
+
}
|
|
5214
|
+
},
|
|
5195
5215
|
id: "create-form",
|
|
5196
5216
|
label: "form",
|
|
5197
5217
|
fields: [
|
|
@@ -5199,6 +5219,7 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
5199
5219
|
name: "filename",
|
|
5200
5220
|
label: "Filename",
|
|
5201
5221
|
component: "text",
|
|
5222
|
+
disabled: (_b2 = (_a2 = schemaCollection == null ? void 0 : schemaCollection.ui) == null ? void 0 : _a2.filename) == null ? void 0 : _b2.disabled,
|
|
5202
5223
|
description: /* @__PURE__ */ React__default["default"].createElement("span", null, "A unique filename for the content.", /* @__PURE__ */ React__default["default"].createElement("br", null), "Examples: ", /* @__PURE__ */ React__default["default"].createElement("code", null, "My_Document"), ", ", /* @__PURE__ */ React__default["default"].createElement("code", null, "My_Document.en"), ",", " ", /* @__PURE__ */ React__default["default"].createElement("code", null, "sub-folder/My_Document")),
|
|
5203
5224
|
placeholder: `My_Document`,
|
|
5204
5225
|
validate: (value, allValues, meta) => {
|
|
@@ -5232,7 +5253,7 @@ This will work when developing locally but NOT when deployed to production.
|
|
|
5232
5253
|
const windowWidth = windowSize.useWindowWidth();
|
|
5233
5254
|
const renderNavToggle = windowWidth < navBreakpoint + 1;
|
|
5234
5255
|
const headerPadding = renderNavToggle ? "px-20" : "px-6";
|
|
5235
|
-
return /* @__PURE__ */ React__default["default"].createElement(PageWrapper, null, /* @__PURE__ */ React__default["default"].createElement(React__default["default"].Fragment, null, ((
|
|
5256
|
+
return /* @__PURE__ */ React__default["default"].createElement(PageWrapper, null, /* @__PURE__ */ React__default["default"].createElement(React__default["default"].Fragment, null, ((_e = (_d = cms == null ? void 0 : cms.api) == null ? void 0 : _d.tina) == null ? void 0 : _e.isLocalMode) && /* @__PURE__ */ React__default["default"].createElement(toolkit.LocalWarning, null), /* @__PURE__ */ React__default["default"].createElement("div", {
|
|
5236
5257
|
className: `py-4 border-b border-gray-200 bg-white ${headerPadding}`
|
|
5237
5258
|
}, /* @__PURE__ */ React__default["default"].createElement("div", {
|
|
5238
5259
|
className: "max-w-form mx-auto"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tinacms",
|
|
3
|
-
"version": "0.69.
|
|
3
|
+
"version": "0.69.13",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"module": "./dist/index.es.js",
|
|
6
6
|
"exports": {
|
|
@@ -54,9 +54,9 @@
|
|
|
54
54
|
"@headlessui/react": "^1.5.0",
|
|
55
55
|
"@heroicons/react": "^1.0.4",
|
|
56
56
|
"@react-hook/window-size": "^3.0.7",
|
|
57
|
-
"@tinacms/schema-tools": "0.1.
|
|
57
|
+
"@tinacms/schema-tools": "0.1.5",
|
|
58
58
|
"@tinacms/sharedctx": "0.1.3",
|
|
59
|
-
"@tinacms/toolkit": "0.57.
|
|
59
|
+
"@tinacms/toolkit": "0.57.9",
|
|
60
60
|
"crypto-js": "^4.0.0",
|
|
61
61
|
"fetch-ponyfill": "^7.1.0",
|
|
62
62
|
"final-form": "4.20.1",
|