@gx-design-vue/pro-table 0.2.0-alpha.7 → 0.2.0-alpha.9

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.
Files changed (133) hide show
  1. package/dist/ProTable.d.ts +14 -492
  2. package/dist/ProTable.js +818 -518
  3. package/dist/components/ScrollBar/Bar.d.ts +81 -0
  4. package/dist/components/ScrollBar/Bar.js +84 -0
  5. package/dist/components/ScrollBar/Thumb.d.ts +52 -0
  6. package/dist/components/ScrollBar/{Thumb/index.js → Thumb.js} +67 -55
  7. package/dist/components/ScrollBar/context.d.ts +3 -4
  8. package/dist/components/ScrollBar/context.js +3 -3
  9. package/dist/components/ScrollBar/util.d.ts +6 -5
  10. package/dist/components/ScrollBar/util.js +1 -12
  11. package/dist/components/SearchForm/CollapseToggle.d.ts +55 -0
  12. package/dist/components/SearchForm/CollapseToggle.js +47 -0
  13. package/dist/components/SearchForm/FormItemContainer.d.ts +75 -0
  14. package/dist/components/SearchForm/FormItemContainer.js +225 -0
  15. package/dist/components/SearchForm/FormItemWrapper.d.ts +82 -0
  16. package/dist/components/SearchForm/FormItemWrapper.js +62 -0
  17. package/dist/components/SearchForm/SearchForm.d.ts +130 -0
  18. package/dist/components/SearchForm/SearchForm.js +319 -0
  19. package/dist/components/SearchForm/index.d.ts +2 -0
  20. package/dist/components/SearchForm/index.js +2 -0
  21. package/dist/components/Toolbar/FullscreenIcon.d.ts +26 -0
  22. package/dist/components/Toolbar/FullscreenIcon.js +22 -0
  23. package/dist/components/Toolbar/ListToolBar.d.ts +111 -0
  24. package/dist/components/Toolbar/ListToolBar.js +101 -0
  25. package/dist/components/Toolbar/index.d.ts +103 -0
  26. package/dist/components/Toolbar/index.js +101 -0
  27. package/dist/components/Toolbar/style.d.ts +8 -0
  28. package/dist/components/{ListToolBar → Toolbar}/style.js +32 -27
  29. package/dist/context/TableContext.d.ts +15 -27
  30. package/dist/context/TableContext.js +3 -3
  31. package/dist/hooks/index.d.ts +16 -0
  32. package/dist/hooks/index.js +16 -0
  33. package/dist/hooks/useBreakpoints.d.ts +13 -0
  34. package/dist/hooks/useBreakpoints.js +57 -0
  35. package/dist/hooks/useCellRender.d.ts +13 -0
  36. package/dist/hooks/useCellRender.js +28 -0
  37. package/dist/hooks/useColumnResize.d.ts +30 -0
  38. package/dist/hooks/useColumnResize.js +110 -0
  39. package/dist/hooks/useColumns.d.ts +35 -24
  40. package/dist/hooks/useColumns.js +89 -56
  41. package/dist/hooks/useFetchData.d.ts +40 -65
  42. package/dist/hooks/useFetchData.js +157 -172
  43. package/dist/hooks/useFitPage.d.ts +19 -0
  44. package/dist/hooks/useFitPage.js +90 -0
  45. package/dist/hooks/useKeepAliveReload.d.ts +21 -0
  46. package/dist/hooks/useKeepAliveReload.js +24 -0
  47. package/dist/hooks/useLoading.d.ts +18 -7
  48. package/dist/hooks/useLoading.js +26 -8
  49. package/dist/hooks/usePagination.d.ts +10 -7
  50. package/dist/hooks/usePagination.js +37 -26
  51. package/dist/hooks/useRequestOptions.d.ts +18 -0
  52. package/dist/hooks/useRequestOptions.js +39 -0
  53. package/dist/hooks/useRowSelection.d.ts +27 -15
  54. package/dist/hooks/useRowSelection.js +92 -77
  55. package/dist/hooks/useTable.d.ts +19 -77
  56. package/dist/hooks/useTable.js +66 -54
  57. package/dist/hooks/useTableForm.d.ts +15 -83
  58. package/dist/hooks/useTableForm.js +93 -56
  59. package/dist/hooks/useTableScroll.d.ts +33 -31
  60. package/dist/hooks/useTableScroll.js +71 -26
  61. package/dist/hooks/useTableSize.d.ts +17 -7
  62. package/dist/hooks/useTableSize.js +20 -6
  63. package/dist/index.d.ts +10 -7
  64. package/dist/index.js +9 -3
  65. package/dist/interface.d.ts +492 -0
  66. package/dist/pro-table.esm.js +3483 -3913
  67. package/dist/pro-table.js +1 -1
  68. package/dist/style/fit-page.d.ts +4 -2
  69. package/dist/style/fit-page.js +9 -3
  70. package/dist/style/index.d.ts +4 -6
  71. package/dist/style/index.js +24 -74
  72. package/dist/style/list.d.ts +4 -2
  73. package/dist/style/list.js +1 -10
  74. package/dist/style/resizable.d.ts +8 -0
  75. package/dist/style/resizable.js +18 -0
  76. package/dist/style/scroll.d.ts +4 -2
  77. package/dist/style/scroll.js +8 -6
  78. package/dist/style/search.d.ts +8 -0
  79. package/dist/{components/Form/style.js → style/search.js} +22 -8
  80. package/dist/theme/augment.d.ts +8 -0
  81. package/dist/theme/interface/components.d.ts +8 -0
  82. package/dist/utils/dateFormat.d.ts +9 -0
  83. package/dist/utils/dateFormat.js +29 -0
  84. package/dist/utils/formConstants.d.ts +9 -0
  85. package/dist/utils/formConstants.js +29 -0
  86. package/dist/utils/valueFormat.d.ts +9 -0
  87. package/dist/utils/valueFormat.js +27 -0
  88. package/package.json +10 -9
  89. package/dist/components/Form/components/RequestSelect.d.ts +0 -50
  90. package/dist/components/Form/components/RequestSelect.js +0 -56
  91. package/dist/components/Form/hooks/useForm.d.ts +0 -11
  92. package/dist/components/Form/hooks/useForm.js +0 -30
  93. package/dist/components/Form/index.d.ts +0 -32
  94. package/dist/components/Form/index.js +0 -476
  95. package/dist/components/Form/style.d.ts +0 -6
  96. package/dist/components/Form/utils/config.d.ts +0 -9
  97. package/dist/components/Form/utils/config.js +0 -29
  98. package/dist/components/Form/utils/dateFormat.d.ts +0 -22
  99. package/dist/components/Form/utils/dateFormat.js +0 -43
  100. package/dist/components/ListToolBar/index.d.ts +0 -59
  101. package/dist/components/ListToolBar/index.js +0 -123
  102. package/dist/components/ListToolBar/style.d.ts +0 -6
  103. package/dist/components/ScrollBar/Bar/index.d.ts +0 -49
  104. package/dist/components/ScrollBar/Bar/index.js +0 -68
  105. package/dist/components/ScrollBar/Bar/props.d.ts +0 -25
  106. package/dist/components/ScrollBar/Bar/props.js +0 -17
  107. package/dist/components/ScrollBar/Thumb/index.d.ts +0 -40
  108. package/dist/components/ScrollBar/Thumb/props.d.ts +0 -20
  109. package/dist/components/ScrollBar/Thumb/props.js +0 -17
  110. package/dist/components/TableCell/index.d.ts +0 -37
  111. package/dist/components/TableCell/index.js +0 -69
  112. package/dist/components/ToolBar/FullscreenIcon.d.ts +0 -7
  113. package/dist/components/ToolBar/FullscreenIcon.js +0 -11
  114. package/dist/components/ToolBar/index.d.ts +0 -34
  115. package/dist/components/ToolBar/index.js +0 -97
  116. package/dist/hooks/tryOnActivated.d.ts +0 -6
  117. package/dist/hooks/tryOnActivated.js +0 -12
  118. package/dist/hooks/useDebounceFn.d.ts +0 -8
  119. package/dist/hooks/useDebounceFn.js +0 -31
  120. package/dist/hooks/useScrollArea.d.ts +0 -24
  121. package/dist/hooks/useScrollArea.js +0 -102
  122. package/dist/props.d.ts +0 -340
  123. package/dist/props.js +0 -247
  124. package/dist/types/ColumnTypings.d.ts +0 -130
  125. package/dist/types/SlotsTypings.d.ts +0 -63
  126. package/dist/types/SlotsTypings.js +0 -12
  127. package/dist/types/TableTypings.d.ts +0 -359
  128. package/dist/types/index.d.ts +0 -9
  129. package/dist/utils/utils.d.ts +0 -10
  130. package/dist/utils/utils.js +0 -89
  131. /package/dist/{types/ColumnTypings.js → interface.js} +0 -0
  132. /package/dist/{types/TableTypings.js → theme/augment.js} +0 -0
  133. /package/dist/{types/index.js → theme/interface/components.js} +0 -0
@@ -0,0 +1,81 @@
1
+ import * as _$vue from "vue";
2
+ import { CSSProperties } from "vue";
3
+ import * as _$vue_jsx_runtime0 from "vue/jsx-runtime";
4
+
5
+ //#region src/components/ScrollBar/Bar.d.ts
6
+ interface BarExpose {
7
+ handleScroll: (wrap: HTMLElement) => void;
8
+ update: () => void;
9
+ }
10
+ declare const barProps: {
11
+ readonly always: {
12
+ readonly type: BooleanConstructor;
13
+ readonly default: true;
14
+ };
15
+ readonly minSize: {
16
+ readonly type: NumberConstructor;
17
+ readonly default: 20;
18
+ };
19
+ readonly barStyle: {
20
+ readonly type: () => {
21
+ x: CSSProperties;
22
+ y: CSSProperties;
23
+ };
24
+ readonly default: () => {};
25
+ };
26
+ readonly hasScrollY: {
27
+ readonly type: BooleanConstructor;
28
+ readonly default: false;
29
+ };
30
+ };
31
+ declare const _default: _$vue.DefineComponent<_$vue.ExtractPropTypes<{
32
+ readonly always: {
33
+ readonly type: BooleanConstructor;
34
+ readonly default: true;
35
+ };
36
+ readonly minSize: {
37
+ readonly type: NumberConstructor;
38
+ readonly default: 20;
39
+ };
40
+ readonly barStyle: {
41
+ readonly type: () => {
42
+ x: CSSProperties;
43
+ y: CSSProperties;
44
+ };
45
+ readonly default: () => {};
46
+ };
47
+ readonly hasScrollY: {
48
+ readonly type: BooleanConstructor;
49
+ readonly default: false;
50
+ };
51
+ }>, () => _$vue_jsx_runtime0.JSX.Element, {}, {}, {}, _$vue.ComponentOptionsMixin, _$vue.ComponentOptionsMixin, {}, string, _$vue.PublicProps, Readonly<_$vue.ExtractPropTypes<{
52
+ readonly always: {
53
+ readonly type: BooleanConstructor;
54
+ readonly default: true;
55
+ };
56
+ readonly minSize: {
57
+ readonly type: NumberConstructor;
58
+ readonly default: 20;
59
+ };
60
+ readonly barStyle: {
61
+ readonly type: () => {
62
+ x: CSSProperties;
63
+ y: CSSProperties;
64
+ };
65
+ readonly default: () => {};
66
+ };
67
+ readonly hasScrollY: {
68
+ readonly type: BooleanConstructor;
69
+ readonly default: false;
70
+ };
71
+ }>> & Readonly<{}>, {
72
+ readonly always: boolean;
73
+ readonly minSize: number;
74
+ readonly barStyle: {
75
+ x: CSSProperties;
76
+ y: CSSProperties;
77
+ };
78
+ readonly hasScrollY: boolean;
79
+ }, {}, {}, {}, string, _$vue.ComponentProvideOptions, true, {}, any>;
80
+ //#endregion
81
+ export { BarExpose, barProps, _default as default };
@@ -0,0 +1,84 @@
1
+ import { useInjectScrollBarContext } from "./context.js";
2
+ import "./util.js";
3
+ import Thumb_default from "./Thumb.js";
4
+ import { Fragment, createVNode, defineComponent, nextTick, onMounted, ref } from "vue";
5
+ //#region src/components/ScrollBar/Bar.tsx
6
+ const barProps = {
7
+ always: {
8
+ type: Boolean,
9
+ default: true
10
+ },
11
+ minSize: {
12
+ type: Number,
13
+ default: 20
14
+ },
15
+ barStyle: {
16
+ type: Object,
17
+ default: () => ({})
18
+ },
19
+ hasScrollY: {
20
+ type: Boolean,
21
+ default: false
22
+ }
23
+ };
24
+ var Bar_default = /* @__PURE__ */ defineComponent({
25
+ name: "ScrollBarBar",
26
+ inheritAttrs: false,
27
+ props: barProps,
28
+ setup(props, { expose }) {
29
+ const scrollbar = useInjectScrollBarContext();
30
+ const moveX = ref(0);
31
+ const moveY = ref(0);
32
+ const sizeWidth = ref("");
33
+ const sizeHeight = ref("");
34
+ const ratioY = ref(1);
35
+ const ratioX = ref(1);
36
+ function handleScroll(wrap) {
37
+ if (!wrap) return;
38
+ const offsetHeight = wrap.offsetHeight - 4;
39
+ const offsetWidth = wrap.offsetWidth - 4;
40
+ moveY.value = wrap.scrollTop * 100 / offsetHeight * ratioY.value;
41
+ moveX.value = wrap.scrollLeft * 100 / offsetWidth * ratioX.value;
42
+ }
43
+ function update() {
44
+ const wrap = scrollbar?.wrapElement?.value;
45
+ if (!wrap) return;
46
+ const offsetHeight = wrap.offsetHeight - 4;
47
+ const offsetWidth = wrap.offsetWidth - 4;
48
+ const originalHeight = offsetHeight ** 2 / wrap.scrollHeight;
49
+ const originalWidth = offsetWidth ** 2 / wrap.scrollWidth;
50
+ const height = Math.max(originalHeight, props.minSize);
51
+ const width = Math.max(originalWidth, props.minSize);
52
+ ratioY.value = originalHeight / (offsetHeight - originalHeight) / (height / (offsetHeight - height));
53
+ ratioX.value = originalWidth / (offsetWidth - originalWidth) / (width / (offsetWidth - width));
54
+ sizeHeight.value = height + 4 < offsetHeight ? `${height}px` : "";
55
+ sizeWidth.value = width + 4 < offsetWidth ? `${width}px` : "";
56
+ }
57
+ onMounted(() => {
58
+ nextTick(() => update());
59
+ });
60
+ expose({
61
+ update,
62
+ handleScroll
63
+ });
64
+ return () => {
65
+ if (!scrollbar) return null;
66
+ return createVNode(Fragment, null, [createVNode(Thumb_default, {
67
+ "move": moveX.value,
68
+ "barStyle": props.barStyle.x,
69
+ "ratio": ratioX.value,
70
+ "size": sizeWidth.value,
71
+ "always": props.always
72
+ }, null), props.hasScrollY && createVNode(Thumb_default, {
73
+ "move": moveY.value,
74
+ "barStyle": props.barStyle.y,
75
+ "ratio": ratioY.value,
76
+ "size": sizeHeight.value,
77
+ "vertical": true,
78
+ "always": props.always
79
+ }, null)]);
80
+ };
81
+ }
82
+ });
83
+ //#endregion
84
+ export { barProps, Bar_default as default };
@@ -0,0 +1,52 @@
1
+ import * as _$vue from "vue";
2
+ import { CSSProperties } from "vue";
3
+ import * as _$vue_jsx_runtime0 from "vue/jsx-runtime";
4
+
5
+ //#region src/components/ScrollBar/Thumb.d.ts
6
+ declare const thumbProps: {
7
+ readonly vertical: BooleanConstructor;
8
+ readonly size: StringConstructor;
9
+ readonly move: NumberConstructor;
10
+ readonly ratio: {
11
+ readonly type: NumberConstructor;
12
+ readonly required: true;
13
+ };
14
+ readonly always: BooleanConstructor;
15
+ readonly barStyle: {
16
+ readonly type: () => CSSProperties;
17
+ readonly default: () => {};
18
+ };
19
+ };
20
+ declare const _default: _$vue.DefineComponent<_$vue.ExtractPropTypes<{
21
+ readonly vertical: BooleanConstructor;
22
+ readonly size: StringConstructor;
23
+ readonly move: NumberConstructor;
24
+ readonly ratio: {
25
+ readonly type: NumberConstructor;
26
+ readonly required: true;
27
+ };
28
+ readonly always: BooleanConstructor;
29
+ readonly barStyle: {
30
+ readonly type: () => CSSProperties;
31
+ readonly default: () => {};
32
+ };
33
+ }>, () => _$vue_jsx_runtime0.JSX.Element, {}, {}, {}, _$vue.ComponentOptionsMixin, _$vue.ComponentOptionsMixin, {}, string, _$vue.PublicProps, Readonly<_$vue.ExtractPropTypes<{
34
+ readonly vertical: BooleanConstructor;
35
+ readonly size: StringConstructor;
36
+ readonly move: NumberConstructor;
37
+ readonly ratio: {
38
+ readonly type: NumberConstructor;
39
+ readonly required: true;
40
+ };
41
+ readonly always: BooleanConstructor;
42
+ readonly barStyle: {
43
+ readonly type: () => CSSProperties;
44
+ readonly default: () => {};
45
+ };
46
+ }>> & Readonly<{}>, {
47
+ readonly always: boolean;
48
+ readonly barStyle: CSSProperties;
49
+ readonly vertical: boolean;
50
+ }, {}, {}, {}, string, _$vue.ComponentProvideOptions, true, {}, any>;
51
+ //#endregion
52
+ export { _default as default, thumbProps };
@@ -1,14 +1,29 @@
1
- import { useScrollBarContext } from "../context.js";
2
- import { BAR_MAP, renderThumbStyle } from "../util.js";
3
- import { thumbProps } from "./props.js";
1
+ import { useInjectScrollBarContext } from "./context.js";
2
+ import { BAR_MAP, renderThumbStyle } from "./util.js";
4
3
  import { computed, createVNode, defineComponent, onBeforeUnmount, ref } from "vue";
4
+ import { useEventListener } from "@vueuse/core";
5
5
  import { unit } from "@gx-design-vue/pro-provider";
6
- import { isClient, useEventListener } from "@vueuse/core";
7
- //#region src/components/ScrollBar/Thumb/index.tsx
8
- const Thumb = /* @__PURE__ */ defineComponent({
6
+ //#region src/components/ScrollBar/Thumb.tsx
7
+ const thumbProps = {
8
+ vertical: Boolean,
9
+ size: String,
10
+ move: Number,
11
+ ratio: {
12
+ type: Number,
13
+ required: true
14
+ },
15
+ always: Boolean,
16
+ barStyle: {
17
+ type: Object,
18
+ default: () => ({})
19
+ }
20
+ };
21
+ var Thumb_default = /* @__PURE__ */ defineComponent({
22
+ name: "ScrollBarThumb",
23
+ inheritAttrs: false,
9
24
  props: thumbProps,
10
25
  setup(props) {
11
- const { tableHeaderHeight, hashId, wrapElement, scrollbarElement, className } = useScrollBarContext();
26
+ const scrollbar = useInjectScrollBarContext();
12
27
  const instance = ref();
13
28
  const thumb = ref();
14
29
  const thumbState = ref({});
@@ -17,57 +32,61 @@ const Thumb = /* @__PURE__ */ defineComponent({
17
32
  let cursorLeave = false;
18
33
  let baseScrollHeight = 0;
19
34
  let baseScrollWidth = 0;
20
- let originalOnSelectStart = isClient ? document.onselectstart : null;
21
35
  const bar = computed(() => BAR_MAP[props.vertical ? "vertical" : "horizontal"]);
22
36
  const thumbStyle = computed(() => renderThumbStyle({
23
37
  size: props.size,
24
38
  move: props.move,
25
39
  bar: bar.value
26
40
  }));
27
- const offsetRatio = computed(() => instance.value[bar.value.offset] ** 2 / wrapElement.value[bar.value.scrollSize] / props.ratio / thumb.value[bar.value.offset]);
28
- const clickThumbHandler = (e) => {
29
- e.stopPropagation();
30
- if (e.ctrlKey || [1, 2].includes(e.button)) return;
31
- window.getSelection()?.removeAllRanges();
32
- startDrag(e);
33
- const el = e.currentTarget;
34
- if (!el) return;
35
- thumbState.value[bar.value.axis] = el[bar.value.offset] - (e[bar.value.client] - el.getBoundingClientRect()[bar.value.direction]);
36
- };
37
- const clickTrackHandler = (e) => {
38
- if (!thumb.value || !instance.value || !wrapElement.value) return;
39
- const thumbPositionPercentage = (Math.abs(e.target.getBoundingClientRect()[bar.value.direction] - e[bar.value.client]) - thumb.value[bar.value.offset] / 2) * 100 * offsetRatio.value / instance.value[bar.value.offset];
40
- wrapElement.value[bar.value.scroll] = thumbPositionPercentage * wrapElement.value[bar.value.scrollSize] / 100;
41
- };
42
- function startDrag(e) {
43
- if (!wrapElement.value) return;
44
- e.stopImmediatePropagation();
45
- cursorDown = true;
46
- baseScrollHeight = wrapElement.value.scrollHeight;
47
- baseScrollWidth = wrapElement.value.scrollWidth;
48
- document.addEventListener("mousemove", mouseMoveDocumentHandler);
49
- document.addEventListener("mouseup", mouseUpDocumentHandler);
50
- originalOnSelectStart = document.onselectstart;
51
- document.onselectstart = () => false;
41
+ const offsetRatio = computed(() => {
42
+ if (!instance.value || !thumb.value || !scrollbar?.wrapElement?.value) return 1;
43
+ return instance.value[bar.value.offset] ** 2 / scrollbar.wrapElement.value[bar.value.scrollSize] / props.ratio / thumb.value[bar.value.offset];
44
+ });
45
+ function restoreOnSelectStart(originalOnSelectStart) {
46
+ if (document.onselectstart !== originalOnSelectStart) document.onselectstart = originalOnSelectStart;
52
47
  }
53
48
  function mouseMoveDocumentHandler(e) {
54
- if (!wrapElement.value) return;
55
- if (!instance.value || !thumb.value) return;
56
- if (cursorDown === false) return;
49
+ if (!scrollbar?.wrapElement?.value || !instance.value || !thumb.value || !cursorDown) return;
57
50
  const prevPage = thumbState.value[bar.value.axis];
58
51
  if (!prevPage) return;
59
52
  const thumbPositionPercentage = ((instance.value.getBoundingClientRect()[bar.value.direction] - e[bar.value.client]) * -1 - (thumb.value[bar.value.offset] - prevPage)) * 100 * offsetRatio.value / instance.value[bar.value.offset];
60
- if (bar.value.scroll === "scrollLeft") wrapElement.value[bar.value.scroll] = thumbPositionPercentage * baseScrollWidth / 100;
61
- else wrapElement.value[bar.value.scroll] = thumbPositionPercentage * baseScrollHeight / 100;
53
+ if (bar.value.scroll === "scrollLeft") scrollbar.wrapElement.value[bar.value.scroll] = thumbPositionPercentage * baseScrollWidth / 100;
54
+ else scrollbar.wrapElement.value[bar.value.scroll] = thumbPositionPercentage * baseScrollHeight / 100;
62
55
  }
56
+ let originalOnSelectStart = document.onselectstart;
63
57
  function mouseUpDocumentHandler() {
64
58
  cursorDown = false;
65
59
  thumbState.value[bar.value.axis] = 0;
66
60
  document.removeEventListener("mousemove", mouseMoveDocumentHandler);
67
61
  document.removeEventListener("mouseup", mouseUpDocumentHandler);
68
- restoreOnselectstart();
62
+ restoreOnSelectStart(originalOnSelectStart);
69
63
  if (cursorLeave) visible.value = false;
70
64
  }
65
+ function startDrag(e) {
66
+ if (!scrollbar?.wrapElement?.value) return;
67
+ e.stopImmediatePropagation();
68
+ cursorDown = true;
69
+ baseScrollHeight = scrollbar.wrapElement.value.scrollHeight;
70
+ baseScrollWidth = scrollbar.wrapElement.value.scrollWidth;
71
+ document.addEventListener("mousemove", mouseMoveDocumentHandler);
72
+ document.addEventListener("mouseup", mouseUpDocumentHandler);
73
+ originalOnSelectStart = document.onselectstart;
74
+ document.onselectstart = () => false;
75
+ }
76
+ function clickThumbHandler(e) {
77
+ e.stopPropagation();
78
+ if (e.ctrlKey || [1, 2].includes(e.button)) return;
79
+ window.getSelection()?.removeAllRanges();
80
+ startDrag(e);
81
+ const el = e.currentTarget;
82
+ if (!el) return;
83
+ thumbState.value[bar.value.axis] = el[bar.value.offset] - (e[bar.value.client] - el.getBoundingClientRect()[bar.value.direction]);
84
+ }
85
+ function clickTrackHandler(e) {
86
+ if (!thumb.value || !instance.value || !scrollbar?.wrapElement?.value) return;
87
+ const thumbPositionPercentage = (Math.abs(e.target.getBoundingClientRect()[bar.value.direction] - e[bar.value.client]) - thumb.value[bar.value.offset] / 2) * 100 * offsetRatio.value / instance.value[bar.value.offset];
88
+ scrollbar.wrapElement.value[bar.value.scroll] = thumbPositionPercentage * scrollbar.wrapElement.value[bar.value.scrollSize] / 100;
89
+ }
71
90
  const mouseMoveScrollbarHandler = () => {
72
91
  cursorLeave = false;
73
92
  visible.value = !!props.size;
@@ -76,19 +95,17 @@ const Thumb = /* @__PURE__ */ defineComponent({
76
95
  cursorLeave = true;
77
96
  visible.value = cursorDown;
78
97
  };
98
+ useEventListener(scrollbar?.scrollbarElement, "mousemove", mouseMoveScrollbarHandler);
99
+ useEventListener(scrollbar?.scrollbarElement, "mouseleave", mouseLeaveScrollbarHandler);
79
100
  onBeforeUnmount(() => {
80
- restoreOnselectstart();
101
+ restoreOnSelectStart(originalOnSelectStart);
81
102
  document.removeEventListener("mouseup", mouseUpDocumentHandler);
82
103
  });
83
- function restoreOnselectstart() {
84
- if (document.onselectstart !== originalOnSelectStart) document.onselectstart = originalOnSelectStart;
85
- }
86
- useEventListener(scrollbarElement, "mousemove", mouseMoveScrollbarHandler);
87
- useEventListener(scrollbarElement, "mouseleave", mouseLeaveScrollbarHandler);
88
104
  return () => {
105
+ if (!scrollbar) return null;
89
106
  const verticalStyle = bar.value.key === "vertical" ? {
90
- height: `calc(100% - ${unit(tableHeaderHeight.value + 1)})`,
91
- top: unit(tableHeaderHeight.value + 1)
107
+ height: `calc(100% - ${unit(scrollbar.tableHeaderHeight.value + 1)})`,
108
+ top: unit(scrollbar.tableHeaderHeight.value + 1)
92
109
  } : {};
93
110
  return createVNode("div", {
94
111
  "ref": instance,
@@ -96,21 +113,16 @@ const Thumb = /* @__PURE__ */ defineComponent({
96
113
  ...props.barStyle,
97
114
  ...verticalStyle
98
115
  },
99
- "class": [
100
- `${className}-bar`,
101
- `is-${bar.value.key}`,
102
- hashId.value
103
- ],
116
+ "class": `${scrollbar.className}-bar is-${bar.value.key}`,
104
117
  "onMousedown": clickTrackHandler
105
118
  }, [createVNode("div", {
106
119
  "ref": thumb,
107
- "class": `${className}-thumb ${hashId.value}`,
120
+ "class": `${scrollbar.className}-thumb`,
108
121
  "style": thumbStyle.value,
109
122
  "onMousedown": clickThumbHandler
110
123
  }, null)]);
111
124
  };
112
125
  }
113
126
  });
114
- Thumb.inheritAttrs = false;
115
127
  //#endregion
116
- export { Thumb as default };
128
+ export { Thumb_default as default, thumbProps };
@@ -1,14 +1,13 @@
1
1
  import { Ref } from "vue";
2
2
 
3
3
  //#region src/components/ScrollBar/context.d.ts
4
- interface ScrollbarContext {
4
+ interface ScrollBarContext {
5
5
  className: string;
6
- hashId: Ref<string>;
7
6
  tableHeaderHeight: Ref<number>;
8
7
  tableScrollYHeight: Ref<number>;
9
8
  scrollbarElement: Ref<HTMLElement | undefined>;
10
9
  wrapElement: Ref<HTMLElement | undefined>;
11
10
  }
12
- declare const useScrollBarContext: (injectDefaultValue?: ScrollbarContext) => ScrollbarContext, provideScrollBarContext: (value: ScrollbarContext) => void;
11
+ declare const useProvideScrollBarContext: (args_0: ScrollBarContext) => ScrollBarContext, useInjectScrollBarContext: () => ScrollBarContext;
13
12
  //#endregion
14
- export { ScrollbarContext, provideScrollBarContext, useScrollBarContext };
13
+ export { ScrollBarContext, useInjectScrollBarContext, useProvideScrollBarContext };
@@ -1,5 +1,5 @@
1
- import { useContext } from "@gx-design-vue/context";
1
+ import { createInjectionState } from "@vueuse/core";
2
2
  //#region src/components/ScrollBar/context.ts
3
- const { useInjectContext: useScrollBarContext, provideContext: provideScrollBarContext } = useContext("scrollbar");
3
+ const [useProvideScrollBarContext, useInjectScrollBarContext] = createInjectionState((context) => context);
4
4
  //#endregion
5
- export { provideScrollBarContext, useScrollBarContext };
5
+ export { useInjectScrollBarContext, useProvideScrollBarContext };
@@ -24,14 +24,15 @@ declare const BAR_MAP: {
24
24
  readonly direction: "left";
25
25
  };
26
26
  };
27
+ type BarDirection = keyof typeof BAR_MAP;
27
28
  declare function renderThumbStyle({
28
29
  move,
29
30
  size,
30
31
  bar
31
- }: Pick<any, 'move' | 'size'> & {
32
- bar: typeof BAR_MAP[keyof typeof BAR_MAP];
32
+ }: {
33
+ move: number;
34
+ size: string;
35
+ bar: typeof BAR_MAP[BarDirection];
33
36
  }): CSSProperties;
34
- declare function isStringNumber(val: string): boolean;
35
- declare function addUnit(value?: string | number, defaultUnit?: string): string;
36
37
  //#endregion
37
- export { BAR_MAP, GAP, addUnit, isStringNumber, renderThumbStyle };
38
+ export { BAR_MAP, BarDirection, GAP, renderThumbStyle };
@@ -1,4 +1,3 @@
1
- import { isNumber, isString } from "@gx-design-vue/pro-utils";
2
1
  //#region src/components/ScrollBar/util.ts
3
2
  const GAP = 4;
4
3
  const BAR_MAP = {
@@ -29,15 +28,5 @@ function renderThumbStyle({ move, size, bar }) {
29
28
  transform: `translate${bar.axis}(${move}%)`
30
29
  };
31
30
  }
32
- function isStringNumber(val) {
33
- if (!isString(val)) return false;
34
- return !Number.isNaN(Number(val));
35
- }
36
- function addUnit(value, defaultUnit = "px") {
37
- if (!value) return "";
38
- if (isNumber(value) || isStringNumber(value)) return `${value}${defaultUnit}`;
39
- else if (isString(value)) return value;
40
- console.warn("utils/dom/style", "value 必须为数字");
41
- }
42
31
  //#endregion
43
- export { BAR_MAP, GAP, addUnit, isStringNumber, renderThumbStyle };
32
+ export { BAR_MAP, GAP, renderThumbStyle };
@@ -0,0 +1,55 @@
1
+ import * as _$vue from "vue";
2
+ import { PropType } from "vue";
3
+ import { CustomRender, WithFalse } from "@gx-design-vue/pro-utils";
4
+ import * as _$vue_jsx_runtime0 from "vue/jsx-runtime";
5
+
6
+ //#region src/components/SearchForm/CollapseToggle.d.ts
7
+ declare const CollapseToggle: _$vue.DefineComponent<_$vue.ExtractPropTypes<{
8
+ collapsed: {
9
+ type: BooleanConstructor;
10
+ default: any;
11
+ };
12
+ collapseRender: {
13
+ type: PropType<WithFalse<(collapsed?: boolean) => CustomRender> | undefined>;
14
+ default: any;
15
+ };
16
+ prefixCls: {
17
+ type: StringConstructor;
18
+ required: true;
19
+ };
20
+ hashId: {
21
+ type: StringConstructor;
22
+ default: string;
23
+ };
24
+ onToggle: {
25
+ type: PropType<(collapsed: boolean) => void>;
26
+ required: true;
27
+ };
28
+ }>, () => _$vue_jsx_runtime0.JSX.Element, {}, {}, {}, _$vue.ComponentOptionsMixin, _$vue.ComponentOptionsMixin, {}, string, _$vue.PublicProps, Readonly<_$vue.ExtractPropTypes<{
29
+ collapsed: {
30
+ type: BooleanConstructor;
31
+ default: any;
32
+ };
33
+ collapseRender: {
34
+ type: PropType<WithFalse<(collapsed?: boolean) => CustomRender> | undefined>;
35
+ default: any;
36
+ };
37
+ prefixCls: {
38
+ type: StringConstructor;
39
+ required: true;
40
+ };
41
+ hashId: {
42
+ type: StringConstructor;
43
+ default: string;
44
+ };
45
+ onToggle: {
46
+ type: PropType<(collapsed: boolean) => void>;
47
+ required: true;
48
+ };
49
+ }>> & Readonly<{}>, {
50
+ collapsed: boolean;
51
+ collapseRender: WithFalse<(collapsed?: boolean) => CustomRender>;
52
+ hashId: string;
53
+ }, {}, {}, {}, string, _$vue.ComponentProvideOptions, true, {}, any>;
54
+ //#endregion
55
+ export { CollapseToggle };
@@ -0,0 +1,47 @@
1
+ import { createVNode, defineComponent } from "vue";
2
+ import { DownOutlined, UpOutlined } from "@antdv-next/icons";
3
+ //#region src/components/SearchForm/CollapseToggle.tsx
4
+ const CollapseToggle = /* @__PURE__ */ defineComponent({
5
+ name: "ProTableCollapseToggle",
6
+ props: {
7
+ collapsed: {
8
+ type: Boolean,
9
+ default: void 0
10
+ },
11
+ collapseRender: {
12
+ type: [
13
+ Function,
14
+ Object,
15
+ Boolean
16
+ ],
17
+ default: void 0
18
+ },
19
+ prefixCls: {
20
+ type: String,
21
+ required: true
22
+ },
23
+ hashId: {
24
+ type: String,
25
+ default: ""
26
+ },
27
+ onToggle: {
28
+ type: Function,
29
+ required: true
30
+ }
31
+ },
32
+ setup(props) {
33
+ return () => {
34
+ if (props.collapseRender === false) return null;
35
+ if (typeof props.collapseRender === "function") return createVNode("span", {
36
+ "class": [`${props.prefixCls}-search-control-text`, props.hashId],
37
+ "onClick": () => props.onToggle(!props.collapsed)
38
+ }, [props.collapseRender(props.collapsed)]);
39
+ return createVNode("span", {
40
+ "class": `${props.prefixCls}-search-control-text`,
41
+ "onClick": () => props.onToggle(!props.collapsed)
42
+ }, [props.collapsed ? "展开" : "收起", props.collapsed ? createVNode(DownOutlined, null, null) : createVNode(UpOutlined, null, null)]);
43
+ };
44
+ }
45
+ });
46
+ //#endregion
47
+ export { CollapseToggle };
@@ -0,0 +1,75 @@
1
+ import { ProSearchMap } from "../../interface.js";
2
+ import * as _$vue from "vue";
3
+ import { PropType } from "vue";
4
+ import * as _$vue_jsx_runtime0 from "vue/jsx-runtime";
5
+
6
+ //#region src/components/SearchForm/FormItemContainer.d.ts
7
+ declare const FormItemContainer: _$vue.DefineComponent<_$vue.ExtractPropTypes<{
8
+ prefixCls: {
9
+ type: StringConstructor;
10
+ required: true;
11
+ };
12
+ record: {
13
+ type: PropType<ProSearchMap>;
14
+ required: true;
15
+ };
16
+ formState: {
17
+ type: PropType<Record<string, any>>;
18
+ required: true;
19
+ };
20
+ autoRequest: {
21
+ type: BooleanConstructor;
22
+ default: boolean;
23
+ };
24
+ loading: {
25
+ type: BooleanConstructor;
26
+ default: boolean;
27
+ };
28
+ onChange: {
29
+ type: PropType<(value: any, record: ProSearchMap, options?: {
30
+ key?: number;
31
+ }) => void>;
32
+ required: true;
33
+ };
34
+ onSubmit: {
35
+ type: PropType<() => void>;
36
+ default: any;
37
+ };
38
+ }>, () => _$vue_jsx_runtime0.JSX.Element, {}, {}, {}, _$vue.ComponentOptionsMixin, _$vue.ComponentOptionsMixin, {}, string, _$vue.PublicProps, Readonly<_$vue.ExtractPropTypes<{
39
+ prefixCls: {
40
+ type: StringConstructor;
41
+ required: true;
42
+ };
43
+ record: {
44
+ type: PropType<ProSearchMap>;
45
+ required: true;
46
+ };
47
+ formState: {
48
+ type: PropType<Record<string, any>>;
49
+ required: true;
50
+ };
51
+ autoRequest: {
52
+ type: BooleanConstructor;
53
+ default: boolean;
54
+ };
55
+ loading: {
56
+ type: BooleanConstructor;
57
+ default: boolean;
58
+ };
59
+ onChange: {
60
+ type: PropType<(value: any, record: ProSearchMap, options?: {
61
+ key?: number;
62
+ }) => void>;
63
+ required: true;
64
+ };
65
+ onSubmit: {
66
+ type: PropType<() => void>;
67
+ default: any;
68
+ };
69
+ }>> & Readonly<{}>, {
70
+ autoRequest: boolean;
71
+ loading: boolean;
72
+ onSubmit: () => void;
73
+ }, {}, {}, {}, string, _$vue.ComponentProvideOptions, true, {}, any>;
74
+ //#endregion
75
+ export { FormItemContainer };