@aplus-frontend/ui 6.13.1 → 6.13.2
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,4 +1,4 @@
|
|
|
1
|
-
import { ref as le, reactive as M, unref as
|
|
1
|
+
import { ref as le, reactive as M, unref as S, nextTick as fe, onMounted as ge, watch as de, computed as y, createVNode as C } from "vue";
|
|
2
2
|
import { useTableSortedAndFiltered as pe } from "./use-sorted-filtered.mjs";
|
|
3
3
|
import "../../config-provider/index.mjs";
|
|
4
4
|
import { parseFieldValue as me, dataIndexToStr as Se, isEqualCustom as he } from "../utils.mjs";
|
|
@@ -6,8 +6,8 @@ import { isArray as Q, isEqualWith as ze, isUndefined as Pe } from "lodash-unifi
|
|
|
6
6
|
import { isDef as $ } from "../../utils/index.mjs";
|
|
7
7
|
import { useLocale as Te } from "../../config-provider/hooks/use-locale.mjs";
|
|
8
8
|
import { useNamespace as we } from "../../config-provider/hooks/use-namespace.mjs";
|
|
9
|
-
const
|
|
10
|
-
defaultCurrent:
|
|
9
|
+
const h = 1, I = 20, G = {
|
|
10
|
+
defaultCurrent: h,
|
|
11
11
|
defaultPageSize: I,
|
|
12
12
|
showLessItems: !1,
|
|
13
13
|
showTotal: !0
|
|
@@ -20,7 +20,7 @@ function Fe(c) {
|
|
|
20
20
|
}
|
|
21
21
|
function be(c) {
|
|
22
22
|
const f = {};
|
|
23
|
-
return c === !1 || (c === !0 || c == null ? (f.current =
|
|
23
|
+
return c === !1 || (c === !0 || c == null ? (f.current = h, f.pageSize = I) : (f.current = c.defaultCurrent || h, f.pageSize = c.defaultPageSize || I)), f;
|
|
24
24
|
}
|
|
25
25
|
const Ie = ({
|
|
26
26
|
manual: c = !1,
|
|
@@ -33,35 +33,35 @@ const Ie = ({
|
|
|
33
33
|
filterFields: W,
|
|
34
34
|
sortFields: Z,
|
|
35
35
|
namespace: H = "ap-table",
|
|
36
|
-
pagination:
|
|
36
|
+
pagination: z,
|
|
37
37
|
onClickReset: x,
|
|
38
38
|
onAfterRequest: E
|
|
39
39
|
}) => {
|
|
40
40
|
let v = 0, s = {};
|
|
41
|
-
const X = Fe(
|
|
41
|
+
const X = Fe(z), Y = (e) => U ? U(e) : e, P = le(), i = M(be(z)), {
|
|
42
42
|
getColumnSFConfig: q,
|
|
43
43
|
setSF: R,
|
|
44
44
|
clearAll: k,
|
|
45
45
|
sortedInfo: N,
|
|
46
46
|
filteredInfo: B
|
|
47
47
|
} = pe(), {
|
|
48
|
-
t:
|
|
48
|
+
t: T
|
|
49
49
|
} = Te(), {
|
|
50
|
-
b:
|
|
50
|
+
b: w
|
|
51
51
|
} = we(H), o = M({
|
|
52
52
|
total: j.length,
|
|
53
53
|
records: j,
|
|
54
54
|
loading: !1
|
|
55
|
-
}),
|
|
55
|
+
}), d = () => {
|
|
56
56
|
var e, t;
|
|
57
|
-
return ((t = (e =
|
|
57
|
+
return ((t = (e = P.value) == null ? void 0 : e.apForm) == null ? void 0 : t.getFieldsValueTransformed(!0)) || {};
|
|
58
58
|
}, J = async (e) => {
|
|
59
59
|
var r;
|
|
60
60
|
const t = Y(e), n = Date.now();
|
|
61
61
|
v = n, o.loading = !0;
|
|
62
62
|
try {
|
|
63
63
|
const a = await f({
|
|
64
|
-
...
|
|
64
|
+
...S(V),
|
|
65
65
|
...t
|
|
66
66
|
});
|
|
67
67
|
v === n && (o.total = a.total || ((r = a.data) == null ? void 0 : r.length) || 0, o.records = [...a.data || []], o.loading = !1);
|
|
@@ -79,11 +79,11 @@ const Ie = ({
|
|
|
79
79
|
}
|
|
80
80
|
}), t;
|
|
81
81
|
}, ee = async (e) => {
|
|
82
|
-
var r, a, l, g,
|
|
83
|
-
const t =
|
|
84
|
-
Object.entries(t).forEach(([
|
|
85
|
-
A && A.indexOf(
|
|
86
|
-
}), await ((a = (r =
|
|
82
|
+
var r, a, l, g, p;
|
|
83
|
+
const t = d(), n = {};
|
|
84
|
+
Object.entries(t).forEach(([m, b]) => {
|
|
85
|
+
A && A.indexOf(m) > -1 && (n[m] = b);
|
|
86
|
+
}), await ((a = (r = P.value) == null ? void 0 : r.apForm) == null ? void 0 : a.resetFields()), (p = (g = (l = P.value) == null ? void 0 : l.apForm) == null ? void 0 : g.setFieldsValue) == null || p.call(g, n), fe(() => {
|
|
87
87
|
e == null || e();
|
|
88
88
|
});
|
|
89
89
|
}, F = (e) => {
|
|
@@ -96,20 +96,23 @@ const Ie = ({
|
|
|
96
96
|
...e
|
|
97
97
|
});
|
|
98
98
|
}, D = () => {
|
|
99
|
-
const e =
|
|
100
|
-
t && (i.current =
|
|
99
|
+
const e = d(), t = z !== !1;
|
|
100
|
+
t && (i.current = h), F({
|
|
101
101
|
...e,
|
|
102
102
|
filter: s.filter,
|
|
103
103
|
sort: s.sort,
|
|
104
|
-
current: t ?
|
|
104
|
+
current: t ? h : void 0,
|
|
105
105
|
pageSize: t ? s.pageSize || i.pageSize : void 0
|
|
106
106
|
});
|
|
107
107
|
}, ne = () => {
|
|
108
108
|
k(), s.sort = {}, s.filter = {}, x == null || x(), ee(D);
|
|
109
109
|
}, O = () => {
|
|
110
|
-
F(
|
|
110
|
+
F({
|
|
111
|
+
...s,
|
|
112
|
+
...d()
|
|
113
|
+
});
|
|
111
114
|
}, re = (e) => {
|
|
112
|
-
if (
|
|
115
|
+
if (z === !1)
|
|
113
116
|
O();
|
|
114
117
|
else {
|
|
115
118
|
const {
|
|
@@ -121,23 +124,23 @@ const Ie = ({
|
|
|
121
124
|
});
|
|
122
125
|
}
|
|
123
126
|
}, L = (e, t, n) => {
|
|
124
|
-
var
|
|
125
|
-
const r =
|
|
127
|
+
var m, b;
|
|
128
|
+
const r = d();
|
|
126
129
|
i.current = e.current, i.pageSize = e.pageSize, R(t, n);
|
|
127
130
|
const a = Q(n) ? [...n] : [n], l = {};
|
|
128
131
|
for (const u of a)
|
|
129
|
-
(
|
|
132
|
+
(m = S(Z)) != null && m.includes(u.columnKey || u.field) && u.order && (l[Se(u.columnKey || u.field)] = u.order);
|
|
130
133
|
const g = {};
|
|
131
134
|
for (const u of Object.keys(t))
|
|
132
|
-
(b =
|
|
133
|
-
const
|
|
135
|
+
(b = S(W)) != null && b.includes(u) && t[u] && (g[u] = t[u]);
|
|
136
|
+
const p = {
|
|
134
137
|
...r,
|
|
135
138
|
filter: g,
|
|
136
139
|
sort: l,
|
|
137
140
|
current: e.current,
|
|
138
141
|
pageSize: e.pageSize
|
|
139
142
|
};
|
|
140
|
-
ze(s,
|
|
143
|
+
ze(s, p, he) || F(p);
|
|
141
144
|
}, ae = (e, t = B.value || {}, n = N.value || {}) => {
|
|
142
145
|
const r = (e == null ? void 0 : e.current) ?? i.current, a = (e == null ? void 0 : e.pageSize) ?? i.pageSize;
|
|
143
146
|
L(
|
|
@@ -155,7 +158,7 @@ const Ie = ({
|
|
|
155
158
|
);
|
|
156
159
|
};
|
|
157
160
|
ge(() => {
|
|
158
|
-
const e =
|
|
161
|
+
const e = d(), {
|
|
159
162
|
current: t,
|
|
160
163
|
pageSize: n
|
|
161
164
|
} = i;
|
|
@@ -169,7 +172,7 @@ const Ie = ({
|
|
|
169
172
|
const r = K(s);
|
|
170
173
|
J(r);
|
|
171
174
|
}
|
|
172
|
-
}), de(() =>
|
|
175
|
+
}), de(() => S(V), () => {
|
|
173
176
|
D();
|
|
174
177
|
}, {
|
|
175
178
|
deep: !0
|
|
@@ -206,14 +209,14 @@ const Ie = ({
|
|
|
206
209
|
size: "default",
|
|
207
210
|
pageSizeOptions: Pe(a) ? ["10", "20", "50", "100"] : a,
|
|
208
211
|
showTotal: t ? (l) => C("span", {
|
|
209
|
-
class:
|
|
210
|
-
}, [
|
|
211
|
-
class:
|
|
212
|
-
}, [l]), " ",
|
|
213
|
-
class:
|
|
214
|
-
}, [
|
|
215
|
-
class:
|
|
216
|
-
}, [
|
|
212
|
+
class: w("pagination-total-wrapper")
|
|
213
|
+
}, [T("ap.apTable.pagination.totalLeftPrefix"), " ", C("span", {
|
|
214
|
+
class: w("pagination-count-text")
|
|
215
|
+
}, [l]), " ", T("ap.apTable.pagination.totalLeftSuffix"), C("span", {
|
|
216
|
+
class: w("pagination--total-right")
|
|
217
|
+
}, [T("ap.apTable.pagination.totalRightPrefix"), " ", C("span", {
|
|
218
|
+
class: w("pagination-count-text")
|
|
219
|
+
}, [S(oe)]), " ", T("ap.apTable.pagination.totalRightSuffix")])]) : void 0
|
|
217
220
|
},
|
|
218
221
|
onChange: L,
|
|
219
222
|
dataSource: o.records
|
|
@@ -228,7 +231,7 @@ const Ie = ({
|
|
|
228
231
|
};
|
|
229
232
|
}
|
|
230
233
|
return {
|
|
231
|
-
formRef:
|
|
234
|
+
formRef: P,
|
|
232
235
|
submit: D,
|
|
233
236
|
reset: ne,
|
|
234
237
|
refresh: O,
|
|
@@ -247,7 +250,7 @@ const Ie = ({
|
|
|
247
250
|
};
|
|
248
251
|
};
|
|
249
252
|
export {
|
|
250
|
-
|
|
253
|
+
h as DEFAULT_CURRENT,
|
|
251
254
|
I as DEFAULT_PAGE_SIZE,
|
|
252
255
|
Ie as useTablePaging
|
|
253
256
|
};
|
package/es/src/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: "6.13.
|
|
1
|
+
declare const _default: "6.13.2";
|
|
2
2
|
export default _default;
|
package/es/src/version.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("vue"),ce=require("./use-sorted-filtered.js");require("../../config-provider/index.js");const N=require("../utils.js"),E=require("lodash-unified"),G=require("../../utils/index.js"),ue=require("../../config-provider/hooks/use-locale.js"),le=require("../../config-provider/hooks/use-namespace.js"),p=1,C=20,J={defaultCurrent:p,defaultPageSize:C,showLessItems:!1,showTotal:!0};function fe(u){return u===!1?{}:u==null||u===!0?J:{...J,...u}}function ge(u){const g={};return u===!1||(u===!0||u==null?(g.current=p,g.pageSize=C):(g.current=u.defaultCurrent||p,g.pageSize=u.defaultPageSize||C)),g}const de=({manual:u=!1,request:g,params:U={},defaultData:V=[],formatParams:q,paramsValueTypeMap:A,resetFieldsIgnores:_,filterFields:K,sortFields:Q,namespace:Z="ap-table",pagination:
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("vue"),ce=require("./use-sorted-filtered.js");require("../../config-provider/index.js");const N=require("../utils.js"),E=require("lodash-unified"),G=require("../../utils/index.js"),ue=require("../../config-provider/hooks/use-locale.js"),le=require("../../config-provider/hooks/use-namespace.js"),p=1,C=20,J={defaultCurrent:p,defaultPageSize:C,showLessItems:!1,showTotal:!0};function fe(u){return u===!1?{}:u==null||u===!0?J:{...J,...u}}function ge(u){const g={};return u===!1||(u===!0||u==null?(g.current=p,g.pageSize=C):(g.current=u.defaultCurrent||p,g.pageSize=u.defaultPageSize||C)),g}const de=({manual:u=!1,request:g,params:U={},defaultData:V=[],formatParams:q,paramsValueTypeMap:A,resetFieldsIgnores:_,filterFields:K,sortFields:Q,namespace:Z="ap-table",pagination:z,onClickReset:v,onAfterRequest:x})=>{let D=0,i={};const $=fe(z),W=e=>q?q(e):e,T=o.ref(),c=o.reactive(ge(z)),{getColumnSFConfig:H,setSF:R,clearAll:X,sortedInfo:I,filteredInfo:j}=ce.useTableSortedAndFiltered(),{t:P}=ue.useLocale(),{b:F}=le.useNamespace(Z),s=o.reactive({total:V.length,records:V,loading:!1}),S=()=>{var e,t;return((t=(e=T.value)==null?void 0:e.apForm)==null?void 0:t.getFieldsValueTransformed(!0))||{}},M=async e=>{var r;const t=W(e),n=Date.now();D=n,s.loading=!0;try{const a=await g({...o.unref(U),...t});D===n&&(s.total=a.total||((r=a.data)==null?void 0:r.length)||0,s.records=[...a.data||[]],s.loading=!1)}catch{D===n&&(s.records=[],s.total=0,s.loading=!1)}finally{x==null||x()}},B=e=>{const t={};return Object.entries(e).forEach(([n,r])=>{if(t[n]=r,A&&r){const a=A[n];a&&(t[n]=N.parseFieldValue(a,r))}}),t},Y=async e=>{var r,a,f,d,h;const t=S(),n={};Object.entries(t).forEach(([m,w])=>{_&&_.indexOf(m)>-1&&(n[m]=w)}),await((a=(r=T.value)==null?void 0:r.apForm)==null?void 0:a.resetFields()),(h=(d=(f=T.value)==null?void 0:f.apForm)==null?void 0:d.setFieldsValue)==null||h.call(d,n),o.nextTick(()=>{e==null||e()})},b=e=>{i=e;const t=B(e);M(t)},k=e=>{b({...i,...e})},L=()=>{const e=S(),t=z!==!1;t&&(c.current=p),b({...e,filter:i.filter,sort:i.sort,current:t?p:void 0,pageSize:t?i.pageSize||c.pageSize:void 0})},ee=()=>{X(),i.sort={},i.filter={},v==null||v(),Y(L)},y=()=>{b({...i,...S()})},te=e=>{if(z===!1)y();else{const{current:t,pageSize:n}=c,r=s.total-e,a=Math.ceil(r/n),f=t>a?a:t;k({current:f>0?f:1})}},O=(e,t,n)=>{var m,w;const r=S();c.current=e.current,c.pageSize=e.pageSize,R(t,n);const a=E.isArray(n)?[...n]:[n],f={};for(const l of a)(m=o.unref(Q))!=null&&m.includes(l.columnKey||l.field)&&l.order&&(f[N.dataIndexToStr(l.columnKey||l.field)]=l.order);const d={};for(const l of Object.keys(t))(w=o.unref(K))!=null&&w.includes(l)&&t[l]&&(d[l]=t[l]);const h={...r,filter:d,sort:f,current:e.current,pageSize:e.pageSize};E.isEqualWith(i,h,N.isEqualCustom)||b(h)},ne=(e,t=j.value||{},n=I.value||{})=>{const r=(e==null?void 0:e.current)??c.current,a=(e==null?void 0:e.pageSize)??c.pageSize;O({current:r,pageSize:a},t,n,{action:"sort",currentDataSource:[]})};o.onMounted(()=>{const e=S(),{current:t,pageSize:n}=c;if(i={current:t,pageSize:n,filter:{},sort:{},...e},!u){const r=B(i);M(r)}}),o.watch(()=>o.unref(U),()=>{L()},{deep:!0});const re=o.computed(()=>{if(s.total===0)return"-";const{current:e,pageSize:t}=c;return`${e}/${Math.ceil(s.total/t)}`});function ae(e){E.isArray(e)&&(s.records=e,s.total=e.length)}const oe=o.computed(()=>{const{showLessItems:e,showTotal:t,showQuickJumper:n,showSizeChanger:r,pageSizeOptions:a}=$;return{loading:s.loading,pagination:{current:c.current,pageSize:c.pageSize,total:s.total,showSizeChanger:G.isDef(r)?r:!e,showQuickJumper:G.isDef(n)?n:!e,showLessItems:e,size:"default",pageSizeOptions:E.isUndefined(a)?["10","20","50","100"]:a,showTotal:t?f=>o.createVNode("span",{class:F("pagination-total-wrapper")},[P("ap.apTable.pagination.totalLeftPrefix")," ",o.createVNode("span",{class:F("pagination-count-text")},[f])," ",P("ap.apTable.pagination.totalLeftSuffix"),o.createVNode("span",{class:F("pagination--total-right")},[P("ap.apTable.pagination.totalRightPrefix")," ",o.createVNode("span",{class:F("pagination-count-text")},[o.unref(re)])," ",P("ap.apTable.pagination.totalRightSuffix")])]):void 0},onChange:O,dataSource:s.records}});function se(e,t=!0){Object.assign(c,e),i.current=e.current,i.pageSize=e.pageSize,t&&y()}function ie(){return{...c}}return{formRef:T,submit:L,reset:ee,refresh:y,refreshByDelete:te,data:s,handleTableChange:O,handleTableChangeOptional:ne,tableProps:oe,dataSource:o.computed(()=>s.records),setDataSource:ae,getColumnSFConfig:H,sortedInfo:I,filteredInfo:j,getPaging:ie,setPaging:se}};exports.DEFAULT_CURRENT=p;exports.DEFAULT_PAGE_SIZE=C;exports.useTablePaging=de;
|
package/lib/src/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: "6.13.
|
|
1
|
+
declare const _default: "6.13.2";
|
|
2
2
|
export default _default;
|
package/lib/src/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e="6.13.
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e="6.13.2";exports.default=e;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aplus-frontend/ui",
|
|
3
|
-
"version": "6.13.
|
|
3
|
+
"version": "6.13.2",
|
|
4
4
|
"main": "./lib/index.js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -61,8 +61,8 @@
|
|
|
61
61
|
"scroll-into-view-if-needed": "^3.1.0",
|
|
62
62
|
"vue-virtual-scroller": "2.0.0-beta.8",
|
|
63
63
|
"vuedraggable": "^4.1.0",
|
|
64
|
-
"@aplus-frontend/
|
|
65
|
-
"@aplus-frontend/
|
|
64
|
+
"@aplus-frontend/hooks": "1.0.7",
|
|
65
|
+
"@aplus-frontend/utils": "1.0.61"
|
|
66
66
|
},
|
|
67
67
|
"peerDependencies": {
|
|
68
68
|
"@aplus-frontend/antdv": "^1.1.12",
|