@aplus-frontend/ui 0.3.11 → 0.3.12
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/index.mjs +175 -173
- package/es/src/ap-form/ap-form.vue.d.ts +12 -31
- package/es/src/ap-form/ap-form.vue2.mjs +135 -118
- package/es/src/ap-form/drawer-form/index.vue.d.ts +22 -40
- package/es/src/ap-form/drawer-form/index.vue.mjs +3 -3
- package/es/src/ap-form/index.d.ts +3 -1
- package/es/src/ap-form/index.mjs +26 -22
- package/es/src/ap-form/interface.d.ts +3 -1
- package/es/src/ap-form/modal-form/index.vue.d.ts +23 -41
- package/es/src/ap-form/modal-form/index.vue.mjs +64 -58
- package/es/src/ap-form/provider/context.d.ts +3 -0
- package/es/src/ap-form/provider/context.mjs +17 -0
- package/es/src/ap-form/provider/index.vue.d.ts +19 -0
- package/es/src/ap-form/provider/index.vue.mjs +39 -0
- package/es/src/ap-form/provider/index.vue2.mjs +4 -0
- package/es/src/ap-form/provider/interface.d.ts +22 -0
- package/es/src/ap-form/search-form/index.vue.d.ts +22 -40
- package/es/src/business/ap-table-modal/interface.d.ts +2 -0
- package/es/src/business/ap-table-modal/table-modal.vue2.mjs +50 -48
- package/es/src/index.mjs +152 -150
- package/es/src/utils/slot.mjs +6 -8
- package/lib/index.js +1 -1
- package/lib/src/ap-form/ap-form.vue.d.ts +12 -31
- package/lib/src/ap-form/ap-form.vue2.js +1 -1
- package/lib/src/ap-form/drawer-form/index.vue.d.ts +22 -40
- package/lib/src/ap-form/drawer-form/index.vue.js +1 -1
- package/lib/src/ap-form/index.d.ts +3 -1
- package/lib/src/ap-form/index.js +1 -1
- package/lib/src/ap-form/interface.d.ts +3 -1
- package/lib/src/ap-form/modal-form/index.vue.d.ts +23 -41
- package/lib/src/ap-form/modal-form/index.vue.js +1 -1
- package/lib/src/ap-form/provider/context.d.ts +3 -0
- package/lib/src/ap-form/provider/context.js +1 -0
- package/lib/src/ap-form/provider/index.vue.d.ts +19 -0
- package/lib/src/ap-form/provider/index.vue.js +1 -0
- package/lib/src/ap-form/provider/index.vue2.js +1 -0
- package/lib/src/ap-form/provider/interface.d.ts +22 -0
- package/lib/src/ap-form/search-form/index.vue.d.ts +22 -40
- package/lib/src/business/ap-table-modal/interface.d.ts +2 -0
- package/lib/src/business/ap-table-modal/table-modal.vue2.js +1 -1
- package/lib/src/index.js +1 -1
- package/lib/src/utils/slot.js +1 -1
- package/package.json +3 -3
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { ApFormModalFormProps } from '../interface';
|
|
2
2
|
import { VNode, ComponentInternalInstance, ExtractPropTypes, PropType, HTMLAttributes, VNodeProps, AllowedComponentProps, ComponentCustomProps, Slot, ComponentPublicInstance, ComponentOptionsBase, ComponentOptionsMixin, GlobalComponents, GlobalDirectives, ComponentProvideOptions, DebuggerEvent, nextTick, WatchOptions, WatchStopHandle, ShallowUnwrapRef, ComponentCustomProperties, DefineComponent, PublicProps, CSSProperties } from 'vue';
|
|
3
3
|
import { InternalNamePath, NamePath, ValidateOptions, ValidateMessages, FormLabelAlign, FieldData, ValidateErrorEntity } from '@aplus-frontend/antdv/es/form/interface';
|
|
4
|
+
import { Recordable } from '../../type';
|
|
4
5
|
import { ButtonSize, ButtonType, ButtonShape } from '@aplus-frontend/antdv/es/button';
|
|
5
6
|
import { RequiredMark } from '@aplus-frontend/antdv/es/form/Form';
|
|
6
7
|
import { ColSize } from '@aplus-frontend/antdv/es/grid';
|
|
7
8
|
import { RuleObject } from '@aplus-frontend/antdv/es/form';
|
|
8
9
|
import { Options } from '../../../node_modules/scroll-into-view-if-needed';
|
|
9
|
-
import {
|
|
10
|
-
import { ApFormProps, WatchFunc, RegistedFieldType, ApFormInternalInstance, ApFormSubmitterConfig } from '..';
|
|
10
|
+
import { ApFormProps, ApFormInternalInstance, WatchFunc, ApFormSubmitterConfig } from '..';
|
|
11
11
|
import { OnCleanup } from '@vue/reactivity';
|
|
12
12
|
import { VueTypeValidableDef } from '../../../node_modules/vue-types';
|
|
13
13
|
import { LegacyButtonType, ButtonHTMLType } from '@aplus-frontend/antdv/es/button/buttonTypes';
|
|
@@ -135,27 +135,18 @@ declare function __VLS_template(): {
|
|
|
135
135
|
$emit: (event: string, ...args: any[]) => void;
|
|
136
136
|
$el: any;
|
|
137
137
|
$options: ComponentOptionsBase<Readonly< ApFormProps> & Readonly<{}>, {
|
|
138
|
+
setFieldsValue: (fields: Partial<any>) => void;
|
|
139
|
+
setFieldValue: (name: NamePath, value: any, triggerChange?: boolean) => void;
|
|
138
140
|
resetFields: () => Promise<void>;
|
|
139
|
-
clearValidate: (name?: NamePath
|
|
140
|
-
validateFields: (nameList?: NamePath[] | string, options?: ValidateOptions) => Promise<
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
[key: string]: any;
|
|
148
|
-
}> | undefined;
|
|
149
|
-
scrollToField: (name: NamePath, options?: {}) => void;
|
|
150
|
-
setFieldsValue: (values: Record<string, any>) => void;
|
|
151
|
-
setFieldValue: (name: NamePath, newValue: any, triggerChange?: boolean) => void;
|
|
141
|
+
clearValidate: (name?: NamePath) => void;
|
|
142
|
+
validateFields: (nameList?: NamePath[] | string, options?: ValidateOptions) => Promise<Partial<any>> | undefined;
|
|
143
|
+
getFieldsValue: (nameList?: true | InternalNamePath[]) => Partial<any> | undefined;
|
|
144
|
+
validate: (nameList?: NamePath[] | string, options?: ValidateOptions) => Promise<Partial<any>> | undefined;
|
|
145
|
+
scrollToField: (name: NamePath, options?: any) => void;
|
|
146
|
+
getInternalInstance: (mark: string) => ApFormInternalInstance | undefined;
|
|
147
|
+
validateFieldsReturnTransformed: (nameList?: NamePath[] | string, options?: ValidateOptions) => Promise<Partial<any>> | undefined;
|
|
148
|
+
getFieldsValueTransformed: (nameList?: true | InternalNamePath[]) => Partial<any> | undefined;
|
|
152
149
|
registerWatch: (callback: WatchFunc, inner: boolean) => () => void;
|
|
153
|
-
validateFieldsReturnTransformed: (nameList?: NamePath[] | string, options?: ValidateOptions) => Promise<any>;
|
|
154
|
-
getFieldsValueTransformed: (nameList?: InternalNamePath[] | true) => any;
|
|
155
|
-
getInternalInstance: (mark: string) => {
|
|
156
|
-
registerField: ({ initialValue, name, transform }: RegistedFieldType) => void;
|
|
157
|
-
registerWatch: (callback: WatchFunc, inner: boolean) => () => void;
|
|
158
|
-
} | undefined;
|
|
159
150
|
}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, {
|
|
160
151
|
layout: string;
|
|
161
152
|
colon: boolean;
|
|
@@ -192,28 +183,19 @@ declare function __VLS_template(): {
|
|
|
192
183
|
hideRequiredMark: boolean;
|
|
193
184
|
validateOnRuleChange: boolean;
|
|
194
185
|
syncToUrl: boolean | ((values: Recordable, type: "get" | "set") => Recordable);
|
|
195
|
-
}> & Omit<Readonly< ApFormProps> & Readonly<{}>, "validate" | "resetFields" | "clearValidate" | "validateFields" | "getFieldsValue" | "scrollToField" | "registerWatch" | "setFieldValue" | "
|
|
186
|
+
}> & Omit<Readonly< ApFormProps> & Readonly<{}>, "validate" | "resetFields" | "clearValidate" | "validateFields" | "getFieldsValue" | "scrollToField" | "registerWatch" | "setFieldValue" | ("layout" | "colon" | "labelAlign" | "validateTrigger" | "hideRequiredMark" | "validateOnRuleChange" | "syncToUrl") | "setFieldsValue" | "getInternalInstance" | "validateFieldsReturnTransformed" | "getFieldsValueTransformed"> & ShallowUnwrapRef<{
|
|
187
|
+
setFieldsValue: (fields: Partial<any>) => void;
|
|
188
|
+
setFieldValue: (name: NamePath, value: any, triggerChange?: boolean) => void;
|
|
196
189
|
resetFields: () => Promise<void>;
|
|
197
|
-
clearValidate: (name?: NamePath
|
|
198
|
-
validateFields: (nameList?: NamePath[] | string, options?: ValidateOptions) => Promise<
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
[key: string]: any;
|
|
206
|
-
}> | undefined;
|
|
207
|
-
scrollToField: (name: NamePath, options?: {}) => void;
|
|
208
|
-
setFieldsValue: (values: Record<string, any>) => void;
|
|
209
|
-
setFieldValue: (name: NamePath, newValue: any, triggerChange?: boolean) => void;
|
|
190
|
+
clearValidate: (name?: NamePath) => void;
|
|
191
|
+
validateFields: (nameList?: NamePath[] | string, options?: ValidateOptions) => Promise<Partial<any>> | undefined;
|
|
192
|
+
getFieldsValue: (nameList?: true | InternalNamePath[]) => Partial<any> | undefined;
|
|
193
|
+
validate: (nameList?: NamePath[] | string, options?: ValidateOptions) => Promise<Partial<any>> | undefined;
|
|
194
|
+
scrollToField: (name: NamePath, options?: any) => void;
|
|
195
|
+
getInternalInstance: (mark: string) => ApFormInternalInstance | undefined;
|
|
196
|
+
validateFieldsReturnTransformed: (nameList?: NamePath[] | string, options?: ValidateOptions) => Promise<Partial<any>> | undefined;
|
|
197
|
+
getFieldsValueTransformed: (nameList?: true | InternalNamePath[]) => Partial<any> | undefined;
|
|
210
198
|
registerWatch: (callback: WatchFunc, inner: boolean) => () => void;
|
|
211
|
-
validateFieldsReturnTransformed: (nameList?: NamePath[] | string, options?: ValidateOptions) => Promise<any>;
|
|
212
|
-
getFieldsValueTransformed: (nameList?: InternalNamePath[] | true) => any;
|
|
213
|
-
getInternalInstance: (mark: string) => {
|
|
214
|
-
registerField: ({ initialValue, name, transform }: RegistedFieldType) => void;
|
|
215
|
-
registerWatch: (callback: WatchFunc, inner: boolean) => () => void;
|
|
216
|
-
} | undefined;
|
|
217
199
|
}> & {} & ComponentCustomProperties & {} & {
|
|
218
200
|
$slots: {
|
|
219
201
|
default?(_: {}): any;
|
|
@@ -1,20 +1,21 @@
|
|
|
1
|
-
import { isVNode as q, defineComponent as D, useSlots as L, ref as g, watch as A, cloneVNode as G, computed as I, createVNode as u, mergeProps as p, unref as n, openBlock as F, createElementBlock as W, Fragment as H, withCtx as
|
|
1
|
+
import { isVNode as q, defineComponent as D, useSlots as L, ref as g, watch as A, cloneVNode as G, computed as I, createVNode as u, mergeProps as p, unref as n, openBlock as F, createElementBlock as W, Fragment as H, withCtx as b, renderSlot as P, createTextVNode as J, toDisplayString as K, createElementVNode as Q, normalizeClass as X, createBlock as w, resolveDynamicComponent as x, createCommentVNode as Y } from "vue";
|
|
2
2
|
import { Button as V, Flex as Z, Space as ee, Modal as te } from "@aplus-frontend/antdv";
|
|
3
3
|
import "../ap-form.vue.mjs";
|
|
4
4
|
import "../../hooks/index.mjs";
|
|
5
5
|
import { getSingleVNode as le } from "../../utils/slot.mjs";
|
|
6
6
|
import "../../config-provider/index.mjs";
|
|
7
7
|
import { omit as oe } from "lodash-unified";
|
|
8
|
-
import
|
|
9
|
-
import { useControllableValue as
|
|
8
|
+
import "../item/index.vue2.mjs";
|
|
9
|
+
import { useControllableValue as ae } from "../../hooks/useControllableValue.mjs";
|
|
10
10
|
import { useLocale as ne } from "../../config-provider/hooks/use-locale.mjs";
|
|
11
|
-
import { useGlobalConfig as
|
|
12
|
-
import { useNamespace as
|
|
13
|
-
import
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
import { useGlobalConfig as ie } from "../../config-provider/hooks/use-global-config.mjs";
|
|
12
|
+
import { useNamespace as se } from "../../config-provider/hooks/use-namespace.mjs";
|
|
13
|
+
import re from "../ap-form.vue2.mjs";
|
|
14
|
+
import ue from "../item/index.vue.mjs";
|
|
15
|
+
function N(m) {
|
|
16
|
+
return typeof m == "function" || Object.prototype.toString.call(m) === "[object Object]" && !q(m);
|
|
16
17
|
}
|
|
17
|
-
const
|
|
18
|
+
const Re = /* @__PURE__ */ D({
|
|
18
19
|
__name: "index",
|
|
19
20
|
props: {
|
|
20
21
|
layout: {
|
|
@@ -91,32 +92,32 @@ const Me = /* @__PURE__ */ D({
|
|
|
91
92
|
submitTimeout: {}
|
|
92
93
|
},
|
|
93
94
|
emits: ["update:open"],
|
|
94
|
-
setup(
|
|
95
|
-
expose:
|
|
96
|
-
emit:
|
|
95
|
+
setup(m, {
|
|
96
|
+
expose: _,
|
|
97
|
+
emit: S
|
|
97
98
|
}) {
|
|
98
|
-
const o =
|
|
99
|
-
value:
|
|
100
|
-
updateValue:
|
|
101
|
-
} =
|
|
99
|
+
const o = m, v = L(), M = S, a = g(), c = g(), s = g(!1), {
|
|
100
|
+
value: R,
|
|
101
|
+
updateValue: f
|
|
102
|
+
} = ae(o, M, {
|
|
102
103
|
valuePropName: "open",
|
|
103
104
|
defaultValue: !1
|
|
104
105
|
}), {
|
|
105
|
-
t:
|
|
106
|
-
} = ne(),
|
|
106
|
+
t: y
|
|
107
|
+
} = ne(), h = ie("uiMode", "aplus"), {
|
|
107
108
|
b: j,
|
|
108
109
|
e: C
|
|
109
|
-
} =
|
|
110
|
+
} = se("ap-form-modal-form");
|
|
110
111
|
A(() => a.value, (e) => {
|
|
111
112
|
var t;
|
|
112
113
|
e && c.value && ((t = e.setFieldsValue) == null || t.call(e, c.value), c.value = void 0);
|
|
113
114
|
});
|
|
114
|
-
const
|
|
115
|
+
const T = le(v.trigger), B = T ? G(T, {
|
|
115
116
|
onClick: () => {
|
|
116
|
-
|
|
117
|
+
f(!0);
|
|
117
118
|
}
|
|
118
119
|
}) : null, O = I(() => {
|
|
119
|
-
var t, l, r,
|
|
120
|
+
var t, l, r, d;
|
|
120
121
|
const e = [];
|
|
121
122
|
if (o.submitter === !1)
|
|
122
123
|
return null;
|
|
@@ -125,35 +126,36 @@ const Me = /* @__PURE__ */ D({
|
|
|
125
126
|
e.push(u(V, {
|
|
126
127
|
onClick: k,
|
|
127
128
|
disabled: s.value
|
|
128
|
-
}, N(i =
|
|
129
|
+
}, N(i = y("ap.common.cancelText")) ? i : {
|
|
129
130
|
default: () => [i]
|
|
130
131
|
}));
|
|
131
132
|
}
|
|
132
133
|
return ((t = o.submitter) == null ? void 0 : t.resetButtonProps) !== !1 && e.push(u(V, p(((l = o.submitter) == null ? void 0 : l.resetButtonProps) || {}, {
|
|
133
|
-
key: "
|
|
134
|
+
key: "reset",
|
|
134
135
|
disabled: s.value,
|
|
135
|
-
onClick: U
|
|
136
|
+
onClick: U,
|
|
137
|
+
htmlType: "reset"
|
|
136
138
|
}), {
|
|
137
139
|
default: () => {
|
|
138
140
|
var i;
|
|
139
|
-
return [((i = o.submitter) == null ? void 0 : i.resetText) ||
|
|
141
|
+
return [((i = o.submitter) == null ? void 0 : i.resetText) || y("ap.common.resetText")];
|
|
140
142
|
}
|
|
141
143
|
})), ((r = o.submitter) == null ? void 0 : r.submitButtonProps) !== !1 && e.push(u(V, p({
|
|
142
144
|
type: "primary",
|
|
143
|
-
key: "submit"
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
145
|
+
key: "submit",
|
|
146
|
+
htmlType: "submit"
|
|
147
|
+
}, ((d = o.submitter) == null ? void 0 : d.submitButtonProps) || {}, {
|
|
148
|
+
loading: s.value
|
|
147
149
|
}), {
|
|
148
150
|
default: () => {
|
|
149
151
|
var i;
|
|
150
|
-
return [((i = o.submitter) == null ? void 0 : i.submitText) ||
|
|
152
|
+
return [((i = o.submitter) == null ? void 0 : i.submitText) || y("ap.common.okText")];
|
|
151
153
|
}
|
|
152
154
|
})), u(Z, {
|
|
153
155
|
justify: "flex-end",
|
|
154
|
-
class: C(n(
|
|
156
|
+
class: C(n(h) === "admin" ? "footer-admin" : "footer")
|
|
155
157
|
}, {
|
|
156
|
-
default: () => [
|
|
158
|
+
default: () => [v.submitter ? v.submitter(e) : u(ee, null, N(e) ? e : {
|
|
157
159
|
default: () => [e]
|
|
158
160
|
})]
|
|
159
161
|
});
|
|
@@ -162,31 +164,30 @@ const Me = /* @__PURE__ */ D({
|
|
|
162
164
|
var e, t, l;
|
|
163
165
|
o.submitter !== !1 && ((e = a.value) == null || e.resetFields(), (l = (t = o.submitter) == null ? void 0 : t.onReset) == null || l.call(t));
|
|
164
166
|
}
|
|
165
|
-
async function
|
|
166
|
-
var
|
|
167
|
+
async function $(e) {
|
|
168
|
+
var t, l, r;
|
|
167
169
|
if (o.submitter !== !1)
|
|
168
170
|
try {
|
|
169
|
-
const f = await ((e = a.value) == null ? void 0 : e.validateFields());
|
|
170
171
|
(l = (t = o.submitter) == null ? void 0 : t.onSubmit) == null || l.call(t), s.value = !0;
|
|
171
|
-
const
|
|
172
|
-
if (o.submitTimeout &&
|
|
173
|
-
const
|
|
174
|
-
|
|
175
|
-
clearTimeout(
|
|
172
|
+
const d = (r = o.onFinish) == null ? void 0 : r.call(o, e);
|
|
173
|
+
if (o.submitTimeout && d instanceof Promise) {
|
|
174
|
+
const E = setTimeout(() => s.value = !1, o.submitTimeout);
|
|
175
|
+
d.finally(() => {
|
|
176
|
+
clearTimeout(E), s.value = !1;
|
|
176
177
|
});
|
|
177
178
|
}
|
|
178
|
-
await
|
|
179
|
+
await d && f(!1);
|
|
179
180
|
} finally {
|
|
180
181
|
s.value = !1;
|
|
181
182
|
}
|
|
182
183
|
}
|
|
183
184
|
function k() {
|
|
184
|
-
n(s) ||
|
|
185
|
+
n(s) || f(!1);
|
|
185
186
|
}
|
|
186
|
-
function
|
|
187
|
-
!e && n(s) ||
|
|
187
|
+
function z(e) {
|
|
188
|
+
!e && n(s) || f(e);
|
|
188
189
|
}
|
|
189
|
-
return
|
|
190
|
+
return _({
|
|
190
191
|
resetFields: () => {
|
|
191
192
|
var e;
|
|
192
193
|
(e = a.value) == null || e.resetFields();
|
|
@@ -230,36 +231,41 @@ const Me = /* @__PURE__ */ D({
|
|
|
230
231
|
}), (e, t) => {
|
|
231
232
|
var l;
|
|
232
233
|
return F(), W(H, null, [u(n(te), p(e.modalProps, {
|
|
233
|
-
open: n(
|
|
234
|
+
open: n(R),
|
|
234
235
|
footer: null,
|
|
235
236
|
width: e.width,
|
|
236
237
|
class: n(j)(),
|
|
237
238
|
"body-style": {
|
|
238
239
|
...((l = e.modalProps) == null ? void 0 : l.bodyStyle) || {},
|
|
239
|
-
padding: n(
|
|
240
|
+
padding: n(h) === "admin" ? "0px !important" : "20px !important"
|
|
240
241
|
// 这里使用内联样式目的是为了使用最高优先级覆盖设置的全局样式
|
|
241
242
|
// 使用ModalForm你可能无法再自定义body的样式
|
|
242
243
|
},
|
|
243
|
-
"onUpdate:open":
|
|
244
|
+
"onUpdate:open": z,
|
|
244
245
|
onCancel: k
|
|
245
246
|
}), {
|
|
246
|
-
title:
|
|
247
|
-
default:
|
|
248
|
-
class: X(n(C)(n(y) === "admin" ? "content-admin" : "content"))
|
|
249
|
-
}, [u(ue, p({
|
|
247
|
+
title: b(() => [P(e.$slots, "title", {}, () => [J(K(o.title), 1)])]),
|
|
248
|
+
default: b(() => [u(re, p({
|
|
250
249
|
ref_key: "formRef",
|
|
251
250
|
ref: a
|
|
252
|
-
}, n(oe)(o, ["modalProps", "open", "onUpdate:open", "title", "width", "onFinish", "submitter"])
|
|
253
|
-
|
|
251
|
+
}, n(oe)(o, ["modalProps", "open", "onUpdate:open", "title", "width", "onFinish", "submitter"]), {
|
|
252
|
+
onFinish: $
|
|
253
|
+
}), {
|
|
254
|
+
default: b(() => [Q("div", {
|
|
255
|
+
class: X(n(C)(n(h) === "admin" ? "content-admin" : "content"))
|
|
256
|
+
}, [P(e.$slots, "default")], 2), u(ue, null, {
|
|
257
|
+
default: b(() => [(F(), w(x(O.value)))]),
|
|
258
|
+
_: 1
|
|
259
|
+
})]),
|
|
254
260
|
_: 3
|
|
255
|
-
}, 16)]
|
|
261
|
+
}, 16)]),
|
|
256
262
|
_: 3
|
|
257
|
-
}, 16, ["open", "width", "class", "body-style"]), n(
|
|
263
|
+
}, 16, ["open", "width", "class", "body-style"]), n(B) ? (F(), w(x(n(B)), {
|
|
258
264
|
key: 0
|
|
259
265
|
})) : Y("", !0)], 64);
|
|
260
266
|
};
|
|
261
267
|
}
|
|
262
268
|
});
|
|
263
269
|
export {
|
|
264
|
-
|
|
270
|
+
Re as default
|
|
265
271
|
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { provide as e, inject as t } from "vue";
|
|
2
|
+
const r = Symbol("InternalContextProps"), m = (o) => {
|
|
3
|
+
e(r, o);
|
|
4
|
+
}, n = {
|
|
5
|
+
triggerFormChange: () => {
|
|
6
|
+
},
|
|
7
|
+
triggerFormFinish: () => {
|
|
8
|
+
},
|
|
9
|
+
registerForm: () => {
|
|
10
|
+
},
|
|
11
|
+
unregisterForm: () => {
|
|
12
|
+
}
|
|
13
|
+
}, s = () => t(r, n);
|
|
14
|
+
export {
|
|
15
|
+
s as useInjectFormProvider,
|
|
16
|
+
m as useProvideFormProvider
|
|
17
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ApFormProviderProps } from './interface';
|
|
2
|
+
import { DefineComponent, ComponentOptionsMixin, PublicProps, ComponentProvideOptions } from 'vue';
|
|
3
|
+
declare function __VLS_template(): {
|
|
4
|
+
attrs: Partial<{}>;
|
|
5
|
+
slots: {
|
|
6
|
+
default?(_: {}): any;
|
|
7
|
+
};
|
|
8
|
+
refs: {};
|
|
9
|
+
rootEl: any;
|
|
10
|
+
};
|
|
11
|
+
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
12
|
+
declare const __VLS_component: DefineComponent<ApFormProviderProps, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<ApFormProviderProps> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
|
|
13
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
14
|
+
export default _default;
|
|
15
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
16
|
+
new (): {
|
|
17
|
+
$slots: S;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { defineComponent as s, ref as g, renderSlot as t } from "vue";
|
|
2
|
+
import { useInjectFormProvider as u, useProvideFormProvider as m } from "./context.mjs";
|
|
3
|
+
const h = /* @__PURE__ */ s({
|
|
4
|
+
__name: "index",
|
|
5
|
+
props: {
|
|
6
|
+
onFormChange: { type: Function },
|
|
7
|
+
onFormFinish: { type: Function }
|
|
8
|
+
},
|
|
9
|
+
setup(F) {
|
|
10
|
+
const o = F, n = g({}), e = u();
|
|
11
|
+
return m({
|
|
12
|
+
triggerFormChange(r, i) {
|
|
13
|
+
o != null && o.onFormChange && o.onFormChange(r, {
|
|
14
|
+
changedFields: i,
|
|
15
|
+
forms: n.value
|
|
16
|
+
}), e == null || e.triggerFormChange(r, i);
|
|
17
|
+
},
|
|
18
|
+
triggerFormFinish: (r, i) => {
|
|
19
|
+
o != null && o.onFormFinish && o.onFormFinish(r, {
|
|
20
|
+
values: i,
|
|
21
|
+
forms: n.value
|
|
22
|
+
}), e == null || e.triggerFormFinish(r, i);
|
|
23
|
+
},
|
|
24
|
+
registerForm: (r, i) => {
|
|
25
|
+
r && (n.value = {
|
|
26
|
+
...n.value,
|
|
27
|
+
[r]: i
|
|
28
|
+
}), e == null || e.registerForm(r, i);
|
|
29
|
+
},
|
|
30
|
+
unregisterForm: (r) => {
|
|
31
|
+
const i = { ...n.value };
|
|
32
|
+
delete i[r], n.value = i, e == null || e.unregisterForm(r);
|
|
33
|
+
}
|
|
34
|
+
}), (r, i) => t(r.$slots, "default");
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
export {
|
|
38
|
+
h as default
|
|
39
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Store } from '@aplus-frontend/antdv/es/form/interface';
|
|
2
|
+
import { ApFormExpose } from '../interface';
|
|
3
|
+
export type ApFormInstance = ApFormExpose;
|
|
4
|
+
export type Forms = Record<string, ApFormInstance>;
|
|
5
|
+
export interface ApFormChangeInfo {
|
|
6
|
+
changedFields: any;
|
|
7
|
+
forms: Forms;
|
|
8
|
+
}
|
|
9
|
+
export interface ApFormFinishInfo {
|
|
10
|
+
values: Store;
|
|
11
|
+
forms: Forms;
|
|
12
|
+
}
|
|
13
|
+
export type ApFormProviderProps = {
|
|
14
|
+
onFormChange?: (name: string, info: ApFormChangeInfo) => void;
|
|
15
|
+
onFormFinish?: (name: string, info: ApFormFinishInfo) => void;
|
|
16
|
+
};
|
|
17
|
+
export interface InternalFormProviderContext {
|
|
18
|
+
triggerFormChange: (name: string, changedFields: any) => void;
|
|
19
|
+
triggerFormFinish: (name: string, values: Store) => void;
|
|
20
|
+
registerForm: (name: string, form: ApFormInstance) => void;
|
|
21
|
+
unregisterForm: (name: string) => void;
|
|
22
|
+
}
|
|
@@ -7,7 +7,7 @@ import { ColSize } from '@aplus-frontend/antdv/es/grid';
|
|
|
7
7
|
import { RuleObject } from '@aplus-frontend/antdv/es/form';
|
|
8
8
|
import { Options } from '../../../node_modules/scroll-into-view-if-needed';
|
|
9
9
|
import { Recordable } from '../../type';
|
|
10
|
-
import { ApFormProps,
|
|
10
|
+
import { ApFormProps, ApFormInternalInstance, WatchFunc } from '..';
|
|
11
11
|
import { OnCleanup } from '@vue/reactivity';
|
|
12
12
|
declare function __VLS_template(): {
|
|
13
13
|
attrs: Partial<{}>;
|
|
@@ -131,27 +131,18 @@ declare function __VLS_template(): {
|
|
|
131
131
|
$emit: (event: string, ...args: any[]) => void;
|
|
132
132
|
$el: any;
|
|
133
133
|
$options: ComponentOptionsBase<Readonly< ApFormProps> & Readonly<{}>, {
|
|
134
|
+
setFieldsValue: (fields: Partial<any>) => void;
|
|
135
|
+
setFieldValue: (name: NamePath, value: any, triggerChange?: boolean) => void;
|
|
134
136
|
resetFields: () => Promise<void>;
|
|
135
|
-
clearValidate: (name?: NamePath
|
|
136
|
-
validateFields: (nameList?: NamePath[] | string, options?: ValidateOptions) => Promise<
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
[key: string]: any;
|
|
144
|
-
}> | undefined;
|
|
145
|
-
scrollToField: (name: NamePath, options?: {}) => void;
|
|
146
|
-
setFieldsValue: (values: Record<string, any>) => void;
|
|
147
|
-
setFieldValue: (name: NamePath, newValue: any, triggerChange?: boolean) => void;
|
|
137
|
+
clearValidate: (name?: NamePath) => void;
|
|
138
|
+
validateFields: (nameList?: NamePath[] | string, options?: ValidateOptions) => Promise<Partial<any>> | undefined;
|
|
139
|
+
getFieldsValue: (nameList?: true | InternalNamePath[]) => Partial<any> | undefined;
|
|
140
|
+
validate: (nameList?: NamePath[] | string, options?: ValidateOptions) => Promise<Partial<any>> | undefined;
|
|
141
|
+
scrollToField: (name: NamePath, options?: any) => void;
|
|
142
|
+
getInternalInstance: (mark: string) => ApFormInternalInstance | undefined;
|
|
143
|
+
validateFieldsReturnTransformed: (nameList?: NamePath[] | string, options?: ValidateOptions) => Promise<Partial<any>> | undefined;
|
|
144
|
+
getFieldsValueTransformed: (nameList?: true | InternalNamePath[]) => Partial<any> | undefined;
|
|
148
145
|
registerWatch: (callback: WatchFunc, inner: boolean) => () => void;
|
|
149
|
-
validateFieldsReturnTransformed: (nameList?: NamePath[] | string, options?: ValidateOptions) => Promise<any>;
|
|
150
|
-
getFieldsValueTransformed: (nameList?: InternalNamePath[] | true) => any;
|
|
151
|
-
getInternalInstance: (mark: string) => {
|
|
152
|
-
registerField: ({ initialValue, name, transform }: RegistedFieldType) => void;
|
|
153
|
-
registerWatch: (callback: WatchFunc, inner: boolean) => () => void;
|
|
154
|
-
} | undefined;
|
|
155
146
|
}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, {
|
|
156
147
|
layout: string;
|
|
157
148
|
colon: boolean;
|
|
@@ -188,28 +179,19 @@ declare function __VLS_template(): {
|
|
|
188
179
|
hideRequiredMark: boolean;
|
|
189
180
|
validateOnRuleChange: boolean;
|
|
190
181
|
syncToUrl: boolean | ((values: Recordable, type: "get" | "set") => Recordable);
|
|
191
|
-
}> & Omit<Readonly< ApFormProps> & Readonly<{}>, "validate" | "resetFields" | "clearValidate" | "validateFields" | "getFieldsValue" | "scrollToField" | "registerWatch" | "setFieldValue" | "
|
|
182
|
+
}> & Omit<Readonly< ApFormProps> & Readonly<{}>, "validate" | "resetFields" | "clearValidate" | "validateFields" | "getFieldsValue" | "scrollToField" | "registerWatch" | "setFieldValue" | ("layout" | "colon" | "labelAlign" | "validateTrigger" | "hideRequiredMark" | "validateOnRuleChange" | "syncToUrl") | "setFieldsValue" | "getInternalInstance" | "validateFieldsReturnTransformed" | "getFieldsValueTransformed"> & ShallowUnwrapRef<{
|
|
183
|
+
setFieldsValue: (fields: Partial<any>) => void;
|
|
184
|
+
setFieldValue: (name: NamePath, value: any, triggerChange?: boolean) => void;
|
|
192
185
|
resetFields: () => Promise<void>;
|
|
193
|
-
clearValidate: (name?: NamePath
|
|
194
|
-
validateFields: (nameList?: NamePath[] | string, options?: ValidateOptions) => Promise<
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
[key: string]: any;
|
|
202
|
-
}> | undefined;
|
|
203
|
-
scrollToField: (name: NamePath, options?: {}) => void;
|
|
204
|
-
setFieldsValue: (values: Record<string, any>) => void;
|
|
205
|
-
setFieldValue: (name: NamePath, newValue: any, triggerChange?: boolean) => void;
|
|
186
|
+
clearValidate: (name?: NamePath) => void;
|
|
187
|
+
validateFields: (nameList?: NamePath[] | string, options?: ValidateOptions) => Promise<Partial<any>> | undefined;
|
|
188
|
+
getFieldsValue: (nameList?: true | InternalNamePath[]) => Partial<any> | undefined;
|
|
189
|
+
validate: (nameList?: NamePath[] | string, options?: ValidateOptions) => Promise<Partial<any>> | undefined;
|
|
190
|
+
scrollToField: (name: NamePath, options?: any) => void;
|
|
191
|
+
getInternalInstance: (mark: string) => ApFormInternalInstance | undefined;
|
|
192
|
+
validateFieldsReturnTransformed: (nameList?: NamePath[] | string, options?: ValidateOptions) => Promise<Partial<any>> | undefined;
|
|
193
|
+
getFieldsValueTransformed: (nameList?: true | InternalNamePath[]) => Partial<any> | undefined;
|
|
206
194
|
registerWatch: (callback: WatchFunc, inner: boolean) => () => void;
|
|
207
|
-
validateFieldsReturnTransformed: (nameList?: NamePath[] | string, options?: ValidateOptions) => Promise<any>;
|
|
208
|
-
getFieldsValueTransformed: (nameList?: InternalNamePath[] | true) => any;
|
|
209
|
-
getInternalInstance: (mark: string) => {
|
|
210
|
-
registerField: ({ initialValue, name, transform }: RegistedFieldType) => void;
|
|
211
|
-
registerWatch: (callback: WatchFunc, inner: boolean) => () => void;
|
|
212
|
-
} | undefined;
|
|
213
195
|
}> & {} & ComponentCustomProperties & {} & {
|
|
214
196
|
$slots: {
|
|
215
197
|
default?(_: {}): any;
|
|
@@ -24,6 +24,8 @@ export interface ApTableModalProps<TableRowType = any> extends Omit<ModalProps,
|
|
|
24
24
|
rowSelection?: TableProps['rowSelection'];
|
|
25
25
|
/** 表格布局配置 */
|
|
26
26
|
tableLayoutConfig?: TableLayoutConfig;
|
|
27
|
+
/** 渲染头部信息 */
|
|
28
|
+
renderHeader?: () => VNodeChild;
|
|
27
29
|
}
|
|
28
30
|
/** useCreateTableModal参数类型 */
|
|
29
31
|
export interface UseCreateTableModalProps extends ApTableModalProps {
|