@aliretail/react-materials-components
Version:
80 lines (68 loc) • 2.24 kB
JavaScript
import _Dialog from "@alifd/next/es/dialog";
import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose";
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import AreaSelect from "./areaSelect";
var AreaSelectDialog = /*#__PURE__*/function (_Component) {
_inheritsLoose(AreaSelectDialog, _Component);
function AreaSelectDialog(props) {
var _props$initValues;
var _this;
_this = _Component.call(this, props) || this;
_this.dialogConfirm = function () {
var codeList = _this.state.codeList;
_this.props.onOk(codeList);
};
_this.handleChange = function (codeList) {
_this.setState({
codeList: codeList
});
};
_this.state = {
codeList: (props === null || props === void 0 ? void 0 : (_props$initValues = props.initValues) === null || _props$initValues === void 0 ? void 0 : _props$initValues.map(function (item) {
return item.code;
})) || []
};
return _this;
}
var _proto = AreaSelectDialog.prototype;
_proto.render = function render() {
var _this$props = this.props,
dialogVisible = _this$props.dialogVisible,
onClose = _this$props.onClose,
title = _this$props.title,
initValues = _this$props.initValues,
areaApiUrl = _this$props.areaApiUrl,
areaApi = _this$props.areaApi;
return /*#__PURE__*/React.createElement(_Dialog, {
visible: dialogVisible,
onClose: onClose,
onOk: this.dialogConfirm,
onCancel: onClose,
title: title,
className: "aliretail-servicearea-areaSelectDialog"
}, /*#__PURE__*/React.createElement(AreaSelect, {
handleChange: this.handleChange,
areaApiUrl: areaApiUrl,
areaApi: areaApi,
initValues: initValues
}));
};
return AreaSelectDialog;
}(Component);
AreaSelectDialog.propTypes = {
dialogVisible: PropTypes.bool,
onClose: PropTypes.func,
onOk: PropTypes.func,
title: PropTypes.string
};
AreaSelectDialog.defaultProps = {
dialogVisible: false,
onClose: function onClose() {},
onOk: function onOk() {},
title: '',
appCode: 'retailforce_oms_pro',
areaApi: 'list_town_cover_info',
areaApiUrl: ''
};
export default AreaSelectDialog;