flameresttable 1.0.26 → 1.0.28
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.
- package/package.json +1 -1
- package/src/Table/FlameTable.ts +21 -0
- package/src/Table/Table.vue +12 -2
- package/src/Table/TableOpts.ts +7 -0
package/package.json
CHANGED
package/src/Table/FlameTable.ts
CHANGED
|
@@ -307,4 +307,25 @@ export default class FlameTable<T> {
|
|
|
307
307
|
return result;
|
|
308
308
|
}
|
|
309
309
|
|
|
310
|
+
/**
|
|
311
|
+
* Выгрузить существующие колонки в CSV
|
|
312
|
+
* @param filename
|
|
313
|
+
* @param arr
|
|
314
|
+
*/
|
|
315
|
+
public exportSelectedToCSV(filename: string = "table.csv", arr: any = null) {
|
|
316
|
+
|
|
317
|
+
arr = arr ?? this.getSelectedRows();
|
|
318
|
+
|
|
319
|
+
const array = [Object.keys(arr[0])].concat(arr);
|
|
320
|
+
const csv = array.map(row => Object.values(row).map(val => `"${val}"`).join(';')).join('\n');
|
|
321
|
+
|
|
322
|
+
const csvData = new Blob([csv], { type: 'text/csv' });
|
|
323
|
+
const csvURL = URL.createObjectURL(csvData);
|
|
324
|
+
const link = document.createElement('a');
|
|
325
|
+
link.href = csvURL;
|
|
326
|
+
link.download = filename;
|
|
327
|
+
link.click();
|
|
328
|
+
|
|
329
|
+
}
|
|
330
|
+
|
|
310
331
|
}
|
package/src/Table/Table.vue
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
<div class="flex items-center justify-between">
|
|
9
9
|
<slot name="defaultButtons">
|
|
10
10
|
<div v-show="$props.opts?.Add.can"
|
|
11
|
-
class="flex cursor-pointer justify-center items-center text-white bg-blue-600 font-medium rounded text-sm px-4 text-center hover:bg-blue-700 .focus:ring-4.focus:ring-blue-200.dark:focus:ring-blue-900"
|
|
11
|
+
class="flex mr-3 cursor-pointer justify-center items-center text-white bg-blue-600 font-medium rounded text-sm px-4 text-center hover:bg-blue-700 .focus:ring-4.focus:ring-blue-200.dark:focus:ring-blue-900"
|
|
12
12
|
@click="add()">
|
|
13
13
|
<div class="text-xl">
|
|
14
14
|
+
|
|
@@ -17,6 +17,16 @@
|
|
|
17
17
|
{{ $props.opts?.Add.buttonTitle }}
|
|
18
18
|
</div>
|
|
19
19
|
</div>
|
|
20
|
+
<div v-show="$props.opts?.Export.CSV.can"
|
|
21
|
+
class="flex mr-3 cursor-pointer justify-center items-center text-white bg-blue-600 font-medium rounded text-sm px-4 text-center hover:bg-blue-700 .focus:ring-4.focus:ring-blue-200.dark:focus:ring-blue-900"
|
|
22
|
+
@click="Table.exportSelectedToCSV()">
|
|
23
|
+
<div class="text-xl">
|
|
24
|
+
+
|
|
25
|
+
</div>
|
|
26
|
+
<div class="ml-2">
|
|
27
|
+
{{ $props.opts?.Export.CSV.buttonTitle }}
|
|
28
|
+
</div>
|
|
29
|
+
</div>
|
|
20
30
|
</slot>
|
|
21
31
|
<slot name="otherButtons" />
|
|
22
32
|
|
|
@@ -451,7 +461,7 @@ export default defineComponent({
|
|
|
451
461
|
color: rgb(55, 53, 47);
|
|
452
462
|
font-size: 14px;
|
|
453
463
|
line-height: 16.8px;
|
|
454
|
-
font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, "Apple Color Emoji", Arial, sans-serif, "Segoe UI Emoji", "Segoe UI Symbol";
|
|
464
|
+
font-family: "Roboto", ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, "Apple Color Emoji", Arial, sans-serif, "Segoe UI Emoji", "Segoe UI Symbol";
|
|
455
465
|
border: 1px solid rgb(233, 233, 231);
|
|
456
466
|
}
|
|
457
467
|
|