Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 属性面板资产无效数据情况 #29

Merged
merged 1 commit into from
Sep 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
],
"scripts": {
"prepare": "husky install",
"dev": "lerna run dev --stream --no-bail",
"start:sdk": "lerna run start --stream --scope=@antv/li-sdk",
"start:editor": "lerna run start --stream --scope=@antv/li-editor",
"start:core-assets": "lerna run start --stream --scope=@antv/li-core-assets",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,6 @@ const useStyle = () => {
background-color: ${colorBgContainer};
`,

panelTooltip: css`
max-height: 300px !important;
overflow-y: auto !important;
font-size: 6px !important;
`,

panelContent: css`
padding: 14px;
`,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { CloseOutlined } from '@ant-design/icons';
import type { ImplementWidgetProps } from '@antv/li-sdk';
import { useDatasetList, useLayerList } from '@antv/li-sdk';
import { Col, Image, Row, Tooltip, Typography } from 'antd';
import { Col, Image, Row, Typography } from 'antd';
import cls from 'classnames';
import { isObject, isString } from 'lodash-es';
import React, { useEffect, useMemo, useRef, useState } from 'react';
import useStyle from './ComponenStyle';
import { CLS_PREFIX } from './constant';
Expand Down Expand Up @@ -63,27 +64,25 @@ const PropertiesPanel: React.FC<PropertiesPanelProps> = ({ items = [], isOpen })
};
}, [datasetList, formatLayerList]);

const getContent = (val: string) => {
if (isImageUrl(val)) {
const getContent = (val: any) => {
if (isString(val) && isImageUrl(val)) {
return (
<div>
<Image referrerPolicy="no-referrer" height={100} src={val} />
</div>
);
}

const text = isObject(val) ? JSON.stringify(val) : val;

return (
<Paragraph
ellipsis={{
rows: 3,
tooltip: {
title: JSON.stringify(val).length > 100 ? (typeof val === 'object' ? JSON.stringify(val) : val) : null,
zIndex: 99999,
overlayClassName: styles.panelTooltip,
},
expandable: true,
}}
>
{typeof val === 'object' ? JSON.stringify(val) : val}
{text}
</Paragraph>
);
};
Expand All @@ -94,13 +93,7 @@ const PropertiesPanel: React.FC<PropertiesPanelProps> = ({ items = [], isOpen })
<div className={cls(styles.propertiesPanel, CLS_PREFIX)} style={{ width: collapsed }}>
<div style={{ display: Boolean(collapsed) ? 'block' : 'none' }}>
<div className={cls(`${CLS_PREFIX}__header`, styles.panelHeader)}>
<Tooltip
title={title}
overlayClassName={cls(`${CLS_PREFIX}__tooltip`, styles.panelTooltip)}
zIndex={99999}
>
<div className={cls(`${CLS_PREFIX}__header__title`, styles.panelHeaderTitle)}>{title}</div>
</Tooltip>
<div className={cls(`${CLS_PREFIX}__header__title`, styles.panelHeaderTitle)}>{title}</div>
<CloseOutlined onClick={() => setCollapsed(0)} />
</div>
<Row style={{ padding: 14 }} className={cls(`${CLS_PREFIX}__content`, styles.panelContent)}>
Expand Down
23 changes: 23 additions & 0 deletions scripts/package-link.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash

cd ./packages/

cd ./li-sdk/
yarn link
cd ..

cd ./li-p2/
yarn link
cd ..

cd ./li-editor/
yarn link
cd ..

cd ./li-core-assets/
yarn link
cd ..

cd ./li-analysis-assets/
yarn link
cd ..
Loading