@veltra/desktop 1.0.13 → 1.0.15

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.
Files changed (166) hide show
  1. package/dist/components/action/action-group.js +110 -3
  2. package/dist/components/action/action-group.js.map +1 -1
  3. package/dist/components/action/action-group.vue.d.ts +16 -3
  4. package/dist/components/action/action.js +26 -13
  5. package/dist/components/action/action.js.map +1 -1
  6. package/dist/components/action/style.js +2 -1
  7. package/dist/components/action/style2.css +35 -7
  8. package/dist/components/batch-edit/batch-edit-form.js +106 -42
  9. package/dist/components/batch-edit/batch-edit-form.js.map +1 -1
  10. package/dist/components/batch-edit/batch-edit-list.js +84 -47
  11. package/dist/components/batch-edit/batch-edit-list.js.map +1 -1
  12. package/dist/components/batch-edit/batch-edit.js +42 -10
  13. package/dist/components/batch-edit/batch-edit.js.map +1 -1
  14. package/dist/components/batch-edit/style.js +2 -4
  15. package/dist/components/batch-edit/style2.css +202 -30
  16. package/dist/components/batch-edit/use-edit.js +45 -9
  17. package/dist/components/batch-edit/use-edit.js.map +1 -1
  18. package/dist/components/cascade/cascade.js +3 -1
  19. package/dist/components/cascade/cascade.js.map +1 -1
  20. package/dist/components/code-editor/code-editor.js +145 -49
  21. package/dist/components/code-editor/code-editor.js.map +1 -1
  22. package/dist/components/code-editor/code-editor.vue.d.ts +2 -0
  23. package/dist/components/code-editor/style2.css +87 -19
  24. package/dist/components/dialog/dialog.js +6 -2
  25. package/dist/components/dialog/dialog.js.map +1 -1
  26. package/dist/components/dialog/style2.css +2 -3
  27. package/dist/components/expression-editor/components/path-preview.js +27 -0
  28. package/dist/components/expression-editor/components/path-preview.js.map +1 -0
  29. package/dist/components/expression-editor/components/variable-picker.js +200 -153
  30. package/dist/components/expression-editor/components/variable-picker.js.map +1 -1
  31. package/dist/components/expression-editor/core/chip.js +54 -0
  32. package/dist/components/expression-editor/core/chip.js.map +1 -0
  33. package/dist/components/expression-editor/core/editor.js +425 -0
  34. package/dist/components/expression-editor/core/editor.js.map +1 -0
  35. package/dist/components/expression-editor/core/mention.js +91 -0
  36. package/dist/components/expression-editor/core/mention.js.map +1 -0
  37. package/dist/components/expression-editor/core/model.js +64 -0
  38. package/dist/components/expression-editor/core/model.js.map +1 -0
  39. package/dist/components/expression-editor/di.js +4 -10
  40. package/dist/components/expression-editor/di.js.map +1 -1
  41. package/dist/components/expression-editor/expression-editor.js +168 -114
  42. package/dist/components/expression-editor/expression-editor.js.map +1 -1
  43. package/dist/components/expression-editor/expression-editor.vue.d.ts +2 -1
  44. package/dist/components/expression-editor/style.js +0 -2
  45. package/dist/components/expression-editor/style2.css +145 -218
  46. package/dist/components/index.js +54 -54
  47. package/dist/components/layout/layout.js +12 -11
  48. package/dist/components/layout/layout.js.map +1 -1
  49. package/dist/components/multi-select/multi-select.vue.d.ts +1 -1
  50. package/dist/components/multi-tree-select/multi-tree-select.vue.d.ts +1 -1
  51. package/dist/components/number-input/number-input.js +4 -4
  52. package/dist/components/number-input/number-input.js.map +1 -1
  53. package/dist/components/pop-confirm/pop-confirm.vue.d.ts +1 -1
  54. package/dist/components/rich-text-editor/rich-text-editor.js +1 -1
  55. package/dist/components/rich-text-editor/toolbar.js +2 -2
  56. package/dist/components/steps/steps.vue.d.ts +1 -1
  57. package/dist/components/table/use-table.js +16 -0
  58. package/dist/components/table/use-table.js.map +1 -1
  59. package/dist/components/tabs/tabs-horizontal.vue.d.ts +3 -3
  60. package/dist/components/tabs/tabs-vertical.vue.d.ts +2 -2
  61. package/dist/components/tabs/tabs.vue.d.ts +3 -3
  62. package/dist/components/tip/tip.js +4 -5
  63. package/dist/components/tip/tip.js.map +1 -1
  64. package/dist/components/tip/tip.vue.d.ts +1 -1
  65. package/dist/components/tree/style2.css +18 -12
  66. package/dist/components/tree/tree-node.js +7 -4
  67. package/dist/components/tree/tree-node.js.map +1 -1
  68. package/dist/components/tree-select/tree-select.vue.d.ts +1 -1
  69. package/dist/index.d.ts +3 -3
  70. package/dist/index.js +83 -83
  71. package/dist/style.js +3 -3
  72. package/dist/types/action.d.ts +38 -4
  73. package/dist/types/cascade.d.ts +2 -3
  74. package/dist/types/code-editor.d.ts +9 -2
  75. package/dist/types/expression-editor.d.ts +9 -1
  76. package/dist/types/index.d.ts +2 -2
  77. package/package.json +11 -12
  78. package/src/components/action/action-group.vue +126 -56
  79. package/src/components/action/action.vue +35 -12
  80. package/src/components/action/style.scss +46 -10
  81. package/src/components/action/style.ts +2 -1
  82. package/src/components/batch-edit/batch-edit-form.vue +121 -45
  83. package/src/components/batch-edit/batch-edit-list.vue +56 -39
  84. package/src/components/batch-edit/batch-edit.vue +57 -6
  85. package/src/components/batch-edit/style.scss +251 -37
  86. package/src/components/batch-edit/style.ts +5 -8
  87. package/src/components/batch-edit/use-edit.ts +58 -11
  88. package/src/components/cascade/cascade.vue +3 -1
  89. package/src/components/code-editor/code-editor.vue +198 -63
  90. package/src/components/code-editor/style.scss +110 -12
  91. package/src/components/dialog/dialog.vue +6 -2
  92. package/src/components/dialog/style.scss +4 -4
  93. package/src/components/expression-editor/__test__/chip.test.ts +86 -0
  94. package/src/components/expression-editor/__test__/editor.test.ts +47 -0
  95. package/src/components/expression-editor/__test__/mention.test.ts +122 -0
  96. package/src/components/expression-editor/__test__/model.test.ts +127 -0
  97. package/src/components/expression-editor/components/path-preview.vue +32 -0
  98. package/src/components/expression-editor/components/variable-picker.vue +225 -219
  99. package/src/components/expression-editor/core/chip.ts +101 -0
  100. package/src/components/expression-editor/core/editor.ts +514 -0
  101. package/src/components/expression-editor/core/mention.ts +121 -0
  102. package/src/components/expression-editor/core/model.ts +109 -0
  103. package/src/components/expression-editor/di.ts +4 -32
  104. package/src/components/expression-editor/expression-editor.vue +184 -151
  105. package/src/components/expression-editor/style.scss +148 -219
  106. package/src/components/expression-editor/style.ts +0 -2
  107. package/src/components/layout/layout.vue +17 -19
  108. package/src/components/number-input/number-input.vue +4 -4
  109. package/src/components/table/use-table.ts +16 -0
  110. package/src/components/tip/tip.vue +4 -3
  111. package/src/components/tree/style.scss +30 -33
  112. package/src/components/tree/tree-node.vue +4 -2
  113. package/src/types/action.ts +42 -4
  114. package/src/types/cascade.ts +4 -3
  115. package/src/types/code-editor.ts +9 -2
  116. package/src/types/expression-editor.ts +9 -0
  117. package/dist/components/action/action-group.vue_vue_type_script_setup_true_lang.js +0 -65
  118. package/dist/components/action/action-group.vue_vue_type_script_setup_true_lang.js.map +0 -1
  119. package/dist/components/expression-editor/constants.js +0 -9
  120. package/dist/components/expression-editor/constants.js.map +0 -1
  121. package/dist/components/expression-editor/internal/editor-runtime/create-runtime.js +0 -47
  122. package/dist/components/expression-editor/internal/editor-runtime/create-runtime.js.map +0 -1
  123. package/dist/components/expression-editor/internal/editor-runtime/model-sync.js +0 -49
  124. package/dist/components/expression-editor/internal/editor-runtime/model-sync.js.map +0 -1
  125. package/dist/components/expression-editor/internal/features/commands/register-command-packs.js +0 -215
  126. package/dist/components/expression-editor/internal/features/commands/register-command-packs.js.map +0 -1
  127. package/dist/components/expression-editor/internal/features/drag-drop/drag-drop-service.js +0 -33
  128. package/dist/components/expression-editor/internal/features/drag-drop/drag-drop-service.js.map +0 -1
  129. package/dist/components/expression-editor/internal/features/insertion/insertion-service.js +0 -33
  130. package/dist/components/expression-editor/internal/features/insertion/insertion-service.js.map +0 -1
  131. package/dist/components/expression-editor/nodes/variable-node.js +0 -94
  132. package/dist/components/expression-editor/nodes/variable-node.js.map +0 -1
  133. package/dist/components/expression-editor/parser.js +0 -32
  134. package/dist/components/expression-editor/parser.js.map +0 -1
  135. package/dist/components/expression-editor/plain-text.js +0 -19
  136. package/dist/components/expression-editor/plain-text.js.map +0 -1
  137. package/dist/components/expression-editor/use-context.js +0 -69
  138. package/dist/components/expression-editor/use-context.js.map +0 -1
  139. package/dist/components/expression-editor/use-decorators.js +0 -27
  140. package/dist/components/expression-editor/use-decorators.js.map +0 -1
  141. package/dist/components/expression-editor/use-expression-drag-drop.js +0 -275
  142. package/dist/components/expression-editor/use-expression-drag-drop.js.map +0 -1
  143. package/src/components/batch-edit/batch-edit-new.vue +0 -168
  144. package/src/components/batch-edit/style-new.scss +0 -35
  145. package/src/components/batch-edit/use-edit-new.ts +0 -68
  146. package/src/components/batch-edit/use-tip.ts +0 -47
  147. package/src/components/expression-editor/__test__/architecture-boundaries.test.ts +0 -103
  148. package/src/components/expression-editor/__test__/architecture-compatibility.test.ts +0 -52
  149. package/src/components/expression-editor/__test__/drag-drop.test.ts +0 -171
  150. package/src/components/expression-editor/__test__/parser.test.ts +0 -62
  151. package/src/components/expression-editor/constants.ts +0 -6
  152. package/src/components/expression-editor/internal/contracts/editor-runtime.ts +0 -11
  153. package/src/components/expression-editor/internal/editor-runtime/create-runtime.ts +0 -64
  154. package/src/components/expression-editor/internal/editor-runtime/index.ts +0 -1
  155. package/src/components/expression-editor/internal/editor-runtime/model-sync.ts +0 -68
  156. package/src/components/expression-editor/internal/features/commands/register-command-packs.ts +0 -517
  157. package/src/components/expression-editor/internal/features/drag-drop/drag-drop-service.ts +0 -51
  158. package/src/components/expression-editor/internal/features/insertion/insertion-service.ts +0 -56
  159. package/src/components/expression-editor/nodes/variable-node.tsx +0 -118
  160. package/src/components/expression-editor/parser.ts +0 -46
  161. package/src/components/expression-editor/plain-text.ts +0 -25
  162. package/src/components/expression-editor/plan.md +0 -22
  163. package/src/components/expression-editor/use-context.ts +0 -134
  164. package/src/components/expression-editor/use-decorators.tsx +0 -29
  165. package/src/components/expression-editor/use-editor.ts +0 -12
  166. package/src/components/expression-editor/use-expression-drag-drop.ts +0 -396
@@ -2,7 +2,6 @@
2
2
  @use 'pkg:@veltra/styles/functions' as fn;
3
3
  @use 'pkg:@veltra/styles/vars';
4
4
 
5
- // 方便拼接
6
5
  $root-name: expression-editor;
7
6
 
8
7
  @include m.b($root-name) {
@@ -43,26 +42,6 @@ $root-name: expression-editor;
43
42
  }
44
43
  }
45
44
 
46
- @include m.e(tools) {
47
- text-align: right;
48
- margin-bottom: fn.use-var(gap, small);
49
-
50
- & > * {
51
- cursor: pointer;
52
- transition: color 0.2s ease;
53
-
54
- &:hover {
55
- color: fn.use-var(color, primary);
56
- }
57
- }
58
- }
59
-
60
- @include m.e(paragraph) {
61
- margin: 0;
62
- padding: 0;
63
- line-height: 1.6;
64
- }
65
-
66
45
  @include m.e(placeholder) {
67
46
  position: absolute;
68
47
  color: fn.use-var(text-color, placeholder);
@@ -83,213 +62,173 @@ $root-name: expression-editor;
83
62
  overflow-y: auto;
84
63
 
85
64
  &:empty::before {
86
- content: '\200b'; // Zero-width space to maintain height
87
- }
88
-
89
- .ultra-expression-variable-source {
90
- cursor: grab;
65
+ content: '\200b';
91
66
  }
92
67
 
93
- .ultra-expression-variable-source.is-dragging {
94
- opacity: 0.5;
95
- cursor: grabbing;
68
+ > [data-seg='text'] {
69
+ // 让连续中文 / 字符自然包裹;变量 chip 之间的空 text span 也能承载光标
70
+ white-space: pre-wrap;
96
71
  }
97
-
98
- .expression-editor__drop-indicator {
99
- position: absolute;
100
- width: 2px;
101
- border-radius: 999px;
102
- transform: translateX(-1px);
103
- pointer-events: none;
104
- background-color: fn.use-var(color, primary);
105
- box-shadow: 0 0 0 1px fn.use-var(color, primary, light-8);
106
- transition: opacity 0.12s ease;
107
- z-index: 3;
108
- }
109
- }
110
-
111
- @include m.e(fallback) {
112
- display: flex;
113
- flex-direction: column;
114
- gap: 6px;
115
- margin-top: 8px;
116
- padding-top: 8px;
117
- border-top: fn.use-var(border);
118
- }
119
-
120
- @include m.e(fallback-item) {
121
- display: flex;
122
- align-items: center;
123
- justify-content: space-between;
124
- gap: 8px;
125
- }
126
-
127
- @include m.e(fallback-label) {
128
- min-width: 0;
129
- flex: 1;
130
- font-size: 12px;
131
- color: fn.use-var(text-color, main);
132
- overflow: hidden;
133
- text-overflow: ellipsis;
134
- white-space: nowrap;
135
72
  }
136
73
 
137
- @include m.e(fallback-actions) {
74
+ // ─── 变量 chip ────────────────────────────────────────────────
75
+ @include m.e(chip) {
138
76
  display: inline-flex;
139
77
  align-items: center;
140
78
  gap: 4px;
141
- flex-shrink: 0;
142
- }
143
-
144
- @include m.e(fallback-button) {
145
- border: fn.use-var(border);
146
- border-radius: fn.use-var(radius, small);
147
- background-color: fn.use-var(bg-color, top);
148
- color: fn.use-var(text-color, main);
149
- font-size: 12px;
150
- line-height: 1;
151
- height: 22px;
79
+ margin: 0 2px;
152
80
  padding: 0 8px;
81
+ height: 22px;
82
+ line-height: 1;
83
+ font-size: 12px;
84
+ color: fn.use-var(color, primary);
85
+ background-color: fn.use-var(color, primary, light-9);
86
+ border-radius: 999px;
153
87
  cursor: pointer;
154
- transition: all 0.12s ease;
88
+ user-select: none;
89
+ transition:
90
+ background-color 0.12s ease,
91
+ box-shadow 0.12s ease;
155
92
 
156
- &:hover:not(:disabled) {
93
+ &:hover {
157
94
  color: fn.use-var(color, primary);
158
- border-color: fn.use-var(color, primary);
159
- background-color: fn.use-var(color, primary, light-9);
95
+ background-color: fn.use-var(color, primary, light-8);
96
+ box-shadow: 0 1px 4px fn.use-var(shadow, color);
97
+
98
+ .#{vars.$namespace}#{$root-name}__chip-close {
99
+ opacity: 1;
100
+ max-width: 14px;
101
+ margin-left: 2px;
102
+ }
160
103
  }
161
104
 
162
- &:disabled {
163
- cursor: not-allowed;
164
- color: fn.use-var(text-color, placeholder);
165
- border-color: fn.use-var(border, color);
166
- background-color: fn.use-var(bg-color, middle);
105
+ &.is-focused {
106
+ box-shadow: 0 0 0 2px fn.use-var(color, primary, light-7);
167
107
  }
168
108
  }
169
109
 
170
- @include m.size using ($size) {
171
- min-height: fn.use-var(form-component-height, $size);
172
- padding: fn.use-var(gap, $size);
173
-
174
- @include m.bem($root-name, placeholder) {
175
- top: fn.use-var(gap, $size);
176
- left: fn.use-var(gap, $size);
177
- font-size: fn.use-var(font-size-main, $size);
178
- }
110
+ @include m.e(chip-label) {
111
+ pointer-events: none;
112
+ }
179
113
 
180
- @include m.bem($root-name, container) {
181
- font-size: fn.use-var(font-size-main, $size);
182
- }
114
+ @include m.e(chip-close) {
115
+ display: inline-flex;
116
+ align-items: center;
117
+ justify-content: center;
118
+ width: 14px;
119
+ max-width: 0;
120
+ margin-left: 0;
121
+ overflow: hidden;
122
+ font-size: 14px;
123
+ line-height: 1;
124
+ color: fn.use-var(color, primary);
125
+ opacity: 0;
126
+ transition:
127
+ opacity 0.12s ease,
128
+ max-width 0.12s ease,
129
+ margin-left 0.12s ease;
130
+ cursor: pointer;
183
131
 
184
- @include m.bem($root-name, clear) {
185
- font-size: fn.use-var(font-size-main, $size);
132
+ &:hover {
133
+ transform: scale(1.1);
186
134
  }
187
135
  }
188
136
 
189
- @include m.e(variable-empty) {
190
- padding: 16px;
191
- text-align: center;
192
- color: fn.use-var(text-color, second);
193
- font-size: 13px;
194
- font-weight: 500;
195
- }
196
-
197
- @include m.e(variable-list) {
198
- padding: 6px 0;
199
- margin: 0;
200
- list-style: none;
201
- max-height: 240px;
202
- overflow-y: auto;
137
+ // ─── 变量选择面板 ──────────────────────────────────────────
138
+ @include m.e(picker) {
139
+ min-width: 220px;
203
140
  background-color: fn.use-var(bg-color, top);
141
+ }
204
142
 
205
- &::-webkit-scrollbar {
206
- width: 8px;
207
- }
143
+ @include m.e(picker-body) {
144
+ display: flex;
145
+ align-items: stretch;
146
+ min-height: 200px;
147
+ }
208
148
 
209
- &::-webkit-scrollbar-track {
210
- background-color: fn.use-var(bg-color, middle);
211
- border-radius: fn.use-var(radius, small);
212
- }
149
+ @include m.e(panel) {
150
+ flex: 1 1 auto;
151
+ min-width: 0;
152
+ max-height: 320px;
153
+ }
213
154
 
214
- &::-webkit-scrollbar-thumb {
215
- background-color: fn.use-var(text-color, placeholder);
216
- border-radius: fn.use-var(radius, small);
217
- border: 2px solid fn.use-var(bg-color, middle);
155
+ @include m.e(panel-list) {
156
+ height: 100%;
157
+ min-height: 200px;
158
+ }
218
159
 
219
- &:hover {
220
- background-color: fn.use-var(text-color, second);
221
- }
222
- }
160
+ @include m.e(panel-content) {
161
+ padding: 4px 0;
223
162
  }
224
163
 
225
- @include m.e(variable-item) {
226
- padding: 8px 14px;
227
- margin: 2px 6px;
164
+ @include m.e(item) {
165
+ padding: 6px 12px;
228
166
  cursor: pointer;
229
- transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
230
- border-radius: fn.use-var(radius, default);
231
- font-size: 13px;
167
+ user-select: none;
168
+ display: flex;
169
+ align-items: center;
170
+ justify-content: space-between;
171
+ gap: 8px;
172
+ transition:
173
+ background-color 0.12s ease,
174
+ color 0.12s ease;
232
175
  color: fn.use-var(text-color, main);
233
- font-weight: 500;
234
-
235
- &:hover {
236
- background-color: fn.use-var(color, primary, light-9);
237
- color: fn.use-var(color, primary);
238
- transform: translateX(2px);
239
- }
176
+ font-size: 13px;
177
+ line-height: 1.4;
178
+ border-radius: fn.use-var(radius, small);
179
+ margin: 1px 4px;
240
180
 
241
- @include m.is('active') {
181
+ @include m.is(active) {
242
182
  background-color: fn.use-var(color, primary);
243
183
  color: fn.use-var(text-color, white);
244
- font-weight: 600;
245
- box-shadow: 0 2px 4px fn.use-var(shadow, color);
184
+
185
+ @include m.bem($root-name, item-expand) {
186
+ color: fn.use-var(text-color, white);
187
+ }
246
188
  }
247
189
  }
248
190
 
249
- @include m.e(filter) {
250
- padding: 6px;
251
- border-bottom: fn.use-var(border);
191
+ @include m.e(item-label) {
192
+ flex: 1;
193
+ overflow: hidden;
194
+ text-overflow: ellipsis;
195
+ white-space: nowrap;
196
+ }
197
+
198
+ @include m.e(item-expand) {
199
+ flex-shrink: 0;
200
+ color: fn.use-var(text-color, placeholder);
201
+ font-size: 12px;
252
202
  }
253
203
 
204
+ @include m.e(empty) {
205
+ flex: 1;
206
+ padding: 32px 16px;
207
+ text-align: center;
208
+ }
209
+
210
+ // ─── 面包屑 ───────────────────────────────────────────────
254
211
  @include m.e(breadcrumbs) {
255
212
  display: flex;
256
213
  align-items: center;
214
+ flex-wrap: wrap;
257
215
  padding: 6px 10px;
258
216
  border-bottom: fn.use-var(border);
259
- background-color: fn.use-var(bg-color, middle);
260
217
  font-size: 12px;
261
218
  color: fn.use-var(text-color, second);
262
- overflow-x: auto;
263
- white-space: nowrap;
264
-
265
- &::-webkit-scrollbar {
266
- height: 4px;
267
- }
268
-
269
- &::-webkit-scrollbar-track {
270
- background-color: transparent;
271
- }
272
-
273
- &::-webkit-scrollbar-thumb {
274
- background-color: fn.use-var(border, color);
275
- border-radius: 2px;
276
-
277
- &:hover {
278
- background-color: fn.use-var(text-color, placeholder);
279
- }
280
- }
281
219
  }
282
220
 
283
221
  @include m.e(breadcrumb-item) {
284
- display: flex;
222
+ display: inline-flex;
285
223
  align-items: center;
286
224
  gap: 4px;
287
225
  }
288
226
 
289
227
  @include m.e(breadcrumb-link) {
290
228
  cursor: pointer;
291
- transition: all 0.15s ease;
292
- font-weight: 500;
229
+ transition:
230
+ color 0.12s ease,
231
+ background-color 0.12s ease;
293
232
  padding: 2px 6px;
294
233
  border-radius: fn.use-var(radius, small);
295
234
 
@@ -307,74 +246,64 @@ $root-name: expression-editor;
307
246
  @include m.e(breadcrumb-separator) {
308
247
  font-size: 10px;
309
248
  color: fn.use-var(text-color, placeholder);
310
- margin: 0 2px;
311
249
  }
312
250
 
313
- @include m.e(panel) {
314
- min-height: 200px;
315
- max-height: 360px;
251
+ // ─── 路径预览(扁平模式专用) ────────────────────────────────
252
+ @include m.e(path-preview) {
253
+ flex: 0 0 200px;
254
+ border-left: fn.use-var(border);
255
+ padding: 8px 12px;
256
+ background-color: fn.use-var(bg-color, middle);
257
+ font-size: 12px;
316
258
  }
317
259
 
318
- @include m.e(panel-list) {
319
- height: 100%;
320
- min-height: 200px;
260
+ @include m.e(path-preview-title) {
261
+ color: fn.use-var(text-color, second);
262
+ margin-bottom: 6px;
263
+ font-weight: 600;
321
264
  }
322
265
 
323
- @include m.e(panel-content) {
324
- padding: 2px 0;
266
+ @include m.e(path-tree) {
267
+ list-style: none;
268
+ margin: 0;
269
+ padding: 0;
325
270
  }
326
271
 
327
- @include m.e(item) {
328
- padding: 5px 10px;
329
- cursor: pointer;
330
- user-select: none;
272
+ @include m.e(path-tree-item) {
331
273
  display: flex;
332
274
  align-items: center;
333
- justify-content: space-between;
334
- gap: 8px;
335
- transition: all 0.12s ease;
275
+ gap: 4px;
276
+ line-height: 1.6;
336
277
  color: fn.use-var(text-color, main);
337
- font-size: 13px;
338
- line-height: 1.4;
339
- border-radius: fn.use-var(radius, small);
340
- margin: 1px 4px;
341
-
342
- &:hover {
343
- background-color: fn.use-var(bg-color, hover);
344
- }
345
278
 
346
279
  @include m.is(active) {
347
- background-color: fn.use-var(color, primary);
348
- color: fn.use-var(text-color, white);
349
- font-weight: 500;
350
- box-shadow: 0 1px 3px fn.use-var(shadow, color);
351
-
352
- @include m.bem($root-name, item-expand) {
353
- color: fn.use-var(text-color, white);
354
- }
280
+ color: fn.use-var(color, primary);
281
+ font-weight: 600;
355
282
  }
283
+ }
356
284
 
357
- @include m.is(leaf) {
358
- // 叶子节点样式
359
- }
285
+ @include m.e(path-tree-branch) {
286
+ color: fn.use-var(text-color, placeholder);
360
287
  }
361
288
 
362
- @include m.e(item-label) {
363
- flex: 1;
289
+ @include m.e(path-tree-label) {
364
290
  overflow: hidden;
365
291
  text-overflow: ellipsis;
366
292
  white-space: nowrap;
367
293
  }
368
294
 
369
- @include m.e(item-expand) {
370
- flex-shrink: 0;
371
- color: fn.use-var(text-color, placeholder);
372
- font-size: 11px;
373
- transition: color 0.15s ease;
374
- }
295
+ @include m.size using ($size) {
296
+ min-height: fn.use-var(form-component-height, $size);
297
+ padding: fn.use-var(gap, $size);
375
298
 
376
- @include m.e(empty) {
377
- padding: 40px 20px;
378
- text-align: center;
299
+ @include m.bem($root-name, placeholder) {
300
+ top: fn.use-var(gap, $size);
301
+ left: fn.use-var(gap, $size);
302
+ font-size: fn.use-var(font-size-main, $size);
303
+ }
304
+
305
+ @include m.bem($root-name, container) {
306
+ font-size: fn.use-var(font-size-main, $size);
307
+ }
379
308
  }
380
309
  }
@@ -1,7 +1,5 @@
1
1
  import '../tip/style'
2
- import '../input/style'
3
2
  import '../icon/style'
4
3
  import '../scroll/style'
5
4
  import '../empty/style'
6
- import '../tag/style'
7
5
  import './style.scss'
@@ -59,7 +59,7 @@ watchEffect(() => {
59
59
  templateCols.value = []
60
60
  return
61
61
  }
62
- templateCols.value = typeof cols === 'string' ? cols.split(' ') : cols
62
+ templateCols.value = typeof cols === 'string' ? cols.split(' ') : [...cols]
63
63
  })
64
64
 
65
65
  const style = computed<CSSProperties>(() => {
@@ -109,27 +109,25 @@ useResizeObserver({
109
109
 
110
110
  // const resizing = shallowRef(false)
111
111
 
112
- let prevSize = '0'
113
- let nextSize = '0'
112
+ let prevSize = 0
113
+ let nextSize = 0
114
114
  const handleStartResize = (index: number) => {
115
- prevSize = templateCols.value[index]!
116
- nextSize = templateCols.value[index + 1]!
117
-
118
- if (!prevSize.endsWith('px') && !nextSize.endsWith('px')) {
119
- const rect = containerRef.value?.children[index + 1]?.getBoundingClientRect()
120
- if (rect) {
121
- nextSize = rect.width + 'px'
122
- }
123
- }
124
- // resizing.value = true
115
+ const container = containerRef.value
116
+ if (!container) return
117
+
118
+ // 拖拽前把相邻两列按实际渲染宽度固定成 px,
119
+ // 这样拖拽时两列等量增减、容器整体宽度保持不变。
120
+ const prevDom = container.children[index] as HTMLElement | undefined
121
+ const nextDom = container.children[index + 1] as HTMLElement | undefined
122
+ prevSize = prevDom ? prevDom.getBoundingClientRect().width : 0
123
+ nextSize = nextDom ? nextDom.getBoundingClientRect().width : 0
125
124
  }
126
125
  const handleResize = (offset: number, index: number) => {
127
- if (prevSize?.endsWith('px')) {
128
- templateCols.value[index] = `${parseInt(prevSize) + offset}px`
129
- }
130
- if (nextSize?.endsWith('px')) {
131
- templateCols.value[index + 1] = `${parseInt(nextSize) - offset}px`
132
- }
126
+ // 钳位到 [-prevSize, nextSize],避免轨道尺寸出现负值——
127
+ // 一旦 grid-template-columns 中带负值,整条声明会被浏览器丢弃。
128
+ const clamped = Math.max(-prevSize, Math.min(nextSize, offset))
129
+ templateCols.value[index] = `${prevSize + clamped}px`
130
+ templateCols.value[index + 1] = `${nextSize - clamped}px`
133
131
  }
134
132
 
135
133
  provide(LayoutDIKey, {
@@ -181,9 +181,9 @@ function getDisplayed(num?: number): string {
181
181
 
182
182
  watch(
183
183
  [model, focused, () => props.currency],
184
- ([model, focused]) => {
185
- if (focused) return
186
- displayed.value = getDisplayed(model)
184
+ ([modelValue, inputFocused]) => {
185
+ if (inputFocused) return
186
+ displayed.value = getDisplayed(modelValue)
187
187
  },
188
188
  { immediate: true }
189
189
  )
@@ -248,7 +248,7 @@ function getValidValue<T extends undefined | number>(val: T): T {
248
248
 
249
249
  function handleUpdateModelValue(input: string): void {
250
250
  const newVal = parseDisplayed(input)
251
- model.value = getValidValue(newVal) ?? 0
251
+ model.value = getValidValue(newVal)
252
252
  displayed.value = input
253
253
  }
254
254
 
@@ -103,7 +103,21 @@ export function useTable(options: Options): UseTableReturn {
103
103
  headerCellClassCache = new WeakMap()
104
104
  })
105
105
 
106
+ /**
107
+ * B2: 即便缓存命中也需读取 `leftFixed` / `rightFixed`,将其登记为调用方
108
+ * render effect 的响应式依赖。
109
+ *
110
+ * 否则横向滚动时虽然 `watch` 已经清空缓存,但已渲染的单元格没有任何依赖
111
+ * 把这两个 ref 串联到自己的 render,导致 `is-last-fixed` / `is-first-fixed`
112
+ * 阴影 class 不会被刷新——只有垂直滚动让虚拟列表新挂载行时(render 首次
113
+ * 命中空缓存读到最新值)才能看到阴影。
114
+ *
115
+ * 父级 `useTable` 的 watch effect id 早于子 `TableRow` 的 render effect,
116
+ * 同一 flush 周期中缓存会先被清空,再轮到 render 重跑读到最新值。
117
+ */
106
118
  const getCellClass = (column: ColumnNode): string => {
119
+ void leftFixed.value
120
+ void rightFixed.value
107
121
  const cached = cellClassCache.get(column)
108
122
  if (cached !== undefined) return cached
109
123
  const result = getCommonClassName(column) + ` ${bem.is(column.align)}`
@@ -112,6 +126,8 @@ export function useTable(options: Options): UseTableReturn {
112
126
  }
113
127
 
114
128
  const getHeaderCellClass = (column: ColumnNode): string => {
129
+ void leftFixed.value
130
+ void rightFixed.value
115
131
  const cached = headerCellClassCache.get(column)
116
132
  if (cached !== undefined) return cached
117
133
  const result = getCommonClassName(column) + ` ${bem.is(column.headerAlign)}`
@@ -141,7 +141,7 @@ const triggerDom = computed(() => {
141
141
  return props.triggerDom || triggerRef.value?.$el
142
142
  })
143
143
 
144
- const { popperContainerId } = usePop({
144
+ const { update, popperContainerId } = usePop({
145
145
  triggerRef: triggerDom,
146
146
  contentRef,
147
147
  arrowRef,
@@ -155,8 +155,9 @@ const { popperContainerId } = usePop({
155
155
  watch(triggerDom, (dom) => {
156
156
  // TODO: 看起来不是很优雅
157
157
  if (dom?.nodeType === Node.ELEMENT_NODE && visible.value) {
158
- close()
159
- nextTick(() => open())
158
+ nextTick(() => {
159
+ void update()
160
+ })
160
161
  }
161
162
  })
162
163