@robot-admin/naive-ui-components 0.11.7 → 0.12.1
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/CHANGELOG.md +18 -0
- package/README.md +146 -29
- package/README_EN.md +146 -29
- package/SECURITY.md +1 -0
- package/dist/C_ActionBar.cjs +1 -1
- package/dist/C_ActionBar.css +53 -53
- package/dist/C_ActionBar.d.cts +2 -2
- package/dist/C_ActionBar.d.ts +2 -2
- package/dist/C_ActionBar.js +1 -1
- package/dist/C_ActionBar2.cjs +1 -1
- package/dist/C_ActionBar2.js +1 -1
- package/dist/C_AntV.css +67 -67
- package/dist/C_AntV2.cjs +3 -3
- package/dist/C_AntV2.js +3 -3
- package/dist/C_AudioPlayer.d.cts +1 -1
- package/dist/C_AudioPlayer.d.ts +1 -1
- package/dist/C_AvatarGroup.d.cts +1 -1
- package/dist/C_AvatarGroup.d.ts +1 -1
- package/dist/C_Barcode.d.cts +1 -1
- package/dist/C_Barcode.d.ts +1 -1
- package/dist/C_Breadcrumb.d.cts +1 -1
- package/dist/C_Breadcrumb.d.ts +1 -1
- package/dist/C_Captcha.cjs +1 -1
- package/dist/C_Captcha.css +193 -51
- package/dist/C_Captcha.d.cts +2 -3
- package/dist/C_Captcha.d.ts +2 -3
- package/dist/C_Captcha.js +1 -1
- package/dist/C_Captcha2.cjs +1 -1
- package/dist/C_Captcha2.js +1 -1
- package/dist/C_Cascade.d.cts +1 -1
- package/dist/C_Cascade.d.ts +1 -1
- package/dist/C_Chat.d.cts +1 -1
- package/dist/C_Chat.d.ts +1 -1
- package/dist/C_City.d.cts +1 -1
- package/dist/C_City.d.ts +1 -1
- package/dist/C_Code.d.cts +1 -1
- package/dist/C_Code.d.ts +1 -1
- package/dist/C_ContextMenu.d.cts +1 -1
- package/dist/C_ContextMenu.d.ts +1 -1
- package/dist/C_Date.d.cts +1 -1
- package/dist/C_Date.d.ts +1 -1
- package/dist/C_Editor.d.cts +1 -1
- package/dist/C_Editor.d.ts +1 -1
- package/dist/C_FormModal.cjs +1 -0
- package/dist/C_FormModal.css +41 -0
- package/dist/C_FormModal.d.cts +2 -0
- package/dist/C_FormModal.d.ts +3 -0
- package/dist/C_FormModal.js +1 -0
- package/dist/C_FormModal2.cjs +1 -0
- package/dist/C_FormModal2.js +1 -0
- package/dist/C_Login.css +210 -127
- package/dist/C_Login2.cjs +1 -1
- package/dist/C_Login2.js +1 -1
- package/dist/C_Map.css +3 -3
- package/dist/C_Map2.cjs +1 -1
- package/dist/C_Map2.js +1 -1
- package/dist/C_Menu.d.cts +1 -1
- package/dist/C_Table.base.css +86 -86
- package/dist/C_Table.cjs +1 -1
- package/dist/C_Table.css +86 -86
- package/dist/C_Table.d.ts +4 -3
- package/dist/C_Table.js +1 -1
- package/dist/C_Tabs.cjs +1 -0
- package/dist/C_Tabs.css +1 -0
- package/dist/C_Tabs.d.cts +2 -0
- package/dist/C_Tabs.d.ts +2 -0
- package/dist/C_Tabs.js +1 -0
- package/dist/C_TagsView.css +38 -38
- package/dist/C_TagsView2.cjs +1 -1
- package/dist/C_TagsView2.js +1 -1
- package/dist/C_VtableGantt.css +19 -19
- package/dist/C_VtableGantt2.cjs +1 -1
- package/dist/C_VtableGantt2.js +1 -1
- package/dist/constants.d.cts +2 -2
- package/dist/constants.d.ts +2 -2
- package/dist/constants2.d.cts +2 -2
- package/dist/constants2.d.ts +2 -2
- package/dist/constants3.d.cts +2 -2
- package/dist/constants3.d.ts +2 -2
- package/dist/constants4.d.cts +4 -4
- package/dist/constants4.d.ts +4 -4
- package/dist/constants5.d.cts +2 -2
- package/dist/constants5.d.ts +2 -2
- package/dist/data.d.cts +108 -0
- package/dist/data.d.ts +108 -0
- package/dist/data2.cjs +1 -0
- package/dist/data2.js +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +49 -48
- package/dist/index.d.ts +51 -49
- package/dist/index.js +1 -1
- package/dist/index.vue.d.cts +72 -69
- package/dist/index.vue.d.ts +72 -69
- package/dist/index10.vue.d.cts +80 -39
- package/dist/index10.vue.d.ts +68 -77
- package/dist/index11.vue.d.cts +68 -77
- package/dist/index11.vue.d.ts +53 -68
- package/dist/index12.vue.d.cts +53 -68
- package/dist/index12.vue.d.ts +52 -58
- package/dist/index13.vue.d.cts +52 -58
- package/dist/index13.vue.d.ts +3 -3
- package/dist/index14.vue.d.cts +3 -3
- package/dist/index14.vue.d.ts +5 -5
- package/dist/index15.vue.d.cts +5 -5
- package/dist/index15.vue.d.ts +2 -2
- package/dist/index16.vue.d.cts +2 -2
- package/dist/index16.vue.d.ts +14 -11
- package/dist/index17.vue.d.cts +14 -11
- package/dist/index17.vue.d.ts +4 -4
- package/dist/index18.vue.d.cts +4 -4
- package/dist/index18.vue.d.ts +3 -3
- package/dist/index19.vue.d.cts +2 -2
- package/dist/index19.vue.d.ts +2 -2
- package/dist/index2.vue.d.cts +70 -65
- package/dist/index2.vue.d.ts +70 -65
- package/dist/index20.vue.d.cts +1 -1
- package/dist/index20.vue.d.ts +1 -1
- package/dist/index21.vue.d.cts +2 -2
- package/dist/index21.vue.d.ts +2 -2
- package/dist/index22.vue.d.cts +1 -1
- package/dist/index22.vue.d.ts +1 -1
- package/dist/index24.vue.d.cts +2 -2
- package/dist/index24.vue.d.ts +2 -2
- package/dist/index25.vue.d.cts +1 -1
- package/dist/index25.vue.d.ts +1 -1
- package/dist/index27.vue.d.cts +2 -2
- package/dist/index27.vue.d.ts +2 -2
- package/dist/index3.vue.d.cts +30 -80
- package/dist/index3.vue.d.ts +30 -80
- package/dist/index4.vue.d.cts +130 -30
- package/dist/index4.vue.d.ts +22 -30
- package/dist/index5.vue.d.cts +18 -126
- package/dist/index5.vue.d.ts +22 -19
- package/dist/index6.vue.d.cts +22 -19
- package/dist/index6.vue.d.ts +117 -22
- package/dist/index7.vue.d.cts +117 -22
- package/dist/index7.vue.d.ts +17 -110
- package/dist/index8.vue.d.cts +17 -110
- package/dist/index8.vue.d.ts +37 -24
- package/dist/index9.vue.d.cts +37 -24
- package/dist/index9.vue.d.ts +80 -39
- package/dist/mapUtils.d.cts +4 -4
- package/dist/mapUtils.d.ts +4 -4
- package/dist/presets.d.cts +96 -0
- package/dist/presets.d.ts +96 -0
- package/dist/resolver.cjs +1 -1
- package/dist/resolver.d.cts +1 -1
- package/dist/resolver.d.ts +1 -1
- package/dist/resolver.js +1 -1
- package/dist/style.css +520 -393
- package/dist/useCalendarEvents.d.cts +1 -1
- package/dist/useCalendarEvents.d.ts +1 -1
- package/dist/useCollapsePanel.d.cts +8 -8
- package/dist/useCollapsePanel.d.ts +8 -8
- package/dist/useCropperCore.d.cts +9 -9
- package/dist/useCropperCore.d.ts +9 -9
- package/dist/useDraggableLayout.d.cts +2 -2
- package/dist/useDraggableLayout.d.ts +2 -2
- package/dist/useEdgeInteraction.d.cts +3 -2
- package/dist/useEdgeInteraction.d.ts +3 -2
- package/dist/useInfiniteScroll.d.cts +1 -1
- package/dist/useInfiniteScroll.d.ts +1 -1
- package/dist/useQRCode.d.cts +4 -4
- package/dist/useQRCode.d.ts +4 -4
- package/dist/useSearchState.d.cts +6 -6
- package/dist/useSearchState.d.ts +6 -6
- package/dist/useSignatureHistory.d.cts +4 -4
- package/dist/useSignatureHistory.d.ts +4 -4
- package/dist/useSplitResize.d.cts +6 -6
- package/dist/useSplitResize.d.ts +6 -6
- package/dist/useTableQuery.cjs +3 -3
- package/dist/useTableQuery.d.cts +10 -0
- package/dist/useTableQuery.d.ts +10 -0
- package/dist/useTableQuery.js +3 -3
- package/dist/useTimeSelection.d.cts +5 -5
- package/dist/useTimeSelection.d.ts +5 -5
- package/dist/useTreeOperations.d.cts +8 -8
- package/dist/useTreeOperations.d.ts +8 -8
- package/dist/useWorkflowValidation.d.cts +4 -4
- package/dist/useWorkflowValidation.d.ts +4 -4
- package/dist/verification.d.cts +70 -5
- package/dist/verification.d.ts +70 -5
- package/package.json +2 -1
- package/dist/types.d.ts +0 -58
- package/dist/types2.d.cts +0 -58
package/dist/C_TagsView.css
CHANGED
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
* 标签组件样式 - 精简版
|
|
62
62
|
* =========================================== */
|
|
63
63
|
/* --------- 标签视图容器 --------- */
|
|
64
|
-
.tags-view-container[data-v-
|
|
64
|
+
.tags-view-container[data-v-7078e2ed] {
|
|
65
65
|
border-bottom: 1px solid var(--color-border);
|
|
66
66
|
padding: 8px 16px 0;
|
|
67
67
|
position: relative;
|
|
@@ -69,14 +69,14 @@
|
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
/* --------- 滚动轨道容器 --------- */
|
|
72
|
-
.tags-track[data-v-
|
|
72
|
+
.tags-track[data-v-7078e2ed] {
|
|
73
73
|
width: 100%;
|
|
74
74
|
overflow: hidden;
|
|
75
75
|
position: relative;
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
/* --------- 滚动容器 --------- */
|
|
79
|
-
.tags-container[data-v-
|
|
79
|
+
.tags-container[data-v-7078e2ed] {
|
|
80
80
|
display: flex;
|
|
81
81
|
overflow-x: auto;
|
|
82
82
|
overflow-y: hidden;
|
|
@@ -86,12 +86,12 @@
|
|
|
86
86
|
align-items: center;
|
|
87
87
|
min-height: 40px;
|
|
88
88
|
}
|
|
89
|
-
.tags-container[data-v-
|
|
89
|
+
.tags-container[data-v-7078e2ed]::-webkit-scrollbar {
|
|
90
90
|
display: none;
|
|
91
91
|
}
|
|
92
92
|
|
|
93
93
|
/* --------- 现代化标签样式 --------- */
|
|
94
|
-
.n-tag[data-v-
|
|
94
|
+
.n-tag[data-v-7078e2ed] {
|
|
95
95
|
position: relative;
|
|
96
96
|
display: inline-flex;
|
|
97
97
|
align-items: center;
|
|
@@ -108,7 +108,7 @@
|
|
|
108
108
|
white-space: nowrap;
|
|
109
109
|
/* 内部高光效果 */
|
|
110
110
|
}
|
|
111
|
-
.n-tag[data-v-
|
|
111
|
+
.n-tag[data-v-7078e2ed]::before {
|
|
112
112
|
content: "";
|
|
113
113
|
position: absolute;
|
|
114
114
|
top: 1px;
|
|
@@ -120,67 +120,67 @@
|
|
|
120
120
|
opacity: 0.5;
|
|
121
121
|
transition: opacity 0.22s ease;
|
|
122
122
|
}
|
|
123
|
-
.n-tag[data-v-
|
|
123
|
+
.n-tag[data-v-7078e2ed] {
|
|
124
124
|
/* --------- 悬停效果 --------- */
|
|
125
125
|
}
|
|
126
|
-
.n-tag[data-v-
|
|
126
|
+
.n-tag[data-v-7078e2ed]:hover:not([type=primary]) {
|
|
127
127
|
color: var(--color-primary) !important;
|
|
128
128
|
border-color: var(--color-primary);
|
|
129
129
|
transform: scale(1.02);
|
|
130
130
|
}
|
|
131
|
-
.n-tag[data-v-
|
|
131
|
+
.n-tag[data-v-7078e2ed]:hover:not([type=primary])::before {
|
|
132
132
|
opacity: 0.8;
|
|
133
133
|
}
|
|
134
|
-
.n-tag[data-v-
|
|
135
|
-
.n-tag[data-v-
|
|
134
|
+
.n-tag[data-v-7078e2ed]:hover:not([type=primary]) .c-icon,
|
|
135
|
+
.n-tag[data-v-7078e2ed]:hover:not([type=primary]) [class*='c-icon'] {
|
|
136
136
|
color: var(--color-primary) !important;
|
|
137
137
|
}
|
|
138
|
-
.n-tag:hover:not([type=primary]) i[data-v-
|
|
139
|
-
.n-tag:hover:not([type=primary]) .icon[data-v-
|
|
138
|
+
.n-tag:hover:not([type=primary]) i[data-v-7078e2ed],
|
|
139
|
+
.n-tag:hover:not([type=primary]) .icon[data-v-7078e2ed] {
|
|
140
140
|
color: var(--color-primary) !important;
|
|
141
141
|
}
|
|
142
|
-
.n-tag[data-v-
|
|
142
|
+
.n-tag[data-v-7078e2ed]:hover:not([type=primary]) .n-tag__close {
|
|
143
143
|
color: var(--color-primary) !important;
|
|
144
144
|
opacity: 0.8;
|
|
145
145
|
transform: scale(1.05);
|
|
146
146
|
}
|
|
147
|
-
.n-tag[data-v-
|
|
147
|
+
.n-tag[data-v-7078e2ed] {
|
|
148
148
|
/* --------- 激活状态 --------- */
|
|
149
149
|
}
|
|
150
|
-
.n-tag[type=primary][data-v-
|
|
150
|
+
.n-tag[type=primary][data-v-7078e2ed] {
|
|
151
151
|
background: var(--tag-active-bg, rgba(32, 128, 240, 0.08)) !important;
|
|
152
152
|
color: var(--color-primary) !important;
|
|
153
153
|
border-color: var(--color-primary) !important;
|
|
154
154
|
font-weight: 600;
|
|
155
155
|
transform: scale(1.02);
|
|
156
156
|
}
|
|
157
|
-
.n-tag[type=primary][data-v-
|
|
157
|
+
.n-tag[type=primary][data-v-7078e2ed]::before {
|
|
158
158
|
opacity: 0.6;
|
|
159
159
|
}
|
|
160
|
-
.n-tag[type=primary][data-v-
|
|
161
|
-
.n-tag[type=primary][data-v-
|
|
160
|
+
.n-tag[type=primary][data-v-7078e2ed] .n-tag__content,
|
|
161
|
+
.n-tag[type=primary][data-v-7078e2ed] *:not(.n-tag__close) {
|
|
162
162
|
color: var(--color-primary) !important;
|
|
163
163
|
}
|
|
164
|
-
.n-tag[type=primary][data-v-
|
|
165
|
-
.n-tag[type=primary][data-v-
|
|
164
|
+
.n-tag[type=primary][data-v-7078e2ed] .c-icon,
|
|
165
|
+
.n-tag[type=primary][data-v-7078e2ed] [class*='c-icon'] {
|
|
166
166
|
color: var(--color-primary) !important;
|
|
167
167
|
}
|
|
168
|
-
.n-tag[type=primary] i[data-v-
|
|
169
|
-
.n-tag[type=primary] .icon[data-v-
|
|
168
|
+
.n-tag[type=primary] i[data-v-7078e2ed],
|
|
169
|
+
.n-tag[type=primary] .icon[data-v-7078e2ed] {
|
|
170
170
|
color: var(--color-primary) !important;
|
|
171
171
|
}
|
|
172
|
-
.n-tag[type=primary][data-v-
|
|
172
|
+
.n-tag[type=primary][data-v-7078e2ed]:hover {
|
|
173
173
|
background: var(--tag-active-hover-bg, rgba(32, 128, 240, 0.12)) !important;
|
|
174
174
|
transform: scale(1.03);
|
|
175
175
|
}
|
|
176
|
-
.n-tag[type=primary][data-v-
|
|
176
|
+
.n-tag[type=primary][data-v-7078e2ed] .n-tag__close {
|
|
177
177
|
color: var(--color-primary) !important;
|
|
178
178
|
opacity: 0.8;
|
|
179
179
|
}
|
|
180
|
-
.n-tag[data-v-
|
|
180
|
+
.n-tag[data-v-7078e2ed] {
|
|
181
181
|
/* --------- 关闭按钮 --------- */
|
|
182
182
|
}
|
|
183
|
-
.n-tag[data-v-
|
|
183
|
+
.n-tag[data-v-7078e2ed] .n-tag__close {
|
|
184
184
|
width: 16px !important;
|
|
185
185
|
height: 16px !important;
|
|
186
186
|
border-radius: 8px !important;
|
|
@@ -195,10 +195,10 @@
|
|
|
195
195
|
background: rgba(0, 0, 0, 0.02) !important;
|
|
196
196
|
border: 1px solid transparent;
|
|
197
197
|
}
|
|
198
|
-
.n-tag[data-v-
|
|
198
|
+
.n-tag[data-v-7078e2ed] .n-tag__close:not(:hover) {
|
|
199
199
|
transform: scale(0.9);
|
|
200
200
|
}
|
|
201
|
-
.n-tag[data-v-
|
|
201
|
+
.n-tag[data-v-7078e2ed] .n-tag__close:hover {
|
|
202
202
|
background: linear-gradient(135deg, rgba(248, 113, 113, 0.1), rgba(239, 68, 68, 0.08)) !important;
|
|
203
203
|
border-color: rgba(239, 68, 68, 0.15) !important;
|
|
204
204
|
color: #ef4444 !important;
|
|
@@ -206,13 +206,13 @@
|
|
|
206
206
|
transform: scale(0.6) !important;
|
|
207
207
|
box-shadow: 0 2px 6px rgba(239, 68, 68, 0.2) !important;
|
|
208
208
|
}
|
|
209
|
-
.n-tag[data-v-
|
|
209
|
+
.n-tag[data-v-7078e2ed] .n-tag__close:active {
|
|
210
210
|
transform: scale(0.95) !important;
|
|
211
211
|
transition-duration: 0.1s !important;
|
|
212
212
|
}
|
|
213
213
|
|
|
214
214
|
/* --------- C_Icon --------- */
|
|
215
|
-
[data-v-
|
|
215
|
+
[data-v-7078e2ed] .c-icon {
|
|
216
216
|
margin-right: 4px;
|
|
217
217
|
font-size: 12px;
|
|
218
218
|
transition: color 0.22s ease;
|
|
@@ -222,36 +222,36 @@
|
|
|
222
222
|
|
|
223
223
|
/* --------- 响应式 --------- */
|
|
224
224
|
@media (max-width: 768px) {
|
|
225
|
-
.tags-view-container[data-v-
|
|
225
|
+
.tags-view-container[data-v-7078e2ed] {
|
|
226
226
|
padding: 6px 12px 0;
|
|
227
227
|
}
|
|
228
|
-
.n-tag[data-v-
|
|
228
|
+
.n-tag[data-v-7078e2ed] {
|
|
229
229
|
height: 26px;
|
|
230
230
|
padding: 0 10px;
|
|
231
231
|
font-size: 11px;
|
|
232
232
|
margin-right: 3px;
|
|
233
233
|
border-radius: 13px;
|
|
234
234
|
}
|
|
235
|
-
.n-tag[data-v-
|
|
235
|
+
.n-tag[data-v-7078e2ed] .n-tag__close {
|
|
236
236
|
width: 14px;
|
|
237
237
|
height: 14px;
|
|
238
238
|
font-size: 11px;
|
|
239
239
|
margin-left: 4px;
|
|
240
240
|
}
|
|
241
|
-
.tags-container[data-v-
|
|
241
|
+
.tags-container[data-v-7078e2ed] {
|
|
242
242
|
padding: 0 12px;
|
|
243
243
|
min-height: 36px;
|
|
244
244
|
}
|
|
245
|
-
[data-v-
|
|
245
|
+
[data-v-7078e2ed] .c-icon {
|
|
246
246
|
font-size: 11px;
|
|
247
247
|
margin-right: 3px;
|
|
248
248
|
}
|
|
249
249
|
}
|
|
250
250
|
/* --------- 暗色主题 --------- */
|
|
251
|
-
[data-theme=dark] .n-tag[data-v-
|
|
251
|
+
[data-theme=dark] .n-tag[data-v-7078e2ed] .n-tag__close {
|
|
252
252
|
background: rgba(255, 255, 255, 0.03) !important;
|
|
253
253
|
}
|
|
254
|
-
[data-theme=dark] .n-tag[data-v-
|
|
254
|
+
[data-theme=dark] .n-tag[data-v-7078e2ed] .n-tag__close:hover {
|
|
255
255
|
background: linear-gradient(135deg, rgba(248, 113, 113, 0.12), rgba(239, 68, 68, 0.1)) !important;
|
|
256
256
|
box-shadow: 0 2px 6px rgba(239, 68, 68, 0.25) !important;
|
|
257
257
|
}
|
package/dist/C_TagsView2.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
require(`./chunk.cjs`);const e=require(`./C_Icon2.cjs`),t=require(`./export-helper.cjs`);let n=require(`vue`),r=require(`naive-ui`),i=require(`vue-router`);function a(e={}){let{persistKey:t=`__tags_view_list__`,homePath:r=`/home`}=e,i=()=>{if(!t)return[];try{let e=localStorage.getItem(t);return e?JSON.parse(e):[]}catch{return[]}},a=e=>{if(t)try{localStorage.setItem(t,JSON.stringify(e))}catch{}},o=(0,n.ref)(i()),s=(0,n.ref)(``),c=()=>a(o.value),l=e=>{e?o.value=e:o.value=[...new Map(o.value.map(e=>[e.path,e])).values()],c()},u=e=>{s.value=e};return{tagsViewList:o,activeTag:s,homePath:r,initTags:l,setActiveTag:u,addTag:e=>{let t=o.value.findIndex(t=>t.path===e.path);if(t===-1)o.value.push(e);else{let n=o.value[t];(n.title!==e.title||!n.originalTitle)&&(n.title=e.title,n.originalTitle=e.originalTitle||n.originalTitle)}u(e.path),c()},removeTag:e=>{if(e>=0&&e<o.value.length){let t=o.value.splice(e,1)[0]?.path??null;return c(),t}return null},removeOtherTags:e=>{e===0?o.value=[o.value[0]].filter(Boolean):o.value=[o.value[0],o.value[e]].filter(Boolean),c()},removeLeftTags:e=>{o.value=[o.value[0],...o.value.slice(e)],c()},removeRightTags:e=>{o.value=o.value.slice(0,e+1),c()},removeAllTags:()=>{o.value=o.value.filter(e=>e.meta?.affix),c()}}}const o={class:`tags-view-container`},s=(0,n.defineComponent)({name:`C_TagsView`,__name:`index`,props:{labelFormatter:{},homePath:{default:`/home`},homeTitle:{default:`首页`},homeIcon:{default:`mdi:home`},persistKey:{default:`__tags_view_list__`},contextMenuLabels:{default:()=>({close:`关闭`,closeOthers:`关闭其他`,closeLeft:`关闭左侧`,closeRight:`关闭右侧`,closeAll:`关闭所有`})},tagsViewOptions:{}},emits:[`close`,`closeAll`],setup(t,{expose:s,emit:c}){let l=t,u=c,d=(0,i.useRoute)(),f=(0,i.useRouter)(),p=a(l.tagsViewOptions??{persistKey:l.persistKey,homePath:l.homePath});if(p.tagsViewList.value.length>0&&l.labelFormatter){let e=f.getRoutes(),t=p.tagsViewList.value.map(t=>{let n=e.find(e=>e.path===t.path),r=t.originalTitle||n?.meta?.title||t.title;return{...t,originalTitle:r,title:l.labelFormatter(r)}});p.initTags(t)}let m=e=>l.labelFormatter?l.labelFormatter(e):e,h=(0,n.ref)(!1),g=(0,n.ref)(0),_=(0,n.ref)(0),v=(0,n.ref)(null),y=(0,n.ref)(-1),b=(0,n.ref)(),x=(0,n.ref)(),S=e=>e.path===d.path,C=e=>e.meta?.affix,w=e=>{let t=x.value;t&&(e.preventDefault(),t.scrollTo({left:t.scrollLeft+e.deltaY,behavior:`smooth`}))},T=e=>{(0,n.nextTick)(()=>{let t=x.value?.querySelector(`[data-path="${e}"]`);t&&t.scrollIntoView({behavior:`smooth`,block:`nearest`,inline:`center`})})},E=e=>{e.path!==d.path&&f.push(e.path),T(e.path)},D=(e,t)=>{if(C(e))return;let n=S(e),r=p.tagsViewList.value.length;if(p.removeTag(t),n){let e=p.tagsViewList.value,n=t===r-1,i;i=n?e[t-1]?.path||l.homePath:e[e.length-1]?.path||l.homePath,f.push(i),u(`close`,i)}},O=(e,t,n)=>{e.preventDefault(),v.value=t,y.value=n,h.value=!0,g.value=e.clientX,_.value=e.clientY},k=()=>h.value=!1,A=(0,n.computed)(()=>{let e=l.contextMenuLabels;return[{type:`option`,label:e.close??`关闭`,key:`close`,disabled:C(v.value),icon:()=>(0,n.h)(`span`,{class:`i-mdi:close`})},{type:`option`,label:e.closeOthers??`关闭其他`,key:`closeOthers`,icon:()=>(0,n.h)(`span`,{class:`i-mdi:arrow-left-right-bold`})},{type:`option`,label:e.closeLeft??`关闭左侧`,key:`closeLeft`,icon:()=>(0,n.h)(`span`,{class:`i-mdi:align-horizontal-left`})},{type:`option`,label:e.closeRight??`关闭右侧`,key:`closeRight`,icon:()=>(0,n.h)(`span`,{class:`i-mdi:align-horizontal-right`})},{type:`option`,label:e.closeAll??`关闭所有`,key:`closeAll`,icon:()=>(0,n.h)(`span`,{class:`i-mdi:tally-mark-5`})}]}),j=e=>{if(!(!v.value||y.value===-1)){switch(e){case`close`:D(v.value,y.value);break;case`closeOthers`:p.removeOtherTags(y.value);break;case`closeLeft`:p.removeLeftTags(y.value);break;case`closeRight`:p.removeRightTags(y.value);break;case`closeAll`:p.removeAllTags(),f.push(l.homePath),u(`closeAll`);break}k()}};return(0,n.watch)(()=>d.path,e=>{let t=e===l.homePath?l.homeTitle:d.meta.title||`Unnamed Page`;p.addTag({path:e,originalTitle:t,title:m(t),icon:e===l.homePath?l.homeIcon:d.meta.icon,meta:{affix:d.meta.affix}}),p.setActiveTag(e),T(e)},{immediate:!0}),s({tags:p,scrollToTag:T}),(t,i)=>{let a=r.NTag,s=r.NDropdown;return(0,n.openBlock)(),(0,n.createElementBlock)(`div`,o,[(0,n.createElementVNode)(`div`,{class:`tags-track`,ref_key:`tagsTrack`,ref:b,onWheel:w},[(0,n.createElementVNode)(`div`,{class:`tags-container`,ref_key:`tagsContainer`,ref:x},[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)((0,n.unref)(p).tagsViewList.value,(t,r)=>((0,n.openBlock)(),(0,n.createBlock)(a,{key:t.path,type:S(t)?`primary`:`default`,closable:!C(t),"data-path":t.path,onClose:(0,n.withModifiers)(e=>D(t,r),[`stop`]),onClick:e=>E(t),onContextmenu:(0,n.withModifiers)(e=>O(e,t,r),[`prevent`])},{icon:(0,n.withCtx)(()=>[(0,n.createVNode)((0,n.unref)(e.t),{name:t.icon,size:12},null,8,[`name`])]),default:(0,n.withCtx)(()=>[(0,n.createTextVNode)(` `+(0,n.toDisplayString)(t.title),1)]),_:2},1032,[`type`,`closable`,`data-path`,`onClose`,`onClick`,`onContextmenu`]))),128))],512)],544),h.value?((0,n.openBlock)(),(0,n.createBlock)(s,{key:0,show:h.value,options:A.value,x:g.value,y:_.value,onClickoutside:k,onSelect:j},null,8,[`show`,`options`,`x`,`y`])):(0,n.createCommentVNode)(`v-if`,!0)])}}});var c=t.t(s,[[`__scopeId`,`data-v-
|
|
1
|
+
require(`./chunk.cjs`);const e=require(`./C_Icon2.cjs`),t=require(`./export-helper.cjs`);let n=require(`vue`),r=require(`naive-ui`),i=require(`vue-router`);function a(e={}){let{persistKey:t=`__tags_view_list__`,homePath:r=`/home`}=e,i=()=>{if(!t)return[];try{let e=localStorage.getItem(t);return e?JSON.parse(e):[]}catch{return[]}},a=e=>{if(t)try{localStorage.setItem(t,JSON.stringify(e))}catch{}},o=(0,n.ref)(i()),s=(0,n.ref)(``),c=()=>a(o.value),l=e=>{e?o.value=e:o.value=[...new Map(o.value.map(e=>[e.path,e])).values()],c()},u=e=>{s.value=e};return{tagsViewList:o,activeTag:s,homePath:r,initTags:l,setActiveTag:u,addTag:e=>{let t=o.value.findIndex(t=>t.path===e.path);if(t===-1)o.value.push(e);else{let n=o.value[t];(n.title!==e.title||!n.originalTitle)&&(n.title=e.title,n.originalTitle=e.originalTitle||n.originalTitle)}u(e.path),c()},removeTag:e=>{if(e>=0&&e<o.value.length){let t=o.value.splice(e,1)[0]?.path??null;return c(),t}return null},removeOtherTags:e=>{e===0?o.value=[o.value[0]].filter(Boolean):o.value=[o.value[0],o.value[e]].filter(Boolean),c()},removeLeftTags:e=>{o.value=[o.value[0],...o.value.slice(e)],c()},removeRightTags:e=>{o.value=o.value.slice(0,e+1),c()},removeAllTags:()=>{o.value=o.value.filter(e=>e.meta?.affix),c()}}}const o={class:`tags-view-container`},s=(0,n.defineComponent)({name:`C_TagsView`,__name:`index`,props:{labelFormatter:{},homePath:{default:`/home`},homeTitle:{default:`首页`},homeIcon:{default:`mdi:home`},persistKey:{default:`__tags_view_list__`},contextMenuLabels:{default:()=>({close:`关闭`,closeOthers:`关闭其他`,closeLeft:`关闭左侧`,closeRight:`关闭右侧`,closeAll:`关闭所有`})},tagsViewOptions:{}},emits:[`close`,`closeAll`],setup(t,{expose:s,emit:c}){let l=t,u=c,d=(0,i.useRoute)(),f=(0,i.useRouter)(),p=a(l.tagsViewOptions??{persistKey:l.persistKey,homePath:l.homePath});if(p.tagsViewList.value.length>0&&l.labelFormatter){let e=f.getRoutes(),t=p.tagsViewList.value.map(t=>{let n=e.find(e=>e.path===t.path),r=t.originalTitle||n?.meta?.title||t.title;return{...t,originalTitle:r,title:l.labelFormatter(r)}});p.initTags(t)}let m=e=>l.labelFormatter?l.labelFormatter(e):e,h=(0,n.ref)(!1),g=(0,n.ref)(0),_=(0,n.ref)(0),v=(0,n.ref)(null),y=(0,n.ref)(-1),b=(0,n.ref)(),x=(0,n.ref)(),S=e=>e.path===d.path,C=e=>e.meta?.affix,w=e=>{let t=x.value;t&&(e.preventDefault(),t.scrollTo({left:t.scrollLeft+e.deltaY,behavior:`smooth`}))},T=e=>{(0,n.nextTick)(()=>{let t=x.value?.querySelector(`[data-path="${e}"]`);t&&t.scrollIntoView({behavior:`smooth`,block:`nearest`,inline:`center`})})},E=e=>{e.path!==d.path&&f.push(e.path).catch(()=>void 0),T(e.path)},D=(e,t)=>{if(C(e))return;let n=S(e),r=p.tagsViewList.value.length;if(p.removeTag(t),n){let e=p.tagsViewList.value,n=t===r-1,i;i=n?e[t-1]?.path||l.homePath:e[e.length-1]?.path||l.homePath,f.push(i).catch(()=>void 0),u(`close`,i)}},O=(e,t,n)=>{e.preventDefault(),v.value=t,y.value=n,h.value=!0,g.value=e.clientX,_.value=e.clientY},k=()=>h.value=!1,A=(0,n.computed)(()=>{let e=l.contextMenuLabels;return[{type:`option`,label:e.close??`关闭`,key:`close`,disabled:C(v.value),icon:()=>(0,n.h)(`span`,{class:`i-mdi:close`})},{type:`option`,label:e.closeOthers??`关闭其他`,key:`closeOthers`,icon:()=>(0,n.h)(`span`,{class:`i-mdi:arrow-left-right-bold`})},{type:`option`,label:e.closeLeft??`关闭左侧`,key:`closeLeft`,icon:()=>(0,n.h)(`span`,{class:`i-mdi:align-horizontal-left`})},{type:`option`,label:e.closeRight??`关闭右侧`,key:`closeRight`,icon:()=>(0,n.h)(`span`,{class:`i-mdi:align-horizontal-right`})},{type:`option`,label:e.closeAll??`关闭所有`,key:`closeAll`,icon:()=>(0,n.h)(`span`,{class:`i-mdi:tally-mark-5`})}]}),j=e=>{if(!(!v.value||y.value===-1)){switch(e){case`close`:D(v.value,y.value);break;case`closeOthers`:p.removeOtherTags(y.value);break;case`closeLeft`:p.removeLeftTags(y.value);break;case`closeRight`:p.removeRightTags(y.value);break;case`closeAll`:p.removeAllTags(),f.push(l.homePath).catch(()=>void 0),u(`closeAll`);break}k()}};return(0,n.watch)(()=>d.path,e=>{let t=e===l.homePath?l.homeTitle:d.meta.title||`Unnamed Page`;p.addTag({path:e,originalTitle:t,title:m(t),icon:e===l.homePath?l.homeIcon:d.meta.icon,meta:{affix:d.meta.affix}}),p.setActiveTag(e),T(e)},{immediate:!0}),s({tags:p,scrollToTag:T}),(t,i)=>{let a=r.NTag,s=r.NDropdown;return(0,n.openBlock)(),(0,n.createElementBlock)(`div`,o,[(0,n.createElementVNode)(`div`,{class:`tags-track`,ref_key:`tagsTrack`,ref:b,onWheel:w},[(0,n.createElementVNode)(`div`,{class:`tags-container`,ref_key:`tagsContainer`,ref:x},[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)((0,n.unref)(p).tagsViewList.value,(t,r)=>((0,n.openBlock)(),(0,n.createBlock)(a,{key:t.path,type:S(t)?`primary`:`default`,closable:!C(t),"data-path":t.path,onClose:(0,n.withModifiers)(e=>D(t,r),[`stop`]),onClick:e=>E(t),onContextmenu:(0,n.withModifiers)(e=>O(e,t,r),[`prevent`])},{icon:(0,n.withCtx)(()=>[(0,n.createVNode)((0,n.unref)(e.t),{name:t.icon,size:12},null,8,[`name`])]),default:(0,n.withCtx)(()=>[(0,n.createTextVNode)(` `+(0,n.toDisplayString)(t.title),1)]),_:2},1032,[`type`,`closable`,`data-path`,`onClose`,`onClick`,`onContextmenu`]))),128))],512)],544),h.value?((0,n.openBlock)(),(0,n.createBlock)(s,{key:0,show:h.value,options:A.value,x:g.value,y:_.value,onClickoutside:k,onSelect:j},null,8,[`show`,`options`,`x`,`y`])):(0,n.createCommentVNode)(`v-if`,!0)])}}});var c=t.t(s,[[`__scopeId`,`data-v-7078e2ed`]]);Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return c}});
|
package/dist/C_TagsView2.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./C_Icon2.js";import{t}from"./export-helper.js";import{Fragment as n,computed as r,createBlock as i,createCommentVNode as a,createElementBlock as o,createElementVNode as s,createTextVNode as c,createVNode as l,defineComponent as u,h as d,nextTick as f,openBlock as p,ref as m,renderList as h,resolveComponent as g,toDisplayString as _,unref as v,watch as y,withCtx as b,withModifiers as x}from"vue";import{NDropdown as S,NTag as C}from"naive-ui";import{useRoute as w,useRouter as T}from"vue-router";function E(e={}){let{persistKey:t=`__tags_view_list__`,homePath:n=`/home`}=e,r=()=>{if(!t)return[];try{let e=localStorage.getItem(t);return e?JSON.parse(e):[]}catch{return[]}},i=e=>{if(t)try{localStorage.setItem(t,JSON.stringify(e))}catch{}},a=m(r()),o=m(``),s=()=>i(a.value),c=e=>{e?a.value=e:a.value=[...new Map(a.value.map(e=>[e.path,e])).values()],s()},l=e=>{o.value=e};return{tagsViewList:a,activeTag:o,homePath:n,initTags:c,setActiveTag:l,addTag:e=>{let t=a.value.findIndex(t=>t.path===e.path);if(t===-1)a.value.push(e);else{let n=a.value[t];(n.title!==e.title||!n.originalTitle)&&(n.title=e.title,n.originalTitle=e.originalTitle||n.originalTitle)}l(e.path),s()},removeTag:e=>{if(e>=0&&e<a.value.length){let t=a.value.splice(e,1)[0]?.path??null;return s(),t}return null},removeOtherTags:e=>{e===0?a.value=[a.value[0]].filter(Boolean):a.value=[a.value[0],a.value[e]].filter(Boolean),s()},removeLeftTags:e=>{a.value=[a.value[0],...a.value.slice(e)],s()},removeRightTags:e=>{a.value=a.value.slice(0,e+1),s()},removeAllTags:()=>{a.value=a.value.filter(e=>e.meta?.affix),s()}}}const D={class:`tags-view-container`};var O=t(u({name:`C_TagsView`,__name:`index`,props:{labelFormatter:{},homePath:{default:`/home`},homeTitle:{default:`首页`},homeIcon:{default:`mdi:home`},persistKey:{default:`__tags_view_list__`},contextMenuLabels:{default:()=>({close:`关闭`,closeOthers:`关闭其他`,closeLeft:`关闭左侧`,closeRight:`关闭右侧`,closeAll:`关闭所有`})},tagsViewOptions:{}},emits:[`close`,`closeAll`],setup(t,{expose:u,emit:g}){let O=t,k=g,A=w(),j=T(),M=E(O.tagsViewOptions??{persistKey:O.persistKey,homePath:O.homePath});if(M.tagsViewList.value.length>0&&O.labelFormatter){let e=j.getRoutes(),t=M.tagsViewList.value.map(t=>{let n=e.find(e=>e.path===t.path),r=t.originalTitle||n?.meta?.title||t.title;return{...t,originalTitle:r,title:O.labelFormatter(r)}});M.initTags(t)}let N=e=>O.labelFormatter?O.labelFormatter(e):e,P=m(!1),F=m(0),I=m(0),L=m(null),R=m(-1),z=m(),B=m(),V=e=>e.path===A.path,H=e=>e.meta?.affix,U=e=>{let t=B.value;t&&(e.preventDefault(),t.scrollTo({left:t.scrollLeft+e.deltaY,behavior:`smooth`}))},W=e=>{f(()=>{let t=B.value?.querySelector(`[data-path="${e}"]`);t&&t.scrollIntoView({behavior:`smooth`,block:`nearest`,inline:`center`})})},G=e=>{e.path!==A.path&&j.push(e.path),W(e.path)},K=(e,t)=>{if(H(e))return;let n=V(e),r=M.tagsViewList.value.length;if(M.removeTag(t),n){let e=M.tagsViewList.value,n=t===r-1,i;i=n?e[t-1]?.path||O.homePath:e[e.length-1]?.path||O.homePath,j.push(i),k(`close`,i)}},q=(e,t,n)=>{e.preventDefault(),L.value=t,R.value=n,P.value=!0,F.value=e.clientX,I.value=e.clientY},J=()=>P.value=!1,Y=r(()=>{let e=O.contextMenuLabels;return[{type:`option`,label:e.close??`关闭`,key:`close`,disabled:H(L.value),icon:()=>d(`span`,{class:`i-mdi:close`})},{type:`option`,label:e.closeOthers??`关闭其他`,key:`closeOthers`,icon:()=>d(`span`,{class:`i-mdi:arrow-left-right-bold`})},{type:`option`,label:e.closeLeft??`关闭左侧`,key:`closeLeft`,icon:()=>d(`span`,{class:`i-mdi:align-horizontal-left`})},{type:`option`,label:e.closeRight??`关闭右侧`,key:`closeRight`,icon:()=>d(`span`,{class:`i-mdi:align-horizontal-right`})},{type:`option`,label:e.closeAll??`关闭所有`,key:`closeAll`,icon:()=>d(`span`,{class:`i-mdi:tally-mark-5`})}]}),X=e=>{if(!(!L.value||R.value===-1)){switch(e){case`close`:K(L.value,R.value);break;case`closeOthers`:M.removeOtherTags(R.value);break;case`closeLeft`:M.removeLeftTags(R.value);break;case`closeRight`:M.removeRightTags(R.value);break;case`closeAll`:M.removeAllTags(),j.push(O.homePath),k(`closeAll`);break}J()}};return y(()=>A.path,e=>{let t=e===O.homePath?O.homeTitle:A.meta.title||`Unnamed Page`;M.addTag({path:e,originalTitle:t,title:N(t),icon:e===O.homePath?O.homeIcon:A.meta.icon,meta:{affix:A.meta.affix}}),M.setActiveTag(e),W(e)},{immediate:!0}),u({tags:M,scrollToTag:W}),(t,r)=>{let u=C,d=S;return p(),o(`div`,D,[s(`div`,{class:`tags-track`,ref_key:`tagsTrack`,ref:z,onWheel:U},[s(`div`,{class:`tags-container`,ref_key:`tagsContainer`,ref:B},[(p(!0),o(n,null,h(v(M).tagsViewList.value,(t,n)=>(p(),i(u,{key:t.path,type:V(t)?`primary`:`default`,closable:!H(t),"data-path":t.path,onClose:x(e=>K(t,n),[`stop`]),onClick:e=>G(t),onContextmenu:x(e=>q(e,t,n),[`prevent`])},{icon:b(()=>[l(v(e),{name:t.icon,size:12},null,8,[`name`])]),default:b(()=>[c(` `+_(t.title),1)]),_:2},1032,[`type`,`closable`,`data-path`,`onClose`,`onClick`,`onContextmenu`]))),128))],512)],544),P.value?(p(),i(d,{key:0,show:P.value,options:Y.value,x:F.value,y:I.value,onClickoutside:J,onSelect:X},null,8,[`show`,`options`,`x`,`y`])):a(`v-if`,!0)])}}}),[[`__scopeId`,`data-v-
|
|
1
|
+
import{t as e}from"./C_Icon2.js";import{t}from"./export-helper.js";import{Fragment as n,computed as r,createBlock as i,createCommentVNode as a,createElementBlock as o,createElementVNode as s,createTextVNode as c,createVNode as l,defineComponent as u,h as d,nextTick as f,openBlock as p,ref as m,renderList as h,resolveComponent as g,toDisplayString as _,unref as v,watch as y,withCtx as b,withModifiers as x}from"vue";import{NDropdown as S,NTag as C}from"naive-ui";import{useRoute as w,useRouter as T}from"vue-router";function E(e={}){let{persistKey:t=`__tags_view_list__`,homePath:n=`/home`}=e,r=()=>{if(!t)return[];try{let e=localStorage.getItem(t);return e?JSON.parse(e):[]}catch{return[]}},i=e=>{if(t)try{localStorage.setItem(t,JSON.stringify(e))}catch{}},a=m(r()),o=m(``),s=()=>i(a.value),c=e=>{e?a.value=e:a.value=[...new Map(a.value.map(e=>[e.path,e])).values()],s()},l=e=>{o.value=e};return{tagsViewList:a,activeTag:o,homePath:n,initTags:c,setActiveTag:l,addTag:e=>{let t=a.value.findIndex(t=>t.path===e.path);if(t===-1)a.value.push(e);else{let n=a.value[t];(n.title!==e.title||!n.originalTitle)&&(n.title=e.title,n.originalTitle=e.originalTitle||n.originalTitle)}l(e.path),s()},removeTag:e=>{if(e>=0&&e<a.value.length){let t=a.value.splice(e,1)[0]?.path??null;return s(),t}return null},removeOtherTags:e=>{e===0?a.value=[a.value[0]].filter(Boolean):a.value=[a.value[0],a.value[e]].filter(Boolean),s()},removeLeftTags:e=>{a.value=[a.value[0],...a.value.slice(e)],s()},removeRightTags:e=>{a.value=a.value.slice(0,e+1),s()},removeAllTags:()=>{a.value=a.value.filter(e=>e.meta?.affix),s()}}}const D={class:`tags-view-container`};var O=t(u({name:`C_TagsView`,__name:`index`,props:{labelFormatter:{},homePath:{default:`/home`},homeTitle:{default:`首页`},homeIcon:{default:`mdi:home`},persistKey:{default:`__tags_view_list__`},contextMenuLabels:{default:()=>({close:`关闭`,closeOthers:`关闭其他`,closeLeft:`关闭左侧`,closeRight:`关闭右侧`,closeAll:`关闭所有`})},tagsViewOptions:{}},emits:[`close`,`closeAll`],setup(t,{expose:u,emit:g}){let O=t,k=g,A=w(),j=T(),M=E(O.tagsViewOptions??{persistKey:O.persistKey,homePath:O.homePath});if(M.tagsViewList.value.length>0&&O.labelFormatter){let e=j.getRoutes(),t=M.tagsViewList.value.map(t=>{let n=e.find(e=>e.path===t.path),r=t.originalTitle||n?.meta?.title||t.title;return{...t,originalTitle:r,title:O.labelFormatter(r)}});M.initTags(t)}let N=e=>O.labelFormatter?O.labelFormatter(e):e,P=m(!1),F=m(0),I=m(0),L=m(null),R=m(-1),z=m(),B=m(),V=e=>e.path===A.path,H=e=>e.meta?.affix,U=e=>{let t=B.value;t&&(e.preventDefault(),t.scrollTo({left:t.scrollLeft+e.deltaY,behavior:`smooth`}))},W=e=>{f(()=>{let t=B.value?.querySelector(`[data-path="${e}"]`);t&&t.scrollIntoView({behavior:`smooth`,block:`nearest`,inline:`center`})})},G=e=>{e.path!==A.path&&j.push(e.path).catch(()=>void 0),W(e.path)},K=(e,t)=>{if(H(e))return;let n=V(e),r=M.tagsViewList.value.length;if(M.removeTag(t),n){let e=M.tagsViewList.value,n=t===r-1,i;i=n?e[t-1]?.path||O.homePath:e[e.length-1]?.path||O.homePath,j.push(i).catch(()=>void 0),k(`close`,i)}},q=(e,t,n)=>{e.preventDefault(),L.value=t,R.value=n,P.value=!0,F.value=e.clientX,I.value=e.clientY},J=()=>P.value=!1,Y=r(()=>{let e=O.contextMenuLabels;return[{type:`option`,label:e.close??`关闭`,key:`close`,disabled:H(L.value),icon:()=>d(`span`,{class:`i-mdi:close`})},{type:`option`,label:e.closeOthers??`关闭其他`,key:`closeOthers`,icon:()=>d(`span`,{class:`i-mdi:arrow-left-right-bold`})},{type:`option`,label:e.closeLeft??`关闭左侧`,key:`closeLeft`,icon:()=>d(`span`,{class:`i-mdi:align-horizontal-left`})},{type:`option`,label:e.closeRight??`关闭右侧`,key:`closeRight`,icon:()=>d(`span`,{class:`i-mdi:align-horizontal-right`})},{type:`option`,label:e.closeAll??`关闭所有`,key:`closeAll`,icon:()=>d(`span`,{class:`i-mdi:tally-mark-5`})}]}),X=e=>{if(!(!L.value||R.value===-1)){switch(e){case`close`:K(L.value,R.value);break;case`closeOthers`:M.removeOtherTags(R.value);break;case`closeLeft`:M.removeLeftTags(R.value);break;case`closeRight`:M.removeRightTags(R.value);break;case`closeAll`:M.removeAllTags(),j.push(O.homePath).catch(()=>void 0),k(`closeAll`);break}J()}};return y(()=>A.path,e=>{let t=e===O.homePath?O.homeTitle:A.meta.title||`Unnamed Page`;M.addTag({path:e,originalTitle:t,title:N(t),icon:e===O.homePath?O.homeIcon:A.meta.icon,meta:{affix:A.meta.affix}}),M.setActiveTag(e),W(e)},{immediate:!0}),u({tags:M,scrollToTag:W}),(t,r)=>{let u=C,d=S;return p(),o(`div`,D,[s(`div`,{class:`tags-track`,ref_key:`tagsTrack`,ref:z,onWheel:U},[s(`div`,{class:`tags-container`,ref_key:`tagsContainer`,ref:B},[(p(!0),o(n,null,h(v(M).tagsViewList.value,(t,n)=>(p(),i(u,{key:t.path,type:V(t)?`primary`:`default`,closable:!H(t),"data-path":t.path,onClose:x(e=>K(t,n),[`stop`]),onClick:e=>G(t),onContextmenu:x(e=>q(e,t,n),[`prevent`])},{icon:b(()=>[l(v(e),{name:t.icon,size:12},null,8,[`name`])]),default:b(()=>[c(` `+_(t.title),1)]),_:2},1032,[`type`,`closable`,`data-path`,`onClose`,`onClick`,`onContextmenu`]))),128))],512)],544),P.value?(p(),i(d,{key:0,show:P.value,options:Y.value,x:F.value,y:I.value,onClickoutside:J,onSelect:X},null,8,[`show`,`options`,`x`,`y`])):a(`v-if`,!0)])}}}),[[`__scopeId`,`data-v-7078e2ed`]]);export{E as n,O as t};
|
package/dist/C_VtableGantt.css
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* unplugin-vue-components disabled *//* 甘特图组件样式 */
|
|
2
|
-
.c-vtable-gantt-wrapper[data-v-
|
|
2
|
+
.c-vtable-gantt-wrapper[data-v-cadc6c9b] {
|
|
3
3
|
display: flex;
|
|
4
4
|
flex-direction: column;
|
|
5
5
|
border: 1px solid var(--c-border, #e1e4e8);
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
|
|
9
9
|
height: 100%;
|
|
10
10
|
}
|
|
11
|
-
.c-vtable-gantt-wrapper .gantt-toolbar[data-v-
|
|
11
|
+
.c-vtable-gantt-wrapper .gantt-toolbar[data-v-cadc6c9b] {
|
|
12
12
|
display: flex;
|
|
13
13
|
justify-content: space-between;
|
|
14
14
|
align-items: center;
|
|
@@ -17,75 +17,75 @@
|
|
|
17
17
|
min-height: 48px;
|
|
18
18
|
flex-shrink: 0;
|
|
19
19
|
}
|
|
20
|
-
.c-vtable-gantt-wrapper .gantt-toolbar .toolbar-left .gantt-title[data-v-
|
|
20
|
+
.c-vtable-gantt-wrapper .gantt-toolbar .toolbar-left .gantt-title[data-v-cadc6c9b] {
|
|
21
21
|
font-size: 16px;
|
|
22
22
|
font-weight: 600;
|
|
23
23
|
color: var(--c-text-1, #333);
|
|
24
24
|
}
|
|
25
|
-
.c-vtable-gantt-wrapper .gantt-toolbar .toolbar-right[data-v-
|
|
25
|
+
.c-vtable-gantt-wrapper .gantt-toolbar .toolbar-right[data-v-cadc6c9b] {
|
|
26
26
|
display: flex;
|
|
27
27
|
gap: 8px;
|
|
28
28
|
align-items: center;
|
|
29
29
|
}
|
|
30
|
-
.c-vtable-gantt-wrapper .gantt-container[data-v-
|
|
30
|
+
.c-vtable-gantt-wrapper .gantt-container[data-v-cadc6c9b] {
|
|
31
31
|
flex: 1;
|
|
32
32
|
position: relative;
|
|
33
33
|
min-height: 400px;
|
|
34
34
|
overflow: hidden;
|
|
35
35
|
/* 确保甘特图组件完全填充容器 */
|
|
36
36
|
}
|
|
37
|
-
.c-vtable-gantt-wrapper .gantt-container[data-v-
|
|
37
|
+
.c-vtable-gantt-wrapper .gantt-container[data-v-cadc6c9b] > * {
|
|
38
38
|
width: 100%;
|
|
39
39
|
height: 100%;
|
|
40
40
|
}
|
|
41
|
-
.c-vtable-gantt-wrapper .gantt-container[data-v-
|
|
41
|
+
.c-vtable-gantt-wrapper .gantt-container[data-v-cadc6c9b] {
|
|
42
42
|
/* 确保甘特图内部组件正确填充 */
|
|
43
43
|
}
|
|
44
|
-
.c-vtable-gantt-wrapper .gantt-container[data-v-
|
|
44
|
+
.c-vtable-gantt-wrapper .gantt-container[data-v-cadc6c9b] .vtable-gantt {
|
|
45
45
|
width: 100% !important;
|
|
46
46
|
height: 100% !important;
|
|
47
47
|
overflow: hidden;
|
|
48
48
|
}
|
|
49
|
-
.c-vtable-gantt-wrapper .gantt-container[data-v-
|
|
49
|
+
.c-vtable-gantt-wrapper .gantt-container[data-v-cadc6c9b] .vtable-gantt * {
|
|
50
50
|
backface-visibility: hidden;
|
|
51
51
|
transform: translateZ(0);
|
|
52
52
|
-webkit-font-smoothing: subpixel-antialiased;
|
|
53
53
|
}
|
|
54
|
-
.c-vtable-gantt-wrapper .gantt-container[data-v-
|
|
54
|
+
.c-vtable-gantt-wrapper .gantt-container[data-v-cadc6c9b] {
|
|
55
55
|
/* 防止内部表格自动调整高度 */
|
|
56
56
|
}
|
|
57
|
-
.c-vtable-gantt-wrapper .gantt-container[data-v-
|
|
57
|
+
.c-vtable-gantt-wrapper .gantt-container[data-v-cadc6c9b] .vtable-gantt-table {
|
|
58
58
|
height: 100% !important;
|
|
59
59
|
box-sizing: border-box;
|
|
60
60
|
}
|
|
61
|
-
.c-vtable-gantt-wrapper .gantt-container[data-v-
|
|
61
|
+
.c-vtable-gantt-wrapper .gantt-container[data-v-cadc6c9b] {
|
|
62
62
|
/* 防止拖动时底部色块闪烁 */
|
|
63
63
|
}
|
|
64
|
-
.c-vtable-gantt-wrapper .gantt-container[data-v-
|
|
64
|
+
.c-vtable-gantt-wrapper .gantt-container[data-v-cadc6c9b] .vtable-gantt-chart {
|
|
65
65
|
position: relative;
|
|
66
66
|
overflow: hidden;
|
|
67
67
|
will-change: transform;
|
|
68
68
|
transform: translateZ(0);
|
|
69
69
|
}
|
|
70
|
-
.c-vtable-gantt-wrapper .gantt-container[data-v-
|
|
70
|
+
.c-vtable-gantt-wrapper .gantt-container[data-v-cadc6c9b] {
|
|
71
71
|
/* 针对拖动元素的优化 */
|
|
72
72
|
}
|
|
73
|
-
.c-vtable-gantt-wrapper .gantt-container[data-v-
|
|
73
|
+
.c-vtable-gantt-wrapper .gantt-container[data-v-cadc6c9b] .vtable-gantt-task {
|
|
74
74
|
backface-visibility: hidden;
|
|
75
75
|
transform: translateZ(0);
|
|
76
76
|
}
|
|
77
|
-
.c-vtable-gantt-wrapper .gantt-container[data-v-
|
|
77
|
+
.c-vtable-gantt-wrapper .gantt-container[data-v-cadc6c9b] .vtable-gantt-task.dragging {
|
|
78
78
|
z-index: 1000;
|
|
79
79
|
pointer-events: none;
|
|
80
80
|
}
|
|
81
|
-
.c-vtable-gantt-wrapper .gantt-container[data-v-
|
|
81
|
+
.c-vtable-gantt-wrapper .gantt-container[data-v-cadc6c9b] {
|
|
82
82
|
/* 防止拖动时底部区域的重绘闪烁 */
|
|
83
83
|
}
|
|
84
|
-
.c-vtable-gantt-wrapper .gantt-container[data-v-
|
|
84
|
+
.c-vtable-gantt-wrapper .gantt-container[data-v-cadc6c9b] .vtable-gantt-chart-container {
|
|
85
85
|
position: relative;
|
|
86
86
|
overflow: hidden;
|
|
87
87
|
}
|
|
88
|
-
.c-vtable-gantt-wrapper .gantt-container[data-v-
|
|
88
|
+
.c-vtable-gantt-wrapper .gantt-container[data-v-cadc6c9b] .vtable-gantt-chart-container::after {
|
|
89
89
|
content: "";
|
|
90
90
|
position: absolute;
|
|
91
91
|
bottom: 0;
|
package/dist/C_VtableGantt2.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
require(`./chunk.cjs`);const e=require(`./C_Icon2.cjs`),t=require(`./export-helper.cjs`);let n=require(`vue`),r=require(`naive-ui`);const i={headerStyle:{borderColor:`rgba(128, 128, 128, 0.2)`,borderLineWidth:1,fontSize:14,fontWeight:`bold`},bodyStyle:{borderColor:`rgba(128, 128, 128, 0.2)`,borderLineWidth:[1,0,1,0],fontSize:13}},a={basic:{overscrollBehavior:`none`,headerRowHeight:40,rowHeight:40,taskListTable:{columns:[{field:`title`,title:`任务名称`,width:220,tree:!0},{field:`start`,title:`开始时间`,width:120},{field:`end`,title:`结束时间`,width:120},{field:`progress`,title:`进度`,width:80}],tableWidth:420,minTableWidth:300,theme:i},frame:{outerFrameStyle:{borderLineWidth:1,borderColor:`#e1e4e8`,cornerRadius:6},verticalSplitLineMoveable:!0,verticalSplitLine:{lineColor:`#e1e4e8`,lineWidth:2}},grid:{verticalLine:{lineWidth:1,lineColor:`rgba(128, 128, 128, 0.2)`},horizontalLine:{lineWidth:1,lineColor:`rgba(128, 128, 128, 0.2)`}},taskBar:{startDateField:`start`,endDateField:`end`,progressField:`progress`,moveable:!0,resizable:!0,labelText:`{title}`,labelTextStyle:{fontSize:12,textAlign:`left`},barStyle:{width:18,barColor:`#1890ff`,completedBarColor:`#52c41a`,cornerRadius:4,borderLineWidth:0},milestoneStyle:{borderColor:`#fa8c16`,borderLineWidth:1,fillColor:`#ffd666`,width:12}},timelineHeader:{colWidth:60,horizontalLine:{lineWidth:1,lineColor:`rgba(128, 128, 128, 0.2)`},verticalLine:{lineWidth:1,lineColor:`rgba(128, 128, 128, 0.2)`},scales:[{unit:`week`,step:1,format:e=>`第${e.dateIndex}周`,style:{fontSize:12,fontWeight:`bold`}},{unit:`day`,step:1,format:e=>`${e.dateIndex}`,style:{fontSize:11}}]},scrollStyle:{scrollRailColor:`rgba(246,246,246,0.5)`,visible:`scrolling`,width:6,scrollSliderCornerRadius:2,scrollSliderColor:`#1890ff`}},project:{overscrollBehavior:`none`,headerRowHeight:40,rowHeight:40,taskListTable:{columns:[{field:`title`,title:`任务名称`,width:200,tree:!0,editor:`input`},{field:`start`,title:`开始时间`,width:120,editor:`date-input`},{field:`end`,title:`结束时间`,width:120,editor:`date-input`},{field:`priority`,title:`优先级`,width:80,editor:`input`},{field:`progress`,title:`进度%`,width:80,editor:`input`}],tableWidth:480,minTableWidth:350,maxTableWidth:800,theme:i,hierarchyExpandLevel:2},frame:{outerFrameStyle:{borderLineWidth:2,borderColor:`#e1e4e8`,cornerRadius:8},verticalSplitLineMoveable:!0,verticalSplitLine:{lineColor:`#e1e4e8`,lineWidth:3}},grid:{verticalLine:{lineWidth:1,lineColor:`rgba(128, 128, 128, 0.2)`},horizontalLine:{lineWidth:1,lineColor:`rgba(128, 128, 128, 0.2)`}},taskBar:{startDateField:`start`,endDateField:`end`,progressField:`progress`,moveable:!0,resizable:!0,hoverBarStyle:{barOverlayColor:`rgba(24, 144, 255, 0.3)`},labelText:`{title} {progress}%`,labelTextStyle:{fontSize:12,textAlign:`left`,textOverflow:`ellipsis`},barStyle:{width:20,barColor:`#1890ff`,completedBarColor:`#52c41a`,cornerRadius:6,borderLineWidth:0}},timelineHeader:{colWidth:60,horizontalLine:{lineWidth:1,lineColor:`rgba(128, 128, 128, 0.2)`},verticalLine:{lineWidth:1,lineColor:`rgba(128, 128, 128, 0.2)`},scales:[{unit:`week`,step:1,startOfWeek:`monday`,format:e=>`第${e.dateIndex}周`,style:{fontSize:13,fontWeight:`bold`,textAlign:`center`}},{unit:`day`,step:1,format:e=>`${e.dateIndex}`,style:{fontSize:11,textAlign:`center`}}]},rowSeriesNumber:{title:`序号`,dragOrder:!0,headerStyle:{borderColor:`rgba(128, 128, 128, 0.2)`},style:{borderColor:`rgba(128, 128, 128, 0.2)`}},scrollStyle:{scrollRailColor:`rgba(246,246,246,0.5)`,visible:`scrolling`,width:6,scrollSliderCornerRadius:2,scrollSliderColor:`#1890ff`}},timeline:{overscrollBehavior:`none`,headerRowHeight:45,rowHeight:40,taskListTable:{columns:[{field:`title`,title:`事件名称`,width:250,tree:!0},{field:`start`,title:`时间`,width:150}],tableWidth:400,minTableWidth:300,theme:{headerStyle:{...i.headerStyle},bodyStyle:i.bodyStyle}},frame:{outerFrameStyle:{borderLineWidth:1,borderColor:`rgba(128, 128, 128, 0.3)`,cornerRadius:4},verticalSplitLineMoveable:!0},grid:{verticalLine:{lineWidth:1,lineColor:`rgba(128, 128, 128, 0.2)`},horizontalLine:{lineWidth:1,lineColor:`rgba(128, 128, 128, 0.2)`}},taskBar:{startDateField:`start`,endDateField:`end`,progressField:`progress`,moveable:!0,resizable:!0,labelText:`{title}`,labelTextStyle:{fontSize:12,textAlign:`left`},barStyle:{width:22,barColor:`#722ed1`,completedBarColor:`#b37feb`,cornerRadius:8,borderLineWidth:0}},timelineHeader:{colWidth:60,scales:[{unit:`month`,step:1,format:e=>`${e.dateIndex}月`,style:{fontSize:13,fontWeight:`bold`}},{unit:`day`,step:1,format:e=>`${e.dateIndex}`,style:{fontSize:11}}]},scrollStyle:{scrollRailColor:`rgba(246,246,246,0.5)`,visible:`scrolling`,width:6,scrollSliderCornerRadius:2,scrollSliderColor:`#1890ff`}},milestone:{overscrollBehavior:`none`,headerRowHeight:40,rowHeight:38,taskListTable:{columns:[{field:`title`,title:`里程碑`,width:200,tree:!0},{field:`start`,title:`目标日期`,width:120},{field:`priority`,title:`重要性`,width:100}],tableWidth:400,minTableWidth:300,theme:{headerStyle:{...i.headerStyle,borderColor:`#ffa940`},bodyStyle:{...i.bodyStyle,borderColor:`#ffa940`}}},frame:{outerFrameStyle:{borderLineWidth:2,borderColor:`#ffa940`,cornerRadius:6},verticalSplitLineMoveable:!0},grid:{verticalLine:{lineWidth:1,lineColor:`rgba(255, 168, 64, 0.3)`},horizontalLine:{lineWidth:1,lineColor:`rgba(255, 168, 64, 0.3)`}},taskBar:{startDateField:`start`,endDateField:`start`,labelText:`{title}`,labelTextStyle:{fontSize:12,fontWeight:`bold`},barStyle:{width:0,barColor:`transparent`},milestoneStyle:{borderColor:`#fa8c16`,borderLineWidth:2,fillColor:`#ffd666`,width:16}},timelineHeader:{colWidth:80,scales:[{unit:`month`,step:1,format:e=>`${e.dateIndex}月`,style:{fontSize:13,fontWeight:`bold`}},{unit:`week`,step:1,format:e=>`第${e.dateIndex}周`,style:{fontSize:11}}]},scrollStyle:{scrollRailColor:`rgba(246,246,246,0.5)`,visible:`scrolling`,width:6,scrollSliderCornerRadius:2,scrollSliderColor:`#1890ff`}},official:{overscrollBehavior:`none`,headerRowHeight:40,rowHeight:40,taskListTable:{columns:[{field:`title`,title:`title`,width:180,sort:!0,tree:!0,editor:`input`},{field:`start`,title:`start`,width:120,sort:!0,editor:`date-input`},{field:`end`,title:`end`,width:120,sort:!0,editor:`date-input`},{field:`priority`,title:`priority`,width:80,sort:!0,editor:`input`},{field:`progress`,title:`progress`,width:80,sort:!0,editor:`input`}],tableWidth:460,minTableWidth:350,maxTableWidth:800,theme:{headerStyle:{...i.headerStyle,fontSize:18,color:`red`},bodyStyle:{...i.bodyStyle,fontSize:16,color:`#4D4D4D`}},hierarchyExpandLevel:2},frame:{outerFrameStyle:{borderLineWidth:2,borderColor:`#e1e4e8`,cornerRadius:8},verticalSplitLineMoveable:!0,verticalSplitLine:{lineColor:`#e1e4e8`,lineWidth:3},horizontalSplitLine:{lineColor:`#e1e4e8`,lineWidth:3}},grid:{verticalLine:{lineWidth:1,lineColor:`rgba(128, 128, 128, 0.2)`},horizontalLine:{lineWidth:1,lineColor:`rgba(128, 128, 128, 0.2)`}},taskBar:{startDateField:`start`,endDateField:`end`,progressField:`progress`,moveable:!0,resizable:!0,hoverBarStyle:{barOverlayColor:`rgba(99, 144, 0, 0.4)`},labelText:`{title} {progress}%`,labelTextStyle:{fontSize:16,textAlign:`left`,textOverflow:`ellipsis`},barStyle:{width:20,barColor:`#ee8800`,completedBarColor:`#91e8e0`,cornerRadius:8,borderLineWidth:1,borderColor:`black`},milestoneStyle:{borderColor:`red`,borderLineWidth:1,fillColor:`green`,width:15}},timelineHeader:{backgroundColor:`#EEF1F5`,colWidth:60,horizontalLine:{lineWidth:1,lineColor:`#e1e4e8`},verticalLine:{lineWidth:1,lineColor:`#e1e4e8`},scales:[{unit:`week`,step:1,startOfWeek:`sunday`,format:e=>`Week ${e.dateIndex}`,style:{fontSize:20,fontWeight:`bold`,color:`white`,strokeColor:`black`,textAlign:`right`,textBaseline:`bottom`,textStick:!0}},{unit:`day`,step:1,format:e=>e.dateIndex.toString(),style:{fontSize:20,fontWeight:`bold`,color:`white`,strokeColor:`black`,textAlign:`right`,textBaseline:`bottom`}}]},markLine:[{date:`2024-07-28`,style:{lineWidth:1,lineColor:`blue`,lineDash:[8,4]}},{date:`2024-08-17`,style:{lineWidth:2,lineColor:`red`,lineDash:[8,4]}}],rowSeriesNumber:{title:`行号`,dragOrder:!0,headerStyle:{borderColor:`rgba(128, 128, 128, 0.2)`},style:{borderColor:`rgba(128, 128, 128, 0.2)`}},scrollStyle:{scrollRailColor:`rgba(246,246,246,0.5)`,visible:`scrolling`,width:6,scrollSliderCornerRadius:2,scrollSliderColor:`#1890ff`}}},o={class:`c-vtable-gantt-wrapper`},s={key:0,class:`gantt-toolbar`},c={class:`toolbar-left`},l={class:`gantt-title`},u={class:`toolbar-right`},d=(0,n.defineComponent)({name:`C_VtableGantt`,__name:`index`,props:{data:{default:()=>[]},options:{default:()=>({})},preset:{default:`basic`},height:{default:`600px`},title:{default:``},showToolbar:{type:Boolean,default:!0},showFullscreenButton:{type:Boolean,default:!0},theme:{default:`light`}},emits:[`ganttCreated`,`taskClick`,`taskChange`],setup(t,{expose:i,emit:d}){let f=t,p=d,m=(0,n.ref)(),h=(0,n.ref)(),g=(0,n.ref)(!1),_=(0,n.computed)(()=>typeof f.height==`number`?`${f.height}px`:f.height),v=(e,t,n=new WeakMap)=>y(e)?y(t)?n.has(t)?n.get(t):x(e,t,n):e:t,y=e=>typeof e==`object`&&!!e,b=e=>e instanceof Date||e instanceof RegExp,x=(e,t,n)=>{let r=Array.isArray(e)?[...e]:{...e};n.set(t,r);for(let i in t){if(!t.hasOwnProperty(i))continue;let a=t[i];r[i]=y(a)&&!Array.isArray(a)&&!b(a)?v(e[i]||{},a,n):a}return r},S=e=>e.map(e=>({...e,title:e.title||`任务${e.id}`,children:e.children?S(e.children):void 0})),C=e=>({underlayBackgroundColor:e?`#1e1e1e`:`#ffffff`,timelineHeaderBg:e?`#2d2d2d`:`#EEF1F5`,gridBg:e?`#1e1e1e`:`#ffffff`,lineColor:e?`rgba(255, 255, 255, 0.1)`:`rgba(128, 128, 128, 0.2)`,textColor:e?`#ffffff`:`#000000`}),w=(e,t)=>({...e,backgroundColor:t.timelineHeaderBg,horizontalLine:{...e?.horizontalLine,lineColor:t.lineColor},verticalLine:{...e?.verticalLine,lineColor:t.lineColor},scales:e?.scales?.map(e=>({...e,style:{...e.style,color:t.textColor}}))}),T=(e,t)=>({...e,backgroundColor:t.gridBg,horizontalLine:{...e?.horizontalLine,lineColor:t.lineColor},verticalLine:{...e?.verticalLine,lineColor:t.lineColor}}),E=(e,t,n,r)=>({...e,records:t,underlayBackgroundColor:r.underlayBackgroundColor,taskListTable:{...e.taskListTable,theme:n},timelineHeader:w(e.timelineHeader,r),grid:T(e.grid,r)}),D=e=>{e.on(`click_cell`,e=>{let{record:t,event:n}=e||{};t&&p(`taskClick`,t,n)}),e.on(`change_data`,e=>{let{record:t,changes:n}=e||{};t&&n&&p(`taskChange`,t,n)})},O=async()=>{if(m.value)try{let{Gantt:e}=await import(`@visactor/vtable-gantt`),{themes:t}=await import(`@visactor/vtable`),n=f.theme===`dark`,r=v(a[f.preset]||a.basic,f.options),i=S(f.data||[]);h.value&&h.value.release();let o=E(r,i,n?t.DARK:t.DEFAULT,C(n));h.value=new e(m.value,o),D(h.value),p(`ganttCreated`,h.value)}catch(e){console.error(`甘特图初始化失败:`,e)}},k=async()=>{if(m.value)try{document.fullscreenElement?(await document.exitFullscreen(),g.value=!1):(await m.value.requestFullscreen(),g.value=!0),setTimeout(()=>h.value?.resize?.(),100)}catch(e){console.warn(`全屏切换失败:`,e),g.value=!g.value,(0,n.nextTick)(()=>h.value?.resize?.())}},A=()=>{g.value=!!document.fullscreenElement,(0,n.nextTick)(()=>h.value?.resize?.())},j=e=>{if(h.value&&e)try{h.value.setRecords(S(e))}catch(e){console.warn(`更新数据失败:`,e)}},M=e=>{if(h.value&&e)try{h.value.updateOption(e)}catch(e){console.warn(`更新配置失败:`,e)}},N=()=>{if(h.value)try{h.value.release()}catch(e){console.warn(`销毁甘特图失败:`,e)}finally{h.value=void 0}};return(0,n.watch)(()=>f.data,e=>{e&&h.value&&j(e)},{deep:!0}),(0,n.watch)(()=>[f.options,f.preset],()=>(0,n.nextTick)(()=>O()),{deep:!0}),(0,n.watch)(()=>f.theme,()=>(0,n.nextTick)(()=>O())),(0,n.onMounted)(()=>{document.addEventListener(`fullscreenchange`,A),(0,n.nextTick)(()=>setTimeout(()=>O(),100))}),(0,n.onUnmounted)(()=>{document.removeEventListener(`fullscreenchange`,A),N()}),i({ganttInstance:h,updateData:j,updateOptions:M,toggleFullscreen:k}),(i,a)=>((0,n.openBlock)(),(0,n.createElementBlock)(`div`,o,[t.showToolbar?((0,n.openBlock)(),(0,n.createElementBlock)(`div`,s,[(0,n.createElementVNode)(`div`,c,[(0,n.createElementVNode)(`span`,l,(0,n.toDisplayString)(t.title||`甘特图`),1)]),(0,n.createElementVNode)(`div`,u,[t.showFullscreenButton?((0,n.openBlock)(),(0,n.createBlock)((0,n.unref)(r.NButton),{key:0,size:`small`,onClick:k},{icon:(0,n.withCtx)(()=>[(0,n.createVNode)(e.t,{name:g.value?`carbon:minimize`:`carbon:maximize`,size:16,color:`currentColor`},null,8,[`name`])]),default:(0,n.withCtx)(()=>[(0,n.createTextVNode)(` `+(0,n.toDisplayString)(g.value?`退出全屏`:`全屏`),1)]),_:1})):(0,n.createCommentVNode)(`v-if`,!0)])])):(0,n.createCommentVNode)(`v-if`,!0),(0,n.createElementVNode)(`div`,{ref_key:`ganttContainerRef`,ref:m,class:`gantt-container`,style:(0,n.normalizeStyle)({height:_.value})},null,4)]))}});var f=t.t(d,[[`__scopeId`,`data-v-1fc4d705`]]);Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return f}});
|
|
1
|
+
require(`./chunk.cjs`);const e=require(`./C_Icon2.cjs`),t=require(`./export-helper.cjs`);let n=require(`vue`),r=require(`naive-ui`);const i={headerStyle:{borderColor:`rgba(128, 128, 128, 0.2)`,borderLineWidth:1,fontSize:14,fontWeight:`bold`},bodyStyle:{borderColor:`rgba(128, 128, 128, 0.2)`,borderLineWidth:[1,0,1,0],fontSize:13}},a={basic:{overscrollBehavior:`none`,headerRowHeight:40,rowHeight:40,taskListTable:{columns:[{field:`title`,title:`任务名称`,width:220,tree:!0},{field:`start`,title:`开始时间`,width:120},{field:`end`,title:`结束时间`,width:120},{field:`progress`,title:`进度`,width:80}],tableWidth:420,minTableWidth:300,theme:i},frame:{outerFrameStyle:{borderLineWidth:1,borderColor:`#e1e4e8`,cornerRadius:6},verticalSplitLineMoveable:!0,verticalSplitLine:{lineColor:`#e1e4e8`,lineWidth:2}},grid:{verticalLine:{lineWidth:1,lineColor:`rgba(128, 128, 128, 0.2)`},horizontalLine:{lineWidth:1,lineColor:`rgba(128, 128, 128, 0.2)`}},taskBar:{startDateField:`start`,endDateField:`end`,progressField:`progress`,moveable:!0,resizable:!0,labelText:`{title}`,labelTextStyle:{fontSize:12,textAlign:`left`},barStyle:{width:18,barColor:`#1890ff`,completedBarColor:`#52c41a`,cornerRadius:4,borderLineWidth:0},milestoneStyle:{borderColor:`#fa8c16`,borderLineWidth:1,fillColor:`#ffd666`,width:12}},timelineHeader:{colWidth:60,horizontalLine:{lineWidth:1,lineColor:`rgba(128, 128, 128, 0.2)`},verticalLine:{lineWidth:1,lineColor:`rgba(128, 128, 128, 0.2)`},scales:[{unit:`week`,step:1,format:e=>`第${e.dateIndex}周`,style:{fontSize:12,fontWeight:`bold`}},{unit:`day`,step:1,format:e=>`${e.dateIndex}`,style:{fontSize:11}}]},scrollStyle:{scrollRailColor:`rgba(246,246,246,0.5)`,visible:`scrolling`,width:6,scrollSliderCornerRadius:2,scrollSliderColor:`#1890ff`}},project:{overscrollBehavior:`none`,headerRowHeight:40,rowHeight:40,taskListTable:{columns:[{field:`title`,title:`任务名称`,width:200,tree:!0,editor:`input`},{field:`start`,title:`开始时间`,width:120,editor:`date-input`},{field:`end`,title:`结束时间`,width:120,editor:`date-input`},{field:`priority`,title:`优先级`,width:80,editor:`input`},{field:`progress`,title:`进度%`,width:80,editor:`input`}],tableWidth:480,minTableWidth:350,maxTableWidth:800,theme:i,hierarchyExpandLevel:2},frame:{outerFrameStyle:{borderLineWidth:2,borderColor:`#e1e4e8`,cornerRadius:8},verticalSplitLineMoveable:!0,verticalSplitLine:{lineColor:`#e1e4e8`,lineWidth:3}},grid:{verticalLine:{lineWidth:1,lineColor:`rgba(128, 128, 128, 0.2)`},horizontalLine:{lineWidth:1,lineColor:`rgba(128, 128, 128, 0.2)`}},taskBar:{startDateField:`start`,endDateField:`end`,progressField:`progress`,moveable:!0,resizable:!0,hoverBarStyle:{barOverlayColor:`rgba(24, 144, 255, 0.3)`},labelText:`{title} {progress}%`,labelTextStyle:{fontSize:12,textAlign:`left`,textOverflow:`ellipsis`},barStyle:{width:20,barColor:`#1890ff`,completedBarColor:`#52c41a`,cornerRadius:6,borderLineWidth:0}},timelineHeader:{colWidth:60,horizontalLine:{lineWidth:1,lineColor:`rgba(128, 128, 128, 0.2)`},verticalLine:{lineWidth:1,lineColor:`rgba(128, 128, 128, 0.2)`},scales:[{unit:`week`,step:1,startOfWeek:`monday`,format:e=>`第${e.dateIndex}周`,style:{fontSize:13,fontWeight:`bold`,textAlign:`center`}},{unit:`day`,step:1,format:e=>`${e.dateIndex}`,style:{fontSize:11,textAlign:`center`}}]},rowSeriesNumber:{title:`序号`,dragOrder:!0,headerStyle:{borderColor:`rgba(128, 128, 128, 0.2)`},style:{borderColor:`rgba(128, 128, 128, 0.2)`}},scrollStyle:{scrollRailColor:`rgba(246,246,246,0.5)`,visible:`scrolling`,width:6,scrollSliderCornerRadius:2,scrollSliderColor:`#1890ff`}},timeline:{overscrollBehavior:`none`,headerRowHeight:45,rowHeight:40,taskListTable:{columns:[{field:`title`,title:`事件名称`,width:250,tree:!0},{field:`start`,title:`时间`,width:150}],tableWidth:400,minTableWidth:300,theme:{headerStyle:{...i.headerStyle},bodyStyle:i.bodyStyle}},frame:{outerFrameStyle:{borderLineWidth:1,borderColor:`rgba(128, 128, 128, 0.3)`,cornerRadius:4},verticalSplitLineMoveable:!0},grid:{verticalLine:{lineWidth:1,lineColor:`rgba(128, 128, 128, 0.2)`},horizontalLine:{lineWidth:1,lineColor:`rgba(128, 128, 128, 0.2)`}},taskBar:{startDateField:`start`,endDateField:`end`,progressField:`progress`,moveable:!0,resizable:!0,labelText:`{title}`,labelTextStyle:{fontSize:12,textAlign:`left`},barStyle:{width:22,barColor:`#722ed1`,completedBarColor:`#b37feb`,cornerRadius:8,borderLineWidth:0}},timelineHeader:{colWidth:60,scales:[{unit:`month`,step:1,format:e=>`${e.dateIndex}月`,style:{fontSize:13,fontWeight:`bold`}},{unit:`day`,step:1,format:e=>`${e.dateIndex}`,style:{fontSize:11}}]},scrollStyle:{scrollRailColor:`rgba(246,246,246,0.5)`,visible:`scrolling`,width:6,scrollSliderCornerRadius:2,scrollSliderColor:`#1890ff`}},milestone:{overscrollBehavior:`none`,headerRowHeight:40,rowHeight:38,taskListTable:{columns:[{field:`title`,title:`里程碑`,width:200,tree:!0},{field:`start`,title:`目标日期`,width:120},{field:`priority`,title:`重要性`,width:100}],tableWidth:400,minTableWidth:300,theme:{headerStyle:{...i.headerStyle,borderColor:`#ffa940`},bodyStyle:{...i.bodyStyle,borderColor:`#ffa940`}}},frame:{outerFrameStyle:{borderLineWidth:2,borderColor:`#ffa940`,cornerRadius:6},verticalSplitLineMoveable:!0},grid:{verticalLine:{lineWidth:1,lineColor:`rgba(255, 168, 64, 0.3)`},horizontalLine:{lineWidth:1,lineColor:`rgba(255, 168, 64, 0.3)`}},taskBar:{startDateField:`start`,endDateField:`start`,labelText:`{title}`,labelTextStyle:{fontSize:12,fontWeight:`bold`},barStyle:{width:0,barColor:`transparent`},milestoneStyle:{borderColor:`#fa8c16`,borderLineWidth:2,fillColor:`#ffd666`,width:16}},timelineHeader:{colWidth:80,scales:[{unit:`month`,step:1,format:e=>`${e.dateIndex}月`,style:{fontSize:13,fontWeight:`bold`}},{unit:`week`,step:1,format:e=>`第${e.dateIndex}周`,style:{fontSize:11}}]},scrollStyle:{scrollRailColor:`rgba(246,246,246,0.5)`,visible:`scrolling`,width:6,scrollSliderCornerRadius:2,scrollSliderColor:`#1890ff`}},official:{overscrollBehavior:`none`,headerRowHeight:40,rowHeight:40,taskListTable:{columns:[{field:`title`,title:`title`,width:180,sort:!0,tree:!0,editor:`input`},{field:`start`,title:`start`,width:120,sort:!0,editor:`date-input`},{field:`end`,title:`end`,width:120,sort:!0,editor:`date-input`},{field:`priority`,title:`priority`,width:80,sort:!0,editor:`input`},{field:`progress`,title:`progress`,width:80,sort:!0,editor:`input`}],tableWidth:460,minTableWidth:350,maxTableWidth:800,theme:{headerStyle:{...i.headerStyle,fontSize:18,color:`red`},bodyStyle:{...i.bodyStyle,fontSize:16,color:`#4D4D4D`}},hierarchyExpandLevel:2},frame:{outerFrameStyle:{borderLineWidth:2,borderColor:`#e1e4e8`,cornerRadius:8},verticalSplitLineMoveable:!0,verticalSplitLine:{lineColor:`#e1e4e8`,lineWidth:3},horizontalSplitLine:{lineColor:`#e1e4e8`,lineWidth:3}},grid:{verticalLine:{lineWidth:1,lineColor:`rgba(128, 128, 128, 0.2)`},horizontalLine:{lineWidth:1,lineColor:`rgba(128, 128, 128, 0.2)`}},taskBar:{startDateField:`start`,endDateField:`end`,progressField:`progress`,moveable:!0,resizable:!0,hoverBarStyle:{barOverlayColor:`rgba(99, 144, 0, 0.4)`},labelText:`{title} {progress}%`,labelTextStyle:{fontSize:16,textAlign:`left`,textOverflow:`ellipsis`},barStyle:{width:20,barColor:`#ee8800`,completedBarColor:`#91e8e0`,cornerRadius:8,borderLineWidth:1,borderColor:`black`},milestoneStyle:{borderColor:`red`,borderLineWidth:1,fillColor:`green`,width:15}},timelineHeader:{backgroundColor:`#EEF1F5`,colWidth:60,horizontalLine:{lineWidth:1,lineColor:`#e1e4e8`},verticalLine:{lineWidth:1,lineColor:`#e1e4e8`},scales:[{unit:`week`,step:1,startOfWeek:`sunday`,format:e=>`Week ${e.dateIndex}`,style:{fontSize:20,fontWeight:`bold`,color:`white`,strokeColor:`black`,textAlign:`right`,textBaseline:`bottom`,textStick:!0}},{unit:`day`,step:1,format:e=>e.dateIndex.toString(),style:{fontSize:20,fontWeight:`bold`,color:`white`,strokeColor:`black`,textAlign:`right`,textBaseline:`bottom`}}]},markLine:[{date:`2024-07-28`,style:{lineWidth:1,lineColor:`blue`,lineDash:[8,4]}},{date:`2024-08-17`,style:{lineWidth:2,lineColor:`red`,lineDash:[8,4]}}],rowSeriesNumber:{title:`行号`,dragOrder:!0,headerStyle:{borderColor:`rgba(128, 128, 128, 0.2)`},style:{borderColor:`rgba(128, 128, 128, 0.2)`}},scrollStyle:{scrollRailColor:`rgba(246,246,246,0.5)`,visible:`scrolling`,width:6,scrollSliderCornerRadius:2,scrollSliderColor:`#1890ff`}}},o={class:`c-vtable-gantt-wrapper`},s={key:0,class:`gantt-toolbar`},c={class:`toolbar-left`},l={class:`gantt-title`},u={class:`toolbar-right`},d=(0,n.defineComponent)({name:`C_VtableGantt`,__name:`index`,props:{data:{default:()=>[]},options:{default:()=>({})},preset:{default:`basic`},height:{default:`600px`},title:{default:``},showToolbar:{type:Boolean,default:!0},showFullscreenButton:{type:Boolean,default:!0},theme:{default:`light`}},emits:[`ganttCreated`,`taskClick`,`taskChange`],setup(t,{expose:i,emit:d}){let f=t,p=d,m=(0,n.ref)(),h=(0,n.ref)(),g=(0,n.ref)(!1),_=0,v,y=!1,b=(0,n.computed)(()=>typeof f.height==`number`?`${f.height}px`:f.height),x=(e,t)=>!y&&e===_&&m.value===t,S=(e,t,n=new WeakMap)=>C(e)?C(t)?n.has(t)?n.get(t):T(e,t,n):e:t,C=e=>typeof e==`object`&&!!e,w=e=>e instanceof Date||e instanceof RegExp,T=(e,t,n)=>{let r=Array.isArray(e)?[...e]:{...e};n.set(t,r);for(let i in t){if(!t.hasOwnProperty(i))continue;let a=t[i];r[i]=C(a)&&!Array.isArray(a)&&!w(a)?S(e[i]||{},a,n):a}return r},E=e=>e.map(e=>({...e,title:e.title||`任务${e.id}`,children:e.children?E(e.children):void 0})),D=e=>({underlayBackgroundColor:e?`#1e1e1e`:`#ffffff`,timelineHeaderBg:e?`#2d2d2d`:`#EEF1F5`,gridBg:e?`#1e1e1e`:`#ffffff`,lineColor:e?`rgba(255, 255, 255, 0.1)`:`rgba(128, 128, 128, 0.2)`,textColor:e?`#ffffff`:`#000000`}),O=(e,t)=>({...e,backgroundColor:t.timelineHeaderBg,horizontalLine:{...e?.horizontalLine,lineColor:t.lineColor},verticalLine:{...e?.verticalLine,lineColor:t.lineColor},scales:e?.scales?.map(e=>({...e,style:{...e.style,color:t.textColor}}))}),k=(e,t)=>({...e,backgroundColor:t.gridBg,horizontalLine:{...e?.horizontalLine,lineColor:t.lineColor},verticalLine:{...e?.verticalLine,lineColor:t.lineColor}}),A=(e,t,n,r)=>({...e,records:t,underlayBackgroundColor:r.underlayBackgroundColor,taskListTable:{...e.taskListTable,theme:n},timelineHeader:O(e.timelineHeader,r),grid:k(e.grid,r)}),j=e=>{e.on(`click_cell`,e=>{let{record:t,event:n}=e||{};t&&p(`taskClick`,t,n)}),e.on(`change_data`,e=>{let{record:t,changes:n}=e||{};t&&n&&p(`taskChange`,t,n)})},M=async()=>{let e=m.value;if(!e||y)return;let t=++_;try{let{Gantt:n}=await import(`@visactor/vtable-gantt`),{themes:r}=await import(`@visactor/vtable`);if(!x(t,e))return;let i=f.theme===`dark`,o=S(a[f.preset]||a.basic,f.options),s=E(f.data||[]);h.value&&h.value.release();let c=new n(e,A(o,s,i?r.DARK:r.DEFAULT,D(i)));if(!x(t,e)){c.release();return}h.value=c,j(c),p(`ganttCreated`,c)}catch(e){console.error(`甘特图初始化失败:`,e)}},N=async()=>{if(m.value)try{document.fullscreenElement?(await document.exitFullscreen(),g.value=!1):(await m.value.requestFullscreen(),g.value=!0),setTimeout(()=>h.value?.resize?.(),100)}catch(e){console.warn(`全屏切换失败:`,e),g.value=!g.value,(0,n.nextTick)(()=>h.value?.resize?.())}},P=()=>{g.value=!!document.fullscreenElement,(0,n.nextTick)(()=>h.value?.resize?.())},F=e=>{if(h.value&&e)try{h.value.setRecords(E(e))}catch(e){console.warn(`更新数据失败:`,e)}},I=e=>{if(h.value&&e)try{h.value.updateOption(e)}catch(e){console.warn(`更新配置失败:`,e)}},L=()=>{if(h.value)try{h.value.release()}catch(e){console.warn(`销毁甘特图失败:`,e)}finally{h.value=void 0}};return(0,n.watch)(()=>f.data,e=>{e&&h.value&&F(e)},{deep:!0}),(0,n.watch)(()=>[f.options,f.preset],()=>(0,n.nextTick)(()=>M()),{deep:!0}),(0,n.watch)(()=>f.theme,()=>(0,n.nextTick)(()=>M())),(0,n.onMounted)(()=>{y=!1,document.addEventListener(`fullscreenchange`,P),(0,n.nextTick)(()=>{y||(v=setTimeout(()=>M(),100))})}),(0,n.onUnmounted)(()=>{y=!0,_+=1,v&&clearTimeout(v),document.removeEventListener(`fullscreenchange`,P),L()}),i({ganttInstance:h,updateData:F,updateOptions:I,toggleFullscreen:N}),(i,a)=>((0,n.openBlock)(),(0,n.createElementBlock)(`div`,o,[t.showToolbar?((0,n.openBlock)(),(0,n.createElementBlock)(`div`,s,[(0,n.createElementVNode)(`div`,c,[(0,n.createElementVNode)(`span`,l,(0,n.toDisplayString)(t.title||`甘特图`),1)]),(0,n.createElementVNode)(`div`,u,[t.showFullscreenButton?((0,n.openBlock)(),(0,n.createBlock)((0,n.unref)(r.NButton),{key:0,size:`small`,onClick:N},{icon:(0,n.withCtx)(()=>[(0,n.createVNode)(e.t,{name:g.value?`carbon:minimize`:`carbon:maximize`,size:16,color:`currentColor`},null,8,[`name`])]),default:(0,n.withCtx)(()=>[(0,n.createTextVNode)(` `+(0,n.toDisplayString)(g.value?`退出全屏`:`全屏`),1)]),_:1})):(0,n.createCommentVNode)(`v-if`,!0)])])):(0,n.createCommentVNode)(`v-if`,!0),(0,n.createElementVNode)(`div`,{ref_key:`ganttContainerRef`,ref:m,class:`gantt-container`,style:(0,n.normalizeStyle)({height:b.value})},null,4)]))}});var f=t.t(d,[[`__scopeId`,`data-v-cadc6c9b`]]);Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return f}});
|
package/dist/C_VtableGantt2.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./C_Icon2.js";import{t}from"./export-helper.js";import{computed as n,createBlock as r,createCommentVNode as i,createElementBlock as a,createElementVNode as o,createTextVNode as s,createVNode as c,defineComponent as l,nextTick as u,normalizeStyle as d,onMounted as f,onUnmounted as p,openBlock as m,ref as h,toDisplayString as g,unref as _,watch as v,withCtx as y}from"vue";import{NButton as b}from"naive-ui";const x={headerStyle:{borderColor:`rgba(128, 128, 128, 0.2)`,borderLineWidth:1,fontSize:14,fontWeight:`bold`},bodyStyle:{borderColor:`rgba(128, 128, 128, 0.2)`,borderLineWidth:[1,0,1,0],fontSize:13}},S={basic:{overscrollBehavior:`none`,headerRowHeight:40,rowHeight:40,taskListTable:{columns:[{field:`title`,title:`任务名称`,width:220,tree:!0},{field:`start`,title:`开始时间`,width:120},{field:`end`,title:`结束时间`,width:120},{field:`progress`,title:`进度`,width:80}],tableWidth:420,minTableWidth:300,theme:x},frame:{outerFrameStyle:{borderLineWidth:1,borderColor:`#e1e4e8`,cornerRadius:6},verticalSplitLineMoveable:!0,verticalSplitLine:{lineColor:`#e1e4e8`,lineWidth:2}},grid:{verticalLine:{lineWidth:1,lineColor:`rgba(128, 128, 128, 0.2)`},horizontalLine:{lineWidth:1,lineColor:`rgba(128, 128, 128, 0.2)`}},taskBar:{startDateField:`start`,endDateField:`end`,progressField:`progress`,moveable:!0,resizable:!0,labelText:`{title}`,labelTextStyle:{fontSize:12,textAlign:`left`},barStyle:{width:18,barColor:`#1890ff`,completedBarColor:`#52c41a`,cornerRadius:4,borderLineWidth:0},milestoneStyle:{borderColor:`#fa8c16`,borderLineWidth:1,fillColor:`#ffd666`,width:12}},timelineHeader:{colWidth:60,horizontalLine:{lineWidth:1,lineColor:`rgba(128, 128, 128, 0.2)`},verticalLine:{lineWidth:1,lineColor:`rgba(128, 128, 128, 0.2)`},scales:[{unit:`week`,step:1,format:e=>`第${e.dateIndex}周`,style:{fontSize:12,fontWeight:`bold`}},{unit:`day`,step:1,format:e=>`${e.dateIndex}`,style:{fontSize:11}}]},scrollStyle:{scrollRailColor:`rgba(246,246,246,0.5)`,visible:`scrolling`,width:6,scrollSliderCornerRadius:2,scrollSliderColor:`#1890ff`}},project:{overscrollBehavior:`none`,headerRowHeight:40,rowHeight:40,taskListTable:{columns:[{field:`title`,title:`任务名称`,width:200,tree:!0,editor:`input`},{field:`start`,title:`开始时间`,width:120,editor:`date-input`},{field:`end`,title:`结束时间`,width:120,editor:`date-input`},{field:`priority`,title:`优先级`,width:80,editor:`input`},{field:`progress`,title:`进度%`,width:80,editor:`input`}],tableWidth:480,minTableWidth:350,maxTableWidth:800,theme:x,hierarchyExpandLevel:2},frame:{outerFrameStyle:{borderLineWidth:2,borderColor:`#e1e4e8`,cornerRadius:8},verticalSplitLineMoveable:!0,verticalSplitLine:{lineColor:`#e1e4e8`,lineWidth:3}},grid:{verticalLine:{lineWidth:1,lineColor:`rgba(128, 128, 128, 0.2)`},horizontalLine:{lineWidth:1,lineColor:`rgba(128, 128, 128, 0.2)`}},taskBar:{startDateField:`start`,endDateField:`end`,progressField:`progress`,moveable:!0,resizable:!0,hoverBarStyle:{barOverlayColor:`rgba(24, 144, 255, 0.3)`},labelText:`{title} {progress}%`,labelTextStyle:{fontSize:12,textAlign:`left`,textOverflow:`ellipsis`},barStyle:{width:20,barColor:`#1890ff`,completedBarColor:`#52c41a`,cornerRadius:6,borderLineWidth:0}},timelineHeader:{colWidth:60,horizontalLine:{lineWidth:1,lineColor:`rgba(128, 128, 128, 0.2)`},verticalLine:{lineWidth:1,lineColor:`rgba(128, 128, 128, 0.2)`},scales:[{unit:`week`,step:1,startOfWeek:`monday`,format:e=>`第${e.dateIndex}周`,style:{fontSize:13,fontWeight:`bold`,textAlign:`center`}},{unit:`day`,step:1,format:e=>`${e.dateIndex}`,style:{fontSize:11,textAlign:`center`}}]},rowSeriesNumber:{title:`序号`,dragOrder:!0,headerStyle:{borderColor:`rgba(128, 128, 128, 0.2)`},style:{borderColor:`rgba(128, 128, 128, 0.2)`}},scrollStyle:{scrollRailColor:`rgba(246,246,246,0.5)`,visible:`scrolling`,width:6,scrollSliderCornerRadius:2,scrollSliderColor:`#1890ff`}},timeline:{overscrollBehavior:`none`,headerRowHeight:45,rowHeight:40,taskListTable:{columns:[{field:`title`,title:`事件名称`,width:250,tree:!0},{field:`start`,title:`时间`,width:150}],tableWidth:400,minTableWidth:300,theme:{headerStyle:{...x.headerStyle},bodyStyle:x.bodyStyle}},frame:{outerFrameStyle:{borderLineWidth:1,borderColor:`rgba(128, 128, 128, 0.3)`,cornerRadius:4},verticalSplitLineMoveable:!0},grid:{verticalLine:{lineWidth:1,lineColor:`rgba(128, 128, 128, 0.2)`},horizontalLine:{lineWidth:1,lineColor:`rgba(128, 128, 128, 0.2)`}},taskBar:{startDateField:`start`,endDateField:`end`,progressField:`progress`,moveable:!0,resizable:!0,labelText:`{title}`,labelTextStyle:{fontSize:12,textAlign:`left`},barStyle:{width:22,barColor:`#722ed1`,completedBarColor:`#b37feb`,cornerRadius:8,borderLineWidth:0}},timelineHeader:{colWidth:60,scales:[{unit:`month`,step:1,format:e=>`${e.dateIndex}月`,style:{fontSize:13,fontWeight:`bold`}},{unit:`day`,step:1,format:e=>`${e.dateIndex}`,style:{fontSize:11}}]},scrollStyle:{scrollRailColor:`rgba(246,246,246,0.5)`,visible:`scrolling`,width:6,scrollSliderCornerRadius:2,scrollSliderColor:`#1890ff`}},milestone:{overscrollBehavior:`none`,headerRowHeight:40,rowHeight:38,taskListTable:{columns:[{field:`title`,title:`里程碑`,width:200,tree:!0},{field:`start`,title:`目标日期`,width:120},{field:`priority`,title:`重要性`,width:100}],tableWidth:400,minTableWidth:300,theme:{headerStyle:{...x.headerStyle,borderColor:`#ffa940`},bodyStyle:{...x.bodyStyle,borderColor:`#ffa940`}}},frame:{outerFrameStyle:{borderLineWidth:2,borderColor:`#ffa940`,cornerRadius:6},verticalSplitLineMoveable:!0},grid:{verticalLine:{lineWidth:1,lineColor:`rgba(255, 168, 64, 0.3)`},horizontalLine:{lineWidth:1,lineColor:`rgba(255, 168, 64, 0.3)`}},taskBar:{startDateField:`start`,endDateField:`start`,labelText:`{title}`,labelTextStyle:{fontSize:12,fontWeight:`bold`},barStyle:{width:0,barColor:`transparent`},milestoneStyle:{borderColor:`#fa8c16`,borderLineWidth:2,fillColor:`#ffd666`,width:16}},timelineHeader:{colWidth:80,scales:[{unit:`month`,step:1,format:e=>`${e.dateIndex}月`,style:{fontSize:13,fontWeight:`bold`}},{unit:`week`,step:1,format:e=>`第${e.dateIndex}周`,style:{fontSize:11}}]},scrollStyle:{scrollRailColor:`rgba(246,246,246,0.5)`,visible:`scrolling`,width:6,scrollSliderCornerRadius:2,scrollSliderColor:`#1890ff`}},official:{overscrollBehavior:`none`,headerRowHeight:40,rowHeight:40,taskListTable:{columns:[{field:`title`,title:`title`,width:180,sort:!0,tree:!0,editor:`input`},{field:`start`,title:`start`,width:120,sort:!0,editor:`date-input`},{field:`end`,title:`end`,width:120,sort:!0,editor:`date-input`},{field:`priority`,title:`priority`,width:80,sort:!0,editor:`input`},{field:`progress`,title:`progress`,width:80,sort:!0,editor:`input`}],tableWidth:460,minTableWidth:350,maxTableWidth:800,theme:{headerStyle:{...x.headerStyle,fontSize:18,color:`red`},bodyStyle:{...x.bodyStyle,fontSize:16,color:`#4D4D4D`}},hierarchyExpandLevel:2},frame:{outerFrameStyle:{borderLineWidth:2,borderColor:`#e1e4e8`,cornerRadius:8},verticalSplitLineMoveable:!0,verticalSplitLine:{lineColor:`#e1e4e8`,lineWidth:3},horizontalSplitLine:{lineColor:`#e1e4e8`,lineWidth:3}},grid:{verticalLine:{lineWidth:1,lineColor:`rgba(128, 128, 128, 0.2)`},horizontalLine:{lineWidth:1,lineColor:`rgba(128, 128, 128, 0.2)`}},taskBar:{startDateField:`start`,endDateField:`end`,progressField:`progress`,moveable:!0,resizable:!0,hoverBarStyle:{barOverlayColor:`rgba(99, 144, 0, 0.4)`},labelText:`{title} {progress}%`,labelTextStyle:{fontSize:16,textAlign:`left`,textOverflow:`ellipsis`},barStyle:{width:20,barColor:`#ee8800`,completedBarColor:`#91e8e0`,cornerRadius:8,borderLineWidth:1,borderColor:`black`},milestoneStyle:{borderColor:`red`,borderLineWidth:1,fillColor:`green`,width:15}},timelineHeader:{backgroundColor:`#EEF1F5`,colWidth:60,horizontalLine:{lineWidth:1,lineColor:`#e1e4e8`},verticalLine:{lineWidth:1,lineColor:`#e1e4e8`},scales:[{unit:`week`,step:1,startOfWeek:`sunday`,format:e=>`Week ${e.dateIndex}`,style:{fontSize:20,fontWeight:`bold`,color:`white`,strokeColor:`black`,textAlign:`right`,textBaseline:`bottom`,textStick:!0}},{unit:`day`,step:1,format:e=>e.dateIndex.toString(),style:{fontSize:20,fontWeight:`bold`,color:`white`,strokeColor:`black`,textAlign:`right`,textBaseline:`bottom`}}]},markLine:[{date:`2024-07-28`,style:{lineWidth:1,lineColor:`blue`,lineDash:[8,4]}},{date:`2024-08-17`,style:{lineWidth:2,lineColor:`red`,lineDash:[8,4]}}],rowSeriesNumber:{title:`行号`,dragOrder:!0,headerStyle:{borderColor:`rgba(128, 128, 128, 0.2)`},style:{borderColor:`rgba(128, 128, 128, 0.2)`}},scrollStyle:{scrollRailColor:`rgba(246,246,246,0.5)`,visible:`scrolling`,width:6,scrollSliderCornerRadius:2,scrollSliderColor:`#1890ff`}}},C={class:`c-vtable-gantt-wrapper`},w={key:0,class:`gantt-toolbar`},T={class:`toolbar-left`},E={class:`gantt-title`},D={class:`toolbar-right`};var O=t(l({name:`C_VtableGantt`,__name:`index`,props:{data:{default:()=>[]},options:{default:()=>({})},preset:{default:`basic`},height:{default:`600px`},title:{default:``},showToolbar:{type:Boolean,default:!0},showFullscreenButton:{type:Boolean,default:!0},theme:{default:`light`}},emits:[`ganttCreated`,`taskClick`,`taskChange`],setup(t,{expose:l,emit:x}){let O=t,k=x,A=h(),j=h(),M=h(!1),N=n(()=>typeof O.height==`number`?`${O.height}px`:O.height),P=(e,t,n=new WeakMap)=>F(e)?F(t)?n.has(t)?n.get(t):L(e,t,n):e:t,F=e=>typeof e==`object`&&!!e,I=e=>e instanceof Date||e instanceof RegExp,L=(e,t,n)=>{let r=Array.isArray(e)?[...e]:{...e};n.set(t,r);for(let i in t){if(!t.hasOwnProperty(i))continue;let a=t[i];r[i]=F(a)&&!Array.isArray(a)&&!I(a)?P(e[i]||{},a,n):a}return r},R=e=>e.map(e=>({...e,title:e.title||`任务${e.id}`,children:e.children?R(e.children):void 0})),z=e=>({underlayBackgroundColor:e?`#1e1e1e`:`#ffffff`,timelineHeaderBg:e?`#2d2d2d`:`#EEF1F5`,gridBg:e?`#1e1e1e`:`#ffffff`,lineColor:e?`rgba(255, 255, 255, 0.1)`:`rgba(128, 128, 128, 0.2)`,textColor:e?`#ffffff`:`#000000`}),B=(e,t)=>({...e,backgroundColor:t.timelineHeaderBg,horizontalLine:{...e?.horizontalLine,lineColor:t.lineColor},verticalLine:{...e?.verticalLine,lineColor:t.lineColor},scales:e?.scales?.map(e=>({...e,style:{...e.style,color:t.textColor}}))}),V=(e,t)=>({...e,backgroundColor:t.gridBg,horizontalLine:{...e?.horizontalLine,lineColor:t.lineColor},verticalLine:{...e?.verticalLine,lineColor:t.lineColor}}),H=(e,t,n,r)=>({...e,records:t,underlayBackgroundColor:r.underlayBackgroundColor,taskListTable:{...e.taskListTable,theme:n},timelineHeader:B(e.timelineHeader,r),grid:V(e.grid,r)}),U=e=>{e.on(`click_cell`,e=>{let{record:t,event:n}=e||{};t&&k(`taskClick`,t,n)}),e.on(`change_data`,e=>{let{record:t,changes:n}=e||{};t&&n&&k(`taskChange`,t,n)})},W=async()=>{if(A.value)try{let{Gantt:e}=await import(`@visactor/vtable-gantt`),{themes:t}=await import(`@visactor/vtable`),n=O.theme===`dark`,r=P(S[O.preset]||S.basic,O.options),i=R(O.data||[]);j.value&&j.value.release();let a=H(r,i,n?t.DARK:t.DEFAULT,z(n));j.value=new e(A.value,a),U(j.value),k(`ganttCreated`,j.value)}catch(e){console.error(`甘特图初始化失败:`,e)}},G=async()=>{if(A.value)try{document.fullscreenElement?(await document.exitFullscreen(),M.value=!1):(await A.value.requestFullscreen(),M.value=!0),setTimeout(()=>j.value?.resize?.(),100)}catch(e){console.warn(`全屏切换失败:`,e),M.value=!M.value,u(()=>j.value?.resize?.())}},K=()=>{M.value=!!document.fullscreenElement,u(()=>j.value?.resize?.())},q=e=>{if(j.value&&e)try{j.value.setRecords(R(e))}catch(e){console.warn(`更新数据失败:`,e)}},J=e=>{if(j.value&&e)try{j.value.updateOption(e)}catch(e){console.warn(`更新配置失败:`,e)}},Y=()=>{if(j.value)try{j.value.release()}catch(e){console.warn(`销毁甘特图失败:`,e)}finally{j.value=void 0}};return v(()=>O.data,e=>{e&&j.value&&q(e)},{deep:!0}),v(()=>[O.options,O.preset],()=>u(()=>W()),{deep:!0}),v(()=>O.theme,()=>u(()=>W())),f(()=>{document.addEventListener(`fullscreenchange`,K),u(()=>setTimeout(()=>W(),100))}),p(()=>{document.removeEventListener(`fullscreenchange`,K),Y()}),l({ganttInstance:j,updateData:q,updateOptions:J,toggleFullscreen:G}),(n,l)=>(m(),a(`div`,C,[t.showToolbar?(m(),a(`div`,w,[o(`div`,T,[o(`span`,E,g(t.title||`甘特图`),1)]),o(`div`,D,[t.showFullscreenButton?(m(),r(_(b),{key:0,size:`small`,onClick:G},{icon:y(()=>[c(e,{name:M.value?`carbon:minimize`:`carbon:maximize`,size:16,color:`currentColor`},null,8,[`name`])]),default:y(()=>[s(` `+g(M.value?`退出全屏`:`全屏`),1)]),_:1})):i(`v-if`,!0)])])):i(`v-if`,!0),o(`div`,{ref_key:`ganttContainerRef`,ref:A,class:`gantt-container`,style:d({height:N.value})},null,4)]))}}),[[`__scopeId`,`data-v-1fc4d705`]]);export{S as n,O as t};
|
|
1
|
+
import{t as e}from"./C_Icon2.js";import{t}from"./export-helper.js";import{computed as n,createBlock as r,createCommentVNode as i,createElementBlock as a,createElementVNode as o,createTextVNode as s,createVNode as c,defineComponent as l,nextTick as u,normalizeStyle as d,onMounted as f,onUnmounted as p,openBlock as m,ref as h,toDisplayString as g,unref as _,watch as v,withCtx as y}from"vue";import{NButton as b}from"naive-ui";const x={headerStyle:{borderColor:`rgba(128, 128, 128, 0.2)`,borderLineWidth:1,fontSize:14,fontWeight:`bold`},bodyStyle:{borderColor:`rgba(128, 128, 128, 0.2)`,borderLineWidth:[1,0,1,0],fontSize:13}},S={basic:{overscrollBehavior:`none`,headerRowHeight:40,rowHeight:40,taskListTable:{columns:[{field:`title`,title:`任务名称`,width:220,tree:!0},{field:`start`,title:`开始时间`,width:120},{field:`end`,title:`结束时间`,width:120},{field:`progress`,title:`进度`,width:80}],tableWidth:420,minTableWidth:300,theme:x},frame:{outerFrameStyle:{borderLineWidth:1,borderColor:`#e1e4e8`,cornerRadius:6},verticalSplitLineMoveable:!0,verticalSplitLine:{lineColor:`#e1e4e8`,lineWidth:2}},grid:{verticalLine:{lineWidth:1,lineColor:`rgba(128, 128, 128, 0.2)`},horizontalLine:{lineWidth:1,lineColor:`rgba(128, 128, 128, 0.2)`}},taskBar:{startDateField:`start`,endDateField:`end`,progressField:`progress`,moveable:!0,resizable:!0,labelText:`{title}`,labelTextStyle:{fontSize:12,textAlign:`left`},barStyle:{width:18,barColor:`#1890ff`,completedBarColor:`#52c41a`,cornerRadius:4,borderLineWidth:0},milestoneStyle:{borderColor:`#fa8c16`,borderLineWidth:1,fillColor:`#ffd666`,width:12}},timelineHeader:{colWidth:60,horizontalLine:{lineWidth:1,lineColor:`rgba(128, 128, 128, 0.2)`},verticalLine:{lineWidth:1,lineColor:`rgba(128, 128, 128, 0.2)`},scales:[{unit:`week`,step:1,format:e=>`第${e.dateIndex}周`,style:{fontSize:12,fontWeight:`bold`}},{unit:`day`,step:1,format:e=>`${e.dateIndex}`,style:{fontSize:11}}]},scrollStyle:{scrollRailColor:`rgba(246,246,246,0.5)`,visible:`scrolling`,width:6,scrollSliderCornerRadius:2,scrollSliderColor:`#1890ff`}},project:{overscrollBehavior:`none`,headerRowHeight:40,rowHeight:40,taskListTable:{columns:[{field:`title`,title:`任务名称`,width:200,tree:!0,editor:`input`},{field:`start`,title:`开始时间`,width:120,editor:`date-input`},{field:`end`,title:`结束时间`,width:120,editor:`date-input`},{field:`priority`,title:`优先级`,width:80,editor:`input`},{field:`progress`,title:`进度%`,width:80,editor:`input`}],tableWidth:480,minTableWidth:350,maxTableWidth:800,theme:x,hierarchyExpandLevel:2},frame:{outerFrameStyle:{borderLineWidth:2,borderColor:`#e1e4e8`,cornerRadius:8},verticalSplitLineMoveable:!0,verticalSplitLine:{lineColor:`#e1e4e8`,lineWidth:3}},grid:{verticalLine:{lineWidth:1,lineColor:`rgba(128, 128, 128, 0.2)`},horizontalLine:{lineWidth:1,lineColor:`rgba(128, 128, 128, 0.2)`}},taskBar:{startDateField:`start`,endDateField:`end`,progressField:`progress`,moveable:!0,resizable:!0,hoverBarStyle:{barOverlayColor:`rgba(24, 144, 255, 0.3)`},labelText:`{title} {progress}%`,labelTextStyle:{fontSize:12,textAlign:`left`,textOverflow:`ellipsis`},barStyle:{width:20,barColor:`#1890ff`,completedBarColor:`#52c41a`,cornerRadius:6,borderLineWidth:0}},timelineHeader:{colWidth:60,horizontalLine:{lineWidth:1,lineColor:`rgba(128, 128, 128, 0.2)`},verticalLine:{lineWidth:1,lineColor:`rgba(128, 128, 128, 0.2)`},scales:[{unit:`week`,step:1,startOfWeek:`monday`,format:e=>`第${e.dateIndex}周`,style:{fontSize:13,fontWeight:`bold`,textAlign:`center`}},{unit:`day`,step:1,format:e=>`${e.dateIndex}`,style:{fontSize:11,textAlign:`center`}}]},rowSeriesNumber:{title:`序号`,dragOrder:!0,headerStyle:{borderColor:`rgba(128, 128, 128, 0.2)`},style:{borderColor:`rgba(128, 128, 128, 0.2)`}},scrollStyle:{scrollRailColor:`rgba(246,246,246,0.5)`,visible:`scrolling`,width:6,scrollSliderCornerRadius:2,scrollSliderColor:`#1890ff`}},timeline:{overscrollBehavior:`none`,headerRowHeight:45,rowHeight:40,taskListTable:{columns:[{field:`title`,title:`事件名称`,width:250,tree:!0},{field:`start`,title:`时间`,width:150}],tableWidth:400,minTableWidth:300,theme:{headerStyle:{...x.headerStyle},bodyStyle:x.bodyStyle}},frame:{outerFrameStyle:{borderLineWidth:1,borderColor:`rgba(128, 128, 128, 0.3)`,cornerRadius:4},verticalSplitLineMoveable:!0},grid:{verticalLine:{lineWidth:1,lineColor:`rgba(128, 128, 128, 0.2)`},horizontalLine:{lineWidth:1,lineColor:`rgba(128, 128, 128, 0.2)`}},taskBar:{startDateField:`start`,endDateField:`end`,progressField:`progress`,moveable:!0,resizable:!0,labelText:`{title}`,labelTextStyle:{fontSize:12,textAlign:`left`},barStyle:{width:22,barColor:`#722ed1`,completedBarColor:`#b37feb`,cornerRadius:8,borderLineWidth:0}},timelineHeader:{colWidth:60,scales:[{unit:`month`,step:1,format:e=>`${e.dateIndex}月`,style:{fontSize:13,fontWeight:`bold`}},{unit:`day`,step:1,format:e=>`${e.dateIndex}`,style:{fontSize:11}}]},scrollStyle:{scrollRailColor:`rgba(246,246,246,0.5)`,visible:`scrolling`,width:6,scrollSliderCornerRadius:2,scrollSliderColor:`#1890ff`}},milestone:{overscrollBehavior:`none`,headerRowHeight:40,rowHeight:38,taskListTable:{columns:[{field:`title`,title:`里程碑`,width:200,tree:!0},{field:`start`,title:`目标日期`,width:120},{field:`priority`,title:`重要性`,width:100}],tableWidth:400,minTableWidth:300,theme:{headerStyle:{...x.headerStyle,borderColor:`#ffa940`},bodyStyle:{...x.bodyStyle,borderColor:`#ffa940`}}},frame:{outerFrameStyle:{borderLineWidth:2,borderColor:`#ffa940`,cornerRadius:6},verticalSplitLineMoveable:!0},grid:{verticalLine:{lineWidth:1,lineColor:`rgba(255, 168, 64, 0.3)`},horizontalLine:{lineWidth:1,lineColor:`rgba(255, 168, 64, 0.3)`}},taskBar:{startDateField:`start`,endDateField:`start`,labelText:`{title}`,labelTextStyle:{fontSize:12,fontWeight:`bold`},barStyle:{width:0,barColor:`transparent`},milestoneStyle:{borderColor:`#fa8c16`,borderLineWidth:2,fillColor:`#ffd666`,width:16}},timelineHeader:{colWidth:80,scales:[{unit:`month`,step:1,format:e=>`${e.dateIndex}月`,style:{fontSize:13,fontWeight:`bold`}},{unit:`week`,step:1,format:e=>`第${e.dateIndex}周`,style:{fontSize:11}}]},scrollStyle:{scrollRailColor:`rgba(246,246,246,0.5)`,visible:`scrolling`,width:6,scrollSliderCornerRadius:2,scrollSliderColor:`#1890ff`}},official:{overscrollBehavior:`none`,headerRowHeight:40,rowHeight:40,taskListTable:{columns:[{field:`title`,title:`title`,width:180,sort:!0,tree:!0,editor:`input`},{field:`start`,title:`start`,width:120,sort:!0,editor:`date-input`},{field:`end`,title:`end`,width:120,sort:!0,editor:`date-input`},{field:`priority`,title:`priority`,width:80,sort:!0,editor:`input`},{field:`progress`,title:`progress`,width:80,sort:!0,editor:`input`}],tableWidth:460,minTableWidth:350,maxTableWidth:800,theme:{headerStyle:{...x.headerStyle,fontSize:18,color:`red`},bodyStyle:{...x.bodyStyle,fontSize:16,color:`#4D4D4D`}},hierarchyExpandLevel:2},frame:{outerFrameStyle:{borderLineWidth:2,borderColor:`#e1e4e8`,cornerRadius:8},verticalSplitLineMoveable:!0,verticalSplitLine:{lineColor:`#e1e4e8`,lineWidth:3},horizontalSplitLine:{lineColor:`#e1e4e8`,lineWidth:3}},grid:{verticalLine:{lineWidth:1,lineColor:`rgba(128, 128, 128, 0.2)`},horizontalLine:{lineWidth:1,lineColor:`rgba(128, 128, 128, 0.2)`}},taskBar:{startDateField:`start`,endDateField:`end`,progressField:`progress`,moveable:!0,resizable:!0,hoverBarStyle:{barOverlayColor:`rgba(99, 144, 0, 0.4)`},labelText:`{title} {progress}%`,labelTextStyle:{fontSize:16,textAlign:`left`,textOverflow:`ellipsis`},barStyle:{width:20,barColor:`#ee8800`,completedBarColor:`#91e8e0`,cornerRadius:8,borderLineWidth:1,borderColor:`black`},milestoneStyle:{borderColor:`red`,borderLineWidth:1,fillColor:`green`,width:15}},timelineHeader:{backgroundColor:`#EEF1F5`,colWidth:60,horizontalLine:{lineWidth:1,lineColor:`#e1e4e8`},verticalLine:{lineWidth:1,lineColor:`#e1e4e8`},scales:[{unit:`week`,step:1,startOfWeek:`sunday`,format:e=>`Week ${e.dateIndex}`,style:{fontSize:20,fontWeight:`bold`,color:`white`,strokeColor:`black`,textAlign:`right`,textBaseline:`bottom`,textStick:!0}},{unit:`day`,step:1,format:e=>e.dateIndex.toString(),style:{fontSize:20,fontWeight:`bold`,color:`white`,strokeColor:`black`,textAlign:`right`,textBaseline:`bottom`}}]},markLine:[{date:`2024-07-28`,style:{lineWidth:1,lineColor:`blue`,lineDash:[8,4]}},{date:`2024-08-17`,style:{lineWidth:2,lineColor:`red`,lineDash:[8,4]}}],rowSeriesNumber:{title:`行号`,dragOrder:!0,headerStyle:{borderColor:`rgba(128, 128, 128, 0.2)`},style:{borderColor:`rgba(128, 128, 128, 0.2)`}},scrollStyle:{scrollRailColor:`rgba(246,246,246,0.5)`,visible:`scrolling`,width:6,scrollSliderCornerRadius:2,scrollSliderColor:`#1890ff`}}},C={class:`c-vtable-gantt-wrapper`},w={key:0,class:`gantt-toolbar`},T={class:`toolbar-left`},E={class:`gantt-title`},D={class:`toolbar-right`};var O=t(l({name:`C_VtableGantt`,__name:`index`,props:{data:{default:()=>[]},options:{default:()=>({})},preset:{default:`basic`},height:{default:`600px`},title:{default:``},showToolbar:{type:Boolean,default:!0},showFullscreenButton:{type:Boolean,default:!0},theme:{default:`light`}},emits:[`ganttCreated`,`taskClick`,`taskChange`],setup(t,{expose:l,emit:x}){let O=t,k=x,A=h(),j=h(),M=h(!1),N=0,P,F=!1,I=n(()=>typeof O.height==`number`?`${O.height}px`:O.height),L=(e,t)=>!F&&e===N&&A.value===t,R=(e,t,n=new WeakMap)=>z(e)?z(t)?n.has(t)?n.get(t):V(e,t,n):e:t,z=e=>typeof e==`object`&&!!e,B=e=>e instanceof Date||e instanceof RegExp,V=(e,t,n)=>{let r=Array.isArray(e)?[...e]:{...e};n.set(t,r);for(let i in t){if(!t.hasOwnProperty(i))continue;let a=t[i];r[i]=z(a)&&!Array.isArray(a)&&!B(a)?R(e[i]||{},a,n):a}return r},H=e=>e.map(e=>({...e,title:e.title||`任务${e.id}`,children:e.children?H(e.children):void 0})),U=e=>({underlayBackgroundColor:e?`#1e1e1e`:`#ffffff`,timelineHeaderBg:e?`#2d2d2d`:`#EEF1F5`,gridBg:e?`#1e1e1e`:`#ffffff`,lineColor:e?`rgba(255, 255, 255, 0.1)`:`rgba(128, 128, 128, 0.2)`,textColor:e?`#ffffff`:`#000000`}),W=(e,t)=>({...e,backgroundColor:t.timelineHeaderBg,horizontalLine:{...e?.horizontalLine,lineColor:t.lineColor},verticalLine:{...e?.verticalLine,lineColor:t.lineColor},scales:e?.scales?.map(e=>({...e,style:{...e.style,color:t.textColor}}))}),G=(e,t)=>({...e,backgroundColor:t.gridBg,horizontalLine:{...e?.horizontalLine,lineColor:t.lineColor},verticalLine:{...e?.verticalLine,lineColor:t.lineColor}}),K=(e,t,n,r)=>({...e,records:t,underlayBackgroundColor:r.underlayBackgroundColor,taskListTable:{...e.taskListTable,theme:n},timelineHeader:W(e.timelineHeader,r),grid:G(e.grid,r)}),q=e=>{e.on(`click_cell`,e=>{let{record:t,event:n}=e||{};t&&k(`taskClick`,t,n)}),e.on(`change_data`,e=>{let{record:t,changes:n}=e||{};t&&n&&k(`taskChange`,t,n)})},J=async()=>{let e=A.value;if(!e||F)return;let t=++N;try{let{Gantt:n}=await import(`@visactor/vtable-gantt`),{themes:r}=await import(`@visactor/vtable`);if(!L(t,e))return;let i=O.theme===`dark`,a=R(S[O.preset]||S.basic,O.options),o=H(O.data||[]);j.value&&j.value.release();let s=new n(e,K(a,o,i?r.DARK:r.DEFAULT,U(i)));if(!L(t,e)){s.release();return}j.value=s,q(s),k(`ganttCreated`,s)}catch(e){console.error(`甘特图初始化失败:`,e)}},Y=async()=>{if(A.value)try{document.fullscreenElement?(await document.exitFullscreen(),M.value=!1):(await A.value.requestFullscreen(),M.value=!0),setTimeout(()=>j.value?.resize?.(),100)}catch(e){console.warn(`全屏切换失败:`,e),M.value=!M.value,u(()=>j.value?.resize?.())}},X=()=>{M.value=!!document.fullscreenElement,u(()=>j.value?.resize?.())},Z=e=>{if(j.value&&e)try{j.value.setRecords(H(e))}catch(e){console.warn(`更新数据失败:`,e)}},Q=e=>{if(j.value&&e)try{j.value.updateOption(e)}catch(e){console.warn(`更新配置失败:`,e)}},$=()=>{if(j.value)try{j.value.release()}catch(e){console.warn(`销毁甘特图失败:`,e)}finally{j.value=void 0}};return v(()=>O.data,e=>{e&&j.value&&Z(e)},{deep:!0}),v(()=>[O.options,O.preset],()=>u(()=>J()),{deep:!0}),v(()=>O.theme,()=>u(()=>J())),f(()=>{F=!1,document.addEventListener(`fullscreenchange`,X),u(()=>{F||(P=setTimeout(()=>J(),100))})}),p(()=>{F=!0,N+=1,P&&clearTimeout(P),document.removeEventListener(`fullscreenchange`,X),$()}),l({ganttInstance:j,updateData:Z,updateOptions:Q,toggleFullscreen:Y}),(n,l)=>(m(),a(`div`,C,[t.showToolbar?(m(),a(`div`,w,[o(`div`,T,[o(`span`,E,g(t.title||`甘特图`),1)]),o(`div`,D,[t.showFullscreenButton?(m(),r(_(b),{key:0,size:`small`,onClick:Y},{icon:y(()=>[c(e,{name:M.value?`carbon:minimize`:`carbon:maximize`,size:16,color:`currentColor`},null,8,[`name`])]),default:y(()=>[s(` `+g(M.value?`退出全屏`:`全屏`),1)]),_:1})):i(`v-if`,!0)])])):i(`v-if`,!0),o(`div`,{ref_key:`ganttContainerRef`,ref:A,class:`gantt-container`,style:d({height:I.value})},null,4)]))}}),[[`__scopeId`,`data-v-cadc6c9b`]]);export{S as n,O as t};
|
package/dist/constants.d.cts
CHANGED
|
@@ -110,12 +110,12 @@ declare const __VLS_export: vue.DefineComponent<CronProps, {
|
|
|
110
110
|
reset: typeof handleReset;
|
|
111
111
|
validate: () => CronValidation;
|
|
112
112
|
}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {
|
|
113
|
-
"update:modelValue": (value: string) => any;
|
|
114
113
|
change: (value: string) => any;
|
|
114
|
+
"update:modelValue": (value: string) => any;
|
|
115
115
|
"validation-change": (result: CronValidation) => any;
|
|
116
116
|
}, string, vue.PublicProps, Readonly<CronProps> & Readonly<{
|
|
117
|
-
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
118
117
|
onChange?: ((value: string) => any) | undefined;
|
|
118
|
+
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
119
119
|
"onValidation-change"?: ((result: CronValidation) => any) | undefined;
|
|
120
120
|
}>, {
|
|
121
121
|
height: string | number;
|
package/dist/constants.d.ts
CHANGED
|
@@ -110,12 +110,12 @@ declare const __VLS_export: vue.DefineComponent<CronProps, {
|
|
|
110
110
|
reset: typeof handleReset;
|
|
111
111
|
validate: () => CronValidation;
|
|
112
112
|
}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {
|
|
113
|
-
"update:modelValue": (value: string) => any;
|
|
114
113
|
change: (value: string) => any;
|
|
114
|
+
"update:modelValue": (value: string) => any;
|
|
115
115
|
"validation-change": (result: CronValidation) => any;
|
|
116
116
|
}, string, vue.PublicProps, Readonly<CronProps> & Readonly<{
|
|
117
|
-
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
118
117
|
onChange?: ((value: string) => any) | undefined;
|
|
118
|
+
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
119
119
|
"onValidation-change"?: ((result: CronValidation) => any) | undefined;
|
|
120
120
|
}>, {
|
|
121
121
|
height: string | number;
|
package/dist/constants2.d.cts
CHANGED
|
@@ -112,12 +112,12 @@ interface FormulaEditorExpose {
|
|
|
112
112
|
//#endregion
|
|
113
113
|
//#region src/components/C_FormulaEditor/index.vue.d.ts
|
|
114
114
|
declare const __VLS_export: vue.DefineComponent<FormulaEditorProps, FormulaEditorExpose, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {
|
|
115
|
-
"update:modelValue": (value: string) => any;
|
|
116
115
|
change: (value: string) => any;
|
|
116
|
+
"update:modelValue": (value: string) => any;
|
|
117
117
|
"validation-change": (result: FormulaValidation) => any;
|
|
118
118
|
}, string, vue.PublicProps, Readonly<FormulaEditorProps> & Readonly<{
|
|
119
|
-
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
120
119
|
onChange?: ((value: string) => any) | undefined;
|
|
120
|
+
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
121
121
|
"onValidation-change"?: ((result: FormulaValidation) => any) | undefined;
|
|
122
122
|
}>, {
|
|
123
123
|
height: string | number;
|
package/dist/constants2.d.ts
CHANGED
|
@@ -112,12 +112,12 @@ interface FormulaEditorExpose {
|
|
|
112
112
|
//#endregion
|
|
113
113
|
//#region src/components/C_FormulaEditor/index.vue.d.ts
|
|
114
114
|
declare const __VLS_export: vue.DefineComponent<FormulaEditorProps, FormulaEditorExpose, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {
|
|
115
|
-
"update:modelValue": (value: string) => any;
|
|
116
115
|
change: (value: string) => any;
|
|
116
|
+
"update:modelValue": (value: string) => any;
|
|
117
117
|
"validation-change": (result: FormulaValidation) => any;
|
|
118
118
|
}, string, vue.PublicProps, Readonly<FormulaEditorProps> & Readonly<{
|
|
119
|
-
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
120
119
|
onChange?: ((value: string) => any) | undefined;
|
|
120
|
+
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
121
121
|
"onValidation-change"?: ((result: FormulaValidation) => any) | undefined;
|
|
122
122
|
}>, {
|
|
123
123
|
height: string | number;
|
package/dist/constants3.d.cts
CHANGED
|
@@ -172,11 +172,11 @@ declare const __VLS_export: vue.DefineComponent<NotificationCenterProps, Notific
|
|
|
172
172
|
onNewMessage?: ((message: NotificationMessage) => any) | undefined;
|
|
173
173
|
onNavigate?: ((url: string) => any) | undefined;
|
|
174
174
|
}>, {
|
|
175
|
+
pageSize: number;
|
|
176
|
+
storageKey: string;
|
|
175
177
|
desktopNotification: boolean;
|
|
176
178
|
maxBadgeCount: number;
|
|
177
179
|
pollingInterval: number;
|
|
178
|
-
pageSize: number;
|
|
179
|
-
storageKey: string;
|
|
180
180
|
}, {}, {}, {}, string, vue.ComponentProvideOptions, false, {}, any>;
|
|
181
181
|
declare const _default: typeof __VLS_export;
|
|
182
182
|
//#endregion
|
package/dist/constants3.d.ts
CHANGED
|
@@ -172,11 +172,11 @@ declare const __VLS_export: vue.DefineComponent<NotificationCenterProps, Notific
|
|
|
172
172
|
onNewMessage?: ((message: NotificationMessage) => any) | undefined;
|
|
173
173
|
onNavigate?: ((url: string) => any) | undefined;
|
|
174
174
|
}>, {
|
|
175
|
+
pageSize: number;
|
|
176
|
+
storageKey: string;
|
|
175
177
|
desktopNotification: boolean;
|
|
176
178
|
maxBadgeCount: number;
|
|
177
179
|
pollingInterval: number;
|
|
178
|
-
pageSize: number;
|
|
179
|
-
storageKey: string;
|
|
180
180
|
}, {}, {}, {}, string, vue.ComponentProvideOptions, false, {}, any>;
|
|
181
181
|
declare const _default: typeof __VLS_export;
|
|
182
182
|
//#endregion
|
package/dist/constants4.d.cts
CHANGED
|
@@ -198,26 +198,26 @@ type __VLS_Slots = {} & {
|
|
|
198
198
|
declare const __VLS_base: vue.DefineComponent<UploadProps, UploadExpose, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {
|
|
199
199
|
error: (file: UploadFileItem, error: Error) => any;
|
|
200
200
|
change: (fileList: UploadFileItem[]) => any;
|
|
201
|
-
progress: (file: UploadFileItem, percent: number) => any;
|
|
202
201
|
success: (file: UploadFileItem, response: unknown) => any;
|
|
202
|
+
progress: (file: UploadFileItem, percent: number) => any;
|
|
203
203
|
remove: (file: UploadFileItem) => any;
|
|
204
204
|
finish: (fileList: UploadFileItem[]) => any;
|
|
205
205
|
exceed: (files: File[], fileList: UploadFileItem[]) => any;
|
|
206
206
|
}, string, vue.PublicProps, Readonly<UploadProps> & Readonly<{
|
|
207
207
|
onError?: ((file: UploadFileItem, error: Error) => any) | undefined;
|
|
208
208
|
onChange?: ((fileList: UploadFileItem[]) => any) | undefined;
|
|
209
|
-
onProgress?: ((file: UploadFileItem, percent: number) => any) | undefined;
|
|
210
209
|
onSuccess?: ((file: UploadFileItem, response: unknown) => any) | undefined;
|
|
210
|
+
onProgress?: ((file: UploadFileItem, percent: number) => any) | undefined;
|
|
211
211
|
onRemove?: ((file: UploadFileItem) => any) | undefined;
|
|
212
212
|
onFinish?: ((fileList: UploadFileItem[]) => any) | undefined;
|
|
213
213
|
onExceed?: ((files: File[], fileList: UploadFileItem[]) => any) | undefined;
|
|
214
214
|
}>, {
|
|
215
|
-
data: Record<string, unknown>;
|
|
216
215
|
disabled: boolean;
|
|
216
|
+
data: Record<string, unknown>;
|
|
217
217
|
multiple: boolean;
|
|
218
|
-
maxSize: number;
|
|
219
218
|
draggable: boolean;
|
|
220
219
|
action: string;
|
|
220
|
+
maxSize: number;
|
|
221
221
|
headers: Record<string, string>;
|
|
222
222
|
directory: boolean;
|
|
223
223
|
accept: string;
|