amis 1.4.2-beta.17 → 1.4.2-beta.18
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/components/Alert2.d.ts +26 -21
- package/lib/components/Alert2.js +11 -4
- package/lib/components/Alert2.js.map +2 -2
- package/lib/components/Button.js +1 -1
- package/lib/components/Button.js.map +2 -2
- package/lib/components/Collapse.js +3 -2
- package/lib/components/Collapse.js.map +2 -2
- package/lib/components/ColorPicker.d.ts +5 -1
- package/lib/components/ColorPicker.js +17 -4
- package/lib/components/ColorPicker.js.map +2 -2
- package/lib/components/Overlay.js +5 -0
- package/lib/components/Overlay.js.map +2 -2
- package/lib/components/PopOver.d.ts +1 -0
- package/lib/components/PopOver.js +12 -1
- package/lib/components/PopOver.js.map +2 -2
- package/lib/components/Toast.d.ts +4 -2
- package/lib/components/Toast.js +10 -3
- package/lib/components/Toast.js.map +2 -2
- package/lib/components/Tree.d.ts +84 -84
- package/lib/components/condition-builder/Field.js +2 -3
- package/lib/components/condition-builder/Field.js.map +2 -2
- package/lib/components/icons.js +8 -0
- package/lib/components/icons.js.map +2 -2
- package/lib/icons/alert-danger.js +7 -0
- package/lib/icons/alert-info.js +7 -0
- package/lib/icons/alert-success.js +7 -0
- package/lib/icons/alert-warning.js +7 -0
- package/lib/index.js +1 -1
- package/lib/renderers/Alert.d.ts +21 -1
- package/lib/renderers/Alert.js.map +2 -2
- package/lib/renderers/Card.d.ts +1 -0
- package/lib/renderers/Card.js +7 -2
- package/lib/renderers/Card.js.map +2 -2
- package/lib/renderers/Form/ConditionBuilder.js +2 -2
- package/lib/renderers/Form/ConditionBuilder.js.map +2 -2
- package/lib/renderers/Form/InputColor.d.ts +2 -1
- package/lib/renderers/Form/InputColor.js +1 -1
- package/lib/renderers/Form/InputColor.js.map +2 -2
- package/lib/renderers/Page.d.ts +18 -0
- package/lib/renderers/Page.js +53 -9
- package/lib/renderers/Page.js.map +2 -2
- package/lib/store/formItem.js +2 -18
- package/lib/store/formItem.js.map +2 -2
- package/lib/themes/ang-ie11.css +131 -23
- package/lib/themes/ang.css +131 -23
- package/lib/themes/ang.css.map +1 -1
- package/lib/themes/antd-ie11.css +131 -23
- package/lib/themes/antd.css +131 -23
- package/lib/themes/antd.css.map +1 -1
- package/lib/themes/cxd-ie11.css +142 -36
- package/lib/themes/cxd.css +142 -36
- package/lib/themes/cxd.css.map +1 -1
- package/lib/themes/dark-ie11.css +131 -23
- package/lib/themes/dark.css +131 -23
- package/lib/themes/dark.css.map +1 -1
- package/lib/themes/default.css +142 -36
- package/lib/themes/default.css.map +1 -1
- package/lib/utils/helper.d.ts +2 -0
- package/lib/utils/helper.js +16 -2
- package/lib/utils/helper.js.map +2 -2
- package/lib/utils/tpl-builtin.js +5 -0
- package/lib/utils/tpl-builtin.js.map +2 -2
- package/package.json +1 -1
- package/schema.json +123 -15
- package/scss/_properties.scss +2 -1
- package/scss/components/_alert.scss +28 -5
- package/scss/components/_button.scss +5 -0
- package/scss/components/_card.scss +1 -1
- package/scss/components/_collapse-group.scss +4 -0
- package/scss/components/_collapse.scss +1 -2
- package/scss/components/_nav.scss +1 -6
- package/scss/components/_page.scss +35 -2
- package/scss/components/_toast.scss +41 -11
- package/scss/components/form/_color.scss +32 -3
- package/scss/components/form/_fieldset.scss +1 -0
- package/scss/components/form/_transfer.scss +1 -0
- package/scss/themes/_cxd-variables.scss +14 -8
- package/scss/themes/cxd.scss +0 -7
- package/sdk/ang-ie11.css +150 -27
- package/sdk/ang.css +151 -27
- package/sdk/antd-ie11.css +150 -27
- package/sdk/antd.css +151 -27
- package/sdk/charts.js +15 -15
- package/sdk/color-picker.js +69 -65
- package/sdk/cropperjs.js +2 -2
- package/sdk/cxd-ie11.css +158 -40
- package/sdk/cxd.css +162 -40
- package/sdk/dark-ie11.css +150 -27
- package/sdk/dark.css +151 -27
- 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 +16 -20
- package/sdk/rich-text.js +62 -62
- package/sdk/sdk-ie11.css +158 -40
- package/sdk/sdk.css +162 -40
- package/sdk/sdk.js +1195 -1187
- 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/Alert2.tsx +32 -4
- package/src/components/Button.tsx +1 -0
- package/src/components/Collapse.tsx +3 -8
- package/src/components/ColorPicker.tsx +32 -10
- package/src/components/Overlay.tsx +6 -0
- package/src/components/PopOver.tsx +15 -1
- package/src/components/Toast.tsx +25 -5
- package/src/components/condition-builder/Field.tsx +3 -1
- package/src/components/icons.tsx +8 -0
- package/src/icons/alert-danger.svg +1 -0
- package/src/icons/alert-info.svg +1 -0
- package/src/icons/alert-success.svg +1 -0
- package/src/icons/alert-warning.svg +1 -0
- package/src/renderers/Alert.tsx +31 -1
- package/src/renderers/Card.tsx +13 -2
- package/src/renderers/Form/ConditionBuilder.tsx +2 -2
- package/src/renderers/Form/InputColor.tsx +4 -2
- package/src/renderers/Page.tsx +62 -1
- package/src/store/formItem.ts +1 -22
- package/src/utils/helper.ts +14 -0
- package/src/utils/tpl-builtin.ts +6 -0
@@ -9,8 +9,13 @@ import {Icon} from './icons';
|
|
9
9
|
|
10
10
|
export interface AlertProps {
|
11
11
|
level: 'danger' | 'info' | 'success' | 'warning';
|
12
|
-
|
12
|
+
title?: string;
|
13
|
+
className?: string;
|
13
14
|
showCloseButton: boolean;
|
15
|
+
showIcon?: boolean;
|
16
|
+
icon?: string | React.ReactNode;
|
17
|
+
iconClassName?: string;
|
18
|
+
closeButtonClassName?: string;
|
14
19
|
onClose?: () => void;
|
15
20
|
classnames: ClassNamesFn;
|
16
21
|
classPrefix: string;
|
@@ -60,21 +65,44 @@ export class Alert extends React.Component<AlertProps, AlertState> {
|
|
60
65
|
className,
|
61
66
|
level,
|
62
67
|
children,
|
63
|
-
showCloseButton
|
68
|
+
showCloseButton,
|
69
|
+
title,
|
70
|
+
icon,
|
71
|
+
showIcon,
|
72
|
+
iconClassName,
|
73
|
+
closeButtonClassName
|
64
74
|
} = this.props;
|
65
75
|
|
76
|
+
const iconNode = icon ? (
|
77
|
+
typeof icon === 'string' ? (
|
78
|
+
<Icon icon={icon} className={cx(`Alert-icon icon`)} />
|
79
|
+
) : React.isValidElement(icon) ? (
|
80
|
+
React.cloneElement(icon, {
|
81
|
+
className: cx(`Alert-icon`, icon.props?.className)
|
82
|
+
})
|
83
|
+
) : null
|
84
|
+
) : showIcon ? (
|
85
|
+
<Icon icon={`alert-${level}`} className={cx(`Alert-icon icon`)} />
|
86
|
+
) : null;
|
87
|
+
|
66
88
|
return this.state.show ? (
|
67
89
|
<div className={cx('Alert', level ? `Alert--${level}` : '', className)}>
|
90
|
+
{showIcon && iconNode ? (
|
91
|
+
<div className={cx('Alert-icon', iconClassName)}>{iconNode}</div>
|
92
|
+
) : null}
|
93
|
+
<div className={cx('Alert-content')}>
|
94
|
+
{title ? <div className={cx('Alert-title')}>{title}</div> : null}
|
95
|
+
<div className={cx('Alert-desc')}>{children}</div>
|
96
|
+
</div>
|
68
97
|
{showCloseButton ? (
|
69
98
|
<button
|
70
|
-
className={cx('Alert-close')}
|
99
|
+
className={cx('Alert-close', closeButtonClassName)}
|
71
100
|
onClick={this.handleClick}
|
72
101
|
type="button"
|
73
102
|
>
|
74
103
|
<Icon icon="close" className="icon" />
|
75
104
|
</button>
|
76
105
|
) : null}
|
77
|
-
{children}
|
78
106
|
</div>
|
79
107
|
) : null;
|
80
108
|
}
|
@@ -82,6 +82,7 @@ export class Button extends React.Component<ButtonProps> {
|
|
82
82
|
<Comp
|
83
83
|
type={Comp === 'input' || Comp === 'button' ? type : undefined}
|
84
84
|
{...pickEventsProps(rest)}
|
85
|
+
onClick={rest.onClick && disabled ? () => {} : rest.onClick}
|
85
86
|
href={href}
|
86
87
|
className={cx(
|
87
88
|
overrideClassName
|
@@ -160,7 +160,8 @@ export class Collapse extends React.Component<CollapseProps, CollapseState> {
|
|
160
160
|
translate: __,
|
161
161
|
showArrow,
|
162
162
|
expandIcon,
|
163
|
-
disabled
|
163
|
+
disabled,
|
164
|
+
children
|
164
165
|
} = this.props;
|
165
166
|
|
166
167
|
const finalHeader = this.state.collapsed ? header : collapseHeader || header;
|
@@ -206,13 +207,7 @@ export class Collapse extends React.Component<CollapseProps, CollapseState> {
|
|
206
207
|
ref={this.contentRef}
|
207
208
|
>
|
208
209
|
<div className={cx('Collapse-body', bodyClassName)}>
|
209
|
-
{
|
210
|
-
...(body as React.ReactElement).props,
|
211
|
-
className: cx(
|
212
|
-
'Collapse-content',
|
213
|
-
(body as React.ReactElement).props.className
|
214
|
-
)
|
215
|
-
})}
|
210
|
+
<div className={cx('Collapse-content')}>{body || children}</div>
|
216
211
|
</div>
|
217
212
|
</div>
|
218
213
|
);
|
@@ -12,9 +12,11 @@ import Overlay from './Overlay';
|
|
12
12
|
import {uncontrollable} from 'uncontrollable';
|
13
13
|
import PopOver from './PopOver';
|
14
14
|
import {ClassNamesFn, themeable, ThemeProps} from '../theme';
|
15
|
-
import {autobind} from '../utils/helper';
|
15
|
+
import {autobind, isObject} from '../utils/helper';
|
16
16
|
import {localeable, LocaleProps} from '../locale';
|
17
17
|
|
18
|
+
export type PresetColor = {color: string; title: string} | string;
|
19
|
+
|
18
20
|
export interface ColorProps extends LocaleProps, ThemeProps {
|
19
21
|
placeholder?: string;
|
20
22
|
format: string;
|
@@ -27,7 +29,7 @@ export interface ColorProps extends LocaleProps, ThemeProps {
|
|
27
29
|
placement?: string;
|
28
30
|
value?: any;
|
29
31
|
onChange: (value: any) => void;
|
30
|
-
presetColors?:
|
32
|
+
presetColors?: PresetColor[];
|
31
33
|
resetValue?: string;
|
32
34
|
allowCustomColor?: boolean;
|
33
35
|
}
|
@@ -229,11 +231,20 @@ export class ColorControl extends React.PureComponent<
|
|
229
231
|
`ColorPicker`,
|
230
232
|
{
|
231
233
|
'is-disabled': disabled,
|
232
|
-
'is-focused': isFocused
|
234
|
+
'is-focused': isFocused,
|
235
|
+
'is-opened': isOpened
|
233
236
|
},
|
234
237
|
className
|
235
238
|
)}
|
236
239
|
>
|
240
|
+
<span onClick={this.handleClick} className={cx('ColorPicker-preview')}>
|
241
|
+
<i
|
242
|
+
ref={this.preview}
|
243
|
+
className={`${ns}ColorPicker-previewIcon`}
|
244
|
+
style={{background: this.state.inputValue || '#ccc'}}
|
245
|
+
/>
|
246
|
+
</span>
|
247
|
+
|
237
248
|
<input
|
238
249
|
ref={this.input}
|
239
250
|
type="text"
|
@@ -255,12 +266,8 @@ export class ColorControl extends React.PureComponent<
|
|
255
266
|
</a>
|
256
267
|
) : null}
|
257
268
|
|
258
|
-
<span
|
259
|
-
<
|
260
|
-
ref={this.preview}
|
261
|
-
className={`${ns}ColorPicker-previewIcon`}
|
262
|
-
style={{background: this.state.inputValue || '#ccc'}}
|
263
|
-
/>
|
269
|
+
<span className={cx('ColorPicker-arrow')}>
|
270
|
+
<Icon icon="caret" className="icon" onClick={this.handleClick} />
|
264
271
|
</span>
|
265
272
|
|
266
273
|
{isOpened ? (
|
@@ -280,6 +287,7 @@ export class ColorControl extends React.PureComponent<
|
|
280
287
|
>
|
281
288
|
{allowCustomColor ? (
|
282
289
|
<SketchPicker
|
290
|
+
styles={{}}
|
283
291
|
disableAlpha={!!~['rgb', 'hex'].indexOf(format as string)}
|
284
292
|
color={value}
|
285
293
|
presetColors={presetColors}
|
@@ -288,7 +296,21 @@ export class ColorControl extends React.PureComponent<
|
|
288
296
|
) : (
|
289
297
|
<GithubPicker
|
290
298
|
color={value}
|
291
|
-
colors={
|
299
|
+
colors={
|
300
|
+
Array.isArray(presetColors)
|
301
|
+
? (presetColors
|
302
|
+
.filter(
|
303
|
+
item => typeof item === 'string' || isObject(item)
|
304
|
+
)
|
305
|
+
.map(item =>
|
306
|
+
typeof item === 'string'
|
307
|
+
? item
|
308
|
+
: isObject(item)
|
309
|
+
? item?.color
|
310
|
+
: item
|
311
|
+
) as string[])
|
312
|
+
: undefined
|
313
|
+
}
|
292
314
|
onChangeComplete={this.handleChange}
|
293
315
|
/>
|
294
316
|
)}
|
@@ -295,6 +295,12 @@ export default class Overlay extends React.Component<
|
|
295
295
|
<Portal container={container}>
|
296
296
|
<RootClose onRootClose={props.onHide}>
|
297
297
|
{(ref: any) => {
|
298
|
+
if (React.isValidElement(child)) {
|
299
|
+
return React.cloneElement(child, {
|
300
|
+
ref: ref
|
301
|
+
});
|
302
|
+
}
|
303
|
+
|
298
304
|
return <div ref={ref}>{child}</div>;
|
299
305
|
}}
|
300
306
|
</RootClose>
|
@@ -7,7 +7,7 @@
|
|
7
7
|
import React from 'react';
|
8
8
|
import {findDOMNode} from 'react-dom';
|
9
9
|
import {ClassNamesFn, themeable} from '../theme';
|
10
|
-
import {camel} from '../utils/helper';
|
10
|
+
import {camel, preventDefault} from '../utils/helper';
|
11
11
|
|
12
12
|
export interface Offset {
|
13
13
|
x: number;
|
@@ -53,12 +53,21 @@ export class PopOver extends React.PureComponent<PopOverPorps, PopOverState> {
|
|
53
53
|
};
|
54
54
|
|
55
55
|
parent: HTMLElement;
|
56
|
+
wrapperRef: React.RefObject<HTMLDivElement> = React.createRef();
|
56
57
|
|
57
58
|
componentDidMount() {
|
58
59
|
this.mayUpdateOffset();
|
59
60
|
const dom = findDOMNode(this) as HTMLElement;
|
60
61
|
this.parent = dom.parentNode as HTMLElement;
|
61
62
|
this.parent.classList.add('has-popover');
|
63
|
+
|
64
|
+
if (this.wrapperRef && this.wrapperRef.current) {
|
65
|
+
// https://developer.mozilla.org/zh-CN/docs/Web/API/EventTarget/addEventListener#使用_passive_改善的滚屏性能
|
66
|
+
this.wrapperRef.current.addEventListener('touchmove', preventDefault, {
|
67
|
+
passive: false,
|
68
|
+
capture: false
|
69
|
+
});
|
70
|
+
}
|
62
71
|
}
|
63
72
|
|
64
73
|
componentDidUpdate() {
|
@@ -67,6 +76,10 @@ export class PopOver extends React.PureComponent<PopOverPorps, PopOverState> {
|
|
67
76
|
|
68
77
|
componentWillUnmount() {
|
69
78
|
this.parent && this.parent.classList.remove('has-popover');
|
79
|
+
|
80
|
+
if (this.wrapperRef && this.wrapperRef.current) {
|
81
|
+
this.wrapperRef.current.removeEventListener('touchmove', preventDefault);
|
82
|
+
}
|
70
83
|
}
|
71
84
|
|
72
85
|
mayUpdateOffset() {
|
@@ -122,6 +135,7 @@ export class PopOver extends React.PureComponent<PopOverPorps, PopOverState> {
|
|
122
135
|
|
123
136
|
return (
|
124
137
|
<div
|
138
|
+
ref={this.wrapperRef}
|
125
139
|
className={cx(
|
126
140
|
`${ns}PopOver`,
|
127
141
|
className,
|
package/src/components/Toast.tsx
CHANGED
@@ -56,7 +56,8 @@ interface ToastComponentProps extends ThemeProps, LocaleProps {
|
|
56
56
|
}
|
57
57
|
|
58
58
|
interface Item extends Config {
|
59
|
-
|
59
|
+
title?: string | React.ReactNode;
|
60
|
+
body: string | React.ReactNode;
|
60
61
|
level: 'info' | 'success' | 'error' | 'warning';
|
61
62
|
id: string;
|
62
63
|
onDissmiss?: () => void;
|
@@ -164,7 +165,6 @@ export class ToastComponent extends React.Component<
|
|
164
165
|
closeButton
|
165
166
|
} = this.props;
|
166
167
|
const items = this.state.items;
|
167
|
-
|
168
168
|
const groupedItems = groupBy(items, item => item.position || position);
|
169
169
|
|
170
170
|
return Object.keys(groupedItems).map(position => {
|
@@ -187,6 +187,7 @@ export class ToastComponent extends React.Component<
|
|
187
187
|
<ToastMessage
|
188
188
|
classnames={cx}
|
189
189
|
key={item.id}
|
190
|
+
title={item.title}
|
190
191
|
body={item.body}
|
191
192
|
level={level}
|
192
193
|
timeout={toastTimeout}
|
@@ -206,7 +207,8 @@ export class ToastComponent extends React.Component<
|
|
206
207
|
export default themeable(localeable(ToastComponent));
|
207
208
|
|
208
209
|
interface ToastMessageProps {
|
209
|
-
|
210
|
+
title?: string | React.ReactNode;
|
211
|
+
body: string | React.ReactNode;
|
210
212
|
level: 'info' | 'success' | 'error' | 'warning';
|
211
213
|
timeout: number;
|
212
214
|
closeButton?: boolean;
|
@@ -291,6 +293,7 @@ export class ToastMessage extends React.Component<
|
|
291
293
|
onDismiss,
|
292
294
|
classnames: cx,
|
293
295
|
closeButton,
|
296
|
+
title,
|
294
297
|
body,
|
295
298
|
allowHtml,
|
296
299
|
level,
|
@@ -328,8 +331,25 @@ export class ToastMessage extends React.Component<
|
|
328
331
|
) : null}
|
329
332
|
</div>
|
330
333
|
)}
|
331
|
-
|
332
|
-
|
334
|
+
|
335
|
+
<div className={cx('Toast-content')}>
|
336
|
+
{typeof title === 'string' ? (
|
337
|
+
<span className={cx(`Toast-title`)}>{title}</span>
|
338
|
+
) : React.isValidElement(title) ? (
|
339
|
+
React.cloneElement(title, {
|
340
|
+
className: cx(`Toast-title`, title?.props?.className ?? '')
|
341
|
+
})
|
342
|
+
) : null}
|
343
|
+
|
344
|
+
{typeof body === 'string' ? (
|
345
|
+
<div className={cx('Toast-body')}>
|
346
|
+
{allowHtml ? <Html html={body} /> : body}
|
347
|
+
</div>
|
348
|
+
) : React.isValidElement(body) ? (
|
349
|
+
React.cloneElement(body, {
|
350
|
+
className: cx(`Toast-body`, body?.props?.className ?? '')
|
351
|
+
})
|
352
|
+
) : null}
|
333
353
|
</div>
|
334
354
|
|
335
355
|
{closeButton ? (
|
@@ -96,7 +96,9 @@ export class ConditionField extends React.Component<
|
|
96
96
|
options={this.state.options}
|
97
97
|
value={[value]}
|
98
98
|
option2value={option2value}
|
99
|
-
onChange={(
|
99
|
+
onChange={(value: any) =>
|
100
|
+
onChange(Array.isArray(value) ? value[0] : value)
|
101
|
+
}
|
100
102
|
/>
|
101
103
|
</>
|
102
104
|
)}
|
package/src/components/icons.tsx
CHANGED
@@ -70,6 +70,10 @@ import ExpandAltIcon from '../icons/expand-alt.svg';
|
|
70
70
|
import CompressAltIcon from '../icons/compress-alt.svg';
|
71
71
|
import TransparentIcon from '../icons/transparent.svg';
|
72
72
|
import LoadingOutline from '../icons/loading-outline.svg';
|
73
|
+
import AlertSuccess from '../icons/alert-success.svg';
|
74
|
+
import AlertInfo from '../icons/alert-info.svg';
|
75
|
+
import AlertWarning from '../icons/alert-warning.svg';
|
76
|
+
import AlertDanger from '../icons/alert-danger.svg';
|
73
77
|
|
74
78
|
// 兼容原来的用法,后续不直接试用。
|
75
79
|
|
@@ -166,6 +170,10 @@ registerIcon('expand-alt', ExpandAltIcon);
|
|
166
170
|
registerIcon('compress-alt', CompressAltIcon);
|
167
171
|
registerIcon('transparent', TransparentIcon);
|
168
172
|
registerIcon('loading-outline', LoadingOutline);
|
173
|
+
registerIcon('alert-success', AlertSuccess);
|
174
|
+
registerIcon('alert-info', AlertInfo);
|
175
|
+
registerIcon('alert-warning', AlertWarning);
|
176
|
+
registerIcon('alert-danger', AlertDanger);
|
169
177
|
|
170
178
|
export function Icon({
|
171
179
|
icon,
|
@@ -0,0 +1 @@
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024" width="16px" fill="currentColor"><path d="M667.904 704.32L508.992 546.56l-157.888 158.912-45.376-45.056 157.824-158.976L304.64 343.488l45.12-45.376 158.912 157.824 157.888-158.848 45.44 45.056L553.984 501.12l158.976 157.888-45.12 45.44zM510.528 64a448 448 0 1 0 2.944 896 448 448 0 0 0-2.944-896z" fill="#E8684A"></path></svg>
|
@@ -0,0 +1 @@
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024" width="16px" fill="currentColor"><path d="M512 64A448 448 0 1 1 512 960 448 448 0 0 1 512 64z m32 354.944h-64V768h64V418.944zM512 256a38.4 38.4 0 1 0-0.128 76.672A38.4 38.4 0 0 0 512 256z" fill="#2468F2"></path></svg>
|
@@ -0,0 +1 @@
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024" width="16px" fill="currentColor"><path d="M449.856 706.56l-45.44-45.056 0.128-0.064L268.16 526.016l45.12-45.44 136.32 135.488 270.592-272.384 45.376 45.056-315.712 317.888zM510.528 64A448 448 0 1 0 960 510.528 448 448 0 0 0 510.528 64z" fill="#0BC286"></path></svg>
|
@@ -0,0 +1 @@
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 1024" width="16px" fill="currentColor"><path d="M512 64A448 448 0 1 1 512 960 448 448 0 0 1 512 64z m0 627.2A38.4 38.4 0 1 0 512 768a38.4 38.4 0 0 0 0-76.8zM544 256h-64v349.12h64V256z" fill="#FFB200"></path></svg>
|
package/src/renderers/Alert.tsx
CHANGED
@@ -1,7 +1,12 @@
|
|
1
1
|
import {Renderer, RendererProps} from '../factory';
|
2
2
|
import React from 'react';
|
3
3
|
import Alert, {AlertProps} from '../components/Alert2';
|
4
|
-
import {
|
4
|
+
import {
|
5
|
+
BaseSchema,
|
6
|
+
SchemaObject,
|
7
|
+
SchemaCollection,
|
8
|
+
SchemaIcon
|
9
|
+
} from '../Schema';
|
5
10
|
|
6
11
|
/**
|
7
12
|
* Alert 提示渲染器。
|
@@ -13,6 +18,11 @@ export interface AlertSchema extends BaseSchema {
|
|
13
18
|
*/
|
14
19
|
type: 'alert';
|
15
20
|
|
21
|
+
/**
|
22
|
+
* 提示框标题
|
23
|
+
*/
|
24
|
+
title?: string;
|
25
|
+
|
16
26
|
/**
|
17
27
|
* 内容区域
|
18
28
|
*/
|
@@ -27,6 +37,26 @@ export interface AlertSchema extends BaseSchema {
|
|
27
37
|
* 是否显示关闭按钮
|
28
38
|
*/
|
29
39
|
showCloseButton?: boolean;
|
40
|
+
|
41
|
+
/**
|
42
|
+
* 关闭按钮CSS类名
|
43
|
+
*/
|
44
|
+
closeButtonClassName?: string;
|
45
|
+
|
46
|
+
/**
|
47
|
+
* 是否显示ICON
|
48
|
+
*/
|
49
|
+
showIcon?: boolean;
|
50
|
+
|
51
|
+
/**
|
52
|
+
* 左侧图标
|
53
|
+
*/
|
54
|
+
icon?: SchemaIcon;
|
55
|
+
|
56
|
+
/**
|
57
|
+
* 图标CSS类名
|
58
|
+
*/
|
59
|
+
iconClassName?: string;
|
30
60
|
}
|
31
61
|
|
32
62
|
@Renderer({
|
package/src/renderers/Card.tsx
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import {findDOMNode} from 'react-dom';
|
3
3
|
import {Renderer, RendererProps} from '../factory';
|
4
|
-
import {SchemaNode, Schema, Action} from '../types';
|
4
|
+
import {SchemaNode, Schema, Action, PlainObject} from '../types';
|
5
5
|
import {filter, evalExpression} from '../utils/tpl';
|
6
6
|
import cx from 'classnames';
|
7
7
|
import Checkbox from '../components/Checkbox';
|
@@ -11,7 +11,8 @@ import {
|
|
11
11
|
isVisible,
|
12
12
|
isDisabled,
|
13
13
|
noop,
|
14
|
-
isClickOnInput
|
14
|
+
isClickOnInput,
|
15
|
+
hashCode
|
15
16
|
} from '../utils/helper';
|
16
17
|
import {resolveVariable} from '../utils/tpl-builtin';
|
17
18
|
import QuickEdit, {SchemaQuickEdit} from './QuickEdit';
|
@@ -128,6 +129,7 @@ export interface CardSchema extends BaseSchema {
|
|
128
129
|
avatar?: SchemaUrlPath;
|
129
130
|
|
130
131
|
avatarText?: SchemaTpl;
|
132
|
+
avatarTextBackground?: String[];
|
131
133
|
avatarTextClassName?: SchemaClassName;
|
132
134
|
|
133
135
|
/**
|
@@ -485,6 +487,7 @@ export class Card extends React.Component<CardProps> {
|
|
485
487
|
highlight: highlightTpl,
|
486
488
|
avatar: avatarTpl,
|
487
489
|
avatarText: avatarTextTpl,
|
490
|
+
avatarTextBackground,
|
488
491
|
title: titleTpl,
|
489
492
|
subTitle: subTitleTpl,
|
490
493
|
subTitlePlaceholder,
|
@@ -500,6 +503,13 @@ export class Card extends React.Component<CardProps> {
|
|
500
503
|
const title = filter(titleTpl, data);
|
501
504
|
const subTitle = filter(subTitleTpl, data);
|
502
505
|
const desc = filter(header?.description || descTpl, data);
|
506
|
+
const avatarTextStyle: PlainObject = {};
|
507
|
+
if (avatarText && avatarTextBackground && avatarTextBackground.length) {
|
508
|
+
avatarTextStyle['background'] =
|
509
|
+
avatarTextBackground[
|
510
|
+
Math.abs(hashCode(avatarText)) % avatarTextBackground.length
|
511
|
+
];
|
512
|
+
}
|
503
513
|
|
504
514
|
heading = (
|
505
515
|
<div className={cx('Card-heading', header?.className)}>
|
@@ -524,6 +534,7 @@ export class Card extends React.Component<CardProps> {
|
|
524
534
|
'Card-avtarText',
|
525
535
|
header?.avatarTextClassName || avatarTextClassName
|
526
536
|
)}
|
537
|
+
style={avatarTextStyle}
|
527
538
|
>
|
528
539
|
{avatarText}
|
529
540
|
</span>
|
@@ -66,12 +66,12 @@ const ConditionBuilderWithRemoteOptions = withRemoteConfig({
|
|
66
66
|
RemoteOptionsProps & React.ComponentProps<typeof ConditionBuilder>
|
67
67
|
> {
|
68
68
|
render() {
|
69
|
-
const {loading, config, deferLoad, ...rest} = this.props;
|
69
|
+
const {loading, config, deferLoad, disabled, ...rest} = this.props;
|
70
70
|
return (
|
71
71
|
<ConditionBuilder
|
72
72
|
{...rest}
|
73
73
|
fields={config || rest.fields || []}
|
74
|
-
disabled={loading}
|
74
|
+
disabled={disabled || loading}
|
75
75
|
/>
|
76
76
|
);
|
77
77
|
}
|
@@ -1,7 +1,9 @@
|
|
1
1
|
import React, {Suspense} from 'react';
|
2
|
-
import {FormItem, FormControlProps, FormBaseControl} from './Item';
|
3
2
|
import cx from 'classnames';
|
4
3
|
|
4
|
+
import {FormItem, FormControlProps, FormBaseControl} from './Item';
|
5
|
+
import type {PresetColor} from '../../components/ColorPicker';
|
6
|
+
|
5
7
|
export const ColorPicker = React.lazy(
|
6
8
|
() => import('../../components/ColorPicker')
|
7
9
|
);
|
@@ -34,7 +36,7 @@ export interface InputColorControlSchema extends FormBaseControl {
|
|
34
36
|
/**
|
35
37
|
* 预设颜色,用户可以直接从预设中选。
|
36
38
|
*/
|
37
|
-
presetColors?: Array<
|
39
|
+
presetColors?: Array<PresetColor>;
|
38
40
|
|
39
41
|
/**
|
40
42
|
* 是否允许用户输入颜色。
|
package/src/renderers/Page.tsx
CHANGED
@@ -85,6 +85,21 @@ export interface PageSchema extends BaseSchema {
|
|
85
85
|
*/
|
86
86
|
aside?: SchemaCollection;
|
87
87
|
|
88
|
+
/**
|
89
|
+
* 边栏是否允许拖动
|
90
|
+
*/
|
91
|
+
asideResizor?: boolean;
|
92
|
+
|
93
|
+
/**
|
94
|
+
* 边栏最小宽度
|
95
|
+
*/
|
96
|
+
asideMinWidth?: number;
|
97
|
+
|
98
|
+
/**
|
99
|
+
* 边栏最小宽度
|
100
|
+
*/
|
101
|
+
asideMaxWidth?: number;
|
102
|
+
|
88
103
|
/**
|
89
104
|
* 边栏区 css 类名
|
90
105
|
*/
|
@@ -199,6 +214,9 @@ export default class Page extends React.Component<PageProps> {
|
|
199
214
|
mounted: boolean;
|
200
215
|
style: HTMLStyleElement;
|
201
216
|
varStyle: HTMLStyleElement;
|
217
|
+
startX: number;
|
218
|
+
startWidth: number;
|
219
|
+
codeWrap: HTMLElement;
|
202
220
|
|
203
221
|
static defaultProps = {
|
204
222
|
asideClassName: '',
|
@@ -499,6 +517,37 @@ export default class Page extends React.Component<PageProps> {
|
|
499
517
|
}
|
500
518
|
}
|
501
519
|
|
520
|
+
@autobind
|
521
|
+
handleResizeMouseDown(e: React.MouseEvent) {
|
522
|
+
// todo 可能 ie 不正确
|
523
|
+
let isRightMB = e.nativeEvent.which == 3;
|
524
|
+
|
525
|
+
if (isRightMB) {
|
526
|
+
return;
|
527
|
+
}
|
528
|
+
|
529
|
+
this.codeWrap = e.currentTarget.parentElement as HTMLElement;
|
530
|
+
document.addEventListener('mousemove', this.handleResizeMouseMove);
|
531
|
+
document.addEventListener('mouseup', this.handleResizeMouseUp);
|
532
|
+
this.startX = e.clientX;
|
533
|
+
this.startWidth = this.codeWrap.offsetWidth;
|
534
|
+
}
|
535
|
+
|
536
|
+
@autobind
|
537
|
+
handleResizeMouseMove(e: MouseEvent) {
|
538
|
+
const {asideMinWidth = 160, asideMaxWidth = 350} = this.props;
|
539
|
+
const dx = e.clientX - this.startX;
|
540
|
+
const mx = this.startWidth + dx;
|
541
|
+
const width = Math.min(Math.max(mx, asideMinWidth), asideMaxWidth);
|
542
|
+
this.codeWrap.style.cssText += `width: ${width}px`;
|
543
|
+
}
|
544
|
+
|
545
|
+
@autobind
|
546
|
+
handleResizeMouseUp() {
|
547
|
+
document.removeEventListener('mousemove', this.handleResizeMouseMove);
|
548
|
+
document.removeEventListener('mouseup', this.handleResizeMouseUp);
|
549
|
+
}
|
550
|
+
|
502
551
|
openFeedback(dialog: any, ctx: any) {
|
503
552
|
return new Promise(resolve => {
|
504
553
|
const {store} = this.props;
|
@@ -658,6 +707,7 @@ export default class Page extends React.Component<PageProps> {
|
|
658
707
|
regions,
|
659
708
|
style,
|
660
709
|
data,
|
710
|
+
asideResizor,
|
661
711
|
translate: __
|
662
712
|
} = this.props;
|
663
713
|
|
@@ -684,7 +734,11 @@ export default class Page extends React.Component<PageProps> {
|
|
684
734
|
style={styleVar}
|
685
735
|
>
|
686
736
|
{hasAside ? (
|
687
|
-
<div className={cx(
|
737
|
+
<div className={cx(
|
738
|
+
`Page-aside`,
|
739
|
+
asideResizor ? 'relative' : 'Page-aside--withWidth',
|
740
|
+
asideClassName
|
741
|
+
)}>
|
688
742
|
{render('aside', aside || '', {
|
689
743
|
...subProps,
|
690
744
|
...(typeof aside === 'string'
|
@@ -694,6 +748,13 @@ export default class Page extends React.Component<PageProps> {
|
|
694
748
|
}
|
695
749
|
: null)
|
696
750
|
})}
|
751
|
+
{asideResizor ? (
|
752
|
+
<div
|
753
|
+
onMouseDown={this.handleResizeMouseDown}
|
754
|
+
className={cx(`Page-asideResizor`)}
|
755
|
+
></div>
|
756
|
+
) : null}
|
757
|
+
|
697
758
|
</div>
|
698
759
|
) : null}
|
699
760
|
|
package/src/store/formItem.ts
CHANGED
@@ -25,8 +25,7 @@ import {
|
|
25
25
|
spliceTree,
|
26
26
|
isEmpty,
|
27
27
|
getTreeAncestors,
|
28
|
-
filterTree
|
29
|
-
eachTree
|
28
|
+
filterTree
|
30
29
|
} from '../utils/helper';
|
31
30
|
import {flattenTree} from '../utils/helper';
|
32
31
|
import {IRendererStore} from '.';
|
@@ -691,30 +690,10 @@ export const FormItemStore = StoreNode.named('FormItemStore')
|
|
691
690
|
json.data ||
|
692
691
|
[];
|
693
692
|
|
694
|
-
const children = Array.isArray(self.options[0].children)
|
695
|
-
? self.options[0].children.concat()
|
696
|
-
: [];
|
697
|
-
|
698
|
-
eachTree(options as any, item => {
|
699
|
-
if (!item.value) {
|
700
|
-
return;
|
701
|
-
}
|
702
|
-
|
703
|
-
const exits = children.find((a: any) => a.ref === item.value);
|
704
|
-
if (!exits) {
|
705
|
-
children.push({
|
706
|
-
ref: item.value,
|
707
|
-
children: [],
|
708
|
-
defer: true
|
709
|
-
});
|
710
|
-
}
|
711
|
-
});
|
712
|
-
|
713
693
|
setOptions(
|
714
694
|
[
|
715
695
|
{
|
716
696
|
...self.options[0],
|
717
|
-
children,
|
718
697
|
leftOptions: spliceTree(leftOptions, indexes, 1, {
|
719
698
|
...option,
|
720
699
|
loading: false,
|