amis 1.5.6-beta.0 → 1.5.7
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/Root.js +1 -1
- package/lib/Root.js.map +2 -2
- package/lib/Schema.d.ts +1 -1
- package/lib/Schema.js.map +1 -1
- package/lib/SchemaRenderer.js +4 -4
- package/lib/SchemaRenderer.js.map +2 -2
- package/lib/components/AsideNav.d.ts +1 -1
- package/lib/components/AsideNav.js.map +1 -1
- package/lib/components/Card.d.ts +20 -20
- package/lib/components/Card.js +1 -1
- package/lib/components/Card.js.map +2 -2
- 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 +5 -7
- package/lib/components/Collapse.js.map +2 -2
- package/lib/components/CollapseGroup.d.ts +20 -20
- package/lib/components/CollapseGroup.js +5 -3
- package/lib/components/CollapseGroup.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.d.ts +84 -84
- 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/LocationPicker.d.ts +84 -84
- 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/Rating.d.ts +203 -73
- package/lib/components/Rating.js +147 -31
- package/lib/components/Rating.js.map +2 -2
- package/lib/components/Select.d.ts +237 -237
- 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/Tabs.d.ts +20 -20
- 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/components/icons.js +2 -0
- package/lib/components/icons.js.map +2 -2
- package/lib/components/index.d.ts +2 -1
- package/lib/components/index.js +4 -2
- package/lib/components/index.js.map +2 -2
- package/lib/helper.css +57 -57
- package/lib/helper.css.map +1 -1
- package/lib/icons/star.js +12 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +2 -1
- package/lib/index.js.map +2 -2
- package/lib/renderers/CRUD.js +1 -2
- package/lib/renderers/CRUD.js.map +2 -2
- package/lib/renderers/Collapse.js +8 -2
- package/lib/renderers/Collapse.js.map +2 -2
- package/lib/renderers/CollapseGroup.js.map +2 -2
- package/lib/renderers/Form/InputCity.d.ts +84 -84
- 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/InputRating.d.ts +37 -0
- package/lib/renderers/Form/InputRating.js +6 -2
- package/lib/renderers/Form/InputRating.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/Form/index.js +2 -1
- package/lib/renderers/Form/index.js.map +2 -2
- package/lib/renderers/Json.js +7 -0
- package/lib/renderers/Json.js.map +2 -2
- package/lib/renderers/Nav.js +4 -1
- package/lib/renderers/Nav.js.map +2 -2
- package/lib/renderers/Steps.js +2 -2
- package/lib/renderers/Steps.js.map +2 -2
- package/lib/renderers/Table/TableRow.js +4 -1
- package/lib/renderers/Table/TableRow.js.map +2 -2
- package/lib/store/formItem.js +17 -7
- package/lib/store/formItem.js.map +2 -2
- package/lib/store/table.js +1 -1
- package/lib/store/table.js.map +2 -2
- package/lib/themes/ang-ie11.css +305 -10
- package/lib/themes/ang.css +305 -10
- package/lib/themes/ang.css.map +1 -1
- package/lib/themes/antd-ie11.css +305 -10
- package/lib/themes/antd.css +305 -10
- package/lib/themes/antd.css.map +1 -1
- package/lib/themes/cxd-ie11.css +307 -11
- package/lib/themes/cxd.css +307 -11
- package/lib/themes/cxd.css.map +1 -1
- package/lib/themes/dark-ie11.css +305 -10
- package/lib/themes/dark.css +305 -10
- package/lib/themes/dark.css.map +1 -1
- package/lib/themes/default.css +307 -11
- package/lib/themes/default.css.map +1 -1
- package/lib/utils/api.js +2 -2
- package/lib/utils/api.js.map +2 -2
- package/lib/utils/helper.js +2 -7
- package/lib/utils/helper.js.map +2 -2
- package/package.json +5 -3
- package/schema.json +59 -7
- package/scss/_properties.scss +3 -1
- 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/_rating.scss +60 -21
- 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/scss/themes/_cxd-variables.scss +3 -1
- package/sdk/ang-ie11.css +922 -8
- package/sdk/ang.css +926 -10
- package/sdk/antd-ie11.css +922 -8
- package/sdk/antd.css +926 -10
- package/sdk/charts.js +17 -17
- package/sdk/codemirror.js +14 -0
- package/sdk/color-picker.js +65 -65
- package/sdk/cropperjs.js +3 -3
- package/sdk/cxd-ie11.css +923 -9
- package/sdk/cxd.css +928 -11
- package/sdk/dark-ie11.css +922 -8
- package/sdk/dark.css +926 -10
- 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 +923 -9
- package/sdk/sdk.css +928 -11
- package/sdk/sdk.js +1318 -1208
- package/sdk/thirds/hls.js/hls.js +18 -18
- package/sdk/thirds/mpegts.js/mpegts.js +2 -2
- package/sdk/tinymce.js +57 -57
- package/src/Root.tsx +1 -0
- package/src/Schema.ts +1 -0
- package/src/SchemaRenderer.tsx +4 -0
- package/src/components/AsideNav.tsx +1 -1
- package/src/components/Card.tsx +2 -2
- package/src/components/CodeMirror.tsx +99 -0
- package/src/components/Collapse.tsx +22 -14
- package/src/components/CollapseGroup.tsx +9 -11
- 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/Rating.tsx +235 -47
- 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/components/icons.tsx +2 -0
- package/src/components/index.tsx +2 -0
- package/src/icons/star.svg +12 -0
- package/src/index.tsx +1 -0
- package/src/renderers/CRUD.tsx +1 -3
- package/src/renderers/Collapse.tsx +27 -27
- package/src/renderers/CollapseGroup.tsx +13 -12
- 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/InputRating.tsx +66 -3
- package/src/renderers/Form/InputYearRange.tsx +2 -0
- package/src/renderers/Form/TreeSelect.tsx +82 -63
- package/src/renderers/Form/index.tsx +2 -1
- package/src/renderers/Json.tsx +5 -0
- package/src/renderers/Nav.tsx +4 -1
- package/src/renderers/Steps.tsx +4 -2
- package/src/renderers/Table/TableRow.tsx +3 -1
- package/src/store/formItem.ts +17 -2
- package/src/store/table.ts +2 -1
- package/src/utils/api.ts +5 -2
- package/src/utils/helper.ts +5 -14
package/src/Root.tsx
CHANGED
package/src/Schema.ts
CHANGED
package/src/SchemaRenderer.tsx
CHANGED
@@ -242,6 +242,7 @@ export class SchemaRenderer extends React.Component<SchemaRendererProps, any> {
|
|
242
242
|
data: defaultData,
|
243
243
|
value: defaultValue,
|
244
244
|
activeKey: defaultActiveKey,
|
245
|
+
key: propKey,
|
245
246
|
...restSchema
|
246
247
|
} = schema;
|
247
248
|
return rest.invisible
|
@@ -253,6 +254,7 @@ export class SchemaRenderer extends React.Component<SchemaRendererProps, any> {
|
|
253
254
|
defaultData,
|
254
255
|
defaultValue,
|
255
256
|
defaultActiveKey,
|
257
|
+
propKey,
|
256
258
|
$path: $path,
|
257
259
|
$schema: schema,
|
258
260
|
ref: isSFC ? undefined : this.refFn,
|
@@ -293,6 +295,7 @@ export class SchemaRenderer extends React.Component<SchemaRendererProps, any> {
|
|
293
295
|
const {
|
294
296
|
data: defaultData,
|
295
297
|
value: defaultValue,
|
298
|
+
key: propKey,
|
296
299
|
activeKey: defaultActiveKey,
|
297
300
|
...restSchema
|
298
301
|
} = schema;
|
@@ -321,6 +324,7 @@ export class SchemaRenderer extends React.Component<SchemaRendererProps, any> {
|
|
321
324
|
defaultData={restSchema.defaultData ?? defaultData}
|
322
325
|
defaultValue={restSchema.defaultValue ?? defaultValue}
|
323
326
|
defaultActiveKey={defaultActiveKey}
|
327
|
+
propKey={propKey}
|
324
328
|
$path={$path}
|
325
329
|
$schema={{...schema, ...exprProps}}
|
326
330
|
ref={this.refFn}
|
package/src/components/Card.tsx
CHANGED
@@ -176,7 +176,7 @@ export class Card extends React.Component<CardProps> {
|
|
176
176
|
</div>
|
177
177
|
</div>
|
178
178
|
) : (
|
179
|
-
|
179
|
+
<>
|
180
180
|
{heading}
|
181
181
|
{body ? (
|
182
182
|
<div className={cx('Card-body', bodyClassName)}>{body}</div>
|
@@ -193,7 +193,7 @@ export class Card extends React.Component<CardProps> {
|
|
193
193
|
) : null}
|
194
194
|
</div>
|
195
195
|
) : null}
|
196
|
-
|
196
|
+
</>
|
197
197
|
)}
|
198
198
|
</div>
|
199
199
|
);
|
@@ -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;
|
@@ -55,7 +56,6 @@ export interface CollapseState {
|
|
55
56
|
}
|
56
57
|
|
57
58
|
export class Collapse extends React.Component<CollapseProps, CollapseState> {
|
58
|
-
|
59
59
|
static defaultProps: Partial<CollapseProps> = {
|
60
60
|
mountOnEnter: false,
|
61
61
|
unmountOnExit: false,
|
@@ -79,10 +79,13 @@ export class Collapse extends React.Component<CollapseProps, CollapseState> {
|
|
79
79
|
super(props);
|
80
80
|
|
81
81
|
this.toggleCollapsed = this.toggleCollapsed.bind(this);
|
82
|
-
this.state.collapsed = !!props.collapsed;
|
82
|
+
this.state.collapsed = props.collapsable ? !!props.collapsed : false;
|
83
83
|
}
|
84
84
|
|
85
|
-
static getDerivedStateFromProps(
|
85
|
+
static getDerivedStateFromProps(
|
86
|
+
nextProps: CollapseProps,
|
87
|
+
preState: CollapseState
|
88
|
+
) {
|
86
89
|
if (nextProps.propsUpdate && nextProps.collapsed !== preState.collapsed) {
|
87
90
|
return {
|
88
91
|
collapsed: !!nextProps.collapsed
|
@@ -164,7 +167,9 @@ export class Collapse extends React.Component<CollapseProps, CollapseState> {
|
|
164
167
|
children
|
165
168
|
} = this.props;
|
166
169
|
|
167
|
-
const finalHeader = this.state.collapsed
|
170
|
+
const finalHeader = this.state.collapsed
|
171
|
+
? header
|
172
|
+
: collapseHeader || header;
|
168
173
|
|
169
174
|
let dom = [
|
170
175
|
finalHeader ? (
|
@@ -173,14 +178,18 @@ export class Collapse extends React.Component<CollapseProps, CollapseState> {
|
|
173
178
|
onClick={this.toggleCollapsed}
|
174
179
|
className={cx(`Collapse-header`, headingClassName)}
|
175
180
|
>
|
176
|
-
{showArrow && collapsable
|
177
|
-
?
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
181
|
+
{showArrow && collapsable ? (
|
182
|
+
expandIcon ? (
|
183
|
+
React.cloneElement(expandIcon, {
|
184
|
+
...expandIcon.props,
|
185
|
+
className: cx('Collapse-icon-tranform')
|
186
|
+
})
|
187
|
+
) : (
|
188
|
+
<span className={cx('Collapse-arrow')} />
|
189
|
+
)
|
190
|
+
) : (
|
191
|
+
''
|
192
|
+
)}
|
184
193
|
{finalHeader}
|
185
194
|
</HeadingComponent>
|
186
195
|
) : null,
|
@@ -213,7 +222,6 @@ export class Collapse extends React.Component<CollapseProps, CollapseState> {
|
|
213
222
|
);
|
214
223
|
}}
|
215
224
|
</Transition>
|
216
|
-
|
217
225
|
];
|
218
226
|
|
219
227
|
if (headerPosition === 'bottom') {
|
@@ -28,7 +28,6 @@ class CollapseGroup extends React.Component<
|
|
28
28
|
CollapseGroupProps,
|
29
29
|
CollapseGroupState
|
30
30
|
> {
|
31
|
-
|
32
31
|
static defaultProps: Partial<CollapseGroupProps> = {
|
33
32
|
className: '',
|
34
33
|
accordion: false,
|
@@ -58,21 +57,18 @@ class CollapseGroup extends React.Component<
|
|
58
57
|
if (collapsed) {
|
59
58
|
if (this.props.accordion) {
|
60
59
|
activeKey = [];
|
61
|
-
}
|
62
|
-
|
63
|
-
for(let i = 0; i < activeKey.length; i++) {
|
60
|
+
} else {
|
61
|
+
for (let i = 0; i < activeKey.length; i++) {
|
64
62
|
if (activeKey[i] === item.id) {
|
65
63
|
activeKey.splice(i, 1);
|
66
64
|
break;
|
67
65
|
}
|
68
66
|
}
|
69
67
|
}
|
70
|
-
}
|
71
|
-
else {
|
68
|
+
} else {
|
72
69
|
if (this.props.accordion) {
|
73
70
|
activeKey = [item.id];
|
74
|
-
}
|
75
|
-
else {
|
71
|
+
} else {
|
76
72
|
activeKey.push(item.id);
|
77
73
|
}
|
78
74
|
}
|
@@ -88,7 +84,8 @@ class CollapseGroup extends React.Component<
|
|
88
84
|
|
89
85
|
return children.map((child: React.ReactElement, index: number) => {
|
90
86
|
let props = child.props;
|
91
|
-
|
87
|
+
|
88
|
+
const id = props.propKey || String(index);
|
92
89
|
const collapsed = this.state.activeKey.indexOf(id) === -1;
|
93
90
|
|
94
91
|
return React.cloneElement(child as any, {
|
@@ -98,7 +95,8 @@ class CollapseGroup extends React.Component<
|
|
98
95
|
collapsed,
|
99
96
|
expandIcon: this.props.expandIcon,
|
100
97
|
propsUpdate: true,
|
101
|
-
onCollapse: (item: CollapseProps, collapsed: boolean) =>
|
98
|
+
onCollapse: (item: CollapseProps, collapsed: boolean) =>
|
99
|
+
this.collapseChange(item, collapsed)
|
102
100
|
});
|
103
101
|
});
|
104
102
|
};
|
@@ -116,7 +114,7 @@ class CollapseGroup extends React.Component<
|
|
116
114
|
className={cx(
|
117
115
|
`CollapseGroup`,
|
118
116
|
{
|
119
|
-
'icon-position-right': expandIconPosition === 'right'
|
117
|
+
'icon-position-right': expandIconPosition === 'right'
|
120
118
|
},
|
121
119
|
className
|
122
120
|
)}
|
@@ -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
|