amis 1.8.0-beta.0 → 1.8.0-beta.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/SchemaRenderer.js +19 -3
- package/lib/SchemaRenderer.js.map +2 -2
- package/lib/WithRootStore.d.ts +18 -0
- package/lib/WithStore.js +2 -1
- package/lib/WithStore.js.map +2 -2
- package/lib/actions/CmptAction.js +14 -3
- package/lib/actions/CmptAction.js.map +2 -2
- package/lib/components/BarCode.js +1 -1
- package/lib/components/BarCode.js.map +2 -2
- package/lib/components/DatePicker.d.ts +3 -0
- package/lib/components/DatePicker.js +56 -11
- package/lib/components/DatePicker.js.map +2 -2
- package/lib/components/DateRangePicker.d.ts +92 -84
- package/lib/components/DateRangePicker.js +198 -5
- package/lib/components/DateRangePicker.js.map +2 -2
- package/lib/components/MonthRangePicker.d.ts +84 -84
- package/lib/components/Progress.js +12 -9
- package/lib/components/Progress.js.map +2 -2
- package/lib/components/Radios.d.ts +1 -1
- package/lib/components/Radios.js +3 -5
- package/lib/components/Radios.js.map +2 -2
- package/lib/components/Range.d.ts +2 -2
- package/lib/components/Range.js +24 -11
- package/lib/components/Range.js.map +2 -2
- package/lib/components/Steps.d.ts +6 -0
- package/lib/components/Steps.js +13 -9
- package/lib/components/Steps.js.map +2 -2
- package/lib/components/calendar/Calendar.js +16 -12
- package/lib/components/calendar/Calendar.js.map +2 -2
- package/lib/components/calendar/YearsView.js +3 -3
- package/lib/components/calendar/YearsView.js.map +2 -2
- package/lib/components/formula/Editor.d.ts +3 -1
- package/lib/components/formula/Editor.js +20 -2
- package/lib/components/formula/Editor.js.map +2 -2
- package/lib/components/formula/Picker.d.ts +5 -0
- package/lib/components/formula/Picker.js +19 -4
- package/lib/components/formula/Picker.js.map +2 -2
- package/lib/factory.d.ts +4 -0
- package/lib/factory.js +8 -2
- package/lib/factory.js.map +2 -2
- package/lib/index.js +1 -1
- package/lib/locale/de-DE.js +13 -0
- package/lib/locale/de-DE.js.map +2 -2
- package/lib/locale/en-US.js +13 -0
- package/lib/locale/en-US.js.map +2 -2
- package/lib/locale/zh-CN.js +13 -0
- package/lib/locale/zh-CN.js.map +2 -2
- package/lib/renderers/Action.d.ts +2 -0
- package/lib/renderers/Action.js +23 -5
- package/lib/renderers/Action.js.map +2 -2
- package/lib/renderers/Carousel.d.ts +1 -0
- package/lib/renderers/Carousel.js +13 -1
- package/lib/renderers/Carousel.js.map +2 -2
- package/lib/renderers/Dialog.d.ts +4 -0
- package/lib/renderers/Dialog.js +4 -3
- package/lib/renderers/Dialog.js.map +2 -2
- package/lib/renderers/DropDownButton.d.ts +2 -0
- package/lib/renderers/DropDownButton.js +13 -4
- package/lib/renderers/DropDownButton.js.map +2 -2
- package/lib/renderers/Form/Checkboxes.d.ts +2 -2
- package/lib/renderers/Form/Checkboxes.js +2 -6
- package/lib/renderers/Form/Checkboxes.js.map +2 -2
- package/lib/renderers/Form/Combo.js +3 -2
- package/lib/renderers/Form/Combo.js.map +2 -2
- package/lib/renderers/Form/InputCity.d.ts +3 -0
- package/lib/renderers/Form/InputCity.js +44 -2
- package/lib/renderers/Form/InputCity.js.map +2 -2
- package/lib/renderers/Form/InputDateRange.d.ts +5 -0
- package/lib/renderers/Form/InputDateRange.js.map +2 -2
- package/lib/renderers/Form/InputFile.js +6 -3
- package/lib/renderers/Form/InputFile.js.map +2 -2
- package/lib/renderers/Form/InputFormula.d.ts +4 -0
- package/lib/renderers/Form/InputFormula.js +2 -2
- package/lib/renderers/Form/InputFormula.js.map +2 -2
- package/lib/renderers/Form/InputImage.js +6 -3
- package/lib/renderers/Form/InputImage.js.map +2 -2
- package/lib/renderers/Form/InputRange.js +13 -14
- package/lib/renderers/Form/InputRange.js.map +2 -2
- package/lib/renderers/Form/InputTable.js +4 -2
- package/lib/renderers/Form/InputTable.js.map +2 -2
- package/lib/renderers/Form/Item.d.ts +11 -6
- package/lib/renderers/Form/index.js +1 -1
- package/lib/renderers/Form/index.js.map +2 -2
- package/lib/renderers/Form/wrapControl.d.ts +9 -0
- package/lib/renderers/Form/wrapControl.js +1 -1
- package/lib/renderers/Form/wrapControl.js.map +2 -2
- package/lib/renderers/Nav.js +2 -2
- package/lib/renderers/Nav.js.map +2 -2
- package/lib/renderers/Page.js +2 -3
- package/lib/renderers/Page.js.map +2 -2
- package/lib/renderers/Progress.d.ts +1 -1
- package/lib/renderers/Progress.js +1 -1
- package/lib/renderers/Progress.js.map +2 -2
- package/lib/renderers/Steps.d.ts +8 -0
- package/lib/renderers/Steps.js +2 -2
- package/lib/renderers/Steps.js.map +2 -2
- package/lib/renderers/Table/TableRow.js +1 -1
- package/lib/renderers/Table/TableRow.js.map +2 -2
- package/lib/renderers/Table/index.js +7 -3
- package/lib/renderers/Table/index.js.map +2 -2
- package/lib/renderers/Tabs.d.ts +4 -0
- package/lib/renderers/Tabs.js +22 -6
- package/lib/renderers/Tabs.js.map +2 -2
- package/lib/renderers/Wizard.d.ts +6 -3
- package/lib/renderers/Wizard.js +257 -152
- package/lib/renderers/Wizard.js.map +2 -2
- package/lib/store/index.d.ts +5 -0
- package/lib/store/index.js +14 -0
- package/lib/store/index.js.map +2 -2
- package/lib/store/table.js +4 -4
- package/lib/store/table.js.map +2 -2
- package/lib/themes/ang-ie11.css +194 -23
- package/lib/themes/ang.css +193 -22
- package/lib/themes/ang.css.map +1 -1
- package/lib/themes/antd-ie11.css +194 -23
- package/lib/themes/antd.css +193 -22
- package/lib/themes/antd.css.map +1 -1
- package/lib/themes/cxd-ie11.css +194 -23
- package/lib/themes/cxd.css +193 -22
- package/lib/themes/cxd.css.map +1 -1
- package/lib/themes/dark-ie11.css +194 -23
- package/lib/themes/dark.css +193 -22
- package/lib/themes/dark.css.map +1 -1
- package/lib/themes/default-ie11.css +194 -23
- package/lib/themes/default.css +193 -22
- 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/columnsSplit.d.ts +1 -0
- package/lib/utils/columnsSplit.js +40 -0
- package/lib/utils/columnsSplit.js.map +13 -0
- package/lib/utils/debug.d.ts +1 -1
- package/lib/utils/debug.js +16 -22
- package/lib/utils/debug.js.map +2 -2
- package/package.json +1 -1
- package/schema.json +181 -30
- package/scss/_properties.scss +2 -2
- package/scss/components/_barcode.scss +1 -1
- package/scss/components/_carousel.scss +1 -0
- package/scss/components/_debug.scss +3 -3
- package/scss/components/_formula.scss +18 -0
- package/scss/components/_progress.scss +3 -8
- package/scss/components/_steps.scss +199 -8
- package/scss/components/form/_date.scss +14 -0
- package/scss/components/form/_editor.scss +2 -1
- package/sdk/ang-ie11.css +234 -25
- package/sdk/ang.css +233 -24
- package/sdk/antd-ie11.css +234 -25
- package/sdk/antd.css +233 -24
- 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 +234 -25
- package/sdk/cxd.css +233 -24
- package/sdk/dark-ie11.css +234 -25
- package/sdk/dark.css +233 -24
- package/sdk/exceljs.js +1 -1
- package/sdk/locale/de-DE.js +13 -0
- package/sdk/markdown.js +69 -69
- package/sdk/papaparse.js +1 -1
- package/sdk/renderers/Form/CityDB.js +1 -1
- package/sdk/rest.js +17 -17
- package/sdk/rich-text.js +62 -62
- package/sdk/sdk-ie11.css +234 -25
- package/sdk/sdk.css +233 -24
- package/sdk/sdk.js +1290 -1288
- 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/SchemaRenderer.tsx +32 -14
- package/src/WithStore.tsx +3 -1
- package/src/actions/CmptAction.ts +18 -0
- package/src/components/BarCode.tsx +2 -2
- package/src/components/DatePicker.tsx +77 -22
- package/src/components/DateRangePicker.tsx +198 -4
- package/src/components/Progress.tsx +8 -12
- package/src/components/Radios.tsx +6 -17
- package/src/components/Range.tsx +26 -12
- package/src/components/Steps.tsx +28 -27
- package/src/components/calendar/Calendar.tsx +17 -12
- package/src/components/calendar/YearsView.tsx +3 -4
- package/src/components/formula/Editor.tsx +34 -3
- package/src/components/formula/Picker.tsx +28 -1
- package/src/factory.tsx +15 -2
- package/src/locale/de-DE.ts +13 -0
- package/src/locale/en-US.ts +13 -0
- package/src/locale/zh-CN.ts +13 -0
- package/src/renderers/Action.tsx +22 -1
- package/src/renderers/Carousel.tsx +8 -0
- package/src/renderers/Dialog.tsx +17 -3
- package/src/renderers/DropDownButton.tsx +14 -3
- package/src/renderers/Form/Checkboxes.tsx +5 -18
- package/src/renderers/Form/Combo.tsx +2 -3
- package/src/renderers/Form/InputCity.tsx +33 -4
- package/src/renderers/Form/InputDateRange.tsx +8 -1
- package/src/renderers/Form/InputFile.tsx +7 -3
- package/src/renderers/Form/InputFormula.tsx +7 -0
- package/src/renderers/Form/InputImage.tsx +7 -3
- package/src/renderers/Form/InputRange.tsx +18 -16
- package/src/renderers/Form/InputTable.tsx +6 -2
- package/src/renderers/Form/index.tsx +1 -1
- package/src/renderers/Form/wrapControl.tsx +1 -1
- package/src/renderers/Nav.tsx +1 -1
- package/src/renderers/Page.tsx +1 -2
- package/src/renderers/Progress.tsx +2 -2
- package/src/renderers/Steps.tsx +14 -0
- package/src/renderers/Table/TableRow.tsx +1 -1
- package/src/renderers/Table/index.tsx +11 -2
- package/src/renderers/Tabs.tsx +75 -28
- package/src/renderers/Wizard.tsx +154 -93
- package/src/store/index.ts +20 -0
- package/src/store/table.ts +4 -4
- package/src/types.ts +3 -1
- package/src/utils/columnsSplit.tsx +57 -0
- package/src/utils/debug.tsx +17 -24
@@ -7,10 +7,11 @@ import {
|
|
7
7
|
} from './Options';
|
8
8
|
import cx from 'classnames';
|
9
9
|
import Checkbox from '../../components/Checkbox';
|
10
|
-
|
10
|
+
|
11
11
|
import {Icon} from '../../components/icons';
|
12
12
|
import {Api} from '../../types';
|
13
13
|
import {autobind, hasAbility} from '../../utils/helper';
|
14
|
+
import {columnsSplit} from '../../utils/columnsSplit';
|
14
15
|
|
15
16
|
/**
|
16
17
|
* 复选框
|
@@ -32,7 +33,7 @@ export interface CheckboxesControlSchema extends FormOptionsControl {
|
|
32
33
|
/**
|
33
34
|
* 每行显示多少个
|
34
35
|
*/
|
35
|
-
columnsCount?: number;
|
36
|
+
columnsCount?: number | number[];
|
36
37
|
}
|
37
38
|
|
38
39
|
export interface CheckboxesProps
|
@@ -47,7 +48,7 @@ export interface CheckboxesProps
|
|
47
48
|
> {
|
48
49
|
placeholder?: any;
|
49
50
|
itemClassName?: string;
|
50
|
-
columnsCount?: number;
|
51
|
+
columnsCount?: number | number[];
|
51
52
|
labelClassName?: string;
|
52
53
|
onAdd?: () => void;
|
53
54
|
addApi?: Api;
|
@@ -221,21 +222,7 @@ export default class CheckboxesControl extends React.Component<
|
|
221
222
|
);
|
222
223
|
}
|
223
224
|
|
224
|
-
|
225
|
-
let weight = 12 / (columnsCount as number);
|
226
|
-
let cellClassName = `Grid-col--sm${
|
227
|
-
weight === Math.round(weight) ? weight : ''
|
228
|
-
}`;
|
229
|
-
body = chunk(body, columnsCount).map((group, groupIndex) => (
|
230
|
-
<div className={cx('Grid')} key={groupIndex}>
|
231
|
-
{Array.from({length: columnsCount as number}).map((_, index) => (
|
232
|
-
<div key={index} className={cx(cellClassName)}>
|
233
|
-
{group[index]}
|
234
|
-
</div>
|
235
|
-
))}
|
236
|
-
</div>
|
237
|
-
));
|
238
|
-
}
|
225
|
+
body = columnsSplit(body, cx, columnsCount);
|
239
226
|
|
240
227
|
return (
|
241
228
|
<div className={cx(`CheckboxesControl`, className)}>
|
@@ -642,7 +642,8 @@ export default class ComboControl extends React.Component<ComboProps> {
|
|
642
642
|
|
643
643
|
if (
|
644
644
|
syncDefaultValue === false ||
|
645
|
-
this.subFormDefaultValues.length !==
|
645
|
+
this.subFormDefaultValues.length !==
|
646
|
+
this.subForms.filter(item => item !== undefined).length
|
646
647
|
) {
|
647
648
|
return;
|
648
649
|
}
|
@@ -1372,9 +1373,7 @@ export default class ComboControl extends React.Component<ComboProps> {
|
|
1372
1373
|
)
|
1373
1374
|
) : (
|
1374
1375
|
<Button
|
1375
|
-
level="default"
|
1376
1376
|
className={cx(`Combo-addBtn`, addButtonClassName)}
|
1377
|
-
block
|
1378
1377
|
tooltip={__('Combo.add')}
|
1379
1378
|
onClick={this.addItem}
|
1380
1379
|
>
|
@@ -4,7 +4,8 @@ import {ClassNamesFn, themeable, ThemeProps} from '../../theme';
|
|
4
4
|
import Spinner from '../../components/Spinner';
|
5
5
|
import Select from '../../components/Select';
|
6
6
|
import CityArea from '../../components/CityArea';
|
7
|
-
import {autobind, isMobile} from '../../utils/helper';
|
7
|
+
import {autobind, isMobile, createObject} from '../../utils/helper';
|
8
|
+
import {Action} from '../../types';
|
8
9
|
import {Option} from './Options';
|
9
10
|
import {localeable, LocaleProps} from '../../locale';
|
10
11
|
|
@@ -432,10 +433,38 @@ export interface LocationControlProps extends FormControlProps {
|
|
432
433
|
allowStreet?: boolean;
|
433
434
|
}
|
434
435
|
export class LocationControl extends React.Component<LocationControlProps> {
|
436
|
+
|
437
|
+
@autobind
|
438
|
+
doAction(action: Action, data: object, throwErrors: boolean) {
|
439
|
+
const {resetValue, onChange} = this.props;
|
440
|
+
const actionType = action?.actionType as string;
|
441
|
+
|
442
|
+
if (!!~['clear', 'reset'].indexOf(actionType)) {
|
443
|
+
onChange(resetValue ?? '');
|
444
|
+
}
|
445
|
+
}
|
446
|
+
|
447
|
+
@autobind
|
448
|
+
async handleChange(value: number | string) {
|
449
|
+
const {dispatchEvent, data, onChange} = this.props;
|
450
|
+
|
451
|
+
const rendererEvent = await dispatchEvent(
|
452
|
+
'change',
|
453
|
+
createObject(data, {
|
454
|
+
value
|
455
|
+
})
|
456
|
+
);
|
457
|
+
|
458
|
+
if (rendererEvent?.prevented) {
|
459
|
+
return;
|
460
|
+
}
|
461
|
+
|
462
|
+
onChange(value);
|
463
|
+
}
|
464
|
+
|
435
465
|
render() {
|
436
466
|
const {
|
437
467
|
value,
|
438
|
-
onChange,
|
439
468
|
allowCity,
|
440
469
|
allowDistrict,
|
441
470
|
extractValue,
|
@@ -453,7 +482,7 @@ export class LocationControl extends React.Component<LocationControlProps> {
|
|
453
482
|
popOverContainer={
|
454
483
|
env && env.getModalContainer ? env.getModalContainer : undefined
|
455
484
|
}
|
456
|
-
onChange={
|
485
|
+
onChange={this.handleChange}
|
457
486
|
allowCity={allowCity}
|
458
487
|
allowDistrict={allowDistrict}
|
459
488
|
extractValue={extractValue}
|
@@ -466,7 +495,7 @@ export class LocationControl extends React.Component<LocationControlProps> {
|
|
466
495
|
<ThemedCity
|
467
496
|
searchable={searchable}
|
468
497
|
value={value}
|
469
|
-
onChange={
|
498
|
+
onChange={this.handleChange}
|
470
499
|
allowCity={allowCity}
|
471
500
|
allowDistrict={allowDistrict}
|
472
501
|
extractValue={extractValue}
|
@@ -7,9 +7,11 @@ import includes from 'lodash/includes';
|
|
7
7
|
import DateRangePicker, {
|
8
8
|
DateRangePicker as BaseDateRangePicker
|
9
9
|
} from '../../components/DateRangePicker';
|
10
|
-
import {
|
10
|
+
import {isMobile, createObject, autobind} from '../../utils/helper';
|
11
11
|
import {Action} from '../../types';
|
12
12
|
|
13
|
+
import type {ShortCuts} from '../../components/DatePicker';
|
14
|
+
|
13
15
|
/**
|
14
16
|
* DateRange 日期范围控件
|
15
17
|
* 文档:https://baidu.gitee.io/amis/docs/components/form/date-range
|
@@ -75,6 +77,11 @@ export interface DateRangeControlSchema extends FormBaseControl {
|
|
75
77
|
* 开启后变成非弹出模式,即内联模式。
|
76
78
|
*/
|
77
79
|
embed?: boolean;
|
80
|
+
|
81
|
+
/**
|
82
|
+
* 日期范围快捷键
|
83
|
+
*/
|
84
|
+
ranges?: string | Array<ShortCuts>;
|
78
85
|
}
|
79
86
|
|
80
87
|
export interface DateRangeProps
|
@@ -28,6 +28,7 @@ import {
|
|
28
28
|
SchemaUrlPath
|
29
29
|
} from '../../Schema';
|
30
30
|
import merge from 'lodash/merge';
|
31
|
+
import omit from 'lodash/omit';
|
31
32
|
|
32
33
|
/**
|
33
34
|
* File 文件上传控件
|
@@ -913,13 +914,16 @@ export default class FileControl extends React.Component<FileProps, FileState> {
|
|
913
914
|
}
|
914
915
|
|
915
916
|
syncAutoFill() {
|
916
|
-
const {autoFill, multiple, onBulkChange, data} = this.props;
|
917
|
-
|
917
|
+
const {autoFill, multiple, onBulkChange, data, name} = this.props;
|
918
|
+
// 排除自身的字段,否则会无限更新state
|
919
|
+
const excludeSelfAutoFill = omit(autoFill, name || '');
|
920
|
+
|
921
|
+
if (!isEmpty(excludeSelfAutoFill) && onBulkChange) {
|
918
922
|
const files = this.state.files.filter(
|
919
923
|
file => ~['uploaded', 'init', 'ready'].indexOf(file.state as string)
|
920
924
|
);
|
921
925
|
const toSync = dataMapping(
|
922
|
-
|
926
|
+
excludeSelfAutoFill,
|
923
927
|
multiple
|
924
928
|
? {
|
925
929
|
items: files
|
@@ -55,6 +55,11 @@ export interface InputFormulaControlSchema extends FormBaseControl {
|
|
55
55
|
*/
|
56
56
|
inputMode?: 'button' | 'input-button';
|
57
57
|
|
58
|
+
/**
|
59
|
+
* 外层input是否允许输入,否需要点击fx在弹窗中输入
|
60
|
+
*/
|
61
|
+
allowInput?: boolean;
|
62
|
+
|
58
63
|
/**
|
59
64
|
* 按钮图标
|
60
65
|
*/
|
@@ -139,6 +144,7 @@ export class InputFormulaRenderer extends React.Component<InputFormulaProps> {
|
|
139
144
|
className,
|
140
145
|
classPrefix: ns,
|
141
146
|
classnames: cx,
|
147
|
+
allowInput = true,
|
142
148
|
borderMode,
|
143
149
|
placeholder,
|
144
150
|
inputMode,
|
@@ -156,6 +162,7 @@ export class InputFormulaRenderer extends React.Component<InputFormulaProps> {
|
|
156
162
|
className={className}
|
157
163
|
value={value}
|
158
164
|
disabled={disabled}
|
165
|
+
allowInput={allowInput}
|
159
166
|
onChange={onChange}
|
160
167
|
evalMode={evalMode}
|
161
168
|
variables={variables}
|
@@ -31,6 +31,7 @@ import {
|
|
31
31
|
import {filter} from '../../utils/tpl';
|
32
32
|
import isPlainObject from 'lodash/isPlainObject';
|
33
33
|
import merge from 'lodash/merge';
|
34
|
+
import omit from 'lodash/omit';
|
34
35
|
|
35
36
|
/**
|
36
37
|
* Image 图片上传控件
|
@@ -817,13 +818,16 @@ export default class ImageControl extends React.Component<
|
|
817
818
|
}
|
818
819
|
|
819
820
|
syncAutoFill() {
|
820
|
-
const {autoFill, multiple, onBulkChange, data} = this.props;
|
821
|
-
|
821
|
+
const {autoFill, multiple, onBulkChange, data, name} = this.props;
|
822
|
+
// 排除自身的字段,否则会无限更新state
|
823
|
+
const excludeSelfAutoFill = omit(autoFill, name || '');
|
824
|
+
|
825
|
+
if (!isEmpty(excludeSelfAutoFill) && onBulkChange && this.initAutoFill) {
|
822
826
|
const files = this.state.files.filter(
|
823
827
|
file => ~['uploaded', 'init', 'ready'].indexOf(file.state as string)
|
824
828
|
);
|
825
829
|
const toSync = dataMapping(
|
826
|
-
|
830
|
+
excludeSelfAutoFill,
|
827
831
|
multiple
|
828
832
|
? {
|
829
833
|
items: files
|
@@ -271,7 +271,7 @@ export function formatValue(
|
|
271
271
|
max: max === undefined || max > props.max ? props.max : max
|
272
272
|
};
|
273
273
|
}
|
274
|
-
return +value
|
274
|
+
return +value < props.min ? props.min : Math.min(+value, props.max);
|
275
275
|
}
|
276
276
|
|
277
277
|
/**
|
@@ -284,11 +284,13 @@ export class Input extends React.Component<RangeItemProps, any> {
|
|
284
284
|
*/
|
285
285
|
@autobind
|
286
286
|
onChange(value: number) {
|
287
|
-
const {multiple, value: originValue, type} = this.props;
|
287
|
+
const {multiple, value: originValue, type, min} = this.props;
|
288
288
|
const _value = this.getValue(value, type);
|
289
289
|
|
290
290
|
this.props.updateValue(
|
291
|
-
multiple
|
291
|
+
multiple
|
292
|
+
? {...(originValue as MultipleValue), [type]: _value}
|
293
|
+
: value ?? min
|
292
294
|
);
|
293
295
|
}
|
294
296
|
|
@@ -334,7 +336,8 @@ export class Input extends React.Component<RangeItemProps, any> {
|
|
334
336
|
*/
|
335
337
|
getValue(value: string | number, type?: string) {
|
336
338
|
const {max, min, step, value: stateValue} = this.props as RangeItemProps;
|
337
|
-
|
339
|
+
// value为null、undefined时,取对应的min/max
|
340
|
+
value = value ?? (type === 'min' ? min : max);
|
338
341
|
// 校正value为step的倍数
|
339
342
|
let _value = Math.round(parseFloat(value + '') / step) * step;
|
340
343
|
// 同步value与步长小数位数
|
@@ -457,21 +460,26 @@ export default class RangeControl extends React.PureComponent<
|
|
457
460
|
}
|
458
461
|
|
459
462
|
componentDidUpdate(prevProps: RangeProps) {
|
460
|
-
const {value} = prevProps;
|
463
|
+
const {value, min, max} = prevProps;
|
461
464
|
const {
|
462
465
|
value: nextPropsValue,
|
463
466
|
multiple,
|
464
467
|
delimiter,
|
465
|
-
min,
|
466
|
-
max,
|
468
|
+
min: nextPropsMin,
|
469
|
+
max: nextPropsMax,
|
467
470
|
onChange
|
468
471
|
} = this.props;
|
469
|
-
|
472
|
+
|
473
|
+
if (
|
474
|
+
value !== nextPropsValue ||
|
475
|
+
min !== nextPropsMin ||
|
476
|
+
max !== nextPropsMax
|
477
|
+
) {
|
470
478
|
const value = formatValue(nextPropsValue, {
|
471
479
|
multiple,
|
472
480
|
delimiter,
|
473
|
-
min,
|
474
|
-
max
|
481
|
+
min: nextPropsMin,
|
482
|
+
max: nextPropsMax
|
475
483
|
});
|
476
484
|
this.setState({
|
477
485
|
value: this.getValue(value)
|
@@ -584,12 +592,6 @@ export default class RangeControl extends React.PureComponent<
|
|
584
592
|
region
|
585
593
|
} = props;
|
586
594
|
|
587
|
-
// 指定parts -> 重新计算步长
|
588
|
-
if (parts > 1) {
|
589
|
-
props.step = (props.max - props.min) / props.parts;
|
590
|
-
props.showSteps = true;
|
591
|
-
}
|
592
|
-
|
593
595
|
// 处理自定义json配置
|
594
596
|
let renderMarks:
|
595
597
|
| MarksType
|
@@ -1082,7 +1082,9 @@ export default class FormTable extends React.Component<TableProps, TableState> {
|
|
1082
1082
|
prefixRow,
|
1083
1083
|
formInited,
|
1084
1084
|
perPage,
|
1085
|
-
classnames: cx
|
1085
|
+
classnames: cx,
|
1086
|
+
rowClassName,
|
1087
|
+
rowClassNameExpr
|
1086
1088
|
} = this.props;
|
1087
1089
|
|
1088
1090
|
if (formInited === false) {
|
@@ -1131,7 +1133,9 @@ export default class FormTable extends React.Component<TableProps, TableState> {
|
|
1131
1133
|
expandConfig,
|
1132
1134
|
canAccessSuperData,
|
1133
1135
|
reUseRow: false,
|
1134
|
-
offset
|
1136
|
+
offset,
|
1137
|
+
rowClassName,
|
1138
|
+
rowClassNameExpr
|
1135
1139
|
}
|
1136
1140
|
)}
|
1137
1141
|
{(addable && showAddBtn !== false) || showPager ? (
|
@@ -1410,7 +1410,7 @@ export default class Form extends React.Component<FormProps, object> {
|
|
1410
1410
|
formHorizontal: horizontal,
|
1411
1411
|
controlWidth,
|
1412
1412
|
disabled: disabled || (control as Schema).disabled || form.loading,
|
1413
|
-
btnDisabled: form.loading || form.validating,
|
1413
|
+
btnDisabled: disabled || form.loading || form.validating,
|
1414
1414
|
onAction: this.handleAction,
|
1415
1415
|
onQuery: this.handleQuery,
|
1416
1416
|
onChange: this.handleChange,
|
@@ -353,7 +353,7 @@ export function wrapControl<
|
|
353
353
|
this.model.clearValueOnHidden &&
|
354
354
|
this.model.form?.deleteValueByName(this.model.name);
|
355
355
|
|
356
|
-
rootStore.removeStore(this.model);
|
356
|
+
isAlive(rootStore) && rootStore.removeStore(this.model);
|
357
357
|
}
|
358
358
|
delete this.model;
|
359
359
|
}
|
package/src/renderers/Nav.tsx
CHANGED
package/src/renderers/Page.tsx
CHANGED
@@ -853,7 +853,7 @@ export class PageRenderer extends Page {
|
|
853
853
|
throwErrors: boolean = false,
|
854
854
|
delegate?: IScopedContext
|
855
855
|
) {
|
856
|
-
const scoped = this.context as IScopedContext;
|
856
|
+
const scoped = delegate || (this.context as IScopedContext);
|
857
857
|
|
858
858
|
if (action.actionType === 'reload') {
|
859
859
|
action.target && scoped.reload(action.target, ctx);
|
@@ -877,7 +877,6 @@ export class PageRenderer extends Page {
|
|
877
877
|
action.reload &&
|
878
878
|
~['url', 'link', 'jump'].indexOf(action.actionType!)
|
879
879
|
) {
|
880
|
-
const scoped = delegate || (this.context as IScopedContext);
|
881
880
|
scoped.reload(action.reload, ctx);
|
882
881
|
}
|
883
882
|
}
|
@@ -59,7 +59,7 @@ export interface ProgressSchema extends BaseSchema {
|
|
59
59
|
animate?: boolean;
|
60
60
|
|
61
61
|
/**
|
62
|
-
*
|
62
|
+
* 进度条线的宽度
|
63
63
|
*/
|
64
64
|
strokeWidth?: number;
|
65
65
|
/**
|
@@ -95,7 +95,7 @@ export class ProgressField extends React.Component<ProgressProps, object> {
|
|
95
95
|
@autobind
|
96
96
|
format(value: number) {
|
97
97
|
const {valueTpl, render, data} = this.props;
|
98
|
-
return render(`progress-value`, valueTpl
|
98
|
+
return render(`progress-value`, valueTpl || '${value}%', {
|
99
99
|
data: createObject(data, {value})
|
100
100
|
});
|
101
101
|
}
|
package/src/renderers/Steps.tsx
CHANGED
@@ -70,6 +70,16 @@ export interface StepsSchema extends BaseSchema {
|
|
70
70
|
* 展示模式
|
71
71
|
*/
|
72
72
|
mode?: 'horizontal' | 'vertical';
|
73
|
+
|
74
|
+
/**
|
75
|
+
* 标签放置位置
|
76
|
+
*/
|
77
|
+
labelPlacement?: 'horizontal' | 'vertical';
|
78
|
+
|
79
|
+
/**
|
80
|
+
* 点状步骤条
|
81
|
+
*/
|
82
|
+
progressDot?: boolean;
|
73
83
|
}
|
74
84
|
|
75
85
|
export interface StepsProps
|
@@ -82,6 +92,8 @@ export function StepsCmpt(props: StepsProps) {
|
|
82
92
|
steps,
|
83
93
|
status,
|
84
94
|
mode,
|
95
|
+
labelPlacement,
|
96
|
+
progressDot,
|
85
97
|
data,
|
86
98
|
source,
|
87
99
|
config,
|
@@ -139,6 +151,8 @@ export function StepsCmpt(props: StepsProps) {
|
|
139
151
|
className={className}
|
140
152
|
status={status}
|
141
153
|
mode={mode}
|
154
|
+
progressDot={progressDot}
|
155
|
+
labelPlacement={labelPlacement}
|
142
156
|
useMobileUI={useMobileUI}
|
143
157
|
></Steps>
|
144
158
|
);
|
@@ -195,7 +195,7 @@ export class TableRow extends React.Component<TableRowProps> {
|
|
195
195
|
'is-checked': item.checked,
|
196
196
|
'is-modified': item.modified,
|
197
197
|
'is-moved': item.moved,
|
198
|
-
'is-expanded': item.expanded,
|
198
|
+
'is-expanded': item.expanded && item.expandable,
|
199
199
|
'is-expandable': item.expandable,
|
200
200
|
[`Table-tr--hasItemAction`]: itemAction,
|
201
201
|
[`Table-tr--odd`]: itemIndex % 2 === 0,
|
@@ -2310,9 +2310,18 @@ export default class Table extends React.Component<TableProps, object> {
|
|
2310
2310
|
});
|
2311
2311
|
worksheet.views = [{state: 'frozen', xSplit: 0, ySplit: 1}];
|
2312
2312
|
|
2313
|
-
|
2313
|
+
let exportColumns = toolbar.columns;
|
2314
|
+
if (isPureVariable(exportColumns)) {
|
2315
|
+
exportColumns = resolveVariableAndFilter(
|
2316
|
+
exportColumns,
|
2317
|
+
data,
|
2318
|
+
'| raw'
|
2319
|
+
);
|
2320
|
+
}
|
2321
|
+
|
2322
|
+
const filteredColumns = exportColumns
|
2314
2323
|
? columns.filter(column => {
|
2315
|
-
const filterColumnsNames =
|
2324
|
+
const filterColumnsNames = exportColumns!;
|
2316
2325
|
if (filterColumnsNames.indexOf(column.name) !== -1) {
|
2317
2326
|
return true;
|
2318
2327
|
}
|
package/src/renderers/Tabs.tsx
CHANGED
@@ -264,7 +264,11 @@ export default class Tabs extends React.Component<TabsProps, TabsState> {
|
|
264
264
|
|
265
265
|
// 初始化 tabs 数组,当从 source 获取数据源时
|
266
266
|
@autobind
|
267
|
-
initTabArray(
|
267
|
+
initTabArray(
|
268
|
+
tabs: Array<TabSource>,
|
269
|
+
source?: string,
|
270
|
+
data?: any
|
271
|
+
): [Array<TabSource>, boolean] {
|
268
272
|
if (!tabs) {
|
269
273
|
return [[], false];
|
270
274
|
}
|
@@ -325,16 +329,28 @@ export default class Tabs extends React.Component<TabsProps, TabsState> {
|
|
325
329
|
let localTabs = this.state.localTabs;
|
326
330
|
|
327
331
|
// 响应外部修改 tabs
|
328
|
-
const isTabsModified = isObjectShallowModified(
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
332
|
+
const isTabsModified = isObjectShallowModified(
|
333
|
+
{
|
334
|
+
tabs: props.tabs,
|
335
|
+
source: resolveVariableAndFilter(props.source, props.data, '| raw')
|
336
|
+
},
|
337
|
+
{
|
338
|
+
tabs: preProps.tabs,
|
339
|
+
source: resolveVariableAndFilter(
|
340
|
+
preProps.source,
|
341
|
+
preProps.data,
|
342
|
+
'| raw'
|
343
|
+
)
|
344
|
+
},
|
345
|
+
false
|
346
|
+
);
|
335
347
|
|
336
348
|
if (isTabsModified) {
|
337
|
-
const [newLocalTabs, isFromSource] = this.initTabArray(
|
349
|
+
const [newLocalTabs, isFromSource] = this.initTabArray(
|
350
|
+
props.tabs,
|
351
|
+
props.source,
|
352
|
+
props.data
|
353
|
+
);
|
338
354
|
|
339
355
|
this.setState({
|
340
356
|
localTabs: newLocalTabs,
|
@@ -343,7 +359,11 @@ export default class Tabs extends React.Component<TabsProps, TabsState> {
|
|
343
359
|
localTabs = newLocalTabs;
|
344
360
|
}
|
345
361
|
|
346
|
-
if (
|
362
|
+
if (
|
363
|
+
props.location &&
|
364
|
+
preProps.location &&
|
365
|
+
props.location.hash !== preProps.location.hash
|
366
|
+
) {
|
347
367
|
const hash = props.location.hash.substring(1);
|
348
368
|
if (!hash) {
|
349
369
|
return;
|
@@ -464,7 +484,10 @@ export default class Tabs extends React.Component<TabsProps, TabsState> {
|
|
464
484
|
tab.hash ? tab.hash === key : index === key
|
465
485
|
);
|
466
486
|
|
467
|
-
if (
|
487
|
+
if (
|
488
|
+
localTabs[tabIndex] &&
|
489
|
+
!isVisible(localTabs[tabIndex], this.props.data)
|
490
|
+
) {
|
468
491
|
let len = localTabs.length;
|
469
492
|
let i = tabIndex - 1 + len;
|
470
493
|
let tries = len - 1;
|
@@ -491,11 +514,14 @@ export default class Tabs extends React.Component<TabsProps, TabsState> {
|
|
491
514
|
body: '新增tab 内容'
|
492
515
|
} as TabSource);
|
493
516
|
|
494
|
-
this.setState(
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
|
517
|
+
this.setState(
|
518
|
+
{
|
519
|
+
localTabs: localTabs
|
520
|
+
},
|
521
|
+
() => {
|
522
|
+
this.switchTo(this.state.localTabs.length - 1);
|
523
|
+
}
|
524
|
+
);
|
499
525
|
}
|
500
526
|
|
501
527
|
@autobind
|
@@ -520,20 +546,23 @@ export default class Tabs extends React.Component<TabsProps, TabsState> {
|
|
520
546
|
}
|
521
547
|
|
522
548
|
@autobind
|
523
|
-
async handleDragChange(e: any){
|
549
|
+
async handleDragChange(e: any) {
|
524
550
|
const activeTab = this.resolveTabByKey(this.activeKey);
|
525
551
|
const originTabs: TabSource[] = this.state.localTabs.concat();
|
526
552
|
|
527
553
|
originTabs.splice(e.newIndex, 0, originTabs.splice(e.oldIndex, 1)[0]);
|
528
554
|
|
529
|
-
this.setState(
|
530
|
-
|
531
|
-
|
532
|
-
|
533
|
-
|
534
|
-
|
555
|
+
this.setState(
|
556
|
+
{
|
557
|
+
localTabs: originTabs
|
558
|
+
},
|
559
|
+
() => {
|
560
|
+
if (activeTab) {
|
561
|
+
const newActiveTabIndex = originTabs.indexOf(activeTab);
|
562
|
+
this.switchTo(newActiveTabIndex);
|
563
|
+
}
|
535
564
|
}
|
536
|
-
|
565
|
+
);
|
537
566
|
}
|
538
567
|
|
539
568
|
@autobind
|
@@ -571,9 +600,12 @@ export default class Tabs extends React.Component<TabsProps, TabsState> {
|
|
571
600
|
@autobind
|
572
601
|
async handleChange(key: any, name: any) {
|
573
602
|
const {dispatchEvent, data, onChange} = this.props;
|
574
|
-
const rendererEvent = await dispatchEvent(
|
575
|
-
|
576
|
-
|
603
|
+
const rendererEvent = await dispatchEvent(
|
604
|
+
'change',
|
605
|
+
createObject(data, {
|
606
|
+
value: key
|
607
|
+
})
|
608
|
+
);
|
577
609
|
if (rendererEvent?.prevented) {
|
578
610
|
return;
|
579
611
|
}
|
@@ -772,4 +804,19 @@ export default class Tabs extends React.Component<TabsProps, TabsState> {
|
|
772
804
|
@Renderer({
|
773
805
|
type: 'tabs'
|
774
806
|
})
|
775
|
-
export class TabsRenderer extends Tabs {
|
807
|
+
export class TabsRenderer extends Tabs {
|
808
|
+
static contextType = ScopedContext;
|
809
|
+
|
810
|
+
constructor(props: TabsProps, context: IScopedContext) {
|
811
|
+
super(props);
|
812
|
+
|
813
|
+
const scoped = context;
|
814
|
+
scoped.registerComponent(this);
|
815
|
+
}
|
816
|
+
|
817
|
+
componentWillUnmount() {
|
818
|
+
super.componentWillUnmount?.();
|
819
|
+
const scoped = this.context as IScopedContext;
|
820
|
+
scoped.unRegisterComponent(this);
|
821
|
+
}
|
822
|
+
}
|