@blaze-cms/plugin-data-ui 0.146.0-translations.8 → 0.147.0-rc-eagle.4
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/lib/components/EntityDataListing/EntityDataListing.js +21 -19
- package/lib/components/EntityDataListing/EntityDataListing.js.map +1 -1
- package/lib/components/EntityDataListing/index.js +2 -3
- package/lib/components/EntityDataListing/index.js.map +1 -1
- package/lib/components/EntityManager/Entity/EntitiyNavLinks/EntityNavLinks.js +18 -19
- package/lib/components/EntityManager/Entity/EntitiyNavLinks/EntityNavLinks.js.map +1 -1
- package/lib/components/EntityManager/Entity/EntitiyNavLinks/index.js +2 -3
- package/lib/components/EntityManager/Entity/EntitiyNavLinks/index.js.map +1 -1
- package/lib/components/EntityManager/Entity/Entity.js +284 -457
- package/lib/components/EntityManager/Entity/Entity.js.map +1 -1
- package/lib/components/EntityManager/Entity/EntityHeader/EntityHeader.js +62 -66
- package/lib/components/EntityManager/Entity/EntityHeader/EntityHeader.js.map +1 -1
- package/lib/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/HeaderPreviewButton.js +32 -56
- package/lib/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/HeaderPreviewButton.js.map +1 -1
- package/lib/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/index.js +2 -3
- package/lib/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/index.js.map +1 -1
- package/lib/components/EntityManager/Entity/EntityHeader/index.js +2 -3
- package/lib/components/EntityManager/Entity/EntityHeader/index.js.map +1 -1
- package/lib/components/EntityManager/Entity/SideBarRelations/container/CustomSidebarInfoContainer.js +20 -26
- package/lib/components/EntityManager/Entity/SideBarRelations/container/CustomSidebarInfoContainer.js.map +1 -1
- package/lib/components/EntityManager/Entity/SideBarRelations/helpers/build-dynamic-query.js +20 -17
- package/lib/components/EntityManager/Entity/SideBarRelations/helpers/build-dynamic-query.js.map +1 -1
- package/lib/components/EntityManager/Entity/SideBarRelations/hooks/useCustomSidebarData.js +34 -32
- package/lib/components/EntityManager/Entity/SideBarRelations/hooks/useCustomSidebarData.js.map +1 -1
- package/lib/components/EntityManager/Entity/SideBarRelations/index.js +95 -158
- package/lib/components/EntityManager/Entity/SideBarRelations/index.js.map +1 -1
- package/lib/components/EntityManager/Entity/SideBarRelations/presentational/CustomSidebarInfo.js +23 -30
- package/lib/components/EntityManager/Entity/SideBarRelations/presentational/CustomSidebarInfo.js.map +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/create/index.js +2 -3
- package/lib/components/EntityManager/Entity/actions-handlers/create/index.js.map +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/create/submit.js +42 -56
- package/lib/components/EntityManager/Entity/actions-handlers/create/submit.js.map +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/delete/delete.js +29 -45
- package/lib/components/EntityManager/Entity/actions-handlers/delete/delete.js.map +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/delete/index.js +2 -3
- package/lib/components/EntityManager/Entity/actions-handlers/delete/index.js.map +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/index.js +7 -8
- package/lib/components/EntityManager/Entity/actions-handlers/index.js.map +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/shared/index.js +2 -3
- package/lib/components/EntityManager/Entity/actions-handlers/shared/index.js.map +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/shared/publish.js +36 -57
- package/lib/components/EntityManager/Entity/actions-handlers/shared/publish.js.map +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/update/index.js +2 -3
- package/lib/components/EntityManager/Entity/actions-handlers/update/index.js.map +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/update/submit.js +47 -66
- package/lib/components/EntityManager/Entity/actions-handlers/update/submit.js.map +1 -1
- package/lib/components/EntityManager/Entity/index.js +2 -3
- package/lib/components/EntityManager/Entity/index.js.map +1 -1
- package/lib/components/EntityManager/EntityManager.js +91 -166
- package/lib/components/EntityManager/EntityManager.js.map +1 -1
- package/lib/components/EntityManager/index.js +2 -3
- package/lib/components/EntityManager/index.js.map +1 -1
- package/lib/components/EntityManager/utils/RecordEditContext/index.js +3 -4
- package/lib/components/EntityManager/utils/RecordEditContext/index.js.map +1 -1
- package/lib/components/EntityManager/utils/data-mappers.js +34 -46
- package/lib/components/EntityManager/utils/data-mappers.js.map +1 -1
- package/lib/components/EntityManager/utils/entity.js +35 -80
- package/lib/components/EntityManager/utils/entity.js.map +1 -1
- package/lib/components/EntityManager/utils/entityAvailableActions.js +51 -110
- package/lib/components/EntityManager/utils/entityAvailableActions.js.map +1 -1
- package/lib/components/EntityManager/utils/is-form-empty.js +6 -10
- package/lib/components/EntityManager/utils/is-form-empty.js.map +1 -1
- package/lib/components/EntityManager/utils/query.js +17 -10
- package/lib/components/EntityManager/utils/query.js.map +1 -1
- package/lib/components/InfoBoxes/InfoBoxTooltip.js +19 -16
- package/lib/components/InfoBoxes/InfoBoxTooltip.js.map +1 -1
- package/lib/components/InfoBoxes/InfoBoxes.js +19 -19
- package/lib/components/InfoBoxes/InfoBoxes.js.map +1 -1
- package/lib/components/InfoBoxes/container/InfoBoxContainer.js +26 -38
- package/lib/components/InfoBoxes/container/InfoBoxContainer.js.map +1 -1
- package/lib/components/InfoBoxes/helpers/build-dynamic-query.js +21 -16
- package/lib/components/InfoBoxes/helpers/build-dynamic-query.js.map +1 -1
- package/lib/components/InfoBoxes/hooks/useData.js +33 -30
- package/lib/components/InfoBoxes/hooks/useData.js.map +1 -1
- package/lib/components/InfoBoxes/hooks/useInfoBox.js +10 -10
- package/lib/components/InfoBoxes/hooks/useInfoBox.js.map +1 -1
- package/lib/components/InfoBoxes/index.js +2 -3
- package/lib/components/InfoBoxes/index.js.map +1 -1
- package/lib/components/InfoBoxes/presentational/InfoBox.js +27 -34
- package/lib/components/InfoBoxes/presentational/InfoBox.js.map +1 -1
- package/lib/components/InfoBoxes/presentational/InfoBoxLabel.js +11 -12
- package/lib/components/InfoBoxes/presentational/InfoBoxLabel.js.map +1 -1
- package/lib/components/InfoBoxes/presentational/InfoBoxValue.js +12 -12
- package/lib/components/InfoBoxes/presentational/InfoBoxValue.js.map +1 -1
- package/lib/components/ListingTable/ListingTable.js +155 -296
- package/lib/components/ListingTable/ListingTable.js.map +1 -1
- package/lib/components/ListingTable/ListingTableContent/ListingTableContent.js +53 -58
- package/lib/components/ListingTable/ListingTableContent/ListingTableContent.js.map +1 -1
- package/lib/components/ListingTable/ListingTableContent/index.js +2 -3
- package/lib/components/ListingTable/ListingTableContent/index.js.map +1 -1
- package/lib/components/ListingTable/SearchFilter/SearchContainer.js +436 -262
- package/lib/components/ListingTable/SearchFilter/SearchContainer.js.map +1 -1
- package/lib/components/ListingTable/SearchFilter/SearchFilter.js +30 -37
- package/lib/components/ListingTable/SearchFilter/SearchFilter.js.map +1 -1
- package/lib/components/ListingTable/SearchFilter/helpers.js +82 -71
- package/lib/components/ListingTable/SearchFilter/helpers.js.map +1 -1
- package/lib/components/ListingTable/SearchFilter/querys.js +5 -5
- package/lib/components/ListingTable/SearchFilter/querys.js.map +1 -1
- package/lib/components/ListingTable/TableActions/TableActions.js +27 -31
- package/lib/components/ListingTable/TableActions/TableActions.js.map +1 -1
- package/lib/components/ListingTable/TableActions/index.js +2 -3
- package/lib/components/ListingTable/TableActions/index.js.map +1 -1
- package/lib/components/ListingTable/index.js +2 -3
- package/lib/components/ListingTable/index.js.map +1 -1
- package/lib/components/ListingTable/mappers/populate-rows.js +103 -122
- package/lib/components/ListingTable/mappers/populate-rows.js.map +1 -1
- package/lib/components/ListingTable/service/index.js +66 -83
- package/lib/components/ListingTable/service/index.js.map +1 -1
- package/lib/components/Tabs/index.js +26 -42
- package/lib/components/Tabs/index.js.map +1 -1
- package/lib/components/hooks/useCallbackDebounce.js +5 -9
- package/lib/components/hooks/useCallbackDebounce.js.map +1 -1
- package/lib/constants.js +30 -31
- package/lib/constants.js.map +1 -1
- package/lib/icons/ContentIcon.js +17 -20
- package/lib/icons/ContentIcon.js.map +1 -1
- package/lib/icons/SettingsIcon.js +12 -15
- package/lib/icons/SettingsIcon.js.map +1 -1
- package/lib/icons/TaxonomyIcon.js +15 -18
- package/lib/icons/TaxonomyIcon.js.map +1 -1
- package/lib/icons/UsersIcon.js +11 -14
- package/lib/icons/UsersIcon.js.map +1 -1
- package/lib/icons/index.js +8 -9
- package/lib/icons/index.js.map +1 -1
- package/lib/index.js +88 -121
- package/lib/index.js.map +1 -1
- package/lib/utils/add-content-menu-items.js +67 -93
- package/lib/utils/add-content-menu-items.js.map +1 -1
- package/lib/utils/build-create-entity-mutation.js +12 -9
- package/lib/utils/build-create-entity-mutation.js.map +1 -1
- package/lib/utils/build-delete-entity-mutation.js +11 -8
- package/lib/utils/build-delete-entity-mutation.js.map +1 -1
- package/lib/utils/build-listing-query.js +17 -14
- package/lib/utils/build-listing-query.js.map +1 -1
- package/lib/utils/build-update-data-query.js +15 -9
- package/lib/utils/build-update-data-query.js.map +1 -1
- package/lib/utils/build-update-publish-unpublish-mutation.js +15 -8
- package/lib/utils/build-update-publish-unpublish-mutation.js.map +1 -1
- package/lib/utils/get-default-query-params.js +7 -6
- package/lib/utils/get-default-query-params.js.map +1 -1
- package/lib/utils/hoc/withContext.js +4 -6
- package/lib/utils/hoc/withContext.js.map +1 -1
- package/lib/utils/hooks/useToggle.js +4 -12
- package/lib/utils/hooks/useToggle.js.map +1 -1
- package/lib/utils/index.js +2 -3
- package/lib/utils/index.js.map +1 -1
- package/lib-es/components/EntityManager/Entity/Entity.js +8 -20
- 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/index.js +6 -3
- package/lib-es/components/EntityManager/Entity/SideBarRelations/index.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/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 +2 -2
- package/lib-es/components/ListingTable/ListingTable.js.map +1 -1
- package/lib-es/components/ListingTable/ListingTableContent/ListingTableContent.js +20 -17
- package/lib-es/components/ListingTable/ListingTableContent/ListingTableContent.js.map +1 -1
- package/lib-es/components/ListingTable/SearchFilter/SearchContainer.js +323 -51
- package/lib-es/components/ListingTable/SearchFilter/SearchContainer.js.map +1 -1
- package/lib-es/components/ListingTable/SearchFilter/SearchFilter.js +7 -3
- package/lib-es/components/ListingTable/SearchFilter/SearchFilter.js.map +1 -1
- package/lib-es/components/ListingTable/SearchFilter/helpers.js +39 -8
- 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 +6 -7
- package/lib-es/components/Tabs/index.js.map +1 -1
- package/lib-es/index.js +12 -3
- 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 +27 -22
- package/src/components/EntityManager/Entity/Entity.js +59 -77
- 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 +64 -59
- 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 +13 -21
- package/src/components/ListingTable/ListingTableContent/ListingTableContent.js +38 -44
- package/src/components/ListingTable/SearchFilter/SearchContainer.js +411 -134
- package/src/components/ListingTable/SearchFilter/SearchFilter.js +5 -2
- package/src/components/ListingTable/SearchFilter/helpers.js +56 -8
- package/src/components/ListingTable/service/index.js +2 -3
- package/src/components/Tabs/index.js +17 -21
- package/src/index.js +11 -7
- package/src/utils/hoc/withContext.js +5 -4
- package/CHANGELOG.md +0 -1947
- package/babel.config.js +0 -3
- package/jest.config.js +0 -5
|
@@ -4,7 +4,7 @@ import { withRouter, Prompt } from 'react-router-dom';
|
|
|
4
4
|
import { useApolloClient } from '@apollo/client';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import { RenderHook } from '@blaze-cms/plugin-render-hooks-ui';
|
|
7
|
-
import { getQuery
|
|
7
|
+
import { getQuery } from '@blaze-cms/admin-ui-utils';
|
|
8
8
|
import { FormBuilder, parseFormValues } from '@blaze-cms/react-form-builder';
|
|
9
9
|
import { DeleteAction, CopyDataFromAction } from '@blaze-cms/admin';
|
|
10
10
|
import { useToasts } from '@blaze-react/toaster';
|
|
@@ -13,7 +13,6 @@ import { getPageName } from '../utils/data-mappers';
|
|
|
13
13
|
import isFormEmpty from '../utils/is-form-empty';
|
|
14
14
|
import availableActions from './actions-handlers';
|
|
15
15
|
import SideBarRelations from './SideBarRelations';
|
|
16
|
-
import Tabs from '../../Tabs';
|
|
17
16
|
import useCallbackDebounce from '../../hooks/useCallbackDebounce';
|
|
18
17
|
|
|
19
18
|
import {
|
|
@@ -51,7 +50,6 @@ const Entity = ({
|
|
|
51
50
|
onViewUrl,
|
|
52
51
|
refetchRecord
|
|
53
52
|
}) => {
|
|
54
|
-
const [, setCurrentTabId] = useState(null);
|
|
55
53
|
const [formValues, setFormValues] = useState(null);
|
|
56
54
|
const [entitySchema, setEntitySchema] = useState(null);
|
|
57
55
|
const [entityData, setEntityData] = useState(null);
|
|
@@ -109,50 +107,48 @@ const Entity = ({
|
|
|
109
107
|
[]
|
|
110
108
|
); // Using an empty dependency array ensures this only runs on unmount
|
|
111
109
|
|
|
112
|
-
useEffect(
|
|
113
|
-
()
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
}
|
|
110
|
+
useEffect(() => {
|
|
111
|
+
if (shouldUpdateState) {
|
|
112
|
+
setSaveButtonText(SAVE_BUTTON_TEXTS.save);
|
|
113
|
+
setEntityData(entity);
|
|
114
|
+
setPageTitle(getPageName(schema.displayProperties, entity));
|
|
115
|
+
setEntityIsPublish(entity.status);
|
|
116
|
+
setEntitySchema(schema);
|
|
117
|
+
setEnablePublishButton(schema.actions.publish);
|
|
118
|
+
setEntityIdentifier(schema.identifier);
|
|
119
|
+
setEnablePreviewButton(!!schema.interfaces.includes(PREVIEW_INTERFACE));
|
|
120
|
+
}
|
|
124
121
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
);
|
|
122
|
+
if (formData && pageBuilderTemplateStatus) {
|
|
123
|
+
const isPageBuilderTemplateSet = !!formData.values.pageBuilderTemplateId;
|
|
124
|
+
client.writeQuery({
|
|
125
|
+
query: getQuery('GET_PB_TEMPLATE_STATUS'),
|
|
126
|
+
data: {
|
|
127
|
+
pageBuilderTemplateSet: isPageBuilderTemplateSet,
|
|
128
|
+
pageBuilderTemplateId: formData.values.pageBuilderTemplateId || ''
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
if (schema) {
|
|
133
|
+
client.writeQuery({
|
|
134
|
+
query: getQuery('GET_CURRENT_ENTITY'),
|
|
135
|
+
data: {
|
|
136
|
+
currentEntity: schema.id,
|
|
137
|
+
currentItemId: entity ? entity.id : null
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
}, [
|
|
142
|
+
client,
|
|
143
|
+
entity,
|
|
144
|
+
entityData,
|
|
145
|
+
formData,
|
|
146
|
+
formValues,
|
|
147
|
+
pageBuilderTemplateStatus,
|
|
148
|
+
previousQuery,
|
|
149
|
+
schema,
|
|
150
|
+
shouldUpdateState
|
|
151
|
+
]);
|
|
156
152
|
|
|
157
153
|
const getFullUrl = async () => {
|
|
158
154
|
const query = getQuery('GET_ENTITY_URL');
|
|
@@ -420,9 +416,6 @@ const Entity = ({
|
|
|
420
416
|
const hasToDisplayPrompt = isSaveButtonAvailable || hasNewFormValues;
|
|
421
417
|
|
|
422
418
|
const showSideBarRelations = checkFulfilConditions(schema, formData);
|
|
423
|
-
const showPageBuilderTabs =
|
|
424
|
-
schema?.interfaces?.includes('page-builder/page-builder-template') ||
|
|
425
|
-
schema?.interfaces?.includes('page-builder/page-builder');
|
|
426
419
|
|
|
427
420
|
return (
|
|
428
421
|
<RecordEditContextProvider value={{ externalUpdateTime, updated: formData?.values?.updated }}>
|
|
@@ -464,9 +457,8 @@ const Entity = ({
|
|
|
464
457
|
)}
|
|
465
458
|
|
|
466
459
|
<div
|
|
467
|
-
className={`page__content--fixed${
|
|
468
|
-
|
|
469
|
-
}`}>
|
|
460
|
+
className={`page__content--fixed${!isRightSidebarOpen ? ' right-sidebar-collapsed' : ''
|
|
461
|
+
}`}>
|
|
470
462
|
<div className="page__content">
|
|
471
463
|
<div className="content">
|
|
472
464
|
<RenderHook
|
|
@@ -475,28 +467,19 @@ const Entity = ({
|
|
|
475
467
|
schema={schema}
|
|
476
468
|
/>
|
|
477
469
|
<InfoBoxes id={entity.id} schema={schema} />
|
|
478
|
-
<
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
}
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
data={clonedFormData}
|
|
492
|
-
onChange={onChangeFormValues}
|
|
493
|
-
shouldCopyData={shouldCopyData}
|
|
494
|
-
updateCopyData={updateCopyData}
|
|
495
|
-
formValues={formValues}
|
|
496
|
-
isNewEntity={isNewEntity}
|
|
497
|
-
onExternalUpdate={setExternalUpdateTime}
|
|
498
|
-
/>
|
|
499
|
-
</Tabs>
|
|
470
|
+
<FormBuilder
|
|
471
|
+
getIsFormValid={setIsFormValid}
|
|
472
|
+
getFormValues={getFormValues}
|
|
473
|
+
schema={schema}
|
|
474
|
+
data={clonedFormData}
|
|
475
|
+
onChange={onChangeFormValues}
|
|
476
|
+
shouldCopyData={shouldCopyData}
|
|
477
|
+
updateCopyData={updateCopyData}
|
|
478
|
+
formValues={formValues}
|
|
479
|
+
isNewEntity={isNewEntity}
|
|
480
|
+
onExternalUpdate={setExternalUpdateTime}
|
|
481
|
+
mode={isNewEntity ? 'create' : 'update'}
|
|
482
|
+
/>
|
|
500
483
|
<RenderHook
|
|
501
484
|
hookKey={`entity:${action}:main:bottom`}
|
|
502
485
|
entity={entity}
|
|
@@ -508,9 +491,8 @@ const Entity = ({
|
|
|
508
491
|
</div>
|
|
509
492
|
|
|
510
493
|
<div
|
|
511
|
-
className={`column column--one-third page-sidebar page-sidebar--relations${
|
|
512
|
-
|
|
513
|
-
}`}>
|
|
494
|
+
className={`column column--one-third page-sidebar page-sidebar--relations${!isRightSidebarOpen ? ' sidebar--collapsed' : ''
|
|
495
|
+
}`}>
|
|
514
496
|
{showSideBarRelations && (
|
|
515
497
|
<SideBarRelations
|
|
516
498
|
entity={entity}
|
|
@@ -30,8 +30,7 @@ const EntityHeader = ({
|
|
|
30
30
|
|
|
31
31
|
const {
|
|
32
32
|
displayProperties: { adminCrudActions: { delete: deleteAction = { active: true } } = {} } = {}
|
|
33
|
-
} =
|
|
34
|
-
entitySchema || {};
|
|
33
|
+
} = entitySchema || {};
|
|
35
34
|
|
|
36
35
|
const showDeleteButton =
|
|
37
36
|
deleteAction.active && formData && Object.keys(formData.values).length !== 0;
|
|
@@ -21,17 +21,19 @@ const useCustomSidebarData = ({ id, schema, displayProperties }) => {
|
|
|
21
21
|
}
|
|
22
22
|
`;
|
|
23
23
|
|
|
24
|
-
const {
|
|
24
|
+
const {
|
|
25
|
+
data = {},
|
|
26
|
+
loading,
|
|
27
|
+
error,
|
|
28
|
+
refetch
|
|
29
|
+
} = useQuery(customSidebarInfoQuery, {
|
|
25
30
|
variables: { id },
|
|
26
31
|
skip: !query
|
|
27
32
|
});
|
|
28
33
|
|
|
29
|
-
useEffect(
|
|
30
|
-
()
|
|
31
|
-
|
|
32
|
-
},
|
|
33
|
-
[externalUpdateTime, updated, refetch]
|
|
34
|
-
);
|
|
34
|
+
useEffect(() => {
|
|
35
|
+
refetch();
|
|
36
|
+
}, [externalUpdateTime, updated, refetch]);
|
|
35
37
|
|
|
36
38
|
return { data: data.__typename !== 'Query' ? data : null, loading, error };
|
|
37
39
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React, { useState, useEffect } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import uuidv1 from 'uuid/v1';
|
|
4
|
+
import Accordion from '@blaze-react/accordion';
|
|
4
5
|
import { useApolloClient } from '@apollo/client';
|
|
5
6
|
import { getQuery } from '@blaze-cms/admin-ui-utils';
|
|
6
7
|
import { formFieldTypes } from '@blaze-cms/react-form-builder';
|
|
@@ -24,40 +25,37 @@ const SideBarRelations = ({ schema, onChange, formData, entity, isOpen, onToggle
|
|
|
24
25
|
|
|
25
26
|
const [relationsComponents, setRelationsComponents] = useState(null);
|
|
26
27
|
|
|
27
|
-
useEffect(
|
|
28
|
-
() => {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
if (!entityIdentifier) return null;
|
|
28
|
+
useEffect(() => {
|
|
29
|
+
(async () => {
|
|
30
|
+
const fetchRelationSchema = async ({ entityIdentifier }) => {
|
|
31
|
+
if (!entityIdentifier) return null;
|
|
32
32
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
33
|
+
const {
|
|
34
|
+
data: {
|
|
35
|
+
getEntitySchemas: [relationSchema]
|
|
36
|
+
}
|
|
37
|
+
} = await client.query({
|
|
38
|
+
query: getQuery('GET_ENTITY_SCHEMA'),
|
|
39
|
+
variables: { identifier: entityIdentifier }
|
|
40
|
+
});
|
|
41
|
+
return relationSchema;
|
|
42
|
+
};
|
|
43
43
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
44
|
+
if (!relationsComponents && schema) {
|
|
45
|
+
const allRelationComponents = await Promise.all(
|
|
46
|
+
schema.relations
|
|
47
|
+
.filter(({ showInForm, foreignKey }) => showInForm && schema.properties[foreignKey])
|
|
48
|
+
.map(async relation => ({
|
|
49
|
+
id: uuidv1(),
|
|
50
|
+
staticData: relation,
|
|
51
|
+
schema: await fetchRelationSchema(relation)
|
|
52
|
+
}))
|
|
53
|
+
);
|
|
54
54
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
[client, relationsComponents, schema, schema.relations]
|
|
60
|
-
);
|
|
55
|
+
setRelationsComponents(allRelationComponents);
|
|
56
|
+
}
|
|
57
|
+
})();
|
|
58
|
+
}, [client, relationsComponents, schema, schema.relations]);
|
|
61
59
|
const { id: itemId } = entity;
|
|
62
60
|
const { identifier: itemEntity, interfaces } = schema;
|
|
63
61
|
|
|
@@ -92,24 +90,21 @@ const SideBarRelations = ({ schema, onChange, formData, entity, isOpen, onToggle
|
|
|
92
90
|
)}
|
|
93
91
|
</div>
|
|
94
92
|
)}
|
|
95
|
-
{!schema.displayProperties.disableDefaultAdminInfo &&
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
{updatedBy
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
</>
|
|
111
|
-
</>
|
|
112
|
-
)}
|
|
93
|
+
{!schema.displayProperties.disableDefaultAdminInfo && formattedCreated && (
|
|
94
|
+
<>
|
|
95
|
+
<p>
|
|
96
|
+
Created: <span>{formattedCreated}</span>
|
|
97
|
+
</p>
|
|
98
|
+
<p>
|
|
99
|
+
Updated: <span>{formattedUpdated}</span>
|
|
100
|
+
</p>
|
|
101
|
+
{updatedBy && (
|
|
102
|
+
<p>
|
|
103
|
+
Updated by: <span>{updatedBy.name}</span>
|
|
104
|
+
</p>
|
|
105
|
+
)}
|
|
106
|
+
</>
|
|
107
|
+
)}
|
|
113
108
|
|
|
114
109
|
<CustomSidebarInfoContainer
|
|
115
110
|
id={itemId}
|
|
@@ -121,16 +116,26 @@ const SideBarRelations = ({ schema, onChange, formData, entity, isOpen, onToggle
|
|
|
121
116
|
<VersionsList itemEntity={itemEntity} itemId={itemId} interfaces={interfaces} />
|
|
122
117
|
<EntityNavLinks schema={schema} />
|
|
123
118
|
|
|
124
|
-
{relationsComponents &&
|
|
125
|
-
|
|
126
|
-
<
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
119
|
+
{relationsComponents && (
|
|
120
|
+
<Accordion isOpen>
|
|
121
|
+
<Accordion.Header>
|
|
122
|
+
<b>Classification</b>
|
|
123
|
+
</Accordion.Header>
|
|
124
|
+
<Accordion.Content>
|
|
125
|
+
<Accordion.ContentDetails>
|
|
126
|
+
{relationsComponents.map(({ id, staticData, schema: entitySchema }) => (
|
|
127
|
+
<RelationComponent
|
|
128
|
+
formData={formData}
|
|
129
|
+
schema={entitySchema}
|
|
130
|
+
key={id}
|
|
131
|
+
staticData={staticData}
|
|
132
|
+
onSelect={onChange}
|
|
133
|
+
/>
|
|
134
|
+
))}
|
|
135
|
+
</Accordion.ContentDetails>
|
|
136
|
+
</Accordion.Content>
|
|
137
|
+
</Accordion>
|
|
138
|
+
)}
|
|
134
139
|
</div>
|
|
135
140
|
</div>
|
|
136
141
|
);
|
|
@@ -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,27 +159,20 @@ 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
|
-
className="button button--small"
|
|
179
|
-
to={`${match.url}/create`}>
|
|
180
|
-
Add
|
|
181
|
-
</Link>
|
|
182
|
-
</Fragment>
|
|
183
|
-
)}
|
|
171
|
+
{createAction.active && !showAddButton && (
|
|
172
|
+
<Link data-testid="addEntity" className="button button--small" to={`${match.url}/create`}>
|
|
173
|
+
Add
|
|
174
|
+
</Link>
|
|
175
|
+
)}
|
|
184
176
|
</PageHeader>
|
|
185
177
|
{showAddButton ? (
|
|
186
178
|
<CardPrompt>
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React, { useEffect, useRef } from 'react';
|
|
2
2
|
import Table from '@blaze-react/table';
|
|
3
3
|
import Pagination from '@blaze-react/pagination';
|
|
4
|
-
|
|
5
4
|
import PropTypes from 'prop-types';
|
|
6
5
|
import { withRouter } from 'react-router-dom';
|
|
7
6
|
|
|
@@ -18,53 +17,48 @@ const ListingTableContent = ({
|
|
|
18
17
|
const { isEnquiry } = tableData;
|
|
19
18
|
const className = `page__content${isEnquiry ? ' array-table' : ''}`;
|
|
20
19
|
|
|
21
|
-
useEffect(
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
);
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
// set table head to match body column widths to handle dynamic content
|
|
22
|
+
if (ref.current && displayTable) {
|
|
23
|
+
const tableHeadCells = ref.current.querySelectorAll('.table-head .table-cell');
|
|
24
|
+
const firstRowCells = ref.current.querySelectorAll(
|
|
25
|
+
'.table-body .table-row:first-child .table-cell'
|
|
26
|
+
);
|
|
29
27
|
|
|
30
|
-
|
|
31
|
-
|
|
28
|
+
firstRowCells.forEach((element, i) => {
|
|
29
|
+
const styles = window.getComputedStyle(element);
|
|
32
30
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
)
|
|
31
|
+
if (tableHeadCells[i]) {
|
|
32
|
+
tableHeadCells[i].style.flex = styles.flex;
|
|
33
|
+
tableHeadCells[i].style['justify-content'] = styles['justify-content'];
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
}, [tableData, displayTable]);
|
|
38
|
+
|
|
39
|
+
if (displayTable) {
|
|
40
|
+
return (
|
|
41
|
+
<div ref={ref} className={className}>
|
|
42
|
+
<Table
|
|
43
|
+
onSort={onSort}
|
|
44
|
+
data={tableData}
|
|
45
|
+
onSelect={handleSelect}
|
|
46
|
+
data-testid="listing-table-content"
|
|
47
|
+
/>
|
|
48
|
+
<Pagination
|
|
49
|
+
visiblePages={10}
|
|
50
|
+
totalItems={totalItems}
|
|
51
|
+
currentPage={currentPage}
|
|
52
|
+
onPageChange={handleOnPageChange}
|
|
53
|
+
/>
|
|
54
|
+
</div>
|
|
55
|
+
);
|
|
56
|
+
}
|
|
42
57
|
|
|
43
58
|
return (
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
<div ref={ref} className={className}>
|
|
48
|
-
<Table
|
|
49
|
-
onSort={onSort}
|
|
50
|
-
data={tableData}
|
|
51
|
-
onSelect={handleSelect}
|
|
52
|
-
data-testid="listing-table-content"
|
|
53
|
-
/>
|
|
54
|
-
<Pagination
|
|
55
|
-
visiblePages={10}
|
|
56
|
-
totalItems={totalItems}
|
|
57
|
-
currentPage={currentPage}
|
|
58
|
-
onPageChange={handleOnPageChange}
|
|
59
|
-
/>
|
|
60
|
-
</div>
|
|
61
|
-
</>
|
|
62
|
-
) : (
|
|
63
|
-
<span className="table-no-results" data-testid="no-results">
|
|
64
|
-
No results
|
|
65
|
-
</span>
|
|
66
|
-
)}
|
|
67
|
-
</>
|
|
59
|
+
<span className="table-no-results" data-testid="no-results">
|
|
60
|
+
No results
|
|
61
|
+
</span>
|
|
68
62
|
);
|
|
69
63
|
};
|
|
70
64
|
|