amis 1.4.2-beta.1 → 1.4.2-beta.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/Schema.d.ts +9 -2
- package/lib/Schema.js.map +1 -1
- package/lib/components/AnchorNav.d.ts +22 -21
- package/lib/components/AnchorNav.js +7 -3
- package/lib/components/AnchorNav.js.map +2 -2
- package/lib/components/ArrayInput.d.ts +84 -84
- package/lib/components/AssociatedSelection.d.ts +930 -0
- package/lib/components/AssociatedSelection.js +89 -0
- package/lib/components/AssociatedSelection.js.map +13 -0
- package/lib/components/Badge.js +2 -2
- package/lib/components/Badge.js.map +2 -2
- package/lib/components/{ChainedCheckboxes.d.ts → ChainedSelection.d.ts} +267 -98
- package/lib/components/{ChainedCheckboxes.js → ChainedSelection.js} +30 -24
- package/lib/components/ChainedSelection.js.map +13 -0
- package/lib/components/ColorPicker.d.ts +84 -84
- package/lib/components/DatePicker.d.ts +84 -84
- package/lib/components/DateRangePicker.d.ts +84 -84
- package/lib/components/Editor.d.ts +84 -84
- package/lib/components/GroupedSelection.d.ts +907 -0
- package/lib/components/GroupedSelection.js +48 -0
- package/lib/components/GroupedSelection.js.map +13 -0
- package/lib/components/Link.d.ts +29 -36
- package/lib/components/Link.js +14 -15
- package/lib/components/Link.js.map +2 -2
- package/lib/components/ListGroup.d.ts +21 -21
- package/lib/components/ModalManager.js +1 -1
- package/lib/components/ModalManager.js.map +2 -2
- package/lib/components/MonthRangePicker.d.ts +84 -84
- package/lib/components/NumberInput.d.ts +20 -20
- package/lib/components/PickerColumn.d.ts +514 -0
- package/lib/components/PickerColumn.js +279 -0
- package/lib/components/PickerColumn.js.map +13 -0
- package/lib/components/PickerContainer.d.ts +513 -0
- package/lib/components/PickerContainer.js +96 -0
- package/lib/components/PickerContainer.js.map +13 -0
- package/lib/components/Radios.d.ts +22 -21
- package/lib/components/Radios.js +1 -0
- package/lib/components/Radios.js.map +2 -2
- package/lib/components/Rating.d.ts +21 -21
- package/lib/components/ResultBox.d.ts +84 -84
- package/lib/components/SearchBox.d.ts +84 -84
- package/lib/components/SearchBox.js +4 -4
- package/lib/components/SearchBox.js.map +2 -2
- package/lib/components/Select.d.ts +245 -237
- package/lib/components/Select.js +25 -4
- package/lib/components/Select.js.map +2 -2
- package/lib/components/{Checkboxes.d.ts → Selection.d.ts} +273 -98
- package/lib/components/Selection.js +134 -0
- package/lib/components/Selection.js.map +13 -0
- package/lib/components/{TableCheckboxes.d.ts → TableSelection.d.ts} +266 -96
- package/lib/components/{TableCheckboxes.js → TableSelection.js} +30 -30
- package/lib/components/TableSelection.js.map +13 -0
- package/lib/components/Tabs.d.ts +20 -20
- package/lib/components/TabsTransfer.d.ts +84 -84
- package/lib/components/TabsTransfer.js +9 -9
- package/lib/components/TabsTransfer.js.map +2 -2
- package/lib/components/TabsTransferPicker.d.ts +489 -0
- package/lib/components/TabsTransferPicker.js +60 -0
- package/lib/components/TabsTransferPicker.js.map +13 -0
- package/lib/components/Transfer.d.ts +908 -274
- package/lib/components/Transfer.js +31 -24
- package/lib/components/Transfer.js.map +2 -2
- package/lib/components/TransferDropDown.d.ts +487 -0
- package/lib/components/TransferDropDown.js +59 -0
- package/lib/components/TransferDropDown.js.map +13 -0
- package/lib/components/TransferPicker.d.ts +489 -0
- package/lib/components/TransferPicker.js +60 -0
- package/lib/components/TransferPicker.js.map +13 -0
- package/lib/components/Tree.d.ts +84 -84
- package/lib/components/{TreeCheckboxes.d.ts → TreeSelection.d.ts} +269 -99
- package/lib/components/{TreeCheckboxes.js → TreeSelection.js} +36 -32
- package/lib/components/TreeSelection.js.map +13 -0
- package/lib/components/WithRemoteConfig.js +1 -1
- package/lib/components/WithRemoteConfig.js.map +2 -2
- package/lib/components/condition-builder/Field.js +5 -2
- package/lib/components/condition-builder/Field.js.map +2 -2
- package/lib/components/condition-builder/Func.js +2 -2
- package/lib/components/condition-builder/Func.js.map +2 -2
- package/lib/components/condition-builder/InputSwitch.js +2 -2
- package/lib/components/condition-builder/InputSwitch.js.map +2 -2
- package/lib/components/condition-builder/Item.js +3 -3
- package/lib/components/condition-builder/Item.js.map +2 -2
- package/lib/components/index.d.ts +8 -8
- package/lib/components/index.js +16 -16
- package/lib/components/index.js.map +2 -2
- package/lib/envOverwrite.js.map +2 -2
- package/lib/factory.d.ts +4 -0
- package/lib/factory.js +4 -2
- package/lib/factory.js.map +2 -2
- package/lib/helper.css.map +1 -1
- package/lib/hooks/index.d.ts +5 -0
- package/lib/hooks/index.js +14 -0
- package/lib/hooks/index.js.map +13 -0
- package/lib/hooks/use-set-state.d.ts +2 -0
- package/lib/hooks/use-set-state.js +15 -0
- package/lib/hooks/use-set-state.js.map +13 -0
- package/lib/hooks/use-touch.d.ts +16 -0
- package/lib/hooks/use-touch.js +73 -0
- package/lib/hooks/use-touch.js.map +13 -0
- package/lib/hooks/use-update-effect.d.ts +3 -0
- package/lib/hooks/use-update-effect.js +17 -0
- package/lib/hooks/use-update-effect.js.map +13 -0
- package/lib/index.d.ts +3 -0
- package/lib/index.js +4 -1
- package/lib/index.js.map +2 -2
- package/lib/locale/de-DE.js +2 -0
- package/lib/locale/de-DE.js.map +2 -2
- package/lib/locale/en-US.js +2 -0
- package/lib/locale/en-US.js.map +2 -2
- package/lib/locale/zh-CN.js +4 -2
- package/lib/locale/zh-CN.js.map +2 -2
- package/lib/renderers/Action.d.ts +4 -3
- package/lib/renderers/Action.js +17 -4
- package/lib/renderers/Action.js.map +2 -2
- package/lib/renderers/AnchorNav.d.ts +1 -0
- package/lib/renderers/AnchorNav.js +2 -2
- package/lib/renderers/AnchorNav.js.map +2 -2
- package/lib/renderers/Avatar.js +3 -3
- package/lib/renderers/Avatar.js.map +2 -2
- package/lib/renderers/Breadcrumb.js +1 -1
- package/lib/renderers/Breadcrumb.js.map +2 -2
- package/lib/renderers/CRUD.d.ts +9 -0
- package/lib/renderers/CRUD.js +24 -4
- package/lib/renderers/CRUD.js.map +2 -2
- package/lib/renderers/Card.d.ts +4 -0
- package/lib/renderers/Card.js +29 -23
- package/lib/renderers/Card.js.map +2 -2
- package/lib/renderers/Chart.js +1 -1
- package/lib/renderers/Chart.js.map +2 -2
- package/lib/renderers/Collapse.js +3 -2
- package/lib/renderers/Collapse.js.map +2 -2
- package/lib/renderers/DropDownButton.js +1 -1
- package/lib/renderers/DropDownButton.js.map +2 -2
- package/lib/renderers/Form/DiffEditor.d.ts +4 -3
- package/lib/renderers/Form/Editor.d.ts +3 -2
- package/lib/renderers/Form/InputCity.d.ts +84 -84
- package/lib/renderers/Form/InputCity.js +7 -6
- package/lib/renderers/Form/InputCity.js.map +2 -2
- package/lib/renderers/Form/InputColor.d.ts +84 -84
- package/lib/renderers/Form/InputFile.js +10 -4
- package/lib/renderers/Form/InputFile.js.map +2 -2
- package/lib/renderers/Form/InputImage.js +11 -4
- package/lib/renderers/Form/InputImage.js.map +2 -2
- package/lib/renderers/Form/Item.d.ts +1 -1
- package/lib/renderers/Form/Item.js.map +1 -1
- package/lib/renderers/Form/Options.js +13 -3
- package/lib/renderers/Form/Options.js.map +2 -2
- package/lib/renderers/Form/Select.d.ts +41 -4
- package/lib/renderers/Form/Select.js +23 -3
- package/lib/renderers/Form/Select.js.map +2 -2
- package/lib/renderers/Form/TabsTransferPicker.d.ts +48 -0
- package/lib/renderers/Form/TabsTransferPicker.js +29 -0
- package/lib/renderers/Form/TabsTransferPicker.js.map +13 -0
- package/lib/renderers/Form/Transfer.js +3 -2
- package/lib/renderers/Form/Transfer.js.map +2 -2
- package/lib/renderers/Form/TransferPicker.d.ts +48 -0
- package/lib/renderers/Form/TransferPicker.js +29 -0
- package/lib/renderers/Form/TransferPicker.js.map +13 -0
- package/lib/renderers/Form/TreeSelect.js +2 -2
- package/lib/renderers/Form/TreeSelect.js.map +2 -2
- package/lib/renderers/Form/index.js +1 -1
- package/lib/renderers/Form/index.js.map +2 -2
- package/lib/renderers/Form/wrapControl.js +13 -1
- package/lib/renderers/Form/wrapControl.js.map +2 -2
- package/lib/renderers/IFrame.js +1 -3
- package/lib/renderers/IFrame.js.map +2 -2
- package/lib/renderers/Json.d.ts +4 -0
- package/lib/renderers/Json.js +4 -13
- package/lib/renderers/Json.js.map +2 -2
- package/lib/renderers/Link.d.ts +4 -2
- package/lib/renderers/Link.js +15 -6
- package/lib/renderers/Link.js.map +2 -2
- package/lib/renderers/List.js +1 -1
- package/lib/renderers/List.js.map +2 -2
- package/lib/renderers/Mapping.d.ts +9 -2
- package/lib/renderers/Mapping.js +18 -6
- package/lib/renderers/Mapping.js.map +2 -2
- package/lib/renderers/Nav.d.ts +21 -21
- package/lib/renderers/Nav.js +39 -21
- package/lib/renderers/Nav.js.map +2 -2
- package/lib/renderers/Portlet.d.ts +125 -0
- package/lib/renderers/Portlet.js +156 -0
- package/lib/renderers/Portlet.js.map +13 -0
- package/lib/renderers/Property.js +2 -1
- package/lib/renderers/Property.js.map +2 -2
- package/lib/renderers/SearchBox.d.ts +6 -1
- package/lib/renderers/SearchBox.js +19 -5
- package/lib/renderers/SearchBox.js.map +2 -2
- package/lib/renderers/Table/TableContent.d.ts +4 -1
- package/lib/renderers/Table/TableContent.js +21 -1
- package/lib/renderers/Table/TableContent.js.map +2 -2
- package/lib/renderers/Table/index.d.ts +5 -1
- package/lib/renderers/Table/index.js +64 -29
- package/lib/renderers/Table/index.js.map +2 -2
- package/lib/renderers/Tabs.js +9 -1
- package/lib/renderers/Tabs.js.map +2 -2
- package/lib/renderers/WebComponent.js +1 -1
- package/lib/renderers/WebComponent.js.map +2 -2
- package/lib/store/combo.d.ts +2 -16
- package/lib/store/crud.js +3 -7
- package/lib/store/crud.js.map +2 -2
- package/lib/store/form.d.ts +1 -1
- package/lib/store/form.js +5 -6
- package/lib/store/form.js.map +2 -2
- package/lib/store/service.js +5 -4
- package/lib/store/service.js.map +2 -2
- package/lib/store/table.d.ts +2 -2
- package/lib/themes/ang-ie11.css +422 -149
- package/lib/themes/ang.css +422 -149
- package/lib/themes/ang.css.map +1 -1
- package/lib/themes/antd-ie11.css +422 -149
- package/lib/themes/antd.css +422 -149
- package/lib/themes/antd.css.map +1 -1
- package/lib/themes/cxd-ie11.css +456 -182
- package/lib/themes/cxd.css +456 -182
- package/lib/themes/cxd.css.map +1 -1
- package/lib/themes/dark-ie11.css +422 -149
- package/lib/themes/dark.css +422 -149
- package/lib/themes/dark.css.map +1 -1
- package/lib/themes/default.css +456 -182
- package/lib/themes/default.css.map +1 -1
- package/lib/types.d.ts +37 -0
- package/lib/types.js +0 -5
- package/lib/types.js.map +2 -2
- package/lib/utils/api.d.ts +3 -2
- package/lib/utils/api.js +28 -12
- package/lib/utils/api.js.map +2 -2
- package/lib/utils/dom.d.ts +4 -0
- package/lib/utils/dom.js +11 -1
- package/lib/utils/dom.js.map +2 -2
- package/lib/utils/helper.d.ts +2 -0
- package/lib/utils/helper.js +11 -2
- package/lib/utils/helper.js.map +2 -2
- package/lib/utils/icon.js +3 -0
- package/lib/utils/icon.js.map +2 -2
- package/package.json +1 -1
- package/schema.json +3038 -790
- package/scss/_mixins.scss +1 -3
- package/scss/_properties.scss +25 -1
- package/scss/base/_normalize.scss +2 -0
- package/scss/components/_anchor-nav.scss +88 -29
- package/scss/components/_card.scss +8 -14
- package/scss/components/_collapse.scss +16 -1
- package/scss/components/_mapping.scss +6 -0
- package/scss/components/_nav.scss +1 -1
- package/scss/components/_picker-columns.scss +123 -0
- package/scss/components/_popover.scss +17 -0
- package/scss/components/_portlet.scss +51 -0
- package/scss/components/_status.scss +1 -1
- package/scss/components/_table.scss +26 -0
- package/scss/components/form/_checks.scss +0 -351
- package/scss/components/form/_fieldset.scss +5 -1
- package/scss/components/form/_selection.scss +354 -0
- package/scss/components/form/_transfer.scss +75 -18
- package/scss/themes/_common.scss +4 -0
- package/scss/themes/_cxd-variables.scss +4 -1
- package/scss/themes/cxd.scss +16 -12
- package/sdk/ang-ie11.css +457 -152
- package/sdk/ang.css +480 -154
- package/sdk/antd-ie11.css +456 -151
- package/sdk/antd.css +480 -154
- package/sdk/charts.js +13 -13
- package/sdk/color-picker.js +65 -69
- package/sdk/cropperjs.js +2 -2
- package/sdk/cxd-ie11.css +496 -194
- package/sdk/cxd.css +517 -190
- package/sdk/dark-ie11.css +457 -152
- package/sdk/dark.css +480 -154
- package/sdk/exceljs.js +1 -1
- package/sdk/helper.css.map +1 -1
- package/sdk/locale/de-DE.js +2 -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 +20 -28
- package/sdk/rich-text.js +62 -62
- package/sdk/sdk-ie11.css +496 -194
- package/sdk/sdk.css +517 -190
- package/sdk/sdk.js +1268 -1236
- 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 +14 -0
- package/src/components/AnchorNav.tsx +15 -4
- package/src/components/{AssociatedCheckboxes.tsx → AssociatedSelection.tsx} +41 -37
- package/src/components/Badge.tsx +3 -3
- package/src/components/{ChainedCheckboxes.tsx → ChainedSelection.tsx} +57 -40
- package/src/components/{ListCheckboxes.tsx → GroupedSelection.tsx} +26 -21
- package/src/components/Link.tsx +28 -37
- package/src/components/ModalManager.ts +1 -1
- package/src/components/PickerColumn.tsx +429 -0
- package/src/components/PickerContainer.tsx +128 -0
- package/src/components/Radios.tsx +3 -8
- package/src/components/SearchBox.tsx +4 -5
- package/src/components/Select.tsx +57 -5
- package/src/components/{Checkboxes.tsx → Selection.tsx} +75 -21
- package/src/components/{TableCheckboxes.tsx → TableSelection.tsx} +46 -25
- package/src/components/TabsTransfer.tsx +13 -7
- package/src/components/TabsTransferPicker.tsx +85 -0
- package/src/components/Transfer.tsx +71 -50
- package/src/components/TransferDropDown.tsx +117 -0
- package/src/components/TransferPicker.tsx +84 -0
- package/src/components/{TreeCheckboxes.tsx → TreeSelection.tsx} +33 -26
- package/src/components/WithRemoteConfig.tsx +7 -2
- package/src/components/condition-builder/Field.tsx +5 -5
- package/src/components/condition-builder/Func.tsx +3 -3
- package/src/components/condition-builder/InputSwitch.tsx +3 -3
- package/src/components/condition-builder/Item.tsx +5 -12
- package/src/components/index.tsx +13 -13
- package/src/envOverwrite.ts +0 -1
- package/src/factory.tsx +18 -3
- package/src/hooks/index.ts +5 -0
- package/src/hooks/use-set-state.ts +19 -0
- package/src/hooks/use-touch.ts +100 -0
- package/src/hooks/use-update-effect.ts +16 -0
- package/src/index.tsx +3 -0
- package/src/locale/de-DE.ts +2 -0
- package/src/locale/en-US.ts +2 -0
- package/src/locale/zh-CN.ts +4 -2
- package/src/renderers/Action.tsx +28 -2
- package/src/renderers/AnchorNav.tsx +4 -0
- package/src/renderers/Avatar.tsx +8 -4
- package/src/renderers/Breadcrumb.tsx +5 -1
- package/src/renderers/CRUD.tsx +33 -3
- package/src/renderers/Card.tsx +63 -34
- package/src/renderers/Chart.tsx +6 -2
- package/src/renderers/Collapse.tsx +4 -2
- package/src/renderers/DropDownButton.tsx +1 -1
- package/src/renderers/Form/InputCity.tsx +4 -8
- package/src/renderers/Form/InputFile.tsx +29 -20
- package/src/renderers/Form/InputImage.tsx +11 -3
- package/src/renderers/Form/Item.tsx +1 -1
- package/src/renderers/Form/Options.tsx +16 -2
- package/src/renderers/Form/Select.tsx +144 -21
- package/src/renderers/Form/TabsTransferPicker.tsx +123 -0
- package/src/renderers/Form/Transfer.tsx +3 -2
- package/src/renderers/Form/TransferPicker.tsx +123 -0
- package/src/renderers/Form/TreeSelect.tsx +25 -0
- package/src/renderers/Form/index.tsx +1 -1
- package/src/renderers/Form/wrapControl.tsx +26 -1
- package/src/renderers/IFrame.tsx +2 -4
- package/src/renderers/Json.tsx +9 -9
- package/src/renderers/Link.tsx +27 -13
- package/src/renderers/List.tsx +1 -1
- package/src/renderers/Mapping.tsx +27 -11
- package/src/renderers/Nav.tsx +108 -60
- package/src/renderers/Portlet.tsx +423 -0
- package/src/renderers/Property.tsx +3 -2
- package/src/renderers/SearchBox.tsx +23 -4
- package/src/renderers/Table/TableContent.tsx +40 -2
- package/src/renderers/Table/index.tsx +87 -41
- package/src/renderers/Tabs.tsx +9 -1
- package/src/renderers/WebComponent.tsx +2 -2
- package/src/store/crud.ts +3 -8
- package/src/store/form.ts +5 -10
- package/src/store/service.ts +5 -4
- package/src/types.ts +57 -0
- package/src/utils/api.ts +40 -20
- package/src/utils/dom.tsx +12 -0
- package/src/utils/helper.ts +8 -0
- package/src/utils/icon.tsx +4 -0
- package/dump.rdb +0 -0
- package/lib/components/AssociatedCheckboxes.d.ts +0 -762
- package/lib/components/AssociatedCheckboxes.js +0 -90
- package/lib/components/AssociatedCheckboxes.js.map +0 -13
- package/lib/components/ChainedCheckboxes.js.map +0 -13
- package/lib/components/Checkboxes.js +0 -101
- package/lib/components/Checkboxes.js.map +0 -13
- package/lib/components/ListCheckboxes.d.ts +0 -739
- package/lib/components/ListCheckboxes.js +0 -48
- package/lib/components/ListCheckboxes.js.map +0 -13
- package/lib/components/ListRadios.d.ts +0 -763
- package/lib/components/ListRadios.js +0 -86
- package/lib/components/ListRadios.js.map +0 -13
- package/lib/components/TableCheckboxes.js.map +0 -13
- package/lib/components/TreeCheckboxes.js.map +0 -13
- package/lib/components/TreeRadios.d.ts +0 -838
- package/lib/components/TreeRadios.js +0 -116
- package/lib/components/TreeRadios.js.map +0 -13
- package/src/components/ListRadios.tsx +0 -159
- package/src/components/TreeRadios.tsx +0 -202
package/src/renderers/Action.tsx
CHANGED
@@ -4,8 +4,14 @@ import {Renderer, RendererProps} from '../factory';
|
|
4
4
|
import {filter} from '../utils/tpl';
|
5
5
|
import Button from '../components/Button';
|
6
6
|
import pick from 'lodash/pick';
|
7
|
+
import omit from 'lodash/omit';
|
7
8
|
|
8
9
|
export interface ButtonSchema extends BaseSchema {
|
10
|
+
/**
|
11
|
+
* 主要用于用户行为跟踪里区分是哪个按钮
|
12
|
+
*/
|
13
|
+
id?: string;
|
14
|
+
|
9
15
|
/**
|
10
16
|
* 是否为块状展示,默认为内联。
|
11
17
|
*/
|
@@ -332,6 +338,7 @@ export type ActionSchema =
|
|
332
338
|
| VanillaAction;
|
333
339
|
|
334
340
|
const ActionProps = [
|
341
|
+
'id',
|
335
342
|
'dialog',
|
336
343
|
'drawer',
|
337
344
|
'url',
|
@@ -570,7 +577,8 @@ export class Action extends React.Component<ActionProps, ActionState> {
|
|
570
577
|
|
571
578
|
@autobind
|
572
579
|
async handleAction(e: React.MouseEvent<any>) {
|
573
|
-
const {onAction, disabled, countDown} = this.props;
|
580
|
+
const {onAction, disabled, countDown, env} = this.props;
|
581
|
+
|
574
582
|
// https://reactjs.org/docs/legacy-event-pooling.html
|
575
583
|
e.persist();
|
576
584
|
let onClick = this.props.onClick;
|
@@ -592,9 +600,26 @@ export class Action extends React.Component<ActionProps, ActionState> {
|
|
592
600
|
|
593
601
|
e.preventDefault();
|
594
602
|
const action = pick(this.props, ActionProps) as ActionSchema;
|
603
|
+
const actionType = action.actionType;
|
604
|
+
|
605
|
+
// ajax 会在 wrapFetcher 里记录,这里再处理就重复了,因此去掉
|
606
|
+
// add 一般是 input-table 之类的,会触发 formItemChange,为了避免重复也去掉
|
607
|
+
if (
|
608
|
+
actionType !== 'ajax' &&
|
609
|
+
actionType !== 'download' &&
|
610
|
+
actionType !== 'add'
|
611
|
+
) {
|
612
|
+
env?.tracker(
|
613
|
+
{
|
614
|
+
eventType: actionType || this.props.type || 'click',
|
615
|
+
eventData: omit(action, ['type', 'actionType', 'tooltipPlacement'])
|
616
|
+
},
|
617
|
+
this.props
|
618
|
+
);
|
619
|
+
}
|
595
620
|
|
596
621
|
// download 是一种 ajax 的简写
|
597
|
-
if (
|
622
|
+
if (actionType === 'download') {
|
598
623
|
action.actionType = 'ajax';
|
599
624
|
const api = normalizeApi((action as AjaxActionSchema).api);
|
600
625
|
api.responseType = 'blob';
|
@@ -798,6 +823,7 @@ export class ActionRenderer extends React.Component<
|
|
798
823
|
return (
|
799
824
|
<Action
|
800
825
|
{...(rest as any)}
|
826
|
+
env={env}
|
801
827
|
disabled={disabled || btnDisabled}
|
802
828
|
onAction={this.handleAction}
|
803
829
|
loading={loading}
|
@@ -65,6 +65,8 @@ export interface AnchorNavSchema extends BaseSchema {
|
|
65
65
|
* 楼层样式名
|
66
66
|
*/
|
67
67
|
sectionClassName?: SchemaClassName;
|
68
|
+
|
69
|
+
direction?: 'vertical' | 'horizontal';
|
68
70
|
}
|
69
71
|
|
70
72
|
export interface AnchorNavProps
|
@@ -148,6 +150,7 @@ export default class AnchorNav extends React.Component<
|
|
148
150
|
className,
|
149
151
|
linkClassName,
|
150
152
|
sectionClassName,
|
153
|
+
direction,
|
151
154
|
sectionRender,
|
152
155
|
render,
|
153
156
|
data
|
@@ -187,6 +190,7 @@ export default class AnchorNav extends React.Component<
|
|
187
190
|
sectionClassName={sectionClassName}
|
188
191
|
onSelect={this.handleSelect}
|
189
192
|
active={this.state.active}
|
193
|
+
direction={direction}
|
190
194
|
>
|
191
195
|
{children}
|
192
196
|
</CAnchorNav>
|
package/src/renderers/Avatar.tsx
CHANGED
@@ -10,7 +10,11 @@ import {
|
|
10
10
|
SchemaUrlPath
|
11
11
|
} from '../Schema';
|
12
12
|
import {BadgeSchema, withBadge} from '../components/Badge';
|
13
|
-
import {
|
13
|
+
import {
|
14
|
+
isPureVariable,
|
15
|
+
resolveVariable,
|
16
|
+
resolveVariableAndFilter
|
17
|
+
} from '../utils/tpl-builtin';
|
14
18
|
|
15
19
|
/**
|
16
20
|
* Avatar 用户头像显示
|
@@ -102,15 +106,15 @@ export class AvatarField extends React.Component<AvatarProps, object> {
|
|
102
106
|
};
|
103
107
|
|
104
108
|
if (isPureVariable(text)) {
|
105
|
-
text =
|
109
|
+
text = resolveVariableAndFilter(text, data);
|
106
110
|
}
|
107
111
|
|
108
112
|
if (isPureVariable(src)) {
|
109
|
-
src =
|
113
|
+
src = resolveVariableAndFilter(src, data, '| raw');
|
110
114
|
}
|
111
115
|
|
112
116
|
if (isPureVariable(icon)) {
|
113
|
-
icon =
|
117
|
+
icon = resolveVariableAndFilter(icon, data);
|
114
118
|
}
|
115
119
|
|
116
120
|
let avatar = <i className={icon} />;
|
@@ -77,7 +77,11 @@ export class BreadcrumbField extends React.Component<BreadcrumbProps, object> {
|
|
77
77
|
|
78
78
|
const crumbItems = items
|
79
79
|
? items
|
80
|
-
: (
|
80
|
+
: (resolveVariableAndFilter(
|
81
|
+
source,
|
82
|
+
data,
|
83
|
+
'| raw'
|
84
|
+
) as Array<BreadcrumbItemSchema>);
|
81
85
|
|
82
86
|
const crumbs = crumbItems
|
83
87
|
.map<React.ReactNode>((item, index) => (
|
package/src/renderers/CRUD.tsx
CHANGED
@@ -282,6 +282,16 @@ export interface CRUDCommonSchema extends BaseSchema {
|
|
282
282
|
* 默认只有当分页数大于 1 是才显示,如果总是想显示请配置。
|
283
283
|
*/
|
284
284
|
alwaysShowPagination?: boolean;
|
285
|
+
|
286
|
+
/**
|
287
|
+
* 开启查询区域,会根据列元素的searchable属性值,自动生成查询条件表单
|
288
|
+
*/
|
289
|
+
autoGenerateFilter?: boolean;
|
290
|
+
|
291
|
+
/**
|
292
|
+
* 内容区域占满屏幕剩余空间
|
293
|
+
*/
|
294
|
+
autoFillHeight?: boolean;
|
285
295
|
}
|
286
296
|
|
287
297
|
export type CRUDCardsSchema = CRUDCommonSchema & {
|
@@ -361,7 +371,8 @@ export default class CRUD extends React.Component<CRUDProps, any> {
|
|
361
371
|
'onInit',
|
362
372
|
'onSaved',
|
363
373
|
'onQuery',
|
364
|
-
'formStore'
|
374
|
+
'formStore',
|
375
|
+
'autoFillHeight'
|
365
376
|
];
|
366
377
|
static defaultProps = {
|
367
378
|
toolbarInline: true,
|
@@ -377,7 +388,8 @@ export default class CRUD extends React.Component<CRUDProps, any> {
|
|
377
388
|
filterTogglable: false,
|
378
389
|
filterDefaultVisible: true,
|
379
390
|
loadDataOnce: false,
|
380
|
-
loadDataOnceFetchOnFilter: true
|
391
|
+
loadDataOnceFetchOnFilter: true,
|
392
|
+
autoFillHeight: false
|
381
393
|
};
|
382
394
|
|
383
395
|
control: any;
|
@@ -1790,7 +1802,7 @@ export default class CRUD extends React.Component<CRUDProps, any> {
|
|
1790
1802
|
return null;
|
1791
1803
|
}
|
1792
1804
|
|
1793
|
-
const {render, store} = this.props;
|
1805
|
+
const {render, store, translate: __} = this.props;
|
1794
1806
|
const type = (toolbar as Schema).type || toolbar;
|
1795
1807
|
|
1796
1808
|
if (type === 'bulkActions' || type === 'bulk-actions') {
|
@@ -1807,6 +1819,22 @@ export default class CRUD extends React.Component<CRUDProps, any> {
|
|
1807
1819
|
return this.renderFilterToggler();
|
1808
1820
|
} else if (type === 'export-csv') {
|
1809
1821
|
return this.renderExportCSV(toolbar as Schema);
|
1822
|
+
} else if (type === 'reload') {
|
1823
|
+
let reloadButton = {
|
1824
|
+
label: '',
|
1825
|
+
icon: 'fa fa-sync',
|
1826
|
+
tooltip: __('reload'),
|
1827
|
+
tooltipPlacement: 'top',
|
1828
|
+
type: 'button'
|
1829
|
+
};
|
1830
|
+
if (typeof toolbar === 'object') {
|
1831
|
+
reloadButton = {...reloadButton, ...omit(toolbar, ['type', 'align'])};
|
1832
|
+
}
|
1833
|
+
return render(`toolbar/${index}`, reloadButton, {
|
1834
|
+
onAction: () => {
|
1835
|
+
this.reload();
|
1836
|
+
}
|
1837
|
+
});
|
1810
1838
|
} else if (Array.isArray(toolbar)) {
|
1811
1839
|
const children: Array<any> = toolbar
|
1812
1840
|
.filter((toolbar: any) => isVisible(toolbar, store.filterData))
|
@@ -1995,6 +2023,7 @@ export default class CRUD extends React.Component<CRUDProps, any> {
|
|
1995
2023
|
onQuery,
|
1996
2024
|
autoGenerateFilter,
|
1997
2025
|
onSelect,
|
2026
|
+
autoFillHeight,
|
1998
2027
|
...rest
|
1999
2028
|
} = this.props;
|
2000
2029
|
|
@@ -2046,6 +2075,7 @@ export default class CRUD extends React.Component<CRUDProps, any> {
|
|
2046
2075
|
className: cx('Crud-body', bodyClassName),
|
2047
2076
|
ref: this.controlRef,
|
2048
2077
|
autoGenerateFilter: !filter && autoGenerateFilter,
|
2078
|
+
autoFillHeight: autoFillHeight,
|
2049
2079
|
selectable: !!(
|
2050
2080
|
(this.hasBulkActionsToolbar() && this.hasBulkActions()) ||
|
2051
2081
|
pickerMode
|
package/src/renderers/Card.tsx
CHANGED
@@ -166,6 +166,11 @@ export interface CardSchema extends BaseSchema {
|
|
166
166
|
* 底部按钮集合。
|
167
167
|
*/
|
168
168
|
actions?: Array<ActionSchema>;
|
169
|
+
|
170
|
+
/**
|
171
|
+
* 工具栏按钮
|
172
|
+
*/
|
173
|
+
toolbar?: Array<ActionSchema>;
|
169
174
|
}
|
170
175
|
|
171
176
|
export interface CardProps
|
@@ -273,30 +278,47 @@ export class Card extends React.Component<CardProps> {
|
|
273
278
|
multiple,
|
274
279
|
hideCheckToggler,
|
275
280
|
classnames: cx,
|
276
|
-
classPrefix: ns
|
281
|
+
classPrefix: ns,
|
282
|
+
toolbar,
|
283
|
+
render
|
277
284
|
} = this.props;
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
285
|
+
const toolbars: Array<JSX.Element> = [];
|
286
|
+
|
287
|
+
if (selectable && !hideCheckToggler) {
|
288
|
+
toolbars.push(
|
289
|
+
<Checkbox
|
290
|
+
key="check"
|
291
|
+
className={cx('Card-checkbox')}
|
292
|
+
type={multiple ? 'checkbox' : 'radio'}
|
293
|
+
disabled={!checkable}
|
294
|
+
checked={selected}
|
295
|
+
onChange={checkOnItemClick ? noop : this.handleCheck}
|
296
|
+
/>
|
284
297
|
);
|
285
|
-
}
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
298
|
+
}
|
299
|
+
|
300
|
+
if (Array.isArray(toolbar)) {
|
301
|
+
toolbar.forEach((action, index) =>
|
302
|
+
toolbars.push(
|
303
|
+
render(
|
304
|
+
`toolbar/${index}`,
|
305
|
+
{
|
306
|
+
type: 'button',
|
307
|
+
level: 'link',
|
308
|
+
size: 'sm',
|
309
|
+
...(action as any)
|
310
|
+
},
|
311
|
+
{
|
312
|
+
key: index
|
313
|
+
}
|
314
|
+
)
|
315
|
+
)
|
296
316
|
);
|
297
317
|
}
|
298
318
|
|
299
|
-
return
|
319
|
+
return toolbars.length ? (
|
320
|
+
<div className={cx('Card-toolbar')}>{toolbars}</div>
|
321
|
+
) : null;
|
300
322
|
}
|
301
323
|
|
302
324
|
renderActions() {
|
@@ -451,12 +473,14 @@ export class Card extends React.Component<CardProps> {
|
|
451
473
|
imageClassName,
|
452
474
|
avatarTextClassName,
|
453
475
|
href,
|
454
|
-
itemAction
|
476
|
+
itemAction,
|
477
|
+
dragging
|
455
478
|
} = this.props;
|
456
479
|
|
480
|
+
const toolbar = this.renderToolbar();
|
457
481
|
let heading = null;
|
458
482
|
|
459
|
-
if (header) {
|
483
|
+
if (header || toolbar) {
|
460
484
|
const {
|
461
485
|
highlight: highlightTpl,
|
462
486
|
avatar: avatarTpl,
|
@@ -465,31 +489,31 @@ export class Card extends React.Component<CardProps> {
|
|
465
489
|
subTitle: subTitleTpl,
|
466
490
|
subTitlePlaceholder,
|
467
491
|
desc: descTpl
|
468
|
-
} = header;
|
492
|
+
} = header || {};
|
469
493
|
|
470
494
|
const descPlaceholder =
|
471
|
-
header
|
495
|
+
header?.descriptionPlaceholder || header?.descPlaceholder;
|
472
496
|
|
473
497
|
const highlight = !!evalExpression(highlightTpl!, data as object);
|
474
498
|
const avatar = filter(avatarTpl, data, '| raw');
|
475
499
|
const avatarText = filter(avatarTextTpl, data);
|
476
500
|
const title = filter(titleTpl, data);
|
477
501
|
const subTitle = filter(subTitleTpl, data);
|
478
|
-
const desc = filter(header
|
502
|
+
const desc = filter(header?.description || descTpl, data);
|
479
503
|
|
480
504
|
heading = (
|
481
|
-
<div className={cx('Card-heading', header
|
505
|
+
<div className={cx('Card-heading', header?.className)}>
|
482
506
|
{avatar ? (
|
483
507
|
<span
|
484
508
|
className={cx(
|
485
509
|
'Card-avtar',
|
486
|
-
header
|
510
|
+
header?.avatarClassName || avatarClassName
|
487
511
|
)}
|
488
512
|
>
|
489
513
|
<img
|
490
514
|
className={cx(
|
491
515
|
'Card-img',
|
492
|
-
header
|
516
|
+
header?.imageClassName || imageClassName
|
493
517
|
)}
|
494
518
|
src={avatar}
|
495
519
|
/>
|
@@ -498,7 +522,7 @@ export class Card extends React.Component<CardProps> {
|
|
498
522
|
<span
|
499
523
|
className={cx(
|
500
524
|
'Card-avtarText',
|
501
|
-
header
|
525
|
+
header?.avatarTextClassName || avatarTextClassName
|
502
526
|
)}
|
503
527
|
>
|
504
528
|
{avatarText}
|
@@ -509,7 +533,7 @@ export class Card extends React.Component<CardProps> {
|
|
509
533
|
<i
|
510
534
|
className={cx(
|
511
535
|
'Card-highlight',
|
512
|
-
header
|
536
|
+
header?.highlightClassName || highlightClassName
|
513
537
|
)}
|
514
538
|
/>
|
515
539
|
) : null}
|
@@ -518,7 +542,7 @@ export class Card extends React.Component<CardProps> {
|
|
518
542
|
<div
|
519
543
|
className={cx(
|
520
544
|
'Card-title',
|
521
|
-
header
|
545
|
+
header?.titleClassName || titleClassName
|
522
546
|
)}
|
523
547
|
>
|
524
548
|
{render('title', title)}
|
@@ -529,7 +553,7 @@ export class Card extends React.Component<CardProps> {
|
|
529
553
|
<div
|
530
554
|
className={cx(
|
531
555
|
'Card-subTitle',
|
532
|
-
header
|
556
|
+
header?.subTitleClassName || subTitleClassName
|
533
557
|
)}
|
534
558
|
>
|
535
559
|
{render('sub-title', subTitle || subTitlePlaceholder!, {
|
@@ -542,8 +566,8 @@ export class Card extends React.Component<CardProps> {
|
|
542
566
|
<div
|
543
567
|
className={cx(
|
544
568
|
'Card-desc',
|
545
|
-
header
|
546
|
-
header
|
569
|
+
header?.descriptionClassName ||
|
570
|
+
header?.descClassName ||
|
547
571
|
descClassName
|
548
572
|
)}
|
549
573
|
>
|
@@ -553,6 +577,7 @@ export class Card extends React.Component<CardProps> {
|
|
553
577
|
</div>
|
554
578
|
) : null}
|
555
579
|
</div>
|
580
|
+
{toolbar}
|
556
581
|
</div>
|
557
582
|
);
|
558
583
|
}
|
@@ -570,7 +595,11 @@ export class Card extends React.Component<CardProps> {
|
|
570
595
|
'Card--link': href || itemAction
|
571
596
|
})}
|
572
597
|
>
|
573
|
-
{
|
598
|
+
{dragging ? (
|
599
|
+
<div className={cx('Card-dragBtn')}>
|
600
|
+
<Icon icon="drag-bar" className="icon" />
|
601
|
+
</div>
|
602
|
+
) : null}
|
574
603
|
{heading}
|
575
604
|
{body ? (
|
576
605
|
<div className={cx('Card-body', bodyClassName)}>{body}</div>
|
package/src/renderers/Chart.tsx
CHANGED
@@ -12,7 +12,11 @@ import {
|
|
12
12
|
isPureVariable,
|
13
13
|
dataMapping
|
14
14
|
} from '../utils/tpl-builtin';
|
15
|
-
import {
|
15
|
+
import {
|
16
|
+
isApiOutdated,
|
17
|
+
isEffectiveApi,
|
18
|
+
normalizeApiResponseData
|
19
|
+
} from '../utils/api';
|
16
20
|
import {ScopedContext, IScopedContext} from '../Scoped';
|
17
21
|
import {createObject, findObjectsWithKey} from '../utils/helper';
|
18
22
|
import Spinner from '../components/Spinner';
|
@@ -342,7 +346,7 @@ export class Chart extends React.Component<ChartProps> {
|
|
342
346
|
}
|
343
347
|
delete this.reloadCancel;
|
344
348
|
|
345
|
-
const data = result.data
|
349
|
+
const data = normalizeApiResponseData(result.data);
|
346
350
|
// 说明返回的是数据接口。
|
347
351
|
if (!data.series && this.props.config) {
|
348
352
|
const ctx = createObject(this.props.data, data);
|
@@ -176,8 +176,10 @@ export default class Collapse extends React.Component<
|
|
176
176
|
onClick={this.toggleCollapsed}
|
177
177
|
className={cx(`Collapse-header`, headingClassName)}
|
178
178
|
>
|
179
|
-
|
180
|
-
|
179
|
+
<div className={cx('Collapse-header-wrapper')}>
|
180
|
+
{render('heading', finalTitle, {className: 'Collapse-header-tpl'})}
|
181
|
+
{collapsable && <span className={cx('Collapse-arrow')} />}
|
182
|
+
</div>
|
181
183
|
</HeadingComponent>
|
182
184
|
) : null,
|
183
185
|
|
@@ -339,7 +339,7 @@ export default class DropDownButton extends React.Component<
|
|
339
339
|
{rightIconElement}
|
340
340
|
{!hideCaret ? (
|
341
341
|
<span className={cx('DropDown-caret')}>
|
342
|
-
<Icon icon="
|
342
|
+
<Icon icon="caret" className="icon" />
|
343
343
|
</span>
|
344
344
|
) : null}
|
345
345
|
</button>
|
@@ -1,7 +1,8 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import {FormItem, FormControlProps, FormBaseControl} from './Item';
|
3
3
|
import {ClassNamesFn, themeable, ThemeProps} from '../../theme';
|
4
|
-
import
|
4
|
+
import Spinner from '../../components/Spinner';
|
5
|
+
import Select from '../../components/Select';
|
5
6
|
import {autobind} from '../../utils/helper';
|
6
7
|
import {Option} from './Options';
|
7
8
|
import {localeable, LocaleProps} from '../../locale';
|
@@ -293,13 +294,8 @@ export class CityPicker extends React.Component<
|
|
293
294
|
|
294
295
|
@autobind
|
295
296
|
syncOut() {
|
296
|
-
const {
|
297
|
-
|
298
|
-
allowStreet,
|
299
|
-
joinValues,
|
300
|
-
extractValue,
|
301
|
-
delimiter
|
302
|
-
} = this.props;
|
297
|
+
const {onChange, allowStreet, joinValues, extractValue, delimiter} =
|
298
|
+
this.props;
|
303
299
|
|
304
300
|
const {code, province, city, district, street} = this.state;
|
305
301
|
|
@@ -20,6 +20,7 @@ import {
|
|
20
20
|
SchemaClassName,
|
21
21
|
SchemaTokenizeableString
|
22
22
|
} from '../../Schema';
|
23
|
+
import merge from 'lodash/merge';
|
23
24
|
|
24
25
|
/**
|
25
26
|
* File 文件上传控件
|
@@ -356,11 +357,12 @@ export default class FileControl extends React.Component<FileProps, FileState> {
|
|
356
357
|
if (value && value instanceof Blob) {
|
357
358
|
files = [value as any];
|
358
359
|
} else if (value) {
|
359
|
-
files = (
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
360
|
+
files = (
|
361
|
+
Array.isArray(value)
|
362
|
+
? value
|
363
|
+
: joinValues
|
364
|
+
? `${(value as any)[valueField] || value}`.split(delimiter)
|
365
|
+
: [value as any]
|
364
366
|
)
|
365
367
|
.map(item => FileControl.valueToFile(item, props) as FileValue)
|
366
368
|
.filter(item => item);
|
@@ -402,11 +404,12 @@ export default class FileControl extends React.Component<FileProps, FileState> {
|
|
402
404
|
let files: Array<FileValue> = [];
|
403
405
|
|
404
406
|
if (value) {
|
405
|
-
files = (
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
407
|
+
files = (
|
408
|
+
Array.isArray(value)
|
409
|
+
? value
|
410
|
+
: joinValues && typeof value === 'string'
|
411
|
+
? value.split(delimiter)
|
412
|
+
: [value as any]
|
410
413
|
)
|
411
414
|
.map(item => {
|
412
415
|
let obj = FileControl.valueToFile(
|
@@ -851,8 +854,8 @@ export default class FileControl extends React.Component<FileProps, FileState> {
|
|
851
854
|
}
|
852
855
|
|
853
856
|
syncAutoFill() {
|
854
|
-
const {autoFill, multiple, onBulkChange} = this.props;
|
855
|
-
if (!isEmpty(autoFill)) {
|
857
|
+
const {autoFill, multiple, onBulkChange, data} = this.props;
|
858
|
+
if (!isEmpty(autoFill) && onBulkChange) {
|
856
859
|
const files = this.state.files.filter(
|
857
860
|
file => ~['uploaded', 'init', 'ready'].indexOf(file.state as string)
|
858
861
|
);
|
@@ -864,7 +867,12 @@ export default class FileControl extends React.Component<FileProps, FileState> {
|
|
864
867
|
}
|
865
868
|
: files[0]
|
866
869
|
);
|
867
|
-
|
870
|
+
Object.keys(toSync).forEach(key => {
|
871
|
+
if (isPlainObject(toSync[key]) && isPlainObject(data[key])) {
|
872
|
+
toSync[key] = merge({}, data[key], toSync[key]);
|
873
|
+
}
|
874
|
+
});
|
875
|
+
onBulkChange(toSync);
|
868
876
|
}
|
869
877
|
}
|
870
878
|
|
@@ -1223,13 +1231,14 @@ export default class FileControl extends React.Component<FileProps, FileState> {
|
|
1223
1231
|
onClick={this.handleSelect}
|
1224
1232
|
>
|
1225
1233
|
<Icon icon="upload" className="icon" />
|
1226
|
-
<span>
|
1227
|
-
|
1228
|
-
|
1229
|
-
|
1230
|
-
|
1231
|
-
|
1232
|
-
|
1234
|
+
<span>
|
1235
|
+
{!multiple && files.length
|
1236
|
+
? __('File.repick')
|
1237
|
+
: multiple && files.length
|
1238
|
+
? __('File.continueAdd')
|
1239
|
+
: btnLabel
|
1240
|
+
? btnLabel
|
1241
|
+
: __('File.upload')}
|
1233
1242
|
</span>
|
1234
1243
|
</Button>
|
1235
1244
|
) : null}
|
@@ -29,6 +29,8 @@ import {
|
|
29
29
|
SchemaUrlPath
|
30
30
|
} from '../../Schema';
|
31
31
|
import {filter} from '../../utils/tpl';
|
32
|
+
import isPlainObject from 'lodash/isPlainObject';
|
33
|
+
import merge from 'lodash/merge';
|
32
34
|
|
33
35
|
/**
|
34
36
|
* Image 图片上传控件
|
@@ -790,8 +792,8 @@ export default class ImageControl extends React.Component<
|
|
790
792
|
}
|
791
793
|
|
792
794
|
syncAutoFill() {
|
793
|
-
const {autoFill, multiple, onBulkChange} = this.props;
|
794
|
-
if (!isEmpty(autoFill)) {
|
795
|
+
const {autoFill, multiple, onBulkChange, data} = this.props;
|
796
|
+
if (!isEmpty(autoFill) && onBulkChange) {
|
795
797
|
const files = this.state.files.filter(
|
796
798
|
file => ~['uploaded', 'init', 'ready'].indexOf(file.state as string)
|
797
799
|
);
|
@@ -803,7 +805,13 @@ export default class ImageControl extends React.Component<
|
|
803
805
|
}
|
804
806
|
: files[0]
|
805
807
|
);
|
806
|
-
|
808
|
+
|
809
|
+
Object.keys(toSync).forEach(key => {
|
810
|
+
if (isPlainObject(toSync[key]) && isPlainObject(data[key])) {
|
811
|
+
toSync[key] = merge({}, data[key], toSync[key]);
|
812
|
+
}
|
813
|
+
});
|
814
|
+
onBulkChange(toSync);
|
807
815
|
}
|
808
816
|
}
|
809
817
|
|
@@ -314,7 +314,7 @@ export interface FormItemProps extends RendererProps {
|
|
314
314
|
submitOnChange?: boolean,
|
315
315
|
changeImmediately?: boolean
|
316
316
|
) => void;
|
317
|
-
onBulkChange
|
317
|
+
onBulkChange?: (
|
318
318
|
values: {[propName: string]: any},
|
319
319
|
submitOnChange?: boolean
|
320
320
|
) => void;
|
@@ -48,6 +48,8 @@ import {
|
|
48
48
|
SchemaObject,
|
49
49
|
SchemaTokenizeableString
|
50
50
|
} from '../../Schema';
|
51
|
+
import isPlainObject from 'lodash/isPlainObject';
|
52
|
+
import merge from 'lodash/merge';
|
51
53
|
|
52
54
|
export {Option};
|
53
55
|
|
@@ -450,7 +452,12 @@ export function registerOptionsControl(config: OptionsConfig) {
|
|
450
452
|
const {autoFill, multiple, onBulkChange, data} = this.props;
|
451
453
|
const formItem = this.props.formItem as IFormItemStore;
|
452
454
|
|
453
|
-
if (
|
455
|
+
if (
|
456
|
+
onBulkChange &&
|
457
|
+
autoFill &&
|
458
|
+
!isEmpty(autoFill) &&
|
459
|
+
formItem.filteredOptions.length
|
460
|
+
) {
|
454
461
|
const selectedOptions = formItem.getSelectedOptions(value);
|
455
462
|
const toSync = dataMapping(
|
456
463
|
autoFill,
|
@@ -482,7 +489,14 @@ export function registerOptionsControl(config: OptionsConfig) {
|
|
482
489
|
selectedOptions[0]
|
483
490
|
)
|
484
491
|
);
|
485
|
-
|
492
|
+
|
493
|
+
Object.keys(toSync).forEach(key => {
|
494
|
+
if (isPlainObject(toSync[key]) && isPlainObject(data[key])) {
|
495
|
+
toSync[key] = merge({}, data[key], toSync[key]);
|
496
|
+
}
|
497
|
+
});
|
498
|
+
|
499
|
+
onBulkChange(toSync);
|
486
500
|
}
|
487
501
|
}
|
488
502
|
|