yk-smart-ui-test
Version:
A Component Library for Vue.js.
1,755 lines (1,575 loc) • 112 kB
JavaScript
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 = 110);
/******/ })
/************************************************************************/
/******/ ({
/***/ 0:
/***/ (function(module, exports) {
module.exports = require("vue");
/***/ }),
/***/ 1:
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return on; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return off; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return once; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return hasClass; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return addClass; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return removeClass; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return getStyle; });
/* unused harmony export setStyle */
/* unused harmony export isScroll */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return getScrollContainer; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return isInContainer; });
/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0);
/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(vue__WEBPACK_IMPORTED_MODULE_0__);
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; };
/* istanbul ignore next */
var isServer = vue__WEBPACK_IMPORTED_MODULE_0___default.a.prototype.$isServer;
var SPECIAL_CHARS_REGEXP = /([\:\-\_]+(.))/g;
var MOZ_HACK_REGEXP = /^moz([A-Z])/;
var ieVersion = isServer ? 0 : Number(document.documentMode);
/* istanbul ignore next */
var trim = function trim(string) {
return (string || '').replace(/^[\s\uFEFF]+|[\s\uFEFF]+$/g, '');
};
/* istanbul ignore next */
var camelCase = function camelCase(name) {
return name.replace(SPECIAL_CHARS_REGEXP, function (_, separator, letter, offset) {
return offset ? letter.toUpperCase() : letter;
}).replace(MOZ_HACK_REGEXP, 'Moz$1');
};
/* istanbul ignore next */
var on = function () {
if (!isServer && document.addEventListener) {
return function (element, event, handler) {
if (element && event && handler) {
element.addEventListener(event, handler, false);
}
};
} else {
return function (element, event, handler) {
if (element && event && handler) {
element.attachEvent('on' + event, handler);
}
};
}
}();
/* istanbul ignore next */
var off = function () {
if (!isServer && document.removeEventListener) {
return function (element, event, handler) {
if (element && event) {
element.removeEventListener(event, handler, false);
}
};
} else {
return function (element, event, handler) {
if (element && event) {
element.detachEvent('on' + event, handler);
}
};
}
}();
/* istanbul ignore next */
var once = function once(el, event, fn) {
var listener = function listener() {
if (fn) {
fn.apply(this, arguments);
}
off(el, event, listener);
};
on(el, event, listener);
};
/* istanbul ignore next */
function hasClass(el, cls) {
if (!el || !cls) return false;
if (cls.indexOf(' ') !== -1) throw new Error('className should not contain space.');
if (el.classList) {
return el.classList.contains(cls);
} else {
return (' ' + el.className + ' ').indexOf(' ' + cls + ' ') > -1;
}
};
/* istanbul ignore next */
function addClass(el, cls) {
if (!el) return;
var curClass = el.className;
var classes = (cls || '').split(' ');
for (var i = 0, j = classes.length; i < j; i++) {
var clsName = classes[i];
if (!clsName) continue;
if (el.classList) {
el.classList.add(clsName);
} else if (!hasClass(el, clsName)) {
curClass += ' ' + clsName;
}
}
if (!el.classList) {
el.setAttribute('class', curClass);
}
};
/* istanbul ignore next */
function removeClass(el, cls) {
if (!el || !cls) return;
var classes = cls.split(' ');
var curClass = ' ' + el.className + ' ';
for (var i = 0, j = classes.length; i < j; i++) {
var clsName = classes[i];
if (!clsName) continue;
if (el.classList) {
el.classList.remove(clsName);
} else if (hasClass(el, clsName)) {
curClass = curClass.replace(' ' + clsName + ' ', ' ');
}
}
if (!el.classList) {
el.setAttribute('class', trim(curClass));
}
};
/* istanbul ignore next */
var getStyle = ieVersion < 9 ? function (element, styleName) {
if (isServer) return;
if (!element || !styleName) return null;
styleName = camelCase(styleName);
if (styleName === 'float') {
styleName = 'styleFloat';
}
try {
switch (styleName) {
case 'opacity':
try {
return element.filters.item('alpha').opacity / 100;
} catch (e) {
return 1.0;
}
default:
return element.style[styleName] || element.currentStyle ? element.currentStyle[styleName] : null;
}
} catch (e) {
return element.style[styleName];
}
} : function (element, styleName) {
if (isServer) return;
if (!element || !styleName) return null;
styleName = camelCase(styleName);
if (styleName === 'float') {
styleName = 'cssFloat';
}
try {
var computed = document.defaultView.getComputedStyle(element, '');
return element.style[styleName] || computed ? computed[styleName] : null;
} catch (e) {
return element.style[styleName];
}
};
/* istanbul ignore next */
function setStyle(element, styleName, value) {
if (!element || !styleName) return;
if ((typeof styleName === 'undefined' ? 'undefined' : _typeof(styleName)) === 'object') {
for (var prop in styleName) {
if (styleName.hasOwnProperty(prop)) {
setStyle(element, prop, styleName[prop]);
}
}
} else {
styleName = camelCase(styleName);
if (styleName === 'opacity' && ieVersion < 9) {
element.style.filter = isNaN(value) ? '' : 'alpha(opacity=' + value * 100 + ')';
} else {
element.style[styleName] = value;
}
}
};
var isScroll = function isScroll(el, vertical) {
if (isServer) return;
var determinedDirection = vertical !== null && vertical !== undefined;
var overflow = determinedDirection ? vertical ? getStyle(el, 'overflow-y') : getStyle(el, 'overflow-x') : getStyle(el, 'overflow');
return overflow.match(/(scroll|auto|overlay)/);
};
var getScrollContainer = function getScrollContainer(el, vertical) {
if (isServer) return;
var parent = el;
while (parent) {
if ([window, document, document.documentElement].includes(parent)) {
return window;
}
if (isScroll(parent, vertical)) {
return parent;
}
parent = parent.parentNode;
}
return parent;
};
var isInContainer = function isInContainer(el, container) {
if (isServer || !el || !container) return false;
var elRect = el.getBoundingClientRect();
var containerRect = void 0;
if ([window, document, document.documentElement, null, undefined].includes(container)) {
containerRect = {
top: 0,
right: window.innerWidth,
bottom: window.innerHeight,
left: 0
};
} else {
containerRect = container.getBoundingClientRect();
}
return elRect.top < containerRect.bottom && elRect.bottom > containerRect.top && elRect.right > containerRect.left && elRect.left < containerRect.right;
};
/***/ }),
/***/ 11:
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
// EXPORTS
__webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ t; });
// UNUSED EXPORTS: use, i18n
// CONCATENATED MODULE: ./src/locale/lang/zh-CN.js
/* harmony default export */ var zh_CN = ({
el: {
colorpicker: {
confirm: '确定',
clear: '清空'
},
datepicker: {
now: '此刻',
today: '今天',
cancel: '取消',
clear: '清空',
confirm: '确定',
selectDate: '选择日期',
selectTime: '选择时间',
startDate: '开始日期',
startTime: '开始时间',
endDate: '结束日期',
endTime: '结束时间',
prevYear: '前一年',
nextYear: '后一年',
prevMonth: '上个月',
nextMonth: '下个月',
year: '年',
month1: '1 月',
month2: '2 月',
month3: '3 月',
month4: '4 月',
month5: '5 月',
month6: '6 月',
month7: '7 月',
month8: '8 月',
month9: '9 月',
month10: '10 月',
month11: '11 月',
month12: '12 月',
// week: '周次',
weeks: {
sun: '日',
mon: '一',
tue: '二',
wed: '三',
thu: '四',
fri: '五',
sat: '六'
},
months: {
jan: '一月',
feb: '二月',
mar: '三月',
apr: '四月',
may: '五月',
jun: '六月',
jul: '七月',
aug: '八月',
sep: '九月',
oct: '十月',
nov: '十一月',
dec: '十二月'
},
shortcuts: {
Today: '今天',
Yestoday: '昨天',
LastThreeDays: '最近三天',
LastSevenDays: '最近七天',
ThisWeek: '本周',
LastWeek: '上周',
ThisMoth: '本月',
LastMonth: '上月',
LastThreeMonths: '最近三个月',
LastSixMonths: '最近六个月'
}
},
select: {
loading: '加载中',
noMatch: '无匹配数据',
noData: '无数据',
placeholder: '请选择'
},
cascader: {
noMatch: '无匹配数据',
loading: '加载中',
placeholder: '请选择',
noData: '暂无数据'
},
pagination: {
goto: '前往',
pagesize: '条/页',
total: '共 {total} 条',
pageClassifier: '页'
},
messagebox: {
title: '提示',
confirm: '确定',
cancel: '取消',
error: '输入的数据不合法!'
},
upload: {
deleteTip: '按 delete 键可删除',
delete: '删除',
preview: '查看图片',
continue: '继续上传'
},
table: {
emptyText: '暂无数据',
confirmFilter: '筛选',
resetFilter: '重置',
clearFilter: '全部',
sumText: '合计'
},
tree: {
emptyText: '暂无数据'
},
transfer: {
noMatch: '无匹配数据',
noData: '无数据',
titles: ['列表 1', '列表 2'],
filterPlaceholder: '请输入搜索内容',
noCheckedFormat: '共 {total} 项',
hasCheckedFormat: '已选 {checked}/{total} 项'
},
image: {
error: '加载失败'
},
pageHeader: {
title: '返回'
},
popconfirm: {
confirmButtonText: '确认',
cancelButtonText: '取消'
},
empty: {
description: '暂无数据'
}
}
});
// EXTERNAL MODULE: external "vue"
var external_vue_ = __webpack_require__(0);
var external_vue_default = /*#__PURE__*/__webpack_require__.n(external_vue_);
// EXTERNAL MODULE: external "deepmerge"
var external_deepmerge_ = __webpack_require__(17);
var external_deepmerge_default = /*#__PURE__*/__webpack_require__.n(external_deepmerge_);
// EXTERNAL MODULE: ./src/utils/util.js
var util = __webpack_require__(3);
// CONCATENATED MODULE: ./src/locale/format.js
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 RE_NARGS = /(%|)\{([0-9a-zA-Z_]+)\}/g;
/**
* String format template
* - Inspired:
* https://github.com/Matt-Esch/string-template/index.js
*/
/* harmony default export */ var format = (function (Vue) {
/**
* template
*
* @param {String} string
* @param {Array} ...args
* @return {String}
*/
function template(string) {
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
args[_key - 1] = arguments[_key];
}
if (args.length === 1 && _typeof(args[0]) === 'object') {
args = args[0];
}
if (!args || !args.hasOwnProperty) {
args = {};
}
return string.replace(RE_NARGS, function (match, prefix, i, index) {
var result = void 0;
if (string[index - 1] === '{' && string[index + match.length] === '}') {
return i;
} else {
result = Object(util["j" /* hasOwn */])(args, i) ? args[i] : null;
if (result === null || result === undefined) {
return '';
}
return result;
}
});
}
return template;
});
// CONCATENATED MODULE: ./src/locale/index.js
var locale_format = format(external_vue_default.a);
var lang = zh_CN;
var merged = false;
var locale_i18nHandler = function i18nHandler() {
var vuei18n = Object.getPrototypeOf(this || external_vue_default.a).$t;
if (typeof vuei18n === 'function' && !!external_vue_default.a.locale) {
if (!merged) {
merged = true;
external_vue_default.a.locale(external_vue_default.a.config.lang, external_deepmerge_default()(lang, external_vue_default.a.locale(external_vue_default.a.config.lang) || {}, { clone: true }));
}
return vuei18n.apply(this, arguments);
}
};
var t = function t(path, options) {
var value = locale_i18nHandler.apply(this, arguments);
if (value !== null && value !== undefined) return value;
var array = path.split('.');
var current = lang;
for (var i = 0, j = array.length; i < j; i++) {
var property = array[i];
value = current[property];
if (i === j - 1) return locale_format(value, options);
if (!value) return '';
current = value;
}
return '';
};
var use = function use(l) {
lang = l || lang;
};
var i18n = function i18n(fn) {
locale_i18nHandler = fn || locale_i18nHandler;
};
/* harmony default export */ var locale = ({ use: use, t: t, i18n: i18n });
/***/ }),
/***/ 110:
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);
// EXTERNAL MODULE: external "vue"
var external_vue_ = __webpack_require__(0);
var external_vue_default = /*#__PURE__*/__webpack_require__.n(external_vue_);
// CONCATENATED MODULE: ./node_modules/_vue-loader@15.9.8@vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/_vue-loader@15.9.8@vue-loader/lib??vue-loader-options!./packages/message-box/src/main.vue?vue&type=template&id=6b29b012&
var render = function () {
var _vm = this
var _h = _vm.$createElement
var _c = _vm._self._c || _h
return _c("transition", { attrs: { name: "msgbox-fade" } }, [
_c(
"div",
{
directives: [
{
name: "show",
rawName: "v-show",
value: _vm.visible,
expression: "visible",
},
],
staticClass: "yk-message-box__wrapper",
attrs: {
tabindex: "-1",
role: "dialog",
"aria-modal": "true",
"aria-label": _vm.title || "dialog",
},
on: {
click: function ($event) {
if ($event.target !== $event.currentTarget) {
return null
}
return _vm.handleWrapperClick($event)
},
},
},
[
_c(
"div",
{
staticClass: "yk-message-box yk-message-box-style",
class: [_vm.customClass, _vm.center && "yk-message-box--center"],
},
[
_vm.title !== null
? _c("div", { staticClass: "yk-message-box__header" }, [
_c("div", { staticClass: "yk-message-box__title" }, [
_vm.icon && _vm.center
? _c("div", {
class: ["yk-message-box__status", _vm.icon],
})
: _vm._e(),
_c("span", [_vm._v(_vm._s(_vm.title))]),
]),
_vm.showClose
? _c(
"button",
{
staticClass: "yk-message-box__headerbtn",
attrs: { type: "button", "aria-label": "Close" },
on: {
click: function ($event) {
_vm.handleAction(
_vm.distinguishCancelAndClose
? "close"
: "cancel"
)
},
keydown: function ($event) {
if (
!("button" in $event) &&
_vm._k(
$event.keyCode,
"enter",
13,
$event.key,
"Enter"
)
) {
return null
}
_vm.handleAction(
_vm.distinguishCancelAndClose
? "close"
: "cancel"
)
},
},
},
[
_c("i", {
staticClass: "yk-message-box__close yk_icon_close",
}),
]
)
: _vm._e(),
])
: _vm._e(),
_c("div", { staticClass: "yk-message-box__content" }, [
_c("div", { staticClass: "yk-message-box__container" }, [
_vm.icon && !_vm.center && _vm.message !== ""
? _c("div", { class: ["yk-message-box__status", _vm.icon] })
: _vm._e(),
_vm.message !== ""
? _c(
"div",
{ staticClass: "yk-message-box__message" },
[
_vm._t("default", [
!_vm.dangerouslyUseHTMLString
? _c("p", [_vm._v(_vm._s(_vm.message))])
: _c("p", {
domProps: { innerHTML: _vm._s(_vm.message) },
}),
]),
],
2
)
: _vm._e(),
]),
_c(
"div",
{
directives: [
{
name: "show",
rawName: "v-show",
value: _vm.showInput,
expression: "showInput",
},
],
staticClass: "yk-message-box__input",
},
[
_c("Yk-input", {
ref: "input",
attrs: {
type: _vm.inputType,
placeholder: _vm.inputPlaceholder,
},
nativeOn: {
keydown: function ($event) {
if (
!("button" in $event) &&
_vm._k(
$event.keyCode,
"enter",
13,
$event.key,
"Enter"
)
) {
return null
}
return _vm.handleInputEnter($event)
},
},
model: {
value: _vm.inputValue,
callback: function ($$v) {
_vm.inputValue = $$v
},
expression: "inputValue",
},
}),
_c(
"div",
{
staticClass: "yk-message-box__errormsg",
style: {
visibility: !!_vm.editorErrorMessage
? "visible"
: "hidden",
},
},
[
_vm._v(
"\n " +
_vm._s(_vm.editorErrorMessage) +
"\n "
),
]
),
],
1
),
]),
_c(
"div",
{ staticClass: "yk-message-box__btns" },
[
_vm.showCancelButton
? _c(
"yk-button",
{
class: [_vm.cancelButtonClasses],
attrs: {
loading: _vm.cancelButtonLoading,
round: _vm.roundButton,
size: "small",
},
on: {
keydown: function ($event) {
if (
!("button" in $event) &&
_vm._k(
$event.keyCode,
"enter",
13,
$event.key,
"Enter"
)
) {
return null
}
_vm.handleAction("cancel")
},
},
nativeOn: {
click: function ($event) {
_vm.handleAction("cancel")
},
},
},
[
_vm._v(
"\n " +
_vm._s(
_vm.cancelButtonText ||
_vm.t("el.messagebox.cancel")
) +
"\n "
),
]
)
: _vm._e(),
_c(
"yk-button",
{
directives: [
{
name: "show",
rawName: "v-show",
value: _vm.showConfirmButton,
expression: "showConfirmButton",
},
],
ref: "confirm",
class: [_vm.confirmButtonClasses],
attrs: {
loading: _vm.confirmButtonLoading,
round: _vm.roundButton,
size: "small",
},
on: {
keydown: function ($event) {
if (
!("button" in $event) &&
_vm._k(
$event.keyCode,
"enter",
13,
$event.key,
"Enter"
)
) {
return null
}
_vm.handleAction("confirm")
},
},
nativeOn: {
click: function ($event) {
_vm.handleAction("confirm")
},
},
},
[
_vm._v(
"\n " +
_vm._s(
_vm.confirmButtonText ||
_vm.t("el.messagebox.confirm")
) +
"\n "
),
]
),
],
1
),
]
),
]
),
])
}
var staticRenderFns = []
render._withStripped = true
// CONCATENATED MODULE: ./packages/message-box/src/main.vue?vue&type=template&id=6b29b012&
// EXTERNAL MODULE: ./src/utils/popup/index.js + 1 modules
var popup = __webpack_require__(9);
// EXTERNAL MODULE: ./src/mixins/locale.js
var locale = __webpack_require__(13);
// EXTERNAL MODULE: ./packages/input/index.js + 6 modules
var input = __webpack_require__(18);
// EXTERNAL MODULE: ./packages/button/index.js + 5 modules
var packages_button = __webpack_require__(22);
// EXTERNAL MODULE: ./src/utils/dom.js
var dom = __webpack_require__(1);
// EXTERNAL MODULE: ./src/locale/index.js + 2 modules
var src_locale = __webpack_require__(11);
// EXTERNAL MODULE: ./src/utils/aria-utils.js
var aria_utils = __webpack_require__(27);
// CONCATENATED MODULE: ./src/utils/aria-dialog.js
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; };
/**
* @constructor
* @desc Dialog object providing modal focus management.
*
* Assumptions: The element serving as the dialog container is present in the
* DOM and hidden. The dialog container has role='dialog'.
*
* @param dialogId
* The ID of the element serving as the dialog container.
* @param focusAfterClosed
* Either the DOM node or the ID of the DOM node to focus when the
* dialog closes.
* @param focusFirst
* Optional parameter containing either the DOM node or the ID of the
* DOM node to focus when the dialog opens. If not specified, the
* first focusable element in the dialog will receive focus.
*/
var aria = aria || {};
var tabEvent;
aria.Dialog = function (dialog, focusAfterClosed, focusFirst) {
var _this = this;
this.dialogNode = dialog;
if (this.dialogNode === null || this.dialogNode.getAttribute('role') !== 'dialog') {
throw new Error('Dialog() requires a DOM element with ARIA role of dialog.');
}
if (typeof focusAfterClosed === 'string') {
this.focusAfterClosed = document.getElementById(focusAfterClosed);
} else if ((typeof focusAfterClosed === 'undefined' ? 'undefined' : _typeof(focusAfterClosed)) === 'object') {
this.focusAfterClosed = focusAfterClosed;
} else {
this.focusAfterClosed = null;
}
if (typeof focusFirst === 'string') {
this.focusFirst = document.getElementById(focusFirst);
} else if ((typeof focusFirst === 'undefined' ? 'undefined' : _typeof(focusFirst)) === 'object') {
this.focusFirst = focusFirst;
} else {
this.focusFirst = null;
}
if (this.focusFirst) {
this.focusFirst.focus();
} else {
aria_utils["a" /* default */].focusFirstDescendant(this.dialogNode);
}
this.lastFocus = document.activeElement;
tabEvent = function tabEvent(e) {
_this.trapFocus(e);
};
this.addListeners();
};
aria.Dialog.prototype.addListeners = function () {
document.addEventListener('focus', tabEvent, true);
};
aria.Dialog.prototype.removeListeners = function () {
document.removeEventListener('focus', tabEvent, true);
};
aria.Dialog.prototype.closeDialog = function () {
var _this2 = this;
this.removeListeners();
if (this.focusAfterClosed) {
setTimeout(function () {
_this2.focusAfterClosed.focus();
});
}
};
aria.Dialog.prototype.trapFocus = function (event) {
if (aria_utils["a" /* default */].IgnoreUtilFocusChanges) {
return;
}
if (this.dialogNode.contains(event.target)) {
this.lastFocus = event.target;
} else {
aria_utils["a" /* default */].focusFirstDescendant(this.dialogNode);
if (this.lastFocus === document.activeElement) {
aria_utils["a" /* default */].focusLastDescendant(this.dialogNode);
}
this.lastFocus = document.activeElement;
}
};
/* harmony default export */ var aria_dialog = (aria.Dialog);
// 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/message-box/src/main.vue?vue&type=script&lang=js&
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
var messageBox = void 0;
var typeMap = {
success: 'success',
info: 'info',
warning: 'warning',
error: 'error'
};
/* harmony default export */ var mainvue_type_script_lang_js_ = ({
mixins: [popup["b" /* default */], locale["a" /* default */]],
props: {
modal: {
default: true
},
lockScroll: {
default: true
},
showClose: {
type: Boolean,
default: true
},
closeOnClickModal: {
default: true
},
closeOnPressEscape: {
default: true
},
closeOnHashChange: {
default: true
},
center: {
default: false,
type: Boolean
},
roundButton: {
default: false,
type: Boolean
}
},
components: {
ElInput: input["default"],
YkButton: packages_button["default"]
},
computed: {
icon: function icon() {
var type = this.type,
iconClass = this.iconClass;
return iconClass || (type && typeMap[type] ? 'el-icon-' + typeMap[type] : '');
},
confirmButtonClasses: function confirmButtonClasses() {
return 'el-button--primary ' + this.confirmButtonClass;
},
cancelButtonClasses: function cancelButtonClasses() {
return '' + this.cancelButtonClass;
}
},
methods: {
getSafeClose: function getSafeClose() {
var _this = this;
var currentId = this.uid;
return function () {
_this.$nextTick(function () {
if (currentId === _this.uid) _this.doClose();
});
};
},
doClose: function doClose() {
var _this2 = this;
if (!this.visible) return;
this.visible = false;
this._closing = true;
this.onClose && this.onClose();
messageBox.closeDialog(); // 解绑
if (this.lockScroll) {
setTimeout(this.restoreBodyStyle, 200);
}
this.opened = false;
this.doAfterClose();
setTimeout(function () {
if (_this2.action) _this2.callback(_this2.action, _this2);
});
},
handleWrapperClick: function handleWrapperClick() {
if (this.closeOnClickModal) {
this.handleAction(this.distinguishCancelAndClose ? 'close' : 'cancel');
}
},
handleInputEnter: function handleInputEnter() {
if (this.inputType !== 'textarea') {
return this.handleAction('confirm');
}
},
handleAction: function handleAction(action) {
if (this.$type === 'prompt' && action === 'confirm' && !this.validate()) {
return;
}
this.action = action;
if (typeof this.beforeClose === 'function') {
this.close = this.getSafeClose();
this.beforeClose(action, this, this.close);
} else {
this.doClose();
}
},
validate: function validate() {
if (this.$type === 'prompt') {
var inputPattern = this.inputPattern;
if (inputPattern && !inputPattern.test(this.inputValue || '')) {
this.editorErrorMessage = this.inputErrorMessage || Object(src_locale["a" /* t */])('el.messagebox.error');
Object(dom["a" /* addClass */])(this.getInputElement(), 'invalid');
return false;
}
var inputValidator = this.inputValidator;
if (typeof inputValidator === 'function') {
var validateResult = inputValidator(this.inputValue);
if (validateResult === false) {
this.editorErrorMessage = this.inputErrorMessage || Object(src_locale["a" /* t */])('el.messagebox.error');
Object(dom["a" /* addClass */])(this.getInputElement(), 'invalid');
return false;
}
if (typeof validateResult === 'string') {
this.editorErrorMessage = validateResult;
Object(dom["a" /* addClass */])(this.getInputElement(), 'invalid');
return false;
}
}
}
this.editorErrorMessage = '';
Object(dom["i" /* removeClass */])(this.getInputElement(), 'invalid');
return true;
},
getFirstFocus: function getFirstFocus() {
var btn = this.$el.querySelector('.yk-message-box__btns .yk-button');
var title = this.$el.querySelector('.yk-message-box__btns .yk-message-box__title');
return btn || title;
},
getInputElement: function getInputElement() {
var inputRefs = this.$refs.input.$refs;
return inputRefs.input || inputRefs.textarea;
},
handleClose: function handleClose() {
this.handleAction('close');
}
},
watch: {
inputValue: {
immediate: true,
handler: function handler(val) {
var _this3 = this;
this.$nextTick(function (_) {
if (_this3.$type === 'prompt' && val !== null) {
_this3.validate();
}
});
}
},
visible: function visible(val) {
var _this4 = this;
if (val) {
this.uid++;
if (this.$type === 'alert' || this.$type === 'confirm') {
this.$nextTick(function () {
_this4.$refs.confirm.$el.focus();
});
}
this.focusAfterClosed = document.activeElement;
messageBox = new aria_dialog(this.$el, this.focusAfterClosed, this.getFirstFocus());
}
// prompt
if (this.$type !== 'prompt') return;
if (val) {
setTimeout(function () {
if (_this4.$refs.input && _this4.$refs.input.$el) {
_this4.getInputElement().focus();
}
}, 500);
} else {
this.editorErrorMessage = '';
Object(dom["i" /* removeClass */])(this.getInputElement(), 'invalid');
}
}
},
mounted: function mounted() {
var _this5 = this;
this.$nextTick(function () {
if (_this5.closeOnHashChange) {
window.addEventListener('hashchange', _this5.close);
}
});
},
beforeDestroy: function beforeDestroy() {
if (this.closeOnHashChange) {
window.removeEventListener('hashchange', this.close);
}
setTimeout(function () {
messageBox.closeDialog();
});
},
data: function data() {
return {
uid: 1,
title: undefined,
message: '',
type: '',
iconClass: '',
customClass: '',
showInput: false,
inputValue: null,
inputPlaceholder: '',
inputType: 'text',
inputPattern: null,
inputValidator: null,
inputErrorMessage: '',
showConfirmButton: true,
showCancelButton: false,
action: '',
confirmButtonText: '',
cancelButtonText: '',
confirmButtonLoading: false,
cancelButtonLoading: false,
confirmButtonClass: '',
confirmButtonDisabled: false,
cancelButtonClass: '',
editorErrorMessage: null,
callback: null,
dangerouslyUseHTMLString: false,
focusAfterClosed: null,
isOnComposition: false,
distinguishCancelAndClose: false
};
}
});
// CONCATENATED MODULE: ./packages/message-box/src/main.vue?vue&type=script&lang=js&
/* harmony default export */ var src_mainvue_type_script_lang_js_ = (mainvue_type_script_lang_js_);
// EXTERNAL MODULE: ./node_modules/_vue-loader@15.9.8@vue-loader/lib/runtime/componentNormalizer.js
var componentNormalizer = __webpack_require__(2);
// CONCATENATED MODULE: ./packages/message-box/src/main.vue
/* normalize component */
var component = Object(componentNormalizer["a" /* default */])(
src_mainvue_type_script_lang_js_,
render,
staticRenderFns,
false,
null,
null,
null
)
/* hot reload */
if (false) { var api; }
component.options.__file = "packages/message-box/src/main.vue"
/* harmony default export */ var main = (component.exports);
// EXTERNAL MODULE: ./src/utils/merge.js
var merge = __webpack_require__(7);
// EXTERNAL MODULE: ./src/utils/vdom.js
var vdom = __webpack_require__(33);
// CONCATENATED MODULE: ./packages/message-box/src/main.js
var main_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 defaults = {
title: null,
message: '',
type: '',
iconClass: '',
showInput: false,
showClose: true,
modalFade: true,
lockScroll: true,
closeOnClickModal: true,
closeOnPressEscape: true,
closeOnHashChange: true,
inputValue: null,
inputPlaceholder: '',
inputType: 'text',
inputPattern: null,
inputValidator: null,
inputErrorMessage: '',
showConfirmButton: true,
showCancelButton: false,
confirmButtonPosition: 'right',
confirmButtonHighlight: false,
cancelButtonHighlight: false,
confirmButtonText: '',
cancelButtonText: '',
confirmButtonClass: '',
cancelButtonClass: '',
customClass: '',
beforeClose: null,
dangerouslyUseHTMLString: false,
center: false,
roundButton: false,
distinguishCancelAndClose: false
};
var MessageBoxConstructor = external_vue_default.a.extend(main);
var currentMsg = void 0,
instance = void 0;
var msgQueue = [];
var defaultCallback = function defaultCallback(action) {
if (currentMsg) {
var callback = currentMsg.callback;
if (typeof callback === 'function') {
if (instance.showInput) {
callback(instance.inputValue, action);
} else {
callback(action);
}
}
if (currentMsg.resolve) {
if (action === 'confirm') {
if (instance.showInput) {
currentMsg.resolve({ value: instance.inputValue, action: action });
} else {
currentMsg.resolve(action);
}
} else if (currentMsg.reject && (action === 'cancel' || action === 'close')) {
currentMsg.reject(action);
}
}
}
};
var initInstance = function initInstance() {
instance = new MessageBoxConstructor({
el: document.createElement('div')
});
instance.callback = defaultCallback;
};
var main_showNextMsg = function showNextMsg() {
if (!instance) {
initInstance();
}
instance.action = '';
if (!instance.visible || instance.closeTimer) {
if (msgQueue.length > 0) {
currentMsg = msgQueue.shift();
var options = currentMsg.options;
for (var prop in options) {
if (options.hasOwnProperty(prop)) {
instance[prop] = options[prop];
}
}
if (options.callback === undefined) {
instance.callback = defaultCallback;
}
var oldCb = instance.callback;
instance.callback = function (action, instance) {
oldCb(action, instance);
showNextMsg();
};
if (Object(vdom["a" /* isVNode */])(instance.message)) {
instance.$slots.default = [instance.message];
instance.message = null;
} else {
delete instance.$slots.default;
}
['modal', 'showClose', 'closeOnClickModal', 'closeOnPressEscape', 'closeOnHashChange'].forEach(function (prop) {
if (instance[prop] === undefined) {
instance[prop] = true;
}
});
document.body.appendChild(instance.$el);
external_vue_default.a.nextTick(function () {
instance.visible = true;
});
}
}
};
var main_MessageBox = function MessageBox(options, callback) {
if (external_vue_default.a.prototype.$isServer) return;
if (typeof options === 'string' || Object(vdom["a" /* isVNode */])(options)) {
options = {
message: options
};
if (typeof arguments[1] === 'string') {
options.title = arguments[1];
}
} else if (options.callback && !callback) {
callback = options.callback;
}
if (typeof Promise !== 'undefined') {
return new Promise(function (resolve, reject) {
// eslint-disable-line
msgQueue.push({
options: Object(merge["a" /* default */])({}, defaults, MessageBox.defaults, options),
callback: callback,
resolve: resolve,
reject: reject
});
main_showNextMsg();
});
} else {
msgQueue.push({
options: Object(merge["a" /* default */])({}, defaults, MessageBox.defaults, options),
callback: callback
});
main_showNextMsg();
}
};
main_MessageBox.setDefaults = function (defaults) {
main_MessageBox.defaults = defaults;
};
main_MessageBox.alert = function (message, title, options) {
if ((typeof title === 'undefined' ? 'undefined' : main_typeof(title)) === 'object') {
options = title;
title = '';
} else if (title === undefined) {
title = '';
}
return main_MessageBox(Object(merge["a" /* default */])({
title: title,
message: message,
$type: 'alert',
closeOnPressEscape: false,
closeOnClickModal: false
}, options));
};
main_MessageBox.confirm = function (message, title, options) {
if ((typeof title === 'undefined' ? 'undefined' : main_typeof(title)) === 'object') {
options = title;
title = '';
} else if (title === undefined) {
title = '';
}
return main_MessageBox(Object(merge["a" /* default */])({
title: title,
message: message,
$type: 'confirm',
showCancelButton: true
}, options));
};
main_MessageBox.prompt = function (message, title, options) {
if ((typeof title === 'undefined' ? 'undefined' : main_typeof(title)) === 'object') {
options = title;
title = '';
} else if (title === undefined) {
title = '';
}
return main_MessageBox(Object(merge["a" /* default */])({
title: title,
message: message,
showCancelButton: true,
showInput: true,
$type: 'prompt'
}, options));
};
main_MessageBox.close = function () {
instance.doClose();
instance.visible = false;
msgQueue = [];
currentMsg = null;
};
/* harmony default export */ var src_main = (main_MessageBox);
// CONCATENATED MODULE: ./packages/message-box/index.js
/* harmony default export */ var message_box = __webpack_exports__["default"] = (src_main);
/***/ }),
/***/ 12:
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var element_ui_src_utils_util__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(3);
/**
* Show migrating guide in browser console.
*
* Usage:
* import Migrating from 'element-ui/src/mixins/migrating';
*
* mixins: [Migrating]
*
* add getMigratingConfig method for your component.
* getMigratingConfig() {
* return {
* props: {
* 'allow-no-selection': 'allow-no-selection is removed.',
* 'selection-mode': 'selection-mode is removed.'
* },
* events: {
* selectionchange: 'selectionchange is renamed to selection-change.'
* }
* };
* },
*/
/* harmony default export */ __webpack_exports__["a"] = ({
mounted: function mounted() {
if (true) return;
if (!this.$vnode) return;
var _getMigratingConfig = this.getMigratingConfig(),
_getMigratingConfig$p = _getMigratingConfig.props,
props = _getMigratingConfig$p === undefined ? {} : _getMigratingConfig$p,
_getMigratingConfig$e = _getMigratingConfig.events,
events = _getMigratingConfig$e === undefined ? {} : _getMigratingConfig$e;
var _$vnode = this.$vnode,
data = _$vnode.data,
componentOptions = _$vnode.componentOptions;
var definedProps = data.attrs || {};
var definedEvents = componentOptions.listeners || {};
for (var propName in definedProps) {
propName = Object(element_ui_src_utils_util__WEBPACK_IMPORTED_MODULE_0__[/* kebabCase */ "p"])(propName); // compatible with camel case
if (props[propName]) {
console.warn('[Element Migrating][' + this.$options.name + '][Attribute]: ' + props[propName]);
}
}
for (var eventName in definedEvents) {
eventName = Object(element_ui_src_utils_util__WEBPACK_IMPORTED_MODULE_0__[/* kebabCase */ "p"])(eventName); // compatible with camel case
if (events[eventName]) {
console.warn('[Element Migrating][' + this.$options.name + '][Event]: ' + events[eventName]);
}
}
},
methods: {
getMigratingConfig: function getMigratingConfig() {
return {
props: {},
events: {}
};
}
}
});
/***/ }),
/***/ 13:
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var element_ui_src_locale__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(11);
/* harmony default export */ __webpack_exports__["a"] = ({
methods: {
t: function t() {
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return element_ui_src_locale__WEBPACK_IMPORTED_MODULE_0__[/* t */ "a"].apply(this, args);
}
}
});
/***/ }),
/***/ 16:
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return isDef; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return isKorean; });
function isDef(val) {
return val !== undefined && val !== null;
}
function isKorean(text) {
var reg = /([(\uAC00-\uD7AF)|(\u3130-\u318F)])+/gi;
return reg.test(text);
}
/***/ }),
/***/ 17:
/***/ (function(module, exports) {
module.expor