vap1 0.5.5 → 0.5.7
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/components/Box/Box.d.ts +4 -0
- package/components/Box/Box.js +17 -7
- package/components/Box/SelectBar.d.ts +1 -4
- package/components/Box/SelectBar.js +3 -6
- package/components/Lists/Grid/index.js +0 -1
- package/components/SearchTool/SearchBar/ByKeyword.js +1 -1
- package/components/Tables/VTable.js +4 -1
- package/components/Trees/STree.js +1 -1
- package/package.json +1 -1
- package/utils/Global.d.ts +5 -0
- package/utils/Global.js +1 -1
package/components/Box/Box.d.ts
CHANGED
|
@@ -6,6 +6,10 @@ import type { ActButton } from '../SearchTool/SearchBar/ActionButtons';
|
|
|
6
6
|
import type { Key, PlainObject } from '../../basetype';
|
|
7
7
|
import type { UPaginationProps } from '../_common/Upagination';
|
|
8
8
|
type BoxState = {
|
|
9
|
+
/**
|
|
10
|
+
* 是否折叠
|
|
11
|
+
*/
|
|
12
|
+
collapsed?: boolean;
|
|
9
13
|
/**
|
|
10
14
|
* 内容区域高度
|
|
11
15
|
*/
|
package/components/Box/Box.js
CHANGED
|
@@ -106,17 +106,22 @@ exports.Box = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
106
106
|
var rootRef = (0, react_1.useRef)(null);
|
|
107
107
|
var contextRef = (0, react_1.useRef)(null);
|
|
108
108
|
var selectRef = (0, react_1.useRef)(null);
|
|
109
|
+
var _b = __read((0, react_1.useState)(function () {
|
|
110
|
+
if (props.selectBar == null)
|
|
111
|
+
return true;
|
|
112
|
+
return props.selectBar.defaultCollapse || false;
|
|
113
|
+
}), 2), collapsed = _b[0], setCollapsed = _b[1];
|
|
109
114
|
var mode = (0, react_1.useMemo)(function () {
|
|
110
115
|
return props.mode || 'common';
|
|
111
116
|
}, [props.mode]);
|
|
112
117
|
var className = (0, react_1.useMemo)(function () {
|
|
113
|
-
var clazz = ['c-box'];
|
|
114
|
-
|
|
115
|
-
|
|
118
|
+
var clazz = ['c-box', 'c-box-' + mode];
|
|
119
|
+
if (props.nobg)
|
|
120
|
+
clazz.push('c-box-nobg');
|
|
116
121
|
if (props.className)
|
|
117
122
|
clazz.push(props.className);
|
|
118
123
|
return clazz.join(' ');
|
|
119
|
-
}, [
|
|
124
|
+
}, [mode, collapsed]);
|
|
120
125
|
var style = (0, react_1.useMemo)(function () {
|
|
121
126
|
var css = __assign({}, props.style);
|
|
122
127
|
if (mode == 'inner') {
|
|
@@ -174,8 +179,13 @@ exports.Box = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
174
179
|
(0, react_1.useEffect)(function () { setTimeout(resize, 120); }, [app === null || app === void 0 ? void 0 : app.theme.contentHeight]); // 1.5 版本:延时 120ms
|
|
175
180
|
(0, react_1.useImperativeHandle)(ref, function () { return ({ resize: resize }); }, [mode]);
|
|
176
181
|
(0, react_1.useLayoutEffect)(function () {
|
|
177
|
-
setTimeout(resize,
|
|
182
|
+
setTimeout(resize, 10);
|
|
178
183
|
}, []);
|
|
184
|
+
var maxWidth = (0, react_1.useMemo)(function () {
|
|
185
|
+
if (collapsed)
|
|
186
|
+
return undefined;
|
|
187
|
+
return "calc(100% - ".concat(props.selectBar.width || utils_1.GLOBAL.CONFIG.BOX.SELECTBAR_WIDTH || 250, "px)");
|
|
188
|
+
}, [collapsed]);
|
|
179
189
|
var SearchTool = (0, react_1.useMemo)(function () {
|
|
180
190
|
var hasBar = lodash_1.default.has(props, 'searchBar'),
|
|
181
191
|
// hasBand = _.has(props, 'searchBand'),
|
|
@@ -228,8 +238,8 @@ exports.Box = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
228
238
|
args[_a] = arguments[_a];
|
|
229
239
|
}
|
|
230
240
|
return setState({ selected: args });
|
|
231
|
-
} })),
|
|
232
|
-
react_1.default.createElement(Layout_1.Layout.Content, { style: { overflow: props.overflowAuto ? 'auto' : 'hidden' }, ref: function () {
|
|
241
|
+
}, onSelectCollapse: setCollapsed })),
|
|
242
|
+
react_1.default.createElement(Layout_1.Layout.Content, { style: { overflow: props.overflowAuto ? 'auto' : 'hidden', maxWidth: maxWidth }, ref: function () {
|
|
233
243
|
if (_layoutRef.current == null) {
|
|
234
244
|
var layout = document.getElementById(domId);
|
|
235
245
|
if (layout) {
|
|
@@ -56,10 +56,6 @@ type _BoxSelectBarProps = BaseItem & {
|
|
|
56
56
|
* 初始为收起状态,默认不收起
|
|
57
57
|
*/
|
|
58
58
|
defaultCollapse?: boolean;
|
|
59
|
-
/**
|
|
60
|
-
* 边栏状态变更触发
|
|
61
|
-
*/
|
|
62
|
-
onSelectCollapse?: (boolean: any) => void;
|
|
63
59
|
/**
|
|
64
60
|
* 选择区映射,用于一些特殊场景
|
|
65
61
|
*/
|
|
@@ -94,5 +90,6 @@ type ExtendSelectProps = {
|
|
|
94
90
|
export type SelectBarProps = _BoxSelectBarProps & ExtendSelectProps;
|
|
95
91
|
export declare const SelectBar: React.ForwardRefExoticComponent<Omit<SelectBarProps, "onSelect"> & {
|
|
96
92
|
onSelect: (key: Key, object?: PlainObject, ...args: any[]) => void;
|
|
93
|
+
onSelectCollapse: (boolean: any) => void;
|
|
97
94
|
} & React.RefAttributes<any>>;
|
|
98
95
|
export {};
|
|
@@ -75,12 +75,9 @@ var Icon_1 = require("../_adapt/Icon");
|
|
|
75
75
|
exports.SelectBar = (0, react_1.forwardRef)(function (props, ref) {
|
|
76
76
|
var _a = __read((0, react_1.useState)(null), 2), keyword = _a[0], setKeyword = _a[1];
|
|
77
77
|
var _b = __read((0, hooks_1.useToggle)(props.defaultCollapse || false), 2), collapsed = _b[0], setCollapsed = _b[1];
|
|
78
|
-
// const setKeyword = _.debounce(_setKeyword, 100);
|
|
79
78
|
var component = (0, _register_1.getSelectBar)(props.type);
|
|
80
79
|
(0, react_1.useLayoutEffect)(function () {
|
|
81
|
-
|
|
82
|
-
props.onSelectCollapse(collapsed);
|
|
83
|
-
}
|
|
80
|
+
props.onSelectCollapse(collapsed);
|
|
84
81
|
}, [collapsed]);
|
|
85
82
|
if (component == undefined) {
|
|
86
83
|
console.warn('SelectBar Type is not registerd ', props.type);
|
|
@@ -88,7 +85,7 @@ exports.SelectBar = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
88
85
|
}
|
|
89
86
|
if (props.roleCode && !utils_1.PageUtil.hasRole(props.roleCode))
|
|
90
87
|
return utils_1.Const.NONE;
|
|
91
|
-
var width = lodash_1.default.isNumber(props.width) ? props.width :
|
|
88
|
+
var width = lodash_1.default.isNumber(props.width) ? props.width : utils_1.GLOBAL.CONFIG.BOX.SELECTBAR_WIDTH;
|
|
92
89
|
var renderContent = function () {
|
|
93
90
|
if (props.type == 'custom') {
|
|
94
91
|
if (!lodash_1.default.has(props, 'content')) {
|
|
@@ -117,7 +114,7 @@ exports.SelectBar = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
117
114
|
return react_1.default.createElement(antd_1.Popconfirm, { placement: "right", title: props.confirm, onConfirm: props.onClick },
|
|
118
115
|
react_1.default.createElement(Icon_1.Icon, __assign({}, iconProps, { evt: true })));
|
|
119
116
|
};
|
|
120
|
-
return react_1.default.createElement(antd_1.Layout.Sider, { className: 'c-selectbar-' + utils_1.GLOBAL.CONFIG.BOX.
|
|
117
|
+
return react_1.default.createElement(antd_1.Layout.Sider, { className: 'c-selectbar-' + utils_1.GLOBAL.CONFIG.BOX.SELECTBAR_CLOSE, collapsed: collapsed, collapsedWidth: utils_1.GLOBAL.CONFIG.BOX.SELECTBAR_CLOSE == 1 ? 6 : 0, width: width },
|
|
121
118
|
react_1.default.createElement("div", { className: 'c-selectbar-closed', onClick: setCollapsed, title: utils_1.i18n.txt(_i18n_1.V.TXT_EXPAND) }),
|
|
122
119
|
react_1.default.createElement("div", { className: 'c-selectbar' },
|
|
123
120
|
react_1.default.createElement("div", { className: 'c-selectbar-head' },
|
|
@@ -41,7 +41,6 @@ var GridList = function (props) {
|
|
|
41
41
|
var grids = props.grids, dataSource = props.dataSource, loading = props.loading;
|
|
42
42
|
var itemRender = (0, react_1.useMemo)(function () {
|
|
43
43
|
if (grids.ratio) {
|
|
44
|
-
// console.log(grids.ratio)
|
|
45
44
|
}
|
|
46
45
|
return function (record, i) { return react_1.default.createElement(antd_1.List.Item, null, grids.itemRender(record, i)); };
|
|
47
46
|
}, [grids]);
|
|
@@ -75,7 +75,7 @@ var SearchBarByKeyword = function (props) {
|
|
|
75
75
|
var searchProps = {
|
|
76
76
|
className: "c-searchbar-keyword",
|
|
77
77
|
placeholder: utils_1.i18n.txt(_i18n_1.V.INPUT_SEARCH_KEYWORD),
|
|
78
|
-
allowClear:
|
|
78
|
+
allowClear: false,
|
|
79
79
|
};
|
|
80
80
|
if (props.keyword !== true) {
|
|
81
81
|
if (props.keyword.placeholder) {
|
|
@@ -260,7 +260,9 @@ var VTableRoot = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
260
260
|
}
|
|
261
261
|
}
|
|
262
262
|
if (props.searchBar) {
|
|
263
|
-
boxProps.searchBar = __assign(__assign({}, props.searchBar), {
|
|
263
|
+
boxProps.searchBar = __assign(__assign({}, props.searchBar), {
|
|
264
|
+
// disabled: isQuerying,
|
|
265
|
+
onSearch: function (data) {
|
|
264
266
|
var queryParam = lodash_1.default.extend({}, props.model.param, data);
|
|
265
267
|
query(queryParam, true);
|
|
266
268
|
setParam(queryParam, utils_1.GLOBAL.CONFIG.TABLE.UNSELECT_ON_QUERY);
|
|
@@ -282,6 +284,7 @@ var VTableRoot = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
282
284
|
// props.searchBand,
|
|
283
285
|
props.actionBar,
|
|
284
286
|
props.selectBar,
|
|
287
|
+
// isQuerying
|
|
285
288
|
// props.className,
|
|
286
289
|
// props.style,
|
|
287
290
|
// props.mode
|
|
@@ -119,7 +119,7 @@ var _Stree = function (props) {
|
|
|
119
119
|
// 如果根节点只有一个,则自动展开这个根结点
|
|
120
120
|
treeProps.defaultExpandedKeys = [treeState.treeData[0][treeState.keyField]];
|
|
121
121
|
}
|
|
122
|
-
return react_1.default.createElement(antd_1.Tree, __assign({}, baseProps, treeProps, { disabled: props.disabled, selectedKeys: treeState.selectedKeys, onSelect: onSelect }), renderRoot(props, treeState));
|
|
122
|
+
return react_1.default.createElement(antd_1.Tree, __assign({}, baseProps, treeProps, { showLine: true, disabled: props.disabled, selectedKeys: treeState.selectedKeys, onSelect: onSelect }), renderRoot(props, treeState));
|
|
123
123
|
};
|
|
124
124
|
var renderNode = function (node, position, state, search, disabledNode, folderChecker) {
|
|
125
125
|
if (search.keyword && !search.match.has(position.join('-')))
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"vap1","version":"0.5.
|
|
1
|
+
{"name":"vap1","version":"0.5.7","description":"vap1, Both support MicroService and SAP FrameWork, Support IE>9","main":"index.js","author":"Xiang da","license":"ISC"}
|
package/utils/Global.d.ts
CHANGED
|
@@ -122,7 +122,12 @@ export type GlobalSetting = {
|
|
|
122
122
|
TIME_FORMAT: string;
|
|
123
123
|
};
|
|
124
124
|
BOX: {
|
|
125
|
+
/**
|
|
126
|
+
* @deprecated
|
|
127
|
+
*/
|
|
125
128
|
SELECT_CLOSE: 1 | 2;
|
|
129
|
+
SELECTBAR_CLOSE: 1 | 2;
|
|
130
|
+
SELECTBAR_WIDTH: number;
|
|
126
131
|
};
|
|
127
132
|
/**
|
|
128
133
|
* 通用上传服务,默认为微服务版的配置,单机版需要在 portal 里面定制一下
|
package/utils/Global.js
CHANGED
|
@@ -59,7 +59,7 @@ var DEFAULT = {
|
|
|
59
59
|
RESULT: { code: 'code', message: 'message', success: '0' },
|
|
60
60
|
VLIST: { list: 'list', total: 'total', totalAcc: 'totalAcc', start: 'start_', count: 'count_', order: 'order_', by: 'by_' },
|
|
61
61
|
VDATA: { data: 'data' },
|
|
62
|
-
BOX: { SELECT_CLOSE: 2 },
|
|
62
|
+
BOX: { SELECT_CLOSE: 2, SELECTBAR_CLOSE: 2, SELECTBAR_WIDTH: 250 },
|
|
63
63
|
AJAX: {
|
|
64
64
|
timeout: 30000,
|
|
65
65
|
beforeSend: null,
|