vap1 0.8.6 → 0.8.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/cems/admin/utils.d.ts
CHANGED
|
@@ -32,6 +32,52 @@ export type GetApiDataXMLHttpRequest = (_url: any, _type: "POST" | 'GET', _param
|
|
|
32
32
|
* @returns 当为同步请求时,返回查询到的所有数据
|
|
33
33
|
*/
|
|
34
34
|
export type GetApiData = (_url: any, _type: "POST" | 'GET', _param?: any, _requestType?: "RequestParam" | "RequestBody", _isAsync?: any, _callBackFun?: any, _headerList?: any, _isEncodeURIComponent?: any) => any;
|
|
35
|
+
/**
|
|
36
|
+
*通过 fetch API发送请求获取数据
|
|
37
|
+
* @param _url 接口地址
|
|
38
|
+
* @param _type 请求类型 "POST"|'GET'
|
|
39
|
+
* @param _param 需要传入的参数例如:{name:"tester"}
|
|
40
|
+
* @param _requestType 后台接口接收的参数类型 "RequestParam"|"RequestBody",不传默认为“RequestBody”
|
|
41
|
+
* @param _callBackFun 请求成功后的回调函数
|
|
42
|
+
* @param _errorCallBackFun 请求失败后的回调函数
|
|
43
|
+
* @param _completeCallBackFun 请求完成后的回调函数(无论成功失败都会执行)
|
|
44
|
+
* @param _headerList 需要放到请求头header中的数据
|
|
45
|
+
* @param _isEncodeURIComponent 是否对参数进行 encodeURIComponent编码
|
|
46
|
+
* @returns Promise<any> 返回解析后的数据
|
|
47
|
+
* @example
|
|
48
|
+
示例一:
|
|
49
|
+
const result = await getApiDataFetch(
|
|
50
|
+
"/api/user/list",
|
|
51
|
+
"POST",
|
|
52
|
+
{ name: "test" },
|
|
53
|
+
"RequestBody",
|
|
54
|
+
(data) => { console.log("Success:", data); }, // _callBackFun
|
|
55
|
+
(xhr, status, err) => { console.error("Error:", err); }, // _errorCallBackFun
|
|
56
|
+
() => { console.log("Complete"); }, // _completeCallBackFun
|
|
57
|
+
{}, // _headerList
|
|
58
|
+
false // _isEncodeURIComponent
|
|
59
|
+
);
|
|
60
|
+
console.log("Returned Data:", result);
|
|
61
|
+
|
|
62
|
+
示例二:
|
|
63
|
+
getApiDataFetch(
|
|
64
|
+
"/api/user/list",
|
|
65
|
+
"GET",
|
|
66
|
+
{ id: 1 },
|
|
67
|
+
"RequestParam",
|
|
68
|
+
(data) => { console.log("Success:", data); },
|
|
69
|
+
(xhr, status, err) => { console.error("Error:", err); },
|
|
70
|
+
() => { console.log("Complete"); }
|
|
71
|
+
)
|
|
72
|
+
.then(data => {
|
|
73
|
+
// 这里也可以处理返回的数据,虽然 callback 已经执行了
|
|
74
|
+
})
|
|
75
|
+
.catch(err => {
|
|
76
|
+
// 错误处理
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
*/
|
|
80
|
+
export type GetApiDataFetch = (_url: string, _type: "POST" | "GET", _param?: any, _requestType?: "RequestParam" | "RequestBody", _callBackFun?: Function, _errorCallBackFun?: Function, _completeCallBackFun?: Function, _headerList?: any, _isEncodeURIComponent?: boolean) => Promise<any>;
|
|
35
81
|
/**
|
|
36
82
|
* 获取指定长度的16进制随机数据,
|
|
37
83
|
* @param len 指定长度,不传默认返回32位
|
package/cems/index.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ interface BuiltInAdminComponents {
|
|
|
13
13
|
AsyncSelect: AsyncSelectComponent;
|
|
14
14
|
CustomPagination: CustomPaginationComponent;
|
|
15
15
|
}
|
|
16
|
-
import type { GetTreeIconNumByOrgFlag, GetOrgFlagByTreeIconNum, MD5, AES, RSA, InitSchema, ConvertOptions, RegExpTest, CallWhereWhileFunc, GetApiData, GetApiDataXMLHttpRequest, GetUUIDFor16 } from './admin/utils';
|
|
16
|
+
import type { GetTreeIconNumByOrgFlag, GetOrgFlagByTreeIconNum, MD5, AES, RSA, InitSchema, ConvertOptions, RegExpTest, CallWhereWhileFunc, GetApiData, GetApiDataXMLHttpRequest, GetApiDataFetch, GetUUIDFor16 } from './admin/utils';
|
|
17
17
|
import type { Validator } from './admin/validator';
|
|
18
18
|
interface BuiltInAdminUtils {
|
|
19
19
|
getTreeIconNumByOrgFlag: GetTreeIconNumByOrgFlag;
|
|
@@ -28,6 +28,7 @@ interface BuiltInAdminUtils {
|
|
|
28
28
|
regExpTest: RegExpTest;
|
|
29
29
|
callWhereWhileFunc: CallWhereWhileFunc;
|
|
30
30
|
getApiData: GetApiData;
|
|
31
|
+
getApiDataFetch: GetApiDataFetch;
|
|
31
32
|
getApiDataXMLHttpRequest: GetApiDataXMLHttpRequest;
|
|
32
33
|
getUUIDFor16: GetUUIDFor16;
|
|
33
34
|
isOpenInCemsProject: boolean;
|
|
@@ -194,6 +195,7 @@ export declare const convertOptions: ConvertOptions;
|
|
|
194
195
|
export declare const regExpTest: RegExpTest;
|
|
195
196
|
export declare const callWhereWhileFunc: CallWhereWhileFunc;
|
|
196
197
|
export declare const getApiData: GetApiData;
|
|
198
|
+
export declare const getApiDataFetch: GetApiDataFetch;
|
|
197
199
|
export declare const getUUIDFor16: GetUUIDFor16;
|
|
198
200
|
export declare const getApiDataXMLHttpRequest: GetApiDataXMLHttpRequest;
|
|
199
201
|
export declare const isOpenInCemsProject: boolean;
|
package/cems/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.registerCustomComponent = exports.registerComponent = exports.CustomLibrary = exports.ComponentLibrary = exports.useDForm = exports.convertArrayToObject = exports.convertObjectToArray = exports.compareVersion = exports.uuid = exports.checkIpPort = exports.checkIpRange = exports.checkIPRangeIntersect = exports.DDrawer = exports.DIcon = exports.DDiv = exports.DCol = exports.DUpload = exports.DTree = exports.DTimePicker = exports.DPTable = exports.DTab = exports.DSwitch = exports.DSlider = exports.DSelect = exports.DSCTable = exports.DRadio = exports.DLabel = void 0;
|
|
3
|
+
exports.DDynamicTreeSelect = exports.DDynamicSelect = exports.DDatePicker = exports.DColorPicker = exports.DCheckboxGroup = exports.DCheckbox = exports.DButton = exports.DApiTable = exports.DForm = exports.CForm = exports.formatCols = exports.formatColumns = exports.useDApiGlobal = exports.useDApi = exports.useDModals = exports.getReload = exports.AjaxPostData = exports.Patch = exports.DivWidth = exports.Sensitive = exports.DModalInfo = exports.DInfo = exports.DModalTable = exports.DTable = exports.CUpload = exports.ChartPie = exports.ChartBar = exports.ChartBase = exports.isOpenInCemsProject = exports.getApiDataXMLHttpRequest = exports.getUUIDFor16 = exports.getApiDataFetch = exports.getApiData = exports.callWhereWhileFunc = exports.regExpTest = exports.convertOptions = exports.initSchema = exports.rsa = exports.aesDecrypted = exports.aes = exports.md5 = exports.validator = exports.getOrgFlagByTreeIconNum = exports.getTreeIconNumByOrgFlag = exports.CustomPagination = exports.AsyncSelect = exports.EasyuiTree = exports.CardTable = exports.UTILS = exports.COMPONENTS = void 0;
|
|
4
|
+
exports.registerCustomComponent = exports.registerComponent = exports.CustomLibrary = exports.ComponentLibrary = exports.useDForm = exports.convertArrayToObject = exports.convertObjectToArray = exports.compareVersion = exports.uuid = exports.checkIpPort = exports.checkIpRange = exports.checkIPRangeIntersect = exports.DDrawer = exports.DIcon = exports.DDiv = exports.DCol = exports.DUpload = exports.DTree = exports.DTimePicker = exports.DPTable = exports.DTab = exports.DSwitch = exports.DSlider = exports.DSelect = exports.DSCTable = exports.DRadio = exports.DLabel = exports.DInput = void 0;
|
|
5
5
|
/**
|
|
6
6
|
* 说明,如需要使用 `vap2/deps/cems` 请确保是 CEMS 应用/模块
|
|
7
7
|
*/
|
|
@@ -28,6 +28,7 @@ exports.convertOptions = exports.UTILS['convertOptions'];
|
|
|
28
28
|
exports.regExpTest = exports.UTILS['regExpTest'];
|
|
29
29
|
exports.callWhereWhileFunc = exports.UTILS['callWhereWhileFunc'];
|
|
30
30
|
exports.getApiData = exports.UTILS['getApiData'];
|
|
31
|
+
exports.getApiDataFetch = exports.UTILS['getApiDataFetch'];
|
|
31
32
|
exports.getUUIDFor16 = exports.UTILS['getUUIDFor16'];
|
|
32
33
|
exports.getApiDataXMLHttpRequest = exports.UTILS['getApiDataXMLHttpRequest'];
|
|
33
34
|
exports.isOpenInCemsProject = exports.UTILS['isOpenInCemsProject'];
|
|
@@ -155,6 +155,7 @@ var _VTable = (0, react_1.forwardRef)(function (props) {
|
|
|
155
155
|
var _b = (0, useTableContext_1.useTableContext)(), selectedRowKeys = _b.selectedRowKeys, initObjects = _b.initObjects, reflushPage = _b.reflushPage, setSelection = _b.setSelection;
|
|
156
156
|
var _c = (0, Box_1.useBox)(), state = _c.state, root = _c.root, resize = _c.resize;
|
|
157
157
|
var update = (0, hooks_1.useUpdate)();
|
|
158
|
+
var isFristMount = (0, hooks_1.useFirstMountState)();
|
|
158
159
|
var _d = __read((0, react_1.useState)(undefined), 2), scroll = _d[0], setScroll = _d[1];
|
|
159
160
|
var _e = __read((0, react_1.useState)({}), 2), columnWidths = _e[0], setColumnWidths = _e[1];
|
|
160
161
|
var _f = props.model, rowKey = _f.rowKey, list = _f.list, isQuerying = _f.isQuerying, pageNo = _f.pageNo, pageSize = _f.pageSize, orderBy = _f.orderBy, query = _f.query, total = _f.total, cost = _f.cost;
|
|
@@ -181,7 +182,12 @@ var _VTable = (0, react_1.forwardRef)(function (props) {
|
|
|
181
182
|
return;
|
|
182
183
|
if (lodash_1.default.isFunction((_b = props.selectBar) === null || _b === void 0 ? void 0 : _b.onSelect)) {
|
|
183
184
|
var param = (_a = props.selectBar).onSelect.apply(_a, __spreadArray([], __read(state.selected), false));
|
|
184
|
-
|
|
185
|
+
if (isFristMount) {
|
|
186
|
+
query(__assign(__assign({}, (props.defaultParam || props.default)), param));
|
|
187
|
+
}
|
|
188
|
+
else {
|
|
189
|
+
query(param, false);
|
|
190
|
+
}
|
|
185
191
|
}
|
|
186
192
|
}, [state.selected]);
|
|
187
193
|
// 更新页数
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import type {
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ReactNode } from 'react';
|
|
3
|
+
import type { BaseTreeProps, BaseTreeRef } from './index';
|
|
4
|
+
import type { TreeProps } from 'antd/es/tree';
|
|
5
|
+
import type { PlainObject } from '../../basetype';
|
|
3
6
|
import type { TreeNodeData } from '../../utils/TreeUtil';
|
|
4
7
|
export type STreeData = {
|
|
5
8
|
/**
|
|
@@ -19,4 +22,12 @@ export type STreeProps = BaseTreeProps & STreeData;
|
|
|
19
22
|
* 搜索 : 支持
|
|
20
23
|
* 数据 : 需要组装好后传入
|
|
21
24
|
*/
|
|
22
|
-
export declare const STree:
|
|
25
|
+
export declare const STree: React.MemoExoticComponent<React.ForwardRefExoticComponent<import("../../utils/TreeUtil").BaseTreeOpts & Pick<TreeProps, "className" | "disabled" | "defaultExpandAll"> & {
|
|
26
|
+
iconField?: string | ((item: any) => ReactNode);
|
|
27
|
+
titleField: string | import("./index").LanguageField;
|
|
28
|
+
titleRender?: (node: PlainObject) => ReactNode;
|
|
29
|
+
mustSelect?: boolean;
|
|
30
|
+
disabledNode?: (node: PlainObject) => boolean;
|
|
31
|
+
onSelect?: (key: import("../../basetype").Key, node: PlainObject, parentNode: PlainObject, crumb: PlainObject[], pos: number[]) => void;
|
|
32
|
+
searchValue?: string;
|
|
33
|
+
} & STreeData & React.RefAttributes<BaseTreeRef>>>;
|
|
@@ -87,10 +87,13 @@ var _i18n_1 = require("../_i18n");
|
|
|
87
87
|
* 搜索 : 支持
|
|
88
88
|
* 数据 : 需要组装好后传入
|
|
89
89
|
*/
|
|
90
|
-
exports.STree = (0, react_1.memo)(function (props) { return react_1.default.createElement(BaseTree_1.BaseTree, __assign({}, props),
|
|
91
|
-
react_1.default.createElement(_Stree, __assign({}, props))); }, function (p, n) { return p.searchValue == n.searchValue; });
|
|
90
|
+
exports.STree = (0, react_1.memo)((0, react_1.forwardRef)(function (props, ref) { return react_1.default.createElement(BaseTree_1.BaseTree, __assign({}, props),
|
|
91
|
+
react_1.default.createElement(_Stree, __assign({}, props, { treeRef: ref }))); }), function (p, n) { return p.searchValue == n.searchValue; });
|
|
92
92
|
var _Stree = function (props) {
|
|
93
93
|
var _a = (0, BaseTree_1.useBaseTree)(), baseProps = _a.baseProps, treeState = _a.treeState, onSelect = _a.onSelect, setTreeData = _a.setTreeData;
|
|
94
|
+
(0, react_1.useImperativeHandle)(props.treeRef, function () { return ({
|
|
95
|
+
getSelected: function () { return treeState.selectedNode; },
|
|
96
|
+
}); }, [treeState.selectedNode]);
|
|
94
97
|
(0, react_1.useLayoutEffect)(function () {
|
|
95
98
|
var tree = [];
|
|
96
99
|
if (props.isFlat) {
|
|
@@ -123,14 +123,16 @@ export type BaseActionTreeProps = {
|
|
|
123
123
|
*/
|
|
124
124
|
idForApiField?: string;
|
|
125
125
|
};
|
|
126
|
+
export type BaseTreeRef = {
|
|
127
|
+
getSelected: () => PlainObject;
|
|
128
|
+
};
|
|
126
129
|
/**
|
|
127
130
|
* 说明 针对节点进行操作
|
|
128
131
|
* 说明,节点信息,位置信息,可通过 onSelect 方法的第五个参数可以拿到
|
|
129
132
|
*/
|
|
130
|
-
export type ActionTreeRef = {
|
|
133
|
+
export type ActionTreeRef = BaseTreeRef & {
|
|
131
134
|
updateData: (node: PlainObject, pos: number[]) => void;
|
|
132
135
|
update: (node: PlainObject, pos: number[]) => Promise<void>;
|
|
133
136
|
del: (node: PlainObject, pos: number[]) => Promise<void>;
|
|
134
137
|
add: (node: PlainObject, pos: number[]) => void;
|
|
135
|
-
getSelected: () => PlainObject;
|
|
136
138
|
};
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"vap1","version":"0.8.
|
|
1
|
+
{"name":"vap1","version":"0.8.8","description":"vap1, Both support MicroService and SAP FrameWork, Support IE>9","main":"index.js","author":"Xiang da","license":"ISC"}
|