antd-management-fast-framework 1.11.16 → 1.11.20

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.
@@ -5,9 +5,11 @@ declare class FlexText extends React.PureComponent<any, any, any> {
5
5
  }
6
6
  declare namespace FlexText {
7
7
  export namespace defaultProps {
8
+ export const flexAuto: string;
8
9
  export const icon: null;
9
10
  export const textPrefix: null;
10
11
  export const text: string;
12
+ export const ellipsis: boolean;
11
13
  export const textEllipsisMaxWidth: number;
12
14
  export const subText: string;
13
15
  export const subTextStyle: null;
@@ -60,9 +60,11 @@ var FlexText = /*#__PURE__*/function (_PureComponent) {
60
60
  key: "render",
61
61
  value: function render() {
62
62
  var _this$props = this.props,
63
+ flexAutoSource = _this$props.flexAuto,
63
64
  icon = _this$props.icon,
64
65
  textPrefix = _this$props.textPrefix,
65
66
  text = _this$props.text,
67
+ ellipsis = _this$props.ellipsis,
66
68
  textEllipsisMaxWidth = _this$props.textEllipsisMaxWidth,
67
69
  subText = _this$props.subText,
68
70
  subTextStyle = _this$props.subTextStyle,
@@ -72,11 +74,12 @@ var FlexText = /*#__PURE__*/function (_PureComponent) {
72
74
  style = _this$props.style;
73
75
  return /*#__PURE__*/_react.default.createElement(_FlexBox.default, {
74
76
  style: style,
77
+ flexAuto: flexAutoSource,
75
78
  left: /*#__PURE__*/_react.default.createElement(_space.default, null, (addonBefore || null) == null ? null : addonBefore, /*#__PURE__*/_react.default.createElement(_IconInfo.default, {
76
79
  icon: icon,
77
80
  textPrefix: textPrefix,
78
81
  text: text,
79
- ellipsis: true,
82
+ ellipsis: ellipsis,
80
83
  ellipsisMaxWidth: textEllipsisMaxWidth
81
84
  }), (subText || null) == null ? null : /*#__PURE__*/_react.default.createElement("span", {
82
85
  className: _index.default.subText,
@@ -91,9 +94,11 @@ var FlexText = /*#__PURE__*/function (_PureComponent) {
91
94
  }(_react.PureComponent);
92
95
 
93
96
  FlexText.defaultProps = {
97
+ flexAuto: 'left',
94
98
  icon: null,
95
99
  textPrefix: null,
96
100
  text: '',
101
+ ellipsis: true,
97
102
  textEllipsisMaxWidth: 0,
98
103
  subText: '',
99
104
  subTextStyle: null,
@@ -3,7 +3,7 @@ declare class AuthorizationWrapper extends SupplementWrapper {
3
3
  componentAuthority: any;
4
4
  doDidMountTask: () => void;
5
5
  checkAuthority: (auth: any) => boolean;
6
- checkAuthorities: (auth: any) => boolean;
6
+ checkAuthorities: (auth: any) => any;
7
7
  getCurrentOperator: () => any;
8
8
  reloadCurrentOperator: (callback?: any) => void;
9
9
  }
@@ -19,14 +19,6 @@ require("antd/es/form/style");
19
19
 
20
20
  var _form = _interopRequireDefault(require("antd/es/form"));
21
21
 
22
- require("antd/es/row/style");
23
-
24
- var _row = _interopRequireDefault(require("antd/es/row"));
25
-
26
- require("antd/es/col/style");
27
-
28
- var _col = _interopRequireDefault(require("antd/es/col"));
29
-
30
22
  var _react = _interopRequireDefault(require("react"));
31
23
 
32
24
  var _icons = require("@ant-design/icons");
@@ -35,6 +27,10 @@ var _tools = require("../../../utils/tools");
35
27
 
36
28
  var _constants = require("../../../utils/constants");
37
29
 
30
+ var _IconInfo = _interopRequireDefault(require("../../../customComponents/IconInfo"));
31
+
32
+ var _FlexText = _interopRequireDefault(require("../../../customComponents/FlexText"));
33
+
38
34
  var _BaseWindow2 = _interopRequireDefault(require("../../DataOperation/BaseWindow"));
39
35
 
40
36
  var _index = _interopRequireDefault(require("./index.less"));
@@ -192,16 +188,21 @@ var Base = /*#__PURE__*/function (_BaseWindow) {
192
188
  };
193
189
 
194
190
  _this.buildTitle = function () {
195
- var prevText = _this.buildTitlePrevText();
196
-
197
191
  var subText = _this.buildTitleSubText();
198
192
 
199
- subText = (0, _tools.stringIsNullOrWhiteSpace)(subText) ? '' : "\uFF1A\u3010".concat(subText, "\u3011");
200
- return /*#__PURE__*/_react.default.createElement(_row.default, {
201
- gutter: 6
202
- }, /*#__PURE__*/_react.default.createElement(_col.default, null, _this.buildTitleIcon()), /*#__PURE__*/_react.default.createElement(_col.default, {
203
- flex: "auto"
204
- }, prevText, _this.buildTitleText(), subText));
193
+ var subInfo = (0, _tools.stringIsNullOrWhiteSpace)(subText) ? null : /*#__PURE__*/_react.default.createElement(_FlexText.default, {
194
+ flexAuto: "right",
195
+ addonBefore: '【',
196
+ text: subText,
197
+ addonAfter: '】'
198
+ });
199
+ return /*#__PURE__*/_react.default.createElement(_FlexText.default, {
200
+ flexAuto: "right",
201
+ icon: _this.buildTitleIcon(),
202
+ textPrefix: _this.buildTitlePrevText(),
203
+ text: _this.buildTitleText(),
204
+ extra: subInfo
205
+ });
205
206
  };
206
207
 
207
208
  _this.formContent = function () {
@@ -1,6 +1,4 @@
1
- export function getAllAuthority(): any;
2
1
  export function checkIsSuper(): boolean;
3
- export function checkHasAuthorities(authCollection: any): boolean;
4
2
  export function checkHasAuthority(auth: any): boolean;
5
3
  /**
6
4
  * 缓存用户权限数据体
@@ -3,10 +3,8 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.checkHasAuthorities = checkHasAuthorities;
7
6
  exports.checkHasAuthority = checkHasAuthority;
8
7
  exports.checkIsSuper = checkIsSuper;
9
- exports.getAllAuthority = getAllAuthority;
10
8
  exports.setAuthority = setAuthority;
11
9
 
12
10
  var _tools = require("./tools");
@@ -18,6 +16,7 @@ var _globalStorageAssist = require("./globalStorageAssist");
18
16
  var _Authorized = require("./Authorized");
19
17
 
20
18
  var authorityCollectionCache = 'authorityCollectionCache';
19
+ var superPermissionCacheKey = 'hasSuperPermission';
21
20
 
22
21
  function getAllAuthorityCore() {
23
22
  var result = [];
@@ -57,23 +56,73 @@ function getAllAuthorityCore() {
57
56
  return result;
58
57
  }
59
58
 
59
+ function getSuperPermission() {
60
+ var result = '';
61
+ var accessWayCollection = (0, _globalStorageAssist.getAccessWayCollectionCache)();
62
+
63
+ if (!(0, _tools.isObject)(accessWayCollection)) {
64
+ return result;
65
+ }
66
+
67
+ var superPermission = (0, _tools.getValueByKey)({
68
+ data: accessWayCollection,
69
+ key: 'super'
70
+ });
71
+
72
+ if ((0, _tools.isObject)(superPermission)) {
73
+ var _superAuth = (0, _tools.getValueByKey)({
74
+ data: superPermission,
75
+ key: 'permission'
76
+ });
77
+
78
+ if ((0, _tools.isString)(_superAuth)) {
79
+ result = _superAuth;
80
+ }
81
+ }
82
+
83
+ return result;
84
+ }
85
+
60
86
  function getAllAuthority() {
61
87
  return getAllAuthorityCore();
62
88
  }
63
89
 
64
90
  function checkIsSuper() {
65
- var _getAccessWayCollecti;
91
+ var existCache = (0, _cacheAssist.hasCache)({
92
+ key: superPermissionCacheKey
93
+ });
66
94
 
67
- var list = getAllAuthorityCore();
68
- var superAuth = (_getAccessWayCollecti = (0, _globalStorageAssist.getAccessWayCollectionCache)().super.permission) !== null && _getAccessWayCollecti !== void 0 ? _getAccessWayCollecti : '';
69
- var isSuper = (list || []).find(function (o) {
70
- return o === superAuth;
71
- }) || '';
95
+ if (existCache) {
96
+ var result = (0, _cacheAssist.getCache)({
97
+ key: superPermissionCacheKey
98
+ });
72
99
 
73
- if (isSuper === superAuth) {
74
- return true;
100
+ if (result !== undefined) {
101
+ return !!result;
102
+ }
103
+ }
104
+
105
+ var superPermission = getSuperPermission();
106
+
107
+ if (!(0, _tools.stringIsNullOrWhiteSpace)(superPermission)) {
108
+ var list = getAllAuthority();
109
+ var isSuper = (list || []).find(function (o) {
110
+ return o === superPermission;
111
+ }) || '';
112
+
113
+ if (isSuper === superPermission) {
114
+ (0, _cacheAssist.setCache)({
115
+ key: superPermissionCacheKey,
116
+ value: true
117
+ });
118
+ return true;
119
+ }
75
120
  }
76
121
 
122
+ (0, _cacheAssist.setCache)({
123
+ key: superPermissionCacheKey,
124
+ value: false
125
+ });
77
126
  return false;
78
127
  }
79
128
 
@@ -82,7 +131,7 @@ function checkHasAuthorities(authCollection) {
82
131
 
83
132
  if ((0, _tools.isArray)(authCollection)) {
84
133
  authCollection.forEach(function (auth) {
85
- result = checkHasAuthority(auth);
134
+ result = checkHasAuthorityCore(auth);
86
135
 
87
136
  if (result) {
88
137
  return true;
@@ -90,7 +139,7 @@ function checkHasAuthorities(authCollection) {
90
139
  });
91
140
 
92
141
  for (var _auth in authCollection) {
93
- result = checkHasAuthority(_auth);
142
+ result = checkHasAuthorityCore(_auth);
94
143
 
95
144
  if (result) {
96
145
  break;
@@ -101,7 +150,7 @@ function checkHasAuthorities(authCollection) {
101
150
  }
102
151
 
103
152
  if ((0, _tools.isString)(authCollection)) {
104
- result = checkHasAuthority(authCollection);
153
+ result = checkHasAuthorityCore(authCollection);
105
154
  return result;
106
155
  }
107
156
 
@@ -115,8 +164,10 @@ function checkHasAuthorities(authCollection) {
115
164
  return result;
116
165
  }
117
166
 
118
- function checkHasAuthority(auth) {
119
- var _accessWayCollection$;
167
+ function checkHasAuthorityCore(auth) {
168
+ if (checkIsSuper()) {
169
+ return true;
170
+ }
120
171
 
121
172
  if ((0, _tools.isObject)(auth)) {
122
173
  console.log({
@@ -140,21 +191,8 @@ function checkHasAuthority(auth) {
140
191
  }
141
192
  }
142
193
 
143
- var list = getAllAuthorityCore();
194
+ var list = getAllAuthority();
144
195
  var accessWayCollection = (0, _globalStorageAssist.getAccessWayCollectionCache)();
145
- var superAuth = (_accessWayCollection$ = accessWayCollection.super.permission) !== null && _accessWayCollection$ !== void 0 ? _accessWayCollection$ : '';
146
- var isSuper = (list || []).find(function (o) {
147
- return o === superAuth;
148
- });
149
-
150
- if (isSuper === superAuth) {
151
- (0, _cacheAssist.setCache)({
152
- key: auth,
153
- value: '1'
154
- });
155
- return true;
156
- }
157
-
158
196
  var v = (list || []).find(function (o) {
159
197
  return o === auth;
160
198
  });
@@ -175,6 +213,28 @@ function checkHasAuthority(auth) {
175
213
  });
176
214
  return result !== '0';
177
215
  }
216
+
217
+ function checkHasAuthority(auth) {
218
+ if ((0, _tools.isObject)(auth)) {
219
+ console.log({
220
+ auth: auth,
221
+ attachedTargetName: (this || null) != null ? (this.constructor || null) != null ? this.constructor.name : '' : ''
222
+ });
223
+ }
224
+
225
+ if ((0, _tools.isArray)(auth)) {
226
+ return checkHasAuthorities(auth);
227
+ }
228
+
229
+ if ((0, _tools.isString)(auth)) {
230
+ return checkHasAuthorityCore(auth);
231
+ }
232
+
233
+ (0, _tools.recordObject)({
234
+ auth: auth
235
+ });
236
+ throw new Error('auth need string or string array, please check in console.');
237
+ }
178
238
  /**
179
239
  * 缓存用户权限数据体
180
240
  * @param {*} authority
@@ -75,18 +75,40 @@ export namespace formNameCollection {
75
75
  export { helper_1 as helper };
76
76
  }
77
77
  }
78
+ /**
79
+ * 转换集合
80
+ */
78
81
  export const convertCollection: {
82
+ /**
83
+ * 数字
84
+ */
79
85
  number: string;
86
+ /**
87
+ * 日期 date
88
+ */
80
89
  datetime: string;
90
+ /**
91
+ * 字符串
92
+ */
81
93
  string: string;
94
+ /**
95
+ * moment日期
96
+ */
82
97
  moment: string;
98
+ /**
99
+ * 金额
100
+ */
83
101
  money: string;
102
+ /**
103
+ * 数组
104
+ */
84
105
  array: string;
85
106
  };
86
107
  export namespace formatCollection {
87
108
  export const money: string;
88
109
  export const datetime: string;
89
110
  export const chineseMoney: string;
111
+ export const percentage: string;
90
112
  }
91
113
  export namespace menuType {
92
114
  export const divider: string;
@@ -104,20 +104,67 @@ var formNameCollection = {
104
104
  helper: ''
105
105
  }
106
106
  };
107
+ /**
108
+ * 转换集合
109
+ */
110
+
107
111
  exports.formNameCollection = formNameCollection;
108
112
  var convertCollection = {
113
+ /**
114
+ * 数字
115
+ */
109
116
  number: 'number',
117
+
118
+ /**
119
+ * 日期 date
120
+ */
110
121
  datetime: 'datetime',
122
+
123
+ /**
124
+ * 字符串
125
+ */
111
126
  string: 'string',
127
+
128
+ /**
129
+ * moment日期
130
+ */
112
131
  moment: 'moment',
132
+
133
+ /**
134
+ * 金额
135
+ */
113
136
  money: 'money',
137
+
138
+ /**
139
+ * 数组
140
+ */
114
141
  array: 'array'
115
142
  };
143
+ /**
144
+ * 格式化集合
145
+ */
146
+
116
147
  exports.convertCollection = convertCollection;
117
148
  var formatCollection = {
149
+ /**
150
+ * 金额 ¥ 0.00
151
+ */
118
152
  money: 'money',
153
+
154
+ /**
155
+ * 格式化日期 YYYY-MM-DD hh:mm:ss
156
+ */
119
157
  datetime: 'datetime',
120
- chineseMoney: 'chineseMoney'
158
+
159
+ /**
160
+ * 中文金额
161
+ */
162
+ chineseMoney: 'chineseMoney',
163
+
164
+ /**
165
+ * 百分比
166
+ */
167
+ percentage: 'percentage'
121
168
  };
122
169
  exports.formatCollection = formatCollection;
123
170
  var menuType = {
@@ -398,7 +398,7 @@ function request(_x) {
398
398
 
399
399
  function _request() {
400
400
  _request = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(_ref4) {
401
- var api, _ref4$params, params, _ref4$method, method, _ref4$useVirtualReque, useVirtualRequest, _ref4$showUseVirtualR, showUseVirtualRequestMessage, _ref4$virtualSuccessR, virtualSuccessResponse, _ref4$virtualFailResp, virtualFailResponse, _ref4$virtualRequestR, virtualRequestResult, _ref4$virtualNeedAuth, virtualNeedAuthorize, apiVersion, url, showRequestInfo, text, result, verifyToken, token, loginPath;
401
+ var api, _ref4$params, params, _ref4$method, method, _ref4$useVirtualReque, useVirtualRequest, _ref4$showUseVirtualR, showUseVirtualRequestMessage, _ref4$virtualSuccessR, virtualSuccessResponse, _ref4$virtualFailResp, virtualFailResponse, _ref4$virtualRequestR, virtualRequestResult, _ref4$virtualNeedAuth, virtualNeedAuthorize, apiVersion, url, showRequestInfo, result, verifyToken, token, loginPath;
402
402
 
403
403
  return regeneratorRuntime.wrap(function _callee$(_context) {
404
404
  while (1) {
@@ -441,10 +441,12 @@ function _request() {
441
441
  }
442
442
 
443
443
  if (showUseVirtualRequestMessage) {
444
- text = '由虚拟访问返回';
445
- (0, _tools.showInfoMessage)({
446
- message: text
447
- });
444
+ setTimeout(function () {
445
+ var text = '由虚拟访问返回';
446
+ (0, _tools.showInfoMessage)({
447
+ message: text
448
+ });
449
+ }, 500);
448
450
  }
449
451
 
450
452
  result = {};
package/es/utils/tools.js CHANGED
@@ -171,6 +171,8 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
171
171
 
172
172
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
173
173
 
174
+ function _readOnlyError(name) { throw new TypeError("\"" + name + "\" is read-only"); }
175
+
174
176
  function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
175
177
 
176
178
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
@@ -1077,6 +1079,16 @@ function getValueByKey(_ref14) {
1077
1079
  result = formatMoneyToChinese(v);
1078
1080
  break;
1079
1081
 
1082
+ case _constants.formatCollection.percentage:
1083
+ var d = 0;
1084
+
1085
+ if (!isMoney(v)) {
1086
+ roundToTarget(v * 100, 1), _readOnlyError("d");
1087
+ }
1088
+
1089
+ result = "".concat(d, "%");
1090
+ break;
1091
+
1080
1092
  default:
1081
1093
  result = v;
1082
1094
  break;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "antd-management-fast-framework",
3
- "version": "1.11.16",
3
+ "version": "1.11.20",
4
4
  "description": "antd-management-fast-framework",
5
5
  "keywords": [
6
6
  "antd-management-fast-framework"