vap1 0.8.7 → 0.8.9
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.
|
@@ -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.9","description":"vap1, Both support MicroService and SAP FrameWork, Support IE>9","main":"index.js","author":"Xiang da","license":"ISC"}
|
package/utils/_AjaxUtil.js
CHANGED
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __values = (this && this.__values) || function(o) {
|
|
3
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
4
|
+
if (m) return m.call(o);
|
|
5
|
+
if (o && typeof o.length === "number") return {
|
|
6
|
+
next: function () {
|
|
7
|
+
if (o && i >= o.length) o = void 0;
|
|
8
|
+
return { value: o && o[i++], done: !o };
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
12
|
+
};
|
|
2
13
|
var __read = (this && this.__read) || function (o, n) {
|
|
3
14
|
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
4
15
|
if (!m) return o;
|
|
@@ -15,17 +26,6 @@ var __read = (this && this.__read) || function (o, n) {
|
|
|
15
26
|
}
|
|
16
27
|
return ar;
|
|
17
28
|
};
|
|
18
|
-
var __values = (this && this.__values) || function(o) {
|
|
19
|
-
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
20
|
-
if (m) return m.call(o);
|
|
21
|
-
if (o && typeof o.length === "number") return {
|
|
22
|
-
next: function () {
|
|
23
|
-
if (o && i >= o.length) o = void 0;
|
|
24
|
-
return { value: o && o[i++], done: !o };
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
28
|
-
};
|
|
29
29
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
30
30
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
31
31
|
};
|
|
@@ -74,91 +74,76 @@ var CLEAR = function () {
|
|
|
74
74
|
};
|
|
75
75
|
exports.CLEAR = CLEAR;
|
|
76
76
|
var sessionStorage = window.sessionStorage;
|
|
77
|
+
// type MicorSessionItem = { value: string, source: string };
|
|
77
78
|
var MICOR_SESSION_STORAGE = 'MICOR_SESSION';
|
|
78
|
-
var
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
var readMicorSessionStore = function () {
|
|
84
|
-
var value = sessionStorage.getItem(MICOR_SESSION_STORAGE);
|
|
85
|
-
if (!value)
|
|
86
|
-
return {};
|
|
87
|
-
try {
|
|
88
|
-
return JSON.parse(value);
|
|
89
|
-
}
|
|
90
|
-
catch (_a) {
|
|
91
|
-
return {};
|
|
92
|
-
}
|
|
93
|
-
};
|
|
94
|
-
var splitMicorSessionHeader = function (headerValue) {
|
|
95
|
-
return headerValue.split(/,(?=\s*[^;,=\s]+=)/g).map(function (value) { return lodash_1.default.trim(value); }).filter(Boolean);
|
|
96
|
-
};
|
|
97
|
-
var parseMicorSessionCookie = function (cookieValue) {
|
|
98
|
-
var values = cookieValue.split(';').map(function (value) { return lodash_1.default.trim(value); }).filter(Boolean);
|
|
99
|
-
if (values.length == 0)
|
|
100
|
-
return null;
|
|
101
|
-
var cookiePair = values[0];
|
|
102
|
-
var idx = cookiePair.indexOf('=');
|
|
103
|
-
if (idx <= 0)
|
|
104
|
-
return null;
|
|
105
|
-
return {
|
|
106
|
-
name: cookiePair.substring(0, idx),
|
|
107
|
-
value: cookiePair.substring(idx + 1),
|
|
108
|
-
source: cookieValue,
|
|
109
|
-
};
|
|
110
|
-
};
|
|
79
|
+
var CEMS_SESSION_RESPONSE = 'set-cems-cookies';
|
|
80
|
+
var CEMS_SESSION_REQUEST = 'cems-cookies';
|
|
81
|
+
var CEMS_SESSION = { CEMS: '', VAP: '', };
|
|
82
|
+
//set-cems-cookies SESSION=ZDc5ZTkzOTQtOWM2NC00YmY5LWE2MmUtYmU2Y2ZiNWMzYjQ1; Path=/CEMSUI/; Secure; HttpOnly; SameSite=Lax
|
|
83
|
+
// SESSION=ZDI3YmE0YmYtNmZlZi00M2M2LTlmYTgtZjllZWE5NzU2OTEz; VAP_SESSION=8d37a07c-20a6-4183-a64b-39824183e8dc
|
|
111
84
|
var findHeaderKey = function (headers, headerName) {
|
|
112
85
|
var lowerName = lodash_1.default.toLower(headerName);
|
|
113
86
|
return lodash_1.default.find(lodash_1.default.keys(headers), function (key) { return lodash_1.default.toLower(key) == lowerName; });
|
|
114
87
|
};
|
|
115
|
-
var
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
.
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
var value = getMicorSessionHeaderValue(store, request);
|
|
125
|
-
var headerKey = findHeaderKey(Global_1.CONFIG.AJAX.headers, request);
|
|
126
|
-
if (value) {
|
|
127
|
-
Global_1.CONFIG.AJAX.headers[headerKey || request] = value;
|
|
128
|
-
return;
|
|
129
|
-
}
|
|
130
|
-
if (headerKey)
|
|
131
|
-
delete Global_1.CONFIG.AJAX.headers[headerKey];
|
|
132
|
-
});
|
|
88
|
+
var setMicorSessionGlobalHeaders = function () {
|
|
89
|
+
if (CEMS_SESSION.CEMS || CEMS_SESSION.VAP) {
|
|
90
|
+
Global_1.CONFIG.AJAX.headers[CEMS_SESSION_REQUEST] = [CEMS_SESSION.CEMS, CEMS_SESSION.VAP].filter(function (item) { return item.length > 0; }).join('; ');
|
|
91
|
+
sessionStorage.setItem(MICOR_SESSION_STORAGE, JSON.stringify(CEMS_SESSION));
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
delete Global_1.CONFIG.AJAX.headers[CEMS_SESSION_REQUEST];
|
|
95
|
+
sessionStorage.removeItem(MICOR_SESSION_STORAGE);
|
|
96
|
+
}
|
|
133
97
|
};
|
|
134
|
-
var
|
|
98
|
+
var receiveMicorSessionHeaders = function (headerValue) {
|
|
99
|
+
var e_2, _a, e_3, _b;
|
|
135
100
|
if (!headerValue)
|
|
136
|
-
return
|
|
137
|
-
var
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
101
|
+
return;
|
|
102
|
+
var needChange = false;
|
|
103
|
+
var items = headerValue.split(/,(?=\s*[^;,=\s]+=)/g).map(function (value) { return lodash_1.default.trim(value); }).filter(Boolean);
|
|
104
|
+
try {
|
|
105
|
+
for (var items_1 = __values(items), items_1_1 = items_1.next(); !items_1_1.done; items_1_1 = items_1.next()) {
|
|
106
|
+
var item = items_1_1.value;
|
|
107
|
+
var values = item.split(';').map(function (value) { return lodash_1.default.trim(value); }).filter(Boolean);
|
|
108
|
+
if (values.length == 0)
|
|
109
|
+
continue;
|
|
110
|
+
try {
|
|
111
|
+
for (var values_1 = (e_3 = void 0, __values(values)), values_1_1 = values_1.next(); !values_1_1.done; values_1_1 = values_1.next()) {
|
|
112
|
+
var cookieValue = values_1_1.value;
|
|
113
|
+
var txt = lodash_1.default.toLower(lodash_1.default.trim(cookieValue));
|
|
114
|
+
if (txt.startsWith('session=')) {
|
|
115
|
+
if (CEMS_SESSION.CEMS != cookieValue) {
|
|
116
|
+
CEMS_SESSION.CEMS = cookieValue;
|
|
117
|
+
needChange = true;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
else if (txt.startsWith('vap_session=')) {
|
|
121
|
+
if (CEMS_SESSION.VAP != cookieValue) {
|
|
122
|
+
CEMS_SESSION.VAP = cookieValue;
|
|
123
|
+
needChange = true;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
129
|
+
finally {
|
|
130
|
+
try {
|
|
131
|
+
if (values_1_1 && !values_1_1.done && (_b = values_1.return)) _b.call(values_1);
|
|
132
|
+
}
|
|
133
|
+
finally { if (e_3) throw e_3.error; }
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
138
|
+
finally {
|
|
139
|
+
try {
|
|
140
|
+
if (items_1_1 && !items_1_1.done && (_a = items_1.return)) _a.call(items_1);
|
|
141
|
+
}
|
|
142
|
+
finally { if (e_2) throw e_2.error; }
|
|
143
|
+
}
|
|
144
|
+
if (needChange) {
|
|
145
|
+
setMicorSessionGlobalHeaders();
|
|
146
|
+
}
|
|
162
147
|
};
|
|
163
148
|
var mergeHeaders = function () {
|
|
164
149
|
var headersList = [];
|
|
@@ -195,10 +180,24 @@ var setXHRHeaders = function (xhr, headers) {
|
|
|
195
180
|
lodash_1.default.keys(requestHeaders).forEach(function (key) { return xhr.setRequestHeader(key, requestHeaders[key]); });
|
|
196
181
|
};
|
|
197
182
|
exports.setXHRHeaders = setXHRHeaders;
|
|
198
|
-
|
|
199
|
-
|
|
183
|
+
var value = sessionStorage.getItem(MICOR_SESSION_STORAGE);
|
|
184
|
+
if (value) {
|
|
185
|
+
try {
|
|
186
|
+
var cached = JSON.parse(value);
|
|
187
|
+
if (cached.CEMS) {
|
|
188
|
+
CEMS_SESSION.CEMS = cached.CEMS;
|
|
189
|
+
}
|
|
190
|
+
if (cached.VAP) {
|
|
191
|
+
CEMS_SESSION.VAP = cached.VAP;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
catch (_b) {
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
setMicorSessionGlobalHeaders();
|
|
198
|
+
var receiveMicorSessionByFetch = function (response) { return receiveMicorSessionHeaders(response.headers.get(CEMS_SESSION_RESPONSE)); };
|
|
200
199
|
exports.receiveMicorSessionByFetch = receiveMicorSessionByFetch;
|
|
201
|
-
var receiveMicorSessionByXHR = function (xhr) { return receiveMicorSessionHeaders(
|
|
200
|
+
var receiveMicorSessionByXHR = function (xhr) { return receiveMicorSessionHeaders(xhr.getResponseHeader(CEMS_SESSION_RESPONSE)); };
|
|
202
201
|
exports.receiveMicorSessionByXHR = receiveMicorSessionByXHR;
|
|
203
202
|
//过滤空参数
|
|
204
203
|
var filterNull = function (param) {
|
|
@@ -247,12 +246,12 @@ if (FIXED_STORAGE) {
|
|
|
247
246
|
finally { if (e_1) throw e_1.error; }
|
|
248
247
|
}
|
|
249
248
|
}
|
|
250
|
-
catch (
|
|
249
|
+
catch (_c) {
|
|
251
250
|
console.log('parse error');
|
|
252
251
|
}
|
|
253
252
|
}
|
|
254
253
|
var setFixedHeader = function (header) {
|
|
255
|
-
var
|
|
254
|
+
var e_4, _a;
|
|
256
255
|
var keys = lodash_1.default.keys(header);
|
|
257
256
|
try {
|
|
258
257
|
for (var keys_2 = __values(keys), keys_2_1 = keys_2.next(); !keys_2_1.done; keys_2_1 = keys_2.next()) {
|
|
@@ -260,12 +259,12 @@ var setFixedHeader = function (header) {
|
|
|
260
259
|
FIXED_HEADER[key] = header[key];
|
|
261
260
|
}
|
|
262
261
|
}
|
|
263
|
-
catch (
|
|
262
|
+
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
264
263
|
finally {
|
|
265
264
|
try {
|
|
266
265
|
if (keys_2_1 && !keys_2_1.done && (_a = keys_2.return)) _a.call(keys_2);
|
|
267
266
|
}
|
|
268
|
-
finally { if (
|
|
267
|
+
finally { if (e_4) throw e_4.error; }
|
|
269
268
|
}
|
|
270
269
|
sessionStorage.setItem(FIXED_HEADER_STROE, JSON.stringify(FIXED_HEADER));
|
|
271
270
|
};
|