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