UNPKG

ant-design-vue

Version:

An enterprise-class UI design language and Vue-based implementation

1,661 lines (1,508 loc) 4.35 MB
/*! * * ant-design-vue v1.7.7 * * Copyright 2017-present, ant-design-vue. * All rights reserved. * */ (function webpackUniversalModuleDefinition(root, factory) { if(typeof exports === 'object' && typeof module === 'object') module.exports = factory(require("moment"), require("vue")); else if(typeof define === 'function' && define.amd) define(["moment", "vue"], factory); else if(typeof exports === 'object') exports["antd"] = factory(require("moment"), require("vue")); else root["antd"] = factory(root["moment"], root["Vue"]); })(window, function(__WEBPACK_EXTERNAL_MODULE_moment__, __WEBPACK_EXTERNAL_MODULE_vue__) { return /******/ (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 = ""; /******/ /******/ /******/ // Load entry module and return exports /******/ return __webpack_require__(__webpack_require__.s = 0); /******/ }) /************************************************************************/ /******/ ({ /***/ "./components sync recursive ^\\.\\/[^_][\\w-]+\\/style\\/index\\.js?$": /*!*************************************************************!*\ !*** ./components sync ^\.\/[^_][\w-]+\/style\/index\.js?$ ***! \*************************************************************/ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { var map = { "./affix/style/index.js": "./components/affix/style/index.js", "./alert/style/index.js": "./components/alert/style/index.js", "./anchor/style/index.js": "./components/anchor/style/index.js", "./auto-complete/style/index.js": "./components/auto-complete/style/index.js", "./avatar/style/index.js": "./components/avatar/style/index.js", "./back-top/style/index.js": "./components/back-top/style/index.js", "./badge/style/index.js": "./components/badge/style/index.js", "./base/style/index.js": "./components/base/style/index.js", "./breadcrumb/style/index.js": "./components/breadcrumb/style/index.js", "./button/style/index.js": "./components/button/style/index.js", "./calendar/style/index.js": "./components/calendar/style/index.js", "./card/style/index.js": "./components/card/style/index.js", "./carousel/style/index.js": "./components/carousel/style/index.js", "./cascader/style/index.js": "./components/cascader/style/index.js", "./checkbox/style/index.js": "./components/checkbox/style/index.js", "./col/style/index.js": "./components/col/style/index.js", "./collapse/style/index.js": "./components/collapse/style/index.js", "./comment/style/index.js": "./components/comment/style/index.js", "./config-provider/style/index.js": "./components/config-provider/style/index.js", "./date-picker/style/index.js": "./components/date-picker/style/index.js", "./descriptions/style/index.js": "./components/descriptions/style/index.js", "./divider/style/index.js": "./components/divider/style/index.js", "./drawer/style/index.js": "./components/drawer/style/index.js", "./dropdown/style/index.js": "./components/dropdown/style/index.js", "./empty/style/index.js": "./components/empty/style/index.js", "./form-model/style/index.js": "./components/form-model/style/index.js", "./form/style/index.js": "./components/form/style/index.js", "./grid/style/index.js": "./components/grid/style/index.js", "./icon/style/index.js": "./components/icon/style/index.js", "./input-number/style/index.js": "./components/input-number/style/index.js", "./input/style/index.js": "./components/input/style/index.js", "./layout/style/index.js": "./components/layout/style/index.js", "./list/style/index.js": "./components/list/style/index.js", "./locale-provider/style/index.js": "./components/locale-provider/style/index.js", "./mentions/style/index.js": "./components/mentions/style/index.js", "./menu/style/index.js": "./components/menu/style/index.js", "./message/style/index.js": "./components/message/style/index.js", "./modal/style/index.js": "./components/modal/style/index.js", "./notification/style/index.js": "./components/notification/style/index.js", "./page-header/style/index.js": "./components/page-header/style/index.js", "./pagination/style/index.js": "./components/pagination/style/index.js", "./popconfirm/style/index.js": "./components/popconfirm/style/index.js", "./popover/style/index.js": "./components/popover/style/index.js", "./progress/style/index.js": "./components/progress/style/index.js", "./radio/style/index.js": "./components/radio/style/index.js", "./rate/style/index.js": "./components/rate/style/index.js", "./result/style/index.js": "./components/result/style/index.js", "./row/style/index.js": "./components/row/style/index.js", "./select/style/index.js": "./components/select/style/index.js", "./skeleton/style/index.js": "./components/skeleton/style/index.js", "./slider/style/index.js": "./components/slider/style/index.js", "./space/style/index.js": "./components/space/style/index.js", "./spin/style/index.js": "./components/spin/style/index.js", "./statistic/style/index.js": "./components/statistic/style/index.js", "./steps/style/index.js": "./components/steps/style/index.js", "./switch/style/index.js": "./components/switch/style/index.js", "./table/style/index.js": "./components/table/style/index.js", "./tabs/style/index.js": "./components/tabs/style/index.js", "./tag/style/index.js": "./components/tag/style/index.js", "./time-picker/style/index.js": "./components/time-picker/style/index.js", "./timeline/style/index.js": "./components/timeline/style/index.js", "./tooltip/style/index.js": "./components/tooltip/style/index.js", "./transfer/style/index.js": "./components/transfer/style/index.js", "./tree-select/style/index.js": "./components/tree-select/style/index.js", "./tree/style/index.js": "./components/tree/style/index.js", "./upload/style/index.js": "./components/upload/style/index.js", "./version/style/index.js": "./components/version/style/index.js" }; function webpackContext(req) { var id = webpackContextResolve(req); return __webpack_require__(id); } function webpackContextResolve(req) { if(!__webpack_require__.o(map, req)) { var e = new Error("Cannot find module '" + req + "'"); e.code = 'MODULE_NOT_FOUND'; throw e; } return map[req]; } webpackContext.keys = function webpackContextKeys() { return Object.keys(map); }; webpackContext.resolve = webpackContextResolve; module.exports = webpackContext; webpackContext.id = "./components sync recursive ^\\.\\/[^_][\\w-]+\\/style\\/index\\.js?$"; /***/ }), /***/ "./components/_util/BaseMixin.js": /*!***************************************!*\ !*** ./components/_util/BaseMixin.js ***! \***************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! babel-runtime/helpers/toConsumableArray */ "./node_modules/babel-runtime/helpers/toConsumableArray.js"); /* harmony import */ var babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! babel-runtime/helpers/extends */ "./node_modules/babel-runtime/helpers/extends.js"); /* harmony import */ var babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_1__); /* harmony import */ var _props_util__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./props-util */ "./components/_util/props-util.js"); /* harmony default export */ __webpack_exports__["default"] = ({ methods: { setState: function setState() { var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; var callback = arguments[1]; var newState = typeof state === 'function' ? state(this.$data, this.$props) : state; if (this.getDerivedStateFromProps) { var s = this.getDerivedStateFromProps(Object(_props_util__WEBPACK_IMPORTED_MODULE_2__["getOptionProps"])(this), babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_1___default()({}, this.$data, newState)); if (s === null) { return; } else { newState = babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_1___default()({}, newState, s || {}); } } babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_1___default()(this.$data, newState); this.$forceUpdate(); this.$nextTick(function () { callback && callback(); }); }, __emit: function __emit() { // 直接调用listeners,底层组件不需要vueTool记录events var args = [].slice.call(arguments, 0); var eventName = args[0]; var event = this.$listeners[eventName]; if (args.length && event) { if (Array.isArray(event)) { for (var i = 0, l = event.length; i < l; i++) { event[i].apply(event, babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_0___default()(args.slice(1))); } } else { event.apply(undefined, babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_0___default()(args.slice(1))); } } } } }); /***/ }), /***/ "./components/_util/ContainerRender.jsx": /*!**********************************************!*\ !*** ./components/_util/ContainerRender.jsx ***! \**********************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var _vue_types__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./vue-types */ "./components/_util/vue-types/index.js"); /* harmony default export */ __webpack_exports__["default"] = ({ props: { autoMount: _vue_types__WEBPACK_IMPORTED_MODULE_0__["default"].bool.def(true), autoDestroy: _vue_types__WEBPACK_IMPORTED_MODULE_0__["default"].bool.def(true), visible: _vue_types__WEBPACK_IMPORTED_MODULE_0__["default"].bool, forceRender: _vue_types__WEBPACK_IMPORTED_MODULE_0__["default"].bool.def(false), parent: _vue_types__WEBPACK_IMPORTED_MODULE_0__["default"].any, getComponent: _vue_types__WEBPACK_IMPORTED_MODULE_0__["default"].func.isRequired, getContainer: _vue_types__WEBPACK_IMPORTED_MODULE_0__["default"].func.isRequired, children: _vue_types__WEBPACK_IMPORTED_MODULE_0__["default"].func.isRequired }, mounted: function mounted() { if (this.autoMount) { this.renderComponent(); } }, updated: function updated() { if (this.autoMount) { this.renderComponent(); } }, beforeDestroy: function beforeDestroy() { if (this.autoDestroy) { this.removeContainer(); } }, methods: { removeContainer: function removeContainer() { if (this.container) { this._component && this._component.$destroy(); this.container.parentNode.removeChild(this.container); this.container = null; this._component = null; } }, renderComponent: function renderComponent() { var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; var ready = arguments[1]; var visible = this.visible, forceRender = this.forceRender, getContainer = this.getContainer, parent = this.parent; var self = this; if (visible || parent._component || parent.$refs._component || forceRender) { var el = this.componentEl; if (!this.container) { this.container = getContainer(); el = document.createElement('div'); this.componentEl = el; this.container.appendChild(el); } // self.getComponent 不要放在 render 中,会因为响应式数据问题导致,多次触发 render var com = { component: self.getComponent(props) }; if (!this._component) { this._component = new this.$root.constructor({ el: el, parent: self, data: { _com: com }, mounted: function mounted() { this.$nextTick(function () { if (ready) { ready.call(self); } }); }, updated: function updated() { this.$nextTick(function () { if (ready) { ready.call(self); } }); }, methods: { setComponent: function setComponent(_com) { this.$data._com = _com; } }, render: function render() { return this.$data._com.component; } }); } else { this._component.setComponent(com); } } } }, render: function render() { return this.children({ renderComponent: this.renderComponent, removeContainer: this.removeContainer }); } }); /***/ }), /***/ "./components/_util/FormDecoratorDirective.js": /*!****************************************************!*\ !*** ./components/_util/FormDecoratorDirective.js ***! \****************************************************/ /*! exports provided: antDecorator, default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "antDecorator", function() { return antDecorator; }); function antDecorator(Vue) { return Vue.directive('decorator', {}); } /* harmony default export */ __webpack_exports__["default"] = ({ // just for tag install: function install(Vue) { antDecorator(Vue); } }); /***/ }), /***/ "./components/_util/KeyCode.js": /*!*************************************!*\ !*** ./components/_util/KeyCode.js ***! \*************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /** * @ignore * some key-codes definition and utils from closure-library * @author yiminghe@gmail.com */ var KeyCode = { /** * MAC_ENTER */ MAC_ENTER: 3, /** * BACKSPACE */ BACKSPACE: 8, /** * TAB */ TAB: 9, /** * NUMLOCK on FF/Safari Mac */ NUM_CENTER: 12, // NUMLOCK on FF/Safari Mac /** * ENTER */ ENTER: 13, /** * SHIFT */ SHIFT: 16, /** * CTRL */ CTRL: 17, /** * ALT */ ALT: 18, /** * PAUSE */ PAUSE: 19, /** * CAPS_LOCK */ CAPS_LOCK: 20, /** * ESC */ ESC: 27, /** * SPACE */ SPACE: 32, /** * PAGE_UP */ PAGE_UP: 33, // also NUM_NORTH_EAST /** * PAGE_DOWN */ PAGE_DOWN: 34, // also NUM_SOUTH_EAST /** * END */ END: 35, // also NUM_SOUTH_WEST /** * HOME */ HOME: 36, // also NUM_NORTH_WEST /** * LEFT */ LEFT: 37, // also NUM_WEST /** * UP */ UP: 38, // also NUM_NORTH /** * RIGHT */ RIGHT: 39, // also NUM_EAST /** * DOWN */ DOWN: 40, // also NUM_SOUTH /** * PRINT_SCREEN */ PRINT_SCREEN: 44, /** * INSERT */ INSERT: 45, // also NUM_INSERT /** * DELETE */ DELETE: 46, // also NUM_DELETE /** * ZERO */ ZERO: 48, /** * ONE */ ONE: 49, /** * TWO */ TWO: 50, /** * THREE */ THREE: 51, /** * FOUR */ FOUR: 52, /** * FIVE */ FIVE: 53, /** * SIX */ SIX: 54, /** * SEVEN */ SEVEN: 55, /** * EIGHT */ EIGHT: 56, /** * NINE */ NINE: 57, /** * QUESTION_MARK */ QUESTION_MARK: 63, // needs localization /** * A */ A: 65, /** * B */ B: 66, /** * C */ C: 67, /** * D */ D: 68, /** * E */ E: 69, /** * F */ F: 70, /** * G */ G: 71, /** * H */ H: 72, /** * I */ I: 73, /** * J */ J: 74, /** * K */ K: 75, /** * L */ L: 76, /** * M */ M: 77, /** * N */ N: 78, /** * O */ O: 79, /** * P */ P: 80, /** * Q */ Q: 81, /** * R */ R: 82, /** * S */ S: 83, /** * T */ T: 84, /** * U */ U: 85, /** * V */ V: 86, /** * W */ W: 87, /** * X */ X: 88, /** * Y */ Y: 89, /** * Z */ Z: 90, /** * META */ META: 91, // WIN_KEY_LEFT /** * WIN_KEY_RIGHT */ WIN_KEY_RIGHT: 92, /** * CONTEXT_MENU */ CONTEXT_MENU: 93, /** * NUM_ZERO */ NUM_ZERO: 96, /** * NUM_ONE */ NUM_ONE: 97, /** * NUM_TWO */ NUM_TWO: 98, /** * NUM_THREE */ NUM_THREE: 99, /** * NUM_FOUR */ NUM_FOUR: 100, /** * NUM_FIVE */ NUM_FIVE: 101, /** * NUM_SIX */ NUM_SIX: 102, /** * NUM_SEVEN */ NUM_SEVEN: 103, /** * NUM_EIGHT */ NUM_EIGHT: 104, /** * NUM_NINE */ NUM_NINE: 105, /** * NUM_MULTIPLY */ NUM_MULTIPLY: 106, /** * NUM_PLUS */ NUM_PLUS: 107, /** * NUM_MINUS */ NUM_MINUS: 109, /** * NUM_PERIOD */ NUM_PERIOD: 110, /** * NUM_DIVISION */ NUM_DIVISION: 111, /** * F1 */ F1: 112, /** * F2 */ F2: 113, /** * F3 */ F3: 114, /** * F4 */ F4: 115, /** * F5 */ F5: 116, /** * F6 */ F6: 117, /** * F7 */ F7: 118, /** * F8 */ F8: 119, /** * F9 */ F9: 120, /** * F10 */ F10: 121, /** * F11 */ F11: 122, /** * F12 */ F12: 123, /** * NUMLOCK */ NUMLOCK: 144, /** * SEMICOLON */ SEMICOLON: 186, // needs localization /** * DASH */ DASH: 189, // needs localization /** * EQUALS */ EQUALS: 187, // needs localization /** * COMMA */ COMMA: 188, // needs localization /** * PERIOD */ PERIOD: 190, // needs localization /** * SLASH */ SLASH: 191, // needs localization /** * APOSTROPHE */ APOSTROPHE: 192, // needs localization /** * SINGLE_QUOTE */ SINGLE_QUOTE: 222, // needs localization /** * OPEN_SQUARE_BRACKET */ OPEN_SQUARE_BRACKET: 219, // needs localization /** * BACKSLASH */ BACKSLASH: 220, // needs localization /** * CLOSE_SQUARE_BRACKET */ CLOSE_SQUARE_BRACKET: 221, // needs localization /** * WIN_KEY */ WIN_KEY: 224, /** * MAC_FF_META */ MAC_FF_META: 224, // Firefox (Gecko) fires this for the meta key instead of 91 /** * WIN_IME */ WIN_IME: 229 }; /* whether text and modified key is entered at the same time. */ KeyCode.isTextModifyingKeyEvent = function isTextModifyingKeyEvent(e) { var keyCode = e.keyCode; if (e.altKey && !e.ctrlKey || e.metaKey || // Function keys don't generate text keyCode >= KeyCode.F1 && keyCode <= KeyCode.F12) { return false; } // The following keys are quite harmless, even in combination with // CTRL, ALT or SHIFT. switch (keyCode) { case KeyCode.ALT: case KeyCode.CAPS_LOCK: case KeyCode.CONTEXT_MENU: case KeyCode.CTRL: case KeyCode.DOWN: case KeyCode.END: case KeyCode.ESC: case KeyCode.HOME: case KeyCode.INSERT: case KeyCode.LEFT: case KeyCode.MAC_FF_META: case KeyCode.META: case KeyCode.NUMLOCK: case KeyCode.NUM_CENTER: case KeyCode.PAGE_DOWN: case KeyCode.PAGE_UP: case KeyCode.PAUSE: case KeyCode.PRINT_SCREEN: case KeyCode.RIGHT: case KeyCode.SHIFT: case KeyCode.UP: case KeyCode.WIN_KEY: case KeyCode.WIN_KEY_RIGHT: return false; default: return true; } }; /* whether character is entered. */ KeyCode.isCharacterKey = function isCharacterKey(keyCode) { if (keyCode >= KeyCode.ZERO && keyCode <= KeyCode.NINE) { return true; } if (keyCode >= KeyCode.NUM_ZERO && keyCode <= KeyCode.NUM_MULTIPLY) { return true; } if (keyCode >= KeyCode.A && keyCode <= KeyCode.Z) { return true; } // Safari sends zero key code for non-latin characters. if (window.navigation.userAgent.indexOf('WebKit') !== -1 && keyCode === 0) { return true; } switch (keyCode) { case KeyCode.SPACE: case KeyCode.QUESTION_MARK: case KeyCode.NUM_PLUS: case KeyCode.NUM_MINUS: case KeyCode.NUM_PERIOD: case KeyCode.NUM_DIVISION: case KeyCode.SEMICOLON: case KeyCode.DASH: case KeyCode.EQUALS: case KeyCode.COMMA: case KeyCode.PERIOD: case KeyCode.SLASH: case KeyCode.APOSTROPHE: case KeyCode.SINGLE_QUOTE: case KeyCode.OPEN_SQUARE_BRACKET: case KeyCode.BACKSLASH: case KeyCode.CLOSE_SQUARE_BRACKET: return true; default: return false; } }; /* harmony default export */ __webpack_exports__["default"] = (KeyCode); /***/ }), /***/ "./components/_util/Portal.js": /*!************************************!*\ !*** ./components/_util/Portal.js ***! \************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var _vue_types__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./vue-types */ "./components/_util/vue-types/index.js"); /* harmony import */ var _vnode__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./vnode */ "./components/_util/vnode.js"); /* harmony default export */ __webpack_exports__["default"] = ({ name: 'Portal', props: { getContainer: _vue_types__WEBPACK_IMPORTED_MODULE_0__["default"].func.isRequired, children: _vue_types__WEBPACK_IMPORTED_MODULE_0__["default"].any.isRequired, didUpdate: _vue_types__WEBPACK_IMPORTED_MODULE_0__["default"].func }, mounted: function mounted() { this.createContainer(); }, updated: function updated() { var _this = this; var didUpdate = this.$props.didUpdate; if (didUpdate) { this.$nextTick(function () { didUpdate(_this.$props); }); } }, beforeDestroy: function beforeDestroy() { this.removeContainer(); }, methods: { createContainer: function createContainer() { this._container = this.$props.getContainer(); this.$forceUpdate(); }, removeContainer: function removeContainer() { if (this._container && this._container.parentNode) { this._container.parentNode.removeChild(this._container); } } }, render: function render() { if (this._container) { return Object(_vnode__WEBPACK_IMPORTED_MODULE_1__["cloneElement"])(this.$props.children, { directives: [{ name: 'ant-portal', value: this._container }] }); } return null; } }); /***/ }), /***/ "./components/_util/PortalWrapper.js": /*!*******************************************!*\ !*** ./components/_util/PortalWrapper.js ***! \*******************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var babel_helper_vue_jsx_merge_props__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! babel-helper-vue-jsx-merge-props */ "./node_modules/babel-helper-vue-jsx-merge-props/index.js"); /* harmony import */ var babel_helper_vue_jsx_merge_props__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(babel_helper_vue_jsx_merge_props__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! babel-runtime/helpers/typeof */ "./node_modules/babel-runtime/helpers/typeof.js"); /* harmony import */ var babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_1__); /* harmony import */ var _vue_types__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./vue-types */ "./components/_util/vue-types/index.js"); /* harmony import */ var _switchScrollingEffect__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./switchScrollingEffect */ "./components/_util/switchScrollingEffect.js"); /* harmony import */ var _setStyle__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./setStyle */ "./components/_util/setStyle.js"); /* harmony import */ var _Portal__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./Portal */ "./components/_util/Portal.js"); var openCount = 0; var windowIsUndefined = !(typeof window !== 'undefined' && window.document && window.document.createElement); // https://github.com/ant-design/ant-design/issues/19340 // https://github.com/ant-design/ant-design/issues/19332 var cacheOverflow = {}; /* harmony default export */ __webpack_exports__["default"] = ({ name: 'PortalWrapper', props: { wrapperClassName: _vue_types__WEBPACK_IMPORTED_MODULE_2__["default"].string, forceRender: _vue_types__WEBPACK_IMPORTED_MODULE_2__["default"].bool, getContainer: _vue_types__WEBPACK_IMPORTED_MODULE_2__["default"].any, children: _vue_types__WEBPACK_IMPORTED_MODULE_2__["default"].func, visible: _vue_types__WEBPACK_IMPORTED_MODULE_2__["default"].bool }, data: function data() { var visible = this.$props.visible; openCount = visible ? openCount + 1 : openCount; return {}; }, updated: function updated() { this.setWrapperClassName(); }, watch: { visible: function visible(val) { openCount = val ? openCount + 1 : openCount - 1; }, getContainer: function getContainer(_getContainer, prevGetContainer) { var getContainerIsFunc = typeof _getContainer === 'function' && typeof prevGetContainer === 'function'; if (getContainerIsFunc ? _getContainer.toString() !== prevGetContainer.toString() : _getContainer !== prevGetContainer) { this.removeCurrentContainer(false); } } }, beforeDestroy: function beforeDestroy() { var visible = this.$props.visible; // 离开时不会 render, 导到离开时数值不变,改用 func 。。 openCount = visible && openCount ? openCount - 1 : openCount; this.removeCurrentContainer(visible); }, methods: { getParent: function getParent() { var getContainer = this.$props.getContainer; if (getContainer) { if (typeof getContainer === 'string') { return document.querySelectorAll(getContainer)[0]; } if (typeof getContainer === 'function') { return getContainer(); } if ((typeof getContainer === 'undefined' ? 'undefined' : babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_1___default()(getContainer)) === 'object' && getContainer instanceof window.HTMLElement) { return getContainer; } } return document.body; }, getDomContainer: function getDomContainer() { if (windowIsUndefined) { return null; } if (!this.container) { this.container = document.createElement('div'); var parent = this.getParent(); if (parent) { parent.appendChild(this.container); } } this.setWrapperClassName(); return this.container; }, setWrapperClassName: function setWrapperClassName() { var wrapperClassName = this.$props.wrapperClassName; if (this.container && wrapperClassName && wrapperClassName !== this.container.className) { this.container.className = wrapperClassName; } }, savePortal: function savePortal(c) { // Warning: don't rename _component // https://github.com/react-component/util/pull/65#discussion_r352407916 this._component = c; }, removeCurrentContainer: function removeCurrentContainer() { this.container = null; this._component = null; }, /** * Enhance ./switchScrollingEffect * 1. Simulate document body scroll bar with * 2. Record body has overflow style and recover when all of PortalWrapper invisible * 3. Disable body scroll when PortalWrapper has open * * @memberof PortalWrapper */ switchScrollingEffect: function switchScrollingEffect() { if (openCount === 1 && !Object.keys(cacheOverflow).length) { Object(_switchScrollingEffect__WEBPACK_IMPORTED_MODULE_3__["default"])(); // Must be set after switchScrollingEffect cacheOverflow = Object(_setStyle__WEBPACK_IMPORTED_MODULE_4__["default"])({ overflow: 'hidden', overflowX: 'hidden', overflowY: 'hidden' }); } else if (!openCount) { Object(_setStyle__WEBPACK_IMPORTED_MODULE_4__["default"])(cacheOverflow); cacheOverflow = {}; Object(_switchScrollingEffect__WEBPACK_IMPORTED_MODULE_3__["default"])(true); } } }, render: function render() { var h = arguments[0]; var _$props = this.$props, children = _$props.children, forceRender = _$props.forceRender, visible = _$props.visible; var portal = null; var childProps = { getOpenCount: function getOpenCount() { return openCount; }, getContainer: this.getDomContainer, switchScrollingEffect: this.switchScrollingEffect }; if (forceRender || visible || this._component) { portal = h(_Portal__WEBPACK_IMPORTED_MODULE_5__["default"], babel_helper_vue_jsx_merge_props__WEBPACK_IMPORTED_MODULE_0___default()([{ attrs: { getContainer: this.getDomContainer, children: children(childProps) } }, { directives: [{ name: 'ant-ref', value: this.savePortal }] }])); } return portal; } }); /***/ }), /***/ "./components/_util/antDirective.js": /*!******************************************!*\ !*** ./components/_util/antDirective.js ***! \******************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var vue_ref__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue-ref */ "./node_modules/vue-ref/index.js"); /* harmony import */ var vue_ref__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(vue_ref__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var _antInputDirective__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./antInputDirective */ "./components/_util/antInputDirective.js"); /* harmony import */ var _FormDecoratorDirective__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./FormDecoratorDirective */ "./components/_util/FormDecoratorDirective.js"); /* harmony import */ var _portalDirective__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./portalDirective */ "./components/_util/portalDirective.js"); /* harmony default export */ __webpack_exports__["default"] = ({ install: function install(Vue) { Vue.use(vue_ref__WEBPACK_IMPORTED_MODULE_0___default.a, { name: 'ant-ref' }); Object(_antInputDirective__WEBPACK_IMPORTED_MODULE_1__["antInput"])(Vue); Object(_FormDecoratorDirective__WEBPACK_IMPORTED_MODULE_2__["antDecorator"])(Vue); Object(_portalDirective__WEBPACK_IMPORTED_MODULE_3__["antPortal"])(Vue); } }); /***/ }), /***/ "./components/_util/antInputDirective.js": /*!***********************************************!*\ !*** ./components/_util/antInputDirective.js ***! \***********************************************/ /*! exports provided: inBrowser, UA, isIE9, antInput, default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "inBrowser", function() { return inBrowser; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "UA", function() { return UA; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isIE9", function() { return isIE9; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "antInput", function() { return antInput; }); /** * Not type checking this file because flow doesn't like attaching * properties to Elements. */ var inBrowser = typeof window !== 'undefined'; var UA = inBrowser && window.navigator.userAgent.toLowerCase(); var isIE9 = UA && UA.indexOf('msie 9.0') > 0; function makeMap(str, expectsLowerCase) { var map = Object.create(null); var list = str.split(','); for (var i = 0; i < list.length; i++) { map[list[i]] = true; } return expectsLowerCase ? function (val) { return map[val.toLowerCase()]; } : function (val) { return map[val]; }; } var isTextInputType = makeMap('text,number,password,search,email,tel,url'); function onCompositionStart(e) { e.target.composing = true; } function onCompositionEnd(e) { // prevent triggering an input event for no reason if (!e.target.composing) return; e.target.composing = false; trigger(e.target, 'input'); } function trigger(el, type) { var e = document.createEvent('HTMLEvents'); e.initEvent(type, true, true); el.dispatchEvent(e); } /* istanbul ignore if */ if (isIE9) { // http://www.matts411.com/post/internet-explorer-9-oninput/ document.addEventListener('selectionchange', function () { var el = document.activeElement; if (el && el.vmodel) { trigger(el, 'input'); } }); } function antInput(Vue) { return Vue.directive('ant-input', { inserted: function inserted(el, binding, vnode) { if (vnode.tag === 'textarea' || isTextInputType(el.type)) { if (!binding.modifiers || !binding.modifiers.lazy) { el.addEventListener('compositionstart', onCompositionStart); el.addEventListener('compositionend', onCompositionEnd); // Safari < 10.2 & UIWebView doesn't fire compositionend when // switching focus before confirming composition choice // this also fixes the issue where some browsers e.g. iOS Chrome // fires "change" instead of "input" on autocomplete. el.addEventListener('change', onCompositionEnd); /* istanbul ignore if */ if (isIE9) { el.vmodel = true; } } } } }); } /* harmony default export */ __webpack_exports__["default"] = ({ install: function install(Vue) { antInput(Vue); } }); /***/ }), /***/ "./components/_util/colors.js": /*!************************************!*\ !*** ./components/_util/colors.js ***! \************************************/ /*! exports provided: PresetColorTypes */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PresetColorTypes", function() { return PresetColorTypes; }); /* harmony import */ var _type__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./type */ "./components/_util/type.js"); var PresetColorTypes = Object(_type__WEBPACK_IMPORTED_MODULE_0__["tuple"])('pink', 'red', 'yellow', 'orange', 'cyan', 'green', 'blue', 'purple', 'geekblue', 'magenta', 'volcano', 'gold', 'lime'); /***/ }), /***/ "./components/_util/createChainedFunction.js": /*!***************************************************!*\ !*** ./components/_util/createChainedFunction.js ***! \***************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return createChainedFunction; }); /** * Safe chained function * * Will only create a new function if needed, * otherwise will pass back existing functions or null. * * @returns {function|null} */ function createChainedFunction() { var args = [].slice.call(arguments, 0); if (args.length === 1) { return args[0]; } return function chainedFunction() { for (var i = 0; i < args.length; i++) { if (args[i] && args[i].apply) { args[i].apply(this, arguments); } } }; } /***/ }), /***/ "./components/_util/css-animation/Event.js": /*!*************************************************!*\ !*** ./components/_util/css-animation/Event.js ***! \*************************************************/ /*! exports provided: default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); var START_EVENT_NAME_MAP = { transitionstart: { transition: 'transitionstart', WebkitTransition: 'webkitTransitionStart', MozTransition: 'mozTransitionStart', OTransition: 'oTransitionStart', msTransition: 'MSTransitionStart' }, animationstart: { animation: 'animationstart', WebkitAnimation: 'webkitAnimationStart', MozAnimation: 'mozAnimationStart', OAnimation: 'oAnimationStart', msAnimation: 'MSAnimationStart' } }; var END_EVENT_NAME_MAP = { transitionend: { transition: 'transitionend', WebkitTransition: 'webkitTransitionEnd', MozTransition: 'mozTransitionEnd', OTransition: 'oTransitionEnd', msTransition: 'MSTransitionEnd' }, animationend: { animation: 'animationend', WebkitAnimation: 'webkitAnimationEnd', MozAnimation: 'mozAnimationEnd', OAnimation: 'oAnimationEnd', msAnimation: 'MSAnimationEnd' } }; var startEvents = []; var endEvents = []; function detectEvents() { var testEl = document.createElement('div'); var style = testEl.style; if (!('AnimationEvent' in window)) { delete START_EVENT_NAME_MAP.animationstart.animation; delete END_EVENT_NAME_MAP.animationend.animation; } if (!('TransitionEvent' in window)) { delete START_EVENT_NAME_MAP.transitionstart.transition; delete END_EVENT_NAME_MAP.transitionend.transition; } function process(EVENT_NAME_MAP, events) { for (var baseEventName in EVENT_NAME_MAP) { if (EVENT_NAME_MAP.hasOwnProperty(baseEventName)) { var baseEvents = EVENT_NAME_MAP[baseEventName]; for (var styleName in baseEvents) { if (styleName in style) { events.push(baseEvents[styleName]); break; } } } } } process(START_EVENT_NAME_MAP, startEvents); process(END_EVENT_NAME_MAP, endEvents); } if (typeof window !== 'undefined' && typeof document !== 'undefined') { detectEvents(); } function addEventListener(node, eventName, eventListener) { node.addEventListener(eventName, eventListener, false); } function removeEventListener(node, eventName, eventListener) { node.removeEventListener(eventName, eventListener, false); } var TransitionEvents = { // Start events startEvents: startEvents, addStartEventListener: function addStartEventListener(node, eventListener) { if (startEvents.length === 0) { window.setTimeout(eventListener, 0); return; } startEvents.forEach(function (startEvent) { addEventListener(node, startEvent, eventListener); }); }, removeStartEventListener: function removeStartEventListener(node, eventListener) { if (startEvents.length === 0) { return; } startEvents.forEach(function (startEvent) { removeEventListener(node, startEvent, eventListener); }); }, // End events endEvents: endEvents, addEndEventListener: function addEndEventListener(node, eventListener) { if (endEvents.length === 0) { window.setTimeout(eventListener, 0); return; } endEvents.forEach(function (endEvent) { addEventListener(node, endEvent, eventListener); }); }, removeEndEventListener: function removeEndEventListener(node, eventListener) { if (endEvents.length === 0) { return; } endEvents.forEach(function (endEvent) { removeEventListener(node, endEvent, eventListener); }); } }; /* harmony default export */ __webpack_exports__["default"] = (TransitionEvents); /***/ }), /***/ "./components/_util/css-animation/index.js": /*!*************************************************!*\ !*** ./components/_util/css-animation/index.js ***! \*************************************************/ /*! exports provided: isCssAnimationSupported, default */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isCssAnimationSupported", function() { return isCssAnimationSupported; }); /* harmony import */ var babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! babel-runtime/helpers/typeof */ "./node_modules/babel-runtime/helpers/typeof.js"); /* harmony import */ var babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var _Event__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Event */ "./components/_util/css-animation/Event.js"); /* harmony import */ var component_classes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! component-classes */ "./node_modules/component-classes/index.js"); /* harmony import */ var component_classes__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(component_classes__WEBPACK_IMPORTED_MODULE_2__); /* harmony import */ var _requestAnimationTimeout__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../requestAnimationTimeout */ "./components/_util/requestAnimationTimeout.js"); // https://github.com/yiminghe/css-animation 1.5.0 var isCssAnimationSupported = _Event__WEBPACK_IMPORTED_MODULE_1__["default"].endEvents.length !== 0; var capitalPrefixes = ['Webkit', 'Moz', 'O', // ms is special .... ! 'ms']; var prefixes = ['-webkit-', '-moz-', '-o-', 'ms-', '']; function getStyleProperty(node, name) { // old ff need null, https://developer.mozilla.org/en-US/docs/Web/API/Window/getComputedStyle var style = window.getComputedStyle(node, null); var ret = ''; for (var i = 0; i < prefixes.length; i++) { ret = style.getPropertyValue(prefixes[i] + name); if (ret) { break; } } return ret; } function fixBrowserByTimeout(node) { if (isCssAnimationSupported) { var transitionDelay = parseFloat(getStyleProperty(node, 'transition-delay')) || 0; var transitionDuration = parseFloat(getStyleProperty(node, 'transition-duration')) || 0; var animationDelay = parseFloat(getStyleProperty(node, 'animation-delay')) || 0; var animationDuration = parseFloat(getStyleProperty(node, 'animation-duration')) || 0; var time = Math.max(transitionDuration + transitionDelay, animationDuration + animationDelay); // sometimes, browser bug node.rcEndAnimTimeout = setTimeout(function () { node.rcEndAnimTimeout = null; if (node.rcEndListener) { node.rcEndListener(); } }, time * 1000 + 200); } } function clearBrowserBugTimeout(node) { if (node.rcEndAnimTimeout) { clearTimeout(node.rcEndAnimTimeout); node.rcEndAnimTimeout = null; } } var cssAnimation = function cssAnimation(node, transitionName, endCallback) { var nameIsObj = (typeof transitionName === 'undefined' ? 'undefined' : babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_0___default()(transitionName)) === 'object'; var className = nameIsObj ? transitionName.name : transitionName; var activeClassName = nameIsObj ? transitionName.active : transitionName + '-active'; var end = endCallback; var start = void 0; var active = void 0; var nodeClasses = component_classes__WEBPACK_IMPORTED_MODULE_2___default()(node); if (endCallback && Object.prototype.toString.call(endCallback) === '[object Object]') { end = endCallback.end; start = endCallback.start; active = endCallback.active; } if (node.rcEndListener) { node.rcEndListener(); } node.rcEndListener = function (e) { if (e && e.target !== node) { return; } if (node.rcAnimTimeout) { Object(_requestAnimationTimeout__WEBPACK_IMPORTED_MODULE_3__["cancelAnimationTimeout"])(node.rcAnimTimeout); node.rcAnimTimeout = null; } clearBrowserBugTimeout(node); nodeClasses.remove(className); nodeClasses.remove(activeClassName); _Event__WEBPACK_IMPORTED_MODULE_1__["default"].removeEndEventListener(node, node.rcEndListener); node.rcEndListener = null; // Usually this optional end is used for informing an owner of // a leave animation and telling it to remove the child. if (end) { end(); } }; _Event__WEBPACK_IMPORTED_MODULE_1__["default"].addEndEventListener(node, node.rcEndListener); if (start) { start(); } nodeClasses.add(className); node.rcAnimTimeout = Object(_requestAnimationTimeout__WEBPACK_IMPORTED_MODULE_3__["requestAnimationTimeout"])(function () { node.rcAnimTimeout = null; nodeClasses.add(className); nodeClasses.add(activeClassName); if (active) { Object(_requestAnimationTimeout__WEBPACK_IMPORTED_MODULE_3__["requestAnimationTimeout"])(active, 0); } fixBrowserByTimeout(node); // 30ms for firefox }, 30); return { stop: function stop() { if (node.rcEndListener) { node.rcEndListener(); } } }; }; cssAnimation.style = function (node, style, callback) { if (node.rcEndListener) { node.rcEndListener(); } node.rcEndListener = function (e) { if (e && e.target !== node) { return; } if (node.rcAnimTimeout) { Object(_requestAnimationTimeout__WEBPACK_IMPORTED_MODULE_3__["cancelAnimationTimeout"])(node.rcAnimTimeout); node.rcAnimTimeout = null; } clearBrowserBugTimeout(node); _Event__WEBPACK_IMPORTED_MODULE_1__["default"].removeEndEventListener(node, node.rcEndListener); node.rcEndListener = null; // Usually this optional callback is used for informing an owner of // a leave animation and telling it to remove the child. if (callback) { callback(); } }; _Event__WEBPACK_IMPORTED_MODULE_1__["default"].addEndEventListener(node, node.rcEndListener); node.rcAnimTimeout = Object(_requestAnimationTimeout__WEBPACK_IMPORTED_MODULE_3__["requestAnimationTimeout"])(function () {