@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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-default-query-params.js","names":["getDefaultQueryParams","schema","updated","properties","adminDefaultListingFilter","where","adminListings","defaultSort","displayProperties","sort","property","direction","limit","offset"],"sources":["../../src/utils/get-default-query-params.js"],"sourcesContent":["const getDefaultQueryParams = schema => {\n const updated = schema.properties && schema.properties.updated;\n const { adminDefaultListingFilter: where, adminListings: { defaultSort } = {} } =\n schema.displayProperties || {};\n\n let sort = [];\n\n if (defaultSort?.property) {\n sort = [\n {\n property: defaultSort.property,\n direction: defaultSort.direction || 'asc'\n }\n ];\n } else if (updated) {\n sort = [\n {\n property: 'updated',\n direction: 'desc'\n }\n ];\n }\n\n return {\n where,\n limit: 10,\n offset: 0,\n sort\n };\n};\n\nexport { getDefaultQueryParams };\n"],"mappings":"AAAA,MAAMA,qBAAqB,GAAGC,MAAM,IAAI;EACtC,MAAMC,OAAO,GAAGD,MAAM,CAACE,UAAU,IAAIF,MAAM,CAACE,UAAU,CAACD,OAAO;EAC9D,MAAM;IAAEE,yBAAyB,EAAEC,KAAK;IAAEC,aAAa,EAAE;MAAEC;IAAY,CAAC,GAAG,CAAC;EAAE,CAAC,GAC7EN,MAAM,CAACO,iBAAiB,IAAI,CAAC,CAAC;EAEhC,IAAIC,IAAI,GAAG,EAAE;EAEb,IAAIF,WAAW,aAAXA,WAAW,uBAAXA,WAAW,CAAEG,QAAQ,EAAE;IACzBD,IAAI,GAAG,CACL;MACEC,QAAQ,EAAEH,WAAW,CAACG,QAAQ;MAC9BC,SAAS,EAAEJ,WAAW,CAACI,SAAS,IAAI;IACtC,CAAC,CACF;EACH,CAAC,MAAM,IAAIT,OAAO,EAAE;IAClBO,IAAI,GAAG,CACL;MACEC,QAAQ,EAAE,SAAS;MACnBC,SAAS,EAAE;IACb,CAAC,CACF;EACH;EAEA,OAAO;IACLN,KAAK;IACLO,KAAK,EAAE,EAAE;IACTC,MAAM,EAAE,CAAC;IACTJ;EACF,CAAC;AACH,CAAC;AAED,SAAST,qBAAqB","ignoreList":[]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { useMainContext, MainContext } from '@blaze-cms/admin-ui-utils';
|
|
4
|
+
export const withContext = Component => function (props) {
|
|
5
|
+
const contexts = useMainContext(MainContext);
|
|
6
|
+
return /*#__PURE__*/React.createElement(Component, _extends({}, props, contexts));
|
|
7
|
+
};
|
|
8
|
+
//# sourceMappingURL=withContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"withContext.js","names":["React","useMainContext","MainContext","withContext","Component","props","contexts","createElement","_extends"],"sources":["../../../src/utils/hoc/withContext.js"],"sourcesContent":["import React from 'react';\nimport { useMainContext, MainContext } from '@blaze-cms/admin-ui-utils';\n\nexport const withContext = Component =>\n function (props) {\n const contexts = useMainContext(MainContext);\n return <Component {...props} {...contexts} />;\n };\n"],"mappings":";AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,cAAc,EAAEC,WAAW,QAAQ,2BAA2B;AAEvE,OAAO,MAAMC,WAAW,GAAGC,SAAS,IAClC,UAAUC,KAAK,EAAE;EACf,MAAMC,QAAQ,GAAGL,cAAc,CAACC,WAAW,CAAC;EAC5C,oBAAOF,KAAA,CAAAO,aAAA,CAACH,SAAS,EAAAI,QAAA,KAAKH,KAAK,EAAMC,QAAQ,CAAG,CAAC;AAC/C,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { useState, useCallback } from 'react';
|
|
2
|
+
function useToggle(initialValue) {
|
|
3
|
+
const [toggleValue, setToggleValue] = useState(initialValue);
|
|
4
|
+
const toggler = useCallback(() => setToggleValue(!toggleValue), [toggleValue]);
|
|
5
|
+
return [toggleValue, toggler];
|
|
6
|
+
}
|
|
7
|
+
export default useToggle;
|
|
8
|
+
//# sourceMappingURL=useToggle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useToggle.js","names":["useState","useCallback","useToggle","initialValue","toggleValue","setToggleValue","toggler"],"sources":["../../../src/utils/hooks/useToggle.js"],"sourcesContent":["import { useState, useCallback } from 'react';\n\nfunction useToggle(initialValue) {\n const [toggleValue, setToggleValue] = useState(initialValue);\n const toggler = useCallback(() => setToggleValue(!toggleValue), [toggleValue]);\n\n return [toggleValue, toggler];\n}\n\nexport default useToggle;\n"],"mappings":"AAAA,SAASA,QAAQ,EAAEC,WAAW,QAAQ,OAAO;AAE7C,SAASC,SAASA,CAACC,YAAY,EAAE;EAC/B,MAAM,CAACC,WAAW,EAAEC,cAAc,CAAC,GAAGL,QAAQ,CAACG,YAAY,CAAC;EAC5D,MAAMG,OAAO,GAAGL,WAAW,CAAC,MAAMI,cAAc,CAAC,CAACD,WAAW,CAAC,EAAE,CAACA,WAAW,CAAC,CAAC;EAE9E,OAAO,CAACA,WAAW,EAAEE,OAAO,CAAC;AAC/B;AAEA,eAAeJ,SAAS","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["buildUpdatePublishUnpublishMutation"],"sources":["../../src/utils/index.js"],"sourcesContent":["import buildUpdatePublishUnpublishMutation from './build-update-publish-unpublish-mutation';\n\nexport { buildUpdatePublishUnpublishMutation };\n"],"mappings":"AAAA,OAAOA,mCAAmC,MAAM,2CAA2C;AAE3F,SAASA,mCAAmC","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blaze-cms/plugin-data-ui",
|
|
3
|
-
"version": "0.146.0-rc-eagle.
|
|
3
|
+
"version": "0.146.0-rc-eagle-3.2",
|
|
4
4
|
"description": "Blaze plugin data ui",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "lib-es/index.js",
|
|
7
|
+
"files": [
|
|
8
|
+
"lib",
|
|
9
|
+
"lib-es",
|
|
10
|
+
"src"
|
|
11
|
+
],
|
|
7
12
|
"source": "src/index.js",
|
|
8
13
|
"directories": {
|
|
9
14
|
"src": "src/"
|
|
@@ -27,16 +32,16 @@
|
|
|
27
32
|
},
|
|
28
33
|
"license": "GPL-3.0",
|
|
29
34
|
"dependencies": {
|
|
30
|
-
"@blaze-cms/admin-ui-utils": "0.146.0-rc-eagle.
|
|
31
|
-
"@blaze-cms/core-errors": "0.146.0-rc-eagle.0",
|
|
32
|
-
"@blaze-cms/plugin-render-hooks-ui": "0.146.0-rc-eagle.0",
|
|
33
|
-
"@blaze-cms/react-form-builder": "0.146.0-rc-eagle.
|
|
34
|
-
"@blaze-cms/react-page-builder": "0.146.0-rc-eagle.
|
|
35
|
-
"@blaze-cms/setup-ui": "0.146.0-rc-eagle.0",
|
|
36
|
-
"@blaze-cms/versioning-ui": "0.146.0-rc-eagle.0",
|
|
35
|
+
"@blaze-cms/admin-ui-utils": "0.146.0-rc-eagle-3.2",
|
|
36
|
+
"@blaze-cms/core-errors": "0.146.0-rc-eagle-3.0",
|
|
37
|
+
"@blaze-cms/plugin-render-hooks-ui": "0.146.0-rc-eagle-3.0",
|
|
38
|
+
"@blaze-cms/react-form-builder": "0.146.0-rc-eagle-3.2",
|
|
39
|
+
"@blaze-cms/react-page-builder": "0.146.0-rc-eagle-3.2",
|
|
40
|
+
"@blaze-cms/setup-ui": "0.146.0-rc-eagle-3.0",
|
|
41
|
+
"@blaze-cms/versioning-ui": "0.146.0-rc-eagle-3.0",
|
|
37
42
|
"@blaze-react/button": "0.8.0-alpha.82",
|
|
38
43
|
"@blaze-react/more": "0.5.19",
|
|
39
|
-
"@blaze-react/multiselect": "0.8.0-alpha.
|
|
44
|
+
"@blaze-react/multiselect": "0.8.0-alpha.108",
|
|
40
45
|
"@blaze-react/pagination": "0.8.0-alpha.76",
|
|
41
46
|
"@blaze-react/select": "0.8.0-alpha.100",
|
|
42
47
|
"@blaze-react/tab": "^0.7.0",
|
|
@@ -52,11 +57,10 @@
|
|
|
52
57
|
"lodash.unionby": "^4.8.0",
|
|
53
58
|
"lodash.upperfirst": "^4.3.1",
|
|
54
59
|
"react-helmet": "^6.1.0",
|
|
55
|
-
"regenerator-runtime": "^0.13.3",
|
|
56
60
|
"uuid": "^3.3.3"
|
|
57
61
|
},
|
|
58
62
|
"devDependencies": {
|
|
59
|
-
"@blaze-cms/core-ui": "0.146.0-rc-eagle.
|
|
63
|
+
"@blaze-cms/core-ui": "0.146.0-rc-eagle-3.2"
|
|
60
64
|
},
|
|
61
65
|
"peerDependencies": {
|
|
62
66
|
"@apollo/client": "3.x",
|
|
@@ -68,5 +72,5 @@
|
|
|
68
72
|
"lib/*",
|
|
69
73
|
"lib-es/*"
|
|
70
74
|
],
|
|
71
|
-
"gitHead": "
|
|
75
|
+
"gitHead": "3219f29b6e4e8c40f34fe79804b2cd315c84467a"
|
|
72
76
|
}
|
|
@@ -407,7 +407,7 @@ const Entity = ({
|
|
|
407
407
|
|
|
408
408
|
const showModal = checkFulfilConditions(formData, modalStatus);
|
|
409
409
|
|
|
410
|
-
const onViewUrlHandler = canViewPage(
|
|
410
|
+
const onViewUrlHandler = canViewPage(entity, schema, entityIsPublished)
|
|
411
411
|
? () => onViewUrlClick(getFullUrl)
|
|
412
412
|
: onViewUrl;
|
|
413
413
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { createEntityRecord } from '@blaze-cms/admin-ui-utils';
|
|
2
2
|
import { SAVE_BUTTON_TEXTS } from '../../../../../constants';
|
|
3
3
|
|
|
4
4
|
const submit = async (
|
|
@@ -14,24 +14,17 @@ const submit = async (
|
|
|
14
14
|
},
|
|
15
15
|
addToast
|
|
16
16
|
) => {
|
|
17
|
-
const mutation = buildCreateEntityMutation(entitySchema);
|
|
18
|
-
|
|
19
17
|
try {
|
|
20
18
|
setIsSaveButtonAvailable(false);
|
|
21
19
|
setSaveButtonText(SAVE_BUTTON_TEXTS.saving);
|
|
22
|
-
const
|
|
23
|
-
data: { createdEntity: createdEntityResult }
|
|
24
|
-
} = await client.mutate({
|
|
25
|
-
mutation,
|
|
26
|
-
variables: { input: parsedFormValues }
|
|
27
|
-
});
|
|
20
|
+
const createdRecord = await createEntityRecord(client, entitySchema, parsedFormValues);
|
|
28
21
|
|
|
29
22
|
setSaveButtonText(SAVE_BUTTON_TEXTS.saved);
|
|
30
|
-
setEntityData(
|
|
23
|
+
setEntityData(createdRecord);
|
|
31
24
|
setIsNewEntity(false);
|
|
32
25
|
|
|
33
26
|
const updatePathname = history.location.pathname.replace('create', 'update');
|
|
34
|
-
history.push(`${updatePathname}/${
|
|
27
|
+
history.push(`${updatePathname}/${createdRecord.id}`);
|
|
35
28
|
addToast(`Created`, {
|
|
36
29
|
appearance: 'success',
|
|
37
30
|
autoDismiss: true
|
|
@@ -1,19 +1,13 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
DEBUG_PARAM,
|
|
4
|
-
ENTITY_PUBLISHED,
|
|
5
|
-
KEY_TO_CHECK,
|
|
6
|
-
SELECT_DEFAULT_VALUE
|
|
7
|
-
} from '../../../constants';
|
|
1
|
+
import { DEBUG_PARAM, ENTITY_PUBLISHED, SELECT_DEFAULT_VALUE } from '../../../constants';
|
|
8
2
|
|
|
9
|
-
function canViewPage(
|
|
3
|
+
function canViewPage(entity, schema, entityIsPublished) {
|
|
10
4
|
return (
|
|
11
|
-
has(formData, KEY_TO_CHECK) &&
|
|
12
5
|
entity &&
|
|
13
6
|
entity.id &&
|
|
14
7
|
schema &&
|
|
15
8
|
schema.id &&
|
|
16
|
-
entityIsPublished === ENTITY_PUBLISHED
|
|
9
|
+
entityIsPublished === ENTITY_PUBLISHED &&
|
|
10
|
+
schema.properties.slug
|
|
17
11
|
);
|
|
18
12
|
}
|
|
19
13
|
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import React, { useState, useEffect, useMemo } from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import MultiSelect from '@blaze-react/multiselect';
|
|
4
|
+
import debounce from 'lodash.debounce';
|
|
5
|
+
import unionBy from 'lodash.unionby';
|
|
6
|
+
import { useApolloClient } from '@apollo/client';
|
|
7
|
+
import {
|
|
8
|
+
getQuery,
|
|
9
|
+
getDynamicQuery,
|
|
10
|
+
getAdminRecordSearch,
|
|
11
|
+
buildLabel
|
|
12
|
+
} from '@blaze-cms/admin-ui-utils';
|
|
13
|
+
|
|
14
|
+
const DEBOUNCE_TIME = 500;
|
|
15
|
+
const SEARCH_LOAD_OFFSET = 10;
|
|
16
|
+
const SELECTION_LIMIT = 10;
|
|
17
|
+
|
|
18
|
+
const shouldLoadMore = (searchTerm, stopIndex, currentDataLength) =>
|
|
19
|
+
searchTerm &&
|
|
20
|
+
stopIndex > SEARCH_LOAD_OFFSET &&
|
|
21
|
+
stopIndex >= currentDataLength - SEARCH_LOAD_OFFSET;
|
|
22
|
+
|
|
23
|
+
const RelationMultiSelectFilter = ({ id, label, entityIdentifier, selectedIds, onChange }) => {
|
|
24
|
+
const client = useApolloClient();
|
|
25
|
+
const [schema, setSchema] = useState(null);
|
|
26
|
+
const [data, setData] = useState([]);
|
|
27
|
+
const [searchTerm, setSearchTerm] = useState('');
|
|
28
|
+
|
|
29
|
+
const { displayProperties } = schema || {};
|
|
30
|
+
|
|
31
|
+
useEffect(() => {
|
|
32
|
+
let active = true;
|
|
33
|
+
(async () => {
|
|
34
|
+
try {
|
|
35
|
+
const { data: { getEntitySchemas = [] } = {} } = await client.query({
|
|
36
|
+
query: getQuery('GET_ENTITY_SCHEMA'),
|
|
37
|
+
variables: { identifier: entityIdentifier }
|
|
38
|
+
});
|
|
39
|
+
const [relationSchema] = getEntitySchemas;
|
|
40
|
+
if (active && relationSchema) setSchema(relationSchema);
|
|
41
|
+
} catch {
|
|
42
|
+
if (active) setSchema(null);
|
|
43
|
+
}
|
|
44
|
+
})();
|
|
45
|
+
return () => {
|
|
46
|
+
active = false;
|
|
47
|
+
};
|
|
48
|
+
}, [client, entityIdentifier]);
|
|
49
|
+
|
|
50
|
+
useEffect(() => {
|
|
51
|
+
if (!schema || !selectedIds.length) return undefined;
|
|
52
|
+
let active = true;
|
|
53
|
+
(async () => {
|
|
54
|
+
try {
|
|
55
|
+
const { data: { result = [] } = {} } = await client.query({
|
|
56
|
+
query: getDynamicQuery('GET_ALL_ENTITIES')(schema),
|
|
57
|
+
variables: {
|
|
58
|
+
where: { id: { _in: selectedIds } },
|
|
59
|
+
sort: [{ property: 'name', direction: 'asc' }]
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
if (active && result.length) setData(prev => unionBy([...prev, ...result], 'id'));
|
|
63
|
+
} catch {
|
|
64
|
+
// ignore - selected chips will fall back to id-only display
|
|
65
|
+
}
|
|
66
|
+
})();
|
|
67
|
+
return () => {
|
|
68
|
+
active = false;
|
|
69
|
+
};
|
|
70
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
71
|
+
}, [schema]);
|
|
72
|
+
|
|
73
|
+
const onSearch = useMemo(
|
|
74
|
+
() => (schema ? getAdminRecordSearch(schema, client) : null),
|
|
75
|
+
[schema, client]
|
|
76
|
+
);
|
|
77
|
+
|
|
78
|
+
const currentData = useMemo(
|
|
79
|
+
() =>
|
|
80
|
+
data.map(option => {
|
|
81
|
+
const checked = selectedIds.includes(option.id);
|
|
82
|
+
return {
|
|
83
|
+
...option,
|
|
84
|
+
checked,
|
|
85
|
+
show: true,
|
|
86
|
+
name: buildLabel(displayProperties, option)
|
|
87
|
+
};
|
|
88
|
+
}),
|
|
89
|
+
[data, selectedIds, displayProperties]
|
|
90
|
+
);
|
|
91
|
+
|
|
92
|
+
const interceptOnSearchChange = debounce(async ({ value }) => {
|
|
93
|
+
setSearchTerm(value);
|
|
94
|
+
if (!onSearch) return;
|
|
95
|
+
const result = await onSearch({ event: { value }, currentValue: selectedIds });
|
|
96
|
+
if (!result) return;
|
|
97
|
+
setData(prev => {
|
|
98
|
+
const selected = prev.filter(item => selectedIds.includes(item.id));
|
|
99
|
+
const newOnes = result.filter(item => !selectedIds.includes(item.id));
|
|
100
|
+
return unionBy([...selected, ...newOnes], 'id');
|
|
101
|
+
});
|
|
102
|
+
}, DEBOUNCE_TIME);
|
|
103
|
+
|
|
104
|
+
const scrollHook = debounce(async ({ stopIndex }) => {
|
|
105
|
+
if (!onSearch) return;
|
|
106
|
+
const currentDataLength = data.length - selectedIds.length;
|
|
107
|
+
if (!shouldLoadMore(searchTerm, stopIndex, currentDataLength)) return;
|
|
108
|
+
const result = await onSearch({
|
|
109
|
+
event: { value: searchTerm },
|
|
110
|
+
currentValue: selectedIds,
|
|
111
|
+
currentOffset: currentDataLength
|
|
112
|
+
});
|
|
113
|
+
if (!result || !result.length) return;
|
|
114
|
+
setData(prev => unionBy([...prev, ...result], 'id'));
|
|
115
|
+
}, DEBOUNCE_TIME);
|
|
116
|
+
|
|
117
|
+
const onItemsRenderedIntercept = async event => {
|
|
118
|
+
if (!onSearch) return;
|
|
119
|
+
scrollHook(event);
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
const getSelected = ({
|
|
123
|
+
event: {
|
|
124
|
+
target: { value }
|
|
125
|
+
}
|
|
126
|
+
}) => {
|
|
127
|
+
onChange(id, value);
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
return (
|
|
131
|
+
<MultiSelect
|
|
132
|
+
label={label}
|
|
133
|
+
name={id}
|
|
134
|
+
data={{ data: currentData, filterBy: ['name'], identification: 'id', keyValue: 'name' }}
|
|
135
|
+
limit={SELECTION_LIMIT}
|
|
136
|
+
onChange={interceptOnSearchChange}
|
|
137
|
+
getSelected={getSelected}
|
|
138
|
+
onItemsRendered={onItemsRenderedIntercept}
|
|
139
|
+
required={false}
|
|
140
|
+
checkedPreviewCount={1}
|
|
141
|
+
formatMoreLabel={count => `${count} more`}
|
|
142
|
+
isDynamic
|
|
143
|
+
/>
|
|
144
|
+
);
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
RelationMultiSelectFilter.propTypes = {
|
|
148
|
+
id: PropTypes.string.isRequired,
|
|
149
|
+
label: PropTypes.string,
|
|
150
|
+
entityIdentifier: PropTypes.string.isRequired,
|
|
151
|
+
selectedIds: PropTypes.array,
|
|
152
|
+
onChange: PropTypes.func.isRequired
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
RelationMultiSelectFilter.defaultProps = {
|
|
156
|
+
label: '',
|
|
157
|
+
selectedIds: []
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
export default RelationMultiSelectFilter;
|