@sdata/web-vue 4.4.2 → 4.5.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.
@@ -1,16 +1,17 @@
1
- type __VLS_Props = {
1
+ declare const _default: typeof __VLS_export;
2
+ export default _default;
3
+ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<{
2
4
  description?: string;
3
5
  imgSrc?: string;
4
6
  inConfigProvider?: boolean;
5
- };
6
- type __VLS_Slots = {
7
+ }, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{
8
+ description?: string;
9
+ imgSrc?: string;
10
+ inConfigProvider?: boolean;
11
+ }> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
7
12
  default?: () => unknown;
8
13
  image?: () => unknown;
9
- };
10
- declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
11
- declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
12
- declare const _default: typeof __VLS_export;
13
- export default _default;
14
+ }>;
14
15
  type __VLS_WithSlots<T, S> = T & {
15
16
  new (): {
16
17
  $slots: S;
@@ -3,9 +3,11 @@ import _objectSpread2 from "../_virtual/_@oxc-project_runtime@0.146.0/helpers/es
3
3
  import { getPrefixCls } from "../_utils/global-config.js";
4
4
  import { useI18n } from "../locale/index.js";
5
5
  import IconEmpty from "../icon/icon-empty/index.js";
6
- import { createBlock, createElementBlock, createElementVNode, createTextVNode, defineComponent, inject, mergeProps, normalizeClass, openBlock, renderSlot, resolveDynamicComponent, toDisplayString, unref, useSlots } from "vue";
6
+ import { createBlock, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, inject, mergeProps, normalizeClass, normalizeProps, openBlock, renderSlot, toDisplayString, unref, useSlots } from "vue";
7
7
  //#region components/empty/empty.vue?vue&type=script&setup=true&lang.ts
8
8
  var _hoisted_1 = ["src", "alt"];
9
+ var CustomEmptyRenderer = (props) => props.vnode;
10
+ CustomEmptyRenderer.props = ["vnode"];
9
11
  var empty_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent(_objectSpread2(_objectSpread2({}, {
10
12
  name: "Empty",
11
13
  inheritAttrs: false
@@ -24,9 +26,13 @@ var empty_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComp
24
26
  const prefixCls = getPrefixCls("empty");
25
27
  const { t } = useI18n();
26
28
  const configCtx = inject(configProviderInjectionKey, void 0);
27
- const getCustomEmpty = () => configCtx === null || configCtx === void 0 ? void 0 : configCtx.slots.empty;
29
+ const getCustomEmpty = () => {
30
+ const slot = configCtx === null || configCtx === void 0 ? void 0 : configCtx.slots.empty;
31
+ const vnode = slot ? slot({ component: "empty" }) : void 0;
32
+ if (vnode && typeof vnode === "object") return vnode;
33
+ };
28
34
  return (_ctx, _cache) => {
29
- return !__props.inConfigProvider && getCustomEmpty() && !slots.image && !__props.imgSrc && !__props.description ? (openBlock(), createBlock(resolveDynamicComponent(getCustomEmpty()), mergeProps({ key: 0 }, _ctx.$attrs, { component: "empty" }), null, 16)) : (openBlock(), createElementBlock("div", mergeProps({
35
+ return !__props.inConfigProvider && getCustomEmpty() && !slots.image && !__props.imgSrc && !__props.description ? (openBlock(), createElementBlock("div", normalizeProps(mergeProps({ key: 0 }, _ctx.$attrs)), [createVNode(CustomEmptyRenderer, { vnode: getCustomEmpty() }, null, 8, ["vnode"])], 16)) : (openBlock(), createElementBlock("div", mergeProps({
30
36
  key: 1,
31
37
  class: unref(prefixCls)
32
38
  }, _ctx.$attrs), [createElementVNode("div", { class: normalizeClass(`${unref(prefixCls)}-image`) }, [renderSlot(_ctx.$slots, "image", {}, () => [__props.imgSrc ? (openBlock(), createElementBlock("img", {
package/es/index.css CHANGED
@@ -5825,7 +5825,7 @@ body.sd-tour-active .sd-tour-popover * {
5825
5825
  border-top: none;
5826
5826
  }
5827
5827
  .sd-tabs-content-animation {
5828
- transition: margin 0.2s cubic-bezier(0.34, 0.69, 0.1, 1);
5828
+ transition: transform 0.2s cubic-bezier(0.34, 0.69, 0.1, 1);
5829
5829
  }
5830
5830
  .sd-tabs-horizontal.sd-tabs-justify {
5831
5831
  display: flex;
@@ -329,55 +329,7 @@ declare const Tabs: {
329
329
  extra(): unknown;
330
330
  };
331
331
  }) & {
332
- TabPane: {
333
- new (...args: any[]): import("vue").CreateComponentPublicInstanceWithMixins<Readonly<import("vue").ExtractPropTypes<{
334
- title: StringConstructor;
335
- disabled: {
336
- type: BooleanConstructor;
337
- default: boolean;
338
- };
339
- closable: {
340
- type: BooleanConstructor;
341
- default: boolean;
342
- };
343
- destroyOnHide: {
344
- type: BooleanConstructor;
345
- default: boolean;
346
- };
347
- }>> & Readonly<{}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, import("vue").PublicProps, {
348
- disabled: boolean;
349
- closable: boolean;
350
- destroyOnHide: boolean;
351
- }, true, {}, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, {}, any, import("vue").ComponentProvideOptions, {
352
- P: {};
353
- B: {};
354
- D: {};
355
- C: {};
356
- M: {};
357
- Defaults: {};
358
- }, Readonly<import("vue").ExtractPropTypes<{
359
- title: StringConstructor;
360
- disabled: {
361
- type: BooleanConstructor;
362
- default: boolean;
363
- };
364
- closable: {
365
- type: BooleanConstructor;
366
- default: boolean;
367
- };
368
- destroyOnHide: {
369
- type: BooleanConstructor;
370
- default: boolean;
371
- };
372
- }>> & Readonly<{}>, {}, {}, {}, {}, {
373
- disabled: boolean;
374
- closable: boolean;
375
- destroyOnHide: boolean;
376
- }>;
377
- __isFragment?: never;
378
- __isTeleport?: never;
379
- __isSuspense?: never;
380
- } & import("vue").ComponentOptionsBase<Readonly<import("vue").ExtractPropTypes<{
332
+ TabPane: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
381
333
  title: StringConstructor;
382
334
  disabled: {
383
335
  type: BooleanConstructor;
@@ -391,17 +343,25 @@ declare const Tabs: {
391
343
  type: BooleanConstructor;
392
344
  default: boolean;
393
345
  };
394
- }>> & Readonly<{}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, {
346
+ }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
347
+ title: StringConstructor;
348
+ disabled: {
349
+ type: BooleanConstructor;
350
+ default: boolean;
351
+ };
352
+ closable: {
353
+ type: BooleanConstructor;
354
+ default: boolean;
355
+ };
356
+ destroyOnHide: {
357
+ type: BooleanConstructor;
358
+ default: boolean;
359
+ };
360
+ }>> & Readonly<{}>, {
395
361
  disabled: boolean;
396
362
  closable: boolean;
397
363
  destroyOnHide: boolean;
398
- }, {}, string, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, import("vue").ComponentProvideOptions> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & (new () => {
399
- $slots: {
400
- default?: (props: {}) => any;
401
- } & {
402
- default?: (props: {}) => any;
403
- };
404
- });
364
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
405
365
  install: (app: App, options?: SDOptions) => void;
406
366
  };
407
367
  export type TabsInstance = InstanceType<typeof _Tabs>;
@@ -407,7 +407,7 @@
407
407
  border-top: none;
408
408
  }
409
409
  .sd-tabs-content-animation {
410
- transition: margin 0.2s cubic-bezier(0.34, 0.69, 0.1, 1);
410
+ transition: transform 0.2s cubic-bezier(0.34, 0.69, 0.1, 1);
411
411
  }
412
412
  .sd-tabs-horizontal.sd-tabs-justify {
413
413
  display: flex;
@@ -627,7 +627,8 @@ $tabs-prefix-cls: string.unquote('#{theme.$prefix}-tabs');
627
627
  }
628
628
 
629
629
  &-content-animation {
630
- transition: margin theme.$transition-duration-2 theme.$transition-timing-function-standard;
630
+ // transform 位移动画由合成器处理,避免重型面板逐帧 reflow
631
+ transition: transform theme.$transition-duration-2 theme.$transition-timing-function-standard;
631
632
  }
632
633
 
633
634
  &-horizontal#{&}-justify {
@@ -1,10 +1,4 @@
1
- declare var __VLS_7: {}, __VLS_9: {};
2
- type __VLS_Slots = {} & {
3
- default?: (props: typeof __VLS_7) => any;
4
- } & {
5
- default?: (props: typeof __VLS_9) => any;
6
- };
7
- declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
1
+ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
8
2
  title: StringConstructor;
9
3
  disabled: {
10
4
  type: BooleanConstructor;
@@ -37,11 +31,5 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
37
31
  closable: boolean;
38
32
  destroyOnHide: boolean;
39
33
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
40
- declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
41
34
  declare const _default: typeof __VLS_export;
42
35
  export default _default;
43
- type __VLS_WithSlots<T, S> = T & {
44
- new (): {
45
- $slots: S;
46
- };
47
- };
@@ -2,7 +2,7 @@ import _objectSpread2 from "../_virtual/_@oxc-project_runtime@0.146.0/helpers/es
2
2
  import { getPrefixCls } from "../_utils/global-config.js";
3
3
  import Scrollbar from "../scrollbar/index.js";
4
4
  import { tabsInjectionKey } from "./context.js";
5
- import { computed, createBlock, createCommentVNode, createElementBlock, defineComponent, getCurrentInstance, inject, mergeProps, normalizeClass, onBeforeUnmount, onUpdated, openBlock, reactive, ref, renderSlot, toRefs, unref, useSlots, watch, withCtx } from "vue";
5
+ import { computed, createBlock, createCommentVNode, createElementBlock, createVNode, defineComponent, getCurrentInstance, inject, mergeProps, normalizeClass, onBeforeUnmount, onUpdated, openBlock, reactive, ref, toRefs, unref, useSlots, watch, withCtx } from "vue";
6
6
  //#region components/tabs/tab-pane.vue?vue&type=script&setup=true&lang.ts
7
7
  var _hoisted_1 = [
8
8
  "id",
@@ -76,6 +76,27 @@ var tab_pane_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineC
76
76
  return scrollbar !== false && scrollbar !== void 0;
77
77
  });
78
78
  const paneCls = computed(() => [`${prefixCls}-pane`, { [`${prefixCls}-pane-scroll`]: hasPaneScrollbar.value }]);
79
+ /**
80
+ * 非激活时冻结面板内容:复用上次渲染的同一批 vnode 引用,Vue 渲染器对
81
+ * 相同引用会整体跳过 patch,避免切换标签时重型面板子树被反复重建和 diff。
82
+ * 面板激活期间始终渲染最新内容并同步缓存,重新激活时自动补上隐藏期间
83
+ * 错过的父作用域数据更新。
84
+ */
85
+ const PaneContent = defineComponent({
86
+ name: "TabPaneContent",
87
+ setup() {
88
+ let cache = null;
89
+ return () => {
90
+ var _cache2, _slots$default3, _slots$default4;
91
+ if (active.value) {
92
+ var _slots$default, _slots$default2;
93
+ cache = (_slots$default = (_slots$default2 = slots.default) === null || _slots$default2 === void 0 ? void 0 : _slots$default2.call(slots)) !== null && _slots$default !== void 0 ? _slots$default : null;
94
+ return cache;
95
+ }
96
+ return (_cache2 = cache) !== null && _cache2 !== void 0 ? _cache2 : cache = (_slots$default3 = (_slots$default4 = slots.default) === null || _slots$default4 === void 0 ? void 0 : _slots$default4.call(slots)) !== null && _slots$default3 !== void 0 ? _slots$default3 : null;
97
+ };
98
+ }
99
+ });
79
100
  const data = reactive({
80
101
  key,
81
102
  title,
@@ -119,9 +140,9 @@ var tab_pane_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineC
119
140
  key: 0,
120
141
  "outer-class": `${unref(prefixCls)}-pane-scrollbar`
121
142
  }, paneScrollbarProps.value), {
122
- default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
123
- _: 3
124
- }, 16, ["outer-class"])) : renderSlot(_ctx.$slots, "default", {}, void 0, void 0, 1)], 2)) : createCommentVNode("", true)], 10, _hoisted_1);
143
+ default: withCtx(() => [createVNode(unref(PaneContent))]),
144
+ _: 1
145
+ }, 16, ["outer-class"])) : (openBlock(), createBlock(unref(PaneContent), { key: 1 }))], 2)) : createCommentVNode("", true)], 10, _hoisted_1);
125
146
  };
126
147
  }
127
148
  }));
@@ -130,6 +130,12 @@ var tabs_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCompo
130
130
  const index = tabKeys.value.indexOf(computedActiveKey.value);
131
131
  return index === -1 ? 0 : index;
132
132
  });
133
+ const configContext = inject(configProviderInjectionKey, void 0);
134
+ const rtl = computed(() => {
135
+ var _configContext$rtl;
136
+ return (_configContext$rtl = configContext === null || configContext === void 0 ? void 0 : configContext.rtl) !== null && _configContext$rtl !== void 0 ? _configContext$rtl : false;
137
+ });
138
+ const contentStyle = computed(() => ({ transform: `translateX(${rtl.value ? "" : "-"}${activeIndex.value * 100}%)` }));
133
139
  const { scrollbarProps } = useScrollbar(toRef(props, "scrollbar"));
134
140
  const paneScrollbar = computed(() => props.fullHeight && props.scrollbar !== false ? scrollbarProps.value : false);
135
141
  const addItem = (id, data) => {
@@ -164,11 +170,6 @@ var tabs_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCompo
164
170
  if (props.autoSwitch) nextTick(() => handleChange(tabKeys.value[tabKeys.value.length - 1]));
165
171
  };
166
172
  const handleDelete = (key, event) => emit("delete", key, event);
167
- const configContext = inject(configProviderInjectionKey, void 0);
168
- const rtl = computed(() => {
169
- var _configContext$rtl;
170
- return (_configContext$rtl = configContext === null || configContext === void 0 ? void 0 : configContext.rtl) !== null && _configContext$rtl !== void 0 ? _configContext$rtl : false;
171
- });
172
173
  const cls = computed(() => [
173
174
  prefixCls,
174
175
  `${prefixCls}-${mergedDirection.value}`,
@@ -190,7 +191,7 @@ var tabs_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCompo
190
191
  return openBlock(), createElementBlock(Fragment, null, [createVNode(unref(DefineContent), null, {
191
192
  default: withCtx(() => [createElementVNode("div", { class: normalizeClass([`${unref(prefixCls)}-content`, { [`${unref(prefixCls)}-content-hide`]: props.hideContent }]) }, [createElementVNode("div", {
192
193
  class: normalizeClass([`${unref(prefixCls)}-content-list`, { [`${unref(prefixCls)}-content-animation`]: props.animation }]),
193
- style: normalizeStyle(rtl.value ? { marginRight: `-${activeIndex.value * 100}%` } : { marginLeft: `-${activeIndex.value * 100}%` })
194
+ style: normalizeStyle(contentStyle.value)
194
195
  }, [createVNode(VNodeRenderer, { content: getChildren() }, null, 8, ["content"])], 6)], 2)]),
195
196
  _: 1
196
197
  }), createElementVNode("div", mergeProps(unref(attrs), { class: cls.value }), [
@@ -2,7 +2,7 @@
2
2
  "$schema": "https://raw.githubusercontent.com/JetBrains/web-types/master/schema/web-types.json",
3
3
  "framework": "vue",
4
4
  "name": "@sdata/web-vue",
5
- "version": "4.4.1",
5
+ "version": "4.4.3",
6
6
  "contributions": {
7
7
  "html": {
8
8
  "types-syntax": "typescript",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sdata/web-vue",
3
- "version": "4.4.2",
3
+ "version": "4.5.0",
4
4
  "description": "SD Design Vue: A Vue.js 3 UI Library",
5
5
  "keywords": [
6
6
  "sd",