mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-04-20 04:18:05 +00:00
Merge branch 'preset-vision/0.9.0' of gitlab.alibaba-inc.com:ali-lowcode/ali-lowcode-engine into preset-vision/0.9.0
This commit is contained in:
commit
8edc2af7ea
@ -1,11 +0,0 @@
|
|||||||
/**
|
|
||||||
* 黄金令箭埋点
|
|
||||||
* @param {String} gmKey 为黄金令箭业务类型
|
|
||||||
* @param {Object} params 参数
|
|
||||||
* @param {String} logKey 属性串
|
|
||||||
*/
|
|
||||||
export function goldlog(gmKey: string, params: object = {}, logKey: string = 'other'): void {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@ -1,5 +1,5 @@
|
|||||||
export * from './get-public-path';
|
export * from './get-public-path';
|
||||||
export * from './goldlog';
|
export * from './monitor';
|
||||||
export * from './obx';
|
export * from './obx';
|
||||||
export * from './request';
|
export * from './request';
|
||||||
export * from './focus-tracker';
|
export * from './focus-tracker';
|
||||||
|
|||||||
45
packages/editor-core/src/utils/monitor.ts
Normal file
45
packages/editor-core/src/utils/monitor.ts
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
class Monitor {
|
||||||
|
fn = (params: any) => {
|
||||||
|
const { AES } = window as any;
|
||||||
|
if (typeof AES.log === 'function') {
|
||||||
|
const { p1, p2, p3, p4 = 'OTHER', ...rest } = params || {};
|
||||||
|
AES.log('event', {
|
||||||
|
p1,
|
||||||
|
p2,
|
||||||
|
p3,
|
||||||
|
p4,
|
||||||
|
...rest,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
(window as any).AES = (window as any).AES || {};
|
||||||
|
}
|
||||||
|
|
||||||
|
register(fn: () => any) {
|
||||||
|
if (typeof fn === 'function') {
|
||||||
|
this.fn = fn;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
log(params: any) {
|
||||||
|
if (typeof this.fn === 'function') {
|
||||||
|
this.fn(params);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
setConfig(key: string | object, value?: string): void {
|
||||||
|
const { AES } = window as any;
|
||||||
|
if (typeof AES?.setConfig !== 'function') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (typeof key === 'string' && value) {
|
||||||
|
AES.setConfig(key, value);
|
||||||
|
} else if (typeof key === 'object') {
|
||||||
|
AES.setConfig(key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default new Monitor();
|
||||||
@ -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