update 6 files
This commit is contained in:
parent
2c1acf2007
commit
67e0687be1
|
|
@ -33,20 +33,30 @@ export const TypeRichText: React.FC<any> = ({
|
||||||
const editorRef = useRef(null);
|
const editorRef = useRef(null);
|
||||||
const [content, setContent] = useState(``);
|
const [content, setContent] = useState(``);
|
||||||
|
|
||||||
const input = useLocal({
|
|
||||||
value: `` as any,
|
|
||||||
ref: null as any,
|
|
||||||
open: false,
|
|
||||||
editor: null as any,
|
|
||||||
});
|
|
||||||
const [url, setUrl] = useState(null as any);
|
|
||||||
const local = useLocal({
|
const local = useLocal({
|
||||||
open: false,
|
open: false,
|
||||||
data: ["General", "Table"],
|
data: ["General", "Table"],
|
||||||
tab: 0,
|
tab: 0,
|
||||||
active: "General",
|
active: "General",
|
||||||
|
ready: true as boolean,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const input = useLocal({
|
||||||
|
value: `` as any,
|
||||||
|
ref: null as any,
|
||||||
|
open: false,
|
||||||
|
editor: null as any,
|
||||||
|
ready: true as boolean,
|
||||||
|
reload: () => {
|
||||||
|
local.ready = false;
|
||||||
|
local.render();
|
||||||
|
setTimeout(() => {
|
||||||
|
local.ready = true;
|
||||||
|
local.render();
|
||||||
|
}, 500);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
const [url, setUrl] = useState(null as any);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
try {
|
try {
|
||||||
fm.fields[name] = { ...fm.fields?.[name], ...input };
|
fm.fields[name] = { ...fm.fields?.[name], ...input };
|
||||||
|
|
@ -811,6 +821,7 @@ export const TypeRichText: React.FC<any> = ({
|
||||||
`
|
`
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
|
{local.ready ? (
|
||||||
<EditorProvider
|
<EditorProvider
|
||||||
slotBefore={<MenuBar />}
|
slotBefore={<MenuBar />}
|
||||||
extensions={extensions}
|
extensions={extensions}
|
||||||
|
|
@ -824,6 +835,9 @@ export const TypeRichText: React.FC<any> = ({
|
||||||
content={fm.data?.[name]}
|
content={fm.data?.[name]}
|
||||||
editable={!disabled}
|
editable={!disabled}
|
||||||
></EditorProvider>
|
></EditorProvider>
|
||||||
|
) : (
|
||||||
|
<></>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -189,7 +189,6 @@ export const TableList: React.FC<any> = ({
|
||||||
if (typeof onCount === "function") {
|
if (typeof onCount === "function") {
|
||||||
const res = await onCount();
|
const res = await onCount();
|
||||||
local.count = res;
|
local.count = res;
|
||||||
|
|
||||||
local.render();
|
local.render();
|
||||||
}
|
}
|
||||||
if (mode === "form") {
|
if (mode === "form") {
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,6 @@ export const TableUI: React.FC<any> = ({
|
||||||
<TabHeaderBetter
|
<TabHeaderBetter
|
||||||
disabledPagination={true}
|
disabledPagination={true}
|
||||||
onLabel={(row: any) => {
|
onLabel={(row: any) => {
|
||||||
console.log({ row });
|
|
||||||
return (
|
return (
|
||||||
<div className="flex flex-row items-center gap-x-2 font-bold">
|
<div className="flex flex-row items-center gap-x-2 font-bold">
|
||||||
<div className="text-3xl">
|
<div className="text-3xl">
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,12 @@ import { cva, type VariantProps } from "class-variance-authority";
|
||||||
|
|
||||||
import { cn } from "@/lib/utils/utils";
|
import { cn } from "@/lib/utils/utils";
|
||||||
import { FC } from "react";
|
import { FC } from "react";
|
||||||
|
import {
|
||||||
|
Tooltip,
|
||||||
|
TooltipContent,
|
||||||
|
TooltipProvider,
|
||||||
|
TooltipTrigger,
|
||||||
|
} from "./tooltip";
|
||||||
|
|
||||||
const btn = cva(
|
const btn = cva(
|
||||||
" text-white px-4 py-1.5 group active-menu-icon relative flex items-stretch justify-center p-0.5 text-center border border-transparent text-white enabled:hover:bg-cyan-800 rounded-md"
|
" text-white px-4 py-1.5 group active-menu-icon relative flex items-stretch justify-center p-0.5 text-center border border-transparent text-white enabled:hover:bg-cyan-800 rounded-md"
|
||||||
|
|
@ -43,6 +49,7 @@ export interface ButtonProps
|
||||||
extends React.ButtonHTMLAttributes<HTMLButtonElement>,
|
extends React.ButtonHTMLAttributes<HTMLButtonElement>,
|
||||||
VariantProps<typeof buttonVariants> {
|
VariantProps<typeof buttonVariants> {
|
||||||
asChild?: boolean;
|
asChild?: boolean;
|
||||||
|
tooltip?: any;
|
||||||
}
|
}
|
||||||
|
|
||||||
const ButtonBetter = React.forwardRef<HTMLButtonElement, ButtonProps>(
|
const ButtonBetter = React.forwardRef<HTMLButtonElement, ButtonProps>(
|
||||||
|
|
@ -57,6 +64,36 @@ const ButtonBetter = React.forwardRef<HTMLButtonElement, ButtonProps>(
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
const ButtonBetterTooltip = React.forwardRef<HTMLButtonElement, ButtonProps>(
|
||||||
|
({ tooltip, className, variant, size, asChild = false, ...props }, ref) => {
|
||||||
|
const Comp = asChild ? Slot : "button";
|
||||||
|
if (tooltip) {
|
||||||
|
return (
|
||||||
|
<TooltipProvider>
|
||||||
|
<Tooltip>
|
||||||
|
<TooltipTrigger asChild>
|
||||||
|
<Comp
|
||||||
|
className={cn(buttonVariants({ variant, size, className }))}
|
||||||
|
ref={ref}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
</TooltipTrigger>
|
||||||
|
<TooltipContent className="bg-linear-sidebar-active text-white border border-primary shadow-md transition-all ">
|
||||||
|
<p>{tooltip}</p>
|
||||||
|
</TooltipContent>
|
||||||
|
</Tooltip>
|
||||||
|
</TooltipProvider>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return (
|
||||||
|
<Comp
|
||||||
|
className={cn(buttonVariants({ variant, size, className }))}
|
||||||
|
ref={ref}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
const ButtonContainer: FC<any> = ({
|
const ButtonContainer: FC<any> = ({
|
||||||
children,
|
children,
|
||||||
className,
|
className,
|
||||||
|
|
@ -71,4 +108,10 @@ const ButtonContainer: FC<any> = ({
|
||||||
};
|
};
|
||||||
ButtonBetter.displayName = "Button";
|
ButtonBetter.displayName = "Button";
|
||||||
|
|
||||||
export { ButtonBetter, ButtonContainer, buttonVariants, btn };
|
export {
|
||||||
|
ButtonBetter,
|
||||||
|
ButtonContainer,
|
||||||
|
buttonVariants,
|
||||||
|
btn,
|
||||||
|
ButtonBetterTooltip,
|
||||||
|
};
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,8 @@ export const actionToast = async (data: {
|
||||||
<div className="flex flex-col w-full">
|
<div className="flex flex-col w-full">
|
||||||
<div className="flex text-red-600 items-center">
|
<div className="flex text-red-600 items-center">
|
||||||
<AlertTriangle className="h-4 w-4 mr-1" />
|
<AlertTriangle className="h-4 w-4 mr-1" />
|
||||||
{msg_error ? msg_error : "Failed"} { get(ex, "response.data.meta.message") || ex.message}.
|
{msg_error ? msg_error : "Failed"}{" "}
|
||||||
|
{get(ex, "response.data.meta.message") || ex.message}.
|
||||||
</div>
|
</div>
|
||||||
</div>,
|
</div>,
|
||||||
{
|
{
|
||||||
|
|
@ -74,6 +75,5 @@ export const actionToast = async (data: {
|
||||||
`,
|
`,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
if (typeof after === "function") after();
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -79,10 +79,7 @@ export const apix = async ({
|
||||||
throw new Error(`Unsupported HTTP method: ${method}`);
|
throw new Error(`Unsupported HTTP method: ${method}`);
|
||||||
}
|
}
|
||||||
} catch (ex: any) {
|
} catch (ex: any) {
|
||||||
console.error(
|
throw new Error(get(ex, "response.data.meta.message") || ex.message);
|
||||||
"API Error:",
|
|
||||||
get(ex, "response.data.meta.message") || ex.message
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const val = get(result, value);
|
const val = get(result, value);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue