@meethive/components 0.0.12 → 0.0.13

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.
@@ -1,12 +1,22 @@
1
- import { defineComponent, ref, useSlots, computed, onMounted, watch } from 'vue';
1
+ import { defineComponent as _defineComponent } from 'vue';
2
+ import { unref as _unref, toDisplayString as _toDisplayString, createElementVNode as _createElementVNode, resolveComponent as _resolveComponent, createVNode as _createVNode, withModifiers as _withModifiers, withCtx as _withCtx, openBlock as _openBlock, createElementBlock as _createElementBlock, createCommentVNode as _createCommentVNode, renderSlot as _renderSlot, normalizeStyle as _normalizeStyle, createTextVNode as _createTextVNode, Transition as _Transition, normalizeClass as _normalizeClass } from "vue";
3
+ const _hoisted_1 = {
4
+ key: 0,
5
+ class: "header"
6
+ };
7
+ const _hoisted_2 = {
8
+ key: 1,
9
+ class: "jetlinks-drag-modal-footer"
10
+ };
11
+ import { ref, useSlots, computed, onMounted, watch } from 'vue';
2
12
  import { Button } from 'ant-design-vue';
3
13
  import { useLocaleReceiver } from '../LocaleReciver/index';
4
14
  import genDragModalStyle from './style';
5
- export default defineComponent({
6
- name: 'JDragModal',
7
- components: {
8
- Button
15
+ const __sfc_main__ = _defineComponent({
16
+ ...{
17
+ name: 'JDragModal'
9
18
  },
19
+ __name: 'DragModal',
10
20
  props: {
11
21
  title: {
12
22
  type: [String, Boolean],
@@ -34,9 +44,11 @@ export default defineComponent({
34
44
  }
35
45
  },
36
46
  emits: ['cancel', 'heightChange', 'ok', 'visibleChange'],
37
- setup(props, {
38
- emit
47
+ setup(__props, {
48
+ emit: __emit
39
49
  }) {
50
+ const props = __props;
51
+ const emits = __emit;
40
52
  const slots = useSlots();
41
53
  const [contextLocale] = useLocaleReceiver('DragModal');
42
54
  const ele = document.body;
@@ -149,18 +161,18 @@ export default defineComponent({
149
161
  }
150
162
  const height = baseHeight.value + calc;
151
163
  baseHeight.value = height <= props.dragRang[1] ? props.dragRang[1] : height;
152
- emit('heightChange', baseHeight.value);
164
+ emits('heightChange', baseHeight.value);
153
165
  }
154
166
  };
155
167
  handleClear();
156
168
  };
157
169
  const onCancel = () => {
158
- emit('cancel');
159
- emit('visibleChange', false);
170
+ emits('cancel');
171
+ emits('visibleChange', false);
160
172
  };
161
173
  const onOk = () => {
162
- emit('ok');
163
- emit('visibleChange', true);
174
+ emits('ok');
175
+ emits('visibleChange', true);
164
176
  };
165
177
  onMounted(() => {
166
178
  if (dialog.value && header.value) {
@@ -177,15 +189,55 @@ export default defineComponent({
177
189
  baseHeight.value = props.height;
178
190
  }
179
191
  });
180
- return {
181
- dialog,
182
- header,
183
- styles,
184
- hashId,
185
- contextLocale,
186
- rangeMove,
187
- onCancel,
188
- onOk
192
+ return (_ctx, _cache) => {
193
+ const _component_AIcon = _resolveComponent("AIcon");
194
+ const _component_a_button = _resolveComponent("a-button");
195
+ const _component_a_space = _resolveComponent("a-space");
196
+ return _openBlock(), _createElementBlock("div", {
197
+ ref_key: "dialog",
198
+ ref: dialog,
199
+ style: _normalizeStyle(styles.value),
200
+ class: _normalizeClass(['jetlinks-drag-modal', _unref(hashId)])
201
+ }, [_createVNode(_Transition, {
202
+ name: "dialog"
203
+ }, {
204
+ default: _withCtx(() => [_createElementVNode("div", {
205
+ class: "jetlinks-drag-modal-sprite",
206
+ ref_key: "header",
207
+ ref: header
208
+ }, [__props.title !== false ? (_openBlock(), _createElementBlock("div", _hoisted_1, [_createElementVNode("span", null, _toDisplayString(__props.title), 1 /* TEXT */), _createVNode(_component_a_button, {
209
+ size: "small",
210
+ type: "text",
211
+ onClick: _withModifiers(onCancel, ["stop"])
212
+ }, {
213
+ default: _withCtx(() => [_createVNode(_component_AIcon, {
214
+ type: "CloseOutlined"
215
+ })]),
216
+ _: 1 /* STABLE */
217
+ })])) : _createCommentVNode("v-if", true), _createElementVNode("div", {
218
+ class: "jetlinks-drag-modal-body",
219
+ style: _normalizeStyle(__props.bodyStyle)
220
+ }, [_renderSlot(_ctx.$slots, "default")], 4 /* STYLE */), __props.footer !== false ? (_openBlock(), _createElementBlock("div", _hoisted_2, [_renderSlot(_ctx.$slots, "footer", {}, () => [_createVNode(_component_a_space, null, {
221
+ default: _withCtx(() => [_createVNode(_unref(Button), {
222
+ onClick: _withModifiers(onCancel, ["stop"])
223
+ }, {
224
+ default: _withCtx(() => [_createTextVNode(_toDisplayString(_unref(contextLocale).cancel), 1 /* TEXT */)]),
225
+ _: 1 /* STABLE */
226
+ }), _createVNode(_unref(Button), {
227
+ type: "primary",
228
+ onClick: _withModifiers(onOk, ["stop"])
229
+ }, {
230
+ default: _withCtx(() => [_createTextVNode(_toDisplayString(_unref(contextLocale).confirm), 1 /* TEXT */)]),
231
+ _: 1 /* STABLE */
232
+ })]),
233
+ _: 1 /* STABLE */
234
+ })])])) : _createCommentVNode("v-if", true)], 512 /* NEED_PATCH */)]),
235
+ _: 3 /* FORWARDED */
236
+ }), _createElementVNode("div", {
237
+ class: _normalizeClass(['jetlinks-drag-modal-range', 'drag-bottom-right']),
238
+ onMousedown: _cache[0] || (_cache[0] = _withModifiers($event => rangeMove($event, 'drag-bottom-right'), ["stop"]))
239
+ }, null, 32 /* NEED_HYDRATION */)], 6 /* CLASS, STYLE */);
189
240
  };
190
241
  }
191
- });
242
+ });
243
+ export default __sfc_main__;
@@ -1,12 +1,14 @@
1
- import { defineComponent, inject, ref } from 'vue';
1
+ import { defineComponent as _defineComponent } from 'vue';
2
+ import { createVNode as _createVNode, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock } from "vue";
3
+ import { inject, ref } from 'vue';
2
4
  import { GAP } from './util';
3
5
  import Thumb from './Thumb.js';
4
6
  import { scrollbarContextKey } from './constants';
5
- export default defineComponent({
6
- name: 'ScrollbarBar',
7
- components: {
8
- Thumb
7
+ const __sfc_main__ = _defineComponent({
8
+ ...{
9
+ name: 'ScrollbarBar'
9
10
  },
11
+ __name: 'Bar',
10
12
  props: {
11
13
  always: {
12
14
  type: Boolean,
@@ -17,9 +19,10 @@ export default defineComponent({
17
19
  required: true
18
20
  }
19
21
  },
20
- setup(props, {
21
- expose
22
+ setup(__props, {
23
+ expose: __expose
22
24
  }) {
25
+ const props = __props;
23
26
  const scrollbar = inject(scrollbarContextKey);
24
27
  const moveX = ref(0);
25
28
  const moveY = ref(0);
@@ -49,17 +52,24 @@ export default defineComponent({
49
52
  sizeHeight.value = height + GAP < offsetHeight ? `${height}px` : '';
50
53
  sizeWidth.value = width + GAP < offsetWidth ? `${width}px` : '';
51
54
  };
52
- expose({
55
+ __expose({
53
56
  handleScroll,
54
57
  update
55
58
  });
56
- return {
57
- moveX,
58
- moveY,
59
- sizeWidth,
60
- sizeHeight,
61
- ratioY,
62
- ratioX
59
+ return (_ctx, _cache) => {
60
+ return _openBlock(), _createElementBlock(_Fragment, null, [_createVNode(Thumb, {
61
+ move: moveX.value,
62
+ ratio: ratioX.value,
63
+ size: sizeWidth.value,
64
+ always: __props.always
65
+ }, null, 8 /* PROPS */, ["move", "ratio", "size", "always"]), _createVNode(Thumb, {
66
+ move: moveY.value,
67
+ ratio: ratioY.value,
68
+ size: sizeHeight.value,
69
+ vertical: "",
70
+ always: __props.always
71
+ }, null, 8 /* PROPS */, ["move", "ratio", "size", "always"])], 64 /* STABLE_FRAGMENT */);
63
72
  };
64
73
  }
65
- });
74
+ });
75
+ export default __sfc_main__;
@@ -1,4 +1,6 @@
1
- import { defineComponent, computed, nextTick, onMounted, onUpdated, provide, reactive, ref, watch } from 'vue';
1
+ import { defineComponent as _defineComponent } from 'vue';
2
+ import { unref as _unref, 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";
3
+ import { computed, nextTick, onMounted, onUpdated, provide, reactive, ref, watch } from 'vue';
2
4
  import { useEventListener, useResizeObserver } from '@vueuse/core';
3
5
  import { isNumber, isObject } from '@meethive/utils';
4
6
  import Bar from './Bar.js';
@@ -6,17 +8,19 @@ import { scrollbarContextKey } from './constants';
6
8
  import { scrollbarEmits, scrollbarProps } from './scrollbarProps';
7
9
  import useScrollbarStyle from './style';
8
10
  const COMPONENT_NAME = 'JScrollbar';
9
- export default defineComponent({
10
- name: COMPONENT_NAME,
11
- components: {
12
- Bar
11
+ const __sfc_main__ = _defineComponent({
12
+ ...{
13
+ name: COMPONENT_NAME
13
14
  },
15
+ __name: 'Scrollbar',
14
16
  props: scrollbarProps,
15
17
  emits: scrollbarEmits,
16
- setup(props, {
17
- expose,
18
- emit
18
+ setup(__props, {
19
+ expose: __expose,
20
+ emit: __emit
19
21
  }) {
22
+ const props = __props;
23
+ const emit = __emit;
20
24
  const prefixCls = computed(() => 'j-scrollbar');
21
25
  const [wrapSSR, hashId] = useScrollbarStyle(prefixCls);
22
26
  let stopResizeObserver = undefined;
@@ -100,7 +104,7 @@ export default defineComponent({
100
104
  });
101
105
  });
102
106
  onUpdated(() => update());
103
- expose({
107
+ __expose({
104
108
  /** @description scrollbar wrap ref */
105
109
  wrapRef,
106
110
  /** @description update scrollbar state manually */
@@ -114,16 +118,36 @@ export default defineComponent({
114
118
  /** @description handle scroll event */
115
119
  handleScroll
116
120
  });
117
- return {
118
- hashId,
119
- scrollbarRef,
120
- wrapRef,
121
- resizeRef,
122
- barRef,
123
- wrapStyle,
124
- wrapKls,
125
- resizeKls,
126
- handleScroll
121
+ return (_ctx, _cache) => {
122
+ return _openBlock(), _createElementBlock("div", {
123
+ ref_key: "scrollbarRef",
124
+ ref: scrollbarRef,
125
+ class: _normalizeClass(['j-scrollbar', _unref(hashId)])
126
+ }, [_createElementVNode("div", {
127
+ ref_key: "wrapRef",
128
+ ref: wrapRef,
129
+ class: _normalizeClass(wrapKls.value),
130
+ style: _normalizeStyle(wrapStyle.value),
131
+ onScroll: handleScroll
132
+ }, [(_openBlock(), _createBlock(_resolveDynamicComponent(_ctx.tag), {
133
+ id: _ctx.id,
134
+ ref_key: "resizeRef",
135
+ ref: resizeRef,
136
+ class: _normalizeClass(resizeKls.value),
137
+ role: _ctx.role,
138
+ "aria-label": _ctx.ariaLabel,
139
+ "aria-orientation": _ctx.ariaOrientation
140
+ }, {
141
+ default: _withCtx(() => [_renderSlot(_ctx.$slots, "default")]),
142
+ _: 3 /* FORWARDED */
143
+ }, 8 /* PROPS */, ["id", "class", "role", "aria-label", "aria-orientation"]))], 38 /* CLASS, STYLE, NEED_HYDRATION */), !_ctx.native ? (_openBlock(), _createBlock(Bar, {
144
+ key: 0,
145
+ ref_key: "barRef",
146
+ ref: barRef,
147
+ always: _ctx.always,
148
+ "min-size": _ctx.minSize
149
+ }, null, 8 /* PROPS */, ["always", "min-size"])) : _createCommentVNode("v-if", true)], 2 /* CLASS */);
127
150
  };
128
151
  }
129
- });
152
+ });
153
+ export default __sfc_main__;
@@ -1,14 +1,20 @@
1
- import { defineComponent, computed, inject, onBeforeUnmount, ref, toRef } from 'vue';
1
+ import { defineComponent as _defineComponent } from 'vue';
2
+ import { unref as _unref, normalizeStyle as _normalizeStyle, createElementVNode as _createElementVNode, vShow as _vShow, normalizeClass as _normalizeClass, withDirectives as _withDirectives, Transition as _Transition, withCtx as _withCtx, createVNode as _createVNode, openBlock as _openBlock, createElementBlock as _createElementBlock } from "vue";
3
+ import { computed, inject, onBeforeUnmount, ref, toRef } from 'vue';
2
4
  import { useEventListener } from '@vueuse/core';
3
5
  import { isClient } from '@meethive/utils';
4
6
  import { scrollbarContextKey } from './constants';
5
7
  import { BAR_MAP, renderThumbStyle } from './util';
6
8
  import { thumbProps } from './thumbProps';
7
9
  import useScrollbarStyle from './style';
8
- export default defineComponent({
9
- name: 'ScrollbarThumb',
10
+ const __sfc_main__ = _defineComponent({
11
+ ...{
12
+ name: 'ScrollbarThumb'
13
+ },
14
+ __name: 'Thumb',
10
15
  props: thumbProps,
11
- setup(props) {
16
+ setup(__props) {
17
+ const props = __props;
12
18
  const scrollbar = inject(scrollbarContextKey);
13
19
  if (!scrollbar) throw new Error('can not inject scrollbar context');
14
20
  const instance = ref();
@@ -87,15 +93,28 @@ export default defineComponent({
87
93
  };
88
94
  useEventListener(toRef(scrollbar, 'scrollbarElement'), 'mousemove', mouseMoveScrollbarHandler);
89
95
  useEventListener(toRef(scrollbar, 'scrollbarElement'), 'mouseleave', mouseLeaveScrollbarHandler);
90
- return {
91
- props,
92
- instance,
93
- thumb,
94
- visible,
95
- hashId,
96
- thumbStyle,
97
- clickThumbHandler,
98
- clickTrackHandler
96
+ return (_ctx, _cache) => {
97
+ return _openBlock(), _createElementBlock("div", {
98
+ class: _normalizeClass([_unref(hashId)])
99
+ }, [_createVNode(_Transition, {
100
+ name: "j-scrollbar-fade",
101
+ persisted: ""
102
+ }, {
103
+ default: _withCtx(() => [_withDirectives(_createElementVNode("div", {
104
+ ref_key: "instance",
105
+ ref: instance,
106
+ class: _normalizeClass(['j-scrollbar__bar', props.vertical ? 'is-vertical' : 'is-horizontal']),
107
+ onMousedown: clickTrackHandler
108
+ }, [_createElementVNode("div", {
109
+ ref_key: "thumb",
110
+ ref: thumb,
111
+ class: "j-scrollbar__thumb",
112
+ style: _normalizeStyle(thumbStyle.value),
113
+ onMousedown: clickThumbHandler
114
+ }, null, 36 /* STYLE, NEED_HYDRATION */)], 34 /* CLASS, NEED_HYDRATION */), [[_vShow, _ctx.always || visible.value]])]),
115
+ _: 1 /* STABLE */
116
+ })], 2 /* CLASS */);
99
117
  };
100
118
  }
101
- });
119
+ });
120
+ export default __sfc_main__;
@@ -1,4 +1,14 @@
1
- import { defineComponent, computed, ref, watch, onMounted, nextTick, h } from 'vue';
1
+ import { defineComponent as _defineComponent } from 'vue';
2
+ import { unref as _unref, openBlock as _openBlock, createBlock as _createBlock, createCommentVNode as _createCommentVNode, toDisplayString as _toDisplayString, createElementVNode as _createElementVNode, createElementBlock as _createElementBlock, renderSlot as _renderSlot, createTextVNode as _createTextVNode, withCtx as _withCtx, createVNode as _createVNode, normalizeStyle as _normalizeStyle, Fragment as _Fragment, normalizeClass as _normalizeClass } from "vue";
3
+ const _hoisted_1 = {
4
+ class: "virtual-table-header"
5
+ };
6
+ const _hoisted_2 = {
7
+ key: 0,
8
+ class: "virtual-table-all-selected"
9
+ };
10
+ const _hoisted_3 = ["onClick"];
11
+ import { computed, ref, watch, onMounted, nextTick, h } from 'vue';
2
12
  import { Table, Checkbox } from 'ant-design-vue';
3
13
  import { isNumber, map, omit } from 'lodash-es';
4
14
  import AIcon from '../Icon';
@@ -6,13 +16,11 @@ import useVirtualTableStyle from './style';
6
16
  import { useLocaleReceiver } from '../LocaleReciver';
7
17
  import { findAllChildren, flattenTree } from './data';
8
18
  const buffer = 5;
9
- export default defineComponent({
10
- name: 'JVirtualTable',
11
- components: {
12
- Table,
13
- Checkbox,
14
- AIcon
19
+ const __sfc_main__ = _defineComponent({
20
+ ...{
21
+ name: 'JVirtualTable'
15
22
  },
23
+ __name: 'VirtualTable',
16
24
  props: {
17
25
  dataSource: {
18
26
  type: Array,
@@ -27,7 +35,7 @@ export default defineComponent({
27
35
  default: () => []
28
36
  },
29
37
  rowSelection: {
30
- type: [Object, Boolean]
38
+ type: Object
31
39
  },
32
40
  rowKey: {
33
41
  type: [String, Function],
@@ -39,9 +47,11 @@ export default defineComponent({
39
47
  }
40
48
  },
41
49
  emits: ['update:expandedRowKeys'],
42
- setup(props, {
43
- emit
50
+ setup(__props, {
51
+ emit: __emit
44
52
  }) {
53
+ const props = __props;
54
+ const emits = __emit;
45
55
  const prefixCls = computed(() => 'virtual-table');
46
56
  const [wrapSSR, hashId] = useVirtualTableStyle(prefixCls);
47
57
  const [contextLocale] = useLocaleReceiver('ProTable');
@@ -214,22 +224,93 @@ export default defineComponent({
214
224
  onMounted(() => {
215
225
  updateVisibleNodes();
216
226
  });
217
- return {
218
- h,
219
- hashId,
220
- container,
221
- selectedAll,
222
- visibleRows,
223
- checkIndeterminate: _indeterminate,
224
- viewportHeight,
225
- tableColumns: _columns,
226
- tableRowSelection: _rowSelection,
227
- totalHeight,
228
- offsetY,
229
- firstColumn,
230
- onSelectedAllChange,
231
- onScroll,
232
- toggleExpand
227
+ return (_ctx, _cache) => {
228
+ return _openBlock(), _createElementBlock("div", {
229
+ class: _normalizeClass(['virtual-table-wrapper', _unref(hashId)])
230
+ }, [_createElementVNode("div", _hoisted_1, [_createVNode(_unref(Table), {
231
+ columns: _columns.value,
232
+ pagination: false,
233
+ rowKey: __props.rowKey,
234
+ "data-source": [],
235
+ components: {
236
+ body: {
237
+ wrapper: () => h('div')
238
+ }
239
+ }
240
+ }, {
241
+ headerCell: _withCtx(({
242
+ column,
243
+ title
244
+ }) => [column.key === '__selection__' ? (_openBlock(), _createElementBlock("span", _hoisted_2, [__props.rowSelection?.type !== 'radio' && !__props.rowSelection?.hideSelectAll ? (_openBlock(), _createBlock(_unref(Checkbox), {
245
+ key: 0,
246
+ checked: selectedAll.value,
247
+ "onUpdate:checked": _cache[0] || (_cache[0] = $event => selectedAll.value = $event),
248
+ onChange: onSelectedAllChange,
249
+ indeterminate: _indeterminate.value,
250
+ disabled: visibleRows.value.length === 0
251
+ }, null, 8 /* PROPS */, ["checked", "indeterminate", "disabled"])) : _createCommentVNode("v-if", true), _createElementVNode("span", null, _toDisplayString(__props.rowSelection?.columnTitle), 1 /* TEXT */)])) : _renderSlot(_ctx.$slots, "headerCell", {
252
+ key: 1,
253
+ title: title,
254
+ column: column
255
+ }, () => [_createTextVNode(_toDisplayString(title), 1 /* TEXT */)])]),
256
+ _: 3 /* FORWARDED */
257
+ }, 8 /* PROPS */, ["columns", "rowKey", "components"])]), _createElementVNode("div", {
258
+ class: "virtual-table-body",
259
+ ref_key: "container",
260
+ ref: container,
261
+ onScroll: onScroll,
262
+ style: _normalizeStyle({
263
+ height: `${viewportHeight.value}px`
264
+ })
265
+ }, [_createElementVNode("div", {
266
+ class: "virtual-table-height",
267
+ style: _normalizeStyle({
268
+ height: totalHeight.value + 'px'
269
+ })
270
+ }, null, 4 /* STYLE */), _createElementVNode("div", {
271
+ class: "virtual-table-visible-box",
272
+ style: _normalizeStyle({
273
+ transform: `translateY(${offsetY.value}px)`,
274
+ position: 'absolute',
275
+ top: 0,
276
+ left: 0,
277
+ right: 0
278
+ })
279
+ }, [_createVNode(_unref(Table), {
280
+ columns: __props.columns,
281
+ rowKey: __props.rowKey,
282
+ "data-source": visibleRows.value,
283
+ showHeader: false,
284
+ pagination: false,
285
+ rowSelection: _rowSelection.value
286
+ }, {
287
+ bodyCell: _withCtx(({
288
+ text,
289
+ record,
290
+ index,
291
+ column
292
+ }) => [column.dataIndex === firstColumn.value?.dataIndex || column.key === firstColumn.value?.key ? (_openBlock(), _createElementBlock(_Fragment, {
293
+ key: 0
294
+ }, [_createElementVNode("span", {
295
+ class: "ant-table-row-indent indent-level-3",
296
+ style: _normalizeStyle({
297
+ paddingLeft: `${record.level * 15}px`
298
+ })
299
+ }, null, 4 /* STYLE */), _createElementVNode("span", {
300
+ class: "virtual-table-row-expand-icon",
301
+ onClick: $event => toggleExpand(record)
302
+ }, [record.hasChildren ? (_openBlock(), _createBlock(_unref(AIcon), {
303
+ key: 0,
304
+ type: !record.expanded ? 'PlusSquareOutlined' : 'MinusSquareOutlined'
305
+ }, null, 8 /* PROPS */, ["type"])) : _createCommentVNode("v-if", true)], 8 /* PROPS */, _hoisted_3)], 64 /* STABLE_FRAGMENT */)) : _createCommentVNode("v-if", true), _renderSlot(_ctx.$slots, "bodyCell", {
306
+ text: text,
307
+ record: record,
308
+ index: index,
309
+ column: column
310
+ }, () => [_createTextVNode(_toDisplayString(text || '--'), 1 /* TEXT */)])]),
311
+ _: 3 /* FORWARDED */
312
+ }, 8 /* PROPS */, ["columns", "rowKey", "data-source", "rowSelection"])], 4 /* STYLE */)], 36 /* STYLE, NEED_HYDRATION */)], 2 /* CLASS */);
233
313
  };
234
314
  }
235
- });
315
+ });
316
+ export default __sfc_main__;
@@ -1,12 +1,22 @@
1
- import { defineComponent, ref, useSlots, computed, onMounted, watch } from 'vue';
1
+ import { defineComponent as _defineComponent } from 'vue';
2
+ import { unref as _unref, toDisplayString as _toDisplayString, createElementVNode as _createElementVNode, resolveComponent as _resolveComponent, createVNode as _createVNode, withModifiers as _withModifiers, withCtx as _withCtx, openBlock as _openBlock, createElementBlock as _createElementBlock, createCommentVNode as _createCommentVNode, renderSlot as _renderSlot, normalizeStyle as _normalizeStyle, createTextVNode as _createTextVNode, Transition as _Transition, normalizeClass as _normalizeClass } from "vue";
3
+ const _hoisted_1 = {
4
+ key: 0,
5
+ class: "header"
6
+ };
7
+ const _hoisted_2 = {
8
+ key: 1,
9
+ class: "jetlinks-drag-modal-footer"
10
+ };
11
+ import { ref, useSlots, computed, onMounted, watch } from 'vue';
2
12
  import { Button } from 'ant-design-vue';
3
13
  import { useLocaleReceiver } from '../LocaleReciver/index';
4
14
  import genDragModalStyle from './style';
5
- export default defineComponent({
6
- name: 'JDragModal',
7
- components: {
8
- Button
15
+ const __sfc_main__ = _defineComponent({
16
+ ...{
17
+ name: 'JDragModal'
9
18
  },
19
+ __name: 'DragModal',
10
20
  props: {
11
21
  title: {
12
22
  type: [String, Boolean],
@@ -34,9 +44,11 @@ export default defineComponent({
34
44
  }
35
45
  },
36
46
  emits: ['cancel', 'heightChange', 'ok', 'visibleChange'],
37
- setup(props, {
38
- emit
47
+ setup(__props, {
48
+ emit: __emit
39
49
  }) {
50
+ const props = __props;
51
+ const emits = __emit;
40
52
  const slots = useSlots();
41
53
  const [contextLocale] = useLocaleReceiver('DragModal');
42
54
  const ele = document.body;
@@ -149,18 +161,18 @@ export default defineComponent({
149
161
  }
150
162
  const height = baseHeight.value + calc;
151
163
  baseHeight.value = height <= props.dragRang[1] ? props.dragRang[1] : height;
152
- emit('heightChange', baseHeight.value);
164
+ emits('heightChange', baseHeight.value);
153
165
  }
154
166
  };
155
167
  handleClear();
156
168
  };
157
169
  const onCancel = () => {
158
- emit('cancel');
159
- emit('visibleChange', false);
170
+ emits('cancel');
171
+ emits('visibleChange', false);
160
172
  };
161
173
  const onOk = () => {
162
- emit('ok');
163
- emit('visibleChange', true);
174
+ emits('ok');
175
+ emits('visibleChange', true);
164
176
  };
165
177
  onMounted(() => {
166
178
  if (dialog.value && header.value) {
@@ -177,15 +189,55 @@ export default defineComponent({
177
189
  baseHeight.value = props.height;
178
190
  }
179
191
  });
180
- return {
181
- dialog,
182
- header,
183
- styles,
184
- hashId,
185
- contextLocale,
186
- rangeMove,
187
- onCancel,
188
- onOk
192
+ return (_ctx, _cache) => {
193
+ const _component_AIcon = _resolveComponent("AIcon");
194
+ const _component_a_button = _resolveComponent("a-button");
195
+ const _component_a_space = _resolveComponent("a-space");
196
+ return _openBlock(), _createElementBlock("div", {
197
+ ref_key: "dialog",
198
+ ref: dialog,
199
+ style: _normalizeStyle(styles.value),
200
+ class: _normalizeClass(['jetlinks-drag-modal', _unref(hashId)])
201
+ }, [_createVNode(_Transition, {
202
+ name: "dialog"
203
+ }, {
204
+ default: _withCtx(() => [_createElementVNode("div", {
205
+ class: "jetlinks-drag-modal-sprite",
206
+ ref_key: "header",
207
+ ref: header
208
+ }, [__props.title !== false ? (_openBlock(), _createElementBlock("div", _hoisted_1, [_createElementVNode("span", null, _toDisplayString(__props.title), 1 /* TEXT */), _createVNode(_component_a_button, {
209
+ size: "small",
210
+ type: "text",
211
+ onClick: _withModifiers(onCancel, ["stop"])
212
+ }, {
213
+ default: _withCtx(() => [_createVNode(_component_AIcon, {
214
+ type: "CloseOutlined"
215
+ })]),
216
+ _: 1 /* STABLE */
217
+ })])) : _createCommentVNode("v-if", true), _createElementVNode("div", {
218
+ class: "jetlinks-drag-modal-body",
219
+ style: _normalizeStyle(__props.bodyStyle)
220
+ }, [_renderSlot(_ctx.$slots, "default")], 4 /* STYLE */), __props.footer !== false ? (_openBlock(), _createElementBlock("div", _hoisted_2, [_renderSlot(_ctx.$slots, "footer", {}, () => [_createVNode(_component_a_space, null, {
221
+ default: _withCtx(() => [_createVNode(_unref(Button), {
222
+ onClick: _withModifiers(onCancel, ["stop"])
223
+ }, {
224
+ default: _withCtx(() => [_createTextVNode(_toDisplayString(_unref(contextLocale).cancel), 1 /* TEXT */)]),
225
+ _: 1 /* STABLE */
226
+ }), _createVNode(_unref(Button), {
227
+ type: "primary",
228
+ onClick: _withModifiers(onOk, ["stop"])
229
+ }, {
230
+ default: _withCtx(() => [_createTextVNode(_toDisplayString(_unref(contextLocale).confirm), 1 /* TEXT */)]),
231
+ _: 1 /* STABLE */
232
+ })]),
233
+ _: 1 /* STABLE */
234
+ })])])) : _createCommentVNode("v-if", true)], 512 /* NEED_PATCH */)]),
235
+ _: 3 /* FORWARDED */
236
+ }), _createElementVNode("div", {
237
+ class: _normalizeClass(['jetlinks-drag-modal-range', 'drag-bottom-right']),
238
+ onMousedown: _cache[0] || (_cache[0] = _withModifiers($event => rangeMove($event, 'drag-bottom-right'), ["stop"]))
239
+ }, null, 32 /* NEED_HYDRATION */)], 6 /* CLASS, STYLE */);
189
240
  };
190
241
  }
191
- });
242
+ });
243
+ export default __sfc_main__;
@@ -1,12 +1,14 @@
1
- import { defineComponent, inject, ref } from 'vue';
1
+ import { defineComponent as _defineComponent } from 'vue';
2
+ import { createVNode as _createVNode, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock } from "vue";
3
+ import { inject, ref } from 'vue';
2
4
  import { GAP } from './util';
3
5
  import Thumb from './Thumb.js';
4
6
  import { scrollbarContextKey } from './constants';
5
- export default defineComponent({
6
- name: 'ScrollbarBar',
7
- components: {
8
- Thumb
7
+ const __sfc_main__ = _defineComponent({
8
+ ...{
9
+ name: 'ScrollbarBar'
9
10
  },
11
+ __name: 'Bar',
10
12
  props: {
11
13
  always: {
12
14
  type: Boolean,
@@ -17,9 +19,10 @@ export default defineComponent({
17
19
  required: true
18
20
  }
19
21
  },
20
- setup(props, {
21
- expose
22
+ setup(__props, {
23
+ expose: __expose
22
24
  }) {
25
+ const props = __props;
23
26
  const scrollbar = inject(scrollbarContextKey);
24
27
  const moveX = ref(0);
25
28
  const moveY = ref(0);
@@ -49,17 +52,24 @@ export default defineComponent({
49
52
  sizeHeight.value = height + GAP < offsetHeight ? `${height}px` : '';
50
53
  sizeWidth.value = width + GAP < offsetWidth ? `${width}px` : '';
51
54
  };
52
- expose({
55
+ __expose({
53
56
  handleScroll,
54
57
  update
55
58
  });
56
- return {
57
- moveX,
58
- moveY,
59
- sizeWidth,
60
- sizeHeight,
61
- ratioY,
62
- ratioX
59
+ return (_ctx, _cache) => {
60
+ return _openBlock(), _createElementBlock(_Fragment, null, [_createVNode(Thumb, {
61
+ move: moveX.value,
62
+ ratio: ratioX.value,
63
+ size: sizeWidth.value,
64
+ always: __props.always
65
+ }, null, 8 /* PROPS */, ["move", "ratio", "size", "always"]), _createVNode(Thumb, {
66
+ move: moveY.value,
67
+ ratio: ratioY.value,
68
+ size: sizeHeight.value,
69
+ vertical: "",
70
+ always: __props.always
71
+ }, null, 8 /* PROPS */, ["move", "ratio", "size", "always"])], 64 /* STABLE_FRAGMENT */);
63
72
  };
64
73
  }
65
- });
74
+ });
75
+ export default __sfc_main__;
@@ -1,4 +1,6 @@
1
- import { defineComponent, computed, nextTick, onMounted, onUpdated, provide, reactive, ref, watch } from 'vue';
1
+ import { defineComponent as _defineComponent } from 'vue';
2
+ import { unref as _unref, 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";
3
+ import { computed, nextTick, onMounted, onUpdated, provide, reactive, ref, watch } from 'vue';
2
4
  import { useEventListener, useResizeObserver } from '@vueuse/core';
3
5
  import { isNumber, isObject } from '@meethive/utils';
4
6
  import Bar from './Bar.js';
@@ -6,17 +8,19 @@ import { scrollbarContextKey } from './constants';
6
8
  import { scrollbarEmits, scrollbarProps } from './scrollbarProps';
7
9
  import useScrollbarStyle from './style';
8
10
  const COMPONENT_NAME = 'JScrollbar';
9
- export default defineComponent({
10
- name: COMPONENT_NAME,
11
- components: {
12
- Bar
11
+ const __sfc_main__ = _defineComponent({
12
+ ...{
13
+ name: COMPONENT_NAME
13
14
  },
15
+ __name: 'Scrollbar',
14
16
  props: scrollbarProps,
15
17
  emits: scrollbarEmits,
16
- setup(props, {
17
- expose,
18
- emit
18
+ setup(__props, {
19
+ expose: __expose,
20
+ emit: __emit
19
21
  }) {
22
+ const props = __props;
23
+ const emit = __emit;
20
24
  const prefixCls = computed(() => 'j-scrollbar');
21
25
  const [wrapSSR, hashId] = useScrollbarStyle(prefixCls);
22
26
  let stopResizeObserver = undefined;
@@ -100,7 +104,7 @@ export default defineComponent({
100
104
  });
101
105
  });
102
106
  onUpdated(() => update());
103
- expose({
107
+ __expose({
104
108
  /** @description scrollbar wrap ref */
105
109
  wrapRef,
106
110
  /** @description update scrollbar state manually */
@@ -114,16 +118,36 @@ export default defineComponent({
114
118
  /** @description handle scroll event */
115
119
  handleScroll
116
120
  });
117
- return {
118
- hashId,
119
- scrollbarRef,
120
- wrapRef,
121
- resizeRef,
122
- barRef,
123
- wrapStyle,
124
- wrapKls,
125
- resizeKls,
126
- handleScroll
121
+ return (_ctx, _cache) => {
122
+ return _openBlock(), _createElementBlock("div", {
123
+ ref_key: "scrollbarRef",
124
+ ref: scrollbarRef,
125
+ class: _normalizeClass(['j-scrollbar', _unref(hashId)])
126
+ }, [_createElementVNode("div", {
127
+ ref_key: "wrapRef",
128
+ ref: wrapRef,
129
+ class: _normalizeClass(wrapKls.value),
130
+ style: _normalizeStyle(wrapStyle.value),
131
+ onScroll: handleScroll
132
+ }, [(_openBlock(), _createBlock(_resolveDynamicComponent(_ctx.tag), {
133
+ id: _ctx.id,
134
+ ref_key: "resizeRef",
135
+ ref: resizeRef,
136
+ class: _normalizeClass(resizeKls.value),
137
+ role: _ctx.role,
138
+ "aria-label": _ctx.ariaLabel,
139
+ "aria-orientation": _ctx.ariaOrientation
140
+ }, {
141
+ default: _withCtx(() => [_renderSlot(_ctx.$slots, "default")]),
142
+ _: 3 /* FORWARDED */
143
+ }, 8 /* PROPS */, ["id", "class", "role", "aria-label", "aria-orientation"]))], 38 /* CLASS, STYLE, NEED_HYDRATION */), !_ctx.native ? (_openBlock(), _createBlock(Bar, {
144
+ key: 0,
145
+ ref_key: "barRef",
146
+ ref: barRef,
147
+ always: _ctx.always,
148
+ "min-size": _ctx.minSize
149
+ }, null, 8 /* PROPS */, ["always", "min-size"])) : _createCommentVNode("v-if", true)], 2 /* CLASS */);
127
150
  };
128
151
  }
129
- });
152
+ });
153
+ export default __sfc_main__;
@@ -1,14 +1,20 @@
1
- import { defineComponent, computed, inject, onBeforeUnmount, ref, toRef } from 'vue';
1
+ import { defineComponent as _defineComponent } from 'vue';
2
+ import { unref as _unref, normalizeStyle as _normalizeStyle, createElementVNode as _createElementVNode, vShow as _vShow, normalizeClass as _normalizeClass, withDirectives as _withDirectives, Transition as _Transition, withCtx as _withCtx, createVNode as _createVNode, openBlock as _openBlock, createElementBlock as _createElementBlock } from "vue";
3
+ import { computed, inject, onBeforeUnmount, ref, toRef } from 'vue';
2
4
  import { useEventListener } from '@vueuse/core';
3
5
  import { isClient } from '@meethive/utils';
4
6
  import { scrollbarContextKey } from './constants';
5
7
  import { BAR_MAP, renderThumbStyle } from './util';
6
8
  import { thumbProps } from './thumbProps';
7
9
  import useScrollbarStyle from './style';
8
- export default defineComponent({
9
- name: 'ScrollbarThumb',
10
+ const __sfc_main__ = _defineComponent({
11
+ ...{
12
+ name: 'ScrollbarThumb'
13
+ },
14
+ __name: 'Thumb',
10
15
  props: thumbProps,
11
- setup(props) {
16
+ setup(__props) {
17
+ const props = __props;
12
18
  const scrollbar = inject(scrollbarContextKey);
13
19
  if (!scrollbar) throw new Error('can not inject scrollbar context');
14
20
  const instance = ref();
@@ -87,15 +93,28 @@ export default defineComponent({
87
93
  };
88
94
  useEventListener(toRef(scrollbar, 'scrollbarElement'), 'mousemove', mouseMoveScrollbarHandler);
89
95
  useEventListener(toRef(scrollbar, 'scrollbarElement'), 'mouseleave', mouseLeaveScrollbarHandler);
90
- return {
91
- props,
92
- instance,
93
- thumb,
94
- visible,
95
- hashId,
96
- thumbStyle,
97
- clickThumbHandler,
98
- clickTrackHandler
96
+ return (_ctx, _cache) => {
97
+ return _openBlock(), _createElementBlock("div", {
98
+ class: _normalizeClass([_unref(hashId)])
99
+ }, [_createVNode(_Transition, {
100
+ name: "j-scrollbar-fade",
101
+ persisted: ""
102
+ }, {
103
+ default: _withCtx(() => [_withDirectives(_createElementVNode("div", {
104
+ ref_key: "instance",
105
+ ref: instance,
106
+ class: _normalizeClass(['j-scrollbar__bar', props.vertical ? 'is-vertical' : 'is-horizontal']),
107
+ onMousedown: clickTrackHandler
108
+ }, [_createElementVNode("div", {
109
+ ref_key: "thumb",
110
+ ref: thumb,
111
+ class: "j-scrollbar__thumb",
112
+ style: _normalizeStyle(thumbStyle.value),
113
+ onMousedown: clickThumbHandler
114
+ }, null, 36 /* STYLE, NEED_HYDRATION */)], 34 /* CLASS, NEED_HYDRATION */), [[_vShow, _ctx.always || visible.value]])]),
115
+ _: 1 /* STABLE */
116
+ })], 2 /* CLASS */);
99
117
  };
100
118
  }
101
- });
119
+ });
120
+ export default __sfc_main__;
@@ -1,4 +1,14 @@
1
- import { defineComponent, computed, ref, watch, onMounted, nextTick, h } from 'vue';
1
+ import { defineComponent as _defineComponent } from 'vue';
2
+ import { unref as _unref, openBlock as _openBlock, createBlock as _createBlock, createCommentVNode as _createCommentVNode, toDisplayString as _toDisplayString, createElementVNode as _createElementVNode, createElementBlock as _createElementBlock, renderSlot as _renderSlot, createTextVNode as _createTextVNode, withCtx as _withCtx, createVNode as _createVNode, normalizeStyle as _normalizeStyle, Fragment as _Fragment, normalizeClass as _normalizeClass } from "vue";
3
+ const _hoisted_1 = {
4
+ class: "virtual-table-header"
5
+ };
6
+ const _hoisted_2 = {
7
+ key: 0,
8
+ class: "virtual-table-all-selected"
9
+ };
10
+ const _hoisted_3 = ["onClick"];
11
+ import { computed, ref, watch, onMounted, nextTick, h } from 'vue';
2
12
  import { Table, Checkbox } from 'ant-design-vue';
3
13
  import { isNumber, map, omit } from 'lodash-es';
4
14
  import AIcon from '../Icon';
@@ -6,13 +16,11 @@ import useVirtualTableStyle from './style';
6
16
  import { useLocaleReceiver } from '../LocaleReciver';
7
17
  import { findAllChildren, flattenTree } from './data';
8
18
  const buffer = 5;
9
- export default defineComponent({
10
- name: 'JVirtualTable',
11
- components: {
12
- Table,
13
- Checkbox,
14
- AIcon
19
+ const __sfc_main__ = _defineComponent({
20
+ ...{
21
+ name: 'JVirtualTable'
15
22
  },
23
+ __name: 'VirtualTable',
16
24
  props: {
17
25
  dataSource: {
18
26
  type: Array,
@@ -27,7 +35,7 @@ export default defineComponent({
27
35
  default: () => []
28
36
  },
29
37
  rowSelection: {
30
- type: [Object, Boolean]
38
+ type: Object
31
39
  },
32
40
  rowKey: {
33
41
  type: [String, Function],
@@ -39,9 +47,11 @@ export default defineComponent({
39
47
  }
40
48
  },
41
49
  emits: ['update:expandedRowKeys'],
42
- setup(props, {
43
- emit
50
+ setup(__props, {
51
+ emit: __emit
44
52
  }) {
53
+ const props = __props;
54
+ const emits = __emit;
45
55
  const prefixCls = computed(() => 'virtual-table');
46
56
  const [wrapSSR, hashId] = useVirtualTableStyle(prefixCls);
47
57
  const [contextLocale] = useLocaleReceiver('ProTable');
@@ -214,22 +224,93 @@ export default defineComponent({
214
224
  onMounted(() => {
215
225
  updateVisibleNodes();
216
226
  });
217
- return {
218
- h,
219
- hashId,
220
- container,
221
- selectedAll,
222
- visibleRows,
223
- checkIndeterminate: _indeterminate,
224
- viewportHeight,
225
- tableColumns: _columns,
226
- tableRowSelection: _rowSelection,
227
- totalHeight,
228
- offsetY,
229
- firstColumn,
230
- onSelectedAllChange,
231
- onScroll,
232
- toggleExpand
227
+ return (_ctx, _cache) => {
228
+ return _openBlock(), _createElementBlock("div", {
229
+ class: _normalizeClass(['virtual-table-wrapper', _unref(hashId)])
230
+ }, [_createElementVNode("div", _hoisted_1, [_createVNode(_unref(Table), {
231
+ columns: _columns.value,
232
+ pagination: false,
233
+ rowKey: __props.rowKey,
234
+ "data-source": [],
235
+ components: {
236
+ body: {
237
+ wrapper: () => h('div')
238
+ }
239
+ }
240
+ }, {
241
+ headerCell: _withCtx(({
242
+ column,
243
+ title
244
+ }) => [column.key === '__selection__' ? (_openBlock(), _createElementBlock("span", _hoisted_2, [__props.rowSelection?.type !== 'radio' && !__props.rowSelection?.hideSelectAll ? (_openBlock(), _createBlock(_unref(Checkbox), {
245
+ key: 0,
246
+ checked: selectedAll.value,
247
+ "onUpdate:checked": _cache[0] || (_cache[0] = $event => selectedAll.value = $event),
248
+ onChange: onSelectedAllChange,
249
+ indeterminate: _indeterminate.value,
250
+ disabled: visibleRows.value.length === 0
251
+ }, null, 8 /* PROPS */, ["checked", "indeterminate", "disabled"])) : _createCommentVNode("v-if", true), _createElementVNode("span", null, _toDisplayString(__props.rowSelection?.columnTitle), 1 /* TEXT */)])) : _renderSlot(_ctx.$slots, "headerCell", {
252
+ key: 1,
253
+ title: title,
254
+ column: column
255
+ }, () => [_createTextVNode(_toDisplayString(title), 1 /* TEXT */)])]),
256
+ _: 3 /* FORWARDED */
257
+ }, 8 /* PROPS */, ["columns", "rowKey", "components"])]), _createElementVNode("div", {
258
+ class: "virtual-table-body",
259
+ ref_key: "container",
260
+ ref: container,
261
+ onScroll: onScroll,
262
+ style: _normalizeStyle({
263
+ height: `${viewportHeight.value}px`
264
+ })
265
+ }, [_createElementVNode("div", {
266
+ class: "virtual-table-height",
267
+ style: _normalizeStyle({
268
+ height: totalHeight.value + 'px'
269
+ })
270
+ }, null, 4 /* STYLE */), _createElementVNode("div", {
271
+ class: "virtual-table-visible-box",
272
+ style: _normalizeStyle({
273
+ transform: `translateY(${offsetY.value}px)`,
274
+ position: 'absolute',
275
+ top: 0,
276
+ left: 0,
277
+ right: 0
278
+ })
279
+ }, [_createVNode(_unref(Table), {
280
+ columns: __props.columns,
281
+ rowKey: __props.rowKey,
282
+ "data-source": visibleRows.value,
283
+ showHeader: false,
284
+ pagination: false,
285
+ rowSelection: _rowSelection.value
286
+ }, {
287
+ bodyCell: _withCtx(({
288
+ text,
289
+ record,
290
+ index,
291
+ column
292
+ }) => [column.dataIndex === firstColumn.value?.dataIndex || column.key === firstColumn.value?.key ? (_openBlock(), _createElementBlock(_Fragment, {
293
+ key: 0
294
+ }, [_createElementVNode("span", {
295
+ class: "ant-table-row-indent indent-level-3",
296
+ style: _normalizeStyle({
297
+ paddingLeft: `${record.level * 15}px`
298
+ })
299
+ }, null, 4 /* STYLE */), _createElementVNode("span", {
300
+ class: "virtual-table-row-expand-icon",
301
+ onClick: $event => toggleExpand(record)
302
+ }, [record.hasChildren ? (_openBlock(), _createBlock(_unref(AIcon), {
303
+ key: 0,
304
+ type: !record.expanded ? 'PlusSquareOutlined' : 'MinusSquareOutlined'
305
+ }, null, 8 /* PROPS */, ["type"])) : _createCommentVNode("v-if", true)], 8 /* PROPS */, _hoisted_3)], 64 /* STABLE_FRAGMENT */)) : _createCommentVNode("v-if", true), _renderSlot(_ctx.$slots, "bodyCell", {
306
+ text: text,
307
+ record: record,
308
+ index: index,
309
+ column: column
310
+ }, () => [_createTextVNode(_toDisplayString(text || '--'), 1 /* TEXT */)])]),
311
+ _: 3 /* FORWARDED */
312
+ }, 8 /* PROPS */, ["columns", "rowKey", "data-source", "rowSelection"])], 4 /* STYLE */)], 36 /* STYLE, NEED_HYDRATION */)], 2 /* CLASS */);
233
313
  };
234
314
  }
235
- });
315
+ });
316
+ export default __sfc_main__;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meethive/components",
3
- "version": "0.0.12",
3
+ "version": "0.0.13",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",