@opentiny/vue-renderless 3.14.1 → 3.15.1

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 (88) hide show
  1. package/LICENSE +22 -0
  2. package/action-menu/index.js +44 -0
  3. package/action-menu/vue.js +25 -8
  4. package/calendar-view/index.js +21 -13
  5. package/calendar-view/vue.js +6 -3
  6. package/cascader/index.js +1 -1
  7. package/cascader-select/index.js +5 -0
  8. package/cascader-select/vue.js +3 -1
  9. package/common/deps/vue-popper.js +22 -2
  10. package/common/index.js +15 -2
  11. package/common/runtime.js +1 -1
  12. package/dept/index.js +8 -1
  13. package/dept/vue.js +10 -1
  14. package/dialog-box/index.js +12 -6
  15. package/dialog-box/vue.js +1 -1
  16. package/dropdown-item/mf.js +2 -2
  17. package/file-upload/index.js +0 -1
  18. package/grid/utils/dom.js +30 -10
  19. package/image/index.js +4 -0
  20. package/image/vue.js +6 -3
  21. package/image-viewer/vue.js +3 -1
  22. package/input/index.js +6 -1
  23. package/input/vue.js +9 -5
  24. package/modal/index.js +1 -1
  25. package/numeric/index.js +5 -18
  26. package/numeric/vue.js +3 -12
  27. package/option-group/index.js +13 -0
  28. package/option-group/vue.js +19 -6
  29. package/package.json +7 -7
  30. package/picker/index.js +27 -6
  31. package/picker/vue.js +2 -2
  32. package/popconfirm/index.js +6 -0
  33. package/popconfirm/vue.js +11 -3
  34. package/popover/index.js +4 -1
  35. package/popover/vue.js +2 -1
  36. package/quarter-panel/index.js +61 -0
  37. package/quarter-panel/vue.js +46 -0
  38. package/select/index.js +99 -30
  39. package/select/vue.js +26 -12
  40. package/skeleton/vue.js +2 -2
  41. package/skeleton-item/vue.js +1 -1
  42. package/statistic/index.js +22 -0
  43. package/statistic/vue.js +20 -0
  44. package/tabs/index.js +55 -14
  45. package/tall-storage/index.js +1 -1
  46. package/time-picker-mobile/index.js +10 -1
  47. package/time-picker-mobile/vue.js +5 -3
  48. package/time-spinner/index.js +52 -1
  49. package/time-spinner/vue.js +4 -2
  50. package/timeline-item/index.js +14 -1
  51. package/timeline-item/vue.js +7 -4
  52. package/tree/index.js +8 -4
  53. package/tree/vue.js +3 -3
  54. package/tree-node/index.js +2 -2
  55. package/types/action-menu.type.d.ts +49 -13
  56. package/types/date-table.type.d.ts +13 -0
  57. package/types/dialog-box.type.d.ts +1 -1
  58. package/types/{dropdown-item.type-8475a549.d.ts → dropdown-item.type-678794c9.d.ts} +4 -0
  59. package/types/dropdown-item.type.d.ts +1 -1
  60. package/types/dropdown-menu.type.d.ts +1 -1
  61. package/types/file-upload.type.d.ts +1 -1
  62. package/types/form-item.type.d.ts +1 -1
  63. package/types/{form.type-a2dc0099.d.ts → form.type-8e30b25c.d.ts} +1 -0
  64. package/types/form.type.d.ts +1 -1
  65. package/types/image.type.d.ts +4 -0
  66. package/types/input.type.d.ts +3 -1
  67. package/types/numeric.type.d.ts +4 -5
  68. package/types/popconfirm.type.d.ts +8 -0
  69. package/types/popover.type.d.ts +2 -2
  70. package/types/skeleton.type.d.ts +1 -1
  71. package/types/statistic.type.d.ts +56 -0
  72. package/types/tag.type.d.ts +4 -1
  73. package/types/{time-line.type-b155cb4f.d.ts → time-line.type-1b501c41.d.ts} +7 -0
  74. package/types/time-line.type.d.ts +1 -1
  75. package/types/timeline-item.type.d.ts +1 -1
  76. package/types/transfer.type.d.ts +3 -3
  77. package/types/upload-dragger.type.d.ts +1 -1
  78. package/types/{upload-list.type-6d6e3d0e.d.ts → upload-list.type-f34997c8.d.ts} +3 -3
  79. package/types/upload-list.type.d.ts +1 -1
  80. package/types/upload.type.d.ts +1 -1
  81. package/credit-card/index.js +0 -93
  82. package/credit-card/vue.js +0 -62
  83. package/credit-card-form/index.js +0 -112
  84. package/credit-card-form/vue.js +0 -119
  85. package/detail-page/index.js +0 -79
  86. package/detail-page/vue.js +0 -78
  87. package/slide-bar/index.js +0 -67
  88. package/slide-bar/vue.js +0 -32
package/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022 - present TinyVue Authors.
4
+ Copyright (c) 2022 - present Huawei Cloud Computing Technologies Co., Ltd.
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in all
14
+ copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ SOFTWARE.
@@ -1,4 +1,44 @@
1
1
  import "../chunk-G2ADBYYC.js";
2
+ const computedMaxShowNum = ({ props, state }) => () => {
3
+ if (props.maxShowNum !== void 0) {
4
+ return props.maxShowNum;
5
+ }
6
+ if (state.isCardMode) {
7
+ return 3;
8
+ } else {
9
+ return 2;
10
+ }
11
+ };
12
+ const computedSpacing = ({ props, state }) => () => {
13
+ if (props.spacing !== void 0) {
14
+ return String(props.spacing).includes("px") ? props.spacing : props.spacing + "px";
15
+ }
16
+ if (state.isCardMode) {
17
+ return "10px";
18
+ } else {
19
+ return "5px";
20
+ }
21
+ };
22
+ const computedMoreText = ({ props, state, t }) => () => {
23
+ if (props.moreText !== void 0) {
24
+ return props.moreText;
25
+ }
26
+ if (state.isCardMode) {
27
+ return "";
28
+ } else {
29
+ return t("ui.actionMenu.moreText");
30
+ }
31
+ };
32
+ const computedSuffixIcon = ({ props, state }) => () => {
33
+ if (props.suffixIcon) {
34
+ return props.suffixIcon;
35
+ }
36
+ if (state.isCardMode) {
37
+ return "tiny-icon-ellipsis";
38
+ } else {
39
+ return "";
40
+ }
41
+ };
2
42
  const handleMoreClick = (emit) => () => {
3
43
  emit("more-click");
4
44
  };
@@ -9,6 +49,10 @@ const visibleChange = (emit) => (status) => {
9
49
  emit("visible-change", status);
10
50
  };
11
51
  export {
52
+ computedMaxShowNum,
53
+ computedMoreText,
54
+ computedSpacing,
55
+ computedSuffixIcon,
12
56
  handleItemClick,
13
57
  handleMoreClick,
14
58
  visibleChange
@@ -1,18 +1,35 @@
1
1
  import "../chunk-G2ADBYYC.js";
2
- import { handleMoreClick, handleItemClick, visibleChange } from "./index";
2
+ import {
3
+ handleMoreClick,
4
+ handleItemClick,
5
+ visibleChange,
6
+ computedMaxShowNum,
7
+ computedSpacing,
8
+ computedMoreText,
9
+ computedSuffixIcon
10
+ } from "./index";
3
11
  const api = ["state", "handleMoreClick", "handleItemClick", "visibleChange"];
4
- const renderless = (props, { computed, reactive }, { emit }) => {
12
+ const renderless = (props, { computed, reactive }, { emit, t }) => {
13
+ const api2 = {};
5
14
  const state = reactive({
6
- visibleOptions: computed(() => props.options.slice(0, props.maxShowNum)),
7
- moreOptions: computed(() => props.options.slice(props.maxShowNum)),
8
- spacing: computed(() => String(props.spacing).includes("px") ? props.spacing : props.spacing + "px")
15
+ visibleOptions: computed(() => props.options.slice(0, state.maxShowNum)),
16
+ isCardMode: computed(() => props.mode === "card"),
17
+ moreOptions: computed(() => props.options.slice(state.maxShowNum)),
18
+ spacing: computed(() => api2.computedSpacing()),
19
+ maxShowNum: computed(() => api2.computedMaxShowNum()),
20
+ moreText: computed(() => api2.computedMoreText()),
21
+ suffixIcon: computed(() => api2.computedSuffixIcon())
9
22
  });
10
- const api2 = {
23
+ Object.assign(api2, {
24
+ state,
11
25
  handleMoreClick: handleMoreClick(emit),
12
26
  handleItemClick: handleItemClick(emit),
13
27
  visibleChange: visibleChange(emit),
14
- state
15
- };
28
+ computedMaxShowNum: computedMaxShowNum({ props, state }),
29
+ computedSpacing: computedSpacing({ props, state }),
30
+ computedMoreText: computedMoreText({ props, state, t }),
31
+ computedSuffixIcon: computedSuffixIcon({ props, state })
32
+ });
16
33
  return api2;
17
34
  };
18
35
  export {
@@ -125,23 +125,30 @@ const handleEvents = ({ props, state }) => () => {
125
125
  props.events.forEach((prop) => {
126
126
  const item = __spreadValues({}, prop);
127
127
  const {
128
- year,
129
- month,
128
+ year: startYear,
129
+ month: startMonth,
130
130
  day: startDay,
131
131
  hours: startHours,
132
132
  minutes: startMinutes,
133
133
  seconds: startSeconds
134
134
  } = parseDate(item.start);
135
- const { day: endDay, hours: endHours, minutes: endMinutes, seconds: endSeconds } = parseDate(item.end);
136
- if ([lastYear, +state.activeYear, nextYear].includes(year) && [lastMon, +state.activeMonth, nextMon].includes(month)) {
135
+ const {
136
+ year: endYear,
137
+ month: endMonth,
138
+ day: endDay,
139
+ hours: endHours,
140
+ minutes: endMinutes,
141
+ seconds: endSeconds
142
+ } = parseDate(item.end);
143
+ if ([lastYear, +state.activeYear, nextYear].includes(startYear) && [lastMon, +state.activeMonth, nextMon].includes(startMonth) || [lastYear, +state.activeYear, nextYear].includes(endYear) && [lastMon, +state.activeMonth, nextMon].includes(endMonth)) {
137
144
  item.start = getTime(item.start);
138
145
  item.end = getTime(item.end);
139
146
  item.startTime = makeUpZero(startHours) + ":" + makeUpZero(startMinutes) + ":" + makeUpZero(startSeconds);
140
147
  item.endTime = makeUpZero(endHours) + ":" + makeUpZero(endMinutes) + ":" + makeUpZero(endSeconds);
141
- item.startDay = year + "-" + month + "-" + startDay;
142
- item.endDay = year + "-" + month + "-" + endDay;
143
- const startTimestamp = getTime(year + "-" + month + "-" + startDay);
144
- const endTimestamp = getTime(year + "-" + month + "-" + endDay);
148
+ item.startDay = startYear + "-" + startMonth + "-" + startDay;
149
+ item.endDay = endYear + "-" + endMonth + "-" + endDay;
150
+ const startTimestamp = getTime(startYear + "-" + startMonth + "-" + startDay);
151
+ const endTimestamp = getTime(endYear + "-" + endMonth + "-" + endDay);
145
152
  const days = Math.abs(endTimestamp - startTimestamp) / dayMillisecond;
146
153
  item.dayNumber = days >= 1 ? days + 1 : 1;
147
154
  if (props.modes.includes("timeline")) {
@@ -158,19 +165,20 @@ const handleEvents = ({ props, state }) => () => {
158
165
  function splitEvent(props, event) {
159
166
  const result = [];
160
167
  const startDay = new Date(event.startDay);
161
- const day = startDay.getDate();
168
+ const dayMillisecond = 24 * 60 * 60 * 1e3;
162
169
  if (event.dayNumber > 1) {
163
170
  for (let i = 0; i < event.dayNumber; i++) {
164
171
  let copyObj = JSON.parse(JSON.stringify(event));
172
+ let dayStartTimeStamp = new Date(startDay.getTime() + i * dayMillisecond);
165
173
  if (i === 0) {
166
174
  copyObj.realStart = copyObj.start;
167
- copyObj.realEnd = new Date(startDay.setDate(day + i)).setHours(props.dayTimes[1]);
175
+ copyObj.realEnd = new Date(dayStartTimeStamp).setHours(props.dayTimes[1]);
168
176
  } else if (i === event.dayNumber - 1) {
169
- copyObj.realStart = new Date(startDay.setDate(day + i)).setHours(props.dayTimes[0]);
177
+ copyObj.realStart = new Date(dayStartTimeStamp).setHours(props.dayTimes[0]);
170
178
  copyObj.realEnd = copyObj.end;
171
179
  } else {
172
- copyObj.realStart = new Date(startDay.setDate(day + i)).setHours(props.dayTimes[0]);
173
- copyObj.realEnd = new Date(startDay.setDate(day + i)).setHours(props.dayTimes[1]);
180
+ copyObj.realStart = new Date(dayStartTimeStamp).setHours(props.dayTimes[0]);
181
+ copyObj.realEnd = new Date(dayStartTimeStamp).setHours(props.dayTimes[1]);
174
182
  }
175
183
  result.push(copyObj);
176
184
  }
@@ -149,9 +149,12 @@ const initWatch = ({ watch, props, state, emit, api: api2, nextTick }) => {
149
149
  { immediate: true, deep: true }
150
150
  );
151
151
  watch(
152
- () => props.mode,
153
- () => {
154
- state.mode = props.mode;
152
+ () => state.mode,
153
+ (val) => {
154
+ emit("mode-change", val);
155
+ if (val === "timeline") {
156
+ api2.getCurWeekEvent();
157
+ }
155
158
  }
156
159
  );
157
160
  watch(
package/cascader/index.js CHANGED
@@ -217,7 +217,7 @@ const handleExpandChange = ({ constants, dispatch, emit, nextTick, state, update
217
217
  dispatch(constants.COMPONENT_NAME.FormItem, constants.EVENT_NAME.FormBlur, [
218
218
  state.multiple ? state.presentText : state.inputValue
219
219
  ]);
220
- updatePopper(state.panel.$parent.$el);
220
+ updatePopper();
221
221
  });
222
222
  emit("expand-change", value);
223
223
  emit("active-item-change", value);
@@ -29,6 +29,10 @@ const confirm = ({ api, emit, defaultValues, selectedOptions, isDisabled, vm })
29
29
  emit("update:modelValue", defaultValues.value.slice());
30
30
  api.close();
31
31
  };
32
+ const clear = ({ api, emit }) => (value) => {
33
+ emit("update:modelValue", value);
34
+ api.close();
35
+ };
32
36
  const columnStyle = ({ props, computed }) => computed(() => {
33
37
  return {
34
38
  height: `${+props.visibleOptionNum * +props.optionHeight}px`,
@@ -36,6 +40,7 @@ const columnStyle = ({ props, computed }) => computed(() => {
36
40
  };
37
41
  });
38
42
  export {
43
+ clear,
39
44
  close,
40
45
  columnStyle,
41
46
  confirm,
@@ -1,10 +1,11 @@
1
1
  import "../chunk-G2ADBYYC.js";
2
- import { watchActionSheetVisible, close, confirm, columnStyle } from "./index";
2
+ import { watchActionSheetVisible, close, confirm, columnStyle, clear } from "./index";
3
3
  import { usePicker } from "./usePicker";
4
4
  const api = [
5
5
  "state",
6
6
  "close",
7
7
  "confirm",
8
+ "clear",
8
9
  "columnsType",
9
10
  "columnsList",
10
11
  "columnFieldNames",
@@ -34,6 +35,7 @@ const renderless = (props, { reactive, computed, watch, ref, toRefs }, { emit, v
34
35
  };
35
36
  Object.assign(api2, {
36
37
  close: close(state),
38
+ clear: clear({ api: api2, emit }),
37
39
  confirm: confirm({ api: api2, emit, props, state, defaultValues, selectedOptions, isDisabled, vm }),
38
40
  watchActionSheetVisible: watchActionSheetVisible({ emit, api: api2, props }),
39
41
  columnsType,
@@ -14,6 +14,23 @@ const getReference = ({ state, props, vm, slots }) => {
14
14
  }
15
15
  return reference;
16
16
  };
17
+ const getReferMaxZIndex = (reference) => {
18
+ if (!reference || !reference.nodeType)
19
+ return;
20
+ let getZIndex = (dom) => parseInt(window.getComputedStyle(dom).zIndex, 10) || 0;
21
+ let max = getZIndex(reference);
22
+ let z;
23
+ do {
24
+ reference = reference.parentNode;
25
+ if (reference) {
26
+ z = getZIndex(reference);
27
+ } else {
28
+ break;
29
+ }
30
+ max = z > max ? z : max;
31
+ } while (reference !== document.body);
32
+ return max + 1 + "";
33
+ };
17
34
  var vue_popper_default = (options) => {
18
35
  const {
19
36
  parent,
@@ -55,6 +72,9 @@ var vue_popper_default = (options) => {
55
72
  popper.style.display = "none";
56
73
  }
57
74
  };
75
+ const nextZIndex = (reference) => {
76
+ return props.zIndex === "relative" ? getReferMaxZIndex(reference) : PopupManager.nextZIndex();
77
+ };
58
78
  const createPopper = (dom) => {
59
79
  if (isServer) {
60
80
  return;
@@ -89,7 +109,7 @@ var vue_popper_default = (options) => {
89
109
  if (typeof options2.onUpdate === "function") {
90
110
  state.popperJS.onUpdate(options2.onUpdate);
91
111
  }
92
- state.popperJS._popper.style.zIndex = PopupManager.nextZIndex().toString();
112
+ state.popperJS._popper.style.zIndex = nextZIndex(state.popperJS._reference);
93
113
  followHide(state.popperJS);
94
114
  on(state.popperElm, "click", stop);
95
115
  };
@@ -101,7 +121,7 @@ var vue_popper_default = (options) => {
101
121
  if (popperJS) {
102
122
  popperJS.update();
103
123
  if (popperJS._popper && popperElmOrTrue !== true) {
104
- popperJS._popper.style.zIndex = PopupManager.nextZIndex().toString();
124
+ popperJS._popper.style.zIndex = nextZIndex(popperJS._reference);
105
125
  followHide(state.popperJS);
106
126
  }
107
127
  } else {
package/common/index.js CHANGED
@@ -109,7 +109,7 @@ const DATE = {
109
109
  Time: "hh:mm",
110
110
  YearMonth: "yyyy-MM"
111
111
  };
112
- const TriggerTypes = "date,datetime,time,time-select,week,month,year,years,yearrange,daterange,monthrange,timerange,datetimerange,dates";
112
+ const TriggerTypes = "date,datetime,time,time-select,week,month,year,years,yearrange,daterange,monthrange,timerange,datetimerange,dates,quarter";
113
113
  const DATEPICKER = {
114
114
  Day: "day",
115
115
  Date: "date",
@@ -147,6 +147,18 @@ const DATEPICKER = {
147
147
  center: "bottom",
148
148
  right: "bottom-end"
149
149
  },
150
+ QuarterMap: {
151
+ 0: 0,
152
+ 1: 3,
153
+ 2: 6,
154
+ 3: 9
155
+ },
156
+ MonthQuarterMap: {
157
+ 0: 1,
158
+ 3: 2,
159
+ 6: 3,
160
+ 9: 4
161
+ },
150
162
  TriggerTypes: TriggerTypes.split(","),
151
163
  DateFormats: {
152
164
  year: "yyyy",
@@ -164,6 +176,7 @@ const DATEPICKER = {
164
176
  },
165
177
  Time: "time",
166
178
  TimeRange: "timerange",
179
+ Quarter: "quarter",
167
180
  IconTime: "icon-time",
168
181
  IconDate: "icon-Calendar",
169
182
  DateRange: "daterange",
@@ -224,7 +237,7 @@ const CASCADER = {
224
237
  PropsHover: "hoverThreshold",
225
238
  MenuConnector: "cascader-menu-"
226
239
  };
227
- const version = "3.14.0";
240
+ const version = "3.15.1";
228
241
  const log = (data, type = "log") => {
229
242
  uLog.logger[type](data);
230
243
  };
package/common/runtime.js CHANGED
@@ -22,7 +22,7 @@ import vuePopup from "./deps/vue-popup";
22
22
  import validate from "./validate";
23
23
  import memorize from "./deps/memorize";
24
24
  import * as common from ".";
25
- const version = "3.14.0";
25
+ const version = "3.15.1";
26
26
  const Renderless = {
27
27
  browser,
28
28
  array,
package/dept/index.js CHANGED
@@ -93,6 +93,7 @@ const getDeptList = ({ api, state, deptState }) => ({ level, value, auto }) => {
93
93
  const selectChange = ({ emit, api, state, deptState }) => ({ level, value }) => {
94
94
  api.resetDeptState(deptState.slice(level + 1, 9));
95
95
  api.setSelectData();
96
+ state.selectChanged = true;
96
97
  const current = formatJudgCofim(deptState);
97
98
  const { hrapprover } = state;
98
99
  if (hrapprover) {
@@ -145,7 +146,13 @@ const confirm = ({ api, props, state }) => () => {
145
146
  }
146
147
  }
147
148
  };
148
- const closeDialog = (emit) => () => emit("close");
149
+ const closeDialog = ({ emit, state, deptState }) => (type) => {
150
+ if (state.selectChanged) {
151
+ state.labels = state.lastLabels;
152
+ deptState.forEach((item, i) => Object.assign(item, state.lastDeptState[i]));
153
+ }
154
+ emit("close", type);
155
+ };
149
156
  const cancel = ({ emit, state, deptState }) => () => {
150
157
  state.labels = state.lastLabels;
151
158
  deptState.forEach((item, i) => Object.assign(item, state.lastDeptState[i]));
package/dept/vue.js CHANGED
@@ -38,6 +38,7 @@ const initState = ({ reactive, computed, parent, props, inject, lastDeptState })
38
38
  display: "",
39
39
  open: false,
40
40
  loading: false,
41
+ selectChanged: false,
41
42
  searchValue: "",
42
43
  searchOptions: [],
43
44
  current: "",
@@ -52,7 +53,7 @@ const initApi = ({ api: api2, state, deptState, emit, $service, props }) => {
52
53
  Object.assign(api2, {
53
54
  state,
54
55
  deptState,
55
- closeDialog: closeDialog(emit),
56
+ closeDialog: closeDialog({ emit, state, deptState }),
56
57
  resetDeptState: resetDeptState(deptState),
57
58
  fetchDept: $service.fetchDept,
58
59
  fetchDeptList: $service.fetchDeptList,
@@ -82,6 +83,14 @@ const renderless = (props, { onBeforeUnmount, reactive, watch, inject, computed
82
83
  const state = initState({ reactive, computed, parent, props, inject, lastDeptState });
83
84
  initApi({ api: api2, state, deptState, emit, $service, props });
84
85
  watch(() => props.modelValue, api2.getDisplay, { immediate: true });
86
+ watch(
87
+ () => state.open,
88
+ (val) => {
89
+ if (!val) {
90
+ state.selectChanged = false;
91
+ }
92
+ }
93
+ );
85
94
  onBeforeUnmount(() => {
86
95
  state.open = false;
87
96
  });
@@ -141,25 +141,25 @@ const handleClose = ({
141
141
  if (!emitEvent(emit, "before-close", api.hide)) {
142
142
  return;
143
143
  }
144
- api.hide();
144
+ api.hide(type);
145
145
  };
146
146
  const hide = ({ api, emit, state, props }) => (cancel) => {
147
147
  if (cancel !== false) {
148
148
  state.emitter.emit("boxclose", props.isFormReset);
149
149
  emit("update:visible", false);
150
150
  emit("change", false);
151
- emit("close");
151
+ emit("close", cancel);
152
152
  state.closed = true;
153
153
  api.hideScrollbar();
154
154
  }
155
155
  };
156
156
  const handleConfirm = ({ api, emit }) => () => {
157
157
  emit("confirm");
158
- api.handleClose();
158
+ api.handleClose("confirm");
159
159
  };
160
160
  const handleCancel = ({ api, emit }) => () => {
161
161
  emit("cancel");
162
- api.handleClose();
162
+ api.handleClose("cancel");
163
163
  };
164
164
  const updatePopper = ({ api, constants }) => () => {
165
165
  api.broadcast(constants.SELECT_DROPDOWN, "updatePopper");
@@ -193,11 +193,17 @@ const closeAllPopover = (parent) => {
193
193
  component.state.visible = false;
194
194
  });
195
195
  };
196
- const handleDrag = ({ parent, props, state, emit }) => (event) => {
196
+ const handleDrag = ({
197
+ parent,
198
+ props,
199
+ state,
200
+ emit,
201
+ vm
202
+ }) => (event) => {
197
203
  if (!props.draggable) {
198
204
  return;
199
205
  }
200
- let modalBoxElem = parent.$el.querySelector(".tiny-dialog-box");
206
+ let modalBoxElem = vm.$refs.dialog;
201
207
  event.preventDefault();
202
208
  let demMousemove = document.onmousemove;
203
209
  let demMouseup = document.onmouseup;
package/dialog-box/vue.js CHANGED
@@ -119,7 +119,7 @@ const initApi = ({
119
119
  afterLeave: afterLeave(emit),
120
120
  hideScrollbar: hideScrollbar(lockScrollClass),
121
121
  showScrollbar: showScrollbar(lockScrollClass),
122
- handleDrag: handleDrag({ parent, props, state, emit })
122
+ handleDrag: handleDrag({ parent, props, state, emit, vm })
123
123
  });
124
124
  };
125
125
  const initWatch = ({ watch, state, api: api2, props }) => {
@@ -43,7 +43,7 @@ const renderless = (props, { reactive, inject }, { dispatch, vm }) => {
43
43
  dataStore2.showContent = false;
44
44
  dispatch("TinyDropdownMenu", "mouseleave-tips", [dataStore2.showContent, dataStore2.itemLabel]);
45
45
  };
46
- const mouseEnter = ({ vm: vm2, dataStore: dataStore2 }) => (e) => {
46
+ const mouseEnter = ({ vm: vm2, dataStore: dataStore2, props: props2 }) => (e) => {
47
47
  const dom = e.target;
48
48
  const text = dom.textContent;
49
49
  const font = window.getComputedStyle(dom).font;
@@ -54,7 +54,7 @@ const renderless = (props, { reactive, inject }, { dispatch, vm }) => {
54
54
  tooltip.state.referenceElm = dom;
55
55
  tooltip.state.popperElm && (tooltip.state.popperElm.style.display = "none");
56
56
  tooltip.doDestroy();
57
- dataStore2.itemLabel = text;
57
+ dataStore2.itemLabel = props2.tooltipContent || text;
58
58
  if (vm2.$refs.level.scrollWidth > vm2.$refs.level.offsetWidth) {
59
59
  dataStore2.showContent = true;
60
60
  }
@@ -88,7 +88,6 @@ const watchFileList = ({ constants, state, props, api }) => (fileList) => {
88
88
  let uploadFiles = fileList && fileList.map((file) => {
89
89
  file.uid = file.uid || Date.now() + state.tempIndex++;
90
90
  file.status = file.status || constants.FILE_STATUS.SUCESS;
91
- file.type = api.getFileSourceType({ file });
92
91
  return file;
93
92
  });
94
93
  if ([constants.LIST_TYPE.PICTURE_SINGLE, constants.LIST_TYPE.DRAG_SINGLE].includes(props.listType)) {
package/grid/utils/dom.js CHANGED
@@ -47,17 +47,34 @@ function getFixedLeft($table, from, column, body, offset) {
47
47
  }
48
48
  return scrollLeft;
49
49
  }
50
+ function computeScrollLeft($table, td) {
51
+ const { tableBody } = $table.$refs;
52
+ const { visibleColumn } = $table;
53
+ const { scrollLeft: bodyLeft, clientWidth: bodyWidth } = tableBody.$el;
54
+ let leftWidth = 0;
55
+ let rightWidth = 0;
56
+ visibleColumn.forEach((column) => {
57
+ if (column.fixed === "left") {
58
+ leftWidth += column.renderWidth;
59
+ } else if (column.fixed === "right") {
60
+ rightWidth += column.renderWidth;
61
+ }
62
+ });
63
+ const tdLeft = td._accumulateRenderWidth || td.offsetLeft + (td.offsetParent ? td.offsetParent.offsetLeft : 0);
64
+ const tdWidth = td._renderWidth || td.clientWidth;
65
+ let scrollLeft;
66
+ if (tdLeft < bodyLeft + leftWidth) {
67
+ scrollLeft = tdLeft - leftWidth;
68
+ } else if (tdLeft + tdWidth > bodyLeft + bodyWidth - rightWidth) {
69
+ scrollLeft = tdLeft + tdWidth - bodyWidth + rightWidth;
70
+ } else {
71
+ scrollLeft = bodyLeft;
72
+ }
73
+ return scrollLeft;
74
+ }
50
75
  function setBodyLeft(body, td, $table, column, move) {
51
76
  const { isLeftArrow, isRightArrow, from } = move || {};
52
- const bodyWidth = body.clientWidth;
53
- const bodySrcollLeft = body.scrollLeft;
54
- const tdOffsetLeft = td.offsetLeft + (td.offsetParent ? td.offsetParent.offsetLeft : 0);
55
- const tdWidth = td.clientWidth;
56
- if (tdOffsetLeft < bodySrcollLeft || tdOffsetLeft > bodySrcollLeft + bodyWidth) {
57
- from !== column && (body.scrollLeft = tdOffsetLeft);
58
- } else if (tdOffsetLeft + tdWidth >= bodyWidth + bodySrcollLeft) {
59
- body.scrollLeft = bodySrcollLeft + tdWidth;
60
- }
77
+ body.scrollLeft = computeScrollLeft($table, td);
61
78
  if (from) {
62
79
  const direction = isLeftArrow ? "left" : isRightArrow ? "right" : null;
63
80
  const fixedDom = $table.elemStore[`${direction}-body-list`];
@@ -92,7 +109,10 @@ const colToVisible = ($table, column, move) => {
92
109
  }
93
110
  scrollLeft += visibleColumn[index].renderWidth;
94
111
  }
95
- gridbodyEl.scrollLeft = scrollLeft;
112
+ gridbodyEl.scrollLeft = computeScrollLeft($table, {
113
+ _accumulateRenderWidth: scrollLeft,
114
+ _renderWidth: column.renderWidth
115
+ });
96
116
  }
97
117
  });
98
118
  };
package/image/index.js CHANGED
@@ -42,6 +42,9 @@ const handleError = ({ state, emit }) => (event) => {
42
42
  state.error = true;
43
43
  emit("error", event);
44
44
  };
45
+ const handleSwitch = ({ emit }) => (index) => {
46
+ emit("change-index", index);
47
+ };
45
48
  const handleLazyLoad = ({ state, api, vm, nextTick }) => () => {
46
49
  if (isInContainer(vm.$el, state._scrollContainer)) {
47
50
  nextTick(() => state.show = true);
@@ -125,6 +128,7 @@ export {
125
128
  handleError,
126
129
  handleLazyLoad,
127
130
  handleLoad,
131
+ handleSwitch,
128
132
  loadImage,
129
133
  mounted,
130
134
  removeLazyLoadListener
package/image/vue.js CHANGED
@@ -14,7 +14,8 @@ import {
14
14
  closeViewer,
15
15
  mounted,
16
16
  deleteHander,
17
- filterImageUrl
17
+ filterImageUrl,
18
+ handleSwitch
18
19
  } from "./index";
19
20
  const api = [
20
21
  "state",
@@ -26,7 +27,8 @@ const api = [
26
27
  "closeViewer",
27
28
  "handleLoad",
28
29
  "handleError",
29
- "deleteHander"
30
+ "deleteHander",
31
+ "handleSwitch"
30
32
  ];
31
33
  const initState = ({
32
34
  reactive,
@@ -78,7 +80,8 @@ const initApi = ({
78
80
  computedGetImageStyle: computedGetImageStyle({ api: api2, props }),
79
81
  addLazyLoadListener: addLazyLoadListener({ api: api2, props, state, vm }),
80
82
  deleteHander: deleteHander(emit),
81
- filterImageUrl: filterImageUrl(props)
83
+ filterImageUrl: filterImageUrl(props),
84
+ handleSwitch: handleSwitch({ emit })
82
85
  });
83
86
  };
84
87
  const initWatch = ({ watch, state, api: api2, props }) => {
@@ -164,7 +164,9 @@ const initWatch = ({ watch, state, api: api2, props, nextTick, vm }) => {
164
164
  watch(
165
165
  () => state.index,
166
166
  (value) => {
167
- api2.reset();
167
+ if (!props.keepStyle) {
168
+ api2.reset();
169
+ }
168
170
  props.onSwitch(value);
169
171
  },
170
172
  { immediate: true }
package/input/index.js CHANGED
@@ -55,7 +55,9 @@ const calcTextareaHeight = ({
55
55
  api,
56
56
  hiddenTextarea,
57
57
  props,
58
- state
58
+ state,
59
+ mode,
60
+ constants
59
61
  }) => (targetElement, minRows = 1, maxRows = null) => {
60
62
  if (!targetElement) {
61
63
  return {
@@ -72,6 +74,9 @@ const calcTextareaHeight = ({
72
74
  hiddenTextarea.value = targetElement.value || targetElement.placeholder || "";
73
75
  let height = hiddenTextarea.scrollHeight;
74
76
  const textareaStyle = {};
77
+ if (mode === "mobile") {
78
+ height = Math.max(hiddenTextarea.scrollHeight, constants.TEXTAREA_HEIGHT_MOBILE);
79
+ }
75
80
  if (boxSizing === STYLE.ContentBox) {
76
81
  height = height - paddingSize;
77
82
  }