eco-vue-js 0.10.1 → 0.10.3
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/components/Button/WButton.vue.d.ts.map +1 -1
- package/dist/components/Button/WButton.vue.js +1 -1
- package/dist/components/Button/WButtonGroup.vue.d.ts.map +1 -1
- package/dist/components/Button/WButtonGroup.vue.js +11 -6
- package/dist/components/Button/types.d.ts +1 -1
- package/dist/components/Button/types.d.ts.map +1 -1
- package/dist/components/FieldWrapper/WFieldWrapper.vue.js +1 -1
- package/dist/components/FormAsync/WFormAsyncButtonGroup.vue.d.ts +4 -2
- package/dist/components/FormAsync/WFormAsyncButtonGroup.vue.d.ts.map +1 -1
- package/dist/components/FormAsync/WFormAsyncButtonGroup.vue.js +19 -50
- package/dist/components/FormAsync/WFormAsyncInput.vue.d.ts.map +1 -1
- package/dist/components/FormAsync/WFormAsyncInput.vue.js +15 -50
- package/dist/components/FormAsync/WFormAsyncSelect.vue.d.ts +1 -1
- package/dist/components/FormAsync/WFormAsyncSelect.vue.d.ts.map +1 -1
- package/dist/components/FormAsync/WFormAsyncSelect.vue.js +25 -57
- package/dist/components/FormAsync/WFormAsyncSelectInfiniteSingle.vue.d.ts.map +1 -1
- package/dist/components/FormAsync/WFormAsyncSelectInfiniteSingle.vue.js +16 -51
- package/dist/components/FormAsync/WFormAsyncSelectSingle.vue.d.ts.map +1 -1
- package/dist/components/FormAsync/WFormAsyncSelectSingle.vue.js +18 -53
- package/dist/components/FormAsync/WFormAsyncSelectStringified.vue.d.ts.map +1 -1
- package/dist/components/FormAsync/WFormAsyncSelectStringified.vue.js +18 -53
- package/dist/components/FormAsync/WFormAsyncToggle.vue.d.ts.map +1 -1
- package/dist/components/FormAsync/WFormAsyncToggle.vue.js +17 -63
- package/dist/components/FormAsync/types.d.ts +16 -119
- package/dist/components/FormAsync/types.d.ts.map +1 -1
- package/dist/components/FormAsync/use/useFormAsync.d.ts +9 -0
- package/dist/components/FormAsync/use/useFormAsync.d.ts.map +1 -0
- package/dist/components/FormAsync/use/useFormAsync.js +61 -0
- package/dist/components/Input/WInputAsync.vue.d.ts.map +1 -1
- package/dist/components/Input/WInputAsync.vue.js +4 -1
- package/dist/components/Input/components/InputActions.vue.d.ts.map +1 -1
- package/dist/components/Input/components/InputActions.vue.js +5 -2
- package/dist/components/Input/components/InputActionsButton.vue.js +3 -3
- package/dist/components/Select/WSelectStringified.vue.js +1 -1
- package/dist/components/Toggle/WToggle.vue.d.ts.map +1 -1
- package/dist/components/Toggle/WToggle.vue.js +34 -12
- package/dist/components/Toggle/types.d.ts +2 -0
- package/dist/components/Toggle/types.d.ts.map +1 -1
- package/package.json +1 -1
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"WButton.vue.d.ts","sourceRoot":"","sources":["../../../src/components/Button/WButton.vue"],"names":[],"mappings":"AAkGA,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,eAAe,CAAA;AAM5C,OAAO,EAAC,YAAY,EAAC,MAAM,sBAAsB,CAAA;AAMjD,UAAU,KAAM,SAAQ,OAAO,CAAC,SAAS,CAAC;IACxC,YAAY,CAAC,EAAE,YAAY,CAAA;IAC3B,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,GAAG,CAAC,EAAE,GAAG,GAAG,QAAQ,CAAA;IACpB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,MAAM,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,SAAS,GAAG,MAAM,CAAA;IAChD,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,eAAe,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC,CAAA;CACxD;AA0CD,iBAAS,cAAc;;
|
1
|
+
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C,GAAG;IACxC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
|
@@ -38,7 +38,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
38
38
|
"w-ripple w-ripple-hover before:text-black-default w-ripple-opacity-20 dark:w-ripple-opacity-30 cursor-pointer": !_ctx.loading && !_ctx.disabled,
|
39
39
|
"cursor-progress": _ctx.loading,
|
40
40
|
"cursor-not-allowed opacity-70": _ctx.disabled,
|
41
|
-
"[&:not(:first-child)]:rounded-l-none [&:not(:first-child)]:border-l-0 [&:not(:last-child)]:rounded-r-none [&:not(:last-child)]:border-r-0": _ctx.join
|
41
|
+
"[&:not(:first-child)]:rounded-l-none [&:not(:first-child)]:border-l-0 [&:not(:first-child)]:before:rounded-l-none [&:not(:last-child)]:rounded-r-none [&:not(:last-child)]:border-r-0 [&:not(:last-child)]:before:rounded-r-none": _ctx.join
|
42
42
|
}],
|
43
43
|
disabled: !_ctx.loading && _ctx.disabled,
|
44
44
|
type: _ctx.type,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"WButtonGroup.vue.d.ts","sourceRoot":"","sources":["../../../src/components/Button/WButtonGroup.vue"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"WButtonGroup.vue.d.ts","sourceRoot":"","sources":["../../../src/components/Button/WButtonGroup.vue"],"names":[],"mappings":"AAqGA,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,SAAS,CAAA;yBAW5B,KAAK,SAAS,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,OAAO,EAAE,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,SAAS;IAAC,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,CAAA;CAAC,CAAC,IAAI,CAAC,GAAG,SAAS,2BAC3J,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,cAClD,mBAAmB,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC,iBAC5F,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC;WA6KxD,mBAAmB,CAAC;;2LAAyD,CAAC,4BAA2B;oBAChG,OAAO,KAAK,EAAE,gBAAgB,CAAC,EAAE,CAAC,GAAG,IAAI;WAClD,GAAG;;uBAlCc,GAAG;;;;YACD,GAAG;uBACJ,GAAG;;cAtIzB,oBAAoB,SAAS,KAAK,KAAG,IAAI;;;;YA2KH,OAAO,CAAC,OAAO,WAAW,CAAC;;AAvLvE,wBAuL4E;AAC5E,KAAK,mBAAmB,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAG,GAAG,EAAE,CAAC"}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { defineComponent, openBlock, createBlock, mergeProps, createSlots, withCtx, createElementVNode, normalizeClass, createElementBlock, Fragment, renderList, unref, renderSlot, resolveDynamicComponent, createCommentVNode } from 'vue';
|
1
|
+
import { defineComponent, ref, openBlock, createBlock, mergeProps, createSlots, withCtx, createElementVNode, normalizeClass, createElementBlock, Fragment, renderList, unref, renderSlot, resolveDynamicComponent, createCommentVNode } from 'vue';
|
2
2
|
import _sfc_main$1 from '../FieldWrapper/WFieldWrapper.vue.js';
|
3
3
|
import { SemanticType } from '../../utils/SemanticType.js';
|
4
4
|
import _sfc_main$2 from './WButton.vue.js';
|
@@ -11,7 +11,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
11
11
|
valueGetter: { type: Function },
|
12
12
|
optionComponent: {},
|
13
13
|
modelValue: {},
|
14
|
-
loading: {},
|
14
|
+
loading: { type: Boolean },
|
15
15
|
minimize: { type: Boolean },
|
16
16
|
wrap: { type: Boolean },
|
17
17
|
col: { type: Boolean },
|
@@ -41,6 +41,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
41
41
|
setup(__props, { emit: __emit }) {
|
42
42
|
const props = __props;
|
43
43
|
const emit = __emit;
|
44
|
+
const loadingItem = ref(void 0);
|
44
45
|
const getValue = (item) => {
|
45
46
|
if (props.valueGetter && typeof item === "object") {
|
46
47
|
return props.valueGetter(item);
|
@@ -48,9 +49,13 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
48
49
|
return item;
|
49
50
|
}
|
50
51
|
};
|
52
|
+
const emitUpdateModelValue = (value) => {
|
53
|
+
loadingItem.value = value;
|
54
|
+
emit("update:model-value", value);
|
55
|
+
};
|
51
56
|
const updateModelValue = (value) => {
|
52
|
-
if (value !== props.modelValue)
|
53
|
-
else if (props.allowClear)
|
57
|
+
if (value !== props.modelValue) emitUpdateModelValue(value);
|
58
|
+
else if (props.allowClear) emitUpdateModelValue(null);
|
54
59
|
};
|
55
60
|
return (_ctx, _cache) => {
|
56
61
|
return openBlock(), createBlock(_sfc_main$1, mergeProps(props, {
|
@@ -68,8 +73,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
68
73
|
return openBlock(), createBlock(_sfc_main$2, {
|
69
74
|
key: index,
|
70
75
|
"semantic-type": getValue(item) === _ctx.modelValue ? _ctx.semanticType ?? unref(SemanticType).PRIMARY : unref(SemanticType).SECONDARY,
|
71
|
-
loading: getValue(item) ===
|
72
|
-
disabled: _ctx.disabled || _ctx.loading
|
76
|
+
loading: _ctx.loading && getValue(item) === loadingItem.value,
|
77
|
+
disabled: _ctx.disabled || _ctx.loading && getValue(item) !== loadingItem.value,
|
73
78
|
minimize: _ctx.minimize,
|
74
79
|
join: !_ctx.wrap && !_ctx.col,
|
75
80
|
"semantic-type-map": _ctx.semanticTypeMap,
|
@@ -9,7 +9,7 @@ export type ButtonGroupOptionProps<Option> = {
|
|
9
9
|
export type ButtonGroupOptionComponent<Option> = Component<ButtonGroupOptionProps<Option>>;
|
10
10
|
interface ButtonGroupPropsBase<Model extends number | string | null | boolean> extends Omit<FieldWrapperProps, 'modelValue'> {
|
11
11
|
modelValue: Model;
|
12
|
-
loading?:
|
12
|
+
loading?: boolean;
|
13
13
|
minimize?: boolean;
|
14
14
|
wrap?: boolean;
|
15
15
|
col?: boolean;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/Button/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,iCAAiC,CAAA;AACtE,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,iCAAiC,CAAA;AACtE,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,sBAAsB,CAAA;AACtD,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,KAAK,CAAA;AAElC,MAAM,MAAM,sBAAsB,CAAC,MAAM,IAAI;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAC,CAAA;AAEjF,MAAM,MAAM,0BAA0B,CAAC,MAAM,IAAI,SAAS,CAAC,sBAAsB,CAAC,MAAM,CAAC,CAAC,CAAA;AAE1F,UAAU,oBAAoB,CAAC,KAAK,SAAS,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,OAAO,CAC3E,SAAQ,IAAI,CAAC,iBAAiB,EAAE,YAAY,CAAC;IAC7C,UAAU,EAAE,KAAK,CAAA;IACjB,OAAO,CAAC,EAAE,
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/Button/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,iCAAiC,CAAA;AACtE,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,iCAAiC,CAAA;AACtE,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,sBAAsB,CAAA;AACtD,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,KAAK,CAAA;AAElC,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';
|
13
13
|
import '../../utils/Modal.js';
|
14
|
-
import { encodeQueryParam } from '../../utils/api.js';
|
15
14
|
import '../Input/WInputSuggest.vue.js';
|
15
|
+
import { encodeQueryParam } from '../../utils/api.js';
|
16
16
|
import '../Input/WInputDate.vue.js';
|
17
17
|
import '../Link/WLink.vue.js';
|
18
18
|
import '@tanstack/vue-query';
|
@@ -2,7 +2,9 @@ import { FormAsyncButtonGroupProps } from './types';
|
|
2
2
|
declare const _default: <Model, FieldType extends string | number | boolean | null, QueryParams, Entity extends Record<string, unknown>, ValueGetter extends {
|
3
3
|
fn(value: Entity): FieldType;
|
4
4
|
}["fn"] | undefined = undefined>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
5
|
-
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
|
5
|
+
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
|
6
|
+
readonly onSuccess?: ((value: Model) => any) | undefined;
|
7
|
+
} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, "onSuccess"> & FormAsyncButtonGroupProps<Model, FieldType, QueryParams, Entity, ValueGetter>> & import('vue').PublicProps;
|
6
8
|
expose(exposed: import('vue').ShallowUnwrapRef<{}>): void;
|
7
9
|
attrs: any;
|
8
10
|
slots: {
|
@@ -11,7 +13,7 @@ declare const _default: <Model, FieldType extends string | number | boolean | nu
|
|
11
13
|
selected: boolean;
|
12
14
|
}): any;
|
13
15
|
};
|
14
|
-
emit:
|
16
|
+
emit: (e: "success", value: Model) => void;
|
15
17
|
}>) => import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
|
16
18
|
[key: string]: any;
|
17
19
|
}> & {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"WFormAsyncButtonGroup.vue.d.ts","sourceRoot":"","sources":["../../../src/components/FormAsync/WFormAsyncButtonGroup.vue"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"WFormAsyncButtonGroup.vue.d.ts","sourceRoot":"","sources":["../../../src/components/FormAsync/WFormAsyncButtonGroup.vue"],"names":[],"mappings":"AAAA,OA2CO,KAAK,EAAC,yBAAyB,EAAC,MAAM,SAAS,CAAA;yBAQrC,KAAK,EAAE,SAAS,SAAS,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,EAAE,WAAW,EAAE,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,SAAS;IAAC,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,CAAA;CAAC,CAAC,IAAI,CAAC,GAAG,SAAS,2BACvL,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,cAClD,mBAAmB,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC,iBAC5F,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC;WA+HxD,mBAAmB,CAAC;;iNAAyD,CAAC,4BAA2B;oBAChG,OAAO,KAAK,EAAE,gBAAgB,CAAC,EAAE,CAAC,GAAG,IAAI;WAClD,GAAG;;;;;YAjCe,GAAG;;cAzFzB,SAAS,SAAS,KAAK,KAAG,IAAI;;;;YA+HQ,OAAO,CAAC,OAAO,WAAW,CAAC;;AAzIvE,wBAyI4E;AAC5E,KAAK,mBAAmB,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAG,GAAG,EAAE,CAAC"}
|
@@ -1,23 +1,14 @@
|
|
1
|
-
import { defineComponent,
|
1
|
+
import { defineComponent, openBlock, createBlock, mergeProps, unref, createSlots, withCtx, renderSlot } from 'vue';
|
2
2
|
import _sfc_main$1 from '../Button/WButtonGroup.vue.js';
|
3
|
-
import {
|
4
|
-
import { Notify } from '../../utils/Notify.js';
|
5
|
-
import { handleApiError } from '../../utils/api.js';
|
6
|
-
import { get, set } from '../../utils/utils.js';
|
3
|
+
import { useFormAsync } from './use/useFormAsync.js';
|
7
4
|
|
8
5
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
9
6
|
__name: "WFormAsyncButtonGroup",
|
10
7
|
props: {
|
11
|
-
useQueryFn: {},
|
12
|
-
noParams: { type: Boolean },
|
13
|
-
queryParams: {},
|
14
|
-
queryEnabled: { type: Boolean },
|
15
|
-
field: {},
|
16
|
-
apiMethod: { type: Function },
|
17
|
-
confimGetter: { type: Function },
|
18
8
|
list: {},
|
19
|
-
valueGetter: {
|
9
|
+
valueGetter: {},
|
20
10
|
optionComponent: {},
|
11
|
+
loading: { type: Boolean },
|
21
12
|
minimize: { type: Boolean },
|
22
13
|
wrap: { type: Boolean },
|
23
14
|
col: { type: Boolean },
|
@@ -41,53 +32,31 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
41
32
|
emptyValue: {},
|
42
33
|
leftError: { type: Boolean },
|
43
34
|
filterField: {},
|
44
|
-
filterValue: {}
|
35
|
+
filterValue: {},
|
36
|
+
useQueryFn: {},
|
37
|
+
noParams: { type: Boolean },
|
38
|
+
queryParams: {},
|
39
|
+
queryEnabled: { type: Boolean, default: void 0 },
|
40
|
+
field: {},
|
41
|
+
apiMethod: {},
|
42
|
+
confimGetter: {}
|
45
43
|
},
|
46
|
-
|
44
|
+
emits: ["success"],
|
45
|
+
setup(__props, { emit: __emit }) {
|
47
46
|
const props = __props;
|
48
|
-
const
|
49
|
-
const
|
50
|
-
const modelValue = computed(() => get(data.value ?? {}, props.field) ?? null);
|
51
|
-
const save = (value) => {
|
52
|
-
if (submittingItem.value !== void 0) return;
|
53
|
-
submittingItem.value = value;
|
54
|
-
return props.apiMethod(set({}, props.field, value)).then((response) => {
|
55
|
-
setData(response.data);
|
56
|
-
Notify.success({ title: "Saved" });
|
57
|
-
}).catch((error) => handleApiError(error, void 0, props.field)).finally(() => {
|
58
|
-
submittingItem.value = void 0;
|
59
|
-
});
|
60
|
-
};
|
61
|
-
let closeModal = null;
|
62
|
-
const showModal = (value) => {
|
63
|
-
closeModal?.();
|
64
|
-
const confirmProps = props.confimGetter?.(value);
|
65
|
-
if (!confirmProps) {
|
66
|
-
save(value);
|
67
|
-
return;
|
68
|
-
}
|
69
|
-
closeModal = Modal.addConfirm({
|
70
|
-
...confirmProps,
|
71
|
-
onAccept: () => {
|
72
|
-
return save(value);
|
73
|
-
}
|
74
|
-
}, () => closeModal = null);
|
75
|
-
};
|
76
|
-
onBeforeUnmount(() => {
|
77
|
-
closeModal?.();
|
78
|
-
closeModal = null;
|
79
|
-
});
|
47
|
+
const emit = __emit;
|
48
|
+
const { isLoadingError, data, modelValue, submitting, showModal } = useFormAsync(props, (value) => emit("success", value));
|
80
49
|
return (_ctx, _cache) => {
|
81
50
|
return openBlock(), createBlock(_sfc_main$1, mergeProps({
|
82
51
|
...props,
|
83
|
-
modelValue: modelValue
|
52
|
+
modelValue: unref(modelValue),
|
84
53
|
list: _ctx.list,
|
85
54
|
optionComponent: _ctx.optionComponent,
|
86
|
-
loading:
|
55
|
+
loading: _ctx.loading || unref(submitting),
|
87
56
|
disabled: _ctx.disabled || unref(isLoadingError),
|
88
57
|
skeleton: _ctx.skeleton || !unref(data)
|
89
58
|
}, {
|
90
|
-
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => showModal($event))
|
59
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => unref(showModal)($event))
|
91
60
|
}), createSlots({ _: 2 }, [
|
92
61
|
_ctx.$slots.option ? {
|
93
62
|
name: "option",
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"WFormAsyncInput.vue.d.ts","sourceRoot":"","sources":["../../../src/components/FormAsync/WFormAsyncInput.vue"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"WFormAsyncInput.vue.d.ts","sourceRoot":"","sources":["../../../src/components/FormAsync/WFormAsyncInput.vue"],"names":[],"mappings":"AAAA,OAqEO,KAAK,EAAC,mBAAmB,EAAC,MAAM,SAAS,CAAA;yBAW/B,KAAK,EAAE,SAAS,SAAS,MAAM,GAAG,MAAM,EAAE,WAAW,eACxD,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,cAClD,mBAAmB,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC,iBAC5F,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC;WA6JxD,mBAAmB,CAAC;;sLAAyD,CAAC,4BAA2B;oBAChG,OAAO,KAAK,EAAE,gBAAgB,CAAC,EAAE,CAAC,GAAG,IAAI;WAClD,GAAG;;uBApCc,GAAG;0BACA,GAAG;uBACN,GAAG;;cAtHxB,SAAS,SAAS,KAAK,KAAG,IAAI;;;;YA6JQ,OAAO,CAAC,OAAO,WAAW,CAAC;;AAvKvE,wBAuK4E;AAC5E,KAAK,mBAAmB,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAG,GAAG,EAAE,CAAC"}
|
@@ -1,21 +1,11 @@
|
|
1
|
-
import { defineComponent,
|
1
|
+
import { defineComponent, computed, openBlock, createBlock, mergeProps, unref, createSlots, withCtx, renderSlot } from 'vue';
|
2
2
|
import _sfc_main$1 from '../Input/WInputAsync.vue.js';
|
3
|
-
import { Modal } from '../../utils/Modal.js';
|
4
|
-
import { Notify } from '../../utils/Notify.js';
|
5
|
-
import { handleApiError } from '../../utils/api.js';
|
6
|
-
import { get, set } from '../../utils/utils.js';
|
7
3
|
import { validateRequired } from '../../utils/validate.js';
|
4
|
+
import { useFormAsync } from './use/useFormAsync.js';
|
8
5
|
|
9
6
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
10
7
|
__name: "WFormAsyncInput",
|
11
8
|
props: {
|
12
|
-
useQueryFn: {},
|
13
|
-
noParams: { type: Boolean },
|
14
|
-
queryParams: {},
|
15
|
-
queryEnabled: { type: Boolean },
|
16
|
-
field: {},
|
17
|
-
apiMethod: { type: Function },
|
18
|
-
confimGetter: { type: Function },
|
19
9
|
validate: {},
|
20
10
|
debounce: {},
|
21
11
|
hideButton: { type: Boolean },
|
@@ -57,61 +47,36 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
57
47
|
emptyValue: {},
|
58
48
|
leftError: { type: Boolean },
|
59
49
|
filterField: {},
|
60
|
-
filterValue: {}
|
50
|
+
filterValue: {},
|
51
|
+
useQueryFn: {},
|
52
|
+
noParams: { type: Boolean },
|
53
|
+
queryParams: {},
|
54
|
+
queryEnabled: { type: Boolean, default: void 0 },
|
55
|
+
field: {},
|
56
|
+
apiMethod: {},
|
57
|
+
confimGetter: {}
|
61
58
|
},
|
62
59
|
emits: ["success"],
|
63
60
|
setup(__props, { emit: __emit }) {
|
64
61
|
const props = __props;
|
65
62
|
const emit = __emit;
|
66
|
-
const { data,
|
67
|
-
const submitting = ref(false);
|
68
|
-
const modelValue = computed(() => get(data.value ?? {}, props.field));
|
63
|
+
const { isLoadingError, data, modelValue, submitting, showModal } = useFormAsync(props, (value) => emit("success", value));
|
69
64
|
const validateFn = computed(() => {
|
70
65
|
const result = Array.isArray(props.validate) ? props.validate.slice() : props.validate ? [props.validate] : [];
|
71
66
|
if (props.required && !props.textSecure) result.push(validateRequired);
|
72
67
|
return result;
|
73
68
|
});
|
74
|
-
const save = (value) => {
|
75
|
-
if (submitting.value) return;
|
76
|
-
submitting.value = true;
|
77
|
-
return props.apiMethod(set({}, props.field, value)).then((response) => {
|
78
|
-
setData(response.data);
|
79
|
-
Notify.success({ title: "Saved" });
|
80
|
-
emit("success", response.data);
|
81
|
-
}).catch((error) => handleApiError(error, void 0, props.field)).finally(() => {
|
82
|
-
submitting.value = false;
|
83
|
-
});
|
84
|
-
};
|
85
|
-
let closeModal = null;
|
86
|
-
const showModal = (value) => {
|
87
|
-
closeModal?.();
|
88
|
-
const confirmProps = props.confimGetter?.(value);
|
89
|
-
if (!confirmProps) {
|
90
|
-
save(value);
|
91
|
-
return;
|
92
|
-
}
|
93
|
-
closeModal = Modal.addConfirm({
|
94
|
-
...confirmProps,
|
95
|
-
onAccept: () => {
|
96
|
-
return save(value);
|
97
|
-
}
|
98
|
-
}, () => closeModal = null);
|
99
|
-
};
|
100
|
-
onBeforeUnmount(() => {
|
101
|
-
closeModal?.();
|
102
|
-
closeModal = null;
|
103
|
-
});
|
104
69
|
return (_ctx, _cache) => {
|
105
70
|
return openBlock(), createBlock(_sfc_main$1, mergeProps({
|
106
71
|
...props,
|
107
|
-
modelValue: _ctx.textSecure ? void 0 : modelValue
|
72
|
+
modelValue: _ctx.textSecure ? void 0 : unref(modelValue),
|
108
73
|
skeleton: _ctx.skeleton || !unref(data),
|
109
74
|
disabled: _ctx.disabled || unref(isLoadingError),
|
110
|
-
loading: _ctx.loading || submitting
|
75
|
+
loading: _ctx.loading || unref(submitting),
|
111
76
|
validate: validateFn.value,
|
112
|
-
placeholderSecure: _ctx.textSecure ? !!modelValue
|
77
|
+
placeholderSecure: _ctx.textSecure ? !!unref(modelValue) : void 0
|
113
78
|
}, {
|
114
|
-
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => showModal($event))
|
79
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => unref(showModal)($event))
|
115
80
|
}), createSlots({ _: 2 }, [
|
116
81
|
_ctx.$slots.title ? {
|
117
82
|
name: "title",
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { FormAsyncSelectProps } from './types';
|
2
2
|
import { SelectOptionComponent } from '../Select/types';
|
3
|
-
declare const _default: <Model, FieldType extends string | number, QueryParamsOptions, QueryParams, Data extends DefaultData, OptionComponent extends SelectOptionComponent<Data>>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
3
|
+
declare const _default: <Model, FieldType extends string[] | number[], QueryParamsOptions, QueryParams, Data extends DefaultData, OptionComponent extends SelectOptionComponent<Data>>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
4
4
|
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
|
5
5
|
readonly onSuccess?: ((value: Model) => any) | undefined;
|
6
6
|
} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, "onSuccess"> & FormAsyncSelectProps<Model, FieldType, QueryParamsOptions, QueryParams, Data, OptionComponent>> & import('vue').PublicProps;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"WFormAsyncSelect.vue.d.ts","sourceRoot":"","sources":["../../../src/components/FormAsync/WFormAsyncSelect.vue"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"WFormAsyncSelect.vue.d.ts","sourceRoot":"","sources":["../../../src/components/FormAsync/WFormAsyncSelect.vue"],"names":[],"mappings":"AAAA,OA8DO,KAAK,EAAC,oBAAoB,EAAC,MAAM,SAAS,CAAA;AACjD,OAAO,KAAK,EAAC,qBAAqB,EAAC,MAAM,2BAA2B,CAAA;yBAOnD,KAAK,EAAE,SAAS,SAAS,MAAM,EAAE,GAAG,MAAM,EAAE,EAAE,kBAAkB,EAAE,WAAW,EAAE,IAAI,SAAS,WAAW,EAAE,eAAe,SAAS,qBAAqB,CAAC,IAAI,CAAC,eAC/J,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,cAClD,mBAAmB,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC,iBAC5F,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC;WA+JxD,mBAAmB,CAAC;;kOAAyD,CAAC,4BAA2B;oBAChG,OAAO,KAAK,EAAE,gBAAgB,CAAC,EAAE,CAAC,GAAG,IAAI;WAClD,GAAG;;uBApCc,GAAG;0BACA,GAAG;uBACL,GAAG;;cAxHzB,SAAS,SAAS,KAAK,KAAG,IAAI;;;;YA+JQ,OAAO,CAAC,OAAO,WAAW,CAAC;;AAzKvE,wBAyK4E;AAC5E,KAAK,mBAAmB,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAG,GAAG,EAAE,CAAC"}
|
@@ -1,28 +1,18 @@
|
|
1
|
-
import { defineComponent,
|
1
|
+
import { defineComponent, openBlock, createBlock, mergeProps, unref, createSlots, withCtx, renderSlot } from 'vue';
|
2
2
|
import _sfc_main$1 from '../Select/WSelect.vue.js';
|
3
|
-
import {
|
4
|
-
import { Notify } from '../../utils/Notify.js';
|
5
|
-
import { handleApiError } from '../../utils/api.js';
|
6
|
-
import { get, set } from '../../utils/utils.js';
|
3
|
+
import { useFormAsync } from './use/useFormAsync.js';
|
7
4
|
|
8
5
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
9
6
|
__name: "WFormAsyncSelect",
|
10
7
|
props: {
|
11
|
-
|
12
|
-
|
13
|
-
queryParams: {},
|
14
|
-
queryEnabled: { type: Boolean },
|
15
|
-
field: {},
|
16
|
-
apiMethod: { type: Function },
|
17
|
-
confimGetter: { type: Function },
|
18
|
-
valueGetter: { type: Function },
|
19
|
-
searchFn: { type: Function },
|
8
|
+
valueGetter: {},
|
9
|
+
searchFn: {},
|
20
10
|
useQueryFnDefault: {},
|
21
11
|
emptyStub: {},
|
22
12
|
disableClear: { type: Boolean },
|
23
13
|
hidePrefix: { type: Boolean },
|
24
|
-
createOption: {
|
25
|
-
filterOptions: {
|
14
|
+
createOption: {},
|
15
|
+
filterOptions: {},
|
26
16
|
hideOptionIcon: { type: Boolean },
|
27
17
|
createdData: {},
|
28
18
|
mobileTitle: {},
|
@@ -75,59 +65,37 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
75
65
|
optionComponentProps: {},
|
76
66
|
useQueryFnOptions: {},
|
77
67
|
queryParamsOptions: {},
|
78
|
-
options: {}
|
68
|
+
options: {},
|
69
|
+
useQueryFn: {},
|
70
|
+
noParams: { type: Boolean },
|
71
|
+
queryParams: {},
|
72
|
+
queryEnabled: { type: Boolean, default: void 0 },
|
73
|
+
field: {},
|
74
|
+
apiMethod: {},
|
75
|
+
confimGetter: {}
|
79
76
|
},
|
80
77
|
emits: ["success"],
|
81
78
|
setup(__props, { emit: __emit }) {
|
82
79
|
const props = __props;
|
83
80
|
const emit = __emit;
|
84
|
-
const { data,
|
85
|
-
const
|
86
|
-
|
87
|
-
|
88
|
-
if (
|
89
|
-
|
90
|
-
return
|
91
|
-
{},
|
92
|
-
props.field,
|
93
|
-
isSelect ? [...modelValue.value, value] : modelValue.value.filter((item) => item !== value)
|
94
|
-
)).then((response) => {
|
95
|
-
setData(response.data);
|
96
|
-
Notify.success({ title: "Saved" });
|
97
|
-
emit("success", response.data);
|
98
|
-
}).catch((error) => handleApiError(error, void 0, props.field)).finally(() => {
|
99
|
-
submitting.value = false;
|
100
|
-
});
|
101
|
-
};
|
102
|
-
let closeModal = null;
|
103
|
-
const showModal = (value, isSelect) => {
|
104
|
-
closeModal?.();
|
105
|
-
const confirmProps = props.confimGetter?.(value, isSelect);
|
106
|
-
if (!confirmProps) {
|
107
|
-
save(value, isSelect);
|
108
|
-
return;
|
109
|
-
}
|
110
|
-
closeModal = Modal.addConfirm({
|
111
|
-
...confirmProps,
|
112
|
-
onAccept: () => {
|
113
|
-
return save(value, isSelect);
|
114
|
-
}
|
115
|
-
}, () => closeModal = null);
|
81
|
+
const { isLoadingError, data, modelValue, submitting, showModal } = useFormAsync(props, (value) => emit("success", value));
|
82
|
+
const getNewValue = (value) => {
|
83
|
+
const newValue = modelValue.value?.slice() ?? [];
|
84
|
+
const index = newValue.indexOf(value);
|
85
|
+
if (index === -1) newValue.push(value);
|
86
|
+
else newValue.splice(index, 1);
|
87
|
+
return newValue;
|
116
88
|
};
|
117
|
-
onBeforeUnmount(() => {
|
118
|
-
closeModal?.();
|
119
|
-
closeModal = null;
|
120
|
-
});
|
121
89
|
return (_ctx, _cache) => {
|
122
90
|
return openBlock(), createBlock(_sfc_main$1, mergeProps({
|
123
91
|
...props,
|
124
|
-
modelValue: modelValue
|
92
|
+
modelValue: unref(modelValue) ?? [],
|
125
93
|
skeleton: _ctx.skeleton || !unref(data),
|
126
94
|
disabled: _ctx.disabled || unref(isLoadingError),
|
127
|
-
loading: _ctx.loading || submitting
|
95
|
+
loading: _ctx.loading || unref(submitting)
|
128
96
|
}, {
|
129
|
-
onSelect: _cache[0] || (_cache[0] = ($event) => showModal($event
|
130
|
-
onUnselect: _cache[1] || (_cache[1] = ($event) => showModal($event
|
97
|
+
onSelect: _cache[0] || (_cache[0] = ($event) => unref(showModal)(getNewValue($event))),
|
98
|
+
onUnselect: _cache[1] || (_cache[1] = ($event) => unref(showModal)(getNewValue($event)))
|
131
99
|
}), createSlots({ _: 2 }, [
|
132
100
|
_ctx.$slots.title ? {
|
133
101
|
name: "title",
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"WFormAsyncSelectInfiniteSingle.vue.d.ts","sourceRoot":"","sources":["../../../src/components/FormAsync/WFormAsyncSelectInfiniteSingle.vue"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"WFormAsyncSelectInfiniteSingle.vue.d.ts","sourceRoot":"","sources":["../../../src/components/FormAsync/WFormAsyncSelectInfiniteSingle.vue"],"names":[],"mappings":"AAAA,OAmDO,KAAK,EAAC,kCAAkC,EAAC,MAAM,SAAS,CAAA;AAC/D,OAAO,KAAK,EAAC,qBAAqB,EAAC,MAAM,2BAA2B,CAAA;yBAOnD,KAAK,EAAE,SAAS,SAAS,MAAM,GAAG,MAAM,EAAE,kBAAkB,EAAE,WAAW,EAAE,IAAI,SAAS,WAAW,EAAE,eAAe,SAAS,qBAAqB,CAAC,IAAI,CAAC,EAAE,UAAU,SAAS,OAAO,uBACvL,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,cAClD,mBAAmB,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC,iBAC5F,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC;WA4IxD,mBAAmB,CAAC;;4PAAyD,CAAC,4BAA2B;oBAChG,OAAO,KAAK,EAAE,gBAAgB,CAAC,EAAE,CAAC,GAAG,IAAI;WAClD,GAAG;;uBAnCc,GAAG;0BACA,GAAG;uBACN,GAAG;;cAtGxB,SAAS,SAAS,KAAK,KAAG,IAAI;;;;YA4IQ,OAAO,CAAC,OAAO,WAAW,CAAC;;AAtJvE,wBAsJ4E;AAC5E,KAAK,mBAAmB,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAG,GAAG,EAAE,CAAC"}
|
@@ -1,20 +1,10 @@
|
|
1
|
-
import { defineComponent,
|
1
|
+
import { defineComponent, openBlock, createBlock, mergeProps, unref, createSlots, withCtx, renderSlot } from 'vue';
|
2
2
|
import _sfc_main$1 from '../Select/WSelectAsyncSingle.vue.js';
|
3
|
-
import {
|
4
|
-
import { Notify } from '../../utils/Notify.js';
|
5
|
-
import { handleApiError } from '../../utils/api.js';
|
6
|
-
import { get, set } from '../../utils/utils.js';
|
3
|
+
import { useFormAsync } from './use/useFormAsync.js';
|
7
4
|
|
8
5
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
9
6
|
__name: "WFormAsyncSelectInfiniteSingle",
|
10
7
|
props: {
|
11
|
-
useQueryFn: {},
|
12
|
-
noParams: { type: Boolean },
|
13
|
-
queryParams: {},
|
14
|
-
queryEnabled: { type: Boolean },
|
15
|
-
field: {},
|
16
|
-
apiMethod: { type: Function },
|
17
|
-
confimGetter: { type: Function },
|
18
8
|
allowClear: { type: Boolean },
|
19
9
|
searchModel: { type: Boolean },
|
20
10
|
previewData: {},
|
@@ -24,11 +14,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
24
14
|
queryParamsOptions: {},
|
25
15
|
searchField: {},
|
26
16
|
valueQueryKey: {},
|
27
|
-
valueGetter: {
|
17
|
+
valueGetter: {},
|
28
18
|
useQueryFnDefault: {},
|
29
19
|
emptyStub: {},
|
30
20
|
hidePrefix: { type: Boolean },
|
31
|
-
createOption: {
|
21
|
+
createOption: {},
|
32
22
|
hideOptionIcon: { type: Boolean },
|
33
23
|
mobileTitle: {},
|
34
24
|
persist: { type: Boolean },
|
@@ -77,54 +67,29 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
77
67
|
maxWidth: {},
|
78
68
|
horizontalAlign: {},
|
79
69
|
optionComponent: {},
|
80
|
-
optionComponentProps: {}
|
70
|
+
optionComponentProps: {},
|
71
|
+
useQueryFn: {},
|
72
|
+
noParams: { type: Boolean },
|
73
|
+
queryParams: {},
|
74
|
+
queryEnabled: { type: Boolean, default: void 0 },
|
75
|
+
field: {},
|
76
|
+
apiMethod: {},
|
77
|
+
confimGetter: {}
|
81
78
|
},
|
82
79
|
emits: ["success"],
|
83
80
|
setup(__props, { emit: __emit }) {
|
84
81
|
const props = __props;
|
85
82
|
const emit = __emit;
|
86
|
-
const { data,
|
87
|
-
const submitting = ref(false);
|
88
|
-
const modelValue = computed(() => get(data.value ?? {}, props.field) ?? null);
|
89
|
-
const save = (value) => {
|
90
|
-
if (submitting.value) return;
|
91
|
-
submitting.value = true;
|
92
|
-
return props.apiMethod(set({}, props.field, value)).then((response) => {
|
93
|
-
setData(response.data);
|
94
|
-
Notify.success({ title: "Saved" });
|
95
|
-
emit("success", response.data);
|
96
|
-
}).catch((error) => handleApiError(error, void 0, props.field)).finally(() => {
|
97
|
-
submitting.value = false;
|
98
|
-
});
|
99
|
-
};
|
100
|
-
let closeModal = null;
|
101
|
-
const showModal = (value) => {
|
102
|
-
closeModal?.();
|
103
|
-
const confirmProps = props.confimGetter?.(value);
|
104
|
-
if (!confirmProps) {
|
105
|
-
save(value);
|
106
|
-
return;
|
107
|
-
}
|
108
|
-
closeModal = Modal.addConfirm({
|
109
|
-
...confirmProps,
|
110
|
-
onAccept: () => {
|
111
|
-
return save(value);
|
112
|
-
}
|
113
|
-
}, () => closeModal = null);
|
114
|
-
};
|
115
|
-
onBeforeUnmount(() => {
|
116
|
-
closeModal?.();
|
117
|
-
closeModal = null;
|
118
|
-
});
|
83
|
+
const { isLoadingError, data, modelValue, submitting, showModal } = useFormAsync(props, (value) => emit("success", value));
|
119
84
|
return (_ctx, _cache) => {
|
120
85
|
return openBlock(), createBlock(_sfc_main$1, mergeProps({
|
121
86
|
...props,
|
122
|
-
modelValue: modelValue
|
87
|
+
modelValue: unref(modelValue),
|
123
88
|
skeleton: _ctx.skeleton || !unref(data),
|
124
89
|
disabled: _ctx.disabled || unref(isLoadingError),
|
125
|
-
loading: _ctx.loading || submitting
|
90
|
+
loading: _ctx.loading || unref(submitting)
|
126
91
|
}, {
|
127
|
-
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => showModal($event ?? null))
|
92
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => unref(showModal)($event ?? null))
|
128
93
|
}), createSlots({ _: 2 }, [
|
129
94
|
_ctx.$slots.title ? {
|
130
95
|
name: "title",
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"WFormAsyncSelectSingle.vue.d.ts","sourceRoot":"","sources":["../../../src/components/FormAsync/WFormAsyncSelectSingle.vue"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"WFormAsyncSelectSingle.vue.d.ts","sourceRoot":"","sources":["../../../src/components/FormAsync/WFormAsyncSelectSingle.vue"],"names":[],"mappings":"AAAA,OAmDO,KAAK,EAAC,0BAA0B,EAAC,MAAM,SAAS,CAAA;AACvD,OAAO,KAAK,EAAC,qBAAqB,EAAC,MAAM,2BAA2B,CAAA;yBAOnD,KAAK,EAAE,SAAS,SAAS,MAAM,GAAG,MAAM,EAAE,kBAAkB,EAAE,WAAW,EAAE,IAAI,SAAS,WAAW,EAAE,eAAe,SAAS,qBAAqB,CAAC,IAAI,CAAC,EAAE,UAAU,SAAS,OAAO,uBACvL,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,cAClD,mBAAmB,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC,iBAC5F,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC;WA4IxD,mBAAmB,CAAC;;oPAAyD,CAAC,4BAA2B;oBAChG,OAAO,KAAK,EAAE,gBAAgB,CAAC,EAAE,CAAC,GAAG,IAAI;WAClD,GAAG;;uBAnCc,GAAG;0BACA,GAAG;uBACN,GAAG;;cAtGxB,SAAS,SAAS,KAAK,KAAG,IAAI;;;;YA4IQ,OAAO,CAAC,OAAO,WAAW,CAAC;;AAtJvE,wBAsJ4E;AAC5E,KAAK,mBAAmB,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAG,GAAG,EAAE,CAAC"}
|