mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-01-18 21:38:14 +00:00
start work trunk
This commit is contained in:
parent
ccd916287f
commit
186f715e92
@ -1,28 +1,39 @@
|
|||||||
|
export enum DISPLAY_TYPE {
|
||||||
|
NONE = 'none',
|
||||||
|
PLAIN = 'plain',
|
||||||
|
INLINE = 'inline',
|
||||||
|
BLOCK = 'block',
|
||||||
|
ACCORDION = 'accordion',
|
||||||
|
TAB = 'tab',
|
||||||
|
ENTRY = 'entry',
|
||||||
|
}
|
||||||
|
|
||||||
export interface IPropConfig {
|
export interface IPropConfig {
|
||||||
/**
|
/**
|
||||||
* composite share the namespace
|
* composite share the namespace
|
||||||
* group just be tie up together
|
* group just be tie up together
|
||||||
*/
|
*/
|
||||||
type?: 'composite' | 'group';
|
type?: 'composite' | 'group'; // => composite as objectSetter
|
||||||
/**
|
/**
|
||||||
* when type is composite or group
|
* when type is composite or group
|
||||||
*/
|
*/
|
||||||
items?: IPropConfig[];
|
items?: IPropConfig[]; // => items
|
||||||
/**
|
/**
|
||||||
* property name: the field key in props of schema
|
* property name: the field key in props of schema
|
||||||
*/
|
*/
|
||||||
name: string;
|
name: string; // =>
|
||||||
title?: string;
|
title?: string; // =>
|
||||||
tip?: {
|
tip?: {
|
||||||
|
// =>
|
||||||
title?: string;
|
title?: string;
|
||||||
content?: string;
|
content?: string;
|
||||||
url?: string;
|
url?: string;
|
||||||
};
|
};
|
||||||
initialValue?: any;
|
initialValue?: any; // => ?
|
||||||
defaultValue?: any;
|
defaultValue?: any; // =>
|
||||||
display?: DISPLAY_TYPE;
|
display?: DISPLAY_TYPE; // => fieldExtraProps
|
||||||
fieldStyle?: DISPLAY_TYPE;
|
fieldStyle?: DISPLAY_TYPE; // => fieldExtraProps
|
||||||
setter?: ComponentClass | ISetterConfig[] | string | SetterGetter;
|
setter?: ComponentClass | ISetterConfig[] | string | SetterGetter; // =>
|
||||||
/**
|
/**
|
||||||
* if a prop is dynamicProp, every-time while rendering setting field
|
* if a prop is dynamicProp, every-time while rendering setting field
|
||||||
* - getValue() will not include value of getHotValue()
|
* - getValue() will not include value of getHotValue()
|
||||||
@ -31,61 +42,61 @@ export interface IPropConfig {
|
|||||||
* from node of current page
|
* from node of current page
|
||||||
*/
|
*/
|
||||||
isDynamicProp?: boolean;
|
isDynamicProp?: boolean;
|
||||||
supportVariable?: boolean;
|
supportVariable?: boolean; // => use MixinSetter
|
||||||
/**
|
/**
|
||||||
* the prop should be collapsed while display value is accordion
|
* the prop should be collapsed while display value is accordion
|
||||||
*/
|
*/
|
||||||
collapse?: boolean;
|
collapse?: boolean; // => extraProps.defaultCollapsed
|
||||||
/**
|
/**
|
||||||
* alias to collapse
|
* alias to collapse
|
||||||
*/
|
*/
|
||||||
collapsed?: boolean;
|
collapsed?: boolean; // => extraProps.defaultCollapsed
|
||||||
fieldCollapsed?: boolean;
|
fieldCollapsed?: boolean; // => extraProps.defaultCollapsed
|
||||||
/**
|
/**
|
||||||
* if a prop is declared as disabled, it will not be saved into
|
* if a prop is declared as disabled, it will not be saved into
|
||||||
* schema
|
* schema
|
||||||
*/
|
*/
|
||||||
disabled?: boolean | ReturnBooleanFunction;
|
disabled?: boolean | ReturnBooleanFunction; // => hide & virtual ? thinkof global transform
|
||||||
/**
|
/**
|
||||||
* will not export data to schema
|
* will not export data to schema
|
||||||
*/
|
*/
|
||||||
ignore?: boolean | ReturnBooleanFunction;
|
ignore?: boolean | ReturnBooleanFunction; // => ?virtualProp ? thinkof global transform
|
||||||
/**
|
/**
|
||||||
* if a prop is declared as virtual, it will not be saved in
|
* if a prop is declared as virtual, it will not be saved in
|
||||||
* schema props, instead it will be saved into context field
|
* schema props, instead it will be saved into context field
|
||||||
*/
|
*/
|
||||||
virtual?: boolean | ReturnBooleanFunction;
|
virtual?: boolean | ReturnBooleanFunction; // =>?virtualProp
|
||||||
hidden?: boolean | ReturnBooleanFunction;
|
hidden?: boolean | ReturnBooleanFunction; // => condition
|
||||||
/**
|
/**
|
||||||
* if a prop is a lifeCycle function
|
* if a prop is a lifeCycle function
|
||||||
*/
|
*/
|
||||||
lifeCycle?: boolean;
|
lifeCycle?: boolean; // =>?
|
||||||
destroy?: () => any;
|
destroy?: () => any; // => x
|
||||||
initial?(this: Prop, value: any, initialValue: any): any;
|
initial?(this: Prop, value: any, initialValue: any): any;
|
||||||
/**
|
/**
|
||||||
* when use getValue(), accessor shall be called as initializer
|
* when use getValue(), accessor shall be called as initializer
|
||||||
*/
|
*/
|
||||||
accessor?(this: Prop): any;
|
accessor?(this: Prop): any; // => getValue
|
||||||
/**
|
/**
|
||||||
* when current prop value mutate, the mutator function shall be called
|
* when current prop value mutate, the mutator function shall be called
|
||||||
*/
|
*/
|
||||||
mutator?(
|
mutator?( // => setValue
|
||||||
this: Prop,
|
this: Prop,
|
||||||
value: any,
|
value: any,
|
||||||
hotValue: any,
|
hotValue: any, // => x
|
||||||
preValue: any,
|
preValue: any, // => x
|
||||||
preHotValue: any,
|
preHotValue: any, // => x
|
||||||
): void;
|
): void;
|
||||||
/**
|
/**
|
||||||
* other values' change will trigger sync function here
|
* other values' change will trigger sync function here
|
||||||
*/
|
*/
|
||||||
sync?(this: Prop, value: any): void;
|
sync?(this: Prop, value: any): void; // => ? autorun
|
||||||
/**
|
/**
|
||||||
* transform runtime data between view and setter
|
* transform runtime data between view and setter
|
||||||
* @param toHotValue hot value for the setter
|
* @param toHotValue hot value for the setter
|
||||||
* @param toViewValue static value for the view
|
* @param toViewValue static value for the view
|
||||||
*/
|
*/
|
||||||
transformer?(
|
transformer?( // =>?
|
||||||
toHotValue: (data: any) => any,
|
toHotValue: (data: any) => any,
|
||||||
toViewValue: (str: string) => any,
|
toViewValue: (str: string) => any,
|
||||||
): any;
|
): any;
|
||||||
@ -93,10 +104,9 @@ export interface IPropConfig {
|
|||||||
* user click var to change current field to
|
* user click var to change current field to
|
||||||
* variable setting field
|
* variable setting field
|
||||||
*/
|
*/
|
||||||
useVariableChange?(data: { isUseVariable: boolean }): any;
|
useVariableChange?(data: { isUseVariable: boolean }): any; // => ?
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export interface SettingFieldConfig {
|
export interface SettingFieldConfig {
|
||||||
type?: 'field';
|
type?: 'field';
|
||||||
title?: string;
|
title?: string;
|
||||||
@ -116,16 +126,98 @@ export interface SettingGroupConfig {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 升级
|
||||||
|
*/
|
||||||
|
function upgradeMetadata(oldConfig: OldPrototypeConfig) {
|
||||||
|
const {
|
||||||
|
componentName,
|
||||||
|
docUrl,
|
||||||
|
title,
|
||||||
|
icon,
|
||||||
|
packageName,
|
||||||
|
category,
|
||||||
|
defaultProps,
|
||||||
|
extraActions,
|
||||||
|
view,
|
||||||
|
initialChildren,
|
||||||
|
configure,
|
||||||
|
snippets,
|
||||||
|
transducers,
|
||||||
|
reducers,
|
||||||
|
isContainer,
|
||||||
|
rectSelector,
|
||||||
|
isModal,
|
||||||
|
isFloating,
|
||||||
|
descriptor,
|
||||||
|
context,
|
||||||
|
hasSlot,
|
||||||
|
canOperating,
|
||||||
|
canDraging,
|
||||||
|
canDragging,
|
||||||
|
canSelecting,
|
||||||
|
canContain,
|
||||||
|
canDropTo,
|
||||||
|
canDropto,
|
||||||
|
canDropIn,
|
||||||
|
canDroping,
|
||||||
|
didDropOut,
|
||||||
|
didDropIn,
|
||||||
|
canResizing,
|
||||||
|
onResizeStart,
|
||||||
|
onResize,
|
||||||
|
onResizeEnd,
|
||||||
|
subtreeModified,
|
||||||
|
} = oldConfig;
|
||||||
|
|
||||||
export declare interface IComponentPrototypeConfigure {
|
|
||||||
|
const meta: any = {
|
||||||
|
componentName,
|
||||||
|
title,
|
||||||
|
icon,
|
||||||
|
docUrl,
|
||||||
|
devMode: 'procode',
|
||||||
|
}
|
||||||
|
|
||||||
|
if (category) {
|
||||||
|
meta.tags = [category];
|
||||||
|
}
|
||||||
|
if (packageName) {
|
||||||
|
meta.npm = {
|
||||||
|
componentName,
|
||||||
|
package: packageName,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
const component: any = {
|
||||||
|
isContainer,
|
||||||
|
rectSelector,
|
||||||
|
isModal,
|
||||||
|
isFloating,
|
||||||
|
descriptor,
|
||||||
|
};
|
||||||
|
|
||||||
|
if (canOperating === false) {
|
||||||
|
component.disableBehaviors = '*';
|
||||||
|
}
|
||||||
|
nestingRule
|
||||||
|
disableBehaviors
|
||||||
|
actions
|
||||||
|
const props = {};
|
||||||
|
const styles = {};
|
||||||
|
const events = {};
|
||||||
|
meta.configure = { props, component, styles, events };
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface OldPrototypeConfig {
|
||||||
packageName: string; // => npm.package
|
packageName: string; // => npm.package
|
||||||
uri?: string;
|
|
||||||
/**
|
/**
|
||||||
* category display in the component pane
|
* category display in the component pane
|
||||||
* component will be hidden while the value is: null
|
* component will be hidden while the value is: null
|
||||||
*/
|
*/
|
||||||
category: string; // => tags
|
category: string; // => tags
|
||||||
componentName: string;// =>
|
componentName: string; // =>
|
||||||
docUrl?: string; // =>
|
docUrl?: string; // =>
|
||||||
defaultProps?: any; // => ?
|
defaultProps?: any; // => ?
|
||||||
/**
|
/**
|
||||||
@ -150,12 +242,12 @@ export declare interface IComponentPrototypeConfigure {
|
|||||||
* @example '.classname > div'
|
* @example '.classname > div'
|
||||||
*/
|
*/
|
||||||
rectSelector?: string; // => configure.component.rectSelector
|
rectSelector?: string; // => configure.component.rectSelector
|
||||||
context?: { // => ?
|
context?: {
|
||||||
|
// => ?
|
||||||
[contextInfoName: string]: any;
|
[contextInfoName: string]: any;
|
||||||
};
|
};
|
||||||
|
|
||||||
isContainer?: boolean; // => configure.component.isContainer
|
isContainer?: boolean; // => configure.component.isContainer
|
||||||
isInline?: boolean; // x
|
|
||||||
isModal?: boolean; // => configure.component.isModal
|
isModal?: boolean; // => configure.component.isModal
|
||||||
isFloating?: boolean; // => configure.component.isFloating
|
isFloating?: boolean; // => configure.component.isFloating
|
||||||
descriptor?: string; // => configure.component.descriptor
|
descriptor?: string; // => configure.component.descriptor
|
||||||
@ -167,14 +259,11 @@ export declare interface IComponentPrototypeConfigure {
|
|||||||
hasSlot?: boolean; // => ?
|
hasSlot?: boolean; // => ?
|
||||||
|
|
||||||
// alias to canDragging
|
// alias to canDragging
|
||||||
canDraging?: boolean; // => ?
|
canDraging?: boolean; // => onDrag
|
||||||
canDragging?: boolean; // => ?
|
canDragging?: boolean; // => ?
|
||||||
|
|
||||||
canOperating?: boolean; // => disabledActions
|
canOperating?: boolean; // => disabledActions
|
||||||
canHovering?: boolean; // x
|
|
||||||
canSelecting?: boolean;
|
canSelecting?: boolean;
|
||||||
canUseCondition?: boolean; // x
|
|
||||||
canLoop?: boolean; // x
|
|
||||||
canContain?: (dragment: Node) => boolean; // => nestingRule
|
canContain?: (dragment: Node) => boolean; // => nestingRule
|
||||||
|
|
||||||
canDropTo?: ((container: Node) => boolean) | string | string[]; // => nestingRule
|
canDropTo?: ((container: Node) => boolean) | string | string[]; // => nestingRule
|
||||||
@ -187,34 +276,14 @@ export declare interface IComponentPrototypeConfigure {
|
|||||||
didDropIn?: (container: any | Prototype, dragment: any) => boolean; // => hooks
|
didDropIn?: (container: any | Prototype, dragment: any) => boolean; // => hooks
|
||||||
|
|
||||||
// => ?
|
// => ?
|
||||||
canResizing?:
|
canResizing?: ((dragment: Node, triggerDirection: string) => boolean) | boolean;
|
||||||
| ((dragment: Node, triggerDirection: string) => boolean)
|
onResizeStart?: (e: MouseEvent, triggerDirection: string, dragment: Node) => void;
|
||||||
| boolean;
|
onResize?: (e: MouseEvent, triggerDirection: string, dragment: Node, moveX: number, moveY: number) => void;
|
||||||
onResizeStart?: (
|
onResizeEnd?: (e: MouseEvent, triggerDirection: string, dragment: Node) => void;
|
||||||
e: MouseEvent,
|
|
||||||
triggerDirection: string,
|
|
||||||
dragment: Node,
|
|
||||||
) => void;
|
|
||||||
onResize?: (
|
|
||||||
e: MouseEvent,
|
|
||||||
triggerDirection: string,
|
|
||||||
dragment: Node,
|
|
||||||
moveX: number,
|
|
||||||
moveY: number,
|
|
||||||
) => void;
|
|
||||||
onResizeEnd?: (
|
|
||||||
e: MouseEvent,
|
|
||||||
triggerDirection: string,
|
|
||||||
dragment: Node,
|
|
||||||
) => void;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* when sub-node of the current node changed
|
* when sub-node of the current node changed
|
||||||
* including: sub-node insert / remove
|
* including: sub-node insert / remove
|
||||||
*/
|
*/
|
||||||
subtreeModified?(this: Node): any; // => ?
|
subtreeModified?(this: Node): any; // => ? hooks
|
||||||
}
|
|
||||||
|
|
||||||
export interface IComponentPrototypeExtraConfigs {
|
|
||||||
autoGenerated?: boolean;
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user