amis 1.6.2 → 1.6.3
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/lib/Schema.d.ts +3 -2
- package/lib/Schema.js.map +1 -1
- package/lib/components/CalendarMobile.d.ts +84 -84
- package/lib/components/Card.d.ts +20 -20
- package/lib/components/Collapse.js +3 -2
- package/lib/components/Collapse.js.map +2 -2
- package/lib/components/ColorPicker.d.ts +84 -84
- package/lib/components/ColorPicker.js +1 -1
- package/lib/components/ColorPicker.js.map +2 -2
- package/lib/components/DatePicker.d.ts +84 -84
- package/lib/components/DatePicker.js +1 -1
- package/lib/components/DatePicker.js.map +2 -2
- package/lib/components/DateRangePicker.d.ts +84 -84
- package/lib/components/DateRangePicker.js +2 -2
- package/lib/components/DateRangePicker.js.map +2 -2
- package/lib/components/Editor.d.ts +84 -84
- package/lib/components/ListGroup.d.ts +21 -21
- package/lib/components/LocationPicker.d.ts +84 -84
- package/lib/components/LocationPicker.js +1 -1
- package/lib/components/LocationPicker.js.map +2 -2
- package/lib/components/MonthRangePicker.d.ts +84 -84
- package/lib/components/PickerContainer.d.ts +1 -0
- package/lib/components/PickerContainer.js +2 -2
- package/lib/components/PickerContainer.js.map +2 -2
- package/lib/components/ResultBox.js +1 -1
- package/lib/components/ResultBox.js.map +2 -2
- package/lib/components/Select.d.ts +237 -237
- package/lib/components/Tabs.d.ts +3 -2
- package/lib/components/Tabs.js.map +2 -2
- package/lib/components/calendar/Calendar.js +1 -2
- package/lib/components/calendar/Calendar.js.map +2 -2
- package/lib/components/condition-builder/Expression.d.ts +2 -0
- package/lib/components/condition-builder/Expression.js +2 -2
- package/lib/components/condition-builder/Expression.js.map +2 -2
- package/lib/components/condition-builder/Group.d.ts +3 -0
- package/lib/components/condition-builder/Group.js +3 -3
- package/lib/components/condition-builder/Group.js.map +2 -2
- package/lib/components/condition-builder/GroupOrItem.d.ts +2 -0
- package/lib/components/condition-builder/GroupOrItem.js +2 -2
- package/lib/components/condition-builder/GroupOrItem.js.map +2 -2
- package/lib/components/condition-builder/Item.d.ts +2 -0
- package/lib/components/condition-builder/Item.js +4 -4
- package/lib/components/condition-builder/Item.js.map +2 -2
- package/lib/components/condition-builder/Value.d.ts +2 -0
- package/lib/components/condition-builder/Value.js +15 -2
- package/lib/components/condition-builder/Value.js.map +2 -2
- package/lib/components/condition-builder/index.d.ts +3 -0
- package/lib/components/condition-builder/index.js +2 -2
- package/lib/components/condition-builder/index.js.map +2 -2
- package/lib/components/formula/Editor.d.ts +88 -84
- package/lib/components/formula/Editor.js +22 -25
- package/lib/components/formula/Editor.js.map +2 -2
- package/lib/components/formula/FuncList.d.ts +3 -0
- package/lib/components/formula/FuncList.js +19 -9
- package/lib/components/formula/FuncList.js.map +2 -2
- package/lib/components/formula/Picker.d.ts +44 -0
- package/lib/components/formula/Picker.js +33 -8
- package/lib/components/formula/Picker.js.map +2 -2
- package/lib/components/formula/VariableList.d.ts +8 -1
- package/lib/components/formula/VariableList.js +13 -4
- package/lib/components/formula/VariableList.js.map +2 -2
- package/lib/components/icons.d.ts +3 -1
- package/lib/components/icons.js +7 -1
- package/lib/components/icons.js.map +2 -2
- package/lib/env.d.ts +4 -0
- package/lib/env.js.map +2 -2
- package/lib/factory.d.ts +4 -0
- package/lib/factory.js +5 -1
- package/lib/factory.js.map +2 -2
- package/lib/helper.css.map +1 -1
- package/lib/icons/function.js +7 -0
- package/lib/icons/input-clear.js +7 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +2 -1
- package/lib/index.js.map +2 -2
- package/lib/locale/de-DE.js +8 -1
- package/lib/locale/de-DE.js.map +2 -2
- package/lib/locale/en-US.js +5 -1
- package/lib/locale/en-US.js.map +2 -2
- package/lib/locale/zh-CN.js +8 -1
- package/lib/locale/zh-CN.js.map +2 -2
- package/lib/renderers/Breadcrumb.js.map +2 -2
- package/lib/renderers/CRUD.js +4 -3
- package/lib/renderers/CRUD.js.map +2 -2
- package/lib/renderers/Calendar.d.ts +45 -0
- package/lib/renderers/Calendar.js +21 -0
- package/lib/renderers/Calendar.js.map +13 -0
- package/lib/renderers/Card.js +2 -2
- package/lib/renderers/Card.js.map +2 -2
- package/lib/renderers/Form/ConditionBuilder.d.ts +8 -0
- package/lib/renderers/Form/ConditionBuilder.js.map +2 -2
- package/lib/renderers/Form/IconPicker.d.ts +2 -0
- package/lib/renderers/Form/IconPicker.js +22 -2
- package/lib/renderers/Form/IconPicker.js.map +2 -2
- package/lib/renderers/Form/InputCity.d.ts +84 -84
- package/lib/renderers/Form/InputColor.d.ts +84 -84
- package/lib/renderers/Form/InputColor.js +1 -1
- package/lib/renderers/Form/InputColor.js.map +2 -2
- package/lib/renderers/Form/InputDate.d.ts +0 -18
- package/lib/renderers/Form/InputDate.js +1 -1
- package/lib/renderers/Form/InputDate.js.map +2 -2
- package/lib/renderers/Form/InputDateRange.js +1 -1
- package/lib/renderers/Form/InputDateRange.js.map +2 -2
- package/lib/renderers/Form/InputFormula.d.ts +42 -0
- package/lib/renderers/Form/InputFormula.js +6 -2
- package/lib/renderers/Form/InputFormula.js.map +2 -2
- package/lib/renderers/Form/InputText.d.ts +5 -0
- package/lib/renderers/Form/InputText.js +22 -4
- package/lib/renderers/Form/InputText.js.map +2 -2
- package/lib/renderers/Form/Picker.js +1 -1
- package/lib/renderers/Form/Picker.js.map +2 -2
- package/lib/renderers/Form/Textarea.d.ts +12 -0
- package/lib/renderers/Form/Textarea.js +31 -15
- package/lib/renderers/Form/Textarea.js.map +2 -2
- package/lib/renderers/Form/Transfer.d.ts +1 -1
- package/lib/renderers/Form/Transfer.js +7 -1
- package/lib/renderers/Form/Transfer.js.map +2 -2
- package/lib/renderers/Form/index.js +4 -0
- package/lib/renderers/Form/index.js.map +2 -2
- package/lib/renderers/IFrame.js +8 -3
- package/lib/renderers/IFrame.js.map +2 -2
- package/lib/renderers/Tpl.js +1 -1
- package/lib/renderers/Tpl.js.map +2 -2
- package/lib/schemaExtend.js +11 -8
- package/lib/schemaExtend.js.map +2 -2
- package/lib/themes/ang-ie11.css +427 -141
- package/lib/themes/ang.css +427 -141
- package/lib/themes/ang.css.map +1 -1
- package/lib/themes/antd-ie11.css +427 -141
- package/lib/themes/antd.css +427 -141
- package/lib/themes/antd.css.map +1 -1
- package/lib/themes/cxd-ie11.css +432 -152
- package/lib/themes/cxd.css +432 -152
- package/lib/themes/cxd.css.map +1 -1
- package/lib/themes/dark-ie11.css +427 -141
- package/lib/themes/dark.css +427 -141
- package/lib/themes/dark.css.map +1 -1
- package/lib/themes/default.css +432 -152
- package/lib/themes/default.css.map +1 -1
- package/lib/utils/api.js +22 -9
- package/lib/utils/api.js.map +2 -2
- package/lib/utils/helper.d.ts +1 -0
- package/lib/utils/helper.js +10 -1
- package/lib/utils/helper.js.map +2 -2
- package/package.json +2 -2
- package/schema.json +201 -66
- package/scss/_mixins.scss +10 -5
- package/scss/_properties.scss +11 -0
- package/scss/components/_collapse-group.scss +4 -0
- package/scss/components/_condition-builder.scss +8 -1
- package/scss/components/_formula.scss +247 -74
- package/scss/components/_result-box.scss +0 -13
- package/scss/components/form/_color.scss +0 -2
- package/scss/components/form/_date-range.scss +14 -7
- package/scss/components/form/_date.scss +14 -7
- package/scss/components/form/_form.scss +1 -0
- package/scss/components/form/_icon-picker.scss +2 -0
- package/scss/components/form/_location.scss +0 -1
- package/scss/components/form/_picker.scss +0 -1
- package/scss/components/form/_text.scss +6 -7
- package/scss/components/form/_textarea.scss +16 -0
- package/scss/components/form/_transfer.scss +2 -1
- package/scss/themes/_cxd-variables.scss +5 -3
- package/scss/themes/cxd.scss +0 -13
- package/sdk/ang-ie11.css +467 -126
- package/sdk/ang.css +486 -141
- package/sdk/antd-ie11.css +467 -126
- package/sdk/antd.css +486 -141
- package/sdk/charts.js +17 -17
- package/sdk/codemirror.js +7 -7
- package/sdk/color-picker.js +65 -69
- package/sdk/cropperjs.js +3 -3
- package/sdk/cxd-ie11.css +474 -142
- package/sdk/cxd.css +491 -153
- package/sdk/dark-ie11.css +467 -126
- package/sdk/dark.css +486 -141
- package/sdk/exceljs.js +1 -1
- package/sdk/helper.css.map +1 -1
- package/sdk/locale/de-DE.js +8 -1
- package/sdk/markdown.js +69 -69
- package/sdk/papaparse.js +1 -1
- package/sdk/renderers/Form/CityDB.js +1 -1
- package/sdk/rest.js +20 -16
- package/sdk/rich-text.js +62 -62
- package/sdk/sdk-ie11.css +474 -142
- package/sdk/sdk.css +491 -153
- package/sdk/sdk.js +1351 -1273
- package/sdk/thirds/hls.js/hls.js +18 -18
- package/sdk/thirds/mpegts.js/mpegts.js +2 -2
- package/sdk/tinymce.js +57 -57
- package/src/Schema.ts +3 -0
- package/src/components/Collapse.tsx +4 -1
- package/src/components/ColorPicker.tsx +1 -1
- package/src/components/DatePicker.tsx +1 -1
- package/src/components/DateRangePicker.tsx +2 -2
- package/src/components/LocationPicker.tsx +1 -1
- package/src/components/PickerContainer.tsx +3 -1
- package/src/components/ResultBox.tsx +1 -1
- package/src/components/Tabs.tsx +4 -2
- package/src/components/calendar/Calendar.tsx +1 -2
- package/src/components/condition-builder/Expression.tsx +5 -2
- package/src/components/condition-builder/Group.tsx +8 -2
- package/src/components/condition-builder/GroupOrItem.tsx +5 -1
- package/src/components/condition-builder/Item.tsx +7 -1
- package/src/components/condition-builder/Value.tsx +17 -4
- package/src/components/condition-builder/index.tsx +8 -1
- package/src/components/formula/Editor.tsx +43 -23
- package/src/components/formula/FuncList.tsx +74 -44
- package/src/components/formula/Picker.tsx +161 -23
- package/src/components/formula/VariableList.tsx +54 -9
- package/src/components/icons.tsx +7 -1
- package/src/env.tsx +5 -0
- package/src/factory.tsx +9 -1
- package/src/icons/function.svg +4 -0
- package/src/icons/input-clear.svg +1 -0
- package/src/index.tsx +1 -0
- package/src/locale/de-DE.ts +8 -1
- package/src/locale/en-US.ts +5 -1
- package/src/locale/zh-CN.ts +8 -1
- package/src/renderers/Breadcrumb.tsx +0 -1
- package/src/renderers/CRUD.tsx +6 -3
- package/src/renderers/Calendar.tsx +43 -0
- package/src/renderers/Card.tsx +12 -2
- package/src/renderers/Form/ConditionBuilder.tsx +11 -0
- package/src/renderers/Form/IconPicker.tsx +29 -0
- package/src/renderers/Form/InputColor.tsx +1 -1
- package/src/renderers/Form/InputDate.tsx +1 -21
- package/src/renderers/Form/InputDateRange.tsx +1 -1
- package/src/renderers/Form/InputFormula.tsx +103 -3
- package/src/renderers/Form/InputText.tsx +30 -5
- package/src/renderers/Form/Picker.tsx +1 -1
- package/src/renderers/Form/Textarea.tsx +46 -22
- package/src/renderers/Form/Transfer.tsx +6 -1
- package/src/renderers/Form/index.tsx +16 -1
- package/src/renderers/IFrame.tsx +8 -10
- package/src/renderers/Tpl.tsx +3 -1
- package/src/schemaExtend.ts +11 -7
- package/src/utils/api.ts +25 -10
- package/src/utils/helper.ts +11 -1
@@ -0,0 +1,43 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import {Renderer} from '../factory';
|
3
|
+
import {SchemaObject, BaseSchema} from '../Schema';
|
4
|
+
import {DateControlRenderer} from './Form/InputDate';
|
5
|
+
|
6
|
+
interface scheduleItem {
|
7
|
+
startTime: string;
|
8
|
+
endTime: string;
|
9
|
+
content: any;
|
10
|
+
className?: string;
|
11
|
+
}
|
12
|
+
|
13
|
+
export interface CalendarSchema extends BaseSchema {
|
14
|
+
/**
|
15
|
+
* 指定为日历选择控件
|
16
|
+
*/
|
17
|
+
type: 'calendar';
|
18
|
+
|
19
|
+
/**
|
20
|
+
* 日程
|
21
|
+
*/
|
22
|
+
schedules?: Array<scheduleItem> | string;
|
23
|
+
|
24
|
+
/**
|
25
|
+
* 日程显示颜色自定义
|
26
|
+
*/
|
27
|
+
scheduleClassNames?: Array<string>;
|
28
|
+
|
29
|
+
/**
|
30
|
+
* 日程点击展示
|
31
|
+
*/
|
32
|
+
scheduleAction?: SchemaObject;
|
33
|
+
}
|
34
|
+
|
35
|
+
@Renderer({
|
36
|
+
type: 'calendar'
|
37
|
+
})
|
38
|
+
export class CalendarRenderer extends DateControlRenderer {
|
39
|
+
static defaultProps = {
|
40
|
+
...DateControlRenderer.defaultProps,
|
41
|
+
embed: true
|
42
|
+
}
|
43
|
+
}
|
package/src/renderers/Card.tsx
CHANGED
@@ -282,7 +282,17 @@ export class CardRenderer extends React.Component<CardProps> {
|
|
282
282
|
}
|
283
283
|
|
284
284
|
handleClick(e: React.MouseEvent<HTMLDivElement>) {
|
285
|
-
const {
|
285
|
+
const {
|
286
|
+
item,
|
287
|
+
href,
|
288
|
+
data,
|
289
|
+
env,
|
290
|
+
blank,
|
291
|
+
itemAction,
|
292
|
+
onAction,
|
293
|
+
onCheck,
|
294
|
+
selectable
|
295
|
+
} = this.props;
|
286
296
|
|
287
297
|
if (href) {
|
288
298
|
env.jumpTo(filter(href, data), {
|
@@ -298,7 +308,7 @@ export class CardRenderer extends React.Component<CardProps> {
|
|
298
308
|
return;
|
299
309
|
}
|
300
310
|
|
301
|
-
|
311
|
+
selectable && onCheck?.(item);
|
302
312
|
}
|
303
313
|
|
304
314
|
handleAction(e: React.UIEvent<any>, action: Action, ctx: object) {
|
@@ -4,6 +4,7 @@ import {Funcs, Fields} from '../../components/condition-builder/types';
|
|
4
4
|
import {Config} from '../../components/condition-builder/config';
|
5
5
|
import ConditionBuilder from '../../components/condition-builder/index';
|
6
6
|
import {SchemaApi, SchemaTokenizeableString} from '../../Schema';
|
7
|
+
import FormulaPicker from '../../components/formula/Picker';
|
7
8
|
import {
|
8
9
|
RemoteOptionsProps,
|
9
10
|
withRemoteConfig
|
@@ -38,6 +39,16 @@ export interface ConditionBuilderControlSchema extends FormBaseControl {
|
|
38
39
|
* 通过远程拉取配置项
|
39
40
|
*/
|
40
41
|
source?: SchemaApi | SchemaTokenizeableString;
|
42
|
+
|
43
|
+
/**
|
44
|
+
* 展现模式
|
45
|
+
*/
|
46
|
+
builderMode?: 'simple' | 'full';
|
47
|
+
|
48
|
+
/**
|
49
|
+
* 是否显示并或切换键按钮,只在简单模式下有用
|
50
|
+
*/
|
51
|
+
showANDOR?: boolean;
|
41
52
|
}
|
42
53
|
|
43
54
|
export interface ConditionBuilderProps
|
@@ -7,6 +7,7 @@ import {autobind} from '../../utils/helper';
|
|
7
7
|
import {ICONS} from './IconPickerIcons';
|
8
8
|
import {FormItem, FormControlProps, FormBaseControl} from './Item';
|
9
9
|
import {Option} from '../../components/Select';
|
10
|
+
import {Icon} from '../../components/icons';
|
10
11
|
|
11
12
|
/**
|
12
13
|
* 图标选择器
|
@@ -22,6 +23,7 @@ export interface IconPickerProps extends FormControlProps {
|
|
22
23
|
placeholder?: string;
|
23
24
|
resetValue?: any;
|
24
25
|
noDataTip?: string;
|
26
|
+
clearable?: boolean;
|
25
27
|
}
|
26
28
|
|
27
29
|
export interface IconPickerState {
|
@@ -210,6 +212,23 @@ export default class IconPickerControl extends React.PureComponent<
|
|
210
212
|
}
|
211
213
|
}
|
212
214
|
|
215
|
+
@autobind
|
216
|
+
handleClear() {
|
217
|
+
const {onChange, resetValue} = this.props;
|
218
|
+
|
219
|
+
onChange?.(resetValue);
|
220
|
+
|
221
|
+
this.setState(
|
222
|
+
{
|
223
|
+
inputValue: resetValue,
|
224
|
+
isFocused: true
|
225
|
+
},
|
226
|
+
() => {
|
227
|
+
this.focus();
|
228
|
+
}
|
229
|
+
);
|
230
|
+
}
|
231
|
+
|
213
232
|
renderFontIcons() {
|
214
233
|
const {
|
215
234
|
className,
|
@@ -220,6 +239,7 @@ export default class IconPickerControl extends React.PureComponent<
|
|
220
239
|
value,
|
221
240
|
noDataTip,
|
222
241
|
disabled,
|
242
|
+
clearable,
|
223
243
|
translate: __
|
224
244
|
} = this.props;
|
225
245
|
const options = this.formatOptions();
|
@@ -278,6 +298,15 @@ export default class IconPickerControl extends React.PureComponent<
|
|
278
298
|
disabled={disabled}
|
279
299
|
size={10}
|
280
300
|
/>
|
301
|
+
|
302
|
+
{clearable && !disabled && value ? (
|
303
|
+
<a
|
304
|
+
onClick={this.handleClear}
|
305
|
+
className={cx('IconPickerControl-clear')}
|
306
|
+
>
|
307
|
+
<Icon icon="input-clear" className="icon" />
|
308
|
+
</a>
|
309
|
+
) : null}
|
281
310
|
</div>
|
282
311
|
{isOpen ? (
|
283
312
|
<div className={cx('IconPickerControl-sugsPanel')}>
|
@@ -91,26 +91,6 @@ export interface DateControlSchema extends InputDateBaseControlSchema {
|
|
91
91
|
* 限制最大日期
|
92
92
|
*/
|
93
93
|
maxDate?: string;
|
94
|
-
|
95
|
-
/**
|
96
|
-
* 日程
|
97
|
-
*/
|
98
|
-
schedules?:
|
99
|
-
| Array<{
|
100
|
-
startTime: Date;
|
101
|
-
endTime: Date;
|
102
|
-
content: any;
|
103
|
-
className?: string;
|
104
|
-
}>
|
105
|
-
| string;
|
106
|
-
/**
|
107
|
-
* 日程显示颜色自定义
|
108
|
-
*/
|
109
|
-
scheduleClassNames?: Array<string>;
|
110
|
-
/**
|
111
|
-
* 日程点击展示
|
112
|
-
*/
|
113
|
-
scheduleAction?: SchemaObject;
|
114
94
|
}
|
115
95
|
|
116
96
|
/**
|
@@ -465,7 +445,7 @@ export default class DateControl extends React.PureComponent<
|
|
465
445
|
popOverContainer={
|
466
446
|
mobileUI && env && env.getModalContainer
|
467
447
|
? env.getModalContainer
|
468
|
-
:
|
448
|
+
: rest.popOverContainer
|
469
449
|
}
|
470
450
|
timeFormat={timeFormat}
|
471
451
|
format={valueFormat || format}
|
@@ -187,7 +187,7 @@ export default class DateRangeControl extends React.Component<DateRangeProps> {
|
|
187
187
|
popOverContainer={
|
188
188
|
mobileUI && env && env.getModalContainer
|
189
189
|
? env.getModalContainer
|
190
|
-
:
|
190
|
+
: rest.popOverContainer
|
191
191
|
}
|
192
192
|
data={data}
|
193
193
|
format={format}
|
@@ -1,7 +1,14 @@
|
|
1
1
|
import React from 'react';
|
2
|
+
|
3
|
+
import ResultBox from '../../components/ResultBox';
|
4
|
+
import Spinner from '../../components/Spinner';
|
5
|
+
import {SchemaApi, SchemaTokenizeableString} from '../../Schema';
|
2
6
|
import FormItem, {FormBaseControl, FormControlProps} from './Item';
|
3
7
|
import FormulaPicker from '../../components/formula/Picker';
|
8
|
+
import {autobind} from '../../utils/helper';
|
9
|
+
|
4
10
|
import type {FuncGroup, VariableItem} from '../../components/formula/Editor';
|
11
|
+
import type {SchemaIcon} from '../../Schema';
|
5
12
|
|
6
13
|
/**
|
7
14
|
* InputFormula 公式编辑器
|
@@ -33,10 +40,68 @@ export interface InputFormulaControlSchema extends FormBaseControl {
|
|
33
40
|
*/
|
34
41
|
functions: Array<FuncGroup>;
|
35
42
|
|
43
|
+
/**
|
44
|
+
* 编辑器标题
|
45
|
+
*/
|
46
|
+
title?: string;
|
47
|
+
|
36
48
|
/**
|
37
49
|
* 顶部标题,默认为表达式
|
38
50
|
*/
|
39
51
|
header: string;
|
52
|
+
|
53
|
+
/**
|
54
|
+
* 控件模式
|
55
|
+
*/
|
56
|
+
inputMode?: 'button' | 'input-button';
|
57
|
+
|
58
|
+
/**
|
59
|
+
* 按钮图标
|
60
|
+
*/
|
61
|
+
icon?: SchemaIcon;
|
62
|
+
|
63
|
+
/**
|
64
|
+
* 按钮Label,inputMode为button时生效
|
65
|
+
*/
|
66
|
+
btnLabel?: string;
|
67
|
+
|
68
|
+
/**
|
69
|
+
* 按钮样式
|
70
|
+
*/
|
71
|
+
level?:
|
72
|
+
| 'info'
|
73
|
+
| 'success'
|
74
|
+
| 'warning'
|
75
|
+
| 'danger'
|
76
|
+
| 'link'
|
77
|
+
| 'primary'
|
78
|
+
| 'dark'
|
79
|
+
| 'light';
|
80
|
+
|
81
|
+
/**
|
82
|
+
* 按钮大小
|
83
|
+
*/
|
84
|
+
btnSize?: 'xs' | 'sm' | 'md' | 'lg';
|
85
|
+
|
86
|
+
/**
|
87
|
+
* 边框模式,全边框,还是半边框,或者没边框。
|
88
|
+
*/
|
89
|
+
borderMode?: 'full' | 'half' | 'none';
|
90
|
+
|
91
|
+
/**
|
92
|
+
* 输入框占位符
|
93
|
+
*/
|
94
|
+
placeholder?: string;
|
95
|
+
|
96
|
+
/**
|
97
|
+
* 变量面板CSS样式类名
|
98
|
+
*/
|
99
|
+
variableClassName?: string;
|
100
|
+
|
101
|
+
/**
|
102
|
+
* 函数面板CSS样式类名
|
103
|
+
*/
|
104
|
+
functionClassName?: string;
|
40
105
|
}
|
41
106
|
|
42
107
|
export interface InputFormulaProps
|
@@ -50,8 +115,16 @@ export interface InputFormulaProps
|
|
50
115
|
type: 'input-formula'
|
51
116
|
})
|
52
117
|
export class InputFormulaRenderer extends React.Component<InputFormulaProps> {
|
118
|
+
static defaultProps: Pick<
|
119
|
+
InputFormulaControlSchema,
|
120
|
+
'inputMode' | 'borderMode'
|
121
|
+
> = {
|
122
|
+
inputMode: 'input-button',
|
123
|
+
borderMode: 'full'
|
124
|
+
};
|
125
|
+
|
53
126
|
render() {
|
54
|
-
|
127
|
+
let {
|
55
128
|
selectedOptions,
|
56
129
|
disabled,
|
57
130
|
onChange,
|
@@ -61,11 +134,26 @@ export class InputFormulaRenderer extends React.Component<InputFormulaProps> {
|
|
61
134
|
functions,
|
62
135
|
header,
|
63
136
|
label,
|
64
|
-
value
|
137
|
+
value,
|
138
|
+
clearable,
|
139
|
+
className,
|
140
|
+
classPrefix: ns,
|
141
|
+
classnames: cx,
|
142
|
+
borderMode,
|
143
|
+
placeholder,
|
144
|
+
inputMode,
|
145
|
+
btnLabel,
|
146
|
+
level,
|
147
|
+
btnSize,
|
148
|
+
icon,
|
149
|
+
title,
|
150
|
+
variableClassName,
|
151
|
+
functionClassName,
|
152
|
+
data
|
65
153
|
} = this.props;
|
66
|
-
|
67
154
|
return (
|
68
155
|
<FormulaPicker
|
156
|
+
className={className}
|
69
157
|
value={value}
|
70
158
|
disabled={disabled}
|
71
159
|
onChange={onChange}
|
@@ -74,6 +162,18 @@ export class InputFormulaRenderer extends React.Component<InputFormulaProps> {
|
|
74
162
|
variableMode={variableMode}
|
75
163
|
functions={functions}
|
76
164
|
header={header || label || ''}
|
165
|
+
borderMode={borderMode}
|
166
|
+
placeholder={placeholder}
|
167
|
+
mode={inputMode}
|
168
|
+
btnLabel={btnLabel}
|
169
|
+
level={level}
|
170
|
+
btnSize={btnSize}
|
171
|
+
icon={icon}
|
172
|
+
title={title}
|
173
|
+
clearable={clearable}
|
174
|
+
variableClassName={variableClassName}
|
175
|
+
functionClassName={functionClassName}
|
176
|
+
data={data}
|
77
177
|
/>
|
78
178
|
);
|
79
179
|
}
|
@@ -85,6 +85,10 @@ export interface TextProps extends OptionsControlProps {
|
|
85
85
|
autoComplete?: any;
|
86
86
|
allowInputText?: boolean;
|
87
87
|
spinnerClassName: string;
|
88
|
+
transform?: {
|
89
|
+
lowerCase?: boolean; // 用户输入的字符自动转小写
|
90
|
+
upperCase?: boolean; // 用户输入的字符自动转大写
|
91
|
+
};
|
88
92
|
}
|
89
93
|
|
90
94
|
export interface TextState {
|
@@ -459,12 +463,33 @@ export default class TextControl extends React.PureComponent<
|
|
459
463
|
|
460
464
|
let value = e.currentTarget.value;
|
461
465
|
|
462
|
-
onChange(value);
|
466
|
+
onChange(this.transformValue(value));
|
467
|
+
}
|
468
|
+
|
469
|
+
transformValue(value: string) {
|
470
|
+
const {transform} = this.props;
|
471
|
+
|
472
|
+
if (!transform) {
|
473
|
+
return value;
|
474
|
+
}
|
475
|
+
|
476
|
+
Object.keys(transform).forEach((key: 'lowerCase' | 'upperCase') => {
|
477
|
+
const propValue = transform[key];
|
478
|
+
switch (key) {
|
479
|
+
case 'lowerCase':
|
480
|
+
propValue && (value = value.toLowerCase());
|
481
|
+
break;
|
482
|
+
case 'upperCase':
|
483
|
+
propValue && (value = value.toUpperCase());
|
484
|
+
break;
|
485
|
+
}
|
486
|
+
});
|
487
|
+
|
488
|
+
return value;
|
463
489
|
}
|
464
490
|
|
465
491
|
loadAutoComplete() {
|
466
|
-
const {formItem, autoComplete, data
|
467
|
-
this.props;
|
492
|
+
const {formItem, autoComplete, data} = this.props;
|
468
493
|
|
469
494
|
if (isEffectiveApi(autoComplete, data) && formItem) {
|
470
495
|
formItem.loadOptions(
|
@@ -609,7 +634,7 @@ export default class TextControl extends React.PureComponent<
|
|
609
634
|
onClick={this.clearValue}
|
610
635
|
className={cx('TextControl-clear')}
|
611
636
|
>
|
612
|
-
<Icon icon="
|
637
|
+
<Icon icon="input-clear" className="icon" />
|
613
638
|
</a>
|
614
639
|
) : null}
|
615
640
|
|
@@ -715,7 +740,7 @@ export default class TextControl extends React.PureComponent<
|
|
715
740
|
/>
|
716
741
|
{clearable && !disabled && value ? (
|
717
742
|
<a onClick={this.clearValue} className={`${ns}TextControl-clear`}>
|
718
|
-
<Icon icon="
|
743
|
+
<Icon icon="input-clear" className="icon" />
|
719
744
|
</a>
|
720
745
|
) : null}
|
721
746
|
{showCounter ? (
|
@@ -469,7 +469,7 @@ export default class PickerControl extends React.PureComponent<
|
|
469
469
|
|
470
470
|
{clearable && !disabled && selectedOptions.length ? (
|
471
471
|
<a onClick={this.clearValue} className={cx('Picker-clear')}>
|
472
|
-
<Icon icon="
|
472
|
+
<Icon icon="input-clear" className="icon" />
|
473
473
|
</a>
|
474
474
|
) : null}
|
475
475
|
|
@@ -2,6 +2,7 @@ import React from 'react';
|
|
2
2
|
import {FormItem, FormControlProps, FormBaseControl} from './Item';
|
3
3
|
import cx from 'classnames';
|
4
4
|
import Textarea from '../../components/Textarea';
|
5
|
+
import {Icon} from '../../components/icons';
|
5
6
|
import {findDOMNode} from 'react-dom';
|
6
7
|
import {autobind, ucFirst} from '../../utils/helper';
|
7
8
|
/**
|
@@ -43,12 +44,24 @@ export interface TextareaControlSchema extends FormBaseControl {
|
|
43
44
|
* 是否显示计数
|
44
45
|
*/
|
45
46
|
showCounter?: boolean;
|
47
|
+
|
48
|
+
/**
|
49
|
+
* 输入内容是否可清除
|
50
|
+
*/
|
51
|
+
clearable?: boolean;
|
52
|
+
|
53
|
+
/**
|
54
|
+
* 重置值
|
55
|
+
*/
|
56
|
+
resetValue?: string;
|
46
57
|
}
|
47
58
|
|
48
59
|
export interface TextAreaProps extends FormControlProps {
|
49
60
|
placeholder?: string;
|
50
61
|
minRows?: number;
|
51
62
|
maxRows?: number;
|
63
|
+
clearable?: boolean;
|
64
|
+
resetValue?: string;
|
52
65
|
}
|
53
66
|
|
54
67
|
export default class TextAreaControl extends React.Component<
|
@@ -58,7 +71,9 @@ export default class TextAreaControl extends React.Component<
|
|
58
71
|
static defaultProps: Partial<TextAreaProps> = {
|
59
72
|
minRows: 3,
|
60
73
|
maxRows: 20,
|
61
|
-
trimContents: true
|
74
|
+
trimContents: true,
|
75
|
+
resetValue: '',
|
76
|
+
clearable: false
|
62
77
|
};
|
63
78
|
|
64
79
|
state = {
|
@@ -68,6 +83,14 @@ export default class TextAreaControl extends React.Component<
|
|
68
83
|
input?: HTMLInputElement;
|
69
84
|
inputRef = (ref: any) => (this.input = findDOMNode(ref) as HTMLInputElement);
|
70
85
|
|
86
|
+
valueToString(value: any) {
|
87
|
+
return typeof value === 'undefined' || value === null
|
88
|
+
? ''
|
89
|
+
: typeof value === 'string'
|
90
|
+
? value
|
91
|
+
: JSON.stringify(value);
|
92
|
+
}
|
93
|
+
|
71
94
|
focus() {
|
72
95
|
if (!this.input) {
|
73
96
|
return;
|
@@ -132,6 +155,14 @@ export default class TextAreaControl extends React.Component<
|
|
132
155
|
);
|
133
156
|
}
|
134
157
|
|
158
|
+
@autobind
|
159
|
+
handleClear() {
|
160
|
+
const {onChange, resetValue} = this.props;
|
161
|
+
|
162
|
+
onChange?.(resetValue);
|
163
|
+
this.focus();
|
164
|
+
}
|
165
|
+
|
135
166
|
render() {
|
136
167
|
const {
|
137
168
|
className,
|
@@ -147,17 +178,10 @@ export default class TextAreaControl extends React.Component<
|
|
147
178
|
borderMode,
|
148
179
|
classnames: cx,
|
149
180
|
maxLength,
|
150
|
-
showCounter
|
181
|
+
showCounter,
|
182
|
+
clearable
|
151
183
|
} = this.props;
|
152
|
-
|
153
|
-
let counter = showCounter
|
154
|
-
? (typeof value === 'undefined' || value === null
|
155
|
-
? ''
|
156
|
-
: typeof value === 'string'
|
157
|
-
? value
|
158
|
-
: JSON.stringify(value)
|
159
|
-
).length
|
160
|
-
: 0;
|
184
|
+
const counter = showCounter ? this.valueToString(value).length : 0;
|
161
185
|
|
162
186
|
return (
|
163
187
|
<div
|
@@ -175,13 +199,7 @@ export default class TextAreaControl extends React.Component<
|
|
175
199
|
ref={this.inputRef}
|
176
200
|
name={name}
|
177
201
|
disabled={disabled}
|
178
|
-
value={
|
179
|
-
typeof value === 'undefined' || value === null
|
180
|
-
? ''
|
181
|
-
: typeof value === 'string'
|
182
|
-
? value
|
183
|
-
: JSON.stringify(value)
|
184
|
-
}
|
202
|
+
value={this.valueToString(value)}
|
185
203
|
placeholder={placeholder}
|
186
204
|
autoCorrect="off"
|
187
205
|
spellCheck="false"
|
@@ -193,12 +211,18 @@ export default class TextAreaControl extends React.Component<
|
|
193
211
|
onBlur={this.handleBlur}
|
194
212
|
/>
|
195
213
|
|
214
|
+
{clearable && !disabled && value ? (
|
215
|
+
<a onClick={this.handleClear} className={cx('TextareaControl-clear')}>
|
216
|
+
<Icon icon="input-clear" className="icon" />
|
217
|
+
</a>
|
218
|
+
) : null}
|
219
|
+
|
196
220
|
{showCounter ? (
|
197
221
|
<span
|
198
|
-
className={cx(
|
199
|
-
'
|
200
|
-
|
201
|
-
)}
|
222
|
+
className={cx('TextareaControl-counter', {
|
223
|
+
'is-empty': counter === 0,
|
224
|
+
'is-clearable': clearable && !disabled && value
|
225
|
+
})}
|
202
226
|
>
|
203
227
|
{`${counter}${
|
204
228
|
typeof maxLength === 'number' && maxLength ? `/${maxLength}` : ''
|
@@ -128,7 +128,7 @@ export class BaseTransferRenderer<
|
|
128
128
|
T extends OptionsControlProps = BaseTransferProps
|
129
129
|
> extends React.Component<T> {
|
130
130
|
@autobind
|
131
|
-
handleChange(value: Array<Option
|
131
|
+
handleChange(value: Array<Option> | Option, optionModified?: boolean) {
|
132
132
|
const {
|
133
133
|
onChange,
|
134
134
|
joinValues,
|
@@ -169,6 +169,11 @@ export class BaseTransferRenderer<
|
|
169
169
|
if (joinValues) {
|
170
170
|
newValue = newValue.join(delimiter || ',');
|
171
171
|
}
|
172
|
+
} else if (value) {
|
173
|
+
newValue =
|
174
|
+
joinValues || extractValue
|
175
|
+
? value[(valueField as string) || 'value']
|
176
|
+
: value;
|
172
177
|
}
|
173
178
|
|
174
179
|
(newOptions.length > options.length || optionModified) &&
|
@@ -19,7 +19,8 @@ import {
|
|
19
19
|
isEmpty,
|
20
20
|
getVariable,
|
21
21
|
isObjectShallowModified,
|
22
|
-
qsparse
|
22
|
+
qsparse,
|
23
|
+
repeatCount
|
23
24
|
} from '../../utils/helper';
|
24
25
|
import debouce from 'lodash/debounce';
|
25
26
|
import flatten from 'lodash/flatten';
|
@@ -1454,6 +1455,18 @@ export default class Form extends React.Component<FormProps, object> {
|
|
1454
1455
|
this.props.wrapperComponent ||
|
1455
1456
|
(/(?:\/|^)form\//.test($path as string) ? 'div' : 'form');
|
1456
1457
|
|
1458
|
+
const padDom = repeatCount(
|
1459
|
+
columnCount && Array.isArray(body)
|
1460
|
+
? columnCount - (body.length % columnCount)
|
1461
|
+
: 0,
|
1462
|
+
index => (
|
1463
|
+
<div
|
1464
|
+
className={cx(`Form-item Form-item--${mode} is-placeholder`)}
|
1465
|
+
key={index}
|
1466
|
+
></div>
|
1467
|
+
)
|
1468
|
+
);
|
1469
|
+
|
1457
1470
|
return (
|
1458
1471
|
<WrapperComponent
|
1459
1472
|
className={cx(
|
@@ -1480,6 +1493,8 @@ export default class Form extends React.Component<FormProps, object> {
|
|
1480
1493
|
body
|
1481
1494
|
})}
|
1482
1495
|
|
1496
|
+
{padDom}
|
1497
|
+
|
1483
1498
|
{/* 显示没有映射上的 errors */}
|
1484
1499
|
{restError && restError.length ? (
|
1485
1500
|
<ul className={cx('Form-restError', 'Form-feedback')}>
|
package/src/renderers/IFrame.tsx
CHANGED
@@ -6,7 +6,7 @@ import {ScopedContext, IScopedContext} from '../Scoped';
|
|
6
6
|
import {buildApi, isApiOutdated} from '../utils/api';
|
7
7
|
import {BaseSchema, SchemaUrlPath} from '../Schema';
|
8
8
|
import {ActionSchema} from './Action';
|
9
|
-
import {dataMapping} from '../utils/tpl-builtin';
|
9
|
+
import {dataMapping, resolveVariableAndFilter} from '../utils/tpl-builtin';
|
10
10
|
|
11
11
|
/**
|
12
12
|
* IFrame 渲染器
|
@@ -113,10 +113,8 @@ export default class IFrame extends React.Component<IFrameProps, object> {
|
|
113
113
|
const {src, data} = this.props;
|
114
114
|
|
115
115
|
if (src) {
|
116
|
-
(this.IFrameRef.current as HTMLIFrameElement).src =
|
117
|
-
src,
|
118
|
-
data
|
119
|
-
).url;
|
116
|
+
(this.IFrameRef.current as HTMLIFrameElement).src =
|
117
|
+
resolveVariableAndFilter(src, data, '| raw');
|
120
118
|
}
|
121
119
|
}
|
122
120
|
|
@@ -129,10 +127,8 @@ export default class IFrame extends React.Component<IFrameProps, object> {
|
|
129
127
|
this.postMessage('receive', newData);
|
130
128
|
|
131
129
|
if (isApiOutdated(src, src, data, newData)) {
|
132
|
-
(this.IFrameRef.current as HTMLIFrameElement).src =
|
133
|
-
src,
|
134
|
-
newData
|
135
|
-
).url;
|
130
|
+
(this.IFrameRef.current as HTMLIFrameElement).src =
|
131
|
+
resolveVariableAndFilter(src, newData, '| raw');
|
136
132
|
}
|
137
133
|
}
|
138
134
|
|
@@ -161,7 +157,9 @@ export default class IFrame extends React.Component<IFrameProps, object> {
|
|
161
157
|
...style
|
162
158
|
};
|
163
159
|
|
164
|
-
const finalSrc = src
|
160
|
+
const finalSrc = src
|
161
|
+
? resolveVariableAndFilter(src, data, '| raw')
|
162
|
+
: undefined;
|
165
163
|
|
166
164
|
if (
|
167
165
|
typeof finalSrc === 'string' &&
|
package/src/renderers/Tpl.tsx
CHANGED
@@ -104,7 +104,9 @@ export class Tpl extends React.Component<TplProps, object> {
|
|
104
104
|
return;
|
105
105
|
}
|
106
106
|
|
107
|
-
this.dom.firstChild.innerHTML = this.
|
107
|
+
this.dom.firstChild.innerHTML = this.props.env.filterHtml(
|
108
|
+
this.getContent()
|
109
|
+
);
|
108
110
|
}
|
109
111
|
|
110
112
|
render() {
|