@webiny/app-headless-cms 5.32.0 → 5.33.0-beta.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/admin/components/ContentEntryForm/useContentEntryForm.js +5 -1
- package/admin/components/ContentEntryForm/useContentEntryForm.js.map +1 -1
- package/admin/components/FieldEditor/EditFieldDialog/GeneralTab.js +2 -3
- package/admin/components/FieldEditor/EditFieldDialog/GeneralTab.js.map +1 -1
- package/admin/components/FieldEditor/EditFieldDialog.js +40 -0
- package/admin/components/FieldEditor/EditFieldDialog.js.map +1 -1
- package/admin/components/FieldEditor/Field.js +28 -15
- package/admin/components/FieldEditor/Field.js.map +1 -1
- package/admin/components/FieldEditor/FieldEditorContext.js +27 -3
- package/admin/components/FieldEditor/FieldEditorContext.js.map +1 -1
- package/admin/graphql/contentModels.d.ts +1 -1
- package/admin/graphql/contentModels.js +1 -1
- package/admin/graphql/contentModels.js.map +1 -1
- package/admin/plugins/fieldRenderers/file/fileField.js +19 -24
- package/admin/plugins/fieldRenderers/file/fileField.js.map +1 -1
- package/admin/plugins/fieldRenderers/file/fileFields.js +47 -51
- package/admin/plugins/fieldRenderers/file/fileFields.js.map +1 -1
- package/admin/plugins/fieldRenderers/object/multipleObjects.js +4 -4
- package/admin/plugins/fieldRenderers/object/multipleObjects.js.map +1 -1
- package/admin/plugins/index.d.ts +1 -1
- package/admin/plugins/install.js +37 -26
- package/admin/plugins/install.js.map +1 -1
- package/admin/plugins/transformers/dateTransformer.js +1 -0
- package/admin/plugins/transformers/dateTransformer.js.map +1 -1
- package/admin/plugins/upgrades/5.33.0/locales.d.ts +7 -0
- package/admin/plugins/upgrades/5.33.0/locales.js +65 -0
- package/admin/plugins/upgrades/5.33.0/locales.js.map +1 -0
- package/admin/plugins/upgrades/5.33.0/types.d.ts +7 -0
- package/admin/plugins/upgrades/5.33.0/types.js +5 -0
- package/admin/plugins/upgrades/5.33.0/types.js.map +1 -0
- package/admin/plugins/upgrades/5.33.0/upgrade.d.ts +8 -0
- package/admin/plugins/upgrades/5.33.0/upgrade.js +81 -0
- package/admin/plugins/upgrades/5.33.0/upgrade.js.map +1 -0
- package/admin/plugins/upgrades/v5.33.0.d.ts +6 -0
- package/admin/plugins/upgrades/v5.33.0.js +191 -0
- package/admin/plugins/upgrades/v5.33.0.js.map +1 -0
- package/admin/views/contentEntries/ContentEntry/prepareFormData.d.ts +2 -2
- package/admin/views/contentEntries/ContentEntry/prepareFormData.js +91 -36
- package/admin/views/contentEntries/ContentEntry/prepareFormData.js.map +1 -1
- package/admin/views/contentEntries/experiment/Property.js +3 -3
- package/admin/views/contentEntries/experiment/Property.js.map +1 -1
- package/package.json +18 -21
- package/types.d.ts +1 -0
- package/types.js.map +1 -1
|
@@ -11,8 +11,18 @@ var _createForOfIteratorHelper2 = _interopRequireDefault(require("@babel/runtime
|
|
|
11
11
|
|
|
12
12
|
var _plugins = require("@webiny/plugins");
|
|
13
13
|
|
|
14
|
+
/**
|
|
15
|
+
* This method builds transformer plugins only once.
|
|
16
|
+
* Really no need in building more than once because at this point all plugins are registered.
|
|
17
|
+
*/
|
|
18
|
+
var availableTransformerPlugins = undefined;
|
|
19
|
+
|
|
14
20
|
var getAvailableTransformerPlugins = function getAvailableTransformerPlugins() {
|
|
15
|
-
|
|
21
|
+
if (availableTransformerPlugins) {
|
|
22
|
+
return availableTransformerPlugins;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
availableTransformerPlugins = _plugins.plugins.byType("cms-field-value-transformer").reduce(function (transformers, pl) {
|
|
16
26
|
var fieldTypes = Array.isArray(pl.fieldType) ? pl.fieldType : [pl.fieldType];
|
|
17
27
|
|
|
18
28
|
var _iterator = (0, _createForOfIteratorHelper2.default)(fieldTypes),
|
|
@@ -37,57 +47,102 @@ var getAvailableTransformerPlugins = function getAvailableTransformerPlugins() {
|
|
|
37
47
|
|
|
38
48
|
return transformers;
|
|
39
49
|
}, {});
|
|
50
|
+
return availableTransformerPlugins;
|
|
40
51
|
};
|
|
41
52
|
|
|
42
|
-
var
|
|
43
|
-
var transformerPlugins = getAvailableTransformerPlugins();
|
|
44
|
-
var transformers = {};
|
|
53
|
+
var transformationRunner;
|
|
45
54
|
|
|
46
|
-
|
|
47
|
-
|
|
55
|
+
var createTransformationRunner = function createTransformationRunner() {
|
|
56
|
+
if (transformationRunner) {
|
|
57
|
+
return transformationRunner;
|
|
58
|
+
}
|
|
48
59
|
|
|
49
|
-
|
|
50
|
-
var _loop = function _loop() {
|
|
51
|
-
var field = _step2.value;
|
|
60
|
+
var availablePlugins = getAvailableTransformerPlugins();
|
|
52
61
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
} // TODO @ts-refactor figure out if possible to put some type instead of any
|
|
62
|
+
transformationRunner = function transformationRunner(field, value) {
|
|
63
|
+
var transformer = availablePlugins[field.type];
|
|
56
64
|
|
|
65
|
+
if (!transformer) {
|
|
66
|
+
return value;
|
|
67
|
+
}
|
|
57
68
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
};
|
|
61
|
-
};
|
|
69
|
+
return transformer.transform(value, field);
|
|
70
|
+
};
|
|
62
71
|
|
|
63
|
-
|
|
64
|
-
|
|
72
|
+
return transformationRunner;
|
|
73
|
+
};
|
|
65
74
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
75
|
+
var prepareFormData = function prepareFormData(input, fields) {
|
|
76
|
+
var runTransformation = createTransformationRunner();
|
|
77
|
+
return fields.reduce(function (output, field) {
|
|
78
|
+
var _field$settings;
|
|
79
|
+
|
|
80
|
+
var inputValue = input[field.fieldId];
|
|
81
|
+
var childFields = field.type === "object" ? (_field$settings = field.settings) === null || _field$settings === void 0 ? void 0 : _field$settings.fields : undefined;
|
|
82
|
+
/**
|
|
83
|
+
* There is a possibility that we have an object field - it has child fields.
|
|
84
|
+
*/
|
|
85
|
+
|
|
86
|
+
if (childFields) {
|
|
87
|
+
/**
|
|
88
|
+
* Field can be repeatable, and in that case, we must go through all values and transform them.
|
|
89
|
+
*/
|
|
90
|
+
if (field.multipleValues) {
|
|
91
|
+
if (!inputValue) {
|
|
92
|
+
return output;
|
|
93
|
+
}
|
|
73
94
|
|
|
74
|
-
|
|
75
|
-
|
|
95
|
+
var values = Array.isArray(inputValue) ? inputValue : undefined;
|
|
96
|
+
|
|
97
|
+
if (!values) {
|
|
98
|
+
return output;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
output[field.fieldId] = values.map(function (value) {
|
|
102
|
+
return prepareFormData(value, childFields);
|
|
103
|
+
});
|
|
104
|
+
return output;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
if (!inputValue) {
|
|
108
|
+
return output;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Or if is not repeatable, just go through the fields without the need to go through an array.
|
|
112
|
+
*/
|
|
76
113
|
|
|
77
|
-
var prepareFormData = function prepareFormData(input, model) {
|
|
78
|
-
var transformers = createTransformers(model.fields);
|
|
79
|
-
return Object.keys(transformers).reduce(function (output, key) {
|
|
80
|
-
var value = input[key];
|
|
81
|
-
var transform = transformers[key];
|
|
82
|
-
var transformedValue = transform(value);
|
|
83
114
|
|
|
84
|
-
|
|
115
|
+
output[field.fieldId] = prepareFormData(inputValue, childFields);
|
|
85
116
|
return output;
|
|
86
117
|
}
|
|
118
|
+
/**
|
|
119
|
+
* Regular fields, multiple values enabled.
|
|
120
|
+
*/
|
|
121
|
+
//
|
|
122
|
+
else if (field.multipleValues) {
|
|
123
|
+
var _values = Array.isArray(inputValue) ? inputValue : undefined;
|
|
124
|
+
|
|
125
|
+
if (!_values) {
|
|
126
|
+
return output;
|
|
127
|
+
}
|
|
87
128
|
|
|
88
|
-
|
|
129
|
+
output[field.fieldId] = _values
|
|
130
|
+
/**
|
|
131
|
+
* Transformations need to run on all the available fields.
|
|
132
|
+
*/
|
|
133
|
+
.map(function (value) {
|
|
134
|
+
return runTransformation(field, value);
|
|
135
|
+
});
|
|
136
|
+
return output;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Regular values, single values.
|
|
140
|
+
*/
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
output[field.fieldId] = runTransformation(field, inputValue);
|
|
89
144
|
return output;
|
|
90
|
-
},
|
|
145
|
+
}, {});
|
|
91
146
|
};
|
|
92
147
|
|
|
93
148
|
exports.prepareFormData = prepareFormData;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["getAvailableTransformerPlugins","plugins","byType","reduce","transformers","pl","fieldTypes","Array","isArray","fieldType","console","warn","
|
|
1
|
+
{"version":3,"names":["availableTransformerPlugins","undefined","getAvailableTransformerPlugins","plugins","byType","reduce","transformers","pl","fieldTypes","Array","isArray","fieldType","console","warn","transformationRunner","createTransformationRunner","availablePlugins","field","value","transformer","type","transform","prepareFormData","input","fields","runTransformation","output","inputValue","fieldId","childFields","settings","multipleValues","values","map"],"sources":["prepareFormData.ts"],"sourcesContent":["import { CmsEditorField, CmsFieldValueTransformer } from \"~/types\";\nimport { plugins } from \"@webiny/plugins\";\n\ninterface AvailableFieldTransformers {\n [fieldType: string]: CmsFieldValueTransformer;\n}\n\n/**\n * This method builds transformer plugins only once.\n * Really no need in building more than once because at this point all plugins are registered.\n */\nlet availableTransformerPlugins: AvailableFieldTransformers | undefined = undefined;\nconst getAvailableTransformerPlugins = (): AvailableFieldTransformers => {\n if (availableTransformerPlugins) {\n return availableTransformerPlugins;\n }\n availableTransformerPlugins = plugins\n .byType<CmsFieldValueTransformer>(\"cms-field-value-transformer\")\n .reduce<AvailableFieldTransformers>((transformers, pl) => {\n const fieldTypes = Array.isArray(pl.fieldType) ? pl.fieldType : [pl.fieldType];\n for (const fieldType of fieldTypes) {\n if (transformers[fieldType]) {\n console.warn(\n `Transformer for field type \"${fieldType}\" is already defined. There cannot be more than one transformer.`\n );\n continue;\n }\n transformers[fieldType] = pl;\n }\n return transformers;\n }, {});\n\n return availableTransformerPlugins;\n};\n\ninterface TransformationRunnerCallable {\n (field: CmsEditorField, value: any): any;\n}\n\nlet transformationRunner: TransformationRunnerCallable;\nconst createTransformationRunner = (): TransformationRunnerCallable => {\n if (transformationRunner) {\n return transformationRunner;\n }\n const availablePlugins = getAvailableTransformerPlugins();\n\n transformationRunner = (field, value) => {\n const transformer = availablePlugins[field.type];\n if (!transformer) {\n return value;\n }\n return transformer.transform(value, field);\n };\n return transformationRunner;\n};\n\nexport const prepareFormData = (\n input: Record<string, any>,\n fields: CmsEditorField[]\n): Record<string, any> => {\n const runTransformation = createTransformationRunner();\n\n return fields.reduce<Record<string, any>>((output, field) => {\n const inputValue = input[field.fieldId];\n const childFields = field.type === \"object\" ? field.settings?.fields : undefined;\n /**\n * There is a possibility that we have an object field - it has child fields.\n */\n if (childFields) {\n /**\n * Field can be repeatable, and in that case, we must go through all values and transform them.\n */\n if (field.multipleValues) {\n if (!inputValue) {\n return output;\n }\n const values = Array.isArray(inputValue) ? inputValue : undefined;\n if (!values) {\n return output;\n }\n output[field.fieldId] = values.map(value => {\n return prepareFormData(value, childFields);\n });\n return output;\n }\n if (!inputValue) {\n return output;\n }\n /**\n * Or if is not repeatable, just go through the fields without the need to go through an array.\n */\n output[field.fieldId] = prepareFormData(inputValue, childFields);\n\n return output;\n }\n /**\n * Regular fields, multiple values enabled.\n */\n //\n else if (field.multipleValues) {\n const values = Array.isArray(inputValue) ? inputValue : undefined;\n if (!values) {\n return output;\n }\n output[field.fieldId] = values\n /**\n * Transformations need to run on all the available fields.\n */\n .map(value => {\n return runTransformation(field, value);\n });\n return output;\n }\n /**\n * Regular values, single values.\n */\n output[field.fieldId] = runTransformation(field, inputValue);\n\n return output;\n }, {});\n};\n"],"mappings":";;;;;;;;;;;AACA;;AAMA;AACA;AACA;AACA;AACA,IAAIA,2BAAmE,GAAGC,SAA1E;;AACA,IAAMC,8BAA8B,GAAG,SAAjCA,8BAAiC,GAAkC;EACrE,IAAIF,2BAAJ,EAA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If,UAAAf,KAAK,EAAI;QACV,OAAOO,iBAAiB,CAACR,KAAD,EAAQC,KAAR,CAAxB;MACH,CANmB,CAAxB;MAOA,OAAOQ,MAAP;IACH;IACD;AACR;AACA;;;IACQA,MAAM,CAACT,KAAK,CAACW,OAAP,CAAN,GAAwBH,iBAAiB,CAACR,KAAD,EAAQU,UAAR,CAAzC;IAEA,OAAOD,MAAP;EACH,CAzDM,EAyDJ,EAzDI,CAAP;AA0DH,CAhEM"}
|
|
@@ -23,10 +23,10 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
23
23
|
|
|
24
24
|
var _react = _interopRequireWildcard(require("react"));
|
|
25
25
|
|
|
26
|
-
var _nanoid = require("nanoid");
|
|
27
|
-
|
|
28
26
|
var _useDeepCompareEffect = _interopRequireDefault(require("use-deep-compare-effect"));
|
|
29
27
|
|
|
28
|
+
var _utils = require("@webiny/utils");
|
|
29
|
+
|
|
30
30
|
var _excluded = ["children", "name", "value"];
|
|
31
31
|
|
|
32
32
|
function toObject(property) {
|
|
@@ -121,7 +121,7 @@ var Property = function Property(_ref3) {
|
|
|
121
121
|
name = _ref3.name,
|
|
122
122
|
value = _ref3.value,
|
|
123
123
|
props = (0, _objectWithoutProperties2.default)(_ref3, _excluded);
|
|
124
|
-
var id = (0, _react.useRef)(props.id || (0,
|
|
124
|
+
var id = (0, _react.useRef)(props.id || (0, _utils.generateAlphaNumericId)(21));
|
|
125
125
|
|
|
126
126
|
var _useState = (0, _react.useState)([]),
|
|
127
127
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["toObject","property","value","undefined","name","obj","properties","forEach","prop","isSingle","filter","p","length","asObject","toArray","objects","map","reduce","acc","item","mergeProperties","properties1","properties2","temp","Object","values","id","PropertyContext","createContext","displayName","useProperty","useContext","PropertyContainerContext","cleanup","Boolean","store","Map","PropertyContainer","onChange","children","ref","useRef","context","useMemo","updateContainer","updater","current","get","set","Property","props","nanoid","useState","setProperties","parentProperty","removeProperty","index","findIndex","slice","$remove","updateProperty","indexById","indexByName","updateParentContainer","remove","replace","merge","useDeepCompareEffect"],"sources":["Property.tsx"],"sourcesContent":["// @ts-nocheck\n/**\n * Note by @pavel910:\n *\n * TS is disabled in this file, as this is a wild experiment, and I need to come back and fix some types, which are not very\n * obvious. I don't have time to do it right now. If the experiment is successful, I'll come back and clean this up, and\n * extract this whole logic into a separate package, as this is a tiny framework for building data objects using React, and\n * we might want to use it in many more places (all views, Page Builder Editor, etc.).\n *\n * More on this a bit later, if the experiment is successful.\n */\nimport React, { createContext, FC, useContext, useMemo, useRef, useState } from \"react\";\nimport { nanoid } from \"nanoid\";\nimport useDeepCompareEffect from \"use-deep-compare-effect\";\n\nexport function toObject<T = unknown>(property: Property): T {\n if (property.value !== undefined) {\n return { [property.name]: property.value };\n }\n\n const obj = {};\n property.properties.forEach(prop => {\n // Check if this is a single occurrence of this property\n const isSingle = property.properties.filter(p => p.name === prop.name).length === 1;\n if (prop.value !== undefined) {\n obj[prop.name] = isSingle ? prop.value : [...(obj[prop.name] || []), prop.value];\n } else {\n const asObject = toObject(prop);\n\n if (!isSingle) {\n obj[prop.name] = [...(obj[prop.name] || []), asObject[prop.name]];\n } else {\n obj[prop.name] = asObject[prop.name];\n }\n }\n });\n\n return obj;\n}\n\nexport function toArray(objects: Property[]) {\n return objects.map(obj =>\n obj.properties.reduce((acc, item) => {\n return { ...acc, ...toObject(item) };\n }, {})\n );\n}\n\nfunction mergeProperties(properties1: Property[], properties2: Property[]) {\n const temp: Property[] = [...properties1, ...properties2];\n\n return Object.values(\n temp.reduce((acc, item) => {\n return { ...acc, [item.id]: item };\n }, {})\n );\n}\n\ninterface PropertyContext {\n removeProperty(id: string): void;\n updateProperty(property: Property): void;\n}\n\nconst PropertyContext = createContext<PropertyContext>(null);\nPropertyContext.displayName = \"PropertyContext\";\n\nconst useProperty = () => {\n return useContext(PropertyContext);\n};\n\ninterface PropertyContainerContext {\n updateContainer(update): void;\n}\n\nexport interface Property<TValue = unknown> {\n id?: string;\n name: string;\n value?: TValue;\n properties?: Property[];\n}\n\nconst PropertyContainerContext = createContext<PropertyContainerContext>();\n\nfunction cleanup(properties: Property[]): Property[] {\n return properties\n .map(property => {\n if (\"$remove\" in property) {\n return null;\n }\n\n return {\n ...property,\n properties: cleanup(property.properties)\n };\n })\n .filter(Boolean);\n}\n\nconst store = new Map<string, any>();\n\ninterface PropertyContainerProps {\n name: string;\n // TODO: create a proper type\n onChange: any;\n}\n\nexport const PropertyContainer: FC<PropertyContainerProps> = ({ name, onChange, children }) => {\n const ref = useRef(store);\n const context = useMemo(\n () => ({\n updateContainer(updater) {\n const current = store.get(name) || [];\n const properties = cleanup(updater(current));\n store.set(name, properties);\n onChange(properties);\n }\n }),\n [ref]\n );\n\n return (\n <PropertyContainerContext.Provider value={context}>\n {children}\n </PropertyContainerContext.Provider>\n );\n};\n\ninterface PropertyProps {\n id?: string;\n name: string;\n value?: unknown;\n merge?: boolean;\n replace?: boolean;\n remove?: boolean;\n}\n\nexport const Property: FC<PropertyProps> = ({ children, name, value, ...props }) => {\n const id = useRef(props.id || nanoid());\n const [properties, setProperties] = useState([]);\n const { updateContainer } = useContext(PropertyContainerContext);\n const parentProperty = useProperty();\n\n const context: PropertyContext = {\n removeProperty(id: string) {\n setProperties(properties => {\n const index = properties.findIndex(p => p.id === id);\n if (index > -1) {\n return [\n ...properties.slice(0, index),\n { ...properties[index], $remove: true },\n ...properties.slice(index + 1)\n ];\n }\n return properties;\n });\n },\n updateProperty(property) {\n setProperties(properties => {\n const index = properties.findIndex(p => p.id === property.id);\n if (index > -1) {\n return [\n ...properties.slice(0, index),\n { ...properties[index], ...property },\n ...properties.slice(index + 1)\n ];\n }\n return [...properties, property];\n });\n }\n };\n\n const indexById = p => p.id === props.id;\n const indexByName = p => p.name === name;\n\n const updateParentContainer = property => {\n updateContainer((properties: Property[]) => {\n // Check if this property already exists in the parent container.\n const index = properties.findIndex(props.id ? indexById : indexByName);\n\n if (props.remove) {\n if (index > -1) {\n return [\n ...properties.slice(0, index),\n { ...properties[index], $remove: true },\n ...properties.slice(index + 1)\n ];\n }\n\n return properties;\n }\n\n if (props.replace) {\n if (index > -1) {\n return [\n ...properties.slice(0, index),\n { ...property },\n ...properties.slice(index + 1)\n ];\n }\n\n return [...properties, property];\n }\n\n if (props.merge) {\n if (index > -1) {\n return [\n ...properties.slice(0, index),\n {\n ...properties[index],\n ...property,\n properties: mergeProperties(\n properties[index].properties,\n property.properties\n )\n },\n ...properties.slice(index + 1)\n ];\n }\n }\n\n return [...properties, property];\n });\n };\n\n useDeepCompareEffect(() => {\n const property = { id: id.current, name, value, properties };\n\n if (!parentProperty) {\n return updateParentContainer(property);\n }\n\n parentProperty.updateProperty(property);\n }, [properties]);\n\n useDeepCompareEffect(() => {\n // On mount, we need to report to our parent.\n if (parentProperty) {\n if (props.remove) {\n parentProperty.removeProperty(id.current);\n } else {\n parentProperty.updateProperty({ id: id.current, name, value, properties });\n }\n }\n }, [props.remove, properties]);\n\n if (!children) {\n return null;\n }\n\n return <PropertyContext.Provider value={context}>{children}</PropertyContext.Provider>;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAWA;;AACA;;AACA;;;;AAEO,SAASA,QAAT,CAA+BC,QAA/B,EAAsD;EACzD,IAAIA,QAAQ,CAACC,KAAT,KAAmBC,SAAvB,EAAkC;IAC9B,yCAAUF,QAAQ,CAACG,IAAnB,EAA0BH,QAAQ,CAACC,KAAnC;EACH;;EAED,IAAMG,GAAG,GAAG,EAAZ;EACAJ,QAAQ,CAACK,UAAT,CAAoBC,OAApB,CAA4B,UAAAC,IAAI,EAAI;IAChC;IACA,IAAMC,QAAQ,GAAGR,QAAQ,CAACK,UAAT,CAAoBI,MAApB,CAA2B,UAAAC,CAAC;MAAA,OAAIA,CAAC,CAACP,IAAF,KAAWI,IAAI,CAACJ,IAApB;IAAA,CAA5B,EAAsDQ,MAAtD,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EO;QACHQ,cAAc,CAACM,cAAf,CAA8B;UAAElC,EAAE,EAAEA,EAAE,CAACoB,OAAT;UAAkB1C,IAAI,EAAJA,IAAlB;UAAwBF,KAAK,EAALA,KAAxB;UAA+BI,UAAU,EAAVA;QAA/B,CAA9B;MACH;IACJ;EACJ,CATD,EASG,CAAC4C,KAAK,CAACc,MAAP,EAAe1D,UAAf,CATH;;EAWA,IAAI,CAACiC,QAAL,EAAe;IACX,OAAO,IAAP;EACH;;EAED,oBAAO,6BAAC,eAAD,CAAiB,QAAjB;IAA0B,KAAK,EAAEG;EAAjC,GAA2CH,QAA3C,CAAP;AACH,CAlHM"}
|
|
1
|
+
{"version":3,"names":["toObject","property","value","undefined","name","obj","properties","forEach","prop","isSingle","filter","p","length","asObject","toArray","objects","map","reduce","acc","item","mergeProperties","properties1","properties2","temp","Object","values","id","PropertyContext","createContext","displayName","useProperty","useContext","PropertyContainerContext","cleanup","Boolean","store","Map","PropertyContainer","onChange","children","ref","useRef","context","useMemo","updateContainer","updater","current","get","set","Property","props","generateAlphaNumericId","useState","setProperties","parentProperty","removeProperty","index","findIndex","slice","$remove","updateProperty","indexById","indexByName","updateParentContainer","remove","replace","merge","useDeepCompareEffect"],"sources":["Property.tsx"],"sourcesContent":["// @ts-nocheck\n/**\n * Note by @pavel910:\n *\n * TS is disabled in this file, as this is a wild experiment, and I need to come back and fix some types, which are not very\n * obvious. I don't have time to do it right now. If the experiment is successful, I'll come back and clean this up, and\n * extract this whole logic into a separate package, as this is a tiny framework for building data objects using React, and\n * we might want to use it in many more places (all views, Page Builder Editor, etc.).\n *\n * More on this a bit later, if the experiment is successful.\n */\nimport React, { createContext, FC, useContext, useMemo, useRef, useState } from \"react\";\nimport useDeepCompareEffect from \"use-deep-compare-effect\";\nimport { generateAlphaNumericId } from \"@webiny/utils\";\n\nexport function toObject<T = unknown>(property: Property): T {\n if (property.value !== undefined) {\n return { [property.name]: property.value };\n }\n\n const obj = {};\n property.properties.forEach(prop => {\n // Check if this is a single occurrence of this property\n const isSingle = property.properties.filter(p => p.name === prop.name).length === 1;\n if (prop.value !== undefined) {\n obj[prop.name] = isSingle ? prop.value : [...(obj[prop.name] || []), prop.value];\n } else {\n const asObject = toObject(prop);\n\n if (!isSingle) {\n obj[prop.name] = [...(obj[prop.name] || []), asObject[prop.name]];\n } else {\n obj[prop.name] = asObject[prop.name];\n }\n }\n });\n\n return obj;\n}\n\nexport function toArray(objects: Property[]) {\n return objects.map(obj =>\n obj.properties.reduce((acc, item) => {\n return { ...acc, ...toObject(item) };\n }, {})\n );\n}\n\nfunction mergeProperties(properties1: Property[], properties2: Property[]) {\n const temp: Property[] = [...properties1, ...properties2];\n\n return Object.values(\n temp.reduce((acc, item) => {\n return { ...acc, [item.id]: item };\n }, {})\n );\n}\n\ninterface PropertyContext {\n removeProperty(id: string): void;\n updateProperty(property: Property): void;\n}\n\nconst PropertyContext = createContext<PropertyContext>(null);\nPropertyContext.displayName = \"PropertyContext\";\n\nconst useProperty = () => {\n return useContext(PropertyContext);\n};\n\ninterface PropertyContainerContext {\n updateContainer(update): void;\n}\n\nexport interface Property<TValue = unknown> {\n id?: string;\n name: string;\n value?: TValue;\n properties?: Property[];\n}\n\nconst PropertyContainerContext = createContext<PropertyContainerContext>();\n\nfunction cleanup(properties: Property[]): Property[] {\n return properties\n .map(property => {\n if (\"$remove\" in property) {\n return null;\n }\n\n return {\n ...property,\n properties: cleanup(property.properties)\n };\n })\n .filter(Boolean);\n}\n\nconst store = new Map<string, any>();\n\ninterface PropertyContainerProps {\n name: string;\n // TODO: create a proper type\n onChange: any;\n}\n\nexport const PropertyContainer: FC<PropertyContainerProps> = ({ name, onChange, children }) => {\n const ref = useRef(store);\n const context = useMemo(\n () => ({\n updateContainer(updater) {\n const current = store.get(name) || [];\n const properties = cleanup(updater(current));\n store.set(name, properties);\n onChange(properties);\n }\n }),\n [ref]\n );\n\n return (\n <PropertyContainerContext.Provider value={context}>\n {children}\n </PropertyContainerContext.Provider>\n );\n};\n\ninterface PropertyProps {\n id?: string;\n name: string;\n value?: unknown;\n merge?: boolean;\n replace?: boolean;\n remove?: boolean;\n}\n\nexport const Property: FC<PropertyProps> = ({ children, name, value, ...props }) => {\n const id = useRef(props.id || generateAlphaNumericId(21));\n const [properties, setProperties] = useState([]);\n const { updateContainer } = useContext(PropertyContainerContext);\n const parentProperty = useProperty();\n\n const context: PropertyContext = {\n removeProperty(id: string) {\n setProperties(properties => {\n const index = properties.findIndex(p => p.id === id);\n if (index > -1) {\n return [\n ...properties.slice(0, index),\n { ...properties[index], $remove: true },\n ...properties.slice(index + 1)\n ];\n }\n return properties;\n });\n },\n updateProperty(property) {\n setProperties(properties => {\n const index = properties.findIndex(p => p.id === property.id);\n if (index > -1) {\n return [\n ...properties.slice(0, index),\n { ...properties[index], ...property },\n ...properties.slice(index + 1)\n ];\n }\n return [...properties, property];\n });\n }\n };\n\n const indexById = p => p.id === props.id;\n const indexByName = p => p.name === name;\n\n const updateParentContainer = property => {\n updateContainer((properties: Property[]) => {\n // Check if this property already exists in the parent container.\n const index = properties.findIndex(props.id ? indexById : indexByName);\n\n if (props.remove) {\n if (index > -1) {\n return [\n ...properties.slice(0, index),\n { ...properties[index], $remove: true },\n ...properties.slice(index + 1)\n ];\n }\n\n return properties;\n }\n\n if (props.replace) {\n if (index > -1) {\n return [\n ...properties.slice(0, index),\n { ...property },\n ...properties.slice(index + 1)\n ];\n }\n\n return [...properties, property];\n }\n\n if (props.merge) {\n if (index > -1) {\n return [\n ...properties.slice(0, index),\n {\n ...properties[index],\n ...property,\n properties: mergeProperties(\n properties[index].properties,\n property.properties\n )\n },\n ...properties.slice(index + 1)\n ];\n }\n }\n\n return [...properties, property];\n });\n };\n\n useDeepCompareEffect(() => {\n const property = { id: id.current, name, value, properties };\n\n if (!parentProperty) {\n return updateParentContainer(property);\n }\n\n parentProperty.updateProperty(property);\n }, [properties]);\n\n useDeepCompareEffect(() => {\n // On mount, we need to report to our parent.\n if (parentProperty) {\n if (props.remove) {\n parentProperty.removeProperty(id.current);\n } else {\n parentProperty.updateProperty({ id: id.current, name, value, properties });\n }\n }\n }, [props.remove, properties]);\n\n if (!children) {\n return null;\n }\n\n return <PropertyContext.Provider value={context}>{children}</PropertyContext.Provider>;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAWA;;AACA;;AACA;;;;AAEO,SAASA,QAAT,CAA+BC,QAA/B,EAAsD;EACzD,IAAIA,QAAQ,CAACC,KAAT,KAAmBC,SAAvB,EAAkC;IAC9B,yCAAUF,QAAQ,CAACG,IAAnB,EAA0BH,QAAQ,CAACC,KAAnC;EACH;;EAED,IAAMG,GAAG,GAAG,EAAZ;EACAJ,QAAQ,CAACK,UAAT,CAAoBC,OAApB,CAA4B,UAAAC,IAAI,EAAI;IAChC;IACA,IAAMC,QAAQ,GAAGR,QAAQ,CAACK,UAAT,CAAoBI,MAApB,CAA2B,UAAAC,CAAC;MAAA,OAAIA,CAAC,CAACP,IAAF,KAAWI,IAAI,CAACJ,IAApB;IAAA,CAA5B,EAAsDQ,MAAtD,KAAiE,CAAlF;;IACA,IAAIJ,IAAI,CAACN,KAAL,KAAeC,SAAnB,EAA8B;MAC1BE,GAAG,CAACG,IAAI,CAACJ,IAAN,CAAH,GAAiBK,QAAQ,GAAGD,IAAI,CAACN,KAAR,8CAAqBG,GAAG,CAACG,IAAI,CAACJ,IAAN,CAAH,IAAkB,EAAvC,IAA4CI,IAAI,CAACN,KAAjD,EAAzB;IACH,CAFD,MAEO;MACH,IAAMW,QAAQ,GAAGb,QAAQ,CAACQ,IAAD,CAAzB;;MAEA,IAAI,CAACC,QAAL,EAAe;QACXJ,GAAG,CAACG,IAAI,CAACJ,IAAN,CAAH,8CAAsBC,GAAG,CAACG,IAAI,CAACJ,IAAN,CAAH,IAAkB,EAAxC,IAA6CS,QAAQ,CAACL,IAAI,CAACJ,IAAN,CAArD;MACH,CAFD,MAEO;QACHC,GAAG,CAACG,IAAI,CAACJ,IAAN,CAAH,GAAiBS,QAA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
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -26,20 +26,20 @@
|
|
|
26
26
|
"@fortawesome/react-fontawesome": "0.1.19",
|
|
27
27
|
"@svgr/webpack": "6.3.1",
|
|
28
28
|
"@types/react": "17.0.39",
|
|
29
|
-
"@webiny/app": "5.
|
|
30
|
-
"@webiny/app-admin": "5.
|
|
31
|
-
"@webiny/app-graphql-playground": "5.
|
|
32
|
-
"@webiny/app-i18n": "5.
|
|
33
|
-
"@webiny/app-plugin-admin-welcome-screen": "5.
|
|
34
|
-
"@webiny/app-security": "5.
|
|
35
|
-
"@webiny/error": "5.
|
|
36
|
-
"@webiny/form": "5.
|
|
37
|
-
"@webiny/plugins": "5.
|
|
38
|
-
"@webiny/react-composition": "5.
|
|
39
|
-
"@webiny/react-router": "5.
|
|
40
|
-
"@webiny/ui": "5.
|
|
41
|
-
"@webiny/utils": "5.
|
|
42
|
-
"@webiny/validation": "5.
|
|
29
|
+
"@webiny/app": "5.33.0-beta.0",
|
|
30
|
+
"@webiny/app-admin": "5.33.0-beta.0",
|
|
31
|
+
"@webiny/app-graphql-playground": "5.33.0-beta.0",
|
|
32
|
+
"@webiny/app-i18n": "5.33.0-beta.0",
|
|
33
|
+
"@webiny/app-plugin-admin-welcome-screen": "5.33.0-beta.0",
|
|
34
|
+
"@webiny/app-security": "5.33.0-beta.0",
|
|
35
|
+
"@webiny/error": "5.33.0-beta.0",
|
|
36
|
+
"@webiny/form": "5.33.0-beta.0",
|
|
37
|
+
"@webiny/plugins": "5.33.0-beta.0",
|
|
38
|
+
"@webiny/react-composition": "5.33.0-beta.0",
|
|
39
|
+
"@webiny/react-router": "5.33.0-beta.0",
|
|
40
|
+
"@webiny/ui": "5.33.0-beta.0",
|
|
41
|
+
"@webiny/utils": "5.33.0-beta.0",
|
|
42
|
+
"@webiny/validation": "5.33.0-beta.0",
|
|
43
43
|
"apollo-cache": "1.3.5",
|
|
44
44
|
"apollo-client": "2.6.10",
|
|
45
45
|
"apollo-link": "1.2.14",
|
|
@@ -52,7 +52,6 @@
|
|
|
52
52
|
"graphql-tag": "2.12.6",
|
|
53
53
|
"invariant": "2.2.4",
|
|
54
54
|
"lodash": "4.17.21",
|
|
55
|
-
"nanoid": "3.3.4",
|
|
56
55
|
"pluralize": "8.0.0",
|
|
57
56
|
"prop-types": "15.8.1",
|
|
58
57
|
"raw.macro": "0.4.2",
|
|
@@ -64,7 +63,6 @@
|
|
|
64
63
|
"react-helmet": "6.1.0",
|
|
65
64
|
"react-hotkeyz": "1.0.4",
|
|
66
65
|
"react-virtualized": "9.22.3",
|
|
67
|
-
"shortid": "2.2.16",
|
|
68
66
|
"timeago-react": "2.0.1",
|
|
69
67
|
"use-deep-compare-effect": "1.8.1"
|
|
70
68
|
},
|
|
@@ -74,12 +72,11 @@
|
|
|
74
72
|
"@babel/preset-env": "^7.16.4",
|
|
75
73
|
"@babel/preset-react": "^7.16.0",
|
|
76
74
|
"@babel/preset-typescript": "^7.16.0",
|
|
77
|
-
"@webiny/cli": "^5.
|
|
78
|
-
"@webiny/project-utils": "^5.
|
|
75
|
+
"@webiny/cli": "^5.33.0-beta.0",
|
|
76
|
+
"@webiny/project-utils": "^5.33.0-beta.0",
|
|
79
77
|
"babel-plugin-emotion": "^9.2.8",
|
|
80
78
|
"babel-plugin-lodash": "^3.3.4",
|
|
81
79
|
"babel-plugin-module-resolver": "^4.1.0",
|
|
82
|
-
"execa": "^5.0.0",
|
|
83
80
|
"rimraf": "^3.0.2",
|
|
84
81
|
"ttypescript": "^1.5.12",
|
|
85
82
|
"typescript": "4.7.4"
|
|
@@ -107,5 +104,5 @@
|
|
|
107
104
|
]
|
|
108
105
|
}
|
|
109
106
|
},
|
|
110
|
-
"gitHead": "
|
|
107
|
+
"gitHead": "8809a70796e5117e92416d6859c1f5dcae2a8c98"
|
|
111
108
|
}
|
package/types.d.ts
CHANGED
package/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import * as React from \"react\";\nimport { Plugin } from \"@webiny/plugins/types\";\nimport { ReactElement, ReactNode } from \"react\";\nimport {\n FormRenderPropParams,\n FormAPI,\n BindComponent as BaseBindComponent,\n BindComponentRenderProp as BaseBindComponentRenderProp,\n BindComponentProps as BaseBindComponentProps\n} from \"@webiny/form\";\nimport { ApolloClient } from \"apollo-client\";\nimport { IconPrefix, IconName } from \"@fortawesome/fontawesome-svg-core\";\nimport Label from \"./admin/components/ContentEntryForm/Label\";\nimport { SecurityPermission } from \"@webiny/app-security/types\";\n\ninterface QueryFieldParams {\n field: CmsEditorField;\n}\n\nexport interface CmsEditorFieldTypePlugin extends Plugin {\n /**\n * a plugin type\n */\n type: \"cms-editor-field-type\";\n field: {\n /**\n * A unique identifier of the field type (text, number, json, myField, ...).\n *\n * ```ts\n * type: \"myField\"\n * ```\n */\n type: string;\n /**\n * A display name for the field.\n *\n * ```ts\n * label: \"Field name\"\n * ```\n */\n label: string;\n /**\n * A list of available validators for the model field.\n *\n * ```ts\n * validators: [\n * \"required\",\n * \"gte\",\n * \"lte\"\n * ]\n * ```\n */\n validators?: string[];\n /**\n * A list of available validators when a model field accepts a list (array) of values.\n *\n * ```ts\n * listValidators: [\n * \"minLength\",\n * \"maxLength\"\n * ]\n * ```\n */\n listValidators?: string[];\n /**\n * An explanation of the field displayed beneath the label.\n *\n * ```ts\n * description: \"A short description of the field\"\n * ```\n */\n description: string;\n /**\n * A ReactNode to display the icon for the field.\n *\n * ```tsx\n * icon: <MyIconComponent />\n * ```\n */\n icon: React.ReactNode;\n /**\n * Is it allowed to have multiple values in this field?\n *\n * ```ts\n * allowMultipleValues: true\n * ```\n */\n allowMultipleValues: boolean;\n /**\n * Does this field type have a fixed list of values that can be selected?\n *\n * ```ts\n * allowPredefinedValues: false\n * ```\n */\n allowPredefinedValues: boolean;\n /**\n * A ReactNode label when multiple values are enabled.\n */\n multipleValuesLabel: React.ReactNode;\n /**\n * These are default values when the field is first created. This is a representation of the field that is stored in the database.\n *\n * ```ts\n * createField: () => ({\n * type: \"fieldType\",\n * validation: [],\n * renderer: {\n * name: \"fieldTypeRenderer\"\n * }\n * })\n * ```\n */\n createField: () => Pick<CmsEditorField, \"type\" | \"validation\" | \"renderer\" | \"settings\">;\n /**\n * A ReactNode that you can add in the section below the help text when creating/editing field.\n *\n * ```tsx\n * renderSettings: (params) => {\n * return <FieldSettingsComponent />;\n * }\n * ```\n */\n renderSettings?: (params: {\n form: FormRenderPropParams;\n afterChangeLabel: (value: string) => void;\n uniqueFieldIdValidator: (fieldId: string) => void;\n contentModel: CmsEditorContentModel;\n }) => React.ReactNode;\n /**\n * A ReactNode that renders in the Predefined values tab.\n *\n * ```tsx\n * renderPredefinedValues: (params) => {\n * const {form: {Bind}} = params;\n * return (\n * <Bind name=\"fieldProperty\">\n * <InputComponent />\n * </Bind>\n * );\n * }\n * ```\n */\n renderPredefinedValues?: (params: {\n form: FormRenderPropParams;\n field: CmsEditorField;\n getBind: (index?: number) => any;\n }) => React.ReactElement;\n /**\n * Object wrapper for GraphQL stuff\n */\n graphql?: {\n /**\n * Define field selection.\n *\n * ```ts\n * graphql: {\n * queryField: `\n * {\n * id\n * title\n * createdOn\n * }\n * `,\n * }\n * ```\n */\n queryField?: string | ((params: QueryFieldParams) => string);\n };\n render?(params: any): React.ReactElement;\n };\n}\n\nexport interface CmsEditorFieldRendererProps {\n field: CmsEditorField;\n Label: typeof Label;\n getBind: (index?: number, key?: string) => BindComponent;\n contentModel: CmsEditorContentModel;\n}\n\nexport interface CmsEditorFieldRendererPlugin extends Plugin {\n /**\n * a plugin type\n */\n type: \"cms-editor-field-renderer\";\n renderer: {\n /**\n * Name of the renderer to match the one from `createField()` method in `CmsEditorFieldTypePlugin`.\n *\n * ```ts\n * renderName: \"myFieldTypeRenderer\"\n * ```\n */\n rendererName: string;\n /**\n * A display name for the field in the UI. It is a `ReactNode` type so you can return a component if you want to.\n *\n * ```tsx\n * name: <MyFieldNameComponent />\n * ```\n */\n name: React.ReactNode;\n /**\n * A description for the field in the UI. Works exactly like the `name` property.\n *\n * ```tsx\n * name: <MyFieldDescriptionComponent />\n * ```\n */\n description: React.ReactNode;\n /**\n * A method that determines if the field can be rendered by this plugin.\n *\n * ```ts\n * canUse({ field }) {\n * return (\n * field.type === \"myType\" && !field.multipleValues\n * );\n * }\n * ```\n */\n canUse(props: { field: CmsEditorField }): boolean;\n /**\n * Renders a field in the UI.\n *\n * ```tsx\n * render({ field, getBind }) {\n * const Bind = getBind();\n *\n * return (\n * <Bind>\n * {bind => {\n * return (\n * <Input\n * value={bind.value}\n * onChange={bind.onChange}\n * />\n * )\n * }}\n * </Bind>\n * );\n * }\n * ```\n */\n render(props: CmsEditorFieldRendererProps): React.ReactNode;\n };\n}\n\nexport interface CmsEditorFieldPredefinedValuesEntry {\n label: string;\n value: string;\n selected?: boolean;\n}\n\nexport interface CmsEditorFieldPredefinedValues {\n enabled: boolean;\n values: CmsEditorFieldPredefinedValuesEntry[];\n}\n\nexport type CmsEditorField<T = unknown> = T & {\n id: string;\n type: string;\n fieldId: CmsEditorFieldId;\n label?: string;\n helpText?: string;\n placeholderText?: string;\n validation?: CmsEditorFieldValidator[];\n listValidation?: CmsEditorFieldValidator[];\n multipleValues?: boolean;\n predefinedValues?: CmsEditorFieldPredefinedValues;\n settings?: {\n defaultValue?: string | null | undefined;\n defaultSetValue?: string;\n type?: string;\n fields?: CmsEditorField<any>[];\n layout?: string[][];\n models?: Pick<CmsModel, \"modelId\" | \"name\">[];\n imagesOnly?: boolean;\n [key: string]: any;\n };\n renderer: {\n name: string;\n };\n};\n\nexport type CmsEditorFieldId = string;\nexport type CmsEditorFieldsLayout = CmsEditorFieldId[][];\n\nexport interface CmsEditorContentModel {\n id: string;\n group: Pick<CmsGroup, \"id\" | \"name\">;\n description?: string;\n version: number;\n layout?: CmsEditorFieldsLayout;\n fields: CmsEditorField[];\n lockedFields: CmsEditorField[];\n name: string;\n modelId: string;\n titleFieldId: string;\n settings: {\n [key: string]: any;\n };\n status: string;\n savedOn: string;\n meta: any;\n createdBy: CmsCreatedBy;\n /**\n * If model is a plugin one (it cannot be changed/deleted)\n */\n plugin?: boolean;\n}\n\nexport type CmsContentEntryStatusType =\n | \"draft\"\n | \"published\"\n | \"unpublished\"\n | \"changesRequested\"\n | \"reviewRequested\";\n\nexport interface CmsEditorContentEntry {\n id: string;\n savedOn: string;\n modelId: string;\n createdBy: CmsCreatedBy;\n meta: {\n title: string;\n publishedOn: string;\n locked: boolean;\n status: CmsContentEntryStatusType;\n version: number;\n };\n [key: string]: any;\n}\n\nexport interface CmsContentEntryRevision {\n id: string;\n savedOn: string;\n modelId: string;\n createdBy: CmsCreatedBy;\n meta: {\n title: string;\n publishedOn: string;\n locked: boolean;\n status: CmsContentEntryStatusType;\n version: number;\n };\n}\n\nexport interface CmsEditorFieldValidator {\n name: string;\n message: string;\n settings: any;\n}\n\nexport interface CmsEditorFieldValidatorPluginValidator {\n name: string;\n label: string;\n description: string;\n defaultMessage: string;\n defaultSettings?: Record<string, any>;\n renderSettings?: (props: {\n field: CmsEditorField;\n Bind: BindComponent;\n setValue: (name: string, value: any) => void;\n setMessage: (message: string) => void;\n data: CmsEditorFieldValidator;\n }) => React.ReactElement;\n}\nexport interface CmsEditorFieldValidatorPlugin extends Plugin {\n type: \"cms-editor-field-validator\";\n validator: CmsEditorFieldValidatorPluginValidator;\n}\n\nexport type CmsEditorContentTab = React.FC<{ activeTab: boolean }>;\n\n// ------------------------------------------------------------------------------------------------------------\nexport interface CmsEditorFieldOptionPlugin extends Plugin {\n type: \"cms-editor-field-option\";\n render(): ReactElement;\n}\n\nexport interface CmsContentDetailsPlugin extends Plugin {\n render: (params: any) => ReactNode;\n}\n\nexport interface CmsContentDetailsRevisionContentPlugin extends Plugin {\n type: \"cms-content-details-revision-content\";\n render(params: any): ReactElement;\n}\n\nexport interface CmsEditorFieldValidatorPatternPlugin extends Plugin {\n type: \"cms-editor-field-validator-pattern\";\n pattern: {\n name: string;\n message: string;\n label: string;\n };\n}\n\nexport interface CmsFieldValidator {\n name: string;\n message: any;\n settings: any;\n}\n\nexport interface CmsModelFieldValidatorPlugin<T = any> extends Plugin {\n type: \"cms-model-field-validator\";\n validator: {\n name: string;\n validate: (value: T, validator: CmsFieldValidator) => Promise<any>;\n };\n}\n\n/**\n * @category Plugin\n * @category ContentModelField\n * @category FieldValidation\n */\nexport interface CmsModelFieldValidatorPatternPlugin extends Plugin {\n /**\n * A plugin type\n */\n type: \"cms-model-field-validator-pattern\";\n /**\n * A pattern object for the validator.\n */\n pattern: {\n /**\n * name of the pattern.\n */\n name: string;\n /**\n * RegExp of the validator.\n */\n regex: string;\n /**\n * RegExp flags\n */\n flags: string;\n };\n}\n\nexport interface FieldLayoutPosition {\n row: number;\n index: number | null;\n}\n\nexport interface CmsEditorFormSettingsPlugin extends Plugin {\n type: \"cms-editor-form-settings\";\n title: string;\n description: string;\n icon: React.ReactElement;\n render(props: { Bind: BaseBindComponent; form: FormAPI; formData: any }): React.ReactNode;\n renderHeaderActions?(props: {\n Bind: BaseBindComponent;\n form: FormAPI;\n formData: any;\n }): React.ReactNode;\n}\n\nexport interface CmsIcon {\n /**\n * [ pack, icon ], ex: [\"fab\", \"cog\"]\n */\n id: [IconPrefix, IconName];\n /**\n * Icon name\n */\n name: string;\n /**\n * SVG element\n */\n svg: ReactElement;\n}\n\nexport interface CmsIconsPlugin extends Plugin {\n type: \"cms-icons\";\n getIcons(): CmsIcon[];\n}\n\nexport interface UseContentModelEditorReducerState {\n apolloClient: ApolloClient<any>;\n id: string;\n}\n\n/**\n * Transform field value when sending data to the API.\n */\nexport interface CmsFieldValueTransformer extends Plugin {\n /**\n * A plugin type.\n */\n type: \"cms-field-value-transformer\";\n /**\n * A field type for the value transformer. Or a list of field types.\n */\n fieldType: string | string[];\n /**\n * A transformer function that takes a value and returns a new one.\n */\n transform: (value: any, field: CmsEditorField) => any;\n}\n\n/**\n * Define a custom form layout renderer for a specific content model.\n */\nexport interface CmsContentFormRendererPlugin extends Plugin {\n /**\n * A plugin type.\n */\n type: \"cms-content-form-renderer\";\n /**\n * Content model ID that will use this renderer.\n */\n modelId: string;\n\n /**\n * A function that will render a custom form layout.\n */\n render(props: {\n /**\n * Content model that is being rendered.\n */\n contentModel: CmsEditorContentModel;\n /**\n * Content entry data handled by the Form element.\n */\n data: Record<string, any>;\n /**\n * A component to bind data to the Form.\n */\n Bind: BindComponent;\n /**\n * Content model fields to render.\n */\n fields: Record<string, React.ReactElement>;\n }): React.ReactNode;\n}\n/**\n * #########################\n * Data types\n * #########################\n */\nexport interface CmsSecurityPermission extends SecurityPermission {\n accessLevel?: \"full\" | \"no\" | \"custom\";\n models?: Record<string, string>;\n groups?: Record<string, string>;\n endpoints?: string[];\n locales?: string[];\n rwd?: string;\n own?: boolean;\n pw?: string;\n}\nexport interface CmsCreatedBy {\n id: string;\n displayName: string;\n type: string;\n}\n/**\n * @category GraphQL\n * @category Model\n */\nexport type CmsModel = CmsEditorContentModel;\n/**\n * @category GraphQL\n * @category Group\n */\nexport interface CmsGroup {\n id: string;\n name: string;\n slug: string;\n icon?: string;\n description?: string;\n contentModels: CmsModel[];\n createdBy: CmsCreatedBy;\n /**\n * Tells if this group is a plugin one (cannot be changed/deleted)\n */\n plugin?: boolean;\n}\n/**\n * @category GraphQL\n * @category Error\n */\nexport interface CmsErrorResponse {\n message: string;\n code: string;\n data: Record<string, any> | Record<string, any>[];\n}\n/**\n * @category GraphQL\n * @category Meta\n */\nexport interface CmsMetaResponse {\n totalCount: number;\n cursor: string | null;\n hasMoreItems: boolean;\n}\n\n/***\n * ###### FORM ########\n */\nexport interface BindComponentRenderProp extends BaseBindComponentRenderProp {\n parentName: string;\n appendValue: (value: any) => void;\n prependValue: (value: any) => void;\n appendValues: (values: any[]) => void;\n removeValue: (index: number) => void;\n moveValueUp: (index: number) => void;\n moveValueDown: (index: number) => void;\n}\n\ninterface BindComponentProps extends Omit<BaseBindComponentProps, \"children\" | \"name\"> {\n name?: string;\n children?: ((props: BindComponentRenderProp) => React.ReactElement) | React.ReactElement;\n}\n\nexport type BindComponent = React.FC<BindComponentProps> & {\n parentName?: string;\n};\n"],"mappings":""}
|
|
1
|
+
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import * as React from \"react\";\nimport { Plugin } from \"@webiny/plugins/types\";\nimport { ReactElement, ReactNode } from \"react\";\nimport {\n FormRenderPropParams,\n FormAPI,\n BindComponent as BaseBindComponent,\n BindComponentRenderProp as BaseBindComponentRenderProp,\n BindComponentProps as BaseBindComponentProps\n} from \"@webiny/form\";\nimport { ApolloClient } from \"apollo-client\";\nimport { IconPrefix, IconName } from \"@fortawesome/fontawesome-svg-core\";\nimport Label from \"./admin/components/ContentEntryForm/Label\";\nimport { SecurityPermission } from \"@webiny/app-security/types\";\n\ninterface QueryFieldParams {\n field: CmsEditorField;\n}\n\nexport interface CmsEditorFieldTypePlugin extends Plugin {\n /**\n * a plugin type\n */\n type: \"cms-editor-field-type\";\n field: {\n /**\n * A unique identifier of the field type (text, number, json, myField, ...).\n *\n * ```ts\n * type: \"myField\"\n * ```\n */\n type: string;\n /**\n * A display name for the field.\n *\n * ```ts\n * label: \"Field name\"\n * ```\n */\n label: string;\n /**\n * A list of available validators for the model field.\n *\n * ```ts\n * validators: [\n * \"required\",\n * \"gte\",\n * \"lte\"\n * ]\n * ```\n */\n validators?: string[];\n /**\n * A list of available validators when a model field accepts a list (array) of values.\n *\n * ```ts\n * listValidators: [\n * \"minLength\",\n * \"maxLength\"\n * ]\n * ```\n */\n listValidators?: string[];\n /**\n * An explanation of the field displayed beneath the label.\n *\n * ```ts\n * description: \"A short description of the field\"\n * ```\n */\n description: string;\n /**\n * A ReactNode to display the icon for the field.\n *\n * ```tsx\n * icon: <MyIconComponent />\n * ```\n */\n icon: React.ReactNode;\n /**\n * Is it allowed to have multiple values in this field?\n *\n * ```ts\n * allowMultipleValues: true\n * ```\n */\n allowMultipleValues: boolean;\n /**\n * Does this field type have a fixed list of values that can be selected?\n *\n * ```ts\n * allowPredefinedValues: false\n * ```\n */\n allowPredefinedValues: boolean;\n /**\n * A ReactNode label when multiple values are enabled.\n */\n multipleValuesLabel: React.ReactNode;\n /**\n * These are default values when the field is first created. This is a representation of the field that is stored in the database.\n *\n * ```ts\n * createField: () => ({\n * type: \"fieldType\",\n * validation: [],\n * renderer: {\n * name: \"fieldTypeRenderer\"\n * }\n * })\n * ```\n */\n createField: () => Pick<CmsEditorField, \"type\" | \"validation\" | \"renderer\" | \"settings\">;\n /**\n * A ReactNode that you can add in the section below the help text when creating/editing field.\n *\n * ```tsx\n * renderSettings: (params) => {\n * return <FieldSettingsComponent />;\n * }\n * ```\n */\n renderSettings?: (params: {\n form: FormRenderPropParams;\n afterChangeLabel: (value: string) => void;\n uniqueFieldIdValidator: (fieldId: string) => void;\n contentModel: CmsEditorContentModel;\n }) => React.ReactNode;\n /**\n * A ReactNode that renders in the Predefined values tab.\n *\n * ```tsx\n * renderPredefinedValues: (params) => {\n * const {form: {Bind}} = params;\n * return (\n * <Bind name=\"fieldProperty\">\n * <InputComponent />\n * </Bind>\n * );\n * }\n * ```\n */\n renderPredefinedValues?: (params: {\n form: FormRenderPropParams;\n field: CmsEditorField;\n getBind: (index?: number) => any;\n }) => React.ReactElement;\n /**\n * Object wrapper for GraphQL stuff\n */\n graphql?: {\n /**\n * Define field selection.\n *\n * ```ts\n * graphql: {\n * queryField: `\n * {\n * id\n * title\n * createdOn\n * }\n * `,\n * }\n * ```\n */\n queryField?: string | ((params: QueryFieldParams) => string);\n };\n render?(params: any): React.ReactElement;\n };\n}\n\nexport interface CmsEditorFieldRendererProps {\n field: CmsEditorField;\n Label: typeof Label;\n getBind: (index?: number, key?: string) => BindComponent;\n contentModel: CmsEditorContentModel;\n}\n\nexport interface CmsEditorFieldRendererPlugin extends Plugin {\n /**\n * a plugin type\n */\n type: \"cms-editor-field-renderer\";\n renderer: {\n /**\n * Name of the renderer to match the one from `createField()` method in `CmsEditorFieldTypePlugin`.\n *\n * ```ts\n * renderName: \"myFieldTypeRenderer\"\n * ```\n */\n rendererName: string;\n /**\n * A display name for the field in the UI. It is a `ReactNode` type so you can return a component if you want to.\n *\n * ```tsx\n * name: <MyFieldNameComponent />\n * ```\n */\n name: React.ReactNode;\n /**\n * A description for the field in the UI. Works exactly like the `name` property.\n *\n * ```tsx\n * name: <MyFieldDescriptionComponent />\n * ```\n */\n description: React.ReactNode;\n /**\n * A method that determines if the field can be rendered by this plugin.\n *\n * ```ts\n * canUse({ field }) {\n * return (\n * field.type === \"myType\" && !field.multipleValues\n * );\n * }\n * ```\n */\n canUse(props: { field: CmsEditorField }): boolean;\n /**\n * Renders a field in the UI.\n *\n * ```tsx\n * render({ field, getBind }) {\n * const Bind = getBind();\n *\n * return (\n * <Bind>\n * {bind => {\n * return (\n * <Input\n * value={bind.value}\n * onChange={bind.onChange}\n * />\n * )\n * }}\n * </Bind>\n * );\n * }\n * ```\n */\n render(props: CmsEditorFieldRendererProps): React.ReactNode;\n };\n}\n\nexport interface CmsEditorFieldPredefinedValuesEntry {\n label: string;\n value: string;\n selected?: boolean;\n}\n\nexport interface CmsEditorFieldPredefinedValues {\n enabled: boolean;\n values: CmsEditorFieldPredefinedValuesEntry[];\n}\n\nexport type CmsEditorField<T = unknown> = T & {\n id: string;\n type: string;\n fieldId: CmsEditorFieldId;\n storageId?: string;\n label?: string;\n helpText?: string;\n placeholderText?: string;\n validation?: CmsEditorFieldValidator[];\n listValidation?: CmsEditorFieldValidator[];\n multipleValues?: boolean;\n predefinedValues?: CmsEditorFieldPredefinedValues;\n settings?: {\n defaultValue?: string | null | undefined;\n defaultSetValue?: string;\n type?: string;\n fields?: CmsEditorField<any>[];\n layout?: string[][];\n models?: Pick<CmsModel, \"modelId\" | \"name\">[];\n imagesOnly?: boolean;\n [key: string]: any;\n };\n renderer: {\n name: string;\n };\n};\n\nexport type CmsEditorFieldId = string;\nexport type CmsEditorFieldsLayout = CmsEditorFieldId[][];\n\nexport interface CmsEditorContentModel {\n id: string;\n group: Pick<CmsGroup, \"id\" | \"name\">;\n description?: string;\n version: number;\n layout?: CmsEditorFieldsLayout;\n fields: CmsEditorField[];\n lockedFields: CmsEditorField[];\n name: string;\n modelId: string;\n titleFieldId: string;\n settings: {\n [key: string]: any;\n };\n status: string;\n savedOn: string;\n meta: any;\n createdBy: CmsCreatedBy;\n /**\n * If model is a plugin one (it cannot be changed/deleted)\n */\n plugin?: boolean;\n}\n\nexport type CmsContentEntryStatusType =\n | \"draft\"\n | \"published\"\n | \"unpublished\"\n | \"changesRequested\"\n | \"reviewRequested\";\n\nexport interface CmsEditorContentEntry {\n id: string;\n savedOn: string;\n modelId: string;\n createdBy: CmsCreatedBy;\n meta: {\n title: string;\n publishedOn: string;\n locked: boolean;\n status: CmsContentEntryStatusType;\n version: number;\n };\n [key: string]: any;\n}\n\nexport interface CmsContentEntryRevision {\n id: string;\n savedOn: string;\n modelId: string;\n createdBy: CmsCreatedBy;\n meta: {\n title: string;\n publishedOn: string;\n locked: boolean;\n status: CmsContentEntryStatusType;\n version: number;\n };\n}\n\nexport interface CmsEditorFieldValidator {\n name: string;\n message: string;\n settings: any;\n}\n\nexport interface CmsEditorFieldValidatorPluginValidator {\n name: string;\n label: string;\n description: string;\n defaultMessage: string;\n defaultSettings?: Record<string, any>;\n renderSettings?: (props: {\n field: CmsEditorField;\n Bind: BindComponent;\n setValue: (name: string, value: any) => void;\n setMessage: (message: string) => void;\n data: CmsEditorFieldValidator;\n }) => React.ReactElement;\n}\nexport interface CmsEditorFieldValidatorPlugin extends Plugin {\n type: \"cms-editor-field-validator\";\n validator: CmsEditorFieldValidatorPluginValidator;\n}\n\nexport type CmsEditorContentTab = React.FC<{ activeTab: boolean }>;\n\n// ------------------------------------------------------------------------------------------------------------\nexport interface CmsEditorFieldOptionPlugin extends Plugin {\n type: \"cms-editor-field-option\";\n render(): ReactElement;\n}\n\nexport interface CmsContentDetailsPlugin extends Plugin {\n render: (params: any) => ReactNode;\n}\n\nexport interface CmsContentDetailsRevisionContentPlugin extends Plugin {\n type: \"cms-content-details-revision-content\";\n render(params: any): ReactElement;\n}\n\nexport interface CmsEditorFieldValidatorPatternPlugin extends Plugin {\n type: \"cms-editor-field-validator-pattern\";\n pattern: {\n name: string;\n message: string;\n label: string;\n };\n}\n\nexport interface CmsFieldValidator {\n name: string;\n message: any;\n settings: any;\n}\n\nexport interface CmsModelFieldValidatorPlugin<T = any> extends Plugin {\n type: \"cms-model-field-validator\";\n validator: {\n name: string;\n validate: (value: T, validator: CmsFieldValidator) => Promise<any>;\n };\n}\n\n/**\n * @category Plugin\n * @category ContentModelField\n * @category FieldValidation\n */\nexport interface CmsModelFieldValidatorPatternPlugin extends Plugin {\n /**\n * A plugin type\n */\n type: \"cms-model-field-validator-pattern\";\n /**\n * A pattern object for the validator.\n */\n pattern: {\n /**\n * name of the pattern.\n */\n name: string;\n /**\n * RegExp of the validator.\n */\n regex: string;\n /**\n * RegExp flags\n */\n flags: string;\n };\n}\n\nexport interface FieldLayoutPosition {\n row: number;\n index: number | null;\n}\n\nexport interface CmsEditorFormSettingsPlugin extends Plugin {\n type: \"cms-editor-form-settings\";\n title: string;\n description: string;\n icon: React.ReactElement;\n render(props: { Bind: BaseBindComponent; form: FormAPI; formData: any }): React.ReactNode;\n renderHeaderActions?(props: {\n Bind: BaseBindComponent;\n form: FormAPI;\n formData: any;\n }): React.ReactNode;\n}\n\nexport interface CmsIcon {\n /**\n * [ pack, icon ], ex: [\"fab\", \"cog\"]\n */\n id: [IconPrefix, IconName];\n /**\n * Icon name\n */\n name: string;\n /**\n * SVG element\n */\n svg: ReactElement;\n}\n\nexport interface CmsIconsPlugin extends Plugin {\n type: \"cms-icons\";\n getIcons(): CmsIcon[];\n}\n\nexport interface UseContentModelEditorReducerState {\n apolloClient: ApolloClient<any>;\n id: string;\n}\n\n/**\n * Transform field value when sending data to the API.\n */\nexport interface CmsFieldValueTransformer extends Plugin {\n /**\n * A plugin type.\n */\n type: \"cms-field-value-transformer\";\n /**\n * A field type for the value transformer. Or a list of field types.\n */\n fieldType: string | string[];\n /**\n * A transformer function that takes a value and returns a new one.\n */\n transform: (value: any, field: CmsEditorField) => any;\n}\n\n/**\n * Define a custom form layout renderer for a specific content model.\n */\nexport interface CmsContentFormRendererPlugin extends Plugin {\n /**\n * A plugin type.\n */\n type: \"cms-content-form-renderer\";\n /**\n * Content model ID that will use this renderer.\n */\n modelId: string;\n\n /**\n * A function that will render a custom form layout.\n */\n render(props: {\n /**\n * Content model that is being rendered.\n */\n contentModel: CmsEditorContentModel;\n /**\n * Content entry data handled by the Form element.\n */\n data: Record<string, any>;\n /**\n * A component to bind data to the Form.\n */\n Bind: BindComponent;\n /**\n * Content model fields to render.\n */\n fields: Record<string, React.ReactElement>;\n }): React.ReactNode;\n}\n/**\n * #########################\n * Data types\n * #########################\n */\nexport interface CmsSecurityPermission extends SecurityPermission {\n accessLevel?: \"full\" | \"no\" | \"custom\";\n models?: Record<string, string>;\n groups?: Record<string, string>;\n endpoints?: string[];\n locales?: string[];\n rwd?: string;\n own?: boolean;\n pw?: string;\n}\nexport interface CmsCreatedBy {\n id: string;\n displayName: string;\n type: string;\n}\n/**\n * @category GraphQL\n * @category Model\n */\nexport type CmsModel = CmsEditorContentModel;\n/**\n * @category GraphQL\n * @category Group\n */\nexport interface CmsGroup {\n id: string;\n name: string;\n slug: string;\n icon?: string;\n description?: string;\n contentModels: CmsModel[];\n createdBy: CmsCreatedBy;\n /**\n * Tells if this group is a plugin one (cannot be changed/deleted)\n */\n plugin?: boolean;\n}\n/**\n * @category GraphQL\n * @category Error\n */\nexport interface CmsErrorResponse {\n message: string;\n code: string;\n data: Record<string, any> | Record<string, any>[];\n}\n/**\n * @category GraphQL\n * @category Meta\n */\nexport interface CmsMetaResponse {\n totalCount: number;\n cursor: string | null;\n hasMoreItems: boolean;\n}\n\n/***\n * ###### FORM ########\n */\nexport interface BindComponentRenderProp extends BaseBindComponentRenderProp {\n parentName: string;\n appendValue: (value: any) => void;\n prependValue: (value: any) => void;\n appendValues: (values: any[]) => void;\n removeValue: (index: number) => void;\n moveValueUp: (index: number) => void;\n moveValueDown: (index: number) => void;\n}\n\ninterface BindComponentProps extends Omit<BaseBindComponentProps, \"children\" | \"name\"> {\n name?: string;\n children?: ((props: BindComponentRenderProp) => React.ReactElement) | React.ReactElement;\n}\n\nexport type BindComponent = React.FC<BindComponentProps> & {\n parentName?: string;\n};\n"],"mappings":""}
|