@romedb/studio 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/package.json +4 -4
- package/src/components/studio/BrowseTab.ts +4 -4
- package/src/components/studio/CellEditorSheet.ts +2 -2
- package/src/components/studio/InsertRowSheet.ts +2 -2
- package/src/components/studio/NewObjectSheet.ts +1 -1
- package/src/components/studio/RowSheets.ts +3 -3
- package/src/workspace/StudioWorkspace.ts +0 -14
package/README.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@romedb/studio",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "The RomeDB Studio database workspace for Cossack applications",
|
|
6
6
|
"license": "MIT",
|
|
@@ -27,10 +27,10 @@
|
|
|
27
27
|
"pages": []
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
30
|
-
"@cossackframework/core": "^0.9.
|
|
31
|
-
"@cossackframework/renderer": "^0.9.
|
|
30
|
+
"@cossackframework/core": "^0.9.4",
|
|
31
|
+
"@cossackframework/renderer": "^0.9.4",
|
|
32
32
|
"@cossackframework/solar-icons": ">=0.7.1",
|
|
33
|
-
"@cossackframework/ui": "^0.9.
|
|
33
|
+
"@cossackframework/ui": "^0.9.4",
|
|
34
34
|
"@romedb/client": ">=0.2.15",
|
|
35
35
|
"hono": "^4.12.0",
|
|
36
36
|
"monaco-editor": "0.52.2"
|
|
@@ -178,7 +178,7 @@ export class BrowseTab extends Cossack {
|
|
|
178
178
|
aria-label="Filter column"
|
|
179
179
|
data-testid="filter-column"
|
|
180
180
|
.value="${this.props.filterColumn || filterColumns[0] || ''}"
|
|
181
|
-
@change="${(event:
|
|
181
|
+
@change="${(event: Event) => this.props.onFilterColumnChange((event.target as HTMLSelectElement).value)}"
|
|
182
182
|
>
|
|
183
183
|
${filterColumns.map(column => html`
|
|
184
184
|
<option value="${column}" ?selected="${column === this.props.filterColumn}">${column}</option>
|
|
@@ -190,7 +190,7 @@ export class BrowseTab extends Cossack {
|
|
|
190
190
|
aria-label="Filter operator"
|
|
191
191
|
data-testid="filter-operator"
|
|
192
192
|
.value="${this.props.filterOperator}"
|
|
193
|
-
@change="${(event:
|
|
193
|
+
@change="${(event: Event) => this.props.onFilterOperatorChange((event.target as HTMLSelectElement).value as BrowseFilterOperator)}"
|
|
194
194
|
>
|
|
195
195
|
${FILTER_OPERATORS.map(operator => html`
|
|
196
196
|
<option value="${operator.value}" ?selected="${operator.value === this.props.filterOperator}">${operator.label}</option>
|
|
@@ -213,7 +213,7 @@ export class BrowseTab extends Cossack {
|
|
|
213
213
|
title="RomeDB compares typed values. Auto uses the column type."
|
|
214
214
|
data-testid="filter-type"
|
|
215
215
|
.value="${this.props.filterType}"
|
|
216
|
-
@change="${(event:
|
|
216
|
+
@change="${(event: Event) => this.props.onFilterTypeChange((event.target as HTMLSelectElement).value as FilterValueType)}"
|
|
217
217
|
>
|
|
218
218
|
${FILTER_VALUE_TYPES.map(type => html`
|
|
219
219
|
<option value="${type.value}" ?selected="${type.value === this.props.filterType}">${type.label}</option>
|
|
@@ -355,7 +355,7 @@ export class BrowseTab extends Cossack {
|
|
|
355
355
|
class="h-8 rounded-md border border-input bg-background px-2 text-foreground"
|
|
356
356
|
data-testid="page-size"
|
|
357
357
|
.value="${String(this.props.pageSize)}"
|
|
358
|
-
@change="${(event:
|
|
358
|
+
@change="${(event: Event) => this.props.onPageSizeChange((event.target as HTMLSelectElement).value)}"
|
|
359
359
|
>
|
|
360
360
|
${PAGE_SIZES.map(size => html`<option value="${size}" ?selected="${size === this.props.pageSize}">${size}</option>`)}
|
|
361
361
|
</select>
|
|
@@ -57,7 +57,7 @@ export class CellEditorSheet extends Cossack {
|
|
|
57
57
|
data-testid="cell-editor-mode"
|
|
58
58
|
aria-label="Value type for ${activeColumn.name}"
|
|
59
59
|
.value="${active.mode === 'null' ? 'null' : active.kind}"
|
|
60
|
-
@change="${(event:
|
|
60
|
+
@change="${(event: Event) => this.props.onSelectionChange((event.target as HTMLSelectElement).value as CellSelection)}"
|
|
61
61
|
>
|
|
62
62
|
<optgroup label="Value type">
|
|
63
63
|
${VALUE_KINDS.map(kind => html`<option value="${kind.value}" ?selected="${active.mode === 'value' && active.kind === kind.value}">${kind.label}</option>`)}
|
|
@@ -121,7 +121,7 @@ export function valueEditor(
|
|
|
121
121
|
if (editor.kind === 'boolean') {
|
|
122
122
|
return html`
|
|
123
123
|
<select class="h-10 w-full max-w-sm rounded-md border border-input bg-background px-3" data-testid="boolean-editor" ?disabled="${disabled}"
|
|
124
|
-
.value="${editor.value}" @change="${(event:
|
|
124
|
+
.value="${editor.value}" @change="${(event: Event) => props.onValueChange((event.target as HTMLSelectElement).value)}">
|
|
125
125
|
<option value="true" ?selected="${editor.value !== 'false'}">True</option>
|
|
126
126
|
<option value="false" ?selected="${editor.value === 'false'}">False</option>
|
|
127
127
|
</select>
|
|
@@ -117,7 +117,7 @@ export class InsertRowSheet extends Cossack {
|
|
|
117
117
|
data-testid="insert-value-${column.name}"
|
|
118
118
|
?disabled="${mode !== 'value'}"
|
|
119
119
|
.value="${value}"
|
|
120
|
-
@change="${(event:
|
|
120
|
+
@change="${(event: Event) => this.props.onValueChange(column.name, (event.target as HTMLSelectElement).value)}"
|
|
121
121
|
>
|
|
122
122
|
<option value="true" ?selected="${value !== 'false'}">True</option>
|
|
123
123
|
<option value="false" ?selected="${value === 'false'}">False</option>
|
|
@@ -150,7 +150,7 @@ export class InsertRowSheet extends Cossack {
|
|
|
150
150
|
data-testid="insert-option-${column.name}"
|
|
151
151
|
aria-label="Value type or insert mode for ${column.name}"
|
|
152
152
|
.value="${selection}"
|
|
153
|
-
@change="${(event:
|
|
153
|
+
@change="${(event: Event) => this.props.onSelectionChange(column.name, (event.target as HTMLSelectElement).value as InsertSelection)}"
|
|
154
154
|
>
|
|
155
155
|
<optgroup label="Value type">
|
|
156
156
|
${VALUE_KINDS.map(kind => html`<option value="${kind.value}" ?selected="${selection === kind.value}">${kind.label}</option>`)}
|
|
@@ -109,7 +109,7 @@ export class NewObjectSheet extends Cossack {
|
|
|
109
109
|
class="h-8 rounded-md border border-input bg-background px-2 text-sm"
|
|
110
110
|
aria-label="Column ${index + 1} type"
|
|
111
111
|
.value="${column.type}"
|
|
112
|
-
@change="${(event:
|
|
112
|
+
@change="${(event: Event) => this.props.onColumnChange(index, { ...column, type: (event.target as HTMLSelectElement).value })}"
|
|
113
113
|
>
|
|
114
114
|
${COLUMN_TYPES.map(type => html`<option value="${type}" ?selected="${type === column.type}">${type}</option>`)}
|
|
115
115
|
</select>
|
|
@@ -114,7 +114,7 @@ export class ExportSheet extends Cossack {
|
|
|
114
114
|
class="h-10 rounded-md border border-input bg-background px-3 font-normal"
|
|
115
115
|
data-testid="export-format"
|
|
116
116
|
.value="${state?.format ?? 'json'}"
|
|
117
|
-
@change="${(event:
|
|
117
|
+
@change="${(event: Event) => this.props.onFormatChange((event.target as HTMLSelectElement).value as ExportFormat)}"
|
|
118
118
|
>
|
|
119
119
|
<option value="json">JSON</option>
|
|
120
120
|
<option value="csv">CSV</option>
|
|
@@ -195,7 +195,7 @@ export class BatchUpdateSheet extends Cossack {
|
|
|
195
195
|
class="h-10 rounded-md border border-input bg-background px-3 font-normal"
|
|
196
196
|
data-testid="batch-column"
|
|
197
197
|
.value="${state?.column ?? ''}"
|
|
198
|
-
@change="${(event:
|
|
198
|
+
@change="${(event: Event) => this.props.onColumnChange((event.target as HTMLSelectElement).value)}"
|
|
199
199
|
>
|
|
200
200
|
${editable.map(candidate => html`<option value="${candidate.name}" ?selected="${candidate.name === state?.column}">${candidate.name}</option>`)}
|
|
201
201
|
</select>
|
|
@@ -207,7 +207,7 @@ export class BatchUpdateSheet extends Cossack {
|
|
|
207
207
|
class="h-10 rounded-md border border-input bg-background px-3 font-normal"
|
|
208
208
|
data-testid="batch-kind"
|
|
209
209
|
.value="${state?.mode === 'null' ? 'null' : state?.kind ?? 'text'}"
|
|
210
|
-
@change="${(event:
|
|
210
|
+
@change="${(event: Event) => this.props.onSelectionChange((event.target as HTMLSelectElement).value as CellSelection)}"
|
|
211
211
|
>
|
|
212
212
|
${VALUE_KINDS.map(kind => html`<option value="${kind.value}" ?selected="${state?.mode === 'value' && state.kind === kind.value}">${kind.label}</option>`)}
|
|
213
213
|
${column?.nullable !== false ? html`<option value="null" ?selected="${state?.mode === 'null'}">NULL</option>` : ''}
|
|
@@ -158,20 +158,6 @@ export abstract class StudioWorkspace extends Cossack {
|
|
|
158
158
|
@ClientState() newObjectError = '';
|
|
159
159
|
@ClientState() creatingObject = false;
|
|
160
160
|
|
|
161
|
-
constructor() {
|
|
162
|
-
super();
|
|
163
|
-
// Cossack binds the methods of the page's own class only. The templates here pass
|
|
164
|
-
// methods as callbacks (`onSave: this.saveRowEditor`), so bind the inherited ones too.
|
|
165
|
-
for (let proto = Object.getPrototypeOf(Object.getPrototypeOf(this)); proto && proto !== Cossack.prototype; proto = Object.getPrototypeOf(proto)) {
|
|
166
|
-
for (const name of Object.getOwnPropertyNames(proto)) {
|
|
167
|
-
const value: unknown = Object.getOwnPropertyDescriptor(proto, name)?.value;
|
|
168
|
-
if (name !== 'constructor' && typeof value === 'function' && !Object.hasOwn(this, name)) {
|
|
169
|
-
(this as unknown as Record<string, unknown>)[name] = value.bind(this);
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
|
|
175
161
|
get activeObject(): StudioObject | undefined {
|
|
176
162
|
return this.schema.objects.find(object => object.name === this.selected);
|
|
177
163
|
}
|