@lobb-js/studio 0.1.32 → 0.1.34
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/package.json +2 -2
- package/{dist → src/lib/components}/LlmButton.svelte +2 -2
- package/{dist → src/lib/components}/Studio.svelte +10 -10
- package/{dist → src/lib/components}/alertView.svelte +1 -1
- package/{dist → src/lib/components}/breadCrumbs.svelte +2 -2
- package/{dist → src/lib/components}/combobox.svelte +4 -4
- package/{dist → src/lib/components}/confirmationDialog/confirmationDialog.svelte +1 -1
- package/src/lib/components/confirmationDialog/store.svelte.ts +28 -0
- package/{dist → src/lib/components}/createManyButton.svelte +2 -2
- package/{dist → src/lib/components}/dataTable/childRecords.svelte +2 -2
- package/{dist → src/lib/components}/dataTable/dataTable.svelte +3 -3
- package/{dist → src/lib/components}/dataTable/fieldCell.svelte +1 -1
- package/{dist → src/lib/components}/dataTable/filter.svelte +2 -2
- package/{dist → src/lib/components}/dataTable/filterButton.svelte +1 -1
- package/{dist → src/lib/components}/dataTable/header.svelte +2 -2
- package/{dist → src/lib/components}/dataTable/sort.svelte +2 -2
- package/{dist → src/lib/components}/dataTable/sortButton.svelte +2 -2
- package/src/lib/components/dataTable/utils.ts +127 -0
- package/{dist → src/lib/components}/detailView/create/children.svelte +3 -3
- package/{dist → src/lib/components}/detailView/create/createDetailView.svelte +6 -6
- package/{dist → src/lib/components}/detailView/create/createDetailViewButton.svelte +2 -2
- package/{dist → src/lib/components}/detailView/create/createManyView.svelte +5 -5
- package/{dist → src/lib/components}/detailView/create/subRecords.svelte +1 -1
- package/{dist → src/lib/components}/detailView/fieldInput.svelte +4 -4
- package/{dist → src/lib/components}/detailView/fieldInputReplacement.svelte +1 -1
- package/src/lib/components/detailView/store.svelte.ts +61 -0
- package/{dist → src/lib/components}/detailView/update/children.svelte +4 -4
- package/{dist → src/lib/components}/detailView/update/updateDetailView.svelte +6 -6
- package/{dist → src/lib/components}/detailView/update/updateDetailViewButton.svelte +2 -2
- package/src/lib/components/detailView/utils.ts +177 -0
- package/{dist → src/lib/components}/diffViewer.svelte +1 -1
- package/{dist → src/lib/components}/drawer.svelte +1 -1
- package/{dist → src/lib/components}/extensionsComponents.svelte +1 -1
- package/{dist → src/lib/components}/header.svelte +1 -1
- package/src/lib/components/loadingTypesForMonacoEditor.ts +36 -0
- package/{dist → src/lib/components}/miniSidebar.svelte +7 -7
- package/{dist → src/lib/components}/monacoEditor.svelte +1 -1
- package/{dist → src/lib/components}/rangeCalendarButton.svelte +4 -4
- package/{dist → src/lib/components}/selectRecord.svelte +1 -1
- package/{dist → src/lib/components}/setServerPage.svelte +2 -2
- package/{dist/sidebar/index.d.ts → src/lib/components/sidebar/index.ts} +2 -1
- package/{dist → src/lib/components}/sidebar/sidebar.svelte +1 -1
- package/{dist → src/lib/components}/singletone.svelte +1 -1
- package/{dist → src/lib/components}/ui/accordion/accordion-content.svelte +1 -1
- package/{dist → src/lib/components}/ui/accordion/accordion-item.svelte +1 -1
- package/{dist → src/lib/components}/ui/accordion/accordion-trigger.svelte +1 -1
- package/{dist/ui/accordion/index.js → src/lib/components/ui/accordion/index.ts} +13 -4
- package/{dist → src/lib/components}/ui/alert/alert-description.svelte +1 -1
- package/{dist → src/lib/components}/ui/alert/alert-title.svelte +1 -1
- package/{dist → src/lib/components}/ui/alert/alert.svelte +1 -1
- package/{dist/ui/alert/index.d.ts → src/lib/components/ui/alert/index.ts} +10 -1
- package/{dist → src/lib/components}/ui/alert-dialog/alert-dialog-action.svelte +2 -2
- package/{dist → src/lib/components}/ui/alert-dialog/alert-dialog-cancel.svelte +2 -2
- package/{dist → src/lib/components}/ui/alert-dialog/alert-dialog-content.svelte +1 -1
- package/{dist → src/lib/components}/ui/alert-dialog/alert-dialog-description.svelte +1 -1
- package/{dist → src/lib/components}/ui/alert-dialog/alert-dialog-footer.svelte +1 -1
- package/{dist → src/lib/components}/ui/alert-dialog/alert-dialog-header.svelte +1 -1
- package/{dist → src/lib/components}/ui/alert-dialog/alert-dialog-overlay.svelte +1 -1
- package/{dist → src/lib/components}/ui/alert-dialog/alert-dialog-title.svelte +1 -1
- package/src/lib/components/ui/alert-dialog/index.ts +40 -0
- package/{dist → src/lib/components}/ui/breadcrumb/breadcrumb-ellipsis.svelte +1 -1
- package/{dist → src/lib/components}/ui/breadcrumb/breadcrumb-item.svelte +1 -1
- package/{dist → src/lib/components}/ui/breadcrumb/breadcrumb-link.svelte +1 -1
- package/{dist → src/lib/components}/ui/breadcrumb/breadcrumb-list.svelte +1 -1
- package/{dist → src/lib/components}/ui/breadcrumb/breadcrumb-page.svelte +1 -1
- package/{dist → src/lib/components}/ui/breadcrumb/breadcrumb-separator.svelte +1 -1
- package/{dist/ui/breadcrumb/index.d.ts → src/lib/components/ui/breadcrumb/index.ts} +18 -1
- package/{dist → src/lib/components}/ui/button/button.svelte +1 -1
- package/src/lib/components/ui/button/index.ts +17 -0
- package/{dist → src/lib/components}/ui/checkbox/checkbox.svelte +1 -1
- package/src/lib/components/ui/checkbox/index.ts +6 -0
- package/{dist → src/lib/components}/ui/command/command-dialog.svelte +1 -1
- package/{dist → src/lib/components}/ui/command/command-empty.svelte +1 -1
- package/{dist → src/lib/components}/ui/command/command-group.svelte +1 -1
- package/{dist → src/lib/components}/ui/command/command-input.svelte +1 -1
- package/{dist → src/lib/components}/ui/command/command-item.svelte +1 -1
- package/{dist → src/lib/components}/ui/command/command-link-item.svelte +1 -1
- package/{dist → src/lib/components}/ui/command/command-list.svelte +1 -1
- package/{dist → src/lib/components}/ui/command/command-separator.svelte +1 -1
- package/{dist → src/lib/components}/ui/command/command-shortcut.svelte +1 -1
- package/{dist → src/lib/components}/ui/command/command.svelte +1 -1
- package/{dist/ui/command/index.d.ts → src/lib/components/ui/command/index.ts} +29 -2
- package/{dist → src/lib/components}/ui/dialog/dialog-content.svelte +1 -1
- package/{dist → src/lib/components}/ui/dialog/dialog-description.svelte +1 -1
- package/{dist → src/lib/components}/ui/dialog/dialog-footer.svelte +1 -1
- package/{dist → src/lib/components}/ui/dialog/dialog-header.svelte +1 -1
- package/{dist → src/lib/components}/ui/dialog/dialog-overlay.svelte +1 -1
- package/{dist → src/lib/components}/ui/dialog/dialog-title.svelte +1 -1
- package/src/lib/components/ui/dialog/index.ts +37 -0
- package/src/lib/components/ui/input/index.ts +7 -0
- package/{dist → src/lib/components}/ui/input/input.svelte +1 -1
- package/src/lib/components/ui/label/index.ts +7 -0
- package/{dist → src/lib/components}/ui/label/label.svelte +1 -1
- package/src/lib/components/ui/popover/index.ts +17 -0
- package/{dist → src/lib/components}/ui/popover/popover-content.svelte +1 -1
- package/{dist/ui/range-calendar/index.d.ts → src/lib/components/ui/range-calendar/index.ts} +17 -1
- package/{dist → src/lib/components}/ui/range-calendar/range-calendar-cell.svelte +1 -1
- package/{dist → src/lib/components}/ui/range-calendar/range-calendar-day.svelte +2 -2
- package/{dist → src/lib/components}/ui/range-calendar/range-calendar-grid-body.svelte +1 -1
- package/{dist → src/lib/components}/ui/range-calendar/range-calendar-grid-head.svelte +1 -1
- package/{dist → src/lib/components}/ui/range-calendar/range-calendar-grid-row.svelte +1 -1
- package/{dist → src/lib/components}/ui/range-calendar/range-calendar-grid.svelte +1 -1
- package/{dist → src/lib/components}/ui/range-calendar/range-calendar-head-cell.svelte +1 -1
- package/{dist → src/lib/components}/ui/range-calendar/range-calendar-header.svelte +1 -1
- package/{dist → src/lib/components}/ui/range-calendar/range-calendar-heading.svelte +1 -1
- package/{dist → src/lib/components}/ui/range-calendar/range-calendar-months.svelte +1 -1
- package/{dist → src/lib/components}/ui/range-calendar/range-calendar-next-button.svelte +2 -2
- package/{dist → src/lib/components}/ui/range-calendar/range-calendar-prev-button.svelte +2 -2
- package/{dist → src/lib/components}/ui/range-calendar/range-calendar.svelte +1 -1
- package/src/lib/components/ui/select/index.ts +34 -0
- package/{dist → src/lib/components}/ui/select/select-content.svelte +1 -1
- package/{dist → src/lib/components}/ui/select/select-group-heading.svelte +1 -1
- package/{dist → src/lib/components}/ui/select/select-item.svelte +1 -1
- package/{dist → src/lib/components}/ui/select/select-scroll-down-button.svelte +1 -1
- package/{dist → src/lib/components}/ui/select/select-scroll-up-button.svelte +1 -1
- package/{dist → src/lib/components}/ui/select/select-separator.svelte +2 -2
- package/{dist → src/lib/components}/ui/select/select-trigger.svelte +1 -1
- package/src/lib/components/ui/separator/index.ts +7 -0
- package/{dist → src/lib/components}/ui/separator/separator.svelte +1 -1
- package/src/lib/components/ui/skeleton/index.ts +7 -0
- package/{dist → src/lib/components}/ui/skeleton/skeleton.svelte +1 -1
- package/src/lib/components/ui/switch/index.ts +7 -0
- package/{dist → src/lib/components}/ui/switch/switch.svelte +1 -1
- package/src/lib/components/ui/textarea/index.ts +7 -0
- package/{dist → src/lib/components}/ui/textarea/textarea.svelte +1 -1
- package/src/lib/components/ui/tooltip/index.ts +18 -0
- package/{dist → src/lib/components}/ui/tooltip/tooltip-content.svelte +1 -1
- package/{dist → src/lib/components}/workflowEditor.svelte +5 -5
- package/vite-plugins/contextual-lib-alias.js +7 -2
- package/dist/LlmButton.svelte.d.ts +0 -17
- package/dist/Studio.svelte.d.ts +0 -6
- package/dist/alertView.svelte.d.ts +0 -8
- package/dist/breadCrumbs.svelte.d.ts +0 -3
- package/dist/combobox.svelte.d.ts +0 -15
- package/dist/confirmationDialog/confirmationDialog.svelte.d.ts +0 -8
- package/dist/confirmationDialog/store.svelte.d.ts +0 -1
- package/dist/confirmationDialog/store.svelte.js +0 -69
- package/dist/createManyButton.svelte.d.ts +0 -8
- package/dist/dataTable/childRecords.svelte.d.ts +0 -9
- package/dist/dataTable/dataTable.svelte.d.ts +0 -15
- package/dist/dataTable/fieldCell.svelte.d.ts +0 -10
- package/dist/dataTable/filter.svelte.d.ts +0 -10
- package/dist/dataTable/filterButton.svelte.d.ts +0 -8
- package/dist/dataTable/footer.svelte.d.ts +0 -8
- package/dist/dataTable/header.svelte.d.ts +0 -10
- package/dist/dataTable/sort.svelte.d.ts +0 -8
- package/dist/dataTable/sortButton.svelte.d.ts +0 -8
- package/dist/dataTable/table.svelte.d.ts +0 -32
- package/dist/dataTable/utils.d.ts +0 -7
- package/dist/dataTable/utils.js +0 -111
- package/dist/detailView/create/children.svelte.d.ts +0 -8
- package/dist/detailView/create/createDetailView.svelte.d.ts +0 -18
- package/dist/detailView/create/createDetailViewButton.svelte.d.ts +0 -11
- package/dist/detailView/create/createManyView.svelte.d.ts +0 -16
- package/dist/detailView/create/subRecords.svelte.d.ts +0 -8
- package/dist/detailView/detailViewForm.svelte.d.ts +0 -48
- package/dist/detailView/fieldCustomInput.svelte.d.ts +0 -10
- package/dist/detailView/fieldInput.svelte.d.ts +0 -10
- package/dist/detailView/fieldInputReplacement.svelte.d.ts +0 -11
- package/dist/detailView/store.svelte.d.ts +0 -4
- package/dist/detailView/store.svelte.js +0 -125
- package/dist/detailView/update/children.svelte.d.ts +0 -7
- package/dist/detailView/update/updateDetailView.svelte.d.ts +0 -19
- package/dist/detailView/update/updateDetailViewButton.svelte.d.ts +0 -11
- package/dist/detailView/utils.d.ts +0 -8
- package/dist/detailView/utils.js +0 -165
- package/dist/diffViewer.svelte.d.ts +0 -9
- package/dist/drawer.svelte.d.ts +0 -8
- package/dist/extensionsComponents.svelte.d.ts +0 -11
- package/dist/foreingKeyInput.svelte.d.ts +0 -11
- package/dist/header.svelte.d.ts +0 -6
- package/dist/loadingTypesForMonacoEditor.d.ts +0 -7
- package/dist/loadingTypesForMonacoEditor.js +0 -72
- package/dist/miniSidebar.svelte.d.ts +0 -20
- package/dist/monacoEditor.svelte.d.ts +0 -13
- package/dist/rangeCalendarButton.svelte.d.ts +0 -7
- package/dist/selectRecord.svelte.d.ts +0 -15
- package/dist/setServerPage.svelte.d.ts +0 -18
- package/dist/sidebar/index.js +0 -3
- package/dist/sidebar/sidebar.svelte.d.ts +0 -17
- package/dist/sidebar/sidebarElements.svelte.d.ts +0 -19
- package/dist/sidebar/sidebarTrigger.svelte.d.ts +0 -7
- package/dist/singletone.svelte.d.ts +0 -6
- package/dist/ui/accordion/accordion-content.svelte.d.ts +0 -4
- package/dist/ui/accordion/accordion-item.svelte.d.ts +0 -4
- package/dist/ui/accordion/accordion-trigger.svelte.d.ts +0 -7
- package/dist/ui/accordion/index.d.ts +0 -6
- package/dist/ui/alert/alert-description.svelte.d.ts +0 -5
- package/dist/ui/alert/alert-title.svelte.d.ts +0 -8
- package/dist/ui/alert/alert.svelte.d.ts +0 -26
- package/dist/ui/alert/index.js +0 -7
- package/dist/ui/alert-dialog/alert-dialog-action.svelte.d.ts +0 -4
- package/dist/ui/alert-dialog/alert-dialog-cancel.svelte.d.ts +0 -4
- package/dist/ui/alert-dialog/alert-dialog-content.svelte.d.ts +0 -7
- package/dist/ui/alert-dialog/alert-dialog-description.svelte.d.ts +0 -4
- package/dist/ui/alert-dialog/alert-dialog-footer.svelte.d.ts +0 -5
- package/dist/ui/alert-dialog/alert-dialog-header.svelte.d.ts +0 -5
- package/dist/ui/alert-dialog/alert-dialog-overlay.svelte.d.ts +0 -4
- package/dist/ui/alert-dialog/alert-dialog-title.svelte.d.ts +0 -4
- package/dist/ui/alert-dialog/index.d.ts +0 -13
- package/dist/ui/alert-dialog/index.js +0 -15
- package/dist/ui/breadcrumb/breadcrumb-ellipsis.svelte.d.ts +0 -5
- package/dist/ui/breadcrumb/breadcrumb-item.svelte.d.ts +0 -5
- package/dist/ui/breadcrumb/breadcrumb-link.svelte.d.ts +0 -11
- package/dist/ui/breadcrumb/breadcrumb-list.svelte.d.ts +0 -5
- package/dist/ui/breadcrumb/breadcrumb-page.svelte.d.ts +0 -5
- package/dist/ui/breadcrumb/breadcrumb-separator.svelte.d.ts +0 -5
- package/dist/ui/breadcrumb/breadcrumb.svelte.d.ts +0 -5
- package/dist/ui/breadcrumb/index.js +0 -10
- package/dist/ui/button/button.svelte.d.ts +0 -60
- package/dist/ui/button/index.d.ts +0 -2
- package/dist/ui/button/index.js +0 -4
- package/dist/ui/checkbox/checkbox.svelte.d.ts +0 -4
- package/dist/ui/checkbox/index.d.ts +0 -2
- package/dist/ui/checkbox/index.js +0 -4
- package/dist/ui/command/command-dialog.svelte.d.ts +0 -9
- package/dist/ui/command/command-empty.svelte.d.ts +0 -4
- package/dist/ui/command/command-group.svelte.d.ts +0 -7
- package/dist/ui/command/command-input.svelte.d.ts +0 -4
- package/dist/ui/command/command-item.svelte.d.ts +0 -4
- package/dist/ui/command/command-link-item.svelte.d.ts +0 -4
- package/dist/ui/command/command-list.svelte.d.ts +0 -4
- package/dist/ui/command/command-separator.svelte.d.ts +0 -4
- package/dist/ui/command/command-shortcut.svelte.d.ts +0 -5
- package/dist/ui/command/command.svelte.d.ts +0 -4
- package/dist/ui/command/index.js +0 -15
- package/dist/ui/dialog/dialog-content.svelte.d.ts +0 -9
- package/dist/ui/dialog/dialog-description.svelte.d.ts +0 -4
- package/dist/ui/dialog/dialog-footer.svelte.d.ts +0 -5
- package/dist/ui/dialog/dialog-header.svelte.d.ts +0 -5
- package/dist/ui/dialog/dialog-overlay.svelte.d.ts +0 -4
- package/dist/ui/dialog/dialog-title.svelte.d.ts +0 -4
- package/dist/ui/dialog/index.d.ts +0 -12
- package/dist/ui/dialog/index.js +0 -14
- package/dist/ui/input/index.d.ts +0 -2
- package/dist/ui/input/index.js +0 -4
- package/dist/ui/input/input.svelte.d.ts +0 -13
- package/dist/ui/label/index.d.ts +0 -2
- package/dist/ui/label/index.js +0 -4
- package/dist/ui/label/label.svelte.d.ts +0 -4
- package/dist/ui/popover/index.d.ts +0 -6
- package/dist/ui/popover/index.js +0 -8
- package/dist/ui/popover/popover-content.svelte.d.ts +0 -7
- package/dist/ui/range-calendar/index.js +0 -16
- package/dist/ui/range-calendar/range-calendar-cell.svelte.d.ts +0 -4
- package/dist/ui/range-calendar/range-calendar-day.svelte.d.ts +0 -6
- package/dist/ui/range-calendar/range-calendar-grid-body.svelte.d.ts +0 -4
- package/dist/ui/range-calendar/range-calendar-grid-head.svelte.d.ts +0 -4
- package/dist/ui/range-calendar/range-calendar-grid-row.svelte.d.ts +0 -4
- package/dist/ui/range-calendar/range-calendar-grid.svelte.d.ts +0 -4
- package/dist/ui/range-calendar/range-calendar-head-cell.svelte.d.ts +0 -4
- package/dist/ui/range-calendar/range-calendar-header.svelte.d.ts +0 -4
- package/dist/ui/range-calendar/range-calendar-heading.svelte.d.ts +0 -4
- package/dist/ui/range-calendar/range-calendar-months.svelte.d.ts +0 -5
- package/dist/ui/range-calendar/range-calendar-next-button.svelte.d.ts +0 -4
- package/dist/ui/range-calendar/range-calendar-prev-button.svelte.d.ts +0 -4
- package/dist/ui/range-calendar/range-calendar.svelte.d.ts +0 -5
- package/dist/ui/select/index.d.ts +0 -11
- package/dist/ui/select/index.js +0 -13
- package/dist/ui/select/select-content.svelte.d.ts +0 -7
- package/dist/ui/select/select-group-heading.svelte.d.ts +0 -4
- package/dist/ui/select/select-item.svelte.d.ts +0 -4
- package/dist/ui/select/select-scroll-down-button.svelte.d.ts +0 -4
- package/dist/ui/select/select-scroll-up-button.svelte.d.ts +0 -4
- package/dist/ui/select/select-separator.svelte.d.ts +0 -4
- package/dist/ui/select/select-trigger.svelte.d.ts +0 -4
- package/dist/ui/separator/index.d.ts +0 -2
- package/dist/ui/separator/index.js +0 -4
- package/dist/ui/separator/separator.svelte.d.ts +0 -4
- package/dist/ui/skeleton/index.d.ts +0 -2
- package/dist/ui/skeleton/index.js +0 -4
- package/dist/ui/skeleton/skeleton.svelte.d.ts +0 -5
- package/dist/ui/sonner/index.js +0 -1
- package/dist/ui/sonner/sonner.svelte.d.ts +0 -4
- package/dist/ui/switch/index.d.ts +0 -2
- package/dist/ui/switch/index.js +0 -4
- package/dist/ui/switch/switch.svelte.d.ts +0 -4
- package/dist/ui/textarea/index.d.ts +0 -2
- package/dist/ui/textarea/index.js +0 -4
- package/dist/ui/textarea/textarea.svelte.d.ts +0 -5
- package/dist/ui/tooltip/index.d.ts +0 -6
- package/dist/ui/tooltip/index.js +0 -8
- package/dist/ui/tooltip/tooltip-content.svelte.d.ts +0 -4
- package/dist/workflowEditor.svelte.d.ts +0 -16
- /package/{dist → src/lib/components}/dataTable/footer.svelte +0 -0
- /package/{dist → src/lib/components}/dataTable/table.svelte +0 -0
- /package/{dist → src/lib/components}/detailView/detailViewForm.svelte +0 -0
- /package/{dist → src/lib/components}/detailView/fieldCustomInput.svelte +0 -0
- /package/{dist → src/lib/components}/foreingKeyInput.svelte +0 -0
- /package/{dist → src/lib/components}/sidebar/sidebarElements.svelte +0 -0
- /package/{dist → src/lib/components}/sidebar/sidebarTrigger.svelte +0 -0
- /package/{dist → src/lib/components}/ui/breadcrumb/breadcrumb.svelte +0 -0
- /package/{dist/ui/sonner/index.d.ts → src/lib/components/ui/sonner/index.ts} +0 -0
- /package/{dist → src/lib/components}/ui/sonner/sonner.svelte +0 -0
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import Mustache from "mustache";
|
|
2
|
+
import { ctx } from "$lib/store.svelte";
|
|
3
|
+
import { getFieldRelation } from "$lib/utils";
|
|
4
|
+
import { getField } from "../dataTable/utils";
|
|
5
|
+
import type { DetailFormField } from "./detailViewForm.svelte";
|
|
6
|
+
|
|
7
|
+
export function getDefaultEntry(fieldNames: string[], collectionName: string, values?: Record<string, any>) {
|
|
8
|
+
return Object.fromEntries(
|
|
9
|
+
fieldNames.map((fieldName) => {
|
|
10
|
+
let value = null;
|
|
11
|
+
const field = getField(fieldName, collectionName);
|
|
12
|
+
if (values && values[fieldName] !== undefined) {
|
|
13
|
+
value = values[fieldName];
|
|
14
|
+
} else if (field.pre_processors?.default) {
|
|
15
|
+
const defualtValue = field.pre_processors.default;
|
|
16
|
+
if (typeof defualtValue === "string") {
|
|
17
|
+
value = Mustache.render(defualtValue, {
|
|
18
|
+
now: new Date().toISOString(),
|
|
19
|
+
});
|
|
20
|
+
} else {
|
|
21
|
+
value = defualtValue;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return [fieldName, value];
|
|
25
|
+
}),
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export function serializeEntry(
|
|
30
|
+
collectionName: string,
|
|
31
|
+
entry: Record<string, any>,
|
|
32
|
+
rollback: boolean = false,
|
|
33
|
+
) {
|
|
34
|
+
// deep clone the object
|
|
35
|
+
entry = { ...entry }
|
|
36
|
+
|
|
37
|
+
// serialize the foreign key field's value
|
|
38
|
+
for (const [fieldName, fieldValue] of Object.entries(entry)) {
|
|
39
|
+
const isRefrenceField = Boolean(getFieldRelation(collectionName, fieldName));
|
|
40
|
+
if (isRefrenceField && fieldValue !== null && fieldValue.id !== undefined) {
|
|
41
|
+
entry[fieldName] = fieldValue.id;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// check for related collections properties and serialize them too
|
|
46
|
+
if (!rollback) {
|
|
47
|
+
const childrenRelations = ctx.meta.relations.filter((relation) => relation.to.collection === collectionName);
|
|
48
|
+
const childrenCollectionNames = childrenRelations.map((relation) => relation.from.collection);
|
|
49
|
+
for (let index = 0; index < childrenCollectionNames.length; index++) {
|
|
50
|
+
const childrenCollectionName = childrenCollectionNames[index];
|
|
51
|
+
const childrenEntries = entry[childrenCollectionName];
|
|
52
|
+
if (childrenEntries) {
|
|
53
|
+
for (let index = 0; index < childrenEntries.length; index++) {
|
|
54
|
+
childrenEntries[index] = serializeEntry(childrenCollectionName, childrenEntries[index]);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return entry;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export function generateTransactionBody(
|
|
64
|
+
collectionName: string,
|
|
65
|
+
entry: Record<string, any>,
|
|
66
|
+
) {
|
|
67
|
+
entry = { ...entry }
|
|
68
|
+
function handleEntryRecursive(
|
|
69
|
+
transactionBody: any[],
|
|
70
|
+
collectionName: string,
|
|
71
|
+
entry: Record<string, any>,
|
|
72
|
+
parentTransactionIndex?: number,
|
|
73
|
+
) {
|
|
74
|
+
const parentCollectionName = parentTransactionIndex !== undefined ? transactionBody[parentTransactionIndex].collection : null;
|
|
75
|
+
const foreignKeyFieldName = ctx.meta.relations.find(relation => relation.from.collection === collectionName && relation.to.collection === parentCollectionName)?.from.field;
|
|
76
|
+
const collectionFieldNames = Object.keys(ctx.meta.collections[collectionName].fields);
|
|
77
|
+
const payload: any = {};
|
|
78
|
+
for (let index = 0; index < collectionFieldNames.length; index++) {
|
|
79
|
+
const fieldName = collectionFieldNames[index];
|
|
80
|
+
const isForeignKeyField = fieldName === foreignKeyFieldName;
|
|
81
|
+
if (isForeignKeyField) {
|
|
82
|
+
payload[fieldName] = `{{ responses[${parentTransactionIndex}].data.id }}`
|
|
83
|
+
continue;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
payload[fieldName] = entry[fieldName];
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
const localTransactionIndex = transactionBody.length;
|
|
90
|
+
if (payload.id) {
|
|
91
|
+
const localPayload = {
|
|
92
|
+
[foreignKeyFieldName]: payload[foreignKeyFieldName],
|
|
93
|
+
};
|
|
94
|
+
transactionBody.push({
|
|
95
|
+
collection: collectionName,
|
|
96
|
+
method: "updateMany",
|
|
97
|
+
args: [
|
|
98
|
+
localPayload,
|
|
99
|
+
{
|
|
100
|
+
id: payload.id
|
|
101
|
+
}
|
|
102
|
+
],
|
|
103
|
+
});
|
|
104
|
+
} else {
|
|
105
|
+
transactionBody.push({
|
|
106
|
+
collection: collectionName,
|
|
107
|
+
method: "createOne",
|
|
108
|
+
args: [payload],
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
const childrenRelations = ctx.meta.relations.filter((relation) => relation.to.collection === collectionName);
|
|
113
|
+
const childrenCollectionNames = childrenRelations.map((relation) => relation.from.collection);
|
|
114
|
+
for (let index = 0; index < childrenCollectionNames.length; index++) {
|
|
115
|
+
const childrenCollectionName = childrenCollectionNames[index];
|
|
116
|
+
const childrenEntries = entry[childrenCollectionName];
|
|
117
|
+
if (childrenEntries) {
|
|
118
|
+
for (let index = 0; index < childrenEntries.length; index++) {
|
|
119
|
+
const childrenEntry = childrenEntries[index];
|
|
120
|
+
handleEntryRecursive(transactionBody, childrenCollectionName, childrenEntry, localTransactionIndex);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
const transactionBody: any[] = [];
|
|
127
|
+
|
|
128
|
+
handleEntryRecursive(transactionBody, collectionName, entry);
|
|
129
|
+
|
|
130
|
+
return transactionBody
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export function parseDetailViewValues(collectionName: string, values: Record<string, any>) {
|
|
134
|
+
const forignFieldNames = ctx.meta.relations
|
|
135
|
+
.filter((relation) => relation.from.collection === collectionName)
|
|
136
|
+
.map((relation) => relation.from.field);
|
|
137
|
+
const childCollectionNames = ctx.meta.relations
|
|
138
|
+
.filter((relation) => relation.to.collection === collectionName)
|
|
139
|
+
.map((relation) => relation.from.collection);
|
|
140
|
+
|
|
141
|
+
for (const [key, value] of Object.entries(values)) {
|
|
142
|
+
if (forignFieldNames.includes(key)) {
|
|
143
|
+
if (typeof value === 'number') {
|
|
144
|
+
values[key] = {
|
|
145
|
+
id: value,
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
} else if (childCollectionNames.includes(key)) {
|
|
149
|
+
for (let index = 0; index < values[key].length; index++) {
|
|
150
|
+
parseDetailViewValues(key, values[key][index]);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
export function getCollectionFields(collectionName: string) {
|
|
157
|
+
let returnedData: DetailFormField[] = [];
|
|
158
|
+
|
|
159
|
+
const collectionFields = ctx.meta.collections[collectionName].fields;
|
|
160
|
+
const isSingleton = ctx.meta.collections[collectionName].singleton;
|
|
161
|
+
for (const [fieldName, value] of Object.entries(collectionFields)) {
|
|
162
|
+
|
|
163
|
+
if (isSingleton && fieldName === "id") {
|
|
164
|
+
continue;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
returnedData.push({
|
|
168
|
+
type: "input",
|
|
169
|
+
key: fieldName,
|
|
170
|
+
label: fieldName,
|
|
171
|
+
disabled: fieldName == "id",
|
|
172
|
+
placeholder: fieldName == "id" ? "AUTO_GENERATED" : "",
|
|
173
|
+
})
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
return returnedData;
|
|
177
|
+
}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
import cssWorker from "monaco-editor/esm/vs/language/css/css.worker?worker";
|
|
7
7
|
import htmlWorker from "monaco-editor/esm/vs/language/html/html.worker?worker";
|
|
8
8
|
import tsWorker from "monaco-editor/esm/vs/language/typescript/ts.worker?worker";
|
|
9
|
-
import { cn } from "
|
|
9
|
+
import { cn } from "$lib/utils";
|
|
10
10
|
|
|
11
11
|
interface Props {
|
|
12
12
|
type: "javascript" | "typescript" | "json";
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import { Menu, Moon, Sun } from "lucide-svelte";
|
|
5
5
|
import BreadCrumbs from "./breadCrumbs.svelte";
|
|
6
6
|
import { toggleMode, mode } from "mode-watcher";
|
|
7
|
-
import { mediaQueries } from "
|
|
7
|
+
import { mediaQueries } from "$lib/utils";
|
|
8
8
|
import { expandMiniSideBar } from "./miniSidebar.svelte";
|
|
9
9
|
|
|
10
10
|
let isSmallScreen = $derived(!mediaQueries.sm.current);
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TODO
|
|
3
|
+
*
|
|
4
|
+
* this file shows an example of downloading the types files of a library from npm to use them in adding type support of that library in the vscode editor
|
|
5
|
+
* so the whole point is that for users to be able to paste a url from npm or jsr of a library and have all ts support from its types
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { gunzipSync } from "fflate";
|
|
9
|
+
import { untar } from "@andrewbranch/untar.js";
|
|
10
|
+
|
|
11
|
+
async function extractTgz(buffer: ArrayBuffer) {
|
|
12
|
+
const tarBuffer = gunzipSync(new Uint8Array(buffer));
|
|
13
|
+
|
|
14
|
+
const cleanBuffer = tarBuffer.buffer.slice(
|
|
15
|
+
tarBuffer.byteOffset,
|
|
16
|
+
tarBuffer.byteOffset + tarBuffer.byteLength,
|
|
17
|
+
);
|
|
18
|
+
const files = await untar(cleanBuffer as ArrayBuffer);
|
|
19
|
+
|
|
20
|
+
const dtsFiles = [];
|
|
21
|
+
|
|
22
|
+
for (const file of files) {
|
|
23
|
+
if (file.filename.endsWith(".d.ts")) {
|
|
24
|
+
const content = new TextDecoder().decode(file.fileData);
|
|
25
|
+
dtsFiles.push({ name: file.filename, content });
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return dtsFiles;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const tgzURL = "https://registry.npmjs.org/zod/-/zod-3.22.4.tgz";
|
|
33
|
+
const response = await fetch(tgzURL);
|
|
34
|
+
const arrayBuffer = await response.arrayBuffer();
|
|
35
|
+
|
|
36
|
+
const files = await extractTgz(arrayBuffer);
|
|
@@ -12,14 +12,14 @@
|
|
|
12
12
|
|
|
13
13
|
<script lang="ts">
|
|
14
14
|
import { House, Layers, Library, LogOut, Workflow, X } from "lucide-svelte";
|
|
15
|
-
import Button from "
|
|
16
|
-
import Separator from "
|
|
17
|
-
import * as Tooltip from "
|
|
18
|
-
import * as Accordion from "
|
|
15
|
+
import Button from "$lib/components/ui/button/button.svelte";
|
|
16
|
+
import Separator from "$lib/components/ui/separator/separator.svelte";
|
|
17
|
+
import * as Tooltip from "$lib/components/ui/tooltip";
|
|
18
|
+
import * as Accordion from "$lib/components/ui/accordion/index.js";
|
|
19
19
|
|
|
20
|
-
import { ctx } from "
|
|
21
|
-
import { getDashboardNavs } from "
|
|
22
|
-
import { mediaQueries } from "
|
|
20
|
+
import { ctx } from "$lib/store.svelte";
|
|
21
|
+
import { getDashboardNavs } from "$lib/extensions/extensionUtils";
|
|
22
|
+
import { mediaQueries } from "$lib/utils";
|
|
23
23
|
import * as Popover from "./ui/popover";
|
|
24
24
|
import { location } from "@wjfe/n-savant";
|
|
25
25
|
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
import cssWorker from "monaco-editor/esm/vs/language/css/css.worker?worker";
|
|
7
7
|
import htmlWorker from "monaco-editor/esm/vs/language/html/html.worker?worker";
|
|
8
8
|
import tsWorker from "monaco-editor/esm/vs/language/typescript/ts.worker?worker";
|
|
9
|
-
import { cn } from "
|
|
9
|
+
import { cn } from "$lib/utils";
|
|
10
10
|
|
|
11
11
|
interface Props {
|
|
12
12
|
type: "javascript" | "typescript" | "json" | "sql";
|
|
@@ -10,10 +10,10 @@
|
|
|
10
10
|
startOfWeek,
|
|
11
11
|
today,
|
|
12
12
|
} from "@internationalized/date";
|
|
13
|
-
import { cn } from "
|
|
14
|
-
import { buttonVariants } from "
|
|
15
|
-
import { RangeCalendar } from "
|
|
16
|
-
import * as Popover from "
|
|
13
|
+
import { cn } from "$lib/utils.js";
|
|
14
|
+
import { buttonVariants } from "$lib/components/ui/button/index.js";
|
|
15
|
+
import { RangeCalendar } from "$lib/components/ui/range-calendar/index.js";
|
|
16
|
+
import * as Popover from "$lib/components/ui/popover/index.js";
|
|
17
17
|
import Input from "./ui/input/input.svelte";
|
|
18
18
|
|
|
19
19
|
interface Props {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import Button, { type ButtonProps } from "./ui/button/button.svelte";
|
|
4
4
|
import DataTable from "./dataTable/dataTable.svelte";
|
|
5
5
|
import { getCollectionPrimaryField } from "./dataTable/utils";
|
|
6
|
-
import { emitEvent } from "
|
|
6
|
+
import { emitEvent } from "$lib/eventSystem";
|
|
7
7
|
import Drawer from "./drawer.svelte";
|
|
8
8
|
|
|
9
9
|
interface LocalProps extends ButtonProps {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { toast } from "svelte-sonner";
|
|
3
3
|
import Button from "./ui/button/button.svelte";
|
|
4
|
-
import { ctx } from "
|
|
5
|
-
import { Input } from "
|
|
4
|
+
import { ctx } from "$lib/store.svelte";
|
|
5
|
+
import { Input } from "$lib/components/ui/input";
|
|
6
6
|
|
|
7
7
|
let formData = {
|
|
8
8
|
server: "",
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
<script lang="ts">
|
|
8
8
|
import { setContext, type Snippet } from "svelte";
|
|
9
9
|
|
|
10
|
-
import { mediaQueries } from "
|
|
10
|
+
import { mediaQueries } from "$lib/utils";
|
|
11
11
|
import Skeleton from "../ui/skeleton/skeleton.svelte";
|
|
12
12
|
import { Search } from "lucide-svelte";
|
|
13
13
|
import SidebarElements, {
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import SidebarTrigger from "./sidebar/sidebarTrigger.svelte";
|
|
6
6
|
import Button from "./ui/button/button.svelte";
|
|
7
7
|
import { onMount } from "svelte";
|
|
8
|
-
import { lobb } from "
|
|
8
|
+
import { lobb } from "$lib";
|
|
9
9
|
import { toast } from "svelte-sonner";
|
|
10
10
|
import Skeleton from "./ui/skeleton/skeleton.svelte";
|
|
11
11
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { Accordion as AccordionPrimitive, type WithoutChild } from "bits-ui";
|
|
3
3
|
import ChevronDown from "@lucide/svelte/icons/chevron-down";
|
|
4
|
-
import { cn } from "
|
|
4
|
+
import { cn } from "$lib/utils.js";
|
|
5
5
|
|
|
6
6
|
let {
|
|
7
7
|
ref = $bindable(null),
|
|
@@ -2,7 +2,16 @@ import { Accordion as AccordionPrimitive } from "bits-ui";
|
|
|
2
2
|
import Content from "./accordion-content.svelte";
|
|
3
3
|
import Item from "./accordion-item.svelte";
|
|
4
4
|
import Trigger from "./accordion-trigger.svelte";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
Root
|
|
5
|
+
|
|
6
|
+
const Root = AccordionPrimitive.Root;
|
|
7
|
+
export {
|
|
8
|
+
Root,
|
|
9
|
+
Content,
|
|
10
|
+
Item,
|
|
11
|
+
Trigger,
|
|
12
|
+
//
|
|
13
|
+
Root as Accordion,
|
|
14
|
+
Content as AccordionContent,
|
|
15
|
+
Item as AccordionItem,
|
|
16
|
+
Trigger as AccordionTrigger,
|
|
17
|
+
};
|
|
@@ -2,4 +2,13 @@ import Root from "./alert.svelte";
|
|
|
2
2
|
import Description from "./alert-description.svelte";
|
|
3
3
|
import Title from "./alert-title.svelte";
|
|
4
4
|
export { alertVariants, type AlertVariant } from "./alert.svelte";
|
|
5
|
-
|
|
5
|
+
|
|
6
|
+
export {
|
|
7
|
+
Root,
|
|
8
|
+
Description,
|
|
9
|
+
Title,
|
|
10
|
+
//
|
|
11
|
+
Root as Alert,
|
|
12
|
+
Description as AlertDescription,
|
|
13
|
+
Title as AlertTitle,
|
|
14
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { AlertDialog as AlertDialogPrimitive } from "bits-ui";
|
|
3
|
-
import { buttonVariants } from "
|
|
4
|
-
import { cn } from "
|
|
3
|
+
import { buttonVariants } from "$lib/components/ui/button/index.js";
|
|
4
|
+
import { cn } from "$lib/utils.js";
|
|
5
5
|
|
|
6
6
|
let {
|
|
7
7
|
class: className,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { AlertDialog as AlertDialogPrimitive } from "bits-ui";
|
|
3
|
-
import { buttonVariants } from "
|
|
4
|
-
import { cn } from "
|
|
3
|
+
import { buttonVariants } from "$lib/components/ui/button/index.js";
|
|
4
|
+
import { cn } from "$lib/utils.js";
|
|
5
5
|
|
|
6
6
|
let {
|
|
7
7
|
class: className,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { AlertDialog as AlertDialogPrimitive, type WithoutChild } from "bits-ui";
|
|
3
3
|
import AlertDialogOverlay from "./alert-dialog-overlay.svelte";
|
|
4
|
-
import { cn } from "
|
|
4
|
+
import { cn } from "$lib/utils.js";
|
|
5
5
|
|
|
6
6
|
let {
|
|
7
7
|
ref = $bindable(null),
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { AlertDialog as AlertDialogPrimitive } from "bits-ui";
|
|
2
|
+
|
|
3
|
+
import Title from "./alert-dialog-title.svelte";
|
|
4
|
+
import Action from "./alert-dialog-action.svelte";
|
|
5
|
+
import Cancel from "./alert-dialog-cancel.svelte";
|
|
6
|
+
import Footer from "./alert-dialog-footer.svelte";
|
|
7
|
+
import Header from "./alert-dialog-header.svelte";
|
|
8
|
+
import Overlay from "./alert-dialog-overlay.svelte";
|
|
9
|
+
import Content from "./alert-dialog-content.svelte";
|
|
10
|
+
import Description from "./alert-dialog-description.svelte";
|
|
11
|
+
|
|
12
|
+
const Root = AlertDialogPrimitive.Root;
|
|
13
|
+
const Trigger = AlertDialogPrimitive.Trigger;
|
|
14
|
+
const Portal = AlertDialogPrimitive.Portal;
|
|
15
|
+
|
|
16
|
+
export {
|
|
17
|
+
Root,
|
|
18
|
+
Title,
|
|
19
|
+
Action,
|
|
20
|
+
Cancel,
|
|
21
|
+
Portal,
|
|
22
|
+
Footer,
|
|
23
|
+
Header,
|
|
24
|
+
Trigger,
|
|
25
|
+
Overlay,
|
|
26
|
+
Content,
|
|
27
|
+
Description,
|
|
28
|
+
//
|
|
29
|
+
Root as AlertDialog,
|
|
30
|
+
Title as AlertDialogTitle,
|
|
31
|
+
Action as AlertDialogAction,
|
|
32
|
+
Cancel as AlertDialogCancel,
|
|
33
|
+
Portal as AlertDialogPortal,
|
|
34
|
+
Footer as AlertDialogFooter,
|
|
35
|
+
Header as AlertDialogHeader,
|
|
36
|
+
Trigger as AlertDialogTrigger,
|
|
37
|
+
Overlay as AlertDialogOverlay,
|
|
38
|
+
Content as AlertDialogContent,
|
|
39
|
+
Description as AlertDialogDescription,
|
|
40
|
+
};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import Ellipsis from "@lucide/svelte/icons/ellipsis";
|
|
3
3
|
import type { WithElementRef, WithoutChildren } from "bits-ui";
|
|
4
4
|
import type { HTMLAttributes } from "svelte/elements";
|
|
5
|
-
import { cn } from "
|
|
5
|
+
import { cn } from "$lib/utils.js";
|
|
6
6
|
|
|
7
7
|
let {
|
|
8
8
|
ref = $bindable(null),
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import ChevronRight from "@lucide/svelte/icons/chevron-right";
|
|
3
3
|
import type { WithElementRef } from "bits-ui";
|
|
4
4
|
import type { HTMLLiAttributes } from "svelte/elements";
|
|
5
|
-
import { cn } from "
|
|
5
|
+
import { cn } from "$lib/utils.js";
|
|
6
6
|
|
|
7
7
|
let {
|
|
8
8
|
ref = $bindable(null),
|