@blaze-cms/plugin-data-ui 0.127.0-project-admin-customisations.3 → 0.128.0-admin-updates.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -29
- package/README.md +0 -2
- package/lib/components/EntityManager/Entity/Entity.js +1 -10
- package/lib/components/EntityManager/Entity/Entity.js.map +1 -1
- package/lib/components/Tabs/index.js +18 -2
- package/lib/components/Tabs/index.js.map +1 -1
- package/lib-es/components/EntityManager/Entity/Entity.js +1 -10
- package/lib-es/components/EntityManager/Entity/Entity.js.map +1 -1
- package/lib-es/components/Tabs/index.js +5 -2
- package/lib-es/components/Tabs/index.js.map +1 -1
- package/package.json +9 -10
- package/src/components/EntityManager/Entity/Entity.js +0 -4
- package/src/components/Tabs/index.js +3 -2
- package/lib/components/InfoBoxes/InfoBoxes.js +0 -36
- package/lib/components/InfoBoxes/InfoBoxes.js.map +0 -1
- package/lib/components/InfoBoxes/container/InfoBoxContainer.js +0 -44
- package/lib/components/InfoBoxes/container/InfoBoxContainer.js.map +0 -1
- package/lib/components/InfoBoxes/helpers/build-dynamic-query.js +0 -25
- package/lib/components/InfoBoxes/helpers/build-dynamic-query.js.map +0 -1
- package/lib/components/InfoBoxes/hooks/useData.js +0 -42
- package/lib/components/InfoBoxes/hooks/useData.js.map +0 -1
- package/lib/components/InfoBoxes/hooks/useInfoBox.js +0 -26
- package/lib/components/InfoBoxes/hooks/useInfoBox.js.map +0 -1
- package/lib/components/InfoBoxes/index.js +0 -12
- package/lib/components/InfoBoxes/index.js.map +0 -1
- package/lib/components/InfoBoxes/presentational/InfoBox.js +0 -46
- package/lib/components/InfoBoxes/presentational/InfoBox.js.map +0 -1
- package/lib-es/components/InfoBoxes/InfoBoxes.js +0 -28
- package/lib-es/components/InfoBoxes/InfoBoxes.js.map +0 -1
- package/lib-es/components/InfoBoxes/container/InfoBoxContainer.js +0 -30
- package/lib-es/components/InfoBoxes/container/InfoBoxContainer.js.map +0 -1
- package/lib-es/components/InfoBoxes/helpers/build-dynamic-query.js +0 -25
- package/lib-es/components/InfoBoxes/helpers/build-dynamic-query.js.map +0 -1
- package/lib-es/components/InfoBoxes/hooks/useData.js +0 -37
- package/lib-es/components/InfoBoxes/hooks/useData.js.map +0 -1
- package/lib-es/components/InfoBoxes/hooks/useInfoBox.js +0 -19
- package/lib-es/components/InfoBoxes/hooks/useInfoBox.js.map +0 -1
- package/lib-es/components/InfoBoxes/index.js +0 -3
- package/lib-es/components/InfoBoxes/index.js.map +0 -1
- package/lib-es/components/InfoBoxes/presentational/InfoBox.js +0 -31
- package/lib-es/components/InfoBoxes/presentational/InfoBox.js.map +0 -1
- package/src/components/InfoBoxes/InfoBoxes.js +0 -24
- package/src/components/InfoBoxes/container/InfoBoxContainer.js +0 -22
- package/src/components/InfoBoxes/helpers/build-dynamic-query.js +0 -25
- package/src/components/InfoBoxes/hooks/useData.js +0 -20
- package/src/components/InfoBoxes/hooks/useInfoBox.js +0 -13
- package/src/components/InfoBoxes/index.js +0 -3
- package/src/components/InfoBoxes/presentational/InfoBox.js +0 -34
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { gql } from '@apollo/client';
|
|
2
|
-
import { BlazeError } from '@blaze-cms/core-errors';
|
|
3
|
-
|
|
4
|
-
export default function buildDynamicQuery({ id, schema, infoBox }) {
|
|
5
|
-
if (!schema || !schema.actions || !schema.actions.get || !schema.properties) {
|
|
6
|
-
throw new BlazeError(
|
|
7
|
-
'DataEntity query requires get action, properties and fields from entity schema'
|
|
8
|
-
);
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
const fields = `${infoBox.property} {
|
|
12
|
-
label
|
|
13
|
-
value
|
|
14
|
-
}`;
|
|
15
|
-
|
|
16
|
-
return {
|
|
17
|
-
query: gql`query getInfoBoxData($id: String!){
|
|
18
|
-
${schema.actions.get}( id: $id ) {
|
|
19
|
-
id
|
|
20
|
-
${fields}
|
|
21
|
-
__typename
|
|
22
|
-
}
|
|
23
|
-
}`
|
|
24
|
-
};
|
|
25
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { useQuery, gql } from '@apollo/client';
|
|
2
|
-
import useInfoBoxData from './useInfoBox';
|
|
3
|
-
|
|
4
|
-
function useData({ id, schema, infoBox }) {
|
|
5
|
-
const { query } = useInfoBoxData({ id, schema, infoBox });
|
|
6
|
-
|
|
7
|
-
const infoBoxQuery =
|
|
8
|
-
query ||
|
|
9
|
-
gql`
|
|
10
|
-
query {
|
|
11
|
-
__typename
|
|
12
|
-
}
|
|
13
|
-
`;
|
|
14
|
-
|
|
15
|
-
const { data = {}, loading, error } = useQuery(infoBoxQuery, { variables: { id }, skip: !query });
|
|
16
|
-
|
|
17
|
-
return { data: data.__typename !== 'Query' ? data : null, loading, error };
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export default useData;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import buildDynamicQuery from '../helpers/build-dynamic-query';
|
|
2
|
-
|
|
3
|
-
function useInfoBox({ id, schema, infoBox }) {
|
|
4
|
-
const { query } = buildDynamicQuery({
|
|
5
|
-
id,
|
|
6
|
-
schema,
|
|
7
|
-
infoBox
|
|
8
|
-
});
|
|
9
|
-
|
|
10
|
-
return { query: query || null };
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export default useInfoBox;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import PropTypes from 'prop-types';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
|
|
4
|
-
const InfoBox = ({ items, infoBoxKey }) => {
|
|
5
|
-
if (!items) return null;
|
|
6
|
-
|
|
7
|
-
const infoBoxItems = items.map(item =>
|
|
8
|
-
Object.values(item)
|
|
9
|
-
.map(info => {
|
|
10
|
-
if (!info.label || !info.value) return null;
|
|
11
|
-
|
|
12
|
-
return (
|
|
13
|
-
<div className="info-box--item" key={`${infoBoxKey}-${info.label.toLowerCase()}`}>
|
|
14
|
-
<div className="info-box--label">{info.label}: </div>
|
|
15
|
-
<div className="info-box--value">{info.value}</div>
|
|
16
|
-
</div>
|
|
17
|
-
);
|
|
18
|
-
})
|
|
19
|
-
.filter(Boolean)
|
|
20
|
-
);
|
|
21
|
-
|
|
22
|
-
return (
|
|
23
|
-
<div className="info-box" key={infoBoxKey}>
|
|
24
|
-
<div className="info-box--container">{infoBoxItems}</div>
|
|
25
|
-
</div>
|
|
26
|
-
);
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
export default InfoBox;
|
|
30
|
-
|
|
31
|
-
InfoBox.propTypes = {
|
|
32
|
-
infoBoxKey: PropTypes.string.isRequired,
|
|
33
|
-
items: PropTypes.array.isRequired
|
|
34
|
-
};
|