vue-girder-slicer-cli-ui 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +102 -0
- package/dist/api/girderRest.d.ts +36 -0
- package/dist/api/girderSlicerApi.d.ts +32 -0
- package/dist/components/FileBrowser/DataBrowser.tw.vue.d.ts +177 -0
- package/dist/components/FileBrowser/Modal.tw.vue.d.ts +27 -0
- package/dist/components/FileBrowser/RootSelection.tw.vue.d.ts +41 -0
- package/dist/components/FileBrowser/utils.d.ts +9 -0
- package/dist/components/GirderControlsPanel.tw.vue.d.ts +29 -0
- package/dist/components/GirderSlicerParameter.tw.vue.d.ts +50 -0
- package/dist/components/GirderSlicerTaskButton.tw.vue.d.ts +42 -0
- package/dist/components/GirderSlicerTaskCard.tw.vue.d.ts +44 -0
- package/dist/components/GirderSlicerTaskMenu.tw.vue.d.ts +49 -0
- package/dist/components/GlicerSlicerTaskMenuModal.tw.vue.d.ts +34 -0
- package/dist/components/GlicerSlicerTaskMenuModalButton.tw.vue.d.ts +38 -0
- package/dist/components/GriderSlicerTasksIntegrated.tw.vue.d.ts +74 -0
- package/dist/components/Parameters/BaseParameter.tw.vue.d.ts +21 -0
- package/dist/components/Parameters/BooleanParameter.tw.vue.d.ts +18 -0
- package/dist/components/Parameters/ColorParameter.tw.vue.d.ts +19 -0
- package/dist/components/Parameters/EnumerationParameters.tw.vue.d.ts +19 -0
- package/dist/components/Parameters/FileParameter.tw.vue.d.ts +32 -0
- package/dist/components/Parameters/RangeParameter.tw.vue.d.ts +19 -0
- package/dist/favicon.ico +0 -0
- package/dist/girderTypes.d.ts +21 -0
- package/dist/index.d.ts +11 -0
- package/dist/parser/constraints.d.ts +4 -0
- package/dist/parser/convert.d.ts +7 -0
- package/dist/parser/defaultValue.d.ts +12 -0
- package/dist/parser/group.d.ts +9 -0
- package/dist/parser/index.d.ts +8 -0
- package/dist/parser/panel.d.ts +11 -0
- package/dist/parser/param.d.ts +6 -0
- package/dist/parser/parse.d.ts +20 -0
- package/dist/parser/parserTypes.d.ts +58 -0
- package/dist/parser/widget.d.ts +6 -0
- package/dist/style.css +1 -0
- package/dist/tailwind.css +1370 -0
- package/dist/utils.d.ts +5 -0
- package/dist/vue-girder-slicer-cli-ui.js +12987 -0
- package/dist/vue-girder-slicer-cli-ui.umd.cjs +59 -0
- package/package.json +135 -0
- package/src/components/FileBrowser/DataBrowser.tw.vue +842 -0
- package/src/components/FileBrowser/Modal.tw.vue +82 -0
- package/src/components/FileBrowser/RootSelection.tw.vue +83 -0
- package/src/components/FileBrowser/utils.ts +48 -0
- package/src/components/GirderControlsPanel.tw.vue +94 -0
- package/src/components/GirderSlicerParameter.tw.vue +84 -0
- package/src/components/GirderSlicerTaskButton.tw.vue +208 -0
- package/src/components/GirderSlicerTaskCard.tw.vue +184 -0
- package/src/components/GirderSlicerTaskMenu.tw.vue +217 -0
- package/src/components/GlicerSlicerTaskMenuModal.tw.vue +77 -0
- package/src/components/GlicerSlicerTaskMenuModalButton.tw.vue +106 -0
- package/src/components/GriderSlicerTasksIntegrated.tw.vue +73 -0
- package/src/components/Parameters/BaseParameter.tw.vue +76 -0
- package/src/components/Parameters/BooleanParameter.tw.vue +54 -0
- package/src/components/Parameters/ColorParameter.tw.vue +58 -0
- package/src/components/Parameters/EnumerationParameters.tw.vue +66 -0
- package/src/components/Parameters/FileParameter.tw.vue +172 -0
- package/src/components/Parameters/RangeParameter.tw.vue +74 -0
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { PropType, Ref, computed, defineComponent, onMounted, ref } from 'vue'
|
|
3
|
+
import type { XMLBaseValue } from '../../parser/parserTypes';
|
|
4
|
+
import { XMLParameters } from '../../parser/parserTypes';
|
|
5
|
+
export default defineComponent({
|
|
6
|
+
props: {
|
|
7
|
+
data: {
|
|
8
|
+
type: Object as PropType<XMLParameters>,
|
|
9
|
+
required: true,
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
setup(props, { emit }) {
|
|
13
|
+
const error = computed(() => props.data.error)
|
|
14
|
+
const numberVectors = ref(['integer-vector', 'float-vector', 'double-vector', 'string-vector']);
|
|
15
|
+
const numbers = ref(['integer', 'float', 'double']);
|
|
16
|
+
const currentValue: Ref<XMLBaseValue> = ref(0);
|
|
17
|
+
onMounted(() => {
|
|
18
|
+
if (props.data.defaultValue && Array.isArray(props.data.defaultValue)) {
|
|
19
|
+
currentValue.value = props.data.defaultValue.join(',') || props.data.value || '';
|
|
20
|
+
} else {
|
|
21
|
+
currentValue.value = props.data.defaultValue || props.data.value || '';
|
|
22
|
+
}
|
|
23
|
+
})
|
|
24
|
+
const validate = (e: Event) => {
|
|
25
|
+
// Validation Logic for different types
|
|
26
|
+
const update = { ...props.data };
|
|
27
|
+
let value = (e.target as HTMLInputElement).value as XMLBaseValue;
|
|
28
|
+
if (numberVectors.value.includes(props.data.slicerType)) {
|
|
29
|
+
value = (value as string).split(',').map(parseFloat);
|
|
30
|
+
} else if (props.data.slicerType === 'string-vector') {
|
|
31
|
+
value = (value as string).split(',');
|
|
32
|
+
}
|
|
33
|
+
update.value = value;
|
|
34
|
+
currentValue.value = value;
|
|
35
|
+
emit('change', update);
|
|
36
|
+
}
|
|
37
|
+
return {
|
|
38
|
+
error,
|
|
39
|
+
numberVectors,
|
|
40
|
+
numbers,
|
|
41
|
+
currentValue,
|
|
42
|
+
validate
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
})
|
|
46
|
+
</script>
|
|
47
|
+
<template>
|
|
48
|
+
<div>
|
|
49
|
+
<label for="parameterInput">{{ data.title }} <span
|
|
50
|
+
v-if="error"
|
|
51
|
+
class="text-red"
|
|
52
|
+
> {{ error }}</span></label>
|
|
53
|
+
<input
|
|
54
|
+
v-if="numbers.includes(data.slicerType) || data.slicerType === 'string'"
|
|
55
|
+
id="parameterInput"
|
|
56
|
+
class="gsu-input block appearance-none w-full py-1 px-2 mb-1 text-base leading-normal"
|
|
57
|
+
:type="numbers.includes(data.slicerType) ? 'number' : 'text'"
|
|
58
|
+
:value="currentValue"
|
|
59
|
+
@change="validate($event)"
|
|
60
|
+
>
|
|
61
|
+
<input
|
|
62
|
+
v-else-if="(numberVectors.includes(data.slicerType) || data.slicerType === 'string-vector')"
|
|
63
|
+
id="parameterInput"
|
|
64
|
+
class="gsu-input block appearance-none w-full py-1 px-2 mb-1 text-base leading-normal"
|
|
65
|
+
type="text"
|
|
66
|
+
:value="currentValue"
|
|
67
|
+
@change="validate($event)"
|
|
68
|
+
>
|
|
69
|
+
<small
|
|
70
|
+
v-if="data.description"
|
|
71
|
+
class="block mt-1 text-grey"
|
|
72
|
+
>{{ data.description }}</small>
|
|
73
|
+
</div>
|
|
74
|
+
</template>
|
|
75
|
+
<style scoped>
|
|
76
|
+
</style>
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { PropType, Ref, computed, defineComponent, onMounted, ref } from 'vue'
|
|
3
|
+
import { XMLParameters } from '../../parser/parserTypes';
|
|
4
|
+
export default defineComponent({
|
|
5
|
+
props: {
|
|
6
|
+
data: {
|
|
7
|
+
type: Object as PropType<XMLParameters>,
|
|
8
|
+
required: true,
|
|
9
|
+
}
|
|
10
|
+
},
|
|
11
|
+
setup(props, { emit }) {
|
|
12
|
+
const error = computed(() => props.data.error)
|
|
13
|
+
const currentValue: Ref<boolean> = ref(false);
|
|
14
|
+
onMounted(() => {
|
|
15
|
+
currentValue.value = !!props.data.value || !!props.data.defaultValue || false;
|
|
16
|
+
})
|
|
17
|
+
const validate = (e: Event) => {
|
|
18
|
+
// Validation Logic for different types
|
|
19
|
+
const update = { ...props.data }
|
|
20
|
+
let value = (e.target as HTMLInputElement).checked as boolean;
|
|
21
|
+
update.value = value;
|
|
22
|
+
currentValue.value = value;
|
|
23
|
+
emit('change', update);
|
|
24
|
+
}
|
|
25
|
+
return {
|
|
26
|
+
error,
|
|
27
|
+
currentValue,
|
|
28
|
+
validate
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
</script>
|
|
33
|
+
<template>
|
|
34
|
+
<div>
|
|
35
|
+
<div class="grid grid-cols-2 gap-4 pl-4">
|
|
36
|
+
<label for="parameterInput">{{ data.title }} <span
|
|
37
|
+
v-if="error"
|
|
38
|
+
class="text-red"
|
|
39
|
+
> {{ error }}</span></label>
|
|
40
|
+
<input
|
|
41
|
+
class="absolute mt-1 -ml-6"
|
|
42
|
+
type="checkbox"
|
|
43
|
+
:checked="currentValue"
|
|
44
|
+
@change="validate($event)"
|
|
45
|
+
>
|
|
46
|
+
</div>
|
|
47
|
+
<p
|
|
48
|
+
v-if="data.description"
|
|
49
|
+
class="block ml-4 text-grey text-xs"
|
|
50
|
+
>{{ data.description }}</p>
|
|
51
|
+
</div>
|
|
52
|
+
</template>
|
|
53
|
+
<style scoped>
|
|
54
|
+
</style>
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { PropType, Ref, computed, defineComponent, onMounted, ref } from 'vue'
|
|
3
|
+
import { XMLParameters } from '../../parser/parserTypes';
|
|
4
|
+
import type { XMLBaseValue } from '../../parser/parserTypes';
|
|
5
|
+
export default defineComponent({
|
|
6
|
+
props: {
|
|
7
|
+
data: {
|
|
8
|
+
type: Object as PropType<XMLParameters>,
|
|
9
|
+
required: true,
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
setup(props, { emit }) {
|
|
13
|
+
const currentValue: Ref<XMLBaseValue> = ref(0);
|
|
14
|
+
onMounted(() => {
|
|
15
|
+
if (props.data.defaultValue && Array.isArray(props.data.defaultValue)) {
|
|
16
|
+
currentValue.value = props.data.defaultValue.join(',') || props.data.value || '';
|
|
17
|
+
} else {
|
|
18
|
+
currentValue.value = props.data.defaultValue || props.data.value || '';
|
|
19
|
+
}
|
|
20
|
+
})
|
|
21
|
+
const error = computed(() => props.data.error)
|
|
22
|
+
const validate = (e: Event) => {
|
|
23
|
+
// Validation Logic for different types
|
|
24
|
+
const update = { ...props.data };
|
|
25
|
+
let value = (e.target as HTMLInputElement).value as XMLBaseValue;
|
|
26
|
+
update.value = value;
|
|
27
|
+
currentValue.value = value;
|
|
28
|
+
emit('change', update);
|
|
29
|
+
}
|
|
30
|
+
return {
|
|
31
|
+
currentValue,
|
|
32
|
+
error,
|
|
33
|
+
validate
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
</script>
|
|
38
|
+
<template>
|
|
39
|
+
<div class="mb-4">
|
|
40
|
+
<label for="parameterInput">{{ data.title }} <span
|
|
41
|
+
v-if="error"
|
|
42
|
+
class="text-red"
|
|
43
|
+
> {{ error }}</span></label>
|
|
44
|
+
<input
|
|
45
|
+
id="parameterInput"
|
|
46
|
+
class="block appearance-none w-full py-1 px-2 mb-1 text-base leading-normal bg-white text-black dark:bg-gray-600 dark:text-gray-300 text-grey-darker border border-grey rounded"
|
|
47
|
+
type="color"
|
|
48
|
+
:value="currentValue"
|
|
49
|
+
@change="validate($event)"
|
|
50
|
+
>
|
|
51
|
+
<small
|
|
52
|
+
v-if="data.description"
|
|
53
|
+
class="block mt-1 text-grey"
|
|
54
|
+
>{{ data.description }}</small>
|
|
55
|
+
</div>
|
|
56
|
+
</template>
|
|
57
|
+
<style scoped>
|
|
58
|
+
</style>
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { PropType, Ref, computed, defineComponent, onMounted, ref } from 'vue'
|
|
3
|
+
import type { XMLBaseValue } from '../../parser/parserTypes';
|
|
4
|
+
import { XMLParameters } from '../../parser/parserTypes';
|
|
5
|
+
export default defineComponent({
|
|
6
|
+
props: {
|
|
7
|
+
data: {
|
|
8
|
+
type: Object as PropType<XMLParameters>,
|
|
9
|
+
required: true,
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
setup(props, { emit }) {
|
|
13
|
+
const error = computed(() => props.data.error)
|
|
14
|
+
const currentValue: Ref<XMLBaseValue> = ref(0);
|
|
15
|
+
onMounted(() => {
|
|
16
|
+
if (props.data.defaultValue && Array.isArray(props.data.defaultValue)) {
|
|
17
|
+
currentValue.value = props.data.defaultValue.join(',') || props.data.value || '';
|
|
18
|
+
} else {
|
|
19
|
+
currentValue.value = props.data.defaultValue || props.data.value || '';
|
|
20
|
+
}
|
|
21
|
+
})
|
|
22
|
+
const validate = (e: Event) => {
|
|
23
|
+
// Validation Logic for different types
|
|
24
|
+
const update = { ...props.data };
|
|
25
|
+
let value = (e.target as HTMLSelectElement).value as XMLBaseValue;
|
|
26
|
+
if (props.data.slicerType === 'number-enumeration') {
|
|
27
|
+
value = parseFloat(value as string);
|
|
28
|
+
}
|
|
29
|
+
update.value = value;
|
|
30
|
+
currentValue.value = value;
|
|
31
|
+
emit('change', update);
|
|
32
|
+
}
|
|
33
|
+
return {
|
|
34
|
+
error,
|
|
35
|
+
currentValue,
|
|
36
|
+
validate,
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
</script>
|
|
41
|
+
<template>
|
|
42
|
+
<div>
|
|
43
|
+
<label for="parameterInput">{{ data.title }} <span
|
|
44
|
+
v-if="error"
|
|
45
|
+
class="text-red"
|
|
46
|
+
> {{ error }}</span></label>
|
|
47
|
+
<select
|
|
48
|
+
:value="data.value"
|
|
49
|
+
@change="validate($event)"
|
|
50
|
+
>
|
|
51
|
+
<option
|
|
52
|
+
v-for="item in data.values"
|
|
53
|
+
:key="`${data.title}_${item}`"
|
|
54
|
+
:value="item"
|
|
55
|
+
>
|
|
56
|
+
{{ item }}
|
|
57
|
+
</option>
|
|
58
|
+
</select>
|
|
59
|
+
<small
|
|
60
|
+
v-if="data.description"
|
|
61
|
+
class="block mt-1 text-grey"
|
|
62
|
+
>{{ data.description }}</small>
|
|
63
|
+
</div>
|
|
64
|
+
</template>
|
|
65
|
+
<style scoped>
|
|
66
|
+
</style>
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { PropType, Ref, computed, defineComponent, onMounted, ref, watch } from 'vue'
|
|
3
|
+
import { XMLParameters } from '../../parser/parserTypes';
|
|
4
|
+
import { mdiFolderOpen, mdiPlusThick } from '@mdi/js';
|
|
5
|
+
import SvgIcon from '@jamescoyle/vue-icon';
|
|
6
|
+
import DataBrowser from '../FileBrowser/DataBrowser.tw.vue';
|
|
7
|
+
export default defineComponent({
|
|
8
|
+
components: {
|
|
9
|
+
SvgIcon,
|
|
10
|
+
DataBrowser,
|
|
11
|
+
},
|
|
12
|
+
props: {
|
|
13
|
+
data: {
|
|
14
|
+
type: Object as PropType<XMLParameters>,
|
|
15
|
+
required: true,
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
setup(props, { emit }) {
|
|
19
|
+
const currentValue: Ref<string | null> = ref(null);
|
|
20
|
+
const placeHolder = ref('Choose a file...');
|
|
21
|
+
const batchload = ref(false);
|
|
22
|
+
const error = computed(() => props.data.error)
|
|
23
|
+
onMounted(() => {
|
|
24
|
+
if (props.data.slicerType === 'file') {
|
|
25
|
+
placeHolder.value = !props.data.multiple ? 'Choose a file...' : 'Choose multiple files...'
|
|
26
|
+
}
|
|
27
|
+
if (props.data.slicerType === 'multi') {
|
|
28
|
+
placeHolder.value = 'Choose multiple files...'
|
|
29
|
+
}
|
|
30
|
+
if (props.data.slicerType === 'image') {
|
|
31
|
+
placeHolder.value = !props.data.multiple ? 'Choose an image...' : 'Choose multiple images...'
|
|
32
|
+
}
|
|
33
|
+
if (props.data.slicerType === 'directory') {
|
|
34
|
+
placeHolder.value = !props.data.multiple ? 'Choose a folder...' : 'Choose multiple folders...'
|
|
35
|
+
}
|
|
36
|
+
if (['file', 'item', 'image', 'multi'].includes(props.data.slicerType) && ! props.data.multiple) {
|
|
37
|
+
batchload.value = true;
|
|
38
|
+
}
|
|
39
|
+
if (props.data.fileValue?.name) {
|
|
40
|
+
currentValue.value = props.data.fileValue.name;
|
|
41
|
+
girderId.value = props.data.fileValue.girderId;
|
|
42
|
+
parentId.value = props.data.fileValue.parentId;
|
|
43
|
+
selectedName.value = props.data.fileValue.name;
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
const showBrowser = ref(false);
|
|
47
|
+
const inputChanged = (name: string) => {
|
|
48
|
+
emit('input-selected', name);
|
|
49
|
+
}
|
|
50
|
+
const girderId: Ref<string | undefined> = ref(undefined);
|
|
51
|
+
const parentId: Ref<string | undefined> = ref(undefined);
|
|
52
|
+
const selectedName: Ref<string | undefined> = ref(undefined);
|
|
53
|
+
watch(() => props.data.fileValue, () => {
|
|
54
|
+
if (props.data.fileValue?.name) {
|
|
55
|
+
currentValue.value = props.data.fileValue.name;
|
|
56
|
+
girderId.value = props.data.fileValue.girderId;
|
|
57
|
+
parentId.value = props.data.fileValue.parentId;
|
|
58
|
+
selectedName.value = props.data.fileValue.name;
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
const acceptBrowser = ({name, girderId, parentId, regExp, fileId}: {name: string, girderId: string, parentId: string, regExp?: boolean, fileId?: string}) => {
|
|
62
|
+
showBrowser.value = false;
|
|
63
|
+
const update = { ...props.data };
|
|
64
|
+
update.fileValue = { name, girderId, parentId, regExp, fileId };
|
|
65
|
+
currentValue.value = name;
|
|
66
|
+
if (props.data.channel === 'input') {
|
|
67
|
+
inputChanged(name);
|
|
68
|
+
}
|
|
69
|
+
emit('change', update);
|
|
70
|
+
}
|
|
71
|
+
return {
|
|
72
|
+
error,
|
|
73
|
+
currentValue,
|
|
74
|
+
placeHolder,
|
|
75
|
+
showBrowser,
|
|
76
|
+
mdiFolderOpen,
|
|
77
|
+
mdiPlusThick,
|
|
78
|
+
batchload,
|
|
79
|
+
girderId,
|
|
80
|
+
parentId,
|
|
81
|
+
selectedName,
|
|
82
|
+
acceptBrowser,
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
</script>
|
|
87
|
+
<template>
|
|
88
|
+
<div class="pr-4">
|
|
89
|
+
<label for="parameterInput">{{ data.title }} <span
|
|
90
|
+
v-if="error"
|
|
91
|
+
class="text-red"
|
|
92
|
+
> {{ error }}</span></label>
|
|
93
|
+
<div class="relative flex items-stretch w-full">
|
|
94
|
+
<input
|
|
95
|
+
id="parameterInput"
|
|
96
|
+
class="gsu-input block border-colid border-2 border-borderColor appearance-none w-full py-1 px-2 mb-1 text-base leading-normal"
|
|
97
|
+
type="text"
|
|
98
|
+
disabled
|
|
99
|
+
:value="currentValue"
|
|
100
|
+
:placeholder="placeHolder"
|
|
101
|
+
>
|
|
102
|
+
<span class="sm:flex">
|
|
103
|
+
<button
|
|
104
|
+
type="button"
|
|
105
|
+
class="inline-block align-middle text-center select-none border font-normal whitespace-no-wrap py-2 mb-1 px-4 rounded text-base leading-normal no-underline select-btn"
|
|
106
|
+
@click="showBrowser = true"
|
|
107
|
+
>
|
|
108
|
+
<svg-icon
|
|
109
|
+
type="mdi"
|
|
110
|
+
:path="mdiFolderOpen"
|
|
111
|
+
:size="15"
|
|
112
|
+
class="gsu-icon gsu-clickable"
|
|
113
|
+
/>
|
|
114
|
+
</button>
|
|
115
|
+
<button
|
|
116
|
+
v-if="!batchload"
|
|
117
|
+
type="button"
|
|
118
|
+
class="flex align-middle items-center text-center select-none border font-normal whitespace-no-wrap py-2 mb-1 px-4 rounded text-base leading-normal no-underline select-btn-multi"
|
|
119
|
+
@click="showBrowser = true"
|
|
120
|
+
>
|
|
121
|
+
<svg-icon
|
|
122
|
+
type="mdi"
|
|
123
|
+
:path="mdiFolderOpen"
|
|
124
|
+
:size="15"
|
|
125
|
+
class="gsu-icon gsu-clickable "
|
|
126
|
+
/>
|
|
127
|
+
<svg-icon
|
|
128
|
+
type="mdi"
|
|
129
|
+
:path="mdiPlusThick"
|
|
130
|
+
:size="15"
|
|
131
|
+
class="gsu-icon gsu-clickable"
|
|
132
|
+
/>
|
|
133
|
+
</button>
|
|
134
|
+
</span>
|
|
135
|
+
</div>
|
|
136
|
+
<small
|
|
137
|
+
v-if="data.description"
|
|
138
|
+
class="block mt-1 text-grey"
|
|
139
|
+
>{{ data.description }}</small>
|
|
140
|
+
<data-browser
|
|
141
|
+
v-if="showBrowser"
|
|
142
|
+
:type="data.type"
|
|
143
|
+
:output="data.channel === 'output' || data.type === 'new-file'"
|
|
144
|
+
:girder-id="girderId"
|
|
145
|
+
:parent-id="parentId"
|
|
146
|
+
:name="selectedName"
|
|
147
|
+
@close="showBrowser=false"
|
|
148
|
+
@submit="acceptBrowser($event)"
|
|
149
|
+
/>
|
|
150
|
+
</div>
|
|
151
|
+
</template>
|
|
152
|
+
<style scoped>
|
|
153
|
+
.icon {
|
|
154
|
+
color: var(--bs-heading-color);
|
|
155
|
+
}
|
|
156
|
+
.select-btn {
|
|
157
|
+
border: 1px solid gray;
|
|
158
|
+
border-radius: 0px;
|
|
159
|
+
}
|
|
160
|
+
.select-btn:hover {
|
|
161
|
+
border: 1px solid gray;
|
|
162
|
+
background-color: lightgray;
|
|
163
|
+
}
|
|
164
|
+
.select-btn-multi {
|
|
165
|
+
border: 1px solid gray;
|
|
166
|
+
border-radius: 0px 4px 4px 0px;
|
|
167
|
+
}
|
|
168
|
+
.select-btn-multi:hover {
|
|
169
|
+
border: 1px solid gray;
|
|
170
|
+
background-color: lightgray;
|
|
171
|
+
}
|
|
172
|
+
</style>
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { PropType, Ref, computed, defineComponent, onMounted, ref } from 'vue'
|
|
3
|
+
import type { XMLBaseValue } from '../../parser/parserTypes';
|
|
4
|
+
import { XMLParameters } from '../../parser/parserTypes';
|
|
5
|
+
export default defineComponent({
|
|
6
|
+
props: {
|
|
7
|
+
data: {
|
|
8
|
+
type: Object as PropType<XMLParameters>,
|
|
9
|
+
required: true,
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
setup(props, { emit }) {
|
|
13
|
+
const currentValue: Ref<XMLBaseValue> = ref(0);
|
|
14
|
+
onMounted(() => {
|
|
15
|
+
if (props.data.defaultValue && Array.isArray(props.data.defaultValue)) {
|
|
16
|
+
currentValue.value = props.data.defaultValue.join(',') || props.data.value || '';
|
|
17
|
+
} else {
|
|
18
|
+
currentValue.value = props.data.defaultValue || props.data.value || '';
|
|
19
|
+
}
|
|
20
|
+
})
|
|
21
|
+
const validate = (e: Event) => {
|
|
22
|
+
// Validation Logic for different types
|
|
23
|
+
const update = { ...props.data };
|
|
24
|
+
let value = (e.target as HTMLSelectElement).value as XMLBaseValue;
|
|
25
|
+
if (props.data.slicerType === 'number-enumeration') {
|
|
26
|
+
value = parseFloat(value as string);
|
|
27
|
+
}
|
|
28
|
+
update.value = value;
|
|
29
|
+
currentValue.value = value;
|
|
30
|
+
emit('change', update);
|
|
31
|
+
}
|
|
32
|
+
const error = computed(() => props.data.error);
|
|
33
|
+
return {
|
|
34
|
+
error,
|
|
35
|
+
currentValue,
|
|
36
|
+
validate
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
</script>
|
|
41
|
+
<template>
|
|
42
|
+
<div class="mb-4">
|
|
43
|
+
<label for="parameterInput">{{ data.title }} <span
|
|
44
|
+
v-if="error"
|
|
45
|
+
class="text-red"
|
|
46
|
+
> {{ error }}</span></label>
|
|
47
|
+
<input
|
|
48
|
+
v-if="data.constraints && typeof data.constraints.min === 'number' && typeof data.constraints.max === 'number'"
|
|
49
|
+
id="parameterInput"
|
|
50
|
+
class="block appearance-none w-full py-1 px-2 mb-1 text-base leading-normal bg-white text-black dark:bg-gray-600 dark:text-gray-300text-grey-darker border border-grey rounded"
|
|
51
|
+
type="range"
|
|
52
|
+
:min="data.constraints.min || 0"
|
|
53
|
+
:max="data.constraints.max || 1"
|
|
54
|
+
:value="currentValue"
|
|
55
|
+
@change="validate($event)"
|
|
56
|
+
>
|
|
57
|
+
<input
|
|
58
|
+
v-else
|
|
59
|
+
id="parameterInput"
|
|
60
|
+
class="block appearance-none w-full py-1 px-2 mb-1 text-base leading-normal bg-white text-black dark:bg-gray-600 dark:text-gray-300 text-grey-darker border border-grey rounded"
|
|
61
|
+
type="range"
|
|
62
|
+
min="0"
|
|
63
|
+
max="1"
|
|
64
|
+
:value="currentValue"
|
|
65
|
+
@change="validate($event)"
|
|
66
|
+
>
|
|
67
|
+
<small
|
|
68
|
+
v-if="data.description"
|
|
69
|
+
class="block mt-1 text-grey"
|
|
70
|
+
>{{ data.description }}</small>
|
|
71
|
+
</div>
|
|
72
|
+
</template>
|
|
73
|
+
<style scoped>
|
|
74
|
+
</style>
|