@giteeteam/apps-team-components 1.0.38 → 1.1.1-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.
package/README.md CHANGED
@@ -21,3 +21,5 @@ const Demo = ({children}) => {
21
21
  - SimpleOverflowTooltip 统一为 BaseOverflowToolTip 导出
22
22
  - 去除 BaseOverflowToolTip 的 maxline
23
23
 
24
+ # 1.1.x版本
25
+ - team最低版本为4.16.0
@@ -1,8 +1,11 @@
1
- import { jsx as _jsx, Fragment as _Fragment } from "@emotion/react/jsx-runtime";
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
2
2
  import { memo, useMemo } from 'react';
3
3
  import EmptyField from '../../common/EmptyField';
4
4
  import SimpleOverflowToolTip from '../../common/overflow-tooltip/SimpleOverflowToolTip';
5
5
  import { handleValue } from './BaseField';
6
+ const getFormattedLabel = ({ label, style = {}, }) => {
7
+ return _jsx("span", { style: { borderRadius: 2, color: style === null || style === void 0 ? void 0 : style.color, background: style === null || style === void 0 ? void 0 : style.background }, children: label });
8
+ };
6
9
  const DropdownReadView = memo(props => {
7
10
  const { value, options, readonly: propsReadonly, userData } = props;
8
11
  const readonly = useMemo(() => {
@@ -13,7 +16,7 @@ const DropdownReadView = memo(props => {
13
16
  return propsReadonly;
14
17
  }
15
18
  }, [propsReadonly, userData]);
16
- const showValue = useMemo(() => {
19
+ const showValueTitle = useMemo(() => {
17
20
  var _a;
18
21
  if (!(value === null || value === void 0 ? void 0 : value.length))
19
22
  return '';
@@ -28,7 +31,29 @@ const DropdownReadView = memo(props => {
28
31
  .join(',');
29
32
  return result;
30
33
  }, [options, value]);
31
- return (_jsx(_Fragment, { children: showValue ? (_jsx(SimpleOverflowToolTip, { title: showValue, children: showValue })) : (_jsx(EmptyField, { readonly: readonly })) }));
34
+ const showValue = useMemo(() => {
35
+ var _a;
36
+ if (!(value === null || value === void 0 ? void 0 : value.length))
37
+ return '';
38
+ if ((_a = value[0]) === null || _a === void 0 ? void 0 : _a.label) {
39
+ return value.map(item => item.label).join(',');
40
+ }
41
+ if (!(options === null || options === void 0 ? void 0 : options.length))
42
+ return '';
43
+ const optionsMap = {};
44
+ options === null || options === void 0 ? void 0 : options.forEach(item => {
45
+ optionsMap[item.label] = item;
46
+ });
47
+ const result = value
48
+ .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); })
49
+ .filter(Boolean)
50
+ .map((item, index) => {
51
+ const content = getFormattedLabel(optionsMap[item]);
52
+ return index === value.length - 1 ? content : _jsxs(_Fragment, { children: [content, ","] });
53
+ });
54
+ return result;
55
+ }, [options, value]);
56
+ return (_jsx(_Fragment, { children: showValue ? (_jsx(SimpleOverflowToolTip, { title: showValueTitle, children: showValue })) : (_jsx(EmptyField, { readonly: readonly })) }));
32
57
  });
33
58
  DropdownReadView.displayName = 'DropdownReadView';
34
59
  export default DropdownReadView;
@@ -17,7 +17,7 @@ export const workflowContentStyle = `
17
17
  text-align: left;
18
18
  `;
19
19
  export const statePopoverStyle = (antPrefix) => `
20
- z-index: 1000 !important;
20
+ z-index: 999 !important;
21
21
 
22
22
  div.${antPrefix}-popover-inner-content, div.${antPrefix}-popover-inner {
23
23
  padding: 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@giteeteam/apps-team-components",
3
- "version": "1.0.38",
3
+ "version": "1.1.1-alpha.1",
4
4
  "description": "Gitee team components",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",