@blaze-cms/plugin-data-ui 0.146.0-node18-tooltips.42 → 0.146.0-node18-core-styles-tooltips.58

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 (93) hide show
  1. package/CHANGELOG.md +186 -36
  2. package/lib/components/EntityManager/Entity/EntitiyNavLinks/EntityNavLinks.js +1 -0
  3. package/lib/components/EntityManager/Entity/EntitiyNavLinks/EntityNavLinks.js.map +1 -1
  4. package/lib/components/EntityManager/Entity/Entity.js +7 -6
  5. package/lib/components/EntityManager/Entity/Entity.js.map +1 -1
  6. package/lib/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/HeaderPreviewButton.js +1 -1
  7. package/lib/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/HeaderPreviewButton.js.map +1 -1
  8. package/lib/components/EntityManager/Entity/SideBarRelations/helpers/build-dynamic-query.js +1 -0
  9. package/lib/components/EntityManager/Entity/SideBarRelations/helpers/build-dynamic-query.js.map +1 -1
  10. package/lib/components/EntityManager/Entity/SideBarRelations/index.js +5 -5
  11. package/lib/components/EntityManager/Entity/SideBarRelations/index.js.map +1 -1
  12. package/lib/components/EntityManager/Entity/actions-handlers/create/submit.js +1 -1
  13. package/lib/components/EntityManager/Entity/actions-handlers/create/submit.js.map +1 -1
  14. package/lib/components/EntityManager/Entity/actions-handlers/delete/delete.js +1 -1
  15. package/lib/components/EntityManager/Entity/actions-handlers/delete/delete.js.map +1 -1
  16. package/lib/components/EntityManager/Entity/actions-handlers/shared/publish.js +1 -1
  17. package/lib/components/EntityManager/Entity/actions-handlers/shared/publish.js.map +1 -1
  18. package/lib/components/EntityManager/Entity/actions-handlers/update/submit.js +1 -1
  19. package/lib/components/EntityManager/Entity/actions-handlers/update/submit.js.map +1 -1
  20. package/lib/components/EntityManager/EntityManager.js +3 -3
  21. package/lib/components/EntityManager/EntityManager.js.map +1 -1
  22. package/lib/components/EntityManager/utils/entity.js +1 -1
  23. package/lib/components/EntityManager/utils/entity.js.map +1 -1
  24. package/lib/components/EntityManager/utils/entityAvailableActions.js +2 -2
  25. package/lib/components/EntityManager/utils/entityAvailableActions.js.map +1 -1
  26. package/lib/components/InfoBoxes/InfoBoxes.js +1 -0
  27. package/lib/components/InfoBoxes/InfoBoxes.js.map +1 -1
  28. package/lib/components/InfoBoxes/container/InfoBoxContainer.js +1 -1
  29. package/lib/components/InfoBoxes/container/InfoBoxContainer.js.map +1 -1
  30. package/lib/components/InfoBoxes/helpers/build-dynamic-query.js +1 -0
  31. package/lib/components/InfoBoxes/helpers/build-dynamic-query.js.map +1 -1
  32. package/lib/components/ListingTable/ListingTable.js +7 -7
  33. package/lib/components/ListingTable/ListingTable.js.map +1 -1
  34. package/lib/components/ListingTable/ListingTableContent/ListingTableContent.js +1 -1
  35. package/lib/components/ListingTable/ListingTableContent/ListingTableContent.js.map +1 -1
  36. package/lib/components/ListingTable/SearchFilter/SearchContainer.js +4 -4
  37. package/lib/components/ListingTable/SearchFilter/SearchContainer.js.map +1 -1
  38. package/lib/components/ListingTable/SearchFilter/SearchFilter.js +1 -1
  39. package/lib/components/ListingTable/SearchFilter/SearchFilter.js.map +1 -1
  40. package/lib/components/ListingTable/SearchFilter/helpers.js +1 -0
  41. package/lib/components/ListingTable/SearchFilter/helpers.js.map +1 -1
  42. package/lib/components/ListingTable/TableActions/TableActions.js.map +1 -1
  43. package/lib/components/ListingTable/service/index.js +2 -1
  44. package/lib/components/ListingTable/service/index.js.map +1 -1
  45. package/lib/components/Tabs/index.js +4 -5
  46. package/lib/components/Tabs/index.js.map +1 -1
  47. package/lib/index.js +5 -5
  48. package/lib/index.js.map +1 -1
  49. package/lib/utils/add-content-menu-items.js +1 -1
  50. package/lib/utils/add-content-menu-items.js.map +1 -1
  51. package/lib/utils/hoc/withContext.js.map +1 -1
  52. package/lib-es/components/EntityManager/Entity/Entity.js +2 -1
  53. package/lib-es/components/EntityManager/Entity/Entity.js.map +1 -1
  54. package/lib-es/components/EntityManager/Entity/EntityHeader/EntityHeader.js.map +1 -1
  55. package/lib-es/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/HeaderPreviewButton.js.map +1 -1
  56. package/lib-es/components/EntityManager/Entity/SideBarRelations/helpers/build-dynamic-query.js.map +1 -1
  57. package/lib-es/components/EntityManager/Entity/SideBarRelations/hooks/useCustomSidebarData.js.map +1 -1
  58. package/lib-es/components/EntityManager/Entity/SideBarRelations/presentational/CustomSidebarInfo.js.map +1 -1
  59. package/lib-es/components/EntityManager/Entity/actions-handlers/create/submit.js.map +1 -1
  60. package/lib-es/components/EntityManager/Entity/actions-handlers/shared/publish.js.map +1 -1
  61. package/lib-es/components/EntityManager/EntityManager.js.map +1 -1
  62. package/lib-es/components/EntityManager/utils/entity.js.map +1 -1
  63. package/lib-es/components/EntityManager/utils/query.js.map +1 -1
  64. package/lib-es/components/InfoBoxes/InfoBoxTooltip.js.map +1 -1
  65. package/lib-es/components/InfoBoxes/helpers/build-dynamic-query.js.map +1 -1
  66. package/lib-es/components/InfoBoxes/hooks/useData.js.map +1 -1
  67. package/lib-es/components/InfoBoxes/presentational/InfoBox.js.map +1 -1
  68. package/lib-es/components/InfoBoxes/presentational/InfoBoxLabel.js.map +1 -1
  69. package/lib-es/components/ListingTable/ListingTable.js.map +1 -1
  70. package/lib-es/components/ListingTable/ListingTableContent/ListingTableContent.js.map +1 -1
  71. package/lib-es/components/ListingTable/SearchFilter/SearchContainer.js.map +1 -1
  72. package/lib-es/components/ListingTable/SearchFilter/helpers.js.map +1 -1
  73. package/lib-es/components/ListingTable/SearchFilter/querys.js.map +1 -1
  74. package/lib-es/components/ListingTable/mappers/populate-rows.js.map +1 -1
  75. package/lib-es/components/ListingTable/service/index.js.map +1 -1
  76. package/lib-es/components/Tabs/index.js +3 -5
  77. package/lib-es/components/Tabs/index.js.map +1 -1
  78. package/lib-es/index.js +2 -2
  79. package/lib-es/index.js.map +1 -1
  80. package/lib-es/utils/add-content-menu-items.js.map +1 -1
  81. package/lib-es/utils/build-create-entity-mutation.js.map +1 -1
  82. package/lib-es/utils/build-delete-entity-mutation.js.map +1 -1
  83. package/lib-es/utils/build-listing-query.js.map +1 -1
  84. package/lib-es/utils/build-update-data-query.js.map +1 -1
  85. package/lib-es/utils/build-update-publish-unpublish-mutation.js.map +1 -1
  86. package/lib-es/utils/hoc/withContext.js +1 -1
  87. package/lib-es/utils/hoc/withContext.js.map +1 -1
  88. package/package.json +10 -10
  89. package/src/components/EntityManager/Entity/Entity.js +4 -2
  90. package/src/components/ListingTable/ListingTableContent/ListingTableContent.js +3 -3
  91. package/src/components/ListingTable/SearchFilter/SearchContainer.js +105 -120
  92. package/src/components/Tabs/index.js +2 -6
  93. package/src/utils/hoc/withContext.js +5 -4
@@ -23,20 +23,17 @@ const SearchContainer = ({
23
23
  const displaySearchFilter = keywordFiltersToUse.length > 0;
24
24
  const displaySelectFilters = selectFiltersToDisplay.length > 0;
25
25
 
26
- const { keywordSearchProperties, keywordSearchLabels } = useMemo(
27
- () => {
28
- const labels = [];
29
- const properties = [];
26
+ const { keywordSearchProperties, keywordSearchLabels } = useMemo(() => {
27
+ const labels = [];
28
+ const properties = [];
30
29
 
31
- keywordFiltersToUse.forEach(([property, { label }]) => {
32
- if (label) labels.push(label);
33
- properties.push(property);
34
- });
30
+ keywordFiltersToUse.forEach(([property, { label }]) => {
31
+ if (label) labels.push(label);
32
+ properties.push(property);
33
+ });
35
34
 
36
- return { keywordSearchProperties: properties, keywordSearchLabels: labels };
37
- },
38
- [keywordFiltersToUse]
39
- );
35
+ return { keywordSearchProperties: properties, keywordSearchLabels: labels };
36
+ }, [keywordFiltersToUse]);
40
37
 
41
38
  const { gqlFields, rawQuery } = useMemo(
42
39
  () => buildQueryFields(selectFiltersToDisplay, schema.id),
@@ -52,101 +49,93 @@ const SearchContainer = ({
52
49
  fetchPolicy: 'cache-and-network'
53
50
  });
54
51
 
55
- const filterData = useMemo(
56
- () => {
57
- const { searchResults: { rawResults: { aggregations = {} } = {} } = {} } = data || {};
58
- const proccessedData = [];
59
- Object.entries(aggregations).forEach(([key, { buckets }]) => {
60
- proccessedData.push(
61
- Array.isArray(buckets) ? [key, buckets.map(b => b.key).filter(Boolean)] : []
62
- );
63
- });
64
-
65
- return proccessedData;
66
- },
67
- [data]
68
- );
52
+ const filterData = useMemo(() => {
53
+ const { searchResults: { rawResults: { aggregations = {} } = {} } = {} } = data || {};
54
+ const proccessedData = [];
55
+ Object.entries(aggregations).forEach(([key, { buckets }]) => {
56
+ proccessedData.push(
57
+ Array.isArray(buckets) ? [key, buckets.map(b => b.key).filter(Boolean)] : []
58
+ );
59
+ });
69
60
 
70
- useEffect(
71
- () => {
72
- if (!filterData.length) {
73
- setSelectOptions([]);
74
- return;
75
- }
76
-
77
- (async () => {
78
- const results = await Promise.all(
79
- filterData.map(async ([property, ids]) => {
80
- try {
81
- if (!ids || !ids.length) return {};
82
-
83
- const [, selectionDetails] =
84
- selectFiltersToDisplay.find(([selectProperty]) => selectProperty === property) ||
85
- [];
86
-
87
- if (!selectionDetails) return null;
88
-
89
- if (!selectionDetails.relation) {
90
- return {
91
- id: property,
92
- label: selectionDetails.label,
93
- options: ids.map(value => [value, value])
94
- };
95
- }
96
- const query = getQuery('GET_ENTITY_SCHEMA');
97
- const {
98
- data: {
99
- getEntitySchemas: [relationSchema]
100
- }
101
- } = await apolloClient.query({
102
- query,
103
- variables: { identifier: selectionDetails.relation.entityIdentifier }
104
- });
105
-
106
- const {
107
- data: { result: selected = [] }
108
- } = await apolloClient
109
- .query({
110
- query: getDynamicQuery('GET_ALL_ENTITIES')(relationSchema),
111
- variables: {
112
- where: {
113
- id: {
114
- _in: ids
115
- }
116
- },
117
- sort: [{ property: 'name', direction: 'asc' }]
118
- }
119
- })
120
- // eslint-disable-next-line no-console
121
- .catch(e => console.error(e));
61
+ return proccessedData;
62
+ }, [data]);
63
+
64
+ useEffect(() => {
65
+ if (!filterData.length) {
66
+ setSelectOptions([]);
67
+ return;
68
+ }
69
+
70
+ (async () => {
71
+ const results = await Promise.all(
72
+ filterData.map(async ([property, ids]) => {
73
+ try {
74
+ if (!ids || !ids.length) return {};
75
+
76
+ const [, selectionDetails] =
77
+ selectFiltersToDisplay.find(([selectProperty]) => selectProperty === property) || [];
78
+
79
+ if (!selectionDetails) return null;
122
80
 
81
+ if (!selectionDetails.relation) {
123
82
  return {
124
83
  id: property,
125
84
  label: selectionDetails.label,
126
- options: selected.map(item => [item.id, item.name])
85
+ options: ids.map(value => [value, value])
127
86
  };
128
- } catch {
129
- return null;
130
87
  }
131
- })
132
- );
88
+ const query = getQuery('GET_ENTITY_SCHEMA');
89
+ const {
90
+ data: {
91
+ getEntitySchemas: [relationSchema]
92
+ }
93
+ } = await apolloClient.query({
94
+ query,
95
+ variables: { identifier: selectionDetails.relation.entityIdentifier }
96
+ });
97
+
98
+ const {
99
+ data: { result: selected = [] }
100
+ } = await apolloClient
101
+ .query({
102
+ query: getDynamicQuery('GET_ALL_ENTITIES')(relationSchema),
103
+ variables: {
104
+ where: {
105
+ id: {
106
+ _in: ids
107
+ }
108
+ },
109
+ sort: [{ property: 'name', direction: 'asc' }]
110
+ }
111
+ })
112
+ // eslint-disable-next-line no-console
113
+ .catch(e => console.error(e));
114
+
115
+ return {
116
+ id: property,
117
+ label: selectionDetails.label,
118
+ options: selected.map(item => [item.id, item.name])
119
+ };
120
+ } catch {
121
+ return null;
122
+ }
123
+ })
124
+ );
133
125
 
134
- setSelectOptions(results.filter(Boolean));
135
- })();
136
- },
137
- [apolloClient, filterData, schema, selectFiltersToDisplay]
138
- );
126
+ setSelectOptions(results.filter(Boolean));
127
+ })();
128
+ }, [apolloClient, filterData, schema, selectFiltersToDisplay]);
139
129
 
140
130
  const updateFilters = useCallback(
141
131
  (term, filters) => updateListFilters(term, filters, setListFilters, keywordSearchProperties),
142
132
  [setListFilters, keywordSearchProperties]
143
133
  );
144
134
 
145
- const handleSearch = useCallback(() => updateFilters(searchTerm, selectedFilters), [
146
- searchTerm,
147
- selectedFilters,
148
- updateFilters
149
- ]);
135
+ const handleSearch = useCallback(
136
+ () => updateFilters(searchTerm, selectedFilters),
137
+ [searchTerm, selectedFilters, updateFilters]
138
+ );
150
139
  const handleSearchChange = useCallback(e => setSearchTerm(e.target.value), []);
151
140
  const handleEnterKey = useCallback(
152
141
  e => {
@@ -154,19 +143,16 @@ const SearchContainer = ({
154
143
  },
155
144
  [handleSearch]
156
145
  );
157
- const handleReset = useCallback(
158
- () => {
159
- setSearchTerm('');
160
- setSelectedFilters(
161
- Object.keys(selectedFilters).reduce(
162
- (acc, key) => ({ ...acc, [key]: DEFAULT_FILTER_OPTION_LABEL }),
163
- {}
164
- )
165
- );
166
- updateFilters('', {});
167
- },
168
- [selectedFilters, updateFilters]
169
- );
146
+ const handleReset = useCallback(() => {
147
+ setSearchTerm('');
148
+ setSelectedFilters(
149
+ Object.keys(selectedFilters).reduce(
150
+ (acc, key) => ({ ...acc, [key]: DEFAULT_FILTER_OPTION_LABEL }),
151
+ {}
152
+ )
153
+ );
154
+ updateFilters('', {});
155
+ }, [selectedFilters, updateFilters]);
170
156
  const handleSelect = useCallback(
171
157
  (property, event) => {
172
158
  const { value } = event;
@@ -200,20 +186,19 @@ const SearchContainer = ({
200
186
  {displaySelectFilters &&
201
187
  selectOptions.map(({ id, options, label }) => (
202
188
  <>
203
- {options &&
204
- !!options.length && (
205
- <div className="search-container__select-wrapper">
206
- <Select
207
- label={label}
208
- id={id}
209
- name={id}
210
- onChange={event => handleSelect(id, event)}
211
- options={options}
212
- value={selectedFilters[id]}
213
- defaultTextValue={DEFAULT_FILTER_OPTION_LABEL}
214
- />
215
- </div>
216
- )}
189
+ {options && !!options.length && (
190
+ <div className="search-container__select-wrapper">
191
+ <Select
192
+ label={label}
193
+ id={id}
194
+ name={id}
195
+ onChange={event => handleSelect(id, event)}
196
+ options={options}
197
+ value={selectedFilters[id]}
198
+ defaultTextValue={DEFAULT_FILTER_OPTION_LABEL}
199
+ />
200
+ </div>
201
+ )}
217
202
  </>
218
203
  ))}
219
204
 
@@ -1,11 +1,7 @@
1
1
  import React, { useState } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import { Tab, TabItem } from '@blaze-react/tab';
4
- import {
5
- useReadFromCache,
6
- GET_CURRENT_TAB_ID,
7
- TabsContextProvider
8
- } from '@blaze-cms/admin-ui-utils';
4
+ import { useTabsContext, TabsContextProvider } from '@blaze-cms/admin-ui-utils';
9
5
  import {
10
6
  PAGE_BUILDER_TAB,
11
7
  PAGE_BUILDER_TAB_INDEX,
@@ -14,7 +10,7 @@ import {
14
10
  } from '../../constants';
15
11
 
16
12
  const Tabs = ({ children, onTabChange, enabled }) => {
17
- const { currentTabId } = useReadFromCache({ query: GET_CURRENT_TAB_ID }) || EDITOR_VIEW_TAB_INDEX;
13
+ const { currentTabId = EDITOR_VIEW_TAB_INDEX } = useTabsContext() || {};
18
14
  const [activeAccordions, setActiveAccordions] = useState([]);
19
15
 
20
16
  if (!enabled) return children;
@@ -1,7 +1,8 @@
1
1
  import React from 'react';
2
2
  import { useMainContext, MainContext } from '@blaze-cms/admin-ui-utils';
3
3
 
4
- export const withContext = Component => props => {
5
- const contexts = useMainContext(MainContext);
6
- return <Component {...props} {...contexts} />;
7
- };
4
+ export const withContext = Component =>
5
+ function (props) {
6
+ const contexts = useMainContext(MainContext);
7
+ return <Component {...props} {...contexts} />;
8
+ };