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
  }>;
@@ -23,9 +23,6 @@ const scrollbarProps = Object.assign(Object.assign({}, _mixins_1.useTheme.props)
23
23
  }, xScrollable: {
24
24
  type: Boolean,
25
25
  default: false
26
- }, showScrollbar: {
27
- type: Boolean,
28
- default: true
29
26
  },
30
27
  // If container is set, resize observer won't not attached
31
28
  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 });
@@ -479,7 +476,7 @@ const Scrollbar = (0, vue_1.defineComponent)({
479
476
  };
480
477
  },
481
478
  render() {
482
- const { $slots, mergedClsPrefix, showScrollbar } = this;
479
+ const { $slots, mergedClsPrefix } = this;
483
480
  if (!this.scrollable)
484
481
  return (0, vue_1.renderSlot)($slots, 'default');
485
482
  const createChildren = () => (0, vue_1.h)('div', (0, vue_1.mergeProps)(this.$attrs, {
@@ -504,20 +501,20 @@ const Scrollbar = (0, vue_1.defineComponent)({
504
501
  this.contentClass
505
502
  ] }, $slots))
506
503
  }))),
507
- showScrollbar && ((0, vue_1.h)("div", { ref: "yRailRef", class: `${mergedClsPrefix}-scrollbar-rail ${mergedClsPrefix}-scrollbar-rail--vertical`, style: [this.horizontalRailStyle] },
504
+ (0, vue_1.h)("div", { ref: "yRailRef", class: `${mergedClsPrefix}-scrollbar-rail ${mergedClsPrefix}-scrollbar-rail--vertical`, style: [this.horizontalRailStyle] },
508
505
  (0, vue_1.h)(vue_1.Transition, { name: "fade-in-transition" }, {
509
506
  default: () => this.needYBar && this.isShowYBar && !this.isIos ? ((0, vue_1.h)("div", { class: `${mergedClsPrefix}-scrollbar-rail__scrollbar`, style: {
510
507
  height: this.yBarSizePx,
511
508
  top: this.yBarTopPx
512
509
  }, onMousedown: this.handleYScrollMouseDown })) : null
513
- }))),
514
- showScrollbar && ((0, vue_1.h)("div", { ref: "xRailRef", class: `${mergedClsPrefix}-scrollbar-rail ${mergedClsPrefix}-scrollbar-rail--horizontal`, style: [this.verticalRailStyle] },
510
+ })),
511
+ (0, vue_1.h)("div", { ref: "xRailRef", class: `${mergedClsPrefix}-scrollbar-rail ${mergedClsPrefix}-scrollbar-rail--horizontal`, style: [this.verticalRailStyle] },
515
512
  (0, vue_1.h)(vue_1.Transition, { name: "fade-in-transition" }, {
516
513
  default: () => this.needXBar && this.isShowXBar && !this.isIos ? ((0, vue_1.h)("div", { class: `${mergedClsPrefix}-scrollbar-rail__scrollbar`, style: {
517
514
  width: this.xBarSizePx,
518
515
  left: this.xBarLeftPx
519
516
  }, onMousedown: this.handleXScrollMouseDown })) : null
520
- })))
517
+ }))
521
518
  ]);
522
519
  return this.container ? (createChildren()) : ((0, vue_1.h)(vueuc_1.VResizeObserver, { onResize: this.handleContainerResize }, {
523
520
  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;
@@ -57,12 +57,12 @@ exports.default = (0, vue_1.defineComponent)({
57
57
  const { type, color: propColor } = props;
58
58
  const { common: { cubicBezierEaseInOut, cubicBezierEaseOut }, self: { [(0, _utils_1.createKey)('color', type)]: color, fontFamily, fontSize } } = themeRef.value;
59
59
  return {
60
- '--font-size': fontSize,
61
- '--font-family': fontFamily,
62
- '--color': propColor || color,
63
- '--ripple-color': propColor || color,
64
- '--bezier': cubicBezierEaseInOut,
65
- '--ripple-bezier': cubicBezierEaseOut
60
+ '--n-font-size': fontSize,
61
+ '--n-font-family': fontFamily,
62
+ '--n-color': propColor || color,
63
+ '--n-ripple-color': propColor || color,
64
+ '--n-bezier': cubicBezierEaseInOut,
65
+ '--n-ripple-bezier': cubicBezierEaseOut
66
66
  };
67
67
  })
68
68
  };
@@ -13,30 +13,30 @@ Object.defineProperty(exports, "__esModule", {
13
13
  const cssr_1 = require("../../../_utils/cssr");
14
14
 
15
15
  const fade_in_scale_up_cssr_1 = __importDefault(require("../../../_styles/transitions/fade-in-scale-up.cssr")); // vars:
16
- // --color
17
- // --ripple-color
18
- // --bezier
19
- // --ripple-bezier
20
- // --font-size
21
- // --font-family
16
+ // --n-color
17
+ // --n-ripple-color
18
+ // --n-bezier
19
+ // --n-ripple-bezier
20
+ // --n-font-size
21
+ // --n-font-family
22
22
 
23
23
 
24
24
  exports.default = (0, cssr_1.c)([(0, cssr_1.c)('@keyframes badge-wave-spread', {
25
25
  from: {
26
- boxShadow: '0 0 0.5px 0px var(--ripple-color)',
26
+ boxShadow: '0 0 0.5px 0px var(--n-ripple-color)',
27
27
  opacity: 0.6
28
28
  },
29
29
  to: {
30
30
  // don't use exact 5px since chrome will display the animation with glitches
31
- boxShadow: '0 0 0.5px 4.5px var(--ripple-color)',
31
+ boxShadow: '0 0 0.5px 4.5px var(--n-ripple-color)',
32
32
  opacity: 0
33
33
  }
34
34
  }), (0, cssr_1.cB)('badge', `
35
35
  display: inline-flex;
36
36
  position: relative;
37
37
  vertical-align: middle;
38
- color: var(--color);
39
- font-family: var(--font-family);
38
+ color: var(--n-color);
39
+ font-family: var(--n-font-family);
40
40
  `, [(0, cssr_1.cM)('as-is', [(0, cssr_1.cB)('badge-sup', {
41
41
  position: 'static',
42
42
  transform: 'translateX(0)'
@@ -53,10 +53,10 @@ exports.default = (0, cssr_1.c)([(0, cssr_1.c)('@keyframes badge-wave-spread', {
53
53
  }, [(0, cssr_1.c)('::before', {
54
54
  borderRadius: '4px'
55
55
  })])]), (0, cssr_1.cB)('badge-sup', `
56
- background: var(--color);
56
+ background: var(--n-color);
57
57
  transition:
58
- background-color .3s var(--bezier),
59
- color .3s var(--bezier);
58
+ background-color .3s var(--n-bezier),
59
+ color .3s var(--n-bezier);
60
60
  color: #FFF;
61
61
  position: absolute;
62
62
  height: 18px;
@@ -64,7 +64,7 @@ exports.default = (0, cssr_1.c)([(0, cssr_1.c)('@keyframes badge-wave-spread', {
64
64
  border-radius: 9px;
65
65
  padding: 0 6px;
66
66
  text-align: center;
67
- font-size: var(--font-size);
67
+ font-size: var(--n-font-size);
68
68
  transform: translateX(-50%);
69
69
  left: 100%;
70
70
  bottom: calc(100% - 9px);
@@ -78,7 +78,7 @@ exports.default = (0, cssr_1.c)([(0, cssr_1.c)('@keyframes badge-wave-spread', {
78
78
  animationDuration: '2s',
79
79
  animationIterationCount: 'infinite',
80
80
  animationDelay: '1s',
81
- animationTimingFunction: 'var(--ripple-bezier)',
81
+ animationTimingFunction: 'var(--n-ripple-bezier)',
82
82
  animationName: 'badge-wave-spread'
83
83
  }), (0, cssr_1.c)('&::before', `
84
84
  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>;
@@ -33,10 +33,10 @@ const buttonProps = Object.assign(Object.assign({}, _mixins_1.useTheme.props), {
33
33
  }, attrType: {
34
34
  type: String,
35
35
  default: 'button'
36
- }, onClick: [Function, Array], bordered: {
36
+ }, bordered: {
37
37
  type: Boolean,
38
38
  default: true
39
- } });
39
+ }, onClick: [Function, Array], internalAutoFocus: Boolean });
40
40
  const Button = (0, vue_1.defineComponent)({
41
41
  name: 'Button',
42
42
  props: buttonProps,
@@ -50,9 +50,18 @@ const Button = (0, vue_1.defineComponent)({
50
50
  }
51
51
  });
52
52
  }
53
- const selfRef = (0, vue_1.ref)(null);
54
- const waveRef = (0, vue_1.ref)(null);
53
+ const selfElRef = (0, vue_1.ref)(null);
54
+ const waveElRef = (0, vue_1.ref)(null);
55
55
  const enterPressedRef = (0, vue_1.ref)(false);
56
+ (0, vue_1.onMounted)(() => {
57
+ const { value: selfEl } = selfElRef;
58
+ if (selfEl &&
59
+ !props.disabled &&
60
+ props.focusable &&
61
+ props.internalAutoFocus) {
62
+ selfEl.focus({ preventScroll: true });
63
+ }
64
+ });
56
65
  const showBorderRef = (0, vooks_1.useMemo)(() => {
57
66
  return (!props.quaternary &&
58
67
  !props.tertiary &&
@@ -88,19 +97,17 @@ const Button = (0, vue_1.defineComponent)({
88
97
  return;
89
98
  }
90
99
  if (mergedFocusableRef.value) {
91
- (_a = selfRef.value) === null || _a === void 0 ? void 0 : _a.focus({ preventScroll: true });
100
+ (_a = selfElRef.value) === null || _a === void 0 ? void 0 : _a.focus({ preventScroll: true });
92
101
  }
93
102
  };
94
103
  const handleClick = (e) => {
104
+ var _a;
95
105
  if (!props.disabled && !props.loading) {
96
106
  const { onClick } = props;
97
107
  if (onClick)
98
108
  (0, _utils_1.call)(onClick, e);
99
109
  if (!props.text) {
100
- const { value } = waveRef;
101
- if (value) {
102
- value.play();
103
- }
110
+ (_a = waveElRef.value) === null || _a === void 0 ? void 0 : _a.play();
104
111
  }
105
112
  }
106
113
  };
@@ -132,8 +139,8 @@ const Button = (0, vue_1.defineComponent)({
132
139
  const themeRef = (0, _mixins_1.useTheme)('Button', 'Button', button_cssr_1.default, styles_1.buttonLight, props, mergedClsPrefixRef);
133
140
  const rtlEnabledRef = (0, use_rtl_1.default)('Button', NConfigProvider === null || NConfigProvider === void 0 ? void 0 : NConfigProvider.mergedRtlRef, mergedClsPrefixRef);
134
141
  return {
135
- selfRef,
136
- waveRef,
142
+ selfElRef,
143
+ waveElRef,
137
144
  mergedClsPrefix: mergedClsPrefixRef,
138
145
  mergedFocusable: mergedFocusableRef,
139
146
  mergedSize: mergedSizeRef,
@@ -389,7 +396,7 @@ const Button = (0, vue_1.defineComponent)({
389
396
  },
390
397
  render() {
391
398
  const { $slots, mergedClsPrefix, tag: Component } = this;
392
- return ((0, vue_1.h)(Component, { ref: "selfRef", class: [
399
+ return ((0, vue_1.h)(Component, { ref: "selfElRef", class: [
393
400
  `${mergedClsPrefix}-button`,
394
401
  `${mergedClsPrefix}-button--${this.type}-type`,
395
402
  `${mergedClsPrefix}-button--${this.mergedSize}-type`,
@@ -413,7 +420,7 @@ const Button = (0, vue_1.defineComponent)({
413
420
  }))) : null
414
421
  }),
415
422
  $slots.default && this.iconPlacement === 'left' ? ((0, vue_1.h)("span", { class: `${mergedClsPrefix}-button__content` }, $slots)) : null,
416
- !this.text ? ((0, vue_1.h)(_internal_1.NBaseWave, { ref: "waveRef", clsPrefix: mergedClsPrefix })) : null,
423
+ !this.text ? ((0, vue_1.h)(_internal_1.NBaseWave, { ref: "waveElRef", clsPrefix: mergedClsPrefix })) : null,
417
424
  this.showBorder ? ((0, vue_1.h)("div", { "aria-hidden": true, class: `${mergedClsPrefix}-button__border`, style: this.customColorCssVars })) : null,
418
425
  this.showBorder ? ((0, vue_1.h)("div", { "aria-hidden": true, class: `${mergedClsPrefix}-button__state-border`, style: this.customColorCssVars })) : null));
419
426
  }
@@ -286,7 +286,7 @@ exports.default = (0, vue_1.defineComponent)({
286
286
  };
287
287
  if (scrollX)
288
288
  contentStyle.width = '100%';
289
- const tableNode = ((0, vue_1.h)(_internal_1.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 }, {
289
+ const tableNode = ((0, vue_1.h)(_internal_1.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 }, {
290
290
  default: () => {
291
291
  // coordinate to pass if there are cells that cross row & col
292
292
  const cordToPass = {};
@@ -139,10 +139,10 @@ exports.default = (0, vue_1.defineComponent)({
139
139
  $slots.action || positiveText || negativeText || action ? ((0, vue_1.h)("div", { class: `${mergedClsPrefix}-dialog__action` }, (0, vue_1.renderSlot)($slots, 'action', undefined, action
140
140
  ? () => [(0, _utils_1.render)(action)]
141
141
  : () => [
142
- this.negativeText && ((0, vue_1.h)(button_1.NButton, { theme: mergedTheme.peers.Button, themeOverrides: mergedTheme.peerOverrides.Button, ghost: true, size: "small", onClick: handleNegativeClick }, {
142
+ this.negativeText && ((0, vue_1.h)(button_1.NButton, { theme: mergedTheme.peers.Button, themeOverrides: mergedTheme.peerOverrides.Button, ghost: true, size: "small", onClick: handleNegativeClick, internalAutoFocus: !this.positiveText }, {
143
143
  default: () => (0, _utils_1.render)(this.negativeText)
144
144
  })),
145
- this.positiveText && ((0, vue_1.h)(button_1.NButton, { theme: mergedTheme.peers.Button, themeOverrides: mergedTheme.peerOverrides.Button, disabled: loading, loading: loading, size: "small", type: type === 'default' ? 'primary' : type, onClick: handlePositiveClick }, {
145
+ this.positiveText && ((0, vue_1.h)(button_1.NButton, { theme: mergedTheme.peers.Button, themeOverrides: mergedTheme.peerOverrides.Button, disabled: loading, loading: loading, size: "small", type: type === 'default' ? 'primary' : type, onClick: handlePositiveClick, internalAutoFocus: true }, {
146
146
  default: () => (0, _utils_1.render)(this.positiveText)
147
147
  }))
148
148
  ]))) : 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;
@@ -22,10 +22,10 @@ exports.default = (0, vue_1.defineComponent)({
22
22
  cssVars: (0, vue_1.computed)(() => {
23
23
  const { common: { cubicBezierEaseInOut }, self: { color, textColor, fontWeight } } = themeRef.value;
24
24
  return {
25
- '--bezier': cubicBezierEaseInOut,
26
- '--color': color,
27
- '--text-color': textColor,
28
- '--font-weight': fontWeight
25
+ '--n-bezier': cubicBezierEaseInOut,
26
+ '--n-color': color,
27
+ '--n-text-color': textColor,
28
+ '--n-font-weight': fontWeight
29
29
  };
30
30
  })
31
31
  };
@@ -5,10 +5,10 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
 
7
7
  const cssr_1 = require("../../../_utils/cssr"); // vars:
8
- // --bezier
9
- // --color
10
- // --text-color
11
- // --font-weight
8
+ // --n-bezier
9
+ // --n-color
10
+ // --n-text-color
11
+ // --n-font-weight
12
12
 
13
13
 
14
14
  exports.default = (0, cssr_1.cB)('divider', `
@@ -17,10 +17,10 @@ exports.default = (0, cssr_1.cB)('divider', `
17
17
  width: 100%;
18
18
  box-sizing: border-box;
19
19
  font-size: 16px;
20
- color: var(--text-color);
20
+ color: var(--n-text-color);
21
21
  transition:
22
- color .3s var(--bezier),
23
- background-color .3s var(--bezier);
22
+ color .3s var(--n-bezier),
23
+ background-color .3s var(--n-bezier);
24
24
  `, [(0, cssr_1.cNotM)('vertical', `
25
25
  margin-top: 24px;
26
26
  margin-bottom: 24px;
@@ -33,7 +33,7 @@ exports.default = (0, cssr_1.cB)('divider', `
33
33
  margin-left: 12px;
34
34
  margin-right: 12px;
35
35
  white-space: nowrap;
36
- font-weight: var(--font-weight);
36
+ font-weight: var(--n-font-weight);
37
37
  `), (0, cssr_1.cM)('title-position-left', [(0, cssr_1.cE)('line', [(0, cssr_1.cM)('left', {
38
38
  width: '28px'
39
39
  })])]), (0, cssr_1.cM)('title-position-right', [(0, cssr_1.cE)('line', [(0, cssr_1.cM)('right', {
@@ -52,14 +52,14 @@ exports.default = (0, cssr_1.cB)('divider', `
52
52
  width: 1px;
53
53
  `), (0, cssr_1.cE)('line', `
54
54
  border: none;
55
- transition: background-color .3s var(--bezier), border-color .3s var(--bezier);
55
+ transition: background-color .3s var(--n-bezier), border-color .3s var(--n-bezier);
56
56
  height: 1px;
57
57
  width: 100%;
58
58
  margin: 0;
59
59
  `), (0, cssr_1.cNotM)('dashed', [(0, cssr_1.cE)('line', {
60
- backgroundColor: 'var(--color)'
60
+ backgroundColor: 'var(--n-color)'
61
61
  })]), (0, cssr_1.cM)('dashed', [(0, cssr_1.cE)('line', {
62
- borderColor: 'var(--color)'
62
+ borderColor: 'var(--n-color)'
63
63
  })]), (0, cssr_1.cM)('vertical', {
64
- backgroundColor: 'var(--color)'
64
+ backgroundColor: 'var(--n-color)'
65
65
  })]);
@@ -14,7 +14,7 @@ function parse(value) {
14
14
  exports.parse = parse;
15
15
  // can be parsed to number but shouldn't be applied when inputing
16
16
  function isWipValue(value) {
17
- return /^\d+\.$/.test(value) || /^\.\d+$/.test(value);
17
+ return /^(-)?\d+\.$/.test(value) || /^\.\d+$/.test(value);
18
18
  }
19
19
  exports.isWipValue = isWipValue;
20
20
  // string => boolean (expected, not implemented)
@@ -86,6 +86,8 @@ exports.default = (0, vue_1.defineComponent)({
86
86
  nTriggerFormBlur();
87
87
  }
88
88
  function handleClick() {
89
+ if (props.loading)
90
+ return;
89
91
  if (!mergedDisabledRef.value) {
90
92
  if (mergedValueRef.value !== props.checkedValue) {
91
93
  doUpdateValue(props.checkedValue);
@@ -105,12 +107,16 @@ exports.default = (0, vue_1.defineComponent)({
105
107
  pressedRef.value = false;
106
108
  }
107
109
  function handleKeyup(e) {
110
+ if (props.loading)
111
+ return;
108
112
  if (e.code === 'Space') {
109
113
  doUpdateValue(!mergedValueRef.value);
110
114
  pressedRef.value = false;
111
115
  }
112
116
  }
113
117
  function handleKeydown(e) {
118
+ if (props.loading)
119
+ return;
114
120
  if (e.code === 'Space') {
115
121
  e.preventDefault();
116
122
  pressedRef.value = true;
@@ -168,6 +174,7 @@ exports.default = (0, vue_1.defineComponent)({
168
174
  checked && `${mergedClsPrefix}-switch--active`,
169
175
  mergedDisabled && `${mergedClsPrefix}-switch--disabled`,
170
176
  this.round && `${mergedClsPrefix}-switch--round`,
177
+ this.loading && `${mergedClsPrefix}-switch--loading`,
171
178
  this.pressed && `${mergedClsPrefix}-switch--pressed`
172
179
  ], tabindex: !this.mergedDisabled ? 0 : undefined, style: this.cssVars, onClick: this.handleClick, onFocus: this.handleFocus, onBlur: this.handleBlur, onKeyup: this.handleKeyup, onKeydown: this.handleKeydown },
173
180
  (0, vue_1.h)("div", { class: `${mergedClsPrefix}-switch__rail`, "aria-hidden": "true", style: mergedRailStyle },
@@ -133,4 +133,6 @@ exports.default = (0, cssr_1.cB)('switch', `
133
133
  })]), (0, cssr_1.cM)('disabled', [(0, cssr_1.cE)('rail', `
134
134
  cursor: not-allowed;
135
135
  opacity: .5;
136
+ `)]), (0, cssr_1.cM)('loading', [(0, cssr_1.cE)('rail', `
137
+ pointer-events: none;
136
138
  `)])]);
@@ -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;
@@ -19,8 +19,8 @@ exports.default = (0, vue_1.defineComponent)({
19
19
  cssVars: (0, vue_1.computed)(() => {
20
20
  const { common: { cubicBezierEaseInOut }, self: { aTextColor } } = themeRef.value;
21
21
  return {
22
- '--text-color': aTextColor,
23
- '--bezier': cubicBezierEaseInOut
22
+ '--n-text-color': aTextColor,
23
+ '--n-bezier': cubicBezierEaseInOut
24
24
  };
25
25
  })
26
26
  };
@@ -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;
@@ -19,11 +19,11 @@ exports.default = (0, vue_1.defineComponent)({
19
19
  cssVars: (0, vue_1.computed)(() => {
20
20
  const { common: { cubicBezierEaseInOut }, self: { blockquoteTextColor, blockquotePrefixColor, blockquoteLineHeight, blockquoteFontSize } } = themeRef.value;
21
21
  return {
22
- '--bezier': cubicBezierEaseInOut,
23
- '--font-size': blockquoteFontSize,
24
- '--line-height': blockquoteLineHeight,
25
- '--prefix-color': blockquotePrefixColor,
26
- '--text-color': blockquoteTextColor
22
+ '--n-bezier': cubicBezierEaseInOut,
23
+ '--n-font-size': blockquoteFontSize,
24
+ '--n-line-height': blockquoteLineHeight,
25
+ '--n-prefix-color': blockquotePrefixColor,
26
+ '--n-text-color': blockquoteTextColor
27
27
  };
28
28
  })
29
29
  };
@@ -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;
@@ -25,14 +25,14 @@ exports.default = (level) => (0, vue_1.defineComponent)({
25
25
  const { type } = props;
26
26
  const { common: { cubicBezierEaseInOut }, self: { headerFontWeight, headerTextColor, [(0, _utils_1.createKey)('headerPrefixWidth', level)]: prefixWidth, [(0, _utils_1.createKey)('headerFontSize', level)]: fontSize, [(0, _utils_1.createKey)('headerMargin', level)]: margin, [(0, _utils_1.createKey)('headerBarWidth', level)]: barWidth, [(0, _utils_1.createKey)('headerBarColor', type)]: barColor } } = themeRef.value;
27
27
  return {
28
- '--bezier': cubicBezierEaseInOut,
29
- '--font-size': fontSize,
30
- '--margin': margin,
31
- '--bar-color': barColor,
32
- '--bar-width': barWidth,
33
- '--font-weight': headerFontWeight,
34
- '--text-color': headerTextColor,
35
- '--prefix-width': prefixWidth
28
+ '--n-bezier': cubicBezierEaseInOut,
29
+ '--n-font-size': fontSize,
30
+ '--n-margin': margin,
31
+ '--n-bar-color': barColor,
32
+ '--n-bar-width': barWidth,
33
+ '--n-font-weight': headerFontWeight,
34
+ '--n-text-color': headerTextColor,
35
+ '--n-prefix-width': prefixWidth
36
36
  };
37
37
  })
38
38
  };