@aplus-frontend/ui 0.0.39 → 0.0.40

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.
Files changed (57) hide show
  1. package/es/index.mjs +149 -148
  2. package/es/src/ap-field/interface.d.ts +1 -1
  3. package/es/src/ap-field/text-area/index.vue.mjs +9 -10
  4. package/es/src/ap-form/style/ap-form-item.css +6 -6
  5. package/es/src/ap-table/ap-table.vue.d.ts +6 -0
  6. package/es/src/ap-table/ap-table.vue.mjs +90 -89
  7. package/es/src/ap-table/constants.d.ts +0 -6
  8. package/es/src/business/ap-export-group/ApExportGroup.vue.d.ts +14 -0
  9. package/es/src/business/ap-export-group/ApExportGroup.vue.mjs +4 -0
  10. package/es/src/business/ap-export-group/ApExportGroup.vue2.mjs +117 -0
  11. package/es/src/business/ap-export-group/interface.d.ts +37 -0
  12. package/es/src/business/ap-export-group/interface.mjs +4 -0
  13. package/es/src/business/index.d.ts +105 -0
  14. package/es/src/business/index.mjs +12 -9
  15. package/es/src/config-provider/config-provider.mjs +22 -17
  16. package/es/src/editable-table/form-item.vue.d.ts +4 -0
  17. package/es/src/editable-table/form-item.vue.mjs +83 -75
  18. package/es/src/editable-table/index.vue.d.ts +4 -0
  19. package/es/src/editable-table/index.vue.mjs +80 -72
  20. package/es/src/editable-table/interface.d.ts +8 -0
  21. package/es/src/editable-table/utils.d.ts +8 -0
  22. package/es/src/editable-table/utils.mjs +29 -18
  23. package/es/src/index.mjs +175 -174
  24. package/es/src/locale/lang/en.mjs +6 -0
  25. package/es/src/locale/lang/zh-cn.mjs +6 -0
  26. package/es/src/theme/ap-form/ap-form-item.css +6 -6
  27. package/es/src/theme/css-var/index.d.ts +7 -0
  28. package/es/src/theme/css-var/index.mjs +45 -0
  29. package/lib/index.js +1 -1
  30. package/lib/src/ap-field/interface.d.ts +1 -1
  31. package/lib/src/ap-field/text-area/index.vue.js +1 -1
  32. package/lib/src/ap-form/style/ap-form-item.css +6 -6
  33. package/lib/src/ap-table/ap-table.vue.d.ts +6 -0
  34. package/lib/src/ap-table/ap-table.vue.js +1 -1
  35. package/lib/src/ap-table/constants.d.ts +0 -6
  36. package/lib/src/business/ap-export-group/ApExportGroup.vue.d.ts +14 -0
  37. package/lib/src/business/ap-export-group/ApExportGroup.vue.js +1 -0
  38. package/lib/src/business/ap-export-group/ApExportGroup.vue2.js +1 -0
  39. package/lib/src/business/ap-export-group/interface.d.ts +37 -0
  40. package/lib/src/business/ap-export-group/interface.js +1 -0
  41. package/lib/src/business/index.d.ts +105 -0
  42. package/lib/src/business/index.js +1 -1
  43. package/lib/src/config-provider/config-provider.js +1 -1
  44. package/lib/src/editable-table/form-item.vue.d.ts +4 -0
  45. package/lib/src/editable-table/form-item.vue.js +1 -1
  46. package/lib/src/editable-table/index.vue.d.ts +4 -0
  47. package/lib/src/editable-table/index.vue.js +1 -1
  48. package/lib/src/editable-table/interface.d.ts +8 -0
  49. package/lib/src/editable-table/utils.d.ts +8 -0
  50. package/lib/src/editable-table/utils.js +1 -1
  51. package/lib/src/index.js +1 -1
  52. package/lib/src/locale/lang/en.js +1 -1
  53. package/lib/src/locale/lang/zh-cn.js +1 -1
  54. package/lib/src/theme/ap-form/ap-form-item.css +6 -6
  55. package/lib/src/theme/css-var/index.d.ts +7 -0
  56. package/lib/src/theme/css-var/index.js +1 -0
  57. package/package.json +6 -5
@@ -1,39 +1,44 @@
1
- import { isVNode as n, ref as l, defineComponent as c, computed as f, watch as d, createVNode as m, renderSlot as u } from "vue";
2
- import { ConfigProvider as p } from "ant-design-vue";
3
- import { provideGlobalConfig as g } from "./hooks/use-global-config.mjs";
4
- import { configProviderProps as s } from "./config-provider-props.mjs";
5
- import { tableDefaultConfig as b } from "./constants.mjs";
6
- import { mergeAntdProvideConfig as v } from "../utils/config-provider-preset.mjs";
7
- function C(e) {
1
+ import { isVNode as n, ref as d, defineComponent as f, computed as m, watch as r, createVNode as c, renderSlot as u } from "vue";
2
+ import { ConfigProvider as s } from "ant-design-vue";
3
+ import { provideGlobalConfig as p } from "./hooks/use-global-config.mjs";
4
+ import { configProviderProps as g } from "./config-provider-props.mjs";
5
+ import { tableDefaultConfig as C } from "./constants.mjs";
6
+ import { mergeAntdProvideConfig as b } from "../utils/config-provider-preset.mjs";
7
+ import { setCSSVariables as v, aplusCssVar as P, adminCssVar as S } from "../theme/css-var/index.mjs";
8
+ function V(e) {
8
9
  return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !n(e);
9
10
  }
10
- const r = l({}), A = /* @__PURE__ */ c({
11
+ const a = d({}), N = /* @__PURE__ */ f({
11
12
  name: "AplusConfigProvider",
12
- props: s(),
13
+ props: g(),
13
14
  setup(e, {
14
15
  slots: i
15
16
  }) {
16
- const a = f(() => ({
17
+ const l = m(() => ({
17
18
  namespace: e.namespace,
18
19
  aplusLocale: e.aplusLocale,
19
20
  api: e.api,
20
21
  table: {
21
- ...b,
22
+ ...C,
22
23
  ...e.table || {}
23
24
  },
24
25
  scrollbar: e.scrollbar,
25
26
  uiMode: e.uiMode,
26
27
  apUpload: e.apUpload,
27
28
  apDescriptions: e.apDescriptions
28
- })), t = g(a);
29
- return d(() => e, (o) => {
30
- r.value = v(o);
29
+ })), t = p(l);
30
+ return r(() => e, (o) => {
31
+ a.value = b(o);
31
32
  }, {
32
33
  deep: !0,
33
34
  immediate: !0
35
+ }), r(() => e.uiMode, (o) => {
36
+ v(o === "aplus" ? P : S);
37
+ }, {
38
+ immediate: !0
34
39
  }), () => {
35
40
  let o;
36
- return m(p, r.value, C(o = u(i, "default", {
41
+ return c(s, a.value, V(o = u(i, "default", {
37
42
  config: t == null ? void 0 : t.value
38
43
  })) ? o : {
39
44
  default: () => [o]
@@ -42,6 +47,6 @@ const r = l({}), A = /* @__PURE__ */ c({
42
47
  }
43
48
  });
44
49
  export {
45
- A as ConfigProvider,
46
- r as globalConfigCached
50
+ N as ConfigProvider,
51
+ a as globalConfigCached
47
52
  };
@@ -1,4 +1,5 @@
1
1
  import { EditableColumnType } from './interface';
2
+ import { StandardBehaviorOptions } from '../../node_modules/scroll-into-view-if-needed';
2
3
  import { ExtractPropTypes, PropType, VNode, RendererNode, RendererElement, CSSProperties, HTMLAttributes, VNodeProps, AllowedComponentProps, ComponentCustomProps, ShallowUnwrapRef } from 'vue';
3
4
  import { SpinSize } from 'ant-design-vue/es/spin/Spin';
4
5
  import { VueTypeValidableDef, VueTypeDef } from '../../node_modules/vue-types';
@@ -325,6 +326,7 @@ declare const _default: <RecordType = any>(__VLS_props: {
325
326
  getRowsData: () => UnwrapRefSimple<RecordType>[];
326
327
  setRowData: (index: number, payload: any) => void;
327
328
  addMultiple: (list: number | Partial<RecordType>[], insetIn?: 'prefix' | 'suffix') => void;
329
+ scrollTo: (index: number | 'end', options?: StandardBehaviorOptions) => void;
328
330
  }>) => void) | undefined, __VLS_setup?: Promise<{
329
331
  props: {
330
332
  loading?: boolean | Partial< ExtractPropTypes<{
@@ -600,6 +602,7 @@ declare const _default: <RecordType = any>(__VLS_props: {
600
602
  getRowsData: () => UnwrapRefSimple<RecordType>[];
601
603
  setRowData: (index: number, payload: any) => void;
602
604
  addMultiple: (list: number | Partial<RecordType>[], insetIn?: 'prefix' | 'suffix') => void;
605
+ scrollTo: (index: number | 'end', options?: StandardBehaviorOptions) => void;
603
606
  }>): void;
604
607
  attrs: any;
605
608
  slots: Readonly<{
@@ -912,6 +915,7 @@ declare const _default: <RecordType = any>(__VLS_props: {
912
915
  getRowsData: () => UnwrapRefSimple<RecordType>[];
913
916
  setRowData: (index: number, payload: any) => void;
914
917
  addMultiple: (list: number | Partial<RecordType>[], insetIn?: 'prefix' | 'suffix') => void;
918
+ scrollTo: (index: number | 'end', options?: StandardBehaviorOptions) => void;
915
919
  }>): void;
916
920
  attrs: any;
917
921
  slots: Readonly<{
@@ -1,16 +1,16 @@
1
- import { defineComponent as P, ref as V, unref as o, useSlots as A, watch as O, openBlock as x, createBlock as T, mergeProps as C, withCtx as m, createVNode as K, createSlots as M, createElementBlock as q, Fragment as G, createElementVNode as w, normalizeClass as H, toDisplayString as W, createCommentVNode as I, renderList as U, renderSlot as $, normalizeProps as J, guardReactiveProps as Q } from "vue";
2
- import { Table as X } from "ant-design-vue";
3
- import { ApForm as b } from "../ap-form/index.mjs";
4
- import { isNumber as u, cloneDeep as i, omit as Y } from "lodash-unified";
1
+ import { defineComponent as A, ref as C, unref as t, useSlots as O, watch as K, openBlock as b, createBlock as M, mergeProps as w, withCtx as u, createVNode as q, createSlots as G, createElementBlock as H, Fragment as I, createElementVNode as y, normalizeClass as W, toDisplayString as $, createCommentVNode as U, renderList as J, renderSlot as Q, normalizeProps as X, guardReactiveProps as Y } from "vue";
2
+ import { Table as Z } from "ant-design-vue";
3
+ import { ApForm as R } from "../ap-form/index.mjs";
4
+ import { isNumber as m, cloneDeep as f, omit as ee } from "lodash-unified";
5
5
  import "../config-provider/index.mjs";
6
- import { useInjectForm as Z } from "../ap-form/context.mjs";
6
+ import { useInjectForm as oe } from "../ap-form/context.mjs";
7
7
  import "./style/index.css";
8
- import { isDef as f } from "../utils/index.mjs";
9
- import ee from "./hooks/use-get-columns.mjs";
10
- import { getColumnIsRequired as oe } from "./utils.mjs";
11
- import { useNamespace as te } from "../config-provider/hooks/use-namespace.mjs";
12
- import { useGlobalConfig as ae } from "../config-provider/hooks/use-global-config.mjs";
13
- const ge = /* @__PURE__ */ P({
8
+ import { isDef as i } from "../utils/index.mjs";
9
+ import te from "./hooks/use-get-columns.mjs";
10
+ import { scrollToRowIndex as ae, getColumnIsRequired as ne } from "./utils.mjs";
11
+ import { useNamespace as le } from "../config-provider/hooks/use-namespace.mjs";
12
+ import { useGlobalConfig as re } from "../config-provider/hooks/use-global-config.mjs";
13
+ const be = /* @__PURE__ */ A({
14
14
  name: "EditableTableInner",
15
15
  __name: "form-item",
16
16
  props: {
@@ -110,93 +110,101 @@ const ge = /* @__PURE__ */ P({
110
110
  default: () => ({})
111
111
  }
112
112
  },
113
- setup(y, {
114
- expose: R
113
+ setup(B, {
114
+ expose: D
115
115
  }) {
116
- var c;
117
- const a = y, {
116
+ var h;
117
+ const n = B, {
118
118
  internalInstance: l,
119
- model: B
120
- } = Z(), r = V(((c = o(B)) == null ? void 0 : c[a.name]) || []), D = A(), F = b.useWatch(a.name);
121
- O(() => F.value, (e) => {
122
- var t;
123
- r.value = e, (t = a.onChange) == null || t.call(a, e);
119
+ model: v
120
+ } = oe(), r = C(((h = t(v)) == null ? void 0 : h[n.name]) || []), F = O(), E = R.useWatch(n.name);
121
+ K(() => E.value, (e) => {
122
+ var o;
123
+ r.value = e, (o = n.onChange) == null || o.call(n, e);
124
124
  });
125
125
  const {
126
- b: p,
127
- em: E
128
- } = te("editable-table"), L = ae("uiMode", "aplus"), v = ee(a);
129
- function N(e, t) {
130
- var s;
131
- const n = ((s = o(r)) == null ? void 0 : s.length) || 0;
132
- if (f(a.maxLength) && n >= a.maxLength)
126
+ b: c,
127
+ em: L
128
+ } = le("editable-table"), N = re("uiMode", "aplus"), p = C(), k = te(n);
129
+ function S(e, o) {
130
+ var d;
131
+ const a = ((d = t(r)) == null ? void 0 : d.length) || 0;
132
+ if (i(n.maxLength) && a >= n.maxLength)
133
133
  return;
134
- const d = [...o(r) || []];
135
- f(t) ? d.splice(t, 0, {
134
+ const s = [...t(r) || []];
135
+ i(o) ? s.splice(o, 0, {
136
136
  ...e || {}
137
- }) : d.push({
137
+ }) : s.push({
138
138
  ...e || {}
139
- }), l == null || l.setFieldValue(a.name, [...o(r) || [], e || {}]);
139
+ }), l == null || l.setFieldValue(n.name, [...t(r) || [], e || {}]);
140
140
  }
141
- function S(e, t = "suffix") {
142
- var g;
143
- const n = ((g = o(r)) == null ? void 0 : g.length) || 0, d = u(e) ? e : e.length;
144
- if (f(a.maxLength) && n + d > a.maxLength)
141
+ function _(e, o = "suffix") {
142
+ var x;
143
+ const a = ((x = t(r)) == null ? void 0 : x.length) || 0, s = m(e) ? e : e.length;
144
+ if (i(n.maxLength) && a + s > n.maxLength)
145
145
  return;
146
- const s = [...o(r) || []], h = u(e) ? new Array(e).fill({}) : i(e);
147
- t === "suffix" ? s.push(...h) : s.unshift(...h), l == null || l.setFieldValue(a.name, s);
146
+ const d = [...t(r) || []], g = m(e) ? new Array(e).fill({}) : f(e);
147
+ o === "suffix" ? d.push(...g) : d.unshift(...g), l == null || l.setFieldValue(n.name, d);
148
+ }
149
+ function T(e) {
150
+ let o = f(t(r) || []);
151
+ const a = m(e) ? [e] : e;
152
+ o = o.filter((s, d) => !a.includes(d)), l == null || l.setFieldValue(n.name, o);
148
153
  }
149
- function k(e) {
150
- let t = i(o(r) || []);
151
- const n = u(e) ? [e] : e;
152
- t = t.filter((d, s) => !n.includes(s)), l == null || l.setFieldValue(a.name, t);
154
+ function j() {
155
+ return t(r);
153
156
  }
154
- function _() {
155
- return o(r);
157
+ function z(e) {
158
+ var o;
159
+ return (o = t(r)) == null ? void 0 : o[e];
156
160
  }
157
- function j(e) {
158
- var t;
159
- return (t = o(r)) == null ? void 0 : t[e];
161
+ function P(e, o) {
162
+ const a = f(t(r));
163
+ a[e] && (a[e] = {
164
+ ...a[e],
165
+ ...o
166
+ }, l == null || l.setFieldValue(n.name, [...a]));
160
167
  }
161
- function z(e, t) {
162
- const n = i(o(r));
163
- n[e] && (n[e] = {
164
- ...n[e],
165
- ...t
166
- }, l == null || l.setFieldValue(a.name, [...n]));
168
+ function V(e, o) {
169
+ var s;
170
+ const a = e === "end" ? r.value.length - 1 : e;
171
+ ae(a, (s = p.value) == null ? void 0 : s.$el, o);
167
172
  }
168
- return R({
169
- add: N,
170
- remove: k,
171
- getRowData: j,
172
- getRowsData: _,
173
- setRowData: z,
174
- addMultiple: S
175
- }), (e, t) => (x(), T(o(b).FormItem, C(e.formItem, {
173
+ return D({
174
+ add: S,
175
+ remove: T,
176
+ getRowData: z,
177
+ getRowsData: j,
178
+ setRowData: P,
179
+ addMultiple: _,
180
+ scrollTo: V
181
+ }), (e, o) => (b(), M(t(R).FormItem, w(e.formItem, {
176
182
  name: e.name,
177
183
  label: e.label
178
184
  }), {
179
- default: m(() => [K(o(X), C(o(Y)(a, ["name", "maxLength", "onChange"]), {
180
- class: [o(p)(), o(L) === "admin" ? o(p)("admin") : null],
181
- columns: o(v),
182
- "data-source": r.value
183
- }), M({
184
- headerCell: m(({
185
- column: n
186
- }) => [o(oe)(n) ? (x(), q(G, {
185
+ default: u(() => [q(t(Z), w(t(ee)(n, ["name", "maxLength", "onChange"]), {
186
+ class: [t(c)(), t(N) === "admin" ? t(c)("admin") : null],
187
+ columns: t(k),
188
+ "data-source": r.value,
189
+ ref_key: "tableRef",
190
+ ref: p
191
+ }), G({
192
+ headerCell: u(({
193
+ column: a
194
+ }) => [t(ne)(a) ? (b(), H(I, {
187
195
  key: 0
188
- }, [w("span", {
189
- class: H(o(E)("header-cell", "required"))
190
- }, "*", 2), w("span", null, W(n.title), 1)], 64)) : I("", !0)]),
196
+ }, [y("span", {
197
+ class: W(t(L)("header-cell", "required"))
198
+ }, "*", 2), y("span", null, $(a.title), 1)], 64)) : U("", !0)]),
191
199
  _: 2
192
- }, [U(D, (n, d) => ({
193
- name: d,
194
- fn: m((s) => [$(e.$slots, d, J(Q(s || {})))])
200
+ }, [J(F, (a, s) => ({
201
+ name: s,
202
+ fn: u((d) => [Q(e.$slots, s, X(Y(d || {})))])
195
203
  }))]), 1040, ["class", "columns", "data-source"])]),
196
204
  _: 3
197
205
  }, 16, ["name", "label"]));
198
206
  }
199
207
  });
200
208
  export {
201
- ge as default
209
+ be as default
202
210
  };
@@ -1,6 +1,7 @@
1
1
  import { EditableColumnType } from './interface';
2
2
  import { NamePath, ValidateOptions } from 'ant-design-vue/es/form/interface';
3
3
  import { Recordable } from '../type';
4
+ import { StandardBehaviorOptions } from '../../node_modules/scroll-into-view-if-needed';
4
5
  import { ExtractPropTypes, PropType, VNode, RendererNode, RendererElement, CSSProperties, VNodeProps, AllowedComponentProps, ComponentCustomProps, ShallowUnwrapRef } from 'vue';
5
6
  import { SpinSize } from 'ant-design-vue/es/spin/Spin';
6
7
  import { VueTypeValidableDef } from '../../node_modules/vue-types';
@@ -210,6 +211,7 @@ declare const _default: <RecordType extends Recordable = any>(__VLS_props: {
210
211
  getRowsData: () => UnwrapRefSimple<RecordType>[];
211
212
  setRowData: (index: number, payload: any) => void;
212
213
  addMultiple: (list: number | Partial<RecordType>[], insetIn?: 'prefix' | 'suffix') => void;
214
+ scrollTo: (index: number | 'end', options?: StandardBehaviorOptions) => void;
213
215
  }>) => void) | undefined, __VLS_setup?: Promise<{
214
216
  props: {
215
217
  loading?: boolean | Partial< ExtractPropTypes<{
@@ -371,6 +373,7 @@ declare const _default: <RecordType extends Recordable = any>(__VLS_props: {
371
373
  getRowsData: () => UnwrapRefSimple<RecordType>[];
372
374
  setRowData: (index: number, payload: any) => void;
373
375
  addMultiple: (list: number | Partial<RecordType>[], insetIn?: 'prefix' | 'suffix') => void;
376
+ scrollTo: (index: number | 'end', options?: StandardBehaviorOptions) => void;
374
377
  }>): void;
375
378
  attrs: any;
376
379
  slots: Readonly<{
@@ -569,6 +572,7 @@ declare const _default: <RecordType extends Recordable = any>(__VLS_props: {
569
572
  getRowsData: () => UnwrapRefSimple<RecordType>[];
570
573
  setRowData: (index: number, payload: any) => void;
571
574
  addMultiple: (list: number | Partial<RecordType>[], insetIn?: 'prefix' | 'suffix') => void;
575
+ scrollTo: (index: number | 'end', options?: StandardBehaviorOptions) => void;
572
576
  }>): void;
573
577
  attrs: any;
574
578
  slots: Readonly<{
@@ -1,17 +1,17 @@
1
- import { defineComponent as T, useSlots as K, ref as M, watch as q, unref as a, openBlock as w, createBlock as G, withCtx as c, createVNode as y, mergeProps as H, createSlots as U, createElementBlock as W, Fragment as $, createElementVNode as v, normalizeClass as J, toDisplayString as Q, createCommentVNode as X, renderList as Y, renderSlot as Z, normalizeProps as ee, guardReactiveProps as te } from "vue";
2
- import { Table as ae } from "ant-design-vue";
1
+ import { defineComponent as q, useSlots as G, ref as y, watch as H, unref as o, openBlock as b, createBlock as U, withCtx as c, createVNode as v, mergeProps as W, createSlots as $, createElementBlock as J, Fragment as Q, createElementVNode as R, normalizeClass as X, toDisplayString as Y, createCommentVNode as Z, renderList as ee, renderSlot as te, normalizeProps as ae, guardReactiveProps as ne } from "vue";
2
+ import { Table as oe } from "ant-design-vue";
3
3
  import { ApForm as f } from "../ap-form/index.mjs";
4
- import { isNumber as p, cloneDeep as h, omit as ne } from "lodash-unified";
4
+ import { isNumber as p, cloneDeep as h, omit as le } from "lodash-unified";
5
5
  import "../config-provider/index.mjs";
6
6
  import "../hooks/index.mjs";
7
7
  import { isDef as x } from "../utils/index.mjs";
8
- import { getColumnIsRequired as oe } from "./utils.mjs";
9
- import le from "./hooks/use-get-columns.mjs";
8
+ import { scrollToRowIndex as re, getColumnIsRequired as se } from "./utils.mjs";
9
+ import ue from "./hooks/use-get-columns.mjs";
10
10
  import "./style/index.css";
11
- import { useNamespace as re } from "../config-provider/hooks/use-namespace.mjs";
12
- import { useGlobalConfig as se } from "../config-provider/hooks/use-global-config.mjs";
13
- import { useControllableValue as ue } from "../hooks/useControllableValue.mjs";
14
- const be = /* @__PURE__ */ T({
11
+ import { useNamespace as de } from "../config-provider/hooks/use-namespace.mjs";
12
+ import { useGlobalConfig as ie } from "../config-provider/hooks/use-global-config.mjs";
13
+ import { useControllableValue as me } from "../hooks/useControllableValue.mjs";
14
+ const Fe = /* @__PURE__ */ q({
15
15
  name: "EditableTable",
16
16
  __name: "index",
17
17
  props: {
@@ -110,108 +110,116 @@ const be = /* @__PURE__ */ T({
110
110
  onFieldChange: {}
111
111
  },
112
112
  emits: ["update:value"],
113
- setup(b, {
114
- expose: R,
115
- emit: B
113
+ setup(B, {
114
+ expose: F,
115
+ emit: D
116
116
  }) {
117
- const l = b, {
117
+ const l = B, {
118
118
  b: g,
119
- em: F
120
- } = re("editable-table"), D = se("uiMode", "aplus"), _ = K(), E = B, {
119
+ em: _
120
+ } = de("editable-table"), k = ie("uiMode", "aplus"), E = G(), L = D, C = y(), {
121
121
  value: s,
122
- updateValue: L
123
- } = ue(l, E), u = M(), k = f.useWatch(l.name, u);
124
- q(() => k.value, (e) => {
125
- var n;
126
- L(e), (n = l.onChange) == null || n.call(l, e);
122
+ updateValue: N
123
+ } = me(l, L), u = y(), S = f.useWatch(l.name, u);
124
+ H(() => S.value, (e) => {
125
+ var a;
126
+ N(e), (a = l.onChange) == null || a.call(l, e);
127
127
  });
128
- const N = le(l);
129
- function S() {
128
+ const V = ue(l);
129
+ function T() {
130
130
  var e;
131
131
  (e = u.value) == null || e.resetFields();
132
132
  }
133
- async function V(e, n) {
133
+ async function z(e, a) {
134
134
  var t;
135
- const o = await ((t = u.value) == null ? void 0 : t.validateFields(e, n));
136
- return o == null ? void 0 : o[l.name];
135
+ const n = await ((t = u.value) == null ? void 0 : t.validateFields(e, a));
136
+ return n == null ? void 0 : n[l.name];
137
137
  }
138
- function z(e, n) {
138
+ function I(e, a) {
139
139
  var r, d, i;
140
- const o = ((r = a(s)) == null ? void 0 : r.length) || 0;
141
- if (x(l.maxLength) && o >= l.maxLength)
140
+ const n = ((r = o(s)) == null ? void 0 : r.length) || 0;
141
+ if (x(l.maxLength) && n >= l.maxLength)
142
142
  return;
143
- const t = [...a(s) || []];
144
- x(n) ? t.splice(n, 0, {
143
+ const t = [...o(s) || []];
144
+ x(a) ? t.splice(a, 0, {
145
145
  ...e || {}
146
146
  }) : t.push({
147
147
  ...e || {}
148
148
  }), (i = (d = u.value) == null ? void 0 : d.setFieldValue) == null || i.call(d, l.name, t);
149
149
  }
150
- function P(e, n = "suffix") {
151
- var i, m, C;
152
- const o = ((i = a(s)) == null ? void 0 : i.length) || 0, t = p(e) ? e : e.length;
153
- if (x(l.maxLength) && o + t > l.maxLength)
150
+ function P(e, a = "suffix") {
151
+ var i, m, w;
152
+ const n = ((i = o(s)) == null ? void 0 : i.length) || 0, t = p(e) ? e : e.length;
153
+ if (x(l.maxLength) && n + t > l.maxLength)
154
154
  return;
155
- const r = [...a(s) || []], d = p(e) ? new Array(e).fill({}) : h(e);
156
- n === "suffix" ? r.push(...d) : r.unshift(...d), (C = (m = u.value) == null ? void 0 : m.setFieldValue) == null || C.call(m, l.name, r);
155
+ const r = [...o(s) || []], d = p(e) ? new Array(e).fill({}) : h(e);
156
+ a === "suffix" ? r.push(...d) : r.unshift(...d), (w = (m = u.value) == null ? void 0 : m.setFieldValue) == null || w.call(m, l.name, r);
157
157
  }
158
158
  function j(e) {
159
159
  var t, r;
160
- let n = h(a(s) || []);
161
- const o = p(e) ? [e] : e;
162
- n = n.filter((d, i) => !o.includes(i)), (r = (t = u.value) == null ? void 0 : t.setFieldValue) == null || r.call(t, l.name, n);
160
+ let a = h(o(s) || []);
161
+ const n = p(e) ? [e] : e;
162
+ a = a.filter((d, i) => !n.includes(i)), (r = (t = u.value) == null ? void 0 : t.setFieldValue) == null || r.call(t, l.name, a);
163
163
  }
164
164
  function A() {
165
- return a(s);
165
+ return o(s);
166
166
  }
167
- function I(e) {
168
- var n;
169
- return (n = a(s)) == null ? void 0 : n[e];
167
+ function O(e) {
168
+ var a;
169
+ return (a = o(s)) == null ? void 0 : a[e];
170
170
  }
171
- function O(e, n) {
171
+ function K(e, a) {
172
172
  var t, r;
173
- const o = h(a(s));
174
- o[e] && (o[e] = {
175
- ...o[e],
176
- ...n
177
- }, (r = (t = u.value) == null ? void 0 : t.setFieldValue) == null || r.call(t, l.name, [...o]));
173
+ const n = h(o(s));
174
+ n[e] && (n[e] = {
175
+ ...n[e],
176
+ ...a
177
+ }, (r = (t = u.value) == null ? void 0 : t.setFieldValue) == null || r.call(t, l.name, [...n]));
178
178
  }
179
- return R({
180
- resetFields: S,
181
- validateFields: V,
182
- add: z,
179
+ function M(e, a) {
180
+ var t;
181
+ const n = e === "end" ? s.value.length - 1 : e;
182
+ re(n, (t = C.value) == null ? void 0 : t.$el, a);
183
+ }
184
+ return F({
185
+ resetFields: T,
186
+ validateFields: z,
187
+ add: I,
183
188
  remove: j,
184
- getRowData: I,
189
+ getRowData: O,
185
190
  getRowsData: A,
186
- setRowData: O,
187
- addMultiple: P
188
- }), (e, n) => (w(), G(a(f), {
191
+ setRowData: K,
192
+ addMultiple: P,
193
+ scrollTo: M
194
+ }), (e, a) => (b(), U(o(f), {
189
195
  "initial-values": {
190
- [l.name]: a(s)
196
+ [l.name]: o(s)
191
197
  },
192
198
  ref_key: "formRef",
193
199
  ref: u
194
200
  }, {
195
- default: c(() => [y(a(f).FormItem, {
201
+ default: c(() => [v(o(f).FormItem, {
196
202
  name: e.name,
197
203
  "no-style": ""
198
204
  }, {
199
- default: c(() => [y(a(ae), H(a(ne)(l, ["name", "value", "onUpdate:value", "maxLength", "onChange"]), {
200
- class: [a(g)(), a(D) === "admin" ? a(g)("admin") : null],
201
- columns: a(N),
202
- "data-source": a(s)
203
- }), U({
205
+ default: c(() => [v(o(oe), W(o(le)(l, ["name", "value", "onUpdate:value", "maxLength", "onChange"]), {
206
+ class: [o(g)(), o(k) === "admin" ? o(g)("admin") : null],
207
+ columns: o(V),
208
+ "data-source": o(s),
209
+ ref_key: "tableRef",
210
+ ref: C
211
+ }), $({
204
212
  headerCell: c(({
205
- column: o
206
- }) => [a(oe)(o) ? (w(), W($, {
213
+ column: n
214
+ }) => [o(se)(n) ? (b(), J(Q, {
207
215
  key: 0
208
- }, [v("span", {
209
- class: J(a(F)("header-cell", "required"))
210
- }, "*", 2), v("span", null, Q(o.title), 1)], 64)) : X("", !0)]),
216
+ }, [R("span", {
217
+ class: X(o(_)("header-cell", "required"))
218
+ }, "*", 2), R("span", null, Y(n.title), 1)], 64)) : Z("", !0)]),
211
219
  _: 2
212
- }, [Y(_, (o, t) => ({
220
+ }, [ee(E, (n, t) => ({
213
221
  name: t,
214
- fn: c((r) => [Z(e.$slots, t, ee(te(r || {})))])
222
+ fn: c((r) => [te(e.$slots, t, ae(ne(r || {})))])
215
223
  }))]), 1040, ["class", "columns", "data-source"])]),
216
224
  _: 3
217
225
  }, 8, ["name"])]),
@@ -220,5 +228,5 @@ const be = /* @__PURE__ */ T({
220
228
  }
221
229
  });
222
230
  export {
223
- be as default
231
+ Fe as default
224
232
  };
@@ -5,6 +5,7 @@ import { DataIndex } from 'ant-design-vue/es/vc-table/interface';
5
5
  import { FormItemProps } from 'ant-design-vue';
6
6
  import { VNode } from 'vue';
7
7
  import { EllipsisConfig } from 'ant-design-vue/es/typography/Base';
8
+ import { StandardBehaviorOptions } from '../../node_modules/scroll-into-view-if-needed';
8
9
 
9
10
  export type EditableColumnType<RecordType = any, ValueType extends ApTableValueTypes = ApTableValueTypes> = ValueType extends ApTableValueTypes ? Omit<ColumnType<RecordType>, 'children' | 'customRender' | 'ellipsis'> & {
10
11
  children?: EditableColumnType<RecordType, ValueType>;
@@ -158,6 +159,13 @@ export type EditableTableExpose<ModelType = any, RecordType = any> = {
158
159
  * @returns
159
160
  */
160
161
  setRowData: (index: number, data: Partial<RecordType>) => void;
162
+ /**
163
+ * 滚动到表格的某行
164
+ * @param index
165
+ * @param options
166
+ * @returns
167
+ */
168
+ scrollTo: (index: number | 'end', options?: StandardBehaviorOptions) => void;
161
169
  };
162
170
  /**
163
171
  * 可编辑表格作为表单项暴露的实例
@@ -1,4 +1,5 @@
1
1
  import { EditableColumnType } from './interface';
2
+ import { StandardBehaviorOptions } from '../../node_modules/scroll-into-view-if-needed';
2
3
 
3
4
  /**
4
5
  * 获取编辑模式下默认映射的组件
@@ -20,3 +21,10 @@ export declare function getColumnIsRequired(column: EditableColumnType<any, 'tex
20
21
  */
21
22
  export declare function getRawDisplayValue(column: EditableColumnType, value: any): any;
22
23
  export declare function mergeClass(current: string, classNames?: string | string[]): string;
24
+ /**
25
+ * 滚动到表格的某行
26
+ * @param index
27
+ * @param container
28
+ * @param options
29
+ */
30
+ export declare function scrollToRowIndex(index: number, container?: HTMLElement, options?: StandardBehaviorOptions): void;