1 | "use strict";
|
2 |
|
3 | Object.defineProperty(exports, "__esModule", {
|
4 | value: true
|
5 | });
|
6 | exports["default"] = void 0;
|
7 |
|
8 | var _react = _interopRequireDefault(require("react"));
|
9 |
|
10 | var _propTypes = _interopRequireDefault(require("prop-types"));
|
11 |
|
12 | var _reactLifecyclesCompat = require("react-lifecycles-compat");
|
13 |
|
14 | var _rcTabs = _interopRequireWildcard(require("rc-tabs"));
|
15 |
|
16 | var _TabContent = _interopRequireDefault(require("rc-tabs/lib/TabContent"));
|
17 |
|
18 | var _ScrollableInkTabBar = _interopRequireDefault(require("rc-tabs/lib/ScrollableInkTabBar"));
|
19 |
|
20 | var _DocumentComponents = _interopRequireDefault(require("./DocumentComponents"));
|
21 |
|
22 | var _FixedComponents = _interopRequireDefault(require("./FixedComponents"));
|
23 |
|
24 | var _SubjectComponents = _interopRequireDefault(require("./SubjectComponents"));
|
25 |
|
26 | var _AuxiliaryComponents = _interopRequireDefault(require("./AuxiliaryComponents"));
|
27 |
|
28 | var _FunctionComponents = _interopRequireDefault(require("./FunctionComponents"));
|
29 |
|
30 | function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; return newObj; } }
|
31 |
|
32 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
33 |
|
34 | function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
35 |
|
36 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
37 |
|
38 | function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
39 |
|
40 | function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
41 |
|
42 | function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
43 |
|
44 | function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
45 |
|
46 | function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
47 |
|
48 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
49 |
|
50 | function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
51 |
|
52 | var TabsComponents =
|
53 |
|
54 | function (_React$Component) {
|
55 | _inherits(TabsComponents, _React$Component);
|
56 |
|
57 | function TabsComponents(props) {
|
58 | var _this;
|
59 |
|
60 | _classCallCheck(this, TabsComponents);
|
61 |
|
62 | _this = _possibleConstructorReturn(this, _getPrototypeOf(TabsComponents).call(this, props));
|
63 | _this.onChange = _this.onChange.bind(_assertThisInitialized(_this));
|
64 | _this.state = {
|
65 | activeKey: _this.props.activeKey
|
66 | };
|
67 | return _this;
|
68 | }
|
69 |
|
70 |
|
71 |
|
72 |
|
73 |
|
74 |
|
75 |
|
76 | _createClass(TabsComponents, [{
|
77 | key: "onChange",
|
78 | value: function onChange(activeKey) {
|
79 | this.setState({
|
80 | activeKey: activeKey
|
81 | });
|
82 | this.props.onDesc();
|
83 | }
|
84 | }, {
|
85 | key: "render",
|
86 | value: function render() {
|
87 | var _this2 = this;
|
88 |
|
89 | var _this$props = this.props,
|
90 | prefixCls = _this$props.prefixCls,
|
91 | tabs = _this$props.tabs,
|
92 | DocumentTreeData = _this$props.DocumentTreeData,
|
93 | ReferDataUrl = _this$props.ReferDataUrl,
|
94 | fixedData = _this$props.fixedData,
|
95 | SubjectData = _this$props.SubjectData,
|
96 | onDesc = _this$props.onDesc,
|
97 | FunctionData = _this$props.FunctionData;
|
98 |
|
99 | return _react["default"].createElement(_rcTabs["default"], {
|
100 | prefixCls: prefixCls,
|
101 | defaultActiveKey: this.state.activeKey,
|
102 | activeKey: this.state.activeKey,
|
103 | onChange: this.onChange,
|
104 | renderTabBar: function renderTabBar() {
|
105 | return _react["default"].createElement(_ScrollableInkTabBar["default"], null);
|
106 | },
|
107 | renderTabContent: function renderTabContent() {
|
108 | return _react["default"].createElement(_TabContent["default"], null);
|
109 | }
|
110 | }, tabs.map(function (item) {
|
111 | var Component = item.component;
|
112 | var props = {
|
113 | onInsertValue: _this2.props.onInsertValue,
|
114 | ReferDataUrl: ReferDataUrl,
|
115 | fixedData: fixedData,
|
116 | onDesc: onDesc,
|
117 | DocumentTreeData: DocumentTreeData,
|
118 | SubjectData: SubjectData,
|
119 | FunctionData: FunctionData
|
120 | };
|
121 |
|
122 | if (typeof item.component === 'string') {
|
123 | if (item.component === 'Document') {
|
124 | Component = _DocumentComponents["default"];
|
125 | } else if (item.component === 'Fixed') {
|
126 | Component = _FixedComponents["default"];
|
127 | } else if (item.component === 'Subject') {
|
128 | Component = _SubjectComponents["default"];
|
129 | } else if (item.component === 'Auxiliary') {
|
130 | Component = _AuxiliaryComponents["default"];
|
131 | } else if (item.component === 'Function') {
|
132 | Component = _FunctionComponents["default"];
|
133 | }
|
134 | }
|
135 |
|
136 | return _react["default"].createElement(_rcTabs.TabPane, {
|
137 | key: item.id,
|
138 | tab: item.name,
|
139 | disabled: item.disabled
|
140 | }, _react["default"].createElement(Component, _extends({}, props, {
|
141 | item: item
|
142 | })));
|
143 | }));
|
144 | }
|
145 | }]);
|
146 |
|
147 | return TabsComponents;
|
148 | }(_react["default"].Component);
|
149 |
|
150 | TabsComponents.propTypes = {
|
151 | prefixCls: _propTypes["default"].string,
|
152 | tabs: _propTypes["default"].array,
|
153 | activeKey: _propTypes["default"].string,
|
154 | ReferDataUrl: _propTypes["default"].string
|
155 | };
|
156 | TabsComponents.defaultProps = {
|
157 | prefixCls: 'rc-tabs',
|
158 | tabs: [],
|
159 | activeKey: '0',
|
160 | ReferDataUrl: ''
|
161 | };
|
162 | (0, _reactLifecyclesCompat.polyfill)(TabsComponents);
|
163 | var _default = TabsComponents;
|
164 | exports["default"] = _default; |
\ | No newline at end of file |