@opentiny/vue-renderless 3.12.1 → 3.13.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 (60) hide show
  1. package/alert/index.js +50 -1
  2. package/alert/vue.js +36 -9
  3. package/calendar-bar/index.js +2 -2
  4. package/calendar-view/index.js +5 -11
  5. package/calendar-view/vue.js +1 -1
  6. package/cascader/index.js +3 -2
  7. package/cascader-mobile/index.js +1 -1
  8. package/cascader-mobile/vue.js +1 -1
  9. package/cascader-view/index.js +1 -1
  10. package/checkbox/vue.js +1 -0
  11. package/checkbox-group/vue.js +1 -0
  12. package/col/vue.js +3 -2
  13. package/common/date.js +2 -0
  14. package/common/deps/popper.js +42 -3
  15. package/common/index.js +1 -1
  16. package/common/runtime.js +1 -1
  17. package/container/index.js +17 -1
  18. package/container/vue.js +12 -3
  19. package/dropdown-item/vue.js +1 -1
  20. package/grid/utils/common.js +10 -5
  21. package/input/index.js +8 -2
  22. package/input/vue.js +13 -8
  23. package/label/index.js +56 -0
  24. package/label/vue.js +26 -0
  25. package/mask/index.js +13 -0
  26. package/mask/vue.js +18 -0
  27. package/numeric/index.js +13 -3
  28. package/numeric/vue.js +6 -1
  29. package/option/index.js +1 -2
  30. package/option/vue.js +7 -1
  31. package/package.json +1 -1
  32. package/pager/index.js +358 -0
  33. package/pager/vue.js +114 -2
  34. package/picker/index.js +1 -1
  35. package/pop-upload/index.js +0 -2
  36. package/pop-upload/vue.js +0 -4
  37. package/pull-refresh/index.js +55 -63
  38. package/pull-refresh/vue.js +20 -7
  39. package/select/index.js +11 -3
  40. package/select/vue.js +5 -4
  41. package/slider/index.js +27 -3
  42. package/slider/vue.js +26 -6
  43. package/tag/vue.js +5 -1
  44. package/tall-storage/index.js +4 -5
  45. package/types/action-menu.type.d.ts +5 -0
  46. package/types/alert.type.d.ts +16 -1
  47. package/types/button.type.d.ts +1 -0
  48. package/types/checkbox.type.d.ts +3 -0
  49. package/types/date-picker.type.d.ts +1 -1
  50. package/types/{dropdown-item.type-bf83e929.d.ts → dropdown-item.type-8ea6c633.d.ts} +1 -1
  51. package/types/dropdown-item.type.d.ts +1 -1
  52. package/types/dropdown-menu.type.d.ts +1 -1
  53. package/types/dropdown.type.d.ts +1 -0
  54. package/types/input.type.d.ts +21 -3
  55. package/types/label.type.d.ts +81 -0
  56. package/types/numeric.type.d.ts +1 -1
  57. package/types/pager.type.d.ts +159 -1
  58. package/types/slider.type.d.ts +8 -0
  59. package/types/tab-item.type.d.ts +0 -1
  60. package/types/tag.type.d.ts +12 -0
package/alert/index.js CHANGED
@@ -1,4 +1,33 @@
1
1
  import "../chunk-G2ADBYYC.js";
2
+ const ALERT_TIMEOUT = 2e3;
3
+ const watchAutoHide = ({ api, props }) => (newVal) => {
4
+ if (props.autoHide && newVal) {
5
+ const timer = setTimeout(() => {
6
+ api.handleClose();
7
+ clearTimeout(timer);
8
+ }, ALERT_TIMEOUT);
9
+ }
10
+ };
11
+ const computedClass = ({ props, mode }) => () => {
12
+ const { type, size, center } = props;
13
+ if (mode === "mobile") {
14
+ const alertClass = ["tiny-mobile-alert", "tiny-mobile-alert--" + type, "tiny-mobile-alert--" + size];
15
+ if (center) {
16
+ alertClass.push("is-center");
17
+ }
18
+ return alertClass;
19
+ }
20
+ return [];
21
+ };
22
+ const computedStyle = ({ props, mode }) => () => {
23
+ if (mode === "mobile") {
24
+ const style = {
25
+ top: isNaN(props.offset) ? props.offset : `${props.offset}px`
26
+ };
27
+ return style;
28
+ }
29
+ return null;
30
+ };
2
31
  const handleClose = ({ emit, state }) => () => {
3
32
  state.show = false;
4
33
  emit("close");
@@ -26,9 +55,29 @@ const handleHeaderClick = ({ state, props, vm }) => () => {
26
55
  }
27
56
  }
28
57
  };
58
+ const getEl = (node) => {
59
+ return node.$el || node;
60
+ };
61
+ const handlerTargetNode = ({ props, parent, vm, nextTick }) => () => {
62
+ const { target } = props;
63
+ const { $parent } = parent;
64
+ nextTick(() => {
65
+ const alertParentNode = $parent == null ? void 0 : $parent.$refs[target];
66
+ if (!target || !alertParentNode) {
67
+ return;
68
+ }
69
+ const targetNode = Array.isArray(alertParentNode) ? alertParentNode[0] : alertParentNode;
70
+ getEl(targetNode).insertBefore(vm.$el, getEl(targetNode).firstChild);
71
+ });
72
+ };
29
73
  export {
74
+ ALERT_TIMEOUT,
75
+ computedClass,
30
76
  computedGetIcon,
31
77
  computedGetTitle,
78
+ computedStyle,
32
79
  handleClose,
33
- handleHeaderClick
80
+ handleHeaderClick,
81
+ handlerTargetNode,
82
+ watchAutoHide
34
83
  };
package/alert/vue.js CHANGED
@@ -1,24 +1,51 @@
1
1
  import "../chunk-G2ADBYYC.js";
2
- import { handleClose, computedGetIcon, computedGetTitle, handleHeaderClick } from "./index";
2
+ import {
3
+ computedGetIcon,
4
+ computedGetTitle,
5
+ computedStyle,
6
+ computedClass,
7
+ handleClose,
8
+ handleHeaderClick,
9
+ watchAutoHide,
10
+ handlerTargetNode
11
+ } from "./index";
3
12
  const api = ["handleClose", "state", "handleHeaderClick"];
4
- const renderless = (props, { computed, reactive }, { t, emit, constants, vm, designConfig }) => {
5
- const state = reactive({
13
+ const initState = ({ api: api2, computed, constants, reactive }) => {
14
+ return reactive({
6
15
  show: true,
7
- getIcon: computed(() => api2.computedGetIcon()),
8
- getTitle: computed(() => api2.computedGetTitle()),
9
16
  contentVisible: false,
10
17
  contentDescribeHeight: 0,
11
18
  contentDefaultHeight: 0,
12
19
  contentMaxHeight: constants.CONTENT_MAXHEUGHT,
13
- scrollStatus: false
20
+ scrollStatus: false,
21
+ getIcon: computed(() => api2.computedGetIcon()),
22
+ getTitle: computed(() => api2.computedGetTitle()),
23
+ alertClass: computed(() => api2.computedClass()),
24
+ alertStyle: computed(() => api2.computedStyle())
14
25
  });
15
- const api2 = {
26
+ };
27
+ const initApi = ({ api: api2, state, constants, props, designConfig, t, emit, vm, parent, nextTick, mode }) => {
28
+ Object.assign(api2, {
16
29
  state,
17
30
  computedGetIcon: computedGetIcon({ constants, props, designConfig }),
18
31
  computedGetTitle: computedGetTitle({ constants, props, t }),
32
+ computedClass: computedClass({ props, mode }),
33
+ computedStyle: computedStyle({ props, mode }),
19
34
  handleClose: handleClose({ emit, state }),
20
- handleHeaderClick: handleHeaderClick({ state, props, vm })
21
- };
35
+ handleHeaderClick: handleHeaderClick({ state, props, vm }),
36
+ watchAutoHide: watchAutoHide({ api: api2, props }),
37
+ handlerTargetNode: handlerTargetNode({ props, parent, vm, nextTick })
38
+ });
39
+ };
40
+ const initWatcher = ({ watch, props, api: api2 }) => {
41
+ watch(() => props.autoHide, api2.watchAutoHide, { immediate: true });
42
+ watch(() => props.target, api2.handlerTargetNode, { immediate: true });
43
+ };
44
+ const renderless = (props, { computed, reactive, watch }, { t, emit, constants, vm, designConfig, parent, nextTick, mode }) => {
45
+ const api2 = {};
46
+ const state = initState({ api: api2, computed, constants, reactive });
47
+ initApi({ api: api2, state, constants, props, designConfig, t, emit, vm, parent, nextTick, mode });
48
+ initWatcher({ watch, props, api: api2 });
22
49
  return api2;
23
50
  };
24
51
  export {
@@ -53,7 +53,7 @@ const getBuildDay = (args) => (year, month, date) => {
53
53
  };
54
54
  const getPadCalendarDays = ({ calendarDays, buildDay }) => (flag, count, cur) => {
55
55
  const sign = flag === "s" ? -1 : 1;
56
- Array.from({ length: count }).map((v, i) => {
56
+ Array.from({ length: count }).forEach((v, i) => {
57
57
  const d = new Date(cur.getTime() + (i + 1) * sign * 864e5);
58
58
  const year = d.getFullYear();
59
59
  const month = d.getMonth() + 1;
@@ -62,7 +62,7 @@ const getPadCalendarDays = ({ calendarDays, buildDay }) => (flag, count, cur) =>
62
62
  });
63
63
  };
64
64
  const equalArr = (arr1, arr2) => Array.isArray(arr1) && Array.isArray(arr2) && arr1.join(",") === arr2.join(",");
65
- const setDayRow = ({ calendarDays, state }) => calendarDays.map((day, i) => {
65
+ const setDayRow = ({ calendarDays, state }) => calendarDays.forEach((day, i) => {
66
66
  day.row = Math.floor(i / state.dayOfWeek);
67
67
  if (day.isCur) {
68
68
  state.activeRow = day.row;
@@ -1,15 +1,9 @@
1
1
  import {
2
2
  __spreadValues
3
3
  } from "../chunk-G2ADBYYC.js";
4
- import { cloneDeep } from "@opentiny/vue-renderless/chart-core/deps/utils";
5
- import { getDirection } from "@opentiny/vue-renderless/common/deps/touch";
6
- import {
7
- getDays,
8
- lastMonth,
9
- nextMonth,
10
- getCalendar,
11
- transformArray
12
- } from "@opentiny/vue-renderless/common/calendar/calendar";
4
+ import { cloneDeep } from "../chart-core/deps/utils";
5
+ import { getDirection } from "../common/deps/touch";
6
+ import { getDays, lastMonth, nextMonth, getCalendar, transformArray } from "../common/calendar/calendar";
13
7
  const getTime = (date) => new Date(date).getTime();
14
8
  const newSchedule = ({ emit }) => (date) => emit("new-schedule", date);
15
9
  const isShowNewSchedule = ({ props }) => (date) => props.showNewSchedule instanceof Function ? props.showNewSchedule(date) : false;
@@ -230,7 +224,7 @@ const getEventByMonth = ({ state }) => (year, month) => {
230
224
  day: state.weekDays[new Date(date).getDay()],
231
225
  events: []
232
226
  };
233
- state.events.filter((item) => {
227
+ state.events.forEach((item) => {
234
228
  if (eventInThisTime(item, startTime, endTime)) {
235
229
  obj.events.push(item);
236
230
  state.monthEventsLength += 1;
@@ -276,7 +270,7 @@ const getEventByDate = ({ state }) => (date, events) => {
276
270
  const endTime = getTime(date + " " + state.dayEndTime);
277
271
  state.curWeekEvents[date] = [];
278
272
  events ? events = [] : state.curWeekEvents[date] = [];
279
- state.events.filter((item) => {
273
+ state.events.forEach((item) => {
280
274
  if (eventInThisTime(item, startTime, endTime)) {
281
275
  events ? events.push(item) : state.curWeekEvents[date].push(item);
282
276
  }
@@ -40,7 +40,7 @@ import {
40
40
  touchmove,
41
41
  touchend
42
42
  } from "./index";
43
- import throttle from "@opentiny/vue-renderless/common/deps/throttle";
43
+ import throttle from "../common/deps/throttle";
44
44
  const api = [
45
45
  "state",
46
46
  "renderProxy",
package/cascader/index.js CHANGED
@@ -268,7 +268,7 @@ const calcCollapseTags = ({ state, refs, nextTick }) => () => {
268
268
  const collapseTagWidth = tagsLength && parseFloat(collapseTagContentWidth) + parseFloat(marginRight) + parseFloat(marginLeft);
269
269
  const tags = Array.from(content.querySelectorAll(".tiny-tag"));
270
270
  let { total, dom, idx } = { total: collapseTagWidth, dom: null, idx: 0 };
271
- tags.some((tag, index) => {
271
+ tags.forEach((tag, index) => {
272
272
  if (tag !== tagsLength) {
273
273
  const { width: tagContentWidth, marginRight: marginRight2, marginLeft: marginLeft2 } = tag && window.getComputedStyle(tag);
274
274
  total += parseFloat(tagContentWidth) + parseFloat(marginRight2) + parseFloat(marginLeft2);
@@ -399,7 +399,8 @@ const updateStyle = ({ parent, refs, state, updatePopper, nextTick, props }) =>
399
399
  }
400
400
  const tags = $el.querySelector(CASCADER.TagClass);
401
401
  let suggestionPanelEl = null;
402
- if (suggestionPanel && (suggestionPanelEl = suggestionPanel.$el)) {
402
+ if (suggestionPanel) {
403
+ suggestionPanelEl = suggestionPanel.$el;
403
404
  const suggestionList = suggestionPanelEl.querySelector(CASCADER.ListClass);
404
405
  suggestionList.style.minWidth = inputInner.offsetWidth + "px";
405
406
  }
@@ -78,7 +78,7 @@ const selectOption = ({ emit, state, props, api }) => (option) => {
78
78
  option.loading = false;
79
79
  state.loading = false;
80
80
  option.loaded = true;
81
- nodes.map((data) => {
81
+ nodes.forEach((data) => {
82
82
  state.store.append(data, option.data);
83
83
  index = waitLoadList.indexOf(data[valueField]);
84
84
  if (index !== -1) {
@@ -53,7 +53,7 @@ const renderless = (props, { computed, reactive, watch }, { emit, constants }) =
53
53
  options: computed(() => {
54
54
  let arr;
55
55
  let list = [state.rootData];
56
- state.navList.map((option) => {
56
+ state.navList.forEach((option) => {
57
57
  arr = option.childNodes;
58
58
  arr && arr.length && list.push(arr);
59
59
  });
@@ -62,7 +62,7 @@ const nodeExpand = ({ emit, state, props, api }) => (option) => {
62
62
  state.loading = false;
63
63
  option.loading = false;
64
64
  option.loaded = true;
65
- nodes.map((data) => {
65
+ nodes.forEach((data) => {
66
66
  index = -1;
67
67
  state.store.append(data, option.data);
68
68
  waitLoadCheckList.some((item, i) => {
package/checkbox/vue.js CHANGED
@@ -25,6 +25,7 @@ const initState = ({ reactive, computed, parent, api: api2, inject, props }) =>
25
25
  const state = reactive({
26
26
  size: props.size || inject("size", null),
27
27
  vertical: inject("vertical", null),
28
+ iconPosition: props.iconPosition || inject("iconPosition", "center"),
28
29
  focus: false,
29
30
  selfModel: false,
30
31
  showLabel: false,
@@ -19,6 +19,7 @@ const renderless = (props, { computed, reactive, watch, provide }, { dispatch, c
19
19
  );
20
20
  provide("size", props.size);
21
21
  provide("vertical", props.vertical);
22
+ provide("iconPosition", props.iconPosition);
22
23
  return api2;
23
24
  };
24
25
  export {
package/col/vue.js CHANGED
@@ -1,12 +1,13 @@
1
1
  import "../chunk-G2ADBYYC.js";
2
2
  import { setSubitemAttrValue, setGlobalAttrValue, getClassName, getStyle, row } from "./index";
3
3
  const api = ["state"];
4
- const renderless = (props, { computed, reactive }, { parent }) => {
4
+ const renderless = (props, { computed, reactive, inject }, { parent }) => {
5
5
  const api2 = {};
6
6
  const state = reactive({
7
7
  row: computed(() => api2.row()),
8
8
  style: computed(() => api2.getStyle()),
9
- className: computed(() => api2.getClassName())
9
+ className: computed(() => api2.getClassName()),
10
+ layout: inject("layout")
10
11
  });
11
12
  Object.assign(api2, {
12
13
  state,
package/common/date.js CHANGED
@@ -16,6 +16,7 @@ const dateFormatRegs = {
16
16
  "M{1,2}": /M{1,2}/,
17
17
  "d{1,2}": /d{1,2}/,
18
18
  "h{1,2}": /h{1,2}/,
19
+ "H{1,2}": /H{1,2}/,
19
20
  "m{1,2}": /m{1,2}/,
20
21
  "s{1,2}": /s{1,2}/,
21
22
  "S{1,3}": /S{1,3}/,
@@ -272,6 +273,7 @@ const format = function(date, dateFormat = "yyyy/MM/dd hh:mm:ss") {
272
273
  "M{1,2}": date.getMonth() + 1,
273
274
  "d{1,2}": date.getDate(),
274
275
  "h{1,2}": date.getHours(),
276
+ "H{1,2}": date.getHours(),
275
277
  "m{1,2}": date.getMinutes(),
276
278
  "s{1,2}": date.getSeconds(),
277
279
  "S{1,3}": date.getMilliseconds(),
@@ -68,6 +68,22 @@ const isScrollElement = (el) => {
68
68
  const scrollTypes = ["scroll", "auto"];
69
69
  return scrollTypes.includes(getStyleComputedProperty(el, "overflow")) || scrollTypes.includes(getStyleComputedProperty(el, "overflow-x")) || scrollTypes.includes(getStyleComputedProperty(el, "overflow-y"));
70
70
  };
71
+ const getAdjustOffset = (parent) => {
72
+ const placeholder = document.createElement("div");
73
+ setStyle(placeholder, {
74
+ opacity: 0,
75
+ position: "fixed",
76
+ width: 1,
77
+ height: 1,
78
+ top: 0,
79
+ left: 0,
80
+ "z-index": "-99"
81
+ });
82
+ parent.appendChild(placeholder);
83
+ const result = getBoundingClientRect(placeholder);
84
+ parent.removeChild(placeholder);
85
+ return result;
86
+ };
71
87
  const getScrollParent = (el) => {
72
88
  let parent = el.parentNode;
73
89
  if (!parent) {
@@ -84,9 +100,14 @@ const getScrollParent = (el) => {
84
100
  }
85
101
  return getScrollParent(parent);
86
102
  };
87
- const getOffsetRectRelativeToCustomParent = (el, parent, fixed) => {
103
+ const getOffsetRectRelativeToCustomParent = (el, parent, fixed, popper) => {
88
104
  let { top, left, width, height } = getBoundingClientRect(el);
89
105
  if (fixed) {
106
+ if (popper.parentElement) {
107
+ const { top: adjustTop, left: adjustLeft } = getAdjustOffset(popper.parentElement);
108
+ top -= adjustTop;
109
+ left -= adjustLeft;
110
+ }
90
111
  return {
91
112
  top,
92
113
  left,
@@ -161,6 +182,9 @@ const getOffsetRect = (el) => {
161
182
  elementRect.bottom = elementRect.top + elementRect.height;
162
183
  return elementRect;
163
184
  };
185
+ const stopFn = (ev) => {
186
+ ev.stopPropagation();
187
+ };
164
188
  class Popper {
165
189
  constructor(reference, popper, options) {
166
190
  this.modifiers = {};
@@ -192,6 +216,7 @@ class Popper {
192
216
  }
193
217
  update() {
194
218
  let data = { instance: this, styles: {} };
219
+ this.stopEventBubble();
195
220
  this.popperOuterSize = null;
196
221
  data.placement = data._originalPlacement = this._options.placement;
197
222
  data.offsets = this._getRefPopOffsets(this._popper, this._reference, data.placement);
@@ -199,6 +224,15 @@ class Popper {
199
224
  data = this.runModifiers(data, this._options.modifierFns);
200
225
  typeof this.state.updateCallback === "function" && this.state.updateCallback(data);
201
226
  }
227
+ // 阻止popper的mousewheel等事件冒泡。 通过 onxxx 绑定,是为了避免重复绑定事件
228
+ stopEventBubble() {
229
+ if (!this._popper)
230
+ return;
231
+ if (!this._popper.onmousewheel)
232
+ this._popper.onmousewheel = stopFn;
233
+ if (!this._popper.onwheel)
234
+ this._popper.onwheel = stopFn;
235
+ }
202
236
  /** 按顺序执行Modifiers, 如果传入终点modifier,则执行到指定位置 */
203
237
  runModifiers(data, modifiers2, ends) {
204
238
  let modifiersToRun = modifiers2.slice();
@@ -206,7 +240,7 @@ class Popper {
206
240
  if (ends !== void 0) {
207
241
  modifiersToRun = this._options.modifierFns.slice(
208
242
  0,
209
- _options.modifierFns.findIndex((m) => m == ends)
243
+ _options.modifierFns.findIndex((m) => m === ends)
210
244
  );
211
245
  }
212
246
  modifiersToRun.forEach((modifier) => {
@@ -416,7 +450,12 @@ class Popper {
416
450
  placement = placement.split("-")[0];
417
451
  let popperOffsets = { position: this.state.position };
418
452
  let isParentFixed = popperOffsets.position === "fixed";
419
- let referenceOffsets = getOffsetRectRelativeToCustomParent(reference, getOffsetParent(popper), isParentFixed);
453
+ let referenceOffsets = getOffsetRectRelativeToCustomParent(
454
+ reference,
455
+ getOffsetParent(popper),
456
+ isParentFixed,
457
+ popper
458
+ );
420
459
  const { width, height } = this.popperOuterSize ? this.popperOuterSize : this.popperOuterSize = getOuterSizes(popper);
421
460
  if (~["right", "left"].indexOf(placement)) {
422
461
  popperOffsets.top = referenceOffsets.top + referenceOffsets.height / 2 - height / 2;
package/common/index.js CHANGED
@@ -224,7 +224,7 @@ const CASCADER = {
224
224
  PropsHover: "hoverThreshold",
225
225
  MenuConnector: "cascader-menu-"
226
226
  };
227
- const version = "3.12.0";
227
+ const version = "3.13.0";
228
228
  const log = (data, type = "log") => {
229
229
  uLog.logger[type](data);
230
230
  };
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.12.0";
25
+ const version = "3.13.0";
26
26
  const Renderless = {
27
27
  browser,
28
28
  array,
@@ -73,12 +73,28 @@ const computedFooterStyle = ({ constants, props }) => () => {
73
73
  height: transferWidthOrHeight(props.footerHeight)
74
74
  };
75
75
  };
76
+ const computedLeftStyle = ({ constants, props }) => () => {
77
+ return {
78
+ width: transferWidthOrHeight(props.leftWidth)
79
+ };
80
+ };
81
+ const computedShowRight = ({ constants, props }) => () => {
82
+ return props.pattern === constants.DEFAULT ? false : true;
83
+ };
84
+ const computedRightStyle = ({ constants, props }) => () => {
85
+ return {
86
+ width: transferWidthOrHeight(props.rightWidth)
87
+ };
88
+ };
76
89
  export {
77
90
  computedAsideStyle,
78
91
  computedFooterStyle,
79
92
  computedHeaderStyle,
93
+ computedLeftStyle,
80
94
  computedMainStyle,
95
+ computedRightStyle,
81
96
  computedShowAside,
82
97
  computedShowFooter,
83
- computedShowHeader
98
+ computedShowHeader,
99
+ computedShowRight
84
100
  };
package/container/vue.js CHANGED
@@ -6,7 +6,10 @@ import {
6
6
  computedHeaderStyle,
7
7
  computedAsideStyle,
8
8
  computedMainStyle,
9
- computedFooterStyle
9
+ computedFooterStyle,
10
+ computedLeftStyle,
11
+ computedShowRight,
12
+ computedRightStyle
10
13
  } from "./index";
11
14
  const api = ["state"];
12
15
  const renderless = (props, { computed, reactive }, { constants }) => {
@@ -18,7 +21,10 @@ const renderless = (props, { computed, reactive }, { constants }) => {
18
21
  mainStyle: computed(() => api2.computedMainStyle()),
19
22
  asideStyle: computed(() => api2.computedAsideStyle()),
20
23
  headerStyle: computed(() => api2.computedHeaderStyle()),
21
- footerStyle: computed(() => api2.computedFooterStyle())
24
+ footerStyle: computed(() => api2.computedFooterStyle()),
25
+ showRight: computed(() => api2.computedShowRight()),
26
+ leftStyle: computed(() => api2.computedLeftStyle()),
27
+ rightStyle: computed(() => api2.computedRightStyle())
22
28
  });
23
29
  Object.assign(api2, {
24
30
  state,
@@ -28,7 +34,10 @@ const renderless = (props, { computed, reactive }, { constants }) => {
28
34
  computedMainStyle: computedMainStyle({ constants, props }),
29
35
  computedAsideStyle: computedAsideStyle({ constants, props }),
30
36
  computedHeaderStyle: computedHeaderStyle({ constants, props }),
31
- computedFooterStyle: computedFooterStyle({ constants, props })
37
+ computedFooterStyle: computedFooterStyle({ constants, props }),
38
+ computedLeftStyle: computedLeftStyle({ constants, props }),
39
+ computedShowRight: computedShowRight({ constants, props }),
40
+ computedRightStyle: computedRightStyle({ constants, props })
32
41
  });
33
42
  return api2;
34
43
  };
@@ -84,7 +84,7 @@ const initApi = ({ api: api2, state, emit, props, parent, dispatch, vm, constant
84
84
  };
85
85
  const renderless = (props, { computed, reactive, watch, inject }, { parent, emit, vm, dispatch, mode, constants, designConfig }) => {
86
86
  const api2 = {};
87
- const dropdownMenuVm = inject("dropdownMenuVm");
87
+ const dropdownMenuVm = inject("dropdownMenuVm", null);
88
88
  if (mode === "mobile" && dropdownMenuVm) {
89
89
  dropdownMenuVm.state.children = [...dropdownMenuVm.state.children, vm];
90
90
  }
@@ -15,7 +15,11 @@ const getRowid = ($table, row) => {
15
15
  const getColumnList = (columns) => {
16
16
  const result = [];
17
17
  columns.forEach((column) => {
18
- result.push.apply(result, column.children && column.children.length ? getColumnList(column.children) : [column]);
18
+ if (column.children && column.children.length) {
19
+ result.push(...getColumnList(column.children));
20
+ } else {
21
+ result.push(column);
22
+ }
19
23
  });
20
24
  return result;
21
25
  };
@@ -79,9 +83,10 @@ const destroyColumn = ($table, { columnConfig }) => {
79
83
  }
80
84
  $table.collectColumn = $table.collectColumn.slice(0);
81
85
  };
82
- const emitEvent = (vnode, type, args) => {
83
- if (vnode.tableListeners[type]) {
84
- vnode.$emit.apply(vnode, [type].concat(args));
86
+ const emitEvent = (vm, type, args) => {
87
+ if (vm.tableListeners[type]) {
88
+ const params = [].concat(args);
89
+ vm.$emit(type, ...params);
85
90
  }
86
91
  };
87
92
  const assemColumn = ($table, $column, instance) => {
@@ -112,7 +117,7 @@ const getListeners = ($attrs, $listeners) => {
112
117
  Object.keys($attrs).forEach((name) => {
113
118
  const event = $attrs[name];
114
119
  if (regEventPrefix.test(name) && typeof event === "function") {
115
- listeners[name.substr(2).replace(regHyphenate, "-$1").toLowerCase()] = event;
120
+ listeners[name.slice(2).replace(regHyphenate, "-$1").toLowerCase()] = event;
116
121
  }
117
122
  });
118
123
  return listeners;
package/input/index.js CHANGED
@@ -37,6 +37,11 @@ const showBox = (state) => () => {
37
37
  }
38
38
  state.boxVisibility = true;
39
39
  };
40
+ const inputStyle = ({ props }) => () => {
41
+ return {
42
+ textAlign: props.textAlign
43
+ };
44
+ };
40
45
  const calculateNodeStyling = () => (targetElement) => {
41
46
  const style = window.getComputedStyle(targetElement);
42
47
  const boxSizing = style.getPropertyValue(STYLE.BoxSizing);
@@ -95,7 +100,7 @@ const calcTextareaHeight = ({
95
100
  hiddenTextarea = null;
96
101
  return textareaStyle;
97
102
  };
98
- const getInput = (refs) => () => refs.input || refs.textarea;
103
+ const getInput = (vm) => () => vm.$refs.input || vm.$refs.textarea;
99
104
  const blur = (api) => () => api.getInput().blur();
100
105
  const focus = (api) => () => api.getInput().focus();
101
106
  const select = (api) => () => api.getInput().select();
@@ -229,7 +234,7 @@ const watchFormSelect = ({ emit, props, state }) => (value) => {
229
234
  emit("update:modelValue", value);
230
235
  emit("change", value);
231
236
  const filterData = props.selectMenu.length && props.selectMenu.filter((item) => item.id === value).shift();
232
- state.checkedLable = filterData ? filterData.label : "";
237
+ state.checkedLabel = filterData ? filterData.label : "";
233
238
  }
234
239
  };
235
240
  const hasSelection = (api) => () => {
@@ -287,6 +292,7 @@ export {
287
292
  handlePasswordVisible,
288
293
  hasSelection,
289
294
  hiddenPassword,
295
+ inputStyle,
290
296
  resizeTextarea,
291
297
  select,
292
298
  setNativeInputValue,
package/input/vue.js CHANGED
@@ -30,7 +30,8 @@ import {
30
30
  handleEnterDisplayOnlyContent,
31
31
  hiddenPassword,
32
32
  dispatchDisplayedValue,
33
- getDisplayedValue
33
+ getDisplayedValue,
34
+ inputStyle
34
35
  } from "./index";
35
36
  import useStorageBox from "../tall-storage/vue-storage-box";
36
37
  const api = [
@@ -63,7 +64,8 @@ const api = [
63
64
  "isMemoryStorage",
64
65
  "hasSelection",
65
66
  "handleEnterDisplayOnlyContent",
66
- "hiddenPassword"
67
+ "hiddenPassword",
68
+ "inputStyle"
67
69
  ];
68
70
  const initState = ({
69
71
  reactive,
@@ -82,7 +84,7 @@ const initState = ({
82
84
  passwordVisible: false,
83
85
  boxVisibility: false,
84
86
  textareaCalcStyle: {},
85
- checkedLable: "",
87
+ checkedLabel: "",
86
88
  sheetvalue: props.modelValue,
87
89
  inputSize: computed(() => props.size || state.formItemSize),
88
90
  showClear: computed(
@@ -98,8 +100,10 @@ const initState = ({
98
100
  () => props.disabled || (parent.tinyForm || {}).disabled || state.isDisplayOnly || (parent.tinyForm || {}).displayOnly
99
101
  ),
100
102
  validateState: computed(() => parent.formItem ? parent.formItem.validateState : ""),
103
+ inputStyle: computed(() => api2.inputStyle()),
101
104
  textareaStyle: computed(() => __spreadProps(__spreadValues({}, state.textareaCalcStyle), {
102
- resize: props.resize
105
+ resize: props.resize,
106
+ textAlign: props.textAlign
103
107
  })),
104
108
  needStatusIcon: computed(() => parent.tinyForm ? parent.tinyForm.statusIcon : false),
105
109
  showPwdVisible: computed(
@@ -125,7 +129,7 @@ const initApi = ({
125
129
  dispatch,
126
130
  broadcast,
127
131
  emit,
128
- refs,
132
+ vm,
129
133
  props,
130
134
  CLASS_PREFIX,
131
135
  parent
@@ -136,7 +140,7 @@ const initApi = ({
136
140
  broadcast,
137
141
  showBox: showBox(state),
138
142
  clear: clear(emit),
139
- getInput: getInput(refs),
143
+ getInput: getInput(vm),
140
144
  handleChange: handleChange(emit),
141
145
  watchFormSelect: watchFormSelect({ emit, props, state }),
142
146
  calcIconOffset: calcIconOffset({ CLASS_PREFIX, parent }),
@@ -145,7 +149,8 @@ const initApi = ({
145
149
  handleCompositionStart: handleCompositionStart(state),
146
150
  handleCompositionUpdate: handleCompositionUpdate(state),
147
151
  dispatchDisplayedValue: dispatchDisplayedValue({ state, props, dispatch, api: api2 }),
148
- getDisplayedValue: getDisplayedValue({ state, props })
152
+ getDisplayedValue: getDisplayedValue({ state, props }),
153
+ inputStyle: inputStyle({ props })
149
154
  });
150
155
  };
151
156
  const mergeApi = ({
@@ -266,7 +271,7 @@ const renderless = (props, { computed, onMounted, onUpdated, reactive, toRefs, w
266
271
  InputGroup: constants.inputGroupMode(mode)
267
272
  };
268
273
  const state = initState({ reactive, computed, mode, props, parent, constants, api: api2 });
269
- initApi({ api: api2, state, dispatch, broadcast, emit, refs, props, CLASS_PREFIX, parent });
274
+ initApi({ api: api2, state, dispatch, broadcast, emit, refs, props, CLASS_PREFIX, parent, vm });
270
275
  const storages = useStorageBox({ api: api2, props, reactive, toRefs });
271
276
  parent.tinyForm = parent.tinyForm || inject("form", null);
272
277
  mergeApi({ api: api2, storages, componentName, emit, eventName, props, state, nextTick, parent, refs });