@sdata/web-vue 4.1.0 → 4.3.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.
- package/dist/sd.css +135 -117
- package/dist/sd.min.css +2 -2
- package/es/_components/auto-tooltip/auto-tooltip.vue_vue_type_script_setup_true_lang.js +17 -50
- package/es/_components/input-label/input-label.vue_vue_type_script_setup_true_lang.js +2 -2
- package/es/_components/picker/input-range.vue_vue_type_script_setup_true_lang.js +1 -1
- package/es/_components/picker/input.vue_vue_type_script_setup_true_lang.js +1 -1
- package/es/_components/select-view/style/index.css +0 -39
- package/es/anchor/anchor.vue.d.ts +1 -1
- package/es/anchor/index.d.ts +3 -3
- package/es/auto-complete/auto-complete.vue.d.ts +4 -4
- package/es/auto-complete/auto-complete.vue_vue_type_script_setup_true_lang.js +6 -6
- package/es/avatar/avatar.vue_vue_type_script_setup_true_lang.js +1 -1
- package/es/bloom-menu/bloom-menu.js +5 -0
- package/es/bloom-menu/bloom-menu.vue.d.ts +52 -0
- package/es/bloom-menu/bloom-menu.vue_vue_type_script_setup_true_lang.js +380 -0
- package/es/bloom-menu/index.d.ts +6 -0
- package/es/bloom-menu/index.js +10 -0
- package/es/bloom-menu/style/css.js +2 -0
- package/es/bloom-menu/style/index.css +135 -0
- package/es/bloom-menu/style/index.d.ts +2 -0
- package/es/bloom-menu/style/index.js +2 -0
- package/es/bloom-menu/style/index.scss +153 -0
- package/es/bloom-menu/style/token.scss +24 -0
- package/es/bloom-menu/types.d.ts +11 -0
- package/es/button/button.vue_vue_type_script_setup_true_lang.js +1 -1
- package/es/cascader/cascader-option.vue_vue_type_script_setup_true_lang.js +1 -1
- package/es/cascader/cascader-panel.vue.d.ts +1 -1
- package/es/cascader/cascader.vue.d.ts +1 -1
- package/es/cascader/cascader.vue_vue_type_script_setup_true_lang.js +1 -1
- package/es/clamp/index.d.ts +212 -0
- package/es/clamp/index.js +15 -0
- package/es/clamp/style/css.js +1 -0
- package/es/clamp/style/index.css +0 -0
- package/es/clamp/style/index.d.ts +1 -0
- package/es/clamp/style/index.js +1 -0
- package/es/clamp/style/index.scss +1 -0
- package/es/clamp/style/token.scss +1 -0
- package/es/color-picker/color-picker.vue_vue_type_script_setup_true_lang.js +1 -1
- package/es/components.d.ts +5 -0
- package/es/date-picker/picker.vue_vue_type_script_setup_true_lang.js +2 -2
- package/es/date-picker/range-picker.vue_vue_type_script_setup_true_lang.js +2 -2
- package/es/drawer/drawer.vue_vue_type_script_setup_true_lang.js +1 -1
- package/es/ellipsis/ellipsis.vue.d.ts +8 -15
- package/es/ellipsis/ellipsis.vue_vue_type_script_setup_true_lang.js +113 -118
- package/es/ellipsis/index.d.ts +14 -16
- package/es/ellipsis/performant-ellipsis.vue.d.ts +3 -5
- package/es/ellipsis/performant-ellipsis.vue_vue_type_script_setup_true_lang.js +12 -24
- package/es/ellipsis/style/index.css +0 -2
- package/es/ellipsis/style/index.scss +3 -2
- package/es/file-previewer/file-previewer.vue_vue_type_script_setup_true_lang.js +1 -1
- package/es/image/image.vue_vue_type_script_setup_true_lang.js +1 -1
- package/es/image/preview.vue_vue_type_script_setup_true_lang.js +1 -1
- package/es/index.css +135 -117
- package/es/index.d.ts +4 -0
- package/es/index.js +5 -3
- package/es/index.scss +2 -0
- package/es/input/input.vue_vue_type_script_setup_true_lang.js +2 -2
- package/es/input-tag/index.d.ts +0 -4
- package/es/input-tag/input-tag.vue.d.ts +3 -7
- package/es/input-tag/input-tag.vue_vue_type_script_setup_true_lang.js +85 -157
- package/es/input-tag/style/index.css +6 -39
- package/es/input-tag/style/index.scss +7 -0
- package/es/input-tag/style/input-tag.scss +0 -45
- package/es/link/link.vue_vue_type_script_setup_true_lang.js +2 -2
- package/es/list/index.d.ts +3 -3
- package/es/list/list.vue.d.ts +1 -1
- package/es/locale/interface.d.ts +2 -0
- package/es/locale/lang/en-us.js +2 -0
- package/es/locale/lang/zh-cn.js +2 -0
- package/es/menu/base-menu.vue_vue_type_script_setup_true_lang.js +3 -3
- package/es/menu/overflow-wrap.vue_vue_type_script_setup_true_lang.js +21 -27
- package/es/menu/style/index.css +5 -2
- package/es/menu/style/index.scss +5 -2
- package/es/modal/index.js +1 -1
- package/es/modal/modal.vue_vue_type_script_setup_true_lang.js +1 -1
- package/es/popover/style/index.css +0 -1
- package/es/popover/style/index.scss +0 -1
- package/es/rate/rate.vue_vue_type_script_setup_true_lang.js +1 -1
- package/es/sd-vue.js +9 -2
- package/es/secret/secret.vue_vue_type_script_setup_true_lang.js +2 -2
- package/es/select/select.vue_vue_type_script_setup_true_lang.js +2 -2
- package/es/sender/sender.vue_vue_type_script_setup_true_lang.js +1 -1
- package/es/table/index.d.ts +8 -8
- package/es/table/table-tr.vue.d.ts +1 -1
- package/es/table/table.vue.d.ts +2 -2
- package/es/tag/tag.vue_vue_type_script_setup_true_lang.js +1 -1
- package/es/tag-group/index.d.ts +4 -6
- package/es/tag-group/style/index.css +6 -29
- package/es/tag-group/style/index.scss +9 -34
- package/es/tag-group/tag-group.vue.d.ts +8 -11
- package/es/tag-group/tag-group.vue_vue_type_script_setup_true_lang.js +91 -272
- package/es/textarea/textarea.vue_vue_type_script_setup_true_lang.js +2 -2
- package/es/time-picker/time-picker.vue_vue_type_script_setup_true_lang.js +1 -1
- package/es/tree/node-switcher.vue_vue_type_script_setup_true_lang.js +1 -1
- package/es/tree/tree.vue.d.ts +12 -12
- package/es/tree/tree.vue_vue_type_script_setup_true_lang.js +1 -1
- package/es/tree-select/tree-select.vue_vue_type_script_setup_true_lang.js +2 -2
- package/es/trigger/trigger.vue_vue_type_script_setup_true_lang.js +3 -3
- package/es/typography/base.vue.d.ts +15 -15
- package/es/typography/base.vue_vue_type_script_setup_true_lang.js +93 -164
- package/es/typography/interface.d.ts +1 -2
- package/es/typography/style/index.css +0 -5
- package/es/typography/style/index.scss +0 -7
- package/json/vetur-attributes.json +0 -20
- package/json/vetur-tags.json +5 -10
- package/json/web-types.json +9 -53
- package/package.json +2 -1
- package/es/typography/utils/measure.d.ts +0 -6
- 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
|
|
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
|
|
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"
|
|
62
|
-
"change"
|
|
63
|
-
"update:editText"
|
|
64
|
-
"editEnd"
|
|
65
|
-
"update:editing"
|
|
66
|
-
"copy"
|
|
67
|
-
"ellipsis"
|
|
68
|
-
"expand"
|
|
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 =
|
|
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 [
|
|
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
|
|
98
|
-
const
|
|
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("&", "&").replaceAll("<", "<").replaceAll(">", ">");
|
|
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)
|
|
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 =
|
|
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
|
|
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 = (
|
|
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:
|
|
179
|
+
isEllipsis: isEllipsis.value,
|
|
152
180
|
expanded: expanded.value,
|
|
153
|
-
forceRenderExpand:
|
|
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(
|
|
234
|
-
default: withCtx(() => [(openBlock(), createBlock(
|
|
235
|
-
|
|
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
|
-
|
|
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
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
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
|
-
])
|
|
225
|
+
]), createVNode(typography_operations_default, normalizeProps(guardReactiveProps(getOperationsProps())), null, 16)]),
|
|
253
226
|
_: 1
|
|
254
|
-
}, 16, ["class"
|
|
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"])) :
|
|
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(
|
|
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;
|
|
@@ -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"
|
package/json/vetur-tags.json
CHANGED
|
@@ -95,6 +95,9 @@
|
|
|
95
95
|
"sd-basic-crud-table": {
|
|
96
96
|
"attributes": []
|
|
97
97
|
},
|
|
98
|
+
"sd-bloom-menu": {
|
|
99
|
+
"attributes": []
|
|
100
|
+
},
|
|
98
101
|
"sd-border-beam": {
|
|
99
102
|
"attributes": []
|
|
100
103
|
},
|
|
@@ -434,18 +437,10 @@
|
|
|
434
437
|
]
|
|
435
438
|
},
|
|
436
439
|
"sd-ellipsis": {
|
|
437
|
-
"attributes": [
|
|
438
|
-
"line-clamp",
|
|
439
|
-
"expand-trigger",
|
|
440
|
-
"tooltip"
|
|
441
|
-
]
|
|
440
|
+
"attributes": []
|
|
442
441
|
},
|
|
443
442
|
"sd-performant-ellipsis": {
|
|
444
|
-
"attributes": [
|
|
445
|
-
"line-clamp",
|
|
446
|
-
"expand-trigger",
|
|
447
|
-
"tooltip"
|
|
448
|
-
]
|
|
443
|
+
"attributes": []
|
|
449
444
|
},
|
|
450
445
|
"sd-empty": {
|
|
451
446
|
"attributes": [
|
package/json/web-types.json
CHANGED
|
@@ -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.
|
|
5
|
+
"version": "4.2.0",
|
|
6
6
|
"contributions": {
|
|
7
7
|
"html": {
|
|
8
8
|
"types-syntax": "typescript",
|
|
@@ -512,6 +512,12 @@
|
|
|
512
512
|
"events": [],
|
|
513
513
|
"slots": []
|
|
514
514
|
},
|
|
515
|
+
{
|
|
516
|
+
"name": "sd-bloom-menu",
|
|
517
|
+
"attributes": [],
|
|
518
|
+
"events": [],
|
|
519
|
+
"slots": []
|
|
520
|
+
},
|
|
515
521
|
{
|
|
516
522
|
"name": "sd-border-beam",
|
|
517
523
|
"attributes": [],
|
|
@@ -2364,63 +2370,13 @@
|
|
|
2364
2370
|
},
|
|
2365
2371
|
{
|
|
2366
2372
|
"name": "sd-ellipsis",
|
|
2367
|
-
"attributes": [
|
|
2368
|
-
{
|
|
2369
|
-
"name": "line-clamp",
|
|
2370
|
-
"description": "Maximum number of displayed lines. Single-line ellipsis is used by default.",
|
|
2371
|
-
"value": {
|
|
2372
|
-
"type": "number | string",
|
|
2373
|
-
"kind": "expression"
|
|
2374
|
-
}
|
|
2375
|
-
},
|
|
2376
|
-
{
|
|
2377
|
-
"name": "expand-trigger",
|
|
2378
|
-
"description": "Trigger mode for expansion",
|
|
2379
|
-
"value": {
|
|
2380
|
-
"type": "'click'",
|
|
2381
|
-
"kind": "expression"
|
|
2382
|
-
}
|
|
2383
|
-
},
|
|
2384
|
-
{
|
|
2385
|
-
"name": "tooltip",
|
|
2386
|
-
"description": "Whether to show a tooltip when ellipsis is active. Tooltip props are supported.",
|
|
2387
|
-
"value": {
|
|
2388
|
-
"type": "boolean | EllipsisTooltipProps",
|
|
2389
|
-
"kind": "expression"
|
|
2390
|
-
}
|
|
2391
|
-
}
|
|
2392
|
-
],
|
|
2373
|
+
"attributes": [],
|
|
2393
2374
|
"events": [],
|
|
2394
2375
|
"slots": []
|
|
2395
2376
|
},
|
|
2396
2377
|
{
|
|
2397
2378
|
"name": "sd-performant-ellipsis",
|
|
2398
|
-
"attributes": [
|
|
2399
|
-
{
|
|
2400
|
-
"name": "line-clamp",
|
|
2401
|
-
"description": "Maximum number of displayed lines. Single-line ellipsis is used by default.",
|
|
2402
|
-
"value": {
|
|
2403
|
-
"type": "number | string",
|
|
2404
|
-
"kind": "expression"
|
|
2405
|
-
}
|
|
2406
|
-
},
|
|
2407
|
-
{
|
|
2408
|
-
"name": "expand-trigger",
|
|
2409
|
-
"description": "Trigger mode for expansion",
|
|
2410
|
-
"value": {
|
|
2411
|
-
"type": "'click'",
|
|
2412
|
-
"kind": "expression"
|
|
2413
|
-
}
|
|
2414
|
-
},
|
|
2415
|
-
{
|
|
2416
|
-
"name": "tooltip",
|
|
2417
|
-
"description": "Whether to show a tooltip when ellipsis is active. Tooltip props are supported.",
|
|
2418
|
-
"value": {
|
|
2419
|
-
"type": "boolean | EllipsisTooltipProps",
|
|
2420
|
-
"kind": "expression"
|
|
2421
|
-
}
|
|
2422
|
-
}
|
|
2423
|
-
],
|
|
2379
|
+
"attributes": [],
|
|
2424
2380
|
"events": [],
|
|
2425
2381
|
"slots": []
|
|
2426
2382
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sdata/web-vue",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.3.0",
|
|
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 };
|