naive-ui 2.30.2 → 2.30.3

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 (90) hide show
  1. package/dist/index.js +96788 -0
  2. package/dist/index.prod.js +9 -0
  3. package/es/_internal/clear/src/Clear.js +1 -1
  4. package/es/_internal/close/index.d.ts +1 -1
  5. package/es/_internal/close/index.js +1 -1
  6. package/es/_internal/close/src/Close.js +1 -1
  7. package/es/_internal/icon/index.d.ts +1 -1
  8. package/es/_internal/icon/index.js +1 -1
  9. package/es/_internal/index.d.ts +2 -2
  10. package/es/_internal/index.js +2 -2
  11. package/es/_internal/select-menu/src/SelectOption.js +1 -1
  12. package/es/_internal/selection/src/Selection.js +12 -23
  13. package/es/_internal/suffix/src/Suffix.js +1 -1
  14. package/es/_utils/composable/use-browser-location.js +2 -2
  15. package/es/_utils/composable/use-houdini.js +2 -1
  16. package/es/_utils/composable/use-is-composing.js +2 -1
  17. package/es/_utils/env/is-browser.d.ts +1 -0
  18. package/es/_utils/env/is-browser.js +1 -0
  19. package/es/_utils/index.d.ts +1 -0
  20. package/es/_utils/index.js +1 -0
  21. package/es/_utils/naive/index.d.ts +0 -1
  22. package/es/_utils/naive/index.js +0 -1
  23. package/es/button/src/styles/index.cssr.js +3 -2
  24. package/es/calendar/src/Calendar.js +14 -5
  25. package/es/cascader/src/Cascader.js +31 -1
  26. package/es/drawer/src/Drawer.js +1 -1
  27. package/es/empty/src/Empty.js +1 -1
  28. package/es/index.d.ts +1 -1
  29. package/es/index.js +1 -1
  30. package/es/jest-setup.d.ts +1 -0
  31. package/es/jest-setup.js +2 -2
  32. package/es/mention/src/utils.js +1 -1
  33. package/es/preset.d.ts +3 -2
  34. package/es/preset.js +3 -1
  35. package/es/space/src/Space.d.ts +1 -0
  36. package/es/space/src/Space.js +43 -38
  37. package/es/space/src/utils.d.ts +1 -0
  38. package/es/space/src/utils.js +22 -0
  39. package/es/tag/src/Tag.js +1 -1
  40. package/es/tree/src/utils.js +2 -1
  41. package/es/upload/src/utils.js +2 -4
  42. package/es/version.d.ts +1 -1
  43. package/es/version.js +1 -1
  44. package/lib/_internal/clear/src/Clear.js +2 -2
  45. package/lib/_internal/close/index.d.ts +1 -1
  46. package/lib/_internal/close/index.js +2 -2
  47. package/lib/_internal/close/src/Close.js +2 -2
  48. package/lib/_internal/icon/index.d.ts +1 -1
  49. package/lib/_internal/icon/index.js +2 -2
  50. package/lib/_internal/index.d.ts +2 -2
  51. package/lib/_internal/index.js +2 -2
  52. package/lib/_internal/select-menu/src/SelectOption.js +2 -5
  53. package/lib/_internal/selection/src/Selection.js +12 -23
  54. package/lib/_internal/suffix/src/Suffix.js +2 -2
  55. package/lib/_utils/composable/use-browser-location.js +2 -2
  56. package/lib/_utils/composable/use-houdini.js +2 -1
  57. package/lib/_utils/composable/use-is-composing.js +2 -1
  58. package/lib/_utils/env/is-browser.d.ts +1 -0
  59. package/lib/_utils/env/is-browser.js +4 -0
  60. package/lib/_utils/index.d.ts +1 -0
  61. package/lib/_utils/index.js +3 -1
  62. package/lib/_utils/naive/index.d.ts +0 -1
  63. package/lib/_utils/naive/index.js +0 -15
  64. package/lib/button/src/styles/index.cssr.js +4 -2
  65. package/lib/calendar/src/Calendar.js +14 -5
  66. package/lib/cascader/src/Cascader.js +30 -0
  67. package/lib/drawer/src/Drawer.js +1 -1
  68. package/lib/empty/src/Empty.js +2 -2
  69. package/lib/index.d.ts +1 -1
  70. package/lib/index.js +2 -1
  71. package/lib/jest-setup.d.ts +1 -0
  72. package/lib/jest-setup.js +3 -1
  73. package/lib/mention/src/utils.js +2 -2
  74. package/lib/preset.d.ts +3 -2
  75. package/lib/preset.js +4 -1
  76. package/lib/space/src/Space.d.ts +1 -0
  77. package/lib/space/src/Space.js +43 -38
  78. package/lib/space/src/utils.d.ts +1 -0
  79. package/lib/space/src/utils.js +26 -0
  80. package/lib/tag/src/Tag.js +2 -2
  81. package/lib/tree/src/utils.js +2 -1
  82. package/lib/upload/src/utils.js +2 -4
  83. package/lib/version.d.ts +1 -1
  84. package/lib/version.js +1 -1
  85. package/package.json +14 -4
  86. package/web-types.json +2 -2
  87. package/es/_utils/naive/window.d.ts +0 -1
  88. package/es/_utils/naive/window.js +0 -1
  89. package/lib/_utils/naive/window.d.ts +0 -1
  90. package/lib/_utils/naive/window.js +0 -4
@@ -2,7 +2,7 @@ import { h, defineComponent, toRef } from 'vue';
2
2
  import { resolveSlot } from '../../../_utils';
3
3
  import { useStyle } from '../../../_mixins';
4
4
  import { ClearIcon } from '../../icons';
5
- import NBaseIcon from '../../icon';
5
+ import { NBaseIcon } from '../../icon';
6
6
  import NIconSwitchTransition from '../../icon-switch-transition';
7
7
  import style from './styles/index.cssr';
8
8
  export default defineComponent({
@@ -1 +1 @@
1
- export { default } from './src/Close';
1
+ export { default as NBaseClose } from './src/Close';
@@ -1 +1 @@
1
- export { default } from './src/Close';
1
+ export { default as NBaseClose } from './src/Close';
@@ -1,6 +1,6 @@
1
1
  import { h, defineComponent, toRef } from 'vue';
2
2
  import { useStyle } from '../../../_mixins';
3
- import NBaseIcon from '../../icon';
3
+ import { NBaseIcon } from '../../icon';
4
4
  import { CloseIcon } from '../../icons';
5
5
  import style from './styles/index.cssr';
6
6
  export default defineComponent({
@@ -1 +1 @@
1
- export { default } from './src/Icon';
1
+ export { default as NBaseIcon } from './src/Icon';
@@ -1 +1 @@
1
- export { default } from './src/Icon';
1
+ export { default as NBaseIcon } from './src/Icon';
@@ -1,7 +1,7 @@
1
1
  export { default as NIconSwitchTransition } from './icon-switch-transition';
2
2
  export { default as NFadeInExpandTransition } from './fade-in-expand-transition';
3
- export { default as NBaseClose } from './close';
4
- export { default as NBaseIcon } from './icon';
3
+ export { NBaseClose } from './close';
4
+ export { NBaseIcon } from './icon';
5
5
  export { default as NBaseFocusDetector } from './focus-detector';
6
6
  export { default as NBaseLoading } from './loading';
7
7
  export { default as NInternalSelectMenu } from './select-menu';
@@ -1,7 +1,7 @@
1
1
  export { default as NIconSwitchTransition } from './icon-switch-transition';
2
2
  export { default as NFadeInExpandTransition } from './fade-in-expand-transition';
3
- export { default as NBaseClose } from './close';
4
- export { default as NBaseIcon } from './icon';
3
+ export { NBaseClose } from './close';
4
+ export { NBaseIcon } from './icon';
5
5
  export { default as NBaseFocusDetector } from './focus-detector';
6
6
  export { default as NBaseLoading } from './loading';
7
7
  export { default as NInternalSelectMenu } from './select-menu';
@@ -2,7 +2,7 @@ import { h, inject, defineComponent, Transition } from 'vue';
2
2
  import { useMemo } from 'vooks';
3
3
  import { render } from '../../../_utils';
4
4
  import { CheckmarkIcon } from '../../icons';
5
- import NBaseIcon from '../../icon';
5
+ import { NBaseIcon } from '../../icon';
6
6
  import { internalSelectionMenuInjectionKey } from './interface';
7
7
  const checkMarkIcon = h(CheckmarkIcon);
8
8
  function renderCheckMark(show, clsPrefix) {
@@ -500,29 +500,18 @@ export default defineComponent({
500
500
  ? !this.pattern && !this.isCompositing
501
501
  : true;
502
502
  const placeholder = showPlaceholder ? (h("div", { class: `${clsPrefix}-base-selection-placeholder ${clsPrefix}-base-selection-overlay` }, this.placeholder)) : null;
503
- if (filterable) {
504
- const popoverTrigger = (h("div", { ref: "patternInputWrapperRef", class: `${clsPrefix}-base-selection-tags` },
505
- tags,
506
- maxTagCountResponsive ? null : input,
507
- suffix));
508
- body = (h(Fragment, null,
509
- useMaxTagCount ? (h(NPopover, Object.assign({}, popoverProps, { scrollable: true }), {
510
- trigger: () => popoverTrigger,
511
- default: renderPopover
512
- })) : (popoverTrigger),
513
- placeholder));
514
- }
515
- else {
516
- const popoverTrigger = (h("div", { ref: "multipleElRef", class: `${clsPrefix}-base-selection-tags`, tabindex: disabled ? undefined : 0 },
517
- tags,
518
- suffix));
519
- body = (h(Fragment, null,
520
- useMaxTagCount ? (h(NPopover, Object.assign({}, popoverProps, { scrollable: true, style: "max-height: calc(var(--v-target-height) * 6.6);" }), {
521
- trigger: () => popoverTrigger,
522
- default: renderPopover
523
- })) : (popoverTrigger),
524
- placeholder));
525
- }
503
+ const popoverTrigger = filterable ? (h("div", { ref: "patternInputWrapperRef", class: `${clsPrefix}-base-selection-tags` },
504
+ tags,
505
+ maxTagCountResponsive ? null : input,
506
+ suffix)) : (h("div", { ref: "multipleElRef", class: `${clsPrefix}-base-selection-tags`, tabindex: disabled ? undefined : 0 },
507
+ tags,
508
+ suffix));
509
+ body = (h(Fragment, null,
510
+ useMaxTagCount ? (h(NPopover, Object.assign({}, popoverProps, { scrollable: true, style: "max-height: calc(var(--v-target-height) * 6.6);" }), {
511
+ trigger: () => popoverTrigger,
512
+ default: renderPopover
513
+ })) : (popoverTrigger),
514
+ placeholder));
526
515
  }
527
516
  else {
528
517
  if (filterable) {
@@ -1,7 +1,7 @@
1
1
  import { h, defineComponent } from 'vue';
2
2
  import NBaseClear from '../../clear';
3
3
  import NBaseLoading from '../../loading';
4
- import NBaseIcon from '../../icon';
4
+ import { NBaseIcon } from '../../icon';
5
5
  import { ChevronDownIcon } from '../../icons';
6
6
  import { resolveSlot } from '../../../_utils/vue';
7
7
  export default defineComponent({
@@ -1,6 +1,6 @@
1
1
  import { onMounted, onUnmounted, ref } from 'vue';
2
- import { hasWindow } from '../naive';
3
- const defaultWindow = hasWindow ? window : null;
2
+ import { isBrowser } from '../env/is-browser';
3
+ const defaultWindow = isBrowser ? window : null;
4
4
  export const useBrowserLocation = (customWindow = defaultWindow) => {
5
5
  const getWindowLocation = () => {
6
6
  const { hash, host, hostname, href, origin, pathname, port, protocol, search } = (customWindow === null || customWindow === void 0 ? void 0 : customWindow.location) || {};
@@ -1,6 +1,7 @@
1
+ import { isBrowser } from '../env/is-browser';
1
2
  let houdiniRegistered = false;
2
3
  export function useHoudini() {
3
- if (typeof window === 'undefined')
4
+ if (!isBrowser)
4
5
  return;
5
6
  if (!window.CSS)
6
7
  return;
@@ -1,4 +1,5 @@
1
1
  import { ref, onBeforeMount, onBeforeUnmount } from 'vue';
2
+ import { isBrowser } from '../env/is-browser';
2
3
  const isComposingRef = ref(false);
3
4
  const compositionStartHandler = () => {
4
5
  isComposingRef.value = true;
@@ -8,7 +9,7 @@ const compositionEndHandler = () => {
8
9
  };
9
10
  let mountedCount = 0;
10
11
  export const useIsComposing = () => {
11
- if (typeof window !== 'undefined') {
12
+ if (isBrowser) {
12
13
  onBeforeMount(() => {
13
14
  if (!mountedCount) {
14
15
  window.addEventListener('compositionstart', compositionStartHandler);
@@ -0,0 +1 @@
1
+ export declare const isBrowser: boolean;
@@ -0,0 +1 @@
1
+ export const isBrowser = typeof document !== 'undefined' && typeof window !== 'undefined';
@@ -5,4 +5,5 @@ export type { ExtractPublicPropTypes, ExtractInternalPropTypes, Mutable } from '
5
5
  export { formatLength, color2Class } from './css';
6
6
  export { createKey } from './cssr';
7
7
  export { isJsdom } from './env/is-jsdom';
8
+ export { isBrowser } from './env/is-browser';
8
9
  export * from './composable';
@@ -3,4 +3,5 @@ export { warn, warnOnce, throwError, smallerSize, largerSize, getTitleAttribute
3
3
  export { formatLength, color2Class } from './css';
4
4
  export { createKey } from './cssr';
5
5
  export { isJsdom } from './env/is-jsdom';
6
+ export { isBrowser } from './env/is-browser';
6
7
  export * from './composable';
@@ -3,4 +3,3 @@ export { smallerSize, largerSize } from './prop';
3
3
  export { getTitleAttribute } from './attribute';
4
4
  export type { ExtractPublicPropTypes, ExtractInternalPropTypes } from './extract-public-props';
5
5
  export type { Mutable } from './mutable';
6
- export * from './window';
@@ -1,4 +1,3 @@
1
1
  export { warn, warnOnce, throwError } from './warn';
2
2
  export { smallerSize, largerSize } from './prop';
3
3
  export { getTitleAttribute } from './attribute';
4
- export * from './window';
@@ -1,6 +1,7 @@
1
1
  import { c, cB, cE, cM, cNotM } from '../../../_utils/cssr';
2
2
  import { fadeInWidthExpandTransition } from '../../../_styles/transitions/fade-in-width-expand.cssr';
3
- import { iconSwitchTransition } from '../../../_styles/transitions/icon-switch.cssr'; // vars:
3
+ import { iconSwitchTransition } from '../../../_styles/transitions/icon-switch.cssr';
4
+ import { isBrowser } from '../../../_utils'; // vars:
4
5
  // --n-bezier
5
6
  // --n-bezier-ease-out
6
7
  // --n-ripple-duration
@@ -114,7 +115,7 @@ export default c([cB('button', `
114
115
  `, [cM('active', {
115
116
  zIndex: 1,
116
117
  animationName: 'button-wave-spread, button-wave-opacity'
117
- })]), typeof window !== 'undefined' && 'MozBoxSizing' in document.createElement('div').style ? c('&::moz-focus-inner', {
118
+ })]), isBrowser && 'MozBoxSizing' in document.createElement('div').style ? c('&::moz-focus-inner', {
118
119
  border: 0
119
120
  }) : null, cE('border, state-border', `
120
121
  position: absolute;
@@ -124,9 +124,10 @@ export default defineComponent({
124
124
  onRender === null || onRender === void 0 ? void 0 : onRender();
125
125
  const normalizedValue = mergedValue && startOfDay(mergedValue).valueOf();
126
126
  const year = getYear(monthTs);
127
+ const calendarMonth = getMonth(monthTs) + 1;
127
128
  return (h("div", { class: [`${mergedClsPrefix}-calendar`, this.themeClass], style: cssVars },
128
129
  h("div", { class: `${mergedClsPrefix}-calendar-header` },
129
- h("div", { class: `${mergedClsPrefix}-calendar-header__title` }, resolveSlotWithProps($slots.header, { year, month: getMonth(monthTs) + 1 }, () => {
130
+ h("div", { class: `${mergedClsPrefix}-calendar-header__title` }, resolveSlotWithProps($slots.header, { year, month: calendarMonth }, () => {
130
131
  const localeMonth = format(monthTs, 'MMMM', { locale });
131
132
  return [
132
133
  monthBeforeYear
@@ -153,7 +154,7 @@ export default defineComponent({
153
154
  const notInCurrentMonth = !inCurrentMonth;
154
155
  const disabled = (isDateDisabled === null || isDateDisabled === void 0 ? void 0 : isDateDisabled(ts)) === true;
155
156
  const selected = normalizedValue === startOfDay(ts).valueOf();
156
- return (h("div", { key: isCurrentDate ? 'current' : index, class: [
157
+ return (h("div", { key: `${calendarMonth}-${index}`, class: [
157
158
  `${mergedClsPrefix}-calendar-cell`,
158
159
  disabled && `${mergedClsPrefix}-calendar-cell--disabled`,
159
160
  notInCurrentMonth &&
@@ -163,17 +164,25 @@ export default defineComponent({
163
164
  `${mergedClsPrefix}-calendar-cell--current`,
164
165
  selected && `${mergedClsPrefix}-calendar-cell--selected`
165
166
  ], onClick: () => {
167
+ var _a;
166
168
  if (disabled)
167
169
  return;
170
+ const monthTs = startOfMonth(ts).valueOf();
171
+ this.monthTs = monthTs;
172
+ if (notInCurrentMonth) {
173
+ (_a = this.onPanelChange) === null || _a === void 0 ? void 0 : _a.call(this, {
174
+ year: getYear(monthTs),
175
+ month: getMonth(monthTs) + 1
176
+ });
177
+ }
168
178
  this.doUpdateValue(ts, {
169
179
  year,
170
180
  month: month + 1,
171
181
  date
172
182
  });
173
- this.monthTs = startOfMonth(ts).valueOf();
174
183
  } },
175
184
  h("div", { class: `${mergedClsPrefix}-calendar-date` },
176
- disabled ? (h("div", { class: `${mergedClsPrefix}-calendar-date__date`, title: fullDate, key: "disabled" }, date)) : (h("div", { class: `${mergedClsPrefix}-calendar-date__date`, title: fullDate, key: "available" }, date)),
185
+ h("div", { class: `${mergedClsPrefix}-calendar-date__date`, title: fullDate }, date),
177
186
  index < 7 && (h("div", { class: `${mergedClsPrefix}-calendar-date__day`, title: fullDate }, format(ts, 'EEE', {
178
187
  locale
179
188
  })))), (_a = $slots.default) === null || _a === void 0 ? void 0 :
@@ -182,7 +191,7 @@ export default defineComponent({
182
191
  month: month + 1,
183
192
  date
184
193
  }),
185
- h("div", { class: `${mergedClsPrefix}-calendar-cell__bar`, key: month })));
194
+ h("div", { class: `${mergedClsPrefix}-calendar-cell__bar` })));
186
195
  }))));
187
196
  }
188
197
  });
@@ -1,4 +1,4 @@
1
- import { h, defineComponent, computed, provide, ref, watch, toRef, isReactive, watchEffect } from 'vue';
1
+ import { h, defineComponent, computed, provide, ref, watch, toRef, isReactive, watchEffect, nextTick } from 'vue';
2
2
  import { createTreeMate, SubtreeNotLoadedError } from 'treemate';
3
3
  import { VBinder, VTarget, VFollower } from 'vueuc';
4
4
  import { depx, changeColor, happensIn } from 'seemly';
@@ -324,6 +324,36 @@ export default defineComponent({
324
324
  const showSelectMenuRef = computed(() => {
325
325
  return !!(props.filterable && patternRef.value);
326
326
  });
327
+ // init hover key
328
+ watch(mergedShowRef, (show) => {
329
+ if (!show)
330
+ return;
331
+ if (props.multiple)
332
+ return;
333
+ const { value } = mergedValueRef;
334
+ if (!Array.isArray(value) && value !== null) {
335
+ keyboardKeyRef.value = value;
336
+ hoverKeyRef.value = value;
337
+ void nextTick(() => {
338
+ var _a;
339
+ if (!mergedShowRef.value)
340
+ return;
341
+ const { value: hoverKey } = hoverKeyRef;
342
+ if (mergedValueRef.value !== null) {
343
+ const node = treeMateRef.value.getNode(hoverKey);
344
+ if (node) {
345
+ (_a = cascaderMenuInstRef.value) === null || _a === void 0 ? void 0 : _a.scroll(node.level, node.index, depx(optionHeightRef.value));
346
+ }
347
+ }
348
+ });
349
+ }
350
+ else {
351
+ keyboardKeyRef.value = null;
352
+ hoverKeyRef.value = null;
353
+ }
354
+ }, {
355
+ immediate: true
356
+ });
327
357
  // --- methods
328
358
  function doBlur(e) {
329
359
  const { onBlur } = props;
@@ -21,7 +21,7 @@ const drawerProps = Object.assign(Object.assign({}, useTheme.props), { show: Boo
21
21
  type: Boolean,
22
22
  default: true
23
23
  }, showMask: {
24
- type: Boolean,
24
+ type: [Boolean, String],
25
25
  default: true
26
26
  }, to: [String, Object], displayDirective: {
27
27
  type: String,
@@ -1,9 +1,9 @@
1
1
  import { h, defineComponent, computed, inject } from 'vue';
2
2
  import { configProviderInjectionKey } from '../../config-provider/src/context';
3
+ import { NBaseIcon } from '../../_internal/icon';
3
4
  import { EmptyIcon } from '../../_internal/icons';
4
5
  import { useConfig, useLocale, useTheme, useThemeClass } from '../../_mixins';
5
6
  import { createKey } from '../../_utils';
6
- import { NBaseIcon } from '../../_internal';
7
7
  import { emptyLight } from '../styles';
8
8
  import style from './styles/index.cssr';
9
9
  const emptyProps = Object.assign(Object.assign({}, useTheme.props), { description: String, showDescription: {
package/es/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { default } from './preset';
1
+ export { default, install } from './preset';
2
2
  export { useOsTheme } from 'vooks';
3
3
  export { default as create } from './create';
4
4
  export * from './locales';
package/es/index.js CHANGED
@@ -1,4 +1,4 @@
1
- export { default } from './preset';
1
+ export { default, install } from './preset';
2
2
  export { useOsTheme } from 'vooks';
3
3
  export { default as create } from './create';
4
4
  export * from './locales';
@@ -0,0 +1 @@
1
+ export {};
package/es/jest-setup.js CHANGED
@@ -1,5 +1,5 @@
1
- "use strict";
1
+ import { isBrowser } from './_utils';
2
2
  // https://github.com/jsdom/jsdom/issues/1422
3
- if (typeof window !== 'undefined') {
3
+ if (isBrowser) {
4
4
  HTMLDivElement.prototype.scrollTo = () => { };
5
5
  }
@@ -4,6 +4,7 @@
4
4
  *
5
5
  * Here I modified it to make it works when input is scrolled.
6
6
  */
7
+ import { isBrowser } from '../../_utils';
7
8
  /**
8
9
  * Returns the Absolute (relative to the inner window size) position of the caret in the given element.
9
10
  * @param element Input (has to be type='text') or Text Area.
@@ -69,7 +70,6 @@ export function getRelativePosition(element, options = {
69
70
  ];
70
71
  // Firefox 1.0+
71
72
  const isFirefox = navigator.userAgent.toLowerCase().includes('firefox');
72
- const isBrowser = typeof window !== 'undefined';
73
73
  if (!isBrowser) {
74
74
  throw new Error('textarea-caret-position#getCaretPosition should only be called in a browser');
75
75
  }
package/es/preset.d.ts CHANGED
@@ -1,2 +1,3 @@
1
- declare const _default: import("./create").NUiInstance;
2
- export default _default;
1
+ declare const naive: import("./create").NUiInstance;
2
+ export default naive;
3
+ export declare const install: (app: import("vue").App<any>) => void;
package/es/preset.js CHANGED
@@ -1,5 +1,7 @@
1
1
  import * as components from './components';
2
2
  import create from './create';
3
- export default create({
3
+ const naive = create({
4
4
  components: Object.keys(components).map((key) => components[key])
5
5
  });
6
+ export default naive;
7
+ export const install = naive.install;
@@ -69,6 +69,7 @@ declare const _default: import("vue").DefineComponent<{
69
69
  gapLarge: string;
70
70
  }, any>>>;
71
71
  }, {
72
+ useGap: boolean;
72
73
  rtlEnabled: import("vue").Ref<import("../../config-provider/src/internal-interface").RtlItem | undefined> | undefined;
73
74
  mergedClsPrefix: import("vue").ComputedRef<string>;
74
75
  margin: import("vue").ComputedRef<{
@@ -4,6 +4,7 @@ import { createKey, flatten, getSlot } from '../../_utils';
4
4
  import { useConfig, useTheme } from '../../_mixins';
5
5
  import { spaceLight } from '../styles';
6
6
  import useRtl from '../../_mixins/use-rtl';
7
+ import { ensureSupportFlexGap } from './utils';
7
8
  const spaceProps = Object.assign(Object.assign({}, useTheme.props), { align: String, justify: {
8
9
  type: String,
9
10
  default: 'start'
@@ -22,6 +23,7 @@ export default defineComponent({
22
23
  const themeRef = useTheme('Space', '-space', undefined, spaceLight, props, mergedClsPrefixRef);
23
24
  const rtlEnabledRef = useRtl('Space', mergedRtlRef, mergedClsPrefixRef);
24
25
  return {
26
+ useGap: ensureSupportFlexGap(),
25
27
  rtlEnabled: rtlEnabledRef,
26
28
  mergedClsPrefix: mergedClsPrefixRef,
27
29
  margin: computed(() => {
@@ -48,7 +50,7 @@ export default defineComponent({
48
50
  };
49
51
  },
50
52
  render() {
51
- const { vertical, align, inline, justify, itemStyle, margin, wrap, mergedClsPrefix, rtlEnabled } = this;
53
+ const { vertical, align, inline, justify, itemStyle, margin, wrap, mergedClsPrefix, rtlEnabled, useGap } = this;
52
54
  const children = flatten(getSlot(this));
53
55
  if (!children.length)
54
56
  return null;
@@ -68,51 +70,54 @@ export default defineComponent({
68
70
  ? 'flex-' + justify
69
71
  : justify,
70
72
  flexWrap: !wrap || vertical ? 'nowrap' : 'wrap',
71
- marginTop: vertical ? '' : `-${semiVerticalMargin}`,
72
- marginBottom: vertical ? '' : `-${semiVerticalMargin}`,
73
- alignItems: align
73
+ marginTop: useGap || vertical ? '' : `-${semiVerticalMargin}`,
74
+ marginBottom: useGap || vertical ? '' : `-${semiVerticalMargin}`,
75
+ alignItems: align,
76
+ gap: useGap ? `${margin.vertical}px ${margin.horizontal}px` : ''
74
77
  } }, children.map((child, index) => (h("div", { role: "none", style: [
75
78
  itemStyle,
76
79
  {
77
80
  maxWidth: '100%'
78
81
  },
79
- vertical
80
- ? {
81
- marginBottom: index !== lastIndex ? verticalMargin : ''
82
- }
83
- : rtlEnabled
82
+ useGap
83
+ ? ''
84
+ : vertical
84
85
  ? {
85
- marginLeft: isJustifySpace
86
- ? justify === 'space-between' && index === lastIndex
87
- ? ''
88
- : semiHorizontalMargin
89
- : index !== lastIndex
90
- ? horizontalMargin
91
- : '',
92
- marginRight: isJustifySpace
93
- ? justify === 'space-between' && index === 0
94
- ? ''
95
- : semiHorizontalMargin
96
- : '',
97
- paddingTop: semiVerticalMargin,
98
- paddingBottom: semiVerticalMargin
86
+ marginBottom: index !== lastIndex ? verticalMargin : ''
99
87
  }
100
- : {
101
- marginRight: isJustifySpace
102
- ? justify === 'space-between' && index === lastIndex
103
- ? ''
104
- : semiHorizontalMargin
105
- : index !== lastIndex
106
- ? horizontalMargin
88
+ : rtlEnabled
89
+ ? {
90
+ marginLeft: isJustifySpace
91
+ ? justify === 'space-between' && index === lastIndex
92
+ ? ''
93
+ : semiHorizontalMargin
94
+ : index !== lastIndex
95
+ ? horizontalMargin
96
+ : '',
97
+ marginRight: isJustifySpace
98
+ ? justify === 'space-between' && index === 0
99
+ ? ''
100
+ : semiHorizontalMargin
107
101
  : '',
108
- marginLeft: isJustifySpace
109
- ? justify === 'space-between' && index === 0
110
- ? ''
111
- : semiHorizontalMargin
112
- : '',
113
- paddingTop: semiVerticalMargin,
114
- paddingBottom: semiVerticalMargin
115
- }
102
+ paddingTop: semiVerticalMargin,
103
+ paddingBottom: semiVerticalMargin
104
+ }
105
+ : {
106
+ marginRight: isJustifySpace
107
+ ? justify === 'space-between' && index === lastIndex
108
+ ? ''
109
+ : semiHorizontalMargin
110
+ : index !== lastIndex
111
+ ? horizontalMargin
112
+ : '',
113
+ marginLeft: isJustifySpace
114
+ ? justify === 'space-between' && index === 0
115
+ ? ''
116
+ : semiHorizontalMargin
117
+ : '',
118
+ paddingTop: semiVerticalMargin,
119
+ paddingBottom: semiVerticalMargin
120
+ }
116
121
  ] }, child)))));
117
122
  }
118
123
  });
@@ -0,0 +1 @@
1
+ export declare const ensureSupportFlexGap: () => boolean;
@@ -0,0 +1,22 @@
1
+ import { isBrowser } from '../../_utils';
2
+ let supportFlexGap;
3
+ export const ensureSupportFlexGap = () => {
4
+ if (!isBrowser)
5
+ return true;
6
+ if (supportFlexGap === undefined) {
7
+ // create flex container with row-gap set
8
+ const flex = document.createElement('div');
9
+ flex.style.display = 'flex';
10
+ flex.style.flexDirection = 'column';
11
+ flex.style.rowGap = '1px';
12
+ // create two, elements inside it
13
+ flex.appendChild(document.createElement('div'));
14
+ flex.appendChild(document.createElement('div'));
15
+ // append to the DOM (needed to obtain scrollHeight)
16
+ document.body.appendChild(flex);
17
+ const isSupported = flex.scrollHeight === 1; // flex container should be 1px high from the row-gap
18
+ document.body.removeChild(flex);
19
+ return (supportFlexGap = isSupported);
20
+ }
21
+ return supportFlexGap;
22
+ };
package/es/tag/src/Tag.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { h, defineComponent, computed, ref, provide, toRef } from 'vue';
2
2
  import useRtl from '../../_mixins/use-rtl';
3
+ import { NBaseClose } from '../../_internal/close';
3
4
  import { useConfig, useThemeClass, useTheme } from '../../_mixins';
4
- import { NBaseClose } from '../../_internal';
5
5
  import { warn, createKey, call, createInjectionKey, color2Class, resolveWrappedSlot } from '../../_utils';
6
6
  import { tagLight } from '../styles';
7
7
  import commonProps from './common-props';
@@ -1,3 +1,4 @@
1
+ import { isBrowser } from '../../_utils';
1
2
  function traverse(nodes, childrenField, callback, callbackAfter) {
2
3
  nodes === null || nodes === void 0 ? void 0 : nodes.forEach((node) => {
3
4
  callback(node);
@@ -31,7 +32,7 @@ export function keysWithFilter(nodes, pattern, keyField, childrenField, filter)
31
32
  };
32
33
  }
33
34
  const emptyImage = null;
34
- if (typeof window !== 'undefined' && Image) {
35
+ if (isBrowser && Image) {
35
36
  const emptyImage = new Image();
36
37
  emptyImage.src =
37
38
  'data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==';
@@ -7,6 +7,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
7
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
8
8
  });
9
9
  };
10
+ import { isBrowser } from '../../_utils';
10
11
  export const isImageFileType = (type) => type.includes('image/');
11
12
  const getExtname = (url = '') => {
12
13
  const temp = url.split('/');
@@ -57,10 +58,7 @@ export function createImageDataUrl(file) {
57
58
  });
58
59
  });
59
60
  }
60
- export const environmentSupportFile = typeof document !== 'undefined' &&
61
- typeof window !== 'undefined' &&
62
- window.FileReader &&
63
- window.File;
61
+ export const environmentSupportFile = isBrowser && window.FileReader && window.File;
64
62
  export function isFileSystemDirectoryEntry(item) {
65
63
  return item.isDirectory;
66
64
  }
package/es/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- declare const _default: "2.30.2";
1
+ declare const _default: "2.30.3";
2
2
  export default _default;
package/es/version.js CHANGED
@@ -1 +1 @@
1
- export default '2.30.2';
1
+ export default '2.30.3';
@@ -7,7 +7,7 @@ const vue_1 = require("vue");
7
7
  const _utils_1 = require("../../../_utils");
8
8
  const _mixins_1 = require("../../../_mixins");
9
9
  const icons_1 = require("../../icons");
10
- const icon_1 = __importDefault(require("../../icon"));
10
+ const icon_1 = require("../../icon");
11
11
  const icon_switch_transition_1 = __importDefault(require("../../icon-switch-transition"));
12
12
  const index_cssr_1 = __importDefault(require("./styles/index.cssr"));
13
13
  exports.default = (0, vue_1.defineComponent)({
@@ -35,7 +35,7 @@ exports.default = (0, vue_1.defineComponent)({
35
35
  default: () => {
36
36
  var _a, _b;
37
37
  return this.show ? ((0, vue_1.h)("div", { key: "dismiss", class: `${clsPrefix}-base-clear__clear`, onClick: this.onClear, onMousedown: this.handleMouseDown, "data-clear": true }, (0, _utils_1.resolveSlot)(this.$slots.icon, () => [
38
- (0, vue_1.h)(icon_1.default, { clsPrefix: clsPrefix }, {
38
+ (0, vue_1.h)(icon_1.NBaseIcon, { clsPrefix: clsPrefix }, {
39
39
  default: () => (0, vue_1.h)(icons_1.ClearIcon, null)
40
40
  })
41
41
  ]))) : ((0, vue_1.h)("div", { key: "icon", class: `${clsPrefix}-base-clear__placeholder` }, (_b = (_a = this.$slots).placeholder) === null || _b === void 0 ? void 0 : _b.call(_a)));
@@ -1 +1 @@
1
- export { default } from './src/Close';
1
+ export { default as NBaseClose } from './src/Close';