Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 536477c

Browse files
committed
Synced and resolved conflicts.
2 parents ee5651d + 7146d3a commit 536477c

File tree

26 files changed

+350
-240
lines changed

26 files changed

+350
-240
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,3 +81,4 @@ You can access Openblocks from [cloud-hosted version](https://cloud.openblocks.d
8181
- [File upload with REST API](https://cloud.openblocks.dev/apps/63a2651e660ad97d59eb4a51/view)
8282
- [Shopping cart demo using transformers/state/drawer](https://cloud.openblocks.dev/apps/63a422a344075b798fe3ae06/view)
8383
- [Module demo: color picker](https://cloud.openblocks.dev/apps/63a58f1e85d4cb49cebad1d4/view)
84+
- [S3 File Management](https://cloud.openblocks.dev/apps/63c7aa55686c4f301cf4d755/view)

client/packages/create-openblocks-plugin/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env node
22
import fs from "fs-extra";
33
import path from "node:path";
4-
import { spawn } from "node:child_process";
4+
import { spawn } from "cross-spawn";
55
import { writeFileSync, existsSync } from "node:fs";
66
import chalk from "chalk";
77
import { createCommand } from "commander";

client/packages/create-openblocks-plugin/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
{
22
"name": "create-openblocks-plugin",
3-
"version": "0.0.2",
3+
"version": "0.0.3",
44
"bin": "./index.js",
55
"type": "module",
66
"dependencies": {
77
"chalk": "4",
88
"commander": "^9.4.1",
9+
"cross-spawn": "^7.0.3",
910
"fs-extra": "^10.1.0",
1011
"openblocks-dev-utils": "workspace:^"
1112
},

client/packages/openblocks-cli/actions/init.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import path from "path";
22
import fs from "fs-extra";
3-
import { spawn } from "child_process";
3+
import { spawn } from "cross-spawn";
44
import paths from "../config/paths.js";
55
import { createRequire } from "node:module";
66
const require = createRequire(import.meta.url);
@@ -84,9 +84,9 @@ export default async function initAction(options) {
8484

8585
const notCopiedFiles = ["package.json", "README.md", "README-template.md", "node_modules"];
8686
fs.copySync(templateDir, "./", {
87-
filter: (src) => notCopiedFiles.every((i) => !src.startsWith(`${templateDir}/${i}`)),
87+
filter: (src) => notCopiedFiles.every((i) => !src.startsWith(path.join(templateDir, i))),
8888
});
89-
fs.copyFile(`${templateDir}/README-template.md`, "./README.md");
89+
fs.copyFile(path.join(templateDir, "README-template.md"), "./README.md");
9090
console.log("template files copied");
9191

9292
const dependencies = [];

client/packages/openblocks-cli/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "openblocks-cli",
33
"description": "CLI tool used to start build publish openblocks components",
4-
"version": "0.0.22",
4+
"version": "0.0.24",
55
"bin": "./index.js",
66
"type": "module",
77
"exports": {
@@ -26,6 +26,7 @@
2626
"axios": "^1.1.3",
2727
"chalk": "4",
2828
"commander": "^9.4.1",
29+
"cross-spawn": "^7.0.3",
2930
"fs-extra": "^10.1.0",
3031
"openblocks-dev-utils": "workspace:^",
3132
"react": "^17",
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
import { Typography } from "antd";
2+
import React from "react";
3+
import styled from "styled-components";
4+
5+
const AntdTypographyText = styled(Typography.Text)`
6+
font-size: 14px;
7+
color: #333333;
8+
line-height: 14px;
9+
overflow: hidden;
10+
text-overflow: ellipsis;
11+
display: block;
12+
13+
:is(.ant-typography-edit-content) {
14+
color: red;
15+
padding: unset;
16+
margin: unset !important;
17+
left: unset;
18+
}
19+
20+
.ant-input,
21+
.ant-input:focus,
22+
.ant-input-focused {
23+
height: 24px !important;
24+
min-height: 24px;
25+
background: #ffffff;
26+
border: 1px solid #3377ff;
27+
border-radius: 4px;
28+
padding: 4px 8px;
29+
margin: -5px 0 3px -9px;
30+
white-space: nowrap;
31+
32+
font-size: 14px;
33+
color: #333333;
34+
line-height: 14px;
35+
36+
::-webkit-scrollbar {
37+
display: none;
38+
}
39+
}
40+
`;
41+
42+
export const TypographyText = (props: {
43+
value: string;
44+
editing: boolean;
45+
onChange: (value: string) => void;
46+
}) => (
47+
<AntdTypographyText
48+
title={props.value}
49+
ellipsis={true}
50+
editable={{
51+
enterIcon: null,
52+
tooltip: false,
53+
editing: props.editing,
54+
icon: null,
55+
triggerType: ["text"],
56+
onChange: props.onChange,
57+
}}
58+
>
59+
{props.value}
60+
</AntdTypographyText>
61+
);

client/packages/openblocks/src/components/layout/Layout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const SideBarV2 = styled(SideBar)`
2222
.sidebar-section:not(:last-child)::after {
2323
content: "";
2424
display: block;
25-
width: 192px;
25+
width: 204px;
2626
height: 1px;
2727
background-color: #ebebeb;
2828
margin: 0 auto 4px;

client/packages/openblocks/src/components/layout/SideBarItem.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const Wrapper = styled.div<{ size?: SideBarSize; selected?: boolean }>`
1212
border-radius: 4px;
1313
display: flex;
1414
align-items: center;
15-
padding: 0 26px;
15+
padding: 0 8px 0 26px;
1616
cursor: pointer;
1717
1818
:hover {

client/packages/openblocks/src/components/table/EditableCell.tsx

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -129,12 +129,3 @@ export function EditableCell<T extends JSONValue>(props: EditableCellProps<T>) {
129129
</ColumnTypeView>
130130
);
131131
}
132-
133-
export function updateChangeValueFn<T extends JSONValue>(
134-
dispatch: DispatchType,
135-
equalOriginFn: (value: T) => boolean
136-
) {
137-
return (value: T) => {
138-
dispatch(changeChildAction("changeValue", equalOriginFn(value) ? null : value));
139-
};
140-
}

client/packages/openblocks/src/comps/comps/moduleComp/moduleComp.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -281,21 +281,22 @@ class ModuleTmpComp extends ModuleCompBase {
281281
this.dispatch(customAction<ModuleReadyAction>({ type: "moduleReady", comp }));
282282
});
283283

284-
return setFieldsNoTypeCheck(this, { moduleRootComp, moduleDsl });
284+
return setFieldsNoTypeCheck(this, { moduleDsl });
285285
}
286286

287287
// module ready
288288
if (isMyCustomAction<ModuleReadyAction>(action, "moduleReady")) {
289-
if (!this.moduleRootComp) {
289+
const moduleRootComp = action.value.comp;
290+
if (!moduleRootComp) {
290291
return this;
291292
}
292293

293294
let updateFields: Record<string, any> = {
294295
isReady: true,
295-
moduleRootComp: action.value.comp,
296+
moduleRootComp,
296297
};
297298

298-
const moduleLayoutComp = this.moduleRootComp.children.ui.getModuleLayoutComp();
299+
const moduleLayoutComp = moduleRootComp.children.ui.getModuleLayoutComp();
299300
if (moduleLayoutComp) {
300301
const inputs = moduleLayoutComp.getInputs().map((i) => i.getView());
301302
const inputChild = this.children.inputs.setInputs(inputs);

client/packages/openblocks/src/comps/comps/tableComp/column/tableColumnComp.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import { genRandomKey } from "comps/utils/idGenerator";
66
import { trans } from "i18n";
77
import _ from "lodash";
88
import {
9-
changeChildAction,
109
changeValueAction,
1110
ConstructorToComp,
1211
ConstructorToDataType,
@@ -16,7 +15,6 @@ import {
1615
fromRecord,
1716
multiChangeAction,
1817
withFunction,
19-
wrapChildAction,
2018
} from "openblocks-core";
2119
import { AlignClose, AlignLeft, AlignRight } from "openblocks-design";
2220
import { ColumnTypeComp, ColumnTypeCompMap } from "./columnTypeComp";

client/packages/openblocks/src/comps/comps/tableComp/tableComp.tsx

Lines changed: 23 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,12 @@ import { UICompBuilder, withPropertyViewFn, withViewFn } from "comps/generators"
1414
import { childrenToProps } from "comps/generators/multi";
1515
import { HidableView } from "comps/generators/uiCompBuilder";
1616
import { withDispatchHook } from "comps/generators/withDispatchHook";
17-
import { DepsConfig, NameConfig, withExposingConfigs } from "comps/generators/withExposing";
17+
import {
18+
depsConfig,
19+
DepsConfig,
20+
NameConfig,
21+
withExposingConfigs,
22+
} from "comps/generators/withExposing";
1823
import { withMethodExposing } from "comps/generators/withMethodExposing";
1924
import { trans } from "i18n";
2025
import _ from "lodash";
@@ -454,29 +459,27 @@ export const TableComp = withExposingConfigs(TableTmpComp, [
454459
},
455460
trans("table.selectedRowsDesc")
456461
),
457-
new DepsConfig(
458-
"changeSet",
459-
(children) => {
460-
return { columns: children.columns.exposingNode() };
461-
},
462-
(input) => {
462+
depsConfig({
463+
name: "changeSet",
464+
desc: trans("table.changeSetDesc"),
465+
depKeys: ["columns"],
466+
func: (input) => {
463467
const record: Record<string, Record<string, JSONValue>> = {};
464468
Object.values(input.columns).forEach((column: any) => {
465469
const dataIndex: string = column.dataIndex;
466470
// const title: string = column.title;
467471
const render = column.render; // {comp, map: [0].comp.changeValue, length}
468472
_.forEach(render.map, (value, key) => {
469473
const changeValue = value.comp?.changeValue;
470-
if (changeValue) {
474+
if (!_.isNil(changeValue)) {
471475
if (!record[key]) record[key] = {};
472476
record[key][dataIndex] = changeValue;
473477
}
474478
});
475479
});
476480
return record;
477481
},
478-
trans("table.changeSetDesc")
479-
),
482+
}),
480483
new DepsConfig(
481484
"pageNo",
482485
(children) => {
@@ -517,7 +520,7 @@ export const TableComp = withExposingConfigs(TableTmpComp, [
517520
},
518521
(input) => {
519522
const sortIndex = input.sort[0]?.column;
520-
const column = Object.values(input.columns).find(
523+
const column = Object.values(input.columns as any).find(
521524
(c: any) => c.dataIndex === sortIndex
522525
) as any;
523526
if (column?.isCustom && column?.title.value) {
@@ -528,18 +531,14 @@ export const TableComp = withExposingConfigs(TableTmpComp, [
528531
},
529532
trans("table.sortColumnDesc")
530533
),
531-
new DepsConfig(
532-
"sortDesc",
533-
(children) => {
534-
return {
535-
sort: children.sort.node(),
536-
};
537-
},
538-
(input) => {
534+
depsConfig({
535+
name: "sortDesc",
536+
desc: trans("table.sortDesc"),
537+
depKeys: ["sort"],
538+
func: (input) => {
539539
return input.sort[0]?.desc || false;
540540
},
541-
trans("table.sortDesc")
542-
),
541+
}),
543542
new DepsConfig(
544543
"pageOffset",
545544
(children) => {
@@ -579,7 +578,7 @@ export const TableComp = withExposingConfigs(TableTmpComp, [
579578
return getDisplayData(
580579
input.data,
581580
input.pagination,
582-
input.columns,
581+
input.columns as any,
583582
input.toolbar.filter,
584583
input.sort,
585584
input.toolbar.searchText.value,
@@ -593,11 +592,11 @@ export const TableComp = withExposingConfigs(TableTmpComp, [
593592
"filter",
594593
(children) => {
595594
return {
596-
toolbar: children.toolbar.node(),
595+
filter: children.toolbar.children.filter.node(),
597596
};
598597
},
599598
(input) => {
600-
return input.toolbar.filter;
599+
return input.filter;
601600
},
602601
trans("table.filterDesc")
603602
),

client/packages/openblocks/src/comps/comps/temporaryStateComp.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ export class TemporaryStateListComp
198198
]
199199
)
200200
);
201-
editorState.setSelectedBottomRes(name, BottomResTypeEnum.TempState);
201+
editorState.setSelectedBottomRes(newStateName, BottomResTypeEnum.TempState);
202202
}
203203

204204
delete(name: string) {

client/packages/openblocks/src/comps/comps/transformerListComp.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ export class TransformerListComp extends TransformerListCompBase implements Bott
176176
]
177177
)
178178
);
179-
editorState.setSelectedBottomRes(name, BottomResTypeEnum.Transformer);
179+
editorState.setSelectedBottomRes(newCompName, BottomResTypeEnum.Transformer);
180180
}
181181

182182
delete(name: string) {

client/packages/openblocks/src/comps/generators/uiCompBuilder.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import {
1212
ToNodeType,
1313
ViewFnTypeForComp,
1414
} from "./multi";
15-
import { ExposingConfig, withExposingConfigs } from "./withExposing";
15+
import { ChildrenToComp, ExposingConfig, withExposingConfigs } from "./withExposing";
1616
import {
1717
ExposeMethodCompConstructor,
1818
MethodConfigsType,
@@ -55,7 +55,7 @@ export class UICompBuilder<ChildrenCompMap extends Record<string, Comp<unknown>>
5555
private childrenMap: ToConstructor<ChildrenCompMap>;
5656
private viewFn: ViewFnTypeForComp<ViewReturn, NewChildren<ChildrenCompMap>>;
5757
private propertyViewFn: PropertyViewFnTypeForComp<NewChildren<ChildrenCompMap>> = () => null;
58-
private stateConfigs: ExposingConfig<ChildrenCompMap>[] = [];
58+
private stateConfigs: ExposingConfig<ChildrenToComp<ChildrenCompMap>>[] = [];
5959
private methodConfigs: MethodConfigsType<ExposeMethodCompConstructor<any>> = [];
6060

6161
/**
@@ -74,7 +74,7 @@ export class UICompBuilder<ChildrenCompMap extends Record<string, Comp<unknown>>
7474
return this;
7575
}
7676

77-
setExposeStateConfigs(configs: ExposingConfig<ChildrenCompMap>[]) {
77+
setExposeStateConfigs(configs: ExposingConfig<ChildrenToComp<ChildrenCompMap>>[]) {
7878
this.stateConfigs = configs;
7979
return this;
8080
}

0 commit comments

Comments
 (0)