checkpoint

This commit is contained in:
rizrmd 2025-02-19 13:28:04 +00:00
parent 09a819dcf1
commit 5901e32479
3 changed files with 21 additions and 20 deletions

View File

@ -26,11 +26,11 @@ export const TypeDropdown: FC<{
if (Array.isArray(res)) { if (Array.isArray(res)) {
const list: any = res.map((e: any, idx: number) => { const list: any = res.map((e: any, idx: number) => {
return { return {
label: arg.opt_get_label(e, "list", { label: arg.opt_get_label?.(e, "list", {
prev: res[idx - 1], prev: res[idx - 1],
next: res[idx + 1], next: res[idx + 1],
}), }),
tag: arg.opt_get_label(e, "label"), tag: arg.opt_get_label?.(e, "label"),
value: e.value, value: e.value,
data: e.data, data: e.data,
}; };
@ -48,7 +48,7 @@ export const TypeDropdown: FC<{
let f = list.find((ex: any) => ex.value === v); let f = list.find((ex: any) => ex.value === v);
if (!f) { if (!f) {
arg.opt_set_value({ arg.opt_set_value?.({
fm, fm,
name: field.name, name: field.name,
type: field.type, type: field.type,
@ -75,7 +75,7 @@ export const TypeDropdown: FC<{
if (field.type === "single-option") { if (field.type === "single-option") {
if (!value && local.options.length > 0) { if (!value && local.options.length > 0) {
arg.opt_set_value({ arg.opt_set_value?.({
fm, fm,
name: field.name, name: field.name,
type: field.type, type: field.type,
@ -83,7 +83,7 @@ export const TypeDropdown: FC<{
selected: [local.options[0]?.value], selected: [local.options[0]?.value],
}); });
} else if (value) { } else if (value) {
arg.opt_set_value({ arg.opt_set_value?.({
fm, fm,
name: field.name, name: field.name,
type: field.type, type: field.type,
@ -191,7 +191,7 @@ export const TypeDropdown: FC<{
popupClassName={popupClassName} popupClassName={popupClassName}
onSelect={({ search, item }) => { onSelect={({ search, item }) => {
if (item) { if (item) {
arg.opt_set_value({ arg.opt_set_value?.({
fm, fm,
name: field.name, name: field.name,
type: field.type, type: field.type,
@ -226,7 +226,7 @@ export const TypeDropdown: FC<{
note="dropdown" note="dropdown"
popupClassName={popupClassName} popupClassName={popupClassName}
onChange={(values) => { onChange={(values) => {
arg.opt_set_value({ arg.opt_set_value?.({
fm, fm,
name: field.name, name: field.name,
type: field.type, type: field.type,

View File

@ -27,7 +27,6 @@ export const ExportExcel: FC<{
const workbook = new ExcelJS.Workbook(); const workbook = new ExcelJS.Workbook();
const worksheet = workbook.addWorksheet("Sheet 1"); const worksheet = workbook.addWorksheet("Sheet 1");
console.log(data);
const columns = getAllKeys(data); const columns = getAllKeys(data);
worksheet.addRow(columns); worksheet.addRow(columns);

View File

@ -42,7 +42,7 @@ export const Typeahead: FC<{
onChange, onChange,
className, className,
popupClassName, popupClassName,
disabledSearch disabledSearch,
}) => { }) => {
const local = useLocal({ const local = useLocal({
value: [] as string[], value: [] as string[],
@ -309,21 +309,23 @@ export const Typeahead: FC<{
} }
} }
const valueLabel = local.value?.map((value) => { const valueLabel = local.value
if (local.mode === "single") { ?.map((value) => {
const item = options.find((item) => item.value === value); if (local.mode === "single") {
const item = options.find((item) => item.value === value);
if (!local.open && !allow_new) { if (!local.open && !allow_new) {
local.select = item || null; local.select = item || null;
local.search.input = item?.tag || item?.label || ""; local.search.input = item?.tag || item?.label || "";
}
return item;
} }
return item;
}
const item = local.options.find((e) => e.value === value); const item = local.options.find((e) => e.value === value);
return item; return item;
}); })
.filter((e) => e);
let inputval = local.search.input; let inputval = local.search.input;