@cloud-app-dev/vidc 2.1.0-alpha.7 → 2.1.0-alpha.8
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/es/Dict/hook.d.ts +0 -1
- package/es/Dict/hook.js +5 -21
- package/es/Dict/index.d.ts +1 -5
- package/es/Dict/index.js +2 -6
- package/es/Dict/utils.d.ts +0 -1
- package/es/Dict/utils.js +0 -7
- package/es/InitialConfig/index.js +0 -2
- package/es/LoaderApp/index.js +3 -3
- package/package.json +1 -1
- package/es/Dict/desc.d.ts +0 -64
- package/es/Dict/desc.js +0 -162
package/es/Dict/hook.d.ts
CHANGED
package/es/Dict/hook.js
CHANGED
|
@@ -19,7 +19,7 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
|
|
|
19
19
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
20
20
|
|
|
21
21
|
import { useMemo, useState, useEffect } from 'react';
|
|
22
|
-
import { queryByTypeCode, queryByTypeCodes,
|
|
22
|
+
import { queryByTypeCode, queryByTypeCodes, formartItemTextExt } from './utils';
|
|
23
23
|
import LMDict from './cache';
|
|
24
24
|
export function useDict(typeCode) {
|
|
25
25
|
var _useState = useState(LMDict.data[typeCode] || []),
|
|
@@ -47,22 +47,6 @@ export function useDict(typeCode) {
|
|
|
47
47
|
}, [typeCode]);
|
|
48
48
|
return codes;
|
|
49
49
|
}
|
|
50
|
-
export function useTypeCodes() {
|
|
51
|
-
var _useState3 = useState(LMDict.data['typeCodes'] || []),
|
|
52
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
53
|
-
typeCodes = _useState4[0],
|
|
54
|
-
setTypeCodes = _useState4[1];
|
|
55
|
-
|
|
56
|
-
useEffect(function () {
|
|
57
|
-
if (!LMDict.data['typeCodes']) {
|
|
58
|
-
queryTypeCodes().then(function (res) {
|
|
59
|
-
setTypeCodes(res);
|
|
60
|
-
LMDict.updateDictMap('typeCode', res);
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
}, []);
|
|
64
|
-
return typeCodes;
|
|
65
|
-
}
|
|
66
50
|
export function useDicts() {
|
|
67
51
|
var typeCodes = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
68
52
|
var isWebVisible = arguments.length > 1 ? arguments[1] : undefined;
|
|
@@ -70,14 +54,14 @@ export function useDicts() {
|
|
|
70
54
|
return typeCodes.toString();
|
|
71
55
|
}, [typeCodes]);
|
|
72
56
|
|
|
73
|
-
var
|
|
57
|
+
var _useState3 = useState(function () {
|
|
74
58
|
return typeCodes.map(function (v) {
|
|
75
59
|
return LMDict.data[v] ? LMDict.data[v] : [];
|
|
76
60
|
});
|
|
77
61
|
}),
|
|
78
|
-
|
|
79
|
-
dicts =
|
|
80
|
-
setDicts =
|
|
62
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
63
|
+
dicts = _useState4[0],
|
|
64
|
+
setDicts = _useState4[1];
|
|
81
65
|
|
|
82
66
|
useEffect(function () {
|
|
83
67
|
var codes = typeCodes.filter(function (v) {
|
package/es/Dict/index.d.ts
CHANGED
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
import * as device from './device';
|
|
2
|
-
import { useDict, useDicts
|
|
3
|
-
import { withDict, withTypeCodes } from './desc';
|
|
2
|
+
import { useDict, useDicts } from './hook';
|
|
4
3
|
declare const Dict: {
|
|
5
4
|
useDict: typeof useDict;
|
|
6
5
|
useDicts: typeof useDicts;
|
|
7
6
|
device: typeof device;
|
|
8
7
|
cacheMap: import("./interface").CacheDictType;
|
|
9
|
-
withDict: typeof withDict;
|
|
10
|
-
useTypeCodes: typeof useTypeCodes;
|
|
11
|
-
withTypeCodes: typeof withTypeCodes;
|
|
12
8
|
};
|
|
13
9
|
export default Dict;
|
package/es/Dict/index.js
CHANGED
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
import LMDict from './cache';
|
|
2
2
|
import * as device from './device';
|
|
3
|
-
import { useDict, useDicts
|
|
4
|
-
import { withDict, withTypeCodes } from './desc';
|
|
3
|
+
import { useDict, useDicts } from './hook';
|
|
5
4
|
var Dict = {
|
|
6
5
|
useDict: useDict,
|
|
7
6
|
useDicts: useDicts,
|
|
8
7
|
device: device,
|
|
9
|
-
cacheMap: LMDict
|
|
10
|
-
withDict: withDict,
|
|
11
|
-
useTypeCodes: useTypeCodes,
|
|
12
|
-
withTypeCodes: withTypeCodes
|
|
8
|
+
cacheMap: LMDict
|
|
13
9
|
};
|
|
14
10
|
export default Dict;
|
package/es/Dict/utils.d.ts
CHANGED
|
@@ -5,7 +5,6 @@ export declare function queryByTypeCode(typeCode: any): Promise<{
|
|
|
5
5
|
export declare function queryByTypeCodes(typeCodes?: any[], isWebVisible?: boolean): Promise<{
|
|
6
6
|
data: DictItem[];
|
|
7
7
|
}>;
|
|
8
|
-
export declare function queryTypeCodes(): Promise<DictItem[]>;
|
|
9
8
|
export declare function formartItemTextExt(text: string): {
|
|
10
9
|
[key: string]: any;
|
|
11
10
|
};
|
package/es/Dict/utils.js
CHANGED
|
@@ -29,13 +29,6 @@ export function queryByTypeCodes() {
|
|
|
29
29
|
}
|
|
30
30
|
});
|
|
31
31
|
}
|
|
32
|
-
export function queryTypeCodes() {
|
|
33
|
-
return Service.http({
|
|
34
|
-
url: "/micro-apps/micro-dep-librarys/config/typeCodes.json",
|
|
35
|
-
method: 'get',
|
|
36
|
-
requestId: 'queryTypeCodes'
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
32
|
export function formartItemTextExt(text) {
|
|
40
33
|
var ext = {};
|
|
41
34
|
|
|
@@ -11,7 +11,6 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
|
|
|
11
11
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
12
12
|
|
|
13
13
|
import React, { useState, useEffect } from 'react';
|
|
14
|
-
import Dict from '../Dict';
|
|
15
14
|
import Config from '../Config';
|
|
16
15
|
import { queryBSConfig, queryMicroApplicationList, querySystemUpdate, queryDefaultTheme } from './utils';
|
|
17
16
|
|
|
@@ -28,7 +27,6 @@ function InitialConfig(_ref) {
|
|
|
28
27
|
state = _useState2[0],
|
|
29
28
|
setState = _useState2[1];
|
|
30
29
|
|
|
31
|
-
Dict.useTypeCodes();
|
|
32
30
|
useEffect(function () {
|
|
33
31
|
var arr = [queryBSConfig(), queryMicroApplicationList(), querySystemUpdate(), queryDefaultTheme()];
|
|
34
32
|
Promise.all(arr).then(function (_ref2) {
|
package/es/LoaderApp/index.js
CHANGED
|
@@ -100,12 +100,12 @@ function LoaderApp(_ref) {
|
|
|
100
100
|
}));
|
|
101
101
|
});
|
|
102
102
|
return function () {
|
|
103
|
-
|
|
103
|
+
console.debug('LoaderApp is destory!');
|
|
104
|
+
|
|
105
|
+
if (app) {
|
|
104
106
|
app.unmount(props);
|
|
105
107
|
setStatus('unmount');
|
|
106
108
|
app = null;
|
|
107
|
-
} catch (error) {
|
|
108
|
-
console.error(error);
|
|
109
109
|
}
|
|
110
110
|
};
|
|
111
111
|
}, []);
|
package/package.json
CHANGED
package/es/Dict/desc.d.ts
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { DictItem } from './interface';
|
|
3
|
-
export declare function withDict(codes?: any[], isWebVisible?: boolean): (Component: any) => (props: any) => JSX.Element;
|
|
4
|
-
export declare function withTypeCodes(Component: any): {
|
|
5
|
-
new (props: any): {
|
|
6
|
-
componentDidMount(): void;
|
|
7
|
-
render(): JSX.Element;
|
|
8
|
-
context: any;
|
|
9
|
-
setState<K extends "typeCodes" | "isInit">(state: {
|
|
10
|
-
typeCodes: DictItem[];
|
|
11
|
-
isInit: boolean;
|
|
12
|
-
} | ((prevState: Readonly<{
|
|
13
|
-
typeCodes: DictItem[];
|
|
14
|
-
isInit: boolean;
|
|
15
|
-
}>, props: Readonly<any>) => {
|
|
16
|
-
typeCodes: DictItem[];
|
|
17
|
-
isInit: boolean;
|
|
18
|
-
} | Pick<{
|
|
19
|
-
typeCodes: DictItem[];
|
|
20
|
-
isInit: boolean;
|
|
21
|
-
}, K>) | Pick<{
|
|
22
|
-
typeCodes: DictItem[];
|
|
23
|
-
isInit: boolean;
|
|
24
|
-
}, K>, callback?: () => void): void;
|
|
25
|
-
forceUpdate(callback?: () => void): void;
|
|
26
|
-
readonly props: Readonly<any> & Readonly<{
|
|
27
|
-
children?: React.ReactNode;
|
|
28
|
-
}>;
|
|
29
|
-
state: Readonly<{
|
|
30
|
-
typeCodes: DictItem[];
|
|
31
|
-
isInit: boolean;
|
|
32
|
-
}>;
|
|
33
|
-
refs: {
|
|
34
|
-
[key: string]: React.ReactInstance;
|
|
35
|
-
};
|
|
36
|
-
shouldComponentUpdate?(nextProps: Readonly<any>, nextState: Readonly<{
|
|
37
|
-
typeCodes: DictItem[];
|
|
38
|
-
isInit: boolean;
|
|
39
|
-
}>, nextContext: any): boolean;
|
|
40
|
-
componentWillUnmount?(): void;
|
|
41
|
-
componentDidCatch?(error: Error, errorInfo: React.ErrorInfo): void;
|
|
42
|
-
getSnapshotBeforeUpdate?(prevProps: Readonly<any>, prevState: Readonly<{
|
|
43
|
-
typeCodes: DictItem[];
|
|
44
|
-
isInit: boolean;
|
|
45
|
-
}>): any;
|
|
46
|
-
componentDidUpdate?(prevProps: Readonly<any>, prevState: Readonly<{
|
|
47
|
-
typeCodes: DictItem[];
|
|
48
|
-
isInit: boolean;
|
|
49
|
-
}>, snapshot?: any): void;
|
|
50
|
-
componentWillMount?(): void;
|
|
51
|
-
UNSAFE_componentWillMount?(): void;
|
|
52
|
-
componentWillReceiveProps?(nextProps: Readonly<any>, nextContext: any): void;
|
|
53
|
-
UNSAFE_componentWillReceiveProps?(nextProps: Readonly<any>, nextContext: any): void;
|
|
54
|
-
componentWillUpdate?(nextProps: Readonly<any>, nextState: Readonly<{
|
|
55
|
-
typeCodes: DictItem[];
|
|
56
|
-
isInit: boolean;
|
|
57
|
-
}>, nextContext: any): void;
|
|
58
|
-
UNSAFE_componentWillUpdate?(nextProps: Readonly<any>, nextState: Readonly<{
|
|
59
|
-
typeCodes: DictItem[];
|
|
60
|
-
isInit: boolean;
|
|
61
|
-
}>, nextContext: any): void;
|
|
62
|
-
};
|
|
63
|
-
contextType?: React.Context<any>;
|
|
64
|
-
};
|
package/es/Dict/desc.js
DELETED
|
@@ -1,162 +0,0 @@
|
|
|
1
|
-
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
-
|
|
3
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
4
|
-
|
|
5
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
6
|
-
|
|
7
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
8
|
-
|
|
9
|
-
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
10
|
-
|
|
11
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
12
|
-
|
|
13
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
14
|
-
|
|
15
|
-
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
16
|
-
|
|
17
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
18
|
-
|
|
19
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
20
|
-
|
|
21
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
22
|
-
|
|
23
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
24
|
-
|
|
25
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
26
|
-
|
|
27
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
28
|
-
|
|
29
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
30
|
-
|
|
31
|
-
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
32
|
-
|
|
33
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
34
|
-
|
|
35
|
-
import React, { useRef, useState, useEffect } from 'react';
|
|
36
|
-
import { queryByTypeCodes, queryTypeCodes, formartItemTextExt } from './utils';
|
|
37
|
-
import LMDict from './cache';
|
|
38
|
-
export function withDict() {
|
|
39
|
-
var codes = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
40
|
-
var isWebVisible = arguments.length > 1 ? arguments[1] : undefined;
|
|
41
|
-
return function (Component) {
|
|
42
|
-
return function (props) {
|
|
43
|
-
var isInitRef = useRef(false);
|
|
44
|
-
|
|
45
|
-
var _useState = useState(function () {
|
|
46
|
-
var map = {};
|
|
47
|
-
codes.forEach(function (code) {
|
|
48
|
-
if (LMDict.data[code]) {
|
|
49
|
-
map[code] = LMDict.data[code];
|
|
50
|
-
} else {
|
|
51
|
-
map[code] = [];
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
return map;
|
|
55
|
-
}),
|
|
56
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
57
|
-
dictMap = _useState2[0],
|
|
58
|
-
setDictMap = _useState2[1];
|
|
59
|
-
|
|
60
|
-
useEffect(function () {
|
|
61
|
-
var nocacheCodes = codes.filter(function (v) {
|
|
62
|
-
return !LMDict.data[v];
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
if (nocacheCodes.length === 0) {
|
|
66
|
-
isInitRef.current = true;
|
|
67
|
-
setDictMap(function (old) {
|
|
68
|
-
return Object.assign({}, old);
|
|
69
|
-
});
|
|
70
|
-
return;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
queryByTypeCodes(nocacheCodes, isWebVisible).then(function (res) {
|
|
74
|
-
isInitRef.current = true;
|
|
75
|
-
var data = res.data;
|
|
76
|
-
data.forEach(function (item) {
|
|
77
|
-
item.label = item.name;
|
|
78
|
-
item.value = item.code;
|
|
79
|
-
item = Object.assign(Object.assign({}, item), formartItemTextExt(item.extText));
|
|
80
|
-
});
|
|
81
|
-
setDictMap(function (old) {
|
|
82
|
-
nocacheCodes.forEach(function (code) {
|
|
83
|
-
var itemCodes = data.filter(function (v1) {
|
|
84
|
-
return +v1.typeCode === +code;
|
|
85
|
-
});
|
|
86
|
-
old[code] = itemCodes;
|
|
87
|
-
LMDict.updateDictMap(code, itemCodes);
|
|
88
|
-
});
|
|
89
|
-
return Object.assign({}, old);
|
|
90
|
-
});
|
|
91
|
-
});
|
|
92
|
-
}, []);
|
|
93
|
-
|
|
94
|
-
if (!isInitRef.current) {
|
|
95
|
-
return null;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
return /*#__PURE__*/React.createElement(Component, Object.assign({}, props, {
|
|
99
|
-
dictMap: dictMap
|
|
100
|
-
}));
|
|
101
|
-
};
|
|
102
|
-
};
|
|
103
|
-
}
|
|
104
|
-
export function withTypeCodes(Component) {
|
|
105
|
-
return /*#__PURE__*/function (_React$Component) {
|
|
106
|
-
_inherits(withTypeCodesComponent, _React$Component);
|
|
107
|
-
|
|
108
|
-
var _super = _createSuper(withTypeCodesComponent);
|
|
109
|
-
|
|
110
|
-
function withTypeCodesComponent(props) {
|
|
111
|
-
var _this;
|
|
112
|
-
|
|
113
|
-
_classCallCheck(this, withTypeCodesComponent);
|
|
114
|
-
|
|
115
|
-
_this = _super.call(this, props);
|
|
116
|
-
_this.state = {
|
|
117
|
-
typeCodes: LMDict.data['typeCodes'] || [],
|
|
118
|
-
isInit: false
|
|
119
|
-
};
|
|
120
|
-
return _this;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
_createClass(withTypeCodesComponent, [{
|
|
124
|
-
key: "componentDidMount",
|
|
125
|
-
value: function componentDidMount() {
|
|
126
|
-
var _this2 = this;
|
|
127
|
-
|
|
128
|
-
if (!LMDict.data['typeCodes']) {
|
|
129
|
-
queryTypeCodes().then(function (res) {
|
|
130
|
-
LMDict.updateDictMap('typeCodes', res);
|
|
131
|
-
|
|
132
|
-
_this2.setState({
|
|
133
|
-
typeCodes: res,
|
|
134
|
-
isInit: true
|
|
135
|
-
});
|
|
136
|
-
}).catch(function () {
|
|
137
|
-
_this2.setState({
|
|
138
|
-
typeCodes: [],
|
|
139
|
-
isInit: true
|
|
140
|
-
});
|
|
141
|
-
});
|
|
142
|
-
} else this.setState({
|
|
143
|
-
typeCodes: LMDict.data['typeCodes'],
|
|
144
|
-
isInit: true
|
|
145
|
-
});
|
|
146
|
-
}
|
|
147
|
-
}, {
|
|
148
|
-
key: "render",
|
|
149
|
-
value: function render() {
|
|
150
|
-
if (!this.state.isInit) {
|
|
151
|
-
return null;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
return /*#__PURE__*/React.createElement(Component, Object.assign({}, this.props, {
|
|
155
|
-
typeCodes: this.state.typeCodes
|
|
156
|
-
}));
|
|
157
|
-
}
|
|
158
|
-
}]);
|
|
159
|
-
|
|
160
|
-
return withTypeCodesComponent;
|
|
161
|
-
}(React.Component);
|
|
162
|
-
}
|