@blaze-cms/plugin-search-ui 0.125.0-core-styles.0 → 0.125.0-f-admin-updates.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +23 -1
- package/lib/application/query/index.js +0 -8
- package/lib/application/query/index.js.map +1 -1
- package/lib/components/SearchAdmin/RecentSearches/RecentSearches.js +2 -11
- package/lib/components/SearchAdmin/RecentSearches/RecentSearches.js.map +1 -1
- package/lib/components/SearchAdmin/RecentSearches/index.js +0 -4
- package/lib/components/SearchAdmin/RecentSearches/index.js.map +1 -1
- package/lib/components/SearchAdmin/SearchAdmin.js +70 -68
- package/lib/components/SearchAdmin/SearchAdmin.js.map +1 -1
- package/lib/components/SearchAdmin/SearchAdminSideBar/SearchAdminSideBar.js +113 -0
- package/lib/components/SearchAdmin/SearchAdminSideBar/SearchAdminSideBar.js.map +1 -0
- package/lib/components/SearchAdmin/SearchAdminSideBar/index.js +12 -0
- package/lib/components/SearchAdmin/SearchAdminSideBar/index.js.map +1 -0
- package/lib/components/SearchAdmin/SearchBar/SearchBar.js +7 -15
- package/lib/components/SearchAdmin/SearchBar/SearchBar.js.map +1 -1
- package/lib/components/SearchAdmin/SearchBar/index.js +0 -4
- package/lib/components/SearchAdmin/SearchBar/index.js.map +1 -1
- package/lib/components/SearchAdmin/SearchResults/SearchResults.js +37 -65
- package/lib/components/SearchAdmin/SearchResults/SearchResults.js.map +1 -1
- package/lib/components/SearchAdmin/SearchResults/index.js +0 -4
- package/lib/components/SearchAdmin/SearchResults/index.js.map +1 -1
- package/lib/components/SearchAdmin/TriggerModal/TriggerModal.js +0 -6
- package/lib/components/SearchAdmin/TriggerModal/TriggerModal.js.map +1 -1
- package/lib/components/SearchAdmin/TriggerModal/index.js +0 -4
- package/lib/components/SearchAdmin/TriggerModal/index.js.map +1 -1
- package/lib/components/SearchAdmin/index.js +0 -4
- package/lib/components/SearchAdmin/index.js.map +1 -1
- package/lib/components/SearchPublishedContent/SearchPublishedContent.js +36 -67
- package/lib/components/SearchPublishedContent/SearchPublishedContent.js.map +1 -1
- package/lib/components/SearchPublishedContent/index.js +0 -4
- package/lib/components/SearchPublishedContent/index.js.map +1 -1
- package/lib/components/useLocalStorage/index.js +0 -4
- package/lib/components/useLocalStorage/index.js.map +1 -1
- package/lib/components/useLocalStorage/useLocalStorage.js +6 -14
- package/lib/components/useLocalStorage/useLocalStorage.js.map +1 -1
- package/lib/components/useSearch/index.js +0 -4
- package/lib/components/useSearch/index.js.map +1 -1
- package/lib/components/useSearch/useSearch.js +41 -65
- package/lib/components/useSearch/useSearch.js.map +1 -1
- package/lib/components/useSearchResults/index.js +0 -4
- package/lib/components/useSearchResults/index.js.map +1 -1
- package/lib/components/useSearchResults/useSearchResults.js +17 -63
- package/lib/components/useSearchResults/useSearchResults.js.map +1 -1
- package/lib/constants.js +0 -1
- package/lib/constants.js.map +1 -1
- package/lib/hooks/index.js +0 -4
- package/lib/hooks/index.js.map +1 -1
- package/lib/hooks/useDebounceSearch.js +19 -33
- package/lib/hooks/useDebounceSearch.js.map +1 -1
- package/lib/index.js +0 -6
- package/lib/index.js.map +1 -1
- package/lib-es/application/query/index.js +0 -3
- package/lib-es/application/query/index.js.map +1 -1
- package/lib-es/components/SearchAdmin/RecentSearches/RecentSearches.js +0 -2
- package/lib-es/components/SearchAdmin/RecentSearches/RecentSearches.js.map +1 -1
- package/lib-es/components/SearchAdmin/RecentSearches/index.js.map +1 -1
- package/lib-es/components/SearchAdmin/SearchAdmin.js +31 -14
- package/lib-es/components/SearchAdmin/SearchAdmin.js.map +1 -1
- package/lib-es/components/SearchAdmin/SearchAdminSideBar/SearchAdminSideBar.js +76 -0
- package/lib-es/components/SearchAdmin/SearchAdminSideBar/SearchAdminSideBar.js.map +1 -0
- package/lib-es/components/SearchAdmin/SearchAdminSideBar/index.js +3 -0
- package/lib-es/components/SearchAdmin/SearchAdminSideBar/index.js.map +1 -0
- package/lib-es/components/SearchAdmin/SearchBar/SearchBar.js +0 -2
- package/lib-es/components/SearchAdmin/SearchBar/SearchBar.js.map +1 -1
- package/lib-es/components/SearchAdmin/SearchBar/index.js.map +1 -1
- package/lib-es/components/SearchAdmin/SearchResults/SearchResults.js +18 -15
- package/lib-es/components/SearchAdmin/SearchResults/SearchResults.js.map +1 -1
- package/lib-es/components/SearchAdmin/SearchResults/index.js.map +1 -1
- package/lib-es/components/SearchAdmin/TriggerModal/TriggerModal.js +0 -2
- package/lib-es/components/SearchAdmin/TriggerModal/TriggerModal.js.map +1 -1
- package/lib-es/components/SearchAdmin/TriggerModal/index.js.map +1 -1
- package/lib-es/components/SearchAdmin/index.js.map +1 -1
- package/lib-es/components/SearchPublishedContent/SearchPublishedContent.js +4 -10
- package/lib-es/components/SearchPublishedContent/SearchPublishedContent.js.map +1 -1
- package/lib-es/components/SearchPublishedContent/index.js.map +1 -1
- package/lib-es/components/useLocalStorage/index.js.map +1 -1
- package/lib-es/components/useLocalStorage/useLocalStorage.js +0 -4
- package/lib-es/components/useLocalStorage/useLocalStorage.js.map +1 -1
- package/lib-es/components/useSearch/index.js.map +1 -1
- package/lib-es/components/useSearch/useSearch.js +7 -10
- package/lib-es/components/useSearch/useSearch.js.map +1 -1
- package/lib-es/components/useSearchResults/index.js.map +1 -1
- package/lib-es/components/useSearchResults/useSearchResults.js +1 -19
- package/lib-es/components/useSearchResults/useSearchResults.js.map +1 -1
- package/lib-es/constants.js.map +1 -1
- package/lib-es/hooks/index.js.map +1 -1
- package/lib-es/hooks/useDebounceSearch.js +0 -2
- package/lib-es/hooks/useDebounceSearch.js.map +1 -1
- package/lib-es/index.js.map +1 -1
- package/package.json +3 -3
- package/src/components/SearchAdmin/SearchAdmin.js +70 -40
- package/src/components/SearchAdmin/SearchAdminSideBar/SearchAdminSideBar.js +88 -0
- package/src/components/SearchAdmin/SearchAdminSideBar/index.js +3 -0
- package/src/components/SearchAdmin/SearchResults/SearchResults.js +42 -6
- package/src/components/useSearch/useSearch.js +8 -2
- package/src/components/useSearchResults/useSearchResults.js +1 -15
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { useQuery } from '@apollo/client';
|
|
3
|
+
import { getQuery } from '@blaze-cms/admin-ui-utils';
|
|
4
|
+
import { Checkbox } from '@blaze-react/checkboxes';
|
|
5
|
+
const MENU_PERMISSIONS = ['update:any', 'update:own', 'create:any', 'create:own'];
|
|
6
|
+
const SearchAdminSideBar = ({
|
|
7
|
+
searchModalSideBarClassName,
|
|
8
|
+
openSearchSideBar,
|
|
9
|
+
setOpenSearchSideBar,
|
|
10
|
+
handleSetEntityValues,
|
|
11
|
+
entityValues,
|
|
12
|
+
setEntityValues
|
|
13
|
+
}) => {
|
|
14
|
+
const [loadMore, setLoadMore] = useState(false);
|
|
15
|
+
const {
|
|
16
|
+
data: {
|
|
17
|
+
getEntitySchemas = []
|
|
18
|
+
} = {},
|
|
19
|
+
loading
|
|
20
|
+
} = useQuery(getQuery('GET_USER_EDITABLE_ENTITIES'), {
|
|
21
|
+
variables: {
|
|
22
|
+
canDoActions: MENU_PERMISSIONS
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
if (loading) return null;
|
|
26
|
+
const filteredEntitiesSchemas = getEntitySchemas.filter(entity => {
|
|
27
|
+
if (Object.keys(entity.extras).length) {
|
|
28
|
+
return entity.extras.searchIndexes.includes('admin');
|
|
29
|
+
}
|
|
30
|
+
return false;
|
|
31
|
+
});
|
|
32
|
+
const entitiesToShow = filteredEntitiesSchemas.slice(0, loadMore ? filteredEntitiesSchemas.length : 5);
|
|
33
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
34
|
+
className: searchModalSideBarClassName
|
|
35
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
36
|
+
className: "modal__search__sidebar__button",
|
|
37
|
+
role: "button",
|
|
38
|
+
onClick: () => setOpenSearchSideBar(!openSearchSideBar)
|
|
39
|
+
}, /*#__PURE__*/React.createElement("i", {
|
|
40
|
+
className: "material-icons"
|
|
41
|
+
}, openSearchSideBar ? 'keyboard_arrow_left' : 'keyboard_arrow_right')), /*#__PURE__*/React.createElement("div", {
|
|
42
|
+
className: "modal__search__sidebar__container"
|
|
43
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
44
|
+
className: "modal__search__sidebar__wrapper"
|
|
45
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
46
|
+
className: "modal__search__sidebar__filters"
|
|
47
|
+
}, /*#__PURE__*/React.createElement("i", {
|
|
48
|
+
className: "material-icons modal__search__sidebar__icon"
|
|
49
|
+
}, "tune"), /*#__PURE__*/React.createElement("span", null, "Filters")), /*#__PURE__*/React.createElement("div", {
|
|
50
|
+
className: "modal__search__sidebar__clear",
|
|
51
|
+
role: "button",
|
|
52
|
+
onClick: () => setEntityValues([])
|
|
53
|
+
}, /*#__PURE__*/React.createElement("span", null, "Clear all"), /*#__PURE__*/React.createElement("i", {
|
|
54
|
+
className: "material-icons modal__search__sidebar__icon--clear"
|
|
55
|
+
}, "replay"))), /*#__PURE__*/React.createElement("div", {
|
|
56
|
+
className: "modal__search__sidebar__entity-list"
|
|
57
|
+
}, /*#__PURE__*/React.createElement("h1", null, "Entity list"), entitiesToShow.map(entity => /*#__PURE__*/React.createElement(Checkbox, {
|
|
58
|
+
checked: entityValues.some(_entity => _entity.id === entity.id),
|
|
59
|
+
label: entity.displayName,
|
|
60
|
+
id: entity.id,
|
|
61
|
+
name: entity.id,
|
|
62
|
+
onChange: ({
|
|
63
|
+
value: {
|
|
64
|
+
checked
|
|
65
|
+
}
|
|
66
|
+
}) => handleSetEntityValues(entity)
|
|
67
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
68
|
+
className: "modal__search__sidebar__more",
|
|
69
|
+
role: "button",
|
|
70
|
+
onClick: () => setLoadMore(!loadMore)
|
|
71
|
+
}, /*#__PURE__*/React.createElement("i", {
|
|
72
|
+
className: "material-icons"
|
|
73
|
+
}, !loadMore ? 'navigate_next' : 'expand_less'), /*#__PURE__*/React.createElement("span", null, loadMore ? 'Less' : 'More')))));
|
|
74
|
+
};
|
|
75
|
+
export default SearchAdminSideBar;
|
|
76
|
+
//# sourceMappingURL=SearchAdminSideBar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SearchAdminSideBar.js","names":["React","useState","useQuery","getQuery","Checkbox","MENU_PERMISSIONS","SearchAdminSideBar","searchModalSideBarClassName","openSearchSideBar","setOpenSearchSideBar","handleSetEntityValues","entityValues","setEntityValues","loadMore","setLoadMore","data","getEntitySchemas","loading","variables","canDoActions","filteredEntitiesSchemas","filter","entity","Object","keys","extras","length","searchIndexes","includes","entitiesToShow","slice","map","some","_entity","id","displayName","value","checked"],"sources":["../../../../src/components/SearchAdmin/SearchAdminSideBar/SearchAdminSideBar.js"],"sourcesContent":["import React, { useState } from 'react';\nimport { useQuery } from '@apollo/client';\nimport { getQuery } from '@blaze-cms/admin-ui-utils';\nimport { Checkbox } from '@blaze-react/checkboxes';\n\nconst MENU_PERMISSIONS = ['update:any', 'update:own', 'create:any', 'create:own'];\n\nconst SearchAdminSideBar = ({\n searchModalSideBarClassName,\n openSearchSideBar,\n setOpenSearchSideBar,\n handleSetEntityValues,\n entityValues,\n setEntityValues\n}) => {\n const [loadMore, setLoadMore] = useState(false);\n const { data: { getEntitySchemas = [] } = {}, loading } = useQuery(\n getQuery('GET_USER_EDITABLE_ENTITIES'),\n {\n variables: {\n canDoActions: MENU_PERMISSIONS\n }\n }\n );\n\n if (loading) return null;\n\n const filteredEntitiesSchemas = getEntitySchemas.filter(entity => {\n if (Object.keys(entity.extras).length) {\n return entity.extras.searchIndexes.includes('admin');\n }\n return false;\n });\n\n const entitiesToShow = filteredEntitiesSchemas.slice(\n 0,\n loadMore ? filteredEntitiesSchemas.length : 5\n );\n\n return (\n <div className={searchModalSideBarClassName}>\n <div\n className=\"modal__search__sidebar__button\"\n role=\"button\"\n onClick={() => setOpenSearchSideBar(!openSearchSideBar)}>\n <i className=\"material-icons\">\n {openSearchSideBar ? 'keyboard_arrow_left' : 'keyboard_arrow_right'}\n </i>\n </div>\n <div className=\"modal__search__sidebar__container\">\n <div className=\"modal__search__sidebar__wrapper\">\n <div className=\"modal__search__sidebar__filters\">\n <i className=\"material-icons modal__search__sidebar__icon\">tune</i>\n <span>Filters</span>\n </div>\n <div\n className=\"modal__search__sidebar__clear\"\n role=\"button\"\n onClick={() => setEntityValues([])}>\n <span>Clear all</span>\n <i className=\"material-icons modal__search__sidebar__icon--clear\">replay</i>\n </div>\n </div>\n <div className=\"modal__search__sidebar__entity-list\">\n <h1>Entity list</h1>\n {entitiesToShow.map(entity => (\n <Checkbox\n checked={entityValues.some(_entity => _entity.id === entity.id)}\n label={entity.displayName}\n id={entity.id}\n name={entity.id}\n onChange={({ value: { checked } }) => handleSetEntityValues(entity)}\n />\n ))}\n <div\n className=\"modal__search__sidebar__more\"\n role=\"button\"\n onClick={() => setLoadMore(!loadMore)}>\n <i className=\"material-icons\">{!loadMore ? 'navigate_next' : 'expand_less'}</i>\n <span>{loadMore ? 'Less' : 'More'}</span>\n </div>\n </div>\n </div>\n </div>\n );\n};\n\nexport default SearchAdminSideBar;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,QAAQ,QAAQ,OAAO;AACvC,SAASC,QAAQ,QAAQ,gBAAgB;AACzC,SAASC,QAAQ,QAAQ,2BAA2B;AACpD,SAASC,QAAQ,QAAQ,yBAAyB;AAElD,MAAMC,gBAAgB,GAAG,CAAC,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,CAAC;AAEjF,MAAMC,kBAAkB,GAAG,CAAC;EAC1BC,2BAA2B;EAC3BC,iBAAiB;EACjBC,oBAAoB;EACpBC,qBAAqB;EACrBC,YAAY;EACZC;AACF,CAAC,KAAK;EACJ,MAAM,CAACC,QAAQ,EAAEC,WAAW,CAAC,GAAGb,QAAQ,CAAC,KAAK,CAAC;EAC/C,MAAM;IAAEc,IAAI,EAAE;MAAEC,gBA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AAG,CAACT,MAAM,iBACxB,oBAAC,QAAQ;IACP,OAAO,EAAEX,YAAY,CAACqB,IAAI,CAACC,OAAO,IAAIA,OAAO,CAACC,EAAE,KAAKZ,MAAM,CAACY,EAAE,CAAE;IAChE,KAAK,EAAEZ,MAAM,CAACa,WAAY;IAC1B,EAAE,EAAEb,MAAM,CAACY,EAAG;IACd,IAAI,EAAEZ,MAAM,CAACY,EAAG;IAChB,QAAQ,EAAE,CAAC;MAAEE,KAAK,EAAE;QAAEC;MAAQ;IAAE,CAAC,KAAK3B,qBAAqB,CAACY,MAAM;EAAE,EAEvE,CAAC,eACF;IACE,SAAS,EAAC,8BAA8B;IACxC,IAAI,EAAC,QAAQ;IACb,OAAO,EAAE,MAAMR,WAAW,CAAC,CAACD,QAAQ;EAAE,gBACtC;IAAG,SAAS,EAAC;EAAgB,GAAE,CAACA,QAAQ,GAAG,eAAe,GAAG,aAAa,CAAK,eAC/E,kCAAOA,QAAQ,GAAG,MAAM,GAAG,MAAM,CAAQ,CACrC,CACF,CACF,CACF;AAEV,CAAC;AAED,eAAeP,kBAAkB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["SearchAdminSideBar"],"sources":["../../../../src/components/SearchAdmin/SearchAdminSideBar/index.js"],"sourcesContent":["import SearchAdminSideBar from './SearchAdminSideBar';\n\nexport default SearchAdminSideBar;\n"],"mappings":"AAAA,OAAOA,kBAAkB,MAAM,sBAAsB;AAErD,eAAeA,kBAAkB"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
|
|
4
3
|
const SearchBar = ({
|
|
5
4
|
handleKeyDown,
|
|
6
5
|
searchInputRef,
|
|
@@ -32,7 +31,6 @@ const SearchBar = ({
|
|
|
32
31
|
onClick: toggleSearchModal,
|
|
33
32
|
role: "button"
|
|
34
33
|
}, "close")));
|
|
35
|
-
|
|
36
34
|
SearchBar.propTypes = {
|
|
37
35
|
close: PropTypes.bool,
|
|
38
36
|
handleKeyDown: PropTypes.func.isRequired,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchBar.js","names":["React","PropTypes","SearchBar","handleKeyDown","searchInputRef","handleSearchTerm","searchTerm","toggleSearchModal","close","search","placeholder","propTypes","bool","func","isRequired","object","string","defaultProps"],"sources":["../../../../src/components/SearchAdmin/SearchBar/SearchBar.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\n\nconst SearchBar = ({\n handleKeyDown,\n searchInputRef,\n handleSearchTerm,\n searchTerm,\n toggleSearchModal,\n close,\n search,\n placeholder\n}) => (\n <div className=\"search__wrapper\">\n <input\n onKeyDown={handleKeyDown}\n ref={searchInputRef}\n placeholder={placeholder}\n type=\"text\"\n onChange={handleSearchTerm}\n value={searchTerm}\n />\n <span\n onClick={search}\n role=\"button\"\n className=\"icon-button icon-button--search icon-button--toggle\">\n <i className=\"material-icons\">search</i>\n </span>\n {close && (\n <div className=\"modal__close\">\n <i className=\"material-icons\" onClick={toggleSearchModal} role=\"button\">\n close\n </i>\n </div>\n )}\n </div>\n);\n\nSearchBar.propTypes = {\n close: PropTypes.bool,\n handleKeyDown: PropTypes.func.isRequired,\n searchInputRef: PropTypes.object,\n handleSearchTerm: PropTypes.func.isRequired,\n searchTerm: PropTypes.string,\n toggleSearchModal: PropTypes.func,\n search: PropTypes.func.isRequired,\n placeholder: PropTypes.string\n};\n\nSearchBar.defaultProps = {\n searchTerm: '',\n close: true,\n placeholder: 'Search...',\n toggleSearchModal: null,\n searchInputRef: null\n};\n\nexport default SearchBar;\n"],"mappings":"AAAA,OAAOA,
|
|
1
|
+
{"version":3,"file":"SearchBar.js","names":["React","PropTypes","SearchBar","handleKeyDown","searchInputRef","handleSearchTerm","searchTerm","toggleSearchModal","close","search","placeholder","propTypes","bool","func","isRequired","object","string","defaultProps"],"sources":["../../../../src/components/SearchAdmin/SearchBar/SearchBar.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\n\nconst SearchBar = ({\n handleKeyDown,\n searchInputRef,\n handleSearchTerm,\n searchTerm,\n toggleSearchModal,\n close,\n search,\n placeholder\n}) => (\n <div className=\"search__wrapper\">\n <input\n onKeyDown={handleKeyDown}\n ref={searchInputRef}\n placeholder={placeholder}\n type=\"text\"\n onChange={handleSearchTerm}\n value={searchTerm}\n />\n <span\n onClick={search}\n role=\"button\"\n className=\"icon-button icon-button--search icon-button--toggle\">\n <i className=\"material-icons\">search</i>\n </span>\n {close && (\n <div className=\"modal__close\">\n <i className=\"material-icons\" onClick={toggleSearchModal} role=\"button\">\n close\n </i>\n </div>\n )}\n </div>\n);\n\nSearchBar.propTypes = {\n close: PropTypes.bool,\n handleKeyDown: PropTypes.func.isRequired,\n searchInputRef: PropTypes.object,\n handleSearchTerm: PropTypes.func.isRequired,\n searchTerm: PropTypes.string,\n toggleSearchModal: PropTypes.func,\n search: PropTypes.func.isRequired,\n placeholder: PropTypes.string\n};\n\nSearchBar.defaultProps = {\n searchTerm: '',\n close: true,\n placeholder: 'Search...',\n toggleSearchModal: null,\n searchInputRef: null\n};\n\nexport default SearchBar;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAElC,MAAMC,SAAS,GAAG,CAAC;EACjBC,aAAa;EACbC,cAAc;EACdC,gBAAgB;EAChBC,UAAU;EACVC,iBAAiB;EACjBC,KAAK;EACLC,MAAM;EACNC;AACF,CAAC,kBACC;EAAK,SAAS,EAAC;AAAiB,gBAC9B;EACE,SAAS,EAAEP,aAAc;EACzB,GAAG,EAAEC,cAAe;EACpB,WAAW,EAAEM,WAAY;EACzB,IAAI,EAAC,MAAM;EACX,QAAQ,EAAEL,gBAAiB;EAC3B,KAAK,EAAEC;AAAW,EAClB,eACF;EACE,OAAO,EAAEG,MAAO;EAChB,IAAI,EAAC,QAAQ;EACb,SAAS,EAAC;AAAqD,gBAC/D;EAAG,SAAS,EAAC;AAAgB,YAAW,CACnC,EACND,KAAK,iBACJ;EAAK,SAAS,EAAC;AAAc,gBAC3B;EAAG,SAAS,EAAC,gBAAgB;EAAC,OAAO,EAAED,iBAAkB;EAAC,IAAI,EAAC;AAAQ,WAEnE,CAEP,CAEJ;AAEDL,SAAS,CAACS,SAAS,GAAG;EACpBH,KAAK,EAAEP,SAAS,CAACW,IAAI;EACrBT,aAAa,EAAEF,SAAS,CAACY,IAAI,CAACC,UAAU;EACxCV,cAAc,EAAEH,SAAS,CAACc,MAAM;EAChCV,gBAAgB,EAAEJ,SAAS,CAACY,IAAI,CAACC,UAAU;EAC3CR,UAAU,EAAEL,SAAS,CAACe,MAAM;EAC5BT,iBAAiB,EAAEN,SAAS,CAACY,IAAI;EACjCJ,MAAM,EAAER,SAAS,CAACY,IAAI,CAACC,UAAU;EACjCJ,WAAW,EAAET,SAAS,CAACe;AACzB,CAAC;AAEDd,SAAS,CAACe,YAAY,GAAG;EACvBX,UAAU,EAAE,EAAE;EACdE,KAAK,EAAE,IAAI;EACXE,WAAW,EAAE,WAAW;EACxBH,iBAAiB,EAAE,IAAI;EACvBH,cAAc,EAAE;AAClB,CAAC;AAED,eAAeF,SAAS"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["SearchBar"],"sources":["../../../../src/components/SearchAdmin/SearchBar/index.js"],"sourcesContent":["import SearchBar from './SearchBar';\n\nexport default SearchBar;\n"],"mappings":"AAAA,OAAOA,
|
|
1
|
+
{"version":3,"file":"index.js","names":["SearchBar"],"sources":["../../../../src/components/SearchAdmin/SearchBar/index.js"],"sourcesContent":["import SearchBar from './SearchBar';\n\nexport default SearchBar;\n"],"mappings":"AAAA,OAAOA,SAAS,MAAM,aAAa;AAEnC,eAAeA,SAAS"}
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
/* eslint-disable jsx-a11y/anchor-is-valid */
|
|
2
|
-
|
|
3
2
|
/* eslint-disable jsx-a11y/no-static-element-interactions */
|
|
4
3
|
import React, { useState } from 'react';
|
|
5
4
|
import PropTypes from 'prop-types';
|
|
6
5
|
import VirtualList from 'react-tiny-virtual-list';
|
|
7
6
|
import { withRouter } from 'react-router-dom';
|
|
8
7
|
import { SEARCH_RESULTS_OVER_SCAN_BUFFER, SEARCH_RESULTS_ELEMETS_HEIGHT_ABOVE_LIST, SEARCH_RESULTS_ITEM_SIZE, FILE } from '../../../constants';
|
|
9
|
-
|
|
10
8
|
const SearchResults = ({
|
|
11
9
|
currentValue,
|
|
12
10
|
loading,
|
|
@@ -18,13 +16,11 @@ const SearchResults = ({
|
|
|
18
16
|
}) => {
|
|
19
17
|
const [verifiedRanges, setVerifiedRanges] = useState([]);
|
|
20
18
|
const [currentIndex, setCurrentIndex] = useState(0);
|
|
21
|
-
|
|
22
19
|
const handleRenderedItems = async ({
|
|
23
20
|
startIndex
|
|
24
21
|
}) => {
|
|
25
22
|
const rowsLength = results.length;
|
|
26
23
|
const loadIndex = Math.floor(rowsLength / 2) - SEARCH_RESULTS_OVER_SCAN_BUFFER;
|
|
27
|
-
|
|
28
24
|
if (loadIndex > 0 && loadIndex < startIndex && !verifiedRanges.includes(loadIndex)) {
|
|
29
25
|
setQueryParams({
|
|
30
26
|
value: currentValue,
|
|
@@ -34,12 +30,10 @@ const SearchResults = ({
|
|
|
34
30
|
setCurrentIndex(startIndex + SEARCH_RESULTS_OVER_SCAN_BUFFER);
|
|
35
31
|
}
|
|
36
32
|
};
|
|
37
|
-
|
|
38
33
|
const getNavigationRoute = ({
|
|
39
34
|
id,
|
|
40
35
|
docType
|
|
41
36
|
}) => docType === FILE ? `/media/edit/${id}` : `/data-listing/${docType}/update/${id}`;
|
|
42
|
-
|
|
43
37
|
const navigate = ({
|
|
44
38
|
id,
|
|
45
39
|
docType
|
|
@@ -50,7 +44,6 @@ const SearchResults = ({
|
|
|
50
44
|
}));
|
|
51
45
|
closeModal();
|
|
52
46
|
};
|
|
53
|
-
|
|
54
47
|
const getDateFormat = date => {
|
|
55
48
|
const newDate = new Date(date);
|
|
56
49
|
const day = `0${newDate.getDate()}`.slice(-2);
|
|
@@ -58,12 +51,13 @@ const SearchResults = ({
|
|
|
58
51
|
const year = String(newDate.getYear()).slice(-2);
|
|
59
52
|
return `${day}.${month}.${year}`;
|
|
60
53
|
};
|
|
61
|
-
|
|
62
54
|
return /*#__PURE__*/React.createElement(React.Fragment, null, loading && /*#__PURE__*/React.createElement("span", null, "Loading..."), /*#__PURE__*/React.createElement("div", {
|
|
63
55
|
className: "modal__content modal__content--search"
|
|
64
56
|
}, /*#__PURE__*/React.createElement("div", {
|
|
65
57
|
className: "header header--list"
|
|
66
|
-
}, /*#__PURE__*/React.createElement("h2",
|
|
58
|
+
}, /*#__PURE__*/React.createElement("h2", {
|
|
59
|
+
className: "header--list--results"
|
|
60
|
+
}, "About ", /*#__PURE__*/React.createElement("b", null, total), " search keywords results")), /*#__PURE__*/React.createElement(VirtualList, {
|
|
67
61
|
width: "100%",
|
|
68
62
|
height: window.innerHeight - SEARCH_RESULTS_ELEMETS_HEIGHT_ABOVE_LIST,
|
|
69
63
|
itemCount: results.length,
|
|
@@ -79,9 +73,15 @@ const SearchResults = ({
|
|
|
79
73
|
id,
|
|
80
74
|
docType,
|
|
81
75
|
updated,
|
|
82
|
-
name
|
|
76
|
+
name,
|
|
77
|
+
entityIdentifier,
|
|
78
|
+
published,
|
|
79
|
+
created,
|
|
80
|
+
status
|
|
83
81
|
} = results[index];
|
|
84
82
|
const updatedDate = updated ? getDateFormat(updated) : null;
|
|
83
|
+
const createdDate = created ? getDateFormat(created) : null;
|
|
84
|
+
const publishedDate = published ? getDateFormat(published) : null;
|
|
85
85
|
return /*#__PURE__*/React.createElement("div", {
|
|
86
86
|
key: index,
|
|
87
87
|
style: style,
|
|
@@ -91,8 +91,8 @@ const SearchResults = ({
|
|
|
91
91
|
}, /*#__PURE__*/React.createElement("div", {
|
|
92
92
|
className: "list__item-row list__item-row--result"
|
|
93
93
|
}, /*#__PURE__*/React.createElement("span", {
|
|
94
|
-
className: "
|
|
95
|
-
},
|
|
94
|
+
className: "list__item-identifier"
|
|
95
|
+
}, entityIdentifier), /*#__PURE__*/React.createElement("a", {
|
|
96
96
|
href: getNavigationRoute({
|
|
97
97
|
id,
|
|
98
98
|
docType
|
|
@@ -101,12 +101,15 @@ const SearchResults = ({
|
|
|
101
101
|
id,
|
|
102
102
|
docType
|
|
103
103
|
}),
|
|
104
|
-
className: "list__item-
|
|
105
|
-
}, name)
|
|
104
|
+
className: "list__item-link"
|
|
105
|
+
}, name), /*#__PURE__*/React.createElement("div", {
|
|
106
|
+
className: "list__item-dates"
|
|
107
|
+
}, publishedDate && /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement("b", null, "Published: "), publishedDate), /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement("b", null, "Created: "), createdDate), /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement("b", null, "Updated: "), updatedDate)), /*#__PURE__*/React.createElement("div", {
|
|
108
|
+
className: "list__item-status"
|
|
109
|
+
}, status && /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement("b", null, "Status: "), status)))));
|
|
106
110
|
}
|
|
107
111
|
})));
|
|
108
112
|
};
|
|
109
|
-
|
|
110
113
|
SearchResults.propTypes = {
|
|
111
114
|
loading: PropTypes.bool.isRequired,
|
|
112
115
|
results: PropTypes.array.isRequired,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchResults.js","names":["React","useState","PropTypes","VirtualList","withRouter","SEARCH_RESULTS_OVER_SCAN_BUFFER","SEARCH_RESULTS_ELEMETS_HEIGHT_ABOVE_LIST","SEARCH_RESULTS_ITEM_SIZE","FILE","SearchResults","currentValue","loading","results","total","setQueryParams","closeModal","history","verifiedRanges","setVerifiedRanges","currentIndex","setCurrentIndex","handleRenderedItems","startIndex","rowsLength","length","loadIndex","Math","floor","includes","value","offset","getNavigationRoute","id","docType","navigate","push","getDateFormat","date","newDate","Date","day","getDate","slice","month","getMonth","year","String","getYear","window","innerHeight","index","style","updated","name","updatedDate","propTypes","bool","isRequired","array","number","func","object","string"],"sources":["../../../../src/components/SearchAdmin/SearchResults/SearchResults.js"],"sourcesContent":["/* eslint-disable jsx-a11y/anchor-is-valid */\n/* eslint-disable jsx-a11y/no-static-element-interactions */\nimport React, { useState } from 'react';\nimport PropTypes from 'prop-types';\nimport VirtualList from 'react-tiny-virtual-list';\nimport { withRouter } from 'react-router-dom';\nimport {\n SEARCH_RESULTS_OVER_SCAN_BUFFER,\n SEARCH_RESULTS_ELEMETS_HEIGHT_ABOVE_LIST,\n SEARCH_RESULTS_ITEM_SIZE,\n FILE\n} from '../../../constants';\n\nconst SearchResults = ({\n currentValue,\n loading,\n results,\n total,\n setQueryParams,\n closeModal,\n history\n}) => {\n const [verifiedRanges, setVerifiedRanges] = useState([]);\n const [currentIndex, setCurrentIndex] = useState(0);\n\n const handleRenderedItems = async ({ startIndex }) => {\n const rowsLength = results.length;\n const loadIndex = Math.floor(rowsLength / 2) - SEARCH_RESULTS_OVER_SCAN_BUFFER;\n if (loadIndex > 0 && loadIndex < startIndex && !verifiedRanges.includes(loadIndex)) {\n setQueryParams({ value: currentValue, offset: results.length });\n setVerifiedRanges([...verifiedRanges, loadIndex]);\n setCurrentIndex(startIndex + SEARCH_RESULTS_OVER_SCAN_BUFFER);\n }\n };\n\n const getNavigationRoute = ({ id, docType }) =>\n docType === FILE ? `/media/edit/${id}` : `/data-listing/${docType}/update/${id}`;\n\n const navigate = ({ id, docType }) => {\n history.push(getNavigationRoute({ id, docType }));\n closeModal();\n };\n\n const getDateFormat = date => {\n const newDate = new Date(date);\n const day = `0${newDate.getDate()}`.slice(-2);\n const month = `0${newDate.getMonth() + 1}`.slice(-2);\n const year = String(newDate.getYear()).slice(-2);\n return `${day}.${month}.${year}`;\n };\n\n return (\n <>\n {loading && <span>Loading...</span>}\n <div className=\"modal__content modal__content--search\">\n <div className=\"header header--list\">\n <h2>{total} results</h2>\n </div>\n <VirtualList\n width=\"100%\"\n height={window.innerHeight - SEARCH_RESULTS_ELEMETS_HEIGHT_ABOVE_LIST}\n itemCount={results.length}\n itemSize={SEARCH_RESULTS_ITEM_SIZE}\n overscanCount={SEARCH_RESULTS_OVER_SCAN_BUFFER}\n scrollToIndex={currentIndex}\n onItemsRendered={handleRenderedItems}\n renderItem={({ index, style }) => {\n const {
|
|
1
|
+
{"version":3,"file":"SearchResults.js","names":["React","useState","PropTypes","VirtualList","withRouter","SEARCH_RESULTS_OVER_SCAN_BUFFER","SEARCH_RESULTS_ELEMETS_HEIGHT_ABOVE_LIST","SEARCH_RESULTS_ITEM_SIZE","FILE","SearchResults","currentValue","loading","results","total","setQueryParams","closeModal","history","verifiedRanges","setVerifiedRanges","currentIndex","setCurrentIndex","handleRenderedItems","startIndex","rowsLength","length","loadIndex","Math","floor","includes","value","offset","getNavigationRoute","id","docType","navigate","push","getDateFormat","date","newDate","Date","day","getDate","slice","month","getMonth","year","String","getYear","window","innerHeight","index","style","updated","name","entityIdentifier","published","created","status","updatedDate","createdDate","publishedDate","propTypes","bool","isRequired","array","number","func","object","string"],"sources":["../../../../src/components/SearchAdmin/SearchResults/SearchResults.js"],"sourcesContent":["/* eslint-disable jsx-a11y/anchor-is-valid */\n/* eslint-disable jsx-a11y/no-static-element-interactions */\nimport React, { useState } from 'react';\nimport PropTypes from 'prop-types';\nimport VirtualList from 'react-tiny-virtual-list';\nimport { withRouter } from 'react-router-dom';\nimport {\n SEARCH_RESULTS_OVER_SCAN_BUFFER,\n SEARCH_RESULTS_ELEMETS_HEIGHT_ABOVE_LIST,\n SEARCH_RESULTS_ITEM_SIZE,\n FILE\n} from '../../../constants';\n\nconst SearchResults = ({\n currentValue,\n loading,\n results,\n total,\n setQueryParams,\n closeModal,\n history\n}) => {\n const [verifiedRanges, setVerifiedRanges] = useState([]);\n const [currentIndex, setCurrentIndex] = useState(0);\n\n const handleRenderedItems = async ({ startIndex }) => {\n const rowsLength = results.length;\n const loadIndex = Math.floor(rowsLength / 2) - SEARCH_RESULTS_OVER_SCAN_BUFFER;\n if (loadIndex > 0 && loadIndex < startIndex && !verifiedRanges.includes(loadIndex)) {\n setQueryParams({ value: currentValue, offset: results.length });\n setVerifiedRanges([...verifiedRanges, loadIndex]);\n setCurrentIndex(startIndex + SEARCH_RESULTS_OVER_SCAN_BUFFER);\n }\n };\n\n const getNavigationRoute = ({ id, docType }) =>\n docType === FILE ? `/media/edit/${id}` : `/data-listing/${docType}/update/${id}`;\n\n const navigate = ({ id, docType }) => {\n history.push(getNavigationRoute({ id, docType }));\n closeModal();\n };\n\n const getDateFormat = date => {\n const newDate = new Date(date);\n const day = `0${newDate.getDate()}`.slice(-2);\n const month = `0${newDate.getMonth() + 1}`.slice(-2);\n const year = String(newDate.getYear()).slice(-2);\n return `${day}.${month}.${year}`;\n };\n\n return (\n <>\n {loading && <span>Loading...</span>}\n <div className=\"modal__content modal__content--search\">\n <div className=\"header header--list\">\n <h2 className=\"header--list--results\">\n About <b>{total}</b> search keywords results\n </h2>\n </div>\n <VirtualList\n width=\"100%\"\n height={window.innerHeight - SEARCH_RESULTS_ELEMETS_HEIGHT_ABOVE_LIST}\n itemCount={results.length}\n itemSize={SEARCH_RESULTS_ITEM_SIZE}\n overscanCount={SEARCH_RESULTS_OVER_SCAN_BUFFER}\n scrollToIndex={currentIndex}\n onItemsRendered={handleRenderedItems}\n renderItem={({ index, style }) => {\n const {\n id,\n docType,\n updated,\n name,\n entityIdentifier,\n published,\n created,\n status\n } = results[index];\n const updatedDate = updated ? getDateFormat(updated) : null;\n const createdDate = created ? getDateFormat(created) : null;\n const publishedDate = published ? getDateFormat(published) : null;\n return (\n <div key={index} style={style} className=\"list__item--resultWrapper\">\n <div className=\"list__item list__item--result\">\n <div className=\"list__item-row list__item-row--result\">\n <span className=\"list__item-identifier\">{entityIdentifier}</span>\n <a\n href={getNavigationRoute({\n id,\n docType\n })}\n onClick={() =>\n navigate({\n id,\n docType\n })\n }\n className=\"list__item-link\">\n {name}\n </a>\n\n <div className=\"list__item-dates\">\n {publishedDate && (\n <span>\n <b>Published: </b>\n {publishedDate}\n </span>\n )}\n <span>\n <b>Created: </b>\n {createdDate}\n </span>\n <span>\n <b>Updated: </b>\n {updatedDate}\n </span>\n </div>\n <div className=\"list__item-status\">\n {status && (\n <span>\n <b>Status: </b>\n {status}\n </span>\n )}\n </div>\n </div>\n </div>\n </div>\n );\n }}\n />\n </div>\n </>\n );\n};\n\nSearchResults.propTypes = {\n loading: PropTypes.bool.isRequired,\n results: PropTypes.array.isRequired,\n total: PropTypes.number.isRequired,\n setQueryParams: PropTypes.func.isRequired,\n closeModal: PropTypes.func.isRequired,\n history: PropTypes.object.isRequired,\n currentValue: PropTypes.string.isRequired\n};\n\nexport default withRouter(SearchResults);\n"],"mappings":"AAAA;AACA;AACA,OAAOA,KAAK,IAAIC,QAAQ,QAAQ,OAAO;AACvC,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,WAAW,MAAM,yBAAyB;AACjD,SAASC,UAAU,QAAQ,kBAAkB;AAC7C,SACEC,+BAA+B,EAC/BC,wCAAwC,EACxCC,wBAAwB,EACxBC,IAAI,QACC,oBAAoB;AAE3B,MAAMC,aAAa,GAAG,CAAC;EACrBC,YAAY;EACZC,OAAO;EACPC,OAAO;EACPC,KAAK;EACLC,cAAc;EACdC,UAAU;EACVC;AACF,CAAC,KAAK;EACJ,MAAM,CAACC,cAAc,EAAEC,iBAAiB,CAAC,GAAGjB,QAAQ,CAAC,EAAE,CAAC;EACxD,MAAM,CAACkB,YAAY,EAAEC,eAAe,CAAC,GAAGnB,QAAQ,CAAC,CAAC,CAAC;EAEnD,MAAMoB,mBAAmB,GAAG,OAAO;IAAEC;EAAW,CAAC,KAAK;IACpD,MAAMC,UAAU,GAAGX,OAAO,CAACY,MAAM;IACjC,MAAMC,SAAS,GAAGC,IAAI,CAACC,KAAK,CAACJ,UAAU,GAAG,CAAC,CAAC,GAAGlB,+BA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BoB,IAAI,CACH,eAEJ;QAAK,SAAS,EAAC;MAAkB,GAC9BO,aAAa,iBACZ,+CACE,6CAAkB,EACjBA,aAAa,CAEjB,eACD,+CACE,2CAAgB,EACfD,WAAW,CACP,eACP,+CACE,2CAAgB,EACfD,WAAW,CACP,CACH,eACN;QAAK,SAAS,EAAC;MAAmB,GAC/BD,MAAM,iBACL,+CACE,0CAAe,EACdA,MAAM,CAEV,CACG,CACF,CACF,CACF;IAEV;EAAE,EACF,CACE,CACL;AAEP,CAAC;AAEDhD,aAAa,CAACoD,SAAS,GAAG;EACxBlD,OAAO,EAAET,SAAS,CAAC4D,IAAI,CAACC,UAAU;EAClCnD,OAAO,EAAEV,SAAS,CAAC8D,KAAK,CAACD,UAAU;EACnClD,KAAK,EAAEX,SAAS,CAAC+D,MAAM,CAACF,UAAU;EAClCjD,cAAc,EAAEZ,SAAS,CAACgE,IAAI,CAACH,UAAU;EACzChD,UAAU,EAAEb,SAAS,CAACgE,IAAI,CAACH,UAAU;EACrC/C,OAAO,EAAEd,SAAS,CAACiE,MAAM,CAACJ,UAAU;EACpCrD,YAAY,EAAER,SAAS,CAACkE,MAAM,CAACL;AACjC,CAAC;AAED,eAAe3D,UAAU,CAACK,aAAa,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["SearchResults"],"sources":["../../../../src/components/SearchAdmin/SearchResults/index.js"],"sourcesContent":["import SearchResults from './SearchResults';\n\nexport default SearchResults;\n"],"mappings":"AAAA,OAAOA,
|
|
1
|
+
{"version":3,"file":"index.js","names":["SearchResults"],"sources":["../../../../src/components/SearchAdmin/SearchResults/index.js"],"sourcesContent":["import SearchResults from './SearchResults';\n\nexport default SearchResults;\n"],"mappings":"AAAA,OAAOA,aAAa,MAAM,iBAAiB;AAE3C,eAAeA,aAAa"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
|
|
4
3
|
const TriggerModal = ({
|
|
5
4
|
toggleSearchModal
|
|
6
5
|
}) => /*#__PURE__*/React.createElement("span", {
|
|
@@ -8,7 +7,6 @@ const TriggerModal = ({
|
|
|
8
7
|
className: "material-icons searchModal-search-icon",
|
|
9
8
|
onClick: toggleSearchModal
|
|
10
9
|
}, "search");
|
|
11
|
-
|
|
12
10
|
TriggerModal.propTypes = {
|
|
13
11
|
toggleSearchModal: PropTypes.func.isRequired
|
|
14
12
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TriggerModal.js","names":["React","PropTypes","TriggerModal","toggleSearchModal","propTypes","func","isRequired"],"sources":["../../../../src/components/SearchAdmin/TriggerModal/TriggerModal.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\n\nconst TriggerModal = ({ toggleSearchModal }) => (\n <span\n role=\"button\"\n className=\"material-icons searchModal-search-icon\"\n onClick={toggleSearchModal}>\n search\n </span>\n);\n\nTriggerModal.propTypes = {\n toggleSearchModal: PropTypes.func.isRequired\n};\n\nexport default TriggerModal;\n"],"mappings":"AAAA,OAAOA,
|
|
1
|
+
{"version":3,"file":"TriggerModal.js","names":["React","PropTypes","TriggerModal","toggleSearchModal","propTypes","func","isRequired"],"sources":["../../../../src/components/SearchAdmin/TriggerModal/TriggerModal.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\n\nconst TriggerModal = ({ toggleSearchModal }) => (\n <span\n role=\"button\"\n className=\"material-icons searchModal-search-icon\"\n onClick={toggleSearchModal}>\n search\n </span>\n);\n\nTriggerModal.propTypes = {\n toggleSearchModal: PropTypes.func.isRequired\n};\n\nexport default TriggerModal;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAElC,MAAMC,YAAY,GAAG,CAAC;EAAEC;AAAkB,CAAC,kBACzC;EACE,IAAI,EAAC,QAAQ;EACb,SAAS,EAAC,wCAAwC;EAClD,OAAO,EAAEA;AAAkB,YAG9B;AAEDD,YAAY,CAACE,SAAS,GAAG;EACvBD,iBAAiB,EAAEF,SAAS,CAACI,IAAI,CAACC;AACpC,CAAC;AAED,eAAeJ,YAAY"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["TriggerModal"],"sources":["../../../../src/components/SearchAdmin/TriggerModal/index.js"],"sourcesContent":["import TriggerModal from './TriggerModal';\n\nexport default TriggerModal;\n"],"mappings":"AAAA,OAAOA,
|
|
1
|
+
{"version":3,"file":"index.js","names":["TriggerModal"],"sources":["../../../../src/components/SearchAdmin/TriggerModal/index.js"],"sourcesContent":["import TriggerModal from './TriggerModal';\n\nexport default TriggerModal;\n"],"mappings":"AAAA,OAAOA,YAAY,MAAM,gBAAgB;AAEzC,eAAeA,YAAY"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["SearchAdmin"],"sources":["../../../src/components/SearchAdmin/index.js"],"sourcesContent":["import SearchAdmin from './SearchAdmin';\n\nexport default SearchAdmin;\n"],"mappings":"AAAA,OAAOA,
|
|
1
|
+
{"version":3,"file":"index.js","names":["SearchAdmin"],"sources":["../../../src/components/SearchAdmin/index.js"],"sourcesContent":["import SearchAdmin from './SearchAdmin';\n\nexport default SearchAdmin;\n"],"mappings":"AAAA,OAAOA,WAAW,MAAM,eAAe;AAEvC,eAAeA,WAAW"}
|
|
@@ -5,7 +5,6 @@ import { MdClose, MdSearch } from 'react-icons/md';
|
|
|
5
5
|
import { useDebounce } from '@blaze-react/utils/lib/customHooks';
|
|
6
6
|
import useSearchResults from '../useSearchResults';
|
|
7
7
|
import { SEARCH_PUBLISHED, DEFAULT_RESULTS_KEYS, SEARCH_BUTTON } from '../../constants';
|
|
8
|
-
|
|
9
8
|
const SearchPublishedContent = ({
|
|
10
9
|
entities,
|
|
11
10
|
children,
|
|
@@ -38,13 +37,15 @@ const SearchPublishedContent = ({
|
|
|
38
37
|
if (isSearchBarOpen !== displaySearchBar) {
|
|
39
38
|
setDisplaySearchBar(isSearchBarOpen);
|
|
40
39
|
}
|
|
41
|
-
},
|
|
40
|
+
},
|
|
41
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
42
42
|
[isSearchBarOpen]);
|
|
43
43
|
useEffect(() => {
|
|
44
44
|
if (inputRef && inputRef.current && displaySearchBar) {
|
|
45
45
|
inputRef.current.focus();
|
|
46
46
|
}
|
|
47
|
-
},
|
|
47
|
+
},
|
|
48
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
48
49
|
[displaySearchBar]);
|
|
49
50
|
useEffect(() => {
|
|
50
51
|
if (debouncedSearchTerm && debouncedSearchTerm !== previousSearchTerm) {
|
|
@@ -54,7 +55,6 @@ const SearchPublishedContent = ({
|
|
|
54
55
|
setPreviousSearchTerm(debouncedSearchTerm);
|
|
55
56
|
}
|
|
56
57
|
}, [debouncedSearchTerm, previousSearchTerm, setQueryParams]);
|
|
57
|
-
|
|
58
58
|
const handleOnChange = ({
|
|
59
59
|
target: {
|
|
60
60
|
value = ''
|
|
@@ -63,26 +63,21 @@ const SearchPublishedContent = ({
|
|
|
63
63
|
onChange(value);
|
|
64
64
|
setSearchTerm(value);
|
|
65
65
|
};
|
|
66
|
-
|
|
67
66
|
const handleKeyPress = event => {
|
|
68
67
|
const onEnter = event.key === 'Enter';
|
|
69
68
|
onEnter && onEnterPress();
|
|
70
69
|
};
|
|
71
|
-
|
|
72
70
|
const handleSearchBar = () => {
|
|
73
71
|
const voidSearchTerm = '';
|
|
74
72
|
displaySearchBar && setSearchTerm(voidSearchTerm);
|
|
75
73
|
handleOnChange({
|
|
76
74
|
value: voidSearchTerm
|
|
77
75
|
});
|
|
78
|
-
|
|
79
76
|
if (isSearchBarOpen !== null) {
|
|
80
77
|
getIsOpenSearchBar(!displaySearchBar);
|
|
81
78
|
}
|
|
82
|
-
|
|
83
79
|
setDisplaySearchBar(!displaySearchBar);
|
|
84
80
|
};
|
|
85
|
-
|
|
86
81
|
const searchWrapperClassname = classnames('search__wrapper', {
|
|
87
82
|
'search__wrapper--toggle-display': displaySearchBar,
|
|
88
83
|
'search__wrapper--toggle': !displaySearchBar
|
|
@@ -120,7 +115,6 @@ const SearchPublishedContent = ({
|
|
|
120
115
|
loading
|
|
121
116
|
})));
|
|
122
117
|
};
|
|
123
|
-
|
|
124
118
|
SearchPublishedContent.propTypes = {
|
|
125
119
|
entities: PropTypes.array,
|
|
126
120
|
children: PropTypes.func.isRequired,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchPublishedContent.js","names":["React","useState","useEffect","classnames","PropTypes","MdClose","MdSearch","useDebounce","useSearchResults","SEARCH_PUBLISHED","DEFAULT_RESULTS_KEYS","SEARCH_BUTTON","SearchPublishedContent","entities","children","resultKeys","getIsOpenSearchBar","SearchIcon","CloseIcon","className","onChange","placeholder","onEnterPress","inputRef","isSearchBarOpen","fields","displaySearchBar","setDisplaySearchBar","searchTerm","setSearchTerm","previousSearchTerm","setPreviousSearchTerm","debouncedSearchTerm","loading","results","setQueryParams","queryKey","current","focus","value","handleOnChange","target","handleKeyPress","event","onEnter","key","handleSearchBar","voidSearchTerm","searchWrapperClassname","triggerClassname","open","length","propTypes","array","func","isRequired","string","object","bool","defaultProps","state"],"sources":["../../../src/components/SearchPublishedContent/SearchPublishedContent.js"],"sourcesContent":["import React, { useState, useEffect } from 'react';\nimport classnames from 'classnames';\nimport PropTypes from 'prop-types';\nimport { MdClose, MdSearch } from 'react-icons/md';\nimport { useDebounce } from '@blaze-react/utils/lib/customHooks';\nimport useSearchResults from '../useSearchResults';\nimport { SEARCH_PUBLISHED, DEFAULT_RESULTS_KEYS, SEARCH_BUTTON } from '../../constants';\n\nconst SearchPublishedContent = ({\n entities,\n children,\n resultKeys,\n getIsOpenSearchBar,\n SearchIcon,\n CloseIcon,\n className,\n onChange,\n placeholder,\n onEnterPress,\n inputRef,\n isSearchBarOpen,\n fields\n}) => {\n const [displaySearchBar, setDisplaySearchBar] = useState(isSearchBarOpen);\n const [searchTerm, setSearchTerm] = useState('');\n const [previousSearchTerm, setPreviousSearchTerm] = useState(null);\n const debouncedSearchTerm = useDebounce(searchTerm, 500);\n\n const [{ loading, results }, setQueryParams] = useSearchResults({\n queryKey: SEARCH_PUBLISHED,\n resultKeys,\n entities,\n fields\n });\n\n useEffect(\n () => {\n if (isSearchBarOpen !== displaySearchBar) {\n setDisplaySearchBar(isSearchBarOpen);\n }\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [isSearchBarOpen]\n );\n\n useEffect(\n () => {\n if (inputRef && inputRef.current && displaySearchBar) {\n inputRef.current.focus();\n }\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [displaySearchBar]\n );\n\n useEffect(\n () => {\n if (debouncedSearchTerm && debouncedSearchTerm !== previousSearchTerm) {\n setQueryParams({ value: `${debouncedSearchTerm}*` });\n setPreviousSearchTerm(debouncedSearchTerm);\n }\n },\n [debouncedSearchTerm, previousSearchTerm, setQueryParams]\n );\n\n const handleOnChange = ({ target: { value = '' } = {} }) => {\n onChange(value);\n setSearchTerm(value);\n };\n\n const handleKeyPress = event => {\n const onEnter = event.key === 'Enter';\n onEnter && onEnterPress();\n };\n\n const handleSearchBar = () => {\n const voidSearchTerm = '';\n displaySearchBar && setSearchTerm(voidSearchTerm);\n handleOnChange({ value: voidSearchTerm });\n if (isSearchBarOpen !== null) {\n getIsOpenSearchBar(!displaySearchBar);\n }\n setDisplaySearchBar(!displaySearchBar);\n };\n\n const searchWrapperClassname = classnames('search__wrapper', {\n 'search__wrapper--toggle-display': displaySearchBar,\n 'search__wrapper--toggle': !displaySearchBar\n });\n\n const triggerClassname = classnames('search__icon', {\n open: displaySearchBar\n });\n\n return (\n <div className={`search-wrapper ${className}`}>\n <div className=\"search search--header search--toggle\">\n <div className={searchWrapperClassname}>\n <input\n data-testid=\"search-input\"\n onKeyPress={handleKeyPress}\n placeholder={placeholder}\n type=\"text\"\n onChange={handleOnChange}\n value={searchTerm}\n ref={inputRef}\n />\n <button type=\"button\" className=\"icon-button icon-button--search icon-button--toggle\">\n <SearchIcon />\n </button>\n </div>\n <div\n role=\"button\"\n className={triggerClassname}\n onClick={handleSearchBar}\n id={SEARCH_BUTTON}\n title={SEARCH_BUTTON}>\n {!displaySearchBar ? <SearchIcon /> : <CloseIcon />}\n </div>\n </div>\n <div className=\"search-modal\">\n {children({ results: results.length && searchTerm ? results : [], loading })}\n </div>\n </div>\n );\n};\n\nSearchPublishedContent.propTypes = {\n entities: PropTypes.array,\n children: PropTypes.func.isRequired,\n resultKeys: PropTypes.string,\n getIsOpenSearchBar: PropTypes.func,\n SearchIcon: PropTypes.func,\n CloseIcon: PropTypes.func,\n onChange: PropTypes.func,\n onEnterPress: PropTypes.func,\n className: PropTypes.string,\n placeholder: PropTypes.string,\n inputRef: PropTypes.object,\n isSearchBarOpen: PropTypes.bool,\n fields: PropTypes.array\n};\n\nSearchPublishedContent.defaultProps = {\n entities: ['published_page'],\n placeholder: '',\n resultKeys: DEFAULT_RESULTS_KEYS,\n onChange: () => {},\n onEnterPress: () => {},\n getIsOpenSearchBar: state => state,\n SearchIcon: () => (\n <i>\n <MdSearch />\n </i>\n ),\n CloseIcon: () => (\n <i>\n <MdClose />\n </i>\n ),\n className: '',\n inputRef: null,\n isSearchBarOpen: null,\n fields: []\n};\n\nexport default SearchPublishedContent;\n"],"mappings":"AAAA,OAAOA,
|
|
1
|
+
{"version":3,"file":"SearchPublishedContent.js","names":["React","useState","useEffect","classnames","PropTypes","MdClose","MdSearch","useDebounce","useSearchResults","SEARCH_PUBLISHED","DEFAULT_RESULTS_KEYS","SEARCH_BUTTON","SearchPublishedContent","entities","children","resultKeys","getIsOpenSearchBar","SearchIcon","CloseIcon","className","onChange","placeholder","onEnterPress","inputRef","isSearchBarOpen","fields","displaySearchBar","setDisplaySearchBar","searchTerm","setSearchTerm","previousSearchTerm","setPreviousSearchTerm","debouncedSearchTerm","loading","results","setQueryParams","queryKey","current","focus","value","handleOnChange","target","handleKeyPress","event","onEnter","key","handleSearchBar","voidSearchTerm","searchWrapperClassname","triggerClassname","open","length","propTypes","array","func","isRequired","string","object","bool","defaultProps","state"],"sources":["../../../src/components/SearchPublishedContent/SearchPublishedContent.js"],"sourcesContent":["import React, { useState, useEffect } from 'react';\nimport classnames from 'classnames';\nimport PropTypes from 'prop-types';\nimport { MdClose, MdSearch } from 'react-icons/md';\nimport { useDebounce } from '@blaze-react/utils/lib/customHooks';\nimport useSearchResults from '../useSearchResults';\nimport { SEARCH_PUBLISHED, DEFAULT_RESULTS_KEYS, SEARCH_BUTTON } from '../../constants';\n\nconst SearchPublishedContent = ({\n entities,\n children,\n resultKeys,\n getIsOpenSearchBar,\n SearchIcon,\n CloseIcon,\n className,\n onChange,\n placeholder,\n onEnterPress,\n inputRef,\n isSearchBarOpen,\n fields\n}) => {\n const [displaySearchBar, setDisplaySearchBar] = useState(isSearchBarOpen);\n const [searchTerm, setSearchTerm] = useState('');\n const [previousSearchTerm, setPreviousSearchTerm] = useState(null);\n const debouncedSearchTerm = useDebounce(searchTerm, 500);\n\n const [{ loading, results }, setQueryParams] = useSearchResults({\n queryKey: SEARCH_PUBLISHED,\n resultKeys,\n entities,\n fields\n });\n\n useEffect(\n () => {\n if (isSearchBarOpen !== displaySearchBar) {\n setDisplaySearchBar(isSearchBarOpen);\n }\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [isSearchBarOpen]\n );\n\n useEffect(\n () => {\n if (inputRef && inputRef.current && displaySearchBar) {\n inputRef.current.focus();\n }\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [displaySearchBar]\n );\n\n useEffect(\n () => {\n if (debouncedSearchTerm && debouncedSearchTerm !== previousSearchTerm) {\n setQueryParams({ value: `${debouncedSearchTerm}*` });\n setPreviousSearchTerm(debouncedSearchTerm);\n }\n },\n [debouncedSearchTerm, previousSearchTerm, setQueryParams]\n );\n\n const handleOnChange = ({ target: { value = '' } = {} }) => {\n onChange(value);\n setSearchTerm(value);\n };\n\n const handleKeyPress = event => {\n const onEnter = event.key === 'Enter';\n onEnter && onEnterPress();\n };\n\n const handleSearchBar = () => {\n const voidSearchTerm = '';\n displaySearchBar && setSearchTerm(voidSearchTerm);\n handleOnChange({ value: voidSearchTerm });\n if (isSearchBarOpen !== null) {\n getIsOpenSearchBar(!displaySearchBar);\n }\n setDisplaySearchBar(!displaySearchBar);\n };\n\n const searchWrapperClassname = classnames('search__wrapper', {\n 'search__wrapper--toggle-display': displaySearchBar,\n 'search__wrapper--toggle': !displaySearchBar\n });\n\n const triggerClassname = classnames('search__icon', {\n open: displaySearchBar\n });\n\n return (\n <div className={`search-wrapper ${className}`}>\n <div className=\"search search--header search--toggle\">\n <div className={searchWrapperClassname}>\n <input\n data-testid=\"search-input\"\n onKeyPress={handleKeyPress}\n placeholder={placeholder}\n type=\"text\"\n onChange={handleOnChange}\n value={searchTerm}\n ref={inputRef}\n />\n <button type=\"button\" className=\"icon-button icon-button--search icon-button--toggle\">\n <SearchIcon />\n </button>\n </div>\n <div\n role=\"button\"\n className={triggerClassname}\n onClick={handleSearchBar}\n id={SEARCH_BUTTON}\n title={SEARCH_BUTTON}>\n {!displaySearchBar ? <SearchIcon /> : <CloseIcon />}\n </div>\n </div>\n <div className=\"search-modal\">\n {children({ results: results.length && searchTerm ? results : [], loading })}\n </div>\n </div>\n );\n};\n\nSearchPublishedContent.propTypes = {\n entities: PropTypes.array,\n children: PropTypes.func.isRequired,\n resultKeys: PropTypes.string,\n getIsOpenSearchBar: PropTypes.func,\n SearchIcon: PropTypes.func,\n CloseIcon: PropTypes.func,\n onChange: PropTypes.func,\n onEnterPress: PropTypes.func,\n className: PropTypes.string,\n placeholder: PropTypes.string,\n inputRef: PropTypes.object,\n isSearchBarOpen: PropTypes.bool,\n fields: PropTypes.array\n};\n\nSearchPublishedContent.defaultProps = {\n entities: ['published_page'],\n placeholder: '',\n resultKeys: DEFAULT_RESULTS_KEYS,\n onChange: () => {},\n onEnterPress: () => {},\n getIsOpenSearchBar: state => state,\n SearchIcon: () => (\n <i>\n <MdSearch />\n </i>\n ),\n CloseIcon: () => (\n <i>\n <MdClose />\n </i>\n ),\n className: '',\n inputRef: null,\n isSearchBarOpen: null,\n fields: []\n};\n\nexport default SearchPublishedContent;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,QAAQ,EAAEC,SAAS,QAAQ,OAAO;AAClD,OAAOC,UAAU,MAAM,YAAY;AACnC,OAAOC,SAAS,MAAM,YAAY;AAClC,SAASC,OAAO,EAAEC,QAAQ,QAAQ,gBAAgB;AAClD,SAASC,WAAW,QAAQ,oCAAoC;AAChE,OAAOC,gBAAgB,MAAM,qBAAqB;AAClD,SAASC,gBAAgB,EAAEC,oBAAoB,EAAEC,aAAa,QAAQ,iBAAiB;AAEvF,MAAMC,sBAAsB,GAAG,CAAC;EAC9BC,QAAQ;EACRC,QAAQ;EACRC,UAAU;EACVC,kBAAkB;EAClBC,UAAU;EACVC,SAAS;EACTC,SAAS;EACTC,QAAQ;EACRC,WAAW;EACXC,YAAY;EACZC,QAAQ;EACRC,eAAe;EACfC;AACF,CAAC,KAAK;EACJ,MAAM,CAACC,gBAAgB,EAAEC,mBAAmB,CAAC,GAAG1B,QAAQ,CAACuB,eAAe,CAAC;EACzE,MAAM,CAACI,UAAU,EAAEC,aAAa,CAAC,GAAG5B,QAAQ,CAAC,EAAE,CAAC;EAChD,MAAM,CAAC6B,kBAAkB,EAAEC,qBAAqB,CAAC,GAAG9B,QAAQ,CAAC,IAAI,CAAC;EAClE,MAAM+B,mBAAmB,GAAGzB,WAAW,CAACqB,UAAU,EAAE,GAAG,CAAC;EAExD,MAAM,CAAC;IAAEK,OAAO;IAAEC;EAAQ,CAAC,EAAEC,cAAc,CAAC,GAAG3B,gBAAgB,CAAC;IAC9D4B,QAAQ,EAAE3B,gBAAgB;IAC1BM,UAAU;IACVF,QAAQ;IACRY;EACF,CAAC,CAAC;EAEFvB,SAAS,CACP,MAAM;IACJ,IAAIsB,eAAe,KA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C,UAAU,EAAEb,SAAS,CAACkD,IAAI;EAC1BpC,SAAS,EAAEd,SAAS,CAACkD,IAAI;EACzBlC,QAAQ,EAAEhB,SAAS,CAACkD,IAAI;EACxBhC,YAAY,EAAElB,SAAS,CAACkD,IAAI;EAC5BnC,SAAS,EAAEf,SAAS,CAACoD,MAAM;EAC3BnC,WAAW,EAAEjB,SAAS,CAACoD,MAAM;EAC7BjC,QAAQ,EAAEnB,SAAS,CAACqD,MAAM;EAC1BjC,eAAe,EAAEpB,SAAS,CAACsD,IAAI;EAC/BjC,MAAM,EAAErB,SAAS,CAACiD;AACpB,CAAC;AAEDzC,sBAAsB,CAAC+C,YAAY,GAAG;EACpC9C,QAAQ,EAAE,CAAC,gBAAgB,CAAC;EAC5BQ,WAAW,EAAE,EAAE;EACfN,UAAU,EAAEL,oBAAoB;EAChCU,QAAQ,EAAE,MAAM,CAAC,CAAC;EAClBE,YAAY,EAAE,MAAM,CAAC,CAAC;EACtBN,kBAAkB,EAAE4C,KAAK,IAAIA,KAAK;EAClC3C,UAAU,EAAE,mBACV,4CACE,oBAAC,QAAQ,OAAG,CAEf;EACDC,SAAS,EAAE,mBACT,4CACE,oBAAC,OAAO,OAAG,CAEd;EACDC,SAAS,EAAE,EAAE;EACbI,QAAQ,EAAE,IAAI;EACdC,eAAe,EAAE,IAAI;EACrBC,MAAM,EAAE;AACV,CAAC;AAED,eAAeb,sBAAsB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["SearchPublishedContent"],"sources":["../../../src/components/SearchPublishedContent/index.js"],"sourcesContent":["import SearchPublishedContent from './SearchPublishedContent';\n\nexport default SearchPublishedContent;\n"],"mappings":"AAAA,OAAOA,
|
|
1
|
+
{"version":3,"file":"index.js","names":["SearchPublishedContent"],"sources":["../../../src/components/SearchPublishedContent/index.js"],"sourcesContent":["import SearchPublishedContent from './SearchPublishedContent';\n\nexport default SearchPublishedContent;\n"],"mappings":"AAAA,OAAOA,sBAAsB,MAAM,0BAA0B;AAE7D,eAAeA,sBAAsB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["useLocalStorage"],"sources":["../../../src/components/useLocalStorage/index.js"],"sourcesContent":["import useLocalStorage from './useLocalStorage';\n\nexport default useLocalStorage;\n"],"mappings":"AAAA,OAAOA,
|
|
1
|
+
{"version":3,"file":"index.js","names":["useLocalStorage"],"sources":["../../../src/components/useLocalStorage/index.js"],"sourcesContent":["import useLocalStorage from './useLocalStorage';\n\nexport default useLocalStorage;\n"],"mappings":"AAAA,OAAOA,eAAe,MAAM,mBAAmB;AAE/C,eAAeA,eAAe"}
|
|
@@ -1,19 +1,15 @@
|
|
|
1
1
|
import { useState } from 'react';
|
|
2
|
-
|
|
3
2
|
function useLocalStorage(key, initialValue) {
|
|
4
3
|
const [storedValue, setStoredValue] = useState(() => {
|
|
5
4
|
const item = window.localStorage.getItem(key);
|
|
6
5
|
return item ? JSON.parse(item) : initialValue;
|
|
7
6
|
});
|
|
8
|
-
|
|
9
7
|
const setValue = value => {
|
|
10
8
|
const valueToStore = value instanceof Function ? value(storedValue) : value;
|
|
11
9
|
setStoredValue(valueToStore);
|
|
12
10
|
window.localStorage.setItem(key, JSON.stringify(valueToStore));
|
|
13
11
|
};
|
|
14
|
-
|
|
15
12
|
return [storedValue, setValue];
|
|
16
13
|
}
|
|
17
|
-
|
|
18
14
|
export default useLocalStorage;
|
|
19
15
|
//# sourceMappingURL=useLocalStorage.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLocalStorage.js","names":["useState","useLocalStorage","key","initialValue","storedValue","setStoredValue","item","window","localStorage","getItem","JSON","parse","setValue","value","valueToStore","Function","setItem","stringify"],"sources":["../../../src/components/useLocalStorage/useLocalStorage.js"],"sourcesContent":["import { useState } from 'react';\n\nfunction useLocalStorage(key, initialValue) {\n const [storedValue, setStoredValue] = useState(() => {\n const item = window.localStorage.getItem(key);\n return item ? JSON.parse(item) : initialValue;\n });\n\n const setValue = value => {\n const valueToStore = value instanceof Function ? value(storedValue) : value;\n setStoredValue(valueToStore);\n window.localStorage.setItem(key, JSON.stringify(valueToStore));\n };\n\n return [storedValue, setValue];\n}\n\nexport default useLocalStorage;\n"],"mappings":"AAAA,SAASA,
|
|
1
|
+
{"version":3,"file":"useLocalStorage.js","names":["useState","useLocalStorage","key","initialValue","storedValue","setStoredValue","item","window","localStorage","getItem","JSON","parse","setValue","value","valueToStore","Function","setItem","stringify"],"sources":["../../../src/components/useLocalStorage/useLocalStorage.js"],"sourcesContent":["import { useState } from 'react';\n\nfunction useLocalStorage(key, initialValue) {\n const [storedValue, setStoredValue] = useState(() => {\n const item = window.localStorage.getItem(key);\n return item ? JSON.parse(item) : initialValue;\n });\n\n const setValue = value => {\n const valueToStore = value instanceof Function ? value(storedValue) : value;\n setStoredValue(valueToStore);\n window.localStorage.setItem(key, JSON.stringify(valueToStore));\n };\n\n return [storedValue, setValue];\n}\n\nexport default useLocalStorage;\n"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,OAAO;AAEhC,SAASC,eAAe,CAACC,GAAG,EAAEC,YAAY,EAAE;EAC1C,MAAM,CAACC,WAAW,EAAEC,cAAc,CAAC,GAAGL,QAAQ,CAAC,MAAM;IACnD,MAAMM,IAAI,GAAGC,MAAM,CAACC,YAAY,CAACC,OAAO,CAACP,GAAG,CAAC;IAC7C,OAAOI,IAAI,GAAGI,IAAI,CAACC,KAAK,CAACL,IAAI,CAAC,GAAGH,YAAY;EAC/C,CAAC,CAAC;EAEF,MAAMS,QAAQ,GAAGC,KAAK,IAAI;IACxB,MAAMC,YAAY,GAAGD,KAAK,YAAYE,QAAQ,GAAGF,KAAK,CAACT,WAAW,CAAC,GAAGS,KAAK;IAC3ER,cAAc,CAACS,YAAY,CAAC;IAC5BP,MAAM,CAACC,YAAY,CAACQ,OAAO,CAACd,GAAG,EAAEQ,IAAI,CAACO,SAAS,CAACH,YAAY,CAAC,CAAC;EAChE,CAAC;EAED,OAAO,CAACV,WAAW,EAAEQ,QAAQ,CAAC;AAChC;AAEA,eAAeX,eAAe"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["useSearch"],"sources":["../../../src/components/useSearch/index.js"],"sourcesContent":["import useSearch from './useSearch';\n\nexport default useSearch;\n"],"mappings":"AAAA,OAAOA,
|
|
1
|
+
{"version":3,"file":"index.js","names":["useSearch"],"sources":["../../../src/components/useSearch/index.js"],"sourcesContent":["import useSearch from './useSearch';\n\nexport default useSearch;\n"],"mappings":"AAAA,OAAOA,SAAS,MAAM,aAAa;AAEnC,eAAeA,SAAS"}
|
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
|
|
3
2
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
4
|
-
|
|
5
3
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
6
|
-
|
|
7
4
|
import { useState, useEffect } from 'react';
|
|
8
5
|
import { useLazyQuery } from '@apollo/client';
|
|
9
6
|
import searchQueries from '../../application/query';
|
|
10
|
-
|
|
11
7
|
function useSearch({
|
|
12
8
|
queryKey,
|
|
13
9
|
resultKeys,
|
|
@@ -20,6 +16,7 @@ function useSearch({
|
|
|
20
16
|
value: ''
|
|
21
17
|
});
|
|
22
18
|
const [searchedValue, setSearchedValue] = useState(null);
|
|
19
|
+
const [en, setEn] = useState([]);
|
|
23
20
|
const [previousOffset, setPreviousOffset] = useState(null);
|
|
24
21
|
const buildSearchQuery = searchQueries[queryKey];
|
|
25
22
|
const [getSearchResults, {
|
|
@@ -40,13 +37,13 @@ function useSearch({
|
|
|
40
37
|
resultKeys
|
|
41
38
|
}), {
|
|
42
39
|
ssr: false
|
|
43
|
-
});
|
|
40
|
+
});
|
|
41
|
+
// todo: remove ssr: false once this bug is resolved https://github.com/apollographql/apollo-client/issues/9108
|
|
44
42
|
// without ssr: false clients can hang in ssr.
|
|
45
43
|
|
|
46
44
|
const handleQueryParams = newQueryParams => {
|
|
47
45
|
setParams(_objectSpread(_objectSpread({}, queryParams), newQueryParams));
|
|
48
46
|
};
|
|
49
|
-
|
|
50
47
|
useEffect(() => {
|
|
51
48
|
const {
|
|
52
49
|
limit,
|
|
@@ -55,13 +52,13 @@ function useSearch({
|
|
|
55
52
|
} = queryParams;
|
|
56
53
|
const isNewValueSet = value && value !== searchedValue;
|
|
57
54
|
const isNewOffsetSet = previousOffset !== null && offset !== previousOffset;
|
|
55
|
+
const notSameLength = en.length !== entities.length;
|
|
58
56
|
const parsedEntities = entities.length ? entities.map(entity => ({
|
|
59
57
|
match: {
|
|
60
58
|
docType: entity
|
|
61
59
|
}
|
|
62
60
|
})) : [];
|
|
63
|
-
|
|
64
|
-
if (isNewValueSet || isNewOffsetSet) {
|
|
61
|
+
if (isNewValueSet || isNewOffsetSet || notSameLength) {
|
|
65
62
|
getSearchResults({
|
|
66
63
|
variables: {
|
|
67
64
|
limit,
|
|
@@ -88,8 +85,9 @@ function useSearch({
|
|
|
88
85
|
});
|
|
89
86
|
setSearchedValue(value);
|
|
90
87
|
setPreviousOffset(offset);
|
|
88
|
+
setEn(entities);
|
|
91
89
|
}
|
|
92
|
-
}, [queryParams, queryParams.limit, queryParams.value, queryParams.offset, searchedValue, previousOffset, getSearchResults, entities, fields]);
|
|
90
|
+
}, [queryParams, queryParams.limit, queryParams.value, queryParams.offset, searchedValue, previousOffset, getSearchResults, entities, fields, entities.length, en.length]);
|
|
93
91
|
return [{
|
|
94
92
|
searchedValue: queryParams.value,
|
|
95
93
|
loading,
|
|
@@ -99,6 +97,5 @@ function useSearch({
|
|
|
99
97
|
}
|
|
100
98
|
}, handleQueryParams];
|
|
101
99
|
}
|
|
102
|
-
|
|
103
100
|
export default useSearch;
|
|
104
101
|
//# sourceMappingURL=useSearch.js.map
|