naive-ui 2.21.1 → 2.21.2

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 (204) hide show
  1. package/es/_internal/scrollbar/src/ScrollBar.d.ts +1 -0
  2. package/es/_internal/scrollbar/src/ScrollBar.js +9 -4
  3. package/es/_internal/select-menu/src/SelectMenu.d.ts +1 -0
  4. package/es/_internal/selection/src/Selection.d.ts +1 -0
  5. package/es/_styles/common/dark.js +2 -1
  6. package/es/_styles/common/light.d.ts +1 -0
  7. package/es/_styles/common/light.js +1 -1
  8. package/es/alert/src/Alert.d.ts +1 -0
  9. package/es/auto-complete/src/AutoComplete.d.ts +1 -0
  10. package/es/auto-complete/src/AutoComplete.js +4 -1
  11. package/es/calendar/src/Calendar.d.ts +1 -0
  12. package/es/card/src/Card.d.ts +1 -0
  13. package/es/cascader/src/Cascader.d.ts +1 -0
  14. package/es/cascader/src/CascaderOption.d.ts +1 -0
  15. package/es/cascader/src/CascaderSelectMenu.d.ts +1 -0
  16. package/es/cascader/src/CascaderSubmenu.d.ts +1 -0
  17. package/es/checkbox/src/Checkbox.d.ts +1 -0
  18. package/es/collapse/src/Collapse.d.ts +1 -0
  19. package/es/color-picker/src/ColorInputUnit.d.ts +1 -0
  20. package/es/data-table/src/DataTable.d.ts +1 -0
  21. package/es/data-table/src/HeaderButton/FilterButton.d.ts +1 -0
  22. package/es/data-table/src/HeaderButton/FilterMenu.d.ts +2 -1
  23. package/es/data-table/src/TableParts/Body.d.ts +1 -0
  24. package/es/data-table/src/TableParts/Cell.d.ts +2 -0
  25. package/es/data-table/src/TableParts/Header.d.ts +1 -0
  26. package/es/data-table/src/styles/index.cssr.js +2 -2
  27. package/es/data-table/src/use-table-data.js +3 -3
  28. package/es/data-table/styles/light.js +4 -4
  29. package/es/date-picker/src/DatePicker.d.ts +1 -0
  30. package/es/date-picker/src/panel/date.d.ts +2 -1
  31. package/es/date-picker/src/panel/daterange.d.ts +3 -2
  32. package/es/date-picker/src/panel/datetime.d.ts +2 -1
  33. package/es/date-picker/src/panel/datetimerange.d.ts +3 -2
  34. package/es/date-picker/src/panel/month.d.ts +2 -1
  35. package/es/date-picker/src/panel/use-calendar.d.ts +2 -1
  36. package/es/date-picker/src/panel/use-calendar.js +2 -0
  37. package/es/date-picker/src/panel/use-dual-calendar.d.ts +3 -2
  38. package/es/date-picker/src/panel/use-dual-calendar.js +4 -0
  39. package/es/date-picker/src/panel/use-panel-common.d.ts +1 -0
  40. package/es/dialog/src/Dialog.d.ts +1 -0
  41. package/es/drawer/src/Drawer.d.ts +1 -0
  42. package/es/drawer/src/DrawerBodyWrapper.d.ts +1 -0
  43. package/es/drawer/src/DrawerContent.d.ts +1 -0
  44. package/es/dropdown/src/Dropdown.d.ts +6 -5
  45. package/es/dynamic-input/src/DynamicInput.d.ts +1 -0
  46. package/es/dynamic-input/src/InputPreset.d.ts +1 -0
  47. package/es/dynamic-input/src/PairPreset.d.ts +1 -0
  48. package/es/dynamic-tags/src/DynamicTags.d.ts +1 -0
  49. package/es/ellipsis/src/Ellipsis.d.ts +1 -0
  50. package/es/input/src/Input.d.ts +1 -0
  51. package/es/input-number/src/InputNumber.d.ts +35 -0
  52. package/es/input-number/src/InputNumber.js +22 -6
  53. package/es/layout/src/Layout.d.ts +2 -0
  54. package/es/layout/src/LayoutContent.d.ts +1 -0
  55. package/es/layout/src/LayoutSider.d.ts +1 -0
  56. package/es/log/src/Log.d.ts +7 -25
  57. package/es/log/src/Log.js +2 -11
  58. package/es/log/src/LogLine.d.ts +1 -0
  59. package/es/log/src/LogLine.js +12 -10
  60. package/es/mention/src/Mention.d.ts +1 -0
  61. package/es/menu/src/Menu.d.ts +1 -0
  62. package/es/menu/src/MenuOption.d.ts +1 -0
  63. package/es/modal/src/BodyWrapper.d.ts +1 -0
  64. package/es/notification/src/NotificationContainer.d.ts +8 -0
  65. package/es/notification/src/NotificationContainer.js +7 -2
  66. package/es/notification/src/NotificationProvider.d.ts +17 -0
  67. package/es/notification/src/NotificationProvider.js +38 -3
  68. package/es/notification/src/styles/index.cssr.d.ts +2 -1
  69. package/es/notification/src/styles/index.cssr.js +41 -12
  70. package/es/pagination/src/Pagination.d.ts +1 -0
  71. package/es/popconfirm/src/Popconfirm.d.ts +6 -5
  72. package/es/popover/src/Popover.d.ts +6 -6
  73. package/es/popover/src/Popover.js +2 -5
  74. package/es/popover/src/PopoverBody.d.ts +5 -5
  75. package/es/popover/src/PopoverBody.js +2 -1
  76. package/es/popover/src/styles/index.cssr.js +0 -1
  77. package/es/popselect/src/Popselect.d.ts +6 -5
  78. package/es/popselect/src/PopselectPanel.d.ts +1 -0
  79. package/es/select/src/Select.d.ts +1 -0
  80. package/es/slider/src/Slider.d.ts +1 -0
  81. package/es/slider/src/Slider.js +70 -54
  82. package/es/table/styles/light.js +2 -2
  83. package/es/theme-editor/src/ThemeEditor.d.ts +1 -0
  84. package/es/time-picker/src/Panel.d.ts +1 -0
  85. package/es/time-picker/src/TimePicker.d.ts +1 -0
  86. package/es/tooltip/src/Tooltip.d.ts +6 -5
  87. package/es/transfer/src/Transfer.d.ts +1 -0
  88. package/es/transfer/src/TransferFilter.d.ts +1 -0
  89. package/es/transfer/src/TransferList.d.ts +1 -0
  90. package/es/transfer/src/TransferListItem.d.ts +1 -0
  91. package/es/tree/src/Tree.d.ts +1 -0
  92. package/es/tree/src/TreeNodeCheckbox.d.ts +1 -0
  93. package/es/tree-select/src/TreeSelect.d.ts +1 -0
  94. package/es/upload/index.d.ts +1 -2
  95. package/es/upload/src/Upload.d.ts +8 -9
  96. package/es/upload/src/Upload.js +69 -16
  97. package/es/upload/src/UploadFile.d.ts +1 -0
  98. package/es/upload/src/UploadProgress.d.ts +1 -0
  99. package/es/upload/src/interface.d.ts +14 -1
  100. package/es/version.d.ts +1 -1
  101. package/es/version.js +1 -1
  102. package/lib/_internal/scrollbar/src/ScrollBar.d.ts +1 -0
  103. package/lib/_internal/scrollbar/src/ScrollBar.js +9 -4
  104. package/lib/_internal/select-menu/src/SelectMenu.d.ts +1 -0
  105. package/lib/_internal/selection/src/Selection.d.ts +1 -0
  106. package/lib/_styles/common/dark.js +2 -1
  107. package/lib/_styles/common/light.d.ts +1 -0
  108. package/lib/_styles/common/light.js +1 -1
  109. package/lib/alert/src/Alert.d.ts +1 -0
  110. package/lib/auto-complete/src/AutoComplete.d.ts +1 -0
  111. package/lib/auto-complete/src/AutoComplete.js +4 -1
  112. package/lib/calendar/src/Calendar.d.ts +1 -0
  113. package/lib/card/src/Card.d.ts +1 -0
  114. package/lib/cascader/src/Cascader.d.ts +1 -0
  115. package/lib/cascader/src/CascaderOption.d.ts +1 -0
  116. package/lib/cascader/src/CascaderSelectMenu.d.ts +1 -0
  117. package/lib/cascader/src/CascaderSubmenu.d.ts +1 -0
  118. package/lib/checkbox/src/Checkbox.d.ts +1 -0
  119. package/lib/collapse/src/Collapse.d.ts +1 -0
  120. package/lib/color-picker/src/ColorInputUnit.d.ts +1 -0
  121. package/lib/data-table/src/DataTable.d.ts +1 -0
  122. package/lib/data-table/src/HeaderButton/FilterButton.d.ts +1 -0
  123. package/lib/data-table/src/HeaderButton/FilterMenu.d.ts +2 -1
  124. package/lib/data-table/src/TableParts/Body.d.ts +1 -0
  125. package/lib/data-table/src/TableParts/Cell.d.ts +2 -0
  126. package/lib/data-table/src/TableParts/Header.d.ts +1 -0
  127. package/lib/data-table/src/styles/index.cssr.js +2 -2
  128. package/lib/data-table/src/use-table-data.js +3 -3
  129. package/lib/data-table/styles/light.js +4 -4
  130. package/lib/date-picker/src/DatePicker.d.ts +1 -0
  131. package/lib/date-picker/src/panel/date.d.ts +2 -1
  132. package/lib/date-picker/src/panel/daterange.d.ts +3 -2
  133. package/lib/date-picker/src/panel/datetime.d.ts +2 -1
  134. package/lib/date-picker/src/panel/datetimerange.d.ts +3 -2
  135. package/lib/date-picker/src/panel/month.d.ts +2 -1
  136. package/lib/date-picker/src/panel/use-calendar.d.ts +2 -1
  137. package/lib/date-picker/src/panel/use-calendar.js +2 -0
  138. package/lib/date-picker/src/panel/use-dual-calendar.d.ts +3 -2
  139. package/lib/date-picker/src/panel/use-dual-calendar.js +4 -0
  140. package/lib/date-picker/src/panel/use-panel-common.d.ts +1 -0
  141. package/lib/dialog/src/Dialog.d.ts +1 -0
  142. package/lib/drawer/src/Drawer.d.ts +1 -0
  143. package/lib/drawer/src/DrawerBodyWrapper.d.ts +1 -0
  144. package/lib/drawer/src/DrawerContent.d.ts +1 -0
  145. package/lib/dropdown/src/Dropdown.d.ts +6 -5
  146. package/lib/dynamic-input/src/DynamicInput.d.ts +1 -0
  147. package/lib/dynamic-input/src/InputPreset.d.ts +1 -0
  148. package/lib/dynamic-input/src/PairPreset.d.ts +1 -0
  149. package/lib/dynamic-tags/src/DynamicTags.d.ts +1 -0
  150. package/lib/ellipsis/src/Ellipsis.d.ts +1 -0
  151. package/lib/input/src/Input.d.ts +1 -0
  152. package/lib/input-number/src/InputNumber.d.ts +35 -0
  153. package/lib/input-number/src/InputNumber.js +22 -6
  154. package/lib/layout/src/Layout.d.ts +2 -0
  155. package/lib/layout/src/LayoutContent.d.ts +1 -0
  156. package/lib/layout/src/LayoutSider.d.ts +1 -0
  157. package/lib/log/src/Log.d.ts +7 -25
  158. package/lib/log/src/Log.js +2 -11
  159. package/lib/log/src/LogLine.d.ts +1 -0
  160. package/lib/log/src/LogLine.js +11 -9
  161. package/lib/mention/src/Mention.d.ts +1 -0
  162. package/lib/menu/src/Menu.d.ts +1 -0
  163. package/lib/menu/src/MenuOption.d.ts +1 -0
  164. package/lib/modal/src/BodyWrapper.d.ts +1 -0
  165. package/lib/notification/src/NotificationContainer.d.ts +8 -0
  166. package/lib/notification/src/NotificationContainer.js +7 -2
  167. package/lib/notification/src/NotificationProvider.d.ts +17 -0
  168. package/lib/notification/src/NotificationProvider.js +38 -3
  169. package/lib/notification/src/styles/index.cssr.d.ts +2 -1
  170. package/lib/notification/src/styles/index.cssr.js +41 -12
  171. package/lib/pagination/src/Pagination.d.ts +1 -0
  172. package/lib/popconfirm/src/Popconfirm.d.ts +6 -5
  173. package/lib/popover/src/Popover.d.ts +6 -6
  174. package/lib/popover/src/Popover.js +2 -5
  175. package/lib/popover/src/PopoverBody.d.ts +5 -5
  176. package/lib/popover/src/PopoverBody.js +2 -1
  177. package/lib/popover/src/styles/index.cssr.js +0 -1
  178. package/lib/popselect/src/Popselect.d.ts +6 -5
  179. package/lib/popselect/src/PopselectPanel.d.ts +1 -0
  180. package/lib/select/src/Select.d.ts +1 -0
  181. package/lib/slider/src/Slider.d.ts +1 -0
  182. package/lib/slider/src/Slider.js +70 -54
  183. package/lib/table/styles/light.js +2 -2
  184. package/lib/theme-editor/src/ThemeEditor.d.ts +1 -0
  185. package/lib/time-picker/src/Panel.d.ts +1 -0
  186. package/lib/time-picker/src/TimePicker.d.ts +1 -0
  187. package/lib/tooltip/src/Tooltip.d.ts +6 -5
  188. package/lib/transfer/src/Transfer.d.ts +1 -0
  189. package/lib/transfer/src/TransferFilter.d.ts +1 -0
  190. package/lib/transfer/src/TransferList.d.ts +1 -0
  191. package/lib/transfer/src/TransferListItem.d.ts +1 -0
  192. package/lib/tree/src/Tree.d.ts +1 -0
  193. package/lib/tree/src/TreeNodeCheckbox.d.ts +1 -0
  194. package/lib/tree-select/src/TreeSelect.d.ts +1 -0
  195. package/lib/upload/index.d.ts +1 -2
  196. package/lib/upload/src/Upload.d.ts +8 -9
  197. package/lib/upload/src/Upload.js +69 -16
  198. package/lib/upload/src/UploadFile.d.ts +1 -0
  199. package/lib/upload/src/UploadProgress.d.ts +1 -0
  200. package/lib/upload/src/interface.d.ts +14 -1
  201. package/lib/version.d.ts +1 -1
  202. package/lib/version.js +1 -1
  203. package/package.json +4 -3
  204. package/web-types.json +51 -6
@@ -42,9 +42,14 @@ exports.default = (0, vue_1.defineComponent)({
42
42
  setup(props) {
43
43
  const { mergedClsPrefixRef, namespaceRef } = (0, _mixins_1.useConfig)(props);
44
44
  const themeRef = (0, _mixins_1.useTheme)('Slider', 'Slider', index_cssr_1.default, styles_1.sliderLight, props, mergedClsPrefixRef);
45
+ // dom ref
46
+ const handleRailRef = (0, vue_1.ref)(null);
47
+ const [handleRefs, setHandleRefs] = (0, utils_1.useRefs)();
48
+ const [followerRefs, setFollowerRefs] = (0, utils_1.useRefs)();
49
+ const followerEnabledIndexSetRef = (0, vue_1.ref)(new Set());
50
+ // data ref
45
51
  const formItem = (0, _mixins_1.useFormItem)(props);
46
52
  const { mergedDisabledRef } = formItem;
47
- const handleRailRef = (0, vue_1.ref)(null);
48
53
  const precisionRef = (0, vue_1.computed)(() => {
49
54
  const { step } = props;
50
55
  if (step <= 0 || step === 'mark')
@@ -56,8 +61,6 @@ exports.default = (0, vue_1.defineComponent)({
56
61
  }
57
62
  return precision;
58
63
  });
59
- const [handleRefs, setHandleRefs] = (0, utils_1.useRefs)();
60
- const [followerRefs, setFollowerRefs] = (0, utils_1.useRefs)();
61
64
  const uncontrolledValueRef = (0, vue_1.ref)(props.defaultValue);
62
65
  const controlledValueRef = (0, vue_1.toRef)(props, 'value');
63
66
  const mergedValueRef = (0, vooks_1.useMergedState)(controlledValueRef, uncontrolledValueRef);
@@ -77,10 +80,13 @@ exports.default = (0, vue_1.defineComponent)({
77
80
  const { marks } = props;
78
81
  return marks ? Object.keys(marks).map(parseFloat) : null;
79
82
  });
83
+ // status ref
80
84
  const activeIndexRef = (0, vue_1.ref)(-1);
81
85
  const previousIndexRef = (0, vue_1.ref)(-1);
82
86
  const hoverIndexRef = (0, vue_1.ref)(-1);
83
87
  const draggingRef = (0, vue_1.ref)(false);
88
+ // style ref
89
+ const dotTransitionDisabledRef = (0, vue_1.ref)(false);
84
90
  const styleDirectionRef = (0, vue_1.computed)(() => {
85
91
  const { vertical, reverse } = props;
86
92
  const left = reverse ? 'right' : 'left';
@@ -91,20 +97,19 @@ exports.default = (0, vue_1.defineComponent)({
91
97
  if (handleCountExceeds2Ref.value)
92
98
  return;
93
99
  const values = arrifiedValueRef.value;
94
- const start = props.range ? Math.min.apply(null, values) : props.min;
95
- const end = props.range ? Math.max.apply(null, values) : values[0];
100
+ const start = valueToPercentage(props.range ? Math.min(...values) : props.min);
101
+ const end = valueToPercentage(props.range ? Math.max(...values) : values[0]);
96
102
  const { value: styleDirection } = styleDirectionRef;
97
103
  return props.vertical
98
104
  ? {
99
- [styleDirection]: `${valueToPercentage(start)}%`,
100
- height: `${valueToPercentage(end - start)}%`
105
+ [styleDirection]: `${start}%`,
106
+ height: `${end - start}%`
101
107
  }
102
108
  : {
103
- [styleDirection]: `${valueToPercentage(start)}%`,
104
- width: `${valueToPercentage(end - start)}%`
109
+ [styleDirection]: `${start}%`,
110
+ width: `${end - start}%`
105
111
  };
106
112
  });
107
- const dotTransitionDisabledRef = (0, vue_1.ref)(false);
108
113
  const markInfosRef = (0, vue_1.computed)(() => {
109
114
  const mergedMarks = [];
110
115
  const { marks } = props;
@@ -133,6 +138,14 @@ exports.default = (0, vue_1.defineComponent)({
133
138
  }
134
139
  return mergedMarks;
135
140
  });
141
+ function getHandleStyle(value, index) {
142
+ const percentage = valueToPercentage(value);
143
+ const { value: styleDirection } = styleDirectionRef;
144
+ return {
145
+ [styleDirection]: `${percentage}%`,
146
+ zIndex: index === activeIndexRef.value ? 1 : 0
147
+ };
148
+ }
136
149
  function isShowTooltip(index) {
137
150
  return (props.showTooltip ||
138
151
  hoverIndexRef.value === index ||
@@ -154,14 +167,6 @@ exports.default = (0, vue_1.defineComponent)({
154
167
  inst.syncPosition();
155
168
  });
156
169
  }
157
- function getHandleStyle(value, index) {
158
- const percentage = valueToPercentage(value);
159
- const { value: styleDirection } = styleDirectionRef;
160
- return {
161
- [styleDirection]: `${percentage}%`,
162
- zIndex: index === activeIndexRef.value ? 1 : 0
163
- };
164
- }
165
170
  function doUpdateValue(value) {
166
171
  const { 'onUpdate:value': _onUpdateValue, onUpdateValue } = props;
167
172
  const { nTriggerFormInput, nTriggerFormChange } = formItem;
@@ -200,51 +205,39 @@ exports.default = (0, vue_1.defineComponent)({
200
205
  dispatchValueUpdate(value);
201
206
  }
202
207
  }
203
- function getClosestMark(currentValue, markValues = markValuesRef.value, buffer) {
204
- if (markValues) {
205
- let closestMark = null;
206
- let index = -1;
207
- while (++index < markValues.length) {
208
- const diff = markValues[index] - currentValue;
209
- const distance = Math.abs(diff);
210
- if (
211
- // find marks in the same direction
212
- (buffer === undefined || diff * buffer > 0) &&
213
- (closestMark === null || distance < closestMark.distance)) {
214
- closestMark = {
215
- value: markValues[index],
216
- distance,
217
- index
218
- };
219
- }
220
- }
221
- return closestMark;
222
- }
223
- return null;
224
- }
208
+ // value conversion
225
209
  function sanitizeValue(value, currentValue, stepBuffer) {
226
210
  const stepping = stepBuffer !== undefined;
227
211
  if (!stepBuffer) {
228
212
  stepBuffer = value - currentValue > 0 ? 1 : -1;
229
213
  }
230
214
  const markValues = markValuesRef.value || [];
231
- const { min, max, step } = props;
215
+ const { step } = props;
232
216
  if (step === 'mark') {
233
217
  const closestMark = getClosestMark(value, markValues.concat(currentValue), stepping ? stepBuffer : undefined);
234
218
  return closestMark ? closestMark.value : currentValue;
235
219
  }
236
220
  if (step <= 0)
237
221
  return currentValue;
238
- const roundValue = getRoundValue(value);
239
- // ensure accurate step
240
- const stepValue = new Array(Math.floor((max - min) / step) + 1)
241
- .fill('')
242
- .map((_, index) => step * index + min);
243
- // If it is a stepping, priority will be given to the marks
244
- // on the rail,otherwise take the nearest one
245
- const closestMark = stepping
246
- ? getClosestMark(currentValue, stepValue.concat(markValues), stepBuffer)
247
- : getClosestMark(value, markValues.concat(roundValue));
222
+ const { value: precision } = precisionRef;
223
+ let closestMark;
224
+ // if it is a stepping, priority will be given to the marks
225
+ // on the rail, otherwise take the nearest one
226
+ if (stepping) {
227
+ const currentStep = Number((currentValue / step).toFixed(precision));
228
+ const actualStep = Math.floor(currentStep);
229
+ const leftStep = currentStep > actualStep ? actualStep : actualStep - 1;
230
+ const rightStep = currentStep < actualStep ? actualStep : actualStep + 1;
231
+ closestMark = getClosestMark(currentValue, [
232
+ Number((leftStep * step).toFixed(precision)),
233
+ Number((rightStep * step).toFixed(precision)),
234
+ ...markValues
235
+ ], stepBuffer);
236
+ }
237
+ else {
238
+ const roundValue = getRoundValue(value);
239
+ closestMark = getClosestMark(value, [...markValues, roundValue]);
240
+ }
248
241
  return closestMark ? clampValue(closestMark.value) : currentValue;
249
242
  }
250
243
  function clampValue(value) {
@@ -265,6 +258,27 @@ exports.default = (0, vue_1.defineComponent)({
265
258
  const newValue = Math.round((value - min) / step) * step + min;
266
259
  return Number(newValue.toFixed(precisionRef.value));
267
260
  }
261
+ function getClosestMark(currentValue, markValues = markValuesRef.value, buffer) {
262
+ if (!markValues || !markValues.length)
263
+ return null;
264
+ let closestMark = null;
265
+ let index = -1;
266
+ while (++index < markValues.length) {
267
+ const diff = markValues[index] - currentValue;
268
+ const distance = Math.abs(diff);
269
+ if (
270
+ // find marks in the same direction
271
+ (buffer === undefined || diff * buffer > 0) &&
272
+ (closestMark === null || distance < closestMark.distance)) {
273
+ closestMark = {
274
+ index,
275
+ distance,
276
+ value: markValues[index]
277
+ };
278
+ }
279
+ }
280
+ return closestMark;
281
+ }
268
282
  function getPointValue(event) {
269
283
  const railEl = handleRailRef.value;
270
284
  if (!railEl)
@@ -283,6 +297,7 @@ exports.default = (0, vue_1.defineComponent)({
283
297
  }
284
298
  return percentageToValue(percentage);
285
299
  }
300
+ // dom event handle
286
301
  function handleRailKeyDown(e) {
287
302
  if (mergedDisabledRef.value)
288
303
  return;
@@ -395,7 +410,7 @@ exports.default = (0, vue_1.defineComponent)({
395
410
  hoverIndexRef.value = -1;
396
411
  }
397
412
  }
398
- (0, vue_1.watch)(activeIndexRef, (_, previous) => (previousIndexRef.value = previous));
413
+ (0, vue_1.watch)(activeIndexRef, (_, previous) => void (0, vue_1.nextTick)(() => (previousIndexRef.value = previous)));
399
414
  (0, vue_1.watch)(mergedValueRef, () => {
400
415
  if (props.marks) {
401
416
  if (dotTransitionDisabledRef.value)
@@ -427,6 +442,7 @@ exports.default = (0, vue_1.defineComponent)({
427
442
  getHandleStyle,
428
443
  activeIndex: activeIndexRef,
429
444
  arrifiedValues: arrifiedValueRef,
445
+ followerEnabledIndexSet: followerEnabledIndexSetRef,
430
446
  handleRailMouseDown,
431
447
  handleHandleFocus,
432
448
  handleHandleBlur,
@@ -506,8 +522,8 @@ exports.default = (0, vue_1.defineComponent)({
506
522
  (0, vue_1.h)(vueuc_1.VTarget, null, {
507
523
  default: () => ((0, vue_1.h)("div", { ref: this.setHandleRefs(index), class: `${mergedClsPrefix}-slider-handle`, tabindex: this.mergedDisabled ? -1 : 0, style: this.getHandleStyle(value, index), onFocus: () => this.handleHandleFocus(index), onBlur: () => this.handleHandleBlur(index), onMouseenter: () => this.handleHandleMouseEnter(index), onMouseleave: () => this.handleHandleMouseLeave(index) }))
508
524
  }),
509
- this.tooltip && ((0, vue_1.h)(vueuc_1.VFollower, { ref: this.setFollowerRefs(index), show: showTooltip, to: this.adjustedTo, teleportDisabled: this.adjustedTo === _utils_1.useAdjustedTo.tdkey, placement: this.mergedPlacement, containerClass: this.namespace }, {
510
- default: () => ((0, vue_1.h)(vue_1.Transition, { name: "fade-in-scale-up-transition", appear: this.isMounted, css: this.isSkipCSSDetection(index) }, {
525
+ this.tooltip && ((0, vue_1.h)(vueuc_1.VFollower, { ref: this.setFollowerRefs(index), show: showTooltip, to: this.adjustedTo, enabled: this.followerEnabledIndexSet.has(index), teleportDisabled: this.adjustedTo === _utils_1.useAdjustedTo.tdkey, placement: this.mergedPlacement, containerClass: this.namespace }, {
526
+ default: () => ((0, vue_1.h)(vue_1.Transition, { name: "fade-in-scale-up-transition", appear: this.isMounted, css: this.isSkipCSSDetection(index), onEnter: () => this.followerEnabledIndexSet.add(index), onAfterLeave: () => this.followerEnabledIndexSet.delete(index) }, {
511
527
  default: () => showTooltip ? ((0, vue_1.h)("div", { class: [
512
528
  `${mergedClsPrefix}-slider-handle-indicator`,
513
529
  `${mergedClsPrefix}-slider-handle-indicator--${this.mergedPlacement}`
@@ -8,12 +8,12 @@ const seemly_1 = require("seemly");
8
8
  const _common_1 = __importDefault(require("./_common"));
9
9
  const common_1 = require("../../_styles/common");
10
10
  const self = (vars) => {
11
- const { dividerColor, cardColor, modalColor, popoverColor, tableHeaderColor, tableColorHover, textColor1, textColor2, borderRadius, fontWeightStrong, lineHeight, fontSizeSmall, fontSizeMedium, fontSizeLarge } = vars;
11
+ const { dividerColor, cardColor, modalColor, popoverColor, tableHeaderColor, tableColorStriped, textColor1, textColor2, borderRadius, fontWeightStrong, lineHeight, fontSizeSmall, fontSizeMedium, fontSizeLarge } = vars;
12
12
  return Object.assign(Object.assign({}, _common_1.default), { fontSizeSmall,
13
13
  fontSizeMedium,
14
14
  fontSizeLarge,
15
15
  lineHeight,
16
- borderRadius, borderColor: (0, seemly_1.composite)(cardColor, dividerColor), borderColorModal: (0, seemly_1.composite)(modalColor, dividerColor), borderColorPopover: (0, seemly_1.composite)(popoverColor, dividerColor), tdColor: cardColor, tdColorModal: modalColor, tdColorPopover: popoverColor, tdColorStriped: (0, seemly_1.composite)(cardColor, tableColorHover), tdColorStripedModal: (0, seemly_1.composite)(modalColor, tableColorHover), tdColorStripedPopover: (0, seemly_1.composite)(popoverColor, tableColorHover), thColor: (0, seemly_1.composite)(cardColor, tableHeaderColor), thColorModal: (0, seemly_1.composite)(modalColor, tableHeaderColor), thColorPopover: (0, seemly_1.composite)(popoverColor, tableHeaderColor), thTextColor: textColor1, tdTextColor: textColor2, thFontWeight: fontWeightStrong });
16
+ borderRadius, borderColor: (0, seemly_1.composite)(cardColor, dividerColor), borderColorModal: (0, seemly_1.composite)(modalColor, dividerColor), borderColorPopover: (0, seemly_1.composite)(popoverColor, dividerColor), tdColor: cardColor, tdColorModal: modalColor, tdColorPopover: popoverColor, tdColorStriped: (0, seemly_1.composite)(cardColor, tableColorStriped), tdColorStripedModal: (0, seemly_1.composite)(modalColor, tableColorStriped), tdColorStripedPopover: (0, seemly_1.composite)(popoverColor, tableColorStriped), thColor: (0, seemly_1.composite)(cardColor, tableHeaderColor), thColorModal: (0, seemly_1.composite)(modalColor, tableHeaderColor), thColorPopover: (0, seemly_1.composite)(popoverColor, tableHeaderColor), thTextColor: textColor1, tdTextColor: textColor2, thFontWeight: fontWeightStrong });
17
17
  };
18
18
  exports.self = self;
19
19
  const tableLight = {
@@ -79,6 +79,7 @@ declare const _default: import("vue").DefineComponent<{}, {
79
79
  tableHeaderColor: string;
80
80
  hoverColor: string;
81
81
  tableColorHover: string;
82
+ tableColorStriped: string;
82
83
  pressedColor: string;
83
84
  opacityDisabled: string;
84
85
  inputColorDisabled: string;
@@ -146,6 +146,7 @@ declare const _default: import("vue").DefineComponent<{
146
146
  tableHeaderColor: string;
147
147
  hoverColor: string;
148
148
  tableColorHover: string;
149
+ tableColorStriped: string;
149
150
  pressedColor: string;
150
151
  opacityDisabled: string;
151
152
  inputColorDisabled: string;
@@ -2006,6 +2006,7 @@ declare const _default: import("vue").DefineComponent<{
2006
2006
  tableHeaderColor: string;
2007
2007
  hoverColor: string;
2008
2008
  tableColorHover: string;
2009
+ tableColorStriped: string;
2009
2010
  pressedColor: string;
2010
2011
  opacityDisabled: string;
2011
2012
  inputColorDisabled: string;
@@ -103,7 +103,7 @@ declare const tooltipProps: {
103
103
  default: string;
104
104
  };
105
105
  arrowStyle: import("vue").PropType<string | import("vue").CSSProperties>;
106
- filp: {
106
+ flip: {
107
107
  type: BooleanConstructor;
108
108
  default: boolean;
109
109
  };
@@ -245,7 +245,7 @@ declare const _default: import("vue").DefineComponent<{
245
245
  default: string;
246
246
  };
247
247
  arrowStyle: import("vue").PropType<string | import("vue").CSSProperties>;
248
- filp: {
248
+ flip: {
249
249
  type: BooleanConstructor;
250
250
  default: boolean;
251
251
  };
@@ -358,6 +358,7 @@ declare const _default: import("vue").DefineComponent<{
358
358
  tableHeaderColor: string;
359
359
  hoverColor: string;
360
360
  tableColorHover: string;
361
+ tableColorStriped: string;
361
362
  pressedColor: string;
362
363
  opacityDisabled: string;
363
364
  inputColorDisabled: string;
@@ -449,7 +450,7 @@ declare const _default: import("vue").DefineComponent<{
449
450
  getDisabled?: unknown;
450
451
  displayDirective?: unknown;
451
452
  arrowStyle?: unknown;
452
- filp?: unknown;
453
+ flip?: unknown;
453
454
  animated?: unknown;
454
455
  width?: unknown;
455
456
  overlap?: unknown;
@@ -467,6 +468,7 @@ declare const _default: import("vue").DefineComponent<{
467
468
  minWidth?: unknown;
468
469
  maxWidth?: unknown;
469
470
  } & {
471
+ flip: boolean;
470
472
  disabled: boolean;
471
473
  duration: number;
472
474
  raw: boolean;
@@ -476,7 +478,6 @@ declare const _default: import("vue").DefineComponent<{
476
478
  showArrow: boolean;
477
479
  delay: number;
478
480
  displayDirective: "show" | "if";
479
- filp: boolean;
480
481
  animated: boolean;
481
482
  defaultShow: boolean;
482
483
  internalExtraClass: string[];
@@ -567,6 +568,7 @@ declare const _default: import("vue").DefineComponent<{
567
568
  arrow?: boolean | undefined;
568
569
  }>, {
569
570
  show: boolean | undefined;
571
+ flip: boolean;
570
572
  width: number | "trigger";
571
573
  disabled: boolean;
572
574
  duration: number;
@@ -578,7 +580,6 @@ declare const _default: import("vue").DefineComponent<{
578
580
  showArrow: boolean;
579
581
  delay: number;
580
582
  displayDirective: "show" | "if";
581
- filp: boolean;
582
583
  animated: boolean;
583
584
  defaultShow: boolean;
584
585
  internalExtraClass: string[];
@@ -2152,6 +2152,7 @@ declare const _default: import("vue").DefineComponent<{
2152
2152
  tableHeaderColor: string;
2153
2153
  hoverColor: string;
2154
2154
  tableColorHover: string;
2155
+ tableColorStriped: string;
2155
2156
  pressedColor: string;
2156
2157
  opacityDisabled: string;
2157
2158
  inputColorDisabled: string;
@@ -87,6 +87,7 @@ declare const _default: import("vue").DefineComponent<{
87
87
  tableHeaderColor: string;
88
88
  hoverColor: string;
89
89
  tableColorHover: string;
90
+ tableColorStriped: string;
90
91
  pressedColor: string;
91
92
  opacityDisabled: string;
92
93
  inputColorDisabled: string;
@@ -100,6 +100,7 @@ declare const _default: import("vue").DefineComponent<{
100
100
  tableHeaderColor: string;
101
101
  hoverColor: string;
102
102
  tableColorHover: string;
103
+ tableColorStriped: string;
103
104
  pressedColor: string;
104
105
  opacityDisabled: string;
105
106
  inputColorDisabled: string;
@@ -87,6 +87,7 @@ declare const _default: import("vue").DefineComponent<{
87
87
  tableHeaderColor: string;
88
88
  hoverColor: string;
89
89
  tableColorHover: string;
90
+ tableColorStriped: string;
90
91
  pressedColor: string;
91
92
  opacityDisabled: string;
92
93
  inputColorDisabled: string;
@@ -598,6 +598,7 @@ declare const _default: import("vue").DefineComponent<{
598
598
  tableHeaderColor: string;
599
599
  hoverColor: string;
600
600
  tableColorHover: string;
601
+ tableColorStriped: string;
601
602
  pressedColor: string;
602
603
  opacityDisabled: string;
603
604
  inputColorDisabled: string;
@@ -81,6 +81,7 @@ declare const _default: import("vue").DefineComponent<{
81
81
  tableHeaderColor: string;
82
82
  hoverColor: string;
83
83
  tableColorHover: string;
84
+ tableColorStriped: string;
84
85
  pressedColor: string;
85
86
  opacityDisabled: string;
86
87
  inputColorDisabled: string;
@@ -1131,6 +1131,7 @@ declare const _default: import("vue").DefineComponent<{
1131
1131
  tableHeaderColor: string;
1132
1132
  hoverColor: string;
1133
1133
  tableColorHover: string;
1134
+ tableColorStriped: string;
1134
1135
  pressedColor: string;
1135
1136
  opacityDisabled: string;
1136
1137
  inputColorDisabled: string;
@@ -3,5 +3,4 @@ export { default as NUploadDragger } from './src/UploadDragger';
3
3
  export { default as NUploadTrigger } from './src/UploadTrigger';
4
4
  export { default as NUploadFileList } from './src/UploadFileList';
5
5
  export type { UploadProps } from './src/Upload';
6
- export type { uploadDraggerKey } from './src/UploadDragger';
7
- export type { UploadInst, FileInfo as UploadFileInfo } from './src/interface';
6
+ export type { UploadInst, FileInfo as UploadFileInfo, CustomRequestOptions as UploadCustomRequestOptions } from './src/interface';
@@ -1,6 +1,6 @@
1
1
  import { PropType, CSSProperties } from 'vue';
2
2
  import { ExtractPublicPropTypes, MaybeArray } from '../../_utils';
3
- import { FileInfo, FuncOrRecordOrUndef, OnFinish, OnRemove, OnDownload, OnChange, OnUpdateFileList, OnBeforeUpload, listType, OnPreview, CreateThumbnailUrl } from './interface';
3
+ import { FileInfo, FuncOrRecordOrUndef, OnFinish, OnRemove, OnDownload, OnChange, OnUpdateFileList, OnBeforeUpload, listType, OnPreview, CreateThumbnailUrl, CustomRequest } from './interface';
4
4
  declare const uploadProps: {
5
5
  readonly name: {
6
6
  readonly type: StringConstructor;
@@ -8,6 +8,7 @@ declare const uploadProps: {
8
8
  };
9
9
  readonly accept: StringConstructor;
10
10
  readonly action: StringConstructor;
11
+ readonly customRequest: PropType<CustomRequest>;
11
12
  readonly method: {
12
13
  readonly type: StringConstructor;
13
14
  readonly default: "POST";
@@ -50,10 +51,7 @@ declare const uploadProps: {
50
51
  readonly type: BooleanConstructor;
51
52
  readonly default: true;
52
53
  };
53
- readonly showDownloadButton: {
54
- readonly type: BooleanConstructor;
55
- readonly default: false;
56
- };
54
+ readonly showDownloadButton: BooleanConstructor;
57
55
  readonly showRetryButton: {
58
56
  readonly type: BooleanConstructor;
59
57
  readonly default: true;
@@ -814,6 +812,7 @@ declare const _default: import("vue").DefineComponent<{
814
812
  };
815
813
  readonly accept: StringConstructor;
816
814
  readonly action: StringConstructor;
815
+ readonly customRequest: PropType<CustomRequest>;
817
816
  readonly method: {
818
817
  readonly type: StringConstructor;
819
818
  readonly default: "POST";
@@ -856,10 +855,7 @@ declare const _default: import("vue").DefineComponent<{
856
855
  readonly type: BooleanConstructor;
857
856
  readonly default: true;
858
857
  };
859
- readonly showDownloadButton: {
860
- readonly type: BooleanConstructor;
861
- readonly default: false;
862
- };
858
+ readonly showDownloadButton: BooleanConstructor;
863
859
  readonly showRetryButton: {
864
860
  readonly type: BooleanConstructor;
865
861
  readonly default: true;
@@ -1689,6 +1685,7 @@ declare const _default: import("vue").DefineComponent<{
1689
1685
  tableHeaderColor: string;
1690
1686
  hoverColor: string;
1691
1687
  tableColorHover: string;
1688
+ tableColorStriped: string;
1692
1689
  pressedColor: string;
1693
1690
  opacityDisabled: string;
1694
1691
  inputColorDisabled: string;
@@ -1988,6 +1985,7 @@ declare const _default: import("vue").DefineComponent<{
1988
1985
  readonly name?: unknown;
1989
1986
  readonly accept?: unknown;
1990
1987
  readonly action?: unknown;
1988
+ readonly customRequest?: unknown;
1991
1989
  readonly method?: unknown;
1992
1990
  readonly multiple?: unknown;
1993
1991
  readonly showFileList?: unknown;
@@ -2778,6 +2776,7 @@ declare const _default: import("vue").DefineComponent<{
2778
2776
  }, any>;
2779
2777
  }>> | undefined;
2780
2778
  onRemove?: OnRemove | undefined;
2779
+ customRequest?: CustomRequest | undefined;
2781
2780
  onFinish?: OnFinish | undefined;
2782
2781
  onBeforeUpload?: OnBeforeUpload | undefined;
2783
2782
  onDownload?: OnDownload | undefined;
@@ -73,6 +73,45 @@ function createXhrHandlers(inst, file, XHR) {
73
73
  }
74
74
  };
75
75
  }
76
+ function customSubmitImpl(options) {
77
+ const { inst, file, data, headers, withCredentials, action, customRequest } = options;
78
+ const { doChange } = options.inst;
79
+ let percentage = 0;
80
+ customRequest({
81
+ file,
82
+ data,
83
+ headers,
84
+ withCredentials,
85
+ action,
86
+ onProgress(event) {
87
+ const fileAfterChange = Object.assign({}, file, {
88
+ status: 'uploading'
89
+ });
90
+ const progress = event.percent;
91
+ fileAfterChange.percentage = progress;
92
+ percentage = progress;
93
+ doChange(fileAfterChange);
94
+ },
95
+ onFinish() {
96
+ var _a;
97
+ let fileAfterChange = Object.assign({}, file, {
98
+ status: 'finished',
99
+ percentage,
100
+ file: null
101
+ });
102
+ fileAfterChange =
103
+ ((_a = inst.onFinish) === null || _a === void 0 ? void 0 : _a.call(inst, { file: fileAfterChange })) || fileAfterChange;
104
+ doChange(fileAfterChange);
105
+ },
106
+ onError() {
107
+ const fileAfterChange = Object.assign({}, file, {
108
+ status: 'error',
109
+ percentage
110
+ });
111
+ doChange(fileAfterChange);
112
+ }
113
+ });
114
+ }
76
115
  function registerHandler(inst, file, request) {
77
116
  const handlers = createXhrHandlers(inst, file, request);
78
117
  request.onabort = handlers.handleXHRAbort;
@@ -125,7 +164,7 @@ function submitImpl(inst, file, formData, { method, action, withCredentials, hea
125
164
  const uploadProps = Object.assign(Object.assign({}, _mixins_1.useTheme.props), { name: {
126
165
  type: String,
127
166
  default: 'file'
128
- }, accept: String, action: String,
167
+ }, accept: String, action: String, customRequest: Function,
129
168
  // to be impl
130
169
  // directory: {
131
170
  // type: Boolean,
@@ -154,10 +193,7 @@ const uploadProps = Object.assign(Object.assign({}, _mixins_1.useTheme.props), {
154
193
  }, showRemoveButton: {
155
194
  type: Boolean,
156
195
  default: true
157
- }, showDownloadButton: {
158
- type: Boolean,
159
- default: false
160
- }, showRetryButton: {
196
+ }, showDownloadButton: Boolean, showRetryButton: {
161
197
  type: Boolean,
162
198
  default: true
163
199
  }, showPreviewButton: {
@@ -269,17 +305,34 @@ exports.default = (0, vue_1.defineComponent)({
269
305
  if (status === 'pending' || (status === 'error' && shouldReupload)) {
270
306
  const formData = new FormData();
271
307
  formData.append(fieldName, file.file);
272
- submitImpl({
273
- doChange,
274
- XhrMap,
275
- onFinish: props.onFinish
276
- }, file, formData, {
277
- method,
278
- action,
279
- withCredentials,
280
- headers,
281
- data
282
- });
308
+ if (props.customRequest) {
309
+ customSubmitImpl({
310
+ inst: {
311
+ doChange,
312
+ XhrMap,
313
+ onFinish: props.onFinish
314
+ },
315
+ file,
316
+ action,
317
+ withCredentials,
318
+ headers,
319
+ data,
320
+ customRequest: props.customRequest
321
+ });
322
+ }
323
+ else {
324
+ submitImpl({
325
+ doChange,
326
+ XhrMap,
327
+ onFinish: props.onFinish
328
+ }, file, formData, {
329
+ method,
330
+ action,
331
+ withCredentials,
332
+ headers,
333
+ data
334
+ });
335
+ }
283
336
  }
284
337
  });
285
338
  }
@@ -84,6 +84,7 @@ declare const _default: import("vue").DefineComponent<{
84
84
  tableHeaderColor: string;
85
85
  hoverColor: string;
86
86
  tableColorHover: string;
87
+ tableColorStriped: string;
87
88
  pressedColor: string;
88
89
  opacityDisabled: string;
89
90
  inputColorDisabled: string;
@@ -80,6 +80,7 @@ declare const _default: import("vue").DefineComponent<{
80
80
  tableHeaderColor: string;
81
81
  hoverColor: string;
82
82
  tableColorHover: string;
83
+ tableColorStriped: string;
83
84
  pressedColor: string;
84
85
  opacityDisabled: string;
85
86
  inputColorDisabled: string;
@@ -21,7 +21,7 @@ export declare type OnChange = (data: {
21
21
  }) => void;
22
22
  export declare type OnFinish = ({ file, event }: {
23
23
  file: FileInfo;
24
- event: Event;
24
+ event?: Event;
25
25
  }) => FileInfo | undefined;
26
26
  export declare type OnRemove = (data: {
27
27
  file: FileInfo;
@@ -85,3 +85,16 @@ export declare type OnBeforeUpload = (data: {
85
85
  export declare type listType = 'text' | 'image' | 'image-card';
86
86
  export declare type OnPreview = (file: FileInfo) => void;
87
87
  export declare type CreateThumbnailUrl = (file: File) => Promise<string>;
88
+ export interface CustomRequestOptions {
89
+ file: FileInfo;
90
+ action?: string;
91
+ withCredentials?: boolean;
92
+ data?: FuncOrRecordOrUndef;
93
+ headers?: FuncOrRecordOrUndef;
94
+ onProgress: (e: {
95
+ percent: number;
96
+ }) => void;
97
+ onFinish: () => void;
98
+ onError: () => void;
99
+ }
100
+ export declare type CustomRequest = (options: CustomRequestOptions) => void;
package/lib/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- declare const _default: "2.21.1";
1
+ declare const _default: "2.21.2";
2
2
  export default _default;
package/lib/version.js CHANGED
@@ -1,3 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = '2.21.1';
3
+ exports.default = '2.21.2';