@aplus-frontend/ui 0.2.16 → 0.2.17
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,11 +1,11 @@
|
|
|
1
|
-
import { ref as P, nextTick as
|
|
2
|
-
import { parseFieldValue as
|
|
3
|
-
import { isArray as q, isEqualWith as
|
|
1
|
+
import { ref as P, nextTick as ae, unref as o, onMounted as oe, computed as V, createVNode as b } from "vue";
|
|
2
|
+
import { parseFieldValue as re, dataIndexToStr as ne, isEqualCustom as se } from "../utils.mjs";
|
|
3
|
+
import { isArray as q, isEqualWith as ie } from "lodash-unified";
|
|
4
4
|
import "../../config-provider/index.mjs";
|
|
5
|
-
import { useTableSortedAndFiltered as
|
|
6
|
-
import { useLocale as
|
|
7
|
-
import { useNamespace as
|
|
8
|
-
const
|
|
5
|
+
import { useTableSortedAndFiltered as le } from "./use-sorted-filtered.mjs";
|
|
6
|
+
import { useLocale as ce } from "../../config-provider/hooks/use-locale.mjs";
|
|
7
|
+
import { useNamespace as ue } from "../../config-provider/hooks/use-namespace.mjs";
|
|
8
|
+
const Te = ({
|
|
9
9
|
manual: B = !1,
|
|
10
10
|
defaultCurrent: K = 1,
|
|
11
11
|
defaultPageSize: y = 10,
|
|
@@ -21,63 +21,63 @@ const Ft = ({
|
|
|
21
21
|
showTotal: Q = !0
|
|
22
22
|
}) => {
|
|
23
23
|
let C = 0, s = {};
|
|
24
|
-
const W = (
|
|
24
|
+
const W = (e) => w ? w(e) : e, u = P(), c = P(K), p = P(y), {
|
|
25
25
|
getColumnSFConfig: G,
|
|
26
26
|
setSF: H,
|
|
27
27
|
clearAll: U
|
|
28
|
-
} =
|
|
29
|
-
t:
|
|
30
|
-
} =
|
|
31
|
-
b:
|
|
32
|
-
} =
|
|
28
|
+
} = le(), {
|
|
29
|
+
t: T
|
|
30
|
+
} = ce(), {
|
|
31
|
+
b: F
|
|
32
|
+
} = ue("ap-table"), r = P({
|
|
33
33
|
total: 0,
|
|
34
34
|
records: $,
|
|
35
35
|
loading: !1
|
|
36
|
-
}), E = async (
|
|
37
|
-
var
|
|
38
|
-
const a = W(
|
|
39
|
-
C =
|
|
36
|
+
}), E = async (e) => {
|
|
37
|
+
var n;
|
|
38
|
+
const a = W(e), t = Date.now();
|
|
39
|
+
C = t, r.value.loading = !0;
|
|
40
40
|
try {
|
|
41
41
|
const i = await M({
|
|
42
42
|
...N,
|
|
43
43
|
...a
|
|
44
44
|
});
|
|
45
|
-
C ===
|
|
45
|
+
C === t && (r.value.total = i.total || ((n = i.data) == null ? void 0 : n.length) || 0, r.value.records = [...i.data || []]);
|
|
46
46
|
} catch {
|
|
47
|
-
C ===
|
|
47
|
+
C === t && (r.value.records = [], r.value.total = 0);
|
|
48
48
|
} finally {
|
|
49
|
-
|
|
49
|
+
r.value.loading = !1;
|
|
50
50
|
}
|
|
51
|
-
}, O = (
|
|
51
|
+
}, O = (e) => {
|
|
52
52
|
const a = {};
|
|
53
|
-
return Object.entries(
|
|
54
|
-
if (a[
|
|
55
|
-
const i = A[
|
|
56
|
-
i && (a[
|
|
53
|
+
return Object.entries(e).forEach(([t, n]) => {
|
|
54
|
+
if (a[t] = n, A && n) {
|
|
55
|
+
const i = A[t];
|
|
56
|
+
i && (a[t] = re(i, n));
|
|
57
57
|
}
|
|
58
58
|
}), a;
|
|
59
|
-
}, X = async (
|
|
60
|
-
var
|
|
61
|
-
const a = ((i = (
|
|
59
|
+
}, X = async (e) => {
|
|
60
|
+
var n, i, g, d, m, f, h;
|
|
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
|
-
D && D.indexOf(v) > -1 && (
|
|
64
|
-
}), await ((d = (g = u.value) == null ? void 0 : g.apForm) == null ? void 0 : d.resetFields()), (h = (f = (m = u.value) == null ? void 0 : m.apForm) == null ? void 0 : f.setFieldsValue) == null || h.call(f,
|
|
65
|
-
|
|
63
|
+
D && D.indexOf(v) > -1 && (t[v] = x);
|
|
64
|
+
}), await ((d = (g = u.value) == null ? void 0 : g.apForm) == null ? void 0 : d.resetFields()), (h = (f = (m = u.value) == null ? void 0 : m.apForm) == null ? void 0 : f.setFieldsValue) == null || h.call(f, t), ae(() => {
|
|
65
|
+
e == null || e();
|
|
66
66
|
});
|
|
67
|
-
},
|
|
68
|
-
s =
|
|
69
|
-
const a = O(
|
|
67
|
+
}, S = (e) => {
|
|
68
|
+
s = e;
|
|
69
|
+
const a = O(e);
|
|
70
70
|
E(a);
|
|
71
|
-
}, Y = (
|
|
72
|
-
|
|
71
|
+
}, Y = (e) => {
|
|
72
|
+
S({
|
|
73
73
|
...s,
|
|
74
|
-
...
|
|
74
|
+
...e
|
|
75
75
|
});
|
|
76
76
|
}, R = () => {
|
|
77
|
-
var a,
|
|
78
|
-
const
|
|
79
|
-
c.value = 1,
|
|
80
|
-
...
|
|
77
|
+
var a, t;
|
|
78
|
+
const e = ((t = (a = u.value) == null ? void 0 : a.apForm) == null ? void 0 : t.getFieldsValueTransformed(!0)) || {};
|
|
79
|
+
c.value = 1, S({
|
|
80
|
+
...e,
|
|
81
81
|
filter: s.filter,
|
|
82
82
|
sort: s.sort,
|
|
83
83
|
current: 1,
|
|
@@ -86,71 +86,71 @@ const Ft = ({
|
|
|
86
86
|
}, Z = () => {
|
|
87
87
|
U(), s.sort = {}, s.filter = {}, X(R);
|
|
88
88
|
}, _ = () => {
|
|
89
|
-
|
|
90
|
-
}, I = (
|
|
91
|
-
const a = o(
|
|
89
|
+
S(s);
|
|
90
|
+
}, I = (e) => {
|
|
91
|
+
const a = o(r).total - e, t = Math.ceil(a / o(p)), n = o(c) > t ? t : o(c);
|
|
92
92
|
Y({
|
|
93
|
-
current:
|
|
93
|
+
current: n > 0 ? n : 1
|
|
94
94
|
});
|
|
95
|
-
}, j = (
|
|
95
|
+
}, j = (e, a, t) => {
|
|
96
96
|
var f, h, v, x;
|
|
97
|
-
const
|
|
98
|
-
c.value =
|
|
99
|
-
const i = q(
|
|
97
|
+
const n = ((h = (f = u.value) == null ? void 0 : f.apForm) == null ? void 0 : h.getFieldsValueTransformed(!0)) || {};
|
|
98
|
+
c.value = e.current, p.value = e.pageSize, H(a, t);
|
|
99
|
+
const i = q(t) ? [...t] : [t], g = {};
|
|
100
100
|
for (const l of i)
|
|
101
|
-
(v = o(L)) != null && v.includes(l.columnKey || l.field) && (g[
|
|
101
|
+
(v = o(L)) != null && v.includes(l.columnKey || l.field) && (g[ne(l.columnKey || l.field)] = l.order);
|
|
102
102
|
const d = {};
|
|
103
103
|
for (const l of Object.keys(a))
|
|
104
104
|
(x = o(J)) != null && x.includes(l) && (d[l] = a[l]);
|
|
105
105
|
const m = {
|
|
106
|
-
...
|
|
106
|
+
...n,
|
|
107
107
|
filter: d,
|
|
108
108
|
sort: g,
|
|
109
|
-
current:
|
|
110
|
-
pageSize:
|
|
109
|
+
current: e.current,
|
|
110
|
+
pageSize: e.pageSize
|
|
111
111
|
};
|
|
112
|
-
|
|
112
|
+
ie(s, m, se) || S(m);
|
|
113
113
|
};
|
|
114
|
-
|
|
115
|
-
var a,
|
|
116
|
-
const
|
|
114
|
+
oe(() => {
|
|
115
|
+
var a, t;
|
|
116
|
+
const e = ((t = (a = u.value) == null ? void 0 : a.apForm) == null ? void 0 : t.getFieldsValueTransformed(!0)) || {};
|
|
117
117
|
if (s = {
|
|
118
118
|
current: o(c),
|
|
119
119
|
pageSize: o(p),
|
|
120
120
|
filter: {},
|
|
121
121
|
sort: {},
|
|
122
|
-
...
|
|
122
|
+
...e
|
|
123
123
|
}, !B) {
|
|
124
|
-
const
|
|
125
|
-
E(
|
|
124
|
+
const n = O(s);
|
|
125
|
+
E(n);
|
|
126
126
|
}
|
|
127
127
|
});
|
|
128
|
-
const k = V(() => o(
|
|
129
|
-
function
|
|
130
|
-
q(
|
|
128
|
+
const k = V(() => o(r).total === 0 ? "-" : `${o(c.value)}/${Math.ceil(o(r).total / o(p))}`);
|
|
129
|
+
function ee(e) {
|
|
130
|
+
q(e) && (r.value.records = e, r.value.total = e.length);
|
|
131
131
|
}
|
|
132
|
-
const
|
|
133
|
-
loading: o(
|
|
132
|
+
const te = V(() => ({
|
|
133
|
+
loading: o(r).loading,
|
|
134
134
|
pagination: {
|
|
135
135
|
current: o(c),
|
|
136
136
|
pageSize: o(p),
|
|
137
|
-
total: o(
|
|
137
|
+
total: o(r).total,
|
|
138
138
|
showSizeChanger: !z,
|
|
139
139
|
showQuickJumper: !z,
|
|
140
140
|
showLessItems: z,
|
|
141
141
|
size: "default",
|
|
142
|
-
showTotal: Q ? (
|
|
143
|
-
class:
|
|
144
|
-
}, [
|
|
145
|
-
class:
|
|
146
|
-
}, [
|
|
147
|
-
class:
|
|
148
|
-
}, [
|
|
149
|
-
class:
|
|
150
|
-
}, [o(k)]), " ",
|
|
142
|
+
showTotal: Q ? (e) => b("span", {
|
|
143
|
+
class: F("pagination-total-wrapper")
|
|
144
|
+
}, [T("ap.apTable.pagination.totalLeftPrefix"), " ", b("span", {
|
|
145
|
+
class: F("pagination-count-text")
|
|
146
|
+
}, [e]), " ", T("ap.apTable.pagination.totalLeftSuffix"), b("span", {
|
|
147
|
+
class: F("pagination--total-right")
|
|
148
|
+
}, [T("ap.apTable.pagination.totalRightPrefix"), " ", b("span", {
|
|
149
|
+
class: F("pagination-count-text")
|
|
150
|
+
}, [o(k)]), " ", T("ap.apTable.pagination.totalRightSuffix")])]) : void 0
|
|
151
151
|
},
|
|
152
152
|
onChange: j,
|
|
153
|
-
dataSource: o(
|
|
153
|
+
dataSource: o(r).records
|
|
154
154
|
}));
|
|
155
155
|
return {
|
|
156
156
|
formRef: u,
|
|
@@ -158,16 +158,16 @@ const Ft = ({
|
|
|
158
158
|
reset: Z,
|
|
159
159
|
refresh: _,
|
|
160
160
|
refreshByDelete: I,
|
|
161
|
-
data:
|
|
161
|
+
data: r,
|
|
162
162
|
current: c,
|
|
163
163
|
pageSize: p,
|
|
164
164
|
handleTableChange: j,
|
|
165
|
-
tableProps:
|
|
166
|
-
dataSource: V(() => o(
|
|
167
|
-
setDataSource:
|
|
165
|
+
tableProps: te,
|
|
166
|
+
dataSource: V(() => o(r).records),
|
|
167
|
+
setDataSource: ee,
|
|
168
168
|
getColumnSFConfig: G
|
|
169
169
|
};
|
|
170
170
|
};
|
|
171
171
|
export {
|
|
172
|
-
|
|
172
|
+
Te as useTablePaging
|
|
173
173
|
};
|
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
import { defineComponent as k, ref as
|
|
1
|
+
import { defineComponent as k, ref as j, computed as u, unref as l, openBlock as f, createElementBlock as E, createVNode as p, withCtx as m, createBlock as L, normalizeStyle as O, createCommentVNode as P, mergeProps as R } from "vue";
|
|
2
2
|
import "../../ap-field/index.mjs";
|
|
3
|
-
import { Space as
|
|
3
|
+
import { Space as T } from "@aplus-frontend/antdv";
|
|
4
4
|
import "../../config-provider/index.mjs";
|
|
5
5
|
import { omit as z } from "lodash-unified";
|
|
6
6
|
import "./popover-input/index.vue.mjs";
|
|
7
7
|
import "../../hooks/index.mjs";
|
|
8
|
-
import { isDef as
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
|
|
8
|
+
import { isDef as F } from "../../utils/index.mjs";
|
|
9
|
+
import { useDefaultPlaceholder as K } from "../../ap-field/hooks/use-default-placeholder.mjs";
|
|
10
|
+
import { useControllableValue as D } from "../../hooks/useControllableValue.mjs";
|
|
11
|
+
import { useLocale as G } from "../../config-provider/hooks/use-locale.mjs";
|
|
12
|
+
import N from "../../ap-field/select/index.vue.mjs";
|
|
13
|
+
import { ApFieldText as $ } from "../../ap-field/text/index.mjs";
|
|
14
|
+
import H from "./popover-input/index.vue2.mjs";
|
|
15
|
+
const s = "GROUP_SEARCH_ALL", re = /* @__PURE__ */ k({
|
|
15
16
|
__name: "index",
|
|
16
17
|
props: {
|
|
17
18
|
style: { type: [Boolean, null, String, Object, Array] },
|
|
@@ -65,80 +66,86 @@ const s = "GROUP_SEARCH_ALL", oe = /* @__PURE__ */ k({
|
|
|
65
66
|
},
|
|
66
67
|
emits: ["update:value"],
|
|
67
68
|
setup(v, { emit: y }) {
|
|
68
|
-
const n = v, h = y, { value: a, updateValue:
|
|
69
|
+
const n = v, h = K("Text", n), B = y, { value: a, updateValue: i } = D(
|
|
69
70
|
n,
|
|
70
|
-
|
|
71
|
-
), c =
|
|
72
|
-
{ value: s, label:
|
|
71
|
+
B
|
|
72
|
+
), c = j(), { t: g } = G(), A = u(() => n.options ? n.options.length > 1 && n.hasAll ? [
|
|
73
|
+
{ value: s, label: g("ap.apGroupSearch.all") },
|
|
73
74
|
...n.options
|
|
74
|
-
] : n.options : []),
|
|
75
|
+
] : n.options : []), _ = u(() => n.options ? n.options.map((e) => e.value) : []), x = u(() => {
|
|
75
76
|
var e, t;
|
|
76
77
|
return (t = (e = l(a)) == null ? void 0 : e.value) != null && t.length ? l(a).value.join(",") : "";
|
|
77
|
-
}), C =
|
|
78
|
+
}), C = u(() => {
|
|
78
79
|
var e, t;
|
|
79
80
|
return (t = (e = l(a)) == null ? void 0 : e.value) != null && t.length ? l(a).value.join(`
|
|
80
81
|
`) : "";
|
|
81
|
-
}),
|
|
82
|
+
}), S = u(() => {
|
|
82
83
|
var t;
|
|
83
84
|
const e = (t = l(a)) == null ? void 0 : t.key;
|
|
84
85
|
if (e != null && e.length)
|
|
85
86
|
return e.length === 1 ? e[0] : s;
|
|
87
|
+
}), V = u(() => {
|
|
88
|
+
var o;
|
|
89
|
+
const e = (o = l(a)) == null ? void 0 : o.key;
|
|
90
|
+
return !e || (e == null ? void 0 : e.length) <= 1 ? l(h) : (n.options || []).filter((r) => e.includes(r.value)).map((r) => r.label).join("、");
|
|
86
91
|
});
|
|
87
|
-
function
|
|
88
|
-
const t = l(a) || {}, o = e === s ? l(
|
|
89
|
-
|
|
92
|
+
function U(e) {
|
|
93
|
+
const t = l(a) || {}, o = e === s ? l(_) : F(e) ? [e] : [];
|
|
94
|
+
i({
|
|
90
95
|
...t,
|
|
91
96
|
key: o
|
|
92
97
|
});
|
|
93
98
|
}
|
|
94
|
-
function
|
|
99
|
+
function b(e) {
|
|
95
100
|
const t = l(a) || {};
|
|
96
101
|
let o = e;
|
|
97
102
|
for (; o.startsWith(","); )
|
|
98
103
|
o = o.slice(1);
|
|
99
|
-
let
|
|
100
|
-
|
|
104
|
+
let r = o.replaceAll(",,", ",").split(",");
|
|
105
|
+
r.length === 1 && r[0] === "" && (r = []), i({
|
|
101
106
|
...t,
|
|
102
|
-
value:
|
|
107
|
+
value: r
|
|
103
108
|
});
|
|
104
109
|
}
|
|
105
|
-
function
|
|
110
|
+
function w(e) {
|
|
106
111
|
const t = l(a) || {};
|
|
107
112
|
let o = e.split(/,|\n/);
|
|
108
|
-
|
|
113
|
+
i({
|
|
109
114
|
...t,
|
|
110
115
|
value: o
|
|
111
116
|
});
|
|
112
117
|
}
|
|
113
|
-
function
|
|
118
|
+
function d() {
|
|
114
119
|
var o;
|
|
115
120
|
const e = l(a) || {}, t = (o = e.value) == null ? void 0 : o.filter(Boolean);
|
|
116
|
-
|
|
121
|
+
i({
|
|
117
122
|
...e,
|
|
118
123
|
value: t
|
|
119
124
|
});
|
|
120
125
|
}
|
|
121
|
-
function
|
|
126
|
+
function I(e) {
|
|
122
127
|
var t;
|
|
123
|
-
|
|
128
|
+
d(), (t = n.onBlur) == null || t.call(n, e);
|
|
124
129
|
}
|
|
125
|
-
return (e, t) => (
|
|
130
|
+
return (e, t) => (f(), E("div", {
|
|
126
131
|
ref_key: "containerRef",
|
|
127
132
|
ref: c,
|
|
128
133
|
style: { position: "relative" }
|
|
129
134
|
}, [
|
|
130
|
-
p(l(
|
|
135
|
+
p(l(T).Compact, { block: "" }, {
|
|
131
136
|
default: m(() => {
|
|
132
137
|
var o;
|
|
133
138
|
return [
|
|
134
|
-
(o = e.options) != null && o.length ? (
|
|
139
|
+
(o = e.options) != null && o.length ? (f(), L(l(N), {
|
|
135
140
|
key: 0,
|
|
136
141
|
style: O(e.style),
|
|
137
|
-
options:
|
|
138
|
-
value:
|
|
139
|
-
"onUpdate:value":
|
|
140
|
-
|
|
141
|
-
|
|
142
|
+
options: A.value,
|
|
143
|
+
value: S.value,
|
|
144
|
+
"onUpdate:value": U,
|
|
145
|
+
"allow-clear": !1,
|
|
146
|
+
"dropdown-match-select-width": !1
|
|
147
|
+
}, null, 8, ["style", "options", "value"])) : P("", !0),
|
|
148
|
+
p(l($), R(
|
|
142
149
|
{ style: e.inputStyle },
|
|
143
150
|
l(z)(n, [
|
|
144
151
|
"style",
|
|
@@ -149,21 +156,22 @@ const s = "GROUP_SEARCH_ALL", oe = /* @__PURE__ */ k({
|
|
|
149
156
|
"options"
|
|
150
157
|
]),
|
|
151
158
|
{
|
|
152
|
-
value:
|
|
153
|
-
"onUpdate:value":
|
|
154
|
-
onBlur:
|
|
159
|
+
value: x.value,
|
|
160
|
+
"onUpdate:value": b,
|
|
161
|
+
onBlur: I,
|
|
162
|
+
placeholder: V.value
|
|
155
163
|
}
|
|
156
164
|
), {
|
|
157
165
|
suffix: m(() => [
|
|
158
|
-
p(
|
|
166
|
+
p(H, {
|
|
159
167
|
_parent: c.value,
|
|
160
168
|
value: C.value,
|
|
161
|
-
"onUpdate:value":
|
|
162
|
-
onClose:
|
|
169
|
+
"onUpdate:value": w,
|
|
170
|
+
onClose: d
|
|
163
171
|
}, null, 8, ["_parent", "value"])
|
|
164
172
|
]),
|
|
165
173
|
_: 1
|
|
166
|
-
}, 16, ["style", "value"])
|
|
174
|
+
}, 16, ["style", "value", "placeholder"])
|
|
167
175
|
];
|
|
168
176
|
}),
|
|
169
177
|
_: 1
|
|
@@ -172,5 +180,5 @@ const s = "GROUP_SEARCH_ALL", oe = /* @__PURE__ */ k({
|
|
|
172
180
|
}
|
|
173
181
|
});
|
|
174
182
|
export {
|
|
175
|
-
|
|
183
|
+
re as default
|
|
176
184
|
};
|
|
@@ -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:
|
|
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,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
2
|
-
`):""}),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("vue");require("../../ap-field/index.js");const q=require("@aplus-frontend/antdv");require("../../config-provider/index.js");const b=require("lodash-unified");require("./popover-input/index.vue.js");require("../../hooks/index.js");const U=require("../../utils/index.js"),w=require("../../ap-field/hooks/use-default-placeholder.js"),k=require("../../hooks/useControllableValue.js"),I=require("../../config-provider/hooks/use-locale.js"),j=require("../../ap-field/select/index.vue.js"),L=require("../../ap-field/text/index.js"),O=require("./popover-input/index.vue2.js"),s="GROUP_SEARCH_ALL",P=t.defineComponent({__name:"index",props:{style:{type:[Boolean,null,String,Object,Array]},inputStyle:{type:[Boolean,null,String,Object,Array]},options:{},hasAll:{type:Boolean,default:!0},value:{},"onUpdate:value":{},mode:{default:"edit"},class:{},id:{},placeholder:{},autocomplete:{},type:{default:"text"},name:{},size:{},autofocus:{type:Boolean},lazy:{type:Boolean,default:!0},maxlength:{},loading:{type:Boolean},bordered:{type:Boolean,default:!0},showCount:{type:[Boolean,Object]},htmlSize:{},onPressEnter:{},onKeydown:{},onKeyup:{},onFocus:{},onBlur:{},onChange:{},onInput:{},onCompositionstart:{},onCompositionend:{},valueModifiers:{},hidden:{type:Boolean},status:{},defaultValue:{},inputElement:{},prefixCls:{},disabled:{type:Boolean},focused:{type:Boolean},triggerFocus:{},readonly:{type:Boolean},handleReset:{},addonBefore:{},addonAfter:{},prefix:{},suffix:{},clearIcon:{},allowClear:{type:Boolean,default:!0},emptyText:{default:"--"}},emits:["update:value"],setup(c,{emit:d}){const o=c,f=w.useDefaultPlaceholder("Text",o),v=d,{value:u,updateValue:r}=k.useControllableValue(o,v),i=t.ref(),{t:y}=I.useLocale(),h=t.computed(()=>o.options?o.options.length>1&&o.hasAll?[{value:s,label:y("ap.apGroupSearch.all")},...o.options]:o.options:[]),m=t.computed(()=>o.options?o.options.map(e=>e.value):[]),_=t.computed(()=>{var e,n;return(n=(e=t.unref(u))==null?void 0:e.value)!=null&&n.length?t.unref(u).value.join(","):""}),g=t.computed(()=>{var e,n;return(n=(e=t.unref(u))==null?void 0:e.value)!=null&&n.length?t.unref(u).value.join(`
|
|
2
|
+
`):""}),B=t.computed(()=>{var n;const e=(n=t.unref(u))==null?void 0:n.key;if(e!=null&&e.length)return e.length===1?e[0]:s}),x=t.computed(()=>{var l;const e=(l=t.unref(u))==null?void 0:l.key;return!e||(e==null?void 0:e.length)<=1?t.unref(f):(o.options||[]).filter(a=>e.includes(a.value)).map(a=>a.label).join("、")});function A(e){const n=t.unref(u)||{},l=e===s?t.unref(m):U.isDef(e)?[e]:[];r({...n,key:l})}function C(e){const n=t.unref(u)||{};let l=e;for(;l.startsWith(",");)l=l.slice(1);let a=l.replaceAll(",,",",").split(",");a.length===1&&a[0]===""&&(a=[]),r({...n,value:a})}function V(e){const n=t.unref(u)||{};let l=e.split(/,|\n/);r({...n,value:l})}function p(){var l;const e=t.unref(u)||{},n=(l=e.value)==null?void 0:l.filter(Boolean);r({...e,value:n})}function S(e){var n;p(),(n=o.onBlur)==null||n.call(o,e)}return(e,n)=>(t.openBlock(),t.createElementBlock("div",{ref_key:"containerRef",ref:i,style:{position:"relative"}},[t.createVNode(t.unref(q.Space).Compact,{block:""},{default:t.withCtx(()=>{var l;return[(l=e.options)!=null&&l.length?(t.openBlock(),t.createBlock(t.unref(j.default),{key:0,style:t.normalizeStyle(e.style),options:h.value,value:B.value,"onUpdate:value":A,"allow-clear":!1,"dropdown-match-select-width":!1},null,8,["style","options","value"])):t.createCommentVNode("",!0),t.createVNode(t.unref(L.ApFieldText),t.mergeProps({style:e.inputStyle},t.unref(b.omit)(o,["style","value","onUpdate:value","inputStyle","hasAll","options"]),{value:_.value,"onUpdate:value":C,onBlur:S,placeholder:x.value}),{suffix:t.withCtx(()=>[t.createVNode(O.default,{_parent:i.value,value:g.value,"onUpdate:value":V,onClose:p},null,8,["_parent","value"])]),_:1},16,["style","value","placeholder"])]}),_:1})],512))}});exports.default=P;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aplus-frontend/ui",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.17",
|
|
4
4
|
"main": "./lib/index.js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -63,8 +63,8 @@
|
|
|
63
63
|
"scroll-into-view-if-needed": "^3.1.0",
|
|
64
64
|
"sortablejs": "^1.15.2",
|
|
65
65
|
"vuedraggable": "^4.1.0",
|
|
66
|
-
"@aplus-frontend/
|
|
67
|
-
"@aplus-frontend/
|
|
66
|
+
"@aplus-frontend/utils": "1.0.42",
|
|
67
|
+
"@aplus-frontend/hooks": "1.0.7"
|
|
68
68
|
},
|
|
69
69
|
"peerDependencies": {
|
|
70
70
|
"@aplus-frontend/antdv": "^1.0.3",
|