@varlet/ui 2.20.5 → 2.20.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/varlet.cjs.js CHANGED
@@ -13890,13 +13890,14 @@ function __render__$M(_ctx, _cache) {
13890
13890
  class: vue.normalizeClass(_ctx.classes(_ctx.n("icon"), [!_ctx.hint, _ctx.n("--icon-non-hint")]))
13891
13891
  },
13892
13892
  [
13893
- _ctx.clearable && !_ctx.isEmpty(_ctx.value) ? (vue.openBlock(), vue.createBlock(_component_var_icon, {
13894
- key: 0,
13895
- class: vue.normalizeClass(_ctx.n("clear-icon")),
13896
- "var-field-decorator-cover": "",
13897
- name: "close-circle",
13898
- onClick: _ctx.handleClear
13899
- }, null, 8, ["class", "onClick"])) : vue.createCommentVNode("v-if", true),
13893
+ _ctx.clearable && !_ctx.isEmpty(_ctx.value) ? vue.renderSlot(_ctx.$slots, "clear-icon", { key: 0 }, () => [
13894
+ vue.createVNode(_component_var_icon, {
13895
+ class: vue.normalizeClass(_ctx.n("clear-icon")),
13896
+ "var-field-decorator-cover": "",
13897
+ name: "close-circle",
13898
+ onClick: _ctx.handleClear
13899
+ }, null, 8, ["class", "onClick"])
13900
+ ]) : vue.createCommentVNode("v-if", true),
13900
13901
  vue.renderSlot(_ctx.$slots, "append-icon")
13901
13902
  ],
13902
13903
  2
@@ -14883,10 +14884,6 @@ const __sfc__$J = vue.defineComponent({
14883
14884
  function stopAutoplay() {
14884
14885
  timer && clearTimeout(timer);
14885
14886
  }
14886
- function setTrackTranslate(value) {
14887
- trackTranslate.value = value;
14888
- dispatchSwipeItems();
14889
- }
14890
14887
  function handleTouchstart(event) {
14891
14888
  return __async$7(this, null, function* () {
14892
14889
  if (length.value <= 1 || !props2.touchable) {
@@ -14908,7 +14905,8 @@ const __sfc__$J = vue.defineComponent({
14908
14905
  return;
14909
14906
  }
14910
14907
  preventDefault(event);
14911
- setTrackTranslate(trackTranslate.value + (vertical2 ? moveY.value : moveX.value));
14908
+ trackTranslate.value += vertical2 ? moveY.value : moveX.value;
14909
+ dispatchSwipeItems();
14912
14910
  }
14913
14911
  function handleTouchend() {
14914
14912
  if (!touching.value) {
@@ -14924,7 +14922,7 @@ const __sfc__$J = vue.defineComponent({
14924
14922
  const quickSwiping = performance.now() - startTime.value <= SWIPE_DELAY && offset2 >= SWIPE_OFFSET;
14925
14923
  const swipeIndex = quickSwiping ? positive ? getSwipeIndex(index.value + 1) : getSwipeIndex(index.value - 1) : getSwipeIndex();
14926
14924
  lockDuration.value = false;
14927
- setTrackTranslate(swipeIndex * -size.value);
14925
+ trackTranslate.value = swipeIndex * -size.value;
14928
14926
  const prevIndex = index.value;
14929
14927
  index.value = swipeIndexToIndex(swipeIndex);
14930
14928
  startAutoplay();
@@ -15996,6 +15994,9 @@ function __render__$D(_ctx, _cache) {
15996
15994
  onClear: _ctx.handleClear
15997
15995
  })),
15998
15996
  vue.createSlots({
15997
+ "clear-icon": vue.withCtx(() => [
15998
+ vue.renderSlot(_ctx.$slots, "clear-icon")
15999
+ ]),
15999
16000
  "append-icon": vue.withCtx(() => [
16000
16001
  vue.renderSlot(_ctx.$slots, "append-icon")
16001
16002
  ]),
@@ -18343,7 +18344,16 @@ const __sfc__$v = vue.defineComponent({
18343
18344
  let prevIndexes = [];
18344
18345
  buildScrollColumns();
18345
18346
  vue.watch(() => props2.columns, buildScrollColumns, { deep: true });
18346
- vue.watch(() => modelValue.value, updateScrollColumnsIndex);
18347
+ vue.watch(
18348
+ () => modelValue.value,
18349
+ () => {
18350
+ if (props2.cascade && props2.modelValue.length) {
18351
+ buildScrollColumns();
18352
+ } else {
18353
+ updateScrollColumnsIndex();
18354
+ }
18355
+ }
18356
+ );
18347
18357
  function getOptionKey(key) {
18348
18358
  const keyMap = {
18349
18359
  text: props2.textKey,
@@ -18400,6 +18410,10 @@ const __sfc__$v = vue.defineComponent({
18400
18410
  scrolling: false
18401
18411
  };
18402
18412
  scrollColumns2.push(scrollColumn);
18413
+ if (props2.modelValue.length) {
18414
+ const index = children.findIndex((option) => modelValue.value[scrollColumns2.length - 1] === getValue(option));
18415
+ scrollColumn.index = index === -1 ? 0 : index;
18416
+ }
18403
18417
  scrollTo2(scrollColumn);
18404
18418
  createChildren(scrollColumns2, (_a = scrollColumn.column[scrollColumn.index][getOptionKey("children")]) != null ? _a : []);
18405
18419
  }
@@ -18411,7 +18425,9 @@ const __sfc__$v = vue.defineComponent({
18411
18425
  }
18412
18426
  function buildScrollColumns() {
18413
18427
  scrollColumns.value = props2.cascade ? normalizeCascadeMode(props2.columns) : normalizeNormalMode(props2.columns);
18414
- updateScrollColumnsIndex();
18428
+ if (!props2.cascade) {
18429
+ updateScrollColumnsIndex();
18430
+ }
18415
18431
  }
18416
18432
  function updateScrollColumnsIndex() {
18417
18433
  scrollColumns.value.forEach((scrollColumn, idx) => {
@@ -18523,7 +18539,7 @@ const __sfc__$v = vue.defineComponent({
18523
18539
  if (isSamePicked()) {
18524
18540
  return;
18525
18541
  }
18526
- if (cascade) {
18542
+ if (cascade && !props2.modelValue.length) {
18527
18543
  rebuildChildren(scrollColumn);
18528
18544
  }
18529
18545
  const hasScrolling = scrollColumns.value.some((scrollColumn2) => scrollColumn2.scrolling);
@@ -20287,6 +20303,9 @@ function __render__$g(_ctx, _cache) {
20287
20303
  onClear: _ctx.handleClear
20288
20304
  })),
20289
20305
  vue.createSlots({
20306
+ "clear-icon": vue.withCtx(() => [
20307
+ vue.renderSlot(_ctx.$slots, "clear-icon")
20308
+ ]),
20290
20309
  "append-icon": vue.withCtx(() => [
20291
20310
  vue.renderSlot(_ctx.$slots, "append-icon")
20292
20311
  ]),
@@ -21486,9 +21505,10 @@ function __render__$d(_ctx, _cache) {
21486
21505
  2
21487
21506
  /* CLASS */
21488
21507
  ),
21489
- vue.createElementVNode(
21508
+ _ctx.$slots.action ? (vue.openBlock(), vue.createElementBlock(
21490
21509
  "div",
21491
21510
  {
21511
+ key: 0,
21492
21512
  class: vue.normalizeClass(_ctx.n("action"))
21493
21513
  },
21494
21514
  [
@@ -21496,7 +21516,7 @@ function __render__$d(_ctx, _cache) {
21496
21516
  ],
21497
21517
  2
21498
21518
  /* CLASS */
21499
- )
21519
+ )) : vue.createCommentVNode("v-if", true)
21500
21520
  ],
21501
21521
  6
21502
21522
  /* CLASS, STYLE */
@@ -23201,7 +23221,8 @@ var stdin_default$l = {
23201
23221
  "--bottom-navigation-border-color": "#444"
23202
23222
  };
23203
23223
  var stdin_default$k = {
23204
- "--bottom-navigation-item-active-background-color": "#272727"
23224
+ "--bottom-navigation-item-active-background-color": "#272727",
23225
+ "--bottom-navigation-item-inactive-color": "#BFBFBF"
23205
23226
  };
23206
23227
  var stdin_default$j = {
23207
23228
  "--menu-background-color": "#272727"
@@ -24944,7 +24965,7 @@ withInstall(stdin_default$1);
24944
24965
  withPropsDefaultsSetter(stdin_default$1, props);
24945
24966
  const _WatermarkComponent = stdin_default$1;
24946
24967
  var stdin_default = stdin_default$1;
24947
- const version = "2.20.5";
24968
+ const version = "2.20.7";
24948
24969
  function install(app) {
24949
24970
  stdin_default$3k.install && app.use(stdin_default$3k);
24950
24971
  stdin_default$3i.install && app.use(stdin_default$3i);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@varlet/ui",
3
- "version": "2.20.5",
3
+ "version": "2.20.7",
4
4
  "description": "A material like components library",
5
5
  "main": "lib/varlet.cjs.js",
6
6
  "module": "es/index.mjs",
@@ -48,12 +48,12 @@
48
48
  "@popperjs/core": "^2.11.6",
49
49
  "dayjs": "^1.10.4",
50
50
  "decimal.js": "^10.2.1",
51
- "@varlet/icons": "2.20.5",
52
- "@varlet/use": "2.20.5",
53
- "@varlet/shared": "2.20.5"
51
+ "@varlet/use": "2.20.7",
52
+ "@varlet/icons": "2.20.7",
53
+ "@varlet/shared": "2.20.7"
54
54
  },
55
55
  "devDependencies": {
56
- "@vue/runtime-core": "3.4.0",
56
+ "@vue/runtime-core": "3.4.3",
57
57
  "@vue/test-utils": "2.4.1",
58
58
  "@types/lodash-es": "^4.17.6",
59
59
  "@types/node": "^18.7.18",
@@ -64,11 +64,11 @@
64
64
  "live-server": "^1.2.1",
65
65
  "lodash-es": "^4.17.21",
66
66
  "typescript": "^5.1.5",
67
- "vue": "3.4.0",
67
+ "vue": "3.4.3",
68
68
  "vue-router": "4.2.0",
69
- "@varlet/ui": "2.20.5",
70
- "@varlet/cli": "2.20.5",
71
- "@varlet/touch-emulator": "2.20.5"
69
+ "@varlet/ui": "2.20.7",
70
+ "@varlet/cli": "2.20.7",
71
+ "@varlet/touch-emulator": "2.20.7"
72
72
  },
73
73
  "scripts": {
74
74
  "dev": "varlet-cli dev",
package/types/input.d.ts CHANGED
@@ -47,6 +47,7 @@ export class Input extends VarComponent {
47
47
  $slots: {
48
48
  'prepend-icon'(): VNode[]
49
49
  'append-icon'(): VNode[]
50
+ 'clear-icon'(): VNode[]
50
51
  'extra-message'(): VNode[]
51
52
  }
52
53
 
package/types/select.d.ts CHANGED
@@ -50,6 +50,7 @@ export class Select extends VarComponent {
50
50
  $slots: {
51
51
  'selected'(): VNode[]
52
52
  'prepend-icon'(): VNode[]
53
+ 'clear-icon'(): VNode[]
53
54
  'append-icon'(): VNode[]
54
55
  'arrow-icon'(data: SelectArrowIconData): VNode[]
55
56
  }