UNPKG

@ntesmail/shark-angularjs

Version:

shark-angularjs组件库,基于shark-ui打造的angular组件库

1,530 lines (1,337 loc) 562 kB
'use strict'; var _typeof2 = 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; }; /******/(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; /******/ /******/ // identity function for calling harmony imports with the correct context /******/__webpack_require__.i = function (value) { return value; }; /******/ /******/ // 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 = "/"; /******/ /******/ // Load entry module and return exports /******/return __webpack_require__(__webpack_require__.s = 1); /******/ })( /************************************************************************/ /******/{ /***/"/kcE": /***/function kcE(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__ntesmail_shark_ui__ = __webpack_require__("f4c1"); /* harmony import */var __WEBPACK_IMPORTED_MODULE_1__common_const__ = __webpack_require__("7Lx1"); angular.module('shark-angularjs.ui').directive(__WEBPACK_IMPORTED_MODULE_1__common_const__["a" /* COMPONENTS */].radiogroup, ['SharkConfig', '$timeout', function (SharkConfig, $timeout) { return { restrict: 'E', template: ' <div>\n <label ng-class="{\'radio-inline\':direction===\'horizonal\',\'radio\':direction!==\'horizonal\'}" ng-repeat="item in radios track by $index">\n <input type="radio" name="{{radioname}}" ng-click="setModelValue(item);" value="{{item.value}}">{{item.name}}\n </label>\n </div>\n ', scope: { direction: '@', radioname: '@', radios: '=' }, replace: true, require: '?ngModel', link: function link($scope, element, attrs, ngModelCtrl) { var elementJq = __WEBPACK_IMPORTED_MODULE_0__ntesmail_shark_ui__["a" /* SharkUI */].$(element); //点击radio改变ngModel $scope.setModelValue = function (item) { if (ngModelCtrl && ngModelCtrl.$setViewValue && ngModelCtrl.$modelValue !== item.value) { ngModelCtrl.$setViewValue(item.value); } }; // 侦听ngModel改变 $scope.$watch(function () { return ngModelCtrl.$modelValue; }, function (newValue, oldValue) { $timeout(function () { var radio = elementJq.find('input[value="' + newValue + '"]'); radio.prop('checked', true); }, 0); }); } }; }]); /***/ }, /***/"0FTm": /***/function FTm(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_flatpickr__ = __webpack_require__("GxBP"); /* harmony import */var __WEBPACK_IMPORTED_MODULE_0_flatpickr___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_flatpickr__); /* harmony import */var __WEBPACK_IMPORTED_MODULE_1__common_const__ = __webpack_require__("7Lx1"); angular.module('shark-angularjs.ui').directive(__WEBPACK_IMPORTED_MODULE_1__common_const__["a" /* COMPONENTS */].datepicker, ['SharkConfig', function (SharkConfig) { //获取默认配置 var datepickerConfig = SharkConfig.getConfig()[__WEBPACK_IMPORTED_MODULE_1__common_const__["a" /* COMPONENTS */].datepicker]; return { restrict: 'E', template: '<div class="shark-datepicker">\ <input class="shark-datepicker-ipt" type="text"/>\ </div>\ ', replace: true, require: '?ngModel', link: function link($scope, element, attrs, ngModelCtrl) { //可选最大日期 var maxDate = typeof attrs.maxDate !== 'undefined' ? SharkConfig.getAttrValue($scope, attrs.maxDate) : null; //可选最小日期 var minDate = typeof attrs.minDate !== 'undefined' ? SharkConfig.getAttrValue($scope, attrs.minDate) : null; //格式化日期 var format = typeof attrs.format !== 'undefined' ? SharkConfig.getAttrValue($scope, attrs.format) : datepickerConfig.format; //根据format来选择是否显示时分秒 //显示时分 var enableTime = /H|i|S/.test(format); //显示秒 var enableSeconds = /S/.test(format); //不显示年月日 var noCalendar = !(/Y/.test(format) || /m/.test(format) || /d/.test(format)); //显示24小时 var time_24hr = enableTime; //禁止选择日期list var disable = typeof attrs.dateDisable !== 'undefined' ? SharkConfig.getAttrValue($scope, attrs.dateDisable) : datepickerConfig.disable; //回调函数部分 //change事件 var changeCb = SharkConfig.getAttrValue($scope, attrs.onChange); //open事件 var openCb = SharkConfig.getAttrValue($scope, attrs.onOpen); //close事件 var closeCb = SharkConfig.getAttrValue($scope, attrs.onClose); function onChangeFunc(selectedDates, dateStr, instance) { var timestamp = selectedDates[0] && selectedDates[0].getTime(); if (ngModelCtrl && ngModelCtrl.$setViewValue && ngModelCtrl.$modelValue !== timestamp) { ngModelCtrl.$setViewValue(timestamp); } if (typeof changeCb === 'function') { changeCb.apply(instance); if (!$scope.$$phase) { $scope.$apply(); } } } function onOpenFunc(selectedDates, dateStr, instance) { if (typeof openCb === 'function') { openCb.apply(instance, arguments); if (!$scope.$$phase) { $scope.$apply(); } } } function onCloseFunc(selectedDates, dateStr, instance) { if (typeof closeCb === 'function') { closeCb.apply(instance, arguments); if (!$scope.$$phase) { $scope.$apply(); } } } //datepicker配置参数 var dOption = { maxDate: maxDate, minDate: minDate, dateFormat: format, enableTime: enableTime, noCalendar: noCalendar, enableSeconds: enableSeconds, time_24hr: time_24hr, disable: disable, onChange: onChangeFunc, onOpen: onOpenFunc, onClose: onCloseFunc //实例化 };var picker = new __WEBPACK_IMPORTED_MODULE_0_flatpickr___default.a(element.find("input")[0], dOption); // //侦听ngModel改变 $scope.$watch(function () { return $scope.$eval(attrs.ngModel); }, function (newValue, oldValue) { picker.setDate(newValue); }); //侦听ngDisabled改变 var disableWatcher; if (typeof attrs.ngDisabled !== 'undefined') { disableWatcher = $scope.$watch(function () { return $scope.$eval(attrs.ngDisabled); }, function (newValue, oldValue) { if (newValue) { destroy(); element.find("input").attr("disabled", true); } else { if (!picker) { picker = new __WEBPACK_IMPORTED_MODULE_0_flatpickr___default.a(element.find("input")[0], dOption); element.find("input").attr("disabled", false); } } }); } //$scope销毁时同步销毁datepicker组件 $scope.$on('$destroy', function () { if (disableWatcher) { disableWatcher(); } destroy(); }); //destroy函数 function destroy() { if (picker) { picker.destroy(); picker = null; } } } }; }]); /***/ }, /***/"0iVz": /***/function iVz(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_flatpickr__ = __webpack_require__("GxBP"); /* harmony import */var __WEBPACK_IMPORTED_MODULE_0_flatpickr___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_flatpickr__); /* harmony import */var __WEBPACK_IMPORTED_MODULE_1__ntesmail_shark_ui__ = __webpack_require__("f4c1"); /* harmony import */var __WEBPACK_IMPORTED_MODULE_2__common_const__ = __webpack_require__("7Lx1"); angular.module('shark-angularjs.ui').directive(__WEBPACK_IMPORTED_MODULE_2__common_const__["a" /* COMPONENTS */].daterangepicker, ['SharkConfig', function (SharkConfig) { //获取默认配置 var datepickerConfig = SharkConfig.getConfig()[__WEBPACK_IMPORTED_MODULE_2__common_const__["a" /* COMPONENTS */].datepicker]; return { restrict: 'E', template: '<div class="shark-datepicker shark-datepicker-range">\ <input type="text" class="shark-datepicker-ipt" placeholder="请选择开始时间"/>\ <span class="shark-datepicker-split">至</span>\ <input type="text" class="shark-datepicker-ipt" placeholder="请选择结束时间"/>\ </div>\ ', replace: true, require: '?ngModel', link: function link($scope, element, attrs, ngModelCtrl) { //可选最大日期 var maxDate = typeof attrs.maxDate !== 'undefined' ? SharkConfig.getAttrValue($scope, attrs.maxDate) : null; //可选最小日期 var minDate = typeof attrs.minDate !== 'undefined' ? SharkConfig.getAttrValue($scope, attrs.minDate) : null; //格式化日期 var format = typeof attrs.format !== 'undefined' ? SharkConfig.getAttrValue($scope, attrs.format) : datepickerConfig.format; //根据format来选择是否显示时分秒 //显示时分 var enableTime = /H|i|S/.test(format); //显示秒 var enableSeconds = /S/.test(format); //不显示年月日 var noCalendar = !(/Y/.test(format) || /m/.test(format) || /d/.test(format)); //显示24小时 var time_24hr = enableTime; //禁止选择日期list var disable = typeof attrs.dateDisable !== 'undefined' ? SharkConfig.getAttrValue($scope, attrs.dateDisable) : datepickerConfig.disable; //change事件 var changeCb = SharkConfig.getAttrValue($scope, attrs.onChange); //open事件 var openCb = SharkConfig.getAttrValue($scope, attrs.onOpen); //close事件 var closeCb = SharkConfig.getAttrValue($scope, attrs.onClose); function onChangeFunc(selectedDates, dateStr, instance) { var start_timestamp = start_picker.selectedDates[0] && start_picker.selectedDates[0].getTime(); var end_timestamp = end_picker.selectedDates[0] && end_picker.selectedDates[0].getTime(); if (ngModelCtrl && ngModelCtrl.$setViewValue && (!__WEBPACK_IMPORTED_MODULE_1__ntesmail_shark_ui__["a" /* SharkUI */].isArray(ngModelCtrl.$modelValue) || ngModelCtrl.$modelValue[0] !== start_timestamp || ngModelCtrl.$modelValue[1] !== end_timestamp)) { ngModelCtrl.$setViewValue([start_timestamp, end_timestamp]); } if (typeof changeCb === 'function') { changeCb.apply(instance); if (!$scope.$$phase) { $scope.$apply(); } } } function onOpenFunc(selectedDates, dateStr, instance) { if (typeof openCb === 'function') { openCb.apply(instance, arguments); if (!$scope.$$phase) { $scope.$apply(); } } } function onCloseFunc(selectedDates, dateStr, instance) { if (typeof closeCb === 'function') { closeCb.apply(instance, arguments); if (!$scope.$$phase) { $scope.$apply(); } } } //datepicker配置参数 var dOption = { maxDate: maxDate, minDate: minDate, dateFormat: format, enableTime: enableTime, noCalendar: noCalendar, enableSeconds: enableSeconds, time_24hr: time_24hr, disable: disable, onChange: onChangeFunc, onOpen: onOpenFunc, onClose: onCloseFunc //实例化 };var start_picker = new __WEBPACK_IMPORTED_MODULE_0_flatpickr___default.a(element.find("input")[0], dOption); var end_picker = new __WEBPACK_IMPORTED_MODULE_0_flatpickr___default.a(element.find("input")[1], dOption); //侦听ngModel改变 $scope.$watch(function () { return $scope.$eval(attrs.ngModel); }, function (newValue, oldValue) { var start_timestamp = newValue && newValue[0]; var end_timestamp = newValue && newValue[1]; start_picker.setDate(start_timestamp); end_picker.setDate(end_timestamp); //正确设值时进入正常约束 if (start_timestamp && end_timestamp && start_timestamp <= end_timestamp) { start_picker.set('maxDate', end_timestamp); end_picker.set('minDate', start_timestamp); } //[null,timestamp]未设置开始时间时只有结束时间约束 else if (!start_timestamp && end_timestamp) { start_picker.set('maxDate', end_timestamp); } //[timestamp,null]未设置结束时间时只有开始时间约束 else if (start_timestamp && !end_timestamp) { end_picker.set('minDate', start_timestamp); } //[later,earlier]错误设值和[null,null],null等三种情况不进行时间约束 }); //侦听ngDisabled改变 var disableWatcher; if (typeof attrs.ngDisabled !== 'undefined') { disableWatcher = $scope.$watch(function () { return $scope.$eval(attrs.ngDisabled); }, function (newValue, oldValue) { if (newValue) { destroy(); element.find("input").attr("disabled", true); } else { if (!start_picker) { start_picker = new __WEBPACK_IMPORTED_MODULE_0_flatpickr___default.a(element.find("input")[0], dOption); } if (!end_picker) { end_picker = new __WEBPACK_IMPORTED_MODULE_0_flatpickr___default.a(element.find("input")[1], dOption); } element.find("input").attr("disabled", false); } }); } //$scope销毁时同步销毁daterangepicker组件 $scope.$on('$destroy', function () { if (disableWatcher) { disableWatcher(); } destroy(); }); //destroy函数 function destroy() { if (start_picker) { start_picker.destroy(); start_picker = null; } if (end_picker) { end_picker.destroy(); end_picker = null; } } } }; }]); /***/ }, /***/1: /***/function _(module, exports, __webpack_require__) { module.exports = __webpack_require__("v7ON"); /***/ }, /***/"2gJo": /***/function gJo(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__ntesmail_shark_ui__ = __webpack_require__("f4c1"); angular.module('shark-angularjs.ui').directive('sharkValidator', ['SharkValidHelper', function (SharkValidHelper) { function fliterElem(target, formElm) { // 获取元素 var element = angular.element(target); if (element[0].tagName === 'INPUT') { if (element.hasClass('shark-autocomplete') || element.hasClass('shark-datepicker-ipt')) { return [element.parent()]; } if (element.attr('type') === 'radio' || element.attr('type') === 'checkbox') { var radiogroup = element.parent().parent(); if (radiogroup.attr('ng-model')) { return [radiogroup]; } } } if (element.hasClass('shark-selecter')) { return [element.parent()]; } var validRelation = element.attr('validrelation'); if (validRelation) { var relationElms = formElm.find('[validrelation="' + validRelation + '"]'); if (relationElms.length > 0) { var result = []; for (var i = 0; i < relationElms.length; i++) { result.push(angular.element(relationElms[i])); } return result; } } return [element]; } return { link: function link($scope, elm, attr) { // form元素 var formElm = __WEBPACK_IMPORTED_MODULE_0__ntesmail_shark_ui__["a" /* SharkUI */].$(elm); // form控制器 var formCtrl = elm.inheritedData("$formController"); // 设置要提示错误的元素 formCtrl.elemQueryStr = 'input,select,textarea,.shark-selecter,.js-clicktouch'; // 出发表单验证 formCtrl.doValidate = function () { // 防止有动态生成的表单元素不校验,每次校验都取一遍所有元素 var needValidateEles = formElm.find(formCtrl.elemQueryStr); for (var i = 0; i < needValidateEles.length; i++) { // 获取元素的jqlite形态 var atomElement = angular.element(needValidateEles[i]); // 获取元素的jquery形态 var atomJq = __WEBPACK_IMPORTED_MODULE_0__ntesmail_shark_ui__["a" /* SharkUI */].$(needValidateEles[i]); // 获取元素的控制器 var atomCtrl = atomElement.inheritedData("$ngModelController"); // 是否进行校验(元素隐藏和禁用情况下不进行校验) var isVerify = !(atomJq.is(':hidden') || atomJq.is(':disabled')); if (isVerify) { fliterElem(needValidateEles[i], formElm).forEach(function (item) { SharkValidHelper.showError(item); }); } else { var errors = atomCtrl.$error; for (var error in errors) { atomCtrl.$setValidity(error, true); } } }; }; // 表单是否正在校验 formCtrl.isPendding = function () { return formElm.find('.valid-pending').length > 0; }; // 表单是否合法 formCtrl.isValid = function () { return formCtrl.$valid; }; formElm.on('focusout.validator', formCtrl.elemQueryStr, function (e) { fliterElem(e.target, formElm).forEach(function (item) { SharkValidHelper.showError(item); }); }); // 输入时清空错误 formElm.on('input.validator', formCtrl.elemQueryStr, function (e) { fliterElem(e.target, formElm).forEach(function (item) { SharkValidHelper.removeError(item); }); }); // 销毁时解绑事件 $scope.$on('$destroy', function () { formElm.off('focusout.validator input.validator'); }); } }; }]).directive('formSubmit', ['$parse', function ($parse) { return { link: function link(scope, elm, attr) { var formCtrl = elm.inheritedData("$formController"); var success = $parse(attr.formSubmit); elm.on('click', function () { formCtrl.doValidate(); if (!formCtrl.isPendding() && formCtrl.isValid()) { scope.$apply(function () { angular.isFunction(success) ? success(scope) : ''; }); } }); scope.$on('$destroy', function () { elm.off('click'); }); } }; }]).directive('clicktouch', [function () { return { require: '?ngModel', link: function link($scope, elm, attr, ctrl) { if (!ctrl) return; elm.addClass('js-clicktouch'); elm.on('click', function () { if (ctrl.$touched) { return; } else { $scope.$apply(function () { ctrl.$setTouched(); }); __WEBPACK_IMPORTED_MODULE_0__ntesmail_shark_ui__["a" /* SharkUI */].$(elm).trigger('focusout'); } }); $scope.$on('$destroy', function () { elm.off('click'); }); } }; }]).directive('ensure', ['SharkValidHelper', 'SharkValidConfig', function (SharkValidHelper, SharkValidConfig) { return { require: 'ngModel', link: function link(scope, elm, attr, ctrl) { if (!ctrl) return; scope.$watch(attr.ngModel, function (newValue, oldvalue) { SharkValidHelper.triggerCheck(scope, elm, attr, ctrl, newValue, SharkValidConfig.ensure); }, true); } }; }]).directive('repeatcheck', ['SharkValidHelper', 'SharkValidConfig', function (SharkValidHelper, SharkValidConfig) { return { require: '?ngModel', link: function link(scope, elm, attr, ctrl) { // 获取比较元素的控制器 var otherInput = elm.inheritedData("$formController")[attr.repeatcheck]; if (!ctrl || !otherInput) { return; } scope.$watch(attr.ngModel, function (newValue, oldvalue) { SharkValidHelper.triggerCheck(scope, elm, attr, ctrl, { value: newValue, compareValue: otherInput.$viewValue }, SharkValidConfig.repeatcheck); }); scope.$watch(function () { return otherInput.$modelValue; }, function (newValue, oldvalue) { SharkValidHelper.triggerCheck(scope, elm, attr, ctrl, { value: ctrl.$viewValue, compareValue: newValue }, SharkValidConfig.repeatcheck); }); } }; }]).directive('datetimecheck', ['SharkValidHelper', 'SharkValidConfig', function (SharkValidHelper, SharkValidConfig) { return { require: '?ngModel', link: function link(scope, elm, attr, ctrl) { if (!ctrl) return; scope.$watch(attr.ngModel, function (newVal, oldVal) { SharkValidHelper.triggerCheck(scope, elm, attr, ctrl, newVal, SharkValidConfig.datetimecheck); }); } }; }]).directive('minlencheck', ['SharkConfig', 'SharkValidHelper', 'SharkValidConfig', function (SharkConfig, SharkValidHelper, SharkValidConfig) { // 特殊,先保留 return { require: '?ngModel', link: function link($scope, elm, attr, ctrl) { if (!ctrl) return; $scope.$watch(attr.ngModel, function (newValue, oldvalue) { SharkValidHelper.triggerCheck($scope, elm, attr, ctrl, { value: newValue, compareLength: SharkConfig.getAttrValue($scope, attr.minlencheck) }, SharkValidConfig.minlencheck); }); } }; }]).directive('maxlencheck', ['SharkConfig', 'SharkValidHelper', 'SharkValidConfig', function (SharkConfig, SharkValidHelper, SharkValidConfig) { // 特殊,先保留 return { require: '?ngModel', link: function link($scope, elm, attr, ctrl) { if (!ctrl) return; $scope.$watch(attr.ngModel, function (newValue, oldvalue) { SharkValidHelper.triggerCheck($scope, elm, attr, ctrl, { value: newValue, compareLength: SharkConfig.getAttrValue($scope, attr.maxlencheck) }, SharkValidConfig.maxlencheck); }); } }; }]).directive('filecheck', ['SharkValidHelper', 'SharkValidConfig', function (SharkValidHelper, SharkValidConfig) { // 特殊,先保留 return { require: '?ngModel', link: function link($scope, elm, attr, ctrl) { if (!ctrl) return; // 节点名称为sharkfileupload的情况 if (elm[0] && elm[0].nodeName.toLowerCase() === 'sharkfileupload') { $scope.$watch(attr.ngModel, function (newValue, oldvalue) { SharkValidHelper.triggerCheck($scope, elm, attr, ctrl, newValue, SharkValidConfig.filecheck); }); } } }; }]).directive('ipcheck', ['SharkValidHelper', 'SharkValidConfig', function (SharkValidHelper, SharkValidConfig) { return { require: 'ngModel', link: function link($scope, elm, attr, ctrl) { if (!ctrl) return; $scope.$watch(attr.ngModel, function (newValue, oldvalue) { SharkValidHelper.triggerCheck($scope, elm, attr, ctrl, newValue, SharkValidConfig.ipcheck); }); } }; }]).directive('numbercheck', ['SharkValidHelper', 'SharkValidConfig', function (SharkValidHelper, SharkValidConfig) { return { require: '?ngModel', link: function link($scope, elm, attr, ctrl) { if (!ctrl) return; $scope.$watch(attr.ngModel, function (newValue, oldvalue) { SharkValidHelper.triggerCheck($scope, elm, attr, ctrl, newValue, SharkValidConfig.numbercheck); }); } }; }]).directive('phonenumcheck', ['SharkValidHelper', 'SharkValidConfig', function (SharkValidHelper, SharkValidConfig) { return { require: '?ngModel', link: function link($scope, elm, attr, ctrl) { if (!ctrl) return; $scope.$watch(attr.ngModel, function (newValue, oldvalue) { SharkValidHelper.triggerCheck($scope, elm, attr, ctrl, newValue, SharkValidConfig.phonenumcheck); }); } }; }]).directive('emailcheck', ['SharkValidHelper', 'SharkValidConfig', function (SharkValidHelper, SharkValidConfig) { return { require: '?ngModel', link: function link($scope, elm, attr, ctrl) { if (!ctrl) return; $scope.$watch(attr.ngModel, function (newValue, oldvalue) { SharkValidHelper.triggerCheck($scope, elm, attr, ctrl, newValue, SharkValidConfig.emailcheck); }); } }; }]).directive('customcheck', ['SharkConfig', 'SharkValidHelper', function (SharkConfig, SharkValidHelper) { return { require: '?ngModel', link: function link($scope, elm, attr, ctrl) { if (!ctrl) return; // 获取用户自定义验证函数 var customFn = SharkConfig.getAttrValue($scope, attr.customcheck); $scope.$watch(attr.ngModel, function (newValue, oldvalue) { SharkValidHelper.triggerCheck($scope, elm, attr, ctrl, newValue, customFn); }, true); } }; }]); /***/ }, /***/"7Lx1": /***/function Lx1(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function () { return COMPONENTS; }); var COMPONENTS = { autocomplete: 'sharkautocomplete', dropdown: 'sharkdropdown', fileupload: 'sharkfileupload', datepicker: 'sharkdatepicker', daterangepicker: 'sharkdaterangepicker', modal: 'sharkmodal', pager: 'sharkpager', popover: 'sharkpopover', selecter: 'sharkselecter', tabs: 'sharktabs', toastr: 'sharktoastr', tooltip: 'sharktooltip', tree: 'sharktree', radiogroup: 'radiogroup', checkboxgroup: 'checkboxgroup', checkabletable: 'checkabletable' }; /***/ }, /***/"7mCR": /***/function mCR(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__ntesmail_shark_ui__ = __webpack_require__("f4c1"); /* harmony import */var __WEBPACK_IMPORTED_MODULE_1__common_const__ = __webpack_require__("7Lx1"); angular.module('shark-angularjs.ui').directive(__WEBPACK_IMPORTED_MODULE_1__common_const__["a" /* COMPONENTS */].pager, ['SharkConfig', function (SharkConfig) { var PagerConfig = SharkConfig.getConfig()[__WEBPACK_IMPORTED_MODULE_1__common_const__["a" /* COMPONENTS */].pager]; return { restrict: 'E', link: function link($scope, element, attrs) { var pager; var disableWatcher; //销毁函数 function destroy() { if (disableWatcher) { disableWatcher(); } if (pager) { pager.destroy(); pager = null; } } // 回调函数 var pageWillChangedCb = SharkConfig.getAttrValue($scope, attrs.onPageWillChange); var pageChangedCb = SharkConfig.getAttrValue($scope, attrs.onPageChanged); // 语言 var hl = typeof attrs.hl !== 'undefined' ? SharkConfig.getAttrValue($scope, attrs.hl) : PagerConfig.hl; // 每页展示大小 var segmentSize = typeof attrs.segmentSize !== 'undefined' ? SharkConfig.getAttrValue($scope, attrs.segmentSize) : PagerConfig.segmentSize; // 页码从0开始还是从1开始 var startFrom = typeof attrs.startFrom !== 'undefined' ? SharkConfig.getAttrValue($scope, attrs.startFrom) : PagerConfig.startFrom; // 是否需要跳转按钮 var gopage = typeof attrs.gopage !== 'undefined' ? SharkConfig.getAttrValue($scope, attrs.gopage) : PagerConfig.gopage; // 如果定义了name属性,把pager组件赋给$scope var pagerName = attrs.name; // 初始化分页组件 pager = __WEBPACK_IMPORTED_MODULE_0__ntesmail_shark_ui__["a" /* SharkUI */].sharkPager({ hl: hl, segmentSize: segmentSize, startFrom: startFrom, gopage: gopage, onPageWillChange: function onPageWillChange() { if (typeof pageWillChangedCb === 'function') { return pageWillChangedCb.apply(pager, arguments); } }, onPageChanged: function onPageChanged() { if (typeof pageChangedCb === 'function') { pageChangedCb.apply(pager, arguments); if (!$scope.$$phase) { $scope.$apply(); } } } }); pager.appendTo(element); if (typeof attrs.ngDisabled !== 'undefined') { // 监听组件是否被禁用 disableWatcher = $scope.$watch(function () { return $scope.$eval(attrs.ngDisabled); }, function (newValue, oldValue) { if (pager) { if (newValue === true) { pager.disable(); } if (newValue === false) { pager.enable(); } } }); } // currentPage和totalPage变化后,触发回调函数 $scope.$watch(function () { return SharkConfig.getAttrValue($scope, attrs.currentPage) + '-' + SharkConfig.getAttrValue($scope, attrs.totalPage); }, function () { var page = SharkConfig.getAttrValue($scope, attrs.currentPage); var totalPages = SharkConfig.getAttrValue($scope, attrs.totalPage); pager.setPage(page, totalPages); }, true); if (pagerName) { $scope[pagerName] = pager; } // $scope销毁时同步销毁pager组件 $scope.$on('$destroy', function () { destroy(); }); } }; }]); /***/ }, /***/"7t+N": /***/function tN(module, exports, __webpack_require__) { var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__; /*! * jQuery JavaScript Library v3.2.1 * https://jquery.com/ * * Includes Sizzle.js * https://sizzlejs.com/ * * Copyright JS Foundation and other contributors * Released under the MIT license * https://jquery.org/license * * Date: 2017-03-20T18:59Z */ (function (global, factory) { "use strict"; if ((typeof module === 'undefined' ? 'undefined' : _typeof2(module)) === "object" && _typeof2(module.exports) === "object") { // For CommonJS and CommonJS-like environments where a proper `window` // is present, execute the factory and get jQuery. // For environments that do not have a `window` with a `document` // (such as Node.js), expose a factory as module.exports. // This accentuates the need for the creation of a real `window`. // e.g. var jQuery = require("jquery")(window); // See ticket #14549 for more info. module.exports = global.document ? factory(global, true) : function (w) { if (!w.document) { throw new Error("jQuery requires a window with a document"); } return factory(w); }; } else { factory(global); } // Pass this if window is not defined yet })(typeof window !== "undefined" ? window : this, function (window, noGlobal) { // Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1 // throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode // arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common // enough that all such attempts are guarded in a try block. "use strict"; var arr = []; var document = window.document; var getProto = Object.getPrototypeOf; var _slice = arr.slice; var concat = arr.concat; var push = arr.push; var indexOf = arr.indexOf; var class2type = {}; var toString = class2type.toString; var hasOwn = class2type.hasOwnProperty; var fnToString = hasOwn.toString; var ObjectFunctionString = fnToString.call(Object); var support = {}; function DOMEval(code, doc) { doc = doc || document; var script = doc.createElement("script"); script.text = code; doc.head.appendChild(script).parentNode.removeChild(script); } /* global Symbol */ // Defining this global in .eslintrc.json would create a danger of using the global // unguarded in another place, it seems safer to define global only for this module var version = "3.2.1", // Define a local copy of jQuery jQuery = function jQuery(selector, context) { // The jQuery object is actually just the init constructor 'enhanced' // Need init if jQuery is called (just allow error to be thrown if not included) return new jQuery.fn.init(selector, context); }, // Support: Android <=4.0 only // Make sure we trim BOM and NBSP rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, // Matches dashed string for camelizing rmsPrefix = /^-ms-/, rdashAlpha = /-([a-z])/g, // Used by jQuery.camelCase as callback to replace() fcamelCase = function fcamelCase(all, letter) { return letter.toUpperCase(); }; jQuery.fn = jQuery.prototype = { // The current version of jQuery being used jquery: version, constructor: jQuery, // The default length of a jQuery object is 0 length: 0, toArray: function toArray() { return _slice.call(this); }, // Get the Nth element in the matched element set OR // Get the whole matched element set as a clean array get: function get(num) { // Return all the elements in a clean array if (num == null) { return _slice.call(this); } // Return just the one element from the set return num < 0 ? this[num + this.length] : this[num]; }, // Take an array of elements and push it onto the stack // (returning the new matched element set) pushStack: function pushStack(elems) { // Build a new jQuery matched element set var ret = jQuery.merge(this.constructor(), elems); // Add the old object onto the stack (as a reference) ret.prevObject = this; // Return the newly-formed element set return ret; }, // Execute a callback for every element in the matched set. each: function each(callback) { return jQuery.each(this, callback); }, map: function map(callback) { return this.pushStack(jQuery.map(this, function (elem, i) { return callback.call(elem, i, elem); })); }, slice: function slice() { return this.pushStack(_slice.apply(this, arguments)); }, first: function first() { return this.eq(0); }, last: function last() { return this.eq(-1); }, eq: function eq(i) { var len = this.length, j = +i + (i < 0 ? len : 0); return this.pushStack(j >= 0 && j < len ? [this[j]] : []); }, end: function end() { return this.prevObject || this.constructor(); }, // For internal use only. // Behaves like an Array's method, not like a jQuery method. push: push, sort: arr.sort, splice: arr.splice }; jQuery.extend = jQuery.fn.extend = function () { var options, name, src, copy, copyIsArray, clone, target = arguments[0] || {}, i = 1, length = arguments.length, deep = false; // Handle a deep copy situation if (typeof target === "boolean") { deep = target; // Skip the boolean and the target target = arguments[i] || {}; i++; } // Handle case when target is a string or something (possible in deep copy) if ((typeof target === 'undefined' ? 'undefined' : _typeof2(target)) !== "object" && !jQuery.isFunction(target)) { target = {}; } // Extend jQuery itself if only one argument is passed if (i === length) { target = this; i--; } for (; i < length; i++) { // Only deal with non-null/undefined values if ((options = arguments[i]) != null) { // Extend the base object for (name in options) { src = target[name]; copy = options[name]; // Prevent never-ending loop if (target === copy) { continue; } // Recurse if we're merging plain objects or arrays if (deep && copy && (jQuery.isPlainObject(copy) || (copyIsArray = Array.isArray(copy)))) { if (copyIsArray) { copyIsArray = false; clone = src && Array.isArray(src) ? src : []; } else { clone = src && jQuery.isPlainObject(src) ? src : {}; } // Never move original objects, clone them target[name] = jQuery.extend(deep, clone, copy); // Don't bring in undefined values } else if (copy !== undefined) { target[name] = copy; } } } } // Return the modified object return target; }; jQuery.extend({ // Unique for each copy of jQuery on the page expando: "jQuery" + (version + Math.random()).replace(/\D/g, ""), // Assume jQuery is ready without the ready module isReady: true, error: function error(msg) { throw new Error(msg); }, noop: function noop() {}, isFunction: function isFunction(obj) { return jQuery.type(obj) === "function"; }, isWindow: function isWindow(obj) { return obj != null && obj === obj.window; }, isNumeric: function isNumeric(obj) { // As of jQuery 3.0, isNumeric is limited to // strings and numbers (primitives or objects) // that can be coerced to finite numbers (gh-2662) var type = jQuery.type(obj); return (type === "number" || type === "string") && // parseFloat NaNs numeric-cast false positives ("") // ...but misinterprets leading-number strings, particularly hex literals ("0x...") // subtraction forces infinities to NaN !isNaN(obj - parseFloat(obj)); }, isPlainObject: function isPlainObject(obj) { var proto, Ctor; // Detect obvious negatives // Use toString instead of jQuery.type to catch host objects if (!obj || toString.call(obj) !== "[object Object]") { return false; } proto = getProto(obj); // Objects with no prototype (e.g., `Object.create( null )`) are plain if (!proto) { return true; } // Objects with prototype are plain iff they were constructed by a global Object function Ctor = hasOwn.call(proto, "constructor") && proto.constructor; return typeof Ctor === "function" && fnToString.call(Ctor) === ObjectFunctionString; }, isEmptyObject: function isEmptyObject(obj) { /* eslint-disable no-unused-vars */ // See https://github.com/eslint/eslint/issues/6125 var name; for (name in obj) { return false; } return true; }, type: function type(obj) { if (obj == null) { return obj + ""; } // Support: Android <=2.3 only (functionish RegExp) return (typeof obj === 'undefined' ? 'undefined' : _typeof2(obj)) === "object" || typeof obj === "function" ? class2type[toString.call(obj)] || "object" : typeof obj === 'undefined' ? 'undefined' : _typeof2(obj); }, // Evaluates a script in a global context globalEval: function globalEval(code) { DOMEval(code); }, // Convert dashed to camelCase; used by the css and data modules // Support: IE <=9 - 11, Edge 12 - 13 // Microsoft forgot to hump their vendor prefix (#9572) camelCase: function camelCase(string) { return string.replace(rmsPrefix, "ms-").replace(rdashAlpha, fcamelCase); }, each: function each(obj, callback) { var length, i = 0; if (isArrayLike(obj)) { length = obj.length; for (; i < length; i++) { if (callback.call(obj[i], i, obj[i]) === false) { break; } } } else { for (i in obj) { if (callback.call(obj[i], i, obj[i]) === false) { break; } } } return obj; }, // Support: Android <=4.0 only trim: function trim(text) { return text == null ? "" : (text + "").replace(rtrim, ""); }, // results is for internal usage only makeArray: function makeArray(arr, results) { var ret = results || []; if (arr != null) { if (isArrayLike(Object(arr))) { jQuery.merge(ret, typeof arr === "string" ? [arr] : arr); } else { push.call(ret, arr); } } return ret; }, inArray: function inArray(elem, arr, i) { return arr == null ? -1 : indexOf.call(arr, elem, i); }, // Support: Android <=4.0 only, PhantomJS 1 only // push.apply(_, arraylike) throws on ancient WebKit merge: function merge(first, second) { var len = +second.length, j = 0, i = first.length; for (; j < len; j++) { first[i++] = second[j]; } first.length = i; return first; }, grep: function grep(elems, callback, invert) { var callbackInverse, matches = [], i = 0, length = elems.length, callbackExpect = !invert; // Go through the array, only saving the items // that pass the validator function for (; i < length; i++) { callbackInverse = !callback(elems[i], i); if (callbackInverse !== callbackExpect) { matches.push(elems[i]); } } return matches; }, // arg is for internal usage only map: function map(elems, callback, arg) { var length, value, i = 0, ret = []; // Go through the array, translating each of the items to their new values if (isArrayLike(elems)) { length = elems.length; for (; i < length; i++) { value = callback(elems[i], i, arg); if (value != null) { ret.push(value); } } // Go through every key on the object, } else { for (i in elems) { value = callback(elems[i], i, arg); if (value != null) { ret.push(value); } } } // Flatten any nested arrays return concat.apply([], ret); }, // A global GUID counter for objects guid: 1, // Bind a function to a context, optionally partially applying any // arguments. proxy: function proxy(fn, context) { var tmp, args, proxy; if (typeof context === "string") { tmp = fn[context]; context = fn; fn = tmp; } // Quick check to determine if target is callable, in the spec // this throws a TypeError, but we will just return undefined. if (!jQuery.isFunction(fn)) { return undefined; } // Simulated bind args = _slice.call(arguments, 2); proxy = function proxy() { return fn.apply(context || this, args.concat(_slice.call(arguments))); }; // Set the guid of unique handler to the same of original handler, so it can be removed proxy.guid = fn.guid = fn.guid || jQuery.guid++; return proxy; }, now: Date.now, // jQuery.support is not used in Core but other projects attach their // properties to it so it needs to exist. support: support }); if (typeof Symbol === "function") { jQuery.fn[Symbol.iterator] = arr[Symbol.iterator]; } // Populate the class2type map jQuery.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "), function (i, name) { class2type["[object " + name + "]"] = name.toLowerCase(); }); function isArrayLike(obj) { // Support: real iOS 8.2 only (not reproducible in simulator) // `in` check used to prevent JIT error (gh-2145) // hasOwn isn't used here due to false negatives // regarding Nodelist length in IE var length = !!obj && "length" in obj && obj.length, type = jQuery.type(obj); if (type === "function" || jQuery.isWindow(obj)) { return false; } return type === "array" || length === 0 || typeof length === "number" && length > 0 && length - 1 in obj; } var Sizzle = /*! * Sizzle CSS Selector Engine v2.3.3 * https://sizzlejs.com/ * * Copyright jQuery Foundation and other contributors * Released under the MIT license * http://jquery.org/license * * Date: 2016-08-08 */ function (window) { var i, support, Expr, getText, isXML, tokenize, compile, select, outermostContext, sortInput, hasDuplicate, // Local document vars setDocument, document, docElem, documentIsHTML, rbuggyQSA, rbuggyMatches, matches, contains, // Instance-specific data expando = "sizzle" + 1 * new Date(), preferredDoc = window.document, dirruns = 0, done = 0, classCache = createCache(), tokenCache = createCache(), compilerCache = createCache(), sortOrder = function sortOrder(a, b) { if (a === b) { hasDuplicate = true; } return 0; }, // Instance methods hasOwn = {}.hasOwnProperty, arr = [], pop = arr.pop, push_native = arr.push, push = arr.push, slice = arr.slice, // Use a stripped-down indexOf as it's faster than native // https://jsperf.com/thor-indexof-vs-for/5 indexOf = function indexOf(list, elem) { var i = 0, len = list.length; for (; i < len; i++) { if (list[i] === elem) { return i; } } return -1; }, booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped", // Regular expressions // http://www.w3.org/TR/css3-selectors/#whitespace whitespace = "[\\x20\\t\\r\\n\\f]", // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+", // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace + // Operator (capture 2) "*([*^$|!~]?=)" + whitespace + // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]" "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace + "*\\]", pseudos = ":(" + identifier + ")(?:\\((" + // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments: // 1. quoted (capture 3; capture 4 or capture 5) "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" + // 2. simple (capture 6) "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" + // 3. anything else (capture 2) ".*" + ")\\)|)", // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter rwhitespace = new RegExp(whitespace + "+", "g"), rtrim = new RegExp("^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g"), rcomma = new RegExp("^" + whitespace + "*," + whitespace + "*"), rcombinators = new RegExp("^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*"), rattributeQuotes = new RegExp("=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g"), rpseudo = new RegExp(pseudos), ridentifier = new RegExp("^" + identifier + "$"), matchExpr = { "ID": new RegExp("^#(" + identifier + ")"), "CLASS": new RegExp("^\\.(" + identifier + ")"), "TAG": new RegExp("^(" + identifier + "|[*])"), "ATTR": new RegExp("^" + attributes), "PSEUDO": new RegExp("^" + pseudos), "CHILD": new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + "*(\\d+)|))" + whitespace + "*\\)|)", "i"), "bool": new RegExp("^(?:" + booleans + ")$", "i"), // For use in libraries implementing .is() // We use this for POS matching in `select` "needsContext": new RegExp("^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i") }, rinputs = /^(?:input|select|textarea|button)$/i, rheader = /^h\d$/i, rnative = /^[^{]+\{\s*\[native \w/, // Easily-parseable/retrievable ID or TAG or CLASS selectors rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, rsibling = /[+~]/, // CSS escapes // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters runescape = new RegExp("\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig"), funescape = function funescape(_, escaped, escapedWhitespace) { var high = "0x" + escaped - 0x10000; // NaN means non-codepoint // Support: Firefox<24 // Workaround erroneous numeric interpretation of +"0x" return high !== high || escapedWhitespace ? escaped : high < 0 ? // BMP