@meethive/components 0.0.3 → 0.0.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.
Files changed (111) hide show
  1. package/es/AutoComplete/AutoComplete.js +71 -80
  2. package/es/BadgeStatus/Badge.js +38 -47
  3. package/es/CardSelect/CardSelect.js +115 -137
  4. package/es/CheckButton/CheckButton.js +102 -118
  5. package/es/ConfigProvider/ConfigProvider.js +44 -68
  6. package/es/DragModal/DragModal.js +191 -212
  7. package/es/EditTable/Body.js +158 -189
  8. package/es/EditTable/CellRender.js +10 -12
  9. package/es/EditTable/EditTable.js +385 -434
  10. package/es/EditTable/FormItem.js +140 -169
  11. package/es/EditTable/Group.js +171 -204
  12. package/es/EditTable/Header.js +57 -63
  13. package/es/EditTable/HeaderRender.js +10 -12
  14. package/es/EditTable/components/ContextMenu/Menu.js +78 -86
  15. package/es/EditTable/components/Search/Search.js +151 -163
  16. package/es/EditTable/components/Search/Sort.js +104 -119
  17. package/es/Ellipsis/Ellipsis.js +144 -148
  18. package/es/Empty/Empty.js +51 -57
  19. package/es/FullPage/FullPage.js +20 -19
  20. package/es/Icon/Icon.js +42 -49
  21. package/es/LocaleProvider/LocaleProvider.js +32 -38
  22. package/es/Markdown/Markdown.js +101 -118
  23. package/es/PermissionButton/PermissionButton.js +118 -118
  24. package/es/ProLayout/Basic/BasicLayout.js +361 -418
  25. package/es/ProLayout/Basic/Header.js +97 -111
  26. package/es/ProLayout/PageContainer/index.js +298 -344
  27. package/es/ProLayout/SiderMenu/BaseMenu.js +233 -240
  28. package/es/ProTable/Alert.js +39 -40
  29. package/es/ProTable/Content.js +84 -97
  30. package/es/ProTable/Header.js +32 -33
  31. package/es/ProTable/Pagination.js +56 -55
  32. package/es/ProTable/ProTable.js +256 -276
  33. package/es/RadioButton/RadioButton.js +48 -53
  34. package/es/Scrollbar/Bar.js +65 -76
  35. package/es/Scrollbar/Scrollbar.js +129 -161
  36. package/es/Scrollbar/Thumb.js +101 -150
  37. package/es/Search/Item.js +208 -236
  38. package/es/Search/Search.js +90 -90
  39. package/es/Skeleton/Skeleton.js +26 -27
  40. package/es/Skeleton/components/DashBoardCard.js +26 -27
  41. package/es/Skeleton/components/DashBoardChart.js +26 -27
  42. package/es/Skeleton/components/Detail.js +26 -27
  43. package/es/Skeleton/components/Drawer.js +26 -27
  44. package/es/Skeleton/components/Item.js +55 -54
  45. package/es/Skeleton/components/List.js +29 -27
  46. package/es/Skeleton/components/ListCard.js +28 -28
  47. package/es/Skeleton/components/ListCardItem.js +20 -20
  48. package/es/Skeleton/components/ListTable.js +26 -27
  49. package/es/Skeleton/components/Page.js +27 -26
  50. package/es/Skeleton/components/Search.js +16 -16
  51. package/es/Skeleton/components/Tree.js +26 -27
  52. package/es/TimeFormat/TimeFormat.js +32 -36
  53. package/es/Title/Title.js +23 -26
  54. package/es/ValueItem/ValueItem.js +100 -113
  55. package/es/VirtualTable/VirtualTable.js +235 -271
  56. package/lib/AutoComplete/AutoComplete.js +71 -80
  57. package/lib/BadgeStatus/Badge.js +38 -47
  58. package/lib/CardSelect/CardSelect.js +115 -137
  59. package/lib/CheckButton/CheckButton.js +102 -118
  60. package/lib/ConfigProvider/ConfigProvider.js +44 -68
  61. package/lib/DragModal/DragModal.js +191 -212
  62. package/lib/EditTable/Body.js +158 -189
  63. package/lib/EditTable/CellRender.js +10 -12
  64. package/lib/EditTable/EditTable.js +385 -434
  65. package/lib/EditTable/FormItem.js +140 -169
  66. package/lib/EditTable/Group.js +171 -204
  67. package/lib/EditTable/Header.js +57 -63
  68. package/lib/EditTable/HeaderRender.js +10 -12
  69. package/lib/EditTable/components/ContextMenu/Menu.js +78 -86
  70. package/lib/EditTable/components/Search/Search.js +151 -163
  71. package/lib/EditTable/components/Search/Sort.js +104 -119
  72. package/lib/Ellipsis/Ellipsis.js +144 -148
  73. package/lib/Empty/Empty.js +51 -57
  74. package/lib/FullPage/FullPage.js +20 -19
  75. package/lib/Icon/Icon.js +42 -49
  76. package/lib/LocaleProvider/LocaleProvider.js +32 -38
  77. package/lib/Markdown/Markdown.js +101 -118
  78. package/lib/PermissionButton/PermissionButton.js +118 -118
  79. package/lib/ProLayout/Basic/BasicLayout.js +361 -418
  80. package/lib/ProLayout/Basic/Header.js +97 -111
  81. package/lib/ProLayout/PageContainer/index.js +298 -344
  82. package/lib/ProLayout/SiderMenu/BaseMenu.js +233 -240
  83. package/lib/ProTable/Alert.js +39 -40
  84. package/lib/ProTable/Content.js +84 -97
  85. package/lib/ProTable/Header.js +32 -33
  86. package/lib/ProTable/Pagination.js +56 -55
  87. package/lib/ProTable/ProTable.js +256 -276
  88. package/lib/RadioButton/RadioButton.js +48 -53
  89. package/lib/Scrollbar/Bar.js +65 -76
  90. package/lib/Scrollbar/Scrollbar.js +129 -161
  91. package/lib/Scrollbar/Thumb.js +101 -150
  92. package/lib/Search/Item.js +208 -236
  93. package/lib/Search/Search.js +90 -90
  94. package/lib/Skeleton/Skeleton.js +26 -27
  95. package/lib/Skeleton/components/DashBoardCard.js +26 -27
  96. package/lib/Skeleton/components/DashBoardChart.js +26 -27
  97. package/lib/Skeleton/components/Detail.js +26 -27
  98. package/lib/Skeleton/components/Drawer.js +26 -27
  99. package/lib/Skeleton/components/Item.js +55 -54
  100. package/lib/Skeleton/components/List.js +29 -27
  101. package/lib/Skeleton/components/ListCard.js +28 -28
  102. package/lib/Skeleton/components/ListCardItem.js +20 -20
  103. package/lib/Skeleton/components/ListTable.js +26 -27
  104. package/lib/Skeleton/components/Page.js +27 -26
  105. package/lib/Skeleton/components/Search.js +16 -16
  106. package/lib/Skeleton/components/Tree.js +26 -27
  107. package/lib/TimeFormat/TimeFormat.js +32 -36
  108. package/lib/Title/Title.js +23 -26
  109. package/lib/ValueItem/ValueItem.js +100 -113
  110. package/lib/VirtualTable/VirtualTable.js +235 -271
  111. package/package.json +1 -1
@@ -1,76 +1,65 @@
1
- function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
- import { defineComponent, inject, ref } from 'vue'
3
- import { GAP } from './util'
4
- import Thumb from './Thumb.js'
5
- import { scrollbarContextKey } from './constants'
6
-
7
- export default defineComponent({
8
- name: 'ScrollbarBar',
9
- components: { Thumb },
10
- props: {
11
- always: {
12
- type: Boolean,
13
- default: true
14
- },
15
- minSize: {
16
- type: Number,
17
- required: true
18
- }
19
- },
20
- setup(props, { expose }) {
21
- const scrollbar = inject(scrollbarContextKey)
22
-
23
- const moveX = ref(0)
24
- const moveY = ref(0)
25
- const sizeWidth = ref('')
26
- const sizeHeight = ref('')
27
- const ratioY = ref(1)
28
- const ratioX = ref(1)
29
-
30
- const handleScroll = (wrap) => {
31
- if (wrap) {
32
- const offsetHeight = wrap.offsetHeight - GAP
33
- const offsetWidth = wrap.offsetWidth - GAP
34
-
35
- moveY.value = ((wrap.scrollTop * 100) / offsetHeight) * ratioY.value
36
- moveX.value = ((wrap.scrollLeft * 100) / offsetWidth) * ratioX.value
37
- }
38
- }
39
-
40
- const update = () => {
41
- const wrap = _optionalChain([scrollbar, 'optionalAccess', _ => _.wrapElement])
42
- if (!wrap) return
43
-
44
- const offsetHeight = wrap.offsetHeight - GAP
45
- const offsetWidth = wrap.offsetWidth - GAP
46
-
47
- const originalHeight = offsetHeight ** 2 / wrap.scrollHeight
48
- const originalWidth = offsetWidth ** 2 / wrap.scrollWidth
49
-
50
- const height = Math.max(originalHeight, props.minSize)
51
- const width = Math.max(originalWidth, props.minSize)
52
-
53
- ratioY.value =
54
- originalHeight / (offsetHeight - originalHeight) / (height / (offsetHeight - height))
55
- ratioX.value =
56
- originalWidth / (offsetWidth - originalWidth) / (width / (offsetWidth - width))
57
-
58
- sizeHeight.value = height + GAP < offsetHeight ? `${height}px` : ''
59
- sizeWidth.value = width + GAP < offsetWidth ? `${width}px` : ''
60
- }
61
-
62
- expose({
63
- handleScroll,
64
- update
65
- })
66
-
67
- return {
68
- moveX,
69
- moveY,
70
- sizeWidth,
71
- sizeHeight,
72
- ratioY,
73
- ratioX
74
- }
75
- }
76
- })
1
+ import { defineComponent, inject, ref } from 'vue';
2
+ import { GAP } from './util';
3
+ import Thumb from './Thumb.js';
4
+ import { scrollbarContextKey } from './constants';
5
+ export default defineComponent({
6
+ name: 'ScrollbarBar',
7
+ components: {
8
+ Thumb
9
+ },
10
+ props: {
11
+ always: {
12
+ type: Boolean,
13
+ default: true
14
+ },
15
+ minSize: {
16
+ type: Number,
17
+ required: true
18
+ }
19
+ },
20
+ setup(props, {
21
+ expose
22
+ }) {
23
+ const scrollbar = inject(scrollbarContextKey);
24
+ const moveX = ref(0);
25
+ const moveY = ref(0);
26
+ const sizeWidth = ref('');
27
+ const sizeHeight = ref('');
28
+ const ratioY = ref(1);
29
+ const ratioX = ref(1);
30
+ const handleScroll = wrap => {
31
+ if (wrap) {
32
+ const offsetHeight = wrap.offsetHeight - GAP;
33
+ const offsetWidth = wrap.offsetWidth - GAP;
34
+ moveY.value = wrap.scrollTop * 100 / offsetHeight * ratioY.value;
35
+ moveX.value = wrap.scrollLeft * 100 / offsetWidth * ratioX.value;
36
+ }
37
+ };
38
+ const update = () => {
39
+ const wrap = scrollbar?.wrapElement;
40
+ if (!wrap) return;
41
+ const offsetHeight = wrap.offsetHeight - GAP;
42
+ const offsetWidth = wrap.offsetWidth - GAP;
43
+ const originalHeight = offsetHeight ** 2 / wrap.scrollHeight;
44
+ const originalWidth = offsetWidth ** 2 / wrap.scrollWidth;
45
+ const height = Math.max(originalHeight, props.minSize);
46
+ const width = Math.max(originalWidth, props.minSize);
47
+ ratioY.value = originalHeight / (offsetHeight - originalHeight) / (height / (offsetHeight - height));
48
+ ratioX.value = originalWidth / (offsetWidth - originalWidth) / (width / (offsetWidth - width));
49
+ sizeHeight.value = height + GAP < offsetHeight ? `${height}px` : '';
50
+ sizeWidth.value = width + GAP < offsetWidth ? `${width}px` : '';
51
+ };
52
+ expose({
53
+ handleScroll,
54
+ update
55
+ });
56
+ return {
57
+ moveX,
58
+ moveY,
59
+ sizeWidth,
60
+ sizeHeight,
61
+ ratioY,
62
+ ratioX
63
+ };
64
+ }
65
+ });
@@ -1,161 +1,129 @@
1
- function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
- import {
3
- defineComponent,
4
- computed,
5
- nextTick,
6
- onMounted,
7
- onUpdated,
8
- provide,
9
- reactive,
10
- ref,
11
- watch
12
- } from 'vue'
13
- import { useEventListener, useResizeObserver } from '@vueuse/core'
14
- import { isNumber, isObject } from '@meethive/utils'
15
- import Bar from './Bar.js'
16
- import { scrollbarContextKey } from './constants'
17
- import { scrollbarEmits, scrollbarProps } from './scrollbarProps'
18
- import useScrollbarStyle from './style'
19
-
20
- const COMPONENT_NAME = 'JScrollbar'
21
-
22
- export default defineComponent({
23
- name: COMPONENT_NAME,
24
- components: { Bar },
25
- props: scrollbarProps,
26
- emits: scrollbarEmits,
27
- setup(props, { expose, emit }) {
28
- const prefixCls = computed(() => 'j-scrollbar')
29
- const [wrapSSR, hashId] = useScrollbarStyle(prefixCls)
30
-
31
- let stopResizeObserver = undefined
32
- let stopResizeListener = undefined
33
-
34
- const scrollbarRef = ref()
35
- const wrapRef = ref()
36
- const resizeRef = ref()
37
- const barRef = ref()
38
-
39
- const wrapStyle = computed(() => {
40
- const style = {}
41
- if (props.height) style.height = `${props.height}px`
42
- if (props.maxHeight) style.maxHeight = `${props.maxHeight}px`
43
- return [props.wrapStyle, style]
44
- })
45
-
46
- const wrapKls = computed(() => {
47
- return ['j-scrollbar__wrap', 'j-scrollbar__wrap--hidden-default']
48
- })
49
-
50
- const resizeKls = computed(() => {
51
- return ['j-scrollbar__view', props.viewClass]
52
- })
53
-
54
- const handleScroll = () => {
55
- if (wrapRef.value) {
56
- _optionalChain([barRef, 'access', _ => _.value, 'optionalAccess', _2 => _2.handleScroll, 'call', _3 => _3(wrapRef.value)])
57
- emit('scroll', {
58
- scrollTop: wrapRef.value.scrollTop,
59
- scrollLeft: wrapRef.value.scrollLeft
60
- })
61
- }
62
- }
63
-
64
- function scrollTo(arg1, arg2) {
65
- if (isObject(arg1)) {
66
- wrapRef.value.scrollTo(arg1 )
67
- } else if (isNumber(arg1) && isNumber(arg2)) {
68
- wrapRef.value.scrollTo(arg1, arg2)
69
- }
70
- }
71
-
72
- const setScrollTop = (value) => {
73
- if (!isNumber(value)) {
74
- throw new Error('value must be a number')
75
- }
76
- wrapRef.value.scrollTop = value
77
- }
78
-
79
- const setScrollLeft = (value) => {
80
- if (!isNumber(value)) {
81
- throw new Error(`[${COMPONENT_NAME}] value must be a number`)
82
- }
83
- wrapRef.value.scrollLeft = value
84
- }
85
-
86
- const update = () => {
87
- _optionalChain([barRef, 'access', _4 => _4.value, 'optionalAccess', _5 => _5.update, 'call', _6 => _6()])
88
- }
89
-
90
- watch(
91
- () => props.noresize,
92
- (noResize) => {
93
- if (noResize) {
94
- _optionalChain([stopResizeObserver, 'optionalCall', _7 => _7()])
95
- _optionalChain([stopResizeListener, 'optionalCall', _8 => _8()])
96
- } else {
97
- ;({ stop: stopResizeObserver } = useResizeObserver(resizeRef, update))
98
- stopResizeListener = useEventListener('resize', update)
99
- }
100
- },
101
- { immediate: true }
102
- )
103
-
104
- watch(
105
- () => [props.maxHeight, props.height],
106
- () => {
107
- if (!props.native)
108
- nextTick(() => {
109
- update()
110
- if (wrapRef.value) {
111
- _optionalChain([barRef, 'access', _9 => _9.value, 'optionalAccess', _10 => _10.handleScroll, 'call', _11 => _11(wrapRef.value)])
112
- }
113
- })
114
- }
115
- )
116
-
117
- provide(
118
- scrollbarContextKey,
119
- reactive({
120
- scrollbarElement: scrollbarRef,
121
- wrapElement: wrapRef
122
- })
123
- )
124
-
125
- onMounted(() => {
126
- if (!props.native)
127
- nextTick(() => {
128
- update()
129
- })
130
- })
131
-
132
- onUpdated(() => update())
133
-
134
- expose({
135
- /** @description scrollbar wrap ref */
136
- wrapRef,
137
- /** @description update scrollbar state manually */
138
- update,
139
- /** @description scrolls to a particular set of coordinates */
140
- scrollTo,
141
- /** @description set distance to scroll top */
142
- setScrollTop,
143
- /** @description set distance to scroll left */
144
- setScrollLeft,
145
- /** @description handle scroll event */
146
- handleScroll
147
- })
148
-
149
- return {
150
- hashId,
151
- scrollbarRef,
152
- wrapRef,
153
- resizeRef,
154
- barRef,
155
- wrapStyle,
156
- wrapKls,
157
- resizeKls,
158
- handleScroll
159
- }
160
- }
161
- })
1
+ import { defineComponent, computed, nextTick, onMounted, onUpdated, provide, reactive, ref, watch } from 'vue';
2
+ import { useEventListener, useResizeObserver } from '@vueuse/core';
3
+ import { isNumber, isObject } from '@meethive/utils';
4
+ import Bar from './Bar.js';
5
+ import { scrollbarContextKey } from './constants';
6
+ import { scrollbarEmits, scrollbarProps } from './scrollbarProps';
7
+ import useScrollbarStyle from './style';
8
+ const COMPONENT_NAME = 'JScrollbar';
9
+ export default defineComponent({
10
+ name: COMPONENT_NAME,
11
+ components: {
12
+ Bar
13
+ },
14
+ props: scrollbarProps,
15
+ emits: scrollbarEmits,
16
+ setup(props, {
17
+ expose,
18
+ emit
19
+ }) {
20
+ const prefixCls = computed(() => 'j-scrollbar');
21
+ const [wrapSSR, hashId] = useScrollbarStyle(prefixCls);
22
+ let stopResizeObserver = undefined;
23
+ let stopResizeListener = undefined;
24
+ const scrollbarRef = ref();
25
+ const wrapRef = ref();
26
+ const resizeRef = ref();
27
+ const barRef = ref();
28
+ const wrapStyle = computed(() => {
29
+ const style = {};
30
+ if (props.height) style.height = `${props.height}px`;
31
+ if (props.maxHeight) style.maxHeight = `${props.maxHeight}px`;
32
+ return [props.wrapStyle, style];
33
+ });
34
+ const wrapKls = computed(() => {
35
+ return ['j-scrollbar__wrap', 'j-scrollbar__wrap--hidden-default'];
36
+ });
37
+ const resizeKls = computed(() => {
38
+ return ['j-scrollbar__view', props.viewClass];
39
+ });
40
+ const handleScroll = () => {
41
+ if (wrapRef.value) {
42
+ barRef.value?.handleScroll(wrapRef.value);
43
+ emit('scroll', {
44
+ scrollTop: wrapRef.value.scrollTop,
45
+ scrollLeft: wrapRef.value.scrollLeft
46
+ });
47
+ }
48
+ };
49
+ function scrollTo(arg1, arg2) {
50
+ if (isObject(arg1)) {
51
+ wrapRef.value.scrollTo(arg1);
52
+ } else if (isNumber(arg1) && isNumber(arg2)) {
53
+ wrapRef.value.scrollTo(arg1, arg2);
54
+ }
55
+ }
56
+ const setScrollTop = value => {
57
+ if (!isNumber(value)) {
58
+ throw new Error('value must be a number');
59
+ }
60
+ wrapRef.value.scrollTop = value;
61
+ };
62
+ const setScrollLeft = value => {
63
+ if (!isNumber(value)) {
64
+ throw new Error(`[${COMPONENT_NAME}] value must be a number`);
65
+ }
66
+ wrapRef.value.scrollLeft = value;
67
+ };
68
+ const update = () => {
69
+ barRef.value?.update();
70
+ };
71
+ watch(() => props.noresize, noResize => {
72
+ if (noResize) {
73
+ stopResizeObserver?.();
74
+ stopResizeListener?.();
75
+ } else {
76
+ ;
77
+ ({
78
+ stop: stopResizeObserver
79
+ } = useResizeObserver(resizeRef, update));
80
+ stopResizeListener = useEventListener('resize', update);
81
+ }
82
+ }, {
83
+ immediate: true
84
+ });
85
+ watch(() => [props.maxHeight, props.height], () => {
86
+ if (!props.native) nextTick(() => {
87
+ update();
88
+ if (wrapRef.value) {
89
+ barRef.value?.handleScroll(wrapRef.value);
90
+ }
91
+ });
92
+ });
93
+ provide(scrollbarContextKey, reactive({
94
+ scrollbarElement: scrollbarRef,
95
+ wrapElement: wrapRef
96
+ }));
97
+ onMounted(() => {
98
+ if (!props.native) nextTick(() => {
99
+ update();
100
+ });
101
+ });
102
+ onUpdated(() => update());
103
+ expose({
104
+ /** @description scrollbar wrap ref */
105
+ wrapRef,
106
+ /** @description update scrollbar state manually */
107
+ update,
108
+ /** @description scrolls to a particular set of coordinates */
109
+ scrollTo,
110
+ /** @description set distance to scroll top */
111
+ setScrollTop,
112
+ /** @description set distance to scroll left */
113
+ setScrollLeft,
114
+ /** @description handle scroll event */
115
+ handleScroll
116
+ });
117
+ return {
118
+ hashId,
119
+ scrollbarRef,
120
+ wrapRef,
121
+ resizeRef,
122
+ barRef,
123
+ wrapStyle,
124
+ wrapKls,
125
+ resizeKls,
126
+ handleScroll
127
+ };
128
+ }
129
+ });