hy-dispatch-ui-v3 0.2.32 → 0.2.34
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/tailwind.css +186 -454
- package/es/components/hyAudioPlayer/audioPlayer.vue.mjs +5 -5
- package/es/components/hyAudioPlayer/js/index.mjs +1 -1
- package/es/components/hyAudioPlayer/style/audioPlayer.scss +11 -12
- package/es/components/hyButton/button.vue.mjs +50 -35
- package/es/components/hyButton/style/button.scss +16 -3
- package/es/components/hyConfirmDialog/confirmDialog.vue.mjs +2 -2
- package/es/components/hyConfirmDialog/confirmMethod.mjs +1 -1
- package/es/components/hyConfirmDialog/index.mjs +1 -1
- package/es/components/hyCutter/cutter.vue.mjs +1 -1
- package/es/components/hyDatePicker/datePicker.vue.mjs +1 -1
- package/es/components/hyDialog/dialog.vue.mjs +178 -137
- package/es/components/hyDialog/style/dialog.scss +13 -0
- package/es/components/hyForm/cpns/formItem.vue.mjs +3 -4
- package/es/components/hyForm/form.vue.mjs +2 -1
- package/es/components/hyForm/js/useAppForm.mjs +1 -1
- package/es/components/hyForm/style/form.scss +56 -54
- package/es/components/hyIcon/style/icon.scss +1 -1
- package/es/components/hyIconBox/style/iconBox.scss +19 -18
- package/es/components/hyInput/input.vue.mjs +4 -1
- package/es/components/hyNoPermissions/noPermissions.vue.mjs +1 -1
- package/es/components/hyNoPermissionsMap/noPermissionsMap.vue.mjs +1 -1
- package/es/components/hyOrgCascader/orgCascader.vue.mjs +1 -1
- package/es/components/hySearch/cpns/searchItem.vue.mjs +3 -9
- package/es/components/hySearch/js/index.mjs +4 -4
- package/es/components/hySearch/style/search.scss +51 -50
- package/es/components/hyTable/cpns/columnSelect.vue.mjs +39 -42
- package/es/components/hyTable/cpns/columnSelectItem.vue.mjs +5 -8
- package/es/components/hyTable/cpns/headerItem.vue.mjs +1 -1
- package/es/components/hyTable/cpns/virtualTable.vue.mjs +18 -11
- package/es/components/hyTable/js/index.mjs +12 -0
- package/es/components/hyTable/js/useAppTable.mjs +1 -1
- package/es/components/hyTable/style/table.scss +13 -0
- package/es/components/hyTable/table.vue.mjs +43 -23
- package/es/components/hyTableForm/batchTableForm.vue.mjs +478 -0
- package/es/components/hyTableForm/index.mjs +4 -1
- package/es/components/hyTableForm/js/index.mjs +123 -0
- package/es/components/hyTableForm/js/useAppTableForm.mjs +47 -0
- package/es/components/hyTableForm/style/batchTableForm.scss +127 -0
- package/es/components/hyTableForm/style/tableForm.scss +42 -0
- package/es/components/hyTableForm/tableForm.vue.mjs +452 -7
- package/es/components/hyTooltip/tooltip.vue.mjs +6 -6
- package/es/components/hyTree/style/index.css +1 -0
- package/es/components/hyTree/tree.vue.mjs +2 -0
- package/es/components/hyUserAvatar/userAvatar.vue.mjs +2 -2
- package/es/components/hyVideoPlayer/cpns/mediaLoading.vue.mjs +1 -1
- package/es/components/hyVideoPlayer/js/index.mjs +1 -1
- package/es/components/hyVideoPlayer/style/mediaLoading.scss +5 -5
- package/es/components/hyVideoPlayer/style/videoPlayer.scss +7 -6
- package/es/components/hyVideoPlayer/videoPlayer.vue.mjs +6 -6
- package/es/components/index.mjs +2 -1
- package/es/index.mjs +2 -1
- package/es/locale/en.mjs +1 -1
- package/es/locale/zh_CN.mjs +1 -1
- package/es/style/element/hy-element.scss +3 -2
- package/es/style/tailwind.scss +133 -1
- package/es/version.mjs +1 -1
- package/lib/components/hyAudioPlayer/audioPlayer.vue.js +4 -4
- package/lib/components/hyAudioPlayer/js/index.js +1 -1
- package/lib/components/hyAudioPlayer/style/audioPlayer.scss +11 -12
- package/lib/components/hyButton/button.vue.js +50 -35
- package/lib/components/hyButton/style/button.scss +16 -3
- package/lib/components/hyConfirmDialog/confirmDialog.vue.js +2 -2
- package/lib/components/hyConfirmDialog/confirmMethod.js +1 -1
- package/lib/components/hyConfirmDialog/index.js +1 -1
- package/lib/components/hyCutter/cutter.vue.js +1 -1
- package/lib/components/hyDatePicker/datePicker.vue.js +1 -1
- package/lib/components/hyDialog/dialog.vue.js +177 -136
- package/lib/components/hyDialog/style/dialog.scss +13 -0
- package/lib/components/hyForm/cpns/formItem.vue.js +3 -4
- package/lib/components/hyForm/form.vue.js +2 -1
- package/lib/components/hyForm/js/useAppForm.js +1 -1
- package/lib/components/hyForm/style/form.scss +56 -54
- package/lib/components/hyIcon/style/icon.scss +1 -1
- package/lib/components/hyIconBox/style/iconBox.scss +19 -18
- package/lib/components/hyInput/input.vue.js +4 -1
- package/lib/components/hyNoPermissions/noPermissions.vue.js +1 -1
- package/lib/components/hyNoPermissionsMap/noPermissionsMap.vue.js +1 -1
- package/lib/components/hyOrgCascader/orgCascader.vue.js +1 -1
- package/lib/components/hySearch/cpns/searchItem.vue.js +3 -9
- package/lib/components/hySearch/js/index.js +4 -4
- package/lib/components/hySearch/style/search.scss +51 -50
- package/lib/components/hyTable/cpns/columnSelect.vue.js +43 -46
- package/lib/components/hyTable/cpns/columnSelectItem.vue.js +4 -7
- package/lib/components/hyTable/cpns/headerItem.vue.js +1 -1
- package/lib/components/hyTable/cpns/virtualTable.vue.js +18 -11
- package/lib/components/hyTable/js/index.js +12 -0
- package/lib/components/hyTable/js/useAppTable.js +1 -1
- package/lib/components/hyTable/style/table.scss +13 -0
- package/lib/components/hyTable/table.vue.js +42 -22
- package/lib/components/hyTableForm/batchTableForm.vue.js +482 -0
- package/lib/components/hyTableForm/index.js +5 -0
- package/lib/components/hyTableForm/js/index.js +127 -0
- package/lib/components/hyTableForm/js/useAppTableForm.js +49 -0
- package/lib/components/hyTableForm/style/batchTableForm.scss +127 -0
- package/lib/components/hyTableForm/style/tableForm.scss +42 -0
- package/lib/components/hyTableForm/tableForm.vue.js +451 -6
- package/lib/components/hyTooltip/tooltip.vue.js +6 -6
- package/lib/components/hyTree/style/index.css +1 -0
- package/lib/components/hyTree/tree.vue.js +2 -0
- package/lib/components/hyUserAvatar/userAvatar.vue.js +2 -2
- package/lib/components/hyVideoPlayer/cpns/mediaLoading.vue.js +1 -1
- package/lib/components/hyVideoPlayer/js/index.js +1 -1
- package/lib/components/hyVideoPlayer/style/mediaLoading.scss +5 -5
- package/lib/components/hyVideoPlayer/style/videoPlayer.scss +7 -6
- package/lib/components/hyVideoPlayer/videoPlayer.vue.js +6 -6
- package/lib/components/index.js +33 -30
- package/lib/index.js +33 -30
- package/lib/locale/en.js +1 -1
- package/lib/locale/zh_CN.js +1 -1
- package/lib/style/element/hy-element.scss +3 -2
- package/lib/style/tailwind.scss +133 -1
- package/lib/version.js +1 -1
- package/package.json +5 -3
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
.hy-batch-table-form {
|
|
2
|
+
position: relative;
|
|
3
|
+
height: 100%;
|
|
4
|
+
max-height: 100vh;
|
|
5
|
+
overflow: hidden;
|
|
6
|
+
.hy-batch-table-form-upload-box {
|
|
7
|
+
height: 340px;
|
|
8
|
+
position: relative;
|
|
9
|
+
border-radius: 8px;
|
|
10
|
+
border: 1px dashed rgba(var(--hy-auxiliary));
|
|
11
|
+
box-sizing: border-box;
|
|
12
|
+
&:hover {
|
|
13
|
+
border-color: rgba(var(--hy-theme));
|
|
14
|
+
}
|
|
15
|
+
.upload-bg {
|
|
16
|
+
position: absolute;
|
|
17
|
+
width: 100%;
|
|
18
|
+
height: 100%;
|
|
19
|
+
perspective: 800px;
|
|
20
|
+
pointer-events: none;
|
|
21
|
+
overflow: hidden;
|
|
22
|
+
&::before {
|
|
23
|
+
display: block;
|
|
24
|
+
content: '';
|
|
25
|
+
position: absolute;
|
|
26
|
+
top: -50%;
|
|
27
|
+
left: -50%;
|
|
28
|
+
width: 200%;
|
|
29
|
+
height: 200%;
|
|
30
|
+
/* 绘制网格线:使用青色,透明度调低,让它融合在 #14273a 背景里 */
|
|
31
|
+
background-image:
|
|
32
|
+
/* 纵向线 */ linear-gradient(
|
|
33
|
+
90deg,
|
|
34
|
+
rgba(0, 229, 255, 0.1) 1px,
|
|
35
|
+
transparent 1px
|
|
36
|
+
),
|
|
37
|
+
/* 横向线 */
|
|
38
|
+
linear-gradient(rgba(0, 229, 255, 0.1) 1px, transparent 1px);
|
|
39
|
+
|
|
40
|
+
/* 网格尺寸 40px */
|
|
41
|
+
background-size: 40px 40px;
|
|
42
|
+
|
|
43
|
+
/* 3D 倒伏效果 */
|
|
44
|
+
transform: rotateX(60deg);
|
|
45
|
+
|
|
46
|
+
/* 动效:无限流动 */
|
|
47
|
+
animation: grid-flow 20s linear infinite;
|
|
48
|
+
|
|
49
|
+
/* 遮罩:四周渐隐,让网格不那么生硬 */
|
|
50
|
+
mask-image: radial-gradient(
|
|
51
|
+
circle at 50% 50%,
|
|
52
|
+
black 10%,
|
|
53
|
+
transparent 80%
|
|
54
|
+
);
|
|
55
|
+
-webkit-mask-image: radial-gradient(
|
|
56
|
+
circle at 50% 50%,
|
|
57
|
+
black 10%,
|
|
58
|
+
transparent 80%
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
&::after {
|
|
62
|
+
display: block;
|
|
63
|
+
content: '';
|
|
64
|
+
position: absolute;
|
|
65
|
+
top: 0;
|
|
66
|
+
left: 0;
|
|
67
|
+
width: 100%;
|
|
68
|
+
height: 100%;
|
|
69
|
+
background: radial-gradient(
|
|
70
|
+
circle at 50% 50%,
|
|
71
|
+
rgba(0, 229, 255, 0.05) 0%,
|
|
72
|
+
transparent 70%
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.hy-el-upload {
|
|
78
|
+
width: 100%;
|
|
79
|
+
height: 100%;
|
|
80
|
+
.hy-el-upload-dragger {
|
|
81
|
+
width: 100%;
|
|
82
|
+
height: 100%;
|
|
83
|
+
display: flex;
|
|
84
|
+
flex-direction: column;
|
|
85
|
+
align-items: center;
|
|
86
|
+
justify-content: center;
|
|
87
|
+
border: none;
|
|
88
|
+
&:hover {
|
|
89
|
+
border-color: var(--theme);
|
|
90
|
+
.type-icon-box {
|
|
91
|
+
transform: translateY(-10px);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.hy-batch-table-form-step-box {
|
|
99
|
+
width: 100%;
|
|
100
|
+
height: 260px;
|
|
101
|
+
font-size: 14px;
|
|
102
|
+
margin-top: 16px;
|
|
103
|
+
padding-top: 24px;
|
|
104
|
+
border-radius: 8px;
|
|
105
|
+
background-color: rgba(var(--hy-background-2), 0.5);
|
|
106
|
+
.hy-el-step {
|
|
107
|
+
.hy-el-step__description {
|
|
108
|
+
padding-left: 0px !important;
|
|
109
|
+
padding-right: 0px !important;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.hy-batch-table-form-template-box {
|
|
115
|
+
width: 100%;
|
|
116
|
+
height: 48px;
|
|
117
|
+
display: flex;
|
|
118
|
+
align-items: center;
|
|
119
|
+
justify-content: space-between;
|
|
120
|
+
font-size: 12px;
|
|
121
|
+
padding: 0 16px 0 18px;
|
|
122
|
+
border: 1px dashed rgba(var(--hy-auxiliary), 0.5);
|
|
123
|
+
border-radius: 4px;
|
|
124
|
+
background: rgba(var(--hy-background-2), 0.5);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
.hy-table-form {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
|
|
5
|
+
.hy-el-table-v2__row.hy-el-table-v2__row-error,
|
|
6
|
+
.hy-el-table-v2__row.hy-el-table-v2__row-error:hover {
|
|
7
|
+
outline: 1px solid rgba(var(--hy-danger-2));
|
|
8
|
+
outline-offset: -1px;
|
|
9
|
+
box-shadow: inset 0px 0px 19px 0px rgba(var(--hy-danger-2), 0.5);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.hy-table-form-tabs {
|
|
13
|
+
height: 1.875rem;
|
|
14
|
+
display: flex;
|
|
15
|
+
gap: 2px;
|
|
16
|
+
font-size: 0.875rem;
|
|
17
|
+
color: rgba(var(--hy-auxiliary));
|
|
18
|
+
border: 1px solid rgba(var(--hy-border));
|
|
19
|
+
border-radius: 4px;
|
|
20
|
+
padding: 2px;
|
|
21
|
+
font-size: 0.75rem;
|
|
22
|
+
.hy-table-form-tab-button {
|
|
23
|
+
display: flex;
|
|
24
|
+
align-items: center;
|
|
25
|
+
font-weight: bold;
|
|
26
|
+
padding: 0 0.75rem;
|
|
27
|
+
border: 1px solid transparent;
|
|
28
|
+
border-radius: 2px;
|
|
29
|
+
cursor: pointer;
|
|
30
|
+
transition: all 0.3s linear;
|
|
31
|
+
&:hover {
|
|
32
|
+
color: rgba(var(--hy-main));
|
|
33
|
+
}
|
|
34
|
+
&.is-select {
|
|
35
|
+
color: rgba(var(--hy-main));
|
|
36
|
+
background: linear-gradient(180deg, rgba(var(--hy-theme)) 0%, #2A4968 100%);
|
|
37
|
+
border-image: linear-gradient(180deg, rgba(var(--hy-theme)) 80%, rgba(var(--hy-auxiliary))) 1 1;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
@@ -1,4 +1,14 @@
|
|
|
1
|
-
import { defineComponent, openBlock, createElementBlock, createCommentVNode } from 'vue';
|
|
1
|
+
import { defineComponent, useTemplateRef, ref, computed, openBlock, createElementBlock, createElementVNode, toDisplayString, createCommentVNode, createVNode, unref, withCtx, createTextVNode, Fragment, renderList, normalizeClass, mergeProps, createSlots, renderSlot, normalizeProps, guardReactiveProps, createBlock, nextTick } from 'vue';
|
|
2
|
+
import { ElIcon } from 'element-plus';
|
|
3
|
+
import { Warning } from '@element-plus/icons-vue';
|
|
4
|
+
import { doValidate } from './js/index.mjs';
|
|
5
|
+
import { useAppTable } from '../hyTable/js/useAppTable.mjs';
|
|
6
|
+
import { isArray, isObject } from '../../utils/is.mjs';
|
|
7
|
+
import { cloneDeep } from '../../utils/handler.mjs';
|
|
8
|
+
import { HyButton } from '../hyButton/index.mjs';
|
|
9
|
+
import { HyTable } from '../hyTable/index.mjs';
|
|
10
|
+
import { HyForm } from '../hyForm/index.mjs';
|
|
11
|
+
import { resetAppFormValue } from '../hyForm/js/useAppForm.mjs';
|
|
2
12
|
|
|
3
13
|
import "./style/tableForm.scss";
|
|
4
14
|
|
|
@@ -6,14 +16,449 @@ const __default__ = defineComponent({
|
|
|
6
16
|
name: "HyTableForm"
|
|
7
17
|
});
|
|
8
18
|
const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
|
|
9
|
-
props: {
|
|
10
|
-
|
|
19
|
+
props: {
|
|
20
|
+
// 表格配置项
|
|
21
|
+
tableColumns: {
|
|
22
|
+
// 表格的列
|
|
23
|
+
type: Array,
|
|
24
|
+
required: true,
|
|
25
|
+
default: () => []
|
|
26
|
+
},
|
|
27
|
+
formColumns: {
|
|
28
|
+
type: Array,
|
|
29
|
+
default: () => []
|
|
30
|
+
},
|
|
31
|
+
rules: {
|
|
32
|
+
type: Object,
|
|
33
|
+
default: () => ({})
|
|
34
|
+
},
|
|
35
|
+
emptyText: {
|
|
36
|
+
// 空数据时显示的文本内容
|
|
37
|
+
type: String
|
|
38
|
+
},
|
|
39
|
+
fontSize: {
|
|
40
|
+
// 字体大小
|
|
41
|
+
type: Number,
|
|
42
|
+
default: 14
|
|
43
|
+
},
|
|
44
|
+
rowClickExpand: {
|
|
45
|
+
// 点击行展开
|
|
46
|
+
type: Boolean,
|
|
47
|
+
required: false,
|
|
48
|
+
default: true
|
|
49
|
+
},
|
|
50
|
+
// 表单配置项
|
|
51
|
+
columnNum: {
|
|
52
|
+
type: Number,
|
|
53
|
+
default: 2
|
|
54
|
+
},
|
|
55
|
+
size: {
|
|
56
|
+
type: String,
|
|
57
|
+
default: "default"
|
|
58
|
+
// 'large' | 'default' | 'small'
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
emits: ["validate"],
|
|
11
62
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
12
|
-
|
|
63
|
+
const props = __props;
|
|
64
|
+
const emits = __emit;
|
|
65
|
+
const tableRef = useTemplateRef("tableRef");
|
|
66
|
+
const formRef = useTemplateRef("formRef");
|
|
67
|
+
const dataSource = ref([]);
|
|
68
|
+
const tabList = ref([
|
|
69
|
+
{ label: "\u5168\u90E8\u6570\u636E", value: "all" },
|
|
70
|
+
{ label: "\u4EC5\u663E\u793A\u5F02\u5E38\u6570\u636E", value: "abnormal" }
|
|
71
|
+
]);
|
|
72
|
+
const tabValue = ref("all");
|
|
73
|
+
const { tableColumns: operatorColumn } = useAppTable({
|
|
74
|
+
columns: [
|
|
75
|
+
{
|
|
76
|
+
type: "operator",
|
|
77
|
+
// prop 改为 type
|
|
78
|
+
width: 64,
|
|
79
|
+
operator: [
|
|
80
|
+
{
|
|
81
|
+
label: "\u5220\u9664",
|
|
82
|
+
desc: "\u5220\u9664",
|
|
83
|
+
svgName: "ops-linear-delete",
|
|
84
|
+
className: "text-danger-2",
|
|
85
|
+
handler: onDeleteRowHandler
|
|
86
|
+
}
|
|
87
|
+
]
|
|
88
|
+
}
|
|
89
|
+
]
|
|
90
|
+
});
|
|
91
|
+
const isExpandValidate = ref(false);
|
|
92
|
+
const tableFormColumns = computed(() => {
|
|
93
|
+
if (!props.tableColumns) return [];
|
|
94
|
+
return [...props.tableColumns, ...operatorColumn.value];
|
|
95
|
+
});
|
|
96
|
+
const expandColumn = computed(() => {
|
|
97
|
+
return props.tableColumns.find((item) => item.type === "expand");
|
|
98
|
+
});
|
|
99
|
+
const statistics = computed(() => {
|
|
100
|
+
return dataSource.value.reduce(
|
|
101
|
+
({ success, failed, total }, data) => {
|
|
102
|
+
if (!data.errorMsg) {
|
|
103
|
+
success++;
|
|
104
|
+
} else {
|
|
105
|
+
failed++;
|
|
106
|
+
}
|
|
107
|
+
return { success, failed, total };
|
|
108
|
+
},
|
|
109
|
+
{ success: 0, failed: 0, total: dataSource.value.length }
|
|
110
|
+
);
|
|
111
|
+
});
|
|
112
|
+
function setData(dataSource2) {
|
|
113
|
+
if (!tableRef.value) return;
|
|
114
|
+
tableRef.value.setData(dataSource2);
|
|
115
|
+
}
|
|
116
|
+
function rowClassName({ row, rowIndex }) {
|
|
117
|
+
if (row.errorMsg) {
|
|
118
|
+
return "hy-el-table-v2__row-error";
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
function onTabChange(value) {
|
|
122
|
+
if (tabValue.value === value) return;
|
|
123
|
+
tabValue.value = value;
|
|
124
|
+
if (tabValue.value === "all") {
|
|
125
|
+
setData(dataSource.value);
|
|
126
|
+
} else {
|
|
127
|
+
const data = dataSource.value.filter((data2) => {
|
|
128
|
+
return !!data2.errorMsg;
|
|
129
|
+
});
|
|
130
|
+
setData(data);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
async function onExpandRowChange(row) {
|
|
134
|
+
await nextTick();
|
|
135
|
+
if (!formRef.value) return;
|
|
136
|
+
const valid = await initValidateHandler([row]);
|
|
137
|
+
if (valid) return;
|
|
138
|
+
formRef.value.validate();
|
|
139
|
+
isExpandValidate.value = true;
|
|
140
|
+
}
|
|
141
|
+
function onDeleteRowHandler(params) {
|
|
142
|
+
const { $index } = params;
|
|
143
|
+
dataSource.value.splice($index, 1);
|
|
144
|
+
}
|
|
145
|
+
async function onAddRowHandler() {
|
|
146
|
+
const data = resetAppFormValue(props.formColumns, {
|
|
147
|
+
onlyId: /* @__PURE__ */ Symbol("onlyId")
|
|
148
|
+
});
|
|
149
|
+
await initValidateHandler([data]);
|
|
150
|
+
dataSource.value.push(data);
|
|
151
|
+
}
|
|
152
|
+
async function initValidateHandler(dataSource2) {
|
|
153
|
+
let promiseList = [];
|
|
154
|
+
for (const data of dataSource2) {
|
|
155
|
+
promiseList.push(
|
|
156
|
+
new Promise(async (resolve, reject) => {
|
|
157
|
+
try {
|
|
158
|
+
const res = await doValidate(data, props.formColumns, props.rules);
|
|
159
|
+
data.errorMsg = data.errorMsg && !data.errorMsg.prop ? data.errorMsg : null;
|
|
160
|
+
data.errorMap = /* @__PURE__ */ new Map();
|
|
161
|
+
resolve();
|
|
162
|
+
} catch (error) {
|
|
163
|
+
const errorMap = /* @__PURE__ */ new Map();
|
|
164
|
+
error.forEach((item, index) => {
|
|
165
|
+
const errData = {
|
|
166
|
+
prop: item.field,
|
|
167
|
+
message: item.message || `${item.field} is required`
|
|
168
|
+
};
|
|
169
|
+
if (!data.errorMsg) {
|
|
170
|
+
data.errorMsg = errData;
|
|
171
|
+
}
|
|
172
|
+
errorMap.set(errData.prop, errData.message);
|
|
173
|
+
});
|
|
174
|
+
data.errorMap = errorMap;
|
|
175
|
+
reject();
|
|
176
|
+
}
|
|
177
|
+
})
|
|
178
|
+
);
|
|
179
|
+
}
|
|
180
|
+
if (!promiseList.length) return true;
|
|
181
|
+
const result = await Promise.allSettled(promiseList);
|
|
182
|
+
return result.every((res) => res.status === "fulfilled");
|
|
183
|
+
}
|
|
184
|
+
async function onValidateHandler(row, { prop, isValid, message }) {
|
|
185
|
+
if (!row.errorMap) {
|
|
186
|
+
row.errorMap = /* @__PURE__ */ new Map();
|
|
187
|
+
}
|
|
188
|
+
if (isValid) {
|
|
189
|
+
row.errorMap.delete(prop);
|
|
190
|
+
if (row.errorMsg && (row.errorMsg.prop === prop || !row.errorMap.has(prop))) {
|
|
191
|
+
if (row.errorMap.size) {
|
|
192
|
+
const [prop2, message2] = Array.from(row.errorMap.entries())[0];
|
|
193
|
+
row.errorMsg = { prop: prop2, message: message2 };
|
|
194
|
+
} else {
|
|
195
|
+
row.errorMsg = null;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
} else {
|
|
199
|
+
row.errorMap.set(prop, message);
|
|
200
|
+
if (!row.errorMsg || !row.errorMsg.prop) {
|
|
201
|
+
row.errorMsg = {
|
|
202
|
+
prop,
|
|
203
|
+
message
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
const { onlyId, errorMsg, errorMap, children, ...data } = row;
|
|
208
|
+
emits("validate", {
|
|
209
|
+
row: data,
|
|
210
|
+
prop,
|
|
211
|
+
isValid,
|
|
212
|
+
message,
|
|
213
|
+
...statistics.value
|
|
214
|
+
});
|
|
215
|
+
console.log("validate", row, { prop, isValid, message });
|
|
216
|
+
}
|
|
217
|
+
__expose({
|
|
218
|
+
setData(data) {
|
|
219
|
+
dataSource.value = cloneDeep(data, true);
|
|
220
|
+
dataSource.value.forEach((item) => {
|
|
221
|
+
item.onlyId = /* @__PURE__ */ Symbol("onlyId");
|
|
222
|
+
});
|
|
223
|
+
initValidateHandler(dataSource.value);
|
|
224
|
+
setData(dataSource.value);
|
|
225
|
+
},
|
|
226
|
+
deleteData(data) {
|
|
227
|
+
if (!isArray(data)) {
|
|
228
|
+
data = isObject(data) ? [data] : [];
|
|
229
|
+
}
|
|
230
|
+
const keySet = data.reduce((set, item) => {
|
|
231
|
+
if (item.onlyId) set.add(item.onlyId);
|
|
232
|
+
return set;
|
|
233
|
+
}, /* @__PURE__ */ new Set());
|
|
234
|
+
console.log("keySet", Array.from(keySet.values()));
|
|
235
|
+
if (!keySet.size) return;
|
|
236
|
+
for (let i = 0; i < dataSource.value.length; i++) {
|
|
237
|
+
const target = dataSource.value[i];
|
|
238
|
+
if (keySet.has(target.onlyId)) {
|
|
239
|
+
keySet.delete(target.onlyId);
|
|
240
|
+
onDeleteRowHandler({ $index: i });
|
|
241
|
+
i--;
|
|
242
|
+
}
|
|
243
|
+
if (keySet.size === 0) break;
|
|
244
|
+
}
|
|
245
|
+
},
|
|
246
|
+
getTableDataSource() {
|
|
247
|
+
return dataSource.value.reduce((list, item) => {
|
|
248
|
+
const { onlyId, errorMsg, errorMap, children, ...data } = item;
|
|
249
|
+
list.push(data);
|
|
250
|
+
return list;
|
|
251
|
+
}, []);
|
|
252
|
+
},
|
|
253
|
+
getStatistics() {
|
|
254
|
+
return { ...statistics.value };
|
|
255
|
+
},
|
|
256
|
+
validate() {
|
|
257
|
+
return {
|
|
258
|
+
...statistics.value,
|
|
259
|
+
dataSource: dataSource.value
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
});
|
|
13
263
|
return (_ctx, _cache) => {
|
|
14
|
-
return openBlock(), createElementBlock(
|
|
15
|
-
|
|
16
|
-
|
|
264
|
+
return openBlock(), createElementBlock(
|
|
265
|
+
"div",
|
|
266
|
+
{
|
|
267
|
+
ref: "containerRef",
|
|
268
|
+
class: "hy-table-form"
|
|
269
|
+
},
|
|
270
|
+
[
|
|
271
|
+
createElementVNode("div", { class: "flex items-center justify-between mb-3 text-sm" }, [
|
|
272
|
+
createElementVNode("div", { class: "flex items-center gap-5" }, [
|
|
273
|
+
createElementVNode("div", { class: "text-auxiliary" }, [
|
|
274
|
+
createElementVNode("span", { class: "mr-1" }, "\u89E3\u6790\u603B\u6570"),
|
|
275
|
+
createElementVNode(
|
|
276
|
+
"span",
|
|
277
|
+
null,
|
|
278
|
+
toDisplayString(dataSource.value.length),
|
|
279
|
+
1
|
|
280
|
+
/* TEXT */
|
|
281
|
+
)
|
|
282
|
+
]),
|
|
283
|
+
statistics.value.success ? (openBlock(), createElementBlock("div", {
|
|
284
|
+
key: 0,
|
|
285
|
+
class: "flex items-center text-success"
|
|
286
|
+
}, [
|
|
287
|
+
createElementVNode("div", { class: "w-1.5 h-1.5 mr-1.5 rounded-full bg-success" }),
|
|
288
|
+
createElementVNode("span", null, "\u5C31\u7EEA"),
|
|
289
|
+
createElementVNode(
|
|
290
|
+
"span",
|
|
291
|
+
null,
|
|
292
|
+
toDisplayString(statistics.value.success),
|
|
293
|
+
1
|
|
294
|
+
/* TEXT */
|
|
295
|
+
)
|
|
296
|
+
])) : createCommentVNode("v-if", true),
|
|
297
|
+
statistics.value.failed ? (openBlock(), createElementBlock("div", {
|
|
298
|
+
key: 1,
|
|
299
|
+
class: "flex items-center text-danger-2"
|
|
300
|
+
}, [
|
|
301
|
+
createElementVNode("div", { class: "w-1.5 h-1.5 mr-1.5 rounded-full bg-danger-2" }),
|
|
302
|
+
createElementVNode("span", null, "\u5F02\u5E38"),
|
|
303
|
+
createElementVNode(
|
|
304
|
+
"span",
|
|
305
|
+
null,
|
|
306
|
+
toDisplayString(statistics.value.failed),
|
|
307
|
+
1
|
|
308
|
+
/* TEXT */
|
|
309
|
+
)
|
|
310
|
+
])) : createCommentVNode("v-if", true)
|
|
311
|
+
]),
|
|
312
|
+
createElementVNode("div", { class: "flex items-center gap-3" }, [
|
|
313
|
+
createVNode(unref(HyButton), {
|
|
314
|
+
type: "success",
|
|
315
|
+
size: "small",
|
|
316
|
+
"svg-name": "ops-button-add",
|
|
317
|
+
onClick: onAddRowHandler
|
|
318
|
+
}, {
|
|
319
|
+
default: withCtx(() => [
|
|
320
|
+
createTextVNode("\u6DFB\u52A0\u6570\u636E")
|
|
321
|
+
]),
|
|
322
|
+
_: 1
|
|
323
|
+
/* STABLE */
|
|
324
|
+
}),
|
|
325
|
+
createElementVNode("div", { class: "hy-table-form-tabs" }, [
|
|
326
|
+
(openBlock(true), createElementBlock(
|
|
327
|
+
Fragment,
|
|
328
|
+
null,
|
|
329
|
+
renderList(tabList.value, (item) => {
|
|
330
|
+
return openBlock(), createElementBlock("div", {
|
|
331
|
+
key: item.value,
|
|
332
|
+
class: normalizeClass(["hy-table-form-tab-button", { "is-select": item.value === tabValue.value }]),
|
|
333
|
+
onClick: ($event) => onTabChange(item.value)
|
|
334
|
+
}, toDisplayString(item.label), 11, ["onClick"]);
|
|
335
|
+
}),
|
|
336
|
+
128
|
|
337
|
+
/* KEYED_FRAGMENT */
|
|
338
|
+
))
|
|
339
|
+
])
|
|
340
|
+
])
|
|
341
|
+
]),
|
|
342
|
+
createVNode(unref(HyTable), mergeProps({
|
|
343
|
+
ref_key: "tableRef",
|
|
344
|
+
ref: tableRef
|
|
345
|
+
}, _ctx.$attrs, {
|
|
346
|
+
type: "virtual",
|
|
347
|
+
"row-key": "onlyId",
|
|
348
|
+
tableColumns: tableFormColumns.value,
|
|
349
|
+
rowClassName,
|
|
350
|
+
showHeader: true,
|
|
351
|
+
emptyText: __props.emptyText,
|
|
352
|
+
fontSize: __props.fontSize,
|
|
353
|
+
rowClickExpand: __props.rowClickExpand,
|
|
354
|
+
showEditable: false,
|
|
355
|
+
showOperate: false,
|
|
356
|
+
showPagination: false,
|
|
357
|
+
expandMode: "accordion",
|
|
358
|
+
onExpandChange: onExpandRowChange
|
|
359
|
+
}), createSlots({
|
|
360
|
+
validateStatus: withCtx(({ row }) => [
|
|
361
|
+
createElementVNode(
|
|
362
|
+
"div",
|
|
363
|
+
{
|
|
364
|
+
class: normalizeClass(["flex items-center gap-1.5", [row.errorMsg ? "text-danger-2" : "text-success"]])
|
|
365
|
+
},
|
|
366
|
+
[
|
|
367
|
+
createElementVNode(
|
|
368
|
+
"div",
|
|
369
|
+
{
|
|
370
|
+
class: normalizeClass(["w-1.5 h-1.5 rounded-full", [row.errorMsg ? "bg-danger-2" : "bg-success"]])
|
|
371
|
+
},
|
|
372
|
+
null,
|
|
373
|
+
2
|
|
374
|
+
/* CLASS */
|
|
375
|
+
),
|
|
376
|
+
createElementVNode(
|
|
377
|
+
"div",
|
|
378
|
+
{ class: "text-sm" },
|
|
379
|
+
toDisplayString(!row.errorMsg ? "\u51C6\u5907\u5C31\u7EEA" : row.errorMsg.prop ? "\u5185\u5BB9\u6709\u8BEF" : "\u6821\u9A8C\u5931\u8D25"),
|
|
380
|
+
1
|
|
381
|
+
/* TEXT */
|
|
382
|
+
)
|
|
383
|
+
],
|
|
384
|
+
2
|
|
385
|
+
/* CLASS */
|
|
386
|
+
)
|
|
387
|
+
]),
|
|
388
|
+
_: 2
|
|
389
|
+
/* DYNAMIC */
|
|
390
|
+
}, [
|
|
391
|
+
renderList(_ctx.$slots, (_, slotName) => {
|
|
392
|
+
return {
|
|
393
|
+
name: slotName,
|
|
394
|
+
fn: withCtx((scope) => [
|
|
395
|
+
renderSlot(_ctx.$slots, slotName, normalizeProps(guardReactiveProps(scope)))
|
|
396
|
+
])
|
|
397
|
+
};
|
|
398
|
+
}),
|
|
399
|
+
expandColumn.value && !_ctx.$slots[expandColumn.value.slot] && __props.formColumns ? {
|
|
400
|
+
name: expandColumn.value.slot,
|
|
401
|
+
fn: withCtx(({ row }) => [
|
|
402
|
+
createElementVNode("div", { class: "w-full pl-[52px] pr-[62px] pb-2" }, [
|
|
403
|
+
createElementVNode("div", { class: "h-[32px]" }, [
|
|
404
|
+
createElementVNode(
|
|
405
|
+
"div",
|
|
406
|
+
{
|
|
407
|
+
class: normalizeClass(["flex items-center gap-1.5 text-danger-2 transition-all duration-300 overflow-hidden", [row.errorMsg ? "h-full" : "h-0"]])
|
|
408
|
+
},
|
|
409
|
+
[
|
|
410
|
+
row.errorMsg ? (openBlock(), createBlock(unref(ElIcon), { key: 0 }, {
|
|
411
|
+
default: withCtx(() => [
|
|
412
|
+
createVNode(unref(Warning))
|
|
413
|
+
]),
|
|
414
|
+
_: 1
|
|
415
|
+
/* STABLE */
|
|
416
|
+
})) : createCommentVNode("v-if", true),
|
|
417
|
+
createElementVNode(
|
|
418
|
+
"span",
|
|
419
|
+
null,
|
|
420
|
+
toDisplayString(row.errorMsg ? row.errorMsg.message : ""),
|
|
421
|
+
1
|
|
422
|
+
/* TEXT */
|
|
423
|
+
)
|
|
424
|
+
],
|
|
425
|
+
2
|
|
426
|
+
/* CLASS */
|
|
427
|
+
)
|
|
428
|
+
]),
|
|
429
|
+
createVNode(unref(HyForm), {
|
|
430
|
+
ref_key: "formRef",
|
|
431
|
+
ref: formRef,
|
|
432
|
+
model: row,
|
|
433
|
+
columns: __props.formColumns,
|
|
434
|
+
rules: __props.rules,
|
|
435
|
+
"show-message": false,
|
|
436
|
+
class: "px-0",
|
|
437
|
+
columnNum: __props.columnNum,
|
|
438
|
+
size: __props.size,
|
|
439
|
+
onValidate: (prop, isValid, message) => onValidateHandler(row, { prop, isValid, message })
|
|
440
|
+
}, createSlots({
|
|
441
|
+
_: 2
|
|
442
|
+
/* DYNAMIC */
|
|
443
|
+
}, [
|
|
444
|
+
renderList(_ctx.$slots, (_, slotName) => {
|
|
445
|
+
return {
|
|
446
|
+
name: slotName,
|
|
447
|
+
fn: withCtx((scope) => [
|
|
448
|
+
renderSlot(_ctx.$slots, slotName, normalizeProps(guardReactiveProps(scope)))
|
|
449
|
+
])
|
|
450
|
+
};
|
|
451
|
+
})
|
|
452
|
+
]), 1032, ["model", "columns", "rules", "columnNum", "size", "onValidate"])
|
|
453
|
+
])
|
|
454
|
+
]),
|
|
455
|
+
key: "0"
|
|
456
|
+
} : void 0
|
|
457
|
+
]), 1040, ["tableColumns", "emptyText", "fontSize", "rowClickExpand"])
|
|
458
|
+
],
|
|
459
|
+
512
|
|
460
|
+
/* NEED_PATCH */
|
|
461
|
+
);
|
|
17
462
|
};
|
|
18
463
|
}
|
|
19
464
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ref, computed, openBlock, createBlock, unref, mergeProps, createSlots, withCtx, renderSlot, createTextVNode, toDisplayString, createElementBlock, normalizeClass, defineComponent } from 'vue';
|
|
2
2
|
import { ElTooltip } from 'element-plus';
|
|
3
|
-
import { useTooltipConfig } from '../../hooks/useTooltipConfig.mjs';
|
|
4
3
|
import { isNumber, isBoolean, isOverflowing } from '../../utils/is.mjs';
|
|
4
|
+
import { useTooltipConfig } from '../../hooks/useTooltipConfig.mjs';
|
|
5
5
|
|
|
6
6
|
import "./style/tooltip.scss";
|
|
7
7
|
|
|
@@ -15,7 +15,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
|
|
|
15
15
|
default: () => {
|
|
16
16
|
const { tooltipConfig } = useTooltipConfig();
|
|
17
17
|
const { isAlways } = tooltipConfig.value;
|
|
18
|
-
return isBoolean(isAlways) ? isAlways :
|
|
18
|
+
return isBoolean(isAlways) ? isAlways : true;
|
|
19
19
|
}
|
|
20
20
|
},
|
|
21
21
|
disabled: {
|
|
@@ -34,7 +34,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
|
|
|
34
34
|
}
|
|
35
35
|
},
|
|
36
36
|
content: {
|
|
37
|
-
type: String
|
|
37
|
+
type: [String, Number]
|
|
38
38
|
}
|
|
39
39
|
},
|
|
40
40
|
setup(__props) {
|
|
@@ -66,16 +66,16 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
|
|
|
66
66
|
"popper-class": "max-w-[300px]"
|
|
67
67
|
}, _ctx.$attrs, {
|
|
68
68
|
disabled: isDisabled.value,
|
|
69
|
-
content: _ctx.$slots.content ? void 0 : __props.content
|
|
69
|
+
content: _ctx.$slots.content ? void 0 : unref(isNumber)(__props.content) ? `${__props.content}` : __props.content
|
|
70
70
|
}), createSlots({
|
|
71
71
|
default: withCtx(() => [
|
|
72
|
-
__props.isAlways ? renderSlot(_ctx.$slots, "default", {
|
|
72
|
+
__props.isAlways ? renderSlot(_ctx.$slots, "default", {}, () => [
|
|
73
73
|
createTextVNode(
|
|
74
74
|
toDisplayString(__props.content),
|
|
75
75
|
1
|
|
76
76
|
/* TEXT */
|
|
77
77
|
)
|
|
78
|
-
]) : (openBlock(), createElementBlock(
|
|
78
|
+
], void 0, 0) : (openBlock(), createElementBlock(
|
|
79
79
|
"span",
|
|
80
80
|
{
|
|
81
81
|
key: 1,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@import url('hy-virtual-tree/style');
|
|
@@ -6,6 +6,8 @@ import { searchTypeConfig, treeTypeConfig } from './config/tree-config.mjs';
|
|
|
6
6
|
import { useMixins } from '../../hooks/useMixins.mjs';
|
|
7
7
|
import { HyIcon } from '../hyIcon/index.mjs';
|
|
8
8
|
|
|
9
|
+
import "./style/index.css";
|
|
10
|
+
|
|
9
11
|
const __default__ = defineComponent({
|
|
10
12
|
name: "HyTree"
|
|
11
13
|
});
|