chore(amis-editor): Plugin增加ID静态属性, 支持注册时基于ID去重 (#7101)

This commit is contained in:
RUNZE LU 2023-06-15 12:48:28 +08:00 committed by GitHub
parent a4f877587c
commit f9fa66e526
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
145 changed files with 232 additions and 25 deletions

View File

@ -2,8 +2,12 @@
* @file 西 compoennt/Editor.tsx
* UI 西
*/
import uniqBy from 'lodash/uniqBy';
import {reaction} from 'mobx';
import {parse, stringify} from 'json-ast-comments';
import debounce from 'lodash/debounce';
import findIndex from 'lodash/findIndex';
import omit from 'lodash/omit';
import {openContextMenus, toast, alert, DataScope, DataSchema} from 'amis';
import {getRenderers, RenderOptions, mapTree} from 'amis-core';
import {
PluginInterface,
@ -31,14 +35,14 @@ import {
DeleteEventContext,
RendererPluginEvent,
PluginEvents,
PluginActions
PluginActions,
BasePlugin
} from './plugin';
import {
EditorStoreType,
PopOverFormContext,
SubEditorContext
} from './store/editor';
import {
autobind,
camelize,
@ -49,29 +53,18 @@ import {
isString,
isObject,
isLayoutPlugin,
JSONPipeOut,
generateNodeId,
JSONTraverse
JSONPipeOut
} from './util';
import {reaction} from 'mobx';
import {hackIn, makeSchemaFormRender, makeWrapper} from './component/factory';
import {env} from './env';
import debounce from 'lodash/debounce';
import sortBy from 'lodash/sortBy';
import reverse from 'lodash/reverse';
import cloneDeep from 'lodash/cloneDeep';
import {openContextMenus, toast, alert, DataScope, DataSchema} from 'amis';
import {parse, stringify} from 'json-ast-comments';
import {EditorNodeType} from './store/node';
import {EditorProps} from './component/Editor';
import findIndex from 'lodash/findIndex';
import {EditorDNDManager} from './dnd';
import {VariableManager} from './variable';
import {IScopedContext} from 'amis';
import type {IScopedContext} from 'amis';
import type {SchemaObject, SchemaCollection} from 'amis';
import type {RendererConfig} from 'amis-core';
import isPlainObject from 'lodash/isPlainObject';
import {omit} from 'lodash';
export interface EditorManagerConfig
extends Omit<EditorProps, 'value' | 'onChange'> {}
@ -79,6 +72,8 @@ export interface EditorManagerConfig
export interface PluginClass {
new (manager: EditorManager, options?: any): PluginInterface;
id?: string;
/** 优先级值为整数当存在两个ID相同的Plugin时数字更大的优先级更高 */
priority?: number;
scene?: Array<string>;
}
@ -111,22 +106,58 @@ export function registerEditorPlugin(klass: PluginClass) {
// 处理插件身上的场景信息
const scene = Array.from(new Set(['global'].concat(klass.scene || 'global')));
klass.scene = scene;
let isExitPlugin: any = null;
let exsitedPluginIdx: any = null;
if (klass.prototype && klass.prototype.isNpmCustomWidget) {
isExitPlugin = builtInPlugins.find(item =>
exsitedPluginIdx = builtInPlugins.findIndex(item =>
Array.isArray(item)
? item[0].prototype.name === klass.prototype.name
: item.prototype.name === klass.prototype.name
);
} else {
// 待进一步优化
isExitPlugin = builtInPlugins.find(item => item === klass);
exsitedPluginIdx = builtInPlugins.findIndex(item => item === klass);
}
if (!isExitPlugin) {
/** 先给新加入的plugin加一个ID */
if (!~exsitedPluginIdx) {
klass.id = klass.id || klass.name || guid();
builtInPlugins.push(klass);
}
/** 因为class的继承关系未设置ID的子class会和父class共用ID, 只有设置了priority的时候才会执行同ID去重 */
if (klass.priority == null || !Number.isInteger(klass.priority)) {
if (!~exsitedPluginIdx) {
builtInPlugins.push(klass);
} else {
console.warn(`注册插件「${klass.id}」异常,已存在同名插件:`, klass);
}
} else {
console.warn(`注册插件异常,已存在同名插件:`, klass);
exsitedPluginIdx = ~exsitedPluginIdx
? exsitedPluginIdx
: builtInPlugins.findIndex(
item =>
!Array.isArray(item) &&
item.id === klass.id &&
item?.prototype instanceof BasePlugin
);
if (!~exsitedPluginIdx) {
builtInPlugins.push(klass);
} else {
const current = builtInPlugins[exsitedPluginIdx] as PluginClass;
/** 同ID的插件根据优先级决定是否update */
const currentPriority =
current.priority && Number.isInteger(current.priority)
? current.priority
: 0;
if (klass.priority > currentPriority) {
builtInPlugins.splice(exsitedPluginIdx, 1, klass);
} else {
console.warn(`注册插件「${klass.id}」异常,已存在同名插件:`, klass);
}
}
}
}
@ -199,7 +230,39 @@ export class EditorManager {
this.hackIn = parent?.hackIn || hackIn;
// 自动加载预先注册的自定义组件
autoPreRegisterEditorCustomPlugins();
const scene = config.scene || 'global';
/** 在顶层对外部注册的Plugin和builtInPlugins合并去重 */
if (!parent?.plugins) {
(config?.plugins || []).forEach(external => {
if (
Array.isArray(external) ||
!external.priority ||
!Number.isInteger(external.priority)
) {
return;
}
const idx = builtInPlugins.findIndex(
builtIn =>
!Array.isArray(builtIn) &&
!Array.isArray(external) &&
builtIn.id === external.id &&
builtIn?.prototype instanceof BasePlugin
);
if (~idx) {
const current = builtInPlugins[idx] as PluginClass;
const currentPriority =
current.priority && Number.isInteger(current.priority)
? current.priority
: 0;
/** 同ID Plugin根据优先级决定是否替换掉Builtin中的Plugin */
if (external.priority > currentPriority) {
builtInPlugins.splice(idx, 1);
}
}
});
}
this.plugins =
parent?.plugins ||
(config.disableBultinPlugin ? [] : builtInPlugins) // 页面设计器注册的插件列表

View File

@ -5,6 +5,7 @@ import {getSchemaTpl} from 'amis-editor-core';
import type {SchemaObject} from 'amis';
export class AlertPlugin extends BasePlugin {
static id = 'AlertPlugin';
static scene = ['layout'];
// 关联渲染器名字

View File

@ -11,6 +11,7 @@ import {registerFilter} from 'amis-formula';
registerFilter('appTranslate', (input: any) => translateSchema(input));
export class AnchorNavPlugin extends BasePlugin {
static id = 'AnchorNavPlugin';
// 关联渲染器名字
rendererName = 'anchor-nav';
$schema = '/schemas/AnchorNavSchema.json';

View File

@ -3,6 +3,7 @@ import {BaseEventContext, BasePlugin} from 'amis-editor-core';
import {defaultValue, getSchemaTpl} from 'amis-editor-core';
export class AudioPlugin extends BasePlugin {
static id = 'AudioPlugin';
static scene = ['layout'];
// 关联渲染器名字
rendererName = 'audio';

View File

@ -13,6 +13,7 @@ const widthOrheightPipeIn = (curValue: string, rest: any) =>
curValue ? curValue : rest.data?.size ?? DefaultSize;
export class AvatarPlugin extends BasePlugin {
static id = 'AvatarPlugin';
static scene = ['layout'];
// 关联渲染器名字
rendererName = 'avatar';

View File

@ -6,6 +6,7 @@ import {BaseEventContext, BasePlugin} from 'amis-editor-core';
import {getSchemaTpl} from 'amis-editor-core';
export class BreadcrumbPlugin extends BasePlugin {
static id = 'BreadcrumbPlugin';
// 关联渲染器名字
rendererName = 'breadcrumb';
$schema = '/schemas/BreadcrumbSchema.json';

View File

@ -15,6 +15,7 @@ import type {SchemaObject} from 'amis';
import {getOldActionSchema} from '../renderer/event-control/helper';
export class ButtonPlugin extends BasePlugin {
static id = 'ButtonPlugin';
static scene = ['layout'];
// 关联渲染器名字
rendererName = 'button';

View File

@ -11,6 +11,7 @@ import {
import {BUTTON_DEFAULT_ACTION} from '../component/BaseControl';
export class ButtonGroupPlugin extends BasePlugin {
static id = 'ButtonGroupPlugin';
static scene = ['layout'];
// 关联渲染器名字
rendererName = 'button-group';

View File

@ -56,6 +56,7 @@ const viewTypeToEditType = (type: string) => {
};
export class CRUDPlugin extends BasePlugin {
static id = 'CRUDPlugin';
// 关联渲染器名字
rendererName = 'crud';
$schema = '/schemas/CRUDSchema.json';

View File

@ -477,6 +477,7 @@ const DataOperators: Array<FeatOption> = [
];
export class CRUDPlugin extends BasePlugin {
static id = 'CRUD2Plugin';
constructor(manager: EditorManager) {
super(manager);
this.dsBuilderMgr = new DSBuilderManager('crud2', 'api');

View File

@ -18,6 +18,7 @@ import flatten from 'lodash/flatten';
import {VRenderer} from 'amis-editor-core';
export class CardPlugin extends BasePlugin {
static id = 'CardPlugin';
static scene = ['layout'];
// 关联渲染器名字
rendererName = 'card';

View File

@ -9,6 +9,7 @@ import {
} from 'amis-editor-core';
export class Card2Plugin extends BasePlugin {
static id = 'Card2Plugin';
static scene = ['layout'];
// 关联渲染器名字
rendererName = 'card2';

View File

@ -19,6 +19,7 @@ import {diff, JSONPipeOut, repeatArray} from 'amis-editor-core';
import {resolveArrayDatasource} from '../util';
export class CardsPlugin extends BasePlugin {
static id = 'CardsPlugin';
static scene = ['layout'];
// 关联渲染器名字
rendererName = 'cards';

View File

@ -4,6 +4,7 @@ import {defaultValue, getSchemaTpl} from 'amis-editor-core';
import {mockValue} from 'amis-editor-core';
export class CarouselPlugin extends BasePlugin {
static id = 'CarouselPlugin';
// 关联渲染器名字
rendererName = 'carousel';
$schema = '/schemas/CarouselSchema.json';

View File

@ -70,6 +70,7 @@ const DEFAULT_EVENT_PARAMS = [
];
export class ChartPlugin extends BasePlugin {
static id = 'ChartPlugin';
// 关联渲染器名字
rendererName = 'chart';
$schema = '/schemas/ChartSchema.json';

View File

@ -6,6 +6,7 @@ import {BaseEventContext, BasePlugin} from 'amis-editor-core';
import {getSchemaTpl} from 'amis-editor-core';
export class CodeViewPlugin extends BasePlugin {
static id = 'CodeViewPlugin';
// 关联渲染器名字
rendererName = 'code';
$schema = '/schemas/CodeSchema.json';

View File

@ -3,6 +3,7 @@ import {BasePlugin, RegionConfig, BaseEventContext} from 'amis-editor-core';
import {defaultValue, getSchemaTpl} from 'amis-editor-core';
export class CollapsePlugin extends BasePlugin {
static id = 'CollapsePlugin';
// 关联渲染器名字
rendererName = 'collapse';
$schema = '/schemas/CollapseSchema.json';

View File

@ -6,6 +6,7 @@ import {tipedLabel} from 'amis-editor-core';
import {isObject} from 'amis-editor-core';
export class CollapseGroupPlugin extends BasePlugin {
static id = 'CollapseGroupPlugin';
// 关联渲染器名字
rendererName = 'collapse-group';
$schema = '/schemas/CollapseGroupSchema.json';

View File

@ -9,6 +9,7 @@ import {
} from 'amis-editor-core';
export class ColumnToggler extends BasePlugin {
static id = 'ColumnToggler';
// 关联渲染器名字
rendererName = 'column-toggler';
$schema = '/schemas/ColumnToggler.json';

View File

@ -11,6 +11,7 @@ import {
} from 'amis-editor-core';
export class ContainerPlugin extends LayoutBasePlugin {
static id = 'ContainerPlugin';
static scene = ['layout'];
// 关联渲染器名字
rendererName = 'container';

View File

@ -12,6 +12,7 @@ import {
import {getSchemaTpl} from 'amis-editor-core';
export class CustomPlugin extends BasePlugin {
static id = 'CustomPlugin';
// 关联渲染器名字
rendererName = 'custom';
$schema = '/schemas/CustomSchema.json';

View File

@ -15,6 +15,7 @@ import {defaultValue, getSchemaTpl} from 'amis-editor-core';
import isArray from 'lodash/isArray';
export class CustomPlugin extends BasePlugin {
static id = 'CustomRegionPlugin';
// 关联渲染器名字
rendererName = 'custom';
$schema = '/schemas/CustomSchema.json';

View File

@ -31,6 +31,7 @@ const valueDateFormatOptions = [
}
];
export class DatePlugin extends BasePlugin {
static id = 'DatePlugin';
static scene = ['layout'];
// 关联渲染器名字
rendererName = 'date';

View File

@ -32,6 +32,7 @@ const valueDateFormatOptions = [
}
];
export class DatetimePlugin extends DatePlugin {
static id = 'DatetimePlugin';
static scene = ['layout'];
// 关联渲染器名字
rendererName = 'datetime';

View File

@ -13,6 +13,7 @@ import {
import {getEventControlConfig} from '../renderer/event-control/helper';
export class DialogPlugin extends BasePlugin {
static id = 'DialogPlugin';
// 关联渲染器名字
rendererName = 'dialog';
$schema = '/schemas/DialogSchema.json';

View File

@ -3,6 +3,7 @@ import {BasePlugin} from 'amis-editor-core';
import {getSchemaTpl} from 'amis-editor-core';
export class DividerPlugin extends BasePlugin {
static id = 'DividerPlugin';
static scene = ['layout'];
// 关联渲染器名字
rendererName = 'divider';

View File

@ -13,6 +13,7 @@ import {InlineModal} from './Dialog';
import {tipedLabel} from 'amis-editor-core';
export class DrawerPlugin extends BasePlugin {
static id = 'DrawerPlugin';
// 关联渲染器名字
rendererName = 'drawer';
$schema = '/schemas/DrawerSchema.json';

View File

@ -14,6 +14,7 @@ import {
} from 'amis-editor-core';
import {BUTTON_DEFAULT_ACTION} from '../component/BaseControl';
export class DropDownButtonPlugin extends BasePlugin {
static id = 'DropDownButtonPlugin';
static scene = ['layout'];
// 关联渲染器名字
rendererName = 'dropdown-button';

View File

@ -12,6 +12,7 @@ import {defaultValue, getSchemaTpl} from 'amis-editor-core';
import {diff, JSONPipeOut} from 'amis-editor-core';
export class EachPlugin extends BasePlugin {
static id = 'EachPlugin';
static scene = ['layout'];
// 关联渲染器名字
rendererName = 'each';

View File

@ -5,6 +5,7 @@ import {registerEditorPlugin} from 'amis-editor-core';
import {FlexPluginBase} from './Layout/FlexPluginBase';
export class FlexPlugin extends FlexPluginBase {
static id = 'FlexPlugin';
static scene = ['layout'];
name = 'Flex 布局';
pluginIcon = 'flex-container-plugin';

View File

@ -10,6 +10,7 @@ import {getSchemaTpl, defaultValue} from 'amis-editor-core';
import {getEventControlConfig} from '../../renderer/event-control/helper';
export class ButtonGroupControlPlugin extends BasePlugin {
static id = 'ButtonGroupControlPlugin';
// 关联渲染器名字
rendererName = 'button-group-select';
$schema = '/schemas/ButtonGroupControlSchema.json';

View File

@ -8,6 +8,7 @@ import {
} from '../../component/BaseControl';
export class ButtonToolbarControlPlugin extends BasePlugin {
static id = 'ButtonToolbarControlPlugin';
static scene = ['layout'];
// 关联渲染器名字
rendererName = 'button-toolbar';

View File

@ -15,6 +15,7 @@ import {ValidatorTag} from '../../validator';
import {getEventControlConfig} from '../../renderer/event-control/helper';
export class ChainedSelectControlPlugin extends BasePlugin {
static id = 'ChainedSelectControlPlugin';
// 关联渲染器名字
rendererName = 'chained-select';
$schema = '/schemas/ChainedSelectControlSchema.json';

View File

@ -23,6 +23,7 @@ setSchemaTpl('option', {
label: tipedLabel('说明', '选项说明')
});
export class CheckboxControlPlugin extends BasePlugin {
static id = 'CheckboxControlPlugin';
static scene = ['layout'];
// 关联渲染器名字
rendererName = 'checkbox';

View File

@ -18,6 +18,7 @@ import {RendererPluginAction, RendererPluginEvent} from 'amis-editor-core';
import {getEventControlConfig} from '../../renderer/event-control/helper';
export class CheckboxesControlPlugin extends BasePlugin {
static id = 'CheckboxesControlPlugin';
// 关联渲染器名字
rendererName = 'checkboxes';
$schema = '/schemas/CheckboxesControlSchema.json';

View File

@ -9,6 +9,7 @@ import {RendererPluginEvent, RendererPluginAction} from 'amis-editor-core';
import {getEventControlConfig} from '../../renderer/event-control/helper';
export class CodeEditorControlPlugin extends BasePlugin {
static id = 'CodeEditorControlPlugin';
// 关联渲染器名字
rendererName = 'editor';
$schema = '/schemas/EditorControlSchema.json';

View File

@ -23,6 +23,7 @@ import {
} from '../../renderer/event-control/helper';
export class ComboControlPlugin extends BasePlugin {
static id = 'ComboControlPlugin';
// 关联渲染器名字
rendererName = 'combo';
$schema = '/schemas/ComboControlSchema.json';

View File

@ -16,6 +16,7 @@ import defaultConfig, {
} from 'amis-ui/lib/components/condition-builder/config';
export class ConditionBilderPlugin extends BasePlugin {
static id = 'ConditionBilderPlugin';
// 关联渲染器名字
rendererName = 'condition-builder';
$schema = '/schemas/ConditionBuilderControlSchema.json';

View File

@ -6,6 +6,7 @@ import {BasePlugin, RegionConfig, BaseEventContext} from 'amis-editor-core';
import {formItemControl} from '../../component/BaseControl';
export class ControlPlugin extends BasePlugin {
static id = 'ControlPlugin';
// 关联渲染器名字
rendererName = 'control';
$schema = '/schemas/FormControlSchema.json';

View File

@ -14,6 +14,7 @@ import {getEventControlConfig} from '../../renderer/event-control/helper';
import {RendererPluginEvent, RendererPluginAction} from 'amis-editor-core';
export class DiffEditorControlPlugin extends BasePlugin {
static id = 'DiffEditorControlPlugin';
// 关联渲染器名字
rendererName = 'diff-editor';
$schema = '/schemas/DiffEditorControlSchema.json';

View File

@ -5,6 +5,7 @@ import {registerEditorPlugin} from 'amis-editor-core';
import {BaseEventContext, BasePlugin, RegionConfig} from 'amis-editor-core';
export class FieldSetControlPlugin extends BasePlugin {
static id = 'FieldSetControlPlugin';
// 关联渲染器名字
rendererName = 'fieldset';
$schema = '/schemas/FieldSetControlSchema.json';

View File

@ -124,6 +124,7 @@ const autoAddOptions = (values: any) => {
};
export class FormPlugin extends BasePlugin {
static id = 'FormPlugin';
// 关联渲染器名字
rendererName = 'form';
$schema = '/schemas/FormSchema.json';

View File

@ -3,6 +3,7 @@ import {registerEditorPlugin} from 'amis-editor-core';
import {BasePlugin} from 'amis-editor-core';
export class FormulaControlPlugin extends BasePlugin {
static id = 'FormulaControlPlugin';
// 关联渲染器名字
rendererName = 'formula';
$schema = '/schemas/FormulaControlSchema.json';

View File

@ -11,6 +11,7 @@ import {defaultValue, getSchemaTpl} from 'amis-editor-core';
import {JSONPipeIn, JSONUpdate, makeHorizontalDeeper} from 'amis-editor-core';
export class GroupControlPlugin extends BasePlugin {
static id = 'GroupControlPlugin';
// 关联渲染器名字
rendererName = 'group';
$schema = '/schemas/GroupControlSchema.json';

View File

@ -3,6 +3,7 @@ import {registerEditorPlugin} from 'amis-editor-core';
import {BasePlugin, getSchemaTpl} from 'amis-editor-core';
export class HiddenControlPlugin extends BasePlugin {
static id = 'HiddenControlPlugin';
// 关联渲染器名字
rendererName = 'hidden';
$schema = '/schemas/HiddenControlSchema.json';

View File

@ -15,6 +15,7 @@ import React from 'react';
import {diff, JSONPipeOut} from 'amis-editor-core';
export class ArrayControlPlugin extends BasePlugin {
static id = 'ArrayControlPlugin';
// 关联渲染器名字
rendererName = 'input-array';
$schema = '/schemas/ArrayControlSchema.json';

View File

@ -15,6 +15,7 @@ import {ValidatorTag} from '../../validator';
import {getEventControlConfig} from '../../renderer/event-control/helper';
export class CityControlPlugin extends BasePlugin {
static id = 'CityControlPlugin';
static scene = ['layout'];
// 关联渲染器名字
rendererName = 'input-city';

View File

@ -55,6 +55,7 @@ const presetColorsByFormat = colorFormat.reduce<{
return res;
}, {});
export class ColorControlPlugin extends BasePlugin {
static id = 'ColorControlPlugin';
static scene = ['layout'];
// 关联渲染器名字
rendererName = 'input-color';

View File

@ -140,6 +140,7 @@ const dateTooltip =
'支持例如: <code>now、+3days、-2weeks、+1hour、+2years</code> 等minute|min|hour|day|week|month|year|weekday|second|millisecond这种相对值用法';
export class DateControlPlugin extends BasePlugin {
static id = 'DateControlPlugin';
// 关联渲染器名字
rendererName = 'input-date';
$schema = '/schemas/DateControlSchema.json';

View File

@ -181,6 +181,7 @@ const sizeImmutableComponents = Object.values(DateType)
.filter(a => a);
export class DateRangeControlPlugin extends BasePlugin {
static id = 'DateRangeControlPlugin';
// 关联渲染器名字
rendererName = 'input-date-range';
$schema = '/schemas/DateRangeControlSchema.json';

View File

@ -3,6 +3,7 @@ import {registerEditorPlugin} from 'amis-editor-core';
import {DateControlPlugin} from './InputDate';
export class DateTimeControlPlugin extends DateControlPlugin {
static id = 'DateTimeControlPlugin';
// 关联渲染器名字
rendererName = 'input-datetime';
$schema = '/schemas/DateTimeControlSchema.json';

View File

@ -3,6 +3,7 @@ import {registerEditorPlugin} from 'amis-editor-core';
import {DateRangeControlPlugin} from './InputDateRange';
export class DateTimeRangeControlPlugin extends DateRangeControlPlugin {
static id = 'DateTimeRangeControlPlugin';
// 关联渲染器名字
rendererName = 'input-datetime-range';
$schema = '/schemas/DateTimeRangeControlSchema.json';

View File

@ -2,6 +2,7 @@ import {registerEditorPlugin} from 'amis-editor-core';
import {TextControlPlugin} from './InputText';
export class EmailControlPlugin extends TextControlPlugin {
static id = 'EmailControlPlugin';
// 关联渲染器名字
rendererName = 'input-email';
$schema = '/schemas/TextControlSchema.json';

View File

@ -14,6 +14,7 @@ import {formItemControl} from '../../component/BaseControl';
import {RendererPluginAction, RendererPluginEvent} from 'amis-editor-core';
export class ExcelControlPlugin extends BasePlugin {
static id = 'ExcelControlPlugin';
// 关联渲染器名字
rendererName = 'input-excel';
$schema = '/schemas/ExcelControlSchema.json';

View File

@ -6,6 +6,7 @@ import {getEventControlConfig} from '../../renderer/event-control/helper';
import {RendererPluginAction, RendererPluginEvent} from 'amis-editor-core';
export class FileControlPlugin extends BasePlugin {
static id = 'FileControlPlugin';
// 关联渲染器名字
rendererName = 'input-file';
$schema = '/schemas/FileControlSchema.json';

View File

@ -10,6 +10,7 @@ import {
import {ValidatorTag} from '../../validator';
export class InputGroupControlPlugin extends BasePlugin {
static id = 'InputGroupControlPlugin';
static scene = ['layout'];
// 关联渲染器名字
rendererName = 'input-group';

View File

@ -48,6 +48,7 @@ const inputStateFunc = (visibleOn: string, state: string) => {
};
export class ImageControlPlugin extends BasePlugin {
static id = 'ImageControlPlugin';
// 关联渲染器名字
rendererName = 'input-image';
$schema = '/schemas/ImageControlSchema.json';

View File

@ -12,6 +12,7 @@ import {
} from 'amis-editor-core';
export class KVControlPlugin extends BasePlugin {
static id = 'KVControlPlugin';
static scene = ['layout'];
// 关联渲染器名字
rendererName = 'input-kv';

View File

@ -3,6 +3,7 @@ import {registerEditorPlugin} from 'amis-editor-core';
import {DateControlPlugin} from './InputDate';
export class MonthControlPlugin extends DateControlPlugin {
static id = 'MonthControlPlugin';
// 关联渲染器名字
rendererName = 'input-month';
$schema = '/schemas/MonthControlSchema.json';

View File

@ -3,6 +3,7 @@ import {registerEditorPlugin} from 'amis-editor-core';
import {DateRangeControlPlugin} from './InputDateRange';
export class MonthRangeControlPlugin extends DateRangeControlPlugin {
static id = 'MonthRangeControlPlugin';
// 关联渲染器名字
rendererName = 'input-month-range';
$schema = '/schemas/MonthRangeControlSchema.json';

View File

@ -20,6 +20,7 @@ import {getEventControlConfig} from '../../renderer/event-control/helper';
import {inputStateTpl} from '../../renderer/style-control/helper';
export class NumberControlPlugin extends BasePlugin {
static id = 'NumberControlPlugin';
// 关联渲染器名字
rendererName = 'input-number';
$schema = '/schemas/NumberControlSchema.json';

View File

@ -2,6 +2,7 @@ import {registerEditorPlugin} from 'amis-editor-core';
import {TextControlPlugin} from './InputText';
export class PasswordControlPlugin extends TextControlPlugin {
static id = 'PasswordControlPlugin';
// 关联渲染器名字
rendererName = 'input-password';
$schema = '/schemas/TextControlSchema.json';

View File

@ -3,6 +3,7 @@ import {registerEditorPlugin} from 'amis-editor-core';
import {DateControlPlugin} from './InputDate';
export class InputQuarterPlugin extends DateControlPlugin {
static id = 'InputQuarterPlugin';
// 关联渲染器名字
rendererName = 'input-quarter';
$schema = '/schemas/QuarterControlSchema.json';

View File

@ -3,6 +3,7 @@ import {registerEditorPlugin} from 'amis-editor-core';
import {DateRangeControlPlugin} from './InputDateRange';
export class QuarterRangePlugin extends DateRangeControlPlugin {
static id = 'QuarterRangePlugin';
// 关联渲染器名字
rendererName = 'input-quarter-range';
$schema = '/schemas/MonthRangeControlSchema.json';

View File

@ -6,6 +6,7 @@ import {ValidatorTag} from '../../validator';
import {getEventControlConfig} from '../../renderer/event-control/helper';
export class RangeControlPlugin extends BasePlugin {
static id = 'RangeControlPlugin';
// 关联渲染器名字
rendererName = 'input-range';
$schema = '/schemas/RangeControlSchema.json';

View File

@ -12,6 +12,7 @@ import {getEventControlConfig} from '../../renderer/event-control/helper';
import {RendererPluginAction, RendererPluginEvent} from 'amis-editor-core';
export class RateControlPlugin extends BasePlugin {
static id = 'RateControlPlugin';
// 关联渲染器名字
rendererName = 'input-rating';
$schema = '/schemas/RatingControlSchema.json';

View File

@ -3,6 +3,7 @@ import {registerEditorPlugin} from 'amis-editor-core';
import {BasePlugin} from 'amis-editor-core';
export class RepeatControlPlugin extends BasePlugin {
static id = 'RepeatControlPlugin';
// 关联渲染器名字
rendererName = 'input-repeat';
$schema = '/schemas/RepeatControlSchema.json';

View File

@ -150,6 +150,7 @@ const froalaOptionsPipeOut = (arr: Array<string>) => {
};
export class RichTextControlPlugin extends BasePlugin {
static id = 'RichTextControlPlugin';
// 关联渲染器名字
rendererName = 'input-rich-text';
$schema = '/schemas/RichTextControlSchema.json';

View File

@ -14,6 +14,7 @@ import {
} from 'amis-editor-core';
export class SubFormControlPlugin extends BasePlugin {
static id = 'SubFormControlPlugin';
// 关联渲染器名字
rendererName = 'input-sub-form';
$schema = '/schemas/SubFormControlSchema.json';

View File

@ -28,6 +28,7 @@ import cloneDeep from 'lodash/cloneDeep';
import {resolveArrayDatasource} from '../../util';
export class TableControlPlugin extends BasePlugin {
static id = 'TableControlPlugin';
// 关联渲染器名字
rendererName = 'input-table';
$schema = '/schemas/TableControlSchema.json';

View File

@ -12,6 +12,7 @@ import {formItemControl} from '../../component/BaseControl';
import {RendererPluginAction, RendererPluginEvent} from 'amis-editor-core';
export class TagControlPlugin extends BasePlugin {
static id = 'TagControlPlugin';
static scene = ['layout'];
// 关联渲染器名字
rendererName = 'input-tag';

View File

@ -20,6 +20,7 @@ function isTextShow(value: string, name: boolean): boolean {
}
export class TextControlPlugin extends BasePlugin {
static id = 'TextControlPlugin';
static scene = ['layout'];
// 关联渲染器名字
rendererName = 'input-text';

View File

@ -2,6 +2,7 @@ import {registerEditorPlugin} from 'amis-editor-core';
import {DateControlPlugin} from './InputDate';
export class TimeControlPlugin extends DateControlPlugin {
static id = 'TimeControlPlugin';
// 关联渲染器名字
rendererName = 'input-time';
$schema = '/schemas/TimeControlSchema.json';

View File

@ -3,6 +3,7 @@ import {registerEditorPlugin} from 'amis-editor-core';
import {DateRangeControlPlugin} from './InputDateRange';
export class TimeRangeControlPlugin extends DateRangeControlPlugin {
static id = 'TimeRangeControlPlugin';
// 关联渲染器名字
rendererName = 'input-time-range';
$schema = '/schemas/DateRangeControlSchema.json';

View File

@ -16,6 +16,7 @@ import {tipedLabel} from 'amis-editor-core';
import {ValidatorTag} from '../../validator';
export class TreeControlPlugin extends BasePlugin {
static id = 'TreeControlPlugin';
// 关联渲染器名字
rendererName = 'input-tree';
$schema = '/schemas/TreeControlSchema.json';

View File

@ -2,6 +2,7 @@ import {registerEditorPlugin} from 'amis-editor-core';
import {TextControlPlugin} from './InputText';
export class URLControlPlugin extends TextControlPlugin {
static id = 'URLControlPlugin';
// 关联渲染器名字
rendererName = 'input-url';
$schema = '/schemas/TextControlSchema.json';

View File

@ -3,6 +3,7 @@ import {registerEditorPlugin} from 'amis-editor-core';
import {DateControlPlugin} from './InputDate';
export class YearControlPlugin extends DateControlPlugin {
static id = 'YearControlPlugin';
// 关联渲染器名字
rendererName = 'input-year';
$schema = '/schemas/YearControlSchema.json';

View File

@ -3,6 +3,7 @@ import {registerEditorPlugin} from 'amis-editor-core';
import {DateRangeControlPlugin} from './InputDateRange';
export class YearRangeControlPlugin extends DateRangeControlPlugin {
static id = 'YearRangeControlPlugin';
// 关联渲染器名字
rendererName = 'input-year-range';
$schema = '/schemas/DateRangeControlSchema.json';

View File

@ -18,6 +18,7 @@ import {JSONDelete, JSONPipeIn, JSONUpdate} from 'amis-editor-core';
import {SUPPORT_STATIC_FORMITEM_CMPTS} from '../../renderer/event-control/helper';
export class ItemPlugin extends BasePlugin {
static id = 'ItemPlugin';
// panelTitle = '表单项通配';
panelTitle = '表单项';
order = -990;

View File

@ -6,6 +6,7 @@ import {formItemControl} from '../../component/BaseControl';
import {RendererPluginAction, RendererPluginEvent} from 'amis-editor-core';
export class ListControlPlugin extends BasePlugin {
static id = 'ListControlPlugin';
// 关联渲染器名字
rendererName = 'list-select';
$schema = '/schemas/ListControlSchema.json';

View File

@ -4,6 +4,7 @@ import {BasePlugin, BaseEventContext} from 'amis-editor-core';
import {ValidatorTag} from '../../validator';
export class LocationControlPlugin extends BasePlugin {
static id = 'LocationControlPlugin';
// 关联渲染器名字
rendererName = 'location-picker';
$schema = '/schemas/LocationControlSchema.json';

View File

@ -13,6 +13,7 @@ import {getEventControlConfig} from '../../renderer/event-control/helper';
import {RendererPluginAction, RendererPluginEvent} from 'amis-editor-core';
export class MatrixControlPlugin extends BasePlugin {
static id = 'MatrixControlPlugin';
// 关联渲染器名字
rendererName = 'matrix-checkboxes';
$schema = '/schemas/MatrixControlSchema.json';

View File

@ -6,6 +6,7 @@ import {ValidatorTag} from '../../validator';
import {getEventControlConfig} from '../../renderer/event-control/helper';
export class NestedSelectControlPlugin extends BasePlugin {
static id = 'NestedSelectControlPlugin';
// 关联渲染器名字
rendererName = 'nested-select';
$schema = '/schemas/NestedSelectControlSchema.json';

View File

@ -18,6 +18,7 @@ import {diff} from 'amis-editor-core';
import {getEventControlConfig} from '../../renderer/event-control/helper';
export class PickerControlPlugin extends BasePlugin {
static id = 'PickerControlPlugin';
// 关联渲染器名字
rendererName = 'picker';
$schema = '/schemas/PickerControlSchema.json';

View File

@ -7,6 +7,7 @@ import {getEventControlConfig} from '../../renderer/event-control/helper';
import {RendererPluginAction, RendererPluginEvent} from 'amis-editor-core';
export class RadiosControlPlugin extends BasePlugin {
static id = 'RadiosControlPlugin';
static scene = ['layout'];
// 关联渲染器名字
rendererName = 'radios';

View File

@ -8,6 +8,7 @@ import {getEventControlConfig} from '../../renderer/event-control/helper';
import {RendererPluginAction, RendererPluginEvent} from 'amis-editor-core';
export class SelectControlPlugin extends BasePlugin {
static id = 'SelectControlPlugin';
static scene = ['layout'];
// 关联渲染器名字
rendererName = 'select';

View File

@ -254,6 +254,7 @@ setSchemaTpl('copyable', {
});
export class StaticControlPlugin extends BasePlugin {
static id = 'StaticControlPlugin';
static scene = ['layout'];
// 关联渲染器名字
rendererName = 'static';

View File

@ -6,6 +6,7 @@ import {getEventControlConfig} from '../../renderer/event-control/helper';
import type {RendererPluginAction, RendererPluginEvent} from 'amis-editor-core';
export class SwitchControlPlugin extends BasePlugin {
static id = 'SwitchControlPlugin';
static scene = ['layout'];
// 关联渲染器名字
rendererName = 'switch';

View File

@ -7,6 +7,7 @@ import {RendererPluginAction, RendererPluginEvent} from 'amis-editor-core';
import {getEventControlConfig} from '../../renderer/event-control/helper';
export class TabsTransferPlugin extends BasePlugin {
static id = 'TabsTransferPlugin';
// 关联渲染器名字
rendererName = 'tabs-transfer';
$schema = '/schemas/TransferControlSchema.json';

View File

@ -8,6 +8,7 @@ import {getEventControlConfig} from '../../renderer/event-control/helper';
import {RendererPluginAction, RendererPluginEvent} from 'amis-editor-core';
export class TextareaControlPlugin extends BasePlugin {
static id = 'TextareaControlPlugin';
// 关联渲染器名字
rendererName = 'textarea';
$schema = '/schemas/TextareaControlSchema.json';

View File

@ -8,6 +8,7 @@ import {ValidatorTag} from '../../validator';
import {tipedLabel} from 'amis-editor-core';
export class TransferPlugin extends BasePlugin {
static id = 'TransferPlugin';
// 关联渲染器名字
rendererName = 'transfer';
$schema = '/schemas/TransferControlSchema.json';

View File

@ -12,6 +12,7 @@ import {ValidatorTag} from '../../validator';
import {tipedLabel} from 'amis-editor-core';
export class TreeSelectControlPlugin extends BasePlugin {
static id = 'TreeSelectControlPlugin';
// 关联渲染器名字
rendererName = 'tree-select';
$schema = '/schemas/TreeSelectControlSchema.json';

View File

@ -8,6 +8,7 @@ import {
} from 'amis-editor-core';
export class UUIDControlPlugin extends BasePlugin {
static id = 'UUIDControlPlugin';
// 关联渲染器名字
rendererName = 'uuid';
$schema = '/schemas/UUIDControlSchema.json';

View File

@ -20,6 +20,7 @@ import {Icon} from 'amis-editor-core';
import {JSONChangeInArray, JSONPipeIn, repeatArray} from 'amis-editor-core';
export class GridPlugin extends BasePlugin {
static id = 'GridPlugin';
static scene = ['layout'];
// 关联渲染器名字
rendererName = 'grid';

View File

@ -20,6 +20,7 @@ import {JSONChangeInArray, JSONPipeIn, repeatArray} from 'amis-editor-core';
import {Icon} from 'amis-editor-core';
export class HBoxPlugin extends BasePlugin {
static id = 'HBoxPlugin';
static scene = ['layout'];
// 关联渲染器名字
rendererName = 'hbox';

View File

@ -9,6 +9,7 @@ import {
import {defaultValue, getSchemaTpl, valuePipeOut} from 'amis-editor-core';
export class IFramePlugin extends BasePlugin {
static id = 'IFramePlugin';
// 关联渲染器名字
rendererName = 'iframe';
$schema = '/schemas/IFrameSchema.json';

View File

@ -4,6 +4,7 @@ import {defaultValue, getSchemaTpl} from 'amis-editor-core';
import {getEventControlConfig} from '../renderer/event-control';
export class IconPlugin extends BasePlugin {
static id = 'IconPlugin';
// 关联渲染器名字
rendererName = 'icon';
$schema = '/schemas/Icon.json';

View File

@ -10,6 +10,7 @@ import {defaultValue, getSchemaTpl, tipedLabel} from 'amis-editor-core';
import {mockValue} from 'amis-editor-core';
export class ImagePlugin extends BasePlugin {
static id = 'ImagePlugin';
static scene = ['layout'];
// 关联渲染器名字
rendererName = 'image';

View File

@ -4,6 +4,7 @@ import {defaultValue, getSchemaTpl, tipedLabel} from 'amis-editor-core';
import {mockValue} from 'amis-editor-core';
export class ImagesPlugin extends BasePlugin {
static id = 'ImagesPlugin';
static scene = ['layout'];
// 关联渲染器名字
rendererName = 'images';

View File

@ -3,6 +3,7 @@ import {BaseEventContext, BasePlugin} from 'amis-editor-core';
import {defaultValue, getSchemaTpl} from 'amis-editor-core';
import flatten from 'lodash/flatten';
export class JsonPlugin extends BasePlugin {
static id = 'JsonPlugin';
// 关联渲染器名字
rendererName = 'json';
$schema = '/schemas/JsonSchema.json';

Some files were not shown because too many files have changed in this diff Show More