@jetlinks-web/components 2.0.37 → 2.1.0

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 (74) hide show
  1. package/es/CardSelect/style/index.js +1 -0
  2. package/es/CheckButton/style/index.js +1 -0
  3. package/es/DragModal/DragModal.js +307 -0
  4. package/es/DragModal/index.js +5 -0
  5. package/es/DragModal/style/index.css +81 -0
  6. package/es/DragModal/style/index.js +1 -0
  7. package/es/DragModal/style/index.less +96 -0
  8. package/es/EditTable/Body.js +368 -0
  9. package/es/EditTable/EditTable.js +412 -0
  10. package/es/EditTable/Header.js +242 -0
  11. package/es/EditTable/components/ContextMenu/Menu.js +154 -0
  12. package/es/EditTable/components/ContextMenu/index.js +81 -0
  13. package/es/EditTable/components/Search/Search.js +290 -0
  14. package/es/EditTable/components/Search/index.js +1 -0
  15. package/es/EditTable/consts.js +7 -0
  16. package/es/EditTable/hooks/index.js +40 -0
  17. package/es/EditTable/hooks/useResizeObserver.js +31 -0
  18. package/es/EditTable/hooks/useValidate.js +87 -0
  19. package/es/EditTable/index.js +9 -0
  20. package/es/EditTable/props.js +50 -0
  21. package/es/EditTable/style/body.less +76 -0
  22. package/es/EditTable/style/header.less +77 -0
  23. package/es/EditTable/style/index.css +214 -0
  24. package/es/EditTable/style/index.js +1 -0
  25. package/es/EditTable/style/index.less +38 -0
  26. package/es/EditTable/style/table.less +42 -0
  27. package/es/EditTable/utils.js +97 -0
  28. package/es/Ellipsis/style/index.js +1 -0
  29. package/es/FullPage/FullPage.js +1 -1
  30. package/es/Search/Advanced/SaveHistory.js +1 -1
  31. package/es/Search/Item.js +1 -1
  32. package/es/Search/Search.js +1 -1
  33. package/es/components.js +3 -1
  34. package/es/style/index.css +287 -0
  35. package/es/style/index.less +9 -7
  36. package/es/style.js +3 -1
  37. package/lib/CardSelect/style/index.js +3 -0
  38. package/lib/CheckButton/style/index.js +3 -0
  39. package/lib/DragModal/DragModal.js +307 -0
  40. package/lib/DragModal/index.js +12 -0
  41. package/lib/DragModal/style/index.css +81 -0
  42. package/lib/DragModal/style/index.js +3 -0
  43. package/lib/DragModal/style/index.less +96 -0
  44. package/lib/EditTable/Body.js +368 -0
  45. package/lib/EditTable/EditTable.js +412 -0
  46. package/lib/EditTable/Header.js +242 -0
  47. package/lib/EditTable/components/ContextMenu/Menu.js +154 -0
  48. package/lib/EditTable/components/ContextMenu/index.js +88 -0
  49. package/lib/EditTable/components/Search/Search.js +290 -0
  50. package/lib/EditTable/components/Search/index.js +13 -0
  51. package/lib/EditTable/consts.js +13 -0
  52. package/lib/EditTable/hooks/index.js +79 -0
  53. package/lib/EditTable/hooks/useResizeObserver.js +38 -0
  54. package/lib/EditTable/hooks/useValidate.js +94 -0
  55. package/lib/EditTable/index.js +16 -0
  56. package/lib/EditTable/props.js +56 -0
  57. package/lib/EditTable/style/body.less +76 -0
  58. package/lib/EditTable/style/header.less +77 -0
  59. package/lib/EditTable/style/index.css +214 -0
  60. package/lib/EditTable/style/index.js +3 -0
  61. package/lib/EditTable/style/index.less +38 -0
  62. package/lib/EditTable/style/table.less +42 -0
  63. package/lib/EditTable/utils.js +104 -0
  64. package/lib/Ellipsis/style/index.js +3 -0
  65. package/lib/FullPage/FullPage.js +1 -1
  66. package/lib/Search/Advanced/SaveHistory.js +1 -1
  67. package/lib/Search/Item.js +1 -1
  68. package/lib/Search/Search.js +1 -1
  69. package/lib/components.js +14 -0
  70. package/lib/style/components.less +2 -0
  71. package/lib/style/index.css +287 -0
  72. package/lib/style/index.less +9 -7
  73. package/lib/style.js +3 -1
  74. package/package.json +3 -1
@@ -0,0 +1 @@
1
+ import './index.less';
@@ -0,0 +1 @@
1
+ import './index.less';
@@ -0,0 +1,307 @@
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
+ "title": "props",
19
+ "width": "props",
20
+ "height": "props",
21
+ "dragRang": "props",
22
+ "bodyStyle": "props",
23
+ "footer": "props",
24
+ "ref": "setup-const",
25
+ "useSlots": "setup-const",
26
+ "defineOptions": "setup-const",
27
+ "computed": "setup-const",
28
+ "onMounted": "setup-const",
29
+ "watch": "setup-const",
30
+ "Button": "setup-maybe-ref",
31
+ "props": "setup-reactive-const",
32
+ "emits": "setup-const",
33
+ "slots": "setup-maybe-ref",
34
+ "ele": "setup-maybe-ref",
35
+ "dialog": "setup-ref",
36
+ "header": "setup-ref",
37
+ "baseWidth": "setup-ref",
38
+ "baseHeight": "setup-ref",
39
+ "baseLeft": "setup-ref",
40
+ "baseTop": "setup-ref",
41
+ "styles": "setup-ref",
42
+ "getFixed": "setup-const",
43
+ "onDrag": "setup-const",
44
+ "handleClear": "setup-const",
45
+ "rangeMove": "setup-const",
46
+ "onCancel": "setup-const",
47
+ "onOk": "setup-const"
48
+ } */
49
+ import { defineComponent as _defineComponent } from 'vue';
50
+ import { 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, unref as _unref, Transition as _Transition } from "vue";
51
+ const _hoisted_1 = {
52
+ key: 0,
53
+ class: "header"
54
+ };
55
+ const _hoisted_2 = {
56
+ key: 1,
57
+ class: "jetlinks-drag-modal-footer"
58
+ };
59
+ import { ref, useSlots, computed, onMounted, watch } from 'vue';
60
+ import { Button } from 'ant-design-vue';
61
+ const __sfc_main__ = _defineComponent({
62
+ ...{
63
+ name: 'JDragModal'
64
+ },
65
+ props: {
66
+ title: {
67
+ type: [String, Boolean],
68
+ default: ''
69
+ },
70
+ width: {
71
+ type: Number,
72
+ default: 400
73
+ },
74
+ height: {
75
+ type: Number,
76
+ default: 100
77
+ },
78
+ dragRang: {
79
+ type: [Array, Number],
80
+ default: [400, 200]
81
+ },
82
+ bodyStyle: {
83
+ type: Object,
84
+ default: () => ({})
85
+ },
86
+ footer: {
87
+ type: Boolean,
88
+ default: true
89
+ }
90
+ },
91
+ emits: ['cancel', 'heightChange', 'ok', 'visibleChange'],
92
+ setup(__props, { emit: __emit }) {
93
+ const props = __props;
94
+ const emits = __emit;
95
+ const slots = useSlots();
96
+ const ele = document.body;
97
+ const dialog = ref();
98
+ const header = ref();
99
+ const baseWidth = ref(props.width || 400);
100
+ const baseHeight = ref(props.height || 100);
101
+ const baseLeft = ref(100);
102
+ const baseTop = ref(100);
103
+ const styles = computed(() => {
104
+ return {
105
+ top: getFixed(baseTop.value) + 'px',
106
+ left: getFixed(baseLeft.value) + 'px',
107
+ width: getFixed(baseWidth.value) + 'px',
108
+ height: getFixed(baseHeight.value) + 'px'
109
+ };
110
+ });
111
+ const getFixed = (val) => {
112
+ return Number(val.toFixed(2));
113
+ };
114
+ const onDrag = () => {
115
+ let active = false;
116
+ let initialX;
117
+ let initialY;
118
+ let initialWindowX;
119
+ let initialWindowY;
120
+ header.value.addEventListener('mousedown', (e) => {
121
+ active = true;
122
+ initialX = e.clientX;
123
+ initialY = e.clientY;
124
+ initialWindowX = dialog.value.offsetLeft;
125
+ initialWindowY = dialog.value.offsetTop;
126
+ });
127
+ document.addEventListener('mouseup', () => {
128
+ active = false;
129
+ });
130
+ document.addEventListener('mousemove', (e) => {
131
+ if (active) {
132
+ const dx = e.clientX - initialX;
133
+ const dy = e.clientY - initialY;
134
+ baseLeft.value = initialWindowX + dx;
135
+ baseTop.value = initialWindowY + dy;
136
+ }
137
+ });
138
+ };
139
+ const handleClear = () => {
140
+ document.onmouseup = () => {
141
+ document.onmousemove = null;
142
+ document.onmouseup = null;
143
+ };
144
+ };
145
+ const rangeMove = (e, position) => {
146
+ //移动的方向
147
+ let x = false;
148
+ let y = false;
149
+ //移动的位置
150
+ let xp = false;
151
+ let yp = false;
152
+ //移动的正负
153
+ let xc = false;
154
+ let yc = false;
155
+ let disX = e.clientX;
156
+ let disY = e.clientY;
157
+ document.onmousemove = e => {
158
+ if (position === 'drag-bottom-right') {
159
+ x = true;
160
+ y = true;
161
+ }
162
+ else if (position === 'drag-bottom-left') {
163
+ x = true;
164
+ y = true;
165
+ xp = true;
166
+ xc = true;
167
+ }
168
+ else if (position === 'drag-top-right') {
169
+ x = true;
170
+ y = true;
171
+ yp = true;
172
+ yc = true;
173
+ }
174
+ else if (position === 'drag-top-left') {
175
+ x = true;
176
+ y = true;
177
+ xp = true;
178
+ xc = true;
179
+ yp = true;
180
+ yc = true;
181
+ }
182
+ let left = e.clientX - disX;
183
+ let top = e.clientY - disY;
184
+ disX = e.clientX;
185
+ disY = e.clientY;
186
+ if (x) {
187
+ let calc = left;
188
+ if (xc) {
189
+ calc = -calc;
190
+ }
191
+ if (xp) {
192
+ baseLeft.value = baseLeft.value - calc;
193
+ }
194
+ const width = baseWidth.value + calc;
195
+ baseWidth.value = width <= props.dragRang[0] ? props.dragRang[0] : width;
196
+ }
197
+ if (y) {
198
+ let calc = top;
199
+ if (yc) {
200
+ calc = -calc;
201
+ }
202
+ if (yp) {
203
+ baseTop.value = baseTop.value - calc;
204
+ }
205
+ const height = baseHeight.value + calc;
206
+ baseHeight.value = height <= props.dragRang[1] ? props.dragRang[1] : height;
207
+ emits('heightChange', baseHeight.value);
208
+ }
209
+ };
210
+ handleClear();
211
+ };
212
+ const onCancel = () => {
213
+ emits("cancel");
214
+ emits('visibleChange', false);
215
+ };
216
+ const onOk = () => {
217
+ emits("ok");
218
+ emits('visibleChange', true);
219
+ };
220
+ onMounted(() => {
221
+ if (dialog.value && header.value) {
222
+ onDrag();
223
+ }
224
+ if (ele) {
225
+ const data = _optionalChain([ele, 'optionalAccess', _2 => _2.getBoundingClientRect, 'call', _3 => _3()]);
226
+ baseLeft.value = (_optionalChain([data, 'optionalAccess', _4 => _4.right]) - baseWidth.value) / 2 || 0;
227
+ baseTop.value = _optionalChain([data, 'optionalAccess', _5 => _5.top]) + 200 || 0;
228
+ }
229
+ });
230
+ watch(() => props.height, () => {
231
+ if (props.height > baseHeight.value) {
232
+ baseHeight.value = props.height;
233
+ }
234
+ });
235
+ return (_ctx, _cache) => {
236
+ const _component_AIcon = _resolveComponent("AIcon");
237
+ const _component_a_button = _resolveComponent("a-button");
238
+ return (_openBlock(), _createElementBlock("div", {
239
+ ref_key: "dialog",
240
+ ref: dialog,
241
+ style: _normalizeStyle(styles.value),
242
+ class: "jetlinks-drag-modal"
243
+ }, [
244
+ _createVNode(_Transition, { name: "dialog" }, {
245
+ default: _withCtx(() => [
246
+ _createElementVNode("div", {
247
+ class: "jetlinks-drag-modal-sprite",
248
+ ref_key: "header",
249
+ ref: header
250
+ }, [
251
+ (__props.title !== false)
252
+ ? (_openBlock(), _createElementBlock("div", _hoisted_1, [
253
+ _createElementVNode("span", null, _toDisplayString(__props.title), 1 /* TEXT */),
254
+ _createVNode(_component_a_button, {
255
+ size: "small",
256
+ type: "text",
257
+ onClick: _withModifiers(onCancel, ["stop"])
258
+ }, {
259
+ default: _withCtx(() => [
260
+ _createVNode(_component_AIcon, { type: "CloseOutlined" })
261
+ ]),
262
+ _: 1 /* STABLE */
263
+ })
264
+ ]))
265
+ : _createCommentVNode("v-if", true),
266
+ _createElementVNode("div", {
267
+ class: "jetlinks-drag-modal-body",
268
+ style: _normalizeStyle(__props.bodyStyle)
269
+ }, [
270
+ _renderSlot(_ctx.$slots, "default")
271
+ ], 4 /* STYLE */),
272
+ (__props.footer !== false)
273
+ ? (_openBlock(), _createElementBlock("div", _hoisted_2, [
274
+ _renderSlot(_ctx.$slots, "footer", {}, () => [
275
+ _createVNode(_unref(Button), {
276
+ onClick: _withModifiers(onCancel, ["stop"])
277
+ }, {
278
+ default: _withCtx(() => [
279
+ _createTextVNode("取消")
280
+ ]),
281
+ _: 1 /* STABLE */
282
+ }),
283
+ _createVNode(_unref(Button), {
284
+ type: "primary",
285
+ onClick: _withModifiers(onOk, ["stop"])
286
+ }, {
287
+ default: _withCtx(() => [
288
+ _createTextVNode("确认")
289
+ ]),
290
+ _: 1 /* STABLE */
291
+ })
292
+ ])
293
+ ]))
294
+ : _createCommentVNode("v-if", true)
295
+ ], 512 /* NEED_PATCH */)
296
+ ]),
297
+ _: 3 /* FORWARDED */
298
+ }),
299
+ _createElementVNode("div", {
300
+ class: "jetlinks-drag-modal-range drag-bottom-right",
301
+ onMousedown: _cache[0] || (_cache[0] = _withModifiers(($event) => (rangeMove($event, "drag-bottom-right")), ["stop"]))
302
+ }, null, 32 /* NEED_HYDRATION */)
303
+ ], 4 /* STYLE */));
304
+ };
305
+ }
306
+ });
307
+ export default __sfc_main__;
@@ -0,0 +1,5 @@
1
+ import DragModal from "./DragModal.js";
2
+ DragModal.install = function (app) {
3
+ app.component(DragModal.name, DragModal);
4
+ };
5
+ export default DragModal;
@@ -0,0 +1,81 @@
1
+ /* stylelint-disable at-rule-empty-line-before,at-rule-name-space-after,at-rule-no-unknown */
2
+ /* stylelint-disable no-duplicate-selectors */
3
+ /* stylelint-disable */
4
+ /* stylelint-disable declaration-bang-space-before,no-duplicate-selectors,string-no-newline */
5
+ .dialog-enter-active,
6
+ .dialog-leave-active {
7
+ transition: opacity 0.5s;
8
+ }
9
+ .dialog-enter,
10
+ .dialog-leave-to {
11
+ opacity: 0;
12
+ }
13
+ .jetlinks-drag-modal {
14
+ position: fixed;
15
+ z-index: 1000;
16
+ }
17
+ .jetlinks-drag-modal .jetlinks-drag-modal-sprite {
18
+ position: absolute;
19
+ width: 100%;
20
+ height: 100%;
21
+ display: flex;
22
+ flex-direction: column;
23
+ overflow: hidden;
24
+ z-index: 23456765435;
25
+ background-color: #ffffff;
26
+ border-radius: 4px;
27
+ border: 1px solid #91CAFF;
28
+ box-shadow: 0 3px 8px 0 rgba(22, 119, 255, 0.24);
29
+ }
30
+ .jetlinks-drag-modal .jetlinks-drag-modal-sprite .header {
31
+ padding: 5px 15px;
32
+ font-size: 18px;
33
+ font-weight: 700;
34
+ color: #333;
35
+ display: flex;
36
+ justify-content: space-between;
37
+ align-items: center;
38
+ border-bottom: 1px solid #f0f0f0;
39
+ cursor: move;
40
+ }
41
+ .jetlinks-drag-modal .jetlinks-drag-modal-sprite .jetlinks-drag-modal-body {
42
+ flex: 1;
43
+ min-height: 0;
44
+ overflow-y: auto;
45
+ padding: 24px 20px;
46
+ }
47
+ .jetlinks-drag-modal .jetlinks-drag-modal-sprite .jetlinks-drag-modal-footer {
48
+ border-top: 1px solid #f0f0f0;
49
+ padding: 5px 15px;
50
+ }
51
+ .jetlinks-drag-modal .jetlinks-drag-modal-range {
52
+ position: absolute;
53
+ width: 16px;
54
+ height: 16px;
55
+ border-radius: 100%;
56
+ z-index: 23456765436;
57
+ }
58
+ .jetlinks-drag-modal .jetlinks-drag-modal-range .drag-bottom-right:hover,
59
+ .jetlinks-drag-modal .jetlinks-drag-modal-range .drag-top-left:hover {
60
+ cursor: nwse-resize;
61
+ }
62
+ .jetlinks-drag-modal .jetlinks-drag-modal-range .drag-bottom-left:hover,
63
+ .jetlinks-drag-modal .jetlinks-drag-modal-range .drag-top-right:hover {
64
+ cursor: nesw-resize;
65
+ }
66
+ .jetlinks-drag-modal .jetlinks-drag-modal-range .drag-top-right {
67
+ top: -6px;
68
+ right: -6px;
69
+ }
70
+ .jetlinks-drag-modal .jetlinks-drag-modal-range .drag-top-left {
71
+ top: -6px;
72
+ left: -6px;
73
+ }
74
+ .jetlinks-drag-modal .jetlinks-drag-modal-range .drag-bottom-right {
75
+ bottom: -6px;
76
+ right: -6px;
77
+ }
78
+ .jetlinks-drag-modal .jetlinks-drag-modal-range .drag-bottom-left {
79
+ bottom: -6px;
80
+ left: -6px;
81
+ }
@@ -0,0 +1 @@
1
+ import './index.less';
@@ -0,0 +1,96 @@
1
+ @import "ant-design-vue/es/style/themes/index.less";
2
+ @boxColor: rgb(@primary-color);
3
+
4
+ // 弹窗动画
5
+ .dialog-enter-active,
6
+ .dialog-leave-active {
7
+ transition: opacity .5s;
8
+ }
9
+
10
+ .dialog-enter,
11
+ .dialog-leave-to {
12
+ opacity: 0;
13
+ }
14
+
15
+ .jetlinks-drag-modal {
16
+ position: fixed;
17
+ z-index: 1000;
18
+
19
+ .jetlinks-drag-modal-sprite {
20
+ position: absolute;
21
+ width: 100%;
22
+ height: 100%;
23
+ display: flex;
24
+ flex-direction: column;
25
+ overflow: hidden;
26
+ z-index: 23456765435;
27
+ background-color: #ffffff;
28
+ border-radius: 4px;
29
+ border: 1px solid #91CAFF;
30
+ box-shadow: 0 3px 8px 0 rgba(#1677FF, 0.24);
31
+
32
+ .header {
33
+ padding: 5px 15px;
34
+ font-size: 18px;
35
+ font-weight: 700;
36
+ color: #333;
37
+ display: flex;
38
+ justify-content: space-between;
39
+ align-items: center;
40
+ border-bottom: 1px solid #f0f0f0;
41
+ cursor: move;
42
+ }
43
+
44
+ .jetlinks-drag-modal-body {
45
+ flex: 1;
46
+ min-height: 0;
47
+ overflow-y: auto;
48
+ padding: 24px 20px;
49
+ }
50
+
51
+ .jetlinks-drag-modal-footer {
52
+ border-top: 1px solid #f0f0f0;
53
+ padding: 5px 15px;
54
+ }
55
+ }
56
+
57
+ .jetlinks-drag-modal-range {
58
+ position: absolute;
59
+ width: 16px;
60
+ height: 16px;
61
+ border-radius: 100%;
62
+ z-index: 23456765436;
63
+
64
+ .drag-bottom-right, .drag-top-left {
65
+ &:hover {
66
+ cursor: nwse-resize
67
+ }
68
+ }
69
+
70
+ .drag-bottom-left, .drag-top-right {
71
+ &:hover {
72
+ cursor: nesw-resize
73
+ }
74
+ }
75
+
76
+ .drag-top-right {
77
+ top: -6px;
78
+ right: -6px;
79
+ }
80
+
81
+ .drag-top-left {
82
+ top: -6px;
83
+ left: -6px;
84
+ }
85
+
86
+ .drag-bottom-right {
87
+ bottom: -6px;
88
+ right: -6px;
89
+ }
90
+
91
+ .drag-bottom-left {
92
+ bottom: -6px;
93
+ left: -6px;
94
+ }
95
+ }
96
+ }