amis 1.3.5-beta.6 → 1.4.2-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/lib/Schema.d.ts +17 -0
- package/lib/Schema.js.map +1 -1
- package/lib/components/Alert.js +3 -1
- package/lib/components/Alert.js.map +2 -2
- package/lib/components/Badge.d.ts +16 -3
- package/lib/components/Badge.js +53 -4
- package/lib/components/Badge.js.map +2 -2
- package/lib/components/Button.d.ts +24 -22
- package/lib/components/Button.js +13 -7
- package/lib/components/Button.js.map +2 -2
- package/lib/components/Checkbox.d.ts +1 -1
- package/lib/components/Checkbox.js +1 -1
- package/lib/components/Checkbox.js.map +2 -2
- package/lib/components/Collapse.js +1 -1
- package/lib/components/Collapse.js.map +2 -2
- package/lib/components/DatePicker.js +1 -1
- package/lib/components/DatePicker.js.map +2 -2
- package/lib/components/DateRangePicker.js +1 -1
- package/lib/components/DateRangePicker.js.map +2 -2
- package/lib/components/Drawer.js +1 -1
- package/lib/components/Drawer.js.map +2 -2
- package/lib/components/InputBox.js +1 -1
- package/lib/components/InputBox.js.map +2 -2
- package/lib/components/Link.d.ts +91 -0
- package/lib/components/Link.js +44 -0
- package/lib/components/Link.js.map +13 -0
- package/lib/components/Modal.js +1 -1
- package/lib/components/Modal.js.map +2 -2
- package/lib/components/MonthRangePicker.js +1 -1
- package/lib/components/MonthRangePicker.js.map +2 -2
- package/lib/components/RichText.d.ts +6 -1
- package/lib/components/RichText.js +207 -8
- package/lib/components/RichText.js.map +2 -2
- package/lib/components/Select.d.ts +7 -0
- package/lib/components/Select.js +3 -0
- package/lib/components/Select.js.map +2 -2
- package/lib/components/SparkLine.d.ts +85 -84
- package/lib/components/SparkLine.js +2 -2
- package/lib/components/SparkLine.js.map +2 -2
- package/lib/components/Steps.d.ts +3 -3
- package/lib/components/Steps.js.map +1 -1
- package/lib/components/Toast.js +2 -2
- package/lib/components/Toast.js.map +2 -2
- package/lib/components/Tree.js +5 -3
- package/lib/components/Tree.js.map +2 -2
- package/lib/components/WithRemoteConfig.d.ts +8 -0
- package/lib/components/WithRemoteConfig.js +28 -2
- package/lib/components/WithRemoteConfig.js.map +2 -2
- package/lib/components/calendar/DaysView.js +2 -2
- package/lib/components/calendar/DaysView.js.map +2 -2
- package/lib/components/condition-builder/Field.js +0 -1
- package/lib/components/condition-builder/Field.js.map +2 -2
- package/lib/components/condition-builder/Value.js +2 -1
- package/lib/components/condition-builder/Value.js.map +2 -2
- package/lib/components/condition-builder/types.d.ts +5 -0
- package/lib/components/condition-builder/types.js.map +1 -1
- package/lib/components/icons.js +14 -0
- package/lib/components/icons.js.map +2 -2
- package/lib/factory.d.ts +5 -1
- package/lib/factory.js +9 -4
- package/lib/factory.js.map +2 -2
- package/lib/helper.css.map +1 -1
- package/lib/icons/clock.js +10 -0
- package/lib/icons/loading-outline.js +7 -0
- package/lib/icons/status-close.js +11 -0
- package/lib/icons/status-fail.js +11 -0
- package/lib/icons/status-info.js +10 -0
- package/lib/icons/status-success.js +11 -0
- package/lib/icons/status-warning.js +10 -0
- package/lib/index.js +1 -1
- package/lib/locale/de-DE.js +3 -0
- package/lib/locale/de-DE.js.map +2 -2
- package/lib/locale/en-US.js +4 -1
- package/lib/locale/en-US.js.map +2 -2
- package/lib/locale/zh-CN.js +5 -2
- package/lib/locale/zh-CN.js.map +2 -2
- package/lib/renderers/Action.d.ts +16 -1
- package/lib/renderers/Action.js +5 -5
- package/lib/renderers/Action.js.map +2 -2
- package/lib/renderers/CRUD.d.ts +2 -2
- package/lib/renderers/CRUD.js +32 -26
- package/lib/renderers/CRUD.js.map +2 -2
- package/lib/renderers/Collapse.d.ts +1 -1
- package/lib/renderers/Collapse.js +7 -3
- package/lib/renderers/Collapse.js.map +2 -2
- package/lib/renderers/Dialog.d.ts +0 -252
- package/lib/renderers/Dialog.js +1 -4
- package/lib/renderers/Dialog.js.map +2 -2
- package/lib/renderers/Drawer.js +0 -3
- package/lib/renderers/Drawer.js.map +2 -2
- package/lib/renderers/DropDownButton.d.ts +13 -1
- package/lib/renderers/DropDownButton.js +9 -5
- package/lib/renderers/DropDownButton.js.map +2 -2
- package/lib/renderers/Form/ButtonGroupSelect.js +3 -0
- package/lib/renderers/Form/ButtonGroupSelect.js.map +2 -2
- package/lib/renderers/Form/Checkbox.d.ts +5 -0
- package/lib/renderers/Form/Checkbox.js +4 -0
- package/lib/renderers/Form/Checkbox.js.map +2 -2
- package/lib/renderers/Form/Combo.js +2 -2
- package/lib/renderers/Form/Combo.js.map +2 -2
- package/lib/renderers/Form/DiffEditor.d.ts +0 -2
- package/lib/renderers/Form/Editor.d.ts +0 -2
- package/lib/renderers/Form/Editor.js +1 -1
- package/lib/renderers/Form/Editor.js.map +2 -2
- package/lib/renderers/Form/InputExcel.d.ts +5 -0
- package/lib/renderers/Form/InputExcel.js +24 -3
- package/lib/renderers/Form/InputExcel.js.map +2 -2
- package/lib/renderers/Form/InputFile.js +2 -2
- package/lib/renderers/Form/InputFile.js.map +2 -2
- package/lib/renderers/Form/InputImage.d.ts +8 -0
- package/lib/renderers/Form/InputImage.js +7 -4
- package/lib/renderers/Form/InputImage.js.map +2 -2
- package/lib/renderers/Form/InputTable.d.ts +23 -5
- package/lib/renderers/Form/InputTable.js +32 -3
- package/lib/renderers/Form/InputTable.js.map +2 -2
- package/lib/renderers/Form/Options.js +6 -3
- package/lib/renderers/Form/Options.js.map +2 -2
- package/lib/renderers/Form/Picker.js +2 -2
- package/lib/renderers/Form/Picker.js.map +2 -2
- package/lib/renderers/Form/wrapControl.js +2 -2
- package/lib/renderers/Form/wrapControl.js.map +2 -2
- package/lib/renderers/IFrame.js +2 -2
- package/lib/renderers/IFrame.js.map +2 -2
- package/lib/renderers/Image.d.ts +1 -0
- package/lib/renderers/Image.js +15 -1
- package/lib/renderers/Image.js.map +2 -2
- package/lib/renderers/Json.js +5 -1
- package/lib/renderers/Json.js.map +2 -2
- package/lib/renderers/Link.d.ts +16 -3
- package/lib/renderers/Link.js +16 -13
- package/lib/renderers/Link.js.map +2 -2
- package/lib/renderers/Log.d.ts +2 -2
- package/lib/renderers/Log.js +7 -1
- package/lib/renderers/Log.js.map +2 -2
- package/lib/renderers/Nav.d.ts +81 -25
- package/lib/renderers/Nav.js +272 -29
- package/lib/renderers/Nav.js.map +2 -2
- package/lib/renderers/Page.js +4 -1
- package/lib/renderers/Page.js.map +2 -2
- package/lib/renderers/Service.d.ts +10 -1
- package/lib/renderers/Service.js +85 -3
- package/lib/renderers/Service.js.map +2 -2
- package/lib/renderers/SparkLine.d.ts +4 -0
- package/lib/renderers/SparkLine.js.map +2 -2
- package/lib/renderers/Steps.d.ts +4 -4
- package/lib/renderers/Steps.js +5 -2
- package/lib/renderers/Steps.js.map +2 -2
- package/lib/renderers/Table/ColumnToggler.d.ts +113 -0
- package/lib/renderers/Table/ColumnToggler.js +216 -0
- package/lib/renderers/Table/ColumnToggler.js.map +13 -0
- package/lib/renderers/Table/ItemActionsWrapper.d.ts +11 -0
- package/lib/renderers/Table/ItemActionsWrapper.js +31 -0
- package/lib/renderers/Table/ItemActionsWrapper.js.map +13 -0
- package/lib/renderers/Table/TableBody.d.ts +5 -1
- package/lib/renderers/Table/TableBody.js +5 -1
- package/lib/renderers/Table/TableBody.js.map +2 -2
- package/lib/renderers/Table/TableCell.js +3 -1
- package/lib/renderers/Table/TableCell.js.map +2 -2
- package/lib/renderers/Table/TableContent.d.ts +1 -1
- package/lib/renderers/Table/TableContent.js +4 -0
- package/lib/renderers/Table/TableContent.js.map +2 -2
- package/lib/renderers/Table/index.d.ts +22 -4
- package/lib/renderers/Table/index.js +196 -81
- package/lib/renderers/Table/index.js.map +2 -2
- package/lib/store/app.d.ts +0 -1
- package/lib/store/combo.d.ts +0 -2
- package/lib/store/crud.d.ts +3 -3
- package/lib/store/crud.js +41 -36
- package/lib/store/crud.js.map +2 -2
- package/lib/store/form.d.ts +0 -1
- package/lib/store/modal.d.ts +1 -1
- package/lib/store/modal.js +4 -0
- package/lib/store/modal.js.map +2 -2
- package/lib/store/root.d.ts +0 -1
- package/lib/store/service.d.ts +0 -1
- package/lib/store/service.js +0 -13
- package/lib/store/service.js.map +2 -2
- package/lib/store/table.d.ts +258 -3
- package/lib/store/table.js +83 -7
- package/lib/store/table.js.map +2 -2
- package/lib/themes/ang-ie11.css +941 -98
- package/lib/themes/ang.css +941 -98
- package/lib/themes/ang.css.map +1 -1
- package/lib/themes/antd-ie11.css +941 -98
- package/lib/themes/antd.css +941 -98
- package/lib/themes/antd.css.map +1 -1
- package/lib/themes/cxd-ie11.css +1580 -411
- package/lib/themes/cxd.css +1580 -411
- package/lib/themes/cxd.css.map +1 -1
- package/lib/themes/dark-ie11.css +941 -98
- package/lib/themes/dark.css +941 -98
- package/lib/themes/dark.css.map +1 -1
- package/lib/themes/default.css +1580 -411
- package/lib/themes/default.css.map +1 -1
- package/lib/utils/api.js +16 -4
- package/lib/utils/api.js.map +2 -2
- package/lib/utils/attachmentAdpator.d.ts +7 -0
- package/lib/utils/attachmentAdpator.js +82 -0
- package/lib/utils/attachmentAdpator.js.map +13 -0
- package/lib/utils/handleAction.d.ts +7 -0
- package/lib/utils/handleAction.js +30 -0
- package/lib/utils/handleAction.js.map +13 -0
- package/lib/utils/helper.d.ts +1 -1
- package/lib/utils/helper.js +3 -3
- package/lib/utils/helper.js.map +2 -2
- package/lib/utils/tpl-builtin.d.ts +1 -1
- package/lib/utils/tpl-builtin.js +25 -15
- package/lib/utils/tpl-builtin.js.map +2 -2
- package/lib/utils/validations.js +62 -5
- package/lib/utils/validations.js.map +2 -2
- package/package.json +1 -2
- package/schema.json +633 -273
- package/scss/_mixins.scss +29 -0
- package/scss/_properties.scss +64 -13
- package/scss/_utilities.scss +4 -0
- package/scss/components/_badge.scss +67 -2
- package/scss/components/_button.scss +34 -3
- package/scss/components/_collapse.scss +26 -8
- package/scss/components/_column-toggler.scss +234 -0
- package/scss/components/_dropdown.scss +2 -1
- package/scss/components/_image-gallery.scss +1 -1
- package/scss/components/_images.scss +2 -1
- package/scss/components/_link.scss +6 -0
- package/scss/components/_markdown.scss +266 -0
- package/scss/components/_nav.scss +236 -154
- package/scss/components/_page.scss +5 -4
- package/scss/components/_progress.scss +2 -0
- package/scss/components/_spinner.scss +6 -2
- package/scss/components/_steps.scss +1 -1
- package/scss/components/_table.scss +25 -1
- package/scss/components/form/_color.scss +1 -0
- package/scss/components/form/_date-range.scss +2 -0
- package/scss/components/form/_date.scss +2 -0
- package/scss/components/form/_fieldset.scss +1 -2
- package/scss/components/form/_file.scss +5 -4
- package/scss/components/form/_group.scss +4 -0
- package/scss/components/form/_image.scss +7 -2
- package/scss/components/form/_list.scss +1 -0
- package/scss/components/form/_location.scss +1 -1
- package/scss/components/form/_text.scss +13 -0
- package/scss/components/form/_textarea.scss +10 -0
- package/scss/components/form/_transfer.scss +2 -0
- package/scss/themes/_common.scss +3 -0
- package/scss/themes/_cxd-colors.scss +56 -0
- package/scss/themes/_cxd-variables.scss +217 -92
- package/scss/themes/cxd.scss +366 -0
- package/sdk/ang-ie11.css +1192 -176
- package/sdk/ang.css +1175 -118
- package/sdk/antd-ie11.css +1177 -163
- package/sdk/antd.css +1175 -118
- package/sdk/charts.js +13 -13
- package/sdk/color-picker.js +67 -67
- package/sdk/cropperjs.js +2 -2
- package/sdk/cxd-ie11.css +2538 -1222
- package/sdk/cxd.css +1825 -401
- package/sdk/dark-ie11.css +1192 -176
- package/sdk/dark.css +1175 -118
- package/sdk/exceljs.js +1 -1
- package/sdk/helper.css.map +1 -1
- package/sdk/ie11-patch.css +1 -0
- package/sdk/locale/de-DE.js +3 -0
- package/sdk/markdown.js +69 -69
- package/sdk/papaparse.js +1 -1
- package/sdk/renderers/Form/CityDB.js +1 -1
- package/sdk/rest.js +22 -24
- package/sdk/rich-text.js +62 -64
- package/sdk/sdk-ie11.css +2538 -1222
- package/sdk/sdk.css +1825 -401
- package/sdk/sdk.js +1139 -1113
- 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 +18 -0
- package/src/components/Alert.tsx +3 -1
- package/src/components/Badge.tsx +124 -21
- package/src/components/Button.tsx +23 -7
- package/src/components/Checkbox.tsx +5 -2
- package/src/components/Collapse.tsx +14 -9
- package/src/components/DatePicker.tsx +1 -1
- package/src/components/DateRangePicker.tsx +23 -11
- package/src/components/Drawer.tsx +3 -2
- package/src/components/InputBox.tsx +1 -1
- package/src/components/Link.tsx +94 -0
- package/src/components/Modal.tsx +3 -2
- package/src/components/MonthRangePicker.tsx +10 -2
- package/src/components/RichText.tsx +244 -3
- package/src/components/Select.tsx +4 -0
- package/src/components/SparkLine.tsx +4 -1
- package/src/components/Steps.tsx +3 -3
- package/src/components/Toast.tsx +5 -5
- package/src/components/Tree.tsx +6 -8
- package/src/components/WithRemoteConfig.tsx +37 -2
- package/src/components/calendar/DaysView.tsx +2 -2
- package/src/components/condition-builder/Field.tsx +1 -2
- package/src/components/condition-builder/Value.tsx +3 -0
- package/src/components/condition-builder/types.ts +6 -0
- package/src/components/icons.tsx +15 -0
- package/src/factory.tsx +13 -3
- package/src/icons/clock.svg +1 -0
- package/src/icons/loading-outline.svg +4 -0
- package/src/icons/status-close.svg +10 -0
- package/src/icons/status-fail.svg +10 -0
- package/src/icons/status-info.svg +8 -0
- package/src/icons/status-success.svg +10 -0
- package/src/icons/status-warning.svg +8 -0
- package/src/locale/de-DE.ts +3 -0
- package/src/locale/en-US.ts +4 -1
- package/src/locale/zh-CN.ts +5 -2
- package/src/renderers/Action.tsx +71 -13
- package/src/renderers/CRUD.tsx +44 -59
- package/src/renderers/Collapse.tsx +6 -2
- package/src/renderers/Dialog.tsx +1 -5
- package/src/renderers/Drawer.tsx +0 -4
- package/src/renderers/DropDownButton.tsx +34 -12
- package/src/renderers/Form/ButtonGroupSelect.tsx +3 -0
- package/src/renderers/Form/Checkbox.tsx +8 -0
- package/src/renderers/Form/Combo.tsx +2 -3
- package/src/renderers/Form/Editor.tsx +19 -20
- package/src/renderers/Form/InputExcel.tsx +28 -3
- package/src/renderers/Form/InputFile.tsx +2 -1
- package/src/renderers/Form/InputImage.tsx +28 -10
- package/src/renderers/Form/InputTable.tsx +88 -9
- package/src/renderers/Form/Options.tsx +16 -5
- package/src/renderers/Form/Picker.tsx +3 -2
- package/src/renderers/Form/wrapControl.tsx +2 -2
- package/src/renderers/IFrame.tsx +2 -1
- package/src/renderers/Image.tsx +10 -0
- package/src/renderers/Json.tsx +10 -1
- package/src/renderers/Link.tsx +36 -11
- package/src/renderers/Log.tsx +16 -3
- package/src/renderers/Nav.tsx +340 -56
- package/src/renderers/Page.tsx +3 -1
- package/src/renderers/Service.tsx +101 -3
- package/src/renderers/SparkLine.tsx +5 -0
- package/src/renderers/Steps.tsx +12 -9
- package/src/renderers/Table/ColumnToggler.tsx +544 -0
- package/src/renderers/Table/ItemActionsWrapper.tsx +44 -0
- package/src/renderers/Table/TableBody.tsx +3 -2
- package/src/renderers/Table/TableCell.tsx +16 -1
- package/src/renderers/Table/TableContent.tsx +3 -1
- package/src/renderers/Table/index.tsx +240 -60
- package/src/store/crud.ts +34 -38
- package/src/store/modal.ts +4 -0
- package/src/store/service.ts +0 -19
- package/src/store/table.ts +103 -4
- package/src/utils/api.ts +24 -4
- package/src/utils/attachmentAdpator.ts +90 -0
- package/src/utils/handleAction.ts +41 -0
- package/src/utils/helper.ts +4 -3
- package/src/utils/tpl-builtin.ts +48 -17
- package/src/utils/validations.ts +80 -12
@@ -7,10 +7,11 @@ import type {TooltipObject, Trigger} from '../components/TooltipWrapper';
|
|
7
7
|
import {isDisabled, isVisible, noop} from '../utils/helper';
|
8
8
|
import {filter} from '../utils/tpl';
|
9
9
|
import {Icon} from '../components/icons';
|
10
|
-
import {BaseSchema, SchemaClassName} from '../Schema';
|
10
|
+
import {BaseSchema, SchemaClassName, SchemaIcon} from '../Schema';
|
11
11
|
import {ActionSchema} from './Action';
|
12
12
|
import {DividerSchema} from './Divider';
|
13
13
|
import {RootClose} from '../utils/RootClose';
|
14
|
+
import {generateIcon} from '../utils/icon';
|
14
15
|
|
15
16
|
/**
|
16
17
|
* 下拉按钮渲染器。
|
@@ -76,6 +77,21 @@ export interface DropdownButtonSchema extends BaseSchema {
|
|
76
77
|
* 是否只显示图标。
|
77
78
|
*/
|
78
79
|
iconOnly?: boolean;
|
80
|
+
|
81
|
+
/**
|
82
|
+
* 右侧图标
|
83
|
+
*/
|
84
|
+
rightIcon?: SchemaIcon;
|
85
|
+
|
86
|
+
/**
|
87
|
+
* 触发条件,默认是 click
|
88
|
+
*/
|
89
|
+
trigger?: 'click' | 'hover';
|
90
|
+
|
91
|
+
/**
|
92
|
+
* 是否显示下拉按钮
|
93
|
+
*/
|
94
|
+
hideCaret?: boolean;
|
79
95
|
}
|
80
96
|
|
81
97
|
export interface DropDownButtonProps
|
@@ -265,10 +281,17 @@ export default class DropDownButton extends React.Component<
|
|
265
281
|
align,
|
266
282
|
iconOnly,
|
267
283
|
icon,
|
284
|
+
rightIcon,
|
268
285
|
isActived,
|
269
|
-
|
286
|
+
trigger,
|
287
|
+
data,
|
288
|
+
hideCaret
|
270
289
|
} = this.props;
|
271
290
|
|
291
|
+
const iconElement = generateIcon(cx, icon, 'm-r-xs');
|
292
|
+
|
293
|
+
const rightIconElement = generateIcon(cx, rightIcon, 'm-l-xs');
|
294
|
+
|
272
295
|
return (
|
273
296
|
<div
|
274
297
|
className={cx(
|
@@ -281,6 +304,8 @@ export default class DropDownButton extends React.Component<
|
|
281
304
|
},
|
282
305
|
className
|
283
306
|
)}
|
307
|
+
onMouseEnter={trigger === 'hover' ? this.open : () => {}}
|
308
|
+
onMouseLeave={trigger === 'hover' ? this.close : () => {}}
|
284
309
|
ref={this.domRef}
|
285
310
|
>
|
286
311
|
<TooltipWrapper
|
@@ -309,17 +334,14 @@ export default class DropDownButton extends React.Component<
|
|
309
334
|
size ? `Button--${size}` : ''
|
310
335
|
)}
|
311
336
|
>
|
312
|
-
{
|
313
|
-
typeof icon === 'string' ? (
|
314
|
-
<i className={cx(icon, 'm-r-xs')} />
|
315
|
-
) : (
|
316
|
-
icon
|
317
|
-
)
|
318
|
-
) : null}
|
337
|
+
{iconElement}
|
319
338
|
{typeof label === 'string' ? filter(label, data) : label}
|
320
|
-
|
321
|
-
|
322
|
-
|
339
|
+
{rightIconElement}
|
340
|
+
{!hideCaret ? (
|
341
|
+
<span className={cx('DropDown-caret')}>
|
342
|
+
<Icon icon="ellipsis-v" className="icon" />
|
343
|
+
</span>
|
344
|
+
) : null}
|
323
345
|
</button>
|
324
346
|
</TooltipWrapper>
|
325
347
|
{this.state.isOpened ? this.renderOuter() : null}
|
@@ -108,6 +108,9 @@ export default class ButtonGroupControl extends React.Component<
|
|
108
108
|
className: cx(option.className, btnClassName),
|
109
109
|
disabled: option.disabled || disabled,
|
110
110
|
onClick: (e: React.UIEvent<any>) => {
|
111
|
+
if (disabled) {
|
112
|
+
return;
|
113
|
+
}
|
111
114
|
this.handleToggle(option);
|
112
115
|
e.preventDefault(); // 禁止 onAction 触发
|
113
116
|
}
|
@@ -2,6 +2,7 @@ import React from 'react';
|
|
2
2
|
import {FormItem, FormControlProps, FormBaseControl} from './Item';
|
3
3
|
import cx from 'classnames';
|
4
4
|
import Checkbox from '../../components/Checkbox';
|
5
|
+
import {withBadge, BadgeSchema} from '../../components/Badge';
|
5
6
|
|
6
7
|
/**
|
7
8
|
* Checkbox 勾选框。
|
@@ -27,6 +28,11 @@ export interface CheckboxControlSchema extends FormBaseControl {
|
|
27
28
|
* 选项说明
|
28
29
|
*/
|
29
30
|
option?: string;
|
31
|
+
|
32
|
+
/**
|
33
|
+
* 角标
|
34
|
+
*/
|
35
|
+
badge?: BadgeSchema;
|
30
36
|
}
|
31
37
|
|
32
38
|
export interface CheckboxProps
|
@@ -78,4 +84,6 @@ export default class CheckboxControl extends React.Component<
|
|
78
84
|
type: 'checkbox',
|
79
85
|
sizeMutable: false
|
80
86
|
})
|
87
|
+
// @ts-ignore
|
88
|
+
@withBadge
|
81
89
|
export class CheckboxControlRenderer extends CheckboxControl {}
|
@@ -251,7 +251,6 @@ export interface ComboControlSchema extends FormBaseControl {
|
|
251
251
|
/**
|
252
252
|
* 最大值验证错误提示
|
253
253
|
*/
|
254
|
-
|
255
254
|
maxLengthValidateFailed?: string;
|
256
255
|
};
|
257
256
|
}
|
@@ -1010,7 +1009,7 @@ export default class ComboControl extends React.Component<ComboProps> {
|
|
1010
1009
|
{deleteIcon ? (
|
1011
1010
|
<i className={deleteIcon} />
|
1012
1011
|
) : (
|
1013
|
-
<Icon icon="close" className="icon" />
|
1012
|
+
<Icon icon="status-close" className="icon" />
|
1014
1013
|
)}
|
1015
1014
|
</div>
|
1016
1015
|
);
|
@@ -1189,7 +1188,7 @@ export default class ComboControl extends React.Component<ComboProps> {
|
|
1189
1188
|
{deleteIcon ? (
|
1190
1189
|
<i className={deleteIcon} />
|
1191
1190
|
) : (
|
1192
|
-
<Icon icon="close" className="icon" />
|
1191
|
+
<Icon icon="status-close" className="icon" />
|
1193
1192
|
)}
|
1194
1193
|
</a>
|
1195
1194
|
);
|
@@ -118,7 +118,7 @@ export default class EditorControl extends React.Component<EditorProps, any> {
|
|
118
118
|
static defaultProps: Partial<EditorProps> = {
|
119
119
|
language: 'javascript',
|
120
120
|
editorTheme: 'vs',
|
121
|
-
allowFullscreen:
|
121
|
+
allowFullscreen: true,
|
122
122
|
options: {
|
123
123
|
automaticLayout: true,
|
124
124
|
selectOnLineNumbers: true,
|
@@ -294,26 +294,25 @@ export const availableLanguages = [
|
|
294
294
|
'yaml'
|
295
295
|
];
|
296
296
|
|
297
|
-
export const EditorControls: Array<
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
}
|
313
|
-
}
|
297
|
+
export const EditorControls: Array<typeof EditorControl> =
|
298
|
+
availableLanguages.map((lang: string) => {
|
299
|
+
@FormItem({
|
300
|
+
type: `${lang}-editor`,
|
301
|
+
sizeMutable: false
|
302
|
+
})
|
303
|
+
class EditorControlRenderer extends EditorControl {
|
304
|
+
static lang = lang;
|
305
|
+
static displayName = `${lang[0].toUpperCase()}${lang.substring(
|
306
|
+
1
|
307
|
+
)}EditorControlRenderer`;
|
308
|
+
static defaultProps = {
|
309
|
+
...EditorControl.defaultProps,
|
310
|
+
language: lang
|
311
|
+
};
|
312
|
+
}
|
314
313
|
|
315
|
-
|
316
|
-
});
|
314
|
+
return EditorControlRenderer;
|
315
|
+
});
|
317
316
|
|
318
317
|
@FormItem({
|
319
318
|
type: 'js-editor',
|
@@ -28,6 +28,11 @@ export interface InputExcelControlSchema extends FormBaseControl {
|
|
28
28
|
* 是否包含空内容,主要用于二维数组模式
|
29
29
|
*/
|
30
30
|
includeEmpty: boolean;
|
31
|
+
|
32
|
+
/**
|
33
|
+
* 纯文本模式
|
34
|
+
*/
|
35
|
+
plainText: boolean;
|
31
36
|
}
|
32
37
|
|
33
38
|
export interface ExcelProps
|
@@ -48,12 +53,15 @@ export default class ExcelControl extends React.PureComponent<
|
|
48
53
|
static defaultProps: Partial<ExcelProps> = {
|
49
54
|
allSheets: false,
|
50
55
|
parseMode: 'object',
|
51
|
-
includeEmpty: true
|
56
|
+
includeEmpty: true,
|
57
|
+
plainText: true
|
52
58
|
};
|
53
59
|
state: ExcelControlState = {
|
54
60
|
open: false
|
55
61
|
};
|
56
62
|
|
63
|
+
ExcelJS: any;
|
64
|
+
|
57
65
|
@autobind
|
58
66
|
handleDrop(files: File[]) {
|
59
67
|
const {allSheets, onChange} = this.props;
|
@@ -63,6 +71,7 @@ export default class ExcelControl extends React.PureComponent<
|
|
63
71
|
reader.onload = async () => {
|
64
72
|
if (reader.result) {
|
65
73
|
import('exceljs').then(async (ExcelJS: any) => {
|
74
|
+
this.ExcelJS = ExcelJS;
|
66
75
|
const workbook = new ExcelJS.Workbook();
|
67
76
|
await workbook.xlsx.load(reader.result);
|
68
77
|
if (allSheets) {
|
@@ -88,7 +97,7 @@ export default class ExcelControl extends React.PureComponent<
|
|
88
97
|
*/
|
89
98
|
readWorksheet(worksheet: any) {
|
90
99
|
const result: any[] = [];
|
91
|
-
const {parseMode} = this.props;
|
100
|
+
const {parseMode, plainText} = this.props;
|
92
101
|
|
93
102
|
if (parseMode === 'array') {
|
94
103
|
worksheet.eachRow((row: any, rowNumber: number) => {
|
@@ -107,7 +116,23 @@ export default class ExcelControl extends React.PureComponent<
|
|
107
116
|
const data: any = {};
|
108
117
|
row.eachCell((cell: any, colNumber: any) => {
|
109
118
|
if (firstRowValues[colNumber]) {
|
110
|
-
|
119
|
+
let value = cell.value;
|
120
|
+
if (plainText) {
|
121
|
+
const ExcelValueType = this.ExcelJS.ValueType;
|
122
|
+
if (cell.type === ExcelValueType.Hyperlink) {
|
123
|
+
value = cell.value.hyperlink;
|
124
|
+
} else if (cell.type === ExcelValueType.Formula) {
|
125
|
+
value = cell.value.result;
|
126
|
+
} else if (cell.type === ExcelValueType.RichText) {
|
127
|
+
value = cell.value.richText
|
128
|
+
.map((item: any) => item.text)
|
129
|
+
.join('');
|
130
|
+
} else if (cell.type === ExcelValueType.Error) {
|
131
|
+
value = '';
|
132
|
+
}
|
133
|
+
}
|
134
|
+
|
135
|
+
data[firstRowValues[colNumber]] = value;
|
111
136
|
}
|
112
137
|
});
|
113
138
|
result.push(data);
|
@@ -1223,13 +1223,14 @@ export default class FileControl extends React.Component<FileProps, FileState> {
|
|
1223
1223
|
onClick={this.handleSelect}
|
1224
1224
|
>
|
1225
1225
|
<Icon icon="upload" className="icon" />
|
1226
|
-
{!multiple && files.length
|
1226
|
+
<span>{!multiple && files.length
|
1227
1227
|
? __('File.repick')
|
1228
1228
|
: multiple && files.length
|
1229
1229
|
? __('File.continueAdd')
|
1230
1230
|
: btnLabel
|
1231
1231
|
? btnLabel
|
1232
1232
|
: __('File.upload')}
|
1233
|
+
</span>
|
1233
1234
|
</Button>
|
1234
1235
|
) : null}
|
1235
1236
|
|
@@ -110,6 +110,16 @@ export interface ImageControlSchema extends FormBaseControl {
|
|
110
110
|
scalable?: boolean;
|
111
111
|
};
|
112
112
|
|
113
|
+
/**
|
114
|
+
* 裁剪后的图片类型
|
115
|
+
*/
|
116
|
+
cropFormat?: string;
|
117
|
+
|
118
|
+
/**
|
119
|
+
* 裁剪后的质量
|
120
|
+
*/
|
121
|
+
cropQuality?: number;
|
122
|
+
|
113
123
|
/**
|
114
124
|
* 是否允许二次裁剪。
|
115
125
|
*/
|
@@ -862,14 +872,19 @@ export default class ImageControl extends React.Component<
|
|
862
872
|
}
|
863
873
|
|
864
874
|
handleCrop() {
|
865
|
-
|
866
|
-
|
867
|
-
|
868
|
-
|
869
|
-
|
870
|
-
|
871
|
-
|
872
|
-
|
875
|
+
const {cropFormat, cropQuality} = this.props;
|
876
|
+
this.cropper.getCroppedCanvas().toBlob(
|
877
|
+
(file: File) => {
|
878
|
+
this.addFiles([file]);
|
879
|
+
this.setState({
|
880
|
+
cropFile: undefined,
|
881
|
+
locked: false,
|
882
|
+
lockedReason: ''
|
883
|
+
});
|
884
|
+
},
|
885
|
+
cropFormat || 'image/png',
|
886
|
+
cropQuality || 1
|
887
|
+
);
|
873
888
|
}
|
874
889
|
|
875
890
|
cancelCrop() {
|
@@ -1362,7 +1377,6 @@ export default class ImageControl extends React.Component<
|
|
1362
1377
|
fixedSize ? fixedSizeClassName : ''
|
1363
1378
|
)}
|
1364
1379
|
>
|
1365
|
-
<p>{__('File.uploading')}</p>
|
1366
1380
|
<div className={cx('ImageControl-progress')}>
|
1367
1381
|
<span
|
1368
1382
|
style={{
|
@@ -1375,6 +1389,7 @@ export default class ImageControl extends React.Component<
|
|
1375
1389
|
)}
|
1376
1390
|
/>
|
1377
1391
|
</div>
|
1392
|
+
<p>{__('File.uploading')}</p>
|
1378
1393
|
</div>
|
1379
1394
|
</>
|
1380
1395
|
) : (
|
@@ -1509,7 +1524,10 @@ export default class ImageControl extends React.Component<
|
|
1509
1524
|
thumbRatio={thumbRatio}
|
1510
1525
|
/>
|
1511
1526
|
) : (
|
1512
|
-
|
1527
|
+
<>
|
1528
|
+
<Icon icon="plus" className="icon" />
|
1529
|
+
<span>{__('File.upload')}</span>
|
1530
|
+
</>
|
1513
1531
|
)}
|
1514
1532
|
|
1515
1533
|
{isFocused ? (
|
@@ -30,6 +30,26 @@ export interface TableControlSchema
|
|
30
30
|
*/
|
31
31
|
addable?: boolean;
|
32
32
|
|
33
|
+
/**
|
34
|
+
* 可复制新增
|
35
|
+
*/
|
36
|
+
copyable?: boolean;
|
37
|
+
|
38
|
+
/**
|
39
|
+
* 复制按钮文字
|
40
|
+
*/
|
41
|
+
copyBtnLabel?: string;
|
42
|
+
|
43
|
+
/**
|
44
|
+
* 复制按钮图标
|
45
|
+
*/
|
46
|
+
copyBtnIcon?: string;
|
47
|
+
|
48
|
+
/**
|
49
|
+
* 是否显示复制按钮
|
50
|
+
*/
|
51
|
+
copyAddBtn?: boolean;
|
52
|
+
|
33
53
|
/**
|
34
54
|
* 是否可以拖拽排序
|
35
55
|
*/
|
@@ -41,12 +61,12 @@ export interface TableControlSchema
|
|
41
61
|
addApi?: SchemaApi;
|
42
62
|
|
43
63
|
/**
|
44
|
-
*
|
64
|
+
* 新增按钮文字
|
45
65
|
*/
|
46
66
|
addBtnLabel?: string;
|
47
67
|
|
48
68
|
/**
|
49
|
-
*
|
69
|
+
* 新增按钮图标
|
50
70
|
*/
|
51
71
|
addBtnIcon?: string;
|
52
72
|
|
@@ -73,12 +93,12 @@ export interface TableControlSchema
|
|
73
93
|
/**
|
74
94
|
* 更新按钮名称
|
75
95
|
*/
|
76
|
-
|
96
|
+
editBtnLabel?: string;
|
77
97
|
|
78
98
|
/**
|
79
99
|
* 更新按钮图标
|
80
100
|
*/
|
81
|
-
|
101
|
+
editBtnIcon?: string;
|
82
102
|
|
83
103
|
/**
|
84
104
|
* 确认按钮文字
|
@@ -172,7 +192,8 @@ export default class FormTable extends React.Component<TableProps, TableState> {
|
|
172
192
|
placeholder: '空',
|
173
193
|
scaffold: {},
|
174
194
|
addBtnIcon: 'plus',
|
175
|
-
|
195
|
+
copyBtnIcon: 'copy',
|
196
|
+
editBtnIcon: 'pencil',
|
176
197
|
deleteBtnIcon: 'minus',
|
177
198
|
confirmBtnIcon: 'check',
|
178
199
|
cancelBtnIcon: 'close',
|
@@ -188,6 +209,7 @@ export default class FormTable extends React.Component<TableProps, TableState> {
|
|
188
209
|
'showAddBtn',
|
189
210
|
'addable',
|
190
211
|
'removable',
|
212
|
+
'copyable',
|
191
213
|
'editable',
|
192
214
|
'addApi',
|
193
215
|
'updateApi',
|
@@ -423,6 +445,26 @@ export default class FormTable extends React.Component<TableProps, TableState> {
|
|
423
445
|
return onAction && onAction(action, ctx, ...rest);
|
424
446
|
}
|
425
447
|
|
448
|
+
copyItem(index: number) {
|
449
|
+
const {needConfirm} = this.props;
|
450
|
+
const items = this.state.items.concat();
|
451
|
+
|
452
|
+
items.splice(index + 1, 0, items[index]);
|
453
|
+
index = Math.min(index + 1, items.length - 1);
|
454
|
+
this.setState(
|
455
|
+
{
|
456
|
+
items
|
457
|
+
},
|
458
|
+
() => {
|
459
|
+
if (needConfirm === false) {
|
460
|
+
this.emitValue();
|
461
|
+
} else {
|
462
|
+
this.startEdit(index, true);
|
463
|
+
}
|
464
|
+
}
|
465
|
+
);
|
466
|
+
}
|
467
|
+
|
426
468
|
addItem(index: number) {
|
427
469
|
const {needConfirm, scaffold, columns} = this.props;
|
428
470
|
const items = this.state.items.concat();
|
@@ -653,6 +695,38 @@ export default class FormTable extends React.Component<TableProps, TableState> {
|
|
653
695
|
});
|
654
696
|
}
|
655
697
|
|
698
|
+
if (props.copyable && props.showCopyBtn !== false) {
|
699
|
+
btns.push({
|
700
|
+
children: ({
|
701
|
+
key,
|
702
|
+
rowIndex,
|
703
|
+
offset
|
704
|
+
}: {
|
705
|
+
key: any;
|
706
|
+
rowIndex: number;
|
707
|
+
offset: number;
|
708
|
+
}) =>
|
709
|
+
~this.state.editIndex && needConfirm !== false ? null : (
|
710
|
+
<Button
|
711
|
+
classPrefix={ns}
|
712
|
+
size="sm"
|
713
|
+
key={key}
|
714
|
+
level="link"
|
715
|
+
tooltip={__('Table.copyRow')}
|
716
|
+
tooltipContainer={
|
717
|
+
env && env.getModalContainer ? env.getModalContainer : undefined
|
718
|
+
}
|
719
|
+
onClick={this.copyItem.bind(this, rowIndex + offset, undefined)}
|
720
|
+
>
|
721
|
+
{props.copyBtnLabel ? <span>{props.copyBtnLabel}</span> : null}
|
722
|
+
{props.copyBtnIcon ? (
|
723
|
+
<Icon icon={props.copyBtnIcon} className="icon" />
|
724
|
+
) : null}
|
725
|
+
</Button>
|
726
|
+
)
|
727
|
+
});
|
728
|
+
}
|
729
|
+
|
656
730
|
if (props.needConfirm === false) {
|
657
731
|
columns = columns.map(column => {
|
658
732
|
const quickEdit = column.quickEdit;
|
@@ -716,11 +790,16 @@ export default class FormTable extends React.Component<TableProps, TableState> {
|
|
716
790
|
}
|
717
791
|
onClick={() => this.startEdit(rowIndex + offset)}
|
718
792
|
>
|
719
|
-
{props.updateBtnLabel ? (
|
720
|
-
<span>{props.updateBtnLabel}</span>
|
793
|
+
{props.updateBtnLabel || props.editBtnLabel ? (
|
794
|
+
<span>{props.updateBtnLabel || props.editBtnLabel}</span>
|
721
795
|
) : null}
|
722
|
-
{
|
723
|
-
|
796
|
+
{/* 兼容之前的写法 */}
|
797
|
+
{typeof props.updateBtnIcon !== 'undefined' ? (
|
798
|
+
props.updateBtnIcon ? (
|
799
|
+
<Icon icon={props.updateBtnIcon} className="icon" />
|
800
|
+
) : null
|
801
|
+
) : props.editBtnIcon ? (
|
802
|
+
<Icon icon={props.editBtnIcon} className="icon" />
|
724
803
|
) : null}
|
725
804
|
</Button>
|
726
805
|
)
|
@@ -270,7 +270,8 @@ export function registerOptionsControl(config: OptionsConfig) {
|
|
270
270
|
: [];
|
271
271
|
static ComposedComponent = Control;
|
272
272
|
|
273
|
-
|
273
|
+
toDispose: Array<() => void> = [];
|
274
|
+
|
274
275
|
input: any;
|
275
276
|
mounted = false;
|
276
277
|
|
@@ -302,9 +303,18 @@ export function registerOptionsControl(config: OptionsConfig) {
|
|
302
303
|
data
|
303
304
|
);
|
304
305
|
|
305
|
-
this.
|
306
|
-
(
|
307
|
-
|
306
|
+
this.toDispose.push(
|
307
|
+
reaction(
|
308
|
+
() => JSON.stringify([formItem.loading, formItem.filteredOptions]),
|
309
|
+
() => this.mounted && this.forceUpdate()
|
310
|
+
)
|
311
|
+
);
|
312
|
+
|
313
|
+
this.toDispose.push(
|
314
|
+
reaction(
|
315
|
+
() => JSON.stringify(formItem.options),
|
316
|
+
() => this.mounted && this.syncAutoFill(formItem.tmpValue)
|
317
|
+
)
|
308
318
|
);
|
309
319
|
// 默认全选。这里会和默认值\回填值逻辑冲突,所以如果有配置source则不执行默认全选
|
310
320
|
if (
|
@@ -432,7 +442,8 @@ export function registerOptionsControl(config: OptionsConfig) {
|
|
432
442
|
|
433
443
|
componentWillUnmount() {
|
434
444
|
this.props.removeHook?.(this.reload, 'init');
|
435
|
-
this.
|
445
|
+
this.toDispose.forEach(fn => fn());
|
446
|
+
this.toDispose = [];
|
436
447
|
}
|
437
448
|
|
438
449
|
syncAutoFill(value: any) {
|
@@ -397,14 +397,15 @@ export default class PickerControl extends React.PureComponent<
|
|
397
397
|
options,
|
398
398
|
multiple,
|
399
399
|
valueField,
|
400
|
-
embed
|
400
|
+
embed,
|
401
|
+
source
|
401
402
|
} = this.props;
|
402
403
|
|
403
404
|
return render('modal-body', this.state.schema, {
|
404
405
|
value: selectedOptions,
|
405
406
|
valueField,
|
406
407
|
primaryField: valueField,
|
407
|
-
options: options,
|
408
|
+
options: source ? [] : options,
|
408
409
|
multiple,
|
409
410
|
onSelect: embed ? this.handleChange : undefined,
|
410
411
|
ref: this.crudRef,
|
@@ -506,8 +506,8 @@ export function wrapControl<
|
|
506
506
|
|
507
507
|
if (
|
508
508
|
// 如果配置了 minLength 或者 maxLength 就切成及时验证
|
509
|
-
|
510
|
-
|
509
|
+
this.model.rules.minLength ||
|
510
|
+
this.model.rules.maxLength ||
|
511
511
|
validateOnChange === true ||
|
512
512
|
(validateOnChange !== false && (formSubmited || validated))
|
513
513
|
) {
|
package/src/renderers/IFrame.tsx
CHANGED
@@ -149,7 +149,7 @@ export default class IFrame extends React.Component<IFrameProps, object> {
|
|
149
149
|
|
150
150
|
render() {
|
151
151
|
const {width, height} = this.state;
|
152
|
-
let {className, src, frameBorder, data, style} = this.props;
|
152
|
+
let {className, src, name, frameBorder, data, style} = this.props;
|
153
153
|
|
154
154
|
let tempStyle: any = {};
|
155
155
|
|
@@ -177,6 +177,7 @@ export default class IFrame extends React.Component<IFrameProps, object> {
|
|
177
177
|
|
178
178
|
return (
|
179
179
|
<iframe
|
180
|
+
name={name}
|
180
181
|
className={className}
|
181
182
|
frameBorder={frameBorder}
|
182
183
|
style={style}
|
package/src/renderers/Image.tsx
CHANGED
@@ -7,6 +7,7 @@ import {Icon} from '../components/icons';
|
|
7
7
|
import {LocaleProps, localeable} from '../locale';
|
8
8
|
import {BaseSchema, SchemaClassName, SchemaTpl, SchemaUrlPath} from '../Schema';
|
9
9
|
import {resolveVariable} from '../utils/tpl-builtin';
|
10
|
+
import handleAction from '../utils/handleAction';
|
10
11
|
|
11
12
|
/**
|
12
13
|
* 图片展示控件。
|
@@ -322,6 +323,14 @@ export class ImageField extends React.Component<ImageFieldProps, object> {
|
|
322
323
|
);
|
323
324
|
}
|
324
325
|
|
326
|
+
@autobind
|
327
|
+
handleClick(e: React.MouseEvent<HTMLElement>) {
|
328
|
+
const clickAction = this.props.clickAction;
|
329
|
+
if (clickAction) {
|
330
|
+
handleAction(e, clickAction, this.props);
|
331
|
+
}
|
332
|
+
}
|
333
|
+
|
325
334
|
render() {
|
326
335
|
const {
|
327
336
|
className,
|
@@ -359,6 +368,7 @@ export class ImageField extends React.Component<ImageFieldProps, object> {
|
|
359
368
|
: 'ImageField--thumb',
|
360
369
|
className
|
361
370
|
)}
|
371
|
+
onClick={this.handleClick}
|
362
372
|
>
|
363
373
|
{value ? (
|
364
374
|
<ThemedImageThumb
|
package/src/renderers/Json.tsx
CHANGED
@@ -97,6 +97,15 @@ export class JSONField extends React.Component<JSONProps, object> {
|
|
97
97
|
}
|
98
98
|
}
|
99
99
|
|
100
|
+
let jsonThemeValue = jsonTheme;
|
101
|
+
if (isPureVariable(jsonTheme)) {
|
102
|
+
jsonThemeValue = resolveVariableAndFilter(
|
103
|
+
jsonTheme,
|
104
|
+
this.props.data,
|
105
|
+
'| raw'
|
106
|
+
);
|
107
|
+
}
|
108
|
+
|
100
109
|
// JsonView 只支持对象,所以不是对象格式需要转成对象格式。
|
101
110
|
if (data && ~['string', 'number'].indexOf(typeof data)) {
|
102
111
|
data = {
|
@@ -112,7 +121,7 @@ export class JSONField extends React.Component<JSONProps, object> {
|
|
112
121
|
<JsonView
|
113
122
|
name={false}
|
114
123
|
src={data}
|
115
|
-
theme={(
|
124
|
+
theme={(jsonThemeValue as any) ?? 'rjv-default'}
|
116
125
|
shouldCollapse={this.shouldExpandNode}
|
117
126
|
enableClipboard={false}
|
118
127
|
iconStyle="square"
|