@giteeteam/apps-team-components 1.0.2-alpha.1 → 1.0.2-alpha.3

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.
@@ -3,7 +3,7 @@ import { memo, useMemo } from 'react';
3
3
  import EmptyField from '../../common/EmptyField';
4
4
  import SimpleOverflowToolTip from '../../common/overflow-tooltip/SimpleOverflowToolTip';
5
5
  const CheckboxReadView = memo(props => {
6
- const { value, options } = props;
6
+ const { value, options, readonly } = props;
7
7
  const showValue = useMemo(() => {
8
8
  if (!(options === null || options === void 0 ? void 0 : options.length))
9
9
  return '';
@@ -15,7 +15,7 @@ const CheckboxReadView = memo(props => {
15
15
  .join(',');
16
16
  return result;
17
17
  }, [options, value]);
18
- return (_jsx(_Fragment, { children: showValue ? _jsx(SimpleOverflowToolTip, { title: showValue, children: showValue }) : _jsx(EmptyField, {}) }));
18
+ return (_jsx(_Fragment, { children: showValue ? (_jsx(SimpleOverflowToolTip, { title: showValue, children: showValue })) : (_jsx(EmptyField, { readonly: readonly })) }));
19
19
  });
20
20
  CheckboxReadView.displayName = 'CheckboxReadView';
21
21
  export default CheckboxReadView;
@@ -4,7 +4,7 @@ import EmptyField from '../../common/EmptyField';
4
4
  import SimpleOverflowToolTip from '../../common/overflow-tooltip/SimpleOverflowToolTip';
5
5
  import { handleValue } from './BaseField';
6
6
  const DropdownReadView = memo(props => {
7
- const { value, options } = props;
7
+ const { value, options, readonly } = props;
8
8
  const showValue = useMemo(() => {
9
9
  if (!(options === null || options === void 0 ? void 0 : options.length))
10
10
  return '';
@@ -16,7 +16,7 @@ const DropdownReadView = memo(props => {
16
16
  .join(',');
17
17
  return result;
18
18
  }, [options, value]);
19
- return (_jsx(_Fragment, { children: showValue ? _jsx(SimpleOverflowToolTip, { title: showValue, children: showValue }) : _jsx(EmptyField, {}) }));
19
+ return (_jsx(_Fragment, { children: showValue ? (_jsx(SimpleOverflowToolTip, { title: showValue, children: showValue })) : (_jsx(EmptyField, { readonly: readonly })) }));
20
20
  });
21
21
  DropdownReadView.displayName = 'DropdownReadView';
22
22
  export default DropdownReadView;
@@ -37,7 +37,7 @@ const transferItem = item => {
37
37
  };
38
38
  const EMPTY_ARRAY = [];
39
39
  const defaultValue = {};
40
- const BaseTableCell = ({ className, cellData, column, rowData, readComponents = defaultValue, editComponents = defaultValue, handleChange, }) => {
40
+ const BaseTableCell = ({ className, cellData, column, rowData, readComponents = defaultValue, editComponents = defaultValue, handleChange, readonly, }) => {
41
41
  var _a, _b, _c;
42
42
  const [cellEntered, setCellEntered] = useState(false);
43
43
  const cls = `field-cell-layout field-layout ${className}`;
@@ -54,10 +54,10 @@ const BaseTableCell = ({ className, cellData, column, rowData, readComponents =
54
54
  }, [editComponents]);
55
55
  if (cellEntered && EditComponent) {
56
56
  const { property, data, objectId } = column;
57
- return (_jsx("div", { className: cls, children: _jsx(EditTableCell, { Component: EditComponent, workspaceId: (_a = rowData.workspace) === null || _a === void 0 ? void 0 : _a.objectId, itemTypeId: (_b = rowData.itemType) === null || _b === void 0 ? void 0 : _b.objectId, property: property, data: data, id: rowData.objectId, readonly: rowData.readonly, objectId: objectId, text: cellData, handleChange: handleChange }) }));
57
+ return (_jsx("div", { className: cls, children: _jsx(EditTableCell, { Component: EditComponent, workspaceId: (_a = rowData.workspace) === null || _a === void 0 ? void 0 : _a.objectId, itemTypeId: (_b = rowData.itemType) === null || _b === void 0 ? void 0 : _b.objectId, property: property, data: data, id: rowData.objectId, readonly: readonly, objectId: objectId, text: cellData, handleChange: handleChange }) }));
58
58
  }
59
59
  if (ReadComponent) {
60
- return (_jsx("div", { className: cls, onMouseOver: handleMouseOver, children: _jsx(ReadComponent, { value: cellData, ...column.property, userData: column.data, options: ((_c = column.data) === null || _c === void 0 ? void 0 : _c.customData) || EMPTY_ARRAY, itemValues: rowData }) }));
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
62
  const text = transferItem(cellData !== null && cellData !== void 0 ? cellData : rowData[column.dataIndex]);
63
63
  return _jsx("div", { className: cls, children: text });
@@ -1,4 +1,5 @@
1
1
  import React from 'react';
2
+ import { Options as CacheOptions } from '@emotion/cache';
2
3
  import { IAntdConfigContext } from './antdConfig';
3
4
  import { ICurrentUserContext } from './currentUser';
4
5
  import { ICurrentWorkspaceContext } from './currentWorkspace';
@@ -9,5 +10,6 @@ import { ITenantContext } from './tenant';
9
10
  import { IWorkflowConfigContext } from './workflowConfig';
10
11
  export interface LibraryProviderProps extends React.PropsWithChildren, IAntdConfigContext, ITeamConfigContext, ITenantContext, IDatetimeFormatContext, ICurrentWorkspaceContext, IWorkflowConfigContext, IItemConfigContext, ICurrentUserContext {
11
12
  locale?: string;
13
+ emotionCacheOptions?: CacheOptions;
12
14
  }
13
15
  export declare const LibraryProvider: React.FC<LibraryProviderProps>;
@@ -1,5 +1,7 @@
1
1
  import { jsx as _jsx } from "@emotion/react/jsx-runtime";
2
- import { useEffect } from 'react';
2
+ import { useEffect, useMemo } from 'react';
3
+ import createCache from '@emotion/cache';
4
+ import { CacheProvider } from '@emotion/react';
3
5
  import { i18n } from '../i18n';
4
6
  import { AntdConfigProvider } from './antdConfig';
5
7
  import { CurrentUserProvider } from './currentUser';
@@ -9,9 +11,15 @@ import { ItemConfigProvider } from './itemConfig';
9
11
  import { TeamConfigProvider } from './teamConfig';
10
12
  import { TenantProvider } from './tenant';
11
13
  import { WorkflowConfigProvider } from './workflowConfig';
12
- export const LibraryProvider = ({ getPopupContainer, locale, tenant, datetimeFormat, teamBasePath, teamGateway, workspaceKey, workflow, item, currentUser, children, }) => {
14
+ export const LibraryProvider = ({ getPopupContainer, locale, tenant, datetimeFormat, teamBasePath, teamGateway, workspaceKey, workflow, item, currentUser, emotionCacheOptions, children, }) => {
15
+ const emotionCache = useMemo(() => {
16
+ return createCache({
17
+ key: 'apps',
18
+ ...emotionCacheOptions,
19
+ });
20
+ }, [emotionCacheOptions]);
13
21
  useEffect(() => {
14
22
  i18n.setLocale(locale);
15
23
  }, [locale]);
16
- return (_jsx(AntdConfigProvider, { getPopupContainer: getPopupContainer, children: _jsx(TeamConfigProvider, { teamBasePath: teamBasePath, teamGateway: teamGateway, children: _jsx(TenantProvider, { tenant: tenant, children: _jsx(CurrentWorkspaceProvider, { workspaceKey: workspaceKey, children: _jsx(DatetimeFormatProvider, { datetimeFormat: datetimeFormat, children: _jsx(CurrentUserProvider, { currentUser: currentUser, children: _jsx(WorkflowConfigProvider, { workflow: workflow, children: _jsx(ItemConfigProvider, { item: item, children: children }) }) }) }) }) }) }) }));
24
+ return (_jsx(CacheProvider, { value: emotionCache, children: _jsx(AntdConfigProvider, { getPopupContainer: getPopupContainer, children: _jsx(TeamConfigProvider, { teamBasePath: teamBasePath, teamGateway: teamGateway, children: _jsx(TenantProvider, { tenant: tenant, children: _jsx(CurrentWorkspaceProvider, { workspaceKey: workspaceKey, children: _jsx(DatetimeFormatProvider, { datetimeFormat: datetimeFormat, children: _jsx(CurrentUserProvider, { currentUser: currentUser, children: _jsx(WorkflowConfigProvider, { workflow: workflow, children: _jsx(ItemConfigProvider, { item: item, children: children }) }) }) }) }) }) }) }) }));
17
25
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@giteeteam/apps-team-components",
3
- "version": "1.0.2-alpha.1",
3
+ "version": "1.0.2-alpha.3",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",