@gx-design-vue/pro-table 0.2.0-alpha.0 → 0.2.0-alpha.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.
Files changed (136) hide show
  1. package/dist/ProTable.d.ts +14 -493
  2. package/dist/ProTable.js +818 -512
  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 -58
  7. package/dist/components/ScrollBar/context.d.ts +3 -4
  8. package/dist/components/ScrollBar/context.js +3 -5
  9. package/dist/components/ScrollBar/util.d.ts +6 -5
  10. package/dist/components/ScrollBar/util.js +1 -14
  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 -5
  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 -58
  41. package/dist/hooks/useFetchData.d.ts +40 -65
  42. package/dist/hooks/useFetchData.js +157 -174
  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 +27 -11
  49. package/dist/hooks/usePagination.d.ts +10 -7
  50. package/dist/hooks/usePagination.js +38 -29
  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 +93 -80
  55. package/dist/hooks/useTable.d.ts +35 -77
  56. package/dist/hooks/useTable.js +72 -50
  57. package/dist/hooks/useTableForm.d.ts +15 -82
  58. package/dist/hooks/useTableForm.js +93 -55
  59. package/dist/hooks/useTableScroll.d.ts +33 -31
  60. package/dist/hooks/useTableScroll.js +71 -28
  61. package/dist/hooks/useTableSize.d.ts +17 -7
  62. package/dist/hooks/useTableSize.js +21 -9
  63. package/dist/index.d.ts +10 -7
  64. package/dist/index.js +9 -4
  65. package/dist/interface.d.ts +499 -0
  66. package/dist/interface.js +1 -0
  67. package/dist/pro-table.esm.js +3579 -3834
  68. package/dist/pro-table.js +1 -1
  69. package/dist/style/fit-page.d.ts +4 -2
  70. package/dist/style/fit-page.js +10 -5
  71. package/dist/style/index.d.ts +4 -6
  72. package/dist/style/index.js +24 -76
  73. package/dist/style/list.d.ts +4 -2
  74. package/dist/style/list.js +2 -12
  75. package/dist/style/resizable.d.ts +8 -0
  76. package/dist/style/resizable.js +18 -0
  77. package/dist/style/scroll.d.ts +4 -2
  78. package/dist/style/scroll.js +9 -9
  79. package/dist/style/search.d.ts +8 -0
  80. package/dist/{components/Form/style.js → style/search.js} +22 -9
  81. package/dist/theme/augment.d.ts +8 -0
  82. package/dist/theme/augment.js +1 -0
  83. package/dist/theme/interface/components.d.ts +8 -0
  84. package/dist/theme/interface/components.js +1 -0
  85. package/dist/utils/dateFormat.d.ts +9 -0
  86. package/dist/utils/dateFormat.js +29 -0
  87. package/dist/utils/formConstants.d.ts +9 -0
  88. package/dist/utils/formConstants.js +29 -0
  89. package/dist/utils/valueFormat.d.ts +9 -0
  90. package/dist/utils/valueFormat.js +27 -0
  91. package/package.json +11 -10
  92. package/dist/components/Form/components/RequestSelect.d.ts +0 -50
  93. package/dist/components/Form/components/RequestSelect.js +0 -58
  94. package/dist/components/Form/hooks/useForm.d.ts +0 -11
  95. package/dist/components/Form/hooks/useForm.js +0 -32
  96. package/dist/components/Form/index.d.ts +0 -33
  97. package/dist/components/Form/index.js +0 -479
  98. package/dist/components/Form/style.d.ts +0 -6
  99. package/dist/components/Form/utils/config.d.ts +0 -9
  100. package/dist/components/Form/utils/config.js +0 -30
  101. package/dist/components/Form/utils/dateFormat.d.ts +0 -22
  102. package/dist/components/Form/utils/dateFormat.js +0 -45
  103. package/dist/components/ListToolBar/index.d.ts +0 -60
  104. package/dist/components/ListToolBar/index.js +0 -123
  105. package/dist/components/ListToolBar/style.d.ts +0 -6
  106. package/dist/components/ScrollBar/Bar/index.d.ts +0 -49
  107. package/dist/components/ScrollBar/Bar/index.js +0 -71
  108. package/dist/components/ScrollBar/Bar/props.d.ts +0 -25
  109. package/dist/components/ScrollBar/Bar/props.js +0 -18
  110. package/dist/components/ScrollBar/Thumb/index.d.ts +0 -40
  111. package/dist/components/ScrollBar/Thumb/props.d.ts +0 -20
  112. package/dist/components/ScrollBar/Thumb/props.js +0 -18
  113. package/dist/components/TableCell/index.d.ts +0 -37
  114. package/dist/components/TableCell/index.js +0 -72
  115. package/dist/components/ToolBar/FullscreenIcon.d.ts +0 -7
  116. package/dist/components/ToolBar/FullscreenIcon.js +0 -14
  117. package/dist/components/ToolBar/index.d.ts +0 -34
  118. package/dist/components/ToolBar/index.js +0 -100
  119. package/dist/hooks/tryOnActivated.d.ts +0 -6
  120. package/dist/hooks/tryOnActivated.js +0 -14
  121. package/dist/hooks/useDebounceFn.d.ts +0 -8
  122. package/dist/hooks/useDebounceFn.js +0 -34
  123. package/dist/hooks/useScrollArea.d.ts +0 -24
  124. package/dist/hooks/useScrollArea.js +0 -104
  125. package/dist/props.d.ts +0 -340
  126. package/dist/props.js +0 -251
  127. package/dist/types/ColumnTypings.d.ts +0 -127
  128. package/dist/types/ColumnTypings.js +0 -1
  129. package/dist/types/SlotsTypings.d.ts +0 -63
  130. package/dist/types/SlotsTypings.js +0 -13
  131. package/dist/types/TableTypings.d.ts +0 -359
  132. package/dist/types/TableTypings.js +0 -1
  133. package/dist/types/index.d.ts +0 -9
  134. package/dist/types/index.js +0 -1
  135. package/dist/utils/utils.d.ts +0 -10
  136. package/dist/utils/utils.js +0 -91
@@ -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,15 +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
-
8
- //#region src/components/ScrollBar/Thumb/index.tsx
9
- 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,
10
24
  props: thumbProps,
11
25
  setup(props) {
12
- const { tableHeaderHeight, hashId, wrapElement, scrollbarElement, className } = useScrollBarContext();
26
+ const scrollbar = useInjectScrollBarContext();
13
27
  const instance = ref();
14
28
  const thumb = ref();
15
29
  const thumbState = ref({});
@@ -18,57 +32,61 @@ const Thumb = /* @__PURE__ */ defineComponent({
18
32
  let cursorLeave = false;
19
33
  let baseScrollHeight = 0;
20
34
  let baseScrollWidth = 0;
21
- let originalOnSelectStart = isClient ? document.onselectstart : null;
22
35
  const bar = computed(() => BAR_MAP[props.vertical ? "vertical" : "horizontal"]);
23
36
  const thumbStyle = computed(() => renderThumbStyle({
24
37
  size: props.size,
25
38
  move: props.move,
26
39
  bar: bar.value
27
40
  }));
28
- const offsetRatio = computed(() => instance.value[bar.value.offset] ** 2 / wrapElement.value[bar.value.scrollSize] / props.ratio / thumb.value[bar.value.offset]);
29
- const clickThumbHandler = (e) => {
30
- e.stopPropagation();
31
- if (e.ctrlKey || [1, 2].includes(e.button)) return;
32
- window.getSelection()?.removeAllRanges();
33
- startDrag(e);
34
- const el = e.currentTarget;
35
- if (!el) return;
36
- thumbState.value[bar.value.axis] = el[bar.value.offset] - (e[bar.value.client] - el.getBoundingClientRect()[bar.value.direction]);
37
- };
38
- const clickTrackHandler = (e) => {
39
- if (!thumb.value || !instance.value || !wrapElement.value) return;
40
- 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];
41
- wrapElement.value[bar.value.scroll] = thumbPositionPercentage * wrapElement.value[bar.value.scrollSize] / 100;
42
- };
43
- function startDrag(e) {
44
- if (!wrapElement.value) return;
45
- e.stopImmediatePropagation();
46
- cursorDown = true;
47
- baseScrollHeight = wrapElement.value.scrollHeight;
48
- baseScrollWidth = wrapElement.value.scrollWidth;
49
- document.addEventListener("mousemove", mouseMoveDocumentHandler);
50
- document.addEventListener("mouseup", mouseUpDocumentHandler);
51
- originalOnSelectStart = document.onselectstart;
52
- 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;
53
47
  }
54
48
  function mouseMoveDocumentHandler(e) {
55
- if (!wrapElement.value) return;
56
- if (!instance.value || !thumb.value) return;
57
- if (cursorDown === false) return;
49
+ if (!scrollbar?.wrapElement?.value || !instance.value || !thumb.value || !cursorDown) return;
58
50
  const prevPage = thumbState.value[bar.value.axis];
59
51
  if (!prevPage) return;
60
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];
61
- if (bar.value.scroll === "scrollLeft") wrapElement.value[bar.value.scroll] = thumbPositionPercentage * baseScrollWidth / 100;
62
- 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;
63
55
  }
56
+ let originalOnSelectStart = document.onselectstart;
64
57
  function mouseUpDocumentHandler() {
65
58
  cursorDown = false;
66
59
  thumbState.value[bar.value.axis] = 0;
67
60
  document.removeEventListener("mousemove", mouseMoveDocumentHandler);
68
61
  document.removeEventListener("mouseup", mouseUpDocumentHandler);
69
- restoreOnselectstart();
62
+ restoreOnSelectStart(originalOnSelectStart);
70
63
  if (cursorLeave) visible.value = false;
71
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
+ }
72
90
  const mouseMoveScrollbarHandler = () => {
73
91
  cursorLeave = false;
74
92
  visible.value = !!props.size;
@@ -77,19 +95,17 @@ const Thumb = /* @__PURE__ */ defineComponent({
77
95
  cursorLeave = true;
78
96
  visible.value = cursorDown;
79
97
  };
98
+ useEventListener(scrollbar?.scrollbarElement, "mousemove", mouseMoveScrollbarHandler);
99
+ useEventListener(scrollbar?.scrollbarElement, "mouseleave", mouseLeaveScrollbarHandler);
80
100
  onBeforeUnmount(() => {
81
- restoreOnselectstart();
101
+ restoreOnSelectStart(originalOnSelectStart);
82
102
  document.removeEventListener("mouseup", mouseUpDocumentHandler);
83
103
  });
84
- function restoreOnselectstart() {
85
- if (document.onselectstart !== originalOnSelectStart) document.onselectstart = originalOnSelectStart;
86
- }
87
- useEventListener(scrollbarElement, "mousemove", mouseMoveScrollbarHandler);
88
- useEventListener(scrollbarElement, "mouseleave", mouseLeaveScrollbarHandler);
89
104
  return () => {
105
+ if (!scrollbar) return null;
90
106
  const verticalStyle = bar.value.key === "vertical" ? {
91
- height: `calc(100% - ${unit(tableHeaderHeight.value + 1)})`,
92
- top: unit(tableHeaderHeight.value + 1)
107
+ height: `calc(100% - ${unit(scrollbar.tableHeaderHeight.value + 1)})`,
108
+ top: unit(scrollbar.tableHeaderHeight.value + 1)
93
109
  } : {};
94
110
  return createVNode("div", {
95
111
  "ref": instance,
@@ -97,23 +113,16 @@ const Thumb = /* @__PURE__ */ defineComponent({
97
113
  ...props.barStyle,
98
114
  ...verticalStyle
99
115
  },
100
- "class": [
101
- `${className}-bar`,
102
- `is-${bar.value.key}`,
103
- hashId.value
104
- ],
116
+ "class": `${scrollbar.className}-bar is-${bar.value.key}`,
105
117
  "onMousedown": clickTrackHandler
106
118
  }, [createVNode("div", {
107
119
  "ref": thumb,
108
- "class": `${className}-thumb ${hashId.value}`,
120
+ "class": `${scrollbar.className}-thumb`,
109
121
  "style": thumbStyle.value,
110
122
  "onMousedown": clickThumbHandler
111
123
  }, null)]);
112
124
  };
113
125
  }
114
126
  });
115
- Thumb.inheritAttrs = false;
116
- var Thumb_default = Thumb;
117
-
118
127
  //#endregion
119
- export { Thumb_default 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,7 +1,5 @@
1
- import { useContext } from "@gx-design-vue/context";
2
-
1
+ import { createInjectionState } from "@vueuse/core";
3
2
  //#region src/components/ScrollBar/context.ts
4
- const { useInjectContext: useScrollBarContext, provideContext: provideScrollBarContext } = useContext("scrollbar");
5
-
3
+ const [useProvideScrollBarContext, useInjectScrollBarContext] = createInjectionState((context) => context);
6
4
  //#endregion
7
- 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,5 +1,3 @@
1
- import { isNumber, isString } from "@gx-design-vue/pro-utils";
2
-
3
1
  //#region src/components/ScrollBar/util.ts
4
2
  const GAP = 4;
5
3
  const BAR_MAP = {
@@ -30,16 +28,5 @@ function renderThumbStyle({ move, size, bar }) {
30
28
  transform: `translate${bar.axis}(${move}%)`
31
29
  };
32
30
  }
33
- function isStringNumber(val) {
34
- if (!isString(val)) return false;
35
- return !Number.isNaN(Number(val));
36
- }
37
- function addUnit(value, defaultUnit = "px") {
38
- if (!value) return "";
39
- if (isNumber(value) || isStringNumber(value)) return `${value}${defaultUnit}`;
40
- else if (isString(value)) return value;
41
- console.warn("utils/dom/style", "value 必须为数字");
42
- }
43
-
44
31
  //#endregion
45
- 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
+ onSubmit: () => void;
71
+ autoRequest: boolean;
72
+ loading: boolean;
73
+ }, {}, {}, {}, string, _$vue.ComponentProvideOptions, true, {}, any>;
74
+ //#endregion
75
+ export { FormItemContainer };