tsv2-library 1.0.61-alpha.47 → 1.0.61-alpha.49

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.
@@ -19,6 +19,7 @@ export interface TreeQueryParams {
19
19
  systemRole?: string;
20
20
  transactionAttribute?: string;
21
21
  roleType?: string;
22
+ showAll?: boolean;
22
23
  }
23
24
  export declare const API: ({ type, headers, params, }?: ServiceOptions) => AxiosInstance;
24
25
  declare const TreeServices: {
@@ -19184,22 +19184,43 @@ function generateXlsxFile(data30, _ref2) {
19184
19184
  compression: "deflate"
19185
19185
  });
19186
19186
  }
19187
- const exportToExcel = async (options3) => {
19188
- const { headers, data: data30, fileName } = options3;
19187
+ const prepareRows = (headers, data30) => {
19189
19188
  const rows3 = [];
19190
- if (headers) {
19191
- rows3.push(headers.map((h2) => ({ value: h2 })));
19192
- }
19193
- if (data30.length > 0) {
19194
- const keys2 = Object.keys(data30[0]);
19195
- data30.forEach((row2) => {
19196
- rows3.push(
19197
- keys2.map((key) => ({
19198
- value: row2[key] ?? "-"
19199
- }))
19200
- );
19189
+ const isObjectArray = Array.isArray(data30) && data30.length > 0 && typeof data30[0] === "object" && !Array.isArray(data30[0]);
19190
+ if (isObjectArray) {
19191
+ const objectData = data30;
19192
+ if (headers) {
19193
+ rows3.push(headers.map((h2) => ({ value: h2 })));
19194
+ }
19195
+ if (objectData.length > 0) {
19196
+ const keys2 = headers ? Object.keys(objectData[0]).filter((key) => headers.includes(key)) : Object.keys(objectData[0]);
19197
+ objectData.forEach((row2) => {
19198
+ rows3.push(
19199
+ keys2.map((key) => ({
19200
+ value: row2[key] ?? "-"
19201
+ // Safely access value, default to '-'
19202
+ }))
19203
+ );
19204
+ });
19205
+ }
19206
+ } else if (Array.isArray(data30) && Array.isArray(data30[0])) {
19207
+ const arrayData = data30;
19208
+ if (headers) {
19209
+ rows3.push(headers.map((h2) => ({ value: h2 })));
19210
+ }
19211
+ arrayData.forEach((row2) => {
19212
+ if (row2.length === 0) {
19213
+ rows3.push([{ value: "" }]);
19214
+ } else {
19215
+ rows3.push(row2.map((cell) => ({ value: cell })));
19216
+ }
19201
19217
  });
19202
19218
  }
19219
+ return rows3;
19220
+ };
19221
+ const exportToExcel = async (options3) => {
19222
+ const { headers, data: data30, fileName } = options3;
19223
+ const rows3 = prepareRows(headers, data30);
19203
19224
  const timestamps = (/* @__PURE__ */ new Date()).toLocaleDateString("en-gb", {
19204
19225
  day: "2-digit",
19205
19226
  month: "2-digit",
@@ -39642,11 +39663,12 @@ const _sfc_main$Y = /* @__PURE__ */ defineComponent({
39642
39663
  const fetchTreeList = async () => {
39643
39664
  try {
39644
39665
  isLoading.value = true;
39645
- const { systemRole, transactionAttribute, roleType } = props.groupParams ?? getParamsByPath();
39666
+ const { systemRole, transactionAttribute, roleType, showAll } = props.groupParams ?? getParamsByPath();
39646
39667
  const params = {
39647
39668
  systemRole: systemRole ? JSON.stringify(systemRole) : void 0,
39648
39669
  transactionAttribute: transactionAttribute ? JSON.stringify(transactionAttribute) : void 0,
39649
- roleType: roleType ? JSON.stringify(roleType) : void 0
39670
+ roleType: roleType ? JSON.stringify(roleType) : void 0,
39671
+ showAll
39650
39672
  };
39651
39673
  const { data: data30 } = await TreeServices.getTreeList(
39652
39674
  props.type,