Skip to content

Commit 5ee6fa6

Browse files
authored
Merge pull request #681 from lowcoder-org/collion-integration
[Feat] Layer Feature & Bulk Property Settings
2 parents 9219658 + 6911e74 commit 5ee6fa6

File tree

18 files changed

+957
-124
lines changed

18 files changed

+957
-124
lines changed

client/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "lowcoder-root",
3-
"version": "2.2.0",
3+
"version": "2.3.0",
44
"type": "module",
55
"private": true,
66
"workspaces": [

client/packages/lowcoder-core/lib/index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ declare enum CompActionTypes {
454454
* broadcast other actions in comp tree structure.
455455
* used for encapsulate MultiBaseComp
456456
*/
457-
BROADCAST = "BROADCAST"
457+
BROADCAST = "BROADCAST",
458458
}
459459
type ExtraActionType = "layout" | "delete" | "add" | "modify" | "rename" | "recover" | "upgrade";
460460
type ActionExtraInfo = {

client/packages/lowcoder-design/src/icons/index.ts

Lines changed: 30 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -214,8 +214,9 @@ export { ReactComponent as ClickHouseIcon } from "./icon-query-ClickHouse.svg";
214214
export { ReactComponent as ResetIcon } from "./icon-style-reset.svg";
215215
export { ReactComponent as EditIcon } from "./icon-edit.svg";
216216
export { ReactComponent as EditableIcon } from "./icon-editable.svg";
217-
export { ReactComponent as LeftStateIcon } from "./icon-left-state.svg";
218-
export { ReactComponent as LeftSettingIcon } from "./icon-left-setting.svg";
217+
export { ReactComponent as LeftStateIcon } from "./remix/node-tree.svg";
218+
export { ReactComponent as LeftSettingIcon } from "./remix/tools-fill.svg";
219+
export { ReactComponent as LeftLayersIcon } from "./remix/stack-line.svg";
219220
export { ReactComponent as LeftHelpIcon } from "./icon-left-help.svg";
220221
export { ReactComponent as LeftPreloadIcon } from "./icon-left-preload.svg";
221222
export { ReactComponent as CollapsibleContainerCompIcon } from "./icon-collapsible-container.svg";
@@ -277,31 +278,37 @@ export { ReactComponent as SignatureIcon } from "./icon-signature.svg";
277278
export { ReactComponent as ManualIcon } from "./icon-manual.svg";
278279
export { ReactComponent as WarnIcon } from "./icon-warn.svg";
279280
export { ReactComponent as SyncManualIcon } from "./icon-sync-manual.svg";
280-
export { ReactComponent as DangerIcon } from "icons/icon-danger.svg";
281-
export { ReactComponent as TableMinusIcon } from "icons/icon-table-minus.svg";
282-
export { ReactComponent as TablePlusIcon } from "icons/icon-table-plus.svg";
283-
export { ReactComponent as MobileAppIcon } from "icons/icon-mobile-app.svg";
284-
export { ReactComponent as MobileNavIcon } from "icons/icon-navigation-mobile.svg";
285-
export { ReactComponent as PcNavIcon } from "icons/icon-navigation-pc.svg";
286-
export { ReactComponent as UnLockIcon } from "icons/icon-unlock.svg";
287-
export { ReactComponent as CalendarDeleteIcon } from "icons/icon-calendar-delete.svg";
288-
export { ReactComponent as TableCheckedIcon } from "icons/icon-table-checked.svg";
289-
export { ReactComponent as TableUnCheckedIcon } from "icons/icon-table-boolean-false.svg";
290-
export { ReactComponent as FileFolderIcon } from "icons/icon-editor-folder.svg";
291-
export { ReactComponent as ExpandIcon } from "icons/icon-expand.svg";
292-
export { ReactComponent as CompressIcon } from "icons/icon-compress.svg";
293-
export { ReactComponent as TableCellsIcon } from "icons/icon-table-cells.svg"; // Added By Aqib Mirza
294-
export { ReactComponent as TimeLineIcon } from "icons/icon-timeline-comp.svg"
295-
export { ReactComponent as LottieIcon } from "icons/icon-lottie.svg";
296-
export { ReactComponent as CommentIcon } from "icons/icon-comment-comp.svg";
297-
export { ReactComponent as MentionIcon } from "icons/icon-mention-comp.svg";
298-
export { ReactComponent as AutoCompleteCompIcon } from "icons/icon-autocomplete-comp.svg";
299-
export { ReactComponent as WidthIcon } from "icons/icon-width.svg";
300-
export { ReactComponent as ResponsiveLayoutCompIcon } from "icons/icon-responsive-layout-comp.svg";
281+
export { ReactComponent as DangerIcon } from "./icon-danger.svg";
282+
export { ReactComponent as TableMinusIcon } from "./icon-table-minus.svg";
283+
export { ReactComponent as TablePlusIcon } from "./icon-table-plus.svg";
284+
export { ReactComponent as MobileAppIcon } from "./icon-mobile-app.svg";
285+
export { ReactComponent as MobileNavIcon } from "./icon-navigation-mobile.svg";
286+
export { ReactComponent as PcNavIcon } from "./icon-navigation-pc.svg";
287+
export { ReactComponent as UnLockIcon } from "./icon-unlock.svg";
288+
export { ReactComponent as CalendarDeleteIcon } from "./icon-calendar-delete.svg";
289+
export { ReactComponent as TableCheckedIcon } from "./icon-table-checked.svg";
290+
export { ReactComponent as TableUnCheckedIcon } from "./icon-table-boolean-false.svg";
291+
export { ReactComponent as FileFolderIcon } from "./icon-editor-folder.svg";
292+
export { ReactComponent as ExpandIcon } from "./icon-expand.svg";
293+
export { ReactComponent as CompressIcon } from "./icon-compress.svg";
294+
export { ReactComponent as TableCellsIcon } from "./icon-table-cells.svg"; // Added By Aqib Mirza
295+
export { ReactComponent as TimeLineIcon } from "./icon-timeline-comp.svg"
296+
export { ReactComponent as LottieIcon } from "./icon-lottie.svg";
297+
export { ReactComponent as CommentIcon } from "./icon-comment-comp.svg";
298+
export { ReactComponent as MentionIcon } from "./icon-mention-comp.svg";
299+
export { ReactComponent as AutoCompleteCompIcon } from "./icon-autocomplete-comp.svg";
300+
export { ReactComponent as WidthIcon } from "./icon-width.svg";
301+
export { ReactComponent as ResponsiveLayoutCompIcon } from "./icon-responsive-layout-comp.svg";
301302
export { ReactComponent as TextSizeIcon } from "./remix/font-size-2.svg";
302303
export { ReactComponent as FontFamilyIcon } from "./remix/font-sans-serif.svg";
303304
export { ReactComponent as TextWeigthIcon } from "./remix/bold.svg";
304305
export { ReactComponent as BorderWidthIcon } from "./remix/expand-width-line.svg";
306+
export { ReactComponent as LeftInfoLine } from "./remix/information-line.svg";
307+
export { ReactComponent as LeftInfoFill } from "./remix/information-fill.svg";
308+
export { ReactComponent as LeftShow } from "./remix/eye-off-line.svg";
309+
export { ReactComponent as LeftHide } from "./remix/eye-line.svg";
310+
export { ReactComponent as LeftLock } from "./remix/lock-line.svg";
311+
export { ReactComponent as LeftUnlock } from "./remix/lock-unlock-line.svg";
305312

306313

307314
// new

client/packages/lowcoder/src/comps/comps/containerComp/containerView.tsx

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,14 +230,27 @@ const onDrop = (
230230
};
231231
const key = genRandomKey();
232232
const layoutItem = Object.values(items)[0];
233+
// calculate postion of newly added comp
234+
// should have last position in the comps list
235+
let itemPos = 0;
236+
if (!Object.keys(layout).length) {
237+
itemPos = 0;
238+
} else {
239+
itemPos = Math.max(...Object.values(layout).map(l => l.pos || 0)) + 1;
240+
}
233241
// log.debug("layout: onDrop. widgetValue: ", widgetValue, " layoutItem: ", layoutItem);
234242
dispatch(
235243
wrapActionExtraInfo(
236244
multiChangeAction({
237245
layout: changeValueAction(
238246
{
239247
...layout,
240-
[key]: { ...layoutItem, i: key, placeholder: undefined },
248+
[key]: {
249+
...layoutItem,
250+
i: key,
251+
placeholder: undefined,
252+
pos: itemPos,
253+
},
241254
},
242255
true
243256
),
@@ -463,6 +476,7 @@ export function InnerGrid(props: ViewPropsWithSelect) {
463476
layout={props.layout}
464477
extraLayout={extraLayout}
465478
onDropDragOver={(e) => {
479+
466480
const compType = draggingUtils.getData<UICompType>("compType");
467481
const compLayout = draggingUtils.getData<UICompLayoutInfo>("compLayout");
468482
if (compType) {

client/packages/lowcoder/src/comps/comps/textComp.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ const getStyle = (style: TextStyleType) => {
3737
margin: ${style.margin} !important;
3838
padding: ${style.padding};
3939
width: ${widthCalculator(style.margin)};
40-
height: ${heightCalculator(style.margin)};
40+
// height: ${heightCalculator(style.margin)};
4141
h1 {
4242
line-height: 1.5;
4343
}

client/packages/lowcoder/src/comps/editorState.tsx

Lines changed: 66 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@ import { RootComp as RootCompTmp } from "comps/comps/rootComp";
33
import { PositionParams } from "layout";
44
import _ from "lodash";
55
import React, { ReactNode } from "react";
6-
import { BottomResComp, BottomResListComp, BottomResTypeEnum } from "types/bottomRes";
6+
import {
7+
BottomResComp,
8+
BottomResListComp,
9+
BottomResTypeEnum,
10+
} from "types/bottomRes";
711
import { setFields } from "util/objectUtils";
812
import { OptionalComp, renameAction } from "lowcoder-core";
913
import { GridItemComp } from "./comps/gridItemComp";
@@ -13,7 +17,7 @@ import { NameAndExposingInfo } from "./utils/exposingTypes";
1317
import { checkName } from "./utils/rename";
1418
import { trans } from "i18n";
1519
import { UiLayoutType } from "./comps/uiComp";
16-
import { getEditorModeStatus } from "util/localStorageUtil";
20+
import { getCollisionStatus, getEditorModeStatus } from "util/localStorageUtil";
1721

1822
type RootComp = InstanceType<typeof RootCompTmp>;
1923

@@ -43,6 +47,7 @@ export class EditorState {
4347
readonly showPropertyPane: boolean = false;
4448
readonly selectedCompNames: Set<string> = new Set();
4549
readonly editorModeStatus: string = "";
50+
readonly collisionStatus: string = "";
4651
readonly isDragging: boolean = false;
4752
readonly draggingCompType: string = "button";
4853
readonly forceShowGrid: boolean = false; // show grid lines
@@ -52,16 +57,20 @@ export class EditorState {
5257
readonly showResultCompName: string = "";
5358
readonly selectSource?: SelectSourceType; // the source of select type
5459

55-
private readonly setEditorState: (fn: (editorState: EditorState) => EditorState) => void;
60+
private readonly setEditorState: (
61+
fn: (editorState: EditorState) => EditorState
62+
) => void;
5663

5764
constructor(
5865
rootComp: RootComp,
5966
setEditorState: (fn: (editorState: EditorState) => EditorState) => void,
60-
initialEditorModeStatus: string = getEditorModeStatus()
67+
initialEditorModeStatus: string = getEditorModeStatus(),
68+
initialCollisionStatus: string = getCollisionStatus()
6169
) {
6270
this.rootComp = rootComp;
6371
this.setEditorState = setEditorState;
6472
this.editorModeStatus = initialEditorModeStatus;
73+
this.collisionStatus = initialCollisionStatus;
6574
}
6675

6776
/**
@@ -79,7 +88,10 @@ export class EditorState {
7988
}
8089

8190
getAllCompMap() {
82-
return { ...this.getAllHooksCompMap(), ...this.getUIComp().getAllCompItems() };
91+
return {
92+
...this.getAllHooksCompMap(),
93+
...this.getUIComp().getAllCompItems(),
94+
};
8395
}
8496

8597
getAllUICompMap() {
@@ -104,7 +116,9 @@ export class EditorState {
104116
*/
105117
getUICompByName(name: string) {
106118
const compMap = this.getAllUICompMap();
107-
return Object.values(compMap).find((item) => item.children.name.getView() === name);
119+
return Object.values(compMap).find(
120+
(item) => item.children.name.getView() === name
121+
);
108122
}
109123

110124
getNameGenerator() {
@@ -120,17 +134,22 @@ export class EditorState {
120134

121135
uiCompInfoList(): Array<CompInfo> {
122136
const compMap = this.getAllUICompMap();
123-
return Object.values(compMap).map((item) => {
137+
return Object.entries(compMap).map(([key, item]) => {
124138
return {
125139
name: item.children.name.getView(),
126140
type: item.children.compType.getView(),
127141
data: item.children.comp.exposingValues,
128142
dataDesc: item.children.comp.exposingInfo().propertyDesc,
143+
key: key,
129144
};
130145
});
131146
}
132147

133-
getCompInfo(nameAndExposingInfo: NameAndExposingInfo, name: string, type: string): CompInfo {
148+
getCompInfo(
149+
nameAndExposingInfo: NameAndExposingInfo,
150+
name: string,
151+
type: string
152+
): CompInfo {
134153
return {
135154
name,
136155
type,
@@ -157,7 +176,11 @@ export class EditorState {
157176
const exposingInfo = listComp.nameAndExposingInfo();
158177
return listComp.getView().map((item) => {
159178
const name = item.children.name.getView();
160-
return this.getCompInfo(exposingInfo, name, BottomResTypeEnum.DateResponder);
179+
return this.getCompInfo(
180+
exposingInfo,
181+
name,
182+
BottomResTypeEnum.DateResponder
183+
);
161184
});
162185
}
163186

@@ -175,7 +198,11 @@ export class EditorState {
175198
const exposingInfo = listComp.nameAndExposingInfo();
176199
return listComp.getView().map((item) => {
177200
const name = item.children.name.getView();
178-
return this.getCompInfo(exposingInfo, name, BottomResTypeEnum.Transformer);
201+
return this.getCompInfo(
202+
exposingInfo,
203+
name,
204+
BottomResTypeEnum.Transformer
205+
);
179206
});
180207
}
181208

@@ -222,7 +249,10 @@ export class EditorState {
222249
}
223250

224251
selectedQueryComp() {
225-
if (this.selectedBottomResType !== BottomResTypeEnum.Query || !this.selectedBottomResName) {
252+
if (
253+
this.selectedBottomResType !== BottomResTypeEnum.Query ||
254+
!this.selectedBottomResName
255+
) {
226256
return undefined;
227257
}
228258
return this.getQueriesComp()
@@ -233,7 +263,9 @@ export class EditorState {
233263
}
234264

235265
showResultComp(): BottomResComp | undefined {
236-
const bottomResComps = Object.values(BottomResTypeEnum).reduce<BottomResComp[]>((a, b) => {
266+
const bottomResComps = Object.values(BottomResTypeEnum).reduce<
267+
BottomResComp[]
268+
>((a, b) => {
237269
const items = this.getBottomResListComp(b).items();
238270
return a.concat(items);
239271
}, []);
@@ -279,7 +311,10 @@ export class EditorState {
279311
return this.getUIComp().getComp();
280312
}
281313
const [key, comp] = _.toPairs(selectedComps)[0];
282-
if (_.size(selectedComps) === 1 && isContainer((comp as GridItemComp)?.children?.comp)) {
314+
if (
315+
_.size(selectedComps) === 1 &&
316+
isContainer((comp as GridItemComp)?.children?.comp)
317+
) {
283318
return comp.children.comp;
284319
}
285320

@@ -307,7 +342,9 @@ export class EditorState {
307342
isCompSelected(compName: string): OptionalComp {
308343
const compMap = this.getAllCompMap();
309344
return Object.values(compMap).find(
310-
(item) => item.children.name.getView() === compName && this.selectedCompNames.has(compName)
345+
(item) =>
346+
item.children.name.getView() === compName &&
347+
this.selectedCompNames.has(compName)
311348
);
312349
}
313350

@@ -319,6 +356,10 @@ export class EditorState {
319356
this.changeState({ editorModeStatus: newEditorModeStatus });
320357
}
321358

359+
setCollisionStatus(newCollisionStatus: string) {
360+
this.changeState({ collisionStatus: newCollisionStatus });
361+
}
362+
322363
setDragging(dragging: boolean) {
323364
if (this.isDragging === dragging) {
324365
return;
@@ -356,7 +397,10 @@ export class EditorState {
356397
});
357398
}
358399

359-
setSelectedCompNames(selectedCompNames: Set<string>, selectSource?: SelectSourceType) {
400+
setSelectedCompNames(
401+
selectedCompNames: Set<string>,
402+
selectSource?: SelectSourceType
403+
) {
360404
if (selectedCompNames.size === 0 && this.selectedCompNames.size === 0) {
361405
return;
362406
}
@@ -406,7 +450,9 @@ export class EditorState {
406450
}
407451

408452
getBottomResComp(name: string): BottomResComp | undefined {
409-
const bottomResComps = Object.values(BottomResTypeEnum).reduce<BottomResComp[]>((a, b) => {
453+
const bottomResComps = Object.values(BottomResTypeEnum).reduce<
454+
BottomResComp[]
455+
>((a, b) => {
410456
const items = this.getBottomResListComp(b).items();
411457
return a.concat(items);
412458
}, []);
@@ -467,8 +513,11 @@ export class EditorState {
467513
getAppType(): UiLayoutType {
468514
return this.getUIComp().children.compType.getView();
469515
}
516+
getCollisionStatus(): string {
517+
return this.collisionStatus;
518+
}
519+
470520
}
471-
472521
export const EditorContext = React.createContext<EditorState>(undefined as any);
473522

474523
// current comp name

client/packages/lowcoder/src/constants/Layers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export const Layers = {
3030
// comp selection wrapper
3131
dragSelectBox: 399,
3232
//
33-
compHover: 300,
33+
compHover: 100,
3434
//
3535
compSelected: 200,
3636
//

client/packages/lowcoder/src/i18n/locales/en.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,12 @@ export const en = {
104104
"components": "Active Components",
105105
"modals": "in-App Modals",
106106
"expandTip": "Click to Expand {component}'s Data",
107-
"collapseTip": "Click to Collapse {component}'s Data"
107+
"collapseTip": "Click to Collapse {component}'s Data",
108+
"layers": "Layers",
109+
"activatelayers": "Use Layers in this App",
110+
"selectedComponents": "Selected Components...",
111+
"displayComponents": "control Display",
112+
"lockComponents": "control Position",
108113
},
109114

110115
// second part

client/packages/lowcoder/src/i18n/locales/zh.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,10 @@ leftPanel: {
106106
components: "组件",
107107
modals: "对话框",
108108
expandTip: "点击展开 {component} 的数据",
109-
collapseTip: "点击折叠 {component} 的数据"
109+
collapseTip: "点击折叠 {component} 的数据",
110+
layers: "图层",
111+
activatelayers: "激活图层",
112+
selectedComponents: "已选组件",
110113
},
111114
bottomPanel: {
112115
title: "查询",

0 commit comments

Comments
 (0)