@titaui/pc 1.11.17-beta.1 → 1.11.19

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.
Files changed (50) hide show
  1. package/lib/components/avatar/name-avatar/index.css +0 -1
  2. package/lib/components/avatar/name-avatar/index.js +13 -22
  3. package/lib/components/button/rect-btn/index.css +11 -25
  4. package/lib/components/button/rect-btn/index.js +4 -8
  5. package/lib/components/communication/index.js +30 -29
  6. package/lib/components/create-okr-modal/request-api.js +1 -1
  7. package/lib/components/drawer/headerAction.js +1 -5
  8. package/lib/components/drawer/headerDrop.js +4 -41
  9. package/lib/components/drawer/index.css +0 -44
  10. package/lib/components/drawer/index.js +7 -36
  11. package/lib/components/mblog/index.js +31 -30
  12. package/lib/components/nav-top/index.js +2 -6
  13. package/lib/components/okr-detail/base-info/other-infos/date-cycle/index.js +4 -16
  14. package/lib/components/okr-detail/base-info/other-infos/principal/index.js +1 -9
  15. package/lib/components/okr-detail/components/header/index.js +3 -9
  16. package/lib/components/okr-detail/components/header/o-name.js +3 -9
  17. package/lib/components/okr-detail/components/o-classify.js +1 -5
  18. package/lib/components/okr-detail/components/okr-tree/tree-node/kr-node/index.js +6 -9
  19. package/lib/components/okr-detail/detail-header/index.js +1 -12
  20. package/lib/components/okr-detail/index.js +2 -21
  21. package/lib/components/okr-detail/okr-list/index.js +3 -8
  22. package/lib/components/okr-detail/request-apis.js +1 -7
  23. package/lib/components/okr-flow/child-node/index.css +2 -1
  24. package/lib/components/okr-flow/utils/index.js +5 -6
  25. package/lib/components/okr-period-selector/select-cycle.js +19 -23
  26. package/lib/components/period-selector/index.css +6 -0
  27. package/lib/components/period-selector/index.js +1 -1
  28. package/lib/components/scroll-container/index.js +423 -0
  29. package/lib/components/scroll-container/style.css +35 -0
  30. package/lib/components/superset-charts/components/chart/index.js +1 -1
  31. package/lib/index.js +8 -40
  32. package/lib/pages/new-okr-list/header/index.css +0 -45
  33. package/lib/pages/new-okr-list/header/index.js +16 -38
  34. package/lib/pages/new-okr-list/index.js +1 -3
  35. package/lib/pages/new-okr-list/list/index.js +2 -19
  36. package/lib/pages/new-okr-list/request-api.js +2 -8
  37. package/lib/pages/okr-map/export-modules/okr-map/header/index.css +1 -1
  38. package/lib/pages/okr-map/export-modules/okr-map/header/index.js +2 -2
  39. package/lib/pages/okr-map/export-modules/share-okr-page/header/index.css +24 -12
  40. package/lib/pages/okr-map/export-modules/share-okr-page/header/index.js +51 -11
  41. package/lib/pages/okr-map/export-modules/share-okr-page/share-okr-map.js +20 -12
  42. package/lib/utils/format-time.js +1 -8
  43. package/lib/utils/open-data.js +1 -5
  44. package/package.json +2 -1
  45. package/lib/components/okr-detail/detail-header/constant.js +0 -53
  46. package/lib/components/okr-detail/helper.js +0 -62
  47. package/lib/components/textarea/index.css +0 -120
  48. package/lib/components/textarea/index.js +0 -257
  49. package/lib/pages/new-okr-list/header/common.js +0 -52
  50. package/lib/pages/new-okr-list/header/operate-record.js +0 -124
@@ -29,10 +29,9 @@ exports.nodeTypes = nodeTypes;
29
29
 
30
30
  var getLayoutedElements = function getLayoutedElements(elements) {
31
31
  var direction = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "horizontal";
32
- var isHorizontal = direction === "horizontal";
33
- var g = new _dagre["default"].graphlib.Graph({
34
- compound: true
35
- });
32
+ var isHorizontal = direction === "horizontal"; // const g = new dagre.graphlib.Graph({compound: true });
33
+
34
+ var g = new _dagre["default"].graphlib.Graph();
36
35
  g.setGraph({
37
36
  rankdir: isHorizontal ? "LR" : "TB",
38
37
  nodesep: 12,
@@ -70,8 +69,8 @@ var getLayoutedElements = function getLayoutedElements(elements) {
70
69
  targetPosition: isHorizontal ? "left" : "top",
71
70
  sourcePosition: isHorizontal ? "right" : "bottom",
72
71
  position: {
73
- x: node.x - node.width / 2,
74
- y: node.y - node.height / 2
72
+ x: node ? (node === null || node === void 0 ? void 0 : node.x) - (node === null || node === void 0 ? void 0 : node.width) / 2 : 0,
73
+ y: node ? (node === null || node === void 0 ? void 0 : node.y) - (node === null || node === void 0 ? void 0 : node.height) / 2 : 0
75
74
  }
76
75
  });
77
76
  }
@@ -49,7 +49,7 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
49
49
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
50
50
 
51
51
  function _formatCycleData(periodParams, getCycleRange) {
52
- if (!periodParams) return '';
52
+ if (!periodParams) return "";
53
53
  var startDate = periodParams.startDate;
54
54
  var endDate = periodParams.endDate;
55
55
 
@@ -58,7 +58,7 @@ function _formatCycleData(periodParams, getCycleRange) {
58
58
  endDate = periodParams.endDate.slice(5);
59
59
  }
60
60
 
61
- return "".concat(_periodSelector["default"].formatPeriod(periodParams)).concat(getCycleRange ? ",".concat(startDate, "~").concat(endDate) : '');
61
+ return "".concat(_periodSelector["default"].formatPeriod(periodParams)).concat(getCycleRange ? ",".concat(startDate, "~").concat(endDate) : "");
62
62
  }
63
63
 
64
64
  function CreateCycle(_ref) {
@@ -94,21 +94,21 @@ function CreateCycle(_ref) {
94
94
  setCycleSetting = _useState4[1];
95
95
 
96
96
  (0, _react.useEffect)(function () {
97
- var settings = localStorage.getItem('OKR_CYCLE_SETTING');
97
+ var settings = localStorage.getItem("OKR_CYCLE_SETTING");
98
98
 
99
99
  if (settings) {
100
100
  setCycleSetting(JSON.parse(settings));
101
101
  return;
102
102
  }
103
103
 
104
- var url = (0, _helper.getApiUrl)('okr/cycleSetting');
105
- (0, _helper.taker)(url, 'GET').then(function (res) {
104
+ var url = (0, _helper.getApiUrl)("okr/cycleSetting");
105
+ (0, _helper.taker)(url, "GET").then(function (res) {
106
106
  if (res.Code == 1) {
107
107
  setCycleSetting(res.Data);
108
108
  }
109
109
  });
110
110
  }, []);
111
- var cycleWrapperRef = (0, _react.useRef)(document.createElement('div'));
111
+ var cycleWrapperRef = (0, _react.useRef)(document.createElement("div"));
112
112
 
113
113
  var onPeriodSelectorChangeHandler = function onPeriodSelectorChangeHandler(c) {
114
114
  setSelfCycle(_objectSpread(_objectSpread({}, selfCycle), c));
@@ -148,13 +148,13 @@ function CreateCycle(_ref) {
148
148
  },
149
149
  ref: cycleWrapperRef,
150
150
  style: {
151
- backgroundColor: 'white',
152
- boxShadow: '0px 4px 12px 0px rgb(127 145 180 / 20%)',
151
+ backgroundColor: "white",
152
+ boxShadow: "0px 4px 12px 0px rgb(127 145 180 / 20%)",
153
153
  borderRadius: 4
154
154
  }
155
155
  }, /*#__PURE__*/_react["default"].createElement(_periodSelector["default"], {
156
156
  style: {
157
- width: '100%'
157
+ width: "100%"
158
158
  },
159
159
  selected: selfCycle,
160
160
  showFullCycle: false,
@@ -176,9 +176,9 @@ function CreateCycle(_ref) {
176
176
  }))), /*#__PURE__*/_react["default"].createElement("div", {
177
177
  className: "okr-detail-date-cycle__date-line",
178
178
  style: {
179
- borderBottom: '1px solid #F0F2F5'
179
+ borderBottom: "1px solid #F0F2F5"
180
180
  }
181
- }, (0, _getLocale.getLocale)('Mod_StartDate'), "\uFF1A", /*#__PURE__*/_react["default"].createElement(_rangePickerPop["default"], {
181
+ }, (0, _getLocale.getLocale)("Mod_StartDate"), "\uFF1A", /*#__PURE__*/_react["default"].createElement(_rangePickerPop["default"], {
182
182
  format: "YYYY/MM/DD",
183
183
  controlled: true,
184
184
  onConfirm: onStartDateConfirmHandler,
@@ -193,7 +193,7 @@ function CreateCycle(_ref) {
193
193
  className: "tu-icon-arrow-down okr-detail-date-cycle__select-time-down-icon"
194
194
  })))), /*#__PURE__*/_react["default"].createElement("div", {
195
195
  className: "okr-detail-date-cycle__date-line"
196
- }, (0, _getLocale.getLocale)('Mod_EndDate'), "\uFF1A", /*#__PURE__*/_react["default"].createElement(_rangePickerPop["default"], {
196
+ }, (0, _getLocale.getLocale)("Mod_EndDate"), "\uFF1A", /*#__PURE__*/_react["default"].createElement(_rangePickerPop["default"], {
197
197
  format: "YYYY/MM/DD",
198
198
  controlled: true,
199
199
  onConfirm: onEndDateCOnfirmHandler,
@@ -208,8 +208,8 @@ function CreateCycle(_ref) {
208
208
  className: "tu-icon-arrow-down okr-detail-date-cycle__select-time-down-icon"
209
209
  })))), /*#__PURE__*/_react["default"].createElement("div", {
210
210
  style: {
211
- display: 'flex',
212
- justifyContent: 'flex-end'
211
+ display: "flex",
212
+ justifyContent: "flex-end"
213
213
  }
214
214
  }, /*#__PURE__*/_react["default"].createElement(_titaUi.Button, {
215
215
  size: "s",
@@ -217,15 +217,15 @@ function CreateCycle(_ref) {
217
217
  marginRight: 12
218
218
  },
219
219
  onClick: onCancelClickHandler
220
- }, (0, _getLocale.getLocale)('Mod_Cancel')), /*#__PURE__*/_react["default"].createElement(_titaUi.Button, {
220
+ }, (0, _getLocale.getLocale)("Mod_Cancel")), /*#__PURE__*/_react["default"].createElement(_titaUi.Button, {
221
221
  size: "s",
222
222
  type: "primary",
223
223
  onClick: onSureClickHandler
224
- }, (0, _getLocale.getLocale)('OKR_MyO_Butt_Determine'))));
224
+ }, (0, _getLocale.getLocale)("OKR_MyO_Butt_Determine"))));
225
225
  } else {
226
- return canEdit ? /*#__PURE__*/_react["default"].createElement(_periodSelector["default"], {
226
+ return /*#__PURE__*/_react["default"].createElement(_periodSelector["default"], {
227
227
  style: {
228
- width: '100%'
228
+ width: "100%"
229
229
  },
230
230
  selected: cycle,
231
231
  showFullCycle: false,
@@ -245,11 +245,7 @@ function CreateCycle(_ref) {
245
245
  btnRef: btnRef,
246
246
  clickCallback: function clickCallback() {},
247
247
  text: _formatCycleData(cycle, getCycleRange)
248
- })) : renderInnerContent({
249
- btnRef: btnRef,
250
- clickCallback: function clickCallback() {},
251
- text: _formatCycleData(cycle, getCycleRange)
252
- });
248
+ }));
253
249
  }
254
250
  }
255
251
 
@@ -2,6 +2,12 @@
2
2
  display: inline-block;
3
3
  }
4
4
 
5
+ .titaui-period-selector__down-icon {
6
+ font-size: 16px;
7
+ transform: scale(0.5);
8
+ margin-left: 4px;
9
+ }
10
+
5
11
  .titaui-period-selector__down-arrow {
6
12
  display: inline-block;
7
13
  vertical-align: baseline;
@@ -189,7 +189,7 @@ function PeriodSelector(_ref) {
189
189
  whiteSpace: "nowrap"
190
190
  }
191
191
  }, (0, _common.formatPeriod)(selectedPeriod)), /*#__PURE__*/_react["default"].createElement("span", {
192
- className: "titaui-period-selector__down-arrow"
192
+ className: "tu-icon-caret-down titaui-period-selector__down-icon"
193
193
  })))));
194
194
  }
195
195
 
@@ -0,0 +1,423 @@
1
+ "use strict";
2
+
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports["default"] = void 0;
9
+
10
+ var _react = _interopRequireWildcard(require("react"));
11
+
12
+ var _classnames = _interopRequireDefault(require("classnames"));
13
+
14
+ var _lodash = require("lodash");
15
+
16
+ var _easyBem = _interopRequireDefault(require("easy-bem"));
17
+
18
+ require("./style.css");
19
+
20
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
21
+
22
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
23
+
24
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
25
+
26
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
27
+
28
+ 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); } }
29
+
30
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
31
+
32
+ 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 } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
33
+
34
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
35
+
36
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
37
+
38
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
39
+
40
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
41
+
42
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
43
+
44
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
45
+
46
+ var cn = (0, _easyBem["default"])('indiana-scroll-container');
47
+ var SCROLL_END_DEBOUNCE = 300;
48
+ var LEFT_BUTTON = 0;
49
+
50
+ var ScrollContainer = /*#__PURE__*/function (_PureComponent) {
51
+ _inherits(ScrollContainer, _PureComponent);
52
+
53
+ var _super = _createSuper(ScrollContainer);
54
+
55
+ function ScrollContainer(props) {
56
+ var _this;
57
+
58
+ _classCallCheck(this, ScrollContainer);
59
+
60
+ _this = _super.call(this, props);
61
+
62
+ _this.onEndScroll = function () {
63
+ _this.scrolling = false;
64
+
65
+ if (!_this.pressed && _this.started) {
66
+ _this.processEnd();
67
+ }
68
+ };
69
+
70
+ _this.onScroll = function (e) {
71
+ var container = _this.container.current; // Ignore the internal scrolls
72
+
73
+ if (container.scrollLeft !== _this.scrollLeft || container.scrollTop !== _this.scrollTop) {
74
+ _this.scrolling = true;
75
+
76
+ _this.processScroll(e);
77
+
78
+ _this.onEndScroll();
79
+ }
80
+ };
81
+
82
+ _this.onTouchStart = function (e) {
83
+ var nativeMobileScroll = _this.props.nativeMobileScroll;
84
+
85
+ if (_this.isDraggable(e.target)) {
86
+ _this.internal = true;
87
+
88
+ if (nativeMobileScroll && _this.scrolling) {
89
+ _this.pressed = true;
90
+ } else {
91
+ var touch = e.touches[0];
92
+
93
+ _this.processClick(e, touch.clientX, touch.clientY);
94
+
95
+ if (!nativeMobileScroll && _this.props.stopPropagation) {
96
+ e.stopPropagation();
97
+ }
98
+ }
99
+ }
100
+ };
101
+
102
+ _this.onTouchEnd = function (e) {
103
+ var nativeMobileScroll = _this.props.nativeMobileScroll;
104
+
105
+ if (_this.pressed) {
106
+ if (_this.started && (!_this.scrolling || !nativeMobileScroll)) {
107
+ _this.processEnd();
108
+ } else {
109
+ _this.pressed = false;
110
+ }
111
+
112
+ _this.forceUpdate();
113
+ }
114
+ };
115
+
116
+ _this.onTouchMove = function (e) {
117
+ var nativeMobileScroll = _this.props.nativeMobileScroll;
118
+
119
+ if (_this.pressed && (!nativeMobileScroll || !_this.isMobile)) {
120
+ var touch = e.touches[0];
121
+
122
+ if (touch) {
123
+ _this.processMove(e, touch.clientX, touch.clientY);
124
+ } // e.preventDefault(); // 处理无法拖动选中文字的问题,先屏蔽禁止默认事件
125
+
126
+
127
+ if (_this.props.stopPropagation) {
128
+ e.stopPropagation();
129
+ }
130
+ }
131
+ };
132
+
133
+ _this.onMouseDown = function (e) {
134
+ if (_this.isDraggable(e.target) && _this.isScrollable()) {
135
+ _this.internal = true;
136
+
137
+ if (_this.props.buttons.indexOf(e.button) !== -1) {
138
+ _this.processClick(e, e.clientX, e.clientY); // e.preventDefault();
139
+
140
+
141
+ if (_this.props.stopPropagation) {
142
+ e.stopPropagation();
143
+ }
144
+ }
145
+ }
146
+ };
147
+
148
+ _this.onMouseMove = function (e) {
149
+ if (_this.pressed) {
150
+ _this.processMove(e, e.clientX, e.clientY); // e.preventDefault();
151
+
152
+
153
+ if (_this.props.stopPropagation) {
154
+ e.stopPropagation();
155
+ }
156
+ }
157
+ };
158
+
159
+ _this.onMouseUp = function (e) {
160
+ if (_this.pressed) {
161
+ if (_this.started) {
162
+ _this.processEnd();
163
+ } else {
164
+ _this.internal = false;
165
+ _this.pressed = false;
166
+
167
+ _this.forceUpdate();
168
+
169
+ if (_this.props.onClick) {
170
+ _this.props.onClick(e);
171
+ }
172
+ } // e.preventDefault();
173
+
174
+
175
+ if (_this.props.stopPropagation) {
176
+ e.stopPropagation();
177
+ }
178
+ }
179
+ };
180
+
181
+ _this.container = /*#__PURE__*/_react["default"].createRef();
182
+ _this.onEndScroll = (0, _lodash.debounce)(_this.onEndScroll, SCROLL_END_DEBOUNCE); // Is container scrolling now (for example by inertia)
183
+
184
+ _this.scrolling = false; // Is scrolling started
185
+
186
+ _this.started = false; // Is touch active or mouse pressed down
187
+
188
+ _this.pressed = false; // Is event internal
189
+
190
+ _this.internal = false; // Bind callbacks
191
+
192
+ _this.getRef = _this.getRef.bind(_assertThisInitialized(_this));
193
+ return _this;
194
+ }
195
+
196
+ _createClass(ScrollContainer, [{
197
+ key: "componentDidMount",
198
+ value: function componentDidMount() {
199
+ var nativeMobileScroll = this.props.nativeMobileScroll;
200
+ var container = this.container.current;
201
+ window.addEventListener('mouseup', this.onMouseUp, {
202
+ capture: true
203
+ });
204
+ window.addEventListener('mousemove', this.onMouseMove, {
205
+ capture: true
206
+ });
207
+ window.addEventListener('touchmove', this.onTouchMove, {
208
+ passive: false,
209
+ capture: true
210
+ });
211
+ window.addEventListener('touchend', this.onTouchEnd, {
212
+ capture: true
213
+ }); // due to https://github.com/facebook/react/issues/9809#issuecomment-414072263
214
+
215
+ container.addEventListener('touchstart', this.onTouchStart, {
216
+ passive: false
217
+ });
218
+ container.addEventListener('mousedown', this.onMouseDown, {
219
+ passive: false
220
+ });
221
+
222
+ if (nativeMobileScroll) {
223
+ // We should check if it's the mobile device after page was loaded
224
+ // to prevent breaking SSR
225
+ this.isMobile = this.isMobileDevice(); // If it's the mobile device, we should rerender to change styles
226
+
227
+ if (this.isMobile) {
228
+ this.forceUpdate();
229
+ }
230
+ }
231
+ }
232
+ }, {
233
+ key: "componentWillUnmount",
234
+ value: function componentWillUnmount() {
235
+ window.removeEventListener('mouseup', this.onMouseUp);
236
+ window.removeEventListener('mousemove', this.onMouseMove);
237
+ window.removeEventListener('touchmove', this.onTouchMove);
238
+ window.removeEventListener('touchend', this.onTouchEnd);
239
+ }
240
+ }, {
241
+ key: "getElement",
242
+ value: function getElement() {
243
+ return this.container.current;
244
+ }
245
+ }, {
246
+ key: "isMobileDevice",
247
+ value: function isMobileDevice() {
248
+ return typeof window.orientation !== 'undefined' || navigator.userAgent.indexOf('IEMobile') !== -1;
249
+ }
250
+ }, {
251
+ key: "isDraggable",
252
+ value: function isDraggable(target) {
253
+ var ignoreElements = this.props.ignoreElements;
254
+
255
+ if (ignoreElements) {
256
+ var closest = target.closest(ignoreElements);
257
+ return closest === null || closest.contains(this.getElement());
258
+ }
259
+
260
+ return true;
261
+ }
262
+ }, {
263
+ key: "isScrollable",
264
+ value: function isScrollable() {
265
+ var container = this.container.current;
266
+ return container && (container.scrollWidth > container.clientWidth || container.scrollHeight > container.clientHeight);
267
+ } // Simulate 'onEndScroll' event that fires when scrolling is stopped
268
+
269
+ }, {
270
+ key: "processClick",
271
+ value: function processClick(e, clientX, clientY) {
272
+ var container = this.container.current;
273
+ this.scrollLeft = container.scrollLeft;
274
+ this.scrollTop = container.scrollTop;
275
+ this.clientX = clientX;
276
+ this.clientY = clientY;
277
+ this.pressed = true;
278
+ }
279
+ }, {
280
+ key: "processStart",
281
+ value: function processStart() {
282
+ var changeCursor = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
283
+ var onStartScroll = this.props.onStartScroll;
284
+ this.started = true; // Add the class to change displayed cursor
285
+
286
+ if (changeCursor) {
287
+ document.body.classList.add('indiana-dragging');
288
+ }
289
+
290
+ if (onStartScroll) {
291
+ onStartScroll({
292
+ external: !this.internal
293
+ });
294
+ }
295
+
296
+ this.forceUpdate();
297
+ } // Process native scroll (scrollbar, mobile scroll)
298
+
299
+ }, {
300
+ key: "processScroll",
301
+ value: function processScroll(e) {
302
+ if (this.started) {
303
+ var onScroll = this.props.onScroll;
304
+
305
+ if (onScroll) {
306
+ onScroll({
307
+ external: !this.internal
308
+ });
309
+ }
310
+ } else {
311
+ this.processStart(false);
312
+ }
313
+ } // Process non-native scroll
314
+
315
+ }, {
316
+ key: "processMove",
317
+ value: function processMove(e, newClientX, newClientY) {
318
+ var _this$props = this.props,
319
+ horizontal = _this$props.horizontal,
320
+ vertical = _this$props.vertical,
321
+ activationDistance = _this$props.activationDistance,
322
+ onScroll = _this$props.onScroll;
323
+ var container = this.container.current;
324
+
325
+ if (!this.started) {
326
+ if (horizontal && Math.abs(newClientX - this.clientX) > activationDistance || vertical && Math.abs(newClientY - this.clientY) > activationDistance) {
327
+ this.clientX = newClientX;
328
+ this.clientY = newClientY;
329
+ this.processStart();
330
+ }
331
+ } else {
332
+ if (horizontal) {
333
+ container.scrollLeft -= newClientX - this.clientX;
334
+ }
335
+
336
+ if (vertical) {
337
+ container.scrollTop -= newClientY - this.clientY;
338
+ }
339
+
340
+ if (onScroll) {
341
+ onScroll({
342
+ external: !this.internal
343
+ });
344
+ }
345
+
346
+ this.clientX = newClientX;
347
+ this.clientY = newClientY;
348
+ this.scrollLeft = container.scrollLeft;
349
+ this.scrollTop = container.scrollTop;
350
+ }
351
+ }
352
+ }, {
353
+ key: "processEnd",
354
+ value: function processEnd() {
355
+ var onEndScroll = this.props.onEndScroll;
356
+ var container = this.container.current;
357
+
358
+ if (container && onEndScroll) {
359
+ onEndScroll({
360
+ external: !this.internal
361
+ });
362
+ }
363
+
364
+ this.pressed = false;
365
+ this.started = false;
366
+ this.scrolling = false;
367
+ this.internal = false;
368
+ document.body.classList.remove('indiana-dragging');
369
+ this.forceUpdate();
370
+ }
371
+ }, {
372
+ key: "getRef",
373
+ value: function getRef(el) {
374
+ ;
375
+ [this.container, this.props.innerRef].forEach(function (ref) {
376
+ if (ref) {
377
+ if (typeof ref === 'function') {
378
+ ref(el);
379
+ } else {
380
+ ;
381
+ ref.current = el;
382
+ }
383
+ }
384
+ });
385
+ }
386
+ }, {
387
+ key: "render",
388
+ value: function render() {
389
+ var _this$props2 = this.props,
390
+ children = _this$props2.children,
391
+ draggingClassName = _this$props2.draggingClassName,
392
+ className = _this$props2.className,
393
+ style = _this$props2.style,
394
+ hideScrollbars = _this$props2.hideScrollbars,
395
+ Component = _this$props2.component;
396
+ return /*#__PURE__*/_react["default"].createElement(Component, {
397
+ className: (0, _classnames["default"])(className, this.pressed && draggingClassName, cn({
398
+ dragging: this.pressed,
399
+ 'hide-scrollbars': hideScrollbars,
400
+ 'native-scroll': this.isMobile
401
+ })),
402
+ style: style,
403
+ ref: this.getRef,
404
+ onScroll: this.onScroll
405
+ }, children);
406
+ }
407
+ }]);
408
+
409
+ return ScrollContainer;
410
+ }(_react.PureComponent);
411
+
412
+ exports["default"] = ScrollContainer;
413
+ ScrollContainer.defaultProps = {
414
+ nativeMobileScroll: true,
415
+ hideScrollbars: true,
416
+ activationDistance: 10,
417
+ vertical: true,
418
+ horizontal: true,
419
+ stopPropagation: false,
420
+ style: {},
421
+ component: 'div',
422
+ buttons: [LEFT_BUTTON]
423
+ };
@@ -0,0 +1,35 @@
1
+ .indiana-scroll-container {
2
+ overflow: auto;
3
+ }
4
+
5
+ .indiana-scroll-container--dragging {
6
+ scroll-behavior: auto !important;
7
+ }
8
+
9
+ .indiana-scroll-container--dragging > * {
10
+ pointer-events: none;
11
+ cursor: grab;
12
+ }
13
+
14
+ .indiana-scroll-container--hide-scrollbars {
15
+ overflow: hidden;
16
+ overflow: -moz-scrollbars-none;
17
+ -ms-overflow-style: none;
18
+ scrollbar-width: none;
19
+ }
20
+
21
+ .indiana-scroll-container--hide-scrollbars::-webkit-scrollbar {
22
+ display: none !important;
23
+ height: 0 !important;
24
+ width: 0 !important;
25
+ background: transparent !important;
26
+ -webkit-appearance: none !important;
27
+ }
28
+
29
+ .indiana-scroll-container--native-scroll {
30
+ overflow: auto;
31
+ }
32
+
33
+ .indiana-dragging {
34
+ cursor: grab;
35
+ }
@@ -19,7 +19,7 @@ var Chart = function Chart(props) {
19
19
  // });
20
20
  // }, []);
21
21
  var Chart = (_window = window) === null || _window === void 0 ? void 0 : (_window$SupersetChart = _window.SupersetChart) === null || _window$SupersetChart === void 0 ? void 0 : _window$SupersetChart.SupersetChart;
22
- return /*#__PURE__*/_react["default"].createElement("div", null, Chart && /*#__PURE__*/_react["default"].createElement(Chart, props));
22
+ return Chart && /*#__PURE__*/_react["default"].createElement(Chart, props);
23
23
  };
24
24
 
25
25
  var _default = Chart;