mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-03-05 17:57:13 +00:00
feat: 自动埋点
This commit is contained in:
parent
2787a12d83
commit
fecf34d0d7
@ -12,6 +12,7 @@ import InlineTip from './inlinetip';
|
|||||||
|
|
||||||
export interface FieldProps {
|
export interface FieldProps {
|
||||||
className?: string;
|
className?: string;
|
||||||
|
meta?: { package: string; componentName: string } | string;
|
||||||
title?: TitleContent | null;
|
title?: TitleContent | null;
|
||||||
defaultDisplay?: 'accordion' | 'inline' | 'block';
|
defaultDisplay?: 'accordion' | 'inline' | 'block';
|
||||||
collapsed?: boolean;
|
collapsed?: boolean;
|
||||||
@ -115,15 +116,23 @@ export class Field extends Component<FieldProps> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { className, children, title, valueState, onClear, name: propName, tip } = this.props;
|
const { className, children, meta, title, valueState, onClear, name: propName, tip } = this.props;
|
||||||
const { display, collapsed } = this.state;
|
const { display, collapsed } = this.state;
|
||||||
const isAccordion = display === 'accordion';
|
const isAccordion = display === 'accordion';
|
||||||
|
let hostName = '';
|
||||||
|
if (typeof meta === 'object') {
|
||||||
|
hostName = `${meta?.package || ''}-${meta.componentName || ''}`;
|
||||||
|
} else if (typeof meta === 'string') {
|
||||||
|
hostName = meta;
|
||||||
|
}
|
||||||
|
const id = `${hostName}-${propName || (title as any)['en-US'] || (title as any)['zh-CN']}`;
|
||||||
const tipContent = this.getTipContent(propName!, tip);
|
const tipContent = this.getTipContent(propName!, tip);
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className={classNames(`lc-field lc-${display}-field`, className, {
|
className={classNames(`lc-field lc-${display}-field`, className, {
|
||||||
'lc-field-is-collapsed': isAccordion && collapsed,
|
'lc-field-is-collapsed': isAccordion && collapsed,
|
||||||
})}
|
})}
|
||||||
|
id={id}
|
||||||
>
|
>
|
||||||
<div className="lc-field-head" onClick={isAccordion ? this.toggleExpand : undefined}>
|
<div className="lc-field-head" onClick={isAccordion ? this.toggleExpand : undefined}>
|
||||||
<div className="lc-field-title">
|
<div className="lc-field-title">
|
||||||
|
|||||||
@ -63,6 +63,7 @@ class SettingFieldView extends Component<{ field: SettingField }> {
|
|||||||
|
|
||||||
return createField(
|
return createField(
|
||||||
{
|
{
|
||||||
|
meta: field?.componentMeta?.npm || field?.componentMeta?.componentName || '',
|
||||||
title: field.title,
|
title: field.title,
|
||||||
collapsed: !field.expanded,
|
collapsed: !field.expanded,
|
||||||
valueState: field.isRequired ? 10 : field.valueState,
|
valueState: field.isRequired ? 10 : field.valueState,
|
||||||
@ -121,6 +122,7 @@ class SettingGroupView extends Component<{ field: SettingField }> {
|
|||||||
return (
|
return (
|
||||||
<Field
|
<Field
|
||||||
defaultDisplay="accordion"
|
defaultDisplay="accordion"
|
||||||
|
meta={field?.componentMeta?.npm || field?.componentMeta?.componentName || ''}
|
||||||
title={field.title}
|
title={field.title}
|
||||||
collapsed={!field.expanded}
|
collapsed={!field.expanded}
|
||||||
onExpandChange={(expandState) => {
|
onExpandChange={(expandState) => {
|
||||||
|
|||||||
@ -24,11 +24,12 @@ class Contents extends Component<{ area: Area }> {
|
|||||||
const { area } = this.props;
|
const { area } = this.props;
|
||||||
const top: any[] = [];
|
const top: any[] = [];
|
||||||
const bottom: any[] = [];
|
const bottom: any[] = [];
|
||||||
area.container.items.forEach(item => {
|
area.container.items.forEach((item) => {
|
||||||
|
const content = <div id={`left-area-${item.name}`}>{item.content}</div>;
|
||||||
if (item.align === 'bottom') {
|
if (item.align === 'bottom') {
|
||||||
bottom.push(item.content);
|
bottom.push(content);
|
||||||
} else {
|
} else {
|
||||||
top.push(item.content);
|
top.push(content);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return (
|
return (
|
||||||
|
|||||||
@ -30,7 +30,7 @@ class Contents extends Component<{ area: Area, itemClassName?: string }> {
|
|||||||
return index1 === index2 ? 0 : (index1 > index2 ? 1 : -1);
|
return index1 === index2 ? 0 : (index1 > index2 ? 1 : -1);
|
||||||
}).forEach(item => {
|
}).forEach(item => {
|
||||||
const content = (
|
const content = (
|
||||||
<div className={itemClassName || ''}>
|
<div className={itemClassName || ''} id={`top-area-${item.name}`}>
|
||||||
{item.content}
|
{item.content}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user