@blaze-cms/plugin-data-ui 0.146.0-node18-core-styles-tooltips.56 → 0.146.0-node18-tooltips.44

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.
Files changed (98) hide show
  1. package/CHANGELOG.md +42 -164
  2. package/lib/components/EntityManager/Entity/EntitiyNavLinks/EntityNavLinks.js +0 -1
  3. package/lib/components/EntityManager/Entity/EntitiyNavLinks/EntityNavLinks.js.map +1 -1
  4. package/lib/components/EntityManager/Entity/Entity.js +5 -5
  5. package/lib/components/EntityManager/Entity/Entity.js.map +1 -1
  6. package/lib/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/HeaderPreviewButton.js +1 -1
  7. package/lib/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/HeaderPreviewButton.js.map +1 -1
  8. package/lib/components/EntityManager/Entity/SideBarRelations/helpers/build-dynamic-query.js +0 -1
  9. package/lib/components/EntityManager/Entity/SideBarRelations/helpers/build-dynamic-query.js.map +1 -1
  10. package/lib/components/EntityManager/Entity/SideBarRelations/index.js +5 -5
  11. package/lib/components/EntityManager/Entity/SideBarRelations/index.js.map +1 -1
  12. package/lib/components/EntityManager/Entity/actions-handlers/create/submit.js +1 -1
  13. package/lib/components/EntityManager/Entity/actions-handlers/create/submit.js.map +1 -1
  14. package/lib/components/EntityManager/Entity/actions-handlers/delete/delete.js +1 -1
  15. package/lib/components/EntityManager/Entity/actions-handlers/delete/delete.js.map +1 -1
  16. package/lib/components/EntityManager/Entity/actions-handlers/shared/publish.js +1 -1
  17. package/lib/components/EntityManager/Entity/actions-handlers/shared/publish.js.map +1 -1
  18. package/lib/components/EntityManager/Entity/actions-handlers/update/submit.js +1 -1
  19. package/lib/components/EntityManager/Entity/actions-handlers/update/submit.js.map +1 -1
  20. package/lib/components/EntityManager/EntityManager.js +3 -3
  21. package/lib/components/EntityManager/EntityManager.js.map +1 -1
  22. package/lib/components/EntityManager/utils/entity.js +1 -1
  23. package/lib/components/EntityManager/utils/entity.js.map +1 -1
  24. package/lib/components/EntityManager/utils/entityAvailableActions.js +2 -2
  25. package/lib/components/EntityManager/utils/entityAvailableActions.js.map +1 -1
  26. package/lib/components/InfoBoxes/InfoBoxes.js +0 -1
  27. package/lib/components/InfoBoxes/InfoBoxes.js.map +1 -1
  28. package/lib/components/InfoBoxes/container/InfoBoxContainer.js +1 -1
  29. package/lib/components/InfoBoxes/container/InfoBoxContainer.js.map +1 -1
  30. package/lib/components/InfoBoxes/helpers/build-dynamic-query.js +0 -1
  31. package/lib/components/InfoBoxes/helpers/build-dynamic-query.js.map +1 -1
  32. package/lib/components/ListingTable/ListingTable.js +7 -7
  33. package/lib/components/ListingTable/ListingTable.js.map +1 -1
  34. package/lib/components/ListingTable/ListingTableContent/ListingTableContent.js +1 -1
  35. package/lib/components/ListingTable/ListingTableContent/ListingTableContent.js.map +1 -1
  36. package/lib/components/ListingTable/SearchFilter/SearchContainer.js +496 -121
  37. package/lib/components/ListingTable/SearchFilter/SearchContainer.js.map +1 -1
  38. package/lib/components/ListingTable/SearchFilter/SearchFilter.js +12 -6
  39. package/lib/components/ListingTable/SearchFilter/SearchFilter.js.map +1 -1
  40. package/lib/components/ListingTable/SearchFilter/helpers.js +48 -12
  41. package/lib/components/ListingTable/SearchFilter/helpers.js.map +1 -1
  42. package/lib/components/ListingTable/TableActions/TableActions.js.map +1 -1
  43. package/lib/components/ListingTable/service/index.js +1 -2
  44. package/lib/components/ListingTable/service/index.js.map +1 -1
  45. package/lib/components/Tabs/index.js +4 -5
  46. package/lib/components/Tabs/index.js.map +1 -1
  47. package/lib/index.js +12 -5
  48. package/lib/index.js.map +1 -1
  49. package/lib/utils/add-content-menu-items.js +1 -1
  50. package/lib/utils/add-content-menu-items.js.map +1 -1
  51. package/lib/utils/hoc/withContext.js.map +1 -1
  52. package/lib-es/components/EntityManager/Entity/Entity.js.map +1 -1
  53. package/lib-es/components/EntityManager/Entity/EntityHeader/EntityHeader.js.map +1 -1
  54. package/lib-es/components/EntityManager/Entity/EntityHeader/HeaderPreviewButton/HeaderPreviewButton.js.map +1 -1
  55. package/lib-es/components/EntityManager/Entity/SideBarRelations/helpers/build-dynamic-query.js.map +1 -1
  56. package/lib-es/components/EntityManager/Entity/SideBarRelations/hooks/useCustomSidebarData.js.map +1 -1
  57. package/lib-es/components/EntityManager/Entity/SideBarRelations/presentational/CustomSidebarInfo.js.map +1 -1
  58. package/lib-es/components/EntityManager/Entity/actions-handlers/create/submit.js.map +1 -1
  59. package/lib-es/components/EntityManager/Entity/actions-handlers/shared/publish.js.map +1 -1
  60. package/lib-es/components/EntityManager/EntityManager.js.map +1 -1
  61. package/lib-es/components/EntityManager/utils/entity.js.map +1 -1
  62. package/lib-es/components/EntityManager/utils/query.js.map +1 -1
  63. package/lib-es/components/InfoBoxes/InfoBoxTooltip.js.map +1 -1
  64. package/lib-es/components/InfoBoxes/helpers/build-dynamic-query.js.map +1 -1
  65. package/lib-es/components/InfoBoxes/hooks/useData.js.map +1 -1
  66. package/lib-es/components/InfoBoxes/presentational/InfoBox.js.map +1 -1
  67. package/lib-es/components/InfoBoxes/presentational/InfoBoxLabel.js.map +1 -1
  68. package/lib-es/components/ListingTable/ListingTable.js.map +1 -1
  69. package/lib-es/components/ListingTable/ListingTableContent/ListingTableContent.js.map +1 -1
  70. package/lib-es/components/ListingTable/SearchFilter/SearchContainer.js +323 -51
  71. package/lib-es/components/ListingTable/SearchFilter/SearchContainer.js.map +1 -1
  72. package/lib-es/components/ListingTable/SearchFilter/SearchFilter.js +7 -3
  73. package/lib-es/components/ListingTable/SearchFilter/SearchFilter.js.map +1 -1
  74. package/lib-es/components/ListingTable/SearchFilter/helpers.js +39 -8
  75. package/lib-es/components/ListingTable/SearchFilter/helpers.js.map +1 -1
  76. package/lib-es/components/ListingTable/SearchFilter/querys.js.map +1 -1
  77. package/lib-es/components/ListingTable/mappers/populate-rows.js.map +1 -1
  78. package/lib-es/components/ListingTable/service/index.js.map +1 -1
  79. package/lib-es/components/Tabs/index.js +3 -5
  80. package/lib-es/components/Tabs/index.js.map +1 -1
  81. package/lib-es/index.js +3 -2
  82. package/lib-es/index.js.map +1 -1
  83. package/lib-es/utils/add-content-menu-items.js.map +1 -1
  84. package/lib-es/utils/build-create-entity-mutation.js.map +1 -1
  85. package/lib-es/utils/build-delete-entity-mutation.js.map +1 -1
  86. package/lib-es/utils/build-listing-query.js.map +1 -1
  87. package/lib-es/utils/build-update-data-query.js.map +1 -1
  88. package/lib-es/utils/build-update-publish-unpublish-mutation.js.map +1 -1
  89. package/lib-es/utils/hoc/withContext.js +1 -1
  90. package/lib-es/utils/hoc/withContext.js.map +1 -1
  91. package/package.json +11 -11
  92. package/src/components/ListingTable/ListingTableContent/ListingTableContent.js +3 -3
  93. package/src/components/ListingTable/SearchFilter/SearchContainer.js +411 -134
  94. package/src/components/ListingTable/SearchFilter/SearchFilter.js +5 -2
  95. package/src/components/ListingTable/SearchFilter/helpers.js +56 -8
  96. package/src/components/Tabs/index.js +2 -6
  97. package/src/index.js +2 -0
  98. package/src/utils/hoc/withContext.js +5 -4
@@ -14,14 +14,32 @@ const updateListFilters = (searchTerm, selectedFilters, setListFilters, fields =
14
14
  }
15
15
 
16
16
  Object.entries(selectedFilters).forEach(([filterKey, filterValue]) => {
17
- if (!filterValue || filterValue === DEFAULT_FILTER_OPTION_LABEL) return;
18
- filters.push({
19
- match: {
20
- [`${filterKey}.keyword`]: {
21
- query: filterValue
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,23 @@ 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 = Object.entries(dynamicProperties).filter(
79
+ isFilterMultiSelectItems
80
+ );
81
+ return [...propertyMultiSelect, ...dynamicPropertyMultiSelect];
82
+ };
83
+
55
84
  const isFilterSelectItem = ([, item]) =>
56
85
  item.adminListingOptions && item.adminListingOptions.filterType === 'select';
57
86
 
87
+ const isFilterMultiSelectItems = ([, item]) =>
88
+ item.adminListingOptions && item.adminListingOptions.filterType === 'multiSelect';
89
+
58
90
  const buildQueryFields = (selectFilters, entityId) => {
59
91
  if (!Array.isArray(selectFilters) || selectFilters.length === 0) {
60
92
  return { gqlFields: '', rawQuery: '{}' };
@@ -96,4 +128,20 @@ const buildQueryFields = (selectFilters, entityId) => {
96
128
  return { gqlFields, rawQuery };
97
129
  };
98
130
 
99
- export { buildQueryFields, updateListFilters, getKeywordSearchFilters, findSelectFilters };
131
+ const getTidyLabel = (value, tidy) => {
132
+ if (!tidy) return value;
133
+
134
+ return value
135
+ .split(/[\s_-]+/)
136
+ .map(word => word.charAt(0).toUpperCase() + word.slice(1))
137
+ .join(' ');
138
+ };
139
+
140
+ export {
141
+ buildQueryFields,
142
+ updateListFilters,
143
+ getKeywordSearchFilters,
144
+ findSelectFilters,
145
+ findMultiSelectFilters,
146
+ getTidyLabel
147
+ };
@@ -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 } = useReadFromCache({ query: GET_CURRENT_TAB_ID }) || EDITOR_VIEW_TAB_INDEX;
13
+ const { currentTabId = EDITOR_VIEW_TAB_INDEX } = useTabsContext() || {};
18
14
  const [activeAccordions, setActiveAccordions] = useState([]);
19
15
 
20
16
  if (!enabled) return children;
package/src/index.js CHANGED
@@ -12,6 +12,8 @@ const EntityManager = React.lazy(
12
12
  () => import(/* webpackChunkName: 'EntityManager' */ './components/EntityManager')
13
13
  );
14
14
 
15
+ export { default as SearchFilter } from './components/ListingTable/SearchFilter/SearchFilter';
16
+
15
17
  export default async function load(app) {
16
18
  app.events.once('admin:menu:config:load', getAddContentMenuItems(app));
17
19
 
@@ -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 => props => {
5
- const contexts = useMainContext(MainContext);
6
- return <Component {...props} {...contexts} />;
7
- };
4
+ export const withContext = Component =>
5
+ function (props) {
6
+ const contexts = useMainContext(MainContext);
7
+ return <Component {...props} {...contexts} />;
8
+ };