@veltra/desktop 1.5.0 → 1.6.1

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.
@@ -47,8 +47,8 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
47
47
  ];
48
48
  });
49
49
  const ripple = computed(() => {
50
- if (props.disabled || props.loading) return false;
51
- if ((props.plain || props.text) && props.type) return bem.is(`ripple-${props.type}`);
50
+ if (props.disabled || props.loading || props.text) return false;
51
+ if (props.plain && props.type) return bem.is(`ripple-${props.type}`);
52
52
  return true;
53
53
  });
54
54
  const handleClick = (e) => {
@@ -1 +1 @@
1
- {"version":3,"file":"button.js","names":[],"sources":["../../../src/components/button/button.vue"],"sourcesContent":["<template>\n <button\n :class=\"classList\"\n type=\"button\"\n aria-label=\"button\"\n ref=\"buttonRef\"\n v-ripple=\"ripple\"\n @click=\"handleClick\"\n >\n <!-- 加载图标 -->\n <u-icon v-if=\"loading\" :class=\"[bem.is('loading')]\" :size=\"iconSize\">\n <component :is=\"loadingIcon\" />\n </u-icon>\n\n <!-- 左侧图标 -->\n <u-icon v-if=\"!!icon && iconPosition === 'left' && !loading\" :size=\"iconSize\">\n <component :is=\"icon\" />\n </u-icon>\n\n <slot />\n\n <!-- 右侧图标 -->\n <u-icon v-if=\"!!icon && iconPosition === 'right'\" :size=\"iconSize\">\n <component :is=\"icon\" />\n </u-icon>\n </button>\n</template>\n\n<script lang=\"ts\" setup>\nimport { useFallbackProps } from '@veltra/compositions'\nimport { vRipple } from '@veltra/directives'\nimport { Loading } from '@veltra/icons'\nimport { bem } from '@veltra/utils'\nimport { computed, shallowRef } from 'vue'\n\nimport type { ButtonEmits, ButtonProps, _ButtonExposed, ComponentSize } from '../../types'\nimport { UIcon } from '../icon'\n\ndefineOptions({ name: 'UButton' })\n\nconst props = withDefaults(defineProps<ButtonProps>(), {\n iconPosition: 'left',\n loadingIcon: () => Loading,\n disabled: false,\n propagate: true\n})\n\nconst { size } = useFallbackProps([props], { size: 'default' as ComponentSize })\n\nconst emit = defineEmits<ButtonEmits>()\n\nconst cls = bem('button')\n\nconst classList = computed(() => {\n return [\n cls.b,\n cls.m(size.value),\n props.type && cls.m('color-' + props.type),\n bem.is('circle', props.circle),\n bem.is('disabled', props.disabled),\n bem.is('loading', props.loading),\n bem.is('plain', props.plain),\n bem.is('text', props.text)\n ]\n})\n\nconst ripple = computed(() => {\n if (props.disabled || props.loading) return false\n if ((props.plain || props.text) && props.type) {\n return bem.is(`ripple-${props.type}`)\n }\n return true\n})\n\nconst handleClick = (e: MouseEvent) => {\n if (props.disabled || props.loading) {\n e.stopPropagation()\n return\n }\n\n !props.propagate && e.stopPropagation()\n\n emit('click', e)\n}\n\nconst buttonRef = shallowRef<HTMLButtonElement>()\n\nconst exposed: _ButtonExposed = { el: buttonRef }\n\ndefineExpose(exposed)\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAwCA,MAAM,QAAQ;EAOd,MAAM,EAAE,SAAS,iBAAiB,CAAC,KAAK,GAAG,EAAE,MAAM,UAA2B,CAAC;EAE/E,MAAM,OAAO;EAEb,MAAM,MAAM,IAAI,QAAQ;EAExB,MAAM,YAAY,eAAe;GAC/B,OAAO;IACL,IAAI;IACJ,IAAI,EAAE,KAAK,KAAK;IAChB,MAAM,QAAQ,IAAI,EAAE,WAAW,MAAM,IAAI;IACzC,IAAI,GAAG,UAAU,MAAM,MAAM;IAC7B,IAAI,GAAG,YAAY,MAAM,QAAQ;IACjC,IAAI,GAAG,WAAW,MAAM,OAAO;IAC/B,IAAI,GAAG,SAAS,MAAM,KAAK;IAC3B,IAAI,GAAG,QAAQ,MAAM,IAAI;GAC3B;EACF,CAAC;EAED,MAAM,SAAS,eAAe;GAC5B,IAAI,MAAM,YAAY,MAAM,SAAS,OAAO;GAC5C,KAAK,MAAM,SAAS,MAAM,SAAS,MAAM,MACvC,OAAO,IAAI,GAAG,UAAU,MAAM,MAAM;GAEtC,OAAO;EACT,CA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esContent":["<template>\n <button\n :class=\"classList\"\n type=\"button\"\n aria-label=\"button\"\n ref=\"buttonRef\"\n v-ripple=\"ripple\"\n @click=\"handleClick\"\n >\n <!-- 加载图标 -->\n <u-icon v-if=\"loading\" :class=\"[bem.is('loading')]\" :size=\"iconSize\">\n <component :is=\"loadingIcon\" />\n </u-icon>\n\n <!-- 左侧图标 -->\n <u-icon v-if=\"!!icon && iconPosition === 'left' && !loading\" :size=\"iconSize\">\n <component :is=\"icon\" />\n </u-icon>\n\n <slot />\n\n <!-- 右侧图标 -->\n <u-icon v-if=\"!!icon && iconPosition === 'right'\" :size=\"iconSize\">\n <component :is=\"icon\" />\n </u-icon>\n </button>\n</template>\n\n<script lang=\"ts\" setup>\nimport { useFallbackProps } from '@veltra/compositions'\nimport { vRipple } from '@veltra/directives'\nimport { Loading } from '@veltra/icons'\nimport { bem } from '@veltra/utils'\nimport { computed, shallowRef } from 'vue'\n\nimport type { ButtonEmits, ButtonProps, _ButtonExposed, ComponentSize } from '../../types'\nimport { UIcon } from '../icon'\n\ndefineOptions({ name: 'UButton' })\n\nconst props = withDefaults(defineProps<ButtonProps>(), {\n iconPosition: 'left',\n loadingIcon: () => Loading,\n disabled: false,\n propagate: true\n})\n\nconst { size } = useFallbackProps([props], { size: 'default' as ComponentSize })\n\nconst emit = defineEmits<ButtonEmits>()\n\nconst cls = bem('button')\n\nconst classList = computed(() => {\n return [\n cls.b,\n cls.m(size.value),\n props.type && cls.m('color-' + props.type),\n bem.is('circle', props.circle),\n bem.is('disabled', props.disabled),\n bem.is('loading', props.loading),\n bem.is('plain', props.plain),\n bem.is('text', props.text)\n ]\n})\n\nconst ripple = computed(() => {\n if (props.disabled || props.loading || props.text) return false\n if (props.plain && props.type) {\n return bem.is(`ripple-${props.type}`)\n }\n return true\n})\n\nconst handleClick = (e: MouseEvent) => {\n if (props.disabled || props.loading) {\n e.stopPropagation()\n return\n }\n\n !props.propagate && e.stopPropagation()\n\n emit('click', e)\n}\n\nconst buttonRef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,eAAA,CAAG,MAAA,GAAA,CAAG,CAAC,GAAE,SAAA,CAAA,CAAA;KAAe,MAAM,QAAA;;KAC1B,SAAA,cAAA,EAAA,UAAA,GAA/B,YAA+B,wBAAf,QAAA,WAAW,CAAA,EAAA,CAAA;;;IAG7B,mBAAA,QAAA;IACgB,CAAA,CAAA,QAAA,QAAQ,QAAA,iBAAY,UAAA,CAAgB,QAAA,WAAA,UAAA,GAApD,YAES,MAAA,WAAA,GAAA;;KAFqD,MAAM,QAAA;;KAC1C,SAAA,cAAA,EAAA,UAAA,GAAxB,YAAwB,wBAAR,QAAA,IAAI,CAAA,EAAA,CAAA;;;IAGtB,WAAQ,KAAA,QAAA,SAAA;IAER,mBAAA,QAAA;IACgB,CAAA,CAAA,QAAA,QAAQ,QAAA,iBAAY,WAAA,UAAA,GAApC,YAES,MAAA,WAAA,GAAA;;KAF0C,MAAM,QAAA;;KAC/B,SAAA,cAAA,EAAA,UAAA,GAAxB,YAAwB,wBAAR,QAAA,IAAI,CAAA,EAAA,CAAA;;;GAjBZ,GAAA,CAAA,IAAA,CAAA,CAAA,MAAA,OAAA,GAAA,OAAA,KAAM,CAAA,CAAA"}
@@ -51,16 +51,9 @@
51
51
  box-shadow: none !important;
52
52
  }
53
53
  .u-button.is-plain {
54
- background-color: var(--u-bg-color-top);
55
- border-color: var(--u-color-default-dark-1);
54
+ border-color: transparent;
56
55
  box-shadow: none;
57
56
  }
58
- .u-button.is-plain:hover {
59
- border-color: var(--u-color-default-dark-1);
60
- }
61
- .u-button.is-plain.is-disabled {
62
- color: var(--u-text-color-second);
63
- }
64
57
  .u-button--small {
65
58
  height: var(--u-form-component-height-small);
66
59
  line-height: var(--u-form-component-height-small);
@@ -133,37 +126,37 @@
133
126
  }
134
127
  .u-button--color-primary.is-text {
135
128
  color: var(--u-color-primary);
129
+ border-color: transparent;
136
130
  box-shadow: none;
137
131
  }
138
- .u-button--color-primary.is-text:hover {
139
- box-shadow: 0px 0px 0px 1px var(--u-color-primary);
140
- }
141
132
  .u-button--color-primary.is-text:not(.is-disabled):not(.is-loading):hover, .u-button--color-primary.is-text:not(.is-disabled):not(.is-loading):focus {
142
133
  background-color: var(--u-button-primary-plain-bg, var(--u-color-primary-light-9));
143
134
  }
144
135
  .u-button--color-primary.is-text.is-disabled {
136
+ border-color: transparent;
145
137
  color: var(--u-color-primary-light-5);
146
138
  }
147
139
  .u-button--color-primary.is-text.is-loading {
140
+ border-color: transparent;
148
141
  color: var(--u-color-primary-light-5);
149
142
  }
150
143
  .u-button--color-primary.is-plain {
144
+ border-color: transparent;
151
145
  color: var(--u-button-primary-plain-color, var(--u-color-primary));
152
146
  background-color: var(--u-button-primary-plain-bg, var(--u-color-primary-light-9));
153
- border-color: var(--u-button-primary-plain-border, var(--u-color-primary-light-5));
154
- box-shadow: none;
155
147
  }
156
148
  .u-button--color-primary.is-plain:not(.is-disabled):not(.is-loading):hover {
157
- color: var(--u-color-primary);
158
- border-color: var(--u-color-primary);
159
- background-color: var(--u-color-primary-light-9);
160
- }
161
- .u-button--color-primary.is-plain:active {
162
- box-shadow: none;
149
+ background-color: var(--u-color-primary-light-7);
163
150
  }
164
151
  .u-button--color-primary.is-plain.is-disabled {
152
+ border-color: transparent;
165
153
  color: var(--u-color-primary-light-5);
166
- border-color: var(--u-color-primary-light-8);
154
+ background-color: var(--u-color-primary-light-9);
155
+ }
156
+ .u-button--color-primary.is-plain.is-loading {
157
+ border-color: transparent;
158
+ color: var(--u-color-primary-light-5);
159
+ background-color: var(--u-color-primary-light-9);
167
160
  }
168
161
  .u-button .is-ripple-success {
169
162
  background-color: var(--u-color-success);
@@ -193,37 +186,37 @@
193
186
  }
194
187
  .u-button--color-success.is-text {
195
188
  color: var(--u-color-success);
189
+ border-color: transparent;
196
190
  box-shadow: none;
197
191
  }
198
- .u-button--color-success.is-text:hover {
199
- box-shadow: 0px 0px 0px 1px var(--u-color-success);
200
- }
201
192
  .u-button--color-success.is-text:not(.is-disabled):not(.is-loading):hover, .u-button--color-success.is-text:not(.is-disabled):not(.is-loading):focus {
202
193
  background-color: var(--u-button-success-plain-bg, var(--u-color-success-light-9));
203
194
  }
204
195
  .u-button--color-success.is-text.is-disabled {
196
+ border-color: transparent;
205
197
  color: var(--u-color-success-light-5);
206
198
  }
207
199
  .u-button--color-success.is-text.is-loading {
200
+ border-color: transparent;
208
201
  color: var(--u-color-success-light-5);
209
202
  }
210
203
  .u-button--color-success.is-plain {
204
+ border-color: transparent;
211
205
  color: var(--u-button-success-plain-color, var(--u-color-success));
212
206
  background-color: var(--u-button-success-plain-bg, var(--u-color-success-light-9));
213
- border-color: var(--u-button-success-plain-border, var(--u-color-success-light-5));
214
- box-shadow: none;
215
207
  }
216
208
  .u-button--color-success.is-plain:not(.is-disabled):not(.is-loading):hover {
217
- color: var(--u-color-success);
218
- border-color: var(--u-color-success);
219
- background-color: var(--u-color-success-light-9);
220
- }
221
- .u-button--color-success.is-plain:active {
222
- box-shadow: none;
209
+ background-color: var(--u-color-success-light-7);
223
210
  }
224
211
  .u-button--color-success.is-plain.is-disabled {
212
+ border-color: transparent;
225
213
  color: var(--u-color-success-light-5);
226
- border-color: var(--u-color-success-light-8);
214
+ background-color: var(--u-color-success-light-9);
215
+ }
216
+ .u-button--color-success.is-plain.is-loading {
217
+ border-color: transparent;
218
+ color: var(--u-color-success-light-5);
219
+ background-color: var(--u-color-success-light-9);
227
220
  }
228
221
  .u-button .is-ripple-warning {
229
222
  background-color: var(--u-color-warning);
@@ -253,37 +246,37 @@
253
246
  }
254
247
  .u-button--color-warning.is-text {
255
248
  color: var(--u-color-warning);
249
+ border-color: transparent;
256
250
  box-shadow: none;
257
251
  }
258
- .u-button--color-warning.is-text:hover {
259
- box-shadow: 0px 0px 0px 1px var(--u-color-warning);
260
- }
261
252
  .u-button--color-warning.is-text:not(.is-disabled):not(.is-loading):hover, .u-button--color-warning.is-text:not(.is-disabled):not(.is-loading):focus {
262
253
  background-color: var(--u-button-warning-plain-bg, var(--u-color-warning-light-9));
263
254
  }
264
255
  .u-button--color-warning.is-text.is-disabled {
256
+ border-color: transparent;
265
257
  color: var(--u-color-warning-light-5);
266
258
  }
267
259
  .u-button--color-warning.is-text.is-loading {
260
+ border-color: transparent;
268
261
  color: var(--u-color-warning-light-5);
269
262
  }
270
263
  .u-button--color-warning.is-plain {
264
+ border-color: transparent;
271
265
  color: var(--u-button-warning-plain-color, var(--u-color-warning));
272
266
  background-color: var(--u-button-warning-plain-bg, var(--u-color-warning-light-9));
273
- border-color: var(--u-button-warning-plain-border, var(--u-color-warning-light-5));
274
- box-shadow: none;
275
267
  }
276
268
  .u-button--color-warning.is-plain:not(.is-disabled):not(.is-loading):hover {
277
- color: var(--u-color-warning);
278
- border-color: var(--u-color-warning);
279
- background-color: var(--u-color-warning-light-9);
280
- }
281
- .u-button--color-warning.is-plain:active {
282
- box-shadow: none;
269
+ background-color: var(--u-color-warning-light-7);
283
270
  }
284
271
  .u-button--color-warning.is-plain.is-disabled {
272
+ border-color: transparent;
285
273
  color: var(--u-color-warning-light-5);
286
- border-color: var(--u-color-warning-light-8);
274
+ background-color: var(--u-color-warning-light-9);
275
+ }
276
+ .u-button--color-warning.is-plain.is-loading {
277
+ border-color: transparent;
278
+ color: var(--u-color-warning-light-5);
279
+ background-color: var(--u-color-warning-light-9);
287
280
  }
288
281
  .u-button .is-ripple-danger {
289
282
  background-color: var(--u-color-danger);
@@ -313,37 +306,37 @@
313
306
  }
314
307
  .u-button--color-danger.is-text {
315
308
  color: var(--u-color-danger);
309
+ border-color: transparent;
316
310
  box-shadow: none;
317
311
  }
318
- .u-button--color-danger.is-text:hover {
319
- box-shadow: 0px 0px 0px 1px var(--u-color-danger);
320
- }
321
312
  .u-button--color-danger.is-text:not(.is-disabled):not(.is-loading):hover, .u-button--color-danger.is-text:not(.is-disabled):not(.is-loading):focus {
322
313
  background-color: var(--u-button-danger-plain-bg, var(--u-color-danger-light-9));
323
314
  }
324
315
  .u-button--color-danger.is-text.is-disabled {
316
+ border-color: transparent;
325
317
  color: var(--u-color-danger-light-5);
326
318
  }
327
319
  .u-button--color-danger.is-text.is-loading {
320
+ border-color: transparent;
328
321
  color: var(--u-color-danger-light-5);
329
322
  }
330
323
  .u-button--color-danger.is-plain {
324
+ border-color: transparent;
331
325
  color: var(--u-button-danger-plain-color, var(--u-color-danger));
332
326
  background-color: var(--u-button-danger-plain-bg, var(--u-color-danger-light-9));
333
- border-color: var(--u-button-danger-plain-border, var(--u-color-danger-light-5));
334
- box-shadow: none;
335
327
  }
336
328
  .u-button--color-danger.is-plain:not(.is-disabled):not(.is-loading):hover {
337
- color: var(--u-color-danger);
338
- border-color: var(--u-color-danger);
339
- background-color: var(--u-color-danger-light-9);
340
- }
341
- .u-button--color-danger.is-plain:active {
342
- box-shadow: none;
329
+ background-color: var(--u-color-danger-light-7);
343
330
  }
344
331
  .u-button--color-danger.is-plain.is-disabled {
332
+ border-color: transparent;
345
333
  color: var(--u-color-danger-light-5);
346
- border-color: var(--u-color-danger-light-8);
334
+ background-color: var(--u-color-danger-light-9);
335
+ }
336
+ .u-button--color-danger.is-plain.is-loading {
337
+ border-color: transparent;
338
+ color: var(--u-color-danger-light-5);
339
+ background-color: var(--u-color-danger-light-9);
347
340
  }
348
341
  .u-button .is-ripple-info {
349
342
  background-color: var(--u-color-info);
@@ -373,37 +366,37 @@
373
366
  }
374
367
  .u-button--color-info.is-text {
375
368
  color: var(--u-color-info);
369
+ border-color: transparent;
376
370
  box-shadow: none;
377
371
  }
378
- .u-button--color-info.is-text:hover {
379
- box-shadow: 0px 0px 0px 1px var(--u-color-info);
380
- }
381
372
  .u-button--color-info.is-text:not(.is-disabled):not(.is-loading):hover, .u-button--color-info.is-text:not(.is-disabled):not(.is-loading):focus {
382
373
  background-color: var(--u-button-info-plain-bg, var(--u-color-info-light-9));
383
374
  }
384
375
  .u-button--color-info.is-text.is-disabled {
376
+ border-color: transparent;
385
377
  color: var(--u-color-info-light-5);
386
378
  }
387
379
  .u-button--color-info.is-text.is-loading {
380
+ border-color: transparent;
388
381
  color: var(--u-color-info-light-5);
389
382
  }
390
383
  .u-button--color-info.is-plain {
384
+ border-color: transparent;
391
385
  color: var(--u-button-info-plain-color, var(--u-color-info));
392
386
  background-color: var(--u-button-info-plain-bg, var(--u-color-info-light-9));
393
- border-color: var(--u-button-info-plain-border, var(--u-color-info-light-5));
394
- box-shadow: none;
395
387
  }
396
388
  .u-button--color-info.is-plain:not(.is-disabled):not(.is-loading):hover {
397
- color: var(--u-color-info);
398
- border-color: var(--u-color-info);
399
- background-color: var(--u-color-info-light-9);
400
- }
401
- .u-button--color-info.is-plain:active {
402
- box-shadow: none;
389
+ background-color: var(--u-color-info-light-7);
403
390
  }
404
391
  .u-button--color-info.is-plain.is-disabled {
392
+ border-color: transparent;
405
393
  color: var(--u-color-info-light-5);
406
- border-color: var(--u-color-info-light-8);
394
+ background-color: var(--u-color-info-light-9);
395
+ }
396
+ .u-button--color-info.is-plain.is-loading {
397
+ border-color: transparent;
398
+ color: var(--u-color-info-light-5);
399
+ background-color: var(--u-color-info-light-9);
407
400
  }
408
401
  .u-button .is-ripple-disabled {
409
402
  background-color: var(--u-color-disabled);
@@ -433,37 +426,37 @@
433
426
  }
434
427
  .u-button--color-disabled.is-text {
435
428
  color: var(--u-color-disabled);
429
+ border-color: transparent;
436
430
  box-shadow: none;
437
431
  }
438
- .u-button--color-disabled.is-text:hover {
439
- box-shadow: 0px 0px 0px 1px var(--u-color-disabled);
440
- }
441
432
  .u-button--color-disabled.is-text:not(.is-disabled):not(.is-loading):hover, .u-button--color-disabled.is-text:not(.is-disabled):not(.is-loading):focus {
442
433
  background-color: var(--u-button-disabled-plain-bg, var(--u-color-disabled-light-9));
443
434
  }
444
435
  .u-button--color-disabled.is-text.is-disabled {
436
+ border-color: transparent;
445
437
  color: var(--u-color-disabled-light-5);
446
438
  }
447
439
  .u-button--color-disabled.is-text.is-loading {
440
+ border-color: transparent;
448
441
  color: var(--u-color-disabled-light-5);
449
442
  }
450
443
  .u-button--color-disabled.is-plain {
444
+ border-color: transparent;
451
445
  color: var(--u-button-disabled-plain-color, var(--u-color-disabled));
452
446
  background-color: var(--u-button-disabled-plain-bg, var(--u-color-disabled-light-9));
453
- border-color: var(--u-button-disabled-plain-border, var(--u-color-disabled-light-5));
454
- box-shadow: none;
455
447
  }
456
448
  .u-button--color-disabled.is-plain:not(.is-disabled):not(.is-loading):hover {
457
- color: var(--u-color-disabled);
458
- border-color: var(--u-color-disabled);
459
- background-color: var(--u-color-disabled-light-9);
460
- }
461
- .u-button--color-disabled.is-plain:active {
462
- box-shadow: none;
449
+ background-color: var(--u-color-disabled-light-7);
463
450
  }
464
451
  .u-button--color-disabled.is-plain.is-disabled {
452
+ border-color: transparent;
465
453
  color: var(--u-color-disabled-light-5);
466
- border-color: var(--u-color-disabled-light-8);
454
+ background-color: var(--u-color-disabled-light-9);
455
+ }
456
+ .u-button--color-disabled.is-plain.is-loading {
457
+ border-color: transparent;
458
+ color: var(--u-color-disabled-light-5);
459
+ background-color: var(--u-color-disabled-light-9);
467
460
  }
468
461
  .u-button .is-ripple-default {
469
462
  background-color: var(--u-color-default);
@@ -493,37 +486,37 @@
493
486
  }
494
487
  .u-button--color-default.is-text {
495
488
  color: var(--u-color-default);
489
+ border-color: transparent;
496
490
  box-shadow: none;
497
491
  }
498
- .u-button--color-default.is-text:hover {
499
- box-shadow: 0px 0px 0px 1px var(--u-color-default);
500
- }
501
492
  .u-button--color-default.is-text:not(.is-disabled):not(.is-loading):hover, .u-button--color-default.is-text:not(.is-disabled):not(.is-loading):focus {
502
493
  background-color: var(--u-button-default-plain-bg, var(--u-color-default-light-9));
503
494
  }
504
495
  .u-button--color-default.is-text.is-disabled {
496
+ border-color: transparent;
505
497
  color: var(--u-color-default-light-5);
506
498
  }
507
499
  .u-button--color-default.is-text.is-loading {
500
+ border-color: transparent;
508
501
  color: var(--u-color-default-light-5);
509
502
  }
510
503
  .u-button--color-default.is-plain {
504
+ border-color: transparent;
511
505
  color: var(--u-button-default-plain-color, var(--u-color-default));
512
506
  background-color: var(--u-button-default-plain-bg, var(--u-color-default-light-9));
513
- border-color: var(--u-button-default-plain-border, var(--u-color-default-light-5));
514
- box-shadow: none;
515
507
  }
516
508
  .u-button--color-default.is-plain:not(.is-disabled):not(.is-loading):hover {
517
- color: var(--u-color-default);
518
- border-color: var(--u-color-default);
519
- background-color: var(--u-color-default-light-9);
520
- }
521
- .u-button--color-default.is-plain:active {
522
- box-shadow: none;
509
+ background-color: var(--u-color-default-light-7);
523
510
  }
524
511
  .u-button--color-default.is-plain.is-disabled {
512
+ border-color: transparent;
525
513
  color: var(--u-color-default-light-5);
526
- border-color: var(--u-color-default-light-8);
514
+ background-color: var(--u-color-default-light-9);
515
+ }
516
+ .u-button--color-default.is-plain.is-loading {
517
+ border-color: transparent;
518
+ color: var(--u-color-default-light-5);
519
+ background-color: var(--u-color-default-light-9);
527
520
  }
528
521
  .u-button.is-circle {
529
522
  border-radius: 50%;
@@ -1,6 +1,6 @@
1
1
  import _sfc_main$1 from "../icon/icon.js";
2
2
  import { CollapseDIKey } from "./di.js";
3
- import { computed, createBlock, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, inject, normalizeClass, onBeforeUnmount, onMounted, openBlock, ref, renderSlot, resolveDynamicComponent, toDisplayString, unref, watch, withCtx, withKeys, withModifiers } from "vue";
3
+ import { computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, inject, nextTick, normalizeClass, onBeforeUnmount, onMounted, openBlock, ref, renderSlot, resolveDynamicComponent, toDisplayString, unref, watch, withCtx, withKeys, withModifiers } from "vue";
4
4
  import { useModel as useModel$1 } from "@veltra/compositions";
5
5
  import { ExpandTransition, bem } from "@veltra/utils";
6
6
  import { ArrowDown } from "@veltra/icons/normal";
@@ -23,7 +23,8 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
23
23
  },
24
24
  title: {},
25
25
  disabled: { type: Boolean },
26
- expandIcon: {}
26
+ expandIcon: {},
27
+ destroyOnCollapse: { type: Boolean }
27
28
  },
28
29
  emits: ["update:modelValue", "change"],
29
30
  setup(__props, { emit: __emit }) {
@@ -64,14 +65,27 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
64
65
  emit("change", next);
65
66
  };
66
67
  const wrapperEl = ref();
68
+ /** 内容是否挂载:destroyOnCollapse 时折叠态卸载内容 DOM,展开前重新挂载 */
69
+ const contentMounted = ref(isActive.value || !props.destroyOnCollapse);
67
70
  onMounted(() => {
68
71
  if (context && props.value !== void 0) context.register(props.value);
69
72
  if (!wrapperEl.value) return;
70
73
  expandTransition.setExpanded(wrapperEl.value, isActive.value);
71
74
  });
72
- watch(isActive, (active) => {
75
+ watch(isActive, async (active) => {
76
+ if (active) {
77
+ if (!contentMounted.value) {
78
+ contentMounted.value = true;
79
+ await nextTick();
80
+ }
81
+ if (!wrapperEl.value || !isActive.value) return;
82
+ expandTransition.expand(wrapperEl.value);
83
+ return;
84
+ }
73
85
  if (!wrapperEl.value) return;
74
- active ? expandTransition.expand(wrapperEl.value) : expandTransition.collapse(wrapperEl.value);
86
+ expandTransition.collapse(wrapperEl.value, () => {
87
+ if (!isActive.value && props.destroyOnCollapse) contentMounted.value = false;
88
+ });
75
89
  });
76
90
  onBeforeUnmount(() => {
77
91
  if (context && props.value !== void 0) context.unregister(props.value);
@@ -87,15 +101,18 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
87
101
  tabindex: __props.disabled ? -1 : 0,
88
102
  onClick: handleClick,
89
103
  onKeydown: [withKeys(withModifiers(handleClick, ["prevent"]), ["enter"]), withKeys(withModifiers(handleClick, ["prevent"]), ["space"])]
90
- }, [createElementVNode("span", { class: normalizeClass(unref(cls).e("title")) }, [renderSlot(_ctx.$slots, "title", {}, () => [createTextVNode(toDisplayString(__props.title), 1)])], 2), createElementVNode("span", { class: normalizeClass(unref(cls).e("icon")) }, [renderSlot(_ctx.$slots, "icon", { isActive: isActive.value }, () => [createVNode(unref(_sfc_main$1), null, {
104
+ }, [renderSlot(_ctx.$slots, "header", { isActive: isActive.value }, () => [createElementVNode("span", { class: normalizeClass(unref(cls).e("title")) }, toDisplayString(__props.title), 3), createElementVNode("span", { class: normalizeClass(unref(cls).e("icon")) }, [createVNode(unref(_sfc_main$1), null, {
91
105
  default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(iconComponent.value)))]),
92
106
  _: 1
93
- })])], 2)], 42, _hoisted_1), createElementVNode("div", {
107
+ })], 2)])], 42, _hoisted_1), createElementVNode("div", {
94
108
  ref_key: "wrapperEl",
95
109
  ref: wrapperEl,
96
110
  class: normalizeClass(unref(cls).e("content-wrapper")),
97
111
  "aria-hidden": !isActive.value
98
- }, [createElementVNode("div", { class: normalizeClass(unref(cls).e("content")) }, [renderSlot(_ctx.$slots, "default")], 2)], 10, _hoisted_2)], 2);
112
+ }, [contentMounted.value ? (openBlock(), createElementBlock("div", {
113
+ key: 0,
114
+ class: normalizeClass(unref(cls).e("content"))
115
+ }, [renderSlot(_ctx.$slots, "default")], 2)) : createCommentVNode("v-if", true)], 10, _hoisted_2)], 2);
99
116
  };
100
117
  }
101
118
  });
@@ -1 +1 @@
1
- {"version":3,"file":"collapse-item.js","names":[],"sources":["../../../src/components/collapse/collapse-item.vue"],"sourcesContent":["<template>\n <div :class=\"classList\">\n <div\n :class=\"headerClassList\"\n role=\"button\"\n :aria-expanded=\"isActive\"\n :aria-disabled=\"disabled\"\n :tabindex=\"disabled ? -1 : 0\"\n @click=\"handleClick\"\n @keydown.enter.prevent=\"handleClick\"\n @keydown.space.prevent=\"handleClick\"\n >\n <span :class=\"cls.e('title')\">\n <slot name=\"title\">{{ title }}</slot>\n </span>\n\n <span :class=\"cls.e('icon')\">\n <slot name=\"icon\" :is-active=\"isActive\">\n <UIcon><component :is=\"iconComponent\" /></UIcon>\n </slot>\n </span>\n </div>\n <div ref=\"wrapperEl\" :class=\"cls.e('content-wrapper')\" :aria-hidden=\"!isActive\">\n <div :class=\"cls.e('content')\">\n <slot />\n </div>\n </div>\n </div>\n</template>\n\n<script lang=\"ts\" setup>\nimport { useModel } from '@veltra/compositions'\nimport { ArrowDown } from '@veltra/icons/normal'\nimport { bem, ExpandTransition } from '@veltra/utils'\nimport { computed, inject, onBeforeUnmount, onMounted, ref, watch } from 'vue'\n\nimport type { CollapseItemEmits, CollapseItemProps } from '../../types'\nimport { UIcon } from '../icon'\nimport { CollapseDIKey } from './di'\n\ndefineOptions({ name: 'UCollapseItem' })\n\nconst props = withDefaults(defineProps<CollapseItemProps>(), { modelValue: false })\nconst emit = defineEmits<CollapseItemEmits>()\n\nconst context = inject(CollapseDIKey, undefined)\n\nconst cls = context?.cls ?? bem('collapse')\n\nconst standaloneModel = useModel<CollapseItemProps, 'modelValue'>({\n props,\n emit,\n defaultValue: false\n})\n\nconst isActive = computed(() => {\n if (context) {\n return props.value !== undefined && context.activeValues.value.includes(props.value)\n }\n return !!standaloneModel.value\n})\n\nconst iconComponent = computed(() => context?.expandIcon.value ?? props.expandIcon ?? ArrowDown)\n\nconst classList = computed(() => [\n cls.e('item'),\n bem.is('active', isActive.value),\n bem.is('disabled', props.disabled)\n])\n\nconst headerClassList = computed(() => [\n cls.e('header'),\n bem.is('disabled', props.disabled),\n bem.is('active', isActive.value)\n])\n\nconst expandTransition =\n context?.expandTransition ??\n new ExpandTransition({ transition: 'height 0.24s cubic-bezier(0.4, 0, 0.2, 1)' })\n\nconst handleClick = () => {\n if (props.disabled) return\n\n if (context) {\n if (props.value === undefined) return\n context.toggle(props.value)\n return\n }\n\n const next = !standaloneModel.value\n standaloneModel.value = next\n emit('change', next)\n}\n\nconst wrapperEl = ref<HTMLElement>()\n\nonMounted(() => {\n if (context && props.value !== undefined) {\n context.register(props.value)\n }\n if (!wrapperEl.value) return\n expandTransition.setExpanded(wrapperEl.value, isActive.value)\n})\n\nwatch(isActive, (active) => {\n if (!wrapperEl.value) return\n active ? expandTransition.expand(wrapperEl.value) : expandTransition.collapse(wrapperEl.value)\n})\n\nonBeforeUnmount(() => {\n if (context && props.value !== undefined) {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,CAAA,CAAA,CAAA,CAAA,GAAA,CAAA,CAAA,GAAA,IAAA,UAAA,GAAA,mBAIM,OAAA;IAJG,SAAA;IAAJ,KAAI;IAAa,OAAK,eAAE,MAAA,GAAA,CAAG,CAAC,EAAC,iBAAA,CAAA;IAAsB,eAAW,CAAG,SAAA;GACpE,GAAA,CAAA,mBAEM,OAAA,EAFA,OAAK,eAAE,MAAA,GAAA,CAAG,CAAC,EAAC,SAAA,CAAA,EAAA,GAChB,CAAA,WAAQ,KAAA,QAAA,SAAA,CAAA,GAAA,CAAA,CAAA,GAAA,IAAA,UAAA,CAAA,GAAA,CAAA"}
1
+ {"version":3,"file":"collapse-item.js","names":[],"sources":["../../../src/components/collapse/collapse-item.vue"],"sourcesContent":["<template>\n <div :class=\"classList\">\n <div\n :class=\"headerClassList\"\n role=\"button\"\n :aria-expanded=\"isActive\"\n :aria-disabled=\"disabled\"\n :tabindex=\"disabled ? -1 : 0\"\n @click=\"handleClick\"\n @keydown.enter.prevent=\"handleClick\"\n @keydown.space.prevent=\"handleClick\"\n >\n <slot name=\"header\" :is-active=\"isActive\">\n <span :class=\"cls.e('title')\">{{ title }}</span>\n\n <span :class=\"cls.e('icon')\">\n <UIcon><component :is=\"iconComponent\" /></UIcon>\n </span>\n </slot>\n </div>\n <div ref=\"wrapperEl\" :class=\"cls.e('content-wrapper')\" :aria-hidden=\"!isActive\">\n <div v-if=\"contentMounted\" :class=\"cls.e('content')\">\n <slot />\n </div>\n </div>\n </div>\n</template>\n\n<script lang=\"ts\" setup>\nimport { useModel } from '@veltra/compositions'\nimport { ArrowDown } from '@veltra/icons/normal'\nimport { bem, ExpandTransition } from '@veltra/utils'\nimport { computed, inject, nextTick, onBeforeUnmount, onMounted, ref, watch } from 'vue'\n\nimport type { CollapseItemEmits, CollapseItemProps } from '../../types'\nimport { UIcon } from '../icon'\nimport { CollapseDIKey } from './di'\n\ndefineOptions({ name: 'UCollapseItem' })\n\nconst props = withDefaults(defineProps<CollapseItemProps>(), { modelValue: false })\nconst emit = defineEmits<CollapseItemEmits>()\n\ndefineSlots<{\n /** 自定义整个头部,作用域参数 `isActive` 指示展开状态;缺省渲染 title + 展开图标 */\n header?: (scope: { isActive: boolean }) => any\n /** 折叠面板内容 */\n default?: () => any\n}>()\n\nconst context = inject(CollapseDIKey, undefined)\n\nconst cls = context?.cls ?? bem('collapse')\n\nconst standaloneModel = useModel<CollapseItemProps, 'modelValue'>({\n props,\n emit,\n defaultValue: false\n})\n\nconst isActive = computed(() => {\n if (context) {\n return props.value !== undefined && context.activeValues.value.includes(props.value)\n }\n return !!standaloneModel.value\n})\n\nconst iconComponent = computed(() => context?.expandIcon.value ?? props.expandIcon ?? ArrowDown)\n\nconst classList = computed(() => [\n cls.e('item'),\n bem.is('active', isActive.value),\n bem.is('disabled', props.disabled)\n])\n\nconst headerClassList = computed(() => [\n cls.e('header'),\n bem.is('disabled', props.disabled),\n bem.is('active', isActive.value)\n])\n\nconst expandTransition =\n context?.expandTransition ??\n new ExpandTransition({ transition: 'height 0.24s cubic-bezier(0.4, 0, 0.2, 1)' })\n\nconst handleClick = () => {\n if (props.disabled) return\n\n if (context) {\n if (props.value === undefined) return\n context.toggle(props.value)\n return\n }\n\n const next = !standaloneModel.value\n standaloneModel.value = next\n emit('change', next)\n}\n\nconst wrapperEl = ref<HTMLElement>()\n\n/** 内容是否挂载:destroyOnCollapse 时折叠态卸载内容 DOM,展开前重新挂载 */\nconst contentMounted = ref(isActive.value || !props.destroyOnCollapse)\n\nonMounted(() => {\n if (context && props.value !== undefined) {\n context.register(props.value)\n }\n if (!wrapperEl.value) return\n expandTransition.setExpanded(wrapperEl.value, isActive.value)\n})\n\nwatch(isActive, async (active) => {\n if (active) {\n // 展开前先挂载内容,待 DOM 更新后再测量高度驱动展开动画\n if (!contentMounted.value) {\n contentMounted.value = true\n await nextTick()\n }\n if (!wrapperEl.value || !isActive.value) return\n expandTransition.expand(wrapperEl.value)\n return\n }\n if (!wrapperEl.value) return\n // 收起动画落定后再卸载内容 DOM;期间被重新展开则不卸载\n expandTransition.collapse(wrapperEl.value, () => {\n if (!isActive.value && props.destroyOnCollapse) contentMounted.value = false\n })\n})\n\nonBeforeUnmount(() => {\n if (context && props.value !== undefined) {\n context.unregister(props.value)\n }\n if (!wrapperEl.value) return\n expandTransition.cancel(wrapperEl.value)\n})\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAwCA,MAAM,QAAQ;EACd,MAAM,OAAO;EASb,MAAM,UAAU,OAAO,eAAe,KAAA,CAAS;EAE/C,MAAM,MAAM,SAAS,OAAO,IAAI,UAAU;EAE1C,MAAM,kBAAkB,WAA0C;GAChE;GACA;GACA,cAAc;EAChB,CAAC;EAED,MAAM,WAAW,eAAe;GAC9B,IAAI,SACF,OAAO,MAAM,UAAU,KAAA,KAAa,QAAQ,aAAa,MAAM,SAAS,MAAM,KAAK;GAErF,OAAO,CAAC,CAAC,gBAAgB;EAC3B,CAAC;EAED,MAAM,gBAAgB,eAAe,SAAS,WAAW,SAAS,MAAM,cAAc,SAAS;EAE/F,MAAM,YAAY,eAAe;GAC/B,IAAI,EAAE,MAAM;GACZ,IAAI,GAAG,UAAU,SAAS,KAAK;GAC/B,IAAI,GAAG,YAAY,MAAM,QAAQ;EACnC,CAAC;EAED,MAAM,kBAAkB,eAAe;GACrC,IAAI,EAAE,QAAQ;GACd,IAAI,GAAG,YAAY,MAAM,QAAQ;GACjC,IAAI,GAAG,UAAU,SAAS,KAAK;EACjC,CAAC;EAED,MAAM,mBACJ,SAAS,oBACT,IAAI,iBAAiB,EAAE,YAAY,4CAA4C,CAAC;EAElF,MAAM,oBAAoB;GACxB,IAAI,MAAM,UAAU;GAEpB,IAAI,SAAS;IACX,IAAI,MAAM,UAAU,KAAA,GAAW;IAC/B,QAAQ,OAAO,MAAM,KAAK;IAC1B;GACF;GAEA,MAAM,OAAO,CAAC,gBAAgB;GAC9B,gBAAgB,QAAQ;GACxB,KAAK,UAAU,IAAI;EACrB;E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gD,QAAA,EAAzC,OAAK,eAAE,MAAA,GAAA,CAAG,CAAC,EAAC,OAAA,CAAA,EAAA,GAAc,gBAAA,QAAA,KAAK,GAAA,CAAA,GAEtC,mBAEO,QAAA,EAFA,OAAK,eAAE,MAAA,GAAA,CAAG,CAAC,EAAC,MAAA,CAAA,EAAA,GACjB,CAAA,YAAgD,MAAA,WAAA,GAAA,MAAA;IAAR,SAAA,cAAA,EAAA,UAAA,GAAjC,YAAiC,wBAAjB,cAAA,KAAa,CAAA,EAAA,CAAA;;GAI1C,CAAA,CAAA,GAAA,CAAA,CAAA,CAAA,CAAA,GAAA,IAAA,UAAA,GAAA,mBAIM,OAAA;IAJG,SAAA;IAAJ,KAAI;IAAa,OAAK,eAAE,MAAA,GAAA,CAAG,CAAC,EAAC,iBAAA,CAAA;IAAsB,eAAW,CAAG,SAAA;GACzD,GAAA,CAAA,eAAA,SAAA,UAAA,GAAX,mBAEM,OAAA;;IAFsB,OAAK,eAAE,MAAA,GAAA,CAAG,CAAC,EAAC,SAAA,CAAA;GACtC,GAAA,CAAA,WAAQ,KAAA,QAAA,SAAA,CAAA,GAAA,CAAA,KAAA,mBAAA,QAAA,IAAA,CAAA,GAAA,IAAA,UAAA,CAAA,GAAA,CAAA"}
@@ -88,11 +88,13 @@
88
88
  cursor: text;
89
89
  }
90
90
  .u-dialog__body {
91
- padding: 8px;
92
91
  background-color: var(--u-bg-color-top);
93
92
  backdrop-filter: var(--u-bg-filter);
94
93
  flex-grow: 1;
95
94
  }
95
+ .u-dialog__body .u-scroll__content {
96
+ padding: 8px;
97
+ }
96
98
  .u-dialog__footer {
97
99
  border-top: var(--u-border);
98
100
  padding: 8px;
@@ -12,10 +12,13 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
12
12
  gap: {},
13
13
  cols: {},
14
14
  rows: {},
15
- resizable: { type: Boolean }
15
+ resizable: { type: Boolean },
16
+ colMinSizes: {}
16
17
  },
17
- setup(__props) {
18
+ emits: ["resize-start", "resize-end"],
19
+ setup(__props, { emit: __emit }) {
18
20
  const props = __props;
21
+ const emit = __emit;
19
22
  const cls = bem("layout");
20
23
  const templateCols = ref([]);
21
24
  watchEffect(() => {
@@ -52,18 +55,22 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
52
55
  () => props.cols
53
56
  ], () => {
54
57
  nextTick(() => {
55
- getResizeOffsets();
58
+ syncResizers();
56
59
  });
57
60
  });
58
61
  useResizeObserver({
59
62
  targets: containerRef,
60
63
  onResize() {
61
- getResizeOffsets();
62
- resizerRefs.value.forEach((r, i) => {
63
- r.update(resizerOffsets.value[i]);
64
- });
64
+ syncResizers();
65
65
  }
66
66
  });
67
+ /** 重新测量各列边界并同步所有拖拽手柄位置(容器尺寸或 cols 程序化变化后调用) */
68
+ function syncResizers() {
69
+ getResizeOffsets();
70
+ resizerRefs.value.forEach((r, i) => {
71
+ r.update(resizerOffsets.value[i]);
72
+ });
73
+ }
67
74
  let prevSize = 0;
68
75
  let nextSize = 0;
69
76
  const handleStartResize = (index) => {
@@ -73,9 +80,12 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
73
80
  const nextDom = container.children[index + 1];
74
81
  prevSize = prevDom ? prevDom.getBoundingClientRect().width : 0;
75
82
  nextSize = nextDom ? nextDom.getBoundingClientRect().width : 0;
83
+ emit("resize-start", index);
76
84
  };
77
85
  const handleResize = (offset, index) => {
78
- const clamped = Math.max(-prevSize, Math.min(nextSize, offset));
86
+ const minPrev = props.colMinSizes?.[index] ?? 0;
87
+ const minNext = props.colMinSizes?.[index + 1] ?? 0;
88
+ const clamped = Math.max(minPrev - prevSize, Math.min(nextSize - minNext, offset));
79
89
  templateCols.value[index] = `${prevSize + clamped}px`;
80
90
  templateCols.value[index + 1] = `${nextSize - clamped}px`;
81
91
  };
@@ -99,11 +109,13 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
99
109
  ref: resizerRefs,
100
110
  direction: "vertical",
101
111
  onResize: ($event) => handleResize($event, index),
102
- onResizeStart: ($event) => handleStartResize(index)
112
+ onResizeStart: ($event) => handleStartResize(index),
113
+ onResizeEnd: ($event) => emit("resize-end", index)
103
114
  }, null, 8, [
104
115
  "offset",
105
116
  "onResize",
106
- "onResizeStart"
117
+ "onResizeStart",
118
+ "onResizeEnd"
107
119
  ]);
108
120
  }), 128)),
109
121
  createCommentVNode(" 横向调节 "),
@@ -1 +1 @@
1
- {"version":3,"file":"layout.js","names":[],"sources":["../../../src/components/layout/layout.vue"],"sourcesContent":["<template>\n <component :is=\"tag\" :class=\"cls.b\" :style=\"style\" ref=\"containerRef\">\n <slot />\n\n <!-- 竖向调节 -->\n <ULayoutResizer\n v-for=\"(offset, index) of resizerOffsets\"\n :offset=\"offset\"\n :key=\"index\"\n ref=\"resizerRefs\"\n direction=\"vertical\"\n @resize=\"handleResize($event, index)\"\n @resize-start=\"handleStartResize(index)\"\n >\n </ULayoutResizer>\n\n <!-- 横向调节 -->\n <!-- <ULayoutResizer\n v-for=\"item in horizontalResizerList\"\n :key=\"item\"\n direction=\"horizontal\"\n /> -->\n </component>\n</template>\n\n<script lang=\"ts\" setup>\nimport { useResizeObserver } from '@veltra/compositions'\nimport { bem, withUnit } from '@veltra/utils'\nimport {\n computed,\n shallowRef,\n type CSSProperties,\n provide,\n watchEffect,\n ref,\n watch,\n nextTick\n} from 'vue'\n\nimport type { LayoutProps } from '../../types'\nimport { LayoutDIKey } from './di'\nimport ULayoutResizer from './layout-resizer.vue'\n\ndefineOptions({ name: 'ULayout' })\n\nconst props = withDefaults(defineProps<LayoutProps>(), { tag: 'div' })\n\nconst cls = bem('layout')\n\nconst templateCols = ref<string[]>([])\n\nwatchEffect(() => {\n const { cols } = props\n if (!cols) {\n templateCols.value = []\n return\n }\n templateCols.value = typeof cols === 'string' ? cols.split(' ') : [...cols]\n})\n\nconst style = computed<CSSProperties>(() => {\n const { rows, gap, resizable } = props\n return {\n gridTemplateColumns: templateCols.value.join(' '),\n gridTemplateRows: rows ? (typeof rows === 'string' ? rows : rows.join(' ')) : '',\n columnGap: resizable ? '10px' : withUnit(gap, 'px')\n }\n})\n\nconst containerRef = shallowRef<HTMLElement>()\nconst resizerRefs = shallowRef<InstanceType<typeof ULayoutResizer>[]>([])\n\nconst resizerOffsets = ref<number[]>([])\n\nfunction getResizeOffsets() {\n const container = containerRef.value\n if (!props.resizable || !container || !props.cols) {\n return (resizerOffsets.value = [])\n }\n\n resizerOffsets.value = templateCols.value.slice(0, -1).map((_, index) => {\n const dom = container.children[index] as HTMLElement\n if (!dom) return 0\n return dom.offsetLeft + dom.offsetWidth\n })\n}\n\nwatch([() => props.resizable, containerRef, () => props.cols], () => {\n nextTick(() => {\n getResizeOffsets()\n })\n})\n\nuseResizeObserver({\n targets: containerRef,\n onResize() {\n getResizeOffsets()\n resizerRefs.value.forEach((r, i) => {\n r.update(resizerOffsets.value![i]!)\n })\n }\n})\n\n// const horizontalResizerList = []\n\n// const resizing = shallowRef(false)\n\nlet prevSize = 0\nlet nextSize = 0\nconst handleStartResize = (index: number) => {\n const container = containerRef.value\n if (!container) return\n\n // 拖拽前把相邻两列按实际渲染宽度固定成 px,\n // 这样拖拽时两列等量增减、容器整体宽度保持不变。\n const prevDom = container.children[index] as HTMLElement | undefined\n const nextDom = container.children[index + 1] as HTMLElement | undefined\n prevSize = prevDom ? prevDom.getBoundingClientRect().width : 0\n nextSize = nextDom ? nextDom.getBoundingClientRect().width : 0\n}\nconst handleResize = (offset: number, index: number) => {\n // 钳位到 [-prevSize, nextSize],避免轨道尺寸出现负值——\n // 一旦 grid-template-columns 中带负值,整条声明会被浏览器丢弃。\n const clamped = Math.max(-prevSize, Math.min(nextSize, offset))\n templateCols.value[index] = `${prevSize + clamped}px`\n templateCols.value[index + 1] = `${nextSize - clamped}px`\n}\n\nprovide(LayoutDIKey, { cls })\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;EA6CA,MAAM,QAAQ;EAEd,MAAM,MAAM,IAAI,QAAQ;EAExB,MAAM,eAAe,IAAc,CAAC,CAAC;EAErC,kBAA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AAU,SAAS;GACnC,MAAM,UAAU,UAAU,SAAS,QAAQ;GAC3C,WAAW,UAAU,QAAQ,sBAAsB,CAAC,CAAC,QAAQ;GAC7D,WAAW,UAAU,QAAQ,sBAAsB,CAAC,CAAC,QAAQ;EAC/D;EACA,MAAM,gBAAgB,QAAgB,UAAkB;GAGtD,MAAM,UAAU,KAAK,IAAI,CAAC,UAAU,KAAK,IAAI,UAAU,MAAM,CAAC;GAC9D,aAAa,MAAM,SAAS,GAAG,WAAW,QAAQ;GAClD,aAAa,MAAM,QAAQ,KAAK,GAAG,WAAW,QAAQ;EACxD;EAEA,QAAQ,aAAa,EAAE,IAAI,CAAC;;GA/H1B,OAAA,UAAA,GAAA,YAqBY,wBArBI,QAAA,GAAG,GAAA;IAAG,OAAK,eAAE,MAAA,GAAA,CAAG,CAAC,CAAC;IAAG,OAAK,eAAE,MAAA,KAAK;IAAM,SAAA;IAAJ,KAAI;;IAC7C,SAAA,cAAA;KAAR,WAAQ,KAAA,QAAA,SAAA;KAER,mBAAA,QAAA;MACA,UAAA,IAAA,GAAA,mBASiB,UAAA,MAAA,WARW,eAAA,QAAlB,QAAQ,UAAK;MADvB,OAAA,UAAA,GAAA,YASiB,aAAA;OAPN;OACR,KAAK;;OACF,SAAA;OAAJ,KAAI;OACJ,WAAU;OACT,WAAM,WAAE,aAAa,QAAQ,KAAK;OAClC,gBAAY,WAAE,kBAAkB,KAAK;;;;;;;KAIxC,mBAAA,QAAA;KACA,mBAAA,+HAAA"}
1
+ {"version":3,"file":"layout.js","names":[],"sources":["../../../src/components/layout/layout.vue"],"sourcesContent":["<template>\n <component :is=\"tag\" :class=\"cls.b\" :style=\"style\" ref=\"containerRef\">\n <slot />\n\n <!-- 竖向调节 -->\n <ULayoutResizer\n v-for=\"(offset, index) of resizerOffsets\"\n :offset=\"offset\"\n :key=\"index\"\n ref=\"resizerRefs\"\n direction=\"vertical\"\n @resize=\"handleResize($event, index)\"\n @resize-start=\"handleStartResize(index)\"\n @resize-end=\"emit('resize-end', index)\"\n >\n </ULayoutResizer>\n\n <!-- 横向调节 -->\n <!-- <ULayoutResizer\n v-for=\"item in horizontalResizerList\"\n :key=\"item\"\n direction=\"horizontal\"\n /> -->\n </component>\n</template>\n\n<script lang=\"ts\" setup>\nimport { useResizeObserver } from '@veltra/compositions'\nimport { bem, withUnit } from '@veltra/utils'\nimport {\n computed,\n shallowRef,\n type CSSProperties,\n provide,\n watchEffect,\n ref,\n watch,\n nextTick\n} from 'vue'\n\nimport type { LayoutEmits, LayoutProps } from '../../types'\nimport { LayoutDIKey } from './di'\nimport ULayoutResizer from './layout-resizer.vue'\n\ndefineOptions({ name: 'ULayout' })\n\nconst props = withDefaults(defineProps<LayoutProps>(), { tag: 'div' })\n\nconst emit = defineEmits<LayoutEmits>()\n\nconst cls = bem('layout')\n\nconst templateCols = ref<string[]>([])\n\nwatchEffect(() => {\n const { cols } = props\n if (!cols) {\n templateCols.value = []\n return\n }\n templateCols.value = typeof cols === 'string' ? cols.split(' ') : [...cols]\n})\n\nconst style = computed<CSSProperties>(() => {\n const { rows, gap, resizable } = props\n return {\n gridTemplateColumns: templateCols.value.join(' '),\n gridTemplateRows: rows ? (typeof rows === 'string' ? rows : rows.join(' ')) : '',\n columnGap: resizable ? '10px' : withUnit(gap, 'px')\n }\n})\n\nconst containerRef = shallowRef<HTMLElement>()\nconst resizerRefs = shallowRef<InstanceType<typeof ULayoutResizer>[]>([])\n\nconst resizerOffsets = ref<number[]>([])\n\nfunction getResizeOffsets() {\n const container = containerRef.value\n if (!props.resizable || !container || !props.cols) {\n return (resizerOffsets.value = [])\n }\n\n resizerOffsets.value = templateCols.value.slice(0, -1).map((_, index) => {\n const dom = container.children[index] as HTMLElement\n if (!dom) return 0\n return dom.offsetLeft + dom.offsetWidth\n })\n}\n\nwatch([() => props.resizable, containerRef, () => props.cols], () => {\n nextTick(() => {\n syncResizers()\n })\n})\n\nuseResizeObserver({\n targets: containerRef,\n onResize() {\n syncResizers()\n }\n})\n\n/** 重新测量各列边界并同步所有拖拽手柄位置(容器尺寸或 cols 程序化变化后调用) */\nfunction syncResizers() {\n getResizeOffsets()\n resizerRefs.value.forEach((r, i) => {\n r.update(resizerOffsets.value![i]!)\n })\n}\n\n// const horizontalResizerList = []\n\n// const resizing = shallowRef(false)\n\nlet prevSize = 0\nlet nextSize = 0\nconst handleStartResize = (index: number) => {\n const container = containerRef.value\n if (!container) return\n\n // 拖拽前把相邻两列按实际渲染宽度固定成 px,\n // 这样拖拽时两列等量增减、容器整体宽度保持不变。\n const prevDom = container.children[index] as HTMLElement | undefined\n const nextDom = container.children[index + 1] as HTMLElement | undefined\n prevSize = prevDom ? prevDom.getBoundingClientRect().width : 0\n nextSize = nextDom ? nextDom.getBoundingClientRect().width : 0\n emit('resize-start', index)\n}\nconst handleResize = (offset: number, index: number) => {\n // 钳位到 [colMin-prevSize, nextSize-colMin],避免轨道尺寸出现负值或小于列最小宽度——\n // 一旦 grid-template-columns 中带负值,整条声明会被浏览器丢弃。\n const minPrev = props.colMinSizes?.[index] ?? 0\n const minNext = props.colMinSizes?.[index + 1] ?? 0\n const clamped = Math.max(minPrev - prevSize, Math.min(nextSize - minNext, offset))\n templateCols.value[index] = `${prevSize + clamped}px`\n templateCols.value[index + 1] = `${nextSize - clamped}px`\n}\n\nprovide(LayoutDIKey, { cls })\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;EA8CA,MAAM,QAAQ;EAEd,MAAM,OAAO;EAEb,MAAM,MAAM,IAAI,QAAQ;EAExB,MAAM,eAAe,IAAc,CAAC,CAAC;EAErC,kBAAkB;GAChB,MAAM,EAAE,SAAS;GACjB,IAAI,CAAC,MAAM;IACT,aAAa,QAAQ,CAAC;IACtB;GACF;GACA,aAAa,QAAQ,OAAO,SAAS,WAAW,KAAK,MAAM,GAAG,IAAI,CAAC,GAAG,IAAI;EAC5E,CAAC;EAED,MAAM,QAAQ,eAA8B;GAC1C,MAAM,EAAE,MAAM,KAAK,cAAc;GACjC,OAAO;I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kB;GAGtD,MAAM,UAAU,MAAM,cAAc,UAAU;GAC9C,MAAM,UAAU,MAAM,cAAc,QAAQ,MAAM;GAClD,MAAM,UAAU,KAAK,IAAI,UAAU,UAAU,KAAK,IAAI,WAAW,SAAS,MAAM,CAAC;GACjF,aAAa,MAAM,SAAS,GAAG,WAAW,QAAQ;GAClD,aAAa,MAAM,QAAQ,KAAK,GAAG,WAAW,QAAQ;EACxD;EAEA,QAAQ,aAAa,EAAE,IAAI,CAAC;;GA1I1B,OAAA,UAAA,GAAA,YAsBY,wBAtBI,QAAA,GAAG,GAAA;IAAG,OAAK,eAAE,MAAA,GAAA,CAAG,CAAC,CAAC;IAAG,OAAK,eAAE,MAAA,KAAK;IAAM,SAAA;IAAJ,KAAI;;IAC7C,SAAA,cAAA;KAAR,WAAQ,KAAA,QAAA,SAAA;KAER,mBAAA,QAAA;MACA,UAAA,IAAA,GAAA,mBAUiB,UAAA,MAAA,WATW,eAAA,QAAlB,QAAQ,UAAK;MADvB,OAAA,UAAA,GAAA,YAUiB,aAAA;OARN;OACR,KAAK;;OACF,SAAA;OAAJ,KAAI;OACJ,WAAU;OACT,WAAM,WAAE,aAAa,QAAQ,KAAK;OAClC,gBAAY,WAAE,kBAAkB,KAAK;OACrC,cAAU,WAAE,KAAI,cAAe,KAAK;;;;;;;;KAIvC,mBAAA,QAAA;KACA,mBAAA,+HAAA"}
@@ -5,13 +5,16 @@
5
5
  * - `explicitWidth` 列:保持配置/拖拽锁定的宽度
6
6
  * - `fixed` 且未显式设宽的列:保持 `minWidth`,不参与剩余宽度均分
7
7
  * - 其余未显式设宽的列:均分容器剩余宽度
8
+ *
9
+ * 分配结果写入列节点自身的 `allocatedWidth`,不回写列配置的 `data.width`,
10
+ * 避免污染用户数据后在列森林重建时被误判为显式宽度。
8
11
  */
9
12
  function allocateLeafColumnWidths(leafColumns, containerWidth) {
10
13
  if (!containerWidth || !leafColumns.length) return;
11
14
  const growColumns = leafColumns.filter((column) => !column.explicitWidth && !column.fixed);
12
15
  const fixedFlexColumns = leafColumns.filter((column) => !column.explicitWidth && column.fixed);
13
16
  fixedFlexColumns.forEach((column) => {
14
- column.data.width = void 0;
17
+ column.allocatedWidth = void 0;
15
18
  });
16
19
  const explicitWidthTotal = leafColumns.filter((column) => column.explicitWidth).reduce((acc, cur) => acc + (cur.width ?? cur.minWidth), 0);
17
20
  const growBaseTotal = growColumns.reduce((acc, cur) => acc + cur.minWidth, 0);
@@ -20,10 +23,10 @@ function allocateLeafColumnWidths(leafColumns, containerWidth) {
20
23
  if (growColumns.length > 0 && totalBase < containerWidth) {
21
24
  const allocatedWidth = (containerWidth - totalBase) / growColumns.length;
22
25
  growColumns.forEach((column) => {
23
- column.width = column.minWidth + allocatedWidth;
26
+ column.allocatedWidth = column.minWidth + allocatedWidth;
24
27
  });
25
28
  } else growColumns.forEach((column) => {
26
- column.data.width = void 0;
29
+ column.allocatedWidth = void 0;
27
30
  });
28
31
  }
29
32
  //#endregion