@aplus-frontend/ui 0.0.4 → 0.0.5
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/es/src/ap-form/ap-form-item-group/index.vue.mjs +23 -21
- package/es/src/ap-form/ap-form.vue.d.ts +7 -2
- package/es/src/ap-form/ap-form.vue2.mjs +85 -52
- package/es/src/ap-form/context.d.ts +14 -0
- package/es/src/ap-form/hooks/use-watch.d.ts +7 -0
- package/es/src/ap-form/hooks/use-watch.mjs +30 -0
- package/es/src/ap-form/index.d.ts +2 -0
- package/es/src/ap-form/index.mjs +13 -11
- package/es/src/ap-form/interface.d.ts +17 -7
- package/es/src/ap-form/modal-form/index.vue.d.ts +2 -2
- package/es/src/ap-form/modal-form/index.vue.mjs +1 -1
- package/es/src/ap-form/search-form/index.vue.mjs +27 -27
- package/es/src/ap-table/ap-table.vue.d.ts +2 -0
- package/es/src/ap-table/ap-table.vue.mjs +98 -93
- package/es/src/ap-table/interface.d.ts +18 -1
- package/es/src/pro-form/helper.mjs +7 -7
- package/es/src/theme/antd-global-overwrite/admin/alert.css +3 -0
- package/es/src/theme/antd-global-overwrite/admin/index.css +3 -0
- package/es/src/theme/antd-global-overwrite/aplus/alert.css +3 -0
- package/es/src/theme/antd-global-overwrite/aplus/index.css +3 -0
- package/es/src/utils/index.mjs +32 -32
- package/lib/src/ap-form/ap-form-item-group/index.vue.js +1 -1
- package/lib/src/ap-form/ap-form.vue.d.ts +7 -2
- package/lib/src/ap-form/ap-form.vue2.js +1 -1
- package/lib/src/ap-form/context.d.ts +14 -0
- package/lib/src/ap-form/hooks/use-watch.d.ts +7 -0
- package/lib/src/ap-form/hooks/use-watch.js +1 -0
- package/lib/src/ap-form/index.d.ts +2 -0
- package/lib/src/ap-form/index.js +1 -1
- package/lib/src/ap-form/interface.d.ts +17 -7
- package/lib/src/ap-form/modal-form/index.vue.d.ts +2 -2
- package/lib/src/ap-form/modal-form/index.vue.js +1 -1
- package/lib/src/ap-form/search-form/index.vue.js +1 -1
- package/lib/src/ap-table/ap-table.vue.d.ts +2 -0
- package/lib/src/ap-table/ap-table.vue.js +1 -1
- package/lib/src/ap-table/interface.d.ts +18 -1
- package/lib/src/pro-form/helper.js +1 -1
- package/lib/src/theme/antd-global-overwrite/admin/alert.css +3 -0
- package/lib/src/theme/antd-global-overwrite/admin/index.css +3 -0
- package/lib/src/theme/antd-global-overwrite/aplus/alert.css +3 -0
- package/lib/src/theme/antd-global-overwrite/aplus/index.css +3 -0
- package/lib/src/utils/index.js +1 -1
- package/package.json +2 -2
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { isVNode as w, defineComponent as _, useSlots as k, watch as b,
|
|
2
|
-
import { Col as
|
|
3
|
-
import { pick as
|
|
4
|
-
import { apFormItemColPropKeys as
|
|
5
|
-
import { genRealChildren as
|
|
1
|
+
import { isVNode as w, defineComponent as _, useSlots as k, watch as b, onBeforeUpdate as h, shallowRef as x, computed as B, unref as p, createVNode as R, mergeProps as m, openBlock as s, createBlock as i, withCtx as S, createElementBlock as j, Fragment as v, renderList as N, resolveDynamicComponent as P } from "vue";
|
|
2
|
+
import { Col as F, Row as I } from "ant-design-vue";
|
|
3
|
+
import { pick as O } from "lodash-unified";
|
|
4
|
+
import { apFormItemColPropKeys as V } from "../constant.mjs";
|
|
5
|
+
import { genRealChildren as l, buildColSpan as A } from "./helper.mjs";
|
|
6
6
|
import "../../config-provider/index.mjs";
|
|
7
7
|
import "../style/ap-form-item-group.css";
|
|
8
|
-
import { useNamespace as
|
|
9
|
-
function
|
|
8
|
+
import { useNamespace as D } from "../../config-provider/hooks/use-namespace.mjs";
|
|
9
|
+
function E(r) {
|
|
10
10
|
return typeof r == "function" || Object.prototype.toString.call(r) === "[object Object]" && !w(r);
|
|
11
11
|
}
|
|
12
12
|
const M = /* @__PURE__ */ _({
|
|
@@ -29,28 +29,30 @@ const M = /* @__PURE__ */ _({
|
|
|
29
29
|
},
|
|
30
30
|
setup(r) {
|
|
31
31
|
const {
|
|
32
|
-
b:
|
|
33
|
-
} =
|
|
32
|
+
b: c
|
|
33
|
+
} = D("ap-form-item-group"), {
|
|
34
34
|
countPerRow: f,
|
|
35
35
|
...d
|
|
36
|
-
} = r,
|
|
37
|
-
b(() =>
|
|
38
|
-
|
|
36
|
+
} = r, n = k();
|
|
37
|
+
b(() => n.default(), (e) => {
|
|
38
|
+
a.value = l(e);
|
|
39
|
+
}), h(() => {
|
|
40
|
+
a.value = l(n.default());
|
|
39
41
|
});
|
|
40
|
-
const
|
|
41
|
-
const t = e.props, o =
|
|
42
|
-
return R(
|
|
43
|
-
key:
|
|
42
|
+
const a = x(l(n.default())), y = B(() => p(a).map((e, u) => {
|
|
43
|
+
const t = e.props, o = O(t, V), C = o != null && o.span ? {} : A(f), g = !!(t != null && t.hidden);
|
|
44
|
+
return R(F, m({
|
|
45
|
+
key: u
|
|
44
46
|
}, C, o, {
|
|
45
|
-
class: g ?
|
|
46
|
-
}),
|
|
47
|
+
class: g ? c("col-hidden") : ""
|
|
48
|
+
}), E(e) ? e : {
|
|
47
49
|
default: () => [e]
|
|
48
50
|
});
|
|
49
51
|
}));
|
|
50
|
-
return (e,
|
|
51
|
-
class:
|
|
52
|
+
return (e, u) => (s(), i(p(I), m({
|
|
53
|
+
class: p(c)()
|
|
52
54
|
}, d), {
|
|
53
|
-
default: S(() => [(
|
|
55
|
+
default: S(() => [(s(!0), j(v, null, N(y.value, (t, o) => (s(), i(P(t), {
|
|
54
56
|
key: o
|
|
55
57
|
}))), 128))]),
|
|
56
58
|
_: 1
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
import { ApFormProps } from './interface';
|
|
1
|
+
import { ApFormProps, WatchFunc } from './interface';
|
|
2
2
|
import { InternalNamePath, NamePath, ValidateOptions, FormLabelAlign } from 'ant-design-vue/es/form/interface';
|
|
3
3
|
import { DefineComponent, ComponentOptionsMixin, PublicProps, ExtractPropTypes, PropType } from 'vue';
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* 订阅事件
|
|
7
|
+
*/
|
|
8
|
+
declare function registerWatch(callback: WatchFunc): () => void;
|
|
5
9
|
declare const _default: __VLS_WithTemplateSlots< DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<ApFormProps>, {
|
|
6
10
|
layout: string;
|
|
7
11
|
hideRequiredMark: boolean;
|
|
@@ -23,7 +27,8 @@ declare const _default: __VLS_WithTemplateSlots< DefineComponent<__VLS_WithDefau
|
|
|
23
27
|
}> | undefined;
|
|
24
28
|
scrollToField: (name: NamePath, options?: {}) => void;
|
|
25
29
|
setFieldsValue: (values: Record<string, any>) => void;
|
|
26
|
-
setFieldValue: (key:
|
|
30
|
+
setFieldValue: (key: any, newValue: any) => void;
|
|
31
|
+
registerWatch: typeof registerWatch;
|
|
27
32
|
}, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly< ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<ApFormProps>, {
|
|
28
33
|
layout: string;
|
|
29
34
|
hideRequiredMark: boolean;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { Form as
|
|
3
|
-
import { useProvideForm as
|
|
4
|
-
import { isArray as
|
|
5
|
-
const
|
|
1
|
+
import { defineComponent as b, ref as k, reactive as x, computed as M, openBlock as R, createBlock as T, unref as W, mergeProps as q, withCtx as w, renderSlot as z } from "vue";
|
|
2
|
+
import { Form as A } from "ant-design-vue";
|
|
3
|
+
import { useProvideForm as E } from "./context.mjs";
|
|
4
|
+
import { isArray as y } from "lodash-unified";
|
|
5
|
+
const I = /* @__PURE__ */ b({
|
|
6
6
|
__name: "ap-form",
|
|
7
7
|
props: {
|
|
8
|
-
initialValues: {},
|
|
9
8
|
layout: { default: "horizontal" },
|
|
10
9
|
labelCol: {},
|
|
11
10
|
wrapperCol: {},
|
|
@@ -28,62 +27,96 @@ const S = /* @__PURE__ */ u({
|
|
|
28
27
|
onFieldsChange: {},
|
|
29
28
|
onFinish: {},
|
|
30
29
|
onFinishFailed: {},
|
|
31
|
-
onValidate: {}
|
|
30
|
+
onValidate: {},
|
|
31
|
+
initialValues: {}
|
|
32
32
|
},
|
|
33
|
-
setup(
|
|
34
|
-
const
|
|
35
|
-
function
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
33
|
+
setup(C, { expose: B }) {
|
|
34
|
+
const r = C;
|
|
35
|
+
function _(e, t) {
|
|
36
|
+
var V;
|
|
37
|
+
if (y(e)) {
|
|
38
|
+
let u = o;
|
|
39
|
+
for (let d = 0; d < e.length - 1; d++)
|
|
40
|
+
u = u[e[d]];
|
|
41
|
+
u[e[e.length - 1]] = t;
|
|
41
42
|
} else
|
|
42
|
-
o[e] =
|
|
43
|
+
o[e] = t;
|
|
44
|
+
let l = y(e) ? e[0] : e;
|
|
45
|
+
(V = r.onValuesChange) == null || V.call(r, { [l]: o[l] }, o), s();
|
|
43
46
|
}
|
|
44
|
-
const a =
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
|
|
47
|
+
const a = k(), o = x(r.initialValues || {});
|
|
48
|
+
let i = [];
|
|
49
|
+
const f = (e) => {
|
|
50
|
+
var t;
|
|
51
|
+
(t = a.value) == null || t.resetFields(e), s();
|
|
52
|
+
}, c = (e) => {
|
|
53
|
+
var t;
|
|
54
|
+
(t = a.value) == null || t.clearValidate(e);
|
|
55
|
+
}, p = (e, t) => {
|
|
56
|
+
var l;
|
|
57
|
+
return (l = a.value) == null ? void 0 : l.validateFields(e, t);
|
|
58
|
+
}, n = (e) => {
|
|
59
|
+
var t;
|
|
60
|
+
return (t = a.value) == null ? void 0 : t.getFieldsValue(e);
|
|
61
|
+
}, h = (e, t) => {
|
|
62
|
+
var l;
|
|
63
|
+
return (l = a.value) == null ? void 0 : l.validate(e, t);
|
|
64
|
+
}, g = (e, t = {}) => {
|
|
65
|
+
var l;
|
|
66
|
+
(l = a.value) == null || l.scrollToField(e, t);
|
|
67
|
+
}, F = (e) => {
|
|
68
|
+
Object.assign(o, e), s();
|
|
69
|
+
}, m = (e, t) => {
|
|
70
|
+
o[e] = t, s();
|
|
71
|
+
};
|
|
72
|
+
function v(e) {
|
|
73
|
+
return i.push(e), () => {
|
|
74
|
+
i = i.filter((t) => t !== e);
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
function s() {
|
|
78
|
+
if (i.length) {
|
|
79
|
+
const e = n(!0);
|
|
80
|
+
i.forEach((t) => {
|
|
81
|
+
t(e);
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return E({
|
|
86
|
+
model: M(() => o),
|
|
87
|
+
updateModel: _,
|
|
88
|
+
formInstance: {
|
|
89
|
+
resetFields: f,
|
|
90
|
+
clearValidate: c,
|
|
91
|
+
validateFields: p,
|
|
92
|
+
getFieldsValue: n,
|
|
93
|
+
validate: h,
|
|
94
|
+
scrollToField: g,
|
|
95
|
+
setFieldsValue: F,
|
|
96
|
+
setFieldValue: m,
|
|
97
|
+
registerWatch: v
|
|
75
98
|
}
|
|
76
|
-
}), (
|
|
99
|
+
}), B({
|
|
100
|
+
resetFields: f,
|
|
101
|
+
clearValidate: c,
|
|
102
|
+
validateFields: p,
|
|
103
|
+
getFieldsValue: n,
|
|
104
|
+
validate: h,
|
|
105
|
+
scrollToField: g,
|
|
106
|
+
setFieldsValue: F,
|
|
107
|
+
setFieldValue: m,
|
|
108
|
+
registerWatch: v
|
|
109
|
+
}), (e, t) => (R(), T(W(A), q({
|
|
77
110
|
ref_key: "formRef",
|
|
78
111
|
ref: a
|
|
79
|
-
},
|
|
80
|
-
default:
|
|
81
|
-
|
|
112
|
+
}, r, { model: o }), {
|
|
113
|
+
default: w(() => [
|
|
114
|
+
z(e.$slots, "default")
|
|
82
115
|
]),
|
|
83
116
|
_: 3
|
|
84
117
|
}, 16, ["model"]));
|
|
85
118
|
}
|
|
86
119
|
});
|
|
87
120
|
export {
|
|
88
|
-
|
|
121
|
+
I as default
|
|
89
122
|
};
|
|
@@ -1,9 +1,23 @@
|
|
|
1
1
|
import { NamePath } from 'ant-design-vue/es/form/interface';
|
|
2
2
|
import { ComputedRef, InjectionKey } from 'vue';
|
|
3
|
+
import { ApFormExpose } from './interface';
|
|
3
4
|
|
|
4
5
|
type ApFormContextProps<ModelType> = {
|
|
6
|
+
/**
|
|
7
|
+
* Form数据源
|
|
8
|
+
*/
|
|
5
9
|
model?: ComputedRef<ModelType>;
|
|
10
|
+
/**
|
|
11
|
+
* 更新数据源的方法
|
|
12
|
+
* @param name
|
|
13
|
+
* @param value
|
|
14
|
+
* @returns
|
|
15
|
+
*/
|
|
6
16
|
updateModel?: (name: NamePath, value: any) => void;
|
|
17
|
+
/**
|
|
18
|
+
* ApForm内部实例
|
|
19
|
+
*/
|
|
20
|
+
formInstance?: ApFormExpose;
|
|
7
21
|
};
|
|
8
22
|
export declare const ApFormContextKey: InjectionKey<ApFormContextProps<any>>;
|
|
9
23
|
export declare function useProvideForm<ModelType>(state: ApFormContextProps<ModelType>): void;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { NamePath } from 'ant-design-vue/es/form/interface';
|
|
2
|
+
import { ApFormExpose } from '../interface';
|
|
3
|
+
import { Ref } from 'vue';
|
|
4
|
+
|
|
5
|
+
type ApFormIns = ApFormExpose;
|
|
6
|
+
declare const useWatch: <ValueType = any>(name: NamePath, form?: Ref<ApFormIns | undefined>) => Ref<ValueType | undefined>;
|
|
7
|
+
export default useWatch;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { useInjectForm as l } from "../context.mjs";
|
|
2
|
+
import { ref as g, watchEffect as h } from "vue";
|
|
3
|
+
import { isArray as S } from "lodash-unified";
|
|
4
|
+
function V(t, r) {
|
|
5
|
+
return S(r) ? r.reduce((e, n) => e == null ? void 0 : e[n], t) : t == null ? void 0 : t[r];
|
|
6
|
+
}
|
|
7
|
+
function w(t) {
|
|
8
|
+
try {
|
|
9
|
+
return JSON.stringify(t);
|
|
10
|
+
} catch {
|
|
11
|
+
return Math.random();
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
const M = (t, r) => {
|
|
15
|
+
const { formInstance: e } = l(), n = g();
|
|
16
|
+
let c = "";
|
|
17
|
+
return h((s) => {
|
|
18
|
+
const u = (r == null ? void 0 : r.value) || e;
|
|
19
|
+
if (!u)
|
|
20
|
+
return;
|
|
21
|
+
const o = u.registerWatch((f) => {
|
|
22
|
+
const a = V(f, t), i = w(a);
|
|
23
|
+
i !== c && (n.value = a, c = i);
|
|
24
|
+
});
|
|
25
|
+
s(o);
|
|
26
|
+
}), n;
|
|
27
|
+
};
|
|
28
|
+
export {
|
|
29
|
+
M as default
|
|
30
|
+
};
|
|
@@ -4,6 +4,7 @@ import { default as ApFormItemGroup } from './ap-form-item-group/index.vue';
|
|
|
4
4
|
import { default as ApFormList } from './ap-form-list.vue';
|
|
5
5
|
import { default as ApFormSearchForm } from './search-form/index.vue';
|
|
6
6
|
import { default as ApFormModalForm } from './modal-form/index.vue';
|
|
7
|
+
import { default as useWatch } from './hooks/use-watch';
|
|
7
8
|
|
|
8
9
|
type ApFormMixedProps = typeof _ApForm & {
|
|
9
10
|
FormItem: typeof ApFormItem;
|
|
@@ -11,6 +12,7 @@ type ApFormMixedProps = typeof _ApForm & {
|
|
|
11
12
|
FormList: typeof ApFormList;
|
|
12
13
|
SearchForm: typeof ApFormSearchForm;
|
|
13
14
|
ModalForm: typeof ApFormModalForm;
|
|
15
|
+
useWatch: typeof useWatch;
|
|
14
16
|
};
|
|
15
17
|
declare const ApForm: ApFormMixedProps;
|
|
16
18
|
export * from './items';
|
package/es/src/ap-form/index.mjs
CHANGED
|
@@ -4,25 +4,27 @@ import "./ap-form-item-group/index.vue2.mjs";
|
|
|
4
4
|
import "./ap-form-list.vue2.mjs";
|
|
5
5
|
import "./search-form/index.vue2.mjs";
|
|
6
6
|
import "./modal-form/index.vue2.mjs";
|
|
7
|
+
import o from "./hooks/use-watch.mjs";
|
|
7
8
|
import "./items/index.mjs";
|
|
8
9
|
import "./interface.mjs";
|
|
9
|
-
import
|
|
10
|
-
import
|
|
10
|
+
import r from "./ap-form.vue2.mjs";
|
|
11
|
+
import t from "./ap-form-item.vue.mjs";
|
|
11
12
|
import p from "./ap-form-item-group/index.vue.mjs";
|
|
12
13
|
import i from "./ap-form-list.vue.mjs";
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
const m =
|
|
16
|
-
m.FormItem =
|
|
14
|
+
import a from "./search-form/index.vue.mjs";
|
|
15
|
+
import s from "./modal-form/index.vue.mjs";
|
|
16
|
+
const m = r;
|
|
17
|
+
m.FormItem = t;
|
|
17
18
|
m.FormItemGroup = p;
|
|
18
19
|
m.FormList = i;
|
|
19
|
-
m.SearchForm =
|
|
20
|
-
m.ModalForm =
|
|
20
|
+
m.SearchForm = a;
|
|
21
|
+
m.ModalForm = s;
|
|
22
|
+
m.useWatch = o;
|
|
21
23
|
export {
|
|
22
24
|
m as ApForm,
|
|
23
|
-
|
|
25
|
+
t as ApFormItem,
|
|
24
26
|
p as ApFormItemGroup,
|
|
25
27
|
i as ApFormList,
|
|
26
|
-
|
|
27
|
-
|
|
28
|
+
s as ApFormModalForm,
|
|
29
|
+
a as ApFormSearchForm
|
|
28
30
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ButtonProps, ColProps, FormItemProps, FormProps, ModalProps, RowProps } from 'ant-design-vue';
|
|
2
2
|
import { FormItemExpose } from 'ant-design-vue/es/form/FormItem';
|
|
3
|
-
import { NamePath, ValidateOptions } from 'ant-design-vue/es/form/interface';
|
|
3
|
+
import { InternalNamePath, NamePath, ValidateOptions } from 'ant-design-vue/es/form/interface';
|
|
4
|
+
import { Recordable } from '../type';
|
|
4
5
|
|
|
5
6
|
export type ApFormColProps = Omit<ColProps, 'prefixCls'>;
|
|
6
7
|
export type ApFormItemProps = FormItemProps & Partial<ApFormColProps> & {
|
|
@@ -13,18 +14,27 @@ export type ApFormItemProps = FormItemProps & Partial<ApFormColProps> & {
|
|
|
13
14
|
export type ApFormItemGroupProps = RowProps & {
|
|
14
15
|
countPerRow?: number;
|
|
15
16
|
};
|
|
16
|
-
export type ApFormProps = {
|
|
17
|
-
initialValues?:
|
|
18
|
-
|
|
17
|
+
export type ApFormProps = Omit<FormProps, 'model'> & {
|
|
18
|
+
initialValues?: Recordable;
|
|
19
|
+
/**
|
|
20
|
+
* 字段值更新时触发
|
|
21
|
+
* @param changedValues 更改的字段值
|
|
22
|
+
* @param allValues 更改后的字段值
|
|
23
|
+
* @returns
|
|
24
|
+
*/
|
|
25
|
+
onValuesChange?: (changedValues: Recordable, allValues: Recordable) => void;
|
|
26
|
+
};
|
|
27
|
+
export type WatchFunc = (values?: Recordable) => void;
|
|
19
28
|
export type ApFormExpose<ModelType = any> = {
|
|
20
29
|
setFieldsValue?: (fields: Partial<ModelType>) => void;
|
|
21
30
|
setFieldValue?: (key: keyof ModelType, value: any) => void;
|
|
22
31
|
resetFields: (name?: NamePath) => void;
|
|
23
32
|
clearValidate: (name?: NamePath) => void;
|
|
24
|
-
validateFields: (nameList?: NamePath[] | string, options?: ValidateOptions) => Promise<Partial<ModelType
|
|
25
|
-
getFieldsValue: (nameList?:
|
|
26
|
-
validate: (nameList?: NamePath[] | string, options?: ValidateOptions) => Promise<Partial<ModelType
|
|
33
|
+
validateFields: (nameList?: NamePath[] | string, options?: ValidateOptions) => Promise<Partial<ModelType>> | undefined;
|
|
34
|
+
getFieldsValue: (nameList?: true | InternalNamePath[]) => Partial<ModelType> | undefined;
|
|
35
|
+
validate: (nameList?: NamePath[] | string, options?: ValidateOptions) => Promise<Partial<ModelType>> | undefined;
|
|
27
36
|
scrollToField: (name: NamePath, options?: any) => void;
|
|
37
|
+
registerWatch: (callback: WatchFunc) => () => void;
|
|
28
38
|
};
|
|
29
39
|
export type ApFormItemExpose = FormItemExpose & {
|
|
30
40
|
getFieldValue: () => any;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ApFormModalFormProps, ApFormSubmitterConfig } from '../interface';
|
|
2
2
|
import { VNode, DefineComponent, ComponentOptionsMixin, PublicProps, ExtractPropTypes, PropType, CSSProperties } from 'vue';
|
|
3
|
-
import { NamePath, ValidateOptions, FormLabelAlign } from 'ant-design-vue/es/form/interface';
|
|
3
|
+
import { InternalNamePath, NamePath, ValidateOptions, FormLabelAlign } from 'ant-design-vue/es/form/interface';
|
|
4
4
|
import { VueTypeValidableDef } from '../../../node_modules/vue-types';
|
|
5
5
|
import { LegacyButtonType, ButtonHTMLType } from 'ant-design-vue/es/button/buttonTypes';
|
|
6
6
|
import { ButtonType, ButtonShape, ButtonSize } from 'ant-design-vue/es/button';
|
|
@@ -31,7 +31,7 @@ declare const _default: __VLS_WithTemplateSlots< DefineComponent<__VLS_WithDefau
|
|
|
31
31
|
resetFields: (name?: NamePath | undefined) => void;
|
|
32
32
|
clearValidate: (name?: NamePath | undefined) => void;
|
|
33
33
|
validateFields: (nameList?: string | NamePath[] | undefined, options?: ValidateOptions | undefined) => Promise<Partial<any>> | undefined;
|
|
34
|
-
getFieldsValue: (nameList?: true |
|
|
34
|
+
getFieldsValue: (nameList?: true | InternalNamePath[] | undefined) => Partial<any> | undefined;
|
|
35
35
|
validate: (nameList?: string | NamePath[] | undefined, options?: ValidateOptions | undefined) => Promise<Partial<any>> | undefined;
|
|
36
36
|
scrollToField: (name: NamePath, options?: {}) => void;
|
|
37
37
|
setFieldValue: (key: string, newValue: any) => void;
|
|
@@ -17,7 +17,6 @@ function C(d) {
|
|
|
17
17
|
const xe = /* @__PURE__ */ L({
|
|
18
18
|
__name: "index",
|
|
19
19
|
props: {
|
|
20
|
-
initialValues: {},
|
|
21
20
|
layout: {
|
|
22
21
|
default: "horizontal"
|
|
23
22
|
},
|
|
@@ -59,6 +58,7 @@ const xe = /* @__PURE__ */ L({
|
|
|
59
58
|
onFieldsChange: {},
|
|
60
59
|
onFinishFailed: {},
|
|
61
60
|
onValidate: {},
|
|
61
|
+
initialValues: {},
|
|
62
62
|
open: {
|
|
63
63
|
type: Boolean,
|
|
64
64
|
default: void 0
|
|
@@ -15,14 +15,13 @@ import { useLocale as se } from "../../config-provider/hooks/use-locale.mjs";
|
|
|
15
15
|
import V from "../ap-form-item.vue.mjs";
|
|
16
16
|
import pe from "../ap-form.vue2.mjs";
|
|
17
17
|
import ce from "../ap-form-item-group/index.vue.mjs";
|
|
18
|
-
function ie(
|
|
19
|
-
return typeof
|
|
18
|
+
function ie(i) {
|
|
19
|
+
return typeof i == "function" || Object.prototype.toString.call(i) === "[object Object]" && !J(i);
|
|
20
20
|
}
|
|
21
|
-
const
|
|
21
|
+
const c = 24, Pe = /* @__PURE__ */ K({
|
|
22
22
|
name: "ApFormSearchForm",
|
|
23
23
|
__name: "index",
|
|
24
24
|
props: {
|
|
25
|
-
initialValues: {},
|
|
26
25
|
layout: {
|
|
27
26
|
default: "horizontal"
|
|
28
27
|
},
|
|
@@ -65,6 +64,7 @@ const p = 24, Pe = /* @__PURE__ */ K({
|
|
|
65
64
|
onFinish: {},
|
|
66
65
|
onFinishFailed: {},
|
|
67
66
|
onValidate: {},
|
|
67
|
+
initialValues: {},
|
|
68
68
|
collapse: {
|
|
69
69
|
type: Boolean,
|
|
70
70
|
default: void 0
|
|
@@ -97,12 +97,12 @@ const p = 24, Pe = /* @__PURE__ */ K({
|
|
|
97
97
|
}
|
|
98
98
|
},
|
|
99
99
|
emits: ["update:collapse"],
|
|
100
|
-
setup(
|
|
100
|
+
setup(i, {
|
|
101
101
|
expose: I,
|
|
102
102
|
emit: j
|
|
103
103
|
}) {
|
|
104
104
|
var S;
|
|
105
|
-
const l = Q(), t =
|
|
105
|
+
const l = Q(), t = i, M = j, {
|
|
106
106
|
value: f,
|
|
107
107
|
updateValue: O
|
|
108
108
|
} = ne(t, M, {
|
|
@@ -117,40 +117,40 @@ const p = 24, Pe = /* @__PURE__ */ K({
|
|
|
117
117
|
O(!o(f));
|
|
118
118
|
}
|
|
119
119
|
function L() {
|
|
120
|
-
var e;
|
|
121
|
-
(e = m.value) == null
|
|
120
|
+
var e, n;
|
|
121
|
+
(n = (e = m.value) == null ? void 0 : e.validateFields()) == null || n.then(t.onSubmit);
|
|
122
122
|
}
|
|
123
123
|
function q() {
|
|
124
|
-
var e,
|
|
125
|
-
t.customReset || (
|
|
124
|
+
var e, n, d;
|
|
125
|
+
t.customReset || (n = (e = m.value) == null ? void 0 : e.resetFields) == null || n.call(e), (d = t.onReset) == null || d.call(t);
|
|
126
126
|
}
|
|
127
|
-
const R = v(T(l.default())),
|
|
127
|
+
const R = v(T(l.default())), u = v((S = l.extra) == null ? void 0 : S.call(l)), F = C(() => Math.floor(c / t.countPerRow));
|
|
128
128
|
P(() => l.default(), (e) => {
|
|
129
129
|
R.value = T(e);
|
|
130
130
|
}), P(() => {
|
|
131
131
|
var e;
|
|
132
132
|
return (e = l.extra) == null ? void 0 : e.call(l);
|
|
133
133
|
}, (e) => {
|
|
134
|
-
|
|
134
|
+
u.value = e;
|
|
135
135
|
});
|
|
136
136
|
const z = C(() => {
|
|
137
137
|
let e;
|
|
138
|
-
const
|
|
138
|
+
const n = [...o(R)], d = [], b = [], r = o(F);
|
|
139
139
|
let h = 0;
|
|
140
|
-
|
|
141
|
-
const
|
|
142
|
-
|
|
140
|
+
n.forEach((s) => {
|
|
141
|
+
const p = s.props;
|
|
142
|
+
p != null && p.hidden ? d.push(s) : (h += p.span || r, b.push(s));
|
|
143
143
|
});
|
|
144
|
-
const B =
|
|
144
|
+
const B = c - (h + r) % c, U = B < r ? c : B, x = c - r * (o(u) && !t.extraInAction ? 2 : 1), W = !t.forceExpand && h > x;
|
|
145
145
|
let _ = 0;
|
|
146
|
-
const G = b.map((
|
|
147
|
-
const w =
|
|
148
|
-
return _ += w.span ||
|
|
149
|
-
span: w.span ||
|
|
150
|
-
key: `ApFormSearchFormItem-${
|
|
146
|
+
const G = b.map((s, p) => {
|
|
147
|
+
const w = s.props;
|
|
148
|
+
return _ += w.span || r, Y(s, {
|
|
149
|
+
span: w.span || r,
|
|
150
|
+
key: `ApFormSearchFormItem-${p}`,
|
|
151
151
|
hidden: !t.forceExpand && o(f) && _ > x
|
|
152
152
|
});
|
|
153
|
-
}), H =
|
|
153
|
+
}), H = c - Math.min(x, _) - r;
|
|
154
154
|
return a(Z, null, [G, d, a(V, {
|
|
155
155
|
span: o(F)
|
|
156
156
|
}, {
|
|
@@ -175,21 +175,21 @@ const p = 24, Pe = /* @__PURE__ */ K({
|
|
|
175
175
|
rotate: o(f) ? 90 : -90
|
|
176
176
|
}, null)
|
|
177
177
|
}, null) : null]
|
|
178
|
-
}), t.extraInAction ? o(
|
|
178
|
+
}), t.extraInAction ? o(u) : null]
|
|
179
179
|
})]
|
|
180
|
-
}), !t.extraInAction && o(
|
|
180
|
+
}), !t.extraInAction && o(u) ? a(V, {
|
|
181
181
|
span: o(f) ? H : U
|
|
182
182
|
}, {
|
|
183
183
|
default: () => [a(N, {
|
|
184
184
|
justify: "end"
|
|
185
|
-
}, ie(e = o(
|
|
185
|
+
}, ie(e = o(u)) ? e : {
|
|
186
186
|
default: () => [e]
|
|
187
187
|
})]
|
|
188
188
|
}) : null]);
|
|
189
189
|
});
|
|
190
190
|
return I({
|
|
191
191
|
apForm: C(() => o(m))
|
|
192
|
-
}), (e,
|
|
192
|
+
}), (e, n) => (k(), A(pe, ee({
|
|
193
193
|
class: o($)(),
|
|
194
194
|
ref_key: "apForm",
|
|
195
195
|
ref: m
|
|
@@ -28,6 +28,7 @@ type ApTableSlots = {
|
|
|
28
28
|
* @param fields
|
|
29
29
|
*/
|
|
30
30
|
declare function setSearchFormValues(fields: any): void;
|
|
31
|
+
declare function getSearchFormValues(): Partial<any> | undefined;
|
|
31
32
|
declare const _default: __VLS_WithTemplateSlots< DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<ApTableProps<any, any, "text">>, {
|
|
32
33
|
bordered: boolean;
|
|
33
34
|
childrenColumnName: string;
|
|
@@ -50,6 +51,7 @@ declare const _default: __VLS_WithTemplateSlots< DefineComponent<__VLS_WithDefau
|
|
|
50
51
|
submit: () => void;
|
|
51
52
|
reset: () => void;
|
|
52
53
|
setSearchFormValues: typeof setSearchFormValues;
|
|
54
|
+
getSearchFormValues: typeof getSearchFormValues;
|
|
53
55
|
}, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly< ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<ApTableProps<any, any, "text">>, {
|
|
54
56
|
bordered: boolean;
|
|
55
57
|
childrenColumnName: string;
|