yuang-framework-ui-pc 1.1.8 → 1.1.10

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.
@@ -8,20 +8,7 @@ import LayoutSkeleton from "./components/layout-skeleton";
8
8
  import LayoutTabs from "./components/layout-tabs";
9
9
  import { adminLayoutProps, adminLayoutEmits, LAYOUT_KEY } from "./props";
10
10
  const tabSlots = ["tabTitle", "tabExtra", "tabHome"];
11
- const ownSlots = [
12
- "logo",
13
- "logoTitle",
14
- "left",
15
- "right",
16
- "center",
17
- "breadcrumb",
18
- "top",
19
- "bottom",
20
- "boxTop",
21
- "boxBottom",
22
- "body",
23
- ...tabSlots
24
- ];
11
+ const ownSlots = ["logo", "logoTitle", "left", "right", "center", "breadcrumb", "top", "bottom", "boxTop", "boxBottom", "body", ...tabSlots];
25
12
  const _sfc_main = defineComponent({
26
13
  name: "EleAdminLayout",
27
14
  components: {
@@ -45,56 +32,26 @@ const _sfc_main = defineComponent({
45
32
  const contentRef = shallowRef(null);
46
33
  const modalsRef = shallowRef(null);
47
34
  const isDisableTransition = shallowRef(false);
48
- const layoutHeight = computed(
49
- () => typeof props.height === "number" ? `${props.height}px` : props.height
50
- );
51
- const isFixedHeader = computed(
52
- () => !props.fixedBody && props.fixedHeader
53
- );
54
- const isFixedSidebar = computed(
55
- () => !props.fixedBody && props.fixedSidebar
56
- );
35
+ const layoutHeight = computed(() => typeof props.height === "number" ? `${props.height}px` : props.height);
36
+ const isFixedHeader = computed(() => !props.fixedBody && props.fixedHeader);
37
+ const isFixedSidebar = computed(() => !props.fixedBody && props.fixedSidebar);
57
38
  const isTopLayout = computed(() => props.layout === "top");
58
39
  const isSideLayout = computed(() => props.layout === "side");
59
- const isBoxSidebar = computed(
60
- () => props.sidebarLayout === "box"
61
- );
62
- const isMixSidebar = computed(
63
- () => !isTopLayout.value && (props.sidebarLayout === "mix" || isBoxSidebar.value)
64
- );
40
+ const isBoxSidebar = computed(() => props.sidebarLayout === "box");
41
+ const isMixSidebar = computed(() => !isTopLayout.value && (props.sidebarLayout === "mix" || isBoxSidebar.value));
65
42
  const isMobile = computed(() => props.mobile && !isTopLayout.value);
66
- const isHeaderLogo = computed(
67
- () => (props.logoInHeader || isTopLayout.value) && !isSideLayout.value && !isMobile.value
68
- );
69
- const showHeaderMenus = computed(
70
- () => isTopLayout.value || props.layout === "mix"
71
- );
43
+ const isHeaderLogo = computed(() => (props.logoInHeader || isTopLayout.value) && !isSideLayout.value && !isMobile.value);
44
+ const showHeaderMenus = computed(() => isTopLayout.value || props.layout === "mix");
72
45
  const showHeaderTabs = computed(() => props.tabBar === "header");
73
- const isDarkHeader = computed(
74
- () => props.headerStyle === "dark"
75
- );
76
- const isPrimaryHeader = computed(
77
- () => props.headerStyle === "primary"
78
- );
46
+ const isDarkHeader = computed(() => props.headerStyle === "dark");
47
+ const isPrimaryHeader = computed(() => props.headerStyle === "primary");
79
48
  const isButtonTab = computed(() => props.tabStyle === "button");
80
- const isDarkSidebar = computed(
81
- () => props.sidebarStyle === "dark"
82
- );
83
- const isDarkMixSidebar = computed(
84
- () => isMixSidebar.value && !isHeaderLogo.value && isDarkSidebar.value && (isDarkHeader.value || isPrimaryHeader.value)
85
- );
86
- const isGhostHeader = computed(
87
- () => !isDarkHeader.value && !isPrimaryHeader.value && showHeaderTabs.value && isButtonTab.value
88
- );
89
- const isGhostSidebar = computed(
90
- () => isGhostHeader.value && !isDarkSidebar.value
91
- );
92
- const isCollapseSidebar = computed(
93
- () => !isMobile.value && props.collapse
94
- );
95
- const isCollapseMobile = computed(
96
- () => isMobile.value && props.collapse
97
- );
49
+ const isDarkSidebar = computed(() => props.sidebarStyle === "dark");
50
+ const isDarkMixSidebar = computed(() => isMixSidebar.value && !isHeaderLogo.value && isDarkSidebar.value && (isDarkHeader.value || isPrimaryHeader.value));
51
+ const isGhostHeader = computed(() => !isDarkHeader.value && !isPrimaryHeader.value && showHeaderTabs.value && isButtonTab.value);
52
+ const isGhostSidebar = computed(() => isGhostHeader.value && !isDarkSidebar.value);
53
+ const isCollapseSidebar = computed(() => !isMobile.value && props.collapse);
54
+ const isCollapseMobile = computed(() => isMobile.value && props.collapse);
98
55
  const getContentEl = () => {
99
56
  return contentRef.value;
100
57
  };
@@ -214,36 +171,24 @@ const _sfc_main = defineComponent({
214
171
  getBodyWrapperEl
215
172
  });
216
173
  provide(LAYOUT_KEY, layoutProvide);
217
- watch(
218
- [
219
- () => props.layout,
220
- () => props.sidebarLayout,
221
- () => props.fixedSidebar,
222
- () => props.fixedBody,
223
- () => props.logoInHeader,
224
- () => props.maximized,
225
- isFixedHeader,
226
- isMobile
227
- ],
228
- () => {
229
- isDisableTransition.value = true;
230
- startDisableTransitionTimer(() => {
231
- isDisableTransition.value = false;
232
- });
233
- if (layoutProvide.layout !== props.layout) {
234
- layoutProvide.layout = props.layout;
235
- }
236
- if (layoutProvide.maximized !== props.maximized) {
237
- layoutProvide.maximized = props.maximized;
238
- }
239
- if (layoutProvide.fixedHeader !== isFixedHeader.value) {
240
- layoutProvide.fixedHeader = isFixedHeader.value;
241
- }
242
- if (layoutProvide.fixedBody !== props.fixedBody) {
243
- layoutProvide.fixedBody = props.fixedBody;
244
- }
174
+ watch([() => props.layout, () => props.sidebarLayout, () => props.fixedSidebar, () => props.fixedBody, () => props.logoInHeader, () => props.maximized, isFixedHeader, isMobile], () => {
175
+ isDisableTransition.value = true;
176
+ startDisableTransitionTimer(() => {
177
+ isDisableTransition.value = false;
178
+ });
179
+ if (layoutProvide.layout !== props.layout) {
180
+ layoutProvide.layout = props.layout;
181
+ }
182
+ if (layoutProvide.maximized !== props.maximized) {
183
+ layoutProvide.maximized = props.maximized;
184
+ }
185
+ if (layoutProvide.fixedHeader !== isFixedHeader.value) {
186
+ layoutProvide.fixedHeader = isFixedHeader.value;
245
187
  }
246
- );
188
+ if (layoutProvide.fixedBody !== props.fixedBody) {
189
+ layoutProvide.fixedBody = props.fixedBody;
190
+ }
191
+ });
247
192
  watch([() => props.sidebarActive, () => props.collapse], () => {
248
193
  nextTick(() => {
249
194
  sidebarScrollToActive();
@@ -355,14 +300,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
355
300
  const _component_LayoutSkeleton = resolveComponent("LayoutSkeleton");
356
301
  return openBlock(), createBlock(_component_LayoutSkeleton, {
357
302
  isHeaderLogo: _ctx.isHeaderLogo,
358
- class: normalizeClass([
359
- { "is-fixed-body": _ctx.fixedBody },
360
- { "is-transition-disabled": _ctx.isDisableTransition },
361
- { "is-maximized": _ctx.maximized },
362
- { "is-expanded": _ctx.maximized === "expanded" },
363
- { "is-mobile": _ctx.isMobile },
364
- { "is-collapse": _ctx.isCollapseMobile }
365
- ]),
303
+ class: normalizeClass([{ "is-fixed-body": _ctx.fixedBody }, { "is-transition-disabled": _ctx.isDisableTransition }, { "is-maximized": _ctx.maximized }, { "is-expanded": _ctx.maximized === "expanded" }, { "is-mobile": _ctx.isMobile }, { "is-collapse": _ctx.isCollapseMobile }]),
366
304
  style: normalizeStyle({
367
305
  minHeight: _ctx.layoutHeight,
368
306
  height: _ctx.fixedBody ? _ctx.layoutHeight : void 0
@@ -371,14 +309,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
371
309
  head: withCtx(() => [
372
310
  !_ctx.isSideLayout ? (openBlock(), createElementBlock("div", {
373
311
  key: 0,
374
- class: normalizeClass([
375
- "ele-admin-header",
376
- { "is-dark": _ctx.isDarkHeader },
377
- { "is-primary": _ctx.isPrimaryHeader },
378
- { "is-ghost": _ctx.isGhostHeader },
379
- { "show-divider": _ctx.tabBar && !_ctx.showHeaderTabs && !_ctx.isButtonTab },
380
- { "is-fixed": _ctx.isFixedHeader }
381
- ]),
312
+ class: normalizeClass(["ele-admin-header", { "is-dark": _ctx.isDarkHeader }, { "is-primary": _ctx.isPrimaryHeader }, { "is-ghost": _ctx.isGhostHeader }, { "show-divider": _ctx.tabBar && !_ctx.showHeaderTabs && !_ctx.isButtonTab }, { "is-fixed": _ctx.isFixedHeader }]),
382
313
  style: normalizeStyle(_ctx.headerCustomStyle),
383
314
  onMouseenter: _cache[0] || (_cache[0] = (...args) => _ctx.handleHeadMouseenter && _ctx.handleHeadMouseenter(...args)),
384
315
  onMouseleave: _cache[1] || (_cache[1] = (...args) => _ctx.handleHeadMouseleave && _ctx.handleHeadMouseleave(...args))
@@ -457,9 +388,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
457
388
  onTabContextMenu: _ctx.handleTabContextMenu,
458
389
  onTabSortChange: _ctx.handleTabSortChange
459
390
  }, createSlots({ _: 2 }, [
460
- renderList(Object.keys(_ctx.$slots).filter(
461
- (k) => _ctx.tabSlots.includes(k)
462
- ), (name) => {
391
+ renderList(Object.keys(_ctx.$slots).filter((k) => _ctx.tabSlots.includes(k)), (name) => {
463
392
  return {
464
393
  name,
465
394
  fn: withCtx((slotProps) => [
@@ -476,26 +405,12 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
476
405
  side: withCtx(() => [
477
406
  !_ctx.isTopLayout ? (openBlock(), createElementBlock("div", {
478
407
  key: 0,
479
- class: normalizeClass([
480
- "ele-admin-side",
481
- { "is-fixed": _ctx.isFixedSidebar },
482
- { "show-placeholder": _ctx.isFixedSidebar && _ctx.isHeaderLogo },
483
- { "is-collapse": !_ctx.isMobile && !_ctx.isBoxSidebar && _ctx.isCollapseSidebar },
484
- { "is-mix": !_ctx.isMobile && !_ctx.isBoxSidebar && _ctx.isMixSidebar },
485
- { "is-compact": !_ctx.isMobile && _ctx.compact },
486
- { "is-box": !_ctx.isMobile && _ctx.isBoxSidebar }
487
- ]),
408
+ class: normalizeClass(["ele-admin-side", { "is-fixed": _ctx.isFixedSidebar }, { "show-placeholder": _ctx.isFixedSidebar && _ctx.isHeaderLogo }, { "is-collapse": !_ctx.isMobile && !_ctx.isBoxSidebar && _ctx.isCollapseSidebar }, { "is-mix": !_ctx.isMobile && !_ctx.isBoxSidebar && _ctx.isMixSidebar }, { "is-compact": !_ctx.isMobile && _ctx.compact }, { "is-box": !_ctx.isMobile && _ctx.isBoxSidebar }]),
488
409
  style: normalizeStyle({ height: _ctx.isFixedSidebar ? _ctx.layoutHeight : void 0 })
489
410
  }, [
490
411
  _ctx.isMixSidebar ? (openBlock(), createElementBlock("div", {
491
412
  key: 0,
492
- class: normalizeClass([
493
- "ele-admin-sidebox",
494
- { "is-dark": _ctx.isDarkSidebar },
495
- { "is-ghost": _ctx.isGhostSidebar },
496
- { "show-divider": !_ctx.isCollapseSidebar && !_ctx.isBoxSidebar },
497
- { "is-compact": _ctx.compact }
498
- ]),
413
+ class: normalizeClass(["ele-admin-sidebox", { "is-dark": _ctx.isDarkSidebar }, { "is-ghost": _ctx.isGhostSidebar }, { "show-divider": !_ctx.isCollapseSidebar && !_ctx.isBoxSidebar }, { "is-compact": _ctx.compact }]),
499
414
  style: normalizeStyle(_ctx.sideboxCustomStyle),
500
415
  onMouseenter: _cache[2] || (_cache[2] = (...args) => _ctx.handleBoxMouseEnter && _ctx.handleBoxMouseEnter(...args)),
501
416
  onMouseleave: _cache[3] || (_cache[3] = (...args) => _ctx.handleBoxMouseLeave && _ctx.handleBoxMouseLeave(...args))
@@ -552,13 +467,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
552
467
  ], 38)) : createCommentVNode("", true),
553
468
  !_ctx.isBoxSidebar ? (openBlock(), createElementBlock("div", {
554
469
  key: 1,
555
- class: normalizeClass([
556
- "ele-admin-sidebar",
557
- { "is-dark": _ctx.isMixSidebar ? _ctx.isDarkMixSidebar : _ctx.isDarkSidebar },
558
- { "is-ghost": _ctx.isGhostSidebar },
559
- { "is-mix": _ctx.isMixSidebar },
560
- { "is-collapse": _ctx.isCollapseSidebar }
561
- ]),
470
+ class: normalizeClass(["ele-admin-sidebar", { "is-dark": _ctx.isMixSidebar ? _ctx.isDarkMixSidebar : _ctx.isDarkSidebar }, { "is-ghost": _ctx.isGhostSidebar }, { "is-mix": _ctx.isMixSidebar }, { "is-collapse": _ctx.isCollapseSidebar }]),
562
471
  style: normalizeStyle(_ctx.sidebarCustomStyle),
563
472
  onMouseenter: _cache[4] || (_cache[4] = (...args) => _ctx.handleSideMouseEnter && _ctx.handleSideMouseEnter(...args)),
564
473
  onMouseleave: _cache[5] || (_cache[5] = (...args) => _ctx.handleSideMouseLeave && _ctx.handleSideMouseLeave(...args))
@@ -639,20 +548,14 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
639
548
  tabContextMenu: _ctx.tabContextMenu,
640
549
  tabContextMenus: _ctx.tabContextMenus,
641
550
  tabSortable: _ctx.tabSortable,
642
- class: normalizeClass([
643
- { "is-fixed-home": _ctx.fixedHome },
644
- { "is-fixed": _ctx.isFixedHeader },
645
- { "is-fixed-top": _ctx.isFixedHeader && (_ctx.isSideLayout || _ctx.maximized) }
646
- ]),
551
+ class: normalizeClass([{ "is-fixed-home": _ctx.fixedHome }, { "is-fixed": _ctx.isFixedHeader }, { "is-fixed-top": _ctx.isFixedHeader && (_ctx.isSideLayout || _ctx.maximized) }]),
647
552
  style: normalizeStyle(_ctx.tabsCustomStyle),
648
553
  onTabClick: _ctx.handleTabClick,
649
554
  onTabRemove: _ctx.handleTabRemove,
650
555
  onTabContextMenu: _ctx.handleTabContextMenu,
651
556
  onTabSortChange: _ctx.handleTabSortChange
652
557
  }, createSlots({ _: 2 }, [
653
- renderList(Object.keys(_ctx.$slots).filter(
654
- (k) => _ctx.tabSlots.includes(k)
655
- ), (name) => {
558
+ renderList(Object.keys(_ctx.$slots).filter((k) => _ctx.tabSlots.includes(k)), (name) => {
656
559
  return {
657
560
  name,
658
561
  fn: withCtx((slotProps) => [
@@ -33,12 +33,6 @@ const index = defineComponent({
33
33
  },
34
34
  { deep: true }
35
35
  );
36
- watch(
37
- () => props.license,
38
- () => {
39
- config.license = props.license;
40
- }
41
- );
42
36
  watch(
43
37
  () => props.mapKey,
44
38
  () => {
@@ -11,7 +11,7 @@ function getRowClass(rowClass, param) {
11
11
  }
12
12
  }
13
13
  function getBodyRowClass(rowClass, param) {
14
- const classes = ["ele-table-tr"];
14
+ const classes = ["ele-table-tr", "ele-table-tr-" + param.row.id];
15
15
  const custom = getRowClass(rowClass, param);
16
16
  if (custom != null) {
17
17
  classes.push(custom);
@@ -149,10 +149,10 @@ declare const _default: import('vue').DefineComponent<{
149
149
  "onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
150
150
  onClose?: (() => any) | undefined;
151
151
  onOpen?: (() => any) | undefined;
152
- onOpenAutoFocus?: (() => any) | undefined;
153
- onCloseAutoFocus?: (() => any) | undefined;
154
152
  onOpened?: (() => any) | undefined;
155
153
  onClosed?: (() => any) | undefined;
154
+ onOpenAutoFocus?: (() => any) | undefined;
155
+ onCloseAutoFocus?: (() => any) | undefined;
156
156
  }, {
157
157
  size: import('element-plus/es/utils/index').EpPropMergeType<readonly [StringConstructor, NumberConstructor], unknown, unknown>;
158
158
  title: string;
@@ -42,12 +42,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
42
42
  !_ctx.isCircle ? withDirectives((openBlock(), createElementBlock("div", {
43
43
  key: 0,
44
44
  style: normalizeStyle(_ctx.spinnerStyle),
45
- class: normalizeClass([
46
- "ele-loading-spinner",
47
- { "ele-loading-blur": _ctx.blur },
48
- { "ele-loading-small": _ctx.size === "small" },
49
- { "ele-loading-large": _ctx.size === "large" }
50
- ])
45
+ class: normalizeClass(["ele-loading-spinner", { "ele-loading-blur": _ctx.blur }, { "ele-loading-small": _ctx.size === "small" }, { "ele-loading-large": _ctx.size === "large" }])
51
46
  }, [
52
47
  renderSlot(_ctx.$slots, "spinner", {}, () => [
53
48
  _hoisted_1
@@ -207,10 +207,10 @@ declare const _default: import('vue').DefineComponent<{
207
207
  "onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
208
208
  onClose?: (() => any) | undefined;
209
209
  onOpen?: (() => any) | undefined;
210
- onOpenAutoFocus?: (() => any) | undefined;
211
- onCloseAutoFocus?: (() => any) | undefined;
212
210
  onOpened?: (() => any) | undefined;
213
211
  onClosed?: (() => any) | undefined;
212
+ onOpenAutoFocus?: (() => any) | undefined;
213
+ onCloseAutoFocus?: (() => any) | undefined;
214
214
  "onUpdate:fullscreen"?: ((_fullscreen: boolean) => any) | undefined;
215
215
  }, {
216
216
  form: boolean;
@@ -36,6 +36,7 @@ declare const _default: import('vue').DefineComponent<{
36
36
  background: BooleanConstructor;
37
37
  disabled: BooleanConstructor;
38
38
  hideOnSinglePage: BooleanConstructor;
39
+ appendSizeTo: StringConstructor;
39
40
  }, {
40
41
  isInfinite: import('vue').ComputedRef<boolean>;
41
42
  pageTotal: import('vue').ComputedRef<number | undefined>;
@@ -83,6 +84,7 @@ declare const _default: import('vue').DefineComponent<{
83
84
  background: BooleanConstructor;
84
85
  disabled: BooleanConstructor;
85
86
  hideOnSinglePage: BooleanConstructor;
87
+ appendSizeTo: StringConstructor;
86
88
  }>> & {
87
89
  "onUpdate:currentPage"?: ((_currentPage: number) => any) | undefined;
88
90
  "onUpdate:pageSize"?: ((_pageSize: number) => any) | undefined;
@@ -46,6 +46,7 @@ export declare const paginationProps: {
46
46
  background: BooleanConstructor;
47
47
  disabled: BooleanConstructor;
48
48
  hideOnSinglePage: BooleanConstructor;
49
+ appendSizeTo: StringConstructor;
49
50
  };
50
51
  export type PaginationProps = ExtractPropTypes<typeof paginationProps>;
51
52
  /**
@@ -196,7 +196,7 @@ declare const _default: import('vue').DefineComponent<{
196
196
  handlePageSizeChange: (pageSize: number) => void;
197
197
  handlePageCurrentChange: (page: number) => void;
198
198
  reload: ReloadFunction;
199
- reloadTable: () => void;
199
+ reset: () => void;
200
200
  getTableRef: () => TableViewInstance | undefined;
201
201
  getData: () => DataItem[];
202
202
  setData: (data: DataItem[]) => void;
@@ -216,16 +216,19 @@ declare const _default: import('vue').DefineComponent<{
216
216
  clearFilter: (columnKeys?: string[]) => void;
217
217
  doLayout: () => void;
218
218
  sort: (prop: string, order: string) => void;
219
- scrollTo: (options: number | ScrollToOptions, yCoord? /** 表格当前的排序筛选搜索参数 */: number) => void;
219
+ scrollTo: (options: number | ScrollToOptions, yCoord?: number) => void;
220
220
  setScrollTop: (top?: number) => void;
221
- setScrollLeft: (left?: number) => void;
221
+ setScrollLeft: (left? /** 表格当前的排序筛选搜索参数 */: number) => void;
222
222
  setCurrentRowKey: (key?: import('../ele-data-table/types').DataKey | null) => void;
223
223
  getCurrentRow: () => DataItem | undefined;
224
224
  setSelectedRows: (rows?: DataItem[]) => void;
225
- setSelectedRowKeys: (keys?: import('../ele-data-table/types').DataKey[], rows? /** 当前页数据 */: DataItem[]) => void;
225
+ setSelectedRowKeys: (keys?: import('../ele-data-table/types').DataKey[], rows?: DataItem[]) => void;
226
226
  toggleRowExpansionAll: (expanded?: boolean) => void;
227
227
  updateSelectedAndChecked: () => void;
228
228
  updateKeyChildren: (key?: import('../ele-data-table/types').DataKey | null, rows?: DataItem[]) => void;
229
+ isShowTable: Ref<{
230
+ valueOf: () => boolean;
231
+ }>;
229
232
  toolsSlotExcludes: string[];
230
233
  tableSlotExcludes: string[];
231
234
  pageSlotExcludes: string[];
@@ -1,4 +1,4 @@
1
- import { defineComponent, ref, shallowRef, computed, watch, onMounted, nextTick, resolveComponent, openBlock, createBlock, normalizeProps, guardReactiveProps, withCtx, mergeProps as mergeProps$1, createSlots, renderSlot, createCommentVNode, renderList, createElementBlock, normalizeStyle } from "vue";
1
+ import { defineComponent, ref, shallowRef, computed, watch, onMounted, nextTick, resolveComponent, openBlock, createBlock, normalizeProps, guardReactiveProps, withCtx, mergeProps as mergeProps$1, createSlots, renderSlot, createCommentVNode, createElementBlock, createVNode, renderList, normalizeStyle } from "vue";
2
2
  import { pick, getValue } from "../utils/core";
3
3
  import { useGlobalProps } from "../ele-config-provider/receiver";
4
4
  import EleLoading from "../ele-loading/index";
@@ -9,7 +9,7 @@ import EleDataTable from "../ele-data-table/index";
9
9
  import EleVirtualTable from "../ele-virtual-table/index";
10
10
  import EleToolbar from "../ele-toolbar/index";
11
11
  import TableTools from "./components/table-tools";
12
- import { getDefaultFilter, getTablePage, getTableLimit, getTableSize, getRowKey, getPaginationProps, mergeProps, cacheColWidth, getInitCacheColumns, reloadData, getRequestOrderParamList, getRequestPageParam, getRequestFilters, getResponseResult, getResponseName, isAutoAmend, sortData } from "./util";
12
+ import { getDefaultFilter, getTablePage, getTableLimit, getTableSize, getRowKey, getPaginationProps, mergeProps, cacheColWidth, getInitCacheColumns, sortData, getRequestOrderParamList, getRequestPageParam, getRequestFilters, reloadData, getResponseResult, getResponseName, isAutoAmend } from "./util";
13
13
  import { proTableProps, proTableEmits } from "./props";
14
14
  const ownSlots = ["default", "toolbar", "tools", "footer"];
15
15
  const toolsSlotExcludes = [...ownSlots, "empty", "append"];
@@ -28,6 +28,7 @@ const _sfc_main = defineComponent({
28
28
  props: proTableProps,
29
29
  emits: proTableEmits,
30
30
  setup(props, { emit }) {
31
+ const isShowTable = ref(true);
31
32
  const events = useEmits(emit);
32
33
  const methods = useMethods(() => getTableRef());
33
34
  const globalProps = useGlobalProps("table");
@@ -144,7 +145,7 @@ const _sfc_main = defineComponent({
144
145
  style: tableMaximized.value ? { zIndex } : void 0
145
146
  };
146
147
  });
147
- const reload = (option, parent, resolve) => {
148
+ const load = (option, parent, resolve) => {
148
149
  if (option) {
149
150
  if (option.currentPage) {
150
151
  tablePage.value = option.currentPage;
@@ -198,6 +199,18 @@ const _sfc_main = defineComponent({
198
199
  resolve && console.error(e);
199
200
  });
200
201
  };
202
+ const reload = (option, parent, resolve) => {
203
+ load(option, parent, resolve);
204
+ };
205
+ const reset = () => {
206
+ methods.doLayout();
207
+ if (props.lazy) {
208
+ isShowTable.value = false;
209
+ nextTick(() => {
210
+ isShowTable.value = true;
211
+ });
212
+ }
213
+ };
201
214
  const requestCallback = (data, totalCount, parent, response, resolve) => {
202
215
  var _a;
203
216
  if (!Array.isArray(data)) {
@@ -230,9 +243,9 @@ const _sfc_main = defineComponent({
230
243
  }
231
244
  tableLoading.value = false;
232
245
  const result = {
233
- data: tableData.value,
234
- page: tablePage.value,
235
- total: tableTotal.value,
246
+ records: tableData.value,
247
+ currentPage: tablePage.value,
248
+ totalCount: tableTotal.value,
236
249
  response
237
250
  };
238
251
  handleDone(result, parent);
@@ -328,9 +341,6 @@ const _sfc_main = defineComponent({
328
341
  emit("update:selections", selection);
329
342
  }
330
343
  };
331
- const reloadTable = () => {
332
- methods.doLayout();
333
- };
334
344
  const getTableRef = () => {
335
345
  return tableViewRef.value;
336
346
  };
@@ -347,9 +357,9 @@ const _sfc_main = defineComponent({
347
357
  const rowKey = tableRowKey.value;
348
358
  const data = sortData(props.datasource, tableState.sorter);
349
359
  const index2 = data.findIndex((d) => getValue(d, rowKey) === key);
350
- const page = Math.floor(index2 / tableLimit.value) + 1;
351
- if (tablePage.value !== page) {
352
- reload({ page });
360
+ const currentPage = Math.floor(index2 / tableLimit.value) + 1;
361
+ if (tablePage.value !== currentPage) {
362
+ reload({ currentPage });
353
363
  }
354
364
  };
355
365
  const fetch = (callback) => {
@@ -447,6 +457,7 @@ const _sfc_main = defineComponent({
447
457
  }
448
458
  });
449
459
  return {
460
+ isShowTable,
450
461
  toolsSlotExcludes,
451
462
  tableSlotExcludes,
452
463
  pageSlotExcludes,
@@ -471,7 +482,8 @@ const _sfc_main = defineComponent({
471
482
  handlePageSizeChange,
472
483
  handlePageCurrentChange,
473
484
  reload,
474
- reloadTable,
485
+ reset,
486
+ // reloadTable,
475
487
  getTableRef,
476
488
  getData,
477
489
  setData,
@@ -491,6 +503,8 @@ const _export_sfc = (sfc, props) => {
491
503
  }
492
504
  return target;
493
505
  };
506
+ const _hoisted_1 = { key: 1 };
507
+ const _hoisted_2 = { key: 2 };
494
508
  function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
495
509
  resolveComponent("TableTools");
496
510
  const _component_EleToolbar = resolveComponent("EleToolbar");
@@ -509,25 +523,29 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
509
523
  void 0
510
524
  ]), 1040)) : createCommentVNode("", true),
511
525
  renderSlot(_ctx.$slots, "default"),
512
- _ctx.virtual ? (openBlock(), createBlock(_component_EleVirtualTable, mergeProps$1({ key: 1 }, _ctx.tableProps, { ref: "tableViewRef" }), createSlots({ _: 2 }, [
513
- renderList(Object.keys(_ctx.$slots).filter((k) => !_ctx.tableSlotExcludes.includes(k)), (name) => {
514
- return {
515
- name,
516
- fn: withCtx((slotProps) => [
517
- renderSlot(_ctx.$slots, name, normalizeProps(guardReactiveProps(slotProps || {})))
518
- ])
519
- };
520
- })
521
- ]), 1040)) : (openBlock(), createBlock(_component_EleDataTable, mergeProps$1({ key: 2 }, _ctx.tableProps, { ref: "tableViewRef" }), createSlots({ _: 2 }, [
522
- renderList(Object.keys(_ctx.$slots).filter((k) => !_ctx.tableSlotExcludes.includes(k)), (name) => {
523
- return {
524
- name,
525
- fn: withCtx((slotProps) => [
526
- renderSlot(_ctx.$slots, name, normalizeProps(guardReactiveProps(slotProps || {})))
527
- ])
528
- };
529
- })
530
- ]), 1040)),
526
+ _ctx.virtual ? (openBlock(), createElementBlock("div", _hoisted_1, [
527
+ createVNode(_component_EleVirtualTable, mergeProps$1(_ctx.tableProps, { ref: "tableViewRef" }), createSlots({ _: 2 }, [
528
+ renderList(Object.keys(_ctx.$slots).filter((k) => !_ctx.tableSlotExcludes.includes(k)), (name) => {
529
+ return {
530
+ name,
531
+ fn: withCtx((slotProps) => [
532
+ renderSlot(_ctx.$slots, name, normalizeProps(guardReactiveProps(slotProps || {})))
533
+ ])
534
+ };
535
+ })
536
+ ]), 1040)
537
+ ])) : (openBlock(), createElementBlock("div", _hoisted_2, [
538
+ _ctx.isShowTable ? (openBlock(), createBlock(_component_EleDataTable, mergeProps$1({ key: 0 }, _ctx.tableProps, { ref: "tableViewRef" }), createSlots({ _: 2 }, [
539
+ renderList(Object.keys(_ctx.$slots).filter((k) => !_ctx.tableSlotExcludes.includes(k)), (name) => {
540
+ return {
541
+ name,
542
+ fn: withCtx((slotProps) => [
543
+ renderSlot(_ctx.$slots, name, normalizeProps(guardReactiveProps(slotProps || {})))
544
+ ])
545
+ };
546
+ })
547
+ ]), 1040)) : createCommentVNode("", true)
548
+ ])),
531
549
  _ctx.paginationProps || _ctx.$slots.footer ? (openBlock(), createElementBlock("div", {
532
550
  key: 3,
533
551
  class: "ele-pro-table-footer",
@@ -80,6 +80,14 @@ export interface ReloadParams {
80
80
  filter?: Filter;
81
81
  }
82
82
 
83
+ /**
84
+ * 加载方法
85
+ * @param option 刷新参数
86
+ * @param parent 树表格父级数据
87
+ * @param resolve 树表格懒加载方法
88
+ */
89
+ export type LoadFunction = (option?: ReloadParams, parent?: DataItem, resolve?: ResolveFunction) => void;
90
+
83
91
  /**
84
92
  * 刷新方法
85
93
  * @param option 刷新参数
@@ -143,11 +151,11 @@ export interface OrderItem {
143
151
  */
144
152
  export interface DoneParams<T> {
145
153
  /** 当前页数据 */
146
- data: T[];
154
+ records: T[];
147
155
  /** 总数量 */
148
- total?: PaginationTotal;
156
+ totalCount?: PaginationTotal;
149
157
  /** 当前页码 */
150
- page?: number;
158
+ currentPage?: number;
151
159
  /** 数据源原始数据 */
152
160
  response?: any;
153
161
  }
@@ -202,7 +202,6 @@ function sortData(datasource, sorter) {
202
202
  return data;
203
203
  }
204
204
  function reloadData(datasource, sorter, currentPage, pageSize) {
205
- debugger;
206
205
  const records = sortData(datasource, sorter);
207
206
  const totalCount = records.length;
208
207
  if (!currentPage || !pageSize) {
@@ -122,6 +122,11 @@ declare const _default: import('vue').DefineComponent<{
122
122
  scrollbarAlwaysOn: BooleanConstructor;
123
123
  flexible: BooleanConstructor;
124
124
  showOverflowTooltip: import('vue').PropType<boolean | Partial<Pick<import('element-plus').ElTooltipProps, "offset" | "transition" | "placement" | "effect" | "showAfter" | "hideAfter" | "popperOptions" | "enterable" | "popperClass" | "appendTo" | "showArrow">> | undefined>;
125
+ appendFilterPanelTo: StringConstructor;
126
+ scrollbarTabindex: {
127
+ type: (NumberConstructor | StringConstructor)[];
128
+ default: undefined;
129
+ };
125
130
  }, {
126
131
  ownSlots: string[];
127
132
  rootRef: Ref<HTMLElement | null>;
@@ -333,6 +338,11 @@ declare const _default: import('vue').DefineComponent<{
333
338
  scrollbarAlwaysOn: BooleanConstructor;
334
339
  flexible: BooleanConstructor;
335
340
  showOverflowTooltip: import('vue').PropType<boolean | Partial<Pick<import('element-plus').ElTooltipProps, "offset" | "transition" | "placement" | "effect" | "showAfter" | "hideAfter" | "popperOptions" | "enterable" | "popperClass" | "appendTo" | "showArrow">> | undefined>;
341
+ appendFilterPanelTo: StringConstructor;
342
+ scrollbarTabindex: {
343
+ type: (NumberConstructor | StringConstructor)[];
344
+ default: undefined;
345
+ };
336
346
  }>> & {
337
347
  onSelect?: ((_selection: DataItem[], _row: DataItem) => any) | undefined;
338
348
  onExpandChange?: ((_row: DataItem, _expanded: boolean) => any) | undefined;
@@ -371,6 +381,7 @@ declare const _default: import('vue').DefineComponent<{
371
381
  tableLayout: "auto" | "fixed";
372
382
  scrollbarAlwaysOn: boolean;
373
383
  flexible: boolean;
384
+ scrollbarTabindex: string | number;
374
385
  sticky: boolean;
375
386
  headerEllipsis: boolean;
376
387
  slotNormalize: boolean;
@@ -123,6 +123,11 @@ export declare const virtualTableProps: {
123
123
  scrollbarAlwaysOn: BooleanConstructor;
124
124
  flexible: BooleanConstructor;
125
125
  showOverflowTooltip: import('vue').PropType<boolean | Partial<Pick<import('element-plus').ElTooltipProps, "offset" | "transition" | "placement" | "effect" | "showAfter" | "hideAfter" | "popperOptions" | "enterable" | "popperClass" | "appendTo" | "showArrow">> | undefined>;
126
+ appendFilterPanelTo: StringConstructor;
127
+ scrollbarTabindex: {
128
+ type: (NumberConstructor | StringConstructor)[];
129
+ default: undefined;
130
+ };
126
131
  };
127
132
  export type VirtualTableProps = ExtractPropTypes<typeof virtualTableProps>;
128
133
  /**