eco-vue-js 0.7.2 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/components/Button/WButtonGroup.vue.d.ts +5 -4
- package/dist/components/Button/WButtonGroup.vue.d.ts.map +1 -1
- package/dist/components/Button/WButtonGroup.vue.js +12 -4
- package/dist/components/Button/types.d.ts +17 -6
- package/dist/components/Button/types.d.ts.map +1 -1
- package/dist/components/Form/WFormValidator.vue.d.ts.map +1 -1
- package/dist/components/Form/WFormValidator.vue.js +3 -4
- package/dist/components/FormAsync/WFormAsyncButtonGroup.vue.d.ts +25 -0
- package/dist/components/FormAsync/WFormAsyncButtonGroup.vue.d.ts.map +1 -0
- package/dist/components/FormAsync/WFormAsyncButtonGroup.vue.js +101 -0
- package/dist/components/FormAsync/WFormAsyncButtonGroup.vue2.js +5 -0
- package/dist/components/FormAsync/WFormAsyncInput.vue.d.ts +26 -0
- package/dist/components/FormAsync/WFormAsyncInput.vue.d.ts.map +1 -0
- package/dist/components/FormAsync/WFormAsyncInput.vue.js +131 -0
- package/dist/components/FormAsync/WFormAsyncInput.vue2.js +5 -0
- package/dist/components/FormAsync/WFormAsyncSelectSingle.vue.d.ts +27 -0
- package/dist/components/FormAsync/WFormAsyncSelectSingle.vue.d.ts.map +1 -0
- package/dist/components/FormAsync/WFormAsyncSelectSingle.vue.js +139 -0
- package/dist/components/FormAsync/WFormAsyncSelectSingle.vue2.js +5 -0
- package/dist/components/FormAsync/WFormAsyncToggle.vue.d.ts +22 -0
- package/dist/components/FormAsync/WFormAsyncToggle.vue.d.ts.map +1 -0
- package/dist/components/FormAsync/WFormAsyncToggle.vue.js +89 -0
- package/dist/components/FormAsync/WFormAsyncToggle.vue2.js +5 -0
- package/dist/components/FormAsync/types.d.ts +85 -0
- package/dist/components/FormAsync/types.d.ts.map +1 -0
- package/dist/components/InfiniteList/WInfiniteList.vue.d.ts +3 -3
- package/dist/components/InfiniteList/WInfiniteList.vue.d.ts.map +1 -1
- package/dist/components/InfiniteList/WInfiniteListPages.vue.d.ts +3 -3
- package/dist/components/InfiniteList/WInfiniteListPages.vue.d.ts.map +1 -1
- package/dist/components/InfiniteList/components/InfiniteListPage.vue.d.ts +6 -6
- package/dist/components/InfiniteList/components/InfiniteListPage.vue.d.ts.map +1 -1
- package/dist/components/List/WList.vue.d.ts +2 -2
- package/dist/components/List/WList.vue.d.ts.map +1 -1
- package/dist/components/List/WList.vue.js +2 -2
- package/dist/components/Select/WSelect.vue.d.ts +12 -13
- package/dist/components/Select/WSelect.vue.d.ts.map +1 -1
- package/dist/components/Select/WSelect.vue.js +44 -33
- package/dist/components/Select/WSelectAsync.vue.d.ts +4 -5
- package/dist/components/Select/WSelectAsync.vue.d.ts.map +1 -1
- package/dist/components/Select/WSelectAsync.vue.js +20 -15
- package/dist/components/Select/WSelectAsyncList.vue.d.ts +3 -3
- package/dist/components/Select/WSelectAsyncList.vue.d.ts.map +1 -1
- package/dist/components/Select/WSelectAsyncSingle.vue.d.ts +2 -5
- package/dist/components/Select/WSelectAsyncSingle.vue.d.ts.map +1 -1
- package/dist/components/Select/WSelectAsyncSingle.vue.js +4 -7
- package/dist/components/Select/WSelectSingle.vue.d.ts +8 -8
- package/dist/components/Select/WSelectSingle.vue.d.ts.map +1 -1
- package/dist/components/Select/WSelectSingle.vue.js +3 -2
- package/dist/components/Select/components/SelectAsyncList.vue.d.ts +3 -3
- package/dist/components/Select/components/SelectAsyncList.vue.d.ts.map +1 -1
- package/dist/components/Select/components/SelectAsyncPrefix.vue.d.ts +4 -2
- package/dist/components/Select/components/SelectAsyncPrefix.vue.d.ts.map +1 -1
- package/dist/components/Select/components/SelectAsyncPrefix.vue.js +2 -1
- package/dist/components/Select/components/SelectAsyncPrefixPage.vue.d.ts +4 -2
- package/dist/components/Select/components/SelectAsyncPrefixPage.vue.d.ts.map +1 -1
- package/dist/components/Select/components/SelectAsyncPrefixPage.vue.js +4 -2
- package/dist/components/Select/components/SelectOptionPrefix.vue.d.ts +2 -2
- package/dist/components/Select/components/SelectOptionPrefix.vue.d.ts.map +1 -1
- package/dist/components/Select/components/SelectOptionPrefix.vue.js +3 -1
- package/dist/components/Select/types.d.ts +22 -20
- package/dist/components/Select/types.d.ts.map +1 -1
- package/dist/components/Tabs/WTabs.vue.d.ts +2 -2
- package/dist/components/Tabs/WTabs.vue.d.ts.map +1 -1
- package/dist/components/Tabs/WTabs.vue.js +3 -3
- package/dist/components/Toggle/WToggle.vue.d.ts +3 -12
- package/dist/components/Toggle/WToggle.vue.d.ts.map +1 -1
- package/dist/components/Toggle/WToggle.vue.js +3 -1
- package/dist/components/Toggle/types.d.ts +13 -0
- package/dist/components/Toggle/types.d.ts.map +1 -0
- package/dist/imports/componentsPlugin.d.ts +5 -1
- package/dist/imports/componentsPlugin.d.ts.map +1 -1
- package/dist/main.d.ts +3 -0
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +8 -1
- package/dist/types/global.d.ts +98 -10
- package/dist/utils/api.d.ts +16 -0
- package/dist/utils/api.d.ts.map +1 -0
- package/dist/utils/api.js +28 -0
- package/dist/utils/useDefaultQuery.d.ts +2 -1
- package/dist/utils/useDefaultQuery.d.ts.map +1 -1
- package/dist/utils/useQueryUpdater.d.ts +12 -0
- package/dist/utils/useQueryUpdater.d.ts.map +1 -0
- package/dist/utils/useQueryUpdater.js +56 -0
- package/dist/utils/utils.d.ts +2 -0
- package/dist/utils/utils.d.ts.map +1 -1
- package/dist/utils/utils.js +13 -1
- package/dist/utils/validate.d.ts +2 -0
- package/dist/utils/validate.d.ts.map +1 -0
- package/dist/utils/validate.js +3 -0
- package/package.json +28 -1
@@ -1,4 +1,4 @@
|
|
1
|
-
import {
|
1
|
+
import { ButtonGroupProps } from './types';
|
2
2
|
|
3
3
|
declare const _default: <Model extends number | string | null | boolean, Entity extends Record<string, unknown>, ValueGetter extends {
|
4
4
|
fn(value: Entity): Model;
|
@@ -7,13 +7,14 @@ declare const _default: <Model extends number | string | null | boolean, Entity
|
|
7
7
|
"onUpdate:modelValue"?: ((value: Model) => any) | undefined;
|
8
8
|
} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps & Readonly<import('vue').ExtractPropTypes<{}>> & {
|
9
9
|
"onUpdate:modelValue"?: ((value: Model) => any) | undefined;
|
10
|
-
}, never>, "onUpdate:modelValue"> &
|
10
|
+
}, never>, "onUpdate:modelValue"> & ButtonGroupProps<Model, Entity, ValueGetter>> & import('vue').PublicProps;
|
11
11
|
expose(exposed: import('vue').ShallowUnwrapRef<{}>): void;
|
12
12
|
attrs: any;
|
13
13
|
slots: ReturnType<() => {
|
14
14
|
title?(_: {}): any;
|
15
|
-
|
16
|
-
|
15
|
+
option?(_: {
|
16
|
+
option: ValueGetter extends undefined ? Model : Entity;
|
17
|
+
selected: boolean;
|
17
18
|
}): any;
|
18
19
|
right?(_: {}): any;
|
19
20
|
}>;
|
@@ -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":"AAsFA,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,SAAS,CAAA;yBAG5B,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,cAAc,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC,iBACvF,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC;WA+JxD,cAAc,CAAC;;;;oFAAyD,CAAC,4BAA2B;oBAC3F,OAAO,KAAK,EAAE,gBAAgB,CAAC,EAAE,CAAC,GAAG,IAAI;WAClD,GAAG;WACH,UAAU;uBA1BO,GAAG;;;;YACD,GAAG;uBACJ,GAAG;MAwBY;UAClC,KA1JH,mBAAmB,SAAS,KAAK,KAAG,IAAI,MA0JG;;;;YAGL,OAAO,CAAC,OAAO,WAAW,CAAC;;AAzKvE,wBAyK4E;AAM5E,KAAK,cAAc,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 } from 'vue';
|
1
|
+
import { defineComponent, openBlock, createBlock, mergeProps, createSlots, withCtx, createElementVNode, normalizeClass, createElementBlock, Fragment, renderList, unref, renderSlot, resolveDynamicComponent, createCommentVNode } from 'vue';
|
2
2
|
import _sfc_main$2 from './WButton.vue.js';
|
3
3
|
import { SemanticType } from '../../utils/SemanticType.js';
|
4
4
|
import _sfc_main$1 from '../FieldWrapper/WFieldWrapper.vue.js';
|
@@ -9,6 +9,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
9
9
|
props: {
|
10
10
|
list: {},
|
11
11
|
valueGetter: { type: Function },
|
12
|
+
optionComponent: {},
|
12
13
|
modelValue: {},
|
13
14
|
loading: {},
|
14
15
|
minimize: { type: Boolean },
|
@@ -66,9 +67,16 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
66
67
|
onClick: ($event) => (_ctx.alwaysEmit || getValue(item) !== _ctx.modelValue) && _ctx.$emit("update:modelValue", getValue(item))
|
67
68
|
}, {
|
68
69
|
default: withCtx(() => [
|
69
|
-
renderSlot(_ctx.$slots, "
|
70
|
-
item
|
71
|
-
|
70
|
+
renderSlot(_ctx.$slots, "option", {
|
71
|
+
option: item,
|
72
|
+
selected: getValue(item) === _ctx.modelValue
|
73
|
+
}, () => [
|
74
|
+
_ctx.optionComponent ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.optionComponent), {
|
75
|
+
key: 0,
|
76
|
+
option: item,
|
77
|
+
selected: getValue(item) === _ctx.modelValue
|
78
|
+
}, null, 8, ["option", "selected"])) : createCommentVNode("", true)
|
79
|
+
])
|
72
80
|
]),
|
73
81
|
_: 2
|
74
82
|
}, 1032, ["semantic-type", "loading", "disabled", "minimize", "join", "class", "onClick"]);
|
@@ -1,10 +1,16 @@
|
|
1
1
|
import { FieldWrapperProps } from '../FieldWrapper/types';
|
2
2
|
import { SemanticType } from '../../utils/SemanticType';
|
3
3
|
import { DropdownMenuProps } from '../DropdownMenu/types';
|
4
|
+
import { Component } from 'vue';
|
4
5
|
|
5
|
-
|
6
|
+
export type ButtonGroupOptionProps<Option> = {
|
7
|
+
option: Option;
|
8
|
+
selected?: boolean;
|
9
|
+
};
|
10
|
+
export type ButtonGroupOptionComponent<Option> = Component<ButtonGroupOptionProps<Option>>;
|
11
|
+
interface ButtonGroupPropsBase<Model extends number | string | null | boolean> extends Omit<FieldWrapperProps, 'modelValue'> {
|
6
12
|
modelValue: Model;
|
7
|
-
loading?:
|
13
|
+
loading?: Model;
|
8
14
|
minimize?: boolean;
|
9
15
|
wrap?: boolean;
|
10
16
|
col?: boolean;
|
@@ -12,18 +18,23 @@ interface Props<Model extends number | string | null | boolean> extends Omit<Fie
|
|
12
18
|
stretch?: boolean;
|
13
19
|
alwaysEmit?: boolean;
|
14
20
|
}
|
15
|
-
|
21
|
+
interface ButtonGroupPropsForModel<Model extends number | string | null | boolean, Entity extends Record<string, unknown>, ValueGetter extends {
|
16
22
|
fn(value: Entity): Model;
|
17
|
-
}['fn'] | undefined = undefined> extends
|
23
|
+
}['fn'] | undefined = undefined> extends ButtonGroupPropsBase<Model> {
|
18
24
|
list: Model[];
|
19
25
|
valueGetter?: ValueGetter | undefined;
|
26
|
+
optionComponent?: ButtonGroupOptionComponent<Model>;
|
20
27
|
}
|
21
|
-
|
28
|
+
interface ButtonGroupPropsForEntity<Model extends number | string | null | boolean, Entity extends Record<string, unknown>, ValueGetter extends {
|
22
29
|
fn(value: Entity): Model;
|
23
|
-
}['fn'] | undefined = undefined> extends
|
30
|
+
}['fn'] | undefined = undefined> extends ButtonGroupPropsBase<Model> {
|
24
31
|
list: Entity[];
|
25
32
|
valueGetter: ValueGetter | ((value: Entity) => Model);
|
33
|
+
optionComponent?: ButtonGroupOptionComponent<Entity>;
|
26
34
|
}
|
35
|
+
export type ButtonGroupProps<Model extends number | string | null | boolean, Entity extends Record<string, unknown>, ValueGetter extends {
|
36
|
+
fn(value: Entity): Model;
|
37
|
+
}['fn'] | undefined = undefined> = ButtonGroupPropsForEntity<Model, Entity, ValueGetter> | ButtonGroupPropsForModel<Model, Entity, ValueGetter>;
|
27
38
|
export interface ButtonDropdownProps extends Omit<DropdownMenuProps, 'isOpen' | 'updateAlign' | 'emitUpdate'> {
|
28
39
|
semanticType?: SemanticType;
|
29
40
|
leftToggle?: 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,YAAY,EAAC,MAAM,sBAAsB,CAAA;AACtD,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,iCAAiC,CAAA;
|
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,YAAY,EAAC,MAAM,sBAAsB,CAAA;AACtD,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,iCAAiC,CAAA;AACtE,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,KAAK,CAAA;IACf,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,GAAG,CAAC,EAAE,OAAO,CAAA;IACb,YAAY,CAAC,EAAE,YAAY,CAAA;IAC3B,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,UAAU,CAAC,EAAE,OAAO,CAAA;CACrB;AAED,UAAU,wBAAwB,CAAC,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,GAAG,SAAS,CACrM,SAAQ,oBAAoB,CAAC,KAAK,CAAC;IACnC,IAAI,EAAE,KAAK,EAAE,CAAA;IACb,WAAW,CAAC,EAAE,WAAW,GAAG,SAAS,CAAA;IACrC,eAAe,CAAC,EAAE,0BAA0B,CAAC,KAAK,CAAC,CAAA;CACpD;AAED,UAAU,yBAAyB,CAAC,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,GAAG,SAAS,CACtM,SAAQ,oBAAoB,CAAC,KAAK,CAAC;IACnC,IAAI,EAAE,MAAM,EAAE,CAAA;IACd,WAAW,EAAE,WAAW,GAAG,CAAC,CAAC,KAAK,EAAE,MAAM,KAAK,KAAK,CAAC,CAAA;IACrD,eAAe,CAAC,EAAE,0BAA0B,CAAC,MAAM,CAAC,CAAA;CACrD;AAED,MAAM,MAAM,gBAAgB,CAAC,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,GAAG,SAAS,IAAI,yBAAyB,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,CAAC,GAAG,wBAAwB,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,CAAC,CAAA;AAEjT,MAAM,WAAW,mBAAoB,SAAQ,IAAI,CAAC,iBAAiB,EAAE,QAAQ,GAAG,aAAa,GAAG,YAAY,CAAC;IAC3G,YAAY,CAAC,EAAE,YAAY,CAAA;IAC3B,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"WFormValidator.vue.d.ts","sourceRoot":"","sources":["../../../src/components/Form/WFormValidator.vue"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"WFormValidator.vue.d.ts","sourceRoot":"","sources":["../../../src/components/Form/WFormValidator.vue"],"names":[],"mappings":"AA0iBA,iBAAS,cAAc;aAVZ,MAAM,IAAI;;aAAV,MAAM,IAAI;EA+GpB;AACD,QAAA,MAAM,eAAe;WAjXZ,MAAM;YACL,MAAM;eACH,UAAU,GAAG,UAAU,EAAE;sBAClB,MAAM;sBACN,MAAM;gBACZ,OAAO;;;wBA4OC,MAAM;qBA/DN,IAAI;;;;;WAlLjB,MAAM;YACL,MAAM;eACH,UAAU,GAAG,UAAU,EAAE;sBAClB,MAAM;sBACN,MAAM;gBACZ,OAAO;;;;UAoXnB,CAAC;wBACkB,uBAAuB,CAAC,OAAO,eAAe,EAAE,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AAAvG,wBAAwG;AAOxG,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IACpC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC;AAEN,KAAK,sBAAsB,CAAC,CAAC,IAAI,CAAC,SAAS,SAAS,GAAG,KAAK,GAAG,CAAC,CAAC;AAC5D,KAAK,uBAAuB,CAAC,CAAC,IAAI;KAChC,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,SAAS,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GACpC;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;KAAE,GAC9D;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAAC,QAAQ,EAAE,IAAI,CAAA;KAAE;CACzD,CAAC"}
|
@@ -3,6 +3,7 @@ import { wFormTitleUpdater, wFormErrorMessageUpdater, wFormHasChangesUpdater, wF
|
|
3
3
|
import { useTabActiveListener } from '../Tabs/use/useTabActiveListener.js';
|
4
4
|
import { scrollToValidator } from './models/utils.js';
|
5
5
|
import { useIsInsideTab } from '../Tabs/use/useIsInsideTab.js';
|
6
|
+
import { validateRequired } from '../../utils/validate.js';
|
6
7
|
|
7
8
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
8
9
|
__name: "WFormValidator",
|
@@ -61,10 +62,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
61
62
|
}
|
62
63
|
};
|
63
64
|
const _validate = (value) => {
|
64
|
-
|
65
|
-
|
66
|
-
return message2;
|
67
|
-
}
|
65
|
+
const requiredMessage = required.value ? validateRequired(value) : void 0;
|
66
|
+
if (requiredMessage) return requiredMessage;
|
68
67
|
if (props.forbiddenRegexp && typeof value === "string") {
|
69
68
|
const match = value.match(props.forbiddenRegexp);
|
70
69
|
if (match?.length) {
|
@@ -0,0 +1,25 @@
|
|
1
|
+
import { FormAsyncButtonGroupProps } from './types';
|
2
|
+
|
3
|
+
declare const _default: <Model, FieldType extends string | number | boolean | null, QueryParams, Entity extends Record<string, unknown>, ValueGetter extends {
|
4
|
+
fn(value: Entity): FieldType;
|
5
|
+
}["fn"] | undefined = undefined>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_Prettify<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
6
|
+
props: __VLS_Prettify<Pick<Partial<{}> & Omit<{} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps & Readonly<import('vue').ExtractPropTypes<{}>>, never>, never> & FormAsyncButtonGroupProps<Model, FieldType, QueryParams, Entity, ValueGetter>> & import('vue').PublicProps;
|
7
|
+
expose(exposed: import('vue').ShallowUnwrapRef<{}>): void;
|
8
|
+
attrs: any;
|
9
|
+
slots: ReturnType<() => {
|
10
|
+
default?(_: {
|
11
|
+
option: FieldType | Entity | (ValueGetter extends undefined ? FieldType : Entity);
|
12
|
+
selected: boolean;
|
13
|
+
}): any;
|
14
|
+
}>;
|
15
|
+
emit: {};
|
16
|
+
}>) => import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
|
17
|
+
[key: string]: any;
|
18
|
+
}> & {
|
19
|
+
__ctx?: Awaited<typeof __VLS_setup>;
|
20
|
+
};
|
21
|
+
export default _default;
|
22
|
+
type __VLS_Prettify<T> = {
|
23
|
+
[K in keyof T]: T[K];
|
24
|
+
} & {};
|
25
|
+
//# sourceMappingURL=WFormAsyncButtonGroup.vue.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"WFormAsyncButtonGroup.vue.d.ts","sourceRoot":"","sources":["../../../src/components/FormAsync/WFormAsyncButtonGroup.vue"],"names":[],"mappings":"AA6FA,OAAO,KAAK,EAAC,yBAAyB,EAAC,MAAM,SAAS,CAAA;yBAOrC,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,cAAc,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC,iBACvF,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC;WAoKxD,cAAc,CAAC,+QAAyD,CAAC,4BAA2B;oBAC3F,OAAO,KAAK,EAAE,gBAAgB,CAAC,EAAE,CAAC,GAAG,IAAI;WAClD,GAAG;WACH,UAAU;;;;YAzBS,GAAG;MAyBW;;;;;YAIC,OAAO,CAAC,OAAO,WAAW,CAAC;;AA9KvE,wBA8K4E;AAM5E,KAAK,cAAc,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAG,GAAG,EAAE,CAAC"}
|
@@ -0,0 +1,101 @@
|
|
1
|
+
import { defineComponent, toRef, ref, computed, onBeforeUnmount, openBlock, createBlock, mergeProps, unref, createSlots, withCtx, renderSlot } from 'vue';
|
2
|
+
import { Notify } from '../../utils/Notify.js';
|
3
|
+
import _sfc_main$1 from '../Button/WButtonGroup.vue.js';
|
4
|
+
import { get, set } from '../../utils/utils.js';
|
5
|
+
import { handleApiError } from '../../utils/api.js';
|
6
|
+
import { Modal } from '../../utils/Modal.js';
|
7
|
+
|
8
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
9
|
+
__name: "WFormAsyncButtonGroup",
|
10
|
+
props: {
|
11
|
+
useQueryFn: {},
|
12
|
+
noParams: { type: Boolean },
|
13
|
+
queryParams: {},
|
14
|
+
queryEnabled: { type: Boolean },
|
15
|
+
field: {},
|
16
|
+
apiMethod: { type: Function },
|
17
|
+
confimGetter: { type: Function },
|
18
|
+
list: {},
|
19
|
+
valueGetter: { type: Function },
|
20
|
+
optionComponent: {},
|
21
|
+
minimize: { type: Boolean },
|
22
|
+
wrap: { type: Boolean },
|
23
|
+
col: { type: Boolean },
|
24
|
+
semanticType: {},
|
25
|
+
stretch: { type: Boolean },
|
26
|
+
alwaysEmit: { type: Boolean },
|
27
|
+
title: {},
|
28
|
+
description: {},
|
29
|
+
errorMessage: {},
|
30
|
+
tooltipText: {},
|
31
|
+
maxLength: {},
|
32
|
+
mono: { type: Boolean },
|
33
|
+
hasChanges: { type: Boolean },
|
34
|
+
skeleton: { type: Boolean },
|
35
|
+
disabled: { type: Boolean },
|
36
|
+
required: { type: Boolean },
|
37
|
+
noMargin: { type: Boolean },
|
38
|
+
allowCopy: { type: Boolean }
|
39
|
+
},
|
40
|
+
setup(__props) {
|
41
|
+
const props = __props;
|
42
|
+
const { data, setData, isLoadingError } = props.noParams === true ? props.useQueryFn({ enabled: toRef(props, "queryEnabled") }) : props.useQueryFn(toRef(props, "queryParams"), { enabled: toRef(props, "queryEnabled") });
|
43
|
+
const submittingItem = ref();
|
44
|
+
const modelValue = computed(() => get(data.value ?? {}, props.field) ?? null);
|
45
|
+
const save = (value) => {
|
46
|
+
if (submittingItem.value !== void 0) return;
|
47
|
+
submittingItem.value = value;
|
48
|
+
return props.apiMethod(set({}, props.field, value)).then((response) => {
|
49
|
+
setData(response.data);
|
50
|
+
Notify.success({ title: "Saved" });
|
51
|
+
}).catch((error) => handleApiError(error, void 0, props.field)).finally(() => {
|
52
|
+
submittingItem.value = void 0;
|
53
|
+
});
|
54
|
+
};
|
55
|
+
let closeModal = null;
|
56
|
+
const showModal = (value) => {
|
57
|
+
closeModal?.();
|
58
|
+
const confirmProps = props.confimGetter?.(value);
|
59
|
+
if (!confirmProps) {
|
60
|
+
save(value);
|
61
|
+
return;
|
62
|
+
}
|
63
|
+
closeModal = Modal.addConfirm({
|
64
|
+
...confirmProps,
|
65
|
+
onAccept: () => {
|
66
|
+
return save(value);
|
67
|
+
}
|
68
|
+
}, () => closeModal = null);
|
69
|
+
};
|
70
|
+
onBeforeUnmount(() => {
|
71
|
+
closeModal?.();
|
72
|
+
closeModal = null;
|
73
|
+
});
|
74
|
+
return (_ctx, _cache) => {
|
75
|
+
return openBlock(), createBlock(_sfc_main$1, mergeProps({
|
76
|
+
...props,
|
77
|
+
modelValue: modelValue.value,
|
78
|
+
list: _ctx.list,
|
79
|
+
optionComponent: _ctx.optionComponent,
|
80
|
+
loading: submittingItem.value,
|
81
|
+
disabled: _ctx.disabled || unref(isLoadingError),
|
82
|
+
skeleton: _ctx.skeleton || !unref(data)
|
83
|
+
}, {
|
84
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => showModal($event))
|
85
|
+
}), createSlots({ _: 2 }, [
|
86
|
+
_ctx.$slots.option ? {
|
87
|
+
name: "option",
|
88
|
+
fn: withCtx(({ option, selected }) => [
|
89
|
+
renderSlot(_ctx.$slots, "default", {
|
90
|
+
option,
|
91
|
+
selected
|
92
|
+
})
|
93
|
+
]),
|
94
|
+
key: "0"
|
95
|
+
} : void 0
|
96
|
+
]), 1040);
|
97
|
+
};
|
98
|
+
}
|
99
|
+
});
|
100
|
+
|
101
|
+
export { _sfc_main as default };
|
@@ -0,0 +1,26 @@
|
|
1
|
+
import { FormAsyncInputProps } from './types';
|
2
|
+
|
3
|
+
declare const _default: <Model, FieldType extends string | number, QueryParams>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_Prettify<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
4
|
+
props: __VLS_Prettify<Pick<Partial<{}> & Omit<{
|
5
|
+
onSuccess?: ((value: Model) => any) | undefined;
|
6
|
+
} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps & Readonly<import('vue').ExtractPropTypes<{}>> & {
|
7
|
+
onSuccess?: ((value: Model) => any) | undefined;
|
8
|
+
}, never>, "onSuccess"> & FormAsyncInputProps<Model, FieldType, QueryParams>> & import('vue').PublicProps;
|
9
|
+
expose(exposed: import('vue').ShallowUnwrapRef<{}>): void;
|
10
|
+
attrs: any;
|
11
|
+
slots: ReturnType<() => {
|
12
|
+
title?(_: {}): any;
|
13
|
+
subtitle?(_: {}): any;
|
14
|
+
right?(_: {}): any;
|
15
|
+
}>;
|
16
|
+
emit: ((e: "success", value: Model) => void) & {};
|
17
|
+
}>) => import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
|
18
|
+
[key: string]: any;
|
19
|
+
}> & {
|
20
|
+
__ctx?: Awaited<typeof __VLS_setup>;
|
21
|
+
};
|
22
|
+
export default _default;
|
23
|
+
type __VLS_Prettify<T> = {
|
24
|
+
[K in keyof T]: T[K];
|
25
|
+
} & {};
|
26
|
+
//# sourceMappingURL=WFormAsyncInput.vue.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"WFormAsyncInput.vue.d.ts","sourceRoot":"","sources":["../../../src/components/FormAsync/WFormAsyncInput.vue"],"names":[],"mappings":"AA8HA,OAAO,KAAK,EAAC,mBAAmB,EAAC,MAAM,SAAS,CAAA;yBAI/B,KAAK,EAAE,SAAS,SAAS,MAAM,GAAG,MAAM,EAAE,WAAW,eACxD,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,cAClD,cAAc,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC,iBACvF,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC;WA8MxD,cAAc,CAAC;;;;gFAAyD,CAAC,4BAA2B;oBAC3F,OAAO,KAAK,EAAE,gBAAgB,CAAC,EAAE,CAAC,GAAG,IAAI;WAClD,GAAG;WACH,UAAU;uBA7BO,GAAG;0BACA,GAAG;uBACN,GAAG;MA2Ba;UAClC,KAzMH,SAAS,SAAS,KAAK,KAAG,IAAI,MAyMO;;;;YAGC,OAAO,CAAC,OAAO,WAAW,CAAC;;AAxNvE,wBAwN4E;AAM5E,KAAK,cAAc,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAG,GAAG,EAAE,CAAC"}
|
@@ -0,0 +1,131 @@
|
|
1
|
+
import { defineComponent, toRef, ref, computed, onBeforeUnmount, openBlock, createBlock, mergeProps, unref, createSlots, withCtx, renderSlot } from 'vue';
|
2
|
+
import _sfc_main$1 from '../Input/WInputAsync.vue.js';
|
3
|
+
import { Notify } from '../../utils/Notify.js';
|
4
|
+
import { validateRequired } from '../../utils/validate.js';
|
5
|
+
import { Modal } from '../../utils/Modal.js';
|
6
|
+
import { handleApiError } from '../../utils/api.js';
|
7
|
+
import { get, set } from '../../utils/utils.js';
|
8
|
+
|
9
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
10
|
+
__name: "WFormAsyncInput",
|
11
|
+
props: {
|
12
|
+
useQueryFn: {},
|
13
|
+
noParams: { type: Boolean },
|
14
|
+
queryParams: {},
|
15
|
+
queryEnabled: { type: Boolean },
|
16
|
+
field: {},
|
17
|
+
apiMethod: { type: Function },
|
18
|
+
confimGetter: { type: Function },
|
19
|
+
validate: {},
|
20
|
+
type: {},
|
21
|
+
textarea: { type: Boolean },
|
22
|
+
resize: { type: Boolean },
|
23
|
+
placeholder: {},
|
24
|
+
icon: {},
|
25
|
+
size: {},
|
26
|
+
maxLength: {},
|
27
|
+
name: {},
|
28
|
+
autocomplete: {},
|
29
|
+
autofocus: { type: Boolean },
|
30
|
+
readonly: { type: Boolean },
|
31
|
+
disabledActions: { type: Boolean },
|
32
|
+
loading: { type: Boolean },
|
33
|
+
spellcheck: { type: Boolean },
|
34
|
+
customBackspaceHandle: { type: Boolean },
|
35
|
+
textSecure: { type: Boolean },
|
36
|
+
allowClear: { type: Boolean },
|
37
|
+
allowPaste: { type: Boolean },
|
38
|
+
hideInput: { type: Boolean },
|
39
|
+
title: {},
|
40
|
+
description: {},
|
41
|
+
errorMessage: {},
|
42
|
+
tooltipText: {},
|
43
|
+
mono: { type: Boolean },
|
44
|
+
hasChanges: { type: Boolean },
|
45
|
+
skeleton: { type: Boolean },
|
46
|
+
disabled: { type: Boolean },
|
47
|
+
required: { type: Boolean },
|
48
|
+
noMargin: { type: Boolean },
|
49
|
+
allowCopy: { type: Boolean }
|
50
|
+
},
|
51
|
+
emits: ["success"],
|
52
|
+
setup(__props, { emit: __emit }) {
|
53
|
+
const props = __props;
|
54
|
+
const emit = __emit;
|
55
|
+
const { data, setData, isLoadingError } = props.noParams === true ? props.useQueryFn({ enabled: toRef(props, "queryEnabled") }) : props.useQueryFn(toRef(props, "queryParams"), { enabled: toRef(props, "queryEnabled") });
|
56
|
+
const submitting = ref(false);
|
57
|
+
const modelValue = computed(() => get(data.value ?? {}, props.field));
|
58
|
+
const validateFn = computed(() => {
|
59
|
+
const result = Array.isArray(props.validate) ? props.validate.slice() : props.validate ? [props.validate] : [];
|
60
|
+
if (props.required && !props.textSecure) result.push(validateRequired);
|
61
|
+
return result;
|
62
|
+
});
|
63
|
+
const save = (value) => {
|
64
|
+
if (submitting.value) return;
|
65
|
+
submitting.value = true;
|
66
|
+
return props.apiMethod(set({}, props.field, value ?? null)).then((response) => {
|
67
|
+
setData(response.data);
|
68
|
+
Notify.success({ title: "Saved" });
|
69
|
+
emit("success", response.data);
|
70
|
+
}).catch((error) => handleApiError(error, void 0, props.field)).finally(() => {
|
71
|
+
submitting.value = false;
|
72
|
+
});
|
73
|
+
};
|
74
|
+
let closeModal = null;
|
75
|
+
const showModal = (value) => {
|
76
|
+
closeModal?.();
|
77
|
+
const confirmProps = props.confimGetter?.(value);
|
78
|
+
if (!confirmProps) {
|
79
|
+
save(value);
|
80
|
+
return;
|
81
|
+
}
|
82
|
+
closeModal = Modal.addConfirm({
|
83
|
+
...confirmProps,
|
84
|
+
onAccept: () => {
|
85
|
+
return save(value);
|
86
|
+
}
|
87
|
+
}, () => closeModal = null);
|
88
|
+
};
|
89
|
+
onBeforeUnmount(() => {
|
90
|
+
closeModal?.();
|
91
|
+
closeModal = null;
|
92
|
+
});
|
93
|
+
return (_ctx, _cache) => {
|
94
|
+
return openBlock(), createBlock(_sfc_main$1, mergeProps({
|
95
|
+
...props,
|
96
|
+
modelValue: _ctx.textSecure ? void 0 : modelValue.value,
|
97
|
+
skeleton: _ctx.skeleton || !unref(data),
|
98
|
+
disabled: _ctx.disabled || unref(isLoadingError),
|
99
|
+
loading: _ctx.loading || submitting.value,
|
100
|
+
validate: validateFn.value,
|
101
|
+
placeholderSecure: _ctx.textSecure ? !!modelValue.value : void 0
|
102
|
+
}, {
|
103
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => showModal($event))
|
104
|
+
}), createSlots({ _: 2 }, [
|
105
|
+
_ctx.$slots.title ? {
|
106
|
+
name: "title",
|
107
|
+
fn: withCtx(() => [
|
108
|
+
renderSlot(_ctx.$slots, "title")
|
109
|
+
]),
|
110
|
+
key: "0"
|
111
|
+
} : void 0,
|
112
|
+
_ctx.$slots.subtitle ? {
|
113
|
+
name: "subtitle",
|
114
|
+
fn: withCtx(() => [
|
115
|
+
renderSlot(_ctx.$slots, "subtitle")
|
116
|
+
]),
|
117
|
+
key: "1"
|
118
|
+
} : void 0,
|
119
|
+
_ctx.$slots.right ? {
|
120
|
+
name: "right",
|
121
|
+
fn: withCtx(() => [
|
122
|
+
renderSlot(_ctx.$slots, "right")
|
123
|
+
]),
|
124
|
+
key: "2"
|
125
|
+
} : void 0
|
126
|
+
]), 1040);
|
127
|
+
};
|
128
|
+
}
|
129
|
+
});
|
130
|
+
|
131
|
+
export { _sfc_main as default };
|
@@ -0,0 +1,27 @@
|
|
1
|
+
import { FormAsyncSelectProps } from './types';
|
2
|
+
import { SelectOptionComponent } from '../Select/types';
|
3
|
+
|
4
|
+
declare const _default: <Model, FieldType extends string | number, QueryParams, Data extends DefaultData, OptionComponent extends SelectOptionComponent<Data>, AllowClear extends boolean = false>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_Prettify<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
5
|
+
props: __VLS_Prettify<Pick<Partial<{}> & Omit<{
|
6
|
+
onSuccess?: ((value: Model) => any) | undefined;
|
7
|
+
} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps & Readonly<import('vue').ExtractPropTypes<{}>> & {
|
8
|
+
onSuccess?: ((value: Model) => any) | undefined;
|
9
|
+
}, never>, "onSuccess"> & FormAsyncSelectProps<Model, FieldType, QueryParams, Data, OptionComponent, AllowClear>> & import('vue').PublicProps;
|
10
|
+
expose(exposed: import('vue').ShallowUnwrapRef<{}>): void;
|
11
|
+
attrs: any;
|
12
|
+
slots: ReturnType<() => {
|
13
|
+
title?(_: {}): any;
|
14
|
+
subtitle?(_: {}): any;
|
15
|
+
right?(_: {}): any;
|
16
|
+
}>;
|
17
|
+
emit: ((e: "success", value: Model) => void) & {};
|
18
|
+
}>) => import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
|
19
|
+
[key: string]: any;
|
20
|
+
}> & {
|
21
|
+
__ctx?: Awaited<typeof __VLS_setup>;
|
22
|
+
};
|
23
|
+
export default _default;
|
24
|
+
type __VLS_Prettify<T> = {
|
25
|
+
[K in keyof T]: T[K];
|
26
|
+
} & {};
|
27
|
+
//# sourceMappingURL=WFormAsyncSelectSingle.vue.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"WFormAsyncSelectSingle.vue.d.ts","sourceRoot":"","sources":["../../../src/components/FormAsync/WFormAsyncSelectSingle.vue"],"names":[],"mappings":"AA0GA,OAAO,KAAK,EAAC,oBAAoB,EAAC,MAAM,SAAS,CAAA;AACjD,OAAO,KAAK,EAAC,qBAAqB,EAAC,MAAM,2BAA2B,CAAA;yBAQnD,KAAK,EAAE,SAAS,SAAS,MAAM,GAAG,MAAM,EAAE,WAAW,EAAE,IAAI,SAAS,WAAW,EAAE,eAAe,SAAS,qBAAqB,CAAC,IAAI,CAAC,EAAE,UAAU,SAAS,OAAO,uBACnK,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,cAClD,cAAc,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC,iBACvF,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC;WA2LxD,cAAc,CAAC;;;;oHAAyD,CAAC,4BAA2B;oBAC3F,OAAO,KAAK,EAAE,gBAAgB,CAAC,EAAE,CAAC,GAAG,IAAI;WAClD,GAAG;WACH,UAAU;uBA5BO,GAAG;0BACA,GAAG;uBACN,GAAG;MA0Ba;UAClC,KAtLH,SAAS,SAAS,KAAK,KAAG,IAAI,MAsLO;;;;YAGC,OAAO,CAAC,OAAO,WAAW,CAAC;;AArMvE,wBAqM4E;AAM5E,KAAK,cAAc,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAG,GAAG,EAAE,CAAC"}
|
@@ -0,0 +1,139 @@
|
|
1
|
+
import { defineComponent, toRef, ref, computed, onBeforeUnmount, openBlock, createBlock, mergeProps, unref, createSlots, withCtx, renderSlot } from 'vue';
|
2
|
+
import _sfc_main$1 from '../Select/WSelectSingle.vue.js';
|
3
|
+
import { get, set } from '../../utils/utils.js';
|
4
|
+
import { Notify } from '../../utils/Notify.js';
|
5
|
+
import { handleApiError } from '../../utils/api.js';
|
6
|
+
import { Modal } from '../../utils/Modal.js';
|
7
|
+
|
8
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
9
|
+
__name: "WFormAsyncSelectSingle",
|
10
|
+
props: {
|
11
|
+
useQueryFn: {},
|
12
|
+
noParams: { type: Boolean },
|
13
|
+
queryParams: {},
|
14
|
+
queryEnabled: { type: Boolean },
|
15
|
+
field: {},
|
16
|
+
apiMethod: { type: Function },
|
17
|
+
confimGetter: { type: Function },
|
18
|
+
allowClear: { type: Boolean },
|
19
|
+
searchModel: { type: Boolean },
|
20
|
+
useQueryFnOptions: {},
|
21
|
+
valueGetter: { type: Function },
|
22
|
+
searchFn: { type: Function },
|
23
|
+
emptyStub: {},
|
24
|
+
hidePrefix: { type: Boolean },
|
25
|
+
allowCreate: { type: Boolean },
|
26
|
+
hideOptionIcon: { type: Boolean },
|
27
|
+
mobileTitle: {},
|
28
|
+
persist: { type: Boolean },
|
29
|
+
type: {},
|
30
|
+
textarea: { type: Boolean },
|
31
|
+
resize: { type: Boolean },
|
32
|
+
placeholder: {},
|
33
|
+
icon: {},
|
34
|
+
size: {},
|
35
|
+
maxLength: {},
|
36
|
+
name: {},
|
37
|
+
autocomplete: {},
|
38
|
+
autofocus: { type: Boolean },
|
39
|
+
readonly: { type: Boolean },
|
40
|
+
disabledActions: { type: Boolean },
|
41
|
+
loading: { type: Boolean },
|
42
|
+
spellcheck: { type: Boolean },
|
43
|
+
customBackspaceHandle: { type: Boolean },
|
44
|
+
textSecure: { type: Boolean },
|
45
|
+
placeholderSecure: { type: Boolean },
|
46
|
+
allowPaste: { type: Boolean },
|
47
|
+
title: {},
|
48
|
+
description: {},
|
49
|
+
errorMessage: {},
|
50
|
+
tooltipText: {},
|
51
|
+
mono: { type: Boolean },
|
52
|
+
hasChanges: { type: Boolean },
|
53
|
+
skeleton: { type: Boolean },
|
54
|
+
disabled: { type: Boolean },
|
55
|
+
required: { type: Boolean },
|
56
|
+
noMargin: { type: Boolean },
|
57
|
+
allowCopy: { type: Boolean },
|
58
|
+
teleport: { type: Boolean },
|
59
|
+
noZIndex: { type: Boolean },
|
60
|
+
maxHeight: {},
|
61
|
+
maxWidth: {},
|
62
|
+
horizontalAlign: {},
|
63
|
+
optionComponent: {},
|
64
|
+
optionComponentProps: {}
|
65
|
+
},
|
66
|
+
emits: ["success"],
|
67
|
+
setup(__props, { emit: __emit }) {
|
68
|
+
const props = __props;
|
69
|
+
const emit = __emit;
|
70
|
+
const { data, setData, isLoadingError } = props.noParams === true ? props.useQueryFn({ enabled: toRef(props, "queryEnabled") }) : props.useQueryFn(toRef(props, "queryParams"), { enabled: toRef(props, "queryEnabled") });
|
71
|
+
const submitting = ref(false);
|
72
|
+
const modelValue = computed(() => get(data.value ?? {}, props.field) ?? null);
|
73
|
+
const save = (value) => {
|
74
|
+
if (submitting.value) return;
|
75
|
+
submitting.value = true;
|
76
|
+
return props.apiMethod(set({}, props.field, value)).then((response) => {
|
77
|
+
setData(response.data);
|
78
|
+
Notify.success({ title: "Saved" });
|
79
|
+
emit("success", response.data);
|
80
|
+
}).catch((error) => handleApiError(error, void 0, props.field)).finally(() => {
|
81
|
+
submitting.value = false;
|
82
|
+
});
|
83
|
+
};
|
84
|
+
let closeModal = null;
|
85
|
+
const showModal = (value) => {
|
86
|
+
closeModal?.();
|
87
|
+
const confirmProps = props.confimGetter?.(value);
|
88
|
+
if (!confirmProps) {
|
89
|
+
save(value);
|
90
|
+
return;
|
91
|
+
}
|
92
|
+
closeModal = Modal.addConfirm({
|
93
|
+
...confirmProps,
|
94
|
+
onAccept: () => {
|
95
|
+
return save(value);
|
96
|
+
}
|
97
|
+
}, () => closeModal = null);
|
98
|
+
};
|
99
|
+
onBeforeUnmount(() => {
|
100
|
+
closeModal?.();
|
101
|
+
closeModal = null;
|
102
|
+
});
|
103
|
+
return (_ctx, _cache) => {
|
104
|
+
return openBlock(), createBlock(_sfc_main$1, mergeProps({
|
105
|
+
...props,
|
106
|
+
modelValue: modelValue.value,
|
107
|
+
skeleton: _ctx.skeleton || !unref(data),
|
108
|
+
disabled: _ctx.disabled || unref(isLoadingError),
|
109
|
+
loading: _ctx.loading || submitting.value
|
110
|
+
}, {
|
111
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => showModal($event ?? null))
|
112
|
+
}), createSlots({ _: 2 }, [
|
113
|
+
_ctx.$slots.title ? {
|
114
|
+
name: "title",
|
115
|
+
fn: withCtx(() => [
|
116
|
+
renderSlot(_ctx.$slots, "title")
|
117
|
+
]),
|
118
|
+
key: "0"
|
119
|
+
} : void 0,
|
120
|
+
_ctx.$slots.subtitle ? {
|
121
|
+
name: "subtitle",
|
122
|
+
fn: withCtx(() => [
|
123
|
+
renderSlot(_ctx.$slots, "subtitle")
|
124
|
+
]),
|
125
|
+
key: "1"
|
126
|
+
} : void 0,
|
127
|
+
_ctx.$slots.right ? {
|
128
|
+
name: "right",
|
129
|
+
fn: withCtx(() => [
|
130
|
+
renderSlot(_ctx.$slots, "right")
|
131
|
+
]),
|
132
|
+
key: "2"
|
133
|
+
} : void 0
|
134
|
+
]), 1040);
|
135
|
+
};
|
136
|
+
}
|
137
|
+
});
|
138
|
+
|
139
|
+
export { _sfc_main as default };
|