@dv.net/docs-vitepress-openapi 1.0.7
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 +52 -0
- package/dist/docs-vitepress-openapi.client.cjs.js +1 -0
- package/dist/docs-vitepress-openapi.client.es.js +16 -0
- package/dist/docs-vitepress-openapi.css +1 -0
- package/dist/docs-vitepress-openapi.node.cjs.js +4102 -0
- package/dist/docs-vitepress-openapi.node.es.js +72981 -0
- package/dist/vanilla-picker-BAEwS4Fy.js +536 -0
- package/dist/vanilla-picker-m653iADl.cjs +8 -0
- package/package.json +80 -0
- package/src/client.ts +73 -0
- package/src/components/Common/Lazy/OALazy.vue +49 -0
- package/src/components/Common/Lazy/lazyBus.ts +8 -0
- package/src/components/Common/OACodeBlock.vue +91 -0
- package/src/components/Common/OACodeValue.vue +22 -0
- package/src/components/Common/OAHeaderBadges.vue +44 -0
- package/src/components/Common/OAHeading.vue +84 -0
- package/src/components/Common/OAInfo.vue +106 -0
- package/src/components/Common/OAIntroduction.vue +25 -0
- package/src/components/Common/OAJSONEditor.vue +41 -0
- package/src/components/Common/OAMarkdown.vue +28 -0
- package/src/components/Common/OAMethodBadge.vue +20 -0
- package/src/components/Common/OAServers.vue +42 -0
- package/src/components/Operation/OAOperation.vue +345 -0
- package/src/components/Operation/OAOperationTags.vue +30 -0
- package/src/components/Parameter/OAParameter.vue +80 -0
- package/src/components/Parameter/OAParameterAttribute.vue +44 -0
- package/src/components/Parameter/OAParameterExamples.vue +52 -0
- package/src/components/Parameter/OAParameters.vue +69 -0
- package/src/components/Path/OAPath.vue +347 -0
- package/src/components/Path/OAPathEndpoint.vue +99 -0
- package/src/components/Path/OAPaths.vue +62 -0
- package/src/components/Path/OAPathsByTag.vue +118 -0
- package/src/components/Path/OAPathsByTags.vue +99 -0
- package/src/components/Path/OAPathsSummary.vue +52 -0
- package/src/components/Playground/OAPlaygroundParameterInput.vue +97 -0
- package/src/components/Playground/OAPlaygroundParameters.vue +262 -0
- package/src/components/Playground/OAPlaygroundResponse.vue +74 -0
- package/src/components/Playground/OAPlaygroundSecurityInput.vue +44 -0
- package/src/components/Remote/OARemoteContext.vue +42 -0
- package/src/components/Remote/OARemoteOperation.vue +30 -0
- package/src/components/Remote/OARemoteRoot.vue +29 -0
- package/src/components/Remote/OARemoteSpec.vue +23 -0
- package/src/components/Request/OARequestBody.vue +24 -0
- package/src/components/Response/OAResponse.vue +81 -0
- package/src/components/Response/OAResponses.vue +119 -0
- package/src/components/Sample/OACodeSamples.vue +71 -0
- package/src/components/Schema/OASchemaPropertyAttributes.vue +44 -0
- package/src/components/Schema/OASchemaTabs.vue +90 -0
- package/src/components/Schema/OASchemaUI.vue +151 -0
- package/src/components/Security/OASecurity.vue +79 -0
- package/src/components/Security/OASecurityContent.vue +100 -0
- package/src/components/Spec/OASpec.vue +127 -0
- package/src/components/Spec/OASpecSkeleton.vue +26 -0
- package/src/components/Try/OATryItButton.vue +171 -0
- package/src/components/Try/OATryWithVariables.vue +105 -0
- package/src/components/index.ts +55 -0
- package/src/components/ui/badge/Badge.vue +18 -0
- package/src/components/ui/badge/index.ts +32 -0
- package/src/components/ui/button/Button.vue +28 -0
- package/src/components/ui/button/index.ts +37 -0
- package/src/components/ui/checkbox/Checkbox.vue +33 -0
- package/src/components/ui/checkbox/index.ts +1 -0
- package/src/components/ui/collapsible/Collapsible.vue +18 -0
- package/src/components/ui/collapsible/CollapsibleContent.vue +15 -0
- package/src/components/ui/collapsible/CollapsibleTrigger.vue +12 -0
- package/src/components/ui/collapsible/index.ts +3 -0
- package/src/components/ui/input/Input.vue +29 -0
- package/src/components/ui/input/index.ts +1 -0
- package/src/components/ui/label/Label.vue +29 -0
- package/src/components/ui/label/index.ts +1 -0
- package/src/components/ui/multiselect/Multiselect.vue +104 -0
- package/src/components/ui/select/Select.vue +15 -0
- package/src/components/ui/select/SelectContent.vue +56 -0
- package/src/components/ui/select/SelectGroup.vue +24 -0
- package/src/components/ui/select/SelectItem.vue +40 -0
- package/src/components/ui/select/SelectItemText.vue +12 -0
- package/src/components/ui/select/SelectLabel.vue +14 -0
- package/src/components/ui/select/SelectScrollDownButton.vue +29 -0
- package/src/components/ui/select/SelectScrollUpButton.vue +29 -0
- package/src/components/ui/select/SelectSeparator.vue +22 -0
- package/src/components/ui/select/SelectTrigger.vue +33 -0
- package/src/components/ui/select/SelectValue.vue +12 -0
- package/src/components/ui/select/index.ts +11 -0
- package/src/components/ui/tabs/Tabs.vue +15 -0
- package/src/components/ui/tabs/TabsContent.vue +24 -0
- package/src/components/ui/tabs/TabsList.vue +27 -0
- package/src/components/ui/tabs/TabsTrigger.vue +33 -0
- package/src/components/ui/tabs/index.ts +21 -0
- package/src/composables/useOpenapi.ts +70 -0
- package/src/composables/usePaths.ts +31 -0
- package/src/composables/usePlayground.ts +49 -0
- package/src/composables/useShiki.ts +46 -0
- package/src/composables/useSidebar.ts +301 -0
- package/src/composables/useTheme.ts +799 -0
- package/src/index.ts +8 -0
- package/src/json.css +251 -0
- package/src/lib/OpenApi.ts +254 -0
- package/src/lib/codeSamples/buildRequest.ts +149 -0
- package/src/lib/codeSamples/generateCodeSample.ts +20 -0
- package/src/lib/codeSamples/generateCodeSampleCurl.ts +150 -0
- package/src/lib/codeSamples/generateCodeSampleJavaScript.ts +29 -0
- package/src/lib/codeSamples/generateCodeSamplePhp.ts +50 -0
- package/src/lib/codeSamples/generateCodeSamplePython.ts +32 -0
- package/src/lib/codeSamples/request.ts +25 -0
- package/src/lib/constraintsParser.ts +30 -0
- package/src/lib/createOpenApiInstance.ts +18 -0
- package/src/lib/deepUnref.ts +76 -0
- package/src/lib/examples/getPropertyExample.ts +31 -0
- package/src/lib/examples/getPropertyExamples.ts +27 -0
- package/src/lib/examples/getSchemaExample.ts +38 -0
- package/src/lib/examples/getSchemaUiJson.ts +150 -0
- package/src/lib/examples/getSchemaUiXml.ts +9 -0
- package/src/lib/examples/hasExample.ts +26 -0
- package/src/lib/getOpenApiInstance.ts +39 -0
- package/src/lib/getSchemaUi.ts +280 -0
- package/src/lib/getSecurityUi.ts +33 -0
- package/src/lib/operationData.ts +24 -0
- package/src/lib/prepareOpenAPI/generateMissingOperationIds.ts +19 -0
- package/src/lib/prepareOpenAPI/generateMissingSummary.ts +20 -0
- package/src/lib/prepareOpenAPI/generateMissingTags.ts +36 -0
- package/src/lib/prepareOpenAPI/prepareOpenAPI.ts +35 -0
- package/src/lib/processOpenAPI.ts +131 -0
- package/src/lib/resolveCircularRef.ts +66 -0
- package/src/lib/sidebar/cleanSidebarItems.ts +19 -0
- package/src/lib/sidebar/ensureGroupTextSlashPrefix.ts +18 -0
- package/src/lib/sidebar/flatSidebarItems.ts +58 -0
- package/src/lib/sidebar/generateSidebarItemsByPaths.ts +132 -0
- package/src/lib/sidebar/mergeAdjacentGroups.ts +56 -0
- package/src/lib/sidebar/setItemCollapsedState.ts +15 -0
- package/src/lib/utils.ts +7 -0
- package/src/locales/en.json +50 -0
- package/src/locales/index.ts +4 -0
- package/src/style.css +180 -0
- package/src/types.ts +73 -0
- package/src/vite-env.d.ts +8 -0
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { VariantProps } from 'class-variance-authority'
|
|
2
|
+
import { cva } from 'class-variance-authority'
|
|
3
|
+
|
|
4
|
+
export { default as Badge } from './Badge.vue'
|
|
5
|
+
|
|
6
|
+
export const badgeVariants = cva(
|
|
7
|
+
'inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2',
|
|
8
|
+
{
|
|
9
|
+
variants: {
|
|
10
|
+
variant: {
|
|
11
|
+
default:
|
|
12
|
+
'border-transparent bg-primary text-primary-foreground hover:bg-primary/80',
|
|
13
|
+
secondary:
|
|
14
|
+
'border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80',
|
|
15
|
+
destructive:
|
|
16
|
+
'border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80',
|
|
17
|
+
outline: 'text-foreground bg-muted',
|
|
18
|
+
plain: 'border-transparent',
|
|
19
|
+
},
|
|
20
|
+
size: {
|
|
21
|
+
default: '',
|
|
22
|
+
xs: 'rounded px-1',
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
defaultVariants: {
|
|
26
|
+
variant: 'default',
|
|
27
|
+
size: 'default',
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
export type BadgeVariants = VariantProps<typeof badgeVariants>
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { PrimitiveProps } from 'radix-vue'
|
|
3
|
+
import type { HTMLAttributes } from 'vue'
|
|
4
|
+
import type { ButtonVariants } from './index'
|
|
5
|
+
import { Primitive } from 'radix-vue'
|
|
6
|
+
import { cn } from '../../../lib/utils'
|
|
7
|
+
import { buttonVariants } from './index'
|
|
8
|
+
|
|
9
|
+
interface Props extends PrimitiveProps {
|
|
10
|
+
variant?: ButtonVariants['variant']
|
|
11
|
+
size?: ButtonVariants['size']
|
|
12
|
+
class?: HTMLAttributes['class']
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
16
|
+
as: 'button',
|
|
17
|
+
})
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
<template>
|
|
21
|
+
<Primitive
|
|
22
|
+
:as="as"
|
|
23
|
+
:as-child="asChild"
|
|
24
|
+
:class="cn(buttonVariants({ variant, size }), props.class)"
|
|
25
|
+
>
|
|
26
|
+
<slot />
|
|
27
|
+
</Primitive>
|
|
28
|
+
</template>
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { VariantProps } from 'class-variance-authority'
|
|
2
|
+
import { cva } from 'class-variance-authority'
|
|
3
|
+
|
|
4
|
+
export { default as Button } from './Button.vue'
|
|
5
|
+
|
|
6
|
+
export const buttonVariants = cva(
|
|
7
|
+
'inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50',
|
|
8
|
+
{
|
|
9
|
+
variants: {
|
|
10
|
+
variant: {
|
|
11
|
+
default: 'bg-muted',
|
|
12
|
+
primary: 'bg-primary text-primary-foreground hover:bg-primary/90',
|
|
13
|
+
destructive:
|
|
14
|
+
'bg-destructive text-destructive-foreground hover:bg-destructive/90',
|
|
15
|
+
outline:
|
|
16
|
+
'border border-input bg-background hover:bg-accent hover:text-accent-foreground',
|
|
17
|
+
secondary:
|
|
18
|
+
'bg-secondary text-secondary-foreground hover:bg-secondary/80',
|
|
19
|
+
ghost: 'hover:bg-accent hover:text-accent-foreground',
|
|
20
|
+
link: 'text-primary underline-offset-4 hover:underline',
|
|
21
|
+
},
|
|
22
|
+
size: {
|
|
23
|
+
default: 'h-10 px-4 py-2',
|
|
24
|
+
xs: 'h-7 rounded px-2',
|
|
25
|
+
sm: 'h-9 rounded-md px-3',
|
|
26
|
+
lg: 'h-11 rounded-md px-8',
|
|
27
|
+
icon: 'h-10 w-10',
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
defaultVariants: {
|
|
31
|
+
variant: 'default',
|
|
32
|
+
size: 'default',
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
export type ButtonVariants = VariantProps<typeof buttonVariants>
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { CheckboxRootEmits, CheckboxRootProps } from 'radix-vue'
|
|
3
|
+
import type { HTMLAttributes } from 'vue'
|
|
4
|
+
import { Check } from 'lucide-vue-next'
|
|
5
|
+
import { CheckboxIndicator, CheckboxRoot, useForwardPropsEmits } from 'radix-vue'
|
|
6
|
+
import { computed } from 'vue'
|
|
7
|
+
import { cn } from '../../../lib/utils'
|
|
8
|
+
|
|
9
|
+
const props = defineProps<CheckboxRootProps & { class?: HTMLAttributes['class'] }>()
|
|
10
|
+
const emits = defineEmits<CheckboxRootEmits>()
|
|
11
|
+
|
|
12
|
+
const delegatedProps = computed(() => {
|
|
13
|
+
const { class: _, ...delegated } = props
|
|
14
|
+
|
|
15
|
+
return delegated
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
const forwarded = useForwardPropsEmits(delegatedProps, emits)
|
|
19
|
+
</script>
|
|
20
|
+
|
|
21
|
+
<template>
|
|
22
|
+
<CheckboxRoot
|
|
23
|
+
v-bind="forwarded"
|
|
24
|
+
:class="
|
|
25
|
+
cn('peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground data-[state=unchecked]:bg-white data-[state=unchecked]:border-solid data-[state=unchecked]:dark:bg-gray-600', props.class)"
|
|
26
|
+
>
|
|
27
|
+
<CheckboxIndicator class="flex h-full w-full items-center justify-center text-current">
|
|
28
|
+
<slot>
|
|
29
|
+
<Check class="h-4 w-4" />
|
|
30
|
+
</slot>
|
|
31
|
+
</CheckboxIndicator>
|
|
32
|
+
</CheckboxRoot>
|
|
33
|
+
</template>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Checkbox } from './Checkbox.vue'
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { CollapsibleRootEmits, CollapsibleRootProps } from 'radix-vue'
|
|
3
|
+
import { CollapsibleRoot, useForwardPropsEmits } from 'radix-vue'
|
|
4
|
+
|
|
5
|
+
const props = defineProps<CollapsibleRootProps>()
|
|
6
|
+
const emits = defineEmits<CollapsibleRootEmits>()
|
|
7
|
+
|
|
8
|
+
const forwarded = useForwardPropsEmits(props, emits)
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
<template>
|
|
12
|
+
<CollapsibleRoot
|
|
13
|
+
v-slot="{ open }"
|
|
14
|
+
v-bind="forwarded"
|
|
15
|
+
>
|
|
16
|
+
<slot :open="open" />
|
|
17
|
+
</CollapsibleRoot>
|
|
18
|
+
</template>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { CollapsibleContentProps } from 'radix-vue'
|
|
3
|
+
import { CollapsibleContent } from 'radix-vue'
|
|
4
|
+
|
|
5
|
+
const props = defineProps<CollapsibleContentProps>()
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<template>
|
|
9
|
+
<CollapsibleContent
|
|
10
|
+
v-bind="props"
|
|
11
|
+
class="overflow-hidden transition-all data-[state=closed]:animate-collapsible-up data-[state=open]:animate-collapsible-down"
|
|
12
|
+
>
|
|
13
|
+
<slot />
|
|
14
|
+
</CollapsibleContent>
|
|
15
|
+
</template>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { CollapsibleTriggerProps } from 'radix-vue'
|
|
3
|
+
import { CollapsibleTrigger } from 'radix-vue'
|
|
4
|
+
|
|
5
|
+
const props = defineProps<CollapsibleTriggerProps>()
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<template>
|
|
9
|
+
<CollapsibleTrigger v-bind="props">
|
|
10
|
+
<slot />
|
|
11
|
+
</CollapsibleTrigger>
|
|
12
|
+
</template>
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { HTMLAttributes } from 'vue'
|
|
3
|
+
import { useVModel } from '@vueuse/core'
|
|
4
|
+
import { cn } from '../../../lib/utils'
|
|
5
|
+
|
|
6
|
+
const props = defineProps<{
|
|
7
|
+
defaultValue?: string | number
|
|
8
|
+
modelValue?: string | number
|
|
9
|
+
class?: HTMLAttributes['class']
|
|
10
|
+
type?: string
|
|
11
|
+
}>()
|
|
12
|
+
|
|
13
|
+
const emits = defineEmits<{
|
|
14
|
+
(e: 'update:modelValue', payload: string | number): void
|
|
15
|
+
}>()
|
|
16
|
+
|
|
17
|
+
const modelValue = useVModel(props, 'modelValue', emits, {
|
|
18
|
+
passive: true,
|
|
19
|
+
defaultValue: props.defaultValue,
|
|
20
|
+
})
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
<template>
|
|
24
|
+
<input
|
|
25
|
+
v-model="modelValue"
|
|
26
|
+
:type="props.type ?? 'text'"
|
|
27
|
+
:class="cn('flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50', props.class)"
|
|
28
|
+
>
|
|
29
|
+
</template>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Input } from './Input.vue'
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { LabelProps } from 'radix-vue'
|
|
3
|
+
import type { HTMLAttributes } from 'vue'
|
|
4
|
+
import { Label } from 'radix-vue'
|
|
5
|
+
import { computed } from 'vue'
|
|
6
|
+
import { cn } from '../../../lib/utils'
|
|
7
|
+
|
|
8
|
+
const props = defineProps<LabelProps & { class?: HTMLAttributes['class'] }>()
|
|
9
|
+
|
|
10
|
+
const delegatedProps = computed(() => {
|
|
11
|
+
const { class: _, ...delegated } = props
|
|
12
|
+
|
|
13
|
+
return delegated
|
|
14
|
+
})
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
<template>
|
|
18
|
+
<Label
|
|
19
|
+
v-bind="delegatedProps"
|
|
20
|
+
:class="
|
|
21
|
+
cn(
|
|
22
|
+
'text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70',
|
|
23
|
+
props.class,
|
|
24
|
+
)
|
|
25
|
+
"
|
|
26
|
+
>
|
|
27
|
+
<slot />
|
|
28
|
+
</Label>
|
|
29
|
+
</template>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Label } from './Label.vue'
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { defineEmits, defineProps, onMounted, onUnmounted, ref } from 'vue'
|
|
3
|
+
import { getPropertyExample } from '../../../lib/examples/getPropertyExample'
|
|
4
|
+
|
|
5
|
+
const props = defineProps({
|
|
6
|
+
parameter: {
|
|
7
|
+
type: Object,
|
|
8
|
+
required: true,
|
|
9
|
+
},
|
|
10
|
+
modelValue: {
|
|
11
|
+
type: Array<string>,
|
|
12
|
+
required: true,
|
|
13
|
+
},
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
const emits = defineEmits([
|
|
17
|
+
'update:modelValue',
|
|
18
|
+
])
|
|
19
|
+
|
|
20
|
+
const dropdownOpen = ref(false)
|
|
21
|
+
const dropdownRef = ref<HTMLElement>()
|
|
22
|
+
|
|
23
|
+
const toggleValue = (val: string) => {
|
|
24
|
+
if (props.modelValue?.includes(val)) {
|
|
25
|
+
removeValue(val)
|
|
26
|
+
return
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const arr = Array.isArray(props.modelValue) ? [...props.modelValue] : []
|
|
30
|
+
arr.push(String(val))
|
|
31
|
+
emits('update:modelValue', arr)
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const removeValue = (val: string) => {
|
|
35
|
+
let arr = Array.isArray(props.modelValue) ? [...props.modelValue] : []
|
|
36
|
+
arr = arr.filter(v => v !== val)
|
|
37
|
+
emits('update:modelValue', arr)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const onClickOutside = (event: MouseEvent) => {
|
|
41
|
+
if (event.target !== dropdownRef.value) {
|
|
42
|
+
dropdownOpen.value = false
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
onMounted(() => {
|
|
47
|
+
document.addEventListener('click', onClickOutside)
|
|
48
|
+
})
|
|
49
|
+
onUnmounted(() => {
|
|
50
|
+
document.removeEventListener('click', onClickOutside)
|
|
51
|
+
})
|
|
52
|
+
</script>
|
|
53
|
+
|
|
54
|
+
<template>
|
|
55
|
+
<div class="relative">
|
|
56
|
+
<div
|
|
57
|
+
ref="dropdownRef"
|
|
58
|
+
class="bg-muted rounded gap-1 cursor-pointer min-h-10 flex items-center flex-wrap px-3 py-2 select-none"
|
|
59
|
+
@click.stop="dropdownOpen = !dropdownOpen"
|
|
60
|
+
>
|
|
61
|
+
<span v-if="!Array.isArray(modelValue) || !modelValue.length" class="text-sm" style="color: #98989F;">
|
|
62
|
+
{{ getPropertyExample(props.parameter) ?? $t('Select...') }}
|
|
63
|
+
</span>
|
|
64
|
+
|
|
65
|
+
<span
|
|
66
|
+
v-for="val in modelValue"
|
|
67
|
+
:key="val"
|
|
68
|
+
class="bg-accent text-accent-foreground rounded text-sm flex items-center"
|
|
69
|
+
@click.stop="removeValue(val)"
|
|
70
|
+
>
|
|
71
|
+
{{ val }}
|
|
72
|
+
<button type="button" class="ml-1 text-sm">×</button>
|
|
73
|
+
</span>
|
|
74
|
+
|
|
75
|
+
<span class="ml-auto">
|
|
76
|
+
<svg
|
|
77
|
+
xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"
|
|
78
|
+
stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"
|
|
79
|
+
class="lucide lucide-chevron-down-icon w-4 h-4 opacity-50" aria-hidden="true"
|
|
80
|
+
>
|
|
81
|
+
<path d="m6 9 6 6 6-6" />
|
|
82
|
+
</svg>
|
|
83
|
+
</span>
|
|
84
|
+
</div>
|
|
85
|
+
|
|
86
|
+
<div
|
|
87
|
+
v-if="dropdownOpen"
|
|
88
|
+
class="absolute z-50 mt-1 w-full bg-popover border rounded shadow-md max-h-48 overflow-auto"
|
|
89
|
+
>
|
|
90
|
+
<div
|
|
91
|
+
v-for="enumValue in parameter.schema.items.enum" :key="enumValue"
|
|
92
|
+
class="px-1.5 py-1 cursor-pointer hover:bg-accent flex items-center text-sm select-none"
|
|
93
|
+
:class="{ 'bg-accent text-accent-foreground': Array.isArray(modelValue) && modelValue.includes(String(enumValue)) }"
|
|
94
|
+
@click.stop="toggleValue(enumValue)"
|
|
95
|
+
>
|
|
96
|
+
<input
|
|
97
|
+
type="checkbox" class="mr-2"
|
|
98
|
+
:checked="Array.isArray(modelValue) && modelValue.includes(String(enumValue))" readonly
|
|
99
|
+
>
|
|
100
|
+
{{ enumValue }}
|
|
101
|
+
</div>
|
|
102
|
+
</div>
|
|
103
|
+
</div>
|
|
104
|
+
</template>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { SelectRootEmits, SelectRootProps } from 'radix-vue'
|
|
3
|
+
import { SelectRoot, useForwardPropsEmits } from 'radix-vue'
|
|
4
|
+
|
|
5
|
+
const props = defineProps<SelectRootProps>()
|
|
6
|
+
const emits = defineEmits<SelectRootEmits>()
|
|
7
|
+
|
|
8
|
+
const forwarded = useForwardPropsEmits(props, emits)
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
<template>
|
|
12
|
+
<SelectRoot v-bind="forwarded">
|
|
13
|
+
<slot />
|
|
14
|
+
</SelectRoot>
|
|
15
|
+
</template>
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { SelectContentEmits, SelectContentProps } from 'radix-vue'
|
|
3
|
+
import type { HTMLAttributes } from 'vue'
|
|
4
|
+
import {
|
|
5
|
+
SelectContent,
|
|
6
|
+
|
|
7
|
+
SelectPortal,
|
|
8
|
+
SelectViewport,
|
|
9
|
+
useForwardPropsEmits,
|
|
10
|
+
} from 'radix-vue'
|
|
11
|
+
import { computed } from 'vue'
|
|
12
|
+
import { SelectScrollDownButton, SelectScrollUpButton } from '.'
|
|
13
|
+
import { cn } from '../../../lib/utils'
|
|
14
|
+
|
|
15
|
+
defineOptions({
|
|
16
|
+
inheritAttrs: false,
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
const props = withDefaults(
|
|
20
|
+
defineProps<SelectContentProps & { class?: HTMLAttributes['class'] }>(),
|
|
21
|
+
{
|
|
22
|
+
position: 'popper',
|
|
23
|
+
bodyLock: false,
|
|
24
|
+
},
|
|
25
|
+
)
|
|
26
|
+
const emits = defineEmits<SelectContentEmits>()
|
|
27
|
+
|
|
28
|
+
const delegatedProps = computed(() => {
|
|
29
|
+
const { class: _, ...delegated } = props
|
|
30
|
+
|
|
31
|
+
return delegated
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
const forwarded = useForwardPropsEmits(delegatedProps, emits)
|
|
35
|
+
</script>
|
|
36
|
+
|
|
37
|
+
<template>
|
|
38
|
+
<SelectPortal>
|
|
39
|
+
<SelectContent
|
|
40
|
+
v-bind="{ ...forwarded, ...$attrs }"
|
|
41
|
+
:class="cn(
|
|
42
|
+
'relative z-50 max-h-96 min-w-32 overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2',
|
|
43
|
+
position === 'popper'
|
|
44
|
+
&& 'data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1',
|
|
45
|
+
props.class,
|
|
46
|
+
)
|
|
47
|
+
"
|
|
48
|
+
>
|
|
49
|
+
<SelectScrollUpButton />
|
|
50
|
+
<SelectViewport :class="cn('p-1', position === 'popper' && 'h-[--radix-select-trigger-height] w-full min-w-[--radix-select-trigger-width]')">
|
|
51
|
+
<slot />
|
|
52
|
+
</SelectViewport>
|
|
53
|
+
<SelectScrollDownButton />
|
|
54
|
+
</SelectContent>
|
|
55
|
+
</SelectPortal>
|
|
56
|
+
</template>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { SelectGroupProps } from 'radix-vue'
|
|
3
|
+
import type { HTMLAttributes } from 'vue'
|
|
4
|
+
import { SelectGroup } from 'radix-vue'
|
|
5
|
+
import { computed } from 'vue'
|
|
6
|
+
import { cn } from '../../../lib/utils'
|
|
7
|
+
|
|
8
|
+
const props = defineProps<SelectGroupProps & { class?: HTMLAttributes['class'] }>()
|
|
9
|
+
|
|
10
|
+
const delegatedProps = computed(() => {
|
|
11
|
+
const { class: _, ...delegated } = props
|
|
12
|
+
|
|
13
|
+
return delegated
|
|
14
|
+
})
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
<template>
|
|
18
|
+
<SelectGroup
|
|
19
|
+
:class="cn('p-1 w-full', props.class)"
|
|
20
|
+
v-bind="delegatedProps"
|
|
21
|
+
>
|
|
22
|
+
<slot />
|
|
23
|
+
</SelectGroup>
|
|
24
|
+
</template>
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { SelectItemProps } from 'radix-vue'
|
|
3
|
+
import type { HTMLAttributes } from 'vue'
|
|
4
|
+
import { Check } from 'lucide-vue-next'
|
|
5
|
+
import { SelectItem, SelectItemIndicator, SelectItemText, useForwardProps } from 'radix-vue'
|
|
6
|
+
import { computed } from 'vue'
|
|
7
|
+
import { cn } from '../../../lib/utils'
|
|
8
|
+
|
|
9
|
+
const props = defineProps<SelectItemProps & { class?: HTMLAttributes['class'] }>()
|
|
10
|
+
|
|
11
|
+
const delegatedProps = computed(() => {
|
|
12
|
+
const { class: _, ...delegated } = props
|
|
13
|
+
|
|
14
|
+
return delegated
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
const forwardedProps = useForwardProps(delegatedProps)
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
<template>
|
|
21
|
+
<SelectItem
|
|
22
|
+
v-bind="forwardedProps"
|
|
23
|
+
:class="
|
|
24
|
+
cn(
|
|
25
|
+
'relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50',
|
|
26
|
+
props.class,
|
|
27
|
+
)
|
|
28
|
+
"
|
|
29
|
+
>
|
|
30
|
+
<span class="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
|
|
31
|
+
<SelectItemIndicator>
|
|
32
|
+
<Check class="h-4 w-4" />
|
|
33
|
+
</SelectItemIndicator>
|
|
34
|
+
</span>
|
|
35
|
+
|
|
36
|
+
<SelectItemText>
|
|
37
|
+
<slot />
|
|
38
|
+
</SelectItemText>
|
|
39
|
+
</SelectItem>
|
|
40
|
+
</template>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { SelectItemTextProps } from 'radix-vue'
|
|
3
|
+
import { SelectItemText } from 'radix-vue'
|
|
4
|
+
|
|
5
|
+
const props = defineProps<SelectItemTextProps>()
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<template>
|
|
9
|
+
<SelectItemText v-bind="props">
|
|
10
|
+
<slot />
|
|
11
|
+
</SelectItemText>
|
|
12
|
+
</template>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { SelectLabelProps } from 'radix-vue'
|
|
3
|
+
import type { HTMLAttributes } from 'vue'
|
|
4
|
+
import { SelectLabel } from 'radix-vue'
|
|
5
|
+
import { cn } from '../../../lib/utils'
|
|
6
|
+
|
|
7
|
+
const props = defineProps<SelectLabelProps & { class?: HTMLAttributes['class'] }>()
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<template>
|
|
11
|
+
<SelectLabel :class="cn('py-1.5 pl-8 pr-2 text-sm font-semibold', props.class)">
|
|
12
|
+
<slot />
|
|
13
|
+
</SelectLabel>
|
|
14
|
+
</template>
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { SelectScrollDownButtonProps } from 'radix-vue'
|
|
3
|
+
import type { HTMLAttributes } from 'vue'
|
|
4
|
+
import { ChevronDown } from 'lucide-vue-next'
|
|
5
|
+
import { SelectScrollDownButton, useForwardProps } from 'radix-vue'
|
|
6
|
+
import { computed } from 'vue'
|
|
7
|
+
import { cn } from '../../../lib/utils'
|
|
8
|
+
|
|
9
|
+
const props = defineProps<SelectScrollDownButtonProps & { class?: HTMLAttributes['class'] }>()
|
|
10
|
+
|
|
11
|
+
const delegatedProps = computed(() => {
|
|
12
|
+
const { class: _, ...delegated } = props
|
|
13
|
+
|
|
14
|
+
return delegated
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
const forwardedProps = useForwardProps(delegatedProps)
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
<template>
|
|
21
|
+
<SelectScrollDownButton
|
|
22
|
+
v-bind="forwardedProps"
|
|
23
|
+
:class="cn('flex cursor-default items-center justify-center py-1', props.class)"
|
|
24
|
+
>
|
|
25
|
+
<slot>
|
|
26
|
+
<ChevronDown class="h-4 w-4" />
|
|
27
|
+
</slot>
|
|
28
|
+
</SelectScrollDownButton>
|
|
29
|
+
</template>
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { SelectScrollUpButtonProps } from 'radix-vue'
|
|
3
|
+
import type { HTMLAttributes } from 'vue'
|
|
4
|
+
import { ChevronUp } from 'lucide-vue-next'
|
|
5
|
+
import { SelectScrollUpButton, useForwardProps } from 'radix-vue'
|
|
6
|
+
import { computed } from 'vue'
|
|
7
|
+
import { cn } from '../../../lib/utils'
|
|
8
|
+
|
|
9
|
+
const props = defineProps<SelectScrollUpButtonProps & { class?: HTMLAttributes['class'] }>()
|
|
10
|
+
|
|
11
|
+
const delegatedProps = computed(() => {
|
|
12
|
+
const { class: _, ...delegated } = props
|
|
13
|
+
|
|
14
|
+
return delegated
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
const forwardedProps = useForwardProps(delegatedProps)
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
<template>
|
|
21
|
+
<SelectScrollUpButton
|
|
22
|
+
v-bind="forwardedProps"
|
|
23
|
+
:class="cn('flex cursor-default items-center justify-center py-1', props.class)"
|
|
24
|
+
>
|
|
25
|
+
<slot>
|
|
26
|
+
<ChevronUp class="h-4 w-4" />
|
|
27
|
+
</slot>
|
|
28
|
+
</SelectScrollUpButton>
|
|
29
|
+
</template>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { SelectSeparatorProps } from 'radix-vue'
|
|
3
|
+
import type { HTMLAttributes } from 'vue'
|
|
4
|
+
import { SelectSeparator } from 'radix-vue'
|
|
5
|
+
import { computed } from 'vue'
|
|
6
|
+
import { cn } from '../../../lib/utils'
|
|
7
|
+
|
|
8
|
+
const props = defineProps<SelectSeparatorProps & { class?: HTMLAttributes['class'] }>()
|
|
9
|
+
|
|
10
|
+
const delegatedProps = computed(() => {
|
|
11
|
+
const { class: _, ...delegated } = props
|
|
12
|
+
|
|
13
|
+
return delegated
|
|
14
|
+
})
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
<template>
|
|
18
|
+
<SelectSeparator
|
|
19
|
+
v-bind="delegatedProps"
|
|
20
|
+
:class="cn('-mx-1 my-1 h-px bg-muted', props.class)"
|
|
21
|
+
/>
|
|
22
|
+
</template>
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { SelectTriggerProps } from 'radix-vue'
|
|
3
|
+
import type { HTMLAttributes } from 'vue'
|
|
4
|
+
import { ChevronDown } from 'lucide-vue-next'
|
|
5
|
+
import { SelectIcon, SelectTrigger, useForwardProps } from 'radix-vue'
|
|
6
|
+
import { computed } from 'vue'
|
|
7
|
+
import { cn } from '../../../lib/utils'
|
|
8
|
+
|
|
9
|
+
const props = defineProps<SelectTriggerProps & { class?: HTMLAttributes['class'] }>()
|
|
10
|
+
|
|
11
|
+
const delegatedProps = computed(() => {
|
|
12
|
+
const { class: _, ...delegated } = props
|
|
13
|
+
|
|
14
|
+
return delegated
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
const forwardedProps = useForwardProps(delegatedProps)
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
<template>
|
|
21
|
+
<SelectTrigger
|
|
22
|
+
v-bind="forwardedProps"
|
|
23
|
+
:class="cn(
|
|
24
|
+
'flex h-10 w-full items-center justify-between rounded-md border border-input bg-muted px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1',
|
|
25
|
+
props.class,
|
|
26
|
+
)"
|
|
27
|
+
>
|
|
28
|
+
<slot />
|
|
29
|
+
<SelectIcon as-child>
|
|
30
|
+
<ChevronDown class="w-4 h-4 opacity-50" />
|
|
31
|
+
</SelectIcon>
|
|
32
|
+
</SelectTrigger>
|
|
33
|
+
</template>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { SelectValueProps } from 'radix-vue'
|
|
3
|
+
import { SelectValue } from 'radix-vue'
|
|
4
|
+
|
|
5
|
+
const props = defineProps<SelectValueProps>()
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<template>
|
|
9
|
+
<SelectValue v-bind="props">
|
|
10
|
+
<slot />
|
|
11
|
+
</SelectValue>
|
|
12
|
+
</template>
|