disabling file saver
This commit is contained in:
parent
e096b9dd34
commit
84667c3001
|
|
@ -1,7 +1,6 @@
|
|||
import { useLocal } from "@/utils/use-local";
|
||||
import { FC, MouseEvent } from "react";
|
||||
import ExcelJS from "exceljs";
|
||||
import * as FileSaver from "file-saver";
|
||||
|
||||
export const ExportExcel: FC<{
|
||||
data: any[],
|
||||
|
|
@ -43,7 +42,7 @@ export const ExportExcel: FC<{
|
|||
type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
||||
});
|
||||
|
||||
FileSaver.saveAs(blob, fileName);
|
||||
// FileSaver.saveAs(blob, fileName);
|
||||
|
||||
console.log("Data exported");
|
||||
} catch (error) {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
import { useLocal } from "@/utils/use-local";
|
||||
import get from "lodash.get";
|
||||
import { FC, useEffect, useRef } from "react";
|
||||
import { Panel, PanelGroup, PanelResizeHandle } from "react-resizable-panels";
|
||||
import { refreshBread } from "./MDBread";
|
||||
|
|
@ -10,47 +9,22 @@ import {
|
|||
masterDetailParseHash as masterDetailParseParams,
|
||||
} from "./utils/md-hash";
|
||||
import { masterDetailInit, masterDetailSelected } from "./utils/md-init";
|
||||
import { MDLocal, MDLocalInternal, MDRef, w } from "./utils/typings";
|
||||
|
||||
export const MasterDetail: FC<{
|
||||
child: any;
|
||||
PassProp: any;
|
||||
name: string;
|
||||
mode: "full" | "h-split" | "v-split";
|
||||
show_head: "always" | "only-master" | "only-child" | "hidden";
|
||||
tab_mode: "h-tab" | "v-tab" | "hidden";
|
||||
editor_tab: string;
|
||||
gen_fields: any;
|
||||
gen_table: string;
|
||||
on_init: (md: MDLocal) => void;
|
||||
_item: PrasiItem;
|
||||
}> = ({
|
||||
_item,
|
||||
PassProp,
|
||||
child,
|
||||
name,
|
||||
mode,
|
||||
show_head,
|
||||
tab_mode,
|
||||
editor_tab,
|
||||
gen_fields,
|
||||
gen_table,
|
||||
on_init,
|
||||
}) => {
|
||||
let isGenerate = false as Boolean;
|
||||
|
||||
try {
|
||||
if (!get(w.md_internal, _item.id))
|
||||
w.md_internal = {
|
||||
...w.md_internal,
|
||||
[_item.id]: _item,
|
||||
};
|
||||
isGenerate = false;
|
||||
if (w.generating_prasi_md["master_detail"]) {
|
||||
isGenerate = true;
|
||||
}
|
||||
} catch (ex) {}
|
||||
import { MDLocal, MDLocalInternal, MDProps, MDRef } from "./utils/typings";
|
||||
import { editorMDInit } from "./utils/editor-init";
|
||||
|
||||
export const MasterDetail: FC<MDProps> = (arg) => {
|
||||
const {
|
||||
PassProp,
|
||||
child,
|
||||
name,
|
||||
mode,
|
||||
show_head,
|
||||
tab_mode,
|
||||
editor_tab,
|
||||
gen_fields,
|
||||
gen_table,
|
||||
on_init,
|
||||
} = arg;
|
||||
const _ref = useRef({ PassProp, child });
|
||||
const md = useLocal<MDLocalInternal>({
|
||||
name,
|
||||
|
|
@ -91,14 +65,9 @@ export const MasterDetail: FC<{
|
|||
|
||||
const local = useLocal({ init: false });
|
||||
if (isEditor) {
|
||||
md.props.mode = mode;
|
||||
md.props.show_head = show_head;
|
||||
md.props.tab_mode = tab_mode;
|
||||
md.props.editor_tab = editor_tab;
|
||||
md.props.gen_fields = gen_fields;
|
||||
md.props.gen_table = gen_table;
|
||||
md.props.on_init = on_init;
|
||||
editorMDInit(md, arg);
|
||||
}
|
||||
|
||||
_ref.current.PassProp = PassProp;
|
||||
_ref.current.child = child;
|
||||
|
||||
|
|
@ -107,13 +76,15 @@ export const MasterDetail: FC<{
|
|||
local.render();
|
||||
}, [editor_tab]);
|
||||
|
||||
// refreshBread ga ditaro di useEffect karena
|
||||
// butuh ubah breadcrumb berdasarkan mode master-detailnya
|
||||
refreshBread(md);
|
||||
|
||||
if (!local.init || isEditor) {
|
||||
local.init = true;
|
||||
masterDetailInit(md, child, editor_tab);
|
||||
masterDetailSelected(md);
|
||||
}
|
||||
if (isGenerate) return <>Generating ...</>;
|
||||
return (
|
||||
<div
|
||||
className={cx(
|
||||
|
|
|
|||
|
|
@ -0,0 +1,23 @@
|
|||
import { MDLocal, MDProps } from "./typings";
|
||||
|
||||
export const editorMDInit = (md: MDLocal, arg: MDProps) => {
|
||||
const {
|
||||
PassProp,
|
||||
child,
|
||||
name,
|
||||
mode,
|
||||
show_head,
|
||||
tab_mode,
|
||||
editor_tab,
|
||||
gen_fields,
|
||||
gen_table,
|
||||
on_init,
|
||||
} = arg;
|
||||
md.props.mode = mode;
|
||||
md.props.show_head = show_head;
|
||||
md.props.tab_mode = tab_mode;
|
||||
md.props.editor_tab = editor_tab;
|
||||
md.props.gen_fields = gen_fields;
|
||||
md.props.gen_table = gen_table;
|
||||
md.props.on_init = on_init;
|
||||
};
|
||||
|
|
@ -11,6 +11,20 @@ export const w = window as unknown as {
|
|||
md_internal: Record<string, any>;
|
||||
};
|
||||
|
||||
export type MDProps = {
|
||||
child: any;
|
||||
PassProp: any;
|
||||
name: string;
|
||||
mode: "full" | "h-split" | "v-split";
|
||||
show_head: "always" | "only-master" | "only-child" | "hidden";
|
||||
tab_mode: "h-tab" | "v-tab" | "hidden";
|
||||
editor_tab: string;
|
||||
gen_fields: any;
|
||||
gen_table: string;
|
||||
on_init: (md: MDLocal) => void;
|
||||
_item: PrasiItem;
|
||||
};
|
||||
|
||||
export type MDActions = {
|
||||
action?: string;
|
||||
label: ReactNode;
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ import { on_load } from "./on_load";
|
|||
import { codeBuild, codeBuildTest } from "../master_detail/utils";
|
||||
// import * as Excel from "exceljs";
|
||||
import ExcelJS from "exceljs";
|
||||
import * as FileSaver from "file-saver";
|
||||
|
||||
export const gen_export = async (
|
||||
modify: (data: any) => void,
|
||||
|
|
@ -70,7 +69,7 @@ export const gen_export = async (
|
|||
type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
||||
});
|
||||
|
||||
FileSaver.saveAs(blob, "exported_data.xlsx");
|
||||
// FileSaver.saveAs(blob, "exported_data.xlsx");
|
||||
|
||||
console.log("Data exported");
|
||||
} catch (error) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue