af-mobile-client-vue3 1.6.40 → 1.6.41

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": "af-mobile-client-vue3",
3
3
  "type": "module",
4
- "version": "1.6.40",
4
+ "version": "1.6.41",
5
5
  "packageManager": "pnpm@10.13.1",
6
6
  "description": "Vue + Vite component lib",
7
7
  "engines": {
@@ -4,11 +4,9 @@ import type { NativePickedFile } from '@af-mobile-client-vue3/utils/nativeFilePi
4
4
  import { deleteFile, upload } from '@af-mobile-client-vue3/services/api/common'
5
5
  import { detectEnvironment } from '@af-mobile-client-vue3/utils/environment'
6
6
  import { buildInputAccept, getFileTypeMeta, getUploadFormType, isImageFileName } from '@af-mobile-client-vue3/utils/fileType'
7
- import { mobileUtil } from '@af-mobile-client-vue3/utils/mobileUtil'
7
+ import { mobileUtil } from '@af-mobile-client-vue3/utils/mobileUtil'
8
8
  import {
9
-
10
9
  openNativeFilePicker,
11
- shouldUseDocumentPickerPanel,
12
10
  triggerBrowserFileInput,
13
11
  } from '@af-mobile-client-vue3/utils/nativeFilePicker'
14
12
  import { toDataUrl } from '@af-mobile-client-vue3/utils/resourceUrl'
@@ -51,8 +49,6 @@ const imageList = ref<Array<any>>(props.imageList ?? [])
51
49
  const parentData: any = inject('provideParent')
52
50
  const imageInputRef = ref<HTMLInputElement | undefined>()
53
51
  const documentInputRef = ref<HTMLInputElement | undefined>()
54
- const documentPanelInputRef = ref<HTMLInputElement | undefined>()
55
- const showDocumentPickerPopup = ref(false)
56
52
 
57
53
  const documentAccept = computed(() => buildInputAccept(props.attr?.accept))
58
54
 
@@ -64,12 +60,6 @@ function openDocumentFilePicker() {
64
60
  triggerBrowserFileInput(documentInputRef.value)
65
61
  }
66
62
 
67
- function onDocumentPanelInputChange(e: Event) {
68
- const input = e.target as HTMLInputElement
69
- handleBrowserDocumentFiles(input.files)
70
- showDocumentPickerPopup.value = false
71
- }
72
-
73
63
  function emitUpdatesAfterChange() {
74
64
  // 新增:对外抛出完整与ID列表
75
65
  (emit as any)('updateAllFileList', imageList.value.filter(item => item.status === 'done').map(item => item))
@@ -283,12 +273,7 @@ function triggerDocumentPicker() {
283
273
  if (startedNative)
284
274
  return
285
275
 
286
- // App WebView 内 hidden input 的 programmatic click 无效,改用用户直接点击的弹层
287
- if (shouldUseDocumentPickerPanel()) {
288
- showDocumentPickerPopup.value = true
289
- return
290
- }
291
-
276
+ // 与「相册中选择」一致:ActionSheet 点击后立即调起系统文件选择器
292
277
  openDocumentFilePicker()
293
278
  }
294
279
 
@@ -644,7 +629,7 @@ defineExpose({
644
629
  type="file"
645
630
  multiple
646
631
  accept="image/*"
647
- style="display:none"
632
+ class="hidden-file-input"
648
633
  @change="(e:any) => handleBrowserImageFiles(e.target.files)"
649
634
  >
650
635
  <!-- 通用文件选择(PDF / Word 等) -->
@@ -653,7 +638,7 @@ defineExpose({
653
638
  type="file"
654
639
  multiple
655
640
  :accept="documentAccept"
656
- style="display:none"
641
+ class="hidden-file-input"
657
642
  @change="(e:any) => handleBrowserDocumentFiles(e.target.files)"
658
643
  >
659
644
  <van-uploader
@@ -696,35 +681,6 @@ defineExpose({
696
681
  cancel-text="取消"
697
682
  @select="handleActionSelect"
698
683
  />
699
-
700
- <!-- App 内文件选择:用户直接点击 label 触发系统文件管理器 -->
701
- <van-popup
702
- v-model:show="showDocumentPickerPopup"
703
- position="bottom"
704
- round
705
- teleport="body"
706
- safe-area-inset-bottom
707
- >
708
- <div class="document-picker-panel">
709
- <div class="document-picker-title">
710
- 选择文件
711
- </div>
712
- <p class="document-picker-tip">
713
- 支持 PDF、Word、Excel 等格式
714
- </p>
715
- <label class="document-picker-btn">
716
- 点击选择文件
717
- <input
718
- ref="documentPanelInputRef"
719
- type="file"
720
- multiple
721
- :accept="documentAccept"
722
- class="document-picker-input"
723
- @change="onDocumentPanelInputChange"
724
- >
725
- </label>
726
- </div>
727
- </van-popup>
728
684
  </div>
729
685
  </template>
730
686
 
@@ -738,6 +694,19 @@ defineExpose({
738
694
  // 该属性会影响表单布局
739
695
  // gap: 16px;
740
696
  }
697
+
698
+ /* WebView 内 display:none 会导致 file input 无法被程序化触发,改用视觉隐藏 */
699
+ .hidden-file-input {
700
+ position: fixed;
701
+ top: 0;
702
+ left: 0;
703
+ width: 1px;
704
+ height: 1px;
705
+ opacity: 0;
706
+ overflow: hidden;
707
+ pointer-events: none;
708
+ z-index: -1;
709
+ }
741
710
  /* 让自定义上传按钮可点击:关闭 Vant 覆盖在上方的透明 input 的事件捕获 */
742
711
  :deep(.custom-trigger-uploader .van-uploader__input) {
743
712
  pointer-events: none;
@@ -809,44 +778,4 @@ defineExpose({
809
778
  overflow: hidden;
810
779
  }
811
780
  }
812
-
813
- .document-picker-panel {
814
- padding: 20px 16px 28px;
815
- text-align: center;
816
- }
817
-
818
- .document-picker-title {
819
- font-size: 16px;
820
- font-weight: 600;
821
- color: #323233;
822
- margin-bottom: 8px;
823
- }
824
-
825
- .document-picker-tip {
826
- font-size: 13px;
827
- color: #969799;
828
- margin: 0 0 20px;
829
- }
830
-
831
- .document-picker-btn {
832
- display: block;
833
- position: relative;
834
- width: 100%;
835
- padding: 12px 0;
836
- font-size: 15px;
837
- color: #fff;
838
- background: #1989fa;
839
- border-radius: 8px;
840
- cursor: pointer;
841
- overflow: hidden;
842
- }
843
-
844
- .document-picker-input {
845
- position: absolute;
846
- inset: 0;
847
- width: 100%;
848
- height: 100%;
849
- opacity: 0;
850
- cursor: pointer;
851
- }
852
781
  </style>
@@ -1,4 +1,4 @@
1
- import { getNativeBridgeWindow, hasFlutterBridge, isNativeApp } from './environment'
1
+ import { getNativeBridgeWindow, hasFlutterBridge } from './environment'
2
2
  import { mobileUtil } from './mobileUtil'
3
3
 
4
4
  /** 原生文件选择桥接名(按优先级) */
@@ -82,11 +82,6 @@ export function triggerBrowserFileInput(input: HTMLInputElement | undefined | nu
82
82
  return true
83
83
  }
84
84
 
85
- /** 是否应使用「点击选择文件」弹层(App WebView 内 hidden input 程序化 click 常无效) */
86
- export function shouldUseDocumentPickerPanel(): boolean {
87
- return isNativeApp() && !hasNativeFilePicker()
88
- }
89
-
90
85
  /** 调试:列出当前 window 上已注入的桥接名 */
91
86
  export function listNativeBridges(): string[] {
92
87
  const win = getNativeBridgeWindow()