windmill-components 1.362.0 → 1.362.2
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/components/EditableSchemaForm.svelte +28 -26
- package/package/components/schema/EditableSchemaDrawer.svelte +2 -1
- package/package/components/schema/EditableSchemaWrapper.svelte +2 -13
- package/package/components/schema/EditableSchemaWrapper.svelte.d.ts +0 -1
- package/package/components/schema/FlowPropertyEditor.svelte +10 -7
- package/package/components/schema/PropertyEditor.svelte +1 -1
- package/package.json +1 -1
|
@@ -70,7 +70,6 @@ function alignOrderWithProperties(schema) {
|
|
|
70
70
|
hasChanged = hasChanged || alignOrderWithProperties(schema.properties[k]);
|
|
71
71
|
}
|
|
72
72
|
if (!norder.includes(k)) {
|
|
73
|
-
console.log('adding', k, index);
|
|
74
73
|
norder = [...norder.slice(0, index), k, ...norder.slice(index)];
|
|
75
74
|
}
|
|
76
75
|
index += 1;
|
|
@@ -83,20 +82,22 @@ function alignOrderWithProperties(schema) {
|
|
|
83
82
|
return hasChanged;
|
|
84
83
|
}
|
|
85
84
|
function onSchemaChange() {
|
|
86
|
-
|
|
85
|
+
let editSchema = false;
|
|
87
86
|
if (alignOrderWithProperties(schema)) {
|
|
88
|
-
|
|
87
|
+
editSchema = true;
|
|
89
88
|
}
|
|
90
89
|
let lkeys = schema?.order ?? Object.keys(schema?.properties ?? {});
|
|
91
90
|
if (schema?.properties && !deepEqual(lkeys, keys)) {
|
|
92
91
|
keys = [...lkeys];
|
|
93
|
-
|
|
92
|
+
editSchema = true;
|
|
94
93
|
if (opened == undefined) {
|
|
95
94
|
opened = keys[0];
|
|
96
95
|
}
|
|
97
96
|
}
|
|
97
|
+
if (editSchema) {
|
|
98
|
+
schema = schema;
|
|
99
|
+
}
|
|
98
100
|
}
|
|
99
|
-
let renderCount = 0;
|
|
100
101
|
let opened = keys[0];
|
|
101
102
|
let selected = '';
|
|
102
103
|
export function openField(key) {
|
|
@@ -165,25 +166,25 @@ let editor = undefined;
|
|
|
165
166
|
{#if !noPreview}
|
|
166
167
|
<Pane size={50} minSize={20}>
|
|
167
168
|
<div class="p-4">
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
169
|
+
<SchemaFormDnd
|
|
170
|
+
{schema}
|
|
171
|
+
{dndType}
|
|
172
|
+
bind:args
|
|
173
|
+
on:click={(e) => {
|
|
174
|
+
opened = e.detail
|
|
175
|
+
}}
|
|
176
|
+
on:reorder={(e) => {
|
|
177
|
+
schema.order = e.detail
|
|
178
|
+
schema = schema
|
|
179
|
+
dispatch('change', schema)
|
|
180
|
+
}}
|
|
181
|
+
on:change={() => {
|
|
182
|
+
schema = schema
|
|
183
|
+
dispatch('change', schema)
|
|
184
|
+
}}
|
|
185
|
+
{lightweightMode}
|
|
186
|
+
prettifyHeader={isAppInput}
|
|
187
|
+
/>
|
|
187
188
|
</div>
|
|
188
189
|
</Pane>
|
|
189
190
|
{/if}
|
|
@@ -439,8 +440,9 @@ let editor = undefined;
|
|
|
439
440
|
schema.required = schema.required?.filter((x) => x !== argName)
|
|
440
441
|
}
|
|
441
442
|
}}
|
|
442
|
-
on:schemaChange={() => {
|
|
443
|
-
|
|
443
|
+
on:schemaChange={(e) => {
|
|
444
|
+
schema = schema
|
|
445
|
+
dispatch('change', schema)
|
|
444
446
|
}}
|
|
445
447
|
/>
|
|
446
448
|
{/if}
|
|
@@ -153,9 +153,10 @@ let error = undefined;
|
|
|
153
153
|
<Drawer bind:this={schemaFormDrawer} size="1200px">
|
|
154
154
|
<DrawerContent noPadding title="UI Customisation" on:close={schemaFormDrawer.closeDrawer}>
|
|
155
155
|
<svelte:fragment slot="actions">
|
|
156
|
-
<AddProperty bind:schema />
|
|
156
|
+
<AddProperty on:change bind:schema />
|
|
157
157
|
</svelte:fragment>
|
|
158
158
|
<EditableSchemaForm
|
|
159
|
+
on:change
|
|
159
160
|
bind:this={editableSchemaForm}
|
|
160
161
|
bind:schema
|
|
161
162
|
isAppInput
|
|
@@ -1,33 +1,22 @@
|
|
|
1
1
|
<script>import { twMerge } from 'tailwind-merge';
|
|
2
2
|
import EditableSchemaForm from '../EditableSchemaForm.svelte';
|
|
3
3
|
import AddProperty from './AddProperty.svelte';
|
|
4
|
-
import { createEventDispatcher } from 'svelte';
|
|
5
4
|
export let schema;
|
|
6
5
|
export let offset = 0;
|
|
7
6
|
export let uiOnly = false;
|
|
8
7
|
export let noPreview = false;
|
|
9
8
|
export let fullHeight = true;
|
|
10
9
|
export let lightweightMode = false;
|
|
11
|
-
export let watchChanges = false;
|
|
12
|
-
const dispatch = createEventDispatcher();
|
|
13
|
-
$: watchChanges && onChange();
|
|
14
|
-
let firstChange = true;
|
|
15
|
-
function onChange() {
|
|
16
|
-
if (firstChange) {
|
|
17
|
-
firstChange = false;
|
|
18
|
-
return;
|
|
19
|
-
}
|
|
20
|
-
dispatch('change', { schema });
|
|
21
|
-
}
|
|
22
10
|
let addProperty = undefined;
|
|
23
11
|
</script>
|
|
24
12
|
|
|
25
13
|
<div class={twMerge(fullHeight ? 'h-full' : 'h-80', 'border overflow-y-auto rounded-md')}>
|
|
26
14
|
<div class="p-4 border-b">
|
|
27
|
-
<AddProperty bind:schema bind:this={addProperty} />
|
|
15
|
+
<AddProperty on:change bind:schema bind:this={addProperty} />
|
|
28
16
|
</div>
|
|
29
17
|
<EditableSchemaForm
|
|
30
18
|
bind:schema
|
|
19
|
+
on:change
|
|
31
20
|
isFlowInput
|
|
32
21
|
on:edit={(e) => {
|
|
33
22
|
addProperty?.openDrawer(e.detail)
|
|
@@ -15,7 +15,7 @@ import Button from '../common/button/Button.svelte';
|
|
|
15
15
|
import { Pen, Plus, Trash2 } from 'lucide-svelte';
|
|
16
16
|
import Popup from '../common/popup/Popup.svelte';
|
|
17
17
|
import { deepEqual } from 'fast-equals';
|
|
18
|
-
export let format =
|
|
18
|
+
export let format = undefined;
|
|
19
19
|
export let contentEncoding = undefined;
|
|
20
20
|
export let type = undefined;
|
|
21
21
|
export let oneOf = undefined;
|
|
@@ -52,10 +52,12 @@ function oneOfUpdate(oneOf) {
|
|
|
52
52
|
!deepEqual(oneOf.map((v) => [v.title, v.order]), schema.oneOf.map((v) => [v.title, v.order]))) {
|
|
53
53
|
// update schema if not exists or order changed
|
|
54
54
|
schema.oneOf = getOneOfWithoutLabel(oneOf);
|
|
55
|
+
schema = schema;
|
|
55
56
|
}
|
|
56
57
|
}
|
|
57
58
|
else if (!oneOf) {
|
|
58
59
|
schema.oneOf = undefined;
|
|
60
|
+
schema = schema;
|
|
59
61
|
}
|
|
60
62
|
}
|
|
61
63
|
$: oneOfUpdate(oneOf);
|
|
@@ -63,6 +65,7 @@ function orderUpdate(order) {
|
|
|
63
65
|
if (order && !deepEqual(order, schema.order)) {
|
|
64
66
|
// update from external reordering
|
|
65
67
|
schema.order = order;
|
|
68
|
+
schema = schema;
|
|
66
69
|
}
|
|
67
70
|
}
|
|
68
71
|
$: orderUpdate(order);
|
|
@@ -79,7 +82,6 @@ let schema = {
|
|
|
79
82
|
required: requiredProperty,
|
|
80
83
|
oneOf: oneOf ? getOneOfWithoutLabel(oneOf) : undefined
|
|
81
84
|
};
|
|
82
|
-
console.log('initial schema', schema);
|
|
83
85
|
function schemaUpdate(changedSchema) {
|
|
84
86
|
if (!deepEqual(changedSchema, {
|
|
85
87
|
properties,
|
|
@@ -87,9 +89,9 @@ function schemaUpdate(changedSchema) {
|
|
|
87
89
|
required: requiredProperty,
|
|
88
90
|
oneOf: oneOf ? getOneOfWithoutLabel(oneOf) : undefined
|
|
89
91
|
})) {
|
|
90
|
-
properties = changedSchema.properties;
|
|
91
|
-
order = changedSchema.order;
|
|
92
|
-
requiredProperty = changedSchema.required;
|
|
92
|
+
properties = structuredClone(changedSchema.properties);
|
|
93
|
+
order = structuredClone(changedSchema.order);
|
|
94
|
+
requiredProperty = structuredClone(changedSchema.required);
|
|
93
95
|
oneOf = changedSchema.oneOf?.map((v) => {
|
|
94
96
|
return {
|
|
95
97
|
...v,
|
|
@@ -102,7 +104,7 @@ function schemaUpdate(changedSchema) {
|
|
|
102
104
|
}
|
|
103
105
|
};
|
|
104
106
|
});
|
|
105
|
-
dispatch('schemaChange');
|
|
107
|
+
dispatch('schemaChange', { properties, order, requiredProperty, oneOf });
|
|
106
108
|
}
|
|
107
109
|
}
|
|
108
110
|
$: schemaUpdate(schema);
|
|
@@ -140,6 +142,7 @@ function renameVariant(name, selected) {
|
|
|
140
142
|
variantName = '';
|
|
141
143
|
}
|
|
142
144
|
}
|
|
145
|
+
let initialObjectSelected = Object.keys(schema?.properties ?? {}).length == 0 ? 'resource' : 'custom-object';
|
|
143
146
|
</script>
|
|
144
147
|
|
|
145
148
|
<div class="flex flex-col gap-2">
|
|
@@ -263,7 +266,7 @@ function renameVariant(name, selected) {
|
|
|
263
266
|
{/if}
|
|
264
267
|
{:else if type === 'object' && format !== 'resource-s3_object'}
|
|
265
268
|
<Tabs
|
|
266
|
-
selected=
|
|
269
|
+
selected={initialObjectSelected}
|
|
267
270
|
on:selected={(e) => {
|
|
268
271
|
if (e.detail === 'custom-object') {
|
|
269
272
|
format = ''
|
|
@@ -11,7 +11,7 @@ import { deepEqual } from 'fast-equals';
|
|
|
11
11
|
import ToggleButtonGroup from '../common/toggleButton-v2/ToggleButtonGroup.svelte';
|
|
12
12
|
import ToggleButton from '../common/toggleButton-v2/ToggleButton.svelte';
|
|
13
13
|
export let description = '';
|
|
14
|
-
export let format =
|
|
14
|
+
export let format = undefined;
|
|
15
15
|
export let contentEncoding = undefined;
|
|
16
16
|
export let type = undefined;
|
|
17
17
|
export let oneOf = undefined;
|