@cmstops/pro-compo 3.10.5-stable.11 → 3.10.5-stable.12
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,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent, computed, ref, watch, openBlock, createElementBlock, normalizeClass, createElementVNode, createCommentVNode, createBlock, unref, toDisplayString, renderSlot, Fragment, renderList, createVNode, withCtx } from "vue";
|
|
1
|
+
import { defineComponent, computed, ref, watch, openBlock, createElementBlock, normalizeClass, createElementVNode, createCommentVNode, createBlock, unref, toDisplayString, renderSlot, Fragment, renderList, resolveDynamicComponent, createVNode, withCtx, h } from "vue";
|
|
2
2
|
import { Image, Tooltip } from "@arco-design/web-vue";
|
|
3
3
|
import { IconTopic } from "@arco-iconbox/vue-cmstop-icons";
|
|
4
4
|
import { getDocThumb } from "../../../utils/doc.js";
|
|
@@ -51,21 +51,74 @@ const _sfc_main = defineComponent({
|
|
|
51
51
|
return props.item && props.item.mourn_style === 1;
|
|
52
52
|
});
|
|
53
53
|
const attributes = ref([]);
|
|
54
|
+
function normalizeRenderResult(result) {
|
|
55
|
+
if (result && typeof result === "object" && "__v_isVNode" in result) {
|
|
56
|
+
return result;
|
|
57
|
+
}
|
|
58
|
+
if (Array.isArray(result)) {
|
|
59
|
+
const [type, props2, children] = result;
|
|
60
|
+
if (children === void 0) {
|
|
61
|
+
return h(type, props2);
|
|
62
|
+
}
|
|
63
|
+
if (Array.isArray(children)) {
|
|
64
|
+
return h(type, props2, children.map((c) => normalizeRenderResult(c)));
|
|
65
|
+
}
|
|
66
|
+
return h(type, props2, children);
|
|
67
|
+
}
|
|
68
|
+
return result;
|
|
69
|
+
}
|
|
54
70
|
function initAttributes() {
|
|
55
71
|
if (!props.showAttrs)
|
|
56
72
|
return;
|
|
57
73
|
attributes.value = props.showAttrs.map((item) => {
|
|
74
|
+
var _a, _b;
|
|
58
75
|
let value = "--";
|
|
59
76
|
if (item.key)
|
|
60
|
-
value = props.item[item.key]
|
|
77
|
+
value = (_a = props.item[item.key]) != null ? _a : "--";
|
|
61
78
|
else if (item.getValue)
|
|
62
|
-
value = item.getValue(props.item)
|
|
79
|
+
value = (_b = item.getValue(props.item)) != null ? _b : "--";
|
|
80
|
+
if (item.render) {
|
|
81
|
+
const renderResult = item.render(props.item, value);
|
|
82
|
+
return {
|
|
83
|
+
value,
|
|
84
|
+
...item,
|
|
85
|
+
renderVNode: normalizeRenderResult(renderResult)
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
let displayValue = value;
|
|
89
|
+
if (item.format) {
|
|
90
|
+
displayValue = item.format(value, props.item);
|
|
91
|
+
}
|
|
63
92
|
return {
|
|
64
93
|
value,
|
|
94
|
+
displayValue,
|
|
65
95
|
...item
|
|
66
96
|
};
|
|
67
97
|
});
|
|
68
98
|
}
|
|
99
|
+
function getTooltipContent(attr) {
|
|
100
|
+
if (attr.tooltip === false)
|
|
101
|
+
return "";
|
|
102
|
+
if (typeof attr.tooltip === "string")
|
|
103
|
+
return attr.tooltip;
|
|
104
|
+
if (typeof attr.tooltip === "function") {
|
|
105
|
+
return attr.tooltip(attr.value, props.item);
|
|
106
|
+
}
|
|
107
|
+
if (typeof attr.tooltip === "object" && attr.tooltip.content) {
|
|
108
|
+
if (typeof attr.tooltip.content === "string")
|
|
109
|
+
return attr.tooltip.content;
|
|
110
|
+
if (typeof attr.tooltip.content === "function") {
|
|
111
|
+
return attr.tooltip.content(attr.value, props.item);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
return `${attr.label}: ${attr.value}`;
|
|
115
|
+
}
|
|
116
|
+
function getTooltipPosition(attr) {
|
|
117
|
+
if (typeof attr.tooltip === "object" && attr.tooltip.position) {
|
|
118
|
+
return attr.tooltip.position;
|
|
119
|
+
}
|
|
120
|
+
return "tl";
|
|
121
|
+
}
|
|
69
122
|
watch(
|
|
70
123
|
() => props.item,
|
|
71
124
|
() => {
|
|
@@ -122,18 +175,23 @@ const _sfc_main = defineComponent({
|
|
|
122
175
|
key: index,
|
|
123
176
|
class: "abttr"
|
|
124
177
|
}, [
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
178
|
+
createCommentVNode(" \u5982\u679C\u6709 render \u51FD\u6570\uFF0C\u76F4\u63A5\u6E32\u67D3 "),
|
|
179
|
+
attr.renderVNode ? (openBlock(), createBlock(resolveDynamicComponent(attr.renderVNode), { key: 0 })) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
180
|
+
createCommentVNode(" \u5426\u5219\u4F7F\u7528\u4F20\u7EDF\u65B9\u5F0F + \u65B0\u589E\u914D\u7F6E "),
|
|
181
|
+
createVNode(unref(Tooltip), {
|
|
182
|
+
content: getTooltipContent(attr),
|
|
183
|
+
disabled: attr.tooltip === false,
|
|
184
|
+
position: getTooltipPosition(attr)
|
|
185
|
+
}, {
|
|
186
|
+
default: withCtx(() => [
|
|
187
|
+
createElementVNode("div", _hoisted_8, [
|
|
188
|
+
attr.topic && attr.displayValue ? (openBlock(), createBlock(unref(IconTopic), { key: 0 })) : createCommentVNode("v-if", true),
|
|
189
|
+
createElementVNode("span", null, toDisplayString(attr.displayValue || "--"), 1)
|
|
190
|
+
])
|
|
191
|
+
]),
|
|
192
|
+
_: 2
|
|
193
|
+
}, 1032, ["content", "disabled", "position"])
|
|
194
|
+
], 2112))
|
|
137
195
|
]);
|
|
138
196
|
}), 128))
|
|
139
197
|
]),
|
|
@@ -52,21 +52,74 @@ const _sfc_main = vue.defineComponent({
|
|
|
52
52
|
return props.item && props.item.mourn_style === 1;
|
|
53
53
|
});
|
|
54
54
|
const attributes = vue.ref([]);
|
|
55
|
+
function normalizeRenderResult(result) {
|
|
56
|
+
if (result && typeof result === "object" && "__v_isVNode" in result) {
|
|
57
|
+
return result;
|
|
58
|
+
}
|
|
59
|
+
if (Array.isArray(result)) {
|
|
60
|
+
const [type, props2, children] = result;
|
|
61
|
+
if (children === void 0) {
|
|
62
|
+
return vue.h(type, props2);
|
|
63
|
+
}
|
|
64
|
+
if (Array.isArray(children)) {
|
|
65
|
+
return vue.h(type, props2, children.map((c) => normalizeRenderResult(c)));
|
|
66
|
+
}
|
|
67
|
+
return vue.h(type, props2, children);
|
|
68
|
+
}
|
|
69
|
+
return result;
|
|
70
|
+
}
|
|
55
71
|
function initAttributes() {
|
|
56
72
|
if (!props.showAttrs)
|
|
57
73
|
return;
|
|
58
74
|
attributes.value = props.showAttrs.map((item) => {
|
|
75
|
+
var _a, _b;
|
|
59
76
|
let value = "--";
|
|
60
77
|
if (item.key)
|
|
61
|
-
value = props.item[item.key]
|
|
78
|
+
value = (_a = props.item[item.key]) != null ? _a : "--";
|
|
62
79
|
else if (item.getValue)
|
|
63
|
-
value = item.getValue(props.item)
|
|
80
|
+
value = (_b = item.getValue(props.item)) != null ? _b : "--";
|
|
81
|
+
if (item.render) {
|
|
82
|
+
const renderResult = item.render(props.item, value);
|
|
83
|
+
return {
|
|
84
|
+
value,
|
|
85
|
+
...item,
|
|
86
|
+
renderVNode: normalizeRenderResult(renderResult)
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
let displayValue = value;
|
|
90
|
+
if (item.format) {
|
|
91
|
+
displayValue = item.format(value, props.item);
|
|
92
|
+
}
|
|
64
93
|
return {
|
|
65
94
|
value,
|
|
95
|
+
displayValue,
|
|
66
96
|
...item
|
|
67
97
|
};
|
|
68
98
|
});
|
|
69
99
|
}
|
|
100
|
+
function getTooltipContent(attr) {
|
|
101
|
+
if (attr.tooltip === false)
|
|
102
|
+
return "";
|
|
103
|
+
if (typeof attr.tooltip === "string")
|
|
104
|
+
return attr.tooltip;
|
|
105
|
+
if (typeof attr.tooltip === "function") {
|
|
106
|
+
return attr.tooltip(attr.value, props.item);
|
|
107
|
+
}
|
|
108
|
+
if (typeof attr.tooltip === "object" && attr.tooltip.content) {
|
|
109
|
+
if (typeof attr.tooltip.content === "string")
|
|
110
|
+
return attr.tooltip.content;
|
|
111
|
+
if (typeof attr.tooltip.content === "function") {
|
|
112
|
+
return attr.tooltip.content(attr.value, props.item);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
return `${attr.label}: ${attr.value}`;
|
|
116
|
+
}
|
|
117
|
+
function getTooltipPosition(attr) {
|
|
118
|
+
if (typeof attr.tooltip === "object" && attr.tooltip.position) {
|
|
119
|
+
return attr.tooltip.position;
|
|
120
|
+
}
|
|
121
|
+
return "tl";
|
|
122
|
+
}
|
|
70
123
|
vue.watch(
|
|
71
124
|
() => props.item,
|
|
72
125
|
() => {
|
|
@@ -123,18 +176,23 @@ const _sfc_main = vue.defineComponent({
|
|
|
123
176
|
key: index2,
|
|
124
177
|
class: "abttr"
|
|
125
178
|
}, [
|
|
126
|
-
vue.
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
179
|
+
vue.createCommentVNode(" \u5982\u679C\u6709 render \u51FD\u6570\uFF0C\u76F4\u63A5\u6E32\u67D3 "),
|
|
180
|
+
attr.renderVNode ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(attr.renderVNode), { key: 0 })) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
|
|
181
|
+
vue.createCommentVNode(" \u5426\u5219\u4F7F\u7528\u4F20\u7EDF\u65B9\u5F0F + \u65B0\u589E\u914D\u7F6E "),
|
|
182
|
+
vue.createVNode(vue.unref(webVue.Tooltip), {
|
|
183
|
+
content: getTooltipContent(attr),
|
|
184
|
+
disabled: attr.tooltip === false,
|
|
185
|
+
position: getTooltipPosition(attr)
|
|
186
|
+
}, {
|
|
187
|
+
default: vue.withCtx(() => [
|
|
188
|
+
vue.createElementVNode("div", _hoisted_8, [
|
|
189
|
+
attr.topic && attr.displayValue ? (vue.openBlock(), vue.createBlock(vue.unref(vueCmstopIcons.IconTopic), { key: 0 })) : vue.createCommentVNode("v-if", true),
|
|
190
|
+
vue.createElementVNode("span", null, vue.toDisplayString(attr.displayValue || "--"), 1)
|
|
191
|
+
])
|
|
192
|
+
]),
|
|
193
|
+
_: 2
|
|
194
|
+
}, 1032, ["content", "disabled", "position"])
|
|
195
|
+
], 2112))
|
|
138
196
|
]);
|
|
139
197
|
}), 128))
|
|
140
198
|
]),
|