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