-
-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2116 from undb-io/release/v1.0.0-111
Release version v1.0.0-111
- Loading branch information
Showing
91 changed files
with
6,174 additions
and
542 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 0 additions & 1 deletion
1
apps/frontend/src/lib/components/blocks/aggregate/config/aggregate-config.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,7 @@ query GetDashboardWidgetTable($tableId: ID!) { | |
display | ||
constraint | ||
option | ||
metadata | ||
} | ||
|
||
views { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,7 @@ query GetForeignTableQuery($tableId: ID!) { | |
display | ||
constraint | ||
option | ||
metadata | ||
} | ||
views { | ||
id | ||
|
18 changes: 18 additions & 0 deletions
18
apps/frontend/src/lib/components/blocks/field-options/formula-field-option.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<script lang="ts"> | ||
import { Label } from "$lib/components/ui/label/index.js" | ||
import FormulaEditor from "$lib/components/formula/formula-editor.svelte" | ||
import { FormulaField, type IFormulaFieldOption } from "@undb/table" | ||
export let option: IFormulaFieldOption = { | ||
fn: "", | ||
} | ||
export let field: FormulaField | undefined = undefined | ||
</script> | ||
|
||
<div class="space-y-2"> | ||
<div class="space-y-1"> | ||
<Label for="Formula" class="text-xs font-normal">Formula</Label> | ||
</div> | ||
<FormulaEditor bind:value={option.fn} {field} /> | ||
</div> |
14 changes: 13 additions & 1 deletion
14
apps/frontend/src/lib/components/blocks/field-value/long-text-field.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,24 @@ | ||
<script lang="ts"> | ||
import type { LongTextField } from "@undb/table" | ||
export let value: string | undefined = undefined | ||
export let placeholder: string | undefined = undefined | ||
export let field: LongTextField | ||
</script> | ||
|
||
{#if !value} | ||
<div> | ||
{placeholder || ""} | ||
</div> | ||
{:else} | ||
<div class={$$restProps.class}>{value}</div> | ||
<div class={$$restProps.class}> | ||
{#if field.allowRichText} | ||
<article class="prose-sm max-w-full"> | ||
{@html value} | ||
</article> | ||
{:else} | ||
{value} | ||
{/if} | ||
</div> | ||
{/if} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,7 @@ query GetForeignTable($tableId: ID!) { | |
display | ||
constraint | ||
option | ||
metadata | ||
} | ||
|
||
views { | ||
|
117 changes: 117 additions & 0 deletions
117
apps/frontend/src/lib/components/formula/formula-cursor.visitor.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
import { | ||
AbstractParseTreeVisitor, | ||
AddSubExprContext, | ||
AndExprContext, | ||
ArgumentListContext, | ||
ComparisonExprContext, | ||
ExpressionContext, | ||
FormulaContext, | ||
FormulaParserVisitor, | ||
FunctionCallContext, | ||
FunctionExprContext, | ||
MulDivModExprContext, | ||
NotExprContext, | ||
OrExprContext, | ||
type ParseTree, | ||
VariableContext, | ||
} from "@undb/formula" | ||
|
||
export class FormulaCursorVisitor extends AbstractParseTreeVisitor<void> implements FormulaParserVisitor<void> { | ||
private pathNodes: ParseTree[] = [] | ||
private variables: Set<string> = new Set() | ||
public readonly targetPosition: number | ||
|
||
constructor(position: number) { | ||
super() | ||
this.targetPosition = position | ||
} | ||
|
||
public hasAggumentList(): boolean { | ||
return this.pathNodes.some((node) => node instanceof ArgumentListContext) | ||
} | ||
|
||
public hasFunctionCall(): boolean { | ||
return this.pathNodes.some((node) => node instanceof FunctionCallContext) | ||
} | ||
|
||
public getNearestFunctionNode() { | ||
for (let i = this.pathNodes.length - 1; i >= 0; i--) { | ||
const node = this.pathNodes[i] | ||
if (node instanceof FunctionCallContext) { | ||
return node | ||
} | ||
} | ||
return null | ||
} | ||
|
||
public getFunctionName(): string | undefined { | ||
const functionCall = this.getNearestFunctionNode() | ||
return functionCall?.IDENTIFIER()?.text | ||
} | ||
|
||
protected defaultResult(): void { | ||
return undefined | ||
} | ||
|
||
public getPathNodes() { | ||
return this.pathNodes | ||
} | ||
|
||
visitPositionInRange(ctx: ExpressionContext) { | ||
if (!ctx.start || !ctx.stop) return | ||
|
||
const start = ctx.start.startIndex | ||
const stop = ctx.stop.stopIndex | ||
const isPositionWithinRange = start <= this.targetPosition && stop >= this.targetPosition | ||
|
||
if (isPositionWithinRange) { | ||
this.pathNodes.push(ctx) | ||
this.visitChildren(ctx) | ||
} | ||
} | ||
|
||
visitFormula(ctx: FormulaContext) { | ||
this.visitPositionInRange(ctx) | ||
} | ||
|
||
visitComparisonExpr(ctx: ComparisonExprContext) { | ||
this.visitPositionInRange(ctx) | ||
} | ||
|
||
visitAndExpr(ctx: AndExprContext) { | ||
this.visitPositionInRange(ctx) | ||
} | ||
|
||
visitOrExpr(ctx: OrExprContext) { | ||
this.visitPositionInRange(ctx) | ||
} | ||
|
||
visitNotExpr(ctx: NotExprContext) { | ||
this.visitPositionInRange(ctx) | ||
} | ||
|
||
visitMulDivModExpr(ctx: MulDivModExprContext) { | ||
this.visitPositionInRange(ctx) | ||
} | ||
|
||
visitAddSubExpr(ctx: AddSubExprContext) { | ||
this.visitPositionInRange(ctx) | ||
} | ||
|
||
visitFunctionExpr(ctx: FunctionExprContext) { | ||
this.visitPositionInRange(ctx) | ||
} | ||
|
||
visitFunctionCall(ctx: FunctionCallContext) { | ||
this.visitPositionInRange(ctx) | ||
} | ||
|
||
visitArgumentList(ctx: ArgumentListContext) { | ||
this.visitPositionInRange(ctx) | ||
} | ||
|
||
visitVariable(ctx: VariableContext) { | ||
this.variables.add(ctx.IDENTIFIER().text) | ||
this.visitPositionInRange(ctx) | ||
} | ||
} |
Oops, something went wrong.