@sdata/web-vue 4.2.0 → 4.3.1

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 (95) hide show
  1. package/dist/sd.css +17 -117
  2. package/dist/sd.min.css +2 -2
  3. package/es/_components/auto-tooltip/auto-tooltip.vue_vue_type_script_setup_true_lang.js +17 -50
  4. package/es/_components/input-label/input-label.vue_vue_type_script_setup_true_lang.js +2 -2
  5. package/es/_components/picker/input-range.vue_vue_type_script_setup_true_lang.js +1 -1
  6. package/es/_components/picker/input.vue_vue_type_script_setup_true_lang.js +1 -1
  7. package/es/_components/select-view/style/index.css +0 -39
  8. package/es/anchor/anchor.vue.d.ts +1 -1
  9. package/es/anchor/index.d.ts +3 -3
  10. package/es/auto-complete/auto-complete.vue.d.ts +6 -22
  11. package/es/auto-complete/auto-complete.vue_vue_type_script_setup_true_lang.js +6 -6
  12. package/es/auto-complete/index.d.ts +1 -17
  13. package/es/avatar/avatar.vue_vue_type_script_setup_true_lang.js +1 -1
  14. package/es/button/button.vue_vue_type_script_setup_true_lang.js +1 -1
  15. package/es/cascader/cascader-option.vue_vue_type_script_setup_true_lang.js +1 -1
  16. package/es/cascader/cascader-panel.vue.d.ts +1 -1
  17. package/es/cascader/cascader.vue.d.ts +1 -1
  18. package/es/cascader/cascader.vue_vue_type_script_setup_true_lang.js +1 -1
  19. package/es/clamp/index.d.ts +212 -0
  20. package/es/clamp/index.js +15 -0
  21. package/es/clamp/style/css.js +1 -0
  22. package/es/clamp/style/index.css +0 -0
  23. package/es/clamp/style/index.d.ts +1 -0
  24. package/es/clamp/style/index.js +1 -0
  25. package/es/clamp/style/index.scss +1 -0
  26. package/es/clamp/style/token.scss +1 -0
  27. package/es/color-picker/color-picker.vue_vue_type_script_setup_true_lang.js +1 -1
  28. package/es/components.d.ts +4 -0
  29. package/es/date-picker/picker.vue_vue_type_script_setup_true_lang.js +2 -2
  30. package/es/date-picker/range-picker.vue_vue_type_script_setup_true_lang.js +2 -2
  31. package/es/drawer/drawer.vue_vue_type_script_setup_true_lang.js +1 -1
  32. package/es/ellipsis/ellipsis.vue.d.ts +8 -15
  33. package/es/ellipsis/ellipsis.vue_vue_type_script_setup_true_lang.js +113 -118
  34. package/es/ellipsis/index.d.ts +14 -16
  35. package/es/ellipsis/performant-ellipsis.vue.d.ts +3 -5
  36. package/es/ellipsis/performant-ellipsis.vue_vue_type_script_setup_true_lang.js +12 -24
  37. package/es/ellipsis/style/index.css +0 -2
  38. package/es/ellipsis/style/index.scss +3 -2
  39. package/es/file-previewer/file-previewer.vue_vue_type_script_setup_true_lang.js +1 -1
  40. package/es/image/image.vue_vue_type_script_setup_true_lang.js +1 -1
  41. package/es/image/preview.vue_vue_type_script_setup_true_lang.js +1 -1
  42. package/es/index.css +17 -117
  43. package/es/index.d.ts +2 -0
  44. package/es/index.js +4 -3
  45. package/es/index.scss +1 -0
  46. package/es/input/input.vue_vue_type_script_setup_true_lang.js +2 -2
  47. package/es/input-tag/index.d.ts +0 -4
  48. package/es/input-tag/input-tag.vue.d.ts +3 -7
  49. package/es/input-tag/input-tag.vue_vue_type_script_setup_true_lang.js +85 -157
  50. package/es/input-tag/style/index.css +6 -39
  51. package/es/input-tag/style/index.scss +7 -0
  52. package/es/input-tag/style/input-tag.scss +0 -45
  53. package/es/link/link.vue_vue_type_script_setup_true_lang.js +2 -2
  54. package/es/list/index.d.ts +3 -3
  55. package/es/list/list.vue.d.ts +1 -1
  56. package/es/menu/base-menu.vue_vue_type_script_setup_true_lang.js +3 -3
  57. package/es/menu/overflow-wrap.vue_vue_type_script_setup_true_lang.js +21 -27
  58. package/es/menu/style/index.css +5 -2
  59. package/es/menu/style/index.scss +5 -2
  60. package/es/modal/index.js +1 -1
  61. package/es/modal/modal.vue_vue_type_script_setup_true_lang.js +1 -1
  62. package/es/popover/style/index.css +0 -1
  63. package/es/popover/style/index.scss +0 -1
  64. package/es/rate/rate.vue_vue_type_script_setup_true_lang.js +1 -1
  65. package/es/sd-vue.js +7 -2
  66. package/es/secret/secret.vue_vue_type_script_setup_true_lang.js +2 -2
  67. package/es/select/select.vue_vue_type_script_setup_true_lang.js +2 -2
  68. package/es/sender/sender.vue_vue_type_script_setup_true_lang.js +1 -1
  69. package/es/table/index.d.ts +8 -8
  70. package/es/table/table-tr.vue.d.ts +1 -1
  71. package/es/table/table.vue.d.ts +2 -2
  72. package/es/tag/tag.vue_vue_type_script_setup_true_lang.js +1 -1
  73. package/es/tag-group/index.d.ts +4 -6
  74. package/es/tag-group/style/index.css +6 -29
  75. package/es/tag-group/style/index.scss +9 -34
  76. package/es/tag-group/tag-group.vue.d.ts +8 -11
  77. package/es/tag-group/tag-group.vue_vue_type_script_setup_true_lang.js +91 -272
  78. package/es/textarea/textarea.vue_vue_type_script_setup_true_lang.js +2 -2
  79. package/es/time-picker/time-picker.vue_vue_type_script_setup_true_lang.js +1 -1
  80. package/es/tree/node-switcher.vue_vue_type_script_setup_true_lang.js +1 -1
  81. package/es/tree/tree.vue.d.ts +12 -12
  82. package/es/tree/tree.vue_vue_type_script_setup_true_lang.js +1 -1
  83. package/es/tree-select/tree-select.vue_vue_type_script_setup_true_lang.js +2 -2
  84. package/es/trigger/trigger.vue_vue_type_script_setup_true_lang.js +3 -3
  85. package/es/typography/base.vue.d.ts +15 -15
  86. package/es/typography/base.vue_vue_type_script_setup_true_lang.js +93 -164
  87. package/es/typography/interface.d.ts +1 -2
  88. package/es/typography/style/index.css +0 -5
  89. package/es/typography/style/index.scss +0 -7
  90. package/json/vetur-attributes.json +0 -20
  91. package/json/vetur-tags.json +2 -10
  92. package/json/web-types.json +3 -53
  93. package/package.json +2 -1
  94. package/es/typography/utils/measure.d.ts +0 -6
  95. package/es/typography/utils/measure.js +0 -69
@@ -1,18 +1,16 @@
1
1
  import _objectSpread2 from "../_virtual/_@oxc-project_runtime@0.142.0/helpers/esm/objectSpread2.js";
2
2
  import { getPrefixCls } from "../_utils/global-config.js";
3
3
  import { isObject } from "../_utils/is.js";
4
- import resize_observer_default from "../_components/resize-observer.js";
5
- import { caf, raf } from "../_utils/raf.js";
6
- import useMergeState from "../_hooks/use-merge-state.js";
4
+ import { RichLineClamp } from "../clamp/index.js";
7
5
  import { omit } from "../_utils/omit.js";
8
6
  import Tooltip from "../tooltip/index.js";
7
+ import useMergeState from "../_hooks/use-merge-state.js";
9
8
  import Popover from "../popover/index.js";
10
9
  import edit_content_default from "./edit-content.js";
11
10
  import typography_content_default from "./typography-content.js";
12
11
  import typography_operations_default from "./typography-operations.js";
13
12
  import getInnerText from "./utils/getInnerText.js";
14
- import measure_default from "./utils/measure.js";
15
- import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, guardReactiveProps, mergeProps, normalizeProps, onMounted, onUnmounted, onUpdated, openBlock, reactive, ref, resolveDynamicComponent, toDisplayString, toRef, unref, useAttrs, useSlots, watch, withCtx } from "vue";
13
+ import { Fragment, computed, createBlock, createElementBlock, createTextVNode, createVNode, defineComponent, guardReactiveProps, mergeProps, normalizeProps, onMounted, onUnmounted, onUpdated, openBlock, reactive, resolveDynamicComponent, shallowRef, toDisplayString, toRef, unref, useAttrs, useSlots, withCtx } from "vue";
16
14
  import { createReusableTemplate } from "@vueuse/core";
17
15
  import copy from "copy-to-clipboard";
18
16
  //#region components/typography/base.vue?vue&type=script&setup=true&lang.ts
@@ -57,27 +55,26 @@ var base_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCompo
57
55
  editTooltipProps: Object,
58
56
  copyTooltipProps: Object
59
57
  },
60
- emits: {
61
- "editStart": () => true,
62
- "change": (_text) => true,
63
- "update:editText": (_text) => true,
64
- "editEnd": () => true,
65
- "update:editing": (_editing) => true,
66
- "copy": (_text) => true,
67
- "ellipsis": (_isEllipsis) => true,
68
- "expand": (_expanded) => true
69
- },
58
+ emits: [
59
+ "editStart",
60
+ "change",
61
+ "update:editText",
62
+ "editEnd",
63
+ "update:editing",
64
+ "copy",
65
+ "ellipsis",
66
+ "expand"
67
+ ],
70
68
  setup(__props, { emit: __emit }) {
71
69
  const normalizeEllipsisConfig = (config) => {
72
- const showTooltip = !!config.showTooltip;
70
+ const showTooltip = Boolean(config.showTooltip);
73
71
  const TooltipComponent = isObject(config.showTooltip) && config.showTooltip.type === "popover" ? Popover : Tooltip;
74
72
  const tooltipProps = isObject(config.showTooltip) && config.showTooltip.props || {};
75
73
  return _objectSpread2(_objectSpread2({
76
74
  rows: 1,
77
75
  suffix: "",
78
76
  ellipsisStr: "...",
79
- expandable: false,
80
- css: false
77
+ expandable: false
81
78
  }, omit(config, ["showTooltip"])), {}, {
82
79
  showTooltip,
83
80
  TooltipComponent,
@@ -88,31 +85,71 @@ var base_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCompo
88
85
  const emit = __emit;
89
86
  const attrs = useAttrs();
90
87
  const slots = useSlots();
91
- const [DefineCssOuter, ReuseCssOuter] = createReusableTemplate();
88
+ const [DefineDisplay, ReuseDisplay] = createReusableTemplate();
92
89
  const prefixCls = getPrefixCls("typography");
93
90
  const classNames = computed(() => [prefixCls, {
94
91
  [`${prefixCls}-${props.type}`]: props.type,
95
92
  [`${prefixCls}-disabled`]: props.disabled
96
93
  }]);
97
- const wrapperRef = ref();
98
- const fullText = ref("");
94
+ const fullText = shallowRef("");
95
+ const isEllipsis = shallowRef(false);
96
+ const expanded = shallowRef(false);
99
97
  const [editing, setEditing] = useMergeState(props.defaultEditing, reactive({ value: toRef(props, "editing") }));
100
98
  const mergeEditing = computed(() => props.editable && editing.value);
101
99
  const editTextValue = computed(() => {
102
100
  var _props$editText;
103
101
  return (_props$editText = props.editText) !== null && _props$editText !== void 0 ? _props$editText : fullText.value;
104
102
  });
103
+ const ellipsisConfig = computed(() => normalizeEllipsisConfig(isObject(props.ellipsis) && props.ellipsis || {}));
104
+ const rootAttrs = computed(() => _objectSpread2(_objectSpread2({}, isEllipsis.value && !expanded.value && !ellipsisConfig.value.showTooltip ? { title: fullText.value } : {}), attrs));
105
+ const contentTags = computed(() => {
106
+ const tags = [];
107
+ if (props.bold) tags.push("b");
108
+ if (props.underline) tags.push("u");
109
+ if (props.delete) tags.push("del");
110
+ if (props.code) tags.push("code");
111
+ if (props.mark) tags.push("mark");
112
+ return tags;
113
+ });
114
+ const markStyle = computed(() => {
115
+ const style = {};
116
+ if (isObject(props.mark) && props.mark.color) style.backgroundColor = props.mark.color;
117
+ return style;
118
+ });
119
+ const escapeHtml = (value) => value.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;");
120
+ const styleAttribute = (style) => {
121
+ const text = style ? Object.entries(style).map(([name, value]) => `${name.replace(/[A-Z]/g, (c) => `-${c.toLowerCase()}`)}:${value}`).join(";") : "";
122
+ return text ? ` style="${escapeHtml(text)}"` : "";
123
+ };
124
+ const richHtml = computed(() => [...contentTags.value].reverse().reduce((html, tag) => {
125
+ return `<${tag}${tag === "mark" ? styleAttribute(markStyle.value) : ""}>${html}</${tag}>`;
126
+ }, escapeHtml(fullText.value)));
127
+ const getChildren = () => {
128
+ var _slots$default;
129
+ return ((_slots$default = slots.default) === null || _slots$default === void 0 ? void 0 : _slots$default.call(slots)) || [];
130
+ };
131
+ const updateFullText = () => {
132
+ if (props.ellipsis || props.copyable || props.editable) {
133
+ const nextFullText = getInnerText(getChildren());
134
+ if (fullText.value !== nextFullText) fullText.value = nextFullText;
135
+ }
136
+ };
137
+ const handleClampChange = (value) => {
138
+ if (isEllipsis.value !== value) {
139
+ isEllipsis.value = value;
140
+ emit("ellipsis", value);
141
+ }
142
+ };
105
143
  const onEditStart = () => {
106
144
  emit("update:editing", true);
107
145
  emit("editStart");
108
146
  setEditing(true);
109
147
  };
110
- const onEditChange = (text) => {
111
- emit("update:editText", text);
112
- emit("change", text);
113
- };
114
148
  const handleEditContentChange = (text) => {
115
- if (text !== editTextValue.value) onEditChange(text);
149
+ if (text !== editTextValue.value) {
150
+ emit("update:editText", text);
151
+ emit("change", text);
152
+ }
116
153
  };
117
154
  const onEditEnd = () => {
118
155
  if (!editing.value) return;
@@ -120,37 +157,28 @@ var base_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCompo
120
157
  emit("editEnd");
121
158
  setEditing(false);
122
159
  };
123
- const isCopied = ref(false);
160
+ const isCopied = shallowRef(false);
124
161
  let copyTimer = null;
125
162
  const onCopyClick = () => {
126
163
  var _props$copyText;
127
164
  const text = (_props$copyText = props.copyText) !== null && _props$copyText !== void 0 ? _props$copyText : fullText.value;
128
- copy(text || "", props.clipboardProps);
165
+ copy(text, props.clipboardProps);
129
166
  isCopied.value = true;
130
167
  emit("copy", text);
131
- copyTimer = setTimeout(() => {
132
- isCopied.value = false;
133
- }, props.copyDelay);
168
+ copyTimer = setTimeout(() => isCopied.value = false, props.copyDelay);
134
169
  };
135
- const isEllipsis = ref(false);
136
- const expanded = ref(false);
137
- const ellipsisText = ref("");
138
- const ellipsisConfig = computed(() => normalizeEllipsisConfig(isObject(props.ellipsis) && props.ellipsis || {}));
139
- const showEllipsis = computed(() => isEllipsis.value && !expanded.value);
140
- const rootAttrs = computed(() => _objectSpread2(_objectSpread2({}, showEllipsis.value && !ellipsisConfig.value.showTooltip ? { title: fullText.value } : {}), attrs));
141
- let rafId = null;
142
170
  const onExpandClick = () => {
143
171
  expanded.value = !expanded.value;
144
172
  emit("expand", expanded.value);
145
173
  };
146
- const getOperationsProps = (forceRenderExpand = false) => ({
174
+ const getOperationsProps = () => ({
147
175
  editable: props.editable,
148
176
  copyable: props.copyable,
149
177
  expandable: ellipsisConfig.value.expandable,
150
178
  isCopied: isCopied.value,
151
- isEllipsis: ellipsisConfig.value.css ? showCSSTooltip.value : isEllipsis.value,
179
+ isEllipsis: isEllipsis.value,
152
180
  expanded: expanded.value,
153
- forceRenderExpand: forceRenderExpand || ellipsisConfig.value.css && expanded.value,
181
+ forceRenderExpand: expanded.value,
154
182
  editTooltipProps: props.editTooltipProps,
155
183
  copyTooltipProps: props.copyTooltipProps,
156
184
  onEdit: onEditStart,
@@ -160,88 +188,33 @@ var base_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCompo
160
188
  copyIcon: slots["copy-icon"],
161
189
  expandNode: slots["expand-node"]
162
190
  });
163
- const calEllipsis = () => {
164
- if (!wrapperRef.value) return;
165
- const result = measure_default(wrapperRef.value, ellipsisConfig.value, getOperationsProps(!!ellipsisConfig.value.expandable), fullText.value);
166
- if (isEllipsis.value !== result.ellipsis) {
167
- isEllipsis.value = result.ellipsis;
168
- if (!ellipsisConfig.value.css) emit("ellipsis", result.ellipsis);
169
- }
170
- if (ellipsisText.value !== result.text) ellipsisText.value = result.text || "";
171
- };
172
- const resizeOnNextFrame = () => {
173
- if (!props.ellipsis || expanded.value) return;
174
- if (rafId != null) caf(rafId);
175
- rafId = raf(calEllipsis);
176
- };
177
- watch(() => ellipsisConfig.value.rows, resizeOnNextFrame);
178
- watch(toRef(props, "ellipsis"), (value) => {
179
- if (value) resizeOnNextFrame();
180
- else isEllipsis.value = false;
181
- });
182
- let children = [];
183
- const getChildren = () => {
184
- var _slots$default;
185
- children = ((_slots$default = slots.default) === null || _slots$default === void 0 ? void 0 : _slots$default.call(slots)) || [];
186
- return children;
187
- };
188
- const contentTags = computed(() => {
189
- const tags = [];
190
- if (props.bold) tags.push("b");
191
- if (props.underline) tags.push("u");
192
- if (props.delete) tags.push("del");
193
- if (props.code) tags.push("code");
194
- if (props.mark) tags.push("mark");
195
- return tags;
196
- });
197
- const markStyle = computed(() => isObject(props.mark) && props.mark.color ? { backgroundColor: props.mark.color } : {});
198
- const getDisplayContent = () => showEllipsis.value ? ellipsisText.value : getChildren();
199
- const updateFullText = () => {
200
- if (props.ellipsis || props.copyable || props.editable) {
201
- const text = getInnerText(children);
202
- if (text !== fullText.value) {
203
- fullText.value = text;
204
- resizeOnNextFrame();
205
- }
206
- }
207
- };
208
191
  onMounted(updateFullText);
209
192
  onUpdated(updateFullText);
210
- const contentRef = ref();
211
- const showCSSTooltip = ref(false);
212
- const calTooltip = () => {
213
- if (wrapperRef.value && contentRef.value) {
214
- const show = contentRef.value.offsetHeight > wrapperRef.value.offsetHeight;
215
- if (show !== showCSSTooltip.value) {
216
- showCSSTooltip.value = show;
217
- emit("ellipsis", show);
218
- }
219
- }
220
- };
221
- const ellipsisStyle = computed(() => expanded.value ? {} : {
222
- "overflow": "hidden",
223
- "text-overflow": "ellipsis",
224
- "display": "-webkit-box",
225
- "-webkit-line-clamp": ellipsisConfig.value.rows,
226
- "-webkit-box-orient": "vertical"
227
- });
228
193
  onUnmounted(() => {
229
194
  if (copyTimer) clearTimeout(copyTimer);
230
- if (rafId != null) caf(rafId);
231
195
  });
232
196
  return (_ctx, _cache) => {
233
- return openBlock(), createElementBlock(Fragment, null, [createVNode(unref(DefineCssOuter), null, {
234
- default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(props.component), mergeProps({
235
- ref_key: "wrapperRef",
236
- ref: wrapperRef
237
- }, rootAttrs.value, {
197
+ return openBlock(), createElementBlock(Fragment, null, [createVNode(unref(DefineDisplay), null, {
198
+ default: withCtx(() => [props.ellipsis ? (openBlock(), createBlock(unref(RichLineClamp), mergeProps({ key: 0 }, rootAttrs.value, {
199
+ as: props.component,
238
200
  class: classNames.value,
239
- style: ellipsisStyle.value
201
+ html: richHtml.value,
202
+ "max-lines": ellipsisConfig.value.rows,
203
+ ellipsis: ellipsisConfig.value.ellipsisStr,
204
+ expanded: expanded.value,
205
+ onClampchange: handleClampChange
240
206
  }), {
241
- default: withCtx(() => [createElementVNode("span", {
242
- ref_key: "contentRef",
243
- ref: contentRef
244
- }, [createVNode(typography_content_default, {
207
+ after: withCtx(() => [createTextVNode(toDisplayString(ellipsisConfig.value.suffix) + " ", 1), createVNode(typography_operations_default, normalizeProps(guardReactiveProps(getOperationsProps())), null, 16)]),
208
+ _: 1
209
+ }, 16, [
210
+ "as",
211
+ "class",
212
+ "html",
213
+ "max-lines",
214
+ "ellipsis",
215
+ "expanded"
216
+ ])) : (openBlock(), createBlock(resolveDynamicComponent(props.component), mergeProps({ key: 1 }, rootAttrs.value, { class: classNames.value }), {
217
+ default: withCtx(() => [createVNode(typography_content_default, {
245
218
  content: getChildren(),
246
219
  tags: contentTags.value,
247
220
  "mark-style": markStyle.value
@@ -249,64 +222,20 @@ var base_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineCompo
249
222
  "content",
250
223
  "tags",
251
224
  "mark-style"
252
- ])], 512)]),
225
+ ]), createVNode(typography_operations_default, normalizeProps(guardReactiveProps(getOperationsProps())), null, 16)]),
253
226
  _: 1
254
- }, 16, ["class", "style"]))]),
227
+ }, 16, ["class"]))]),
255
228
  _: 1
256
229
  }), mergeEditing.value ? (openBlock(), createBlock(edit_content_default, {
257
230
  key: 0,
258
231
  text: editTextValue.value,
259
232
  onChange: handleEditContentChange,
260
233
  onEnd: onEditEnd
261
- }, null, 8, ["text"])) : ellipsisConfig.value.css ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [showCSSTooltip.value ? (openBlock(), createBlock(resolveDynamicComponent(ellipsisConfig.value.TooltipComponent), mergeProps({ key: 0 }, ellipsisConfig.value.tooltipProps, { onResize: calTooltip }), {
234
+ }, null, 8, ["text"])) : props.ellipsis && ellipsisConfig.value.showTooltip ? (openBlock(), createBlock(resolveDynamicComponent(ellipsisConfig.value.TooltipComponent), mergeProps({ key: 1 }, ellipsisConfig.value.tooltipProps, { disabled: !isEllipsis.value }), {
262
235
  content: withCtx(() => [createTextVNode(toDisplayString(fullText.value), 1)]),
263
- default: withCtx(() => [createVNode(unref(ReuseCssOuter))]),
264
- _: 1
265
- }, 16)) : (openBlock(), createBlock(resize_observer_default, {
266
- key: 1,
267
- onResize: calTooltip
268
- }, {
269
- default: withCtx(() => [createVNode(unref(ReuseCssOuter))]),
270
- _: 1
271
- }))], 64)) : (openBlock(), createBlock(resize_observer_default, {
272
- key: 2,
273
- onResize: resizeOnNextFrame
274
- }, {
275
- default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(props.component), mergeProps({
276
- ref_key: "wrapperRef",
277
- ref: wrapperRef
278
- }, rootAttrs.value, { class: classNames.value }), {
279
- default: withCtx(() => [
280
- showEllipsis.value && ellipsisConfig.value.showTooltip ? (openBlock(), createBlock(resolveDynamicComponent(ellipsisConfig.value.TooltipComponent), normalizeProps(mergeProps({ key: 0 }, ellipsisConfig.value.tooltipProps)), {
281
- content: withCtx(() => [createTextVNode(toDisplayString(fullText.value), 1)]),
282
- default: withCtx(() => [createElementVNode("span", null, [createVNode(typography_content_default, {
283
- content: getDisplayContent(),
284
- tags: contentTags.value,
285
- "mark-style": markStyle.value
286
- }, null, 8, [
287
- "content",
288
- "tags",
289
- "mark-style"
290
- ])])]),
291
- _: 1
292
- }, 16)) : (openBlock(), createBlock(typography_content_default, {
293
- key: 1,
294
- content: getDisplayContent(),
295
- tags: contentTags.value,
296
- "mark-style": markStyle.value
297
- }, null, 8, [
298
- "content",
299
- "tags",
300
- "mark-style"
301
- ])),
302
- showEllipsis.value ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [createTextVNode(toDisplayString(ellipsisConfig.value.ellipsisStr), 1)], 64)) : createCommentVNode("", true),
303
- createTextVNode(" " + toDisplayString(ellipsisConfig.value.suffix) + " ", 1),
304
- createVNode(typography_operations_default, normalizeProps(guardReactiveProps(getOperationsProps())), null, 16)
305
- ]),
306
- _: 1
307
- }, 16, ["class"]))]),
236
+ default: withCtx(() => [createVNode(unref(ReuseDisplay))]),
308
237
  _: 1
309
- }))], 64);
238
+ }, 16, ["disabled"])) : (openBlock(), createBlock(unref(ReuseDisplay), { key: 2 }))], 64);
310
239
  };
311
240
  }
312
241
  }));
@@ -1,5 +1,5 @@
1
1
  import type { Options as ClipboardOptions } from 'copy-to-clipboard';
2
- import { VNode } from 'vue';
2
+ import type { VNode } from 'vue';
3
3
  export interface EllipsisConfig {
4
4
  rows?: number;
5
5
  expandable?: boolean;
@@ -9,7 +9,6 @@ export interface EllipsisConfig {
9
9
  type: 'tooltip' | 'popover';
10
10
  props: Record<string, unknown>;
11
11
  };
12
- css?: boolean;
13
12
  }
14
13
  export interface EllipsisInternalConfig extends Required<EllipsisConfig> {
15
14
  showTooltip: boolean;
@@ -170,9 +170,4 @@
170
170
  margin-top: -5px;
171
171
  margin-right: -13px;
172
172
  margin-bottom: calc(1em - 4px - 1px);
173
- }
174
- .sd-typography-css-operation {
175
- margin-top: -1em;
176
- margin-bottom: 1em;
177
- text-align: right;
178
173
  }
@@ -198,11 +198,4 @@ $typography-prefix-cls: string.unquote('#{theme.$prefix}-typography');
198
198
  margin-right: -($textarea-padding-horizontal + $input-border-width);
199
199
  margin-bottom: calc(1em - $textarea-padding-vertical - $input-border-width);
200
200
  }
201
-
202
- // css
203
- &-css-operation {
204
- margin-top: -1em;
205
- margin-bottom: 1em;
206
- text-align: right;
207
- }
208
201
  }
@@ -953,26 +953,6 @@
953
953
  "description": "Whether to hide popup when the user selects",
954
954
  "type": "boolean"
955
955
  },
956
- "sd-ellipsis/line-clamp": {
957
- "description": "Maximum number of displayed lines. Single-line ellipsis is used by default.",
958
- "type": "number | string"
959
- },
960
- "sd-ellipsis/expand-trigger": {
961
- "description": "Trigger mode for expansion"
962
- },
963
- "sd-ellipsis/tooltip": {
964
- "description": "Whether to show a tooltip when ellipsis is active. Tooltip props are supported."
965
- },
966
- "sd-performant-ellipsis/line-clamp": {
967
- "description": "Maximum number of displayed lines. Single-line ellipsis is used by default.",
968
- "type": "number | string"
969
- },
970
- "sd-performant-ellipsis/expand-trigger": {
971
- "description": "Trigger mode for expansion"
972
- },
973
- "sd-performant-ellipsis/tooltip": {
974
- "description": "Whether to show a tooltip when ellipsis is active. Tooltip props are supported."
975
- },
976
956
  "sd-empty/description": {
977
957
  "description": "Description",
978
958
  "type": "string"
@@ -437,18 +437,10 @@
437
437
  ]
438
438
  },
439
439
  "sd-ellipsis": {
440
- "attributes": [
441
- "line-clamp",
442
- "expand-trigger",
443
- "tooltip"
444
- ]
440
+ "attributes": []
445
441
  },
446
442
  "sd-performant-ellipsis": {
447
- "attributes": [
448
- "line-clamp",
449
- "expand-trigger",
450
- "tooltip"
451
- ]
443
+ "attributes": []
452
444
  },
453
445
  "sd-empty": {
454
446
  "attributes": [
@@ -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.1.0",
5
+ "version": "4.3.0",
6
6
  "contributions": {
7
7
  "html": {
8
8
  "types-syntax": "typescript",
@@ -2370,63 +2370,13 @@
2370
2370
  },
2371
2371
  {
2372
2372
  "name": "sd-ellipsis",
2373
- "attributes": [
2374
- {
2375
- "name": "line-clamp",
2376
- "description": "Maximum number of displayed lines. Single-line ellipsis is used by default.",
2377
- "value": {
2378
- "type": "number | string",
2379
- "kind": "expression"
2380
- }
2381
- },
2382
- {
2383
- "name": "expand-trigger",
2384
- "description": "Trigger mode for expansion",
2385
- "value": {
2386
- "type": "'click'",
2387
- "kind": "expression"
2388
- }
2389
- },
2390
- {
2391
- "name": "tooltip",
2392
- "description": "Whether to show a tooltip when ellipsis is active. Tooltip props are supported.",
2393
- "value": {
2394
- "type": "boolean | EllipsisTooltipProps",
2395
- "kind": "expression"
2396
- }
2397
- }
2398
- ],
2373
+ "attributes": [],
2399
2374
  "events": [],
2400
2375
  "slots": []
2401
2376
  },
2402
2377
  {
2403
2378
  "name": "sd-performant-ellipsis",
2404
- "attributes": [
2405
- {
2406
- "name": "line-clamp",
2407
- "description": "Maximum number of displayed lines. Single-line ellipsis is used by default.",
2408
- "value": {
2409
- "type": "number | string",
2410
- "kind": "expression"
2411
- }
2412
- },
2413
- {
2414
- "name": "expand-trigger",
2415
- "description": "Trigger mode for expansion",
2416
- "value": {
2417
- "type": "'click'",
2418
- "kind": "expression"
2419
- }
2420
- },
2421
- {
2422
- "name": "tooltip",
2423
- "description": "Whether to show a tooltip when ellipsis is active. Tooltip props are supported.",
2424
- "value": {
2425
- "type": "boolean | EllipsisTooltipProps",
2426
- "kind": "expression"
2427
- }
2428
- }
2429
- ],
2379
+ "attributes": [],
2430
2380
  "events": [],
2431
2381
  "slots": []
2432
2382
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sdata/web-vue",
3
- "version": "4.2.0",
3
+ "version": "4.3.1",
4
4
  "description": "SD Design Vue: A Vue.js 3 UI Library",
5
5
  "keywords": [
6
6
  "sd",
@@ -81,6 +81,7 @@
81
81
  "scroll-into-view-if-needed": "^3.1.0",
82
82
  "virtua": "^0.49.3",
83
83
  "vue": "^3.5.41",
84
+ "vue-clamp": "^1.6.0",
84
85
  "vue-draggable-plus": "^0.6.1"
85
86
  },
86
87
  "devDependencies": {
@@ -1,6 +0,0 @@
1
- import type { EllipsisInternalConfig } from '../interface';
2
- declare const _default: (originElement: HTMLElement, ellipsisConfig: EllipsisInternalConfig, operationsProps: Record<string, unknown>, fullText: string) => {
3
- ellipsis: boolean;
4
- text: string;
5
- };
6
- export default _default;
@@ -1,69 +0,0 @@
1
- import typography_operations_default from "../typography-operations.js";
2
- import { createApp } from "vue";
3
- //#region components/typography/utils/measure.ts
4
- var ellipsisContainer;
5
- function styleToString(style) {
6
- return Array.prototype.slice.apply(style).map((name) => `${name}: ${style.getPropertyValue(name)};`).join("");
7
- }
8
- function pxToNumber(value) {
9
- if (!value) return 0;
10
- const match = value.match(/^\d*(\.\d*)?/);
11
- return match ? Number(match[0]) : 0;
12
- }
13
- var measure_default = (originElement, ellipsisConfig, operationsProps, fullText) => {
14
- if (!ellipsisContainer) {
15
- ellipsisContainer = document.createElement("div");
16
- document.body.appendChild(ellipsisContainer);
17
- }
18
- const { rows, suffix, ellipsisStr } = ellipsisConfig;
19
- const originStyle = window.getComputedStyle(originElement);
20
- const styleString = styleToString(originStyle);
21
- const lineHeight = pxToNumber(originStyle.lineHeight);
22
- const maxHeight = Math.round(lineHeight * rows + pxToNumber(originStyle.paddingTop) + pxToNumber(originStyle.paddingBottom));
23
- ellipsisContainer.setAttribute("style", styleString);
24
- ellipsisContainer.setAttribute("aria-hidden", "true");
25
- ellipsisContainer.style.height = "auto";
26
- ellipsisContainer.style.minHeight = "auto";
27
- ellipsisContainer.style.maxHeight = "auto";
28
- ellipsisContainer.style.position = "fixed";
29
- ellipsisContainer.style.left = "0";
30
- ellipsisContainer.style.top = "-99999999px";
31
- ellipsisContainer.style.zIndex = "-200";
32
- ellipsisContainer.style.whiteSpace = "normal";
33
- const operationsApp = createApp(typography_operations_default, operationsProps);
34
- operationsApp.mount(ellipsisContainer);
35
- const operationsChildNodes = Array.prototype.slice.apply(ellipsisContainer.cloneNode(true).childNodes);
36
- operationsApp.unmount();
37
- const ellipsisTextNode = document.createTextNode(`${ellipsisStr}${suffix}`);
38
- ellipsisContainer.appendChild(ellipsisTextNode);
39
- operationsChildNodes.forEach((operationNode) => {
40
- ellipsisContainer.appendChild(operationNode);
41
- });
42
- const textNode = document.createTextNode(fullText);
43
- ellipsisContainer.insertBefore(textNode, ellipsisTextNode);
44
- function inRange() {
45
- return ellipsisContainer.offsetHeight <= maxHeight;
46
- }
47
- if (inRange()) return {
48
- ellipsis: false,
49
- text: fullText
50
- };
51
- function measureText(textNode, startLoc = 0, endLoc = fullText.length) {
52
- const midLoc = Math.floor((startLoc + endLoc) / 2);
53
- textNode.textContent = fullText.slice(0, midLoc);
54
- if (startLoc >= endLoc - 1) for (let step = endLoc; step >= startLoc; step -= 1) {
55
- const currentStepText = fullText.slice(0, step);
56
- textNode.textContent = currentStepText;
57
- if (inRange() || !currentStepText) return;
58
- }
59
- if (inRange()) measureText(textNode, midLoc, endLoc);
60
- else measureText(textNode, startLoc, midLoc);
61
- }
62
- measureText(textNode);
63
- return {
64
- text: textNode.textContent,
65
- ellipsis: true
66
- };
67
- };
68
- //#endregion
69
- export { measure_default as default };