feat: new config format

This commit is contained in:
2025-03-13 23:26:00 +00:00
parent 48dc9ec4df
commit fd27000c05
30 changed files with 1447 additions and 833 deletions

View File

@ -2,25 +2,16 @@
import Button from 'primevue/button';
import InputText from 'primevue/inputtext';
import { open } from '@tauri-apps/plugin-dialog';
import { usePrfStore } from '../stores';
const props = defineProps({
field: String,
default: String,
placeholder: String,
directory: Boolean,
promptname: String,
extension: String,
value: String,
callback: Function,
});
if (props.field === undefined || props.default === undefined) {
throw new Error('Invalid FilePicker');
}
const prf = usePrfStore();
const cfg = prf.cfg(props.field, props.default);
const filePick = async () => {
const res = await open({
multiple: false,
@ -35,9 +26,9 @@ const filePick = async () => {
]
: [],
});
if (res != null) {
cfg.value =
/*path.relative(cfgs.current?.data.exe_dir ?? '', res) */ res;
if (res != null && props.callback !== undefined) {
props.callback(res);
/*path.relative(cfgs.current?.data.exe_dir ?? '', res) */
}
};
</script>
@ -48,6 +39,7 @@ const filePick = async () => {
size="small"
:placeholder="placeholder"
type="text"
v-model="cfg"
:model-value="value"
@update:model-value="(value) => callback && callback(value)"
/>
</template>