@webiny/app-headless-cms 0.0.0-unstable.496cf268ac → 0.0.0-unstable.606fc9c866

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.
Files changed (153) hide show
  1. package/admin/components/ContentEntryForm/useRenderPlugins.d.ts +1 -2
  2. package/admin/components/Dialog.js +1 -1
  3. package/admin/components/Dialog.js.map +1 -1
  4. package/admin/components/FieldEditor/EditFieldDialog/GeneralTab.js +1 -1
  5. package/admin/components/FieldEditor/EditFieldDialog/GeneralTab.js.map +1 -1
  6. package/admin/components/IconPicker.js +16 -12
  7. package/admin/components/IconPicker.js.map +1 -1
  8. package/admin/hooks/index.d.ts +1 -0
  9. package/admin/hooks/index.js +12 -0
  10. package/admin/hooks/index.js.map +1 -1
  11. package/admin/hooks/useContentModels.d.ts +8 -0
  12. package/admin/hooks/useContentModels.js +9 -2
  13. package/admin/hooks/useContentModels.js.map +1 -1
  14. package/admin/menus/ContentGroupsMenuItems.js +1 -2
  15. package/admin/menus/ContentGroupsMenuItems.js.map +1 -1
  16. package/admin/plugins/fieldRenderers/boolean/index.d.ts +1 -1
  17. package/admin/plugins/fieldRenderers/dateTime/index.d.ts +1 -1
  18. package/admin/plugins/fieldRenderers/dynamicZone/AddTemplate.d.ts +3 -3
  19. package/admin/plugins/fieldRenderers/dynamicZone/AddTemplate.js.map +1 -1
  20. package/admin/plugins/fieldRenderers/dynamicZone/MultiValueDynamicZone.d.ts +4 -4
  21. package/admin/plugins/fieldRenderers/dynamicZone/MultiValueDynamicZone.js.map +1 -1
  22. package/admin/plugins/fieldRenderers/dynamicZone/SingleValueDynamicZone.d.ts +4 -4
  23. package/admin/plugins/fieldRenderers/dynamicZone/SingleValueDynamicZone.js.map +1 -1
  24. package/admin/plugins/fieldRenderers/dynamicZone/TemplateCard.d.ts +2 -2
  25. package/admin/plugins/fieldRenderers/dynamicZone/TemplateCard.js.map +1 -1
  26. package/admin/plugins/fieldRenderers/dynamicZone/TemplateGallery.d.ts +2 -2
  27. package/admin/plugins/fieldRenderers/dynamicZone/TemplateGallery.js.map +1 -1
  28. package/admin/plugins/fieldRenderers/dynamicZone/TemplateIcon.d.ts +2 -2
  29. package/admin/plugins/fieldRenderers/dynamicZone/TemplateIcon.js.map +1 -1
  30. package/admin/plugins/fieldRenderers/dynamicZone/dynamicZoneRenderer.js.map +1 -1
  31. package/admin/plugins/fieldRenderers/file/index.d.ts +1 -1
  32. package/admin/plugins/fieldRenderers/longText/index.d.ts +1 -1
  33. package/admin/plugins/fieldRenderers/number/index.d.ts +1 -1
  34. package/admin/plugins/fieldRenderers/object/index.d.ts +1 -1
  35. package/admin/plugins/fieldRenderers/object/multipleObjects.js.map +1 -1
  36. package/admin/plugins/fieldRenderers/object/multipleObjectsAccordion.js.map +1 -1
  37. package/admin/plugins/fieldRenderers/ref/advanced/components/AdvancedMultipleReferenceField.d.ts +2 -2
  38. package/admin/plugins/fieldRenderers/ref/advanced/components/AdvancedMultipleReferenceField.js +5 -3
  39. package/admin/plugins/fieldRenderers/ref/advanced/components/AdvancedMultipleReferenceField.js.map +1 -1
  40. package/admin/plugins/fieldRenderers/ref/advanced/components/AdvancedSingleReferenceField.d.ts +2 -2
  41. package/admin/plugins/fieldRenderers/ref/advanced/components/AdvancedSingleReferenceField.js +1 -5
  42. package/admin/plugins/fieldRenderers/ref/advanced/components/AdvancedSingleReferenceField.js.map +1 -1
  43. package/admin/plugins/fieldRenderers/ref/advanced/components/Entries.js +4 -3
  44. package/admin/plugins/fieldRenderers/ref/advanced/components/Entries.js.map +1 -1
  45. package/admin/plugins/fieldRenderers/ref/advanced/components/NewReferencedEntryDialog.js +3 -3
  46. package/admin/plugins/fieldRenderers/ref/advanced/components/NewReferencedEntryDialog.js.map +1 -1
  47. package/admin/plugins/fieldRenderers/ref/advanced/components/ReferencesDialog.d.ts +2 -2
  48. package/admin/plugins/fieldRenderers/ref/advanced/components/ReferencesDialog.js +1 -1
  49. package/admin/plugins/fieldRenderers/ref/advanced/components/ReferencesDialog.js.map +1 -1
  50. package/admin/plugins/fieldRenderers/ref/advanced/components/options/OptionsModelList.js +1 -1
  51. package/admin/plugins/fieldRenderers/ref/advanced/components/options/OptionsModelList.js.map +1 -1
  52. package/admin/plugins/fieldRenderers/ref/advanced/hooks/graphql.js +1 -5
  53. package/admin/plugins/fieldRenderers/ref/advanced/hooks/graphql.js.map +1 -1
  54. package/admin/plugins/fieldRenderers/ref/advanced/index.d.ts +1 -1
  55. package/admin/plugins/fieldRenderers/ref/components/NewRefEntryFormDialog.d.ts +2 -2
  56. package/admin/plugins/fieldRenderers/ref/components/NewRefEntryFormDialog.js +3 -3
  57. package/admin/plugins/fieldRenderers/ref/components/NewRefEntryFormDialog.js.map +1 -1
  58. package/admin/plugins/fieldRenderers/ref/index.d.ts +1 -1
  59. package/admin/plugins/fieldRenderers/richText/index.d.ts +1 -1
  60. package/admin/plugins/fieldRenderers/text/index.d.ts +1 -1
  61. package/admin/plugins/fields/dynamicZone/AddTemplate.d.ts +3 -3
  62. package/admin/plugins/fields/dynamicZone/AddTemplate.js.map +1 -1
  63. package/admin/plugins/fields/dynamicZone/DynamicZone.d.ts +2 -2
  64. package/admin/plugins/fields/dynamicZone/DynamicZone.js.map +1 -1
  65. package/admin/plugins/fields/dynamicZone/DynamicZoneTemplate.d.ts +2 -2
  66. package/admin/plugins/fields/dynamicZone/DynamicZoneTemplate.js.map +1 -1
  67. package/admin/plugins/fields/dynamicZone/TemplateDialog.d.ts +2 -2
  68. package/admin/plugins/fields/dynamicZone/TemplateDialog.js.map +1 -1
  69. package/admin/plugins/fields/dynamicZone.d.ts +2 -2
  70. package/admin/plugins/fields/dynamicZone.js +1 -1
  71. package/admin/plugins/fields/dynamicZone.js.map +1 -1
  72. package/admin/plugins/fields/object.js +3 -0
  73. package/admin/plugins/fields/object.js.map +1 -1
  74. package/admin/plugins/index.d.ts +2 -2
  75. package/admin/plugins/routes.js +2 -1
  76. package/admin/plugins/routes.js.map +1 -1
  77. package/admin/views/contentEntries/ContentEntries.js +8 -57
  78. package/admin/views/contentEntries/ContentEntries.js.map +1 -1
  79. package/admin/views/contentEntries/ContentEntriesContainer.d.ts +4 -0
  80. package/admin/views/contentEntries/ContentEntriesContainer.js +65 -0
  81. package/admin/views/contentEntries/ContentEntriesContainer.js.map +1 -0
  82. package/admin/views/contentEntries/ContentEntriesContext.d.ts +1 -1
  83. package/admin/views/contentEntries/ContentEntriesContext.js +4 -4
  84. package/admin/views/contentEntries/ContentEntriesContext.js.map +1 -1
  85. package/admin/views/contentEntries/ContentEntriesList.js +2 -3
  86. package/admin/views/contentEntries/ContentEntriesList.js.map +1 -1
  87. package/admin/views/contentEntries/ContentEntry/ContentEntryContext.d.ts +1 -1
  88. package/admin/views/contentEntries/ContentEntry/ContentEntryContext.js +4 -4
  89. package/admin/views/contentEntries/ContentEntry/ContentEntryContext.js.map +1 -1
  90. package/admin/views/contentEntries/experiment/ContentEntriesViewConfig.d.ts +2 -0
  91. package/admin/views/contentEntries/experiment/ContentEntriesViewConfig.js +36 -39
  92. package/admin/views/contentEntries/experiment/ContentEntriesViewConfig.js.map +1 -1
  93. package/admin/views/contentEntries/hooks/index.d.ts +3 -0
  94. package/admin/views/contentEntries/hooks/index.js +38 -0
  95. package/admin/views/contentEntries/hooks/index.js.map +1 -0
  96. package/admin/views/contentEntries/hooks/useContentEntriesList.d.ts +1 -1
  97. package/admin/views/contentModels/ContentModelsDataList.js +3 -3
  98. package/admin/views/contentModels/ContentModelsDataList.js.map +1 -1
  99. package/allPlugins.d.ts +2 -2
  100. package/package.json +20 -20
  101. package/types/index.d.ts +29 -14
  102. package/types/index.js.map +1 -1
  103. package/admin/plugins/upgrades/5.19.0/UpgradeItemsInfo.d.ts +0 -7
  104. package/admin/plugins/upgrades/5.19.0/UpgradeItemsInfo.js +0 -65
  105. package/admin/plugins/upgrades/5.19.0/UpgradeItemsInfo.js.map +0 -1
  106. package/admin/plugins/upgrades/5.19.0/createCmsApolloClient.d.ts +0 -7
  107. package/admin/plugins/upgrades/5.19.0/createCmsApolloClient.js +0 -67
  108. package/admin/plugins/upgrades/5.19.0/createCmsApolloClient.js.map +0 -1
  109. package/admin/plugins/upgrades/5.19.0/createListEntriesQuery.d.ts +0 -2
  110. package/admin/plugins/upgrades/5.19.0/createListEntriesQuery.js +0 -26
  111. package/admin/plugins/upgrades/5.19.0/createListEntriesQuery.js.map +0 -1
  112. package/admin/plugins/upgrades/5.19.0/createListModelsQuery.d.ts +0 -1
  113. package/admin/plugins/upgrades/5.19.0/createListModelsQuery.js +0 -20
  114. package/admin/plugins/upgrades/5.19.0/createListModelsQuery.js.map +0 -1
  115. package/admin/plugins/upgrades/5.19.0/createRepublishMutation.d.ts +0 -2
  116. package/admin/plugins/upgrades/5.19.0/createRepublishMutation.js +0 -23
  117. package/admin/plugins/upgrades/5.19.0/createRepublishMutation.js.map +0 -1
  118. package/admin/plugins/upgrades/5.19.0/createUpgradeMutation.d.ts +0 -1
  119. package/admin/plugins/upgrades/5.19.0/createUpgradeMutation.js +0 -20
  120. package/admin/plugins/upgrades/5.19.0/createUpgradeMutation.js.map +0 -1
  121. package/admin/plugins/upgrades/5.19.0/fetchModelEntries.d.ts +0 -7
  122. package/admin/plugins/upgrades/5.19.0/fetchModelEntries.js +0 -137
  123. package/admin/plugins/upgrades/5.19.0/fetchModelEntries.js.map +0 -1
  124. package/admin/plugins/upgrades/5.19.0/types.d.ts +0 -47
  125. package/admin/plugins/upgrades/5.19.0/types.js +0 -5
  126. package/admin/plugins/upgrades/5.19.0/types.js.map +0 -1
  127. package/admin/plugins/upgrades/5.33.0/locales.d.ts +0 -7
  128. package/admin/plugins/upgrades/5.33.0/locales.js +0 -65
  129. package/admin/plugins/upgrades/5.33.0/locales.js.map +0 -1
  130. package/admin/plugins/upgrades/5.33.0/types.d.ts +0 -7
  131. package/admin/plugins/upgrades/5.33.0/types.js +0 -5
  132. package/admin/plugins/upgrades/5.33.0/types.js.map +0 -1
  133. package/admin/plugins/upgrades/5.33.0/upgrade.d.ts +0 -8
  134. package/admin/plugins/upgrades/5.33.0/upgrade.js +0 -81
  135. package/admin/plugins/upgrades/5.33.0/upgrade.js.map +0 -1
  136. package/admin/plugins/upgrades/v5.0.0.d.ts +0 -5
  137. package/admin/plugins/upgrades/v5.0.0.js +0 -111
  138. package/admin/plugins/upgrades/v5.0.0.js.map +0 -1
  139. package/admin/plugins/upgrades/v5.19.0.d.ts +0 -5
  140. package/admin/plugins/upgrades/v5.19.0.js +0 -684
  141. package/admin/plugins/upgrades/v5.19.0.js.map +0 -1
  142. package/admin/plugins/upgrades/v5.33.0.d.ts +0 -6
  143. package/admin/plugins/upgrades/v5.33.0.js +0 -191
  144. package/admin/plugins/upgrades/v5.33.0.js.map +0 -1
  145. package/admin/plugins/upgrades/v5.5.0.d.ts +0 -5
  146. package/admin/plugins/upgrades/v5.5.0.js +0 -111
  147. package/admin/plugins/upgrades/v5.5.0.js.map +0 -1
  148. package/admin/plugins/upgrades/v5.8.0.d.ts +0 -5
  149. package/admin/plugins/upgrades/v5.8.0.js +0 -111
  150. package/admin/plugins/upgrades/v5.8.0.js.map +0 -1
  151. package/admin/views/contentEntries/experiment/Property.d.ts +0 -34
  152. package/admin/views/contentEntries/experiment/Property.js +0 -200
  153. package/admin/views/contentEntries/experiment/Property.js.map +0 -1
@@ -8,9 +8,9 @@ Object.defineProperty(exports, "__esModule", {
8
8
  exports.ContentEntriesViewRenderer = exports.ContentEntriesViewConfig = exports.ContentEntriesView = void 0;
9
9
  exports.useContentEntriesViewConfig = useContentEntriesViewConfig;
10
10
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
11
- var _appAdmin = require("@webiny/app-admin");
12
11
  var _react = _interopRequireWildcard(require("react"));
13
- var _Property = require("./Property");
12
+ var _appAdmin = require("@webiny/app-admin");
13
+ var _reactProperties = require("@webiny/react-properties");
14
14
  var ContentEntriesViewConfigApply = (0, _appAdmin.makeComposable)("ContentEntriesViewConfigApply", function (_ref) {
15
15
  var children = _ref.children;
16
16
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, children);
@@ -36,23 +36,31 @@ var Filter = function Filter(_ref4) {
36
36
  element = _ref4.element,
37
37
  _ref4$modelIds = _ref4.modelIds,
38
38
  modelIds = _ref4$modelIds === void 0 ? [] : _ref4$modelIds,
39
+ _ref4$after = _ref4.after,
40
+ after = _ref4$after === void 0 ? undefined : _ref4$after,
41
+ _ref4$before = _ref4.before,
42
+ before = _ref4$before === void 0 ? undefined : _ref4$before,
39
43
  _ref4$remove = _ref4.remove,
40
44
  remove = _ref4$remove === void 0 ? false : _ref4$remove;
41
- return /*#__PURE__*/_react.default.createElement(_Property.Property, {
42
- id: name,
43
- name: "filter",
44
- merge: true,
45
- remove: remove
46
- }, /*#__PURE__*/_react.default.createElement(_Property.Property, {
47
- id: "name",
45
+ var placeBefore = before !== undefined ? "filter:".concat(before) : undefined;
46
+ var placeAfter = after !== undefined ? "filter:".concat(after) : undefined;
47
+ return /*#__PURE__*/_react.default.createElement(_reactProperties.Property, {
48
+ id: "filter:".concat(name),
49
+ name: "filters",
50
+ remove: remove,
51
+ array: true,
52
+ before: placeBefore,
53
+ after: placeAfter
54
+ }, /*#__PURE__*/_react.default.createElement(_reactProperties.Property, {
55
+ id: "filter:".concat(name, ":name"),
48
56
  name: "name",
49
57
  value: name
50
- }), /*#__PURE__*/_react.default.createElement(_Property.Property, {
51
- id: "modelIds",
58
+ }), /*#__PURE__*/_react.default.createElement(_reactProperties.Property, {
59
+ id: "filter:".concat(name, ":modelIds"),
52
60
  name: "modelIds",
53
61
  value: modelIds
54
- }), element ? /*#__PURE__*/_react.default.createElement(_Property.Property, {
55
- id: "element",
62
+ }), element ? /*#__PURE__*/_react.default.createElement(_reactProperties.Property, {
63
+ id: "filter:".concat(name, ":element"),
56
64
  name: "element",
57
65
  value: element
58
66
  }) : null);
@@ -64,21 +72,21 @@ var Sorter = function Sorter(_ref5) {
64
72
  modelIds = _ref5$modelIds === void 0 ? [] : _ref5$modelIds,
65
73
  _ref5$remove = _ref5.remove,
66
74
  remove = _ref5$remove === void 0 ? false : _ref5$remove;
67
- return /*#__PURE__*/_react.default.createElement(_Property.Property, {
68
- id: name,
69
- name: "sorter",
70
- merge: true,
71
- remove: remove
72
- }, /*#__PURE__*/_react.default.createElement(_Property.Property, {
73
- id: "name",
75
+ return /*#__PURE__*/_react.default.createElement(_reactProperties.Property, {
76
+ id: "sorter:".concat(name),
77
+ name: "sorters",
78
+ remove: remove,
79
+ array: true
80
+ }, /*#__PURE__*/_react.default.createElement(_reactProperties.Property, {
81
+ id: "sorter:".concat(name, ":name"),
74
82
  name: "name",
75
83
  value: name
76
- }), /*#__PURE__*/_react.default.createElement(_Property.Property, {
77
- id: "label",
84
+ }), /*#__PURE__*/_react.default.createElement(_reactProperties.Property, {
85
+ id: "sorter:".concat(name, ":label"),
78
86
  name: "label",
79
87
  value: label
80
- }), /*#__PURE__*/_react.default.createElement(_Property.Property, {
81
- id: "modelIds",
88
+ }), /*#__PURE__*/_react.default.createElement(_reactProperties.Property, {
89
+ id: "sorter:".concat(name, ":modelIds"),
82
90
  name: "modelIds",
83
91
  value: modelIds
84
92
  }));
@@ -102,30 +110,19 @@ var ContentEntriesView = (0, _appAdmin.makeComposable)("ContentEntriesView", fun
102
110
  };
103
111
  return /*#__PURE__*/_react.default.createElement(ViewContext.Provider, {
104
112
  value: context
105
- }, /*#__PURE__*/_react.default.createElement(_Property.PropertyContainer, {
106
- name: "view",
113
+ }, /*#__PURE__*/_react.default.createElement(_reactProperties.Properties, {
107
114
  onChange: stateUpdater
108
115
  }, /*#__PURE__*/_react.default.createElement(ContentEntriesViewConfigApply, null), /*#__PURE__*/_react.default.createElement(ContentEntriesViewRenderer, null)));
109
116
  });
110
117
  exports.ContentEntriesView = ContentEntriesView;
111
118
  var ContentEntriesViewRenderer = (0, _appAdmin.makeComposable)("ContentEntriesViewRenderer");
112
119
  exports.ContentEntriesViewRenderer = ContentEntriesViewRenderer;
113
- function byName(name) {
114
- return function (obj) {
115
- return obj.name === name;
116
- };
117
- }
118
120
  function useContentEntriesViewConfig() {
119
121
  var _useContext = (0, _react.useContext)(ViewContext),
120
122
  properties = _useContext.properties;
121
- var filters = properties.filter(byName("filter")).map(function (f) {
122
- return (0, _Property.toObject)(f);
123
- });
124
- var sorters = properties.filter(byName("sorter")).map(function (f) {
125
- return (0, _Property.toObject)(f);
126
- });
123
+ var config = (0, _reactProperties.toObject)(properties);
127
124
  return {
128
- filters: filters,
129
- sorters: sorters
125
+ filters: config.filters || [],
126
+ sorters: config.sorters || []
130
127
  };
131
128
  }
@@ -1 +1 @@
1
- {"version":3,"names":["ContentEntriesViewConfigApply","makeComposable","children","createHOC","newChildren","BaseComponent","ConfigHOC","ContentEntriesViewConfig","Filter","name","element","modelIds","remove","Sorter","label","defaultContext","properties","ViewContext","React","createContext","ContentEntriesView","useState","setProperties","context","stateUpdater","ContentEntriesViewRenderer","byName","obj","useContentEntriesViewConfig","useContext","filters","filter","map","f","toObject","sorters"],"sources":["ContentEntriesViewConfig.tsx"],"sourcesContent":["import { makeComposable, Compose, HigherOrderComponent } from \"@webiny/app-admin\";\nimport React, { useContext, useState } from \"react\";\nimport { Property, PropertyContainer, toObject } from \"./Property\";\n\ninterface ContentEntriesViewConfig extends React.FC<unknown> {\n Filter: React.FC<ContentEntriesViewConfigFilterProps>;\n Sorter: React.FC<ContentEntriesViewConfigSorterProps>;\n}\n\nconst ContentEntriesViewConfigApply = makeComposable(\n \"ContentEntriesViewConfigApply\",\n ({ children }) => {\n return <>{children}</>;\n }\n);\n\nconst createHOC =\n (newChildren: React.ReactNode): HigherOrderComponent =>\n BaseComponent => {\n return function ConfigHOC({ children }) {\n return (\n <BaseComponent>\n {newChildren}\n {children}\n </BaseComponent>\n );\n };\n };\n\nexport const ContentEntriesViewConfig: ContentEntriesViewConfig = ({ children }) => {\n return <Compose component={ContentEntriesViewConfigApply} with={createHOC(children)} />;\n};\n\nexport interface ContentEntriesViewConfigFilterProps {\n name: string;\n element?: React.ReactElement<unknown>;\n modelIds?: string[];\n remove?: boolean;\n}\n\nconst Filter: React.FC<ContentEntriesViewConfigFilterProps> = ({\n name,\n element,\n modelIds = [],\n remove = false\n}) => {\n return (\n <Property id={name} name={\"filter\"} merge={true} remove={remove}>\n <Property id={\"name\"} name={\"name\"} value={name} />\n <Property id={\"modelIds\"} name={\"modelIds\"} value={modelIds} />\n {element ? <Property id={\"element\"} name={\"element\"} value={element} /> : null}\n </Property>\n );\n};\n\nexport interface ContentEntriesViewConfigSorterProps {\n name: string;\n label: string;\n modelIds?: string[];\n remove?: boolean;\n}\n\nconst Sorter: React.FC<ContentEntriesViewConfigSorterProps> = ({\n name,\n label,\n modelIds = [],\n remove = false\n}) => {\n return (\n <Property id={name} name={\"sorter\"} merge={true} remove={remove}>\n <Property id={\"name\"} name={\"name\"} value={name} />\n <Property id={\"label\"} name={\"label\"} value={label} />\n <Property id={\"modelIds\"} name={\"modelIds\"} value={modelIds} />\n </Property>\n );\n};\n\nContentEntriesViewConfig.Filter = Filter;\nContentEntriesViewConfig.Sorter = Sorter;\n\ninterface ViewContext {\n properties: Property[];\n}\n\nconst defaultContext = { properties: [] };\n\nconst ViewContext = React.createContext<ViewContext>(defaultContext);\n\nexport const ContentEntriesView = makeComposable(\"ContentEntriesView\", () => {\n const [properties, setProperties] = useState<Property[]>([]);\n const context = { properties };\n\n const stateUpdater = (properties: Property[]) => {\n setProperties(properties);\n };\n\n return (\n <ViewContext.Provider value={context}>\n <PropertyContainer name={\"view\"} onChange={stateUpdater}>\n <ContentEntriesViewConfigApply />\n <ContentEntriesViewRenderer />\n </PropertyContainer>\n </ViewContext.Provider>\n );\n});\n\nexport const ContentEntriesViewRenderer = makeComposable(\"ContentEntriesViewRenderer\");\n\nfunction byName(name: string) {\n return (obj: Property) => obj.name === name;\n}\n\nexport interface ContentEntriesViewConfigFilter {\n name: string;\n element: React.ReactElement;\n modelIds: string[];\n}\n\nexport interface ContentEntriesViewConfigSorter {\n name: string;\n label: string;\n modelIds: string[];\n}\n\nexport function useContentEntriesViewConfig(): {\n filters: ContentEntriesViewConfigFilter[];\n sorters: ContentEntriesViewConfigSorter[];\n} {\n const { properties } = useContext(ViewContext);\n\n const filters = properties\n .filter(byName(\"filter\"))\n .map(f => toObject<ContentEntriesViewConfigFilter>(f));\n\n const sorters = properties\n .filter(byName(\"sorter\"))\n .map(f => toObject<ContentEntriesViewConfigSorter>(f));\n\n return {\n filters,\n sorters\n };\n}\n"],"mappings":";;;;;;;;;;AAAA;AACA;AACA;AAOA,IAAMA,6BAA6B,GAAG,IAAAC,wBAAc,EAChD,+BAA+B,EAC/B,gBAAkB;EAAA,IAAfC,QAAQ,QAARA,QAAQ;EACP,oBAAO,4DAAGA,QAAQ,CAAI;AAC1B,CAAC,CACJ;AAED,IAAMC,SAAS,GACX,SADEA,SAAS,CACVC,WAA4B;EAAA,OAC7B,UAAAC,aAAa,EAAI;IACb,OAAO,SAASC,SAAS,QAAe;MAAA,IAAZJ,QAAQ,SAARA,QAAQ;MAChC,oBACI,6BAAC,aAAa,QACTE,WAAW,EACXF,QAAQ,CACG;IAExB,CAAC;EACL,CAAC;AAAA;AAEE,IAAMK,wBAAkD,GAAG,SAArDA,wBAAkD,QAAqB;EAAA,IAAfL,QAAQ,SAARA,QAAQ;EACzE,oBAAO,6BAAC,iBAAO;IAAC,SAAS,EAAEF,6BAA8B;IAAC,IAAI,EAAEG,SAAS,CAACD,QAAQ;EAAE,EAAG;AAC3F,CAAC;AAAC;AASF,IAAMM,MAAqD,GAAG,SAAxDA,MAAqD,QAKrD;EAAA,IAJFC,IAAI,SAAJA,IAAI;IACJC,OAAO,SAAPA,OAAO;IAAA,uBACPC,QAAQ;IAARA,QAAQ,+BAAG,EAAE;IAAA,qBACbC,MAAM;IAANA,MAAM,6BAAG,KAAK;EAEd,oBACI,6BAAC,kBAAQ;IAAC,EAAE,EAAEH,IAAK;IAAC,IAAI,EAAE,QAAS;IAAC,KAAK,EA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AO,EAAPA,OAAO;IACPK,OAAO,EAAPA;EACJ,CAAC;AACL"}
1
+ {"version":3,"names":["ContentEntriesViewConfigApply","makeComposable","children","createHOC","newChildren","BaseComponent","ConfigHOC","ContentEntriesViewConfig","Filter","name","element","modelIds","after","undefined","before","remove","placeBefore","placeAfter","Sorter","label","defaultContext","properties","ViewContext","React","createContext","ContentEntriesView","useState","setProperties","context","stateUpdater","ContentEntriesViewRenderer","useContentEntriesViewConfig","useContext","config","toObject","filters","sorters"],"sources":["ContentEntriesViewConfig.tsx"],"sourcesContent":["import React, { useContext, useState } from \"react\";\nimport { makeComposable, Compose, HigherOrderComponent } from \"@webiny/app-admin\";\nimport { Property, Properties, toObject } from \"@webiny/react-properties\";\n\ninterface ContentEntriesViewConfig extends React.FC<unknown> {\n Filter: React.FC<ContentEntriesViewConfigFilterProps>;\n Sorter: React.FC<ContentEntriesViewConfigSorterProps>;\n}\n\nconst ContentEntriesViewConfigApply = makeComposable(\n \"ContentEntriesViewConfigApply\",\n ({ children }) => {\n return <>{children}</>;\n }\n);\n\nconst createHOC =\n (newChildren: React.ReactNode): HigherOrderComponent =>\n BaseComponent => {\n return function ConfigHOC({ children }) {\n return (\n <BaseComponent>\n {newChildren}\n {children}\n </BaseComponent>\n );\n };\n };\n\nexport const ContentEntriesViewConfig: ContentEntriesViewConfig = ({ children }) => {\n return <Compose component={ContentEntriesViewConfigApply} with={createHOC(children)} />;\n};\n\nexport interface ContentEntriesViewConfigFilterProps {\n name: string;\n element?: React.ReactElement<unknown>;\n modelIds?: string[];\n remove?: boolean;\n before?: string;\n after?: string;\n}\n\nconst Filter: React.FC<ContentEntriesViewConfigFilterProps> = ({\n name,\n element,\n modelIds = [],\n after = undefined,\n before = undefined,\n remove = false\n}) => {\n const placeBefore = before !== undefined ? `filter:${before}` : undefined;\n const placeAfter = after !== undefined ? `filter:${after}` : undefined;\n\n return (\n <Property\n id={`filter:${name}`}\n name={\"filters\"}\n remove={remove}\n array={true}\n before={placeBefore}\n after={placeAfter}\n >\n <Property id={`filter:${name}:name`} name={\"name\"} value={name} />\n <Property id={`filter:${name}:modelIds`} name={\"modelIds\"} value={modelIds} />\n {element ? (\n <Property id={`filter:${name}:element`} name={\"element\"} value={element} />\n ) : null}\n </Property>\n );\n};\n\nexport interface ContentEntriesViewConfigSorterProps {\n name: string;\n label: string;\n modelIds?: string[];\n remove?: boolean;\n}\n\nconst Sorter: React.FC<ContentEntriesViewConfigSorterProps> = ({\n name,\n label,\n modelIds = [],\n remove = false\n}) => {\n return (\n <Property id={`sorter:${name}`} name={\"sorters\"} remove={remove} array={true}>\n <Property id={`sorter:${name}:name`} name={\"name\"} value={name} />\n <Property id={`sorter:${name}:label`} name={\"label\"} value={label} />\n <Property id={`sorter:${name}:modelIds`} name={\"modelIds\"} value={modelIds} />\n </Property>\n );\n};\n\nContentEntriesViewConfig.Filter = Filter;\nContentEntriesViewConfig.Sorter = Sorter;\n\ninterface ViewContext {\n properties: Property[];\n}\n\nconst defaultContext = { properties: [] };\n\nconst ViewContext = React.createContext<ViewContext>(defaultContext);\n\nexport const ContentEntriesView = makeComposable(\"ContentEntriesView\", () => {\n const [properties, setProperties] = useState<Property[]>([]);\n const context = { properties };\n\n const stateUpdater = (properties: Property[]) => {\n setProperties(properties);\n };\n\n return (\n <ViewContext.Provider value={context}>\n <Properties onChange={stateUpdater}>\n <ContentEntriesViewConfigApply />\n <ContentEntriesViewRenderer />\n </Properties>\n </ViewContext.Provider>\n );\n});\n\nexport const ContentEntriesViewRenderer = makeComposable(\"ContentEntriesViewRenderer\");\n\nexport interface ContentEntriesViewConfigFilter {\n name: string;\n element: React.ReactElement;\n modelIds: string[];\n}\n\nexport interface ContentEntriesViewConfigSorter {\n name: string;\n label: string;\n modelIds: string[];\n}\n\ninterface ContentEntriesViewConfigData {\n filters: ContentEntriesViewConfigFilter[];\n sorters: ContentEntriesViewConfigSorter[];\n}\n\nexport function useContentEntriesViewConfig() {\n const { properties } = useContext(ViewContext);\n\n const config = toObject<ContentEntriesViewConfigData>(properties);\n\n return {\n filters: config.filters || [],\n sorters: config.sorters || []\n };\n}\n"],"mappings":";;;;;;;;;;AAAA;AACA;AACA;AAOA,IAAMA,6BAA6B,GAAG,IAAAC,wBAAc,EAChD,+BAA+B,EAC/B,gBAAkB;EAAA,IAAfC,QAAQ,QAARA,QAAQ;EACP,oBAAO,4DAAGA,QAAQ,CAAI;AAC1B,CAAC,CACJ;AAED,IAAMC,SAAS,GACX,SADEA,SAAS,CACVC,WAA4B;EAAA,OAC7B,UAAAC,aAAa,EAAI;IACb,OAAO,SAASC,SAAS,QAAe;MAAA,IAAZJ,QAAQ,SAARA,QAAQ;MAChC,oBACI,6BAAC,aAAa,QACTE,WAAW,EACXF,QAAQ,CACG;IAExB,CAAC;EACL,CAAC;AAAA;AAEE,IAAMK,wBAAkD,GAAG,SAArDA,wBAAkD,QAAqB;EAAA,IAAfL,QAAQ,SAARA,QAAQ;EACzE,oBAAO,6BAAC,iBAAO;IAAC,SAAS,EAAEF,6BAA8B;IAAC,IAAI,EAAEG,SAAS,CAACD,QAAQ;EAAE,EAAG;AAC3F,CAAC;AAAC;AAWF,IAAMM,MAAqD,GAAG,SAAxDA,MAAqD,QAOrD;EAAA,IANFC,IAAI,SAAJA,IAAI;IACJC,OAAO,SAAPA,OAAO;IAAA,uBACPC,QAAQ;IAARA,QAAQ,+BAAG,EAAE;IAAA,oBACbC,KAAK;IAALA,KAAK,4BAAGC,SAAS;IAAA,qBACjBC,MAAM;IAANA,MAAM,6BAAGD,SAAS;IAAA,qBAClBE,MAAM;IAANA,MAAM,6BAAG,KAAK;EAEd,IAAMC,WAAW,GAAGF,MAAM,KAAKD,SAAS,oBAAaC,MAAM,IAAKD,SAAS;EACzE,IAAMI,UAAU,GAAGL,KAAK,KAAKC,SAAS,oBAAaD,KAAK,IAAKC,SAAS;EAEtE,oBACI,6BAAC,yBAAQ;IACL,EAAE,mBAAYJ,IAAI,CAAG;IACrB,IAAI,EAAE,SAAU;IAChB,M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AM;AAMxC,IAAME,cAAc,GAAG;EAAEC,UAAU,EAAE;AAAG,CAAC;AAEzC,IAAMC,WAAW,gBAAGC,cAAK,CAACC,aAAa,CAAcJ,cAAc,CAAC;AAE7D,IAAMK,kBAAkB,GAAG,IAAAxB,wBAAc,EAAC,oBAAoB,EAAE,YAAM;EACzE,gBAAoC,IAAAyB,eAAQ,EAAa,EAAE,CAAC;IAAA;IAArDL,UAAU;IAAEM,aAAa;EAChC,IAAMC,OAAO,GAAG;IAAEP,UAAU,EAAVA;EAAW,CAAC;EAE9B,IAAMQ,YAAY,GAAG,SAAfA,YAAY,CAAIR,UAAsB,EAAK;IAC7CM,aAAa,CAACN,UAAU,CAAC;EAC7B,CAAC;EAED,oBACI,6BAAC,WAAW,CAAC,QAAQ;IAAC,KAAK,EAAEO;EAAQ,gBACjC,6BAAC,2BAAU;IAAC,QAAQ,EAAEC;EAAa,gBAC/B,6BAAC,6BAA6B,OAAG,eACjC,6BAAC,0BAA0B,OAAG,CACrB,CACM;AAE/B,CAAC,CAAC;AAAC;AAEI,IAAMC,0BAA0B,GAAG,IAAA7B,wBAAc,EAAC,4BAA4B,CAAC;AAAC;AAmBhF,SAAS8B,2BAA2B,GAAG;EAC1C,kBAAuB,IAAAC,iBAAU,EAACV,WAAW,CAAC;IAAtCD,UAAU,eAAVA,UAAU;EAElB,IAAMY,MAAM,GAAG,IAAAC,yBAAQ,EAA+Bb,UAAU,CAAC;EAEjE,OAAO;IACHc,OAAO,EAAEF,MAAM,CAACE,OAAO,IAAI,EAAE;IAC7BC,OAAO,EAAEH,MAAM,CAACG,OAAO,IAAI;EAC/B,CAAC;AACL"}
@@ -0,0 +1,3 @@
1
+ export * from "./useContentEntries";
2
+ export * from "./useContentEntriesList";
3
+ export * from "./useContentEntry";
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ var _useContentEntries = require("./useContentEntries");
7
+ Object.keys(_useContentEntries).forEach(function (key) {
8
+ if (key === "default" || key === "__esModule") return;
9
+ if (key in exports && exports[key] === _useContentEntries[key]) return;
10
+ Object.defineProperty(exports, key, {
11
+ enumerable: true,
12
+ get: function get() {
13
+ return _useContentEntries[key];
14
+ }
15
+ });
16
+ });
17
+ var _useContentEntriesList = require("./useContentEntriesList");
18
+ Object.keys(_useContentEntriesList).forEach(function (key) {
19
+ if (key === "default" || key === "__esModule") return;
20
+ if (key in exports && exports[key] === _useContentEntriesList[key]) return;
21
+ Object.defineProperty(exports, key, {
22
+ enumerable: true,
23
+ get: function get() {
24
+ return _useContentEntriesList[key];
25
+ }
26
+ });
27
+ });
28
+ var _useContentEntry = require("./useContentEntry");
29
+ Object.keys(_useContentEntry).forEach(function (key) {
30
+ if (key === "default" || key === "__esModule") return;
31
+ if (key in exports && exports[key] === _useContentEntry[key]) return;
32
+ Object.defineProperty(exports, key, {
33
+ enumerable: true,
34
+ get: function get() {
35
+ return _useContentEntry[key];
36
+ }
37
+ });
38
+ });
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./useContentEntries\";\nexport * from \"./useContentEntriesList\";\nexport * from \"./useContentEntry\";\n"],"mappings":";;;;;AAAA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA"}
@@ -7,7 +7,7 @@ export declare function useContentEntriesList(): {
7
7
  sorters: import("../ContentEntriesContext").CmsEntriesSorter[];
8
8
  id: string | null;
9
9
  loading: boolean;
10
- data: CmsEditorContentEntry[];
10
+ data: import("../../../../types").CmsContentEntry[];
11
11
  loadMore: () => void;
12
12
  loadMoreLoading: boolean;
13
13
  canCreate: boolean;
@@ -104,9 +104,9 @@ var ContentModelsDataList = function ContentModelsDataList(_ref2) {
104
104
  dataTestId: "cms-delete-content-model-dialog"
105
105
  }),
106
106
  showConfirmation = _useConfirmationDialo.showConfirmation;
107
- var _useContentModels = (0, _hooks.useContentModels)(),
108
- models = _useContentModels.models,
109
- loading = _useContentModels.loading;
107
+ var _useModels = (0, _hooks.useModels)(),
108
+ models = _useModels.models,
109
+ loading = _useModels.loading;
110
110
  var _usePermission = (0, _usePermission2.default)(),
111
111
  canDelete = _usePermission.canDelete,
112
112
  canEdit = _usePermission.canEdit;
@@ -1 +1 @@
1
- {"version":3,"names":["t","i18n","namespace","SORTERS","label","sorters","rightAlign","css","alignItems","justifyContent","listItemMinHeight","minHeight","Icon","styled","width","height","marginRight","flex","svg","color","maxWidth","maxHeight","DisplayIcon","model","icon","split","ContentModelsDataList","canCreate","onCreate","onClone","useState","filter","setFilter","sort","setSort","useRouter","history","client","useApolloClient","useSnackbar","showSnackbar","useConfirmationDialog","dataTestId","showConfirmation","useContentModels","models","loading","usePermission","canDelete","canEdit","filterData","useCallback","name","toLowerCase","includes","sortData","list","deserializeSorters","sortField","sortOrderBy","orderBy","deleteRecord","item","mutate","mutation","GQL","DELETE_CONTENT_MODEL","variables","modelId","update","cache","data","error","deleteContentModel","message","title","removeModelFromListCache","removeModelFromGroupCache","removeModelFromCache","editRecord","contentModel","push","viewContentEntries","contentModelsDataListModalOverlay","useMemo","map","filteredData","contentModels","disableViewContent","fields","length","time","savedOn","plugin"],"sources":["ContentModelsDataList.tsx"],"sourcesContent":["import React, { useCallback, useMemo, useState } from \"react\";\n/**\n * Package timeago-react does not have types.\n */\n// @ts-ignore\nimport TimeAgo from \"timeago-react\";\nimport { css } from \"emotion\";\nimport { useRouter } from \"@webiny/react-router\";\nimport { DeleteIcon, EditIcon } from \"@webiny/ui/List/DataList/icons\";\nimport { ReactComponent as ViewListIcon } from \"../../icons/view_list.svg\";\nimport { ReactComponent as CloneIcon } from \"../../icons/clone.svg\";\nimport { useApolloClient, useContentModels } from \"../../hooks\";\nimport { useSnackbar } from \"@webiny/app-admin/hooks/useSnackbar\";\nimport * as UIL from \"@webiny/ui/List\";\nimport { ButtonIcon, ButtonSecondary, IconButton } from \"@webiny/ui/Button\";\nimport { Tooltip } from \"@webiny/ui/Tooltip\";\nimport { i18n } from \"@webiny/app/i18n\";\nimport { useConfirmationDialog } from \"@webiny/app-admin/hooks/useConfirmationDialog\";\nimport { removeModelFromGroupCache, removeModelFromListCache, removeModelFromCache } from \"./cache\";\nimport * as GQL from \"../../viewsGraphql\";\nimport { ReactComponent as AddIcon } from \"@webiny/app-admin/assets/icons/add-18px.svg\";\nimport SearchUI from \"@webiny/app-admin/components/SearchUI\";\nimport { deserializeSorters } from \"../utils\";\nimport orderBy from \"lodash/orderBy\";\nimport { Cell, Grid } from \"@webiny/ui/Grid\";\nimport { Select } from \"@webiny/ui/Select\";\nimport { ReactComponent as FilterIcon } from \"@webiny/app-admin/assets/icons/filter-24px.svg\";\nimport { CmsEditorContentModel, CmsModel } from \"~/types\";\nimport {\n DeleteCmsModelMutationResponse,\n DeleteCmsModelMutationVariables\n} from \"../../viewsGraphql\";\nimport usePermission from \"~/admin/hooks/usePermission\";\nimport styled from \"@emotion/styled\";\nimport { FontAwesomeIcon } from \"@fortawesome/react-fontawesome\";\nimport { IconProp } from \"@fortawesome/fontawesome-svg-core\";\n\nconst t = i18n.namespace(\"FormsApp.ContentModelsDataList\");\n\ninterface Sorter {\n label: string;\n sorters: string;\n}\n\nconst SORTERS: Sorter[] = [\n {\n label: t`Newest to oldest`,\n sorters: \"savedOn_DESC\"\n },\n {\n label: t`Oldest to newest`,\n sorters: \"savedOn_ASC\"\n },\n {\n label: t`Name A-Z`,\n sorters: \"name_ASC\"\n },\n {\n label: t`Name Z-A`,\n sorters: \"name_DESC\"\n }\n];\n\nconst rightAlign = css({\n alignItems: \"flex-end !important\",\n justifyContent: \"center !important\"\n});\n\nconst listItemMinHeight = css({\n minHeight: \"66px !important\"\n});\n\ninterface ContentModelsDataListProps {\n canCreate: boolean;\n onCreate: () => void;\n onClone: (contentModel: CmsEditorContentModel) => void;\n}\n\nconst Icon = styled(\"div\")({\n width: \"24px\",\n height: \"24px\",\n marginRight: \"15px\",\n flex: \"0 0 24px\",\n svg: {\n color: \"var(--mdc-theme-text-icon-on-light)\",\n width: \"100%\",\n height: \"auto\",\n maxWidth: 24,\n maxHeight: 24\n }\n});\n\ninterface IconProps {\n model: Pick<CmsModel, \"icon\">;\n}\n\nconst DisplayIcon: React.VFC<IconProps> = ({ model }) => {\n if (!model.icon) {\n return null;\n }\n return <FontAwesomeIcon icon={(model.icon || \"\").split(\"/\") as IconProp} />;\n};\n\nconst ContentModelsDataList: React.FC<ContentModelsDataListProps> = ({\n canCreate,\n onCreate,\n onClone\n}) => {\n const [filter, setFilter] = useState<string>(\"\");\n const [sort, setSort] = useState<string>(SORTERS[0].sorters);\n const { history } = useRouter();\n const client = useApolloClient();\n const { showSnackbar } = useSnackbar();\n const { showConfirmation } = useConfirmationDialog({\n dataTestId: \"cms-delete-content-model-dialog\"\n });\n const { models, loading } = useContentModels();\n const { canDelete, canEdit } = usePermission();\n\n const filterData = useCallback(\n ({ name }: Pick<CmsModel, \"name\">): boolean => {\n return name.toLowerCase().includes(filter);\n },\n [filter]\n );\n\n const sortData = useCallback(\n (list: CmsModel[]): CmsModel[] => {\n if (!sort) {\n return list;\n }\n const [sortField, sortOrderBy] = deserializeSorters(sort);\n return orderBy(list, [sortField], [sortOrderBy]);\n },\n [sort]\n );\n\n const deleteRecord = async (item: CmsModel): Promise<void> => {\n showConfirmation(async () => {\n await client.mutate<DeleteCmsModelMutationResponse, DeleteCmsModelMutationVariables>({\n mutation: GQL.DELETE_CONTENT_MODEL,\n variables: { modelId: item.modelId },\n update(cache, { data }) {\n if (!data) {\n showSnackbar(\"Missing data on Delete Content Model Mutation Response.\");\n return;\n }\n const { error } = data.deleteContentModel;\n\n if (error) {\n showSnackbar(error.message, {\n title: t`Something unexpected happened.`\n });\n return;\n }\n\n removeModelFromListCache(cache, item);\n removeModelFromGroupCache(cache, item);\n removeModelFromCache(client, item);\n\n showSnackbar(\n t`Content model {name} deleted successfully!.`({ name: item.name })\n );\n }\n });\n });\n };\n\n const editRecord = (contentModel: CmsModel): void => {\n history.push(\"/cms/content-models/\" + contentModel.modelId);\n };\n\n const viewContentEntries = useCallback(contentModel => {\n return () => history.push(\"/cms/content-entries/\" + contentModel.modelId);\n }, []);\n\n const contentModelsDataListModalOverlay = useMemo(\n () => (\n <UIL.DataListModalOverlay>\n <Grid>\n <Cell span={12}>\n <Select\n value={sort}\n onChange={setSort}\n label={t`Sort by`}\n description={\"Sort content models by\"}\n >\n {SORTERS.map(({ label, sorters }) => {\n return (\n <option key={label} value={sorters}>\n {label}\n </option>\n );\n })}\n </Select>\n </Cell>\n </Grid>\n </UIL.DataListModalOverlay>\n ),\n [sort]\n );\n\n const filteredData = filter === \"\" ? models : models.filter(filterData);\n const contentModels = sortData(filteredData);\n\n return (\n <UIL.DataList\n loading={loading}\n data={contentModels}\n title={t`Content Models`}\n actions={\n canCreate ? (\n <ButtonSecondary data-testid=\"new-record-button\" onClick={onCreate}>\n <ButtonIcon icon={<AddIcon />} /> {t`New Model`}\n </ButtonSecondary>\n ) : null\n }\n search={\n <SearchUI\n value={filter}\n onChange={setFilter}\n inputPlaceholder={t`Search content models`}\n />\n }\n modalOverlay={contentModelsDataListModalOverlay}\n modalOverlayAction={\n <UIL.DataListModalOverlayAction\n icon={<FilterIcon />}\n data-testid={\"default-data-list.filter\"}\n />\n }\n >\n {({ data = [] }: { data: CmsModel[] }) => (\n <UIL.List data-testid=\"default-data-list\">\n {data.map(contentModel => {\n const disableViewContent = contentModel.fields.length === 0;\n const message = disableViewContent\n ? \"To view the content, you first need to add a field and save the model\"\n : \"View content\";\n return (\n <UIL.ListItem key={contentModel.modelId} className={listItemMinHeight}>\n <Icon>\n <DisplayIcon model={contentModel} />\n </Icon>\n <UIL.ListItemText>\n {contentModel.name}\n <UIL.ListItemTextSecondary>\n {t`Last modified: {time}.`({\n time: contentModel.savedOn ? (\n <TimeAgo datetime={contentModel.savedOn} />\n ) : (\n \"N/A\"\n )\n })}\n </UIL.ListItemTextSecondary>\n </UIL.ListItemText>\n <UIL.ListItemMeta className={rightAlign}>\n <UIL.ListActions>\n {canEdit(contentModel, \"cms.contentModel\") && (\n <>\n <Tooltip\n content={t`{message}`({ message })}\n placement={\"top\"}\n >\n <IconButton\n data-testid={\n \"cms-view-content-model-button\"\n }\n icon={<ViewListIcon />}\n label={t`View entries`}\n onClick={viewContentEntries(contentModel)}\n disabled={disableViewContent}\n />\n </Tooltip>\n {contentModel.plugin ? (\n <Tooltip\n content={t`Content model is registered via a plugin.`}\n placement={\"top\"}\n >\n <EditIcon\n disabled\n data-testid={\n \"cms-edit-content-model-button\"\n }\n />\n </Tooltip>\n ) : (\n <Tooltip\n content={t`Edit content model`}\n placement={\"top\"}\n >\n <EditIcon\n onClick={() => editRecord(contentModel)}\n data-testid={\n \"cms-edit-content-model-button\"\n }\n />\n </Tooltip>\n )}\n </>\n )}\n\n <Tooltip content={\"Clone content model\"} placement={\"top\"}>\n <IconButton\n data-testid={\"cms-clone-content-model-button\"}\n icon={<CloneIcon />}\n label={t`View entries`}\n onClick={() => onClone(contentModel)}\n />\n </Tooltip>\n\n {canDelete(contentModel, \"cms.contentModel\") &&\n contentModel.plugin ? (\n <Tooltip\n content={t`Content model is registered via a plugin.`}\n placement={\"top\"}\n >\n <DeleteIcon\n disabled\n data-testid={\"cms-delete-content-model-button\"}\n />\n </Tooltip>\n ) : (\n <Tooltip\n content={t`Delete content model`}\n placement={\"top\"}\n >\n <DeleteIcon\n onClick={() => deleteRecord(contentModel)}\n data-testid={\"cms-delete-content-model-button\"}\n />\n </Tooltip>\n )}\n </UIL.ListActions>\n </UIL.ListItemMeta>\n </UIL.ListItem>\n );\n })}\n </UIL.List>\n )}\n </UIL.DataList>\n );\n};\n\nexport default ContentModelsDataList;\n"],"mappings":";;;;;;;;;;;;AAAA;AAKA;AACA;AACA;AACA;AAC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EA,CAAC,2GAAuB;QACjC,SAAS,EAAE;MAAM,gBAEjB,6BAAC,iBAAU;QACP,OAAO,EAAE;UAAA,OAAM6D,YAAY,CAACmB,YAAY,CAAC;QAAA,CAAC;QAC1C,eAAa;MAAkC,EACjD,CAET,CACa,CACH,CACR;IAEvB,CAAC,CAAC,CACK;EAAA,CACd,CACU;AAEvB,CAAC;AAAC,eAEatD,qBAAqB;AAAA"}
1
+ {"version":3,"names":["t","i18n","namespace","SORTERS","label","sorters","rightAlign","css","alignItems","justifyContent","listItemMinHeight","minHeight","Icon","styled","width","height","marginRight","flex","svg","color","maxWidth","maxHeight","DisplayIcon","model","icon","split","ContentModelsDataList","canCreate","onCreate","onClone","useState","filter","setFilter","sort","setSort","useRouter","history","client","useApolloClient","useSnackbar","showSnackbar","useConfirmationDialog","dataTestId","showConfirmation","useModels","models","loading","usePermission","canDelete","canEdit","filterData","useCallback","name","toLowerCase","includes","sortData","list","deserializeSorters","sortField","sortOrderBy","orderBy","deleteRecord","item","mutate","mutation","GQL","DELETE_CONTENT_MODEL","variables","modelId","update","cache","data","error","deleteContentModel","message","title","removeModelFromListCache","removeModelFromGroupCache","removeModelFromCache","editRecord","contentModel","push","viewContentEntries","contentModelsDataListModalOverlay","useMemo","map","filteredData","contentModels","disableViewContent","fields","length","time","savedOn","plugin"],"sources":["ContentModelsDataList.tsx"],"sourcesContent":["import React, { useCallback, useMemo, useState } from \"react\";\n/**\n * Package timeago-react does not have types.\n */\n// @ts-ignore\nimport TimeAgo from \"timeago-react\";\nimport { css } from \"emotion\";\nimport { useRouter } from \"@webiny/react-router\";\nimport { DeleteIcon, EditIcon } from \"@webiny/ui/List/DataList/icons\";\nimport { ReactComponent as ViewListIcon } from \"../../icons/view_list.svg\";\nimport { ReactComponent as CloneIcon } from \"../../icons/clone.svg\";\nimport { useApolloClient, useModels } from \"../../hooks\";\nimport { useSnackbar } from \"@webiny/app-admin/hooks/useSnackbar\";\nimport * as UIL from \"@webiny/ui/List\";\nimport { ButtonIcon, ButtonSecondary, IconButton } from \"@webiny/ui/Button\";\nimport { Tooltip } from \"@webiny/ui/Tooltip\";\nimport { i18n } from \"@webiny/app/i18n\";\nimport { useConfirmationDialog } from \"@webiny/app-admin/hooks/useConfirmationDialog\";\nimport { removeModelFromGroupCache, removeModelFromListCache, removeModelFromCache } from \"./cache\";\nimport * as GQL from \"../../viewsGraphql\";\nimport { ReactComponent as AddIcon } from \"@webiny/app-admin/assets/icons/add-18px.svg\";\nimport SearchUI from \"@webiny/app-admin/components/SearchUI\";\nimport { deserializeSorters } from \"../utils\";\nimport orderBy from \"lodash/orderBy\";\nimport { Cell, Grid } from \"@webiny/ui/Grid\";\nimport { Select } from \"@webiny/ui/Select\";\nimport { ReactComponent as FilterIcon } from \"@webiny/app-admin/assets/icons/filter-24px.svg\";\nimport { CmsEditorContentModel, CmsModel } from \"~/types\";\nimport {\n DeleteCmsModelMutationResponse,\n DeleteCmsModelMutationVariables\n} from \"../../viewsGraphql\";\nimport usePermission from \"~/admin/hooks/usePermission\";\nimport styled from \"@emotion/styled\";\nimport { FontAwesomeIcon } from \"@fortawesome/react-fontawesome\";\nimport { IconProp } from \"@fortawesome/fontawesome-svg-core\";\n\nconst t = i18n.namespace(\"FormsApp.ContentModelsDataList\");\n\ninterface Sorter {\n label: string;\n sorters: string;\n}\n\nconst SORTERS: Sorter[] = [\n {\n label: t`Newest to oldest`,\n sorters: \"savedOn_DESC\"\n },\n {\n label: t`Oldest to newest`,\n sorters: \"savedOn_ASC\"\n },\n {\n label: t`Name A-Z`,\n sorters: \"name_ASC\"\n },\n {\n label: t`Name Z-A`,\n sorters: \"name_DESC\"\n }\n];\n\nconst rightAlign = css({\n alignItems: \"flex-end !important\",\n justifyContent: \"center !important\"\n});\n\nconst listItemMinHeight = css({\n minHeight: \"66px !important\"\n});\n\ninterface ContentModelsDataListProps {\n canCreate: boolean;\n onCreate: () => void;\n onClone: (contentModel: CmsEditorContentModel) => void;\n}\n\nconst Icon = styled(\"div\")({\n width: \"24px\",\n height: \"24px\",\n marginRight: \"15px\",\n flex: \"0 0 24px\",\n svg: {\n color: \"var(--mdc-theme-text-icon-on-light)\",\n width: \"100%\",\n height: \"auto\",\n maxWidth: 24,\n maxHeight: 24\n }\n});\n\ninterface IconProps {\n model: Pick<CmsModel, \"icon\">;\n}\n\nconst DisplayIcon: React.VFC<IconProps> = ({ model }) => {\n if (!model.icon) {\n return null;\n }\n return <FontAwesomeIcon icon={(model.icon || \"\").split(\"/\") as IconProp} />;\n};\n\nconst ContentModelsDataList: React.FC<ContentModelsDataListProps> = ({\n canCreate,\n onCreate,\n onClone\n}) => {\n const [filter, setFilter] = useState<string>(\"\");\n const [sort, setSort] = useState<string>(SORTERS[0].sorters);\n const { history } = useRouter();\n const client = useApolloClient();\n const { showSnackbar } = useSnackbar();\n const { showConfirmation } = useConfirmationDialog({\n dataTestId: \"cms-delete-content-model-dialog\"\n });\n const { models, loading } = useModels();\n const { canDelete, canEdit } = usePermission();\n\n const filterData = useCallback(\n ({ name }: Pick<CmsModel, \"name\">): boolean => {\n return name.toLowerCase().includes(filter);\n },\n [filter]\n );\n\n const sortData = useCallback(\n (list: CmsModel[]): CmsModel[] => {\n if (!sort) {\n return list;\n }\n const [sortField, sortOrderBy] = deserializeSorters(sort);\n return orderBy(list, [sortField], [sortOrderBy]);\n },\n [sort]\n );\n\n const deleteRecord = async (item: CmsModel): Promise<void> => {\n showConfirmation(async () => {\n await client.mutate<DeleteCmsModelMutationResponse, DeleteCmsModelMutationVariables>({\n mutation: GQL.DELETE_CONTENT_MODEL,\n variables: { modelId: item.modelId },\n update(cache, { data }) {\n if (!data) {\n showSnackbar(\"Missing data on Delete Content Model Mutation Response.\");\n return;\n }\n const { error } = data.deleteContentModel;\n\n if (error) {\n showSnackbar(error.message, {\n title: t`Something unexpected happened.`\n });\n return;\n }\n\n removeModelFromListCache(cache, item);\n removeModelFromGroupCache(cache, item);\n removeModelFromCache(client, item);\n\n showSnackbar(\n t`Content model {name} deleted successfully!.`({ name: item.name })\n );\n }\n });\n });\n };\n\n const editRecord = (contentModel: CmsModel): void => {\n history.push(\"/cms/content-models/\" + contentModel.modelId);\n };\n\n const viewContentEntries = useCallback(contentModel => {\n return () => history.push(\"/cms/content-entries/\" + contentModel.modelId);\n }, []);\n\n const contentModelsDataListModalOverlay = useMemo(\n () => (\n <UIL.DataListModalOverlay>\n <Grid>\n <Cell span={12}>\n <Select\n value={sort}\n onChange={setSort}\n label={t`Sort by`}\n description={\"Sort content models by\"}\n >\n {SORTERS.map(({ label, sorters }) => {\n return (\n <option key={label} value={sorters}>\n {label}\n </option>\n );\n })}\n </Select>\n </Cell>\n </Grid>\n </UIL.DataListModalOverlay>\n ),\n [sort]\n );\n\n const filteredData = filter === \"\" ? models : models.filter(filterData);\n const contentModels = sortData(filteredData);\n\n return (\n <UIL.DataList\n loading={loading}\n data={contentModels}\n title={t`Content Models`}\n actions={\n canCreate ? (\n <ButtonSecondary data-testid=\"new-record-button\" onClick={onCreate}>\n <ButtonIcon icon={<AddIcon />} /> {t`New Model`}\n </ButtonSecondary>\n ) : null\n }\n search={\n <SearchUI\n value={filter}\n onChange={setFilter}\n inputPlaceholder={t`Search content models`}\n />\n }\n modalOverlay={contentModelsDataListModalOverlay}\n modalOverlayAction={\n <UIL.DataListModalOverlayAction\n icon={<FilterIcon />}\n data-testid={\"default-data-list.filter\"}\n />\n }\n >\n {({ data = [] }: { data: CmsModel[] }) => (\n <UIL.List data-testid=\"default-data-list\">\n {data.map(contentModel => {\n const disableViewContent = contentModel.fields.length === 0;\n const message = disableViewContent\n ? \"To view the content, you first need to add a field and save the model\"\n : \"View content\";\n return (\n <UIL.ListItem key={contentModel.modelId} className={listItemMinHeight}>\n <Icon>\n <DisplayIcon model={contentModel} />\n </Icon>\n <UIL.ListItemText>\n {contentModel.name}\n <UIL.ListItemTextSecondary>\n {t`Last modified: {time}.`({\n time: contentModel.savedOn ? (\n <TimeAgo datetime={contentModel.savedOn} />\n ) : (\n \"N/A\"\n )\n })}\n </UIL.ListItemTextSecondary>\n </UIL.ListItemText>\n <UIL.ListItemMeta className={rightAlign}>\n <UIL.ListActions>\n {canEdit(contentModel, \"cms.contentModel\") && (\n <>\n <Tooltip\n content={t`{message}`({ message })}\n placement={\"top\"}\n >\n <IconButton\n data-testid={\n \"cms-view-content-model-button\"\n }\n icon={<ViewListIcon />}\n label={t`View entries`}\n onClick={viewContentEntries(contentModel)}\n disabled={disableViewContent}\n />\n </Tooltip>\n {contentModel.plugin ? (\n <Tooltip\n content={t`Content model is registered via a plugin.`}\n placement={\"top\"}\n >\n <EditIcon\n disabled\n data-testid={\n \"cms-edit-content-model-button\"\n }\n />\n </Tooltip>\n ) : (\n <Tooltip\n content={t`Edit content model`}\n placement={\"top\"}\n >\n <EditIcon\n onClick={() => editRecord(contentModel)}\n data-testid={\n \"cms-edit-content-model-button\"\n }\n />\n </Tooltip>\n )}\n </>\n )}\n\n <Tooltip content={\"Clone content model\"} placement={\"top\"}>\n <IconButton\n data-testid={\"cms-clone-content-model-button\"}\n icon={<CloneIcon />}\n label={t`View entries`}\n onClick={() => onClone(contentModel)}\n />\n </Tooltip>\n\n {canDelete(contentModel, \"cms.contentModel\") &&\n contentModel.plugin ? (\n <Tooltip\n content={t`Content model is registered via a plugin.`}\n placement={\"top\"}\n >\n <DeleteIcon\n disabled\n data-testid={\"cms-delete-content-model-button\"}\n />\n </Tooltip>\n ) : (\n <Tooltip\n content={t`Delete content model`}\n placement={\"top\"}\n >\n <DeleteIcon\n onClick={() => deleteRecord(contentModel)}\n data-testid={\"cms-delete-content-model-button\"}\n />\n </Tooltip>\n )}\n </UIL.ListActions>\n </UIL.ListItemMeta>\n </UIL.ListItem>\n );\n })}\n </UIL.List>\n )}\n </UIL.DataList>\n );\n};\n\nexport default ContentModelsDataList;\n"],"mappings":";;;;;;;;;;;;AAAA;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA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P,OAAO,EAAE;UAAA,OAAM6D,YAAY,CAACmB,YAAY,CAAC;QAAA,CAAC;QAC1C,eAAa;MAAkC,EACjD,CAET,CACa,CACH,CACR;IAEvB,CAAC,CAAC,CACK;EAAA,CACd,CACU;AAEvB,CAAC;AAAC,eAEatD,qBAAqB;AAAA"}
package/allPlugins.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- declare const _default: (import("./types").CmsModelFieldTypePlugin | import("./types").CmsEditorFieldRendererPlugin | import("./types").CmsEditorFieldRendererPlugin[] | import("./types").CmsModelFieldValidatorPlugin<any> | import("./types").CmsModelFieldRegexValidatorExpressionPlugin | (import("./types").CmsEditorFormSettingsPlugin | import("./types").CmsIconsPlugin | import("./types").CmsFieldValueTransformer<{
2
+ declare const _default: (import("./types").CmsModelFieldTypePlugin | import("./types").CmsModelFieldRendererPlugin | import("./types").CmsModelFieldRendererPlugin[] | import("./types").CmsModelFieldValidatorPlugin<any> | import("./types").CmsModelFieldRegexValidatorExpressionPlugin | (import("./types").CmsEditorFormSettingsPlugin | import("./types").CmsIconsPlugin | import("@webiny/app-admin/types").AdminInstallationPlugin | import("@webiny/app-admin/types").AdminAppPermissionRendererPlugin | import("./types").CmsFieldValueTransformer<{
3
3
  id: string;
4
4
  type: string;
5
5
  fieldId: string;
@@ -26,7 +26,7 @@ declare const _default: (import("./types").CmsModelFieldTypePlugin | import("./t
26
26
  name: string;
27
27
  };
28
28
  tags?: string[] | undefined;
29
- }>[] | import("@webiny/app/types").RoutePlugin[] | import("@webiny/app-admin/types").AdminInstallationPlugin | import("@webiny/app-admin/types").AdminAppPermissionRendererPlugin | import("@webiny/app").ApolloCacheObjectIdPlugin<import("@webiny/app/plugins/ApolloCacheObjectIdPlugin").ApolloCacheObject> | import("./types").CmsContentDetailsPlugin[] | {
29
+ }>[] | import("@webiny/app/types").RoutePlugin[] | import("@webiny/app").ApolloCacheObjectIdPlugin<import("@webiny/app/plugins/ApolloCacheObjectIdPlugin").ApolloCacheObject> | import("./types").CmsContentDetailsPlugin[] | {
30
30
  name: string;
31
31
  type: string;
32
32
  render(): JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webiny/app-headless-cms",
3
- "version": "0.0.0-unstable.496cf268ac",
3
+ "version": "0.0.0-unstable.606fc9c866",
4
4
  "main": "index.js",
5
5
  "repository": {
6
6
  "type": "git",
@@ -16,7 +16,7 @@
16
16
  "@apollo/react-common": "3.1.4",
17
17
  "@apollo/react-hooks": "3.1.5",
18
18
  "@babel/runtime": "7.20.13",
19
- "@emotion/react": "11.10.6",
19
+ "@emotion/react": "11.10.8",
20
20
  "@emotion/styled": "11.10.6",
21
21
  "@fortawesome/fontawesome-common-types": "0.3.0",
22
22
  "@fortawesome/fontawesome-svg-core": "1.3.0",
@@ -27,20 +27,21 @@
27
27
  "@material-design-icons/svg": "0.14.2",
28
28
  "@svgr/webpack": "6.5.1",
29
29
  "@types/react": "17.0.39",
30
- "@webiny/app": "0.0.0-unstable.496cf268ac",
31
- "@webiny/app-admin": "0.0.0-unstable.496cf268ac",
32
- "@webiny/app-graphql-playground": "0.0.0-unstable.496cf268ac",
33
- "@webiny/app-i18n": "0.0.0-unstable.496cf268ac",
34
- "@webiny/app-plugin-admin-welcome-screen": "0.0.0-unstable.496cf268ac",
35
- "@webiny/app-security": "0.0.0-unstable.496cf268ac",
36
- "@webiny/error": "0.0.0-unstable.496cf268ac",
37
- "@webiny/form": "0.0.0-unstable.496cf268ac",
38
- "@webiny/plugins": "0.0.0-unstable.496cf268ac",
39
- "@webiny/react-composition": "0.0.0-unstable.496cf268ac",
40
- "@webiny/react-router": "0.0.0-unstable.496cf268ac",
41
- "@webiny/ui": "0.0.0-unstable.496cf268ac",
42
- "@webiny/utils": "0.0.0-unstable.496cf268ac",
43
- "@webiny/validation": "0.0.0-unstable.496cf268ac",
30
+ "@webiny/app": "0.0.0-unstable.606fc9c866",
31
+ "@webiny/app-admin": "0.0.0-unstable.606fc9c866",
32
+ "@webiny/app-graphql-playground": "0.0.0-unstable.606fc9c866",
33
+ "@webiny/app-i18n": "0.0.0-unstable.606fc9c866",
34
+ "@webiny/app-plugin-admin-welcome-screen": "0.0.0-unstable.606fc9c866",
35
+ "@webiny/app-security": "0.0.0-unstable.606fc9c866",
36
+ "@webiny/error": "0.0.0-unstable.606fc9c866",
37
+ "@webiny/form": "0.0.0-unstable.606fc9c866",
38
+ "@webiny/plugins": "0.0.0-unstable.606fc9c866",
39
+ "@webiny/react-composition": "0.0.0-unstable.606fc9c866",
40
+ "@webiny/react-properties": "0.0.0-unstable.606fc9c866",
41
+ "@webiny/react-router": "0.0.0-unstable.606fc9c866",
42
+ "@webiny/ui": "0.0.0-unstable.606fc9c866",
43
+ "@webiny/utils": "0.0.0-unstable.606fc9c866",
44
+ "@webiny/validation": "0.0.0-unstable.606fc9c866",
44
45
  "apollo-cache": "1.3.5",
45
46
  "apollo-client": "2.6.10",
46
47
  "apollo-link": "1.2.14",
@@ -51,7 +52,6 @@
51
52
  "graphql": "15.8.0",
52
53
  "graphql-tag": "2.12.6",
53
54
  "lodash": "4.17.21",
54
- "pluralize": "8.0.0",
55
55
  "prop-types": "15.8.1",
56
56
  "raw.macro": "0.4.2",
57
57
  "react": "17.0.2",
@@ -71,8 +71,8 @@
71
71
  "@babel/preset-env": "^7.19.4",
72
72
  "@babel/preset-react": "^7.16.0",
73
73
  "@babel/preset-typescript": "^7.18.6",
74
- "@webiny/cli": "^0.0.0-unstable.496cf268ac",
75
- "@webiny/project-utils": "^0.0.0-unstable.496cf268ac",
74
+ "@webiny/cli": "^0.0.0-unstable.606fc9c866",
75
+ "@webiny/project-utils": "^0.0.0-unstable.606fc9c866",
76
76
  "babel-plugin-emotion": "^9.2.8",
77
77
  "babel-plugin-lodash": "^3.3.4",
78
78
  "babel-plugin-module-resolver": "^4.1.0",
@@ -103,5 +103,5 @@
103
103
  ]
104
104
  }
105
105
  },
106
- "gitHead": "496cf268acd5b092c860b62d75c7d765c9472043"
106
+ "gitHead": "606fc9c866aec436f24983abc9bdaf02af2b8746"
107
107
  }
package/types/index.d.ts CHANGED
@@ -1,13 +1,13 @@
1
1
  import * as React from "react";
2
- import { Plugin } from "@webiny/plugins/types";
3
2
  import { ReactElement, ReactNode } from "react";
4
- import { FormAPI, BindComponent as BaseBindComponent, BindComponentRenderProp as BaseBindComponentRenderProp, BindComponentProps as BaseBindComponentProps } from "@webiny/form";
5
- import { IconPrefix, IconName } from "@fortawesome/fontawesome-svg-core";
3
+ import { Plugin } from "@webiny/plugins/types";
4
+ import { BindComponent as BaseBindComponent, BindComponentProps as BaseBindComponentProps, BindComponentRenderProp as BaseBindComponentRenderProp, FormAPI } from "@webiny/form";
5
+ import { IconName, IconPrefix } from "@fortawesome/fontawesome-svg-core";
6
6
  import Label from "../admin/components/ContentEntryForm/Label";
7
7
  import { SecurityPermission } from "@webiny/app-security/types";
8
8
  import { DragSource } from "../admin/components/FieldEditor/FieldEditorContext";
9
- import { CmsModelFieldValidator, CmsModelFieldValidatorsGroup, CmsModelFieldValidatorsFactory } from "./validation";
10
- import { CmsModelField, CmsModel } from "./model";
9
+ import { CmsModelFieldValidator, CmsModelFieldValidatorsFactory, CmsModelFieldValidatorsGroup } from "./validation";
10
+ import { CmsModel, CmsModelField } from "./model";
11
11
  import { CmsIdentity } from "./shared";
12
12
  export * from "./validation";
13
13
  export * from "./model";
@@ -16,6 +16,9 @@ interface QueryFieldParams {
16
16
  model: CmsModel;
17
17
  field: CmsModelField;
18
18
  }
19
+ /**
20
+ * @deprecated Use `CmsModelFieldTypePlugin`.
21
+ */
19
22
  export declare type CmsEditorFieldTypePlugin = CmsModelFieldTypePlugin;
20
23
  export interface CmsModelFieldTypePlugin extends Plugin {
21
24
  /**
@@ -85,7 +88,7 @@ export interface CmsModelFieldTypePlugin extends Plugin {
85
88
  * allowMultipleValues: true
86
89
  * ```
87
90
  */
88
- allowMultipleValues: boolean;
91
+ allowMultipleValues?: boolean;
89
92
  /**
90
93
  * Does this field type have a fixed list of values that can be selected?
91
94
  *
@@ -93,11 +96,11 @@ export interface CmsModelFieldTypePlugin extends Plugin {
93
96
  * allowPredefinedValues: false
94
97
  * ```
95
98
  */
96
- allowPredefinedValues: boolean;
99
+ allowPredefinedValues?: boolean;
97
100
  /**
98
101
  * A ReactNode label when multiple values are enabled.
99
102
  */
100
- multipleValuesLabel: React.ReactNode;
103
+ multipleValuesLabel?: React.ReactNode;
101
104
  /**
102
105
  * These are default values when the field is first created. This is a representation of the field that is stored in the database.
103
106
  *
@@ -191,20 +194,28 @@ export interface CmsModelFieldTypePlugin extends Plugin {
191
194
  }) => React.ReactElement;
192
195
  };
193
196
  }
194
- export interface CmsEditorFieldRendererProps {
197
+ export interface CmsModelFieldRendererProps {
195
198
  field: CmsModelField;
196
199
  Label: typeof Label;
197
200
  getBind: (index?: number, key?: string) => BindComponent;
198
201
  contentModel: CmsModel;
199
202
  }
200
- export interface CmsEditorFieldRendererPlugin extends Plugin {
203
+ /**
204
+ * @deprecated Use `CmsModelFieldRendererProps`.
205
+ */
206
+ export declare type CmsEditorFieldRendererProps = CmsModelFieldRendererProps;
207
+ /**
208
+ * @deprecated Use `CmsModelFieldRendererPlugin`.
209
+ */
210
+ export declare type CmsEditorFieldRendererPlugin = CmsModelFieldRendererPlugin;
211
+ export interface CmsModelFieldRendererPlugin extends Plugin {
201
212
  /**
202
213
  * a plugin type
203
214
  */
204
215
  type: "cms-editor-field-renderer";
205
216
  renderer: {
206
217
  /**
207
- * Name of the renderer to match the one from `createField()` method in `CmsEditorFieldTypePlugin`.
218
+ * Name of the renderer to match the one from `createField()` method in `CmsModelFieldTypePlugin`.
208
219
  *
209
220
  * ```ts
210
221
  * renderName: "myFieldTypeRenderer"
@@ -240,7 +251,7 @@ export interface CmsEditorFieldRendererPlugin extends Plugin {
240
251
  */
241
252
  canUse(props: {
242
253
  field: CmsModelField;
243
- fieldPlugin: CmsEditorFieldTypePlugin;
254
+ fieldPlugin: CmsModelFieldTypePlugin;
244
255
  }): boolean;
245
256
  /**
246
257
  * Renders a field in the UI.
@@ -264,7 +275,7 @@ export interface CmsEditorFieldRendererPlugin extends Plugin {
264
275
  * }
265
276
  * ```
266
277
  */
267
- render(props: CmsEditorFieldRendererProps): React.ReactNode;
278
+ render(props: CmsModelFieldRendererProps): React.ReactNode;
268
279
  };
269
280
  }
270
281
  export interface CmsEditorFieldPredefinedValuesEntry {
@@ -287,7 +298,11 @@ export interface CmsDynamicZoneTemplate {
287
298
  validation: CmsModelFieldValidator[];
288
299
  }
289
300
  export declare type CmsContentEntryStatusType = "draft" | "published" | "unpublished";
290
- export interface CmsEditorContentEntry {
301
+ /**
302
+ * @deprecated Use `CmsContentEntry`.
303
+ */
304
+ export declare type CmsEditorContentEntry = CmsContentEntry;
305
+ export interface CmsContentEntry {
291
306
  id: string;
292
307
  savedOn: string;
293
308
  modelId: string;