@jetlinks-web/components 2.0.2-4 → 2.0.2-5

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.
@@ -20,7 +20,7 @@
20
20
  } */
21
21
  import { defineComponent as _defineComponent } from 'vue';
22
22
  import { renderList as _renderList, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock, toDisplayString as _toDisplayString, normalizeClass as _normalizeClass, normalizeStyle as _normalizeStyle, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from "vue";
23
- const _withScopeId = n => (_pushScopeId("data-v-1712538744740"), n = n(), _popScopeId(), n);
23
+ const _withScopeId = n => (_pushScopeId("data-v-1712541385851"), n = n(), _popScopeId(), n);
24
24
  const _hoisted_1 = ["onClick"];
25
25
  import { computed, ref, watch } from 'vue';
26
26
  import { isArray } from '@jetlinks-web/utils';
@@ -6,7 +6,7 @@
6
6
  } */
7
7
  import { defineComponent as _defineComponent } from 'vue';
8
8
  import { unref as _unref, renderSlot as _renderSlot, createElementVNode as _createElementVNode, normalizeStyle as _normalizeStyle, openBlock as _openBlock, createElementBlock as _createElementBlock, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from "vue";
9
- const _withScopeId = n => (_pushScopeId("data-v-1712538745509"), n = n(), _popScopeId(), n);
9
+ const _withScopeId = n => (_pushScopeId("data-v-1712541386176"), n = n(), _popScopeId(), n);
10
10
  const _hoisted_1 = { class: "full-page-warp-content" };
11
11
  import { ref } from 'vue';
12
12
  import { useElementBounding } from '@vueuse/core';
@@ -1,100 +1,212 @@
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
- };
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
+ "nextTick": "setup-const",
20
+ "onMounted": "setup-const",
21
+ "onUpdated": "setup-const",
22
+ "provide": "setup-const",
23
+ "reactive": "setup-const",
24
+ "ref": "setup-const",
25
+ "watch": "setup-const",
26
+ "useEventListener": "setup-maybe-ref",
27
+ "useResizeObserver": "setup-maybe-ref",
28
+ "isNumber": "setup-maybe-ref",
29
+ "isObject": "setup-maybe-ref",
30
+ "Bar": "setup-const",
31
+ "scrollbarContextKey": "setup-maybe-ref",
32
+ "scrollbarEmits": "setup-maybe-ref",
33
+ "scrollbarProps": "setup-maybe-ref",
34
+ "BarInstance": "setup-maybe-ref",
35
+ "COMPONENT_NAME": "literal-const",
36
+ "props": "setup-reactive-const",
37
+ "emit": "setup-const",
38
+ "stopResizeObserver": "setup-let",
39
+ "stopResizeListener": "setup-let",
40
+ "scrollbarRef": "setup-ref",
41
+ "wrapRef": "setup-ref",
42
+ "resizeRef": "setup-ref",
43
+ "barRef": "setup-ref",
44
+ "wrapStyle": "setup-ref",
45
+ "wrapKls": "setup-ref",
46
+ "resizeKls": "setup-ref",
47
+ "handleScroll": "setup-const",
48
+ "scrollTo": "setup-const",
49
+ "setScrollTop": "setup-const",
50
+ "setScrollLeft": "setup-const",
51
+ "update": "setup-const"
52
+ } */
53
+ import { defineComponent as _defineComponent } from 'vue';
54
+ import { renderSlot as _renderSlot, resolveDynamicComponent as _resolveDynamicComponent, normalizeClass as _normalizeClass, withCtx as _withCtx, openBlock as _openBlock, createBlock as _createBlock, normalizeStyle as _normalizeStyle, createElementVNode as _createElementVNode, createCommentVNode as _createCommentVNode, createElementBlock as _createElementBlock } from "vue";
55
+ import { computed, nextTick, onMounted, onUpdated, provide, reactive, ref, watch, } from 'vue';
56
+ import { useEventListener, useResizeObserver } from '@vueuse/core';
57
+ import { isNumber, isObject } from '@jetlinks-web/utils';
58
+ import Bar from './Bar.js';
59
+ import { scrollbarContextKey } from './constants';
60
+ import { scrollbarEmits, scrollbarProps, } from './scrollbar';
61
+ const COMPONENT_NAME = 'JScrollbar';
62
+ const __sfc_main__ = _defineComponent({
63
+ ...{
64
+ name: COMPONENT_NAME,
65
+ },
66
+ props: scrollbarProps,
67
+ emits: scrollbarEmits,
68
+ setup(__props, { expose: __expose, emit: __emit }) {
69
+ const props = __props;
70
+ const emit = __emit;
71
+ let stopResizeObserver = undefined;
72
+ let stopResizeListener = undefined;
73
+ const scrollbarRef = ref();
74
+ const wrapRef = ref();
75
+ const resizeRef = ref();
76
+ const barRef = ref();
77
+ const wrapStyle = computed(() => {
78
+ const style = {};
79
+ if (props.height)
80
+ style.height = `${props.height}px`;
81
+ if (props.maxHeight)
82
+ style.maxHeight = `${props.maxHeight}px`;
83
+ return [props.wrapStyle, style];
84
+ });
85
+ const wrapKls = computed(() => {
86
+ return [
87
+ 'j-scrollbar__wrap',
88
+ 'j-scrollbar__wrap--hidden-default'
89
+ ];
90
+ });
91
+ const resizeKls = computed(() => {
92
+ return ['j-scrollbar__view', props.viewClass];
93
+ });
94
+ const handleScroll = () => {
95
+ if (wrapRef.value) {
96
+ _optionalChain([barRef, 'access', _2 => _2.value, 'optionalAccess', _3 => _3.handleScroll, 'call', _4 => _4(wrapRef.value)]);
97
+ emit('scroll', {
98
+ scrollTop: wrapRef.value.scrollTop,
99
+ scrollLeft: wrapRef.value.scrollLeft,
100
+ });
101
+ }
102
+ };
103
+ function scrollTo(arg1, arg2) {
104
+ if (isObject(arg1)) {
105
+ wrapRef.value.scrollTo(arg1);
106
+ }
107
+ else if (isNumber(arg1) && isNumber(arg2)) {
108
+ wrapRef.value.scrollTo(arg1, arg2);
109
+ }
110
+ }
111
+ const setScrollTop = (value) => {
112
+ if (!isNumber(value)) {
113
+ throw new Error('value must be a number');
114
+ }
115
+ wrapRef.value.scrollTop = value;
116
+ };
117
+ const setScrollLeft = (value) => {
118
+ if (!isNumber(value)) {
119
+ throw new Error(`[${COMPONENT_NAME}] value must be a number`);
120
+ }
121
+ wrapRef.value.scrollLeft = value;
122
+ };
123
+ const update = () => {
124
+ _optionalChain([barRef, 'access', _5 => _5.value, 'optionalAccess', _6 => _6.update, 'call', _7 => _7()]);
125
+ };
126
+ watch(() => props.noresize, (noResize) => {
127
+ if (noResize) {
128
+ _optionalChain([stopResizeObserver, 'optionalCall', _8 => _8()]);
129
+ _optionalChain([stopResizeListener, 'optionalCall', _9 => _9()]);
130
+ }
131
+ else {
132
+ ;
133
+ ({ stop: stopResizeObserver } = useResizeObserver(resizeRef, update));
134
+ stopResizeListener = useEventListener('resize', update);
135
+ }
136
+ }, { immediate: true });
137
+ watch(() => [props.maxHeight, props.height], () => {
138
+ if (!props.native)
139
+ nextTick(() => {
140
+ update();
141
+ if (wrapRef.value) {
142
+ _optionalChain([barRef, 'access', _10 => _10.value, 'optionalAccess', _11 => _11.handleScroll, 'call', _12 => _12(wrapRef.value)]);
143
+ }
144
+ });
145
+ });
146
+ provide(scrollbarContextKey, reactive({
147
+ scrollbarElement: scrollbarRef,
148
+ wrapElement: wrapRef,
149
+ }));
150
+ onMounted(() => {
151
+ if (!props.native)
152
+ nextTick(() => {
153
+ update();
154
+ });
155
+ });
156
+ onUpdated(() => update());
157
+ __expose({
158
+ /** @description scrollbar wrap ref */
159
+ wrapRef,
160
+ /** @description update scrollbar state manually */
161
+ update,
162
+ /** @description scrolls to a particular set of coordinates */
163
+ scrollTo,
164
+ /** @description set distance to scroll top */
165
+ setScrollTop,
166
+ /** @description set distance to scroll left */
167
+ setScrollLeft,
168
+ /** @description handle scroll event */
169
+ handleScroll,
170
+ });
171
+ return (_ctx, _cache) => {
172
+ return (_openBlock(), _createElementBlock("div", {
173
+ ref_key: "scrollbarRef",
174
+ ref: scrollbarRef,
175
+ class: "j-scrollbar"
176
+ }, [
177
+ _createElementVNode("div", {
178
+ ref_key: "wrapRef",
179
+ ref: wrapRef,
180
+ class: _normalizeClass(wrapKls.value),
181
+ style: _normalizeStyle(wrapStyle.value),
182
+ onScroll: handleScroll
183
+ }, [
184
+ (_openBlock(), _createBlock(_resolveDynamicComponent(_ctx.tag), {
185
+ id: _ctx.id,
186
+ ref_key: "resizeRef",
187
+ ref: resizeRef,
188
+ class: _normalizeClass(resizeKls.value),
189
+ role: _ctx.role,
190
+ "aria-label": _ctx.ariaLabel,
191
+ "aria-orientation": _ctx.ariaOrientation
192
+ }, {
193
+ default: _withCtx(() => [
194
+ _renderSlot(_ctx.$slots, "default")
195
+ ]),
196
+ _: 3 /* FORWARDED */
197
+ }, 8 /* PROPS */, ["id", "class", "role", "aria-label", "aria-orientation"]))
198
+ ], 38 /* CLASS, STYLE, NEED_HYDRATION */),
199
+ (!_ctx.native)
200
+ ? (_openBlock(), _createBlock(Bar, {
201
+ key: 0,
202
+ ref_key: "barRef",
203
+ ref: barRef,
204
+ always: _ctx.always,
205
+ "min-size": _ctx.minSize
206
+ }, null, 8 /* PROPS */, ["always", "min-size"]))
207
+ : _createCommentVNode("v-if", true)
208
+ ], 512 /* NEED_PATCH */));
209
+ };
210
+ }
211
+ });
212
+ export default __sfc_main__;
@@ -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
+ };
@@ -21,7 +21,7 @@
21
21
  } */
22
22
  import { defineComponent as _defineComponent } from 'vue';
23
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-1712538746514"), n = n(), _popScopeId(), n);
24
+ const _withScopeId = n => (_pushScopeId("data-v-1712541387577"), n = n(), _popScopeId(), n);
25
25
  const _hoisted_1 = {
26
26
  key: 0,
27
27
  style: { "width": "240px" }
package/es/Search/Item.js CHANGED
@@ -78,7 +78,7 @@ function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]
78
78
  } */
79
79
  import { defineComponent as _defineComponent } from 'vue';
80
80
  import { unref as _unref, openBlock as _openBlock, createBlock as _createBlock, createCommentVNode as _createCommentVNode, toDisplayString as _toDisplayString, createElementBlock as _createElementBlock, createVNode as _createVNode, Fragment as _Fragment, normalizeStyle as _normalizeStyle, mergeProps as _mergeProps, resolveDynamicComponent as _resolveDynamicComponent, withCtx as _withCtx, createElementVNode as _createElementVNode, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from "vue";
81
- const _withScopeId = n => (_pushScopeId("data-v-1712538746157"), n = n(), _popScopeId(), n);
81
+ const _withScopeId = n => (_pushScopeId("data-v-1712541387135"), n = n(), _popScopeId(), n);
82
82
  const _hoisted_1 = { class: "JSearch-item" };
83
83
  const _hoisted_2 = {
84
84
  key: 0,
@@ -36,7 +36,7 @@
36
36
  } */
37
37
  import { defineComponent as _defineComponent } from 'vue';
38
38
  import { renderList as _renderList, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock, createVNode as _createVNode, unref as _unref, withCtx as _withCtx, createBlock as _createBlock, renderSlot as _renderSlot, toDisplayString as _toDisplayString, createTextVNode as _createTextVNode, normalizeStyle as _normalizeStyle, createElementVNode as _createElementVNode, normalizeClass as _normalizeClass, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from "vue";
39
- const _withScopeId = n => (_pushScopeId("data-v-1712538746257"), n = n(), _popScopeId(), n);
39
+ const _withScopeId = n => (_pushScopeId("data-v-1712541387271"), n = n(), _popScopeId(), n);
40
40
  const _hoisted_1 = { class: "JSearch-content simple" };
41
41
  const _hoisted_2 = { class: "JSearch-items" };
42
42
  import { Button, Row, Col, Form, FormItemRest, } from 'ant-design-vue';
@@ -20,7 +20,7 @@
20
20
  } */
21
21
  import { defineComponent as _defineComponent } from 'vue';
22
22
  import { renderList as _renderList, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock, toDisplayString as _toDisplayString, normalizeClass as _normalizeClass, normalizeStyle as _normalizeStyle, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from "vue";
23
- const _withScopeId = n => (_pushScopeId("data-v-1712538744762"), n = n(), _popScopeId(), n);
23
+ const _withScopeId = n => (_pushScopeId("data-v-1712541385831"), n = n(), _popScopeId(), n);
24
24
  const _hoisted_1 = ["onClick"];
25
25
  import { computed, ref, watch } from 'vue';
26
26
  import { isArray } from '@jetlinks-web/utils';
@@ -6,7 +6,7 @@
6
6
  } */
7
7
  import { defineComponent as _defineComponent } from 'vue';
8
8
  import { unref as _unref, renderSlot as _renderSlot, createElementVNode as _createElementVNode, normalizeStyle as _normalizeStyle, openBlock as _openBlock, createElementBlock as _createElementBlock, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from "vue";
9
- const _withScopeId = n => (_pushScopeId("data-v-1712538745502"), n = n(), _popScopeId(), n);
9
+ const _withScopeId = n => (_pushScopeId("data-v-1712541386147"), n = n(), _popScopeId(), n);
10
10
  const _hoisted_1 = { class: "full-page-warp-content" };
11
11
  import { ref } from 'vue';
12
12
  import { useElementBounding } from '@vueuse/core';
@@ -1,106 +1,212 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
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
+ "nextTick": "setup-const",
20
+ "onMounted": "setup-const",
21
+ "onUpdated": "setup-const",
22
+ "provide": "setup-const",
23
+ "reactive": "setup-const",
24
+ "ref": "setup-const",
25
+ "watch": "setup-const",
26
+ "useEventListener": "setup-maybe-ref",
27
+ "useResizeObserver": "setup-maybe-ref",
28
+ "isNumber": "setup-maybe-ref",
29
+ "isObject": "setup-maybe-ref",
30
+ "Bar": "setup-const",
31
+ "scrollbarContextKey": "setup-maybe-ref",
32
+ "scrollbarEmits": "setup-maybe-ref",
33
+ "scrollbarProps": "setup-maybe-ref",
34
+ "BarInstance": "setup-maybe-ref",
35
+ "COMPONENT_NAME": "literal-const",
36
+ "props": "setup-reactive-const",
37
+ "emit": "setup-const",
38
+ "stopResizeObserver": "setup-let",
39
+ "stopResizeListener": "setup-let",
40
+ "scrollbarRef": "setup-ref",
41
+ "wrapRef": "setup-ref",
42
+ "resizeRef": "setup-ref",
43
+ "barRef": "setup-ref",
44
+ "wrapStyle": "setup-ref",
45
+ "wrapKls": "setup-ref",
46
+ "resizeKls": "setup-ref",
47
+ "handleScroll": "setup-const",
48
+ "scrollTo": "setup-const",
49
+ "setScrollTop": "setup-const",
50
+ "setScrollLeft": "setup-const",
51
+ "update": "setup-const"
52
+ } */
53
+ import { defineComponent as _defineComponent } from 'vue';
54
+ import { renderSlot as _renderSlot, resolveDynamicComponent as _resolveDynamicComponent, normalizeClass as _normalizeClass, withCtx as _withCtx, openBlock as _openBlock, createBlock as _createBlock, normalizeStyle as _normalizeStyle, createElementVNode as _createElementVNode, createCommentVNode as _createCommentVNode, createElementBlock as _createElementBlock } from "vue";
55
+ import { computed, nextTick, onMounted, onUpdated, provide, reactive, ref, watch, } from 'vue';
56
+ import { useEventListener, useResizeObserver } from '@vueuse/core';
57
+ import { isNumber, isObject } from '@jetlinks-web/utils';
58
+ import Bar from './Bar.js';
59
+ import { scrollbarContextKey } from './constants';
60
+ import { scrollbarEmits, scrollbarProps, } from './scrollbar';
61
+ const COMPONENT_NAME = 'JScrollbar';
62
+ const __sfc_main__ = _defineComponent({
63
+ ...{
64
+ name: COMPONENT_NAME,
65
+ },
66
+ props: scrollbarProps,
67
+ emits: scrollbarEmits,
68
+ setup(__props, { expose: __expose, emit: __emit }) {
69
+ const props = __props;
70
+ const emit = __emit;
71
+ let stopResizeObserver = undefined;
72
+ let stopResizeListener = undefined;
73
+ const scrollbarRef = ref();
74
+ const wrapRef = ref();
75
+ const resizeRef = ref();
76
+ const barRef = ref();
77
+ const wrapStyle = computed(() => {
78
+ const style = {};
79
+ if (props.height)
80
+ style.height = `${props.height}px`;
81
+ if (props.maxHeight)
82
+ style.maxHeight = `${props.maxHeight}px`;
83
+ return [props.wrapStyle, style];
84
+ });
85
+ const wrapKls = computed(() => {
86
+ return [
87
+ 'j-scrollbar__wrap',
88
+ 'j-scrollbar__wrap--hidden-default'
89
+ ];
90
+ });
91
+ const resizeKls = computed(() => {
92
+ return ['j-scrollbar__view', props.viewClass];
93
+ });
94
+ const handleScroll = () => {
95
+ if (wrapRef.value) {
96
+ _optionalChain([barRef, 'access', _2 => _2.value, 'optionalAccess', _3 => _3.handleScroll, 'call', _4 => _4(wrapRef.value)]);
97
+ emit('scroll', {
98
+ scrollTop: wrapRef.value.scrollTop,
99
+ scrollLeft: wrapRef.value.scrollLeft,
100
+ });
101
+ }
102
+ };
103
+ function scrollTo(arg1, arg2) {
104
+ if (isObject(arg1)) {
105
+ wrapRef.value.scrollTo(arg1);
106
+ }
107
+ else if (isNumber(arg1) && isNumber(arg2)) {
108
+ wrapRef.value.scrollTo(arg1, arg2);
109
+ }
110
+ }
111
+ const setScrollTop = (value) => {
112
+ if (!isNumber(value)) {
113
+ throw new Error('value must be a number');
114
+ }
115
+ wrapRef.value.scrollTop = value;
116
+ };
117
+ const setScrollLeft = (value) => {
118
+ if (!isNumber(value)) {
119
+ throw new Error(`[${COMPONENT_NAME}] value must be a number`);
120
+ }
121
+ wrapRef.value.scrollLeft = value;
122
+ };
123
+ const update = () => {
124
+ _optionalChain([barRef, 'access', _5 => _5.value, 'optionalAccess', _6 => _6.update, 'call', _7 => _7()]);
125
+ };
126
+ watch(() => props.noresize, (noResize) => {
127
+ if (noResize) {
128
+ _optionalChain([stopResizeObserver, 'optionalCall', _8 => _8()]);
129
+ _optionalChain([stopResizeListener, 'optionalCall', _9 => _9()]);
130
+ }
131
+ else {
132
+ ;
133
+ ({ stop: stopResizeObserver } = useResizeObserver(resizeRef, update));
134
+ stopResizeListener = useEventListener('resize', update);
135
+ }
136
+ }, { immediate: true });
137
+ watch(() => [props.maxHeight, props.height], () => {
138
+ if (!props.native)
139
+ nextTick(() => {
140
+ update();
141
+ if (wrapRef.value) {
142
+ _optionalChain([barRef, 'access', _10 => _10.value, 'optionalAccess', _11 => _11.handleScroll, 'call', _12 => _12(wrapRef.value)]);
143
+ }
144
+ });
145
+ });
146
+ provide(scrollbarContextKey, reactive({
147
+ scrollbarElement: scrollbarRef,
148
+ wrapElement: wrapRef,
149
+ }));
150
+ onMounted(() => {
151
+ if (!props.native)
152
+ nextTick(() => {
153
+ update();
154
+ });
155
+ });
156
+ onUpdated(() => update());
157
+ __expose({
158
+ /** @description scrollbar wrap ref */
159
+ wrapRef,
160
+ /** @description update scrollbar state manually */
161
+ update,
162
+ /** @description scrolls to a particular set of coordinates */
163
+ scrollTo,
164
+ /** @description set distance to scroll top */
165
+ setScrollTop,
166
+ /** @description set distance to scroll left */
167
+ setScrollLeft,
168
+ /** @description handle scroll event */
169
+ handleScroll,
170
+ });
171
+ return (_ctx, _cache) => {
172
+ return (_openBlock(), _createElementBlock("div", {
173
+ ref_key: "scrollbarRef",
174
+ ref: scrollbarRef,
175
+ class: "j-scrollbar"
176
+ }, [
177
+ _createElementVNode("div", {
178
+ ref_key: "wrapRef",
179
+ ref: wrapRef,
180
+ class: _normalizeClass(wrapKls.value),
181
+ style: _normalizeStyle(wrapStyle.value),
182
+ onScroll: handleScroll
183
+ }, [
184
+ (_openBlock(), _createBlock(_resolveDynamicComponent(_ctx.tag), {
185
+ id: _ctx.id,
186
+ ref_key: "resizeRef",
187
+ ref: resizeRef,
188
+ class: _normalizeClass(resizeKls.value),
189
+ role: _ctx.role,
190
+ "aria-label": _ctx.ariaLabel,
191
+ "aria-orientation": _ctx.ariaOrientation
192
+ }, {
193
+ default: _withCtx(() => [
194
+ _renderSlot(_ctx.$slots, "default")
195
+ ]),
196
+ _: 3 /* FORWARDED */
197
+ }, 8 /* PROPS */, ["id", "class", "role", "aria-label", "aria-orientation"]))
198
+ ], 38 /* CLASS, STYLE, NEED_HYDRATION */),
199
+ (!_ctx.native)
200
+ ? (_openBlock(), _createBlock(Bar, {
201
+ key: 0,
202
+ ref_key: "barRef",
203
+ ref: barRef,
204
+ always: _ctx.always,
205
+ "min-size": _ctx.minSize
206
+ }, null, 8 /* PROPS */, ["always", "min-size"]))
207
+ : _createCommentVNode("v-if", true)
208
+ ], 512 /* NEED_PATCH */));
209
+ };
210
+ }
5
211
  });
6
- exports.scrollbarProps = exports.scrollbarEmits = void 0;
7
- var _utils = require("@jetlinks-web/utils");
8
- var scrollbarProps = exports.scrollbarProps = {
9
- /**
10
- * @description height of scrollbar
11
- */
12
- height: {
13
- type: [String, Number],
14
- default: ''
15
- },
16
- /**
17
- * @description max height of scrollbar
18
- */
19
- maxHeight: {
20
- type: [String, Number],
21
- default: ''
22
- },
23
- /**
24
- * @description whether to use the native scrollbar
25
- */
26
- native: {
27
- type: Boolean,
28
- default: false
29
- },
30
- /**
31
- * @description style of wrap
32
- */
33
- wrapStyle: {
34
- type: [String, Object, Array],
35
- default: ''
36
- },
37
- /**
38
- * @description class of wrap
39
- */
40
- wrapClass: {
41
- type: [String, Array],
42
- default: ''
43
- },
44
- /**
45
- * @description class of view
46
- */
47
- viewClass: {
48
- type: [String, Array],
49
- default: ''
50
- },
51
- /**
52
- * @description style of view
53
- */
54
- viewStyle: {
55
- type: [String, Array, Object],
56
- default: ''
57
- },
58
- /**
59
- * @description do not respond to container size changes, if the container size does not change, it is better to set it to optimize performance
60
- */
61
- noresize: Boolean,
62
- /**
63
- * @description element tag of the view
64
- */
65
- tag: {
66
- type: String,
67
- default: 'div'
68
- },
69
- /**
70
- * @description always show
71
- */
72
- always: Boolean,
73
- /**
74
- * @description minimum size of scrollbar
75
- */
76
- minSize: {
77
- type: Number,
78
- default: 20
79
- },
80
- /**
81
- * @description id of view
82
- */
83
- id: String,
84
- /**
85
- * @description role of view
86
- */
87
- role: String,
88
- /**
89
- * @description aria-label of view
90
- */
91
- ariaLabel: String,
92
- /**
93
- * @description aria-orientation of view
94
- */
95
- ariaOrientation: {
96
- type: String,
97
- values: ['horizontal', 'vertical']
98
- }
99
- };
100
- var scrollbarEmits = exports.scrollbarEmits = {
101
- scroll: function scroll(_ref) {
102
- var scrollTop = _ref.scrollTop,
103
- scrollLeft = _ref.scrollLeft;
104
- return [scrollTop, scrollLeft].every(_utils.isNumber);
105
- }
106
- };
212
+ export default __sfc_main__;
@@ -0,0 +1,106 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.scrollbarProps = exports.scrollbarEmits = void 0;
7
+ var _utils = require("@jetlinks-web/utils");
8
+ var scrollbarProps = exports.scrollbarProps = {
9
+ /**
10
+ * @description height of scrollbar
11
+ */
12
+ height: {
13
+ type: [String, Number],
14
+ default: ''
15
+ },
16
+ /**
17
+ * @description max height of scrollbar
18
+ */
19
+ maxHeight: {
20
+ type: [String, Number],
21
+ default: ''
22
+ },
23
+ /**
24
+ * @description whether to use the native scrollbar
25
+ */
26
+ native: {
27
+ type: Boolean,
28
+ default: false
29
+ },
30
+ /**
31
+ * @description style of wrap
32
+ */
33
+ wrapStyle: {
34
+ type: [String, Object, Array],
35
+ default: ''
36
+ },
37
+ /**
38
+ * @description class of wrap
39
+ */
40
+ wrapClass: {
41
+ type: [String, Array],
42
+ default: ''
43
+ },
44
+ /**
45
+ * @description class of view
46
+ */
47
+ viewClass: {
48
+ type: [String, Array],
49
+ default: ''
50
+ },
51
+ /**
52
+ * @description style of view
53
+ */
54
+ viewStyle: {
55
+ type: [String, Array, Object],
56
+ default: ''
57
+ },
58
+ /**
59
+ * @description do not respond to container size changes, if the container size does not change, it is better to set it to optimize performance
60
+ */
61
+ noresize: Boolean,
62
+ /**
63
+ * @description element tag of the view
64
+ */
65
+ tag: {
66
+ type: String,
67
+ default: 'div'
68
+ },
69
+ /**
70
+ * @description always show
71
+ */
72
+ always: Boolean,
73
+ /**
74
+ * @description minimum size of scrollbar
75
+ */
76
+ minSize: {
77
+ type: Number,
78
+ default: 20
79
+ },
80
+ /**
81
+ * @description id of view
82
+ */
83
+ id: String,
84
+ /**
85
+ * @description role of view
86
+ */
87
+ role: String,
88
+ /**
89
+ * @description aria-label of view
90
+ */
91
+ ariaLabel: String,
92
+ /**
93
+ * @description aria-orientation of view
94
+ */
95
+ ariaOrientation: {
96
+ type: String,
97
+ values: ['horizontal', 'vertical']
98
+ }
99
+ };
100
+ var scrollbarEmits = exports.scrollbarEmits = {
101
+ scroll: function scroll(_ref) {
102
+ var scrollTop = _ref.scrollTop,
103
+ scrollLeft = _ref.scrollLeft;
104
+ return [scrollTop, scrollLeft].every(_utils.isNumber);
105
+ }
106
+ };
@@ -21,7 +21,7 @@
21
21
  } */
22
22
  import { defineComponent as _defineComponent } from 'vue';
23
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-1712538746499"), n = n(), _popScopeId(), n);
24
+ const _withScopeId = n => (_pushScopeId("data-v-1712541387551"), n = n(), _popScopeId(), n);
25
25
  const _hoisted_1 = {
26
26
  key: 0,
27
27
  style: { "width": "240px" }
@@ -78,7 +78,7 @@ function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]
78
78
  } */
79
79
  import { defineComponent as _defineComponent } from 'vue';
80
80
  import { unref as _unref, openBlock as _openBlock, createBlock as _createBlock, createCommentVNode as _createCommentVNode, toDisplayString as _toDisplayString, createElementBlock as _createElementBlock, createVNode as _createVNode, Fragment as _Fragment, normalizeStyle as _normalizeStyle, mergeProps as _mergeProps, resolveDynamicComponent as _resolveDynamicComponent, withCtx as _withCtx, createElementVNode as _createElementVNode, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from "vue";
81
- const _withScopeId = n => (_pushScopeId("data-v-1712538746083"), n = n(), _popScopeId(), n);
81
+ const _withScopeId = n => (_pushScopeId("data-v-1712541387063"), n = n(), _popScopeId(), n);
82
82
  const _hoisted_1 = { class: "JSearch-item" };
83
83
  const _hoisted_2 = {
84
84
  key: 0,
@@ -36,7 +36,7 @@
36
36
  } */
37
37
  import { defineComponent as _defineComponent } from 'vue';
38
38
  import { renderList as _renderList, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock, createVNode as _createVNode, unref as _unref, withCtx as _withCtx, createBlock as _createBlock, renderSlot as _renderSlot, toDisplayString as _toDisplayString, createTextVNode as _createTextVNode, normalizeStyle as _normalizeStyle, createElementVNode as _createElementVNode, normalizeClass as _normalizeClass, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from "vue";
39
- const _withScopeId = n => (_pushScopeId("data-v-1712538746229"), n = n(), _popScopeId(), n);
39
+ const _withScopeId = n => (_pushScopeId("data-v-1712541387211"), n = n(), _popScopeId(), n);
40
40
  const _hoisted_1 = { class: "JSearch-content simple" };
41
41
  const _hoisted_2 = { class: "JSearch-items" };
42
42
  import { Button, Row, Col, Form, FormItemRest, } from 'ant-design-vue';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetlinks-web/components",
3
- "version": "2.0.2-4",
3
+ "version": "2.0.2-5",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -15,7 +15,7 @@
15
15
  "dependencies": {
16
16
  "@ant-design/icons-vue": "^7.0.1",
17
17
  "@vuemap/vue-amap": "^2.0.17",
18
- "@vueuse/core": "^9.12.0",
18
+ "@vueuse/core": "^10.2.1",
19
19
  "@vueuse/router": "^10.9.0",
20
20
  "ant-design-vue": "3.2.20",
21
21
  "echarts": "^5.4.3",