@webiny/app 0.0.0-ee-vpcs.549378cf03

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 (154) hide show
  1. package/App.d.ts +24 -0
  2. package/App.js +116 -0
  3. package/App.js.map +1 -0
  4. package/LICENSE +21 -0
  5. package/README.md +19 -0
  6. package/apollo-client/InMemoryCache.d.ts +7 -0
  7. package/apollo-client/InMemoryCache.js +79 -0
  8. package/apollo-client/InMemoryCache.js.map +1 -0
  9. package/components/Image.d.ts +3 -0
  10. package/components/Image.js +43 -0
  11. package/components/Image.js.map +1 -0
  12. package/components/Routes.d.ts +2 -0
  13. package/components/Routes.js +51 -0
  14. package/components/Routes.js.map +1 -0
  15. package/components/View.d.ts +8 -0
  16. package/components/View.js +41 -0
  17. package/components/View.js.map +1 -0
  18. package/components/index.d.ts +2 -0
  19. package/components/index.js +21 -0
  20. package/components/index.js.map +1 -0
  21. package/config.d.ts +8 -0
  22. package/config.js +33 -0
  23. package/config.js.map +1 -0
  24. package/contexts/Ui/index.d.ts +24 -0
  25. package/contexts/Ui/index.js +81 -0
  26. package/contexts/Ui/index.js.map +1 -0
  27. package/core/AddRoute.d.ts +3 -0
  28. package/core/AddRoute.js +26 -0
  29. package/core/AddRoute.js.map +1 -0
  30. package/core/DebounceRender.d.ts +11 -0
  31. package/core/DebounceRender.js +51 -0
  32. package/core/DebounceRender.js.map +1 -0
  33. package/core/Plugins.d.ts +8 -0
  34. package/core/Plugins.js +52 -0
  35. package/core/Plugins.js.map +1 -0
  36. package/core/Provider.d.ts +9 -0
  37. package/core/Provider.js +27 -0
  38. package/core/Provider.js.map +1 -0
  39. package/core/Routes.d.ts +6 -0
  40. package/core/Routes.js +49 -0
  41. package/core/Routes.js.map +1 -0
  42. package/core/createProviderPlugin.d.ts +8 -0
  43. package/core/createProviderPlugin.js +25 -0
  44. package/core/createProviderPlugin.js.map +1 -0
  45. package/hooks/useAutocomplete/index.d.ts +1 -0
  46. package/hooks/useAutocomplete/index.js +13 -0
  47. package/hooks/useAutocomplete/index.js.map +1 -0
  48. package/hooks/useAutocomplete/useAutocomplete.d.ts +11 -0
  49. package/hooks/useAutocomplete/useAutocomplete.js +38 -0
  50. package/hooks/useAutocomplete/useAutocomplete.js.map +1 -0
  51. package/hooks/useDataList/functions/getData.d.ts +2 -0
  52. package/hooks/useDataList/functions/getData.js +16 -0
  53. package/hooks/useDataList/functions/getData.js.map +1 -0
  54. package/hooks/useDataList/functions/getError.d.ts +2 -0
  55. package/hooks/useDataList/functions/getError.js +16 -0
  56. package/hooks/useDataList/functions/getError.js.map +1 -0
  57. package/hooks/useDataList/functions/getMeta.d.ts +2 -0
  58. package/hooks/useDataList/functions/getMeta.js +16 -0
  59. package/hooks/useDataList/functions/getMeta.js.map +1 -0
  60. package/hooks/useDataList/functions/index.d.ts +3 -0
  61. package/hooks/useDataList/functions/index.js +31 -0
  62. package/hooks/useDataList/functions/index.js.map +1 -0
  63. package/hooks/useDataList/functions/searchDataByKey.d.ts +2 -0
  64. package/hooks/useDataList/functions/searchDataByKey.js +29 -0
  65. package/hooks/useDataList/functions/searchDataByKey.js.map +1 -0
  66. package/hooks/useDataList/index.d.ts +1 -0
  67. package/hooks/useDataList/index.js +13 -0
  68. package/hooks/useDataList/index.js.map +1 -0
  69. package/hooks/useDataList/useDataList.d.ts +36 -0
  70. package/hooks/useDataList/useDataList.js +208 -0
  71. package/hooks/useDataList/useDataList.js.map +1 -0
  72. package/hooks/useDataList/utils/index.d.ts +2 -0
  73. package/hooks/useDataList/utils/index.js +23 -0
  74. package/hooks/useDataList/utils/index.js.map +1 -0
  75. package/hooks/useDataList/utils/prepareLoadListParams.d.ts +11 -0
  76. package/hooks/useDataList/utils/prepareLoadListParams.js +48 -0
  77. package/hooks/useDataList/utils/prepareLoadListParams.js.map +1 -0
  78. package/hooks/useDataList/utils/redirectToRouteWithQueryParams.d.ts +14 -0
  79. package/hooks/useDataList/utils/redirectToRouteWithQueryParams.js +31 -0
  80. package/hooks/useDataList/utils/redirectToRouteWithQueryParams.js.map +1 -0
  81. package/hooks/useDataList/utils/types.d.ts +34 -0
  82. package/hooks/useDataList/utils/types.js +5 -0
  83. package/hooks/useDataList/utils/types.js.map +1 -0
  84. package/hooks/useHandler.d.ts +11 -0
  85. package/hooks/useHandler.js +20 -0
  86. package/hooks/useHandler.js.map +1 -0
  87. package/hooks/useHandlers.d.ts +11 -0
  88. package/hooks/useHandlers.js +30 -0
  89. package/hooks/useHandlers.js.map +1 -0
  90. package/hooks/useUi.d.ts +2 -0
  91. package/hooks/useUi.js +16 -0
  92. package/hooks/useUi.js.map +1 -0
  93. package/i18n/i18n.d.ts +2 -0
  94. package/i18n/i18n.js +21 -0
  95. package/i18n/i18n.js.map +1 -0
  96. package/i18n/index.d.ts +1 -0
  97. package/i18n/index.js +15 -0
  98. package/i18n/index.js.map +1 -0
  99. package/index.d.ts +13 -0
  100. package/index.js +141 -0
  101. package/index.js.map +1 -0
  102. package/package.json +78 -0
  103. package/plugins/AddQuerySelectionPlugin.d.ts +15 -0
  104. package/plugins/AddQuerySelectionPlugin.js +132 -0
  105. package/plugins/AddQuerySelectionPlugin.js.map +1 -0
  106. package/plugins/ApolloCacheObjectIdPlugin.d.ts +15 -0
  107. package/plugins/ApolloCacheObjectIdPlugin.js +53 -0
  108. package/plugins/ApolloCacheObjectIdPlugin.js.map +1 -0
  109. package/plugins/ApolloDynamicLink.d.ts +6 -0
  110. package/plugins/ApolloDynamicLink.js +83 -0
  111. package/plugins/ApolloDynamicLink.js.map +1 -0
  112. package/plugins/ApolloLinkPlugin.d.ts +13 -0
  113. package/plugins/ApolloLinkPlugin.js +63 -0
  114. package/plugins/ApolloLinkPlugin.js.map +1 -0
  115. package/plugins/ConsoleLinkPlugin.d.ts +8 -0
  116. package/plugins/ConsoleLinkPlugin.js +63 -0
  117. package/plugins/ConsoleLinkPlugin.js.map +1 -0
  118. package/plugins/LocaleHeaderLinkPlugin.d.ts +15 -0
  119. package/plugins/LocaleHeaderLinkPlugin.js +77 -0
  120. package/plugins/LocaleHeaderLinkPlugin.js.map +1 -0
  121. package/plugins/NetworkErrorLinkPlugin/ErrorOverlay.d.ts +14 -0
  122. package/plugins/NetworkErrorLinkPlugin/ErrorOverlay.js +97 -0
  123. package/plugins/NetworkErrorLinkPlugin/ErrorOverlay.js.map +1 -0
  124. package/plugins/NetworkErrorLinkPlugin/StyledComponents.d.ts +5 -0
  125. package/plugins/NetworkErrorLinkPlugin/StyledComponents.js +21 -0
  126. package/plugins/NetworkErrorLinkPlugin/StyledComponents.js.map +1 -0
  127. package/plugins/NetworkErrorLinkPlugin/assets/close_24px.svg +1 -0
  128. package/plugins/NetworkErrorLinkPlugin/createErrorOverlay.d.ts +7 -0
  129. package/plugins/NetworkErrorLinkPlugin/createErrorOverlay.js +38 -0
  130. package/plugins/NetworkErrorLinkPlugin/createErrorOverlay.js.map +1 -0
  131. package/plugins/NetworkErrorLinkPlugin.d.ts +7 -0
  132. package/plugins/NetworkErrorLinkPlugin.js +65 -0
  133. package/plugins/NetworkErrorLinkPlugin.js.map +1 -0
  134. package/plugins/OmitTypenameLinkPlugin.d.ts +8 -0
  135. package/plugins/OmitTypenameLinkPlugin.js +55 -0
  136. package/plugins/OmitTypenameLinkPlugin.js.map +1 -0
  137. package/plugins/RoutePlugin.d.ts +12 -0
  138. package/plugins/RoutePlugin.js +53 -0
  139. package/plugins/RoutePlugin.js.map +1 -0
  140. package/plugins/TenantHeaderLinkPlugin.d.ts +15 -0
  141. package/plugins/TenantHeaderLinkPlugin.js +85 -0
  142. package/plugins/TenantHeaderLinkPlugin.js.map +1 -0
  143. package/plugins/ViewPlugin.d.ts +14 -0
  144. package/plugins/ViewPlugin.js +58 -0
  145. package/plugins/ViewPlugin.js.map +1 -0
  146. package/plugins/image.d.ts +3 -0
  147. package/plugins/image.js +184 -0
  148. package/plugins/image.js.map +1 -0
  149. package/plugins/index.d.ts +20 -0
  150. package/plugins/index.js +110 -0
  151. package/plugins/index.js.map +1 -0
  152. package/types.d.ts +70 -0
  153. package/types.js +13 -0
  154. package/types.js.map +1 -0
@@ -0,0 +1 @@
1
+ {"version":3,"names":["UiContext","React","createContext","UiProvider","ui","setter","setState","state","value","setData","uiStatePlugins","plugins","byType","map","pl","cloneElement","render","key","name","props","children","Component"],"sources":["index.tsx"],"sourcesContent":["import React from \"react\";\nimport { UiStatePlugin } from \"~/types\";\nimport { plugins } from \"@webiny/plugins\";\n\nexport const UiContext = React.createContext({});\n\ntype Props = {};\n\ntype State = {\n ui: { [key: string]: any };\n};\n\ninterface UiData {\n [key: string]: any;\n}\n\ninterface UiDataSetter {\n (ui: UiData): UiData;\n}\n\nexport interface UiContextValue {\n setState: (setter: UiDataSetter) => void;\n [key: string]: any;\n}\n\nexport class UiProvider extends React.Component<Props, State> {\n public override state: State = {\n ui: {}\n };\n\n private readonly setData = (setter: Function): void => {\n return this.setState((state: State) => {\n return { ui: { ...state.ui, ...setter(state.ui) } };\n });\n };\n\n public override render() {\n const value: UiContextValue = { ...this.state.ui, setState: this.setData };\n const uiStatePlugins = plugins.byType<UiStatePlugin>(\"ui-state\");\n return (\n <UiContext.Provider value={value}>\n {uiStatePlugins.map(pl => React.cloneElement(pl.render(), { key: pl.name }))}\n {this.props.children}\n </UiContext.Provider>\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;;AAEA;;AAEO,IAAMA,SAAS,gBAAGC,cAAA,CAAMC,aAAN,CAAoB,EAApB,CAAlB;;;;IAqBMC,U;;;;;;;;;;;;;;;wFACsB;MAC3BC,EAAE,EAAE;IADuB,C;0FAIJ,UAACC,MAAD,EAA4B;MACnD,OAAO,MAAKC,QAAL,CAAc,UAACC,KAAD,EAAkB;QACnC,OAAO;UAAEH,EAAE,8DAAOG,KAAK,CAACH,EAAb,GAAoBC,MAAM,CAACE,KAAK,CAACH,EAAP,CAA1B;QAAJ,CAAP;MACH,CAFM,CAAP;IAGH,C;;;;;;WAED,kBAAyB;MACrB,IAAMI,KAAqB,+DAAQ,KAAKD,KAAL,CAAWH,EAAnB;QAAuBE,QAAQ,EAAE,KAAKG;MAAtC,EAA3B;;MACA,IAAMC,cAAc,GAAGC,gBAAA,CAAQC,MAAR,CAA8B,UAA9B,CAAvB;;MACA,oBACI,6BAAC,SAAD,CAAW,QAAX;QAAoB,KAAK,EAAEJ;MAA3B,GACKE,cAAc,CAACG,GAAf,CAAmB,UAAAC,EAAE;QAAA,oBAAIb,cAAA,CAAMc,YAAN,CAAmBD,EAAE,CAACE,MAAH,EAAnB,EAAgC;UAAEC,GAAG,EAAEH,EAAE,CAACI;QAAV,CAAhC,CAAJ;MAAA,CAArB,CADL,EAEK,KAAKC,KAAL,CAAWC,QAFhB,CADJ;IAMH;;;EApB2BnB,cAAA,CAAMoB,S"}
@@ -0,0 +1,3 @@
1
+ import React from "react";
2
+ import { RouteProps } from "@webiny/react-router";
3
+ export declare const AddRoute: React.FC<RouteProps>;
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+
3
+ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.AddRoute = void 0;
9
+
10
+ var _react = _interopRequireWildcard(require("react"));
11
+
12
+ var _App = require("../App");
13
+
14
+ var _reactRouter = require("@webiny/react-router");
15
+
16
+ var AddRoute = function AddRoute(props) {
17
+ var _useApp = (0, _App.useApp)(),
18
+ addRoute = _useApp.addRoute;
19
+
20
+ (0, _react.useEffect)(function () {
21
+ addRoute( /*#__PURE__*/_react.default.createElement(_reactRouter.Route, props));
22
+ }, []);
23
+ return null;
24
+ };
25
+
26
+ exports.AddRoute = AddRoute;
@@ -0,0 +1 @@
1
+ {"version":3,"names":["AddRoute","props","useApp","addRoute","useEffect"],"sources":["AddRoute.tsx"],"sourcesContent":["import React, { useEffect } from \"react\";\nimport { useApp } from \"~/App\";\nimport { Route, RouteProps } from \"@webiny/react-router\";\n\nexport const AddRoute: React.FC<RouteProps> = props => {\n const { addRoute } = useApp();\n\n useEffect(() => {\n addRoute(<Route {...props} />);\n }, []);\n\n return null;\n};\n"],"mappings":";;;;;;;;;AAAA;;AACA;;AACA;;AAEO,IAAMA,QAA8B,GAAG,SAAjCA,QAAiC,CAAAC,KAAK,EAAI;EACnD,cAAqB,IAAAC,WAAA,GAArB;EAAA,IAAQC,QAAR,WAAQA,QAAR;;EAEA,IAAAC,gBAAA,EAAU,YAAM;IACZD,QAAQ,eAAC,6BAAC,kBAAD,EAAWF,KAAX,CAAD,CAAR;EACH,CAFD,EAEG,EAFH;EAIA,OAAO,IAAP;AACH,CARM"}
@@ -0,0 +1,11 @@
1
+ import React from "react";
2
+ interface Props {
3
+ wait?: number;
4
+ }
5
+ /**
6
+ * We need to debounce the rendering of children during app bootstrap, since many plugins
7
+ * can add more and more Providers which will recompose the entire hierarchy of React Context providers.
8
+ * During this stage, we don't want to render anything.
9
+ */
10
+ export declare const DebounceRender: React.FC<Props>;
11
+ export {};
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+
3
+ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
4
+
5
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
6
+
7
+ Object.defineProperty(exports, "__esModule", {
8
+ value: true
9
+ });
10
+ exports.DebounceRender = void 0;
11
+
12
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
13
+
14
+ var _react = _interopRequireWildcard(require("react"));
15
+
16
+ var _lodash = _interopRequireDefault(require("lodash.debounce"));
17
+
18
+ /**
19
+ * We need to debounce the rendering of children during app bootstrap, since many plugins
20
+ * can add more and more Providers which will recompose the entire hierarchy of React Context providers.
21
+ * During this stage, we don't want to render anything.
22
+ */
23
+ var DebounceRender = function DebounceRender(_ref) {
24
+ var _ref$wait = _ref.wait,
25
+ wait = _ref$wait === void 0 ? 50 : _ref$wait,
26
+ children = _ref.children;
27
+
28
+ var _useState = (0, _react.useState)(wait === 0),
29
+ _useState2 = (0, _slicedToArray2.default)(_useState, 2),
30
+ render = _useState2[0],
31
+ setRender = _useState2[1];
32
+
33
+ var debouncedRender = (0, _react.useMemo)(function () {
34
+ return (0, _lodash.default)(function () {
35
+ setRender(true);
36
+ }, wait);
37
+ }, [setRender]);
38
+ (0, _react.useEffect)(function () {
39
+ if (render) {
40
+ return;
41
+ }
42
+
43
+ debouncedRender();
44
+ return function () {
45
+ debouncedRender.cancel();
46
+ };
47
+ }, []);
48
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, render ? children : null);
49
+ };
50
+
51
+ exports.DebounceRender = DebounceRender;
@@ -0,0 +1 @@
1
+ {"version":3,"names":["DebounceRender","wait","children","useState","render","setRender","debouncedRender","useMemo","debounce","useEffect","cancel"],"sources":["DebounceRender.tsx"],"sourcesContent":["import React from \"react\";\nimport { useEffect, useMemo, useState } from \"react\";\nimport debounce from \"lodash.debounce\";\n\ninterface Props {\n wait?: number;\n}\n/**\n * We need to debounce the rendering of children during app bootstrap, since many plugins\n * can add more and more Providers which will recompose the entire hierarchy of React Context providers.\n * During this stage, we don't want to render anything.\n */\nexport const DebounceRender: React.FC<Props> = ({ wait = 50, children }) => {\n const [render, setRender] = useState(wait === 0);\n\n const debouncedRender = useMemo(() => {\n return debounce(() => {\n setRender(true);\n }, wait);\n }, [setRender]);\n\n useEffect(() => {\n if (render) {\n return;\n }\n\n debouncedRender();\n\n return () => {\n debouncedRender.cancel();\n };\n }, []);\n\n return <>{render ? children : null}</>;\n};\n"],"mappings":";;;;;;;;;;;;;AAAA;;AAEA;;AAKA;AACA;AACA;AACA;AACA;AACO,IAAMA,cAA+B,GAAG,SAAlCA,cAAkC,OAA6B;EAAA,qBAA1BC,IAA0B;EAAA,IAA1BA,IAA0B,0BAAnB,EAAmB;EAAA,IAAfC,QAAe,QAAfA,QAAe;;EACxE,gBAA4B,IAAAC,eAAA,EAASF,IAAI,KAAK,CAAlB,CAA5B;EAAA;EAAA,IAAOG,MAAP;EAAA,IAAeC,SAAf;;EAEA,IAAMC,eAAe,GAAG,IAAAC,cAAA,EAAQ,YAAM;IAClC,OAAO,IAAAC,eAAA,EAAS,YAAM;MAClBH,SAAS,CAAC,IAAD,CAAT;IACH,CAFM,EAEJJ,IAFI,CAAP;EAGH,CAJuB,EAIrB,CAACI,SAAD,CAJqB,CAAxB;EAMA,IAAAI,gBAAA,EAAU,YAAM;IACZ,IAAIL,MAAJ,EAAY;MACR;IACH;;IAEDE,eAAe;IAEf,OAAO,YAAM;MACTA,eAAe,CAACI,MAAhB;IACH,CAFD;EAGH,CAVD,EAUG,EAVH;EAYA,oBAAO,4DAAGN,MAAM,GAAGF,QAAH,GAAc,IAAvB,CAAP;AACH,CAtBM"}
@@ -0,0 +1,8 @@
1
+ import React from "react";
2
+ export declare const PluginsContext: React.Context<boolean>;
3
+ interface PluginsProviderComponentProps {
4
+ children: JSX.Element[];
5
+ }
6
+ export declare const PluginsProvider: React.NamedExoticComponent<PluginsProviderComponentProps>;
7
+ export declare const Plugins: React.FC;
8
+ export {};
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+
3
+ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.PluginsProvider = exports.PluginsContext = exports.Plugins = void 0;
9
+
10
+ var _react = _interopRequireWildcard(require("react"));
11
+
12
+ var _App = require("../App");
13
+
14
+ var PluginsContext = /*#__PURE__*/(0, _react.createContext)(false);
15
+ exports.PluginsContext = PluginsContext;
16
+ PluginsContext.displayName = "PluginsContext";
17
+
18
+ var PluginsProviderComponent = function PluginsProviderComponent(_ref) {
19
+ var children = _ref.children;
20
+
21
+ /**
22
+ * This context only serves as a safeguard. We need to warn users when they mount a plugin without using
23
+ * the <Plugins> component. In that case, the context will not be available, and we can log warnings.
24
+ */
25
+ return /*#__PURE__*/_react.default.createElement(PluginsContext.Provider, {
26
+ value: true
27
+ }, children);
28
+ };
29
+
30
+ var PluginsProvider = /*#__PURE__*/(0, _react.memo)(PluginsProviderComponent);
31
+ exports.PluginsProvider = PluginsProvider;
32
+
33
+ var Plugins = function Plugins(_ref2) {
34
+ var children = _ref2.children;
35
+
36
+ var _useApp = (0, _App.useApp)(),
37
+ addPlugin = _useApp.addPlugin;
38
+
39
+ var hasParentPlugin = (0, _react.useContext)(PluginsContext);
40
+ (0, _react.useEffect)(function () {
41
+ if (hasParentPlugin) {
42
+ return;
43
+ }
44
+
45
+ _react.Children.forEach(children, function (child) {
46
+ return addPlugin(child);
47
+ });
48
+ }, []);
49
+ return hasParentPlugin ? /*#__PURE__*/_react.default.createElement(_react.Fragment, null, children) : null;
50
+ };
51
+
52
+ exports.Plugins = Plugins;
@@ -0,0 +1 @@
1
+ {"version":3,"names":["PluginsContext","createContext","displayName","PluginsProviderComponent","children","PluginsProvider","memo","Plugins","useApp","addPlugin","hasParentPlugin","useContext","useEffect","Children","forEach","child"],"sources":["Plugins.tsx"],"sourcesContent":["import React, { Fragment, Children, createContext, useContext, useEffect, memo } from \"react\";\nimport { useApp } from \"~/App\";\n\nexport const PluginsContext = createContext<boolean>(false);\nPluginsContext.displayName = \"PluginsContext\";\n\ninterface PluginsProviderComponentProps {\n children: JSX.Element[];\n}\nconst PluginsProviderComponent: React.FC<PluginsProviderComponentProps> = ({ children }) => {\n /**\n * This context only serves as a safeguard. We need to warn users when they mount a plugin without using\n * the <Plugins> component. In that case, the context will not be available, and we can log warnings.\n */\n return <PluginsContext.Provider value={true}>{children}</PluginsContext.Provider>;\n};\n\nexport const PluginsProvider = memo(PluginsProviderComponent);\n\nexport const Plugins: React.FC = ({ children }) => {\n const { addPlugin } = useApp();\n const hasParentPlugin = useContext(PluginsContext);\n\n useEffect(() => {\n if (hasParentPlugin) {\n return;\n }\n\n Children.forEach(children, child => addPlugin(child));\n }, []);\n\n return hasParentPlugin ? <Fragment>{children}</Fragment> : null;\n};\n"],"mappings":";;;;;;;;;AAAA;;AACA;;AAEO,IAAMA,cAAc,gBAAG,IAAAC,oBAAA,EAAuB,KAAvB,CAAvB;;AACPD,cAAc,CAACE,WAAf,GAA6B,gBAA7B;;AAKA,IAAMC,wBAAiE,GAAG,SAApEA,wBAAoE,OAAkB;EAAA,IAAfC,QAAe,QAAfA,QAAe;;EACxF;AACJ;AACA;AACA;EACI,oBAAO,6BAAC,cAAD,CAAgB,QAAhB;IAAyB,KAAK,EAAE;EAAhC,GAAuCA,QAAvC,CAAP;AACH,CAND;;AAQO,IAAMC,eAAe,gBAAG,IAAAC,WAAA,EAAKH,wBAAL,CAAxB;;;AAEA,IAAMI,OAAiB,GAAG,SAApBA,OAAoB,QAAkB;EAAA,IAAfH,QAAe,SAAfA,QAAe;;EAC/C,cAAsB,IAAAI,WAAA,GAAtB;EAAA,IAAQC,SAAR,WAAQA,SAAR;;EACA,IAAMC,eAAe,GAAG,IAAAC,iBAAA,EAAWX,cAAX,CAAxB;EAEA,IAAAY,gBAAA,EAAU,YAAM;IACZ,IAAIF,eAAJ,EAAqB;MACjB;IACH;;IAEDG,eAAA,CAASC,OAAT,CAAiBV,QAAjB,EAA2B,UAAAW,KAAK;MAAA,OAAIN,SAAS,CAACM,KAAD,CAAb;IAAA,CAAhC;EACH,CAND,EAMG,EANH;EAQA,OAAOL,eAAe,gBAAG,6BAAC,eAAD,QAAWN,QAAX,CAAH,GAAqC,IAA3D;AACH,CAbM"}
@@ -0,0 +1,9 @@
1
+ import React from "react";
2
+ import { HigherOrderComponent } from "../index";
3
+ export interface ProviderProps {
4
+ hoc: HigherOrderComponent;
5
+ }
6
+ /**
7
+ * Register a new React context provider.
8
+ */
9
+ export declare const Provider: React.FC<ProviderProps>;
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.Provider = void 0;
7
+
8
+ var _react = require("react");
9
+
10
+ var _ = require("./..");
11
+
12
+ /**
13
+ * Register a new React context provider.
14
+ */
15
+ var Provider = function Provider(_ref) {
16
+ var hoc = _ref.hoc;
17
+
18
+ var _useApp = (0, _.useApp)(),
19
+ addProvider = _useApp.addProvider;
20
+
21
+ (0, _react.useEffect)(function () {
22
+ return addProvider(hoc);
23
+ }, []);
24
+ return null;
25
+ };
26
+
27
+ exports.Provider = Provider;
@@ -0,0 +1 @@
1
+ {"version":3,"names":["Provider","hoc","useApp","addProvider","useEffect"],"sources":["Provider.tsx"],"sourcesContent":["import React, { useEffect } from \"react\";\nimport { HigherOrderComponent, useApp } from \"~/index\";\n\nexport interface ProviderProps {\n hoc: HigherOrderComponent;\n}\n\n/**\n * Register a new React context provider.\n */\nexport const Provider: React.FC<ProviderProps> = ({ hoc }) => {\n const { addProvider } = useApp();\n\n useEffect(() => {\n return addProvider(hoc);\n }, []);\n\n return null;\n};\n"],"mappings":";;;;;;;AAAA;;AACA;;AAMA;AACA;AACA;AACO,IAAMA,QAAiC,GAAG,SAApCA,QAAoC,OAAa;EAAA,IAAVC,GAAU,QAAVA,GAAU;;EAC1D,cAAwB,IAAAC,QAAA,GAAxB;EAAA,IAAQC,WAAR,WAAQA,WAAR;;EAEA,IAAAC,gBAAA,EAAU,YAAM;IACZ,OAAOD,WAAW,CAACF,GAAD,CAAlB;EACH,CAFD,EAEG,EAFH;EAIA,OAAO,IAAP;AACH,CARM"}
@@ -0,0 +1,6 @@
1
+ import React from "react";
2
+ interface RoutesProps {
3
+ routes: JSX.Element[];
4
+ }
5
+ export declare const Routes: React.FC<RoutesProps>;
6
+ export {};
package/core/Routes.js ADDED
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.Routes = void 0;
9
+
10
+ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
11
+
12
+ var _react = _interopRequireDefault(require("react"));
13
+
14
+ var _plugins = require("@webiny/plugins");
15
+
16
+ var _reactRouter = require("@webiny/react-router");
17
+
18
+ var Routes = function Routes(props) {
19
+ var routes = [].concat((0, _toConsumableArray2.default)(props.routes), (0, _toConsumableArray2.default)(_plugins.plugins.byType("route").map(function (_ref) {
20
+ var route = _ref.route;
21
+ return route;
22
+ }))).sort(function (a, b) {
23
+ var pathA = a.props.path || "*";
24
+ var pathB = b.props.path || "*"; // This will sort paths at the very bottom of the list
25
+
26
+ if (pathA === "/" && pathB === "*") {
27
+ return -1;
28
+ } // This will push * and / to the bottom of the list
29
+
30
+
31
+ if (pathA === "*" || pathA === "/") {
32
+ return 1;
33
+ } // This will push * and / to the bottom of the list
34
+
35
+
36
+ if (["*", "/"].includes(pathB)) {
37
+ return -1;
38
+ }
39
+
40
+ return 0;
41
+ });
42
+ return /*#__PURE__*/_react.default.createElement(_reactRouter.Routes, null, routes.map(function (route, index) {
43
+ return /*#__PURE__*/_react.default.cloneElement(route, {
44
+ key: "".concat(route.props.path, ":").concat(index)
45
+ });
46
+ }));
47
+ };
48
+
49
+ exports.Routes = Routes;
@@ -0,0 +1 @@
1
+ {"version":3,"names":["Routes","props","routes","plugins","byType","map","route","sort","a","b","pathA","path","pathB","includes","index","React","cloneElement","key"],"sources":["Routes.tsx"],"sourcesContent":["import React from \"react\";\nimport { plugins } from \"@webiny/plugins\";\nimport { Routes as ReactRouterRoutes } from \"@webiny/react-router\";\nimport { RoutePlugin } from \"~/types\";\n\ninterface RoutesProps {\n routes: JSX.Element[];\n}\n\nexport const Routes: React.FC<RoutesProps> = props => {\n const routes = [\n ...props.routes,\n // For backwards compatibility, we need to support the RoutePlugin routes as well.\n ...plugins.byType<RoutePlugin>(\"route\").map(({ route }) => route)\n ].sort((a, b) => {\n const pathA = a.props.path || \"*\";\n const pathB = b.props.path || \"*\";\n\n // This will sort paths at the very bottom of the list\n if (pathA === \"/\" && pathB === \"*\") {\n return -1;\n }\n\n // This will push * and / to the bottom of the list\n if (pathA === \"*\" || pathA === \"/\") {\n return 1;\n }\n\n // This will push * and / to the bottom of the list\n if ([\"*\", \"/\"].includes(pathB)) {\n return -1;\n }\n\n return 0;\n });\n\n return (\n <ReactRouterRoutes>\n {routes.map((route, index) =>\n React.cloneElement(route, { key: `${route.props.path}:${index}` })\n )}\n </ReactRouterRoutes>\n );\n};\n"],"mappings":";;;;;;;;;;;AAAA;;AACA;;AACA;;AAOO,IAAMA,MAA6B,GAAG,SAAhCA,MAAgC,CAAAC,KAAK,EAAI;EAClD,IAAMC,MAAM,GAAG,2CACRD,KAAK,CAACC,MADE,oCAGRC,gBAAA,CAAQC,MAAR,CAA4B,OAA5B,EAAqCC,GAArC,CAAyC;IAAA,IAAGC,KAAH,QAAGA,KAAH;IAAA,OAAeA,KAAf;EAAA,CAAzC,CAHQ,GAIbC,IAJa,CAIR,UAACC,CAAD,EAAIC,CAAJ,EAAU;IACb,IAAMC,KAAK,GAAGF,CAAC,CAACP,KAAF,CAAQU,IAAR,IAAgB,GAA9B;IACA,IAAMC,KAAK,GAAGH,CAAC,CAACR,KAAF,CAAQU,IAAR,IAAgB,GAA9B,CAFa,CAIb;;IACA,IAAID,KAAK,KAAK,GAAV,IAAiBE,KAAK,KAAK,GAA/B,EAAoC;MAChC,OAAO,CAAC,CAAR;IACH,CAPY,CASb;;;IACA,IAAIF,KAAK,KAAK,GAAV,IAAiBA,KAAK,KAAK,GAA/B,EAAoC;MAChC,OAAO,CAAP;IACH,CAZY,CAcb;;;IACA,IAAI,CAAC,GAAD,EAAM,GAAN,EAAWG,QAAX,CAAoBD,KAApB,CAAJ,EAAgC;MAC5B,OAAO,CAAC,CAAR;IACH;;IAED,OAAO,CAAP;EACH,CAxBc,CAAf;EA0BA,oBACI,6BAAC,mBAAD,QACKV,MAAM,CAACG,GAAP,CAAW,UAACC,KAAD,EAAQQ,KAAR;IAAA,oBACRC,cAAA,CAAMC,YAAN,CAAmBV,KAAnB,EAA0B;MAAEW,GAAG,YAAKX,KAAK,CAACL,KAAN,CAAYU,IAAjB,cAAyBG,KAAzB;IAAL,CAA1B,CADQ;EAAA,CAAX,CADL,CADJ;AAOH,CAlCM"}
@@ -0,0 +1,8 @@
1
+ import React from "react";
2
+ import { HigherOrderComponent } from "@webiny/react-composition";
3
+ /**
4
+ * Creates a component, which, when mounted, will register an app provider.
5
+ * This is particularly useful for wrapping the entire app with custom React Context providers.
6
+ * For more information, visit https://www.webiny.com/docs/admin-area/basics/framework.
7
+ */
8
+ export declare function createProviderPlugin(hoc: HigherOrderComponent): React.FC;
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.createProviderPlugin = createProviderPlugin;
9
+
10
+ var _react = _interopRequireDefault(require("react"));
11
+
12
+ var _Provider = require("./Provider");
13
+
14
+ /**
15
+ * Creates a component, which, when mounted, will register an app provider.
16
+ * This is particularly useful for wrapping the entire app with custom React Context providers.
17
+ * For more information, visit https://www.webiny.com/docs/admin-area/basics/framework.
18
+ */
19
+ function createProviderPlugin(hoc) {
20
+ return function ProviderPlugin() {
21
+ return /*#__PURE__*/_react.default.createElement(_Provider.Provider, {
22
+ hoc: hoc
23
+ });
24
+ };
25
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"names":["createProviderPlugin","hoc","ProviderPlugin"],"sources":["createProviderPlugin.tsx"],"sourcesContent":["import React from \"react\";\nimport { HigherOrderComponent } from \"@webiny/react-composition\";\nimport { Provider } from \"./Provider\";\n\n/**\n * Creates a component, which, when mounted, will register an app provider.\n * This is particularly useful for wrapping the entire app with custom React Context providers.\n * For more information, visit https://www.webiny.com/docs/admin-area/basics/framework.\n */\nexport function createProviderPlugin(hoc: HigherOrderComponent): React.FC {\n return function ProviderPlugin() {\n return <Provider hoc={hoc} />;\n };\n}\n"],"mappings":";;;;;;;;;AAAA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACO,SAASA,oBAAT,CAA8BC,GAA9B,EAAmE;EACtE,OAAO,SAASC,cAAT,GAA0B;IAC7B,oBAAO,6BAAC,kBAAD;MAAU,GAAG,EAAED;IAAf,EAAP;EACH,CAFD;AAGH"}
@@ -0,0 +1 @@
1
+ export { useAutocomplete } from "./useAutocomplete";
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "useAutocomplete", {
7
+ enumerable: true,
8
+ get: function get() {
9
+ return _useAutocomplete.useAutocomplete;
10
+ }
11
+ });
12
+
13
+ var _useAutocomplete = require("./useAutocomplete");
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export { useAutocomplete } from \"./useAutocomplete\";\n"],"mappings":";;;;;;;;;;;;AAAA"}
@@ -0,0 +1,11 @@
1
+ import { DocumentNode } from "graphql";
2
+ interface UseAutocompleteHook {
3
+ options: any[];
4
+ onInput(value: string): void;
5
+ }
6
+ interface Props {
7
+ query: DocumentNode;
8
+ search?: string | ((value: string) => string);
9
+ }
10
+ export declare const useAutocomplete: (props: Props) => UseAutocompleteHook;
11
+ export {};
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.useAutocomplete = void 0;
9
+
10
+ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
11
+
12
+ var _debounce2 = _interopRequireDefault(require("lodash/debounce"));
13
+
14
+ var _useDataList = require("../useDataList");
15
+
16
+ var useAutocomplete = function useAutocomplete(props) {
17
+ var dataList = (0, _useDataList.useDataList)((0, _objectSpread2.default)({
18
+ useRouter: false
19
+ }, props));
20
+ return {
21
+ options: dataList.data || [],
22
+ onInput: (0, _debounce2.default)(function (query) {
23
+ if (!query) {
24
+ return;
25
+ }
26
+
27
+ var search = props.search || query;
28
+
29
+ if (typeof search === "function") {
30
+ search = search(query);
31
+ }
32
+
33
+ dataList.setSearch(search);
34
+ }, 250)
35
+ };
36
+ };
37
+
38
+ exports.useAutocomplete = useAutocomplete;
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useAutocomplete","props","dataList","useDataList","useRouter","options","data","onInput","query","search","setSearch"],"sources":["useAutocomplete.ts"],"sourcesContent":["import { useDataList } from \"../useDataList\";\nimport { debounce } from \"lodash\";\nimport { DocumentNode } from \"graphql\";\n\ninterface UseAutocompleteHook {\n options: any[];\n onInput(value: string): void;\n}\n\ninterface Props {\n query: DocumentNode;\n search?: string | ((value: string) => string);\n}\n\nexport const useAutocomplete = (props: Props): UseAutocompleteHook => {\n const dataList = useDataList({ useRouter: false, ...props });\n\n return {\n options: dataList.data || [],\n onInput: debounce(query => {\n if (!query) {\n return;\n }\n\n let search = props.search || query;\n if (typeof search === \"function\") {\n search = search(query);\n }\n\n dataList.setSearch(search);\n }, 250)\n };\n};\n"],"mappings":";;;;;;;;;;;;;AAAA;;AAcO,IAAMA,eAAe,GAAG,SAAlBA,eAAkB,CAACC,KAAD,EAAuC;EAClE,IAAMC,QAAQ,GAAG,IAAAC,wBAAA;IAAcC,SAAS,EAAE;EAAzB,GAAmCH,KAAnC,EAAjB;EAEA,OAAO;IACHI,OAAO,EAAEH,QAAQ,CAACI,IAAT,IAAiB,EADvB;IAEHC,OAAO,EAAE,wBAAS,UAAAC,KAAK,EAAI;MACvB,IAAI,CAACA,KAAL,EAAY;QACR;MACH;;MAED,IAAIC,MAAM,GAAGR,KAAK,CAACQ,MAAN,IAAgBD,KAA7B;;MACA,IAAI,OAAOC,MAAP,KAAkB,UAAtB,EAAkC;QAC9BA,MAAM,GAAGA,MAAM,CAACD,KAAD,CAAf;MACH;;MAEDN,QAAQ,CAACQ,SAAT,CAAmBD,MAAnB;IACH,CAXQ,EAWN,GAXM;EAFN,CAAP;AAeH,CAlBM"}
@@ -0,0 +1,2 @@
1
+ declare const _default: (response: Record<string, string>) => string | null;
2
+ export default _default;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.default = void 0;
9
+
10
+ var _searchDataByKey = _interopRequireDefault(require("./searchDataByKey"));
11
+
12
+ var _default = function _default(response) {
13
+ return (0, _searchDataByKey.default)("data", response);
14
+ };
15
+
16
+ exports.default = _default;
@@ -0,0 +1 @@
1
+ {"version":3,"names":["response","searchDataByKey"],"sources":["getData.ts"],"sourcesContent":["import searchDataByKey from \"./searchDataByKey\";\n\nexport default (response: Record<string, string>) => searchDataByKey(\"data\", response);\n"],"mappings":";;;;;;;;;AAAA;;eAEe,kBAACA,QAAD;EAAA,OAAsC,IAAAC,wBAAA,EAAgB,MAAhB,EAAwBD,QAAxB,CAAtC;AAAA,C"}
@@ -0,0 +1,2 @@
1
+ declare const _default: (response: Record<string, string>) => string | null;
2
+ export default _default;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.default = void 0;
9
+
10
+ var _searchDataByKey = _interopRequireDefault(require("./searchDataByKey"));
11
+
12
+ var _default = function _default(response) {
13
+ return (0, _searchDataByKey.default)("error", response);
14
+ };
15
+
16
+ exports.default = _default;
@@ -0,0 +1 @@
1
+ {"version":3,"names":["response","searchDataByKey"],"sources":["getError.ts"],"sourcesContent":["import searchDataByKey from \"./searchDataByKey\";\n\nexport default (response: Record<string, string>) => searchDataByKey(\"error\", response);\n"],"mappings":";;;;;;;;;AAAA;;eAEe,kBAACA,QAAD;EAAA,OAAsC,IAAAC,wBAAA,EAAgB,OAAhB,EAAyBD,QAAzB,CAAtC;AAAA,C"}
@@ -0,0 +1,2 @@
1
+ declare const _default: (response: Record<string, string>) => string | null;
2
+ export default _default;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.default = void 0;
9
+
10
+ var _searchDataByKey = _interopRequireDefault(require("./searchDataByKey"));
11
+
12
+ var _default = function _default(response) {
13
+ return (0, _searchDataByKey.default)("meta", response);
14
+ };
15
+
16
+ exports.default = _default;
@@ -0,0 +1 @@
1
+ {"version":3,"names":["response","searchDataByKey"],"sources":["getMeta.ts"],"sourcesContent":["import searchDataByKey from \"./searchDataByKey\";\n\nexport default (response: Record<string, string>) => searchDataByKey(\"meta\", response);\n"],"mappings":";;;;;;;;;AAAA;;eAEe,kBAACA,QAAD;EAAA,OAAsC,IAAAC,wBAAA,EAAgB,MAAhB,EAAwBD,QAAxB,CAAtC;AAAA,C"}
@@ -0,0 +1,3 @@
1
+ export { default as getData } from "./getData";
2
+ export { default as getError } from "./getError";
3
+ export { default as getMeta } from "./getMeta";
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ Object.defineProperty(exports, "getData", {
9
+ enumerable: true,
10
+ get: function get() {
11
+ return _getData.default;
12
+ }
13
+ });
14
+ Object.defineProperty(exports, "getError", {
15
+ enumerable: true,
16
+ get: function get() {
17
+ return _getError.default;
18
+ }
19
+ });
20
+ Object.defineProperty(exports, "getMeta", {
21
+ enumerable: true,
22
+ get: function get() {
23
+ return _getMeta.default;
24
+ }
25
+ });
26
+
27
+ var _getData = _interopRequireDefault(require("./getData"));
28
+
29
+ var _getError = _interopRequireDefault(require("./getError"));
30
+
31
+ var _getMeta = _interopRequireDefault(require("./getMeta"));
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export { default as getData } from \"./getData\";\nexport { default as getError } from \"./getError\";\nexport { default as getMeta } from \"./getMeta\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA"}
@@ -0,0 +1,2 @@
1
+ declare const searchDataByKey: (searchKey: string, object: Record<string, any>) => string | null;
2
+ export default searchDataByKey;
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var searchDataByKey = function searchDataByKey(searchKey, object) {
9
+ if (!object || typeof object !== "object") {
10
+ return null;
11
+ }
12
+
13
+ if (object[searchKey]) {
14
+ return object[searchKey];
15
+ }
16
+
17
+ for (var key in object) {
18
+ var value = searchDataByKey(searchKey, object[key]);
19
+
20
+ if (value) {
21
+ return value;
22
+ }
23
+ }
24
+
25
+ return null;
26
+ };
27
+
28
+ var _default = searchDataByKey;
29
+ exports.default = _default;
@@ -0,0 +1 @@
1
+ {"version":3,"names":["searchDataByKey","searchKey","object","key","value"],"sources":["searchDataByKey.ts"],"sourcesContent":["const searchDataByKey = (searchKey: string, object: Record<string, any>): string | null => {\n if (!object || typeof object !== \"object\") {\n return null;\n }\n\n if (object[searchKey]) {\n return object[searchKey];\n }\n\n for (const key in object) {\n const value = searchDataByKey(searchKey, object[key]);\n if (value) {\n return value;\n }\n }\n\n return null;\n};\n\nexport default searchDataByKey;\n"],"mappings":";;;;;;;AAAA,IAAMA,eAAe,GAAG,SAAlBA,eAAkB,CAACC,SAAD,EAAoBC,MAApB,EAAmE;EACvF,IAAI,CAACA,MAAD,IAAW,OAAOA,MAAP,KAAkB,QAAjC,EAA2C;IACvC,OAAO,IAAP;EACH;;EAED,IAAIA,MAAM,CAACD,SAAD,CAAV,EAAuB;IACnB,OAAOC,MAAM,CAACD,SAAD,CAAb;EACH;;EAED,KAAK,IAAME,GAAX,IAAkBD,MAAlB,EAA0B;IACtB,IAAME,KAAK,GAAGJ,eAAe,CAACC,SAAD,EAAYC,MAAM,CAACC,GAAD,CAAlB,CAA7B;;IACA,IAAIC,KAAJ,EAAW;MACP,OAAOA,KAAP;IACH;EACJ;;EAED,OAAO,IAAP;AACH,CAjBD;;eAmBeJ,e"}
@@ -0,0 +1 @@
1
+ export { useDataList } from "./useDataList";
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "useDataList", {
7
+ enumerable: true,
8
+ get: function get() {
9
+ return _useDataList.useDataList;
10
+ }
11
+ });
12
+
13
+ var _useDataList = require("./useDataList");
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export { useDataList } from \"./useDataList\";\n"],"mappings":";;;;;;;;;;;;AAAA"}
@@ -0,0 +1,36 @@
1
+ import { DocumentNode } from "graphql";
2
+ import { ApolloClient } from "apollo-client";
3
+ export interface UseDataListParams {
4
+ useRouter?: boolean;
5
+ variables?: ((params: UseDataListParams) => any) | object;
6
+ client?: ApolloClient<any>;
7
+ query: DocumentNode;
8
+ getData?: (data: any) => any;
9
+ getMeta?: (data: any) => any;
10
+ getError?: (data: any) => any;
11
+ }
12
+ export interface DataListProps {
13
+ __loadParams: any;
14
+ refresh: (params?: any) => void;
15
+ data: any[];
16
+ meta: any;
17
+ error: any;
18
+ loading: boolean;
19
+ isSelected: (item: any) => boolean;
20
+ select: (item: any) => void;
21
+ isMultiSelected: (item: any) => boolean;
22
+ isNoneMultiSelected: () => boolean;
23
+ isAllMultiSelected: () => boolean;
24
+ multiSelectAll: (value: boolean) => void;
25
+ getMultiSelected: () => any[];
26
+ setSearch: (search: any) => void;
27
+ setWhere: (where: any) => void;
28
+ setSorters: (sort: any) => void;
29
+ setPerPage: (perPage: number) => void;
30
+ setPreviousPage: (cursor: string) => void;
31
+ setNextPage: (cursor: string) => void;
32
+ multiSelect: (items: string | string[], value?: boolean) => void;
33
+ init: () => void;
34
+ }
35
+ declare const useDataList: (params: UseDataListParams) => DataListProps;
36
+ export { useDataList };