nuxt-ui-tools 0.1.0 → 0.1.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/dist/module.d.mts +4 -0
- package/dist/module.json +1 -1
- package/dist/module.mjs +30 -15
- package/dist/runtime/form/components/actions/FormActions.d.vue.ts +0 -2
- package/dist/runtime/form/components/actions/FormActions.vue +5 -8
- package/dist/runtime/form/components/actions/FormActions.vue.d.ts +0 -2
- package/dist/runtime/form/components/layout/DrawerLayout.vue +5 -1
- package/dist/runtime/form/components/layout/ModalLayout.vue +5 -1
- package/dist/runtime/form/components/renderer/FormCompositeControl.d.vue.ts +15 -0
- package/dist/runtime/form/components/renderer/FormCompositeControl.vue +13 -0
- package/dist/runtime/form/components/renderer/FormCompositeControl.vue.d.ts +15 -0
- package/dist/runtime/form/components/renderer/FormFieldRenderer.d.vue.ts +1 -0
- package/dist/runtime/form/components/renderer/FormFieldRenderer.vue +19 -3
- package/dist/runtime/form/components/renderer/FormFieldRenderer.vue.d.ts +1 -0
- package/dist/runtime/form/components/renderer/FormFieldShell.d.vue.ts +4 -4
- package/dist/runtime/form/components/renderer/FormFieldShell.vue +15 -1
- package/dist/runtime/form/components/renderer/FormFieldShell.vue.d.ts +4 -4
- package/dist/runtime/form/components/root/Form.d.vue.ts +2 -2
- package/dist/runtime/form/components/root/Form.vue +5 -3
- package/dist/runtime/form/components/root/Form.vue.d.ts +2 -2
- package/dist/runtime/form/composables/use-field-control.d.ts +1 -1
- package/dist/runtime/form/composables/use-field-control.js +4 -0
- package/dist/runtime/form/composables/use-field-options.d.ts +1 -1
- package/dist/runtime/form/composables/use-field-options.js +75 -31
- package/dist/runtime/form/composables/use-form-field-chrome.d.ts +3 -0
- package/dist/runtime/form/composables/use-form-field-chrome.js +9 -0
- package/dist/runtime/form/composables/use-form-runtime.js +17 -5
- package/dist/runtime/form/fields/array-list/component.vue +4 -1
- package/dist/runtime/form/fields/auto-complete/component.vue +23 -16
- package/dist/runtime/form/fields/checkbox-card/component.vue +28 -29
- package/dist/runtime/form/fields/checkbox-group/component.vue +28 -29
- package/dist/runtime/form/fields/color-picker/component.vue +4 -2
- package/dist/runtime/form/fields/date-family/component.vue +9 -4
- package/dist/runtime/form/fields/hierarchy/SelectionCheckbox.d.vue.ts +13 -0
- package/dist/runtime/form/fields/hierarchy/SelectionCheckbox.vue +24 -0
- package/dist/runtime/form/fields/hierarchy/SelectionCheckbox.vue.d.ts +13 -0
- package/dist/runtime/form/fields/hierarchy/SelectionRadio.d.vue.ts +14 -0
- package/dist/runtime/form/fields/hierarchy/SelectionRadio.vue +27 -0
- package/dist/runtime/form/fields/hierarchy/SelectionRadio.vue.d.ts +14 -0
- package/dist/runtime/form/fields/hierarchy/component.vue +257 -142
- package/dist/runtime/form/fields/hierarchy/utils.d.ts +9 -0
- package/dist/runtime/form/fields/hierarchy/utils.js +32 -0
- package/dist/runtime/form/fields/input-group/component.vue +7 -30
- package/dist/runtime/form/fields/matrix/component.vue +9 -3
- package/dist/runtime/form/fields/phone-number/component.vue +7 -2
- package/dist/runtime/form/fields/rating/component.vue +25 -2
- package/dist/runtime/form/fields/select/component.vue +29 -21
- package/dist/runtime/form/fields/switch-group/component.vue +8 -3
- package/dist/runtime/form/fields/time/component.vue +7 -5
- package/dist/runtime/form/fields/upload/component.vue +5 -3
- package/dist/runtime/form/types/api.d.ts +9 -3
- package/dist/runtime/form/types/field-base.d.ts +3 -1
- package/dist/runtime/form/types/runtime.d.ts +2 -0
- package/dist/runtime/form/types/ui.d.ts +1 -0
- package/dist/runtime/form/utils/api.js +3 -0
- package/dist/runtime/form/utils/options.d.ts +11 -2
- package/dist/runtime/form/utils/options.js +57 -9
- package/dist/runtime/form/utils/state.js +10 -2
- package/dist/runtime/i18n/locales/en.js +38 -0
- package/dist/runtime/i18n/locales/fr.js +38 -0
- package/dist/runtime/i18n/types.d.ts +38 -0
- package/dist/runtime/i18n/use-locale.d.ts +2 -2
- package/dist/runtime/i18n/use-locale.js +3 -3
- package/dist/runtime/spreadsheet/components/layout/SpreadsheetImportFooter.d.vue.ts +2 -2
- package/dist/runtime/spreadsheet/components/layout/SpreadsheetImportFooter.vue.d.ts +2 -2
- package/dist/runtime/spreadsheet/components/steps/review/SpreadsheetReviewInspection.d.vue.ts +2 -2
- package/dist/runtime/spreadsheet/components/steps/review/SpreadsheetReviewInspection.vue.d.ts +2 -2
- package/dist/runtime/spreadsheet/composables/use-spreadsheet-internals.d.ts +15 -15
- package/dist/runtime/spreadsheet/composables/use-spreadsheet-resolutions.d.ts +2 -2
- package/dist/runtime/spreadsheet/schema/normalize.d.ts +1 -1
- package/dist/runtime/spreadsheet/utils/references/sources.d.ts +1 -1
- package/dist/runtime/table/components/DataList.d.vue.ts +2 -0
- package/dist/runtime/table/components/DataList.vue.d.ts +2 -0
- package/dist/runtime/table/components/actions/RowActions.d.vue.ts +4 -2
- package/dist/runtime/table/components/actions/RowActions.vue +2 -0
- package/dist/runtime/table/components/actions/RowActions.vue.d.ts +4 -2
- package/dist/runtime/table/components/data-list/DataListAddFilter.d.vue.ts +5 -3
- package/dist/runtime/table/components/data-list/DataListAddFilter.vue +6 -1
- package/dist/runtime/table/components/data-list/DataListAddFilter.vue.d.ts +5 -3
- package/dist/runtime/table/components/data-list/DataListContent.d.vue.ts +24 -17
- package/dist/runtime/table/components/data-list/DataListContent.vue +70 -17
- package/dist/runtime/table/components/data-list/DataListContent.vue.d.ts +24 -17
- package/dist/runtime/table/components/data-list/DataListDefault.d.vue.ts +2 -0
- package/dist/runtime/table/components/data-list/DataListDefault.vue.d.ts +2 -0
- package/dist/runtime/table/components/data-list/DataListFilterTags.d.vue.ts +2 -0
- package/dist/runtime/table/components/data-list/DataListFilterTags.vue.d.ts +2 -0
- package/dist/runtime/table/components/data-list/DataListInfiniteLoader.d.vue.ts +1 -1
- package/dist/runtime/table/components/data-list/DataListInfiniteLoader.vue.d.ts +1 -1
- package/dist/runtime/table/components/data-list/DataListLayoutSwitch.vue +17 -11
- package/dist/runtime/table/components/data-list/DataListPagination.d.vue.ts +1 -1
- package/dist/runtime/table/components/data-list/DataListPagination.vue.d.ts +1 -1
- package/dist/runtime/table/components/data-list/DataListRoot.vue +2 -46
- package/dist/runtime/table/components/data-list/DataListSortMenu.d.vue.ts +1 -1
- package/dist/runtime/table/components/data-list/DataListSortMenu.vue +6 -0
- package/dist/runtime/table/components/data-list/DataListSortMenu.vue.d.ts +1 -1
- package/dist/runtime/table/components/filters/shared/DynamicFilterPicker.d.vue.ts +5 -0
- package/dist/runtime/table/components/filters/shared/DynamicFilterPicker.vue +182 -59
- package/dist/runtime/table/components/filters/shared/DynamicFilterPicker.vue.d.ts +5 -0
- package/dist/runtime/table/components/filters/shared/FilterMatchModeButton.d.vue.ts +3 -1
- package/dist/runtime/table/components/filters/shared/FilterMatchModeButton.vue +29 -5
- package/dist/runtime/table/components/filters/shared/FilterMatchModeButton.vue.d.ts +3 -1
- package/dist/runtime/table/components/filters/shared/FilterMatchModePanel.d.vue.ts +17 -0
- package/dist/runtime/table/components/filters/shared/FilterMatchModePanel.vue +47 -0
- package/dist/runtime/table/components/filters/shared/FilterMatchModePanel.vue.d.ts +17 -0
- package/dist/runtime/table/components/filters/shared/FilterOptionMultipleList.d.vue.ts +3 -1
- package/dist/runtime/table/components/filters/shared/FilterOptionMultipleList.vue +12 -3
- package/dist/runtime/table/components/filters/shared/FilterOptionMultipleList.vue.d.ts +3 -1
- package/dist/runtime/table/components/filters/shared/FilterOptionPickerContent.d.vue.ts +3 -0
- package/dist/runtime/table/components/filters/shared/FilterOptionPickerContent.vue +11 -1
- package/dist/runtime/table/components/filters/shared/FilterOptionPickerContent.vue.d.ts +3 -0
- package/dist/runtime/table/components/filters/shared/FilterOptionRow.d.vue.ts +3 -0
- package/dist/runtime/table/components/filters/shared/FilterOptionRow.vue +48 -9
- package/dist/runtime/table/components/filters/shared/FilterOptionRow.vue.d.ts +3 -0
- package/dist/runtime/table/components/filters/shared/FilterOptionSingleList.d.vue.ts +3 -0
- package/dist/runtime/table/components/filters/shared/FilterOptionSingleList.vue +35 -9
- package/dist/runtime/table/components/filters/shared/FilterOptionSingleList.vue.d.ts +3 -0
- package/dist/runtime/table/components/filters/shared/FilterOptionTreeContent.d.vue.ts +3 -0
- package/dist/runtime/table/components/filters/shared/FilterOptionTreeContent.vue +77 -20
- package/dist/runtime/table/components/filters/shared/FilterOptionTreeContent.vue.d.ts +3 -0
- package/dist/runtime/table/components/filters/shared/FilterPopoverShell.d.vue.ts +27 -0
- package/dist/runtime/table/components/filters/shared/FilterPopoverShell.vue +36 -0
- package/dist/runtime/table/components/filters/shared/FilterPopoverShell.vue.d.ts +27 -0
- package/dist/runtime/table/components/filters/shared/FilterSearchablePanel.d.vue.ts +3 -0
- package/dist/runtime/table/components/filters/shared/FilterSearchablePanel.vue +40 -10
- package/dist/runtime/table/components/filters/shared/FilterSearchablePanel.vue.d.ts +3 -0
- package/dist/runtime/table/components/filters/shared/FilterStageTransition.d.vue.ts +23 -0
- package/dist/runtime/table/components/filters/shared/FilterStageTransition.vue +21 -0
- package/dist/runtime/table/components/filters/shared/FilterStageTransition.vue.d.ts +23 -0
- package/dist/runtime/table/components/filters/shared/FilterTriggerTag.d.vue.ts +3 -2
- package/dist/runtime/table/components/filters/shared/FilterTriggerTag.vue +26 -25
- package/dist/runtime/table/components/filters/shared/FilterTriggerTag.vue.d.ts +3 -2
- package/dist/runtime/table/components/filters/tags/BooleanFilterTag.d.vue.ts +1 -1
- package/dist/runtime/table/components/filters/tags/BooleanFilterTag.vue +75 -22
- package/dist/runtime/table/components/filters/tags/BooleanFilterTag.vue.d.ts +1 -1
- package/dist/runtime/table/components/filters/tags/DateFilterTag.d.vue.ts +3 -1
- package/dist/runtime/table/components/filters/tags/DateFilterTag.vue +254 -160
- package/dist/runtime/table/components/filters/tags/DateFilterTag.vue.d.ts +3 -1
- package/dist/runtime/table/components/filters/tags/FilterTagsBar.d.vue.ts +7 -6
- package/dist/runtime/table/components/filters/tags/FilterTagsBar.vue +12 -27
- package/dist/runtime/table/components/filters/tags/FilterTagsBar.vue.d.ts +7 -6
- package/dist/runtime/table/components/filters/tags/NumberFilterTag.d.vue.ts +3 -2
- package/dist/runtime/table/components/filters/tags/NumberFilterTag.vue +192 -106
- package/dist/runtime/table/components/filters/tags/NumberFilterTag.vue.d.ts +3 -2
- package/dist/runtime/table/components/filters/tags/OptionFilterTag.d.vue.ts +3 -2
- package/dist/runtime/table/components/filters/tags/OptionFilterTag.vue +110 -48
- package/dist/runtime/table/components/filters/tags/OptionFilterTag.vue.d.ts +3 -2
- package/dist/runtime/table/components/filters/tags/TextFilterTag.d.vue.ts +3 -2
- package/dist/runtime/table/components/filters/tags/TextFilterTag.vue +120 -57
- package/dist/runtime/table/components/filters/tags/TextFilterTag.vue.d.ts +3 -2
- package/dist/runtime/table/components/grid/GridRenderer.vue +1 -1
- package/dist/runtime/table/components/layout/TableFooter.d.vue.ts +1 -1
- package/dist/runtime/table/components/layout/TableFooter.vue +1 -0
- package/dist/runtime/table/components/layout/TableFooter.vue.d.ts +1 -1
- package/dist/runtime/table/components/table/TableCellEllipsis.d.ts +1 -1
- package/dist/runtime/table/components/table/TableRenderer.vue +24 -12
- package/dist/runtime/table/composables/use-filter-tag-session.d.ts +3 -4
- package/dist/runtime/table/composables/use-filter-tag-session.js +12 -32
- package/dist/runtime/table/composables/use-query-state.d.ts +5 -5
- package/dist/runtime/table/composables/use-query-state.js +7 -32
- package/dist/runtime/table/composables/use-table-api.js +2 -2
- package/dist/runtime/table/composables/use-table-columns.d.ts +4 -14
- package/dist/runtime/table/composables/use-table-filter-presentation.d.ts +0 -3
- package/dist/runtime/table/composables/use-table-filter-presentation.js +0 -9
- package/dist/runtime/table/composables/use-table-filters.js +18 -7
- package/dist/runtime/table/composables/use-table-internals.d.ts +24 -63
- package/dist/runtime/table/composables/use-table-pagination.d.ts +2 -2
- package/dist/runtime/table/composables/use-table-state.d.ts +2 -2
- package/dist/runtime/table/types/actions.d.ts +1 -1
- package/dist/runtime/table/types/data-list.d.ts +41 -8
- package/dist/runtime/table/types/filters.d.ts +4 -0
- package/dist/runtime/table/utils/actions.d.ts +1 -1
- package/dist/runtime/table/utils/columns/menu.d.ts +2 -11
- package/dist/runtime/table/utils/columns/render.d.ts +2 -9
- package/dist/runtime/table/utils/columns/render.js +39 -30
- package/dist/runtime/table/utils/columns/state.d.ts +1 -1
- package/dist/runtime/table/utils/data-list-ui.d.ts +3 -1
- package/dist/runtime/table/utils/data-list-ui.js +45 -0
- package/dist/runtime/table/utils/filters/editor-size.d.ts +11 -0
- package/dist/runtime/table/utils/filters/editor-size.js +45 -0
- package/dist/runtime/table/utils/filters/index.d.ts +1 -1
- package/dist/runtime/table/utils/filters/index.js +1 -1
- package/dist/runtime/table/utils/query-state.d.ts +18 -1
- package/dist/runtime/table/utils/query-state.js +109 -0
- package/package.json +4 -2
- package/dist/runtime/table/utils/filters/operators.d.ts +0 -4
- package/dist/runtime/table/utils/filters/operators.js +0 -6
package/dist/module.d.mts
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import * as _nuxt_schema from '@nuxt/schema';
|
|
2
|
+
import { ModuleOptions as ModuleOptions$1 } from 'nuxt-viewport';
|
|
2
3
|
import { FormUiConfig } from '../dist/runtime/form/types/index.js';
|
|
3
4
|
import { DataListUiConfig } from '../dist/runtime/table/types/index.js';
|
|
4
5
|
|
|
5
6
|
declare module '@nuxt/schema' {
|
|
7
|
+
interface NuxtOptions {
|
|
8
|
+
viewport: ModuleOptions$1 | false;
|
|
9
|
+
}
|
|
6
10
|
interface AppConfigInput {
|
|
7
11
|
nuxtUiTools?: {
|
|
8
12
|
dataList?: DataListUiConfig;
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { createRequire } from 'node:module';
|
|
2
|
+
import { join, dirname } from 'node:path';
|
|
1
3
|
import { addComponent, addImports, logger, addTemplate, defineNuxtModule, createResolver, installModule } from '@nuxt/kit';
|
|
2
4
|
import { breakpointsTailwind } from '@vueuse/core';
|
|
3
5
|
|
|
@@ -154,16 +156,9 @@ const viewportDefaults = {
|
|
|
154
156
|
fallbackBreakpoint: "lg",
|
|
155
157
|
feature: "minWidth"
|
|
156
158
|
};
|
|
157
|
-
const optimizeDepsInclude = [
|
|
158
|
-
"@tanstack/vue-query",
|
|
159
|
-
"@tanstack/vue-virtual",
|
|
160
|
-
"@vueuse/core",
|
|
161
|
-
"@internationalized/date",
|
|
162
|
-
"motion-v",
|
|
163
|
-
"tailwind-merge",
|
|
164
|
-
"vue-draggable-plus"
|
|
165
|
-
];
|
|
166
159
|
const publicRuntimeDomains = ["form", "i18n", "query-state", "shared", "table"];
|
|
160
|
+
const require$1 = createRequire(import.meta.url);
|
|
161
|
+
const cookieEsmPath = join(dirname(require$1.resolve("cookiejs/package.json")), "dist/cookie.esm.js");
|
|
167
162
|
const module$1 = defineNuxtModule({
|
|
168
163
|
defaults: {
|
|
169
164
|
prefix: "Ui",
|
|
@@ -187,13 +182,31 @@ const module$1 = defineNuxtModule({
|
|
|
187
182
|
},
|
|
188
183
|
async setup(options, nuxt) {
|
|
189
184
|
const { resolve } = createResolver(import.meta.url);
|
|
185
|
+
const consumerRequire = createRequire(join(nuxt.options.rootDir, "package.json"));
|
|
186
|
+
const nuxtUiComponentsDir = dirname(consumerRequire.resolve("@nuxt/ui/components/Button.vue"));
|
|
187
|
+
const nuxtUiRuntimeDir = dirname(nuxtUiComponentsDir);
|
|
188
|
+
const nuxtUiRequire = createRequire(join(nuxtUiRuntimeDir, "package.json"));
|
|
189
|
+
const internationalizedDateDir = dirname(
|
|
190
|
+
dirname(nuxtUiRequire.resolve("@internationalized/date"))
|
|
191
|
+
);
|
|
190
192
|
for (const domain of publicRuntimeDomains)
|
|
191
193
|
nuxt.options.alias[`#ui-tools/${domain}`] = resolve(`./runtime/${domain}`);
|
|
194
|
+
nuxt.options.alias["@nuxt/ui/components"] ??= nuxtUiComponentsDir;
|
|
195
|
+
nuxt.options.alias["@nuxt/ui/composables"] ??= join(nuxtUiRuntimeDir, "composables");
|
|
196
|
+
nuxt.options.alias["@nuxt/ui/runtime"] ??= nuxtUiRuntimeDir;
|
|
197
|
+
nuxt.options.alias["@internationalized/date"] ??= internationalizedDateDir;
|
|
198
|
+
nuxt.options.typescript.tsConfig ??= {};
|
|
199
|
+
nuxt.options.typescript.sharedTsConfig ??= {};
|
|
200
|
+
nuxt.options.typescript.nodeTsConfig ??= {};
|
|
201
|
+
setupJsxCompilerOptions(nuxt.options.typescript.tsConfig);
|
|
202
|
+
setupJsxCompilerOptions(nuxt.options.typescript.sharedTsConfig);
|
|
203
|
+
setupJsxCompilerOptions(nuxt.options.typescript.nodeTsConfig);
|
|
192
204
|
nuxt.options.vite ??= {};
|
|
193
|
-
nuxt.options.vite.
|
|
194
|
-
nuxt.options.vite.
|
|
195
|
-
nuxt.options.vite.
|
|
196
|
-
|
|
205
|
+
nuxt.options.vite.resolve ??= {};
|
|
206
|
+
nuxt.options.vite.resolve.dedupe = [
|
|
207
|
+
.../* @__PURE__ */ new Set([...nuxt.options.vite.resolve.dedupe ?? [], "@nuxt/ui"])
|
|
208
|
+
];
|
|
209
|
+
nuxt.options.alias.cookiejs ??= cookieEsmPath;
|
|
197
210
|
const viewportOptions = normalizeViewportOptions(nuxt.options.viewport);
|
|
198
211
|
nuxt.options.viewport = viewportOptions;
|
|
199
212
|
await installModule("nuxt-viewport", viewportOptions);
|
|
@@ -221,8 +234,10 @@ function normalizeViewportOptions(viewportOptions) {
|
|
|
221
234
|
if (viewportOptions === false) return mergeViewportOptions(void 0);
|
|
222
235
|
return mergeViewportOptions(viewportOptions);
|
|
223
236
|
}
|
|
224
|
-
function
|
|
225
|
-
|
|
237
|
+
function setupJsxCompilerOptions(config) {
|
|
238
|
+
config.compilerOptions ??= {};
|
|
239
|
+
config.compilerOptions.jsx = "preserve";
|
|
240
|
+
config.compilerOptions.jsxImportSource = "vue";
|
|
226
241
|
}
|
|
227
242
|
|
|
228
243
|
export { module$1 as default };
|
|
@@ -5,10 +5,8 @@ type __VLS_Props = {
|
|
|
5
5
|
};
|
|
6
6
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
7
7
|
cancel: () => any;
|
|
8
|
-
submit: () => any;
|
|
9
8
|
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
10
9
|
onCancel?: (() => any) | undefined;
|
|
11
|
-
onSubmit?: (() => any) | undefined;
|
|
12
10
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
13
11
|
declare const _default: typeof __VLS_export;
|
|
14
12
|
export default _default;
|
|
@@ -11,7 +11,7 @@ const props = defineProps({
|
|
|
11
11
|
actions: { type: Array, required: true }
|
|
12
12
|
});
|
|
13
13
|
const formUi = useFormUi();
|
|
14
|
-
const emit = defineEmits(["
|
|
14
|
+
const emit = defineEmits(["cancel"]);
|
|
15
15
|
const actionContext = computed(() => ({
|
|
16
16
|
currentStep: props.runtime.currentStepIndex.value,
|
|
17
17
|
api: createPublicFormApi(props.runtime),
|
|
@@ -30,10 +30,7 @@ const actionsRight = computed(
|
|
|
30
30
|
() => visibleActions.value.filter((action) => resolveActionSlot(action) !== "left")
|
|
31
31
|
);
|
|
32
32
|
async function runAction(action) {
|
|
33
|
-
if (isBuiltInAction(action, "submit"))
|
|
34
|
-
emit("submit");
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
33
|
+
if (isBuiltInAction(action, "submit")) return;
|
|
37
34
|
if (isBuiltInAction(action, "next")) {
|
|
38
35
|
await props.runtime.nextStep();
|
|
39
36
|
return;
|
|
@@ -93,7 +90,7 @@ function resolveActionVariant(action) {
|
|
|
93
90
|
}
|
|
94
91
|
function actionButtonClass(action) {
|
|
95
92
|
return mergeFormUiClass(
|
|
96
|
-
resolveActionWidth(action) === "fill" ? "flex-1" : void 0,
|
|
93
|
+
resolveActionWidth(action) === "fill" ? "flex-1 justify-center" : void 0,
|
|
97
94
|
formUi.ui.value.actions?.ui?.button,
|
|
98
95
|
action.class
|
|
99
96
|
);
|
|
@@ -127,7 +124,7 @@ function isBuiltInActionKey(value) {
|
|
|
127
124
|
<UButton
|
|
128
125
|
v-for="(action, index) in actionsLeft"
|
|
129
126
|
:key="action.key ?? index"
|
|
130
|
-
type="button"
|
|
127
|
+
:type="isBuiltInAction(action, 'submit') ? 'submit' : 'button'"
|
|
131
128
|
:to="resolveActionLink(action)"
|
|
132
129
|
:label="resolveActionLabel(action)"
|
|
133
130
|
:icon="action.icon === false ? void 0 : action.icon"
|
|
@@ -154,7 +151,7 @@ function isBuiltInActionKey(value) {
|
|
|
154
151
|
<UButton
|
|
155
152
|
v-for="(action, index) in actionsRight"
|
|
156
153
|
:key="action.key ?? index"
|
|
157
|
-
type="button"
|
|
154
|
+
:type="isBuiltInAction(action, 'submit') ? 'submit' : 'button'"
|
|
158
155
|
:to="resolveActionLink(action)"
|
|
159
156
|
:label="resolveActionLabel(action)"
|
|
160
157
|
:icon="action.icon === false ? void 0 : action.icon"
|
|
@@ -5,10 +5,8 @@ type __VLS_Props = {
|
|
|
5
5
|
};
|
|
6
6
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
7
7
|
cancel: () => any;
|
|
8
|
-
submit: () => any;
|
|
9
8
|
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
10
9
|
onCancel?: (() => any) | undefined;
|
|
11
|
-
onSubmit?: (() => any) | undefined;
|
|
12
10
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
13
11
|
declare const _default: typeof __VLS_export;
|
|
14
12
|
export default _default;
|
|
@@ -17,6 +17,10 @@ const contentStyle = computed(() => ({
|
|
|
17
17
|
height: cssSize(props.config?.height),
|
|
18
18
|
resize: props.config?.resizable ? ["top", "bottom"].includes(direction.value) ? "vertical" : "horizontal" : void 0
|
|
19
19
|
}));
|
|
20
|
+
const contentProps = computed(() => ({
|
|
21
|
+
disableOutsidePointerEvents: void 0,
|
|
22
|
+
style: contentStyle.value
|
|
23
|
+
}));
|
|
20
24
|
function cssSize(value) {
|
|
21
25
|
return typeof value === "number" ? `${value}px` : value;
|
|
22
26
|
}
|
|
@@ -29,7 +33,7 @@ function cssSize(value) {
|
|
|
29
33
|
:description="description"
|
|
30
34
|
:direction="direction"
|
|
31
35
|
:dismissible="dismissible && config?.allowOutsideClick !== false"
|
|
32
|
-
:
|
|
36
|
+
:content="contentProps"
|
|
33
37
|
:handle="false"
|
|
34
38
|
:ui="{
|
|
35
39
|
overlay: ui?.overlay,
|
|
@@ -15,6 +15,10 @@ const contentStyle = computed(() => ({
|
|
|
15
15
|
maxWidth: cssSize(props.config?.maxWidth),
|
|
16
16
|
maxHeight: cssSize(props.config?.maxHeight)
|
|
17
17
|
}));
|
|
18
|
+
const contentProps = computed(() => ({
|
|
19
|
+
disableOutsidePointerEvents: void 0,
|
|
20
|
+
style: contentStyle.value
|
|
21
|
+
}));
|
|
18
22
|
function cssSize(value) {
|
|
19
23
|
return typeof value === "number" ? `${value}px` : value;
|
|
20
24
|
}
|
|
@@ -26,7 +30,7 @@ function cssSize(value) {
|
|
|
26
30
|
:title="title"
|
|
27
31
|
:description="description"
|
|
28
32
|
:dismissible="dismissible && config?.allowOutsideClick !== false"
|
|
29
|
-
:
|
|
33
|
+
:content="contentProps"
|
|
30
34
|
:ui="{
|
|
31
35
|
overlay: ui?.overlay,
|
|
32
36
|
content: mergeFormUiClass(
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
declare var __VLS_1: {
|
|
2
|
+
attrs: import("../../../shared/index.js").GenericObject;
|
|
3
|
+
};
|
|
4
|
+
type __VLS_Slots = {} & {
|
|
5
|
+
default?: (props: typeof __VLS_1) => any;
|
|
6
|
+
};
|
|
7
|
+
declare const __VLS_base: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
8
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
9
|
+
declare const _default: typeof __VLS_export;
|
|
10
|
+
export default _default;
|
|
11
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
12
|
+
new (): {
|
|
13
|
+
$slots: S;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { useFormField } from "@nuxt/ui/composables/useFormField";
|
|
3
|
+
import { computed } from "vue";
|
|
4
|
+
const { id, ariaAttrs } = useFormField();
|
|
5
|
+
const attrs = computed(() => ({
|
|
6
|
+
...ariaAttrs.value ?? {},
|
|
7
|
+
id: id.value
|
|
8
|
+
}));
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
<template>
|
|
12
|
+
<slot :attrs="attrs" />
|
|
13
|
+
</template>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
declare var __VLS_1: {
|
|
2
|
+
attrs: import("../../../shared/index.js").GenericObject;
|
|
3
|
+
};
|
|
4
|
+
type __VLS_Slots = {} & {
|
|
5
|
+
default?: (props: typeof __VLS_1) => any;
|
|
6
|
+
};
|
|
7
|
+
declare const __VLS_base: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
8
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
9
|
+
declare const _default: typeof __VLS_export;
|
|
10
|
+
export default _default;
|
|
11
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
12
|
+
new (): {
|
|
13
|
+
$slots: S;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
@@ -3,6 +3,7 @@ type __VLS_Props = {
|
|
|
3
3
|
field: FormField;
|
|
4
4
|
parentPath: readonly string[];
|
|
5
5
|
bare?: boolean;
|
|
6
|
+
controlLabelledby?: string;
|
|
6
7
|
};
|
|
7
8
|
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>;
|
|
8
9
|
declare const _default: typeof __VLS_export;
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import UAlert from "@nuxt/ui/components/Alert.vue";
|
|
3
|
-
import { computed, ref, watchEffect } from "vue";
|
|
4
|
-
import {
|
|
3
|
+
import { computed, ref, useId, watchEffect } from "vue";
|
|
4
|
+
import {
|
|
5
|
+
provideFormFieldBare,
|
|
6
|
+
provideFormFieldControlAttrs
|
|
7
|
+
} from "../../composables/use-form-field-chrome";
|
|
5
8
|
import { useFormItemLayout } from "../../composables/use-form-layout";
|
|
6
9
|
import {
|
|
7
10
|
childParentPath,
|
|
@@ -48,15 +51,24 @@ import TimeField from "../../fields/time/component.vue";
|
|
|
48
51
|
import UploadField from "../../fields/upload/component.vue";
|
|
49
52
|
import { createFormFieldInstance } from "../../utils/field-instance";
|
|
50
53
|
import { focusFormFieldElement } from "../../utils/focus";
|
|
54
|
+
import { resolveFormText } from "../../utils/text";
|
|
51
55
|
const props = defineProps({
|
|
52
56
|
field: { type: null, required: true },
|
|
53
57
|
parentPath: { type: Array, required: true },
|
|
54
|
-
bare: { type: Boolean, required: false }
|
|
58
|
+
bare: { type: Boolean, required: false },
|
|
59
|
+
controlLabelledby: { type: String, required: false }
|
|
55
60
|
});
|
|
56
61
|
const form = useFormRuntimeContext();
|
|
57
62
|
const element = ref(null);
|
|
58
63
|
const bare = computed(() => props.bare === true);
|
|
64
|
+
const controlId = useId();
|
|
65
|
+
const controlAttrs = computed(() => {
|
|
66
|
+
if (!bare.value) return {};
|
|
67
|
+
if (props.controlLabelledby) return { id: controlId, "aria-labelledby": props.controlLabelledby };
|
|
68
|
+
return { id: controlId, "aria-label": resolveControlLabel(props.field) };
|
|
69
|
+
});
|
|
59
70
|
provideFormFieldBare(bare);
|
|
71
|
+
provideFormFieldControlAttrs(controlAttrs);
|
|
60
72
|
const field = computed(() => createFormFieldInstance(props.field));
|
|
61
73
|
const path = computed(() => fieldPath(props.parentPath, props.field));
|
|
62
74
|
const childPath = computed(() => childParentPath(props.parentPath, props.field));
|
|
@@ -144,6 +156,10 @@ function resolveFieldLayout() {
|
|
|
144
156
|
function isLayout(value) {
|
|
145
157
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
146
158
|
}
|
|
159
|
+
function resolveControlLabel(controlField) {
|
|
160
|
+
if ("label" in controlField) return resolveFormText(controlField.label) ?? controlField.key;
|
|
161
|
+
return controlField.key;
|
|
162
|
+
}
|
|
147
163
|
</script>
|
|
148
164
|
|
|
149
165
|
<template>
|
|
@@ -3,6 +3,7 @@ type __VLS_Props = {
|
|
|
3
3
|
field: FormField;
|
|
4
4
|
parentPath: readonly string[];
|
|
5
5
|
bare?: boolean;
|
|
6
|
+
controlLabelledby?: string;
|
|
6
7
|
};
|
|
7
8
|
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>;
|
|
8
9
|
declare const _default: typeof __VLS_export;
|
|
@@ -9,12 +9,12 @@ declare var __VLS_1: {
|
|
|
9
9
|
description: string | undefined;
|
|
10
10
|
hint: string | undefined;
|
|
11
11
|
required: boolean;
|
|
12
|
-
},
|
|
12
|
+
}, __VLS_29: {
|
|
13
13
|
label: string | undefined;
|
|
14
14
|
description: string | undefined;
|
|
15
15
|
hint: string | undefined;
|
|
16
16
|
required: boolean;
|
|
17
|
-
},
|
|
17
|
+
}, __VLS_38: {
|
|
18
18
|
label: string | undefined;
|
|
19
19
|
description: string | undefined;
|
|
20
20
|
hint: string | undefined;
|
|
@@ -23,9 +23,9 @@ declare var __VLS_1: {
|
|
|
23
23
|
type __VLS_Slots = {} & {
|
|
24
24
|
default?: (props: typeof __VLS_1) => any;
|
|
25
25
|
} & {
|
|
26
|
-
default?: (props: typeof
|
|
26
|
+
default?: (props: typeof __VLS_29) => any;
|
|
27
27
|
} & {
|
|
28
|
-
default?: (props: typeof
|
|
28
|
+
default?: (props: typeof __VLS_38) => any;
|
|
29
29
|
};
|
|
30
30
|
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>;
|
|
31
31
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
@@ -28,9 +28,15 @@ const description = computed(
|
|
|
28
28
|
const hint = computed(
|
|
29
29
|
() => field.value.capability.has("hint") && "hint" in props.field ? resolveFormText(props.field.hint) : void 0
|
|
30
30
|
);
|
|
31
|
+
const labelExtra = computed(() => {
|
|
32
|
+
if (!field.value.capability.has("hint") || !("labelExtra" in props.field)) return void 0;
|
|
33
|
+
const value = props.field.labelExtra;
|
|
34
|
+
return typeof value === "function" ? value() : value;
|
|
35
|
+
});
|
|
31
36
|
const shellLabel = computed(() => props.inlineLabel ? void 0 : label.value);
|
|
32
37
|
const shellDescription = computed(() => props.inlineLabel ? void 0 : description.value);
|
|
33
38
|
const shellHint = computed(() => props.inlineLabel ? void 0 : hint.value);
|
|
39
|
+
const shellLabelExtra = computed(() => props.inlineLabel ? void 0 : labelExtra.value);
|
|
34
40
|
const error = computed(() => form.getFieldError(props.path));
|
|
35
41
|
const required = computed(() => {
|
|
36
42
|
if (!field.value.capability.has("validation")) return false;
|
|
@@ -67,6 +73,9 @@ const nuxtFieldUi = computed(() => ({
|
|
|
67
73
|
function resetField() {
|
|
68
74
|
form.getFieldApi(props.path, props.field).value.reset();
|
|
69
75
|
}
|
|
76
|
+
function renderLabelExtra() {
|
|
77
|
+
return shellLabelExtra.value;
|
|
78
|
+
}
|
|
70
79
|
</script>
|
|
71
80
|
|
|
72
81
|
<template>
|
|
@@ -78,12 +87,17 @@ function resetField() {
|
|
|
78
87
|
:name="path.join('.')"
|
|
79
88
|
:label="shellLabel"
|
|
80
89
|
:description="shellDescription"
|
|
81
|
-
:hint="shellHint"
|
|
90
|
+
:hint="shellLabelExtra === void 0 || shellLabelExtra === null ? shellHint : void 0"
|
|
82
91
|
:error="error"
|
|
83
92
|
:required="required"
|
|
84
93
|
:size="formUi.controlSize.value"
|
|
85
94
|
:ui="nuxtFieldUi"
|
|
86
95
|
>
|
|
96
|
+
<template v-if="shellLabelExtra !== void 0 && shellLabelExtra !== null" #hint>
|
|
97
|
+
<span :class="fieldUi?.labelExtra">
|
|
98
|
+
<component :is="renderLabelExtra" />
|
|
99
|
+
</span>
|
|
100
|
+
</template>
|
|
87
101
|
<UCollapsible
|
|
88
102
|
v-if="collapsible"
|
|
89
103
|
v-model:open="open"
|
|
@@ -9,12 +9,12 @@ declare var __VLS_1: {
|
|
|
9
9
|
description: string | undefined;
|
|
10
10
|
hint: string | undefined;
|
|
11
11
|
required: boolean;
|
|
12
|
-
},
|
|
12
|
+
}, __VLS_29: {
|
|
13
13
|
label: string | undefined;
|
|
14
14
|
description: string | undefined;
|
|
15
15
|
hint: string | undefined;
|
|
16
16
|
required: boolean;
|
|
17
|
-
},
|
|
17
|
+
}, __VLS_38: {
|
|
18
18
|
label: string | undefined;
|
|
19
19
|
description: string | undefined;
|
|
20
20
|
hint: string | undefined;
|
|
@@ -23,9 +23,9 @@ declare var __VLS_1: {
|
|
|
23
23
|
type __VLS_Slots = {} & {
|
|
24
24
|
default?: (props: typeof __VLS_1) => any;
|
|
25
25
|
} & {
|
|
26
|
-
default?: (props: typeof
|
|
26
|
+
default?: (props: typeof __VLS_29) => any;
|
|
27
27
|
} & {
|
|
28
|
-
default?: (props: typeof
|
|
28
|
+
default?: (props: typeof __VLS_38) => any;
|
|
29
29
|
};
|
|
30
30
|
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>;
|
|
31
31
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
@@ -26,17 +26,17 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {
|
|
|
26
26
|
nextStep: () => Promise<boolean>;
|
|
27
27
|
previousStep: () => Promise<boolean>;
|
|
28
28
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
29
|
-
cancel: (value: import("../../../shared/index.js").GenericObject) => any;
|
|
30
29
|
submit: (value: import("../../../shared/index.js").GenericObject, result: {
|
|
31
30
|
success: boolean;
|
|
32
31
|
data?: unknown;
|
|
33
32
|
}) => any;
|
|
33
|
+
cancel: (value: import("../../../shared/index.js").GenericObject) => any;
|
|
34
34
|
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
35
|
-
onCancel?: ((value: import("../../../shared/index.js").GenericObject) => any) | undefined;
|
|
36
35
|
onSubmit?: ((value: import("../../../shared/index.js").GenericObject, result: {
|
|
37
36
|
success: boolean;
|
|
38
37
|
data?: unknown;
|
|
39
38
|
}) => any) | undefined;
|
|
39
|
+
onCancel?: ((value: import("../../../shared/index.js").GenericObject) => any) | undefined;
|
|
40
40
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
41
41
|
declare const _default: typeof __VLS_export;
|
|
42
42
|
export default _default;
|
|
@@ -4,7 +4,7 @@ import UButton from "@nuxt/ui/components/Button.vue";
|
|
|
4
4
|
import USkeleton from "@nuxt/ui/components/Skeleton.vue";
|
|
5
5
|
import { useAppConfig } from "nuxt/app";
|
|
6
6
|
import { computed, nextTick, onBeforeUnmount, onMounted, watch } from "vue";
|
|
7
|
-
import {
|
|
7
|
+
import { useRouter } from "vue-router";
|
|
8
8
|
import { useFormActions } from "../../composables/use-form-actions";
|
|
9
9
|
import { useFormGridLayout } from "../../composables/use-form-layout";
|
|
10
10
|
import { provideFormRuntime, useFormRuntime } from "../../composables/use-form-runtime";
|
|
@@ -25,6 +25,7 @@ const props = defineProps({
|
|
|
25
25
|
showCloseButton: { type: Boolean, required: false },
|
|
26
26
|
ui: { type: Object, required: false }
|
|
27
27
|
});
|
|
28
|
+
const router = useRouter();
|
|
28
29
|
const emit = defineEmits(["submit", "cancel"]);
|
|
29
30
|
const schemaRef = computed(() => props.form?.schema.value ?? props.schema ?? {});
|
|
30
31
|
const appConfig = useAppConfig();
|
|
@@ -74,10 +75,11 @@ if (typeof window !== "undefined") {
|
|
|
74
75
|
window.addEventListener("beforeunload", handleBeforeUnload);
|
|
75
76
|
onBeforeUnmount(() => window.removeEventListener("beforeunload", handleBeforeUnload));
|
|
76
77
|
}
|
|
77
|
-
|
|
78
|
+
const removeRouteGuard = router.beforeEach(() => {
|
|
78
79
|
if (!shouldConfirmDirtyNavigation()) return true;
|
|
79
80
|
return window.confirm(getDirtyNavigationMessage());
|
|
80
81
|
});
|
|
82
|
+
onBeforeUnmount(removeRouteGuard);
|
|
81
83
|
const currentStep = computed(() => getSchemaSteps(schemaRef.value)[runtime.currentStepIndex.value]);
|
|
82
84
|
const parentPath = computed(
|
|
83
85
|
() => runtime.currentStepRoot.value ? [runtime.currentStepRoot.value] : []
|
|
@@ -304,7 +306,7 @@ async function focusFirstRenderedField() {
|
|
|
304
306
|
</div>
|
|
305
307
|
|
|
306
308
|
<footer :class="footerClass">
|
|
307
|
-
<FormActions :runtime="runtime" :actions="actions" @
|
|
309
|
+
<FormActions :runtime="runtime" :actions="actions" @cancel="cancel" />
|
|
308
310
|
</footer>
|
|
309
311
|
</form>
|
|
310
312
|
</template>
|
|
@@ -26,17 +26,17 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {
|
|
|
26
26
|
nextStep: () => Promise<boolean>;
|
|
27
27
|
previousStep: () => Promise<boolean>;
|
|
28
28
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
29
|
-
cancel: (value: import("../../../shared/index.js").GenericObject) => any;
|
|
30
29
|
submit: (value: import("../../../shared/index.js").GenericObject, result: {
|
|
31
30
|
success: boolean;
|
|
32
31
|
data?: unknown;
|
|
33
32
|
}) => any;
|
|
33
|
+
cancel: (value: import("../../../shared/index.js").GenericObject) => any;
|
|
34
34
|
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
35
|
-
onCancel?: ((value: import("../../../shared/index.js").GenericObject) => any) | undefined;
|
|
36
35
|
onSubmit?: ((value: import("../../../shared/index.js").GenericObject, result: {
|
|
37
36
|
success: boolean;
|
|
38
37
|
data?: unknown;
|
|
39
38
|
}) => any) | undefined;
|
|
39
|
+
onCancel?: ((value: import("../../../shared/index.js").GenericObject) => any) | undefined;
|
|
40
40
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
41
41
|
declare const _default: typeof __VLS_export;
|
|
42
42
|
export default _default;
|
|
@@ -23,7 +23,7 @@ export declare function useFieldControl(field: () => FormField, path: () => read
|
|
|
23
23
|
refreshable: import("vue").ComputedRef<boolean>;
|
|
24
24
|
selectCreatedOption: import("vue").ComputedRef<boolean>;
|
|
25
25
|
refresh: () => Promise<void>;
|
|
26
|
-
add: (option: unknown) =>
|
|
26
|
+
add: (option: unknown) => import("../utils/options.js").ResolvedFormOption;
|
|
27
27
|
create: (label: string) => Promise<import("../utils/options.js").ResolvedFormOption | null>;
|
|
28
28
|
};
|
|
29
29
|
placeholder: import("vue").ComputedRef<string>;
|
|
@@ -5,12 +5,14 @@ import { createFormFieldInstance } from "../utils/field-instance.js";
|
|
|
5
5
|
import { resolveFormText } from "../utils/text.js";
|
|
6
6
|
import { mergeFormUiClass } from "../utils/ui.js";
|
|
7
7
|
import { useFieldOptions } from "./use-field-options.js";
|
|
8
|
+
import { useFormFieldControlAttrs } from "./use-form-field-chrome.js";
|
|
8
9
|
import { useFormRuntimeContext } from "./use-form-runtime.js";
|
|
9
10
|
import { useFormUi } from "./use-form-ui.js";
|
|
10
11
|
export function useFieldControl(field, path) {
|
|
11
12
|
const form = useFormRuntimeContext();
|
|
12
13
|
const formUi = useFormUi();
|
|
13
14
|
const { t } = useUiToolsLocale();
|
|
15
|
+
const fieldControlAttrs = useFormFieldControlAttrs();
|
|
14
16
|
const api = computed(() => form.getFieldApi(path(), field()));
|
|
15
17
|
const params = computed(() => form.getFieldCallbackParams(path(), field()));
|
|
16
18
|
const options = useFieldOptions({
|
|
@@ -25,6 +27,7 @@ export function useFieldControl(field, path) {
|
|
|
25
27
|
const current = field();
|
|
26
28
|
const fieldUi = formUi.ui.value.fields?.[current.type];
|
|
27
29
|
const defaults = {
|
|
30
|
+
...fieldControlAttrs.value,
|
|
28
31
|
size: fieldUi?.size ?? formUi.controlSize.value,
|
|
29
32
|
class: fieldUi?.class,
|
|
30
33
|
ui: mergeControlUi(formUi.ui.value.control?.ui, fieldUi?.ui)
|
|
@@ -70,6 +73,7 @@ export function useFieldControl(field, path) {
|
|
|
70
73
|
watchWithFilter(
|
|
71
74
|
() => form.getValue(path()),
|
|
72
75
|
async () => {
|
|
76
|
+
api.value.validation.clearError();
|
|
73
77
|
if (!createFormFieldInstance(field()).capability.has("validation")) return;
|
|
74
78
|
const trigger = getValidationTrigger(field());
|
|
75
79
|
if (trigger === "submit") return;
|
|
@@ -21,6 +21,6 @@ export declare function useFieldOptions(params: {
|
|
|
21
21
|
refreshable: ComputedRef<boolean>;
|
|
22
22
|
selectCreatedOption: ComputedRef<boolean>;
|
|
23
23
|
refresh: () => Promise<void>;
|
|
24
|
-
add: (option: unknown) =>
|
|
24
|
+
add: (option: unknown) => ResolvedFormOption;
|
|
25
25
|
create: (label: string) => Promise<ResolvedFormOption | null>;
|
|
26
26
|
};
|