vap1 0.1.8 → 0.1.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.
- package/components/Box/Box.js +1 -2
- package/components/SearchBar/_FieldType.d.ts +1 -1
- package/components/SearchBar/_FieldType.js +6 -0
- package/components/TreeSelect/BaseTreeSelect.js +0 -1
- package/components/_setup/SearchField/SearchFieldTree.js +149 -189
- package/components/_setup/UForm/UFormTree.js +9 -9
- package/package.json +1 -1
package/components/Box/Box.js
CHANGED
|
@@ -76,8 +76,7 @@ exports.Box = (0, react_1.forwardRef)((props, ref) => {
|
|
|
76
76
|
if (props.nobg)
|
|
77
77
|
className.push('c-box-nobg');
|
|
78
78
|
const style = Object.assign({}, props.style);
|
|
79
|
-
|
|
80
|
-
className.push('c-box-' + props.mode);
|
|
79
|
+
className.push(props.mode ? ('c-box-' + props.mode) : 'c-box-common');
|
|
81
80
|
if (props.mode == 'inner') {
|
|
82
81
|
if (rootRef.current == null) {
|
|
83
82
|
// style.height = 0;
|
|
@@ -5,4 +5,4 @@
|
|
|
5
5
|
| text ||
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
|
-
export declare const _FieldType: readonly ["text", "number", "select", "multi-select", "radio", "radio-button", "checkbox", "switch", "date", "daterange", "daterange-single", "datetime", "datetimerange", "datetimerange-single", "month", "monthrange", "autocomplete"];
|
|
8
|
+
export declare const _FieldType: readonly ["text", "number", "select", "multi-select", "radio", "radio-button", "checkbox", "switch", "date", "daterange", "daterange-single", "datetime", "datetimerange", "datetimerange-single", "month", "monthrange", "stree-select", "dtree-select", "ftree-select", "multi-stree-select", "multi-dtree-select", "multi-ftree-select", "autocomplete"];
|
|
@@ -25,6 +25,12 @@ exports._FieldType = [
|
|
|
25
25
|
'datetimerange-single',
|
|
26
26
|
'month',
|
|
27
27
|
'monthrange',
|
|
28
|
+
'stree-select',
|
|
29
|
+
'dtree-select',
|
|
30
|
+
'ftree-select',
|
|
31
|
+
'multi-stree-select',
|
|
32
|
+
'multi-dtree-select',
|
|
33
|
+
'multi-ftree-select',
|
|
28
34
|
'autocomplete',
|
|
29
35
|
];
|
|
30
36
|
// * text 文本输入(默认)
|
|
@@ -27,7 +27,6 @@ exports.renderRoot = exports.getNodeParam = exports.BaseTreeSelect = exports.use
|
|
|
27
27
|
const lodash_1 = __importStar(require("lodash"));
|
|
28
28
|
const react_1 = __importStar(require("react"));
|
|
29
29
|
const antd_1 = require("antd");
|
|
30
|
-
// import { HighLight, Icon } from '';
|
|
31
30
|
const HighLight_1 = require("../_common/HighLight");
|
|
32
31
|
;
|
|
33
32
|
const Icon_1 = require("../_adapt/Icon");
|
|
@@ -1,191 +1,151 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
2
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
// } else if (_.isArray(node.children) && node.children.length) {
|
|
127
|
-
// return this.setChidren(node.children, key, children);
|
|
128
|
-
// }
|
|
129
|
-
// }
|
|
130
|
-
// return false;
|
|
131
|
-
// }
|
|
132
|
-
// async onLoadData(node) {
|
|
133
|
-
// const children = await this.getChildren(node.props.eventKey);
|
|
134
|
-
// if (children.length == 0) {
|
|
135
|
-
// return;
|
|
136
|
-
// }
|
|
137
|
-
// const treeData = _.concat([], this.state.treeData);
|
|
138
|
-
// this.setChidren(treeData, node.props.eventKey, children)
|
|
139
|
-
// this.setState({ treeData })
|
|
140
|
-
// };
|
|
141
|
-
// renderNode(data: any) {
|
|
142
|
-
// let isLeaf = false;
|
|
143
|
-
// if (_.has(data, 'children') && _.isArray(data.children)) {
|
|
144
|
-
// if (data.children.length) {
|
|
145
|
-
// isLeaf = false;
|
|
146
|
-
// } else {
|
|
147
|
-
// isLeaf = true;
|
|
148
|
-
// }
|
|
149
|
-
// } else if (this.fields.checkField) {
|
|
150
|
-
// if (!data[this.fields.checkField]) {
|
|
151
|
-
// isLeaf = true;
|
|
152
|
-
// }
|
|
153
|
-
// }
|
|
154
|
-
// if (isLeaf) {
|
|
155
|
-
// return <TreeSelect.TreeNode value={data[this.fields.keyField]} key={data[this.fields.keyField]} title={data[this.fields.titleField]} isLeaf> </TreeSelect.TreeNode>
|
|
156
|
-
// }
|
|
157
|
-
// if (_.isArray(data.children) && data.children.length) {
|
|
158
|
-
// return <TreeSelect.TreeNode value={data[this.fields.keyField]} key={data[this.fields.keyField]} title={data[this.fields.titleField]}>
|
|
159
|
-
// {data.children.map(item => this.renderNode(item))}
|
|
160
|
-
// </TreeSelect.TreeNode>
|
|
161
|
-
// }
|
|
162
|
-
// return <TreeSelect.TreeNode value={data[this.fields.keyField]} key={data[this.fields.keyField]} title={data[this.fields.titleField]}> </TreeSelect.TreeNode>
|
|
163
|
-
// }
|
|
164
|
-
// render() {
|
|
165
|
-
// const { field, onChange, data } = this.props;
|
|
166
|
-
// const { treeData } = this.state;
|
|
167
|
-
// let param: any = {
|
|
168
|
-
// allowClear: true,
|
|
169
|
-
// placeholder: _.has(field.config, 'placeholder') ? field.config.placeholder : null || field.placeholder || `请选择 ${field.label}`,
|
|
170
|
-
// }
|
|
171
|
-
// if (field.allowClear === false) {
|
|
172
|
-
// param.allowClear = false;
|
|
173
|
-
// }
|
|
174
|
-
// if (_.has(data, field.field)) {
|
|
175
|
-
// param.value = data[field.field];
|
|
176
|
-
// }
|
|
177
|
-
// if (_.has(this.props, 'width')) {
|
|
178
|
-
// param.style = { width: this.props.width }
|
|
179
|
-
// }
|
|
180
|
-
// return <TreeSelect
|
|
181
|
-
// {...param}
|
|
182
|
-
// onChange={(value, label, extra) => {
|
|
183
|
-
// onChange(value)
|
|
184
|
-
// }}
|
|
185
|
-
// loadData={(node) => this.onLoadData(node)}
|
|
186
|
-
// >
|
|
187
|
-
// {treeData.map(item => this.renderNode(item))}
|
|
188
|
-
// </TreeSelect>
|
|
189
|
-
// }
|
|
190
|
-
// }
|
|
191
|
-
// registerSearchField('dynamic-tree-select', DynamicTreeSelect);
|
|
29
|
+
const react_1 = __importStar(require("react"));
|
|
30
|
+
const lodash_1 = __importDefault(require("lodash"));
|
|
31
|
+
const _register_1 = require("../../SearchBar/_register");
|
|
32
|
+
const STreeSelect_1 = require("../../TreeSelect/STreeSelect");
|
|
33
|
+
const DTreeSelect_1 = require("../../TreeSelect/DTreeSelect");
|
|
34
|
+
const FTreeSelect_1 = require("../../TreeSelect/FTreeSelect");
|
|
35
|
+
const SearchFieldInput_1 = require("./SearchFieldInput");
|
|
36
|
+
const toArr = (value) => (0, react_1.useMemo)(() => {
|
|
37
|
+
if (value == undefined)
|
|
38
|
+
return [];
|
|
39
|
+
if (lodash_1.default.isArray(value))
|
|
40
|
+
return value;
|
|
41
|
+
if (lodash_1.default.isString(value))
|
|
42
|
+
return value.split(',');
|
|
43
|
+
return [];
|
|
44
|
+
}, [value]);
|
|
45
|
+
(0, _register_1.registerSearchField)('stree-select', (props) => {
|
|
46
|
+
const { field: { field, config, placeholder, allowClear, options }, disabled, onChange, data, width } = props;
|
|
47
|
+
if (!lodash_1.default.has(config, 'titleField')) {
|
|
48
|
+
console.error('field type : STree select must have a config with titleField');
|
|
49
|
+
return react_1.default.createElement(SearchFieldInput_1.TEXT, Object.assign({}, props));
|
|
50
|
+
}
|
|
51
|
+
let treeData = lodash_1.default.has(config, 'treeData') ? config.treeData : options;
|
|
52
|
+
let params = {
|
|
53
|
+
titleField: config.titleFField,
|
|
54
|
+
disabled: disabled,
|
|
55
|
+
treeData,
|
|
56
|
+
multiple: false,
|
|
57
|
+
allowClear: typeof allowClear == 'boolean' ? allowClear : true,
|
|
58
|
+
placeholder: lodash_1.default.has(config, 'placeholder') ? config.placeholder : placeholder,
|
|
59
|
+
style: { width },
|
|
60
|
+
};
|
|
61
|
+
return react_1.default.createElement(STreeSelect_1.STreeSelect, Object.assign({}, params, config, { multiple: false, value: (lodash_1.default.has(data, field) && data[field] !== null) ? data[field] : undefined, onChange: onChange }));
|
|
62
|
+
});
|
|
63
|
+
(0, _register_1.registerSearchField)('dtree-select', (props) => {
|
|
64
|
+
const { field: { field, config, placeholder, allowClear, options }, disabled, onChange, data, width } = props;
|
|
65
|
+
if (!lodash_1.default.has(config, 'titleField') || !lodash_1.default.has(config, 'childApi')) {
|
|
66
|
+
console.error('field type : DTree select must have a config with titleField and childApi');
|
|
67
|
+
return react_1.default.createElement(SearchFieldInput_1.TEXT, Object.assign({}, props));
|
|
68
|
+
}
|
|
69
|
+
let params = {
|
|
70
|
+
titleField: config.titleFField,
|
|
71
|
+
childApi: config.childApi,
|
|
72
|
+
disabled: disabled,
|
|
73
|
+
multiple: false,
|
|
74
|
+
allowClear: typeof allowClear == 'boolean' ? allowClear : true,
|
|
75
|
+
placeholder: lodash_1.default.has(config, 'placeholder') ? config.placeholder : placeholder,
|
|
76
|
+
style: { width },
|
|
77
|
+
};
|
|
78
|
+
return react_1.default.createElement(DTreeSelect_1.DTreeSelect, Object.assign({}, params, config, { multiple: false, value: (lodash_1.default.has(data, field) && data[field] !== null) ? data[field] : undefined, onChange: onChange }));
|
|
79
|
+
});
|
|
80
|
+
(0, _register_1.registerSearchField)('ftree-select', (props) => {
|
|
81
|
+
const { field: { field, config, placeholder, allowClear }, disabled, onChange, data, width } = props;
|
|
82
|
+
if (!lodash_1.default.has(config, 'titleField') || !lodash_1.default.has(config, 'fetchApi')) {
|
|
83
|
+
console.error('field type : FTree select must have a config with titleField and fetchApi');
|
|
84
|
+
return react_1.default.createElement(SearchFieldInput_1.TEXT, Object.assign({}, props));
|
|
85
|
+
}
|
|
86
|
+
let params = {
|
|
87
|
+
titleField: config.titleFField,
|
|
88
|
+
fetchApi: config.fetchApi,
|
|
89
|
+
disabled: disabled,
|
|
90
|
+
multiple: false,
|
|
91
|
+
allowClear: typeof allowClear == 'boolean' ? allowClear : true,
|
|
92
|
+
placeholder: lodash_1.default.has(config, 'placeholder') ? config.placeholder : placeholder,
|
|
93
|
+
style: { width },
|
|
94
|
+
};
|
|
95
|
+
return react_1.default.createElement(FTreeSelect_1.FTreeSelect, Object.assign({}, params, config, { multiple: false, value: (lodash_1.default.has(data, field) && data[field] !== null) ? data[field] : undefined, onChange: onChange }));
|
|
96
|
+
});
|
|
97
|
+
(0, _register_1.registerSearchField)('multi-stree-select', (props) => {
|
|
98
|
+
const { field: { field, config, placeholder, allowClear, options }, disabled, onChange, data, width } = props;
|
|
99
|
+
if (!lodash_1.default.has(config, 'titleField')) {
|
|
100
|
+
console.error('field type : tree-select must have a config with title field');
|
|
101
|
+
return react_1.default.createElement(SearchFieldInput_1.TEXT, Object.assign({}, props));
|
|
102
|
+
}
|
|
103
|
+
let treeData = lodash_1.default.has(config, 'treeData') ? config.treeData : options;
|
|
104
|
+
let params = {
|
|
105
|
+
titleField: config.titleFField,
|
|
106
|
+
disabled: disabled,
|
|
107
|
+
treeData,
|
|
108
|
+
multiple: true,
|
|
109
|
+
allowClear: typeof allowClear == 'boolean' ? allowClear : true,
|
|
110
|
+
placeholder: lodash_1.default.has(config, 'placeholder') ? config.placeholder : placeholder,
|
|
111
|
+
style: { width },
|
|
112
|
+
};
|
|
113
|
+
const value = (lodash_1.default.has(data, field) && data[field] !== null) ? data[field] : undefined;
|
|
114
|
+
return react_1.default.createElement(STreeSelect_1.STreeSelect, Object.assign({}, params, config, { multiple: true, value: toArr(value), onChange: (ids) => onChange(ids.join(',')) }));
|
|
115
|
+
});
|
|
116
|
+
(0, _register_1.registerSearchField)('multi-dtree-select', (props) => {
|
|
117
|
+
const { field: { field, config, placeholder, allowClear, options }, disabled, onChange, data, width } = props;
|
|
118
|
+
if (!lodash_1.default.has(config, 'titleField') || !lodash_1.default.has(config, 'childApi')) {
|
|
119
|
+
console.error('field type : DTree select must have a config with titleField and childApi');
|
|
120
|
+
return react_1.default.createElement(SearchFieldInput_1.TEXT, Object.assign({}, props));
|
|
121
|
+
}
|
|
122
|
+
let params = {
|
|
123
|
+
titleField: config.titleFField,
|
|
124
|
+
childApi: config.childApi,
|
|
125
|
+
disabled: disabled,
|
|
126
|
+
multiple: false,
|
|
127
|
+
allowClear: typeof allowClear == 'boolean' ? allowClear : true,
|
|
128
|
+
placeholder: lodash_1.default.has(config, 'placeholder') ? config.placeholder : placeholder,
|
|
129
|
+
style: { width },
|
|
130
|
+
};
|
|
131
|
+
const value = (lodash_1.default.has(data, field) && data[field] !== null) ? data[field] : undefined;
|
|
132
|
+
return react_1.default.createElement(DTreeSelect_1.DTreeSelect, Object.assign({}, params, config, { multiple: true, value: toArr(value), onChange: (ids) => onChange(ids.join(',')) }));
|
|
133
|
+
});
|
|
134
|
+
(0, _register_1.registerSearchField)('multi-ftree-select', (props) => {
|
|
135
|
+
const { field: { field, config, placeholder, allowClear }, disabled, onChange, data, width } = props;
|
|
136
|
+
if (!lodash_1.default.has(config, 'titleField') || !lodash_1.default.has(config, 'fetchApi')) {
|
|
137
|
+
console.error('field type : FTree select must have a config with titleField and fetchApi');
|
|
138
|
+
return react_1.default.createElement(SearchFieldInput_1.TEXT, Object.assign({}, props));
|
|
139
|
+
}
|
|
140
|
+
let params = {
|
|
141
|
+
titleField: config.titleFField,
|
|
142
|
+
fetchApi: config.fetchApi,
|
|
143
|
+
disabled: disabled,
|
|
144
|
+
multiple: false,
|
|
145
|
+
allowClear: typeof allowClear == 'boolean' ? allowClear : true,
|
|
146
|
+
placeholder: lodash_1.default.has(config, 'placeholder') ? config.placeholder : placeholder,
|
|
147
|
+
style: { width },
|
|
148
|
+
};
|
|
149
|
+
const value = (lodash_1.default.has(data, field) && data[field] !== null) ? data[field] : undefined;
|
|
150
|
+
return react_1.default.createElement(FTreeSelect_1.FTreeSelect, Object.assign({}, params, config, { multiple: true, value: toArr(value), onChange: (ids) => onChange(ids.join(',')) }));
|
|
151
|
+
});
|
|
@@ -33,6 +33,15 @@ const _input_1 = require("../../UForm/_input");
|
|
|
33
33
|
const STreeSelect_1 = require("../../TreeSelect/STreeSelect");
|
|
34
34
|
const DTreeSelect_1 = require("../../TreeSelect/DTreeSelect");
|
|
35
35
|
const FTreeSelect_1 = require("../../TreeSelect/FTreeSelect");
|
|
36
|
+
const toArr = (value) => (0, react_1.useMemo)(() => {
|
|
37
|
+
if (value == undefined)
|
|
38
|
+
return [];
|
|
39
|
+
if (lodash_1.default.isArray(value))
|
|
40
|
+
return value;
|
|
41
|
+
if (lodash_1.default.isString(value))
|
|
42
|
+
return value.split(',');
|
|
43
|
+
return [];
|
|
44
|
+
}, [value]);
|
|
36
45
|
(0, _register_1.registerFormField)('stree-select', (props) => {
|
|
37
46
|
const { field, disabled, value, onChange } = props;
|
|
38
47
|
let params = { placeholder: (0, _input_1.getPlaceholder)(field, true), disabled, allowClear: true };
|
|
@@ -54,15 +63,6 @@ const FTreeSelect_1 = require("../../TreeSelect/FTreeSelect");
|
|
|
54
63
|
params.allowClear = false;
|
|
55
64
|
return react_1.default.createElement(FTreeSelect_1.FTreeSelect, Object.assign({}, params, field.config, { multiple: false, value: value === null ? undefined : value, onChange: onChange }));
|
|
56
65
|
});
|
|
57
|
-
const toArr = (value) => (0, react_1.useMemo)(() => {
|
|
58
|
-
if (value == undefined)
|
|
59
|
-
return [];
|
|
60
|
-
if (lodash_1.default.isArray(value))
|
|
61
|
-
return value;
|
|
62
|
-
if (lodash_1.default.isString(value))
|
|
63
|
-
return value.split(',');
|
|
64
|
-
return [];
|
|
65
|
-
}, [value]);
|
|
66
66
|
const treeChange = (onChange, dataType) => (0, react_1.useCallback)((value) => {
|
|
67
67
|
if (dataType == 'array') {
|
|
68
68
|
onChange(value);
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"vap1","version":"0.1.
|
|
1
|
+
{"name":"vap1","version":"0.1.9","description":"vap1, Both support MicroService and SAP FrameWork, Support IE>9","main":"index.js","author":"Xiang da","license":"ISC"}
|