@giteeteam/apps-team-components 1.0.28 → 1.0.29

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.
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ import { BaseCascadeProps } from './types';
3
+ export type CascadeProps = BaseCascadeProps;
4
+ declare const Cascade: React.FC<CascadeProps>;
5
+ export default Cascade;
@@ -0,0 +1,14 @@
1
+ import { jsx as _jsx } from "@emotion/react/jsx-runtime";
2
+ import { useMemo } from 'react';
3
+ import EmptyField from '../../common/EmptyField';
4
+ import BaseOverflowTooltip from '../../common/overflow-tooltip/BaseOverflowTooltip';
5
+ import { getShowValue } from './utils';
6
+ const Cascade = props => {
7
+ const { value } = props;
8
+ const showValue = useMemo(() => {
9
+ return getShowValue(value);
10
+ }, [value]);
11
+ return showValue ? _jsx(BaseOverflowTooltip, { title: showValue, children: showValue }) : _jsx(EmptyField, { readonly: true });
12
+ };
13
+ Cascade.displayName = 'CascadeReadView';
14
+ export default Cascade;
@@ -0,0 +1,4 @@
1
+ import { ValueOptionType } from './types';
2
+ export declare const VALUE_SPLIT = "__RC_CASCADER_SPLIT__";
3
+ export declare const LABEL_JOIN_STR = " / ";
4
+ export declare const getShowValue: (values: ValueOptionType[]) => string;
@@ -0,0 +1,18 @@
1
+ export const VALUE_SPLIT = '__RC_CASCADER_SPLIT__';
2
+ export const LABEL_JOIN_STR = ' / ';
3
+ export const getShowValue = (values) => {
4
+ if (!Array.isArray(values) || !values.length)
5
+ return '';
6
+ const showValue = values
7
+ .map(value => {
8
+ if (Array.isArray(value)) {
9
+ return value.map(ele => (ele === null || ele === void 0 ? void 0 : ele.label) || ele).join(LABEL_JOIN_STR);
10
+ }
11
+ else {
12
+ return (value === null || value === void 0 ? void 0 : value.label) || value;
13
+ }
14
+ })
15
+ .filter(Boolean)
16
+ .join(',');
17
+ return showValue;
18
+ };
@@ -3,6 +3,7 @@ import ActorsReadView from '../fields/actors/ReadView';
3
3
  import AncestorReadView from '../fields/ancestor/ReadView';
4
4
  import AssigneeReadView from '../fields/assignee/ReadView';
5
5
  import BindWorkspaceReadView from '../fields/bind-workspace/ReadView';
6
+ import CascadeReadView from '../fields/cascade/ReadView';
6
7
  import CheckboxReadView from '../fields/checkbox/ReadView';
7
8
  import CreatedAtReadView from '../fields/created-at/ReadView';
8
9
  import CreatedByReadView from '../fields/created-by/ReadView';
@@ -40,6 +41,7 @@ export const getStandardReadComponents = () => {
40
41
  [FIELD_TYPE_KEY_MAPPINGS.Ancestor]: AncestorReadView,
41
42
  [FIELD_TYPE_KEY_MAPPINGS.Assignee]: AssigneeReadView,
42
43
  [FIELD_TYPE_KEY_MAPPINGS.BindWorkspace]: BindWorkspaceReadView,
44
+ [FIELD_TYPE_KEY_MAPPINGS.Cascade]: CascadeReadView,
43
45
  [FIELD_TYPE_KEY_MAPPINGS.Checkbox]: CheckboxReadView,
44
46
  [FIELD_TYPE_KEY_MAPPINGS.CreatedAt]: CreatedAtReadView,
45
47
  [FIELD_TYPE_KEY_MAPPINGS.CreatedBy]: CreatedByReadView,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@giteeteam/apps-team-components",
3
- "version": "1.0.28",
3
+ "version": "1.0.29",
4
4
  "description": "Gitee team components",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",