app模板、应用模板、组件模板、widget模板
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

667 lines
92 KiB

4 years ago
  1. module.exports =
  2. /******/ (function(modules) { // webpackBootstrap
  3. /******/ // The module cache
  4. /******/ var installedModules = {};
  5. /******/
  6. /******/ // The require function
  7. /******/ function __webpack_require__(moduleId) {
  8. /******/
  9. /******/ // Check if module is in cache
  10. /******/ if(installedModules[moduleId]) {
  11. /******/ return installedModules[moduleId].exports;
  12. /******/ }
  13. /******/ // Create a new module (and put it into the cache)
  14. /******/ var module = installedModules[moduleId] = {
  15. /******/ i: moduleId,
  16. /******/ l: false,
  17. /******/ exports: {}
  18. /******/ };
  19. /******/
  20. /******/ // Execute the module function
  21. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  22. /******/
  23. /******/ // Flag the module as loaded
  24. /******/ module.l = true;
  25. /******/
  26. /******/ // Return the exports of the module
  27. /******/ return module.exports;
  28. /******/ }
  29. /******/
  30. /******/
  31. /******/ // expose the modules object (__webpack_modules__)
  32. /******/ __webpack_require__.m = modules;
  33. /******/
  34. /******/ // expose the module cache
  35. /******/ __webpack_require__.c = installedModules;
  36. /******/
  37. /******/ // define getter function for harmony exports
  38. /******/ __webpack_require__.d = function(exports, name, getter) {
  39. /******/ if(!__webpack_require__.o(exports, name)) {
  40. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  41. /******/ }
  42. /******/ };
  43. /******/
  44. /******/ // define __esModule on exports
  45. /******/ __webpack_require__.r = function(exports) {
  46. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  47. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  48. /******/ }
  49. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  50. /******/ };
  51. /******/
  52. /******/ // create a fake namespace object
  53. /******/ // mode & 1: value is a module id, require it
  54. /******/ // mode & 2: merge all properties of value into the ns
  55. /******/ // mode & 4: return value when already ns object
  56. /******/ // mode & 8|1: behave like require
  57. /******/ __webpack_require__.t = function(value, mode) {
  58. /******/ if(mode & 1) value = __webpack_require__(value);
  59. /******/ if(mode & 8) return value;
  60. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  61. /******/ var ns = Object.create(null);
  62. /******/ __webpack_require__.r(ns);
  63. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  64. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  65. /******/ return ns;
  66. /******/ };
  67. /******/
  68. /******/ // getDefaultExport function for compatibility with non-harmony modules
  69. /******/ __webpack_require__.n = function(module) {
  70. /******/ var getter = module && module.__esModule ?
  71. /******/ function getDefault() { return module['default']; } :
  72. /******/ function getModuleExports() { return module; };
  73. /******/ __webpack_require__.d(getter, 'a', getter);
  74. /******/ return getter;
  75. /******/ };
  76. /******/
  77. /******/ // Object.prototype.hasOwnProperty.call
  78. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  79. /******/
  80. /******/ // __webpack_public_path__
  81. /******/ __webpack_require__.p = "/dist/";
  82. /******/
  83. /******/
  84. /******/ // Load entry module and return exports
  85. /******/ return __webpack_require__(__webpack_require__.s = 586);
  86. /******/ })
  87. /************************************************************************/
  88. /******/ ({
  89. /***/ 114:
  90. /***/ (function(module) {
  91. module.exports = JSON.parse("{\"parkingApron\":{\"dimensions\":[\"Name\",\"Type\",\"Near Bridge\"],\"data\":[[\"AB94\",\"W\",true],[\"AB95\",\"W\",true],[\"AB96\",\"W\",true],[\"AB97\",\"W\",true],[\"AB98\",\"W\",true],[\"AS3\",\"W\",true],[\"AS4\",\"W\",true],[\"AS5\",\"W\",true],[\"AS6\",\"W\",true],[\"AS7\",\"W\",true],[\"AS8\",\"W\",true],[\"A98\",\"U\",true],[\"HU\",\"W\",true],[\"HXK\",\"W\",true],[\"O85\",\"W\",true],[\"O86\",\"W\",true],[\"O87\",\"W\",true],[\"O88\",\"W\",true],[\"O89\",\"W\",true],[\"O90\",\"W\",true],[\"O91\",\"W\",true],[\"O92\",\"W\",true],[\"O93\",\"X\",true],[\"O94\",\"W\",true],[\"O95\",\"W\",true],[\"O96\",\"W\",true],[\"O97\",\"W\",true],[\"O98\",\"W\",true],[\"S97\",\"W\",true],[\"S98\",\"W\",true],[\"WA94\",\"W\",true],[\"WA95\",\"W\",true],[\"WA96\",\"W\",true],[\"WA97\",\"W\",true],[\"WA98\",\"W\",true],[\"WA\",\"W\",true],[\"XA5\",\"W\",true],[\"XA6\",\"W\",true],[\"XA7\",\"W\",true],[\"XA8\",\"W\",true],[\"00\",\"X\",true],[\"01\",\"X\",true],[\"03\",\"X\",true],[\"04\",\"X\",true],[\"05\",\"X\",true],[\"06\",\"Y\",true],[\"07\",\"X\",true],[\"08\",\"X\",true],[\"09\",\"X\",true],[\"10\",\"X\",true],[\"11\",\"X\",true],[\"12\",\"Y\",true],[\"13\",\"X\",true],[\"21\",\"X\",true],[\"23\",\"W\",true],[\"25\",\"W\",true],[\"27\",\"X\",true],[\"29\",\"W\",true],[\"30\",\"W\",true],[\"31\",\"X\",true],[\"32\",\"W\",true],[\"33\",\"W\",true],[\"34\",\"X\",true],[\"35\",\"W\",true],[\"36\",\"X\",true],[\"37\",\"X\",true],[\"38\",\"X\",true],[\"39\",\"X\",true],[\"40\",\"W\",true],[\"41\",\"X\",true],[\"42\",\"X\",true],[\"43\",\"X\",true],[\"44\",\"X\",true],[\"45\",\"W\",true],[\"46\",\"W\",true],[\"47\",\"W\",true],[\"483\",\"X\",true],[\"484\",\"X\",true],[\"485\",\"X\",true],[\"486\",\"X\",true],[\"487\",\"X\",true],[\"488\",\"X\",true],[\"489\",\"X\",true],[\"48\",\"W\",true],[\"490\",\"X\",true],[\"491\",\"X\",true],[\"492\",\"X\",true],[\"493\",\"X\",true],[\"494\",\"X\",true],[\"495\",\"X\",true],[\"496\",\"X\",true],[\"497\",\"X\",true],[\"498\",\"X\",true],[\"608\",\"X\",true],[\"609O\",\"W\",true],[\"609\",\"X\",true],[\"60\",\"X\",true],[\"61I\",\"X\",true],[\"61O\",\"X\",true],[\"610I\",\"W\",true],[\"610O\",\"W\",true],[\"610\",\"W\",true],[\"611O\",\"W\",true],[\"611\",\"X\",true],[\"612I\",\"W\",true],[\"612O\",\"W\",true],[\"612\",\"X\",true],[\"613\",\"X\",true],[\"614O\",\"W\",true],[\"614\",\"X\",true],[\"615I\",\"W\",true],[\"615O\",\"W\",true],[\"615\",\"X\",true],[\"616O\",\"W\",true],[\"616\",\"X\",true],[\"617I\",\"W\",true],[\"617O\",\"W\",true],[\"617\",\"X\",true],[\"618O\",\"W\",true],[\"618\",\"X\",true],[\"619I\",\"W\",true],[\"619O\",\"W\",true],[\"619\",\"X\",true],[\"61\",\"Y\",true],[\"623\",\"X\",true],[\"624\",\"X\",true],[\"625\",\"W\",true],[\"626\",\"X\",true],[\"627\",\"W\",true],[\"628\",\"X\",true],[\"629\",\"X\",true],[\"62\",\"X\",true],[\"63I\",\"X\",true],[\"630\",\"X\",true],[\"631\",\"X\",true],[\"632\",\"X\",true],[\"633\",\"X\",true],[\"634\",\"X\",true],[\"635\",\"X\",true],[\"636\",\"X\",true],[\"63\",\"Y\",true],[\"64\",\"X\",true],[\"65I\",\"W\",true],[\"65O\",\"W\",true],[\"65\",\"X\",true],[\"66I\",\"W\",true],[\"66O\",\"W\",true],[\"66\",\"X\",true],[\"67I\",\"W\",true],[\"67O\",\"W\",true],[\"67\",\"X\",true],[\"68\",\"X\",true],[\"69I\",\"X\",true],[\"69\",\"X\",true],[\"70I\",\"X\",true],[\"70O\",\"X\",true],[\"70\",\"W\",true],[\"71\",\"X\",true],[\"72I\",\"X\",true],[\"72O\",\"X\",true],[\"72\",\"W\",true],[\"73\",\"W\",true],[\"760\",\"W\",true],[\"761\",\"W\",true],[\"762\",\"W\",true],[\"763\",\"W\",true],[\"764\",\"X\",true],[\"765\",\"X\",true],[\"766\",\"X\",true],[\"767\",\"X\",true],[\"768\",\"X\",true],[\"769\",\"X\",true],[\"770\",\"X\",true],[\"771\",\"W\",true],[\"772\",\"X\",true],[\"773\",\"W\",true],[\"774\",\"W\",true],[\"775\",\"W\",true],[\"776\",\"X\",true],[\"777\",\"W\",true],[\"778\",\"W\",true],[\"779\",\"W\",true],[\"780\",\"X\",true],[\"781\",\"X\",true],[\"782\",\"X\",true],[\"783\",\"X\",true],[\"784\",\"X\",true],[\"785\",\"X\",true],[\"786\",\"X\",true],[\"787\",\"X\",true],[\"788\",\"X\",true],[\"
  92. /***/ }),
  93. /***/ 125:
  94. /***/ (function(module, exports) {
  95. module.exports = require("echarts");
  96. /***/ }),
  97. /***/ 586:
  98. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  99. "use strict";
  100. // ESM COMPAT FLAG
  101. __webpack_require__.r(__webpack_exports__);
  102. // EXTERNAL MODULE: external "echarts"
  103. var external_echarts_ = __webpack_require__(125);
  104. var external_echarts_default = /*#__PURE__*/__webpack_require__.n(external_echarts_);
  105. // EXTERNAL MODULE: ./packages/c-gantt/raw-data.json
  106. var raw_data = __webpack_require__(114);
  107. // CONCATENATED MODULE: ./packages/c-gantt/main.js
  108. // let ROOT_PATH = 'https://cdn.jsdelivr.net/gh/apache/echarts-website@asf-site/examples';
  109. var HEIGHT_RATIO = 0.6;
  110. var DIM_CATEGORY_INDEX = 0;
  111. var DIM_TIME_ARRIVAL = 1;
  112. var DIM_TIME_DEPARTURE = 2;
  113. var DATA_ZOOM_AUTO_MOVE_THROTTLE = 30;
  114. var DATA_ZOOM_X_INSIDE_INDEX = 1;
  115. var DATA_ZOOM_Y_INSIDE_INDEX = 3;
  116. var DATA_ZOOM_AUTO_MOVE_SPEED = 0.2;
  117. var DATA_ZOOM_AUTO_MOVE_DETECT_AREA_WIDTH = 30;
  118. var _draggable = void 0;
  119. var _draggingEl = void 0;
  120. var _dropShadow = void 0;
  121. var _draggingCursorOffset = [0, 0];
  122. var _draggingTimeLength = void 0;
  123. var _draggingRecord = void 0;
  124. var _dropRecord = void 0;
  125. var _cartesianXBounds = [];
  126. var _cartesianYBounds = [];
  127. // let _rawData;
  128. var _autoDataZoomAnimator = void 0;
  129. // $.get(ROOT_PATH + '/data/asset/data/airport-schedule.json', function (rawData) {
  130. // _rawData = rawData;
  131. // this.myChart.setOption(option = makeOption());
  132. // initDrag();
  133. // });
  134. // _rawData = rawData;
  135. /* harmony default export */ var main = ({
  136. name: 've-gantt',
  137. props: {
  138. width: { type: String, default: '100%' },
  139. height: { type: String, default: '100%' },
  140. options: { type: Object, default: null }
  141. },
  142. data: function data() {
  143. return {
  144. myChart: null
  145. };
  146. },
  147. mounted: function mounted() {
  148. // let chartDom = document.getElementById('main');
  149. this.myChart = external_echarts_default.a.init(this.$refs.ganttContainer);
  150. var option = void 0;
  151. this.myChart.setOption(option = this.makeOption());
  152. this.initDrag();
  153. option && this.myChart.setOption(option);
  154. },
  155. methods: {
  156. initDrag: function initDrag() {
  157. var _this = this;
  158. _autoDataZoomAnimator = makeAnimator(dispatchDataZoom);
  159. this.myChart.on('mousedown', function (param) {
  160. if (!_draggable || !param || param.seriesIndex == null) {
  161. return;
  162. }
  163. // Drag start
  164. _draggingRecord = {
  165. dataIndex: param.dataIndex,
  166. categoryIndex: param.value[DIM_CATEGORY_INDEX],
  167. timeArrival: param.value[DIM_TIME_ARRIVAL],
  168. timeDeparture: param.value[DIM_TIME_DEPARTURE]
  169. };
  170. var style = { lineWidth: 2, fill: 'rgba(255,0,0,0.1)', stroke: 'rgba(255,0,0,0.8)', lineDash: [6, 3] };
  171. _draggingEl = addOrUpdateBar(_draggingEl, _draggingRecord, style, 100);
  172. _draggingCursorOffset = [_draggingEl.position[0] - param.event.offsetX, _draggingEl.position[1] - param.event.offsetY];
  173. _draggingTimeLength = _draggingRecord.timeDeparture - _draggingRecord.timeArrival;
  174. });
  175. this.myChart.getZr().on('mousemove', function (event) {
  176. if (!_draggingEl) {
  177. return;
  178. }
  179. var cursorX = event.offsetX;
  180. var cursorY = event.offsetY;
  181. // Move _draggingEl.
  182. _draggingEl.attr('position', [_draggingCursorOffset[0] + cursorX, _draggingCursorOffset[1] + cursorY]);
  183. prepareDrop();
  184. autoDataZoomWhenDraggingOutside(cursorX, cursorY);
  185. });
  186. this.myChart.getZr().on('mouseup', function () {
  187. // Drop
  188. if (_draggingEl && _dropRecord) {
  189. updateRawData() && _this.myChart.setOption({
  190. series: {
  191. id: 'flightData',
  192. data: raw_data.flight.data
  193. }
  194. });
  195. }
  196. dragRelease();
  197. });
  198. this.myChart.getZr().on('globalout', dragRelease);
  199. function dragRelease() {
  200. _autoDataZoomAnimator.stop();
  201. if (_draggingEl) {
  202. this.myChart.getZr().remove(_draggingEl);
  203. _draggingEl = null;
  204. }
  205. if (_dropShadow) {
  206. this.myChart.getZr().remove(_dropShadow);
  207. _dropShadow = null;
  208. }
  209. _dropRecord = _draggingRecord = null;
  210. }
  211. function addOrUpdateBar(el, itemData, style, z) {
  212. var pointArrival = this.myChart.convertToPixel('grid', [itemData.timeArrival, itemData.categoryIndex]);
  213. var pointDeparture = this.myChart.convertToPixel('grid', [itemData.timeDeparture, itemData.categoryIndex]);
  214. var barLength = pointDeparture[0] - pointArrival[0];
  215. var barHeight = Math.abs(this.myChart.convertToPixel('grid', [0, 0])[1] - this.myChart.convertToPixel('grid', [0, 1])[1]) * HEIGHT_RATIO;
  216. if (!el) {
  217. el = new external_echarts_default.a.graphic.Rect({
  218. shape: { x: 0, y: 0, width: 0, height: 0 },
  219. style: style,
  220. z: z
  221. });
  222. this.myChart.getZr().add(el);
  223. }
  224. el.attr({
  225. shape: { x: 0, y: 0, width: barLength, height: barHeight },
  226. position: [pointArrival[0], pointArrival[1] - barHeight]
  227. });
  228. return el;
  229. }
  230. function prepareDrop() {
  231. // Check droppable place.
  232. var xPixel = _draggingEl.shape.x + _draggingEl.position[0];
  233. var yPixel = _draggingEl.shape.y + _draggingEl.position[1];
  234. var cursorData = this.myChart.convertFromPixel('grid', [xPixel, yPixel]);
  235. if (cursorData) {
  236. // Make drop shadow and _dropRecord
  237. _dropRecord = {
  238. categoryIndex: Math.floor(cursorData[1]),
  239. timeArrival: cursorData[0],
  240. timeDeparture: cursorData[0] + _draggingTimeLength
  241. };
  242. var style = { fill: 'rgba(0,0,0,0.4)' };
  243. _dropShadow = addOrUpdateBar(_dropShadow, _dropRecord, style, 99);
  244. }
  245. }
  246. // This is some business logic, don't care about it.
  247. function updateRawData() {
  248. var flightData = raw_data.flight.data;
  249. var movingItem = flightData[_draggingRecord.dataIndex];
  250. // Check conflict
  251. for (var i = 0; i < flightData.length; i++) {
  252. var dataItem = flightData[i];
  253. if (dataItem !== movingItem && _dropRecord.categoryIndex === dataItem[DIM_CATEGORY_INDEX] && _dropRecord.timeArrival < dataItem[DIM_TIME_DEPARTURE] && _dropRecord.timeDeparture > dataItem[DIM_TIME_ARRIVAL]) {
  254. alert('Conflict! Find a free space to settle the bar!');
  255. return;
  256. }
  257. }
  258. // No conflict.
  259. movingItem[DIM_CATEGORY_INDEX] = _dropRecord.categoryIndex;
  260. movingItem[DIM_TIME_ARRIVAL] = _dropRecord.timeArrival;
  261. movingItem[DIM_TIME_DEPARTURE] = _dropRecord.timeDeparture;
  262. return true;
  263. }
  264. function autoDataZoomWhenDraggingOutside(cursorX, cursorY) {
  265. // When cursor is outside the cartesian and being dragging,
  266. // auto move the dataZooms.
  267. var cursorDistX = getCursorCartesianDist(cursorX, _cartesianXBounds);
  268. var cursorDistY = getCursorCartesianDist(cursorY, _cartesianYBounds);
  269. if (cursorDistX !== 0 || cursorDistY !== 0) {
  270. _autoDataZoomAnimator.start({
  271. cursorDistX: cursorDistX,
  272. cursorDistY: cursorDistY
  273. });
  274. } else {
  275. _autoDataZoomAnimator.stop();
  276. }
  277. }
  278. function dispatchDataZoom(params) {
  279. var option = this.myChart.getOption();
  280. var optionInsideX = option.dataZoom[DATA_ZOOM_X_INSIDE_INDEX];
  281. var optionInsideY = option.dataZoom[DATA_ZOOM_Y_INSIDE_INDEX];
  282. var batch = [];
  283. prepareBatch(batch, 'insideX', optionInsideX.start, optionInsideX.end, params.cursorDistX);
  284. prepareBatch(batch, 'insideY', optionInsideY.start, optionInsideY.end, -params.cursorDistY);
  285. batch.length && this.myChart.dispatchAction({
  286. type: 'dataZoom',
  287. batch: batch
  288. });
  289. function prepareBatch(batch, id, start, end, cursorDist) {
  290. if (cursorDist === 0) {
  291. return;
  292. }
  293. var sign = cursorDist / Math.abs(cursorDist);
  294. var size = end - start;
  295. var delta = DATA_ZOOM_AUTO_MOVE_SPEED * sign;
  296. start += delta;
  297. end += delta;
  298. if (end > 100) {
  299. end = 100;
  300. start = end - size;
  301. }
  302. if (start < 0) {
  303. start = 0;
  304. end = start + size;
  305. }
  306. batch.push({
  307. dataZoomId: id,
  308. start: start,
  309. end: end
  310. });
  311. }
  312. }
  313. function getCursorCartesianDist(cursorXY, bounds) {
  314. var dist0 = cursorXY - (bounds[0] + DATA_ZOOM_AUTO_MOVE_DETECT_AREA_WIDTH);
  315. var dist1 = cursorXY - (bounds[1] - DATA_ZOOM_AUTO_MOVE_DETECT_AREA_WIDTH);
  316. return dist0 * dist1 <= 0 ? 0 // cursor is in cartesian
  317. : dist0 < 0 ? dist0 // cursor is at left/top of cartesian
  318. : dist1; // cursor is at right/bottom of cartesian
  319. }
  320. function makeAnimator(callback) {
  321. var requestId = void 0;
  322. var callbackParams = void 0;
  323. // Use throttle to prevent from calling dispatchAction frequently.
  324. callback = external_echarts_default.a.throttle(callback, DATA_ZOOM_AUTO_MOVE_THROTTLE);
  325. function onFrame() {
  326. callback(callbackParams);
  327. requestId = requestAnimationFrame(onFrame);
  328. }
  329. return {
  330. start: function start(params) {
  331. callbackParams = params;
  332. if (requestId == null) {
  333. onFrame();
  334. }
  335. },
  336. stop: function stop() {
  337. if (requestId != null) {
  338. cancelAnimationFrame(requestId);
  339. }
  340. requestId = callbackParams = null;
  341. }
  342. };
  343. }
  344. },
  345. onDragSwitchClick: function onDragSwitchClick(model, api, type) {
  346. _draggable = !_draggable;
  347. this.myChart.setOption({
  348. dataZoom: [{
  349. id: 'insideX',
  350. disabled: _draggable
  351. }, {
  352. id: 'insideY',
  353. disabled: _draggable
  354. }]
  355. });
  356. this.model.setIconStatus(type, _draggable ? 'emphasis' : 'normal');
  357. },
  358. clipRectByRect: function clipRectByRect(params, rect) {
  359. return external_echarts_default.a.graphic.clipRectByRect(rect, {
  360. x: params.coordSys.x,
  361. y: params.coordSys.y,
  362. width: params.coordSys.width,
  363. height: params.coordSys.height
  364. });
  365. },
  366. renderAxisLabelItem: function renderAxisLabelItem(params, api) {
  367. var y = api.coord([0, api.value(0)])[1];
  368. if (y < params.coordSys.y + 5) {
  369. return;
  370. }
  371. return {
  372. type: 'group',
  373. position: [10, y],
  374. children: [{
  375. type: 'path',
  376. shape: {
  377. d: 'M0,0 L0,-20 L30,-20 C42,-20 38,-1 50,-1 L70,-1 L70,0 Z',
  378. x: 0,
  379. y: -20,
  380. width: 90,
  381. height: 20,
  382. layout: 'cover'
  383. },
  384. style: {
  385. fill: '#368c6c'
  386. }
  387. }, {
  388. type: 'text',
  389. style: {
  390. x: 24,
  391. y: -3,
  392. text: api.value(1),
  393. textVerticalAlign: 'bottom',
  394. textAlign: 'center',
  395. textFill: '#fff'
  396. }
  397. }, {
  398. type: 'text',
  399. style: {
  400. x: 75,
  401. y: -2,
  402. textVerticalAlign: 'bottom',
  403. textAlign: 'center',
  404. text: api.value(2),
  405. textFill: '#000'
  406. }
  407. }]
  408. };
  409. },
  410. renderGanttItem: function renderGanttItem(params, api) {
  411. var categoryIndex = api.value(DIM_CATEGORY_INDEX);
  412. var timeArrival = api.coord([api.value(DIM_TIME_ARRIVAL), categoryIndex]);
  413. var timeDeparture = api.coord([api.value(DIM_TIME_DEPARTURE), categoryIndex]);
  414. var coordSys = params.coordSys;
  415. _cartesianXBounds[0] = coordSys.x;
  416. _cartesianXBounds[1] = coordSys.x + coordSys.width;
  417. _cartesianYBounds[0] = coordSys.y;
  418. _cartesianYBounds[1] = coordSys.y + coordSys.height;
  419. var barLength = timeDeparture[0] - timeArrival[0];
  420. // Get the heigth corresponds to length 1 on y axis.
  421. var barHeight = api.size([0, 1])[1] * HEIGHT_RATIO;
  422. var x = timeArrival[0];
  423. var y = timeArrival[1] - barHeight;
  424. var flightNumber = api.value(3) + '';
  425. var flightNumberWidth = external_echarts_default.a.format.getTextRect(flightNumber).width;
  426. var text = barLength > flightNumberWidth + 40 && x + barLength >= 180 ? flightNumber : '';
  427. var rectNormal = this.clipRectByRect(params, {
  428. x: x, y: y, width: barLength, height: barHeight
  429. });
  430. var rectVIP = this.clipRectByRect(params, {
  431. x: x, y: y, width: barLength / 2, height: barHeight
  432. });
  433. var rectText = this.clipRectByRect(params, {
  434. x: x, y: y, width: barLength, height: barHeight
  435. });
  436. return {
  437. type: 'group',
  438. children: [{
  439. type: 'rect',
  440. ignore: !rectNormal,
  441. shape: rectNormal,
  442. style: api.style()
  443. }, {
  444. type: 'rect',
  445. ignore: !rectVIP && !api.value(4),
  446. shape: rectVIP,
  447. style: api.style({ fill: '#ddb30b' })
  448. }, {
  449. type: 'rect',
  450. ignore: !rectText,
  451. shape: rectText,
  452. style: api.style({
  453. fill: 'transparent',
  454. stroke: 'transparent',
  455. text: text,
  456. textFill: '#fff'
  457. })
  458. }]
  459. };
  460. },
  461. makeOption: function makeOption() {
  462. return {
  463. tooltip: {},
  464. animation: false,
  465. toolbox: {
  466. left: 20,
  467. top: 0,
  468. itemSize: 20,
  469. feature: {
  470. myDrag: {
  471. show: true,
  472. title: 'Make bars\ndraggable',
  473. icon: 'path://M990.55 380.08 q11.69 0 19.88 8.19 q7.02 7.01 7.02 18.71 l0 480.65 q-1.17 43.27 -29.83 71.93 q-28.65 28.65 -71.92 29.82 l-813.96 0 q-43.27 -1.17 -72.5 -30.41 q-28.07 -28.07 -29.24 -71.34 l0 -785.89 q1.17 -43.27 29.24 -72.5 q29.23 -29.24 72.5 -29.24 l522.76 0 q11.7 0 18.71 7.02 q8.19 8.18 8.19 18.71 q0 11.69 -7.6 19.29 q-7.6 7.61 -19.3 7.61 l-518.08 0 q-22.22 1.17 -37.42 16.37 q-15.2 15.2 -15.2 37.42 l0 775.37 q0 23.39 15.2 38.59 q15.2 15.2 37.42 15.2 l804.6 0 q22.22 0 37.43 -15.2 q15.2 -15.2 16.37 -38.59 l0 -474.81 q0 -11.7 7.02 -18.71 q8.18 -8.19 18.71 -8.19 l0 0 ZM493.52 723.91 l-170.74 -170.75 l509.89 -509.89 q23.39 -23.39 56.13 -21.05 q32.75 1.17 59.65 26.9 l47.94 47.95 q25.73 26.89 27.49 59.64 q1.75 32.75 -21.64 57.3 l-508.72 509.9 l0 0 ZM870.09 80.69 l-56.13 56.14 l94.72 95.9 l56.14 -57.31 q8.19 -9.35 8.19 -21.05 q-1.17 -12.86 -10.53 -22.22 l-47.95 -49.12 q-10.52 -9.35 -23.39 -9.35 q-11.69 -1.17 -21.05 7.01 l0 0 ZM867.75 272.49 l-93.56 -95.9 l-380.08 380.08 l94.73 94.73 l378.91 -378.91 l0 0 ZM322.78 553.16 l38.59 39.77 l-33.92 125.13 l125.14 -33.92 l38.59 38.6 l-191.79 52.62 q-5.85 1.17 -12.28 0 q-6.44 -1.17 -11.11 -5.84 q-4.68 -4.68 -5.85 -11.7 q-2.34 -5.85 0 -11.69 l52.63 -192.97 l0 0 Z',
  474. onclick: this.onDragSwitchClick
  475. }
  476. }
  477. },
  478. title: {
  479. text: '甘特图示例',
  480. left: 'center'
  481. },
  482. dataZoom: [{
  483. type: 'slider',
  484. xAxisIndex: 0,
  485. filterMode: 'weakFilter',
  486. height: 20,
  487. bottom: 0,
  488. start: 0,
  489. end: 26,
  490. handleIcon: 'path://M10.7,11.9H9.3c-4.9,0.3-8.8,4.4-8.8,9.4c0,5,3.9,9.1,8.8,9.4h1.3c4.9-0.3,8.8-4.4,8.8-9.4C19.5,16.3,15.6,12.2,10.7,11.9z M13.3,24.4H6.7V23h6.6V24.4z M13.3,19.6H6.7v-1.4h6.6V19.6z',
  491. handleSize: '80%',
  492. showDetail: false
  493. }, {
  494. type: 'inside',
  495. id: 'insideX',
  496. xAxisIndex: 0,
  497. filterMode: 'weakFilter',
  498. start: 0,
  499. end: 26,
  500. zoomOnMouseWheel: false,
  501. moveOnMouseMove: true
  502. }, {
  503. type: 'slider',
  504. yAxisIndex: 0,
  505. zoomLock: true,
  506. width: 10,
  507. right: 10,
  508. top: 70,
  509. bottom: 20,
  510. start: 95,
  511. end: 100,
  512. handleSize: 0,
  513. showDetail: false
  514. }, {
  515. type: 'inside',
  516. id: 'insideY',
  517. yAxisIndex: 0,
  518. start: 95,
  519. end: 100,
  520. zoomOnMouseWheel: false,
  521. moveOnMouseMove: true,
  522. moveOnMouseWheel: true
  523. }],
  524. grid: {
  525. show: true,
  526. top: 70,
  527. bottom: 20,
  528. left: 100,
  529. right: 20,
  530. backgroundColor: '#fff',
  531. borderWidth: 0
  532. },
  533. xAxis: {
  534. type: 'time',
  535. position: 'top',
  536. splitLine: {
  537. lineStyle: {
  538. color: ['#E9EDFF']
  539. }
  540. },
  541. axisLine: {
  542. show: false
  543. },
  544. axisTick: {
  545. lineStyle: {
  546. color: '#929ABA'
  547. }
  548. },
  549. axisLabel: {
  550. color: '#929ABA',
  551. inside: false,
  552. align: 'center'
  553. }
  554. },
  555. yAxis: {
  556. axisTick: { show: false },
  557. splitLine: { show: false },
  558. axisLine: { show: false },
  559. axisLabel: { show: false },
  560. min: 0,
  561. max: raw_data.parkingApron.data.length
  562. },
  563. series: [{
  564. id: 'flightData',
  565. type: 'custom',
  566. renderItem: this.renderGanttItem,
  567. dimensions: raw_data.flight.dimensions,
  568. encode: {
  569. x: [DIM_TIME_ARRIVAL, DIM_TIME_DEPARTURE],
  570. y: DIM_CATEGORY_INDEX,
  571. tooltip: [DIM_CATEGORY_INDEX, DIM_TIME_ARRIVAL, DIM_TIME_DEPARTURE]
  572. },
  573. data: raw_data.flight.data
  574. }, {
  575. type: 'custom',
  576. renderItem: this.renderAxisLabelItem,
  577. dimensions: raw_data.parkingApron.dimensions,
  578. encode: {
  579. x: -1, // Then this series will not controlled by x.
  580. y: 0
  581. },
  582. data: raw_data.parkingApron.data.map(function (item, index) {
  583. return [index].concat(item);
  584. })
  585. }]
  586. };
  587. }
  588. },
  589. render: function render() {
  590. var h = arguments[0];
  591. return h(
  592. 'div',
  593. {
  594. attrs: { className: 'c-gantt-wrapper' },
  595. style: { width: this.width, height: this.height } },
  596. [h('div', {
  597. attrs: { className: 'c-gantt-container' },
  598. ref: 'ganttContainer', style: { width: this.width, height: this.height } })]
  599. );
  600. }
  601. });
  602. // CONCATENATED MODULE: ./packages/c-gantt/index.js
  603. /* harmony default export */ var c_gantt = __webpack_exports__["default"] = (main);
  604. /***/ })
  605. /******/ });