@opentiny/vue-renderless 3.9.2 → 3.10.0

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 (198) hide show
  1. package/action-sheet/vue.js +25 -2
  2. package/anchor/index.js +3 -3
  3. package/anchor/vue.js +7 -1
  4. package/area/index.js +4 -4
  5. package/button/vue.js +4 -2
  6. package/button-group/index.js +8 -1
  7. package/button-group/vue.js +5 -10
  8. package/calendar/index.js +14 -14
  9. package/calendar-bar/index.js +3 -3
  10. package/carousel-item/index.js +1 -1
  11. package/cascader/vue.js +1 -1
  12. package/cascader-mobile/index.js +299 -0
  13. package/cascader-mobile/vue.js +102 -0
  14. package/cascader-panel/store.js +3 -1
  15. package/chart-boxplot/index.js +0 -1
  16. package/chart-core/deps/constants.js +20 -2
  17. package/chart-core/index.js +9 -1
  18. package/chart-core/modules/extend.js +14 -1
  19. package/chart-gauge/index.js +3 -1
  20. package/chart-graph/index.js +3 -1
  21. package/chart-map/index.js +11 -1
  22. package/chart-scatter/index.js +10 -2
  23. package/chart-waterfall/index.js +4 -1
  24. package/checkbox/index.js +16 -14
  25. package/checkbox/vue.js +14 -10
  26. package/checkbox-button/vue.js +7 -3
  27. package/column-list-item/vue.js +10 -1
  28. package/common/bigInt.js +4 -11
  29. package/common/date.js +2 -2
  30. package/common/deps/ResizeObserver.js +3 -1
  31. package/common/deps/date-util.js +9 -1
  32. package/common/deps/date.js +18 -5
  33. package/common/deps/fastdom/async.js +41 -0
  34. package/common/deps/fastdom/index.js +9 -0
  35. package/common/deps/fastdom/sandbox.js +53 -0
  36. package/common/deps/fastdom/singleton.js +80 -0
  37. package/common/deps/fullscreen/screenfull.js +16 -2
  38. package/common/deps/memorize.js +3 -3
  39. package/common/deps/popup-manager.js +0 -1
  40. package/common/deps/requestAnimationFrame.js +1 -1
  41. package/common/deps/throttle.js +2 -2
  42. package/common/deps/tree-model/node.js +23 -11
  43. package/common/deps/tree-model/tree-store.js +28 -7
  44. package/common/deps/vue-popper.js +14 -2
  45. package/common/deps/vue-popup.js +16 -23
  46. package/common/index.js +7 -35
  47. package/common/runtime.js +1 -1
  48. package/common/validate/rules/type.js +3 -1
  49. package/credit-card-form/vue.js +2 -2
  50. package/date-panel/index.js +35 -31
  51. package/date-panel/vue.js +12 -12
  52. package/date-picker/index.js +9 -5
  53. package/date-picker/vue.js +20 -8
  54. package/date-picker-mobile/index.js +3 -3
  55. package/date-range/index.js +91 -19
  56. package/date-range/vue.js +19 -11
  57. package/date-table/index.js +39 -6
  58. package/date-table/vue.js +2 -2
  59. package/dept/index.js +1 -1
  60. package/detail-page/vue.js +9 -1
  61. package/dialog-box/index.js +11 -2
  62. package/dialog-box/vue.js +30 -6
  63. package/dialog-select/index.js +27 -5
  64. package/dialog-select/vue.js +11 -4
  65. package/drop-roles/index.js +3 -1
  66. package/dropdown/index.js +28 -7
  67. package/dropdown/vue.js +12 -7
  68. package/dropdown-item/index.js +9 -1
  69. package/dropdown-item/mf.js +3 -3
  70. package/dropdown-item/vue.js +12 -10
  71. package/dropdown-menu/index.js +13 -14
  72. package/dropdown-menu/vue.js +8 -7
  73. package/espace/vue.js +9 -1
  74. package/fall-menu/vue.js +12 -1
  75. package/file-upload/index.js +137 -89
  76. package/file-upload/vue.js +24 -14
  77. package/filter/index.js +1 -1
  78. package/filter/vue.js +1 -3
  79. package/floating-button/index.js +73 -0
  80. package/floating-button/vue.js +35 -0
  81. package/form/index.js +13 -4
  82. package/form/vue.js +7 -2
  83. package/form-item/index.js +4 -1
  84. package/form-item/vue.js +6 -3
  85. package/fullscreen/vue.js +24 -3
  86. package/grid/plugins/exportExcel.js +54 -8
  87. package/grid/static/base/helperGetHGSKeys.js +1 -4
  88. package/grid/utils/common.js +15 -11
  89. package/grid/utils/dom.js +5 -1
  90. package/guide/index.js +2 -3
  91. package/hrapprover/index.js +3 -1
  92. package/index-bar/vue.js +8 -1
  93. package/input/index.js +1 -11
  94. package/input/vue.js +6 -12
  95. package/ip-address/index.js +66 -33
  96. package/ip-address/vue.js +8 -1
  97. package/link-menu/vue.js +22 -2
  98. package/locales/index.js +4 -2
  99. package/logon-user/index.js +3 -1
  100. package/logout/index.js +6 -2
  101. package/milestone/vue.js +1 -1
  102. package/mini-picker/index.js +12 -10
  103. package/mini-picker/vue.js +10 -10
  104. package/modal/index.js +5 -3
  105. package/modal/vue.js +4 -2
  106. package/month-range/index.js +18 -18
  107. package/month-range/vue.js +16 -4
  108. package/month-table/index.js +7 -3
  109. package/multi-select/vue.js +1 -9
  110. package/nav-menu/index.js +33 -4
  111. package/nav-menu/vue.js +9 -1
  112. package/notify/vue.js +12 -1
  113. package/numeric/vue.js +6 -2
  114. package/option/index.js +10 -2
  115. package/option/vue.js +20 -9
  116. package/option-group/index.js +3 -1
  117. package/package.json +2 -1
  118. package/picker/index.js +88 -17
  119. package/picker/vue.js +42 -17
  120. package/picker-column/index.js +6 -6
  121. package/picker-column/vue.js +5 -5
  122. package/popconfirm/vue.js +3 -1
  123. package/popeditor/index.js +55 -13
  124. package/popeditor/vue.js +23 -7
  125. package/popover/vue.js +1 -2
  126. package/popup/vue.js +15 -2
  127. package/progress/index.js +9 -7
  128. package/progress/vue.js +12 -4
  129. package/pull-refresh/vue.js +10 -1
  130. package/query-builder/index.js +9 -0
  131. package/query-builder/vue.js +18 -0
  132. package/radio/vue.js +3 -1
  133. package/radio-button/vue.js +1 -1
  134. package/rate/index.js +8 -2
  135. package/rate/vue.js +27 -4
  136. package/recycle-scroller/index.js +0 -1
  137. package/scrollbar/vue-bar.js +18 -2
  138. package/search/index.js +12 -5
  139. package/search/vue.js +7 -5
  140. package/select/index.js +596 -304
  141. package/select/vue.js +167 -101
  142. package/select-dropdown/vue.js +8 -6
  143. package/select-mobile/index.js +26 -13
  144. package/select-mobile/vue.js +14 -5
  145. package/select-view/index.js +5 -21
  146. package/select-view/vue.js +0 -3
  147. package/selected-box/index.js +3 -1
  148. package/slider/index.js +5 -5
  149. package/slider/vue.js +16 -0
  150. package/slider-button/index.js +41 -0
  151. package/slider-button/vue.js +36 -0
  152. package/slider-button-group/slide-button.js +142 -0
  153. package/slider-button-group/vue.js +52 -0
  154. package/steps/slide-bar.js +0 -1
  155. package/switch/index.js +1 -1
  156. package/switch/vue.js +1 -1
  157. package/tab-bar/index.js +8 -6
  158. package/tab-nav/index.js +19 -13
  159. package/tab-nav/vue.js +10 -9
  160. package/tabs/index.js +21 -17
  161. package/tabs/vue.js +1 -4
  162. package/tag/vue.js +2 -1
  163. package/tag-group/index.js +23 -10
  164. package/tag-group/vue.js +5 -4
  165. package/time/index.js +8 -8
  166. package/time/vue.js +9 -9
  167. package/time-line/index.js +24 -2
  168. package/time-line/vue.js +30 -4
  169. package/time-panel/index.js +2 -2
  170. package/time-panel/vue.js +2 -2
  171. package/time-range/index.js +24 -21
  172. package/time-range/vue.js +26 -16
  173. package/time-spinner/index.js +32 -21
  174. package/time-spinner/vue.js +37 -12
  175. package/timeline-item/index.js +77 -0
  176. package/timeline-item/vue.js +44 -0
  177. package/toggle-menu/vue.js +0 -1
  178. package/tooltip/index.js +11 -12
  179. package/tooltip/vue.js +11 -1
  180. package/top-box/vue.js +13 -1
  181. package/tree/index.js +228 -15
  182. package/tree/vue.js +119 -15
  183. package/tree-menu/index.js +35 -0
  184. package/tree-menu/vue.js +27 -5
  185. package/tree-node/index.js +75 -10
  186. package/tree-node/vue.js +45 -23
  187. package/upload/index.js +90 -49
  188. package/upload/vue.js +22 -10
  189. package/upload-dragger/index.js +4 -3
  190. package/upload-list/index.js +67 -16
  191. package/upload-list/vue.js +26 -9
  192. package/user/index.js +7 -4
  193. package/user-link/index.js +2 -1
  194. package/wizard/index.js +4 -1
  195. package/wizard/vue.js +19 -2
  196. package/year-range/index.js +1 -1
  197. package/year-range/vue.js +3 -3
  198. package/year-table/index.js +2 -2
package/date-range/vue.js CHANGED
@@ -38,7 +38,8 @@ import {
38
38
  setTimeFormat,
39
39
  computerBtnDisabled,
40
40
  computerLabel,
41
- computerEnableYearArrow
41
+ computerEnableYearArrow,
42
+ watchPickerVisible
42
43
  } from "./index";
43
44
  import { nextMonth, extractDateFormat, extractTimeFormat } from "../common/deps/date-util";
44
45
  const api = [
@@ -65,7 +66,7 @@ const api = [
65
66
  "handleDateChange",
66
67
  "handleMaxTimeClose"
67
68
  ];
68
- const initState = ({ reactive, computed, api: api2 }) => {
69
+ const initState = ({ reactive, computed, api: api2, constants }) => {
69
70
  const state = reactive({
70
71
  popperElm: null,
71
72
  popperClass: "",
@@ -74,8 +75,13 @@ const initState = ({ reactive, computed, api: api2 }) => {
74
75
  defaultTime: null,
75
76
  minDate: "",
76
77
  maxDate: "",
77
- leftDate: /* @__PURE__ */ new Date(),
78
- rightDate: nextMonth(/* @__PURE__ */ new Date()),
78
+ shortcutType: "",
79
+ shortcutText: "",
80
+ singleSelect: false,
81
+ minRangeDate: constants.startDate,
82
+ maxRangeDate: constants.endDate,
83
+ leftDate: new Date(),
84
+ rightDate: nextMonth(new Date()),
79
85
  rangeState: { endDate: null, selecting: false, row: null, column: null },
80
86
  showTime: false,
81
87
  format: "",
@@ -118,8 +124,9 @@ const initWatch = ({ watch, state, api: api2 }) => {
118
124
  watch(() => state.value, api2.watchValue);
119
125
  watch(() => state.defaultValue, api2.watchDefault);
120
126
  watch(() => state.showTime, api2.setTimeFormat);
127
+ watch(() => state.visible, api2.watchPickerVisible);
121
128
  };
122
- const initApi = ({ api: api2, state, t, vm, nextTick, refs, emit }) => {
129
+ const initApi = ({ api: api2, state, t, vm, nextTick, emit, constants }) => {
123
130
  Object.assign(api2, {
124
131
  t,
125
132
  state,
@@ -148,7 +155,7 @@ const initApi = ({ api: api2, state, t, vm, nextTick, refs, emit }) => {
148
155
  handleDateChange: handleDateChange({ state, t }),
149
156
  handleTimeChange: handleTimeChange({ state, t, vm }),
150
157
  watchMinDate: watchMinDate({ state, t, vm }),
151
- handleTimeInput: handleTimeInput({ nextTick, refs, state, t }),
158
+ handleTimeInput: handleTimeInput({ state, t }),
152
159
  watchMaxTimePickerVisible: watchMaxTimePickerVisible({ nextTick, state, vm }),
153
160
  watchMinTimePickerVisible: watchMinTimePickerVisible({ nextTick, state, vm }),
154
161
  handleDateInput: handleDateInput({ state, t }),
@@ -159,16 +166,17 @@ const initApi = ({ api: api2, state, t, vm, nextTick, refs, emit }) => {
159
166
  setTimeFormat: setTimeFormat({ nextTick, vm, state }),
160
167
  handleConfirm: handleConfirm({ api: api2, emit, state }),
161
168
  handleRangePick: handleRangePick({ api: api2, state, t }),
162
- handleShortcutClick: handleShortcutClick(api2),
169
+ handleShortcutClick: handleShortcutClick(state, api2),
163
170
  computerBtnDisabled: computerBtnDisabled({ state, api: api2 }),
164
- computerEnableYearArrow: computerEnableYearArrow(state)
171
+ computerEnableYearArrow: computerEnableYearArrow(state),
172
+ watchPickerVisible: watchPickerVisible({ state, constants })
165
173
  });
166
174
  };
167
- const renderless = (props, { computed, reactive, watch, nextTick }, { t, refs, emit: $emit, vm }) => {
175
+ const renderless = (props, { computed, reactive, watch, nextTick }, { t, emit: $emit, vm, constants }) => {
168
176
  const api2 = {};
169
177
  const emit = props.emitter ? props.emitter.emit : $emit;
170
- const state = initState({ reactive, computed, api: api2 });
171
- initApi({ api: api2, state, t, vm, nextTick, refs, emit });
178
+ const state = initState({ reactive, computed, api: api2, constants });
179
+ initApi({ api: api2, state, t, vm, nextTick, emit, constants });
172
180
  initWatch({ watch, state, api: api2 });
173
181
  return api2;
174
182
  };
@@ -1,6 +1,14 @@
1
1
  import "../chunk-PKUHTIDK.js";
2
2
  import { formatDate } from "../common/deps/date-util";
3
- import { getFirstDayOfMonth, getDayCountOfMonth, getWeekNumber, prevDate, nextDate, isDate, clearTime } from "../common/deps/date-util";
3
+ import {
4
+ getFirstDayOfMonth,
5
+ getDayCountOfMonth,
6
+ getWeekNumber,
7
+ prevDate,
8
+ nextDate,
9
+ isDate,
10
+ clearTime
11
+ } from "../common/deps/date-util";
4
12
  import { DATEPICKER } from "../common";
5
13
  const formatJudg = ({ day, offset, j, i, cell, count, dateCountOfLastMonth }) => {
6
14
  const nodfpm = day + offset < 0 ? 7 + day + offset : day + offset;
@@ -50,7 +58,7 @@ const getSelected = ({ props, cell, format, t, cellDate, selectedDate }) => {
50
58
  return selected;
51
59
  };
52
60
  const getCell = ({ state, props }) => (row, i, j) => {
53
- const now = getDateTimestamp(/* @__PURE__ */ new Date());
61
+ const now = getDateTimestamp(new Date());
54
62
  let cell = row[props.showWeekNumber ? j + 1 : j];
55
63
  if (!cell) {
56
64
  cell = {
@@ -98,7 +106,10 @@ const getRows = ({ api, props, state, t, vm }) => () => {
98
106
  const date = new Date(state.year, state.month, 1);
99
107
  let day = getFirstDayOfMonth(date);
100
108
  const dateCountOfMonth = getDayCountOfMonth(date.getFullYear(), date.getMonth());
101
- const dateCountOfLastMonth = getDayCountOfMonth(date.getFullYear(), date.getMonth() === 0 ? 11 : date.getMonth() - 1);
109
+ const dateCountOfLastMonth = getDayCountOfMonth(
110
+ date.getFullYear(),
111
+ date.getMonth() === 0 ? 11 : date.getMonth() - 1
112
+ );
102
113
  day = day === 0 ? 7 : day;
103
114
  const offset = state.offsetDay;
104
115
  const rows = state.tableRows;
@@ -107,21 +118,33 @@ const getRows = ({ api, props, state, t, vm }) => () => {
107
118
  const cellClassName = props.cellClassName;
108
119
  const selectedDate = props.selectionMode === DATEPICKER.Dates ? coerceTruthyValueToArray(props.value) : [];
109
120
  let count = 1;
121
+ const isFunction = props.formatWeeks instanceof Function;
122
+ const arr = [];
110
123
  for (let i = 0; i < 6; i++) {
111
124
  const row = rows[i];
112
- if (props.showWeekNumber && !row[0]) {
125
+ if (props.showWeekNumber) {
113
126
  row[0] = {
114
127
  type: DATEPICKER.Week,
115
128
  text: getWeekNumber(nextDate(startDate, i * 7 + 1))
116
129
  };
117
130
  }
131
+ arr[i] = [];
118
132
  for (let j = 0; j < 7; j++) {
119
133
  const { cell, cellDate } = api.getCell(row, i, j, DATEPICKER.Normal, props);
120
134
  count = doCount({ i, day, offset, j, cell, count, dateCountOfLastMonth, dateCountOfMonth });
121
135
  cell.disabled = typeof disabledDate === "function" && disabledDate(cellDate);
122
- cell.selected = getSelected({ props, cell, api, format: DATEPICKER.DateFormats.date, t, cellDate, selectedDate });
136
+ cell.selected = getSelected({
137
+ props,
138
+ cell,
139
+ api,
140
+ format: DATEPICKER.DateFormats.date,
141
+ t,
142
+ cellDate,
143
+ selectedDate
144
+ });
123
145
  cell.customClass = typeof cellClassName === "function" && cellClassName(cellDate);
124
146
  vm.$set(row, props.showWeekNumber ? j + 1 : j, cell);
147
+ arr[i].push(cellDate);
125
148
  }
126
149
  if (props.selectionMode === DATEPICKER.Week) {
127
150
  const [start, end] = props.showWeekNumber ? [1, 7] : [0, 6];
@@ -130,6 +153,16 @@ const getRows = ({ api, props, state, t, vm }) => () => {
130
153
  Object.assign(row[end], { inRange: isWeekActive2, end: isWeekActive2 });
131
154
  }
132
155
  }
156
+ const res = [];
157
+ for (let i = 0; i < arr.length; i++) {
158
+ res.push(arr[i][0].getFullYear() + "/" + (arr[i][0].getMonth() + 1) + "/" + arr[i][0].getDate());
159
+ }
160
+ if (props.showWeekNumber && isFunction) {
161
+ for (let i = 0; i < 6; i++) {
162
+ let val = getWeekNumber(nextDate(startDate, i * 7 + 1));
163
+ rows[i][0].text = props.formatWeeks(val, res);
164
+ }
165
+ }
133
166
  return rows;
134
167
  };
135
168
  const watchMinDate = ({ api, props }) => (value, oldvalue) => {
@@ -297,8 +330,8 @@ const handleClick = ({ api, emit, props, state }) => (event) => {
297
330
  const newDate = api.getDateOfCell(row, column);
298
331
  if (props.selectionMode === DATEPICKER.Range) {
299
332
  if (!props.rangeState.selecting) {
300
- emit("pick", { minDate: newDate, maxDate: null });
301
333
  props.rangeState.selecting = true;
334
+ emit("pick", { minDate: newDate, maxDate: null });
302
335
  } else {
303
336
  if (newDate >= props.minDate) {
304
337
  emit("pick", { minDate: props.minDate, maxDate: newDate });
package/date-table/vue.js CHANGED
@@ -25,9 +25,9 @@ const initState = ({ reactive, computed, api: api2, props }) => {
25
25
  constWeeks: ["sun", "mon", "tue", "wed", "thu", "fri", "sat"],
26
26
  rows: computed(() => api2.getRows()),
27
27
  weeks: computed(() => api2.getWeeks()),
28
- month: computed(() => props.date.getMonth()),
28
+ month: computed(() => !Array.isArray(props.date) && props.date.getMonth()),
29
29
  offsetDay: computed(() => api2.getOffsetDay()),
30
- year: computed(() => props.date.getFullYear()),
30
+ year: computed(() => !Array.isArray(props.date) && props.date.getFullYear()),
31
31
  startDate: computed(() => getStartDateOfMonth(state.year, state.month)),
32
32
  date: props.value
33
33
  });
package/dept/index.js CHANGED
@@ -154,7 +154,7 @@ const cancel = ({ emit, state, deptState }) => () => {
154
154
  };
155
155
  const initService = ({ props, service }) => {
156
156
  const { fetchDeptList, fetchDeptByValue, fetchDept } = service || {};
157
- const noopFnCreator = (propName) => () => Promise.reject(new Error(`[TINY Error][Dept] Prop ${propName} is not configured`));
157
+ const noopFnCreator = (propName) => () => Promise.reject(new Error(`[TINY Error][Dept] Prop ${propName} is mandatory when the framework service is not used`));
158
158
  return {
159
159
  fetchDeptList: props.fetchDeptList || fetchDeptList || noopFnCreator("fetchDeptList"),
160
160
  fetchDeptByValue: props.fetchDeptByValue || fetchDeptByValue || noopFnCreator("fetchDeptByValue"),
@@ -15,7 +15,15 @@ import {
15
15
  computedSetLabelTitle,
16
16
  computedSetDialogTitle
17
17
  } from "./index";
18
- const api = ["state", "valueChange", "showDialog", "closeDialog", "checkAllHander", "saveHandler", "checkValueHiddenItem"];
18
+ const api = [
19
+ "state",
20
+ "valueChange",
21
+ "showDialog",
22
+ "closeDialog",
23
+ "checkAllHander",
24
+ "saveHandler",
25
+ "checkValueHiddenItem"
26
+ ];
19
27
  const initState = ({ reactive, computed, api: api2, props }) => {
20
28
  const state = reactive({
21
29
  value: props.modelValue,
@@ -26,7 +26,15 @@ const computedStyle = ({ props, state }) => () => {
26
26
  }
27
27
  return style;
28
28
  };
29
- const watchVisible = ({ api, constants, emit, nextTick, parent, props, refs, state }) => (val) => {
29
+ const computedBodyStyle = ({ props }) => () => {
30
+ const style = {};
31
+ let { maxHeight } = props;
32
+ if (maxHeight) {
33
+ style.maxHeight = "none";
34
+ }
35
+ return style;
36
+ };
37
+ const watchVisible = ({ api, constants, emit, nextTick, parent, props, vm, state }) => (val) => {
30
38
  const el = parent.$el;
31
39
  if (props.lockScroll) {
32
40
  val ? api.showScrollbar() : api.hideScrollbar();
@@ -39,7 +47,7 @@ const watchVisible = ({ api, constants, emit, nextTick, parent, props, refs, sta
39
47
  emit("open");
40
48
  on(el, "scroll", api.updatePopper);
41
49
  nextTick(() => {
42
- refs.dialog.scrollTop = 0;
50
+ vm.$refs.dialog.scrollTop = 0;
43
51
  });
44
52
  if (props.appendToBody) {
45
53
  document.body.appendChild(el);
@@ -196,6 +204,7 @@ export {
196
204
  afterLeave,
197
205
  computedAddUnit,
198
206
  computedAnimationName,
207
+ computedBodyStyle,
199
208
  computedStyle,
200
209
  handleCancel,
201
210
  handleClose,
package/dialog-box/vue.js CHANGED
@@ -17,10 +17,20 @@ import {
17
17
  updatePopper,
18
18
  handleDrag,
19
19
  showScrollbar,
20
- hideScrollbar
20
+ hideScrollbar,
21
+ computedBodyStyle
21
22
  } from "./index";
22
23
  import usePopup from "../common/deps/vue-popup";
23
- const api = ["afterEnter", "afterLeave", "handleClose", "handleWrapperClick", "handleCancel", "handleConfirm", "handleDrag", "state"];
24
+ const api = [
25
+ "afterEnter",
26
+ "afterLeave",
27
+ "handleClose",
28
+ "handleWrapperClick",
29
+ "handleCancel",
30
+ "handleConfirm",
31
+ "handleDrag",
32
+ "state"
33
+ ];
24
34
  const initState = ({ reactive, computed, api: api2, emitter, props }) => {
25
35
  const state = reactive({
26
36
  emitter: emitter(),
@@ -35,6 +45,7 @@ const initState = ({ reactive, computed, api: api2, emitter, props }) => {
35
45
  dragable: null,
36
46
  isFull: props.fullscreen,
37
47
  style: computed(() => api2.computedStyle()),
48
+ bodyStyle: computed(() => api2.computedBodyStyle()),
38
49
  animationName: computed(() => api2.computedAnimationName())
39
50
  });
40
51
  return state;
@@ -50,7 +61,19 @@ const mergeState = ({ reactive, state, toRefs, usePopups }) => {
50
61
  }, toRefs(state)));
51
62
  return merge;
52
63
  };
53
- const initApi = ({ emit, api: api2, state, parent, props, lockScrollClass, constants, usePopups, nextTick, refs, broadcast }) => {
64
+ const initApi = ({
65
+ emit,
66
+ api: api2,
67
+ state,
68
+ parent,
69
+ props,
70
+ lockScrollClass,
71
+ constants,
72
+ usePopups,
73
+ nextTick,
74
+ broadcast,
75
+ vm
76
+ }) => {
54
77
  const { open, close, doOpen, doClose } = usePopups;
55
78
  const { doAfterOpen, doAfterClose, restoreBodyStyle } = usePopups;
56
79
  Object.assign(api2, {
@@ -76,10 +99,11 @@ const initApi = ({ emit, api: api2, state, parent, props, lockScrollClass, const
76
99
  nextTick,
77
100
  parent,
78
101
  props,
79
- refs,
102
+ vm,
80
103
  state
81
104
  }),
82
105
  computedStyle: computedStyle({ state, props }),
106
+ computedBodyStyle: computedBodyStyle({ props }),
83
107
  mounted: mounted({ api: api2, parent, props }),
84
108
  unMounted: unMounted({ api: api2, parent, props }),
85
109
  computedAnimationName: computedAnimationName({ constants, props }),
@@ -99,7 +123,7 @@ const initWatch = ({ watch, state, api: api2, props }) => {
99
123
  }
100
124
  );
101
125
  };
102
- const renderless = (props, { computed, onBeforeUnmount, onMounted, toRefs, reactive, watch }, { vm, emitter, parent, emit, constants, nextTick, refs, mode, broadcast }) => {
126
+ const renderless = (props, { computed, onBeforeUnmount, onMounted, toRefs, reactive, watch }, { vm, emitter, parent, emit, constants, nextTick, mode, broadcast }) => {
103
127
  const api2 = {};
104
128
  const lockScrollClass = constants.scrollLockClass(mode);
105
129
  let state = initState({ reactive, computed, api: api2, emitter, props });
@@ -125,7 +149,7 @@ const renderless = (props, { computed, onBeforeUnmount, onMounted, toRefs, react
125
149
  usePopups,
126
150
  lockScrollClass,
127
151
  nextTick,
128
- refs,
152
+ vm,
129
153
  broadcast
130
154
  });
131
155
  state = mergeState({ reactive, state, toRefs, usePopups });
@@ -27,13 +27,18 @@ const queryGridData = ({ api, props, state }) => () => {
27
27
  if (popseletor === "grid") {
28
28
  if (typeof remoteSearch === "function") {
29
29
  state.multiGridStore.loading = true;
30
+ state.temporary.final = true;
31
+ const onFinally = () => {
32
+ if (state.temporary.final) {
33
+ state.temporary.final = false;
34
+ state.multiGridStore.loading = false;
35
+ state.multiGridStore.inited = true;
36
+ }
37
+ };
30
38
  remoteSearch().then(() => {
31
39
  state.multiGridStore.loading = false;
32
40
  api.setChecked();
33
- }).finally(() => {
34
- state.multiGridStore.loading = false;
35
- state.multiGridStore.inited = true;
36
- });
41
+ }).then(onFinally).catch(onFinally);
37
42
  } else {
38
43
  state.multiGridStore.inited = true;
39
44
  }
@@ -318,6 +323,22 @@ const multiGridRadioChange = ({ props, state }) => ({ row }) => {
318
323
  state.selectedDatas = [row];
319
324
  state.selectedChanged = true;
320
325
  };
326
+ const watchMulti = ({ api, state, props }) => () => {
327
+ state.splitValue = props.multi ? 0.7 : 1;
328
+ state.selectedChanged = false;
329
+ state.selectedDatas = [];
330
+ state.selectedValues = [];
331
+ state.multiGridStore.inited = false;
332
+ state.multiGridStore.loading = false;
333
+ state.multiTreeStore.viewType = "tree";
334
+ state.multiTreeStore.expandedKeys = [];
335
+ state.multiTreeStore.checkedKeys = [];
336
+ state.multiTreeStore.highlight = null;
337
+ state.multiTreeStore.filterText = "";
338
+ state.multiTreeStore.inited = false;
339
+ state.lookupStore.datas = [];
340
+ api.doAutoLookup();
341
+ };
321
342
  export {
322
343
  computedConfig,
323
344
  computedGridColumns,
@@ -341,5 +362,6 @@ export {
341
362
  selectedBoxDelete,
342
363
  selectedBoxDrag,
343
364
  selectedBoxInit,
344
- setChecked
365
+ setChecked,
366
+ watchMulti
345
367
  };
@@ -22,7 +22,8 @@ import {
22
22
  computedConfig,
23
23
  doAutoLookup,
24
24
  multiTreeRadio,
25
- multiGridRadioChange
25
+ multiGridRadioChange,
26
+ watchMulti
26
27
  } from "./index";
27
28
  const api = [
28
29
  "state",
@@ -46,7 +47,7 @@ const api = [
46
47
  ];
47
48
  const renderless = (props, { reactive, computed, watch }, { vm, nextTick, emit }) => {
48
49
  const state = reactive({
49
- splitValue: props.multi ? 0.7 : 1,
50
+ splitValue: 0,
50
51
  gridColumns: computed(() => api2.computedGridColumns()),
51
52
  selectedChanged: false,
52
53
  selectedDatas: [],
@@ -69,6 +70,7 @@ const renderless = (props, { reactive, computed, watch }, { vm, nextTick, emit }
69
70
  datas: []
70
71
  }
71
72
  });
73
+ state.temporary = {};
72
74
  const api2 = {
73
75
  state,
74
76
  computedGridColumns: computedGridColumns(props),
@@ -95,13 +97,18 @@ const renderless = (props, { reactive, computed, watch }, { vm, nextTick, emit }
95
97
  onFooterConfirm: onFooterConfirm({ api: api2, props }),
96
98
  queryGridData: queryGridData({ api: api2, props, state }),
97
99
  setChecked: setChecked({ api: api2, props, state }),
98
- multiTreeRadio: multiTreeRadio({ api: api2, props })
100
+ multiTreeRadio: multiTreeRadio({ api: api2, props }),
101
+ watchMulti: watchMulti({ api: api2, state, props })
99
102
  });
100
103
  watch(
101
104
  () => props.visible,
102
105
  (value) => value && !state.multiGridStore.inited && api2.queryGridData()
103
106
  );
104
- api2.doAutoLookup();
107
+ watch(
108
+ () => props.multi,
109
+ () => api2.watchMulti(),
110
+ { immediate: true }
111
+ );
105
112
  return api2;
106
113
  };
107
114
  export {
@@ -34,7 +34,9 @@ const change = (emit) => (value) => {
34
34
  const initService = ({ props, service }) => {
35
35
  const { setting = {}, fetchRole, fetchCurrentRole } = service || {};
36
36
  const { options = {} } = setting;
37
- const noopFnCreator = (propName) => () => Promise.reject(new Error(`[TINY Error][DropRoles] Prop ${propName} is not configured`));
37
+ const noopFnCreator = (propName) => () => Promise.reject(
38
+ new Error(`[TINY Error][DropRoles] Prop ${propName} is mandatory when the framework service is not used`)
39
+ );
38
40
  const defaultDropRolesSetting = {
39
41
  textField: "roleName",
40
42
  valueField: "roleId"
package/dropdown/index.js CHANGED
@@ -102,7 +102,7 @@ const initAria = ({ state, props }) => () => {
102
102
  state.dropdownElm.setAttribute("id", state.listId);
103
103
  state.triggerElm.setAttribute("aria-haspopup", "list");
104
104
  state.triggerElm.setAttribute("aria-controls", state.listId);
105
- if (!props.splitButton) {
105
+ if (!props.splitButton || !props.singleButton) {
106
106
  state.triggerElm.setAttribute("role", "button");
107
107
  state.triggerElm.setAttribute("tabindex", props.tabindex);
108
108
  addClass(state.triggerElm, "tiny-dropdown-selfdefine");
@@ -111,11 +111,12 @@ const initAria = ({ state, props }) => () => {
111
111
  const toggleFocus = ({ state, value }) => () => {
112
112
  state.focusing = value;
113
113
  };
114
- const initEvent = ({ api, props, state, vm }) => () => {
115
- state.triggerElm = props.splitButton ? vm.$refs.trigger.$el : vm.$refs.trigger;
114
+ const initEvent = ({ api, props, state, vm, mode }) => () => {
115
+ let buttonValue = props.splitButton || props.singleButton;
116
+ state.triggerElm = buttonValue ? vm.$refs.trigger.$el : props.border ? vm.$refs.trigger.$el : vm.$refs.trigger;
116
117
  on(state.triggerElm, "keydown", api.handleTriggerKeyDown);
117
118
  state.dropdownElm.addEventListener("keydown", api.handleItemKeyDown, true);
118
- if (!props.splitButton) {
119
+ if (!props.splitButton || !props.singleButton) {
119
120
  on(state.triggerElm, "focus", toggleFocus({ state, value: true }));
120
121
  on(state.triggerElm, "blur", toggleFocus({ state, value: false }));
121
122
  on(state.triggerElm, "click", toggleFocus({ state, value: false }));
@@ -128,10 +129,16 @@ const initEvent = ({ api, props, state, vm }) => () => {
128
129
  } else if (props.trigger === "click") {
129
130
  on(state.triggerElm, "click", api.handleClick);
130
131
  }
132
+ if (mode === "mobile-first") {
133
+ if (props.splitButton || props.singleButton) {
134
+ on(state.triggerElm, "click", api.handleClick);
135
+ }
136
+ }
131
137
  };
132
- const handleMenuItemClick = ({ props, state, emit }) => (itemData, instance) => {
138
+ const handleMenuItemClick = ({ props, state, emit }) => (itemData, instance, isDisabled) => {
139
+ state.isDisabled = isDisabled;
133
140
  if (props.hideOnClick) {
134
- state.visible = false;
141
+ !state.isDisabled && (state.visible = false);
135
142
  }
136
143
  emit("item-click", itemData, instance);
137
144
  };
@@ -149,8 +156,16 @@ const handleMainButtonClick = ({ api, emit }) => (event) => {
149
156
  emit("button-click", event);
150
157
  api.hide();
151
158
  };
152
- const mounted = ({ api, vm }) => () => {
159
+ const mounted = ({ api, vm, state, broadcast }) => () => {
160
+ if (state.showSelfIcon) {
161
+ state.showIcon = false;
162
+ }
153
163
  vm.$on("menu-item-click", api.handleMenuItemClick);
164
+ vm.$on("current-item-click", api.handleMenuItemClick);
165
+ vm.$on("selectedIndex", (selectedIndex) => {
166
+ broadcast("TinyDropdownMenu", "menuselectedIndex", selectedIndex);
167
+ });
168
+ vm.$on("is-disabled", api.clickOutside);
154
169
  };
155
170
  const beforeDistory = ({ api, state }) => () => {
156
171
  if (state.triggerElm) {
@@ -170,8 +185,14 @@ const beforeDistory = ({ api, state }) => () => {
170
185
  state.dropdownElm = null;
171
186
  }
172
187
  };
188
+ const clickOutside = ({ props, api, state }) => (value) => {
189
+ if (props.hideOnClick) {
190
+ state.isDisabled ? value ? api.show() : api.hide() : api.hide();
191
+ }
192
+ };
173
193
  export {
174
194
  beforeDistory,
195
+ clickOutside,
175
196
  handleClick,
176
197
  handleItemKeyDown,
177
198
  handleMainButtonClick,
package/dropdown/vue.js CHANGED
@@ -17,10 +17,11 @@ import {
17
17
  triggerElmFocus,
18
18
  initDomOperation,
19
19
  mounted,
20
- beforeDistory
20
+ beforeDistory,
21
+ clickOutside
21
22
  } from "./index";
22
- const api = ["state", "handleMainButtonClick", "hide", "show", "initDomOperation", "handleClick"];
23
- const renderless = (props, { reactive, watch, provide, onMounted }, { emit, parent, broadcast, vm, nextTick, designConfig }) => {
23
+ const api = ["state", "handleMainButtonClick", "hide", "show", "initDomOperation", "handleClick", "clickOutside"];
24
+ const renderless = (props, { reactive, watch, provide, onMounted }, { emit, parent, broadcast, vm, nextTick, mode, designConfig }) => {
24
25
  const api2 = {};
25
26
  const state = reactive({
26
27
  visible: false,
@@ -31,28 +32,32 @@ const renderless = (props, { reactive, watch, provide, onMounted }, { emit, pare
31
32
  triggerElm: null,
32
33
  dropdownElm: null,
33
34
  listId: `dropdown-menu-${guid()}`,
35
+ showIcon: props.showIcon,
36
+ showSelfIcon: props.showSelfIcon,
37
+ isDisabled: false,
34
38
  designConfig
35
39
  });
36
- provide("dropdown", vm);
40
+ provide("dropdownVm", vm);
37
41
  Object.assign(api2, {
38
42
  state,
39
43
  watchVisible: watchVisible({ broadcast, emit, nextTick }),
40
44
  watchFocusing: watchFocusing({ parent }),
41
45
  show: show({ props, state }),
42
46
  hide: hide({ api: api2, props, state }),
43
- mounted: mounted({ api: api2, vm }),
47
+ mounted: mounted({ api: api2, vm, state, broadcast }),
44
48
  handleClick: handleClick({ api: api2, props, state, emit }),
45
49
  handleTriggerKeyDown: handleTriggerKeyDown({ api: api2, state }),
46
50
  handleItemKeyDown: handleItemKeyDown({ api: api2, props, state }),
47
51
  resetTabindex: resetTabindex({ api: api2 }),
48
52
  removeTabindex: removeTabindex({ state }),
49
53
  initAria: initAria({ state, props }),
50
- initEvent: initEvent({ api: api2, props, state, vm }),
54
+ initEvent: initEvent({ api: api2, props, state, vm, mode }),
51
55
  handleMenuItemClick: handleMenuItemClick({ props, state, emit }),
52
56
  handleMainButtonClick: handleMainButtonClick({ api: api2, emit }),
53
57
  triggerElmFocus: triggerElmFocus({ state }),
54
58
  initDomOperation: initDomOperation({ api: api2, state, vm }),
55
- beforeDistory: beforeDistory({ api: api2, state })
59
+ beforeDistory: beforeDistory({ api: api2, state }),
60
+ clickOutside: clickOutside({ state, props, api: api2 })
56
61
  });
57
62
  watch(() => state.visible, api2.watchVisible);
58
63
  watch(() => state.focusing, api2.watchFocusing);
@@ -91,13 +91,20 @@ const clickOutside = (parent) => () => {
91
91
  };
92
92
  const handleClick = ({ props, dispatch, vm, emit }) => (event) => {
93
93
  event.stopPropagation();
94
- const data = { itemData: props.itemData, vm };
94
+ const data = { itemData: props.itemData, vm, disabled: props.disabled };
95
95
  emit("item-click", data);
96
96
  dispatch("TinyDropdown", "menu-item-click", data);
97
+ dispatch("TinyDropdown", "is-disabled", [props.disabled]);
97
98
  };
98
99
  const computedGetIcon = ({ constants, designConfig }) => (name = "leftWardArrow") => {
99
100
  return (designConfig == null ? void 0 : designConfig.icons[name]) || (constants == null ? void 0 : constants.ICON_MAP[name]);
100
101
  };
102
+ const getTip = ({ props, vm }) => {
103
+ if (props.tip && typeof props.tip === "function") {
104
+ return props.tip({ itemData: props.itemData, vm });
105
+ }
106
+ return props.tip || "";
107
+ };
101
108
  export {
102
109
  bindScroll,
103
110
  clickItem,
@@ -109,6 +116,7 @@ export {
109
116
  confirm,
110
117
  getItemStyle,
111
118
  getOptionStyle,
119
+ getTip,
112
120
  getTitle,
113
121
  handleClick,
114
122
  onScroll,
@@ -3,7 +3,7 @@ import { omitText } from "../common/string";
3
3
  const api = ["dataStore", "handleClick", "dataStore", "mouseEnter", "mouseLeave"];
4
4
  const renderless = (props, { reactive, inject }, { dispatch, vm }) => {
5
5
  const api2 = {};
6
- const dropdownMenuVm = inject("dropdownMenu");
6
+ const dropdownMenuVm = inject("dropdownMenuVm");
7
7
  const multiStage = inject("multiStage");
8
8
  let dataStore = reactive({
9
9
  checkedStatus: dropdownMenuVm.checkedStatus,
@@ -22,7 +22,6 @@ const renderless = (props, { reactive, inject }, { dispatch, vm }) => {
22
22
  const handleClick = ({ dataStore: dataStore2, props: props2, vm: vm2 }) => () => {
23
23
  if (props2.disabled) {
24
24
  dataStore2.checkedStatus = false;
25
- return;
26
25
  }
27
26
  dataStore2.itemData = props2.itemData;
28
27
  dataStore2.itemLabel = "";
@@ -38,8 +37,9 @@ const renderless = (props, { reactive, inject }, { dispatch, vm }) => {
38
37
  vm2,
39
38
  dataStore2.itemLabel,
40
39
  dataStore2.showContent,
41
- dataStore2.currentIndex
40
+ props2.disabled
42
41
  ]);
42
+ dispatch("TinyDropdown", "is-disabled", [props2.disabled]);
43
43
  };
44
44
  const mouseLeave = ({ dataStore: dataStore2 }) => () => {
45
45
  dataStore2.itemLabel = "";