mirror of
https://github.com/Fabio286/antares.git
synced 2025-02-21 14:10:42 +01:00
feat: copy rows as PHP array
This commit is contained in:
parent
8968179c11
commit
03638c0553
@ -177,6 +177,7 @@ import { TableUpdateParams } from 'common/interfaces/tableApis';
|
|||||||
import { jsonToSqlInsert } from 'common/libs/sqlUtils';
|
import { jsonToSqlInsert } from 'common/libs/sqlUtils';
|
||||||
import { unproxify } from '@/libs/unproxify';
|
import { unproxify } from '@/libs/unproxify';
|
||||||
import faker from '@faker-js/faker';
|
import faker from '@faker-js/faker';
|
||||||
|
import * as json2php from 'json2php';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
|
||||||
@ -528,6 +529,12 @@ const copyRow = (format: string) => {
|
|||||||
|
|
||||||
navigator.clipboard.write(data);
|
navigator.clipboard.write(data);
|
||||||
}
|
}
|
||||||
|
else if (format === 'php') {
|
||||||
|
if (!Array.isArray(contentToCopy)) contentToCopy = [contentToCopy];
|
||||||
|
const printer = json2php.make({ linebreak: '\n', indent: '\t', shortArraySyntax: true });
|
||||||
|
const phpString = printer(contentToCopy);
|
||||||
|
navigator.clipboard.writeText(phpString);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const createHtmlTable = (tableData: Array<string[]>) => {
|
const createHtmlTable = (tableData: Array<string[]>) => {
|
||||||
|
@ -31,6 +31,11 @@
|
|||||||
<i class="mdi mdi-18px mdi-table-row text-light pr-1" /> {{ t('word.row', selectedRows.length) }} (CSV)
|
<i class="mdi mdi-18px mdi-table-row text-light pr-1" /> {{ t('word.row', selectedRows.length) }} (CSV)
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="context-element" @click="copyRow('php')">
|
||||||
|
<span class="d-flex">
|
||||||
|
<i class="mdi mdi-18px mdi-table-row text-light pr-1" /> {{ t('word.row', selectedRows.length) }} (PHP)
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
<div class="context-element" @click="copyRow('sql')">
|
<div class="context-element" @click="copyRow('sql')">
|
||||||
<span class="d-flex">
|
<span class="d-flex">
|
||||||
<i class="mdi mdi-18px mdi-table-row text-light pr-1" /> {{ t('word.row', selectedRows.length) }} (SQL INSERT)
|
<i class="mdi mdi-18px mdi-table-row text-light pr-1" /> {{ t('word.row', selectedRows.length) }} (SQL INSERT)
|
||||||
|
4
src/renderer/untyped.d.ts
vendored
4
src/renderer/untyped.d.ts
vendored
@ -2,9 +2,7 @@
|
|||||||
/* eslint-disable @typescript-eslint/ban-types */
|
/* eslint-disable @typescript-eslint/ban-types */
|
||||||
declare module '@/App.vue';
|
declare module '@/App.vue';
|
||||||
declare module 'v-mask';
|
declare module 'v-mask';
|
||||||
declare module 'json2php' {
|
declare module 'json2php';
|
||||||
const make: (args: { linebreak: string; indent: string; shortArraySyntax: boolean }) => (json: any | any[]) => string;
|
|
||||||
}
|
|
||||||
declare module 'vuedraggable' {// <- to export as default
|
declare module 'vuedraggable' {// <- to export as default
|
||||||
const draggableComponent: import('vue').DefineComponent<{
|
const draggableComponent: import('vue').DefineComponent<{
|
||||||
list: {
|
list: {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user