@zgfe/business-lib 1.1.87-auth.2 → 1.1.87
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/context/index.d.ts +0 -1
- package/es/demoWrapper/demo/index.js +11 -6
- package/es/demoWrapper/index.js +0 -8
- package/es/hooks/useChanged.d.ts +2 -0
- package/es/hooks/useChanged.js +21 -0
- package/es/index.d.ts +2 -1
- package/es/index.js +2 -1
- package/package.json +2 -2
package/es/context/index.d.ts
CHANGED
|
@@ -77,7 +77,6 @@ export interface GlobalContextProps {
|
|
|
77
77
|
funPermissions?: any;
|
|
78
78
|
menusName?: any;
|
|
79
79
|
getMenuRouterByName?: (name: string) => string;
|
|
80
|
-
authorityList?: {};
|
|
81
80
|
}
|
|
82
81
|
declare const BizGlobalDataContext: import("react").Context<GlobalContextProps>;
|
|
83
82
|
export default BizGlobalDataContext;
|
|
@@ -1,10 +1,15 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { DemoWrapper, BizGlobalDataContext } from '@zgfe/business-lib';
|
|
1
|
+
import React, { useContext } from 'react';
|
|
2
|
+
import { DemoWrapper, BizGlobalDataContext, useChanged } from '@zgfe/business-lib';
|
|
3
|
+
function Test() {
|
|
4
|
+
var _useContext = useContext(BizGlobalDataContext),
|
|
5
|
+
currentApp = _useContext.currentApp;
|
|
6
|
+
useChanged(function () {
|
|
7
|
+
console.log('currentApp changed', currentApp);
|
|
8
|
+
}, currentApp);
|
|
9
|
+
return /*#__PURE__*/React.createElement("span", null, "\u5F53\u524D\u5E94\u7528\uFF1A", currentApp === null || currentApp === void 0 ? void 0 : currentApp.appName, "(id: ", currentApp === null || currentApp === void 0 ? void 0 : currentApp.id, ")");
|
|
10
|
+
}
|
|
3
11
|
export default (function () {
|
|
4
12
|
return /*#__PURE__*/React.createElement(DemoWrapper, {
|
|
5
13
|
needMeta: true
|
|
6
|
-
}, /*#__PURE__*/React.createElement(
|
|
7
|
-
var currentApp = _ref.currentApp;
|
|
8
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, "\u5F53\u524D\u5E94\u7528\uFF1A", currentApp.appName, "(id: ", currentApp.id, ")");
|
|
9
|
-
}));
|
|
14
|
+
}, /*#__PURE__*/React.createElement(Test, null));
|
|
10
15
|
});
|
package/es/demoWrapper/index.js
CHANGED
|
@@ -45,14 +45,6 @@ var DemoWrapper = function DemoWrapper(_ref) {
|
|
|
45
45
|
}).finally(function () {
|
|
46
46
|
setLoading(false);
|
|
47
47
|
});
|
|
48
|
-
request('/zg/web/v2/company/setting/queryRoleMenuTree', {
|
|
49
|
-
method: 'post',
|
|
50
|
-
data: {
|
|
51
|
-
systemVersion: 1
|
|
52
|
-
}
|
|
53
|
-
}).then(function (res) {
|
|
54
|
-
if (!res) {}
|
|
55
|
-
}).catch(function () {});
|
|
56
48
|
}
|
|
57
49
|
if (loading) {
|
|
58
50
|
return /*#__PURE__*/React.createElement(Spin, null);
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
+
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."); }
|
|
3
|
+
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); }
|
|
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
|
+
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
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
|
+
import { useEffect, useState } from 'react';
|
|
8
|
+
import _ from 'lodash';
|
|
9
|
+
function useChanged(callback, dep) {
|
|
10
|
+
var _useState = useState(dep),
|
|
11
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
12
|
+
preDeps = _useState2[0],
|
|
13
|
+
setPredeps = _useState2[1];
|
|
14
|
+
useEffect(function () {
|
|
15
|
+
if (!_.isEqual(preDeps, dep)) {
|
|
16
|
+
callback(preDeps, dep);
|
|
17
|
+
}
|
|
18
|
+
setPredeps(dep);
|
|
19
|
+
}, [dep]);
|
|
20
|
+
}
|
|
21
|
+
export default useChanged;
|
package/es/index.d.ts
CHANGED
|
@@ -42,7 +42,8 @@ import BizUserGroupHeader from './userGroupHeader';
|
|
|
42
42
|
import BizFormulaTarget from './formulaTarget';
|
|
43
43
|
import { chartColors } from './chart/util/color';
|
|
44
44
|
import useBizStore from './hooks/useBizStore';
|
|
45
|
-
|
|
45
|
+
import useChanged from './hooks/useChanged';
|
|
46
|
+
export { BizTargetDimension, BizTargetFromPanel, BizSearchInput, BizSelect, BizDialog, BizChart, BizTable, BizLayout, BizAnalysisLayout, BizDetailLayout, BizUserGroup, BizUserGroupHeader, IconFont, ColorIcon, BizFormulaTarget, BizTargetSelector, BizEventSelector, BizAttributeSelector, BizGlobalDataContext, BizTargetFromPanelContext, BizTargetCondition, BizDatePicker, BizQuickDatePicker, BizLoading, BizConditionItem, BizConditionGroup, BizAttrCondition, BizAttrConditionGroup, BizUserCondition, BizAddToScene, BizAddToPanel, BizCycleTime, BizDnd, BizLoginForm, DemoWrapper, SocketClient, ajax, util, base64, theme, convertAttributeData, BizUserTagsSelect, setGlobalConfig, chartColors, useBizStore, useChanged, };
|
|
46
47
|
export type { UserGroupTypes } from './userGroup/types';
|
|
47
48
|
export type { BizSelectTypes } from './select/types';
|
|
48
49
|
export type { AttributeSelect } from './attributeSelector/types';
|
package/es/index.js
CHANGED
|
@@ -41,4 +41,5 @@ import BizUserGroupHeader from './userGroupHeader';
|
|
|
41
41
|
import BizFormulaTarget from './formulaTarget';
|
|
42
42
|
import { chartColors } from './chart/util/color';
|
|
43
43
|
import useBizStore from './hooks/useBizStore';
|
|
44
|
-
|
|
44
|
+
import useChanged from './hooks/useChanged';
|
|
45
|
+
export { BizTargetDimension, BizTargetFromPanel, BizSearchInput, BizSelect, BizDialog, BizChart, BizTable, BizLayout, BizAnalysisLayout, BizDetailLayout, BizUserGroup, BizUserGroupHeader, IconFont, ColorIcon, BizFormulaTarget, BizTargetSelector, BizEventSelector, BizAttributeSelector, BizGlobalDataContext, BizTargetFromPanelContext, BizTargetCondition, BizDatePicker, BizQuickDatePicker, BizLoading, BizConditionItem, BizConditionGroup, BizAttrCondition, BizAttrConditionGroup, BizUserCondition, BizAddToScene, BizAddToPanel, BizCycleTime, BizDnd, BizLoginForm, DemoWrapper, SocketClient, ajax, util, base64, theme, convertAttributeData, BizUserTagsSelect, setGlobalConfig, chartColors, useBizStore, useChanged };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zgfe/business-lib",
|
|
3
|
-
"version": "1.1.87
|
|
3
|
+
"version": "1.1.87",
|
|
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": "7a4bc2b2bcbdc96ab8254b718e62a90dfe820860",
|
|
59
59
|
"gitHooks": {
|
|
60
60
|
"pre-commit": "lint-staged"
|
|
61
61
|
}
|