oadp-material
Version:
oadp-material
111 lines (110 loc) • 3.59 kB
JavaScript
import _Dialog from "@alifd/next/es/dialog";
import _Box from "@alifd/next/es/box";
import _Transfer from "@alifd/next/es/transfer";
import _Button from "@alifd/next/es/button";
import _Icon from "@alifd/next/es/icon";
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
var _excluded = ["children", "attributeDataSource", "attributeShowDataSource", "onOpen", "onConfirm", "__designMode"];
import React, { useState, useEffect } from 'react';
// oadp-filter 组件定义
// oadp-filter 组件实例
var OadpAttributeSettingTransfer = function OadpAttributeSettingTransfer(_ref) {
var children = _ref.children,
attributeDataSource = _ref.attributeDataSource,
attributeShowDataSource = _ref.attributeShowDataSource,
onOpen = _ref.onOpen,
onConfirm = _ref.onConfirm,
__designMode = _ref.__designMode,
otherProps = _objectWithoutPropertiesLoose(_ref, _excluded);
var _useState = useState(attributeShowDataSource),
localValues = _useState[0],
setLocalValues = _useState[1];
var _React$useState = React.useState(false),
visibleTableSetting = _React$useState[0],
setVisibleTableSetting = _React$useState[1];
useEffect(function () {
setLocalValues(attributeShowDataSource || []);
}, [attributeShowDataSource]);
var handleDialogOpen = function handleDialogOpen() {
onOpen === null || onOpen === void 0 ? void 0 : onOpen();
if (__designMode === 'design') {
console.log('OadpEntityButtonReadCondition handleDialogOpen __designMode === design');
return;
}
setVisibleTableSetting(true);
};
var handleDialogOk = function handleDialogOk() {
onConfirm === null || onConfirm === void 0 ? void 0 : onConfirm(localValues);
setVisibleTableSetting(false);
};
var handleTransferChange = function handleTransferChange(value, data, extra) {
setLocalValues(value);
};
return /*#__PURE__*/React.createElement(_Box, {
direction: "row",
justify: "start",
align: "center"
}, /*#__PURE__*/React.createElement(_Button, {
onClick: handleDialogOpen,
text: false,
type: "secondary",
size: "medium",
iconSize: "medium",
icons: {
loading: /*#__PURE__*/React.createElement(_Icon, {
type: "set"
})
},
style: {
paddingLeft: 4,
paddingRight: 4,
border: 'none'
},
"aria-label": "set button"
}, /*#__PURE__*/React.createElement(_Icon, {
type: "set",
size: "large"
})), /*#__PURE__*/React.createElement(_Dialog, {
title: "\u8BBE\u7F6E",
overflowScroll: true,
visible: visibleTableSetting,
onOk: handleDialogOk,
onCancel: function onCancel() {
return setVisibleTableSetting(false);
},
onClose: function onClose() {
return setVisibleTableSetting(false);
},
style: {
width: '50%',
height: '70%'
},
v2: true,
closeMode: ['close', 'mask', 'esc']
}, /*#__PURE__*/React.createElement(_Box, {
direction: "column",
align: "center"
}, /*#__PURE__*/React.createElement(_Transfer, {
sortable: true,
value: localValues,
searchProps: {
hasClear: true,
style: {
width: '225px'
}
},
listStyle: {
width: '225px',
height: '300px'
},
onChange: handleTransferChange,
useVirtual: true,
dataSource: attributeDataSource
// onSort={this.handleSort}
,
titles: ['未展示', '已展示'],
showSearch: [true, true],
notFoundContent: ['请选择数据', '请选择数据']
}))));
};
export default OadpAttributeSettingTransfer;