naive-ui 2.19.7 → 2.19.11

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 (208) hide show
  1. package/es/_internal/icons/Add.js +2 -3
  2. package/es/_internal/selection/src/Selection.d.ts +4 -1
  3. package/es/_internal/selection/src/Selection.js +3 -3
  4. package/es/anchor/src/AnchorAdapter.d.ts +5 -0
  5. package/es/anchor/src/BaseAnchor.d.ts +6 -1
  6. package/es/anchor/src/BaseAnchor.js +8 -3
  7. package/es/auto-complete/src/AutoComplete.d.ts +4 -0
  8. package/es/auto-complete/src/AutoComplete.js +9 -2
  9. package/es/calendar/src/Calendar.d.ts +1 -0
  10. package/es/cascader/src/Cascader.js +1 -1
  11. package/es/cascader/src/CascaderSelectMenu.d.ts +16 -7
  12. package/es/cascader/src/CascaderSelectMenu.js +23 -10
  13. package/es/cascader/src/utils.d.ts +2 -1
  14. package/es/cascader/src/utils.js +5 -2
  15. package/es/collapse/src/Collapse.d.ts +0 -1
  16. package/es/collapse/src/Collapse.js +2 -5
  17. package/es/collapse/src/CollapseItem.js +0 -2
  18. package/es/color-picker/src/ColorPicker.d.ts +4 -0
  19. package/es/color-picker/src/ColorPicker.js +5 -2
  20. package/es/color-picker/src/ColorPickerSwatches.d.ts +39 -0
  21. package/es/color-picker/src/ColorPickerSwatches.js +142 -0
  22. package/es/color-picker/src/styles/index.cssr.js +20 -0
  23. package/es/config-provider/src/ConfigProvider.d.ts +8 -1
  24. package/es/config-provider/src/ConfigProvider.js +8 -2
  25. package/es/config-provider/src/config.d.ts +8 -0
  26. package/es/config-provider/src/config.js +8 -0
  27. package/es/config-provider/src/internal-interface.d.ts +4 -0
  28. package/es/data-table/src/TableParts/Body.d.ts +8 -2
  29. package/es/data-table/src/TableParts/Body.js +4 -4
  30. package/es/data-table/src/TableParts/Header.d.ts +8 -2
  31. package/es/data-table/src/TableParts/Header.js +7 -4
  32. package/es/data-table/src/interface.d.ts +8 -2
  33. package/es/data-table/src/use-group-header.js +12 -8
  34. package/es/data-table/src/use-scroll.d.ts +11 -5
  35. package/es/data-table/src/use-scroll.js +37 -10
  36. package/es/date-picker/src/DatePicker.js +3 -0
  37. package/es/date-picker/src/panel/date.d.ts +1 -0
  38. package/es/date-picker/src/panel/daterange.d.ts +1 -0
  39. package/es/date-picker/src/panel/datetime.d.ts +1 -0
  40. package/es/date-picker/src/panel/datetimerange.d.ts +1 -0
  41. package/es/date-picker/src/panel/month.d.ts +1 -0
  42. package/es/date-picker/src/panel/use-calendar.d.ts +1 -0
  43. package/es/date-picker/src/panel/use-dual-calendar.d.ts +1 -0
  44. package/es/date-picker/src/panel/use-panel-common.d.ts +1 -0
  45. package/es/dialog/src/styles/index.cssr.js +1 -0
  46. package/es/ellipsis/src/Ellipsis.js +3 -1
  47. package/es/grid/src/Grid.d.ts +1 -1
  48. package/es/grid/src/Grid.js +4 -3
  49. package/es/input/src/Input.d.ts +1 -1
  50. package/es/input/src/Input.js +3 -8
  51. package/es/input/src/WordCount.js +22 -7
  52. package/es/input/src/interface.d.ts +1 -1
  53. package/es/input-number/index.d.ts +1 -0
  54. package/es/input-number/src/InputNumber.d.ts +2 -0
  55. package/es/input-number/src/InputNumber.js +10 -22
  56. package/es/input-number/src/interface.d.ts +4 -0
  57. package/es/locales/common/enUS.d.ts +1 -0
  58. package/es/locales/common/enUS.js +1 -0
  59. package/es/locales/common/jaJP.d.ts +3 -0
  60. package/es/locales/common/jaJP.js +93 -0
  61. package/es/locales/common/ruRU.js +1 -0
  62. package/es/locales/common/ukUA.js +1 -0
  63. package/es/locales/common/zhCN.js +1 -0
  64. package/es/locales/date/jaJP.d.ts +3 -0
  65. package/es/locales/date/jaJP.js +6 -0
  66. package/es/locales/index.d.ts +2 -0
  67. package/es/locales/index.js +2 -0
  68. package/es/menu/src/Menu.d.ts +8 -1
  69. package/es/menu/src/Menu.js +4 -2
  70. package/es/menu/src/MenuOption.d.ts +2 -0
  71. package/es/menu/src/MenuOptionContent.d.ts +2 -0
  72. package/es/menu/src/Submenu.d.ts +2 -0
  73. package/es/menu/src/Submenu.js +3 -2
  74. package/es/rate/src/Rate.d.ts +2 -2
  75. package/es/scrollbar/src/ScrollBar.d.ts +14 -4
  76. package/es/scrollbar/src/ScrollBar.js +13 -3
  77. package/es/select/src/Select.d.ts +5 -1
  78. package/es/select/src/Select.js +2 -2
  79. package/es/table/src/Table.d.ts +2 -8
  80. package/es/table/src/Table.js +1 -4
  81. package/es/tabs/src/Tab.js +18 -2
  82. package/es/tabs/src/Tabs.d.ts +5 -1
  83. package/es/tabs/src/Tabs.js +4 -1
  84. package/es/tabs/src/interface.d.ts +6 -0
  85. package/es/time-picker/src/Panel.d.ts +30 -8
  86. package/es/time-picker/src/Panel.js +101 -33
  87. package/es/time-picker/src/PanelCol.d.ts +6 -9
  88. package/es/time-picker/src/PanelCol.js +7 -9
  89. package/es/time-picker/src/TimePicker.d.ts +21 -16
  90. package/es/time-picker/src/TimePicker.js +63 -36
  91. package/es/time-picker/src/interface.d.ts +7 -0
  92. package/es/time-picker/src/utils.d.ts +4 -1
  93. package/es/time-picker/src/utils.js +67 -4
  94. package/es/tree/src/Tree.d.ts +2 -2
  95. package/es/upload/src/Upload.d.ts +15 -11
  96. package/es/upload/src/Upload.js +16 -7
  97. package/es/upload/src/UploadFile.js +1 -1
  98. package/es/upload/src/UploadFileList.js +1 -3
  99. package/es/upload/src/UploadTrigger.js +13 -5
  100. package/es/upload/src/interface.d.ts +1 -1
  101. package/es/upload/src/styles/index.cssr.js +3 -1
  102. package/es/version.d.ts +1 -1
  103. package/es/version.js +1 -1
  104. package/lib/_internal/icons/Add.js +2 -3
  105. package/lib/_internal/selection/src/Selection.d.ts +4 -1
  106. package/lib/_internal/selection/src/Selection.js +3 -3
  107. package/lib/anchor/src/AnchorAdapter.d.ts +5 -0
  108. package/lib/anchor/src/BaseAnchor.d.ts +6 -1
  109. package/lib/anchor/src/BaseAnchor.js +7 -2
  110. package/lib/auto-complete/src/AutoComplete.d.ts +4 -0
  111. package/lib/auto-complete/src/AutoComplete.js +9 -2
  112. package/lib/calendar/src/Calendar.d.ts +1 -0
  113. package/lib/cascader/src/Cascader.js +1 -1
  114. package/lib/cascader/src/CascaderSelectMenu.d.ts +16 -7
  115. package/lib/cascader/src/CascaderSelectMenu.js +23 -10
  116. package/lib/cascader/src/utils.d.ts +2 -1
  117. package/lib/cascader/src/utils.js +5 -2
  118. package/lib/collapse/src/Collapse.d.ts +0 -1
  119. package/lib/collapse/src/Collapse.js +2 -5
  120. package/lib/collapse/src/CollapseItem.js +0 -2
  121. package/lib/color-picker/src/ColorPicker.d.ts +4 -0
  122. package/lib/color-picker/src/ColorPicker.js +5 -2
  123. package/lib/color-picker/src/ColorPickerSwatches.d.ts +39 -0
  124. package/lib/color-picker/src/ColorPickerSwatches.js +144 -0
  125. package/lib/color-picker/src/styles/index.cssr.js +20 -0
  126. package/lib/config-provider/src/ConfigProvider.d.ts +8 -1
  127. package/lib/config-provider/src/ConfigProvider.js +8 -2
  128. package/lib/config-provider/src/config.d.ts +8 -0
  129. package/lib/config-provider/src/config.js +11 -0
  130. package/lib/config-provider/src/internal-interface.d.ts +4 -0
  131. package/lib/data-table/src/TableParts/Body.d.ts +8 -2
  132. package/lib/data-table/src/TableParts/Body.js +4 -4
  133. package/lib/data-table/src/TableParts/Header.d.ts +8 -2
  134. package/lib/data-table/src/TableParts/Header.js +7 -4
  135. package/lib/data-table/src/interface.d.ts +8 -2
  136. package/lib/data-table/src/use-group-header.js +12 -8
  137. package/lib/data-table/src/use-scroll.d.ts +11 -5
  138. package/lib/data-table/src/use-scroll.js +37 -10
  139. package/lib/date-picker/src/DatePicker.js +3 -0
  140. package/lib/date-picker/src/panel/date.d.ts +1 -0
  141. package/lib/date-picker/src/panel/daterange.d.ts +1 -0
  142. package/lib/date-picker/src/panel/datetime.d.ts +1 -0
  143. package/lib/date-picker/src/panel/datetimerange.d.ts +1 -0
  144. package/lib/date-picker/src/panel/month.d.ts +1 -0
  145. package/lib/date-picker/src/panel/use-calendar.d.ts +1 -0
  146. package/lib/date-picker/src/panel/use-dual-calendar.d.ts +1 -0
  147. package/lib/date-picker/src/panel/use-panel-common.d.ts +1 -0
  148. package/lib/dialog/src/styles/index.cssr.js +1 -0
  149. package/lib/ellipsis/src/Ellipsis.js +3 -1
  150. package/lib/grid/src/Grid.d.ts +1 -1
  151. package/lib/grid/src/Grid.js +4 -3
  152. package/lib/input/src/Input.d.ts +1 -1
  153. package/lib/input/src/Input.js +2 -7
  154. package/lib/input/src/WordCount.js +21 -6
  155. package/lib/input/src/interface.d.ts +1 -1
  156. package/lib/input-number/index.d.ts +1 -0
  157. package/lib/input-number/src/InputNumber.d.ts +2 -0
  158. package/lib/input-number/src/InputNumber.js +10 -22
  159. package/lib/input-number/src/interface.d.ts +4 -0
  160. package/lib/locales/common/enUS.d.ts +1 -0
  161. package/lib/locales/common/enUS.js +1 -0
  162. package/lib/locales/common/jaJP.d.ts +3 -0
  163. package/lib/locales/common/jaJP.js +95 -0
  164. package/lib/locales/common/ruRU.js +1 -0
  165. package/lib/locales/common/ukUA.js +1 -0
  166. package/lib/locales/common/zhCN.js +1 -0
  167. package/lib/locales/date/jaJP.d.ts +3 -0
  168. package/lib/locales/date/jaJP.js +8 -0
  169. package/lib/locales/index.d.ts +2 -0
  170. package/lib/locales/index.js +5 -1
  171. package/lib/menu/src/Menu.d.ts +8 -1
  172. package/lib/menu/src/Menu.js +4 -2
  173. package/lib/menu/src/MenuOption.d.ts +2 -0
  174. package/lib/menu/src/MenuOptionContent.d.ts +2 -0
  175. package/lib/menu/src/Submenu.d.ts +2 -0
  176. package/lib/menu/src/Submenu.js +3 -2
  177. package/lib/rate/src/Rate.d.ts +2 -2
  178. package/lib/scrollbar/src/ScrollBar.d.ts +14 -4
  179. package/lib/scrollbar/src/ScrollBar.js +12 -2
  180. package/lib/select/src/Select.d.ts +5 -1
  181. package/lib/select/src/Select.js +2 -2
  182. package/lib/table/src/Table.d.ts +2 -8
  183. package/lib/table/src/Table.js +1 -4
  184. package/lib/tabs/src/Tab.js +18 -2
  185. package/lib/tabs/src/Tabs.d.ts +5 -1
  186. package/lib/tabs/src/Tabs.js +4 -1
  187. package/lib/tabs/src/interface.d.ts +6 -0
  188. package/lib/time-picker/src/Panel.d.ts +30 -8
  189. package/lib/time-picker/src/Panel.js +100 -32
  190. package/lib/time-picker/src/PanelCol.d.ts +6 -9
  191. package/lib/time-picker/src/PanelCol.js +7 -9
  192. package/lib/time-picker/src/TimePicker.d.ts +21 -16
  193. package/lib/time-picker/src/TimePicker.js +61 -34
  194. package/lib/time-picker/src/interface.d.ts +7 -0
  195. package/lib/time-picker/src/utils.d.ts +4 -1
  196. package/lib/time-picker/src/utils.js +69 -5
  197. package/lib/tree/src/Tree.d.ts +2 -2
  198. package/lib/upload/src/Upload.d.ts +15 -11
  199. package/lib/upload/src/Upload.js +16 -7
  200. package/lib/upload/src/UploadFile.js +1 -1
  201. package/lib/upload/src/UploadFileList.js +1 -3
  202. package/lib/upload/src/UploadTrigger.js +13 -5
  203. package/lib/upload/src/interface.d.ts +1 -1
  204. package/lib/upload/src/styles/index.cssr.js +3 -1
  205. package/lib/version.d.ts +1 -1
  206. package/lib/version.js +1 -1
  207. package/package.json +7 -4
  208. package/web-types.json +68 -1
@@ -1,8 +1,37 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.findSimilarTime = exports.isTimeInStep = exports.getTimeUnits = exports.getFixValue = exports.time = void 0;
3
+ exports.getAmPm = exports.findSimilarTime = exports.isTimeInStep = exports.getTimeUnits = exports.getFixValue = exports.time = void 0;
4
+ const date_fns_1 = require("date-fns");
4
5
  const _utils_1 = require("../../_utils");
5
6
  exports.time = {
7
+ amHours: [
8
+ '00',
9
+ '01',
10
+ '02',
11
+ '03',
12
+ '04',
13
+ '05',
14
+ '06',
15
+ '07',
16
+ '08',
17
+ '09',
18
+ '10',
19
+ '11'
20
+ ],
21
+ pmHours: [
22
+ '12',
23
+ '01',
24
+ '02',
25
+ '03',
26
+ '04',
27
+ '05',
28
+ '06',
29
+ '07',
30
+ '08',
31
+ '09',
32
+ '10',
33
+ '11'
34
+ ],
6
35
  hours: [
7
36
  '00',
8
37
  '01',
@@ -159,15 +188,46 @@ function getFixValue(value) {
159
188
  return `00${value}`.slice(-2);
160
189
  }
161
190
  exports.getFixValue = getFixValue;
162
- function getTimeUnits(defaultValue, stepOrList) {
191
+ // TODO: refactor the logic, it's somehow a patch logic
192
+ function getTimeUnits(defaultValue, stepOrList, isHourWithAmPm) {
163
193
  if (Array.isArray(stepOrList)) {
164
- return stepOrList.map((v) => Math.floor(v)).map((v) => getFixValue(v));
194
+ return (isHourWithAmPm === 'am'
195
+ ? stepOrList.filter((v) => v < 12)
196
+ : isHourWithAmPm === 'pm'
197
+ ? stepOrList.filter((v) => v >= 12).map((v) => (v === 12 ? 12 : v - 12))
198
+ : stepOrList).map((v) => getFixValue(v));
165
199
  }
166
200
  else if (typeof stepOrList === 'number') {
167
- return defaultValue.filter((hour) => Number(hour) % stepOrList === 0);
201
+ if (isHourWithAmPm === 'am') {
202
+ return defaultValue.filter((hour) => {
203
+ const hourAsNumber = Number(hour);
204
+ return hourAsNumber < 12 && hourAsNumber % stepOrList === 0;
205
+ });
206
+ }
207
+ else if (isHourWithAmPm === 'pm') {
208
+ return defaultValue
209
+ .filter((hour) => {
210
+ const hourAsNumber = Number(hour);
211
+ return hourAsNumber >= 12 && hourAsNumber % stepOrList === 0;
212
+ })
213
+ .map((hour) => {
214
+ const hourAsNumber = Number(hour);
215
+ return getFixValue(hourAsNumber === 12 ? 12 : hourAsNumber - 12);
216
+ });
217
+ }
218
+ return defaultValue.filter((hour) => {
219
+ return Number(hour) % stepOrList === 0;
220
+ });
168
221
  }
169
222
  else {
170
- return defaultValue;
223
+ return isHourWithAmPm === 'am'
224
+ ? defaultValue.filter((hour) => Number(hour) < 12)
225
+ : isHourWithAmPm === 'pm'
226
+ ? defaultValue
227
+ .map((hour) => Number(hour))
228
+ .filter((hour) => Number(hour) >= 12)
229
+ .map((v) => getFixValue(v === 12 ? 12 : v - 12))
230
+ : defaultValue;
171
231
  }
172
232
  }
173
233
  exports.getTimeUnits = getTimeUnits;
@@ -208,3 +268,7 @@ function findSimilarTime(value, type, stepOrList) {
208
268
  return upperBound - value > value - lowerBound ? lowerBound : upperBound;
209
269
  }
210
270
  exports.findSimilarTime = findSimilarTime;
271
+ function getAmPm(value) {
272
+ return (0, date_fns_1.getHours)(value) < 12 ? 'am' : 'pm';
273
+ }
274
+ exports.getAmPm = getAmPm;
@@ -1043,12 +1043,12 @@ declare const _default: import("vue").DefineComponent<{
1043
1043
  indent: number;
1044
1044
  labelField: string;
1045
1045
  childrenField: string;
1046
+ internalScrollable: boolean;
1046
1047
  checkStrategy: CheckStrategy;
1047
1048
  leafOnly: boolean;
1048
1049
  defaultExpandAll: boolean;
1049
1050
  defaultExpandedKeys: Key[];
1050
1051
  cancelable: boolean;
1051
- internalScrollable: boolean;
1052
1052
  blockLine: boolean;
1053
1053
  selectable: boolean;
1054
1054
  internalUnifySelectCheck: boolean;
@@ -1238,12 +1238,12 @@ declare const _default: import("vue").DefineComponent<{
1238
1238
  indent: number;
1239
1239
  labelField: string;
1240
1240
  childrenField: string;
1241
+ internalScrollable: boolean;
1241
1242
  checkStrategy: CheckStrategy;
1242
1243
  leafOnly: boolean;
1243
1244
  defaultExpandAll: boolean;
1244
1245
  defaultExpandedKeys: Key[];
1245
1246
  cancelable: boolean;
1246
- internalScrollable: boolean;
1247
1247
  blockLine: boolean;
1248
1248
  selectable: boolean;
1249
1249
  internalUnifySelectCheck: boolean;
@@ -69,6 +69,7 @@ declare const uploadProps: {
69
69
  readonly onPreview: PropType<OnPreview>;
70
70
  readonly createThumbnailUrl: PropType<CreateThumbnailUrl>;
71
71
  readonly abstract: BooleanConstructor;
72
+ readonly max: NumberConstructor;
72
73
  readonly theme: PropType<import("../../_mixins").Theme<"Upload", {
73
74
  fontSize: string;
74
75
  lineHeight: string;
@@ -192,7 +193,7 @@ declare const uploadProps: {
192
193
  textColorFocusSuccess: string;
193
194
  textColorDisabledSuccess: string;
194
195
  textColorTextSuccess: string;
195
- textColorTextHoverSuccess: string; /** currently of no usage */
196
+ textColorTextHoverSuccess: string;
196
197
  textColorTextPressedSuccess: string;
197
198
  textColorTextFocusSuccess: string;
198
199
  textColorTextDisabledSuccess: string;
@@ -428,7 +429,7 @@ declare const uploadProps: {
428
429
  textColorFocusSuccess: string;
429
430
  textColorDisabledSuccess: string;
430
431
  textColorTextSuccess: string;
431
- textColorTextHoverSuccess: string; /** currently of no usage */
432
+ textColorTextHoverSuccess: string;
432
433
  textColorTextPressedSuccess: string;
433
434
  textColorTextFocusSuccess: string;
434
435
  textColorTextDisabledSuccess: string;
@@ -664,7 +665,7 @@ declare const uploadProps: {
664
665
  textColorFocusSuccess: string;
665
666
  textColorDisabledSuccess: string;
666
667
  textColorTextSuccess: string;
667
- textColorTextHoverSuccess: string; /** currently of no usage */
668
+ textColorTextHoverSuccess: string;
668
669
  textColorTextPressedSuccess: string;
669
670
  textColorTextFocusSuccess: string;
670
671
  textColorTextDisabledSuccess: string;
@@ -847,6 +848,7 @@ declare const _default: import("vue").DefineComponent<{
847
848
  readonly onPreview: PropType<OnPreview>;
848
849
  readonly createThumbnailUrl: PropType<CreateThumbnailUrl>;
849
850
  readonly abstract: BooleanConstructor;
851
+ readonly max: NumberConstructor;
850
852
  readonly theme: PropType<import("../../_mixins").Theme<"Upload", {
851
853
  fontSize: string;
852
854
  lineHeight: string;
@@ -970,7 +972,7 @@ declare const _default: import("vue").DefineComponent<{
970
972
  textColorFocusSuccess: string;
971
973
  textColorDisabledSuccess: string;
972
974
  textColorTextSuccess: string;
973
- textColorTextHoverSuccess: string; /** currently of no usage */
975
+ textColorTextHoverSuccess: string;
974
976
  textColorTextPressedSuccess: string;
975
977
  textColorTextFocusSuccess: string;
976
978
  textColorTextDisabledSuccess: string;
@@ -1206,7 +1208,7 @@ declare const _default: import("vue").DefineComponent<{
1206
1208
  textColorFocusSuccess: string;
1207
1209
  textColorDisabledSuccess: string;
1208
1210
  textColorTextSuccess: string;
1209
- textColorTextHoverSuccess: string; /** currently of no usage */
1211
+ textColorTextHoverSuccess: string;
1210
1212
  textColorTextPressedSuccess: string;
1211
1213
  textColorTextFocusSuccess: string;
1212
1214
  textColorTextDisabledSuccess: string;
@@ -1442,7 +1444,7 @@ declare const _default: import("vue").DefineComponent<{
1442
1444
  textColorFocusSuccess: string;
1443
1445
  textColorDisabledSuccess: string;
1444
1446
  textColorTextSuccess: string;
1445
- textColorTextHoverSuccess: string; /** currently of no usage */
1447
+ textColorTextHoverSuccess: string;
1446
1448
  textColorTextPressedSuccess: string;
1447
1449
  textColorTextFocusSuccess: string;
1448
1450
  textColorTextDisabledSuccess: string;
@@ -1631,7 +1633,7 @@ declare const _default: import("vue").DefineComponent<{
1631
1633
  tableHeaderColor: string;
1632
1634
  hoverColor: string;
1633
1635
  tableColorHover: string;
1634
- pressedColor: string;
1636
+ pressedColor: string; /** currently of no usage */
1635
1637
  opacityDisabled: string;
1636
1638
  inputColorDisabled: string;
1637
1639
  boxShadow1: string;
@@ -1785,7 +1787,7 @@ declare const _default: import("vue").DefineComponent<{
1785
1787
  textColorFocusSuccess: string;
1786
1788
  textColorDisabledSuccess: string;
1787
1789
  textColorTextSuccess: string;
1788
- textColorTextHoverSuccess: string; /** currently of no usage */
1790
+ textColorTextHoverSuccess: string;
1789
1791
  textColorTextPressedSuccess: string;
1790
1792
  textColorTextFocusSuccess: string;
1791
1793
  textColorTextDisabledSuccess: string;
@@ -1946,6 +1948,7 @@ declare const _default: import("vue").DefineComponent<{
1946
1948
  readonly onPreview?: unknown;
1947
1949
  readonly createThumbnailUrl?: unknown;
1948
1950
  readonly abstract?: unknown;
1951
+ readonly max?: unknown;
1949
1952
  readonly theme?: unknown;
1950
1953
  readonly themeOverrides?: unknown;
1951
1954
  readonly builtinThemeOverrides?: unknown;
@@ -1970,6 +1973,7 @@ declare const _default: import("vue").DefineComponent<{
1970
1973
  onChange?: OnChange | undefined;
1971
1974
  action?: string | undefined;
1972
1975
  accept?: string | undefined;
1976
+ max?: number | undefined;
1973
1977
  headers?: FuncOrRecordOrUndef;
1974
1978
  theme?: import("../../_mixins").Theme<"Upload", {
1975
1979
  fontSize: string;
@@ -2094,7 +2098,7 @@ declare const _default: import("vue").DefineComponent<{
2094
2098
  textColorFocusSuccess: string;
2095
2099
  textColorDisabledSuccess: string;
2096
2100
  textColorTextSuccess: string;
2097
- textColorTextHoverSuccess: string; /** currently of no usage */
2101
+ textColorTextHoverSuccess: string;
2098
2102
  textColorTextPressedSuccess: string;
2099
2103
  textColorTextFocusSuccess: string;
2100
2104
  textColorTextDisabledSuccess: string;
@@ -2330,7 +2334,7 @@ declare const _default: import("vue").DefineComponent<{
2330
2334
  textColorFocusSuccess: string;
2331
2335
  textColorDisabledSuccess: string;
2332
2336
  textColorTextSuccess: string;
2333
- textColorTextHoverSuccess: string; /** currently of no usage */
2337
+ textColorTextHoverSuccess: string;
2334
2338
  textColorTextPressedSuccess: string;
2335
2339
  textColorTextFocusSuccess: string;
2336
2340
  textColorTextDisabledSuccess: string;
@@ -2566,7 +2570,7 @@ declare const _default: import("vue").DefineComponent<{
2566
2570
  textColorFocusSuccess: string;
2567
2571
  textColorDisabledSuccess: string;
2568
2572
  textColorTextSuccess: string;
2569
- textColorTextHoverSuccess: string; /** currently of no usage */
2573
+ textColorTextHoverSuccess: string;
2570
2574
  textColorTextPressedSuccess: string;
2571
2575
  textColorTextFocusSuccess: string;
2572
2576
  textColorTextDisabledSuccess: string;
@@ -52,8 +52,7 @@ function createXhrHandlers(inst, file, XHR) {
52
52
  handleXHRError(e) {
53
53
  const fileAfterChange = Object.assign({}, file, {
54
54
  status: 'error',
55
- percentage,
56
- file: null
55
+ percentage
57
56
  });
58
57
  XhrMap.delete(file.id);
59
58
  doChange(fileAfterChange, e);
@@ -164,7 +163,7 @@ const uploadProps = Object.assign(Object.assign({}, _mixins_1.useTheme.props), {
164
163
  }, listType: {
165
164
  type: String,
166
165
  default: 'text'
167
- }, onPreview: Function, createThumbnailUrl: Function, abstract: Boolean });
166
+ }, onPreview: Function, createThumbnailUrl: Function, abstract: Boolean, max: Number });
168
167
  exports.default = (0, vue_1.defineComponent)({
169
168
  name: 'Upload',
170
169
  props: uploadProps,
@@ -175,7 +174,13 @@ exports.default = (0, vue_1.defineComponent)({
175
174
  const { mergedClsPrefixRef } = (0, _mixins_1.useConfig)(props);
176
175
  const themeRef = (0, _mixins_1.useTheme)('Upload', 'Upload', index_cssr_1.default, styles_1.uploadLight, props, mergedClsPrefixRef);
177
176
  const formItem = (0, _mixins_1.useFormItem)(props);
178
- const { mergedDisabledRef } = formItem;
177
+ const maxReachedRef = (0, vue_1.computed)(() => {
178
+ const { max } = props;
179
+ if (max !== undefined) {
180
+ return mergedFileListRef.value.length >= max;
181
+ }
182
+ return false;
183
+ });
179
184
  const uncontrolledFileListRef = (0, vue_1.ref)(props.defaultFileList);
180
185
  const controlledFileListRef = (0, vue_1.toRef)(props, 'fileList');
181
186
  const inputElRef = (0, vue_1.ref)(null);
@@ -207,7 +212,11 @@ exports.default = (0, vue_1.defineComponent)({
207
212
  if (!files || files.length === 0)
208
213
  return;
209
214
  const { onBeforeUpload } = props;
210
- const filesAsArray = props.multiple ? Array.from(files) : [files[0]];
215
+ let filesAsArray = props.multiple ? Array.from(files) : [files[0]];
216
+ const { max } = props;
217
+ if (max) {
218
+ filesAsArray = filesAsArray.slice(0, max - mergedFileListRef.value.length);
219
+ }
211
220
  void Promise.all(filesAsArray.map((file) => __awaiter(this, void 0, void 0, function* () {
212
221
  const fileInfo = {
213
222
  id: (0, seemly_1.createId)(),
@@ -334,7 +343,6 @@ exports.default = (0, vue_1.defineComponent)({
334
343
  (0, vue_1.provide)(interface_1.uploadInjectionKey, {
335
344
  mergedClsPrefixRef,
336
345
  mergedThemeRef: themeRef,
337
- disabledRef: mergedDisabledRef,
338
346
  showCancelButtonRef: (0, vue_1.toRef)(props, 'showCancelButton'),
339
347
  showDownloadButtonRef: (0, vue_1.toRef)(props, 'showDownloadButton'),
340
348
  showRemoveButtonRef: (0, vue_1.toRef)(props, 'showRemoveButton'),
@@ -353,7 +361,8 @@ exports.default = (0, vue_1.defineComponent)({
353
361
  openFileDialog,
354
362
  draggerInsideRef,
355
363
  handleFileAddition,
356
- mergedDisabledRef,
364
+ mergedDisabledRef: formItem.mergedDisabledRef,
365
+ maxReachedRef,
357
366
  fileListStyleRef: (0, vue_1.toRef)(props, 'fileListStyle'),
358
367
  abstractRef: (0, vue_1.toRef)(props, 'abstract'),
359
368
  cssVarsRef
@@ -171,7 +171,7 @@ exports.default = (0, vue_1.defineComponent)({
171
171
  progressStatus: progressStatusRef,
172
172
  buttonType: buttonTypeRef,
173
173
  showProgress: showProgressRef,
174
- disabled: NUpload.disabledRef,
174
+ disabled: NUpload.mergedDisabledRef,
175
175
  showCancelButton: showCancelButtonRef,
176
176
  showRemoveButton: showRemoveButtonRef,
177
177
  showDownloadButton: showDownloadButtonRef,
@@ -14,7 +14,7 @@ exports.default = (0, vue_1.defineComponent)({
14
14
  if (!NUpload) {
15
15
  (0, _utils_1.throwError)('upload-file-list', '`n-upload-file-list` must be placed inside `n-upload`.');
16
16
  }
17
- const { mergedClsPrefixRef, listTypeRef, mergedFileListRef, fileListStyleRef, cssVarsRef, mergedDisabledRef } = NUpload;
17
+ const { mergedClsPrefixRef, listTypeRef, mergedFileListRef, fileListStyleRef, cssVarsRef } = NUpload;
18
18
  const isImageCardTypeRef = (0, vue_1.computed)(() => listTypeRef.value === 'image-card');
19
19
  const renderFileList = () => mergedFileListRef.value.map((file) => ((0, vue_1.h)(UploadFile_1.default, { clsPrefix: mergedClsPrefixRef.value, key: file.id, file: file, listType: listTypeRef.value })));
20
20
  const renderUploadFileList = () => isImageCardTypeRef.value ? ((0, vue_1.h)(image_1.NImageGroup, null, { default: renderFileList })) : ((0, vue_1.h)(_internal_1.NFadeInExpandTransition, { group: true }, {
@@ -24,8 +24,6 @@ exports.default = (0, vue_1.defineComponent)({
24
24
  const { value: mergedClsPrefix } = mergedClsPrefixRef;
25
25
  return ((0, vue_1.h)("div", { class: [
26
26
  `${mergedClsPrefix}-upload-file-list`,
27
- mergedDisabledRef.value &&
28
- `${mergedClsPrefix}-upload-file-list--disabled`,
29
27
  isImageCardTypeRef.value &&
30
28
  `${mergedClsPrefix}-upload-file-list--grid`
31
29
  ], style: [cssVarsRef.value, fileListStyleRef.value] },
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const vue_1 = require("vue");
4
+ const icons_1 = require("../../_internal/icons");
5
+ const _internal_1 = require("../../_internal");
4
6
  const _utils_1 = require("../../_utils");
5
7
  const interface_1 = require("./interface");
6
8
  const UploadDragger_1 = require("./UploadDragger");
@@ -14,10 +16,10 @@ exports.default = (0, vue_1.defineComponent)({
14
16
  if (!NUpload) {
15
17
  (0, _utils_1.throwError)('upload-trigger', '`n-upload-trigger` must be placed inside `n-upload`.');
16
18
  }
17
- const { mergedClsPrefixRef, mergedDisabledRef, listTypeRef, disabledRef, dragOverRef, openFileDialog, draggerInsideRef, handleFileAddition } = NUpload;
19
+ const { mergedClsPrefixRef, mergedDisabledRef, maxReachedRef, listTypeRef, dragOverRef, openFileDialog, draggerInsideRef, handleFileAddition } = NUpload;
18
20
  const isImageCardTypeRef = (0, vue_1.computed)(() => listTypeRef.value === 'image-card');
19
21
  function handleTriggerClick() {
20
- if (disabledRef.value)
22
+ if (mergedDisabledRef.value || maxReachedRef.value)
21
23
  return;
22
24
  openFileDialog();
23
25
  }
@@ -35,8 +37,11 @@ exports.default = (0, vue_1.defineComponent)({
35
37
  }
36
38
  function handleTriggerDrop(e) {
37
39
  e.preventDefault();
38
- if (!draggerInsideRef.value || disabledRef.value)
40
+ if (!draggerInsideRef.value ||
41
+ mergedDisabledRef.value ||
42
+ maxReachedRef.value) {
39
43
  return;
44
+ }
40
45
  const dataTransfer = e.dataTransfer;
41
46
  const files = dataTransfer === null || dataTransfer === void 0 ? void 0 : dataTransfer.files;
42
47
  if (files) {
@@ -55,11 +60,14 @@ exports.default = (0, vue_1.defineComponent)({
55
60
  handleDragLeave: handleTriggerDragLeave
56
61
  })) : ((0, vue_1.h)("div", { class: [
57
62
  `${mergedClsPrefix}-upload-trigger`,
58
- mergedDisabledRef.value &&
63
+ (mergedDisabledRef.value || maxReachedRef.value) &&
59
64
  `${mergedClsPrefix}-upload-trigger--disabled`,
60
65
  isImageCardTypeRef.value &&
61
66
  `${mergedClsPrefix}-upload-trigger--image-card`
62
- ], onClick: handleTriggerClick, onDrop: handleTriggerDrop, onDragover: handleTriggerDragOver, onDragenter: handleTriggerDragEnter, onDragleave: handleTriggerDragLeave }, isImageCardTypeRef.value ? ((0, vue_1.h)(UploadDragger_1.default, null, slots)) : (slots)));
67
+ ], onClick: handleTriggerClick, onDrop: handleTriggerDrop, onDragover: handleTriggerDragOver, onDragenter: handleTriggerDragEnter, onDragleave: handleTriggerDragLeave }, isImageCardTypeRef.value ? ((0, vue_1.h)(UploadDragger_1.default, null, {
68
+ default: slots.default ||
69
+ (() => ((0, vue_1.h)(_internal_1.NBaseIcon, { clsPrefix: mergedClsPrefix }, { default: () => (0, vue_1.h)(icons_1.AddIcon, null) })))
70
+ })) : (slots)));
63
71
  };
64
72
  }
65
73
  });
@@ -41,7 +41,6 @@ export declare type OnUpdateFileList = (fileList: FileInfo[]) => void;
41
41
  export interface UploadInjection {
42
42
  mergedClsPrefixRef: Ref<string>;
43
43
  mergedThemeRef: Ref<MergedTheme<UploadTheme>>;
44
- disabledRef: Ref<boolean>;
45
44
  showCancelButtonRef: Ref<boolean>;
46
45
  showRemoveButtonRef: Ref<boolean>;
47
46
  showDownloadButtonRef: Ref<boolean>;
@@ -60,6 +59,7 @@ export interface UploadInjection {
60
59
  };
61
60
  fileListStyleRef: Ref<string | CSSProperties | undefined>;
62
61
  mergedDisabledRef: Ref<boolean>;
62
+ maxReachedRef: Ref<boolean>;
63
63
  abstractRef: Ref<boolean>;
64
64
  cssVarsRef: Ref<CSSProperties>;
65
65
  submit: (fileId?: string) => void;
@@ -44,7 +44,9 @@ exports.default = (0, cssr_1.c)([(0, cssr_1.cB)('upload', [(0, cssr_1.cM)('dragg
44
44
  `), (0, cssr_1.cM)('image-card', `
45
45
  width: 96px;
46
46
  height: 96px;
47
- `, [(0, cssr_1.cB)('upload-dragger', `
47
+ `, [(0, cssr_1.cB)('base-icon', `
48
+ font-size: 24px;
49
+ `), (0, cssr_1.cB)('upload-dragger', `
48
50
  padding: 0;
49
51
  height: 100%;
50
52
  width: 100%;
package/lib/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- declare const _default: "2.19.7";
1
+ declare const _default: "2.19.11";
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.19.7';
3
+ exports.default = '2.19.11';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "naive-ui",
3
- "version": "2.19.7",
3
+ "version": "2.19.11",
4
4
  "description": "A Vue 3 Component Library. Fairly Complete, Customizable Themes, Uses TypeScript, Not Too Slow",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -96,13 +96,13 @@
96
96
  "eslint-plugin-markdown": "^2.0.0",
97
97
  "eslint-plugin-node": "^11.1.0",
98
98
  "eslint-plugin-promise": "^5.1.0",
99
- "eslint-plugin-standard": "^5.0.0",
100
99
  "eslint-plugin-vue": "^7.6.0",
101
100
  "express": "^4.17.1",
102
101
  "fs-extra": "^10.0.0",
103
102
  "husky": "^7.0.0",
104
103
  "inquirer": "^8.1.0",
105
104
  "jest": "^27.0.4",
105
+ "jest-canvas-mock": "^2.3.1",
106
106
  "lint-staged": "^11.0.0",
107
107
  "marked": "^3.0.2",
108
108
  "prettier": "^2.2.1",
@@ -133,7 +133,7 @@
133
133
  "treemate": "^0.3.8",
134
134
  "vdirs": "^0.1.4",
135
135
  "vfonts": "^0.1.0",
136
- "vooks": "^0.2.6",
136
+ "vooks": "^0.2.10",
137
137
  "vueuc": "^0.4.13"
138
138
  },
139
139
  "sideEffects": false,
@@ -148,5 +148,8 @@
148
148
  "ui framework",
149
149
  "ui",
150
150
  "vue"
151
- ]
151
+ ],
152
+ "publishConfig": {
153
+ "registry": "https://registry.npmjs.org/"
154
+ }
152
155
  }
package/web-types.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "$schema": "https://raw.githubusercontent.com/JetBrains/web-types/master/schema/web-types.json",
3
3
  "framework": "vue",
4
4
  "name": "naive-ui",
5
- "version": "2.19.7",
5
+ "version": "2.19.11",
6
6
  "contributions": {
7
7
  "html": {
8
8
  "tags": [
@@ -420,6 +420,15 @@
420
420
  "kind": "expression"
421
421
  }
422
422
  },
423
+ {
424
+ "name": "get-show",
425
+ "default": "-",
426
+ "description": "-",
427
+ "value": {
428
+ "type": "Function",
429
+ "kind": "expression"
430
+ }
431
+ },
423
432
  {
424
433
  "name": "size",
425
434
  "default": "-",
@@ -1062,6 +1071,15 @@
1062
1071
  "kind": "expression"
1063
1072
  }
1064
1073
  },
1074
+ {
1075
+ "name": "swatches",
1076
+ "default": "-",
1077
+ "description": "-",
1078
+ "value": {
1079
+ "type": "Array",
1080
+ "kind": "expression"
1081
+ }
1082
+ },
1065
1083
  {
1066
1084
  "name": "actions",
1067
1085
  "default": "-",
@@ -2009,6 +2027,15 @@
2009
2027
  "kind": "expression"
2010
2028
  }
2011
2029
  },
2030
+ {
2031
+ "name": "breakpoints",
2032
+ "default": "-",
2033
+ "description": "-",
2034
+ "value": {
2035
+ "type": "object",
2036
+ "kind": "expression"
2037
+ }
2038
+ },
2012
2039
  {
2013
2040
  "name": "as",
2014
2041
  "default": "-",
@@ -6695,6 +6722,15 @@
6695
6722
  "kind": "expression"
6696
6723
  }
6697
6724
  },
6725
+ {
6726
+ "name": "dropdown-props",
6727
+ "default": "-",
6728
+ "description": "-",
6729
+ "value": {
6730
+ "type": "object",
6731
+ "kind": "expression"
6732
+ }
6733
+ },
6698
6734
  {
6699
6735
  "name": "accordion",
6700
6736
  "default": "-",
@@ -9123,6 +9159,15 @@
9123
9159
  "kind": "expression"
9124
9160
  }
9125
9161
  },
9162
+ {
9163
+ "name": "input-props",
9164
+ "default": "-",
9165
+ "description": "-",
9166
+ "value": {
9167
+ "type": "object",
9168
+ "kind": "expression"
9169
+ }
9170
+ },
9126
9171
  {
9127
9172
  "name": "items",
9128
9173
  "default": "-",
@@ -9953,6 +9998,10 @@
9953
9998
  }
9954
9999
  ],
9955
10000
  "events": [
10001
+ {
10002
+ "name": "before-leave",
10003
+ "description": "-"
10004
+ },
9956
10005
  {
9957
10006
  "name": "add",
9958
10007
  "description": "-"
@@ -10463,6 +10512,15 @@
10463
10512
  "type": "number | Array",
10464
10513
  "kind": "expression"
10465
10514
  }
10515
+ },
10516
+ {
10517
+ "name": "use-12-hours",
10518
+ "default": "-",
10519
+ "description": "-",
10520
+ "value": {
10521
+ "type": "boolean",
10522
+ "kind": "expression"
10523
+ }
10466
10524
  }
10467
10525
  ],
10468
10526
  "events": [
@@ -12222,6 +12280,15 @@
12222
12280
  "type": "boolean",
12223
12281
  "kind": "expression"
12224
12282
  }
12283
+ },
12284
+ {
12285
+ "name": "max",
12286
+ "default": "-",
12287
+ "description": "-",
12288
+ "value": {
12289
+ "type": "number",
12290
+ "kind": "expression"
12291
+ }
12225
12292
  }
12226
12293
  ],
12227
12294
  "events": [