@blaze-cms/plugin-data-ui 0.146.0-core-styles.44 → 0.146.0-node18.1
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 +16 -163
- 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 +6 -6
- package/lib/components/EntityManager/Entity/Entity.js.map +1 -1
- package/lib/components/EntityManager/Entity/EntityHeader/EntityHeader.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/hooks/useCustomSidebarData.js.map +1 -1
- package/lib/components/EntityManager/Entity/SideBarRelations/index.js +6 -6
- 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/InfoBoxes/hooks/useData.js.map +1 -1
- package/lib/components/ListingTable/ListingTable.js +8 -8
- package/lib/components/ListingTable/ListingTable.js.map +1 -1
- package/lib/components/ListingTable/ListingTableContent/ListingTableContent.js +2 -2
- package/lib/components/ListingTable/ListingTableContent/ListingTableContent.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 +1 -1
- 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-es/components/EntityManager/Entity/Entity.js +1 -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/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/index.js +1 -1
- package/lib-es/components/EntityManager/Entity/SideBarRelations/index.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/query.js.map +1 -1
- package/lib-es/components/InfoBoxes/container/InfoBoxContainer.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 +1 -1
- package/lib-es/components/ListingTable/ListingTable.js.map +1 -1
- package/lib-es/components/ListingTable/ListingTableContent/ListingTableContent.js +2 -2
- package/lib-es/components/ListingTable/ListingTableContent/ListingTableContent.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/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/package.json +18 -17
- package/src/components/EntityManager/Entity/Entity.js +41 -44
- package/src/components/EntityManager/Entity/EntityHeader/EntityHeader.js +1 -2
- package/src/components/EntityManager/Entity/SideBarRelations/hooks/useCustomSidebarData.js +9 -7
- package/src/components/EntityManager/Entity/SideBarRelations/index.js +40 -51
- package/src/components/EntityManager/EntityManager.js +52 -45
- package/src/components/InfoBoxes/container/InfoBoxContainer.js +3 -6
- package/src/components/InfoBoxes/hooks/useData.js +6 -1
- package/src/components/ListingTable/ListingTable.js +26 -29
- package/src/components/ListingTable/ListingTableContent/ListingTableContent.js +15 -17
- package/src/components/ListingTable/service/index.js +2 -3
- package/src/index.js +4 -4
|
@@ -12,51 +12,43 @@ import EntityNavLinks from '../EntitiyNavLinks';
|
|
|
12
12
|
|
|
13
13
|
const SideBarRelations = ({ schema, onChange, formData, entity }) => {
|
|
14
14
|
const { relation: RelationComponent } = formFieldTypes;
|
|
15
|
-
const {
|
|
16
|
-
|
|
17
|
-
formattedUpdated,
|
|
18
|
-
formattedCreated,
|
|
19
|
-
formattedPublished,
|
|
20
|
-
status
|
|
21
|
-
} = formData;
|
|
15
|
+
const { formattedStatus, formattedUpdated, formattedCreated, formattedPublished, status } =
|
|
16
|
+
formData;
|
|
22
17
|
const client = useApolloClient();
|
|
23
18
|
|
|
24
19
|
const [relationsComponents, setRelationsComponents] = useState(null);
|
|
25
20
|
|
|
26
|
-
useEffect(
|
|
27
|
-
() => {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
if (!entityIdentifier) return null;
|
|
21
|
+
useEffect(() => {
|
|
22
|
+
(async () => {
|
|
23
|
+
const fetchRelationSchema = async ({ entityIdentifier }) => {
|
|
24
|
+
if (!entityIdentifier) return null;
|
|
31
25
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
26
|
+
const {
|
|
27
|
+
data: {
|
|
28
|
+
getEntitySchemas: [relationSchema]
|
|
29
|
+
}
|
|
30
|
+
} = await client.query({
|
|
31
|
+
query: getQuery('GET_ENTITY_SCHEMA'),
|
|
32
|
+
variables: { identifier: entityIdentifier }
|
|
33
|
+
});
|
|
34
|
+
return relationSchema;
|
|
35
|
+
};
|
|
42
36
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
37
|
+
if (!relationsComponents && schema) {
|
|
38
|
+
const allRelationComponents = await Promise.all(
|
|
39
|
+
schema.relations
|
|
40
|
+
.filter(({ showInForm, foreignKey }) => showInForm && schema.properties[foreignKey])
|
|
41
|
+
.map(async relation => ({
|
|
42
|
+
id: uuidv1(),
|
|
43
|
+
staticData: relation,
|
|
44
|
+
schema: await fetchRelationSchema(relation)
|
|
45
|
+
}))
|
|
46
|
+
);
|
|
53
47
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
[client, relationsComponents, schema, schema.relations]
|
|
59
|
-
);
|
|
48
|
+
setRelationsComponents(allRelationComponents);
|
|
49
|
+
}
|
|
50
|
+
})();
|
|
51
|
+
}, [client, relationsComponents, schema, schema.relations]);
|
|
60
52
|
const { id: itemId } = entity;
|
|
61
53
|
const { identifier: itemEntity, interfaces } = schema;
|
|
62
54
|
|
|
@@ -82,19 +74,16 @@ const SideBarRelations = ({ schema, onChange, formData, entity }) => {
|
|
|
82
74
|
)}
|
|
83
75
|
</div>
|
|
84
76
|
)}
|
|
85
|
-
{!schema.displayProperties.disableDefaultAdminInfo &&
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
</>
|
|
96
|
-
</>
|
|
97
|
-
)}
|
|
77
|
+
{!schema.displayProperties.disableDefaultAdminInfo && formattedCreated && (
|
|
78
|
+
<>
|
|
79
|
+
<p>
|
|
80
|
+
Created: <span>{formattedCreated}</span>
|
|
81
|
+
</p>
|
|
82
|
+
<p>
|
|
83
|
+
Updated: <span>{formattedUpdated}</span>
|
|
84
|
+
</p>
|
|
85
|
+
</>
|
|
86
|
+
)}
|
|
98
87
|
|
|
99
88
|
<CustomSidebarInfoContainer
|
|
100
89
|
id={itemId}
|
|
@@ -19,56 +19,63 @@ const EntityManager = ({ match, history }) => {
|
|
|
19
19
|
|
|
20
20
|
const { action, entityIdentifier, id = null, onViewUrl } = match.params;
|
|
21
21
|
|
|
22
|
-
useEffect(
|
|
23
|
-
() => {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
addToast(PAGE_NOT_FOUND, {
|
|
34
|
-
appearance: ERROR,
|
|
35
|
-
autoDismiss: true
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
history.push(`/data-listing/${entityIdentifier}`);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
let localData = data;
|
|
42
|
-
|
|
43
|
-
if (isPageBuilderTemplateSet(data)) {
|
|
44
|
-
const pageBuilderComponents = await getPageBuilderComponents({
|
|
45
|
-
entitySchema,
|
|
46
|
-
client,
|
|
47
|
-
id
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
localData = {
|
|
51
|
-
...localData,
|
|
52
|
-
pageBuilder: pageBuilderComponents || localData.pageBuilder
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
setFormData({ values: localData });
|
|
57
|
-
setEntity(data);
|
|
58
|
-
setSchema(entitySchema);
|
|
59
|
-
setPreviousQuery(requestedQuery);
|
|
60
|
-
setShouldRefetch(false);
|
|
61
|
-
} catch (error) {
|
|
62
|
-
addToast(error.message, {
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
(async () => {
|
|
24
|
+
try {
|
|
25
|
+
const [entitySchema, data = {}, requestedQuery] = await entityAvailableActions[action]({
|
|
26
|
+
client,
|
|
27
|
+
identifier: entityIdentifier,
|
|
28
|
+
id
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
if (!data) {
|
|
32
|
+
addToast(PAGE_NOT_FOUND, {
|
|
63
33
|
appearance: ERROR,
|
|
64
34
|
autoDismiss: true
|
|
65
35
|
});
|
|
36
|
+
|
|
66
37
|
history.push(`/data-listing/${entityIdentifier}`);
|
|
67
38
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
39
|
+
|
|
40
|
+
let localData = data;
|
|
41
|
+
|
|
42
|
+
if (isPageBuilderTemplateSet(data)) {
|
|
43
|
+
const pageBuilderComponents = await getPageBuilderComponents({
|
|
44
|
+
entitySchema,
|
|
45
|
+
client,
|
|
46
|
+
id
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
localData = {
|
|
50
|
+
...localData,
|
|
51
|
+
pageBuilder: pageBuilderComponents || localData.pageBuilder
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
setFormData({ values: localData });
|
|
56
|
+
setEntity(data);
|
|
57
|
+
setSchema(entitySchema);
|
|
58
|
+
setPreviousQuery(requestedQuery);
|
|
59
|
+
setShouldRefetch(false);
|
|
60
|
+
} catch (error) {
|
|
61
|
+
addToast(error.message, {
|
|
62
|
+
appearance: ERROR,
|
|
63
|
+
autoDismiss: true
|
|
64
|
+
});
|
|
65
|
+
history.push(`/data-listing/${entityIdentifier}`);
|
|
66
|
+
}
|
|
67
|
+
})();
|
|
68
|
+
}, [
|
|
69
|
+
action,
|
|
70
|
+
addToast,
|
|
71
|
+
client,
|
|
72
|
+
entityIdentifier,
|
|
73
|
+
history,
|
|
74
|
+
history.push,
|
|
75
|
+
id,
|
|
76
|
+
schema,
|
|
77
|
+
shouldRefetch
|
|
78
|
+
]);
|
|
72
79
|
|
|
73
80
|
const updateFormData = (updatedFormData, shouldRefresh) => {
|
|
74
81
|
if (shouldRefresh) setShouldRefetch(true);
|
|
@@ -9,12 +9,9 @@ const InfoBoxContainer = ({ id, schema, infoBox }) => {
|
|
|
9
9
|
|
|
10
10
|
const { data, refetch } = useData({ id, schema, infoBox });
|
|
11
11
|
|
|
12
|
-
useEffect(
|
|
13
|
-
()
|
|
14
|
-
|
|
15
|
-
},
|
|
16
|
-
[externalUpdateTime, refetch]
|
|
17
|
-
);
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
refetch();
|
|
14
|
+
}, [externalUpdateTime, refetch]);
|
|
18
15
|
|
|
19
16
|
if (!data || !Object.keys(data) || Object.keys(data).length === 0) return null;
|
|
20
17
|
|
|
@@ -12,7 +12,12 @@ function useData({ id, schema, infoBox }) {
|
|
|
12
12
|
}
|
|
13
13
|
`;
|
|
14
14
|
|
|
15
|
-
const {
|
|
15
|
+
const {
|
|
16
|
+
data = {},
|
|
17
|
+
loading,
|
|
18
|
+
error,
|
|
19
|
+
refetch
|
|
20
|
+
} = useQuery(infoBoxQuery, {
|
|
16
21
|
variables: { id },
|
|
17
22
|
skip: !query
|
|
18
23
|
});
|
|
@@ -144,7 +144,6 @@ const ListingTable = ({ match, entitySchema, history }) => {
|
|
|
144
144
|
});
|
|
145
145
|
history.push('?page=1');
|
|
146
146
|
};
|
|
147
|
-
|
|
148
147
|
if (!tableData || !tableData.rows) return 'loading';
|
|
149
148
|
|
|
150
149
|
const {
|
|
@@ -160,35 +159,33 @@ const ListingTable = ({ match, entitySchema, history }) => {
|
|
|
160
159
|
|
|
161
160
|
return (
|
|
162
161
|
<div className="page">
|
|
163
|
-
{modalStatus &&
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
)}
|
|
162
|
+
{modalStatus && _deleteAction.active && (
|
|
163
|
+
<DeleteAction
|
|
164
|
+
data-testid="deleteEntity"
|
|
165
|
+
onClose={toggleModal}
|
|
166
|
+
deleteAction={deleteAction}
|
|
167
|
+
itemName={itemToDelete.name}
|
|
168
|
+
/>
|
|
169
|
+
)}
|
|
172
170
|
<PageHeader title={entitySchema.displayName} subtitle="">
|
|
173
|
-
{createAction.active &&
|
|
174
|
-
|
|
175
|
-
<
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
<
|
|
183
|
-
<More>
|
|
184
|
-
<
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
)}
|
|
171
|
+
{createAction.active && !showAddButton && (
|
|
172
|
+
<>
|
|
173
|
+
<Link
|
|
174
|
+
data-testid="addEntity"
|
|
175
|
+
className="button button--small"
|
|
176
|
+
to={`${match.url}/create`}>
|
|
177
|
+
Add
|
|
178
|
+
</Link>
|
|
179
|
+
<PageHeader.Actions>
|
|
180
|
+
<More>
|
|
181
|
+
<More.Avatar isMoreMenu>
|
|
182
|
+
<span className="material-icons">more_vert</span>
|
|
183
|
+
</More.Avatar>
|
|
184
|
+
<More.Content isMoreMenu />
|
|
185
|
+
</More>
|
|
186
|
+
</PageHeader.Actions>
|
|
187
|
+
</>
|
|
188
|
+
)}
|
|
192
189
|
</PageHeader>
|
|
193
190
|
{showAddButton ? (
|
|
194
191
|
<CardPrompt>
|
|
@@ -20,23 +20,21 @@ const ListingTableContent = ({
|
|
|
20
20
|
return (
|
|
21
21
|
<>
|
|
22
22
|
{displayTable ? (
|
|
23
|
-
|
|
24
|
-
<
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
</div>
|
|
39
|
-
</>
|
|
23
|
+
<div className={className}>
|
|
24
|
+
<Table
|
|
25
|
+
onSort={onSort}
|
|
26
|
+
data={tableData}
|
|
27
|
+
checkboxes={!isEnquiry}
|
|
28
|
+
onSelect={handleSelect}
|
|
29
|
+
data-testid="listing-table-content"
|
|
30
|
+
/>
|
|
31
|
+
<Pagination
|
|
32
|
+
visiblePages={10}
|
|
33
|
+
totalItems={totalItems}
|
|
34
|
+
currentPage={currentPage}
|
|
35
|
+
onPageChange={handleOnPageChange}
|
|
36
|
+
/>
|
|
37
|
+
</div>
|
|
40
38
|
) : (
|
|
41
39
|
<span className="table-no-results" data-testid="no-results">
|
|
42
40
|
No results
|
|
@@ -34,9 +34,8 @@ function buildVariables({ entitySchema, isSearchQuery, listFilters = [], queryPa
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
const fetchData = async ({ client, querySettings: { entitySchema, queryParams }, listFilters }) => {
|
|
37
|
-
const {
|
|
38
|
-
|
|
39
|
-
} = entitySchema;
|
|
37
|
+
const { displayProperties: { adminListings: { dataSource: { source } = {} } = {} } = {} } =
|
|
38
|
+
entitySchema;
|
|
40
39
|
|
|
41
40
|
const isSearchQuery = source === 'search';
|
|
42
41
|
const query = buildListingQuery(entitySchema, isSearchQuery);
|
package/src/index.js
CHANGED
|
@@ -5,11 +5,11 @@ import { DATA_LISTING_PREFIX, PLUGIN_NAME } from './constants';
|
|
|
5
5
|
import getAddContentMenuItems from './utils/add-content-menu-items';
|
|
6
6
|
import { UserIcon, TaxonomyIcon, ContentIcon, SettingsIcon } from './icons';
|
|
7
7
|
|
|
8
|
-
const EntityDataListing = React.lazy(
|
|
9
|
-
import(/* webpackChunkName: 'EntityDataListing' */ './components/EntityDataListing')
|
|
8
|
+
const EntityDataListing = React.lazy(
|
|
9
|
+
() => import(/* webpackChunkName: 'EntityDataListing' */ './components/EntityDataListing')
|
|
10
10
|
);
|
|
11
|
-
const EntityManager = React.lazy(
|
|
12
|
-
import(/* webpackChunkName: 'EntityManager' */ './components/EntityManager')
|
|
11
|
+
const EntityManager = React.lazy(
|
|
12
|
+
() => import(/* webpackChunkName: 'EntityManager' */ './components/EntityManager')
|
|
13
13
|
);
|
|
14
14
|
|
|
15
15
|
export default async function load(app) {
|