UNPKG

yk-smart-ui

Version:

A Component Library for Vue.js.

1,723 lines (1,663 loc) 99.4 kB
module.exports = /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) { /******/ return installedModules[moduleId].exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ i: moduleId, /******/ l: false, /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ /******/ // Flag the module as loaded /******/ module.l = true; /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /******/ /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ /******/ // define getter function for harmony exports /******/ __webpack_require__.d = function(exports, name, getter) { /******/ if(!__webpack_require__.o(exports, name)) { /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); /******/ } /******/ }; /******/ /******/ // define __esModule on exports /******/ __webpack_require__.r = function(exports) { /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); /******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; /******/ /******/ // create a fake namespace object /******/ // mode & 1: value is a module id, require it /******/ // mode & 2: merge all properties of value into the ns /******/ // mode & 4: return value when already ns object /******/ // mode & 8|1: behave like require /******/ __webpack_require__.t = function(value, mode) { /******/ if(mode & 1) value = __webpack_require__(value); /******/ if(mode & 8) return value; /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; /******/ var ns = Object.create(null); /******/ __webpack_require__.r(ns); /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); /******/ return ns; /******/ }; /******/ /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = function(module) { /******/ var getter = module && module.__esModule ? /******/ function getDefault() { return module['default']; } : /******/ function getModuleExports() { return module; }; /******/ __webpack_require__.d(getter, 'a', getter); /******/ return getter; /******/ }; /******/ /******/ // Object.prototype.hasOwnProperty.call /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; /******/ /******/ // __webpack_public_path__ /******/ __webpack_require__.p = "/dist/"; /******/ /******/ /******/ // Load entry module and return exports /******/ return __webpack_require__(__webpack_require__.s = 169); /******/ }) /************************************************************************/ /******/ ({ /***/ 0: /***/ (function(module, exports) { module.exports = require("vue"); /***/ }), /***/ 15: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return getCell; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return orderBy; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return getColumnById; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return getColumnByKey; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return getColumnByCell; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return getRowIdentity; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return getKeysMap; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return mergeOptions; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "l", function() { return parseWidth; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "k", function() { return parseMinWidth; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "j", function() { return parseHeight; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return compose; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "m", function() { return toggleRowStatus; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "n", function() { return walkTreeNode; }); /* harmony import */ var element_ui_src_utils_util__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(3); var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; var getCell = function getCell(event) { var cell = event.target; while (cell && cell.tagName.toUpperCase() !== 'HTML') { if (cell.tagName.toUpperCase() === 'TD') { return cell; } cell = cell.parentNode; } return null; }; var isObject = function isObject(obj) { return obj !== null && (typeof obj === 'undefined' ? 'undefined' : _typeof(obj)) === 'object'; }; var orderBy = function orderBy(array, sortKey, reverse, sortMethod, sortBy) { if (!sortKey && !sortMethod && (!sortBy || Array.isArray(sortBy) && !sortBy.length)) { return array; } if (typeof reverse === 'string') { reverse = reverse === 'descending' ? -1 : 1; } else { reverse = reverse && reverse < 0 ? -1 : 1; } var getKey = sortMethod ? null : function (value, index) { if (sortBy) { if (!Array.isArray(sortBy)) { sortBy = [sortBy]; } return sortBy.map(function (by) { if (typeof by === 'string') { return Object(element_ui_src_utils_util__WEBPACK_IMPORTED_MODULE_0__[/* getValueByPath */ "i"])(value, by); } else { return by(value, index, array); } }); } if (sortKey !== '$key') { if (isObject(value) && '$value' in value) value = value.$value; } return [isObject(value) ? Object(element_ui_src_utils_util__WEBPACK_IMPORTED_MODULE_0__[/* getValueByPath */ "i"])(value, sortKey) : value]; }; var compare = function compare(a, b) { if (sortMethod) { return sortMethod(a.value, b.value); } for (var i = 0, len = a.key.length; i < len; i++) { if (a.key[i] < b.key[i]) { return -1; } if (a.key[i] > b.key[i]) { return 1; } } return 0; }; return array.map(function (value, index) { return { value: value, index: index, key: getKey ? getKey(value, index) : null }; }).sort(function (a, b) { var order = compare(a, b); if (!order) { // make stable https://en.wikipedia.org/wiki/Sorting_algorithm#Stability order = a.index - b.index; } return order * reverse; }).map(function (item) { return item.value; }); }; var getColumnById = function getColumnById(table, columnId) { var column = null; table.columns.forEach(function (item) { if (item.id === columnId) { column = item; } }); return column; }; var getColumnByKey = function getColumnByKey(table, columnKey) { var column = null; for (var i = 0; i < table.columns.length; i++) { var item = table.columns[i]; if (item.columnKey === columnKey) { column = item; break; } } return column; }; var getColumnByCell = function getColumnByCell(table, cell) { var matches = (cell.className || '').match(/yk-table_[^\s]+/gm); if (matches) { return getColumnById(table, matches[0]); } return null; }; var getRowIdentity = function getRowIdentity(row, rowKey) { if (!row) throw new Error('row is required when get row identity'); if (typeof rowKey === 'string') { if (rowKey.indexOf('.') < 0) { return row[rowKey]; } var key = rowKey.split('.'); var current = row; for (var i = 0; i < key.length; i++) { current = current[key[i]]; } return current; } else if (typeof rowKey === 'function') { return rowKey.call(null, row); } }; var getKeysMap = function getKeysMap(array, rowKey) { var arrayMap = {}; (array || []).forEach(function (row, index) { arrayMap[getRowIdentity(row, rowKey)] = { row: row, index: index }; }); return arrayMap; }; function hasOwn(obj, key) { return Object.prototype.hasOwnProperty.call(obj, key); } function mergeOptions(defaults, config) { var options = {}; var key = void 0; for (key in defaults) { options[key] = defaults[key]; } for (key in config) { if (hasOwn(config, key)) { var value = config[key]; if (typeof value !== 'undefined') { options[key] = value; } } } return options; } function parseWidth(width) { if (width !== undefined) { width = parseInt(width, 10); if (isNaN(width)) { width = null; } } return width; } function parseMinWidth(minWidth) { if (typeof minWidth !== 'undefined') { minWidth = parseWidth(minWidth); if (isNaN(minWidth)) { minWidth = 80; } } return minWidth; }; function parseHeight(height) { if (typeof height === 'number') { return height; } if (typeof height === 'string') { if (/^\d+(?:px)?$/.test(height)) { return parseInt(height, 10); } else { return height; } } return null; } // https://github.com/reduxjs/redux/blob/master/src/compose.js function compose() { for (var _len = arguments.length, funcs = Array(_len), _key = 0; _key < _len; _key++) { funcs[_key] = arguments[_key]; } if (funcs.length === 0) { return function (arg) { return arg; }; } if (funcs.length === 1) { return funcs[0]; } return funcs.reduce(function (a, b) { return function () { return a(b.apply(undefined, arguments)); }; }); } function toggleRowStatus(statusArr, row, newVal) { var changed = false; var index = statusArr.indexOf(row); var included = index !== -1; var addRow = function addRow() { statusArr.push(row); changed = true; }; var removeRow = function removeRow() { statusArr.splice(index, 1); changed = true; }; if (typeof newVal === 'boolean') { if (newVal && !included) { addRow(); } else if (!newVal && included) { removeRow(); } } else { if (included) { removeRow(); } else { addRow(); } } return changed; } function walkTreeNode(root, cb) { var childrenKey = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'children'; var lazyKey = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'hasChildren'; var isNil = function isNil(array) { return !(Array.isArray(array) && array.length); }; function _walker(parent, children, level) { cb(parent, children, level); children.forEach(function (item) { if (item[lazyKey]) { cb(item, null, level + 1); return; } var children = item[childrenKey]; if (!isNil(children)) { _walker(item, children, level + 1); } }); } root.forEach(function (item) { if (item[lazyKey]) { cb(item, null, 0); return; } var children = item[childrenKey]; if (!isNil(children)) { _walker(item, children, 0); } }); } /***/ }), /***/ 169: /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; // ESM COMPAT FLAG __webpack_require__.r(__webpack_exports__); // EXTERNAL MODULE: external "vue-slider-component" var external_vue_slider_component_ = __webpack_require__(47); var external_vue_slider_component_default = /*#__PURE__*/__webpack_require__.n(external_vue_slider_component_); // EXTERNAL MODULE: external "vue-slider-component/theme/default.css" var default_css_ = __webpack_require__(54); // EXTERNAL MODULE: ./packages/table/src/store/current.js var current = __webpack_require__(49); // CONCATENATED MODULE: ./packages/routebook-multi/src/mapStyle.js /* harmony default export */ var mapStyle = ({ styleJson: [{ 'featureType': 'land', 'elementType': 'geometry', 'stylers': { 'color': '#fcfcfc' } }, { 'featureType': 'water', 'elementType': 'geometry', 'stylers': { 'color': '#d5e2f8' } }, { 'featureType': 'label', 'elementType': 'labels.text.fill', 'stylers': { 'color': '#585d99' } }, { 'featureType': 'highway', 'elementType': 'geometry.fill', 'stylers': { 'color': '#b5caa0ff' } }, { 'featureType': 'highway', 'elementType': 'geometry.stroke', 'stylers': { 'color': '#94ad79ff' } }, { 'featureType': 'nationalway', 'elementType': 'geometry.fill', 'stylers': { 'color': '#b5caa0ff' } }, { 'featureType': 'arterial', 'elementType': 'geometry.fill', 'stylers': { 'color': '#d4e2c6ff' } }, { 'featureType': 'cityhighway', 'elementType': 'geometry.fill', 'stylers': { 'color': '#d4e2c6ff' } }, { 'featureType': 'provincialway', 'elementType': 'geometry.fill', 'stylers': { 'color': '#d4e2c6ff' } }, { 'featureType': 'provincialway', 'elementType': 'geometry.stroke', 'stylers': { 'color': '#b5caa0ff' } }, { 'featureType': 'tertiaryway', 'elementType': 'geometry.fill', 'stylers': { 'color': '#ffffffff' } }, { 'featureType': 'tertiaryway', 'elementType': 'geometry.stroke', 'stylers': { 'color': '#b5caa0ff' } }, { 'featureType': 'fourlevelway', 'elementType': 'geometry.fill', 'stylers': { 'color': '#ffffffff' } }, { 'featureType': 'fourlevelway', 'elementType': 'geometry.stroke', 'stylers': { 'color': '#b5caa0ff' } }, { 'featureType': 'subway', 'elementType': 'geometry', 'stylers': { 'visibility': 'off' } }, { 'featureType': 'railway', 'elementType': 'geometry', 'stylers': { 'visibility': 'off' } }, { 'featureType': 'highwaysign', 'elementType': 'labels', 'stylers': { 'visibility': 'off' } }, { 'featureType': 'highwaysign', 'elementType': 'labels.icon', 'stylers': { 'visibility': 'off' } }, { 'featureType': 'nationalwaysign', 'elementType': 'labels', 'stylers': { 'visibility': 'off' } }, { 'featureType': 'nationalwaysign', 'elementType': 'labels.icon', 'stylers': { 'visibility': 'off' } }, { 'featureType': 'provincialwaysign', 'elementType': 'labels', 'stylers': { 'visibility': 'off' } }, { 'featureType': 'provincialwaysign', 'elementType': 'labels.icon', 'stylers': { 'visibility': 'off' } }, { 'featureType': 'tertiarywaysign', 'elementType': 'labels', 'stylers': { 'visibility': 'off' } }, { 'featureType': 'tertiarywaysign', 'elementType': 'labels.icon', 'stylers': { 'visibility': 'off' } }, { 'featureType': 'subwaylabel', 'elementType': 'labels', 'stylers': { 'visibility': 'off' } }, { 'featureType': 'subwaylabel', 'elementType': 'labels.icon', 'stylers': { 'visibility': 'off' } }, { 'featureType': 'nationalway', 'elementType': 'geometry.stroke', 'stylers': { 'color': '#94ad79ff' } }, { 'featureType': 'cityhighway', 'elementType': 'geometry.stroke', 'stylers': { 'color': '#b5caa0ff' } }, { 'featureType': 'arterial', 'elementType': 'geometry.stroke', 'stylers': { 'color': '#b5caa0ff' } }, { 'featureType': 'highway', 'stylers': { 'level': '6', 'curZoomRegionId': '0', 'curZoomRegion': '6-9' } }, { 'featureType': 'highway', 'stylers': { 'level': '7', 'curZoomRegionId': '0', 'curZoomRegion': '6-9' } }, { 'featureType': 'highway', 'stylers': { 'level': '8', 'curZoomRegionId': '0', 'curZoomRegion': '6-9' } }, { 'featureType': 'highway', 'stylers': { 'level': '9', 'curZoomRegionId': '0', 'curZoomRegion': '6-9' } }, { 'featureType': 'highway', 'elementType': 'geometry', 'stylers': { 'visibility': 'off', 'level': '6', 'curZoomRegionId': '0', 'curZoomRegion': '6-9' } }, { 'featureType': 'highway', 'elementType': 'geometry', 'stylers': { 'visibility': 'off', 'level': '7', 'curZoomRegionId': '0', 'curZoomRegion': '6-9' } }, { 'featureType': 'highway', 'elementType': 'geometry', 'stylers': { 'visibility': 'off', 'level': '8', 'curZoomRegionId': '0', 'curZoomRegion': '6-9' } }, { 'featureType': 'highway', 'elementType': 'geometry', 'stylers': { 'visibility': 'off', 'level': '9', 'curZoomRegionId': '0', 'curZoomRegion': '6-9' } }, { 'featureType': 'highway', 'elementType': 'labels', 'stylers': { 'visibility': 'off', 'level': '6', 'curZoomRegionId': '0', 'curZoomRegion': '6-9' } }, { 'featureType': 'highway', 'elementType': 'labels', 'stylers': { 'visibility': 'off', 'level': '7', 'curZoomRegionId': '0', 'curZoomRegion': '6-9' } }, { 'featureType': 'highway', 'elementType': 'labels', 'stylers': { 'visibility': 'off', 'level': '8', 'curZoomRegionId': '0', 'curZoomRegion': '6-9' } }, { 'featureType': 'highway', 'elementType': 'labels', 'stylers': { 'visibility': 'off', 'level': '9', 'curZoomRegionId': '0', 'curZoomRegion': '6-9' } }, { 'featureType': 'nationalway', 'stylers': { 'level': '6', 'curZoomRegionId': '0', 'curZoomRegion': '6-9' } }, { 'featureType': 'nationalway', 'stylers': { 'level': '7', 'curZoomRegionId': '0', 'curZoomRegion': '6-9' } }, { 'featureType': 'nationalway', 'stylers': { 'level': '8', 'curZoomRegionId': '0', 'curZoomRegion': '6-9' } }, { 'featureType': 'nationalway', 'stylers': { 'level': '9', 'curZoomRegionId': '0', 'curZoomRegion': '6-9' } }, { 'featureType': 'nationalway', 'elementType': 'geometry', 'stylers': { 'visibility': 'off', 'level': '6', 'curZoomRegionId': '0', 'curZoomRegion': '6-9' } }, { 'featureType': 'nationalway', 'elementType': 'geometry', 'stylers': { 'visibility': 'off', 'level': '7', 'curZoomRegionId': '0', 'curZoomRegion': '6-9' } }, { 'featureType': 'nationalway', 'elementType': 'geometry', 'stylers': { 'visibility': 'off', 'level': '8', 'curZoomRegionId': '0', 'curZoomRegion': '6-9' } }, { 'featureType': 'nationalway', 'elementType': 'geometry', 'stylers': { 'visibility': 'off', 'level': '9', 'curZoomRegionId': '0', 'curZoomRegion': '6-9' } }, { 'featureType': 'nationalway', 'elementType': 'labels', 'stylers': { 'visibility': 'off', 'level': '6', 'curZoomRegionId': '0', 'curZoomRegion': '6-9' } }, { 'featureType': 'nationalway', 'elementType': 'labels', 'stylers': { 'visibility': 'off', 'level': '7', 'curZoomRegionId': '0', 'curZoomRegion': '6-9' } }, { 'featureType': 'nationalway', 'elementType': 'labels', 'stylers': { 'visibility': 'off', 'level': '8', 'curZoomRegionId': '0', 'curZoomRegion': '6-9' } }, { 'featureType': 'nationalway', 'elementType': 'labels', 'stylers': { 'visibility': 'off', 'level': '9', 'curZoomRegionId': '0', 'curZoomRegion': '6-9' } }, { 'featureType': 'provincialway', 'stylers': { 'level': '8', 'curZoomRegionId': '0', 'curZoomRegion': '8-9' } }, { 'featureType': 'provincialway', 'stylers': { 'level': '9', 'curZoomRegionId': '0', 'curZoomRegion': '8-9' } }, { 'featureType': 'provincialway', 'elementType': 'geometry', 'stylers': { 'visibility': 'off', 'level': '8', 'curZoomRegionId': '0', 'curZoomRegion': '8-9' } }, { 'featureType': 'provincialway', 'elementType': 'geometry', 'stylers': { 'visibility': 'off', 'level': '9', 'curZoomRegionId': '0', 'curZoomRegion': '8-9' } }, { 'featureType': 'provincialway', 'elementType': 'labels', 'stylers': { 'visibility': 'off', 'level': '8', 'curZoomRegionId': '0', 'curZoomRegion': '8-9' } }, { 'featureType': 'provincialway', 'elementType': 'labels', 'stylers': { 'visibility': 'off', 'level': '9', 'curZoomRegionId': '0', 'curZoomRegion': '8-9' } }, { 'featureType': 'cityhighway', 'stylers': { 'level': '6', 'curZoomRegionId': '0', 'curZoomRegion': '6-9' } }, { 'featureType': 'cityhighway', 'stylers': { 'level': '7', 'curZoomRegionId': '0', 'curZoomRegion': '6-9' } }, { 'featureType': 'cityhighway', 'stylers': { 'level': '8', 'curZoomRegionId': '0', 'curZoomRegion': '6-9' } }, { 'featureType': 'cityhighway', 'stylers': { 'level': '9', 'curZoomRegionId': '0', 'curZoomRegion': '6-9' } }, { 'featureType': 'cityhighway', 'elementType': 'geometry', 'stylers': { 'visibility': 'off', 'level': '6', 'curZoomRegionId': '0', 'curZoomRegion': '6-9' } }, { 'featureType': 'cityhighway', 'elementType': 'geometry', 'stylers': { 'visibility': 'off', 'level': '7', 'curZoomRegionId': '0', 'curZoomRegion': '6-9' } }, { 'featureType': 'cityhighway', 'elementType': 'geometry', 'stylers': { 'visibility': 'off', 'level': '8', 'curZoomRegionId': '0', 'curZoomRegion': '6-9' } }, { 'featureType': 'cityhighway', 'elementType': 'geometry', 'stylers': { 'visibility': 'off', 'level': '9', 'curZoomRegionId': '0', 'curZoomRegion': '6-9' } }, { 'featureType': 'cityhighway', 'elementType': 'labels', 'stylers': { 'visibility': 'off', 'level': '6', 'curZoomRegionId': '0', 'curZoomRegion': '6-9' } }, { 'featureType': 'cityhighway', 'elementType': 'labels', 'stylers': { 'visibility': 'off', 'level': '7', 'curZoomRegionId': '0', 'curZoomRegion': '6-9' } }, { 'featureType': 'cityhighway', 'elementType': 'labels', 'stylers': { 'visibility': 'off', 'level': '8', 'curZoomRegionId': '0', 'curZoomRegion': '6-9' } }, { 'featureType': 'cityhighway', 'elementType': 'labels', 'stylers': { 'visibility': 'off', 'level': '9', 'curZoomRegionId': '0', 'curZoomRegion': '6-9' } }, { 'featureType': 'entertainment', 'elementType': 'geometry', 'stylers': { 'color': '#e4f0d7ff' } }, { 'featureType': 'manmade', 'elementType': 'geometry', 'stylers': { 'color': '#effcf0ff' } }, { 'featureType': 'education', 'elementType': 'geometry', 'stylers': { 'color': '#e3f7e4ff' } }, { 'featureType': 'building', 'elementType': 'geometry.stroke', 'stylers': { 'color': '#a1cfa4ff' } }, { 'featureType': 'poilabel', 'elementType': 'labels', 'stylers': { 'visibility': 'off' } }, { 'featureType': 'poilabel', 'elementType': 'labels.icon', 'stylers': { 'visibility': 'off' } }, { 'featureType': 'education', 'elementType': 'labels.text.fill', 'stylers': { 'color': '#7a7a7aff' } }, { 'featureType': 'education', 'elementType': 'labels.text.stroke', 'stylers': { 'color': '#ffffffff' } }, { 'featureType': 'education', 'elementType': 'labels.text', 'stylers': { 'fontsize': '26' } }, { 'featureType': 'manmade', 'elementType': 'labels.text.fill', 'stylers': { 'color': '#afafafff' } }, { 'featureType': 'manmade', 'elementType': 'labels.text', 'stylers': { 'fontsize': '26' } }, { 'featureType': 'scenicspotslabel', 'elementType': 'labels.text.fill', 'stylers': { 'color': '#376b6dff' } }, { 'featureType': 'scenicspots', 'elementType': 'labels', 'stylers': { 'visibility': 'off' } }, { 'featureType': 'scenicspotslabel', 'elementType': 'labels', 'stylers': { 'visibility': 'on' } }, { 'featureType': 'scenicspotslabel', 'elementType': 'labels.text.stroke', 'stylers': { 'color': '#ffffffff', 'weight': '4' } }, { 'featureType': 'country', 'elementType': 'labels.text.fill', 'stylers': { 'color': '#376b6dff' } }, { 'featureType': 'country', 'elementType': 'labels.text.stroke', 'stylers': { 'color': '#ffffffff', 'weight': '3' } }, { 'featureType': 'water', 'elementType': 'labels.text.fill', 'stylers': { 'color': '#ffffffff' } }, { 'featureType': 'water', 'elementType': 'labels.text.stroke', 'stylers': { 'color': '#ffffff00' } }, { 'featureType': 'water', 'elementType': 'labels.text', 'stylers': { 'fontsize': '24' } }] }); // CONCATENATED MODULE: ./node_modules/_babel-loader@7.1.5@babel-loader/lib!./node_modules/_vue-loader@15.9.8@vue-loader/lib??vue-loader-options!./packages/routebook-multi/src/main.vue?vue&type=script&lang=js& // // import BMap from 'BMap' var BMap = null; var ComplexCustomOverlay = null; /* harmony default export */ var mainvue_type_script_lang_js_ = ({ name: "YkRoutebookMulti", components: { VueSlider: external_vue_slider_component_default.a }, props: { longitudeKey: { type: String, default: "lon" }, latitudeKey: { type: String, default: "lat" }, initPoint: { // 初始化中心点位置。如果points有数据。就取第一个 type: Object, default: function _default() { return { lon: 116.403984, lat: 39.914034 }; } }, height: { type: String, default: "600px" }, /* * point格式{lat: , lng: , color: } * */ points: { type: Array, default: function _default() { return []; }, required: true }, pointsArr: { // 地图打点,停留点,事件点等 type: Array, default: function _default() { return []; } }, pointsColor: { type: String, default: "#DD425A" }, play: { // 播放状态 type: Boolean, default: false }, zoom: { // 地图缩放等级 type: Number, default: 6 }, speed: { // 倍数 type: Number, default: 1 }, speedArr: { type: Array, default: function _default() { return [1, 2, 5, 10, 20, 50, 100]; } }, speedBase: { // 速度 type: Number, default: 100 }, lineWidth: { // 路径线宽度 type: Number, default: 4 }, progress: { // 进度 type: Number, default: 0 }, direction: { // Icon偏离角度 type: Number, default: -60 }, showPoints: Boolean, // 是否显示途经点 showMarkerBg: { type: Boolean, default: false }, // 是否显示标记点的背景图 poylineClickable: { type: Boolean, default: false }, // 是否开启轨迹线点击功能,点击后车辆和轨迹进度条跟随 popcardPosition: { type: String, default: 'auto' }, // 弹窗位置 auto:随着地图移动 fixed:固定在点的上方 triggerType: { type: String, default: "hover" }, //弹窗触发事件 hover-鼠标经过;click-鼠标点击 multiPopCard: { type: Boolean, default: false }, // 弹窗同时存在的个数 false-单个;true 多个 showInfoWin: { // 始终显示infoWindow(如果设置了landmarkPois,必须为true,两者只能生效一个) type: Boolean, default: false }, autoCenter: { // 实时刷新中心点。 type: Boolean, default: true }, colorsArrResource: { type: Array, default: function _default() { return [ // 速度颜色数组 { key: "#F4D035", name: "0~30km/h", min: 0, max: 30 }, { key: "#4CAF50", name: "30~60km/h", min: 30, max: 60 }, { key: "#2E63FD", name: "60~80km/h", min: 60, max: 80 }, { key: "#5D3FE4", name: "80~100km/h", min: 80, max: 100 }, { key: "#DD425A", name: ">100km/h", min: 100 }]; } }, ctrlIcons: { type: Object, default: function _default() { return { left: __webpack_require__(85), play: { active: __webpack_require__(86), inactive: __webpack_require__(87) }, right: __webpack_require__(88) }; } } }, data: function data() { return { map: null, startIndex: 0, car: null, timeId: null, angle: 60, // 旋转角度 myCompOverlay: null, myPopOverlay: null, showInfoWindow: this.showInfoWin, // 是否显示info弹窗 curPlay: this.play, // 播放状态 curProgress: 0, // 当前播放进度 curSpeed: 1, // 倍数 parsedPoints: [], // 处理点分组 value: 0, pointsBMap: [], pointOverlays: [], pointPopCards: [], newZIndex: 1, currentPopCardIndex: null // 当面操作的弹窗的默认索引 }; }, computed: { beginEndTime: function beginEndTime() { return this.points.length > 0 ? { startTime: this.points[0].reportTime, endTime: this.points[this.points.length - 1].reportTime } : {}; }, colorsArr: function colorsArr() { return this.colorsArrResource.filter(function (item) { return item.min > 0 || item.max > 0; }); } }, watch: { play: function play(newv) { this.curPlay = newv; if (newv) { if (!this.car) this.$emit("update:play", false);else this.start(); } else { this.pause(); } }, pointsArr: function pointsArr(newVal) { // console.log("新的数据源", newVal); if (this.showPoints) this.initPoints(); }, points: function points(newv) { // console.log("newv", newv); this.clearMap(); this.initLinesArr(); // this.initLine() // let lon = this.points.length > 0 ? this.points[0].lon : this.initPoint.lon // let lat = this.points.length > 0 ? this.points[0].lat : this.initPoint.lat if (this.points.length > 0) { this.initCar(this.points[0][this.longitudeKey], this.points[0][this.latitudeKey]); // 画车 this.initStartEndPoint(); // 画开始结束的点 } }, curSpeed: function curSpeed() { if (this.timeId) this.start(); }, curProgress: function curProgress(newv) { if (this.points.length > 0) { this.startIndex = newv; if (newv < 0) { this.startIndex = 0; } if (newv < this.points.length - 1) { this.angle = Number(this.points[this.startIndex].direction) + this.direction; } else { this.startIndex = this.points.length - 1; } this.initCar(this.points[this.startIndex][this.longitudeKey], this.points[this.startIndex][this.latitudeKey]); } }, colorsArr: function colorsArr(newv) { this.parsedPoints = []; // 清空已有数组 this.pointsBMap.forEach(function (item) { item.enableMassClear(); }); if (this.points.length > 0) { this.initLinesArr(); } }, showPoints: function showPoints(newv) { if (newv && this.pointsArr.length > 0) this.initPoints();else { this.map.clearOverlays(); } } }, mounted: function mounted() { BMap = window.BMap; ComplexCustomOverlay = function ComplexCustomOverlay(point, el) { this._point = point; this._div = el; }; ComplexCustomOverlay.prototype = new BMap.Overlay(); ComplexCustomOverlay.prototype.initialize = function (map) { this._map = map; // console.log('labelPane',map.getPanes().labelPane); map.getPanes().labelPane.appendChild(this._div); return this._div; }; ComplexCustomOverlay.prototype.draw = function () { var map = this._map; var pixel = map.pointToOverlayPixel(this._point); /* 获取地图东北与西南角*/ var NorthEast = map.getBounds().getNorthEast(); // 东北 - 上右 var SouthWest = map.getBounds().getSouthWest(); // 西南 - 下左 var o = 32; // 距离边缘和小车的偏移值 // console.log('this._div.offsetWidth',this._div.offsetWidth,pixel.x ); var offsetLeft = this._div.offsetWidth / 2; var offsetTop = this._div.offsetHeight + o; var lng = void 0, lat = void 0; if (this.popcardPosition === 'auto') { var northEastX = map.pointToOverlayPixel(NorthEast).x; var northEastY = map.pointToOverlayPixel(NorthEast).y; if (pixel.x + this._div.offsetWidth >= northEastX) { // console.log('到右边了') lng = NorthEast.lng; lat = this._point.lat; offsetLeft = -this._div.offsetWidth - o; pixel = map.pointToOverlayPixel(new BMap.Point(lng, lat)); } if (pixel.y - this._div.offsetHeight - o <= northEastY) { // console.log('到上边了') lng = this._point.lng; lat = NorthEast.lat; offsetTop = -30; pixel = map.pointToOverlayPixel(new BMap.Point(lng, lat)); } // 超出下边/左边范围 if (this._point.lng < SouthWest.lng || this._point.lat < SouthWest.lat) { // console.log('左下') lng = this._point.lng < SouthWest.lng ? SouthWest.lng : this._point.lng; lat = this._point.lat < SouthWest.lat ? SouthWest.lat : this._point.lat; pixel = map.pointToOverlayPixel(new BMap.Point(lng, lat)); if (this._point.lng < SouthWest.lng) { offsetLeft = o; } } if (this._point.lat > NorthEast.lat) { // console.log('上.....') lng = this._point.lng; lat = NorthEast.lat; offsetTop = -o; pixel = map.pointToOverlayPixel(new BMap.Point(lng, lat)); } if (this._point.lng < SouthWest.lng && this._point.lat > NorthEast.lat) { // console.log('左上。。。。') lng = SouthWest.lng; lat = NorthEast.lat; offsetTop = -o; pixel = map.pointToOverlayPixel(new BMap.Point(lng, lat)); } if (pixel.y - this._div.offsetHeight - o <= northEastY && pixel.x + this._div.offsetWidth >= northEastX) { // console.log('上右') lng = NorthEast.lng; lat = NorthEast.lat; offsetLeft = -this._div.offsetWidth - o; offsetTop = -o; pixel = map.pointToOverlayPixel(new BMap.Point(lng, lat)); } if (pixel.x + this._div.offsetWidth >= northEastX && this._point.lat < SouthWest.lat) { // console.log('右下角') lng = NorthEast.lng; lat = SouthWest.lat; offsetLeft = -this._div.offsetWidth - o; pixel = map.pointToOverlayPixel(new BMap.Point(lng, lat)); } } this._div.style.left = pixel.x - offsetLeft + "px"; this._div.style.top = pixel.y - offsetTop + "px"; }; ComplexCustomOverlay.prototype.setZIndex = function (zindex) { // console.log('设置overlay的zindex',zindex); this._div.style.zIndex = zindex; }; this.initMap(); this.curSpeed = this.speedArr[0]; }, methods: { initMap: function initMap() { var that = this; var map = new BMap.Map(this.$refs.mapInner, { enableMapClick: false, minZoom: 6, maxZoom: 18 }); map.enableScrollWheelZoom(new BMap.Point(this.points[0] ? this.points[0][this.longitudeKey] : this.initPoint[this.longitudeKey] || this.initPoint.lon, this.points[0] ? this.points[0][this.latitudeKey] : this.initPoint[this.latitudeKey] || this.initPoint.lat), this.zoom); map.centerAndZoom(new BMap.Point(this.points[0] ? this.points[0][this.longitudeKey] : this.initPoint[this.longitudeKey] || this.initPoint.lon, this.points[0] ? this.points[0][this.latitudeKey] : this.initPoint[this.latitudeKey] || this.initPoint.lat), this.zoom); this.map = map; if (this.points.length > 0) { this.clearMap(); this.initLinesArr(); this.initLine(); this.initCar(this.points[0][this.longitudeKey], this.points[0][this.latitudeKey]); // 画车 this.initStartEndPoint(); // 画开始结束的点 } this.map.setMapStyle(mapStyle); this.map.addEventListener("zoomend", function () { that.initInfoWindow("zoomend"); }); }, // 根据索引控制打点的显示隐藏 togglePoint: function togglePoint(index) { var position = new BMap.Point(this.pointsArr[index][this.longitudeKey], this.pointsArr[index][this.latitudeKey]); // console.log('toggle得到的positon', position); if (this.triggerType === "hover") { this.handlePopCard(position, index); } else if (this.triggerType === "click") { this.handlePopCard(position, index); // 单个模式下,隐藏当前索引对应的弹窗 // console.log('this.currentPopCardIndex', this.currentPopCardIndex,index); if (!this.multiPopCard && this.showInfoWin && this.currentPopCardIndex !== null && this.currentPopCardIndex !== index) { // console.log('执行关闭'); this.pointPopCards[this.currentPopCardIndex].hide(); } this.currentPopCardIndex = index; } // 移动地图中心点到当前点 this.map.panTo(position); }, initPoints: function initPoints() { var _this2 = this; var _this = this; // 如果已存在打点,清空原先的打点 // console.log('this.pointOverlays',this.pointOverlays); if (this.pointOverlays.length > 0) { this.pointOverlays.forEach(function (item) { // console.log('已存在打点,清空',item.pointMarkerBg); item.pointMarker && _this2.map.removeOverlay(item.pointMarker); item.pointMarkerBg && _this2.map.removeOverlay(item.pointMarkerBg); }); } this.pointOverlays = []; // 清空所有已存在弹窗 if (this.pointPopCards.length > 0) { this.pointPopCards.forEach(function (item) { // console.log('已存在弹窗,清空',item); item && _this2.map.removeOverlay(item); }); } this.pointPopCards = []; // 地图打点 this.pointsArr.forEach(function (item, index) { var pointOverlay = {}; var p = new BMap.Point(item[_this2.longitudeKey], item[_this2.latitudeKey]); var pointMarker = new BMap.Marker(p, { icon: new BMap.Icon(__webpack_require__(89), new BMap.Size(32, 32)) }); pointMarker.setZIndex(99); // 处理鼠标事件-弹窗 // 处理单个显示和多个显示弹窗, 默认是单个显示 if (_this2.triggerType === "hover") { pointMarker.addEventListener("mouseover", function (e) { var point = e.currentTarget; _this.handlePopCard(point.getPosition(), index); // _this.$emit("clickPoint", item); }); // 单个模式下,鼠标离开隐藏当前弹窗 if (!_this2.multiPopCard && _this2.showInfoWin) { pointMarker.addEventListener("mouseout", function (e) { _this.pointPopCards[index].hide(); }); } } else if (_this2.triggerType === "click") { pointMarker.addEventListener("click", function (e) { var point = e.currentTarget; _this.handlePopCard(point.getPosition(), index); // 单个模式下,隐藏当前索引对应的弹窗 // console.log('_this.currentPopCardIndex', _this.currentPopCardIndex,index); if (!_this.multiPopCard && this.showInfoWin && _this.currentPopCardIndex !== null && _this.currentPopCardIndex !== index) { // console.log('执行关闭'); _this.pointPopCards[_this.currentPopCardIndex].hide(); } _this.currentPopCardIndex = index; // _this.$emit("clickPoint", item); }); } pointOverlay.pointMarker = pointMarker; _this2.map.addOverlay(pointMarker); // console.log('判断是否存在pointOverlays[index]',this.pointOverlays[index]); if (_this2.pointOverlays[index]) { _this2.$set(_this2.pointOverlays[index], 'pointMarker', pointMarker); } else { _this2.pointOverlays[index] = { pointMarker: pointMarker }; } }); }, initLinesArr: function initLinesArr() { var _this3 = this; // 初始化分段数组 this.points.forEach(function (item) { var speed = parseInt(item.speed); for (var i = 0; i < _this3.colorsArr.length; i++) { var element = _this3.colorsArr[i]; if (element.max ? speed < element.max && speed > element.min : speed > element.min) { _this3.pushData(element.min, item, element); } else if (element.min === 0 && element.max === 0) { _this3.pushData(element.min, item, _this3.colorsArr[i + 1]); } } }); this.initLine(); }, pushData: function pushData(tag, value, color) { if (this.parsedPoints.length === 0 || this.parsedPoints[this.parsedPoints.length - 1].tag !== tag) { this.parsedPoints.push({ tag: tag, color: color.key, points: [] }); } this.parsedPoints[this.parsedPoints.length - 1].points.push(value); }, initLine: function initLine() { var _this4 = this; // 清除已有的线 var allLines = this.map.getOverlays(); allLines.forEach(function (item) { _this4.map.removeOverlay(item); }); // console.log("initLine", allLines); // 画轨迹 // 画不同颜色的路线 this.parsedPoints.forEach(function (item, index, arr) { // 解决断点情况。每个首尾相连 if (index + 1 < arr.length) { item.points.push(arr[index + 1].points[0]); } var polyLine = new BMap.Polyline(item.points.map(function (it) { return new BMap.Point(it[_this4.longitudeKey], it[_this4.latitudeKey]); }), { strokeColor: item.color, // 设置颜色 strokeWeight: _this4.lineWidth, // 宽度 strokeOpacity: 1 }); polyLine.disableMassClear(); _this4.pointsBMap.push(polyLine); _this4.map.addOverlay(polyLine); // 增加点击轨迹显示小车以及相应进度条的功能 if (_this4.poylineClickable) { polyLine.addEventListener('click', function (res) { // 获取点击的经纬度 var dot = res.point; var index = 0; var dist = 0; // 获取距离最近的一个点 拿到点的下标 // console.log('点击了轨迹',dot); for (var i = 0; i < item.points.length; i++) { var e = item.points[i]; var newDist = _this4.getGreatCircleDistance(dot.lat, dot.lng, e.latitude, e.longitude); if (dist === 0) dist = newDist; if (dist > newDist) { dist = newDist; index = i; } } var _index = item.points[index].indexKey; // 设置小车位置 _this4.curProgress = _this4.startIndex = _index; // this.CHANGE_PLAY_INDEX(this.play_index, 0); // console.log('this.points[_index]',_index,item.points[index]) var lng = _this4.points[_index][_this4.longitudeKey]; var lat = _this4.points[_index][_this4.latitudeKey]; _this4.angle = Number(_this4.points[_index].direction) + _this4.direction; _this4.initCar(lng, lat); _this4.pause(); }); } }); // 添加途经点 if (this.pointsArr.length > 0 && this.showPoints) this.initPoints(); console.timeEnd(); }, // 两个经纬度计算距离 getGreatCircleDistance: function getGreatCircleDistance(lat1, lng1, lat2, lng2) { var PI = Math.PI; function getRad(d) { return d * PI / 180.0; } var radLat1 = getRad(lat1); var radLat2 = getRad(lat2); var a = radLat1 - radLat2; var b = getRad(lng1) - getRad(lng2); var s = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(a / 2), 2) + Math.cos(radLat1) * Math.cos(radLat2) * Math.pow(Math.sin(b / 2), 2))); s = s * 6378.137; // EARTH_RADIUS; s = Math.round(s * 10000) / 10000; return s; }, initStartEndPoint: function initStartEndPoint() { var startIcon = new BMap.Icon(__webpack_require__(90), new BMap.Size(40, 40)); var endIcon = new BMap.Icon(__webpack_require__(91), new BMap.Size(40, 40)); var startPoint = new BMap.Point(this.points[0][this.longitudeKey], this.points[0][this.latitudeKey]); var start = new BMap.Marker(startPoint, { icon: startIcon }); var endPoint = new BMap.Point(this.points[this.points.length - 1][this.longitudeKey], this.points[this.points.length - 1][this.latitudeKey]); var end = new BMap.Marker(endPoint, { icon: endIcon }); start.disableMassClear(); end.disableMassClear(); this.map.addOverlay(start); this.map.addOverlay(end); }, initCar: function initCar(lng, lat) { this.car && this.map.removeOverlay(this.car); var that = this; // 创建小车图标 var myIcon = new BMap.Icon(__webpack_require__(92), new BMap.Size(94, 94)); // 创建Marker标注,使用小车图标 var pt = new BMap.Point(lng, lat); this.car = new BMap.Marker(pt, { icon: myIcon, rotation: that.angle, zIndex: 99 }); this.car.disableMassClear(); if (this.showInfoWindow) this.initInfoWindow(); // 将标注添加到地图 this.map.addOverlay(this.car); if (this.points.length > 0) { this.map.setCenter(new BMap.Point(lng, lat)); } // 点标记添加点击事件 this.car.addEventListener("click", function () { // console.log("点击了小车"); that.showInfoWindow = !that.showInfoWindow; that.$emit("carClick", { lng: lng, lat: lat, isShow: that.showInfoWindow }); // that.initCar() that.initInfoWindow(); // this.map.openInfoWindow(infoWindow, point); // 开启信息窗口 }); }, initInfoWindow: function initInfoWindow(type) { var _this5 = this; this.myCompOverlay && this.map.removeOverlay(this.myCompOverlay); if (this.showInfoWin && this.points.length > 0) { this.$nextTick(function () { if (type === "zoomend") { setTimeout(function () { _this5.myCompOverlay = new ComplexCustomOverlay(_this5.car.getPosition(), _this5.$refs.slotContainer); _this5.map.addOverlay(_this5.myCompOverlay); }, 100); } else { _this5.myCompOverlay = new ComplexCustomOverlay(_this5.car.getPosition(), _this5.$refs.slotContainer); _this5.map.addOverlay(_this5.myCompOverlay); } }); } }, handlePopCard: function handlePopCard(position, index) { var _this6 = this; if (this.showInfoWin && this.points.length > 0) { this.$nextTick(function () { // console.log('this.$refs.slotPopCard', this.$refs['slotPopCard'+index]); if (!_this6.pointPopCards[index]) { // console.log('point.getPosition()'+ index, position); _this6.pointPopCards[index] = new ComplexCustomOverlay(position, _this6.$refs['slotPopCard' + index]); _this6.map.addOverlay(_this6.pointPopCards[index]); // 更改overlay的z-index _this6.newZIndex++; _this6.pointPopCards[index].setZIndex(_this6.newZIndex); } else { // console.log('第'+index+'个的.isVisible()',this.pointPopCards[index].isVisible()); if (_this6.pointPopCards[index].isVisible()) { _this6.pointPopCards[index].hide(); } else { _this6.pointPopCards[index].show(); // 更改overlay的z-index _this6.newZIndex++; _this6.pointPopCards[index].setZIndex(_this6.newZIndex); } } // 增加途经点的背景图 if (_this6.showMarkerBg) { // console.log('pointMarkerBg',this.pointOverlays[index]); if (!_this6.pointOverlays[index] || !_this6.pointOverlays[index].pointMarkerBg) { // console.log('开始增加点的背景'); var pointMarkerBg = new BMap.Marker(position, { icon: new BMap.Icon(__webpack_require__(93), new BMap.Size(48, 48)) }); pointMarkerBg.setZIndex(98); _this6.map.addOverlay(pointMarkerBg); if (_this6.pointOverlays[index]) { _this6.$set(_this6.pointOverlays[index], 'pointMarkerBg', pointMarkerBg);