amis 1.5.6-beta.4 → 1.5.6-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/Schema.d.ts +1 -1
- package/lib/Schema.js.map +1 -1
- package/lib/components/AsideNav.d.ts +1 -1
- package/lib/components/AsideNav.js.map +1 -1
- package/lib/components/CodeMirror.d.ts +26 -0
- package/lib/components/CodeMirror.js +104 -0
- package/lib/components/CodeMirror.js.map +13 -0
- package/lib/components/Collapse.d.ts +22 -21
- package/lib/components/Collapse.js.map +2 -2
- package/lib/components/ColorPicker.d.ts +85 -84
- package/lib/components/ColorPicker.js +15 -3
- package/lib/components/ColorPicker.js.map +2 -2
- package/lib/components/DatePicker.js +7 -3
- package/lib/components/DatePicker.js.map +2 -2
- package/lib/components/DateRangePicker.d.ts +85 -84
- package/lib/components/DateRangePicker.js +5 -3
- package/lib/components/DateRangePicker.js.map +2 -2
- package/lib/components/MonthRangePicker.d.ts +85 -84
- package/lib/components/MonthRangePicker.js +5 -3
- package/lib/components/MonthRangePicker.js.map +2 -2
- package/lib/components/PickerContainer.d.ts +2 -1
- package/lib/components/PickerContainer.js +3 -3
- package/lib/components/PickerContainer.js.map +2 -2
- package/lib/components/PopUp.d.ts +93 -0
- package/lib/components/PopUp.js +58 -0
- package/lib/components/PopUp.js.map +13 -0
- package/lib/components/Steps.d.ts +1 -0
- package/lib/components/Steps.js +5 -3
- package/lib/components/Steps.js.map +2 -2
- package/lib/components/TabsTransferPicker.js +1 -1
- package/lib/components/TabsTransferPicker.js.map +2 -2
- package/lib/components/TransferPicker.d.ts +0 -1
- package/lib/components/TransferPicker.js +2 -15
- package/lib/components/TransferPicker.js.map +2 -2
- package/lib/components/formula/Editor.d.ts +560 -0
- package/lib/components/formula/Editor.js +186 -0
- package/lib/components/formula/Editor.js.map +13 -0
- package/lib/components/formula/FuncList.d.ts +67 -0
- package/lib/components/formula/FuncList.js +35 -0
- package/lib/components/formula/FuncList.js.map +13 -0
- package/lib/components/formula/Picker.d.ts +493 -0
- package/lib/components/formula/Picker.js +48 -0
- package/lib/components/formula/Picker.js.map +13 -0
- package/lib/components/formula/VariableList.d.ts +9 -0
- package/lib/components/formula/VariableList.js +15 -0
- package/lib/components/formula/VariableList.js.map +13 -0
- package/lib/components/formula/plugin.d.ts +18 -0
- package/lib/components/formula/plugin.js +136 -0
- package/lib/components/formula/plugin.js.map +13 -0
- package/lib/helper.css +57 -57
- 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/Form/InputColor.d.ts +84 -84
- package/lib/renderers/Form/InputColor.js +2 -2
- package/lib/renderers/Form/InputColor.js.map +2 -2
- package/lib/renderers/Form/InputDate.js +2 -2
- package/lib/renderers/Form/InputDate.js.map +2 -2
- package/lib/renderers/Form/InputDateRange.js +2 -2
- package/lib/renderers/Form/InputDateRange.js.map +2 -2
- package/lib/renderers/Form/InputFormula.d.ts +35 -0
- package/lib/renderers/Form/InputFormula.js +25 -0
- package/lib/renderers/Form/InputFormula.js.map +13 -0
- package/lib/renderers/Form/InputMonthRange.js +2 -2
- package/lib/renderers/Form/InputMonthRange.js.map +2 -2
- package/lib/renderers/Form/InputQuarterRange.js +2 -2
- package/lib/renderers/Form/InputQuarterRange.js.map +2 -2
- package/lib/renderers/Form/InputYearRange.js +2 -2
- package/lib/renderers/Form/InputYearRange.js.map +2 -2
- package/lib/renderers/Form/TreeSelect.d.ts +1 -0
- package/lib/renderers/Form/TreeSelect.js +11 -8
- package/lib/renderers/Form/TreeSelect.js.map +2 -2
- package/lib/renderers/Steps.js +2 -2
- package/lib/renderers/Steps.js.map +2 -2
- package/lib/themes/ang-ie11.css +261 -0
- package/lib/themes/ang.css +261 -0
- package/lib/themes/ang.css.map +1 -1
- package/lib/themes/antd-ie11.css +261 -0
- package/lib/themes/antd.css +261 -0
- package/lib/themes/antd.css.map +1 -1
- package/lib/themes/cxd-ie11.css +261 -0
- package/lib/themes/cxd.css +261 -0
- package/lib/themes/cxd.css.map +1 -1
- package/lib/themes/dark-ie11.css +261 -0
- package/lib/themes/dark.css +261 -0
- package/lib/themes/dark.css.map +1 -1
- package/lib/themes/default.css +261 -0
- package/lib/themes/default.css.map +1 -1
- package/lib/utils/api.js +2 -2
- package/lib/utils/api.js.map +2 -2
- package/package.json +4 -2
- package/scss/_variables.scss +1 -1
- package/scss/components/_formula.scss +122 -0
- package/scss/components/_popup.scss +123 -0
- package/scss/components/_steps.scss +60 -0
- package/scss/components/form/_color.scss +4 -0
- package/scss/components/form/_date-range.scss +4 -0
- package/scss/components/form/_date.scss +3 -0
- package/scss/components/form/_tree-select.scss +4 -0
- package/scss/helper/background/_background-color.scss +1 -1
- package/scss/helper/border/_border-color.scss +1 -1
- package/scss/helper/typography/_text-color.scss +1 -1
- package/scss/themes/_common.scss +2 -0
- package/sdk/ang-ie11.css +875 -0
- package/sdk/ang.css +875 -0
- package/sdk/antd-ie11.css +875 -0
- package/sdk/antd.css +875 -0
- package/sdk/charts.js +15 -15
- package/sdk/codemirror.js +14 -0
- package/sdk/color-picker.js +65 -65
- package/sdk/cropperjs.js +2 -2
- package/sdk/cxd-ie11.css +875 -0
- package/sdk/cxd.css +875 -0
- package/sdk/dark-ie11.css +875 -0
- package/sdk/dark.css +875 -0
- package/sdk/exceljs.js +1 -1
- package/sdk/helper.css +57 -57
- 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 +18 -18
- package/sdk/rich-text.js +62 -62
- package/sdk/sdk-ie11.css +875 -0
- package/sdk/sdk.css +875 -0
- package/sdk/sdk.js +1219 -1201
- 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/AsideNav.tsx +1 -1
- package/src/components/CodeMirror.tsx +99 -0
- package/src/components/Collapse.tsx +2 -1
- package/src/components/ColorPicker.tsx +45 -3
- package/src/components/DatePicker.tsx +33 -3
- package/src/components/DateRangePicker.tsx +17 -3
- package/src/components/MonthRangePicker.tsx +18 -4
- package/src/components/PickerContainer.tsx +10 -6
- package/src/components/PopUp.tsx +133 -0
- package/src/components/Steps.tsx +8 -3
- package/src/components/TabsTransferPicker.tsx +1 -1
- package/src/components/TransferPicker.tsx +1 -11
- package/src/components/formula/Editor.tsx +261 -0
- package/src/components/formula/FuncList.tsx +82 -0
- package/src/components/formula/Picker.tsx +86 -0
- package/src/components/formula/VariableList.tsx +49 -0
- package/src/components/formula/plugin.ts +177 -0
- package/src/index.tsx +1 -0
- package/src/renderers/Form/InputColor.tsx +2 -3
- package/src/renderers/Form/InputDate.tsx +2 -0
- package/src/renderers/Form/InputDateRange.tsx +2 -0
- package/src/renderers/Form/InputFormula.tsx +75 -0
- package/src/renderers/Form/InputMonthRange.tsx +2 -0
- package/src/renderers/Form/InputQuarterRange.tsx +2 -0
- package/src/renderers/Form/InputYearRange.tsx +2 -0
- package/src/renderers/Form/TreeSelect.tsx +82 -63
- package/src/renderers/Steps.tsx +4 -2
- package/src/utils/api.ts +5 -2
package/src/Schema.ts
CHANGED
@@ -0,0 +1,99 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import 'codemirror/lib/codemirror.css';
|
3
|
+
import type CodeMirror from 'codemirror';
|
4
|
+
import {autobind} from '../utils/helper';
|
5
|
+
import {resizeSensor} from '../utils/resize-sensor';
|
6
|
+
|
7
|
+
export interface CodeMirrorEditorProps {
|
8
|
+
className?: string;
|
9
|
+
value?: string;
|
10
|
+
onChange?: (value: string) => void;
|
11
|
+
onFocus?: (e: any) => void;
|
12
|
+
onBlur?: (e: any) => void;
|
13
|
+
editorFactory?: (
|
14
|
+
dom: HTMLElement,
|
15
|
+
cm: typeof CodeMirror,
|
16
|
+
props?: any
|
17
|
+
) => CodeMirror.Editor;
|
18
|
+
editorDidMount?: (cm: typeof CodeMirror, editor: CodeMirror.Editor) => void;
|
19
|
+
editorWillUnMount?: (
|
20
|
+
cm: typeof CodeMirror,
|
21
|
+
editor: CodeMirror.Editor
|
22
|
+
) => void;
|
23
|
+
}
|
24
|
+
|
25
|
+
export class CodeMirrorEditor extends React.Component<CodeMirrorEditorProps> {
|
26
|
+
dom = React.createRef<HTMLDivElement>();
|
27
|
+
|
28
|
+
editor?: CodeMirror.Editor;
|
29
|
+
toDispose: Array<() => void> = [];
|
30
|
+
unmounted = false;
|
31
|
+
async componentDidMount() {
|
32
|
+
const cm = (await import('codemirror')).default;
|
33
|
+
// @ts-ignore
|
34
|
+
await import('codemirror/mode/javascript/javascript');
|
35
|
+
// @ts-ignore
|
36
|
+
await import('codemirror/mode/htmlmixed/htmlmixed');
|
37
|
+
await import('codemirror/addon/mode/simple');
|
38
|
+
await import('codemirror/addon/mode/multiplex');
|
39
|
+
if (this.unmounted) {
|
40
|
+
return;
|
41
|
+
}
|
42
|
+
|
43
|
+
this.editor =
|
44
|
+
this.props.editorFactory?.(this.dom.current!, cm, this.props) ??
|
45
|
+
cm(this.dom.current!, {
|
46
|
+
value: this.props.value || ''
|
47
|
+
});
|
48
|
+
|
49
|
+
this.props.editorDidMount?.(cm, this.editor);
|
50
|
+
this.editor.on('change', this.handleChange);
|
51
|
+
|
52
|
+
this.toDispose.push(
|
53
|
+
resizeSensor(this.dom.current as HTMLElement, () =>
|
54
|
+
this.editor?.refresh()
|
55
|
+
)
|
56
|
+
);
|
57
|
+
// todo 以后优化这个,解决弹窗里面默认光标太小的问题
|
58
|
+
setTimeout(() => this.editor?.refresh(), 350);
|
59
|
+
this.toDispose.push(() => {
|
60
|
+
this.props.editorWillUnMount?.(cm, this.editor!);
|
61
|
+
});
|
62
|
+
}
|
63
|
+
|
64
|
+
componentDidUpdate(prevProps: CodeMirrorEditorProps) {
|
65
|
+
const props = this.props;
|
66
|
+
|
67
|
+
if (props.value !== prevProps.value) {
|
68
|
+
this.editor && this.setValue(props.value);
|
69
|
+
}
|
70
|
+
}
|
71
|
+
|
72
|
+
componentWillUnmount() {
|
73
|
+
this.unmounted = true;
|
74
|
+
this.editor?.off('change', this.handleChange);
|
75
|
+
this.toDispose.forEach(fn => fn());
|
76
|
+
this.toDispose = [];
|
77
|
+
}
|
78
|
+
|
79
|
+
@autobind
|
80
|
+
handleChange(editor: any) {
|
81
|
+
this.props.onChange?.(editor.getValue());
|
82
|
+
}
|
83
|
+
|
84
|
+
setValue(value?: string) {
|
85
|
+
const doc = this.editor!.getDoc();
|
86
|
+
if (value && value !== doc.getValue()) {
|
87
|
+
const cursor = doc.getCursor();
|
88
|
+
doc.setValue(value);
|
89
|
+
doc.setCursor(cursor);
|
90
|
+
}
|
91
|
+
}
|
92
|
+
|
93
|
+
render() {
|
94
|
+
const {className} = this.props;
|
95
|
+
return <div className={className} ref={this.dom}></div>;
|
96
|
+
}
|
97
|
+
}
|
98
|
+
|
99
|
+
export default CodeMirrorEditor;
|
@@ -26,13 +26,14 @@ const collapseStyles: {
|
|
26
26
|
export interface CollapseProps {
|
27
27
|
key?: string;
|
28
28
|
id?: string;
|
29
|
+
propKey?: string;
|
29
30
|
mountOnEnter?: boolean;
|
30
31
|
unmountOnExit?: boolean;
|
31
32
|
className?: string;
|
32
33
|
classPrefix: string;
|
33
34
|
classnames: ClassNamesFn;
|
34
35
|
headerPosition?: 'top' | 'bottom';
|
35
|
-
header?: React.
|
36
|
+
header?: React.ReactNode;
|
36
37
|
body: any;
|
37
38
|
bodyClassName?: string;
|
38
39
|
disabled?: boolean;
|
@@ -11,8 +11,9 @@ import {Icon} from './icons';
|
|
11
11
|
import Overlay from './Overlay';
|
12
12
|
import {uncontrollable} from 'uncontrollable';
|
13
13
|
import PopOver from './PopOver';
|
14
|
+
import PopUp from './PopUp';
|
14
15
|
import {ClassNamesFn, themeable, ThemeProps} from '../theme';
|
15
|
-
import {autobind, isObject} from '../utils/helper';
|
16
|
+
import {autobind, isMobile, isObject} from '../utils/helper';
|
16
17
|
import {localeable, LocaleProps} from '../locale';
|
17
18
|
|
18
19
|
export type PresetColor = {color: string; title: string} | string;
|
@@ -32,6 +33,7 @@ export interface ColorProps extends LocaleProps, ThemeProps {
|
|
32
33
|
presetColors?: PresetColor[];
|
33
34
|
resetValue?: string;
|
34
35
|
allowCustomColor?: boolean;
|
36
|
+
useMobileUI?: boolean;
|
35
37
|
}
|
36
38
|
|
37
39
|
export interface ColorControlState {
|
@@ -218,7 +220,8 @@ export class ColorControl extends React.PureComponent<
|
|
218
220
|
placement,
|
219
221
|
classnames: cx,
|
220
222
|
presetColors,
|
221
|
-
allowCustomColor
|
223
|
+
allowCustomColor,
|
224
|
+
useMobileUI
|
222
225
|
} = this.props;
|
223
226
|
|
224
227
|
const __ = this.props.translate;
|
@@ -270,7 +273,7 @@ export class ColorControl extends React.PureComponent<
|
|
270
273
|
<Icon icon="caret" className="icon" onClick={this.handleClick} />
|
271
274
|
</span>
|
272
275
|
|
273
|
-
{isOpened ? (
|
276
|
+
{!(useMobileUI && isMobile()) && isOpened ? (
|
274
277
|
<Overlay
|
275
278
|
placement={placement || 'auto'}
|
276
279
|
target={() => findDOMNode(this)}
|
@@ -317,6 +320,45 @@ export class ColorControl extends React.PureComponent<
|
|
317
320
|
</PopOver>
|
318
321
|
</Overlay>
|
319
322
|
) : null}
|
323
|
+
{
|
324
|
+
useMobileUI && isMobile() && (
|
325
|
+
<PopUp
|
326
|
+
className={cx(`${ns}ColorPicker-popup`)}
|
327
|
+
isShow={isOpened}
|
328
|
+
onHide={this.handleClick}
|
329
|
+
>
|
330
|
+
{allowCustomColor ? (
|
331
|
+
<SketchPicker
|
332
|
+
styles={{}}
|
333
|
+
disableAlpha={!!~['rgb', 'hex'].indexOf(format as string)}
|
334
|
+
color={value}
|
335
|
+
presetColors={presetColors}
|
336
|
+
onChangeComplete={this.handleChange}
|
337
|
+
/>
|
338
|
+
) : (
|
339
|
+
<GithubPicker
|
340
|
+
color={value}
|
341
|
+
colors={
|
342
|
+
Array.isArray(presetColors)
|
343
|
+
? (presetColors
|
344
|
+
.filter(
|
345
|
+
item => typeof item === 'string' || isObject(item)
|
346
|
+
)
|
347
|
+
.map(item =>
|
348
|
+
typeof item === 'string'
|
349
|
+
? item
|
350
|
+
: isObject(item)
|
351
|
+
? item?.color
|
352
|
+
: item
|
353
|
+
) as string[])
|
354
|
+
: undefined
|
355
|
+
}
|
356
|
+
onChangeComplete={this.handleChange}
|
357
|
+
/>
|
358
|
+
)}
|
359
|
+
</PopUp>
|
360
|
+
)
|
361
|
+
}
|
320
362
|
</div>
|
321
363
|
);
|
322
364
|
}
|
@@ -9,13 +9,14 @@ import moment from 'moment';
|
|
9
9
|
import 'moment/locale/zh-cn';
|
10
10
|
import {Icon} from './icons';
|
11
11
|
import PopOver from './PopOver';
|
12
|
+
import PopUp from './PopUp';
|
12
13
|
import Overlay from './Overlay';
|
13
14
|
import {ClassNamesFn, themeable, ThemeProps} from '../theme';
|
14
15
|
import {PlainObject} from '../types';
|
15
16
|
import Calendar from './calendar/Calendar';
|
16
17
|
import 'react-datetime/css/react-datetime.css';
|
17
|
-
import {localeable, LocaleProps, TranslateFn} from '../locale';
|
18
|
-
import {ucFirst} from '../utils/helper';
|
18
|
+
import { localeable, LocaleProps, TranslateFn } from '../locale';
|
19
|
+
import {isMobile, ucFirst} from '../utils/helper';
|
19
20
|
|
20
21
|
const availableShortcuts: {[propName: string]: any} = {
|
21
22
|
now: {
|
@@ -559,6 +560,7 @@ export class DatePicker extends React.Component<DateProps, DatePickerState> {
|
|
559
560
|
borderMode,
|
560
561
|
embed,
|
561
562
|
minDate,
|
563
|
+
useMobileUI,
|
562
564
|
schedules,
|
563
565
|
largeMode,
|
564
566
|
scheduleClassNames,
|
@@ -662,7 +664,7 @@ export class DatePicker extends React.Component<DateProps, DatePickerState> {
|
|
662
664
|
<Icon icon="clock" className="icon" />
|
663
665
|
</a>
|
664
666
|
|
665
|
-
{isOpened ? (
|
667
|
+
{!(useMobileUI && isMobile()) && isOpened ? (
|
666
668
|
<Overlay
|
667
669
|
target={this.getTarget}
|
668
670
|
container={popOverContainer || this.getParent}
|
@@ -698,6 +700,34 @@ export class DatePicker extends React.Component<DateProps, DatePickerState> {
|
|
698
700
|
</PopOver>
|
699
701
|
</Overlay>
|
700
702
|
) : null}
|
703
|
+
{
|
704
|
+
useMobileUI && isMobile() ? (
|
705
|
+
<PopUp
|
706
|
+
className={cx(`${ns}DatePicker-popup`)}
|
707
|
+
isShow={isOpened}
|
708
|
+
onHide={this.handleClick}
|
709
|
+
>
|
710
|
+
{this.renderShortCuts(shortcuts)}
|
711
|
+
|
712
|
+
<Calendar
|
713
|
+
value={date}
|
714
|
+
onChange={this.handleChange}
|
715
|
+
requiredConfirm={!!(dateFormat && timeFormat)}
|
716
|
+
dateFormat={dateFormat}
|
717
|
+
inputFormat={inputFormat}
|
718
|
+
timeFormat={timeFormat}
|
719
|
+
isValidDate={this.checkIsValidDate}
|
720
|
+
viewMode={viewMode}
|
721
|
+
timeConstraints={timeConstraints}
|
722
|
+
input={false}
|
723
|
+
onClose={this.close}
|
724
|
+
locale={locale}
|
725
|
+
minDate={minDate}
|
726
|
+
// utc={utc}
|
727
|
+
/>
|
728
|
+
</PopUp>
|
729
|
+
) : null
|
730
|
+
}
|
701
731
|
</div>
|
702
732
|
);
|
703
733
|
}
|
@@ -13,9 +13,10 @@ import Overlay from './Overlay';
|
|
13
13
|
import {ShortCuts, ShortCutDateRange} from './DatePicker';
|
14
14
|
import Calendar from './calendar/Calendar';
|
15
15
|
import PopOver from './PopOver';
|
16
|
+
import PopUp from './PopUp';
|
16
17
|
import {ClassNamesFn, themeable, ThemeProps} from '../theme';
|
17
18
|
import {PlainObject} from '../types';
|
18
|
-
import {noop, ucFirst} from '../utils/helper';
|
19
|
+
import {isMobile, noop, ucFirst} from '../utils/helper';
|
19
20
|
import {LocaleProps, localeable} from '../locale';
|
20
21
|
|
21
22
|
export interface DateRangePickerProps extends ThemeProps, LocaleProps {
|
@@ -47,6 +48,7 @@ export interface DateRangePickerProps extends ThemeProps, LocaleProps {
|
|
47
48
|
embed?: boolean;
|
48
49
|
viewMode?: 'days' | 'months' | 'years' | 'time' | 'quarters';
|
49
50
|
borderMode?: 'full' | 'half' | 'none';
|
51
|
+
useMobileUI?: boolean;
|
50
52
|
}
|
51
53
|
|
52
54
|
export interface DateRangePickerState {
|
@@ -760,7 +762,8 @@ export class DateRangePicker extends React.Component<
|
|
760
762
|
disabled,
|
761
763
|
embed,
|
762
764
|
overlayPlacement,
|
763
|
-
borderMode
|
765
|
+
borderMode,
|
766
|
+
useMobileUI
|
764
767
|
} = this.props;
|
765
768
|
|
766
769
|
const {isOpened, isFocused} = this.state;
|
@@ -836,7 +839,7 @@ export class DateRangePicker extends React.Component<
|
|
836
839
|
<Icon icon="clock" className="icon" />
|
837
840
|
</a>
|
838
841
|
|
839
|
-
{isOpened ? (
|
842
|
+
{!(useMobileUI && isMobile()) && isOpened ? (
|
840
843
|
<Overlay
|
841
844
|
target={() => this.dom.current}
|
842
845
|
onHide={this.close}
|
@@ -856,6 +859,17 @@ export class DateRangePicker extends React.Component<
|
|
856
859
|
</PopOver>
|
857
860
|
</Overlay>
|
858
861
|
) : null}
|
862
|
+
{
|
863
|
+
useMobileUI && isMobile() && (
|
864
|
+
<PopUp
|
865
|
+
isShow={isOpened}
|
866
|
+
className={cx(`${ns}DateRangePicker-popup`)}
|
867
|
+
onHide={this.handleClick}
|
868
|
+
>
|
869
|
+
{this.renderCalendar()}
|
870
|
+
</PopUp>
|
871
|
+
)
|
872
|
+
}
|
859
873
|
</div>
|
860
874
|
);
|
861
875
|
}
|
@@ -12,14 +12,15 @@ import {Icon} from './icons';
|
|
12
12
|
import Overlay from './Overlay';
|
13
13
|
import Calendar from './calendar/Calendar';
|
14
14
|
import PopOver from './PopOver';
|
15
|
+
import PopUp from './PopUp';
|
15
16
|
import {themeable, ThemeProps} from '../theme';
|
16
17
|
import {PlainObject} from '../types';
|
17
|
-
import {noop} from '../utils/helper';
|
18
|
+
import {isMobile, noop} from '../utils/helper';
|
18
19
|
import {LocaleProps, localeable} from '../locale';
|
19
20
|
import {DateRangePicker} from './DateRangePicker';
|
20
21
|
import capitalize from 'lodash/capitalize';
|
21
22
|
import {ShortCuts, ShortCutDateRange} from './DatePicker';
|
22
|
-
import {availableRanges} from './DateRangePicker';
|
23
|
+
import { availableRanges } from './DateRangePicker';
|
23
24
|
|
24
25
|
export interface MonthRangePickerProps extends ThemeProps, LocaleProps {
|
25
26
|
className?: string;
|
@@ -47,6 +48,7 @@ export interface MonthRangePickerProps extends ThemeProps, LocaleProps {
|
|
47
48
|
resetValue?: any;
|
48
49
|
popOverContainer?: any;
|
49
50
|
embed?: boolean;
|
51
|
+
useMobileUI?: boolean;
|
50
52
|
}
|
51
53
|
|
52
54
|
export interface MonthRangePickerState {
|
@@ -528,7 +530,8 @@ export class MonthRangePicker extends React.Component<
|
|
528
530
|
clearable,
|
529
531
|
disabled,
|
530
532
|
embed,
|
531
|
-
overlayPlacement
|
533
|
+
overlayPlacement,
|
534
|
+
useMobileUI
|
532
535
|
} = this.props;
|
533
536
|
|
534
537
|
const {isOpened, isFocused} = this.state;
|
@@ -603,7 +606,7 @@ export class MonthRangePicker extends React.Component<
|
|
603
606
|
<Icon icon="clock" className="icon" />
|
604
607
|
</a>
|
605
608
|
|
606
|
-
{isOpened ? (
|
609
|
+
{!(useMobileUI && isMobile()) && isOpened ? (
|
607
610
|
<Overlay
|
608
611
|
target={() => this.dom.current}
|
609
612
|
onHide={this.close}
|
@@ -623,6 +626,17 @@ export class MonthRangePicker extends React.Component<
|
|
623
626
|
</PopOver>
|
624
627
|
</Overlay>
|
625
628
|
) : null}
|
629
|
+
{
|
630
|
+
useMobileUI && isMobile() && (
|
631
|
+
<PopUp
|
632
|
+
className={cx(`${ns}DateRangePicker-popup`)}
|
633
|
+
isShow={isOpened}
|
634
|
+
onHide={this.handleClick}
|
635
|
+
>
|
636
|
+
{this.renderCalendar()}
|
637
|
+
</PopUp>
|
638
|
+
)
|
639
|
+
}
|
626
640
|
</div>
|
627
641
|
);
|
628
642
|
}
|
@@ -10,11 +10,12 @@ import Button from './Button';
|
|
10
10
|
|
11
11
|
export interface PickerContainerProps extends ThemeProps, LocaleProps {
|
12
12
|
title?: string;
|
13
|
+
showTitle?: boolean;
|
13
14
|
children: (props: {
|
14
15
|
onClick: (e: React.MouseEvent) => void;
|
15
16
|
isOpened: boolean;
|
16
17
|
}) => JSX.Element;
|
17
|
-
|
18
|
+
bodyRender: (props: {
|
18
19
|
onClose: () => void;
|
19
20
|
value: any;
|
20
21
|
onChange: (value: any) => void;
|
@@ -85,8 +86,9 @@ export class PickerContainer extends React.Component<
|
|
85
86
|
render() {
|
86
87
|
const {
|
87
88
|
children,
|
88
|
-
|
89
|
+
bodyRender: popOverRender,
|
89
90
|
title,
|
91
|
+
showTitle,
|
90
92
|
translate: __,
|
91
93
|
size
|
92
94
|
} = this.props;
|
@@ -103,11 +105,13 @@ export class PickerContainer extends React.Component<
|
|
103
105
|
show={this.state.isOpened}
|
104
106
|
onHide={this.close}
|
105
107
|
>
|
106
|
-
|
107
|
-
{
|
108
|
-
|
108
|
+
{showTitle !== false ? (
|
109
|
+
<Modal.Header onClose={this.close}>
|
110
|
+
{__(title || 'Select.placeholder')}
|
111
|
+
</Modal.Header>
|
112
|
+
) : null}
|
109
113
|
<Modal.Body>
|
110
|
-
{
|
114
|
+
{popOverRender({
|
111
115
|
onClose: this.close,
|
112
116
|
value: this.state.value,
|
113
117
|
onChange: this.handleChange
|
@@ -0,0 +1,133 @@
|
|
1
|
+
/**
|
2
|
+
* @file PopUp
|
3
|
+
* @description
|
4
|
+
* @author fex
|
5
|
+
*/
|
6
|
+
|
7
|
+
import React from 'react';
|
8
|
+
import {ClassNamesFn, themeable} from '../theme';
|
9
|
+
import Transition, {
|
10
|
+
ENTERED,
|
11
|
+
EXITING,
|
12
|
+
EXITED,
|
13
|
+
ENTERING
|
14
|
+
} from 'react-transition-group/Transition';
|
15
|
+
import Portal from 'react-overlays/Portal';
|
16
|
+
import { Icon } from './icons';
|
17
|
+
|
18
|
+
|
19
|
+
export interface PopUpPorps {
|
20
|
+
className?: string;
|
21
|
+
style?: {
|
22
|
+
[styleName: string]: string;
|
23
|
+
};
|
24
|
+
overlay?: boolean;
|
25
|
+
onHide?: () => void;
|
26
|
+
classPrefix: string;
|
27
|
+
classnames: ClassNamesFn;
|
28
|
+
[propName: string]: any;
|
29
|
+
isShow?: boolean;
|
30
|
+
container?: any;
|
31
|
+
hideClose?: boolean;
|
32
|
+
placement?: 'left' | 'center' | 'right';
|
33
|
+
}
|
34
|
+
|
35
|
+
const fadeStyles: {
|
36
|
+
[propName: string]: string;
|
37
|
+
} = {
|
38
|
+
[ENTERED]: '',
|
39
|
+
[EXITING]: 'out',
|
40
|
+
[EXITED]: '',
|
41
|
+
[ENTERING]: 'in'
|
42
|
+
};
|
43
|
+
export class PopUp extends React.PureComponent<PopUpPorps> {
|
44
|
+
static defaultProps = {
|
45
|
+
className: '',
|
46
|
+
overlay: true,
|
47
|
+
isShow: false,
|
48
|
+
container: document.body,
|
49
|
+
hideClose: false,
|
50
|
+
};
|
51
|
+
|
52
|
+
componentDidMount() {
|
53
|
+
|
54
|
+
}
|
55
|
+
handleClick(e: React.MouseEvent) {
|
56
|
+
e.stopPropagation();
|
57
|
+
}
|
58
|
+
|
59
|
+
render() {
|
60
|
+
const {
|
61
|
+
style,
|
62
|
+
children,
|
63
|
+
overlay,
|
64
|
+
onHide,
|
65
|
+
classPrefix: ns,
|
66
|
+
classnames: cx,
|
67
|
+
className,
|
68
|
+
isShow,
|
69
|
+
container,
|
70
|
+
hideClose,
|
71
|
+
placement='center',
|
72
|
+
...rest
|
73
|
+
} = this.props;
|
74
|
+
|
75
|
+
const outerStyle: any = {
|
76
|
+
...style,
|
77
|
+
};
|
78
|
+
delete outerStyle.top;
|
79
|
+
return (
|
80
|
+
<Portal container={container}>
|
81
|
+
<Transition
|
82
|
+
mountOnEnter
|
83
|
+
unmountOnExit
|
84
|
+
in={isShow}
|
85
|
+
timeout={500}
|
86
|
+
appear
|
87
|
+
>
|
88
|
+
{(status: string) => {
|
89
|
+
return (
|
90
|
+
<div
|
91
|
+
className={cx(
|
92
|
+
`${ns}PopUp`,
|
93
|
+
className,
|
94
|
+
fadeStyles[status]
|
95
|
+
)}
|
96
|
+
style={outerStyle}
|
97
|
+
{...rest}
|
98
|
+
onClick={this.handleClick}
|
99
|
+
>
|
100
|
+
{overlay && (
|
101
|
+
<div className={`${ns}PopUp-overlay`} onClick={onHide}/>
|
102
|
+
)}
|
103
|
+
<div className={cx(
|
104
|
+
`${ns}PopUp-inner`
|
105
|
+
)}
|
106
|
+
>
|
107
|
+
{
|
108
|
+
!hideClose && (
|
109
|
+
<div className={cx(`${ns}PopUp-closeWrap`, 'text-right')}>
|
110
|
+
<Icon
|
111
|
+
icon="close"
|
112
|
+
className={cx('icon', `${ns}PopUp-close`)}
|
113
|
+
onClick={onHide}
|
114
|
+
/>
|
115
|
+
</div>
|
116
|
+
)
|
117
|
+
}
|
118
|
+
<div
|
119
|
+
className={cx(`${ns}PopUp-content`, `justify-${placement}`)}
|
120
|
+
>
|
121
|
+
{children}
|
122
|
+
</div>
|
123
|
+
</div>
|
124
|
+
</div>
|
125
|
+
)
|
126
|
+
}}
|
127
|
+
</Transition>
|
128
|
+
</Portal>
|
129
|
+
)
|
130
|
+
}
|
131
|
+
}
|
132
|
+
|
133
|
+
export default themeable(PopUp);
|
package/src/components/Steps.tsx
CHANGED
@@ -2,6 +2,7 @@ import React from 'react';
|
|
2
2
|
import {themeable, ThemeProps} from '../theme';
|
3
3
|
import {Icon} from './icons';
|
4
4
|
import {BaseSchema} from '../Schema';
|
5
|
+
import { isMobile } from '../utils/helper';
|
5
6
|
|
6
7
|
export enum StepStatus {
|
7
8
|
wait = 'wait',
|
@@ -78,6 +79,7 @@ export interface StepsProps extends ThemeProps {
|
|
78
79
|
[propName: string]: StepStatus;
|
79
80
|
};
|
80
81
|
mode?: 'horizontal' | 'vertical';
|
82
|
+
useMobileUI?: boolean;
|
81
83
|
}
|
82
84
|
|
83
85
|
export function Steps(props: StepsProps) {
|
@@ -87,7 +89,8 @@ export function Steps(props: StepsProps) {
|
|
87
89
|
className,
|
88
90
|
current,
|
89
91
|
status,
|
90
|
-
mode = 'horizontal'
|
92
|
+
mode = 'horizontal',
|
93
|
+
useMobileUI
|
91
94
|
} = props;
|
92
95
|
const FINISH_ICON = 'check';
|
93
96
|
const ERROR_ICON = 'close';
|
@@ -122,8 +125,9 @@ export function Steps(props: StepsProps) {
|
|
122
125
|
};
|
123
126
|
}
|
124
127
|
|
128
|
+
const mobileUI = useMobileUI && isMobile();
|
125
129
|
return (
|
126
|
-
<ul className={cx('Steps', `Steps--${mode}`, className)}>
|
130
|
+
<ul className={cx('Steps', `Steps--${mode}`, mobileUI ? 'Steps-mobile' : '', className)}>
|
127
131
|
{stepsRow.map((step, i) => {
|
128
132
|
const {stepStatus, icon} = getStepStatus(step, i);
|
129
133
|
|
@@ -133,7 +137,8 @@ export function Steps(props: StepsProps) {
|
|
133
137
|
className={cx('StepsItem', `is-${stepStatus}`, step.className)}
|
134
138
|
>
|
135
139
|
<div className={cx('StepsItem-container')}>
|
136
|
-
<div className={cx('StepsItem-containerIcon'
|
140
|
+
<div className={cx('StepsItem-containerIcon',
|
141
|
+
i < current && 'is-success')}>
|
137
142
|
<span className={cx('StepsItem-icon')}>
|
138
143
|
{icon ? <Icon icon={icon} className="icon" /> : i + 1}
|
139
144
|
</span>
|
@@ -44,7 +44,7 @@ export class TransferPicker extends React.Component<TabsTransferPickerProps> {
|
|
44
44
|
return (
|
45
45
|
<PickerContainer
|
46
46
|
title={__('Select.placeholder')}
|
47
|
-
|
47
|
+
bodyRender={({onClose, value, onChange}) => {
|
48
48
|
return <TabsTransfer {...rest} value={value} onChange={onChange} />;
|
49
49
|
}}
|
50
50
|
value={value}
|
@@ -19,18 +19,9 @@ export interface TransferPickerProps extends Omit<TransferProps, 'itemRender'> {
|
|
19
19
|
}
|
20
20
|
|
21
21
|
export class TransferPicker extends React.Component<TransferPickerProps> {
|
22
|
-
@autobind
|
23
|
-
handleClose() {
|
24
|
-
this.setState({
|
25
|
-
inputValue: '',
|
26
|
-
searchResult: null
|
27
|
-
});
|
28
|
-
}
|
29
|
-
|
30
22
|
@autobind
|
31
23
|
handleConfirm(value: any) {
|
32
24
|
this.props.onChange?.(value);
|
33
|
-
this.handleClose();
|
34
25
|
}
|
35
26
|
|
36
27
|
render() {
|
@@ -49,12 +40,11 @@ export class TransferPicker extends React.Component<TransferPickerProps> {
|
|
49
40
|
return (
|
50
41
|
<PickerContainer
|
51
42
|
title={__('Select.placeholder')}
|
52
|
-
|
43
|
+
bodyRender={({onClose, value, onChange}) => {
|
53
44
|
return <Transfer {...rest} value={value} onChange={onChange} />;
|
54
45
|
}}
|
55
46
|
value={value}
|
56
47
|
onConfirm={this.handleConfirm}
|
57
|
-
onCancel={this.handleClose}
|
58
48
|
size={size}
|
59
49
|
>
|
60
50
|
{({onClick, isOpened}) => (
|