lew-ui 1.8.15 → 1.8.17

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.es.js CHANGED
@@ -2764,8 +2764,8 @@ const cascaderProps = {
2764
2764
  };
2765
2765
  var LewCascader_vue_vue_type_style_index_0_scoped_true_lang = "";
2766
2766
  var LewCascader_vue_vue_type_style_index_1_lang = "";
2767
- const _withScopeId$5 = (n) => (pushScopeId("data-v-68eb9091"), n = n(), popScopeId(), n);
2768
- const _hoisted_1$y = /* @__PURE__ */ _withScopeId$5(() => /* @__PURE__ */ createElementVNode("path", {
2767
+ const _withScopeId$4 = (n) => (pushScopeId("data-v-68eb9091"), n = n(), popScopeId(), n);
2768
+ const _hoisted_1$y = /* @__PURE__ */ _withScopeId$4(() => /* @__PURE__ */ createElementVNode("path", {
2769
2769
  d: "M29.506 6.502 18.493 41.498",
2770
2770
  "data-v-5303b0ef": ""
2771
2771
  }, null, -1));
@@ -3196,9 +3196,7 @@ const _sfc_main$C = defineComponent({
3196
3196
  watch(
3197
3197
  () => tabsValue.value,
3198
3198
  (v) => {
3199
- if (v || v === 0) {
3200
- selectItem(v, "watch");
3201
- }
3199
+ selectItem(v, "watch");
3202
3200
  if (!state.isInit) {
3203
3201
  init();
3204
3202
  }
@@ -3236,8 +3234,9 @@ const _sfc_main$C = defineComponent({
3236
3234
  }, 100);
3237
3235
  };
3238
3236
  const selectItem = (value, type) => {
3239
- const index2 = props.options.findIndex((e) => value === e.value);
3240
- if (index2 >= 0 && state.curIndex != index2) {
3237
+ let index2 = props.options.findIndex((e) => value === e.value);
3238
+ index2 = index2 === -1 ? 0 : index2;
3239
+ if (index2 >= 0) {
3241
3240
  const _item = props.options[index2];
3242
3241
  if (tabsValue.value != _item.value) {
3243
3242
  tabsValue.value = _item.value;
@@ -3371,7 +3370,7 @@ const breadcrumbProps = {
3371
3370
  }
3372
3371
  };
3373
3372
  var LewBreadcrumb_vue_vue_type_style_index_0_scoped_true_lang = "";
3374
- const _withScopeId$4 = (n) => (pushScopeId("data-v-1e00024a"), n = n(), popScopeId(), n);
3373
+ const _withScopeId$3 = (n) => (pushScopeId("data-v-1e00024a"), n = n(), popScopeId(), n);
3375
3374
  const _hoisted_1$v = { class: "lew-breadcrumb" };
3376
3375
  const _hoisted_2$o = ["onClick"];
3377
3376
  const _hoisted_3$f = {
@@ -3388,9 +3387,9 @@ const _hoisted_4$d = {
3388
3387
  "stroke-linecap": "butt",
3389
3388
  "stroke-linejoin": "miter"
3390
3389
  };
3391
- const _hoisted_5$a = /* @__PURE__ */ _withScopeId$4(() => /* @__PURE__ */ createElementVNode("path", { d: "M29.506 6.502 18.493 41.498" }, null, -1));
3390
+ const _hoisted_5$9 = /* @__PURE__ */ _withScopeId$3(() => /* @__PURE__ */ createElementVNode("path", { d: "M29.506 6.502 18.493 41.498" }, null, -1));
3392
3391
  const _hoisted_6$5 = [
3393
- _hoisted_5$a
3392
+ _hoisted_5$9
3394
3393
  ];
3395
3394
  const _hoisted_7$4 = {
3396
3395
  key: 1,
@@ -3402,8 +3401,8 @@ const _hoisted_7$4 = {
3402
3401
  "stroke-linecap": "butt",
3403
3402
  "stroke-linejoin": "miter"
3404
3403
  };
3405
- const _hoisted_8$4 = /* @__PURE__ */ _withScopeId$4(() => /* @__PURE__ */ createElementVNode("path", { d: "m16 39.513 15.556-15.557L16 8.4" }, null, -1));
3406
- const _hoisted_9$3 = [
3404
+ const _hoisted_8$4 = /* @__PURE__ */ _withScopeId$3(() => /* @__PURE__ */ createElementVNode("path", { d: "m16 39.513 15.556-15.557L16 8.4" }, null, -1));
3405
+ const _hoisted_9$4 = [
3407
3406
  _hoisted_8$4
3408
3407
  ];
3409
3408
  const _sfc_main$A = defineComponent({
@@ -3424,7 +3423,7 @@ const _sfc_main$A = defineComponent({
3424
3423
  }, toDisplayString(item.label), 11, _hoisted_2$o),
3425
3424
  index2 != _ctx.options.length - 1 ? (openBlock(), createElementBlock("div", _hoisted_3$f, [
3426
3425
  _ctx.iconType === "sprit" ? (openBlock(), createElementBlock("svg", _hoisted_4$d, _hoisted_6$5)) : createCommentVNode("v-if", true),
3427
- _ctx.iconType === "shoulder" ? (openBlock(), createElementBlock("svg", _hoisted_7$4, _hoisted_9$3)) : createCommentVNode("v-if", true)
3426
+ _ctx.iconType === "shoulder" ? (openBlock(), createElementBlock("svg", _hoisted_7$4, _hoisted_9$4)) : createCommentVNode("v-if", true)
3428
3427
  ])) : createCommentVNode("v-if", true)
3429
3428
  ], 2);
3430
3429
  }), 128))
@@ -3662,7 +3661,7 @@ const _hoisted_4$c = {
3662
3661
  key: 2,
3663
3662
  class: "lew-input-prefixes-select"
3664
3663
  };
3665
- const _hoisted_5$9 = ["disabled", "placeholder", "type", "readonly"];
3664
+ const _hoisted_5$8 = ["disabled", "placeholder", "type", "readonly"];
3666
3665
  const _hoisted_6$4 = {
3667
3666
  key: 2,
3668
3667
  class: "lew-input-suffix"
@@ -3675,15 +3674,15 @@ const _hoisted_8$3 = {
3675
3674
  key: 1,
3676
3675
  class: "lew-input-suffix-icon"
3677
3676
  };
3678
- const _hoisted_9$2 = {
3677
+ const _hoisted_9$3 = {
3679
3678
  key: 2,
3680
3679
  class: "lew-input-suffix-select"
3681
3680
  };
3682
- const _hoisted_10$2 = {
3681
+ const _hoisted_10$3 = {
3683
3682
  key: 3,
3684
3683
  class: "lew-input-auto-width"
3685
3684
  };
3686
- const _hoisted_11$1 = {
3685
+ const _hoisted_11$2 = {
3687
3686
  key: 4,
3688
3687
  class: "lew-input-controls"
3689
3688
  };
@@ -3790,9 +3789,8 @@ const _sfc_main$y = defineComponent({
3790
3789
  const getType = computed(() => {
3791
3790
  if (props.type === "password") {
3792
3791
  return _type.value;
3793
- } else {
3794
- return props.type;
3795
3792
  }
3793
+ return props.type;
3796
3794
  });
3797
3795
  const getInputClassNames = computed(() => {
3798
3796
  const { size, readonly: readonly2, disabled, align, autoWidth } = props;
@@ -3915,9 +3913,9 @@ const _sfc_main$y = defineComponent({
3915
3913
  withDirectives(createElementVNode("input", {
3916
3914
  ref_key: "lewInputRef",
3917
3915
  ref: lewInputRef,
3916
+ "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => isRef(modelValue) ? modelValue.value = $event : null),
3918
3917
  class: "lew-input",
3919
3918
  autocomplete: "new-password",
3920
- "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => isRef(modelValue) ? modelValue.value = $event : null),
3921
3919
  disabled: _ctx.disabled,
3922
3920
  placeholder: _ctx.placeholder,
3923
3921
  type: unref(getType),
@@ -3927,7 +3925,7 @@ const _sfc_main$y = defineComponent({
3927
3925
  onChange: _cache[3] || (_cache[3] = ($event) => emit("change", unref(modelValue))),
3928
3926
  onBlur: blur,
3929
3927
  onFocus: focus
3930
- }, null, 40, _hoisted_5$9), [
3928
+ }, null, 40, _hoisted_5$8), [
3931
3929
  [vModelDynamic, unref(modelValue)]
3932
3930
  ]),
3933
3931
  _ctx.suffix ? withDirectives((openBlock(), createElementBlock("div", _hoisted_6$4, [
@@ -3938,7 +3936,7 @@ const _sfc_main$y = defineComponent({
3938
3936
  type: unref(suffixValue)
3939
3937
  }, null, 8, ["size", "type"])
3940
3938
  ])) : createCommentVNode("v-if", true),
3941
- _ctx.suffix === "select" ? (openBlock(), createElementBlock("div", _hoisted_9$2, [
3939
+ _ctx.suffix === "select" ? (openBlock(), createElementBlock("div", _hoisted_9$3, [
3942
3940
  createVNode(unref(LewDropdown), {
3943
3941
  placement: "bottom",
3944
3942
  trigger: "click",
@@ -3975,8 +3973,8 @@ const _sfc_main$y = defineComponent({
3975
3973
  trigger: _ctx.suffixTooltip ? "mouseenter" : ""
3976
3974
  }]
3977
3975
  ]) : createCommentVNode("v-if", true),
3978
- _ctx.autoWidth ? (openBlock(), createElementBlock("label", _hoisted_10$2, toDisplayString(unref(modelValue)), 1)) : createCommentVNode("v-if", true),
3979
- _ctx.showPassword || _ctx.clearable || _ctx.showCount ? (openBlock(), createElementBlock("div", _hoisted_11$1, [
3976
+ _ctx.autoWidth ? (openBlock(), createElementBlock("label", _hoisted_10$3, toDisplayString(unref(modelValue)), 1)) : createCommentVNode("v-if", true),
3977
+ _ctx.showPassword || _ctx.clearable || _ctx.showCount ? (openBlock(), createElementBlock("div", _hoisted_11$2, [
3980
3978
  unref(getCheckNumStr) ? (openBlock(), createElementBlock("div", {
3981
3979
  key: 0,
3982
3980
  class: normalizeClass(["lew-input-count", {
@@ -4010,11 +4008,11 @@ const _sfc_main$y = defineComponent({
4010
4008
  class: normalizeClass(["lew-form-icon-clear", {
4011
4009
  "lew-form-icon-clear-focus": unref(state).isFocus
4012
4010
  }]),
4011
+ size: unref(getIconSize),
4012
+ type: "x",
4013
4013
  onMousedown: _cache[7] || (_cache[7] = withModifiers(() => {
4014
4014
  }, ["prevent"])),
4015
- onClick: clear2,
4016
- size: unref(getIconSize),
4017
- type: "x"
4015
+ onClick: clear2
4018
4016
  }, null, 8, ["class", "size"])), [
4019
4017
  [_directive_tooltip, {
4020
4018
  content: "\u6E05\u7A7A",
@@ -4262,9 +4260,9 @@ const inputTagProps = {
4262
4260
  }
4263
4261
  };
4264
4262
  var LewInputTag_vue_vue_type_style_index_0_scoped_true_lang = "";
4265
- const _withScopeId$3 = (n) => (pushScopeId("data-v-4ac3e7ec"), n = n(), popScopeId(), n);
4263
+ const _withScopeId$2 = (n) => (pushScopeId("data-v-4ac3e7ec"), n = n(), popScopeId(), n);
4266
4264
  const _hoisted_1$r = { class: "lew-input-tag-view" };
4267
- const _hoisted_2$l = /* @__PURE__ */ _withScopeId$3(() => /* @__PURE__ */ createElementVNode("div", { style: { "margin-left": "-10px", "height": "26px" } }, null, -1));
4265
+ const _hoisted_2$l = /* @__PURE__ */ _withScopeId$2(() => /* @__PURE__ */ createElementVNode("div", { style: { "margin-left": "-10px", "height": "26px" } }, null, -1));
4268
4266
  const _sfc_main$w = defineComponent({
4269
4267
  __name: "LewInputTag",
4270
4268
  props: inputTagProps,
@@ -11939,6 +11937,11 @@ const checkboxProps = {
11939
11937
  default: false,
11940
11938
  description: "\u9009\u4E2D\u72B6\u6001"
11941
11939
  },
11940
+ certain: {
11941
+ type: Boolean,
11942
+ default: false,
11943
+ description: "\u662F\u5426\u662F\u786E\u5B9A\u72B6\u6001"
11944
+ },
11942
11945
  label: {
11943
11946
  type: String,
11944
11947
  default: "",
@@ -12015,29 +12018,13 @@ const checkboxGroupProps = {
12015
12018
  }
12016
12019
  };
12017
12020
  var LewCheckbox_vue_vue_type_style_index_0_scoped_true_lang = "";
12018
- const _withScopeId$2 = (n) => (pushScopeId("data-v-1d5ce89b"), n = n(), popScopeId(), n);
12019
12021
  const _hoisted_1$p = {
12020
12022
  key: 0,
12021
12023
  class: "icon-checkbox-box"
12022
12024
  };
12023
- const _hoisted_2$k = /* @__PURE__ */ _withScopeId$2(() => /* @__PURE__ */ createElementVNode("svg", {
12024
- class: "icon-checkbox",
12025
- viewBox: "0 0 24 24",
12026
- width: "24",
12027
- height: "24",
12028
- stroke: "currentColor",
12029
- "stroke-width": "4",
12030
- fill: "none",
12031
- "stroke-linecap": "round",
12032
- "stroke-linejoin": "round"
12033
- }, [
12034
- /* @__PURE__ */ createElementVNode("polyline", { points: "20 6 9 17 4 12" })
12035
- ], -1));
12036
- const _hoisted_3$d = [
12037
- _hoisted_2$k
12038
- ];
12039
- const _hoisted_4$b = ["checked"];
12040
- const _hoisted_5$8 = {
12025
+ const _hoisted_2$k = { class: "icon-certain" };
12026
+ const _hoisted_3$d = ["checked"];
12027
+ const _hoisted_4$b = {
12041
12028
  key: 1,
12042
12029
  class: "lew-checkbox-label"
12043
12030
  };
@@ -12056,8 +12043,21 @@ const _sfc_main$u = defineComponent({
12056
12043
  modelValue.value = checked;
12057
12044
  emit("change", checked);
12058
12045
  };
12046
+ const getIconSize = computed(() => {
12047
+ const { size } = props;
12048
+ switch (size) {
12049
+ case "small":
12050
+ return 9;
12051
+ case "medium":
12052
+ return 10;
12053
+ case "large":
12054
+ return 13;
12055
+ default:
12056
+ return 11;
12057
+ }
12058
+ });
12059
12059
  const getCheckboxClassName = computed(() => {
12060
- const { block, round: round2, iconable, size, disabled } = props;
12060
+ const { block, round: round2, iconable, size, disabled, certain } = props;
12061
12061
  const checked = modelValue.value || props.checked;
12062
12062
  const unicon = !iconable && block;
12063
12063
  return object2class("lew-checkbox", {
@@ -12066,22 +12066,34 @@ const _sfc_main$u = defineComponent({
12066
12066
  size,
12067
12067
  checked,
12068
12068
  unicon,
12069
- disabled
12069
+ disabled,
12070
+ certain
12070
12071
  });
12071
12072
  });
12072
12073
  return (_ctx, _cache) => {
12074
+ const _component_lew_icon = resolveComponent("lew-icon");
12073
12075
  return openBlock(), createElementBlock("label", {
12074
12076
  class: normalizeClass(["lew-checkbox", unref(getCheckboxClassName)])
12075
12077
  }, [
12076
- _ctx.iconable || !_ctx.iconable && !_ctx.block ? (openBlock(), createElementBlock("div", _hoisted_1$p, _hoisted_3$d)) : createCommentVNode("v-if", true),
12078
+ _ctx.iconable || !_ctx.iconable && !_ctx.block ? (openBlock(), createElementBlock("div", _hoisted_1$p, [
12079
+ withDirectives(createElementVNode("i", _hoisted_2$k, null, 512), [
12080
+ [vShow, _ctx.certain]
12081
+ ]),
12082
+ createVNode(_component_lew_icon, {
12083
+ "stroke-width": "3",
12084
+ class: "icon-checkbox",
12085
+ type: "check",
12086
+ size: unref(getIconSize)
12087
+ }, null, 8, ["size"])
12088
+ ])) : createCommentVNode("v-if", true),
12077
12089
  withDirectives(createElementVNode("input", {
12078
12090
  type: "checkbox",
12079
12091
  checked: unref(modelValue),
12080
12092
  onChange: setChecked
12081
- }, null, 40, _hoisted_4$b), [
12093
+ }, null, 40, _hoisted_3$d), [
12082
12094
  [vShow, false]
12083
12095
  ]),
12084
- _ctx.label ? (openBlock(), createElementBlock("span", _hoisted_5$8, toDisplayString(_ctx.label), 1)) : createCommentVNode("v-if", true)
12096
+ _ctx.label ? (openBlock(), createElementBlock("span", _hoisted_4$b, toDisplayString(_ctx.label), 1)) : createCommentVNode("v-if", true)
12085
12097
  ], 2);
12086
12098
  };
12087
12099
  }
@@ -13825,11 +13837,11 @@ const _hoisted_5$4 = { class: "lew-date-box" };
13825
13837
  const _hoisted_6$3 = { class: "lew-date-num" };
13826
13838
  const _hoisted_7$2 = ["onClick"];
13827
13839
  const _hoisted_8$2 = { class: "lew-date-label" };
13828
- const _hoisted_9$1 = {
13840
+ const _hoisted_9$2 = {
13829
13841
  key: 0,
13830
13842
  class: "lew-date-item-today"
13831
13843
  };
13832
- const _hoisted_10$1 = { class: "lew-date-value" };
13844
+ const _hoisted_10$2 = { class: "lew-date-value" };
13833
13845
  const _sfc_main$n = defineComponent({
13834
13846
  __name: "LewDate",
13835
13847
  props: dateProps,
@@ -13963,8 +13975,8 @@ const _sfc_main$n = defineComponent({
13963
13975
  onClick: ($event) => selectDateFn(item)
13964
13976
  }, [
13965
13977
  createElementVNode("div", _hoisted_8$2, [
13966
- unref(checkToday)(item) ? (openBlock(), createElementBlock("i", _hoisted_9$1)) : createCommentVNode("v-if", true),
13967
- createElementVNode("div", _hoisted_10$1, toDisplayString(item.showDate), 1)
13978
+ unref(checkToday)(item) ? (openBlock(), createElementBlock("i", _hoisted_9$2)) : createCommentVNode("v-if", true),
13979
+ createElementVNode("div", _hoisted_10$2, toDisplayString(item.showDate), 1)
13968
13980
  ])
13969
13981
  ], 10, _hoisted_7$2);
13970
13982
  }), 128))
@@ -13983,12 +13995,12 @@ const _hoisted_5$3 = { class: "lew-date-control-right" };
13983
13995
  const _hoisted_6$2 = { class: "lew-date-box" };
13984
13996
  const _hoisted_7$1 = { class: "lew-date-num" };
13985
13997
  const _hoisted_8$1 = ["onClick", "onMouseenter"];
13986
- const _hoisted_9 = {
13998
+ const _hoisted_9$1 = {
13987
13999
  key: 0,
13988
14000
  class: "lew-date-item-today"
13989
14001
  };
13990
- const _hoisted_10 = { class: "lew-date" };
13991
- const _hoisted_11 = { class: "lew-date-control-left" };
14002
+ const _hoisted_10$1 = { class: "lew-date" };
14003
+ const _hoisted_11$1 = { class: "lew-date-control-left" };
13992
14004
  const _hoisted_12 = { class: "cur-date" };
13993
14005
  const _hoisted_13 = { class: "lew-date-control-right" };
13994
14006
  const _hoisted_14 = { class: "lew-date-box" };
@@ -14307,7 +14319,7 @@ const _sfc_main$m = defineComponent({
14307
14319
  createElementVNode("div", {
14308
14320
  class: normalizeClass(["lew-date-label", unref(object2class2)("rangeSelected", item)])
14309
14321
  }, [
14310
- unref(object2class2)("today", item) ? (openBlock(), createElementBlock("div", _hoisted_9)) : createCommentVNode("v-if", true),
14322
+ unref(object2class2)("today", item) ? (openBlock(), createElementBlock("div", _hoisted_9$1)) : createCommentVNode("v-if", true),
14311
14323
  createElementVNode("div", {
14312
14324
  class: normalizeClass(["lew-date-value", unref(object2class2)("selected", item)])
14313
14325
  }, toDisplayString(item.showDate), 3)
@@ -14316,14 +14328,14 @@ const _sfc_main$m = defineComponent({
14316
14328
  }), 128))
14317
14329
  ])
14318
14330
  ]),
14319
- createElementVNode("div", _hoisted_10, [
14331
+ createElementVNode("div", _hoisted_10$1, [
14320
14332
  createVNode(unref(LewFlex), {
14321
14333
  x: "start",
14322
14334
  mode: "between",
14323
14335
  class: "lew-date-control"
14324
14336
  }, {
14325
14337
  default: withCtx(() => [
14326
- createElementVNode("div", _hoisted_11, [
14338
+ createElementVNode("div", _hoisted_11$1, [
14327
14339
  createCommentVNode(" \u4E0A\u4E00\u5E74 "),
14328
14340
  createVNode(unref(LewButton), {
14329
14341
  type: "light",
@@ -14655,11 +14667,6 @@ const _sfc_main$k = defineComponent({
14655
14667
  });
14656
14668
  var LewDateRangePicker = /* @__PURE__ */ _export_sfc(_sfc_main$k, [["__scopeId", "data-v-8717ea06"], ["__file", "C:/Users/div/Documents/GitHub/lew-ui/lib/components/date-picker/src/LewDateRangePicker.vue"]]);
14657
14669
  const tableProps = {
14658
- selectedKey: {
14659
- type: Array,
14660
- default: [],
14661
- description: "\u9009\u4E2D\u7684key"
14662
- },
14663
14670
  rowKey: {
14664
14671
  type: String,
14665
14672
  default: "id",
@@ -14688,26 +14695,40 @@ const tableProps = {
14688
14695
  checkable: {
14689
14696
  type: Boolean,
14690
14697
  default: false,
14691
- description: "\u662F\u5426\u663E\u793A\u9009\u62E9\u6846"
14698
+ description: "\u662F\u5426\u663E\u793A\u590D\u9009\u6846"
14699
+ },
14700
+ singleSelect: {
14701
+ type: Boolean,
14702
+ default: false,
14703
+ description: "\u662F\u5426\u5355\u9009"
14692
14704
  }
14693
14705
  };
14694
14706
  var LewTable_vue_vue_type_style_index_0_lang = "";
14695
14707
  const _hoisted_1$g = { class: "lew-table-tr" };
14696
- const _hoisted_2$b = { class: "lew-table-main" };
14697
- const _hoisted_3$6 = { class: "lew-table-tr" };
14708
+ const _hoisted_2$b = { key: 1 };
14709
+ const _hoisted_3$6 = { class: "lew-table-main" };
14698
14710
  const _hoisted_4$4 = { class: "lew-table-tr" };
14699
- const _hoisted_5$1 = ["onMouseenter"];
14700
- const _hoisted_6 = { class: "lew-table-main" };
14701
- const _hoisted_7 = ["onMouseenter"];
14702
- const _hoisted_8 = ["onMouseenter"];
14711
+ const _hoisted_5$1 = { class: "lew-table-tr" };
14712
+ const _hoisted_6 = {
14713
+ key: 0,
14714
+ class: "lew-table-fixed-left"
14715
+ };
14716
+ const _hoisted_7 = ["onClick", "onMouseenter"];
14717
+ const _hoisted_8 = { class: "lew-table-main" };
14718
+ const _hoisted_9 = ["onClick", "onMouseenter"];
14719
+ const _hoisted_10 = {
14720
+ key: 1,
14721
+ class: "lew-table-fixed-right"
14722
+ };
14723
+ const _hoisted_11 = ["onMouseenter"];
14703
14724
  const _sfc_main$j = defineComponent({
14704
14725
  __name: "LewTable",
14705
14726
  props: tableProps,
14706
- emits: ["update:selectedKey"],
14707
- setup(__props, { emit }) {
14727
+ setup(__props, { expose: __expose }) {
14708
14728
  const props = __props;
14709
- const selectedKey = useVModel(props, "selectedKey", emit);
14710
14729
  const tableRef = ref();
14730
+ const fixedLeftRef = ref();
14731
+ const fixedRightRef = ref();
14711
14732
  let obs;
14712
14733
  const state = reactive({
14713
14734
  hoverIndex: -1,
@@ -14715,8 +14736,10 @@ const _sfc_main$j = defineComponent({
14715
14736
  scrollbarVisible: false,
14716
14737
  scrollClientWidth: 0,
14717
14738
  hidScrollLine: "all",
14718
- checkList: [],
14719
- checkAll: false
14739
+ checkAll: false,
14740
+ fixedLeftWidth: 0,
14741
+ fixedRightWidth: 0,
14742
+ selectedKeysMap: {}
14720
14743
  });
14721
14744
  onActivated(() => {
14722
14745
  checkScroll();
@@ -14761,6 +14784,15 @@ const _sfc_main$j = defineComponent({
14761
14784
  if (props.checkable) {
14762
14785
  clientWidth += 40;
14763
14786
  }
14787
+ if (fixedLeftRef.value) {
14788
+ state.fixedLeftWidth = fixedLeftRef.value.clientWidth || 0;
14789
+ }
14790
+ if (fixedRightRef.value) {
14791
+ state.fixedRightWidth = fixedRightRef.value.clientWidth || 0;
14792
+ if (table.clientHeight < table.scrollHeight) {
14793
+ state.fixedRightWidth += 6;
14794
+ }
14795
+ }
14764
14796
  state.scrollClientWidth = table.clientWidth;
14765
14797
  state.scrollbarVisible = clientWidth > state.scrollClientWidth;
14766
14798
  checkScroll();
@@ -14807,45 +14839,57 @@ const _sfc_main$j = defineComponent({
14807
14839
  });
14808
14840
  const setAllChecked = (checked) => {
14809
14841
  if (checked) {
14810
- selectedKey.value = props.dataSource.map(
14811
- (e) => props.rowKey && e[props.rowKey]
14842
+ state.selectedKeysMap = _.mapValues(
14843
+ _.keyBy(props.dataSource, props.rowKey),
14844
+ () => true
14812
14845
  );
14813
14846
  } else {
14814
- selectedKey.value = [];
14847
+ state.selectedKeysMap = _.mapValues(
14848
+ _.keyBy(props.dataSource, props.rowKey),
14849
+ () => false
14850
+ );
14815
14851
  }
14816
14852
  };
14817
- const setChecked = (key, checked) => {
14818
- if (checked) {
14819
- selectedKey.value.push(key);
14820
- } else {
14821
- const index2 = props.selectedKey.findIndex((e) => e === key);
14822
- if (index2 >= 0) {
14823
- selectedKey.value.splice(index2, 1);
14824
- }
14825
- }
14826
- initCheckAll();
14853
+ const setSelectedKeys = (keys) => {
14854
+ state.selectedKeysMap = {};
14855
+ keys.forEach((key) => {
14856
+ state.selectedKeysMap[key] = true;
14857
+ });
14858
+ checkIsAll();
14859
+ };
14860
+ const getSelectedKeys = () => {
14861
+ return _.keys(_.pickBy(state.selectedKeysMap, (value) => value === true));
14862
+ };
14863
+ const checkIsAll = () => {
14864
+ const filteredKeys = _.keys(
14865
+ _.pickBy(state.selectedKeysMap, (value) => value === true)
14866
+ );
14867
+ const dataKey = props.dataSource.map((e) => String(e[props.rowKey]));
14868
+ const diffArr = _.difference(dataKey, filteredKeys);
14869
+ state.checkAll = _.isEmpty(diffArr);
14827
14870
  };
14828
- const initCheckAll = () => {
14829
- const isAll = selectedKey.value.length > 0 && selectedKey.value.length === props.dataSource.length;
14830
- if (isAll) {
14831
- state.checkAll = true;
14871
+ const selectTr = (row) => {
14872
+ if (props.singleSelect) {
14873
+ state.selectedKeysMap = {};
14874
+ }
14875
+ if (state.selectedKeysMap[row[props.rowKey]]) {
14876
+ state.selectedKeysMap[row[props.rowKey]] = false;
14832
14877
  } else {
14833
- state.checkAll = false;
14878
+ state.selectedKeysMap[row[props.rowKey]] = true;
14834
14879
  }
14880
+ checkIsAll();
14835
14881
  };
14836
- const initCheckbox = () => {
14837
- state.checkList = props.dataSource.map((item) => {
14838
- if (props.rowKey && selectedKey.value.includes(item[props.rowKey])) {
14882
+ const checkCertain = computed(() => {
14883
+ const selectedKeysMap = state.selectedKeysMap;
14884
+ const i = props.dataSource.findIndex((e) => {
14885
+ if (e[props.rowKey] in selectedKeysMap && selectedKeysMap[e[props.rowKey]]) {
14839
14886
  return true;
14840
14887
  }
14841
14888
  return false;
14842
14889
  });
14843
- };
14844
- initCheckbox();
14845
- watchArray(selectedKey, () => {
14846
- initCheckbox();
14847
- initCheckAll();
14890
+ return i >= 0;
14848
14891
  });
14892
+ __expose({ setSelectedKeys, getSelectedKeys });
14849
14893
  onMounted(() => {
14850
14894
  tableObserve();
14851
14895
  checkScroll();
@@ -14861,10 +14905,21 @@ const _sfc_main$j = defineComponent({
14861
14905
  const _component_lew_empty = resolveComponent("lew-empty");
14862
14906
  return openBlock(), createElementBlock("div", {
14863
14907
  class: normalizeClass(["lew-table-wrapper", {
14864
- "hide-line-left": !unref(state).scrollbarVisible || ["all", "left"].includes(unref(state).hidScrollLine) || _ctx.columns.filter((e) => e.fixed === "left").length > 0,
14865
- "hide-line-right": !unref(state).scrollbarVisible || ["all", "right"].includes(unref(state).hidScrollLine) || _ctx.columns.filter((e) => e.fixed === "right").length > 0
14908
+ "lew-table-checkable": props.checkable
14866
14909
  }])
14867
14910
  }, [
14911
+ createElementVNode("div", {
14912
+ style: normalizeStyle({ left: unref(any2px)(unref(state).fixedLeftWidth) }),
14913
+ class: normalizeClass([{
14914
+ "hide-line-left": !unref(state).scrollbarVisible || ["all", "left"].includes(unref(state).hidScrollLine)
14915
+ }, "lew-table-scroll-line-left"])
14916
+ }, null, 6),
14917
+ createElementVNode("div", {
14918
+ style: normalizeStyle({ right: unref(any2px)(unref(state).fixedRightWidth) }),
14919
+ class: normalizeClass([{
14920
+ "hide-line-right": !unref(state).scrollbarVisible || ["all", "right"].includes(unref(state).hidScrollLine)
14921
+ }, "lew-table-scroll-line-right"])
14922
+ }, null, 6),
14868
14923
  createElementVNode("div", {
14869
14924
  ref_key: "tableRef",
14870
14925
  ref: tableRef,
@@ -14880,25 +14935,26 @@ const _sfc_main$j = defineComponent({
14880
14935
  }, [
14881
14936
  unref(fixedColumns)("left").length > 0 ? (openBlock(), createElementBlock("div", {
14882
14937
  key: 0,
14883
- class: normalizeClass(["lew-table-fixed-left", {
14884
- "hid-scroll-line": ["all", "left"].includes(
14885
- unref(state).hidScrollLine
14886
- )
14887
- }])
14938
+ ref_key: "fixedLeftRef",
14939
+ ref: fixedLeftRef,
14940
+ class: "lew-table-fixed-left"
14888
14941
  }, [
14889
14942
  createElementVNode("div", _hoisted_1$g, [
14890
14943
  _ctx.checkable && unref(fixedColumns)("left").length > 0 ? (openBlock(), createBlock(unref(LewFlex), {
14891
14944
  key: 0,
14892
14945
  style: { "width": "50px" },
14946
+ class: "lew-table-td",
14893
14947
  x: "center"
14894
14948
  }, {
14895
14949
  default: withCtx(() => [
14896
- createVNode(unref(LewCheckbox), {
14950
+ !_ctx.singleSelect ? (openBlock(), createBlock(unref(LewCheckbox), {
14951
+ key: 0,
14897
14952
  disabled: _ctx.dataSource.length === 0,
14953
+ certain: unref(checkCertain) && !unref(state).checkAll,
14898
14954
  modelValue: unref(state).checkAll,
14899
14955
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => unref(state).checkAll = $event),
14900
14956
  onChange: _cache[1] || (_cache[1] = ($event) => setAllChecked($event))
14901
- }, null, 8, ["disabled", "modelValue"])
14957
+ }, null, 8, ["disabled", "certain", "modelValue"])) : (openBlock(), createElementBlock("span", _hoisted_2$b, "\u5355\u9009"))
14902
14958
  ]),
14903
14959
  _: 1
14904
14960
  })) : createCommentVNode("v-if", true),
@@ -14917,20 +14973,23 @@ const _sfc_main$j = defineComponent({
14917
14973
  }, 1032, ["x", "y", "style"]);
14918
14974
  }), 128))
14919
14975
  ])
14920
- ], 2)) : createCommentVNode("v-if", true),
14921
- createElementVNode("div", _hoisted_2$b, [
14922
- createElementVNode("div", _hoisted_3$6, [
14976
+ ], 512)) : createCommentVNode("v-if", true),
14977
+ createElementVNode("div", _hoisted_3$6, [
14978
+ createElementVNode("div", _hoisted_4$4, [
14923
14979
  _ctx.checkable && unref(fixedColumns)("left").length === 0 ? (openBlock(), createBlock(unref(LewFlex), {
14924
14980
  key: 0,
14925
14981
  style: { "width": "50px" },
14926
14982
  x: "center"
14927
14983
  }, {
14928
14984
  default: withCtx(() => [
14929
- createVNode(unref(LewCheckbox), {
14985
+ !_ctx.singleSelect ? (openBlock(), createBlock(unref(LewCheckbox), {
14986
+ key: 0,
14987
+ disabled: _ctx.dataSource.length === 0,
14988
+ certain: unref(checkCertain) && !unref(state).checkAll,
14930
14989
  modelValue: unref(state).checkAll,
14931
14990
  "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => unref(state).checkAll = $event),
14932
14991
  onChange: _cache[3] || (_cache[3] = ($event) => setAllChecked($event))
14933
- }, null, 8, ["modelValue"])
14992
+ }, null, 8, ["disabled", "certain", "modelValue"])) : createCommentVNode("v-if", true)
14934
14993
  ]),
14935
14994
  _: 1
14936
14995
  })) : createCommentVNode("v-if", true),
@@ -14952,13 +15011,11 @@ const _sfc_main$j = defineComponent({
14952
15011
  ]),
14953
15012
  unref(fixedColumns)("right").length > 0 ? (openBlock(), createElementBlock("div", {
14954
15013
  key: 1,
14955
- class: normalizeClass(["lew-table-fixed-right", {
14956
- "hid-scroll-line": ["all", "right"].includes(
14957
- unref(state).hidScrollLine
14958
- )
14959
- }])
15014
+ ref_key: "fixedRightRef",
15015
+ ref: fixedRightRef,
15016
+ class: "lew-table-fixed-right"
14960
15017
  }, [
14961
- createElementVNode("div", _hoisted_4$4, [
15018
+ createElementVNode("div", _hoisted_5$1, [
14962
15019
  (openBlock(true), createElementBlock(Fragment, null, renderList(unref(fixedColumns)("right"), (column, index2) => {
14963
15020
  return openBlock(), createBlock(unref(LewFlex), {
14964
15021
  key: `columns${index2}`,
@@ -14974,40 +15031,35 @@ const _sfc_main$j = defineComponent({
14974
15031
  }, 1032, ["x", "y", "style"]);
14975
15032
  }), 128))
14976
15033
  ])
14977
- ], 2)) : createCommentVNode("v-if", true)
15034
+ ], 512)) : createCommentVNode("v-if", true)
14978
15035
  ], 36),
14979
15036
  _ctx.dataSource.length > 0 ? (openBlock(), createElementBlock("div", {
14980
15037
  key: 0,
14981
15038
  class: "lew-table-body",
14982
15039
  style: normalizeStyle(`width: ${unref(getTdTotalWidth)}px`)
14983
15040
  }, [
14984
- unref(fixedColumns)("left").length > 0 ? (openBlock(), createElementBlock("div", {
14985
- key: 0,
14986
- class: normalizeClass(["lew-table-fixed-left", {
14987
- "hid-scroll-line": ["all", "left"].includes(
14988
- unref(state).hidScrollLine
14989
- )
14990
- }])
14991
- }, [
15041
+ unref(fixedColumns)("left").length > 0 ? (openBlock(), createElementBlock("div", _hoisted_6, [
14992
15042
  (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.dataSource, (row, i) => {
14993
15043
  return openBlock(), createElementBlock("div", {
14994
15044
  key: `data${i}`,
14995
15045
  class: normalizeClass(["lew-table-tr", {
14996
- "lew-table-tr-hover": unref(state).hoverIndex === i
15046
+ "lew-table-tr-hover": unref(state).hoverIndex === i,
15047
+ "lew-table-tr-selected": unref(state).selectedKeysMap[row[_ctx.rowKey]]
14997
15048
  }]),
15049
+ onClick: ($event) => selectTr(row),
14998
15050
  onMouseenter: ($event) => unref(state).hoverIndex = i
14999
15051
  }, [
15000
15052
  _ctx.checkable && unref(fixedColumns)("left").length > 0 ? (openBlock(), createBlock(unref(LewFlex), {
15001
15053
  key: 0,
15002
15054
  style: { "width": "50px" },
15003
- x: "center"
15055
+ x: "center",
15056
+ class: "lew-table-checkbox-wrapper"
15004
15057
  }, {
15005
15058
  default: withCtx(() => [
15006
15059
  createVNode(unref(LewCheckbox), {
15007
- modelValue: unref(state).checkList[i],
15008
- "onUpdate:modelValue": ($event) => unref(state).checkList[i] = $event,
15009
- onChange: ($event) => _ctx.rowKey && setChecked(row[_ctx.rowKey], $event)
15010
- }, null, 8, ["modelValue", "onUpdate:modelValue", "onChange"])
15060
+ class: "lew-table-checkbox",
15061
+ checked: unref(state).selectedKeysMap[row[_ctx.rowKey]]
15062
+ }, null, 8, ["checked"])
15011
15063
  ]),
15012
15064
  _: 2
15013
15065
  }, 1024)) : createCommentVNode("v-if", true),
@@ -15032,29 +15084,31 @@ const _sfc_main$j = defineComponent({
15032
15084
  _: 2
15033
15085
  }, 1032, ["x", "y", "style"]);
15034
15086
  }), 128))
15035
- ], 42, _hoisted_5$1);
15087
+ ], 42, _hoisted_7);
15036
15088
  }), 128))
15037
- ], 2)) : createCommentVNode("v-if", true),
15038
- createElementVNode("div", _hoisted_6, [
15089
+ ])) : createCommentVNode("v-if", true),
15090
+ createElementVNode("div", _hoisted_8, [
15039
15091
  (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.dataSource, (row, i) => {
15040
15092
  return openBlock(), createElementBlock("div", {
15041
15093
  key: `data${i}`,
15042
15094
  class: normalizeClass(["lew-table-tr", {
15043
- "lew-table-tr-hover": unref(state).hoverIndex === i
15095
+ "lew-table-tr-hover": unref(state).hoverIndex === i,
15096
+ "lew-table-tr-selected": unref(state).selectedKeysMap[row[_ctx.rowKey]]
15044
15097
  }]),
15098
+ onClick: ($event) => selectTr(row),
15045
15099
  onMouseenter: ($event) => unref(state).hoverIndex = i
15046
15100
  }, [
15047
15101
  _ctx.checkable && unref(fixedColumns)("left").length === 0 ? (openBlock(), createBlock(unref(LewFlex), {
15048
15102
  key: 0,
15049
15103
  style: { "width": "50px" },
15050
- x: "center"
15104
+ x: "center",
15105
+ class: "lew-table-checkbox-wrapper"
15051
15106
  }, {
15052
15107
  default: withCtx(() => [
15053
15108
  createVNode(unref(LewCheckbox), {
15054
- modelValue: unref(state).checkList[i],
15055
- "onUpdate:modelValue": ($event) => unref(state).checkList[i] = $event,
15056
- onChange: ($event) => _ctx.rowKey && setChecked(row[_ctx.rowKey], $event)
15057
- }, null, 8, ["modelValue", "onUpdate:modelValue", "onChange"])
15109
+ class: "lew-table-checkbox",
15110
+ checked: unref(state).selectedKeysMap[row[_ctx.rowKey]]
15111
+ }, null, 8, ["checked"])
15058
15112
  ]),
15059
15113
  _: 2
15060
15114
  }, 1024)) : createCommentVNode("v-if", true),
@@ -15082,22 +15136,16 @@ const _sfc_main$j = defineComponent({
15082
15136
  _: 2
15083
15137
  }, 1032, ["x", "y", "style"]);
15084
15138
  }), 128))
15085
- ], 42, _hoisted_7);
15139
+ ], 42, _hoisted_9);
15086
15140
  }), 128))
15087
15141
  ]),
15088
- unref(fixedColumns)("right").length > 0 ? (openBlock(), createElementBlock("div", {
15089
- key: 1,
15090
- class: normalizeClass(["lew-table-fixed-right", {
15091
- "hid-scroll-line": ["all", "right"].includes(
15092
- unref(state).hidScrollLine
15093
- )
15094
- }])
15095
- }, [
15142
+ unref(fixedColumns)("right").length > 0 ? (openBlock(), createElementBlock("div", _hoisted_10, [
15096
15143
  (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.dataSource, (row, i) => {
15097
15144
  return openBlock(), createElementBlock("div", {
15098
15145
  key: `data${i}`,
15099
15146
  class: normalizeClass(["lew-table-tr", {
15100
- "lew-table-tr-hover": unref(state).hoverIndex === i
15147
+ "lew-table-tr-hover": unref(state).hoverIndex === i,
15148
+ "lew-table-tr-selected": unref(state).selectedKeysMap[row[_ctx.rowKey]]
15101
15149
  }]),
15102
15150
  onMouseenter: ($event) => unref(state).hoverIndex = i
15103
15151
  }, [
@@ -15122,9 +15170,9 @@ const _sfc_main$j = defineComponent({
15122
15170
  _: 2
15123
15171
  }, 1032, ["x", "y", "style"]);
15124
15172
  }), 128))
15125
- ], 42, _hoisted_8);
15173
+ ], 42, _hoisted_11);
15126
15174
  }), 128))
15127
- ], 2)) : createCommentVNode("v-if", true)
15175
+ ])) : createCommentVNode("v-if", true)
15128
15176
  ], 4)) : createCommentVNode("v-if", true)
15129
15177
  ], 36),
15130
15178
  _ctx.dataSource.length === 0 ? (openBlock(), createBlock(unref(LewFlex), {