This commit is contained in:
rizky 2024-08-14 15:28:16 -07:00
parent 5029cc48d8
commit 101c439ef0
3 changed files with 17 additions and 5 deletions

View File

@ -19,6 +19,8 @@ export const FieldUploadSingle: FC<{
on_change: (e: any) => void | Promise<void>; on_change: (e: any) => void | Promise<void>;
}> = ({ field, fm, prop, on_change, arg }) => { }> = ({ field, fm, prop, on_change, arg }) => {
const styling = arg.upload_style ? arg.upload_style : "full"; const styling = arg.upload_style ? arg.upload_style : "full";
const disabled =
typeof field.disabled === "function" ? field.disabled() : field.disabled;
let value: any = fm.data[field.name]; let value: any = fm.data[field.name];
// let type_upload = // let type_upload =
const input = useLocal({ const input = useLocal({
@ -142,7 +144,7 @@ export const FieldUploadSingle: FC<{
` `
)} )}
> >
{!isEditor && ( {!isEditor && !disabled && (
<input <input
ref={(ref) => (input.ref = ref)} ref={(ref) => (input.ref = ref)}
type="file" type="file"

View File

@ -89,6 +89,7 @@ export const MasterDetail: FC<MDProps> = (arg) => {
const pk = fields.find((e) => e.is_pk); const pk = fields.find((e) => e.is_pk);
md.pk = pk; md.pk = pk;
md.params.parse(); md.params.parse();
if (pk) { if (pk) {
const value = md.params.hash[md.name]; const value = md.params.hash[md.name];
if (!value && md.selected && Object.keys(md.selected).length === 0) { if (!value && md.selected && Object.keys(md.selected).length === 0) {

View File

@ -80,6 +80,15 @@ export const masterDetailApplyParams = (md: MDLocal) => {
} }
}; };
const cleanHash = (hash: string) => {
return hash
.split("#")
.filter(function (value, index, self) {
return self.indexOf(value) === index;
})
.join("#");
};
export const breadcrumbPrefix = (md: MDLocal) => { export const breadcrumbPrefix = (md: MDLocal) => {
let prefix: (BreadItem & { url: string })[] = []; let prefix: (BreadItem & { url: string })[] = [];
if (md.params.links && md.params.links.length > 0) { if (md.params.links && md.params.links.length > 0) {
@ -100,14 +109,14 @@ export const breadcrumbPrefix = (md: MDLocal) => {
const hashIndex = hashes.indexOf(link.hash); const hashIndex = hashes.indexOf(link.hash);
const link_hashes = hashes.slice(0, hashIndex).join("+"); const link_hashes = hashes.slice(0, hashIndex).join("+");
const lnk = link_hashes ? `#lnk=${link_hashes}` : ``; let lnk = link_hashes ? `#lnk=${link_hashes}` : ``;
if (p.md) { if (p.md) {
url = `${p.url || link.url}#${p.md.name}=${p.md.value}${lnk}`; lnk = `#${p.md.name}=${p.md.value}${lnk}`;
} else {
url = `${p.url || link.url}${lnk}`;
} }
url = `${p.url || link.url}${cleanHash(lnk)}`;
if (url) { if (url) {
navigate(url); navigate(url);
} }