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