0}>
+ class:thinking={$tableColumnSuggestions.thinking}
+ class:no-transition={hasTransitioned && customColumns.length > 0}>
{#if $tableColumnSuggestions.thinking}
-
+
@@ -297,6 +542,41 @@
+ {:else if customColumns.length > 0 && showFloatingBar}
+
+
+
+ {#if creatingColumns}
+
+ {/if}
+
+
+ {creatingColumns
+ ? 'Creating columns...'
+ : 'Review and edit suggested columns before applying'}
+
+
+
+ {#if !creatingColumns}
+
+ {
+ customColumns = [];
+ $tableColumnSuggestions.context = null;
+ $tableColumnSuggestions.enabled = false;
+ }}
+ >Dismiss
+
+ Apply
+
+
+ {/if}
+
+
+
{/if}
@@ -308,28 +588,130 @@
columns={spreadsheetColumns}
bottomActionClick={() => {}}>
- {#each spreadsheetColumns as column (column.id)}
-
- {#if column.isAction}
+ {#each spreadsheetColumns as column, index (index)}
+ {#if column.isAction}
+
- {:else if column.id === 'actions' || column.id === 'empty'}
- {column.title}
- {:else}
-
- {column.title}
-
-
- {/if}
-
+
+ {:else}
+
+ {#snippet children(toggle)}
+
+
+
+ {column.title}
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {/snippet}
+
+ {#snippet tooltipChildren()}
+ {@const columnObj = getColumn(column.id)}
+ {#if columnObj}
+ {@const selectedOption = getColumnOption(
+ columnObj.type,
+ columnObj.format
+ )}
+ {@const ColumnComponent = selectedOption?.component}
+
+
+
+
+
+ {
+ const newOption = columnOptions.find(
+ (opt) => opt.name === e.detail
+ );
+ if (newOption) {
+ updateColumn(column.id, {
+ type: newOption.type,
+ format: newOption.format || null
+ });
+ }
+ }}
+ options={basicColumnOptions.map((col) => {
+ return {
+ label: col.name,
+ value: col.name,
+ leadingIcon: col.icon
+ };
+ })} />
+
+
+ {#if ColumnComponent}
+
+ {/if}
+
+ {/if}
+ {/snippet}
+
+ {/if}
{/each}
@@ -338,7 +720,7 @@
+ style="height: var(--overlay-height);">
@@ -347,27 +729,30 @@
width: 100%;
position: fixed;
overflow: hidden;
+ scrollbar-width: none;
+
+ &.custom-columns {
+ width: unset;
+ }
& :global([role='rowheader'] :nth-last-child(2) [role='presentation']) {
display: none;
}
.columns-range-overlay {
- width: 100%;
position: absolute;
- margin-block-start: 2px;
left: var(--group-left, 0px);
- height: calc(var(--overlay-height, 60vh) + 36px);
- border-radius: var(--border-radius-S, 8px);
+ width: var(--group-width, 100%);
+ height: 100%;
background: color-mix(in oklab, #fd366e 7%, transparent);
pointer-events: none;
z-index: 21;
overflow: hidden;
+ transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
- /* border + inner hairline without double-counting */
- box-shadow:
- 0 0 0 var(--border-width-L, 2px) #fd366e,
- inset 0 0 0 1px color-mix(in oklab, #fe9567 20%, transparent);
+ &.no-transition {
+ transition: none !important;
+ }
/* pretty gradient wash (with fallback) */
background: rgba(253, 54, 110, 0.07);
@@ -380,6 +765,15 @@
}
&.thinking {
+ margin-block-start: 2px;
+ height: calc(100% - 4px);
+ border-radius: var(--border-radius-S, 8px);
+ box-shadow:
+ 0 0 0 var(--border-width-l, 2px) #fd366e,
+ inset 0 0 0 1px color-mix(in oklab, #fe9567 20%, transparent);
+
+ transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
+
&::after {
content: '';
position: absolute;
@@ -405,15 +799,28 @@
); /* change this value if the firstColumn is changed for overlay logic.*/
}
+ & .floating-action-wrapper.expanded :global(:first-child) {
+ z-index: 21;
+ left: calc(50% - 80px);
+ max-width: 500px !important;
+ }
+
& :global(.spreadsheet-container) {
overflow-x: hidden;
overflow-y: hidden;
+ scrollbar-width: none;
}
& :global([data-select='true']) {
opacity: 0.85;
pointer-events: none;
}
+
+ /* alternative selector for header selection */
+ & :global(.sticky-header [data-select='true']) {
+ opacity: 1;
+ pointer-events: none;
+ }
}
.spreadsheet-fade-bottom {
@@ -430,6 +837,7 @@
display: flex;
justify-content: center;
transition: height 300ms cubic-bezier(0.4, 0, 0.2, 1);
+ pointer-events: none;
}
:global(.theme-dark) .spreadsheet-fade-bottom {
diff --git a/src/routes/(console)/project-[region]-[project]/databases/database-[database]/(suggestions)/options.svelte b/src/routes/(console)/project-[region]-[project]/databases/database-[database]/(suggestions)/options.svelte
new file mode 100644
index 000000000..9af78bc93
--- /dev/null
+++ b/src/routes/(console)/project-[region]-[project]/databases/database-[database]/(suggestions)/options.svelte
@@ -0,0 +1,24 @@
+
+
+
+ {onShowStateChanged?.(showing)}
+
+ {@render children(toggle)}
+
+
+ {@render tooltipChildren(toggle)}
+
+
diff --git a/src/routes/(console)/project-[region]-[project]/databases/database-[database]/(suggestions)/store.ts b/src/routes/(console)/project-[region]-[project]/databases/database-[database]/(suggestions)/store.ts
index 67bd268ba..ed6924c07 100644
--- a/src/routes/(console)/project-[region]-[project]/databases/database-[database]/(suggestions)/store.ts
+++ b/src/routes/(console)/project-[region]-[project]/databases/database-[database]/(suggestions)/store.ts
@@ -1,4 +1,5 @@
import { writable } from 'svelte/store';
+import { columnOptions } from '$routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/columns/store';
export type TableColumnSuggestions = {
enabled: boolean;
@@ -30,6 +31,73 @@ export const tableColumnSuggestions = writable
({
table: null
});
+// TODO: @itznotabug, remove later, this is MOCK DATA ONLY.
+export const mockSuggestions: { total: number; columns: ColumnInput[] } = {
+ total: 7,
+ columns: [
+ {
+ name: 'title',
+ type: 'string',
+ size: 255,
+ format: null,
+ required: true,
+ formatOptions: null
+ },
+ {
+ name: 'authorName',
+ type: 'string',
+ size: 128,
+ format: null,
+ required: true,
+ formatOptions: null
+ },
+ {
+ name: 'publishedYear',
+ type: 'integer',
+ size: null,
+ format: null,
+ required: true,
+ formatOptions: {
+ min: 1500,
+ max: null
+ }
+ },
+ {
+ name: 'genre',
+ type: 'string',
+ size: 64,
+ format: null,
+ required: false,
+ formatOptions: null,
+ default: null
+ },
+ {
+ name: 'isbn',
+ type: 'string',
+ size: 13,
+ required: false,
+ formatOptions: null,
+ default: null
+ },
+ {
+ name: 'language',
+ type: 'string',
+ size: 32,
+ format: null,
+ required: false,
+ formatOptions: null,
+ default: null
+ },
+ {
+ name: 'pageCount',
+ type: 'integer',
+ required: false,
+ min: 1,
+ max: 10000,
+ default: null
+ }
+ ]
+};
export type ColumnInput = {
name: string;
type: string;
@@ -63,3 +131,5 @@ export function mapSuggestedColumns(columns: T[]): Sugges
format: col.format ?? null
}));
}
+
+export const basicColumnOptions = columnOptions.slice(0, -1);
diff --git a/src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/+page.svelte b/src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/+page.svelte
index f625e72a7..ca33f1415 100644
--- a/src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/+page.svelte
+++ b/src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/+page.svelte
@@ -225,11 +225,7 @@
}} />
{/if}
{:else if $tableColumnSuggestions.enabled && $tableColumnSuggestions.table && $tableColumnSuggestions.table.id === page.params.table}
- {
- showSuggestionsModal = true;
- columnSuggestionsSchema = columns;
- }} />
+
{:else}