mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-07-02 03:02:19 +08:00
Merge branch 'next' into develop
This commit is contained in:
commit
129c14cd19
@ -1,28 +0,0 @@
|
|||||||
/**
|
|
||||||
* This file is part of the NocoBase (R) project.
|
|
||||||
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
||||||
* Authors: NocoBase Team.
|
|
||||||
*
|
|
||||||
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
||||||
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import React, { FC } from 'react';
|
|
||||||
import { EllipsisWithTooltip } from '../input/EllipsisWithTooltip';
|
|
||||||
|
|
||||||
const style: React.CSSProperties = { overflowWrap: 'break-word', whiteSpace: 'normal' };
|
|
||||||
|
|
||||||
export const RenderTextInCell: FC<{ value: string; ellipsis: boolean }> = ({ value, ellipsis = false }) => {
|
|
||||||
if (ellipsis) {
|
|
||||||
return (
|
|
||||||
<EllipsisWithTooltip role="button" ellipsis>
|
|
||||||
{value}
|
|
||||||
</EllipsisWithTooltip>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return (
|
|
||||||
<span role="button" style={style}>
|
|
||||||
{value}
|
|
||||||
</span>
|
|
||||||
);
|
|
||||||
};
|
|
@ -23,7 +23,7 @@ import { default as classNames, default as cls } from 'classnames';
|
|||||||
import _, { omit } from 'lodash';
|
import _, { omit } from 'lodash';
|
||||||
import React, { createContext, FC, MutableRefObject, useCallback, useContext, useMemo, useRef, useState } from 'react';
|
import React, { createContext, FC, MutableRefObject, useCallback, useContext, useMemo, useRef, useState } from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { DndContext, isBulkEditAction, useCompile, useDesignable, usePopupSettings, useTableSize } from '../..';
|
import { DndContext, isBulkEditAction, useDesignable, usePopupSettings, useTableSize } from '../..';
|
||||||
import {
|
import {
|
||||||
BlockRequestLoadingContext,
|
BlockRequestLoadingContext,
|
||||||
RecordIndexProvider,
|
RecordIndexProvider,
|
||||||
@ -54,7 +54,6 @@ import { GetStyleRules } from '../../../schema-settings/LinkageRules/useActionVa
|
|||||||
import { HighPerformanceSpin } from '../../common/high-performance-spin/HighPerformanceSpin';
|
import { HighPerformanceSpin } from '../../common/high-performance-spin/HighPerformanceSpin';
|
||||||
import { useToken } from '../__builtins__';
|
import { useToken } from '../__builtins__';
|
||||||
import { useAssociationFieldContext } from '../association-field/hooks';
|
import { useAssociationFieldContext } from '../association-field/hooks';
|
||||||
import { RenderTextInCell } from './RenderTextInCell';
|
|
||||||
import { TableSkeleton } from './TableSkeleton';
|
import { TableSkeleton } from './TableSkeleton';
|
||||||
import { extractIndex, isCollectionFieldComponent, isColumnComponent } from './utils';
|
import { extractIndex, isCollectionFieldComponent, isColumnComponent } from './utils';
|
||||||
|
|
||||||
@ -83,9 +82,6 @@ const useArrayField = (props) => {
|
|||||||
return (props.field || field) as ArrayField;
|
return (props.field || field) as ArrayField;
|
||||||
};
|
};
|
||||||
|
|
||||||
function getSchemaArrJSON(schemaArr: Schema[]) {
|
|
||||||
return schemaArr.map((item) => (item.name === 'actions' ? omit(item.toJSON(), 'properties') : item.toJSON()));
|
|
||||||
}
|
|
||||||
function adjustColumnOrder(columns) {
|
function adjustColumnOrder(columns) {
|
||||||
const leftFixedColumns = [];
|
const leftFixedColumns = [];
|
||||||
const normalColumns = [];
|
const normalColumns = [];
|
||||||
@ -171,7 +167,6 @@ const useTableColumns = (props: { showDel?: any; isSubTable?: boolean }, paginat
|
|||||||
const { current, pageSize } = paginationProps;
|
const { current, pageSize } = paginationProps;
|
||||||
const { isPopupVisibleControlledByURL } = usePopupSettings();
|
const { isPopupVisibleControlledByURL } = usePopupSettings();
|
||||||
const { refresh } = useRefreshTableColumns();
|
const { refresh } = useRefreshTableColumns();
|
||||||
const compile = useCompile();
|
|
||||||
|
|
||||||
const filterProperties = useCallback(
|
const filterProperties = useCallback(
|
||||||
(schema) =>
|
(schema) =>
|
||||||
@ -224,17 +219,6 @@ const useTableColumns = (props: { showDel?: any; isSubTable?: boolean }, paginat
|
|||||||
...columnSchema['x-component-props'],
|
...columnSchema['x-component-props'],
|
||||||
width: columnHidden && !designable ? 0 : columnSchema['x-component-props']?.width || 100,
|
width: columnHidden && !designable ? 0 : columnSchema['x-component-props']?.width || 100,
|
||||||
render: (value, record, index) => {
|
render: (value, record, index) => {
|
||||||
const { enableLink } = Object.values(columnSchema.properties)[0]['x-component-props'] || {};
|
|
||||||
|
|
||||||
if (!enableLink && ['sequence', 'input', 'textarea', 'phone', 'email'].includes(_interface)) {
|
|
||||||
return (
|
|
||||||
<RenderTextInCell
|
|
||||||
value={compile(value || _.get(record, Object.keys(columnSchema.properties)[0]))}
|
|
||||||
ellipsis={Object.values(columnSchema.properties)[0]?.['x-component-props']?.ellipsis}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<RefreshComponentProvider refresh={refresh}>
|
<RefreshComponentProvider refresh={refresh}>
|
||||||
<TableCellRender
|
<TableCellRender
|
||||||
|
Loading…
x
Reference in New Issue
Block a user