Skip to content

Commit

Permalink
Merge pull request #565 from lowcoder-org/dev
Browse files Browse the repository at this point in the history
Dev -> Main - 2.2.0 hotfixes
  • Loading branch information
FalkWolsky authored Dec 5, 2023
2 parents 588093d + dcd674c commit e5f36ab
Show file tree
Hide file tree
Showing 31 changed files with 307 additions and 136 deletions.
2 changes: 1 addition & 1 deletion client/.yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
nodeLinker: node-modules

npmRegistryServer: "https://registry.npmmirror.com"
npmRegistryServer: "https://registry.npmjs.org"

plugins:
- path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs
Expand Down
4 changes: 2 additions & 2 deletions client/config/test/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import path from "node:path";
import { buildVars } from "lowcoder-dev-utils/buildVars.js";
import { currentDirName } from "lowcoder-dev-utils/util.js";
import { buildVars } from "../../packages/lowcoder-dev-utils/buildVars.js";
import { currentDirName } from "../../packages/lowcoder-dev-utils/util.js";

const globals = {};
buildVars.forEach(({ name, defaultValue }) => {
Expand Down
4 changes: 2 additions & 2 deletions client/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "taco-fe",
"version": "0.1.0",
"name": "lowcoder-root",
"version": "2.2.0",
"type": "module",
"private": true,
"workspaces": [
Expand Down
2 changes: 1 addition & 1 deletion client/packages/create-lowcoder-plugin/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { spawn } from "cross-spawn";
import { writeFileSync, existsSync } from "node:fs";
import chalk from "chalk";
import { createCommand } from "commander";
import { readJson, currentDirName } from "lowcoder-dev-utils/util.js";
import { readJson, currentDirName } from "../lowcoder-dev-utils/util.js";

const currentDir = currentDirName(import.meta.url);
const pkg = readJson(path.resolve(currentDir, "./package.json"));
Expand Down
2 changes: 1 addition & 1 deletion client/packages/lowcoder-cli/config/paths.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import path from "node:path";
import fs from "node:fs";
import { currentDirName } from "lowcoder-dev-utils/util.js";
import { currentDirName } from "../../lowcoder-dev-utils/util.js";

const currentDir = currentDirName(import.meta.url);
const appDirectory = fs.realpathSync(process.cwd());
Expand Down
6 changes: 3 additions & 3 deletions client/packages/lowcoder-cli/config/vite.config.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import react from "@vitejs/plugin-react";
import svgrPlugin from "vite-plugin-svgr";
import global from "rollup-plugin-external-globals";
import { buildVars } from "lowcoder-dev-utils/buildVars.js";
import { buildVars } from "../../lowcoder-dev-utils/buildVars.js";
import injectCss from "vite-plugin-css-injected-by-js";
import { getLibNames, getAllLibGlobalVarNames } from "lowcoder-dev-utils/external.js";
import { getLibNames, getAllLibGlobalVarNames } from "../../lowcoder-dev-utils/external.js";
import paths from "./paths.js";
import { defineConfig } from "vite";
import { readJson } from "lowcoder-dev-utils/util.js";
import { readJson } from "../../lowcoder-dev-utils/util.js";

const isProduction = process.env.NODE_ENV === "production";
const packageJson = readJson(paths.appPackageJson);
Expand Down
1 change: 1 addition & 0 deletions client/packages/lowcoder-dev-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"version": "0.0.6",
"license": "MIT",
"type": "module",
"main": "external.js",
"description": "Lowcoder dev utils for lowcoder build process and lowcoder-cli",
"keywords": [
"lowcoder"
Expand Down
2 changes: 1 addition & 1 deletion client/packages/lowcoder-plugin-demo/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { CompIDE } from "lowcoder-sdk";
import { name, version, lowcoder } from "./package.json";
import compMap from "./src/index";

import "lowcoder-sdk/dist/style.css";
import "../lowcoder-sdk/dist/style.css";

function CompDevApp() {
return (
Expand Down
6 changes: 3 additions & 3 deletions client/packages/lowcoder-sdk/vite.config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import react from "@vitejs/plugin-react";
import viteTsconfigPaths from "vite-tsconfig-paths";
import svgrPlugin from "vite-plugin-svgr";
import path from "path";
import { ensureLastSlash } from "lowcoder-dev-utils/util";
import { buildVars } from "lowcoder-dev-utils/buildVars";
import { globalDepPlugin } from "lowcoder-dev-utils/globalDepPlguin";
import { ensureLastSlash } from "../lowcoder-dev-utils/util";
import { buildVars } from "../lowcoder-dev-utils/buildVars";
import { globalDepPlugin } from "../lowcoder-dev-utils/globalDepPlguin";

const define = {};
buildVars.forEach(({ name, defaultValue }) => {
Expand Down
22 changes: 8 additions & 14 deletions client/packages/lowcoder/src/components/table/EditableCell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export interface CellProps {
size?: string;
candidateTags?: string[];
candidateStatus?: { text: string; status: StatusType }[];
textOverflow?: boolean;
}

export type CellViewReturn = (props: CellProps) => ReactNode;
Expand All @@ -43,17 +44,6 @@ export type EditViewFn<T> = (props: {
onChangeEnd: () => void;
}) => ReactNode;

export const SizeWrapper = styled.div<{ $size?: string }>`
${(props) =>
props.$size &&
`padding: ${
props.$size === "small" ? "8.5px 8px" : props.$size === "large" ? "16.5px 16px" : "12.5px 8px"
};
line-height: 21px;
min-height: ${props.$size === "small" ? "39px" : props.$size === "large" ? "55px" : "47px"};
`}
`;

const BorderDiv = styled.div`
position: absolute;
border: 1.5px solid #315efb;
Expand Down Expand Up @@ -127,11 +117,15 @@ export function EditableCell<T extends JSONValue>(props: EditableCellProps<T>) {
}

return (
<ColumnTypeView>
<ColumnTypeView
textOverflow={props.textOverflow}
>
{status === "toSave" && !isEditing && <EditableChip />}
<SizeWrapper $size={props.size} onDoubleClick={enterEditFn}>
<div
onDoubleClick={enterEditFn}
>
{normalView}
</SizeWrapper>
</div>
</ColumnTypeView>
);
}
26 changes: 17 additions & 9 deletions client/packages/lowcoder/src/components/table/columnTypeView.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
import React, { useEffect, useMemo, useRef, useState } from "react";
import styled from "styled-components";

const ColumnTypeViewWrapper = styled.div`
div {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
word-break: keep-all;
}
const ColumnTypeViewWrapper = styled.div<{
textOverflow?: boolean
}>`
${props => !props.textOverflow && `
div {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
word-break: keep-all;
}
`}
`;

const ColumnTypeHoverView = styled.div<{
Expand Down Expand Up @@ -62,7 +66,10 @@ function childIsOverflow(nodes: HTMLCollection): boolean {
return false;
}

export default function ColumnTypeView(props: { children: React.ReactNode }) {
export default function ColumnTypeView(props: {
children: React.ReactNode,
textOverflow?: boolean,
}) {
const wrapperRef = useRef<HTMLDivElement>(null);
const hoverViewRef = useRef<HTMLDivElement>(null);
const [isHover, setIsHover] = useState(false);
Expand Down Expand Up @@ -161,6 +168,7 @@ export default function ColumnTypeView(props: { children: React.ReactNode }) {
<>
<ColumnTypeViewWrapper
ref={wrapperRef}
textOverflow={props.textOverflow}
onMouseEnter={() => {
delayMouseEnter();
}}
Expand All @@ -171,7 +179,7 @@ export default function ColumnTypeView(props: { children: React.ReactNode }) {
>
{props.children}
</ColumnTypeViewWrapper>
{isHover && hasOverflow && wrapperRef.current && (
{isHover && hasOverflow && wrapperRef.current && !props.textOverflow && (
<ColumnTypeHoverView
ref={hoverViewRef}
visible={adjustedPosition.done}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import { ColumnTypeComp, ColumnTypeCompMap } from "./columnTypeComp";
import { ColorControl } from "comps/controls/colorControl";
import { JSONValue } from "util/jsonTypes";
import styled from "styled-components";
import { TextOverflowControl } from "comps/controls/textOverflowControl";

export type Render = ReturnType<ConstructorToComp<typeof RenderComp>["getOriginalComp"]>;
export const RenderComp = withSelectedMultiContext(ColumnTypeComp);
Expand Down Expand Up @@ -103,7 +104,8 @@ export const columnChildrenMap = {
borderWidth: withDefault(RadiusControl, ""),
radius: withDefault(RadiusControl, ""),
textSize: withDefault(RadiusControl, ""),
cellColor: CellColorComp,
cellColor: CellColorComp,
textOverflow: withDefault(TextOverflowControl, "ellipsis"),
};

const StyledIcon = styled.span`
Expand Down Expand Up @@ -228,6 +230,7 @@ export class ColumnComp extends ColumnInitComp {
preInputNode: <StyledIcon as={TextSizeIcon} title="" />,
placeholder: '14px',
})}
{this.children.textOverflow.getPropertyView()}
{this.children.cellColor.getPropertyView()}
</>
);
Expand Down
13 changes: 12 additions & 1 deletion client/packages/lowcoder/src/comps/comps/tableComp/tableComp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ import { lastValueIfEqual, shallowEqual } from "util/objectUtils";
import { IContainer } from "../containerBase";
import { getSelectedRowKeys } from "./selectionControl";
import { compTablePropertyView } from "./tablePropertyView";
import { RowColorComp, TableChildrenView, TableInitComp } from "./tableTypes";
import { RowColorComp, RowHeightComp, TableChildrenView, TableInitComp } from "./tableTypes";

import { useContext } from "react";
import { EditorContext } from "comps/editorState";
Expand Down Expand Up @@ -196,6 +196,17 @@ export class TableImplComp extends TableInitComp implements IContainer {
})
)
);
comp = comp.setChild(
"rowHeight",
comp.children.rowHeight.reduce(
RowHeightComp.changeContextDataAction({
currentRow: nextRowExample,
currentIndex: 0,
currentOriginalIndex: 0,
columnTitle: nextRowExample ? Object.keys(nextRowExample)[0] : undefined,
})
)
);
}

if (dataChanged) {
Expand Down
Loading

0 comments on commit e5f36ab

Please sign in to comment.