vxe-table 3.4.12-beta.0 → 3.4.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/README.en.md +3 -1
  2. package/README.md +3 -1
  3. package/README.zh-TW.md +3 -1
  4. package/lib/edit/src/mixin.js +39 -13
  5. package/lib/edit/src/mixin.min.js +1 -1
  6. package/lib/export/src/mixin.js +15 -10
  7. package/lib/export/src/mixin.min.js +1 -1
  8. package/lib/footer/src/footer.js +11 -0
  9. package/lib/footer/src/footer.min.js +1 -1
  10. package/lib/form/src/form.js +2 -1
  11. package/lib/form/src/form.min.js +1 -1
  12. package/lib/grid/src/grid.js +5 -2
  13. package/lib/grid/src/grid.min.js +1 -1
  14. package/lib/header/src/header.js +12 -0
  15. package/lib/header/src/header.min.js +1 -1
  16. package/lib/index.css +1 -1
  17. package/lib/index.umd.js +229 -78
  18. package/lib/index.umd.min.js +1 -1
  19. package/lib/input/src/input.js +62 -39
  20. package/lib/input/src/input.min.js +1 -1
  21. package/lib/modal/src/modal.js +1 -1
  22. package/lib/modal/src/modal.min.js +1 -1
  23. package/lib/pulldown/src/pulldown.js +13 -0
  24. package/lib/pulldown/src/pulldown.min.js +1 -1
  25. package/lib/style.css +1 -1
  26. package/lib/style.min.css +1 -1
  27. package/lib/table/src/body.js +24 -5
  28. package/lib/table/src/body.min.js +1 -1
  29. package/lib/table/src/methods.js +48 -9
  30. package/lib/table/src/methods.min.js +1 -1
  31. package/lib/tools/src/utils.js +1 -0
  32. package/lib/tools/src/utils.min.js +1 -1
  33. package/package.json +4 -4
  34. package/packages/edit/src/mixin.js +20 -11
  35. package/packages/export/src/mixin.js +16 -9
  36. package/packages/footer/src/footer.js +10 -0
  37. package/packages/form/src/form.js +2 -1
  38. package/packages/grid/src/grid.js +3 -2
  39. package/packages/header/src/header.js +11 -0
  40. package/packages/input/src/input.js +46 -34
  41. package/packages/modal/src/modal.js +1 -1
  42. package/packages/pulldown/src/pulldown.js +12 -0
  43. package/packages/table/src/body.js +41 -7
  44. package/packages/table/src/methods.js +28 -9
  45. package/packages/tools/src/utils.js +1 -0
  46. package/styles/button.scss +4 -4
  47. package/styles/modal.scss +14 -13
  48. package/styles/table.scss +4 -4
  49. package/styles/variable.scss +8 -0
@@ -886,18 +886,11 @@ var _default2 = {
886
886
  dateValue: function dateValue() {
887
887
  var value = this.value,
888
888
  isDatePickerType = this.isDatePickerType,
889
- type = this.type,
890
889
  dateValueFormat = this.dateValueFormat;
891
890
  var val = null;
892
891
 
893
892
  if (value && isDatePickerType) {
894
- var date;
895
-
896
- if (type === 'time') {
897
- date = toStringTimeDate(value);
898
- } else {
899
- date = _xeUtils.default.toStringDate(value, dateValueFormat);
900
- }
893
+ var date = this.parseDate(value, dateValueFormat);
901
894
 
902
895
  if (_xeUtils.default.isValidDate(date)) {
903
896
  val = date;
@@ -956,15 +949,16 @@ var _default2 = {
956
949
 
957
950
  return '';
958
951
  },
952
+ firstDayOfWeek: function firstDayOfWeek() {
953
+ var startDay = this.startDay,
954
+ startWeek = this.startWeek;
955
+ return _xeUtils.default.toNumber(_xeUtils.default.isNumber(startDay) || _xeUtils.default.isString(startDay) ? startDay : startWeek);
956
+ },
959
957
  weekDatas: function weekDatas() {
960
958
  var weeks = [];
961
959
 
962
960
  if (this.isDatePickerType) {
963
- var startDay = this.startDay,
964
- startWeek = this.startWeek;
965
-
966
- var sWeek = _xeUtils.default.toNumber(_xeUtils.default.isNumber(startDay) || _xeUtils.default.isString(startDay) ? startDay : startWeek);
967
-
961
+ var sWeek = this.firstDayOfWeek;
968
962
  weeks.push(sWeek);
969
963
 
970
964
  for (var index = 0; index < 6; index++) {
@@ -1137,7 +1131,9 @@ var _default2 = {
1137
1131
  return _xeUtils.default.chunk(this.dayList, 7);
1138
1132
  },
1139
1133
  weekDates: function weekDates() {
1140
- return this.dayDatas.map(function (list) {
1134
+ var dayDatas = this.dayDatas,
1135
+ firstDayOfWeek = this.firstDayOfWeek;
1136
+ return dayDatas.map(function (list) {
1141
1137
  var firstItem = list[0];
1142
1138
  var item = {
1143
1139
  date: firstItem.date,
@@ -1146,7 +1142,7 @@ var _default2 = {
1146
1142
  isCurrent: false,
1147
1143
  isNow: false,
1148
1144
  isNext: false,
1149
- label: _xeUtils.default.getYearWeek(firstItem.date)
1145
+ label: _xeUtils.default.getYearWeek(firstItem.date, firstDayOfWeek)
1150
1146
  };
1151
1147
  return [item].concat(list);
1152
1148
  });
@@ -1241,8 +1237,10 @@ var _default2 = {
1241
1237
  this.initValue();
1242
1238
  },
1243
1239
  dateLabelFormat: function dateLabelFormat() {
1244
- this.dateParseValue(this.datePanelValue);
1245
- this.inputValue = this.datePanelLabel;
1240
+ if (this.isDatePickerType) {
1241
+ this.dateParseValue(this.datePanelValue);
1242
+ this.inputValue = this.datePanelLabel;
1243
+ }
1246
1244
  }
1247
1245
  },
1248
1246
  created: function created() {
@@ -1542,6 +1540,15 @@ var _default2 = {
1542
1540
  $event: evnt
1543
1541
  });
1544
1542
  },
1543
+ parseDate: function parseDate(value, format) {
1544
+ var type = this.type;
1545
+
1546
+ if (type === 'time') {
1547
+ return toStringTimeDate(value);
1548
+ }
1549
+
1550
+ return _xeUtils.default.toStringDate(value, format);
1551
+ },
1545
1552
 
1546
1553
  /**
1547
1554
  * 检查初始值
@@ -1586,7 +1593,8 @@ var _default2 = {
1586
1593
  datetimePanelValue = this.datetimePanelValue,
1587
1594
  dateLabelFormat = this.dateLabelFormat,
1588
1595
  min = this.min,
1589
- max = this.max;
1596
+ max = this.max,
1597
+ firstDayOfWeek = this.firstDayOfWeek;
1590
1598
 
1591
1599
  if (!inpReadonly) {
1592
1600
  if (isNumType) {
@@ -1615,13 +1623,7 @@ var _default2 = {
1615
1623
  if (inputValue) {
1616
1624
  if (type === 'week' || type === 'quarter') {// 周和季度选择器不支持解析,无需处理
1617
1625
  } else {
1618
- var inpDateVal;
1619
-
1620
- if (type === 'time') {
1621
- inpDateVal = toStringTimeDate(inputValue);
1622
- } else {
1623
- inpDateVal = _xeUtils.default.toStringDate(inputValue, dateLabelFormat);
1624
- }
1626
+ var inpDateVal = this.parseDate(inputValue, dateLabelFormat);
1625
1627
 
1626
1628
  if (_xeUtils.default.isValidDate(inpDateVal)) {
1627
1629
  if (type === 'time') {
@@ -1648,7 +1650,9 @@ var _default2 = {
1648
1650
  isChange = true;
1649
1651
  }
1650
1652
 
1651
- this.inputValue = _xeUtils.default.toDateString(inpDateVal, dateLabelFormat);
1653
+ this.inputValue = _xeUtils.default.toDateString(inpDateVal, dateLabelFormat, {
1654
+ firstDay: firstDayOfWeek
1655
+ });
1652
1656
 
1653
1657
  if (isChange) {
1654
1658
  this.dateChange(inpDateVal);
@@ -2042,20 +2046,35 @@ var _default2 = {
2042
2046
  dateParseValue: function dateParseValue(date) {
2043
2047
  var type = this.type,
2044
2048
  dateLabelFormat = this.dateLabelFormat,
2045
- valueFormat = this.valueFormat;
2049
+ valueFormat = this.valueFormat,
2050
+ firstDayOfWeek = this.firstDayOfWeek;
2046
2051
  var dValue = null;
2047
2052
  var dLabel = '';
2048
2053
 
2049
2054
  if (date) {
2050
- if (type === 'time') {
2051
- dValue = toStringTimeDate(date);
2052
- } else {
2053
- dValue = _xeUtils.default.toStringDate(date, valueFormat);
2054
- }
2055
+ dValue = this.parseDate(date, valueFormat);
2055
2056
  }
2056
2057
 
2057
2058
  if (_xeUtils.default.isValidDate(dValue)) {
2058
- dLabel = _xeUtils.default.toDateString(dValue, dateLabelFormat);
2059
+ dLabel = _xeUtils.default.toDateString(dValue, dateLabelFormat, {
2060
+ firstDay: firstDayOfWeek
2061
+ }); // 由于年份和第几周是冲突的行为,所以需要特殊处理,判断是否跨年
2062
+
2063
+ if (dateLabelFormat && type === 'week') {
2064
+ var firstWeekDate = _xeUtils.default.getWhatWeek(dValue, 0, firstDayOfWeek, firstDayOfWeek);
2065
+
2066
+ if (firstWeekDate.getFullYear() < dValue.getFullYear()) {
2067
+ var yyIndex = dateLabelFormat.indexOf('yyyy');
2068
+
2069
+ if (yyIndex > -1) {
2070
+ var yyNum = Number(dLabel.substring(yyIndex, yyIndex + 4));
2071
+
2072
+ if (yyNum && !isNaN(yyNum)) {
2073
+ dLabel = dLabel.replace("".concat(yyNum), "".concat(yyNum - 1));
2074
+ }
2075
+ }
2076
+ }
2077
+ }
2059
2078
  } else {
2060
2079
  dValue = null;
2061
2080
  }
@@ -2066,7 +2085,8 @@ var _default2 = {
2066
2085
  dateOffsetEvent: function dateOffsetEvent(evnt) {
2067
2086
  var isActivated = this.isActivated,
2068
2087
  datePanelValue = this.datePanelValue,
2069
- datePanelType = this.datePanelType;
2088
+ datePanelType = this.datePanelType,
2089
+ firstDayOfWeek = this.firstDayOfWeek;
2070
2090
 
2071
2091
  if (isActivated) {
2072
2092
  evnt.preventDefault();
@@ -2124,11 +2144,11 @@ var _default2 = {
2124
2144
  if (isLeftArrow) {
2125
2145
  offsetDay = _xeUtils.default.getWhatDay(offsetDay, -1);
2126
2146
  } else if (isUpArrow) {
2127
- offsetDay = _xeUtils.default.getWhatWeek(offsetDay, -1);
2147
+ offsetDay = _xeUtils.default.getWhatWeek(offsetDay, -1, firstDayOfWeek);
2128
2148
  } else if (isRightArrow) {
2129
2149
  offsetDay = _xeUtils.default.getWhatDay(offsetDay, 1);
2130
2150
  } else if (isDwArrow) {
2131
- offsetDay = _xeUtils.default.getWhatWeek(offsetDay, 1);
2151
+ offsetDay = _xeUtils.default.getWhatWeek(offsetDay, 1, firstDayOfWeek);
2132
2152
  }
2133
2153
 
2134
2154
  this.dateMoveDay(offsetDay);
@@ -2152,19 +2172,22 @@ var _default2 = {
2152
2172
  dateChange: function dateChange(date) {
2153
2173
  var value = this.value,
2154
2174
  datetimePanelValue = this.datetimePanelValue,
2155
- dateValueFormat = this.dateValueFormat;
2175
+ dateValueFormat = this.dateValueFormat,
2176
+ firstDayOfWeek = this.firstDayOfWeek;
2156
2177
 
2157
2178
  if (this.type === 'week') {
2158
2179
  var sWeek = _xeUtils.default.toNumber(this.selectDay);
2159
2180
 
2160
- date = _xeUtils.default.getWhatWeek(date, 0, sWeek);
2181
+ date = _xeUtils.default.getWhatWeek(date, 0, sWeek, firstDayOfWeek);
2161
2182
  } else if (this.hasTime) {
2162
2183
  date.setHours(datetimePanelValue.getHours());
2163
2184
  date.setMinutes(datetimePanelValue.getMinutes());
2164
2185
  date.setSeconds(datetimePanelValue.getSeconds());
2165
2186
  }
2166
2187
 
2167
- var inpVal = _xeUtils.default.toDateString(date, dateValueFormat);
2188
+ var inpVal = _xeUtils.default.toDateString(date, dateValueFormat, {
2189
+ firstDay: firstDayOfWeek
2190
+ });
2168
2191
 
2169
2192
  this.dateCheckMonth(date);
2170
2193
 
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _xeUtils=_interopRequireDefault(require("xe-utils")),_conf=_interopRequireDefault(require("../../v-x-e-table/src/conf")),_size=_interopRequireDefault(require("../../mixins/size")),_tools=require("../../tools");function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function ownKeys(t,e){var i,a=Object.keys(t);return Object.getOwnPropertySymbols&&(i=Object.getOwnPropertySymbols(t),e&&(i=i.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),a.push.apply(a,i)),a}function _objectSpread(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?ownKeys(Object(i),!0).forEach(function(e){_defineProperty(t,e,i[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):ownKeys(Object(i)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))})}return t}function _defineProperty(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}var yearSize=20,monthSize=20,quarterSize=8;function toStringTimeDate(e){if(e){var t,i,a,n=new Date;return _xeUtils.default.isDate(e)?(t=e.getHours(),i=e.getMinutes(),a=e.getSeconds()):(e=(e=_xeUtils.default.toValueString(e)).match(/^(\d{1,2})(:(\d{1,2}))?(:(\d{1,2}))?/))&&(t=e[1],i=e[3],a=e[5]),n.setHours(t||0),n.setMinutes(i||0),n.setSeconds(a||0),n}return new Date("")}function getDateQuarter(e){e=e.getMonth();return e<3?1:e<6?2:e<9?3:4}function toFloatValueFixed(e,t){return/^-/.test(""+e)?_xeUtils.default.toFixed(_xeUtils.default.ceil(e,t),t):_xeUtils.default.toFixed(_xeUtils.default.floor(e,t),t)}function getNumberValue(e,t){var i=e.type,a=e.exponential,n=e.digitsValue,e=e.inpMaxlength,n="float"===i?toFloatValueFixed(t,n):_xeUtils.default.toValueString(t);return!a||t!==n&&_xeUtils.default.toValueString(t).toLowerCase()!==_xeUtils.default.toNumber(n).toExponential()?n.slice(0,e):t}function renderDateLabel(t,e,i,a){var n=e.festivalMethod;if(n){n=n(_objectSpread({$input:e,type:e.datePanelType,viewType:e.datePanelType},i)),e=n?_xeUtils.default.isString(n)?{label:n}:n:{},i=e.extra?_xeUtils.default.isString(e.extra)?{label:e.extra}:e.extra:null,n=[t("span",{class:["vxe-input--date-label",{"is-notice":e.notice}]},i&&i.label?[t("span",a),t("span",{class:["vxe-input--date-label--extra",i.important?"is-important":"",i.className],style:i.style},_xeUtils.default.toValueString(i.label))]:a)],i=e.label;return i&&(i=_xeUtils.default.toValueString(i).split(","),n.push(t("span",{class:["vxe-input--date-festival",e.important?"is-important":"",e.className],style:e.style},[1<i.length?t("span",{class:["vxe-input--date-festival--overlap","overlap--".concat(i.length)]},i.map(function(e){return t("span",e.substring(0,3))})):t("span",{class:"vxe-input--date-festival--label"},i[0].substring(0,3))]))),n}return a}function isDateDisabled(e,t){var i=e.disabledMethod;return i&&i({$input:e,type:e.datePanelType,viewType:e.datePanelType,date:t.date})}function renderDateDayTable(t,i){var e=i.datePanelType,a=i.dateValue,n=i.datePanelValue,s=i.dateHeaders,r=i.dayDatas,l="yyyy-MM-dd";return[t("table",{class:"vxe-input--date-".concat(e,"-view"),attrs:{cellspacing:0,cellpadding:0,border:0}},[t("thead",[t("tr",s.map(function(e){return t("th",e.label)}))]),t("tbody",r.map(function(e){return t("tr",e.map(function(e){return t("td",{class:{"is--prev":e.isPrev,"is--current":e.isCurrent,"is--now":e.isNow,"is--next":e.isNext,"is--disabled":isDateDisabled(i,e),"is--selected":_xeUtils.default.isDateSame(a,e.date,l),"is--hover":_xeUtils.default.isDateSame(n,e.date,l)},on:{click:function(){return i.dateSelectEvent(e)},mouseenter:function(){return i.dateMouseenterEvent(e)}}},renderDateLabel(t,i,e,e.label))}))}))])]}function renderDateWeekTable(a,n){var e=n.datePanelType,s=n.dateValue,r=n.datePanelValue,t=n.weekHeaders,i=n.weekDates,l="yyyyMMdd";return[a("table",{class:"vxe-input--date-".concat(e,"-view"),attrs:{cellspacing:0,cellpadding:0,border:0}},[a("thead",[a("tr",t.map(function(e){return a("th",e.label)}))]),a("tbody",i.map(function(e){var t=e.some(function(e){return _xeUtils.default.isDateSame(s,e.date,l)}),i=e.some(function(e){return _xeUtils.default.isDateSame(r,e.date,l)});return a("tr",e.map(function(e){return a("td",{class:{"is--prev":e.isPrev,"is--current":e.isCurrent,"is--now":e.isNow,"is--next":e.isNext,"is--disabled":isDateDisabled(n,e),"is--selected":t,"is--hover":i},on:{click:function(){return n.dateSelectEvent(e)},mouseenter:function(){return n.dateMouseenterEvent(e)}}},renderDateLabel(a,n,e,e.label))}))}))])]}function renderDateMonthTable(t,i){var a=i.dateValue,e=i.datePanelType,n=i.monthDatas,s=i.datePanelValue;return[t("table",{class:"vxe-input--date-".concat(e,"-view"),attrs:{cellspacing:0,cellpadding:0,border:0}},[t("tbody",n.map(function(e){return t("tr",e.map(function(e){return t("td",{class:{"is--prev":e.isPrev,"is--current":e.isCurrent,"is--now":e.isNow,"is--next":e.isNext,"is--disabled":isDateDisabled(i,e),"is--selected":_xeUtils.default.isDateSame(a,e.date,"yyyyMM"),"is--hover":_xeUtils.default.isDateSame(s,e.date,"yyyyMM")},on:{click:function(){return i.dateSelectEvent(e)},mouseenter:function(){return i.dateMouseenterEvent(e)}}},renderDateLabel(t,i,e,_conf.default.i18n("vxe.input.date.months.m".concat(e.month))))}))}))])]}function renderDateQuarterTable(t,i){var a=i.dateValue,e=i.datePanelType,n=i.quarterDatas,s=i.datePanelValue;return[t("table",{class:"vxe-input--date-".concat(e,"-view"),attrs:{cellspacing:0,cellpadding:0,border:0}},[t("tbody",n.map(function(e){return t("tr",e.map(function(e){return t("td",{class:{"is--prev":e.isPrev,"is--current":e.isCurrent,"is--now":e.isNow,"is--next":e.isNext,"is--disabled":isDateDisabled(i,e),"is--selected":_xeUtils.default.isDateSame(a,e.date,"yyyyq"),"is--hover":_xeUtils.default.isDateSame(s,e.date,"yyyyq")},on:{click:function(){return i.dateSelectEvent(e)},mouseenter:function(){return i.dateMouseenterEvent(e)}}},renderDateLabel(t,i,e,_conf.default.i18n("vxe.input.date.quarters.q".concat(e.quarter))))}))}))])]}function renderDateYearTable(t,i){var a=i.dateValue,e=i.datePanelType,n=i.yearDatas,s=i.datePanelValue;return[t("table",{class:"vxe-input--date-".concat(e,"-view"),attrs:{cellspacing:0,cellpadding:0,border:0}},[t("tbody",n.map(function(e){return t("tr",e.map(function(e){return t("td",{class:{"is--disabled":isDateDisabled(i,e),"is--current":e.isCurrent,"is--now":e.isNow,"is--selected":_xeUtils.default.isDateSame(a,e.date,"yyyy"),"is--hover":_xeUtils.default.isDateSame(s,e.date,"yyyy")},on:{click:function(){return i.dateSelectEvent(e)},mouseenter:function(){return i.dateMouseenterEvent(e)}}},renderDateLabel(t,i,e,e.year))}))}))])]}function renderDateTable(e,t){switch(t.datePanelType){case"week":return renderDateWeekTable(e,t);case"month":return renderDateMonthTable(e,t);case"quarter":return renderDateQuarterTable(e,t);case"year":return renderDateYearTable(e,t)}return renderDateDayTable(e,t)}function renderDatePanel(e,t){var i=t.datePanelType,a=t.selectDatePanelLabel,n=t.isDisabledPrevDateBtn,s=t.isDisabledNextDateBtn;return[e("div",{class:"vxe-input--date-picker-header"},[e("div",{class:"vxe-input--date-picker-type-wrapper"},[e("span","year"===i?{class:"vxe-input--date-picker-label"}:{class:"vxe-input--date-picker-btn",on:{click:t.dateToggleTypeEvent}},a)]),e("div",{class:"vxe-input--date-picker-btn-wrapper"},[e("span",{class:["vxe-input--date-picker-btn vxe-input--date-picker-prev-btn",{"is--disabled":n}],on:{click:t.datePrevEvent}},[e("i",{class:"vxe-icon--caret-left"})]),e("span",{class:"vxe-input--date-picker-btn vxe-input--date-picker-current-btn",on:{click:t.dateTodayMonthEvent}},[e("i",{class:"vxe-icon--dot"})]),e("span",{class:["vxe-input--date-picker-btn vxe-input--date-picker-next-btn",{"is--disabled":s}],on:{click:t.dateNextEvent}},[e("i",{class:"vxe-icon--caret-right"})])])]),e("div",{class:"vxe-input--date-picker-body"},renderDateTable(e,t))]}function renderTimePanel(i,a){var e=a.dateTimeLabel,n=a.datetimePanelValue,t=a.hourList,s=a.minuteList,r=a.secondList;return[i("div",{class:"vxe-input--time-picker-header"},[i("span",{class:"vxe-input--time-picker-title"},e),i("button",{class:"vxe-input--time-picker-confirm",attrs:{type:"button"},on:{click:a.dateConfirmEvent}},_conf.default.i18n("vxe.button.confirm"))]),i("div",{ref:"timeBody",class:"vxe-input--time-picker-body"},[i("ul",{class:"vxe-input--time-picker-hour-list"},t.map(function(t,e){return i("li",{key:e,class:{"is--selected":n&&n.getHours()===t.value},on:{click:function(e){return a.dateHourEvent(e,t)}}},t.label)})),i("ul",{class:"vxe-input--time-picker-minute-list"},s.map(function(t,e){return i("li",{key:e,class:{"is--selected":n&&n.getMinutes()===t.value},on:{click:function(e){return a.dateMinuteEvent(e,t)}}},t.label)})),i("ul",{class:"vxe-input--time-picker-second-list"},r.map(function(t,e){return i("li",{key:e,class:{"is--selected":n&&n.getSeconds()===t.value},on:{click:function(e){return a.dateSecondEvent(e,t)}}},t.label)}))])]}function renderPanel(e,t){var i=t.type,a=t.vSize,n=t.isDatePickerType,s=t.transfer,r=t.animatVisible,l=t.visiblePanel,u=t.panelPlacement,o=t.panelStyle,d=[];return n?("datetime"===i?d.push(e("div",{class:"vxe-input--panel-layout-wrapper"},[e("div",{class:"vxe-input--panel-left-wrapper"},renderDatePanel(e,t)),e("div",{class:"vxe-input--panel-right-wrapper"},renderTimePanel(e,t))])):"time"===i?d.push(e("div",{class:"vxe-input--panel-wrapper"},renderTimePanel(e,t))):d.push(e("div",{class:"vxe-input--panel-wrapper"},renderDatePanel(e,t))),e("div",{ref:"panel",class:["vxe-table--ignore-clear vxe-input--panel","type--".concat(i),(_defineProperty(i={},"size--".concat(a),a),_defineProperty(i,"is--transfer",s),_defineProperty(i,"animat--leave",r),_defineProperty(i,"animat--enter",l),i)],attrs:{placement:u},style:o},d)):null}function renderNumberIcon(e,t){return e("span",{class:"vxe-input--number-suffix"},[e("span",{class:"vxe-input--number-prev is--prev",on:{mousedown:t.numberMousedownEvent,mouseup:t.numberStopDown,mouseleave:t.numberStopDown}},[e("i",{class:["vxe-input--number-prev-icon",_conf.default.icon.INPUT_PREV_NUM]})]),e("span",{class:"vxe-input--number-next is--next",on:{mousedown:t.numberMousedownEvent,mouseup:t.numberStopDown,mouseleave:t.numberStopDown}},[e("i",{class:["vxe-input--number-next-icon",_conf.default.icon.INPUT_NEXT_NUM]})])])}function renderDatePickerIcon(e,t){return e("span",{class:"vxe-input--date-picker-suffix",on:{click:t.datePickerOpenEvent}},[e("i",{class:["vxe-input--date-picker-icon",_conf.default.icon.INPUT_DATE]})])}function renderSearchIcon(e,t){return e("span",{class:"vxe-input--search-suffix",on:{click:t.searchEvent}},[e("i",{class:["vxe-input--search-icon",_conf.default.icon.INPUT_SEARCH]})])}function renderPasswordIcon(e,t){var i=t.showPwd;return e("span",{class:"vxe-input--password-suffix",on:{click:t.passwordToggleEvent}},[e("i",{class:["vxe-input--password-icon",i?_conf.default.icon.INPUT_SHOW_PWD:_conf.default.icon.INPUT_PWD]})])}function rendePrefixIcon(e,t){var i=t.$scopedSlots,a=t.prefixIcon,n=[];return i.prefix?n.push(e("span",{class:"vxe-input--prefix-icon"},i.prefix.call(this,{},e))):a&&n.push(e("i",{class:["vxe-input--prefix-icon",a]})),n.length?e("span",{class:"vxe-input--prefix",on:{click:t.clickPrefixEvent}},n):null}function renderSuffixIcon(e,t){var i=t.$scopedSlots,a=t.inputValue,n=t.isClearable,s=t.disabled,r=t.suffixIcon,l=[];return i.suffix?l.push(e("span",{class:"vxe-input--suffix-icon"},i.suffix.call(this,{},e))):r&&l.push(e("i",{class:["vxe-input--suffix-icon",r]})),n&&l.push(e("i",{class:["vxe-input--clear-icon",_conf.default.icon.INPUT_CLEAR]})),l.length?e("span",{class:["vxe-input--suffix",{"is--clear":n&&!s&&!(""===a||_xeUtils.default.eqNull(a))}],on:{click:t.clickSuffixEvent}},l):null}function renderExtraSuffixIcon(e,t){var i,a=t.controls,n=t.isPawdType,s=t.isNumType,r=t.isDatePickerType,l=t.isSearch;return n?i=renderPasswordIcon(e,t):s?a&&(i=renderNumberIcon(e,t)):r?i=renderDatePickerIcon(e,t):l&&(i=renderSearchIcon(e,t)),i?e("span",{class:"vxe-input--extra-suffix"},[i]):null}var _default2={name:"VxeInput",mixins:[_size.default],model:{prop:"value",event:"modelValue"},props:{value:[String,Number,Date],immediate:{type:Boolean,default:!0},name:String,type:{type:String,default:"text"},clearable:{type:Boolean,default:function(){return _conf.default.input.clearable}},readonly:Boolean,disabled:Boolean,placeholder:String,maxlength:[String,Number],autocomplete:{type:String,default:"off"},align:String,form:String,className:String,size:{type:String,default:function(){return _conf.default.input.size||_conf.default.size}},min:{type:[String,Number],default:null},max:{type:[String,Number],default:null},step:[String,Number],exponential:{type:Boolean,default:function(){return _conf.default.input.exponential}},controls:{type:Boolean,default:function(){return _conf.default.input.controls}},digits:{type:[String,Number],default:function(){return _conf.default.input.digits}},dateConfig:Object,minDate:{type:[String,Number,Date],default:function(){return _conf.default.input.minDate}},maxDate:{type:[String,Number,Date],default:function(){return _conf.default.input.maxDate}},startWeek:Number,startDay:{type:[String,Number],default:function(){return _conf.default.input.startDay}},labelFormat:{type:String,default:function(){return _conf.default.input.labelFormat}},valueFormat:{type:String,default:function(){return _conf.default.input.valueFormat}},editable:{type:Boolean,default:!0},festivalMethod:{type:Function,default:function(){return _conf.default.input.festivalMethod}},disabledMethod:{type:Function,default:function(){return _conf.default.input.disabledMethod}},selectDay:{type:Number,default:function(){return _conf.default.input.selectDay}},prefixIcon:String,suffixIcon:String,placement:String,transfer:{type:Boolean,default:function(){return _conf.default.input.transfer}}},data:function(){return{panelIndex:0,showPwd:!1,visiblePanel:!1,animatVisible:!1,panelStyle:null,panelPlacement:null,isActivated:!1,inputValue:this.value,datetimePanelValue:null,datePanelValue:null,datePanelLabel:"",datePanelType:"day",selectMonth:null,currentDate:null}},computed:{isNumType:function(){return-1<["number","integer","float"].indexOf(this.type)},isDatePickerType:function(){return this.hasTime||-1<["date","week","month","quarter","year"].indexOf(this.type)},hasTime:function(){var e=this.type;return"time"===e||"datetime"===e},isPawdType:function(){return"password"===this.type},isSearch:function(){return"search"===this.type},stepValue:function(){var e=this.type,t=this.step;return"integer"===e?_xeUtils.default.toInteger(t)||1:"float"===e?_xeUtils.default.toNumber(t)||1/Math.pow(10,this.digitsValue):_xeUtils.default.toNumber(t)||1},digitsValue:function(){return _xeUtils.default.toInteger(this.digits)||1},isClearable:function(){return this.clearable&&(this.isPawdType||this.isNumType||this.isDatePickerType||"text"===this.type||"search"===this.type)},isDisabledPrevDateBtn:function(){var e=this.selectMonth,t=this.dateMinTime;return!!e&&e<=t},isDisabledNextDateBtn:function(){var e=this.selectMonth,t=this.dateMaxTime;return!!e&&t<=e},dateMinTime:function(){return this.minDate?_xeUtils.default.toStringDate(this.minDate):null},dateMaxTime:function(){return this.maxDate?_xeUtils.default.toStringDate(this.maxDate):null},dateValue:function(){var e=this.value,t=this.isDatePickerType,i=this.type,a=this.dateValueFormat,n=null;return e&&t&&(a="time"===i?toStringTimeDate(e):_xeUtils.default.toStringDate(e,a),_xeUtils.default.isValidDate(a)&&(n=a)),n},dateTimeLabel:function(){var e=this.datetimePanelValue;return e?_xeUtils.default.toDateString(e,"HH:mm:ss"):""},hmsTime:function(){var e=this.dateValue;return e&&this.hasTime?1e3*(3600*e.getHours()+60*e.getMinutes()+e.getSeconds()):0},dateLabelFormat:function(){return this.isDatePickerType?this.labelFormat||_conf.default.i18n("vxe.input.date.labelFormat.".concat(this.type)):null},dateValueFormat:function(){var e=this.type;return"time"===e?"HH:mm:ss":this.valueFormat||("datetime"===e?"yyyy-MM-dd HH:mm:ss":"yyyy-MM-dd")},selectDatePanelLabel:function(){if(this.isDatePickerType){var e,t=this.datePanelType,i=this.selectMonth,a=this.yearList,n="";return i&&(n=i.getFullYear(),e=i.getMonth()+1),"quarter"===t?_conf.default.i18n("vxe.input.date.quarterLabel",[n]):"month"===t?_conf.default.i18n("vxe.input.date.monthLabel",[n]):"year"===t?a.length?"".concat(a[0].year," - ").concat(a[a.length-1].year):"":_conf.default.i18n("vxe.input.date.dayLabel",[n,e?_conf.default.i18n("vxe.input.date.m".concat(e)):"-"])}return""},weekDatas:function(){var e=[];if(this.isDatePickerType){var t=this.startDay,i=this.startWeek,a=_xeUtils.default.toNumber(_xeUtils.default.isNumber(t)||_xeUtils.default.isString(t)?t:i);e.push(a);for(var n=0;n<6;n++)6<=a?a=0:a++,e.push(a)}return e},dateHeaders:function(){return this.isDatePickerType?this.weekDatas.map(function(e){return{value:e,label:_conf.default.i18n("vxe.input.date.weeks.w".concat(e))}}):[]},weekHeaders:function(){return this.isDatePickerType?[{label:_conf.default.i18n("vxe.input.date.weeks.w")}].concat(this.dateHeaders):[]},yearList:function(){var e=this.selectMonth,t=this.currentDate,i=[];if(e&&t)for(var a=t.getFullYear(),n=new Date((""+e.getFullYear()).replace(/\d{1}$/,"0"),0,1),s=-10;s<yearSize-10;s++){var r=_xeUtils.default.getWhatYear(n,s,"first"),l=r.getFullYear();i.push({date:r,isCurrent:!0,isNow:a===l,year:l})}return i},yearDatas:function(){return _xeUtils.default.chunk(this.yearList,4)},quarterList:function(){var e=this.selectMonth,t=this.currentDate,i=[];if(e&&t)for(var a=t.getFullYear(),n=getDateQuarter(t),s=_xeUtils.default.getWhatYear(e,0,"first"),r=s.getFullYear(),l=-2;l<quarterSize-2;l++){var u=_xeUtils.default.getWhatQuarter(s,l),o=u.getFullYear(),d=getDateQuarter(u),h=o<r;i.push({date:u,isPrev:h,isCurrent:o===r,isNow:o===a&&d===n,isNext:!h&&r<o,quarter:d})}return i},quarterDatas:function(){return _xeUtils.default.chunk(this.quarterList,2)},monthList:function(){var e=this.selectMonth,t=this.currentDate,i=[];if(e&&t)for(var a=t.getFullYear(),n=t.getMonth(),s=_xeUtils.default.getWhatYear(e,0,"first").getFullYear(),r=-4;r<monthSize-4;r++){var l=_xeUtils.default.getWhatYear(e,0,r),u=l.getFullYear(),o=l.getMonth(),d=u<s;i.push({date:l,isPrev:d,isCurrent:u===s,isNow:u===a&&o===n,isNext:!d&&s<u,month:o})}return i},monthDatas:function(){return _xeUtils.default.chunk(this.monthList,4)},dayList:function(){var e=this.weekDatas,t=this.selectMonth,i=this.currentDate,a=this.hmsTime,n=[];if(t&&i)for(var s=i.getFullYear(),r=i.getMonth(),l=i.getDate(),u=t.getFullYear(),o=t.getMonth(),i=t.getDay(),i=-e.indexOf(i),d=new Date(_xeUtils.default.getWhatDay(t,i).getTime()+a),h=0;h<42;h++){var c=_xeUtils.default.getWhatDay(d,h),f=c.getFullYear(),p=c.getMonth(),v=c.getDate(),m=c<t;n.push({date:c,isPrev:m,isCurrent:f===u&&p===o,isNow:f===s&&p===r&&v===l,isNext:!m&&o!==p,label:v})}return n},dayDatas:function(){return _xeUtils.default.chunk(this.dayList,7)},weekDates:function(){return this.dayDatas.map(function(e){var t=e[0];return[{date:t.date,isWeekNumber:!0,isPrev:!1,isCurrent:!1,isNow:!1,isNext:!1,label:_xeUtils.default.getYearWeek(t.date)}].concat(e)})},hourList:function(){var e=[];if(this.hasTime)for(var t=0;t<24;t++)e.push({value:t,label:(""+t).padStart(2,0)});return e},minuteList:function(){var e=[];if(this.hasTime)for(var t=0;t<60;t++)e.push({value:t,label:(""+t).padStart(2,0)});return e},secondList:function(){return this.minuteList},inpImmediate:function(){var e=this.type;return this.immediate||!("text"===e||"number"===e||"integer"===e||"float"===e)},inpPlaceholder:function(){var e=this.placeholder;return e?_tools.UtilTools.getFuncText(e):""},inputType:function(){var e=this.isDatePickerType,t=this.isNumType,i=this.isPawdType,a=this.type,n=this.showPwd;return e||t||i&&n||"number"===a?"text":a},inpMaxlength:function(){var e=this.isNumType,t=this.maxlength;return e&&!_xeUtils.default.toNumber(t)?16:t},inpReadonly:function(){var e=this.type,t=this.readonly,i=this.editable;return t||!i||"week"===e||"quarter"===e}},watch:{value:function(e){this.inputValue=e,this.changeValue()},type:function(){Object.assign(this,{inputValue:this.value,datetimePanelValue:null,datePanelValue:null,datePanelLabel:"",datePanelType:"day",selectMonth:null,currentDate:null}),this.initValue()},dateLabelFormat:function(){this.dateParseValue(this.datePanelValue),this.inputValue=this.datePanelLabel}},created:function(){this.initValue(),_tools.GlobalEvent.on(this,"mousewheel",this.handleGlobalMousewheelEvent),_tools.GlobalEvent.on(this,"mousedown",this.handleGlobalMousedownEvent),_tools.GlobalEvent.on(this,"keydown",this.handleGlobalKeydownEvent),_tools.GlobalEvent.on(this,"blur",this.handleGlobalBlurEvent)},mounted:function(){this.dateConfig&&_tools.UtilTools.warn("vxe.error.removeProp",["date-config"]),this.isDatePickerType&&this.transfer&&document.body.appendChild(this.$refs.panel)},beforeDestroy:function(){var e=this.$refs.panel;e&&e.parentNode&&e.parentNode.removeChild(e)},destroyed:function(){this.numberStopDown(),_tools.GlobalEvent.off(this,"mousewheel"),_tools.GlobalEvent.off(this,"mousedown"),_tools.GlobalEvent.off(this,"keydown"),_tools.GlobalEvent.off(this,"blur")},render:function(e){var t=this.name,i=this.form,a=this.inputType,n=this.inpPlaceholder,s=this.inpMaxlength,r=this.inpReadonly,l=this.className,u=this.controls,o=this.inputValue,d=this.isDatePickerType,h=this.visiblePanel,c=this.isActivated,f=this.vSize,p=this.type,v=this.align,m=this.readonly,y=this.disabled,x=this.autocomplete,b=[],g=rendePrefixIcon(e,this),D=renderSuffixIcon(e,this);return g&&b.push(g),b.push(e("input",{ref:"input",class:"vxe-input--inner",domProps:{value:o},attrs:{name:t,form:i,type:a,placeholder:n,maxlength:s,readonly:r,disabled:y,autocomplete:x},on:{keydown:this.keydownEvent,keyup:this.triggerEvent,wheel:this.wheelEvent,click:this.clickEvent,input:this.inputEvent,change:this.changeEvent,focus:this.focusEvent,blur:this.blurEvent}})),D&&b.push(D),b.push(renderExtraSuffixIcon(e,this)),d&&b.push(renderPanel(e,this)),e("div",{class:["vxe-input","type--".concat(p),l,(_defineProperty(l={},"size--".concat(f),f),_defineProperty(l,"is--".concat(v),v),_defineProperty(l,"is--controls",u),_defineProperty(l,"is--prefix",!!g),_defineProperty(l,"is--suffix",!!D),_defineProperty(l,"is--readonly",m),_defineProperty(l,"is--visivle",h),_defineProperty(l,"is--disabled",y),_defineProperty(l,"is--active",c),l)]},b)},methods:{focus:function(){return this.isActivated=!0,this.$refs.input.focus(),this.$nextTick()},blur:function(){return this.$refs.input.blur(),this.isActivated=!1,this.$nextTick()},triggerEvent:function(e){var t=this.$refs,i=this.inputValue;this.$emit(e.type,{$panel:t.panel,value:i,$event:e})},emitModel:function(e,t){this.inputValue=e,this.$emit("modelValue",e),this.$emit("input",{value:e,$event:t}),_xeUtils.default.toValueString(this.value)!==e&&this.$emit("change",{value:e,$event:t})},emitInputEvent:function(e,t){var i=this.inpImmediate,a=this.isDatePickerType;this.inputValue=e,a||(i?this.emitModel(e,t):this.$emit("input",{value:e,$event:t}))},inputEvent:function(e){var t=e.target.value;this.emitInputEvent(t,e)},changeEvent:function(e){this.inpImmediate||this.triggerEvent(e)},focusEvent:function(e){this.isActivated=!0,this.triggerEvent(e)},blurEvent:function(e){var t=this.inputValue;this.inpImmediate||this.emitModel(t,e),this.afterCheckValue(),this.visiblePanel||(this.isActivated=!1),this.$emit("blur",{value:t,$event:e})},keydownEvent:function(e){var t,i,a,n,s=this.exponential,r=this.controls;this.isNumType&&(t=e.ctrlKey,i=e.shiftKey,a=e.altKey,n=e.keyCode,t||i||a||!(32===n||(!s||69!==n)&&65<=n&&n<=90||186<=n&&n<=188||191<=n)||e.preventDefault(),r&&this.numberKeydownEvent(e)),this.triggerEvent(e)},wheelEvent:function(e){var t;this.isNumType&&this.controls&&this.isActivated&&(0<(t=e.deltaY)?this.numberNextEvent(e):t<0&&this.numberPrevEvent(e),e.preventDefault()),this.triggerEvent(e)},clickEvent:function(e){this.isDatePickerType&&this.datePickerOpenEvent(e),this.triggerEvent(e)},clickPrefixEvent:function(e){var t=this.$refs,i=this.disabled,a=this.inputValue;i||this.$emit("prefix-click",{$panel:t.panel,value:a,$event:e})},clickSuffixEvent:function(e){var t=this.$refs,i=this.disabled,a=this.inputValue;i||(_tools.DomTools.hasClass(e.currentTarget,"is--clear")?(this.emitModel("",e),this.clearValueEvent(e,"")):this.$emit("suffix-click",{$panel:t.panel,value:a,$event:e}))},clearValueEvent:function(e,t){var i=this.$refs,a=this.type,n=this.isNumType;this.isDatePickerType&&this.hidePanel(),(n||-1<["text","search","password"].indexOf(a))&&this.focus(),this.$emit("clear",{$panel:i.panel,value:t,$event:e})},initValue:function(){var e=this.type,t=this.isDatePickerType,i=this.inputValue,a=this.digitsValue;t?this.changeValue():"float"===e&&(!i||i!==(a=toFloatValueFixed(i,a))&&this.emitModel(a,{type:"init"}))},changeValue:function(){this.isDatePickerType&&(this.dateParseValue(this.inputValue),this.inputValue=this.datePanelLabel)},afterCheckValue:function(){var e,t=this.type,i=this.exponential,a=this.inpReadonly,n=this.inputValue,s=this.isDatePickerType,r=this.isNumType,l=this.datetimePanelValue,u=this.dateLabelFormat,o=this.min,d=this.max;a||(r?n&&(e="integer"===t?_xeUtils.default.toInteger(n):_xeUtils.default.toNumber(n),this.vaildMinNum(e)?this.vaildMaxNum(e)||(e=d):e=o,!i||(i=_xeUtils.default.toValueString(n).toLowerCase())===_xeUtils.default.toNumber(e).toExponential()&&(e=i),this.emitModel(getNumberValue(this,e),{type:"check"})):s&&(n?"week"===t||"quarter"===t||(e="time"===t?toStringTimeDate(n):_xeUtils.default.toStringDate(n,u),_xeUtils.default.isValidDate(e)?"time"===t?(n!==(e=toStringTimeDate(e))&&this.emitModel(e,{type:"check"}),this.inputValue=e):(s=!1,"datetime"===t?n===_xeUtils.default.toDateString(this.dateValue,u)&&n===_xeUtils.default.toDateString(e,u)||(s=!0,l.setHours(e.getHours()),l.setMinutes(e.getMinutes()),l.setSeconds(e.getSeconds())):s=!0,this.inputValue=_xeUtils.default.toDateString(e,u),s&&this.dateChange(e)):this.dateRevert()):this.emitModel("",{type:"check"})))},passwordToggleEvent:function(e){var t=this.disabled,i=this.readonly,a=this.showPwd;t||i||(this.showPwd=!a),this.$emit("toggle-visible",{visible:this.showPwd,$event:e})},searchEvent:function(e){this.$emit("search-click",{$event:e})},vaildMinNum:function(e){return null===this.min||e>=_xeUtils.default.toNumber(this.min)},vaildMaxNum:function(e){return null===this.max||e<=_xeUtils.default.toNumber(this.max)},numberStopDown:function(){clearTimeout(this.downbumTimeout)},numberDownPrevEvent:function(e){var t=this;this.downbumTimeout=setTimeout(function(){t.numberPrevEvent(e),t.numberDownPrevEvent(e)},60)},numberDownNextEvent:function(e){var t=this;this.downbumTimeout=setTimeout(function(){t.numberNextEvent(e),t.numberDownNextEvent(e)},60)},numberKeydownEvent:function(e){var t=e.keyCode,i=38===t;!i&&40!==t||(e.preventDefault(),i?this.numberPrevEvent(e):this.numberNextEvent(e))},numberMousedownEvent:function(e){var t,i=this;this.numberStopDown(),0===e.button&&((t=_tools.DomTools.hasClass(e.currentTarget,"is--prev"))?this.numberPrevEvent(e):this.numberNextEvent(e),this.downbumTimeout=setTimeout(function(){t?i.numberDownPrevEvent(e):i.numberDownNextEvent(e)},500))},numberPrevEvent:function(e){var t=this.disabled,i=this.readonly;clearTimeout(this.downbumTimeout),t||i||this.numberChange(!0,e),this.$emit("prev-number",{$event:e})},numberNextEvent:function(e){var t=this.disabled,i=this.readonly;clearTimeout(this.downbumTimeout),t||i||this.numberChange(!1,e),this.$emit("next-number",{$event:e})},numberChange:function(e,t){var i=this.min,a=this.max,n=this.type,s=this.inputValue,r=this.stepValue,s="integer"===n?_xeUtils.default.toInteger(s):_xeUtils.default.toNumber(s),r=e?_xeUtils.default.add(s,r):_xeUtils.default.subtract(s,r),i=this.vaildMinNum(r)?this.vaildMaxNum(r)?r:a:i;this.emitInputEvent(getNumberValue(this,i),t)},datePickerOpenEvent:function(e){this.readonly||(e.preventDefault(),this.showPanel())},dateMonthHandle:function(e,t){this.selectMonth=_xeUtils.default.getWhatMonth(e,t,"first")},dateNowHandle:function(){var e=_xeUtils.default.getWhatDay(Date.now(),0,"first");this.currentDate=e,this.dateMonthHandle(e,0)},dateToggleTypeEvent:function(){var e="month"===(e=this.datePanelType)||"quarter"===e?"year":"month";this.datePanelType=e},datePrevEvent:function(e){var t=this.isDisabledPrevDateBtn,i=this.type,a=this.datePanelType;t||(this.selectMonth="year"===i?_xeUtils.default.getWhatYear(this.selectMonth,-yearSize,"first"):"month"===i||"quarter"===i?"year"===a?_xeUtils.default.getWhatYear(this.selectMonth,-yearSize,"first"):_xeUtils.default.getWhatYear(this.selectMonth,-1,"first"):"year"===a?_xeUtils.default.getWhatYear(this.selectMonth,-yearSize,"first"):"month"===a?_xeUtils.default.getWhatYear(this.selectMonth,-1,"first"):_xeUtils.default.getWhatMonth(this.selectMonth,-1,"first"),this.$emit("date-prev",{type:i,$event:e}))},dateTodayMonthEvent:function(e){this.dateNowHandle(),this.dateChange(this.currentDate),this.hidePanel(),this.$emit("date-today",{type:this.type,$event:e})},dateNextEvent:function(e){var t=this.isDisabledNextDateBtn,i=this.type,a=this.datePanelType;t||(this.selectMonth="year"===i?_xeUtils.default.getWhatYear(this.selectMonth,yearSize,"first"):"month"===i||"quarter"===i?"year"===a?_xeUtils.default.getWhatYear(this.selectMonth,yearSize,"first"):_xeUtils.default.getWhatYear(this.selectMonth,1,"first"):"year"===a?_xeUtils.default.getWhatYear(this.selectMonth,yearSize,"first"):"month"===a?_xeUtils.default.getWhatYear(this.selectMonth,1,"first"):_xeUtils.default.getWhatMonth(this.selectMonth,1,"first"),this.$emit("date-next",{type:i,$event:e}))},dateSelectEvent:function(e){isDateDisabled(this,e)||this.dateSelectItem(e.date)},dateSelectItem:function(e){var t=this.type,i=this.datePanelType,a="week"===t;"month"===t?"year"===i?(this.datePanelType="month",this.dateCheckMonth(e)):(this.dateChange(e),this.hidePanel()):"year"===t?(this.hidePanel(),this.dateChange(e)):"quarter"===t?"year"===i?(this.datePanelType="quarter",this.dateCheckMonth(e)):(this.dateChange(e),this.hidePanel()):"month"===i?(this.datePanelType="week"===t?t:"day",this.dateCheckMonth(e)):"year"===i?(this.datePanelType="month",this.dateCheckMonth(e)):(this.dateChange(e),this.hidePanel()),a&&this.changeValue()},dateMouseenterEvent:function(e){var t;isDateDisabled(this,e)||("month"===(t=this.datePanelType)?this.dateMoveMonth(e.date):"quarter"===t?this.dateMoveQuarter(e.date):"year"===t?this.dateMoveYear(e.date):this.dateMoveDay(e.date))},dateHourEvent:function(e,t){this.datetimePanelValue.setHours(t.value),this.dateTimeChangeEvent(e)},dateConfirmEvent:function(){this.dateChange(this.dateValue||this.currentDate),this.hidePanel()},dateMinuteEvent:function(e,t){this.datetimePanelValue.setMinutes(t.value),this.dateTimeChangeEvent(e)},dateSecondEvent:function(e,t){this.datetimePanelValue.setSeconds(t.value),this.dateTimeChangeEvent(e)},dateTimeChangeEvent:function(e){this.datetimePanelValue=new Date(this.datetimePanelValue.getTime()),this.updateTimePos(e.currentTarget)},updateTimePos:function(e){var t;e&&(t=e.offsetHeight,e.parentNode.scrollTop=e.offsetTop-4*t)},dateMoveDay:function(t){isDateDisabled(this,{date:t})||(this.dayList.some(function(e){return _xeUtils.default.isDateSame(e.date,t,"yyyyMMdd")})||this.dateCheckMonth(t),this.dateParseValue(t))},dateMoveMonth:function(t){isDateDisabled(this,{date:t})||(this.monthList.some(function(e){return _xeUtils.default.isDateSame(e.date,t,"yyyyMM")})||this.dateCheckMonth(t),this.dateParseValue(t))},dateMoveQuarter:function(t){isDateDisabled(this,{date:t})||(this.quarterList.some(function(e){return _xeUtils.default.isDateSame(e.date,t,"yyyyq")})||this.dateCheckMonth(t),this.dateParseValue(t))},dateMoveYear:function(t){isDateDisabled(this,{date:t})||(this.yearList.some(function(e){return _xeUtils.default.isDateSame(e.date,t,"yyyy")})||this.dateCheckMonth(t),this.dateParseValue(t))},dateParseValue:function(e){var t=this.type,i=this.dateLabelFormat,a=this.valueFormat,n=null,s="";e&&(n="time"===t?toStringTimeDate(e):_xeUtils.default.toStringDate(e,a)),_xeUtils.default.isValidDate(n)?s=_xeUtils.default.toDateString(n,i):n=null,this.datePanelValue=n,this.datePanelLabel=s},dateOffsetEvent:function(e){var t,i,a,n=this.isActivated,s=this.datePanelValue,r=this.datePanelType;n&&(e.preventDefault(),t=37===(i=e.keyCode),n=38===i,e=39===i,i=40===i,"year"===r?(a=_xeUtils.default.getWhatYear(s||Date.now(),0,"first"),t?a=_xeUtils.default.getWhatYear(a,-1):n?a=_xeUtils.default.getWhatYear(a,-4):e?a=_xeUtils.default.getWhatYear(a,1):i&&(a=_xeUtils.default.getWhatYear(a,4)),this.dateMoveYear(a)):"quarter"===r?(a=_xeUtils.default.getWhatQuarter(s||Date.now(),0,"first"),t?a=_xeUtils.default.getWhatQuarter(a,-1):n?a=_xeUtils.default.getWhatQuarter(a,-2):e?a=_xeUtils.default.getWhatQuarter(a,1):i&&(a=_xeUtils.default.getWhatQuarter(a,2)),this.dateMoveQuarter(a)):"month"===r?(r=_xeUtils.default.getWhatMonth(s||Date.now(),0,"first"),t?r=_xeUtils.default.getWhatMonth(r,-1):n?r=_xeUtils.default.getWhatMonth(r,-4):e?r=_xeUtils.default.getWhatMonth(r,1):i&&(r=_xeUtils.default.getWhatMonth(r,4)),this.dateMoveMonth(r)):(s=s||_xeUtils.default.getWhatDay(Date.now(),0,"first"),t?s=_xeUtils.default.getWhatDay(s,-1):n?s=_xeUtils.default.getWhatWeek(s,-1):e?s=_xeUtils.default.getWhatDay(s,1):i&&(s=_xeUtils.default.getWhatWeek(s,1)),this.dateMoveDay(s)))},datePgOffsetEvent:function(e){var t;this.isActivated&&(t=33===e.keyCode,e.preventDefault(),t?this.datePrevEvent(e):this.dateNextEvent(e))},dateChange:function(e){var t,i=this.value,a=this.datetimePanelValue,n=this.dateValueFormat;"week"===this.type?(t=_xeUtils.default.toNumber(this.selectDay),e=_xeUtils.default.getWhatWeek(e,0,t)):this.hasTime&&(e.setHours(a.getHours()),e.setMinutes(a.getMinutes()),e.setSeconds(a.getSeconds()));n=_xeUtils.default.toDateString(e,n);this.dateCheckMonth(e),_xeUtils.default.isEqual(i,n)||this.emitModel(n,{type:"update"})},dateCheckMonth:function(e){e=_xeUtils.default.getWhatMonth(e,0,"first");_xeUtils.default.isEqual(e,this.selectMonth)||(this.selectMonth=e)},dateOpenPanel:function(){var e=this,t=this.type,i=this.dateValue;-1<["year","quarter","month","week"].indexOf(t)?this.datePanelType=t:this.datePanelType="day",this.currentDate=_xeUtils.default.getWhatDay(Date.now(),0,"first"),i?(this.dateMonthHandle(i,0),this.dateParseValue(i)):this.dateNowHandle(),this.hasTime&&(this.datetimePanelValue=this.datePanelValue||_xeUtils.default.getWhatDay(Date.now(),0,"first"),this.$nextTick(function(){_xeUtils.default.arrayEach(e.$refs.timeBody.querySelectorAll("li.is--selected"),e.updateTimePos)}))},dateRevert:function(){this.inputValue=this.datePanelLabel},updateZindex:function(){this.panelIndex<_tools.UtilTools.getLastZIndex()&&(this.panelIndex=_tools.UtilTools.nextZIndex())},showPanel:function(){var e=this,t=this.disabled,i=this.visiblePanel,a=this.isDatePickerType;t||i||(clearTimeout(this.hidePanelTimeout),this.isActivated=!0,this.animatVisible=!0,a&&this.dateOpenPanel(),setTimeout(function(){e.visiblePanel=!0},10),this.updateZindex(),this.updatePlacement())},hidePanel:function(){var e=this;this.visiblePanel=!1,this.hidePanelTimeout=setTimeout(function(){e.animatVisible=!1},350)},updatePlacement:function(){var c=this;return this.$nextTick().then(function(){var e=c.$refs,t=c.transfer,i=c.placement,a=c.panelIndex,n=e.input,s=e.panel;if(n&&s){var r=n.offsetHeight,l=n.offsetWidth,u=s.offsetHeight,o=s.offsetWidth,d={zIndex:a},h=_tools.DomTools.getAbsolutePos(n),e=h.boundingTop,s=h.boundingLeft,a=h.visibleHeight,n=h.visibleWidth,h="bottom";return t?(t=e+r,"top"===i?(h="top",t=e-u):i||(a<t+u+5&&(h="top",t=e-u),t<5&&(h="bottom",t=e+r)),n<(s=s)+o+5&&(s-=s+o+5-n),s<5&&(s=5),Object.assign(d,{left:"".concat(s,"px"),top:"".concat(t,"px"),minWidth:"".concat(l,"px")})):"top"===i?(h="top",d.bottom="".concat(r,"px")):i||a<e+r+u&&5<e-r-u&&(h="top",d.bottom="".concat(r,"px")),c.panelStyle=d,c.panelPlacement=h,c.$nextTick()}})},handleGlobalMousedownEvent:function(e){var t=this.$refs,i=this.$el,a=this.disabled,n=this.visiblePanel,s=this.isActivated;!a&&s&&(this.isActivated=_tools.DomTools.getEventTargetNode(e,i).flag||_tools.DomTools.getEventTargetNode(e,t.panel).flag,this.isActivated||(this.isDatePickerType?n&&(this.hidePanel(),this.afterCheckValue()):this.afterCheckValue()))},handleGlobalKeydownEvent:function(e){var t,i,a,n,s,r,l,u,o,d,h=this.isDatePickerType,c=this.visiblePanel,f=this.clearable;this.disabled||(i=46===(t=e.keyCode),a=27===t,n=13===t,s=38===t,r=40===t,l=33===t,u=34===t,o=37===t||s||39===t||r,d=this.isActivated,(t=9===t)?(d&&this.afterCheckValue(),this.isActivated=d=!1):o?h&&d&&(c?this.dateOffsetEvent(e):(s||r)&&this.datePickerOpenEvent(e)):n?h&&(c?this.datePanelValue?this.dateSelectItem(this.datePanelValue):this.hidePanel():d&&this.datePickerOpenEvent(e)):(l||u)&&h&&d&&this.datePgOffsetEvent(e),t||a?c&&this.hidePanel():i&&f&&d&&this.clearValueEvent(e,null))},handleGlobalMousewheelEvent:function(e){var t=this.$refs,i=this.disabled,a=this.visiblePanel;i||a&&(_tools.DomTools.getEventTargetNode(e,t.panel).flag?this.updatePlacement():(this.hidePanel(),this.afterCheckValue()))},handleGlobalBlurEvent:function(){var e=this.isActivated;this.visiblePanel?(this.hidePanel(),this.afterCheckValue()):e&&this.afterCheckValue()}}};exports.default=_default2;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _xeUtils=_interopRequireDefault(require("xe-utils")),_conf=_interopRequireDefault(require("../../v-x-e-table/src/conf")),_size=_interopRequireDefault(require("../../mixins/size")),_tools=require("../../tools");function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function ownKeys(t,e){var i,a=Object.keys(t);return Object.getOwnPropertySymbols&&(i=Object.getOwnPropertySymbols(t),e&&(i=i.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),a.push.apply(a,i)),a}function _objectSpread(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?ownKeys(Object(i),!0).forEach(function(e){_defineProperty(t,e,i[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):ownKeys(Object(i)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))})}return t}function _defineProperty(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}var yearSize=20,monthSize=20,quarterSize=8;function toStringTimeDate(e){if(e){var t,i,a,n=new Date;return _xeUtils.default.isDate(e)?(t=e.getHours(),i=e.getMinutes(),a=e.getSeconds()):(e=(e=_xeUtils.default.toValueString(e)).match(/^(\d{1,2})(:(\d{1,2}))?(:(\d{1,2}))?/))&&(t=e[1],i=e[3],a=e[5]),n.setHours(t||0),n.setMinutes(i||0),n.setSeconds(a||0),n}return new Date("")}function getDateQuarter(e){e=e.getMonth();return e<3?1:e<6?2:e<9?3:4}function toFloatValueFixed(e,t){return/^-/.test(""+e)?_xeUtils.default.toFixed(_xeUtils.default.ceil(e,t),t):_xeUtils.default.toFixed(_xeUtils.default.floor(e,t),t)}function getNumberValue(e,t){var i=e.type,a=e.exponential,n=e.digitsValue,e=e.inpMaxlength,n="float"===i?toFloatValueFixed(t,n):_xeUtils.default.toValueString(t);return!a||t!==n&&_xeUtils.default.toValueString(t).toLowerCase()!==_xeUtils.default.toNumber(n).toExponential()?n.slice(0,e):t}function renderDateLabel(t,e,i,a){var n=e.festivalMethod;if(n){n=n(_objectSpread({$input:e,type:e.datePanelType,viewType:e.datePanelType},i)),e=n?_xeUtils.default.isString(n)?{label:n}:n:{},i=e.extra?_xeUtils.default.isString(e.extra)?{label:e.extra}:e.extra:null,n=[t("span",{class:["vxe-input--date-label",{"is-notice":e.notice}]},i&&i.label?[t("span",a),t("span",{class:["vxe-input--date-label--extra",i.important?"is-important":"",i.className],style:i.style},_xeUtils.default.toValueString(i.label))]:a)],i=e.label;return i&&(i=_xeUtils.default.toValueString(i).split(","),n.push(t("span",{class:["vxe-input--date-festival",e.important?"is-important":"",e.className],style:e.style},[1<i.length?t("span",{class:["vxe-input--date-festival--overlap","overlap--".concat(i.length)]},i.map(function(e){return t("span",e.substring(0,3))})):t("span",{class:"vxe-input--date-festival--label"},i[0].substring(0,3))]))),n}return a}function isDateDisabled(e,t){var i=e.disabledMethod;return i&&i({$input:e,type:e.datePanelType,viewType:e.datePanelType,date:t.date})}function renderDateDayTable(t,i){var e=i.datePanelType,a=i.dateValue,n=i.datePanelValue,s=i.dateHeaders,r=i.dayDatas,l="yyyy-MM-dd";return[t("table",{class:"vxe-input--date-".concat(e,"-view"),attrs:{cellspacing:0,cellpadding:0,border:0}},[t("thead",[t("tr",s.map(function(e){return t("th",e.label)}))]),t("tbody",r.map(function(e){return t("tr",e.map(function(e){return t("td",{class:{"is--prev":e.isPrev,"is--current":e.isCurrent,"is--now":e.isNow,"is--next":e.isNext,"is--disabled":isDateDisabled(i,e),"is--selected":_xeUtils.default.isDateSame(a,e.date,l),"is--hover":_xeUtils.default.isDateSame(n,e.date,l)},on:{click:function(){return i.dateSelectEvent(e)},mouseenter:function(){return i.dateMouseenterEvent(e)}}},renderDateLabel(t,i,e,e.label))}))}))])]}function renderDateWeekTable(a,n){var e=n.datePanelType,s=n.dateValue,r=n.datePanelValue,t=n.weekHeaders,i=n.weekDates,l="yyyyMMdd";return[a("table",{class:"vxe-input--date-".concat(e,"-view"),attrs:{cellspacing:0,cellpadding:0,border:0}},[a("thead",[a("tr",t.map(function(e){return a("th",e.label)}))]),a("tbody",i.map(function(e){var t=e.some(function(e){return _xeUtils.default.isDateSame(s,e.date,l)}),i=e.some(function(e){return _xeUtils.default.isDateSame(r,e.date,l)});return a("tr",e.map(function(e){return a("td",{class:{"is--prev":e.isPrev,"is--current":e.isCurrent,"is--now":e.isNow,"is--next":e.isNext,"is--disabled":isDateDisabled(n,e),"is--selected":t,"is--hover":i},on:{click:function(){return n.dateSelectEvent(e)},mouseenter:function(){return n.dateMouseenterEvent(e)}}},renderDateLabel(a,n,e,e.label))}))}))])]}function renderDateMonthTable(t,i){var a=i.dateValue,e=i.datePanelType,n=i.monthDatas,s=i.datePanelValue;return[t("table",{class:"vxe-input--date-".concat(e,"-view"),attrs:{cellspacing:0,cellpadding:0,border:0}},[t("tbody",n.map(function(e){return t("tr",e.map(function(e){return t("td",{class:{"is--prev":e.isPrev,"is--current":e.isCurrent,"is--now":e.isNow,"is--next":e.isNext,"is--disabled":isDateDisabled(i,e),"is--selected":_xeUtils.default.isDateSame(a,e.date,"yyyyMM"),"is--hover":_xeUtils.default.isDateSame(s,e.date,"yyyyMM")},on:{click:function(){return i.dateSelectEvent(e)},mouseenter:function(){return i.dateMouseenterEvent(e)}}},renderDateLabel(t,i,e,_conf.default.i18n("vxe.input.date.months.m".concat(e.month))))}))}))])]}function renderDateQuarterTable(t,i){var a=i.dateValue,e=i.datePanelType,n=i.quarterDatas,s=i.datePanelValue;return[t("table",{class:"vxe-input--date-".concat(e,"-view"),attrs:{cellspacing:0,cellpadding:0,border:0}},[t("tbody",n.map(function(e){return t("tr",e.map(function(e){return t("td",{class:{"is--prev":e.isPrev,"is--current":e.isCurrent,"is--now":e.isNow,"is--next":e.isNext,"is--disabled":isDateDisabled(i,e),"is--selected":_xeUtils.default.isDateSame(a,e.date,"yyyyq"),"is--hover":_xeUtils.default.isDateSame(s,e.date,"yyyyq")},on:{click:function(){return i.dateSelectEvent(e)},mouseenter:function(){return i.dateMouseenterEvent(e)}}},renderDateLabel(t,i,e,_conf.default.i18n("vxe.input.date.quarters.q".concat(e.quarter))))}))}))])]}function renderDateYearTable(t,i){var a=i.dateValue,e=i.datePanelType,n=i.yearDatas,s=i.datePanelValue;return[t("table",{class:"vxe-input--date-".concat(e,"-view"),attrs:{cellspacing:0,cellpadding:0,border:0}},[t("tbody",n.map(function(e){return t("tr",e.map(function(e){return t("td",{class:{"is--disabled":isDateDisabled(i,e),"is--current":e.isCurrent,"is--now":e.isNow,"is--selected":_xeUtils.default.isDateSame(a,e.date,"yyyy"),"is--hover":_xeUtils.default.isDateSame(s,e.date,"yyyy")},on:{click:function(){return i.dateSelectEvent(e)},mouseenter:function(){return i.dateMouseenterEvent(e)}}},renderDateLabel(t,i,e,e.year))}))}))])]}function renderDateTable(e,t){switch(t.datePanelType){case"week":return renderDateWeekTable(e,t);case"month":return renderDateMonthTable(e,t);case"quarter":return renderDateQuarterTable(e,t);case"year":return renderDateYearTable(e,t)}return renderDateDayTable(e,t)}function renderDatePanel(e,t){var i=t.datePanelType,a=t.selectDatePanelLabel,n=t.isDisabledPrevDateBtn,s=t.isDisabledNextDateBtn;return[e("div",{class:"vxe-input--date-picker-header"},[e("div",{class:"vxe-input--date-picker-type-wrapper"},[e("span","year"===i?{class:"vxe-input--date-picker-label"}:{class:"vxe-input--date-picker-btn",on:{click:t.dateToggleTypeEvent}},a)]),e("div",{class:"vxe-input--date-picker-btn-wrapper"},[e("span",{class:["vxe-input--date-picker-btn vxe-input--date-picker-prev-btn",{"is--disabled":n}],on:{click:t.datePrevEvent}},[e("i",{class:"vxe-icon--caret-left"})]),e("span",{class:"vxe-input--date-picker-btn vxe-input--date-picker-current-btn",on:{click:t.dateTodayMonthEvent}},[e("i",{class:"vxe-icon--dot"})]),e("span",{class:["vxe-input--date-picker-btn vxe-input--date-picker-next-btn",{"is--disabled":s}],on:{click:t.dateNextEvent}},[e("i",{class:"vxe-icon--caret-right"})])])]),e("div",{class:"vxe-input--date-picker-body"},renderDateTable(e,t))]}function renderTimePanel(i,a){var e=a.dateTimeLabel,n=a.datetimePanelValue,t=a.hourList,s=a.minuteList,r=a.secondList;return[i("div",{class:"vxe-input--time-picker-header"},[i("span",{class:"vxe-input--time-picker-title"},e),i("button",{class:"vxe-input--time-picker-confirm",attrs:{type:"button"},on:{click:a.dateConfirmEvent}},_conf.default.i18n("vxe.button.confirm"))]),i("div",{ref:"timeBody",class:"vxe-input--time-picker-body"},[i("ul",{class:"vxe-input--time-picker-hour-list"},t.map(function(t,e){return i("li",{key:e,class:{"is--selected":n&&n.getHours()===t.value},on:{click:function(e){return a.dateHourEvent(e,t)}}},t.label)})),i("ul",{class:"vxe-input--time-picker-minute-list"},s.map(function(t,e){return i("li",{key:e,class:{"is--selected":n&&n.getMinutes()===t.value},on:{click:function(e){return a.dateMinuteEvent(e,t)}}},t.label)})),i("ul",{class:"vxe-input--time-picker-second-list"},r.map(function(t,e){return i("li",{key:e,class:{"is--selected":n&&n.getSeconds()===t.value},on:{click:function(e){return a.dateSecondEvent(e,t)}}},t.label)}))])]}function renderPanel(e,t){var i=t.type,a=t.vSize,n=t.isDatePickerType,s=t.transfer,r=t.animatVisible,l=t.visiblePanel,u=t.panelPlacement,o=t.panelStyle,d=[];return n?("datetime"===i?d.push(e("div",{class:"vxe-input--panel-layout-wrapper"},[e("div",{class:"vxe-input--panel-left-wrapper"},renderDatePanel(e,t)),e("div",{class:"vxe-input--panel-right-wrapper"},renderTimePanel(e,t))])):"time"===i?d.push(e("div",{class:"vxe-input--panel-wrapper"},renderTimePanel(e,t))):d.push(e("div",{class:"vxe-input--panel-wrapper"},renderDatePanel(e,t))),e("div",{ref:"panel",class:["vxe-table--ignore-clear vxe-input--panel","type--".concat(i),(_defineProperty(i={},"size--".concat(a),a),_defineProperty(i,"is--transfer",s),_defineProperty(i,"animat--leave",r),_defineProperty(i,"animat--enter",l),i)],attrs:{placement:u},style:o},d)):null}function renderNumberIcon(e,t){return e("span",{class:"vxe-input--number-suffix"},[e("span",{class:"vxe-input--number-prev is--prev",on:{mousedown:t.numberMousedownEvent,mouseup:t.numberStopDown,mouseleave:t.numberStopDown}},[e("i",{class:["vxe-input--number-prev-icon",_conf.default.icon.INPUT_PREV_NUM]})]),e("span",{class:"vxe-input--number-next is--next",on:{mousedown:t.numberMousedownEvent,mouseup:t.numberStopDown,mouseleave:t.numberStopDown}},[e("i",{class:["vxe-input--number-next-icon",_conf.default.icon.INPUT_NEXT_NUM]})])])}function renderDatePickerIcon(e,t){return e("span",{class:"vxe-input--date-picker-suffix",on:{click:t.datePickerOpenEvent}},[e("i",{class:["vxe-input--date-picker-icon",_conf.default.icon.INPUT_DATE]})])}function renderSearchIcon(e,t){return e("span",{class:"vxe-input--search-suffix",on:{click:t.searchEvent}},[e("i",{class:["vxe-input--search-icon",_conf.default.icon.INPUT_SEARCH]})])}function renderPasswordIcon(e,t){var i=t.showPwd;return e("span",{class:"vxe-input--password-suffix",on:{click:t.passwordToggleEvent}},[e("i",{class:["vxe-input--password-icon",i?_conf.default.icon.INPUT_SHOW_PWD:_conf.default.icon.INPUT_PWD]})])}function rendePrefixIcon(e,t){var i=t.$scopedSlots,a=t.prefixIcon,n=[];return i.prefix?n.push(e("span",{class:"vxe-input--prefix-icon"},i.prefix.call(this,{},e))):a&&n.push(e("i",{class:["vxe-input--prefix-icon",a]})),n.length?e("span",{class:"vxe-input--prefix",on:{click:t.clickPrefixEvent}},n):null}function renderSuffixIcon(e,t){var i=t.$scopedSlots,a=t.inputValue,n=t.isClearable,s=t.disabled,r=t.suffixIcon,l=[];return i.suffix?l.push(e("span",{class:"vxe-input--suffix-icon"},i.suffix.call(this,{},e))):r&&l.push(e("i",{class:["vxe-input--suffix-icon",r]})),n&&l.push(e("i",{class:["vxe-input--clear-icon",_conf.default.icon.INPUT_CLEAR]})),l.length?e("span",{class:["vxe-input--suffix",{"is--clear":n&&!s&&!(""===a||_xeUtils.default.eqNull(a))}],on:{click:t.clickSuffixEvent}},l):null}function renderExtraSuffixIcon(e,t){var i,a=t.controls,n=t.isPawdType,s=t.isNumType,r=t.isDatePickerType,l=t.isSearch;return n?i=renderPasswordIcon(e,t):s?a&&(i=renderNumberIcon(e,t)):r?i=renderDatePickerIcon(e,t):l&&(i=renderSearchIcon(e,t)),i?e("span",{class:"vxe-input--extra-suffix"},[i]):null}var _default2={name:"VxeInput",mixins:[_size.default],model:{prop:"value",event:"modelValue"},props:{value:[String,Number,Date],immediate:{type:Boolean,default:!0},name:String,type:{type:String,default:"text"},clearable:{type:Boolean,default:function(){return _conf.default.input.clearable}},readonly:Boolean,disabled:Boolean,placeholder:String,maxlength:[String,Number],autocomplete:{type:String,default:"off"},align:String,form:String,className:String,size:{type:String,default:function(){return _conf.default.input.size||_conf.default.size}},min:{type:[String,Number],default:null},max:{type:[String,Number],default:null},step:[String,Number],exponential:{type:Boolean,default:function(){return _conf.default.input.exponential}},controls:{type:Boolean,default:function(){return _conf.default.input.controls}},digits:{type:[String,Number],default:function(){return _conf.default.input.digits}},dateConfig:Object,minDate:{type:[String,Number,Date],default:function(){return _conf.default.input.minDate}},maxDate:{type:[String,Number,Date],default:function(){return _conf.default.input.maxDate}},startWeek:Number,startDay:{type:[String,Number],default:function(){return _conf.default.input.startDay}},labelFormat:{type:String,default:function(){return _conf.default.input.labelFormat}},valueFormat:{type:String,default:function(){return _conf.default.input.valueFormat}},editable:{type:Boolean,default:!0},festivalMethod:{type:Function,default:function(){return _conf.default.input.festivalMethod}},disabledMethod:{type:Function,default:function(){return _conf.default.input.disabledMethod}},selectDay:{type:Number,default:function(){return _conf.default.input.selectDay}},prefixIcon:String,suffixIcon:String,placement:String,transfer:{type:Boolean,default:function(){return _conf.default.input.transfer}}},data:function(){return{panelIndex:0,showPwd:!1,visiblePanel:!1,animatVisible:!1,panelStyle:null,panelPlacement:null,isActivated:!1,inputValue:this.value,datetimePanelValue:null,datePanelValue:null,datePanelLabel:"",datePanelType:"day",selectMonth:null,currentDate:null}},computed:{isNumType:function(){return-1<["number","integer","float"].indexOf(this.type)},isDatePickerType:function(){return this.hasTime||-1<["date","week","month","quarter","year"].indexOf(this.type)},hasTime:function(){var e=this.type;return"time"===e||"datetime"===e},isPawdType:function(){return"password"===this.type},isSearch:function(){return"search"===this.type},stepValue:function(){var e=this.type,t=this.step;return"integer"===e?_xeUtils.default.toInteger(t)||1:"float"===e?_xeUtils.default.toNumber(t)||1/Math.pow(10,this.digitsValue):_xeUtils.default.toNumber(t)||1},digitsValue:function(){return _xeUtils.default.toInteger(this.digits)||1},isClearable:function(){return this.clearable&&(this.isPawdType||this.isNumType||this.isDatePickerType||"text"===this.type||"search"===this.type)},isDisabledPrevDateBtn:function(){var e=this.selectMonth,t=this.dateMinTime;return!!e&&e<=t},isDisabledNextDateBtn:function(){var e=this.selectMonth,t=this.dateMaxTime;return!!e&&t<=e},dateMinTime:function(){return this.minDate?_xeUtils.default.toStringDate(this.minDate):null},dateMaxTime:function(){return this.maxDate?_xeUtils.default.toStringDate(this.maxDate):null},dateValue:function(){var e=this.value,t=this.isDatePickerType,i=this.dateValueFormat,a=null;return e&&t&&(i=this.parseDate(e,i),_xeUtils.default.isValidDate(i)&&(a=i)),a},dateTimeLabel:function(){var e=this.datetimePanelValue;return e?_xeUtils.default.toDateString(e,"HH:mm:ss"):""},hmsTime:function(){var e=this.dateValue;return e&&this.hasTime?1e3*(3600*e.getHours()+60*e.getMinutes()+e.getSeconds()):0},dateLabelFormat:function(){return this.isDatePickerType?this.labelFormat||_conf.default.i18n("vxe.input.date.labelFormat.".concat(this.type)):null},dateValueFormat:function(){var e=this.type;return"time"===e?"HH:mm:ss":this.valueFormat||("datetime"===e?"yyyy-MM-dd HH:mm:ss":"yyyy-MM-dd")},selectDatePanelLabel:function(){if(this.isDatePickerType){var e,t=this.datePanelType,i=this.selectMonth,a=this.yearList,n="";return i&&(n=i.getFullYear(),e=i.getMonth()+1),"quarter"===t?_conf.default.i18n("vxe.input.date.quarterLabel",[n]):"month"===t?_conf.default.i18n("vxe.input.date.monthLabel",[n]):"year"===t?a.length?"".concat(a[0].year," - ").concat(a[a.length-1].year):"":_conf.default.i18n("vxe.input.date.dayLabel",[n,e?_conf.default.i18n("vxe.input.date.m".concat(e)):"-"])}return""},firstDayOfWeek:function(){var e=this.startDay,t=this.startWeek;return _xeUtils.default.toNumber(_xeUtils.default.isNumber(e)||_xeUtils.default.isString(e)?e:t)},weekDatas:function(){var e=[];if(this.isDatePickerType){var t=this.firstDayOfWeek;e.push(t);for(var i=0;i<6;i++)6<=t?t=0:t++,e.push(t)}return e},dateHeaders:function(){return this.isDatePickerType?this.weekDatas.map(function(e){return{value:e,label:_conf.default.i18n("vxe.input.date.weeks.w".concat(e))}}):[]},weekHeaders:function(){return this.isDatePickerType?[{label:_conf.default.i18n("vxe.input.date.weeks.w")}].concat(this.dateHeaders):[]},yearList:function(){var e=this.selectMonth,t=this.currentDate,i=[];if(e&&t)for(var a=t.getFullYear(),n=new Date((""+e.getFullYear()).replace(/\d{1}$/,"0"),0,1),s=-10;s<yearSize-10;s++){var r=_xeUtils.default.getWhatYear(n,s,"first"),l=r.getFullYear();i.push({date:r,isCurrent:!0,isNow:a===l,year:l})}return i},yearDatas:function(){return _xeUtils.default.chunk(this.yearList,4)},quarterList:function(){var e=this.selectMonth,t=this.currentDate,i=[];if(e&&t)for(var a=t.getFullYear(),n=getDateQuarter(t),s=_xeUtils.default.getWhatYear(e,0,"first"),r=s.getFullYear(),l=-2;l<quarterSize-2;l++){var u=_xeUtils.default.getWhatQuarter(s,l),o=u.getFullYear(),d=getDateQuarter(u),h=o<r;i.push({date:u,isPrev:h,isCurrent:o===r,isNow:o===a&&d===n,isNext:!h&&r<o,quarter:d})}return i},quarterDatas:function(){return _xeUtils.default.chunk(this.quarterList,2)},monthList:function(){var e=this.selectMonth,t=this.currentDate,i=[];if(e&&t)for(var a=t.getFullYear(),n=t.getMonth(),s=_xeUtils.default.getWhatYear(e,0,"first").getFullYear(),r=-4;r<monthSize-4;r++){var l=_xeUtils.default.getWhatYear(e,0,r),u=l.getFullYear(),o=l.getMonth(),d=u<s;i.push({date:l,isPrev:d,isCurrent:u===s,isNow:u===a&&o===n,isNext:!d&&s<u,month:o})}return i},monthDatas:function(){return _xeUtils.default.chunk(this.monthList,4)},dayList:function(){var e=this.weekDatas,t=this.selectMonth,i=this.currentDate,a=this.hmsTime,n=[];if(t&&i)for(var s=i.getFullYear(),r=i.getMonth(),l=i.getDate(),u=t.getFullYear(),o=t.getMonth(),i=t.getDay(),i=-e.indexOf(i),d=new Date(_xeUtils.default.getWhatDay(t,i).getTime()+a),h=0;h<42;h++){var c=_xeUtils.default.getWhatDay(d,h),f=c.getFullYear(),p=c.getMonth(),v=c.getDate(),m=c<t;n.push({date:c,isPrev:m,isCurrent:f===u&&p===o,isNow:f===s&&p===r&&v===l,isNext:!m&&o!==p,label:v})}return n},dayDatas:function(){return _xeUtils.default.chunk(this.dayList,7)},weekDates:function(){var e=this.dayDatas,i=this.firstDayOfWeek;return e.map(function(e){var t=e[0];return[{date:t.date,isWeekNumber:!0,isPrev:!1,isCurrent:!1,isNow:!1,isNext:!1,label:_xeUtils.default.getYearWeek(t.date,i)}].concat(e)})},hourList:function(){var e=[];if(this.hasTime)for(var t=0;t<24;t++)e.push({value:t,label:(""+t).padStart(2,0)});return e},minuteList:function(){var e=[];if(this.hasTime)for(var t=0;t<60;t++)e.push({value:t,label:(""+t).padStart(2,0)});return e},secondList:function(){return this.minuteList},inpImmediate:function(){var e=this.type;return this.immediate||!("text"===e||"number"===e||"integer"===e||"float"===e)},inpPlaceholder:function(){var e=this.placeholder;return e?_tools.UtilTools.getFuncText(e):""},inputType:function(){var e=this.isDatePickerType,t=this.isNumType,i=this.isPawdType,a=this.type,n=this.showPwd;return e||t||i&&n||"number"===a?"text":a},inpMaxlength:function(){var e=this.isNumType,t=this.maxlength;return e&&!_xeUtils.default.toNumber(t)?16:t},inpReadonly:function(){var e=this.type,t=this.readonly,i=this.editable;return t||!i||"week"===e||"quarter"===e}},watch:{value:function(e){this.inputValue=e,this.changeValue()},type:function(){Object.assign(this,{inputValue:this.value,datetimePanelValue:null,datePanelValue:null,datePanelLabel:"",datePanelType:"day",selectMonth:null,currentDate:null}),this.initValue()},dateLabelFormat:function(){this.isDatePickerType&&(this.dateParseValue(this.datePanelValue),this.inputValue=this.datePanelLabel)}},created:function(){this.initValue(),_tools.GlobalEvent.on(this,"mousewheel",this.handleGlobalMousewheelEvent),_tools.GlobalEvent.on(this,"mousedown",this.handleGlobalMousedownEvent),_tools.GlobalEvent.on(this,"keydown",this.handleGlobalKeydownEvent),_tools.GlobalEvent.on(this,"blur",this.handleGlobalBlurEvent)},mounted:function(){this.dateConfig&&_tools.UtilTools.warn("vxe.error.removeProp",["date-config"]),this.isDatePickerType&&this.transfer&&document.body.appendChild(this.$refs.panel)},beforeDestroy:function(){var e=this.$refs.panel;e&&e.parentNode&&e.parentNode.removeChild(e)},destroyed:function(){this.numberStopDown(),_tools.GlobalEvent.off(this,"mousewheel"),_tools.GlobalEvent.off(this,"mousedown"),_tools.GlobalEvent.off(this,"keydown"),_tools.GlobalEvent.off(this,"blur")},render:function(e){var t=this.name,i=this.form,a=this.inputType,n=this.inpPlaceholder,s=this.inpMaxlength,r=this.inpReadonly,l=this.className,u=this.controls,o=this.inputValue,d=this.isDatePickerType,h=this.visiblePanel,c=this.isActivated,f=this.vSize,p=this.type,v=this.align,m=this.readonly,y=this.disabled,x=this.autocomplete,b=[],g=rendePrefixIcon(e,this),D=renderSuffixIcon(e,this);return g&&b.push(g),b.push(e("input",{ref:"input",class:"vxe-input--inner",domProps:{value:o},attrs:{name:t,form:i,type:a,placeholder:n,maxlength:s,readonly:r,disabled:y,autocomplete:x},on:{keydown:this.keydownEvent,keyup:this.triggerEvent,wheel:this.wheelEvent,click:this.clickEvent,input:this.inputEvent,change:this.changeEvent,focus:this.focusEvent,blur:this.blurEvent}})),D&&b.push(D),b.push(renderExtraSuffixIcon(e,this)),d&&b.push(renderPanel(e,this)),e("div",{class:["vxe-input","type--".concat(p),l,(_defineProperty(l={},"size--".concat(f),f),_defineProperty(l,"is--".concat(v),v),_defineProperty(l,"is--controls",u),_defineProperty(l,"is--prefix",!!g),_defineProperty(l,"is--suffix",!!D),_defineProperty(l,"is--readonly",m),_defineProperty(l,"is--visivle",h),_defineProperty(l,"is--disabled",y),_defineProperty(l,"is--active",c),l)]},b)},methods:{focus:function(){return this.isActivated=!0,this.$refs.input.focus(),this.$nextTick()},blur:function(){return this.$refs.input.blur(),this.isActivated=!1,this.$nextTick()},triggerEvent:function(e){var t=this.$refs,i=this.inputValue;this.$emit(e.type,{$panel:t.panel,value:i,$event:e})},emitModel:function(e,t){this.inputValue=e,this.$emit("modelValue",e),this.$emit("input",{value:e,$event:t}),_xeUtils.default.toValueString(this.value)!==e&&this.$emit("change",{value:e,$event:t})},emitInputEvent:function(e,t){var i=this.inpImmediate,a=this.isDatePickerType;this.inputValue=e,a||(i?this.emitModel(e,t):this.$emit("input",{value:e,$event:t}))},inputEvent:function(e){var t=e.target.value;this.emitInputEvent(t,e)},changeEvent:function(e){this.inpImmediate||this.triggerEvent(e)},focusEvent:function(e){this.isActivated=!0,this.triggerEvent(e)},blurEvent:function(e){var t=this.inputValue;this.inpImmediate||this.emitModel(t,e),this.afterCheckValue(),this.visiblePanel||(this.isActivated=!1),this.$emit("blur",{value:t,$event:e})},keydownEvent:function(e){var t,i,a,n,s=this.exponential,r=this.controls;this.isNumType&&(t=e.ctrlKey,i=e.shiftKey,a=e.altKey,n=e.keyCode,t||i||a||!(32===n||(!s||69!==n)&&65<=n&&n<=90||186<=n&&n<=188||191<=n)||e.preventDefault(),r&&this.numberKeydownEvent(e)),this.triggerEvent(e)},wheelEvent:function(e){var t;this.isNumType&&this.controls&&this.isActivated&&(0<(t=e.deltaY)?this.numberNextEvent(e):t<0&&this.numberPrevEvent(e),e.preventDefault()),this.triggerEvent(e)},clickEvent:function(e){this.isDatePickerType&&this.datePickerOpenEvent(e),this.triggerEvent(e)},clickPrefixEvent:function(e){var t=this.$refs,i=this.disabled,a=this.inputValue;i||this.$emit("prefix-click",{$panel:t.panel,value:a,$event:e})},clickSuffixEvent:function(e){var t=this.$refs,i=this.disabled,a=this.inputValue;i||(_tools.DomTools.hasClass(e.currentTarget,"is--clear")?(this.emitModel("",e),this.clearValueEvent(e,"")):this.$emit("suffix-click",{$panel:t.panel,value:a,$event:e}))},clearValueEvent:function(e,t){var i=this.$refs,a=this.type,n=this.isNumType;this.isDatePickerType&&this.hidePanel(),(n||-1<["text","search","password"].indexOf(a))&&this.focus(),this.$emit("clear",{$panel:i.panel,value:t,$event:e})},parseDate:function(e,t){return"time"===this.type?toStringTimeDate(e):_xeUtils.default.toStringDate(e,t)},initValue:function(){var e=this.type,t=this.isDatePickerType,i=this.inputValue,a=this.digitsValue;t?this.changeValue():"float"===e&&(!i||i!==(a=toFloatValueFixed(i,a))&&this.emitModel(a,{type:"init"}))},changeValue:function(){this.isDatePickerType&&(this.dateParseValue(this.inputValue),this.inputValue=this.datePanelLabel)},afterCheckValue:function(){var e,t=this.type,i=this.exponential,a=this.inpReadonly,n=this.inputValue,s=this.isDatePickerType,r=this.isNumType,l=this.datetimePanelValue,u=this.dateLabelFormat,o=this.min,d=this.max,h=this.firstDayOfWeek;a||(r?n&&(e="integer"===t?_xeUtils.default.toInteger(n):_xeUtils.default.toNumber(n),this.vaildMinNum(e)?this.vaildMaxNum(e)||(e=d):e=o,!i||(i=_xeUtils.default.toValueString(n).toLowerCase())===_xeUtils.default.toNumber(e).toExponential()&&(e=i),this.emitModel(getNumberValue(this,e),{type:"check"})):s&&(n?"week"===t||"quarter"===t||(e=this.parseDate(n,u),_xeUtils.default.isValidDate(e)?"time"===t?(n!==(e=toStringTimeDate(e))&&this.emitModel(e,{type:"check"}),this.inputValue=e):(s=!1,"datetime"===t?n===_xeUtils.default.toDateString(this.dateValue,u)&&n===_xeUtils.default.toDateString(e,u)||(s=!0,l.setHours(e.getHours()),l.setMinutes(e.getMinutes()),l.setSeconds(e.getSeconds())):s=!0,this.inputValue=_xeUtils.default.toDateString(e,u,{firstDay:h}),s&&this.dateChange(e)):this.dateRevert()):this.emitModel("",{type:"check"})))},passwordToggleEvent:function(e){var t=this.disabled,i=this.readonly,a=this.showPwd;t||i||(this.showPwd=!a),this.$emit("toggle-visible",{visible:this.showPwd,$event:e})},searchEvent:function(e){this.$emit("search-click",{$event:e})},vaildMinNum:function(e){return null===this.min||e>=_xeUtils.default.toNumber(this.min)},vaildMaxNum:function(e){return null===this.max||e<=_xeUtils.default.toNumber(this.max)},numberStopDown:function(){clearTimeout(this.downbumTimeout)},numberDownPrevEvent:function(e){var t=this;this.downbumTimeout=setTimeout(function(){t.numberPrevEvent(e),t.numberDownPrevEvent(e)},60)},numberDownNextEvent:function(e){var t=this;this.downbumTimeout=setTimeout(function(){t.numberNextEvent(e),t.numberDownNextEvent(e)},60)},numberKeydownEvent:function(e){var t=e.keyCode,i=38===t;!i&&40!==t||(e.preventDefault(),i?this.numberPrevEvent(e):this.numberNextEvent(e))},numberMousedownEvent:function(e){var t,i=this;this.numberStopDown(),0===e.button&&((t=_tools.DomTools.hasClass(e.currentTarget,"is--prev"))?this.numberPrevEvent(e):this.numberNextEvent(e),this.downbumTimeout=setTimeout(function(){t?i.numberDownPrevEvent(e):i.numberDownNextEvent(e)},500))},numberPrevEvent:function(e){var t=this.disabled,i=this.readonly;clearTimeout(this.downbumTimeout),t||i||this.numberChange(!0,e),this.$emit("prev-number",{$event:e})},numberNextEvent:function(e){var t=this.disabled,i=this.readonly;clearTimeout(this.downbumTimeout),t||i||this.numberChange(!1,e),this.$emit("next-number",{$event:e})},numberChange:function(e,t){var i=this.min,a=this.max,n=this.type,s=this.inputValue,r=this.stepValue,s="integer"===n?_xeUtils.default.toInteger(s):_xeUtils.default.toNumber(s),r=e?_xeUtils.default.add(s,r):_xeUtils.default.subtract(s,r),i=this.vaildMinNum(r)?this.vaildMaxNum(r)?r:a:i;this.emitInputEvent(getNumberValue(this,i),t)},datePickerOpenEvent:function(e){this.readonly||(e.preventDefault(),this.showPanel())},dateMonthHandle:function(e,t){this.selectMonth=_xeUtils.default.getWhatMonth(e,t,"first")},dateNowHandle:function(){var e=_xeUtils.default.getWhatDay(Date.now(),0,"first");this.currentDate=e,this.dateMonthHandle(e,0)},dateToggleTypeEvent:function(){var e="month"===(e=this.datePanelType)||"quarter"===e?"year":"month";this.datePanelType=e},datePrevEvent:function(e){var t=this.isDisabledPrevDateBtn,i=this.type,a=this.datePanelType;t||(this.selectMonth="year"===i?_xeUtils.default.getWhatYear(this.selectMonth,-yearSize,"first"):"month"===i||"quarter"===i?"year"===a?_xeUtils.default.getWhatYear(this.selectMonth,-yearSize,"first"):_xeUtils.default.getWhatYear(this.selectMonth,-1,"first"):"year"===a?_xeUtils.default.getWhatYear(this.selectMonth,-yearSize,"first"):"month"===a?_xeUtils.default.getWhatYear(this.selectMonth,-1,"first"):_xeUtils.default.getWhatMonth(this.selectMonth,-1,"first"),this.$emit("date-prev",{type:i,$event:e}))},dateTodayMonthEvent:function(e){this.dateNowHandle(),this.dateChange(this.currentDate),this.hidePanel(),this.$emit("date-today",{type:this.type,$event:e})},dateNextEvent:function(e){var t=this.isDisabledNextDateBtn,i=this.type,a=this.datePanelType;t||(this.selectMonth="year"===i?_xeUtils.default.getWhatYear(this.selectMonth,yearSize,"first"):"month"===i||"quarter"===i?"year"===a?_xeUtils.default.getWhatYear(this.selectMonth,yearSize,"first"):_xeUtils.default.getWhatYear(this.selectMonth,1,"first"):"year"===a?_xeUtils.default.getWhatYear(this.selectMonth,yearSize,"first"):"month"===a?_xeUtils.default.getWhatYear(this.selectMonth,1,"first"):_xeUtils.default.getWhatMonth(this.selectMonth,1,"first"),this.$emit("date-next",{type:i,$event:e}))},dateSelectEvent:function(e){isDateDisabled(this,e)||this.dateSelectItem(e.date)},dateSelectItem:function(e){var t=this.type,i=this.datePanelType,a="week"===t;"month"===t?"year"===i?(this.datePanelType="month",this.dateCheckMonth(e)):(this.dateChange(e),this.hidePanel()):"year"===t?(this.hidePanel(),this.dateChange(e)):"quarter"===t?"year"===i?(this.datePanelType="quarter",this.dateCheckMonth(e)):(this.dateChange(e),this.hidePanel()):"month"===i?(this.datePanelType="week"===t?t:"day",this.dateCheckMonth(e)):"year"===i?(this.datePanelType="month",this.dateCheckMonth(e)):(this.dateChange(e),this.hidePanel()),a&&this.changeValue()},dateMouseenterEvent:function(e){var t;isDateDisabled(this,e)||("month"===(t=this.datePanelType)?this.dateMoveMonth(e.date):"quarter"===t?this.dateMoveQuarter(e.date):"year"===t?this.dateMoveYear(e.date):this.dateMoveDay(e.date))},dateHourEvent:function(e,t){this.datetimePanelValue.setHours(t.value),this.dateTimeChangeEvent(e)},dateConfirmEvent:function(){this.dateChange(this.dateValue||this.currentDate),this.hidePanel()},dateMinuteEvent:function(e,t){this.datetimePanelValue.setMinutes(t.value),this.dateTimeChangeEvent(e)},dateSecondEvent:function(e,t){this.datetimePanelValue.setSeconds(t.value),this.dateTimeChangeEvent(e)},dateTimeChangeEvent:function(e){this.datetimePanelValue=new Date(this.datetimePanelValue.getTime()),this.updateTimePos(e.currentTarget)},updateTimePos:function(e){var t;e&&(t=e.offsetHeight,e.parentNode.scrollTop=e.offsetTop-4*t)},dateMoveDay:function(t){isDateDisabled(this,{date:t})||(this.dayList.some(function(e){return _xeUtils.default.isDateSame(e.date,t,"yyyyMMdd")})||this.dateCheckMonth(t),this.dateParseValue(t))},dateMoveMonth:function(t){isDateDisabled(this,{date:t})||(this.monthList.some(function(e){return _xeUtils.default.isDateSame(e.date,t,"yyyyMM")})||this.dateCheckMonth(t),this.dateParseValue(t))},dateMoveQuarter:function(t){isDateDisabled(this,{date:t})||(this.quarterList.some(function(e){return _xeUtils.default.isDateSame(e.date,t,"yyyyq")})||this.dateCheckMonth(t),this.dateParseValue(t))},dateMoveYear:function(t){isDateDisabled(this,{date:t})||(this.yearList.some(function(e){return _xeUtils.default.isDateSame(e.date,t,"yyyy")})||this.dateCheckMonth(t),this.dateParseValue(t))},dateParseValue:function(e){var t=this.type,i=this.dateLabelFormat,a=this.valueFormat,n=this.firstDayOfWeek,s=null,r="";e&&(s=this.parseDate(e,a)),_xeUtils.default.isValidDate(s)?(r=_xeUtils.default.toDateString(s,i,{firstDay:n}),i&&"week"===t&&_xeUtils.default.getWhatWeek(s,0,n,n).getFullYear()<s.getFullYear()&&(-1<(i=i.indexOf("yyyy"))&&((i=Number(r.substring(i,i+4)))&&!isNaN(i)&&(r=r.replace("".concat(i),"".concat(i-1)))))):s=null,this.datePanelValue=s,this.datePanelLabel=r},dateOffsetEvent:function(e){var t,i,a,n=this.isActivated,s=this.datePanelValue,r=this.datePanelType,l=this.firstDayOfWeek;n&&(e.preventDefault(),t=37===(i=e.keyCode),n=38===i,e=39===i,i=40===i,"year"===r?(a=_xeUtils.default.getWhatYear(s||Date.now(),0,"first"),t?a=_xeUtils.default.getWhatYear(a,-1):n?a=_xeUtils.default.getWhatYear(a,-4):e?a=_xeUtils.default.getWhatYear(a,1):i&&(a=_xeUtils.default.getWhatYear(a,4)),this.dateMoveYear(a)):"quarter"===r?(a=_xeUtils.default.getWhatQuarter(s||Date.now(),0,"first"),t?a=_xeUtils.default.getWhatQuarter(a,-1):n?a=_xeUtils.default.getWhatQuarter(a,-2):e?a=_xeUtils.default.getWhatQuarter(a,1):i&&(a=_xeUtils.default.getWhatQuarter(a,2)),this.dateMoveQuarter(a)):"month"===r?(r=_xeUtils.default.getWhatMonth(s||Date.now(),0,"first"),t?r=_xeUtils.default.getWhatMonth(r,-1):n?r=_xeUtils.default.getWhatMonth(r,-4):e?r=_xeUtils.default.getWhatMonth(r,1):i&&(r=_xeUtils.default.getWhatMonth(r,4)),this.dateMoveMonth(r)):(s=s||_xeUtils.default.getWhatDay(Date.now(),0,"first"),t?s=_xeUtils.default.getWhatDay(s,-1):n?s=_xeUtils.default.getWhatWeek(s,-1,l):e?s=_xeUtils.default.getWhatDay(s,1):i&&(s=_xeUtils.default.getWhatWeek(s,1,l)),this.dateMoveDay(s)))},datePgOffsetEvent:function(e){var t;this.isActivated&&(t=33===e.keyCode,e.preventDefault(),t?this.datePrevEvent(e):this.dateNextEvent(e))},dateChange:function(e){var t,i=this.value,a=this.datetimePanelValue,n=this.dateValueFormat,s=this.firstDayOfWeek;"week"===this.type?(t=_xeUtils.default.toNumber(this.selectDay),e=_xeUtils.default.getWhatWeek(e,0,t,s)):this.hasTime&&(e.setHours(a.getHours()),e.setMinutes(a.getMinutes()),e.setSeconds(a.getSeconds()));s=_xeUtils.default.toDateString(e,n,{firstDay:s});this.dateCheckMonth(e),_xeUtils.default.isEqual(i,s)||this.emitModel(s,{type:"update"})},dateCheckMonth:function(e){e=_xeUtils.default.getWhatMonth(e,0,"first");_xeUtils.default.isEqual(e,this.selectMonth)||(this.selectMonth=e)},dateOpenPanel:function(){var e=this,t=this.type,i=this.dateValue;-1<["year","quarter","month","week"].indexOf(t)?this.datePanelType=t:this.datePanelType="day",this.currentDate=_xeUtils.default.getWhatDay(Date.now(),0,"first"),i?(this.dateMonthHandle(i,0),this.dateParseValue(i)):this.dateNowHandle(),this.hasTime&&(this.datetimePanelValue=this.datePanelValue||_xeUtils.default.getWhatDay(Date.now(),0,"first"),this.$nextTick(function(){_xeUtils.default.arrayEach(e.$refs.timeBody.querySelectorAll("li.is--selected"),e.updateTimePos)}))},dateRevert:function(){this.inputValue=this.datePanelLabel},updateZindex:function(){this.panelIndex<_tools.UtilTools.getLastZIndex()&&(this.panelIndex=_tools.UtilTools.nextZIndex())},showPanel:function(){var e=this,t=this.disabled,i=this.visiblePanel,a=this.isDatePickerType;t||i||(clearTimeout(this.hidePanelTimeout),this.isActivated=!0,this.animatVisible=!0,a&&this.dateOpenPanel(),setTimeout(function(){e.visiblePanel=!0},10),this.updateZindex(),this.updatePlacement())},hidePanel:function(){var e=this;this.visiblePanel=!1,this.hidePanelTimeout=setTimeout(function(){e.animatVisible=!1},350)},updatePlacement:function(){var c=this;return this.$nextTick().then(function(){var e=c.$refs,t=c.transfer,i=c.placement,a=c.panelIndex,n=e.input,s=e.panel;if(n&&s){var r=n.offsetHeight,l=n.offsetWidth,u=s.offsetHeight,o=s.offsetWidth,d={zIndex:a},h=_tools.DomTools.getAbsolutePos(n),e=h.boundingTop,s=h.boundingLeft,a=h.visibleHeight,n=h.visibleWidth,h="bottom";return t?(t=e+r,"top"===i?(h="top",t=e-u):i||(a<t+u+5&&(h="top",t=e-u),t<5&&(h="bottom",t=e+r)),n<(s=s)+o+5&&(s-=s+o+5-n),s<5&&(s=5),Object.assign(d,{left:"".concat(s,"px"),top:"".concat(t,"px"),minWidth:"".concat(l,"px")})):"top"===i?(h="top",d.bottom="".concat(r,"px")):i||a<e+r+u&&5<e-r-u&&(h="top",d.bottom="".concat(r,"px")),c.panelStyle=d,c.panelPlacement=h,c.$nextTick()}})},handleGlobalMousedownEvent:function(e){var t=this.$refs,i=this.$el,a=this.disabled,n=this.visiblePanel,s=this.isActivated;!a&&s&&(this.isActivated=_tools.DomTools.getEventTargetNode(e,i).flag||_tools.DomTools.getEventTargetNode(e,t.panel).flag,this.isActivated||(this.isDatePickerType?n&&(this.hidePanel(),this.afterCheckValue()):this.afterCheckValue()))},handleGlobalKeydownEvent:function(e){var t,i,a,n,s,r,l,u,o,d,h=this.isDatePickerType,c=this.visiblePanel,f=this.clearable;this.disabled||(i=46===(t=e.keyCode),a=27===t,n=13===t,s=38===t,r=40===t,l=33===t,u=34===t,o=37===t||s||39===t||r,d=this.isActivated,(t=9===t)?(d&&this.afterCheckValue(),this.isActivated=d=!1):o?h&&d&&(c?this.dateOffsetEvent(e):(s||r)&&this.datePickerOpenEvent(e)):n?h&&(c?this.datePanelValue?this.dateSelectItem(this.datePanelValue):this.hidePanel():d&&this.datePickerOpenEvent(e)):(l||u)&&h&&d&&this.datePgOffsetEvent(e),t||a?c&&this.hidePanel():i&&f&&d&&this.clearValueEvent(e,null))},handleGlobalMousewheelEvent:function(e){var t=this.$refs,i=this.disabled,a=this.visiblePanel;i||a&&(_tools.DomTools.getEventTargetNode(e,t.panel).flag?this.updatePlacement():(this.hidePanel(),this.afterCheckValue()))},handleGlobalBlurEvent:function(){var e=this.isActivated;this.visiblePanel?(this.hidePanel(),this.afterCheckValue()):e&&this.afterCheckValue()}}};exports.default=_default2;
@@ -758,7 +758,7 @@ var _default2 = {
758
758
 
759
759
  return this.$nextTick().then(function () {
760
760
  if (!_this7.zoomLocat) {
761
- var marginSize = _this7.marginSize;
761
+ var marginSize = Math.max(0, _this7.marginSize);
762
762
 
763
763
  var modalBoxElem = _this7.getBox();
764
764
 
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.msgQueue=exports.default=exports.allActivedModals=void 0;var _conf=_interopRequireDefault(require("../../v-x-e-table/src/conf")),_size=_interopRequireDefault(require("../../mixins/size")),_xeUtils=_interopRequireDefault(require("xe-utils")),_tools=require("../../tools");function _interopRequireDefault(t){return t&&t.__esModule?t:{default:t}}function _slicedToArray(t,e){return _arrayWithHoles(t)||_iterableToArrayLimit(t,e)||_unsupportedIterableToArray(t,e)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(t,e){if(t){if("string"==typeof t)return _arrayLikeToArray(t,e);var o=Object.prototype.toString.call(t).slice(8,-1);return"Map"===(o="Object"===o&&t.constructor?t.constructor.name:o)||"Set"===o?Array.from(t):"Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?_arrayLikeToArray(t,e):void 0}}function _arrayLikeToArray(t,e){(null==e||e>t.length)&&(e=t.length);for(var o=0,i=new Array(e);o<e;o++)i[o]=t[o];return i}function _iterableToArrayLimit(t,e){var o=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=o){var i,n,s=[],l=!0,a=!1;try{for(o=o.call(t);!(l=(i=o.next()).done)&&(s.push(i.value),!e||s.length!==e);l=!0);}catch(t){a=!0,n=t}finally{try{l||null==o.return||o.return()}finally{if(a)throw n}}return s}}function _arrayWithHoles(t){if(Array.isArray(t))return t}function _defineProperty(t,e,o){return e in t?Object.defineProperty(t,e,{value:o,enumerable:!0,configurable:!0,writable:!0}):t[e]=o,t}var allActivedModals=[];exports.allActivedModals=allActivedModals;var msgQueue=[];exports.msgQueue=msgQueue;var _default2={name:"VxeModal",mixins:[_size.default],props:{value:Boolean,id:String,type:{type:String,default:"modal"},loading:{type:Boolean,default:null},status:String,iconStatus:String,className:String,top:{type:[Number,String],default:function(){return _conf.default.modal.top}},position:[String,Object],title:String,duration:{type:[Number,String],default:function(){return _conf.default.modal.duration}},message:[String,Function],content:[String,Function],cancelButtonText:{type:String,default:function(){return _conf.default.modal.cancelButtonText}},confirmButtonText:{type:String,default:function(){return _conf.default.modal.confirmButtonText}},lockView:{type:Boolean,default:function(){return _conf.default.modal.lockView}},lockScroll:Boolean,mask:{type:Boolean,default:function(){return _conf.default.modal.mask}},maskClosable:{type:Boolean,default:function(){return _conf.default.modal.maskClosable}},escClosable:{type:Boolean,default:function(){return _conf.default.modal.escClosable}},resize:{type:Boolean,default:function(){return _conf.default.modal.resize}},showHeader:{type:Boolean,default:function(){return _conf.default.modal.showHeader}},showFooter:{type:Boolean,default:function(){return _conf.default.modal.showFooter}},showZoom:{type:Boolean,default:null},showClose:{type:Boolean,default:function(){return _conf.default.modal.showClose}},dblclickZoom:{type:Boolean,default:function(){return _conf.default.modal.dblclickZoom}},width:[Number,String],height:[Number,String],minWidth:{type:[Number,String],default:function(){return _conf.default.modal.minWidth}},minHeight:{type:[Number,String],default:function(){return _conf.default.modal.minHeight}},zIndex:Number,marginSize:{type:[Number,String],default:function(){return _conf.default.modal.marginSize}},fullscreen:Boolean,draggable:{type:Boolean,default:function(){return _conf.default.modal.draggable}},remember:{type:Boolean,default:function(){return _conf.default.modal.remember}},destroyOnClose:{type:Boolean,default:function(){return _conf.default.modal.destroyOnClose}},showTitleOverflow:{type:Boolean,default:function(){return _conf.default.modal.showTitleOverflow}},transfer:{type:Boolean,default:function(){return _conf.default.modal.transfer}},storage:{type:Boolean,default:function(){return _conf.default.modal.storage}},storageKey:{type:String,default:function(){return _conf.default.modal.storageKey}},animat:{type:Boolean,default:function(){return _conf.default.modal.animat}},size:{type:String,default:function(){return _conf.default.modal.size||_conf.default.size}},beforeHideMethod:{type:Function,default:function(){return _conf.default.modal.beforeHideMethod}},slots:Object,events:Object},data:function(){return{inited:!1,visible:!1,contentVisible:!1,modalTop:0,modalZindex:0,zoomLocat:null,firstOpen:!1}},computed:{isMsg:function(){return"message"===this.type}},watch:{width:function(){this.recalculate()},height:function(){this.recalculate()},value:function(t){this[t?"open":"close"]("model")}},created:function(){this.storage&&!this.id&&_tools.UtilTools.error("vxe.error.reqProp",["modal.id"])},mounted:function(){var t=this.$listeners,e=this.events,o=void 0===e?{}:e;this.value&&this.open(),this.recalculate(),this.escClosable&&_tools.GlobalEvent.on(this,"keydown",this.handleGlobalKeydownEvent);e="inserted",e={type:e,$modal:this,$event:{type:e}};t.inserted?this.$emit("inserted",e):o.inserted&&o.inserted.call(this,e)},beforeDestroy:function(){var t=this.$el;_tools.GlobalEvent.off(this,"keydown"),this.removeMsgQueue(),t.parentNode===document.body&&t.parentNode.removeChild(t)},render:function(e){var o=this,t=this._e,i=this.$scopedSlots,n=this.slots,s=void 0===n?{}:n,l=this.inited,a=this.vSize,r=this.className,c=this.type,u=this.resize,d=this.showClose,f=this.showZoom,h=this.animat,m=this.draggable,p=this.loading,v=this.status,g=this.iconStatus,x=this.showFooter,y=this.zoomLocat,b=this.modalTop,_=this.dblclickZoom,w=this.contentVisible,S=this.visible,z=this.title,T=this.lockScroll,k=this.lockView,$=this.mask,B=this.isMsg,M=this.showTitleOverflow,N=this.destroyOnClose,O=this.content||this.message,L=i.default||s.default,P=i.footer||s.footer,n=i.header||s.header,i=i.title||s.title,s={};return m&&(s.mousedown=this.mousedownEvent),f&&_&&"modal"===c&&(s.dblclick=this.toggleZoomEvent),e("div",{class:["vxe-modal--wrapper","type--".concat(c),r||"",(_defineProperty(r={},"size--".concat(a),a),_defineProperty(r,"status--".concat(v),v),_defineProperty(r,"is--animat",h),_defineProperty(r,"lock--scroll",T),_defineProperty(r,"lock--view",k),_defineProperty(r,"is--resize",u),_defineProperty(r,"is--mask",$),_defineProperty(r,"is--maximize",y),_defineProperty(r,"is--visible",w),_defineProperty(r,"is--active",S),_defineProperty(r,"is--loading",p),r)],style:{zIndex:this.modalZindex,top:b?"".concat(b,"px"):null},on:{click:this.selfClickEvent}},[e("div",{class:"vxe-modal--box",on:{mousedown:this.boxMousedownEvent},ref:"modalBox"},[this.showHeader?e("div",{class:["vxe-modal--header",{"is--drag":m,"is--ellipsis":!B&&M}],on:s},n?!l||N&&!S?[]:n.call(this,{$modal:this},e):[i?i.call(this,{$modal:this},e):e("span",{class:"vxe-modal--title"},z?_tools.UtilTools.getFuncText(z):_conf.default.i18n("vxe.alert.title")),f?e("i",{class:["vxe-modal--zoom-btn","trigger--btn",y?_conf.default.icon.MODAL_ZOOM_OUT:_conf.default.icon.MODAL_ZOOM_IN],attrs:{title:_conf.default.i18n("vxe.modal.zoom".concat(y?"Out":"In"))},on:{click:this.toggleZoomEvent}}):t(),d?e("i",{class:["vxe-modal--close-btn","trigger--btn",_conf.default.icon.MODAL_CLOSE],attrs:{title:_conf.default.i18n("vxe.modal.close")},on:{click:this.closeEvent}}):t()]):null,e("div",{class:"vxe-modal--body"},[v?e("div",{class:"vxe-modal--status-wrapper"},[e("i",{class:["vxe-modal--status-icon",g||_conf.default.icon["MODAL_".concat(v).toLocaleUpperCase()]]})]):null,e("div",{class:"vxe-modal--content"},L?!l||N&&!S?[]:L.call(this,{$modal:this},e):_tools.UtilTools.getFuncText(O)),B?null:e("div",{class:["vxe-loading",{"is--visible":p}]},[e("div",{class:"vxe-loading--spinner"})])]),x?e("div",{class:"vxe-modal--footer"},P?!l||N&&!S?[]:P.call(this,{$modal:this},e):["confirm"===c?e("vxe-button",{ref:"cancelBtn",on:{click:this.cancelEvent}},this.cancelButtonText||_conf.default.i18n("vxe.button.cancel")):null,e("vxe-button",{ref:"confirmBtn",props:{status:"primary"},on:{click:this.confirmEvent}},this.confirmButtonText||_conf.default.i18n("vxe.button.confirm"))]):null,!B&&u?e("span",{class:"vxe-modal--resize"},["wl","wr","swst","sest","st","swlb","selb","sb"].map(function(t){return e("span",{class:"".concat(t,"-resize"),attrs:{type:t},on:{mousedown:o.dragEvent}})})):null])])},methods:{recalculate:function(){var t=this.width,e=this.height,o=this.getBox();return o.style.width=t?isNaN(t)?t:"".concat(t,"px"):null,o.style.height=e?isNaN(e)?e:"".concat(e,"px"):null,this.$nextTick()},selfClickEvent:function(t){this.maskClosable&&t.target===this.$el&&this.close("mask")},updateZindex:function(){var t=this.zIndex,e=this.modalZindex;t?this.modalZindex=t:e<_tools.UtilTools.getLastZIndex()&&(this.modalZindex=_tools.UtilTools.nextZIndex())},closeEvent:function(t){var e=this.events,o=void 0===e?{}:e,e="close",t={type:e,$modal:this,$event:t};o[e]?o[e].call(this,t):this.$emit(e,t),this.close(e)},confirmEvent:function(t){var e=this.events,o=void 0===e?{}:e,e="confirm",t={type:e,$modal:this,$event:t};o[e]?o[e].call(this,t):this.$emit(e,t),this.close(e)},cancelEvent:function(t){var e=this.events,o=void 0===e?{}:e,e="cancel",t={type:e,$modal:this,$event:t};o[e]?o[e].call(this,t):this.$emit(e,t),this.close(e)},open:function(){var o=this,e=this.$refs,t=this.events,i=void 0===t?{}:t,n=this.inited,s=this.duration,l=this.visible,t=this.isMsg,a=this.remember,r=this.showFooter;n||(this.inited=!0,this.transfer&&document.body.appendChild(this.$el)),l||(a||this.recalculate(),this.visible=!0,this.contentVisible=!1,this.updateZindex(),allActivedModals.push(this),setTimeout(function(){o.contentVisible=!0,o.$nextTick(function(){!r||(t=e.confirmBtn||e.cancelBtn)&&t.focus();var t={type:"",$modal:o};i.show?i.show.call(o,t):(o.$emit("input",!0),o.$emit("show",t))})},10),t?(this.addMsgQueue(),-1!==s&&setTimeout(function(){return o.close("close")},_xeUtils.default.toNumber(s))):this.$nextTick(function(){var t=o.firstOpen,e=o.fullscreen;a&&t||o.updatePosition().then(function(){setTimeout(function(){return o.updatePosition()},20)}),t||(o.firstOpen=!0,o.hasPosStorage()?o.restorePosStorage():e&&o.$nextTick(function(){return o.maximize()}))}))},addMsgQueue:function(){-1===msgQueue.indexOf(this)&&msgQueue.push(this),this.updateStyle()},removeMsgQueue:function(){var e=this;-1<msgQueue.indexOf(this)&&_xeUtils.default.remove(msgQueue,function(t){return t===e}),this.updateStyle()},updateStyle:function(){this.$nextTick(function(){var e=0;msgQueue.forEach(function(t){e+=_xeUtils.default.toNumber(t.top),t.modalTop=e,e+=t.$refs.modalBox.clientHeight})})},updatePosition:function(){var u=this;return this.$nextTick().then(function(){var t=u.marginSize,e=u.position,o=u.getBox(),i=document.documentElement.clientWidth||document.body.clientWidth,n=document.documentElement.clientHeight||document.body.clientHeight,s="center"===e,l=s?{top:e,left:e}:Object.assign({},e),a=l.top,r=l.left,c=s||"center"===a,e="",l="",l=r&&!(s||"center"===r)?isNaN(r)?r:"".concat(r,"px"):"".concat(Math.max(t,i/2-o.offsetWidth/2),"px"),e=a&&!c?isNaN(a)?a:"".concat(a,"px"):"".concat(Math.max(t,n/2-o.offsetHeight/2),"px");o.style.top=e,o.style.left=l})},close:function(t){var e=this,o=this.events,i=void 0===o?{}:o,n=this.remember,s=this.visible,l=this.isMsg,o=this.beforeHideMethod,a={type:t,$modal:this};s&&Promise.resolve(o?o(a):null).then(function(t){_xeUtils.default.isError(t)||(l&&e.removeMsgQueue(),e.contentVisible=!1,n||(e.zoomLocat=null),_xeUtils.default.remove(allActivedModals,function(t){return t===e}),e.$emit("before-hide",a),setTimeout(function(){e.visible=!1,i.hide?i.hide.call(e,a):(e.$emit("input",!1),e.$emit("hide",a))},200))}).catch(function(t){return t})},handleGlobalKeydownEvent:function(t){var e,o=this;27===t.keyCode&&((e=_xeUtils.default.max(allActivedModals,function(t){return t.modalZindex}))&&setTimeout(function(){e===o&&e.escClosable&&o.close("exit")},10))},getBox:function(){return this.$refs.modalBox},isMaximized:function(){return!!this.zoomLocat},maximize:function(){var n=this;return this.$nextTick().then(function(){var t,e,o,i;n.zoomLocat||(t=n.marginSize,e=n.getBox(),o=(i=_tools.DomTools.getDomNode()).visibleHeight,i=i.visibleWidth,n.zoomLocat={top:e.offsetTop,left:e.offsetLeft,width:e.offsetWidth+(e.style.width?0:1),height:e.offsetHeight+(e.style.height?0:1)},Object.assign(e.style,{top:"".concat(t,"px"),left:"".concat(t,"px"),width:"".concat(i-2*t,"px"),height:"".concat(o-2*t,"px")}),n.savePosStorage())})},revert:function(){var o=this;return this.$nextTick().then(function(){var t,e=o.zoomLocat;e&&(t=o.getBox(),o.zoomLocat=null,Object.assign(t.style,{top:"".concat(e.top,"px"),left:"".concat(e.left,"px"),width:"".concat(e.width,"px"),height:"".concat(e.height,"px")}),o.savePosStorage())})},zoom:function(){var t=this;return this[this.zoomLocat?"revert":"maximize"]().then(function(){return t.isMaximized()})},toggleZoomEvent:function(t){var e=this,o=this.$listeners,i=this.zoomLocat,n=this.events,s=void 0===n?{}:n,l={type:i?"revert":"max",$modal:this,$event:t};return this.zoom().then(function(){o.zoom?e.$emit("zoom",l):s.zoom&&s.zoom.call(e,l)})},getPosition:function(){if(!this.isMsg){var t=this.getBox();if(t)return{top:t.offsetTop,left:t.offsetLeft}}return null},setPosition:function(t,e){var o;return this.isMsg||(o=this.getBox(),_xeUtils.default.isNumber(t)&&(o.style.top="".concat(t,"px")),_xeUtils.default.isNumber(e)&&(o.style.left="".concat(e,"px"))),this.$nextTick()},boxMousedownEvent:function(){var e=this.modalZindex;allActivedModals.some(function(t){return t.visible&&t.modalZindex>e})&&this.updateZindex()},mousedownEvent:function(t){var e,o,n,s,l,a,i=this,r=this.remember,c=this.storage,u=this.marginSize,d=this.zoomLocat,f=this.getBox();d||0!==t.button||_tools.DomTools.getEventTargetNode(t,f,"trigger--btn").flag||(t.preventDefault(),e=document.onmousemove,o=document.onmouseup,n=t.clientX-f.offsetLeft,s=t.clientY-f.offsetTop,t=_tools.DomTools.getDomNode(),l=t.visibleHeight,a=t.visibleWidth,document.onmousemove=function(t){t.preventDefault();var e=f.offsetWidth,o=f.offsetHeight,i=a-e-u-1,e=l-o-u-1,o=t.clientX-n,t=t.clientY-s;(t=e<t?e:t)<u&&(t=u),f.style.left="".concat(o=(o=i<o?i:o)<u?u:o,"px"),f.style.top="".concat(t,"px")},document.onmouseup=function(){document.onmousemove=e,document.onmouseup=o,r&&c&&i.$nextTick(function(){i.savePosStorage()})})},dragEvent:function(t){var s=this;t.preventDefault();var l=this.$listeners,a=this.marginSize,e=this.events,r=void 0===e?{}:e,c=this.remember,u=this.storage,e=_tools.DomTools.getDomNode(),d=e.visibleHeight,f=e.visibleWidth,h=t.target.getAttribute("type"),m=_xeUtils.default.toNumber(this.minWidth),p=_xeUtils.default.toNumber(this.minHeight),v=f,g=d,x=this.getBox(),o=document.onmousemove,i=document.onmouseup,y=x.clientWidth,b=x.clientHeight,_=t.clientX,w=t.clientY,S=x.offsetTop,z=x.offsetLeft,T={type:"resize",$modal:this};document.onmousemove=function(t){var e,o,i,n;switch(t.preventDefault(),h){case"wl":i=(e=_-t.clientX)+y,a<z-e&&m<i&&(x.style.width="".concat(i<v?i:v,"px"),x.style.left="".concat(z-e,"px"));break;case"swst":e=_-t.clientX,o=w-t.clientY,i=e+y,n=o+b,a<z-e&&m<i&&(x.style.width="".concat(i<v?i:v,"px"),x.style.left="".concat(z-e,"px")),a<S-o&&p<n&&(x.style.height="".concat(n<g?n:g,"px"),x.style.top="".concat(S-o,"px"));break;case"swlb":e=_-t.clientX,o=t.clientY-w,i=e+y,n=o+b,a<z-e&&m<i&&(x.style.width="".concat(i<v?i:v,"px"),x.style.left="".concat(z-e,"px")),S+n+a<d&&p<n&&(x.style.height="".concat(n<g?n:g,"px"));break;case"st":o=w-t.clientY,n=b+o,a<S-o&&p<n&&(x.style.height="".concat(n<g?n:g,"px"),x.style.top="".concat(S-o,"px"));break;case"wr":e=t.clientX-_,z+(i=e+y)+a<f&&m<i&&(x.style.width="".concat(i<v?i:v,"px"));break;case"sest":e=t.clientX-_,n=(o=w-t.clientY)+b,z+(i=e+y)+a<f&&m<i&&(x.style.width="".concat(i<v?i:v,"px")),a<S-o&&p<n&&(x.style.height="".concat(n<g?n:g,"px"),x.style.top="".concat(S-o,"px"));break;case"selb":e=t.clientX-_,n=(o=t.clientY-w)+b,z+(i=e+y)+a<f&&m<i&&(x.style.width="".concat(i<v?i:v,"px")),S+n+a<d&&p<n&&(x.style.height="".concat(n<g?n:g,"px"));break;case"sb":o=t.clientY-w,S+(n=o+b)+a<d&&p<n&&(x.style.height="".concat(n<g?n:g,"px"))}x.className=x.className.replace(/\s?is--drag/,"")+" is--drag",c&&u&&s.savePosStorage(),l.zoom?s.$emit("zoom",T):r.zoom&&r.zoom.call(s,T)},document.onmouseup=function(){s.zoomLocat=null,document.onmousemove=o,document.onmouseup=i,setTimeout(function(){x.className=x.className.replace(/\s?is--drag/,"")},50)}},getStorageMap:function(t){var e=_conf.default.version,t=_xeUtils.default.toStringJSON(localStorage.getItem(t));return t&&t._v===e?t:{_v:e}},hasPosStorage:function(){var t=this.id,e=this.remember,o=this.storage,i=this.storageKey;return!!(e&&o&&this.getStorageMap(i)[t])},restorePosStorage:function(){var t,e,o,i,n,s=this.id,l=this.remember,a=this.storage,r=this.storageKey;l&&a&&((i=this.getStorageMap(r)[s])&&(t=this.getBox(),e=(n=_slicedToArray(i.split(","),8))[0],o=n[1],l=n[2],a=n[3],r=n[4],s=n[5],i=n[6],n=n[7],e&&(t.style.left="".concat(e,"px")),o&&(t.style.top="".concat(o,"px")),l&&(t.style.width="".concat(l,"px")),a&&(t.style.height="".concat(a,"px")),r&&s&&(this.zoomLocat={left:r,top:s,width:i,height:n})))},savePosStorage:function(){var t=this.id,e=this.remember,o=this.storage,i=this.storageKey,n=this.zoomLocat;e&&o&&(e=this.getBox(),(o=this.getStorageMap(i))[t]=[e.style.left,e.style.top,e.style.width,e.style.height].concat(n?[n.left,n.top,n.width,n.height]:[]).map(function(t){return t?_xeUtils.default.toNumber(t):""}).join(","),localStorage.setItem(i,_xeUtils.default.toJSONString(o)))}}};exports.default=_default2;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.msgQueue=exports.default=exports.allActivedModals=void 0;var _conf=_interopRequireDefault(require("../../v-x-e-table/src/conf")),_size=_interopRequireDefault(require("../../mixins/size")),_xeUtils=_interopRequireDefault(require("xe-utils")),_tools=require("../../tools");function _interopRequireDefault(t){return t&&t.__esModule?t:{default:t}}function _slicedToArray(t,e){return _arrayWithHoles(t)||_iterableToArrayLimit(t,e)||_unsupportedIterableToArray(t,e)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(t,e){if(t){if("string"==typeof t)return _arrayLikeToArray(t,e);var o=Object.prototype.toString.call(t).slice(8,-1);return"Map"===(o="Object"===o&&t.constructor?t.constructor.name:o)||"Set"===o?Array.from(t):"Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?_arrayLikeToArray(t,e):void 0}}function _arrayLikeToArray(t,e){(null==e||e>t.length)&&(e=t.length);for(var o=0,i=new Array(e);o<e;o++)i[o]=t[o];return i}function _iterableToArrayLimit(t,e){var o=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=o){var i,n,s=[],l=!0,a=!1;try{for(o=o.call(t);!(l=(i=o.next()).done)&&(s.push(i.value),!e||s.length!==e);l=!0);}catch(t){a=!0,n=t}finally{try{l||null==o.return||o.return()}finally{if(a)throw n}}return s}}function _arrayWithHoles(t){if(Array.isArray(t))return t}function _defineProperty(t,e,o){return e in t?Object.defineProperty(t,e,{value:o,enumerable:!0,configurable:!0,writable:!0}):t[e]=o,t}var allActivedModals=[];exports.allActivedModals=allActivedModals;var msgQueue=[];exports.msgQueue=msgQueue;var _default2={name:"VxeModal",mixins:[_size.default],props:{value:Boolean,id:String,type:{type:String,default:"modal"},loading:{type:Boolean,default:null},status:String,iconStatus:String,className:String,top:{type:[Number,String],default:function(){return _conf.default.modal.top}},position:[String,Object],title:String,duration:{type:[Number,String],default:function(){return _conf.default.modal.duration}},message:[String,Function],content:[String,Function],cancelButtonText:{type:String,default:function(){return _conf.default.modal.cancelButtonText}},confirmButtonText:{type:String,default:function(){return _conf.default.modal.confirmButtonText}},lockView:{type:Boolean,default:function(){return _conf.default.modal.lockView}},lockScroll:Boolean,mask:{type:Boolean,default:function(){return _conf.default.modal.mask}},maskClosable:{type:Boolean,default:function(){return _conf.default.modal.maskClosable}},escClosable:{type:Boolean,default:function(){return _conf.default.modal.escClosable}},resize:{type:Boolean,default:function(){return _conf.default.modal.resize}},showHeader:{type:Boolean,default:function(){return _conf.default.modal.showHeader}},showFooter:{type:Boolean,default:function(){return _conf.default.modal.showFooter}},showZoom:{type:Boolean,default:null},showClose:{type:Boolean,default:function(){return _conf.default.modal.showClose}},dblclickZoom:{type:Boolean,default:function(){return _conf.default.modal.dblclickZoom}},width:[Number,String],height:[Number,String],minWidth:{type:[Number,String],default:function(){return _conf.default.modal.minWidth}},minHeight:{type:[Number,String],default:function(){return _conf.default.modal.minHeight}},zIndex:Number,marginSize:{type:[Number,String],default:function(){return _conf.default.modal.marginSize}},fullscreen:Boolean,draggable:{type:Boolean,default:function(){return _conf.default.modal.draggable}},remember:{type:Boolean,default:function(){return _conf.default.modal.remember}},destroyOnClose:{type:Boolean,default:function(){return _conf.default.modal.destroyOnClose}},showTitleOverflow:{type:Boolean,default:function(){return _conf.default.modal.showTitleOverflow}},transfer:{type:Boolean,default:function(){return _conf.default.modal.transfer}},storage:{type:Boolean,default:function(){return _conf.default.modal.storage}},storageKey:{type:String,default:function(){return _conf.default.modal.storageKey}},animat:{type:Boolean,default:function(){return _conf.default.modal.animat}},size:{type:String,default:function(){return _conf.default.modal.size||_conf.default.size}},beforeHideMethod:{type:Function,default:function(){return _conf.default.modal.beforeHideMethod}},slots:Object,events:Object},data:function(){return{inited:!1,visible:!1,contentVisible:!1,modalTop:0,modalZindex:0,zoomLocat:null,firstOpen:!1}},computed:{isMsg:function(){return"message"===this.type}},watch:{width:function(){this.recalculate()},height:function(){this.recalculate()},value:function(t){this[t?"open":"close"]("model")}},created:function(){this.storage&&!this.id&&_tools.UtilTools.error("vxe.error.reqProp",["modal.id"])},mounted:function(){var t=this.$listeners,e=this.events,o=void 0===e?{}:e;this.value&&this.open(),this.recalculate(),this.escClosable&&_tools.GlobalEvent.on(this,"keydown",this.handleGlobalKeydownEvent);e="inserted",e={type:e,$modal:this,$event:{type:e}};t.inserted?this.$emit("inserted",e):o.inserted&&o.inserted.call(this,e)},beforeDestroy:function(){var t=this.$el;_tools.GlobalEvent.off(this,"keydown"),this.removeMsgQueue(),t.parentNode===document.body&&t.parentNode.removeChild(t)},render:function(e){var o=this,t=this._e,i=this.$scopedSlots,n=this.slots,s=void 0===n?{}:n,l=this.inited,a=this.vSize,r=this.className,c=this.type,u=this.resize,d=this.showClose,f=this.showZoom,h=this.animat,m=this.draggable,p=this.loading,v=this.status,g=this.iconStatus,x=this.showFooter,y=this.zoomLocat,b=this.modalTop,_=this.dblclickZoom,w=this.contentVisible,S=this.visible,z=this.title,T=this.lockScroll,k=this.lockView,$=this.mask,B=this.isMsg,M=this.showTitleOverflow,N=this.destroyOnClose,O=this.content||this.message,L=i.default||s.default,P=i.footer||s.footer,n=i.header||s.header,i=i.title||s.title,s={};return m&&(s.mousedown=this.mousedownEvent),f&&_&&"modal"===c&&(s.dblclick=this.toggleZoomEvent),e("div",{class:["vxe-modal--wrapper","type--".concat(c),r||"",(_defineProperty(r={},"size--".concat(a),a),_defineProperty(r,"status--".concat(v),v),_defineProperty(r,"is--animat",h),_defineProperty(r,"lock--scroll",T),_defineProperty(r,"lock--view",k),_defineProperty(r,"is--resize",u),_defineProperty(r,"is--mask",$),_defineProperty(r,"is--maximize",y),_defineProperty(r,"is--visible",w),_defineProperty(r,"is--active",S),_defineProperty(r,"is--loading",p),r)],style:{zIndex:this.modalZindex,top:b?"".concat(b,"px"):null},on:{click:this.selfClickEvent}},[e("div",{class:"vxe-modal--box",on:{mousedown:this.boxMousedownEvent},ref:"modalBox"},[this.showHeader?e("div",{class:["vxe-modal--header",{"is--drag":m,"is--ellipsis":!B&&M}],on:s},n?!l||N&&!S?[]:n.call(this,{$modal:this},e):[i?i.call(this,{$modal:this},e):e("span",{class:"vxe-modal--title"},z?_tools.UtilTools.getFuncText(z):_conf.default.i18n("vxe.alert.title")),f?e("i",{class:["vxe-modal--zoom-btn","trigger--btn",y?_conf.default.icon.MODAL_ZOOM_OUT:_conf.default.icon.MODAL_ZOOM_IN],attrs:{title:_conf.default.i18n("vxe.modal.zoom".concat(y?"Out":"In"))},on:{click:this.toggleZoomEvent}}):t(),d?e("i",{class:["vxe-modal--close-btn","trigger--btn",_conf.default.icon.MODAL_CLOSE],attrs:{title:_conf.default.i18n("vxe.modal.close")},on:{click:this.closeEvent}}):t()]):null,e("div",{class:"vxe-modal--body"},[v?e("div",{class:"vxe-modal--status-wrapper"},[e("i",{class:["vxe-modal--status-icon",g||_conf.default.icon["MODAL_".concat(v).toLocaleUpperCase()]]})]):null,e("div",{class:"vxe-modal--content"},L?!l||N&&!S?[]:L.call(this,{$modal:this},e):_tools.UtilTools.getFuncText(O)),B?null:e("div",{class:["vxe-loading",{"is--visible":p}]},[e("div",{class:"vxe-loading--spinner"})])]),x?e("div",{class:"vxe-modal--footer"},P?!l||N&&!S?[]:P.call(this,{$modal:this},e):["confirm"===c?e("vxe-button",{ref:"cancelBtn",on:{click:this.cancelEvent}},this.cancelButtonText||_conf.default.i18n("vxe.button.cancel")):null,e("vxe-button",{ref:"confirmBtn",props:{status:"primary"},on:{click:this.confirmEvent}},this.confirmButtonText||_conf.default.i18n("vxe.button.confirm"))]):null,!B&&u?e("span",{class:"vxe-modal--resize"},["wl","wr","swst","sest","st","swlb","selb","sb"].map(function(t){return e("span",{class:"".concat(t,"-resize"),attrs:{type:t},on:{mousedown:o.dragEvent}})})):null])])},methods:{recalculate:function(){var t=this.width,e=this.height,o=this.getBox();return o.style.width=t?isNaN(t)?t:"".concat(t,"px"):null,o.style.height=e?isNaN(e)?e:"".concat(e,"px"):null,this.$nextTick()},selfClickEvent:function(t){this.maskClosable&&t.target===this.$el&&this.close("mask")},updateZindex:function(){var t=this.zIndex,e=this.modalZindex;t?this.modalZindex=t:e<_tools.UtilTools.getLastZIndex()&&(this.modalZindex=_tools.UtilTools.nextZIndex())},closeEvent:function(t){var e=this.events,o=void 0===e?{}:e,e="close",t={type:e,$modal:this,$event:t};o[e]?o[e].call(this,t):this.$emit(e,t),this.close(e)},confirmEvent:function(t){var e=this.events,o=void 0===e?{}:e,e="confirm",t={type:e,$modal:this,$event:t};o[e]?o[e].call(this,t):this.$emit(e,t),this.close(e)},cancelEvent:function(t){var e=this.events,o=void 0===e?{}:e,e="cancel",t={type:e,$modal:this,$event:t};o[e]?o[e].call(this,t):this.$emit(e,t),this.close(e)},open:function(){var o=this,e=this.$refs,t=this.events,i=void 0===t?{}:t,n=this.inited,s=this.duration,l=this.visible,t=this.isMsg,a=this.remember,r=this.showFooter;n||(this.inited=!0,this.transfer&&document.body.appendChild(this.$el)),l||(a||this.recalculate(),this.visible=!0,this.contentVisible=!1,this.updateZindex(),allActivedModals.push(this),setTimeout(function(){o.contentVisible=!0,o.$nextTick(function(){!r||(t=e.confirmBtn||e.cancelBtn)&&t.focus();var t={type:"",$modal:o};i.show?i.show.call(o,t):(o.$emit("input",!0),o.$emit("show",t))})},10),t?(this.addMsgQueue(),-1!==s&&setTimeout(function(){return o.close("close")},_xeUtils.default.toNumber(s))):this.$nextTick(function(){var t=o.firstOpen,e=o.fullscreen;a&&t||o.updatePosition().then(function(){setTimeout(function(){return o.updatePosition()},20)}),t||(o.firstOpen=!0,o.hasPosStorage()?o.restorePosStorage():e&&o.$nextTick(function(){return o.maximize()}))}))},addMsgQueue:function(){-1===msgQueue.indexOf(this)&&msgQueue.push(this),this.updateStyle()},removeMsgQueue:function(){var e=this;-1<msgQueue.indexOf(this)&&_xeUtils.default.remove(msgQueue,function(t){return t===e}),this.updateStyle()},updateStyle:function(){this.$nextTick(function(){var e=0;msgQueue.forEach(function(t){e+=_xeUtils.default.toNumber(t.top),t.modalTop=e,e+=t.$refs.modalBox.clientHeight})})},updatePosition:function(){var u=this;return this.$nextTick().then(function(){var t=u.marginSize,e=u.position,o=u.getBox(),i=document.documentElement.clientWidth||document.body.clientWidth,n=document.documentElement.clientHeight||document.body.clientHeight,s="center"===e,l=s?{top:e,left:e}:Object.assign({},e),a=l.top,r=l.left,c=s||"center"===a,e="",l="",l=r&&!(s||"center"===r)?isNaN(r)?r:"".concat(r,"px"):"".concat(Math.max(t,i/2-o.offsetWidth/2),"px"),e=a&&!c?isNaN(a)?a:"".concat(a,"px"):"".concat(Math.max(t,n/2-o.offsetHeight/2),"px");o.style.top=e,o.style.left=l})},close:function(t){var e=this,o=this.events,i=void 0===o?{}:o,n=this.remember,s=this.visible,l=this.isMsg,o=this.beforeHideMethod,a={type:t,$modal:this};s&&Promise.resolve(o?o(a):null).then(function(t){_xeUtils.default.isError(t)||(l&&e.removeMsgQueue(),e.contentVisible=!1,n||(e.zoomLocat=null),_xeUtils.default.remove(allActivedModals,function(t){return t===e}),e.$emit("before-hide",a),setTimeout(function(){e.visible=!1,i.hide?i.hide.call(e,a):(e.$emit("input",!1),e.$emit("hide",a))},200))}).catch(function(t){return t})},handleGlobalKeydownEvent:function(t){var e,o=this;27===t.keyCode&&((e=_xeUtils.default.max(allActivedModals,function(t){return t.modalZindex}))&&setTimeout(function(){e===o&&e.escClosable&&o.close("exit")},10))},getBox:function(){return this.$refs.modalBox},isMaximized:function(){return!!this.zoomLocat},maximize:function(){var n=this;return this.$nextTick().then(function(){var t,e,o,i;n.zoomLocat||(t=Math.max(0,n.marginSize),e=n.getBox(),o=(i=_tools.DomTools.getDomNode()).visibleHeight,i=i.visibleWidth,n.zoomLocat={top:e.offsetTop,left:e.offsetLeft,width:e.offsetWidth+(e.style.width?0:1),height:e.offsetHeight+(e.style.height?0:1)},Object.assign(e.style,{top:"".concat(t,"px"),left:"".concat(t,"px"),width:"".concat(i-2*t,"px"),height:"".concat(o-2*t,"px")}),n.savePosStorage())})},revert:function(){var o=this;return this.$nextTick().then(function(){var t,e=o.zoomLocat;e&&(t=o.getBox(),o.zoomLocat=null,Object.assign(t.style,{top:"".concat(e.top,"px"),left:"".concat(e.left,"px"),width:"".concat(e.width,"px"),height:"".concat(e.height,"px")}),o.savePosStorage())})},zoom:function(){var t=this;return this[this.zoomLocat?"revert":"maximize"]().then(function(){return t.isMaximized()})},toggleZoomEvent:function(t){var e=this,o=this.$listeners,i=this.zoomLocat,n=this.events,s=void 0===n?{}:n,l={type:i?"revert":"max",$modal:this,$event:t};return this.zoom().then(function(){o.zoom?e.$emit("zoom",l):s.zoom&&s.zoom.call(e,l)})},getPosition:function(){if(!this.isMsg){var t=this.getBox();if(t)return{top:t.offsetTop,left:t.offsetLeft}}return null},setPosition:function(t,e){var o;return this.isMsg||(o=this.getBox(),_xeUtils.default.isNumber(t)&&(o.style.top="".concat(t,"px")),_xeUtils.default.isNumber(e)&&(o.style.left="".concat(e,"px"))),this.$nextTick()},boxMousedownEvent:function(){var e=this.modalZindex;allActivedModals.some(function(t){return t.visible&&t.modalZindex>e})&&this.updateZindex()},mousedownEvent:function(t){var e,o,n,s,l,a,i=this,r=this.remember,c=this.storage,u=this.marginSize,d=this.zoomLocat,f=this.getBox();d||0!==t.button||_tools.DomTools.getEventTargetNode(t,f,"trigger--btn").flag||(t.preventDefault(),e=document.onmousemove,o=document.onmouseup,n=t.clientX-f.offsetLeft,s=t.clientY-f.offsetTop,t=_tools.DomTools.getDomNode(),l=t.visibleHeight,a=t.visibleWidth,document.onmousemove=function(t){t.preventDefault();var e=f.offsetWidth,o=f.offsetHeight,i=a-e-u-1,e=l-o-u-1,o=t.clientX-n,t=t.clientY-s;(t=e<t?e:t)<u&&(t=u),f.style.left="".concat(o=(o=i<o?i:o)<u?u:o,"px"),f.style.top="".concat(t,"px")},document.onmouseup=function(){document.onmousemove=e,document.onmouseup=o,r&&c&&i.$nextTick(function(){i.savePosStorage()})})},dragEvent:function(t){var s=this;t.preventDefault();var l=this.$listeners,a=this.marginSize,e=this.events,r=void 0===e?{}:e,c=this.remember,u=this.storage,e=_tools.DomTools.getDomNode(),d=e.visibleHeight,f=e.visibleWidth,h=t.target.getAttribute("type"),m=_xeUtils.default.toNumber(this.minWidth),p=_xeUtils.default.toNumber(this.minHeight),v=f,g=d,x=this.getBox(),o=document.onmousemove,i=document.onmouseup,y=x.clientWidth,b=x.clientHeight,_=t.clientX,w=t.clientY,S=x.offsetTop,z=x.offsetLeft,T={type:"resize",$modal:this};document.onmousemove=function(t){var e,o,i,n;switch(t.preventDefault(),h){case"wl":i=(e=_-t.clientX)+y,a<z-e&&m<i&&(x.style.width="".concat(i<v?i:v,"px"),x.style.left="".concat(z-e,"px"));break;case"swst":e=_-t.clientX,o=w-t.clientY,i=e+y,n=o+b,a<z-e&&m<i&&(x.style.width="".concat(i<v?i:v,"px"),x.style.left="".concat(z-e,"px")),a<S-o&&p<n&&(x.style.height="".concat(n<g?n:g,"px"),x.style.top="".concat(S-o,"px"));break;case"swlb":e=_-t.clientX,o=t.clientY-w,i=e+y,n=o+b,a<z-e&&m<i&&(x.style.width="".concat(i<v?i:v,"px"),x.style.left="".concat(z-e,"px")),S+n+a<d&&p<n&&(x.style.height="".concat(n<g?n:g,"px"));break;case"st":o=w-t.clientY,n=b+o,a<S-o&&p<n&&(x.style.height="".concat(n<g?n:g,"px"),x.style.top="".concat(S-o,"px"));break;case"wr":e=t.clientX-_,z+(i=e+y)+a<f&&m<i&&(x.style.width="".concat(i<v?i:v,"px"));break;case"sest":e=t.clientX-_,n=(o=w-t.clientY)+b,z+(i=e+y)+a<f&&m<i&&(x.style.width="".concat(i<v?i:v,"px")),a<S-o&&p<n&&(x.style.height="".concat(n<g?n:g,"px"),x.style.top="".concat(S-o,"px"));break;case"selb":e=t.clientX-_,n=(o=t.clientY-w)+b,z+(i=e+y)+a<f&&m<i&&(x.style.width="".concat(i<v?i:v,"px")),S+n+a<d&&p<n&&(x.style.height="".concat(n<g?n:g,"px"));break;case"sb":o=t.clientY-w,S+(n=o+b)+a<d&&p<n&&(x.style.height="".concat(n<g?n:g,"px"))}x.className=x.className.replace(/\s?is--drag/,"")+" is--drag",c&&u&&s.savePosStorage(),l.zoom?s.$emit("zoom",T):r.zoom&&r.zoom.call(s,T)},document.onmouseup=function(){s.zoomLocat=null,document.onmousemove=o,document.onmouseup=i,setTimeout(function(){x.className=x.className.replace(/\s?is--drag/,"")},50)}},getStorageMap:function(t){var e=_conf.default.version,t=_xeUtils.default.toStringJSON(localStorage.getItem(t));return t&&t._v===e?t:{_v:e}},hasPosStorage:function(){var t=this.id,e=this.remember,o=this.storage,i=this.storageKey;return!!(e&&o&&this.getStorageMap(i)[t])},restorePosStorage:function(){var t,e,o,i,n,s=this.id,l=this.remember,a=this.storage,r=this.storageKey;l&&a&&((i=this.getStorageMap(r)[s])&&(t=this.getBox(),e=(n=_slicedToArray(i.split(","),8))[0],o=n[1],l=n[2],a=n[3],r=n[4],s=n[5],i=n[6],n=n[7],e&&(t.style.left="".concat(e,"px")),o&&(t.style.top="".concat(o,"px")),l&&(t.style.width="".concat(l,"px")),a&&(t.style.height="".concat(a,"px")),r&&s&&(this.zoomLocat={left:r,top:s,width:i,height:n})))},savePosStorage:function(){var t=this.id,e=this.remember,o=this.storage,i=this.storageKey,n=this.zoomLocat;e&&o&&(e=this.getBox(),(o=this.getStorageMap(i))[t]=[e.style.left,e.style.top,e.style.width,e.style.height].concat(n?[n.left,n.top,n.width,n.height]:[]).map(function(t){return t?_xeUtils.default.toNumber(t):""}).join(","),localStorage.setItem(i,_xeUtils.default.toJSONString(o)))}}};exports.default=_default2;
@@ -19,6 +19,7 @@ var _default2 = {
19
19
  name: 'VxePulldown',
20
20
  mixins: [_size.default],
21
21
  props: {
22
+ value: Boolean,
22
23
  disabled: Boolean,
23
24
  placement: String,
24
25
  size: {
@@ -42,6 +43,15 @@ var _default2 = {
42
43
  isActivated: false
43
44
  };
44
45
  },
46
+ watch: {
47
+ value: function value(_value) {
48
+ if (_value) {
49
+ this.showPanel();
50
+ } else {
51
+ this.hidePanel();
52
+ }
53
+ }
54
+ },
45
55
  created: function created() {
46
56
  _tools.GlobalEvent.on(this, 'mousewheel', this.handleGlobalMousewheelEvent);
47
57
 
@@ -186,6 +196,8 @@ var _default2 = {
186
196
  setTimeout(function () {
187
197
  _this.visiblePanel = true;
188
198
 
199
+ _this.$emit('update:input', true);
200
+
189
201
  _this.updatePlacement();
190
202
 
191
203
  setTimeout(function () {
@@ -207,6 +219,7 @@ var _default2 = {
207
219
  var _this2 = this;
208
220
 
209
221
  this.visiblePanel = false;
222
+ this.$emit('update:input', false);
210
223
  return new Promise(function (resolve) {
211
224
  if (_this2.animatVisible) {
212
225
  _this2.hidePanelTimeout = setTimeout(function () {
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _conf=_interopRequireDefault(require("../../v-x-e-table/src/conf")),_size=_interopRequireDefault(require("../../mixins/size")),_tools=require("../../tools");function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _defineProperty(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}var _default2={name:"VxePulldown",mixins:[_size.default],props:{disabled:Boolean,placement:String,size:{type:String,default:function(){return _conf.default.size}},destroyOnClose:Boolean,transfer:Boolean},data:function(){return{inited:!1,panelIndex:0,panelStyle:null,panelPlacement:null,currentValue:null,visiblePanel:!1,animatVisible:!1,isActivated:!1}},created:function(){_tools.GlobalEvent.on(this,"mousewheel",this.handleGlobalMousewheelEvent),_tools.GlobalEvent.on(this,"mousedown",this.handleGlobalMousedownEvent),_tools.GlobalEvent.on(this,"blur",this.handleGlobalBlurEvent)},beforeDestroy:function(){var e=this.$refs.panel;e&&e.parentNode&&e.parentNode.removeChild(e)},destroyed:function(){_tools.GlobalEvent.off(this,"mousewheel"),_tools.GlobalEvent.off(this,"mousedown"),_tools.GlobalEvent.off(this,"blur")},render:function(e){var t=this.$scopedSlots,i=this.inited,n=this.vSize,l=this.destroyOnClose,o=this.transfer,s=this.isActivated,a=this.disabled,r=this.animatVisible,d=this.visiblePanel,u=this.panelStyle,h=this.panelPlacement,c=t.default,f=t.dropdown;return e("div",{class:["vxe-pulldown",(_defineProperty(t={},"size--".concat(n),n),_defineProperty(t,"is--visivle",d),_defineProperty(t,"is--disabled",a),_defineProperty(t,"is--active",s),t)]},[e("div",{ref:"content",class:"vxe-pulldown--content"},c?c.call(this,{$pulldown:this},e):[]),e("div",{ref:"panel",class:["vxe-table--ignore-clear vxe-pulldown--panel",(_defineProperty(c={},"size--".concat(n),n),_defineProperty(c,"is--transfer",o),_defineProperty(c,"animat--leave",r),_defineProperty(c,"animat--enter",d),c)],attrs:{placement:h},style:u},f?[e("div",{class:"vxe-pulldown--wrapper"},!i||l&&!d&&!r?[]:f.call(this,{$pulldown:this},e))]:[])])},methods:{handleGlobalMousewheelEvent:function(e){var t=this.$refs,i=this.disabled,n=this.visiblePanel;i||n&&(_tools.DomTools.getEventTargetNode(e,t.panel).flag?this.updatePlacement():(this.hidePanel(),this.$emit("hide-panel",{$event:e})))},handleGlobalMousedownEvent:function(e){var t=this.$refs,i=this.$el,n=this.disabled,l=this.visiblePanel;n||(this.isActivated=_tools.DomTools.getEventTargetNode(e,i).flag||_tools.DomTools.getEventTargetNode(e,t.panel).flag,l&&!this.isActivated&&(this.hidePanel(),this.$emit("hide-panel",{$event:e})))},handleGlobalBlurEvent:function(e){this.visiblePanel&&(this.isActivated=!1,this.hidePanel(),this.$emit("hide-panel",{$event:e}))},updateZindex:function(){this.panelIndex<_tools.UtilTools.getLastZIndex()&&(this.panelIndex=_tools.UtilTools.nextZIndex())},isPanelVisible:function(){return this.visiblePanel},togglePanel:function(){return this.visiblePanel?this.hidePanel():this.showPanel()},showPanel:function(){var t=this;return this.inited||(this.inited=!0,this.transfer&&document.body.appendChild(this.$refs.panel)),new Promise(function(e){t.disabled?e(t.$nextTick()):(clearTimeout(t.hidePanelTimeout),t.isActivated=!0,t.animatVisible=!0,setTimeout(function(){t.visiblePanel=!0,t.updatePlacement(),setTimeout(function(){e(t.updatePlacement())},40)},10),t.updateZindex())})},hidePanel:function(){var t=this;return this.visiblePanel=!1,new Promise(function(e){t.animatVisible?t.hidePanelTimeout=setTimeout(function(){t.animatVisible=!1,e(t.$nextTick())},350):e(t.$nextTick())})},updatePlacement:function(){var c=this;return this.$nextTick().then(function(){var e,t,i,n,l,o,s,a,r=c.$refs,d=c.transfer,u=c.placement,h=c.panelIndex;return c.visiblePanel&&(a=r.panel,o=r.content,a&&o&&(e=o.offsetHeight,t=o.offsetWidth,i=a.offsetHeight,n=a.offsetWidth,l={zIndex:h},r=(s=_tools.DomTools.getAbsolutePos(o)).boundingTop,a=s.boundingLeft,h=s.visibleHeight,o=s.visibleWidth,s="bottom",d?(d=r+e,"top"===u?(s="top",d=r-i):u||(h<d+i+5&&(s="top",d=r-i),d<5&&(s="bottom",d=r+e)),o<(a=a)+n+5&&(a-=a+n+5-o),a<5&&(a=5),Object.assign(l,{left:"".concat(a,"px"),top:"".concat(d,"px"),minWidth:"".concat(t,"px")})):"top"===u?(s="top",l.bottom="".concat(e,"px")):u||h<r+e+i&&5<r-e-i&&(s="top",l.bottom="".concat(e,"px")),c.panelStyle=l,c.panelPlacement=s)),c.$nextTick()})}}};exports.default=_default2;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var _conf=_interopRequireDefault(require("../../v-x-e-table/src/conf")),_size=_interopRequireDefault(require("../../mixins/size")),_tools=require("../../tools");function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _defineProperty(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}var _default2={name:"VxePulldown",mixins:[_size.default],props:{value:Boolean,disabled:Boolean,placement:String,size:{type:String,default:function(){return _conf.default.size}},destroyOnClose:Boolean,transfer:Boolean},data:function(){return{inited:!1,panelIndex:0,panelStyle:null,panelPlacement:null,currentValue:null,visiblePanel:!1,animatVisible:!1,isActivated:!1}},watch:{value:function(e){e?this.showPanel():this.hidePanel()}},created:function(){_tools.GlobalEvent.on(this,"mousewheel",this.handleGlobalMousewheelEvent),_tools.GlobalEvent.on(this,"mousedown",this.handleGlobalMousedownEvent),_tools.GlobalEvent.on(this,"blur",this.handleGlobalBlurEvent)},beforeDestroy:function(){var e=this.$refs.panel;e&&e.parentNode&&e.parentNode.removeChild(e)},destroyed:function(){_tools.GlobalEvent.off(this,"mousewheel"),_tools.GlobalEvent.off(this,"mousedown"),_tools.GlobalEvent.off(this,"blur")},render:function(e){var t=this.$scopedSlots,i=this.inited,n=this.vSize,l=this.destroyOnClose,o=this.transfer,s=this.isActivated,a=this.disabled,r=this.animatVisible,d=this.visiblePanel,u=this.panelStyle,h=this.panelPlacement,c=t.default,f=t.dropdown;return e("div",{class:["vxe-pulldown",(_defineProperty(t={},"size--".concat(n),n),_defineProperty(t,"is--visivle",d),_defineProperty(t,"is--disabled",a),_defineProperty(t,"is--active",s),t)]},[e("div",{ref:"content",class:"vxe-pulldown--content"},c?c.call(this,{$pulldown:this},e):[]),e("div",{ref:"panel",class:["vxe-table--ignore-clear vxe-pulldown--panel",(_defineProperty(c={},"size--".concat(n),n),_defineProperty(c,"is--transfer",o),_defineProperty(c,"animat--leave",r),_defineProperty(c,"animat--enter",d),c)],attrs:{placement:h},style:u},f?[e("div",{class:"vxe-pulldown--wrapper"},!i||l&&!d&&!r?[]:f.call(this,{$pulldown:this},e))]:[])])},methods:{handleGlobalMousewheelEvent:function(e){var t=this.$refs,i=this.disabled,n=this.visiblePanel;i||n&&(_tools.DomTools.getEventTargetNode(e,t.panel).flag?this.updatePlacement():(this.hidePanel(),this.$emit("hide-panel",{$event:e})))},handleGlobalMousedownEvent:function(e){var t=this.$refs,i=this.$el,n=this.disabled,l=this.visiblePanel;n||(this.isActivated=_tools.DomTools.getEventTargetNode(e,i).flag||_tools.DomTools.getEventTargetNode(e,t.panel).flag,l&&!this.isActivated&&(this.hidePanel(),this.$emit("hide-panel",{$event:e})))},handleGlobalBlurEvent:function(e){this.visiblePanel&&(this.isActivated=!1,this.hidePanel(),this.$emit("hide-panel",{$event:e}))},updateZindex:function(){this.panelIndex<_tools.UtilTools.getLastZIndex()&&(this.panelIndex=_tools.UtilTools.nextZIndex())},isPanelVisible:function(){return this.visiblePanel},togglePanel:function(){return this.visiblePanel?this.hidePanel():this.showPanel()},showPanel:function(){var t=this;return this.inited||(this.inited=!0,this.transfer&&document.body.appendChild(this.$refs.panel)),new Promise(function(e){t.disabled?e(t.$nextTick()):(clearTimeout(t.hidePanelTimeout),t.isActivated=!0,t.animatVisible=!0,setTimeout(function(){t.visiblePanel=!0,t.$emit("update:input",!0),t.updatePlacement(),setTimeout(function(){e(t.updatePlacement())},40)},10),t.updateZindex())})},hidePanel:function(){var t=this;return this.visiblePanel=!1,this.$emit("update:input",!1),new Promise(function(e){t.animatVisible?t.hidePanelTimeout=setTimeout(function(){t.animatVisible=!1,e(t.$nextTick())},350):e(t.$nextTick())})},updatePlacement:function(){var c=this;return this.$nextTick().then(function(){var e,t,i,n,l,o,s,a,r=c.$refs,d=c.transfer,u=c.placement,h=c.panelIndex;return c.visiblePanel&&(a=r.panel,o=r.content,a&&o&&(e=o.offsetHeight,t=o.offsetWidth,i=a.offsetHeight,n=a.offsetWidth,l={zIndex:h},r=(s=_tools.DomTools.getAbsolutePos(o)).boundingTop,a=s.boundingLeft,h=s.visibleHeight,o=s.visibleWidth,s="bottom",d?(d=r+e,"top"===u?(s="top",d=r-i):u||(h<d+i+5&&(s="top",d=r-i),d<5&&(s="bottom",d=r+e)),o<(a=a)+n+5&&(a-=a+n+5-o),a<5&&(a=5),Object.assign(l,{left:"".concat(a,"px"),top:"".concat(d,"px"),minWidth:"".concat(t,"px")})):"top"===u?(s="top",l.bottom="".concat(e,"px")):u||h<r+e+i&&5<r-e-i&&(s="top",l.bottom="".concat(e,"px")),c.panelStyle=l,c.panelPlacement=s)),c.$nextTick()})}}};exports.default=_default2;