@elice/material-shared-utils 1.240718.0-trasncript.2 → 1.240718.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/components/MaterialIntlProvider.d.ts +14 -0
- package/cjs/components/MaterialIntlProvider.js +27 -0
- package/cjs/components/index.d.ts +2 -0
- package/cjs/hooks/useCallbackProp.js +3 -7
- package/cjs/hooks/useDeepClonedCompareEffect.js +4 -8
- package/cjs/index.d.ts +1 -0
- package/cjs/index.js +2 -0
- package/cjs/material-config/MaterialConfigContext.js +2 -2
- package/cjs/material-config/MaterialConfigProvider.js +17 -31
- package/cjs/material-config/useMaterialConfig.js +2 -2
- package/cjs/material-config/useMaterialConfigApiClientUpdate.js +4 -8
- package/cjs/material-fetch/useMaterialFetch.d.ts +1 -1
- package/cjs/material-fetch/useMaterialFetch.js +2 -3
- package/cjs/material-fetch/useMaterialFetchRaw.js +54 -71
- package/cjs/material-hoc/withMaterial.d.ts +13 -2
- package/cjs/material-hoc/withMaterial.js +31 -31
- package/es/components/MaterialIntlProvider.d.ts +14 -0
- package/es/components/MaterialIntlProvider.js +23 -0
- package/es/components/index.d.ts +2 -0
- package/es/hooks/useCallbackProp.js +3 -3
- package/es/hooks/useDeepClonedCompareEffect.js +4 -4
- package/es/index.d.ts +1 -0
- package/es/index.js +1 -0
- package/es/material-config/MaterialConfigContext.js +2 -2
- package/es/material-config/MaterialConfigProvider.js +17 -27
- package/es/material-config/useMaterialConfig.js +2 -2
- package/es/material-config/useMaterialConfigApiClientUpdate.js +4 -8
- package/es/material-fetch/useMaterialFetch.d.ts +1 -1
- package/es/material-fetch/useMaterialFetch.js +2 -3
- package/es/material-fetch/useMaterialFetchRaw.js +54 -71
- package/es/material-hoc/withMaterial.d.ts +13 -2
- package/es/material-hoc/withMaterial.js +32 -32
- package/package.json +11 -8
- package/cjs/_virtual/_rollupPluginBabelHelpers.js +0 -414
- package/cjs/hooks/index.js +0 -9
- package/cjs/material-config/index.js +0 -13
- package/cjs/material-fetch/index.js +0 -9
- package/cjs/material-hoc/index.js +0 -8
- package/es/_virtual/_rollupPluginBabelHelpers.js +0 -402
- package/es/hooks/index.js +0 -2
- package/es/material-config/index.js +0 -4
- package/es/material-fetch/index.js +0 -2
- package/es/material-hoc/index.js +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createContext } from 'react';
|
|
2
2
|
import { BehaviorSubject } from 'rxjs';
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
const MaterialConfigContext = createContext(null);
|
|
5
|
+
const sessionKeySubject$ = new BehaviorSubject(null);
|
|
6
6
|
|
|
7
7
|
export { MaterialConfigContext, sessionKeySubject$ };
|
|
@@ -1,47 +1,37 @@
|
|
|
1
|
-
import { slicedToArray as _slicedToArray } from '../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
|
-
import { jsx } from 'react/jsx-runtime';
|
|
3
1
|
import React from 'react';
|
|
4
2
|
import { sessionKeySubject$, MaterialConfigContext } from './MaterialConfigContext.js';
|
|
5
3
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
orgNameShort = _React$useState2[0],
|
|
15
|
-
setOrgNameShort = _React$useState2[1];
|
|
16
|
-
var _React$useState3 = React.useState(null),
|
|
17
|
-
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
18
|
-
sessionKey = _React$useState4[0],
|
|
19
|
-
setSessionKey = _React$useState4[1];
|
|
4
|
+
const MaterialConfigProvider = ({
|
|
5
|
+
children,
|
|
6
|
+
apiOriginUrl,
|
|
7
|
+
apiWsOriginUrl,
|
|
8
|
+
orgNameShort: orgNameShortProp = 'academy'
|
|
9
|
+
}) => {
|
|
10
|
+
const [orgNameShort, setOrgNameShort] = React.useState(orgNameShortProp);
|
|
11
|
+
const [sessionKey, setSessionKey] = React.useState(null);
|
|
20
12
|
//
|
|
21
13
|
// Update org name short.
|
|
22
14
|
//
|
|
23
|
-
React.useEffect(
|
|
24
|
-
return setOrgNameShort(orgNameShortProp);
|
|
25
|
-
}, [orgNameShortProp]);
|
|
15
|
+
React.useEffect(() => setOrgNameShort(orgNameShortProp), [orgNameShortProp]);
|
|
26
16
|
//
|
|
27
17
|
// Update session key when session key subject emits.
|
|
28
18
|
//
|
|
29
|
-
React.useEffect(
|
|
30
|
-
|
|
31
|
-
return
|
|
19
|
+
React.useEffect(() => {
|
|
20
|
+
const sub = sessionKeySubject$.subscribe(setSessionKey);
|
|
21
|
+
return () => {
|
|
32
22
|
sub.unsubscribe();
|
|
33
23
|
};
|
|
34
24
|
}, []);
|
|
35
25
|
//
|
|
36
26
|
//
|
|
37
27
|
//
|
|
38
|
-
return
|
|
28
|
+
return React.createElement(MaterialConfigContext.Provider, {
|
|
39
29
|
children: children,
|
|
40
30
|
value: {
|
|
41
|
-
apiOriginUrl
|
|
42
|
-
apiWsOriginUrl
|
|
43
|
-
orgNameShort
|
|
44
|
-
sessionKey
|
|
31
|
+
apiOriginUrl,
|
|
32
|
+
apiWsOriginUrl,
|
|
33
|
+
orgNameShort,
|
|
34
|
+
sessionKey
|
|
45
35
|
}
|
|
46
36
|
});
|
|
47
37
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { useContext } from 'react';
|
|
2
2
|
import { MaterialConfigContext } from './MaterialConfigContext.js';
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
const useMaterialConfig = () => {
|
|
5
|
+
const context = useContext(MaterialConfigContext);
|
|
6
6
|
if (context === undefined) {
|
|
7
7
|
throw new Error('Oops, `useMaterialConfig` must be used within a `MaterialConfigProvider`');
|
|
8
8
|
}
|
|
@@ -1,18 +1,14 @@
|
|
|
1
|
-
import { slicedToArray as _slicedToArray } from '../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
1
|
import { useContext, useState } from 'react';
|
|
3
2
|
import { useDeepCompareEffect } from 'react-use';
|
|
4
3
|
import { MaterialConfigContext } from './MaterialConfigContext.js';
|
|
5
4
|
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
const useMaterialConfigApiClientUpdate = callback => {
|
|
6
|
+
const context = useContext(MaterialConfigContext);
|
|
8
7
|
if (!context) {
|
|
9
8
|
throw new Error('Oops, Elice material component must be used within a `MaterialConfigProvider`');
|
|
10
9
|
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
isReady = _useState2[0],
|
|
14
|
-
setReady = _useState2[1];
|
|
15
|
-
useDeepCompareEffect(function () {
|
|
10
|
+
const [isReady, setReady] = useState(false);
|
|
11
|
+
useDeepCompareEffect(() => {
|
|
16
12
|
var _a;
|
|
17
13
|
callback({
|
|
18
14
|
apiBaseUrl: context.apiOriginUrl,
|
|
@@ -67,7 +67,7 @@ export declare const useMaterialFetch: <MT extends enums.LectureMaterialType, R
|
|
|
67
67
|
title: string;
|
|
68
68
|
} | null;
|
|
69
69
|
} & {
|
|
70
|
-
status: import("
|
|
70
|
+
status: import("packages/elice-material-shared-types/es").APIStatus;
|
|
71
71
|
refetch: (signal?: AbortSignal | undefined) => Promise<void>;
|
|
72
72
|
};
|
|
73
73
|
export {};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import 'react/jsx-runtime';
|
|
2
1
|
import 'react';
|
|
3
2
|
import '../material-config/MaterialConfigContext.js';
|
|
4
3
|
import { useMaterialConfigApiClientUpdate } from '../material-config/useMaterialConfigApiClientUpdate.js';
|
|
@@ -25,8 +24,8 @@ import { useMaterialFetchRaw } from './useMaterialFetchRaw.js';
|
|
|
25
24
|
* eliceApiClientConfigs.init
|
|
26
25
|
* );
|
|
27
26
|
*/
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
const useMaterialFetch = (materialType, materialFetchFn, init) => {
|
|
28
|
+
const isReady = useMaterialConfigApiClientUpdate(init);
|
|
30
29
|
return useMaterialFetchRaw(materialType, materialFetchFn, isReady);
|
|
31
30
|
};
|
|
32
31
|
|
|
@@ -1,10 +1,24 @@
|
|
|
1
|
-
import { defineProperty as _defineProperty, slicedToArray as _slicedToArray, asyncToGenerator as _asyncToGenerator, regeneratorRuntime as _regeneratorRuntime } from '../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
1
|
import { useRef, useState, useCallback, useEffect } from 'react';
|
|
3
2
|
import { getOrgLecturePageResolve, getOrgLecturePageGet } from '@elice/api-client';
|
|
4
3
|
import { enums } from '@elice/types';
|
|
5
4
|
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
const MATERIAL_FETCH_KEY_MAP = Object.freeze({
|
|
6
|
+
[enums.LectureMaterialType.Nothing]: 'materialNothing',
|
|
7
|
+
[enums.LectureMaterialType.Note]: 'materialNote',
|
|
8
|
+
[enums.LectureMaterialType.Video]: 'materialVideo',
|
|
9
|
+
[enums.LectureMaterialType.PDF]: 'materialPdf',
|
|
10
|
+
[enums.LectureMaterialType.Exercise]: 'materialExercise',
|
|
11
|
+
[enums.LectureMaterialType.Quiz]: 'materialQuiz',
|
|
12
|
+
[enums.LectureMaterialType.LegacyRunbox]: 'materialLegacyRunbox',
|
|
13
|
+
[enums.LectureMaterialType.VideoFile]: 'materialVideoFile',
|
|
14
|
+
[enums.LectureMaterialType.Live]: 'materialLive',
|
|
15
|
+
[enums.LectureMaterialType.Assignment]: 'materialAssignment',
|
|
16
|
+
[enums.LectureMaterialType.LMSPublicContent]: 'materialLmsPublicContent',
|
|
17
|
+
[enums.LectureMaterialType.External]: 'materialExternal',
|
|
18
|
+
[enums.LectureMaterialType.Survey]: 'materialSurvey',
|
|
19
|
+
[enums.LectureMaterialType.Runbox]: 'materialRunbox',
|
|
20
|
+
[enums.LectureMaterialType.Cloud]: 'materialCloud'
|
|
21
|
+
});
|
|
8
22
|
//
|
|
9
23
|
//
|
|
10
24
|
//
|
|
@@ -26,85 +40,54 @@ var MATERIAL_FETCH_KEY_MAP = Object.freeze((_Object$freeze = {}, _defineProperty
|
|
|
26
40
|
* isReady // boolean
|
|
27
41
|
* );
|
|
28
42
|
*/
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
39
|
-
matFetchRes = _useState2[0],
|
|
40
|
-
setMatFetchRes = _useState2[1];
|
|
41
|
-
var _useState3 = useState('idle'),
|
|
42
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
43
|
-
matFetchStatus = _useState4[0],
|
|
44
|
-
setMatFetchStatus = _useState4[1];
|
|
43
|
+
const useMaterialFetchRaw = (materialType, materialFetchFn, isReady = true) => {
|
|
44
|
+
const _return = useRef({});
|
|
45
|
+
const materialKey = MATERIAL_FETCH_KEY_MAP[materialType];
|
|
46
|
+
const _createEmptyFetchRes = () => ({
|
|
47
|
+
[materialKey]: null,
|
|
48
|
+
materialLecturePage: null
|
|
49
|
+
});
|
|
50
|
+
const [matFetchRes, setMatFetchRes] = useState(_createEmptyFetchRes);
|
|
51
|
+
const [matFetchStatus, setMatFetchStatus] = useState('idle');
|
|
45
52
|
/**
|
|
46
53
|
* fetch material and lecture page
|
|
47
54
|
*/
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
var _setMatFetchRes;
|
|
73
|
-
var _ref4 = _slicedToArray(_ref3, 2),
|
|
74
|
-
material = _ref4[0],
|
|
75
|
-
materialLecturePage = _ref4[1];
|
|
76
|
-
setMatFetchRes((_setMatFetchRes = {}, _defineProperty(_setMatFetchRes, materialKey, material), _defineProperty(_setMatFetchRes, "materialLecturePage", materialLecturePage), _setMatFetchRes));
|
|
77
|
-
setMatFetchStatus('resolved');
|
|
78
|
-
}).catch(function (err) {
|
|
79
|
-
if (err.name !== 'AbortError') {
|
|
80
|
-
setMatFetchRes(_createEmptyFetchRes);
|
|
81
|
-
setMatFetchStatus('rejected');
|
|
82
|
-
}
|
|
83
|
-
}));
|
|
84
|
-
case 2:
|
|
85
|
-
case "end":
|
|
86
|
-
return _context.stop();
|
|
87
|
-
}
|
|
88
|
-
}, _callee);
|
|
89
|
-
}));
|
|
90
|
-
return function (_x) {
|
|
91
|
-
return _ref2.apply(this, arguments);
|
|
92
|
-
};
|
|
93
|
-
}(),
|
|
55
|
+
const fetch = useCallback(async signal => {
|
|
56
|
+
setMatFetchStatus('pending');
|
|
57
|
+
return materialFetchFn(signal).then(resMaterialGet => resMaterialGet[materialKey]).then(material => Promise.all([material, getOrgLecturePageResolve({
|
|
58
|
+
materialId: material.id,
|
|
59
|
+
materialType
|
|
60
|
+
}, {
|
|
61
|
+
signal: signal
|
|
62
|
+
}).then(resLecturePageResolve => getOrgLecturePageGet({
|
|
63
|
+
lecturePageId: resLecturePageResolve.lecturePageId
|
|
64
|
+
}, {
|
|
65
|
+
signal: signal
|
|
66
|
+
})).then(resLecturePageGet => resLecturePageGet.lecturePage)])).then(([material, materialLecturePage]) => {
|
|
67
|
+
setMatFetchRes({
|
|
68
|
+
[materialKey]: material,
|
|
69
|
+
materialLecturePage
|
|
70
|
+
});
|
|
71
|
+
setMatFetchStatus('resolved');
|
|
72
|
+
}).catch(err => {
|
|
73
|
+
if (err.name !== 'AbortError') {
|
|
74
|
+
setMatFetchRes(_createEmptyFetchRes);
|
|
75
|
+
setMatFetchStatus('rejected');
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
},
|
|
94
79
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
95
80
|
[materialKey, materialFetchFn]);
|
|
96
81
|
//
|
|
97
82
|
// emit `fetch` when `isReady` is changed
|
|
98
83
|
//
|
|
99
|
-
useEffect(
|
|
84
|
+
useEffect(() => {
|
|
100
85
|
if (!isReady) {
|
|
101
86
|
return;
|
|
102
87
|
}
|
|
103
|
-
|
|
104
|
-
fetch(abortCtrl.signal).catch(
|
|
105
|
-
|
|
106
|
-
});
|
|
107
|
-
return function () {
|
|
88
|
+
const abortCtrl = new AbortController();
|
|
89
|
+
fetch(abortCtrl.signal).catch(() => void 0);
|
|
90
|
+
return () => {
|
|
108
91
|
abortCtrl.abort();
|
|
109
92
|
};
|
|
110
93
|
},
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import type { MaterialIntlProviderPhrases } from '../components/MaterialIntlProvider';
|
|
2
3
|
import type { MaterialConfigApiClientUpdateCallback } from '../material-config';
|
|
3
4
|
type AnyObject = Record<string, any>;
|
|
4
5
|
/**
|
|
@@ -10,6 +11,16 @@ export interface WithMaterialOptions {
|
|
|
10
11
|
* - ref: https://recoiljs.org/docs/api-reference/core/RecoilRoot/#props -> `override`
|
|
11
12
|
*/
|
|
12
13
|
overrideRecoilScope?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Phrases for `IntlProvider`.
|
|
16
|
+
*/
|
|
17
|
+
phrases?: MaterialIntlProviderPhrases;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Common props for material components.
|
|
21
|
+
*/
|
|
22
|
+
export interface MaterialCommponentCommonProps {
|
|
23
|
+
locale?: string;
|
|
13
24
|
}
|
|
14
25
|
/**
|
|
15
26
|
* HOC for material components.
|
|
@@ -18,7 +29,7 @@ export interface WithMaterialOptions {
|
|
|
18
29
|
* - `<RecoilRoot />`
|
|
19
30
|
* - `<IntlProvider />`
|
|
20
31
|
*/
|
|
21
|
-
export declare const withMaterial: <P extends AnyObject>(Component: React.VFC<P>, eliceApiClientConfigInit: MaterialConfigApiClientUpdateCallback, options?: WithMaterialOptions) => React.VFC<P>;
|
|
32
|
+
export declare const withMaterial: <P extends AnyObject>(Component: React.VFC<P & MaterialCommponentCommonProps>, eliceApiClientConfigInit: MaterialConfigApiClientUpdateCallback, options?: WithMaterialOptions) => React.VFC<P & MaterialCommponentCommonProps>;
|
|
22
33
|
/**
|
|
23
34
|
* HOC for material forward ref exotic components.
|
|
24
35
|
*
|
|
@@ -26,5 +37,5 @@ export declare const withMaterial: <P extends AnyObject>(Component: React.VFC<P>
|
|
|
26
37
|
* - `<RecoilRoot />`
|
|
27
38
|
* - `<IntlProvider />`
|
|
28
39
|
*/
|
|
29
|
-
export declare const withForwardRefMaterial: <T, P extends AnyObject>(Component: React.ForwardRefExoticComponent<P & React.RefAttributes<T>>, eliceApiClientConfigInit: MaterialConfigApiClientUpdateCallback, options?: WithMaterialOptions) => React.ForwardRefExoticComponent<React.PropsWithoutRef<P> & React.RefAttributes<T>>;
|
|
40
|
+
export declare const withForwardRefMaterial: <T, P extends AnyObject>(Component: React.ForwardRefExoticComponent<P & MaterialCommponentCommonProps & React.RefAttributes<T>>, eliceApiClientConfigInit: MaterialConfigApiClientUpdateCallback, options?: WithMaterialOptions) => React.ForwardRefExoticComponent<React.PropsWithoutRef<P & MaterialCommponentCommonProps> & React.RefAttributes<T>>;
|
|
30
41
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { forwardRef } from 'react';
|
|
1
|
+
import React, { forwardRef } from 'react';
|
|
3
2
|
import { Flex, Spinner } from '@elice/blocks';
|
|
4
3
|
import { RecoilRoot } from 'recoil';
|
|
4
|
+
import MaterialIntlProvider from '../components/MaterialIntlProvider.js';
|
|
5
5
|
import '../material-config/MaterialConfigContext.js';
|
|
6
6
|
import { useMaterialConfigApiClientUpdate } from '../material-config/useMaterialConfigApiClientUpdate.js';
|
|
7
7
|
|
|
@@ -15,27 +15,27 @@ import { useMaterialConfigApiClientUpdate } from '../material-config/useMaterial
|
|
|
15
15
|
* - `<RecoilRoot />`
|
|
16
16
|
* - `<IntlProvider />`
|
|
17
17
|
*/
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
return function (props) {
|
|
18
|
+
const withMaterial = (Component, eliceApiClientConfigInit, options = {}) => {
|
|
19
|
+
return props => {
|
|
21
20
|
var _a;
|
|
22
|
-
|
|
21
|
+
const isReady = useMaterialConfigApiClientUpdate(eliceApiClientConfigInit);
|
|
23
22
|
// do not render component, if material config is not ready
|
|
24
23
|
if (!isReady) {
|
|
25
|
-
return
|
|
24
|
+
return React.createElement(Flex, {
|
|
26
25
|
justify: "center",
|
|
27
26
|
align: "center",
|
|
28
27
|
width: "100%",
|
|
29
|
-
height: "100%"
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
});
|
|
28
|
+
height: "100%"
|
|
29
|
+
}, React.createElement(Spinner, {
|
|
30
|
+
size: "small"
|
|
31
|
+
}));
|
|
34
32
|
}
|
|
35
|
-
return
|
|
36
|
-
override: (_a = options.overrideRecoilScope) !== null && _a !== void 0 ? _a : false
|
|
37
|
-
|
|
38
|
-
|
|
33
|
+
return React.createElement(RecoilRoot, {
|
|
34
|
+
override: (_a = options.overrideRecoilScope) !== null && _a !== void 0 ? _a : false
|
|
35
|
+
}, React.createElement(MaterialIntlProvider, {
|
|
36
|
+
locale: props.locale,
|
|
37
|
+
phrases: options.phrases
|
|
38
|
+
}, React.createElement(Component, Object.assign({}, props))));
|
|
39
39
|
};
|
|
40
40
|
};
|
|
41
41
|
/**
|
|
@@ -45,29 +45,29 @@ var withMaterial = function withMaterial(Component, eliceApiClientConfigInit) {
|
|
|
45
45
|
* - `<RecoilRoot />`
|
|
46
46
|
* - `<IntlProvider />`
|
|
47
47
|
*/
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
return forwardRef(function (props, ref) {
|
|
48
|
+
const withForwardRefMaterial = (Component, eliceApiClientConfigInit, options = {}) => {
|
|
49
|
+
return forwardRef((props, ref) => {
|
|
51
50
|
var _a;
|
|
52
|
-
|
|
51
|
+
const isReady = useMaterialConfigApiClientUpdate(eliceApiClientConfigInit);
|
|
53
52
|
// do not render component, if material config is not ready
|
|
54
53
|
if (!isReady) {
|
|
55
|
-
return
|
|
54
|
+
return React.createElement(Flex, {
|
|
56
55
|
justify: "center",
|
|
57
56
|
align: "center",
|
|
58
57
|
width: "100%",
|
|
59
|
-
height: "100%"
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
});
|
|
58
|
+
height: "100%"
|
|
59
|
+
}, React.createElement(Spinner, {
|
|
60
|
+
size: "small"
|
|
61
|
+
}));
|
|
64
62
|
}
|
|
65
|
-
return
|
|
66
|
-
override: (_a = options.overrideRecoilScope) !== null && _a !== void 0 ? _a : false
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
}
|
|
63
|
+
return React.createElement(RecoilRoot, {
|
|
64
|
+
override: (_a = options.overrideRecoilScope) !== null && _a !== void 0 ? _a : false
|
|
65
|
+
}, React.createElement(MaterialIntlProvider, {
|
|
66
|
+
locale: props.locale,
|
|
67
|
+
phrases: options.phrases
|
|
68
|
+
}, React.createElement(Component, Object.assign({}, props, {
|
|
69
|
+
ref: ref
|
|
70
|
+
}))));
|
|
71
71
|
});
|
|
72
72
|
};
|
|
73
73
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elice/material-shared-utils",
|
|
3
|
-
"version": "1.240718.
|
|
3
|
+
"version": "1.240718.2",
|
|
4
4
|
"description": "Shared typings for elice material projects",
|
|
5
5
|
"repository": "https://git.elicer.io/elice/frontend/library/elice-material",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -17,8 +17,10 @@
|
|
|
17
17
|
"scripts": {
|
|
18
18
|
"start": "run-s watch",
|
|
19
19
|
"prebuild": "run-s clean",
|
|
20
|
-
"build": "
|
|
21
|
-
"
|
|
20
|
+
"build": "run-p build:es build:cjs",
|
|
21
|
+
"build:es": "rollup -c ../../rollup.config.ts --configPlugin typescript -f es",
|
|
22
|
+
"build:cjs": "rollup -c ../../rollup.config.ts --configPlugin typescript -f cjs",
|
|
23
|
+
"watch": "rollup -c ../../rollup.config.ts --configPlugin typescript -f es -w",
|
|
22
24
|
"lint": "eslint --ext .ts,.tsx ./src --max-warnings=0",
|
|
23
25
|
"clean": "del-cli \"es/*\" \"cjs/*\" \"dist/*\""
|
|
24
26
|
},
|
|
@@ -26,19 +28,20 @@
|
|
|
26
28
|
"@elice/api-client": "^1",
|
|
27
29
|
"@elice/material-shared-types": "*",
|
|
28
30
|
"react": "^16.8.0 || ^17.0.0 || ^18.0.0",
|
|
29
|
-
"react-use": "^17.0.0"
|
|
31
|
+
"react-use": "^17.0.0",
|
|
32
|
+
"recoil": "~0.7.3"
|
|
30
33
|
},
|
|
31
34
|
"dependencies": {
|
|
32
35
|
"lodash-es": "^4.17.21",
|
|
33
|
-
"recoil": "~0.7.3",
|
|
34
36
|
"tslib": "^2.6.1"
|
|
35
37
|
},
|
|
36
38
|
"devDependencies": {
|
|
37
39
|
"@elice/api-client": "^1.240619.0",
|
|
38
|
-
"@elice/material-shared-types": "1.240718.
|
|
39
|
-
"@elice/types": "1.
|
|
40
|
+
"@elice/material-shared-types": "1.240718.2",
|
|
41
|
+
"@elice/types": "^1.240619.0",
|
|
40
42
|
"@types/lodash-es": "^4.17.6",
|
|
41
43
|
"@types/react": "~17.0.9",
|
|
42
44
|
"react-use": "^17.2.4"
|
|
43
|
-
}
|
|
45
|
+
},
|
|
46
|
+
"gitHead": "cd595d8015f44aa8518f22e37b7d2fb981a2b71d"
|
|
44
47
|
}
|