lew-ui 2.7.21 → 2.7.24

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/index.js CHANGED
@@ -6192,10 +6192,8 @@ const _sfc_main$10 = /* @__PURE__ */ defineComponent({
6192
6192
  }));
6193
6193
  const totalColumnWidth = computed(() => {
6194
6194
  let width = sumBy(processedColumns.value, "width");
6195
- if (props2.checkable)
6196
- width += getCheckableWidth.value;
6197
- if (props2.sortable)
6198
- width += getDragColumnWidth.value;
6195
+ if (props2.checkable) width += getCheckableWidth.value;
6196
+ if (props2.sortable) width += getDragColumnWidth.value;
6199
6197
  return width;
6200
6198
  });
6201
6199
  const fixedWidths = computed(() => {
@@ -6236,8 +6234,7 @@ const _sfc_main$10 = /* @__PURE__ */ defineComponent({
6236
6234
  });
6237
6235
  const columnLevel = computed(() => {
6238
6236
  const findMaxDepth = (columns, currentDepth = 1) => {
6239
- if (!columns || columns.length === 0)
6240
- return currentDepth;
6237
+ if (!columns || columns.length === 0) return currentDepth;
6241
6238
  let maxDepth = currentDepth;
6242
6239
  for (const col of columns) {
6243
6240
  if (col.children && col.children.length > 0) {
@@ -6425,8 +6422,8 @@ const _sfc_main$10 = /* @__PURE__ */ defineComponent({
6425
6422
  column?.title,
6426
6423
  column.sortable && h(SortIcon, {
6427
6424
  "sort-value": sortValue.value[column.field],
6428
- "size": props2.size,
6429
- "class": "lew-table-sorter"
6425
+ size: props2.size,
6426
+ class: "lew-table-sorter"
6430
6427
  })
6431
6428
  ]
6432
6429
  }
@@ -6470,8 +6467,7 @@ const _sfc_main$10 = /* @__PURE__ */ defineComponent({
6470
6467
  }
6471
6468
  }
6472
6469
  function updateScrollState() {
6473
- if (!tableRef.value)
6474
- return;
6470
+ if (!tableRef.value) return;
6475
6471
  const element = tableRef.value;
6476
6472
  const { clientWidth, scrollWidth, scrollLeft } = element;
6477
6473
  if (scrollWidth === clientWidth) {
@@ -6489,12 +6485,10 @@ const _sfc_main$10 = /* @__PURE__ */ defineComponent({
6489
6485
  state.hiddenScrollLine = "";
6490
6486
  }
6491
6487
  function computeTableRowHeight() {
6492
- console.log("🚀 Starting height computation...");
6493
6488
  nextTick(() => {
6494
6489
  const newTrHeightMap = {};
6495
6490
  const newTrPositionsMap = {};
6496
6491
  const allRowIds = state.dataSource.map((row) => row._lew_table_tr_id);
6497
- console.log(`Found ${allRowIds.length} rows to process`);
6498
6492
  allRowIds.forEach((rowId) => {
6499
6493
  let maxHeight = 0;
6500
6494
  let mainHeight = 0;
@@ -6518,22 +6512,6 @@ const _sfc_main$10 = /* @__PURE__ */ defineComponent({
6518
6512
  rightHeight = rightRect.height;
6519
6513
  maxHeight = Math.max(maxHeight, rightHeight);
6520
6514
  }
6521
- console.log(
6522
- `Row ${rowId}: main=${mainHeight}, left=${leftHeight}, right=${rightHeight}, max=${maxHeight}`
6523
- );
6524
- console.log(
6525
- `Elements found: main=${!!mainElement}, left=${!!leftElement}, right=${!!rightElement}`
6526
- );
6527
- if (mainElement) {
6528
- console.log(
6529
- `Main element current style.height: ${mainElement.style.height}, computed height: ${getComputedStyle(mainElement).height}`
6530
- );
6531
- }
6532
- if (rightElement) {
6533
- console.log(
6534
- `Right element current style.height: ${rightElement.style.height}, computed height: ${getComputedStyle(rightElement).height}`
6535
- );
6536
- }
6537
6515
  if (maxHeight > 0) {
6538
6516
  newTrHeightMap[rowId] = maxHeight;
6539
6517
  const referenceElement = mainElement || leftElement || rightElement;
@@ -6550,16 +6528,11 @@ const _sfc_main$10 = /* @__PURE__ */ defineComponent({
6550
6528
  });
6551
6529
  state.trHeightMap = newTrHeightMap;
6552
6530
  state.trPositionsMap = newTrPositionsMap;
6553
- console.log("✅ Height computation completed, updated state:", newTrHeightMap);
6554
- nextTick(() => {
6555
- console.log("🔄 Forcing re-render after height update");
6556
- });
6557
6531
  });
6558
6532
  }
6559
6533
  const handleTableResize = throttle(() => {
6560
6534
  const table = tableRef.value;
6561
- if (!table)
6562
- return;
6535
+ if (!table) return;
6563
6536
  const newScrollClientWidth = table.clientWidth;
6564
6537
  const newIsScroll = table.scrollWidth > table.clientWidth + 5;
6565
6538
  if (state.scrollClientWidth !== newScrollClientWidth) {
@@ -6613,8 +6586,7 @@ const _sfc_main$10 = /* @__PURE__ */ defineComponent({
6613
6586
  }
6614
6587
  const throttledTooltipUpdate = throttle(updateTooltipPosition, TOOLTIP_THROTTLE_DELAY);
6615
6588
  function dragStart(event, row, index2) {
6616
- if (!props2.sortable)
6617
- return;
6589
+ if (!props2.sortable) return;
6618
6590
  initDragState();
6619
6591
  computeTableRowHeight();
6620
6592
  state.dragIndex = index2;
@@ -6699,8 +6671,7 @@ const _sfc_main$10 = /* @__PURE__ */ defineComponent({
6699
6671
  }
6700
6672
  function updateDragTarget(mouseY) {
6701
6673
  state.lastMouseY = mouseY;
6702
- if (!state.dragRowId || Object.keys(state.trPositionsMap).length === 0)
6703
- return;
6674
+ if (!state.dragRowId || Object.keys(state.trPositionsMap).length === 0) return;
6704
6675
  const dragDistance = Math.abs(state.initialDragY - mouseY);
6705
6676
  const minDragDistance = 5;
6706
6677
  if (dragDistance < minDragDistance) {
@@ -6714,8 +6685,7 @@ const _sfc_main$10 = /* @__PURE__ */ defineComponent({
6714
6685
  }));
6715
6686
  positionEntries.sort((a, b) => a.top - b.top);
6716
6687
  for (const entry of positionEntries) {
6717
- if (entry.id === state.dragRowId)
6718
- continue;
6688
+ if (entry.id === state.dragRowId) continue;
6719
6689
  const position = entry;
6720
6690
  if (mouseY >= position.top && mouseY <= position.bottom) {
6721
6691
  targetRowId = position.id;
@@ -6725,10 +6695,8 @@ const _sfc_main$10 = /* @__PURE__ */ defineComponent({
6725
6695
  }
6726
6696
  if (!targetRowId) {
6727
6697
  for (let i = 0; i < positionEntries.length - 1; i++) {
6728
- if (positionEntries[i].id === state.dragRowId)
6729
- continue;
6730
- if (positionEntries[i + 1].id === state.dragRowId)
6731
- continue;
6698
+ if (positionEntries[i].id === state.dragRowId) continue;
6699
+ if (positionEntries[i + 1].id === state.dragRowId) continue;
6732
6700
  if (mouseY > positionEntries[i].bottom && mouseY < positionEntries[i + 1].top) {
6733
6701
  if (mouseY - positionEntries[i].bottom < positionEntries[i + 1].top - mouseY) {
6734
6702
  targetRowId = positionEntries[i].id;
@@ -6763,8 +6731,7 @@ const _sfc_main$10 = /* @__PURE__ */ defineComponent({
6763
6731
  `;
6764
6732
  }
6765
6733
  const targetPosition = state.trPositionsMap[state.targetRowId];
6766
- if (!targetPosition)
6767
- return "display: none;";
6734
+ if (!targetPosition) return "display: none;";
6768
6735
  const top2 = state.isAboveTarget ? targetPosition.top : targetPosition.bottom;
6769
6736
  const tableRect = tableRef.value?.getBoundingClientRect();
6770
6737
  const offsetTop = tableRect ? top2 - tableRect.top : 0;
@@ -6783,13 +6750,9 @@ const _sfc_main$10 = /* @__PURE__ */ defineComponent({
6783
6750
  });
6784
6751
  }
6785
6752
  function getRowHeight(row) {
6786
- if (!row || !row._lew_table_tr_id)
6787
- return "auto";
6753
+ if (!row || !row._lew_table_tr_id) return "auto";
6788
6754
  const height = state.trHeightMap[row._lew_table_tr_id];
6789
6755
  const result = height ? `${height}px` : "auto";
6790
- if (height) {
6791
- console.log(`getRowHeight for ${row._lew_table_tr_id}: ${result}`);
6792
- }
6793
6756
  return result;
6794
6757
  }
6795
6758
  function setTrRef(el, row) {
@@ -6813,18 +6776,6 @@ const _sfc_main$10 = /* @__PURE__ */ defineComponent({
6813
6776
  state.isInitialized = false;
6814
6777
  handleTableResize();
6815
6778
  });
6816
- if (props2.checkable && !props2.rowKey) {
6817
- console.warn(
6818
- '[LewTable] Invalid rowKey: "undefined". Expected: string when checkable is enabled'
6819
- );
6820
- }
6821
- if (props2.columns.some(
6822
- (col) => !col.width && (!col.children || col.children.length === 0)
6823
- )) {
6824
- console.warn(
6825
- '[LewTable] Invalid column width: "undefined". Expected: number for every column'
6826
- );
6827
- }
6828
6779
  });
6829
6780
  onUnmounted(() => {
6830
6781
  if (tooltipAnimationFrame) {
@@ -11895,13 +11846,13 @@ const _sfc_main$U = /* @__PURE__ */ defineComponent({
11895
11846
  },
11896
11847
  onClickOutside() {
11897
11848
  if (props2.clickOutsideToHide) {
11898
- instance.hide();
11849
+ instance?.hide();
11899
11850
  }
11900
11851
  }
11901
11852
  });
11902
11853
  instance?.popper.children[0].setAttribute("data-lew", "popover");
11903
11854
  if (disabled && instance) {
11904
- instance.disable();
11855
+ instance?.disable();
11905
11856
  }
11906
11857
  }
11907
11858
  onActivated(() => {
@@ -22830,7 +22781,7 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
22830
22781
  setup(__props2, { expose: __expose2, emit: __emit2 }) {
22831
22782
  const props2 = __props2;
22832
22783
  const emit2 = __emit2;
22833
- const selectValue = useModel(__props2, "modelValue");
22784
+ const modelValue2 = useModel(__props2, "modelValue");
22834
22785
  const slots = useSlots();
22835
22786
  const lewSelectRef = ref();
22836
22787
  const lewPopoverRef = ref();
@@ -22905,52 +22856,52 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
22905
22856
  state.loading = false;
22906
22857
  }
22907
22858
  function clearHandle() {
22908
- selectValue.value = [];
22859
+ modelValue2.value = [];
22909
22860
  emit2("clear");
22910
22861
  setTimeout(() => {
22911
22862
  lewPopoverRef.value && lewPopoverRef.value.refresh();
22912
22863
  }, 100);
22913
- emit2("change", selectValue.value);
22864
+ emit2("change", modelValue2.value);
22914
22865
  state.visible = false;
22915
22866
  emit2("blur");
22916
22867
  }
22917
22868
  function deleteTag({ value }) {
22918
- const valueIndex = selectValue.value.findIndex((_value) => value === _value);
22869
+ const valueIndex = modelValue2.value.findIndex((_value) => value === _value);
22919
22870
  if (valueIndex > -1) {
22920
- const item = selectValue.value[valueIndex];
22921
- selectValue.value.splice(valueIndex, 1);
22922
- emit2("delete", cloneDeep(selectValue.value), item);
22923
- if (selectValue.value.length === 0) {
22871
+ const item = modelValue2.value[valueIndex];
22872
+ modelValue2.value.splice(valueIndex, 1);
22873
+ emit2("delete", cloneDeep(modelValue2.value), item);
22874
+ if (modelValue2.value.length === 0) {
22924
22875
  lewPopoverValueRef.value && lewPopoverValueRef.value.hide();
22925
22876
  }
22926
22877
  setTimeout(() => {
22927
22878
  lewPopoverRef.value && lewPopoverRef.value.refresh();
22928
22879
  }, 100);
22929
- emit2("change", selectValue.value);
22880
+ emit2("change", modelValue2.value);
22930
22881
  }
22931
22882
  }
22932
22883
  function selectHandle(item) {
22933
22884
  if (item.disabled || item.isGroup) {
22934
22885
  return;
22935
22886
  }
22936
- const _value = selectValue.value || [];
22887
+ const _value = modelValue2.value || [];
22937
22888
  const index2 = _value.findIndex((e) => e === item.value);
22938
22889
  if (index2 >= 0) {
22939
22890
  _value.splice(index2, 1);
22940
22891
  } else {
22941
22892
  _value.push(item.value);
22942
22893
  }
22943
- selectValue.value = _value;
22894
+ modelValue2.value = _value;
22944
22895
  emit2("select", _value);
22945
22896
  setTimeout(() => {
22946
22897
  lewPopoverRef.value && lewPopoverRef.value.refresh();
22947
22898
  }, 100);
22948
- emit2("change", selectValue.value);
22899
+ emit2("change", modelValue2.value);
22949
22900
  getSelectWidth();
22950
22901
  }
22951
22902
  const getChecked = computed(() => (value) => {
22952
- if (selectValue.value) {
22953
- return JSON.parse(JSON.stringify(selectValue.value.includes(value)));
22903
+ if (modelValue2.value) {
22904
+ return JSON.parse(JSON.stringify(modelValue2.value.includes(value)));
22954
22905
  }
22955
22906
  return false;
22956
22907
  });
@@ -22962,7 +22913,7 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
22962
22913
  };
22963
22914
  });
22964
22915
  if (state.options.length > 0) {
22965
- const selectedRows = selectValue.value && selectValue.value.map((v) => {
22916
+ const selectedRows = modelValue2.value && modelValue2.value.map((v) => {
22966
22917
  return state.options.find((e) => v === e.value);
22967
22918
  });
22968
22919
  if (!selectedRows || selectedRows.length === 0) {
@@ -22978,7 +22929,7 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
22978
22929
  });
22979
22930
  const getSelectClassName = computed(() => {
22980
22931
  let { clearable, size, disabled, readonly } = props2;
22981
- clearable = clearable ? !!selectValue.value : false;
22932
+ clearable = clearable ? !!modelValue2.value : false;
22982
22933
  const focus = state.visible;
22983
22934
  return object2class("lew-select", {
22984
22935
  clearable,
@@ -23018,7 +22969,7 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
23018
22969
  if (state.options && state.options.length === 0 && props2.searchable) {
23019
22970
  search({ target: { value: "" } });
23020
22971
  }
23021
- const indexes = (selectValue.value || []).map((value) => state.options.findIndex((e) => e.value === value)).filter((index2) => index2 > -1);
22972
+ const indexes = (modelValue2.value || []).map((value) => state.options.findIndex((e) => e.value === value)).filter((index2) => index2 > -1);
23022
22973
  const minIndex = Math.min(...indexes);
23023
22974
  poll({
23024
22975
  callback: () => {
@@ -23089,6 +23040,15 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
23089
23040
  deep: true
23090
23041
  }
23091
23042
  );
23043
+ watch(
23044
+ () => modelValue2.value,
23045
+ () => {
23046
+ getSelectWidth();
23047
+ },
23048
+ {
23049
+ deep: true
23050
+ }
23051
+ );
23092
23052
  const getResultText = computed(() => {
23093
23053
  return state.options.length > 0 ? locale.t("selectMultiple.resultCount", {
23094
23054
  num: numFormat(state.options.filter((e) => !e.isGroup).length)
@@ -23104,8 +23064,7 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
23104
23064
  return getSelectedRows.value && getSelectedRows.value.length === 0;
23105
23065
  });
23106
23066
  const selectedItemsText = computed(() => {
23107
- if (!hasSelectedItems.value)
23108
- return "";
23067
+ if (!hasSelectedItems.value) return "";
23109
23068
  return getSelectedRows.value.map((item) => item.label).join(props2.valueTextSplit);
23110
23069
  });
23111
23070
  const showResultCount = computed(() => {
@@ -23128,6 +23087,7 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
23128
23087
  return props2.placeholder || locale.t("selectMultiple.placeholder");
23129
23088
  });
23130
23089
  const textValueStyle = computed(() => {
23090
+ console.log(state.selectWidth);
23131
23091
  return {
23132
23092
  opacity: state.visible ? 0.6 : 1,
23133
23093
  width: `calc(${state.selectWidth - 24}px)`
@@ -23404,7 +23364,7 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
23404
23364
  };
23405
23365
  }
23406
23366
  });
23407
- const LewSelectMultiple = /* @__PURE__ */ _export_sfc(_sfc_main$u, [["__scopeId", "data-v-b682dcf8"]]);
23367
+ const LewSelectMultiple = /* @__PURE__ */ _export_sfc(_sfc_main$u, [["__scopeId", "data-v-05030c8e"]]);
23408
23368
  const sliderEmits = {
23409
23369
  change: (value) => value
23410
23370
  };
@@ -23558,30 +23518,33 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
23558
23518
  return Math.max(getMin.value, Math.min(getMax.value, safeVal));
23559
23519
  }
23560
23520
  });
23521
+ const internalViewValue = ref(0);
23561
23522
  const dotRef = ref(null);
23562
23523
  const trackRef = ref(null);
23563
23524
  const dotX = ref(0);
23525
+ const throttledUpdateView = throttle((newValue) => {
23526
+ const clampedValue = Math.max(getMin.value, Math.min(getMax.value, newValue));
23527
+ internalViewValue.value = clampedValue;
23528
+ setDotByValue(clampedValue);
23529
+ }, 50);
23564
23530
  const throttledUpdateModelValue = throttle((newValue) => {
23565
23531
  const clampedValue = Math.max(getMin.value, Math.min(getMax.value, newValue));
23566
23532
  modelValue2.value = clampedValue;
23567
23533
  emit2("change", clampedValue);
23568
- }, 16);
23534
+ }, 250);
23569
23535
  function getMarkPosition(value) {
23570
23536
  const trackMax = getTrackMax.value;
23571
23537
  const trackMin = getTrackMin.value;
23572
23538
  const range = trackMax - trackMin;
23573
- if (range <= 0)
23574
- return 0;
23539
+ if (range <= 0) return 0;
23575
23540
  const safeValue = safeNumber(value, trackMin);
23576
23541
  const percentage = (safeValue - trackMin) / range * 100;
23577
23542
  return Math.max(0, Math.min(100, percentage));
23578
23543
  }
23579
23544
  function calculateValue(position) {
23580
- if (!trackRef.value)
23581
- return getMin.value;
23545
+ if (!trackRef.value) return getMin.value;
23582
23546
  const trackWidth = trackRef.value.clientWidth;
23583
- if (trackWidth <= 0)
23584
- return getMin.value;
23547
+ if (trackWidth <= 0) return getMin.value;
23585
23548
  const percentage = Math.max(0, Math.min(1, position / trackWidth));
23586
23549
  dotX.value = position;
23587
23550
  const trackMax = getTrackMax.value;
@@ -23589,8 +23552,7 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
23589
23552
  const range = trackMax - trackMin;
23590
23553
  const value = percentage * range + trackMin;
23591
23554
  const step = safeNumber(props2.step, 1);
23592
- if (step <= 0)
23593
- return value;
23555
+ if (step <= 0) return value;
23594
23556
  const decimalPlaces = (step.toString().split(".")[1] || "").length;
23595
23557
  return Number(value.toFixed(decimalPlaces));
23596
23558
  }
@@ -23600,28 +23562,20 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
23600
23562
  }
23601
23563
  try {
23602
23564
  const trackRect = trackRef.value.getBoundingClientRect();
23603
- const clickX = Math.max(
23604
- 0,
23605
- Math.min(e.clientX - trackRect.left, trackRect.width)
23606
- );
23565
+ const clickX = Math.max(0, Math.min(e.clientX - trackRect.left, trackRect.width));
23607
23566
  const step = safeNumber(props2.step, 1);
23608
- if (step <= 0)
23609
- return;
23567
+ if (step <= 0) return;
23610
23568
  const trackMax = getTrackMax.value;
23611
23569
  const trackMin = getTrackMin.value;
23612
23570
  const range = trackMax - trackMin;
23613
- if (range <= 0)
23614
- return;
23571
+ if (range <= 0) return;
23615
23572
  const stepSize = trackRect.width / (range / step);
23616
23573
  const nearestStep = Math.round(clickX / stepSize) * stepSize;
23617
23574
  const newValue = calculateValue(nearestStep);
23618
- const clampedValue = Math.max(
23619
- getMin.value,
23620
- Math.min(getMax.value, newValue)
23621
- );
23575
+ const clampedValue = Math.max(getMin.value, Math.min(getMax.value, newValue));
23622
23576
  if (clampedValue >= getMin.value && clampedValue <= getMax.value) {
23577
+ throttledUpdateView(clampedValue);
23623
23578
  throttledUpdateModelValue(clampedValue);
23624
- setDotByValue(clampedValue);
23625
23579
  }
23626
23580
  } catch (error) {
23627
23581
  console.warn("[LewSlider] setDot error:", error);
@@ -23632,33 +23586,24 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
23632
23586
  const trackMin = getTrackMin.value;
23633
23587
  const range = trackMax - trackMin;
23634
23588
  const step = safeNumber(props2.step, 1);
23635
- if (range <= 0 || step <= 0)
23636
- return 0;
23589
+ if (range <= 0 || step <= 0) return 0;
23637
23590
  const steps = Math.round((value - trackMin) / step);
23638
23591
  return steps * step / range * 100;
23639
23592
  }
23640
23593
  function setDotByClick(value) {
23641
- if (props2.readonly || props2.disabled)
23642
- return;
23594
+ if (props2.readonly || props2.disabled) return;
23643
23595
  const safeValue = safeNumber(value, getMin.value);
23644
- const clampedValue = Math.max(
23645
- getMin.value,
23646
- Math.min(getMax.value, safeValue)
23647
- );
23596
+ const clampedValue = Math.max(getMin.value, Math.min(getMax.value, safeValue));
23648
23597
  if (clampedValue >= getMin.value && clampedValue <= getMax.value) {
23598
+ throttledUpdateView(clampedValue);
23649
23599
  throttledUpdateModelValue(clampedValue);
23650
- setDotByValue(clampedValue);
23651
23600
  }
23652
23601
  }
23653
23602
  function setDotByValue(value) {
23654
- if (!dotRef.value)
23655
- return;
23603
+ if (!dotRef.value) return;
23656
23604
  try {
23657
23605
  const safeValue = safeNumber(value, getMin.value);
23658
- const clampedValue = Math.max(
23659
- getMin.value,
23660
- Math.min(getMax.value, safeValue)
23661
- );
23606
+ const clampedValue = Math.max(getMin.value, Math.min(getMax.value, safeValue));
23662
23607
  const nearestStep = calculateNearestStep(clampedValue);
23663
23608
  const clampedStep = Math.max(0, Math.min(100, nearestStep));
23664
23609
  dotRef.value.style.left = `${clampedStep}%`;
@@ -23686,12 +23631,9 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
23686
23631
  callback: (e) => {
23687
23632
  try {
23688
23633
  const newValue = calculateValue(e.x);
23689
- const clampedValue = Math.max(
23690
- getMin.value,
23691
- Math.min(getMax.value, newValue)
23692
- );
23634
+ const clampedValue = Math.max(getMin.value, Math.min(getMax.value, newValue));
23635
+ throttledUpdateView(clampedValue);
23693
23636
  throttledUpdateModelValue(clampedValue);
23694
- setDotByValue(clampedValue);
23695
23637
  } catch (error) {
23696
23638
  console.warn("[LewSlider] drag callback error:", error);
23697
23639
  }
@@ -23699,6 +23641,7 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
23699
23641
  });
23700
23642
  }
23701
23643
  const currentValue = modelValue2.value || getMin.value;
23644
+ internalViewValue.value = currentValue;
23702
23645
  setDotByValue(currentValue);
23703
23646
  } catch (error) {
23704
23647
  console.warn("[LewSlider] init error:", error);
@@ -23728,6 +23671,7 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
23728
23671
  onUnmounted(() => {
23729
23672
  try {
23730
23673
  _dragmove();
23674
+ throttledUpdateView.cancel();
23731
23675
  throttledUpdateModelValue.cancel();
23732
23676
  } catch (error) {
23733
23677
  console.warn("[LewSlider] cleanup error:", error);
@@ -23737,6 +23681,7 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
23737
23681
  modelValue2,
23738
23682
  (newValue) => {
23739
23683
  const safeValue = safeNumber(newValue, getMin.value);
23684
+ internalViewValue.value = safeValue;
23740
23685
  setDotByValue(safeValue);
23741
23686
  },
23742
23687
  { immediate: true }
@@ -23781,7 +23726,7 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
23781
23726
  }
23782
23727
  return {
23783
23728
  ...objStyle,
23784
- "width": any2px(width),
23729
+ width: any2px(width),
23785
23730
  "--lew-slider-height": `var(--lew-form-item-height-${safeSize})`
23786
23731
  };
23787
23732
  });
@@ -23823,10 +23768,7 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
23823
23768
  left: "0%"
23824
23769
  };
23825
23770
  }
23826
- const width = Math.max(
23827
- 0,
23828
- Math.min(100, (getMax.value - getMin.value) / range * 100)
23829
- );
23771
+ const width = Math.max(0, Math.min(100, (getMax.value - getMin.value) / range * 100));
23830
23772
  const left2 = getMarkPosition(getMin.value);
23831
23773
  return {
23832
23774
  width: `${width}%`,
@@ -23834,21 +23776,21 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
23834
23776
  };
23835
23777
  });
23836
23778
  const selectedTrackStyles = computed(() => {
23837
- const currentValue = modelValue2.value || getMin.value;
23779
+ const currentValue = internalViewValue.value || getMin.value;
23838
23780
  const width = getMarkPosition(currentValue);
23839
23781
  return {
23840
23782
  width: `${width}%`
23841
23783
  };
23842
23784
  });
23843
23785
  const dotStyles = computed(() => {
23844
- const currentValue = modelValue2.value;
23786
+ const currentValue = internalViewValue.value;
23845
23787
  const opacity = currentValue !== void 0 && currentValue !== null ? "1" : "0";
23846
23788
  return {
23847
23789
  opacity
23848
23790
  };
23849
23791
  });
23850
23792
  const tooltipConfig = computed(() => {
23851
- const currentValue = safeNumber(modelValue2.value);
23793
+ const currentValue = safeNumber(internalViewValue.value);
23852
23794
  return {
23853
23795
  content: safeFormatTooltip(currentValue),
23854
23796
  placement: "top",
@@ -23860,7 +23802,7 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
23860
23802
  const optionMarkStyles = computed(() => {
23861
23803
  return validOptions.value.map((item) => {
23862
23804
  const value = safeNumber(item.value);
23863
- const currentValue = safeNumber(modelValue2.value);
23805
+ const currentValue = safeNumber(internalViewValue.value);
23864
23806
  const isSelected = value <= currentValue;
23865
23807
  return {
23866
23808
  key: `mark-${item.value}`,
@@ -23963,7 +23905,7 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
23963
23905
  };
23964
23906
  }
23965
23907
  });
23966
- const LewSlider = /* @__PURE__ */ _export_sfc(_sfc_main$t, [["__scopeId", "data-v-b0677332"]]);
23908
+ const LewSlider = /* @__PURE__ */ _export_sfc(_sfc_main$t, [["__scopeId", "data-v-c779ddf8"]]);
23967
23909
  const sliderRangeEmits = {
23968
23910
  change: (value) => value
23969
23911
  };
@@ -24096,10 +24038,18 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
24096
24038
  return [getMin.value, getMax.value];
24097
24039
  }
24098
24040
  });
24041
+ const internalViewValue = ref([0, 0]);
24099
24042
  const dotRef1 = ref(null);
24100
24043
  const dotRef2 = ref(null);
24101
24044
  const trackRef = ref(null);
24102
24045
  const dotX = ref(0);
24046
+ const throttledUpdateView = throttle(
24047
+ (leftValue, rightValue) => {
24048
+ internalViewValue.value = [leftValue, rightValue];
24049
+ updateDotsByModelValue([leftValue, rightValue]);
24050
+ },
24051
+ 50
24052
+ );
24103
24053
  const throttledUpdateModelValue = throttle(
24104
24054
  (leftValue, rightValue) => {
24105
24055
  if (!modelValue2.value) {
@@ -24108,7 +24058,7 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
24108
24058
  modelValue2.value = [leftValue, rightValue];
24109
24059
  emit2("change", modelValue2.value);
24110
24060
  },
24111
- 16
24061
+ 250
24112
24062
  );
24113
24063
  function getMarkPosition(value) {
24114
24064
  const range = getTrackMax.value - getTrackMin.value;
@@ -24171,12 +24121,12 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
24171
24121
  trackMin: () => getTrackMin.value,
24172
24122
  callback: (e) => {
24173
24123
  const newValue = [
24174
- modelValue2.value?.[0] || getMin.value,
24175
- modelValue2.value?.[1] || getMax.value
24124
+ internalViewValue.value?.[0] || getMin.value,
24125
+ internalViewValue.value?.[1] || getMax.value
24176
24126
  ];
24177
24127
  newValue[0] = calculateValue(e.x);
24128
+ throttledUpdateView(newValue[0], newValue[1]);
24178
24129
  throttledUpdateModelValue(newValue[0], newValue[1]);
24179
- updateDotsByModelValue([newValue[0], newValue[1]]);
24180
24130
  }
24181
24131
  });
24182
24132
  _dragmove = dragmove({
@@ -24190,16 +24140,18 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
24190
24140
  trackMin: () => getTrackMin.value,
24191
24141
  callback: (e) => {
24192
24142
  const newValue = [
24193
- modelValue2.value?.[0] || getMin.value,
24194
- modelValue2.value?.[1] || getMax.value
24143
+ internalViewValue.value?.[0] || getMin.value,
24144
+ internalViewValue.value?.[1] || getMax.value
24195
24145
  ];
24196
24146
  newValue[1] = calculateValue(e.x);
24147
+ throttledUpdateView(newValue[0], newValue[1]);
24197
24148
  throttledUpdateModelValue(newValue[0], newValue[1]);
24198
- updateDotsByModelValue([newValue[0], newValue[1]]);
24199
24149
  }
24200
24150
  });
24201
24151
  }
24202
- updateDotsByModelValue(modelValue2.value || [getMin.value, getMax.value]);
24152
+ const initialValue = modelValue2.value || [getMin.value, getMax.value];
24153
+ internalViewValue.value = initialValue;
24154
+ updateDotsByModelValue(initialValue);
24203
24155
  }
24204
24156
  watch(
24205
24157
  [
@@ -24218,12 +24170,15 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
24218
24170
  });
24219
24171
  onUnmounted(() => {
24220
24172
  _dragmove();
24173
+ throttledUpdateView.cancel();
24221
24174
  throttledUpdateModelValue.cancel();
24222
24175
  });
24223
24176
  watch(
24224
24177
  modelValue2,
24225
24178
  (newValue) => {
24226
- updateDotsByModelValue(newValue || [getMin.value, getMax.value]);
24179
+ const safeValue = newValue || [getMin.value, getMax.value];
24180
+ internalViewValue.value = safeValue;
24181
+ updateDotsByModelValue(safeValue);
24227
24182
  },
24228
24183
  {
24229
24184
  deep: true
@@ -24295,8 +24250,8 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
24295
24250
  };
24296
24251
  });
24297
24252
  const selectedLineStyle = computed(() => {
24298
- const currentMin = modelValue2.value?.[0] ?? getMin.value;
24299
- const currentMax = modelValue2.value?.[1] ?? getMax.value;
24253
+ const currentMin = internalViewValue.value?.[0] ?? getMin.value;
24254
+ const currentMax = internalViewValue.value?.[1] ?? getMax.value;
24300
24255
  const width = Math.max(
24301
24256
  0,
24302
24257
  Math.min(
@@ -24313,8 +24268,8 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
24313
24268
  const optionStyles = computed(() => {
24314
24269
  return props2.options?.map((item, index2) => {
24315
24270
  const itemValue = Number(item.value);
24316
- const currentMin = modelValue2.value?.[0] ?? getMin.value;
24317
- const currentMax = modelValue2.value?.[1] ?? getMax.value;
24271
+ const currentMin = internalViewValue.value?.[0] ?? getMin.value;
24272
+ const currentMax = internalViewValue.value?.[1] ?? getMax.value;
24318
24273
  const isSelected = itemValue >= Math.min(currentMin, currentMax) && itemValue <= Math.max(currentMin, currentMax);
24319
24274
  const isDisabled = itemValue < Number(getMin.value) || itemValue > Number(getMax.value);
24320
24275
  return {
@@ -24343,17 +24298,17 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
24343
24298
  const dotStyles = computed(() => {
24344
24299
  return {
24345
24300
  dot1: {
24346
- opacity: modelValue2.value?.[0] !== void 0 ? "1" : "0"
24301
+ opacity: internalViewValue.value?.[0] !== void 0 ? "1" : "0"
24347
24302
  },
24348
24303
  dot2: {
24349
- opacity: modelValue2.value?.[1] !== void 0 ? "1" : "0"
24304
+ opacity: internalViewValue.value?.[1] !== void 0 ? "1" : "0"
24350
24305
  }
24351
24306
  };
24352
24307
  });
24353
24308
  const tooltipContent = computed(() => {
24354
24309
  return {
24355
- dot1: props2.formatTooltip(modelValue2.value?.[0] ?? getMin.value),
24356
- dot2: props2.formatTooltip(modelValue2.value?.[1] ?? getMax.value)
24310
+ dot1: props2.formatTooltip(internalViewValue.value?.[0] ?? getMin.value),
24311
+ dot2: props2.formatTooltip(internalViewValue.value?.[1] ?? getMax.value)
24357
24312
  };
24358
24313
  });
24359
24314
  return (_ctx, _cache) => {
@@ -24443,7 +24398,7 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
24443
24398
  };
24444
24399
  }
24445
24400
  });
24446
- const LewSliderRange = /* @__PURE__ */ _export_sfc(_sfc_main$s, [["__scopeId", "data-v-8702eb83"]]);
24401
+ const LewSliderRange = /* @__PURE__ */ _export_sfc(_sfc_main$s, [["__scopeId", "data-v-94778521"]]);
24447
24402
  const switchEmits = {
24448
24403
  change: (value) => value
24449
24404
  };
@@ -29489,7 +29444,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
29489
29444
  const emit2 = __emit2;
29490
29445
  const _options = ref(props2.options);
29491
29446
  function clickItem(item) {
29492
- const instance = props2.dropdownInstance || window.LewContextMenu.instance || window.LewHoverMenu.instance || null;
29447
+ const instance = props2.dropdownInstance || window.LewContextMenu?.instance || window.LewHoverMenu?.instance || null;
29493
29448
  if (isFunction$1(item.onClick)) {
29494
29449
  const proxyItem = new Proxy(item, {
29495
29450
  get(target, prop, receiver) {
@@ -29508,9 +29463,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
29508
29463
  emit2("change", item);
29509
29464
  }
29510
29465
  const uniqueId = getUniqueId();
29511
- const itemRefs = ref(
29512
- []
29513
- );
29466
+ const itemRefs = ref([]);
29514
29467
  function initTippy() {
29515
29468
  itemRefs.value.forEach((el, index2) => {
29516
29469
  if (!el || props2.options[index2].disabled || (props2.options[index2].children || []).length === 0) {
@@ -29548,7 +29501,10 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
29548
29501
  zIndex: 2001,
29549
29502
  content: menuDom
29550
29503
  });
29551
- window.LewContextMenu.menuInstance[uniqueId].popper.children[0].setAttribute("data-lew", "popover");
29504
+ window.LewContextMenu.menuInstance[uniqueId].popper.children[0].setAttribute(
29505
+ "data-lew",
29506
+ "popover"
29507
+ );
29552
29508
  });
29553
29509
  }
29554
29510
  onMounted(() => {
@@ -29626,7 +29582,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
29626
29582
  };
29627
29583
  }
29628
29584
  });
29629
- const LewContextMenu = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-c01b5d30"]]);
29585
+ const LewContextMenu = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-7eb0a25c"]]);
29630
29586
  const LewContextMenu$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
29631
29587
  __proto__: null,
29632
29588
  default: LewContextMenu
@@ -29694,10 +29650,10 @@ const LewVContextMenu = {
29694
29650
  return;
29695
29651
  e.preventDefault();
29696
29652
  const { instance } = window.LewContextMenu;
29697
- instance.hide();
29653
+ instance?.hide();
29698
29654
  const menuDom = createContextMenu(menuConfig.options);
29699
29655
  setTimeout(() => {
29700
- instance.setProps({
29656
+ instance?.setProps({
29701
29657
  content: menuDom,
29702
29658
  getReferenceClientRect: () => ({
29703
29659
  width: 0,
@@ -29708,7 +29664,7 @@ const LewVContextMenu = {
29708
29664
  right: e.clientX
29709
29665
  })
29710
29666
  });
29711
- instance.show();
29667
+ instance?.show();
29712
29668
  }, 120);
29713
29669
  };
29714
29670
  window.addEventListener(
@@ -29815,7 +29771,7 @@ const LewVHoverMenu = {
29815
29771
  return;
29816
29772
  const options = window.LewHoverMenu.menu[id];
29817
29773
  const { instance } = window.LewHoverMenu;
29818
- instance.hide();
29774
+ instance?.hide();
29819
29775
  const menuDom = document.createElement("div");
29820
29776
  createApp({
29821
29777
  render() {
@@ -29838,8 +29794,8 @@ const LewVHoverMenu = {
29838
29794
  right: rect.right
29839
29795
  })
29840
29796
  };
29841
- instance.setProps(props2);
29842
- instance.show();
29797
+ instance?.setProps(props2);
29798
+ instance?.show();
29843
29799
  }, 120);
29844
29800
  };
29845
29801
  window.addEventListener("mouseover", window.LewHoverMenu.hoverMenu);