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
@@ -1,17 +1,28 @@
|
|
1
1
|
import React from 'react';
|
2
|
+
|
2
3
|
import {themeable, ThemeProps} from '../../theme';
|
3
4
|
import Collapse from '../Collapse';
|
4
5
|
import CollapseGroup from '../CollapseGroup';
|
5
6
|
import SearchBox from '../SearchBox';
|
6
7
|
import type {FuncGroup, FuncItem} from './Editor';
|
8
|
+
import {generateIcon} from '../../utils/icon';
|
7
9
|
|
8
10
|
export interface FuncListProps extends ThemeProps {
|
11
|
+
title?: string;
|
12
|
+
descClassName?: string;
|
13
|
+
bodyClassName?: string;
|
9
14
|
data: Array<FuncGroup>;
|
10
15
|
onSelect?: (item: FuncItem) => void;
|
11
16
|
}
|
12
17
|
|
13
18
|
export function FuncList(props: FuncListProps) {
|
14
|
-
const
|
19
|
+
const {
|
20
|
+
title,
|
21
|
+
className,
|
22
|
+
classnames: cx,
|
23
|
+
bodyClassName,
|
24
|
+
descClassName
|
25
|
+
} = props;
|
15
26
|
const [filteredFuncs, setFiteredFuncs] = React.useState(props.data);
|
16
27
|
const [activeFunc, setActiveFunc] = React.useState<any>(null);
|
17
28
|
function onSearch(term: string) {
|
@@ -29,52 +40,71 @@ export function FuncList(props: FuncListProps) {
|
|
29
40
|
}
|
30
41
|
|
31
42
|
return (
|
32
|
-
<div className={cx('
|
33
|
-
<
|
34
|
-
className=
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
43
|
+
<div className={cx('FormulaEditor-FuncList', className)}>
|
44
|
+
<div className={cx('FormulaEditor-panel')}>
|
45
|
+
<div className={cx('FormulaEditor-panel-header')}>{title}</div>
|
46
|
+
<div className={cx('FormulaEditor-panel-body')}>
|
47
|
+
<div className={cx('FormulaEditor-FuncList-searchBox')}>
|
48
|
+
<SearchBox mini={false} onSearch={onSearch} />
|
49
|
+
</div>
|
50
|
+
<div className={cx('FormulaEditor-FuncList-body', bodyClassName)}>
|
51
|
+
<CollapseGroup
|
52
|
+
className={cx('FormulaEditor-FuncList-collapseGroup')}
|
53
|
+
defaultActiveKey={filteredFuncs[0]?.groupName}
|
54
|
+
expandIcon={
|
55
|
+
generateIcon(
|
56
|
+
cx,
|
57
|
+
'fa fa-chevron-right FormulaEditor-FuncList-expandIcon',
|
58
|
+
'Icon'
|
59
|
+
)!
|
60
|
+
}
|
61
|
+
accordion
|
51
62
|
>
|
52
|
-
{
|
53
|
-
<
|
54
|
-
className={cx(
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
onClick={() => props.onSelect?.(item)}
|
61
|
-
key={item.name}
|
63
|
+
{filteredFuncs.map(item => (
|
64
|
+
<Collapse
|
65
|
+
className={cx('FormulaEditor-FuncList-collapse')}
|
66
|
+
headingClassName={cx('FormulaEditor-FuncList-groupTitle')}
|
67
|
+
bodyClassName={cx('FormulaEditor-FuncList-groupBody')}
|
68
|
+
propKey={item.groupName}
|
69
|
+
header={item.groupName}
|
70
|
+
key={item.groupName}
|
62
71
|
>
|
63
|
-
{item.
|
64
|
-
|
72
|
+
{item.items.map(item => (
|
73
|
+
<div
|
74
|
+
className={cx('FormulaEditor-FuncList-item', {
|
75
|
+
'is-active': item.name === activeFunc?.name
|
76
|
+
})}
|
77
|
+
onMouseEnter={() => setActiveFunc(item)}
|
78
|
+
onClick={() => props.onSelect?.(item)}
|
79
|
+
key={item.name}
|
80
|
+
>
|
81
|
+
{item.name}
|
82
|
+
</div>
|
83
|
+
))}
|
84
|
+
</Collapse>
|
65
85
|
))}
|
66
|
-
</
|
67
|
-
|
68
|
-
</
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
86
|
+
</CollapseGroup>
|
87
|
+
</div>
|
88
|
+
</div>
|
89
|
+
</div>
|
90
|
+
|
91
|
+
<div className={cx('FormulaEditor-panel')}>
|
92
|
+
<div className={cx('FormulaEditor-panel-header')}>
|
93
|
+
{activeFunc?.name || ''}
|
94
|
+
</div>
|
95
|
+
<div className={cx('FormulaEditor-panel-body')}>
|
96
|
+
<div className={cx('FormulaEditor-FuncList-doc', descClassName)}>
|
97
|
+
{activeFunc ? (
|
98
|
+
<>
|
99
|
+
<pre>
|
100
|
+
<code>{activeFunc.example}</code>
|
101
|
+
</pre>
|
102
|
+
<div className={cx('FormulaEditor-FuncList-doc-desc')}>
|
103
|
+
{activeFunc.description}
|
104
|
+
</div>
|
105
|
+
</>
|
106
|
+
) : null}
|
107
|
+
</div>
|
78
108
|
</div>
|
79
109
|
</div>
|
80
110
|
</div>
|
@@ -2,23 +2,92 @@ import {uncontrollable} from 'uncontrollable';
|
|
2
2
|
import React from 'react';
|
3
3
|
import {FormulaEditor, FormulaEditorProps} from './Editor';
|
4
4
|
import {autobind, noop} from '../../utils/helper';
|
5
|
+
import {generateIcon} from '../../utils/icon';
|
5
6
|
import PickerContainer from '../PickerContainer';
|
6
7
|
import Editor from './Editor';
|
7
8
|
import ResultBox from '../ResultBox';
|
9
|
+
import Button from '../Button';
|
8
10
|
import {Icon} from '../icons';
|
9
11
|
import {themeable} from '../../theme';
|
10
12
|
import {localeable} from '../../locale';
|
11
13
|
|
14
|
+
import type {SchemaIcon} from '../../Schema';
|
15
|
+
import {
|
16
|
+
resolveVariableAndFilter,
|
17
|
+
isPureVariable
|
18
|
+
} from '../../utils/tpl-builtin';
|
19
|
+
|
12
20
|
export interface FormulaPickerProps extends FormulaEditorProps {
|
13
21
|
// 新的属性?
|
14
22
|
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'full';
|
15
23
|
|
24
|
+
/**
|
25
|
+
* 编辑器标题
|
26
|
+
*/
|
27
|
+
title?: string;
|
28
|
+
|
29
|
+
/**
|
30
|
+
* 按钮图标
|
31
|
+
*/
|
32
|
+
icon?: SchemaIcon;
|
33
|
+
|
34
|
+
/**
|
35
|
+
* 控件模式
|
36
|
+
*/
|
37
|
+
mode?: 'button' | 'input-button';
|
38
|
+
|
16
39
|
/**
|
17
40
|
* 边框模式,全边框,还是半边框,或者没边框。
|
18
41
|
*/
|
19
42
|
borderMode?: 'full' | 'half' | 'none';
|
20
43
|
|
44
|
+
/**
|
45
|
+
* 按钮Label,inputMode为button时生效
|
46
|
+
*/
|
47
|
+
btnLabel?: string;
|
48
|
+
|
49
|
+
/**
|
50
|
+
* 按钮样式
|
51
|
+
*/
|
52
|
+
level?:
|
53
|
+
| 'info'
|
54
|
+
| 'success'
|
55
|
+
| 'warning'
|
56
|
+
| 'danger'
|
57
|
+
| 'link'
|
58
|
+
| 'primary'
|
59
|
+
| 'dark'
|
60
|
+
| 'light';
|
61
|
+
|
62
|
+
/**
|
63
|
+
* 按钮大小
|
64
|
+
*/
|
65
|
+
btnSize?: 'xs' | 'sm' | 'md' | 'lg';
|
66
|
+
|
67
|
+
/**
|
68
|
+
* 禁用状态
|
69
|
+
*/
|
21
70
|
disabled?: boolean;
|
71
|
+
|
72
|
+
/**
|
73
|
+
* 占位文本
|
74
|
+
*/
|
75
|
+
placeholder?: string;
|
76
|
+
|
77
|
+
/**
|
78
|
+
* 可清除
|
79
|
+
*/
|
80
|
+
clearable?: boolean;
|
81
|
+
|
82
|
+
/**
|
83
|
+
* 支持通过上下文变量配置value
|
84
|
+
*/
|
85
|
+
source?: string;
|
86
|
+
|
87
|
+
/**
|
88
|
+
* 外层透传的 data,和source配合使用
|
89
|
+
*/
|
90
|
+
data?: any;
|
22
91
|
}
|
23
92
|
|
24
93
|
export class FormulaPicker extends React.Component<FormulaPickerProps> {
|
@@ -28,7 +97,7 @@ export class FormulaPicker extends React.Component<FormulaPickerProps> {
|
|
28
97
|
}
|
29
98
|
|
30
99
|
render() {
|
31
|
-
|
100
|
+
let {
|
32
101
|
classnames: cx,
|
33
102
|
value,
|
34
103
|
translate: __,
|
@@ -37,41 +106,110 @@ export class FormulaPicker extends React.Component<FormulaPickerProps> {
|
|
37
106
|
onChange,
|
38
107
|
size,
|
39
108
|
borderMode,
|
109
|
+
placeholder,
|
110
|
+
mode,
|
111
|
+
btnLabel,
|
112
|
+
level,
|
113
|
+
btnSize,
|
114
|
+
icon,
|
115
|
+
title,
|
116
|
+
clearable,
|
117
|
+
variables,
|
118
|
+
functions,
|
40
119
|
...rest
|
41
120
|
} = this.props;
|
121
|
+
if (isPureVariable(variables)) {
|
122
|
+
// 如果 variables 是 ${xxx} 这种形式,将其处理成实际的值
|
123
|
+
variables = resolveVariableAndFilter(variables, this.props.data, '| raw');
|
124
|
+
}
|
125
|
+
|
126
|
+
if (isPureVariable(functions)) {
|
127
|
+
// 如果 functions 是 ${xxx} 这种形式,将其处理成实际的值
|
128
|
+
functions = resolveVariableAndFilter(functions, this.props.data, '| raw');
|
129
|
+
}
|
130
|
+
const iconElement = generateIcon(cx, icon, 'Icon');
|
42
131
|
|
43
132
|
return (
|
44
133
|
<PickerContainer
|
45
|
-
|
134
|
+
title={__(title || 'FormulaEditor.title')}
|
135
|
+
headerClassName="font-bold"
|
46
136
|
bodyRender={({onClose, value, onChange}) => {
|
47
|
-
return
|
137
|
+
return (
|
138
|
+
<Editor
|
139
|
+
{...rest}
|
140
|
+
variables={variables}
|
141
|
+
functions={functions}
|
142
|
+
value={value}
|
143
|
+
onChange={onChange}
|
144
|
+
/>
|
145
|
+
);
|
48
146
|
}}
|
49
147
|
value={value}
|
50
148
|
onConfirm={this.handleConfirm}
|
51
149
|
size={'md'}
|
52
150
|
>
|
53
151
|
{({onClick, isOpened}) => (
|
54
|
-
<
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
152
|
+
<div className={cx('FormulaPicker', className)}>
|
153
|
+
{mode === 'button' ? (
|
154
|
+
<Button
|
155
|
+
className={cx('FormulaPicker-action', 'w-full')}
|
156
|
+
level={level}
|
157
|
+
size={btnSize}
|
158
|
+
onClick={onClick}
|
159
|
+
>
|
160
|
+
{iconElement ? (
|
161
|
+
React.cloneElement(iconElement, {
|
162
|
+
className: cx(
|
163
|
+
iconElement?.props?.className ?? '',
|
164
|
+
'FormulaPicker-icon',
|
165
|
+
{
|
166
|
+
['is-filled']: !!value
|
167
|
+
}
|
168
|
+
)
|
169
|
+
})
|
170
|
+
) : (
|
171
|
+
<Icon
|
172
|
+
icon="function"
|
173
|
+
className={cx('FormulaPicker-icon', 'icon', {
|
174
|
+
['is-filled']: !!value
|
175
|
+
})}
|
176
|
+
/>
|
177
|
+
)}
|
178
|
+
<span className={cx('FormulaPicker-label')}>
|
179
|
+
{__(btnLabel || 'FormulaEditor.btnLabel')}
|
180
|
+
</span>
|
181
|
+
</Button>
|
182
|
+
) : (
|
183
|
+
<>
|
184
|
+
<ResultBox
|
185
|
+
className={cx(
|
186
|
+
'FormulaPicker-input',
|
187
|
+
isOpened ? 'is-active' : ''
|
188
|
+
)}
|
189
|
+
allowInput
|
190
|
+
clearable={clearable}
|
191
|
+
value={value}
|
192
|
+
onResultChange={noop}
|
193
|
+
onChange={this.handleConfirm}
|
194
|
+
disabled={disabled}
|
195
|
+
borderMode={borderMode}
|
196
|
+
placeholder={placeholder}
|
197
|
+
/>
|
198
|
+
|
199
|
+
<Button
|
200
|
+
className={cx('FormulaPicker-action')}
|
201
|
+
onClick={onClick}
|
202
|
+
>
|
203
|
+
<Icon
|
204
|
+
icon="function"
|
205
|
+
className={cx('FormulaPicker-icon', 'icon', {
|
206
|
+
['is-filled']: !!value
|
207
|
+
})}
|
208
|
+
/>
|
209
|
+
</Button>
|
210
|
+
</>
|
65
211
|
)}
|
66
|
-
|
67
|
-
onResultClick={onClick}
|
68
|
-
disabled={disabled}
|
69
|
-
borderMode={borderMode}
|
70
|
-
>
|
71
|
-
<span className={cx('FormulaPicker-icon')}>
|
72
|
-
<Icon icon="pencil" className="icon" />
|
73
|
-
</span>
|
74
|
-
</ResultBox>
|
212
|
+
</div>
|
75
213
|
)}
|
76
214
|
</PickerContainer>
|
77
215
|
);
|
@@ -1,29 +1,70 @@
|
|
1
1
|
import React from 'react';
|
2
|
+
import cx from 'classnames';
|
3
|
+
|
2
4
|
import GroupedSelection from '../GroupedSelection';
|
3
5
|
import Tabs, {Tab} from '../Tabs';
|
4
6
|
import TreeSelection from '../TreeSelection';
|
7
|
+
|
5
8
|
import type {VariableItem} from './Editor';
|
9
|
+
import type {ItemRenderStates} from '../Selection';
|
10
|
+
import type {Option} from '../Select';
|
11
|
+
import type {TabsMode} from '../Tabs';
|
6
12
|
|
7
13
|
export interface VariableListProps {
|
8
14
|
className?: string;
|
15
|
+
itemClassName?: string;
|
16
|
+
classPrefix?: string;
|
9
17
|
data: Array<VariableItem>;
|
10
18
|
selectMode?: 'list' | 'tree' | 'tabs';
|
19
|
+
tabsMode?: TabsMode;
|
20
|
+
itemRender?: (option: Option, states: ItemRenderStates) => JSX.Element;
|
11
21
|
onSelect?: (item: VariableItem) => void;
|
12
22
|
}
|
13
23
|
|
14
|
-
export function VariableList({
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
24
|
+
export function VariableList(props: VariableListProps) {
|
25
|
+
const {
|
26
|
+
data: list,
|
27
|
+
className,
|
28
|
+
tabsMode = 'card',
|
29
|
+
classPrefix: themePrefix,
|
30
|
+
itemClassName,
|
31
|
+
selectMode,
|
32
|
+
onSelect
|
33
|
+
} = props;
|
34
|
+
const classPrefix = `${themePrefix}FormulaEditor-VariableList`;
|
35
|
+
const itemRender =
|
36
|
+
props.itemRender && typeof props.itemRender === 'function'
|
37
|
+
? props.itemRender
|
38
|
+
: (option: Option, states: ItemRenderStates): JSX.Element => {
|
39
|
+
return (
|
40
|
+
<span className={cx(`${classPrefix}-item`, itemClassName)}>
|
41
|
+
<label>{option.label}</label>
|
42
|
+
{option?.tag ? (
|
43
|
+
<span className={cx(`${classPrefix}-item-tag`)}>
|
44
|
+
{option.tag}
|
45
|
+
</span>
|
46
|
+
) : null}
|
47
|
+
</span>
|
48
|
+
);
|
49
|
+
};
|
50
|
+
|
20
51
|
return (
|
21
|
-
<div className={className}>
|
52
|
+
<div className={cx(className, {'is-scrollable': selectMode !== 'tabs'})}>
|
22
53
|
{selectMode === 'tabs' ? (
|
23
|
-
<Tabs
|
54
|
+
<Tabs
|
55
|
+
tabsMode={tabsMode}
|
56
|
+
className={cx(`${classPrefix}-base ${classPrefix}-tabs`)}
|
57
|
+
>
|
24
58
|
{list.map((item, index) => (
|
25
|
-
<Tab
|
59
|
+
<Tab
|
60
|
+
className={cx(`${classPrefix}-tab`)}
|
61
|
+
eventKey={index}
|
62
|
+
key={index}
|
63
|
+
title={item.label}
|
64
|
+
>
|
26
65
|
<VariableList
|
66
|
+
className={cx(`${classPrefix}-sub`)}
|
67
|
+
itemRender={itemRender}
|
27
68
|
selectMode={item.selectMode}
|
28
69
|
data={item.children!}
|
29
70
|
onSelect={onSelect}
|
@@ -33,12 +74,16 @@ export function VariableList({
|
|
33
74
|
</Tabs>
|
34
75
|
) : selectMode === 'tree' ? (
|
35
76
|
<TreeSelection
|
77
|
+
itemRender={itemRender}
|
78
|
+
className={cx(`${classPrefix}-base`)}
|
36
79
|
multiple={false}
|
37
80
|
options={list}
|
38
81
|
onChange={(item: any) => onSelect?.(item)}
|
39
82
|
/>
|
40
83
|
) : (
|
41
84
|
<GroupedSelection
|
85
|
+
itemRender={itemRender}
|
86
|
+
className={cx(`${classPrefix}-base`)}
|
42
87
|
multiple={false}
|
43
88
|
options={list}
|
44
89
|
onChange={(item: any) => onSelect?.(item)}
|
package/src/components/icons.tsx
CHANGED
@@ -76,6 +76,8 @@ import AlertSuccess from '../icons/alert-success.svg';
|
|
76
76
|
import AlertInfo from '../icons/alert-info.svg';
|
77
77
|
import AlertWarning from '../icons/alert-warning.svg';
|
78
78
|
import AlertDanger from '../icons/alert-danger.svg';
|
79
|
+
import FunctionIcon from '../icons/function.svg';
|
80
|
+
import InputClearIcon from '../icons/input-clear.svg';
|
79
81
|
|
80
82
|
// 兼容原来的用法,后续不直接试用。
|
81
83
|
|
@@ -178,6 +180,8 @@ registerIcon('alert-info', AlertInfo);
|
|
178
180
|
registerIcon('alert-warning', AlertWarning);
|
179
181
|
registerIcon('alert-danger', AlertDanger);
|
180
182
|
registerIcon('tree-down', TreeDownIcon);
|
183
|
+
registerIcon('function', FunctionIcon);
|
184
|
+
registerIcon('input-clear', InputClearIcon);
|
181
185
|
|
182
186
|
export function Icon({
|
183
187
|
icon,
|
@@ -200,6 +204,7 @@ export function Icon({
|
|
200
204
|
}
|
201
205
|
|
202
206
|
export {
|
207
|
+
InputClearIcon,
|
203
208
|
CloseIcon,
|
204
209
|
UnDoIcon,
|
205
210
|
ReDoIcon,
|
@@ -213,5 +218,6 @@ export {
|
|
213
218
|
CheckIcon,
|
214
219
|
PlusIcon,
|
215
220
|
MinusIcon,
|
216
|
-
PencilIcon
|
221
|
+
PencilIcon,
|
222
|
+
FunctionIcon
|
217
223
|
};
|
package/src/env.tsx
CHANGED
@@ -79,6 +79,11 @@ export interface RendererEnv {
|
|
79
79
|
broadcast?: RendererEvent<any>
|
80
80
|
) => Promise<RendererEvent<any> | undefined>;
|
81
81
|
rendererEventListeners: RendererEventListener[];
|
82
|
+
|
83
|
+
/**
|
84
|
+
* 过滤 html 标签,可用来添加 xss 保护逻辑
|
85
|
+
*/
|
86
|
+
filterHtml: (input: string) => string;
|
82
87
|
[propName: string]: any;
|
83
88
|
}
|
84
89
|
|
package/src/factory.tsx
CHANGED
@@ -148,6 +148,10 @@ export interface RenderOptions {
|
|
148
148
|
* 文本替换的黑名单,因为属性太多了所以改成黑名单的 fangs
|
149
149
|
*/
|
150
150
|
replaceTextIgnoreKeys?: String[];
|
151
|
+
/**
|
152
|
+
* 过滤 html 标签,可用来添加 xss 保护逻辑
|
153
|
+
*/
|
154
|
+
filterHtml?: (input: string) => string;
|
151
155
|
[propName: string]: any;
|
152
156
|
}
|
153
157
|
|
@@ -447,7 +451,11 @@ const defaultOptions: RenderOptions = {
|
|
447
451
|
'target',
|
448
452
|
'reload',
|
449
453
|
'persistData'
|
450
|
-
]
|
454
|
+
],
|
455
|
+
/**
|
456
|
+
* 过滤 html 标签,可用来添加 xss 保护逻辑
|
457
|
+
*/
|
458
|
+
filterHtml: (input: string) => input
|
451
459
|
};
|
452
460
|
let stores: {
|
453
461
|
[propName: string]: IRendererStore;
|
@@ -0,0 +1,4 @@
|
|
1
|
+
<svg t="1642059003991" class="icon" viewBox="0 0 1024 1024" version="1.1"
|
2
|
+
xmlns="http://www.w3.org/2000/svg" p-id="6131" width="200" height="200">
|
3
|
+
<path d="M510.665143 801.536c13.037714 0 22.253714-7.296 22.253714-20.333714 0-5.76-1.536-8.832-5.76-16.896-46.811429-72.502857-73.289143-155.757714-73.289143-245.924572 0-87.094857 24.941714-174.189714 73.289143-247.076571 4.205714-8.045714 5.76-11.117714 5.76-16.877714 0-12.288-9.216-20.333714-22.253714-20.333715-12.672 0-23.04 5.741714-35.291429 22.637715-57.563429 73.270857-86.710857 164.571429-86.710857 261.266285s27.995429 185.307429 86.692572 260.900572c12.288 16.877714 22.637714 22.637714 35.291428 22.637714z m391.716571 0c12.653714 0 22.637714-5.76 34.925715-22.637714C995.986286 703.305143 1024 614.692571 1024 517.997714c0-96.676571-28.781714-187.977143-86.710857-261.266285-12.269714-16.896-22.253714-22.637714-34.907429-22.637715-13.037714 0-22.253714 8.045714-22.253714 20.333715 0 5.76 1.152 8.813714 5.376 16.877714 48.731429 72.886857 73.654857 160 73.654857 247.076571 0 90.148571-26.843429 173.421714-73.270857 245.942857-4.608 8.045714-5.76 11.117714-5.76 16.877715 0 12.269714 9.216 20.333714 22.253714 20.333714z m-850.578285-0.768c75.190857 0 110.098286-32.237714 128.128-118.564571l43.739428-209.865143h69.449143c22.253714 0 36.443429-11.885714 36.443429-31.085715 0-16.475429-10.733714-26.843429-28.379429-26.843428h-64.841143l10.733714-52.169143c9.984-48.731429 25.325714-68.681143 67.913143-68.681143 6.144 0 12.269714-0.384 16.493715-0.768 19.2-1.92 27.611429-10.752 27.611428-27.245714 0-21.485714-18.011429-31.085714-54.857143-31.085714-73.270857 0-110.866286 36.461714-127.744 118.564571l-13.056 61.385143H115.858286c-22.235429 0-36.827429 11.885714-36.827429 31.085714 0 16.493714 11.136 26.843429 28.781714 26.843429h43.337143L108.982857 673.005714C98.194286 723.254857 82.468571 741.668571 41.435429 741.668571c-5.376 0-10.368 0.384-14.189715 0.768-17.664 2.304-27.245714 11.885714-27.245714 28.013715 0 20.717714 17.645714 30.317714 51.803429 30.317714z m539.044571-100.918857c12.653714 0 21.101714-4.205714 30.683429-18.029714l84.022857-119.698286h1.536l85.942857 121.618286c9.6 13.44 18.797714 16.109714 28.013714 16.109714 18.413714 0 30.701714-13.037714 30.701714-28.763429 0-7.296-2.304-14.189714-7.314285-20.717714l-98.194286-133.522286 98.194286-131.602285c5.010286-6.509714 7.314286-13.421714 7.314285-21.485715 0-16.493714-13.824-27.995429-29.165714-27.995428-13.805714 0-21.869714 6.912-29.165714 18.029714l-80.950857 118.546286h-1.92l-81.334857-118.930286c-7.296-11.136-16.493714-17.645714-31.085715-17.645714-17.645714 0-31.085714 14.189714-31.085714 29.531428 0 11.136 3.090286 18.048 8.466286 24.557715l93.220571 125.074285-98.980571 136.96c-5.76 7.314286-6.912 13.824-6.912 21.504 0 14.957714 12.672 26.459429 28.013714 26.459429z" p-id="6132"></path>
|
4
|
+
</svg>
|
@@ -0,0 +1 @@
|
|
1
|
+
<svg t="1642652418667" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3606" width="200" height="200"><path d="M512 39.384615C250.092308 39.384615 39.384615 250.092308 39.384615 512s210.707692 472.615385 472.615385 472.615385 472.615385-210.707692 472.615385-472.615385S773.907692 39.384615 512 39.384615z m96.492308 488.369231l153.6 153.6c7.876923 7.876923 7.876923 19.692308 0 27.569231l-55.138462 55.138461c-7.876923 7.876923-19.692308 7.876923-27.569231 0L525.784615 610.461538c-7.876923-7.876923-19.692308-7.876923-27.56923 0l-153.6 153.6c-7.876923 7.876923-19.692308 7.876923-27.569231 0L261.907692 708.923077c-7.876923-7.876923-7.876923-19.692308 0-27.569231l153.6-153.6c7.876923-7.876923 7.876923-19.692308 0-27.569231l-155.56923-155.56923c-7.876923-7.876923-7.876923-19.692308 0-27.569231l55.138461-55.138462c7.876923-7.876923 19.692308-7.876923 27.569231 0l155.569231 155.569231c7.876923 7.876923 19.692308 7.876923 27.56923 0l153.6-153.6c7.876923-7.876923 19.692308-7.876923 27.569231 0l55.138462 55.138462c7.876923 7.876923 7.876923 19.692308 0 27.56923l-153.6 153.6c-5.907692 7.876923-5.907692 19.692308 0 27.569231z" p-id="3607"></path></svg>
|
package/src/index.tsx
CHANGED
@@ -57,6 +57,7 @@ import './renderers/ButtonGroup';
|
|
57
57
|
import './renderers/Form/ButtonToolbar';
|
58
58
|
import './renderers/Breadcrumb';
|
59
59
|
import './renderers/DropDownButton';
|
60
|
+
import './renderers/Calendar';
|
60
61
|
import './renderers/Collapse';
|
61
62
|
import './renderers/CollapseGroup';
|
62
63
|
import './renderers/Color';
|
package/src/locale/de-DE.ts
CHANGED
@@ -15,6 +15,9 @@ register('de-DE', {
|
|
15
15
|
'Calendar.toast': 'Außerhalb des Datumsbereichs',
|
16
16
|
'Calendar.startPick': 'Wählen Sie Startzeit',
|
17
17
|
'Calendar.endPick': 'Wählen Sie Endzeit',
|
18
|
+
'Schedule': 'Zeitplan',
|
19
|
+
'Time': 'Zeit',
|
20
|
+
'Content': 'Inhalt',
|
18
21
|
'cancel': 'Abbrechen',
|
19
22
|
'Card.dragTip': 'Obere Schaltfläche zum Sortieren ziehen',
|
20
23
|
'Card.toggleDrag': 'Zum Sortieren umschalten',
|
@@ -269,5 +272,9 @@ register('de-DE', {
|
|
269
272
|
'Condition.blank': 'leer',
|
270
273
|
'InputTable.uniqueError': 'Column `{{label}}` unique validate failed',
|
271
274
|
'Timeline.collapseText': 'Entfalten',
|
272
|
-
'Timeline.expandText': 'Falten'
|
275
|
+
'Timeline.expandText': 'Falten',
|
276
|
+
'FormulaEditor.btnLabel': 'Formel Bearbeiten',
|
277
|
+
'FormulaEditor.title': 'Formel Editor',
|
278
|
+
'FormulaEditor.variable': 'Variable',
|
279
|
+
'FormulaEditor.function': 'Funktion'
|
273
280
|
});
|
package/src/locale/en-US.ts
CHANGED
@@ -271,5 +271,9 @@ register('en-US', {
|
|
271
271
|
'Condition.blank': 'blank',
|
272
272
|
'InputTable.uniqueError': 'Column `{{label}}` unique validate failed',
|
273
273
|
'Timeline.collapseText': 'Unfold',
|
274
|
-
'Timeline.expandText': 'Fold'
|
274
|
+
'Timeline.expandText': 'Fold',
|
275
|
+
'FormulaEditor.btnLabel': 'Formula Edit',
|
276
|
+
'FormulaEditor.title': 'Formula Editor',
|
277
|
+
'FormulaEditor.variable': 'Variable',
|
278
|
+
'FormulaEditor.function': 'Function'
|
275
279
|
});
|
package/src/locale/zh-CN.ts
CHANGED
@@ -15,6 +15,9 @@ register('zh-CN', {
|
|
15
15
|
'Calendar.toast': '超出日期范围',
|
16
16
|
'Calendar.startPick': '选择开始时间',
|
17
17
|
'Calendar.endPick': '选择结束时间',
|
18
|
+
'Schedule': '日程',
|
19
|
+
'Time': '时间',
|
20
|
+
'Content': '内容',
|
18
21
|
'cancel': '取消',
|
19
22
|
'Card.dragTip': '请拖动顶部的按钮进行排序',
|
20
23
|
'Card.toggleDrag': '对卡片进行排序操作',
|
@@ -275,5 +278,9 @@ register('zh-CN', {
|
|
275
278
|
'Condition.blank': '空',
|
276
279
|
'InputTable.uniqueError': '列`{{label}}`没有通过唯一验证',
|
277
280
|
'Timeline.collapseText': '展开',
|
278
|
-
'Timeline.expandText': '折叠'
|
281
|
+
'Timeline.expandText': '折叠',
|
282
|
+
'FormulaEditor.btnLabel': '公式编辑',
|
283
|
+
'FormulaEditor.title': '公式编辑器',
|
284
|
+
'FormulaEditor.variable': '变量',
|
285
|
+
'FormulaEditor.function': '函数'
|
279
286
|
});
|
@@ -82,7 +82,6 @@ export class BreadcrumbField extends React.Component<BreadcrumbProps, object> {
|
|
82
82
|
data,
|
83
83
|
'| raw'
|
84
84
|
) as Array<BreadcrumbItemSchema>);
|
85
|
-
|
86
85
|
const crumbs = crumbItems
|
87
86
|
.map<React.ReactNode>((item, index) => (
|
88
87
|
<span className={cx('Breadcrumb-item', itemClassName)} key={index}>
|
package/src/renderers/CRUD.tsx
CHANGED
@@ -376,7 +376,7 @@ export default class CRUD extends React.Component<CRUDProps, any> {
|
|
376
376
|
];
|
377
377
|
static defaultProps = {
|
378
378
|
toolbarInline: true,
|
379
|
-
headerToolbar: ['bulkActions'
|
379
|
+
headerToolbar: ['bulkActions'],
|
380
380
|
footerToolbar: ['statistics', 'pagination'],
|
381
381
|
primaryField: 'id',
|
382
382
|
syncLocation: true,
|
@@ -465,13 +465,16 @@ export default class CRUD extends React.Component<CRUDProps, any> {
|
|
465
465
|
}
|
466
466
|
|
467
467
|
componentDidMount() {
|
468
|
-
const store = this.props
|
468
|
+
const {store, autoGenerateFilter} = this.props;
|
469
469
|
|
470
470
|
if (this.props.perPage) {
|
471
471
|
store.changePage(store.page, this.props.perPage);
|
472
472
|
}
|
473
473
|
|
474
|
-
if (
|
474
|
+
if (
|
475
|
+
(!this.props.filter || (store.filterTogggable && !store.filterVisible)) &&
|
476
|
+
!autoGenerateFilter
|
477
|
+
) {
|
475
478
|
this.handleFilterInit({});
|
476
479
|
}
|
477
480
|
|