vap1 0.1.4 → 0.1.5
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/index.d.ts +1 -1
- package/package.json +1 -1
- package/uform/FormEditor.d.ts +21 -0
- package/uform/FormEditor.js +101 -0
- package/uform/FormViewer.d.ts +12 -0
- package/uform/FormViewer.js +71 -0
- package/uform/hooks/useEditor.d.ts +28 -0
- package/uform/hooks/useEditor.js +144 -0
- package/uform/hooks/useForm.d.ts +4 -0
- package/uform/hooks/useForm.js +7 -0
- package/uform/index.d.ts +5 -0
- package/uform/index.js +35 -0
- package/uform/inputs/_advance.d.ts +2 -0
- package/uform/inputs/_advance.js +57 -0
- package/uform/inputs/_date.d.ts +2 -0
- package/uform/inputs/_date.js +178 -0
- package/uform/inputs/_input.d.ts +6 -0
- package/uform/inputs/_input.js +139 -0
- package/uform/inputs/_select.d.ts +2 -0
- package/uform/inputs/_select.js +241 -0
- package/uform/inputs/_specific.d.ts +2 -0
- package/uform/inputs/_specific.js +107 -0
- package/uform/inputs/index.d.ts +6 -0
- package/uform/inputs/index.js +18 -0
- package/uform/inputs/register.d.ts +25 -0
- package/uform/inputs/register.js +47 -0
- package/uform/panel/Editor/GroupEditor.d.ts +7 -0
- package/uform/panel/Editor/GroupEditor.js +126 -0
- package/uform/panel/Editor/ListEditor.d.ts +4 -0
- package/uform/panel/Editor/ListEditor.js +77 -0
- package/uform/panel/Editor/_FieldItems.d.ts +5 -0
- package/uform/panel/Editor/_FieldItems.js +45 -0
- package/uform/panel/Editor/_GroupCollapse.d.ts +3 -0
- package/uform/panel/Editor/_GroupCollapse.js +24 -0
- package/uform/panel/Editor/_GroupDefault.d.ts +3 -0
- package/uform/panel/Editor/_GroupDefault.js +24 -0
- package/uform/panel/Editor/_GroupStep.d.ts +3 -0
- package/uform/panel/Editor/_GroupStep.js +49 -0
- package/uform/panel/Editor/_GroupTab.d.ts +3 -0
- package/uform/panel/Editor/_GroupTab.js +41 -0
- package/uform/panel/Editor/index.d.ts +3 -0
- package/uform/panel/Editor/index.js +83 -0
- package/uform/panel/Items/index.d.ts +3 -0
- package/uform/panel/Items/index.js +23 -0
- package/uform/panel/Propreties/CanvasProperties.d.ts +3 -0
- package/uform/panel/Propreties/CanvasProperties.js +42 -0
- package/uform/panel/Propreties/Component/FieldPlugin.d.ts +12 -0
- package/uform/panel/Propreties/Component/FieldPlugin.js +39 -0
- package/uform/panel/Propreties/Component/LinkAsyncFunction.d.ts +8 -0
- package/uform/panel/Propreties/Component/LinkAsyncFunction.js +171 -0
- package/uform/panel/Propreties/Component/LinkSyncFunction.d.ts +8 -0
- package/uform/panel/Propreties/Component/LinkSyncFunction.js +149 -0
- package/uform/panel/Propreties/Component/Links.d.ts +3 -0
- package/uform/panel/Propreties/Component/Links.js +114 -0
- package/uform/panel/Propreties/Component/OptionTable.d.ts +3 -0
- package/uform/panel/Propreties/Component/OptionTable.js +144 -0
- package/uform/panel/Propreties/Component/RegexpModal.d.ts +5 -0
- package/uform/panel/Propreties/Component/RegexpModal.js +74 -0
- package/uform/panel/Propreties/Component/Validate.d.ts +3 -0
- package/uform/panel/Propreties/Component/Validate.js +93 -0
- package/uform/panel/Propreties/Component/ValidateAsyncFunction.d.ts +3 -0
- package/uform/panel/Propreties/Component/ValidateAsyncFunction.js +83 -0
- package/uform/panel/Propreties/Component/ValidateSyncFunction.d.ts +3 -0
- package/uform/panel/Propreties/Component/ValidateSyncFunction.js +77 -0
- package/uform/panel/Propreties/FieldOptions.d.ts +6 -0
- package/uform/panel/Propreties/FieldOptions.js +131 -0
- package/uform/panel/Propreties/FieldProperties.d.ts +3 -0
- package/uform/panel/Propreties/FieldProperties.js +60 -0
- package/uform/panel/Propreties/GroupProperties.d.ts +3 -0
- package/uform/panel/Propreties/GroupProperties.js +17 -0
- package/uform/panel/Propreties/_ItemAdvance.d.ts +4 -0
- package/uform/panel/Propreties/_ItemAdvance.js +140 -0
- package/uform/panel/Propreties/_ItemBase.d.ts +4 -0
- package/uform/panel/Propreties/_ItemBase.js +34 -0
- package/uform/panel/Propreties/_ItemLink.d.ts +4 -0
- package/uform/panel/Propreties/_ItemLink.js +15 -0
- package/uform/panel/Propreties/_ItemValidate.d.ts +4 -0
- package/uform/panel/Propreties/_ItemValidate.js +67 -0
- package/uform/panel/Propreties/_util.d.ts +9 -0
- package/uform/panel/Propreties/_util.js +2 -0
- package/uform/plugins/index.d.ts +15 -0
- package/uform/plugins/index.js +47 -0
- package/uform/schema.d.ts +155 -0
- package/uform/schema.js +2 -0
- package/uform/utils/Const.d.ts +20 -0
- package/uform/utils/Const.js +24 -0
- package/uform/utils/Convert.d.ts +3 -0
- package/uform/utils/Convert.js +274 -0
- package/uform/utils/SchemaConvert.d.ts +6 -0
- package/uform/utils/SchemaConvert.js +169 -0
- package/uform/utils/arr.d.ts +12 -0
- package/uform/utils/arr.js +175 -0
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.FORM_DATE = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const index_1 = require("../../index");
|
|
9
|
+
const lodash_1 = __importDefault(require("lodash"));
|
|
10
|
+
const dayjs_1 = __importDefault(require("dayjs"));
|
|
11
|
+
const utils_1 = require("../../utils");
|
|
12
|
+
const defaultPlaceholder = '请选择';
|
|
13
|
+
const style = { pointerEvents: 'none', };
|
|
14
|
+
const getPlaceholder = (props) => {
|
|
15
|
+
if (props.placeholder)
|
|
16
|
+
return props.placeholder;
|
|
17
|
+
return defaultPlaceholder + props.title;
|
|
18
|
+
};
|
|
19
|
+
// 日期输入相关的组件
|
|
20
|
+
const DatePick = (props) => {
|
|
21
|
+
const { field, disabled, value, form, onChange } = props;
|
|
22
|
+
let params = { placeholder: getPlaceholder(field), disabled, allowClear: true, style };
|
|
23
|
+
if (field.required || field.rules && lodash_1.default.find(field.rules, { required: true }))
|
|
24
|
+
params.allowClear = false;
|
|
25
|
+
if (field.config && field.config._startField) {
|
|
26
|
+
params.disabledDate = (current) => {
|
|
27
|
+
let startStr = form.getFieldValue(field.config._startField);
|
|
28
|
+
if (startStr == null || field.config._startField == '')
|
|
29
|
+
return false;
|
|
30
|
+
return (0, dayjs_1.default)(startStr).diff(current) > 0;
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
else if (field.config && field.config._endField) {
|
|
34
|
+
params.disabledDate = (current) => {
|
|
35
|
+
let endDateStr = form.getFieldValue(field.config._endField);
|
|
36
|
+
if (endDateStr == null || field.config._endField == '')
|
|
37
|
+
return false;
|
|
38
|
+
return (0, dayjs_1.default)(endDateStr).diff(current) < 0;
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
if (value) {
|
|
42
|
+
let day = (0, dayjs_1.default)(value);
|
|
43
|
+
if (day.isValid())
|
|
44
|
+
params.value = day;
|
|
45
|
+
}
|
|
46
|
+
const format = lodash_1.default.has(field.config, 'format') ? field.config.format : (props.showTime ? utils_1.GLOBAL.CONFIG.DATE.DATE_TIME_FORMAT : utils_1.GLOBAL.CONFIG.DATE.DATE_FORMAT);
|
|
47
|
+
return react_1.default.createElement(index_1.DatePicker, Object.assign({ style: { width: '80%', pointerEvents: 'none' } }, params, field.config, { showTime: props.showTime, format: format, onChange: day => {
|
|
48
|
+
if (day == null) {
|
|
49
|
+
onChange(undefined);
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
onChange(day.format(format));
|
|
53
|
+
}
|
|
54
|
+
} }));
|
|
55
|
+
};
|
|
56
|
+
// 内置输入
|
|
57
|
+
exports.FORM_DATE = [
|
|
58
|
+
{
|
|
59
|
+
type: 'date',
|
|
60
|
+
title: '日期',
|
|
61
|
+
icon: 'date.png',
|
|
62
|
+
defaultPlaceholder,
|
|
63
|
+
Component: props => {
|
|
64
|
+
let params = {
|
|
65
|
+
field: props,
|
|
66
|
+
onChange: () => { },
|
|
67
|
+
form: {},
|
|
68
|
+
};
|
|
69
|
+
if (props._default)
|
|
70
|
+
params.value = (0, dayjs_1.default)(props._default);
|
|
71
|
+
return react_1.default.createElement(DatePick, Object.assign({}, params, { showTime: false }));
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
type: 'datetime',
|
|
76
|
+
title: '日期+时间',
|
|
77
|
+
icon: 'date.png',
|
|
78
|
+
defaultPlaceholder,
|
|
79
|
+
Component: props => {
|
|
80
|
+
let params = {
|
|
81
|
+
field: props,
|
|
82
|
+
onChange: () => { },
|
|
83
|
+
form: {},
|
|
84
|
+
};
|
|
85
|
+
if (props._default)
|
|
86
|
+
params.value = (0, dayjs_1.default)(props._default);
|
|
87
|
+
return react_1.default.createElement(DatePick, Object.assign({}, params, { showTime: true }));
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
type: 'daterange',
|
|
92
|
+
title: '日期范围',
|
|
93
|
+
icon: 'date.png',
|
|
94
|
+
fieldCount: 2,
|
|
95
|
+
Component: props => {
|
|
96
|
+
const { config } = props;
|
|
97
|
+
return react_1.default.createElement(index_1.DatePicker.RangePicker, Object.assign({ style: style }, config, { showTime: false, disabled: props.disabled ? true : false }));
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
type: 'timerange',
|
|
102
|
+
title: '时间范围',
|
|
103
|
+
icon: 'date.png',
|
|
104
|
+
fieldCount: 2,
|
|
105
|
+
Component: props => {
|
|
106
|
+
const { config } = props;
|
|
107
|
+
return react_1.default.createElement(index_1.DatePicker.RangePicker, Object.assign({ style: style }, config, { showTime: true, disabled: props.disabled ? true : false }));
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
type: 'daterange-single',
|
|
112
|
+
title: '日期范围(单)',
|
|
113
|
+
icon: 'date.png',
|
|
114
|
+
fieldCount: 2,
|
|
115
|
+
breakCol: true,
|
|
116
|
+
Component: props => {
|
|
117
|
+
const { config } = props;
|
|
118
|
+
return react_1.default.createElement(index_1.DateRange, Object.assign({}, config, { showTime: false, disabled: props.disabled ? true : false }));
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
type: 'timerange-single',
|
|
123
|
+
title: '时间范围(单)',
|
|
124
|
+
icon: 'date.png',
|
|
125
|
+
fieldCount: 2,
|
|
126
|
+
breakCol: true,
|
|
127
|
+
Component: props => {
|
|
128
|
+
const { config } = props;
|
|
129
|
+
return react_1.default.createElement(index_1.DateRange, Object.assign({}, config, { showTime: true, disabled: props.disabled ? true : false }));
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
type: 'month',
|
|
134
|
+
title: '月',
|
|
135
|
+
icon: 'date.png',
|
|
136
|
+
defaultPlaceholder,
|
|
137
|
+
Component: props => {
|
|
138
|
+
let params = {
|
|
139
|
+
style: { width: '80%', pointerEvents: 'none' },
|
|
140
|
+
placeholder: getPlaceholder(props),
|
|
141
|
+
};
|
|
142
|
+
if (props._default)
|
|
143
|
+
params.value = (0, dayjs_1.default)(props._default);
|
|
144
|
+
return react_1.default.createElement(index_1.DatePicker.MonthPicker, Object.assign({}, params, props.config));
|
|
145
|
+
}
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
type: 'week',
|
|
149
|
+
title: '周',
|
|
150
|
+
icon: 'date.png',
|
|
151
|
+
defaultPlaceholder,
|
|
152
|
+
Component: props => {
|
|
153
|
+
let params = {
|
|
154
|
+
style: { width: '80%', pointerEvents: 'none' },
|
|
155
|
+
placeholder: getPlaceholder(props),
|
|
156
|
+
};
|
|
157
|
+
if (props._default)
|
|
158
|
+
params.value = (0, dayjs_1.default)(props._default);
|
|
159
|
+
return react_1.default.createElement(index_1.DatePicker.WeekPicker, Object.assign({}, params, props.config));
|
|
160
|
+
}
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
type: 'time',
|
|
164
|
+
title: '时间',
|
|
165
|
+
icon: 'date.png',
|
|
166
|
+
defaultPlaceholder,
|
|
167
|
+
Component: props => {
|
|
168
|
+
let params = {
|
|
169
|
+
style: { width: '80%', pointerEvents: 'none' },
|
|
170
|
+
placeholder: getPlaceholder(props),
|
|
171
|
+
};
|
|
172
|
+
if (props._default)
|
|
173
|
+
params.value = (0, dayjs_1.default)(props._default);
|
|
174
|
+
return react_1.default.createElement(index_1.TimePicker, Object.assign({}, params, props.config));
|
|
175
|
+
}
|
|
176
|
+
},
|
|
177
|
+
];
|
|
178
|
+
// monthrange
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { FormInput } from './register';
|
|
3
|
+
import type { FormItem } from '../schema';
|
|
4
|
+
export declare const getPlaceholder: (props: FormItem) => string;
|
|
5
|
+
export declare const INPUT: (props: any) => React.JSX.Element;
|
|
6
|
+
export declare const FORM_INPUT: FormInput[];
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.FORM_INPUT = exports.INPUT = exports.getPlaceholder = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const index_1 = require("../../index");
|
|
9
|
+
const lodash_1 = __importDefault(require("lodash"));
|
|
10
|
+
const defaultPlaceholder = '请输入';
|
|
11
|
+
const style = { pointerEvents: 'none' };
|
|
12
|
+
const getPlaceholder = (props) => {
|
|
13
|
+
if (props.placeholder)
|
|
14
|
+
return props.placeholder;
|
|
15
|
+
return defaultPlaceholder + props.title;
|
|
16
|
+
};
|
|
17
|
+
exports.getPlaceholder = getPlaceholder;
|
|
18
|
+
const INPUT = props => {
|
|
19
|
+
let params = { placeholder: (0, exports.getPlaceholder)(props), autoComplete: 'off', style, disabled: props.disabled ? true : false };
|
|
20
|
+
if (props._default)
|
|
21
|
+
params.value = props._default;
|
|
22
|
+
return react_1.default.createElement(index_1.Input, Object.assign({}, params, props.config));
|
|
23
|
+
};
|
|
24
|
+
exports.INPUT = INPUT;
|
|
25
|
+
// 内置输入
|
|
26
|
+
exports.FORM_INPUT = [
|
|
27
|
+
{
|
|
28
|
+
type: 'text',
|
|
29
|
+
title: '文本',
|
|
30
|
+
icon: 'text.png',
|
|
31
|
+
defaultPlaceholder,
|
|
32
|
+
Component: exports.INPUT
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
type: 'textarea',
|
|
36
|
+
title: '文本域',
|
|
37
|
+
icon: 'textarea.png',
|
|
38
|
+
breakCol: true,
|
|
39
|
+
defaultPlaceholder,
|
|
40
|
+
Component: props => {
|
|
41
|
+
let params = { placeholder: (0, exports.getPlaceholder)(props), autoComplete: 'off', style, disabled: props.disabled ? true : false };
|
|
42
|
+
if (props._default)
|
|
43
|
+
params.value = props._default;
|
|
44
|
+
return react_1.default.createElement(index_1.Input.TextArea, Object.assign({}, params, props.config));
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
type: 'password',
|
|
49
|
+
title: '密码',
|
|
50
|
+
icon: 'password.png',
|
|
51
|
+
defaultPlaceholder,
|
|
52
|
+
Component: props => {
|
|
53
|
+
let params = { placeholder: (0, exports.getPlaceholder)(props), autoComplete: 'off', style, disabled: props.disabled ? true : false };
|
|
54
|
+
if (props._default)
|
|
55
|
+
params.value = props._default;
|
|
56
|
+
return react_1.default.createElement(index_1.Input.Password, Object.assign({}, params, props.config));
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
type: 'number',
|
|
61
|
+
title: '数字',
|
|
62
|
+
icon: 'number.png',
|
|
63
|
+
defaultPlaceholder,
|
|
64
|
+
Component: props => {
|
|
65
|
+
let params = { placeholder: (0, exports.getPlaceholder)(props), autoComplete: 'off', style, disabled: props.disabled ? true : false };
|
|
66
|
+
if (props._default)
|
|
67
|
+
params.value = props._default;
|
|
68
|
+
return react_1.default.createElement(index_1.InputNumber, Object.assign({}, params, props.config));
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
type: 'input-with-select',
|
|
73
|
+
title: '输入 + 选择',
|
|
74
|
+
icon: 'text.png',
|
|
75
|
+
fieldCount: 2,
|
|
76
|
+
defaultPlaceholder,
|
|
77
|
+
hasOption: true,
|
|
78
|
+
defaultProperties: { selectProps: { style: { minWidth: 96 } }, },
|
|
79
|
+
Component: props => {
|
|
80
|
+
const { disabled, options, config } = props;
|
|
81
|
+
let inputProps = {
|
|
82
|
+
placeholder: (0, exports.getPlaceholder)(props),
|
|
83
|
+
disabled: disabled ? true : false,
|
|
84
|
+
autoComplete: 'off',
|
|
85
|
+
};
|
|
86
|
+
let selectProps = {
|
|
87
|
+
options: options,
|
|
88
|
+
disabled: disabled ? true : false,
|
|
89
|
+
allowClear: true,
|
|
90
|
+
placeholder: "请选择",
|
|
91
|
+
style: { minWidth: 80 }
|
|
92
|
+
};
|
|
93
|
+
let atRight = lodash_1.default.has(config, 'atAfter') && config.atAfter;
|
|
94
|
+
if (atRight) {
|
|
95
|
+
inputProps.addonAfter = react_1.default.createElement(index_1.Select, Object.assign({}, selectProps));
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
inputProps.addonBefore = react_1.default.createElement(index_1.Select, Object.assign({}, selectProps));
|
|
99
|
+
}
|
|
100
|
+
return react_1.default.createElement(index_1.Input, Object.assign({}, inputProps));
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
type: 'slider',
|
|
105
|
+
title: '数字滑动',
|
|
106
|
+
icon: 'text.png',
|
|
107
|
+
defaultConfig: { min: 0, max: 100, step: 1 },
|
|
108
|
+
Component: props => {
|
|
109
|
+
let params = { style, min: props._min ? props._min : 0, max: props._max ? props._max : 100, disabled: props.disabled ? true : false };
|
|
110
|
+
if (props._default) {
|
|
111
|
+
try {
|
|
112
|
+
params.value = parseInt(props._default);
|
|
113
|
+
}
|
|
114
|
+
catch (_a) { }
|
|
115
|
+
}
|
|
116
|
+
return react_1.default.createElement(index_1.Slider, Object.assign({}, params, props.config));
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
type: 'slider-range',
|
|
121
|
+
title: '数字范围',
|
|
122
|
+
icon: 'text.png',
|
|
123
|
+
fieldCount: 2,
|
|
124
|
+
defaultConfig: { min: 0, max: 100, step: 1 },
|
|
125
|
+
Component: props => {
|
|
126
|
+
let params = { style, min: props._min ? props._min : 0, max: props._max ? props._max : 100, disabled: props.disabled ? true : false, range: true };
|
|
127
|
+
if (props._default) {
|
|
128
|
+
try {
|
|
129
|
+
const ptns = props._default.split(',');
|
|
130
|
+
if (ptns.length == 2) {
|
|
131
|
+
params.value = [parseInt(ptns[0]), parseInt(ptns[1])];
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
catch (_a) { }
|
|
135
|
+
}
|
|
136
|
+
return react_1.default.createElement(index_1.Slider, Object.assign({}, params, props.config));
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
];
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.FORM_SELECT = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const index_1 = require("../../index");
|
|
9
|
+
const lodash_1 = __importDefault(require("lodash"));
|
|
10
|
+
const defaultPlaceholder = '请选择';
|
|
11
|
+
const style = { pointerEvents: 'none', width: '100%' };
|
|
12
|
+
const getPlaceholder = (props) => {
|
|
13
|
+
if (props.placeholder)
|
|
14
|
+
return props.placeholder;
|
|
15
|
+
return defaultPlaceholder + props.title;
|
|
16
|
+
};
|
|
17
|
+
// 内置输入
|
|
18
|
+
exports.FORM_SELECT = [
|
|
19
|
+
{
|
|
20
|
+
type: 'select',
|
|
21
|
+
title: '下拉',
|
|
22
|
+
icon: 'select.png',
|
|
23
|
+
defaultPlaceholder,
|
|
24
|
+
hasOption: true,
|
|
25
|
+
Component: props => {
|
|
26
|
+
let params = { placeholder: getPlaceholder(props), style, options: props.options, disabled: props.disabled ? true : false };
|
|
27
|
+
if (props._default) {
|
|
28
|
+
params.value = props._default;
|
|
29
|
+
if (props._isNumber) {
|
|
30
|
+
try {
|
|
31
|
+
params.value = parseInt(props._default);
|
|
32
|
+
}
|
|
33
|
+
catch (_a) { }
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return react_1.default.createElement(index_1.Select, Object.assign({}, params, props.config));
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
type: 'multi-select',
|
|
41
|
+
title: '下拉(多选)',
|
|
42
|
+
icon: 'select.png',
|
|
43
|
+
defaultPlaceholder,
|
|
44
|
+
hasOption: true,
|
|
45
|
+
Component: props => {
|
|
46
|
+
let params = { placeholder: getPlaceholder(props), style, options: props.options, disabled: props.disabled ? true : false };
|
|
47
|
+
if (props._default)
|
|
48
|
+
params.value = (props._default || '').split('').map(lodash_1.default.trim).filter(txt => txt.length > 0);
|
|
49
|
+
return react_1.default.createElement(index_1.Select, Object.assign({}, params, props.config));
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
type: 'switch',
|
|
54
|
+
title: '开关',
|
|
55
|
+
icon: 'select.png',
|
|
56
|
+
hasOption: true,
|
|
57
|
+
Component: props => {
|
|
58
|
+
let params = {
|
|
59
|
+
checkedChildren: props.options[0].label,
|
|
60
|
+
unCheckedChildren: props.options[1].label,
|
|
61
|
+
checked: props._default == props.options[0].value,
|
|
62
|
+
disabled: props.disabled ? true : false
|
|
63
|
+
};
|
|
64
|
+
return react_1.default.createElement(index_1.Switch, Object.assign({}, params, props.config));
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
type: 'radio',
|
|
69
|
+
title: '单选',
|
|
70
|
+
icon: 'select.png',
|
|
71
|
+
hasOption: true,
|
|
72
|
+
breakCol: true,
|
|
73
|
+
Component: props => {
|
|
74
|
+
let params = {
|
|
75
|
+
options: props.options,
|
|
76
|
+
disabled: props.disabled ? true : false,
|
|
77
|
+
optionType: "default"
|
|
78
|
+
};
|
|
79
|
+
if (props._default) {
|
|
80
|
+
params.value = props._default;
|
|
81
|
+
if (props._isNumber) {
|
|
82
|
+
try {
|
|
83
|
+
params.value = parseInt(props._default);
|
|
84
|
+
}
|
|
85
|
+
catch (_a) { }
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
return react_1.default.createElement(index_1.Radio.Group, Object.assign({}, params, props.config));
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
type: 'radio-button',
|
|
93
|
+
title: '单选(按钮)',
|
|
94
|
+
icon: 'select.png',
|
|
95
|
+
hasOption: true,
|
|
96
|
+
Component: props => {
|
|
97
|
+
let params = {
|
|
98
|
+
optionType: "button",
|
|
99
|
+
buttonStyle: "solid",
|
|
100
|
+
options: props.options,
|
|
101
|
+
disabled: props.disabled ? true : false,
|
|
102
|
+
};
|
|
103
|
+
if (props._default) {
|
|
104
|
+
params.value = props._default;
|
|
105
|
+
if (props._isNumber) {
|
|
106
|
+
try {
|
|
107
|
+
params.value = parseInt(props._default);
|
|
108
|
+
}
|
|
109
|
+
catch (_a) { }
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
return react_1.default.createElement(index_1.Radio.Group, Object.assign({}, params, props.config));
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
type: 'radio-with-more',
|
|
117
|
+
title: '单选(更多)',
|
|
118
|
+
icon: 'select.png',
|
|
119
|
+
hasOption: true,
|
|
120
|
+
breakCol: true,
|
|
121
|
+
Component: props => {
|
|
122
|
+
return react_1.default.createElement(index_1.Radio.Group, { disabled: props.disabled ? true : false },
|
|
123
|
+
props.options.map(item => react_1.default.createElement(index_1.Radio, { value: item.value }, item.label)),
|
|
124
|
+
react_1.default.createElement(index_1.Radio, { value: "___MORE__" }, "\u66F4\u591A"));
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
type: 'checkbox',
|
|
129
|
+
title: '多选',
|
|
130
|
+
icon: 'select.png',
|
|
131
|
+
hasOption: true,
|
|
132
|
+
Component: props => {
|
|
133
|
+
const { _default } = props;
|
|
134
|
+
const options = {
|
|
135
|
+
className: 'i-checkbox-group',
|
|
136
|
+
options: props.options.map((item) => (Object.assign(Object.assign({}, item), { value: item.value + '' }))),
|
|
137
|
+
disabled: props.disabled ? true : false,
|
|
138
|
+
value: [],
|
|
139
|
+
};
|
|
140
|
+
if (_default)
|
|
141
|
+
options.value = _default.split(',').map(item => item.trim());
|
|
142
|
+
return react_1.default.createElement(index_1.Checkbox.Group, Object.assign({}, options));
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
type: 'checkbox-with-all',
|
|
147
|
+
title: '多选(全选)',
|
|
148
|
+
icon: 'select.png',
|
|
149
|
+
hasOption: true,
|
|
150
|
+
Component: props => {
|
|
151
|
+
const { _default } = props;
|
|
152
|
+
const options = {
|
|
153
|
+
className: 'i-checkbox-group',
|
|
154
|
+
options: props.options.map((item) => (Object.assign(Object.assign({}, item), { value: item.value + '' }))),
|
|
155
|
+
disabled: props.disabled ? true : false,
|
|
156
|
+
value: [],
|
|
157
|
+
};
|
|
158
|
+
options.options.unshift({ label: '全部', value: '____CHECK_ALL' });
|
|
159
|
+
if (_default)
|
|
160
|
+
options.value = _default.split(',').map(item => item.trim());
|
|
161
|
+
return react_1.default.createElement(index_1.Checkbox.Group, Object.assign({}, options));
|
|
162
|
+
}
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
type: 'icon',
|
|
166
|
+
title: '图标',
|
|
167
|
+
icon: 'select.png',
|
|
168
|
+
defaultPlaceholder,
|
|
169
|
+
Component: props => {
|
|
170
|
+
let params = { placeholder: getPlaceholder(props), style, disabled: props.disabled ? true : false };
|
|
171
|
+
return react_1.default.createElement(index_1.Select, Object.assign({}, params));
|
|
172
|
+
}
|
|
173
|
+
},
|
|
174
|
+
// tree-select 树选择 string | number
|
|
175
|
+
// dtree-select 树选择(动态树) string | number
|
|
176
|
+
];
|
|
177
|
+
// registerFormField({
|
|
178
|
+
// group: GroupType.SELECT,
|
|
179
|
+
// type: 'transfer',
|
|
180
|
+
// text: '穿梭框选择',
|
|
181
|
+
// breakCol: true,
|
|
182
|
+
// thumbnail: '/transfer.png',
|
|
183
|
+
// component: class extends FormField {
|
|
184
|
+
// render() {
|
|
185
|
+
// let param: any = this.param();
|
|
186
|
+
// let options = this.props.options || [];
|
|
187
|
+
// if (param.value) {
|
|
188
|
+
// param.selectedKeys = param.value.split(',')
|
|
189
|
+
// }
|
|
190
|
+
// return <Transfer
|
|
191
|
+
// titles={['未选择', '已选择']}
|
|
192
|
+
// {...param}
|
|
193
|
+
// dataSource={options.map(item => ({ key: item.value, title: item.name }))}
|
|
194
|
+
// render={item => item.title}
|
|
195
|
+
// />
|
|
196
|
+
// }
|
|
197
|
+
// }
|
|
198
|
+
// });
|
|
199
|
+
// registerFormField({
|
|
200
|
+
// group: GroupType.SELECT,
|
|
201
|
+
// type: 'tree-select',
|
|
202
|
+
// text: '树选择',
|
|
203
|
+
// thumbnail: '/select.png',
|
|
204
|
+
// component: class extends FormField {
|
|
205
|
+
// render() {
|
|
206
|
+
// let param: any = this.param();
|
|
207
|
+
// let options = this.props.options || [];
|
|
208
|
+
// if (param.value) {
|
|
209
|
+
// param.selectedKeys = param.value.split(',')
|
|
210
|
+
// }
|
|
211
|
+
// return <TreeSelect
|
|
212
|
+
// dropdownStyle={{ maxHeight: 389, overflow: 'auto' }}
|
|
213
|
+
// {...param}
|
|
214
|
+
// multiple={false}
|
|
215
|
+
// treeCheckable={false}
|
|
216
|
+
// />
|
|
217
|
+
// }
|
|
218
|
+
// }
|
|
219
|
+
// });
|
|
220
|
+
// registerFormField({
|
|
221
|
+
// group: GroupType.SELECT,
|
|
222
|
+
// type: 'multi-tree-select',
|
|
223
|
+
// text: '树选择 (多选)',
|
|
224
|
+
// thumbnail: '/select.png',
|
|
225
|
+
// component: class extends FormField {
|
|
226
|
+
// render() {
|
|
227
|
+
// let param: any = this.param();
|
|
228
|
+
// let options = this.props.options || [];
|
|
229
|
+
// if (param.value) {
|
|
230
|
+
// param.selectedKeys = param.value.split(',')
|
|
231
|
+
// }
|
|
232
|
+
// return <TreeSelect
|
|
233
|
+
// dropdownStyle={{ maxHeight: 389, overflow: 'auto' }}
|
|
234
|
+
// treeData={options.map(item => ({ title: item.name, key: item.value, value: item.value }))}
|
|
235
|
+
// {...param}
|
|
236
|
+
// multiple
|
|
237
|
+
// treeCheckable={false}
|
|
238
|
+
// />
|
|
239
|
+
// }
|
|
240
|
+
// }
|
|
241
|
+
// });
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.FROM_SPECIFIC = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const _input_1 = require("./_input");
|
|
9
|
+
const index_1 = require("../../index");
|
|
10
|
+
const defaultPlaceholder = '请输入';
|
|
11
|
+
// 内置输入
|
|
12
|
+
exports.FROM_SPECIFIC = [
|
|
13
|
+
{
|
|
14
|
+
type: 'ip',
|
|
15
|
+
title: 'IP地址',
|
|
16
|
+
icon: 'text.png',
|
|
17
|
+
defaultPlaceholder,
|
|
18
|
+
Component: _input_1.INPUT
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
type: 'ip4',
|
|
22
|
+
title: 'IP4',
|
|
23
|
+
icon: 'text.png',
|
|
24
|
+
defaultPlaceholder,
|
|
25
|
+
Component: props => react_1.default.createElement(index_1.Input.Group, { style: { pointerEvents: 'none', }, className: 'i-ip' },
|
|
26
|
+
react_1.default.createElement(index_1.InputNumber, { placeholder: '192', style: { width: 60, borderRightColor: 'transparent', borderTopRightRadius: 0, borderBottomRightRadius: 0 } }),
|
|
27
|
+
react_1.default.createElement(index_1.InputNumber, { placeholder: '168', style: { width: 60, borderLeftColor: 'transparent', borderRightColor: 'transparent', borderRadius: 0 } }),
|
|
28
|
+
react_1.default.createElement(index_1.InputNumber, { placeholder: '1', style: { width: 60, borderLeftColor: 'transparent', borderRightColor: 'transparent', borderRadius: 0 } }),
|
|
29
|
+
react_1.default.createElement(index_1.InputNumber, { placeholder: '1', style: { width: 60, borderLeftColor: 'transparent', borderTopLeftRadius: 0, borderBottomLeftRadius: 0 } }))
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
type: 'ip6',
|
|
33
|
+
title: 'IP6',
|
|
34
|
+
icon: 'text.png',
|
|
35
|
+
defaultPlaceholder,
|
|
36
|
+
Component: _input_1.INPUT
|
|
37
|
+
},
|
|
38
|
+
// ip4 port email url crontab
|
|
39
|
+
{
|
|
40
|
+
type: 'port',
|
|
41
|
+
title: '端口',
|
|
42
|
+
icon: 'text.png',
|
|
43
|
+
defaultPlaceholder,
|
|
44
|
+
Component: props => {
|
|
45
|
+
let params = { placeholder: (0, _input_1.getPlaceholder)(props), disabled: props.disabled === false, autoComplete: 'off', };
|
|
46
|
+
return react_1.default.createElement(index_1.Input.Group, { style: { pointerEvents: 'none', }, compact: true, className: 'i-port' },
|
|
47
|
+
react_1.default.createElement(index_1.InputNumber, Object.assign({}, params, { autoComplete: "off", value: props._default === null ? undefined : props._default, min: 1, max: 65535, step: 1, style: { width: 120 } })),
|
|
48
|
+
react_1.default.createElement(index_1.Button, { icon: react_1.default.createElement(index_1.Icon, { type: "select" }) }, "\u5E38\u7528\u7AEF\u53E3"));
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
type: 'idcard',
|
|
53
|
+
title: '身份证',
|
|
54
|
+
icon: 'text.png',
|
|
55
|
+
defaultPlaceholder,
|
|
56
|
+
Component: _input_1.INPUT
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
type: 'phone',
|
|
60
|
+
title: '电话号码',
|
|
61
|
+
icon: 'text.png',
|
|
62
|
+
defaultPlaceholder,
|
|
63
|
+
Component: _input_1.INPUT
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
type: 'mobilephone',
|
|
67
|
+
title: '手机号码',
|
|
68
|
+
icon: 'text.png',
|
|
69
|
+
defaultPlaceholder,
|
|
70
|
+
Component: _input_1.INPUT
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
type: 'telephone',
|
|
74
|
+
title: '固话号码',
|
|
75
|
+
icon: 'text.png',
|
|
76
|
+
defaultPlaceholder,
|
|
77
|
+
Component: _input_1.INPUT
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
type: 'mac',
|
|
81
|
+
title: 'MAC地址',
|
|
82
|
+
icon: 'text.png',
|
|
83
|
+
defaultPlaceholder,
|
|
84
|
+
Component: _input_1.INPUT
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
type: 'url',
|
|
88
|
+
title: 'URL地址',
|
|
89
|
+
icon: 'text.png',
|
|
90
|
+
defaultPlaceholder,
|
|
91
|
+
Component: _input_1.INPUT
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
type: 'email',
|
|
95
|
+
title: 'Email地址',
|
|
96
|
+
icon: 'text.png',
|
|
97
|
+
defaultPlaceholder,
|
|
98
|
+
Component: _input_1.INPUT
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
type: 'crontab',
|
|
102
|
+
title: 'Crontab',
|
|
103
|
+
icon: 'text.png',
|
|
104
|
+
defaultPlaceholder,
|
|
105
|
+
Component: props => react_1.default.createElement(index_1.Button, { style: { pointerEvents: 'none', } }, props.placeholder || '设置周期')
|
|
106
|
+
},
|
|
107
|
+
];
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export { Groups } from './register';
|
|
3
|
+
import type { FormItem } from '../schema';
|
|
4
|
+
export type { FormInput } from './register';
|
|
5
|
+
export declare const getInput: (type: string) => import("./register").FormInput;
|
|
6
|
+
export declare const preview: (props: FormItem) => import("react").FunctionComponentElement<FormItem>;
|