@giteeteam/apps-team-components 1.1.2 → 1.1.4-alpha.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.
|
@@ -38,22 +38,24 @@ const DropdownReadView = memo(props => {
|
|
|
38
38
|
}
|
|
39
39
|
if (!(options === null || options === void 0 ? void 0 : options.length))
|
|
40
40
|
return '';
|
|
41
|
-
|
|
41
|
+
const valueArr = value
|
|
42
42
|
.map(item => { var _a; return (item === null || item === void 0 ? void 0 : item.label) || ((_a = options.find(opt => opt.value === handleValue(item))) === null || _a === void 0 ? void 0 : _a.label); })
|
|
43
|
-
.filter(Boolean)
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
.filter(Boolean);
|
|
44
|
+
if (!(valueArr === null || valueArr === void 0 ? void 0 : valueArr.length))
|
|
45
|
+
return '';
|
|
46
|
+
return valueArr.map((item, index) => {
|
|
47
|
+
const content = optionsMap[item] ? getFormattedLabel(optionsMap[item]) : item;
|
|
46
48
|
return index === value.length - 1 ? content : _jsxs(_Fragment, { children: [content, ","] });
|
|
47
49
|
});
|
|
48
50
|
}
|
|
49
51
|
else {
|
|
50
52
|
const item = value[0];
|
|
51
|
-
if (item.label)
|
|
52
|
-
return item.label;
|
|
53
|
+
if (item === null || item === void 0 ? void 0 : item.label)
|
|
54
|
+
return item === null || item === void 0 ? void 0 : item.label;
|
|
53
55
|
if (!(options === null || options === void 0 ? void 0 : options.length))
|
|
54
56
|
return '';
|
|
55
57
|
const label = (item === null || item === void 0 ? void 0 : item.label) || ((_b = options.find(opt => opt.value === handleValue(item))) === null || _b === void 0 ? void 0 : _b.label);
|
|
56
|
-
return getFormattedLabel(optionsMap[label]);
|
|
58
|
+
return optionsMap[label] ? getFormattedLabel(optionsMap[label]) : label;
|
|
57
59
|
}
|
|
58
60
|
}, [mode, options, optionsMap, value]);
|
|
59
61
|
return (_jsx(_Fragment, { children: showValue ? (_jsx(SimpleOverflowToolTip, { title: showValue, children: showValue })) : (_jsx(EmptyField, { readonly: readonly })) }));
|
|
@@ -1,4 +1,18 @@
|
|
|
1
|
+
export const getFullName = (value) => {
|
|
2
|
+
const fullPath = getFullPath(value);
|
|
3
|
+
if (!fullPath)
|
|
4
|
+
return value === null || value === void 0 ? void 0 : value.name;
|
|
5
|
+
return `${fullPath}/${value === null || value === void 0 ? void 0 : value.name}`;
|
|
6
|
+
};
|
|
1
7
|
export const formatDisplayValue = (value) => {
|
|
2
|
-
const values = (Array.isArray(value) ? value : [value]).map(item => item
|
|
8
|
+
const values = (Array.isArray(value) ? value : [value]).map(item => getFullName(item)).filter(Boolean);
|
|
3
9
|
return values.join('、');
|
|
4
10
|
};
|
|
11
|
+
export const getFullPath = (value) => {
|
|
12
|
+
const { repo, path } = value || {};
|
|
13
|
+
let fullPath = repo;
|
|
14
|
+
if (path) {
|
|
15
|
+
fullPath += '/' + path;
|
|
16
|
+
}
|
|
17
|
+
return fullPath;
|
|
18
|
+
};
|