@koumoul/vjsf 3.9.0 → 3.10.1
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/src/components/nodes/list.vue +128 -89
- package/types/compat/v2.d.ts +1 -1
- package/types/compat/v2.d.ts.map +1 -1
- package/types/components/fragments/list-item-menu.vue.d.ts +11 -0
- package/types/components/fragments/list-item-menu.vue.d.ts.map +1 -0
- package/types/components/fragments/select-item.vue.d.ts +2 -2
- package/types/components/fragments/select-selection.vue.d.ts +2 -2
- package/types/composables/use-get-items.d.ts +1 -1
- package/types/composables/use-node.d.ts +1 -1
- package/types/composables/use-select-node.d.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@koumoul/vjsf",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.10.1",
|
|
4
4
|
"description": "Generate forms for the vuetify UI library (vuejs) based on annotated JSON schemas.",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "vitest run",
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
"vuetify": "^3.6.13"
|
|
72
72
|
},
|
|
73
73
|
"dependencies": {
|
|
74
|
-
"@json-layout/core": "~1.4.
|
|
74
|
+
"@json-layout/core": "~1.4.3",
|
|
75
75
|
"@vueuse/core": "^10.5.0",
|
|
76
76
|
"debug": "^4.3.4"
|
|
77
77
|
},
|
|
@@ -45,8 +45,14 @@ const { activeDnd, sortableArray, draggable, hovered, dragging, itemBind, handle
|
|
|
45
45
|
? sortableArray.value.reduce((a, child) => { a[child.key] = child.data; return a }, /** @type {Record<string, any>} */({}))
|
|
46
46
|
: sortableArray.value.map((child) => child.data)
|
|
47
47
|
props.statefulLayout.input(props.modelValue, newData)
|
|
48
|
+
dragPrepared.value = -1
|
|
48
49
|
})
|
|
49
50
|
watch(children, (array) => { sortableArray.value = array })
|
|
51
|
+
const dragPrepared = ref(-1)
|
|
52
|
+
const prepareDrag = (/** @type {number} */index) => {
|
|
53
|
+
dragPrepared.value = index
|
|
54
|
+
menuOpened.value = -1
|
|
55
|
+
}
|
|
50
56
|
|
|
51
57
|
/* manage hovered and edited items */
|
|
52
58
|
// const editedItem = computed(() => activatedItems.value[fullKey.value])
|
|
@@ -55,6 +61,11 @@ const editedItem = computed(() => {
|
|
|
55
61
|
})
|
|
56
62
|
|
|
57
63
|
const menuOpened = ref(-1)
|
|
64
|
+
const toggleMenu = (/** @type {number} */childIndex, /** @type {boolean} */value) => {
|
|
65
|
+
menuOpened.value = value ? childIndex : -1
|
|
66
|
+
preparedDelete.value = false
|
|
67
|
+
}
|
|
68
|
+
|
|
58
69
|
const activeItem = computed(() => {
|
|
59
70
|
if (
|
|
60
71
|
layout.value.listActions.includes('edit') &&
|
|
@@ -65,6 +76,7 @@ const activeItem = computed(() => {
|
|
|
65
76
|
}
|
|
66
77
|
if (dragging.value !== -1) return -1
|
|
67
78
|
if (menuOpened.value !== -1) return menuOpened.value
|
|
79
|
+
if (dragPrepared.value !== -1) return dragPrepared.value
|
|
68
80
|
return hovered.value
|
|
69
81
|
})
|
|
70
82
|
|
|
@@ -117,6 +129,7 @@ const deleteItem = (childIndex) => {
|
|
|
117
129
|
|
|
118
130
|
menuOpened.value = -1
|
|
119
131
|
}
|
|
132
|
+
const preparedDelete = ref(false)
|
|
120
133
|
|
|
121
134
|
/**
|
|
122
135
|
* @param {import('@json-layout/core').StateNode} child
|
|
@@ -136,6 +149,7 @@ const itemBorderColor = computed(() => (/** @type {import('@json-layout/core').S
|
|
|
136
149
|
if (child.validated && (child.error || child.childError)) return theme.current.value.colors.error
|
|
137
150
|
if (options.value.readOnly) return 'transparent'
|
|
138
151
|
if (activeItem.value === childIndex) return theme.current.value.colors.primary
|
|
152
|
+
if (dragPrepared.value === childIndex) return theme.current.value.colors.primary
|
|
139
153
|
return 'transparent'
|
|
140
154
|
})
|
|
141
155
|
|
|
@@ -185,99 +199,124 @@ const itemBorderColor = computed(() => (/** @type {import('@json-layout/core').S
|
|
|
185
199
|
:icon="statefulLayout.options.icons.edit"
|
|
186
200
|
/>
|
|
187
201
|
</v-list-item-action>
|
|
188
|
-
<
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
<v-list-item-action
|
|
223
|
-
v-if="editedItem === undefined && (modelValue.layout.listActions.includes('delete') || modelValue.layout.listActions.includes('duplicate') || modelValue.layout.listActions.includes('sort'))"
|
|
202
|
+
<v-list-item-action
|
|
203
|
+
v-else-if="modelValue.layout.listActions.includes('edit') && modelValue.layout.listEditMode === 'inline-single' && editedItem === childIndex"
|
|
204
|
+
>
|
|
205
|
+
<v-btn
|
|
206
|
+
:title="modelValue.messages.close"
|
|
207
|
+
:icon="statefulLayout.options.icons.edit"
|
|
208
|
+
variant="flat"
|
|
209
|
+
color="primary"
|
|
210
|
+
:density="buttonDensity"
|
|
211
|
+
@click="statefulLayout.deactivateItem(modelValue)"
|
|
212
|
+
/>
|
|
213
|
+
</v-list-item-action>
|
|
214
|
+
<v-list-item-action
|
|
215
|
+
v-else-if="dragPrepared === childIndex"
|
|
216
|
+
>
|
|
217
|
+
<v-btn
|
|
218
|
+
:title="modelValue.messages.sort"
|
|
219
|
+
:icon="statefulLayout.options.icons.sort"
|
|
220
|
+
variant="flat"
|
|
221
|
+
color="primary"
|
|
222
|
+
:density="buttonDensity"
|
|
223
|
+
v-bind="handleBind(childIndex)"
|
|
224
|
+
/>
|
|
225
|
+
</v-list-item-action>
|
|
226
|
+
<v-list-item-action
|
|
227
|
+
v-else-if="editedItem === undefined && modelValue.layout.listActions.length"
|
|
228
|
+
>
|
|
229
|
+
<v-menu
|
|
230
|
+
location="bottom end"
|
|
231
|
+
z-index="3000"
|
|
232
|
+
:density="modelValue.options.density"
|
|
233
|
+
:close-on-content-click="false"
|
|
234
|
+
:model-value="menuOpened === childIndex"
|
|
235
|
+
@update:model-value="value => toggleMenu(childIndex, value)"
|
|
224
236
|
>
|
|
225
|
-
<
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
237
|
+
<template #activator="{props: activatorProps}">
|
|
238
|
+
<v-btn
|
|
239
|
+
v-bind="activatorProps"
|
|
240
|
+
:icon="statefulLayout.options.icons.menu"
|
|
241
|
+
variant="plain"
|
|
242
|
+
slim
|
|
243
|
+
:density="buttonDensity"
|
|
244
|
+
/>
|
|
245
|
+
</template>
|
|
246
|
+
<v-list :density="modelValue.options.density">
|
|
247
|
+
<v-list-item
|
|
248
|
+
v-if="modelValue.layout.listActions.includes('edit') && modelValue.layout.listEditMode === 'inline-single'"
|
|
249
|
+
:density="modelValue.options.density"
|
|
250
|
+
base-color="primary"
|
|
251
|
+
@click="statefulLayout.activateItem(modelValue, childIndex)"
|
|
252
|
+
>
|
|
253
|
+
<template #prepend>
|
|
254
|
+
<v-icon :icon="statefulLayout.options.icons.edit" />
|
|
255
|
+
</template>
|
|
256
|
+
{{ modelValue.messages.edit }}
|
|
257
|
+
</v-list-item>
|
|
258
|
+
<v-list-item
|
|
259
|
+
v-if="modelValue.layout.listActions.includes('duplicate')"
|
|
260
|
+
@click="duplicateItem(child, childIndex)"
|
|
261
|
+
>
|
|
262
|
+
<template #prepend>
|
|
263
|
+
<v-icon :icon="statefulLayout.options.icons.duplicate" />
|
|
264
|
+
</template>
|
|
265
|
+
{{ modelValue.messages.duplicate }}
|
|
266
|
+
</v-list-item>
|
|
267
|
+
<v-list-item
|
|
268
|
+
v-if="modelValue.layout.listActions.includes('sort') && activeDnd"
|
|
269
|
+
:disabled="modelValue.data.length === 1"
|
|
270
|
+
@click="prepareDrag(childIndex)"
|
|
271
|
+
>
|
|
272
|
+
<template #prepend>
|
|
273
|
+
<v-icon :icon="statefulLayout.options.icons.sort" />
|
|
274
|
+
</template>
|
|
275
|
+
{{ modelValue.messages.sort }}
|
|
276
|
+
</v-list-item>
|
|
277
|
+
<v-list-item
|
|
278
|
+
v-if="modelValue.layout.listActions.includes('sort')"
|
|
279
|
+
:disabled="childIndex === 0"
|
|
280
|
+
@click="statefulLayout.input(modelValue, moveDataItem(modelValue.data, childIndex, childIndex - 1)); menuOpened = -1"
|
|
281
|
+
>
|
|
282
|
+
<template #prepend>
|
|
283
|
+
<v-icon :icon="statefulLayout.options.icons.sortUp" />
|
|
284
|
+
</template>
|
|
285
|
+
{{ modelValue.messages.up }}
|
|
286
|
+
</v-list-item>
|
|
287
|
+
<v-list-item
|
|
288
|
+
v-if="modelValue.layout.listActions.includes('sort')"
|
|
289
|
+
:disabled="childIndex === modelValue.data.length - 1"
|
|
290
|
+
@click="statefulLayout.input(modelValue, moveDataItem(modelValue.data, childIndex, childIndex + 1)); menuOpened = -1"
|
|
291
|
+
>
|
|
292
|
+
<template #prepend>
|
|
293
|
+
<v-icon :icon="statefulLayout.options.icons.sortDown" />
|
|
294
|
+
</template>
|
|
295
|
+
{{ modelValue.messages.down }}
|
|
296
|
+
</v-list-item>
|
|
297
|
+
<v-list-item
|
|
298
|
+
v-if="modelValue.layout.listActions.includes('delete')"
|
|
299
|
+
base-color="warning"
|
|
300
|
+
@click="preparedDelete = true"
|
|
301
|
+
>
|
|
302
|
+
<template #prepend>
|
|
303
|
+
<v-icon :icon="statefulLayout.options.icons.delete" />
|
|
304
|
+
</template>
|
|
305
|
+
{{ modelValue.messages.delete }}
|
|
306
|
+
</v-list-item>
|
|
307
|
+
<v-list-item v-if="preparedDelete">
|
|
308
|
+
<v-spacer />
|
|
231
309
|
<v-btn
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
variant="plain"
|
|
235
|
-
slim
|
|
236
|
-
:density="buttonDensity"
|
|
237
|
-
/>
|
|
238
|
-
</template>
|
|
239
|
-
<v-list>
|
|
240
|
-
<v-list-item
|
|
241
|
-
v-if="modelValue.layout.listActions.includes('delete')"
|
|
242
|
-
base-color="warning"
|
|
310
|
+
color="warning"
|
|
311
|
+
class="float-right ma-1"
|
|
243
312
|
@click="deleteItem(childIndex)"
|
|
244
313
|
>
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
v-if="modelValue.layout.listActions.includes('duplicate')"
|
|
252
|
-
@click="duplicateItem(child, childIndex)"
|
|
253
|
-
>
|
|
254
|
-
<template #prepend>
|
|
255
|
-
<v-icon :icon="statefulLayout.options.icons.duplicate" />
|
|
256
|
-
</template>
|
|
257
|
-
{{ modelValue.messages.duplicate }}
|
|
258
|
-
</v-list-item>
|
|
259
|
-
<v-list-item
|
|
260
|
-
v-if="modelValue.layout.listActions.includes('sort')"
|
|
261
|
-
@click="statefulLayout.input(modelValue, moveDataItem(modelValue.data, childIndex, childIndex - 1))"
|
|
262
|
-
>
|
|
263
|
-
<template #prepend>
|
|
264
|
-
<v-icon :icon="statefulLayout.options.icons.sortUp" />
|
|
265
|
-
</template>
|
|
266
|
-
{{ modelValue.messages.up }}
|
|
267
|
-
</v-list-item>
|
|
268
|
-
<v-list-item
|
|
269
|
-
v-if="modelValue.layout.listActions.includes('sort')"
|
|
270
|
-
@click="statefulLayout.input(modelValue, moveDataItem(modelValue.data, childIndex, childIndex + 1))"
|
|
271
|
-
>
|
|
272
|
-
<template #prepend>
|
|
273
|
-
<v-icon :icon="statefulLayout.options.icons.sortDown" />
|
|
274
|
-
</template>
|
|
275
|
-
{{ modelValue.messages.down }}
|
|
276
|
-
</v-list-item>
|
|
277
|
-
</v-list>
|
|
278
|
-
</v-menu>
|
|
279
|
-
</v-list-item-action>
|
|
280
|
-
</template>
|
|
314
|
+
{{ modelValue.messages.confirm }}
|
|
315
|
+
</v-btn>
|
|
316
|
+
</v-list-item>
|
|
317
|
+
</v-list>
|
|
318
|
+
</v-menu>
|
|
319
|
+
</v-list-item-action>
|
|
281
320
|
</div>
|
|
282
321
|
</template>
|
|
283
322
|
</v-list-item>
|
package/types/compat/v2.d.ts
CHANGED
|
@@ -5,6 +5,6 @@
|
|
|
5
5
|
* @param {string} lang
|
|
6
6
|
* @returns
|
|
7
7
|
*/
|
|
8
|
-
export function v2compat(_schema: object, _ajv?: ajvModule.
|
|
8
|
+
export function v2compat(_schema: object, _ajv?: ajvModule.Ajv | undefined, lang?: string): ajvModule.SchemaObject;
|
|
9
9
|
import ajvModule from 'ajv';
|
|
10
10
|
//# sourceMappingURL=v2.d.ts.map
|
package/types/compat/v2.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"v2.d.ts","sourceRoot":"","sources":["../../src/compat/v2.js"],"names":[],"mappings":"AAyMA;;;;;;GAMG;AACH,kCALW,MAAM
|
|
1
|
+
{"version":3,"file":"v2.d.ts","sourceRoot":"","sources":["../../src/compat/v2.js"],"names":[],"mappings":"AAyMA;;;;;;GAMG;AACH,kCALW,MAAM,2CAEN,MAAM,0BAoBhB;sBAjOqB,KAAK"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
declare const _default: import("vue").DefineComponent<any, {
|
|
2
|
+
$emit: (event: "delete" | "drag" | "sortUp" | "sortDown", ...args: any[]) => void;
|
|
3
|
+
listNode: import("../../types.js").VjsfListNode;
|
|
4
|
+
statefulLayout: import("../../types.js").VjsfStatefulLayout;
|
|
5
|
+
$props: {
|
|
6
|
+
readonly listNode?: import("../../types.js").VjsfListNode | undefined;
|
|
7
|
+
readonly statefulLayout?: import("../../types.js").VjsfStatefulLayout | undefined;
|
|
8
|
+
};
|
|
9
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<any> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
10
|
+
export default _default;
|
|
11
|
+
//# sourceMappingURL=list-item-menu.vue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-item-menu.vue.d.ts","sourceRoot":"","sources":["../../../src/components/fragments/list-item-menu.vue.js"],"names":[],"mappings":""}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
declare const _default: import("vue").DefineComponent<any, {
|
|
2
2
|
multiple: boolean;
|
|
3
|
-
item: import("
|
|
3
|
+
item: import("../../../node_modules/@json-layout/vocabulary/types/normalized-layout/types.js").SelectItem;
|
|
4
4
|
avatarProps: Record<string, any>;
|
|
5
5
|
itemProps: Record<string, any>;
|
|
6
6
|
$props: {
|
|
7
7
|
readonly multiple?: boolean | undefined;
|
|
8
|
-
readonly item?: import("
|
|
8
|
+
readonly item?: import("../../../node_modules/@json-layout/vocabulary/types/normalized-layout/types.js").SelectItem | undefined;
|
|
9
9
|
readonly avatarProps?: Record<string, any> | undefined;
|
|
10
10
|
readonly itemProps?: Record<string, any> | undefined;
|
|
11
11
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
declare const _default: import("vue").DefineComponent<any, {
|
|
2
2
|
multiple: boolean;
|
|
3
|
-
item: import("
|
|
3
|
+
item: import("../../../node_modules/@json-layout/vocabulary/types/normalized-layout/types.js").SelectItem;
|
|
4
4
|
avatarProps: Record<string, any>;
|
|
5
5
|
last: boolean;
|
|
6
6
|
$props: {
|
|
7
7
|
readonly multiple?: boolean | undefined;
|
|
8
|
-
readonly item?: import("
|
|
8
|
+
readonly item?: import("../../../node_modules/@json-layout/vocabulary/types/normalized-layout/types.js").SelectItem | undefined;
|
|
9
9
|
readonly avatarProps?: Record<string, any> | undefined;
|
|
10
10
|
readonly last?: boolean | undefined;
|
|
11
11
|
};
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
export default function _default(nodeRef: import('vue').Ref<import('../types.js').VjsfNode>, statefulLayout: import('../types.js').VjsfStatefulLayout): {
|
|
6
6
|
hasItems: import("vue").ComputedRef<boolean>;
|
|
7
|
-
items: import("vue").Ref<import("
|
|
7
|
+
items: import("vue").Ref<import("../../node_modules/@json-layout/vocabulary/types/normalized-layout/types.js").SelectItems, import("../../node_modules/@json-layout/vocabulary/types/normalized-layout/types.js").SelectItems>;
|
|
8
8
|
loading: import("vue").Ref<boolean, boolean>;
|
|
9
9
|
search: import("vue").Ref<string, string>;
|
|
10
10
|
prepareSelectedItem: (selectedItem: any, itemValue: any) => any;
|
|
@@ -25,7 +25,7 @@ export default function _default(nodeRef: import('vue').Ref<import('../types.js'
|
|
|
25
25
|
compSlots: import("vue").ComputedRef<Record<string, any>>;
|
|
26
26
|
options: import("vue").ComputedRef<Required<import("../types.js").VjsfOptions>>;
|
|
27
27
|
skeleton: import("vue").ComputedRef<import("../../node_modules/@json-layout/core/types/compile/types.js").SkeletonNode>;
|
|
28
|
-
layout: import("vue").ComputedRef<import("
|
|
28
|
+
layout: import("vue").ComputedRef<import("../../node_modules/@json-layout/vocabulary/types/normalized-layout/types.js").BaseCompObject>;
|
|
29
29
|
data: import("vue").ComputedRef<unknown>;
|
|
30
30
|
children: import("vue").ComputedRef<import("../../node_modules/@json-layout/core/types/state/types.js").StateNode[] | undefined>;
|
|
31
31
|
};
|
|
@@ -19,7 +19,7 @@ export default function _default(nodeRef: import('vue').Ref<import('../types.js'
|
|
|
19
19
|
}>;
|
|
20
20
|
getItems: {
|
|
21
21
|
hasItems: import("vue").ComputedRef<boolean>;
|
|
22
|
-
items: import("vue").Ref<import("
|
|
22
|
+
items: import("vue").Ref<import("../../node_modules/@json-layout/vocabulary/types/normalized-layout/types.js").SelectItems, import("../../node_modules/@json-layout/vocabulary/types/normalized-layout/types.js").SelectItems>;
|
|
23
23
|
loading: import("vue").Ref<boolean, boolean>;
|
|
24
24
|
search: import("vue").Ref<string, string>;
|
|
25
25
|
prepareSelectedItem: (selectedItem: any, itemValue: any) => any;
|