zkqh-lagrange-utils 0.0.59 → 0.0.60

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "zkqh-lagrange-utils",
3
3
  "private": false,
4
- "version": "0.0.59",
4
+ "version": "0.0.60",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "dev": "vite",
@@ -4,12 +4,14 @@
4
4
  :key="treeSelectKey"
5
5
  :value="treeSelectValue"
6
6
  size="small"
7
- placeholder="请选择本地目录"
7
+ :placeholder="initLoading ? '目录加载中…' : '请选择本地目录'"
8
8
  :consistent-menu-width="false"
9
9
  show-path
10
10
  separator="/"
11
11
  filterable
12
12
  clearable
13
+ :loading="initLoading"
14
+ :disabled="initLoading"
13
15
  :options="treeOptions"
14
16
  :expanded-keys="expandedKeys"
15
17
  :menu-props="{ class: 'plugin_dir_select_tree' }"
@@ -17,7 +19,13 @@
17
19
  :on-load="onLoadTreeNode"
18
20
  @update:expanded-keys="onExpandedKeysUpdate"
19
21
  @update:value="onDirChange" />
20
- <template v-if="diskUsageText">
22
+ <span
23
+ v-if="initLoading"
24
+ class="_pds_loading lc_fs_s">
25
+ <n-spin :size="14" />
26
+ 加载目录中…
27
+ </span>
28
+ <template v-else-if="diskUsageText">
21
29
  <span class="_pds_folder_icon">
22
30
  <i class="lc lc-tuxing1"></i>
23
31
  </span>
@@ -71,6 +79,7 @@ export default defineComponent({
71
79
  const expandedKeys = ref([])
72
80
  const treeSelectKey = ref(0)
73
81
  const defaultDisk = ref({})
82
+ const initLoading = ref(true)
74
83
 
75
84
  const treeSelectValue = computed(() => toTreeKey(modelValue.value))
76
85
 
@@ -265,15 +274,20 @@ export default defineComponent({
265
274
  * 并行拉默认目录与磁盘列表;有默认目录则先反填,再展开树
266
275
  */
267
276
  const initDirectory = async () => {
268
- const [info] = await Promise.all([fetchDefault(), loadDisks()])
269
- if (!info) {
270
- setDirname("")
271
- applyDisk(null)
272
- return
277
+ initLoading.value = true
278
+ try {
279
+ const [info] = await Promise.all([fetchDefault(), loadDisks()])
280
+ if (!info) {
281
+ setDirname("")
282
+ applyDisk(null)
283
+ return
284
+ }
285
+ setDirname(info.root)
286
+ applyDisk(info.disk)
287
+ await hydrateTreePath(info.root)
288
+ } finally {
289
+ initLoading.value = false
273
290
  }
274
- setDirname(info.root)
275
- applyDisk(info.disk)
276
- await hydrateTreePath(info.root)
277
291
  }
278
292
 
279
293
  /**
@@ -325,6 +339,7 @@ export default defineComponent({
325
339
  expandedKeys,
326
340
  treeSelectKey,
327
341
  treeSelectValue,
342
+ initLoading,
328
343
  diskUsageText,
329
344
  usagePercent,
330
345
  renderTreeLabel,
@@ -10,6 +10,14 @@
10
10
  flex-shrink: 0;
11
11
  }
12
12
 
13
+ ._pds_loading {
14
+ display: inline-flex;
15
+ align-items: center;
16
+ gap: 6px;
17
+ color: var(--lc_text_color_secondary);
18
+ flex-shrink: 0;
19
+ }
20
+
13
21
  ._pds_folder_icon {
14
22
  display: inline-flex;
15
23
  align-items: center;