@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,212 +1,191 @@
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, ref, useSlots, computed, onMounted, watch } from 'vue'
3
- import { Button } from 'ant-design-vue'
4
- import { useLocaleReceiver } from '../LocaleReciver/index'
5
- import genDragModalStyle from './style'
6
-
7
- export default defineComponent({
8
- name: 'JDragModal',
9
- components: { Button },
10
- props: {
11
- title: {
12
- type: [String, Boolean],
13
- default: ''
14
- },
15
- width: {
16
- type: Number,
17
- default: 400
18
- },
19
- height: {
20
- type: Number,
21
- default: 100
22
- },
23
- dragRang: {
24
- type: [Array, Number],
25
- default: [400, 200]
26
- },
27
- bodyStyle: {
28
- type: Object,
29
- default: () => ({})
30
- },
31
- footer: {
32
- type: Boolean,
33
- default: true
34
- }
35
- },
36
- emits: ['cancel', 'heightChange', 'ok', 'visibleChange'],
37
- setup(props, { emit }) {
38
- const slots = useSlots()
39
- const [contextLocale] = useLocaleReceiver('DragModal')
40
- const ele = document.body
41
-
42
- const dialog = ref()
43
- const header = ref()
44
- const baseWidth = ref(props.width || 400)
45
- const baseHeight = ref(props.height || 100)
46
- const baseLeft = ref(100)
47
- const baseTop = ref(100)
48
-
49
- const prefixCls = computed(() => 'jetlinks-drag-modal')
50
- const [wrapSSR, hashId] = genDragModalStyle(prefixCls)
51
-
52
- const styles = computed(() => {
53
- return {
54
- top: getFixed(baseTop.value) + 'px',
55
- left: getFixed(baseLeft.value) + 'px',
56
- width: getFixed(baseWidth.value) + 'px',
57
- height: getFixed(baseHeight.value) + 'px'
58
- }
59
- })
60
-
61
- const getFixed = (val) => {
62
- return Number(val.toFixed(2))
63
- }
64
-
65
- const onDrag = () => {
66
- let active = false
67
- let initialX
68
- let initialY
69
- let initialWindowX
70
- let initialWindowY
71
-
72
- header.value.addEventListener('mousedown', (e) => {
73
- active = true
74
- initialX = e.clientX
75
- initialY = e.clientY
76
- initialWindowX = dialog.value.offsetLeft
77
- initialWindowY = dialog.value.offsetTop
78
- })
79
-
80
- document.addEventListener('mouseup', () => {
81
- active = false
82
- })
83
-
84
- document.addEventListener('mousemove', (e) => {
85
- if (active) {
86
- const dx = e.clientX - initialX
87
- const dy = e.clientY - initialY
88
- baseLeft.value = initialWindowX + dx
89
- baseTop.value = initialWindowY + dy
90
- }
91
- })
92
- }
93
-
94
- const handleClear = () => {
95
- document.onmouseup = () => {
96
- document.onmousemove = null
97
- document.onmouseup = null
98
- }
99
- }
100
-
101
- const rangeMove = (e, position) => {
102
- //移动的方向
103
- let x = false
104
- let y = false
105
- //移动的位置
106
- let xp = false
107
- let yp = false
108
- //移动的正负
109
- let xc = false
110
- let yc = false
111
-
112
- let disX = e.clientX
113
- let disY = e.clientY
114
-
115
- document.onmousemove = (e) => {
116
- if (position === 'drag-bottom-right') {
117
- x = true
118
- y = true
119
- } else if (position === 'drag-bottom-left') {
120
- x = true
121
- y = true
122
- xp = true
123
- xc = true
124
- } else if (position === 'drag-top-right') {
125
- x = true
126
- y = true
127
- yp = true
128
- yc = true
129
- } else if (position === 'drag-top-left') {
130
- x = true
131
- y = true
132
- xp = true
133
- xc = true
134
- yp = true
135
- yc = true
136
- }
137
-
138
- let left = e.clientX - disX
139
- let top = e.clientY - disY
140
- disX = e.clientX
141
- disY = e.clientY
142
-
143
- if (x) {
144
- let calc = left
145
- if (xc) {
146
- calc = -calc
147
- }
148
- if (xp) {
149
- baseLeft.value = baseLeft.value - calc
150
- }
151
- const width = baseWidth.value + calc
152
- baseWidth.value = width <= (props.dragRang )[0] ? (props.dragRang )[0] : width
153
- }
154
-
155
- if (y) {
156
- let calc = top
157
- if (yc) {
158
- calc = -calc
159
- }
160
- if (yp) {
161
- baseTop.value = baseTop.value - calc
162
- }
163
- const height = baseHeight.value + calc
164
- baseHeight.value = height <= (props.dragRang )[1] ? (props.dragRang )[1] : height
165
- emit('heightChange', baseHeight.value)
166
- }
167
- }
168
- handleClear()
169
- }
170
-
171
- const onCancel = () => {
172
- emit('cancel')
173
- emit('visibleChange', false)
174
- }
175
-
176
- const onOk = () => {
177
- emit('ok')
178
- emit('visibleChange', true)
179
- }
180
-
181
- onMounted(() => {
182
- if (dialog.value && header.value) {
183
- onDrag()
184
- }
185
- if (ele) {
186
- const data = _optionalChain([ele, 'optionalAccess', _ => _.getBoundingClientRect, 'call', _2 => _2()])
187
- baseLeft.value = (_optionalChain([data, 'optionalAccess', _3 => _3.right]) - baseWidth.value) / 2 || 0
188
- baseTop.value = _optionalChain([data, 'optionalAccess', _4 => _4.top]) + 200 || 0
189
- }
190
- })
191
-
192
- watch(
193
- () => props.height,
194
- () => {
195
- if (props.height > baseHeight.value) {
196
- baseHeight.value = props.height
197
- }
198
- }
199
- )
200
-
201
- return {
202
- dialog,
203
- header,
204
- styles,
205
- hashId,
206
- contextLocale,
207
- rangeMove,
208
- onCancel,
209
- onOk
210
- }
211
- }
212
- })
1
+ import { defineComponent, ref, useSlots, computed, onMounted, watch } from 'vue';
2
+ import { Button } from 'ant-design-vue';
3
+ import { useLocaleReceiver } from '../LocaleReciver/index';
4
+ import genDragModalStyle from './style';
5
+ export default defineComponent({
6
+ name: 'JDragModal',
7
+ components: {
8
+ Button
9
+ },
10
+ props: {
11
+ title: {
12
+ type: [String, Boolean],
13
+ default: ''
14
+ },
15
+ width: {
16
+ type: Number,
17
+ default: 400
18
+ },
19
+ height: {
20
+ type: Number,
21
+ default: 100
22
+ },
23
+ dragRang: {
24
+ type: [Array, Number],
25
+ default: [400, 200]
26
+ },
27
+ bodyStyle: {
28
+ type: Object,
29
+ default: () => ({})
30
+ },
31
+ footer: {
32
+ type: Boolean,
33
+ default: true
34
+ }
35
+ },
36
+ emits: ['cancel', 'heightChange', 'ok', 'visibleChange'],
37
+ setup(props, {
38
+ emit
39
+ }) {
40
+ const slots = useSlots();
41
+ const [contextLocale] = useLocaleReceiver('DragModal');
42
+ const ele = document.body;
43
+ const dialog = ref();
44
+ const header = ref();
45
+ const baseWidth = ref(props.width || 400);
46
+ const baseHeight = ref(props.height || 100);
47
+ const baseLeft = ref(100);
48
+ const baseTop = ref(100);
49
+ const prefixCls = computed(() => 'jetlinks-drag-modal');
50
+ const [wrapSSR, hashId] = genDragModalStyle(prefixCls);
51
+ const styles = computed(() => {
52
+ return {
53
+ top: getFixed(baseTop.value) + 'px',
54
+ left: getFixed(baseLeft.value) + 'px',
55
+ width: getFixed(baseWidth.value) + 'px',
56
+ height: getFixed(baseHeight.value) + 'px'
57
+ };
58
+ });
59
+ const getFixed = val => {
60
+ return Number(val.toFixed(2));
61
+ };
62
+ const onDrag = () => {
63
+ let active = false;
64
+ let initialX;
65
+ let initialY;
66
+ let initialWindowX;
67
+ let initialWindowY;
68
+ header.value.addEventListener('mousedown', e => {
69
+ active = true;
70
+ initialX = e.clientX;
71
+ initialY = e.clientY;
72
+ initialWindowX = dialog.value.offsetLeft;
73
+ initialWindowY = dialog.value.offsetTop;
74
+ });
75
+ document.addEventListener('mouseup', () => {
76
+ active = false;
77
+ });
78
+ document.addEventListener('mousemove', e => {
79
+ if (active) {
80
+ const dx = e.clientX - initialX;
81
+ const dy = e.clientY - initialY;
82
+ baseLeft.value = initialWindowX + dx;
83
+ baseTop.value = initialWindowY + dy;
84
+ }
85
+ });
86
+ };
87
+ const handleClear = () => {
88
+ document.onmouseup = () => {
89
+ document.onmousemove = null;
90
+ document.onmouseup = null;
91
+ };
92
+ };
93
+ const rangeMove = (e, position) => {
94
+ //移动的方向
95
+ let x = false;
96
+ let y = false;
97
+ //移动的位置
98
+ let xp = false;
99
+ let yp = false;
100
+ //移动的正负
101
+ let xc = false;
102
+ let yc = false;
103
+ let disX = e.clientX;
104
+ let disY = e.clientY;
105
+ document.onmousemove = e => {
106
+ if (position === 'drag-bottom-right') {
107
+ x = true;
108
+ y = true;
109
+ } else if (position === 'drag-bottom-left') {
110
+ x = true;
111
+ y = true;
112
+ xp = true;
113
+ xc = true;
114
+ } else if (position === 'drag-top-right') {
115
+ x = true;
116
+ y = true;
117
+ yp = true;
118
+ yc = true;
119
+ } else if (position === 'drag-top-left') {
120
+ x = true;
121
+ y = true;
122
+ xp = true;
123
+ xc = true;
124
+ yp = true;
125
+ yc = true;
126
+ }
127
+ let left = e.clientX - disX;
128
+ let top = e.clientY - disY;
129
+ disX = e.clientX;
130
+ disY = e.clientY;
131
+ if (x) {
132
+ let calc = left;
133
+ if (xc) {
134
+ calc = -calc;
135
+ }
136
+ if (xp) {
137
+ baseLeft.value = baseLeft.value - calc;
138
+ }
139
+ const width = baseWidth.value + calc;
140
+ baseWidth.value = width <= props.dragRang[0] ? props.dragRang[0] : width;
141
+ }
142
+ if (y) {
143
+ let calc = top;
144
+ if (yc) {
145
+ calc = -calc;
146
+ }
147
+ if (yp) {
148
+ baseTop.value = baseTop.value - calc;
149
+ }
150
+ const height = baseHeight.value + calc;
151
+ baseHeight.value = height <= props.dragRang[1] ? props.dragRang[1] : height;
152
+ emit('heightChange', baseHeight.value);
153
+ }
154
+ };
155
+ handleClear();
156
+ };
157
+ const onCancel = () => {
158
+ emit('cancel');
159
+ emit('visibleChange', false);
160
+ };
161
+ const onOk = () => {
162
+ emit('ok');
163
+ emit('visibleChange', true);
164
+ };
165
+ onMounted(() => {
166
+ if (dialog.value && header.value) {
167
+ onDrag();
168
+ }
169
+ if (ele) {
170
+ const data = ele?.getBoundingClientRect();
171
+ baseLeft.value = (data?.right - baseWidth.value) / 2 || 0;
172
+ baseTop.value = data?.top + 200 || 0;
173
+ }
174
+ });
175
+ watch(() => props.height, () => {
176
+ if (props.height > baseHeight.value) {
177
+ baseHeight.value = props.height;
178
+ }
179
+ });
180
+ return {
181
+ dialog,
182
+ header,
183
+ styles,
184
+ hashId,
185
+ contextLocale,
186
+ rangeMove,
187
+ onCancel,
188
+ onOk
189
+ };
190
+ }
191
+ });