@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.
- package/CHANGELOG.md +186 -36
- package/lib/components/EntityManager/Entity/EntitiyNavLinks/EntityNavLinks.js +1 -0
- package/lib/components/EntityManager/Entity/EntitiyNavLinks/EntityNavLinks.js.map +1 -1
- package/lib/components/EntityManager/Entity/Entity.js +7 -6
- package/lib/components/EntityManager/Entity/Entity.js.map +1 -1
- package/lib/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/HeaderPreviewButton.js +1 -1
- package/lib/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/HeaderPreviewButton.js.map +1 -1
- package/lib/components/EntityManager/Entity/SideBarRelations/helpers/build-dynamic-query.js +1 -0
- package/lib/components/EntityManager/Entity/SideBarRelations/helpers/build-dynamic-query.js.map +1 -1
- package/lib/components/EntityManager/Entity/SideBarRelations/index.js +5 -5
- package/lib/components/EntityManager/Entity/SideBarRelations/index.js.map +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/create/submit.js +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/create/submit.js.map +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/delete/delete.js +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/delete/delete.js.map +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/shared/publish.js +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/shared/publish.js.map +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/update/submit.js +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/update/submit.js.map +1 -1
- package/lib/components/EntityManager/EntityManager.js +3 -3
- package/lib/components/EntityManager/EntityManager.js.map +1 -1
- package/lib/components/EntityManager/utils/entity.js +1 -1
- package/lib/components/EntityManager/utils/entity.js.map +1 -1
- package/lib/components/EntityManager/utils/entityAvailableActions.js +2 -2
- package/lib/components/EntityManager/utils/entityAvailableActions.js.map +1 -1
- package/lib/components/InfoBoxes/InfoBoxes.js +1 -0
- package/lib/components/InfoBoxes/InfoBoxes.js.map +1 -1
- package/lib/components/InfoBoxes/container/InfoBoxContainer.js +1 -1
- package/lib/components/InfoBoxes/container/InfoBoxContainer.js.map +1 -1
- package/lib/components/InfoBoxes/helpers/build-dynamic-query.js +1 -0
- package/lib/components/InfoBoxes/helpers/build-dynamic-query.js.map +1 -1
- package/lib/components/ListingTable/ListingTable.js +7 -7
- package/lib/components/ListingTable/ListingTable.js.map +1 -1
- package/lib/components/ListingTable/ListingTableContent/ListingTableContent.js +1 -1
- package/lib/components/ListingTable/ListingTableContent/ListingTableContent.js.map +1 -1
- package/lib/components/ListingTable/SearchFilter/SearchContainer.js +4 -4
- package/lib/components/ListingTable/SearchFilter/SearchContainer.js.map +1 -1
- package/lib/components/ListingTable/SearchFilter/SearchFilter.js +1 -1
- package/lib/components/ListingTable/SearchFilter/SearchFilter.js.map +1 -1
- package/lib/components/ListingTable/SearchFilter/helpers.js +1 -0
- package/lib/components/ListingTable/SearchFilter/helpers.js.map +1 -1
- package/lib/components/ListingTable/TableActions/TableActions.js.map +1 -1
- package/lib/components/ListingTable/service/index.js +2 -1
- package/lib/components/ListingTable/service/index.js.map +1 -1
- package/lib/components/Tabs/index.js +4 -5
- package/lib/components/Tabs/index.js.map +1 -1
- package/lib/index.js +5 -5
- package/lib/index.js.map +1 -1
- package/lib/utils/add-content-menu-items.js +1 -1
- package/lib/utils/add-content-menu-items.js.map +1 -1
- package/lib/utils/hoc/withContext.js.map +1 -1
- package/lib-es/components/EntityManager/Entity/Entity.js +2 -1
- package/lib-es/components/EntityManager/Entity/Entity.js.map +1 -1
- package/lib-es/components/EntityManager/Entity/EntityHeader/EntityHeader.js.map +1 -1
- package/lib-es/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/HeaderPreviewButton.js.map +1 -1
- package/lib-es/components/EntityManager/Entity/SideBarRelations/helpers/build-dynamic-query.js.map +1 -1
- package/lib-es/components/EntityManager/Entity/SideBarRelations/hooks/useCustomSidebarData.js.map +1 -1
- package/lib-es/components/EntityManager/Entity/SideBarRelations/presentational/CustomSidebarInfo.js.map +1 -1
- package/lib-es/components/EntityManager/Entity/actions-handlers/create/submit.js.map +1 -1
- package/lib-es/components/EntityManager/Entity/actions-handlers/shared/publish.js.map +1 -1
- package/lib-es/components/EntityManager/EntityManager.js.map +1 -1
- package/lib-es/components/EntityManager/utils/entity.js.map +1 -1
- package/lib-es/components/EntityManager/utils/query.js.map +1 -1
- package/lib-es/components/InfoBoxes/InfoBoxTooltip.js.map +1 -1
- package/lib-es/components/InfoBoxes/helpers/build-dynamic-query.js.map +1 -1
- package/lib-es/components/InfoBoxes/hooks/useData.js.map +1 -1
- package/lib-es/components/InfoBoxes/presentational/InfoBox.js.map +1 -1
- package/lib-es/components/InfoBoxes/presentational/InfoBoxLabel.js.map +1 -1
- package/lib-es/components/ListingTable/ListingTable.js.map +1 -1
- package/lib-es/components/ListingTable/ListingTableContent/ListingTableContent.js.map +1 -1
- package/lib-es/components/ListingTable/SearchFilter/SearchContainer.js.map +1 -1
- package/lib-es/components/ListingTable/SearchFilter/helpers.js.map +1 -1
- package/lib-es/components/ListingTable/SearchFilter/querys.js.map +1 -1
- package/lib-es/components/ListingTable/mappers/populate-rows.js.map +1 -1
- package/lib-es/components/ListingTable/service/index.js.map +1 -1
- package/lib-es/components/Tabs/index.js +3 -5
- package/lib-es/components/Tabs/index.js.map +1 -1
- package/lib-es/index.js +2 -2
- package/lib-es/index.js.map +1 -1
- package/lib-es/utils/add-content-menu-items.js.map +1 -1
- package/lib-es/utils/build-create-entity-mutation.js.map +1 -1
- package/lib-es/utils/build-delete-entity-mutation.js.map +1 -1
- package/lib-es/utils/build-listing-query.js.map +1 -1
- package/lib-es/utils/build-update-data-query.js.map +1 -1
- package/lib-es/utils/build-update-publish-unpublish-mutation.js.map +1 -1
- package/lib-es/utils/hoc/withContext.js +1 -1
- package/lib-es/utils/hoc/withContext.js.map +1 -1
- package/package.json +10 -10
- package/src/components/EntityManager/Entity/Entity.js +4 -2
- package/src/components/ListingTable/ListingTableContent/ListingTableContent.js +3 -3
- package/src/components/ListingTable/SearchFilter/SearchContainer.js +105 -120
- package/src/components/Tabs/index.js +2 -6
- 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
|
-
|
|
29
|
-
const properties = [];
|
|
26
|
+
const { keywordSearchProperties, keywordSearchLabels } = useMemo(() => {
|
|
27
|
+
const labels = [];
|
|
28
|
+
const properties = [];
|
|
30
29
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
30
|
+
keywordFiltersToUse.forEach(([property, { label }]) => {
|
|
31
|
+
if (label) labels.push(label);
|
|
32
|
+
properties.push(property);
|
|
33
|
+
});
|
|
35
34
|
|
|
36
|
-
|
|
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
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
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
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
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:
|
|
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
|
-
|
|
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(
|
|
146
|
-
searchTerm,
|
|
147
|
-
selectedFilters,
|
|
148
|
-
|
|
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
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
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
|
-
|
|
205
|
-
<
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
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 } =
|
|
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 =>
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
4
|
+
export const withContext = Component =>
|
|
5
|
+
function (props) {
|
|
6
|
+
const contexts = useMainContext(MainContext);
|
|
7
|
+
return <Component {...props} {...contexts} />;
|
|
8
|
+
};
|