@sarafapp/ant-design 1.0.26 → 1.0.27
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/dist/baseTable/SarafTable.vue.es.js +4 -4
- package/dist/baseTable/SarafTable.vue.es2.js +169 -154
- package/dist/baseTable/SarafTableGenerator.vue.d.ts +2 -4
- package/dist/baseTable/SarafTableGenerator.vue.es.js +3 -3
- package/dist/baseTable/SarafTableGenerator.vue.es2.js +131 -124
- package/dist/index.js +4 -4
- package/dist/style.css +1 -1
- package/package.json +2 -2
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { SelectableTableGenerator as
|
|
3
|
-
import
|
|
4
|
-
const
|
|
5
|
-
key:
|
|
1
|
+
import { defineComponent as _e, ref as u, computed as d, onBeforeMount as ge, onBeforeUpdate as ve, onBeforeUnmount as Te, resolveComponent as p, createBlock as _, openBlock as o, createSlots as we, withCtx as l, createElementBlock as s, createCommentVNode as g, unref as m, toDisplayString as S, normalizeClass as ke, resolveDynamicComponent as be, normalizeProps as Ae, mergeProps as Ie, createVNode as h, createElementVNode as Re, Fragment as w, renderList as j, withModifiers as Oe, createTextVNode as k, renderSlot as Pe } from "vue";
|
|
2
|
+
import { SelectableTableGenerator as Ne, TableConstants as b, CellType as y, HeaderType as xe, SortDetail as Ee, SortOrderTableHeader as Le, SortOrder as q, TABLE_ACTION_COLUMN as Be, isOnlyOneItem as De, isLastItem as ze } from "@sarafapp/iron_core";
|
|
3
|
+
import Me from "../dataDisplay/tooltip/SarafTooltip.vue.es.js";
|
|
4
|
+
const Ve = { key: 0 }, He = ["onClick"], Ue = {
|
|
5
|
+
key: 1,
|
|
6
6
|
class: "action-column"
|
|
7
|
-
},
|
|
7
|
+
}, We = /* @__PURE__ */ _e({
|
|
8
8
|
__name: "SarafTableGenerator",
|
|
9
9
|
props: {
|
|
10
10
|
dataSource: {},
|
|
@@ -12,217 +12,224 @@ const He = { key: 0 }, Ue = ["onClick"], Ke = {
|
|
|
12
12
|
tableConfig: {},
|
|
13
13
|
hasInitialLoad: { type: Boolean, default: !0 }
|
|
14
14
|
},
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
const t = J, X = Q, A = c(""), u = c([]), I = c([]), R = c([]), S = c(), _ = s(() => t.dataSource instanceof Oe), x = s(() => u.value.length > b.MINIMAL_LOADABLE_HEADER_COUNT), P = c(0), E = c(0), O = c(0), N = c(!1), Y = s(() => ({
|
|
15
|
+
setup(J) {
|
|
16
|
+
const t = J, A = u(""), i = u([]), I = u([]), R = u([]), C = u(), v = d(() => t.dataSource instanceof Ne), O = d(() => i.value.length > b.MINIMAL_LOADABLE_HEADER_COUNT), P = u(0), N = u(0), x = u(0), E = u(!1), Q = d(() => ({
|
|
18
17
|
total: P.value,
|
|
19
|
-
current:
|
|
18
|
+
current: N.value,
|
|
20
19
|
showLessItems: !0,
|
|
21
20
|
showTotal(e) {
|
|
22
21
|
return "تعداد کل: " + e;
|
|
23
22
|
},
|
|
24
23
|
defaultPageSize: b.DEFAULT_ITEM_COUNT_PER_PAGE,
|
|
25
|
-
pageSize:
|
|
24
|
+
pageSize: x.value,
|
|
26
25
|
position: [b.PAGINATION_POSITION]
|
|
27
|
-
})), L =
|
|
26
|
+
})), L = d(() => {
|
|
28
27
|
var e;
|
|
29
|
-
return ((e =
|
|
30
|
-
}),
|
|
31
|
-
onSelect:
|
|
32
|
-
onSelectAll:
|
|
28
|
+
return ((e = i.value[i.value.length - 1]) == null ? void 0 : e.cellType) === y.ACTION;
|
|
29
|
+
}), X = d(() => v.value ? {
|
|
30
|
+
onSelect: te,
|
|
31
|
+
onSelectAll: ae,
|
|
33
32
|
selectedRowKeys: R.value
|
|
34
|
-
} : null),
|
|
33
|
+
} : null), Y = d(() => !!C.value.summaryItems.length);
|
|
35
34
|
function B(e) {
|
|
36
|
-
return
|
|
35
|
+
return e.onClick;
|
|
37
36
|
}
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
function D(e) {
|
|
38
|
+
return e.cellType !== y.ACTION && typeof B(e) == "function";
|
|
40
39
|
}
|
|
41
|
-
function
|
|
40
|
+
async function Z(e, n, r) {
|
|
41
|
+
D(e) && (r.stopPropagation(), await B(e)(n));
|
|
42
|
+
}
|
|
43
|
+
function ee(e) {
|
|
42
44
|
const n = e.currentTarget;
|
|
43
45
|
A.value = n.scrollWidth > n.clientWidth ? n.innerText : "";
|
|
44
46
|
}
|
|
45
|
-
function
|
|
47
|
+
function te(e) {
|
|
46
48
|
t.dataSource.selectRow(e);
|
|
47
49
|
}
|
|
48
|
-
function
|
|
50
|
+
function ae() {
|
|
49
51
|
t.dataSource.selectAll();
|
|
50
52
|
}
|
|
51
|
-
async function
|
|
52
|
-
if (e && await t.dataSource.paginate(e.current, e.pageSize),
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
|
|
53
|
+
async function ne(e, n, r) {
|
|
54
|
+
if (e && await t.dataSource.paginate(e.current, e.pageSize), r != null && r.columnKey) {
|
|
55
|
+
const T = new Ee(
|
|
56
|
+
r.columnKey,
|
|
57
|
+
oe(r.order)
|
|
56
58
|
);
|
|
57
|
-
await t.dataSource.sort(
|
|
59
|
+
await t.dataSource.sort(T);
|
|
58
60
|
}
|
|
59
61
|
}
|
|
60
|
-
function
|
|
61
|
-
return e ===
|
|
62
|
+
function oe(e) {
|
|
63
|
+
return e === Le.ASC ? q.ASC : q.DESC;
|
|
62
64
|
}
|
|
63
|
-
async function
|
|
64
|
-
t.hasInitialLoad && await t.dataSource.load(),
|
|
65
|
+
async function le() {
|
|
66
|
+
t.hasInitialLoad && await t.dataSource.load(), z();
|
|
65
67
|
}
|
|
66
|
-
function
|
|
68
|
+
function z() {
|
|
67
69
|
const e = t.dataSource.hasAnyAction();
|
|
68
|
-
e && !L.value &&
|
|
70
|
+
e && !L.value && re(), !e && L.value && ce();
|
|
69
71
|
}
|
|
70
|
-
function
|
|
71
|
-
|
|
72
|
+
function re() {
|
|
73
|
+
i.value.push(Be);
|
|
72
74
|
}
|
|
73
|
-
function
|
|
74
|
-
|
|
75
|
+
function ce() {
|
|
76
|
+
i.value.pop();
|
|
75
77
|
}
|
|
76
|
-
function
|
|
78
|
+
function ue(e) {
|
|
77
79
|
t.dataSource.handleClick(e);
|
|
78
80
|
}
|
|
79
|
-
function
|
|
81
|
+
function ie(e) {
|
|
80
82
|
t.dataSource.handleMetaClick(e);
|
|
81
83
|
}
|
|
82
|
-
function
|
|
84
|
+
function se(e) {
|
|
83
85
|
t.dataSource.handleDoubleClick(e);
|
|
84
86
|
}
|
|
85
|
-
function
|
|
87
|
+
function de(e) {
|
|
86
88
|
return {
|
|
87
89
|
onClick(n) {
|
|
88
|
-
n.metaKey ?
|
|
90
|
+
n.metaKey ? ie(e) : ue(e);
|
|
89
91
|
},
|
|
90
92
|
onDblclick() {
|
|
91
|
-
|
|
93
|
+
se(e);
|
|
92
94
|
}
|
|
93
95
|
};
|
|
94
96
|
}
|
|
95
|
-
function
|
|
97
|
+
function pe(e) {
|
|
96
98
|
return e.id;
|
|
97
99
|
}
|
|
98
|
-
function
|
|
99
|
-
return !
|
|
100
|
+
function fe(e, n) {
|
|
101
|
+
return !De(e) && !ze(e, n);
|
|
100
102
|
}
|
|
101
|
-
function
|
|
103
|
+
function me(e, n) {
|
|
102
104
|
return e.getProps ? e.getProps(n) : null;
|
|
103
105
|
}
|
|
104
|
-
function
|
|
105
|
-
|
|
106
|
-
}
|
|
107
|
-
function M(e) {
|
|
108
|
-
u.value = e;
|
|
106
|
+
function M() {
|
|
107
|
+
C.value = t.dataSource.loadSummarySchema();
|
|
109
108
|
}
|
|
110
109
|
function V(e) {
|
|
111
|
-
|
|
110
|
+
i.value = e;
|
|
112
111
|
}
|
|
113
112
|
function H(e) {
|
|
114
|
-
|
|
113
|
+
I.value = e;
|
|
115
114
|
}
|
|
116
115
|
function U(e) {
|
|
117
|
-
|
|
116
|
+
R.value = t.dataSource.getSelectedRowIds();
|
|
118
117
|
}
|
|
119
118
|
function K(e) {
|
|
120
|
-
|
|
119
|
+
P.value = e;
|
|
121
120
|
}
|
|
122
121
|
function G(e) {
|
|
123
|
-
|
|
122
|
+
N.value = e;
|
|
124
123
|
}
|
|
125
124
|
function $(e) {
|
|
126
|
-
|
|
125
|
+
x.value = e;
|
|
126
|
+
}
|
|
127
|
+
function F(e) {
|
|
128
|
+
E.value = e;
|
|
127
129
|
}
|
|
128
|
-
return
|
|
129
|
-
|
|
130
|
-
}),
|
|
131
|
-
|
|
132
|
-
}),
|
|
133
|
-
t.dataSource.onDestroy(), t.dataSource.headerSchema.detach(
|
|
130
|
+
return ge(() => {
|
|
131
|
+
le(), M(), t.dataSource.headerSchema.attach(V), t.dataSource.rows.attach(H), t.dataSource.currentPage.attach(G), t.dataSource.currentPageSize.attach($), t.dataSource.totalItems.attach(K), t.dataSource.isExpandable.attach(F), v.value && t.dataSource.selectedRows.attach(U);
|
|
132
|
+
}), ve(() => {
|
|
133
|
+
z(), M();
|
|
134
|
+
}), Te(() => {
|
|
135
|
+
t.dataSource.onDestroy(), t.dataSource.headerSchema.detach(V), t.dataSource.rows.detach(H), t.dataSource.currentPage.detach(G), t.dataSource.currentPageSize.detach($), t.dataSource.totalItems.detach(K), t.dataSource.isExpandable.detach(F), v.value && t.dataSource.selectedRows.detach(U);
|
|
134
136
|
}), (e, n) => {
|
|
135
|
-
const
|
|
136
|
-
return
|
|
137
|
-
columns:
|
|
137
|
+
const r = p("a-button"), T = p("a-divider"), W = p("a-table-summary-cell"), Se = p("a-typography-text"), he = p("a-table-summary-row"), ye = p("a-table");
|
|
138
|
+
return o(), _(ye, {
|
|
139
|
+
columns: i.value,
|
|
138
140
|
"data-source": I.value,
|
|
139
|
-
pagination:
|
|
140
|
-
"custom-row":
|
|
141
|
-
"row-key":
|
|
141
|
+
pagination: Q.value,
|
|
142
|
+
"custom-row": de,
|
|
143
|
+
"row-key": pe,
|
|
142
144
|
loading: t.isLoading,
|
|
143
145
|
scroll: t.dataSource.scrollDetail,
|
|
144
|
-
"row-selection":
|
|
146
|
+
"row-selection": X.value,
|
|
145
147
|
class: "saraf-table",
|
|
146
|
-
onChange:
|
|
147
|
-
},
|
|
148
|
-
|
|
148
|
+
onChange: ne
|
|
149
|
+
}, we({ _: 2 }, [
|
|
150
|
+
O.value ? {
|
|
149
151
|
name: "headerCell",
|
|
150
|
-
fn:
|
|
151
|
-
a.headerType ===
|
|
152
|
+
fn: l(({ column: a }) => [
|
|
153
|
+
a.headerType === m(xe).Text ? (o(), s("span", Ve, S(a.title), 1)) : g("", !0)
|
|
152
154
|
]),
|
|
153
155
|
key: "0"
|
|
154
156
|
} : void 0,
|
|
155
|
-
|
|
157
|
+
O.value ? {
|
|
156
158
|
name: "bodyCell",
|
|
157
|
-
fn:
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
ref: "tooltipTarget",
|
|
163
|
-
class: xe(["ellipsis-cell", { "clickable-cell": !B(o[a.path]) }]),
|
|
164
|
-
onMouseenter: ae,
|
|
165
|
-
onClick: W((h) => te(o[a.path]), ["stop"])
|
|
159
|
+
fn: l(({ column: a, record: c }) => [
|
|
160
|
+
a.cellType !== m(y).ACTION ? (o(), s("div", {
|
|
161
|
+
key: 0,
|
|
162
|
+
class: ke(["saraf-table-cell", { "clickable-cell": D(a) }]),
|
|
163
|
+
onClick: (f) => Z(a, c, f)
|
|
166
164
|
}, [
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
165
|
+
t.tableConfig.getCellComponentRegistry().getRegisteredComponents().has(a.cellType) ? (o(), _(be(
|
|
166
|
+
t.tableConfig.getCellComponentRegistry().getRegisteredComponents().get(a.cellType)
|
|
167
|
+
), Ae(Ie({ key: 0 }, { ...me(a, c), data: c[a.path] })), null, 16)) : a.cellType === m(y).Text ? (o(), s("div", {
|
|
168
|
+
key: 1,
|
|
169
|
+
ref: "tooltipTarget",
|
|
170
|
+
class: "ellipsis-cell",
|
|
171
|
+
onMouseenter: ee
|
|
172
|
+
}, [
|
|
173
|
+
h(m(Me), { title: A.value }, {
|
|
174
|
+
default: l(() => [
|
|
175
|
+
Re("span", null, S(c[a.path]), 1)
|
|
176
|
+
]),
|
|
177
|
+
_: 2
|
|
178
|
+
}, 1032, ["title"])
|
|
179
|
+
], 544)) : g("", !0)
|
|
180
|
+
], 10, He)) : a.cellType === m(y).ACTION ? (o(), s("span", Ue, [
|
|
181
|
+
(o(!0), s(w, null, j(t.dataSource.getRowActions(c), (f, Ce) => (o(), s(w, {
|
|
182
|
+
key: f.actionName
|
|
176
183
|
}, [
|
|
177
|
-
|
|
184
|
+
h(r, {
|
|
178
185
|
type: "link",
|
|
179
|
-
onClick:
|
|
186
|
+
onClick: Oe((Ke) => f.handler(c), ["stop"])
|
|
180
187
|
}, {
|
|
181
|
-
default:
|
|
182
|
-
|
|
188
|
+
default: l(() => [
|
|
189
|
+
k(S(f.actionName), 1)
|
|
183
190
|
]),
|
|
184
191
|
_: 2
|
|
185
192
|
}, 1032, ["onClick"]),
|
|
186
|
-
|
|
187
|
-
t.dataSource.getRowActions(
|
|
188
|
-
|
|
189
|
-
) ? (
|
|
193
|
+
fe(
|
|
194
|
+
t.dataSource.getRowActions(c).length,
|
|
195
|
+
Ce
|
|
196
|
+
) ? (o(), _(T, {
|
|
190
197
|
key: 0,
|
|
191
198
|
type: "vertical"
|
|
192
|
-
})) :
|
|
199
|
+
})) : g("", !0)
|
|
193
200
|
], 64))), 128))
|
|
194
|
-
])) :
|
|
201
|
+
])) : g("", !0)
|
|
195
202
|
]),
|
|
196
203
|
key: "1"
|
|
197
204
|
} : void 0,
|
|
198
|
-
|
|
205
|
+
E.value ? {
|
|
199
206
|
name: "expandedRowRender",
|
|
200
|
-
fn:
|
|
201
|
-
|
|
207
|
+
fn: l(({ record: a }) => [
|
|
208
|
+
Pe(e.$slots, "expandedRowRender", {
|
|
202
209
|
row: a
|
|
203
210
|
}, void 0, !0)
|
|
204
211
|
]),
|
|
205
212
|
key: "2"
|
|
206
213
|
} : void 0,
|
|
207
|
-
|
|
214
|
+
Y.value ? {
|
|
208
215
|
name: "summary",
|
|
209
|
-
fn:
|
|
210
|
-
|
|
211
|
-
default:
|
|
212
|
-
|
|
213
|
-
default:
|
|
214
|
-
|
|
216
|
+
fn: l(() => [
|
|
217
|
+
h(he, null, {
|
|
218
|
+
default: l(() => [
|
|
219
|
+
h(W, null, {
|
|
220
|
+
default: l(() => [
|
|
221
|
+
k(S(C.value.summaryTitle), 1)
|
|
215
222
|
]),
|
|
216
223
|
_: 1
|
|
217
224
|
}),
|
|
218
|
-
(
|
|
219
|
-
key:
|
|
225
|
+
(o(!0), s(w, null, j(C.value.summaryItems, (a, c) => (o(), _(W, {
|
|
226
|
+
key: c,
|
|
220
227
|
align: a.align
|
|
221
228
|
}, {
|
|
222
|
-
default:
|
|
223
|
-
|
|
224
|
-
default:
|
|
225
|
-
|
|
229
|
+
default: l(() => [
|
|
230
|
+
h(Se, null, {
|
|
231
|
+
default: l(() => [
|
|
232
|
+
k(S(a.data), 1)
|
|
226
233
|
]),
|
|
227
234
|
_: 2
|
|
228
235
|
}, 1024)
|
|
@@ -240,5 +247,5 @@ const He = { key: 0 }, Ue = ["onClick"], Ke = {
|
|
|
240
247
|
}
|
|
241
248
|
});
|
|
242
249
|
export {
|
|
243
|
-
|
|
250
|
+
We as default
|
|
244
251
|
};
|