vap1 0.1.9 → 0.2.1
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/SearchBar/ActionButtons.js +1 -1
- package/components/Tables/Components/ActionBar.js +20 -17
- package/components/Tables/STable.d.ts +3 -3
- package/components/Tables/VTable.js +1 -2
- package/package.json +1 -1
- package/uform/FormViewer.d.ts +4 -4
- package/uform/FormViewer.js +6 -7
- package/utils/Global.d.ts +12 -0
- package/utils/Global.js +1 -0
- package/utils/Renders/DictRender.d.ts +3 -0
- package/utils/Renders/DictRender.js +22 -30
|
@@ -64,7 +64,7 @@ const ActionButton = (props) => {
|
|
|
64
64
|
if (props.danger)
|
|
65
65
|
btnParam.danger = true;
|
|
66
66
|
if (props.confirm && props.disabled !== true) {
|
|
67
|
-
return react_1.default.createElement(Popconfirm_1.Popconfirm, { trigger: "click", placement: "bottomLeft", onConfirm: props.onClick, title: lodash_1.default.isString(props.confirm) ? props.confirm : props.confirm() },
|
|
67
|
+
return react_1.default.createElement(Popconfirm_1.Popconfirm, { key: Math.floor(lodash_1.default.random() * 1000000) + '', trigger: "click", placement: "bottomLeft", onConfirm: props.onClick, title: lodash_1.default.isString(props.confirm) ? props.confirm : props.confirm() },
|
|
68
68
|
react_1.default.createElement(Button_1.Button, Object.assign({}, props.config, btnParam), props.label));
|
|
69
69
|
}
|
|
70
70
|
btnParam.onClick = (evt) => utils_1.PageUtil.stopEvent(evt, props.onClick);
|
|
@@ -48,24 +48,27 @@ const ActionBar = props => {
|
|
|
48
48
|
update();
|
|
49
49
|
};
|
|
50
50
|
}, []);
|
|
51
|
-
let buttons = [];
|
|
52
51
|
const [selectedRowKeys, selectedObjects] = props.selectedRef.current.selected;
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
sub
|
|
63
|
-
btn.children.
|
|
64
|
-
sub.children
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
52
|
+
const buttons = (0, react_1.useMemo)(() => {
|
|
53
|
+
const btns = [];
|
|
54
|
+
(props.buttons || []).map(btn => {
|
|
55
|
+
if (btn === false)
|
|
56
|
+
return;
|
|
57
|
+
if (btn === null) {
|
|
58
|
+
btns.push(null);
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
let sub = convertButton(btn, selectedRowKeys, selectedObjects, props.queryParam);
|
|
62
|
+
if (lodash_1.default.isArray(btn.children) && btn.children.length > 0) {
|
|
63
|
+
sub.children = [];
|
|
64
|
+
btn.children.map(item => {
|
|
65
|
+
sub.children.push(convertButton(item, selectedRowKeys, selectedObjects, props.queryParam));
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
btns.push(sub);
|
|
69
|
+
});
|
|
70
|
+
return btns;
|
|
71
|
+
}, [selectedRowKeys, props.buttons, props.queryParam]);
|
|
69
72
|
return react_1.default.createElement(ActionButtons_1.ActionButtons, { buttons: buttons });
|
|
70
73
|
};
|
|
71
74
|
exports.ActionBar = ActionBar;
|
|
@@ -3,10 +3,10 @@ import { ListInit } from '../../hooks/_list';
|
|
|
3
3
|
import type { BaseTableProps } from './index';
|
|
4
4
|
export type STableProps = BaseTableProps & ListInit & {
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
6
|
+
* 说明 pageSize : 默认为 false : 不分页。
|
|
7
7
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
8
|
+
* 为 true 时,以系统默认分页数进行分页
|
|
9
|
+
* 为 数字 时, 以指定的分页大小进行分页
|
|
10
10
|
*/
|
|
11
11
|
pageSize?: true | number;
|
|
12
12
|
};
|
|
@@ -201,7 +201,6 @@ const _VTable = (0, react_1.forwardRef)((props, ref) => {
|
|
|
201
201
|
} }));
|
|
202
202
|
});
|
|
203
203
|
exports.VTable = (0, react_1.forwardRef)((props, ref) => {
|
|
204
|
-
var _a;
|
|
205
204
|
const { isQuerying, pageNo, pageSize, total, totalAcc, param, pageTo, query, cost } = props.model;
|
|
206
205
|
// 通过 ref 方式交互,后续扩展方法实现定制联页选择
|
|
207
206
|
const selectedRef = (0, react_1.useRef)({ selected: [[], []], onSelected: () => { }, });
|
|
@@ -215,7 +214,7 @@ exports.VTable = (0, react_1.forwardRef)((props, ref) => {
|
|
|
215
214
|
return props.model.param;
|
|
216
215
|
}
|
|
217
216
|
};
|
|
218
|
-
}, [
|
|
217
|
+
}, [param]);
|
|
219
218
|
let boxProps = lodash_1.default.pick(props, ['selectBar', 'style', 'className', 'default', 'mode']);
|
|
220
219
|
if (props.searchBar) {
|
|
221
220
|
boxProps.searchBar = Object.assign(Object.assign({}, props.searchBar), { disabled: isQuerying, onSearch: (data) => {
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"vap1","version":"0.1
|
|
1
|
+
{"name":"vap1","version":"0.2.1","description":"vap1, Both support MicroService and SAP FrameWork, Support IE>9","main":"index.js","author":"Xiang da","license":"ISC"}
|
package/uform/FormViewer.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import type { FormSchema } from './schema';
|
|
3
|
-
import type {
|
|
2
|
+
import type { RefAttributes, ForwardRefExoticComponent, FC } from 'react';
|
|
3
|
+
import type { UModalProps, UFormRef, PlainObject } from '../index';
|
|
4
4
|
type ModalProps = Pick<UModalProps, 'open' | 'onOk' | 'onCancel' | 'title' | 'data'>;
|
|
5
5
|
type FormViewProps = {
|
|
6
6
|
schema: FormSchema | string;
|
|
7
7
|
data?: PlainObject;
|
|
8
8
|
};
|
|
9
9
|
export declare const initSchama: (data: string | FormSchema) => FormSchema;
|
|
10
|
-
export declare const FormViewer:
|
|
11
|
-
export declare const FormModal:
|
|
10
|
+
export declare const FormViewer: ForwardRefExoticComponent<FormViewProps & RefAttributes<UFormRef>>;
|
|
11
|
+
export declare const FormModal: FC<FormViewProps & ModalProps>;
|
|
12
12
|
export {};
|
package/uform/FormViewer.js
CHANGED
|
@@ -49,21 +49,20 @@ const initSchama = (data) => {
|
|
|
49
49
|
return DEFAULT;
|
|
50
50
|
};
|
|
51
51
|
exports.initSchama = initSchama;
|
|
52
|
-
const _FormRender = props => {
|
|
52
|
+
const _FormRender = (0, react_1.forwardRef)((props, ref) => {
|
|
53
53
|
const uformProps = (0, react_1.useMemo)(() => (0, Convert_1.schemaToForm)(props.schema), [props]);
|
|
54
|
-
return react_1.default.createElement(index_1.UForm, Object.assign({}, uformProps, { data: props.data }));
|
|
55
|
-
};
|
|
54
|
+
return react_1.default.createElement(index_1.UForm, Object.assign({}, uformProps, { data: props.data, ref: ref }));
|
|
55
|
+
});
|
|
56
56
|
const _ModalRender = props => {
|
|
57
57
|
const uformProps = (0, react_1.useMemo)(() => (0, Convert_1.schemaToForm)(props.schema), [props]);
|
|
58
58
|
let modalProps = {};
|
|
59
59
|
modalProps.title = props.title || props.schema.title || '';
|
|
60
60
|
return react_1.default.createElement(index_1.UFormModal, Object.assign({}, uformProps, modalProps, { data: props.data, open: props.open, onOk: props.onOk, onCancel: props.onCancel }));
|
|
61
61
|
};
|
|
62
|
-
|
|
62
|
+
exports.FormViewer = (0, react_1.forwardRef)((props, ref) => {
|
|
63
63
|
const schema = (0, react_1.useMemo)(() => (0, exports.initSchama)(props.schema), [props.schema]);
|
|
64
|
-
return react_1.default.createElement(_FormRender, { schema: schema, data: props.data });
|
|
65
|
-
};
|
|
66
|
-
exports.FormViewer = FormViewer;
|
|
64
|
+
return react_1.default.createElement(_FormRender, { schema: schema, data: props.data, ref: ref });
|
|
65
|
+
});
|
|
67
66
|
const FormModal = props => {
|
|
68
67
|
const schema = (0, react_1.useMemo)(() => (0, exports.initSchama)(props.schema), [props.schema]);
|
|
69
68
|
return react_1.default.createElement(_ModalRender, Object.assign({}, props, { schema: schema }));
|
package/utils/Global.d.ts
CHANGED
|
@@ -16,8 +16,20 @@ export type GlobalSetting = {
|
|
|
16
16
|
* 应用相关参数:
|
|
17
17
|
*/
|
|
18
18
|
APP: {
|
|
19
|
+
/**
|
|
20
|
+
* 默认语言,默认简体中文
|
|
21
|
+
*/
|
|
19
22
|
LANG: Language;
|
|
23
|
+
/**
|
|
24
|
+
* 显示:回到首页,默认为 true
|
|
25
|
+
*/
|
|
26
|
+
USER_MENU_HOMEPAGE: boolean;
|
|
20
27
|
};
|
|
28
|
+
/**
|
|
29
|
+
* 基础API设置,
|
|
30
|
+
* 说明,如果只是前缀与通用版不同,则只需设置 PREFIX 即可,
|
|
31
|
+
* 其它还有不同的可单独设置
|
|
32
|
+
*/
|
|
21
33
|
BASIC: {
|
|
22
34
|
PREFIX: string;
|
|
23
35
|
SYSTEM: string;
|
package/utils/Global.js
CHANGED
|
@@ -19,5 +19,8 @@ interface DictRender extends Render {
|
|
|
19
19
|
options: (config?: OptionConvertConfig) => BaseOption[];
|
|
20
20
|
}
|
|
21
21
|
export declare const DictRender: (options: string | DictRenderOptions) => DictRender;
|
|
22
|
+
/**
|
|
23
|
+
* 初始化字典,将字典接口的响应数组传入
|
|
24
|
+
*/
|
|
22
25
|
export declare const initDict: (dict: PlainObject[]) => void;
|
|
23
26
|
export { _V_DICT as DICT };
|
|
@@ -166,22 +166,6 @@ const _DictRender = (props) => {
|
|
|
166
166
|
return props.default || Const_2.NONE;
|
|
167
167
|
return renderDictValue(dictInfo, dictInfo.nodes[idx]);
|
|
168
168
|
};
|
|
169
|
-
// if (config.valueFormat) {
|
|
170
|
-
// switch (config.valueFormat) {
|
|
171
|
-
// case 'string':
|
|
172
|
-
// format = val => val + '';
|
|
173
|
-
// break;
|
|
174
|
-
// case 'number':
|
|
175
|
-
// format = val => {
|
|
176
|
-
// if (_.isNumber(val)) return val;
|
|
177
|
-
// try {
|
|
178
|
-
// return parseInt(val);
|
|
179
|
-
// } catch {
|
|
180
|
-
// return val;
|
|
181
|
-
// }
|
|
182
|
-
// }
|
|
183
|
-
// }
|
|
184
|
-
// }
|
|
185
169
|
const putOptions = (arr, config) => {
|
|
186
170
|
if (config === undefined)
|
|
187
171
|
return arr;
|
|
@@ -221,14 +205,14 @@ const DictRender = (options) => {
|
|
|
221
205
|
};
|
|
222
206
|
fn.getText = (key, def) => {
|
|
223
207
|
if (key === null)
|
|
224
|
-
return def
|
|
208
|
+
return lodash_1.default.isString(def) ? def : '';
|
|
225
209
|
const dictInfo = DICT.get(props.dictType);
|
|
226
210
|
if (dictInfo == null)
|
|
227
|
-
return def
|
|
211
|
+
return lodash_1.default.isString(def) ? def : '';
|
|
228
212
|
const dictKey = key + '';
|
|
229
213
|
let idx = lodash_1.default.findIndex(dictInfo.nodes, (item) => dictKey == item.value);
|
|
230
214
|
if (idx < 0)
|
|
231
|
-
return def
|
|
215
|
+
return lodash_1.default.isString(def) ? def : '';
|
|
232
216
|
return dictInfo.nodes[idx].label;
|
|
233
217
|
};
|
|
234
218
|
if (lodash_1.default.isString(options))
|
|
@@ -236,22 +220,30 @@ const DictRender = (options) => {
|
|
|
236
220
|
return fn;
|
|
237
221
|
};
|
|
238
222
|
exports.DictRender = DictRender;
|
|
239
|
-
|
|
223
|
+
const initNodes = (parentType, dict, nodes) => {
|
|
224
|
+
let childs = lodash_1.default.filter(dict, item => item.parentType == parentType);
|
|
225
|
+
childs.map(item => {
|
|
226
|
+
let value = lodash_1.default.trim(item.code);
|
|
227
|
+
if (value.length > 0)
|
|
228
|
+
nodes.push({ label: item.codeValue, value });
|
|
229
|
+
let subChildren = lodash_1.default.filter(dict, sub => sub.parentType == item.type);
|
|
230
|
+
if (subChildren.length > 0) {
|
|
231
|
+
initNodes(item.type, dict, nodes);
|
|
232
|
+
}
|
|
233
|
+
});
|
|
234
|
+
};
|
|
235
|
+
/**
|
|
236
|
+
* 初始化字典,将字典接口的响应数组传入
|
|
237
|
+
*/
|
|
240
238
|
const initDict = (dict) => {
|
|
241
239
|
const roots = lodash_1.default.filter(dict, item => item['parentType'] == '0' || item['parentType'] == '');
|
|
242
240
|
_V_DICT.DICTS = [];
|
|
243
241
|
roots.map(root => {
|
|
244
|
-
|
|
245
|
-
if (root.format && VALIDATE_FORMAT.has(root.format)) {
|
|
246
|
-
info.format = root.format;
|
|
247
|
-
}
|
|
242
|
+
const info = { code: root.type, nodes: [] };
|
|
248
243
|
_V_DICT.DICTS.push({ label: root.codeValue, value: root.type });
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
if (value.length > 0)
|
|
253
|
-
info.nodes.push({ label: item.codeValue, value });
|
|
254
|
-
});
|
|
244
|
+
if (root.format && VALIDATE_FORMAT.has(root.format))
|
|
245
|
+
info.format = root.format;
|
|
246
|
+
initNodes(root.type, dict, info.nodes);
|
|
255
247
|
DICT.set(root.type, info);
|
|
256
248
|
});
|
|
257
249
|
};
|