naive-ui 2.30.4 → 2.30.7

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 (192) hide show
  1. package/README.zh-CN.md +2 -2
  2. package/dist/index.js +2321 -1375
  3. package/dist/index.prod.js +2 -2
  4. package/es/_internal/close/src/Close.js +1 -1
  5. package/es/_internal/scrollbar/src/Scrollbar.js +1 -2
  6. package/es/_internal/selection/src/Selection.js +5 -3
  7. package/es/_utils/dom/index.d.ts +1 -0
  8. package/es/_utils/dom/index.js +1 -0
  9. package/es/_utils/dom/is-document.d.ts +1 -0
  10. package/es/_utils/dom/is-document.js +3 -0
  11. package/es/_utils/index.d.ts +2 -1
  12. package/es/_utils/index.js +2 -1
  13. package/es/_utils/vue/index.d.ts +2 -0
  14. package/es/_utils/vue/index.js +2 -0
  15. package/es/_utils/vue/is-node-v-show-false.d.ts +2 -0
  16. package/es/_utils/vue/is-node-v-show-false.js +6 -0
  17. package/es/{_internal/scrollbar/src/Wrapper.d.ts → _utils/vue/wrapper.d.ts} +0 -0
  18. package/es/{_internal/scrollbar/src/Wrapper.js → _utils/vue/wrapper.js} +0 -0
  19. package/es/back-top/src/BackTop.d.ts +1 -1
  20. package/es/back-top/src/BackTop.js +24 -31
  21. package/es/button/src/styles/index.cssr.js +3 -0
  22. package/es/color-picker/src/ColorInputUnit.js +1 -1
  23. package/es/data-table/src/DataTable.d.ts +5 -2
  24. package/es/data-table/src/DataTable.js +3 -2
  25. package/es/data-table/src/TableParts/Body.d.ts +1 -0
  26. package/es/data-table/src/TableParts/Body.js +5 -7
  27. package/es/data-table/src/TableParts/Cell.d.ts +11 -1
  28. package/es/data-table/src/TableParts/Cell.js +19 -6
  29. package/es/data-table/src/interface.d.ts +5 -2
  30. package/es/data-table/src/styles/index.cssr.js +7 -2
  31. package/es/data-table/src/use-check.js +11 -3
  32. package/es/date-picker/src/DatePicker.d.ts +40 -0
  33. package/es/date-picker/src/DatePicker.js +15 -3
  34. package/es/date-picker/src/config.d.ts +1 -1
  35. package/es/date-picker/src/panel/date.d.ts +4 -0
  36. package/es/date-picker/src/panel/daterange.d.ts +7 -1
  37. package/es/date-picker/src/panel/datetime.d.ts +4 -0
  38. package/es/date-picker/src/panel/datetimerange.d.ts +7 -1
  39. package/es/date-picker/src/panel/month.d.ts +4 -0
  40. package/es/date-picker/src/panel/monthrange.d.ts +11 -5
  41. package/es/date-picker/src/panel/monthrange.js +13 -7
  42. package/es/date-picker/src/panel/panelHeader.d.ts +8 -0
  43. package/es/date-picker/src/panel/use-calendar.d.ts +4 -0
  44. package/es/date-picker/src/panel/use-dual-calendar.d.ts +9 -3
  45. package/es/date-picker/src/panel/use-dual-calendar.js +26 -6
  46. package/es/date-picker/src/panel/use-panel-common.d.ts +4 -0
  47. package/es/date-picker/src/utils.d.ts +1 -1
  48. package/es/date-picker/src/utils.js +2 -2
  49. package/es/date-picker/styles/_common.d.ts +4 -0
  50. package/es/date-picker/styles/_common.js +5 -1
  51. package/es/date-picker/styles/light.d.ts +8 -0
  52. package/es/drawer/src/DrawerBodyWrapper.js +1 -1
  53. package/es/grid/src/Grid.d.ts +3 -0
  54. package/es/grid/src/Grid.js +47 -9
  55. package/es/grid/src/GridItem.js +2 -1
  56. package/es/image/src/Image.d.ts +10 -0
  57. package/es/image/src/Image.js +42 -8
  58. package/es/image/src/utils.d.ts +11 -0
  59. package/es/image/src/utils.js +81 -0
  60. package/es/input/src/styles/input-group-label.cssr.js +2 -0
  61. package/es/locales/common/viVN.d.ts +3 -0
  62. package/es/locales/common/viVN.js +113 -0
  63. package/es/locales/date/viVN.d.ts +3 -0
  64. package/es/locales/date/viVN.js +6 -0
  65. package/es/locales/index.d.ts +2 -0
  66. package/es/locales/index.js +2 -0
  67. package/es/modal/src/BodyWrapper.d.ts +13 -18
  68. package/es/modal/src/BodyWrapper.js +38 -33
  69. package/es/modal/src/Modal.js +12 -7
  70. package/es/modal/src/styles/index.cssr.js +1 -0
  71. package/es/notification/src/Notification.d.ts +3 -0
  72. package/es/notification/src/Notification.js +5 -2
  73. package/es/notification/src/NotificationContainer.d.ts +3 -0
  74. package/es/notification/src/NotificationProvider.d.ts +27 -0
  75. package/es/notification/src/styles/index.cssr.js +6 -3
  76. package/es/notification/styles/_common.d.ts +3 -0
  77. package/es/notification/styles/_common.js +4 -1
  78. package/es/notification/styles/light.d.ts +6 -0
  79. package/es/select/index.d.ts +1 -1
  80. package/es/select/src/Select.d.ts +4 -4
  81. package/es/select/src/Select.js +10 -1
  82. package/es/select/src/interface.d.ts +1 -0
  83. package/es/space/src/Space.d.ts +26 -0
  84. package/es/space/src/Space.js +53 -43
  85. package/es/tabs/src/Tabs.js +1 -1
  86. package/es/tooltip/index.d.ts +1 -1
  87. package/es/tree/src/Tree.d.ts +4 -3
  88. package/es/tree/src/Tree.js +2 -1
  89. package/es/tree/src/TreeNode.d.ts +1 -1
  90. package/es/tree/src/interface.d.ts +1 -1
  91. package/es/tree-select/index.d.ts +1 -1
  92. package/es/tree-select/src/TreeSelect.d.ts +27 -5
  93. package/es/tree-select/src/TreeSelect.js +19 -3
  94. package/es/tree-select/src/interface.d.ts +17 -1
  95. package/es/version.d.ts +1 -1
  96. package/es/version.js +1 -1
  97. package/lib/_internal/close/src/Close.js +1 -1
  98. package/lib/_internal/scrollbar/src/Scrollbar.js +2 -3
  99. package/lib/_internal/selection/src/Selection.js +4 -2
  100. package/lib/_utils/dom/index.d.ts +1 -0
  101. package/lib/_utils/dom/index.js +5 -0
  102. package/lib/_utils/dom/is-document.d.ts +1 -0
  103. package/lib/_utils/dom/is-document.js +7 -0
  104. package/lib/_utils/index.d.ts +2 -1
  105. package/lib/_utils/index.js +4 -1
  106. package/lib/_utils/vue/index.d.ts +2 -0
  107. package/lib/_utils/vue/index.js +5 -1
  108. package/lib/_utils/vue/is-node-v-show-false.d.ts +2 -0
  109. package/lib/_utils/vue/is-node-v-show-false.js +10 -0
  110. package/lib/{_internal/scrollbar/src/Wrapper.d.ts → _utils/vue/wrapper.d.ts} +0 -0
  111. package/lib/{_internal/scrollbar/src/Wrapper.js → _utils/vue/wrapper.js} +0 -0
  112. package/lib/back-top/src/BackTop.d.ts +1 -1
  113. package/lib/back-top/src/BackTop.js +23 -30
  114. package/lib/button/src/styles/index.cssr.js +3 -0
  115. package/lib/color-picker/src/ColorInputUnit.js +1 -1
  116. package/lib/data-table/src/DataTable.d.ts +5 -2
  117. package/lib/data-table/src/DataTable.js +3 -2
  118. package/lib/data-table/src/TableParts/Body.d.ts +1 -0
  119. package/lib/data-table/src/TableParts/Body.js +5 -7
  120. package/lib/data-table/src/TableParts/Cell.d.ts +11 -1
  121. package/lib/data-table/src/TableParts/Cell.js +19 -6
  122. package/lib/data-table/src/interface.d.ts +5 -2
  123. package/lib/data-table/src/styles/index.cssr.js +7 -2
  124. package/lib/data-table/src/use-check.js +11 -3
  125. package/lib/date-picker/src/DatePicker.d.ts +40 -0
  126. package/lib/date-picker/src/DatePicker.js +15 -3
  127. package/lib/date-picker/src/config.d.ts +1 -1
  128. package/lib/date-picker/src/panel/date.d.ts +4 -0
  129. package/lib/date-picker/src/panel/daterange.d.ts +7 -1
  130. package/lib/date-picker/src/panel/datetime.d.ts +4 -0
  131. package/lib/date-picker/src/panel/datetimerange.d.ts +7 -1
  132. package/lib/date-picker/src/panel/month.d.ts +4 -0
  133. package/lib/date-picker/src/panel/monthrange.d.ts +11 -5
  134. package/lib/date-picker/src/panel/monthrange.js +13 -7
  135. package/lib/date-picker/src/panel/panelHeader.d.ts +8 -0
  136. package/lib/date-picker/src/panel/use-calendar.d.ts +4 -0
  137. package/lib/date-picker/src/panel/use-dual-calendar.d.ts +9 -3
  138. package/lib/date-picker/src/panel/use-dual-calendar.js +24 -4
  139. package/lib/date-picker/src/panel/use-panel-common.d.ts +4 -0
  140. package/lib/date-picker/src/utils.d.ts +1 -1
  141. package/lib/date-picker/src/utils.js +2 -2
  142. package/lib/date-picker/styles/_common.d.ts +4 -0
  143. package/lib/date-picker/styles/_common.js +5 -1
  144. package/lib/date-picker/styles/light.d.ts +8 -0
  145. package/lib/drawer/src/DrawerBodyWrapper.js +1 -1
  146. package/lib/grid/src/Grid.d.ts +3 -0
  147. package/lib/grid/src/Grid.js +45 -7
  148. package/lib/grid/src/GridItem.js +2 -1
  149. package/lib/image/src/Image.d.ts +10 -0
  150. package/lib/image/src/Image.js +41 -7
  151. package/lib/image/src/utils.d.ts +11 -0
  152. package/lib/image/src/utils.js +86 -0
  153. package/lib/input/src/styles/input-group-label.cssr.js +2 -0
  154. package/lib/locales/common/viVN.d.ts +3 -0
  155. package/lib/locales/common/viVN.js +115 -0
  156. package/lib/locales/date/viVN.d.ts +3 -0
  157. package/lib/locales/date/viVN.js +11 -0
  158. package/lib/locales/index.d.ts +2 -0
  159. package/lib/locales/index.js +5 -1
  160. package/lib/modal/src/BodyWrapper.d.ts +13 -18
  161. package/lib/modal/src/BodyWrapper.js +38 -33
  162. package/lib/modal/src/Modal.js +12 -7
  163. package/lib/modal/src/styles/index.cssr.js +1 -0
  164. package/lib/notification/src/Notification.d.ts +3 -0
  165. package/lib/notification/src/Notification.js +5 -2
  166. package/lib/notification/src/NotificationContainer.d.ts +3 -0
  167. package/lib/notification/src/NotificationProvider.d.ts +27 -0
  168. package/lib/notification/src/styles/index.cssr.js +6 -3
  169. package/lib/notification/styles/_common.d.ts +3 -0
  170. package/lib/notification/styles/_common.js +4 -1
  171. package/lib/notification/styles/light.d.ts +6 -0
  172. package/lib/select/index.d.ts +1 -1
  173. package/lib/select/src/Select.d.ts +4 -4
  174. package/lib/select/src/Select.js +10 -1
  175. package/lib/select/src/interface.d.ts +1 -0
  176. package/lib/space/src/Space.d.ts +26 -0
  177. package/lib/space/src/Space.js +53 -43
  178. package/lib/tabs/src/Tabs.js +1 -1
  179. package/lib/tooltip/index.d.ts +1 -1
  180. package/lib/tree/src/Tree.d.ts +4 -3
  181. package/lib/tree/src/Tree.js +2 -1
  182. package/lib/tree/src/TreeNode.d.ts +1 -1
  183. package/lib/tree/src/interface.d.ts +1 -1
  184. package/lib/tree-select/index.d.ts +1 -1
  185. package/lib/tree-select/src/TreeSelect.d.ts +27 -5
  186. package/lib/tree-select/src/TreeSelect.js +19 -3
  187. package/lib/tree-select/src/interface.d.ts +17 -1
  188. package/lib/version.d.ts +1 -1
  189. package/lib/version.js +1 -1
  190. package/package.json +2 -2
  191. package/volar.d.ts +0 -1
  192. package/web-types.json +100 -10
@@ -117,6 +117,14 @@ function useDualCalendar(props, type) {
117
117
  const endYearArrayRef = (0, vue_1.computed)(() => {
118
118
  return (0, utils_1.yearArray)((0, utils_1.pluckValueFromRange)(props.value, 'end'), nowRef.value);
119
119
  });
120
+ const startQuarterArrayRef = (0, vue_1.computed)(() => {
121
+ const startValue = (0, utils_1.pluckValueFromRange)(props.value, 'start');
122
+ return (0, utils_1.quarterArray)(startValue !== null && startValue !== void 0 ? startValue : Date.now(), startValue, nowRef.value);
123
+ });
124
+ const endQuarterArrayRef = (0, vue_1.computed)(() => {
125
+ const endValue = (0, utils_1.pluckValueFromRange)(props.value, 'end');
126
+ return (0, utils_1.quarterArray)(endValue !== null && endValue !== void 0 ? endValue : Date.now(), endValue, nowRef.value);
127
+ });
120
128
  const startMonthArrayRef = (0, vue_1.computed)(() => {
121
129
  const startValue = (0, utils_1.pluckValueFromRange)(props.value, 'start');
122
130
  return (0, utils_1.monthArray)(startValue !== null && startValue !== void 0 ? startValue : Date.now(), startValue, nowRef.value);
@@ -545,11 +553,17 @@ function useDualCalendar(props, type) {
545
553
  function handleColItemClick(dateItem, clickType) {
546
554
  const { value } = props;
547
555
  const noCurrentValue = !Array.isArray(value);
548
- const itemTs = dateItem.type === 'year'
556
+ const itemTs = dateItem.type === 'year' && type !== 'yearrange'
549
557
  ? noCurrentValue
550
- ? (0, date_fns_1.set)(dateItem.ts, { month: (0, date_fns_1.getMonth)(new Date()) }).valueOf()
558
+ ? (0, date_fns_1.set)(dateItem.ts, {
559
+ month: (0, date_fns_1.getMonth)(type === 'quarterrange'
560
+ ? (0, date_fns_1.startOfQuarter)(new Date())
561
+ : new Date())
562
+ }).valueOf()
551
563
  : (0, date_fns_1.set)(dateItem.ts, {
552
- month: (0, date_fns_1.getMonth)(value[clickType === 'start' ? 0 : 1])
564
+ month: (0, date_fns_1.getMonth)(type === 'quarterrange'
565
+ ? (0, date_fns_1.startOfQuarter)(value[clickType === 'start' ? 0 : 1])
566
+ : value[clickType === 'start' ? 0 : 1])
553
567
  }).valueOf()
554
568
  : dateItem.ts;
555
569
  if (noCurrentValue) {
@@ -558,6 +572,7 @@ function useDualCalendar(props, type) {
558
572
  panelCommon.doUpdateValue(nextValue, props.panel);
559
573
  justifyColumnsScrollState(nextValue, 'start');
560
574
  justifyColumnsScrollState(nextValue, 'end');
575
+ panelCommon.disableTransitionOneTick();
561
576
  return;
562
577
  }
563
578
  const nextValue = [value[0], value[1]];
@@ -579,6 +594,7 @@ function useDualCalendar(props, type) {
579
594
  panelCommon.doUpdateValue(nextValue, props.panel);
580
595
  switch (type) {
581
596
  case 'monthrange':
597
+ case 'quarterrange':
582
598
  panelCommon.disableTransitionOneTick();
583
599
  if (otherPartsChanged) {
584
600
  justifyColumnsScrollState(nextValue, 'start');
@@ -588,6 +604,10 @@ function useDualCalendar(props, type) {
588
604
  justifyColumnsScrollState(nextValue, clickType);
589
605
  }
590
606
  break;
607
+ case 'yearrange':
608
+ panelCommon.disableTransitionOneTick();
609
+ justifyColumnsScrollState(nextValue, 'start');
610
+ justifyColumnsScrollState(nextValue, 'end');
591
611
  }
592
612
  }
593
613
  function handleStartYearVlScroll() {
@@ -640,7 +660,7 @@ function useDualCalendar(props, type) {
640
660
  endCalendarNextMonth,
641
661
  endCalendarNextYear,
642
662
  mergedIsDateDisabled,
643
- changeStartEndTime, ranges: rangesRef, startCalendarMonth: startCalendarMonthRef, startCalendarYear: startCalendarYearRef, endCalendarMonth: endCalendarMonthRef, endCalendarYear: endCalendarYearRef, weekdays: weekdaysRef, startDateArray: startDateArrayRef, endDateArray: endDateArrayRef, startYearArray: startYearArrayRef, startMonthArray: startMonthArrayRef, endYearArray: endYearArrayRef, endMonthArray: endMonthArrayRef, isSelecting: isSelectingRef, handleRangeShortcutMouseenter,
663
+ changeStartEndTime, ranges: rangesRef, startCalendarMonth: startCalendarMonthRef, startCalendarYear: startCalendarYearRef, endCalendarMonth: endCalendarMonthRef, endCalendarYear: endCalendarYearRef, weekdays: weekdaysRef, startDateArray: startDateArrayRef, endDateArray: endDateArrayRef, startYearArray: startYearArrayRef, startMonthArray: startMonthArrayRef, startQuarterArray: startQuarterArrayRef, endYearArray: endYearArrayRef, endMonthArray: endMonthArrayRef, endQuarterArray: endQuarterArrayRef, isSelecting: isSelectingRef, handleRangeShortcutMouseenter,
644
664
  handleRangeShortcutClick }, panelCommon), validation), childComponentRefs), {
645
665
  // datetimerangeonly
646
666
  startDateDisplayString: startDateInput, endDateInput: endDateInputRef, timePickerSize: panelCommon.timePickerSize, startTimeValue: startTimeValueRef, endTimeValue: endTimeValueRef, datePickerSlots, shortcuts: shortcutsRef, startCalendarDateTime: startCalendarDateTimeRef, endCalendarDateTime: endCalendarDateTimeRef, justifyColumnsScrollState, handleFocusDetectorFocus: panelCommon.handleFocusDetectorFocus, handleStartTimePickerChange,
@@ -183,6 +183,8 @@ declare function usePanelCommon(props: UsePanelCommonProps): {
183
183
  calendarLeftPaddingYear: string;
184
184
  calendarLeftPaddingQuarter: string;
185
185
  calendarLeftPaddingMonthrange: string;
186
+ calendarLeftPaddingQuarterrange: string;
187
+ calendarLeftPaddingYearrange: string;
186
188
  calendarRightPaddingDate: string;
187
189
  calendarRightPaddingDatetime: string;
188
190
  calendarRightPaddingDaterange: string;
@@ -191,6 +193,8 @@ declare function usePanelCommon(props: UsePanelCommonProps): {
191
193
  calendarRightPaddingYear: string;
192
194
  calendarRightPaddingQuarter: string;
193
195
  calendarRightPaddingMonthrange: string;
196
+ calendarRightPaddingQuarterrange: string;
197
+ calendarRightPaddingYearrange: string;
194
198
  };
195
199
  peers: {
196
200
  Input: import("../../../_mixins").Theme<"Input", {
@@ -51,7 +51,7 @@ export interface QuarterItem {
51
51
  */
52
52
  declare function dateArray(monthTs: number, valueTs: number | [number, number] | null, currentTs: number, startDay: 0 | 1 | 2 | 3 | 4 | 5 | 6, strip?: boolean): DateItem[];
53
53
  declare function monthArray(yearAnchorTs: number, valueTs: number | null, currentTs: number): MonthItem[];
54
- declare function quarterArray(quarterTs: number, valueTs: number | null, currentTs: number): QuarterItem[];
54
+ declare function quarterArray(yearAnchorTs: number, valueTs: number | null, currentTs: number): QuarterItem[];
55
55
  declare function yearArray(valueTs: number | null, currentTs: number): YearItem[];
56
56
  declare function strictParse(string: string, pattern: string, backup: Date, option: {
57
57
  locale: NDateLocale['locale'];
@@ -151,9 +151,9 @@ function monthArray(yearAnchorTs, valueTs, currentTs) {
151
151
  return calendarMonths;
152
152
  }
153
153
  exports.monthArray = monthArray;
154
- function quarterArray(quarterTs, valueTs, currentTs) {
154
+ function quarterArray(yearAnchorTs, valueTs, currentTs) {
155
155
  const calendarQuarters = [];
156
- const yearStart = (0, date_fns_1.startOfYear)(quarterTs);
156
+ const yearStart = (0, date_fns_1.startOfYear)(yearAnchorTs);
157
157
  for (let i = 0; i < 4; i++) {
158
158
  calendarQuarters.push(quarterItem((0, date_fns_1.getTime)((0, date_fns_1.addQuarters)(yearStart, i)), valueTs, currentTs));
159
159
  }
@@ -20,6 +20,8 @@ declare const _default: {
20
20
  calendarLeftPaddingYear: string;
21
21
  calendarLeftPaddingQuarter: string;
22
22
  calendarLeftPaddingMonthrange: string;
23
+ calendarLeftPaddingQuarterrange: string;
24
+ calendarLeftPaddingYearrange: string;
23
25
  calendarRightPaddingDate: string;
24
26
  calendarRightPaddingDatetime: string;
25
27
  calendarRightPaddingDaterange: string;
@@ -28,5 +30,7 @@ declare const _default: {
28
30
  calendarRightPaddingYear: string;
29
31
  calendarRightPaddingQuarter: string;
30
32
  calendarRightPaddingMonthrange: string;
33
+ calendarRightPaddingQuarterrange: string;
34
+ calendarRightPaddingYearrange: string;
31
35
  };
32
36
  export default _default;
@@ -23,6 +23,8 @@ exports.default = {
23
23
  calendarLeftPaddingYear: '0',
24
24
  calendarLeftPaddingQuarter: '0',
25
25
  calendarLeftPaddingMonthrange: '0',
26
+ calendarLeftPaddingQuarterrange: '0',
27
+ calendarLeftPaddingYearrange: '0',
26
28
  calendarRightPaddingDate: '6px 12px 4px 12px',
27
29
  calendarRightPaddingDatetime: '4px 12px',
28
30
  calendarRightPaddingDaterange: '6px 12px 4px 12px',
@@ -30,5 +32,7 @@ exports.default = {
30
32
  calendarRightPaddingMonth: '0',
31
33
  calendarRightPaddingYear: '0',
32
34
  calendarRightPaddingQuarter: '0',
33
- calendarRightPaddingMonthrange: '0'
35
+ calendarRightPaddingMonthrange: '0',
36
+ calendarRightPaddingQuarterrange: '0',
37
+ calendarRightPaddingYearrange: '0'
34
38
  };
@@ -49,6 +49,8 @@ export declare const self: (vars: ThemeCommonVars) => {
49
49
  calendarLeftPaddingYear: string;
50
50
  calendarLeftPaddingQuarter: string;
51
51
  calendarLeftPaddingMonthrange: string;
52
+ calendarLeftPaddingQuarterrange: string;
53
+ calendarLeftPaddingYearrange: string;
52
54
  calendarRightPaddingDate: string;
53
55
  calendarRightPaddingDatetime: string;
54
56
  calendarRightPaddingDaterange: string;
@@ -57,6 +59,8 @@ export declare const self: (vars: ThemeCommonVars) => {
57
59
  calendarRightPaddingYear: string;
58
60
  calendarRightPaddingQuarter: string;
59
61
  calendarRightPaddingMonthrange: string;
62
+ calendarRightPaddingQuarterrange: string;
63
+ calendarRightPaddingYearrange: string;
60
64
  };
61
65
  export declare type DatePickerThemeVars = ReturnType<typeof self>;
62
66
  declare const datePickerLight: import("../../_mixins").Theme<"DatePicker", {
@@ -109,6 +113,8 @@ declare const datePickerLight: import("../../_mixins").Theme<"DatePicker", {
109
113
  calendarLeftPaddingYear: string;
110
114
  calendarLeftPaddingQuarter: string;
111
115
  calendarLeftPaddingMonthrange: string;
116
+ calendarLeftPaddingQuarterrange: string;
117
+ calendarLeftPaddingYearrange: string;
112
118
  calendarRightPaddingDate: string;
113
119
  calendarRightPaddingDatetime: string;
114
120
  calendarRightPaddingDaterange: string;
@@ -117,6 +123,8 @@ declare const datePickerLight: import("../../_mixins").Theme<"DatePicker", {
117
123
  calendarRightPaddingYear: string;
118
124
  calendarRightPaddingQuarter: string;
119
125
  calendarRightPaddingMonthrange: string;
126
+ calendarRightPaddingQuarterrange: string;
127
+ calendarRightPaddingYearrange: string;
120
128
  }, {
121
129
  Input: import("../../_mixins").Theme<"Input", {
122
130
  countTextColor: string;
@@ -40,7 +40,7 @@ exports.default = (0, vue_1.defineComponent)({
40
40
  default: true
41
41
  },
42
42
  showMask: {
43
- type: Boolean,
43
+ type: [Boolean, String],
44
44
  required: true
45
45
  },
46
46
  onClickoutside: Function,
@@ -27,6 +27,7 @@ declare const gridProps: {
27
27
  };
28
28
  };
29
29
  export interface NGridInjection {
30
+ isSsrRef: Ref<boolean>;
30
31
  itemStyleRef: Ref<CSSProperties | string | undefined>;
31
32
  xGapRef: Ref<string | undefined>;
32
33
  overflowRef: Ref<boolean>;
@@ -57,6 +58,8 @@ declare const _default: import("vue").DefineComponent<{
57
58
  readonly default: 0;
58
59
  };
59
60
  }, {
61
+ isSsr: boolean;
62
+ contentEl: Ref<HTMLElement | undefined>;
60
63
  mergedClsPrefix: import("vue").ComputedRef<string>;
61
64
  style: import("vue").ComputedRef<CSSProperties>;
62
65
  isResponsive: import("vue").ComputedRef<boolean>;
@@ -9,6 +9,7 @@ const _mixins_1 = require("../../_mixins");
9
9
  const _utils_1 = require("../../_utils");
10
10
  const config_2 = require("./config");
11
11
  const defaultCols = 24;
12
+ const SSR_ATTR_NAME = '__ssr__';
12
13
  const gridProps = {
13
14
  responsive: {
14
15
  type: [String, Boolean],
@@ -79,12 +80,27 @@ exports.default = (0, vue_1.defineComponent)({
79
80
  }
80
81
  return undefined;
81
82
  });
83
+ // for SSR, fix bug https://github.com/TuSimple/naive-ui/issues/2462
84
+ const isSsrRef = (0, vue_1.ref)(false);
85
+ const contentElRef = (0, vue_1.ref)();
86
+ (0, vue_1.onMounted)(() => {
87
+ const { value: contentEl } = contentElRef;
88
+ if (contentEl) {
89
+ if (contentEl.hasAttribute(SSR_ATTR_NAME)) {
90
+ contentEl.removeAttribute(SSR_ATTR_NAME);
91
+ isSsrRef.value = true;
92
+ }
93
+ }
94
+ });
82
95
  (0, vue_1.provide)(config_2.gridInjectionKey, {
96
+ isSsrRef,
83
97
  itemStyleRef: (0, vue_1.toRef)(props, 'itemStyle'),
84
98
  xGapRef: responsiveXGapRef,
85
99
  overflowRef
86
100
  });
87
101
  return {
102
+ isSsr: !_utils_1.isBrowser,
103
+ contentEl: contentElRef,
88
104
  mergedClsPrefix: mergedClsPrefixRef,
89
105
  style: (0, vue_1.computed)(() => {
90
106
  return {
@@ -104,7 +120,7 @@ exports.default = (0, vue_1.defineComponent)({
104
120
  },
105
121
  render() {
106
122
  const renderContent = () => {
107
- var _a, _b, _c, _d, _e, _f;
123
+ var _a, _b, _c, _d, _e, _f, _g;
108
124
  this.overflow = false;
109
125
  // render will be called twice when mounted, I can't figure out why
110
126
  // 2 jobs will be pushed into job queues with same id, and then be flushed
@@ -112,11 +128,28 @@ exports.default = (0, vue_1.defineComponent)({
112
128
  const childrenAndRawSpan = [];
113
129
  const { collapsed, collapsedRows, responsiveCols, responsiveQuery } = this;
114
130
  rawChildren.forEach((child) => {
115
- var _a, _b, _c;
131
+ var _a, _b, _c, _d;
116
132
  if (((_a = child === null || child === void 0 ? void 0 : child.type) === null || _a === void 0 ? void 0 : _a.__GRID_ITEM__) !== true)
117
133
  return;
134
+ if ((0, _utils_1.isNodeVShowFalse)(child)) {
135
+ const clonedNode = (0, vue_1.cloneVNode)(child);
136
+ if (clonedNode.props) {
137
+ clonedNode.props.privateShow = false;
138
+ }
139
+ else {
140
+ clonedNode.props = { privateShow: false };
141
+ }
142
+ childrenAndRawSpan.push({
143
+ child: clonedNode,
144
+ rawChildSpan: 0
145
+ });
146
+ return;
147
+ }
148
+ // We don't want v-show to control display, so we need to stripe it
149
+ // here, nor it may mess child's style
150
+ child.dirs = ((_b = child.dirs) === null || _b === void 0 ? void 0 : _b.filter(({ dir }) => dir !== vue_1.vShow)) || null;
118
151
  const clonedChild = (0, vue_1.cloneVNode)(child);
119
- const rawChildSpan = Number((_c = (0, seemly_1.parseResponsivePropValue)((_b = clonedChild.props) === null || _b === void 0 ? void 0 : _b.span, responsiveQuery)) !== null && _c !== void 0 ? _c : config_2.defaultSpan);
152
+ const rawChildSpan = Number((_d = (0, seemly_1.parseResponsivePropValue)((_c = clonedChild.props) === null || _c === void 0 ? void 0 : _c.span, responsiveQuery)) !== null && _d !== void 0 ? _d : config_2.defaultSpan);
120
153
  if (rawChildSpan === 0)
121
154
  return;
122
155
  childrenAndRawSpan.push({
@@ -133,7 +166,8 @@ exports.default = (0, vue_1.defineComponent)({
133
166
  maybeSuffixNode.props.privateSpan = suffixSpan;
134
167
  maybeSuffixNode.props.privateColStart =
135
168
  responsiveCols + 1 - suffixSpan;
136
- maybeSuffixNode.props.privateShow = true;
169
+ maybeSuffixNode.props.privateShow =
170
+ (_e = maybeSuffixNode.props.privateShow) !== null && _e !== void 0 ? _e : true;
137
171
  }
138
172
  }
139
173
  let spanCounter = 0;
@@ -143,8 +177,9 @@ exports.default = (0, vue_1.defineComponent)({
143
177
  this.overflow = true;
144
178
  }
145
179
  if (!done) {
146
- const childOffset = Number((_f = (0, seemly_1.parseResponsivePropValue)((_e = child.props) === null || _e === void 0 ? void 0 : _e.offset, responsiveQuery)) !== null && _f !== void 0 ? _f : 0);
147
- const childSpan = Math.min(rawChildSpan + childOffset, responsiveCols) || 1;
180
+ const childOffset = Number((_g = (0, seemly_1.parseResponsivePropValue)((_f = child.props) === null || _f === void 0 ? void 0 : _f.offset, responsiveQuery)) !== null && _g !== void 0 ? _g : 0);
181
+ // it could be 0 sometimes (v-show = false)
182
+ const childSpan = Math.min(rawChildSpan + childOffset, responsiveCols);
148
183
  if (!child.props) {
149
184
  child.props = {
150
185
  privateSpan: childSpan,
@@ -171,6 +206,7 @@ exports.default = (0, vue_1.defineComponent)({
171
206
  }
172
207
  if (done) {
173
208
  if (child.props) {
209
+ // suffix node's privateShow may be true
174
210
  if (child.props.privateShow !== true) {
175
211
  child.props.privateShow = false;
176
212
  }
@@ -183,8 +219,10 @@ exports.default = (0, vue_1.defineComponent)({
183
219
  }
184
220
  }
185
221
  return (0, vue_1.h)('div', (0, vue_1.mergeProps)({
222
+ ref: 'contentEl',
186
223
  class: `${this.mergedClsPrefix}-grid`,
187
- style: this.style
224
+ style: this.style,
225
+ [SSR_ATTR_NAME]: this.isSsr || undefined
188
226
  }, this.$attrs), childrenAndRawSpan.map(({ child }) => child));
189
227
  };
190
228
  return this.isResponsive && this.responsive === 'self' ? ((0, vue_1.h)(vueuc_1.VResizeObserver, { onResize: this.handleResize }, {
@@ -32,7 +32,7 @@ exports.default = (0, vue_1.defineComponent)({
32
32
  alias: ['Gi'],
33
33
  props: exports.gridItemProps,
34
34
  setup() {
35
- const { xGapRef, itemStyleRef, overflowRef
35
+ const { isSsrRef, xGapRef, itemStyleRef, overflowRef
36
36
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
37
37
  } = (0, vue_1.inject)(config_1.gridInjectionKey);
38
38
  const self = (0, vue_1.getCurrentInstance)();
@@ -40,6 +40,7 @@ exports.default = (0, vue_1.defineComponent)({
40
40
  overflow: overflowRef,
41
41
  itemStyle: itemStyleRef,
42
42
  deriveStyle: () => {
43
+ void isSsrRef.value;
43
44
  // Here is quite a hack, I hope there is a better way to solve it
44
45
  const { privateSpan = exports.defaultSpan, privateShow = true, privateColStart = undefined, privateOffset = 0
45
46
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
@@ -1,5 +1,6 @@
1
1
  import { PropType, ImgHTMLAttributes } from 'vue';
2
2
  import type { ExtractPublicPropTypes } from '../../_utils';
3
+ import type { IntersectionObserverOptions } from './utils';
3
4
  export interface ImageInst {
4
5
  click: () => void;
5
6
  }
@@ -99,6 +100,8 @@ declare const imageProps: {
99
100
  alt: StringConstructor;
100
101
  height: PropType<string | number>;
101
102
  imgProps: PropType<ImgHTMLAttributes>;
103
+ lazy: BooleanConstructor;
104
+ intersectionObserverOptions: PropType<IntersectionObserverOptions>;
102
105
  objectFit: {
103
106
  type: PropType<"fill" | "none" | "contain" | "cover" | "scale-down">;
104
107
  default: string;
@@ -209,6 +212,8 @@ declare const _default: import("vue").DefineComponent<{
209
212
  alt: StringConstructor;
210
213
  height: PropType<string | number>;
211
214
  imgProps: PropType<ImgHTMLAttributes>;
215
+ lazy: BooleanConstructor;
216
+ intersectionObserverOptions: PropType<IntersectionObserverOptions>;
212
217
  objectFit: {
213
218
  type: PropType<"fill" | "none" | "contain" | "cover" | "scale-down">;
214
219
  default: string;
@@ -233,6 +238,8 @@ declare const _default: import("vue").DefineComponent<{
233
238
  imageRef: import("vue").Ref<HTMLImageElement | null>;
234
239
  imgProps: import("vue").Ref<ImgHTMLAttributes | undefined>;
235
240
  showError: import("vue").Ref<boolean>;
241
+ shouldStartLoading: import("vue").Ref<boolean>;
242
+ loaded: import("vue").Ref<boolean>;
236
243
  mergedOnError: (e: Event) => void;
237
244
  mergedOnLoad: (e: Event) => void;
238
245
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
@@ -331,6 +338,8 @@ declare const _default: import("vue").DefineComponent<{
331
338
  alt: StringConstructor;
332
339
  height: PropType<string | number>;
333
340
  imgProps: PropType<ImgHTMLAttributes>;
341
+ lazy: BooleanConstructor;
342
+ intersectionObserverOptions: PropType<IntersectionObserverOptions>;
334
343
  objectFit: {
335
344
  type: PropType<"fill" | "none" | "contain" | "cover" | "scale-down">;
336
345
  default: string;
@@ -344,6 +353,7 @@ declare const _default: import("vue").DefineComponent<{
344
353
  onError: PropType<(e: Event) => void>;
345
354
  onLoad: PropType<(e: Event) => void>;
346
355
  }>>, {
356
+ lazy: boolean;
347
357
  objectFit: "fill" | "none" | "contain" | "cover" | "scale-down";
348
358
  showToolbar: boolean;
349
359
  showToolbarTooltip: boolean;
@@ -8,7 +8,8 @@ const ImagePreview_1 = __importDefault(require("./ImagePreview"));
8
8
  const ImageGroup_1 = require("./ImageGroup");
9
9
  const _mixins_1 = require("../../_mixins");
10
10
  const interface_1 = require("./interface");
11
- const imageProps = Object.assign({ alt: String, height: [String, Number], imgProps: Object, objectFit: {
11
+ const utils_1 = require("./utils");
12
+ const imageProps = Object.assign({ alt: String, height: [String, Number], imgProps: Object, lazy: Boolean, intersectionObserverOptions: Object, objectFit: {
12
13
  type: String,
13
14
  default: 'fill'
14
15
  }, previewSrc: String, fallbackSrc: String, width: [String, Number], src: String, previewDisabled: Boolean, loadDescription: String, onError: Function, onLoad: Function }, interface_1.imagePreviewSharedProps);
@@ -42,18 +43,36 @@ exports.default = (0, vue_1.defineComponent)({
42
43
  previewInst.toggleShow();
43
44
  }
44
45
  };
46
+ const shouldStartLoadingRef = (0, vue_1.ref)(!props.lazy);
45
47
  (0, vue_1.onMounted)(() => {
46
48
  var _a;
47
49
  (_a = imageRef.value) === null || _a === void 0 ? void 0 : _a.setAttribute('data-group-id', (imageGroupHandle === null || imageGroupHandle === void 0 ? void 0 : imageGroupHandle.groupId) || '');
48
50
  });
51
+ (0, vue_1.onMounted)(() => {
52
+ let unobserve;
53
+ const stopWatchHandle = (0, vue_1.watchEffect)(() => {
54
+ unobserve === null || unobserve === void 0 ? void 0 : unobserve();
55
+ unobserve = undefined;
56
+ if (props.lazy) {
57
+ unobserve = (0, utils_1.observeIntersection)(imageRef.value, props.intersectionObserverOptions, shouldStartLoadingRef);
58
+ }
59
+ });
60
+ (0, vue_1.onBeforeUnmount)(() => {
61
+ stopWatchHandle();
62
+ unobserve === null || unobserve === void 0 ? void 0 : unobserve();
63
+ });
64
+ });
49
65
  (0, vue_1.watchEffect)(() => {
50
66
  var _a;
51
67
  void props.src;
52
68
  void ((_a = props.imgProps) === null || _a === void 0 ? void 0 : _a.src);
53
69
  showErrorRef.value = false;
54
70
  });
71
+ const loadedRef = (0, vue_1.ref)(false);
55
72
  return Object.assign({ mergedClsPrefix: mergedClsPrefixRef, groupId: imageGroupHandle === null || imageGroupHandle === void 0 ? void 0 : imageGroupHandle.groupId, previewInstRef,
56
- imageRef, imgProps: imgPropsRef, showError: showErrorRef, mergedOnError: (e) => {
73
+ imageRef, imgProps: imgPropsRef, showError: showErrorRef, shouldStartLoading: shouldStartLoadingRef, loaded: loadedRef, mergedOnError: (e) => {
74
+ if (!shouldStartLoadingRef.value)
75
+ return;
57
76
  showErrorRef.value = true;
58
77
  const { onError, imgProps: { onError: imgPropsOnError } = {} } = props;
59
78
  onError === null || onError === void 0 ? void 0 : onError(e);
@@ -62,18 +81,33 @@ exports.default = (0, vue_1.defineComponent)({
62
81
  const { onLoad, imgProps: { onLoad: imgPropsOnLoad } = {} } = props;
63
82
  onLoad === null || onLoad === void 0 ? void 0 : onLoad(e);
64
83
  imgPropsOnLoad === null || imgPropsOnLoad === void 0 ? void 0 : imgPropsOnLoad(e);
84
+ loadedRef.value = true;
65
85
  } }, exposedMethods);
66
86
  },
67
87
  render() {
68
- const { mergedClsPrefix, imgProps = {}, $attrs } = this;
69
- const imgNode = ((0, vue_1.h)("img", Object.assign({}, imgProps, { class: imgProps.class, ref: "imageRef", width: this.width || imgProps.width, height: this.height || imgProps.height, src: this.showError ? this.fallbackSrc : this.src || imgProps.src, alt: this.alt || imgProps.alt, "aria-label": this.alt || imgProps.alt, onClick: this.click, onError: this.mergedOnError, onLoad: this.mergedOnLoad, style: [imgProps.style || '', { objectFit: this.objectFit }], "data-error": this.showError, "data-preview-src": this.previewSrc || this.src })));
88
+ var _a, _b;
89
+ const { mergedClsPrefix, imgProps = {}, loaded, $attrs } = this;
90
+ const placeholderNode = (_b = (_a = this.$slots).placeholder) === null || _b === void 0 ? void 0 : _b.call(_a);
91
+ const imgNode = ((0, vue_1.h)("img", Object.assign({}, imgProps, { class: imgProps.class, ref: "imageRef", width: this.width || imgProps.width, height: this.height || imgProps.height, src: this.showError
92
+ ? this.fallbackSrc
93
+ : this.shouldStartLoading
94
+ ? this.src || imgProps.src
95
+ : undefined, alt: this.alt || imgProps.alt, "aria-label": this.alt || imgProps.alt, onClick: this.click, onError: this.mergedOnError, onLoad: this.mergedOnLoad, style: [
96
+ imgProps.style || '',
97
+ placeholderNode && !loaded
98
+ ? { height: '0', width: '0', visibility: 'hidden' }
99
+ : '',
100
+ { objectFit: this.objectFit }
101
+ ], "data-error": this.showError, "data-preview-src": this.previewSrc || this.src })));
70
102
  return ((0, vue_1.h)("div", Object.assign({}, $attrs, { role: "none", class: [
71
103
  $attrs.class,
72
104
  `${mergedClsPrefix}-image`,
73
105
  (this.previewDisabled || this.showError) &&
74
106
  `${mergedClsPrefix}-image--preview-disabled`
75
- ] }), this.groupId ? (imgNode) : ((0, vue_1.h)(ImagePreview_1.default, { theme: this.theme, themeOverrides: this.themeOverrides, clsPrefix: mergedClsPrefix, ref: "previewInstRef", showToolbar: this.showToolbar, showToolbarTooltip: this.showToolbarTooltip }, {
76
- default: () => imgNode
77
- }))));
107
+ ] }),
108
+ this.groupId ? (imgNode) : ((0, vue_1.h)(ImagePreview_1.default, { theme: this.theme, themeOverrides: this.themeOverrides, clsPrefix: mergedClsPrefix, ref: "previewInstRef", showToolbar: this.showToolbar, showToolbarTooltip: this.showToolbarTooltip }, {
109
+ default: () => imgNode
110
+ })),
111
+ !loaded && placeholderNode));
78
112
  }
79
113
  });
@@ -0,0 +1,11 @@
1
+ import { Ref } from 'vue';
2
+ export declare type IntersectionObserverOptions = Omit<IntersectionObserverInit, 'root'> & {
3
+ root?: Element | Document | null | string;
4
+ };
5
+ export declare const resolveOptionsAndHash: (options?: IntersectionObserverOptions | undefined) => {
6
+ hash: string;
7
+ options: Omit<IntersectionObserverInit, "root"> & {
8
+ root: Element | Document;
9
+ };
10
+ };
11
+ export declare const observeIntersection: (el: HTMLImageElement | null, options: IntersectionObserverOptions | undefined, shouldStartLoadingRef: Ref<boolean>) => () => void;
@@ -0,0 +1,86 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.observeIntersection = exports.resolveOptionsAndHash = void 0;
4
+ const resolveOptionsAndHash = (options = {}) => {
5
+ var _a;
6
+ const { root = null } = options;
7
+ return {
8
+ hash: `${options.rootMargin || '0px 0px 0px 0px'}-${Array.isArray(options.threshold)
9
+ ? options.threshold.join(',')
10
+ : (_a = options.threshold) !== null && _a !== void 0 ? _a : '0'}`,
11
+ options: Object.assign(Object.assign({}, options), { root: (typeof root === 'string' ? document.querySelector(root) : root) ||
12
+ document.documentElement })
13
+ };
14
+ };
15
+ exports.resolveOptionsAndHash = resolveOptionsAndHash;
16
+ // root -> options -> [observer, elements]
17
+ const observers = new WeakMap();
18
+ const unobserveHandleMap = new WeakMap();
19
+ const shouldStartLoadingRefMap = new WeakMap();
20
+ const observeIntersection = (el, options, shouldStartLoadingRef) => {
21
+ if (!el)
22
+ return () => { };
23
+ const resolvedOptionsAndHash = (0, exports.resolveOptionsAndHash)(options);
24
+ const { root } = resolvedOptionsAndHash.options;
25
+ let rootObservers;
26
+ const _rootObservers = observers.get(root);
27
+ if (_rootObservers) {
28
+ rootObservers = _rootObservers;
29
+ }
30
+ else {
31
+ rootObservers = new Map();
32
+ observers.set(root, rootObservers);
33
+ }
34
+ let observer;
35
+ let observerAndObservedElements;
36
+ if (rootObservers.has(resolvedOptionsAndHash.hash)) {
37
+ observerAndObservedElements =
38
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
39
+ rootObservers.get(resolvedOptionsAndHash.hash);
40
+ if (!observerAndObservedElements[1].has(el)) {
41
+ observer = observerAndObservedElements[0];
42
+ observerAndObservedElements[1].add(el);
43
+ observer.observe(el);
44
+ }
45
+ }
46
+ else {
47
+ observer = new IntersectionObserver((entries) => {
48
+ entries.forEach((entry) => {
49
+ if (entry.isIntersecting) {
50
+ const _unobserve = unobserveHandleMap.get(entry.target);
51
+ const _shouldStartLoadingRef = shouldStartLoadingRefMap.get(entry.target);
52
+ if (_unobserve)
53
+ _unobserve();
54
+ if (_shouldStartLoadingRef) {
55
+ _shouldStartLoadingRef.value = true;
56
+ }
57
+ }
58
+ });
59
+ }, resolvedOptionsAndHash.options);
60
+ observer.observe(el);
61
+ observerAndObservedElements = [observer, new Set([el])];
62
+ rootObservers.set(resolvedOptionsAndHash.hash, observerAndObservedElements);
63
+ }
64
+ let unobservered = false;
65
+ const unobserve = () => {
66
+ if (unobservered)
67
+ return;
68
+ unobserveHandleMap.delete(el);
69
+ shouldStartLoadingRefMap.delete(el);
70
+ unobservered = true;
71
+ if (observerAndObservedElements[1].has(el)) {
72
+ observerAndObservedElements[0].unobserve(el);
73
+ observerAndObservedElements[1].delete(el);
74
+ }
75
+ if (observerAndObservedElements[1].size <= 0) {
76
+ rootObservers.delete(resolvedOptionsAndHash.hash);
77
+ }
78
+ if (!rootObservers.size) {
79
+ observers.delete(root);
80
+ }
81
+ };
82
+ unobserveHandleMap.set(el, unobserve);
83
+ shouldStartLoadingRefMap.set(el, shouldStartLoadingRef);
84
+ return unobserve;
85
+ };
86
+ exports.observeIntersection = observeIntersection;
@@ -26,6 +26,8 @@ exports.default = (0, cssr_1.cB)('input-group-label', `
26
26
  font-size: var(--n-font-size);
27
27
  line-height: var(--n-height);
28
28
  height: var(--n-height);
29
+ flex-shrink: 0;
30
+ white-space: nowrap;
29
31
  transition:
30
32
  color .3s var(--n-bezier),
31
33
  background-color .3s var(--n-bezier),
@@ -0,0 +1,3 @@
1
+ import type { NLocale } from './enUS';
2
+ declare const viVN: NLocale;
3
+ export default viVN;