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
package/src/Schema.ts
CHANGED
@@ -9,6 +9,7 @@ import {ButtonToolbarSchema} from './renderers/Form/ButtonToolbar';
|
|
9
9
|
import {CardSchema} from './renderers/Card';
|
10
10
|
import {CardsSchema} from './renderers/Cards';
|
11
11
|
import {FormSchema} from './renderers/Form';
|
12
|
+
import {CalendarSchema} from './renderers/Calendar';
|
12
13
|
import {CarouselSchema} from './renderers/Carousel';
|
13
14
|
import {ChartSchema} from './renderers/Chart';
|
14
15
|
import {CollapseSchema} from './renderers/Collapse';
|
@@ -132,6 +133,7 @@ export type SchemaType =
|
|
132
133
|
| 'cards'
|
133
134
|
| 'carousel'
|
134
135
|
| 'chart'
|
136
|
+
| 'calendar'
|
135
137
|
| 'collapse'
|
136
138
|
| 'collapse-group'
|
137
139
|
| 'color'
|
@@ -340,6 +342,7 @@ export type SchemaObject =
|
|
340
342
|
| AvatarSchema
|
341
343
|
| ButtonGroupSchema
|
342
344
|
| ButtonToolbarSchema
|
345
|
+
| CalendarSchema
|
343
346
|
| CardSchema
|
344
347
|
| CardsSchema
|
345
348
|
| CarouselSchema
|
@@ -182,7 +182,10 @@ export class Collapse extends React.Component<CollapseProps, CollapseState> {
|
|
182
182
|
expandIcon ? (
|
183
183
|
React.cloneElement(expandIcon, {
|
184
184
|
...expandIcon.props,
|
185
|
-
className: cx(
|
185
|
+
className: cx(
|
186
|
+
'Collapse-icon-tranform',
|
187
|
+
expandIcon.props?.className
|
188
|
+
)
|
186
189
|
})
|
187
190
|
) : (
|
188
191
|
<span className={cx('Collapse-arrow')} />
|
@@ -267,7 +267,7 @@ export class ColorControl extends React.PureComponent<
|
|
267
267
|
|
268
268
|
{clearable && !disabled && value ? (
|
269
269
|
<a onClick={this.clearValue} className={cx('ColorPicker-clear')}>
|
270
|
-
<Icon icon="
|
270
|
+
<Icon icon="input-clear" className="icon" />
|
271
271
|
</a>
|
272
272
|
) : null}
|
273
273
|
|
@@ -700,7 +700,7 @@ export class DatePicker extends React.Component<DateProps, DatePickerState> {
|
|
700
700
|
|
701
701
|
{clearable && !disabled && normalizeValue(value, format) ? (
|
702
702
|
<a className={cx(`DatePicker-clear`)} onClick={this.clearValue}>
|
703
|
-
<Icon icon="
|
703
|
+
<Icon icon="input-clear" className="icon" />
|
704
704
|
</a>
|
705
705
|
) : null}
|
706
706
|
|
@@ -426,7 +426,7 @@ export class DateRangePicker extends React.Component<
|
|
426
426
|
|
427
427
|
if (
|
428
428
|
startDate &&
|
429
|
-
!endDate &&
|
429
|
+
(!endDate || (endDate && newValue.isSame(startDate))) && // 没有结束时间,或者新的时间也是开始时间,这时都会将新值当成结束时间
|
430
430
|
newValue.isSameOrAfter(startDate) &&
|
431
431
|
(!minDuration || newValue.isAfter(startDate.clone().add(minDuration))) &&
|
432
432
|
(!maxDuration || newValue.isBefore(startDate.clone().add(maxDuration)))
|
@@ -885,7 +885,7 @@ export class DateRangePicker extends React.Component<
|
|
885
885
|
|
886
886
|
{clearable && !disabled && value ? (
|
887
887
|
<a className={`${ns}DateRangePicker-clear`} onClick={this.clearValue}>
|
888
|
-
<Icon icon="
|
888
|
+
<Icon icon="input-clear" className="icon" />
|
889
889
|
</a>
|
890
890
|
) : null}
|
891
891
|
|
@@ -171,7 +171,7 @@ export class LocationPicker extends React.Component<
|
|
171
171
|
|
172
172
|
{clearable && !disabled && value ? (
|
173
173
|
<a className={cx('LocationPicker-clear')} onClick={this.clearValue}>
|
174
|
-
<Icon icon="
|
174
|
+
<Icon icon="input-clear" className="icon" />
|
175
175
|
</a>
|
176
176
|
) : null}
|
177
177
|
|
@@ -11,6 +11,7 @@ import Button from './Button';
|
|
11
11
|
export interface PickerContainerProps extends ThemeProps, LocaleProps {
|
12
12
|
title?: string;
|
13
13
|
showTitle?: boolean;
|
14
|
+
headerClassName?: string;
|
14
15
|
children: (props: {
|
15
16
|
onClick: (e: React.MouseEvent) => void;
|
16
17
|
isOpened: boolean;
|
@@ -100,6 +101,7 @@ export class PickerContainer extends React.Component<
|
|
100
101
|
bodyRender: popOverRender,
|
101
102
|
title,
|
102
103
|
showTitle,
|
104
|
+
headerClassName,
|
103
105
|
translate: __,
|
104
106
|
size
|
105
107
|
} = this.props;
|
@@ -117,7 +119,7 @@ export class PickerContainer extends React.Component<
|
|
117
119
|
onHide={this.close}
|
118
120
|
>
|
119
121
|
{showTitle !== false ? (
|
120
|
-
<Modal.Header onClose={this.close}>
|
122
|
+
<Modal.Header onClose={this.close} className={headerClassName}>
|
121
123
|
{__(title || 'Select.placeholder')}
|
122
124
|
</Modal.Header>
|
123
125
|
) : null}
|
@@ -184,7 +184,7 @@ export class ResultBox extends React.Component<ResultBoxProps> {
|
|
184
184
|
!disabled &&
|
185
185
|
(Array.isArray(result) ? result.length : result) ? (
|
186
186
|
<a onClick={this.clearValue} className={cx('ResultBox-clear')}>
|
187
|
-
<Icon icon="
|
187
|
+
<Icon icon="input-clear" className="icon" />
|
188
188
|
</a>
|
189
189
|
) : null}
|
190
190
|
{!allowInput && mobileUI ? (
|
package/src/components/Tabs.tsx
CHANGED
@@ -21,6 +21,8 @@ const transitionStyles: {
|
|
21
21
|
[ENTERED]: 'in'
|
22
22
|
};
|
23
23
|
|
24
|
+
export type TabsMode = '' | 'line' | 'card' | 'radio' | 'vertical' | 'chrome';
|
25
|
+
|
24
26
|
export interface TabProps extends ThemeProps {
|
25
27
|
title?: string | React.ReactNode; // 标题
|
26
28
|
icon?: string;
|
@@ -85,8 +87,8 @@ class TabComponent extends React.PureComponent<TabProps> {
|
|
85
87
|
export const Tab = themeable(TabComponent);
|
86
88
|
|
87
89
|
export interface TabsProps extends ThemeProps {
|
88
|
-
mode:
|
89
|
-
tabsMode?:
|
90
|
+
mode: TabsMode;
|
91
|
+
tabsMode?: TabsMode;
|
90
92
|
additionBtns?: React.ReactNode;
|
91
93
|
onSelect?: (key: string | number) => void;
|
92
94
|
activeKey?: string | number;
|
@@ -19,6 +19,7 @@ import {ThemeProps, themeable} from '../../theme';
|
|
19
19
|
import {Config} from './config';
|
20
20
|
import InputBox from '../InputBox';
|
21
21
|
import Formula from './Formula';
|
22
|
+
import {FormulaPickerProps} from '../formula/Picker';
|
22
23
|
|
23
24
|
/**
|
24
25
|
* 支持4中表达式设置方式
|
@@ -43,6 +44,7 @@ export interface ExpressionProps extends ThemeProps {
|
|
43
44
|
disabled?: boolean;
|
44
45
|
searchable?: boolean;
|
45
46
|
fieldClassName?: string;
|
47
|
+
formula?: FormulaPickerProps;
|
46
48
|
}
|
47
49
|
|
48
50
|
const fieldMap = {
|
@@ -132,7 +134,8 @@ export class Expression extends React.Component<ExpressionProps> {
|
|
132
134
|
config,
|
133
135
|
data,
|
134
136
|
disabled,
|
135
|
-
searchable
|
137
|
+
searchable,
|
138
|
+
formula
|
136
139
|
} = this.props;
|
137
140
|
const inputType =
|
138
141
|
((value as any)?.type === 'field'
|
@@ -146,7 +149,6 @@ export class Expression extends React.Component<ExpressionProps> {
|
|
146
149
|
: undefined) ||
|
147
150
|
allowedTypes?.[0] ||
|
148
151
|
'value';
|
149
|
-
|
150
152
|
const types = allowedTypes || ['value', 'field', 'func'];
|
151
153
|
|
152
154
|
if ((!Array.isArray(funcs) || !funcs.length) && ~types.indexOf('func')) {
|
@@ -163,6 +165,7 @@ export class Expression extends React.Component<ExpressionProps> {
|
|
163
165
|
op={op}
|
164
166
|
data={data}
|
165
167
|
disabled={disabled}
|
168
|
+
formula={formula}
|
166
169
|
/>
|
167
170
|
) : null}
|
168
171
|
|
@@ -7,6 +7,7 @@ import {autobind, guid} from '../../utils/helper';
|
|
7
7
|
import {Config} from './config';
|
8
8
|
import {Icon} from '../icons';
|
9
9
|
import {localeable, LocaleProps} from '../../locale';
|
10
|
+
import {FormulaPickerProps} from '../formula/Picker';
|
10
11
|
|
11
12
|
export interface ConditionGroupProps extends ThemeProps, LocaleProps {
|
12
13
|
builderMode?: 'simple' | 'full';
|
@@ -15,6 +16,7 @@ export interface ConditionGroupProps extends ThemeProps, LocaleProps {
|
|
15
16
|
fields: Fields;
|
16
17
|
funcs?: Funcs;
|
17
18
|
showNot?: boolean;
|
19
|
+
showANDOR?: boolean;
|
18
20
|
data?: any;
|
19
21
|
disabled?: boolean;
|
20
22
|
searchable?: boolean;
|
@@ -23,6 +25,7 @@ export interface ConditionGroupProps extends ThemeProps, LocaleProps {
|
|
23
25
|
onRemove?: (e: React.MouseEvent) => void;
|
24
26
|
onDragStart?: (e: React.MouseEvent) => void;
|
25
27
|
fieldClassName?: string;
|
28
|
+
formula?: FormulaPickerProps;
|
26
29
|
}
|
27
30
|
|
28
31
|
export class ConditionGroup extends React.Component<ConditionGroupProps> {
|
@@ -127,14 +130,16 @@ export class ConditionGroup extends React.Component<ConditionGroupProps> {
|
|
127
130
|
onRemove,
|
128
131
|
onDragStart,
|
129
132
|
showNot,
|
133
|
+
showANDOR = false,
|
130
134
|
disabled,
|
131
135
|
searchable,
|
132
|
-
translate: __
|
136
|
+
translate: __,
|
137
|
+
formula
|
133
138
|
} = this.props;
|
134
139
|
return (
|
135
140
|
<div className={cx('CBGroup')} data-group-id={value?.id}>
|
136
141
|
<div className={cx('CBGroup-toolbar')}>
|
137
|
-
{builderMode === 'simple' ? null : (
|
142
|
+
{builderMode === 'simple' && showANDOR === false ? null : (
|
138
143
|
<div className={cx('CBGroup-toolbarCondition')}>
|
139
144
|
{showNot ? (
|
140
145
|
<Button
|
@@ -216,6 +221,7 @@ export class ConditionGroup extends React.Component<ConditionGroupProps> {
|
|
216
221
|
disabled={disabled}
|
217
222
|
searchable={searchable}
|
218
223
|
builderMode={builderMode}
|
224
|
+
formula={formula}
|
219
225
|
/>
|
220
226
|
))
|
221
227
|
) : (
|
@@ -6,6 +6,7 @@ import {Icon} from '../icons';
|
|
6
6
|
import {autobind} from '../../utils/helper';
|
7
7
|
import ConditionGroup from './Group';
|
8
8
|
import ConditionItem from './Item';
|
9
|
+
import {FormulaPickerProps} from '../formula/Picker';
|
9
10
|
|
10
11
|
export interface CBGroupOrItemProps extends ThemeProps {
|
11
12
|
builderMode?: 'simple' | 'full';
|
@@ -23,6 +24,7 @@ export interface CBGroupOrItemProps extends ThemeProps {
|
|
23
24
|
onDragStart?: (e: React.MouseEvent) => void;
|
24
25
|
onRemove?: (index: number) => void;
|
25
26
|
fieldClassName?: string;
|
27
|
+
formula?: FormulaPickerProps;
|
26
28
|
}
|
27
29
|
|
28
30
|
export class CBGroupOrItem extends React.Component<CBGroupOrItemProps> {
|
@@ -49,7 +51,8 @@ export class CBGroupOrItem extends React.Component<CBGroupOrItemProps> {
|
|
49
51
|
data,
|
50
52
|
disabled,
|
51
53
|
searchable,
|
52
|
-
onDragStart
|
54
|
+
onDragStart,
|
55
|
+
formula
|
53
56
|
} = this.props;
|
54
57
|
|
55
58
|
return (
|
@@ -97,6 +100,7 @@ export class CBGroupOrItem extends React.Component<CBGroupOrItemProps> {
|
|
97
100
|
fieldClassName={fieldClassName}
|
98
101
|
funcs={funcs}
|
99
102
|
data={data}
|
103
|
+
formula={formula}
|
100
104
|
/>
|
101
105
|
<a className={cx('CBDelete')} onClick={this.handleItemRemove}>
|
102
106
|
<Icon icon="close" className="icon" />
|
@@ -21,6 +21,7 @@ import PopOverContainer from '../PopOverContainer';
|
|
21
21
|
import GroupedSelection from '../GroupedSelection';
|
22
22
|
import ResultBox from '../ResultBox';
|
23
23
|
import {localeable, LocaleProps} from '../../locale';
|
24
|
+
import {FormulaPickerProps} from '../formula/Picker';
|
24
25
|
|
25
26
|
const option2value = (item: any) => item.value;
|
26
27
|
|
@@ -35,6 +36,7 @@ export interface ConditionItemProps extends ThemeProps, LocaleProps {
|
|
35
36
|
searchable?: boolean;
|
36
37
|
onChange: (value: ConditionRule, index?: number) => void;
|
37
38
|
fieldClassName?: string;
|
39
|
+
formula?: FormulaPickerProps;
|
38
40
|
}
|
39
41
|
|
40
42
|
export class ConditionItem extends React.Component<ConditionItemProps> {
|
@@ -239,7 +241,8 @@ export class ConditionItem extends React.Component<ConditionItemProps> {
|
|
239
241
|
fields,
|
240
242
|
config,
|
241
243
|
classnames: cx,
|
242
|
-
disabled
|
244
|
+
disabled,
|
245
|
+
formula
|
243
246
|
} = this.props;
|
244
247
|
let field = {
|
245
248
|
...config.types[type],
|
@@ -278,6 +281,7 @@ export class ConditionItem extends React.Component<ConditionItemProps> {
|
|
278
281
|
config.valueTypes || ['value', 'field', 'func', 'formula']
|
279
282
|
}
|
280
283
|
disabled={disabled}
|
284
|
+
formula={formula}
|
281
285
|
/>
|
282
286
|
|
283
287
|
<span className={cx('CBSeprator')}>~</span>
|
@@ -295,6 +299,7 @@ export class ConditionItem extends React.Component<ConditionItemProps> {
|
|
295
299
|
config.valueTypes || ['value', 'field', 'func', 'formula']
|
296
300
|
}
|
297
301
|
disabled={disabled}
|
302
|
+
formula={formula}
|
298
303
|
/>
|
299
304
|
</>
|
300
305
|
);
|
@@ -315,6 +320,7 @@ export class ConditionItem extends React.Component<ConditionItemProps> {
|
|
315
320
|
config.valueTypes || ['value', 'field', 'func', 'formula']
|
316
321
|
}
|
317
322
|
disabled={disabled}
|
323
|
+
formula={formula}
|
318
324
|
/>
|
319
325
|
);
|
320
326
|
}
|
@@ -7,6 +7,7 @@ import DatePicker from '../DatePicker';
|
|
7
7
|
import {SelectWithRemoteOptions as Select} from '../Select';
|
8
8
|
import Switch from '../Switch';
|
9
9
|
import {localeable, LocaleProps} from '../../locale';
|
10
|
+
import {FormulaPicker, FormulaPickerProps} from '../formula/Picker';
|
10
11
|
|
11
12
|
export interface ValueProps extends ThemeProps, LocaleProps {
|
12
13
|
value: any;
|
@@ -15,11 +16,12 @@ export interface ValueProps extends ThemeProps, LocaleProps {
|
|
15
16
|
field: FieldSimple;
|
16
17
|
op?: OperatorType;
|
17
18
|
disabled?: boolean;
|
19
|
+
formula?: FormulaPickerProps;
|
18
20
|
}
|
19
21
|
|
20
22
|
export class Value extends React.Component<ValueProps> {
|
21
23
|
render() {
|
22
|
-
|
24
|
+
let {
|
23
25
|
classnames: cx,
|
24
26
|
field,
|
25
27
|
value,
|
@@ -27,11 +29,22 @@ export class Value extends React.Component<ValueProps> {
|
|
27
29
|
op,
|
28
30
|
translate: __,
|
29
31
|
data,
|
30
|
-
disabled
|
32
|
+
disabled,
|
33
|
+
formula
|
31
34
|
} = this.props;
|
32
35
|
let input: JSX.Element | undefined = undefined;
|
33
|
-
|
34
|
-
|
36
|
+
if (formula) {
|
37
|
+
// 如果配置了 formula 字段,则所有的输入变为 formula 形式
|
38
|
+
formula = Object.assign(formula, {
|
39
|
+
translate: __,
|
40
|
+
classnames: cx,
|
41
|
+
data,
|
42
|
+
value: value ?? field.defaultValue,
|
43
|
+
onChange,
|
44
|
+
disabled
|
45
|
+
});
|
46
|
+
input = <FormulaPicker {...formula} />;
|
47
|
+
} else if (field.type === 'text') {
|
35
48
|
input = (
|
36
49
|
<InputBox
|
37
50
|
value={value ?? field.defaultValue}
|
@@ -15,12 +15,14 @@ import {
|
|
15
15
|
} from '../../utils/helper';
|
16
16
|
import {findDOMNode} from 'react-dom';
|
17
17
|
import animtion from '../../utils/Animation';
|
18
|
+
import {FormulaPickerProps} from '../formula/Picker';
|
18
19
|
|
19
20
|
export interface ConditionBuilderProps extends ThemeProps, LocaleProps {
|
20
21
|
builderMode?: 'simple' | 'full'; // 简单模式|完整模式
|
21
22
|
fields: Fields;
|
22
23
|
funcs?: Funcs;
|
23
24
|
showNot?: boolean;
|
25
|
+
showANDOR?: boolean;
|
24
26
|
value?: ConditionGroupValue;
|
25
27
|
data?: any;
|
26
28
|
onChange: (value: ConditionGroupValue) => void;
|
@@ -28,6 +30,7 @@ export interface ConditionBuilderProps extends ThemeProps, LocaleProps {
|
|
28
30
|
disabled?: boolean;
|
29
31
|
searchable?: boolean;
|
30
32
|
fieldClassName?: string;
|
33
|
+
formula?: FormulaPickerProps;
|
31
34
|
}
|
32
35
|
|
33
36
|
export class QueryBuilder extends React.Component<ConditionBuilderProps> {
|
@@ -202,10 +205,12 @@ export class QueryBuilder extends React.Component<ConditionBuilderProps> {
|
|
202
205
|
onChange,
|
203
206
|
value,
|
204
207
|
showNot,
|
208
|
+
showANDOR,
|
205
209
|
data,
|
206
210
|
disabled,
|
207
211
|
searchable,
|
208
|
-
builderMode
|
212
|
+
builderMode,
|
213
|
+
formula
|
209
214
|
} = this.props;
|
210
215
|
|
211
216
|
const normalizedValue = Array.isArray(value?.children)
|
@@ -236,10 +241,12 @@ export class QueryBuilder extends React.Component<ConditionBuilderProps> {
|
|
236
241
|
fieldClassName={fieldClassName}
|
237
242
|
removeable={false}
|
238
243
|
onDragStart={this.handleDragStart}
|
244
|
+
showANDOR={showANDOR}
|
239
245
|
showNot={showNot}
|
240
246
|
data={data}
|
241
247
|
disabled={disabled}
|
242
248
|
searchable={searchable}
|
249
|
+
formula={formula}
|
243
250
|
/>
|
244
251
|
);
|
245
252
|
}
|
@@ -3,13 +3,14 @@
|
|
3
3
|
*/
|
4
4
|
import React from 'react';
|
5
5
|
import {uncontrollable} from 'uncontrollable';
|
6
|
-
import {
|
6
|
+
import {parse} from 'amis-formula';
|
7
7
|
import {doc} from 'amis-formula/dist/doc';
|
8
|
+
|
9
|
+
import {FormulaPlugin, editorFactory} from './plugin';
|
8
10
|
import FuncList from './FuncList';
|
9
11
|
import {VariableList} from './VariableList';
|
10
|
-
import {parse} from 'amis-formula';
|
11
|
-
import {autobind} from '../../utils/helper';
|
12
12
|
import CodeMirrorEditor from '../CodeMirror';
|
13
|
+
import {autobind} from '../../utils/helper';
|
13
14
|
import {themeable, ThemeProps} from '../../theme';
|
14
15
|
import {localeable, LocaleProps} from '../../locale';
|
15
16
|
|
@@ -17,6 +18,8 @@ export interface VariableItem {
|
|
17
18
|
label: string;
|
18
19
|
value?: string;
|
19
20
|
children?: Array<VariableItem>;
|
21
|
+
type: '';
|
22
|
+
tag?: string;
|
20
23
|
selectMode?: 'tree' | 'tabs';
|
21
24
|
}
|
22
25
|
|
@@ -60,6 +63,10 @@ export interface FormulaEditorProps extends ThemeProps, LocaleProps {
|
|
60
63
|
* 顶部标题,默认为表达式
|
61
64
|
*/
|
62
65
|
header: string;
|
66
|
+
|
67
|
+
variableClassName?: string;
|
68
|
+
|
69
|
+
functionClassName?: string;
|
63
70
|
}
|
64
71
|
|
65
72
|
export interface FunctionsProps {
|
@@ -116,7 +123,7 @@ export class FormulaEditor extends React.Component<
|
|
116
123
|
FormulaEditorProps,
|
117
124
|
'functions' | 'variables' | 'evalMode'
|
118
125
|
> = {
|
119
|
-
functions:
|
126
|
+
functions: FormulaEditor.buildDefaultFunctions(doc),
|
120
127
|
variables: [],
|
121
128
|
evalMode: true
|
122
129
|
};
|
@@ -209,18 +216,23 @@ export class FormulaEditor extends React.Component<
|
|
209
216
|
value,
|
210
217
|
functions,
|
211
218
|
variableMode,
|
212
|
-
|
219
|
+
translate: __,
|
220
|
+
classnames: cx,
|
221
|
+
variableClassName,
|
222
|
+
functionClassName,
|
223
|
+
classPrefix
|
213
224
|
} = this.props;
|
214
225
|
const {focused} = this.state;
|
215
|
-
|
216
226
|
return (
|
217
227
|
<div
|
218
228
|
className={cx(`FormulaEditor`, {
|
219
229
|
'is-focused': focused
|
220
230
|
})}
|
221
231
|
>
|
222
|
-
<
|
223
|
-
<
|
232
|
+
<section className={cx(`FormulaEditor-content`)}>
|
233
|
+
<header className={cx(`FormulaEditor-header`)}>
|
234
|
+
{__(header || 'FormulaEditor.title')}
|
235
|
+
</header>
|
224
236
|
|
225
237
|
<CodeMirrorEditor
|
226
238
|
className={cx('FormulaEditor-editor')}
|
@@ -230,28 +242,36 @@ export class FormulaEditor extends React.Component<
|
|
230
242
|
editorDidMount={this.handleEditorMounted}
|
231
243
|
onFocus={this.handleFocus}
|
232
244
|
onBlur={this.handleBlur}
|
233
|
-
|
234
|
-
</
|
245
|
+
/>
|
246
|
+
</section>
|
235
247
|
|
236
|
-
<
|
237
|
-
{
|
238
|
-
<div>
|
239
|
-
|
248
|
+
<section className={cx('FormulaEditor-settings')}>
|
249
|
+
<div className={cx('FormulaEditor-panel')}>
|
250
|
+
<div className={cx('FormulaEditor-panel-header')}>
|
251
|
+
{__('FormulaEditor.variable')}
|
252
|
+
</div>
|
253
|
+
<div className={cx('FormulaEditor-panel-body')}>
|
240
254
|
<VariableList
|
241
|
-
|
255
|
+
classPrefix={classPrefix}
|
256
|
+
className={cx(
|
257
|
+
'FormulaEditor-VariableList',
|
258
|
+
'FormulaEditor-VariableList-root',
|
259
|
+
variableClassName
|
260
|
+
)}
|
242
261
|
selectMode={variableMode}
|
243
262
|
data={variables}
|
244
263
|
onSelect={this.handleVariableSelect}
|
245
264
|
/>
|
246
265
|
</div>
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
266
|
+
</div>
|
267
|
+
|
268
|
+
<FuncList
|
269
|
+
className={functionClassName}
|
270
|
+
title={__('FormulaEditor.function')}
|
271
|
+
data={functions}
|
272
|
+
onSelect={this.handleFunctionSelect}
|
273
|
+
/>
|
274
|
+
</section>
|
255
275
|
</div>
|
256
276
|
);
|
257
277
|
}
|