@zgfe/business-lib 1.2.55-plat.3 → 1.2.55-plat.4
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/platformSelector/index.js +5 -39
- package/package.json +2 -2
|
@@ -4,12 +4,9 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
4
4
|
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; }
|
|
5
5
|
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
6
6
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
|
-
import React, { useState, useEffect
|
|
7
|
+
import React, { useState, useEffect } from 'react';
|
|
8
8
|
import { BizSelect } from '@zgfe/business-lib';
|
|
9
9
|
import './styles/index.less';
|
|
10
|
-
import request from '../utils/ajax';
|
|
11
|
-
import Apis from '../constants/apis';
|
|
12
|
-
import BizGlobalDataContext from '../context';
|
|
13
10
|
import { platformOptionUtil } from './util';
|
|
14
11
|
var BizPlatformSelector = function BizPlatformSelector(props) {
|
|
15
12
|
var classPrefix = 'biz-platform-selector';
|
|
@@ -17,52 +14,21 @@ var BizPlatformSelector = function BizPlatformSelector(props) {
|
|
|
17
14
|
_useState2 = _slicedToArray(_useState, 2),
|
|
18
15
|
currentValue = _useState2[0],
|
|
19
16
|
setCurrentValue = _useState2[1];
|
|
20
|
-
var _useContext = useContext(BizGlobalDataContext),
|
|
21
|
-
currentApp = _useContext.currentApp;
|
|
22
|
-
var _useState3 = useState([]),
|
|
23
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
24
|
-
platformOption = _useState4[0],
|
|
25
|
-
setPlatformOption = _useState4[1];
|
|
26
17
|
useEffect(function () {
|
|
27
18
|
if (props.value) {
|
|
28
|
-
var selectValue =
|
|
19
|
+
var selectValue = platformOptionUtil.find(function (item) {
|
|
29
20
|
return item.key === props.value;
|
|
30
21
|
});
|
|
31
|
-
setCurrentValue(selectValue ||
|
|
22
|
+
setCurrentValue(selectValue || platformOptionUtil[0]);
|
|
32
23
|
}
|
|
33
24
|
}, [props.value]);
|
|
34
|
-
useEffect(function () {
|
|
35
|
-
queryPlatformList();
|
|
36
|
-
}, []);
|
|
37
|
-
function queryPlatformList() {
|
|
38
|
-
request(Apis.queryPlatformList, {
|
|
39
|
-
method: 'get',
|
|
40
|
-
params: {
|
|
41
|
-
appId: currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId
|
|
42
|
-
}
|
|
43
|
-
}).then(function (res) {
|
|
44
|
-
var _res$data;
|
|
45
|
-
if (res === null || res === void 0 ? void 0 : (_res$data = res.data) === null || _res$data === void 0 ? void 0 : _res$data.length) {
|
|
46
|
-
var list = res.data.map(function (item) {
|
|
47
|
-
return item.sdkPlatform;
|
|
48
|
-
});
|
|
49
|
-
var options = platformOptionUtil.map(function (item) {
|
|
50
|
-
if (list.includes(item.key) || item.key === 0) {
|
|
51
|
-
return item;
|
|
52
|
-
}
|
|
53
|
-
}).filter(function (item) {
|
|
54
|
-
return item;
|
|
55
|
-
});
|
|
56
|
-
setPlatformOption(options || []);
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
}
|
|
25
|
+
useEffect(function () {}, []);
|
|
60
26
|
return /*#__PURE__*/React.createElement("div", {
|
|
61
27
|
className: classPrefix
|
|
62
28
|
}, /*#__PURE__*/React.createElement(BizSelect, {
|
|
63
29
|
className: "".concat(classPrefix, "-select"),
|
|
64
30
|
overlayClassName: "".concat(classPrefix, "-select-overlay"),
|
|
65
|
-
options: props.valueOption && props.valueOption.length ? props.valueOption :
|
|
31
|
+
options: props.valueOption && props.valueOption.length ? props.valueOption : platformOptionUtil,
|
|
66
32
|
overlayWidth: 134,
|
|
67
33
|
keyField: "key",
|
|
68
34
|
labelField: "value",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zgfe/business-lib",
|
|
3
|
-
"version": "1.2.55-plat.
|
|
3
|
+
"version": "1.2.55-plat.4",
|
|
4
4
|
"module": "es/index.js",
|
|
5
5
|
"typings": "es/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"react": "^16.12.0 || ^17.0.0",
|
|
56
56
|
"yorkie": "^2.0.0"
|
|
57
57
|
},
|
|
58
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "7bda9bea59b087f73bf460a7388ce613957b9e88",
|
|
59
59
|
"gitHooks": {
|
|
60
60
|
"pre-commit": "lint-staged"
|
|
61
61
|
}
|