-
sanitizeInputSpec(x.detail, inputSpecKey)}
- >
-
- Static
-
-
- Dynamic
-
-
- User
-
-
-
+
+ {#each Object.keys(inputSpecs) as inputSpecKey, index (index)}
+ {@const input = inputSpecs[inputSpecKey]}
+
+
+
{
+ if (openedProp === inputSpecKey) {
+ openedProp = undefined
+ } else {
+ openedProp = inputSpecKey
+ }
+ }}
+ >
+ {inputSpecKey}
+ {#if input.fieldType}
+
+ {capitalize(fieldTypeToTsType(input.fieldType))}
+
+ {/if}
- {/if}
+ {#if inputSpecKey === openedProp}
+
+ sanitizeInputSpec(detail, inputSpecKey)}
+ >
+
+ Static
+
+
+ Dynamic
+
+ {#if userInputEnabled}
+
+ User
+
+ {/if}
+
+
+
+ {/if}
+
{/each}
diff --git a/frontend/src/lib/components/apps/editor/settingsPanel/StaticInputEditor.svelte b/frontend/src/lib/components/apps/editor/settingsPanel/StaticInputEditor.svelte
index 7e111eee08..58419d6606 100644
--- a/frontend/src/lib/components/apps/editor/settingsPanel/StaticInputEditor.svelte
+++ b/frontend/src/lib/components/apps/editor/settingsPanel/StaticInputEditor.svelte
@@ -1,30 +1,32 @@
-{#if canHide}
-
-{/if}
+{#if input.type === 'static'}
+ {#if canHide}
+
+ {/if}
-{#if input.fieldType === 'number'}
-
-{:else if input.fieldType === 'textarea'}
-
-{:else if input.fieldType === 'boolean'}
-
-{:else if input.fieldType === 'select'}
-
-{:else}
-
+ {#if input.fieldType === 'number'}
+
+ {:else if input.fieldType === 'textarea'}
+
+ {:else if input.fieldType === 'boolean'}
+
+ {:else if input.fieldType === 'select'}
+
+ {:else}
+
+ {/if}
{/if}
diff --git a/frontend/src/lib/components/apps/editor/settingsPanel/TableActions.svelte b/frontend/src/lib/components/apps/editor/settingsPanel/TableActions.svelte
new file mode 100644
index 0000000000..dc49703d61
--- /dev/null
+++ b/frontend/src/lib/components/apps/editor/settingsPanel/TableActions.svelte
@@ -0,0 +1,72 @@
+
+
+
+
+
+
+ {#each components as component}
+
+
Component: {component.id}
+
{
+ components = components.filter((c) => c.id !== component.id)
+ }}
+ />
+
+ {/each}
+
diff --git a/frontend/src/lib/components/apps/editor/settingsPanel/common/PanelSection.svelte b/frontend/src/lib/components/apps/editor/settingsPanel/common/PanelSection.svelte
index bb99892ad7..8ec632cec6 100644
--- a/frontend/src/lib/components/apps/editor/settingsPanel/common/PanelSection.svelte
+++ b/frontend/src/lib/components/apps/editor/settingsPanel/common/PanelSection.svelte
@@ -1,8 +1,10 @@
-
+
{title}
diff --git a/frontend/src/lib/components/apps/types.ts b/frontend/src/lib/components/apps/types.ts
index 8248e73ae0..b9ecc83891 100644
--- a/frontend/src/lib/components/apps/types.ts
+++ b/frontend/src/lib/components/apps/types.ts
@@ -1,28 +1,27 @@
-import type { Schema, SchemaProperty } from '$lib/common'
+import type { Schema } from '$lib/common'
import type { Preview } from '$lib/gen'
import type { FilledItem } from 'svelte-grid'
import type { Writable } from 'svelte/store'
import type { staticValues } from './editor/componentsPanel/componentStaticValues'
import type { World } from './rx'
-export type UserInput = {
+export type UserInput
= {
type: 'user'
- schemaProperty: SchemaProperty
- // Default value override
- defaultValue: any
- value: any
+ value: V | undefined
+ defaultValue: V
+ fieldType: T
}
-export type DynamicInput = {
+export type DynamicInput = {
type: 'output'
id: FieldID | undefined
name: string | undefined
- // Before any connection occures
- defaultValue: any
+ defaultValue: V
+ fieldType: T
}
-export type StaticInputType =
- ('text'
+export type InputType =
+ | 'text'
| 'textarea'
| 'number'
| 'boolean'
@@ -30,39 +29,36 @@ export type StaticInputType =
| 'date'
| 'time'
| 'datetime'
- | 'object')
+ | 'object'
-type BaseStaticInput = {
- fieldType: T
+export type StaticInput = {
value: V | undefined
type: 'static'
visible?: boolean
+ defaultValue: V
+ fieldType: T
}
-export type SelectStaticInput = BaseStaticInput<'select', string> & {
- /**
- * One of the keys of `staticValues` from `lib/components/apps/editor/componentsPanel/componentStaticValues`
- */
- optionValuesKey: keyof typeof staticValues
-}
+type AppInput = StaticInput | DynamicInput | UserInput
-export type StaticInput =
- BaseStaticInput<'text', string>
- | BaseStaticInput<'textarea', string>
- | BaseStaticInput<'number', number>
- | BaseStaticInput<'boolean', boolean>
- | SelectStaticInput
- | BaseStaticInput<'date', string>
- | BaseStaticInput<'time', string>
- | BaseStaticInput<'datetime', string>
- | BaseStaticInput<'object', Record>
-
-
-export type AppInputTransform = DynamicInput | StaticInput | UserInput
+export type AppInputTransform =
+ | AppInput<'text', string>
+ | AppInput<'textarea', string>
+ | AppInput<'number', number>
+ | AppInput<'boolean', boolean>
+ | (AppInput<'select', string> & {
+ /**
+ * One of the keys of `staticValues` from `lib/components/apps/editor/componentsPanel/componentStaticValues`
+ */
+ optionValuesKey: keyof typeof staticValues
+ })
+ | AppInput<'date', string>
+ | AppInput<'time', string>
+ | AppInput<'datetime', string>
+ | AppInput<'object', Record>
// Inner inputs, (search, filter, page, inputs of a script or flow)
export type InputsSpec = Record
-export type ComponentInputsSpec = Record
type Runnable = {
inlineScriptName?: string
@@ -76,11 +72,15 @@ type BaseComponent = {
export type TextComponent = BaseComponent<'textcomponent'>
export type TextInputComponent = BaseComponent<'textinputcomponent'>
-export type ButtonComponent = BaseComponent<'buttoncomponent'>
+export type ButtonComponent = Runnable & BaseComponent<'buttoncomponent'>
export type RunFormComponent = Runnable & BaseComponent<'runformcomponent'>
export type BarChartComponent = BaseComponent<'barchartcomponent'>
export type PieChartComponent = Runnable & BaseComponent<'piechartcomponent'>
-export type TableComponent = Runnable & BaseComponent<'tablecomponent'>
+export type TableComponent = Runnable &
+ BaseComponent<'tablecomponent'> & {
+ components: AppComponent[]
+ }
+
export type DisplayComponent = BaseComponent<'displaycomponent'>
export type ImageComponent = BaseComponent<'imagecomponent'>
export type InputComponent = BaseComponent<'inputcomponent'>
@@ -98,17 +98,16 @@ export type Aligned = {
export interface BaseAppComponent extends Partial {
id: ComponentID
inputs: InputsSpec
- // Only dynamic inputs (Result of display)
- componentInputs: ComponentInputsSpec
+ componentInputs: InputsSpec
runnable?: boolean | undefined
card?: boolean | undefined
// TODO: add min/max width/height
}
-export type AppComponent =
- BaseAppComponent & (
- RunFormComponent
+export type AppComponent = BaseAppComponent &
+ (
+ | RunFormComponent
| DisplayComponent
| TextInputComponent
| BarChartComponent
@@ -117,15 +116,15 @@ export type AppComponent =
| TableComponent
| ButtonComponent
| PieChartComponent
- | ImageComponent
- | InputComponent
- | SelectComponent
- | CheckboxComponent
- | RadioComponent
+ | ImageComponent
+ | InputComponent
+ | SelectComponent
+ | CheckboxComponent
+ | RadioComponent
)
export type ComponentSet = {
- title: string,
+ title: string
components: AppComponent[]
}
@@ -150,9 +149,9 @@ export type App = {
title: string
}
-export type ConnectingInput = {
+export type ConnectingInput = {
opened: boolean
- input?: DynamicInput
+ input?: DynamicInput
}
export type AppEditorContext = {
@@ -161,7 +160,7 @@ export type AppEditorContext = {
app: Writable
selectedComponent: Writable
mode: Writable
- connectingInput: Writable
+ connectingInput: Writable>
}
export type EditorMode = 'dnd' | 'preview'
diff --git a/frontend/src/lib/components/apps/utils.ts b/frontend/src/lib/components/apps/utils.ts
index 2970c067b5..75e4846a6f 100644
--- a/frontend/src/lib/components/apps/utils.ts
+++ b/frontend/src/lib/components/apps/utils.ts
@@ -1,4 +1,4 @@
-import type { InputsSpec } from './types'
+import type { InputsSpec, InputType } from './types'
import type { Schema } from '$lib/common'
import { FlowService, ScriptService } from '$lib/gen'
@@ -97,3 +97,21 @@ export function accessPropertyByPath(object: T, path: string): T | undefined
}
return object
}
+
+export function fieldTypeToTsType(InputType: InputType): string {
+ switch (InputType) {
+ case 'text':
+ case 'textarea':
+ case 'date':
+ case 'time':
+ case 'datetime':
+ case 'select':
+ return 'string'
+ case 'number':
+ return 'number'
+ case 'boolean':
+ return 'boolean'
+ case 'object':
+ return 'object'
+ }
+}
diff --git a/frontend/src/lib/components/propertyPicker/ObjectViewer.svelte b/frontend/src/lib/components/propertyPicker/ObjectViewer.svelte
index 12fc7ead6b..d0bbfc6db3 100644
--- a/frontend/src/lib/components/propertyPicker/ObjectViewer.svelte
+++ b/frontend/src/lib/components/propertyPicker/ObjectViewer.svelte
@@ -1,5 +1,5 @@