@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.
@@ -1,10 +1,10 @@
1
- import { defineComponent as Ce, ref as c, computed as s, onBeforeMount as Te, onBeforeUpdate as we, onBeforeUnmount as be, resolveComponent as d, createBlock as y, openBlock as l, createSlots as ke, withCtx as r, createElementBlock as p, createCommentVNode as C, unref as g, toDisplayString as m, resolveDynamicComponent as Ae, normalizeProps as Ie, mergeProps as Re, withModifiers as W, normalizeClass as xe, createVNode as f, createElementVNode as Pe, Fragment as T, renderList as j, createTextVNode as w, renderSlot as Ee } from "vue";
2
- import { SelectableTableGenerator as Oe, TableConstants as b, CellType as k, HeaderType as Ne, SortDetail as Le, SortOrderTableHeader as Be, SortOrder as q, TABLE_ACTION_COLUMN as De, isOnlyOneItem as ze, isLastItem as Me } from "@sarafapp/iron_core";
3
- import Ve from "../dataDisplay/tooltip/SarafTooltip.vue.es.js";
4
- const He = { key: 0 }, Ue = ["onClick"], Ke = {
5
- key: 2,
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
- }, je = /* @__PURE__ */ Ce({
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
- emits: ["copy"],
16
- setup(J, { emit: Q }) {
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: E.value,
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: O.value,
24
+ pageSize: x.value,
26
25
  position: [b.PAGINATION_POSITION]
27
- })), L = s(() => {
26
+ })), L = d(() => {
28
27
  var e;
29
- return ((e = u.value[u.value.length - 1]) == null ? void 0 : e.cellType) === k.ACTION;
30
- }), Z = s(() => _.value ? {
31
- onSelect: ne,
32
- onSelectAll: oe,
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), ee = s(() => !!S.value.summaryItems.length);
33
+ } : null), Y = d(() => !!C.value.summaryItems.length);
35
34
  function B(e) {
36
- return String(e).length < 5;
35
+ return e.onClick;
37
36
  }
38
- async function te(e) {
39
- !e || B(e) || (await navigator.clipboard.writeText(String(e)), X("copy", String(e)));
37
+ function D(e) {
38
+ return e.cellType !== y.ACTION && typeof B(e) == "function";
40
39
  }
41
- function ae(e) {
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 ne(e) {
47
+ function te(e) {
46
48
  t.dataSource.selectRow(e);
47
49
  }
48
- function oe() {
50
+ function ae() {
49
51
  t.dataSource.selectAll();
50
52
  }
51
- async function le(e, n, i) {
52
- if (e && await t.dataSource.paginate(e.current, e.pageSize), i != null && i.columnKey) {
53
- const v = new Le(
54
- i.columnKey,
55
- re(i.order)
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(v);
59
+ await t.dataSource.sort(T);
58
60
  }
59
61
  }
60
- function re(e) {
61
- return e === Be.ASC ? q.ASC : q.DESC;
62
+ function oe(e) {
63
+ return e === Le.ASC ? q.ASC : q.DESC;
62
64
  }
63
- async function ce() {
64
- t.hasInitialLoad && await t.dataSource.load(), D();
65
+ async function le() {
66
+ t.hasInitialLoad && await t.dataSource.load(), z();
65
67
  }
66
- function D() {
68
+ function z() {
67
69
  const e = t.dataSource.hasAnyAction();
68
- e && !L.value && ue(), !e && L.value && ie();
70
+ e && !L.value && re(), !e && L.value && ce();
69
71
  }
70
- function ue() {
71
- u.value.push(De);
72
+ function re() {
73
+ i.value.push(Be);
72
74
  }
73
- function ie() {
74
- u.value.pop();
75
+ function ce() {
76
+ i.value.pop();
75
77
  }
76
- function se(e) {
78
+ function ue(e) {
77
79
  t.dataSource.handleClick(e);
78
80
  }
79
- function de(e) {
81
+ function ie(e) {
80
82
  t.dataSource.handleMetaClick(e);
81
83
  }
82
- function pe(e) {
84
+ function se(e) {
83
85
  t.dataSource.handleDoubleClick(e);
84
86
  }
85
- function me(e) {
87
+ function de(e) {
86
88
  return {
87
89
  onClick(n) {
88
- n.metaKey ? de(e) : se(e);
90
+ n.metaKey ? ie(e) : ue(e);
89
91
  },
90
92
  onDblclick() {
91
- pe(e);
93
+ se(e);
92
94
  }
93
95
  };
94
96
  }
95
- function fe(e) {
97
+ function pe(e) {
96
98
  return e.id;
97
99
  }
98
- function Se(e, n) {
99
- return !ze(e) && !Me(e, n);
100
+ function fe(e, n) {
101
+ return !De(e) && !ze(e, n);
100
102
  }
101
- function he(e, n) {
103
+ function me(e, n) {
102
104
  return e.getProps ? e.getProps(n) : null;
103
105
  }
104
- function z() {
105
- S.value = t.dataSource.loadSummarySchema();
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
- I.value = e;
110
+ i.value = e;
112
111
  }
113
112
  function H(e) {
114
- R.value = t.dataSource.getSelectedRowIds();
113
+ I.value = e;
115
114
  }
116
115
  function U(e) {
117
- P.value = e;
116
+ R.value = t.dataSource.getSelectedRowIds();
118
117
  }
119
118
  function K(e) {
120
- E.value = e;
119
+ P.value = e;
121
120
  }
122
121
  function G(e) {
123
- O.value = e;
122
+ N.value = e;
124
123
  }
125
124
  function $(e) {
126
- N.value = e;
125
+ x.value = e;
126
+ }
127
+ function F(e) {
128
+ E.value = e;
127
129
  }
128
- return Te(() => {
129
- ce(), z(), t.dataSource.headerSchema.attach(M), t.dataSource.rows.attach(V), t.dataSource.currentPage.attach(K), t.dataSource.currentPageSize.attach(G), t.dataSource.totalItems.attach(U), t.dataSource.isExpandable.attach($), _.value && t.dataSource.selectedRows.attach(H);
130
- }), we(() => {
131
- D(), z();
132
- }), be(() => {
133
- t.dataSource.onDestroy(), t.dataSource.headerSchema.detach(M), t.dataSource.rows.detach(V), t.dataSource.currentPage.detach(K), t.dataSource.currentPageSize.detach(G), t.dataSource.totalItems.detach(U), t.dataSource.isExpandable.detach($), _.value && t.dataSource.selectedRows.detach(H);
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 i = d("a-button"), v = d("a-divider"), F = d("a-table-summary-cell"), ye = d("a-typography-text"), ge = d("a-table-summary-row"), _e = d("a-table");
136
- return l(), y(_e, {
137
- columns: u.value,
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: Y.value,
140
- "custom-row": me,
141
- "row-key": fe,
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": Z.value,
146
+ "row-selection": X.value,
145
147
  class: "saraf-table",
146
- onChange: le
147
- }, ke({ _: 2 }, [
148
- x.value ? {
148
+ onChange: ne
149
+ }, we({ _: 2 }, [
150
+ O.value ? {
149
151
  name: "headerCell",
150
- fn: r(({ column: a }) => [
151
- a.headerType === g(Ne).Text ? (l(), p("span", He, m(a.title), 1)) : C("", !0)
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
- x.value ? {
157
+ O.value ? {
156
158
  name: "bodyCell",
157
- fn: r(({ column: a, record: o }) => [
158
- t.tableConfig.getCellComponentRegistry().getRegisteredComponents().has(a.cellType) ? (l(), y(Ae(
159
- t.tableConfig.getCellComponentRegistry().getRegisteredComponents().get(a.cellType)
160
- ), Ie(Re({ key: 0 }, { ...he(a, o), data: o[a.path] })), null, 16)) : a.cellType === g(k).Text ? (l(), p("div", {
161
- key: 1,
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
- f(g(Ve), { title: A.value }, {
168
- default: r(() => [
169
- Pe("span", null, m(o[a.path]), 1)
170
- ]),
171
- _: 2
172
- }, 1032, ["title"])
173
- ], 42, Ue)) : a.cellType === g(k).ACTION ? (l(), p("span", Ke, [
174
- (l(!0), p(T, null, j(t.dataSource.getRowActions(o), (h, ve) => (l(), p(T, {
175
- key: h.actionName
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
- f(i, {
184
+ h(r, {
178
185
  type: "link",
179
- onClick: W((Ge) => h.handler(o), ["stop"])
186
+ onClick: Oe((Ke) => f.handler(c), ["stop"])
180
187
  }, {
181
- default: r(() => [
182
- w(m(h.actionName), 1)
188
+ default: l(() => [
189
+ k(S(f.actionName), 1)
183
190
  ]),
184
191
  _: 2
185
192
  }, 1032, ["onClick"]),
186
- Se(
187
- t.dataSource.getRowActions(o).length,
188
- ve
189
- ) ? (l(), y(v, {
193
+ fe(
194
+ t.dataSource.getRowActions(c).length,
195
+ Ce
196
+ ) ? (o(), _(T, {
190
197
  key: 0,
191
198
  type: "vertical"
192
- })) : C("", !0)
199
+ })) : g("", !0)
193
200
  ], 64))), 128))
194
- ])) : C("", !0)
201
+ ])) : g("", !0)
195
202
  ]),
196
203
  key: "1"
197
204
  } : void 0,
198
- N.value ? {
205
+ E.value ? {
199
206
  name: "expandedRowRender",
200
- fn: r(({ record: a }) => [
201
- Ee(e.$slots, "expandedRowRender", {
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
- ee.value ? {
214
+ Y.value ? {
208
215
  name: "summary",
209
- fn: r(() => [
210
- f(ge, null, {
211
- default: r(() => [
212
- f(F, null, {
213
- default: r(() => [
214
- w(m(S.value.summaryTitle), 1)
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
- (l(!0), p(T, null, j(S.value.summaryItems, (a, o) => (l(), y(F, {
219
- key: o,
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: r(() => [
223
- f(ye, null, {
224
- default: r(() => [
225
- w(m(a.data), 1)
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
- je as default
250
+ We as default
244
251
  };