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

chore: 补齐编辑器默认组件子组件的id #11322

Merged
merged 1 commit into from
Dec 5, 2024
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
4 changes: 3 additions & 1 deletion packages/amis-editor/src/plugin/Alert.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {registerEditorPlugin} from 'amis-editor-core';
import {BaseEventContext, BasePlugin} from 'amis-editor-core';
import {getSchemaTpl} from 'amis-editor-core';
import type {SchemaObject} from 'amis';
import {generateId} from '../util';

export class AlertPlugin extends BasePlugin {
static id = 'AlertPlugin';
Expand All @@ -28,7 +29,8 @@ export class AlertPlugin extends BasePlugin {
type: 'tpl',
tpl: '提示内容',
wrapperComponent: '',
inline: false
inline: false,
id: generateId()
},
level: 'info'
};
Expand Down
10 changes: 7 additions & 3 deletions packages/amis-editor/src/plugin/AnchorNav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import findIndex from 'lodash/findIndex';
import {RegionWrapper as Region} from 'amis-editor-core';
import {AnchorNavSection} from 'amis-ui';
import {registerFilter} from 'amis-formula';
import {generateId} from '../util';
registerFilter('appTranslate', (input: any) => translateSchema(input));

export class AnchorNavPlugin extends BasePlugin {
Expand Down Expand Up @@ -36,7 +37,8 @@ export class AnchorNavPlugin extends BasePlugin {
type: 'tpl',
tpl: '这里是锚点内容1',
wrapperComponent: '',
inline: false
inline: false,
id: generateId()
}
]
},
Expand All @@ -48,7 +50,8 @@ export class AnchorNavPlugin extends BasePlugin {
type: 'tpl',
tpl: '这里是锚点内容2',
wrapperComponent: '',
inline: false
inline: false,
id: generateId()
}
]
},
Expand All @@ -60,7 +63,8 @@ export class AnchorNavPlugin extends BasePlugin {
type: 'tpl',
tpl: '这里是锚点内容3',
wrapperComponent: '',
inline: false
inline: false,
id: generateId()
}
]
}
Expand Down
3 changes: 3 additions & 0 deletions packages/amis-editor/src/plugin/ButtonGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
translateSchema
} from 'amis-editor-core';
import {BUTTON_DEFAULT_ACTION} from '../component/BaseControl';
import {generateId} from '../util';

export class ButtonGroupPlugin extends BasePlugin {
static id = 'ButtonGroupPlugin';
Expand All @@ -31,12 +32,14 @@ export class ButtonGroupPlugin extends BasePlugin {
{
type: 'button',
label: '按钮1',
id: generateId(),
...BUTTON_DEFAULT_ACTION
},

{
type: 'button',
label: '按钮2',
id: generateId(),
...BUTTON_DEFAULT_ACTION
}
]
Expand Down
2 changes: 2 additions & 0 deletions packages/amis-editor/src/plugin/Card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
import {defaultValue, getSchemaTpl} from 'amis-editor-core';
import flatten from 'lodash/flatten';
import {VRenderer} from 'amis-editor-core';
import {generateId} from '../util';

export class CardPlugin extends BasePlugin {
static id = 'CardPlugin';
Expand Down Expand Up @@ -44,6 +45,7 @@ export class CardPlugin extends BasePlugin {
type: 'button',
label: '按钮',
actionType: 'dialog',
id: generateId(),
dialog: {
title: '标题',
body: '内容'
Expand Down
44 changes: 22 additions & 22 deletions packages/amis-editor/src/plugin/Cards.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {defaultValue, getSchemaTpl} from 'amis-editor-core';
import {diff, JSONPipeOut, repeatArray} from 'amis-editor-core';
import set from 'lodash/set';
import merge from 'lodash/merge';
import {escapeFormula, resolveArrayDatasource} from '../util';
import {escapeFormula, generateId, resolveArrayDatasource} from '../util';

export class CardsPlugin extends BasePlugin {
static id = 'CardsPlugin';
Expand Down Expand Up @@ -63,7 +63,7 @@ export class CardsPlugin extends BasePlugin {
}
}
},
id: 'u:c3a694c7f4e6'
id: generateId()
},
{
type: 'tpl',
Expand All @@ -83,7 +83,7 @@ export class CardsPlugin extends BasePlugin {
}
}
},
id: 'u:4273575e1d7b'
id: generateId()
}
],
style: {
Expand All @@ -103,7 +103,7 @@ export class CardsPlugin extends BasePlugin {
}
}
},
id: 'u:561592d2ff0a'
id: generateId()
},
{
type: 'flex',
Expand All @@ -130,7 +130,7 @@ export class CardsPlugin extends BasePlugin {
}
}
},
id: 'u:c53d2e838649'
id: generateId()
},
{
type: 'tpl',
Expand All @@ -146,7 +146,7 @@ export class CardsPlugin extends BasePlugin {
}
}
},
id: 'u:774766c09a3e'
id: generateId()
}
],
style: {
Expand All @@ -167,7 +167,7 @@ export class CardsPlugin extends BasePlugin {
}
}
},
id: 'u:7b8d9478caf0'
id: generateId()
},
{
type: 'container',
Expand All @@ -185,7 +185,7 @@ export class CardsPlugin extends BasePlugin {
}
}
},
id: 'u:4abe984e2cdf'
id: generateId()
}
],
style: {
Expand All @@ -201,7 +201,7 @@ export class CardsPlugin extends BasePlugin {
isFixedHeight: false,
isFixedWidth: false,
size: 'none',
id: 'u:10268e055c48'
id: generateId()
}
],
size: 'xs',
Expand All @@ -219,7 +219,7 @@ export class CardsPlugin extends BasePlugin {
wrapperBody: false,
isFixedHeight: false,
isFixedWidth: false,
id: 'u:a35d9094c57a'
id: generateId()
},
{
type: 'container',
Expand All @@ -239,7 +239,7 @@ export class CardsPlugin extends BasePlugin {
}
}
},
id: 'u:dfa080010477'
id: generateId()
},
{
type: 'tpl',
Expand All @@ -254,7 +254,7 @@ export class CardsPlugin extends BasePlugin {
}
}
},
id: 'u:ee6afab8bebf'
id: generateId()
}
],
size: 'xs',
Expand All @@ -272,7 +272,7 @@ export class CardsPlugin extends BasePlugin {
wrapperBody: false,
isFixedHeight: false,
isFixedWidth: false,
id: 'u:8d1113a60808'
id: generateId()
},
{
type: 'container',
Expand All @@ -292,7 +292,7 @@ export class CardsPlugin extends BasePlugin {
}
}
},
id: 'u:538523c38973'
id: generateId()
},
{
type: 'tpl',
Expand All @@ -307,7 +307,7 @@ export class CardsPlugin extends BasePlugin {
}
}
},
id: 'u:4b2f8311836c'
id: generateId()
}
],
size: 'xs',
Expand All @@ -325,13 +325,13 @@ export class CardsPlugin extends BasePlugin {
wrapperBody: false,
isFixedHeight: false,
isFixedWidth: false,
id: 'u:7543aef28c33'
id: generateId()
}
],
style: {
position: 'relative'
},
id: 'u:0f802c8852fd'
id: generateId()
},
{
type: 'container',
Expand All @@ -350,7 +350,7 @@ export class CardsPlugin extends BasePlugin {
}
}
},
id: 'u:ec80d1113007'
id: generateId()
},
{
type: 'tpl',
Expand All @@ -366,7 +366,7 @@ export class CardsPlugin extends BasePlugin {
}
}
},
id: 'u:7f6bef513eb3'
id: generateId()
}
],
style: {
Expand All @@ -385,7 +385,7 @@ export class CardsPlugin extends BasePlugin {
}
}
},
id: 'u:6606cebce092'
id: generateId()
}
],
size: 'none',
Expand Down Expand Up @@ -435,15 +435,15 @@ export class CardsPlugin extends BasePlugin {
}
}
},
id: 'u:b39411e7f540'
id: generateId()
},
placeholder: '',
name: '',
style: {
gutterX: 15,
gutterY: 15
},
id: 'u:1f941707f77f'
id: generateId()
};
previewSchema = {
...this.scaffold,
Expand Down
4 changes: 3 additions & 1 deletion packages/amis-editor/src/plugin/Collapse.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
getEventControlConfig
} from '../renderer/event-control/helper';
import {getActionCommonProps} from '../renderer/event-control/helper';
import {generateId} from '../util';

export class CollapsePlugin extends BasePlugin {
static id = 'CollapsePlugin';
Expand All @@ -38,7 +39,8 @@ export class CollapsePlugin extends BasePlugin {
type: 'tpl',
tpl: '内容',
wrapperComponent: '',
inline: false
inline: false,
id: generateId()
}
]
};
Expand Down
9 changes: 7 additions & 2 deletions packages/amis-editor/src/plugin/CollapseGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {defaultValue, getSchemaTpl} from 'amis-editor-core';
import {tipedLabel} from 'amis-editor-core';
import {isObject} from 'amis-editor-core';
import {getEventControlConfig} from '../renderer/event-control/helper';
import {generateId} from '../util';

export class CollapseGroupPlugin extends BasePlugin {
static id = 'CollapseGroupPlugin';
Expand All @@ -35,25 +36,29 @@ export class CollapseGroupPlugin extends BasePlugin {
key: '1',
active: true,
header: '标题1',
id: generateId(),
body: [
{
type: 'tpl',
tpl: '这里是内容1',
wrapperComponent: '',
inline: false
inline: false,
id: generateId()
}
]
},
{
type: 'collapse',
key: '2',
header: '标题2',
id: generateId(),
body: [
{
type: 'tpl',
tpl: '这里是内容1',
wrapperComponent: '',
inline: false
inline: false,
id: generateId()
}
]
}
Expand Down
4 changes: 3 additions & 1 deletion packages/amis-editor/src/plugin/CustomRegion.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
} from 'amis-editor-core';
import {defaultValue, getSchemaTpl} from 'amis-editor-core';
import isArray from 'lodash/isArray';
import {generateId} from '../util';

export class CustomPlugin extends BasePlugin {
static id = 'CustomRegionPlugin';
Expand All @@ -37,7 +38,8 @@ export class CustomPlugin extends BasePlugin {
{
type: 'tpl',
wrapperComponent: '',
tpl: '自定义容器区域'
tpl: '自定义容器区域',
id: generateId()
}
]
};
Expand Down
3 changes: 3 additions & 0 deletions packages/amis-editor/src/plugin/DropDownButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
} from 'amis-editor-core';
import {BUTTON_DEFAULT_ACTION} from '../component/BaseControl';
import {buttonStateFunc} from '../renderer/style-control/helper';
import {generateId} from '../util';
export class DropDownButtonPlugin extends BasePlugin {
static id = 'DropDownButtonPlugin';
static scene = ['layout'];
Expand All @@ -38,12 +39,14 @@ export class DropDownButtonPlugin extends BasePlugin {
{
type: 'button',
label: '按钮1',
id: generateId(),
...BUTTON_DEFAULT_ACTION
},

{
type: 'button',
label: '按钮2',
id: generateId(),
...BUTTON_DEFAULT_ACTION
}
]
Expand Down
Loading
Loading