1 | import _extends from "@babel/runtime/helpers/extends";
|
2 | import "core-js/modules/es6.object.assign";
|
3 | import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
4 | import _createClass from "@babel/runtime/helpers/createClass";
|
5 | import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
6 | import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
7 | import _inherits from "@babel/runtime/helpers/inherits";
|
8 | import React, { Component, PropTypes } from 'react';
|
9 | import { render } from 'react-dom';
|
10 | import ToolTip from '@beisen-platform/tool-tip';
|
11 | import CommonLabel from '@beisen-platform/common-label';
|
12 | import Input from './input';
|
13 | import List from './list';
|
14 |
|
15 | var Edit =
|
16 |
|
17 | function (_Component) {
|
18 | _inherits(Edit, _Component);
|
19 |
|
20 | function Edit(props) {
|
21 | var _this;
|
22 |
|
23 | _classCallCheck(this, Edit);
|
24 |
|
25 | _this = _possibleConstructorReturn(this, _getPrototypeOf(Edit).call(this, props));
|
26 |
|
27 | _this.getMountSize = function () {
|
28 | var width,
|
29 | height = 0,
|
30 | heightCalc,
|
31 | listHeight;
|
32 | _this.inputDom = _this.refs.input.refs.wrapper.getElementsByClassName('list_horizontal list_wrap form-item__multi-list lookupv2__select-list')[0] || _this.refs.input.refs.wrapper;
|
33 | width = _this.inputDom.offsetWidth;
|
34 | heightCalc = _this.props.setListHeight();
|
35 | return {
|
36 | width: width,
|
37 | height: heightCalc.listHeight,
|
38 | listHeight: heightCalc.itemHeight
|
39 | };
|
40 | };
|
41 |
|
42 | return _this;
|
43 | }
|
44 |
|
45 | _createClass(Edit, [{
|
46 | key: "componentDidUpdate",
|
47 | value: function componentDidUpdate(prevProps, prevState) {
|
48 | var props = Object.assign({}, this.props);
|
49 |
|
50 | if (props.disabled || props.readOnly || props.onlyShowAdvanced) {
|
51 | return;
|
52 | }
|
53 |
|
54 | var self = this;
|
55 |
|
56 | if (props.isShowDoropList && Array.isArray(props.listValue) || props.isShowDoropList && props.isFetching || props.isShowDoropList && (props.isNotAllow || props.isNotInstall)) {
|
57 | var _size = this.getMountSize();
|
58 |
|
59 | var dom = document.getElementsByClassName("BS_lookupV2__mountContainer")[0];
|
60 | var height = dom && dom.offsetHeight ? dom.offsetHeight : _size.height;
|
61 | if (!props.isFetching) height = _size.height;
|
62 | this.props.commonMount.renderDom('BS_lookupV2_container__' + this.props.uid, React.createElement(List, {
|
63 | listValue: props.listValue,
|
64 | listHeight: _size.listHeight,
|
65 | value: props.value,
|
66 | isNotAllow: props.isNotAllow,
|
67 | isNotInstall: props.isNotInstall,
|
68 | isFetching: props.isFetching,
|
69 | multiple: props.multiple,
|
70 | isShowFindAll: props.isShowFindAll,
|
71 | commonMount: props.commonMount,
|
72 | handlerFindAll: props.handlerFindAll,
|
73 | listClick: props.listClick,
|
74 | setComState: props.setComState,
|
75 | onChange: props.onChange
|
76 | }), self.inputDom, [self.inputDom, {
|
77 | width: 340,
|
78 | height: height
|
79 | }], false, 0,
|
80 | false,
|
81 | 100,
|
82 | props.lablePos ? 33 : 50);
|
83 | }
|
84 | }
|
85 | }, {
|
86 | key: "render",
|
87 | value: function render() {
|
88 | var props = Object.assign({}, this.props);
|
89 | return React.createElement("div", {
|
90 | className: "form-item form-item-lookupv2 "
|
91 | }, React.createElement(CommonLabel, this.props), React.createElement(Input, _extends({}, props, {
|
92 | handlerFindAll: props.handlerFindAll,
|
93 | setComState: props.setComState,
|
94 | ref: "input"
|
95 | })));
|
96 | }
|
97 | }]);
|
98 |
|
99 | return Edit;
|
100 | }(Component);
|
101 |
|
102 | Edit.defaultProps = {
|
103 | title: "",
|
104 | hiddenTip: false,
|
105 | sideTip: false,
|
106 | isFocus: false,
|
107 | helpMsg: '',
|
108 | required: true,
|
109 | listValue: null,
|
110 | value: ''
|
111 | };
|
112 | export { Edit as default }; |
\ | No newline at end of file |