@jetlinks-web/components 2.0.2 → 2.0.4-1

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 (245) hide show
  1. package/es/AMap/Map.js +125 -0
  2. package/es/AMap/index.js +2 -0
  3. package/es/AMap/util.js +56 -0
  4. package/es/BadgeStatus/Badge.js +54 -0
  5. package/es/BadgeStatus/color.js +21 -0
  6. package/es/BadgeStatus/index.js +3 -0
  7. package/es/CardSelect/CardSelect.js +123 -0
  8. package/es/CardSelect/index.js +2 -0
  9. package/es/CheckButton/CheckButton.js +120 -0
  10. package/es/CheckButton/index.js +2 -0
  11. package/es/CheckButton/style/index.css +37 -0
  12. package/es/CheckButton/style/index.less +40 -0
  13. package/es/ConfigProvider/context.js +12 -0
  14. package/es/ConfigProvider/index.js +31 -0
  15. package/es/Echarts/Echarts.js +47 -0
  16. package/es/Echarts/index.js +2 -0
  17. package/es/Ellipsis/Ellipsis.js +184 -0
  18. package/es/Ellipsis/index.js +2 -0
  19. package/es/Ellipsis/style/index.css +17 -0
  20. package/es/Ellipsis/style/index.less +20 -0
  21. package/es/Empty/Empty.js +56 -0
  22. package/es/Empty/image.js +2 -0
  23. package/es/Empty/index.js +2 -0
  24. package/es/FullPage/FullPage.js +31 -0
  25. package/es/FullPage/index.js +2 -0
  26. package/es/Icon/icon.js +42 -0
  27. package/{src/Icon/index.ts → es/Icon/index.js} +2 -3
  28. package/es/MonacoEditor/Monaco.js +238 -0
  29. package/es/MonacoEditor/index.js +2 -0
  30. package/es/PermissionButton/index.js +117 -0
  31. package/es/ProLayout/Basic/BasicLayout.js +259 -0
  32. package/es/ProLayout/Basic/Header.js +97 -0
  33. package/es/ProLayout/PageContainer/index.js +324 -0
  34. package/es/ProLayout/PageContainer/typings.js +1 -0
  35. package/es/ProLayout/RouteContext.js +22 -0
  36. package/es/ProLayout/SiderMenu/BaseMenu.js +285 -0
  37. package/es/ProLayout/SiderMenu/SiderMenu.js +278 -0
  38. package/es/ProLayout/SiderMenu/index.js +2 -0
  39. package/es/ProLayout/SiderMenu/typings.js +1 -0
  40. package/es/ProLayout/TopHeader/index.js +163 -0
  41. package/es/ProLayout/defaultSettings.js +66 -0
  42. package/{src/ProLayout/index.ts → es/ProLayout/index.js} +4 -6
  43. package/{src → es}/ProLayout/style/default.less +1 -1
  44. package/es/ProLayout/style/index.js +1 -0
  45. package/es/ProLayout/typings.js +1 -0
  46. package/es/ProLayout/util.js +61 -0
  47. package/es/ProTable/index.js +411 -0
  48. package/es/ProTable/proTableTypes.js +11 -0
  49. package/es/ProTable/style/index.css +65 -0
  50. package/es/ProTable/style/index.js +1 -0
  51. package/{src → es}/ProTable/style/index.less +92 -92
  52. package/es/Scrollbar/Bar.js +114 -0
  53. package/es/Scrollbar/Scrollbar.js +212 -0
  54. package/es/Scrollbar/Thumb.js +189 -0
  55. package/es/Scrollbar/constants.js +1 -0
  56. package/es/Scrollbar/index.js +2 -0
  57. package/es/Scrollbar/scrollbarProps.js +100 -0
  58. package/es/Scrollbar/thumbProps.js +10 -0
  59. package/es/Scrollbar/util.js +30 -0
  60. package/es/Search/Advanced/History.js +183 -0
  61. package/es/Search/Advanced/SaveHistory.js +153 -0
  62. package/es/Search/Advanced/index.js +520 -0
  63. package/es/Search/Item.js +497 -0
  64. package/es/Search/Search.js +249 -0
  65. package/es/Search/hooks/index.js +1 -0
  66. package/es/Search/hooks/useSearchItems.js +40 -0
  67. package/es/Search/index.js +4 -0
  68. package/es/Search/setting.js +91 -0
  69. package/es/Search/style/Item.less +33 -0
  70. package/es/Search/style/Search.less +179 -0
  71. package/es/Search/style/index.js +2 -0
  72. package/es/Search/typing.js +1 -0
  73. package/es/Search/util.js +234 -0
  74. package/es/ValueItem/ValueItem.js +233 -0
  75. package/es/ValueItem/index.js +2 -0
  76. package/es/ValueItem/util.js +16 -0
  77. package/es/index.js +24 -0
  78. package/es/style/index.js +3 -0
  79. package/es/style/variable.css +0 -0
  80. package/{src → es}/style/variable.less +2 -4
  81. package/es/style.js +5 -0
  82. package/lib/AMap/Map.js +125 -0
  83. package/lib/AMap/index.js +9 -0
  84. package/lib/AMap/util.js +62 -0
  85. package/lib/BadgeStatus/Badge.js +54 -0
  86. package/lib/BadgeStatus/color.js +27 -0
  87. package/lib/BadgeStatus/index.js +22 -0
  88. package/lib/CardSelect/CardSelect.js +123 -0
  89. package/lib/CardSelect/index.js +9 -0
  90. package/lib/CheckButton/CheckButton.js +120 -0
  91. package/lib/CheckButton/index.js +9 -0
  92. package/lib/CheckButton/style/index.css +37 -0
  93. package/lib/CheckButton/style/index.less +40 -0
  94. package/lib/ConfigProvider/context.js +19 -0
  95. package/lib/ConfigProvider/index.js +37 -0
  96. package/lib/Echarts/Echarts.js +47 -0
  97. package/lib/Echarts/index.js +9 -0
  98. package/lib/Ellipsis/Ellipsis.js +184 -0
  99. package/lib/Ellipsis/index.js +9 -0
  100. package/lib/Ellipsis/style/index.css +17 -0
  101. package/lib/Ellipsis/style/index.less +20 -0
  102. package/lib/Empty/Empty.js +56 -0
  103. package/lib/Empty/image.js +8 -0
  104. package/lib/Empty/index.js +9 -0
  105. package/lib/FullPage/FullPage.js +31 -0
  106. package/lib/FullPage/index.js +9 -0
  107. package/lib/Icon/icon.js +52 -0
  108. package/lib/Icon/index.js +9 -0
  109. package/lib/MonacoEditor/Monaco.js +238 -0
  110. package/lib/MonacoEditor/index.js +9 -0
  111. package/lib/PermissionButton/index.js +124 -0
  112. package/lib/ProLayout/Basic/BasicLayout.js +268 -0
  113. package/lib/ProLayout/Basic/BasicLayout.less +66 -0
  114. package/lib/ProLayout/Basic/Header.js +103 -0
  115. package/lib/ProLayout/Basic/Header.less +8 -0
  116. package/lib/ProLayout/PageContainer/index.js +327 -0
  117. package/lib/ProLayout/PageContainer/index.less +103 -0
  118. package/lib/ProLayout/PageContainer/typings.js +5 -0
  119. package/lib/ProLayout/RouteContext.js +28 -0
  120. package/lib/ProLayout/SiderMenu/BaseMenu.js +290 -0
  121. package/lib/ProLayout/SiderMenu/SiderMenu.js +287 -0
  122. package/lib/ProLayout/SiderMenu/index.js +20 -0
  123. package/lib/ProLayout/SiderMenu/index.less +212 -0
  124. package/lib/ProLayout/SiderMenu/typings.js +5 -0
  125. package/lib/ProLayout/TopHeader/index.js +168 -0
  126. package/lib/ProLayout/TopHeader/index.less +174 -0
  127. package/lib/ProLayout/defaultSettings.js +72 -0
  128. package/lib/ProLayout/index.js +16 -0
  129. package/lib/ProLayout/style/default.less +4 -0
  130. package/lib/ProLayout/style/index.js +3 -0
  131. package/lib/ProLayout/style/style.less +7 -0
  132. package/lib/ProLayout/typings.js +5 -0
  133. package/lib/ProLayout/util.js +72 -0
  134. package/lib/ProTable/index.js +417 -0
  135. package/lib/ProTable/proTableTypes.js +17 -0
  136. package/lib/ProTable/style/index.css +65 -0
  137. package/lib/ProTable/style/index.js +3 -0
  138. package/lib/ProTable/style/index.less +92 -0
  139. package/lib/Scrollbar/Bar.js +114 -0
  140. package/lib/Scrollbar/Scrollbar.js +212 -0
  141. package/lib/Scrollbar/Thumb.js +189 -0
  142. package/lib/Scrollbar/constants.js +7 -0
  143. package/lib/Scrollbar/index.js +9 -0
  144. package/{src/Scrollbar/scrollbar.ts → lib/Scrollbar/scrollbarProps.js} +106 -108
  145. package/lib/Scrollbar/thumbProps.js +16 -0
  146. package/lib/Scrollbar/util.js +37 -0
  147. package/lib/Search/Advanced/History.js +183 -0
  148. package/lib/Search/Advanced/SaveHistory.js +153 -0
  149. package/lib/Search/Advanced/index.js +520 -0
  150. package/lib/Search/Item.js +497 -0
  151. package/lib/Search/Search.js +249 -0
  152. package/lib/Search/hooks/index.js +16 -0
  153. package/lib/Search/hooks/useSearchItems.js +47 -0
  154. package/lib/Search/index.js +16 -0
  155. package/lib/Search/setting.js +97 -0
  156. package/lib/Search/style/Item.less +33 -0
  157. package/lib/Search/style/Search.less +179 -0
  158. package/lib/Search/style/index.js +4 -0
  159. package/lib/Search/typing.js +5 -0
  160. package/lib/Search/util.js +241 -0
  161. package/lib/ValueItem/ValueItem.js +233 -0
  162. package/lib/ValueItem/index.js +9 -0
  163. package/lib/ValueItem/util.js +22 -0
  164. package/lib/index.js +158 -0
  165. package/lib/style/components.less +3 -0
  166. package/lib/style/index.js +4 -0
  167. package/lib/style/variable.css +0 -0
  168. package/lib/style/variable.less +2 -0
  169. package/lib/style.js +7 -0
  170. package/package.json +123 -13
  171. package/index.ts +0 -64
  172. package/src/AMap/Map.vue +0 -110
  173. package/src/AMap/index.ts +0 -1
  174. package/src/AMap/util.ts +0 -56
  175. package/src/BadgeStatus/Badge.vue +0 -41
  176. package/src/BadgeStatus/color.ts +0 -25
  177. package/src/BadgeStatus/index.ts +0 -4
  178. package/src/CardSelect/CardSelect.vue +0 -136
  179. package/src/CardSelect/index.ts +0 -3
  180. package/src/CheckButton/CheckButton.vue +0 -146
  181. package/src/CheckButton/index.md +0 -27
  182. package/src/CheckButton/index.ts +0 -3
  183. package/src/ConfigProvider/context.ts +0 -17
  184. package/src/ConfigProvider/index.tsx +0 -42
  185. package/src/Echarts/Echarts.vue +0 -43
  186. package/src/Echarts/index.ts +0 -3
  187. package/src/Ellipsis/Ellipsis.vue +0 -182
  188. package/src/Ellipsis/index.ts +0 -3
  189. package/src/Empty/Empty.vue +0 -43
  190. package/src/Empty/image.ts +0 -3
  191. package/src/Empty/index.ts +0 -2
  192. package/src/FullPage/FullPage.vue +0 -30
  193. package/src/FullPage/index.ts +0 -3
  194. package/src/Icon/icon.tsx +0 -40
  195. package/src/MonacoEditor/Monaco.vue +0 -242
  196. package/src/MonacoEditor/index.md +0 -26
  197. package/src/MonacoEditor/index.ts +0 -2
  198. package/src/PermissionButton/index.tsx +0 -110
  199. package/src/ProLayout/Basic/BasicLayout.tsx +0 -392
  200. package/src/ProLayout/Basic/Header.tsx +0 -115
  201. package/src/ProLayout/PageContainer/index.tsx +0 -441
  202. package/src/ProLayout/PageContainer/typings.ts +0 -56
  203. package/src/ProLayout/RouteContext.ts +0 -87
  204. package/src/ProLayout/SiderMenu/BaseMenu.tsx +0 -296
  205. package/src/ProLayout/SiderMenu/SiderMenu.tsx +0 -320
  206. package/src/ProLayout/SiderMenu/index.ts +0 -2
  207. package/src/ProLayout/SiderMenu/typings.ts +0 -49
  208. package/src/ProLayout/TopHeader/index.tsx +0 -210
  209. package/src/ProLayout/defaultSettings.ts +0 -106
  210. package/src/ProLayout/style/index.ts +0 -1
  211. package/src/ProLayout/typings.ts +0 -87
  212. package/src/ProLayout/util.ts +0 -64
  213. package/src/ProTable/index.md +0 -53
  214. package/src/ProTable/index.tsx +0 -551
  215. package/src/ProTable/proTableTypes.ts +0 -70
  216. package/src/ProTable/style/index.ts +0 -1
  217. package/src/Scrollbar/Bar.vue +0 -75
  218. package/src/Scrollbar/Scrollbar.vue +0 -260
  219. package/src/Scrollbar/Thumb.vue +0 -163
  220. package/src/Scrollbar/constants.ts +0 -10
  221. package/src/Scrollbar/index.ts +0 -4
  222. package/src/Scrollbar/thumb.ts +0 -16
  223. package/src/Scrollbar/util.ts +0 -38
  224. package/src/Search/Advanced/History.vue +0 -140
  225. package/src/Search/Advanced/SaveHistory.vue +0 -108
  226. package/src/Search/Advanced/index.vue +0 -435
  227. package/src/Search/Item.vue +0 -525
  228. package/src/Search/Search.vue +0 -398
  229. package/src/Search/hooks/index.ts +0 -1
  230. package/src/Search/hooks/useSearchItems.ts +0 -68
  231. package/src/Search/index.md +0 -57
  232. package/src/Search/index.ts +0 -5
  233. package/src/Search/setting.ts +0 -55
  234. package/src/Search/typing.ts +0 -76
  235. package/src/Search/util.ts +0 -263
  236. package/src/ValueItem/ValueItem.vue +0 -192
  237. package/src/ValueItem/index.ts +0 -3
  238. package/src/ValueItem/util.ts +0 -16
  239. package/src/style/index.ts +0 -3
  240. /package/{src → es}/ProLayout/Basic/BasicLayout.less +0 -0
  241. /package/{src → es}/ProLayout/Basic/Header.less +0 -0
  242. /package/{src → es}/ProLayout/PageContainer/index.less +0 -0
  243. /package/{src → es}/ProLayout/SiderMenu/index.less +0 -0
  244. /package/{src → es}/ProLayout/TopHeader/index.less +0 -0
  245. /package/{src → es}/ProLayout/style/style.less +0 -0
@@ -0,0 +1,189 @@
1
+ function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) {
2
+ const op = ops[i];
3
+ const fn = ops[i + 1];
4
+ i += 2;
5
+ if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) {
6
+ return undefined;
7
+ }
8
+ if (op === 'access' || op === 'optionalAccess') {
9
+ lastAccessLHS = value;
10
+ value = fn(value);
11
+ }
12
+ else if (op === 'call' || op === 'optionalCall') {
13
+ value = fn((...args) => value.call(lastAccessLHS, ...args));
14
+ lastAccessLHS = undefined;
15
+ }
16
+ } return value; }
17
+ /* Analyzed bindings: {
18
+ "computed": "setup-const",
19
+ "inject": "setup-const",
20
+ "onBeforeUnmount": "setup-const",
21
+ "ref": "setup-const",
22
+ "toRef": "setup-const",
23
+ "useEventListener": "setup-maybe-ref",
24
+ "isClient": "setup-maybe-ref",
25
+ "scrollbarContextKey": "setup-maybe-ref",
26
+ "BAR_MAP": "setup-maybe-ref",
27
+ "renderThumbStyle": "setup-maybe-ref",
28
+ "thumbProps": "setup-maybe-ref",
29
+ "props": "setup-reactive-const",
30
+ "scrollbar": "setup-maybe-ref",
31
+ "instance": "setup-ref",
32
+ "thumb": "setup-ref",
33
+ "thumbState": "setup-ref",
34
+ "visible": "setup-ref",
35
+ "cursorDown": "setup-let",
36
+ "cursorLeave": "setup-let",
37
+ "originalOnSelectStart": "setup-let",
38
+ "bar": "setup-ref",
39
+ "thumbStyle": "setup-ref",
40
+ "offsetRatio": "setup-ref",
41
+ "clickThumbHandler": "setup-const",
42
+ "clickTrackHandler": "setup-const",
43
+ "startDrag": "setup-const",
44
+ "mouseMoveDocumentHandler": "setup-const",
45
+ "mouseUpDocumentHandler": "setup-const",
46
+ "mouseMoveScrollbarHandler": "setup-const",
47
+ "mouseLeaveScrollbarHandler": "setup-const",
48
+ "restoreOnselectstart": "setup-const"
49
+ } */
50
+ import { defineComponent as _defineComponent } from 'vue';
51
+ import { normalizeStyle as _normalizeStyle, createElementVNode as _createElementVNode, vShow as _vShow, normalizeClass as _normalizeClass, withDirectives as _withDirectives, Transition as _Transition, withCtx as _withCtx, openBlock as _openBlock, createBlock as _createBlock } from "vue";
52
+ import { computed, inject, onBeforeUnmount, ref, toRef } from 'vue';
53
+ import { useEventListener } from '@vueuse/core';
54
+ import { isClient } from '@jetlinks-web/utils';
55
+ import { scrollbarContextKey } from './constants';
56
+ import { BAR_MAP, renderThumbStyle } from './util';
57
+ import { thumbProps } from './thumbProps';
58
+ const __sfc_main__ = _defineComponent({
59
+ props: thumbProps,
60
+ setup(__props) {
61
+ const props = __props;
62
+ const scrollbar = inject(scrollbarContextKey);
63
+ if (!scrollbar)
64
+ throw new Error('can not inject scrollbar context');
65
+ const instance = ref();
66
+ const thumb = ref();
67
+ const thumbState = ref({});
68
+ const visible = ref(false);
69
+ let cursorDown = false;
70
+ let cursorLeave = false;
71
+ let originalOnSelectStart = isClient ? document.onselectstart : null;
72
+ const bar = computed(() => BAR_MAP[props.vertical ? 'vertical' : 'horizontal']);
73
+ const thumbStyle = computed(() => renderThumbStyle({
74
+ size: props.size,
75
+ move: props.move,
76
+ bar: bar.value,
77
+ }));
78
+ const offsetRatio = computed(() => instance.value[bar.value.offset] ** 2 /
79
+ scrollbar.wrapElement[bar.value.scrollSize] /
80
+ props.ratio /
81
+ Thumb.value[bar.value.offset]);
82
+ const clickThumbHandler = (e) => {
83
+ // prevent click event of middle and right button
84
+ e.stopPropagation();
85
+ if (e.ctrlKey || [1, 2].includes(e.button))
86
+ return;
87
+ _optionalChain([window, 'access', _2 => _2.getSelection, 'call', _3 => _3(), 'optionalAccess', _4 => _4.removeAllRanges, 'call', _5 => _5()]);
88
+ startDrag(e);
89
+ const el = e.currentTarget;
90
+ if (!el)
91
+ return;
92
+ thumbState.value[bar.value.axis] =
93
+ el[bar.value.offset] -
94
+ (e[bar.value.client] - el.getBoundingClientRect()[bar.value.direction]);
95
+ };
96
+ const clickTrackHandler = (e) => {
97
+ if (!Thumb.value || !instance.value || !scrollbar.wrapElement)
98
+ return;
99
+ const offset = Math.abs((e.target).getBoundingClientRect()[bar.value.direction] -
100
+ e[bar.value.client]);
101
+ const thumbHalf = Thumb.value[bar.value.offset] / 2;
102
+ const thumbPositionPercentage = ((offset - thumbHalf) * 100 * offsetRatio.value) /
103
+ instance.value[bar.value.offset];
104
+ scrollbar.wrapElement[bar.value.scroll] =
105
+ (thumbPositionPercentage * scrollbar.wrapElement[bar.value.scrollSize]) /
106
+ 100;
107
+ };
108
+ const startDrag = (e) => {
109
+ e.stopImmediatePropagation();
110
+ cursorDown = true;
111
+ document.addEventListener('mousemove', mouseMoveDocumentHandler);
112
+ document.addEventListener('mouseup', mouseUpDocumentHandler);
113
+ originalOnSelectStart = document.onselectstart;
114
+ document.onselectstart = () => false;
115
+ };
116
+ const mouseMoveDocumentHandler = (e) => {
117
+ if (!instance.value || !Thumb.value)
118
+ return;
119
+ if (cursorDown === false)
120
+ return;
121
+ const prevPage = thumbState.value[bar.value.axis];
122
+ if (!prevPage)
123
+ return;
124
+ const offset = (instance.value.getBoundingClientRect()[bar.value.direction] -
125
+ e[bar.value.client]) *
126
+ -1;
127
+ const thumbClickPosition = Thumb.value[bar.value.offset] - prevPage;
128
+ const thumbPositionPercentage = ((offset - thumbClickPosition) * 100 * offsetRatio.value) /
129
+ instance.value[bar.value.offset];
130
+ scrollbar.wrapElement[bar.value.scroll] =
131
+ (thumbPositionPercentage * scrollbar.wrapElement[bar.value.scrollSize]) /
132
+ 100;
133
+ };
134
+ const mouseUpDocumentHandler = () => {
135
+ cursorDown = false;
136
+ thumbState.value[bar.value.axis] = 0;
137
+ document.removeEventListener('mousemove', mouseMoveDocumentHandler);
138
+ document.removeEventListener('mouseup', mouseUpDocumentHandler);
139
+ restoreOnselectstart();
140
+ if (cursorLeave)
141
+ visible.value = false;
142
+ };
143
+ const mouseMoveScrollbarHandler = () => {
144
+ cursorLeave = false;
145
+ visible.value = !!props.size;
146
+ };
147
+ const mouseLeaveScrollbarHandler = () => {
148
+ cursorLeave = true;
149
+ visible.value = cursorDown;
150
+ };
151
+ onBeforeUnmount(() => {
152
+ restoreOnselectstart();
153
+ document.removeEventListener('mouseup', mouseUpDocumentHandler);
154
+ });
155
+ const restoreOnselectstart = () => {
156
+ if (document.onselectstart !== originalOnSelectStart)
157
+ document.onselectstart = originalOnSelectStart;
158
+ };
159
+ useEventListener(toRef(scrollbar, 'scrollbarElement'), 'mousemove', mouseMoveScrollbarHandler);
160
+ useEventListener(toRef(scrollbar, 'scrollbarElement'), 'mouseleave', mouseLeaveScrollbarHandler);
161
+ return (_ctx, _cache) => {
162
+ return (_openBlock(), _createBlock(_Transition, {
163
+ name: "j-scrollbar-fade",
164
+ persisted: ""
165
+ }, {
166
+ default: _withCtx(() => [
167
+ _withDirectives(_createElementVNode("div", {
168
+ ref_key: "instance",
169
+ ref: instance,
170
+ class: _normalizeClass(['j-scrollbar__bar', props.vertical ? 'is-vertical' : 'is-horizontal']),
171
+ onMousedown: clickTrackHandler
172
+ }, [
173
+ _createElementVNode("div", {
174
+ ref_key: "thumb",
175
+ ref: thumb,
176
+ class: "j-scrollbar__thumb",
177
+ style: _normalizeStyle(thumbStyle.value),
178
+ onMousedown: clickThumbHandler
179
+ }, null, 36 /* STYLE, NEED_HYDRATION */)
180
+ ], 34 /* CLASS, NEED_HYDRATION */), [
181
+ [_vShow, _ctx.always || visible.value]
182
+ ])
183
+ ]),
184
+ _: 1 /* STABLE */
185
+ }));
186
+ };
187
+ }
188
+ });
189
+ export default __sfc_main__;
@@ -0,0 +1 @@
1
+ export var scrollbarContextKey = Symbol('scrollbarContextKey');
@@ -0,0 +1,2 @@
1
+ import Scrollbar from './Scrollbar.js';
2
+ export default Scrollbar;
@@ -0,0 +1,100 @@
1
+ import { isNumber } from '@jetlinks-web/utils';
2
+ export var scrollbarProps = {
3
+ /**
4
+ * @description height of scrollbar
5
+ */
6
+ height: {
7
+ type: [String, Number],
8
+ default: ''
9
+ },
10
+ /**
11
+ * @description max height of scrollbar
12
+ */
13
+ maxHeight: {
14
+ type: [String, Number],
15
+ default: ''
16
+ },
17
+ /**
18
+ * @description whether to use the native scrollbar
19
+ */
20
+ native: {
21
+ type: Boolean,
22
+ default: false
23
+ },
24
+ /**
25
+ * @description style of wrap
26
+ */
27
+ wrapStyle: {
28
+ type: [String, Object, Array],
29
+ default: ''
30
+ },
31
+ /**
32
+ * @description class of wrap
33
+ */
34
+ wrapClass: {
35
+ type: [String, Array],
36
+ default: ''
37
+ },
38
+ /**
39
+ * @description class of view
40
+ */
41
+ viewClass: {
42
+ type: [String, Array],
43
+ default: ''
44
+ },
45
+ /**
46
+ * @description style of view
47
+ */
48
+ viewStyle: {
49
+ type: [String, Array, Object],
50
+ default: ''
51
+ },
52
+ /**
53
+ * @description do not respond to container size changes, if the container size does not change, it is better to set it to optimize performance
54
+ */
55
+ noresize: Boolean,
56
+ /**
57
+ * @description element tag of the view
58
+ */
59
+ tag: {
60
+ type: String,
61
+ default: 'div'
62
+ },
63
+ /**
64
+ * @description always show
65
+ */
66
+ always: Boolean,
67
+ /**
68
+ * @description minimum size of scrollbar
69
+ */
70
+ minSize: {
71
+ type: Number,
72
+ default: 20
73
+ },
74
+ /**
75
+ * @description id of view
76
+ */
77
+ id: String,
78
+ /**
79
+ * @description role of view
80
+ */
81
+ role: String,
82
+ /**
83
+ * @description aria-label of view
84
+ */
85
+ ariaLabel: String,
86
+ /**
87
+ * @description aria-orientation of view
88
+ */
89
+ ariaOrientation: {
90
+ type: String,
91
+ values: ['horizontal', 'vertical']
92
+ }
93
+ };
94
+ export var scrollbarEmits = {
95
+ scroll: function scroll(_ref) {
96
+ var scrollTop = _ref.scrollTop,
97
+ scrollLeft = _ref.scrollLeft;
98
+ return [scrollTop, scrollLeft].every(isNumber);
99
+ }
100
+ };
@@ -0,0 +1,10 @@
1
+ export var thumbProps = {
2
+ vertical: Boolean,
3
+ size: String,
4
+ move: Number,
5
+ ratio: {
6
+ type: Number,
7
+ required: true
8
+ },
9
+ always: Boolean
10
+ };
@@ -0,0 +1,30 @@
1
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
+ export var GAP = 4; // top 2 + bottom 2 of bar instance
3
+ export var BAR_MAP = {
4
+ vertical: {
5
+ offset: 'offsetHeight',
6
+ scroll: 'scrollTop',
7
+ scrollSize: 'scrollHeight',
8
+ size: 'height',
9
+ key: 'vertical',
10
+ axis: 'Y',
11
+ client: 'clientY',
12
+ direction: 'top'
13
+ },
14
+ horizontal: {
15
+ offset: 'offsetWidth',
16
+ scroll: 'scrollLeft',
17
+ scrollSize: 'scrollWidth',
18
+ size: 'width',
19
+ key: 'horizontal',
20
+ axis: 'X',
21
+ client: 'clientX',
22
+ direction: 'left'
23
+ }
24
+ };
25
+ export var renderThumbStyle = function renderThumbStyle(_ref) {
26
+ var move = _ref.move,
27
+ size = _ref.size,
28
+ bar = _ref.bar;
29
+ return _defineProperty(_defineProperty({}, bar.size, size), "transform", "translate".concat(bar.axis, "(").concat(move, "%)"));
30
+ };
@@ -0,0 +1,183 @@
1
+ /* Analyzed bindings: {
2
+ "target": "props",
3
+ "request": "props",
4
+ "deleteRequest": "props",
5
+ "deleteKey": "props",
6
+ "computed": "setup-const",
7
+ "ref": "setup-const",
8
+ "isFunction": "setup-maybe-ref",
9
+ "AIcon": "setup-maybe-ref",
10
+ "Empty": "setup-maybe-ref",
11
+ "Ellipsis": "setup-maybe-ref",
12
+ "Popconfirm": "setup-maybe-ref",
13
+ "Button": "setup-maybe-ref",
14
+ "FormItemRest": "setup-maybe-ref",
15
+ "Popover": "setup-maybe-ref",
16
+ "message": "setup-maybe-ref",
17
+ "emit": "setup-const",
18
+ "props": "setup-reactive-const",
19
+ "historyList": "setup-ref",
20
+ "historyVisible": "setup-ref",
21
+ "showEmpty": "setup-ref",
22
+ "showHistoryList": "setup-const",
23
+ "visibleChange": "setup-const",
24
+ "click": "setup-const",
25
+ "itemClick": "setup-const",
26
+ "deleteHistory": "setup-const"
27
+ } */
28
+ import { defineComponent as _defineComponent } from 'vue';
29
+ import { createTextVNode as _createTextVNode, unref as _unref, withCtx as _withCtx, createVNode as _createVNode, renderList as _renderList, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock, toDisplayString as _toDisplayString, createElementVNode as _createElementVNode, withModifiers as _withModifiers } from "vue";
30
+ const _hoisted_1 = { class: "search-history-warp" };
31
+ const _hoisted_2 = {
32
+ key: 0,
33
+ class: "search-history-items"
34
+ };
35
+ const _hoisted_3 = ["onClick"];
36
+ const _hoisted_4 = { class: "delete" };
37
+ const _hoisted_5 = {
38
+ key: 1,
39
+ class: "search-history-empty"
40
+ };
41
+ import { computed, ref } from 'vue';
42
+ import { isFunction } from 'lodash-es';
43
+ import { AIcon, Empty, Ellipsis } from '../../../';
44
+ import { Popconfirm, Button, FormItemRest, Popover, message } from 'ant-design-vue';
45
+ const __sfc_main__ = _defineComponent({
46
+ props: {
47
+ target: {
48
+ type: String,
49
+ default: '',
50
+ required: true,
51
+ },
52
+ request: {
53
+ type: Function,
54
+ default: null,
55
+ },
56
+ deleteRequest: {
57
+ type: Function,
58
+ default: null,
59
+ },
60
+ deleteKey: {
61
+ type: String,
62
+ default: 'key',
63
+ },
64
+ },
65
+ emits: ["click", "itemClick"],
66
+ setup(__props, { emit: __emit }) {
67
+ const emit = __emit;
68
+ const props = __props;
69
+ const historyList = ref([]);
70
+ const historyVisible = ref(false);
71
+ const showEmpty = computed(() => {
72
+ return historyList.value.length === 0;
73
+ });
74
+ const showHistoryList = async () => {
75
+ if (props.request) {
76
+ const resp = await props.request(props.target);
77
+ if (resp.success && resp.result.length) {
78
+ historyList.value = resp.result.filter((item) => item.content);
79
+ }
80
+ else {
81
+ historyList.value = [];
82
+ }
83
+ }
84
+ };
85
+ const visibleChange = async (v) => {
86
+ historyVisible.value = v;
87
+ };
88
+ const click = () => {
89
+ emit('click');
90
+ };
91
+ const itemClick = (content) => {
92
+ historyVisible.value = false;
93
+ emit('itemClick', content);
94
+ };
95
+ const deleteHistory = async (item) => {
96
+ if (props.deleteRequest && isFunction(props.deleteRequest)) {
97
+ const resp = await props.deleteRequest(props.target, item[props.deleteKey]);
98
+ historyVisible.value = false;
99
+ if (resp.success || resp.status === 200 || resp.code === 200) {
100
+ message.success('操作成功');
101
+ }
102
+ else {
103
+ message.error('操作失败');
104
+ }
105
+ }
106
+ };
107
+ return (_ctx, _cache) => {
108
+ return (_openBlock(), _createElementBlock("div", _hoisted_1, [
109
+ _createVNode(_unref(FormItemRest), null, {
110
+ default: _withCtx(() => [
111
+ _createVNode(_unref(Button), {
112
+ class: "search-history-button",
113
+ type: "primary",
114
+ "html-type": "submit"
115
+ }, {
116
+ default: _withCtx(() => [
117
+ _createTextVNode(" 搜索 ")
118
+ ]),
119
+ _: 1 /* STABLE */
120
+ })
121
+ ]),
122
+ _: 1 /* STABLE */
123
+ }),
124
+ _createVNode(_unref(Popover), {
125
+ placement: "bottom",
126
+ trigger: "click",
127
+ "overlay-class-name": "search-history-list-pop",
128
+ visible: historyVisible.value,
129
+ onVisibleChange: visibleChange
130
+ }, {
131
+ content: _withCtx(() => [
132
+ (!showEmpty.value)
133
+ ? (_openBlock(), _createElementBlock("div", _hoisted_2, [
134
+ (_openBlock(true), _createElementBlock(_Fragment, null, _renderList(historyList.value, (item) => {
135
+ return (_openBlock(), _createElementBlock("div", {
136
+ key: item.id,
137
+ class: "search-history-item"
138
+ }, [
139
+ _createElementVNode("div", {
140
+ class: "history-item--title",
141
+ onClick: ($event) => (itemClick(item.content))
142
+ }, [
143
+ _createVNode(_unref(Ellipsis), { style: { "width": "100%" } }, {
144
+ default: _withCtx(() => [
145
+ _createTextVNode(_toDisplayString(item.name), 1 /* TEXT */)
146
+ ]),
147
+ _: 2 /* DYNAMIC */
148
+ }, 1024 /* DYNAMIC_SLOTS */)
149
+ ], 8 /* PROPS */, _hoisted_3),
150
+ _createVNode(_unref(Popconfirm), {
151
+ title: "确认删除吗?",
152
+ placement: "top",
153
+ onConfirm: ($event) => (deleteHistory(item))
154
+ }, {
155
+ default: _withCtx(() => [
156
+ _createElementVNode("span", _hoisted_4, [
157
+ _createVNode(_unref(AIcon), { type: "DeleteOutlined" })
158
+ ])
159
+ ]),
160
+ _: 2 /* DYNAMIC */
161
+ }, 1032 /* PROPS, DYNAMIC_SLOTS */, ["onConfirm"])
162
+ ]));
163
+ }), 128 /* KEYED_FRAGMENT */))
164
+ ]))
165
+ : (_openBlock(), _createElementBlock("div", _hoisted_5, [
166
+ _createVNode(_unref(Empty))
167
+ ]))
168
+ ]),
169
+ default: _withCtx(() => [
170
+ _createElementVNode("div", {
171
+ class: "search-history-button-icon",
172
+ onClick: _withModifiers(showHistoryList, ["stop"])
173
+ }, [
174
+ _createVNode(_unref(AIcon), { type: "DownOutlined" })
175
+ ])
176
+ ]),
177
+ _: 1 /* STABLE */
178
+ }, 8 /* PROPS */, ["visible"])
179
+ ]));
180
+ };
181
+ }
182
+ });
183
+ export default __sfc_main__;
@@ -0,0 +1,153 @@
1
+ /* Analyzed bindings: {
2
+ "terms": "props",
3
+ "target": "props",
4
+ "request": "props",
5
+ "ref": "setup-const",
6
+ "reactive": "setup-const",
7
+ "Form": "setup-maybe-ref",
8
+ "Button": "setup-maybe-ref",
9
+ "FormItem": "setup-maybe-ref",
10
+ "Popover": "setup-maybe-ref",
11
+ "Textarea": "setup-maybe-ref",
12
+ "message": "setup-maybe-ref",
13
+ "isFunction": "setup-maybe-ref",
14
+ "props": "setup-reactive-const",
15
+ "saveHistoryLoading": "setup-ref",
16
+ "visible": "setup-ref",
17
+ "formRef": "setup-ref",
18
+ "modelRef": "setup-reactive-const",
19
+ "visibleChange": "setup-const",
20
+ "saveHistory": "setup-const"
21
+ } */
22
+ import { defineComponent as _defineComponent } from 'vue';
23
+ import { unref as _unref, createVNode as _createVNode, withCtx as _withCtx, createTextVNode as _createTextVNode, openBlock as _openBlock, createElementBlock as _createElementBlock, createCommentVNode as _createCommentVNode, createBlock as _createBlock, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from "vue";
24
+ const _withScopeId = n => (_pushScopeId("data-v-1712915948568"), n = n(), _popScopeId(), n);
25
+ const _hoisted_1 = {
26
+ key: 0,
27
+ style: { "width": "240px" }
28
+ };
29
+ import { ref, reactive } from 'vue';
30
+ import { Form, Button, FormItem, Popover, Textarea, message } from 'ant-design-vue';
31
+ import { isFunction } from 'lodash-es';
32
+ const __sfc_main__ = _defineComponent({
33
+ props: {
34
+ terms: {
35
+ type: Object,
36
+ default: () => ({}),
37
+ },
38
+ target: {
39
+ type: String,
40
+ default: '',
41
+ required: true,
42
+ },
43
+ request: {
44
+ type: Function,
45
+ default: null,
46
+ },
47
+ },
48
+ setup(__props) {
49
+ const props = __props;
50
+ const saveHistoryLoading = ref(false);
51
+ const visible = ref(false);
52
+ const formRef = ref();
53
+ const modelRef = reactive({
54
+ name: undefined,
55
+ });
56
+ const visibleChange = (e) => {
57
+ visible.value = e;
58
+ if (!e) {
59
+ setTimeout(() => {
60
+ modelRef.name = undefined;
61
+ }, 100);
62
+ }
63
+ };
64
+ /**
65
+ * 保存当前查询条件
66
+ */
67
+ const saveHistory = async () => {
68
+ // 获取当前查询条件并转化为字符串
69
+ const formData = await formRef.value.validate();
70
+ if (formData && props.request && isFunction(props.request)) {
71
+ formData.content = JSON.stringify(props.terms);
72
+ saveHistoryLoading.value = true;
73
+ const resp = await props.request(formData, props.target);
74
+ saveHistoryLoading.value = false;
75
+ if (resp.success || resp.status === 200 || resp.code === 200) {
76
+ message.success('操作成功');
77
+ visibleChange(false);
78
+ }
79
+ else {
80
+ message.error('操作失败');
81
+ }
82
+ }
83
+ };
84
+ return (_ctx, _cache) => {
85
+ return (_openBlock(), _createBlock(_unref(Popover), {
86
+ visible: visible.value,
87
+ "onUpdate:visible": _cache[1] || (_cache[1] = ($event) => ((visible).value = $event)),
88
+ title: "搜索名称",
89
+ trigger: "click",
90
+ placement: "bottom",
91
+ onVisibleChange: visibleChange
92
+ }, {
93
+ content: _withCtx(() => [
94
+ (visible.value)
95
+ ? (_openBlock(), _createElementBlock("div", _hoisted_1, [
96
+ _createVNode(_unref(Form), {
97
+ ref_key: "formRef",
98
+ ref: formRef,
99
+ model: modelRef
100
+ }, {
101
+ default: _withCtx(() => [
102
+ _createVNode(_unref(FormItem), {
103
+ name: "name",
104
+ rules: [
105
+ { required: true, message: '请输入名称' },
106
+ { max: 64, message: '最多64个字符' },
107
+ ]
108
+ }, {
109
+ default: _withCtx(() => [
110
+ _createVNode(_unref(Textarea), {
111
+ value: modelRef.name,
112
+ "onUpdate:value": _cache[0] || (_cache[0] = ($event) => ((modelRef.name) = $event)),
113
+ rows: 3,
114
+ maxlength: 200
115
+ }, null, 8 /* PROPS */, ["value"])
116
+ ]),
117
+ _: 1 /* STABLE */
118
+ })
119
+ ]),
120
+ _: 1 /* STABLE */
121
+ }, 8 /* PROPS */, ["model"]),
122
+ _createVNode(_unref(Button), {
123
+ loading: saveHistoryLoading.value,
124
+ type: "primary",
125
+ class: "save-btn",
126
+ style: { "width": "100%" },
127
+ onClick: saveHistory
128
+ }, {
129
+ default: _withCtx(() => [
130
+ _createTextVNode(" 保存 ")
131
+ ]),
132
+ _: 1 /* STABLE */
133
+ }, 8 /* PROPS */, ["loading"])
134
+ ]))
135
+ : _createCommentVNode("v-if", true)
136
+ ]),
137
+ default: _withCtx(() => [
138
+ _createVNode(_unref(Button), {
139
+ ghost: "",
140
+ type: "primary"
141
+ }, {
142
+ default: _withCtx(() => [
143
+ _createTextVNode(" 保存")
144
+ ]),
145
+ _: 1 /* STABLE */
146
+ })
147
+ ]),
148
+ _: 1 /* STABLE */
149
+ }, 8 /* PROPS */, ["visible"]));
150
+ };
151
+ }
152
+ });
153
+ export default __sfc_main__;