liwei 1 jaar geleden
bovenliggende
commit
5f5ac8cb7b

+ 3 - 0
src/assets/icons/components/IconLock.tsx

@@ -0,0 +1,3 @@
+
+import { createIcon } from '@queenjs/icons';
+export const IconLock = createIcon(<svg viewBox="0 0 14 14"><rect fill="none" width="14" height="14"/><g transform="translate(2.471 2.111)"><rect fill="none" stroke="currentColor" stroke-linejoin="round" stroke-width="0.8px" width="9.327" height="6.218" rx="2" transform="translate(0 3.73)"/><path fill="none" stroke="currentColor" stroke-linejoin="round" stroke-width="0.8px" stroke-linecap="round" d="M14,7.73V6.636A2.636,2.636,0,0,1,16.636,4a2.742,2.742,0,0,1,2.209,1.2,2.434,2.434,0,0,1,.426,1.438V7.73" transform="translate(-11.864 -4)"/><path fill="none" stroke="currentColor" stroke-linejoin="round" stroke-width="0.8px" stroke-linecap="round" d="M24,30v1.582" transform="translate(-19.228 -23.803)"/></g></svg>)

+ 3 - 0
src/assets/icons/components/IconUnlock.tsx

@@ -0,0 +1,3 @@
+
+import { createIcon } from '@queenjs/icons';
+export const IconUnlock = createIcon(<svg  viewBox="0 0 14 14"><rect fill="none" width="14" height="14"/><g transform="translate(2.471 2.111)"><rect fill="none" stroke="currentColor" stroke-linejoin="round" stroke-width="0.8px" width="9.327" height="6.218" rx="2" transform="translate(0 3.73)"/><path fill="none" stroke="currentColor" stroke-linejoin="round" stroke-width="0.8px" stroke-linecap="round" d="M14.219,5.582A2.532,2.532,0,0,1,16.636,4a2.742,2.742,0,0,1,2.209,1.2,2.434,2.434,0,0,1,.426,1.438V7.73" transform="translate(-11.864 -4)"/><path fill="none" stroke="currentColor" stroke-linejoin="round" stroke-width="0.8px" stroke-linecap="round" d="M24,30v1.582" transform="translate(-19.228 -23.803)"/></g></svg>)

+ 2 - 0
src/assets/icons/index.ts

@@ -30,6 +30,7 @@ export * from "./components/IconImage";
 export * from "./components/IconLayerDown";
 export * from "./components/IconLayers";
 export * from "./components/IconLayerUp";
+export * from "./components/IconLock";
 export * from "./components/IconLocked";
 export * from "./components/IconMove";
 export * from "./components/IconMusic";
@@ -60,6 +61,7 @@ export * from "./components/IconTextUnderline";
 export * from "./components/IconTpl";
 export * from "./components/IconTransfer";
 export * from "./components/IconUngroup";
+export * from "./components/IconUnlock";
 export * from "./components/IconVideo";
 export * from "./components/IconWechat";
 export * from "./components/IconWidth";

+ 1 - 0
src/assets/icons/svg/lock.svg

@@ -0,0 +1 @@
+<svg viewBox="0 0 14 14"><rect fill="none" width="14" height="14"/><g transform="translate(2.471 2.111)"><rect fill="none" stroke="currentColor" stroke-linejoin="round" stroke-width="0.8px" width="9.327" height="6.218" rx="2" transform="translate(0 3.73)"/><path fill="none" stroke="currentColor" stroke-linejoin="round" stroke-width="0.8px" stroke-linecap="round" d="M14,7.73V6.636A2.636,2.636,0,0,1,16.636,4a2.742,2.742,0,0,1,2.209,1.2,2.434,2.434,0,0,1,.426,1.438V7.73" transform="translate(-11.864 -4)"/><path fill="none" stroke="currentColor" stroke-linejoin="round" stroke-width="0.8px" stroke-linecap="round" d="M24,30v1.582" transform="translate(-19.228 -23.803)"/></g></svg>

+ 1 - 0
src/assets/icons/svg/unlock.svg

@@ -0,0 +1 @@
+<svg  viewBox="0 0 14 14"><rect fill="none" width="14" height="14"/><g transform="translate(2.471 2.111)"><rect fill="none" stroke="currentColor" stroke-linejoin="round" stroke-width="0.8px" width="9.327" height="6.218" rx="2" transform="translate(0 3.73)"/><path fill="none" stroke="currentColor" stroke-linejoin="round" stroke-width="0.8px" stroke-linecap="round" d="M14.219,5.582A2.532,2.532,0,0,1,16.636,4a2.742,2.742,0,0,1,2.209,1.2,2.434,2.434,0,0,1,.426,1.438V7.73" transform="translate(-11.864 -4)"/><path fill="none" stroke="currentColor" stroke-linejoin="round" stroke-width="0.8px" stroke-linecap="round" d="M24,30v1.582" transform="translate(-19.228 -23.803)"/></g></svg>

+ 7 - 4
src/modules/editor/components/CompUI/basicUI/Page/component.tsx

@@ -30,11 +30,14 @@ export const Component = defineComponent({
         style.height = "100%";
       }
 
-      const contextStyle:any = { transform: `translate(0, ${ -store.shortPage.index * window.innerHeight + store.shortPage.offset}px`};
-      if (!store.shortPage.isMoving) {
-        contextStyle.transition = "transform .4s ease-out";
+      let contextStyle:any = null;
+      if (store.rootPage.value.pageMode == "short") {
+        contextStyle = { transform: `translate(0, ${ -store.shortPage.index * window.innerHeight + store.shortPage.offset}px`};
+        if (!store.shortPage.isMoving) {
+          contextStyle.transition = "transform .4s ease-out";
+        }
       }
-
+      
       return (
         <div
           ref={compRef}

+ 5 - 6
src/modules/editor/components/CompUI/defines/createAttrsForm.tsx

@@ -87,12 +87,11 @@ export const layoutColumns: ColumnItem[] = [
   //     ),
   //   },
   // },
-  {
-    label: "锁定",
-    dataIndex: "layout.locked",
-    component: "Switch",
-  },
-  
+  // {
+  //   label: "锁定",
+  //   dataIndex: "layout.locked",
+  //   component: "Switch",
+  // },
 ];
 
 export const bdColumns: ColumnItem[] = [

+ 10 - 0
src/modules/editor/controllers/SelectCtrl/index.ts

@@ -11,6 +11,7 @@ import { indexOf } from "lodash";
 import { AssistCtrl } from "./assistCtrl";
 import { AssistRulerCtrl } from "./assistRulerCtrl";
 import { AssistMagnetCtrl } from "./assistMagnetCtrl";
+import { DesignComp } from "../../objects/DesignTemp/DesignComp";
 
 /**
  *  页面画布空间进行选择
@@ -583,6 +584,15 @@ export class SelectCtrl extends ModuleControl<EditorModule> {
   }
 
   _selectObjs( outs:string[], e:MouseEvent) {
+    //过滤掉锁定的对象
+    let n = outs.length;
+    while(n--) {
+      const c = outs[n]
+      const comp = this.helper.findComp(c)as DesignComp;
+      if (comp.layout.locked) {
+         outs.splice(n, 1);
+      }
+    }
 
     let objs = this.store.selected.slice(0);
     let lastId = outs[outs.length-1];

+ 1 - 1
src/modules/editor/module/actions/edit.tsx

@@ -634,7 +634,7 @@ export const editActions = EditorModule.action({
   },
   // 设置组件锁定状态
   setCompLock(comp: DesignComp) {
-    console.log(comp);
+     comp.layout.locked = !comp.layout.locked
   },
   // 设置组件层级
   setCompLayer(comp: DesignComp, offset: number) {

+ 1 - 1
src/modules/editor/objects/Toolbars/TreeToolbars.ts

@@ -7,8 +7,8 @@ export const TreeToolbars: ICompToolbars = {
     // }),
     toolbars.rename,
     toolbars.saveAsComp,
+    toolbars.lock,
     toolbars.visible,
-    toolbars.delete,
   ],
   Page: [],
   MultiSelector: [multiSelToolbar.delete]

+ 2 - 1
src/modules/editor/objects/Toolbars/default.ts

@@ -110,7 +110,7 @@ export const toolbars = createToolbars({
   // 锁定
   lock: {
     component: TipIcons.Lock,
-    getValue: (comp) => (comp ? 0 : 1),
+    getValue: (comp) => (comp.layout.locked ? 0 : 1),
     onClick(comp) {
       this.actions.setCompLock(comp);
     },
@@ -129,6 +129,7 @@ export const toolbars = createToolbars({
       this.actions.removeComp(comp.id);
     },
   },
+  
   // 对齐
   align: {
     component: TipIcons.Align,