lew-ui 2.2.4 → 2.2.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.
@@ -32,6 +32,11 @@ declare const __VLS_component: import('vue').DefineComponent<{
32
32
  default: string;
33
33
  description: string;
34
34
  };
35
+ iconSize: {
36
+ type: NumberConstructor;
37
+ default: string;
38
+ description: string;
39
+ };
35
40
  loading: {
36
41
  type: BooleanConstructor;
37
42
  default: boolean;
@@ -85,6 +90,11 @@ declare const __VLS_component: import('vue').DefineComponent<{
85
90
  default: string;
86
91
  description: string;
87
92
  };
93
+ iconSize: {
94
+ type: NumberConstructor;
95
+ default: string;
96
+ description: string;
97
+ };
88
98
  loading: {
89
99
  type: BooleanConstructor;
90
100
  default: boolean;
@@ -117,6 +127,7 @@ declare const __VLS_component: import('vue').DefineComponent<{
117
127
  disabled: boolean;
118
128
  loading: boolean;
119
129
  iconPosition: string;
130
+ iconSize: number;
120
131
  request: Function;
121
132
  }, {}>;
122
133
  declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, ReturnType<typeof __VLS_template>>;
@@ -34,6 +34,11 @@ export declare const buttonProps: {
34
34
  default: string;
35
35
  description: string;
36
36
  };
37
+ iconSize: {
38
+ type: NumberConstructor;
39
+ default: string;
40
+ description: string;
41
+ };
37
42
  loading: {
38
43
  type: BooleanConstructor;
39
44
  default: boolean;
@@ -133,6 +133,7 @@ declare const __VLS_component: import('vue').DefineComponent<{
133
133
  disabled: boolean;
134
134
  loading: boolean;
135
135
  iconPosition: string;
136
+ iconSize: number;
136
137
  request: Function;
137
138
  };
138
139
  cancelProps: {
@@ -145,6 +146,7 @@ declare const __VLS_component: import('vue').DefineComponent<{
145
146
  disabled: boolean;
146
147
  loading: boolean;
147
148
  iconPosition: string;
149
+ iconSize: number;
148
150
  request: Function;
149
151
  };
150
152
  closeOnClickOverlay: boolean;
@@ -147,6 +147,7 @@ declare const __VLS_component: import('vue').DefineComponent<{
147
147
  disabled: boolean;
148
148
  loading: boolean;
149
149
  iconPosition: string;
150
+ iconSize: number;
150
151
  request: Function;
151
152
  };
152
153
  cancelProps: {
@@ -159,6 +160,7 @@ declare const __VLS_component: import('vue').DefineComponent<{
159
160
  disabled: boolean;
160
161
  loading: boolean;
161
162
  iconPosition: string;
163
+ iconSize: number;
162
164
  request: Function;
163
165
  };
164
166
  hideOkButton: boolean;
@@ -12,6 +12,11 @@ declare const __VLS_component: import('vue').DefineComponent<{
12
12
  default: string;
13
13
  description: string;
14
14
  };
15
+ visiblePagesCount: {
16
+ type: NumberConstructor;
17
+ default: number;
18
+ description: string;
19
+ };
15
20
  }, {}, unknown, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
16
21
  change: (...args: any[]) => void;
17
22
  "update:currentPage": (...args: any[]) => void;
@@ -26,12 +31,18 @@ declare const __VLS_component: import('vue').DefineComponent<{
26
31
  default: string;
27
32
  description: string;
28
33
  };
34
+ visiblePagesCount: {
35
+ type: NumberConstructor;
36
+ default: number;
37
+ description: string;
38
+ };
29
39
  }>> & {
30
40
  onChange?: ((...args: any[]) => any) | undefined;
31
41
  "onUpdate:currentPage"?: ((...args: any[]) => any) | undefined;
32
42
  "onUpdate:pageSize"?: ((...args: any[]) => any) | undefined;
33
43
  }, {
34
44
  size: string;
45
+ visiblePagesCount: number;
35
46
  }, {}>;
36
47
  declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, ReturnType<typeof __VLS_template>>;
37
48
  export default _default;
@@ -34,4 +34,9 @@ export declare const paginationProps: {
34
34
  default: string;
35
35
  description: string;
36
36
  };
37
+ visiblePagesCount: {
38
+ type: NumberConstructor;
39
+ default: number;
40
+ description: string;
41
+ };
37
42
  };
@@ -124,6 +124,7 @@ declare const __VLS_component: import('vue').DefineComponent<{
124
124
  disabled: boolean;
125
125
  loading: boolean;
126
126
  iconPosition: string;
127
+ iconSize: number;
127
128
  request: Function;
128
129
  };
129
130
  cancelProps: {
@@ -136,6 +137,7 @@ declare const __VLS_component: import('vue').DefineComponent<{
136
137
  disabled: boolean;
137
138
  loading: boolean;
138
139
  iconPosition: string;
140
+ iconSize: number;
139
141
  request: Function;
140
142
  };
141
143
  }, {}>;
package/dist/index.mjs CHANGED
@@ -7671,7 +7671,7 @@ const _sfc_main$P = /* @__PURE__ */ defineComponent({
7671
7671
  }
7672
7672
  state.activeItemStyle = {
7673
7673
  width: `${activeRef == null ? void 0 : activeRef.offsetWidth}px`,
7674
- height: `${activeRef == null ? void 0 : activeRef.offsetHeight}px`,
7674
+ height: props.type === "line" ? "" : `${activeRef == null ? void 0 : activeRef.offsetHeight}px`,
7675
7675
  transform: `translate(${activeRef == null ? void 0 : activeRef.offsetLeft}px,-50%)`
7676
7676
  };
7677
7677
  };
@@ -7804,7 +7804,7 @@ const _sfc_main$P = /* @__PURE__ */ defineComponent({
7804
7804
  };
7805
7805
  }
7806
7806
  });
7807
- const LewTabs = /* @__PURE__ */ _export_sfc(_sfc_main$P, [["__scopeId", "data-v-a5407266"]]);
7807
+ const LewTabs = /* @__PURE__ */ _export_sfc(_sfc_main$P, [["__scopeId", "data-v-a49fe2f6"]]);
7808
7808
  const breadcrumbProps = {
7809
7809
  options: {
7810
7810
  type: Array,
@@ -11680,7 +11680,7 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
11680
11680
  };
11681
11681
  }
11682
11682
  });
11683
- const LewCheckbox = /* @__PURE__ */ _export_sfc(_sfc_main$D, [["__scopeId", "data-v-dbdb9ea9"]]);
11683
+ const LewCheckbox = /* @__PURE__ */ _export_sfc(_sfc_main$D, [["__scopeId", "data-v-3ac4d4d0"]]);
11684
11684
  const _sfc_main$C = /* @__PURE__ */ defineComponent({
11685
11685
  __name: "LewCheckboxGroup",
11686
11686
  props: /* @__PURE__ */ mergeModels(checkboxGroupProps, {
@@ -11931,7 +11931,7 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
11931
11931
  };
11932
11932
  }
11933
11933
  });
11934
- const LewRadio = /* @__PURE__ */ _export_sfc(_sfc_main$B, [["__scopeId", "data-v-8d3bbc75"]]);
11934
+ const LewRadio = /* @__PURE__ */ _export_sfc(_sfc_main$B, [["__scopeId", "data-v-1c92baed"]]);
11935
11935
  const _sfc_main$A = /* @__PURE__ */ defineComponent({
11936
11936
  __name: "LewRadioGroup",
11937
11937
  props: /* @__PURE__ */ mergeModels(radioGroupProps, {
@@ -14867,11 +14867,16 @@ const paginationModel = {
14867
14867
  const paginationProps = {
14868
14868
  size: {
14869
14869
  type: String,
14870
- default: "medium",
14870
+ default: "small",
14871
14871
  description: "尺寸,可选值为 small、medium、large"
14872
+ },
14873
+ visiblePagesCount: {
14874
+ type: Number,
14875
+ default: 5,
14876
+ description: "显示的页码数"
14872
14877
  }
14873
14878
  };
14874
- const _hoisted_1$m = { class: "lew-pagination" };
14879
+ const _hoisted_1$m = ["onClick"];
14875
14880
  const _sfc_main$r = /* @__PURE__ */ defineComponent({
14876
14881
  __name: "LewPagination",
14877
14882
  props: /* @__PURE__ */ mergeModels(paginationProps, {
@@ -14909,31 +14914,49 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
14909
14914
  }),
14910
14915
  emits: /* @__PURE__ */ mergeModels(["change", "update:currentPage", "update:pageSize"], ["update:total", "update:currentPage", "update:pageSize", "update:pageSizeOptions"]),
14911
14916
  setup(__props, { emit: __emit }) {
14917
+ const props = __props;
14912
14918
  const emit = __emit;
14913
- useModel(__props, "total");
14919
+ const total = useModel(__props, "total");
14914
14920
  const currentPage = useModel(__props, "currentPage");
14915
14921
  const pageSize = useModel(__props, "pageSize");
14916
14922
  const pageSizeOptions = useModel(__props, "pageSizeOptions");
14917
14923
  const state = reactive({
14918
14924
  toPage: void 0,
14919
- pageSize: pageSize.value
14925
+ pageSize: pageSize.value,
14926
+ visiblePagesCount: props.visiblePagesCount
14920
14927
  });
14921
- const totalPages = computed(() => {
14922
- let _arr = new Array(123).fill({ label: "", value: "" });
14923
- console.log(
14924
- _arr.map((_, i) => {
14925
- let page = i + 1;
14926
- return { label: page, value: page };
14927
- })
14928
- );
14929
- return _arr.map((_, i) => {
14930
- let page = i + 1;
14931
- return { label: page, value: page };
14932
- });
14928
+ onMounted(() => {
14929
+ state.visiblePagesCount = Math.max(state.visiblePagesCount, 5);
14930
+ state.visiblePagesCount = Math.min(state.visiblePagesCount, 12);
14931
+ });
14932
+ const totalPages = computed(() => Math.ceil(total.value / state.pageSize));
14933
+ const visiblePages = computed(() => {
14934
+ const _currentPage = currentPage.value;
14935
+ const totalPages2 = Math.ceil(total.value / state.pageSize);
14936
+ let startPage = _currentPage - Math.floor(state.visiblePagesCount / 2);
14937
+ if (_currentPage < state.visiblePagesCount / 2 + 2) {
14938
+ startPage = 1;
14939
+ }
14940
+ if (startPage < 1) {
14941
+ startPage = 1;
14942
+ }
14943
+ let endPage = startPage + state.visiblePagesCount - 1;
14944
+ if (endPage > totalPages2) {
14945
+ endPage = totalPages2;
14946
+ startPage = endPage - state.visiblePagesCount + 1;
14947
+ if (startPage < 1) {
14948
+ startPage = 1;
14949
+ }
14950
+ }
14951
+ const visiblePages2 = [];
14952
+ for (let i = startPage; i <= endPage; i++) {
14953
+ visiblePages2.push(i);
14954
+ }
14955
+ return visiblePages2;
14933
14956
  });
14934
14957
  const changePage = (page) => {
14935
14958
  page = Math.floor(page);
14936
- if (page < 1 || page > totalPages.value.length) {
14959
+ if (page < 1 || page > totalPages.value) {
14937
14960
  return;
14938
14961
  }
14939
14962
  currentPage.value = page;
@@ -14943,6 +14966,12 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
14943
14966
  pageSize: state.pageSize
14944
14967
  });
14945
14968
  };
14969
+ const startEllipsis = computed(() => visiblePages.value[0] > 2 + 1);
14970
+ const endEllipsis = computed(
14971
+ () => visiblePages.value[visiblePages.value.length - 1] < totalPages.value - 2
14972
+ );
14973
+ const showOne = computed(() => visiblePages.value[0] > 1);
14974
+ const showMax = computed(() => visiblePages.value[visiblePages.value.length - 1] < totalPages.value);
14946
14975
  const checkPageSize = (value) => {
14947
14976
  state.pageSize = value;
14948
14977
  changePage(currentPage.value);
@@ -14950,52 +14979,101 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
14950
14979
  const checkPageNum = (value) => {
14951
14980
  const page = Number(value);
14952
14981
  state.toPage = void 0;
14953
- if (page > totalPages.value.length || page < 1) {
14982
+ if (page > totalPages.value || page < 1) {
14954
14983
  return;
14955
14984
  }
14956
14985
  currentPage.value = page;
14957
14986
  changePage(value);
14958
14987
  };
14988
+ const getPaginationClassNmae = computed(() => {
14989
+ const { size } = props;
14990
+ return object2class("lew-pagination", {
14991
+ size
14992
+ });
14993
+ });
14959
14994
  return (_ctx, _cache) => {
14960
14995
  const _component_lew_button = resolveComponent("lew-button");
14961
- const _component_lew_tabs = resolveComponent("lew-tabs");
14962
- return openBlock(), createElementBlock("div", _hoisted_1$m, [
14996
+ return openBlock(), createElementBlock("div", {
14997
+ class: normalizeClass(["lew-pagination", unref(getPaginationClassNmae)])
14998
+ }, [
14963
14999
  createVNode(unref(LewFlex), {
14964
15000
  class: "control",
14965
15001
  gap: "10"
14966
15002
  }, {
14967
15003
  default: withCtx(() => [
14968
15004
  renderSlot(_ctx.$slots, "left"),
14969
- createVNode(_component_lew_button, {
14970
- size: _ctx.size,
14971
- icon: "chevron-left",
14972
- type: "text",
14973
- onClick: _cache[0] || (_cache[0] = ($event) => changePage(currentPage.value - 1))
14974
- }, null, 8, ["size"]),
14975
15005
  createVNode(unref(LewFlex), {
14976
15006
  class: "lew-pagination-page-box",
14977
15007
  gap: "5"
14978
15008
  }, {
14979
15009
  default: withCtx(() => [
14980
- createVNode(_component_lew_tabs, {
15010
+ createVNode(_component_lew_button, {
15011
+ size: _ctx.size,
15012
+ icon: "chevron-left",
15013
+ "icon-size": "16",
15014
+ type: "text",
15015
+ onClick: _cache[0] || (_cache[0] = ($event) => changePage(currentPage.value - 1))
15016
+ }, null, 8, ["size"]),
15017
+ unref(showOne) ? (openBlock(), createElementBlock("div", {
15018
+ key: 0,
15019
+ class: "btn lew-pagination-page-btn",
15020
+ onClick: _cache[1] || (_cache[1] = ($event) => changePage(1))
15021
+ }, "1")) : createCommentVNode("", true),
15022
+ unref(startEllipsis) ? (openBlock(), createElementBlock("div", {
15023
+ key: 1,
15024
+ class: "btn control-btn",
15025
+ onClick: _cache[2] || (_cache[2] = ($event) => changePage(unref(visiblePages)[0] - 1))
15026
+ }, [
15027
+ createVNode(unref(script), {
15028
+ size: "14",
15029
+ type: "more-horizontal"
15030
+ })
15031
+ ])) : currentPage.value > unref(visiblePages).length / 2 + 2 && _ctx.visiblePagesCount < unref(totalPages) ? (openBlock(), createElementBlock("div", {
15032
+ key: 2,
15033
+ class: "btn",
15034
+ onClick: _cache[3] || (_cache[3] = ($event) => changePage(2))
15035
+ }, " 2 ")) : createCommentVNode("", true),
15036
+ (openBlock(true), createElementBlock(Fragment, null, renderList(unref(visiblePages), (page, index2) => {
15037
+ return openBlock(), createElementBlock("div", {
15038
+ key: index2,
15039
+ class: normalizeClass(["btn", {
15040
+ active: Number(page) === Number(currentPage.value)
15041
+ }]),
15042
+ onClick: ($event) => changePage(page)
15043
+ }, toDisplayString(page), 11, _hoisted_1$m);
15044
+ }), 128)),
15045
+ unref(endEllipsis) ? (openBlock(), createElementBlock("div", {
15046
+ key: 3,
15047
+ class: "btn control-btn",
15048
+ onClick: _cache[4] || (_cache[4] = ($event) => changePage(unref(visiblePages)[unref(visiblePages).length - 1] + 1))
15049
+ }, [
15050
+ createVNode(unref(script), {
15051
+ size: "14",
15052
+ type: "more-horizontal"
15053
+ })
15054
+ ])) : currentPage.value < unref(totalPages) - unref(visiblePages).length / 2 - 1 && _ctx.visiblePagesCount < unref(totalPages) ? (openBlock(), createElementBlock("div", {
15055
+ key: 4,
15056
+ class: "btn",
15057
+ onClick: _cache[5] || (_cache[5] = ($event) => changePage(2))
15058
+ }, toDisplayString(unref(totalPages) - 1), 1)) : createCommentVNode("", true),
15059
+ unref(showMax) ? (openBlock(), createElementBlock("div", {
15060
+ key: 5,
15061
+ class: "btn lew-pagination-page-btn",
15062
+ onClick: _cache[6] || (_cache[6] = ($event) => changePage(unref(totalPages)))
15063
+ }, toDisplayString(unref(totalPages)), 1)) : createCommentVNode("", true),
15064
+ createVNode(_component_lew_button, {
14981
15065
  size: _ctx.size,
14982
- width: "320",
14983
- options: unref(totalPages),
14984
- modelValue: currentPage.value,
14985
- "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => currentPage.value = $event)
14986
- }, null, 8, ["size", "options", "modelValue"])
15066
+ "icon-size": "16",
15067
+ icon: "chevron-right",
15068
+ type: "text",
15069
+ onClick: _cache[7] || (_cache[7] = ($event) => changePage(currentPage.value + 1))
15070
+ }, null, 8, ["size"])
14987
15071
  ]),
14988
15072
  _: 1
14989
15073
  }),
14990
- createVNode(_component_lew_button, {
14991
- size: _ctx.size,
14992
- icon: "chevron-right",
14993
- type: "text",
14994
- onClick: _cache[2] || (_cache[2] = ($event) => changePage(currentPage.value + 1))
14995
- }, null, 8, ["size"]),
14996
15074
  createVNode(unref(LewSelect), {
14997
15075
  modelValue: unref(state).pageSize,
14998
- "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => unref(state).pageSize = $event),
15076
+ "onUpdate:modelValue": _cache[8] || (_cache[8] = ($event) => unref(state).pageSize = $event),
14999
15077
  style: { "width": "100px" },
15000
15078
  align: "center",
15001
15079
  size: _ctx.size,
@@ -15005,7 +15083,7 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
15005
15083
  }, null, 8, ["modelValue", "size", "options"]),
15006
15084
  createVNode(unref(LewInput), {
15007
15085
  modelValue: unref(state).toPage,
15008
- "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => unref(state).toPage = $event),
15086
+ "onUpdate:modelValue": _cache[9] || (_cache[9] = ($event) => unref(state).toPage = $event),
15009
15087
  size: _ctx.size,
15010
15088
  align: "center",
15011
15089
  placeholder: "跳转至",
@@ -15016,7 +15094,7 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
15016
15094
  ]),
15017
15095
  _: 3
15018
15096
  })
15019
- ]);
15097
+ ], 2);
15020
15098
  };
15021
15099
  }
15022
15100
  });
@@ -15266,6 +15344,11 @@ const buttonProps = {
15266
15344
  default: "medium",
15267
15345
  description: "大小"
15268
15346
  },
15347
+ iconSize: {
15348
+ type: Number,
15349
+ default: "",
15350
+ description: "图标大小"
15351
+ },
15269
15352
  loading: {
15270
15353
  type: Boolean,
15271
15354
  default: false,
@@ -15331,16 +15414,16 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
15331
15414
  });
15332
15415
  });
15333
15416
  const getIconSize = computed(() => {
15334
- const { size } = props;
15417
+ const { size, iconSize } = props;
15335
15418
  switch (size) {
15336
15419
  case "small":
15337
- return 14;
15420
+ return iconSize ? iconSize : 14;
15338
15421
  case "medium":
15339
- return 16;
15422
+ return iconSize ? iconSize : 16;
15340
15423
  case "large":
15341
- return 18;
15424
+ return iconSize ? iconSize : 18;
15342
15425
  default:
15343
- return 16;
15426
+ return iconSize ? iconSize : 16;
15344
15427
  }
15345
15428
  });
15346
15429
  const getStyle = computed(() => {
@@ -15389,6 +15472,7 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
15389
15472
  createVNode(unref(script), {
15390
15473
  size: unref(getIconSize),
15391
15474
  animation: "spin",
15475
+ strokeWidth: "2",
15392
15476
  animationSpeed: "fast",
15393
15477
  type: "loader"
15394
15478
  }, null, 8, ["size"])
@@ -15396,6 +15480,7 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
15396
15480
  _ctx.iconPosition === "left" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
15397
15481
  _ctx.icon ? (openBlock(), createBlock(unref(script), {
15398
15482
  key: 0,
15483
+ strokeWidth: "2",
15399
15484
  class: "lew-button-icon",
15400
15485
  size: unref(getIconSize),
15401
15486
  type: _ctx.icon
@@ -15412,6 +15497,7 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
15412
15497
  _ctx.icon ? (openBlock(), createBlock(unref(script), {
15413
15498
  key: 0,
15414
15499
  class: "lew-button-icon",
15500
+ strokeWidth: "2",
15415
15501
  size: unref(getIconSize),
15416
15502
  type: _ctx.icon
15417
15503
  }, null, 8, ["size", "type"])) : createCommentVNode("", true)
@@ -15420,7 +15506,7 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
15420
15506
  };
15421
15507
  }
15422
15508
  });
15423
- const LewButton = /* @__PURE__ */ _export_sfc(_sfc_main$n, [["__scopeId", "data-v-b79b59df"]]);
15509
+ const LewButton = /* @__PURE__ */ _export_sfc(_sfc_main$n, [["__scopeId", "data-v-e3e4ceec"]]);
15424
15510
  const badgeProps = {
15425
15511
  value: {
15426
15512
  type: String,