naive-ui 2.30.5 → 2.30.6

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.
package/dist/index.js CHANGED
@@ -5000,44 +5000,42 @@
5000
5000
  },
5001
5001
 
5002
5002
  setup(props) {
5003
- return {
5004
- registered: false,
5005
-
5006
- handleResize(entry) {
5007
- const {
5008
- onResize
5009
- } = props;
5010
- if (onResize !== undefined) onResize(entry);
5011
- }
5012
-
5013
- };
5014
- },
5003
+ let registered = false; // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
5015
5004
 
5016
- mounted() {
5017
- const el = this.$el;
5005
+ const proxy = vue.getCurrentInstance().proxy;
5018
5006
 
5019
- if (el === undefined) {
5020
- warn('resize-observer', '$el does not exist.');
5021
- return;
5007
+ function handleResize(entry) {
5008
+ const {
5009
+ onResize
5010
+ } = props;
5011
+ if (onResize !== undefined) onResize(entry);
5022
5012
  }
5023
5013
 
5024
- if (el.nextElementSibling !== el.nextSibling) {
5025
- if (el.nodeType === 3 && el.nodeValue !== '') {
5026
- warn('resize-observer', '$el can not be observed (it may be a text node).');
5014
+ vue.onMounted(() => {
5015
+ const el = proxy.$el;
5016
+
5017
+ if (el === undefined) {
5018
+ warn('resize-observer', '$el does not exist.');
5027
5019
  return;
5028
5020
  }
5029
- }
5030
5021
 
5031
- if (el.nextElementSibling !== null) {
5032
- resizeObserverManager.registerHandler(el.nextElementSibling, this.handleResize);
5033
- this.registered = true;
5034
- }
5035
- },
5022
+ if (el.nextElementSibling !== el.nextSibling) {
5023
+ if (el.nodeType === 3 && el.nodeValue !== '') {
5024
+ warn('resize-observer', '$el can not be observed (it may be a text node).');
5025
+ return;
5026
+ }
5027
+ }
5036
5028
 
5037
- beforeUnmount() {
5038
- if (this.registered) {
5039
- resizeObserverManager.unregisterHandler(this.$el.nextElementSibling);
5040
- }
5029
+ if (el.nextElementSibling !== null) {
5030
+ resizeObserverManager.registerHandler(el.nextElementSibling, handleResize);
5031
+ registered = true;
5032
+ }
5033
+ });
5034
+ vue.onBeforeUnmount(() => {
5035
+ if (registered) {
5036
+ resizeObserverManager.unregisterHandler(proxy.$el.nextElementSibling);
5037
+ }
5038
+ });
5041
5039
  },
5042
5040
 
5043
5041
  render() {
@@ -46498,7 +46496,7 @@
46498
46496
  }
46499
46497
  function normalizeAlphaUnit(value) {
46500
46498
  if (/^\d{1,3}\.?\d*%$/.test(value.trim())) {
46501
- return Math.max(0, Math.min(parseInt(value), 100));
46499
+ return Math.max(0, Math.min(parseInt(value) / 100, 100));
46502
46500
  }
46503
46501
  return false;
46504
46502
  }
@@ -58240,6 +58238,10 @@
58240
58238
  var Cell = vue.defineComponent({
58241
58239
  name: "DataTableCell",
58242
58240
  props: {
58241
+ clsPrefix: {
58242
+ type: String,
58243
+ required: true
58244
+ },
58243
58245
  row: {
58244
58246
  type: Object,
58245
58247
  required: true
@@ -58272,13 +58274,19 @@
58272
58274
  cell = renderCell ? renderCell(lodash.exports.get(row, key), row, column) : lodash.exports.get(row, key);
58273
58275
  }
58274
58276
  }
58275
- if (ellipsis && typeof ellipsis === "object") {
58276
- const { mergedTheme } = this;
58277
- return /* @__PURE__ */ vue.h(NEllipsis, {
58278
- ...ellipsis,
58279
- theme: mergedTheme.peers.Ellipsis,
58280
- themeOverrides: mergedTheme.peerOverrides.Ellipsis
58281
- }, { default: () => cell });
58277
+ if (ellipsis) {
58278
+ if (typeof ellipsis === "object") {
58279
+ const { mergedTheme } = this;
58280
+ return /* @__PURE__ */ vue.h(NEllipsis, {
58281
+ ...ellipsis,
58282
+ theme: mergedTheme.peers.Ellipsis,
58283
+ themeOverrides: mergedTheme.peerOverrides.Ellipsis
58284
+ }, { default: () => cell });
58285
+ } else {
58286
+ return /* @__PURE__ */ vue.h("span", {
58287
+ class: `${this.clsPrefix}-data-table-td__ellipsis`
58288
+ }, cell);
58289
+ }
58282
58290
  }
58283
58291
  return cell;
58284
58292
  }
@@ -58894,7 +58902,7 @@
58894
58902
  }
58895
58903
  }
58896
58904
  const hoverKey = isCrossRowTd ? this.hoverKey : null;
58897
- const { ellipsis, cellProps } = column;
58905
+ const { cellProps } = column;
58898
58906
  const resolvedCellProps = cellProps?.(rowData, rowIndex);
58899
58907
  return /* @__PURE__ */ vue.h("td", {
58900
58908
  ...resolvedCellProps,
@@ -58919,7 +58927,6 @@
58919
58927
  column.fixed && `${mergedClsPrefix}-data-table-td--fixed-${column.fixed}`,
58920
58928
  column.align && `${mergedClsPrefix}-data-table-td--${column.align}-align`,
58921
58929
  {
58922
- [`${mergedClsPrefix}-data-table-td--ellipsis`]: ellipsis === true || ellipsis && !ellipsis.tooltip,
58923
58930
  [`${mergedClsPrefix}-data-table-td--selection`]: column.type === "selection",
58924
58931
  [`${mergedClsPrefix}-data-table-td--expand`]: column.type === "expand",
58925
58932
  [`${mergedClsPrefix}-data-table-td--last-col`]: isLastCol,
@@ -58952,6 +58959,7 @@
58952
58959
  expanded,
58953
58960
  onClick: () => handleUpdateExpanded(rowKey, null)
58954
58961
  }) : null : null : /* @__PURE__ */ vue.h(Cell, {
58962
+ clsPrefix: mergedClsPrefix,
58955
58963
  index: rowIndex,
58956
58964
  row: rowData,
58957
58965
  column,
@@ -60409,20 +60417,25 @@
60409
60417
  background-color .3s var(--n-bezier),
60410
60418
  border-color .3s var(--n-bezier),
60411
60419
  color .3s var(--n-bezier);
60412
- `, [cM("last-row", {
60420
+ `, [cM("expand", [cB("data-table-expand-trigger", `
60421
+ margin-right: 0;
60422
+ `)]), cM("last-row", {
60413
60423
  borderBottom: "0 solid var(--n-merged-border-color)"
60414
60424
  }, [c$1("&::after", {
60415
60425
  bottom: "0 !important"
60416
60426
  }), c$1("&::before", {
60417
60427
  bottom: "0 !important"
60418
60428
  })]), cM("summary", `
60419
- background-color: var(--n-merged-th-color);
60420
- `), cM("hover", {
60429
+ background-color: var(--n-merged-th-color);
60430
+ `), cM("hover", {
60421
60431
  backgroundColor: "var(--n-merged-td-color-hover)"
60422
- }), cM("ellipsis", `
60432
+ }), cE("ellipsis", `
60433
+ display: inline-block;
60423
60434
  text-overflow: ellipsis;
60424
60435
  overflow: hidden;
60425
60436
  white-space: nowrap;
60437
+ max-width: 100%;
60438
+ vertical-align: bottom;
60426
60439
  `), cM("selection, expand", `
60427
60440
  text-align: center;
60428
60441
  padding: 0;
@@ -71644,10 +71657,8 @@
71644
71657
  },
71645
71658
  blockScroll: Boolean,
71646
71659
  ...presetProps,
71647
- onClickoutside: {
71648
- type: Function,
71649
- required: true
71650
- },
71660
+ renderMask: Function,
71661
+ onClickoutside: Function,
71651
71662
  onBeforeLeave: {
71652
71663
  type: Function,
71653
71664
  required: true
@@ -71744,9 +71755,6 @@
71744
71755
  function handlePositiveClick() {
71745
71756
  props.onPositiveClick();
71746
71757
  }
71747
- function handleClickOutside(e) {
71748
- props.onClickoutside(e);
71749
- }
71750
71758
  const childNodeRef = vue.ref(null);
71751
71759
  vue.watch(childNodeRef, (node) => {
71752
71760
  if (node) {
@@ -71770,7 +71778,6 @@
71770
71778
  scrollbarRef,
71771
71779
  displayed: displayedRef,
71772
71780
  childNodeRef,
71773
- handleClickOutside,
71774
71781
  handlePositiveClick,
71775
71782
  handleNegativeClick,
71776
71783
  handleCloseClick,
@@ -71786,7 +71793,6 @@
71786
71793
  handleEnter,
71787
71794
  handleAfterLeave,
71788
71795
  handleBeforeLeave,
71789
- handleClickOutside,
71790
71796
  preset,
71791
71797
  mergedClsPrefix
71792
71798
  } = this;
@@ -71811,54 +71817,63 @@
71811
71817
  themeOverrides: this.mergedTheme.peerOverrides.Scrollbar,
71812
71818
  contentClass: `${mergedClsPrefix}-modal-scroll-content`
71813
71819
  }, {
71814
- default: () => /* @__PURE__ */ vue.h(FocusTrap, {
71815
- disabled: !this.trapFocus,
71816
- active: this.show,
71817
- onEsc: this.onEsc,
71818
- autoFocus: this.autoFocus
71819
- }, {
71820
- default: () => /* @__PURE__ */ vue.h(vue.Transition, {
71821
- name: "fade-in-scale-up-transition",
71822
- appear: this.appear ?? this.isMounted,
71823
- onEnter: handleEnter,
71824
- onAfterEnter: this.onAfterEnter,
71825
- onAfterLeave: handleAfterLeave,
71826
- onBeforeLeave: handleBeforeLeave
71820
+ default: () => [
71821
+ this.renderMask?.(),
71822
+ /* @__PURE__ */ vue.h(FocusTrap, {
71823
+ disabled: !this.trapFocus,
71824
+ active: this.show,
71825
+ onEsc: this.onEsc,
71826
+ autoFocus: this.autoFocus
71827
71827
  }, {
71828
- default: () => vue.withDirectives(this.preset === "confirm" || this.preset === "dialog" ? /* @__PURE__ */ vue.h(NDialog, {
71829
- ...this.$attrs,
71830
- class: [
71831
- `${mergedClsPrefix}-modal`,
71832
- this.$attrs.class
71833
- ],
71834
- ref: "bodyRef",
71835
- theme: this.mergedTheme.peers.Dialog,
71836
- themeOverrides: this.mergedTheme.peerOverrides.Dialog,
71837
- ...keep(this.$props, dialogPropKeys),
71838
- "aria-modal": "true"
71839
- }, $slots) : this.preset === "card" ? /* @__PURE__ */ vue.h(NCard, {
71840
- ...this.$attrs,
71841
- ref: "bodyRef",
71842
- class: [
71843
- `${mergedClsPrefix}-modal`,
71844
- this.$attrs.class
71845
- ],
71846
- theme: this.mergedTheme.peers.Card,
71847
- themeOverrides: this.mergedTheme.peerOverrides.Card,
71848
- ...keep(this.$props, cardBasePropKeys),
71849
- "aria-modal": "true",
71850
- role: "dialog"
71851
- }, $slots) : this.childNodeRef = childNode, [
71852
- [vue.vShow, this.show],
71853
- [
71854
- clickoutside,
71855
- handleClickOutside,
71856
- void 0,
71857
- { capture: true }
71858
- ]
71859
- ])
71828
+ default: () => /* @__PURE__ */ vue.h(vue.Transition, {
71829
+ name: "fade-in-scale-up-transition",
71830
+ appear: this.appear ?? this.isMounted,
71831
+ onEnter: handleEnter,
71832
+ onAfterEnter: this.onAfterEnter,
71833
+ onAfterLeave: handleAfterLeave,
71834
+ onBeforeLeave: handleBeforeLeave
71835
+ }, {
71836
+ default: () => {
71837
+ const dirs = [
71838
+ [vue.vShow, this.show]
71839
+ ];
71840
+ const { onClickoutside } = this;
71841
+ if (onClickoutside) {
71842
+ dirs.push([
71843
+ clickoutside,
71844
+ this.onClickoutside,
71845
+ void 0,
71846
+ { capture: true }
71847
+ ]);
71848
+ }
71849
+ return vue.withDirectives(this.preset === "confirm" || this.preset === "dialog" ? /* @__PURE__ */ vue.h(NDialog, {
71850
+ ...this.$attrs,
71851
+ class: [
71852
+ `${mergedClsPrefix}-modal`,
71853
+ this.$attrs.class
71854
+ ],
71855
+ ref: "bodyRef",
71856
+ theme: this.mergedTheme.peers.Dialog,
71857
+ themeOverrides: this.mergedTheme.peerOverrides.Dialog,
71858
+ ...keep(this.$props, dialogPropKeys),
71859
+ "aria-modal": "true"
71860
+ }, $slots) : this.preset === "card" ? /* @__PURE__ */ vue.h(NCard, {
71861
+ ...this.$attrs,
71862
+ ref: "bodyRef",
71863
+ class: [
71864
+ `${mergedClsPrefix}-modal`,
71865
+ this.$attrs.class
71866
+ ],
71867
+ theme: this.mergedTheme.peers.Card,
71868
+ themeOverrides: this.mergedTheme.peerOverrides.Card,
71869
+ ...keep(this.$props, cardBasePropKeys),
71870
+ "aria-modal": "true",
71871
+ role: "dialog"
71872
+ }, $slots) : this.childNodeRef = childNode, dirs);
71873
+ }
71874
+ })
71860
71875
  })
71861
- })
71876
+ ]
71862
71877
  })), [
71863
71878
  [
71864
71879
  vue.vShow,
@@ -72129,6 +72144,7 @@
72129
72144
  }, {
72130
72145
  default: () => {
72131
72146
  this.onRender?.();
72147
+ const { unstableShowMask } = this;
72132
72148
  return vue.withDirectives(/* @__PURE__ */ vue.h("div", {
72133
72149
  role: "none",
72134
72150
  ref: "containerRef",
@@ -72138,19 +72154,7 @@
72138
72154
  this.namespace
72139
72155
  ],
72140
72156
  style: this.cssVars
72141
- }, this.unstableShowMask ? /* @__PURE__ */ vue.h(vue.Transition, {
72142
- name: "fade-in-transition",
72143
- key: "mask",
72144
- appear: this.internalAppear ?? this.isMounted
72145
- }, {
72146
- default: () => {
72147
- return this.show ? /* @__PURE__ */ vue.h("div", {
72148
- "aria-hidden": true,
72149
- ref: "containerRef",
72150
- class: `${mergedClsPrefix}-modal-mask`
72151
- }) : null;
72152
- }
72153
- }) : null, /* @__PURE__ */ vue.h(NModalBodyWrapper, {
72157
+ }, /* @__PURE__ */ vue.h(NModalBodyWrapper, {
72154
72158
  style: this.overlayStyle,
72155
72159
  ...this.$attrs,
72156
72160
  ref: "bodyWrapper",
@@ -72168,7 +72172,21 @@
72168
72172
  onBeforeLeave: this.handleBeforeLeave,
72169
72173
  onAfterEnter: this.onAfterEnter,
72170
72174
  onAfterLeave: this.handleAfterLeave,
72171
- onClickoutside: this.handleClickoutside
72175
+ onClickoutside: unstableShowMask ? void 0 : this.handleClickoutside,
72176
+ renderMask: unstableShowMask ? () => /* @__PURE__ */ vue.h(vue.Transition, {
72177
+ name: "fade-in-transition",
72178
+ key: "mask",
72179
+ appear: this.internalAppear ?? this.isMounted
72180
+ }, {
72181
+ default: () => {
72182
+ return this.show ? /* @__PURE__ */ vue.h("div", {
72183
+ "aria-hidden": true,
72184
+ ref: "containerRef",
72185
+ class: `${mergedClsPrefix}-modal-mask`,
72186
+ onClick: this.handleClickoutside
72187
+ }) : null;
72188
+ }
72189
+ }) : void 0
72172
72190
  }, this.$slots)), [
72173
72191
  [
72174
72192
  zindexable,
@@ -76566,6 +76584,7 @@
76566
76584
  props: gridItemProps,
76567
76585
  setup() {
76568
76586
  const {
76587
+ isSsrRef,
76569
76588
  xGapRef,
76570
76589
  itemStyleRef,
76571
76590
  overflowRef
@@ -76575,6 +76594,7 @@
76575
76594
  overflow: overflowRef,
76576
76595
  itemStyle: itemStyleRef,
76577
76596
  deriveStyle: () => {
76597
+ void isSsrRef.value;
76578
76598
  const {
76579
76599
  privateSpan = defaultSpan,
76580
76600
  privateShow = true,
@@ -77164,6 +77184,7 @@
77164
77184
  };
77165
77185
 
77166
77186
  const defaultCols = 24;
77187
+ const SSR_ATTR_NAME = "__ssr__";
77167
77188
  const gridProps = {
77168
77189
  responsive: {
77169
77190
  type: [String, Boolean],
@@ -77232,12 +77253,26 @@
77232
77253
  }
77233
77254
  return void 0;
77234
77255
  });
77256
+ const isSsrRef = vue.ref(false);
77257
+ const contentElRef = vue.ref();
77258
+ vue.onMounted(() => {
77259
+ const { value: contentEl } = contentElRef;
77260
+ if (contentEl) {
77261
+ if (contentEl.hasAttribute(SSR_ATTR_NAME)) {
77262
+ contentEl.removeAttribute(SSR_ATTR_NAME);
77263
+ isSsrRef.value = true;
77264
+ }
77265
+ }
77266
+ });
77235
77267
  vue.provide(gridInjectionKey, {
77268
+ isSsrRef,
77236
77269
  itemStyleRef: vue.toRef(props, "itemStyle"),
77237
77270
  xGapRef: responsiveXGapRef,
77238
77271
  overflowRef
77239
77272
  });
77240
77273
  return {
77274
+ isSsr: !isBrowser$2,
77275
+ contentEl: contentElRef,
77241
77276
  mergedClsPrefix: mergedClsPrefixRef,
77242
77277
  style: vue.computed(() => {
77243
77278
  return {
@@ -77341,8 +77376,10 @@
77341
77376
  }
77342
77377
  }
77343
77378
  return vue.h("div", vue.mergeProps({
77379
+ ref: "contentEl",
77344
77380
  class: `${this.mergedClsPrefix}-grid`,
77345
- style: this.style
77381
+ style: this.style,
77382
+ [SSR_ATTR_NAME]: this.isSsr || void 0
77346
77383
  }, this.$attrs), childrenAndRawSpan.map(({ child }) => child));
77347
77384
  };
77348
77385
  return this.isResponsive && this.responsive === "self" ? /* @__PURE__ */ vue.h(VResizeObserver, {
@@ -80133,6 +80170,8 @@
80133
80170
  shouldStartLoading: shouldStartLoadingRef,
80134
80171
  loaded: loadedRef,
80135
80172
  mergedOnError: (e) => {
80173
+ if (!shouldStartLoadingRef.value)
80174
+ return;
80136
80175
  showErrorRef.value = true;
80137
80176
  const { onError, imgProps: { onError: imgPropsOnError } = {} } = props;
80138
80177
  onError?.(e);
@@ -96608,7 +96647,7 @@
96608
96647
  createDiscreteApi: createDiscreteApi
96609
96648
  });
96610
96649
 
96611
- var version = "2.30.5";
96650
+ var version = "2.30.6";
96612
96651
 
96613
96652
  function create() {
96614
96653
  let {