@nokecy/qc-ui 1.1.89 → 1.1.90
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/dist/cjs/ag-grid-plus/queryForm/index.d.ts +2 -0
- package/dist/cjs/ag-grid-plus/queryForm/index.js +13 -4
- package/dist/cjs/standardList/emptyState.d.ts +7 -0
- package/dist/cjs/standardList/emptyState.js +17 -5
- package/dist/cjs/standardList/index.d.ts +1 -1
- package/dist/cjs/standardList/index.js +6 -0
- package/dist/esm/ag-grid-plus/queryForm/index.d.ts +2 -0
- package/dist/esm/ag-grid-plus/queryForm/index.js +13 -3
- package/dist/esm/standardList/emptyState.d.ts +7 -0
- package/dist/esm/standardList/emptyState.js +16 -4
- package/dist/esm/standardList/index.d.ts +1 -1
- package/dist/esm/standardList/index.js +1 -1
- package/dist/umd/qc-ui.min.js +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { ColDef, ColumnState, GridApi } from 'ag-grid-community';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import './index.less';
|
|
4
|
+
/** 查询区初始化兜底:requestAnimationFrame 迟迟不触发时,最迟这么久后通知首查(毫秒)。@author nokecy */
|
|
5
|
+
export declare const INIT_FALLBACK_DELAY = 300;
|
|
4
6
|
declare const FormRender: (props: {
|
|
5
7
|
className?: any;
|
|
6
8
|
gridApi?: GridApi<any> | undefined;
|
|
@@ -4,7 +4,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.default = void 0;
|
|
7
|
+
exports.default = exports.INIT_FALLBACK_DELAY = void 0;
|
|
8
8
|
var _antdV = require("@formily/antd-v5");
|
|
9
9
|
var _core = require("@formily/core");
|
|
10
10
|
var _react = require("@formily/react");
|
|
@@ -30,6 +30,8 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
30
30
|
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; }
|
|
31
31
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
32
32
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } // @author nokecy
|
|
33
|
+
/** 查询区初始化兜底:requestAnimationFrame 迟迟不触发时,最迟这么久后通知首查(毫秒)。@author nokecy */
|
|
34
|
+
var INIT_FALLBACK_DELAY = exports.INIT_FALLBACK_DELAY = 300;
|
|
33
35
|
var FormRender = function FormRender(props) {
|
|
34
36
|
var className = props.className,
|
|
35
37
|
colDefs = props.colDefs,
|
|
@@ -236,11 +238,18 @@ var FormRender = function FormRender(props) {
|
|
|
236
238
|
if (!initializedRef.current) {
|
|
237
239
|
initializedRef.current = true;
|
|
238
240
|
// 使用 requestAnimationFrame + setTimeout 确保默认值已应用
|
|
241
|
+
// 后台标签页或浏览器繁忙时 requestAnimationFrame 可能迟迟不触发,列表首查就一直不发,
|
|
242
|
+
// 只能手动点「查询」;另设一个定时兜底,两条路先到先执行、只执行一次。@author nokecy
|
|
243
|
+
var initialized = false;
|
|
244
|
+
var notifyInit = function notifyInit() {
|
|
245
|
+
if (initialized) return;
|
|
246
|
+
initialized = true;
|
|
247
|
+
props.onInit && props.onInit(form.values);
|
|
248
|
+
};
|
|
239
249
|
requestAnimationFrame(function () {
|
|
240
|
-
setTimeout(
|
|
241
|
-
props.onInit && props.onInit(form.values);
|
|
242
|
-
}, 0);
|
|
250
|
+
setTimeout(notifyInit, 0);
|
|
243
251
|
});
|
|
252
|
+
setTimeout(notifyInit, INIT_FALLBACK_DELAY);
|
|
244
253
|
}
|
|
245
254
|
}, [schemaKey, defaultRows, props.defaultExpand]);
|
|
246
255
|
return /*#__PURE__*/_react2.default.createElement("div", {
|
|
@@ -28,6 +28,13 @@ export interface GridEmptyContextValue {
|
|
|
28
28
|
onRetry?: () => void;
|
|
29
29
|
}
|
|
30
30
|
export declare const GridEmptyContext: React.Context<GridEmptyContextValue>;
|
|
31
|
+
/**
|
|
32
|
+
* 403 是否真的是「没有权限」。ABP 的业务异常(BusinessException)默认也按 403 返回,
|
|
33
|
+
* 例如「工厂日历缺少所选年周」;这类有业务错误码的 403 要显示后端原因并允许重试,
|
|
34
|
+
* 不能说成没权限,否则用户会去找管理员授权而真因在数据。
|
|
35
|
+
* 授权失败的错误码以 Volo.Authorization 开头,或没有错误码。@author nokecy
|
|
36
|
+
*/
|
|
37
|
+
export declare const isPermissionDenied: (status?: number, code?: string) => boolean;
|
|
31
38
|
export declare const GridEmptyState: React.FC;
|
|
32
39
|
/**
|
|
33
40
|
* 判断请求 filter 是否带生效条件(任意叶子值非空即算有筛选)。
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.hasActiveFilter = exports.GridEmptyState = exports.GridEmptyContext = void 0;
|
|
6
|
+
exports.isPermissionDenied = exports.hasActiveFilter = exports.GridEmptyState = exports.GridEmptyContext = void 0;
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
8
|
var _antd = require("antd");
|
|
9
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -31,6 +31,16 @@ var httpStatusOf = function httpStatusOf(error) {
|
|
|
31
31
|
var _response$status, _error$context, _error$originalError;
|
|
32
32
|
return (_response$status = error === null || error === void 0 || (_error$context = error.context) === null || _error$context === void 0 || (_error$context = _error$context.originalError) === null || _error$context === void 0 || (_error$context = _error$context.response) === null || _error$context === void 0 ? void 0 : _error$context.status) !== null && _response$status !== void 0 ? _response$status : error === null || error === void 0 || (_error$originalError = error.originalError) === null || _error$originalError === void 0 || (_error$originalError = _error$originalError.response) === null || _error$originalError === void 0 ? void 0 : _error$originalError.status;
|
|
33
33
|
};
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* 403 是否真的是「没有权限」。ABP 的业务异常(BusinessException)默认也按 403 返回,
|
|
37
|
+
* 例如「工厂日历缺少所选年周」;这类有业务错误码的 403 要显示后端原因并允许重试,
|
|
38
|
+
* 不能说成没权限,否则用户会去找管理员授权而真因在数据。
|
|
39
|
+
* 授权失败的错误码以 Volo.Authorization 开头,或没有错误码。@author nokecy
|
|
40
|
+
*/
|
|
41
|
+
var isPermissionDenied = exports.isPermissionDenied = function isPermissionDenied(status, code) {
|
|
42
|
+
return status === 403 && (!code || code.startsWith('Volo.Authorization'));
|
|
43
|
+
};
|
|
34
44
|
var GridEmptyState = exports.GridEmptyState = function GridEmptyState() {
|
|
35
45
|
var _React$useContext = _react.default.useContext(GridEmptyContext),
|
|
36
46
|
error = _React$useContext.error,
|
|
@@ -48,8 +58,8 @@ var GridEmptyState = exports.GridEmptyState = function GridEmptyState() {
|
|
|
48
58
|
});
|
|
49
59
|
}
|
|
50
60
|
|
|
51
|
-
// 分支 1:无权限(403
|
|
52
|
-
if (error && httpStatusOf(error) ===
|
|
61
|
+
// 分支 1:无权限(403 且不是业务异常)——说明原因,不给任何入口
|
|
62
|
+
if (error && isPermissionDenied(httpStatusOf(error), remoteError === null || remoteError === void 0 ? void 0 : remoteError.code)) {
|
|
53
63
|
return /*#__PURE__*/_react.default.createElement(_antd.Empty, {
|
|
54
64
|
image: _antd.Empty.PRESENTED_IMAGE_SIMPLE,
|
|
55
65
|
description: "\u6CA1\u6709\u6743\u9650\u67E5\u770B\u6B64\u5217\u8868\uFF0C\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458\u5F00\u901A"
|
|
@@ -59,8 +69,10 @@ var GridEmptyState = exports.GridEmptyState = function GridEmptyState() {
|
|
|
59
69
|
// 分支 2:加载失败——给重试
|
|
60
70
|
if (error) {
|
|
61
71
|
return /*#__PURE__*/_react.default.createElement(_antd.Empty, {
|
|
62
|
-
image: _antd.Empty.PRESENTED_IMAGE_SIMPLE
|
|
63
|
-
|
|
72
|
+
image: _antd.Empty.PRESENTED_IMAGE_SIMPLE
|
|
73
|
+
// 后端给了业务原因(如数据未维护)时直接显示原因,告诉用户下一步。@author nokecy
|
|
74
|
+
,
|
|
75
|
+
description: remoteError !== null && remoteError !== void 0 && remoteError.code && remoteError.message ? remoteError.message : '加载失败,请检查后重试'
|
|
64
76
|
}, onRetry && /*#__PURE__*/_react.default.createElement(_antd.Button, {
|
|
65
77
|
size: "small",
|
|
66
78
|
type: "primary",
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
export { StandardAgGridColumn, StandardAgGridPlus } from './StandardAgGridPlus';
|
|
8
8
|
export type { AppGridColumn, StandardListPolicy } from './StandardAgGridPlus';
|
|
9
|
-
export { GridEmptyContext, GridEmptyState, hasActiveFilter } from './emptyState';
|
|
9
|
+
export { GridEmptyContext, GridEmptyState, hasActiveFilter, isPermissionDenied } from './emptyState';
|
|
10
10
|
export type { GridEmptyContextValue } from './emptyState';
|
|
11
11
|
export { applyColDefSort, detachLiveSortFromColumnDefs, firstGridSorter } from './gridColumnDefs';
|
|
12
12
|
export { compositeClasses, getCompositeColumnEdges, withCompositeGroupHeader, withCompositeLeafHeader } from './groupedHeaders';
|
|
@@ -111,6 +111,12 @@ Object.defineProperty(exports, "inferListDefaultSort", {
|
|
|
111
111
|
return _listDefaultSort.inferListDefaultSort;
|
|
112
112
|
}
|
|
113
113
|
});
|
|
114
|
+
Object.defineProperty(exports, "isPermissionDenied", {
|
|
115
|
+
enumerable: true,
|
|
116
|
+
get: function get() {
|
|
117
|
+
return _emptyState.isPermissionDenied;
|
|
118
|
+
}
|
|
119
|
+
});
|
|
114
120
|
Object.defineProperty(exports, "normalizeExtendedDateColumn", {
|
|
115
121
|
enumerable: true,
|
|
116
122
|
get: function get() {
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { ColDef, ColumnState, GridApi } from 'ag-grid-community';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import './index.less';
|
|
4
|
+
/** 查询区初始化兜底:requestAnimationFrame 迟迟不触发时,最迟这么久后通知首查(毫秒)。@author nokecy */
|
|
5
|
+
export declare const INIT_FALLBACK_DELAY = 300;
|
|
4
6
|
declare const FormRender: (props: {
|
|
5
7
|
className?: any;
|
|
6
8
|
gridApi?: GridApi<any> | undefined;
|
|
@@ -21,6 +21,9 @@ import { queryFormSchemaKey } from "./schemaKey";
|
|
|
21
21
|
import { resolveQueryColumns } from "./queryColumns";
|
|
22
22
|
import BoolSelect from "../_utils/boolSelect";
|
|
23
23
|
import "./index.less";
|
|
24
|
+
|
|
25
|
+
/** 查询区初始化兜底:requestAnimationFrame 迟迟不触发时,最迟这么久后通知首查(毫秒)。@author nokecy */
|
|
26
|
+
export var INIT_FALLBACK_DELAY = 300;
|
|
24
27
|
var FormRender = function FormRender(props) {
|
|
25
28
|
var className = props.className,
|
|
26
29
|
colDefs = props.colDefs,
|
|
@@ -227,11 +230,18 @@ var FormRender = function FormRender(props) {
|
|
|
227
230
|
if (!initializedRef.current) {
|
|
228
231
|
initializedRef.current = true;
|
|
229
232
|
// 使用 requestAnimationFrame + setTimeout 确保默认值已应用
|
|
233
|
+
// 后台标签页或浏览器繁忙时 requestAnimationFrame 可能迟迟不触发,列表首查就一直不发,
|
|
234
|
+
// 只能手动点「查询」;另设一个定时兜底,两条路先到先执行、只执行一次。@author nokecy
|
|
235
|
+
var initialized = false;
|
|
236
|
+
var notifyInit = function notifyInit() {
|
|
237
|
+
if (initialized) return;
|
|
238
|
+
initialized = true;
|
|
239
|
+
props.onInit && props.onInit(form.values);
|
|
240
|
+
};
|
|
230
241
|
requestAnimationFrame(function () {
|
|
231
|
-
setTimeout(
|
|
232
|
-
props.onInit && props.onInit(form.values);
|
|
233
|
-
}, 0);
|
|
242
|
+
setTimeout(notifyInit, 0);
|
|
234
243
|
});
|
|
244
|
+
setTimeout(notifyInit, INIT_FALLBACK_DELAY);
|
|
235
245
|
}
|
|
236
246
|
}, [schemaKey, defaultRows, props.defaultExpand]);
|
|
237
247
|
return /*#__PURE__*/React.createElement("div", {
|
|
@@ -28,6 +28,13 @@ export interface GridEmptyContextValue {
|
|
|
28
28
|
onRetry?: () => void;
|
|
29
29
|
}
|
|
30
30
|
export declare const GridEmptyContext: React.Context<GridEmptyContextValue>;
|
|
31
|
+
/**
|
|
32
|
+
* 403 是否真的是「没有权限」。ABP 的业务异常(BusinessException)默认也按 403 返回,
|
|
33
|
+
* 例如「工厂日历缺少所选年周」;这类有业务错误码的 403 要显示后端原因并允许重试,
|
|
34
|
+
* 不能说成没权限,否则用户会去找管理员授权而真因在数据。
|
|
35
|
+
* 授权失败的错误码以 Volo.Authorization 开头,或没有错误码。@author nokecy
|
|
36
|
+
*/
|
|
37
|
+
export declare const isPermissionDenied: (status?: number, code?: string) => boolean;
|
|
31
38
|
export declare const GridEmptyState: React.FC;
|
|
32
39
|
/**
|
|
33
40
|
* 判断请求 filter 是否带生效条件(任意叶子值非空即算有筛选)。
|
|
@@ -25,6 +25,16 @@ var httpStatusOf = function httpStatusOf(error) {
|
|
|
25
25
|
var _response$status, _error$context, _error$originalError;
|
|
26
26
|
return (_response$status = error === null || error === void 0 || (_error$context = error.context) === null || _error$context === void 0 || (_error$context = _error$context.originalError) === null || _error$context === void 0 || (_error$context = _error$context.response) === null || _error$context === void 0 ? void 0 : _error$context.status) !== null && _response$status !== void 0 ? _response$status : error === null || error === void 0 || (_error$originalError = error.originalError) === null || _error$originalError === void 0 || (_error$originalError = _error$originalError.response) === null || _error$originalError === void 0 ? void 0 : _error$originalError.status;
|
|
27
27
|
};
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* 403 是否真的是「没有权限」。ABP 的业务异常(BusinessException)默认也按 403 返回,
|
|
31
|
+
* 例如「工厂日历缺少所选年周」;这类有业务错误码的 403 要显示后端原因并允许重试,
|
|
32
|
+
* 不能说成没权限,否则用户会去找管理员授权而真因在数据。
|
|
33
|
+
* 授权失败的错误码以 Volo.Authorization 开头,或没有错误码。@author nokecy
|
|
34
|
+
*/
|
|
35
|
+
export var isPermissionDenied = function isPermissionDenied(status, code) {
|
|
36
|
+
return status === 403 && (!code || code.startsWith('Volo.Authorization'));
|
|
37
|
+
};
|
|
28
38
|
export var GridEmptyState = function GridEmptyState() {
|
|
29
39
|
var _React$useContext = React.useContext(GridEmptyContext),
|
|
30
40
|
error = _React$useContext.error,
|
|
@@ -42,8 +52,8 @@ export var GridEmptyState = function GridEmptyState() {
|
|
|
42
52
|
});
|
|
43
53
|
}
|
|
44
54
|
|
|
45
|
-
// 分支 1:无权限(403
|
|
46
|
-
if (error && httpStatusOf(error) ===
|
|
55
|
+
// 分支 1:无权限(403 且不是业务异常)——说明原因,不给任何入口
|
|
56
|
+
if (error && isPermissionDenied(httpStatusOf(error), remoteError === null || remoteError === void 0 ? void 0 : remoteError.code)) {
|
|
47
57
|
return /*#__PURE__*/React.createElement(Empty, {
|
|
48
58
|
image: Empty.PRESENTED_IMAGE_SIMPLE,
|
|
49
59
|
description: "\u6CA1\u6709\u6743\u9650\u67E5\u770B\u6B64\u5217\u8868\uFF0C\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458\u5F00\u901A"
|
|
@@ -53,8 +63,10 @@ export var GridEmptyState = function GridEmptyState() {
|
|
|
53
63
|
// 分支 2:加载失败——给重试
|
|
54
64
|
if (error) {
|
|
55
65
|
return /*#__PURE__*/React.createElement(Empty, {
|
|
56
|
-
image: Empty.PRESENTED_IMAGE_SIMPLE
|
|
57
|
-
|
|
66
|
+
image: Empty.PRESENTED_IMAGE_SIMPLE
|
|
67
|
+
// 后端给了业务原因(如数据未维护)时直接显示原因,告诉用户下一步。@author nokecy
|
|
68
|
+
,
|
|
69
|
+
description: remoteError !== null && remoteError !== void 0 && remoteError.code && remoteError.message ? remoteError.message : '加载失败,请检查后重试'
|
|
58
70
|
}, onRetry && /*#__PURE__*/React.createElement(Button, {
|
|
59
71
|
size: "small",
|
|
60
72
|
type: "primary",
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
export { StandardAgGridColumn, StandardAgGridPlus } from './StandardAgGridPlus';
|
|
8
8
|
export type { AppGridColumn, StandardListPolicy } from './StandardAgGridPlus';
|
|
9
|
-
export { GridEmptyContext, GridEmptyState, hasActiveFilter } from './emptyState';
|
|
9
|
+
export { GridEmptyContext, GridEmptyState, hasActiveFilter, isPermissionDenied } from './emptyState';
|
|
10
10
|
export type { GridEmptyContextValue } from './emptyState';
|
|
11
11
|
export { applyColDefSort, detachLiveSortFromColumnDefs, firstGridSorter } from './gridColumnDefs';
|
|
12
12
|
export { compositeClasses, getCompositeColumnEdges, withCompositeGroupHeader, withCompositeLeafHeader } from './groupedHeaders';
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* @author nokecy
|
|
6
6
|
*/
|
|
7
7
|
export { StandardAgGridColumn, StandardAgGridPlus } from "./StandardAgGridPlus";
|
|
8
|
-
export { GridEmptyContext, GridEmptyState, hasActiveFilter } from "./emptyState";
|
|
8
|
+
export { GridEmptyContext, GridEmptyState, hasActiveFilter, isPermissionDenied } from "./emptyState";
|
|
9
9
|
export { applyColDefSort, detachLiveSortFromColumnDefs, firstGridSorter } from "./gridColumnDefs";
|
|
10
10
|
export { compositeClasses, getCompositeColumnEdges, withCompositeGroupHeader, withCompositeLeafHeader } from "./groupedHeaders";
|
|
11
11
|
export { getListDateType, normalizeExtendedDateColumn, normalizeListDateColumn } from "./listDateDisplay";
|