@warkypublic/svelix 0.1.46 → 0.1.47
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 +93 -33
- package/dist/components/BetterMenu/BetterMenu.svelte +21 -37
- package/dist/components/BetterMenu/BetterMenuAsyncButton.svelte +21 -31
- package/dist/components/BetterMenu/BetterMenuPreview.svelte +27 -29
- package/dist/components/BetterMenu/MenuRenderer.svelte +40 -51
- package/dist/components/Boxer/Boxer.svelte +488 -602
- package/dist/components/Boxer/BoxerTarget.svelte +6 -46
- package/dist/components/Boxer/BoxerTarget.svelte.d.ts +1 -0
- package/dist/components/Boxer/types.d.ts +0 -1
- package/dist/components/Button.svelte +19 -43
- package/dist/components/ButtonPreview.svelte +2 -11
- package/dist/components/CardGrid/CardGrid.svelte +443 -614
- package/dist/components/CardGrid/CardGridFilterPanel.svelte +111 -90
- package/dist/components/CardGrid/DefaultCard.svelte +80 -96
- package/dist/components/CardGrid/ImageCardStory.svelte +87 -36
- package/dist/components/ContentEditor/CollaboraInsertTextDemo.svelte +5 -10
- package/dist/components/ContentEditor/ContentEditor.svelte +24 -50
- package/dist/components/ContentEditor/subcomponents/AudioPlayer.svelte +17 -17
- package/dist/components/ContentEditor/subcomponents/CollaboraEditor.svelte +244 -309
- package/dist/components/ContentEditor/subcomponents/EmailViewer.svelte +2 -3
- package/dist/components/ContentEditor/subcomponents/ImageViewer.svelte +14 -15
- package/dist/components/ContentEditor/subcomponents/MarkdownViewer.svelte +74 -90
- package/dist/components/ContentEditor/subcomponents/MonacoEditor.svelte +75 -103
- package/dist/components/ContentEditor/subcomponents/Office365Editor.svelte +234 -297
- package/dist/components/ContentEditor/subcomponents/PdfViewer.svelte +14 -20
- package/dist/components/ContentEditor/subcomponents/TextEditor.svelte +122 -150
- package/dist/components/ContentEditor/subcomponents/UnknownFile.svelte +105 -126
- package/dist/components/ContentEditor/subcomponents/VideoPlayer.svelte +17 -17
- package/dist/components/ContentEditor/subcomponents/ZipViewer.svelte +2 -3
- package/dist/components/ErrorBoundary/ErrorBoundary.svelte +41 -58
- package/dist/components/ErrorBoundary/ErrorBoundaryPreview.svelte +8 -16
- package/dist/components/Former/Former.svelte +306 -424
- package/dist/components/Former/FormerButtonArea.svelte +17 -68
- package/dist/components/Former/FormerDrawer.svelte +26 -78
- package/dist/components/Former/FormerDrawerPreview.svelte +99 -89
- package/dist/components/Former/FormerModal.svelte +24 -70
- package/dist/components/Former/FormerModalPreview.svelte +99 -89
- package/dist/components/Former/FormerPreview.svelte +76 -78
- package/dist/components/Former/FormerRestApiPreview.svelte +55 -48
- package/dist/components/FormerControllers/ButtonCtrl.svelte +13 -44
- package/dist/components/FormerControllers/DateTimeCtrl/DateTimeCtrl.svelte +280 -445
- package/dist/components/FormerControllers/DateTimeCtrl/DateTimeCtrlCalendar.svelte +95 -136
- package/dist/components/FormerControllers/DateTimeCtrl/DateTimeCtrlPickerPanel.svelte +3 -62
- package/dist/components/FormerControllers/DateTimeCtrl/DateTimeCtrlTimeFields.svelte +143 -217
- package/dist/components/FormerControllers/IconButtonCtrl.svelte +13 -42
- package/dist/components/FormerControllers/InlineWrapper.svelte +12 -41
- package/dist/components/FormerControllers/InlineWrapperPreview.svelte +4 -26
- package/dist/components/FormerControllers/NativeSelectCtrl.svelte +3 -29
- package/dist/components/FormerControllers/NumberInputCtrl.svelte +9 -35
- package/dist/components/FormerControllers/PasswordInputCtrl.svelte +4 -23
- package/dist/components/FormerControllers/SwitchCtrl.svelte +3 -20
- package/dist/components/FormerControllers/TextAreaCtrl.svelte +3 -24
- package/dist/components/FormerControllers/TextInputCtrl.svelte +3 -24
- package/dist/components/GlobalStateStore/GlobalStateStoreProvider.svelte +73 -120
- package/dist/components/Gridler/components/Gridler.svelte +338 -442
- package/dist/components/Gridler/components/GridlerCanvas.svelte +720 -1115
- package/dist/components/Gridler/components/GridlerEditor.svelte +2 -15
- package/dist/components/Gridler/components/GridlerFull.svelte +520 -841
- package/dist/components/Gridler/components/GridlerFull.svelte.d.ts +1 -1
- package/dist/components/Gridler/components/GridlerFullWithFormerPreview.svelte +194 -147
- package/dist/components/Gridler/components/GridlerSearch.svelte +7 -16
- package/dist/components/Gridler/components/GridlerSearchToggle.svelte +7 -19
- package/dist/components/Gridler/types.d.ts +1 -1
- package/dist/components/Icons/IconAdd.svelte +1 -3
- package/dist/components/Icons/IconAlertCircle.svelte +1 -3
- package/dist/components/Icons/IconAlertTriangle.svelte +1 -3
- package/dist/components/Icons/IconCamera.svelte +1 -3
- package/dist/components/Icons/IconClose.svelte +1 -3
- package/dist/components/Icons/IconEdit.svelte +1 -3
- package/dist/components/Icons/IconFilter.svelte +1 -3
- package/dist/components/Icons/IconSearch.svelte +1 -3
- package/dist/components/Icons/IconSort.svelte +1 -3
- package/dist/components/Icons/IconTrash.svelte +1 -3
- package/dist/components/Portal/Portal.svelte +14 -38
- package/dist/components/Screenshot/Screenshot.svelte +7 -13
- package/dist/components/Svark/Svark.svelte +680 -852
- package/dist/components/Svark/SvarkContextMenu.svelte +44 -63
- package/dist/components/Svark/SvarkInfiniteLoader.svelte +2 -6
- package/dist/components/Svark/SvarkPager.svelte +2 -28
- package/dist/components/Svark/SvarkSelectionDemo.svelte +4 -8
- package/dist/components/Svark/SvarkTopBar.svelte +9 -74
- package/dist/components/SvarkGrid/SvarkGrid.svelte +877 -1123
- package/dist/components/SvarkGrid/components/SvarkColumnFilterForm.svelte +45 -58
- package/dist/components/SvarkGrid/components/SvarkContextMenu.svelte +44 -63
- package/dist/components/SvarkGrid/components/SvarkHeaderFilterCell.svelte +41 -75
- package/dist/components/SvarkGrid/components/SvarkInfiniteLoader.svelte +2 -6
- package/dist/components/SvarkGrid/components/SvarkPager.svelte +2 -28
- package/dist/components/SvarkGrid/components/SvarkSearchPopover.svelte +8 -16
- package/dist/components/SvarkGrid/components/SvarkTopBar.svelte +6 -62
- package/dist/components/SvarkGrid/internal/SvarkGridView.svelte +345 -507
- package/dist/components/VTree/VTree.svelte +349 -431
- package/dist/components/VTree/VTreeContextMenu.svelte +21 -33
- package/dist/components/VTree/VTreeEventsDemo.svelte +48 -58
- package/dist/components/VTree/VTreeRow.svelte +13 -65
- package/dist/components/VTree/VTreeSearch.svelte +6 -13
- package/dist/components/VTree/VTreeVirtualViewport.svelte +37 -106
- package/package.json +30 -29
|
@@ -1,93 +1,104 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
1
|
+
<script lang="ts">import FormerModal from "./FormerModal.svelte";
|
|
2
|
+
import TextInputCtrl from "../FormerControllers/TextInputCtrl.svelte";
|
|
3
|
+
import PasswordInputCtrl from "../FormerControllers/PasswordInputCtrl.svelte";
|
|
4
|
+
import NumberInputCtrl from "../FormerControllers/NumberInputCtrl.svelte";
|
|
5
|
+
import NativeSelectCtrl from "../FormerControllers/NativeSelectCtrl.svelte";
|
|
6
|
+
import TextAreaCtrl from "../FormerControllers/TextAreaCtrl.svelte";
|
|
7
|
+
import SwitchCtrl from "../FormerControllers/SwitchCtrl.svelte";
|
|
8
|
+
import Boxer from "../Boxer/Boxer.svelte";
|
|
9
|
+
const { request = "insert" } = $props();
|
|
10
|
+
const emptyUser = {
|
|
11
|
+
firstName: "",
|
|
12
|
+
lastName: "",
|
|
13
|
+
email: "",
|
|
14
|
+
password: "",
|
|
15
|
+
age: undefined,
|
|
16
|
+
role: "",
|
|
17
|
+
department: "",
|
|
18
|
+
skills: [],
|
|
19
|
+
bio: "",
|
|
20
|
+
website: "",
|
|
21
|
+
emailNotifications: true,
|
|
22
|
+
active: true
|
|
23
|
+
};
|
|
24
|
+
const filledUser = {
|
|
25
|
+
id: 1,
|
|
26
|
+
firstName: "Jane",
|
|
27
|
+
lastName: "Smith",
|
|
28
|
+
email: "jane.smith@example.com",
|
|
29
|
+
password: "",
|
|
30
|
+
age: 32,
|
|
31
|
+
role: "admin",
|
|
32
|
+
department: "engineering",
|
|
33
|
+
skills: ["typescript", "svelte"],
|
|
34
|
+
bio: "Senior software engineer with 10 years of experience building scalable systems.",
|
|
35
|
+
website: "https://janesmith.dev",
|
|
36
|
+
emailNotifications: true,
|
|
37
|
+
active: true
|
|
38
|
+
};
|
|
39
|
+
const roleOptions = [
|
|
40
|
+
{
|
|
41
|
+
label: "Admin",
|
|
42
|
+
value: "admin"
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
label: "Editor",
|
|
46
|
+
value: "editor"
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
label: "Viewer",
|
|
50
|
+
value: "viewer"
|
|
27
51
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
52
|
+
];
|
|
53
|
+
const departmentOptions = [
|
|
54
|
+
{
|
|
55
|
+
label: "Engineering",
|
|
56
|
+
value: "engineering"
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
label: "Product",
|
|
60
|
+
value: "product"
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
label: "Design",
|
|
64
|
+
value: "design"
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
label: "Marketing",
|
|
68
|
+
value: "marketing"
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
label: "Operations",
|
|
72
|
+
value: "operations"
|
|
31
73
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
bio: 'Senior software engineer with 10 years of experience building scalable systems.',
|
|
61
|
-
website: 'https://janesmith.dev',
|
|
62
|
-
emailNotifications: true,
|
|
63
|
-
active: true,
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
const roleOptions = [
|
|
67
|
-
{ label: 'Admin', value: 'admin' },
|
|
68
|
-
{ label: 'Editor', value: 'editor' },
|
|
69
|
-
{ label: 'Viewer', value: 'viewer' },
|
|
70
|
-
];
|
|
71
|
-
|
|
72
|
-
const departmentOptions = [
|
|
73
|
-
{ label: 'Engineering', value: 'engineering' },
|
|
74
|
-
{ label: 'Product', value: 'product' },
|
|
75
|
-
{ label: 'Design', value: 'design' },
|
|
76
|
-
{ label: 'Marketing', value: 'marketing' },
|
|
77
|
-
{ label: 'Operations', value: 'operations' },
|
|
78
|
-
];
|
|
79
|
-
|
|
80
|
-
const skillOptions = [
|
|
81
|
-
{ label: 'Svelte', value: 'svelte' },
|
|
82
|
-
{ label: 'TypeScript', value: 'typescript' },
|
|
83
|
-
{ label: 'Node.js', value: 'nodejs' },
|
|
84
|
-
{ label: 'Testing', value: 'testing' },
|
|
85
|
-
{ label: 'UX', value: 'ux' },
|
|
86
|
-
];
|
|
87
|
-
|
|
88
|
-
let values = $state<UserForm>(request === 'insert' ? { ...emptyUser } : { ...filledUser });
|
|
89
|
-
let lastSaved = $state<UserForm | undefined>(undefined);
|
|
90
|
-
let opened = $state(false);
|
|
74
|
+
];
|
|
75
|
+
const skillOptions = [
|
|
76
|
+
{
|
|
77
|
+
label: "Svelte",
|
|
78
|
+
value: "svelte"
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
label: "TypeScript",
|
|
82
|
+
value: "typescript"
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
label: "Node.js",
|
|
86
|
+
value: "nodejs"
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
label: "Testing",
|
|
90
|
+
value: "testing"
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
label: "UX",
|
|
94
|
+
value: "ux"
|
|
95
|
+
}
|
|
96
|
+
];
|
|
97
|
+
// eslint-disable-next-line svelte/no-unused-svelte-ignore
|
|
98
|
+
// svelte-ignore state_referenced_locally -- initial value is intentional (sets up form state once)
|
|
99
|
+
let values = $state(request === "insert" ? { ...emptyUser } : { ...filledUser });
|
|
100
|
+
let lastSaved = $state(undefined);
|
|
101
|
+
let opened = $state(false);
|
|
91
102
|
</script>
|
|
92
103
|
|
|
93
104
|
<div class="p-8 space-y-6">
|
|
@@ -212,7 +223,6 @@
|
|
|
212
223
|
data={skillOptions}
|
|
213
224
|
dataSource="local"
|
|
214
225
|
multiSelect
|
|
215
|
-
searchable
|
|
216
226
|
clearable
|
|
217
227
|
placeholder="Search skills..."
|
|
218
228
|
disabled={isReadonly}
|
|
@@ -1,81 +1,79 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
{ label: 'Operations', value: 'operations' },
|
|
78
|
-
];
|
|
1
|
+
<script lang="ts">import Former from "./Former.svelte";
|
|
2
|
+
import TextInputCtrl from "../FormerControllers/TextInputCtrl.svelte";
|
|
3
|
+
import PasswordInputCtrl from "../FormerControllers/PasswordInputCtrl.svelte";
|
|
4
|
+
import NumberInputCtrl from "../FormerControllers/NumberInputCtrl.svelte";
|
|
5
|
+
import NativeSelectCtrl from "../FormerControllers/NativeSelectCtrl.svelte";
|
|
6
|
+
import TextAreaCtrl from "../FormerControllers/TextAreaCtrl.svelte";
|
|
7
|
+
import SwitchCtrl from "../FormerControllers/SwitchCtrl.svelte";
|
|
8
|
+
const { request = "insert", showKeepOpenSwitch = false } = $props();
|
|
9
|
+
const emptyUser = {
|
|
10
|
+
firstName: "",
|
|
11
|
+
lastName: "",
|
|
12
|
+
email: "",
|
|
13
|
+
password: "",
|
|
14
|
+
age: undefined,
|
|
15
|
+
role: "",
|
|
16
|
+
department: "",
|
|
17
|
+
bio: "",
|
|
18
|
+
website: "",
|
|
19
|
+
emailNotifications: true,
|
|
20
|
+
active: true
|
|
21
|
+
};
|
|
22
|
+
const filledUser = {
|
|
23
|
+
id: 1,
|
|
24
|
+
firstName: "Jane",
|
|
25
|
+
lastName: "Smith",
|
|
26
|
+
email: "jane.smith@example.com",
|
|
27
|
+
password: "",
|
|
28
|
+
age: 32,
|
|
29
|
+
role: "admin",
|
|
30
|
+
department: "engineering",
|
|
31
|
+
bio: "Senior software engineer with 10 years of experience building scalable systems.",
|
|
32
|
+
website: "https://janesmith.dev",
|
|
33
|
+
emailNotifications: true,
|
|
34
|
+
active: true
|
|
35
|
+
};
|
|
36
|
+
// eslint-disable-next-line svelte/no-unused-svelte-ignore
|
|
37
|
+
// svelte-ignore state_referenced_locally -- initial value is intentional (sets up form state once)
|
|
38
|
+
let values = $state(request === "insert" ? { ...emptyUser } : { ...filledUser });
|
|
39
|
+
let lastSaved = $state(undefined);
|
|
40
|
+
let opened = $state(true);
|
|
41
|
+
const roleOptions = [
|
|
42
|
+
{
|
|
43
|
+
label: "Admin",
|
|
44
|
+
value: "admin"
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
label: "Editor",
|
|
48
|
+
value: "editor"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
label: "Viewer",
|
|
52
|
+
value: "viewer"
|
|
53
|
+
}
|
|
54
|
+
];
|
|
55
|
+
const departmentOptions = [
|
|
56
|
+
{
|
|
57
|
+
label: "Engineering",
|
|
58
|
+
value: "engineering"
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
label: "Product",
|
|
62
|
+
value: "product"
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
label: "Design",
|
|
66
|
+
value: "design"
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
label: "Marketing",
|
|
70
|
+
value: "marketing"
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
label: "Operations",
|
|
74
|
+
value: "operations"
|
|
75
|
+
}
|
|
76
|
+
];
|
|
79
77
|
</script>
|
|
80
78
|
|
|
81
79
|
<div class="p-6 space-y-6">
|
|
@@ -1,51 +1,58 @@
|
|
|
1
|
-
<script lang="ts"
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
1
|
+
<script lang="ts">/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
+
import FormerModal from "./FormerModal.svelte";
|
|
3
|
+
import { FormerRestHeadSpecAPI } from "./FormerRestHeadSpecAPI";
|
|
4
|
+
import TextInputCtrl from "../FormerControllers/TextInputCtrl.svelte";
|
|
5
|
+
import TextAreaCtrl from "../FormerControllers/TextAreaCtrl.svelte";
|
|
6
|
+
import NativeSelectCtrl from "../FormerControllers/NativeSelectCtrl.svelte";
|
|
7
|
+
// ── Config state ────────────────────────────────────────────────────────────
|
|
8
|
+
let apiUrl = $state("https://www.postb.in/b/1771846908265-6770497136749");
|
|
9
|
+
let authToken = $state("");
|
|
10
|
+
let showToken = $state(false);
|
|
11
|
+
let recordId = $state("1");
|
|
12
|
+
let request = $state("insert");
|
|
13
|
+
// ── Modal state ─────────────────────────────────────────────────────────────
|
|
14
|
+
let opened = $state(false);
|
|
15
|
+
let values = $state({});
|
|
16
|
+
let lastResponse = $state(undefined);
|
|
17
|
+
let lastError = $state(undefined);
|
|
18
|
+
// Re-create the API adapter whenever the URL or token changes.
|
|
19
|
+
// $derived is correct here — FormerRestHeadSpecAPI is a pure factory function.
|
|
20
|
+
const onAPICall = $derived(FormerRestHeadSpecAPI({
|
|
21
|
+
authToken,
|
|
22
|
+
url: apiUrl
|
|
23
|
+
}));
|
|
24
|
+
const requestOptions = [
|
|
25
|
+
{
|
|
26
|
+
label: "Insert (POST)",
|
|
27
|
+
value: "insert"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
label: "Update (PUT)",
|
|
31
|
+
value: "update"
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
label: "Delete (DELETE)",
|
|
35
|
+
value: "delete"
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
label: "View (GET)",
|
|
39
|
+
value: "view"
|
|
40
|
+
}
|
|
41
|
+
];
|
|
42
|
+
function openForm() {
|
|
43
|
+
lastError = undefined;
|
|
44
|
+
if (request === "insert") {
|
|
45
|
+
values = {
|
|
46
|
+
title: "",
|
|
47
|
+
body: "",
|
|
48
|
+
userId: 1
|
|
49
|
+
};
|
|
50
|
+
} else {
|
|
51
|
+
// For non-insert modes prime the key so Former knows which record to load.
|
|
52
|
+
values = { id: Number(recordId) || 1 };
|
|
53
|
+
}
|
|
54
|
+
opened = true;
|
|
55
|
+
}
|
|
49
56
|
</script>
|
|
50
57
|
|
|
51
58
|
<div class="p-6 space-y-6">
|
|
@@ -1,49 +1,18 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
variant?: 'filled' | 'ghost' | 'outlined';
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
const {
|
|
16
|
-
children,
|
|
17
|
-
disabled,
|
|
18
|
-
loading: externalLoading = false,
|
|
19
|
-
onclick,
|
|
20
|
-
sid,
|
|
21
|
-
title,
|
|
22
|
-
tooltip,
|
|
23
|
-
variant = 'filled',
|
|
24
|
-
}: Props = $props();
|
|
25
|
-
|
|
26
|
-
let internalLoading = $state(false);
|
|
27
|
-
const isLoading = $derived(internalLoading || externalLoading);
|
|
28
|
-
|
|
29
|
-
const variantClass = $derived(
|
|
30
|
-
variant === 'outlined'
|
|
31
|
-
? 'preset-outlined-primary-500'
|
|
32
|
-
: variant === 'ghost'
|
|
33
|
-
? 'preset-tonal-primary'
|
|
34
|
-
: 'preset-filled-primary-500'
|
|
35
|
-
);
|
|
36
|
-
|
|
37
|
-
async function handleClick() {
|
|
38
|
-
if (onclick && !isLoading) {
|
|
39
|
-
internalLoading = true;
|
|
40
|
-
try {
|
|
41
|
-
await onclick();
|
|
42
|
-
} finally {
|
|
43
|
-
internalLoading = false;
|
|
44
|
-
}
|
|
1
|
+
<script lang="ts">const { children, disabled, loading: externalLoading = false, onclick, sid, title, tooltip, variant = "filled" } = $props();
|
|
2
|
+
let internalLoading = $state(false);
|
|
3
|
+
const isLoading = $derived(internalLoading || externalLoading);
|
|
4
|
+
const variantClass = $derived(variant === "outlined" ? "preset-outlined-primary-500" : variant === "ghost" ? "preset-tonal-primary" : "preset-filled-primary-500");
|
|
5
|
+
async function handleClick() {
|
|
6
|
+
if (onclick && !isLoading) {
|
|
7
|
+
internalLoading = true;
|
|
8
|
+
try {
|
|
9
|
+
await onclick();
|
|
10
|
+
} finally {
|
|
11
|
+
internalLoading = false;
|
|
45
12
|
}
|
|
46
13
|
}
|
|
14
|
+
}
|
|
15
|
+
export {};
|
|
47
16
|
</script>
|
|
48
17
|
|
|
49
18
|
<button
|