amis 1.10.1-beta.0 → 1.10.2
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/Schema.d.ts +1 -1
- package/lib/Schema.js.map +1 -1
- package/lib/components/Avatar.d.ts +10 -10
- package/lib/components/ListGroup.d.ts +10 -10
- package/lib/components/Range.js +8 -2
- package/lib/components/Range.js.map +2 -2
- package/lib/components/ResultBox.d.ts +41 -40
- package/lib/components/ResultBox.js +23 -19
- package/lib/components/ResultBox.js.map +2 -2
- package/lib/components/Select.js +5 -3
- package/lib/components/Select.js.map +2 -2
- package/lib/components/Steps.d.ts +1 -0
- package/lib/components/Steps.js +8 -6
- package/lib/components/Steps.js.map +2 -2
- package/lib/components/condition-builder/index.d.ts +12 -2
- package/lib/components/condition-builder/index.js +40 -4
- package/lib/components/condition-builder/index.js.map +2 -2
- package/lib/components/formula/Editor.js +1 -1
- package/lib/components/formula/Editor.js.map +2 -2
- package/lib/components/formula/VariableList.js +2 -2
- package/lib/components/formula/VariableList.js.map +2 -2
- package/lib/components/table/index.d.ts +9 -7
- package/lib/components/table/index.js +102 -102
- package/lib/components/table/index.js.map +2 -2
- package/lib/helper.css.map +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +2 -1
- package/lib/index.js.map +2 -2
- package/lib/renderers/Action.js +18 -11
- package/lib/renderers/Action.js.map +2 -2
- package/lib/renderers/ButtonGroup.d.ts +2 -2
- package/lib/renderers/ButtonGroup.js.map +1 -1
- package/lib/renderers/CRUD.js +2 -2
- package/lib/renderers/CRUD.js.map +2 -2
- package/lib/renderers/CRUD2.d.ts +213 -0
- package/lib/renderers/CRUD2.js +724 -0
- package/lib/renderers/CRUD2.js.map +13 -0
- package/lib/renderers/Card2.d.ts +1 -1
- package/lib/renderers/Card2.js +1 -2
- package/lib/renderers/Card2.js.map +2 -2
- package/lib/renderers/Cards.d.ts +3 -0
- package/lib/renderers/Cards.js +52 -5
- package/lib/renderers/Cards.js.map +2 -2
- package/lib/renderers/Form/ConditionBuilder.d.ts +10 -0
- package/lib/renderers/Form/ConditionBuilder.js +6 -2
- package/lib/renderers/Form/ConditionBuilder.js.map +2 -2
- package/lib/renderers/Form/DiffEditor.d.ts +66 -20
- package/lib/renderers/Form/Editor.d.ts +66 -20
- package/lib/renderers/Form/Item.d.ts +4 -0
- package/lib/renderers/Form/Item.js +1 -1
- package/lib/renderers/Form/Item.js.map +2 -2
- package/lib/renderers/Form/TreeSelect.d.ts +0 -1
- package/lib/renderers/Form/TreeSelect.js +1 -9
- package/lib/renderers/Form/TreeSelect.js.map +2 -2
- package/lib/renderers/Form/index.js +8 -4
- package/lib/renderers/Form/index.js.map +2 -2
- package/lib/renderers/Icon.d.ts +1 -1
- package/lib/renderers/Icon.js +13 -8
- package/lib/renderers/Icon.js.map +2 -2
- package/lib/renderers/Table/index.d.ts +1 -0
- package/lib/renderers/Table/index.js +19 -5
- package/lib/renderers/Table/index.js.map +2 -2
- package/lib/renderers/Table-v2/index.d.ts +8 -5
- package/lib/renderers/Table-v2/index.js +83 -54
- package/lib/renderers/Table-v2/index.js.map +2 -2
- package/lib/store/combo.d.ts +72 -22
- package/lib/store/crud.d.ts +2 -0
- package/lib/store/crud.js +21 -1
- package/lib/store/crud.js.map +2 -2
- package/lib/store/form.d.ts +30 -9
- package/lib/store/form.js +28 -10
- package/lib/store/form.js.map +2 -2
- package/lib/store/formItem.d.ts +3 -1
- package/lib/store/formItem.js +3 -5
- package/lib/store/formItem.js.map +2 -2
- package/lib/store/list.d.ts +2 -0
- package/lib/store/list.js +8 -0
- package/lib/store/list.js.map +2 -2
- package/lib/store/table.d.ts +60 -18
- package/lib/themes/ang-ie11.css +166 -19
- package/lib/themes/ang.css +166 -19
- package/lib/themes/ang.css.map +1 -1
- package/lib/themes/antd-ie11.css +166 -19
- package/lib/themes/antd.css +166 -19
- package/lib/themes/antd.css.map +1 -1
- package/lib/themes/cxd-ie11.css +166 -19
- package/lib/themes/cxd.css +166 -19
- package/lib/themes/cxd.css.map +1 -1
- package/lib/themes/dark-ie11.css +166 -19
- package/lib/themes/dark.css +166 -19
- package/lib/themes/dark.css.map +1 -1
- package/lib/themes/default-ie11.css +166 -19
- package/lib/themes/default.css +166 -19
- package/lib/themes/default.css.map +1 -1
- package/lib/types.d.ts +1 -1
- package/lib/types.js.map +1 -1
- package/lib/utils/icon.js +7 -0
- package/lib/utils/icon.js.map +2 -2
- package/package.json +1 -1
- package/schema.json +28 -25
- package/scss/_mixins.scss +1 -1
- package/scss/components/_condition-builder.scss +11 -0
- package/scss/components/_crud.scss +8 -3
- package/scss/components/_crud2.scss +148 -0
- package/scss/components/_result-box.scss +27 -8
- package/scss/components/_steps.scss +21 -26
- package/scss/components/_table-v2.scss +1 -3
- package/scss/components/form/_select.scss +4 -0
- package/scss/themes/_common.scss +1 -0
- package/sdk/ang-ie11.css +203 -20
- package/sdk/ang.css +203 -20
- package/sdk/antd-ie11.css +203 -20
- package/sdk/antd.css +203 -20
- package/sdk/barcode.js +51 -51
- package/sdk/charts.js +14 -14
- package/sdk/codemirror.js +7 -7
- package/sdk/color-picker.js +65 -65
- package/sdk/cropperjs.js +2 -2
- package/sdk/cxd-ie11.css +203 -20
- package/sdk/cxd.css +203 -20
- package/sdk/dark-ie11.css +203 -20
- package/sdk/dark.css +203 -20
- package/sdk/exceljs.js +1 -1
- package/sdk/helper.css.map +1 -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 +16 -16
- package/sdk/rich-text.js +62 -62
- package/sdk/sdk-ie11.css +203 -20
- package/sdk/sdk.css +203 -20
- package/sdk/sdk.js +1344 -1340
- package/sdk/thirds/hls.js/hls.js +1 -1
- package/sdk/thirds/mpegts.js/mpegts.js +1 -1
- package/sdk/tinymce.js +57 -57
- package/src/Schema.ts +1 -0
- package/src/components/Range.tsx +14 -7
- package/src/components/ResultBox.tsx +65 -54
- package/src/components/Select.tsx +6 -5
- package/src/components/Steps.tsx +60 -18
- package/src/components/condition-builder/index.tsx +107 -8
- package/src/components/formula/Editor.tsx +1 -1
- package/src/components/formula/VariableList.tsx +2 -2
- package/src/components/table/index.tsx +190 -193
- package/src/index.tsx +1 -0
- package/src/renderers/Action.tsx +22 -11
- package/src/renderers/ButtonGroup.tsx +2 -2
- package/src/renderers/CRUD.tsx +2 -1
- package/src/renderers/CRUD2.tsx +1213 -0
- package/src/renderers/Card2.tsx +2 -3
- package/src/renderers/Cards.tsx +55 -10
- package/src/renderers/Form/ConditionBuilder.tsx +19 -2
- package/src/renderers/Form/Item.tsx +11 -1
- package/src/renderers/Form/TreeSelect.tsx +14 -16
- package/src/renderers/Form/index.tsx +11 -2
- package/src/renderers/Icon.tsx +8 -1
- package/src/renderers/Table/index.tsx +21 -5
- package/src/renderers/Table-v2/index.tsx +92 -72
- package/src/store/crud.ts +23 -1
- package/src/store/form.ts +31 -24
- package/src/store/formItem.ts +65 -52
- package/src/store/list.ts +10 -0
- package/src/types.ts +2 -1
- package/src/utils/icon.tsx +9 -0
package/src/Schema.ts
CHANGED
package/src/components/Range.tsx
CHANGED
@@ -530,13 +530,20 @@ export class Range extends React.Component<RangeItemProps, any> {
|
|
530
530
|
{/* 刻度标记 */}
|
531
531
|
{marks && (
|
532
532
|
<div className={cx('InputRange-marks')}>
|
533
|
-
{keys(marks).map((key: keyof MarksType) =>
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
|
539
|
-
|
533
|
+
{keys(marks).map((key: keyof MarksType) => {
|
534
|
+
const offsetLeft = this.getOffsetLeft(key);
|
535
|
+
if (/^\d+%$/.test(offsetLeft)) {
|
536
|
+
return (
|
537
|
+
<div key={key} style={{left: offsetLeft}}>
|
538
|
+
<span style={(marks[key] as any)?.style}>
|
539
|
+
{(marks[key] as any)?.label || marks[key]}
|
540
|
+
</span>
|
541
|
+
</div>
|
542
|
+
)
|
543
|
+
} else {
|
544
|
+
return null;
|
545
|
+
}
|
546
|
+
})}
|
540
547
|
</div>
|
541
548
|
)}
|
542
549
|
</div>
|
@@ -27,6 +27,7 @@ export interface ResultBoxProps
|
|
27
27
|
hasDropDownArrow?: boolean;
|
28
28
|
maxTagCount?: number;
|
29
29
|
overflowTagPopover?: TooltipObject;
|
30
|
+
actions?: JSX.Element | JSX.Element[];
|
30
31
|
}
|
31
32
|
|
32
33
|
export class ResultBox extends React.Component<ResultBoxProps> {
|
@@ -59,6 +60,7 @@ export class ResultBox extends React.Component<ResultBoxProps> {
|
|
59
60
|
@autobind
|
60
61
|
clearValue(e: React.MouseEvent<any>) {
|
61
62
|
e.preventDefault();
|
63
|
+
e.stopPropagation();
|
62
64
|
this.props.onClear && this.props.onClear(e);
|
63
65
|
this.props.onResultChange && this.props.onResultChange([]);
|
64
66
|
}
|
@@ -210,6 +212,7 @@ export class ResultBox extends React.Component<ResultBoxProps> {
|
|
210
212
|
borderMode,
|
211
213
|
useMobileUI,
|
212
214
|
hasDropDownArrow,
|
215
|
+
actions,
|
213
216
|
onClear,
|
214
217
|
...rest
|
215
218
|
} = this.props;
|
@@ -236,63 +239,71 @@ export class ResultBox extends React.Component<ResultBoxProps> {
|
|
236
239
|
onFocus={allowInput ? undefined : onFocus}
|
237
240
|
onBlur={allowInput ? undefined : onBlur}
|
238
241
|
>
|
239
|
-
{
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
{
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
{
|
248
|
-
|
249
|
-
|
242
|
+
<div className={cx('ResultBox-value-wrap')}>
|
243
|
+
{Array.isArray(result) && result.length ? (
|
244
|
+
this.renderMultipeTags(result)
|
245
|
+
) : result && !Array.isArray(result) ? (
|
246
|
+
<span className={cx('ResultBox-singleValue')}>
|
247
|
+
{isPlainObject(result) ? itemRender(result) : result}
|
248
|
+
</span>
|
249
|
+
) : allowInput && !disabled ? null : (
|
250
|
+
<span className={cx('ResultBox-placeholder')}>
|
251
|
+
{__(placeholder || 'placeholder.noData')}
|
252
|
+
</span>
|
253
|
+
)}
|
250
254
|
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
255
|
+
{allowInput && !disabled ? (
|
256
|
+
<Input
|
257
|
+
{...omit(rest, omitPropsList)}
|
258
|
+
className={cx('ResultBox-value-input')}
|
259
|
+
onKeyPress={onKeyPress}
|
260
|
+
ref={this.inputRef}
|
261
|
+
value={value || ''}
|
262
|
+
onChange={this.handleChange}
|
263
|
+
placeholder={__(
|
264
|
+
Array.isArray(result) && result.length
|
265
|
+
? inputPlaceholder
|
266
|
+
: result
|
267
|
+
? ''
|
268
|
+
: placeholder
|
269
|
+
)}
|
270
|
+
onFocus={this.handleFocus}
|
271
|
+
onBlur={this.handleBlur}
|
272
|
+
/>
|
273
|
+
) : null}
|
269
274
|
|
270
|
-
|
275
|
+
{children}
|
276
|
+
</div>
|
271
277
|
|
272
|
-
{
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
'ResultBox-clear
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
<
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
278
|
+
<div className={cx('ResultBox-actions')}>
|
279
|
+
{clearable &&
|
280
|
+
!disabled &&
|
281
|
+
(Array.isArray(result) ? result.length : result) ? (
|
282
|
+
<a
|
283
|
+
onClick={this.clearValue}
|
284
|
+
className={cx('ResultBox-clear', {
|
285
|
+
'ResultBox-clear-with-arrow': hasDropDownArrow
|
286
|
+
})}
|
287
|
+
>
|
288
|
+
<div className={cx('ResultBox-clear-wrap')}>
|
289
|
+
<Icon icon="input-clear" className="icon" />
|
290
|
+
</div>
|
291
|
+
</a>
|
292
|
+
) : null}
|
293
|
+
|
294
|
+
{actions}
|
295
|
+
|
296
|
+
{hasDropDownArrow && !mobileUI && (
|
297
|
+
<span className={cx('ResultBox-pc-arrow')}>
|
298
|
+
<Icon icon="right-arrow-bold" className="icon" />
|
299
|
+
</span>
|
300
|
+
)}
|
301
|
+
{!allowInput && mobileUI ? (
|
302
|
+
<span className={cx('ResultBox-arrow')}>
|
303
|
+
<Icon icon="caret" className="icon" />
|
304
|
+
</span>
|
305
|
+
) : null}
|
306
|
+
</div>
|
296
307
|
</div>
|
297
308
|
);
|
298
309
|
}
|
@@ -7,6 +7,7 @@
|
|
7
7
|
|
8
8
|
import {uncontrollable} from 'uncontrollable';
|
9
9
|
import React from 'react';
|
10
|
+
import merge from 'lodash/merge';
|
10
11
|
import isInteger from 'lodash/isInteger';
|
11
12
|
import omit from 'lodash/omit';
|
12
13
|
import VirtualList from './virtual-list';
|
@@ -946,7 +947,7 @@ export class Select extends React.Component<SelectProps, SelectState> {
|
|
946
947
|
hideSelected,
|
947
948
|
renderMenu,
|
948
949
|
mobileClassName,
|
949
|
-
virtualThreshold =
|
950
|
+
virtualThreshold = 100,
|
950
951
|
useMobileUI = false
|
951
952
|
} = this.props;
|
952
953
|
const {selection} = this.state;
|
@@ -960,7 +961,8 @@ export class Select extends React.Component<SelectProps, SelectState> {
|
|
960
961
|
})
|
961
962
|
: options.concat()
|
962
963
|
).filter((option: Option) => !option.hidden && option.visible !== false);
|
963
|
-
|
964
|
+
const enableVirtualRender =
|
965
|
+
filtedOptions.length && filtedOptions.length > virtualThreshold;
|
964
966
|
const selectionValues = selection.map(select => select[valueField]);
|
965
967
|
if (multiple && checkAll) {
|
966
968
|
const optionsValues = (checkAllBySearch ? filtedOptions : options).map(
|
@@ -1000,7 +1002,7 @@ export class Select extends React.Component<SelectProps, SelectState> {
|
|
1000
1002
|
item,
|
1001
1003
|
disabled: item.disabled
|
1002
1004
|
})}
|
1003
|
-
style={style}
|
1005
|
+
style={merge(style, enableVirtualRender ? {width: '100%'} : {})}
|
1004
1006
|
className={cx(`Select-option`, {
|
1005
1007
|
'is-disabled': item.disabled,
|
1006
1008
|
'is-highlight': highlightedIndex === index,
|
@@ -1107,8 +1109,7 @@ export class Select extends React.Component<SelectProps, SelectState> {
|
|
1107
1109
|
<div
|
1108
1110
|
ref={this.menu}
|
1109
1111
|
className={cx('Select-menu', {
|
1110
|
-
'Select--longlist':
|
1111
|
-
filtedOptions.length && filtedOptions.length > virtualThreshold,
|
1112
|
+
'Select--longlist': enableVirtualRender,
|
1112
1113
|
'is-mobile': mobileUI
|
1113
1114
|
})}
|
1114
1115
|
>
|
package/src/components/Steps.tsx
CHANGED
@@ -35,6 +35,8 @@ export type StepSchema = {
|
|
35
35
|
description?: string | JSX.Element;
|
36
36
|
|
37
37
|
status?: StepStatus;
|
38
|
+
|
39
|
+
iconClassName?: string;
|
38
40
|
} & Omit<BaseSchema, 'type'>;
|
39
41
|
|
40
42
|
export interface StepsSchema extends BaseSchema {
|
@@ -73,7 +75,7 @@ export interface StepsSchema extends BaseSchema {
|
|
73
75
|
/**
|
74
76
|
* 标签放置位置
|
75
77
|
*/
|
76
|
-
|
78
|
+
labelPlacement?: 'horizontal' | 'vertical';
|
77
79
|
}
|
78
80
|
export interface StepsProps extends ThemeProps {
|
79
81
|
steps: StepSchema[];
|
@@ -137,27 +139,49 @@ export function Steps(props: StepsProps) {
|
|
137
139
|
|
138
140
|
const mobileUI = useMobileUI && isMobile();
|
139
141
|
return (
|
140
|
-
<ul
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
142
|
+
<ul
|
143
|
+
className={cx(
|
144
|
+
// 纵向步骤条暂时不支持labelPlacement属性
|
145
|
+
'Steps',
|
146
|
+
`Steps--Placement-${
|
147
|
+
progressDot || (labelPlacement === 'vertical' && mode != 'vertical')
|
148
|
+
? 'vertical'
|
149
|
+
: ''
|
150
|
+
}`,
|
151
|
+
`Steps--${progressDot ? 'ProgressDot' : ''}`,
|
152
|
+
`Steps--${mode}`,
|
153
|
+
mobileUI ? 'Steps-mobile' : '',
|
154
|
+
className
|
155
|
+
)}
|
156
|
+
>
|
146
157
|
{stepsRow.map((step, i) => {
|
147
158
|
const {stepStatus, icon} = getStepStatus(step, i);
|
148
159
|
return (
|
149
160
|
<li
|
150
161
|
key={i}
|
151
|
-
className={cx(
|
162
|
+
className={cx(
|
163
|
+
'StepsItem',
|
164
|
+
`is-${stepStatus}`,
|
165
|
+
step.className,
|
166
|
+
`StepsItem-${progressDot ? 'ProgressDot' : ''}`
|
167
|
+
)}
|
152
168
|
>
|
153
169
|
<div className={cx('StepsItem-container')}>
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
170
|
+
<div className={cx('StepsItem-containerTail')}></div>
|
171
|
+
{progressDot ? (
|
172
|
+
<div className={cx('StepsItem-containerProgressDot')}></div>
|
173
|
+
) : (
|
174
|
+
<div
|
175
|
+
className={cx(
|
176
|
+
'StepsItem-containerIcon',
|
177
|
+
i < current && 'is-success'
|
178
|
+
)}
|
179
|
+
>
|
180
|
+
<span className={cx('StepsItem-icon', step.iconClassName)}>
|
181
|
+
{icon ? <Icon icon={icon} className="icon" /> : i + 1}
|
182
|
+
</span>
|
183
|
+
</div>
|
184
|
+
)}
|
161
185
|
<div className={cx('StepsItem-containerWrapper')}>
|
162
186
|
<div className={cx('StepsItem-body')}>
|
163
187
|
<div
|
@@ -167,10 +191,28 @@ export function Steps(props: StepsProps) {
|
|
167
191
|
i < current && 'is-success'
|
168
192
|
)}
|
169
193
|
>
|
170
|
-
<span
|
171
|
-
|
194
|
+
<span
|
195
|
+
className={cx('StepsItem-ellText')}
|
196
|
+
title={String(step.title)}
|
197
|
+
>
|
198
|
+
{step.title}
|
199
|
+
</span>
|
200
|
+
{step.subTitle && (
|
201
|
+
<span
|
202
|
+
className={cx(
|
203
|
+
'StepsItem-subTitle',
|
204
|
+
'StepsItem-ellText'
|
205
|
+
)}
|
206
|
+
title={String(step.subTitle)}
|
207
|
+
>
|
208
|
+
{step.subTitle}
|
209
|
+
</span>
|
210
|
+
)}
|
172
211
|
</div>
|
173
|
-
<div
|
212
|
+
<div
|
213
|
+
className={cx('StepsItem-description', 'StepsItem-ellText')}
|
214
|
+
title={String(step.description)}
|
215
|
+
>
|
174
216
|
<span>{step.description}</span>
|
175
217
|
</div>
|
176
218
|
</div>
|
@@ -11,20 +11,28 @@ import {
|
|
11
11
|
spliceTree,
|
12
12
|
getTree,
|
13
13
|
mapTree,
|
14
|
-
guid
|
14
|
+
guid,
|
15
|
+
noop
|
15
16
|
} from '../../utils/helper';
|
16
17
|
import animtion from '../../utils/Animation';
|
17
18
|
import {FormulaPickerProps} from '../formula/Picker';
|
19
|
+
import {PickerContainer} from '../PickerContainer';
|
20
|
+
import {ResultBox} from '../ResultBox';
|
21
|
+
import {Icon} from '../icons';
|
18
22
|
|
19
23
|
export interface ConditionBuilderProps extends ThemeProps, LocaleProps {
|
20
24
|
builderMode?: 'simple' | 'full'; // 简单模式|完整模式
|
25
|
+
embed?: boolean;
|
26
|
+
pickerIcon?: JSX.Element;
|
27
|
+
placeholder?: string;
|
28
|
+
title?: string;
|
21
29
|
fields: Fields;
|
22
30
|
funcs?: Funcs;
|
23
31
|
showNot?: boolean;
|
24
32
|
showANDOR?: boolean;
|
25
33
|
value?: ConditionGroupValue;
|
26
34
|
data?: any;
|
27
|
-
onChange: (value
|
35
|
+
onChange: (value?: ConditionGroupValue) => void;
|
28
36
|
config?: Config;
|
29
37
|
disabled?: boolean;
|
30
38
|
searchable?: boolean;
|
@@ -34,7 +42,14 @@ export interface ConditionBuilderProps extends ThemeProps, LocaleProps {
|
|
34
42
|
renderEtrValue?: any;
|
35
43
|
}
|
36
44
|
|
37
|
-
export
|
45
|
+
export interface ConditionBuilderState {
|
46
|
+
tmpValue: ConditionGroupValue;
|
47
|
+
}
|
48
|
+
|
49
|
+
export class QueryBuilder extends React.Component<
|
50
|
+
ConditionBuilderProps,
|
51
|
+
ConditionBuilderState
|
52
|
+
> {
|
38
53
|
config = {...defaultConfig, ...this.props.config};
|
39
54
|
|
40
55
|
dragTarget?: HTMLElement;
|
@@ -197,14 +212,33 @@ export class QueryBuilder extends React.Component<ConditionBuilderProps> {
|
|
197
212
|
delete this.ghost;
|
198
213
|
}
|
199
214
|
|
200
|
-
|
215
|
+
@autobind
|
216
|
+
handleClear() {
|
217
|
+
this.props.onChange();
|
218
|
+
}
|
219
|
+
|
220
|
+
@autobind
|
221
|
+
highlightValue(value: ConditionGroupValue) {
|
222
|
+
const {classnames: cx} = this.props;
|
223
|
+
const html = {
|
224
|
+
__html: `<span class="label label-info">已配置</span>`
|
225
|
+
};
|
226
|
+
|
227
|
+
return (
|
228
|
+
<div className={cx('CPGroup-result')} dangerouslySetInnerHTML={html} />
|
229
|
+
);
|
230
|
+
}
|
231
|
+
|
232
|
+
renderBody(
|
233
|
+
onChange: (value: ConditionGroupValue) => void,
|
234
|
+
value?: ConditionGroupValue,
|
235
|
+
popOverContainer?: any
|
236
|
+
) {
|
201
237
|
const {
|
202
238
|
classnames: cx,
|
203
239
|
fieldClassName,
|
204
240
|
fields,
|
205
241
|
funcs,
|
206
|
-
onChange,
|
207
|
-
value,
|
208
242
|
showNot,
|
209
243
|
showANDOR,
|
210
244
|
data,
|
@@ -212,7 +246,6 @@ export class QueryBuilder extends React.Component<ConditionBuilderProps> {
|
|
212
246
|
searchable,
|
213
247
|
builderMode,
|
214
248
|
formula,
|
215
|
-
popOverContainer,
|
216
249
|
renderEtrValue
|
217
250
|
} = this.props;
|
218
251
|
|
@@ -250,11 +283,77 @@ export class QueryBuilder extends React.Component<ConditionBuilderProps> {
|
|
250
283
|
disabled={disabled}
|
251
284
|
searchable={searchable}
|
252
285
|
formula={formula}
|
253
|
-
popOverContainer={popOverContainer}
|
254
286
|
renderEtrValue={renderEtrValue}
|
287
|
+
popOverContainer={popOverContainer}
|
255
288
|
/>
|
256
289
|
);
|
257
290
|
}
|
291
|
+
|
292
|
+
render() {
|
293
|
+
const {
|
294
|
+
classnames: cx,
|
295
|
+
placeholder,
|
296
|
+
embed = true,
|
297
|
+
pickerIcon,
|
298
|
+
locale,
|
299
|
+
translate,
|
300
|
+
classPrefix,
|
301
|
+
onChange: onFinalChange,
|
302
|
+
value,
|
303
|
+
title,
|
304
|
+
disabled,
|
305
|
+
popOverContainer
|
306
|
+
} = this.props;
|
307
|
+
|
308
|
+
if (embed) {
|
309
|
+
return this.renderBody(onFinalChange, value, popOverContainer);
|
310
|
+
}
|
311
|
+
|
312
|
+
return (
|
313
|
+
<PickerContainer
|
314
|
+
classnames={cx}
|
315
|
+
classPrefix={classPrefix}
|
316
|
+
translate={translate}
|
317
|
+
locale={locale}
|
318
|
+
onConfirm={onFinalChange}
|
319
|
+
value={value}
|
320
|
+
size={'md'}
|
321
|
+
popOverContainer={popOverContainer}
|
322
|
+
bodyRender={(params: {
|
323
|
+
value: ConditionGroupValue;
|
324
|
+
onChange: (value: ConditionGroupValue) => void;
|
325
|
+
}) => this.renderBody(params.onChange, params.value)}
|
326
|
+
title={title}
|
327
|
+
>
|
328
|
+
{({onClick, isOpened}) => (
|
329
|
+
<ResultBox
|
330
|
+
classnames={cx}
|
331
|
+
classPrefix={classPrefix}
|
332
|
+
translate={translate}
|
333
|
+
locale={locale}
|
334
|
+
className={cx('CBGroup-result', {'is-active': isOpened})}
|
335
|
+
allowInput={false}
|
336
|
+
clearable={true}
|
337
|
+
result={value}
|
338
|
+
itemRender={this.highlightValue}
|
339
|
+
onResultChange={noop}
|
340
|
+
onClear={this.handleClear}
|
341
|
+
disabled={disabled}
|
342
|
+
borderMode={'full'}
|
343
|
+
placeholder={placeholder}
|
344
|
+
actions={
|
345
|
+
pickerIcon && (
|
346
|
+
<span className={cx('CBPicker-trigger')} onClick={onClick}>
|
347
|
+
{pickerIcon}
|
348
|
+
</span>
|
349
|
+
)
|
350
|
+
}
|
351
|
+
onResultClick={pickerIcon ? undefined : onClick}
|
352
|
+
></ResultBox>
|
353
|
+
)}
|
354
|
+
</PickerContainer>
|
355
|
+
);
|
356
|
+
}
|
258
357
|
}
|
259
358
|
|
260
359
|
export default themeable(
|
@@ -230,7 +230,7 @@ export class FormulaEditor extends React.Component<
|
|
230
230
|
handleVariableSelect(item: VariableItem) {
|
231
231
|
const {evalMode, selfVariableName} = this.props;
|
232
232
|
|
233
|
-
if (item && item.value && selfVariableName === item.value) {
|
233
|
+
if (item && item.value && (selfVariableName && selfVariableName === item.value)) {
|
234
234
|
toast.warning('不能使用当前变量[self],避免循环引用。');
|
235
235
|
return;
|
236
236
|
}
|
@@ -48,7 +48,7 @@ function VariableList(props: VariableListProps) {
|
|
48
48
|
return (
|
49
49
|
<span className={cx(`${classPrefix}-item`, itemClassName)}>
|
50
50
|
{
|
51
|
-
option.label && option.value === selfVariableName && (
|
51
|
+
option.label && (selfVariableName && option.value === selfVariableName) && (
|
52
52
|
<Badge
|
53
53
|
classnames={cx}
|
54
54
|
badge={{
|
@@ -67,7 +67,7 @@ function VariableList(props: VariableListProps) {
|
|
67
67
|
)
|
68
68
|
}
|
69
69
|
{
|
70
|
-
option.label && option.value !== selfVariableName && (
|
70
|
+
option.label && (!selfVariableName || option.value !== selfVariableName) && (
|
71
71
|
<label>
|
72
72
|
{option.label}
|
73
73
|
</label>
|