sveltekit-ui 1.0.29 → 1.0.31
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 +4 -0
- package/dist/Components/Content/index.svelte +2 -0
- package/dist/Components/ContentInput/AttributesInput/index.svelte +5 -0
- package/dist/Components/ContentInput/AttributesInput/index.svelte.js +21 -8
- package/dist/Components/ContentInput/index.svelte.js +7 -1
- package/dist/Components/TableAdvanced/ColumnInput/index.svelte.js +21 -22
- package/dist/Components/VariablePathInput/index.svelte.js +10 -2
- package/dist/client/astc_formatting/index.js +4 -1
- package/dist/client/types/index.js +4 -0
- package/package.json +3 -3
- package/src/lib/Components/Content/index.svelte +2 -0
- package/src/lib/Components/ContentInput/AttributesInput/index.svelte +5 -0
- package/src/lib/Components/ContentInput/AttributesInput/index.svelte.js +21 -8
- package/src/lib/Components/ContentInput/index.svelte.js +7 -1
- package/src/lib/Components/TableAdvanced/ColumnInput/index.svelte.js +21 -22
- package/src/lib/Components/VariablePathInput/index.svelte.js +10 -2
- package/src/lib/client/astc_formatting/index.js +4 -1
- package/src/lib/client/types/index.js +4 -0
package/README.md
CHANGED
|
@@ -29,3 +29,7 @@ npm run dev
|
|
|
29
29
|
## Browser
|
|
30
30
|
|
|
31
31
|
That should spit out a url like http://localhost:5173/ where you should see your starting website.
|
|
32
|
+
|
|
33
|
+
## Code Generator
|
|
34
|
+
|
|
35
|
+
This is experimental but you can check out https://www.contibase.com/code_generator for component building help
|
|
@@ -152,6 +152,8 @@
|
|
|
152
152
|
? `padding: ${set_closurable(manager?.val_prepped?.attributes?.padding)}rem;`
|
|
153
153
|
: ''} {manager?.val_prepped?.attributes?.border_radius
|
|
154
154
|
? `border-radius: ${set_closurable(manager?.val_prepped?.attributes?.border_radius)}rem;`
|
|
155
|
+
: ''} {manager?.val_prepped?.attributes?.gap
|
|
156
|
+
? `gap: ${set_closurable(manager?.val_prepped?.attributes?.gap)}rem;`
|
|
155
157
|
: ''} {manager?.val_prepped?.attributes?.padding
|
|
156
158
|
? `padding: ${set_closurable(manager?.val_prepped?.attributes?.padding)}rem;`
|
|
157
159
|
: ''} {manager?.val_prepped?.attributes?.align_content || manager?.val_prepped?.attributes?.justify_content
|
|
@@ -145,6 +145,11 @@
|
|
|
145
145
|
<Dropdown manager={manager?.attributes_manager?.justify_content_dropdown_manager} />
|
|
146
146
|
{/snippet}
|
|
147
147
|
</DefinedTypeInput>
|
|
148
|
+
<DefinedTypeInput manager={manager?.attributes_manager?.gap_defined_type_input_manager}>
|
|
149
|
+
{#snippet content()}
|
|
150
|
+
<Slider manager={manager?.attributes_manager?.gap_slider_manager} />
|
|
151
|
+
{/snippet}
|
|
152
|
+
</DefinedTypeInput>
|
|
148
153
|
{:else if manager?.content_type == "show_conditions"}
|
|
149
154
|
<DefinedTypeInput manager={manager?.attributes_manager?.is_run_serverside_defined_type_input_manager}>
|
|
150
155
|
{#snippet content()}
|
|
@@ -359,6 +359,24 @@ export function create_attributes_input_manager(config) {
|
|
|
359
359
|
attributes: config?.val,
|
|
360
360
|
})
|
|
361
361
|
)
|
|
362
|
+
|
|
363
|
+
let gap_slider_manager = $state(
|
|
364
|
+
create_slider_manager({
|
|
365
|
+
min: 0,
|
|
366
|
+
max: 5,
|
|
367
|
+
step: 0.1,
|
|
368
|
+
val: config?.val?.gap ?? 0,
|
|
369
|
+
})
|
|
370
|
+
)
|
|
371
|
+
let gap_defined_type_input_manager = $state(
|
|
372
|
+
create_defined_type_input_manager({
|
|
373
|
+
get_defined_options: config?.get_defined_options,
|
|
374
|
+
label: "Gap",
|
|
375
|
+
attribute_root_key: "gap",
|
|
376
|
+
attribute_const_val: () => gap_slider_manager?.val,
|
|
377
|
+
attributes: config?.val,
|
|
378
|
+
})
|
|
379
|
+
)
|
|
362
380
|
attributes_manager = {
|
|
363
381
|
background_color_color_input_manager: background_color_color_input_manager,
|
|
364
382
|
background_color_defined_type_input_manager: background_color_defined_type_input_manager,
|
|
@@ -372,6 +390,8 @@ export function create_attributes_input_manager(config) {
|
|
|
372
390
|
align_content_defined_type_input_manager: align_content_defined_type_input_manager,
|
|
373
391
|
justify_content_dropdown_manager: justify_content_dropdown_manager,
|
|
374
392
|
justify_content_defined_type_input_manager: justify_content_defined_type_input_manager,
|
|
393
|
+
gap_slider_manager: gap_slider_manager,
|
|
394
|
+
gap_defined_type_input_manager: gap_defined_type_input_manager,
|
|
375
395
|
get val() {
|
|
376
396
|
return {
|
|
377
397
|
...background_color_defined_type_input_manager?.val,
|
|
@@ -1293,15 +1313,8 @@ export function create_attributes_input_manager(config) {
|
|
|
1293
1313
|
let val_input_manager = $state(
|
|
1294
1314
|
create_variable_path_input_manager({
|
|
1295
1315
|
val: config?.val?.val_from_variable_path,
|
|
1296
|
-
// defined_data_type: {
|
|
1297
|
-
// ...defined_data_type,
|
|
1298
|
-
// properties: {
|
|
1299
|
-
// ...defined_data_type?.properties,
|
|
1300
|
-
// [iter_identifier_text_input_manager?.val]: { type: "int_literal" },
|
|
1301
|
-
// },
|
|
1302
|
-
// },
|
|
1303
1316
|
get_defined_options: config?.get_defined_options,
|
|
1304
|
-
on_finish: () =>
|
|
1317
|
+
on_finish: () => val_input_manager.close_popover(),
|
|
1305
1318
|
})
|
|
1306
1319
|
)
|
|
1307
1320
|
let join_text_text_input_manager = $state(
|
|
@@ -56,7 +56,10 @@ export function create_content_input_manager(config) {
|
|
|
56
56
|
if (input?.type_id == selector_id) {
|
|
57
57
|
return { defined, is_found_selector_id: true }
|
|
58
58
|
} else if (input?.type_id == "loop") {
|
|
59
|
-
|
|
59
|
+
console.log("loop_iter_iter_identifier", input?.attributes?.iter_identifier)
|
|
60
|
+
if (input?.attributes?.iter_identifier) {
|
|
61
|
+
defined[input?.attributes?.iter_identifier] = { type: "text_literal" }
|
|
62
|
+
}
|
|
60
63
|
}
|
|
61
64
|
if (Array.isArray(input?.children)) {
|
|
62
65
|
for (let child of input?.children) {
|
|
@@ -73,10 +76,13 @@ export function create_content_input_manager(config) {
|
|
|
73
76
|
}
|
|
74
77
|
|
|
75
78
|
function get_defined_options(selector_id) {
|
|
79
|
+
console.log("get_defined_options", deep_copy({ definition_stack, selector_id }))
|
|
76
80
|
const defined_at_selector_id = get_defined_at_selector_id(selector_id)
|
|
81
|
+
console.log("defined_at_selector_id", deep_copy({ defined_at_selector_id }))
|
|
77
82
|
const defined_data_type = json_to_data_type(
|
|
78
83
|
Object.assign({}, ...[...(Array.isArray(definition_stack) ? definition_stack : [])].reverse())
|
|
79
84
|
)
|
|
85
|
+
console.log("defined_data_type", deep_copy({ defined_data_type }))
|
|
80
86
|
return Object.entries({ ...(defined_data_type?.properties || {}), ...defined_at_selector_id }).map(
|
|
81
87
|
([key, val]) => ({
|
|
82
88
|
key,
|
|
@@ -13,6 +13,8 @@ import {
|
|
|
13
13
|
variables_data_type_remaining_to_astc,
|
|
14
14
|
set_definition_stack,
|
|
15
15
|
astc_element,
|
|
16
|
+
deep_copy,
|
|
17
|
+
get_def_from_variable_path,
|
|
16
18
|
} from "../../../client/index.js"
|
|
17
19
|
|
|
18
20
|
export function create_column_input_manager(config) {
|
|
@@ -110,7 +112,7 @@ export function create_column_input_manager(config) {
|
|
|
110
112
|
}
|
|
111
113
|
|
|
112
114
|
function init(config) {
|
|
113
|
-
console.log("column_input_init", config)
|
|
115
|
+
console.log("column_input_init", deep_copy(config))
|
|
114
116
|
definition_stack = config?.definition_stack
|
|
115
117
|
column_id_text_input_manager = create_text_input_manager({
|
|
116
118
|
label: "Column ID",
|
|
@@ -121,20 +123,16 @@ export function create_column_input_manager(config) {
|
|
|
121
123
|
storage: null,
|
|
122
124
|
storage_default_folder_path: null,
|
|
123
125
|
definition_stack: definition_stack,
|
|
124
|
-
on_event: (input) => {
|
|
125
|
-
console.log("set_definition_stack_tbd400", input)
|
|
126
|
-
set_definition_stack(input)
|
|
127
|
-
},
|
|
128
126
|
})
|
|
127
|
+
const editable_row = get_def_from_variable_path([...rows_data_from_variable_path, 0], definition_stack)
|
|
128
|
+
const row_definition_stack = row_iter_identifier
|
|
129
|
+
? [{ [row_iter_identifier]: editable_row }, ...definition_stack]
|
|
130
|
+
: definition_stack
|
|
129
131
|
body_content_input_manager = create_content_input_manager({
|
|
130
132
|
val: config?.val?.body_content ?? null,
|
|
131
133
|
storage: config?.storage,
|
|
132
134
|
storage_default_folder_path: null,
|
|
133
|
-
definition_stack:
|
|
134
|
-
on_event: (input) => {
|
|
135
|
-
console.log("set_definition_stack_tbd33")
|
|
136
|
-
set_definition_stack(input)
|
|
137
|
-
},
|
|
135
|
+
definition_stack: row_definition_stack,
|
|
138
136
|
})
|
|
139
137
|
column_description_text_input_manager = create_text_input_manager({
|
|
140
138
|
type: "text_area",
|
|
@@ -192,24 +190,28 @@ export function create_column_input_manager(config) {
|
|
|
192
190
|
val: config?.val?.is_db_column ?? column_input_options?.is_db_column?.default_value ?? false,
|
|
193
191
|
})
|
|
194
192
|
column_db_data_type_input_manager = create_data_type_input_manager({
|
|
195
|
-
// data_sample: () => variables,
|
|
196
193
|
table_options: config?.table_options,
|
|
197
194
|
val: config?.val?.db_data_type,
|
|
198
195
|
on_finish: (input) => {
|
|
199
|
-
let default_content_input_astc = variables_data_type_remaining_to_astc(input, "input", [
|
|
196
|
+
let default_content_input_astc = variables_data_type_remaining_to_astc(input, "input", [
|
|
197
|
+
...(Array.isArray(rows_data_from_variable_path) ? rows_data_from_variable_path : []),
|
|
198
|
+
[row_iter_identifier],
|
|
199
|
+
column_id_text_input_manager.val,
|
|
200
|
+
])
|
|
200
201
|
column_default_value_content_manager = create_content_manager({
|
|
201
202
|
val: default_content_input_astc,
|
|
202
203
|
table_options: config?.table_options,
|
|
203
204
|
on_search_table_row_ids: config?.on_search_table_row_ids,
|
|
204
205
|
definition_stack: definition_stack,
|
|
205
206
|
on_event: (input) => {
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
207
|
+
// console.log("input3334", input)
|
|
208
|
+
// const res = set_definition_stack(
|
|
209
|
+
// input,
|
|
210
|
+
// definition_stack,
|
|
211
|
+
// column_default_value_content_manager?.pass_event_down
|
|
212
|
+
// )
|
|
213
|
+
// definition_stack = res?.definition_stack
|
|
214
|
+
// return res
|
|
213
215
|
},
|
|
214
216
|
})
|
|
215
217
|
},
|
|
@@ -260,7 +262,6 @@ export function create_column_input_manager(config) {
|
|
|
260
262
|
font_size: 1,
|
|
261
263
|
border_radius: 0.5,
|
|
262
264
|
on_click: () => {
|
|
263
|
-
console.log("guess_header_content_button_manager")
|
|
264
265
|
if (column_id_text_input_manager?.val) {
|
|
265
266
|
const header_text = column_id_text_input_manager.val
|
|
266
267
|
.split("_")
|
|
@@ -278,7 +279,6 @@ export function create_column_input_manager(config) {
|
|
|
278
279
|
font_size: 1,
|
|
279
280
|
border_radius: 0.5,
|
|
280
281
|
on_click: () => {
|
|
281
|
-
console.log("guess_body_content_button_manager")
|
|
282
282
|
if (column_id_text_input_manager.val && column_db_data_type_input_manager?.val) {
|
|
283
283
|
let guessed_column_display_content = variables_data_type_remaining_to_astc(
|
|
284
284
|
column_db_data_type_input_manager?.val,
|
|
@@ -289,7 +289,6 @@ export function create_column_input_manager(config) {
|
|
|
289
289
|
column_id_text_input_manager.val,
|
|
290
290
|
]
|
|
291
291
|
)
|
|
292
|
-
console.log("guessed_column_display_content", guessed_column_display_content)
|
|
293
292
|
body_content_input_manager.add_version(guessed_column_display_content)
|
|
294
293
|
} else {
|
|
295
294
|
body_content_input_manager.add_version(null)
|
|
@@ -2,6 +2,7 @@ import { create_popover_manager } from "../Popover/index.svelte.js"
|
|
|
2
2
|
import { create_button_manager } from "../Button/index.svelte.js"
|
|
3
3
|
import { create_text_input_manager } from "../TextInput/index.svelte.js"
|
|
4
4
|
import { create_dropdown_manager } from "../Dropdown/index.svelte.js"
|
|
5
|
+
import { deep_copy } from "../../client/index.js"
|
|
5
6
|
|
|
6
7
|
export function create_variable_path_input_manager(config) {
|
|
7
8
|
let popover_manager = $state(null)
|
|
@@ -14,6 +15,7 @@ export function create_variable_path_input_manager(config) {
|
|
|
14
15
|
let path_prepped = $state(null)
|
|
15
16
|
let val = $derived(get_val())
|
|
16
17
|
let val_text = $derived(val_to_text(val))
|
|
18
|
+
let variable_data_type_at_path = $state(null)
|
|
17
19
|
|
|
18
20
|
function get_val() {
|
|
19
21
|
return def_dropdown_manager?.val
|
|
@@ -24,7 +26,7 @@ export function create_variable_path_input_manager(config) {
|
|
|
24
26
|
function prep_path(input) {
|
|
25
27
|
let path_prepped_loc = $state([])
|
|
26
28
|
if (Array.isArray(input)) {
|
|
27
|
-
|
|
29
|
+
variable_data_type_at_path = Array.isArray(defined_options)
|
|
28
30
|
? defined_options.find((h) => h?.key === def_dropdown_manager?.val)?.data_type
|
|
29
31
|
: null
|
|
30
32
|
for (let i = 1; i < input.length; i++) {
|
|
@@ -104,7 +106,6 @@ export function create_variable_path_input_manager(config) {
|
|
|
104
106
|
})
|
|
105
107
|
}
|
|
106
108
|
}
|
|
107
|
-
console.log("key_options", key_options)
|
|
108
109
|
let val = $derived(
|
|
109
110
|
type_dropdown_manager?.val == "string"
|
|
110
111
|
? const_string_value_text_input_manager?.val
|
|
@@ -123,6 +124,7 @@ export function create_variable_path_input_manager(config) {
|
|
|
123
124
|
? variable_path_input_manager?.variable_data_type_at_path
|
|
124
125
|
: null
|
|
125
126
|
)
|
|
127
|
+
variable_data_type_at_path = variable_data_type_at_next_path
|
|
126
128
|
path_prepped_loc.push({
|
|
127
129
|
get type_dropdown_manager() {
|
|
128
130
|
return type_dropdown_manager
|
|
@@ -177,6 +179,9 @@ export function create_variable_path_input_manager(config) {
|
|
|
177
179
|
|
|
178
180
|
function init(input) {
|
|
179
181
|
levels_nested = input?.levels_nested ?? 0
|
|
182
|
+
if (typeof config?.get_defined_options == "function") {
|
|
183
|
+
defined_options = config?.get_defined_options()
|
|
184
|
+
}
|
|
180
185
|
popover_manager = create_popover_manager({
|
|
181
186
|
min_width: 280,
|
|
182
187
|
target_width: 450,
|
|
@@ -239,6 +244,9 @@ export function create_variable_path_input_manager(config) {
|
|
|
239
244
|
get val_text() {
|
|
240
245
|
return val_text
|
|
241
246
|
},
|
|
247
|
+
get variable_data_type_at_path() {
|
|
248
|
+
return variable_data_type_at_path
|
|
249
|
+
},
|
|
242
250
|
get levels_nested() {
|
|
243
251
|
return levels_nested
|
|
244
252
|
},
|
|
@@ -792,12 +792,15 @@ export function variables_data_type_remaining_to_astc(
|
|
|
792
792
|
// }
|
|
793
793
|
const child_astc = variables_data_type_remaining_to_astc(
|
|
794
794
|
variables_data_type_remaining?.items,
|
|
795
|
-
preferred_content_use
|
|
795
|
+
preferred_content_use,
|
|
796
|
+
[...leading_variable_path, ["loop_index"]]
|
|
796
797
|
)
|
|
798
|
+
console.log("loop_child", { child_astc, variables_data_type_remaining })
|
|
797
799
|
return astc_element("loop", [child_astc], {
|
|
798
800
|
val_from_variable_path: leading_variable_path,
|
|
799
801
|
...(variables_data_type_remaining?.attributes ?? {}),
|
|
800
802
|
font_size: 1.2,
|
|
803
|
+
iter_identifier: "loop_index",
|
|
801
804
|
})
|
|
802
805
|
// } else if (variables_data_type_remaining?.type == "list") {
|
|
803
806
|
// list input tbd just content input i guess
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sveltekit-ui",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.31",
|
|
4
4
|
"description": "A SvelteKit UI component library for building modern web applications",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -19,14 +19,14 @@
|
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"context-filter-polyfill": "^0.3.23",
|
|
21
21
|
"qr-code-styling": "^1.9.2",
|
|
22
|
-
"svelte": "^5.38.
|
|
22
|
+
"svelte": "^5.38.3"
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
25
25
|
"@sveltejs/kit": "^2.22.2"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@sveltejs/adapter-vercel": "^5.10.2",
|
|
29
|
-
"@sveltejs/kit": "^2.36.
|
|
29
|
+
"@sveltejs/kit": "^2.36.2",
|
|
30
30
|
"@sveltejs/package": "^2.5.0",
|
|
31
31
|
"@sveltejs/vite-plugin-svelte": "^6.1.3",
|
|
32
32
|
"@vercel/analytics": "^1.5.0",
|
|
@@ -152,6 +152,8 @@
|
|
|
152
152
|
? `padding: ${set_closurable(manager?.val_prepped?.attributes?.padding)}rem;`
|
|
153
153
|
: ''} {manager?.val_prepped?.attributes?.border_radius
|
|
154
154
|
? `border-radius: ${set_closurable(manager?.val_prepped?.attributes?.border_radius)}rem;`
|
|
155
|
+
: ''} {manager?.val_prepped?.attributes?.gap
|
|
156
|
+
? `gap: ${set_closurable(manager?.val_prepped?.attributes?.gap)}rem;`
|
|
155
157
|
: ''} {manager?.val_prepped?.attributes?.padding
|
|
156
158
|
? `padding: ${set_closurable(manager?.val_prepped?.attributes?.padding)}rem;`
|
|
157
159
|
: ''} {manager?.val_prepped?.attributes?.align_content || manager?.val_prepped?.attributes?.justify_content
|
|
@@ -145,6 +145,11 @@
|
|
|
145
145
|
<Dropdown manager={manager?.attributes_manager?.justify_content_dropdown_manager} />
|
|
146
146
|
{/snippet}
|
|
147
147
|
</DefinedTypeInput>
|
|
148
|
+
<DefinedTypeInput manager={manager?.attributes_manager?.gap_defined_type_input_manager}>
|
|
149
|
+
{#snippet content()}
|
|
150
|
+
<Slider manager={manager?.attributes_manager?.gap_slider_manager} />
|
|
151
|
+
{/snippet}
|
|
152
|
+
</DefinedTypeInput>
|
|
148
153
|
{:else if manager?.content_type == "show_conditions"}
|
|
149
154
|
<DefinedTypeInput manager={manager?.attributes_manager?.is_run_serverside_defined_type_input_manager}>
|
|
150
155
|
{#snippet content()}
|
|
@@ -359,6 +359,24 @@ export function create_attributes_input_manager(config) {
|
|
|
359
359
|
attributes: config?.val,
|
|
360
360
|
})
|
|
361
361
|
)
|
|
362
|
+
|
|
363
|
+
let gap_slider_manager = $state(
|
|
364
|
+
create_slider_manager({
|
|
365
|
+
min: 0,
|
|
366
|
+
max: 5,
|
|
367
|
+
step: 0.1,
|
|
368
|
+
val: config?.val?.gap ?? 0,
|
|
369
|
+
})
|
|
370
|
+
)
|
|
371
|
+
let gap_defined_type_input_manager = $state(
|
|
372
|
+
create_defined_type_input_manager({
|
|
373
|
+
get_defined_options: config?.get_defined_options,
|
|
374
|
+
label: "Gap",
|
|
375
|
+
attribute_root_key: "gap",
|
|
376
|
+
attribute_const_val: () => gap_slider_manager?.val,
|
|
377
|
+
attributes: config?.val,
|
|
378
|
+
})
|
|
379
|
+
)
|
|
362
380
|
attributes_manager = {
|
|
363
381
|
background_color_color_input_manager: background_color_color_input_manager,
|
|
364
382
|
background_color_defined_type_input_manager: background_color_defined_type_input_manager,
|
|
@@ -372,6 +390,8 @@ export function create_attributes_input_manager(config) {
|
|
|
372
390
|
align_content_defined_type_input_manager: align_content_defined_type_input_manager,
|
|
373
391
|
justify_content_dropdown_manager: justify_content_dropdown_manager,
|
|
374
392
|
justify_content_defined_type_input_manager: justify_content_defined_type_input_manager,
|
|
393
|
+
gap_slider_manager: gap_slider_manager,
|
|
394
|
+
gap_defined_type_input_manager: gap_defined_type_input_manager,
|
|
375
395
|
get val() {
|
|
376
396
|
return {
|
|
377
397
|
...background_color_defined_type_input_manager?.val,
|
|
@@ -1293,15 +1313,8 @@ export function create_attributes_input_manager(config) {
|
|
|
1293
1313
|
let val_input_manager = $state(
|
|
1294
1314
|
create_variable_path_input_manager({
|
|
1295
1315
|
val: config?.val?.val_from_variable_path,
|
|
1296
|
-
// defined_data_type: {
|
|
1297
|
-
// ...defined_data_type,
|
|
1298
|
-
// properties: {
|
|
1299
|
-
// ...defined_data_type?.properties,
|
|
1300
|
-
// [iter_identifier_text_input_manager?.val]: { type: "int_literal" },
|
|
1301
|
-
// },
|
|
1302
|
-
// },
|
|
1303
1316
|
get_defined_options: config?.get_defined_options,
|
|
1304
|
-
on_finish: () =>
|
|
1317
|
+
on_finish: () => val_input_manager.close_popover(),
|
|
1305
1318
|
})
|
|
1306
1319
|
)
|
|
1307
1320
|
let join_text_text_input_manager = $state(
|
|
@@ -56,7 +56,10 @@ export function create_content_input_manager(config) {
|
|
|
56
56
|
if (input?.type_id == selector_id) {
|
|
57
57
|
return { defined, is_found_selector_id: true }
|
|
58
58
|
} else if (input?.type_id == "loop") {
|
|
59
|
-
|
|
59
|
+
console.log("loop_iter_iter_identifier", input?.attributes?.iter_identifier)
|
|
60
|
+
if (input?.attributes?.iter_identifier) {
|
|
61
|
+
defined[input?.attributes?.iter_identifier] = { type: "text_literal" }
|
|
62
|
+
}
|
|
60
63
|
}
|
|
61
64
|
if (Array.isArray(input?.children)) {
|
|
62
65
|
for (let child of input?.children) {
|
|
@@ -73,10 +76,13 @@ export function create_content_input_manager(config) {
|
|
|
73
76
|
}
|
|
74
77
|
|
|
75
78
|
function get_defined_options(selector_id) {
|
|
79
|
+
console.log("get_defined_options", deep_copy({ definition_stack, selector_id }))
|
|
76
80
|
const defined_at_selector_id = get_defined_at_selector_id(selector_id)
|
|
81
|
+
console.log("defined_at_selector_id", deep_copy({ defined_at_selector_id }))
|
|
77
82
|
const defined_data_type = json_to_data_type(
|
|
78
83
|
Object.assign({}, ...[...(Array.isArray(definition_stack) ? definition_stack : [])].reverse())
|
|
79
84
|
)
|
|
85
|
+
console.log("defined_data_type", deep_copy({ defined_data_type }))
|
|
80
86
|
return Object.entries({ ...(defined_data_type?.properties || {}), ...defined_at_selector_id }).map(
|
|
81
87
|
([key, val]) => ({
|
|
82
88
|
key,
|
|
@@ -13,6 +13,8 @@ import {
|
|
|
13
13
|
variables_data_type_remaining_to_astc,
|
|
14
14
|
set_definition_stack,
|
|
15
15
|
astc_element,
|
|
16
|
+
deep_copy,
|
|
17
|
+
get_def_from_variable_path,
|
|
16
18
|
} from "$lib/client/index.js"
|
|
17
19
|
|
|
18
20
|
export function create_column_input_manager(config) {
|
|
@@ -110,7 +112,7 @@ export function create_column_input_manager(config) {
|
|
|
110
112
|
}
|
|
111
113
|
|
|
112
114
|
function init(config) {
|
|
113
|
-
console.log("column_input_init", config)
|
|
115
|
+
console.log("column_input_init", deep_copy(config))
|
|
114
116
|
definition_stack = config?.definition_stack
|
|
115
117
|
column_id_text_input_manager = create_text_input_manager({
|
|
116
118
|
label: "Column ID",
|
|
@@ -121,20 +123,16 @@ export function create_column_input_manager(config) {
|
|
|
121
123
|
storage: null,
|
|
122
124
|
storage_default_folder_path: null,
|
|
123
125
|
definition_stack: definition_stack,
|
|
124
|
-
on_event: (input) => {
|
|
125
|
-
console.log("set_definition_stack_tbd400", input)
|
|
126
|
-
set_definition_stack(input)
|
|
127
|
-
},
|
|
128
126
|
})
|
|
127
|
+
const editable_row = get_def_from_variable_path([...rows_data_from_variable_path, 0], definition_stack)
|
|
128
|
+
const row_definition_stack = row_iter_identifier
|
|
129
|
+
? [{ [row_iter_identifier]: editable_row }, ...definition_stack]
|
|
130
|
+
: definition_stack
|
|
129
131
|
body_content_input_manager = create_content_input_manager({
|
|
130
132
|
val: config?.val?.body_content ?? null,
|
|
131
133
|
storage: config?.storage,
|
|
132
134
|
storage_default_folder_path: null,
|
|
133
|
-
definition_stack:
|
|
134
|
-
on_event: (input) => {
|
|
135
|
-
console.log("set_definition_stack_tbd33")
|
|
136
|
-
set_definition_stack(input)
|
|
137
|
-
},
|
|
135
|
+
definition_stack: row_definition_stack,
|
|
138
136
|
})
|
|
139
137
|
column_description_text_input_manager = create_text_input_manager({
|
|
140
138
|
type: "text_area",
|
|
@@ -192,24 +190,28 @@ export function create_column_input_manager(config) {
|
|
|
192
190
|
val: config?.val?.is_db_column ?? column_input_options?.is_db_column?.default_value ?? false,
|
|
193
191
|
})
|
|
194
192
|
column_db_data_type_input_manager = create_data_type_input_manager({
|
|
195
|
-
// data_sample: () => variables,
|
|
196
193
|
table_options: config?.table_options,
|
|
197
194
|
val: config?.val?.db_data_type,
|
|
198
195
|
on_finish: (input) => {
|
|
199
|
-
let default_content_input_astc = variables_data_type_remaining_to_astc(input, "input", [
|
|
196
|
+
let default_content_input_astc = variables_data_type_remaining_to_astc(input, "input", [
|
|
197
|
+
...(Array.isArray(rows_data_from_variable_path) ? rows_data_from_variable_path : []),
|
|
198
|
+
[row_iter_identifier],
|
|
199
|
+
column_id_text_input_manager.val,
|
|
200
|
+
])
|
|
200
201
|
column_default_value_content_manager = create_content_manager({
|
|
201
202
|
val: default_content_input_astc,
|
|
202
203
|
table_options: config?.table_options,
|
|
203
204
|
on_search_table_row_ids: config?.on_search_table_row_ids,
|
|
204
205
|
definition_stack: definition_stack,
|
|
205
206
|
on_event: (input) => {
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
207
|
+
// console.log("input3334", input)
|
|
208
|
+
// const res = set_definition_stack(
|
|
209
|
+
// input,
|
|
210
|
+
// definition_stack,
|
|
211
|
+
// column_default_value_content_manager?.pass_event_down
|
|
212
|
+
// )
|
|
213
|
+
// definition_stack = res?.definition_stack
|
|
214
|
+
// return res
|
|
213
215
|
},
|
|
214
216
|
})
|
|
215
217
|
},
|
|
@@ -260,7 +262,6 @@ export function create_column_input_manager(config) {
|
|
|
260
262
|
font_size: 1,
|
|
261
263
|
border_radius: 0.5,
|
|
262
264
|
on_click: () => {
|
|
263
|
-
console.log("guess_header_content_button_manager")
|
|
264
265
|
if (column_id_text_input_manager?.val) {
|
|
265
266
|
const header_text = column_id_text_input_manager.val
|
|
266
267
|
.split("_")
|
|
@@ -278,7 +279,6 @@ export function create_column_input_manager(config) {
|
|
|
278
279
|
font_size: 1,
|
|
279
280
|
border_radius: 0.5,
|
|
280
281
|
on_click: () => {
|
|
281
|
-
console.log("guess_body_content_button_manager")
|
|
282
282
|
if (column_id_text_input_manager.val && column_db_data_type_input_manager?.val) {
|
|
283
283
|
let guessed_column_display_content = variables_data_type_remaining_to_astc(
|
|
284
284
|
column_db_data_type_input_manager?.val,
|
|
@@ -289,7 +289,6 @@ export function create_column_input_manager(config) {
|
|
|
289
289
|
column_id_text_input_manager.val,
|
|
290
290
|
]
|
|
291
291
|
)
|
|
292
|
-
console.log("guessed_column_display_content", guessed_column_display_content)
|
|
293
292
|
body_content_input_manager.add_version(guessed_column_display_content)
|
|
294
293
|
} else {
|
|
295
294
|
body_content_input_manager.add_version(null)
|
|
@@ -2,6 +2,7 @@ import { create_popover_manager } from "$lib/Components/Popover/index.svelte.js"
|
|
|
2
2
|
import { create_button_manager } from "$lib/Components/Button/index.svelte.js"
|
|
3
3
|
import { create_text_input_manager } from "$lib/Components/TextInput/index.svelte.js"
|
|
4
4
|
import { create_dropdown_manager } from "$lib/Components/Dropdown/index.svelte.js"
|
|
5
|
+
import { deep_copy } from "$lib/client/index.js"
|
|
5
6
|
|
|
6
7
|
export function create_variable_path_input_manager(config) {
|
|
7
8
|
let popover_manager = $state(null)
|
|
@@ -14,6 +15,7 @@ export function create_variable_path_input_manager(config) {
|
|
|
14
15
|
let path_prepped = $state(null)
|
|
15
16
|
let val = $derived(get_val())
|
|
16
17
|
let val_text = $derived(val_to_text(val))
|
|
18
|
+
let variable_data_type_at_path = $state(null)
|
|
17
19
|
|
|
18
20
|
function get_val() {
|
|
19
21
|
return def_dropdown_manager?.val
|
|
@@ -24,7 +26,7 @@ export function create_variable_path_input_manager(config) {
|
|
|
24
26
|
function prep_path(input) {
|
|
25
27
|
let path_prepped_loc = $state([])
|
|
26
28
|
if (Array.isArray(input)) {
|
|
27
|
-
|
|
29
|
+
variable_data_type_at_path = Array.isArray(defined_options)
|
|
28
30
|
? defined_options.find((h) => h?.key === def_dropdown_manager?.val)?.data_type
|
|
29
31
|
: null
|
|
30
32
|
for (let i = 1; i < input.length; i++) {
|
|
@@ -104,7 +106,6 @@ export function create_variable_path_input_manager(config) {
|
|
|
104
106
|
})
|
|
105
107
|
}
|
|
106
108
|
}
|
|
107
|
-
console.log("key_options", key_options)
|
|
108
109
|
let val = $derived(
|
|
109
110
|
type_dropdown_manager?.val == "string"
|
|
110
111
|
? const_string_value_text_input_manager?.val
|
|
@@ -123,6 +124,7 @@ export function create_variable_path_input_manager(config) {
|
|
|
123
124
|
? variable_path_input_manager?.variable_data_type_at_path
|
|
124
125
|
: null
|
|
125
126
|
)
|
|
127
|
+
variable_data_type_at_path = variable_data_type_at_next_path
|
|
126
128
|
path_prepped_loc.push({
|
|
127
129
|
get type_dropdown_manager() {
|
|
128
130
|
return type_dropdown_manager
|
|
@@ -177,6 +179,9 @@ export function create_variable_path_input_manager(config) {
|
|
|
177
179
|
|
|
178
180
|
function init(input) {
|
|
179
181
|
levels_nested = input?.levels_nested ?? 0
|
|
182
|
+
if (typeof config?.get_defined_options == "function") {
|
|
183
|
+
defined_options = config?.get_defined_options()
|
|
184
|
+
}
|
|
180
185
|
popover_manager = create_popover_manager({
|
|
181
186
|
min_width: 280,
|
|
182
187
|
target_width: 450,
|
|
@@ -239,6 +244,9 @@ export function create_variable_path_input_manager(config) {
|
|
|
239
244
|
get val_text() {
|
|
240
245
|
return val_text
|
|
241
246
|
},
|
|
247
|
+
get variable_data_type_at_path() {
|
|
248
|
+
return variable_data_type_at_path
|
|
249
|
+
},
|
|
242
250
|
get levels_nested() {
|
|
243
251
|
return levels_nested
|
|
244
252
|
},
|
|
@@ -792,12 +792,15 @@ export function variables_data_type_remaining_to_astc(
|
|
|
792
792
|
// }
|
|
793
793
|
const child_astc = variables_data_type_remaining_to_astc(
|
|
794
794
|
variables_data_type_remaining?.items,
|
|
795
|
-
preferred_content_use
|
|
795
|
+
preferred_content_use,
|
|
796
|
+
[...leading_variable_path, ["loop_index"]]
|
|
796
797
|
)
|
|
798
|
+
console.log("loop_child", { child_astc, variables_data_type_remaining })
|
|
797
799
|
return astc_element("loop", [child_astc], {
|
|
798
800
|
val_from_variable_path: leading_variable_path,
|
|
799
801
|
...(variables_data_type_remaining?.attributes ?? {}),
|
|
800
802
|
font_size: 1.2,
|
|
803
|
+
iter_identifier: "loop_index",
|
|
801
804
|
})
|
|
802
805
|
// } else if (variables_data_type_remaining?.type == "list") {
|
|
803
806
|
// list input tbd just content input i guess
|