amis 1.8.0-beta.1 → 1.8.0-beta.5
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/AssociatedSelection.js +9 -2
- package/lib/components/AssociatedSelection.js.map +2 -2
- package/lib/components/BarCode.js +1 -1
- package/lib/components/BarCode.js.map +2 -2
- package/lib/components/Checkbox.d.ts +24 -23
- package/lib/components/Checkbox.js +6 -2
- package/lib/components/Checkbox.js.map +2 -2
- package/lib/components/DatePicker.js +16 -5
- package/lib/components/DatePicker.js.map +2 -2
- package/lib/components/DateRangePicker.d.ts +94 -84
- package/lib/components/DateRangePicker.js +259 -7
- package/lib/components/DateRangePicker.js.map +2 -2
- package/lib/components/MonthRangePicker.d.ts +84 -84
- package/lib/components/Radios.d.ts +22 -22
- 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 +2 -14
- 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/factory.d.ts +4 -0
- package/lib/factory.js +9 -0
- 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/CRUD.d.ts +8 -0
- package/lib/renderers/CRUD.js +11 -4
- package/lib/renderers/CRUD.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/Form/Checkbox.d.ts +5 -2
- package/lib/renderers/Form/Checkbox.js +2 -2
- package/lib/renderers/Form/Checkbox.js.map +2 -2
- package/lib/renderers/Form/Checkboxes.d.ts +7 -2
- package/lib/renderers/Form/Checkboxes.js +101 -12
- 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/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/Item.d.ts +11 -6
- package/lib/renderers/Form/Item.js +3 -1
- package/lib/renderers/Form/Item.js.map +2 -2
- package/lib/renderers/Form/index.d.ts +1 -0
- 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/Steps.d.ts +8 -0
- package/lib/renderers/Steps.js +2 -2
- package/lib/renderers/Steps.js.map +2 -2
- package/lib/renderers/Table/index.d.ts +1 -0
- package/lib/renderers/Table/index.js +10 -5
- 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/crud.d.ts +1 -0
- package/lib/store/crud.js +33 -7
- package/lib/store/crud.js.map +2 -2
- package/lib/store/formItem.js +1 -1
- package/lib/store/formItem.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 +2 -2
- package/lib/store/table.js.map +2 -2
- package/lib/themes/ang-ie11.css +278 -17
- package/lib/themes/ang.css +286 -17
- package/lib/themes/ang.css.map +1 -1
- package/lib/themes/antd-ie11.css +278 -17
- package/lib/themes/antd.css +286 -17
- package/lib/themes/antd.css.map +1 -1
- package/lib/themes/cxd-ie11.css +278 -17
- package/lib/themes/cxd.css +286 -17
- package/lib/themes/cxd.css.map +1 -1
- package/lib/themes/dark-ie11.css +278 -17
- package/lib/themes/dark.css +286 -17
- package/lib/themes/dark.css.map +1 -1
- package/lib/themes/default-ie11.css +278 -17
- package/lib/themes/default.css +286 -17
- 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 +237 -29
- package/scss/_properties.scss +10 -1
- package/scss/components/_barcode.scss +1 -1
- package/scss/components/_carousel.scss +1 -0
- package/scss/components/_debug.scss +3 -3
- package/scss/components/_steps.scss +199 -8
- package/scss/components/form/_checks.scss +122 -1
- package/scss/components/form/_date.scss +2 -1
- package/scss/components/form/_editor.scss +2 -1
- package/scss/components/form/_form.scss +16 -0
- package/sdk/ang-ie11.css +335 -18
- package/sdk/ang.css +343 -18
- package/sdk/antd-ie11.css +335 -18
- package/sdk/antd.css +343 -18
- 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 +335 -18
- package/sdk/cxd.css +343 -18
- package/sdk/dark-ie11.css +335 -18
- package/sdk/dark.css +343 -18
- 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 +335 -18
- package/sdk/sdk.css +343 -18
- package/sdk/sdk.js +1289 -1287
- 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/AssociatedSelection.tsx +9 -3
- package/src/components/BarCode.tsx +2 -2
- package/src/components/Checkbox.tsx +11 -5
- package/src/components/DatePicker.tsx +21 -4
- package/src/components/DateRangePicker.tsx +295 -6
- 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 +2 -15
- package/src/components/calendar/YearsView.tsx +3 -4
- package/src/factory.tsx +16 -0
- 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/CRUD.tsx +22 -4
- package/src/renderers/Carousel.tsx +8 -0
- package/src/renderers/Form/Checkbox.tsx +11 -2
- package/src/renderers/Form/Checkboxes.tsx +106 -23
- 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/InputImage.tsx +7 -3
- package/src/renderers/Form/InputRange.tsx +18 -16
- package/src/renderers/Form/Item.tsx +1 -0
- package/src/renderers/Form/index.tsx +2 -1
- package/src/renderers/Form/wrapControl.tsx +1 -1
- package/src/renderers/Nav.tsx +1 -1
- package/src/renderers/Steps.tsx +14 -0
- package/src/renderers/Table/index.tsx +15 -4
- package/src/renderers/Tabs.tsx +75 -28
- package/src/renderers/Wizard.tsx +154 -93
- package/src/store/crud.ts +40 -5
- package/src/store/formItem.ts +1 -2
- package/src/store/index.ts +20 -0
- package/src/store/table.ts +2 -2
- 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;
|
@@ -55,6 +56,7 @@ export interface CheckboxesProps
|
|
55
56
|
createBtnLabel: string;
|
56
57
|
editable?: boolean;
|
57
58
|
removable?: boolean;
|
59
|
+
optionType?: 'default' | 'button'
|
58
60
|
}
|
59
61
|
|
60
62
|
export default class CheckboxesControl extends React.Component<
|
@@ -67,7 +69,8 @@ export default class CheckboxesControl extends React.Component<
|
|
67
69
|
placeholder: 'placeholder.noOption',
|
68
70
|
creatable: false,
|
69
71
|
inline: true,
|
70
|
-
createBtnLabel: 'Select.createLabel'
|
72
|
+
createBtnLabel: 'Select.createLabel',
|
73
|
+
optionType: 'default'
|
71
74
|
};
|
72
75
|
|
73
76
|
reload() {
|
@@ -97,6 +100,97 @@ export default class CheckboxesControl extends React.Component<
|
|
97
100
|
onDelete && onDelete(item);
|
98
101
|
}
|
99
102
|
|
103
|
+
componentDidMount() {
|
104
|
+
this.updateBorderStyle();
|
105
|
+
window.addEventListener('resize', this.updateBorderStyle);
|
106
|
+
}
|
107
|
+
|
108
|
+
componentWillMount() {
|
109
|
+
window.removeEventListener('resize', this.updateBorderStyle);
|
110
|
+
}
|
111
|
+
|
112
|
+
@autobind
|
113
|
+
updateBorderStyle() {
|
114
|
+
if (this.props.optionType !== 'button') {
|
115
|
+
return;
|
116
|
+
}
|
117
|
+
const wrapDom = this.refs.checkboxRef as HTMLElement;
|
118
|
+
const wrapWidth = wrapDom.clientWidth;
|
119
|
+
const childs = Array.from(wrapDom.children) as HTMLElement[];
|
120
|
+
|
121
|
+
childs.forEach(child => {
|
122
|
+
child.style.borderRadius = '0';
|
123
|
+
child.style.borderLeftWidth = '1px';
|
124
|
+
child.style.borderTopWidth = '1px';
|
125
|
+
});
|
126
|
+
const childTotalWidth = childs.reduce((pre, next) =>
|
127
|
+
pre + next.clientWidth, 0);
|
128
|
+
if (childTotalWidth <= wrapWidth) {
|
129
|
+
if (childs.length === 1) {
|
130
|
+
childs[0].style.borderRadius = "4px";
|
131
|
+
}
|
132
|
+
else {
|
133
|
+
childs[0].style.borderRadius = "4px 0 0 4px";
|
134
|
+
childs[childs.length - 1].style.borderRadius = "0 4px 4px 0";
|
135
|
+
childs.forEach((child, idx) => {
|
136
|
+
idx !== 0 && (child.style.borderLeftWidth = '0');
|
137
|
+
});
|
138
|
+
}
|
139
|
+
}
|
140
|
+
else {
|
141
|
+
let curRowWidth = 0;
|
142
|
+
let curRow = 0;
|
143
|
+
const rowNum = Math.floor(childTotalWidth / wrapWidth);
|
144
|
+
const rowColArr: any[] = [];
|
145
|
+
for (let i = 0; i <= rowNum; i++) {
|
146
|
+
const arr: HTMLElement[] = [];
|
147
|
+
rowColArr[i] = arr;
|
148
|
+
}
|
149
|
+
childs.forEach((child: HTMLElement, idx: number) => {
|
150
|
+
curRowWidth += child.clientWidth;
|
151
|
+
if (curRowWidth > wrapWidth) {
|
152
|
+
curRowWidth = child.clientWidth;
|
153
|
+
curRow++;
|
154
|
+
}
|
155
|
+
if (curRow > rowNum) {
|
156
|
+
return;
|
157
|
+
}
|
158
|
+
rowColArr[curRow].push(child);
|
159
|
+
});
|
160
|
+
|
161
|
+
rowColArr.forEach((row: HTMLElement[], rowIdx: number) => {
|
162
|
+
if (rowIdx === 0) {
|
163
|
+
row.forEach((r: HTMLElement, colIdx: number) => {
|
164
|
+
r.style.borderRadius = '0';
|
165
|
+
colIdx !== 0 && (r.style.borderLeftWidth = '0');
|
166
|
+
row.length > rowColArr[rowIdx + 1].length
|
167
|
+
&& (row[row.length - 1].style.borderBottomRightRadius = "4px");
|
168
|
+
});
|
169
|
+
row[0].style.borderTopLeftRadius = "4px";
|
170
|
+
row[row.length - 1].style.borderTopRightRadius = "4px";
|
171
|
+
}
|
172
|
+
else if (rowIdx === rowNum) {
|
173
|
+
row.forEach((r: HTMLElement, colIdx: number) => {
|
174
|
+
r.style.borderRadius = '0';
|
175
|
+
colIdx !== 0 && (r.style.borderLeftWidth = '0');
|
176
|
+
r.style.borderTopWidth = '0';
|
177
|
+
row[0].style.borderBottomLeftRadius = "4px";
|
178
|
+
row[row.length - 1].style.borderBottomRightRadius = "4px";
|
179
|
+
});
|
180
|
+
}
|
181
|
+
else {
|
182
|
+
row.forEach((r: HTMLElement, colIdx: number) => {
|
183
|
+
r.style.borderRadius = '0';
|
184
|
+
colIdx !== 0 && (r.style.borderLeftWidth = '0');
|
185
|
+
r.style.borderTopWidth = '0';
|
186
|
+
row.length > rowColArr[rowIdx + 1].length
|
187
|
+
&& (row[row.length - 1].style.borderBottomRightRadius = "4px");
|
188
|
+
});
|
189
|
+
}
|
190
|
+
});
|
191
|
+
}
|
192
|
+
}
|
193
|
+
|
100
194
|
renderGroup(option: Option, index: number) {
|
101
195
|
const {classnames: cx, labelField} = this.props;
|
102
196
|
|
@@ -135,7 +229,8 @@ export default class CheckboxesControl extends React.Component<
|
|
135
229
|
labelField,
|
136
230
|
removable,
|
137
231
|
editable,
|
138
|
-
translate: __
|
232
|
+
translate: __,
|
233
|
+
optionType
|
139
234
|
} = this.props;
|
140
235
|
|
141
236
|
return (
|
@@ -148,6 +243,7 @@ export default class CheckboxesControl extends React.Component<
|
|
148
243
|
inline={inline}
|
149
244
|
labelClassName={labelClassName}
|
150
245
|
description={option.description}
|
246
|
+
optionType={optionType}
|
151
247
|
>
|
152
248
|
{String(option[labelField || 'label'])}
|
153
249
|
{removable && hasAbility(option, 'removable') ? (
|
@@ -190,7 +286,8 @@ export default class CheckboxesControl extends React.Component<
|
|
190
286
|
creatable,
|
191
287
|
addApi,
|
192
288
|
createBtnLabel,
|
193
|
-
translate: __
|
289
|
+
translate: __,
|
290
|
+
optionType
|
194
291
|
} = this.props;
|
195
292
|
|
196
293
|
let body: Array<React.ReactNode> = [];
|
@@ -199,7 +296,7 @@ export default class CheckboxesControl extends React.Component<
|
|
199
296
|
body = options.map((option, key) => this.renderItem(option, key));
|
200
297
|
}
|
201
298
|
|
202
|
-
if (checkAll && body.length) {
|
299
|
+
if (checkAll && body.length && optionType === 'default') {
|
203
300
|
body.unshift(
|
204
301
|
<Checkbox
|
205
302
|
key="checkall"
|
@@ -221,24 +318,10 @@ export default class CheckboxesControl extends React.Component<
|
|
221
318
|
);
|
222
319
|
}
|
223
320
|
|
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
|
-
}
|
321
|
+
body = columnsSplit(body, cx, columnsCount);
|
239
322
|
|
240
323
|
return (
|
241
|
-
<div className={cx(`CheckboxesControl`, className)}>
|
324
|
+
<div className={cx(`CheckboxesControl`, className)} ref="checkboxRef">
|
242
325
|
{body && body.length ? (
|
243
326
|
body
|
244
327
|
) : (
|
@@ -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
|
@@ -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
|
@@ -552,6 +552,7 @@ export class FormItemWrap extends React.Component<FormItemProps> {
|
|
552
552
|
`Form-item Form-item--horizontal`,
|
553
553
|
className,
|
554
554
|
{
|
555
|
+
'Form-item--horizontal-justify': horizontal.justify,
|
555
556
|
[`is-error`]: model && !model.valid,
|
556
557
|
[`is-required`]: required
|
557
558
|
},
|
@@ -61,6 +61,7 @@ export interface FormSchemaHorizontal {
|
|
61
61
|
left?: number;
|
62
62
|
right?: number;
|
63
63
|
leftFixed?: boolean | number | 'xs' | 'sm' | 'md' | 'lg';
|
64
|
+
justify?: boolean; // 两端对齐
|
64
65
|
}
|
65
66
|
|
66
67
|
/**
|
@@ -1410,7 +1411,7 @@ export default class Form extends React.Component<FormProps, object> {
|
|
1410
1411
|
formHorizontal: horizontal,
|
1411
1412
|
controlWidth,
|
1412
1413
|
disabled: disabled || (control as Schema).disabled || form.loading,
|
1413
|
-
btnDisabled: form.loading || form.validating,
|
1414
|
+
btnDisabled: disabled || form.loading || form.validating,
|
1414
1415
|
onAction: this.handleAction,
|
1415
1416
|
onQuery: this.handleQuery,
|
1416
1417
|
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/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
|
);
|
@@ -472,6 +472,7 @@ export default class Table extends React.Component<TableProps, object> {
|
|
472
472
|
} = {};
|
473
473
|
renderedToolbars: Array<string> = [];
|
474
474
|
subForms: any = {};
|
475
|
+
timer: ReturnType<typeof setTimeout>;
|
475
476
|
|
476
477
|
constructor(props: TableProps) {
|
477
478
|
super(props);
|
@@ -659,7 +660,7 @@ export default class Table extends React.Component<TableProps, object> {
|
|
659
660
|
const footToolbarHeight = footToolbar ? offset(footToolbar).height : 0;
|
660
661
|
// 有时候会拿不到 footToolbar,等一下在执行
|
661
662
|
if (!footToolbarHeight && footerToolbar && footerToolbar.length) {
|
662
|
-
setTimeout(() => {
|
663
|
+
this.timer = setTimeout(() => {
|
663
664
|
this.updateAutoFillHeight();
|
664
665
|
}, 100);
|
665
666
|
return;
|
@@ -777,6 +778,7 @@ export default class Table extends React.Component<TableProps, object> {
|
|
777
778
|
this.unSensor && this.unSensor();
|
778
779
|
|
779
780
|
formItem && isAlive(formItem) && formItem.setSubStore(null);
|
781
|
+
clearTimeout(this.timer);
|
780
782
|
}
|
781
783
|
|
782
784
|
subFormRef(form: any, x: number, y: number) {
|
@@ -1662,7 +1664,7 @@ export default class Table extends React.Component<TableProps, object> {
|
|
1662
1664
|
{store.rows.length && multiple ? (
|
1663
1665
|
<Checkbox
|
1664
1666
|
classPrefix={ns}
|
1665
|
-
partial={!store.allChecked}
|
1667
|
+
partial={store.someChecked && !store.allChecked}
|
1666
1668
|
checked={store.someChecked}
|
1667
1669
|
disabled={store.disabledHeadCheckbox}
|
1668
1670
|
onChange={this.handleCheckAll}
|
@@ -2310,9 +2312,18 @@ export default class Table extends React.Component<TableProps, object> {
|
|
2310
2312
|
});
|
2311
2313
|
worksheet.views = [{state: 'frozen', xSplit: 0, ySplit: 1}];
|
2312
2314
|
|
2313
|
-
|
2315
|
+
let exportColumns = toolbar.columns;
|
2316
|
+
if (isPureVariable(exportColumns)) {
|
2317
|
+
exportColumns = resolveVariableAndFilter(
|
2318
|
+
exportColumns,
|
2319
|
+
data,
|
2320
|
+
'| raw'
|
2321
|
+
);
|
2322
|
+
}
|
2323
|
+
|
2324
|
+
const filteredColumns = exportColumns
|
2314
2325
|
? columns.filter(column => {
|
2315
|
-
const filterColumnsNames =
|
2326
|
+
const filterColumnsNames = exportColumns!;
|
2316
2327
|
if (filterColumnsNames.indexOf(column.name) !== -1) {
|
2317
2328
|
return true;
|
2318
2329
|
}
|