amis 1.5.3 → 1.5.4
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/README.md +5 -0
- package/lib/components/Card.d.ts +96 -0
- package/lib/components/Card.js +85 -0
- package/lib/components/Card.js.map +13 -0
- package/lib/components/DatePicker.d.ts +85 -84
- package/lib/components/DatePicker.js.map +2 -2
- package/lib/components/DateRangePicker.d.ts +84 -84
- package/lib/components/MonthRangePicker.d.ts +84 -84
- package/lib/components/Picker.d.ts +503 -0
- package/lib/components/Picker.js +65 -0
- package/lib/components/Picker.js.map +13 -0
- package/lib/components/PickerColumn.d.ts +29 -459
- package/lib/components/PickerColumn.js +35 -44
- package/lib/components/PickerColumn.js.map +2 -2
- package/lib/components/Select.d.ts +238 -238
- package/lib/components/Select.js +9 -2
- package/lib/components/Select.js.map +2 -2
- package/lib/components/Selection.js +1 -4
- package/lib/components/Selection.js.map +2 -2
- package/lib/components/Switch.d.ts +6 -6
- package/lib/components/Switch.js.map +2 -2
- package/lib/components/calendar/Calendar.js +15 -0
- package/lib/components/calendar/Calendar.js.map +2 -2
- package/lib/components/calendar/DaysView.js +4 -4
- package/lib/components/calendar/DaysView.js.map +2 -2
- package/lib/components/calendar/TimeView.d.ts +10 -0
- package/lib/components/calendar/TimeView.js +55 -2
- package/lib/components/calendar/TimeView.js.map +2 -2
- package/lib/components/calendar/YearsView.d.ts +9 -0
- package/lib/components/calendar/YearsView.js +19 -0
- package/lib/components/calendar/YearsView.js.map +2 -2
- package/lib/index.js +1 -1
- package/lib/renderers/Card.d.ts +81 -13
- package/lib/renderers/Card.js +178 -81
- package/lib/renderers/Card.js.map +2 -2
- package/lib/renderers/Form/DiffEditor.d.ts +145 -37
- package/lib/renderers/Form/Editor.d.ts +144 -36
- package/lib/renderers/Form/Formula.js +5 -5
- package/lib/renderers/Form/Formula.js.map +2 -2
- package/lib/renderers/Form/InputCity.d.ts +84 -84
- package/lib/renderers/Form/InputFile.js +2 -2
- package/lib/renderers/Form/InputFile.js.map +2 -2
- package/lib/renderers/Form/index.js +10 -0
- package/lib/renderers/Form/index.js.map +2 -2
- package/lib/renderers/Form/wrapControl.js +3 -2
- package/lib/renderers/Form/wrapControl.js.map +2 -2
- package/lib/store/combo.d.ts +160 -40
- package/lib/store/form.d.ts +64 -16
- package/lib/store/formItem.d.ts +4 -2
- package/lib/store/formItem.js +11 -6
- package/lib/store/formItem.js.map +2 -2
- package/lib/store/table.d.ts +128 -32
- package/lib/themes/ang-ie11.css +177 -30
- package/lib/themes/ang.css +177 -30
- package/lib/themes/ang.css.map +1 -1
- package/lib/themes/antd-ie11.css +177 -30
- package/lib/themes/antd.css +177 -30
- package/lib/themes/antd.css.map +1 -1
- package/lib/themes/cxd-ie11.css +177 -30
- package/lib/themes/cxd.css +177 -30
- package/lib/themes/cxd.css.map +1 -1
- package/lib/themes/dark-ie11.css +177 -30
- package/lib/themes/dark.css +177 -30
- package/lib/themes/dark.css.map +1 -1
- package/lib/themes/default.css +177 -30
- package/lib/themes/default.css.map +1 -1
- package/lib/utils/helper.d.ts +7 -0
- package/lib/utils/helper.js +33 -1
- package/lib/utils/helper.js.map +2 -2
- package/package.json +2 -2
- package/schema.json +157 -13
- package/scss/_properties.scss +13 -2
- package/scss/components/_card.scss +155 -15
- package/scss/components/_nav.scss +1 -1
- package/scss/components/_picker-columns.scss +20 -14
- package/scss/components/form/_file.scss +2 -2
- package/scss/components/form/_selection.scss +4 -0
- package/scss/components/form/_switch.scss +6 -0
- package/sdk/ang-ie11.css +214 -40
- package/sdk/ang.css +216 -32
- package/sdk/antd-ie11.css +214 -40
- package/sdk/antd.css +216 -32
- package/sdk/charts.js +14 -14
- package/sdk/color-picker.js +65 -65
- package/sdk/cropperjs.js +2 -2
- package/sdk/cxd-ie11.css +206 -32
- package/sdk/cxd.css +216 -32
- package/sdk/dark-ie11.css +214 -40
- package/sdk/dark.css +216 -32
- package/sdk/exceljs.js +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 +18 -18
- package/sdk/rich-text.js +62 -62
- package/sdk/sdk-ie11.css +206 -32
- package/sdk/sdk.css +216 -32
- package/sdk/sdk.js +1190 -1186
- 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/components/Card.tsx +203 -0
- package/src/components/DatePicker.tsx +3 -0
- package/src/components/Picker.tsx +145 -0
- package/src/components/PickerColumn.tsx +58 -95
- package/src/components/Select.tsx +17 -12
- package/src/components/Selection.tsx +1 -4
- package/src/components/Switch.tsx +7 -7
- package/src/components/calendar/Calendar.tsx +18 -0
- package/src/components/calendar/DaysView.tsx +6 -4
- package/src/components/calendar/TimeView.tsx +80 -5
- package/src/components/calendar/YearsView.tsx +44 -1
- package/src/renderers/Card.tsx +299 -191
- package/src/renderers/Form/Formula.tsx +7 -5
- package/src/renderers/Form/InputFile.tsx +6 -2
- package/src/renderers/Form/index.tsx +12 -0
- package/src/renderers/Form/wrapControl.tsx +5 -2
- package/src/store/formItem.ts +12 -6
- package/src/utils/helper.ts +34 -0
@@ -36,7 +36,7 @@ import {LocaleProps, localeable} from '../locale';
|
|
36
36
|
import Spinner from './Spinner';
|
37
37
|
import {Option, Options} from '../Schema';
|
38
38
|
import {RemoteOptionsProps, withRemoteConfig} from './WithRemoteConfig';
|
39
|
-
import
|
39
|
+
import Picker from './Picker';
|
40
40
|
|
41
41
|
export {Option, Options};
|
42
42
|
|
@@ -569,7 +569,10 @@ export class Select extends React.Component<SelectProps, SelectState> {
|
|
569
569
|
);
|
570
570
|
}
|
571
571
|
|
572
|
-
handlePickerChange(selectItem: any, index: number, confirm
|
572
|
+
handlePickerChange(selectItem: any, index: number, confirm?: boolean) {
|
573
|
+
if (!this.props.multiple) {
|
574
|
+
selectItem = selectItem[0];
|
575
|
+
}
|
573
576
|
this.setState({
|
574
577
|
pickerSelectItem: selectItem
|
575
578
|
});
|
@@ -916,20 +919,22 @@ export class Select extends React.Component<SelectProps, SelectState> {
|
|
916
919
|
};
|
917
920
|
|
918
921
|
const mobileUI = isMobile() && useMobileUI;
|
922
|
+
const column = {
|
923
|
+
labelField: 'label',
|
924
|
+
options: filtedOptions
|
925
|
+
};
|
919
926
|
const menu = mobileUI ? (
|
920
|
-
<
|
921
|
-
|
922
|
-
labelField=
|
923
|
-
|
924
|
-
|
925
|
-
|
926
|
-
|
927
|
-
visibleItemCount={5}
|
928
|
-
options={filtedOptions}
|
927
|
+
<Picker
|
928
|
+
className={cx('PickerColumns-column', mobileClassName)}
|
929
|
+
labelField='label'
|
930
|
+
value={value[0]}
|
931
|
+
translate={this.props.translate}
|
932
|
+
locale={this.props.locale}
|
933
|
+
columns={[column]}
|
929
934
|
onChange={checkAll ? noop : this.handlePickerChange}
|
930
935
|
onClose={this.close}
|
931
936
|
onConfirm={this.confirm}
|
932
|
-
|
937
|
+
/>
|
933
938
|
) : (
|
934
939
|
<div
|
935
940
|
ref={this.menu}
|
@@ -126,10 +126,7 @@ export class BaseSelection<
|
|
126
126
|
|
127
127
|
@autobind
|
128
128
|
toggleAll() {
|
129
|
-
const {value, onChange, option2value, options
|
130
|
-
if (multiple) {
|
131
|
-
return;
|
132
|
-
}
|
129
|
+
const {value, onChange, option2value, options} = this.props;
|
133
130
|
|
134
131
|
let valueArray: Array<Option> = [];
|
135
132
|
|
@@ -28,15 +28,15 @@ interface SwitchProps {
|
|
28
28
|
className?: string;
|
29
29
|
classPrefix: string;
|
30
30
|
classnames: ClassNamesFn;
|
31
|
-
onChange?: (checked: boolean) => void;
|
32
|
-
value?:
|
31
|
+
onChange?: (checked: boolean | string | number) => void;
|
32
|
+
value?: boolean | string | number;
|
33
33
|
inline?: boolean;
|
34
|
-
trueValue?:
|
35
|
-
falseValue?:
|
34
|
+
trueValue?: boolean | string | number;
|
35
|
+
falseValue?: boolean | string | number;
|
36
36
|
disabled?: boolean;
|
37
37
|
readOnly?: boolean;
|
38
|
-
onText?:
|
39
|
-
offText?:
|
38
|
+
onText?: React.ReactNode;
|
39
|
+
offText?: React.ReactNode;
|
40
40
|
checked?: boolean;
|
41
41
|
}
|
42
42
|
|
@@ -59,7 +59,7 @@ export class Switch extends React.PureComponent<SwitchProps, any> {
|
|
59
59
|
return;
|
60
60
|
}
|
61
61
|
|
62
|
-
onChange(e.currentTarget.checked ? trueValue : falseValue);
|
62
|
+
onChange(e.currentTarget.checked ? trueValue! : falseValue!);
|
63
63
|
}
|
64
64
|
|
65
65
|
render() {
|
@@ -7,6 +7,7 @@ import CustomCalendarContainer from './CalendarContainer';
|
|
7
7
|
import cx from 'classnames';
|
8
8
|
import moment from 'moment';
|
9
9
|
import {themeable, ThemeOutterProps, ThemeProps} from '../../theme';
|
10
|
+
import {convertDateArrayToDate} from "../../utils/helper";
|
10
11
|
|
11
12
|
interface BaseDatePickerProps
|
12
13
|
extends Omit<ReactDatePicker.DatetimepickerProps, 'viewMode'> {
|
@@ -191,6 +192,22 @@ class BaseDatePicker extends ReactDatePicker {
|
|
191
192
|
that.props.onChange(date);
|
192
193
|
};
|
193
194
|
|
195
|
+
onConfirm = (value: number[], types: string[]) => {
|
196
|
+
const currentDate = (this.state.selectedDate || this.state.viewDate || moment()).clone();
|
197
|
+
|
198
|
+
const date = convertDateArrayToDate(value, types, currentDate);
|
199
|
+
|
200
|
+
if (!this.props.value) {
|
201
|
+
this.setState({
|
202
|
+
selectedDate: date,
|
203
|
+
inputValue: date!.format(this.state.inputFormat)
|
204
|
+
});
|
205
|
+
}
|
206
|
+
this.props.onChange && this.props.onChange(date);
|
207
|
+
this.props.onClose && this.props.onClose();
|
208
|
+
}
|
209
|
+
|
210
|
+
|
194
211
|
render() {
|
195
212
|
const Component = CustomCalendarContainer as any;
|
196
213
|
const viewProps = this.getComponentProps();
|
@@ -202,6 +219,7 @@ class BaseDatePicker extends ReactDatePicker {
|
|
202
219
|
];
|
203
220
|
}
|
204
221
|
|
222
|
+
viewProps.onConfirm = this.onConfirm;
|
205
223
|
return (
|
206
224
|
<div className={cx('rdt rdtStatic rdtOpen', this.props.className)}>
|
207
225
|
<div key="dt" className="rdtPicker">
|
@@ -185,11 +185,12 @@ export class CustomDaysView extends DaysView {
|
|
185
185
|
const width = item.width || Math.min(moment(item.endTime).diff(moment(item.startTime), 'days') + 1, 7 - moment(item.startTime).weekday());
|
186
186
|
return <div key={props.key + 'content' + index}
|
187
187
|
className={cx('ScheduleCalendar-large-schedule-content', item.className)}
|
188
|
-
style={{width: width + '00%'}}
|
188
|
+
style={{width: width + '00%'}}
|
189
|
+
onClick={() => this.props.onScheduleClick && this.props.onScheduleClick(scheduleData)}>
|
189
190
|
<div className={cx('ScheduleCalendar-text-overflow')}>{item.content}</div>
|
190
191
|
</div>;
|
191
192
|
});
|
192
|
-
return <td {...props}
|
193
|
+
return <td {...props}>
|
193
194
|
<div className={cx('ScheduleCalendar-large-day-wrap')}>
|
194
195
|
<div className={cx('ScheduleCalendar-large-schedule-header')}>{currentDate.date()}</div>
|
195
196
|
{scheduleDiv}
|
@@ -199,8 +200,9 @@ export class CustomDaysView extends DaysView {
|
|
199
200
|
}
|
200
201
|
|
201
202
|
// 正常模式
|
202
|
-
const ScheduleIcon = <span className={cx('ScheduleCalendar-icon', schedule[0].className)}
|
203
|
-
|
203
|
+
const ScheduleIcon = <span className={cx('ScheduleCalendar-icon', schedule[0].className)}
|
204
|
+
onClick={() => this.props.onScheduleClick && this.props.onScheduleClick(scheduleData)}></span>;
|
205
|
+
return <td {...props}>
|
204
206
|
{currentDate.date()}
|
205
207
|
{ScheduleIcon}
|
206
208
|
</td>;
|
@@ -5,6 +5,9 @@ import React from 'react';
|
|
5
5
|
import {LocaleProps, localeable} from '../../locale';
|
6
6
|
import {Icon} from '../icons';
|
7
7
|
import {ClassNamesFn} from '../../theme';
|
8
|
+
import Picker from '../Picker';
|
9
|
+
import {PickerColumnItem} from '../PickerColumn';
|
10
|
+
import {getRange, isMobile} from "../../utils/helper";
|
8
11
|
|
9
12
|
export class CustomTimeView extends TimeView {
|
10
13
|
props: {
|
@@ -23,6 +26,9 @@ export class CustomTimeView extends TimeView {
|
|
23
26
|
timeFormat: string;
|
24
27
|
classnames: ClassNamesFn;
|
25
28
|
setTime: (type: string, value: any) => void;
|
29
|
+
onClose?: () => void;
|
30
|
+
onConfirm?: (value: number[], types: string[]) => void;
|
31
|
+
useMobileUI: boolean;
|
26
32
|
} & LocaleProps;
|
27
33
|
onStartClicking: any;
|
28
34
|
disableContextMenu: any;
|
@@ -68,10 +74,9 @@ export class CustomTimeView extends TimeView {
|
|
68
74
|
);
|
69
75
|
};
|
70
76
|
|
71
|
-
|
72
|
-
const cx = this.props.classnames;
|
77
|
+
getCounterValue = (type: string) => {
|
73
78
|
if (type !== 'daypart') {
|
74
|
-
|
79
|
+
let value = this.state[type];
|
75
80
|
if (
|
76
81
|
type === 'hours' &&
|
77
82
|
this.props.timeFormat.toLowerCase().indexOf(' a') !== -1
|
@@ -82,6 +87,15 @@ export class CustomTimeView extends TimeView {
|
|
82
87
|
value = 12;
|
83
88
|
}
|
84
89
|
}
|
90
|
+
return parseInt(value);
|
91
|
+
}
|
92
|
+
return 0;
|
93
|
+
}
|
94
|
+
|
95
|
+
renderCounter = (type: string) => {
|
96
|
+
const cx = this.props.classnames;
|
97
|
+
if (type !== 'daypart') {
|
98
|
+
const value = this.getCounterValue(type);
|
85
99
|
|
86
100
|
const {min, max, step} = this.timeConstraints[type];
|
87
101
|
|
@@ -134,10 +148,71 @@ export class CustomTimeView extends TimeView {
|
|
134
148
|
return null;
|
135
149
|
};
|
136
150
|
|
151
|
+
onConfirm = (value: number[]) => {
|
152
|
+
this.props.onConfirm && this.props.onConfirm(value, this.state.counters);
|
153
|
+
}
|
154
|
+
|
155
|
+
getDayPartOptions = () => {
|
156
|
+
const {translate: __} = this.props;
|
157
|
+
let options = ['am', 'pm'];
|
158
|
+
if ( this.props.timeFormat.indexOf( ' A' ) !== -1 ) {
|
159
|
+
options = ['AM', 'PM'];
|
160
|
+
}
|
161
|
+
|
162
|
+
return options.map(daypart => ({
|
163
|
+
text: __(daypart),
|
164
|
+
value: daypart
|
165
|
+
}));
|
166
|
+
}
|
167
|
+
|
168
|
+
renderTimeViewPicker = () => {
|
169
|
+
const columns: PickerColumnItem[] = [];
|
170
|
+
const values = [];
|
171
|
+
|
172
|
+
this.state.counters.forEach(type => {
|
173
|
+
if (type !== 'daypart') {
|
174
|
+
const counterValue: number = this.getCounterValue(type);
|
175
|
+
let {min, max, step} = this.timeConstraints[type];
|
176
|
+
// 修正am pm时hours可选最大值
|
177
|
+
if (type === 'hours'
|
178
|
+
&& this.state.daypart !== false
|
179
|
+
&& this.props.timeFormat.toLowerCase().indexOf(' a') !== -1) {
|
180
|
+
max = max > 12 ? 12 : max;
|
181
|
+
}
|
182
|
+
columns.push({
|
183
|
+
options: getRange(min, max, step)
|
184
|
+
});
|
185
|
+
values.push(counterValue);
|
186
|
+
}
|
187
|
+
});
|
188
|
+
if (this.state.daypart !== false) {
|
189
|
+
columns.push({
|
190
|
+
options: this.getDayPartOptions()
|
191
|
+
});
|
192
|
+
values.push(this.state.daypart)
|
193
|
+
}
|
194
|
+
|
195
|
+
return (
|
196
|
+
<Picker
|
197
|
+
translate={this.props.translate}
|
198
|
+
locale={this.props.locale}
|
199
|
+
columns={columns}
|
200
|
+
value={values}
|
201
|
+
onConfirm={this.onConfirm}
|
202
|
+
onClose={this.props.onClose}
|
203
|
+
/>
|
204
|
+
);
|
205
|
+
}
|
206
|
+
|
137
207
|
render() {
|
138
|
-
|
208
|
+
let counters: Array<JSX.Element | null> = [];
|
139
209
|
const cx = this.props.classnames;
|
140
|
-
|
210
|
+
|
211
|
+
if (isMobile() && this.props.useMobileUI) {
|
212
|
+
return <div className={cx('CalendarTime')}>
|
213
|
+
{this.renderTimeViewPicker()}
|
214
|
+
</div>
|
215
|
+
}
|
141
216
|
this.state.counters.forEach(c => {
|
142
217
|
if (counters.length) {
|
143
218
|
counters.push(
|
@@ -3,10 +3,13 @@ import YearsView from 'react-datetime/src/YearsView';
|
|
3
3
|
import moment from 'moment';
|
4
4
|
import React from 'react';
|
5
5
|
import {LocaleProps, localeable} from '../../locale';
|
6
|
+
import Picker from '../Picker';
|
7
|
+
import {convertDateToObject, getRange, isMobile} from "../../utils/helper";
|
6
8
|
|
7
9
|
export class CustomYearsView extends YearsView {
|
8
10
|
props: {
|
9
11
|
viewDate: moment.Moment;
|
12
|
+
selectedDate: moment.Moment;
|
10
13
|
subtractTime: (
|
11
14
|
amount: number,
|
12
15
|
type: string,
|
@@ -18,6 +21,12 @@ export class CustomYearsView extends YearsView {
|
|
18
21
|
toSelected?: moment.Moment
|
19
22
|
) => () => void;
|
20
23
|
showView: (view: string) => () => void;
|
24
|
+
minDate?: moment.Moment;
|
25
|
+
maxDate?: moment.Moment;
|
26
|
+
onChange?: () => void;
|
27
|
+
onClose?: () => void;
|
28
|
+
onConfirm?: (value: number[], types: string[]) => void;
|
29
|
+
useMobileUI: boolean;
|
21
30
|
} & LocaleProps;
|
22
31
|
renderYears: (year: number) => JSX.Element;
|
23
32
|
renderYear = (props: any, year: number) => {
|
@@ -27,11 +36,45 @@ export class CustomYearsView extends YearsView {
|
|
27
36
|
</td>
|
28
37
|
);
|
29
38
|
};
|
39
|
+
|
40
|
+
onConfirm = (value: number[]) => {
|
41
|
+
this.props.onConfirm && this.props.onConfirm(value, ["year"])
|
42
|
+
}
|
43
|
+
|
44
|
+
renderYearPicker = () => {
|
45
|
+
const {minDate, maxDate, selectedDate, viewDate} = this.props;
|
46
|
+
const year = (selectedDate || viewDate || moment()).year();
|
47
|
+
const maxYear = maxDate ? convertDateToObject(maxDate)!.year : year + 100;
|
48
|
+
const minYear = minDate ? convertDateToObject(minDate)!.year : year - 100;
|
49
|
+
|
50
|
+
const columns = [{
|
51
|
+
options: getRange(minYear, maxYear, 1)
|
52
|
+
}];
|
53
|
+
|
54
|
+
return (
|
55
|
+
<Picker
|
56
|
+
translate={this.props.translate}
|
57
|
+
locale={this.props.locale}
|
58
|
+
columns={columns}
|
59
|
+
value={[year]}
|
60
|
+
onConfirm={this.onConfirm}
|
61
|
+
onClose={this.props.onClose}
|
62
|
+
/>
|
63
|
+
);
|
64
|
+
};
|
65
|
+
|
30
66
|
render() {
|
31
67
|
let year = this.props.viewDate.year();
|
32
68
|
year = year - (year % 10);
|
33
69
|
const __ = this.props.translate;
|
34
|
-
|
70
|
+
|
71
|
+
if (isMobile() && this.props.useMobileUI) {
|
72
|
+
return (
|
73
|
+
<div className="rdtYears">
|
74
|
+
{this.renderYearPicker()}
|
75
|
+
</div>
|
76
|
+
);
|
77
|
+
}
|
35
78
|
return (
|
36
79
|
<div className="rdtYears">
|
37
80
|
<table>
|