@veltra/desktop 1.1.2 → 1.1.4
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/dist/components/action/action-group.vue.d.ts +1 -1
- package/dist/components/action/action.vue.d.ts +1 -1
- package/dist/components/auto-complete/auto-complete.js +1 -2
- package/dist/components/auto-complete/auto-complete.js.map +1 -1
- package/dist/components/cascade/cascade.js +1 -2
- package/dist/components/cascade/cascade.js.map +1 -1
- package/dist/components/cascade/cascade.vue.d.ts +2 -2
- package/dist/components/checkbox/checkbox-button.js +1 -2
- package/dist/components/checkbox/checkbox-button.js.map +1 -1
- package/dist/components/checkbox/checkbox-button.vue.d.ts +1 -1
- package/dist/components/checkbox/checkbox.js +1 -2
- package/dist/components/checkbox/checkbox.js.map +1 -1
- package/dist/components/checkbox-group/checkbox-group.js +1 -2
- package/dist/components/checkbox-group/checkbox-group.js.map +1 -1
- package/dist/components/checkbox-group/checkbox-group.vue.d.ts +2 -2
- package/dist/components/code-editor/code-editor.js +1 -2
- package/dist/components/code-editor/code-editor.js.map +1 -1
- package/dist/components/date-picker/date-picker.js +1 -2
- package/dist/components/date-picker/date-picker.js.map +1 -1
- package/dist/components/date-picker/date-picker.vue.d.ts +1 -1
- package/dist/components/date-range-picker/date-range-picker.js +1 -2
- package/dist/components/date-range-picker/date-range-picker.js.map +1 -1
- package/dist/components/date-range-picker/date-range-picker.vue.d.ts +1 -1
- package/dist/components/dialog/style2.css +1 -1
- package/dist/components/expression-editor/expression-editor.js +1 -2
- package/dist/components/expression-editor/expression-editor.js.map +1 -1
- package/dist/components/expression-editor/style2.css +1 -0
- package/dist/components/form/form.js.map +1 -1
- package/dist/components/form/form.vue_vue_type_script_setup_true_lang.js +1 -2
- package/dist/components/form/form.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/form-item/form-item.js.map +1 -1
- package/dist/components/form-item/form-item.vue_vue_type_script_setup_true_lang.js +1 -2
- package/dist/components/form-item/form-item.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/group-input/group-input.js +2 -2
- package/dist/components/group-input/group-input.js.map +1 -1
- package/dist/components/group-input/style.js +1 -0
- package/dist/components/input/input.js.map +1 -1
- package/dist/components/input/input.vue_vue_type_script_setup_true_lang.js +1 -2
- package/dist/components/input/input.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/multi-select/multi-select-option.js +19 -14
- package/dist/components/multi-select/multi-select-option.js.map +1 -1
- package/dist/components/multi-select/multi-select.js +1 -2
- package/dist/components/multi-select/multi-select.js.map +1 -1
- package/dist/components/multi-select/multi-select.vue.d.ts +2 -2
- package/dist/components/multi-tree-select/multi-tree-select.js +1 -2
- package/dist/components/multi-tree-select/multi-tree-select.js.map +1 -1
- package/dist/components/multi-tree-select/multi-tree-select.vue.d.ts +2 -2
- package/dist/components/number/number.vue.d.ts +1 -1
- package/dist/components/number-input/number-input.js +1 -2
- package/dist/components/number-input/number-input.js.map +1 -1
- package/dist/components/number-range-input/number-range-input.js +1 -2
- package/dist/components/number-range-input/number-range-input.js.map +1 -1
- package/dist/components/number-range-input/style2.css +1 -0
- package/dist/components/palette/palette.js +1 -2
- package/dist/components/palette/palette.js.map +1 -1
- package/dist/components/password-input/password-input.js +1 -2
- package/dist/components/password-input/password-input.js.map +1 -1
- package/dist/components/pop-confirm/pop-confirm.js +1 -2
- package/dist/components/pop-confirm/pop-confirm.js.map +1 -1
- package/dist/components/pop-confirm/pop-confirm.vue.d.ts +1 -1
- package/dist/components/radio/radio.js +1 -2
- package/dist/components/radio/radio.js.map +1 -1
- package/dist/components/radio-group/radio-group.js +1 -2
- package/dist/components/radio-group/radio-group.js.map +1 -1
- package/dist/components/radio-group/radio-group.vue.d.ts +2 -2
- package/dist/components/rich-text-editor/rich-text-editor.js +1 -2
- package/dist/components/rich-text-editor/rich-text-editor.js.map +1 -1
- package/dist/components/select/select.js +1 -2
- package/dist/components/select/select.js.map +1 -1
- package/dist/components/select/select.vue.d.ts +2 -2
- package/dist/components/slider/slider.js +1 -2
- package/dist/components/slider/slider.js.map +1 -1
- package/dist/components/switch/switch.js +1 -2
- package/dist/components/switch/switch.js.map +1 -1
- package/dist/components/tabs/tabs-horizontal.vue.d.ts +1 -1
- package/dist/components/tabs/tabs.vue.d.ts +1 -1
- package/dist/components/tag/tag.js +1 -2
- package/dist/components/tag/tag.js.map +1 -1
- package/dist/components/textarea/textarea.js +1 -2
- package/dist/components/textarea/textarea.js.map +1 -1
- package/dist/components/textarea/textarea.vue.d.ts +1 -1
- package/dist/components/tip/tip.vue.d.ts +1 -1
- package/dist/components/tree/tree.js +1 -2
- package/dist/components/tree/tree.js.map +1 -1
- package/dist/components/tree-select/tree-select.js +1 -2
- package/dist/components/tree-select/tree-select.js.map +1 -1
- package/dist/components/tree-select/tree-select.vue.d.ts +2 -2
- package/package.json +11 -11
- package/src/components/auto-complete/auto-complete.vue +1 -1
- package/src/components/cascade/cascade.vue +1 -1
- package/src/components/checkbox/checkbox-button.vue +1 -1
- package/src/components/checkbox/checkbox.vue +1 -1
- package/src/components/checkbox-group/checkbox-group.vue +1 -1
- package/src/components/code-editor/code-editor.vue +1 -1
- package/src/components/date-picker/date-picker.vue +1 -1
- package/src/components/date-range-picker/date-range-picker.vue +1 -1
- package/src/components/dialog/style.scss +1 -1
- package/src/components/expression-editor/expression-editor.vue +1 -1
- package/src/components/expression-editor/style.scss +1 -0
- package/src/components/form/form.vue +1 -1
- package/src/components/form-item/form-item.vue +1 -1
- package/src/components/group-input/group-input.vue +9 -2
- package/src/components/group-input/style.ts +1 -0
- package/src/components/input/input.vue +1 -1
- package/src/components/multi-select/multi-select-option.vue +19 -13
- package/src/components/multi-select/multi-select.vue +1 -1
- package/src/components/multi-tree-select/multi-tree-select.vue +1 -1
- package/src/components/number-input/number-input.vue +1 -1
- package/src/components/number-range-input/number-range-input.vue +1 -1
- package/src/components/number-range-input/style.scss +1 -0
- package/src/components/palette/palette.vue +1 -1
- package/src/components/password-input/password-input.vue +1 -1
- package/src/components/pop-confirm/pop-confirm.vue +1 -1
- package/src/components/radio/radio.vue +1 -1
- package/src/components/radio-group/radio-group.vue +1 -1
- package/src/components/rich-text-editor/rich-text-editor.vue +1 -1
- package/src/components/select/select.vue +1 -1
- package/src/components/slider/slider.vue +1 -1
- package/src/components/switch/switch.vue +1 -1
- package/src/components/tag/tag.vue +1 -1
- package/src/components/textarea/textarea.vue +1 -1
- package/src/components/tree/tree.vue +1 -1
- package/src/components/tree-select/tree-select.vue +1 -1
- package/dist/utils/form-context.js +0 -17
- package/dist/utils/form-context.js.map +0 -1
- package/src/utils/form-context.ts +0 -24
|
@@ -31,6 +31,7 @@
|
|
|
31
31
|
<script lang="ts" setup>
|
|
32
32
|
import { useFormFallbackProps } from '@veltra/compositions'
|
|
33
33
|
import { bem } from '@veltra/utils'
|
|
34
|
+
import { injectFormContext } from '@veltra/utils'
|
|
34
35
|
import {
|
|
35
36
|
computed,
|
|
36
37
|
nextTick,
|
|
@@ -42,7 +43,6 @@ import {
|
|
|
42
43
|
} from 'vue'
|
|
43
44
|
|
|
44
45
|
import type { ExpressionEditorProps, VariableItem } from '../../types'
|
|
45
|
-
import { injectFormContext } from '../../utils/form-context'
|
|
46
46
|
import VariablePicker from './components/variable-picker.vue'
|
|
47
47
|
import { createEditor, type EditorAPI } from './core/editor'
|
|
48
48
|
import { createMention, type MentionAPI } from './core/mention'
|
|
@@ -32,10 +32,10 @@
|
|
|
32
32
|
<script lang="tsx" setup generic="Model extends FormModel | DynamicFormModel">
|
|
33
33
|
import { o } from '@cat-kit/core'
|
|
34
34
|
import { bem } from '@veltra/utils'
|
|
35
|
+
import { provideFormContext } from '@veltra/utils'
|
|
35
36
|
import { shallowRef, toRef } from 'vue'
|
|
36
37
|
|
|
37
38
|
import type { BreakCols, GridExposed, FormProps, _FormExposed } from '../../types'
|
|
38
|
-
import { provideFormContext } from '../../utils/form-context'
|
|
39
39
|
import { UFormItem } from '../form-item'
|
|
40
40
|
import { UGrid } from '../grid'
|
|
41
41
|
import type { DynamicFormModel } from './dynamic-form-model'
|
|
@@ -35,10 +35,10 @@
|
|
|
35
35
|
<script lang="tsx" setup>
|
|
36
36
|
import { useConfig, useFallbackProps } from '@veltra/compositions'
|
|
37
37
|
import { bem, withUnit } from '@veltra/utils'
|
|
38
|
+
import { injectFormContext } from '@veltra/utils'
|
|
38
39
|
import { type CSSProperties, computed } from 'vue'
|
|
39
40
|
|
|
40
41
|
import type { FormItemProps, ComponentSize } from '../../types'
|
|
41
|
-
import { injectFormContext } from '../../utils/form-context'
|
|
42
42
|
import { UGridItem } from '../grid'
|
|
43
43
|
import { UTip } from '../tip'
|
|
44
44
|
import { formItemCls as cls } from './helper'
|
|
@@ -15,7 +15,14 @@
|
|
|
15
15
|
:size="size"
|
|
16
16
|
@click="handleRemove(index)"
|
|
17
17
|
/>
|
|
18
|
-
<u-button
|
|
18
|
+
<u-button
|
|
19
|
+
:icon="Plus"
|
|
20
|
+
circle
|
|
21
|
+
:disabled="disabled"
|
|
22
|
+
:size="size"
|
|
23
|
+
type="primary"
|
|
24
|
+
@click="handleAdd(index)"
|
|
25
|
+
/>
|
|
19
26
|
</span>
|
|
20
27
|
</li>
|
|
21
28
|
</ul>
|
|
@@ -37,10 +44,10 @@
|
|
|
37
44
|
import { useFormFallbackProps } from '@veltra/compositions'
|
|
38
45
|
import { Minus, Plus } from '@veltra/icons/normal'
|
|
39
46
|
import { bem, FORM_EMPTY_CONTENT } from '@veltra/utils'
|
|
47
|
+
import { injectFormContext } from '@veltra/utils'
|
|
40
48
|
import { computed } from 'vue'
|
|
41
49
|
|
|
42
50
|
import type { GroupInputEmits, GroupInputProps } from '../../types'
|
|
43
|
-
import { injectFormContext } from '../../utils/form-context'
|
|
44
51
|
import { UButton } from '../button'
|
|
45
52
|
import { useGroupItems } from './use-group-items'
|
|
46
53
|
|
|
@@ -56,10 +56,10 @@
|
|
|
56
56
|
import { useFocus, useFormFallbackProps } from '@veltra/compositions'
|
|
57
57
|
import { Close } from '@veltra/icons/normal'
|
|
58
58
|
import { bem, FORM_EMPTY_CONTENT } from '@veltra/utils'
|
|
59
|
+
import { injectFormContext } from '@veltra/utils'
|
|
59
60
|
import { computed, getCurrentInstance, ref, shallowRef, nextTick } from 'vue'
|
|
60
61
|
|
|
61
62
|
import type { InputEmits, InputProps, _InputExposed } from '../../types'
|
|
62
|
-
import { injectFormContext } from '../../utils/form-context'
|
|
63
63
|
import { UIcon } from '../icon'
|
|
64
64
|
|
|
65
65
|
defineOptions({
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
|
|
22
22
|
<script lang="ts" setup>
|
|
23
23
|
import { Ripple } from '@veltra/directives'
|
|
24
|
-
import { inject, onBeforeUnmount } from 'vue'
|
|
24
|
+
import { inject, onBeforeUnmount, shallowRef } from 'vue'
|
|
25
25
|
|
|
26
26
|
import { UCheckbox } from '../checkbox'
|
|
27
27
|
import { MultiSelectDIKey } from './di'
|
|
@@ -43,8 +43,6 @@ const props = defineProps<{
|
|
|
43
43
|
measureElement?: (index: number, el: Element | null) => void
|
|
44
44
|
}>()
|
|
45
45
|
|
|
46
|
-
const { disabled = false, checked } = props
|
|
47
|
-
|
|
48
46
|
function measureRef(el: unknown) {
|
|
49
47
|
if (typeof props.index !== 'number' || !props.measureElement) return
|
|
50
48
|
props.measureElement(props.index, el as Element | null)
|
|
@@ -56,33 +54,41 @@ const emit = defineEmits<{
|
|
|
56
54
|
|
|
57
55
|
const { optionClass, rippleClass, checkboxClass } = inject(MultiSelectDIKey)!
|
|
58
56
|
|
|
59
|
-
|
|
57
|
+
const rippleRef = shallowRef<Ripple | null>(null)
|
|
60
58
|
|
|
61
59
|
function handleClick(e) {
|
|
62
|
-
if (disabled) return
|
|
63
|
-
emit('check', !checked)
|
|
60
|
+
if (props.disabled) return
|
|
61
|
+
emit('check', !props.checked)
|
|
64
62
|
}
|
|
65
63
|
|
|
66
64
|
function handleMousedown(e: MouseEvent) {
|
|
67
|
-
if (disabled) return
|
|
65
|
+
if (props.disabled) return
|
|
66
|
+
|
|
67
|
+
// 清理旧实例,避免同一元素上多个 Ripple 实例同时修改样式
|
|
68
|
+
if (rippleRef.value) {
|
|
69
|
+
rippleRef.value.remove()
|
|
70
|
+
rippleRef.value = null
|
|
71
|
+
}
|
|
68
72
|
|
|
69
|
-
|
|
73
|
+
rippleRef.value = new Ripple(e.currentTarget as HTMLElement, {
|
|
70
74
|
rippleClass
|
|
71
75
|
})
|
|
72
76
|
|
|
73
|
-
|
|
77
|
+
rippleRef.value.showByEvent(e)
|
|
74
78
|
}
|
|
75
79
|
|
|
76
80
|
function handleMouseleave() {
|
|
77
|
-
|
|
81
|
+
rippleRef.value?.remove()
|
|
82
|
+
rippleRef.value = null
|
|
78
83
|
}
|
|
79
84
|
|
|
80
85
|
function handleMouseup() {
|
|
81
|
-
|
|
86
|
+
rippleRef.value?.remove()
|
|
87
|
+
rippleRef.value = null
|
|
82
88
|
}
|
|
83
89
|
|
|
84
90
|
onBeforeUnmount(() => {
|
|
85
|
-
|
|
86
|
-
|
|
91
|
+
rippleRef.value?.remove()
|
|
92
|
+
rippleRef.value = null
|
|
87
93
|
})
|
|
88
94
|
</script>
|
|
@@ -143,6 +143,7 @@ import { o as chainObj } from '@cat-kit/core'
|
|
|
143
143
|
import { useFormFallbackProps, useVirtualizer } from '@veltra/compositions'
|
|
144
144
|
import { ArrowDown, Close, Search } from '@veltra/icons/normal'
|
|
145
145
|
import { bem, FORM_EMPTY_CONTENT } from '@veltra/utils'
|
|
146
|
+
import { injectFormContext } from '@veltra/utils'
|
|
146
147
|
import { computed, shallowRef, shallowReactive, watch, provide } from 'vue'
|
|
147
148
|
|
|
148
149
|
import type {
|
|
@@ -151,7 +152,6 @@ import type {
|
|
|
151
152
|
ScrollExposed,
|
|
152
153
|
DropdownExposed
|
|
153
154
|
} from '../../types'
|
|
154
|
-
import { injectFormContext } from '../../utils/form-context'
|
|
155
155
|
import { UCheckbox } from '../checkbox'
|
|
156
156
|
import { UDropdown } from '../dropdown'
|
|
157
157
|
import { UEmpty } from '../empty'
|
|
@@ -99,11 +99,11 @@ import { dfs, o } from '@cat-kit/core'
|
|
|
99
99
|
import { useFormFallbackProps } from '@veltra/compositions'
|
|
100
100
|
import { ArrowDown, Close, Search } from '@veltra/icons/normal'
|
|
101
101
|
import { bem, FORM_EMPTY_CONTENT } from '@veltra/utils'
|
|
102
|
+
import { injectFormContext } from '@veltra/utils'
|
|
102
103
|
import { computed, nextTick, shallowRef, watch } from 'vue'
|
|
103
104
|
|
|
104
105
|
import type { MultiTreeSelectProps, MultiTreeSelectEmits, TreeExposed } from '../../types'
|
|
105
106
|
import type { DropdownExposed } from '../../types'
|
|
106
|
-
import { injectFormContext } from '../../utils/form-context'
|
|
107
107
|
import { UButton } from '../button'
|
|
108
108
|
import { UCheckbox } from '../checkbox'
|
|
109
109
|
import { UDropdown } from '../dropdown'
|
|
@@ -67,10 +67,10 @@ import { useFormFallbackProps } from '@veltra/compositions'
|
|
|
67
67
|
import { vRipple } from '@veltra/directives'
|
|
68
68
|
import { ArrowDown, ArrowUp, Close } from '@veltra/icons/normal'
|
|
69
69
|
import { bem, FORM_EMPTY_CONTENT, Tween } from '@veltra/utils'
|
|
70
|
+
import { injectFormContext } from '@veltra/utils'
|
|
70
71
|
import { computed, shallowRef, watch } from 'vue'
|
|
71
72
|
|
|
72
73
|
import type { NumberInputEmits, NumberInputProps, InputExposed } from '../../types'
|
|
73
|
-
import { injectFormContext } from '../../utils/form-context'
|
|
74
74
|
import { UIcon } from '../icon'
|
|
75
75
|
import { UInput } from '../input'
|
|
76
76
|
|
|
@@ -30,10 +30,10 @@
|
|
|
30
30
|
import { n, $n, o } from '@cat-kit/core'
|
|
31
31
|
import { useFormFallbackProps } from '@veltra/compositions'
|
|
32
32
|
import { bem, FORM_EMPTY_CONTENT } from '@veltra/utils'
|
|
33
|
+
import { injectFormContext } from '@veltra/utils'
|
|
33
34
|
import { computed, getCurrentInstance, nextTick, onMounted, watch } from 'vue'
|
|
34
35
|
|
|
35
36
|
import type { NumberRangeInputEmits, NumberRangeInputProps, NumberRangeTuple } from '../../types'
|
|
36
|
-
import { injectFormContext } from '../../utils/form-context'
|
|
37
37
|
import { UNumberInput } from '../number-input'
|
|
38
38
|
|
|
39
39
|
defineOptions({
|
|
@@ -26,10 +26,10 @@
|
|
|
26
26
|
<script lang="ts" setup>
|
|
27
27
|
import { useFormFallbackProps, useUserAction } from '@veltra/compositions'
|
|
28
28
|
import { bem } from '@veltra/utils'
|
|
29
|
+
import { injectFormContext } from '@veltra/utils'
|
|
29
30
|
import { computed, provide, shallowRef, useTemplateRef, watch } from 'vue'
|
|
30
31
|
|
|
31
32
|
import type { PaletteProps } from '../../types'
|
|
32
|
-
import { injectFormContext } from '../../utils/form-context'
|
|
33
33
|
import { UTip } from '../tip'
|
|
34
34
|
import { HSV2RGB, RGB2HEX, HEX2RGBA, RGB2HSV } from './color-transform'
|
|
35
35
|
import { PaletteDIKey } from './di'
|
|
@@ -30,10 +30,10 @@ import { o } from '@cat-kit/core'
|
|
|
30
30
|
import { useFormFallbackProps } from '@veltra/compositions'
|
|
31
31
|
import { Hide, View } from '@veltra/icons/normal'
|
|
32
32
|
import { bem } from '@veltra/utils'
|
|
33
|
+
import { injectFormContext } from '@veltra/utils'
|
|
33
34
|
import { computed, nextTick, shallowRef } from 'vue'
|
|
34
35
|
|
|
35
36
|
import type { PasswordInputProps } from '../../types'
|
|
36
|
-
import { injectFormContext } from '../../utils/form-context'
|
|
37
37
|
import { UIcon } from '../icon'
|
|
38
38
|
import { UInput } from '../input'
|
|
39
39
|
|
|
@@ -35,10 +35,10 @@
|
|
|
35
35
|
import { useFormFallbackProps } from '@veltra/compositions'
|
|
36
36
|
import { QuestionFilled } from '@veltra/icons/normal'
|
|
37
37
|
import { bem } from '@veltra/utils'
|
|
38
|
+
import { injectFormContext } from '@veltra/utils'
|
|
38
39
|
import { ref } from 'vue'
|
|
39
40
|
|
|
40
41
|
import type { PopConfirmProps, PopConfirmEmits } from '../../types'
|
|
41
|
-
import { injectFormContext } from '../../utils/form-context'
|
|
42
42
|
import { UButton } from '../button'
|
|
43
43
|
import { UIcon } from '../icon'
|
|
44
44
|
import { UTip } from '../tip'
|
|
@@ -25,10 +25,10 @@
|
|
|
25
25
|
<script lang="ts" setup>
|
|
26
26
|
import { useFormFallbackProps } from '@veltra/compositions'
|
|
27
27
|
import { bem } from '@veltra/utils'
|
|
28
|
+
import { injectFormContext } from '@veltra/utils'
|
|
28
29
|
import { computed } from 'vue'
|
|
29
30
|
|
|
30
31
|
import type { RadioProps, RadioEmits } from '../../types'
|
|
31
|
-
import { injectFormContext } from '../../utils/form-context'
|
|
32
32
|
|
|
33
33
|
defineOptions({
|
|
34
34
|
name: 'Radio'
|
|
@@ -21,9 +21,9 @@
|
|
|
21
21
|
<script lang="ts" setup>
|
|
22
22
|
import { useFormFallbackProps } from '@veltra/compositions'
|
|
23
23
|
import { bem, FORM_EMPTY_CONTENT } from '@veltra/utils'
|
|
24
|
+
import { injectFormContext } from '@veltra/utils'
|
|
24
25
|
|
|
25
26
|
import type { RadioGroupProps, RadioGroupEmits } from '../../types'
|
|
26
|
-
import { injectFormContext } from '../../utils/form-context'
|
|
27
27
|
import URadio from '../radio/radio.vue'
|
|
28
28
|
|
|
29
29
|
defineOptions({
|
|
@@ -79,11 +79,11 @@ import { registerRichText } from '@lexical/rich-text'
|
|
|
79
79
|
import { HeadingNode, QuoteNode } from '@lexical/rich-text'
|
|
80
80
|
import { useFormFallbackProps } from '@veltra/compositions'
|
|
81
81
|
import { bem } from '@veltra/utils'
|
|
82
|
+
import { injectFormContext } from '@veltra/utils'
|
|
82
83
|
import { createEditor, $getRoot, $createParagraphNode, type LexicalEditor } from 'lexical'
|
|
83
84
|
import { computed, onBeforeUnmount, onMounted, ref, shallowRef, useTemplateRef, watch } from 'vue'
|
|
84
85
|
|
|
85
86
|
import type { RichTextEditorProps } from '../../types'
|
|
86
|
-
import { injectFormContext } from '../../utils/form-context'
|
|
87
87
|
import Toolbar from './toolbar.vue'
|
|
88
88
|
|
|
89
89
|
const props = withDefaults(defineProps<RichTextEditorProps>(), {
|
|
@@ -119,6 +119,7 @@ import { useFormFallbackProps, useVirtualizer } from '@veltra/compositions'
|
|
|
119
119
|
import { vFocus } from '@veltra/directives'
|
|
120
120
|
import { ArrowDown, Search } from '@veltra/icons/normal'
|
|
121
121
|
import { bem, FORM_EMPTY_CONTENT, scrollIntoContainerView, withUnit } from '@veltra/utils'
|
|
122
|
+
import { injectFormContext } from '@veltra/utils'
|
|
122
123
|
import { computed, nextTick, shallowRef, watch } from 'vue'
|
|
123
124
|
|
|
124
125
|
import type {
|
|
@@ -128,7 +129,6 @@ import type {
|
|
|
128
129
|
DropdownExposed,
|
|
129
130
|
ScrollExposed
|
|
130
131
|
} from '../../types'
|
|
131
|
-
import { injectFormContext } from '../../utils/form-context'
|
|
132
132
|
import { UDropdown } from '../dropdown'
|
|
133
133
|
import { UEmpty } from '../empty'
|
|
134
134
|
import { UIcon } from '../icon'
|
|
@@ -22,10 +22,10 @@
|
|
|
22
22
|
<script lang="ts" setup generic="T extends number | [number, number]">
|
|
23
23
|
import { useFormFallbackProps, useUserAction } from '@veltra/compositions'
|
|
24
24
|
import { bem } from '@veltra/utils'
|
|
25
|
+
import { injectFormContext } from '@veltra/utils'
|
|
25
26
|
import { computed, provide, watch } from 'vue'
|
|
26
27
|
|
|
27
28
|
import type { SliderProps, SliderEmits } from '../../types'
|
|
28
|
-
import { injectFormContext } from '../../utils/form-context'
|
|
29
29
|
import { sliderContextKey } from './di'
|
|
30
30
|
import SliderThumb from './slider-thumb.vue'
|
|
31
31
|
import { useSlider } from './use-slider'
|
|
@@ -25,10 +25,10 @@
|
|
|
25
25
|
<script lang="ts" setup>
|
|
26
26
|
import { useFormFallbackProps } from '@veltra/compositions'
|
|
27
27
|
import { bem } from '@veltra/utils'
|
|
28
|
+
import { injectFormContext } from '@veltra/utils'
|
|
28
29
|
import { computed } from 'vue'
|
|
29
30
|
|
|
30
31
|
import type { SwitchEmits, SwitchProps, _SwitchExposed } from '../../types'
|
|
31
|
-
import { injectFormContext } from '../../utils/form-context'
|
|
32
32
|
|
|
33
33
|
defineOptions({
|
|
34
34
|
name: 'Switch'
|
|
@@ -14,10 +14,10 @@
|
|
|
14
14
|
import { useFormFallbackProps } from '@veltra/compositions'
|
|
15
15
|
import { Close } from '@veltra/icons/normal'
|
|
16
16
|
import { bem } from '@veltra/utils'
|
|
17
|
+
import { injectFormContext } from '@veltra/utils'
|
|
17
18
|
import { computed } from 'vue'
|
|
18
19
|
|
|
19
20
|
import type { TagEmits, TagProps } from '../../types'
|
|
20
|
-
import { injectFormContext } from '../../utils/form-context'
|
|
21
21
|
import { UIcon } from '../icon'
|
|
22
22
|
|
|
23
23
|
defineOptions({
|
|
@@ -43,10 +43,10 @@
|
|
|
43
43
|
import { useFocus, useFormFallbackProps } from '@veltra/compositions'
|
|
44
44
|
import { Close } from '@veltra/icons/normal'
|
|
45
45
|
import { bem, FORM_EMPTY_CONTENT } from '@veltra/utils'
|
|
46
|
+
import { injectFormContext } from '@veltra/utils'
|
|
46
47
|
import { computed, ref, shallowRef, watch } from 'vue'
|
|
47
48
|
|
|
48
49
|
import type { TextareaProps, TextareaEmits, ComponentSize } from '../../types'
|
|
49
|
-
import { injectFormContext } from '../../utils/form-context'
|
|
50
50
|
import { UIcon } from '../icon'
|
|
51
51
|
import { calcTextareaHeight } from './utils'
|
|
52
52
|
|
|
@@ -33,11 +33,11 @@
|
|
|
33
33
|
<script lang="ts" setup>
|
|
34
34
|
import { useFormFallbackProps, useVirtualizer } from '@veltra/compositions'
|
|
35
35
|
import { bem, nextFrame, scrollIntoContainerView } from '@veltra/utils'
|
|
36
|
+
import { injectFormContext } from '@veltra/utils'
|
|
36
37
|
import { computed, provide, shallowRef, useSlots, watch, watchEffect, type VNode } from 'vue'
|
|
37
38
|
|
|
38
39
|
import type { TreeProps, TreeEmit, _TreeExposed } from '../../types'
|
|
39
40
|
import type { ScrollExposed } from '../../types'
|
|
40
|
-
import { injectFormContext } from '../../utils/form-context'
|
|
41
41
|
import { UEmpty } from '../empty'
|
|
42
42
|
import { UScroll } from '../scroll'
|
|
43
43
|
import { TreeDIKey, type TreeConText, type TreeSlotsScope } from './di'
|
|
@@ -63,10 +63,10 @@ import { dfs, o } from '@cat-kit/core'
|
|
|
63
63
|
import { useFormFallbackProps } from '@veltra/compositions'
|
|
64
64
|
import { ArrowDown, Search } from '@veltra/icons/normal'
|
|
65
65
|
import { bem, FORM_EMPTY_CONTENT } from '@veltra/utils'
|
|
66
|
+
import { injectFormContext } from '@veltra/utils'
|
|
66
67
|
import { computed, nextTick, shallowRef, watch } from 'vue'
|
|
67
68
|
|
|
68
69
|
import type { TreeSelectProps, TreeSelectEmits, TreeExposed } from '../../types'
|
|
69
|
-
import { injectFormContext } from '../../utils/form-context'
|
|
70
70
|
import { UDropdown } from '../dropdown'
|
|
71
71
|
import { UIcon } from '../icon'
|
|
72
72
|
import { UInput } from '../input'
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { inject, provide } from "vue";
|
|
2
|
-
//#region src/utils/form-context.ts
|
|
3
|
-
const FormComponentDIKey = Symbol("FormComponentDIKey");
|
|
4
|
-
function provideFormContext(props) {
|
|
5
|
-
if (props) return provide(FormComponentDIKey, { formProps: props });
|
|
6
|
-
}
|
|
7
|
-
function injectFormContext() {
|
|
8
|
-
const context = inject(FormComponentDIKey, void 0) || {};
|
|
9
|
-
return {
|
|
10
|
-
inForm: !!context,
|
|
11
|
-
...context
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
//#endregion
|
|
15
|
-
export { injectFormContext, provideFormContext };
|
|
16
|
-
|
|
17
|
-
//# sourceMappingURL=form-context.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"form-context.js","names":[],"sources":["../../src/utils/form-context.ts"],"sourcesContent":["import { type InjectionKey, inject, provide } from 'vue'\n\nimport type { FormProps } from '../types/form'\n\ntype DIContext = {\n /** 表单属性 */\n formProps: FormProps\n}\n\nconst FormComponentDIKey: InjectionKey<DIContext> = Symbol('FormComponentDIKey')\n\nexport function provideFormContext(props: FormProps): void {\n if (props) {\n return provide(FormComponentDIKey, { formProps: props })\n }\n}\n\nexport function injectFormContext(): {\n /** 是否在表单中 */\n inForm: boolean\n} & Partial<DIContext> {\n const context = inject(FormComponentDIKey, undefined) || {}\n return { inForm: !!context, ...context }\n}\n"],"mappings":";;AASA,MAAM,qBAA8C,OAAO,qBAAqB;AAEhF,SAAgB,mBAAmB,OAAwB;AACzD,KAAI,MACF,QAAO,QAAQ,oBAAoB,EAAE,WAAW,OAAO,CAAC;;AAI5D,SAAgB,oBAGO;CACrB,MAAM,UAAU,OAAO,oBAAoB,KAAA,EAAU,IAAI,EAAE;AAC3D,QAAO;EAAE,QAAQ,CAAC,CAAC;EAAS,GAAG;EAAS"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { type InjectionKey, inject, provide } from 'vue'
|
|
2
|
-
|
|
3
|
-
import type { FormProps } from '../types/form'
|
|
4
|
-
|
|
5
|
-
type DIContext = {
|
|
6
|
-
/** 表单属性 */
|
|
7
|
-
formProps: FormProps
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
const FormComponentDIKey: InjectionKey<DIContext> = Symbol('FormComponentDIKey')
|
|
11
|
-
|
|
12
|
-
export function provideFormContext(props: FormProps): void {
|
|
13
|
-
if (props) {
|
|
14
|
-
return provide(FormComponentDIKey, { formProps: props })
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export function injectFormContext(): {
|
|
19
|
-
/** 是否在表单中 */
|
|
20
|
-
inForm: boolean
|
|
21
|
-
} & Partial<DIContext> {
|
|
22
|
-
const context = inject(FormComponentDIKey, undefined) || {}
|
|
23
|
-
return { inForm: !!context, ...context }
|
|
24
|
-
}
|