UNPKG

byted-vui

Version:

A Component Library for Vue.js.

1,880 lines (1,571 loc) 1.01 MB
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, { /******/ configurable: false, /******/ enumerable: true, /******/ get: getter /******/ }); /******/ } /******/ }; /******/ /******/ // 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 = 133); /******/ }) /************************************************************************/ /******/ ([ /* 0 */ /***/ (function(module, exports) { /* globals __VUE_SSR_CONTEXT__ */ // IMPORTANT: Do NOT use ES2015 features in this file. // This module is a runtime utility for cleaner component module output and will // be included in the final webpack user bundle. module.exports = function normalizeComponent ( rawScriptExports, compiledTemplate, functionalTemplate, injectStyles, scopeId, moduleIdentifier /* server only */ ) { var esModule var scriptExports = rawScriptExports = rawScriptExports || {} // ES6 modules interop var type = typeof rawScriptExports.default if (type === 'object' || type === 'function') { esModule = rawScriptExports scriptExports = rawScriptExports.default } // Vue.extend constructor export interop var options = typeof scriptExports === 'function' ? scriptExports.options : scriptExports // render functions if (compiledTemplate) { options.render = compiledTemplate.render options.staticRenderFns = compiledTemplate.staticRenderFns options._compiled = true } // functional template if (functionalTemplate) { options.functional = true } // scopedId if (scopeId) { options._scopeId = scopeId } var hook if (moduleIdentifier) { // server build hook = function (context) { // 2.3 injection context = context || // cached call (this.$vnode && this.$vnode.ssrContext) || // stateful (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional // 2.2 with runInNewContext: true if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') { context = __VUE_SSR_CONTEXT__ } // inject component styles if (injectStyles) { injectStyles.call(this, context) } // register component module identifier for async chunk inferrence if (context && context._registeredComponents) { context._registeredComponents.add(moduleIdentifier) } } // used by ssr in case component is cached and beforeCreate // never gets called options._ssrRegister = hook } else if (injectStyles) { hook = injectStyles } if (hook) { var functional = options.functional var existing = functional ? options.render : options.beforeCreate if (!functional) { // inject component registration as beforeCreate hook options.beforeCreate = existing ? [].concat(existing, hook) : [hook] } else { // for template-only hot-reload because in that case the render fn doesn't // go through the normalizer options._injectStyles = hook // register for functioal component in vue file options.render = function renderWithStyleInjection (h, context) { hook.call(context) return existing(h, context) } } } return { esModule: esModule, exports: scriptExports, options: options } } /***/ }), /* 1 */ /***/ (function(module, exports) { module.exports = require("byted-vui/lib/mixins/emitter"); /***/ }), /* 2 */ /***/ (function(module, exports) { module.exports = require("byted-vui/lib/utils/dom"); /***/ }), /* 3 */ /***/ (function(module, exports) { module.exports = require("byted-vui/lib/mixins/locale"); /***/ }), /* 4 */ /***/ (function(module, exports) { module.exports = require("byted-vui/lib/utils/util"); /***/ }), /* 5 */ /***/ (function(module, exports) { module.exports = require("vue"); /***/ }), /* 6 */ /***/ (function(module, exports) { module.exports = require("byted-vui/lib/input"); /***/ }), /* 7 */ /***/ (function(module, exports) { module.exports = require("byted-vui/lib/mixins/migrating"); /***/ }), /* 8 */ /***/ (function(module, exports) { module.exports = require("byted-vui/lib/utils/vue-popper"); /***/ }), /* 9 */ /***/ (function(module, exports) { module.exports = require("byted-vui/lib/utils/clickoutside"); /***/ }), /* 10 */ /***/ (function(module, exports) { module.exports = require("byted-vui/lib/utils/merge"); /***/ }), /* 11 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; exports.extractTimeFormat = exports.extractDateFormat = exports.nextYear = exports.prevYear = exports.nextMonth = exports.prevMonth = exports.changeYearMonthAndClampDate = exports.timeWithinRange = exports.limitTimeRange = exports.clearMilliseconds = exports.clearTime = exports.modifyWithTimeString = exports.modifyTime = exports.modifyDate = exports.range = exports.getRangeHours = exports.getWeekNumber = exports.getStartDateOfMonth = exports.nextDate = exports.prevDate = exports.getFirstDayOfMonth = exports.getDayCountOfYear = exports.getDayCountOfMonth = exports.parseDate = exports.formatDate = exports.isDateObject = exports.isDate = exports.toDate = undefined; var _date = __webpack_require__(233); var _date2 = _interopRequireDefault(_date); var _locale = __webpack_require__(16); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var weeks = ['sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat']; var months = ['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec']; var getI18nSettings = function getI18nSettings() { return { dayNamesShort: weeks.map(function (week) { return (0, _locale.t)('vi.datepicker.weeks.' + week); }), dayNames: weeks.map(function (week) { return (0, _locale.t)('vi.datepicker.weeks.' + week); }), monthNamesShort: months.map(function (month) { return (0, _locale.t)('vi.datepicker.months.' + month); }), monthNames: months.map(function (month, index) { return (0, _locale.t)('vi.datepicker.month' + (index + 1)); }), amPm: ['am', 'pm'] }; }; var newArray = function newArray(start, end) { var result = []; for (var i = start; i <= end; i++) { result.push(i); } return result; }; var toDate = exports.toDate = function toDate(date) { return isDate(date) ? new Date(date) : null; }; var isDate = exports.isDate = function isDate(date) { if (date === null || date === undefined) return false; if (isNaN(new Date(date).getTime())) return false; if (Array.isArray(date)) return false; // deal with `new Date([ new Date() ]) -> new Date()` return true; }; var isDateObject = exports.isDateObject = function isDateObject(val) { return val instanceof Date; }; var formatDate = exports.formatDate = function formatDate(date, format) { date = toDate(date); if (!date) return ''; return _date2.default.format(date, format || 'yyyy-MM-dd', getI18nSettings()); }; var parseDate = exports.parseDate = function parseDate(string, format) { return _date2.default.parse(string, format || 'yyyy-MM-dd', getI18nSettings()); }; var getDayCountOfMonth = exports.getDayCountOfMonth = function getDayCountOfMonth(year, month) { if (month === 3 || month === 5 || month === 8 || month === 10) { return 30; } if (month === 1) { if (year % 4 === 0 && year % 100 !== 0 || year % 400 === 0) { return 29; } else { return 28; } } return 31; }; var getDayCountOfYear = exports.getDayCountOfYear = function getDayCountOfYear(year) { var isLeapYear = year % 400 === 0 || year % 100 !== 0 && year % 4 === 0; return isLeapYear ? 366 : 365; }; var getFirstDayOfMonth = exports.getFirstDayOfMonth = function getFirstDayOfMonth(date) { var temp = new Date(date.getTime()); temp.setDate(1); return temp.getDay(); }; // see: https://stackoverflow.com/questions/3674539/incrementing-a-date-in-javascript // {prev, next} Date should work for Daylight Saving Time // Adding 24 * 60 * 60 * 1000 does not work in the above scenario var prevDate = exports.prevDate = function prevDate(date) { var amount = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1; return new Date(date.getFullYear(), date.getMonth(), date.getDate() - amount); }; var nextDate = exports.nextDate = function nextDate(date) { var amount = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1; return new Date(date.getFullYear(), date.getMonth(), date.getDate() + amount); }; var getStartDateOfMonth = exports.getStartDateOfMonth = function getStartDateOfMonth(year, month) { var result = new Date(year, month, 1); var day = result.getDay(); if (day === 0) { return prevDate(result, 7); } else { return prevDate(result, day); } }; var getWeekNumber = exports.getWeekNumber = function getWeekNumber(src) { if (!isDate(src)) return null; var date = new Date(src.getTime()); date.setHours(0, 0, 0, 0); // Thursday in current week decides the year. date.setDate(date.getDate() + 3 - (date.getDay() + 6) % 7); // January 4 is always in week 1. var week1 = new Date(date.getFullYear(), 0, 4); // Adjust to Thursday in week 1 and count number of weeks from date to week 1. // Rounding should be fine for Daylight Saving Time. Its shift should never be more than 12 hours. return 1 + Math.round(((date.getTime() - week1.getTime()) / 86400000 - 3 + (week1.getDay() + 6) % 7) / 7); }; var getRangeHours = exports.getRangeHours = function getRangeHours(ranges) { var hours = []; var disabledHours = []; (ranges || []).forEach(function (range) { var value = range.map(function (date) { return date.getHours(); }); disabledHours = disabledHours.concat(newArray(value[0], value[1])); }); if (disabledHours.length) { for (var i = 0; i < 24; i++) { hours[i] = disabledHours.indexOf(i) === -1; } } else { for (var _i = 0; _i < 24; _i++) { hours[_i] = false; } } return hours; }; var range = exports.range = function range(n) { // see https://stackoverflow.com/questions/3746725/create-a-javascript-array-containing-1-n return Array.apply(null, { length: n }).map(function (_, n) { return n; }); }; var modifyDate = exports.modifyDate = function modifyDate(date, y, m, d) { return new Date(y, m, d, date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds()); }; var modifyTime = exports.modifyTime = function modifyTime(date, h, m, s) { return new Date(date.getFullYear(), date.getMonth(), date.getDate(), h, m, s, date.getMilliseconds()); }; var modifyWithTimeString = exports.modifyWithTimeString = function modifyWithTimeString(date, time) { if (date == null || !time) { return date; } time = parseDate(time, 'HH:mm:ss'); return modifyTime(date, time.getHours(), time.getMinutes(), time.getSeconds()); }; var clearTime = exports.clearTime = function clearTime(date) { return new Date(date.getFullYear(), date.getMonth(), date.getDate()); }; var clearMilliseconds = exports.clearMilliseconds = function clearMilliseconds(date) { return new Date(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), 0); }; var limitTimeRange = exports.limitTimeRange = function limitTimeRange(date, ranges) { var format = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'HH:mm:ss'; // TODO: refactory a more elegant solution if (ranges.length === 0) return date; var normalizeDate = function normalizeDate(date) { return _date2.default.parse(_date2.default.format(date, format), format); }; var ndate = normalizeDate(date); var nranges = ranges.map(function (range) { return range.map(normalizeDate); }); if (nranges.some(function (nrange) { return ndate >= nrange[0] && ndate <= nrange[1]; })) return date; var minDate = nranges[0][0]; var maxDate = nranges[0][0]; nranges.forEach(function (nrange) { minDate = new Date(Math.min(nrange[0], minDate)); maxDate = new Date(Math.max(nrange[1], minDate)); }); var ret = ndate < minDate ? minDate : maxDate; // preserve Year/Month/Date return modifyDate(ret, date.getFullYear(), date.getMonth(), date.getDate()); }; var timeWithinRange = exports.timeWithinRange = function timeWithinRange(date, selectableRange, format) { var limitedDate = limitTimeRange(date, selectableRange, format); return limitedDate.getTime() === date.getTime(); }; var changeYearMonthAndClampDate = exports.changeYearMonthAndClampDate = function changeYearMonthAndClampDate(date, year, month) { // clamp date to the number of days in `year`, `month` // eg: (2010-1-31, 2010, 2) => 2010-2-28 var monthDate = Math.min(date.getDate(), getDayCountOfMonth(year, month)); return modifyDate(date, year, month, monthDate); }; var prevMonth = exports.prevMonth = function prevMonth(date) { var year = date.getFullYear(); var month = date.getMonth(); return month === 0 ? changeYearMonthAndClampDate(date, year - 1, 11) : changeYearMonthAndClampDate(date, year, month - 1); }; var nextMonth = exports.nextMonth = function nextMonth(date) { var year = date.getFullYear(); var month = date.getMonth(); return month === 11 ? changeYearMonthAndClampDate(date, year + 1, 0) : changeYearMonthAndClampDate(date, year, month + 1); }; var prevYear = exports.prevYear = function prevYear(date) { var amount = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1; var year = date.getFullYear(); var month = date.getMonth(); return changeYearMonthAndClampDate(date, year - amount, month); }; var nextYear = exports.nextYear = function nextYear(date) { var amount = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1; var year = date.getFullYear(); var month = date.getMonth(); return changeYearMonthAndClampDate(date, year + amount, month); }; var extractDateFormat = exports.extractDateFormat = function extractDateFormat(format) { return format.replace(/\W?m{1,2}|\W?ZZ/g, '').replace(/\W?h{1,2}|\W?s{1,3}|\W?a/gi, '').trim(); }; var extractTimeFormat = exports.extractTimeFormat = function extractTimeFormat(format) { return format.replace(/\W?D{1,2}|\W?Do|\W?d{1,4}|\W?M{1,4}|\W?y{2,4}/g, '').trim(); }; /***/ }), /* 12 */ /***/ (function(module, exports) { module.exports = require("byted-vui/lib/utils/popup"); /***/ }), /* 13 */ /***/ (function(module, exports) { module.exports = require("throttle-debounce/debounce"); /***/ }), /* 14 */ /***/ (function(module, exports) { module.exports = require("byted-vui/lib/checkbox"); /***/ }), /* 15 */ /***/ (function(module, exports) { module.exports = require("byted-vui/lib/button"); /***/ }), /* 16 */ /***/ (function(module, exports) { module.exports = require("byted-vui/lib/locale"); /***/ }), /* 17 */ /***/ (function(module, exports) { module.exports = require("byted-vui/lib/utils/resize-event"); /***/ }), /* 18 */ /***/ (function(module, exports) { module.exports = require("byted-vui/lib/scrollbar"); /***/ }), /* 19 */ /***/ (function(module, exports) { module.exports = require("byted-vui/lib/mixins/focus"); /***/ }), /* 20 */ /***/ (function(module, exports) { module.exports = require("byted-vui/lib/transitions/collapse-transition"); /***/ }), /* 21 */ /***/ (function(module, exports) { module.exports = require("byted-vui/lib/utils/vdom"); /***/ }), /* 22 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; var NODE_KEY = exports.NODE_KEY = '$treeNodeId'; var markNodeData = exports.markNodeData = function markNodeData(node, data) { if (!data || data[NODE_KEY]) return; Object.defineProperty(data, NODE_KEY, { value: node.id, enumerable: false, configurable: false, writable: false }); }; var getNodeKey = exports.getNodeKey = function getNodeKey(key, data) { if (!key) return data[NODE_KEY]; return data[key]; }; var findNearestComponent = exports.findNearestComponent = function findNearestComponent(element, componentName) { var target = element; while (target && target.tagName !== 'BODY') { if (target.__vue__ && target.__vue__.$options.name === componentName) { return target.__vue__; } target = target.parentNode; } return null; }; /***/ }), /* 23 */ /***/ (function(module, exports) { module.exports = require("byted-vui/lib/tooltip"); /***/ }), /* 24 */ /***/ (function(module, exports) { module.exports = require("byted-vui/lib/utils/shared"); /***/ }), /* 25 */ /***/ (function(module, exports) { module.exports = require("byted-vui/lib/tag"); /***/ }), /* 26 */ /***/ (function(module, exports) { module.exports = require("byted-vui/lib/utils/scroll-into-view"); /***/ }), /* 27 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; exports.default = { created: function created() { this.tableLayout.addObserver(this); }, destroyed: function destroyed() { this.tableLayout.removeObserver(this); }, computed: { tableLayout: function tableLayout() { var layout = this.layout; if (!layout && this.table) { layout = this.table.layout; } if (!layout) { throw new Error('Can not find table layout.'); } return layout; } }, mounted: function mounted() { this.onColumnsChange(this.tableLayout); this.onScrollableChange(this.tableLayout); }, updated: function updated() { if (this.__updated__) return; this.onColumnsChange(this.tableLayout); this.onScrollableChange(this.tableLayout); this.__updated__ = true; }, methods: { onColumnsChange: function onColumnsChange() { var cols = this.$el.querySelectorAll('colgroup > col'); if (!cols.length) return; var flattenColumns = this.tableLayout.getFlattenColumns(); var columnsMap = {}; flattenColumns.forEach(function (column) { columnsMap[column.id] = column; }); for (var i = 0, j = cols.length; i < j; i++) { var col = cols[i]; var name = col.getAttribute('name'); var column = columnsMap[name]; if (column) { col.setAttribute('width', column.realWidth || column.width); } } }, onScrollableChange: function onScrollableChange(layout) { var cols = this.$el.querySelectorAll('colgroup > col[name=gutter]'); for (var i = 0, j = cols.length; i < j; i++) { var col = cols[i]; col.setAttribute('width', layout.scrollY ? layout.gutterWidth : '0'); } var ths = this.$el.querySelectorAll('th.gutter'); for (var _i = 0, _j = ths.length; _i < _j; _i++) { var th = ths[_i]; th.style.width = layout.scrollY ? layout.gutterWidth + 'px' : '0'; th.style.display = layout.scrollY ? '' : 'none'; } } } }; /***/ }), /* 28 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_picker_vue__ = __webpack_require__(66); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_picker_vue___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_picker_vue__); /* harmony namespace reexport (unknown) */ for(var __WEBPACK_IMPORT_KEY__ in __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_picker_vue__) if(__WEBPACK_IMPORT_KEY__ !== 'default') (function(key) { __webpack_require__.d(__webpack_exports__, key, function() { return __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_picker_vue__[key]; }) }(__WEBPACK_IMPORT_KEY__)); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__node_modules_vue_loader_lib_template_compiler_index_id_data_v_4b870510_hasScoped_false_preserveWhitespace_false_buble_transforms_node_modules_vue_loader_lib_selector_type_template_index_0_picker_vue__ = __webpack_require__(234); var normalizeComponent = __webpack_require__(0) /* script */ /* template */ /* template functional */ var __vue_template_functional__ = false /* styles */ var __vue_styles__ = null /* scopeId */ var __vue_scopeId__ = null /* moduleIdentifier (server only) */ var __vue_module_identifier__ = null var Component = normalizeComponent( __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_picker_vue___default.a, __WEBPACK_IMPORTED_MODULE_1__node_modules_vue_loader_lib_template_compiler_index_id_data_v_4b870510_hasScoped_false_preserveWhitespace_false_buble_transforms_node_modules_vue_loader_lib_selector_type_template_index_0_picker_vue__["a" /* default */], __vue_template_functional__, __vue_styles__, __vue_scopeId__, __vue_module_identifier__ ) /* harmony default export */ __webpack_exports__["default"] = (Component.exports); /***/ }), /* 29 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_time_vue__ = __webpack_require__(68); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_time_vue___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_time_vue__); /* harmony namespace reexport (unknown) */ for(var __WEBPACK_IMPORT_KEY__ in __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_time_vue__) if(__WEBPACK_IMPORT_KEY__ !== 'default') (function(key) { __webpack_require__.d(__webpack_exports__, key, function() { return __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_time_vue__[key]; }) }(__WEBPACK_IMPORT_KEY__)); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__node_modules_vue_loader_lib_template_compiler_index_id_data_v_72a54c92_hasScoped_false_preserveWhitespace_false_buble_transforms_node_modules_vue_loader_lib_selector_type_template_index_0_time_vue__ = __webpack_require__(237); var normalizeComponent = __webpack_require__(0) /* script */ /* template */ /* template functional */ var __vue_template_functional__ = false /* styles */ var __vue_styles__ = null /* scopeId */ var __vue_scopeId__ = null /* moduleIdentifier (server only) */ var __vue_module_identifier__ = null var Component = normalizeComponent( __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_time_vue___default.a, __WEBPACK_IMPORTED_MODULE_1__node_modules_vue_loader_lib_template_compiler_index_id_data_v_72a54c92_hasScoped_false_preserveWhitespace_false_buble_transforms_node_modules_vue_loader_lib_selector_type_template_index_0_time_vue__["a" /* default */], __vue_template_functional__, __vue_styles__, __vue_scopeId__, __vue_module_identifier__ ) /* harmony default export */ __webpack_exports__["default"] = (Component.exports); /***/ }), /* 30 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; exports.default = function (element, options) { if (_vue2.default.prototype.$isServer) return; var moveFn = function moveFn(event) { if (options.drag) { options.drag(event); } }; var upFn = function upFn(event) { document.removeEventListener('mousemove', moveFn); document.removeEventListener('mouseup', upFn); document.onselectstart = null; document.ondragstart = null; isDragging = false; if (options.end) { options.end(event); } }; element.addEventListener('mousedown', function (event) { if (isDragging) return; document.onselectstart = function () { return false; }; document.ondragstart = function () { return false; }; document.addEventListener('mousemove', moveFn); document.addEventListener('mouseup', upFn); isDragging = true; if (options.start) { options.start(event); } }); }; var _vue = __webpack_require__(5); var _vue2 = _interopRequireDefault(_vue); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var isDragging = false; /***/ }), /* 31 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // exports.default = { name: 'ViPager', props: { currentPage: Number, pageCount: Number, pagerCount: Number, disabled: Boolean }, watch: { showPrevMore: function showPrevMore(val) { if (!val) this.quickprevIconClass = 'vi-icon-more'; }, showNextMore: function showNextMore(val) { if (!val) this.quicknextIconClass = 'vi-icon-more'; } }, methods: { onPagerClick: function onPagerClick(event) { var target = event.target; if (target.tagName === 'UL' || this.disabled) { return; } var newPage = Number(event.target.textContent); var pageCount = this.pageCount; var currentPage = this.currentPage; var pagerCountOffset = this.pagerCount - 2; if (target.className.indexOf('more') !== -1) { if (target.className.indexOf('quickprev') !== -1) { newPage = currentPage - pagerCountOffset; } else if (target.className.indexOf('quicknext') !== -1) { newPage = currentPage + pagerCountOffset; } } /* istanbul ignore if */ if (!isNaN(newPage)) { if (newPage < 1) { newPage = 1; } if (newPage > pageCount) { newPage = pageCount; } } if (newPage !== currentPage) { this.$emit('change', newPage); } }, onMouseenter: function onMouseenter(direction) { if (this.disabled) return; if (direction === 'left') { this.quickprevIconClass = 'vi-icon-d-arrow-left'; } else { this.quicknextIconClass = 'vi-icon-d-arrow-right'; } } }, computed: { pagers: function pagers() { var pagerCount = this.pagerCount; var halfPagerCount = (pagerCount - 1) / 2; var currentPage = Number(this.currentPage); var pageCount = Number(this.pageCount); var showPrevMore = false; var showNextMore = false; if (pageCount > pagerCount) { if (currentPage > pagerCount - halfPagerCount) { showPrevMore = true; } if (currentPage < pageCount - halfPagerCount) { showNextMore = true; } } var array = []; if (showPrevMore && !showNextMore) { var startPage = pageCount - (pagerCount - 2); for (var i = startPage; i < pageCount; i++) { array.push(i); } } else if (!showPrevMore && showNextMore) { for (var _i = 2; _i < pagerCount; _i++) { array.push(_i); } } else if (showPrevMore && showNextMore) { var offset = Math.floor(pagerCount / 2) - 1; for (var _i2 = currentPage - offset; _i2 <= currentPage + offset; _i2++) { array.push(_i2); } } else { for (var _i3 = 2; _i3 < pageCount; _i3++) { array.push(_i3); } } this.showPrevMore = showPrevMore; this.showNextMore = showNextMore; return array; } }, data: function data() { return { current: null, showPrevMore: false, showNextMore: false, quicknextIconClass: 'vi-icon-more', quickprevIconClass: 'vi-icon-more' }; } }; /***/ }), /* 32 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; var _popup = __webpack_require__(12); var _popup2 = _interopRequireDefault(_popup); var _migrating = __webpack_require__(7); var _migrating2 = _interopRequireDefault(_migrating); var _emitter = __webpack_require__(1); var _emitter2 = _interopRequireDefault(_emitter); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } exports.default = { name: 'ViDialog', mixins: [_popup2.default, _emitter2.default, _migrating2.default], props: { title: { type: String, default: '' }, modal: { type: Boolean, default: true }, modalAppendToBody: { type: Boolean, default: true }, appendToBody: { type: Boolean, default: false }, lockScroll: { type: Boolean, default: true }, closeOnClickModal: { type: Boolean, default: true }, closeOnPressEscape: { type: Boolean, default: true }, showClose: { type: Boolean, default: true }, width: String, fullscreen: Boolean, customClass: { type: String, default: '' }, top: { type: String, default: '15vh' }, beforeClose: Function, center: { type: Boolean, default: false } }, data: function data() { return { closed: false }; }, watch: { visible: function visible(val) { var _this = this; if (val) { this.closed = false; this.$emit('open'); this.$el.addEventListener('scroll', this.updatePopper); this.$nextTick(function () { _this.$refs.dialog.scrollTop = 0; }); if (this.appendToBody) { document.body.appendChild(this.$el); } } else { this.$el.removeEventListener('scroll', this.updatePopper); if (!this.closed) this.$emit('close'); } } }, computed: { style: function style() { var style = {}; if (this.width) { style.width = this.width; } if (!this.fullscreen) { style.marginTop = this.top; } return style; } }, methods: { getMigratingConfig: function getMigratingConfig() { return { props: { 'size': 'size is removed.' } }; }, handleWrapperClick: function handleWrapperClick() { if (!this.closeOnClickModal) return; this.handleClose(); }, handleClose: function handleClose() { if (typeof this.beforeClose === 'function') { this.beforeClose(this.hide); } else { this.hide(); } }, hide: function hide(cancel) { if (cancel !== false) { this.$emit('update:visible', false); this.$emit('close'); this.closed = true; } }, updatePopper: function updatePopper() { this.broadcast('ViSelectDropdown', 'updatePopper'); this.broadcast('ViDropdownMenu', 'updatePopper'); }, afterLeave: function afterLeave() { this.$emit('closed'); } }, mounted: function mounted() { if (this.visible) { this.rendered = true; this.open(); if (this.appendToBody) { document.body.appendChild(this.$el); } } }, destroyed: function destroyed() { // if appendToBody is true, remove DOM node after destroy if (this.appendToBody && this.$el && this.$el.parentNode) { this.$el.parentNode.removeChild(this.$el); } } }; // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // /***/ }), /* 33 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; var _debounce = __webpack_require__(13); var _debounce2 = _interopRequireDefault(_debounce); var _input = __webpack_require__(6); var _input2 = _interopRequireDefault(_input); var _clickoutside = __webpack_require__(9); var _clickoutside2 = _interopRequireDefault(_clickoutside); var _autocompleteSuggestions = __webpack_require__(146); var _autocompleteSuggestions2 = _interopRequireDefault(_autocompleteSuggestions); var _emitter = __webpack_require__(1); var _emitter2 = _interopRequireDefault(_emitter); var _migrating = __webpack_require__(7); var _migrating2 = _interopRequireDefault(_migrating); var _util = __webpack_require__(4); var _focus = __webpack_require__(19); var _focus2 = _interopRequireDefault(_focus); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // // exports.default = { name: 'ViAutocomplete', mixins: [_emitter2.default, (0, _focus2.default)('input'), _migrating2.default], inheritAttrs: false, componentName: 'ViAutocomplete', components: { ViInput: _input2.default, ViAutocompleteSuggestions: _autocompleteSuggestions2.default }, directives: { Clickoutside: _clickoutside2.default }, props: { valueKey: { type: String, default: 'value' }, popperClass: String, popperOptions: Object, placeholder: String, disabled: Boolean, name: String, size: String, value: String, maxlength: Number, minlength: Number, autofocus: Boolean, fetchSuggestions: Function, triggerOnFocus: { type: Boolean, default: true }, customItem: String, selectWhenUnmatched: { type: Boolean, default: false }, prefixIcon: String, suffixIcon: String, label: String, debounce: { type: Number, default: 300 }, placement: { type: String, default: 'bottom-start' }, hideLoading: Boolean }, data: function data() { return { activated: false, suggestions: [], loading: false, highlightedIndex: -1, suggestionDisabled: false }; }, computed: { suggestionVisible: function suggestionVisible() { var suggestions = this.suggestions; var isValidData = Array.isArray(suggestions) && suggestions.length > 0; return (isValidData || this.loading) && this.activated; }, id: function id() { return 'vi-autocomplete-' + (0, _util.generateId)(); } }, watch: { suggestionVisible: function suggestionVisible(val) { this.broadcast('ViAutocompleteSuggestions', 'visible', [val, this.$refs.input.$refs.input.offsetWidth]); } }, methods: { getMigratingConfig: function getMigratingConfig() { return { props: { 'custom-item': 'custom-item is removed, use scoped slot instead.', 'props': 'props is removed, use value-key instead.' } }; }, getData: function getData(queryString) { var _this = this; if (this.suggestionDisabled) { return; } this.loading = true; this.fetchSuggestions(queryString, function (suggestions) { _this.loading = false; if (_this.suggestionDisabled) { return; } if (Array.isArray(suggestions)) { _this.suggestions = suggestions; } else { console.error('[Viement Error][Autocomplete]autocomplete suggestions must be an array'); } }); }, handleChange: function handleChange(value) { this.$emit('input', value); this.suggestionDisabled = false; if (!this.triggerOnFocus && !value) { this.suggestionDisabled = true; this.suggestions = []; return; } this.debouncedGetData(value); }, handleFocus: function handleFocus(event) { this.activated = true; this.$emit('focus', event); if (this.triggerOnFocus) { this.debouncedGetData(this.value); } }, handleBlur: function handleBlur(event) { this.$emit('blur', event); }, close: function close(e) { this.activated = false; }, handleKeyEnter: function handleKeyEnter(e) { var _this2 = this; if (this.suggestionVisible && this.highlightedIndex >= 0 && this.highlightedIndex < this.suggestions.length) { e.preventDefault(); this.select(this.suggestions[this.highlightedIndex]); } else if (this.selectWhenUnmatched) { this.$emit('select', { value: this.value }); this.$nextTick(function (_) { _this2.suggestions = []; _this2.highlightedIndex = -1; }); } }, select: function select(item) { var _this3 = this; this.$emit('input', item[this.valueKey]); this.$emit('select', item); this.$nextTick(function (_) { _this3.suggestions = []; _this3.highlightedIndex = -1; }); }, highlight: function highlight(index) { if (!this.suggestionVisible || this.loading) { return; } if (index < 0) { this.highlightedIndex = -1; return; } if (index >= this.suggestions.length) { index = this.suggestions.length - 1; } var suggestion = this.$refs.suggestions.$el.querySelector('.vi-autocomplete-suggestion__wrap'); var suggestionList = suggestion.querySelectorAll('.vi-autocomplete-suggestion__list li'); var highlightItem = suggestionList[index]; var scrollTop = suggestion.scrollTop; var offsetTop = highlightItem.offsetTop; if (offsetTop + highlightItem.scrollHeight > scrollTop + suggestion.clientHeight) { suggestion.scrollTop += highlightItem.scrollHeight; } if (offsetTop < scrollTop) { suggestion.scrollTop -= highlightItem.scrollHeight; } this.highlightedIndex = index; this.$el.querySelector('.vi-input__inner').setAttribute('aria-activedescendant', this.id + '-item-' + this.highlightedIndex); } }, mounted: function mounted() { var _this4 = this; this.debouncedGetData = (0, _debounce2.default)(this.debounce, this.getData); this.$on('item-click', function (item) { _this4.select(item); }); var $input = this.$el.querySelector('.vi-input__inner'); $input.setAttribute('role', 'textbox'); $input.setAttribute('aria-autocomplete', 'list'); $input.setAttribute('aria-controls', 'id'); $input.setAttribute('aria-activedescendant', this.id + '-item-' + this.highlightedIndex); }, beforeDestroy: function beforeDestroy() { this.$refs.suggestions.$destroy(); } }; /***/ }), /* 34 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; var _vuePopper = __webpack_require__(8); var _vuePopper2 = _interopRequireDefault(_vuePopper); var _emitter = __webpack_require__(1); var _emitter2 = _interopRequireDefault(_emitter); var _scrollbar = __webpack_require__(18); var _scrollbar2 = _interopRequireDefault(_scrollbar); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } exports.default = { components: { ViScrollbar: _scrollbar2.default }, mixins: [_vuePopper2.default, _emitter2.default], componentName: 'ViAutocompleteSuggestions', data: function data() { return { parent: this.$parent, dropdownWidth: '' }; }, props: { options: { default: function _default() { return { gpuAcceleration: false }; } }, id: String }, methods: { select: function select(item) { this.dispatch('ViAutocomplete', 'item-click', item); } }, updated: function updated() { var _this = this; this.$nextTick(function (_) { _this.popperJS && _this.updatePopper(); }); }, mounted: function mounted() { this.$parent.popperElm = this.popperElm = this.$el; this.referenceElm = this.$parent.$refs.input.$refs.input; this.referenceList = this.$el.querySelector('.vi-autocomplete-suggestion__list'); this.referenceList.setAttribute('role', 'listbox'); this.referenceList.setAttribute('id', this.id); }, created: function created() { var _this2 = this; this.$on('visible', function (val, inputWidth) { _this2.dropdownWidth = inputWidth + 'px'; _this2.showPopper = val; }); } }; // // // // // // // // // // // // // // // // // // // /***/ }), /* 35 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; exports.__esModule = true; var _clickoutside = __webpack_require__(9); var _clickoutside2 = _interopRequireDefault(_clickoutside); var _emitter = __webpack_require__(1); var _emitter2 = _interopRequireDefault(_emitter); var _migrating = __webpack_require__(7); var _migrating2 = _interopRequireDefault(_migrating); var _button = __webpack_require__(15); var _button2 = _interopRequireDefault(_button); var _buttonGroup = __webpack_require__(151); var _buttonGroup2 = _interopRequireDefault(_buttonGroup); var _util = __webpack_require__(4); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } exports.default = { name: 'ViDropdown', componentName: 'ViDropdown', mixins: [_emitter2.default, _migrating2.default], directives: { Clickoutside: _clickoutside2.default }, components: { ViButton: _button2.default, ViButtonGroup: _buttonGroup2.default }, provide: function provide() { return { dropdown: this }; }, props: { trigger: { type: String, default: 'hover' }, type: String, size: { type: String, default: '' }, splitButton: Boolean, hideOnClick: { type: Boolean, default: true }, placement: { type: String, default: 'bottom-end' }, visibleArrow: { default: true }, showTimeout: { type: Number, default: 250 }, hideTimeout: { type: Number, default: 150 } }, data: function data() { return { timeout: null, visible: false, triggerVi: null, menuItems: null, menuItemsArray: null, dropdownVi: null, focusing: false, listId: 'dropdown-menu-' + (0, _util.generateId)() }; }, computed: { dropdownSize: function dropdownSize() { return this.size || (this.$BytedVui || {}).size; } }, mounted: function mounted() { this.$on('menu-item-click', this.handleMenuItemClick); this.initEvent(); this.initAria(); }, watch: { visible: function visible(val) { this.broadcast('ViDropdownMenu', 'visible', val); this.$emit('visible-change', val); }, focusing: function focusing(val) { var selfDefine = this.$el.querySelector('.vi-dropdown-selfdefine'); if (selfDefine) { // 自定义 if (val) { selfDefine.className += ' focusing'; } else { selfDefine.className = selfDefine.className.replace('focusing', ''); } } } }, methods: { getMigratingConfig: function getMigratingConfig() { return { props: { 'menu-align': 'menu-align is renamed to placement.' } }; }, show: function show() { var _this = this; if (this.triggerElm.disabled) return; clearTimeout(this.timeout); this.timeout = setTimeout(function () { _this.visible = true; }, this.trigger === 'click' ? 0 : this.showTimeout); }, hide: function hide() { var _this2 = this; if (this.triggerElm.disabled) return; this.removeTabindex(); this.resetTabindex(this.triggerElm); clearTimeout(this.timeout); this.timeout = setTimeout(function () { _this2.visible = false; }, this.trigger === 'click' ? 0 : this.hideTimeout); }, handleClick: function handleClick() { if (this.triggerElm.disabled) return; if (this.visible) { this.hide(); } else { this.show(); } }, handleTriggerKeyDown: function handleTriggerKeyDown(ev) { var keyCode = ev.keyCode; if ([38, 40].indexOf(keyCode) > -1) { // up/down this.removeTabindex(); this.resetTabindex(this.menuItems[0]); this.menuItems[0].focus(); ev.preventDefault(); ev.stopPropagation(); } else if (keyCode === 13) { // space enter选中 this.handleClick(); } else if ([9, 27].indexOf(keyCode) > -1) { // tab || esc this.hide(); } return; }, handleItemKeyDown: function handleItemKeyDown(ev) { var keyCode = ev.keyCode; var target = ev.target; var currentIndex = this.menuItemsArray.indexOf(target); var max = this.menuItemsArray.length - 1; var nextIndex = void 0; if ([38, 40].indexOf(keyCode) > -1) { // up/down if (keyCode === 38) { // up nextIndex = currentIndex !== 0 ? currentIndex - 1 : 0; } else { // down nextIndex = currentIndex < max ? currentIndex + 1 : max; } this.removeTabindex(); this.resetTabindex(this.menuItems[nextIndex]); this.menuItems[nextIndex].focus(); ev.preventDefault(); ev.stopPropagation(); } else if (keyCode === 13) { // enter选中 this.triggerElm.focus(); target.click(); if (this.hideOnClick) { // click关闭 this.visible = false; } } else if ([9, 27].indexOf(keyCode) > -1) { // tab // esc this.hide(); this.triggerElm.focus(); } return; }, resetTabindex: function resetTabindex(ele) { // 下次tab时组件聚焦元素 this.removeTabindex(); ele.setAttribute('tabindex', '0'); // 下次期望的聚焦元素 }, removeTabindex: function removeTabindex() { this.triggerElm.setAttribute('tabindex', '-1'); this.menuItemsArray.forEach(function (item) { item.setAttribute('tabindex', '-1'); }); }, initAria: function initAria() { this.dropdownElm.setAttribute('id', this.listId); this.triggerElm.setAttribute('aria-haspopup', 'list'); this.triggerElm.setAttribute('aria-controls', this.listId); this.menuItems = this.dropdownElm.querySelectorAll("[tabindex='-1']"); this.menuItemsArray = Array.prototype.slice.call(this.menuItems); if (!this.splitButton) { // 自定义 this.triggerElm.setAttribute('role', 'button'); this.triggerElm.setAttribute('tabindex', '0'); this.triggerElm.setAttribute('class', (this.triggerElm.getAttribute('class') || '') + ' vi-dropdown-selfdefine'); // 控制 } }, initEvent: function initEvent() { var _this3 = this; var trigger = this.trigger, show = this.show, hide = this.hide, handleClick = this.handleClick, splitButton = this.splitButton, handleTriggerKeyDown = this.handleTriggerKeyDown, handleItemKeyDown = this.handleItemKeyDown; this.triggerElm = splitButton ? this.$refs.trigger.$el : this.$slots.default[0].elm; var dropdownElm = this.dropdownElm = this.$slots.dropdown[0].elm; this.triggerElm.addEventListener('keydown', handleTriggerKeyDown); // triggerElm keydown dropdownElm.addEventListener('keydown', handleItemKeyDown, true); // item keydown // 控制自定义元素的样式 if (!splitButton) { this.triggerElm.addEventListener('focus', function () { _this3.focusing = true; }); this.triggerElm.addEventListener('blur', function () { _this3.focusing = false; }); this.triggerElm.addEventListener('click', function () { _this3.focusing = false; }); } if (trigger === 'hover') {