@giteeteam/apps-team-components 1.0.6 → 1.0.8

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,8 +1,9 @@
1
- import React from 'react';
2
- export interface WorkSpaceReadViewProps {
1
+ /// <reference types="react" />
2
+ export interface WorkspaceReadViewProps {
3
3
  value?: {
4
4
  name?: string;
5
+ key?: string;
5
6
  };
6
7
  }
7
- declare const WorkspaceReadView: React.FC<WorkSpaceReadViewProps>;
8
+ declare const WorkspaceReadView: import("react").NamedExoticComponent<WorkspaceReadViewProps>;
8
9
  export default WorkspaceReadView;
@@ -1,9 +1,16 @@
1
1
  import { jsx as _jsx } from "@emotion/react/jsx-runtime";
2
2
  import { memo } from 'react';
3
+ import { ClassNames } from '@emotion/react';
3
4
  import EmptyField from '../../common/EmptyField';
4
- import BaseOverflowTooltip from '../../common/overflow-tooltip/BaseOverflowTooltip';
5
+ import { getTooltipMaxlineStyle, tooltipOverflowStyle } from '../../common/overflow-tooltip/style';
6
+ import { useToWorkspacePage } from '../bind-workspace/hooks';
7
+ import { pointerStyle } from '../bind-workspace/style';
5
8
  const WorkspaceReadView = memo(({ value }) => {
6
- return (value === null || value === void 0 ? void 0 : value.name) ? (_jsx(BaseOverflowTooltip, { title: value === null || value === void 0 ? void 0 : value.name, children: value === null || value === void 0 ? void 0 : value.name })) : (_jsx(EmptyField, { readonly: true }));
9
+ const { name, key } = value || {};
10
+ const { toWorkspacePage } = useToWorkspacePage();
11
+ return (_jsx(ClassNames, { children: ({ cx, css }) => {
12
+ return name ? (_jsx("span", { className: cx(css(tooltipOverflowStyle), css(getTooltipMaxlineStyle(1)), css(pointerStyle)), title: name, onClick: () => toWorkspacePage(key), children: name })) : (_jsx(EmptyField, { readonly: true }));
13
+ } }));
7
14
  });
8
15
  WorkspaceReadView.displayName = 'WorkspaceReadView';
9
16
  export default WorkspaceReadView;
@@ -13,7 +13,7 @@ const reduceObjArr = ({ arr, keys }) => {
13
13
  return accumulatorStr + ',' + nextValue;
14
14
  }, undefined);
15
15
  };
16
- const transferItem = item => {
16
+ const transferItem = (item, readonly) => {
17
17
  var _a, _b, _c;
18
18
  if (typeof item === 'string' || typeof item === 'number') {
19
19
  return item;
@@ -31,9 +31,9 @@ const transferItem = item => {
31
31
  else if ((_c = item[0]) === null || _c === void 0 ? void 0 : _c.value) {
32
32
  return reduceObjArr({ arr: item, keys: ['value'] });
33
33
  }
34
- return _jsx(EmptyField, { readonly: true });
34
+ return _jsx(EmptyField, { readonly: readonly });
35
35
  }
36
- return _jsx(EmptyField, { readonly: true });
36
+ return _jsx(EmptyField, { readonly: readonly });
37
37
  };
38
38
  const EMPTY_ARRAY = [];
39
39
  const defaultValue = {};
@@ -59,7 +59,7 @@ const BaseTableCell = ({ className, cellData, column, rowData, readComponents =
59
59
  if (ReadComponent) {
60
60
  return (_jsx("div", { className: cls, onMouseOver: handleMouseOver, children: _jsx(ReadComponent, { readonly: readonly, value: cellData, ...column.property, userData: column.data, options: ((_c = column.data) === null || _c === void 0 ? void 0 : _c.customData) || EMPTY_ARRAY, itemValues: rowData }) }));
61
61
  }
62
- const text = transferItem(cellData !== null && cellData !== void 0 ? cellData : rowData[column.dataIndex]);
62
+ const text = transferItem(cellData !== null && cellData !== void 0 ? cellData : rowData[column.dataIndex], readonly);
63
63
  return _jsx("div", { className: cls, children: text });
64
64
  };
65
65
  export const TableCell = props => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@giteeteam/apps-team-components",
3
- "version": "1.0.6",
3
+ "version": "1.0.8",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",