amis 1.4.2-beta.12 → 1.4.2-beta.13
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/InputBox.d.ts +22 -21
- package/lib/components/InputBox.js +10 -2
- package/lib/components/InputBox.js.map +2 -2
- package/lib/components/ResultBox.d.ts +84 -84
- package/lib/components/ResultBox.js +10 -2
- package/lib/components/ResultBox.js.map +2 -2
- package/lib/components/TransferDropDown.d.ts +85 -84
- package/lib/components/TransferDropDown.js +2 -2
- package/lib/components/TransferDropDown.js.map +2 -2
- package/lib/components/TransferPicker.d.ts +4 -0
- package/lib/components/TransferPicker.js +2 -2
- package/lib/components/TransferPicker.js.map +2 -2
- package/lib/components/icons.js +2 -0
- package/lib/components/icons.js.map +2 -2
- package/lib/icons/download.js +7 -0
- package/lib/index.js +1 -1
- package/lib/locale/en-US.js +1 -0
- package/lib/locale/en-US.js.map +2 -2
- package/lib/locale/zh-CN.js +1 -0
- package/lib/locale/zh-CN.js.map +2 -2
- package/lib/renderers/Form/InputFile.d.ts +6 -0
- package/lib/renderers/Form/InputFile.js +18 -4
- package/lib/renderers/Form/InputFile.js.map +2 -2
- package/lib/renderers/Form/Select.d.ts +1 -0
- package/lib/renderers/Form/Select.js +2 -2
- package/lib/renderers/Form/Select.js.map +2 -2
- package/lib/renderers/Form/TransferPicker.d.ts +4 -0
- package/lib/renderers/Form/TransferPicker.js +2 -2
- package/lib/renderers/Form/TransferPicker.js.map +2 -2
- package/lib/renderers/Form/index.js +1 -1
- package/lib/renderers/Form/index.js.map +2 -2
- package/lib/store/table.js +5 -5
- package/lib/store/table.js.map +2 -2
- package/lib/themes/ang-ie11.css +30 -4
- package/lib/themes/ang.css +30 -4
- package/lib/themes/ang.css.map +1 -1
- package/lib/themes/antd-ie11.css +30 -4
- package/lib/themes/antd.css +30 -4
- package/lib/themes/antd.css.map +1 -1
- package/lib/themes/cxd-ie11.css +30 -4
- package/lib/themes/cxd.css +30 -4
- package/lib/themes/cxd.css.map +1 -1
- package/lib/themes/dark-ie11.css +30 -4
- package/lib/themes/dark.css +30 -4
- package/lib/themes/dark.css.map +1 -1
- package/lib/themes/default.css +30 -4
- package/lib/themes/default.css.map +1 -1
- package/package.json +1 -1
- package/schema.json +36 -14
- package/scss/base/_common.scss +3 -0
- package/scss/components/_input-box.scss +1 -0
- package/scss/components/_picker-columns.scss +1 -0
- package/scss/components/_popover.scss +0 -4
- package/scss/components/_result-box.scss +1 -0
- package/scss/components/form/_file.scss +11 -0
- package/scss/themes/_common.scss +1 -0
- package/sdk/ang-ie11.css +41 -4
- package/sdk/ang.css +36 -4
- package/sdk/antd-ie11.css +41 -4
- package/sdk/antd.css +36 -4
- package/sdk/charts.js +13 -13
- package/sdk/color-picker.js +65 -65
- package/sdk/cropperjs.js +2 -2
- package/sdk/cxd-ie11.css +41 -4
- package/sdk/cxd.css +36 -4
- package/sdk/dark-ie11.css +41 -4
- package/sdk/dark.css +36 -4
- 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 +41 -4
- package/sdk/sdk.css +36 -4
- package/sdk/sdk.js +1144 -1142
- 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/InputBox.tsx +10 -9
- package/src/components/ResultBox.tsx +9 -9
- package/src/components/TransferDropDown.tsx +4 -1
- package/src/components/TransferPicker.tsx +7 -0
- package/src/components/icons.tsx +2 -0
- package/src/icons/download.svg +4 -0
- package/src/locale/en-US.ts +1 -0
- package/src/locale/zh-CN.ts +1 -0
- package/src/renderers/Form/InputFile.tsx +36 -4
- package/src/renderers/Form/Item.tsx +2 -1
- package/src/renderers/Form/Select.tsx +6 -2
- package/src/renderers/Form/TransferPicker.tsx +7 -1
- package/src/renderers/Form/index.tsx +1 -2
- package/src/store/table.ts +9 -5
@@ -1,7 +1,7 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import {ThemeProps, themeable} from '../theme';
|
3
3
|
import Input from './Input';
|
4
|
-
import {autobind} from '../utils/helper';
|
4
|
+
import {autobind, ucFirst} from '../utils/helper';
|
5
5
|
import {Icon} from './icons';
|
6
6
|
|
7
7
|
export interface InputBoxProps
|
@@ -17,6 +17,7 @@ export interface InputBoxProps
|
|
17
17
|
placeholder?: string;
|
18
18
|
prefix?: JSX.Element;
|
19
19
|
children?: JSX.Element;
|
20
|
+
borderMode?: 'full' | 'half' | 'none';
|
20
21
|
}
|
21
22
|
|
22
23
|
export interface InputBoxState {
|
@@ -79,20 +80,20 @@ export class InputBox extends React.Component<InputBoxProps, InputBoxState> {
|
|
79
80
|
placeholder,
|
80
81
|
prefix: result,
|
81
82
|
children,
|
83
|
+
borderMode,
|
82
84
|
...rest
|
83
85
|
} = this.props;
|
84
86
|
const isFocused = this.state.isFocused;
|
85
87
|
|
86
88
|
return (
|
87
89
|
<div
|
88
|
-
className={cx(
|
89
|
-
'
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
)}
|
90
|
+
className={cx('InputBox', className, {
|
91
|
+
'is-focused': isFocused,
|
92
|
+
'is-disabled': disabled,
|
93
|
+
'is-error': hasError,
|
94
|
+
'is-clickable': rest.onClick,
|
95
|
+
[`InputBox--border${ucFirst(borderMode)}`]: borderMode
|
96
|
+
})}
|
96
97
|
>
|
97
98
|
{result}
|
98
99
|
|
@@ -4,7 +4,7 @@ import {InputBoxProps} from './InputBox';
|
|
4
4
|
import {uncontrollable} from 'uncontrollable';
|
5
5
|
import {Icon} from './icons';
|
6
6
|
import Input from './Input';
|
7
|
-
import {autobind} from '../utils/helper';
|
7
|
+
import {autobind, ucFirst} from '../utils/helper';
|
8
8
|
import {LocaleProps, localeable} from '../locale';
|
9
9
|
|
10
10
|
export interface ResultBoxProps
|
@@ -113,20 +113,20 @@ export class ResultBox extends React.Component<ResultBoxProps> {
|
|
113
113
|
onKeyPress,
|
114
114
|
onFocus,
|
115
115
|
onBlur,
|
116
|
+
borderMode,
|
116
117
|
...rest
|
117
118
|
} = this.props;
|
118
119
|
const isFocused = this.state.isFocused;
|
119
120
|
|
120
121
|
return (
|
121
122
|
<div
|
122
|
-
className={cx(
|
123
|
-
'
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
)}
|
123
|
+
className={cx('ResultBox', className, {
|
124
|
+
'is-focused': isFocused,
|
125
|
+
'is-disabled': disabled,
|
126
|
+
'is-error': hasError,
|
127
|
+
'is-clickable': onResultClick,
|
128
|
+
[`ResultBox--border${ucFirst(borderMode)}`]: borderMode
|
129
|
+
})}
|
130
130
|
onClick={onResultClick}
|
131
131
|
tabIndex={!allowInput && !disabled && onFocus ? 0 : -1}
|
132
132
|
onKeyPress={allowInput ? undefined : onKeyPress}
|
@@ -11,6 +11,7 @@ import PopOverContainer from './PopOverContainer';
|
|
11
11
|
export interface TransferDropDownProps extends TransferProps {
|
12
12
|
// 新的属性?
|
13
13
|
multiple?: boolean;
|
14
|
+
borderMode?: 'full' | 'half' | 'none';
|
14
15
|
}
|
15
16
|
|
16
17
|
export class TransferDropDown extends Transfer<TransferDropDownProps> {
|
@@ -23,7 +24,8 @@ export class TransferDropDown extends Transfer<TransferDropDownProps> {
|
|
23
24
|
className,
|
24
25
|
onChange,
|
25
26
|
onSearch,
|
26
|
-
multiple
|
27
|
+
multiple,
|
28
|
+
borderMode
|
27
29
|
} = this.props;
|
28
30
|
const {inputValue, searchResult} = this.state;
|
29
31
|
|
@@ -84,6 +86,7 @@ export class TransferDropDown extends Transfer<TransferDropDownProps> {
|
|
84
86
|
className,
|
85
87
|
isOpened ? 'is-active' : ''
|
86
88
|
)}
|
89
|
+
borderMode={borderMode}
|
87
90
|
allowInput={false}
|
88
91
|
result={
|
89
92
|
multiple
|
@@ -11,6 +11,11 @@ import {autobind} from '../utils/helper';
|
|
11
11
|
export interface TransferPickerProps extends Omit<TransferProps, 'itemRender'> {
|
12
12
|
// 新的属性?
|
13
13
|
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'full';
|
14
|
+
|
15
|
+
/**
|
16
|
+
* 边框模式,全边框,还是半边框,或者没边框。
|
17
|
+
*/
|
18
|
+
borderMode?: 'full' | 'half' | 'none';
|
14
19
|
}
|
15
20
|
|
16
21
|
export class TransferPicker extends React.Component<TransferPickerProps> {
|
@@ -37,6 +42,7 @@ export class TransferPicker extends React.Component<TransferPickerProps> {
|
|
37
42
|
className,
|
38
43
|
onChange,
|
39
44
|
size,
|
45
|
+
borderMode,
|
40
46
|
...rest
|
41
47
|
} = this.props;
|
42
48
|
|
@@ -64,6 +70,7 @@ export class TransferPicker extends React.Component<TransferPickerProps> {
|
|
64
70
|
onResultClick={onClick}
|
65
71
|
placeholder={__('Select.placeholder')}
|
66
72
|
disabled={disabled}
|
73
|
+
borderMode={borderMode}
|
67
74
|
>
|
68
75
|
<span className={cx('TransferPicker-icon')}>
|
69
76
|
<Icon icon="pencil" className="icon" />
|
package/src/components/icons.tsx
CHANGED
@@ -24,6 +24,7 @@ import ViewIcon from '../icons/view.svg';
|
|
24
24
|
import RemoveIcon from '../icons/remove.svg';
|
25
25
|
import RetryIcon from '../icons/retry.svg';
|
26
26
|
import UploadIcon from '../icons/upload.svg';
|
27
|
+
import DownloadIcon from '../icons/download.svg';
|
27
28
|
import FileIcon from '../icons/file.svg';
|
28
29
|
import StatusSuccessIcon from '../icons/status-success.svg';
|
29
30
|
import StatusFailIcon from '../icons/status-fail.svg';
|
@@ -120,6 +121,7 @@ registerIcon('view', ViewIcon);
|
|
120
121
|
registerIcon('remove', RemoveIcon);
|
121
122
|
registerIcon('retry', RetryIcon);
|
122
123
|
registerIcon('upload', UploadIcon);
|
124
|
+
registerIcon('download', DownloadIcon);
|
123
125
|
registerIcon('file', FileIcon);
|
124
126
|
registerIcon('status-success', StatusSuccessIcon);
|
125
127
|
registerIcon('status-fail', StatusFailIcon);
|
@@ -0,0 +1,4 @@
|
|
1
|
+
<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="download" class="svg-inline--fa fa-download fa-w-16" role="img"
|
2
|
+
xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
|
3
|
+
<path fill="currentColor" d="M216 0h80c13.3 0 24 10.7 24 24v168h87.7c17.8 0 26.7 21.5 14.1 34.1L269.7 378.3c-7.5 7.5-19.8 7.5-27.3 0L90.1 226.1c-12.6-12.6-3.7-34.1 14.1-34.1H192V24c0-13.3 10.7-24 24-24zm296 376v112c0 13.3-10.7 24-24 24H24c-13.3 0-24-10.7-24-24V376c0-13.3 10.7-24 24-24h146.7l49 49c20.1 20.1 52.5 20.1 72.6 0l49-49H488c13.3 0 24 10.7 24 24zm-124 88c0-11-9-20-20-20s-20 9-20 20 9 20 20 20 20-9 20-20zm64 0c0-11-9-20-20-20s-20 9-20 20 9 20 20 20 20-9 20-20z"></path>
|
4
|
+
</svg>
|
package/src/locale/en-US.ts
CHANGED
@@ -85,6 +85,7 @@ register('en-US', {
|
|
85
85
|
'Excel.placeholder': `Drag 'n' drop excel here, or click to select`,
|
86
86
|
'fetchFailed': 'Fetch api failed',
|
87
87
|
'File.continueAdd': 'Continue add',
|
88
|
+
'File.downloadTpl': 'Download template',
|
88
89
|
'File.dragDrop': `Drag 'n' drop some files here`,
|
89
90
|
'File.errorRetry': 'File upload failed, please try again',
|
90
91
|
'File.failed': 'Failed files.',
|
package/src/locale/zh-CN.ts
CHANGED
@@ -18,7 +18,8 @@ import {dataMapping} from '../../utils/tpl-builtin';
|
|
18
18
|
import {
|
19
19
|
SchemaApi,
|
20
20
|
SchemaClassName,
|
21
|
-
SchemaTokenizeableString
|
21
|
+
SchemaTokenizeableString,
|
22
|
+
SchemaUrlPath
|
22
23
|
} from '../../Schema';
|
23
24
|
import merge from 'lodash/merge';
|
24
25
|
|
@@ -89,6 +90,11 @@ export interface FileControlSchema extends FormBaseControl {
|
|
89
90
|
*/
|
90
91
|
downloadUrl?: SchemaApi;
|
91
92
|
|
93
|
+
/**
|
94
|
+
* 模板下载地址
|
95
|
+
*/
|
96
|
+
templateUrl?: SchemaApi;
|
97
|
+
|
92
98
|
/**
|
93
99
|
* 默认 `file`, 如果你不想自己存储,则可以忽略此属性。
|
94
100
|
* @default file
|
@@ -276,6 +282,7 @@ export default class FileControl extends React.Component<FileProps, FileState> {
|
|
276
282
|
extractValue: false,
|
277
283
|
delimiter: ',',
|
278
284
|
downloadUrl: '', // '/api/file/'
|
285
|
+
templateUrl: '',
|
279
286
|
useChunk: 'auto',
|
280
287
|
chunkSize: 5 * 1024 * 1024, // 文件大于5M, 自动分块上传
|
281
288
|
startChunkApi: '/api/upload/startChunk',
|
@@ -388,6 +395,7 @@ export default class FileControl extends React.Component<FileProps, FileState> {
|
|
388
395
|
this.uploadBigFile = this.uploadBigFile.bind(this);
|
389
396
|
this.handleSelect = this.handleSelect.bind(this);
|
390
397
|
this.syncAutoFill = this.syncAutoFill.bind(this);
|
398
|
+
this.downloadTpl = this.downloadTpl.bind(this);
|
391
399
|
}
|
392
400
|
|
393
401
|
componentDidMount() {
|
@@ -535,7 +543,7 @@ export default class FileControl extends React.Component<FileProps, FileState> {
|
|
535
543
|
e.preventDefault();
|
536
544
|
e.stopPropagation();
|
537
545
|
|
538
|
-
const {
|
546
|
+
const {downloadUrl} = this.props;
|
539
547
|
const urlField = this.props.urlField || 'url';
|
540
548
|
const valueField = this.props.valueField || 'value';
|
541
549
|
|
@@ -550,10 +558,23 @@ export default class FileControl extends React.Component<FileProps, FileState> {
|
|
550
558
|
? downloadUrl
|
551
559
|
: `${fileUrl}`;
|
552
560
|
|
561
|
+
this.handleApi(api, file);
|
562
|
+
}
|
563
|
+
|
564
|
+
downloadTpl(e: React.MouseEvent) {
|
565
|
+
e.preventDefault();
|
566
|
+
e.stopPropagation();
|
567
|
+
|
568
|
+
this.handleApi(this.props.templateUrl || '');
|
569
|
+
}
|
570
|
+
|
571
|
+
handleApi(api: SchemaApi, payload?: object) {
|
572
|
+
const {data, env} = this.props;
|
553
573
|
if (api) {
|
554
574
|
const ctx = createObject(data, {
|
555
|
-
...
|
575
|
+
...payload
|
556
576
|
});
|
577
|
+
|
557
578
|
const apiObject = normalizeApi(api);
|
558
579
|
|
559
580
|
if (apiObject.method?.toLowerCase() === 'get' && !apiObject.data) {
|
@@ -1171,7 +1192,8 @@ export default class FileControl extends React.Component<FileProps, FileState> {
|
|
1171
1192
|
classnames: cx,
|
1172
1193
|
translate: __,
|
1173
1194
|
render,
|
1174
|
-
downloadUrl
|
1195
|
+
downloadUrl,
|
1196
|
+
templateUrl
|
1175
1197
|
} = this.props;
|
1176
1198
|
let {files, uploading, error} = this.state;
|
1177
1199
|
const nameField = this.props.nameField || 'name';
|
@@ -1194,6 +1216,16 @@ export default class FileControl extends React.Component<FileProps, FileState> {
|
|
1194
1216
|
|
1195
1217
|
return (
|
1196
1218
|
<div className={cx('FileControl', className)}>
|
1219
|
+
{templateUrl ? (
|
1220
|
+
<a
|
1221
|
+
className={cx('FileControl-templateInfo')}
|
1222
|
+
onClick={this.downloadTpl.bind(this)}
|
1223
|
+
>
|
1224
|
+
<Icon icon="download" className="icon" />
|
1225
|
+
<span>{__('File.downloadTpl')}</span>
|
1226
|
+
</a>
|
1227
|
+
) : null}
|
1228
|
+
|
1197
1229
|
<DropZone
|
1198
1230
|
disabled={disabled}
|
1199
1231
|
key="drop-zone"
|
@@ -344,7 +344,9 @@ export interface TransferDropDownProps
|
|
344
344
|
| 'inputClassName'
|
345
345
|
| 'className'
|
346
346
|
| 'descriptionClassName'
|
347
|
-
> {
|
347
|
+
> {
|
348
|
+
borderMode?: 'full' | 'half' | 'none';
|
349
|
+
}
|
348
350
|
|
349
351
|
class TransferDropdownRenderer extends BaseTransferRenderer<TransferDropDownProps> {
|
350
352
|
render() {
|
@@ -363,7 +365,8 @@ class TransferDropdownRenderer extends BaseTransferRenderer<TransferDropDownProp
|
|
363
365
|
selectMode,
|
364
366
|
multiple,
|
365
367
|
columns,
|
366
|
-
leftMode
|
368
|
+
leftMode,
|
369
|
+
borderMode
|
367
370
|
} = this.props;
|
368
371
|
|
369
372
|
// 目前 LeftOptions 没有接口可以动态加载
|
@@ -402,6 +405,7 @@ class TransferDropdownRenderer extends BaseTransferRenderer<TransferDropDownProp
|
|
402
405
|
columns={columns}
|
403
406
|
leftMode={leftMode}
|
404
407
|
leftOptions={leftOptions}
|
408
|
+
borderMode={borderMode}
|
405
409
|
/>
|
406
410
|
|
407
411
|
<Spinner overlay key="info" show={loading} />
|
@@ -17,6 +17,10 @@ import TransferPicker from '../../components/TransferPicker';
|
|
17
17
|
*/
|
18
18
|
export interface TransferPickerControlSchema extends FormOptionsControl {
|
19
19
|
type: 'transfer-picker';
|
20
|
+
/**
|
21
|
+
* 边框模式,全边框,还是半边框,或者没边框。
|
22
|
+
*/
|
23
|
+
borderMode?: 'full' | 'half' | 'none';
|
20
24
|
|
21
25
|
/**
|
22
26
|
* 是否显示剪头
|
@@ -91,7 +95,8 @@ export class TransferPickerRenderer extends BaseTransferRenderer<TabsTransferPro
|
|
91
95
|
pickerSize,
|
92
96
|
columns,
|
93
97
|
leftMode,
|
94
|
-
selectMode
|
98
|
+
selectMode,
|
99
|
+
borderMode
|
95
100
|
} = this.props;
|
96
101
|
|
97
102
|
// 目前 LeftOptions 没有接口可以动态加载
|
@@ -113,6 +118,7 @@ export class TransferPickerRenderer extends BaseTransferRenderer<TabsTransferPro
|
|
113
118
|
return (
|
114
119
|
<div className={cx('TransferControl', className)}>
|
115
120
|
<TransferPicker
|
121
|
+
borderMode={borderMode}
|
116
122
|
selectMode={selectMode}
|
117
123
|
value={selectedOptions}
|
118
124
|
disabled={disabled}
|
@@ -1440,8 +1440,7 @@ export default class Form extends React.Component<FormProps, object> {
|
|
1440
1440
|
className={cx(
|
1441
1441
|
`Form`,
|
1442
1442
|
`Form--${mode || 'normal'}`,
|
1443
|
-
|
1444
|
-
`Form--column-${columnCount}`,
|
1443
|
+
columnCount ? `Form--column Form--column-${columnCount}` : null,
|
1445
1444
|
className
|
1446
1445
|
)}
|
1447
1446
|
onSubmit={this.handleFormSubmit}
|
package/src/store/table.ts
CHANGED
@@ -429,7 +429,7 @@ export const TableStore = iRendererStore
|
|
429
429
|
}
|
430
430
|
|
431
431
|
function getUnSelectedRows() {
|
432
|
-
return self.rows.filter(item => !item.checked);
|
432
|
+
return flattenTree<IRow>(self.rows).filter((item: IRow) => !item.checked);
|
433
433
|
}
|
434
434
|
|
435
435
|
function getData(superData: any): any {
|
@@ -604,7 +604,9 @@ export const TableStore = iRendererStore
|
|
604
604
|
},
|
605
605
|
|
606
606
|
get checkableRows() {
|
607
|
-
return self.rows.filter(
|
607
|
+
return flattenTree<IRow>(self.rows).filter(
|
608
|
+
(item: IRow) => item.checkable
|
609
|
+
);
|
608
610
|
},
|
609
611
|
|
610
612
|
get expandableRows() {
|
@@ -1023,9 +1025,10 @@ export const TableStore = iRendererStore
|
|
1023
1025
|
|
1024
1026
|
function updateSelected(selected: Array<any>, valueField?: string) {
|
1025
1027
|
self.selectedRows.clear();
|
1026
|
-
|
1028
|
+
|
1029
|
+
eachTree(self.rows, item => {
|
1027
1030
|
if (~selected.indexOf(item.pristine)) {
|
1028
|
-
self.selectedRows.push(item);
|
1031
|
+
self.selectedRows.push(item.id);
|
1029
1032
|
} else if (
|
1030
1033
|
find(
|
1031
1034
|
selected,
|
@@ -1034,9 +1037,10 @@ export const TableStore = iRendererStore
|
|
1034
1037
|
a[valueField || 'value'] == item.pristine[valueField || 'value']
|
1035
1038
|
)
|
1036
1039
|
) {
|
1037
|
-
self.selectedRows.push(item);
|
1040
|
+
self.selectedRows.push(item.id);
|
1038
1041
|
}
|
1039
1042
|
});
|
1043
|
+
|
1040
1044
|
updateCheckDisable();
|
1041
1045
|
}
|
1042
1046
|
|