@dazhicheng/ui 1.5.228 → 1.5.230
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/tt-form/src/components/ExpandableArrow.vue.d.ts +2 -2
- package/dist/components/tt-form/src/components/ExpandableArrow.vue2.js +29 -23
- package/dist/components/tt-form/src/index.vue2.js +32 -29
- package/dist/components/tt-modal-form/index.d.ts +1 -1
- package/dist/components/tt-modal-form/index.vue.d.ts +6 -4
- package/dist/components/tt-modal-form/index.vue.js +47 -56
- package/dist/components/tt-modal-form/props.d.ts +13 -4
- package/dist/components/tt-modal-form/useModalForm.d.ts +4 -3
- package/dist/components/tt-table/src/Table.vue.js +471 -393
- package/dist/components/tt-table/src/components/TableAction.vue.js +132 -106
- package/dist/components/tt-table/src/components/TableToobalTools.vue.js +49 -44
- package/dist/style.css +1 -1
- package/package.json +3 -3
|
@@ -16,14 +16,14 @@ declare function __VLS_template(): {
|
|
|
16
16
|
icon: string;
|
|
17
17
|
};
|
|
18
18
|
refs: {};
|
|
19
|
-
rootEl:
|
|
19
|
+
rootEl: any;
|
|
20
20
|
};
|
|
21
21
|
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
22
22
|
declare const __VLS_component: import('vue').DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
23
23
|
"update:modelValue": (value: boolean) => any;
|
|
24
24
|
}, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
25
25
|
"onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
|
|
26
|
-
}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {},
|
|
26
|
+
}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
27
27
|
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
28
28
|
export default _default;
|
|
29
29
|
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as n, mergeModels as m, useModel as p, createBlock as d, openBlock as c, unref as o, normalizeClass as u, withCtx as f, renderSlot as a, createElementVNode as s, createVNode as x } from "vue";
|
|
2
2
|
import "axios";
|
|
3
3
|
import "element-plus";
|
|
4
4
|
import "dayjs";
|
|
@@ -9,12 +9,13 @@ import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/en
|
|
|
9
9
|
import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-ecb.js";
|
|
10
10
|
import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-pkcs7.js";
|
|
11
11
|
import "lodash-es";
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import { TtIcon as
|
|
15
|
-
|
|
12
|
+
import w from "../../../../assets/svg/arrowLineDown.svg.js";
|
|
13
|
+
import _ from "../../../../assets/svg/arrowUp.svg.js";
|
|
14
|
+
import { TtIcon as b } from "../../../tt-icon/index.js";
|
|
15
|
+
import { TtButton as V } from "../../../tt-button/index.js";
|
|
16
|
+
const h = { class: "ml-1 flex items-center cursor-pointer" }, B = { class: "tt-expandable-arrow__icon flex h-[20px] w-[20px] items-center justify-center rounded-full" }, q = /* @__PURE__ */ n({
|
|
16
17
|
__name: "ExpandableArrow",
|
|
17
|
-
props: /* @__PURE__ */
|
|
18
|
+
props: /* @__PURE__ */ m({
|
|
18
19
|
class: {}
|
|
19
20
|
}, {
|
|
20
21
|
modelValue: { default: !1, type: Boolean },
|
|
@@ -22,26 +23,31 @@ const V = { class: "ml-1 flex items-center cursor-pointer" }, E = { class: "tt-e
|
|
|
22
23
|
}),
|
|
23
24
|
emits: ["update:modelValue"],
|
|
24
25
|
setup(t) {
|
|
25
|
-
const
|
|
26
|
-
return (r, l) => (
|
|
27
|
-
class: u(o(v)("flex items-center h-[28px]",
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
26
|
+
const i = t, e = p(t, "modelValue");
|
|
27
|
+
return (r, l) => (c(), d(o(V), {
|
|
28
|
+
class: u(o(v)("tt-expandable-arrow flex items-center h-[28px]", i.class)),
|
|
29
|
+
"aria-expanded": !e.value,
|
|
30
|
+
"aria-label": e.value ? "展开" : "收起",
|
|
31
|
+
onClick: l[0] || (l[0] = (C) => e.value = !e.value)
|
|
32
|
+
}, {
|
|
33
|
+
default: f(() => [
|
|
34
|
+
a(r.$slots, "default", { isExpanded: e.value }),
|
|
35
|
+
s("div", h, [
|
|
36
|
+
a(r.$slots, "icon", {}, () => [
|
|
37
|
+
s("div", B, [
|
|
38
|
+
x(o(b), {
|
|
39
|
+
icon: e.value ? o(w) : o(_),
|
|
40
|
+
size: 12,
|
|
41
|
+
"is-custom-svg": ""
|
|
42
|
+
}, null, 8, ["icon"])
|
|
43
|
+
])
|
|
39
44
|
])
|
|
40
45
|
])
|
|
41
|
-
])
|
|
42
|
-
|
|
46
|
+
]),
|
|
47
|
+
_: 3
|
|
48
|
+
}, 8, ["class", "aria-expanded", "aria-label"]));
|
|
43
49
|
}
|
|
44
50
|
});
|
|
45
51
|
export {
|
|
46
|
-
|
|
52
|
+
q as default
|
|
47
53
|
};
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { defineComponent as P, ref as N, onMounted as S, nextTick as $, watch as k, createBlock as
|
|
1
|
+
import { defineComponent as P, ref as N, onMounted as S, nextTick as $, watch as k, createBlock as B, openBlock as A, unref as a, mergeProps as x, withKeys as L, createSlots as I, withCtx as m, renderSlot as u, normalizeProps as c, guardReactiveProps as f, createCommentVNode as K, renderList as U } from "vue";
|
|
2
2
|
import "../../../node_modules/.pnpm/vue-types@5.1.3_vue@3.5.21_typescript@5.9.3_/node_modules/vue-types/shim/index.modern.js";
|
|
3
3
|
import { useDesign as z } from "../../../packages/hooks/src/useDesign.js";
|
|
4
4
|
import "axios";
|
|
5
5
|
import "element-plus";
|
|
6
6
|
import "dayjs";
|
|
7
|
-
import { cloneDeep as
|
|
7
|
+
import { cloneDeep as H } from "../../../packages/utils/src/tool.js";
|
|
8
8
|
import "../../../node_modules/.pnpm/decimal.js@10.6.0/node_modules/decimal.js/decimal.js";
|
|
9
9
|
import "../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/aes.js";
|
|
10
10
|
import "../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/enc-utf8.js";
|
|
11
11
|
import "../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-ecb.js";
|
|
12
12
|
import "../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-pkcs7.js";
|
|
13
|
-
import { get as M, isEqual as
|
|
13
|
+
import { get as M, isEqual as q, set as G } from "lodash-es";
|
|
14
14
|
import { useForwardPriorityValues as W } from "./hooks/useForwardPriorityValues.js";
|
|
15
15
|
import { useDebounceFn as j } from "@vueuse/core";
|
|
16
16
|
import J from "./components/FormActions.vue2.js";
|
|
@@ -61,35 +61,38 @@ const Pe = /* @__PURE__ */ P({
|
|
|
61
61
|
},
|
|
62
62
|
setup(O) {
|
|
63
63
|
var g, w, y, F;
|
|
64
|
-
const C = N(), { prefixCls: _ } = z("form-plus"), d = O,
|
|
65
|
-
ee([
|
|
64
|
+
const C = N(), { prefixCls: _ } = z("form-plus"), d = O, t = (w = (g = d.formApi) == null ? void 0 : g.useStore) == null ? void 0 : w.call(g), n = W(d, t), v = /* @__PURE__ */ new Map(), { delegatedSlots: E, form: h } = Z(n);
|
|
65
|
+
ee([n, h]), oe(v), (F = (y = d.formApi) == null ? void 0 : y.mount) == null || F.call(y, h, v);
|
|
66
66
|
const T = (e) => {
|
|
67
|
-
var s,
|
|
68
|
-
(s = d.formApi) == null || s.setState({ collapsed: e }), (
|
|
67
|
+
var s, r, o;
|
|
68
|
+
(s = d.formApi) == null || s.setState({ collapsed: e }), (o = (r = n.value).handleCollapsedChange) == null || o.call(r, e);
|
|
69
69
|
};
|
|
70
70
|
function R(e) {
|
|
71
|
-
var
|
|
72
|
-
!(
|
|
71
|
+
var r, o;
|
|
72
|
+
if (!(t != null && t.value.submitOnEnter) || !((r = n.value.formApi) != null && r.isMounted))
|
|
73
|
+
return;
|
|
74
|
+
const s = e.target;
|
|
75
|
+
s instanceof HTMLTextAreaElement || s instanceof HTMLButtonElement || (e.preventDefault(), (o = n.value.formApi) == null || o.validateAndSubmitForm());
|
|
73
76
|
}
|
|
74
77
|
const V = j(async () => {
|
|
75
78
|
var e;
|
|
76
|
-
|
|
79
|
+
t != null && t.value.submitOnChange && ((e = n.value.formApi) == null || e.validateAndSubmitForm());
|
|
77
80
|
}, 300), b = {};
|
|
78
81
|
return S(async () => {
|
|
79
82
|
await $(), k(
|
|
80
83
|
() => h.values,
|
|
81
84
|
async (e) => {
|
|
82
|
-
var s,
|
|
83
|
-
if (
|
|
84
|
-
const
|
|
85
|
-
if (
|
|
85
|
+
var s, r;
|
|
86
|
+
if (n.value.handleValuesChange) {
|
|
87
|
+
const o = (s = t == null ? void 0 : t.value.schema) == null ? void 0 : s.map((p) => p.fieldName);
|
|
88
|
+
if (o && o.length > 0) {
|
|
86
89
|
const p = [];
|
|
87
|
-
if (
|
|
90
|
+
if (o.forEach((i) => {
|
|
88
91
|
const l = M(e, i), D = M(b, i);
|
|
89
|
-
|
|
92
|
+
q(l, D) || (p.push(i), G(b, i, l));
|
|
90
93
|
}), p.length > 0) {
|
|
91
|
-
const i = await ((
|
|
92
|
-
|
|
94
|
+
const i = await ((r = n.value.formApi) == null ? void 0 : r.getValues());
|
|
95
|
+
n.value.handleValuesChange(H(i ?? {}), p);
|
|
93
96
|
}
|
|
94
97
|
}
|
|
95
98
|
}
|
|
@@ -98,26 +101,26 @@ const Pe = /* @__PURE__ */ P({
|
|
|
98
101
|
{ deep: !0 }
|
|
99
102
|
);
|
|
100
103
|
}), (e, s) => {
|
|
101
|
-
var
|
|
102
|
-
return
|
|
104
|
+
var r;
|
|
105
|
+
return A(), B(a(te), x({
|
|
103
106
|
ref_key: "formRef",
|
|
104
107
|
ref: C
|
|
105
|
-
}, a(
|
|
108
|
+
}, a(n), {
|
|
106
109
|
class: a(_),
|
|
107
|
-
collapsed: (
|
|
110
|
+
collapsed: (r = a(t)) == null ? void 0 : r.collapsed,
|
|
108
111
|
"component-bind-event-map": a(Y),
|
|
109
112
|
"component-map": a(X),
|
|
110
113
|
form: a(h),
|
|
111
114
|
"global-common-config": a(Q),
|
|
112
115
|
onKeydown: L(R, ["enter"])
|
|
113
116
|
}), I({
|
|
114
|
-
default: m((
|
|
115
|
-
u(e.$slots, "default", c(f(
|
|
117
|
+
default: m((o) => [
|
|
118
|
+
u(e.$slots, "default", c(f(o)), () => {
|
|
116
119
|
var p, i;
|
|
117
120
|
return [
|
|
118
|
-
a(
|
|
121
|
+
a(n).showDefaultActions ? (A(), B(J, {
|
|
119
122
|
key: 0,
|
|
120
|
-
"model-value": (p = a(
|
|
123
|
+
"model-value": (p = a(t)) == null ? void 0 : p.collapsed,
|
|
121
124
|
"wrapper-ref": (i = C.value) == null ? void 0 : i.wrapperRef,
|
|
122
125
|
"onUpdate:modelValue": T
|
|
123
126
|
}, {
|
|
@@ -140,10 +143,10 @@ const Pe = /* @__PURE__ */ P({
|
|
|
140
143
|
]),
|
|
141
144
|
_: 2
|
|
142
145
|
}, [
|
|
143
|
-
U(a(E), (
|
|
144
|
-
name:
|
|
146
|
+
U(a(E), (o) => ({
|
|
147
|
+
name: o,
|
|
145
148
|
fn: m((p) => [
|
|
146
|
-
u(e.$slots,
|
|
149
|
+
u(e.$slots, o, c(f(p)))
|
|
147
150
|
])
|
|
148
151
|
}))
|
|
149
152
|
]), 1040, ["class", "collapsed", "component-bind-event-map", "component-map", "form", "global-common-config"]);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export * from './useModalForm';
|
|
2
|
-
export type { TtModalFormProps } from './props';
|
|
2
|
+
export type { ModalFormApi, ModalFormType, TtModalFormProps } from './props';
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Recordable } from '../../../../utils/src';
|
|
2
|
-
import { TtModalFormProps } from './props';
|
|
2
|
+
import { ModalFormType, TtModalFormProps } from './props';
|
|
3
|
+
import { TtFormProps, UseGroupFormOptions } from '../tt-form';
|
|
3
4
|
declare function __VLS_template(): {
|
|
4
5
|
attrs: Partial<{}>;
|
|
5
6
|
slots: Readonly<{
|
|
@@ -17,20 +18,21 @@ declare function __VLS_template(): {
|
|
|
17
18
|
rootEl: any;
|
|
18
19
|
};
|
|
19
20
|
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
20
|
-
declare const __VLS_component: import('vue').DefineComponent<Partial<TtModalFormProps
|
|
21
|
+
declare const __VLS_component: import('vue').DefineComponent<Partial<TtModalFormProps<ModalFormType>>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
21
22
|
submit: (data: Recordable) => any;
|
|
22
23
|
fetch: (data: Recordable) => any;
|
|
23
24
|
getinfo: (data: any) => any;
|
|
24
|
-
}, string, import('vue').PublicProps, Readonly<Partial<TtModalFormProps
|
|
25
|
+
}, string, import('vue').PublicProps, Readonly<Partial<TtModalFormProps<ModalFormType>>> & Readonly<{
|
|
25
26
|
onSubmit?: ((data: Recordable) => any) | undefined;
|
|
26
27
|
onFetch?: ((data: Recordable) => any) | undefined;
|
|
27
28
|
onGetinfo?: ((data: any) => any) | undefined;
|
|
28
29
|
}>, {
|
|
30
|
+
renderType: ModalFormType;
|
|
29
31
|
dataField: string;
|
|
30
32
|
infoApiIdKey: string;
|
|
31
33
|
infoApiParams: globalThis.Recordable;
|
|
32
34
|
apiParams: globalThis.Recordable;
|
|
33
|
-
formProps: Partial<
|
|
35
|
+
formProps: Partial<TtFormProps<Record<string, any>>> | Partial<UseGroupFormOptions<Record<string, any>>>;
|
|
34
36
|
isContinuousChecked: boolean;
|
|
35
37
|
checkedOptions: Record<string, any>;
|
|
36
38
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as H, useSlots as J, ref as K, computed as C, toValue as Q, nextTick as y, watch as W, createBlock as M, openBlock as B, unref as d, createSlots as P, withCtx as A, renderSlot as h, createVNode as X, renderList as S, normalizeProps as b, guardReactiveProps as V, createCommentVNode as Y } from "vue";
|
|
2
2
|
import "axios";
|
|
3
|
-
import { ElCheckbox as
|
|
4
|
-
import { isFunction as
|
|
3
|
+
import { ElCheckbox as Z, ElMessage as O } from "element-plus";
|
|
4
|
+
import { isFunction as c } from "../../packages/utils/src/is.js";
|
|
5
5
|
import "xe-utils";
|
|
6
6
|
import "dayjs";
|
|
7
7
|
import "dayjs/plugin/utc";
|
|
@@ -11,7 +11,7 @@ import "../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/aes.js";
|
|
|
11
11
|
import "../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/enc-utf8.js";
|
|
12
12
|
import "../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-ecb.js";
|
|
13
13
|
import "../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-pkcs7.js";
|
|
14
|
-
import { get as
|
|
14
|
+
import { get as ee } from "lodash-es";
|
|
15
15
|
import "../tt-select/index.js";
|
|
16
16
|
import "../tt-checkbox/index.js";
|
|
17
17
|
import "../tt-radio-group/index.js";
|
|
@@ -19,30 +19,21 @@ import "../tt-panel-select/index.js";
|
|
|
19
19
|
import "../tt-upload/index.js";
|
|
20
20
|
import "../tt-api-component/index.js";
|
|
21
21
|
import "vee-validate";
|
|
22
|
-
import { useForm as
|
|
22
|
+
import { useForm as oe } from "../tt-form/src/useForm.js";
|
|
23
23
|
import "zod";
|
|
24
24
|
import "@vee-validate/zod";
|
|
25
25
|
import "@tanstack/vue-store";
|
|
26
26
|
import "es-toolkit/compat";
|
|
27
27
|
import "../tt-form/src/shared/zod-defaults.js";
|
|
28
|
-
import "../tt-
|
|
29
|
-
import "../../node_modules/.pnpm/vue-types@5.1.3_vue@3.5.21_typescript@5.9.3_/node_modules/vue-types/shim/index.modern.js";
|
|
30
|
-
import "../tt-icon/index.js";
|
|
31
|
-
import "../tt-form/src/components/Slot.js";
|
|
32
|
-
import "../tt-form-item-error-tooltip/index.js";
|
|
33
|
-
import "@vueuse/core";
|
|
34
|
-
/* empty css */
|
|
35
|
-
import "../tt-form/src/form/RenderContent.vue.js";
|
|
36
|
-
import "../tt-form/src/form-render/FormFieldContact.js";
|
|
37
|
-
/* empty css */
|
|
38
|
-
/* empty css */
|
|
28
|
+
import { useGroupForm as te } from "../tt-form/src/group-form/useGroupForm.js";
|
|
39
29
|
import "../tt-modal/index.js";
|
|
40
|
-
import { useModalFormSlot as
|
|
41
|
-
import { useModalRender as
|
|
42
|
-
const
|
|
30
|
+
import { useModalFormSlot as ie } from "./hooks/useModalFormSlot.js";
|
|
31
|
+
import { useModalRender as ne } from "../tt-modal/src/hooks/useModalRender.js";
|
|
32
|
+
const Ee = /* @__PURE__ */ H({
|
|
43
33
|
name: "TtModalForm",
|
|
44
34
|
__name: "index",
|
|
45
35
|
props: {
|
|
36
|
+
renderType: { default: "form" },
|
|
46
37
|
model: {},
|
|
47
38
|
addApi: {},
|
|
48
39
|
editApi: {},
|
|
@@ -63,12 +54,12 @@ const Ue = /* @__PURE__ */ G({
|
|
|
63
54
|
checkedOptions: { default: () => ({}) }
|
|
64
55
|
},
|
|
65
56
|
emits: ["submit", "fetch", "getinfo"],
|
|
66
|
-
setup(I, { emit:
|
|
67
|
-
var
|
|
68
|
-
const o = I,
|
|
57
|
+
setup(I, { emit: D }) {
|
|
58
|
+
var w, F;
|
|
59
|
+
const o = I, m = D, L = J(), f = K(), r = K(!1), { getFormSlotKeys: T, getModalSlotKeys: E, replaceFormSlotKey: R, replaceModalSlotKey: _ } = ie(L), x = C(() => E.value.filter(Boolean)), $ = C(() => T.value.filter(Boolean)), v = {
|
|
69
60
|
showDefaultActions: !1,
|
|
70
|
-
...
|
|
71
|
-
}
|
|
61
|
+
...Q(o.formProps)
|
|
62
|
+
}, [z, s] = o.renderType === "groupForm" ? te(v) : oe(v), [N, a] = ne({
|
|
72
63
|
...o.modalProps,
|
|
73
64
|
onReceiveSharedData: async (e) => {
|
|
74
65
|
if (!e) {
|
|
@@ -77,8 +68,8 @@ const Ue = /* @__PURE__ */ G({
|
|
|
77
68
|
}
|
|
78
69
|
if (e.schemas && s.setState({ schema: e.schemas }), e != null && e.title && a.setModalProps({ title: e.title }), f.value = e[o.infoApiIdKey], e != null && e[o.infoApiIdKey]) {
|
|
79
70
|
const i = o.infoApi;
|
|
80
|
-
if (!
|
|
81
|
-
|
|
71
|
+
if (!c(i)) {
|
|
72
|
+
g(e);
|
|
82
73
|
return;
|
|
83
74
|
}
|
|
84
75
|
a.changeLoading(!0);
|
|
@@ -86,56 +77,56 @@ const Ue = /* @__PURE__ */ G({
|
|
|
86
77
|
const t = {
|
|
87
78
|
...o.infoApiParams,
|
|
88
79
|
[o.infoApiIdKey]: e[o.infoApiIdKey]
|
|
89
|
-
}, n =
|
|
90
|
-
|
|
80
|
+
}, n = c(o.infoApiBefore) ? await o.infoApiBefore(t) : t, l = await i(n), p = o.dataField ? ee(l, o.dataField) : l, u = c(o.infoApiAfter) ? await o.infoApiAfter(p) : p;
|
|
81
|
+
k(u), m("getinfo", u), await y(), await s.resetForm({ values: u });
|
|
91
82
|
} finally {
|
|
92
83
|
a.changeLoading(!1);
|
|
93
84
|
}
|
|
94
85
|
} else
|
|
95
|
-
|
|
86
|
+
g(e);
|
|
96
87
|
},
|
|
97
88
|
async onOk() {
|
|
98
89
|
await q();
|
|
99
90
|
}
|
|
100
91
|
});
|
|
101
|
-
function
|
|
92
|
+
function g(e) {
|
|
102
93
|
const i = e[o.infoDataKey || ""] || {};
|
|
103
|
-
|
|
94
|
+
k(i), y(() => {
|
|
104
95
|
s.resetForm({ values: i });
|
|
105
96
|
});
|
|
106
97
|
}
|
|
107
|
-
function
|
|
98
|
+
function k(e) {
|
|
108
99
|
const i = Object.keys(o.checkedOptions || {});
|
|
109
100
|
i.length && i.forEach((t) => {
|
|
110
|
-
var
|
|
111
|
-
const n = (
|
|
101
|
+
var u;
|
|
102
|
+
const n = (u = o.checkedOptions) == null ? void 0 : u[t];
|
|
112
103
|
if (!Array.isArray(n) || n.length === 0)
|
|
113
104
|
return;
|
|
114
|
-
const [l,
|
|
115
|
-
!l || !
|
|
105
|
+
const [l, p] = n.length === 1 ? [n[0], n[0]] : n;
|
|
106
|
+
!l || !p || (e[t] = {
|
|
116
107
|
label: e[l],
|
|
117
|
-
value: e[
|
|
108
|
+
value: e[p]
|
|
118
109
|
});
|
|
119
110
|
});
|
|
120
111
|
}
|
|
121
|
-
async function
|
|
112
|
+
async function j() {
|
|
122
113
|
const e = await s.getValues(), { apiParams: i } = o;
|
|
123
114
|
let t = {
|
|
124
115
|
...e,
|
|
125
116
|
...i
|
|
126
117
|
};
|
|
127
|
-
return t =
|
|
118
|
+
return t = c(o.saveApiBefore) ? await o.saveApiBefore(t) : t, { reqParams: t, formValue: e };
|
|
128
119
|
}
|
|
129
|
-
async function
|
|
120
|
+
async function G(e, i) {
|
|
130
121
|
const { editApi: t } = o;
|
|
131
|
-
!t || !
|
|
122
|
+
!t || !c(t) || (e[o.infoApiIdKey] = f.value, await t(e, i.files), O.success("修改成功"), m("submit", {
|
|
132
123
|
...e,
|
|
133
124
|
continuousChecked: r.value
|
|
134
125
|
}), a.closeModal());
|
|
135
126
|
}
|
|
136
127
|
async function U(e, i) {
|
|
137
128
|
const { addApi: t } = o;
|
|
138
|
-
!t || !
|
|
129
|
+
!t || !c(t) || (await t(e, i.files), O.success("新增成功"), m("submit", {
|
|
139
130
|
...e,
|
|
140
131
|
continuousChecked: r.value
|
|
141
132
|
}), (!r.value || !o.isContinuousChecked) && a.closeModal());
|
|
@@ -145,24 +136,24 @@ const Ue = /* @__PURE__ */ G({
|
|
|
145
136
|
try {
|
|
146
137
|
const { valid: e } = await s.validate();
|
|
147
138
|
if (!e) return;
|
|
148
|
-
const { reqParams: i, formValue: t } = await
|
|
139
|
+
const { reqParams: i, formValue: t } = await j();
|
|
149
140
|
if (!i)
|
|
150
141
|
return;
|
|
151
142
|
const { addApi: n, editApi: l } = o;
|
|
152
143
|
if (!n && !l) {
|
|
153
|
-
|
|
144
|
+
m("submit", {
|
|
154
145
|
...i,
|
|
155
146
|
[o.infoApiIdKey]: f.value,
|
|
156
147
|
continuousChecked: r.value
|
|
157
148
|
});
|
|
158
149
|
return;
|
|
159
150
|
}
|
|
160
|
-
f.value ? await
|
|
151
|
+
f.value ? await G(i, t) : await U(i, t);
|
|
161
152
|
} finally {
|
|
162
153
|
a.changeOkLoading(!1);
|
|
163
154
|
}
|
|
164
155
|
}
|
|
165
|
-
return (
|
|
156
|
+
return (w = o.getFormApi) == null || w.call(o, s), (F = o.getModalApi) == null || F.call(o, a), W(
|
|
166
157
|
() => {
|
|
167
158
|
var e;
|
|
168
159
|
return (e = a.getVisible) == null ? void 0 : e.value;
|
|
@@ -171,42 +162,42 @@ const Ue = /* @__PURE__ */ G({
|
|
|
171
162
|
if (e) {
|
|
172
163
|
await y();
|
|
173
164
|
const i = await s.getValues();
|
|
174
|
-
|
|
165
|
+
m("fetch", i);
|
|
175
166
|
} else
|
|
176
167
|
r.value = !1;
|
|
177
168
|
}
|
|
178
|
-
), (e, i) => (
|
|
169
|
+
), (e, i) => (B(), M(d(N), null, P({
|
|
179
170
|
insertFooter: A(() => [
|
|
180
|
-
o.isContinuousChecked && !f.value ? (
|
|
171
|
+
o.isContinuousChecked && !f.value ? (B(), M(d(Z), {
|
|
181
172
|
key: 0,
|
|
182
173
|
modelValue: r.value,
|
|
183
174
|
"onUpdate:modelValue": i[0] || (i[0] = (t) => r.value = t),
|
|
184
175
|
label: "连续添加",
|
|
185
176
|
size: "small"
|
|
186
|
-
}, null, 8, ["modelValue"])) :
|
|
177
|
+
}, null, 8, ["modelValue"])) : Y("", !0)
|
|
187
178
|
]),
|
|
188
179
|
default: A(() => [
|
|
189
180
|
h(e.$slots, "BasicMsgTop"),
|
|
190
|
-
|
|
191
|
-
|
|
181
|
+
X(d(z), null, P({ _: 2 }, [
|
|
182
|
+
S($.value, (t) => ({
|
|
192
183
|
name: d(R)(t),
|
|
193
184
|
fn: A((n) => [
|
|
194
|
-
h(e.$slots, t,
|
|
185
|
+
h(e.$slots, t, b(V(n)))
|
|
195
186
|
])
|
|
196
187
|
}))
|
|
197
188
|
]), 1024)
|
|
198
189
|
]),
|
|
199
190
|
_: 2
|
|
200
191
|
}, [
|
|
201
|
-
|
|
192
|
+
S(x.value, (t) => ({
|
|
202
193
|
name: d(_)(t),
|
|
203
194
|
fn: A((n) => [
|
|
204
|
-
h(e.$slots, t,
|
|
195
|
+
h(e.$slots, t, b(V(n)))
|
|
205
196
|
])
|
|
206
197
|
}))
|
|
207
198
|
]), 1024));
|
|
208
199
|
}
|
|
209
200
|
});
|
|
210
201
|
export {
|
|
211
|
-
|
|
202
|
+
Ee as default
|
|
212
203
|
};
|
|
@@ -1,6 +1,14 @@
|
|
|
1
|
-
import { TtExtendedFormApi, TtFormProps } from '../tt-form';
|
|
1
|
+
import { GroupFormApi, TtExtendedFormApi, TtFormProps, UseGroupFormOptions } from '../tt-form';
|
|
2
2
|
import { ModalApiOptions, TtModalExtendedModalApi } from '../tt-modal';
|
|
3
|
-
|
|
3
|
+
/** modal-form 使用的表单类型。 */
|
|
4
|
+
export type ModalFormType = "form" | "groupForm";
|
|
5
|
+
/** modal-form 对外暴露的表单 API 类型。 */
|
|
6
|
+
export type ModalFormApi<TType extends ModalFormType = "form"> = TType extends "groupForm" ? GroupFormApi : TtExtendedFormApi;
|
|
7
|
+
/** 根据表单类型收窄的表单配置。 */
|
|
8
|
+
type ModalFormProps<TValues extends Record<string, any>, TType extends ModalFormType> = TType extends "groupForm" ? Partial<UseGroupFormOptions<TValues>> : Partial<TtFormProps<TValues>>;
|
|
9
|
+
export type TtModalFormProps<TType extends ModalFormType = "form", TValues extends Record<string, any> = Record<string, any>> = {
|
|
10
|
+
/** 表单渲染类型,默认使用普通表单 */
|
|
11
|
+
renderType?: TType;
|
|
4
12
|
/** model */
|
|
5
13
|
model?: Recordable;
|
|
6
14
|
/** 新增保存接口 */
|
|
@@ -24,7 +32,7 @@ export type TtModalFormProps = {
|
|
|
24
32
|
/** 保存额外参数 */
|
|
25
33
|
apiParams?: Recordable;
|
|
26
34
|
/** formProps */
|
|
27
|
-
formProps?:
|
|
35
|
+
formProps?: ModalFormProps<TValues, TType>;
|
|
28
36
|
/** 是否连续添加 */
|
|
29
37
|
isContinuousChecked?: boolean;
|
|
30
38
|
/** 响应结果集字段 */
|
|
@@ -32,9 +40,10 @@ export type TtModalFormProps = {
|
|
|
32
40
|
/** modal props */
|
|
33
41
|
modalProps?: ModalApiOptions;
|
|
34
42
|
/** 获取formApi的回调 */
|
|
35
|
-
getFormApi?: (api:
|
|
43
|
+
getFormApi?: (api: ModalFormApi<TType>) => void;
|
|
36
44
|
/** 获取modalApi的回调 */
|
|
37
45
|
getModalApi?: (api: TtModalExtendedModalApi) => void;
|
|
38
46
|
/** 处理TtSelect(非多选回显值) */
|
|
39
47
|
checkedOptions?: Record<string, any>;
|
|
40
48
|
};
|
|
49
|
+
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { TtModalExtendedModalApi } from '../tt-modal';
|
|
2
|
-
import { TtModalFormProps } from './props';
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
import { ModalFormApi, ModalFormType, TtModalFormProps } from './props';
|
|
3
|
+
/** 创建普通表单或分组表单的弹窗表单。 */
|
|
4
|
+
export declare function useModalForm<TType extends ModalFormType = "form", TValues extends Record<string, any> = Record<string, any>>(options: TtModalFormProps<TType, TValues>): readonly [import('vue').DefineSetupFnComponent<Partial<TtModalFormProps<ModalFormType>>, {}, {}, Partial<TtModalFormProps<ModalFormType>> & {}, import('vue').PublicProps>, {
|
|
5
|
+
readonly formApi: import('vue').Ref<ModalFormApi<TType> | undefined, ModalFormApi<TType> | undefined>;
|
|
5
6
|
readonly modalApi: import('vue').Ref<TtModalExtendedModalApi | undefined, TtModalExtendedModalApi | undefined>;
|
|
6
7
|
}];
|