@aplus-frontend/ui 0.3.4 → 0.3.6
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-table/hooks/use-table-content-height.mjs +5 -5
- package/es/src/ap-table/hooks/use-table-paging.mjs +8 -8
- package/es/src/business/ap-ladder/interface.d.ts +8 -8
- package/es/src/editable-table/form-item.vue.mjs +67 -63
- package/lib/src/ap-table/hooks/use-table-content-height.js +1 -1
- package/lib/src/ap-table/hooks/use-table-paging.js +1 -1
- package/lib/src/business/ap-ladder/interface.d.ts +8 -8
- package/lib/src/editable-table/form-item.vue.js +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "../../config-provider/index.mjs";
|
|
2
2
|
import { useElementSize as y } from "@vueuse/core";
|
|
3
|
-
import { ref as
|
|
3
|
+
import { ref as h, computed as v, unref as u, onUpdated as q } from "vue";
|
|
4
4
|
import { useGlobalConfig as N } from "../../config-provider/hooks/use-global-config.mjs";
|
|
5
5
|
function p(t) {
|
|
6
6
|
if (!t)
|
|
@@ -15,13 +15,13 @@ function m(t) {
|
|
|
15
15
|
return t.clientHeight + p(e.marginTop) + p(e.marginBottom);
|
|
16
16
|
}
|
|
17
17
|
const _ = (t) => {
|
|
18
|
-
const e =
|
|
18
|
+
const e = h(), { height: d } = y(e), H = N("namespace"), a = h();
|
|
19
19
|
let i = !1;
|
|
20
20
|
const S = v(() => {
|
|
21
|
-
var
|
|
22
|
-
const n = ((
|
|
21
|
+
var c, l, g, s, f;
|
|
22
|
+
const n = ((l = (c = e.value) == null ? void 0 : c.querySelector(`.${u(H)}-ap-table-header-wrapper`)) == null ? void 0 : l.clientHeight) || 0, r = ((s = (g = e.value) == null ? void 0 : g.querySelector(".ant-table-header")) == null ? void 0 : s.clientHeight) || 47, o = (f = e.value) == null ? void 0 : f.querySelector(".ant-pagination"), b = o ? m(o) : u(a);
|
|
23
23
|
return o && (i = !0), Math.ceil(
|
|
24
|
-
|
|
24
|
+
u(d) - r - n - (b || 0) - ((t == null ? void 0 : t.offset) || 0)
|
|
25
25
|
);
|
|
26
26
|
});
|
|
27
27
|
return q(() => {
|
|
@@ -57,11 +57,11 @@ const Te = ({
|
|
|
57
57
|
}
|
|
58
58
|
}), a;
|
|
59
59
|
}, X = async (e) => {
|
|
60
|
-
var n, i,
|
|
60
|
+
var n, i, d, g, m, f, h;
|
|
61
61
|
const a = ((i = (n = u.value) == null ? void 0 : n.apForm) == null ? void 0 : i.getFieldsValueTransformed(!0)) || {}, t = {};
|
|
62
62
|
Object.entries(a).forEach(([v, x]) => {
|
|
63
63
|
D && D.indexOf(v) > -1 && (t[v] = x);
|
|
64
|
-
}), await ((
|
|
64
|
+
}), await ((g = (d = u.value) == null ? void 0 : d.apForm) == null ? void 0 : g.resetFields()), (h = (f = (m = u.value) == null ? void 0 : m.apForm) == null ? void 0 : f.setFieldsValue) == null || h.call(f, t), ae(() => {
|
|
65
65
|
e == null || e();
|
|
66
66
|
});
|
|
67
67
|
}, S = (e) => {
|
|
@@ -96,16 +96,16 @@ const Te = ({
|
|
|
96
96
|
var f, h, v, x;
|
|
97
97
|
const n = ((h = (f = u.value) == null ? void 0 : f.apForm) == null ? void 0 : h.getFieldsValueTransformed(!0)) || {};
|
|
98
98
|
c.value = e.current, p.value = e.pageSize, H(a, t);
|
|
99
|
-
const i = q(t) ? [...t] : [t],
|
|
99
|
+
const i = q(t) ? [...t] : [t], d = {};
|
|
100
100
|
for (const l of i)
|
|
101
|
-
(v = o(L)) != null && v.includes(l.columnKey || l.field) && (
|
|
102
|
-
const
|
|
101
|
+
(v = o(L)) != null && v.includes(l.columnKey || l.field) && l.order && (d[ne(l.columnKey || l.field)] = l.order);
|
|
102
|
+
const g = {};
|
|
103
103
|
for (const l of Object.keys(a))
|
|
104
|
-
(x = o(J)) != null && x.includes(l) && (
|
|
104
|
+
(x = o(J)) != null && x.includes(l) && a[l] && (g[l] = a[l]);
|
|
105
105
|
const m = {
|
|
106
106
|
...n,
|
|
107
|
-
filter:
|
|
108
|
-
sort:
|
|
107
|
+
filter: g,
|
|
108
|
+
sort: d,
|
|
109
109
|
current: e.current,
|
|
110
110
|
pageSize: e.pageSize
|
|
111
111
|
};
|
|
@@ -73,40 +73,40 @@ export interface ApLadderProps {
|
|
|
73
73
|
* 重要信息
|
|
74
74
|
* @description 如 操作人名称、供应商名称...
|
|
75
75
|
*/
|
|
76
|
-
major
|
|
76
|
+
major?: string;
|
|
77
77
|
/**
|
|
78
78
|
* 次要信息
|
|
79
79
|
* @description 如 操作人邮箱、供应商编码...
|
|
80
80
|
*/
|
|
81
|
-
minor
|
|
81
|
+
minor?: string;
|
|
82
82
|
/**
|
|
83
83
|
* 自定义重要信息颜色
|
|
84
84
|
*/
|
|
85
|
-
majorColor
|
|
85
|
+
majorColor?: string;
|
|
86
86
|
/**
|
|
87
87
|
* 自定义次要信息颜色
|
|
88
88
|
*/
|
|
89
|
-
minorColor
|
|
89
|
+
minorColor?: string;
|
|
90
90
|
/**
|
|
91
91
|
* 布局方式
|
|
92
92
|
* - `vertical` 垂直布局
|
|
93
93
|
* - `horizontal` 水平布局
|
|
94
94
|
* @default `vertical`
|
|
95
95
|
*/
|
|
96
|
-
layout
|
|
96
|
+
layout?: 'vertical' | 'horizontal';
|
|
97
97
|
/**
|
|
98
98
|
* 是否展示气泡
|
|
99
99
|
* @description 默认展示
|
|
100
100
|
*/
|
|
101
|
-
tooltip
|
|
101
|
+
tooltip?: boolean;
|
|
102
102
|
/**
|
|
103
103
|
* 健值对 - 数组展示
|
|
104
104
|
*/
|
|
105
|
-
labelValues
|
|
105
|
+
labelValues?: Array<ApLadderLabelValue>;
|
|
106
106
|
/**
|
|
107
107
|
* 扩展 Tooltip
|
|
108
108
|
*/
|
|
109
|
-
tooltipProps
|
|
109
|
+
tooltipProps?: TooltipNeedProps;
|
|
110
110
|
}
|
|
111
111
|
/**
|
|
112
112
|
* ApLadder Slots 类型声明
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { Table as
|
|
3
|
-
import { ApForm as
|
|
4
|
-
import { isArray as Z, isNumber as
|
|
1
|
+
import { defineComponent as K, ref as d, unref as n, useSlots as M, watch as g, openBlock as G, createBlock as H, mergeProps as b, withCtx as w, createVNode as W, createSlots as $, renderList as q, renderSlot as U, normalizeProps as J, guardReactiveProps as Q } from "vue";
|
|
2
|
+
import { Table as X } from "@aplus-frontend/antdv";
|
|
3
|
+
import { ApForm as C } from "../ap-form/index.mjs";
|
|
4
|
+
import { isArray as Y, isEqual as Z, isNumber as f, cloneDeep as m, omit as y } from "lodash-unified";
|
|
5
5
|
import "../config-provider/index.mjs";
|
|
6
6
|
import { useInjectForm as I } from "../ap-form/context.mjs";
|
|
7
|
-
import { isDef as
|
|
7
|
+
import { isDef as i } from "../utils/index.mjs";
|
|
8
8
|
import ee from "./hooks/use-get-columns.mjs";
|
|
9
9
|
import { scrollToRowIndex as oe } from "./utils.mjs";
|
|
10
10
|
import { useNamespace as te } from "../config-provider/hooks/use-namespace.mjs";
|
|
11
11
|
import { useGlobalConfig as ae } from "../config-provider/hooks/use-global-config.mjs";
|
|
12
|
-
const he = /* @__PURE__ */
|
|
12
|
+
const he = /* @__PURE__ */ K({
|
|
13
13
|
name: "EditableTableInner",
|
|
14
14
|
__name: "form-item",
|
|
15
15
|
props: {
|
|
@@ -109,102 +109,106 @@ const he = /* @__PURE__ */ O({
|
|
|
109
109
|
default: () => ({})
|
|
110
110
|
}
|
|
111
111
|
},
|
|
112
|
-
setup(
|
|
113
|
-
expose:
|
|
112
|
+
setup(R, {
|
|
113
|
+
expose: B
|
|
114
114
|
}) {
|
|
115
|
-
const l =
|
|
116
|
-
function
|
|
117
|
-
return
|
|
115
|
+
const l = R;
|
|
116
|
+
function D(e, o) {
|
|
117
|
+
return Y(o) ? o.reduce((u, a) => u == null ? void 0 : u[a], e) : e == null ? void 0 : e[o];
|
|
118
118
|
}
|
|
119
119
|
const {
|
|
120
120
|
internalInstance: t,
|
|
121
|
-
model:
|
|
122
|
-
} = I(),
|
|
123
|
-
|
|
121
|
+
model: F
|
|
122
|
+
} = I(), r = d(D(n(F), l.name) || []), L = M(), c = d(l.name);
|
|
123
|
+
g(() => l.name, (e, o) => {
|
|
124
|
+
Z(e, o) || (c.value = e);
|
|
125
|
+
});
|
|
126
|
+
const T = C.useWatch(c);
|
|
127
|
+
g(() => T.value, (e) => {
|
|
124
128
|
var o;
|
|
125
|
-
|
|
129
|
+
r.value = e, (o = l.onChange) == null || o.call(l, e);
|
|
126
130
|
}, {
|
|
127
131
|
deep: !0
|
|
128
132
|
});
|
|
129
133
|
const {
|
|
130
|
-
b:
|
|
131
|
-
} = te("editable-table"),
|
|
132
|
-
function
|
|
134
|
+
b: v
|
|
135
|
+
} = te("editable-table"), p = d(), E = ae("valueTypeMap"), N = ee(l, E);
|
|
136
|
+
function V(e, o) {
|
|
133
137
|
var s;
|
|
134
|
-
const
|
|
135
|
-
if (
|
|
138
|
+
const u = ((s = n(r)) == null ? void 0 : s.length) || 0;
|
|
139
|
+
if (i(l.maxLength) && u >= l.maxLength)
|
|
136
140
|
return;
|
|
137
|
-
const a = [...n(
|
|
138
|
-
|
|
141
|
+
const a = [...n(r) || []];
|
|
142
|
+
i(o) ? a.splice(o, 0, {
|
|
139
143
|
...e || {}
|
|
140
144
|
}) : a.push({
|
|
141
145
|
...e || {}
|
|
142
146
|
}), t == null || t.setFieldValue(l.name, a);
|
|
143
147
|
}
|
|
144
|
-
function
|
|
145
|
-
var
|
|
146
|
-
const
|
|
147
|
-
if (
|
|
148
|
+
function S(e, o = "suffix") {
|
|
149
|
+
var x;
|
|
150
|
+
const u = ((x = n(r)) == null ? void 0 : x.length) || 0, a = f(e) ? e : e.length;
|
|
151
|
+
if (i(l.maxLength) && u + a > l.maxLength)
|
|
148
152
|
return;
|
|
149
|
-
const s = [...n(
|
|
150
|
-
o === "suffix" ? s.push(...
|
|
153
|
+
const s = [...n(r) || []], h = f(e) ? new Array(e).fill({}) : m(e);
|
|
154
|
+
o === "suffix" ? s.push(...h) : s.unshift(...h), t == null || t.setFieldValue(l.name, s);
|
|
151
155
|
}
|
|
152
|
-
function
|
|
153
|
-
let o =
|
|
154
|
-
const
|
|
155
|
-
o = o.filter((a, s) => !
|
|
156
|
+
function _(e) {
|
|
157
|
+
let o = m(n(r) || []);
|
|
158
|
+
const u = f(e) ? [e] : e;
|
|
159
|
+
o = o.filter((a, s) => !u.includes(s)), t == null || t.setFieldValue(l.name, o);
|
|
156
160
|
}
|
|
157
|
-
function
|
|
158
|
-
return n(
|
|
161
|
+
function k() {
|
|
162
|
+
return n(r);
|
|
159
163
|
}
|
|
160
|
-
function
|
|
164
|
+
function j(e) {
|
|
161
165
|
var o;
|
|
162
|
-
return (o = n(
|
|
166
|
+
return (o = n(r)) == null ? void 0 : o[e];
|
|
163
167
|
}
|
|
164
|
-
function
|
|
165
|
-
const a =
|
|
168
|
+
function A(e, o, u = !0) {
|
|
169
|
+
const a = m(n(r));
|
|
166
170
|
a[e] && (a[e] = {
|
|
167
|
-
...
|
|
171
|
+
...u ? a[e] : {},
|
|
168
172
|
...o
|
|
169
173
|
}, t == null || t.setFieldValue(l.name, [...a]));
|
|
170
174
|
}
|
|
171
|
-
function
|
|
175
|
+
function P(e) {
|
|
172
176
|
t == null || t.setFieldValue(l.name, e);
|
|
173
177
|
}
|
|
174
|
-
function
|
|
178
|
+
function z(e, o) {
|
|
175
179
|
var a;
|
|
176
|
-
const
|
|
177
|
-
oe(
|
|
180
|
+
const u = e === "end" ? r.value.length - 1 : e;
|
|
181
|
+
oe(u, (a = p.value) == null ? void 0 : a.$el, o);
|
|
178
182
|
}
|
|
179
|
-
function
|
|
183
|
+
function O() {
|
|
180
184
|
var e;
|
|
181
185
|
(e = t == null ? void 0 : t.setFieldValue) == null || e.call(t, l.name, []);
|
|
182
186
|
}
|
|
183
|
-
return
|
|
184
|
-
add:
|
|
185
|
-
remove:
|
|
186
|
-
getRowData:
|
|
187
|
-
getRowsData:
|
|
188
|
-
setRowData:
|
|
189
|
-
addMultiple:
|
|
190
|
-
scrollTo:
|
|
191
|
-
setTableData:
|
|
192
|
-
clear:
|
|
193
|
-
}), (e, o) => (
|
|
187
|
+
return B({
|
|
188
|
+
add: V,
|
|
189
|
+
remove: _,
|
|
190
|
+
getRowData: j,
|
|
191
|
+
getRowsData: k,
|
|
192
|
+
setRowData: A,
|
|
193
|
+
addMultiple: S,
|
|
194
|
+
scrollTo: z,
|
|
195
|
+
setTableData: P,
|
|
196
|
+
clear: O
|
|
197
|
+
}), (e, o) => (G(), H(n(C).FormItem, b(e.formItem, {
|
|
194
198
|
name: e.name,
|
|
195
199
|
label: e.label
|
|
196
200
|
}), {
|
|
197
|
-
default:
|
|
201
|
+
default: w(() => [W(n(X), b(n(y)(l, ["name", "maxLength", "onChange"]), {
|
|
198
202
|
ref_key: "tableRef",
|
|
199
|
-
ref:
|
|
200
|
-
class: n(
|
|
201
|
-
columns: n(
|
|
202
|
-
"data-source":
|
|
203
|
-
}),
|
|
203
|
+
ref: p,
|
|
204
|
+
class: n(v)(),
|
|
205
|
+
columns: n(N),
|
|
206
|
+
"data-source": r.value
|
|
207
|
+
}), $({
|
|
204
208
|
_: 2
|
|
205
|
-
}, [q(n(
|
|
209
|
+
}, [q(n(y)(L, ["headerCell"]), (u, a) => ({
|
|
206
210
|
name: a,
|
|
207
|
-
fn:
|
|
211
|
+
fn: w((s) => [U(e.$slots, a, J(Q(s || {})))])
|
|
208
212
|
}))]), 1040, ["class", "columns", "data-source"])]),
|
|
209
213
|
_: 3
|
|
210
214
|
}, 16, ["name", "label"]));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});require("../../config-provider/index.js");const S=require("@vueuse/core"),n=require("vue"),q=require("../../config-provider/hooks/use-global-config.js");function h(t){if(!t)return 0;const e=parseFloat(t);return Number.isNaN(e)?0:e}function d(t){if(!t)return 0;const e=getComputedStyle(t);return t.clientHeight+h(e.marginTop)+h(e.marginBottom)}const v=t=>{const e=n.ref(),{height:p}=S.useElementSize(e),m=q.useGlobalConfig("namespace"),i=n.ref();let u=!1;const H=n.computed(()=>{var c,l,s,g,f;const r=((l=(c=e.value)==null?void 0:c.querySelector(`.${m}-ap-table-header-wrapper`))==null?void 0:l.clientHeight)||0,a=((g=(s=e.value)==null?void 0:s.querySelector(".ant-table-header"))==null?void 0:g.clientHeight)||47,o=(f=e.value)==null?void 0:f.querySelector(".ant-pagination"),b=o?d(o):n.unref(i);return o&&(u=!0),Math.ceil(n.unref(p)-a-r-(b||0)-((t==null?void 0:t.offset)||0))});return n.onUpdated(()=>{var a;if(u)return;const r=(a=e.value)==null?void 0:a.querySelector(".ant-pagination");if(!r){i.value=0;return}i.value=d(r),u=!0}),{contentRef:e,height:H}};exports.default=v;
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});require("../../config-provider/index.js");const S=require("@vueuse/core"),n=require("vue"),q=require("../../config-provider/hooks/use-global-config.js");function h(t){if(!t)return 0;const e=parseFloat(t);return Number.isNaN(e)?0:e}function d(t){if(!t)return 0;const e=getComputedStyle(t);return t.clientHeight+h(e.marginTop)+h(e.marginBottom)}const v=t=>{const e=n.ref(),{height:p}=S.useElementSize(e),m=q.useGlobalConfig("namespace"),i=n.ref();let u=!1;const H=n.computed(()=>{var c,l,s,g,f;const r=((l=(c=e.value)==null?void 0:c.querySelector(`.${n.unref(m)}-ap-table-header-wrapper`))==null?void 0:l.clientHeight)||0,a=((g=(s=e.value)==null?void 0:s.querySelector(".ant-table-header"))==null?void 0:g.clientHeight)||47,o=(f=e.value)==null?void 0:f.querySelector(".ant-pagination"),b=o?d(o):n.unref(i);return o&&(u=!0),Math.ceil(n.unref(p)-a-r-(b||0)-((t==null?void 0:t.offset)||0))});return n.onUpdated(()=>{var a;if(u)return;const r=(a=e.value)==null?void 0:a.querySelector(".ant-pagination");if(!r){i.value=0;return}i.value=d(r),u=!0}),{contentRef:e,height:H}};exports.default=v;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("vue"),x=require("../utils.js"),V=require("lodash-unified");require("../../config-provider/index.js");const ee=require("./use-sorted-filtered.js"),te=require("../../config-provider/hooks/use-locale.js"),ae=require("../../config-provider/hooks/use-namespace.js"),re=({manual:D=!1,defaultCurrent:E=1,defaultPageSize:y=10,request:R,defaultParams:M={},defaultData:B=[],formatParams:z,paramsValueTypeMap:C,resetFieldsIgnores:N,filterFields:K,sortFields:L,showLessItems:P=!1,showTotal:$=!0})=>{let q=0,s={};const J=e=>z?z(e):e,c=t.ref(),l=t.ref(E),d=t.ref(y),{getColumnSFConfig:Q,setSF:U,clearAll:W}=ee.useTableSortedAndFiltered(),{t:S}=te.useLocale(),{b:T}=ae.useNamespace("ap-table"),n=t.ref({total:0,records:B,loading:!1}),w=async e=>{var o;const r=J(e),a=Date.now();q=a,n.value.loading=!0;try{const u=await R({...M,...r});q===a&&(n.value.total=u.total||((o=u.data)==null?void 0:o.length)||0,n.value.records=[...u.data||[]])}catch{q===a&&(n.value.records=[],n.value.total=0)}finally{n.value.loading=!1}},A=e=>{const r={};return Object.entries(e).forEach(([a,o])=>{if(r[a]=o,C&&o){const u=C[a];u&&(r[a]=x.parseFieldValue(u,o))}}),r},G=async e=>{var o,u,g,p,m,f,h;const r=((u=(o=c.value)==null?void 0:o.apForm)==null?void 0:u.getFieldsValueTransformed(!0))||{},a={};Object.entries(r).forEach(([v,b])=>{N&&N.indexOf(v)>-1&&(a[v]=b)}),await((p=(g=c.value)==null?void 0:g.apForm)==null?void 0:p.resetFields()),(h=(f=(m=c.value)==null?void 0:m.apForm)==null?void 0:f.setFieldsValue)==null||h.call(f,a),t.nextTick(()=>{e==null||e()})},F=e=>{s=e;const r=A(e);w(r)},H=e=>{F({...s,...e})},O=()=>{var r,a;const e=((a=(r=c.value)==null?void 0:r.apForm)==null?void 0:a.getFieldsValueTransformed(!0))||{};l.value=1,F({...e,filter:s.filter,sort:s.sort,current:1,pageSize:s.pageSize||y})},X=()=>{W(),s.sort={},s.filter={},G(O)},Y=()=>{F(s)},Z=e=>{const r=t.unref(n).total-e,a=Math.ceil(r/t.unref(d)),o=t.unref(l)>a?a:t.unref(l);H({current:o>0?o:1})},j=(e,r,a)=>{var f,h,v,b;const o=((h=(f=c.value)==null?void 0:f.apForm)==null?void 0:h.getFieldsValueTransformed(!0))||{};l.value=e.current,d.value=e.pageSize,U(r,a);const u=V.isArray(a)?[...a]:[a],g={};for(const i of u)(v=t.unref(L))!=null&&v.includes(i.columnKey||i.field)&&(g[x.dataIndexToStr(i.columnKey||i.field)]=i.order);const p={};for(const i of Object.keys(r))(b=t.unref(K))!=null&&b.includes(i)&&(p[i]=r[i]);const m={...o,filter:p,sort:g,current:e.current,pageSize:e.pageSize};V.isEqualWith(s,m,x.isEqualCustom)||F(m)};t.onMounted(()=>{var r,a;const e=((a=(r=c.value)==null?void 0:r.apForm)==null?void 0:a.getFieldsValueTransformed(!0))||{};if(s={current:t.unref(l),pageSize:t.unref(d),filter:{},sort:{},...e},!D){const o=A(s);w(o)}});const _=t.computed(()=>t.unref(n).total===0?"-":`${t.unref(l.value)}/${Math.ceil(t.unref(n).total/t.unref(d))}`);function I(e){V.isArray(e)&&(n.value.records=e,n.value.total=e.length)}const k=t.computed(()=>({loading:t.unref(n).loading,pagination:{current:t.unref(l),pageSize:t.unref(d),total:t.unref(n).total,showSizeChanger:!P,showQuickJumper:!P,showLessItems:P,size:"default",showTotal:$?e=>t.createVNode("span",{class:T("pagination-total-wrapper")},[S("ap.apTable.pagination.totalLeftPrefix")," ",t.createVNode("span",{class:T("pagination-count-text")},[e])," ",S("ap.apTable.pagination.totalLeftSuffix"),t.createVNode("span",{class:T("pagination--total-right")},[S("ap.apTable.pagination.totalRightPrefix")," ",t.createVNode("span",{class:T("pagination-count-text")},[t.unref(_)])," ",S("ap.apTable.pagination.totalRightSuffix")])]):void 0},onChange:j,dataSource:t.unref(n).records}));return{formRef:c,submit:O,reset:X,refresh:Y,refreshByDelete:Z,data:n,current:l,pageSize:d,handleTableChange:j,tableProps:k,dataSource:t.computed(()=>t.unref(n).records),setDataSource:I,getColumnSFConfig:Q}};exports.useTablePaging=re;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("vue"),x=require("../utils.js"),V=require("lodash-unified");require("../../config-provider/index.js");const ee=require("./use-sorted-filtered.js"),te=require("../../config-provider/hooks/use-locale.js"),ae=require("../../config-provider/hooks/use-namespace.js"),re=({manual:D=!1,defaultCurrent:E=1,defaultPageSize:y=10,request:R,defaultParams:M={},defaultData:B=[],formatParams:z,paramsValueTypeMap:C,resetFieldsIgnores:N,filterFields:K,sortFields:L,showLessItems:P=!1,showTotal:$=!0})=>{let q=0,s={};const J=e=>z?z(e):e,c=t.ref(),l=t.ref(E),d=t.ref(y),{getColumnSFConfig:Q,setSF:U,clearAll:W}=ee.useTableSortedAndFiltered(),{t:S}=te.useLocale(),{b:T}=ae.useNamespace("ap-table"),n=t.ref({total:0,records:B,loading:!1}),w=async e=>{var o;const r=J(e),a=Date.now();q=a,n.value.loading=!0;try{const u=await R({...M,...r});q===a&&(n.value.total=u.total||((o=u.data)==null?void 0:o.length)||0,n.value.records=[...u.data||[]])}catch{q===a&&(n.value.records=[],n.value.total=0)}finally{n.value.loading=!1}},A=e=>{const r={};return Object.entries(e).forEach(([a,o])=>{if(r[a]=o,C&&o){const u=C[a];u&&(r[a]=x.parseFieldValue(u,o))}}),r},G=async e=>{var o,u,g,p,m,f,h;const r=((u=(o=c.value)==null?void 0:o.apForm)==null?void 0:u.getFieldsValueTransformed(!0))||{},a={};Object.entries(r).forEach(([v,b])=>{N&&N.indexOf(v)>-1&&(a[v]=b)}),await((p=(g=c.value)==null?void 0:g.apForm)==null?void 0:p.resetFields()),(h=(f=(m=c.value)==null?void 0:m.apForm)==null?void 0:f.setFieldsValue)==null||h.call(f,a),t.nextTick(()=>{e==null||e()})},F=e=>{s=e;const r=A(e);w(r)},H=e=>{F({...s,...e})},O=()=>{var r,a;const e=((a=(r=c.value)==null?void 0:r.apForm)==null?void 0:a.getFieldsValueTransformed(!0))||{};l.value=1,F({...e,filter:s.filter,sort:s.sort,current:1,pageSize:s.pageSize||y})},X=()=>{W(),s.sort={},s.filter={},G(O)},Y=()=>{F(s)},Z=e=>{const r=t.unref(n).total-e,a=Math.ceil(r/t.unref(d)),o=t.unref(l)>a?a:t.unref(l);H({current:o>0?o:1})},j=(e,r,a)=>{var f,h,v,b;const o=((h=(f=c.value)==null?void 0:f.apForm)==null?void 0:h.getFieldsValueTransformed(!0))||{};l.value=e.current,d.value=e.pageSize,U(r,a);const u=V.isArray(a)?[...a]:[a],g={};for(const i of u)(v=t.unref(L))!=null&&v.includes(i.columnKey||i.field)&&i.order&&(g[x.dataIndexToStr(i.columnKey||i.field)]=i.order);const p={};for(const i of Object.keys(r))(b=t.unref(K))!=null&&b.includes(i)&&r[i]&&(p[i]=r[i]);const m={...o,filter:p,sort:g,current:e.current,pageSize:e.pageSize};V.isEqualWith(s,m,x.isEqualCustom)||F(m)};t.onMounted(()=>{var r,a;const e=((a=(r=c.value)==null?void 0:r.apForm)==null?void 0:a.getFieldsValueTransformed(!0))||{};if(s={current:t.unref(l),pageSize:t.unref(d),filter:{},sort:{},...e},!D){const o=A(s);w(o)}});const _=t.computed(()=>t.unref(n).total===0?"-":`${t.unref(l.value)}/${Math.ceil(t.unref(n).total/t.unref(d))}`);function I(e){V.isArray(e)&&(n.value.records=e,n.value.total=e.length)}const k=t.computed(()=>({loading:t.unref(n).loading,pagination:{current:t.unref(l),pageSize:t.unref(d),total:t.unref(n).total,showSizeChanger:!P,showQuickJumper:!P,showLessItems:P,size:"default",showTotal:$?e=>t.createVNode("span",{class:T("pagination-total-wrapper")},[S("ap.apTable.pagination.totalLeftPrefix")," ",t.createVNode("span",{class:T("pagination-count-text")},[e])," ",S("ap.apTable.pagination.totalLeftSuffix"),t.createVNode("span",{class:T("pagination--total-right")},[S("ap.apTable.pagination.totalRightPrefix")," ",t.createVNode("span",{class:T("pagination-count-text")},[t.unref(_)])," ",S("ap.apTable.pagination.totalRightSuffix")])]):void 0},onChange:j,dataSource:t.unref(n).records}));return{formRef:c,submit:O,reset:X,refresh:Y,refreshByDelete:Z,data:n,current:l,pageSize:d,handleTableChange:j,tableProps:k,dataSource:t.computed(()=>t.unref(n).records),setDataSource:I,getColumnSFConfig:Q}};exports.useTablePaging=re;
|
|
@@ -73,40 +73,40 @@ export interface ApLadderProps {
|
|
|
73
73
|
* 重要信息
|
|
74
74
|
* @description 如 操作人名称、供应商名称...
|
|
75
75
|
*/
|
|
76
|
-
major
|
|
76
|
+
major?: string;
|
|
77
77
|
/**
|
|
78
78
|
* 次要信息
|
|
79
79
|
* @description 如 操作人邮箱、供应商编码...
|
|
80
80
|
*/
|
|
81
|
-
minor
|
|
81
|
+
minor?: string;
|
|
82
82
|
/**
|
|
83
83
|
* 自定义重要信息颜色
|
|
84
84
|
*/
|
|
85
|
-
majorColor
|
|
85
|
+
majorColor?: string;
|
|
86
86
|
/**
|
|
87
87
|
* 自定义次要信息颜色
|
|
88
88
|
*/
|
|
89
|
-
minorColor
|
|
89
|
+
minorColor?: string;
|
|
90
90
|
/**
|
|
91
91
|
* 布局方式
|
|
92
92
|
* - `vertical` 垂直布局
|
|
93
93
|
* - `horizontal` 水平布局
|
|
94
94
|
* @default `vertical`
|
|
95
95
|
*/
|
|
96
|
-
layout
|
|
96
|
+
layout?: 'vertical' | 'horizontal';
|
|
97
97
|
/**
|
|
98
98
|
* 是否展示气泡
|
|
99
99
|
* @description 默认展示
|
|
100
100
|
*/
|
|
101
|
-
tooltip
|
|
101
|
+
tooltip?: boolean;
|
|
102
102
|
/**
|
|
103
103
|
* 健值对 - 数组展示
|
|
104
104
|
*/
|
|
105
|
-
labelValues
|
|
105
|
+
labelValues?: Array<ApLadderLabelValue>;
|
|
106
106
|
/**
|
|
107
107
|
* 扩展 Tooltip
|
|
108
108
|
*/
|
|
109
|
-
tooltipProps
|
|
109
|
+
tooltipProps?: TooltipNeedProps;
|
|
110
110
|
}
|
|
111
111
|
/**
|
|
112
112
|
* ApLadder Slots 类型声明
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("vue"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("vue"),V=require("@aplus-frontend/antdv"),h=require("../ap-form/index.js"),d=require("lodash-unified");require("../config-provider/index.js");const P=require("../ap-form/context.js"),f=require("../utils/index.js"),j=require("./hooks/use-get-columns.js"),k=require("./utils.js"),A=require("../config-provider/hooks/use-namespace.js"),M=require("../config-provider/hooks/use-global-config.js"),O=o.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:g}){const l=x;function b(e,t){return d.isArray(t)?t.reduce((u,n)=>u==null?void 0:u[n],e):e==null?void 0:e[t]}const{internalInstance:a,model:w}=P.useInjectForm(),r=o.ref(b(o.unref(w),l.name)||[]),C=o.useSlots(),i=o.ref(l.name);o.watch(()=>l.name,(e,t)=>{d.isEqual(e,t)||(i.value=e)});const y=h.ApForm.useWatch(i);o.watch(()=>y.value,e=>{var t;r.value=e,(t=l.onChange)==null||t.call(l,e)},{deep:!0});const{b:R}=A.useNamespace("editable-table"),c=o.ref(),D=M.useGlobalConfig("valueTypeMap"),B=j.default(l,D);function q(e,t){var s;const u=((s=o.unref(r))==null?void 0:s.length)||0;if(f.isDef(l.maxLength)&&u>=l.maxLength)return;const n=[...o.unref(r)||[]];f.isDef(t)?n.splice(t,0,{...e||{}}):n.push({...e||{}}),a==null||a.setFieldValue(l.name,n)}function v(e,t="suffix"){var p;const u=((p=o.unref(r))==null?void 0:p.length)||0,n=d.isNumber(e)?e:e.length;if(f.isDef(l.maxLength)&&u+n>l.maxLength)return;const s=[...o.unref(r)||[]],m=d.isNumber(e)?new Array(e).fill({}):d.cloneDeep(e);t==="suffix"?s.push(...m):s.unshift(...m),a==null||a.setFieldValue(l.name,s)}function F(e){let t=d.cloneDeep(o.unref(r)||[]);const u=d.isNumber(e)?[e]:e;t=t.filter((n,s)=>!u.includes(s)),a==null||a.setFieldValue(l.name,t)}function N(){return o.unref(r)}function T(e){var t;return(t=o.unref(r))==null?void 0:t[e]}function L(e,t,u=!0){const n=d.cloneDeep(o.unref(r));n[e]&&(n[e]={...u?n[e]:{},...t},a==null||a.setFieldValue(l.name,[...n]))}function S(e){a==null||a.setFieldValue(l.name,e)}function _(e,t){var n;const u=e==="end"?r.value.length-1:e;k.scrollToRowIndex(u,(n=c.value)==null?void 0:n.$el,t)}function E(){var e;(e=a==null?void 0:a.setFieldValue)==null||e.call(a,l.name,[])}return g({add:q,remove:F,getRowData:T,getRowsData:N,setRowData:L,addMultiple:v,scrollTo:_,setTableData:S,clear:E}),(e,t)=>(o.openBlock(),o.createBlock(o.unref(h.ApForm).FormItem,o.mergeProps(e.formItem,{name:e.name,label:e.label}),{default:o.withCtx(()=>[o.createVNode(o.unref(V.Table),o.mergeProps(o.unref(d.omit)(l,["name","maxLength","onChange"]),{ref_key:"tableRef",ref:c,class:o.unref(R)(),columns:o.unref(B),"data-source":r.value}),o.createSlots({_:2},[o.renderList(o.unref(d.omit)(C,["headerCell"]),(u,n)=>({name:n,fn:o.withCtx(s=>[o.renderSlot(e.$slots,n,o.normalizeProps(o.guardReactiveProps(s||{})))])}))]),1040,["class","columns","data-source"])]),_:3},16,["name","label"]))}});exports.default=O;
|