@veltra/desktop 1.1.1 → 1.1.2
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 +3 -3
- package/dist/components/action/action.vue.d.ts +2 -2
- package/dist/components/auto-complete/auto-complete.js +3 -2
- package/dist/components/auto-complete/auto-complete.js.map +1 -1
- package/dist/components/auto-complete/style2.css +2 -2
- package/dist/components/batch-edit/batch-edit.vue.d.ts +1 -1
- package/dist/components/cascade/cascade.js +3 -2
- package/dist/components/cascade/cascade.js.map +1 -1
- package/dist/components/cascade/cascade.vue.d.ts +1 -1
- package/dist/components/cascade/style2.css +1 -1
- package/dist/components/checkbox/checkbox-button.js +3 -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 +3 -2
- package/dist/components/checkbox/checkbox.js.map +1 -1
- package/dist/components/checkbox/style2.css +2 -2
- package/dist/components/checkbox-group/checkbox-group.js +3 -2
- package/dist/components/checkbox-group/checkbox-group.js.map +1 -1
- package/dist/components/checkbox-group/checkbox-group.vue.d.ts +1 -1
- package/dist/components/code-editor/code-editor.js +3 -2
- package/dist/components/code-editor/code-editor.js.map +1 -1
- package/dist/components/code-editor/style2.css +1 -1
- package/dist/components/collapse/collapse-item.js +10 -35
- package/dist/components/collapse/collapse-item.js.map +1 -1
- package/dist/components/collapse/collapse.js +4 -2
- package/dist/components/collapse/collapse.js.map +1 -1
- package/dist/components/collapse/di.js +1 -0
- package/dist/components/collapse/di.js.map +1 -1
- package/dist/components/date-panel/date-panel.vue.d.ts +1 -1
- package/dist/components/date-picker/date-picker.js +3 -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 +3 -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/date-range-picker/style2.css +1 -1
- package/dist/components/drawer/drawer.vue.d.ts +2 -2
- package/dist/components/expression-editor/expression-editor.js +3 -2
- package/dist/components/expression-editor/expression-editor.js.map +1 -1
- package/dist/components/expression-editor/style2.css +5 -5
- package/dist/components/file-viewer/file-viewer.vue.d.ts +1 -1
- package/dist/components/form/form.js.map +1 -1
- package/dist/components/form/form.vue_vue_type_script_setup_true_lang.js +2 -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 +3 -2
- package/dist/components/form-item/form-item.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/form-item/style2.css +0 -1
- package/dist/components/grid-input/style2.css +3 -3
- package/dist/components/group-input/group-input.js +3 -2
- package/dist/components/group-input/group-input.js.map +1 -1
- package/dist/components/input/input.js.map +1 -1
- package/dist/components/input/input.vue_vue_type_script_setup_true_lang.js +3 -2
- package/dist/components/input/input.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/input/style2.css +1 -1
- package/dist/components/menu/di.js +1 -0
- package/dist/components/menu/di.js.map +1 -1
- package/dist/components/menu/menu-sub.js +7 -15
- package/dist/components/menu/menu-sub.js.map +1 -1
- package/dist/components/menu/menu.js +8 -2
- package/dist/components/menu/menu.js.map +1 -1
- package/dist/components/multi-select/multi-select.js +3 -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-select/style2.css +2 -2
- package/dist/components/multi-tree-select/multi-tree-select.js +3 -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/multi-tree-select/style2.css +2 -2
- package/dist/components/number-input/number-input.js +3 -2
- package/dist/components/number-input/number-input.js.map +1 -1
- package/dist/components/number-range-input/number-range-input.js +3 -2
- package/dist/components/number-range-input/number-range-input.js.map +1 -1
- package/dist/components/palette/palette.js +3 -2
- package/dist/components/palette/palette.js.map +1 -1
- package/dist/components/password-input/password-input.js +4 -3
- package/dist/components/password-input/password-input.js.map +1 -1
- package/dist/components/pop-confirm/pop-confirm.js +3 -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/progress-nodes/progress-nodes.vue.d.ts +2 -2
- package/dist/components/radio/radio.js +3 -2
- package/dist/components/radio/radio.js.map +1 -1
- package/dist/components/radio/style2.css +1 -1
- package/dist/components/radio-group/radio-group.js +3 -2
- package/dist/components/radio-group/radio-group.js.map +1 -1
- package/dist/components/radio-group/radio-group.vue.d.ts +1 -1
- package/dist/components/radio-group/style2.css +1 -1
- package/dist/components/rich-text-editor/rich-text-editor.js +3 -2
- package/dist/components/rich-text-editor/rich-text-editor.js.map +1 -1
- package/dist/components/rich-text-editor/style2.css +5 -5
- package/dist/components/select/select.js +4 -3
- package/dist/components/select/select.js.map +1 -1
- package/dist/components/select/select.vue.d.ts +1 -1
- package/dist/components/slider/slider.js +3 -2
- package/dist/components/slider/slider.js.map +1 -1
- package/dist/components/steps/steps.vue.d.ts +1 -1
- package/dist/components/switch/style2.css +1 -1
- package/dist/components/switch/switch.js +3 -2
- package/dist/components/switch/switch.js.map +1 -1
- package/dist/components/table/table.vue.d.ts +2 -2
- package/dist/components/tabs/tabs-horizontal.vue.d.ts +4 -4
- package/dist/components/tabs/tabs-vertical.vue.d.ts +4 -4
- package/dist/components/tabs/tabs.vue.d.ts +4 -4
- package/dist/components/tag/tag.js +3 -2
- package/dist/components/tag/tag.js.map +1 -1
- package/dist/components/textarea/style2.css +1 -1
- package/dist/components/textarea/textarea.js +3 -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 +3 -2
- package/dist/components/tree/tree.js.map +1 -1
- package/dist/components/tree-select/tree-select.js +3 -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/dist/utils/form-context.js +17 -0
- package/dist/utils/form-context.js.map +1 -0
- package/package.json +11 -11
- package/src/components/auto-complete/auto-complete.vue +3 -2
- package/src/components/auto-complete/style.scss +2 -2
- package/src/components/cascade/cascade.vue +3 -2
- package/src/components/cascade/style.scss +1 -1
- package/src/components/checkbox/checkbox-button.vue +3 -2
- package/src/components/checkbox/checkbox.vue +3 -2
- package/src/components/checkbox/style.scss +2 -2
- package/src/components/checkbox-group/checkbox-group.vue +3 -2
- package/src/components/code-editor/code-editor.vue +3 -2
- package/src/components/code-editor/style.scss +1 -1
- package/src/components/collapse/collapse-item.vue +11 -49
- package/src/components/collapse/collapse.vue +7 -2
- package/src/components/collapse/di.ts +2 -1
- package/src/components/collapse/style.scss +1 -1
- package/src/components/date-picker/date-picker.vue +3 -2
- package/src/components/date-range-picker/date-range-picker.vue +3 -2
- package/src/components/date-range-picker/style.scss +1 -1
- package/src/components/expression-editor/expression-editor.vue +3 -2
- package/src/components/expression-editor/style.scss +5 -5
- package/src/components/form/form.vue +2 -2
- package/src/components/form-item/form-item.vue +3 -2
- package/src/components/form-item/style.scss +0 -1
- package/src/components/grid-input/style.scss +1 -1
- package/src/components/group-input/group-input.vue +3 -2
- package/src/components/input/input.vue +3 -2
- package/src/components/input/style.scss +1 -1
- package/src/components/menu/di.ts +2 -1
- package/src/components/menu/menu-sub.vue +6 -9
- package/src/components/menu/menu.vue +11 -2
- package/src/components/multi-select/multi-select.vue +3 -2
- package/src/components/multi-select/style.scss +2 -2
- package/src/components/multi-tree-select/multi-tree-select.vue +3 -2
- package/src/components/multi-tree-select/style.scss +2 -2
- package/src/components/number-input/number-input.vue +3 -2
- package/src/components/number-range-input/number-range-input.vue +3 -2
- package/src/components/palette/palette.vue +3 -2
- package/src/components/password-input/password-input.vue +4 -3
- package/src/components/pop-confirm/pop-confirm.vue +3 -2
- package/src/components/radio/radio.vue +3 -2
- package/src/components/radio/style.scss +1 -1
- package/src/components/radio-group/radio-group.vue +3 -2
- package/src/components/radio-group/style.scss +1 -1
- package/src/components/rich-text-editor/rich-text-editor.vue +3 -2
- package/src/components/rich-text-editor/style.scss +5 -5
- package/src/components/select/select.vue +4 -3
- package/src/components/slider/slider.vue +3 -2
- package/src/components/switch/style.scss +1 -1
- package/src/components/switch/switch.vue +3 -2
- package/src/components/tag/tag.vue +3 -2
- package/src/components/textarea/style.scss +1 -1
- package/src/components/textarea/textarea.vue +3 -2
- package/src/components/tree/tree.vue +3 -2
- package/src/components/tree-select/tree-select.vue +3 -2
- package/src/utils/form-context.ts +24 -0
- package/dist/components/menu/use-menu-transition.js +0 -71
- package/dist/components/menu/use-menu-transition.js.map +0 -1
- package/src/components/menu/use-menu-transition.ts +0 -69
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@veltra/desktop",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"files": [
|
|
5
5
|
"dist",
|
|
6
6
|
"src"
|
|
@@ -61,22 +61,22 @@
|
|
|
61
61
|
"@lexical/rich-text": "^0.43.0",
|
|
62
62
|
"@lexical/selection": "^0.43.0",
|
|
63
63
|
"@lexical/utils": "^0.43.0",
|
|
64
|
-
"@veltra/compositions": "1.1.
|
|
65
|
-
"@veltra/directives": "1.1.
|
|
66
|
-
"@veltra/icons": "1.1.
|
|
67
|
-
"@veltra/styles": "1.1.
|
|
68
|
-
"@veltra/utils": "1.1.
|
|
64
|
+
"@veltra/compositions": "1.1.2",
|
|
65
|
+
"@veltra/directives": "1.1.2",
|
|
66
|
+
"@veltra/icons": "1.1.2",
|
|
67
|
+
"@veltra/styles": "1.1.2",
|
|
68
|
+
"@veltra/utils": "1.1.2",
|
|
69
69
|
"@visactor/vtable": "^1.26.0",
|
|
70
70
|
"codemirror": "^6.0.2",
|
|
71
71
|
"docx-preview": "^0.3.7",
|
|
72
72
|
"lexical": "^0.43.0"
|
|
73
73
|
},
|
|
74
74
|
"peerDependencies": {
|
|
75
|
-
"@veltra/compositions": "1.1.
|
|
76
|
-
"@veltra/directives": "1.1.
|
|
77
|
-
"@veltra/icons": "1.1.
|
|
78
|
-
"@veltra/styles": "1.1.
|
|
79
|
-
"@veltra/utils": "1.1.
|
|
75
|
+
"@veltra/compositions": "1.1.2",
|
|
76
|
+
"@veltra/directives": "1.1.2",
|
|
77
|
+
"@veltra/icons": "1.1.2",
|
|
78
|
+
"@veltra/styles": "1.1.2",
|
|
79
|
+
"@veltra/utils": "1.1.2",
|
|
80
80
|
"vue": "^3.5.33"
|
|
81
81
|
}
|
|
82
82
|
}
|
|
@@ -71,13 +71,14 @@
|
|
|
71
71
|
</template>
|
|
72
72
|
|
|
73
73
|
<script lang="ts" setup>
|
|
74
|
-
import {
|
|
74
|
+
import { useFormFallbackProps } from '@veltra/compositions'
|
|
75
75
|
import { vRipple } from '@veltra/directives'
|
|
76
76
|
import { bem, FORM_EMPTY_CONTENT, scrollIntoContainerView } from '@veltra/utils'
|
|
77
77
|
import { computed, shallowRef, watch } from 'vue'
|
|
78
78
|
|
|
79
79
|
import type { AutoCompleteEmits, AutoCompleteProps, _AutoCompleteExposed } from '../../types'
|
|
80
80
|
import type { DropdownExposed, ScrollExposed } from '../../types'
|
|
81
|
+
import { injectFormContext } from '../../utils/form-context'
|
|
81
82
|
import { UDropdown } from '../dropdown'
|
|
82
83
|
import { UInput } from '../input'
|
|
83
84
|
import { UScroll } from '../scroll'
|
|
@@ -108,7 +109,7 @@ const cls = bem('auto-complete')
|
|
|
108
109
|
|
|
109
110
|
const optionClass = cls.e('option')
|
|
110
111
|
|
|
111
|
-
const { formProps } =
|
|
112
|
+
const { formProps } = injectFormContext()
|
|
112
113
|
const { size, disabled, readonly } = useFormFallbackProps([formProps ?? {}, props], {
|
|
113
114
|
size: 'default',
|
|
114
115
|
disabled: false,
|
|
@@ -22,7 +22,7 @@ $root-name: auto-complete;
|
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
@include m.bem(tag) {
|
|
25
|
-
border: fn.use-var(border);
|
|
25
|
+
border: fn.use-var(border-muted);
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
|
|
@@ -68,7 +68,7 @@ $root-name: auto-complete;
|
|
|
68
68
|
|
|
69
69
|
@include m.is(multiple) {
|
|
70
70
|
line-height: 1;
|
|
71
|
-
border: fn.use-var(border);
|
|
71
|
+
border: fn.use-var(border-muted);
|
|
72
72
|
box-shadow: fn.use-var(shadow, emboss);
|
|
73
73
|
transition: border-color 0.25s ease, box-shadow 0.25s ease;
|
|
74
74
|
overflow: hidden;
|
|
@@ -105,12 +105,13 @@
|
|
|
105
105
|
|
|
106
106
|
<script lang="ts" setup>
|
|
107
107
|
import { Forest, o } from '@cat-kit/core'
|
|
108
|
-
import {
|
|
108
|
+
import { useFormFallbackProps, useUserAction } from '@veltra/compositions'
|
|
109
109
|
import { ArrowDown, Close, Search } from '@veltra/icons/normal'
|
|
110
110
|
import { bem, FORM_EMPTY_CONTENT } from '@veltra/utils'
|
|
111
111
|
import { computed, provide, shallowRef, triggerRef, watch } from 'vue'
|
|
112
112
|
|
|
113
113
|
import type { CascadeProps, CascadeEmits, DropdownExposed } from '../../types'
|
|
114
|
+
import { injectFormContext } from '../../utils/form-context'
|
|
114
115
|
import { UDropdown } from '../dropdown'
|
|
115
116
|
import { UEmpty } from '../empty'
|
|
116
117
|
import { UIcon } from '../icon'
|
|
@@ -145,7 +146,7 @@ const emit = defineEmits<CascadeEmits>()
|
|
|
145
146
|
|
|
146
147
|
const cls = bem('cascade')
|
|
147
148
|
|
|
148
|
-
const { formProps } =
|
|
149
|
+
const { formProps } = injectFormContext()
|
|
149
150
|
|
|
150
151
|
const { size, disabled, readonly } = useFormFallbackProps([formProps ?? {}, props], {
|
|
151
152
|
size: 'default',
|
|
@@ -10,7 +10,7 @@ $menu-name: $root-name + '-panel-item';
|
|
|
10
10
|
width: 100%;
|
|
11
11
|
|
|
12
12
|
@include m.is(multiple) {
|
|
13
|
-
border: fn.use-var(border);
|
|
13
|
+
border: fn.use-var(border-muted);
|
|
14
14
|
box-shadow: fn.use-var(shadow, emboss);
|
|
15
15
|
transition: border-color 0.25s ease, box-shadow 0.25s ease;
|
|
16
16
|
overflow: hidden;
|
|
@@ -13,11 +13,12 @@
|
|
|
13
13
|
</template>
|
|
14
14
|
|
|
15
15
|
<script lang="ts" setup>
|
|
16
|
-
import {
|
|
16
|
+
import { useFormFallbackProps } from '@veltra/compositions'
|
|
17
17
|
import { bem, FORM_EMPTY_CONTENT } from '@veltra/utils'
|
|
18
18
|
import { computed } from 'vue'
|
|
19
19
|
|
|
20
20
|
import type { CheckboxButtonProps, CheckboxButtonEmits } from '../../types'
|
|
21
|
+
import { injectFormContext } from '../../utils/form-context'
|
|
21
22
|
import { UTag } from '../tag'
|
|
22
23
|
|
|
23
24
|
defineOptions({
|
|
@@ -41,7 +42,7 @@ const cls = bem('checkbox-button')
|
|
|
41
42
|
|
|
42
43
|
const checked = defineModel<boolean>()
|
|
43
44
|
|
|
44
|
-
const { formProps } =
|
|
45
|
+
const { formProps } = injectFormContext()
|
|
45
46
|
|
|
46
47
|
const { size, disabled, readonly } = useFormFallbackProps([formProps ?? {}, props], {
|
|
47
48
|
size: 'default',
|
|
@@ -18,11 +18,12 @@
|
|
|
18
18
|
</template>
|
|
19
19
|
|
|
20
20
|
<script lang="ts" setup>
|
|
21
|
-
import {
|
|
21
|
+
import { useFormFallbackProps } from '@veltra/compositions'
|
|
22
22
|
import { bem } from '@veltra/utils'
|
|
23
23
|
import { computed } from 'vue'
|
|
24
24
|
|
|
25
25
|
import type { CheckboxProps, CheckboxEmits } from '../../types'
|
|
26
|
+
import { injectFormContext } from '../../utils/form-context'
|
|
26
27
|
|
|
27
28
|
defineOptions({
|
|
28
29
|
name: 'Checkbox'
|
|
@@ -37,7 +38,7 @@ const cls = bem('checkbox')
|
|
|
37
38
|
|
|
38
39
|
const checked = defineModel<boolean>()
|
|
39
40
|
|
|
40
|
-
const { formProps } =
|
|
41
|
+
const { formProps } = injectFormContext()
|
|
41
42
|
|
|
42
43
|
const { size, disabled, readonly } = useFormFallbackProps([formProps ?? {}, props], {
|
|
43
44
|
size: 'default',
|
|
@@ -19,7 +19,7 @@ $root-name: checkbox;
|
|
|
19
19
|
@include m.is(disabled) {
|
|
20
20
|
@include m.bem($root-name, wrap) {
|
|
21
21
|
background-color: fn.use-var(text-color, disabled);
|
|
22
|
-
border-color: fn.use-var(border, color);
|
|
22
|
+
border-color: fn.use-var(border, muted-color);
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
}
|
|
@@ -72,7 +72,7 @@ $root-name: checkbox;
|
|
|
72
72
|
|
|
73
73
|
$button-name: checkbox-button;
|
|
74
74
|
@include m.b($button-name) {
|
|
75
|
-
border: fn.use-var(border);
|
|
75
|
+
border: fn.use-var(border-muted);
|
|
76
76
|
vertical-align: middle;
|
|
77
77
|
display: inline-flex;
|
|
78
78
|
align-items: center;
|
|
@@ -26,10 +26,11 @@
|
|
|
26
26
|
</template>
|
|
27
27
|
|
|
28
28
|
<script lang="ts" setup>
|
|
29
|
-
import {
|
|
29
|
+
import { useFormFallbackProps } from '@veltra/compositions'
|
|
30
30
|
import { bem, FORM_EMPTY_CONTENT } from '@veltra/utils'
|
|
31
31
|
|
|
32
32
|
import type { CheckboxGroupProps, CheckboxGroupEmits } from '../../types'
|
|
33
|
+
import { injectFormContext } from '../../utils/form-context'
|
|
33
34
|
import { UCheckbox } from '../checkbox'
|
|
34
35
|
import { UTag } from '../tag'
|
|
35
36
|
|
|
@@ -50,7 +51,7 @@ const model = defineModel<any[]>()
|
|
|
50
51
|
|
|
51
52
|
const cls = bem('checkbox-group')
|
|
52
53
|
|
|
53
|
-
const { formProps } =
|
|
54
|
+
const { formProps } = injectFormContext()
|
|
54
55
|
|
|
55
56
|
const { size, disabled, readonly } = useFormFallbackProps([formProps ?? {}, props], {
|
|
56
57
|
size: 'default',
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
import { Compartment, EditorState, type Extension } from '@codemirror/state'
|
|
9
9
|
import { oneDark } from '@codemirror/theme-one-dark'
|
|
10
10
|
import { ViewPlugin, tooltips, type ViewUpdate } from '@codemirror/view'
|
|
11
|
-
import {
|
|
11
|
+
import { useFormFallbackProps } from '@veltra/compositions'
|
|
12
12
|
import { bem, zIndex } from '@veltra/utils'
|
|
13
13
|
import { EditorView, basicSetup } from 'codemirror'
|
|
14
14
|
import {
|
|
@@ -21,6 +21,7 @@ import {
|
|
|
21
21
|
} from 'vue'
|
|
22
22
|
|
|
23
23
|
import type { CodeEditorLang, CodeEditorProps } from '../../types'
|
|
24
|
+
import { injectFormContext } from '../../utils/form-context'
|
|
24
25
|
import { UScroll } from '../scroll'
|
|
25
26
|
|
|
26
27
|
defineOptions({ name: 'CodeEditor' })
|
|
@@ -36,7 +37,7 @@ const model = defineModel<string>()
|
|
|
36
37
|
|
|
37
38
|
const cls = bem('code-editor')
|
|
38
39
|
|
|
39
|
-
const { formProps } =
|
|
40
|
+
const { formProps } = injectFormContext()
|
|
40
41
|
|
|
41
42
|
const { disabled, readonly } = useFormFallbackProps([formProps ?? {}, props], {
|
|
42
43
|
disabled: false,
|
|
@@ -11,7 +11,7 @@ $root-name: code-editor;
|
|
|
11
11
|
--u-code-editor-padding-block: 6px;
|
|
12
12
|
--u-code-editor-bg: #{fn.use-var(bg, color, top)};
|
|
13
13
|
--u-code-editor-fg: #{fn.use-var(text-color, main)};
|
|
14
|
-
--u-code-editor-border: #{fn.use-var(border, color)};
|
|
14
|
+
--u-code-editor-border: #{fn.use-var(border, muted-color)};
|
|
15
15
|
--u-code-editor-gutter-fg: #{fn.use-var(text-color, placeholder)};
|
|
16
16
|
--u-code-editor-active-bg: rgba(30, 136, 229, 0.06);
|
|
17
17
|
--u-code-editor-selection-bg: rgba(30, 136, 229, 0.18);
|
|
@@ -49,7 +49,7 @@ defineOptions({
|
|
|
49
49
|
|
|
50
50
|
const props = defineProps<CollapseItemProps>()
|
|
51
51
|
|
|
52
|
-
const context = inject(CollapseDIKey)
|
|
52
|
+
const context = inject(CollapseDIKey)!
|
|
53
53
|
|
|
54
54
|
const cls = context?.cls ?? bem('collapse')
|
|
55
55
|
|
|
@@ -80,59 +80,21 @@ const handleClick = () => {
|
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
const wrapperEl = ref<HTMLElement>()
|
|
83
|
-
let cleanupTransition: (() => void) | null = null
|
|
84
83
|
|
|
85
|
-
const
|
|
86
|
-
cleanupTransition?.()
|
|
87
|
-
cleanupTransition = null
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
// 用 height 数值过渡替代 grid-template-rows,避免每帧 grid 重排带来的卡顿。
|
|
91
|
-
const animateHeight = (active: boolean) => {
|
|
92
|
-
const el = wrapperEl.value
|
|
93
|
-
if (!el) return
|
|
94
|
-
|
|
95
|
-
cancelTransition()
|
|
96
|
-
|
|
97
|
-
const startHeight = el.offsetHeight
|
|
98
|
-
const endHeight = active ? el.scrollHeight : 0
|
|
99
|
-
|
|
100
|
-
if (startHeight === endHeight) {
|
|
101
|
-
el.style.height = active ? 'auto' : '0px'
|
|
102
|
-
return
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
el.style.height = `${startHeight}px`
|
|
106
|
-
// 强制 reflow,确保起始高度被采纳,避免 0 → auto 直接跳变。
|
|
107
|
-
void el.offsetHeight
|
|
108
|
-
el.style.height = `${endHeight}px`
|
|
109
|
-
|
|
110
|
-
const onEnd = (e: TransitionEvent) => {
|
|
111
|
-
if (e.target !== el || e.propertyName !== 'height') return
|
|
112
|
-
cleanup()
|
|
113
|
-
if (active) {
|
|
114
|
-
// 回归 auto,让后续内容动态变化时不被锁死高度。
|
|
115
|
-
el.style.height = 'auto'
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
const cleanup = () => {
|
|
120
|
-
el.removeEventListener('transitionend', onEnd)
|
|
121
|
-
el.removeEventListener('transitioncancel', onEnd)
|
|
122
|
-
cleanupTransition = null
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
el.addEventListener('transitionend', onEnd)
|
|
126
|
-
el.addEventListener('transitioncancel', onEnd)
|
|
127
|
-
cleanupTransition = cleanup
|
|
128
|
-
}
|
|
84
|
+
const { expandTransition } = context
|
|
129
85
|
|
|
130
86
|
onMounted(() => {
|
|
131
87
|
if (!wrapperEl.value) return
|
|
132
|
-
wrapperEl.value
|
|
88
|
+
expandTransition.setExpanded(wrapperEl.value, isActive.value)
|
|
133
89
|
})
|
|
134
90
|
|
|
135
|
-
watch(isActive,
|
|
91
|
+
watch(isActive, (active) => {
|
|
92
|
+
if (!wrapperEl.value) return
|
|
93
|
+
active ? expandTransition.expand(wrapperEl.value) : expandTransition.collapse(wrapperEl.value)
|
|
94
|
+
})
|
|
136
95
|
|
|
137
|
-
onBeforeUnmount(
|
|
96
|
+
onBeforeUnmount(() => {
|
|
97
|
+
if (!wrapperEl.value) return
|
|
98
|
+
expandTransition.cancel(wrapperEl.value)
|
|
99
|
+
})
|
|
138
100
|
</script>
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
<script lang="ts" setup>
|
|
8
8
|
import { useFormFallbackProps, useModel } from '@veltra/compositions'
|
|
9
|
-
import { bem } from '@veltra/utils'
|
|
9
|
+
import { bem, ExpandTransition } from '@veltra/utils'
|
|
10
10
|
import { computed, provide } from 'vue'
|
|
11
11
|
|
|
12
12
|
import type {
|
|
@@ -31,6 +31,10 @@ const emit = defineEmits<CollapseEmits>()
|
|
|
31
31
|
|
|
32
32
|
const cls = bem('collapse')
|
|
33
33
|
|
|
34
|
+
const expandTransition = new ExpandTransition({
|
|
35
|
+
transition: 'height 0.24s cubic-bezier(0.4, 0, 0.2, 1)'
|
|
36
|
+
})
|
|
37
|
+
|
|
34
38
|
const { size } = useFormFallbackProps([props], { size: 'default' })
|
|
35
39
|
|
|
36
40
|
const iconPosition = computed(() => props.iconPosition ?? 'right')
|
|
@@ -109,7 +113,8 @@ provide(CollapseDIKey, {
|
|
|
109
113
|
iconPosition,
|
|
110
114
|
expandIcon,
|
|
111
115
|
activeValues,
|
|
112
|
-
toggle
|
|
116
|
+
toggle,
|
|
117
|
+
expandTransition
|
|
113
118
|
})
|
|
114
119
|
|
|
115
120
|
defineExpose<_CollapseExposed>({
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type BEM, type ComponentSize, ExpandTransition } from '@veltra/utils'
|
|
2
2
|
import type { Component, ComputedRef, InjectionKey } from 'vue'
|
|
3
3
|
|
|
4
4
|
import type { CollapseIconPosition, CollapseValue } from '../../types'
|
|
@@ -10,6 +10,7 @@ export interface CollapseContext {
|
|
|
10
10
|
expandIcon: ComputedRef<Component | undefined>
|
|
11
11
|
activeValues: ComputedRef<CollapseValue[]>
|
|
12
12
|
toggle: (value: CollapseValue) => void
|
|
13
|
+
expandTransition: ExpandTransition
|
|
13
14
|
}
|
|
14
15
|
|
|
15
16
|
export const CollapseDIKey: InjectionKey<CollapseContext> = Symbol('Collapse')
|
|
@@ -124,7 +124,7 @@ $header-padding-y: (
|
|
|
124
124
|
}
|
|
125
125
|
|
|
126
126
|
// ===== Content wrapper =====
|
|
127
|
-
//
|
|
127
|
+
// 高度由共享 expand transition hook 在 isActive 切换时驱动:
|
|
128
128
|
// 未挂载前 → CSS 兜底 height: 0
|
|
129
129
|
// 未激活 → 0px(带 transition)
|
|
130
130
|
// 激活中 → 0 → scrollHeight(CSS transition: height)
|
|
@@ -36,13 +36,14 @@
|
|
|
36
36
|
|
|
37
37
|
<script lang="ts" setup>
|
|
38
38
|
import { date, type Dater } from '@cat-kit/core'
|
|
39
|
-
import {
|
|
39
|
+
import { useFormFallbackProps, useUserAction } from '@veltra/compositions'
|
|
40
40
|
import { Calendar } from '@veltra/icons/normal'
|
|
41
41
|
import { bem, FORM_EMPTY_CONTENT } from '@veltra/utils'
|
|
42
42
|
import { computed, shallowRef, watch } from 'vue'
|
|
43
43
|
|
|
44
44
|
import type { DatePickerEmits, DatePickerProps } from '../../types'
|
|
45
45
|
import type { DropdownExposed } from '../../types'
|
|
46
|
+
import { injectFormContext } from '../../utils/form-context'
|
|
46
47
|
import { UDatePanel } from '../date-panel'
|
|
47
48
|
import { UDropdown } from '../dropdown'
|
|
48
49
|
import { UIcon } from '../icon'
|
|
@@ -64,7 +65,7 @@ const emit = defineEmits<DatePickerEmits>()
|
|
|
64
65
|
|
|
65
66
|
const cls = bem('date-picker')
|
|
66
67
|
|
|
67
|
-
const { formProps } =
|
|
68
|
+
const { formProps } = injectFormContext()
|
|
68
69
|
|
|
69
70
|
const { size, disabled, readonly } = useFormFallbackProps([formProps ?? {}, props], {
|
|
70
71
|
size: 'default',
|
|
@@ -61,12 +61,13 @@
|
|
|
61
61
|
|
|
62
62
|
<script lang="ts" setup>
|
|
63
63
|
import { date, type Dater } from '@cat-kit/core'
|
|
64
|
-
import {
|
|
64
|
+
import { useFormFallbackProps, useUserAction } from '@veltra/compositions'
|
|
65
65
|
import { Calendar, Close } from '@veltra/icons/normal'
|
|
66
66
|
import { bem, FORM_EMPTY_CONTENT } from '@veltra/utils'
|
|
67
67
|
import { computed, shallowRef, watch } from 'vue'
|
|
68
68
|
|
|
69
69
|
import type { DateRangePickerEmits, DateRangePickerProps, DropdownExposed } from '../../types'
|
|
70
|
+
import { injectFormContext } from '../../utils/form-context'
|
|
70
71
|
import { UDatePanel } from '../date-panel'
|
|
71
72
|
import { UDropdown } from '../dropdown'
|
|
72
73
|
import { UIcon } from '../icon'
|
|
@@ -91,7 +92,7 @@ const className = computed(() => {
|
|
|
91
92
|
return [cls.b, cls.m(size.value), bem.is('disabled', disabled.value)]
|
|
92
93
|
})
|
|
93
94
|
|
|
94
|
-
const { formProps } =
|
|
95
|
+
const { formProps } = injectFormContext()
|
|
95
96
|
|
|
96
97
|
const { size, disabled, readonly } = useFormFallbackProps([formProps ?? {}, props], {
|
|
97
98
|
size: 'default',
|
|
@@ -9,7 +9,7 @@ $root-name: date-range-picker;
|
|
|
9
9
|
width: 100%;
|
|
10
10
|
vertical-align: middle;
|
|
11
11
|
line-height: 1;
|
|
12
|
-
border: fn.use-var(border);
|
|
12
|
+
border: fn.use-var(border-muted);
|
|
13
13
|
box-shadow: fn.use-var(shadow, emboss);
|
|
14
14
|
transition: border-color 0.25s ease, box-shadow 0.25s ease;
|
|
15
15
|
overflow: hidden;
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
</template>
|
|
30
30
|
|
|
31
31
|
<script lang="ts" setup>
|
|
32
|
-
import {
|
|
32
|
+
import { useFormFallbackProps } from '@veltra/compositions'
|
|
33
33
|
import { bem } from '@veltra/utils'
|
|
34
34
|
import {
|
|
35
35
|
computed,
|
|
@@ -42,6 +42,7 @@ import {
|
|
|
42
42
|
} from 'vue'
|
|
43
43
|
|
|
44
44
|
import type { ExpressionEditorProps, VariableItem } from '../../types'
|
|
45
|
+
import { injectFormContext } from '../../utils/form-context'
|
|
45
46
|
import VariablePicker from './components/variable-picker.vue'
|
|
46
47
|
import { createEditor, type EditorAPI } from './core/editor'
|
|
47
48
|
import { createMention, type MentionAPI } from './core/mention'
|
|
@@ -62,7 +63,7 @@ const emit = defineEmits<{
|
|
|
62
63
|
}>()
|
|
63
64
|
|
|
64
65
|
const cls = bem('expression-editor')
|
|
65
|
-
const { formProps } =
|
|
66
|
+
const { formProps } = injectFormContext()
|
|
66
67
|
const { size, disabled, readonly } = useFormFallbackProps([formProps ?? {}, props])
|
|
67
68
|
|
|
68
69
|
const containerRef = useTemplateRef<HTMLDivElement>('container')
|
|
@@ -9,7 +9,7 @@ $root-name: expression-editor;
|
|
|
9
9
|
background-color: fn.use-var(bg-color, top);
|
|
10
10
|
border-width: fn.use-var(border, width);
|
|
11
11
|
border-style: fn.use-var(border, style);
|
|
12
|
-
border-color: fn.use-var(border, color);
|
|
12
|
+
border-color: fn.use-var(border, muted-color);
|
|
13
13
|
border-radius: fn.use-var(radius, default);
|
|
14
14
|
|
|
15
15
|
@include m.is-not(disabled, readonly) {
|
|
@@ -26,21 +26,21 @@ $root-name: expression-editor;
|
|
|
26
26
|
@include m.is('disabled') {
|
|
27
27
|
background-color: fn.use-var(color, disabled);
|
|
28
28
|
cursor: not-allowed;
|
|
29
|
-
border-color: fn.use-var(border, color);
|
|
29
|
+
border-color: fn.use-var(border, muted-color);
|
|
30
30
|
|
|
31
31
|
&:hover {
|
|
32
|
-
border-color: fn.use-var(border, color);
|
|
32
|
+
border-color: fn.use-var(border, muted-color);
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
@include m.is('readonly') {
|
|
37
37
|
background-color: fn.use-var(bg-color, middle);
|
|
38
38
|
cursor: default;
|
|
39
|
-
border-color: fn.use-var(border, color);
|
|
39
|
+
border-color: fn.use-var(border, muted-color);
|
|
40
40
|
user-select: text;
|
|
41
41
|
|
|
42
42
|
&:hover {
|
|
43
|
-
border-color: fn.use-var(border, color);
|
|
43
|
+
border-color: fn.use-var(border, muted-color);
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
|
|
@@ -31,11 +31,11 @@
|
|
|
31
31
|
|
|
32
32
|
<script lang="tsx" setup generic="Model extends FormModel | DynamicFormModel">
|
|
33
33
|
import { o } from '@cat-kit/core'
|
|
34
|
-
import { useFormComponent } from '@veltra/compositions'
|
|
35
34
|
import { bem } from '@veltra/utils'
|
|
36
35
|
import { shallowRef, toRef } from 'vue'
|
|
37
36
|
|
|
38
37
|
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'
|
|
@@ -67,7 +67,7 @@ const breakpointCols: BreakCols = {
|
|
|
67
67
|
default: 4
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
|
|
70
|
+
provideFormContext(props)
|
|
71
71
|
|
|
72
72
|
const { getSlotsNodes } = useNodeInterceptor({ props })
|
|
73
73
|
|
|
@@ -33,11 +33,12 @@
|
|
|
33
33
|
</template>
|
|
34
34
|
|
|
35
35
|
<script lang="tsx" setup>
|
|
36
|
-
import { useConfig, useFallbackProps
|
|
36
|
+
import { useConfig, useFallbackProps } from '@veltra/compositions'
|
|
37
37
|
import { bem, withUnit } from '@veltra/utils'
|
|
38
38
|
import { type CSSProperties, computed } from 'vue'
|
|
39
39
|
|
|
40
40
|
import type { FormItemProps, ComponentSize } from '../../types'
|
|
41
|
+
import { injectFormContext } from '../../utils/form-context'
|
|
41
42
|
import { UGridItem } from '../grid'
|
|
42
43
|
import { UTip } from '../tip'
|
|
43
44
|
import { formItemCls as cls } from './helper'
|
|
@@ -57,7 +58,7 @@ defineSlots<{
|
|
|
57
58
|
}>()
|
|
58
59
|
|
|
59
60
|
/** 表单组件上下文 */
|
|
60
|
-
const { formProps } =
|
|
61
|
+
const { formProps } = injectFormContext()
|
|
61
62
|
|
|
62
63
|
const { config } = useConfig()
|
|
63
64
|
|
|
@@ -12,7 +12,7 @@ $root-name: grid-input;
|
|
|
12
12
|
width: fn.use-var(form-component-height, $size);
|
|
13
13
|
height: fn.use-var(form-component-height, $size);
|
|
14
14
|
line-height: fn.use-var(form-component-height, $size);
|
|
15
|
-
border: fn.use-var(border);
|
|
15
|
+
border: fn.use-var(border-muted);
|
|
16
16
|
border-radius: fn.use-var(gap, $size);
|
|
17
17
|
outline: none;
|
|
18
18
|
text-align: center;
|
|
@@ -34,12 +34,13 @@
|
|
|
34
34
|
</template>
|
|
35
35
|
|
|
36
36
|
<script lang="ts" setup generic="GroupItem extends Record<string, any>">
|
|
37
|
-
import {
|
|
37
|
+
import { useFormFallbackProps } from '@veltra/compositions'
|
|
38
38
|
import { Minus, Plus } from '@veltra/icons/normal'
|
|
39
39
|
import { bem, FORM_EMPTY_CONTENT } from '@veltra/utils'
|
|
40
40
|
import { computed } from 'vue'
|
|
41
41
|
|
|
42
42
|
import type { GroupInputEmits, GroupInputProps } from '../../types'
|
|
43
|
+
import { injectFormContext } from '../../utils/form-context'
|
|
43
44
|
import { UButton } from '../button'
|
|
44
45
|
import { useGroupItems } from './use-group-items'
|
|
45
46
|
|
|
@@ -58,7 +59,7 @@ const emit = defineEmits<GroupInputEmits>()
|
|
|
58
59
|
|
|
59
60
|
const cls = bem('group-input')
|
|
60
61
|
|
|
61
|
-
const { formProps } =
|
|
62
|
+
const { formProps } = injectFormContext()
|
|
62
63
|
const { disabled, size, readonly } = useFormFallbackProps([formProps ?? {}, props], {
|
|
63
64
|
size: 'default',
|
|
64
65
|
disabled: false,
|
|
@@ -53,12 +53,13 @@
|
|
|
53
53
|
</template>
|
|
54
54
|
|
|
55
55
|
<script lang="tsx" setup>
|
|
56
|
-
import { useFocus,
|
|
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
59
|
import { computed, getCurrentInstance, ref, shallowRef, nextTick } from 'vue'
|
|
60
60
|
|
|
61
61
|
import type { InputEmits, InputProps, _InputExposed } from '../../types'
|
|
62
|
+
import { injectFormContext } from '../../utils/form-context'
|
|
62
63
|
import { UIcon } from '../icon'
|
|
63
64
|
|
|
64
65
|
defineOptions({
|
|
@@ -80,7 +81,7 @@ const inst = getCurrentInstance()
|
|
|
80
81
|
|
|
81
82
|
const cls = bem('input')
|
|
82
83
|
|
|
83
|
-
const { formProps } =
|
|
84
|
+
const { formProps } = injectFormContext()
|
|
84
85
|
|
|
85
86
|
const { size, disabled, readonly } = useFormFallbackProps([formProps ?? {}, props])
|
|
86
87
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type BEM, ExpandTransition } from '@veltra/utils'
|
|
2
2
|
import type { ComputedRef, InjectionKey } from 'vue'
|
|
3
3
|
|
|
4
4
|
import type { MenuProps, MenuEmits } from '../../types'
|
|
@@ -11,6 +11,7 @@ export interface MenuContext {
|
|
|
11
11
|
menuEmit: MenuEmits
|
|
12
12
|
expandedPath: Set<string>
|
|
13
13
|
size: ComputedRef<ComponentSize>
|
|
14
|
+
expandTransition: ExpandTransition
|
|
14
15
|
}
|
|
15
16
|
|
|
16
17
|
export const MenuDIKey: InjectionKey<MenuContext> = Symbol('MenuDIKey')
|