fangguo-component 1.1.2 → 1.1.4
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.
- package/dist/ArgHover.css +20 -1
- package/dist/ArgHover.vue_vue_type_style_index_0_lang-CSymSDRl.js +56 -0
- package/dist/ButtonGroup-DqViorHX.js +134 -0
- package/dist/ButtonGroup.css +35 -1
- package/dist/CitySelect.vue_vue_type_script_setup_true_lang-DZp6834K.js +224 -0
- package/dist/ContentTitle-By0Zk1u7.js +30 -0
- package/dist/ContentTitle.css +6 -1
- package/dist/CustomInputV2-BqhBSO53.js +157 -0
- package/dist/CustomInputV2.css +5 -1
- package/dist/CustomMultipleInput-DRMTUtkE.js +125 -0
- package/dist/CustomMultipleInput.css +8 -1
- package/dist/DragResizable.css +126 -1
- package/dist/DragResizable.vue_vue_type_style_index_0_lang-BePpQHve.js +331 -0
- package/dist/DragSort-5WetnkmW.js +98 -0
- package/dist/DragSort.css +5 -1
- package/dist/ErrorImage-Ao9kEEUg.js +36 -0
- package/dist/ErrorImage.css +4 -1
- package/dist/FgCascader.css +37 -1
- package/dist/FgCascader.vue_vue_type_style_index_0_lang-CM8FxFLJ.js +2424 -0
- package/dist/HSelect-BFkWiCFi.js +671 -0
- package/dist/HSelect.css +80 -1
- package/dist/HSelectAll.vue_vue_type_script_setup_true_lang-BZX7ch2I.js +50 -0
- package/dist/HSelectSJ-DZmtdyjF.js +671 -0
- package/dist/HSelectSJ.css +88 -1
- package/dist/IdentifyAddress.vue_vue_type_script_setup_true_lang-BCIOF-Oy.js +5202 -0
- package/dist/ImageLoupe.vue_vue_type_script_setup_true_lang-BaXHYlDu.js +92 -0
- package/dist/LazyComponent.vue_vue_type_script_setup_true_lang-D5KGqlj4.js +107 -0
- package/dist/LazyPopover.vue_vue_type_script_setup_true_lang-B2vtU4f4.js +34 -0
- package/dist/LoadingBtn-DWm2cY9k.js +87 -0
- package/dist/LoadingBtn.css +12 -1
- package/dist/MInput-s_P63myh.js +114 -0
- package/dist/MInput.css +21 -1
- package/dist/MyTable-CHvxPYgk.js +94 -0
- package/dist/MyTable.css +33 -1
- package/dist/NoRender.vue_vue_type_script_setup_true_lang-B0G6jxPg.js +31 -0
- package/dist/SelectAddress-CCepDxu8.js +254 -0
- package/dist/SelectAddress.css +18 -1
- package/dist/SelectAll.vue_vue_type_script_setup_true_lang-CyzY8ams.js +101 -0
- package/dist/SelectAll2.vue_vue_type_script_setup_true_lang-CrsaohxU.js +103 -0
- package/dist/SelectCustomAll.css +8 -1
- package/dist/SelectCustomAll.vue_vue_type_style_index_0_lang-BEZwlGXa.js +111 -0
- package/dist/SelectTimePicker.vue_vue_type_script_setup_true_lang-Dk4TpTBN.js +48 -0
- package/dist/SelectTree-DHbWogEU.js +1276 -0
- package/dist/SelectTree.css +74 -1
- package/dist/SvgIcon-DIg0upEk.js +33 -0
- package/dist/TextCopy-th0FAxwl.js +44 -0
- package/dist/TextCopy.css +7 -1
- package/dist/TextEllipsisTooltip.vue_vue_type_script_setup_true_lang-DVE1CxPm.js +174 -0
- package/dist/VirtualTable-Cm_L7q9W.js +703 -0
- package/dist/VirtualTable.css +185 -1
- package/dist/_commonjsHelpers-DnzVkjQg.js +38 -0
- package/dist/_plugin-vue_export-helper-1tPrXgE0.js +10 -0
- package/dist/common-B1nSpTGn.js +9669 -0
- package/dist/components/VirtualTable/index.js +2 -2
- package/dist/components/argHover/index.js +2 -2
- package/dist/components/buttonGroup/index.js +2 -2
- package/dist/components/cascader/index.js +2 -2
- package/dist/components/citySelect/index.js +2 -2
- package/dist/components/contentTitle/index.js +2 -2
- package/dist/components/customInputV2/index.js +2 -2
- package/dist/components/customMultipleInput/index.js +2 -2
- package/dist/components/dragResizable/index.js +2 -2
- package/dist/components/dragSort/index.js +2 -2
- package/dist/components/errorImage/index.js +2 -2
- package/dist/components/hSelect/index.js +2 -2
- package/dist/components/hSelectAll/index.js +2 -2
- package/dist/components/hSelectSJ/index.js +2 -2
- package/dist/components/identifyAddress/index.js +2 -2
- package/dist/components/imageLoupe/index.js +2 -2
- package/dist/components/index.js +62 -62
- package/dist/components/lazyComponent/index.js +2 -2
- package/dist/components/lazyPopover/index.js +2 -2
- package/dist/components/loadingBtn/index.js +2 -2
- package/dist/components/mInput/index.js +2 -2
- package/dist/components/myTable/index.js +2 -2
- package/dist/components/noRender/index.js +2 -2
- package/dist/components/selectAddress/index.js +2 -2
- package/dist/components/selectAll/index.js +2 -2
- package/dist/components/selectAll2/index.js +2 -2
- package/dist/components/selectCustomAll/index.js +2 -2
- package/dist/components/selectTimePicker/index.js +2 -2
- package/dist/components/selectTree/index.js +2 -2
- package/dist/components/svgIcon/index.js +2 -2
- package/dist/components/textCopy/index.js +2 -2
- package/dist/components/textEllipsisTooltip/index.js +2 -2
- package/dist/dateShortcuts-DjFC_Txu.js +27 -0
- package/dist/directive/index.js +2 -2
- package/dist/directive/loading/index.js +2 -2
- package/dist/hooks/index.js +2 -2
- package/dist/hooks/usePagination/index.js +2 -2
- package/dist/index-BPnixsfc.js +103 -0
- package/dist/index-C9zyi90j.js +165 -0
- package/dist/index-CSMWzzp0.js +8 -0
- package/dist/index-DfQiknXJ.js +8 -0
- package/dist/index-DzdLpetc.js +29184 -0
- package/dist/index-uQXqC9BF.js +68 -0
- package/dist/index.css +1 -1
- package/dist/index.js +204 -194
- package/dist/loading-CGrVcnNl.js +47 -0
- package/dist/loading.css +110 -1
- package/dist/tools/ImageParserUtils/index.js +17239 -9074
- package/dist/tools/common/index.js +86 -86
- package/dist/tools/index.js +95 -95
- package/dist/usePagination-C63IRXjZ.js +29 -0
- package/dist/vue-virtual-scroller.esm-ZgBoGAjX.js +1507 -0
- package/package.json +1 -1
- package/dist/ArgHover.vue_vue_type_style_index_0_lang-CMhRP09M.js +0 -54
- package/dist/ButtonGroup-C0yZEkxK.js +0 -103
- package/dist/CitySelect.vue_vue_type_script_setup_true_lang-8EbHD3Nt.js +0 -159
- package/dist/ContentTitle-mqrusLjx.js +0 -24
- package/dist/CustomInputV2-uARhbFc8.js +0 -135
- package/dist/CustomMultipleInput-DDaqoHVU.js +0 -109
- package/dist/DragResizable.vue_vue_type_style_index_0_lang-CHv0gJmo.js +0 -179
- package/dist/DragSort-CfDeFAIG.js +0 -66
- package/dist/ErrorImage-CTP_5sal.js +0 -32
- package/dist/FgCascader.vue_vue_type_style_index_0_lang-BUZDDcVn.js +0 -1656
- package/dist/HSelect-Drf6YBwO.js +0 -468
- package/dist/HSelectAll.vue_vue_type_script_setup_true_lang-Blq9xpfa.js +0 -36
- package/dist/HSelectSJ-D3GrXmvj.js +0 -462
- package/dist/IdentifyAddress.vue_vue_type_script_setup_true_lang-BJheMI1q.js +0 -4743
- package/dist/ImageLoupe.vue_vue_type_script_setup_true_lang-BlX4VbRi.js +0 -79
- package/dist/LazyComponent.vue_vue_type_script_setup_true_lang-vNk68D8E.js +0 -82
- package/dist/LazyPopover.vue_vue_type_script_setup_true_lang-DcOrcH0T.js +0 -33
- package/dist/LoadingBtn-BhbhNboo.js +0 -66
- package/dist/MInput-CpoW17Wh.js +0 -101
- package/dist/MyTable-DmwyEVJb.js +0 -68
- package/dist/NoRender.vue_vue_type_script_setup_true_lang-Do36nSsV.js +0 -30
- package/dist/SelectAddress-B4oK5erq.js +0 -173
- package/dist/SelectAll.vue_vue_type_script_setup_true_lang-BC3q2U8f.js +0 -79
- package/dist/SelectAll2.vue_vue_type_script_setup_true_lang-CaET5eli.js +0 -74
- package/dist/SelectCustomAll.vue_vue_type_style_index_0_lang-_wCRO217.js +0 -83
- package/dist/SelectTimePicker.vue_vue_type_script_setup_true_lang-Bj0KMOKv.js +0 -45
- package/dist/SelectTree-Dm5259kY.js +0 -911
- package/dist/SvgIcon-C2ah8E0Z.js +0 -30
- package/dist/TextCopy-hOj-Wj2H.js +0 -41
- package/dist/TextEllipsisTooltip.vue_vue_type_script_setup_true_lang-aZbEQmbM.js +0 -112
- package/dist/VirtualTable-BWugJiQ5.js +0 -349
- package/dist/_commonjsHelpers-ByYUsBRP.js +0 -33
- package/dist/_plugin-vue_export-helper-CHgC5LLL.js +0 -9
- package/dist/common-BIEgCXbl.js +0 -7030
- package/dist/dateShortcuts-DDPtAhDI.js +0 -26
- package/dist/index-BRcBDlVs.js +0 -68
- package/dist/index-CeWudY6u.js +0 -8
- package/dist/index-DIX8TpoT.js +0 -118
- package/dist/index-DpPsTMp0.js +0 -8
- package/dist/index-epuVZjZV.js +0 -103
- package/dist/index-uf7oyYDF.js +0 -16847
- package/dist/loading-DJVNc0eN.js +0 -36
- package/dist/usePagination-CwShBEjA.js +0 -20
- package/dist/vue-virtual-scroller.esm-CH-jx4ri.js +0 -1051
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { ElInput, ElDialog, ElButton } from "element-plus/es";
|
|
2
|
+
import { defineComponent, ref, watch, openBlock, createElementBlock, createVNode, withKeys, createSlots, withCtx, createElementVNode, createTextVNode, createCommentVNode } from "vue";
|
|
3
|
+
import { _ as _export_sfc } from "./_plugin-vue_export-helper-1tPrXgE0.js";
|
|
4
|
+
import './CustomMultipleInput.css';const _hoisted_1 = { class: "w-full" };
|
|
5
|
+
const _hoisted_2 = { key: 0 };
|
|
6
|
+
const _hoisted_3 = { class: "pt-[24px] pb-[12px]" };
|
|
7
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
8
|
+
__name: "CustomMultipleInput",
|
|
9
|
+
props: {
|
|
10
|
+
name: {
|
|
11
|
+
type: String,
|
|
12
|
+
default: "请输入"
|
|
13
|
+
},
|
|
14
|
+
modelValue: {
|
|
15
|
+
type: String,
|
|
16
|
+
required: true
|
|
17
|
+
},
|
|
18
|
+
multiple: {
|
|
19
|
+
type: Boolean,
|
|
20
|
+
default: true
|
|
21
|
+
},
|
|
22
|
+
clear: {
|
|
23
|
+
type: Boolean,
|
|
24
|
+
default: true
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
emits: ["update:modelValue", "enter"],
|
|
28
|
+
setup(__props, { emit: __emit }) {
|
|
29
|
+
const props = __props;
|
|
30
|
+
const emit = __emit;
|
|
31
|
+
const inputValue = ref("");
|
|
32
|
+
watch(() => props.modelValue, (e) => inputValue.value = e, { immediate: true });
|
|
33
|
+
const inputChange = (e) => emit("update:modelValue", e);
|
|
34
|
+
const moreValue = ref("");
|
|
35
|
+
const moreShow = ref(false);
|
|
36
|
+
const open = () => {
|
|
37
|
+
moreValue.value = inputValue.value;
|
|
38
|
+
moreShow.value = true;
|
|
39
|
+
};
|
|
40
|
+
const save = () => {
|
|
41
|
+
emit("update:modelValue", moreValue.value);
|
|
42
|
+
moreShow.value = false;
|
|
43
|
+
};
|
|
44
|
+
const search = () => emit("enter");
|
|
45
|
+
return (_ctx, _cache) => {
|
|
46
|
+
const _component_el_input = ElInput;
|
|
47
|
+
const _component_el_button = ElButton;
|
|
48
|
+
const _component_el_dialog = ElDialog;
|
|
49
|
+
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
50
|
+
createVNode(_component_el_input, {
|
|
51
|
+
class: "custom-input",
|
|
52
|
+
modelValue: inputValue.value,
|
|
53
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => inputValue.value = $event),
|
|
54
|
+
placeholder: `${__props.name}${__props.multiple ? ",多个用逗号或空格分隔" : ""}`,
|
|
55
|
+
clearable: "",
|
|
56
|
+
onChange: inputChange,
|
|
57
|
+
onKeydown: withKeys(search, ["enter"])
|
|
58
|
+
}, createSlots({ _: 2 }, [
|
|
59
|
+
__props.multiple ? {
|
|
60
|
+
name: "append",
|
|
61
|
+
fn: withCtx(() => [
|
|
62
|
+
createElementVNode("span", { onClick: open }, "•••")
|
|
63
|
+
]),
|
|
64
|
+
key: "0"
|
|
65
|
+
} : void 0
|
|
66
|
+
]), 1032, ["modelValue", "placeholder"]),
|
|
67
|
+
__props.multiple ? (openBlock(), createElementBlock("div", _hoisted_2, [
|
|
68
|
+
createVNode(_component_el_dialog, {
|
|
69
|
+
class: "order-dialog",
|
|
70
|
+
modelValue: moreShow.value,
|
|
71
|
+
"onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => moreShow.value = $event),
|
|
72
|
+
width: "480px",
|
|
73
|
+
title: __props.name,
|
|
74
|
+
"align-center": "",
|
|
75
|
+
draggable: "",
|
|
76
|
+
"close-on-click-modal": false
|
|
77
|
+
}, {
|
|
78
|
+
footer: withCtx(() => [
|
|
79
|
+
createElementVNode("div", _hoisted_3, [
|
|
80
|
+
createVNode(_component_el_button, {
|
|
81
|
+
type: "info",
|
|
82
|
+
plain: "",
|
|
83
|
+
onClick: _cache[2] || (_cache[2] = ($event) => moreShow.value = false)
|
|
84
|
+
}, {
|
|
85
|
+
default: withCtx(() => [..._cache[4] || (_cache[4] = [
|
|
86
|
+
createTextVNode("取消", -1)
|
|
87
|
+
])]),
|
|
88
|
+
_: 1
|
|
89
|
+
}),
|
|
90
|
+
createVNode(_component_el_button, {
|
|
91
|
+
class: "!ml-[14px]",
|
|
92
|
+
type: "primary",
|
|
93
|
+
onClick: save
|
|
94
|
+
}, {
|
|
95
|
+
default: withCtx(() => [..._cache[5] || (_cache[5] = [
|
|
96
|
+
createTextVNode("确认", -1)
|
|
97
|
+
])]),
|
|
98
|
+
_: 1
|
|
99
|
+
})
|
|
100
|
+
])
|
|
101
|
+
]),
|
|
102
|
+
default: withCtx(() => [
|
|
103
|
+
_cache[6] || (_cache[6] = createElementVNode("div", {
|
|
104
|
+
class: "py-[12px] text-fill-900",
|
|
105
|
+
style: { "font-family": "MicrosoftYaHei, sans-serif" }
|
|
106
|
+
}, " 多个值以逗号隔开或空格隔开 ", -1)),
|
|
107
|
+
createVNode(_component_el_input, {
|
|
108
|
+
modelValue: moreValue.value,
|
|
109
|
+
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => moreValue.value = $event),
|
|
110
|
+
type: "textarea",
|
|
111
|
+
autosize: { minRows: 3, maxRows: 5 },
|
|
112
|
+
placeholder: "多个用逗号或空格分隔"
|
|
113
|
+
}, null, 8, ["modelValue"])
|
|
114
|
+
]),
|
|
115
|
+
_: 1
|
|
116
|
+
}, 8, ["modelValue", "title"])
|
|
117
|
+
])) : createCommentVNode("", true)
|
|
118
|
+
]);
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
const CustomMultipleInput = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-5686d705"]]);
|
|
123
|
+
export {
|
|
124
|
+
CustomMultipleInput as C
|
|
125
|
+
};
|
|
@@ -1 +1,8 @@
|
|
|
1
|
-
.custom-input[data-v-5686d705]
|
|
1
|
+
.custom-input[data-v-5686d705] {
|
|
2
|
+
width: 100%
|
|
3
|
+
}
|
|
4
|
+
.custom-input[data-v-5686d705] .el-input-group__append {
|
|
5
|
+
cursor: pointer;
|
|
6
|
+
padding-left: 8px;
|
|
7
|
+
padding-right: 8px
|
|
8
|
+
}
|
package/dist/DragResizable.css
CHANGED
|
@@ -1 +1,126 @@
|
|
|
1
|
-
@charset "UTF-8"
|
|
1
|
+
@charset "UTF-8";
|
|
2
|
+
.customer-move-dialog {
|
|
3
|
+
position: relative;
|
|
4
|
+
z-index: 99;
|
|
5
|
+
overflow: hidden;
|
|
6
|
+
background: #f1f3f9;
|
|
7
|
+
border-radius: 4px;
|
|
8
|
+
box-sizing: border-box;
|
|
9
|
+
}
|
|
10
|
+
.customer-move-dialog.floating {
|
|
11
|
+
position: fixed;
|
|
12
|
+
background-color: #fff;
|
|
13
|
+
border: 1px solid #b9bec7;
|
|
14
|
+
box-shadow: 0 0 8px 2px rgba(0, 0, 0, 0.16);
|
|
15
|
+
}
|
|
16
|
+
.customer-move-dialog.parent-constrained {
|
|
17
|
+
position: absolute !important;
|
|
18
|
+
}
|
|
19
|
+
.customer-move-dialog .drag-header {
|
|
20
|
+
width: 100%;
|
|
21
|
+
height: 15px;
|
|
22
|
+
}
|
|
23
|
+
.customer-move-dialog .drag-header.draggable {
|
|
24
|
+
cursor: move;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/* 调整大小的句柄样式 */
|
|
28
|
+
.resize-handle {
|
|
29
|
+
position: absolute;
|
|
30
|
+
z-index: 99;
|
|
31
|
+
box-sizing: border-box;
|
|
32
|
+
}
|
|
33
|
+
.resize-handle-t {
|
|
34
|
+
top: 0;
|
|
35
|
+
right: 0;
|
|
36
|
+
left: 0;
|
|
37
|
+
height: 6px;
|
|
38
|
+
cursor: row-resize;
|
|
39
|
+
}
|
|
40
|
+
.resize-handle-t:hover {
|
|
41
|
+
border-top: 2px solid #2779ff;
|
|
42
|
+
}
|
|
43
|
+
.resize-handle-t:hover .resize-handle-area {
|
|
44
|
+
display: block;
|
|
45
|
+
}
|
|
46
|
+
.resize-handle-r {
|
|
47
|
+
top: 0;
|
|
48
|
+
right: 0;
|
|
49
|
+
bottom: 0;
|
|
50
|
+
width: 6px;
|
|
51
|
+
cursor: col-resize;
|
|
52
|
+
}
|
|
53
|
+
.resize-handle-r:hover {
|
|
54
|
+
border-right: 2px solid #2779ff;
|
|
55
|
+
}
|
|
56
|
+
.resize-handle-b {
|
|
57
|
+
right: 0;
|
|
58
|
+
bottom: 0;
|
|
59
|
+
left: 0;
|
|
60
|
+
height: 6px;
|
|
61
|
+
cursor: row-resize;
|
|
62
|
+
}
|
|
63
|
+
.resize-handle-b:hover {
|
|
64
|
+
border-bottom: 2px solid #2779ff;
|
|
65
|
+
}
|
|
66
|
+
.resize-handle-l {
|
|
67
|
+
top: 0;
|
|
68
|
+
bottom: 0;
|
|
69
|
+
left: 0;
|
|
70
|
+
width: 6px;
|
|
71
|
+
cursor: col-resize;
|
|
72
|
+
}
|
|
73
|
+
.resize-handle-l:hover {
|
|
74
|
+
border-left: 2px solid #2779ff;
|
|
75
|
+
}
|
|
76
|
+
.resize-handle-rt {
|
|
77
|
+
top: 0;
|
|
78
|
+
right: 0;
|
|
79
|
+
width: 8px;
|
|
80
|
+
height: 8px;
|
|
81
|
+
cursor: ne-resize;
|
|
82
|
+
}
|
|
83
|
+
.resize-handle-rb {
|
|
84
|
+
right: 0;
|
|
85
|
+
bottom: 0;
|
|
86
|
+
width: 8px;
|
|
87
|
+
height: 8px;
|
|
88
|
+
cursor: se-resize;
|
|
89
|
+
}
|
|
90
|
+
.resize-handle-lb {
|
|
91
|
+
bottom: 0;
|
|
92
|
+
left: 0;
|
|
93
|
+
width: 8px;
|
|
94
|
+
height: 8px;
|
|
95
|
+
cursor: sw-resize;
|
|
96
|
+
}
|
|
97
|
+
.resize-handle-lt {
|
|
98
|
+
top: 0;
|
|
99
|
+
left: 0;
|
|
100
|
+
width: 8px;
|
|
101
|
+
height: 8px;
|
|
102
|
+
cursor: nw-resize;
|
|
103
|
+
}
|
|
104
|
+
.resize-handle-rt:hover,
|
|
105
|
+
.resize-handle-rb:hover,
|
|
106
|
+
.resize-handle-lb:hover,
|
|
107
|
+
.resize-handle-lt:hover {
|
|
108
|
+
background-color: #2779ff;
|
|
109
|
+
}
|
|
110
|
+
.resize-handle-rt::after,
|
|
111
|
+
.resize-handle-rb::after,
|
|
112
|
+
.resize-handle-lb::after,
|
|
113
|
+
.resize-handle-lt::after {
|
|
114
|
+
position: absolute;
|
|
115
|
+
top: 50%;
|
|
116
|
+
left: 50%;
|
|
117
|
+
width: 6px;
|
|
118
|
+
height: 6px;
|
|
119
|
+
background-color: transparent;
|
|
120
|
+
border-radius: 50%;
|
|
121
|
+
content: "";
|
|
122
|
+
transform: translate(-50%, -50%);
|
|
123
|
+
}
|
|
124
|
+
.dialog-content {
|
|
125
|
+
height: calc(100% - 15px);
|
|
126
|
+
}
|
|
@@ -0,0 +1,331 @@
|
|
|
1
|
+
import { defineComponent, ref, onMounted, openBlock, createElementBlock, normalizeClass, Fragment, renderList, createElementVNode, createCommentVNode, renderSlot } from "vue";
|
|
2
|
+
import './DragResizable.css';const _hoisted_1 = ["data-direction"];
|
|
3
|
+
const _hoisted_2 = { class: "dialog-content" };
|
|
4
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
5
|
+
__name: "DragResizable",
|
|
6
|
+
props: {
|
|
7
|
+
width: { default: 100 },
|
|
8
|
+
height: { default: 100 },
|
|
9
|
+
minWidth: { default: 100 },
|
|
10
|
+
minHeight: { default: 100 },
|
|
11
|
+
maxWidth: {},
|
|
12
|
+
maxHeight: {},
|
|
13
|
+
left: {},
|
|
14
|
+
top: {},
|
|
15
|
+
handles: { default: () => ["t", "r", "b", "l", "rt", "rb", "lb", "lt"] },
|
|
16
|
+
draggable: { type: Boolean, default: true },
|
|
17
|
+
resizable: { type: Boolean, default: true },
|
|
18
|
+
overflowScreen: { type: Boolean, default: false },
|
|
19
|
+
floating: { type: Boolean, default: true },
|
|
20
|
+
parentSelector: { default: "" }
|
|
21
|
+
},
|
|
22
|
+
emits: ["resizing", "dragging", "resizeStop", "dragStop"],
|
|
23
|
+
setup(__props, { emit: __emit }) {
|
|
24
|
+
const moveDialogRef = ref();
|
|
25
|
+
const props = __props;
|
|
26
|
+
const emit = __emit;
|
|
27
|
+
let dialog = null;
|
|
28
|
+
let startX, startY, startWidth, startHeight, startTop, startLeft, direction, originalLeft, originalTop;
|
|
29
|
+
let isResizing = false;
|
|
30
|
+
let isDragging = false;
|
|
31
|
+
const getParentBounds = () => {
|
|
32
|
+
if (!props.parentSelector) {
|
|
33
|
+
return {
|
|
34
|
+
left: 0,
|
|
35
|
+
top: 0,
|
|
36
|
+
right: window.innerWidth,
|
|
37
|
+
bottom: window.innerHeight,
|
|
38
|
+
width: window.innerWidth,
|
|
39
|
+
height: window.innerHeight
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
const parent = document.querySelector(props.parentSelector);
|
|
43
|
+
if (!parent) {
|
|
44
|
+
return {
|
|
45
|
+
left: 0,
|
|
46
|
+
top: 0,
|
|
47
|
+
right: window.innerWidth,
|
|
48
|
+
bottom: window.innerHeight,
|
|
49
|
+
width: window.innerWidth,
|
|
50
|
+
height: window.innerHeight
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
const parentRect = parent.getBoundingClientRect();
|
|
54
|
+
return {
|
|
55
|
+
left: 0,
|
|
56
|
+
// 相对于父元素的左边距
|
|
57
|
+
top: 0,
|
|
58
|
+
// 相对于父元素的上边距
|
|
59
|
+
right: parentRect.width,
|
|
60
|
+
bottom: parentRect.height,
|
|
61
|
+
width: parentRect.width,
|
|
62
|
+
height: parentRect.height
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
const init = () => {
|
|
66
|
+
var _a, _b;
|
|
67
|
+
dialog = moveDialogRef.value;
|
|
68
|
+
if (!dialog) return;
|
|
69
|
+
let data = {
|
|
70
|
+
left: (_a = props.left) != null ? _a : window.innerWidth - props.width,
|
|
71
|
+
top: (_b = props.top) != null ? _b : window.innerHeight - props.height,
|
|
72
|
+
width: props.width,
|
|
73
|
+
height: props.height
|
|
74
|
+
};
|
|
75
|
+
data = limitScreen(data.left, data.top, data.width, data.height);
|
|
76
|
+
data = limitParent(data.left, data.top, data.width, data.height);
|
|
77
|
+
data = applyDimensionLimits(data.left, data.top, data.width, data.height);
|
|
78
|
+
if (props.floating) {
|
|
79
|
+
dialog.style.left = `${data.left}px`;
|
|
80
|
+
dialog.style.top = `${data.top}px`;
|
|
81
|
+
dialog.style.height = `${data.height}px`;
|
|
82
|
+
} else {
|
|
83
|
+
dialog.style.height = "100%";
|
|
84
|
+
}
|
|
85
|
+
if (props.parentSelector) {
|
|
86
|
+
const parent = document.querySelector(props.parentSelector);
|
|
87
|
+
if (parent) {
|
|
88
|
+
const parentStyle = window.getComputedStyle(parent);
|
|
89
|
+
if (parentStyle.position === "static") {
|
|
90
|
+
parent.style.position = "relative";
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
dialog.style.width = `${data.width}px`;
|
|
95
|
+
applySizeConstraintsToElement();
|
|
96
|
+
data.width;
|
|
97
|
+
data.height;
|
|
98
|
+
data.left;
|
|
99
|
+
data.top;
|
|
100
|
+
};
|
|
101
|
+
const applyDimensionLimits = (newLeft, newTop, newWidth, newHeight) => {
|
|
102
|
+
let width = Math.max(newWidth, props.minWidth);
|
|
103
|
+
let height = Math.max(newHeight, props.minHeight);
|
|
104
|
+
if (props.maxWidth != null) {
|
|
105
|
+
width = Math.min(width, props.maxWidth);
|
|
106
|
+
}
|
|
107
|
+
if (props.maxHeight != null) {
|
|
108
|
+
height = Math.min(height, props.maxHeight);
|
|
109
|
+
}
|
|
110
|
+
return {
|
|
111
|
+
left: newLeft,
|
|
112
|
+
top: newTop,
|
|
113
|
+
width,
|
|
114
|
+
height
|
|
115
|
+
};
|
|
116
|
+
};
|
|
117
|
+
const applySizeConstraintsToElement = () => {
|
|
118
|
+
dialog.style.minWidth = `${props.minWidth}px`;
|
|
119
|
+
dialog.style.minHeight = `${props.minHeight}px`;
|
|
120
|
+
if (props.maxWidth != null) {
|
|
121
|
+
dialog.style.maxWidth = `${props.maxWidth}px`;
|
|
122
|
+
}
|
|
123
|
+
if (props.maxHeight != null) {
|
|
124
|
+
dialog.style.maxHeight = `${props.maxHeight}px`;
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
function startResize(e) {
|
|
128
|
+
e.preventDefault();
|
|
129
|
+
isResizing = true;
|
|
130
|
+
direction = e.target.getAttribute("data-direction");
|
|
131
|
+
startX = e.clientX;
|
|
132
|
+
startY = e.clientY;
|
|
133
|
+
startWidth = dialog.offsetWidth;
|
|
134
|
+
startHeight = dialog.offsetHeight;
|
|
135
|
+
startTop = dialog.offsetTop;
|
|
136
|
+
startLeft = dialog.offsetLeft;
|
|
137
|
+
document.addEventListener("mousemove", resize);
|
|
138
|
+
document.addEventListener("mouseup", stopResize);
|
|
139
|
+
dialog.classList.add("resizing");
|
|
140
|
+
}
|
|
141
|
+
function resize(e) {
|
|
142
|
+
if (!isResizing) return;
|
|
143
|
+
let newWidth = startWidth;
|
|
144
|
+
let newHeight = startHeight;
|
|
145
|
+
let newTop = startTop;
|
|
146
|
+
let newLeft = startLeft;
|
|
147
|
+
const clientX = e.clientX;
|
|
148
|
+
const clientY = e.clientY;
|
|
149
|
+
const deltaX = clientX - startX;
|
|
150
|
+
const deltaY = clientY - startY;
|
|
151
|
+
if (direction.includes("t")) {
|
|
152
|
+
newHeight = startHeight - deltaY;
|
|
153
|
+
newTop = startTop + deltaY;
|
|
154
|
+
} else if (direction.includes("r")) {
|
|
155
|
+
newWidth = startWidth + deltaX;
|
|
156
|
+
} else if (direction.includes("b")) {
|
|
157
|
+
newHeight = startHeight + deltaY;
|
|
158
|
+
console.log(newHeight, deltaY, 1111);
|
|
159
|
+
} else if (direction.includes("l")) {
|
|
160
|
+
newWidth = startWidth - deltaX;
|
|
161
|
+
newLeft = startLeft + deltaX;
|
|
162
|
+
}
|
|
163
|
+
if (direction.length === 2) {
|
|
164
|
+
if (direction === "rt") {
|
|
165
|
+
newHeight = startHeight - deltaY;
|
|
166
|
+
newTop = startTop + deltaY;
|
|
167
|
+
newWidth = startWidth + deltaX;
|
|
168
|
+
} else if (direction === "rb") {
|
|
169
|
+
newWidth = startWidth + deltaX;
|
|
170
|
+
newHeight = startHeight + deltaY;
|
|
171
|
+
} else if (direction === "lb") {
|
|
172
|
+
newWidth = startWidth - deltaX;
|
|
173
|
+
newLeft = startLeft + deltaX;
|
|
174
|
+
newHeight = startHeight + deltaY;
|
|
175
|
+
} else if (direction === "lt") {
|
|
176
|
+
newWidth = startWidth - deltaX;
|
|
177
|
+
newHeight = startHeight - deltaY;
|
|
178
|
+
newLeft = startLeft + deltaX;
|
|
179
|
+
newTop = startTop + deltaY;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
let data = {
|
|
183
|
+
left: newLeft,
|
|
184
|
+
top: newTop,
|
|
185
|
+
width: newWidth,
|
|
186
|
+
height: newHeight
|
|
187
|
+
};
|
|
188
|
+
data = limitScreen(data.left, data.top, data.width, data.height);
|
|
189
|
+
data = limitParent(data.left, data.top, data.width, data.height);
|
|
190
|
+
data = applyDimensionLimits(data.left, data.top, data.width, data.height);
|
|
191
|
+
dialog.style.width = `${data.width}px`;
|
|
192
|
+
dialog.style.height = `${data.height}px`;
|
|
193
|
+
console.log(data.height, 2222);
|
|
194
|
+
if (props.floating) {
|
|
195
|
+
dialog.style.top = `${data.top}px`;
|
|
196
|
+
dialog.style.left = `${data.left}px`;
|
|
197
|
+
}
|
|
198
|
+
data.width;
|
|
199
|
+
data.height;
|
|
200
|
+
data.left;
|
|
201
|
+
data.top;
|
|
202
|
+
emit("resizing", data);
|
|
203
|
+
}
|
|
204
|
+
function stopResize() {
|
|
205
|
+
isResizing = false;
|
|
206
|
+
document.removeEventListener("mousemove", resize);
|
|
207
|
+
document.removeEventListener("mouseup", stopResize);
|
|
208
|
+
dialog.classList.remove("resizing");
|
|
209
|
+
emit("resizeStop", {
|
|
210
|
+
width: dialog.offsetWidth,
|
|
211
|
+
height: dialog.offsetHeight,
|
|
212
|
+
left: dialog.offsetLeft,
|
|
213
|
+
top: dialog.offsetTop
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
function startDrag(e) {
|
|
217
|
+
if (!props.draggable) return;
|
|
218
|
+
e.preventDefault();
|
|
219
|
+
isDragging = true;
|
|
220
|
+
originalLeft = dialog.offsetLeft;
|
|
221
|
+
originalTop = dialog.offsetTop;
|
|
222
|
+
startX = e.clientX;
|
|
223
|
+
startY = e.clientY;
|
|
224
|
+
document.addEventListener("mousemove", drag);
|
|
225
|
+
document.addEventListener("mouseup", stopDrag);
|
|
226
|
+
dialog.classList.add("dragging");
|
|
227
|
+
}
|
|
228
|
+
function drag(e) {
|
|
229
|
+
if (!props.floating) return;
|
|
230
|
+
if (!isDragging) return;
|
|
231
|
+
let data = {
|
|
232
|
+
left: originalLeft + (e.clientX - startX),
|
|
233
|
+
top: originalTop + (e.clientY - startY),
|
|
234
|
+
width: dialog.offsetWidth,
|
|
235
|
+
height: dialog.offsetHeight
|
|
236
|
+
};
|
|
237
|
+
data = limitScreen(data.left, data.top, data.width, data.height);
|
|
238
|
+
data = limitParent(data.left, data.top, data.width, data.height);
|
|
239
|
+
data = applyDimensionLimits(data.left, data.top, data.width, data.height);
|
|
240
|
+
dialog.style.left = `${data.left}px`;
|
|
241
|
+
dialog.style.top = `${data.top}px`;
|
|
242
|
+
data.left;
|
|
243
|
+
data.top;
|
|
244
|
+
emit("dragging", {
|
|
245
|
+
left: data.left,
|
|
246
|
+
top: data.top,
|
|
247
|
+
width: data.width,
|
|
248
|
+
height: data.height
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
function stopDrag() {
|
|
252
|
+
isDragging = false;
|
|
253
|
+
document.removeEventListener("mousemove", drag);
|
|
254
|
+
document.removeEventListener("mouseup", stopDrag);
|
|
255
|
+
dialog.classList.remove("dragging");
|
|
256
|
+
emit("dragStop", {
|
|
257
|
+
left: dialog.offsetLeft,
|
|
258
|
+
top: dialog.offsetTop,
|
|
259
|
+
width: dialog.offsetWidth,
|
|
260
|
+
height: dialog.offsetHeight
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
const limitScreen = (newLeft, newTop, newWidth, newHeight) => {
|
|
264
|
+
if (!props.overflowScreen && props.floating) {
|
|
265
|
+
newLeft = Math.min(Math.max(newLeft, 0), window.innerWidth - dialog.offsetWidth);
|
|
266
|
+
newTop = Math.min(Math.max(newTop, 0), window.innerHeight - dialog.offsetHeight);
|
|
267
|
+
newWidth = Math.min(newWidth, window.innerWidth - newLeft);
|
|
268
|
+
newHeight = Math.min(newHeight, window.innerHeight - newTop);
|
|
269
|
+
}
|
|
270
|
+
return {
|
|
271
|
+
left: newLeft,
|
|
272
|
+
top: newTop,
|
|
273
|
+
width: newWidth,
|
|
274
|
+
height: newHeight
|
|
275
|
+
};
|
|
276
|
+
};
|
|
277
|
+
const limitParent = (newLeft, newTop, newWidth, newHeight) => {
|
|
278
|
+
if (props.parentSelector) {
|
|
279
|
+
const parentBounds = getParentBounds();
|
|
280
|
+
newLeft = Math.min(newLeft, parentBounds.width - dialog.offsetWidth);
|
|
281
|
+
newTop = Math.min(newTop, parentBounds.height - dialog.offsetHeight);
|
|
282
|
+
newLeft = Math.max(newLeft, 0);
|
|
283
|
+
newTop = Math.max(newTop, 0);
|
|
284
|
+
newWidth = Math.min(newWidth, parentBounds.width - newLeft);
|
|
285
|
+
newHeight = Math.min(newHeight, parentBounds.height - newTop);
|
|
286
|
+
}
|
|
287
|
+
return {
|
|
288
|
+
left: newLeft,
|
|
289
|
+
top: newTop,
|
|
290
|
+
width: newWidth,
|
|
291
|
+
height: newHeight
|
|
292
|
+
};
|
|
293
|
+
};
|
|
294
|
+
onMounted(() => {
|
|
295
|
+
init();
|
|
296
|
+
});
|
|
297
|
+
return (_ctx, _cache) => {
|
|
298
|
+
return openBlock(), createElementBlock("div", {
|
|
299
|
+
class: normalizeClass(["customer-move-dialog", { floating: __props.floating, "parent-constrained": __props.floating && __props.parentSelector }]),
|
|
300
|
+
ref_key: "moveDialogRef",
|
|
301
|
+
ref: moveDialogRef
|
|
302
|
+
}, [
|
|
303
|
+
__props.resizable ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(__props.handles, (handle, index) => {
|
|
304
|
+
return openBlock(), createElementBlock("div", {
|
|
305
|
+
class: normalizeClass(["resize-handle", `resize-handle-${handle}`]),
|
|
306
|
+
"data-direction": handle,
|
|
307
|
+
key: index,
|
|
308
|
+
onMousedown: startResize
|
|
309
|
+
}, [
|
|
310
|
+
createElementVNode("div", {
|
|
311
|
+
class: normalizeClass(["resize-handle-area", `resize-handle-area-${handle}`])
|
|
312
|
+
}, null, 2)
|
|
313
|
+
], 42, _hoisted_1);
|
|
314
|
+
}), 128)) : createCommentVNode("", true),
|
|
315
|
+
__props.floating ? (openBlock(), createElementBlock("div", {
|
|
316
|
+
key: 1,
|
|
317
|
+
class: normalizeClass(["drag-header", __props.draggable ? "draggable" : ""]),
|
|
318
|
+
onMousedown: startDrag
|
|
319
|
+
}, [
|
|
320
|
+
renderSlot(_ctx.$slots, "header")
|
|
321
|
+
], 34)) : createCommentVNode("", true),
|
|
322
|
+
createElementVNode("div", _hoisted_2, [
|
|
323
|
+
renderSlot(_ctx.$slots, "default")
|
|
324
|
+
])
|
|
325
|
+
], 2);
|
|
326
|
+
};
|
|
327
|
+
}
|
|
328
|
+
});
|
|
329
|
+
export {
|
|
330
|
+
_sfc_main as _
|
|
331
|
+
};
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { ElScrollbar } from "element-plus/es";
|
|
2
|
+
import { defineComponent, ref, watch, openBlock, createBlock, withCtx, createElementVNode, createVNode, TransitionGroup, createElementBlock, Fragment, renderList, withModifiers, normalizeClass, renderSlot } from "vue";
|
|
3
|
+
import { _ as _export_sfc } from "./_plugin-vue_export-helper-1tPrXgE0.js";
|
|
4
|
+
import './DragSort.css';const _hoisted_1 = { class: "drag-list" };
|
|
5
|
+
const _hoisted_2 = ["draggable", "onDragstart", "onDragenter"];
|
|
6
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
7
|
+
__name: "DragSort",
|
|
8
|
+
props: {
|
|
9
|
+
list: { default: () => [] },
|
|
10
|
+
props: { default: () => {
|
|
11
|
+
return { id: "id" };
|
|
12
|
+
} }
|
|
13
|
+
},
|
|
14
|
+
emits: ["sortChange"],
|
|
15
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
16
|
+
const props = __props;
|
|
17
|
+
const emit = __emit;
|
|
18
|
+
const sortList = ref(props.list);
|
|
19
|
+
let oldId = null;
|
|
20
|
+
let newId = null;
|
|
21
|
+
const dragend = (event) => {
|
|
22
|
+
event.preventDefault();
|
|
23
|
+
let oldIndex = null;
|
|
24
|
+
let newIndex = null;
|
|
25
|
+
let newData = {};
|
|
26
|
+
const newArr = [...sortList.value];
|
|
27
|
+
sortList.value.forEach((item, index) => {
|
|
28
|
+
if ((item[props.props.id] || item) === oldId) {
|
|
29
|
+
oldIndex = index;
|
|
30
|
+
newData = item;
|
|
31
|
+
}
|
|
32
|
+
if ((item[props.props.id] || item) === newId) {
|
|
33
|
+
newIndex = index;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
newArr.splice(oldIndex, 1);
|
|
37
|
+
newArr.splice(newIndex, 0, newData);
|
|
38
|
+
sortList.value = newArr;
|
|
39
|
+
oldId = null;
|
|
40
|
+
newId = null;
|
|
41
|
+
emit("sortChange", sortList.value);
|
|
42
|
+
};
|
|
43
|
+
const dragstart = (event, data) => {
|
|
44
|
+
oldId = data[props.props.id] || data;
|
|
45
|
+
};
|
|
46
|
+
const dragleave = (event) => {
|
|
47
|
+
event.preventDefault();
|
|
48
|
+
};
|
|
49
|
+
const dragenter = (event, data) => {
|
|
50
|
+
event.preventDefault();
|
|
51
|
+
newId = data[props.props.id] || data;
|
|
52
|
+
};
|
|
53
|
+
watch(props, (newVal) => {
|
|
54
|
+
sortList.value = newVal.list;
|
|
55
|
+
});
|
|
56
|
+
const $getSort = () => {
|
|
57
|
+
emit("sortChange", sortList.value);
|
|
58
|
+
};
|
|
59
|
+
__expose({ $getSort, sortList });
|
|
60
|
+
return (_ctx, _cache) => {
|
|
61
|
+
const _component_el_scrollbar = ElScrollbar;
|
|
62
|
+
return openBlock(), createBlock(_component_el_scrollbar, null, {
|
|
63
|
+
default: withCtx(() => [
|
|
64
|
+
createElementVNode("ul", _hoisted_1, [
|
|
65
|
+
createVNode(TransitionGroup, null, {
|
|
66
|
+
default: withCtx(() => [
|
|
67
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(sortList.value, (item, index) => {
|
|
68
|
+
return openBlock(), createElementBlock("li", {
|
|
69
|
+
key: item[props.props.id] || item,
|
|
70
|
+
class: normalizeClass(["drag-container drag-list-item flex justify-between", { "cursor-move": !item.noSort }]),
|
|
71
|
+
draggable: item.noSort ? false : true,
|
|
72
|
+
onDragstart: ($event) => dragstart($event, item),
|
|
73
|
+
onDragend: _cache[0] || (_cache[0] = ($event) => dragend($event)),
|
|
74
|
+
onDragover: _cache[1] || (_cache[1] = withModifiers(() => {
|
|
75
|
+
}, ["prevent"])),
|
|
76
|
+
onDragenter: ($event) => dragenter($event, item),
|
|
77
|
+
onDragleave: _cache[2] || (_cache[2] = ($event) => dragleave($event))
|
|
78
|
+
}, [
|
|
79
|
+
renderSlot(_ctx.$slots, "main", {
|
|
80
|
+
data: item,
|
|
81
|
+
index
|
|
82
|
+
}, void 0, true)
|
|
83
|
+
], 42, _hoisted_2);
|
|
84
|
+
}), 128))
|
|
85
|
+
]),
|
|
86
|
+
_: 3
|
|
87
|
+
})
|
|
88
|
+
])
|
|
89
|
+
]),
|
|
90
|
+
_: 3
|
|
91
|
+
});
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
const DragSort = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-b9b2c678"]]);
|
|
96
|
+
export {
|
|
97
|
+
DragSort as D
|
|
98
|
+
};
|
package/dist/DragSort.css
CHANGED