naive-ui 2.22.0 → 2.23.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. package/es/_internal/scrollbar/src/ScrollBar.d.ts +0 -11
  2. package/es/_internal/scrollbar/src/ScrollBar.js +5 -8
  3. package/es/badge/src/Badge.d.ts +6 -6
  4. package/es/badge/src/Badge.js +6 -6
  5. package/es/badge/src/styles/index.cssr.js +15 -15
  6. package/es/button/src/Button.d.ts +10 -5
  7. package/es/button/src/Button.js +21 -14
  8. package/es/data-table/src/TableParts/Body.js +1 -1
  9. package/es/dialog/src/Dialog.js +2 -2
  10. package/es/divider/src/Divider.d.ts +4 -4
  11. package/es/divider/src/Divider.js +4 -4
  12. package/es/divider/src/styles/index.cssr.js +12 -12
  13. package/es/input-number/src/utils.js +1 -1
  14. package/es/switch/src/Switch.js +7 -0
  15. package/es/switch/src/styles/index.cssr.js +2 -0
  16. package/es/typography/src/a.d.ts +2 -2
  17. package/es/typography/src/a.js +2 -2
  18. package/es/typography/src/blockquote.d.ts +5 -5
  19. package/es/typography/src/blockquote.js +5 -5
  20. package/es/typography/src/create-header.d.ts +8 -8
  21. package/es/typography/src/create-header.js +8 -8
  22. package/es/typography/src/headers.d.ts +48 -48
  23. package/es/typography/src/hr.d.ts +2 -1
  24. package/es/typography/src/hr.js +3 -1
  25. package/es/typography/src/ol.d.ts +7 -7
  26. package/es/typography/src/ol.js +7 -7
  27. package/es/typography/src/p.d.ts +5 -5
  28. package/es/typography/src/p.js +5 -5
  29. package/es/typography/src/styles/a.cssr.js +6 -6
  30. package/es/typography/src/styles/blockquote.cssr.js +11 -11
  31. package/es/typography/src/styles/header.cssr.js +19 -19
  32. package/es/typography/src/styles/hr.cssr.js +3 -3
  33. package/es/typography/src/styles/list.cssr.js +15 -15
  34. package/es/typography/src/styles/p.cssr.js +10 -10
  35. package/es/typography/src/styles/text.cssr.js +18 -18
  36. package/es/typography/src/text.d.ts +8 -7
  37. package/es/typography/src/text.js +9 -8
  38. package/es/typography/src/ul.d.ts +7 -7
  39. package/es/typography/src/ul.js +7 -7
  40. package/es/version.d.ts +1 -1
  41. package/es/version.js +1 -1
  42. package/lib/_internal/scrollbar/src/ScrollBar.d.ts +0 -11
  43. package/lib/_internal/scrollbar/src/ScrollBar.js +5 -8
  44. package/lib/badge/src/Badge.d.ts +6 -6
  45. package/lib/badge/src/Badge.js +6 -6
  46. package/lib/badge/src/styles/index.cssr.js +15 -15
  47. package/lib/button/src/Button.d.ts +10 -5
  48. package/lib/button/src/Button.js +20 -13
  49. package/lib/data-table/src/TableParts/Body.js +1 -1
  50. package/lib/dialog/src/Dialog.js +2 -2
  51. package/lib/divider/src/Divider.d.ts +4 -4
  52. package/lib/divider/src/Divider.js +4 -4
  53. package/lib/divider/src/styles/index.cssr.js +12 -12
  54. package/lib/input-number/src/utils.js +1 -1
  55. package/lib/switch/src/Switch.js +7 -0
  56. package/lib/switch/src/styles/index.cssr.js +2 -0
  57. package/lib/typography/src/a.d.ts +2 -2
  58. package/lib/typography/src/a.js +2 -2
  59. package/lib/typography/src/blockquote.d.ts +5 -5
  60. package/lib/typography/src/blockquote.js +5 -5
  61. package/lib/typography/src/create-header.d.ts +8 -8
  62. package/lib/typography/src/create-header.js +8 -8
  63. package/lib/typography/src/headers.d.ts +48 -48
  64. package/lib/typography/src/hr.d.ts +2 -1
  65. package/lib/typography/src/hr.js +3 -1
  66. package/lib/typography/src/ol.d.ts +7 -7
  67. package/lib/typography/src/ol.js +7 -7
  68. package/lib/typography/src/p.d.ts +5 -5
  69. package/lib/typography/src/p.js +5 -5
  70. package/lib/typography/src/styles/a.cssr.js +6 -6
  71. package/lib/typography/src/styles/blockquote.cssr.js +11 -11
  72. package/lib/typography/src/styles/header.cssr.js +19 -19
  73. package/lib/typography/src/styles/hr.cssr.js +3 -3
  74. package/lib/typography/src/styles/list.cssr.js +15 -15
  75. package/lib/typography/src/styles/p.cssr.js +10 -10
  76. package/lib/typography/src/styles/text.cssr.js +18 -18
  77. package/lib/typography/src/text.d.ts +8 -7
  78. package/lib/typography/src/text.js +9 -8
  79. package/lib/typography/src/ul.d.ts +7 -7
  80. package/lib/typography/src/ul.js +7 -7
  81. package/lib/version.d.ts +1 -1
  82. package/lib/version.js +1 -1
  83. package/package.json +2 -2
  84. package/web-types.json +1 -1
@@ -49,10 +49,6 @@ declare const scrollbarProps: {
49
49
  readonly type: BooleanConstructor;
50
50
  readonly default: false;
51
51
  };
52
- readonly showScrollbar: {
53
- readonly type: BooleanConstructor;
54
- readonly default: true;
55
- };
56
52
  readonly container: PropType<() => HTMLElement | null | undefined>;
57
53
  readonly content: PropType<() => HTMLElement | null | undefined>;
58
54
  readonly containerClass: StringConstructor;
@@ -97,10 +93,6 @@ declare const Scrollbar: import("vue").DefineComponent<{
97
93
  readonly type: BooleanConstructor;
98
94
  readonly default: false;
99
95
  };
100
- readonly showScrollbar: {
101
- readonly type: BooleanConstructor;
102
- readonly default: true;
103
- };
104
96
  readonly container: PropType<() => HTMLElement | null | undefined>;
105
97
  readonly content: PropType<() => HTMLElement | null | undefined>;
106
98
  readonly containerClass: StringConstructor;
@@ -164,7 +156,6 @@ declare const Scrollbar: import("vue").DefineComponent<{
164
156
  readonly duration?: unknown;
165
157
  readonly scrollable?: unknown;
166
158
  readonly xScrollable?: unknown;
167
- readonly showScrollbar?: unknown;
168
159
  readonly container?: unknown;
169
160
  readonly content?: unknown;
170
161
  readonly containerClass?: unknown;
@@ -183,7 +174,6 @@ declare const Scrollbar: import("vue").DefineComponent<{
183
174
  } & {
184
175
  size: number;
185
176
  duration: number;
186
- showScrollbar: boolean;
187
177
  scrollable: boolean;
188
178
  xScrollable: boolean;
189
179
  } & {
@@ -214,7 +204,6 @@ declare const Scrollbar: import("vue").DefineComponent<{
214
204
  }>, {
215
205
  size: number;
216
206
  duration: number;
217
- showScrollbar: boolean;
218
207
  scrollable: boolean;
219
208
  xScrollable: boolean;
220
209
  }>;
@@ -17,9 +17,6 @@ const scrollbarProps = Object.assign(Object.assign({}, useTheme.props), { size:
17
17
  }, xScrollable: {
18
18
  type: Boolean,
19
19
  default: false
20
- }, showScrollbar: {
21
- type: Boolean,
22
- default: true
23
20
  },
24
21
  // If container is set, resize observer won't not attached
25
22
  container: Function, content: Function, containerClass: String, containerStyle: [String, Object], contentClass: String, contentStyle: [String, Object], horizontalRailStyle: [String, Object], verticalRailStyle: [String, Object], onScroll: Function, onWheel: Function, onResize: Function, internalOnUpdateScrollLeft: Function });
@@ -473,7 +470,7 @@ const Scrollbar = defineComponent({
473
470
  };
474
471
  },
475
472
  render() {
476
- const { $slots, mergedClsPrefix, showScrollbar } = this;
473
+ const { $slots, mergedClsPrefix } = this;
477
474
  if (!this.scrollable)
478
475
  return renderSlot($slots, 'default');
479
476
  const createChildren = () => h('div', mergeProps(this.$attrs, {
@@ -498,20 +495,20 @@ const Scrollbar = defineComponent({
498
495
  this.contentClass
499
496
  ] }, $slots))
500
497
  }))),
501
- showScrollbar && (h("div", { ref: "yRailRef", class: `${mergedClsPrefix}-scrollbar-rail ${mergedClsPrefix}-scrollbar-rail--vertical`, style: [this.horizontalRailStyle] },
498
+ h("div", { ref: "yRailRef", class: `${mergedClsPrefix}-scrollbar-rail ${mergedClsPrefix}-scrollbar-rail--vertical`, style: [this.horizontalRailStyle] },
502
499
  h(Transition, { name: "fade-in-transition" }, {
503
500
  default: () => this.needYBar && this.isShowYBar && !this.isIos ? (h("div", { class: `${mergedClsPrefix}-scrollbar-rail__scrollbar`, style: {
504
501
  height: this.yBarSizePx,
505
502
  top: this.yBarTopPx
506
503
  }, onMousedown: this.handleYScrollMouseDown })) : null
507
- }))),
508
- showScrollbar && (h("div", { ref: "xRailRef", class: `${mergedClsPrefix}-scrollbar-rail ${mergedClsPrefix}-scrollbar-rail--horizontal`, style: [this.verticalRailStyle] },
504
+ })),
505
+ h("div", { ref: "xRailRef", class: `${mergedClsPrefix}-scrollbar-rail ${mergedClsPrefix}-scrollbar-rail--horizontal`, style: [this.verticalRailStyle] },
509
506
  h(Transition, { name: "fade-in-transition" }, {
510
507
  default: () => this.needXBar && this.isShowXBar && !this.isIos ? (h("div", { class: `${mergedClsPrefix}-scrollbar-rail__scrollbar`, style: {
511
508
  width: this.xBarSizePx,
512
509
  left: this.xBarLeftPx
513
510
  }, onMousedown: this.handleXScrollMouseDown })) : null
514
- })))
511
+ }))
515
512
  ]);
516
513
  return this.container ? (createChildren()) : (h(VResizeObserver, { onResize: this.handleContainerResize }, {
517
514
  default: createChildren
@@ -111,12 +111,12 @@ declare const _default: import("vue").DefineComponent<{
111
111
  handleAfterEnter: () => void;
112
112
  handleAfterLeave: () => void;
113
113
  cssVars: import("vue").ComputedRef<{
114
- '--font-size': string;
115
- '--font-family': string;
116
- '--color': string;
117
- '--ripple-color': string;
118
- '--bezier': string;
119
- '--ripple-bezier': string;
114
+ '--n-font-size': string;
115
+ '--n-font-family': string;
116
+ '--n-color': string;
117
+ '--n-ripple-color': string;
118
+ '--n-bezier': string;
119
+ '--n-ripple-bezier': string;
120
120
  }>;
121
121
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<{
122
122
  readonly value?: unknown;
@@ -52,12 +52,12 @@ export default defineComponent({
52
52
  const { type, color: propColor } = props;
53
53
  const { common: { cubicBezierEaseInOut, cubicBezierEaseOut }, self: { [createKey('color', type)]: color, fontFamily, fontSize } } = themeRef.value;
54
54
  return {
55
- '--font-size': fontSize,
56
- '--font-family': fontFamily,
57
- '--color': propColor || color,
58
- '--ripple-color': propColor || color,
59
- '--bezier': cubicBezierEaseInOut,
60
- '--ripple-bezier': cubicBezierEaseOut
55
+ '--n-font-size': fontSize,
56
+ '--n-font-family': fontFamily,
57
+ '--n-color': propColor || color,
58
+ '--n-ripple-color': propColor || color,
59
+ '--n-bezier': cubicBezierEaseInOut,
60
+ '--n-ripple-bezier': cubicBezierEaseOut
61
61
  };
62
62
  })
63
63
  };
@@ -1,28 +1,28 @@
1
1
  import { c, cB, cM } from '../../../_utils/cssr';
2
2
  import fadeInScaleUpTransition from '../../../_styles/transitions/fade-in-scale-up.cssr'; // vars:
3
- // --color
4
- // --ripple-color
5
- // --bezier
6
- // --ripple-bezier
7
- // --font-size
8
- // --font-family
3
+ // --n-color
4
+ // --n-ripple-color
5
+ // --n-bezier
6
+ // --n-ripple-bezier
7
+ // --n-font-size
8
+ // --n-font-family
9
9
 
10
10
  export default c([c('@keyframes badge-wave-spread', {
11
11
  from: {
12
- boxShadow: '0 0 0.5px 0px var(--ripple-color)',
12
+ boxShadow: '0 0 0.5px 0px var(--n-ripple-color)',
13
13
  opacity: 0.6
14
14
  },
15
15
  to: {
16
16
  // don't use exact 5px since chrome will display the animation with glitches
17
- boxShadow: '0 0 0.5px 4.5px var(--ripple-color)',
17
+ boxShadow: '0 0 0.5px 4.5px var(--n-ripple-color)',
18
18
  opacity: 0
19
19
  }
20
20
  }), cB('badge', `
21
21
  display: inline-flex;
22
22
  position: relative;
23
23
  vertical-align: middle;
24
- color: var(--color);
25
- font-family: var(--font-family);
24
+ color: var(--n-color);
25
+ font-family: var(--n-font-family);
26
26
  `, [cM('as-is', [cB('badge-sup', {
27
27
  position: 'static',
28
28
  transform: 'translateX(0)'
@@ -39,10 +39,10 @@ export default c([c('@keyframes badge-wave-spread', {
39
39
  }, [c('::before', {
40
40
  borderRadius: '4px'
41
41
  })])]), cB('badge-sup', `
42
- background: var(--color);
42
+ background: var(--n-color);
43
43
  transition:
44
- background-color .3s var(--bezier),
45
- color .3s var(--bezier);
44
+ background-color .3s var(--n-bezier),
45
+ color .3s var(--n-bezier);
46
46
  color: #FFF;
47
47
  position: absolute;
48
48
  height: 18px;
@@ -50,7 +50,7 @@ export default c([c('@keyframes badge-wave-spread', {
50
50
  border-radius: 9px;
51
51
  padding: 0 6px;
52
52
  text-align: center;
53
- font-size: var(--font-size);
53
+ font-size: var(--n-font-size);
54
54
  transform: translateX(-50%);
55
55
  left: 100%;
56
56
  bottom: calc(100% - 9px);
@@ -64,7 +64,7 @@ export default c([c('@keyframes badge-wave-spread', {
64
64
  animationDuration: '2s',
65
65
  animationIterationCount: 'infinite',
66
66
  animationDelay: '1s',
67
- animationTimingFunction: 'var(--ripple-bezier)',
67
+ animationTimingFunction: 'var(--n-ripple-bezier)',
68
68
  animationName: 'badge-wave-spread'
69
69
  }), c('&::before', `
70
70
  opacity: 0;
@@ -41,11 +41,12 @@ declare const buttonProps: {
41
41
  readonly type: PropType<"button" | "reset" | "submit">;
42
42
  readonly default: "button";
43
43
  };
44
- readonly onClick: PropType<MaybeArray<(e: MouseEvent) => void>>;
45
44
  readonly bordered: {
46
45
  readonly type: BooleanConstructor;
47
46
  readonly default: true;
48
47
  };
48
+ readonly onClick: PropType<MaybeArray<(e: MouseEvent) => void>>;
49
+ readonly internalAutoFocus: BooleanConstructor;
49
50
  readonly theme: PropType<import("../../_mixins").Theme<"Button", {
50
51
  heightTiny: string;
51
52
  heightSmall: string;
@@ -700,11 +701,12 @@ declare const Button: import("vue").DefineComponent<{
700
701
  readonly type: PropType<"button" | "reset" | "submit">;
701
702
  readonly default: "button";
702
703
  };
703
- readonly onClick: PropType<MaybeArray<(e: MouseEvent) => void>>;
704
704
  readonly bordered: {
705
705
  readonly type: BooleanConstructor;
706
706
  readonly default: true;
707
707
  };
708
+ readonly onClick: PropType<MaybeArray<(e: MouseEvent) => void>>;
709
+ readonly internalAutoFocus: BooleanConstructor;
708
710
  readonly theme: PropType<import("../../_mixins").Theme<"Button", {
709
711
  heightTiny: string;
710
712
  heightSmall: string;
@@ -1318,8 +1320,8 @@ declare const Button: import("vue").DefineComponent<{
1318
1320
  rippleDuration: string;
1319
1321
  }, any>>>;
1320
1322
  }, {
1321
- selfRef: import("vue").Ref<HTMLElement | null>;
1322
- waveRef: import("vue").Ref<{
1323
+ selfElRef: import("vue").Ref<HTMLElement | null>;
1324
+ waveElRef: import("vue").Ref<{
1323
1325
  play: () => void;
1324
1326
  } | null>;
1325
1327
  mergedClsPrefix: import("vue").ComputedRef<string>;
@@ -1393,8 +1395,9 @@ declare const Button: import("vue").DefineComponent<{
1393
1395
  readonly dashed?: unknown;
1394
1396
  readonly iconPlacement?: unknown;
1395
1397
  readonly attrType?: unknown;
1396
- readonly onClick?: unknown;
1397
1398
  readonly bordered?: unknown;
1399
+ readonly onClick?: unknown;
1400
+ readonly internalAutoFocus?: unknown;
1398
1401
  readonly theme?: unknown;
1399
1402
  readonly themeOverrides?: unknown;
1400
1403
  readonly builtinThemeOverrides?: unknown;
@@ -1418,6 +1421,7 @@ declare const Button: import("vue").DefineComponent<{
1418
1421
  quaternary: boolean;
1419
1422
  iconPlacement: "left" | "right";
1420
1423
  attrType: "button" | "reset" | "submit";
1424
+ internalAutoFocus: boolean;
1421
1425
  } & {
1422
1426
  color?: string | undefined;
1423
1427
  size?: Size | undefined;
@@ -2055,6 +2059,7 @@ declare const Button: import("vue").DefineComponent<{
2055
2059
  quaternary: boolean;
2056
2060
  iconPlacement: "left" | "right";
2057
2061
  attrType: "button" | "reset" | "submit";
2062
+ internalAutoFocus: boolean;
2058
2063
  }>;
2059
2064
  declare type NativeButtonProps = Omit<ButtonHTMLAttributes, keyof ButtonProps>;
2060
2065
  declare type MergedProps = Partial<ButtonProps & NativeButtonProps>;
@@ -1,4 +1,4 @@
1
- import { h, ref, computed, inject, defineComponent, renderSlot, watchEffect } from 'vue';
1
+ import { h, ref, computed, inject, onMounted, defineComponent, renderSlot, watchEffect } from 'vue';
2
2
  import { useMemo } from 'vooks';
3
3
  import { createHoverColor, createPressedColor } from '../../_utils/color/index';
4
4
  import { useConfig, useFormItem, useTheme } from '../../_mixins';
@@ -27,10 +27,10 @@ const buttonProps = Object.assign(Object.assign({}, useTheme.props), { color: St
27
27
  }, attrType: {
28
28
  type: String,
29
29
  default: 'button'
30
- }, onClick: [Function, Array], bordered: {
30
+ }, bordered: {
31
31
  type: Boolean,
32
32
  default: true
33
- } });
33
+ }, onClick: [Function, Array], internalAutoFocus: Boolean });
34
34
  const Button = defineComponent({
35
35
  name: 'Button',
36
36
  props: buttonProps,
@@ -44,9 +44,18 @@ const Button = defineComponent({
44
44
  }
45
45
  });
46
46
  }
47
- const selfRef = ref(null);
48
- const waveRef = ref(null);
47
+ const selfElRef = ref(null);
48
+ const waveElRef = ref(null);
49
49
  const enterPressedRef = ref(false);
50
+ onMounted(() => {
51
+ const { value: selfEl } = selfElRef;
52
+ if (selfEl &&
53
+ !props.disabled &&
54
+ props.focusable &&
55
+ props.internalAutoFocus) {
56
+ selfEl.focus({ preventScroll: true });
57
+ }
58
+ });
50
59
  const showBorderRef = useMemo(() => {
51
60
  return (!props.quaternary &&
52
61
  !props.tertiary &&
@@ -82,19 +91,17 @@ const Button = defineComponent({
82
91
  return;
83
92
  }
84
93
  if (mergedFocusableRef.value) {
85
- (_a = selfRef.value) === null || _a === void 0 ? void 0 : _a.focus({ preventScroll: true });
94
+ (_a = selfElRef.value) === null || _a === void 0 ? void 0 : _a.focus({ preventScroll: true });
86
95
  }
87
96
  };
88
97
  const handleClick = (e) => {
98
+ var _a;
89
99
  if (!props.disabled && !props.loading) {
90
100
  const { onClick } = props;
91
101
  if (onClick)
92
102
  call(onClick, e);
93
103
  if (!props.text) {
94
- const { value } = waveRef;
95
- if (value) {
96
- value.play();
97
- }
104
+ (_a = waveElRef.value) === null || _a === void 0 ? void 0 : _a.play();
98
105
  }
99
106
  }
100
107
  };
@@ -126,8 +133,8 @@ const Button = defineComponent({
126
133
  const themeRef = useTheme('Button', 'Button', style, buttonLight, props, mergedClsPrefixRef);
127
134
  const rtlEnabledRef = useRtl('Button', NConfigProvider === null || NConfigProvider === void 0 ? void 0 : NConfigProvider.mergedRtlRef, mergedClsPrefixRef);
128
135
  return {
129
- selfRef,
130
- waveRef,
136
+ selfElRef,
137
+ waveElRef,
131
138
  mergedClsPrefix: mergedClsPrefixRef,
132
139
  mergedFocusable: mergedFocusableRef,
133
140
  mergedSize: mergedSizeRef,
@@ -383,7 +390,7 @@ const Button = defineComponent({
383
390
  },
384
391
  render() {
385
392
  const { $slots, mergedClsPrefix, tag: Component } = this;
386
- return (h(Component, { ref: "selfRef", class: [
393
+ return (h(Component, { ref: "selfElRef", class: [
387
394
  `${mergedClsPrefix}-button`,
388
395
  `${mergedClsPrefix}-button--${this.type}-type`,
389
396
  `${mergedClsPrefix}-button--${this.mergedSize}-type`,
@@ -407,7 +414,7 @@ const Button = defineComponent({
407
414
  }))) : null
408
415
  }),
409
416
  $slots.default && this.iconPlacement === 'left' ? (h("span", { class: `${mergedClsPrefix}-button__content` }, $slots)) : null,
410
- !this.text ? (h(NBaseWave, { ref: "waveRef", clsPrefix: mergedClsPrefix })) : null,
417
+ !this.text ? (h(NBaseWave, { ref: "waveElRef", clsPrefix: mergedClsPrefix })) : null,
411
418
  this.showBorder ? (h("div", { "aria-hidden": true, class: `${mergedClsPrefix}-button__border`, style: this.customColorCssVars })) : null,
412
419
  this.showBorder ? (h("div", { "aria-hidden": true, class: `${mergedClsPrefix}-button__state-border`, style: this.customColorCssVars })) : null));
413
420
  }
@@ -281,7 +281,7 @@ export default defineComponent({
281
281
  };
282
282
  if (scrollX)
283
283
  contentStyle.width = '100%';
284
- const tableNode = (h(NScrollbar, { ref: "scrollbarInstRef", scrollable: scrollable || isBasicAutoLayout, showScrollbar: !this.bodyShowHeaderOnly, class: `${mergedClsPrefix}-data-table-base-table-body`, style: this.bodyStyle, theme: mergedTheme.peers.Scrollbar, themeOverrides: mergedTheme.peerOverrides.Scrollbar, contentStyle: contentStyle, container: virtualScroll ? this.virtualListContainer : undefined, content: virtualScroll ? this.virtualListContent : undefined, horizontalRailStyle: { zIndex: 3 }, verticalRailStyle: { zIndex: 3 }, xScrollable: xScrollable, onScroll: virtualScroll ? undefined : this.handleTableBodyScroll, internalOnUpdateScrollLeft: setHeaderScrollLeft, onResize: onResize }, {
284
+ const tableNode = (h(NScrollbar, { ref: "scrollbarInstRef", scrollable: scrollable || isBasicAutoLayout, class: `${mergedClsPrefix}-data-table-base-table-body`, style: this.bodyStyle, theme: mergedTheme.peers.Scrollbar, themeOverrides: mergedTheme.peerOverrides.Scrollbar, contentStyle: contentStyle, container: virtualScroll ? this.virtualListContainer : undefined, content: virtualScroll ? this.virtualListContent : undefined, horizontalRailStyle: { zIndex: 3 }, verticalRailStyle: { zIndex: 3 }, xScrollable: xScrollable, onScroll: virtualScroll ? undefined : this.handleTableBodyScroll, internalOnUpdateScrollLeft: setHeaderScrollLeft, onResize: onResize }, {
285
285
  default: () => {
286
286
  // coordinate to pass if there are cells that cross row & col
287
287
  const cordToPass = {};
@@ -133,10 +133,10 @@ export default defineComponent({
133
133
  $slots.action || positiveText || negativeText || action ? (h("div", { class: `${mergedClsPrefix}-dialog__action` }, renderSlot($slots, 'action', undefined, action
134
134
  ? () => [render(action)]
135
135
  : () => [
136
- this.negativeText && (h(NButton, { theme: mergedTheme.peers.Button, themeOverrides: mergedTheme.peerOverrides.Button, ghost: true, size: "small", onClick: handleNegativeClick }, {
136
+ this.negativeText && (h(NButton, { theme: mergedTheme.peers.Button, themeOverrides: mergedTheme.peerOverrides.Button, ghost: true, size: "small", onClick: handleNegativeClick, internalAutoFocus: !this.positiveText }, {
137
137
  default: () => render(this.negativeText)
138
138
  })),
139
- this.positiveText && (h(NButton, { theme: mergedTheme.peers.Button, themeOverrides: mergedTheme.peerOverrides.Button, disabled: loading, loading: loading, size: "small", type: type === 'default' ? 'primary' : type, onClick: handlePositiveClick }, {
139
+ this.positiveText && (h(NButton, { theme: mergedTheme.peers.Button, themeOverrides: mergedTheme.peerOverrides.Button, disabled: loading, loading: loading, size: "small", type: type === 'default' ? 'primary' : type, onClick: handlePositiveClick, internalAutoFocus: true }, {
140
140
  default: () => render(this.positiveText)
141
141
  }))
142
142
  ]))) : null));
@@ -49,10 +49,10 @@ declare const _default: import("vue").DefineComponent<{
49
49
  }, {
50
50
  mergedClsPrefix: import("vue").ComputedRef<string>;
51
51
  cssVars: import("vue").ComputedRef<{
52
- '--bezier': string;
53
- '--color': string;
54
- '--text-color': string;
55
- '--font-weight': string;
52
+ '--n-bezier': string;
53
+ '--n-color': string;
54
+ '--n-text-color': string;
55
+ '--n-font-weight': string;
56
56
  }>;
57
57
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<{
58
58
  readonly titlePlacement?: unknown;
@@ -17,10 +17,10 @@ export default defineComponent({
17
17
  cssVars: computed(() => {
18
18
  const { common: { cubicBezierEaseInOut }, self: { color, textColor, fontWeight } } = themeRef.value;
19
19
  return {
20
- '--bezier': cubicBezierEaseInOut,
21
- '--color': color,
22
- '--text-color': textColor,
23
- '--font-weight': fontWeight
20
+ '--n-bezier': cubicBezierEaseInOut,
21
+ '--n-color': color,
22
+ '--n-text-color': textColor,
23
+ '--n-font-weight': fontWeight
24
24
  };
25
25
  })
26
26
  };
@@ -1,8 +1,8 @@
1
1
  import { cB, cNotM, cE, cM } from '../../../_utils/cssr'; // vars:
2
- // --bezier
3
- // --color
4
- // --text-color
5
- // --font-weight
2
+ // --n-bezier
3
+ // --n-color
4
+ // --n-text-color
5
+ // --n-font-weight
6
6
 
7
7
  export default cB('divider', `
8
8
  position: relative;
@@ -10,10 +10,10 @@ export default cB('divider', `
10
10
  width: 100%;
11
11
  box-sizing: border-box;
12
12
  font-size: 16px;
13
- color: var(--text-color);
13
+ color: var(--n-text-color);
14
14
  transition:
15
- color .3s var(--bezier),
16
- background-color .3s var(--bezier);
15
+ color .3s var(--n-bezier),
16
+ background-color .3s var(--n-bezier);
17
17
  `, [cNotM('vertical', `
18
18
  margin-top: 24px;
19
19
  margin-bottom: 24px;
@@ -26,7 +26,7 @@ export default cB('divider', `
26
26
  margin-left: 12px;
27
27
  margin-right: 12px;
28
28
  white-space: nowrap;
29
- font-weight: var(--font-weight);
29
+ font-weight: var(--n-font-weight);
30
30
  `), cM('title-position-left', [cE('line', [cM('left', {
31
31
  width: '28px'
32
32
  })])]), cM('title-position-right', [cE('line', [cM('right', {
@@ -45,14 +45,14 @@ export default cB('divider', `
45
45
  width: 1px;
46
46
  `), cE('line', `
47
47
  border: none;
48
- transition: background-color .3s var(--bezier), border-color .3s var(--bezier);
48
+ transition: background-color .3s var(--n-bezier), border-color .3s var(--n-bezier);
49
49
  height: 1px;
50
50
  width: 100%;
51
51
  margin: 0;
52
52
  `), cNotM('dashed', [cE('line', {
53
- backgroundColor: 'var(--color)'
53
+ backgroundColor: 'var(--n-color)'
54
54
  })]), cM('dashed', [cE('line', {
55
- borderColor: 'var(--color)'
55
+ borderColor: 'var(--n-color)'
56
56
  })]), cM('vertical', {
57
- backgroundColor: 'var(--color)'
57
+ backgroundColor: 'var(--n-color)'
58
58
  })]);
@@ -10,7 +10,7 @@ export function parse(value) {
10
10
  }
11
11
  // can be parsed to number but shouldn't be applied when inputing
12
12
  export function isWipValue(value) {
13
- return /^\d+\.$/.test(value) || /^\.\d+$/.test(value);
13
+ return /^(-)?\d+\.$/.test(value) || /^\.\d+$/.test(value);
14
14
  }
15
15
  // string => boolean (expected, not implemented)
16
16
  // number => boolean (legacy)
@@ -81,6 +81,8 @@ export default defineComponent({
81
81
  nTriggerFormBlur();
82
82
  }
83
83
  function handleClick() {
84
+ if (props.loading)
85
+ return;
84
86
  if (!mergedDisabledRef.value) {
85
87
  if (mergedValueRef.value !== props.checkedValue) {
86
88
  doUpdateValue(props.checkedValue);
@@ -100,12 +102,16 @@ export default defineComponent({
100
102
  pressedRef.value = false;
101
103
  }
102
104
  function handleKeyup(e) {
105
+ if (props.loading)
106
+ return;
103
107
  if (e.code === 'Space') {
104
108
  doUpdateValue(!mergedValueRef.value);
105
109
  pressedRef.value = false;
106
110
  }
107
111
  }
108
112
  function handleKeydown(e) {
113
+ if (props.loading)
114
+ return;
109
115
  if (e.code === 'Space') {
110
116
  e.preventDefault();
111
117
  pressedRef.value = true;
@@ -163,6 +169,7 @@ export default defineComponent({
163
169
  checked && `${mergedClsPrefix}-switch--active`,
164
170
  mergedDisabled && `${mergedClsPrefix}-switch--disabled`,
165
171
  this.round && `${mergedClsPrefix}-switch--round`,
172
+ this.loading && `${mergedClsPrefix}-switch--loading`,
166
173
  this.pressed && `${mergedClsPrefix}-switch--pressed`
167
174
  ], tabindex: !this.mergedDisabled ? 0 : undefined, style: this.cssVars, onClick: this.handleClick, onFocus: this.handleFocus, onBlur: this.handleBlur, onKeyup: this.handleKeyup, onKeydown: this.handleKeydown },
168
175
  h("div", { class: `${mergedClsPrefix}-switch__rail`, "aria-hidden": "true", style: mergedRailStyle },
@@ -119,4 +119,6 @@ export default cB('switch', `
119
119
  })]), cM('disabled', [cE('rail', `
120
120
  cursor: not-allowed;
121
121
  opacity: .5;
122
+ `)]), cM('loading', [cE('rail', `
123
+ pointer-events: none;
122
124
  `)])]);
@@ -402,8 +402,8 @@ declare const _default: import("vue").DefineComponent<{
402
402
  }, {
403
403
  mergedClsPrefix: import("vue").ComputedRef<string>;
404
404
  cssVars: import("vue").ComputedRef<{
405
- '--text-color': string;
406
- '--bezier': string;
405
+ '--n-text-color': string;
406
+ '--n-bezier': string;
407
407
  }>;
408
408
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<{
409
409
  readonly theme?: unknown;
@@ -14,8 +14,8 @@ export default defineComponent({
14
14
  cssVars: computed(() => {
15
15
  const { common: { cubicBezierEaseInOut }, self: { aTextColor } } = themeRef.value;
16
16
  return {
17
- '--text-color': aTextColor,
18
- '--bezier': cubicBezierEaseInOut
17
+ '--n-text-color': aTextColor,
18
+ '--n-bezier': cubicBezierEaseInOut
19
19
  };
20
20
  })
21
21
  };
@@ -404,11 +404,11 @@ declare const _default: import("vue").DefineComponent<{
404
404
  }, {
405
405
  mergedClsPrefix: import("vue").ComputedRef<string>;
406
406
  cssVars: import("vue").ComputedRef<{
407
- '--bezier': string;
408
- '--font-size': string;
409
- '--line-height': string;
410
- '--prefix-color': string;
411
- '--text-color': string;
407
+ '--n-bezier': string;
408
+ '--n-font-size': string;
409
+ '--n-line-height': string;
410
+ '--n-prefix-color': string;
411
+ '--n-text-color': string;
412
412
  }>;
413
413
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<{
414
414
  readonly alignText?: unknown;
@@ -14,11 +14,11 @@ export default defineComponent({
14
14
  cssVars: computed(() => {
15
15
  const { common: { cubicBezierEaseInOut }, self: { blockquoteTextColor, blockquotePrefixColor, blockquoteLineHeight, blockquoteFontSize } } = themeRef.value;
16
16
  return {
17
- '--bezier': cubicBezierEaseInOut,
18
- '--font-size': blockquoteFontSize,
19
- '--line-height': blockquoteLineHeight,
20
- '--prefix-color': blockquotePrefixColor,
21
- '--text-color': blockquoteTextColor
17
+ '--n-bezier': cubicBezierEaseInOut,
18
+ '--n-font-size': blockquoteFontSize,
19
+ '--n-line-height': blockquoteLineHeight,
20
+ '--n-prefix-color': blockquotePrefixColor,
21
+ '--n-text-color': blockquoteTextColor
22
22
  };
23
23
  })
24
24
  };
@@ -415,14 +415,14 @@ declare const _default: (level: '1' | '2' | '3' | '4' | '5' | '6') => import("vu
415
415
  }, {
416
416
  mergedClsPrefix: import("vue").ComputedRef<string>;
417
417
  cssVars: import("vue").ComputedRef<{
418
- '--bezier': string;
419
- '--font-size': string;
420
- '--margin': string;
421
- '--bar-color': string;
422
- '--bar-width': string;
423
- '--font-weight': string;
424
- '--text-color': string;
425
- '--prefix-width': string;
418
+ '--n-bezier': string;
419
+ '--n-font-size': string;
420
+ '--n-margin': string;
421
+ '--n-bar-color': string;
422
+ '--n-bar-width': string;
423
+ '--n-font-weight': string;
424
+ '--n-text-color': string;
425
+ '--n-prefix-width': string;
426
426
  }>;
427
427
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<{
428
428
  readonly type?: unknown;
@@ -20,14 +20,14 @@ export default (level) => defineComponent({
20
20
  const { type } = props;
21
21
  const { common: { cubicBezierEaseInOut }, self: { headerFontWeight, headerTextColor, [createKey('headerPrefixWidth', level)]: prefixWidth, [createKey('headerFontSize', level)]: fontSize, [createKey('headerMargin', level)]: margin, [createKey('headerBarWidth', level)]: barWidth, [createKey('headerBarColor', type)]: barColor } } = themeRef.value;
22
22
  return {
23
- '--bezier': cubicBezierEaseInOut,
24
- '--font-size': fontSize,
25
- '--margin': margin,
26
- '--bar-color': barColor,
27
- '--bar-width': barWidth,
28
- '--font-weight': headerFontWeight,
29
- '--text-color': headerTextColor,
30
- '--prefix-width': prefixWidth
23
+ '--n-bezier': cubicBezierEaseInOut,
24
+ '--n-font-size': fontSize,
25
+ '--n-margin': margin,
26
+ '--n-bar-color': barColor,
27
+ '--n-bar-width': barWidth,
28
+ '--n-font-weight': headerFontWeight,
29
+ '--n-text-color': headerTextColor,
30
+ '--n-prefix-width': prefixWidth
31
31
  };
32
32
  })
33
33
  };