Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

improve [properties] - inline editor improvements (#35)

Daniel Kweon188fe34a7a9f
diff --git a/js/app/packages/core/component/Properties/components/property-display/NumberValue.tsx b/js/app/packages/core/component/Properties/components/property-display/NumberValue.tsx
index 9e2c3235da..226f3fadfb 100644
--- a/js/app/packages/core/component/Properties/components/property-display/NumberValue.tsx
+++ b/js/app/packages/core/component/Properties/components/property-display/NumberValue.tsx
@@ -107,7 +107,6 @@ export const NumberValue: Component<NumberValueProps> = (props) => {
ref={(el) => {
setTimeout(() => {
el.focus();
- el.setSelectionRange(el.value.length, el.value.length);
}, 0);
}}
type="number"
diff --git a/js/app/packages/core/component/Properties/components/property-display/TextValue.tsx b/js/app/packages/core/component/Properties/components/property-display/TextValue.tsx
index 2b065ea38e..33193c25e9 100644
--- a/js/app/packages/core/component/Properties/components/property-display/TextValue.tsx
+++ b/js/app/packages/core/component/Properties/components/property-display/TextValue.tsx
@@ -101,27 +101,26 @@ export const TextValue: Component<TextValueProps> = (props) => {
supportsInline()
? 'hover:bg-hover cursor-pointer bg-transparent text-ink'
: 'bg-transparent text-ink-muted cursor-default'
- } inline-block max-w-full break-words`}
+ } block max-w-full break-words`}
title={displayValue}
>
- <span class="block truncate max-w-full">{displayValue}</span>
+ <span class="block max-w-full">{displayValue}</span>
</button>
}
>
- <input
+ <textarea
ref={(el) => {
setTimeout(() => {
el.focus();
el.setSelectionRange(el.value.length, el.value.length);
}, 0);
}}
- type="text"
value={editor.inputValue()}
onInput={(e) => editor.setInputValue(e.currentTarget.value)}
onBlur={editor.save}
onKeyDown={handleKeyDown}
disabled={editor.isSaving()}
- class="w-full text-left text-ink text-xs px-2 py-1 border border-edge bg-transparent focus:outline-none focus:border-accent"
+ class="w-full field-sizing-content resize-none text-left text-ink text-xs px-2 py-1 border border-edge bg-transparent focus:outline-none focus:border-accent"
/>
</Show>
);
diff --git a/js/app/packages/core/component/Properties/utils.ts b/js/app/packages/core/component/Properties/utils.ts
index 9ec0b0a47d..9962feca24 100644
--- a/js/app/packages/core/component/Properties/utils.ts
+++ b/js/app/packages/core/component/Properties/utils.ts
@@ -6,8 +6,14 @@ type PropertyValueUnion = string | number | Date | boolean;
/**
* Format a number to show up to 4 decimal places
+ * Uses exponential notation for numbers beyond safe integer range
*/
export function formatNumber(value: number): string {
+ // Use exponential notation for numbers beyond 15 digits
+ // 15 is the largest js can handle
+ if (Math.abs(value) >= 1e15 || (value !== 0 && Math.abs(value) < 1e-15)) {
+ return value.toExponential(NUMBER_DECIMAL_PLACES);
+ }
// Round to 4 decimal places and remove trailing zeros
const rounded = parseFloat(value.toFixed(NUMBER_DECIMAL_PLACES));
return rounded.toString();