merge pre-release

Change-Id: Icc0954d0d7f8fc9f9a1577da20cad732e7b7be60
This commit is contained in:
yangwei9012 2022-07-27 17:56:04 +08:00
commit 7246a044d9
15 changed files with 84 additions and 136 deletions

View File

@ -1,6 +1,6 @@
{
"name": "amis-editor-core",
"version": "5.2.0-beta.21",
"version": "5.2.0-beta.26",
"description": "amis 可视化编辑器",
"main": "lib/index.min.js",
"types": "lib/index.d.ts",
@ -53,10 +53,10 @@
"@types/sortablejs": "^1.10.7",
"@types/tinycolor2": "^1.4.3",
"ajv": "^8.8.2",
"amis": "^2.0.0-rc.16",
"amis-core": "^2.0.0-rc.16",
"amis-formula": "^2.0.0-rc.15",
"amis-ui": "^2.0.0-rc.16",
"amis": "^2.0.2",
"amis-core": "^2.0.2",
"amis-formula": "^2.0.2",
"amis-ui": "^2.0.2",
"axios": "0.21.1",
"concurrently": "^6.2.0",
"css-loader": "^6.2.0",

View File

@ -1,4 +1,9 @@
@mixin minScrollBar {
// 火狐浏览器
scrollbar-width: thin;
scrollbar-color: #d4d6d9 transparent;
&::-webkit-scrollbar {
// display: none;
background-color: transparent;
@ -13,12 +18,12 @@
&::-webkit-scrollbar-thumb {
width: 6px;
background-color: rgb(92, 95, 102, 0.5); // #babac0;
background-color: #d4d6d9; // #babac0;
border-radius: 6px;
border: 4px solid transparent;
&:hover {
background-color: #d4d6d9;
background-color: rgb(92, 95, 102, 0.5);
}
}

View File

@ -68,64 +68,6 @@
// width: $Editor-aside-width;
display: flex;
flex-direction: column;
justify-content: flex-start;
.ae-RendererList-tabs-header {
padding: 0 12px;
}
.ae-RendererList-tabs-content {
position: relative;
margin-top: 12px;
flex: 1 1 auto;
padding: 0 5px;
// overflow: auto;
height: 100%;
// max-height: calc(100% - 50px); // 确保不撑开
box-sizing: border-box;
// @include minScrollBar();
.ae-RendererList-tabs-panel {
position: relative;
padding: 0;
height: 100%;
}
}
}
.ae-RendererList {
height: 100%;
padding: 0 0 12px 0;
// width: $Editor-aside-width;
display: flex;
flex-direction: column;
&.only-base-component {
width: $Editor-aside-width;
.ae-RendererList-groupWrap {
margin: 0;
padding: 0 0 12px 0;
}
}
&.only-base-component {
width: $Editor-aside-width;
.ae-RendererList-groupWrap {
margin: 0;
padding: 0;
}
}
&.only-base-component {
width: $Editor-aside-width;
.ae-RendererList-groupWrap {
margin: 0;
padding: 0 0 12px 0;
}
}
&.only-base-component {
width: $Editor-aside-width;
@ -154,6 +96,7 @@
margin: 0 -5px; // 让右侧滚动条靠最右侧
padding: 0 0 12px 0;
background: #fff;
scrollbar-width: none !important; // 火狐浏览器中不显示滚动条避免挤压组件列表
.collapse-header {
padding: 0 12px;

View File

@ -244,8 +244,6 @@ $category-2-height: px2rem(32px);
.config-form-content {
position: relative;
height: 100%;
// 添加事件按钮display:fixed继承该元素宽度
transform: translateX(0);
padding: 16px 12px;
// 带底部操作按钮的属性配置面板
@ -273,7 +271,7 @@ $category-2-height: px2rem(32px);
// 内层tabs
.editor-prop-config-tabs {
display: flex;
display: block;
position: relative;
height: 100%;
padding: 0;
@ -364,7 +362,9 @@ $category-2-height: px2rem(32px);
// tab内容
&-cont {
flex: 1 1 auto;
height: calc( 100% - 45px);
position:absolute;
width: 100%;
padding: 0;
overflow-y: overlay !important;
@include minScrollBar();

View File

@ -66,4 +66,4 @@
}
}
}
}
}

View File

@ -267,6 +267,9 @@
padding-top: 5px;
font-size: 12px;
}
.cxd-NestedSelect-popover {
font-size: 12px;
}
}
.action-config-panel {
@ -378,7 +381,7 @@
.action-desc {
font-size: 12px;
margin-left: 16px;
color: var(--Form-description-color);
color: var(--Form-item-fontColor);
}
.ae-ApiControl-tabs {
@ -420,6 +423,15 @@
text-align: left;
}
}
.cxd-Checkbox {
font-size: 12px;
}
.cxd-Remark {
margin-left: 0;
margin-top: 5px;
}
}
}

View File

@ -14,8 +14,6 @@
.ae-TreeOptionControl-content {
margin: 0;
padding: 0;
max-height: #{px2rem(400px)};
overflow-y: auto;
}
.ae-TreeOptionControlItem {
display: flex;
@ -56,6 +54,9 @@
}
&-dropdown {
margin-right: var(--gap-sm);
svg {
font-size: var(--Button--sm-fontSize);
}
.m-r-xs {
margin-right: 2px;
font-size: #{px2rem(12px)};

View File

@ -1,23 +1,23 @@
@import 'amis-ui/scss/_functions';
@import 'amis-ui/scss/_variables';
@import 'amis-ui/scss/_mixins';
@import './_mixin';
@import './_variables';
@import './_backTop';
@import './_context-menu-setting';
@import './_outline';
@import './_leftPanel';
@import './_rightPanel';
@import './_bcn';
@import './_classname-picker';
@import './_renderers';
@import './_searchRendererPanel';
@import './_tableview';
@import './_targetname';
@import './_selection';
@import './_data-chain';
@import './_tooltip';
@import './_shortcutKey';
@import 'amis-ui/scss/functions';
@import 'amis-ui/scss/variables';
@import 'amis-ui/scss/mixins';
@import './mixin';
@import './variables';
@import './backTop';
@import './context-menu-setting';
@import './outline';
@import './leftPanel';
@import './rightPanel';
@import './bcn';
@import './classname-picker';
@import './renderers';
@import './searchRendererPanel';
@import './tableview';
@import './targetname';
@import './selection';
@import './data-chain';
@import './tooltip';
@import './shortcutKey';
@import './control/option-control';
@import './control/api-control';
@import './control/switch-more-control';
@ -1385,8 +1385,8 @@ div.ae-DragImage {
// Pagination配置面板里的layout字段样式
.ae-pagination-layout-item {
input+div {
>div:nth-child(1) {
input + div {
> div:nth-child(1) {
flex-basis: px2rem(32px);
flex-grow: 0;
padding-right: 0;
@ -1551,18 +1551,8 @@ div.ae-DragImage {
}
}
.ae-InputVariable {
width: 100%;
flex-wrap: nowrap;
> span {
margin-left: auto;
cursor: pointer;
}
}
.ae-collapse-checkbox{
label{
.ae-collapse-checkbox {
label {
margin-right: 0;
}
}

View File

@ -78,11 +78,15 @@ export interface EditorProps extends PluginEventListener {
/**
*
*/
actionTreeGetter?: (actionTree: RendererPluginAction[]) => RendererPluginAction[];
actionTreeGetter?: (
actionTree: RendererPluginAction[]
) => RendererPluginAction[];
/**
*
*/
customActionGetter?: (manager: EditorManager) => {[propName: string]: RendererPluginAction};
customActionGetter?: (manager: EditorManager) => {
[propName: string]: RendererPluginAction;
};
};
onUndo?: () => void; // 用于触发外部 undo 事件
@ -237,7 +241,7 @@ export default class Editor extends Component<EditorProps> {
return;
} else if (
(e.target as HTMLElement).tagName === 'BODY' &&
e.key === 's' &&
(e.key === 's' || e.key === 'S') &&
(e.metaKey || e.ctrlKey)
) {
e.preventDefault();
@ -245,7 +249,7 @@ export default class Editor extends Component<EditorProps> {
return;
} else if (
(e.target as HTMLElement).tagName === 'BODY' &&
e.key === 'c' &&
(e.key === 'c' || e.key === 'C') &&
(e.metaKey || e.ctrlKey)
) {
e.preventDefault();
@ -253,7 +257,7 @@ export default class Editor extends Component<EditorProps> {
return;
} else if (
(e.target as HTMLElement).tagName === 'BODY' &&
e.key === 'v' &&
(e.key === 'v' || e.key === 'V') &&
(e.metaKey || e.ctrlKey)
) {
e.preventDefault();
@ -463,7 +467,6 @@ export default class Editor extends Component<EditorProps> {
}
}
@autobind
getToolbarContainer() {
return this.mainRef.current;

View File

@ -85,16 +85,6 @@ export class AvailableRenderersPanel extends React.Component<
searchRendererType={'renderer'}
/>
)}
{(!store.showCustomRenderersPanel ||
Object.keys(groupedCustomRenderers).length < 1) && (
<RenderersPanel
className={'only-base-component'}
groupedRenderers={groupedSubRenderers}
store={store}
manager={manager}
searchRendererType={'renderer'}
/>
)}
</div>
</div>
);

View File

@ -284,11 +284,8 @@ function SchemaFrom({
schema,
{
onFinished: (newValue: any) => {
if (newValue && newValue.type) {
// 确保type值不为空
const diffValue = diff(value, newValue);
onChange(newValue, diffValue);
}
},
data: value,
node: node,
@ -679,7 +676,7 @@ export function renderThumbToGhost(
schema: any,
manager: EditorManager
) {
// bca-disable-line
// bca-disable-next-line
ghost.innerHTML = '';
let path = '';
const host = region.host!;
@ -713,13 +710,15 @@ export function renderThumbToGhost(
);
} catch (e) {}
/* bca-disable */
const html =
thumbHost.innerHTML ||
'<div class="wrapper-sm b-a b-light m-b-sm">拖入占位</div>';
// bca-disable-line
ghost.innerHTML = html;
/* bca-enable */
unmountComponentAtNode(thumbHost);
// bca-disable-line
// bca-disable-next-line
thumbHost.innerHTML = '';
}

View File

@ -51,7 +51,7 @@ export class DefaultDNDMode implements DNDModeInterface {
// .replace(/\bdata\-editor\-id=('|").+?\1/g, '');
// 上面那个会让 fis 编译的时候把后续的 require 语句都给忽略掉了。
.replace(/\bdata\-editor\-id=(?:'.+?'|".+?")/g, '');
// bca-disable-next-line
ghost.innerHTML = innerHTML;
} else {
const manager = this.dnd.manager;

View File

@ -91,6 +91,7 @@ export class EditorDNDManager {
createDragImage(id: string, node: EditorNodeType) {
const dragImage = document.createElement('div');
dragImage.classList.add('ae-DragImage');
// bca-disable-next-line
dragImage.innerHTML = `<span>${node.label}</span>`;
document.body.appendChild(dragImage);
// dragImage.style.cssText += `width: ${node.w}px; height: ${node.h}px;`;
@ -367,6 +368,7 @@ export class EditorDNDManager {
this.dndMode?.leave(e, this.dragGhost!);
delete this.dndMode;
// bca-disable-next-line
this.dragGhost.innerHTML = '';
this.store.setDragId('');
this.store.setDropId('');

View File

@ -416,7 +416,6 @@ export class EditorManager {
triggerEvent && this.trigger('build-panels', context);
panels = context.data || panels;
if (context.changeLeftPanelKey) {
// 改变左侧激活面板
this.store.changeLeftPanelKey(context.changeLeftPanelKey);
@ -1128,9 +1127,10 @@ export class EditorManager {
const event = this.trigger('before-move', context);
if (!event.prevented) {
store.moveUp(node.id);
this.buildToolbars();
// this.buildToolbars();
this.trigger('after-move', context);
this.trigger('after-update', context);
}
}
@ -1159,9 +1159,10 @@ export class EditorManager {
const event = this.trigger('before-move', context);
if (!event.prevented) {
store.moveDown(node.id);
this.buildToolbars();
// this.buildToolbars();
this.trigger('after-move', context);
this.trigger('after-update', context);
}
}
@ -1673,8 +1674,10 @@ export class EditorManager {
// 查找最近一层的数据域
while (!scope && from) {
scope = this.dataSchema.hasScope(`${from.id}-${from.type}`)
? this.dataSchema.getScope(`${from.id}-${from.type}`)
const nodeId = from.info?.id;
const type = from.info?.type;
scope = this.dataSchema.hasScope(`${nodeId}-${type}`)
? this.dataSchema.getScope(`${nodeId}-${type}`)
: undefined;
from = from.parent;
if (from?.isRegion) {

View File

@ -174,7 +174,7 @@ export function JSONPipeOut(
if (
typeof filterHiddenProps === 'function'
? filterHiddenProps(key, prop)
: filterHiddenProps && key.substring(0, 2) === '__'
: filterHiddenProps !== false && key.substring(0, 2) === '__'
) {
toUpdate[key] = undefined;
flag = true;
@ -555,7 +555,7 @@ export function reGenerateID(
export function createElementFromHTML(htmlString: string): HTMLElement {
var div = document.createElement('div');
// bca-disable-line
// bca-disable-next-line
div.innerHTML = htmlString.trim();
// Change this to div.childNodes to support multiple top-level nodes