* added faker columns

* updated line settings
This commit is contained in:
ArnabChatterjee20k
2025-09-16 20:57:05 +05:30
parent 20815ad8b8
commit afce403a10
2 changed files with 38 additions and 7 deletions
+24 -2
View File
@@ -43,7 +43,24 @@ export async function generateColumns(
size: 1000,
required: false
}),
client.tablesDB.createBooleanColumn({ databaseId, tableId, key: 'active', required: false })
client.tablesDB.createBooleanColumn({
databaseId,
tableId,
key: 'active',
required: false
}),
client.tablesDB.createPointColumn({
databaseId,
tableId,
key: 'location',
required: false
}),
client.tablesDB.createLineColumn({
databaseId,
tableId,
key: 'route',
required: false
})
]);
}
@@ -82,7 +99,12 @@ export function generateFakeRecords(
age: faker.number.int({ min: 18, max: 80 }),
city: faker.location.city(),
description: faker.lorem.sentence(),
active: faker.datatype.boolean()
active: faker.datatype.boolean(),
location: [faker.location.longitude(), faker.location.latitude()],
route: Array.from({ length: 5 }, () => [
faker.location.longitude(),
faker.location.latitude()
])
};
} else {
for (const column of filteredColumns) {
@@ -59,11 +59,17 @@
}
function pushCoordinate() {
data.default.push(getDefaultSpatialData('point') as number[]);
if (data.default) {
data.default.push(getDefaultSpatialData('point') as number[]);
data.default = [...data.default];
}
}
function deleteCoordinate(_: number) {
if (data.default.length > 2) data.default.pop();
if (data.default && data.default.length > 2) {
data.default.pop();
data.default = [...data.default];
}
}
const {
@@ -102,7 +108,10 @@
on:change={(e) => {
if (e.detail) {
$required = false;
} else data.default = null;
handleDefaultState(false);
} else {
data.default = null;
}
}}
description="Enable to set a predefined value for this column" />
@@ -117,9 +126,9 @@
values={defaultChecked ? data.default : null}
onAddPoint={() => pushCoordinate()}
onDeletePoint={deleteCoordinate}
onChangePoint={(index, newValue: number, coordIndex: number) => {
onChangePoint={(pointIndex: number, coordIndex: number, newValue: number) => {
if (data.default) {
data.default[index][coordIndex] = newValue;
data.default[pointIndex][coordIndex] = newValue;
data.default = [...data.default];
}
}} />