@aplus-frontend/ui 0.1.12 → 0.1.13

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.
@@ -1,7 +1,7 @@
1
- import { defineComponent as V, ref as x, unref as t, useSlots as A, watch as O, openBlock as C, createBlock as K, mergeProps as w, withCtx as m, createVNode as q, createSlots as H, createElementBlock as I, Fragment as W, createElementVNode as b, normalizeClass as $, toDisplayString as G, createCommentVNode as M, renderList as U, renderSlot as J, normalizeProps as Q, guardReactiveProps as X } from "vue";
1
+ import { defineComponent as V, ref as x, unref as t, useSlots as A, watch as O, openBlock as C, createBlock as K, mergeProps as w, withCtx as u, createVNode as q, createSlots as H, createElementBlock as I, Fragment as W, createElementVNode as b, normalizeClass as $, toDisplayString as G, createCommentVNode as M, renderList as U, renderSlot as J, normalizeProps as Q, guardReactiveProps as X } from "vue";
2
2
  import { Table as Y } from "ant-design-vue";
3
3
  import { ApForm as y } from "../ap-form/index.mjs";
4
- import { isNumber as u, cloneDeep as f, omit as Z } from "lodash-unified";
4
+ import { isNumber as m, cloneDeep as f, omit as Z } from "lodash-unified";
5
5
  import "../config-provider/index.mjs";
6
6
  import { useInjectForm as ee } from "../ap-form/context.mjs";
7
7
  import "./style/index.css";
@@ -120,6 +120,8 @@ const ge = /* @__PURE__ */ V({
120
120
  O(() => F.value, (e) => {
121
121
  var o;
122
122
  r.value = e, (o = n.onChange) == null || o.call(n, e);
123
+ }, {
124
+ deep: !0
123
125
  });
124
126
  const {
125
127
  b: E,
@@ -139,15 +141,15 @@ const ge = /* @__PURE__ */ V({
139
141
  }
140
142
  function S(e, o = "suffix") {
141
143
  var g;
142
- const a = ((g = t(r)) == null ? void 0 : g.length) || 0, s = u(e) ? e : e.length;
144
+ const a = ((g = t(r)) == null ? void 0 : g.length) || 0, s = m(e) ? e : e.length;
143
145
  if (c(n.maxLength) && a + s > n.maxLength)
144
146
  return;
145
- const d = [...t(r) || []], h = u(e) ? new Array(e).fill({}) : f(e);
147
+ const d = [...t(r) || []], h = m(e) ? new Array(e).fill({}) : f(e);
146
148
  o === "suffix" ? d.push(...h) : d.unshift(...h), l == null || l.setFieldValue(n.name, d);
147
149
  }
148
150
  function _(e) {
149
151
  let o = f(t(r) || []);
150
- const a = u(e) ? [e] : e;
152
+ const a = m(e) ? [e] : e;
151
153
  o = o.filter((s, d) => !a.includes(d)), l == null || l.setFieldValue(n.name, o);
152
154
  }
153
155
  function T() {
@@ -181,14 +183,14 @@ const ge = /* @__PURE__ */ V({
181
183
  name: e.name,
182
184
  label: e.label
183
185
  }), {
184
- default: m(() => [q(t(Y), w(t(Z)(n, ["name", "maxLength", "onChange"]), {
186
+ default: u(() => [q(t(Y), w(t(Z)(n, ["name", "maxLength", "onChange"]), {
185
187
  class: t(E)(),
186
188
  columns: t(N),
187
189
  "data-source": r.value,
188
190
  ref_key: "tableRef",
189
191
  ref: i
190
192
  }), H({
191
- headerCell: m(({
193
+ headerCell: u(({
192
194
  column: a
193
195
  }) => [t(ae)(a) ? (C(), I(W, {
194
196
  key: 0
@@ -198,7 +200,7 @@ const ge = /* @__PURE__ */ V({
198
200
  _: 2
199
201
  }, [U(v, (a, s) => ({
200
202
  name: s,
201
- fn: m((d) => [J(e.$slots, s, Q(X(d || {})))])
203
+ fn: u((d) => [J(e.$slots, s, Q(X(d || {})))])
202
204
  }))]), 1040, ["class", "columns", "data-source"])]),
203
205
  _: 3
204
206
  }, 16, ["name", "label"]));
@@ -1,16 +1,16 @@
1
- import { defineComponent as q, useSlots as H, ref as w, watch as U, unref as o, openBlock as y, createBlock as W, withCtx as c, createVNode as v, mergeProps as $, createSlots as G, createElementBlock as M, Fragment as J, createElementVNode as b, normalizeClass as Q, toDisplayString as X, createCommentVNode as Y, renderList as Z, renderSlot as ee, normalizeProps as te, guardReactiveProps as ae } from "vue";
2
- import { Table as ne } from "ant-design-vue";
1
+ import { defineComponent as M, useSlots as U, ref as y, watch as W, unref as l, openBlock as w, createBlock as $, withCtx as c, createVNode as v, mergeProps as G, createSlots as J, createElementBlock as Q, Fragment as X, createElementVNode as b, normalizeClass as Y, toDisplayString as Z, createCommentVNode as ee, renderList as te, renderSlot as ae, normalizeProps as ne, guardReactiveProps as oe } from "vue";
2
+ import { Table as le } 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 oe } from "lodash-unified";
4
+ import { isArray as R, isNumber as p, cloneDeep as h, omit as re } 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 { scrollToRowIndex as le, getColumnIsRequired as re } from "./utils.mjs";
9
- import se from "./hooks/use-get-columns.mjs";
8
+ import { scrollToRowIndex as se, getColumnIsRequired as ue } from "./utils.mjs";
9
+ import de from "./hooks/use-get-columns.mjs";
10
10
  import "./style/index.css";
11
- import { useNamespace as ue } from "../config-provider/hooks/use-namespace.mjs";
12
- import { useControllableValue as de } from "../hooks/useControllableValue.mjs";
13
- const be = /* @__PURE__ */ q({
11
+ import { useNamespace as ie } from "../config-provider/hooks/use-namespace.mjs";
12
+ import { useControllableValue as me } from "../hooks/useControllableValue.mjs";
13
+ const Be = /* @__PURE__ */ M({
14
14
  name: "EditableTable",
15
15
  __name: "index",
16
16
  props: {
@@ -109,116 +109,121 @@ const be = /* @__PURE__ */ q({
109
109
  onFieldChange: {}
110
110
  },
111
111
  emits: ["update:value"],
112
- setup(R, {
113
- expose: B,
114
- emit: F
112
+ setup(B, {
113
+ expose: F,
114
+ emit: D
115
115
  }) {
116
- const l = R, {
117
- b: D,
118
- em: _
119
- } = ue("editable-table"), k = H(), E = F, g = w(), {
116
+ const o = B, {
117
+ b: _,
118
+ em: N
119
+ } = ie("editable-table"), k = U(), E = D, g = y(), {
120
120
  value: s,
121
121
  updateValue: L
122
- } = de(l, E), u = w(), N = f.useWatch(l.name, u);
123
- U(() => N.value, (e) => {
124
- var a;
125
- L(e), (a = l.onChange) == null || a.call(l, e);
122
+ } = me(o, E), u = y(), S = f.useWatch(o.name, u);
123
+ W(() => S.value, (e) => {
124
+ var n;
125
+ L(e), (n = o.onChange) == null || n.call(o, e);
126
+ }, {
127
+ deep: !0
126
128
  });
127
- const S = se(l);
128
- function V() {
129
+ const V = de(o);
130
+ function A() {
129
131
  var e;
130
132
  (e = u.value) == null || e.resetFields();
131
133
  }
132
- async function T(e, a) {
133
- var t;
134
- const n = await ((t = u.value) == null ? void 0 : t.validateFields(e, a));
135
- return n == null ? void 0 : n[l.name];
134
+ function T(e) {
135
+ return e ? (R(e) ? e : [e]).map((t) => R(t) ? [o.name, ...t] : [o.name, t]) : void 0;
136
+ }
137
+ async function z(e, n) {
138
+ var a;
139
+ const t = await ((a = u.value) == null ? void 0 : a.validateFields(T(e), n));
140
+ return t == null ? void 0 : t[o.name];
136
141
  }
137
- function z(e, a) {
142
+ function I(e, n) {
138
143
  var r, d, i;
139
- const n = ((r = o(s)) == null ? void 0 : r.length) || 0;
140
- if (x(l.maxLength) && n >= l.maxLength)
144
+ const t = ((r = l(s)) == null ? void 0 : r.length) || 0;
145
+ if (x(o.maxLength) && t >= o.maxLength)
141
146
  return;
142
- const t = [...o(s) || []];
143
- x(a) ? t.splice(a, 0, {
147
+ const a = [...l(s) || []];
148
+ x(n) ? a.splice(n, 0, {
144
149
  ...e || {}
145
- }) : t.push({
150
+ }) : a.push({
146
151
  ...e || {}
147
- }), (i = (d = u.value) == null ? void 0 : d.setFieldValue) == null || i.call(d, l.name, t);
152
+ }), (i = (d = u.value) == null ? void 0 : d.setFieldValue) == null || i.call(d, o.name, a);
148
153
  }
149
- function I(e, a = "suffix") {
154
+ function P(e, n = "suffix") {
150
155
  var i, m, C;
151
- const n = ((i = o(s)) == null ? void 0 : i.length) || 0, t = p(e) ? e : e.length;
152
- if (x(l.maxLength) && n + t > l.maxLength)
156
+ const t = ((i = l(s)) == null ? void 0 : i.length) || 0, a = p(e) ? e : e.length;
157
+ if (x(o.maxLength) && t + a > o.maxLength)
153
158
  return;
154
- const r = [...o(s) || []], d = p(e) ? new Array(e).fill({}) : h(e);
155
- a === "suffix" ? r.push(...d) : r.unshift(...d), (C = (m = u.value) == null ? void 0 : m.setFieldValue) == null || C.call(m, l.name, r);
159
+ const r = [...l(s) || []], d = p(e) ? new Array(e).fill({}) : h(e);
160
+ n === "suffix" ? r.push(...d) : r.unshift(...d), (C = (m = u.value) == null ? void 0 : m.setFieldValue) == null || C.call(m, o.name, r);
156
161
  }
157
- function P(e) {
158
- var t, r;
159
- let a = h(o(s) || []);
160
- const n = p(e) ? [e] : e;
161
- a = a.filter((d, i) => !n.includes(i)), (r = (t = u.value) == null ? void 0 : t.setFieldValue) == null || r.call(t, l.name, a);
162
+ function j(e) {
163
+ var a, r;
164
+ let n = h(l(s) || []);
165
+ const t = p(e) ? [e] : e;
166
+ n = n.filter((d, i) => !t.includes(i)), (r = (a = u.value) == null ? void 0 : a.setFieldValue) == null || r.call(a, o.name, n);
162
167
  }
163
- function j() {
164
- return o(s);
168
+ function O() {
169
+ return l(s);
165
170
  }
166
- function A(e) {
167
- var a;
168
- return (a = o(s)) == null ? void 0 : a[e];
171
+ function K(e) {
172
+ var n;
173
+ return (n = l(s)) == null ? void 0 : n[e];
169
174
  }
170
- function O(e, a) {
171
- var t, r;
172
- const n = h(o(s));
173
- n[e] && (n[e] = {
174
- ...n[e],
175
- ...a
176
- }, (r = (t = u.value) == null ? void 0 : t.setFieldValue) == null || r.call(t, l.name, [...n]));
175
+ function q(e, n) {
176
+ var a, r;
177
+ const t = h(l(s));
178
+ t[e] && (t[e] = {
179
+ ...t[e],
180
+ ...n
181
+ }, (r = (a = u.value) == null ? void 0 : a.setFieldValue) == null || r.call(a, o.name, [...t]));
177
182
  }
178
- function K(e, a) {
179
- var t;
180
- const n = e === "end" ? s.value.length - 1 : e;
181
- le(n, (t = g.value) == null ? void 0 : t.$el, a);
183
+ function H(e, n) {
184
+ var a;
185
+ const t = e === "end" ? s.value.length - 1 : e;
186
+ se(t, (a = g.value) == null ? void 0 : a.$el, n);
182
187
  }
183
- return B({
184
- resetFields: V,
185
- validateFields: T,
186
- add: z,
187
- remove: P,
188
- getRowData: A,
189
- getRowsData: j,
190
- setRowData: O,
191
- addMultiple: I,
192
- scrollTo: K
193
- }), (e, a) => (y(), W(o(f), {
188
+ return F({
189
+ resetFields: A,
190
+ validateFields: z,
191
+ add: I,
192
+ remove: j,
193
+ getRowData: K,
194
+ getRowsData: O,
195
+ setRowData: q,
196
+ addMultiple: P,
197
+ scrollTo: H
198
+ }), (e, n) => (w(), $(l(f), {
194
199
  "initial-values": {
195
- [l.name]: o(s)
200
+ [o.name]: l(s)
196
201
  },
197
202
  ref_key: "formRef",
198
203
  ref: u
199
204
  }, {
200
- default: c(() => [v(o(f).FormItem, {
205
+ default: c(() => [v(l(f).FormItem, {
201
206
  name: e.name,
202
207
  "no-style": ""
203
208
  }, {
204
- default: c(() => [v(o(ne), $(o(oe)(l, ["name", "value", "onUpdate:value", "maxLength", "onChange"]), {
205
- class: o(D)(),
206
- columns: o(S),
207
- "data-source": o(s),
209
+ default: c(() => [v(l(le), G(l(re)(o, ["name", "value", "onUpdate:value", "maxLength", "onChange"]), {
210
+ class: l(_)(),
211
+ columns: l(V),
212
+ "data-source": l(s),
208
213
  ref_key: "tableRef",
209
214
  ref: g
210
- }), G({
215
+ }), J({
211
216
  headerCell: c(({
212
- column: n
213
- }) => [o(re)(n) ? (y(), M(J, {
217
+ column: t
218
+ }) => [l(ue)(t) ? (w(), Q(X, {
214
219
  key: 0
215
220
  }, [b("span", {
216
- class: Q(o(_)("header-cell", "required"))
217
- }, "*", 2), b("span", null, X(n.title), 1)], 64)) : Y("", !0)]),
221
+ class: Y(l(N)("header-cell", "required"))
222
+ }, "*", 2), b("span", null, Z(t.title), 1)], 64)) : ee("", !0)]),
218
223
  _: 2
219
- }, [Z(k, (n, t) => ({
220
- name: t,
221
- fn: c((r) => [ee(e.$slots, t, te(ae(r || {})))])
224
+ }, [te(k, (t, a) => ({
225
+ name: a,
226
+ fn: c((r) => [ae(e.$slots, a, ne(oe(r || {})))])
222
227
  }))]), 1040, ["class", "columns", "data-source"])]),
223
228
  _: 3
224
229
  }, 8, ["name"])]),
@@ -227,5 +232,5 @@ const be = /* @__PURE__ */ q({
227
232
  }
228
233
  });
229
234
  export {
230
- be as default
235
+ Be as default
231
236
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),L=require("ant-design-vue"),h=require("../ap-form/index.js"),d=require("lodash-unified");require("../config-provider/index.js");const _=require("../ap-form/context.js");require("./style/index.css");const f=require("../utils/index.js"),P=require("./hooks/use-get-columns.js"),g=require("./utils.js"),T=require("../config-provider/hooks/use-namespace.js"),V=e.defineComponent({name:"EditableTableInner",__name:"form-item",props:{dropdownPrefixCls:{},pagination:{type:[Boolean,Object],default:!1},loading:{type:[Boolean,Object],default:void 0},size:{default:"middle"},bordered:{type:Boolean,default:!1},locale:{},onResizeColumn:{},rowSelection:{},getPopupContainer:{},scroll:{},sortDirections:{default:()=>["ascend","descend"]},showSorterTooltip:{type:[Boolean,Object],default:!0},prefixCls:{},rowKey:{default:"key"},tableLayout:{default:"fixed"},rowClassName:{},title:{},footer:{},id:{},showHeader:{type:Boolean,default:!0},components:{},customRow:{},customHeaderRow:{},direction:{},expandFixed:{type:[String,Boolean],default:!1},expandColumnWidth:{},expandedRowKeys:{},defaultExpandedRowKeys:{},expandedRowRender:{},expandRowByClick:{type:Boolean,default:!1},expandIcon:{},onExpand:{},onExpandedRowsChange:{},defaultExpandAllRows:{type:Boolean,default:!1},indentSize:{default:15},expandIconColumnIndex:{},showExpandColumn:{type:Boolean,default:!0},expandedRowClassName:{},childrenColumnName:{default:"children"},rowExpandable:{},sticky:{type:[Boolean,Object]},transformCellText:{},columns:{},value:{},defaultValue:{},"onUpdate:value":{},onChange:{},maxLength:{},onFieldChange:{},label:{},name:{},formItem:{default:()=>({})}},setup(x,{expose:C}){var i;const a=x,{internalInstance:l,model:b}=_.useInjectForm(),r=e.ref(((i=e.unref(b))==null?void 0:i[a.name])||[]),w=e.useSlots(),y=h.ApForm.useWatch(a.name);e.watch(()=>y.value,t=>{var n;r.value=t,(n=a.onChange)==null||n.call(a,t)});const{b:R,em:D}=T.useNamespace("editable-table"),c=e.ref(),B=P.default(a);function q(t,n){var s;const o=((s=e.unref(r))==null?void 0:s.length)||0;if(f.isDef(a.maxLength)&&o>=a.maxLength)return;const u=[...e.unref(r)||[]];f.isDef(n)?u.splice(n,0,{...t||{}}):u.push({...t||{}}),l==null||l.setFieldValue(a.name,[...e.unref(r)||[],t||{}])}function v(t,n="suffix"){var p;const o=((p=e.unref(r))==null?void 0:p.length)||0,u=d.isNumber(t)?t:t.length;if(f.isDef(a.maxLength)&&o+u>a.maxLength)return;const s=[...e.unref(r)||[]],m=d.isNumber(t)?new Array(t).fill({}):d.cloneDeep(t);n==="suffix"?s.push(...m):s.unshift(...m),l==null||l.setFieldValue(a.name,s)}function N(t){let n=d.cloneDeep(e.unref(r)||[]);const o=d.isNumber(t)?[t]:t;n=n.filter((u,s)=>!o.includes(s)),l==null||l.setFieldValue(a.name,n)}function F(){return e.unref(r)}function E(t){var n;return(n=e.unref(r))==null?void 0:n[t]}function S(t,n){const o=d.cloneDeep(e.unref(r));o[t]&&(o[t]={...o[t],...n},l==null||l.setFieldValue(a.name,[...o]))}function k(t,n){var u;const o=t==="end"?r.value.length-1:t;g.scrollToRowIndex(o,(u=c.value)==null?void 0:u.$el,n)}return C({add:q,remove:N,getRowData:E,getRowsData:F,setRowData:S,addMultiple:v,scrollTo:k}),(t,n)=>(e.openBlock(),e.createBlock(e.unref(h.ApForm).FormItem,e.mergeProps(t.formItem,{name:t.name,label:t.label}),{default:e.withCtx(()=>[e.createVNode(e.unref(L.Table),e.mergeProps(e.unref(d.omit)(a,["name","maxLength","onChange"]),{class:e.unref(R)(),columns:e.unref(B),"data-source":r.value,ref_key:"tableRef",ref:c}),e.createSlots({headerCell:e.withCtx(({column:o})=>[e.unref(g.getColumnIsRequired)(o)?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createElementVNode("span",{class:e.normalizeClass(e.unref(D)("header-cell","required"))},"*",2),e.createElementVNode("span",null,e.toDisplayString(o.title),1)],64)):e.createCommentVNode("",!0)]),_:2},[e.renderList(w,(o,u)=>({name:u,fn:e.withCtx(s=>[e.renderSlot(t.$slots,u,e.normalizeProps(e.guardReactiveProps(s||{})))])}))]),1040,["class","columns","data-source"])]),_:3},16,["name","label"]))}});exports.default=V;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),L=require("ant-design-vue"),h=require("../ap-form/index.js"),d=require("lodash-unified");require("../config-provider/index.js");const _=require("../ap-form/context.js");require("./style/index.css");const f=require("../utils/index.js"),P=require("./hooks/use-get-columns.js"),g=require("./utils.js"),T=require("../config-provider/hooks/use-namespace.js"),V=e.defineComponent({name:"EditableTableInner",__name:"form-item",props:{dropdownPrefixCls:{},pagination:{type:[Boolean,Object],default:!1},loading:{type:[Boolean,Object],default:void 0},size:{default:"middle"},bordered:{type:Boolean,default:!1},locale:{},onResizeColumn:{},rowSelection:{},getPopupContainer:{},scroll:{},sortDirections:{default:()=>["ascend","descend"]},showSorterTooltip:{type:[Boolean,Object],default:!0},prefixCls:{},rowKey:{default:"key"},tableLayout:{default:"fixed"},rowClassName:{},title:{},footer:{},id:{},showHeader:{type:Boolean,default:!0},components:{},customRow:{},customHeaderRow:{},direction:{},expandFixed:{type:[String,Boolean],default:!1},expandColumnWidth:{},expandedRowKeys:{},defaultExpandedRowKeys:{},expandedRowRender:{},expandRowByClick:{type:Boolean,default:!1},expandIcon:{},onExpand:{},onExpandedRowsChange:{},defaultExpandAllRows:{type:Boolean,default:!1},indentSize:{default:15},expandIconColumnIndex:{},showExpandColumn:{type:Boolean,default:!0},expandedRowClassName:{},childrenColumnName:{default:"children"},rowExpandable:{},sticky:{type:[Boolean,Object]},transformCellText:{},columns:{},value:{},defaultValue:{},"onUpdate:value":{},onChange:{},maxLength:{},onFieldChange:{},label:{},name:{},formItem:{default:()=>({})}},setup(x,{expose:C}){var i;const a=x,{internalInstance:l,model:b}=_.useInjectForm(),r=e.ref(((i=e.unref(b))==null?void 0:i[a.name])||[]),w=e.useSlots(),y=h.ApForm.useWatch(a.name);e.watch(()=>y.value,t=>{var n;r.value=t,(n=a.onChange)==null||n.call(a,t)},{deep:!0});const{b:R,em:D}=T.useNamespace("editable-table"),c=e.ref(),B=P.default(a);function q(t,n){var s;const o=((s=e.unref(r))==null?void 0:s.length)||0;if(f.isDef(a.maxLength)&&o>=a.maxLength)return;const u=[...e.unref(r)||[]];f.isDef(n)?u.splice(n,0,{...t||{}}):u.push({...t||{}}),l==null||l.setFieldValue(a.name,[...e.unref(r)||[],t||{}])}function v(t,n="suffix"){var p;const o=((p=e.unref(r))==null?void 0:p.length)||0,u=d.isNumber(t)?t:t.length;if(f.isDef(a.maxLength)&&o+u>a.maxLength)return;const s=[...e.unref(r)||[]],m=d.isNumber(t)?new Array(t).fill({}):d.cloneDeep(t);n==="suffix"?s.push(...m):s.unshift(...m),l==null||l.setFieldValue(a.name,s)}function N(t){let n=d.cloneDeep(e.unref(r)||[]);const o=d.isNumber(t)?[t]:t;n=n.filter((u,s)=>!o.includes(s)),l==null||l.setFieldValue(a.name,n)}function F(){return e.unref(r)}function E(t){var n;return(n=e.unref(r))==null?void 0:n[t]}function S(t,n){const o=d.cloneDeep(e.unref(r));o[t]&&(o[t]={...o[t],...n},l==null||l.setFieldValue(a.name,[...o]))}function k(t,n){var u;const o=t==="end"?r.value.length-1:t;g.scrollToRowIndex(o,(u=c.value)==null?void 0:u.$el,n)}return C({add:q,remove:N,getRowData:E,getRowsData:F,setRowData:S,addMultiple:v,scrollTo:k}),(t,n)=>(e.openBlock(),e.createBlock(e.unref(h.ApForm).FormItem,e.mergeProps(t.formItem,{name:t.name,label:t.label}),{default:e.withCtx(()=>[e.createVNode(e.unref(L.Table),e.mergeProps(e.unref(d.omit)(a,["name","maxLength","onChange"]),{class:e.unref(R)(),columns:e.unref(B),"data-source":r.value,ref_key:"tableRef",ref:c}),e.createSlots({headerCell:e.withCtx(({column:o})=>[e.unref(g.getColumnIsRequired)(o)?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createElementVNode("span",{class:e.normalizeClass(e.unref(D)("header-cell","required"))},"*",2),e.createElementVNode("span",null,e.toDisplayString(o.title),1)],64)):e.createCommentVNode("",!0)]),_:2},[e.renderList(w,(o,u)=>({name:u,fn:e.withCtx(s=>[e.renderSlot(t.$slots,u,e.normalizeProps(e.guardReactiveProps(s||{})))])}))]),1040,["class","columns","data-source"])]),_:3},16,["name","label"]))}});exports.default=V;
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),P=require("ant-design-vue"),m=require("../ap-form/index.js"),c=require("lodash-unified");require("../config-provider/index.js");require("../hooks/index.js");const p=require("../utils/index.js"),g=require("./utils.js"),j=require("./hooks/use-get-columns.js");require("./style/index.css");const z=require("../config-provider/hooks/use-namespace.js"),I=require("../hooks/useControllableValue.js"),O=e.defineComponent({name:"EditableTable",__name:"index",props:{dropdownPrefixCls:{},pagination:{type:[Boolean,Object],default:!1},loading:{type:[Boolean,Object],default:void 0},size:{default:"middle"},bordered:{type:Boolean,default:!1},locale:{},onResizeColumn:{},rowSelection:{},getPopupContainer:{},scroll:{},sortDirections:{default:()=>["ascend","descend"]},showSorterTooltip:{type:[Boolean,Object],default:!0},prefixCls:{},rowKey:{default:"key"},tableLayout:{default:"fixed"},rowClassName:{},title:{},footer:{},id:{},showHeader:{type:Boolean,default:!0},components:{},customRow:{},customHeaderRow:{},direction:{},expandFixed:{type:[String,Boolean],default:!1},expandColumnWidth:{},expandedRowKeys:{},defaultExpandedRowKeys:{},expandedRowRender:{},expandRowByClick:{type:Boolean,default:!1},expandIcon:{},onExpand:{},onExpandedRowsChange:{},defaultExpandAllRows:{type:Boolean,default:!1},indentSize:{default:15},expandIconColumnIndex:{},showExpandColumn:{type:Boolean,default:!0},expandedRowClassName:{},childrenColumnName:{default:"children"},rowExpandable:{},sticky:{type:[Boolean,Object]},transformCellText:{},columns:{},value:{},defaultValue:{},"onUpdate:value":{},onChange:{},maxLength:{},name:{default:"ap-editable-table-inner-name"},onFieldChange:{}},emits:["update:value"],setup(C,{expose:w,emit:b}){const l=C,{b:v,em:y}=z.useNamespace("editable-table"),R=e.useSlots(),D=b,h=e.ref(),{value:u,updateValue:B}=I.useControllableValue(l,D),s=e.ref(),F=m.ApForm.useWatch(l.name,s);e.watch(()=>F.value,n=>{var a;B(n),(a=l.onChange)==null||a.call(l,n)});const q=j.default(l);function N(){var n;(n=s.value)==null||n.resetFields()}async function _(n,a){var t;const o=await((t=s.value)==null?void 0:t.validateFields(n,a));return o==null?void 0:o[l.name]}function V(n,a){var r,i,d;const o=((r=e.unref(u))==null?void 0:r.length)||0;if(p.isDef(l.maxLength)&&o>=l.maxLength)return;const t=[...e.unref(u)||[]];p.isDef(a)?t.splice(a,0,{...n||{}}):t.push({...n||{}}),(d=(i=s.value)==null?void 0:i.setFieldValue)==null||d.call(i,l.name,t)}function k(n,a="suffix"){var d,f,x;const o=((d=e.unref(u))==null?void 0:d.length)||0,t=c.isNumber(n)?n:n.length;if(p.isDef(l.maxLength)&&o+t>l.maxLength)return;const r=[...e.unref(u)||[]],i=c.isNumber(n)?new Array(n).fill({}):c.cloneDeep(n);a==="suffix"?r.push(...i):r.unshift(...i),(x=(f=s.value)==null?void 0:f.setFieldValue)==null||x.call(f,l.name,r)}function E(n){var t,r;let a=c.cloneDeep(e.unref(u)||[]);const o=c.isNumber(n)?[n]:n;a=a.filter((i,d)=>!o.includes(d)),(r=(t=s.value)==null?void 0:t.setFieldValue)==null||r.call(t,l.name,a)}function S(){return e.unref(u)}function L(n){var a;return(a=e.unref(u))==null?void 0:a[n]}function T(n,a){var t,r;const o=c.cloneDeep(e.unref(u));o[n]&&(o[n]={...o[n],...a},(r=(t=s.value)==null?void 0:t.setFieldValue)==null||r.call(t,l.name,[...o]))}function A(n,a){var t;const o=n==="end"?u.value.length-1:n;g.scrollToRowIndex(o,(t=h.value)==null?void 0:t.$el,a)}return w({resetFields:N,validateFields:_,add:V,remove:E,getRowData:L,getRowsData:S,setRowData:T,addMultiple:k,scrollTo:A}),(n,a)=>(e.openBlock(),e.createBlock(e.unref(m.ApForm),{"initial-values":{[l.name]:e.unref(u)},ref_key:"formRef",ref:s},{default:e.withCtx(()=>[e.createVNode(e.unref(m.ApForm).FormItem,{name:n.name,"no-style":""},{default:e.withCtx(()=>[e.createVNode(e.unref(P.Table),e.mergeProps(e.unref(c.omit)(l,["name","value","onUpdate:value","maxLength","onChange"]),{class:e.unref(v)(),columns:e.unref(q),"data-source":e.unref(u),ref_key:"tableRef",ref:h}),e.createSlots({headerCell:e.withCtx(({column:o})=>[e.unref(g.getColumnIsRequired)(o)?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createElementVNode("span",{class:e.normalizeClass(e.unref(y)("header-cell","required"))},"*",2),e.createElementVNode("span",null,e.toDisplayString(o.title),1)],64)):e.createCommentVNode("",!0)]),_:2},[e.renderList(R,(o,t)=>({name:t,fn:e.withCtx(r=>[e.renderSlot(n.$slots,t,e.normalizeProps(e.guardReactiveProps(r||{})))])}))]),1040,["class","columns","data-source"])]),_:3},8,["name"])]),_:3},8,["initial-values"]))}});exports.default=O;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),j=require("ant-design-vue"),m=require("../ap-form/index.js"),s=require("lodash-unified");require("../config-provider/index.js");require("../hooks/index.js");const p=require("../utils/index.js"),g=require("./utils.js"),z=require("./hooks/use-get-columns.js");require("./style/index.css");const I=require("../config-provider/hooks/use-namespace.js"),O=require("../hooks/useControllableValue.js"),M=e.defineComponent({name:"EditableTable",__name:"index",props:{dropdownPrefixCls:{},pagination:{type:[Boolean,Object],default:!1},loading:{type:[Boolean,Object],default:void 0},size:{default:"middle"},bordered:{type:Boolean,default:!1},locale:{},onResizeColumn:{},rowSelection:{},getPopupContainer:{},scroll:{},sortDirections:{default:()=>["ascend","descend"]},showSorterTooltip:{type:[Boolean,Object],default:!0},prefixCls:{},rowKey:{default:"key"},tableLayout:{default:"fixed"},rowClassName:{},title:{},footer:{},id:{},showHeader:{type:Boolean,default:!0},components:{},customRow:{},customHeaderRow:{},direction:{},expandFixed:{type:[String,Boolean],default:!1},expandColumnWidth:{},expandedRowKeys:{},defaultExpandedRowKeys:{},expandedRowRender:{},expandRowByClick:{type:Boolean,default:!1},expandIcon:{},onExpand:{},onExpandedRowsChange:{},defaultExpandAllRows:{type:Boolean,default:!1},indentSize:{default:15},expandIconColumnIndex:{},showExpandColumn:{type:Boolean,default:!0},expandedRowClassName:{},childrenColumnName:{default:"children"},rowExpandable:{},sticky:{type:[Boolean,Object]},transformCellText:{},columns:{},value:{},defaultValue:{},"onUpdate:value":{},onChange:{},maxLength:{},name:{default:"ap-editable-table-inner-name"},onFieldChange:{}},emits:["update:value"],setup(C,{expose:w,emit:y}){const l=C,{b,em:v}=I.useNamespace("editable-table"),R=e.useSlots(),D=y,h=e.ref(),{value:u,updateValue:B}=O.useControllableValue(l,D),i=e.ref(),F=m.ApForm.useWatch(l.name,i);e.watch(()=>F.value,n=>{var o;B(n),(o=l.onChange)==null||o.call(l,n)},{deep:!0});const N=z.default(l);function q(){var n;(n=i.value)==null||n.resetFields()}function _(n){return n?(s.isArray(n)?n:[n]).map(t=>s.isArray(t)?[l.name,...t]:[l.name,t]):void 0}async function V(n,o){var a;const t=await((a=i.value)==null?void 0:a.validateFields(_(n),o));return t==null?void 0:t[l.name]}function k(n,o){var r,d,c;const t=((r=e.unref(u))==null?void 0:r.length)||0;if(p.isDef(l.maxLength)&&t>=l.maxLength)return;const a=[...e.unref(u)||[]];p.isDef(o)?a.splice(o,0,{...n||{}}):a.push({...n||{}}),(c=(d=i.value)==null?void 0:d.setFieldValue)==null||c.call(d,l.name,a)}function A(n,o="suffix"){var c,f,x;const t=((c=e.unref(u))==null?void 0:c.length)||0,a=s.isNumber(n)?n:n.length;if(p.isDef(l.maxLength)&&t+a>l.maxLength)return;const r=[...e.unref(u)||[]],d=s.isNumber(n)?new Array(n).fill({}):s.cloneDeep(n);o==="suffix"?r.push(...d):r.unshift(...d),(x=(f=i.value)==null?void 0:f.setFieldValue)==null||x.call(f,l.name,r)}function E(n){var a,r;let o=s.cloneDeep(e.unref(u)||[]);const t=s.isNumber(n)?[n]:n;o=o.filter((d,c)=>!t.includes(c)),(r=(a=i.value)==null?void 0:a.setFieldValue)==null||r.call(a,l.name,o)}function S(){return e.unref(u)}function L(n){var o;return(o=e.unref(u))==null?void 0:o[n]}function T(n,o){var a,r;const t=s.cloneDeep(e.unref(u));t[n]&&(t[n]={...t[n],...o},(r=(a=i.value)==null?void 0:a.setFieldValue)==null||r.call(a,l.name,[...t]))}function P(n,o){var a;const t=n==="end"?u.value.length-1:n;g.scrollToRowIndex(t,(a=h.value)==null?void 0:a.$el,o)}return w({resetFields:q,validateFields:V,add:k,remove:E,getRowData:L,getRowsData:S,setRowData:T,addMultiple:A,scrollTo:P}),(n,o)=>(e.openBlock(),e.createBlock(e.unref(m.ApForm),{"initial-values":{[l.name]:e.unref(u)},ref_key:"formRef",ref:i},{default:e.withCtx(()=>[e.createVNode(e.unref(m.ApForm).FormItem,{name:n.name,"no-style":""},{default:e.withCtx(()=>[e.createVNode(e.unref(j.Table),e.mergeProps(e.unref(s.omit)(l,["name","value","onUpdate:value","maxLength","onChange"]),{class:e.unref(b)(),columns:e.unref(N),"data-source":e.unref(u),ref_key:"tableRef",ref:h}),e.createSlots({headerCell:e.withCtx(({column:t})=>[e.unref(g.getColumnIsRequired)(t)?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createElementVNode("span",{class:e.normalizeClass(e.unref(v)("header-cell","required"))},"*",2),e.createElementVNode("span",null,e.toDisplayString(t.title),1)],64)):e.createCommentVNode("",!0)]),_:2},[e.renderList(R,(t,a)=>({name:a,fn:e.withCtx(r=>[e.renderSlot(n.$slots,a,e.normalizeProps(e.guardReactiveProps(r||{})))])}))]),1040,["class","columns","data-source"])]),_:3},8,["name"])]),_:3},8,["initial-values"]))}});exports.default=M;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aplus-frontend/ui",
3
- "version": "0.1.12",
3
+ "version": "0.1.13",
4
4
  "main": "lib/index.js",
5
5
  "module": "es/index.mjs",
6
6
  "files": [