amis-editor 4.2.0-beta.3 → 5.1.8
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/6dbcbb49b6fd405190a9.png +0 -0
- package/dist/component/Editor.d.ts +16 -0
- package/dist/component/RegionWrapper.d.ts +10 -0
- package/dist/component/ScaffoldModal.d.ts +1 -1
- package/dist/component/VRenderer.d.ts +10 -0
- package/dist/component/control/APIControl.d.ts +1158 -0
- package/dist/component/control/ActionAPIControl.d.ts +1158 -0
- package/dist/component/control/BadgeControl.d.ts +133 -0
- package/dist/component/control/BaseControl.d.ts +248 -0
- package/dist/component/control/DataBindingControl.d.ts +14 -0
- package/dist/component/control/DataPickerControl.d.ts +13 -0
- package/dist/component/control/DateShortCutControl.d.ts +83 -0
- package/dist/component/control/FormulaControl.d.ts +51 -0
- package/dist/component/{Control → control}/OptionControl.d.ts +23 -34
- package/dist/component/{Control → control}/PopoverEdit.d.ts +0 -0
- package/dist/component/control/StatusControl.d.ts +39 -0
- package/dist/component/control/SwitchMoreControl.d.ts +224 -0
- package/dist/component/control/ValidationControl.d.ts +65 -0
- package/dist/component/control/ValidationItem.d.ts +46 -0
- package/dist/component/control/style-control/Background.d.ts +17 -0
- package/dist/component/control/style-control/Border.d.ts +18 -0
- package/dist/component/control/style-control/BoxModel.d.ts +17 -0
- package/dist/component/control/style-control/BoxShadow.d.ts +18 -0
- package/dist/component/control/style-control/Display.d.ts +14 -0
- package/dist/component/control/style-control/Font.d.ts +16 -0
- package/dist/component/control/style-control/font-family.d.ts +11 -0
- package/dist/component/control/style-control/transformation.d.ts +29 -0
- package/dist/component/control/style-control/types.d.ts +8 -0
- package/dist/component/schemaTpl.d.ts +8 -0
- package/dist/component/validator.d.ts +62 -0
- package/dist/dnd/index.d.ts +1 -1
- package/dist/event-action/action-config-panel.d.ts +8 -0
- package/dist/event-action/actions.d.ts +3 -0
- package/dist/event-action/comp-action-select.d.ts +11 -0
- package/dist/event-action/config.d.ts +13 -0
- package/dist/event-action/index.d.ts +459 -0
- package/dist/event-action/schema.d.ts +32 -0
- package/dist/exports.min.js +1 -1
- package/dist/index.d.ts +23 -5
- package/dist/index.min.js +1 -1
- package/dist/manager.d.ts +46 -1
- package/dist/plugin/Alert.d.ts +4 -2
- package/dist/plugin/Button.d.ts +5 -1
- package/dist/plugin/ButtonGroup.d.ts +13 -34
- package/dist/plugin/ButtonToolbar.d.ts +4 -10
- package/dist/plugin/CRUD.d.ts +2 -0
- package/dist/plugin/Chart.d.ts +2 -0
- package/dist/plugin/Collapse.d.ts +1 -0
- package/dist/plugin/CollapseGroup.d.ts +28 -4
- package/dist/plugin/Container.d.ts +2 -1
- package/dist/plugin/Dialog.d.ts +12 -2
- package/dist/plugin/Drawer.d.ts +12 -2
- package/dist/plugin/DropDownButton.d.ts +11 -11
- package/dist/plugin/Form/ButtonGroupSelect.d.ts +7 -2
- package/dist/plugin/Form/ButtonToolbar.d.ts +8 -7
- package/dist/plugin/Form/ChainedSelect.d.ts +3 -0
- package/dist/plugin/Form/Checkbox.d.ts +7 -2
- package/dist/plugin/Form/Checkboxes.d.ts +8 -2
- package/dist/plugin/Form/CodeEditor.d.ts +7 -22
- package/dist/plugin/Form/Combo.d.ts +3 -0
- package/dist/plugin/Form/Control.d.ts +6 -2
- package/dist/plugin/Form/DiffEditor.d.ts +7 -1
- package/dist/plugin/Form/Form.d.ts +6 -0
- package/dist/plugin/Form/Formula.d.ts +1 -25
- package/dist/plugin/Form/InputDate.d.ts +8 -2
- package/dist/plugin/Form/InputDateRange.d.ts +8 -2
- package/dist/plugin/Form/InputDateTime.d.ts +4 -4
- package/dist/plugin/Form/InputDateTimeRange.d.ts +4 -4
- package/dist/plugin/Form/InputEmail.d.ts +1 -0
- package/dist/plugin/Form/InputExcel.d.ts +6 -41
- package/dist/plugin/Form/InputFile.d.ts +7 -3
- package/dist/plugin/Form/InputKV.d.ts +6 -0
- package/dist/plugin/Form/InputMonth.d.ts +1 -0
- package/dist/plugin/Form/InputMonthRange.d.ts +4 -4
- package/dist/plugin/Form/InputPassword.d.ts +1 -0
- package/dist/plugin/Form/InputQuarter.d.ts +1 -0
- package/dist/plugin/Form/InputQuarterRange.d.ts +4 -4
- package/dist/plugin/Form/InputRange.d.ts +3 -0
- package/dist/plugin/Form/InputRating.d.ts +9 -3
- package/dist/plugin/Form/InputText.d.ts +24 -2
- package/dist/plugin/Form/InputTime.d.ts +3 -3
- package/dist/plugin/Form/InputTimeRange.d.ts +20 -0
- package/dist/plugin/Form/InputTree.d.ts +6 -2
- package/dist/plugin/Form/InputURL.d.ts +1 -0
- package/dist/plugin/Form/InputYear.d.ts +1 -0
- package/dist/plugin/Form/InputYearRange.d.ts +20 -0
- package/dist/plugin/Form/ListSelect.d.ts +6 -2
- package/dist/plugin/Form/LocationPicker.d.ts +1 -31
- package/dist/plugin/Form/NestedSelect.d.ts +5 -2
- package/dist/plugin/Form/Radios.d.ts +7 -2
- package/dist/plugin/Form/Select.d.ts +7 -2
- package/dist/plugin/Form/Switch.d.ts +7 -2
- package/dist/plugin/Form/TabsTransfer.d.ts +5 -2
- package/dist/plugin/Form/Textarea.d.ts +7 -1
- package/dist/plugin/Form/Transfer.d.ts +5 -2
- package/dist/plugin/Form/TreeSelect.d.ts +6 -2
- package/dist/plugin/IFrame.d.ts +2 -2
- package/dist/plugin/Nav.d.ts +1 -116
- package/dist/plugin/Others/Action.d.ts +5 -1
- package/dist/plugin/Page.d.ts +5 -2
- package/dist/plugin/Progress.d.ts +5 -1
- package/dist/plugin/Table.d.ts +2 -0
- package/dist/plugin/Tabs.d.ts +33 -2
- package/dist/plugin/TooltipWrapper.d.ts +10 -0
- package/dist/plugin/Tpl.d.ts +2 -1
- package/dist/plugin/Wizard.d.ts +4 -1
- package/dist/plugin.d.ts +37 -1
- package/dist/store/editor.d.ts +55 -28
- package/dist/store/node.d.ts +16 -0
- package/dist/style.css +1 -1
- package/dist/util.d.ts +36 -3
- package/package.json +14 -8
- package/src/component/schemaTpl.tsx +1198 -474
- package/src/plugin/.DS_Store +0 -0
- package/src/plugin/Alert.tsx +69 -48
- package/src/plugin/AnchorNav.tsx +1 -0
- package/src/plugin/Audio.tsx +9 -15
- package/src/plugin/Avatar.tsx +2 -1
- package/src/plugin/Breadcrumb.tsx +2 -1
- package/src/plugin/Button.tsx +257 -188
- package/src/plugin/ButtonGroup.tsx +99 -38
- package/src/plugin/ButtonToolbar.tsx +7 -13
- package/src/plugin/CRUD.tsx +77 -135
- package/src/plugin/Card.tsx +1 -0
- package/src/plugin/Cards.tsx +8 -14
- package/src/plugin/Carousel.tsx +1 -1
- package/src/plugin/Chart.tsx +26 -14
- package/src/plugin/Collapse.tsx +78 -78
- package/src/plugin/CollapseGroup.tsx +165 -83
- package/src/plugin/Container.tsx +59 -6
- package/src/plugin/Custom.tsx +2 -8
- package/src/plugin/CustomRegion.tsx +4 -3
- package/src/plugin/Dialog.tsx +55 -24
- package/src/plugin/Drawer.tsx +65 -35
- package/src/plugin/DropDownButton.tsx +95 -79
- package/src/plugin/Flex.tsx +123 -65
- package/src/plugin/Form/ButtonGroupSelect.tsx +114 -26
- package/src/plugin/Form/ButtonToolbar.tsx +62 -55
- package/src/plugin/Form/ChainedSelect.tsx +45 -0
- package/src/plugin/Form/Checkbox.tsx +122 -33
- package/src/plugin/Form/Checkboxes.tsx +154 -87
- package/src/plugin/Form/CodeEditor.tsx +163 -34
- package/src/plugin/Form/Combo.tsx +104 -65
- package/src/plugin/Form/Control.tsx +16 -70
- package/src/plugin/Form/DiffEditor.tsx +158 -54
- package/src/plugin/Form/FieldSet.tsx +6 -11
- package/src/plugin/Form/Form.tsx +277 -70
- package/src/plugin/Form/Formula.tsx +8 -14
- package/src/plugin/Form/InputArray.tsx +7 -16
- package/src/plugin/Form/InputCity.tsx +1 -1
- package/src/plugin/Form/InputDate.tsx +344 -121
- package/src/plugin/Form/InputDateRange.tsx +303 -161
- package/src/plugin/Form/InputDateTime.tsx +6 -150
- package/src/plugin/Form/InputDateTimeRange.tsx +7 -187
- package/src/plugin/Form/InputEmail.tsx +1 -0
- package/src/plugin/Form/InputExcel.tsx +70 -27
- package/src/plugin/Form/InputFile.tsx +326 -152
- package/src/plugin/Form/InputImage.tsx +1 -1
- package/src/plugin/Form/InputKV.tsx +61 -0
- package/src/plugin/Form/InputMonth.tsx +3 -1
- package/src/plugin/Form/InputMonthRange.tsx +6 -160
- package/src/plugin/Form/InputNumber.tsx +1 -1
- package/src/plugin/Form/InputPassword.tsx +2 -0
- package/src/plugin/Form/InputQuarter.tsx +3 -1
- package/src/plugin/Form/InputQuarterRange.tsx +6 -160
- package/src/plugin/Form/InputRange.tsx +74 -4
- package/src/plugin/Form/InputRating.tsx +347 -35
- package/src/plugin/Form/InputRichText.tsx +2 -3
- package/src/plugin/Form/InputTable.tsx +33 -49
- package/src/plugin/Form/InputTag.tsx +1 -1
- package/src/plugin/Form/InputText.tsx +310 -132
- package/src/plugin/Form/InputTime.tsx +4 -53
- package/src/plugin/Form/InputTimeRange.tsx +41 -0
- package/src/plugin/Form/InputTree.tsx +196 -46
- package/src/plugin/Form/InputURL.tsx +2 -0
- package/src/plugin/Form/InputYear.tsx +2 -0
- package/src/plugin/Form/InputYearRange.tsx +41 -0
- package/src/plugin/Form/Item.tsx +17 -18
- package/src/plugin/Form/ListSelect.tsx +75 -20
- package/src/plugin/Form/LocationPicker.tsx +2 -7
- package/src/plugin/Form/MatrixCheckboxes.tsx +1 -1
- package/src/plugin/Form/NestedSelect.tsx +110 -43
- package/src/plugin/Form/Picker.tsx +2 -5
- package/src/plugin/Form/Radios.tsx +122 -52
- package/src/plugin/Form/Select.tsx +239 -168
- package/src/plugin/Form/Static.tsx +1 -1
- package/src/plugin/Form/Switch.tsx +170 -58
- package/src/plugin/Form/TabsTransfer.tsx +175 -79
- package/src/plugin/Form/Textarea.tsx +146 -36
- package/src/plugin/Form/Transfer.tsx +295 -233
- package/src/plugin/Form/TreeSelect.tsx +287 -146
- package/src/plugin/Grid.tsx +340 -312
- package/src/plugin/HBox.tsx +1 -0
- package/src/plugin/IFrame.tsx +21 -12
- package/src/plugin/Image.tsx +7 -12
- package/src/plugin/Images.tsx +7 -12
- package/src/plugin/Link.tsx +6 -12
- package/src/plugin/List.tsx +6 -10
- package/src/plugin/ListItem.tsx +1 -0
- package/src/plugin/Nav.tsx +7 -9
- package/src/plugin/Others/Action.tsx +16 -10
- package/src/plugin/Others/BasicToolbar.tsx +4 -1
- package/src/plugin/Others/TableCell.tsx +19 -39
- package/src/plugin/Page.tsx +315 -229
- package/src/plugin/Panel.tsx +6 -7
- package/src/plugin/Plain.tsx +3 -6
- package/src/plugin/Progress.tsx +234 -94
- package/src/plugin/Service.tsx +10 -6
- package/src/plugin/Table.tsx +49 -20
- package/src/plugin/TableView.tsx +212 -106
- package/src/plugin/Tabs.tsx +306 -146
- package/src/plugin/TooltipWrapper.tsx +231 -135
- package/src/plugin/Tpl.tsx +68 -52
- package/src/plugin/Video.tsx +9 -20
- package/src/plugin/Wizard.tsx +537 -336
- package/src/plugin/Wrapper.tsx +82 -61
- package/src/plugin.ts +66 -4
- package/static/empty.png +0 -0
- package/dist/component/Control/APIControl.d.ts +0 -504
- package/dist/component/Control/ValidationControl.d.ts +0 -30
- package/dist/component/remarkTpl.d.ts +0 -150
@@ -1,17 +1,143 @@
|
|
1
|
-
import {relativeValueRe} from 'amis';
|
2
|
-
import {
|
3
|
-
defaultValue,
|
4
|
-
getSchemaTpl,
|
5
|
-
valuePipeOut
|
6
|
-
} from '../../component/schemaTpl';
|
7
1
|
import {registerEditorPlugin} from '../../manager';
|
8
|
-
import {
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
} from '../../
|
14
|
-
import
|
2
|
+
import {defaultValue, getSchemaTpl} from '../../component/schemaTpl';
|
3
|
+
import {BasePlugin, BaseEventContext} from '../../plugin';
|
4
|
+
|
5
|
+
import {tipedLabel} from '../../component/control/BaseControl';
|
6
|
+
import {ValidatorTag} from '../../component/validator';
|
7
|
+
import {getEventControlConfig} from '../../util';
|
8
|
+
import {RendererAction, RendererEvent} from '../../event-action';
|
9
|
+
|
10
|
+
const formatX = [
|
11
|
+
{
|
12
|
+
label: 'X(时间戳)',
|
13
|
+
value: 'X'
|
14
|
+
},
|
15
|
+
{
|
16
|
+
label: 'x(毫秒时间戳)',
|
17
|
+
value: 'x'
|
18
|
+
}
|
19
|
+
];
|
20
|
+
|
21
|
+
const DateType: {
|
22
|
+
[key: string]: {
|
23
|
+
format: string;
|
24
|
+
placeholder: string;
|
25
|
+
formatOptions: Array<{label: string; value: string; timeFormat?: string}>;
|
26
|
+
};
|
27
|
+
} = {
|
28
|
+
date: {
|
29
|
+
format: 'YYYY-MM-DD',
|
30
|
+
placeholder: '请选择日期',
|
31
|
+
formatOptions: [
|
32
|
+
...formatX,
|
33
|
+
{
|
34
|
+
label: 'YYYY-MM-DD',
|
35
|
+
value: 'YYYY-MM-DD'
|
36
|
+
},
|
37
|
+
{
|
38
|
+
label: 'YYYY/MM/DD',
|
39
|
+
value: 'YYYY/MM/DD'
|
40
|
+
},
|
41
|
+
{
|
42
|
+
label: 'YYYY年MM月DD日',
|
43
|
+
value: 'YYYY年MM月DD日'
|
44
|
+
}
|
45
|
+
]
|
46
|
+
},
|
47
|
+
datetime: {
|
48
|
+
format: 'YYYY-MM-DD HH:mm:ss',
|
49
|
+
placeholder: '请选择日期以及时间',
|
50
|
+
formatOptions: [
|
51
|
+
...formatX,
|
52
|
+
{
|
53
|
+
label: 'YYYY-MM-DD HH:mm:ss',
|
54
|
+
value: 'YYYY-MM-DD HH:mm:ss'
|
55
|
+
},
|
56
|
+
{
|
57
|
+
label: 'YYYY/MM/DD HH:mm:ss',
|
58
|
+
value: 'YYYY/MM/DD HH:mm:ss'
|
59
|
+
},
|
60
|
+
{
|
61
|
+
label: 'YYYY年MM月DD日 HH时mm分ss秒',
|
62
|
+
value: 'YYYY年MM月DD日 HH时mm分ss秒'
|
63
|
+
}
|
64
|
+
]
|
65
|
+
},
|
66
|
+
time: {
|
67
|
+
format: 'HH:mm',
|
68
|
+
placeholder: '请选择时间',
|
69
|
+
formatOptions: [
|
70
|
+
{
|
71
|
+
label: 'HH:mm',
|
72
|
+
value: 'HH:mm',
|
73
|
+
timeFormat: 'HH:mm'
|
74
|
+
},
|
75
|
+
{
|
76
|
+
label: 'HH:mm:ss',
|
77
|
+
value: 'HH:mm:ss',
|
78
|
+
timeFormat: 'HH:mm'
|
79
|
+
},
|
80
|
+
{
|
81
|
+
label: 'HH时mm分',
|
82
|
+
value: 'HH时mm分',
|
83
|
+
timeFormat: 'HH:mm'
|
84
|
+
},
|
85
|
+
{
|
86
|
+
label: 'HH时mm分ss秒',
|
87
|
+
value: 'HH时mm分ss秒',
|
88
|
+
timeFormat: 'HH:mm:ss'
|
89
|
+
}
|
90
|
+
]
|
91
|
+
},
|
92
|
+
month: {
|
93
|
+
format: 'YYYY-MM',
|
94
|
+
placeholder: '请选择月份',
|
95
|
+
formatOptions: [
|
96
|
+
...formatX,
|
97
|
+
{
|
98
|
+
label: 'YYYY-MM',
|
99
|
+
value: 'YYYY-MM'
|
100
|
+
},
|
101
|
+
{
|
102
|
+
label: 'MM',
|
103
|
+
value: 'MM'
|
104
|
+
},
|
105
|
+
{
|
106
|
+
label: 'M',
|
107
|
+
value: 'M'
|
108
|
+
}
|
109
|
+
]
|
110
|
+
},
|
111
|
+
quarter: {
|
112
|
+
format: 'YYYY [Q]Q',
|
113
|
+
placeholder: '请选择季度',
|
114
|
+
formatOptions: [
|
115
|
+
...formatX,
|
116
|
+
{
|
117
|
+
label: 'YYYY-[Q]Q',
|
118
|
+
value: 'YYYY-[Q]Q'
|
119
|
+
},
|
120
|
+
{
|
121
|
+
label: 'Q',
|
122
|
+
value: 'Q'
|
123
|
+
}
|
124
|
+
]
|
125
|
+
},
|
126
|
+
year: {
|
127
|
+
format: 'YYYY',
|
128
|
+
placeholder: '请选择年',
|
129
|
+
formatOptions: [
|
130
|
+
...formatX,
|
131
|
+
{
|
132
|
+
label: 'YYYY',
|
133
|
+
value: 'YYYY'
|
134
|
+
}
|
135
|
+
]
|
136
|
+
}
|
137
|
+
};
|
138
|
+
|
139
|
+
const tipedLabelText =
|
140
|
+
'支持 <code>now、+1day、-2weeks、+1hours、+2years</code>这种相对值用法,同时支持变量如<code>\\${start_date}</code>';
|
15
141
|
|
16
142
|
export class DateControlPlugin extends BasePlugin {
|
17
143
|
// 关联渲染器名字
|
@@ -22,8 +148,11 @@ export class DateControlPlugin extends BasePlugin {
|
|
22
148
|
|
23
149
|
// 组件名称
|
24
150
|
icon = 'fa fa-calendar';
|
25
|
-
name = '
|
151
|
+
name = '日期';
|
26
152
|
isBaseComponent = true;
|
153
|
+
// 添加源对应组件中文名称 & type字段
|
154
|
+
searchKeywords =
|
155
|
+
'日期框、input-datetime、日期时间框、input-time、时间框、input-month、月份框、input-quarter、季度框、input-year、年框';
|
27
156
|
description = '年月日选择,支持相对值设定,如<code>+2days</code>两天后';
|
28
157
|
docLink = '/amis/zh-CN/components/form/input-date';
|
29
158
|
tags = ['表单项'];
|
@@ -44,132 +173,226 @@ export class DateControlPlugin extends BasePlugin {
|
|
44
173
|
]
|
45
174
|
};
|
46
175
|
|
47
|
-
|
48
|
-
panelBody = [
|
49
|
-
getSchemaTpl('placeholder', {
|
50
|
-
pipeIn: defaultValue('请选择日期')
|
51
|
-
}),
|
52
|
-
|
53
|
-
{
|
54
|
-
type: 'input-text',
|
55
|
-
name: 'format',
|
56
|
-
label: '值格式',
|
57
|
-
description:
|
58
|
-
'请参考 <a href="https://momentjs.com/" target="_blank">moment</a> 中的格式用法。',
|
59
|
-
pipeIn: defaultValue('X'),
|
60
|
-
onChange: (value: any, oldValue: any, model: any, form: any) => {
|
61
|
-
form.setValueByName('value', '');
|
62
|
-
form.setValueByName('minDate', '');
|
63
|
-
form.setValueByName('maxDate', '');
|
64
|
-
}
|
65
|
-
},
|
176
|
+
notRenderFormZone = true;
|
66
177
|
|
67
|
-
|
68
|
-
|
69
|
-
{
|
70
|
-
type: 'input-text',
|
71
|
-
name: 'value',
|
72
|
-
label: '默认值',
|
73
|
-
visibleOn: 'typeof this.value !== "undefined"',
|
74
|
-
placeholder: '请输入相对值',
|
75
|
-
description: '支持 <code>now、+1day、-2weeks</code>这种相对值用法'
|
76
|
-
},
|
178
|
+
panelTitle = '日期配置';
|
77
179
|
|
180
|
+
events: RendererEvent[] = [
|
78
181
|
{
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
className: 'fieldset',
|
84
|
-
visibleOn: 'typeof this.value !== "undefined"',
|
85
|
-
body: [
|
182
|
+
eventName: 'change',
|
183
|
+
eventLabel: '值变化',
|
184
|
+
description: '时间值变化时触发',
|
185
|
+
dataSchema: [
|
86
186
|
{
|
87
|
-
type: '
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
: value
|
94
|
-
).format('X'),
|
95
|
-
pipeOut: (value: any, old: any, data: any) => {
|
96
|
-
return moment(parseInt(value, 10), 'X').format(data.format);
|
187
|
+
type: 'object',
|
188
|
+
properties: {
|
189
|
+
'event.data.value': {
|
190
|
+
type: 'string',
|
191
|
+
title: '时间值'
|
192
|
+
}
|
97
193
|
}
|
98
194
|
}
|
99
195
|
]
|
100
196
|
},
|
101
|
-
getSchemaTpl('clearable', {
|
102
|
-
pipeIn: defaultValue(true)
|
103
|
-
}),
|
104
|
-
|
105
197
|
{
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
placeholder: '请输入相对值',
|
110
|
-
description:
|
111
|
-
'支持 <code>now、+1day、-2weeks</code>这种相对值用法,同时支持变量如<code>\\${start_date}</code>'
|
198
|
+
eventName: 'focus',
|
199
|
+
eventLabel: '获取焦点',
|
200
|
+
description: '输入框获取焦点(非内嵌模式)时触发'
|
112
201
|
},
|
113
|
-
|
114
202
|
{
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
body: [
|
121
|
-
{
|
122
|
-
type: 'input-date',
|
123
|
-
name: 'minDate',
|
124
|
-
pipeIn: (value: any) =>
|
125
|
-
moment(
|
126
|
-
relativeValueRe.test(value) || ~['now', 'today'].indexOf(value)
|
127
|
-
? ''
|
128
|
-
: value
|
129
|
-
).format('X'),
|
130
|
-
pipeOut: (value: any, old: any, data: any) => {
|
131
|
-
return moment(parseInt(value, 10), 'X').format(data.format);
|
132
|
-
}
|
133
|
-
}
|
134
|
-
]
|
135
|
-
},
|
203
|
+
eventName: 'blur',
|
204
|
+
eventLabel: '失去焦点',
|
205
|
+
description: '输入框失去焦点(非内嵌模式)时触发'
|
206
|
+
}
|
207
|
+
];
|
136
208
|
|
209
|
+
// 动作定义
|
210
|
+
actions: RendererAction[] = [
|
137
211
|
{
|
138
|
-
|
212
|
+
actionType: 'clear',
|
213
|
+
actionLabel: '清空',
|
214
|
+
description: '清空输入框内容'
|
139
215
|
},
|
140
|
-
|
141
216
|
{
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
placeholder: '请输入相对值',
|
146
|
-
description:
|
147
|
-
'支持 <code>now、+1day、-2weeks</code>这种相对值用法,同时支持变量如<code>\\${start_date}</code>'
|
217
|
+
actionType: 'reset',
|
218
|
+
actionLabel: '重置',
|
219
|
+
description: '将值重置为resetValue,若没有配置resetValue,则清空'
|
148
220
|
},
|
149
|
-
|
150
221
|
{
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
collapsable: true,
|
155
|
-
className: 'fieldset',
|
156
|
-
body: [
|
157
|
-
{
|
158
|
-
type: 'input-date',
|
159
|
-
name: 'maxDate',
|
160
|
-
pipeIn: (value: any) =>
|
161
|
-
moment(
|
162
|
-
relativeValueRe.test(value) || ~['now', 'today'].indexOf(value)
|
163
|
-
? ''
|
164
|
-
: value
|
165
|
-
).format('X'),
|
166
|
-
pipeOut: (value: any, old: any, data: any) => {
|
167
|
-
return moment(parseInt(value, 10), 'X').format(data.format);
|
168
|
-
}
|
169
|
-
}
|
170
|
-
]
|
222
|
+
actionType: 'setValue',
|
223
|
+
actionLabel: '赋值',
|
224
|
+
description: '触发组件数据更新'
|
171
225
|
}
|
172
226
|
];
|
227
|
+
|
228
|
+
panelJustify = true;
|
229
|
+
|
230
|
+
panelBodyCreator = (context: BaseEventContext) => {
|
231
|
+
const renderer: any = context.info.renderer;
|
232
|
+
|
233
|
+
return getSchemaTpl('tabs', [
|
234
|
+
{
|
235
|
+
title: '属性',
|
236
|
+
body: getSchemaTpl('collapseGroup', [
|
237
|
+
{
|
238
|
+
title: '基本',
|
239
|
+
body: [
|
240
|
+
getSchemaTpl('formItemName', {
|
241
|
+
required: true
|
242
|
+
}),
|
243
|
+
getSchemaTpl('label'),
|
244
|
+
getSchemaTpl('selectDateType', {
|
245
|
+
value: this.scaffold.type,
|
246
|
+
onChange: (
|
247
|
+
value: string,
|
248
|
+
oldValue: any,
|
249
|
+
model: any,
|
250
|
+
form: any
|
251
|
+
) => {
|
252
|
+
let type: string = value.split('-')[1];
|
253
|
+
|
254
|
+
form.setValues({
|
255
|
+
inputFormat: DateType[type]?.format,
|
256
|
+
placeholder: DateType[type]?.placeholder,
|
257
|
+
format: type === 'time' ? 'HH:mm' : 'X',
|
258
|
+
minDate: '',
|
259
|
+
maxDate: '',
|
260
|
+
value: ''
|
261
|
+
});
|
262
|
+
}
|
263
|
+
}),
|
264
|
+
{
|
265
|
+
type: 'input-text',
|
266
|
+
name: 'format',
|
267
|
+
label: tipedLabel(
|
268
|
+
'值格式',
|
269
|
+
'提交数据前将根据设定格式化数据,请参考 <a href="https://momentjs.com/" target="_blank">moment</a> 中的格式用法。'
|
270
|
+
),
|
271
|
+
pipeIn: defaultValue('X')
|
272
|
+
},
|
273
|
+
{
|
274
|
+
type: 'input-text',
|
275
|
+
name: 'inputFormat',
|
276
|
+
label: tipedLabel(
|
277
|
+
'显示格式',
|
278
|
+
'请参考 <a href="https://momentjs.com/" target="_blank">moment</a> 中的格式用法。'
|
279
|
+
),
|
280
|
+
pipeIn: defaultValue('YYYY-MM-DD'),
|
281
|
+
clearable: true,
|
282
|
+
onChange: (
|
283
|
+
value: string,
|
284
|
+
oldValue: any,
|
285
|
+
model: any,
|
286
|
+
form: any
|
287
|
+
) => {
|
288
|
+
const type = form.data.type.split('-')[1];
|
289
|
+
model.setOptions(DateType[type].formatOptions);
|
290
|
+
// 时间日期类组件 input-time 需要更加关注 timeFormat 和 inputFormat 属性区别
|
291
|
+
// inputFormat 表示输入框内的显示格式; timeFormat表示选择下拉弹窗中展示"HH、mm、ss"的组合
|
292
|
+
if (type === 'time') {
|
293
|
+
const timeFormatObj = DateType[type].formatOptions.find(
|
294
|
+
item => item.value === value
|
295
|
+
);
|
296
|
+
const timeFormat = timeFormatObj
|
297
|
+
? (timeFormatObj as any).timeFormat
|
298
|
+
: 'HH:mm:ss';
|
299
|
+
form.setValues({
|
300
|
+
timeFormat: timeFormat
|
301
|
+
});
|
302
|
+
}
|
303
|
+
},
|
304
|
+
options:
|
305
|
+
DateType[this.scaffold.type.split('-')[1]].formatOptions
|
306
|
+
},
|
307
|
+
getSchemaTpl('utc'),
|
308
|
+
getSchemaTpl('clearable', {
|
309
|
+
pipeIn: defaultValue(true)
|
310
|
+
}),
|
311
|
+
getSchemaTpl('formulaControl', {
|
312
|
+
name: 'value',
|
313
|
+
label: tipedLabel(
|
314
|
+
'默认值',
|
315
|
+
'支持 <code>now、+1day、-2weeks、+1hours、+2years</code>等这种相对值用法'
|
316
|
+
),
|
317
|
+
placeholder: '请输入相对值',
|
318
|
+
inputClassName: 'is-inline'
|
319
|
+
}),
|
320
|
+
getSchemaTpl('formulaControl', {
|
321
|
+
name: 'minDate',
|
322
|
+
label: tipedLabel('最小值', tipedLabelText),
|
323
|
+
placeholder: '请输入最小值',
|
324
|
+
inputClassName: 'is-inline'
|
325
|
+
}),
|
326
|
+
getSchemaTpl('formulaControl', {
|
327
|
+
name: 'maxDate',
|
328
|
+
label: tipedLabel('最大值', tipedLabelText),
|
329
|
+
placeholder: '请输入最大值',
|
330
|
+
inputClassName: 'is-inline'
|
331
|
+
}),
|
332
|
+
getSchemaTpl('placeholder', {
|
333
|
+
pipeIn: defaultValue('请选择日期')
|
334
|
+
}),
|
335
|
+
// getSchemaTpl('remark'),
|
336
|
+
// getSchemaTpl('labelRemark'),
|
337
|
+
getSchemaTpl('description')
|
338
|
+
]
|
339
|
+
},
|
340
|
+
getSchemaTpl('status', {isFormItem: true}),
|
341
|
+
getSchemaTpl('validation', {
|
342
|
+
tag: ValidatorTag.Date
|
343
|
+
})
|
344
|
+
])
|
345
|
+
},
|
346
|
+
{
|
347
|
+
title: '外观',
|
348
|
+
body: getSchemaTpl('collapseGroup', [
|
349
|
+
getSchemaTpl('style:formItem', renderer),
|
350
|
+
getSchemaTpl('style:classNames', [
|
351
|
+
getSchemaTpl('className', {
|
352
|
+
label: '描述',
|
353
|
+
name: 'descriptionClassName',
|
354
|
+
visibleOn: 'this.description'
|
355
|
+
}),
|
356
|
+
getSchemaTpl('className', {
|
357
|
+
name: 'addOn.className',
|
358
|
+
label: 'AddOn',
|
359
|
+
visibleOn: 'this.addOn && this.addOn.type === "text"'
|
360
|
+
})
|
361
|
+
]),
|
362
|
+
getSchemaTpl('style:others', [
|
363
|
+
{
|
364
|
+
name: 'embed',
|
365
|
+
type: 'button-group-select',
|
366
|
+
size: 'md',
|
367
|
+
label: '模式',
|
368
|
+
mode: 'row',
|
369
|
+
value: false,
|
370
|
+
options: [
|
371
|
+
{
|
372
|
+
label: '浮层',
|
373
|
+
value: false
|
374
|
+
},
|
375
|
+
{
|
376
|
+
label: '内嵌',
|
377
|
+
value: true
|
378
|
+
}
|
379
|
+
]
|
380
|
+
}
|
381
|
+
])
|
382
|
+
])
|
383
|
+
},
|
384
|
+
{
|
385
|
+
title: '事件',
|
386
|
+
className: 'p-none',
|
387
|
+
body: [
|
388
|
+
getSchemaTpl('eventControl', {
|
389
|
+
name: 'onEvent',
|
390
|
+
...getEventControlConfig(this.manager, context)
|
391
|
+
})
|
392
|
+
]
|
393
|
+
}
|
394
|
+
]);
|
395
|
+
};
|
173
396
|
}
|
174
397
|
|
175
398
|
registerEditorPlugin(DateControlPlugin);
|