Skip to content

Commit

Permalink
Merge pull request #337 from lvhuichao/develop
Browse files Browse the repository at this point in the history
PR 0323
  • Loading branch information
neon-balcony authored Mar 23, 2023
2 parents aa8bc2d + 9a1f4d5 commit 648aae5
Show file tree
Hide file tree
Showing 25 changed files with 340 additions and 149 deletions.
1 change: 1 addition & 0 deletions client/packages/openblocks-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": "openblocks-cli",
"description": "CLI tool used to start build publish openblocks components",
"version": "0.0.24",
"license": "MIT",
"bin": "./index.js",
"type": "module",
"exports": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,13 @@ let CalendarBasicComp = (function () {
});
};

let initialDate = defaultDate;
try {
initialDate = new Date(defaultDate).toISOString();
} catch (error) {
initialDate = undefined;
}

return (
<Wrapper
ref={ref}
Expand All @@ -287,6 +294,7 @@ let CalendarBasicComp = (function () {
theme={theme?.theme}
onDoubleClick={handleDbClick}
left={left}
key={initialDate ? defaultView + initialDate : defaultView}
>
<FullCalendar
slotEventOverlap={false}
Expand Down Expand Up @@ -323,7 +331,7 @@ let CalendarBasicComp = (function () {
slotLabelFormat={slotLabelFormat}
viewClassNames={viewClassNames}
moreLinkText={trans("calendar.more")}
initialDate={defaultDate}
initialDate={initialDate}
initialView={defaultView}
editable={editable}
selectable={editable}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ export const en = {
friday: "Friday",
saturday: "Saturday",
sunday: "Sunday",
startWeek: "Start week on",
startWeek: "Start from",
creatEvent: "Create event",
editEvent: "Edit event",
eventName: "Event name",
Expand Down
15 changes: 15 additions & 0 deletions client/packages/openblocks-core/lib/index.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,9 @@ var FunctionNode = /** @class */ (function (_super) {
__decorate([
memoized()
], FunctionNode.prototype, "filterNodes", null);
__decorate([
memoized()
], FunctionNode.prototype, "fetchInfo", null);
return FunctionNode;
}(AbstractNode));
function withFunction(child, func) {
Expand Down Expand Up @@ -395,6 +398,9 @@ var RecordNode = /** @class */ (function (_super) {
__decorate([
memoized()
], RecordNode.prototype, "filterNodes", null);
__decorate([
memoized()
], RecordNode.prototype, "fetchInfo", null);
return RecordNode;
}(AbstractNode));
function fromRecord(record) {
Expand Down Expand Up @@ -1717,6 +1723,9 @@ var CodeNode = /** @class */ (function (_super) {
__decorate([
memoized()
], CodeNode.prototype, "filterDirectDepends", null);
__decorate([
memoized()
], CodeNode.prototype, "fetchInfo", null);
return CodeNode;
}(AbstractNode));
/**
Expand Down Expand Up @@ -1765,6 +1774,9 @@ var FetchCheckNode = /** @class */ (function (_super) {
__decorate([
memoized()
], FetchCheckNode.prototype, "filterNodes", null);
__decorate([
memoized()
], FetchCheckNode.prototype, "fetchInfo", null);
return FetchCheckNode;
}(AbstractNode));
function isFetching(node) {
Expand Down Expand Up @@ -2893,6 +2905,9 @@ var WrapNode = /** @class */ (function (_super) {
__decorate([
memoized()
], WrapNode.prototype, "filterNodes", null);
__decorate([
memoized()
], WrapNode.prototype, "fetchInfo", null);
return WrapNode;
}(AbstractNode));

Expand Down
15 changes: 15 additions & 0 deletions client/packages/openblocks-core/lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,9 @@ var FunctionNode = /** @class */ (function (_super) {
__decorate([
memoized()
], FunctionNode.prototype, "filterNodes", null);
__decorate([
memoized()
], FunctionNode.prototype, "fetchInfo", null);
return FunctionNode;
}(AbstractNode));
function withFunction(child, func) {
Expand Down Expand Up @@ -387,6 +390,9 @@ var RecordNode = /** @class */ (function (_super) {
__decorate([
memoized()
], RecordNode.prototype, "filterNodes", null);
__decorate([
memoized()
], RecordNode.prototype, "fetchInfo", null);
return RecordNode;
}(AbstractNode));
function fromRecord(record) {
Expand Down Expand Up @@ -1709,6 +1715,9 @@ var CodeNode = /** @class */ (function (_super) {
__decorate([
memoized()
], CodeNode.prototype, "filterDirectDepends", null);
__decorate([
memoized()
], CodeNode.prototype, "fetchInfo", null);
return CodeNode;
}(AbstractNode));
/**
Expand Down Expand Up @@ -1757,6 +1766,9 @@ var FetchCheckNode = /** @class */ (function (_super) {
__decorate([
memoized()
], FetchCheckNode.prototype, "filterNodes", null);
__decorate([
memoized()
], FetchCheckNode.prototype, "fetchInfo", null);
return FetchCheckNode;
}(AbstractNode));
function isFetching(node) {
Expand Down Expand Up @@ -2885,6 +2897,9 @@ var WrapNode = /** @class */ (function (_super) {
__decorate([
memoized()
], WrapNode.prototype, "filterNodes", null);
__decorate([
memoized()
], WrapNode.prototype, "fetchInfo", null);
return WrapNode;
}(AbstractNode));

Expand Down
1 change: 1 addition & 0 deletions client/packages/openblocks-core/src/eval/codeNode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ export class CodeNode extends AbstractNode<ValueAndMsg<unknown>> {
return ret;
}

@memoized()
override fetchInfo(
exposingNodes: Record<string, Node<unknown>>,
options?: FetchInfoOptions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export class FetchCheckNode extends AbstractNode<FetchInfo> {
return this.child.dependValues();
}

@memoized()
override fetchInfo(exposingNodes: Record<string, Node<unknown>>) {
return this.child.fetchInfo(exposingNodes, this.options);
}
Expand Down
1 change: 1 addition & 0 deletions client/packages/openblocks-core/src/eval/functionNode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export class FunctionNode<T, OutputType> extends AbstractNode<OutputType> {
return this.child.dependValues();
}

@memoized()
override fetchInfo(exposingNodes: Record<string, Node<unknown>>, options?: FetchInfoOptions) {
return this.child.fetchInfo(exposingNodes, options);
}
Expand Down
1 change: 1 addition & 0 deletions client/packages/openblocks-core/src/eval/recordNode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export class RecordNode<T extends Record<string, Node<unknown>>> extends Abstrac
return ret;
}

@memoized()
override fetchInfo(exposingNodes: Record<string, Node<unknown>>, options?: FetchInfoOptions) {
let isFetching = false;
let ready = true;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export type EvalMethods = Record<string, Record<string, Function>>;

export type CodeType = undefined | "JSON" | "Function";
export type CodeType = undefined | "JSON" | "Function" | "PureJSON";

export type CodeFunction = (args?: Record<string, unknown>, runInHost?: boolean) => any;
1 change: 1 addition & 0 deletions client/packages/openblocks-core/src/eval/wrapNode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export class WrapNode<T> extends AbstractNode<T> {
return this.delegate.evaluate(this.wrap(exposingNodes, methods), this.moduleExposingMethods);
}

@memoized()
override fetchInfo(exposingNodes: Record<string, Node<unknown>>) {
return this.delegate.fetchInfo(this.wrap(exposingNodes, {}));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ export const BaseSection = (props: ISectionConfig<ReactNode>) => {
<SectionLabelDiv onClick={handleToggle} className={"section-header"}>
<SectionLabel>{props.name}</SectionLabel>
<div style={{ display: "flex" }}>
{props.additionalButton}
{open && props.additionalButton}
<PackupIcon deg={open ? "rotate(0deg)" : "rotate(180deg)"} />
</div>
</SectionLabelDiv>
Expand Down
5 changes: 4 additions & 1 deletion client/packages/openblocks-design/src/components/edit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,10 @@ export const EditText = (props: EditTextProps) => {
{props.text}
</TextWrapper>
<EditIcon
onClick={() => !props.disabled && setEditing(true)}
onClick={(e) => {
e.stopPropagation();
!props.disabled && setEditing(true);
}}
className={"taco-edit-text-icon"}
/>
</EditTextWrapper>
Expand Down
3 changes: 2 additions & 1 deletion client/packages/openblocks-sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,6 @@
},
"keywords": [
"openblocks"
]
],
"license": "MIT"
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import styled from "styled-components";
import { DraggableTreeContext } from "./DraggableTreeContext";

const Wrapper = styled.div<{
showPositionLine: boolean;
dragging: boolean;
isOver: boolean;
dropInAsSub: boolean;
Expand All @@ -27,7 +28,9 @@ const Wrapper = styled.div<{
&::before {
content: "";
display: ${(props) =>
(props.showPositionLineDot ?? false) && props.isOver ? "block" : "none"};
(props.showPositionLineDot ?? false) && props.isOver && props.showPositionLine
? "block"
: "none"};
position: absolute;
background-color: #315efb;
height: ${(props) => props.positionLineDotDiameter}px;
Expand All @@ -43,7 +46,7 @@ const Wrapper = styled.div<{
&::after {
content: "";
display: ${(props) => (props.isOver ? "block" : "none")};
display: ${(props) => (props.isOver && props.showPositionLine ? "block" : "none")};
height: ${(props) => props.positionLineHeight ?? 4}px;
border-radius: 4px;
position: absolute;
Expand Down Expand Up @@ -76,8 +79,10 @@ function DraggableItem(props: IProps, ref: Ref<HTMLDivElement>) {
} = props;
const context = useContext(DraggableTreeContext);
const positionLineIndent = context.positionLineIndent?.(path, dropInAsSub);
const showPositionLine = (context.showDropInPositionLine ?? true) || !dropInAsSub;
return (
<Wrapper
showPositionLine={showPositionLine}
positionLineIndent={positionLineIndent}
positionLineDotDiameter={context.positionLineDotDiameter}
showPositionLineDot={context.showPositionLineDot}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export interface DraggableTreeContextValue {
showPositionLineDot?: boolean;
positionLineDotDiameter?: number;
showSubInDragOverlay?: boolean;
showDropInPositionLine?: boolean;
positionLineIndent?(path: number[], dropInAsSub: boolean): number;

toggleFold(id: string): void;
Expand Down
Loading

0 comments on commit 648aae5

Please sign in to comment.