@gravity-ui/data-source 0.10.0-alpha.3 → 0.10.0-alpha.5
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/build/cjs/react/components/Async/Async.d.ts +3 -0
- package/build/cjs/react/components/Async/Async.js +18 -0
- package/build/cjs/react/components/Async/Async.js.map +1 -0
- package/build/cjs/react/components/Async/index.d.ts +3 -0
- package/build/cjs/react/components/Async/index.js +20 -0
- package/build/cjs/react/components/Async/index.js.map +1 -0
- package/build/cjs/react/components/Async/types.d.ts +9 -0
- package/build/cjs/react/components/Async/types.js +6 -0
- package/build/cjs/react/components/Async/types.js.map +1 -0
- package/build/cjs/react/components/Async/withAsync.d.ts +3 -0
- package/build/cjs/react/components/Async/withAsync.js +26 -0
- package/build/cjs/react/components/Async/withAsync.js.map +1 -0
- package/build/cjs/react/components/AsyncBoundary/AsyncBoundary.js +3 -2
- package/build/cjs/react/components/AsyncBoundary/AsyncBoundary.js.map +1 -1
- package/build/cjs/react/components/AsyncBoundary/types.d.ts +3 -3
- package/build/cjs/react/components/AsyncBoundary/types.js.map +1 -1
- package/build/cjs/react/components/AsyncBoundary/withAsyncBoundary.d.ts +3 -2
- package/build/cjs/react/components/AsyncBoundary/withAsyncBoundary.js +9 -5
- package/build/cjs/react/components/AsyncBoundary/withAsyncBoundary.js.map +1 -1
- package/build/cjs/react/index.d.ts +1 -0
- package/build/cjs/react/index.js +12 -0
- package/build/cjs/react/index.js.map +1 -1
- package/build/cjs/react-query/components/QueryAsyncBoundary/types.d.ts +5 -4
- package/build/cjs/react-query/components/QueryAsyncBoundary/types.js.map +1 -1
- package/build/cjs/react-query/components/QueryAsyncBoundary/withQueryAsyncBoundary.d.ts +3 -2
- package/build/cjs/react-query/components/QueryAsyncBoundary/withQueryAsyncBoundary.js +9 -5
- package/build/cjs/react-query/components/QueryAsyncBoundary/withQueryAsyncBoundary.js.map +1 -1
- package/build/esm/react/components/Async/Async.d.ts +3 -0
- package/build/esm/react/components/Async/Async.js +11 -0
- package/build/esm/react/components/Async/Async.js.map +1 -0
- package/build/esm/react/components/Async/index.d.ts +3 -0
- package/build/esm/react/components/Async/index.js +3 -0
- package/build/esm/react/components/Async/index.js.map +1 -0
- package/build/esm/react/components/Async/types.d.ts +9 -0
- package/build/esm/react/components/Async/types.js +2 -0
- package/build/esm/react/components/Async/types.js.map +1 -0
- package/build/esm/react/components/Async/withAsync.d.ts +3 -0
- package/build/esm/react/components/Async/withAsync.js +19 -0
- package/build/esm/react/components/Async/withAsync.js.map +1 -0
- package/build/esm/react/components/AsyncBoundary/AsyncBoundary.js +3 -2
- package/build/esm/react/components/AsyncBoundary/AsyncBoundary.js.map +1 -1
- package/build/esm/react/components/AsyncBoundary/types.d.ts +3 -3
- package/build/esm/react/components/AsyncBoundary/types.js.map +1 -1
- package/build/esm/react/components/AsyncBoundary/withAsyncBoundary.d.ts +3 -2
- package/build/esm/react/components/AsyncBoundary/withAsyncBoundary.js +9 -5
- package/build/esm/react/components/AsyncBoundary/withAsyncBoundary.js.map +1 -1
- package/build/esm/react/index.d.ts +1 -0
- package/build/esm/react/index.js +1 -0
- package/build/esm/react/index.js.map +1 -1
- package/build/esm/react-query/components/QueryAsyncBoundary/types.d.ts +5 -4
- package/build/esm/react-query/components/QueryAsyncBoundary/types.js.map +1 -1
- package/build/esm/react-query/components/QueryAsyncBoundary/withQueryAsyncBoundary.d.ts +3 -2
- package/build/esm/react-query/components/QueryAsyncBoundary/withQueryAsyncBoundary.js +9 -5
- package/build/esm/react-query/components/QueryAsyncBoundary/withQueryAsyncBoundary.js.map +1 -1
- package/build/plugin/typings/client.d.ts +12 -4
- package/package.json +1 -1
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Async = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
+
var Async = exports.Async = function Async(_ref) {
|
|
11
|
+
var LoadingView = _ref.LoadingView,
|
|
12
|
+
children = _ref.children;
|
|
13
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_react.default.Suspense, {
|
|
14
|
+
fallback: /*#__PURE__*/(0, _jsxRuntime.jsx)(LoadingView, {}),
|
|
15
|
+
children: children
|
|
16
|
+
});
|
|
17
|
+
};
|
|
18
|
+
// #sourceMappingURL=Async.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireDefault","require","_jsxRuntime","e","__esModule","default","Async","exports","_ref","LoadingView","children","_jsx","React","Suspense","fallback"],"sources":["Async.tsx"],"sourcesContent":["import React from 'react';\n\nimport type {AsyncProps} from './types';\n\nexport const Async: React.FC<AsyncProps> = ({LoadingView, children}) => {\n return <React.Suspense fallback={<LoadingView />}>{children}</React.Suspense>;\n};\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAA0B,IAAAC,WAAA,GAAAD,OAAA;AAAA,SAAAD,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAInB,IAAMG,KAA2B,GAAAC,OAAA,CAAAD,KAAA,GAAG,SAA9BA,KAA2BA,CAAAE,IAAA,EAAgC;EAAA,IAA3BC,WAAW,GAAAD,IAAA,CAAXC,WAAW;IAAEC,QAAQ,GAAAF,IAAA,CAARE,QAAQ;EAC9D,oBAAO,IAAAC,eAAA,EAACC,cAAK,CAACC,QAAQ;IAACC,QAAQ,eAAE,IAAAH,eAAA,EAACF,WAAW,IAAE,CAAE;IAAAC,QAAA,EAAEA;EAAQ,CAAiB,CAAC;AACjF,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "Async", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _Async.Async;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "withAsync", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _withAsync.withAsync;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
var _Async = require("./Async");
|
|
19
|
+
var _withAsync = require("./withAsync");
|
|
20
|
+
// #sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_Async","require","_withAsync"],"sources":["index.ts"],"sourcesContent":["export type {AsyncProps, AsyncComponent} from './types';\nexport {Async} from './Async';\nexport {withAsync} from './withAsync';\n"],"mappings":";;;;;;;;;;;;;;;;;AACA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA","ignoreList":[]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ComponentType, ReactNode } from 'react';
|
|
2
|
+
export interface AsyncProps {
|
|
3
|
+
LoadingView: ComponentType;
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
}
|
|
6
|
+
export interface AsyncComponent<TProps extends object = {}, TLoadingProps extends object = {}> extends React.FC<TProps & TLoadingProps> {
|
|
7
|
+
Content: React.ComponentType<TProps>;
|
|
8
|
+
Loading: ComponentType<TLoadingProps & Partial<TProps>>;
|
|
9
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type {ComponentType, ReactNode} from 'react';\n\nexport interface AsyncProps {\n LoadingView: ComponentType;\n children: ReactNode;\n}\n\nexport interface AsyncComponent<TProps extends object = {}, TLoadingProps extends object = {}>\n extends React.FC<TProps & TLoadingProps> {\n Content: React.ComponentType<TProps>;\n Loading: ComponentType<TLoadingProps & Partial<TProps>>;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { AsyncComponent } from './types';
|
|
3
|
+
export declare const withAsync: <TProps extends object = {}, TLoadingProps extends object = {}>(Component: React.ComponentType<TProps>, LoadingView: React.ComponentType<TLoadingProps & Partial<TProps>>) => AsyncComponent<TProps, TLoadingProps>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.withAsync = void 0;
|
|
7
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _Async = require("./Async");
|
|
10
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
|
+
var withAsync = exports.withAsync = function withAsync(Component, _LoadingView) {
|
|
13
|
+
var WrappedComponent = function WrappedComponent(props) {
|
|
14
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Async.Async, {
|
|
15
|
+
LoadingView: function LoadingView() {
|
|
16
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_LoadingView, (0, _objectSpread2.default)({}, props));
|
|
17
|
+
},
|
|
18
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(Component, (0, _objectSpread2.default)({}, props))
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
WrappedComponent.displayName = "WithAsync(".concat(Component.displayName || Component.name, ")");
|
|
22
|
+
WrappedComponent.Content = Component;
|
|
23
|
+
WrappedComponent.Loading = _LoadingView;
|
|
24
|
+
return WrappedComponent;
|
|
25
|
+
};
|
|
26
|
+
// #sourceMappingURL=withAsync.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireDefault","require","_Async","_jsxRuntime","e","__esModule","default","withAsync","exports","Component","_LoadingView","WrappedComponent","props","_jsx","Async","LoadingView","_objectSpread","children","displayName","concat","name","Content","Loading"],"sources":["withAsync.tsx"],"sourcesContent":["import React from 'react';\n\nimport {Async} from './Async';\nimport type {AsyncComponent} from './types';\n\nexport const withAsync = <TProps extends object = {}, TLoadingProps extends object = {}>(\n Component: React.ComponentType<TProps>,\n LoadingView: React.ComponentType<TLoadingProps & Partial<TProps>>,\n) => {\n const WrappedComponent = ((props: TProps & TLoadingProps) => (\n <Async LoadingView={() => <LoadingView {...props} />}>\n <Component {...props} />\n </Async>\n )) as AsyncComponent<TProps, TLoadingProps>;\n\n WrappedComponent.displayName = `WithAsync(${Component.displayName || Component.name})`;\n\n WrappedComponent.Content = Component;\n WrappedComponent.Loading = LoadingView;\n\n return WrappedComponent;\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,MAAA,GAAAD,OAAA;AAA8B,IAAAE,WAAA,GAAAF,OAAA;AAAA,SAAAD,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAGvB,IAAMG,SAAS,GAAAC,OAAA,CAAAD,SAAA,GAAG,SAAZA,SAASA,CAClBE,SAAsC,EACtCC,YAAiE,EAChE;EACD,IAAMC,gBAAgB,GAAI,SAApBA,gBAAgBA,CAAKC,KAA6B;IAAA,oBACpD,IAAAC,eAAA,EAACC,YAAK;MAACC,WAAW,EAAE,SAAbA,WAAWA,CAAA;QAAA,oBAAQ,IAAAF,eAAA,EAACH,YAAW,MAAAM,sBAAA,MAAKJ,KAAK,CAAG,CAAC;MAAA,CAAC;MAAAK,QAAA,eACjD,IAAAJ,eAAA,EAACJ,SAAS,MAAAO,sBAAA,MAAKJ,KAAK,CAAG;IAAC,CACrB,CAAC;EAAA,CAC+B;EAE3CD,gBAAgB,CAACO,WAAW,gBAAAC,MAAA,CAAgBV,SAAS,CAACS,WAAW,IAAIT,SAAS,CAACW,IAAI,MAAG;EAEtFT,gBAAgB,CAACU,OAAO,GAAGZ,SAAS;EACpCE,gBAAgB,CAACW,OAAO,GAAGZ,YAAW;EAEtC,OAAOC,gBAAgB;AAC3B,CAAC","ignoreList":[]}
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.AsyncBoundary = void 0;
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
8
|
var _reactErrorBoundary = require("react-error-boundary");
|
|
9
|
+
var _Async = require("../Async");
|
|
9
10
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
10
11
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
12
|
var AsyncBoundary = exports.AsyncBoundary = function AsyncBoundary(_ref) {
|
|
@@ -26,8 +27,8 @@ var AsyncBoundary = exports.AsyncBoundary = function AsyncBoundary(_ref) {
|
|
|
26
27
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactErrorBoundary.ErrorBoundary, {
|
|
27
28
|
fallbackRender: fallbackRender,
|
|
28
29
|
onReset: onReset,
|
|
29
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
30
|
-
|
|
30
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Async.Async, {
|
|
31
|
+
LoadingView: LoadingView,
|
|
31
32
|
children: children
|
|
32
33
|
})
|
|
33
34
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireDefault","require","_reactErrorBoundary","_jsxRuntime","e","__esModule","default","AsyncBoundary","exports","_ref","LoadingView","ErrorView","onReset","children","fallbackRender","React","useCallback","_ref2","error","resetErrorBoundary","_jsx","action","handler","ErrorBoundary","
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireDefault","require","_reactErrorBoundary","_Async","_jsxRuntime","e","__esModule","default","AsyncBoundary","exports","_ref","LoadingView","ErrorView","onReset","children","fallbackRender","React","useCallback","_ref2","error","resetErrorBoundary","_jsx","action","handler","ErrorBoundary","Async"],"sources":["AsyncBoundary.tsx"],"sourcesContent":["import React from 'react';\n\nimport type {FallbackProps} from 'react-error-boundary';\nimport {ErrorBoundary} from 'react-error-boundary';\n\nimport {Async} from '../Async';\n\nimport type {AsyncBoundaryProps} from './types';\n\nexport const AsyncBoundary: React.FC<AsyncBoundaryProps> = ({\n LoadingView,\n ErrorView,\n onReset,\n children,\n}) => {\n const fallbackRender = React.useCallback(\n ({error, resetErrorBoundary}: FallbackProps) => (\n <ErrorView error={error} action={{handler: resetErrorBoundary}} />\n ),\n [ErrorView],\n );\n\n return (\n <ErrorBoundary fallbackRender={fallbackRender} onReset={onReset}>\n <Async LoadingView={LoadingView}>{children}</Async>\n </ErrorBoundary>\n );\n};\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAGA,IAAAC,mBAAA,GAAAD,OAAA;AAEA,IAAAE,MAAA,GAAAF,OAAA;AAA+B,IAAAG,WAAA,GAAAH,OAAA;AAAA,SAAAD,uBAAAK,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAIxB,IAAMG,aAA2C,GAAAC,OAAA,CAAAD,aAAA,GAAG,SAA9CA,aAA2CA,CAAAE,IAAA,EAKlD;EAAA,IAJFC,WAAW,GAAAD,IAAA,CAAXC,WAAW;IACXC,SAAS,GAAAF,IAAA,CAATE,SAAS;IACTC,OAAO,GAAAH,IAAA,CAAPG,OAAO;IACPC,QAAQ,GAAAJ,IAAA,CAARI,QAAQ;EAER,IAAMC,cAAc,GAAGC,cAAK,CAACC,WAAW,CACpC,UAAAC,KAAA;IAAA,IAAEC,KAAK,GAAAD,KAAA,CAALC,KAAK;MAAEC,kBAAkB,GAAAF,KAAA,CAAlBE,kBAAkB;IAAA,oBACvB,IAAAC,eAAA,EAACT,SAAS;MAACO,KAAK,EAAEA,KAAM;MAACG,MAAM,EAAE;QAACC,OAAO,EAAEH;MAAkB;IAAE,CAAE,CAAC;EAAA,CACrE,EACD,CAACR,SAAS,CACd,CAAC;EAED,oBACI,IAAAS,eAAA,EAACG,iCAAa;IAACT,cAAc,EAAEA,cAAe;IAACF,OAAO,EAAEA,OAAQ;IAAAC,QAAA,eAC5D,IAAAO,eAAA,EAACI,YAAK;MAACd,WAAW,EAAEA,WAAY;MAAAG,QAAA,EAAEA;IAAQ,CAAQ;EAAC,CACxC,CAAC;AAExB,CAAC","ignoreList":[]}
|
|
@@ -6,8 +6,8 @@ export interface AsyncBoundaryProps {
|
|
|
6
6
|
onReset?: () => void;
|
|
7
7
|
children: ReactNode;
|
|
8
8
|
}
|
|
9
|
-
export interface AsyncBoundaryComponent<TProps extends object> extends React.FC<TProps
|
|
9
|
+
export interface AsyncBoundaryComponent<TProps extends object = {}, TLoadingProps extends object = {}, TErrorProps extends object = {}> extends React.FC<TProps & TLoadingProps & Omit<TErrorProps, keyof ErrorViewProps>> {
|
|
10
10
|
Content: React.ComponentType<TProps>;
|
|
11
|
-
Loading:
|
|
12
|
-
Error:
|
|
11
|
+
Loading: ComponentType<TLoadingProps & Partial<TProps>>;
|
|
12
|
+
Error: ComponentType<ErrorViewProps & TErrorProps & Partial<TProps>>;
|
|
13
13
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type {ComponentType, ReactNode} from 'react';\n\nimport type {ErrorViewProps} from '../types';\n\nexport interface AsyncBoundaryProps {\n LoadingView: ComponentType;\n ErrorView: ComponentType<ErrorViewProps>;\n onReset?: () => void;\n children: ReactNode;\n}\n\nexport interface AsyncBoundaryComponent
|
|
1
|
+
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type {ComponentType, ReactNode} from 'react';\n\nimport type {ErrorViewProps} from '../types';\n\nexport interface AsyncBoundaryProps {\n LoadingView: ComponentType;\n ErrorView: ComponentType<ErrorViewProps>;\n onReset?: () => void;\n children: ReactNode;\n}\n\nexport interface AsyncBoundaryComponent<\n TProps extends object = {},\n TLoadingProps extends object = {},\n TErrorProps extends object = {},\n> extends React.FC<TProps & TLoadingProps & Omit<TErrorProps, keyof ErrorViewProps>> {\n Content: React.ComponentType<TProps>;\n Loading: ComponentType<TLoadingProps & Partial<TProps>>;\n Error: ComponentType<ErrorViewProps & TErrorProps & Partial<TProps>>;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type {
|
|
3
|
-
|
|
2
|
+
import type { ErrorViewProps } from '../types';
|
|
3
|
+
import type { AsyncBoundaryComponent } from './types';
|
|
4
|
+
export declare const withAsyncBoundary: <TProps extends object = {}, TLoadingProps extends object = {}, TErrorProps extends object = {}>(Component: React.ComponentType<TProps>, LoadingView: React.ComponentType<TLoadingProps & Partial<TProps>>, ErrorView: React.ComponentType<ErrorViewProps & TErrorProps & Partial<TProps>>) => AsyncBoundaryComponent<TProps, TLoadingProps, TErrorProps>;
|
|
@@ -9,18 +9,22 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
9
9
|
var _AsyncBoundary = require("./AsyncBoundary");
|
|
10
10
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
11
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
|
-
var withAsyncBoundary = exports.withAsyncBoundary = function withAsyncBoundary(Component,
|
|
12
|
+
var withAsyncBoundary = exports.withAsyncBoundary = function withAsyncBoundary(Component, _LoadingView, _ErrorView) {
|
|
13
13
|
var WrappedComponent = function WrappedComponent(props) {
|
|
14
14
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_AsyncBoundary.AsyncBoundary, {
|
|
15
|
-
LoadingView: LoadingView
|
|
16
|
-
|
|
15
|
+
LoadingView: function LoadingView() {
|
|
16
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_LoadingView, (0, _objectSpread2.default)({}, props));
|
|
17
|
+
},
|
|
18
|
+
ErrorView: function ErrorView(errorProps) {
|
|
19
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ErrorView, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, props), errorProps));
|
|
20
|
+
},
|
|
17
21
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(Component, (0, _objectSpread2.default)({}, props))
|
|
18
22
|
});
|
|
19
23
|
};
|
|
20
24
|
WrappedComponent.displayName = "WithAsyncBoundary(".concat(Component.displayName || Component.name, ")");
|
|
21
25
|
WrappedComponent.Content = Component;
|
|
22
|
-
WrappedComponent.Loading =
|
|
23
|
-
WrappedComponent.Error =
|
|
26
|
+
WrappedComponent.Loading = _LoadingView;
|
|
27
|
+
WrappedComponent.Error = _ErrorView;
|
|
24
28
|
return WrappedComponent;
|
|
25
29
|
};
|
|
26
30
|
// #sourceMappingURL=withAsyncBoundary.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireDefault","require","_AsyncBoundary","_jsxRuntime","e","__esModule","default","withAsyncBoundary","exports","Component","
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireDefault","require","_AsyncBoundary","_jsxRuntime","e","__esModule","default","withAsyncBoundary","exports","Component","_LoadingView","_ErrorView","WrappedComponent","props","_jsx","AsyncBoundary","LoadingView","_objectSpread","ErrorView","errorProps","children","displayName","concat","name","Content","Loading","Error"],"sources":["withAsyncBoundary.tsx"],"sourcesContent":["import React from 'react';\n\nimport type {ErrorViewProps} from '../types';\n\nimport {AsyncBoundary} from './AsyncBoundary';\nimport type {AsyncBoundaryComponent} from './types';\n\nexport const withAsyncBoundary = <\n TProps extends object = {},\n TLoadingProps extends object = {},\n TErrorProps extends object = {},\n>(\n Component: React.ComponentType<TProps>,\n LoadingView: React.ComponentType<TLoadingProps & Partial<TProps>>,\n ErrorView: React.ComponentType<ErrorViewProps & TErrorProps & Partial<TProps>>,\n) => {\n const WrappedComponent = ((props: TProps & TLoadingProps & TErrorProps) => (\n <AsyncBoundary\n LoadingView={() => <LoadingView {...props} />}\n ErrorView={(errorProps) => <ErrorView {...props} {...errorProps} />}\n >\n <Component {...props} />\n </AsyncBoundary>\n )) as AsyncBoundaryComponent<TProps, TLoadingProps, TErrorProps>;\n\n WrappedComponent.displayName = `WithAsyncBoundary(${Component.displayName || Component.name})`;\n\n WrappedComponent.Content = Component;\n WrappedComponent.Loading = LoadingView;\n WrappedComponent.Error = ErrorView;\n\n return WrappedComponent;\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAIA,IAAAC,cAAA,GAAAD,OAAA;AAA8C,IAAAE,WAAA,GAAAF,OAAA;AAAA,SAAAD,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAGvC,IAAMG,iBAAiB,GAAAC,OAAA,CAAAD,iBAAA,GAAG,SAApBA,iBAAiBA,CAK1BE,SAAsC,EACtCC,YAAiE,EACjEC,UAA8E,EAC7E;EACD,IAAMC,gBAAgB,GAAI,SAApBA,gBAAgBA,CAAKC,KAA2C;IAAA,oBAClE,IAAAC,eAAA,EAACC,4BAAa;MACVC,WAAW,EAAE,SAAbA,WAAWA,CAAA;QAAA,oBAAQ,IAAAF,eAAA,EAACJ,YAAW,MAAAO,sBAAA,MAAKJ,KAAK,CAAG,CAAC;MAAA,CAAC;MAC9CK,SAAS,EAAE,SAAXA,SAASA,CAAGC,UAAU;QAAA,oBAAK,IAAAL,eAAA,EAACH,UAAS,MAAAM,sBAAA,MAAAA,sBAAA,MAAKJ,KAAK,GAAMM,UAAU,CAAG,CAAC;MAAA,CAAC;MAAAC,QAAA,eAEpE,IAAAN,eAAA,EAACL,SAAS,MAAAQ,sBAAA,MAAKJ,KAAK,CAAG;IAAC,CACb,CAAC;EAAA,CAC4C;EAEhED,gBAAgB,CAACS,WAAW,wBAAAC,MAAA,CAAwBb,SAAS,CAACY,WAAW,IAAIZ,SAAS,CAACc,IAAI,MAAG;EAE9FX,gBAAgB,CAACY,OAAO,GAAGf,SAAS;EACpCG,gBAAgB,CAACa,OAAO,GAAGf,YAAW;EACtCE,gBAAgB,CAACc,KAAK,GAAGf,UAAS;EAElC,OAAOC,gBAAgB;AAC3B,CAAC","ignoreList":[]}
|
package/build/cjs/react/index.js
CHANGED
|
@@ -33,6 +33,18 @@ Object.defineProperty(exports, "withDataManager", {
|
|
|
33
33
|
return _withDataManager.withDataManager;
|
|
34
34
|
}
|
|
35
35
|
});
|
|
36
|
+
var _Async = require("./components/Async");
|
|
37
|
+
Object.keys(_Async).forEach(function (key) {
|
|
38
|
+
if (key === "default" || key === "__esModule") return;
|
|
39
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
40
|
+
if (key in exports && exports[key] === _Async[key]) return;
|
|
41
|
+
Object.defineProperty(exports, key, {
|
|
42
|
+
enumerable: true,
|
|
43
|
+
get: function () {
|
|
44
|
+
return _Async[key];
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
});
|
|
36
48
|
var _AsyncBoundary = require("./components/AsyncBoundary");
|
|
37
49
|
Object.keys(_AsyncBoundary).forEach(function (key) {
|
|
38
50
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["_Async","require","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_AsyncBoundary","_DataLoader","_DataInfiniteLoader","_EmptyView","_DataManagerContext","_DataManagerProvider","_withDataManager"],"sources":["index.ts"],"sourcesContent":["export * from './components/Async';\nexport * from './components/AsyncBoundary';\nexport * from './components/DataLoader';\nexport * from './components/DataInfiniteLoader';\nexport * from './components/EmptyView';\nexport type {ErrorAction, ErrorViewProps} from './components/types';\n\nexport {DataManagerContext, useDataManager} from './DataManagerContext';\nexport {DataManagerProvider} from './DataManagerProvider';\nexport type {DataManagerProviderProps} from './DataManagerProvider';\nexport type {WithDataManagerProps} from './withDataManager';\nexport {withDataManager} from './withDataManager';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,MAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAL,MAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAb,MAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAS,cAAA,GAAAb,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAW,cAAA,EAAAV,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAS,cAAA,CAAAT,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,cAAA,CAAAT,GAAA;IAAA;EAAA;AAAA;AACA,IAAAU,WAAA,GAAAd,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAY,WAAA,EAAAX,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAU,WAAA,CAAAV,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAE,WAAA,CAAAV,GAAA;IAAA;EAAA;AAAA;AACA,IAAAW,mBAAA,GAAAf,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAa,mBAAA,EAAAZ,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAW,mBAAA,CAAAX,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAG,mBAAA,CAAAX,GAAA;IAAA;EAAA;AAAA;AACA,IAAAY,UAAA,GAAAhB,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAc,UAAA,EAAAb,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAY,UAAA,CAAAZ,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAI,UAAA,CAAAZ,GAAA;IAAA;EAAA;AAAA;AAGA,IAAAa,mBAAA,GAAAjB,OAAA;AACA,IAAAkB,oBAAA,GAAAlB,OAAA;AAGA,IAAAmB,gBAAA,GAAAnB,OAAA","ignoreList":[]}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ComponentType } from 'react';
|
|
2
|
+
import type { AsyncBoundaryProps, ErrorViewProps } from '../../../react';
|
|
2
3
|
export interface QueryAsyncBoundaryProps extends AsyncBoundaryProps {
|
|
3
4
|
}
|
|
4
|
-
export interface QueryAsyncBoundaryComponent<TProps extends object> extends React.FC<TProps
|
|
5
|
+
export interface QueryAsyncBoundaryComponent<TProps extends object = {}, TLoadingProps extends object = {}, TErrorProps extends object = {}> extends React.FC<TProps & TLoadingProps & Omit<TErrorProps, keyof ErrorViewProps>> {
|
|
5
6
|
Content: React.ComponentType<TProps>;
|
|
6
|
-
Loading:
|
|
7
|
-
Error:
|
|
7
|
+
Loading: ComponentType<TLoadingProps & Partial<TProps>>;
|
|
8
|
+
Error: ComponentType<ErrorViewProps & TErrorProps & Partial<TProps>>;
|
|
8
9
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type {AsyncBoundaryProps} from '../../../react';\n\nexport interface QueryAsyncBoundaryProps extends AsyncBoundaryProps {}\n\nexport interface QueryAsyncBoundaryComponent
|
|
1
|
+
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type {ComponentType} from 'react';\n\nimport type {AsyncBoundaryProps, ErrorViewProps} from '../../../react';\n\nexport interface QueryAsyncBoundaryProps extends AsyncBoundaryProps {}\n\nexport interface QueryAsyncBoundaryComponent<\n TProps extends object = {},\n TLoadingProps extends object = {},\n TErrorProps extends object = {},\n> extends React.FC<TProps & TLoadingProps & Omit<TErrorProps, keyof ErrorViewProps>> {\n Content: React.ComponentType<TProps>;\n Loading: ComponentType<TLoadingProps & Partial<TProps>>;\n Error: ComponentType<ErrorViewProps & TErrorProps & Partial<TProps>>;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type {
|
|
3
|
-
|
|
2
|
+
import type { ErrorViewProps } from '../../../react';
|
|
3
|
+
import type { QueryAsyncBoundaryComponent } from './types';
|
|
4
|
+
export declare const withQueryAsyncBoundary: <TProps extends object = {}, TLoadingProps extends object = {}, TErrorProps extends object = {}>(Component: React.ComponentType<TProps>, LoadingView: React.ComponentType<TLoadingProps & Partial<TProps>>, ErrorView: React.ComponentType<ErrorViewProps & TErrorProps & Partial<TProps>>) => QueryAsyncBoundaryComponent<TProps, TLoadingProps, TErrorProps>;
|
|
@@ -9,18 +9,22 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
9
9
|
var _QueryAsyncBoundary = require("./QueryAsyncBoundary");
|
|
10
10
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
11
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
|
-
var withQueryAsyncBoundary = exports.withQueryAsyncBoundary = function withQueryAsyncBoundary(Component,
|
|
12
|
+
var withQueryAsyncBoundary = exports.withQueryAsyncBoundary = function withQueryAsyncBoundary(Component, _LoadingView, _ErrorView) {
|
|
13
13
|
var WrappedComponent = function WrappedComponent(props) {
|
|
14
14
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_QueryAsyncBoundary.QueryAsyncBoundary, {
|
|
15
|
-
LoadingView: LoadingView
|
|
16
|
-
|
|
15
|
+
LoadingView: function LoadingView() {
|
|
16
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_LoadingView, (0, _objectSpread2.default)({}, props));
|
|
17
|
+
},
|
|
18
|
+
ErrorView: function ErrorView(errorProps) {
|
|
19
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ErrorView, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, props), errorProps));
|
|
20
|
+
},
|
|
17
21
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(Component, (0, _objectSpread2.default)({}, props))
|
|
18
22
|
});
|
|
19
23
|
};
|
|
20
24
|
WrappedComponent.displayName = "WithQueryAsyncBoundary(".concat(Component.displayName || Component.name, ")");
|
|
21
25
|
WrappedComponent.Content = Component;
|
|
22
|
-
WrappedComponent.Loading =
|
|
23
|
-
WrappedComponent.Error =
|
|
26
|
+
WrappedComponent.Loading = _LoadingView;
|
|
27
|
+
WrappedComponent.Error = _ErrorView;
|
|
24
28
|
return WrappedComponent;
|
|
25
29
|
};
|
|
26
30
|
// #sourceMappingURL=withQueryAsyncBoundary.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireDefault","require","_QueryAsyncBoundary","_jsxRuntime","e","__esModule","default","withQueryAsyncBoundary","exports","Component","
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireDefault","require","_QueryAsyncBoundary","_jsxRuntime","e","__esModule","default","withQueryAsyncBoundary","exports","Component","_LoadingView","_ErrorView","WrappedComponent","props","_jsx","QueryAsyncBoundary","LoadingView","_objectSpread","ErrorView","errorProps","children","displayName","concat","name","Content","Loading","Error"],"sources":["withQueryAsyncBoundary.tsx"],"sourcesContent":["import React from 'react';\n\nimport type {ErrorViewProps} from '../../../react';\n\nimport {QueryAsyncBoundary} from './QueryAsyncBoundary';\nimport type {QueryAsyncBoundaryComponent} from './types';\n\nexport const withQueryAsyncBoundary = <\n TProps extends object = {},\n TLoadingProps extends object = {},\n TErrorProps extends object = {},\n>(\n Component: React.ComponentType<TProps>,\n LoadingView: React.ComponentType<TLoadingProps & Partial<TProps>>,\n ErrorView: React.ComponentType<ErrorViewProps & TErrorProps & Partial<TProps>>,\n) => {\n const WrappedComponent = ((props: TProps & TLoadingProps & TErrorProps) => (\n <QueryAsyncBoundary\n LoadingView={() => <LoadingView {...props} />}\n ErrorView={(errorProps) => <ErrorView {...props} {...errorProps} />}\n >\n <Component {...props} />\n </QueryAsyncBoundary>\n )) as QueryAsyncBoundaryComponent<TProps, TLoadingProps, TErrorProps>;\n\n WrappedComponent.displayName = `WithQueryAsyncBoundary(${\n Component.displayName || Component.name\n })`;\n\n WrappedComponent.Content = Component;\n WrappedComponent.Loading = LoadingView;\n WrappedComponent.Error = ErrorView;\n\n return WrappedComponent;\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAIA,IAAAC,mBAAA,GAAAD,OAAA;AAAwD,IAAAE,WAAA,GAAAF,OAAA;AAAA,SAAAD,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAGjD,IAAMG,sBAAsB,GAAAC,OAAA,CAAAD,sBAAA,GAAG,SAAzBA,sBAAsBA,CAK/BE,SAAsC,EACtCC,YAAiE,EACjEC,UAA8E,EAC7E;EACD,IAAMC,gBAAgB,GAAI,SAApBA,gBAAgBA,CAAKC,KAA2C;IAAA,oBAClE,IAAAC,eAAA,EAACC,sCAAkB;MACfC,WAAW,EAAE,SAAbA,WAAWA,CAAA;QAAA,oBAAQ,IAAAF,eAAA,EAACJ,YAAW,MAAAO,sBAAA,MAAKJ,KAAK,CAAG,CAAC;MAAA,CAAC;MAC9CK,SAAS,EAAE,SAAXA,SAASA,CAAGC,UAAU;QAAA,oBAAK,IAAAL,eAAA,EAACH,UAAS,MAAAM,sBAAA,MAAAA,sBAAA,MAAKJ,KAAK,GAAMM,UAAU,CAAG,CAAC;MAAA,CAAC;MAAAC,QAAA,eAEpE,IAAAN,eAAA,EAACL,SAAS,MAAAQ,sBAAA,MAAKJ,KAAK,CAAG;IAAC,CACR,CAAC;EAAA,CAC4C;EAErED,gBAAgB,CAACS,WAAW,6BAAAC,MAAA,CACxBb,SAAS,CAACY,WAAW,IAAIZ,SAAS,CAACc,IAAI,MACxC;EAEHX,gBAAgB,CAACY,OAAO,GAAGf,SAAS;EACpCG,gBAAgB,CAACa,OAAO,GAAGf,YAAW;EACtCE,gBAAgB,CAACc,KAAK,GAAGf,UAAS;EAElC,OAAOC,gBAAgB;AAC3B,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
export var Async = function Async(_ref) {
|
|
4
|
+
var LoadingView = _ref.LoadingView,
|
|
5
|
+
children = _ref.children;
|
|
6
|
+
return /*#__PURE__*/_jsx(React.Suspense, {
|
|
7
|
+
fallback: /*#__PURE__*/_jsx(LoadingView, {}),
|
|
8
|
+
children: children
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
// #sourceMappingURL=Async.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","jsx","_jsx","Async","_ref","LoadingView","children","Suspense","fallback"],"sources":["Async.tsx"],"sourcesContent":["import React from 'react';\n\nimport type {AsyncProps} from './types';\n\nexport const Async: React.FC<AsyncProps> = ({LoadingView, children}) => {\n return <React.Suspense fallback={<LoadingView />}>{children}</React.Suspense>;\n};\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAI1B,OAAO,IAAMC,KAA2B,GAAG,SAA9BA,KAA2BA,CAAAC,IAAA,EAAgC;EAAA,IAA3BC,WAAW,GAAAD,IAAA,CAAXC,WAAW;IAAEC,QAAQ,GAAAF,IAAA,CAARE,QAAQ;EAC9D,oBAAOJ,IAAA,CAACF,KAAK,CAACO,QAAQ;IAACC,QAAQ,eAAEN,IAAA,CAACG,WAAW,IAAE,CAAE;IAAAC,QAAA,EAAEA;EAAQ,CAAiB,CAAC;AACjF,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Async","withAsync"],"sources":["index.ts"],"sourcesContent":["export type {AsyncProps, AsyncComponent} from './types';\nexport {Async} from './Async';\nexport {withAsync} from './withAsync';\n"],"mappings":"AACA,SAAQA,KAAK,QAAO,SAAS;AAC7B,SAAQC,SAAS,QAAO,aAAa","ignoreList":[]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ComponentType, ReactNode } from 'react';
|
|
2
|
+
export interface AsyncProps {
|
|
3
|
+
LoadingView: ComponentType;
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
}
|
|
6
|
+
export interface AsyncComponent<TProps extends object = {}, TLoadingProps extends object = {}> extends React.FC<TProps & TLoadingProps> {
|
|
7
|
+
Content: React.ComponentType<TProps>;
|
|
8
|
+
Loading: ComponentType<TLoadingProps & Partial<TProps>>;
|
|
9
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type {ComponentType, ReactNode} from 'react';\n\nexport interface AsyncProps {\n LoadingView: ComponentType;\n children: ReactNode;\n}\n\nexport interface AsyncComponent<TProps extends object = {}, TLoadingProps extends object = {}>\n extends React.FC<TProps & TLoadingProps> {\n Content: React.ComponentType<TProps>;\n Loading: ComponentType<TLoadingProps & Partial<TProps>>;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { AsyncComponent } from './types';
|
|
3
|
+
export declare const withAsync: <TProps extends object = {}, TLoadingProps extends object = {}>(Component: React.ComponentType<TProps>, LoadingView: React.ComponentType<TLoadingProps & Partial<TProps>>) => AsyncComponent<TProps, TLoadingProps>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/objectSpread2";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { Async } from './Async';
|
|
4
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
|
+
export var withAsync = function withAsync(Component, _LoadingView) {
|
|
6
|
+
var WrappedComponent = function WrappedComponent(props) {
|
|
7
|
+
return /*#__PURE__*/_jsx(Async, {
|
|
8
|
+
LoadingView: function LoadingView() {
|
|
9
|
+
return /*#__PURE__*/_jsx(_LoadingView, _objectSpread({}, props));
|
|
10
|
+
},
|
|
11
|
+
children: /*#__PURE__*/_jsx(Component, _objectSpread({}, props))
|
|
12
|
+
});
|
|
13
|
+
};
|
|
14
|
+
WrappedComponent.displayName = "WithAsync(".concat(Component.displayName || Component.name, ")");
|
|
15
|
+
WrappedComponent.Content = Component;
|
|
16
|
+
WrappedComponent.Loading = _LoadingView;
|
|
17
|
+
return WrappedComponent;
|
|
18
|
+
};
|
|
19
|
+
// #sourceMappingURL=withAsync.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","Async","jsx","_jsx","withAsync","Component","LoadingView","WrappedComponent","props","_LoadingView","_objectSpread","children","displayName","concat","name","Content","Loading"],"sources":["withAsync.tsx"],"sourcesContent":["import React from 'react';\n\nimport {Async} from './Async';\nimport type {AsyncComponent} from './types';\n\nexport const withAsync = <TProps extends object = {}, TLoadingProps extends object = {}>(\n Component: React.ComponentType<TProps>,\n LoadingView: React.ComponentType<TLoadingProps & Partial<TProps>>,\n) => {\n const WrappedComponent = ((props: TProps & TLoadingProps) => (\n <Async LoadingView={() => <LoadingView {...props} />}>\n <Component {...props} />\n </Async>\n )) as AsyncComponent<TProps, TLoadingProps>;\n\n WrappedComponent.displayName = `WithAsync(${Component.displayName || Component.name})`;\n\n WrappedComponent.Content = Component;\n WrappedComponent.Loading = LoadingView;\n\n return WrappedComponent;\n};\n"],"mappings":";AAAA,OAAOA,KAAK,MAAM,OAAO;AAEzB,SAAQC,KAAK,QAAO,SAAS;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAG9B,OAAO,IAAMC,SAAS,GAAG,SAAZA,SAASA,CAClBC,SAAsC,EACtCC,YAAiE,EAChE;EACD,IAAMC,gBAAgB,GAAI,SAApBA,gBAAgBA,CAAKC,KAA6B;IAAA,oBACpDL,IAAA,CAACF,KAAK;MAACK,WAAW,EAAE,SAAbA,WAAWA,CAAA;QAAA,oBAAQH,IAAA,CAACM,YAAW,EAAAC,aAAA,KAAKF,KAAK,CAAG,CAAC;MAAA,CAAC;MAAAG,QAAA,eACjDR,IAAA,CAACE,SAAS,EAAAK,aAAA,KAAKF,KAAK,CAAG;IAAC,CACrB,CAAC;EAAA,CAC+B;EAE3CD,gBAAgB,CAACK,WAAW,gBAAAC,MAAA,CAAgBR,SAAS,CAACO,WAAW,IAAIP,SAAS,CAACS,IAAI,MAAG;EAEtFP,gBAAgB,CAACQ,OAAO,GAAGV,SAAS;EACpCE,gBAAgB,CAACS,OAAO,GAAGV,YAAW;EAEtC,OAAOC,gBAAgB;AAC3B,CAAC","ignoreList":[]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ErrorBoundary } from 'react-error-boundary';
|
|
3
|
+
import { Async } from '../Async';
|
|
3
4
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
5
|
export var AsyncBoundary = function AsyncBoundary(_ref) {
|
|
5
6
|
var LoadingView = _ref.LoadingView,
|
|
@@ -19,8 +20,8 @@ export var AsyncBoundary = function AsyncBoundary(_ref) {
|
|
|
19
20
|
return /*#__PURE__*/_jsx(ErrorBoundary, {
|
|
20
21
|
fallbackRender: fallbackRender,
|
|
21
22
|
onReset: onReset,
|
|
22
|
-
children: /*#__PURE__*/_jsx(
|
|
23
|
-
|
|
23
|
+
children: /*#__PURE__*/_jsx(Async, {
|
|
24
|
+
LoadingView: LoadingView,
|
|
24
25
|
children: children
|
|
25
26
|
})
|
|
26
27
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","ErrorBoundary","jsx","_jsx","AsyncBoundary","_ref","LoadingView","ErrorView","onReset","children","fallbackRender","useCallback","_ref2","error","resetErrorBoundary","action","handler"
|
|
1
|
+
{"version":3,"names":["React","ErrorBoundary","Async","jsx","_jsx","AsyncBoundary","_ref","LoadingView","ErrorView","onReset","children","fallbackRender","useCallback","_ref2","error","resetErrorBoundary","action","handler"],"sources":["AsyncBoundary.tsx"],"sourcesContent":["import React from 'react';\n\nimport type {FallbackProps} from 'react-error-boundary';\nimport {ErrorBoundary} from 'react-error-boundary';\n\nimport {Async} from '../Async';\n\nimport type {AsyncBoundaryProps} from './types';\n\nexport const AsyncBoundary: React.FC<AsyncBoundaryProps> = ({\n LoadingView,\n ErrorView,\n onReset,\n children,\n}) => {\n const fallbackRender = React.useCallback(\n ({error, resetErrorBoundary}: FallbackProps) => (\n <ErrorView error={error} action={{handler: resetErrorBoundary}} />\n ),\n [ErrorView],\n );\n\n return (\n <ErrorBoundary fallbackRender={fallbackRender} onReset={onReset}>\n <Async LoadingView={LoadingView}>{children}</Async>\n </ErrorBoundary>\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AAGzB,SAAQC,aAAa,QAAO,sBAAsB;AAElD,SAAQC,KAAK,QAAO,UAAU;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAI/B,OAAO,IAAMC,aAA2C,GAAG,SAA9CA,aAA2CA,CAAAC,IAAA,EAKlD;EAAA,IAJFC,WAAW,GAAAD,IAAA,CAAXC,WAAW;IACXC,SAAS,GAAAF,IAAA,CAATE,SAAS;IACTC,OAAO,GAAAH,IAAA,CAAPG,OAAO;IACPC,QAAQ,GAAAJ,IAAA,CAARI,QAAQ;EAER,IAAMC,cAAc,GAAGX,KAAK,CAACY,WAAW,CACpC,UAAAC,KAAA;IAAA,IAAEC,KAAK,GAAAD,KAAA,CAALC,KAAK;MAAEC,kBAAkB,GAAAF,KAAA,CAAlBE,kBAAkB;IAAA,oBACvBX,IAAA,CAACI,SAAS;MAACM,KAAK,EAAEA,KAAM;MAACE,MAAM,EAAE;QAACC,OAAO,EAAEF;MAAkB;IAAE,CAAE,CAAC;EAAA,CACrE,EACD,CAACP,SAAS,CACd,CAAC;EAED,oBACIJ,IAAA,CAACH,aAAa;IAACU,cAAc,EAAEA,cAAe;IAACF,OAAO,EAAEA,OAAQ;IAAAC,QAAA,eAC5DN,IAAA,CAACF,KAAK;MAACK,WAAW,EAAEA,WAAY;MAAAG,QAAA,EAAEA;IAAQ,CAAQ;EAAC,CACxC,CAAC;AAExB,CAAC","ignoreList":[]}
|
|
@@ -6,8 +6,8 @@ export interface AsyncBoundaryProps {
|
|
|
6
6
|
onReset?: () => void;
|
|
7
7
|
children: ReactNode;
|
|
8
8
|
}
|
|
9
|
-
export interface AsyncBoundaryComponent<TProps extends object> extends React.FC<TProps
|
|
9
|
+
export interface AsyncBoundaryComponent<TProps extends object = {}, TLoadingProps extends object = {}, TErrorProps extends object = {}> extends React.FC<TProps & TLoadingProps & Omit<TErrorProps, keyof ErrorViewProps>> {
|
|
10
10
|
Content: React.ComponentType<TProps>;
|
|
11
|
-
Loading:
|
|
12
|
-
Error:
|
|
11
|
+
Loading: ComponentType<TLoadingProps & Partial<TProps>>;
|
|
12
|
+
Error: ComponentType<ErrorViewProps & TErrorProps & Partial<TProps>>;
|
|
13
13
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type {ComponentType, ReactNode} from 'react';\n\nimport type {ErrorViewProps} from '../types';\n\nexport interface AsyncBoundaryProps {\n LoadingView: ComponentType;\n ErrorView: ComponentType<ErrorViewProps>;\n onReset?: () => void;\n children: ReactNode;\n}\n\nexport interface AsyncBoundaryComponent
|
|
1
|
+
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type {ComponentType, ReactNode} from 'react';\n\nimport type {ErrorViewProps} from '../types';\n\nexport interface AsyncBoundaryProps {\n LoadingView: ComponentType;\n ErrorView: ComponentType<ErrorViewProps>;\n onReset?: () => void;\n children: ReactNode;\n}\n\nexport interface AsyncBoundaryComponent<\n TProps extends object = {},\n TLoadingProps extends object = {},\n TErrorProps extends object = {},\n> extends React.FC<TProps & TLoadingProps & Omit<TErrorProps, keyof ErrorViewProps>> {\n Content: React.ComponentType<TProps>;\n Loading: ComponentType<TLoadingProps & Partial<TProps>>;\n Error: ComponentType<ErrorViewProps & TErrorProps & Partial<TProps>>;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type {
|
|
3
|
-
|
|
2
|
+
import type { ErrorViewProps } from '../types';
|
|
3
|
+
import type { AsyncBoundaryComponent } from './types';
|
|
4
|
+
export declare const withAsyncBoundary: <TProps extends object = {}, TLoadingProps extends object = {}, TErrorProps extends object = {}>(Component: React.ComponentType<TProps>, LoadingView: React.ComponentType<TLoadingProps & Partial<TProps>>, ErrorView: React.ComponentType<ErrorViewProps & TErrorProps & Partial<TProps>>) => AsyncBoundaryComponent<TProps, TLoadingProps, TErrorProps>;
|
|
@@ -2,18 +2,22 @@ import _objectSpread from "@babel/runtime/helpers/objectSpread2";
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { AsyncBoundary } from './AsyncBoundary';
|
|
4
4
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
|
-
export var withAsyncBoundary = function withAsyncBoundary(Component,
|
|
5
|
+
export var withAsyncBoundary = function withAsyncBoundary(Component, _LoadingView, _ErrorView) {
|
|
6
6
|
var WrappedComponent = function WrappedComponent(props) {
|
|
7
7
|
return /*#__PURE__*/_jsx(AsyncBoundary, {
|
|
8
|
-
LoadingView: LoadingView
|
|
9
|
-
|
|
8
|
+
LoadingView: function LoadingView() {
|
|
9
|
+
return /*#__PURE__*/_jsx(_LoadingView, _objectSpread({}, props));
|
|
10
|
+
},
|
|
11
|
+
ErrorView: function ErrorView(errorProps) {
|
|
12
|
+
return /*#__PURE__*/_jsx(_ErrorView, _objectSpread(_objectSpread({}, props), errorProps));
|
|
13
|
+
},
|
|
10
14
|
children: /*#__PURE__*/_jsx(Component, _objectSpread({}, props))
|
|
11
15
|
});
|
|
12
16
|
};
|
|
13
17
|
WrappedComponent.displayName = "WithAsyncBoundary(".concat(Component.displayName || Component.name, ")");
|
|
14
18
|
WrappedComponent.Content = Component;
|
|
15
|
-
WrappedComponent.Loading =
|
|
16
|
-
WrappedComponent.Error =
|
|
19
|
+
WrappedComponent.Loading = _LoadingView;
|
|
20
|
+
WrappedComponent.Error = _ErrorView;
|
|
17
21
|
return WrappedComponent;
|
|
18
22
|
};
|
|
19
23
|
// #sourceMappingURL=withAsyncBoundary.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","AsyncBoundary","jsx","_jsx","withAsyncBoundary","Component","LoadingView","ErrorView","WrappedComponent","props","
|
|
1
|
+
{"version":3,"names":["React","AsyncBoundary","jsx","_jsx","withAsyncBoundary","Component","LoadingView","ErrorView","WrappedComponent","props","_LoadingView","_objectSpread","errorProps","_ErrorView","children","displayName","concat","name","Content","Loading","Error"],"sources":["withAsyncBoundary.tsx"],"sourcesContent":["import React from 'react';\n\nimport type {ErrorViewProps} from '../types';\n\nimport {AsyncBoundary} from './AsyncBoundary';\nimport type {AsyncBoundaryComponent} from './types';\n\nexport const withAsyncBoundary = <\n TProps extends object = {},\n TLoadingProps extends object = {},\n TErrorProps extends object = {},\n>(\n Component: React.ComponentType<TProps>,\n LoadingView: React.ComponentType<TLoadingProps & Partial<TProps>>,\n ErrorView: React.ComponentType<ErrorViewProps & TErrorProps & Partial<TProps>>,\n) => {\n const WrappedComponent = ((props: TProps & TLoadingProps & TErrorProps) => (\n <AsyncBoundary\n LoadingView={() => <LoadingView {...props} />}\n ErrorView={(errorProps) => <ErrorView {...props} {...errorProps} />}\n >\n <Component {...props} />\n </AsyncBoundary>\n )) as AsyncBoundaryComponent<TProps, TLoadingProps, TErrorProps>;\n\n WrappedComponent.displayName = `WithAsyncBoundary(${Component.displayName || Component.name})`;\n\n WrappedComponent.Content = Component;\n WrappedComponent.Loading = LoadingView;\n WrappedComponent.Error = ErrorView;\n\n return WrappedComponent;\n};\n"],"mappings":";AAAA,OAAOA,KAAK,MAAM,OAAO;AAIzB,SAAQC,aAAa,QAAO,iBAAiB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAG9C,OAAO,IAAMC,iBAAiB,GAAG,SAApBA,iBAAiBA,CAK1BC,SAAsC,EACtCC,YAAiE,EACjEC,UAA8E,EAC7E;EACD,IAAMC,gBAAgB,GAAI,SAApBA,gBAAgBA,CAAKC,KAA2C;IAAA,oBAClEN,IAAA,CAACF,aAAa;MACVK,WAAW,EAAE,SAAbA,WAAWA,CAAA;QAAA,oBAAQH,IAAA,CAACO,YAAW,EAAAC,aAAA,KAAKF,KAAK,CAAG,CAAC;MAAA,CAAC;MAC9CF,SAAS,EAAE,SAAXA,SAASA,CAAGK,UAAU;QAAA,oBAAKT,IAAA,CAACU,UAAS,EAAAF,aAAA,CAAAA,aAAA,KAAKF,KAAK,GAAMG,UAAU,CAAG,CAAC;MAAA,CAAC;MAAAE,QAAA,eAEpEX,IAAA,CAACE,SAAS,EAAAM,aAAA,KAAKF,KAAK,CAAG;IAAC,CACb,CAAC;EAAA,CAC4C;EAEhED,gBAAgB,CAACO,WAAW,wBAAAC,MAAA,CAAwBX,SAAS,CAACU,WAAW,IAAIV,SAAS,CAACY,IAAI,MAAG;EAE9FT,gBAAgB,CAACU,OAAO,GAAGb,SAAS;EACpCG,gBAAgB,CAACW,OAAO,GAAGb,YAAW;EACtCE,gBAAgB,CAACY,KAAK,GAAGb,UAAS;EAElC,OAAOC,gBAAgB;AAC3B,CAAC","ignoreList":[]}
|
package/build/esm/react/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["DataManagerContext","useDataManager","DataManagerProvider","withDataManager"],"sources":["index.ts"],"sourcesContent":["export * from './components/AsyncBoundary';\nexport * from './components/DataLoader';\nexport * from './components/DataInfiniteLoader';\nexport * from './components/EmptyView';\nexport type {ErrorAction, ErrorViewProps} from './components/types';\n\nexport {DataManagerContext, useDataManager} from './DataManagerContext';\nexport {DataManagerProvider} from './DataManagerProvider';\nexport type {DataManagerProviderProps} from './DataManagerProvider';\nexport type {WithDataManagerProps} from './withDataManager';\nexport {withDataManager} from './withDataManager';\n"],"mappings":"AAAA,cAAc,4BAA4B;AAC1C,cAAc,yBAAyB;AACvC,cAAc,iCAAiC;AAC/C,cAAc,wBAAwB;AAGtC,SAAQA,kBAAkB,EAAEC,cAAc,QAAO,sBAAsB;AACvE,SAAQC,mBAAmB,QAAO,uBAAuB;AAGzD,SAAQC,eAAe,QAAO,mBAAmB","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["DataManagerContext","useDataManager","DataManagerProvider","withDataManager"],"sources":["index.ts"],"sourcesContent":["export * from './components/Async';\nexport * from './components/AsyncBoundary';\nexport * from './components/DataLoader';\nexport * from './components/DataInfiniteLoader';\nexport * from './components/EmptyView';\nexport type {ErrorAction, ErrorViewProps} from './components/types';\n\nexport {DataManagerContext, useDataManager} from './DataManagerContext';\nexport {DataManagerProvider} from './DataManagerProvider';\nexport type {DataManagerProviderProps} from './DataManagerProvider';\nexport type {WithDataManagerProps} from './withDataManager';\nexport {withDataManager} from './withDataManager';\n"],"mappings":"AAAA,cAAc,oBAAoB;AAClC,cAAc,4BAA4B;AAC1C,cAAc,yBAAyB;AACvC,cAAc,iCAAiC;AAC/C,cAAc,wBAAwB;AAGtC,SAAQA,kBAAkB,EAAEC,cAAc,QAAO,sBAAsB;AACvE,SAAQC,mBAAmB,QAAO,uBAAuB;AAGzD,SAAQC,eAAe,QAAO,mBAAmB","ignoreList":[]}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ComponentType } from 'react';
|
|
2
|
+
import type { AsyncBoundaryProps, ErrorViewProps } from '../../../react';
|
|
2
3
|
export interface QueryAsyncBoundaryProps extends AsyncBoundaryProps {
|
|
3
4
|
}
|
|
4
|
-
export interface QueryAsyncBoundaryComponent<TProps extends object> extends React.FC<TProps
|
|
5
|
+
export interface QueryAsyncBoundaryComponent<TProps extends object = {}, TLoadingProps extends object = {}, TErrorProps extends object = {}> extends React.FC<TProps & TLoadingProps & Omit<TErrorProps, keyof ErrorViewProps>> {
|
|
5
6
|
Content: React.ComponentType<TProps>;
|
|
6
|
-
Loading:
|
|
7
|
-
Error:
|
|
7
|
+
Loading: ComponentType<TLoadingProps & Partial<TProps>>;
|
|
8
|
+
Error: ComponentType<ErrorViewProps & TErrorProps & Partial<TProps>>;
|
|
8
9
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type {AsyncBoundaryProps} from '../../../react';\n\nexport interface QueryAsyncBoundaryProps extends AsyncBoundaryProps {}\n\nexport interface QueryAsyncBoundaryComponent
|
|
1
|
+
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type {ComponentType} from 'react';\n\nimport type {AsyncBoundaryProps, ErrorViewProps} from '../../../react';\n\nexport interface QueryAsyncBoundaryProps extends AsyncBoundaryProps {}\n\nexport interface QueryAsyncBoundaryComponent<\n TProps extends object = {},\n TLoadingProps extends object = {},\n TErrorProps extends object = {},\n> extends React.FC<TProps & TLoadingProps & Omit<TErrorProps, keyof ErrorViewProps>> {\n Content: React.ComponentType<TProps>;\n Loading: ComponentType<TLoadingProps & Partial<TProps>>;\n Error: ComponentType<ErrorViewProps & TErrorProps & Partial<TProps>>;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type {
|
|
3
|
-
|
|
2
|
+
import type { ErrorViewProps } from '../../../react';
|
|
3
|
+
import type { QueryAsyncBoundaryComponent } from './types';
|
|
4
|
+
export declare const withQueryAsyncBoundary: <TProps extends object = {}, TLoadingProps extends object = {}, TErrorProps extends object = {}>(Component: React.ComponentType<TProps>, LoadingView: React.ComponentType<TLoadingProps & Partial<TProps>>, ErrorView: React.ComponentType<ErrorViewProps & TErrorProps & Partial<TProps>>) => QueryAsyncBoundaryComponent<TProps, TLoadingProps, TErrorProps>;
|
|
@@ -2,18 +2,22 @@ import _objectSpread from "@babel/runtime/helpers/objectSpread2";
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { QueryAsyncBoundary } from './QueryAsyncBoundary';
|
|
4
4
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
|
-
export var withQueryAsyncBoundary = function withQueryAsyncBoundary(Component,
|
|
5
|
+
export var withQueryAsyncBoundary = function withQueryAsyncBoundary(Component, _LoadingView, _ErrorView) {
|
|
6
6
|
var WrappedComponent = function WrappedComponent(props) {
|
|
7
7
|
return /*#__PURE__*/_jsx(QueryAsyncBoundary, {
|
|
8
|
-
LoadingView: LoadingView
|
|
9
|
-
|
|
8
|
+
LoadingView: function LoadingView() {
|
|
9
|
+
return /*#__PURE__*/_jsx(_LoadingView, _objectSpread({}, props));
|
|
10
|
+
},
|
|
11
|
+
ErrorView: function ErrorView(errorProps) {
|
|
12
|
+
return /*#__PURE__*/_jsx(_ErrorView, _objectSpread(_objectSpread({}, props), errorProps));
|
|
13
|
+
},
|
|
10
14
|
children: /*#__PURE__*/_jsx(Component, _objectSpread({}, props))
|
|
11
15
|
});
|
|
12
16
|
};
|
|
13
17
|
WrappedComponent.displayName = "WithQueryAsyncBoundary(".concat(Component.displayName || Component.name, ")");
|
|
14
18
|
WrappedComponent.Content = Component;
|
|
15
|
-
WrappedComponent.Loading =
|
|
16
|
-
WrappedComponent.Error =
|
|
19
|
+
WrappedComponent.Loading = _LoadingView;
|
|
20
|
+
WrappedComponent.Error = _ErrorView;
|
|
17
21
|
return WrappedComponent;
|
|
18
22
|
};
|
|
19
23
|
// #sourceMappingURL=withQueryAsyncBoundary.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","QueryAsyncBoundary","jsx","_jsx","withQueryAsyncBoundary","Component","LoadingView","ErrorView","WrappedComponent","props","
|
|
1
|
+
{"version":3,"names":["React","QueryAsyncBoundary","jsx","_jsx","withQueryAsyncBoundary","Component","LoadingView","ErrorView","WrappedComponent","props","_LoadingView","_objectSpread","errorProps","_ErrorView","children","displayName","concat","name","Content","Loading","Error"],"sources":["withQueryAsyncBoundary.tsx"],"sourcesContent":["import React from 'react';\n\nimport type {ErrorViewProps} from '../../../react';\n\nimport {QueryAsyncBoundary} from './QueryAsyncBoundary';\nimport type {QueryAsyncBoundaryComponent} from './types';\n\nexport const withQueryAsyncBoundary = <\n TProps extends object = {},\n TLoadingProps extends object = {},\n TErrorProps extends object = {},\n>(\n Component: React.ComponentType<TProps>,\n LoadingView: React.ComponentType<TLoadingProps & Partial<TProps>>,\n ErrorView: React.ComponentType<ErrorViewProps & TErrorProps & Partial<TProps>>,\n) => {\n const WrappedComponent = ((props: TProps & TLoadingProps & TErrorProps) => (\n <QueryAsyncBoundary\n LoadingView={() => <LoadingView {...props} />}\n ErrorView={(errorProps) => <ErrorView {...props} {...errorProps} />}\n >\n <Component {...props} />\n </QueryAsyncBoundary>\n )) as QueryAsyncBoundaryComponent<TProps, TLoadingProps, TErrorProps>;\n\n WrappedComponent.displayName = `WithQueryAsyncBoundary(${\n Component.displayName || Component.name\n })`;\n\n WrappedComponent.Content = Component;\n WrappedComponent.Loading = LoadingView;\n WrappedComponent.Error = ErrorView;\n\n return WrappedComponent;\n};\n"],"mappings":";AAAA,OAAOA,KAAK,MAAM,OAAO;AAIzB,SAAQC,kBAAkB,QAAO,sBAAsB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAGxD,OAAO,IAAMC,sBAAsB,GAAG,SAAzBA,sBAAsBA,CAK/BC,SAAsC,EACtCC,YAAiE,EACjEC,UAA8E,EAC7E;EACD,IAAMC,gBAAgB,GAAI,SAApBA,gBAAgBA,CAAKC,KAA2C;IAAA,oBAClEN,IAAA,CAACF,kBAAkB;MACfK,WAAW,EAAE,SAAbA,WAAWA,CAAA;QAAA,oBAAQH,IAAA,CAACO,YAAW,EAAAC,aAAA,KAAKF,KAAK,CAAG,CAAC;MAAA,CAAC;MAC9CF,SAAS,EAAE,SAAXA,SAASA,CAAGK,UAAU;QAAA,oBAAKT,IAAA,CAACU,UAAS,EAAAF,aAAA,CAAAA,aAAA,KAAKF,KAAK,GAAMG,UAAU,CAAG,CAAC;MAAA,CAAC;MAAAE,QAAA,eAEpEX,IAAA,CAACE,SAAS,EAAAM,aAAA,KAAKF,KAAK,CAAG;IAAC,CACR,CAAC;EAAA,CAC4C;EAErED,gBAAgB,CAACO,WAAW,6BAAAC,MAAA,CACxBX,SAAS,CAACU,WAAW,IAAIV,SAAS,CAACY,IAAI,MACxC;EAEHT,gBAAgB,CAACU,OAAO,GAAGb,SAAS;EACpCG,gBAAgB,CAACW,OAAO,GAAGb,YAAW;EACtCE,gBAAgB,CAACY,KAAK,GAAGb,UAAS;EAElC,OAAOC,gBAAgB;AAC3B,CAAC","ignoreList":[]}
|
|
@@ -1,11 +1,19 @@
|
|
|
1
1
|
import type {ComponentType} from 'react';
|
|
2
2
|
|
|
3
3
|
declare module '@gravity-ui/data-source' {
|
|
4
|
-
interface AsyncBoundaryComponent<
|
|
5
|
-
|
|
4
|
+
interface AsyncBoundaryComponent<
|
|
5
|
+
TProps extends object = {},
|
|
6
|
+
TLoadingProps extends object = {},
|
|
7
|
+
TErrorProps extends object = {},
|
|
8
|
+
> {
|
|
9
|
+
Lazy: ComponentType<TProps & TLoadingProps & Omit<TErrorProps, keyof ErrorViewProps>>;
|
|
6
10
|
}
|
|
7
11
|
|
|
8
|
-
interface QueryAsyncBoundaryComponent<
|
|
9
|
-
|
|
12
|
+
interface QueryAsyncBoundaryComponent<
|
|
13
|
+
TProps extends object = {},
|
|
14
|
+
TLoadingProps extends object = {},
|
|
15
|
+
TErrorProps extends object = {},
|
|
16
|
+
> {
|
|
17
|
+
Lazy: ComponentType<TProps & TLoadingProps & Omit<TErrorProps, keyof ErrorViewProps>>;
|
|
10
18
|
}
|
|
11
19
|
}
|