@fewangsit/wangsvue-fats 1.0.1-alpha.41 → 1.0.1-alpha.42

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,12 +1,12 @@
1
1
  import { defineComponent as E, onMounted as I, shallowRef as i, ref as M, createElementBlock as N, openBlock as F, Fragment as L, createElementVNode as d, createVNode as a, mergeProps as P, unref as l, withCtx as U, toDisplayString as _ } from "vue";
2
2
  import { AssetServices as V, DisposalServices as q } from "@tagsamurai/fats-api-services";
3
3
  import { u as z } from "../assetinfo/index.es.js";
4
- import { u as O } from "../plugins/basei18n.es.js";
5
- import { u as W } from "../utils/toast.util.es.js";
4
+ import { u as H } from "../plugins/basei18n.es.js";
5
+ import { u as O } from "../utils/toast.util.es.js";
6
6
  import { _ as g } from "../badge/index.es.js";
7
7
  import { _ as w } from "../button/index.es.js";
8
- import { _ as j } from "../buttonfilter/index.es.js";
9
- import { _ as H } from "../buttonsearch/index.es.js";
8
+ import { _ as W } from "../buttonfilter/index.es.js";
9
+ import { _ as j } from "../buttonsearch/index.es.js";
10
10
  import { D as K } from "../datatable/index.es.js";
11
11
  import { _ as R } from "../dialogconfirm/index.es.js";
12
12
  import { _ as G } from "../image/index.es.js";
@@ -23,6 +23,7 @@ const Y = {
23
23
  childTableProps: {},
24
24
  tableName: {},
25
25
  tableTitle: {},
26
+ parentHeaders: {},
26
27
  useOption: { type: Boolean },
27
28
  data: {},
28
29
  disableKey: {},
@@ -62,7 +63,7 @@ const Y = {
62
63
  I(() => {
63
64
  S();
64
65
  });
65
- const p = W(), { t: s } = O(), { setLoading: m } = z(), c = i(!1), f = i(!1), D = i(0), y = i([]), b = i(), r = i([]), n = M(
66
+ const p = O(), { t: s } = H(), { setLoading: m } = z(), c = i(!1), f = i(!1), D = i(0), y = i([]), b = i(), r = i([]), n = M(
66
67
  /* @__PURE__ */ new Map()
67
68
  ), C = [
68
69
  {
@@ -72,10 +73,10 @@ const Y = {
72
73
  fixed: !0,
73
74
  sortable: !0,
74
75
  excluded: !0,
75
- bodyComponent: (o) => ({
76
+ bodyComponent: (t) => ({
76
77
  component: G,
77
78
  props: {
78
- src: o.assetImageBig,
79
+ src: t.assetImageBig,
79
80
  description: "asset-report-photo",
80
81
  size: "small"
81
82
  }
@@ -86,9 +87,9 @@ const Y = {
86
87
  field: "name.nameWithSequence",
87
88
  sortable: !0,
88
89
  fixed: !0,
89
- bodyTemplate: (o) => {
90
+ bodyTemplate: (t) => {
90
91
  var e;
91
- return ((e = o.name) == null ? void 0 : e.nameWithSequence) ?? "-";
92
+ return ((e = t.name) == null ? void 0 : e.nameWithSequence) ?? "-";
92
93
  }
93
94
  },
94
95
  {
@@ -96,12 +97,12 @@ const Y = {
96
97
  field: "brand.name",
97
98
  sortable: !0,
98
99
  fixed: !1,
99
- bodyComponent: (o) => {
100
+ bodyComponent: (t) => {
100
101
  var e;
101
102
  return {
102
103
  component: g,
103
104
  props: {
104
- label: (e = o.brand) == null ? void 0 : e.name,
105
+ label: (e = t.brand) == null ? void 0 : e.name,
105
106
  severity: "dark",
106
107
  format: "nowrap"
107
108
  }
@@ -113,12 +114,12 @@ const Y = {
113
114
  field: "model.name",
114
115
  sortable: !0,
115
116
  fixed: !1,
116
- bodyComponent: (o) => {
117
+ bodyComponent: (t) => {
117
118
  var e;
118
119
  return {
119
120
  component: g,
120
121
  props: {
121
- label: (e = o.model) == null ? void 0 : e.name,
122
+ label: (e = t.model) == null ? void 0 : e.name,
122
123
  severity: "dark",
123
124
  format: "nowrap"
124
125
  }
@@ -130,12 +131,12 @@ const Y = {
130
131
  field: "group.name",
131
132
  sortable: !0,
132
133
  fixed: !1,
133
- bodyComponent: (o) => {
134
+ bodyComponent: (t) => {
134
135
  var e;
135
136
  return {
136
137
  component: g,
137
138
  props: {
138
- label: (e = o.group) == null ? void 0 : e.name,
139
+ label: (e = t.group) == null ? void 0 : e.name,
139
140
  format: "nowrap"
140
141
  }
141
142
  };
@@ -145,21 +146,21 @@ const Y = {
145
146
  header: "Note",
146
147
  field: "note",
147
148
  fixed: !0,
148
- bodyComponent: (o) => ({
149
+ bodyComponent: (t) => ({
149
150
  component: Q,
150
151
  props: {
151
- modelValue: n.value.get(o._id ?? "assetId").notes,
152
+ modelValue: n.value.get(t._id ?? "assetId").notes,
152
153
  placeholder: s("Enter note"),
153
154
  rows: 1,
154
155
  maxlength: 30
155
156
  },
156
157
  events: {
157
158
  "update:modelValue": (e) => {
158
- const t = n.value.get(o._id ?? "assetId");
159
- n.value.set(o._id ?? "assetId", {
160
- ...t,
159
+ const o = n.value.get(t._id ?? "assetId");
160
+ n.value.set(t._id ?? "assetId", {
161
+ ...o,
161
162
  notes: e
162
- }), o.note = e;
163
+ }), t.note = e;
163
164
  }
164
165
  }
165
166
  })
@@ -167,16 +168,16 @@ const Y = {
167
168
  ], S = async () => {
168
169
  try {
169
170
  m(!0);
170
- const o = sessionStorage.getItem("assetsDisposalReport") ?? "[]", { data: e } = await V.getAllAssets({ _id: o });
171
- e.data.data.forEach((t) => {
172
- n.value.set(t._id ?? "", {
171
+ const t = sessionStorage.getItem("assetsDisposalReport") ?? "[]", { data: e } = await V.getAllAssets({ _id: t });
172
+ e.data.data.forEach((o) => {
173
+ n.value.set(o._id ?? "", {
173
174
  notes: null,
174
- reason: ["Damaged", "Missing"].includes(t.status) ? t.status : u.reason
175
+ reason: ["Damaged", "Missing"].includes(o.status) ? o.status : u.reason
175
176
  });
176
177
  }), r.value = e.data.data, D.value = e.data.totalRecords;
177
- } catch (o) {
178
- console.error(o), p.add({
179
- error: o,
178
+ } catch (t) {
179
+ console.error(t), p.add({
180
+ error: t,
180
181
  message: "Error, failed to get assets. "
181
182
  });
182
183
  } finally {
@@ -191,39 +192,39 @@ const Y = {
191
192
  c.value = !0;
192
193
  }
193
194
  }
194
- ], h = (o) => {
195
+ ], h = (t) => {
195
196
  r.value = r.value.filter(
196
- (e) => !o.some((t) => e._id === t._id)
197
- ), T(o);
198
- }, T = (o) => {
199
- o.forEach((e) => {
197
+ (e) => !t.some((o) => e._id === o._id)
198
+ ), T(t);
199
+ }, T = (t) => {
200
+ t.forEach((e) => {
200
201
  n.value.delete(e._id ?? "");
201
202
  }), r.value.length || v(), p.add({
202
203
  message: s("Success, asset has been removed from the list."),
203
204
  severity: "success"
204
205
  });
205
- }, $ = (o, e) => {
206
- o.forEach((t) => {
207
- n.value.set(t._id ?? "", {
206
+ }, $ = (t, e) => {
207
+ t.forEach((o) => {
208
+ n.value.set(o._id ?? "", {
208
209
  notes: e ?? null,
209
- reason: ["Damaged", "Missing"].includes(t.status) ? t.status : u.reason
210
+ reason: ["Damaged", "Missing"].includes(o.status) ? o.status : u.reason
210
211
  });
211
212
  });
212
213
  }, v = () => {
213
- const o = window.location.pathname, e = o.slice(0, o.lastIndexOf("/"));
214
+ const t = window.location.pathname, e = t.slice(0, t.lastIndexOf("/"));
214
215
  u.router.replace(e), sessionStorage.removeItem("assetsDisposalReport");
215
216
  }, A = async () => {
216
- const o = [];
217
- n.value.forEach((e, t) => {
217
+ const t = [];
218
+ n.value.forEach((e, o) => {
218
219
  const k = {
219
- asset: t,
220
+ asset: o,
220
221
  notes: e.notes,
221
222
  reason: e.reason
222
223
  };
223
- o.push(k);
224
+ t.push(k);
224
225
  });
225
226
  try {
226
- m(!0), await q.postReportDisposal({ data: o }), p.add({
227
+ m(!0), await q.postReportDisposal({ data: t }), p.add({
227
228
  message: s("Success, disposal report has been submitted.")
228
229
  }), v();
229
230
  } catch (e) {
@@ -235,35 +236,35 @@ const Y = {
235
236
  m(!1);
236
237
  }
237
238
  };
238
- return (o, e) => (F(), N(L, null, [
239
+ return (t, e) => (F(), N(L, null, [
239
240
  d("div", Y, [
240
241
  d("div", Z, [
241
242
  a(J, {
242
243
  "assets-to-report": r.value,
243
- "onUpdate:assetsToReport": e[0] || (e[0] = (t) => r.value = t),
244
+ "onUpdate:assetsToReport": e[0] || (e[0] = (o) => r.value = o),
244
245
  "selected-data": y.value,
245
- "onUpdate:selectedData": e[1] || (e[1] = (t) => y.value = t),
246
+ "onUpdate:selectedData": e[1] || (e[1] = (o) => y.value = o),
246
247
  onNoted: $,
247
- onRemoved: e[2] || (e[2] = (t) => h(t)),
248
+ onRemoved: e[2] || (e[2] = (o) => h(o)),
248
249
  "table-name": "disposal-report-page-table"
249
250
  }, null, 8, ["assets-to-report", "selected-data"]),
250
- a(H, {
251
+ a(j, {
251
252
  class: "ml-auto",
252
253
  "table-name": "disposal-report-page-table"
253
254
  }),
254
- a(j, { "table-name": "disposal-report-page-table" })
255
+ a(W, { "table-name": "disposal-report-page-table" })
255
256
  ]),
256
257
  a(X, {
257
258
  assets: r.value,
258
259
  "table-name": "disposal-report-page-table"
259
260
  }, null, 8, ["assets"]),
260
- a(K, P(o.$props, {
261
+ a(K, P(t.$props, {
261
262
  columns: C,
262
263
  data: r.value,
263
264
  lazy: !1,
264
265
  options: B,
265
266
  rows: 10,
266
- onToggleOption: e[3] || (e[3] = (t) => b.value = t),
267
+ onToggleOption: e[3] || (e[3] = (o) => b.value = o),
267
268
  "data-key": "_id",
268
269
  "rounded-header": "",
269
270
  "selection-type": "checkbox",
@@ -274,18 +275,18 @@ const Y = {
274
275
  ]),
275
276
  a(R, {
276
277
  visible: c.value,
277
- "onUpdate:visible": e[4] || (e[4] = (t) => c.value = t),
278
+ "onUpdate:visible": e[4] || (e[4] = (o) => c.value = o),
278
279
  body: l(s)("Are you sure you want to remove it?"),
279
280
  "confirm-label": l(s)("Remove"),
280
281
  header: l(s)("Remove from List"),
281
282
  lists: [b.value],
282
- onConfirm: e[5] || (e[5] = (t) => h([b.value])),
283
+ onConfirm: e[5] || (e[5] = (o) => h([b.value])),
283
284
  "list-label": "name.nameWithSequence",
284
285
  severity: "danger"
285
286
  }, null, 8, ["visible", "body", "confirm-label", "header", "lists"]),
286
287
  a(R, {
287
288
  visible: f.value,
288
- "onUpdate:visible": e[6] || (e[6] = (t) => f.value = t),
289
+ "onUpdate:visible": e[6] || (e[6] = (o) => f.value = o),
289
290
  "confirm-label": l(s)("Continue"),
290
291
  header: l(s)("Cancel Report"),
291
292
  onConfirm: v,
@@ -300,7 +301,7 @@ const Y = {
300
301
  d("div", ee, [
301
302
  a(w, {
302
303
  label: l(s)("Cancel"),
303
- onClick: e[7] || (e[7] = (t) => f.value = !0),
304
+ onClick: e[7] || (e[7] = (o) => f.value = !0),
304
305
  severity: "dark",
305
306
  text: ""
306
307
  }, null, 8, ["label"]),
@@ -0,0 +1,40 @@
1
+ import { defineComponent as n, createElementBlock as t, openBlock as o, normalizeClass as c, createElementVNode as r, normalizeProps as p, guardReactiveProps as i, createBlock as s, createCommentVNode as a, createTextVNode as d, toDisplayString as f } from "vue";
2
+ import { _ as l } from "../icon/index.es.js";
3
+ const m = ["colspan", "rowspan"], u = { class: "flex" }, k = /* @__PURE__ */ n({
4
+ __name: "HeaderCell",
5
+ props: {
6
+ col: {},
7
+ defaultHeaderRowSpan: {},
8
+ sortBy: {},
9
+ sortOrder: {},
10
+ preset: {}
11
+ },
12
+ setup(y) {
13
+ return (e, h) => (o(), t("th", {
14
+ class: c([e.col.headerClass, e.col.class]),
15
+ colspan: e.col.colspan,
16
+ rowspan: e.col.rowspan ?? e.defaultHeaderRowSpan
17
+ }, [
18
+ r("span", p(i(e.preset.headercellcontent)), [
19
+ r("span", u, [
20
+ d(f(e.col.header) + " ", 1),
21
+ e.col.info ? (o(), s(l, {
22
+ key: 0,
23
+ info: e.col.info,
24
+ severity: e.col.infoSeverity,
25
+ class: "w-[10px] h-[10px]",
26
+ icon: "info"
27
+ }, null, 8, ["info", "severity"])) : a("", !0)
28
+ ]),
29
+ e.col.sortable ? (o(), s(l, {
30
+ key: 0,
31
+ icon: !e.sortBy || e.sortBy != e.col.field ? "arrow-up-down" : e.sortOrder == 1 ? "sort-asc" : "sort-desc",
32
+ class: "text-base"
33
+ }, null, 8, ["icon"])) : a("", !0)
34
+ ], 16)
35
+ ], 10, m));
36
+ }
37
+ });
38
+ export {
39
+ k as _
40
+ };
@@ -1,3 +1,5 @@
1
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
2
+ import { BadgeProps } from '../badge';
1
3
  import { CustomValidation } from '../form';
2
4
  import { ClassComponent, GlobalComponentConstructor } from '../ts-helpers.d';
3
5
 
@@ -32,6 +34,37 @@ export interface InputBadgeProps {
32
34
  * - Need to specify the custom validation : { empty: 'Error message when empty' } within props validatorMessage
33
35
  */
34
36
  existingValues?: string[];
37
+ /**
38
+ * Values that can be edited by the user.
39
+ * Any new added label will considered as editable. You dont need to pass a reactive value this prop and update whenever new label is added.
40
+ *
41
+ * @default undefined - All values are editable.
42
+ */
43
+ editableValues?: string[];
44
+ /**
45
+ * List of values that can be removed. If not removable, the remove icon will be either disabled or hidden.
46
+ *
47
+ * Any new added label will considered as removable. You dont need to pass a reactive value this prop and update whenever new label is added.
48
+ * @default undefined - All values are removable.
49
+ */
50
+ removableValues?: string[];
51
+
52
+ /**
53
+ * Specify the variant of the remove button on each badge.
54
+ * By default, the remove button is hidden if the badge is not removable.
55
+ * You can set this to 'disabled' to show the remove button but disable it.
56
+ * @default hidden
57
+ *
58
+ * See {@link BadgeProps.disableRemoveButton}
59
+ */
60
+ removeButtonVariant?: 'disabled' | 'hidden';
61
+
62
+ /**
63
+ * While editing the badgem if it left empty, the badge will be restored to the previous value.
64
+ * @default false - The badge removed.
65
+ */
66
+ restoreValueOnEmpty?: boolean;
67
+
35
68
  /**
36
69
  * Determines if the field is mandatory
37
70
  */