This commit is contained in:
Rizky 2024-03-05 16:49:13 +07:00
parent 60fc0b59d7
commit a79f895064
4 changed files with 27 additions and 11 deletions

View File

@ -26,7 +26,6 @@
"date-fns": "^2.30.0",
"safe-flat": "^2.1.0",
"dbgen": "workspace:*",
"downshift": "^8.2.3",
"esbuild-wasm": "^0.19.10",
"hash-wasm": "^4.11.0",
"idb-keyval": "^6.2.1",

View File

@ -1,12 +1,11 @@
import Downshift from "downshift";
import { FC, useEffect } from "react";
import { useGlobal, useLocal } from "web-utils";
import { apiProxy } from "../../../../../base/load/api/api-proxy";
import { dbProxy } from "../../../../../base/load/db/db-proxy";
import { FMCompDef, FNCompDef } from "../../../../../utils/types/meta-fn";
import { EDGlobal } from "../../../logic/ed-global";
import { EdPropLabel } from "./prop-label";
import { treeRebuild } from "../../../logic/tree/build";
import { EdPropLabel } from "./prop-label";
export const EdPropInstanceOptions: FC<{
name: string;
@ -87,7 +86,7 @@ else metaOptions = resOpt;
p.render();
};
let mode = prop.meta?.option_mode;
let mode = cprop.meta?.option_mode;
if (!mode) mode = "button";
if (metaOptions && metaOptions.length > 0) {
@ -101,8 +100,27 @@ else metaOptions = resOpt;
return (
<div className="flex items-stretch min-h-[28px]">
<EdPropLabel name={cprop.label || name} labelClick={labelClick} />
<div className="flex flex-1 justify-end">
<div className="flex flex-1 justify-end items-stretch">
{mode === "dropdown" && (
<select
value={evalue}
className="flex-1 border-l outline-none"
onChange={(ev) => {
onChange(`"${ev.currentTarget.value}"`);
}}
>
{Array.isArray(metaOptions) &&
metaOptions.map((item, idx) => {
return (
<option key={idx} value={item.value}>
{item.label}
</option>
);
})}
</select>
)}
{/* {mode === "dropdown" && (
<>
<Downshift
inputValue={local.val}
@ -200,7 +218,7 @@ else metaOptions = resOpt;
)}
</Downshift>
</>
)}
)} */}
{mode === "button" && (
<div className="flex-1 pt-1 px-1 flex flex-wrap justify-end space-x-1">
{Array.isArray(metaOptions) &&

View File

@ -1,10 +1,9 @@
import { FC, useEffect } from "react";
import { CPArgs } from "./types";
import { CPCoded } from "./CPCoded";
import { useGlobal, useLocal } from "web-utils";
import { Loading } from "../../../../../utils/ui/loading";
import Downshift from "downshift";
import { EditorGlobal } from "../../../logic/global";
import { CPCoded } from "./CPCoded";
import { CPArgs } from "./types";
export const CPOption: FC<CPArgs> = ({ prop, onChange, editCode, reset }) => {
const local = useLocal({
@ -100,7 +99,7 @@ else metaOptions = resOpt;
<Loading backdrop={false}></Loading>
) : (
<>
{mode === "dropdown" && (
{/* {mode === "dropdown" && (
<>
<Downshift
inputValue={local.val}
@ -193,7 +192,7 @@ else metaOptions = resOpt;
)}
</Downshift>
</>
)}
)} */}
{mode === "button" && (
<div className="flex-1 pt-1 px-2 flex flex-wrap justify-end space-x-1">
{Array.isArray(metaOptions) &&

BIN
bun.lockb

Binary file not shown.