@blaze-cms/plugin-data-ui 0.146.0-rc-eagle.0 → 0.146.0-rc-eagle-3.2
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/README.md +9 -2
- package/lib/components/EntityManager/Entity/Entity.js +1 -1
- package/lib/components/EntityManager/Entity/Entity.js.map +1 -1
- package/lib/components/EntityManager/Entity/actions-handlers/create/submit.js +4 -15
- package/lib/components/EntityManager/Entity/actions-handlers/create/submit.js.map +1 -1
- package/lib/components/EntityManager/utils/entity.js +2 -3
- package/lib/components/EntityManager/utils/entity.js.map +1 -1
- package/lib/components/ListingTable/SearchFilter/RelationMultiSelectFilter.js +181 -0
- package/lib/components/ListingTable/SearchFilter/RelationMultiSelectFilter.js.map +1 -0
- package/lib/components/ListingTable/SearchFilter/SearchContainer.js +348 -52
- package/lib/components/ListingTable/SearchFilter/SearchContainer.js.map +1 -1
- package/lib/components/ListingTable/SearchFilter/SearchFilter.js +15 -3
- package/lib/components/ListingTable/SearchFilter/SearchFilter.js.map +1 -1
- package/lib/components/ListingTable/SearchFilter/helpers.js +41 -8
- package/lib/components/ListingTable/SearchFilter/helpers.js.map +1 -1
- package/lib/index.js +7 -0
- package/lib/index.js.map +1 -1
- package/lib/utils/build-create-entity-mutation.js +3 -19
- package/lib/utils/build-create-entity-mutation.js.map +1 -1
- package/lib/utils/get-default-query-params.js +17 -5
- package/lib/utils/get-default-query-params.js.map +1 -1
- package/lib-es/components/EntityDataListing/EntityDataListing.js +33 -0
- package/lib-es/components/EntityDataListing/EntityDataListing.js.map +1 -0
- package/lib-es/components/EntityDataListing/index.js +3 -0
- package/lib-es/components/EntityDataListing/index.js.map +1 -0
- package/lib-es/components/EntityManager/Entity/EntitiyNavLinks/EntityNavLinks.js +30 -0
- package/lib-es/components/EntityManager/Entity/EntitiyNavLinks/EntityNavLinks.js.map +1 -0
- package/lib-es/components/EntityManager/Entity/EntitiyNavLinks/index.js +3 -0
- package/lib-es/components/EntityManager/Entity/EntitiyNavLinks/index.js.map +1 -0
- package/lib-es/components/EntityManager/Entity/Entity.js +453 -0
- package/lib-es/components/EntityManager/Entity/Entity.js.map +1 -0
- package/lib-es/components/EntityManager/Entity/EntityHeader/EntityHeader.js +103 -0
- package/lib-es/components/EntityManager/Entity/EntityHeader/EntityHeader.js.map +1 -0
- package/lib-es/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/HeaderPreviewButton.js +47 -0
- package/lib-es/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/HeaderPreviewButton.js.map +1 -0
- package/lib-es/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/index.js +3 -0
- package/lib-es/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/index.js.map +1 -0
- package/lib-es/components/EntityManager/Entity/EntityHeader/index.js +3 -0
- package/lib-es/components/EntityManager/Entity/EntityHeader/index.js.map +1 -0
- package/lib-es/components/EntityManager/Entity/SideBarRelations/container/CustomSidebarInfoContainer.js +30 -0
- package/lib-es/components/EntityManager/Entity/SideBarRelations/container/CustomSidebarInfoContainer.js.map +1 -0
- package/lib-es/components/EntityManager/Entity/SideBarRelations/helpers/build-dynamic-query.js +29 -0
- package/lib-es/components/EntityManager/Entity/SideBarRelations/helpers/build-dynamic-query.js.map +1 -0
- package/lib-es/components/EntityManager/Entity/SideBarRelations/hooks/useCustomSidebarData.js +49 -0
- package/lib-es/components/EntityManager/Entity/SideBarRelations/hooks/useCustomSidebarData.js.map +1 -0
- package/lib-es/components/EntityManager/Entity/SideBarRelations/index.js +136 -0
- package/lib-es/components/EntityManager/Entity/SideBarRelations/index.js.map +1 -0
- package/lib-es/components/EntityManager/Entity/SideBarRelations/presentational/CustomSidebarInfo.js +36 -0
- package/lib-es/components/EntityManager/Entity/SideBarRelations/presentational/CustomSidebarInfo.js.map +1 -0
- package/lib-es/components/EntityManager/Entity/actions-handlers/create/index.js +5 -0
- package/lib-es/components/EntityManager/Entity/actions-handlers/create/index.js.map +1 -0
- package/lib-es/components/EntityManager/Entity/actions-handlers/create/submit.js +36 -0
- package/lib-es/components/EntityManager/Entity/actions-handlers/create/submit.js.map +1 -0
- package/lib-es/components/EntityManager/Entity/actions-handlers/delete/delete.js +32 -0
- package/lib-es/components/EntityManager/Entity/actions-handlers/delete/delete.js.map +1 -0
- package/lib-es/components/EntityManager/Entity/actions-handlers/delete/index.js +5 -0
- package/lib-es/components/EntityManager/Entity/actions-handlers/delete/index.js.map +1 -0
- package/lib-es/components/EntityManager/Entity/actions-handlers/index.js +12 -0
- package/lib-es/components/EntityManager/Entity/actions-handlers/index.js.map +1 -0
- package/lib-es/components/EntityManager/Entity/actions-handlers/shared/index.js +5 -0
- package/lib-es/components/EntityManager/Entity/actions-handlers/shared/index.js.map +1 -0
- package/lib-es/components/EntityManager/Entity/actions-handlers/shared/publish.js +39 -0
- package/lib-es/components/EntityManager/Entity/actions-handlers/shared/publish.js.map +1 -0
- package/lib-es/components/EntityManager/Entity/actions-handlers/update/index.js +5 -0
- package/lib-es/components/EntityManager/Entity/actions-handlers/update/index.js.map +1 -0
- package/lib-es/components/EntityManager/Entity/actions-handlers/update/submit.js +53 -0
- package/lib-es/components/EntityManager/Entity/actions-handlers/update/submit.js.map +1 -0
- package/lib-es/components/EntityManager/Entity/index.js +3 -0
- package/lib-es/components/EntityManager/Entity/index.js.map +1 -0
- package/lib-es/components/EntityManager/EntityManager.js +133 -0
- package/lib-es/components/EntityManager/EntityManager.js.map +1 -0
- package/lib-es/components/EntityManager/index.js +3 -0
- package/lib-es/components/EntityManager/index.js.map +1 -0
- package/lib-es/components/EntityManager/utils/RecordEditContext/index.js +6 -0
- package/lib-es/components/EntityManager/utils/RecordEditContext/index.js.map +1 -0
- package/lib-es/components/EntityManager/utils/data-mappers.js +55 -0
- package/lib-es/components/EntityManager/utils/data-mappers.js.map +1 -0
- package/lib-es/components/EntityManager/utils/entity.js +69 -0
- package/lib-es/components/EntityManager/utils/entity.js.map +1 -0
- package/lib-es/components/EntityManager/utils/entityAvailableActions.js +56 -0
- package/lib-es/components/EntityManager/utils/entityAvailableActions.js.map +1 -0
- package/lib-es/components/EntityManager/utils/is-form-empty.js +9 -0
- package/lib-es/components/EntityManager/utils/is-form-empty.js.map +1 -0
- package/lib-es/components/EntityManager/utils/query.js +23 -0
- package/lib-es/components/EntityManager/utils/query.js.map +1 -0
- package/lib-es/components/InfoBoxes/InfoBoxTooltip.js +36 -0
- package/lib-es/components/InfoBoxes/InfoBoxTooltip.js.map +1 -0
- package/lib-es/components/InfoBoxes/InfoBoxes.js +28 -0
- package/lib-es/components/InfoBoxes/InfoBoxes.js.map +1 -0
- package/lib-es/components/InfoBoxes/container/InfoBoxContainer.js +38 -0
- package/lib-es/components/InfoBoxes/container/InfoBoxContainer.js.map +1 -0
- package/lib-es/components/InfoBoxes/helpers/build-dynamic-query.js +28 -0
- package/lib-es/components/InfoBoxes/helpers/build-dynamic-query.js.map +1 -0
- package/lib-es/components/InfoBoxes/hooks/useData.js +39 -0
- package/lib-es/components/InfoBoxes/hooks/useData.js.map +1 -0
- package/lib-es/components/InfoBoxes/hooks/useInfoBox.js +17 -0
- package/lib-es/components/InfoBoxes/hooks/useInfoBox.js.map +1 -0
- package/lib-es/components/InfoBoxes/index.js +3 -0
- package/lib-es/components/InfoBoxes/index.js.map +1 -0
- package/lib-es/components/InfoBoxes/presentational/InfoBox.js +40 -0
- package/lib-es/components/InfoBoxes/presentational/InfoBox.js.map +1 -0
- package/lib-es/components/InfoBoxes/presentational/InfoBoxLabel.js +12 -0
- package/lib-es/components/InfoBoxes/presentational/InfoBoxLabel.js.map +1 -0
- package/lib-es/components/InfoBoxes/presentational/InfoBoxValue.js +30 -0
- package/lib-es/components/InfoBoxes/presentational/InfoBoxValue.js.map +1 -0
- package/lib-es/components/ListingTable/ListingTable.js +208 -0
- package/lib-es/components/ListingTable/ListingTable.js.map +1 -0
- package/lib-es/components/ListingTable/ListingTableContent/ListingTableContent.js +72 -0
- package/lib-es/components/ListingTable/ListingTableContent/ListingTableContent.js.map +1 -0
- package/lib-es/components/ListingTable/ListingTableContent/index.js +3 -0
- package/lib-es/components/ListingTable/ListingTableContent/index.js.map +1 -0
- package/lib-es/components/ListingTable/SearchFilter/RelationMultiSelectFilter.js +173 -0
- package/lib-es/components/ListingTable/SearchFilter/RelationMultiSelectFilter.js.map +1 -0
- package/lib-es/components/ListingTable/SearchFilter/SearchContainer.js +503 -0
- package/lib-es/components/ListingTable/SearchFilter/SearchContainer.js.map +1 -0
- package/lib-es/components/ListingTable/SearchFilter/SearchFilter.js +52 -0
- package/lib-es/components/ListingTable/SearchFilter/SearchFilter.js.map +1 -0
- package/lib-es/components/ListingTable/SearchFilter/helpers.js +127 -0
- package/lib-es/components/ListingTable/SearchFilter/helpers.js.map +1 -0
- package/lib-es/components/ListingTable/SearchFilter/querys.js +8 -0
- package/lib-es/components/ListingTable/SearchFilter/querys.js.map +1 -0
- package/lib-es/components/ListingTable/TableActions/TableActions.js +34 -0
- package/lib-es/components/ListingTable/TableActions/TableActions.js.map +1 -0
- package/lib-es/components/ListingTable/TableActions/index.js +3 -0
- package/lib-es/components/ListingTable/TableActions/index.js.map +1 -0
- package/lib-es/components/ListingTable/index.js +3 -0
- package/lib-es/components/ListingTable/index.js.map +1 -0
- package/lib-es/components/ListingTable/mappers/populate-rows.js +140 -0
- package/lib-es/components/ListingTable/mappers/populate-rows.js.map +1 -0
- package/lib-es/components/ListingTable/service/index.js +87 -0
- package/lib-es/components/ListingTable/service/index.js.map +1 -0
- package/lib-es/components/Tabs/index.js +38 -0
- package/lib-es/components/Tabs/index.js.map +1 -0
- package/lib-es/components/hooks/useCallbackDebounce.js +12 -0
- package/lib-es/components/hooks/useCallbackDebounce.js.map +1 -0
- package/lib-es/constants.js +42 -0
- package/lib-es/constants.js.map +1 -0
- package/lib-es/icons/ContentIcon.js +80 -0
- package/lib-es/icons/ContentIcon.js.map +1 -0
- package/lib-es/icons/SettingsIcon.js +36 -0
- package/lib-es/icons/SettingsIcon.js.map +1 -0
- package/lib-es/icons/TaxonomyIcon.js +60 -0
- package/lib-es/icons/TaxonomyIcon.js.map +1 -0
- package/lib-es/icons/UsersIcon.js +33 -0
- package/lib-es/icons/UsersIcon.js.map +1 -0
- package/lib-es/icons/index.js +6 -0
- package/lib-es/icons/index.js.map +1 -0
- package/lib-es/index.js +93 -0
- package/lib-es/index.js.map +1 -0
- package/lib-es/utils/add-content-menu-items.js +72 -0
- package/lib-es/utils/add-content-menu-items.js.map +1 -0
- package/lib-es/utils/build-create-entity-mutation.js +7 -0
- package/lib-es/utils/build-create-entity-mutation.js.map +1 -0
- package/lib-es/utils/build-delete-entity-mutation.js +18 -0
- package/lib-es/utils/build-delete-entity-mutation.js.map +1 -0
- package/lib-es/utils/build-listing-query.js +28 -0
- package/lib-es/utils/build-listing-query.js.map +1 -0
- package/lib-es/utils/build-update-data-query.js +24 -0
- package/lib-es/utils/build-update-data-query.js.map +1 -0
- package/lib-es/utils/build-update-publish-unpublish-mutation.js +22 -0
- package/lib-es/utils/build-update-publish-unpublish-mutation.js.map +1 -0
- package/lib-es/utils/get-default-query-params.js +29 -0
- package/lib-es/utils/get-default-query-params.js.map +1 -0
- package/lib-es/utils/hoc/withContext.js +8 -0
- package/lib-es/utils/hoc/withContext.js.map +1 -0
- package/lib-es/utils/hooks/useToggle.js +8 -0
- package/lib-es/utils/hooks/useToggle.js.map +1 -0
- package/lib-es/utils/index.js +3 -0
- package/lib-es/utils/index.js.map +1 -0
- package/package.json +16 -12
- package/src/components/EntityManager/Entity/Entity.js +1 -1
- package/src/components/EntityManager/Entity/actions-handlers/create/submit.js +4 -11
- package/src/components/EntityManager/utils/entity.js +4 -10
- package/src/components/ListingTable/SearchFilter/RelationMultiSelectFilter.js +160 -0
- package/src/components/ListingTable/SearchFilter/SearchContainer.js +407 -74
- package/src/components/ListingTable/SearchFilter/SearchFilter.js +14 -3
- package/src/components/ListingTable/SearchFilter/helpers.js +55 -8
- package/src/index.js +2 -0
- package/src/utils/build-create-entity-mutation.js +5 -28
- package/src/utils/get-default-query-params.js +21 -9
- package/CHANGELOG.md +0 -1932
- package/babel.config.js +0 -3
- package/jest.config.js +0 -5
|
@@ -14,14 +14,32 @@ const updateListFilters = (searchTerm, selectedFilters, setListFilters, fields =
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
Object.entries(selectedFilters).forEach(([filterKey, filterValue]) => {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
17
|
+
const isEmptyArray = Array.isArray(filterValue) && filterValue.length === 0;
|
|
18
|
+
if (
|
|
19
|
+
filterValue == null ||
|
|
20
|
+
filterValue === '' ||
|
|
21
|
+
filterValue === DEFAULT_FILTER_OPTION_LABEL ||
|
|
22
|
+
isEmptyArray
|
|
23
|
+
)
|
|
24
|
+
return;
|
|
25
|
+
|
|
26
|
+
const field = `${filterKey}.keyword`;
|
|
27
|
+
|
|
28
|
+
if (Array.isArray(filterValue)) {
|
|
29
|
+
if (filterValue.length > 1) {
|
|
30
|
+
filters.push({
|
|
31
|
+
terms: { [field]: filterValue }
|
|
32
|
+
});
|
|
33
|
+
} else {
|
|
34
|
+
filters.push({
|
|
35
|
+
term: { [field]: filterValue[0] }
|
|
36
|
+
});
|
|
23
37
|
}
|
|
24
|
-
}
|
|
38
|
+
} else {
|
|
39
|
+
filters.push({
|
|
40
|
+
term: { [field]: filterValue }
|
|
41
|
+
});
|
|
42
|
+
}
|
|
25
43
|
});
|
|
26
44
|
|
|
27
45
|
setListFilters(filters);
|
|
@@ -52,9 +70,22 @@ const findSelectFilters = schema => {
|
|
|
52
70
|
return [...propertySelects, ...dynamicPropertySelects];
|
|
53
71
|
};
|
|
54
72
|
|
|
73
|
+
const findMultiSelectFilters = schema => {
|
|
74
|
+
if (!schema || !schema.properties) return [];
|
|
75
|
+
|
|
76
|
+
const { properties = {}, dynamicProperties = {} } = schema;
|
|
77
|
+
const propertyMultiSelect = Object.entries(properties).filter(isFilterMultiSelectItems);
|
|
78
|
+
const dynamicPropertyMultiSelect =
|
|
79
|
+
Object.entries(dynamicProperties).filter(isFilterMultiSelectItems);
|
|
80
|
+
return [...propertyMultiSelect, ...dynamicPropertyMultiSelect];
|
|
81
|
+
};
|
|
82
|
+
|
|
55
83
|
const isFilterSelectItem = ([, item]) =>
|
|
56
84
|
item.adminListingOptions && item.adminListingOptions.filterType === 'select';
|
|
57
85
|
|
|
86
|
+
const isFilterMultiSelectItems = ([, item]) =>
|
|
87
|
+
item.adminListingOptions && item.adminListingOptions.filterType === 'multiSelect';
|
|
88
|
+
|
|
58
89
|
const buildQueryFields = (selectFilters, entityId) => {
|
|
59
90
|
if (!Array.isArray(selectFilters) || selectFilters.length === 0) {
|
|
60
91
|
return { gqlFields: '', rawQuery: '{}' };
|
|
@@ -96,4 +127,20 @@ const buildQueryFields = (selectFilters, entityId) => {
|
|
|
96
127
|
return { gqlFields, rawQuery };
|
|
97
128
|
};
|
|
98
129
|
|
|
99
|
-
|
|
130
|
+
const getTidyLabel = (value, tidy) => {
|
|
131
|
+
if (!tidy) return value;
|
|
132
|
+
|
|
133
|
+
return value
|
|
134
|
+
.split(/[\s_-]+/)
|
|
135
|
+
.map(word => word.charAt(0).toUpperCase() + word.slice(1))
|
|
136
|
+
.join(' ');
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
export {
|
|
140
|
+
buildQueryFields,
|
|
141
|
+
updateListFilters,
|
|
142
|
+
getKeywordSearchFilters,
|
|
143
|
+
findSelectFilters,
|
|
144
|
+
findMultiSelectFilters,
|
|
145
|
+
getTidyLabel
|
|
146
|
+
};
|
package/src/index.js
CHANGED
|
@@ -14,6 +14,8 @@ import EntityManager from './components/EntityManager';
|
|
|
14
14
|
// () => import(/* webpackChunkName: 'EntityManager' */ './components/EntityManager')
|
|
15
15
|
// );
|
|
16
16
|
|
|
17
|
+
export { default as SearchFilter } from './components/ListingTable/SearchFilter/SearchFilter';
|
|
18
|
+
|
|
17
19
|
export default async function load(app) {
|
|
18
20
|
app.events.once('admin:menu:config:load', getAddContentMenuItems(app));
|
|
19
21
|
|
|
@@ -1,31 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { BlazeError } from '@blaze-cms/core-errors';
|
|
3
|
-
import upperfirst from 'lodash.upperfirst';
|
|
4
|
-
import { getDataProperties } from '@blaze-cms/admin-ui-utils';
|
|
1
|
+
import { getDynamicMutation } from '@blaze-cms/admin-ui-utils';
|
|
5
2
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
!entitySchema.actions.create ||
|
|
11
|
-
!entitySchema.properties
|
|
12
|
-
) {
|
|
13
|
-
throw new BlazeError(
|
|
14
|
-
'Create entity query requires create action and properties from entity schema'
|
|
15
|
-
);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
const actionInput = upperfirst(`${entitySchema.actions.create}Input`);
|
|
19
|
-
const dataProperties = getDataProperties(entitySchema);
|
|
20
|
-
|
|
21
|
-
return gql`mutation createEntity($input: ${actionInput}) {
|
|
22
|
-
createdEntity: ${entitySchema.actions.create}(input: $input){
|
|
23
|
-
result {
|
|
24
|
-
id,
|
|
25
|
-
${dataProperties.join(',\n')}
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
}`;
|
|
29
|
-
}
|
|
3
|
+
// Kept for back-compat: the builder now lives in the admin-ui-utils dynamic
|
|
4
|
+
// mutation registry so packages that cannot depend on this plugin can use it.
|
|
5
|
+
const buildCreateEntityMutation = entitySchema =>
|
|
6
|
+
getDynamicMutation('CREATE_ENTITY_MUTATION')(entitySchema);
|
|
30
7
|
|
|
31
8
|
export default buildCreateEntityMutation;
|
|
@@ -1,19 +1,31 @@
|
|
|
1
1
|
const getDefaultQueryParams = schema => {
|
|
2
2
|
const updated = schema.properties && schema.properties.updated;
|
|
3
|
-
const { adminDefaultListingFilter: where } =
|
|
3
|
+
const { adminDefaultListingFilter: where, adminListings: { defaultSort } = {} } =
|
|
4
|
+
schema.displayProperties || {};
|
|
5
|
+
|
|
6
|
+
let sort = [];
|
|
7
|
+
|
|
8
|
+
if (defaultSort?.property) {
|
|
9
|
+
sort = [
|
|
10
|
+
{
|
|
11
|
+
property: defaultSort.property,
|
|
12
|
+
direction: defaultSort.direction || 'asc'
|
|
13
|
+
}
|
|
14
|
+
];
|
|
15
|
+
} else if (updated) {
|
|
16
|
+
sort = [
|
|
17
|
+
{
|
|
18
|
+
property: 'updated',
|
|
19
|
+
direction: 'desc'
|
|
20
|
+
}
|
|
21
|
+
];
|
|
22
|
+
}
|
|
4
23
|
|
|
5
24
|
return {
|
|
6
25
|
where,
|
|
7
26
|
limit: 10,
|
|
8
27
|
offset: 0,
|
|
9
|
-
sort
|
|
10
|
-
? [
|
|
11
|
-
{
|
|
12
|
-
property: 'updated',
|
|
13
|
-
direction: 'desc'
|
|
14
|
-
}
|
|
15
|
-
]
|
|
16
|
-
: []
|
|
28
|
+
sort
|
|
17
29
|
};
|
|
18
30
|
};
|
|
19
31
|
|