Skip to content

Commit 8cdcda8

Browse files
authored
Merge pull request #78 from objectstack-ai/copilot/fix-action-run-issue
2 parents b5ad57c + 1714bfc commit 8cdcda8

File tree

6 files changed

+31
-15
lines changed

6 files changed

+31
-15
lines changed

examples/designer-modes/src/App.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useState } from 'react';
1+
import { useState } from 'react';
22
import { Designer, type DesignerMode } from '@object-ui/designer';
33
import type { SchemaNode } from '@object-ui/core';
44

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import React from 'react';
2-
import ReactDOM from 'react-dom/client';
1+
import { StrictMode } from 'react';
2+
import { createRoot } from 'react-dom/client';
33
import App from './App';
44
import './index.css';
55

6-
ReactDOM.createRoot(document.getElementById('root')!).render(
7-
<React.StrictMode>
6+
createRoot(document.getElementById('root')!).render(
7+
<StrictMode>
88
<App />
9-
</React.StrictMode>,
9+
</StrictMode>,
1010
);

examples/designer-modes/tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"useDefineForClassFields": true,
55
"lib": ["ES2020", "DOM", "DOM.Iterable"],
66
"module": "ESNext",
7+
"types": ["vite/client"],
78
"skipLibCheck": true,
89

910
/* Bundler mode */

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"scripts": {
1717
"dev": "pnpm --filter prototype dev",
1818
"start": "pnpm --filter prototype dev",
19-
"build": "pnpm -r build",
19+
"build": "pnpm --filter './packages/*' -r build && pnpm --filter './examples/*' -r build",
2020
"pretest": "pnpm --filter @object-ui/types build && pnpm --filter @object-ui/core build && pnpm --filter @object-ui/react build && pnpm --filter @object-ui/components build",
2121
"test": "vitest run",
2222
"docs:dev": "pnpm --filter object-ui-docs dev",

packages/components/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
"version": "0.2.0",
44
"type": "module",
55
"license": "MIT",
6-
"main": "dist/index.umd.js",
7-
"module": "dist/index.mjs",
6+
"main": "dist/index.umd.cjs",
7+
"module": "dist/index.js",
88
"types": "dist/index.d.ts",
99
"exports": {
1010
".": {
1111
"types": "./dist/index.d.ts",
12-
"import": "./dist/index.mjs",
13-
"require": "./dist/index.umd.js"
12+
"import": "./dist/index.js",
13+
"require": "./dist/index.umd.cjs"
1414
},
1515
"./dist/style.css": "./dist/style.css"
1616
},

packages/designer/src/components/CanvasDesigner.tsx

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import { useKeyboardShortcuts } from '../hooks/useKeyboardShortcuts';
1818
import type { SchemaNode } from '@object-ui/core';
1919
import type { CanvasDesignerConfig } from '../types/designer-modes';
2020
import { SchemaRenderer } from '@object-ui/react';
21-
import { ResizeHandles } from './ResizeHandle';
21+
import { ResizeHandles, type ResizeDirection } from './ResizeHandle';
2222
import { ComponentRegistry } from '@object-ui/core';
2323
import { cn } from '@object-ui/components';
2424

@@ -158,7 +158,22 @@ const FreeFormCanvas: React.FC<{ showGrid?: boolean; gridSize?: number }> = ({
158158

159159
return nodes.map((node) => {
160160
const isSelected = node.id === selectedNodeId;
161-
const isResizable = ComponentRegistry.getConfig(node.type)?.resizable || false;
161+
const config = ComponentRegistry.getConfig(node.type);
162+
const isResizable = config?.resizable || false;
163+
164+
// Determine which directions to show based on constraints
165+
const constraints = config?.resizeConstraints || {};
166+
const directions: ResizeDirection[] = [];
167+
168+
if (constraints.width !== false) {
169+
directions.push('e', 'w');
170+
}
171+
if (constraints.height !== false) {
172+
directions.push('n', 's');
173+
}
174+
if (constraints.width !== false && constraints.height !== false) {
175+
directions.push('ne', 'nw', 'se', 'sw');
176+
}
162177

163178
return (
164179
<div
@@ -186,8 +201,8 @@ const FreeFormCanvas: React.FC<{ showGrid?: boolean; gridSize?: number }> = ({
186201
{/* Resize handles for selected node */}
187202
{isSelected && isResizable && (
188203
<ResizeHandles
189-
nodeId={node.id || ''}
190-
onResizeStart={(direction) => {
204+
directions={directions}
205+
onResizeStart={(direction, e) => {
191206
const element = document.querySelector(`[data-obj-id="${node.id}"]`) as HTMLElement;
192207
if (element) {
193208
setResizingNode({

0 commit comments

Comments
 (0)