nuxt-ui-tools 1.17.1 → 1.19.0
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/dist/module.json +1 -1
- package/dist/module.mjs +1 -0
- package/dist/runtime/form/components/page/form-page-header.d.vue.ts +3 -1
- package/dist/runtime/form/components/page/form-page-header.vue +44 -34
- package/dist/runtime/form/components/page/form-page-header.vue.d.ts +3 -1
- package/dist/runtime/form/components/page/form-page-navigation.d.vue.ts +5 -3
- package/dist/runtime/form/components/page/form-page-navigation.vue +6 -3
- package/dist/runtime/form/components/page/form-page-navigation.vue.d.ts +5 -3
- package/dist/runtime/form/components/page/form-page-section.vue +6 -5
- package/dist/runtime/form/components/page/form-page-sections.d.vue.ts +4 -3
- package/dist/runtime/form/components/page/form-page-sections.vue +7 -2
- package/dist/runtime/form/components/page/form-page-sections.vue.d.ts +4 -3
- package/dist/runtime/form/components/page/form-page.d.vue.ts +2 -0
- package/dist/runtime/form/components/page/form-page.vue +11 -2
- package/dist/runtime/form/components/page/form-page.vue.d.ts +2 -0
- package/dist/runtime/form/components/renderer/form-field-renderer.vue +6 -4
- package/dist/runtime/form/components/renderer/form-field-shell.d.vue.ts +4 -4
- package/dist/runtime/form/components/renderer/form-field-shell.vue +28 -4
- package/dist/runtime/form/components/renderer/form-field-shell.vue.d.ts +4 -4
- package/dist/runtime/form/components/root/form.vue +2 -2
- package/dist/runtime/form/components/utils/form-option-choice-label.d.vue.ts +16 -0
- package/dist/runtime/form/components/utils/form-option-choice-label.vue +37 -0
- package/dist/runtime/form/components/utils/form-option-choice-label.vue.d.ts +16 -0
- package/dist/runtime/form/components/utils/form-option-display-value.d.vue.ts +14 -0
- package/dist/runtime/form/components/utils/form-option-display-value.vue +20 -0
- package/dist/runtime/form/components/utils/form-option-display-value.vue.d.ts +14 -0
- package/dist/runtime/form/components/utils/form-option-item-label.d.vue.ts +9 -2
- package/dist/runtime/form/components/utils/form-option-item-label.vue +20 -13
- package/dist/runtime/form/components/utils/form-option-item-label.vue.d.ts +9 -2
- package/dist/runtime/form/components/utils/form-option-leading.d.vue.ts +23 -0
- package/dist/runtime/form/components/utils/form-option-leading.vue +41 -0
- package/dist/runtime/form/components/utils/form-option-leading.vue.d.ts +23 -0
- package/dist/runtime/form/components/utils/form-option-render.d.ts +11 -0
- package/dist/runtime/form/components/utils/form-option-render.js +5 -0
- package/dist/runtime/form/components/utils/form-option-suffix.d.vue.ts +8 -0
- package/dist/runtime/form/components/utils/form-option-suffix.vue +15 -0
- package/dist/runtime/form/components/utils/form-option-suffix.vue.d.ts +8 -0
- package/dist/runtime/form/components/utils/form-option-value-overlay.d.vue.ts +30 -0
- package/dist/runtime/form/components/utils/form-option-value-overlay.vue +44 -0
- package/dist/runtime/form/components/utils/form-option-value-overlay.vue.d.ts +30 -0
- package/dist/runtime/form/composables/use-choice-group-items.d.ts +27 -0
- package/dist/runtime/form/composables/use-choice-group-items.js +24 -0
- package/dist/runtime/form/composables/use-field-control.d.ts +6 -6
- package/dist/runtime/form/composables/use-field-control.js +9 -21
- package/dist/runtime/form/composables/use-field-options.js +8 -4
- package/dist/runtime/form/composables/use-form-layout.js +4 -3
- package/dist/runtime/form/composables/use-form-page.d.ts +11 -1
- package/dist/runtime/form/composables/use-form-page.js +12 -6
- package/dist/runtime/form/composables/use-form-runtime.js +1 -1
- package/dist/runtime/form/composables/use-option-menu.d.ts +20 -0
- package/dist/runtime/form/composables/use-option-menu.js +41 -0
- package/dist/runtime/form/fields/array-primitive/types.d.ts +1 -1
- package/dist/runtime/form/fields/auto-complete/component.vue +92 -51
- package/dist/runtime/form/fields/auto-complete/config.d.ts +1 -0
- package/dist/runtime/form/fields/auto-complete/config.js +1 -1
- package/dist/runtime/form/fields/auto-complete/types.d.ts +2 -2
- package/dist/runtime/form/fields/checkbox-card/component.vue +55 -29
- package/dist/runtime/form/fields/checkbox-card/config.d.ts +1 -0
- package/dist/runtime/form/fields/checkbox-card/config.js +1 -1
- package/dist/runtime/form/fields/checkbox-card/types.d.ts +3 -3
- package/dist/runtime/form/fields/checkbox-group/component.vue +18 -4
- package/dist/runtime/form/fields/checkbox-group/types.d.ts +2 -2
- package/dist/runtime/form/fields/choice-card/choice-card-label.d.vue.ts +7 -0
- package/dist/runtime/form/fields/choice-card/choice-card-label.vue +27 -1
- package/dist/runtime/form/fields/choice-card/choice-card-label.vue.d.ts +7 -0
- package/dist/runtime/form/fields/choice-card/types.d.ts +35 -1
- package/dist/runtime/form/fields/choice-card/use-choice-card.d.ts +7 -3
- package/dist/runtime/form/fields/choice-card/use-choice-card.js +37 -15
- package/dist/runtime/form/fields/choice-card/utils.d.ts +10 -0
- package/dist/runtime/form/fields/choice-card/utils.js +6 -0
- package/dist/runtime/form/fields/hierarchy/component.vue +3 -2
- package/dist/runtime/form/fields/index.d.ts +4 -0
- package/dist/runtime/form/fields/radio/component.vue +19 -2
- package/dist/runtime/form/fields/radio/types.d.ts +2 -2
- package/dist/runtime/form/fields/radio-card/component.vue +58 -28
- package/dist/runtime/form/fields/radio-card/config.d.ts +1 -0
- package/dist/runtime/form/fields/radio-card/config.js +1 -1
- package/dist/runtime/form/fields/radio-card/types.d.ts +3 -3
- package/dist/runtime/form/fields/select/component.vue +56 -58
- package/dist/runtime/form/fields/select/config.d.ts +1 -0
- package/dist/runtime/form/fields/select/config.js +1 -1
- package/dist/runtime/form/fields/select/types.d.ts +2 -2
- package/dist/runtime/form/types/field-base.d.ts +6 -0
- package/dist/runtime/form/types/field-kind.d.ts +3 -1
- package/dist/runtime/form/types/field.d.ts +1 -0
- package/dist/runtime/form/types/layout.d.ts +6 -0
- package/dist/runtime/form/types/options.d.ts +137 -0
- package/dist/runtime/form/types/page.d.ts +20 -8
- package/dist/runtime/form/types/ui.d.ts +29 -4
- package/dist/runtime/form/utils/disabled.d.ts +11 -0
- package/dist/runtime/form/utils/disabled.js +11 -0
- package/dist/runtime/form/utils/field-instance.js +3 -0
- package/dist/runtime/form/utils/options.d.ts +56 -11
- package/dist/runtime/form/utils/options.js +86 -0
- package/dist/runtime/form/utils/page-surface.d.ts +26 -0
- package/dist/runtime/form/utils/page-surface.js +28 -0
- package/dist/runtime/form/utils/page.d.ts +21 -1
- package/dist/runtime/form/utils/page.js +24 -2
- package/dist/runtime/i18n/locales/en.js +28 -8
- package/dist/runtime/i18n/locales/fr.js +28 -8
- package/dist/runtime/i18n/types.d.ts +46 -7
- package/dist/runtime/spreadsheet/components/internal/spreadsheet-import-column-row.d.vue.ts +2 -2
- package/dist/runtime/spreadsheet/components/internal/spreadsheet-import-column-row.vue.d.ts +2 -2
- package/dist/runtime/table/components/actions/row-actions.d.vue.ts +2 -0
- package/dist/runtime/table/components/actions/row-actions.vue +8 -3
- package/dist/runtime/table/components/actions/row-actions.vue.d.ts +2 -0
- package/dist/runtime/table/components/data-list/data-list-content.vue +7 -1
- package/dist/runtime/table/components/data-list/data-list-default.d.vue.ts +16 -16
- package/dist/runtime/table/components/data-list/data-list-default.vue +3 -0
- package/dist/runtime/table/components/data-list/data-list-default.vue.d.ts +16 -16
- package/dist/runtime/table/components/data-list/data-list-layout-switch.vue +7 -9
- package/dist/runtime/table/components/data-list/data-list-root.vue +5 -6
- package/dist/runtime/table/components/data-list/data-list-sort-menu.vue +3 -1
- package/dist/runtime/table/components/data-list/data-list-table.d.vue.ts +8 -1
- package/dist/runtime/table/components/data-list/data-list-table.vue +18 -1
- package/dist/runtime/table/components/data-list/data-list-table.vue.d.ts +8 -1
- package/dist/runtime/table/components/data-list/data-list-view-toggle.d.vue.ts +25 -0
- package/dist/runtime/table/components/data-list/data-list-view-toggle.vue +57 -0
- package/dist/runtime/table/components/data-list/data-list-view-toggle.vue.d.ts +25 -0
- package/dist/runtime/table/components/data-list/sort-menu-panel.vue +1 -1
- package/dist/runtime/table/components/filters/tags/boolean-filter-tag.d.vue.ts +2 -2
- package/dist/runtime/table/components/filters/tags/boolean-filter-tag.vue.d.ts +2 -2
- package/dist/runtime/table/components/filters/tags/date-filter-tag.d.vue.ts +2 -2
- package/dist/runtime/table/components/filters/tags/date-filter-tag.vue.d.ts +2 -2
- package/dist/runtime/table/components/filters/tags/number-filter-tag.d.vue.ts +2 -2
- package/dist/runtime/table/components/filters/tags/number-filter-tag.vue.d.ts +2 -2
- package/dist/runtime/table/components/filters/tags/option-filter-tag.d.vue.ts +2 -2
- package/dist/runtime/table/components/filters/tags/option-filter-tag.vue.d.ts +2 -2
- package/dist/runtime/table/components/filters/tags/text-filter-tag.d.vue.ts +2 -2
- package/dist/runtime/table/components/filters/tags/text-filter-tag.vue.d.ts +2 -2
- package/dist/runtime/table/components/layout/table-footer.d.vue.ts +6 -4
- package/dist/runtime/table/components/layout/table-footer.vue +80 -3
- package/dist/runtime/table/components/layout/table-footer.vue.d.ts +6 -4
- package/dist/runtime/table/components/summary/summary-content.d.ts +13 -0
- package/dist/runtime/table/components/summary/summary-content.js +5 -0
- package/dist/runtime/table/components/summary/summary-renderer.d.vue.ts +31 -0
- package/dist/runtime/table/components/summary/summary-renderer.vue +282 -0
- package/dist/runtime/table/components/summary/summary-renderer.vue.d.ts +31 -0
- package/dist/runtime/table/components/summary/summary-row.d.vue.ts +19 -0
- package/dist/runtime/table/components/summary/summary-row.vue +102 -0
- package/dist/runtime/table/components/summary/summary-row.vue.d.ts +19 -0
- package/dist/runtime/table/components/table/table-empty-state.vue +39 -9
- package/dist/runtime/table/components/table/table-renderer.vue +1 -1
- package/dist/runtime/table/components/table/table-row-actions-control.vue +10 -6
- package/dist/runtime/table/components/table/table-selection-control.d.vue.ts +5 -1
- package/dist/runtime/table/components/table/table-selection-control.vue +17 -4
- package/dist/runtime/table/components/table/table-selection-control.vue.d.ts +5 -1
- package/dist/runtime/table/components/table/table-tree-control.vue +2 -1
- package/dist/runtime/table/components/table/table-tree-header.vue +0 -1
- package/dist/runtime/table/composables/use-table-api.d.ts +2 -0
- package/dist/runtime/table/composables/use-table-api.js +8 -0
- package/dist/runtime/table/composables/use-table-columns.d.ts +2 -0
- package/dist/runtime/table/composables/use-table-controls.d.ts +6 -0
- package/dist/runtime/table/composables/use-table-controls.js +6 -3
- package/dist/runtime/table/composables/use-table-internals.d.ts +33 -0
- package/dist/runtime/table/composables/use-table-internals.js +9 -0
- package/dist/runtime/table/composables/use-table-row-labels.d.ts +16 -0
- package/dist/runtime/table/composables/use-table-row-labels.js +22 -0
- package/dist/runtime/table/composables/use-table-row-summary.d.ts +18 -0
- package/dist/runtime/table/composables/use-table-row-summary.js +41 -0
- package/dist/runtime/table/constants/mobile.d.ts +79 -0
- package/dist/runtime/table/constants/mobile.js +17 -0
- package/dist/runtime/table/constants/summary.d.ts +67 -0
- package/dist/runtime/table/constants/summary.js +31 -0
- package/dist/runtime/table/types/data-list.d.ts +58 -8
- package/dist/runtime/table/types/layout.d.ts +73 -0
- package/dist/runtime/table/types/remote-options.d.ts +4 -1
- package/dist/runtime/table/types/schema.d.ts +9 -1
- package/dist/runtime/table/types/table-api.d.ts +12 -0
- package/dist/runtime/table/utils/columns/defs.js +3 -1
- package/dist/runtime/table/utils/columns/render.d.ts +2 -0
- package/dist/runtime/table/utils/columns/render.js +2 -2
- package/dist/runtime/table/utils/data-list-ui.d.ts +1 -1
- package/dist/runtime/table/utils/data-list-ui.js +3 -1
- package/dist/runtime/table/utils/mobile-defaults.d.ts +7 -0
- package/dist/runtime/table/utils/mobile-defaults.js +25 -0
- package/dist/runtime/table/utils/remote-table-options.js +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { VNodeChild } from 'vue';
|
|
2
|
+
import type { FormOptionRenderContext, ResolvedFormOption } from '../../types/index.js';
|
|
3
|
+
/**
|
|
4
|
+
* Label of an option in a radio or checkbox list: the leading visual, the label, and the suffix at
|
|
5
|
+
* the end of the row. The description stays with the Nuxt UI group, under the row. An option with a
|
|
6
|
+
* `renderOption` function shows what it returns instead, and a plain option shows its label as it
|
|
7
|
+
* always did.
|
|
8
|
+
*/
|
|
9
|
+
type __VLS_Props = {
|
|
10
|
+
option: ResolvedFormOption;
|
|
11
|
+
selected?: boolean;
|
|
12
|
+
render?: (context: FormOptionRenderContext) => VNodeChild;
|
|
13
|
+
};
|
|
14
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
15
|
+
declare const _default: typeof __VLS_export;
|
|
16
|
+
export default _default;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { VNodeChild } from 'vue';
|
|
2
|
+
import type { FormOptionValueRenderContext, ResolvedFormOption } from '../../types/index.js';
|
|
3
|
+
/**
|
|
4
|
+
* The chosen option as the closed control of a select or auto-complete reads: what `renderValue`
|
|
5
|
+
* returns, or the label followed by the dimmed suffix. The leading visual belongs to the control's
|
|
6
|
+
* own leading slot.
|
|
7
|
+
*/
|
|
8
|
+
type __VLS_Props = {
|
|
9
|
+
option: ResolvedFormOption;
|
|
10
|
+
render?: (context: FormOptionValueRenderContext) => VNodeChild;
|
|
11
|
+
};
|
|
12
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
13
|
+
declare const _default: typeof __VLS_export;
|
|
14
|
+
export default _default;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import FormOptionRender from "./form-option-render";
|
|
3
|
+
import FormOptionSuffix from "./form-option-suffix.vue";
|
|
4
|
+
const props = defineProps({
|
|
5
|
+
option: { type: Object, required: true },
|
|
6
|
+
render: { type: Function, required: false }
|
|
7
|
+
});
|
|
8
|
+
function content() {
|
|
9
|
+
const { item } = props.option;
|
|
10
|
+
return item === void 0 ? null : props.render?.({ item, option: props.option });
|
|
11
|
+
}
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<template>
|
|
15
|
+
<FormOptionRender v-if="render" :content="content" />
|
|
16
|
+
<template v-else>
|
|
17
|
+
{{ option.label }}
|
|
18
|
+
<FormOptionSuffix :option="option" class="ms-1.5" />
|
|
19
|
+
</template>
|
|
20
|
+
</template>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { VNodeChild } from 'vue';
|
|
2
|
+
import type { FormOptionValueRenderContext, ResolvedFormOption } from '../../types/index.js';
|
|
3
|
+
/**
|
|
4
|
+
* The chosen option as the closed control of a select or auto-complete reads: what `renderValue`
|
|
5
|
+
* returns, or the label followed by the dimmed suffix. The leading visual belongs to the control's
|
|
6
|
+
* own leading slot.
|
|
7
|
+
*/
|
|
8
|
+
type __VLS_Props = {
|
|
9
|
+
option: ResolvedFormOption;
|
|
10
|
+
render?: (context: FormOptionValueRenderContext) => VNodeChild;
|
|
11
|
+
};
|
|
12
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
13
|
+
declare const _default: typeof __VLS_export;
|
|
14
|
+
export default _default;
|
|
@@ -1,6 +1,13 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { VNodeChild } from 'vue';
|
|
2
|
+
import type { FormOptionRenderContext, ResolvedFormOption } from '../../types/index.js';
|
|
3
|
+
/**
|
|
4
|
+
* Label of an option in a menu. The load-more row keeps its own loader, an option with a
|
|
5
|
+
* `renderOption` function shows what it returns, and any other option shows its label.
|
|
6
|
+
*/
|
|
2
7
|
type __VLS_Props = {
|
|
3
|
-
|
|
8
|
+
option: ResolvedFormOption;
|
|
9
|
+
selected?: boolean;
|
|
10
|
+
render?: (context: FormOptionRenderContext) => VNodeChild;
|
|
4
11
|
};
|
|
5
12
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
6
13
|
declare const _default: typeof __VLS_export;
|
|
@@ -2,19 +2,23 @@
|
|
|
2
2
|
import UIcon from "@nuxt/ui/components/Icon.vue";
|
|
3
3
|
import { computed } from "vue";
|
|
4
4
|
import { isLoadMoreOption } from "../../utils/options";
|
|
5
|
-
import
|
|
6
|
-
import { isNumber, isString } from "../../utils/predicate";
|
|
5
|
+
import FormOptionRender from "./form-option-render";
|
|
7
6
|
const props = defineProps({
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
const label = computed(() => {
|
|
12
|
-
if (isRecord(props.item)) {
|
|
13
|
-
const value = props.item.label;
|
|
14
|
-
return isString(value) || isNumber(value) ? String(value) : "";
|
|
15
|
-
}
|
|
16
|
-
return isString(props.item) || isNumber(props.item) ? String(props.item) : "";
|
|
7
|
+
option: { type: Object, required: true },
|
|
8
|
+
selected: { type: Boolean, required: false },
|
|
9
|
+
render: { type: Function, required: false }
|
|
17
10
|
});
|
|
11
|
+
const loadMore = computed(() => isLoadMoreOption(props.option));
|
|
12
|
+
function content() {
|
|
13
|
+
const { item } = props.option;
|
|
14
|
+
if (item === void 0) return null;
|
|
15
|
+
return props.render?.({
|
|
16
|
+
disabled: props.option.disabled === true,
|
|
17
|
+
item,
|
|
18
|
+
option: props.option,
|
|
19
|
+
selected: props.selected === true
|
|
20
|
+
});
|
|
21
|
+
}
|
|
18
22
|
</script>
|
|
19
23
|
|
|
20
24
|
<template>
|
|
@@ -24,7 +28,10 @@ const label = computed(() => {
|
|
|
24
28
|
data-form-option-loading=""
|
|
25
29
|
>
|
|
26
30
|
<UIcon name="i-lucide-loader-circle" class="size-3.5 animate-spin" aria-hidden="true" />
|
|
27
|
-
{{ label }}
|
|
31
|
+
{{ option.label }}
|
|
32
|
+
</span>
|
|
33
|
+
<span v-else-if="render" class="block whitespace-normal" data-form-option-custom>
|
|
34
|
+
<FormOptionRender :content="content" />
|
|
28
35
|
</span>
|
|
29
|
-
<template v-else>{{ label }}</template>
|
|
36
|
+
<template v-else>{{ option.label }}</template>
|
|
30
37
|
</template>
|
|
@@ -1,6 +1,13 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { VNodeChild } from 'vue';
|
|
2
|
+
import type { FormOptionRenderContext, ResolvedFormOption } from '../../types/index.js';
|
|
3
|
+
/**
|
|
4
|
+
* Label of an option in a menu. The load-more row keeps its own loader, an option with a
|
|
5
|
+
* `renderOption` function shows what it returns, and any other option shows its label.
|
|
6
|
+
*/
|
|
2
7
|
type __VLS_Props = {
|
|
3
|
-
|
|
8
|
+
option: ResolvedFormOption;
|
|
9
|
+
selected?: boolean;
|
|
10
|
+
render?: (context: FormOptionRenderContext) => VNodeChild;
|
|
4
11
|
};
|
|
5
12
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
6
13
|
declare const _default: typeof __VLS_export;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { ResolvedFormOption } from '../../types/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* The one visual an option draws before its label: its icon, else its avatar, else its chip, the
|
|
4
|
+
* same order as Nuxt UI items. Draws nothing for an option that declares none, or for no option:
|
|
5
|
+
* a menu fills its leading slot with this component even when a `renderOption` function owns the
|
|
6
|
+
* content, because an empty slot would bring back the Nuxt UI icon.
|
|
7
|
+
*/
|
|
8
|
+
type __VLS_Props = {
|
|
9
|
+
option?: ResolvedFormOption;
|
|
10
|
+
/** Classes of the icon, so a control can match its own leading icon. */
|
|
11
|
+
iconClass?: string;
|
|
12
|
+
/** Nuxt UI avatar size; one the avatar does not know falls back to `xs`. */
|
|
13
|
+
avatarSize?: string;
|
|
14
|
+
/** Classes of the box the chip dot is centered in. */
|
|
15
|
+
chipClass?: string;
|
|
16
|
+
};
|
|
17
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
18
|
+
iconClass: string;
|
|
19
|
+
avatarSize: string;
|
|
20
|
+
chipClass: string;
|
|
21
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
22
|
+
declare const _default: typeof __VLS_export;
|
|
23
|
+
export default _default;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import UAvatar from "@nuxt/ui/components/Avatar.vue";
|
|
3
|
+
import UChip from "@nuxt/ui/components/Chip.vue";
|
|
4
|
+
import UIcon from "@nuxt/ui/components/Icon.vue";
|
|
5
|
+
import { computed } from "vue";
|
|
6
|
+
const AVATAR_SIZES = ["3xs", "2xs", "xs", "sm", "md", "lg", "xl", "2xl", "3xl"];
|
|
7
|
+
const props = defineProps({
|
|
8
|
+
option: { type: Object, required: false },
|
|
9
|
+
iconClass: { type: String, required: false, default: "size-4 text-muted" },
|
|
10
|
+
avatarSize: { type: String, required: false, default: "xs" },
|
|
11
|
+
chipClass: { type: String, required: false, default: "size-4" }
|
|
12
|
+
});
|
|
13
|
+
const size = computed(() => AVATAR_SIZES.find((entry) => entry === props.avatarSize) ?? "xs");
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
<template>
|
|
17
|
+
<UIcon
|
|
18
|
+
v-if="option?.icon"
|
|
19
|
+
:name="option.icon"
|
|
20
|
+
:class="['shrink-0', iconClass]"
|
|
21
|
+
aria-hidden="true"
|
|
22
|
+
data-form-option-leading="icon"
|
|
23
|
+
/>
|
|
24
|
+
<UAvatar
|
|
25
|
+
v-else-if="option?.avatar"
|
|
26
|
+
:src="option.avatar.src"
|
|
27
|
+
:alt="option.avatar.alt ?? option.label"
|
|
28
|
+
:text="option.avatar.text"
|
|
29
|
+
:size="size"
|
|
30
|
+
class="shrink-0"
|
|
31
|
+
data-form-option-leading="avatar"
|
|
32
|
+
/>
|
|
33
|
+
<span
|
|
34
|
+
v-else-if="option?.chip"
|
|
35
|
+
:class="['grid shrink-0 place-items-center', chipClass]"
|
|
36
|
+
aria-hidden="true"
|
|
37
|
+
data-form-option-leading="chip"
|
|
38
|
+
>
|
|
39
|
+
<UChip standalone inset size="md" :color="option.chip.color" />
|
|
40
|
+
</span>
|
|
41
|
+
</template>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { ResolvedFormOption } from '../../types/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* The one visual an option draws before its label: its icon, else its avatar, else its chip, the
|
|
4
|
+
* same order as Nuxt UI items. Draws nothing for an option that declares none, or for no option:
|
|
5
|
+
* a menu fills its leading slot with this component even when a `renderOption` function owns the
|
|
6
|
+
* content, because an empty slot would bring back the Nuxt UI icon.
|
|
7
|
+
*/
|
|
8
|
+
type __VLS_Props = {
|
|
9
|
+
option?: ResolvedFormOption;
|
|
10
|
+
/** Classes of the icon, so a control can match its own leading icon. */
|
|
11
|
+
iconClass?: string;
|
|
12
|
+
/** Nuxt UI avatar size; one the avatar does not know falls back to `xs`. */
|
|
13
|
+
avatarSize?: string;
|
|
14
|
+
/** Classes of the box the chip dot is centered in. */
|
|
15
|
+
chipClass?: string;
|
|
16
|
+
};
|
|
17
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
18
|
+
iconClass: string;
|
|
19
|
+
avatarSize: string;
|
|
20
|
+
chipClass: string;
|
|
21
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
22
|
+
declare const _default: typeof __VLS_export;
|
|
23
|
+
export default _default;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { VNodeChild } from 'vue';
|
|
2
|
+
/**
|
|
3
|
+
* Renders what a `renderOption` or `renderValue` function returned. The function is called inside
|
|
4
|
+
* this component's render, so the reactive state it reads re-renders only this option.
|
|
5
|
+
*/
|
|
6
|
+
declare const _default: import("vue").DefineSetupFnComponent<{
|
|
7
|
+
content: () => VNodeChild;
|
|
8
|
+
}, {}, {}, {
|
|
9
|
+
content: () => VNodeChild;
|
|
10
|
+
} & {}, import("vue").PublicProps>;
|
|
11
|
+
export default _default;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ResolvedFormOption } from '../../types/index.js';
|
|
2
|
+
/** The secondary text at the end of an option, dimmed, with numbers that line up in a column. */
|
|
3
|
+
type __VLS_Props = {
|
|
4
|
+
option: ResolvedFormOption;
|
|
5
|
+
};
|
|
6
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
7
|
+
declare const _default: typeof __VLS_export;
|
|
8
|
+
export default _default;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
defineProps({
|
|
3
|
+
option: { type: Object, required: true }
|
|
4
|
+
});
|
|
5
|
+
</script>
|
|
6
|
+
|
|
7
|
+
<template>
|
|
8
|
+
<span
|
|
9
|
+
v-if="option.suffix"
|
|
10
|
+
class="shrink-0 whitespace-nowrap text-dimmed tabular-nums"
|
|
11
|
+
data-form-option-suffix
|
|
12
|
+
>
|
|
13
|
+
{{ option.suffix }}
|
|
14
|
+
</span>
|
|
15
|
+
</template>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ResolvedFormOption } from '../../types/index.js';
|
|
2
|
+
/** The secondary text at the end of an option, dimmed, with numbers that line up in a column. */
|
|
3
|
+
type __VLS_Props = {
|
|
4
|
+
option: ResolvedFormOption;
|
|
5
|
+
};
|
|
6
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
7
|
+
declare const _default: typeof __VLS_export;
|
|
8
|
+
export default _default;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { VNodeChild } from 'vue';
|
|
2
|
+
import type { FormOptionValueRenderContext, ResolvedFormOption } from '../../types/index.js';
|
|
3
|
+
/**
|
|
4
|
+
* Draws the chosen option of an auto-complete over the text of its input, while the field rests.
|
|
5
|
+
* The input holds plain text, so a `renderValue` result or a suffix after the label can only sit
|
|
6
|
+
* on top of it: the input keeps its own text (made transparent by the field while `active`), its
|
|
7
|
+
* selection and its focus, and the overlay copies the input's padding and type so the value starts
|
|
8
|
+
* where the text would. It ignores the pointer, and is hidden from assistive technology because
|
|
9
|
+
* the input already announces the label.
|
|
10
|
+
*/
|
|
11
|
+
type __VLS_Props = {
|
|
12
|
+
/** The chosen option, or none. */
|
|
13
|
+
option?: ResolvedFormOption;
|
|
14
|
+
render?: (context: FormOptionValueRenderContext) => VNodeChild;
|
|
15
|
+
/** True while the overlay stands in for the text of the input. */
|
|
16
|
+
active: boolean;
|
|
17
|
+
};
|
|
18
|
+
declare var __VLS_1: {};
|
|
19
|
+
type __VLS_Slots = {} & {
|
|
20
|
+
default?: (props: typeof __VLS_1) => any;
|
|
21
|
+
};
|
|
22
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
23
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
24
|
+
declare const _default: typeof __VLS_export;
|
|
25
|
+
export default _default;
|
|
26
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
27
|
+
new (): {
|
|
28
|
+
$slots: S;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { nextTick, onMounted, ref, useTemplateRef, watch } from "vue";
|
|
3
|
+
import FormOptionDisplayValue from "./form-option-display-value.vue";
|
|
4
|
+
const props = defineProps({
|
|
5
|
+
option: { type: Object, required: false },
|
|
6
|
+
render: { type: Function, required: false },
|
|
7
|
+
active: { type: Boolean, required: true }
|
|
8
|
+
});
|
|
9
|
+
const root = useTemplateRef("root");
|
|
10
|
+
const inset = ref({});
|
|
11
|
+
function measure() {
|
|
12
|
+
const input = root.value?.querySelector("input");
|
|
13
|
+
if (!input) return;
|
|
14
|
+
const style = getComputedStyle(input);
|
|
15
|
+
inset.value = {
|
|
16
|
+
fontSize: style.fontSize,
|
|
17
|
+
insetInlineEnd: style.paddingInlineEnd,
|
|
18
|
+
insetInlineStart: style.paddingInlineStart,
|
|
19
|
+
lineHeight: style.lineHeight
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
onMounted(measure);
|
|
23
|
+
watch(
|
|
24
|
+
() => [props.option?.value, props.active],
|
|
25
|
+
() => nextTick(measure)
|
|
26
|
+
);
|
|
27
|
+
</script>
|
|
28
|
+
|
|
29
|
+
<template>
|
|
30
|
+
<div ref="root" class="relative w-full min-w-0">
|
|
31
|
+
<slot />
|
|
32
|
+
<div
|
|
33
|
+
v-if="active && option"
|
|
34
|
+
class="pointer-events-none absolute inset-y-0 flex min-w-0 items-center overflow-hidden whitespace-nowrap text-highlighted"
|
|
35
|
+
:style="inset"
|
|
36
|
+
aria-hidden="true"
|
|
37
|
+
data-form-option-value-overlay
|
|
38
|
+
>
|
|
39
|
+
<span class="min-w-0 truncate">
|
|
40
|
+
<FormOptionDisplayValue :option="option" :render="render" />
|
|
41
|
+
</span>
|
|
42
|
+
</div>
|
|
43
|
+
</div>
|
|
44
|
+
</template>
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { VNodeChild } from 'vue';
|
|
2
|
+
import type { FormOptionValueRenderContext, ResolvedFormOption } from '../../types/index.js';
|
|
3
|
+
/**
|
|
4
|
+
* Draws the chosen option of an auto-complete over the text of its input, while the field rests.
|
|
5
|
+
* The input holds plain text, so a `renderValue` result or a suffix after the label can only sit
|
|
6
|
+
* on top of it: the input keeps its own text (made transparent by the field while `active`), its
|
|
7
|
+
* selection and its focus, and the overlay copies the input's padding and type so the value starts
|
|
8
|
+
* where the text would. It ignores the pointer, and is hidden from assistive technology because
|
|
9
|
+
* the input already announces the label.
|
|
10
|
+
*/
|
|
11
|
+
type __VLS_Props = {
|
|
12
|
+
/** The chosen option, or none. */
|
|
13
|
+
option?: ResolvedFormOption;
|
|
14
|
+
render?: (context: FormOptionValueRenderContext) => VNodeChild;
|
|
15
|
+
/** True while the overlay stands in for the text of the input. */
|
|
16
|
+
active: boolean;
|
|
17
|
+
};
|
|
18
|
+
declare var __VLS_1: {};
|
|
19
|
+
type __VLS_Slots = {} & {
|
|
20
|
+
default?: (props: typeof __VLS_1) => any;
|
|
21
|
+
};
|
|
22
|
+
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
23
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
24
|
+
declare const _default: typeof __VLS_export;
|
|
25
|
+
export default _default;
|
|
26
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
27
|
+
new (): {
|
|
28
|
+
$slots: S;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { FormControlUi, FormOptionRuntimeState, ResolvedFormOption } from '../types/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* Items for the Nuxt UI radio and checkbox groups of a field whose options carry more than a
|
|
4
|
+
* label. The group gets the plain parts of each option only: the leading visual, the suffix and a
|
|
5
|
+
* custom render are drawn in its label slot (`optionOf` finds the resolved option behind a slot
|
|
6
|
+
* item), and the description sits under the label, lined up with it. Nothing else of the option
|
|
7
|
+
* reaches the group, whose own `icon` is the check mark of a checkbox.
|
|
8
|
+
*/
|
|
9
|
+
export declare function useChoiceGroupItems<TValue extends string | ResolvedFormOption['value']>(params: {
|
|
10
|
+
/** True when a `renderOption` function owns the content of the options. */
|
|
11
|
+
custom: () => boolean;
|
|
12
|
+
options: FormOptionRuntimeState;
|
|
13
|
+
ui: () => FormControlUi | undefined;
|
|
14
|
+
/** The value the group knows an option by. */
|
|
15
|
+
valueOf: (option: ResolvedFormOption) => TValue;
|
|
16
|
+
}): {
|
|
17
|
+
items: import("vue").ComputedRef<{
|
|
18
|
+
description: string | undefined;
|
|
19
|
+
disabled: boolean | undefined;
|
|
20
|
+
label: string;
|
|
21
|
+
ui: {
|
|
22
|
+
description: string;
|
|
23
|
+
} | undefined;
|
|
24
|
+
value: TValue;
|
|
25
|
+
}[]>;
|
|
26
|
+
optionOf: (key: string) => ResolvedFormOption;
|
|
27
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { computed } from "vue";
|
|
2
|
+
import { formOptionKey, resolveOptionDescriptionIndent } from "../utils/options.js";
|
|
3
|
+
import { mergeFormUiClass } from "../utils/ui.js";
|
|
4
|
+
export function useChoiceGroupItems(params) {
|
|
5
|
+
const optionByKey = computed(
|
|
6
|
+
() => new Map(params.options.items.value.map((option) => [formOptionKey(option.value), option]))
|
|
7
|
+
);
|
|
8
|
+
const items = computed(
|
|
9
|
+
() => params.options.items.value.map((option) => {
|
|
10
|
+
const indent = params.custom() ? void 0 : resolveOptionDescriptionIndent(option);
|
|
11
|
+
return {
|
|
12
|
+
description: params.custom() ? void 0 : option.description,
|
|
13
|
+
disabled: option.disabled,
|
|
14
|
+
label: option.label,
|
|
15
|
+
ui: indent ? { description: mergeFormUiClass(params.ui()?.description, indent) } : void 0,
|
|
16
|
+
value: params.valueOf(option)
|
|
17
|
+
};
|
|
18
|
+
})
|
|
19
|
+
);
|
|
20
|
+
function optionOf(key) {
|
|
21
|
+
return optionByKey.value.get(key) ?? { label: key, value: key };
|
|
22
|
+
}
|
|
23
|
+
return { items, optionOf };
|
|
24
|
+
}
|
|
@@ -28,17 +28,17 @@ export declare function useFieldControl<TField extends FormField>(field: () => T
|
|
|
28
28
|
interactionOwnerClass: import("vue").ComputedRef<string>;
|
|
29
29
|
options: {
|
|
30
30
|
activate: () => void;
|
|
31
|
-
add: (option: FormValue) => import("../
|
|
31
|
+
add: (option: FormValue) => import("../types/index.js").ResolvedFormOption;
|
|
32
32
|
creatable: import("vue").ComputedRef<boolean>;
|
|
33
|
-
create: (label?: string) => Promise<import("../
|
|
33
|
+
create: (label?: string) => Promise<import("../types/index.js").ResolvedFormOption | null>;
|
|
34
34
|
createLabel: import("vue").ComputedRef<string | undefined>;
|
|
35
35
|
creating: import("vue").ComputedRef<boolean>;
|
|
36
36
|
disableOnLoading: import("vue").ComputedRef<boolean>;
|
|
37
37
|
error: import("vue").ComputedRef<unknown>;
|
|
38
38
|
fetching: import("vue").ComputedRef<boolean>;
|
|
39
39
|
hasMore: import("vue").ComputedRef<boolean>;
|
|
40
|
-
items: import("vue").ComputedRef<readonly import("../
|
|
41
|
-
loadChildren: (option: import("../
|
|
40
|
+
items: import("vue").ComputedRef<readonly import("../types/index.js").ResolvedFormOption[]>;
|
|
41
|
+
loadChildren: (option: import("../types/index.js").ResolvedFormOption) => Promise<void>;
|
|
42
42
|
loadMore: () => Promise<void>;
|
|
43
43
|
loading: import("vue").ComputedRef<boolean>;
|
|
44
44
|
loadingMore: import("vue").ComputedRef<boolean>;
|
|
@@ -51,11 +51,11 @@ export declare function useFieldControl<TField extends FormField>(field: () => T
|
|
|
51
51
|
retryable: import("vue").ComputedRef<boolean>;
|
|
52
52
|
search: import("vue").ComputedRef<string>;
|
|
53
53
|
selectCreatedOption: import("vue").ComputedRef<boolean>;
|
|
54
|
-
selectedItems: import("vue").ComputedRef<readonly import("../
|
|
54
|
+
selectedItems: import("vue").ComputedRef<readonly import("../types/index.js").ResolvedFormOption[]>;
|
|
55
55
|
setSearch: (term: string) => void;
|
|
56
56
|
};
|
|
57
57
|
params: import("vue").ComputedRef<import("../types/index.js").FormFieldCallbackParams<{}, import("../types/index.js").FormDependencies, unknown, unknown>>;
|
|
58
|
-
placeholder: import("vue").ComputedRef<string>;
|
|
58
|
+
placeholder: import("vue").ComputedRef<string | undefined>;
|
|
59
59
|
validationPending: import("vue").ComputedRef<boolean>;
|
|
60
60
|
};
|
|
61
61
|
export {};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { watchWithFilter } from "@vueuse/core";
|
|
2
2
|
import { computed, onScopeDispose } from "vue";
|
|
3
|
-
import { useUiToolsLocale } from "../../i18n/use-locale.js";
|
|
4
3
|
import { isEqualFormValue } from "../utils/compare.js";
|
|
4
|
+
import { isFieldDisabledByCallback } from "../utils/disabled.js";
|
|
5
5
|
import { createFormFieldInstance } from "../utils/field-instance.js";
|
|
6
6
|
import { cloneFormValue } from "../utils/path.js";
|
|
7
|
-
import { isFunction,
|
|
7
|
+
import { isFunction, isObject, isString } from "../utils/predicate.js";
|
|
8
|
+
import { resolveFieldText } from "../utils/text.js";
|
|
8
9
|
import { mergeFormUiClass } from "../utils/ui.js";
|
|
9
10
|
import { useFieldOptions } from "./use-field-options.js";
|
|
10
11
|
import { useFormFieldControlAttrs } from "./use-form-field-chrome.js";
|
|
@@ -24,7 +25,6 @@ export function useResolvedFieldProps(field, path) {
|
|
|
24
25
|
export function useFieldControl(field, path, controlOptions = {}) {
|
|
25
26
|
const form = useFormRuntimeContext();
|
|
26
27
|
const formUi = useFormUi();
|
|
27
|
-
const { t } = useUiToolsLocale();
|
|
28
28
|
const fieldControlAttrs = useFormFieldControlAttrs();
|
|
29
29
|
const api = computed(() => form.getFieldApi(path(), field()));
|
|
30
30
|
const params = computed(() => form.getFieldCallbackParams(path(), field()));
|
|
@@ -73,24 +73,12 @@ export function useFieldControl(field, path, controlOptions = {}) {
|
|
|
73
73
|
const value = controlProps.value.size;
|
|
74
74
|
return isFormControlSize(value) ? value : formUi.controlSize.value;
|
|
75
75
|
});
|
|
76
|
-
const disabled = computed(
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
const placeholder = computed(() => {
|
|
83
|
-
const current = field();
|
|
84
|
-
const value = Object.getOwnPropertyDescriptor(current, "placeholder")?.value;
|
|
85
|
-
if (isFunction(value)) {
|
|
86
|
-
const resolved = value(params.value);
|
|
87
|
-
return isString(resolved) || isNumber(resolved) ? String(resolved) : t("form.fields.text.defaultPlaceholder");
|
|
88
|
-
}
|
|
89
|
-
if (isString(value) || isNumber(value)) {
|
|
90
|
-
return String(value);
|
|
91
|
-
}
|
|
92
|
-
return t("form.fields.text.defaultPlaceholder");
|
|
93
|
-
});
|
|
76
|
+
const disabled = computed(
|
|
77
|
+
() => isFieldDisabledByCallback(field(), params.value) || form.actionPending.value !== null || options.disableOnLoading.value && options.loading.value
|
|
78
|
+
);
|
|
79
|
+
const placeholder = computed(
|
|
80
|
+
() => resolveFieldText(Object.getOwnPropertyDescriptor(field(), "placeholder")?.value, params.value)
|
|
81
|
+
);
|
|
94
82
|
let lastValue = cloneFormValue(form.getValue(path()));
|
|
95
83
|
watchWithFilter(
|
|
96
84
|
() => form.getValue(path()),
|
|
@@ -6,7 +6,9 @@ import {
|
|
|
6
6
|
mergeResolvedOptions,
|
|
7
7
|
normalizeOptionItem,
|
|
8
8
|
normalizeOptionItems,
|
|
9
|
-
normalizeOptionSelection
|
|
9
|
+
normalizeOptionSelection,
|
|
10
|
+
readOptionSource,
|
|
11
|
+
resolveOptionGroupKey
|
|
10
12
|
} from "../utils/options.js";
|
|
11
13
|
import { isRecord, relativePathSegments } from "../utils/path.js";
|
|
12
14
|
import {
|
|
@@ -31,7 +33,10 @@ export function useFieldOptions(params) {
|
|
|
31
33
|
const promiseResolution = shallowRef(null);
|
|
32
34
|
const creating = ref(false);
|
|
33
35
|
const remoteConfig = computed(() => resolveRemoteOptionConfig(params.field()));
|
|
34
|
-
const optionKeys = computed(() =>
|
|
36
|
+
const optionKeys = computed(() => ({
|
|
37
|
+
...resolveOptionKeys(params.field()),
|
|
38
|
+
group: resolveOptionGroupKey(params.field())
|
|
39
|
+
}));
|
|
35
40
|
const remote = useRemoteFieldOptions({
|
|
36
41
|
api: params.api,
|
|
37
42
|
callbackParams: params.callbackParams,
|
|
@@ -389,8 +394,7 @@ function resolveOptionSource(field, params) {
|
|
|
389
394
|
if (!createFormFieldInstance(field).capability.has("options")) {
|
|
390
395
|
return [];
|
|
391
396
|
}
|
|
392
|
-
const
|
|
393
|
-
const source = isRecord(options) && "source" in options ? options.source : options;
|
|
397
|
+
const source = readOptionSource(field);
|
|
394
398
|
return isFunction(source) ? source(params) : source;
|
|
395
399
|
}
|
|
396
400
|
function emptyTrackedOptionSource() {
|
|
@@ -30,9 +30,10 @@ export function useFormItemLayout(params) {
|
|
|
30
30
|
),
|
|
31
31
|
normalizeFormGridColumnSpanStyle
|
|
32
32
|
);
|
|
33
|
-
const style = computed(
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
const style = computed(() => {
|
|
34
|
+
const spanStyle = span.value ?? normalizeFormGridColumnSpanStyle(String(FORM_LAYOUT_DEFAULTS.fieldSpan));
|
|
35
|
+
return params.layout()?.newRow ? `${spanStyle}; grid-column-start: 1` : spanStyle;
|
|
36
|
+
});
|
|
36
37
|
return {
|
|
37
38
|
span,
|
|
38
39
|
style
|