Skip to content

Commit

Permalink
Merge pull request #1989 from undb-io/release/v1.0.0-57
Browse files Browse the repository at this point in the history
Release version v1.0.0-57
  • Loading branch information
nichenqin committed Sep 3, 2024
2 parents 078a977 + ae37a12 commit c245311
Show file tree
Hide file tree
Showing 11 changed files with 63 additions and 10 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Changelog


## v1.0.0-57

## v1.0.0-56


Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ UNDB is a no-code platform that can also serve as a Backend as a Service (BaaS).
- 🐳 Supports Docker deployment
- 🛠️ Provides a UI for table management

## Screenshot

![form](./docs/images/form.jpeg)
![openapi](./docs/images/openapi.jpeg)

## Quick start

- Try [undb cloud](https://app.undb.io)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
fieldTypes,
getIsDisplayFieldType,
systemFieldTypes,
type IButtonFieldOption,
type ICreateSchemaDTO,
type NoneSystemFieldType,
} from "@undb/table"
Expand Down Expand Up @@ -54,6 +55,36 @@
options: [],
},
}))
.with("currency", () => ({
id: fieldId,
type: "currency",
name: getNextName(
$formData.schema.map((field) => field.name),
$LL.table.fieldTypes[type](),
),
display: false,
constraint: {},
option: {
symbol: "$",
},
}))
.with("button", () => ({
id: fieldId,
type,
name: getNextName(
$formData.schema.map((field) => field.name),
$LL.table.fieldTypes[type](),
),
display: false,
constraint: {},
option: {
action: {
type: "update",
values: [],
confirm: true,
},
} satisfies IButtonFieldOption,
}))
.otherwise((type) => ({
id: fieldId,
type,
Expand Down Expand Up @@ -188,7 +219,7 @@
</Button>
</Popover.Trigger>
<Popover.Content sameWidth class="p-0">
<Card.Root class="rounded-none p-1">
<Card.Root class="rounded-none px-1.5 py-2">
<Card.Content class="p-0">
<div class="grid grid-cols-4 gap-1">
{#each fieldTypes as type}
Expand All @@ -198,8 +229,8 @@
on:click={() => addField(type)}
class="hover:bg-muted flex cursor-pointer items-center gap-2 p-2 text-sm"
>
<FieldIcon class="h-4 w-4" {type} />
<span>{type}</span>
<FieldIcon class="h-3 w-3" {type} />
<span class="text-sm">{$LL.table.fieldTypes[type]()}</span>
</button>
{/if}
{/each}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
<div class={$$restProps.class}>
<Button disabled={$trigger.isPending || disabled} on:click={handleClick} size="xs" variant="outline">
{#if $trigger.isPending}
<LoaderCircleIcon className="h-3 w-3 animate-spin" />
<LoaderCircleIcon className="h-2 w-2 animate-spin" />
{:else}
{field.label ?? "Button"}
{/if}
Expand Down
Binary file added docs/images/form.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/openapi.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "undb",
"version": "1.0.0-56",
"version": "1.0.0-57",
"private": true,
"scripts": {
"build": "NODE_ENV=production bun --bun turbo build",
Expand Down
9 changes: 7 additions & 2 deletions packages/persistence/src/record/record.filter-visitor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,13 @@ export class RecordFilterVisitor extends AbstractQBVisitor<RecordDO> implements
this.addCond(this.eb.eb(this.getFieldId(spec), "in", spec.values))
}
checkboxEqual(spec: CheckboxEqual): void {
const cond = this.eb.eb(this.getFieldId(spec), "=", spec.value)
this.addCond(cond)
if (!spec.value) {
const cond = this.eb.eb(this.getFieldId(spec), "is", null).or(this.getFieldId(spec), "=", false)
this.addCond(cond)
} else {
const cond = this.eb.eb(this.getFieldId(spec), "=", spec.value)
this.addCond(cond)
}
}
longTextEqual(spec: LongTextEqual): void {
const cond = this.eb.eb(this.getFieldId(spec), "=", spec.value)
Expand Down
6 changes: 5 additions & 1 deletion packages/persistence/src/record/record.mutate-visitor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,11 @@ export class RecordMutateVisitor extends AbstractQBMutationVisitor implements IR
throw new Error("Method not implemented.")
}
checkboxEqual(spec: CheckboxEqual): void {
this.setData(spec.fieldId.value, spec.value)
if (!spec.value) {
this.setData(spec.fieldId.value, false)
} else {
this.setData(spec.fieldId.value, spec.value)
}
}
jsonEqual(spec: JsonEqual): void {
this.setData(spec.fieldId.value, JSON.stringify(spec.json))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ export class UnderlyingTableFieldVisitor<TB extends CreateTableBuilder<any, any>
}
rollup(field: RollupField): void {}
checkbox(field: CheckboxField): void {
const c = this.tb.addColumn(field.id.value, "boolean")
const c = this.tb.addColumn(field.id.value, "boolean", (b) => b.defaultTo(0).notNull())
this.addColumn(c)
}
user(field: UserField): void {
Expand Down
8 changes: 7 additions & 1 deletion packages/table/src/modules/schema/fields/field.type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ import type {
CurrencyFieldValue,
ICurrencyFieldConditionSchema,
ICurrencyFieldConstraint,
ICurrencyFieldOption,
} from "./variants/currency-field"
import type {
EMAIL_TYPE,
Expand Down Expand Up @@ -275,6 +276,11 @@ export type IFieldConstraint =
| ILongTextFieldConstraint
| ICurrencyFieldConstraint

export type IFieldOption = IReferenceFieldOption | IRollupFieldOption | ISelectFieldOption | IButtonFieldOption
export type IFieldOption =
| IReferenceFieldOption
| IRollupFieldOption
| ISelectFieldOption
| IButtonFieldOption
| ICurrencyFieldOption

export type IFieldMacro = IUserFieldMacro

0 comments on commit c245311

Please sign in to comment.