giime 0.6.35 → 0.6.37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.css +138 -138
- package/es/components/src/base/datePicker/DatePicker.vue.d.ts +3 -3
- package/es/components/src/base/datePicker/datePicker.d.ts +1 -1
- package/es/components/src/base/datePicker/index.d.ts +7 -7
- package/es/components/src/business/uploadPro/UploadPro.vue.mjs +1 -1
- package/es/components/src/business/uploadPro/UploadPro.vue2.mjs +38 -6
- package/es/components/src/business/uploadPro/UploadPro.vue2.mjs.map +1 -1
- package/es/components/src/business/uploadPro/uploadPro.mjs +1 -1
- package/es/components/src/business/uploadPro/uploadPro.mjs.map +1 -1
- package/es/components/src/composite/previewFile/PreviewFile.vue2.mjs +3 -2
- package/es/components/src/composite/previewFile/PreviewFile.vue2.mjs.map +1 -1
- package/es/components/src/composite/searchForm/searchFormItems/cascader/SearchFormCascader.vue2.mjs +1 -1
- package/es/components/src/composite/searchForm/searchFormItems/cascader/SearchFormCascader.vue2.mjs.map +1 -1
- package/es/components/src/composite/searchForm/searchFormItems/datePicker/SearchFormDatePicker.vue.d.ts +2 -5
- package/es/components/src/composite/searchForm/searchFormItems/datePicker/SearchFormDatePicker.vue2.mjs +6 -2
- package/es/components/src/composite/searchForm/searchFormItems/datePicker/SearchFormDatePicker.vue2.mjs.map +1 -1
- package/es/components/src/composite/searchForm/searchFormItems/datePicker/index.d.ts +2 -5
- package/es/components/src/composite/searchForm/searchFormItems/datePicker/searchFormDatePicker.d.ts +1 -2
- package/es/components/src/composite/searchForm/searchFormItems/datePicker/searchFormDatePicker.mjs +2 -2
- package/es/components/src/composite/searchForm/searchFormItems/datePicker/searchFormDatePicker.mjs.map +1 -1
- package/es/giime/index.mjs +2 -1
- package/es/giime/index.mjs.map +1 -1
- package/es/giime/version.d.ts +1 -1
- package/es/giime/version.mjs +1 -1
- package/es/giime/version.mjs.map +1 -1
- package/es/hooks/base/useDownload/index.mjs +27 -12
- package/es/hooks/base/useDownload/index.mjs.map +1 -1
- package/es/hooks/base/useUploadFile/index.d.ts +8 -1
- package/es/hooks/base/useUploadFile/index.mjs +36 -5
- package/es/hooks/base/useUploadFile/index.mjs.map +1 -1
- package/es/index.css +138 -138
- package/es/utils/index.mjs +2 -1
- package/es/utils/index.mjs.map +1 -1
- package/es/utils/src/date/dateShortcuts.d.ts +2 -2
- package/es/utils/src/date/dateShortcuts.mjs +87 -82
- package/es/utils/src/date/dateShortcuts.mjs.map +1 -1
- package/es/utils/src/file.d.ts +1 -6
- package/es/utils/src/file.mjs +2 -9
- package/es/utils/src/file.mjs.map +1 -1
- package/es/utils/src/http/interceptors.d.ts +1 -1
- package/es/utils/src/http/interceptors.mjs +4 -1
- package/es/utils/src/http/interceptors.mjs.map +1 -1
- package/lib/components/src/base/datePicker/DatePicker.vue.d.ts +3 -3
- package/lib/components/src/base/datePicker/datePicker.d.ts +1 -1
- package/lib/components/src/base/datePicker/index.d.ts +7 -7
- package/lib/components/src/business/uploadPro/UploadPro.vue.js +1 -1
- package/lib/components/src/business/uploadPro/UploadPro.vue2.js +38 -6
- package/lib/components/src/business/uploadPro/UploadPro.vue2.js.map +1 -1
- package/lib/components/src/business/uploadPro/uploadPro.js +1 -1
- package/lib/components/src/business/uploadPro/uploadPro.js.map +1 -1
- package/lib/components/src/composite/previewFile/PreviewFile.vue2.js +6 -5
- package/lib/components/src/composite/previewFile/PreviewFile.vue2.js.map +1 -1
- package/lib/components/src/composite/searchForm/searchFormItems/cascader/SearchFormCascader.vue2.js +1 -1
- package/lib/components/src/composite/searchForm/searchFormItems/cascader/SearchFormCascader.vue2.js.map +1 -1
- package/lib/components/src/composite/searchForm/searchFormItems/datePicker/SearchFormDatePicker.vue.d.ts +2 -5
- package/lib/components/src/composite/searchForm/searchFormItems/datePicker/SearchFormDatePicker.vue2.js +6 -2
- package/lib/components/src/composite/searchForm/searchFormItems/datePicker/SearchFormDatePicker.vue2.js.map +1 -1
- package/lib/components/src/composite/searchForm/searchFormItems/datePicker/index.d.ts +2 -5
- package/lib/components/src/composite/searchForm/searchFormItems/datePicker/searchFormDatePicker.d.ts +1 -2
- package/lib/components/src/composite/searchForm/searchFormItems/datePicker/searchFormDatePicker.js +2 -2
- package/lib/components/src/composite/searchForm/searchFormItems/datePicker/searchFormDatePicker.js.map +1 -1
- package/lib/giime/index.js +5 -1
- package/lib/giime/index.js.map +1 -1
- package/lib/giime/version.d.ts +1 -1
- package/lib/giime/version.js +1 -1
- package/lib/giime/version.js.map +1 -1
- package/lib/hooks/base/useDownload/index.js +27 -12
- package/lib/hooks/base/useDownload/index.js.map +1 -1
- package/lib/hooks/base/useUploadFile/index.d.ts +8 -1
- package/lib/hooks/base/useUploadFile/index.js +36 -5
- package/lib/hooks/base/useUploadFile/index.js.map +1 -1
- package/lib/index.css +138 -138
- package/lib/utils/index.js +5 -1
- package/lib/utils/index.js.map +1 -1
- package/lib/utils/src/date/dateShortcuts.d.ts +2 -2
- package/lib/utils/src/date/dateShortcuts.js +87 -82
- package/lib/utils/src/date/dateShortcuts.js.map +1 -1
- package/lib/utils/src/file.d.ts +1 -6
- package/lib/utils/src/file.js +5 -9
- package/lib/utils/src/file.js.map +1 -1
- package/lib/utils/src/http/interceptors.d.ts +1 -1
- package/lib/utils/src/http/interceptors.js +4 -1
- package/lib/utils/src/http/interceptors.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UploadPro.vue2.mjs","sources":["../../../../../../../packages/components/src/business/uploadPro/UploadPro.vue"],"sourcesContent":["<template>\n <div>\n <div\n v-loading=\"uploadLoading\"\n ref=\"pasteFileRef\"\n :class=\"{ 'gm-upload-pro-file-picture-card': listType === 'picture-card', 'gm-upload-pro-file-disabled': disabled }\"\n class=\"gm-upload-pro-file\"\n >\n <el-checkbox-group v-model=\"checkoutFiles\">\n <el-upload\n ref=\"uploadFileRef\"\n v-bind=\"props\"\n v-model:file-list=\"fileList\"\n :before-remove=\"beforeRemove\"\n action=\"\"\n :http-request=\"httpRequest\"\n :on-success=\"coverFileSuccess\"\n :on-error=\"coverFileError\"\n >\n <slot v-if=\"!disabled\">\n <template v-if=\"listType === 'picture-card'\">\n <div\n class=\"gm-flex gm-flex-col gm-items-center gm-justify-center gm-rounded-md gm-border gm-border-dashed gm-p-1\"\n style=\"flex-direction: column\"\n :style=\"{ width: width + 'px', height: height + 'px' }\"\n >\n <el-icon :size=\"30\" color=\"#999\">\n <UploadFilled />\n </el-icon>\n <div class=\"el-upload__text gm-text-center !gm-text-xs gm-text-gray-500\">\n 将文件拖到此处,复制粘贴,或 <em class=\"gm-text-blue-700\">点击上传</em>\n </div>\n </div>\n </template>\n <template v-else>\n <el-button type=\"primary\" size=\"default\">点击上传</el-button>\n </template>\n </slot>\n <template v-if=\"showFileList && listType === 'picture-card'\" #file=\"{ file }\">\n <el-checkbox v-if=\"checkbox\" :value=\"file\" />\n <slot name=\"file\" :file=\"file\">\n <div class=\"gm-flex gm-items-center gm-justify-center gm-rounded-md\" :style=\"{ width: width + 'px', height: height + 'px' }\">\n <GmFileComponent :file=\"file\" :size=\"width - 40\" :controls=\"false\" :show-icon=\"true\" />\n </div>\n <div class=\"el-upload-list__item-actions\">\n <span class=\"el-upload-list__item-preview\" @click=\"handlePreview(file)\">\n <el-icon><View /></el-icon>\n </span>\n <span v-if=\"showDelete\" class=\"el-upload-list__item-delete\" @click=\"handleRemove(file, fileList)\">\n <el-icon><Delete /></el-icon>\n </span>\n </div>\n </slot>\n </template>\n <template v-else #file=\"slotValue\">\n <slot name=\"file\" v-bind=\"slotValue\" />\n </template>\n <template v-if=\"slots.trigger\" #trigger>\n <slot name=\"trigger\" />\n </template>\n <template v-if=\"slots.tip\" #tip>\n <div class=\"gm-text-sm\">\n <slot name=\"tip\" />\n </div>\n </template>\n </el-upload>\n </el-checkbox-group>\n\n <GmPreviewFile v-model:dialogVisible=\"dialogVisible\" v-model:file-index=\"fileIndex\" :file-list=\"fileList\" />\n </div>\n </div>\n</template>\n\n<script setup lang=\"ts\">\nimport { ElMessageBox } from 'element-plus';\nimport { computed, ref, useSlots } from 'vue';\nimport { fileValidType } from '@giime/utils/src/file';\n// import { pasteFile } from '@giime/utils/src/pasteFile';\nimport { usePasteFile } from '@giime/hooks/base/usePasteFile';\nimport { GmConfirmBox } from '@giime/components/src/plugins/confirmBox';\nimport { Delete, UploadFilled, View } from '@element-plus/icons-vue';\nimport GmFileComponent from '../../composite/fileComponent';\nimport GmPreviewFile from '../../composite/previewFile';\nimport { uploadFileProps } from './uploadPro';\nimport type { UploadFile, UploadFiles, UploadInstance, UploadProps, UploadRawFile } from 'element-plus';\nimport { getGmExports } from '@giime/utils/src/elementPlus/exports';\nimport { useUploadFile } from '@giime/hooks/base/useUploadFile';\n\ndefineOptions({\n name: 'GmUploadPro',\n});\nconst slots = useSlots();\n\nconst props = defineProps(uploadFileProps);\nconst emit = defineEmits([\"handleRemove\"]);\n\n/** 上传文件 */\nconst fileList = defineModel<UploadFile[]>('fileList', { required: true });\n/** 多选数据 */\nconst checkoutFiles = defineModel<any[]>('checkoutFiles', { default: () => [] });\n\n/**上传功能 */\nconst { uploadFile } = useUploadFile();\n\nconst loadingUids = ref<Set<number>>(new Set());\nconst uploadLoading = computed(() => props.showLoading && loadingUids.value.size > 0);\n\n/* 上传 */\nconst httpRequest: UploadProps['httpRequest'] = async options => {\n loadingUids.value.add(options.file.uid);\n return uploadFile(options.file, { domainCode: props.domainCode, sceneCode: props.sceneCode, accept: props.accept, acl: props.acl });\n};\n// 上传成功\nconst coverFileSuccess: UploadProps['onSuccess'] = (response: any, uploadFile, uploadFiles) => {\n loadingUids.value.delete(uploadFile.uid);\n props.onSuccess?.(response, uploadFile, uploadFiles);\n};\n// 上传失败\nconst coverFileError: UploadProps['onError'] = (error, uploadFile, uploadFiles) => {\n loadingUids.value.delete(uploadFile.uid);\n props.onError?.(error, uploadFile, uploadFiles);\n};\n\n/* 删除文件前 */\nconst beforeRemove: UploadProps['beforeRemove'] = (file, files) => {\n if (props.disabled) {\n return false;\n }\n return props.beforeRemove?.(file, files) ?? true;\n};\n\n/* 删除文件 */\nconst removeFile = (file: UploadFile, uploadFiles: UploadFiles) => {\n const index = fileList.value.indexOf(file);\n if (index > -1) {\n fileList.value.splice(index, 1);\n emit('handleRemove', { file, index });\n return props.onRemove?.(file, uploadFiles);\n }\n};\n/**点击删除图标 */\nconst handleRemove = async (file: UploadFile, uploadFiles: UploadFiles) => {\n if (props.deleteTip) {\n await GmConfirmBox({ message: '确定删除该文件吗?' }, async () => {});\n }\n\n removeFile(file, uploadFiles);\n};\n\nconst uploadFileRef = ref<UploadInstance>();\nconst exposeEvents = ['abort', 'submit', 'clearFiles', 'handleStart', 'handleRemove'] as const;\nconst { exposeFns } = getGmExports(uploadFileRef, exposeEvents);\n\nconst pasteFileRef = ref<HTMLElement>();\n\n/** 预览 */\nconst dialogVisible = ref(false);\nconst fileIndex = ref(0);\n/**点击预览 */\nconst handlePreview = (file: UploadFile) => {\n fileIndex.value = fileList.value.indexOf(file);\n dialogVisible.value = true;\n};\n\n//** 复制粘贴 */\nconst { onSuccess, onError } = usePasteFile(pasteFileRef, { accept: props.accept, disabled: props.disabled });\nonSuccess((files: File[]) => {\n if (props.disabled) {\n return;\n }\n if (Array.isArray(files) && files.length > 0) {\n files.forEach(file => {\n if (file instanceof File) {\n const rawFile = file as UploadRawFile;\n uploadFileRef.value?.handleStart(rawFile);\n\n // 粘贴成功自动上传\n if (props.autoUpload) {\n uploadFileRef.value?.submit();\n }\n }\n });\n }\n});\n/**粘贴失败 */\nonError((error: Error) => {\n console.error('粘贴错误:', error);\n ElMessageBox.alert(error.message, '提示', {\n type: 'error',\n });\n});\ndefineExpose({\n ...exposeFns,\n uploadFileRef,\n});\n</script>\n\n<style scoped lang=\"scss\">\n.gm-upload-pro-preview-dialog {\n :deep(.el-dialog__body) {\n padding: 0;\n }\n}\n.gm-upload-pro-file-picture-card {\n :deep(.el-upload-list__item),\n :deep(.el-upload--picture-card) {\n width: auto;\n height: auto;\n }\n}\n</style>\n<style lang=\"scss\">\n.gm-upload-pro-file {\n line-height: normal;\n .el-checkbox-group {\n font-size: unset;\n }\n .el-checkbox {\n position: absolute;\n left: 10px;\n top: 0;\n z-index: 9;\n }\n .el-upload-list--picture-card {\n gap: 10px;\n }\n .el-upload-list__item {\n margin: 0;\n }\n .el-upload-list__item-file-name {\n line-height: 1.7;\n }\n .el-upload-dragger {\n padding: 0;\n border: none;\n width: 100%;\n height: 100%;\n display: flex;\n }\n .el-upload--picture-card {\n border: none;\n }\n}\n.gm-upload-pro-file-disabled {\n .el-upload--picture-card {\n display: none;\n }\n .el-upload-list__item-status-label {\n display: none;\n }\n}\n</style>\n"],"names":["_useModel","uploadFile"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2FA,IAAA,MAAM,QAAQ,QAAS,EAAA,CAAA;AAEvB,IAAA,MAAM,KAAQ,GAAA,OAAA,CAAA;AACd,IAAA,MAAM,IAAO,GAAA,MAAA,CAAA;AAGb,IAAM,MAAA,QAAA,GAAWA,QAA0B,CAAA,OAAA,EAAA,UAA8B,CAAA,CAAA;AAEzE,IAAM,MAAA,aAAA,GAAgBA,kBAAmB,eAAsC,CAAA,CAAA;AAG/E,IAAM,MAAA,EAAE,UAAW,EAAA,GAAI,aAAc,EAAA,CAAA;AAErC,IAAA,MAAM,WAAc,GAAA,GAAA,iBAAqB,IAAA,GAAA,EAAK,CAAA,CAAA;AAC9C,IAAM,MAAA,aAAA,GAAgB,SAAS,MAAM,KAAA,CAAM,eAAe,WAAY,CAAA,KAAA,CAAM,OAAO,CAAC,CAAA,CAAA;AAGpF,IAAM,MAAA,WAAA,GAA0C,OAAM,OAAW,KAAA;AAC/D,MAAA,WAAA,CAAY,KAAM,CAAA,GAAA,CAAI,OAAQ,CAAA,IAAA,CAAK,GAAG,CAAA,CAAA;AACtC,MAAA,OAAO,WAAW,OAAQ,CAAA,IAAA,EAAM,EAAE,UAA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AAU,EAAA;AAClB,QAAA,OAAA;AAAA,OACF;AACA,MAAA,IAAI,MAAM,OAAQ,CAAA,KAAK,CAAK,IAAA,KAAA,CAAM,SAAS,CAAG,EAAA;AAC5C,QAAA,KAAA,CAAM,QAAQ,CAAQ,IAAA,KAAA;AACpB,UAAA,IAAI,gBAAgB,IAAM,EAAA;AACxB,YAAA,MAAM,OAAU,GAAA,IAAA,CAAA;AAChB,YAAc,aAAA,CAAA,KAAA,EAAO,YAAY,OAAO,CAAA,CAAA;AAGxC,YAAA,IAAI,MAAM,UAAY,EAAA;AACpB,cAAA,aAAA,CAAc,OAAO,MAAO,EAAA,CAAA;AAAA,aAC9B;AAAA,WACF;AAAA,SACD,CAAA,CAAA;AAAA,OACH;AAAA,KACD,CAAA,CAAA;AAED,IAAA,OAAA,CAAQ,CAAC,KAAiB,KAAA;AACxB,MAAQ,OAAA,CAAA,KAAA,CAAM,6BAAS,KAAK,CAAA,CAAA;AAC5B,MAAa,YAAA,CAAA,KAAA,CAAM,KAAM,CAAA,OAAA,EAAS,cAAM,EAAA;AAAA,QACtC,IAAM,EAAA,OAAA;AAAA,OACP,CAAA,CAAA;AAAA,KACF,CAAA,CAAA;AACD,IAAa,QAAA,CAAA;AAAA,MACX,GAAG,SAAA;AAAA,MACH,aAAA;AAAA,KACD,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"UploadPro.vue2.mjs","sources":["../../../../../../../packages/components/src/business/uploadPro/UploadPro.vue"],"sourcesContent":["<template>\n <div>\n <div\n v-loading=\"uploadLoading\"\n ref=\"pasteFileRef\"\n :class=\"{ 'gm-upload-pro-file-picture-card': listType === 'picture-card', 'gm-upload-pro-file-disabled': disabled }\"\n class=\"gm-upload-pro-file\"\n >\n <el-checkbox-group v-model=\"checkoutFiles\">\n <el-upload\n ref=\"uploadFileRef\"\n v-bind=\"props\"\n v-model:file-list=\"fileList\"\n :before-remove=\"beforeRemove\"\n action=\"\"\n :http-request=\"httpRequest\"\n :on-success=\"coverFileSuccess\"\n :on-error=\"coverFileError\"\n >\n <slot v-if=\"!disabled\">\n <template v-if=\"listType === 'picture-card'\">\n <div\n class=\"gm-flex gm-flex-col gm-items-center gm-justify-center gm-rounded-md gm-border gm-border-dashed gm-p-1\"\n style=\"flex-direction: column\"\n :style=\"{ width: width + 'px', height: height + 'px' }\"\n >\n <el-icon :size=\"30\" color=\"#999\">\n <UploadFilled />\n </el-icon>\n <div class=\"el-upload__text gm-text-center !gm-text-xs gm-text-gray-500\">\n 将文件拖到此处,复制粘贴,或 <em class=\"gm-text-blue-700\">点击上传</em>\n </div>\n </div>\n </template>\n <template v-else>\n <el-button type=\"primary\" size=\"default\">点击上传</el-button>\n </template>\n </slot>\n <template v-if=\"showFileList && listType === 'picture-card'\" #file=\"{ file }\">\n <el-checkbox v-if=\"checkbox\" :value=\"file\" />\n\n <slot name=\"file\" :file=\"file\">\n <div class=\"gm-flex gm-items-center gm-justify-center gm-rounded-md\" :style=\"{ width: width + 'px', height: height + 'px' }\">\n <el-progress\n v-if=\"file.status === 'uploading' || loadingUids.has(file.uid)\"\n :type=\"listType === 'picture-card' ? 'circle' : 'line'\"\n :stroke-width=\"listType === 'picture-card' ? 6 : 2\"\n :percentage=\"Number(file.percentage)\"\n :style=\"\n listType === 'picture-card'\n ? {\n width: width - 20 + 'px',\n height: width - 20 + 'px',\n }\n : 'margin-top: 0.5rem'\n \"\n :width=\"width - 20\"\n />\n\n <GmFileComponent v-else :file=\"file\" :size=\"width - 40\" :controls=\"false\" :show-icon=\"true\" />\n </div>\n <div class=\"el-upload-list__item-actions\">\n <span class=\"el-upload-list__item-preview\" @click=\"handlePreview(file)\">\n <el-icon><View /></el-icon>\n </span>\n <span v-if=\"showDelete\" class=\"el-upload-list__item-delete\" @click=\"handleRemove(file, fileList)\">\n <el-icon><Delete /></el-icon>\n </span>\n </div>\n </slot>\n </template>\n <template v-else #file=\"slotValue\">\n <slot name=\"file\" v-bind=\"slotValue\" />\n </template>\n <template v-if=\"slots.trigger\" #trigger>\n <slot name=\"trigger\" />\n </template>\n <template v-if=\"slots.tip\" #tip>\n <div class=\"gm-text-sm\">\n <slot name=\"tip\" />\n </div>\n </template>\n </el-upload>\n </el-checkbox-group>\n\n <GmPreviewFile v-model:dialogVisible=\"dialogVisible\" v-model:file-index=\"fileIndex\" :file-list=\"fileList\" />\n </div>\n </div>\n</template>\n\n<script setup lang=\"ts\">\nimport { ElMessageBox } from 'element-plus';\nimport { computed, ref, useSlots } from 'vue';\n// import { fileValidType } from '@giime/utils/src/file';\n// import { pasteFile } from '@giime/utils/src/pasteFile';\nimport { usePasteFile } from '@giime/hooks/base/usePasteFile';\nimport { GmConfirmBox } from '@giime/components/src/plugins/confirmBox';\nimport { Delete, UploadFilled, View } from '@element-plus/icons-vue';\nimport GmFileComponent from '../../composite/fileComponent';\nimport GmPreviewFile from '../../composite/previewFile';\nimport { GmUploadProUserFileResponse, uploadFileProps } from './uploadPro';\nimport type { UploadFile, UploadFiles, UploadInstance, UploadProps, UploadRawFile } from 'element-plus';\nimport { getGmExports } from '@giime/utils/src/elementPlus/exports';\nimport { useUploadFile } from '@giime/hooks/base/useUploadFile';\n\ndefineOptions({\n name: 'GmUploadPro',\n});\nconst slots = useSlots();\n\nconst props = defineProps(uploadFileProps);\nconst emit = defineEmits([\"handleRemove\"]);\n\n/** 上传文件 */\nconst fileList = defineModel<UploadFile[]>('fileList', { required: true });\n/** 多选数据 */\nconst checkoutFiles = defineModel<any[]>('checkoutFiles', { default: () => [] });\n/**上传功能 */\nconst { uploadFile, cancelUpload } = useUploadFile();\n\nconst loadingUids = ref<Set<number>>(new Set());\nconst uploadLoading = computed(() => props.showLoading && loadingUids.value.size > 0);\n\n/* 上传 */\nconst httpRequest: UploadProps['httpRequest'] = async options => {\n loadingUids.value.add(options.file.uid);\n return uploadFile(options.file, {\n domainCode: props.domainCode,\n sceneCode: props.sceneCode,\n accept: props.accept,\n acl: props.acl,\n elOptions: options,\n });\n};\n// 上传成功\nconst coverFileSuccess: UploadProps['onSuccess'] = (response: GmUploadProUserFileResponse, uploadFile, uploadFiles) => {\n loadingUids.value.delete(uploadFile.uid);\n props.onSuccess?.(response, uploadFile, uploadFiles);\n};\n// 上传失败\nconst coverFileError: UploadProps['onError'] = (error, uploadFile, uploadFiles) => {\n loadingUids.value.delete(uploadFile.uid);\n props.onError?.(error, uploadFile, uploadFiles);\n};\n\n/* 删除文件前 */\nconst beforeRemove: UploadProps['beforeRemove'] = async (file, files) => {\n if (props.disabled) {\n return false;\n }\n if (props.deleteTip) {\n await GmConfirmBox({ message: '确定删除该文件吗?' }, async () => {});\n }\n // 如果文件正在上传,取消上传请求\n if (file.status === 'uploading' || loadingUids.value.has(file.uid)) {\n cancelUpload(file.uid);\n loadingUids.value.delete(file.uid);\n }\n return props.beforeRemove?.(file, files) ?? true;\n};\n\n/* 删除文件 */\nconst removeFile = (file: UploadFile, uploadFiles: UploadFiles) => {\n // 如果文件正在上传,取消上传请求\n if (file.status === 'uploading' || loadingUids.value.has(file.uid)) {\n cancelUpload(file.uid);\n loadingUids.value.delete(file.uid);\n }\n\n const index = fileList.value.indexOf(file);\n if (index > -1) {\n fileList.value.splice(index, 1);\n emit('handleRemove', { file, index });\n return props.onRemove?.(file, uploadFiles);\n }\n};\n/**点击删除图标 */\nconst handleRemove = async (file: UploadFile, uploadFiles: UploadFiles) => {\n if (props.deleteTip) {\n await GmConfirmBox({ message: '确定删除该文件吗?' }, async () => {});\n }\n\n removeFile(file, uploadFiles);\n};\n\nconst uploadFileRef = ref<UploadInstance>();\nconst exposeEvents = ['abort', 'submit', 'clearFiles', 'handleStart', 'handleRemove'] as const;\nconst { exposeFns } = getGmExports(uploadFileRef, exposeEvents);\n\nconst pasteFileRef = ref<HTMLElement>();\n\n/** 预览 */\nconst dialogVisible = ref(false);\nconst fileIndex = ref(0);\n/**点击预览 */\nconst handlePreview = (file: UploadFile) => {\n fileIndex.value = fileList.value.indexOf(file);\n dialogVisible.value = true;\n};\n\n//** 复制粘贴 */\nconst { onSuccess, onError } = usePasteFile(pasteFileRef, { accept: props.accept, disabled: props.disabled });\nonSuccess((files: File[]) => {\n if (props.disabled) {\n return;\n }\n if (Array.isArray(files) && files.length > 0) {\n files.forEach(file => {\n if (file instanceof File) {\n const rawFile = file as UploadRawFile;\n uploadFileRef.value?.handleStart(rawFile);\n\n // 粘贴成功自动上传\n if (props.autoUpload) {\n uploadFileRef.value?.submit();\n }\n }\n });\n }\n});\n/**粘贴失败 */\nonError((error: Error) => {\n console.error('粘贴错误:', error);\n ElMessageBox.alert(error.message, '提示', {\n type: 'error',\n });\n});\ndefineExpose({\n ...exposeFns,\n uploadFileRef,\n});\n</script>\n\n<style scoped lang=\"scss\">\n.gm-upload-pro-preview-dialog {\n :deep(.el-dialog__body) {\n padding: 0;\n }\n}\n.gm-upload-pro-file-picture-card {\n :deep(.el-upload-list__item),\n :deep(.el-upload--picture-card) {\n width: auto;\n height: auto;\n }\n}\n</style>\n<style lang=\"scss\">\n.gm-upload-pro-file {\n line-height: normal;\n .el-checkbox-group {\n font-size: unset;\n }\n .el-checkbox {\n position: absolute;\n left: 10px;\n top: 0;\n z-index: 9;\n }\n .el-upload-list--picture-card {\n gap: 10px;\n }\n .el-upload-list__item {\n margin: 0;\n }\n .el-upload-list__item-file-name {\n line-height: 1.7;\n }\n .el-upload-dragger {\n padding: 0;\n border: none;\n width: 100%;\n height: 100%;\n display: flex;\n }\n .el-upload--picture-card {\n border: none;\n }\n}\n.gm-upload-pro-file-disabled {\n .el-upload--picture-card {\n display: none;\n }\n .el-upload-list__item-status-label {\n display: none;\n }\n}\n</style>\n"],"names":["_useModel","uploadFile"],"mappings":";;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uploadPro.mjs","sources":["../../../../../../../packages/components/src/business/uploadPro/uploadPro.ts"],"sourcesContent":["import { type PropType } from 'vue';\nimport { type UploadFile, type UploadProps, uploadProps, type UploadUserFile } from 'element-plus';\nimport type { ResourceUrlResponse } from '@giime/api/resource/interface';\n// import { previewFileProps } from '../../composite/previewFile/previewFile';\n\nexport const uploadFileProps = {\n ...uploadProps,\n // ...previewFileProps,\n listType: {\n type: String as PropType<UploadProps['listType']>,\n default: 'picture-card',\n },\n drag: {\n type: Boolean,\n default: true,\n },\n /**领域编码 */\n domainCode: {\n type: String,\n },\n /**场景编码 */\n sceneCode: {\n type: String,\n default: 'internal_oss',\n },\n /** 文件权限,默认继承桶 */\n acl: {\n type: String,\n default: 'default',\n },\n /**上传中是否loading */\n showLoading: {\n type: Boolean,\n default:
|
|
1
|
+
{"version":3,"file":"uploadPro.mjs","sources":["../../../../../../../packages/components/src/business/uploadPro/uploadPro.ts"],"sourcesContent":["import { type PropType } from 'vue';\nimport { type UploadFile, type UploadProps, uploadProps, type UploadUserFile } from 'element-plus';\nimport type { ResourceUrlResponse } from '@giime/api/resource/interface';\n// import { previewFileProps } from '../../composite/previewFile/previewFile';\n\nexport const uploadFileProps = {\n ...uploadProps,\n // ...previewFileProps,\n listType: {\n type: String as PropType<UploadProps['listType']>,\n default: 'picture-card',\n },\n drag: {\n type: Boolean,\n default: true,\n },\n /**领域编码 */\n domainCode: {\n type: String,\n },\n /**场景编码 */\n sceneCode: {\n type: String,\n default: 'internal_oss',\n },\n /** 文件权限,默认继承桶 */\n acl: {\n type: String,\n default: 'default',\n },\n /**上传中是否loading */\n showLoading: {\n type: Boolean,\n default: false,\n },\n /** 是否展示删除按钮 */\n showDelete: {\n type: Boolean,\n default: true,\n },\n /** 删除时提示 */\n deleteTip: {\n type: Boolean,\n default: false,\n },\n /** 是否开启文件多选 */\n checkbox: {\n type: Boolean,\n default: false,\n },\n /** 缩略图宽度 */\n width: {\n type: Number,\n default: 120,\n },\n /** 缩略图高度 */\n height: {\n type: Number,\n default: 120,\n },\n};\nexport type GmUploadProUserFileResponse = ResourceUrlResponse;\n\nexport type GmUploadProUserFile = Omit<UploadUserFile, 'response'> & { response?: GmUploadProUserFileResponse };\n"],"names":[],"mappings":";;AAKO,MAAM,eAAkB,GAAA;AAAA,EAC7B,GAAG,WAAA;AAAA;AAAA,EAEH,QAAU,EAAA;AAAA,IACR,IAAM,EAAA,MAAA;AAAA,IACN,OAAS,EAAA,cAAA;AAAA,GACX;AAAA,EACA,IAAM,EAAA;AAAA,IACJ,IAAM,EAAA,OAAA;AAAA,IACN,OAAS,EAAA,IAAA;AAAA,GACX;AAAA;AAAA,EAEA,UAAY,EAAA;AAAA,IACV,IAAM,EAAA,MAAA;AAAA,GACR;AAAA;AAAA,EAEA,SAAW,EAAA;AAAA,IACT,IAAM,EAAA,MAAA;AAAA,IACN,OAAS,EAAA,cAAA;AAAA,GACX;AAAA;AAAA,EAEA,GAAK,EAAA;AAAA,IACH,IAAM,EAAA,MAAA;AAAA,IACN,OAAS,EAAA,SAAA;AAAA,GACX;AAAA;AAAA,EAEA,WAAa,EAAA;AAAA,IACX,IAAM,EAAA,OAAA;AAAA,IACN,OAAS,EAAA,KAAA;AAAA,GACX;AAAA;AAAA,EAEA,UAAY,EAAA;AAAA,IACV,IAAM,EAAA,OAAA;AAAA,IACN,OAAS,EAAA,IAAA;AAAA,GACX;AAAA;AAAA,EAEA,SAAW,EAAA;AAAA,IACT,IAAM,EAAA,OAAA;AAAA,IACN,OAAS,EAAA,KAAA;AAAA,GACX;AAAA;AAAA,EAEA,QAAU,EAAA;AAAA,IACR,IAAM,EAAA,OAAA;AAAA,IACN,OAAS,EAAA,KAAA;AAAA,GACX;AAAA;AAAA,EAEA,KAAO,EAAA;AAAA,IACL,IAAM,EAAA,MAAA;AAAA,IACN,OAAS,EAAA,GAAA;AAAA,GACX;AAAA;AAAA,EAEA,MAAQ,EAAA;AAAA,IACN,IAAM,EAAA,MAAA;AAAA,IACN,OAAS,EAAA,GAAA;AAAA,GACX;AACF;;;;"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { createElementVNode, defineComponent, mergeModels, useModel, computed, resolveComponent, openBlock, createBlock, withCtx, createVNode, createTextVNode, createElementBlock, unref, createCommentVNode, normalizeProps, guardReactiveProps } from 'vue';
|
|
2
2
|
import { ElMessage } from 'element-plus';
|
|
3
|
-
import { downloadFile } from '../../../../utils/src/file.mjs';
|
|
4
3
|
import { ArrowLeftBold, ArrowRightBold } from '@element-plus/icons-vue';
|
|
5
4
|
import { GmFileComponent } from '../fileComponent/index.mjs';
|
|
6
5
|
import { previewFileProps } from './previewFile.mjs';
|
|
6
|
+
import { useDownload } from '../../../../hooks/base/useDownload/index.mjs';
|
|
7
7
|
|
|
8
8
|
const _hoisted_1 = { class: "gm-flex gm-items-center gm-justify-between" };
|
|
9
9
|
const _hoisted_2 = /* @__PURE__ */ createElementVNode(
|
|
@@ -34,6 +34,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
34
34
|
const props = __props;
|
|
35
35
|
const dialogVisible = useModel(__props, "dialogVisible");
|
|
36
36
|
const fileIndex = useModel(__props, "fileIndex");
|
|
37
|
+
const downloadMethod = useDownload();
|
|
37
38
|
const files = computed(() => {
|
|
38
39
|
let result = props.fileList;
|
|
39
40
|
if (props.fileList && !props.fileList.length && props.file) {
|
|
@@ -69,7 +70,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
69
70
|
};
|
|
70
71
|
const download = () => {
|
|
71
72
|
const file = files.value[fileIndex.value];
|
|
72
|
-
|
|
73
|
+
downloadMethod.downloadByUrl(file.url || "", { filename: file.name });
|
|
73
74
|
};
|
|
74
75
|
return (_ctx, _cache) => {
|
|
75
76
|
const _component_el_button = resolveComponent("el-button");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PreviewFile.vue2.mjs","sources":["../../../../../../../packages/components/src/composite/previewFile/PreviewFile.vue"],"sourcesContent":["<template>\n <el-dialog v-model=\"dialogVisible\" title=\"预览\" :width=\"width\" top=\"10vh\" append-to-body destroy-on-close>\n <template #header>\n <div class=\"gm-flex gm-items-center gm-justify-between\">\n <span>预览</span>\n <el-button type=\"primary\" size=\"default\" link @click=\"download\">下载</el-button>\n </div>\n </template>\n <div class=\"gm-flex gm-select-none gm-items-center gm-justify-center gm-gap-4\">\n <div v-if=\"files.length > 1\" class=\"gm-cursor-pointer\" @click=\"prev\">\n <el-icon :size=\"40\"><ArrowLeftBold /></el-icon>\n </div>\n <div class=\"gm-flex gm-flex-1 gm-items-center gm-justify-center\" style=\"height: calc(80vh - 72px)\">\n <GmFileComponent v-bind=\"fileProps\" />\n </div>\n <div v-if=\"files.length > 1\" class=\"gm-cursor-pointer\" @click=\"next\">\n <el-icon :size=\"40\"><ArrowRightBold /></el-icon>\n </div>\n </div>\n </el-dialog>\n</template>\n\n<script setup lang=\"ts\">\nimport { computed } from 'vue';\nimport { ElMessage } from 'element-plus';\nimport {
|
|
1
|
+
{"version":3,"file":"PreviewFile.vue2.mjs","sources":["../../../../../../../packages/components/src/composite/previewFile/PreviewFile.vue"],"sourcesContent":["<template>\n <el-dialog v-model=\"dialogVisible\" title=\"预览\" :width=\"width\" top=\"10vh\" append-to-body destroy-on-close>\n <template #header>\n <div class=\"gm-flex gm-items-center gm-justify-between\">\n <span>预览</span>\n <el-button type=\"primary\" size=\"default\" link @click=\"download\">下载</el-button>\n </div>\n </template>\n <div class=\"gm-flex gm-select-none gm-items-center gm-justify-center gm-gap-4\">\n <div v-if=\"files.length > 1\" class=\"gm-cursor-pointer\" @click=\"prev\">\n <el-icon :size=\"40\"><ArrowLeftBold /></el-icon>\n </div>\n <div class=\"gm-flex gm-flex-1 gm-items-center gm-justify-center\" style=\"height: calc(80vh - 72px)\">\n <GmFileComponent v-bind=\"fileProps\" />\n </div>\n <div v-if=\"files.length > 1\" class=\"gm-cursor-pointer\" @click=\"next\">\n <el-icon :size=\"40\"><ArrowRightBold /></el-icon>\n </div>\n </div>\n </el-dialog>\n</template>\n\n<script setup lang=\"ts\">\nimport { computed } from 'vue';\nimport { ElMessage } from 'element-plus';\nimport { ArrowLeftBold, ArrowRightBold } from '@element-plus/icons-vue';\nimport GmFileComponent from '../fileComponent';\nimport { previewFileProps } from './previewFile';\nimport type { UploadFile } from 'element-plus';\nimport { useDownload } from '@giime/hooks/base/useDownload';\n\ndefineOptions({\n name: 'GmPreviewFile',\n});\n\nconst props = defineProps(previewFileProps);\nconst dialogVisible = defineModel<boolean>('dialogVisible', { default: false });\nconst fileIndex = defineModel<number>('fileIndex', { default: 0 });\n\nconst downloadMethod = useDownload();\n\nconst files = computed(() => {\n let result: Partial<UploadFile>[] = props.fileList;\n if (props.fileList && !props.fileList.length && props.file) {\n result = [props.file];\n }\n return result;\n});\n\nconst fileProps = computed(() => {\n const file = files.value[fileIndex.value];\n return {\n file,\n controls: props.controls,\n oncontextmenu: props.oncontextmenu,\n controlslist: props.controlslist,\n field: props.field,\n url: props.url,\n size: props.size,\n };\n});\n\nconst prev = () => {\n if (fileIndex.value > 0) {\n fileIndex.value--;\n return;\n }\n ElMessage.warning('已经是第一张了');\n};\n\nconst next = () => {\n if (fileIndex.value < props.fileList.length - 1) {\n fileIndex.value++;\n return;\n }\n ElMessage.warning('没有更多了!');\n};\n\nconst download = () => {\n const file = files.value[fileIndex.value];\n downloadMethod.downloadByUrl(file.url || '', { filename: file.name });\n};\n</script>\n"],"names":["_useModel"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCA,IAAA,MAAM,KAAQ,GAAA,OAAA,CAAA;AACd,IAAM,MAAA,aAAA,GAAgBA,QAAqB,CAAA,OAAA,EAAA,eAAmC,CAAA,CAAA;AAC9E,IAAM,MAAA,SAAA,GAAYA,QAAmB,CAAA,OAAA,EAAC,WAA2B,CAAA,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AC5B,CAAA;AAEA,IAAA,MAAM,WAAW,MAAM;AACrB,MAAA,MAAM,IAAO,GAAA,KAAA,CAAM,KAAM,CAAA,SAAA,CAAU,KAAK,CAAA,CAAA;AACxC,MAAe,cAAA,CAAA,aAAA,CAAc,KAAK,GAAO,IAAA,EAAA,EAAI,EAAE,QAAU,EAAA,IAAA,CAAK,MAAM,CAAA,CAAA;AAAA,KACtE,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/es/components/src/composite/searchForm/searchFormItems/cascader/SearchFormCascader.vue2.mjs
CHANGED
|
@@ -53,7 +53,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
53
53
|
modelValue: modelValue.value,
|
|
54
54
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => modelValue.value = $event),
|
|
55
55
|
options: _ctx.options,
|
|
56
|
-
props: { ..._ctx.cascaderProps
|
|
56
|
+
props: { ..._ctx.cascaderProps },
|
|
57
57
|
clearable: "",
|
|
58
58
|
filterable: "",
|
|
59
59
|
disabled: _ctx.disabled,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchFormCascader.vue2.mjs","sources":["../../../../../../../../../packages/components/src/composite/searchForm/searchFormItems/cascader/SearchFormCascader.vue"],"sourcesContent":["<template>\n <gm-form-item ref=\"formItemRef\" :prop=\"prop\">\n <gm-cascader\n ref=\"cascaderRef\"\n v-model=\"modelValue\"\n :options=\"options\"\n :props=\"{ ...cascaderProps
|
|
1
|
+
{"version":3,"file":"SearchFormCascader.vue2.mjs","sources":["../../../../../../../../../packages/components/src/composite/searchForm/searchFormItems/cascader/SearchFormCascader.vue"],"sourcesContent":["<template>\n <gm-form-item ref=\"formItemRef\" :prop=\"prop\">\n <gm-cascader\n ref=\"cascaderRef\"\n v-model=\"modelValue\"\n :options=\"options\"\n :props=\"{ ...cascaderProps }\"\n clearable\n filterable\n :disabled=\"disabled\"\n collapse-tags\n collapse-tags-tooltip\n class=\"gm-w-full\"\n :placeholder=\"label\"\n @change=\"onChange\"\n />\n </gm-form-item>\n</template>\n<script lang=\"ts\" setup>\n// import { inject } from 'vue';\nimport { ref } from 'vue';\nimport { getGmObjExports } from '@giime/utils';\nimport { type FormItemInstance, formItemExposeNames } from '@giime/components/src/base/formItem';\nimport { type CascaderInstance, type CascaderProps, cascaderExposeNames } from '@giime/components/src/base/cascader';\nimport { useWatchModelChange } from '../../composables/useWatchModelChange';\n// import { searchFormHandleQueryKey } from '../../searchForm';\nimport { SearchFormCascaderName, searchFormCascaderEmits, searchFormCascaderProps } from './searchFormCascader';\nimport type { CascaderValue } from 'element-plus';\ndefineOptions({\n name: SearchFormCascaderName,\n});\nconst modelValue = defineModel<CascaderProps['modelValue'] | undefined>();\nconst props = defineProps(searchFormCascaderProps);\nconst emit = defineEmits(searchFormCascaderEmits);\nuseWatchModelChange(modelValue, { prop: props.prop, noDefaultSync: props.noDefaultSync });\n// const handleQuery = inject(searchFormHandleQueryKey);\nconst onChange = (value: CascaderValue) => {\n // handleQuery?.();\n emit('change', value);\n};\nconst cascaderRef = ref<CascaderInstance>();\nconst formItemRef = ref<FormItemInstance>();\nconst { exposeFns: cascaderFns } = getGmObjExports(cascaderRef, cascaderExposeNames);\nconst { exposeFns: formItemFns } = getGmObjExports(formItemRef, formItemExposeNames);\ndefineExpose({\n cascaderExposes: {\n ...cascaderFns,\n },\n formItemExposes: {\n ...formItemFns,\n },\n});\n</script>\n"],"names":["_useModel"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA+BA,IAAM,MAAA,UAAA,GAAaA,QAAoD,CAAA,OAAA,EAAA,YAAC,CAAA,CAAA;AACxE,IAAA,MAAM,KAAQ,GAAA,OAAA,CAAA;AACd,IAAA,MAAM,IAAO,GAAA,MAAA,CAAA;AACb,IAAoB,mBAAA,CAAA,UAAA,EAAY,EAAE,IAAM,EAAA,KAAA,CAAM,MAAM,aAAe,EAAA,KAAA,CAAM,eAAe,CAAA,CAAA;AAExF,IAAM,MAAA,QAAA,GAAW,CAAC,KAAyB,KAAA;AAEzC,MAAA,IAAA,CAAK,UAAU,KAAK,CAAA,CAAA;AAAA,KACtB,CAAA;AACA,IAAA,MAAM,cAAc,GAAsB,EAAA,CAAA;AAC1C,IAAA,MAAM,cAAc,GAAsB,EAAA,CAAA;AAC1C,IAAA,MAAM,EAAE,SAAW,EAAA,WAAA,EAAgB,GAAA,eAAA,CAAgB,aAAa,mBAAmB,CAAA,CAAA;AACnF,IAAA,MAAM,EAAE,SAAW,EAAA,WAAA,EAAgB,GAAA,eAAA,CAAgB,aAAa,mBAAmB,CAAA,CAAA;AACnF,IAAa,QAAA,CAAA;AAAA,MACX,eAAiB,EAAA;AAAA,QACf,GAAG,WAAA;AAAA,OACL;AAAA,MACA,eAAiB,EAAA;AAAA,QACf,GAAG,WAAA;AAAA,OACL;AAAA,KACD,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -10,7 +10,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
10
10
|
required: true;
|
|
11
11
|
};
|
|
12
12
|
type: {
|
|
13
|
-
type: import("vue").PropType<"date" | "daterange" | "month" | "year" | "months" | "years" | "dates" | "week" | "
|
|
13
|
+
type: import("vue").PropType<"date" | "daterange" | "month" | "year" | "months" | "years" | "dates" | "week" | "datetimerange" | "datetime" | "monthrange" | "yearrange">;
|
|
14
14
|
required: true;
|
|
15
15
|
};
|
|
16
16
|
shortcuts: {
|
|
@@ -30,7 +30,6 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
30
30
|
};
|
|
31
31
|
valueFormat: {
|
|
32
32
|
type: import("vue").PropType<string | undefined>;
|
|
33
|
-
default: string;
|
|
34
33
|
};
|
|
35
34
|
startPlaceholder: {
|
|
36
35
|
type: StringConstructor;
|
|
@@ -60,7 +59,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
60
59
|
required: true;
|
|
61
60
|
};
|
|
62
61
|
type: {
|
|
63
|
-
type: import("vue").PropType<"date" | "daterange" | "month" | "year" | "months" | "years" | "dates" | "week" | "
|
|
62
|
+
type: import("vue").PropType<"date" | "daterange" | "month" | "year" | "months" | "years" | "dates" | "week" | "datetimerange" | "datetime" | "monthrange" | "yearrange">;
|
|
64
63
|
required: true;
|
|
65
64
|
};
|
|
66
65
|
shortcuts: {
|
|
@@ -80,7 +79,6 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
80
79
|
};
|
|
81
80
|
valueFormat: {
|
|
82
81
|
type: import("vue").PropType<string | undefined>;
|
|
83
|
-
default: string;
|
|
84
82
|
};
|
|
85
83
|
startPlaceholder: {
|
|
86
84
|
type: StringConstructor;
|
|
@@ -102,7 +100,6 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
102
100
|
}, {
|
|
103
101
|
disabled: boolean;
|
|
104
102
|
label: string;
|
|
105
|
-
valueFormat: string | undefined;
|
|
106
103
|
noDefaultSync: boolean;
|
|
107
104
|
}, {}>;
|
|
108
105
|
export default _default;
|
|
@@ -20,6 +20,10 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
20
20
|
const emit = __emit;
|
|
21
21
|
useWatchModelChange(modelValue, { prop: props.prop, noDefaultSync: props.noDefaultSync });
|
|
22
22
|
const shortcutList = computed(() => Array.isArray(props.shortcuts) ? props.shortcuts : getDateShortcuts(props.type));
|
|
23
|
+
const valueFormat = computed(() => props.valueFormat ?? (props.type === "datetimerange" ? "YYYY-MM-DD HH:mm:ss" : "YYYY-MM-DD"));
|
|
24
|
+
const defaultTime = computed(
|
|
25
|
+
() => props.defaultTime ?? (props.type === "datetimerange" ? [new Date(2e3, 0, 1, 0, 0, 0), new Date(2e3, 0, 1, 23, 59, 59)] : void 0)
|
|
26
|
+
);
|
|
23
27
|
const onChange = (value) => {
|
|
24
28
|
emit("change", value);
|
|
25
29
|
};
|
|
@@ -33,7 +37,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
33
37
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => modelValue.value = $event),
|
|
34
38
|
type: _ctx.type,
|
|
35
39
|
"range-separator": "-",
|
|
36
|
-
"value-format":
|
|
40
|
+
"value-format": valueFormat.value,
|
|
37
41
|
clearable: "",
|
|
38
42
|
disabled: _ctx.disabled,
|
|
39
43
|
placeholder: _ctx.label,
|
|
@@ -44,7 +48,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
44
48
|
},
|
|
45
49
|
shortcuts: shortcutList.value,
|
|
46
50
|
defaultValue: _ctx.defaultValue,
|
|
47
|
-
defaultTime:
|
|
51
|
+
defaultTime: defaultTime.value,
|
|
48
52
|
onChange
|
|
49
53
|
}, null, 8, ["modelValue", "type", "value-format", "disabled", "placeholder", "start-placeholder", "end-placeholder", "shortcuts", "defaultValue", "defaultTime"])
|
|
50
54
|
]),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchFormDatePicker.vue2.mjs","sources":["../../../../../../../../../packages/components/src/composite/searchForm/searchFormItems/datePicker/SearchFormDatePicker.vue"],"sourcesContent":["<template>\n <gm-form-item :prop=\"prop\">\n <gm-date-picker\n v-model=\"modelValue\"\n :type=\"type\"\n range-separator=\"-\"\n :value-format=\"valueFormat\"\n clearable\n :disabled=\"disabled\"\n :placeholder=\"label\"\n :start-placeholder=\"startPlaceholder ?? `${label}开始日期`\"\n :end-placeholder=\"endPlaceholder ?? `${label}结束日期`\"\n :style=\"{\n '--el-date-editor-width': '100%',\n }\"\n :shortcuts=\"shortcutList\"\n :defaultValue=\"defaultValue\"\n :defaultTime=\"defaultTime\"\n @change=\"onChange\"\n />\n </gm-form-item>\n</template>\n<script lang=\"ts\" setup>\nimport { computed } from 'vue';\nimport { getDateShortcuts } from '@giime/utils';\nimport { useWatchModelChange } from '../../composables/useWatchModelChange';\n// import { searchFormHandleQueryKey } from '../../searchForm';\nimport { SearchFormDatePickerName, searchFormDatePickerEmits, searchFormDatePickerProps } from './searchFormDatePicker';\nimport type { ModelValueType } from 'element-plus';\nimport type { DatePickerProps } from '@giime/components/src/base/datePicker';\ndefineOptions({\n name: SearchFormDatePickerName,\n});\nconst modelValue = defineModel<DatePickerProps['modelValue'] | undefined>();\nconst props = defineProps(searchFormDatePickerProps);\nconst emit = defineEmits(searchFormDatePickerEmits);\nuseWatchModelChange(modelValue, { prop: props.prop, noDefaultSync: props.noDefaultSync });\n\n// const isRangeType = computed(() => props.type === 'datetimerange' || props.type === 'daterange' || props.type === 'monthrange');\n/**\n * shortcuts赋予默认值\n */\nconst shortcutList = computed(() => (Array.isArray(props.shortcuts) ? props.shortcuts : getDateShortcuts(props.type)));\n// const handleQuery = inject(searchFormHandleQueryKey);\nconst onChange = (value: ModelValueType) => {\n // handleQuery?.();\n emit('change', value);\n};\n</script>\n"],"names":["_useModel"],"mappings":";;;;;;;;;;;;;;;;;AAiCA,IAAM,MAAA,UAAA,GAAaA,QAAsD,CAAA,OAAA,EAAA,YAAC,CAAA,CAAA;AAC1E,IAAA,MAAM,KAAQ,GAAA,OAAA,CAAA;AACd,IAAA,MAAM,IAAO,GAAA,MAAA,CAAA;AACb,IAAoB,mBAAA,CAAA,UAAA,EAAY,EAAE,IAAM,EAAA,KAAA,CAAM,MAAM,aAAe,EAAA,KAAA,CAAM,eAAe,CAAA,CAAA;AAMxF,IAAA,MAAM,YAAe,GAAA,QAAA,CAAS,MAAO,KAAA,CAAM,OAAQ,CAAA,KAAA,CAAM,SAAS,CAAA,GAAI,KAAM,CAAA,SAAA,GAAY,gBAAiB,CAAA,KAAA,CAAM,IAAI,CAAE,CAAA,CAAA;AAErH,IAAM,MAAA,QAAA,GAAW,CAAC,KAA0B,KAAA;AAE1C,MAAA,IAAA,CAAK,UAAU,KAAK,CAAA,CAAA;AAAA,KACtB,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"SearchFormDatePicker.vue2.mjs","sources":["../../../../../../../../../packages/components/src/composite/searchForm/searchFormItems/datePicker/SearchFormDatePicker.vue"],"sourcesContent":["<template>\n <gm-form-item :prop=\"prop\">\n <gm-date-picker\n v-model=\"modelValue\"\n :type=\"type\"\n range-separator=\"-\"\n :value-format=\"valueFormat\"\n clearable\n :disabled=\"disabled\"\n :placeholder=\"label\"\n :start-placeholder=\"startPlaceholder ?? `${label}开始日期`\"\n :end-placeholder=\"endPlaceholder ?? `${label}结束日期`\"\n :style=\"{\n '--el-date-editor-width': '100%',\n }\"\n :shortcuts=\"shortcutList\"\n :defaultValue=\"defaultValue\"\n :defaultTime=\"defaultTime\"\n @change=\"onChange\"\n />\n </gm-form-item>\n</template>\n<script lang=\"ts\" setup>\nimport { computed } from 'vue';\nimport { getDateShortcuts } from '@giime/utils';\nimport { useWatchModelChange } from '../../composables/useWatchModelChange';\n// import { searchFormHandleQueryKey } from '../../searchForm';\nimport { SearchFormDatePickerName, searchFormDatePickerEmits, searchFormDatePickerProps } from './searchFormDatePicker';\nimport type { ModelValueType } from 'element-plus';\nimport type { DatePickerProps } from '@giime/components/src/base/datePicker';\ndefineOptions({\n name: SearchFormDatePickerName,\n});\nconst modelValue = defineModel<DatePickerProps['modelValue'] | undefined>();\nconst props = defineProps(searchFormDatePickerProps);\nconst emit = defineEmits(searchFormDatePickerEmits);\nuseWatchModelChange(modelValue, { prop: props.prop, noDefaultSync: props.noDefaultSync });\n\n// const isRangeType = computed(() => props.type === 'datetimerange' || props.type === 'daterange' || props.type === 'monthrange');\n/**\n * shortcuts赋予默认值\n */\nconst shortcutList = computed(() => (Array.isArray(props.shortcuts) ? props.shortcuts : getDateShortcuts(props.type)));\n\nconst valueFormat = computed(() => props.valueFormat ?? (props.type === 'datetimerange' ? 'YYYY-MM-DD HH:mm:ss' : 'YYYY-MM-DD'));\n\nconst defaultTime = computed(\n () =>\n props.defaultTime ??\n (props.type === 'datetimerange' ? ([new Date(2000, 0, 1, 0, 0, 0), new Date(2000, 0, 1, 23, 59, 59)] as [Date, Date]) : undefined),\n);\n// const handleQuery = inject(searchFormHandleQueryKey);\nconst onChange = (value: ModelValueType) => {\n // handleQuery?.();\n emit('change', value);\n};\n</script>\n"],"names":["_useModel"],"mappings":";;;;;;;;;;;;;;;;;AAiCA,IAAM,MAAA,UAAA,GAAaA,QAAsD,CAAA,OAAA,EAAA,YAAC,CAAA,CAAA;AAC1E,IAAA,MAAM,KAAQ,GAAA,OAAA,CAAA;AACd,IAAA,MAAM,IAAO,GAAA,MAAA,CAAA;AACb,IAAoB,mBAAA,CAAA,UAAA,EAAY,EAAE,IAAM,EAAA,KAAA,CAAM,MAAM,aAAe,EAAA,KAAA,CAAM,eAAe,CAAA,CAAA;AAMxF,IAAA,MAAM,YAAe,GAAA,QAAA,CAAS,MAAO,KAAA,CAAM,OAAQ,CAAA,KAAA,CAAM,SAAS,CAAA,GAAI,KAAM,CAAA,SAAA,GAAY,gBAAiB,CAAA,KAAA,CAAM,IAAI,CAAE,CAAA,CAAA;AAErH,IAAM,MAAA,WAAA,GAAc,SAAS,MAAM,KAAA,CAAM,gBAAgB,KAAM,CAAA,IAAA,KAAS,eAAkB,GAAA,qBAAA,GAAwB,YAAa,CAAA,CAAA,CAAA;AAE/H,IAAA,MAAM,WAAc,GAAA,QAAA;AAAA,MAClB,MACE,KAAM,CAAA,WAAA,KACL,KAAM,CAAA,IAAA,KAAS,kBAAmB,CAAC,IAAI,IAAK,CAAA,GAAA,EAAM,CAAG,EAAA,CAAA,EAAG,GAAG,CAAG,EAAA,CAAC,CAAG,EAAA,IAAI,IAAK,CAAA,GAAA,EAAM,CAAG,EAAA,CAAA,EAAG,EAAI,EAAA,EAAA,EAAI,EAAE,CAAC,CAAqB,GAAA,KAAA,CAAA,CAAA;AAAA,KAC5H,CAAA;AAEA,IAAM,MAAA,QAAA,GAAW,CAAC,KAA0B,KAAA;AAE1C,MAAA,IAAA,CAAK,UAAU,KAAK,CAAA,CAAA;AAAA,KACtB,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -10,7 +10,7 @@ export declare const GmSearchFormDatePicker: import("../../../../../../utils").S
|
|
|
10
10
|
required: true;
|
|
11
11
|
};
|
|
12
12
|
type: {
|
|
13
|
-
type: import("vue").PropType<"date" | "daterange" | "month" | "year" | "months" | "years" | "dates" | "week" | "
|
|
13
|
+
type: import("vue").PropType<"date" | "daterange" | "month" | "year" | "months" | "years" | "dates" | "week" | "datetimerange" | "datetime" | "monthrange" | "yearrange">;
|
|
14
14
|
required: true;
|
|
15
15
|
};
|
|
16
16
|
shortcuts: {
|
|
@@ -30,7 +30,6 @@ export declare const GmSearchFormDatePicker: import("../../../../../../utils").S
|
|
|
30
30
|
};
|
|
31
31
|
valueFormat: {
|
|
32
32
|
type: import("vue").PropType<string | undefined>;
|
|
33
|
-
default: string;
|
|
34
33
|
};
|
|
35
34
|
startPlaceholder: {
|
|
36
35
|
type: StringConstructor;
|
|
@@ -60,7 +59,7 @@ export declare const GmSearchFormDatePicker: import("../../../../../../utils").S
|
|
|
60
59
|
required: true;
|
|
61
60
|
};
|
|
62
61
|
type: {
|
|
63
|
-
type: import("vue").PropType<"date" | "daterange" | "month" | "year" | "months" | "years" | "dates" | "week" | "
|
|
62
|
+
type: import("vue").PropType<"date" | "daterange" | "month" | "year" | "months" | "years" | "dates" | "week" | "datetimerange" | "datetime" | "monthrange" | "yearrange">;
|
|
64
63
|
required: true;
|
|
65
64
|
};
|
|
66
65
|
shortcuts: {
|
|
@@ -80,7 +79,6 @@ export declare const GmSearchFormDatePicker: import("../../../../../../utils").S
|
|
|
80
79
|
};
|
|
81
80
|
valueFormat: {
|
|
82
81
|
type: import("vue").PropType<string | undefined>;
|
|
83
|
-
default: string;
|
|
84
82
|
};
|
|
85
83
|
startPlaceholder: {
|
|
86
84
|
type: StringConstructor;
|
|
@@ -102,7 +100,6 @@ export declare const GmSearchFormDatePicker: import("../../../../../../utils").S
|
|
|
102
100
|
}, {
|
|
103
101
|
disabled: boolean;
|
|
104
102
|
label: string;
|
|
105
|
-
valueFormat: string | undefined;
|
|
106
103
|
noDefaultSync: boolean;
|
|
107
104
|
}, {}>> & Record<string, any>;
|
|
108
105
|
export type SearchFormDatePickerInstance = InstanceType<typeof SearchFormDatePicker>;
|
package/es/components/src/composite/searchForm/searchFormItems/datePicker/searchFormDatePicker.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ export declare const searchFormDatePickerProps: {
|
|
|
9
9
|
required: true;
|
|
10
10
|
};
|
|
11
11
|
type: {
|
|
12
|
-
type: PropType<"date" | "daterange" | "month" | "year" | "months" | "years" | "dates" | "week" | "
|
|
12
|
+
type: PropType<"date" | "daterange" | "month" | "year" | "months" | "years" | "dates" | "week" | "datetimerange" | "datetime" | "monthrange" | "yearrange">;
|
|
13
13
|
required: true;
|
|
14
14
|
};
|
|
15
15
|
shortcuts: {
|
|
@@ -29,7 +29,6 @@ export declare const searchFormDatePickerProps: {
|
|
|
29
29
|
};
|
|
30
30
|
valueFormat: {
|
|
31
31
|
type: PropType<string | undefined>;
|
|
32
|
-
default: string;
|
|
33
32
|
};
|
|
34
33
|
startPlaceholder: {
|
|
35
34
|
type: StringConstructor;
|
package/es/components/src/composite/searchForm/searchFormItems/datePicker/searchFormDatePicker.mjs
CHANGED
|
@@ -22,8 +22,8 @@ const searchFormDatePickerProps = {
|
|
|
22
22
|
defaultValue: datePickerProps["defaultValue"],
|
|
23
23
|
defaultTime: datePickerProps["defaultTime"],
|
|
24
24
|
valueFormat: {
|
|
25
|
-
type: String
|
|
26
|
-
default:
|
|
25
|
+
type: String
|
|
26
|
+
// default: 'YYYY-MM-DD',
|
|
27
27
|
},
|
|
28
28
|
startPlaceholder: {
|
|
29
29
|
type: String
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"searchFormDatePicker.mjs","sources":["../../../../../../../../../packages/components/src/composite/searchForm/searchFormItems/datePicker/searchFormDatePicker.ts"],"sourcesContent":["import { datePickerProps } from '@giime/components/src/base/datePicker';\nimport { searchFormCommonProps } from '../common';\nimport type { PropType } from 'vue';\nimport type { DatePickerProps } from '@giime/components/src/base/datePicker';\n\nexport const searchFormDatePickerProps = {\n ...searchFormCommonProps,\n label: {\n type: String,\n default: '',\n },\n prop: {\n type: String,\n required: true as const,\n },\n type: {\n type: String as PropType<DatePickerProps['type']>,\n required: true as const,\n },\n shortcuts: {\n type: Array as PropType<DatePickerProps['shortcuts']>,\n },\n defaultValue: datePickerProps['defaultValue'],\n defaultTime: datePickerProps['defaultTime'],\n valueFormat: {\n type: String as PropType<DatePickerProps['valueFormat']>,\n default: 'YYYY-MM-DD',\n },\n startPlaceholder: {\n type: String,\n },\n endPlaceholder: {\n type: String,\n },\n};\n\nexport const searchFormDatePickerEmits = {\n change: (...value: any[]) => !!value,\n};\nexport const SearchFormDatePickerName = 'GmSearchFormDatePicker';\n"],"names":[],"mappings":";;;;AAKO,MAAM,yBAA4B,GAAA;AAAA,EACvC,GAAG,qBAAA;AAAA,EACH,KAAO,EAAA;AAAA,IACL,IAAM,EAAA,MAAA;AAAA,IACN,OAAS,EAAA,EAAA;AAAA,GACX;AAAA,EACA,IAAM,EAAA;AAAA,IACJ,IAAM,EAAA,MAAA;AAAA,IACN,QAAU,EAAA,IAAA;AAAA,GACZ;AAAA,EACA,IAAM,EAAA;AAAA,IACJ,IAAM,EAAA,MAAA;AAAA,IACN,QAAU,EAAA,IAAA;AAAA,GACZ;AAAA,EACA,SAAW,EAAA;AAAA,IACT,IAAM,EAAA,KAAA;AAAA,GACR;AAAA,EACA,YAAA,EAAc,gBAAgB,cAAc,CAAA;AAAA,EAC5C,WAAA,EAAa,gBAAgB,aAAa,CAAA;AAAA,EAC1C,WAAa,EAAA;AAAA,IACX,IAAM,EAAA,MAAA;AAAA
|
|
1
|
+
{"version":3,"file":"searchFormDatePicker.mjs","sources":["../../../../../../../../../packages/components/src/composite/searchForm/searchFormItems/datePicker/searchFormDatePicker.ts"],"sourcesContent":["import { datePickerProps } from '@giime/components/src/base/datePicker';\nimport { searchFormCommonProps } from '../common';\nimport type { PropType } from 'vue';\nimport type { DatePickerProps } from '@giime/components/src/base/datePicker';\n\nexport const searchFormDatePickerProps = {\n ...searchFormCommonProps,\n label: {\n type: String,\n default: '',\n },\n prop: {\n type: String,\n required: true as const,\n },\n type: {\n type: String as PropType<DatePickerProps['type']>,\n required: true as const,\n },\n shortcuts: {\n type: Array as PropType<DatePickerProps['shortcuts']>,\n },\n defaultValue: datePickerProps['defaultValue'],\n defaultTime: datePickerProps['defaultTime'],\n valueFormat: {\n type: String as PropType<DatePickerProps['valueFormat']>,\n // default: 'YYYY-MM-DD',\n },\n startPlaceholder: {\n type: String,\n },\n endPlaceholder: {\n type: String,\n },\n};\n\nexport const searchFormDatePickerEmits = {\n change: (...value: any[]) => !!value,\n};\nexport const SearchFormDatePickerName = 'GmSearchFormDatePicker';\n"],"names":[],"mappings":";;;;AAKO,MAAM,yBAA4B,GAAA;AAAA,EACvC,GAAG,qBAAA;AAAA,EACH,KAAO,EAAA;AAAA,IACL,IAAM,EAAA,MAAA;AAAA,IACN,OAAS,EAAA,EAAA;AAAA,GACX;AAAA,EACA,IAAM,EAAA;AAAA,IACJ,IAAM,EAAA,MAAA;AAAA,IACN,QAAU,EAAA,IAAA;AAAA,GACZ;AAAA,EACA,IAAM,EAAA;AAAA,IACJ,IAAM,EAAA,MAAA;AAAA,IACN,QAAU,EAAA,IAAA;AAAA,GACZ;AAAA,EACA,SAAW,EAAA;AAAA,IACT,IAAM,EAAA,KAAA;AAAA,GACR;AAAA,EACA,YAAA,EAAc,gBAAgB,cAAc,CAAA;AAAA,EAC5C,WAAA,EAAa,gBAAgB,aAAa,CAAA;AAAA,EAC1C,WAAa,EAAA;AAAA,IACX,IAAM,EAAA,MAAA;AAAA;AAAA,GAER;AAAA,EACA,gBAAkB,EAAA;AAAA,IAChB,IAAM,EAAA,MAAA;AAAA,GACR;AAAA,EACA,cAAgB,EAAA;AAAA,IACd,IAAM,EAAA,MAAA;AAAA,GACR;AACF,EAAA;AAEO,MAAM,yBAA4B,GAAA;AAAA,EACvC,MAAQ,EAAA,CAAA,GAAI,KAAiB,KAAA,CAAC,CAAC,KAAA;AACjC,EAAA;AACO,MAAM,wBAA2B,GAAA;;;;"}
|
package/es/giime/index.mjs
CHANGED
|
@@ -16,7 +16,8 @@ export { giimeDevProxy } from '../utils/src/http/devProxy.mjs';
|
|
|
16
16
|
export { getDomain } from '../utils/src/http/url.mjs';
|
|
17
17
|
export { getModifiedData, hasOwn, keysOf, resetObject } from '../utils/src/objects.mjs';
|
|
18
18
|
export { getDateShortcuts } from '../utils/src/date/dateShortcuts.mjs';
|
|
19
|
-
export {
|
|
19
|
+
export { genFileId } from 'element-plus';
|
|
20
|
+
export { base64ToBlob, base64ToFile, blobToBase64, blobToFile, fileMd5, fileToBase64, fileToBlob, fileToUrl, fileValidType, getImageInfo, getVideoInfo, urlToBlob, urlToFile } from '../utils/src/file.mjs';
|
|
20
21
|
export { compareVersions, isVersionGreaterOrEqual, omitOnEvents, remove } from '../utils/src/general.mjs';
|
|
21
22
|
export { b64_hmac_md5, b64_md5, hex_hmac_md5, hex_md5, str_hmac_md5, str_md5, ts_md5_file } from '../utils/src/crypto/md5.mjs';
|
|
22
23
|
export { any_hmac_sha1, any_sha1, b64_hmac_sha1, b64_sha1, hex_hmac_sha1, hex_sha1 } from '../utils/src/crypto/sha1.mjs';
|
package/es/giime/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../../../packages/giime/index.ts"],"sourcesContent":["import installer from './defaults';\nimport './tailwind.css';\nexport * from '@giime/utils';\nexport * from '@giime/components';\nexport * from '@giime/hooks';\n// export * from '@giime/api'; // 用户通过giime/es/api 导入类型\nexport const install = installer.install;\nexport const version = installer.version;\nexport default installer;\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../../../packages/giime/index.ts"],"sourcesContent":["import installer from './defaults';\nimport './tailwind.css';\nexport * from '@giime/utils';\nexport * from '@giime/components';\nexport * from '@giime/hooks';\n// export * from '@giime/api'; // 用户通过giime/es/api 导入类型\nexport const install = installer.install;\nexport const version = installer.version;\nexport default installer;\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMO,MAAM,UAAU,SAAU,CAAA,QAAA;AAC1B,MAAM,UAAU,SAAU,CAAA;;;;"}
|
package/es/giime/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "0.6.
|
|
1
|
+
export declare const version = "0.6.37";
|
package/es/giime/version.mjs
CHANGED
package/es/giime/version.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.mjs","sources":["../../../../packages/giime/version.ts"],"sourcesContent":["export const version = '0.6.
|
|
1
|
+
{"version":3,"file":"version.mjs","sources":["../../../../packages/giime/version.ts"],"sourcesContent":["export const version = '0.6.36';\n"],"names":[],"mappings":"AAAO,MAAM,OAAU,GAAA;;;;"}
|
|
@@ -18,12 +18,15 @@ const useDownload = () => {
|
|
|
18
18
|
message: h("div", { className: curId }, [`\u5F53\u524D\u4E0B\u8F7D\u8FDB\u5EA6 0%`]),
|
|
19
19
|
duration: 0
|
|
20
20
|
});
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
21
|
+
try {
|
|
22
|
+
await createDownload({
|
|
23
|
+
url,
|
|
24
|
+
filename,
|
|
25
|
+
uuid: curId
|
|
26
|
+
});
|
|
27
|
+
} finally {
|
|
28
|
+
modalInfo.close();
|
|
29
|
+
}
|
|
27
30
|
};
|
|
28
31
|
const downloadByRes = async (res, options) => {
|
|
29
32
|
let contentDispositionName = (res?.headers?.["content-disposition"] || res?.headers?.["Content-Disposition"])?.split("filename=")[1];
|
|
@@ -41,12 +44,15 @@ const useDownload = () => {
|
|
|
41
44
|
});
|
|
42
45
|
const blob = new Blob([resBlob]);
|
|
43
46
|
const fileUrl = window.URL.createObjectURL(blob);
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
47
|
+
try {
|
|
48
|
+
await createDownload({
|
|
49
|
+
url: fileUrl,
|
|
50
|
+
filename,
|
|
51
|
+
uuid: curId
|
|
52
|
+
});
|
|
53
|
+
} finally {
|
|
54
|
+
modalInfo.close();
|
|
55
|
+
}
|
|
50
56
|
};
|
|
51
57
|
const downloadToZip = async (fileList, filename) => {
|
|
52
58
|
return new Promise((resolve, reject) => {
|
|
@@ -82,6 +88,9 @@ const useDownload = () => {
|
|
|
82
88
|
reject(error);
|
|
83
89
|
});
|
|
84
90
|
}
|
|
91
|
+
}).catch((error) => {
|
|
92
|
+
reject(error);
|
|
93
|
+
modalInfo.close();
|
|
85
94
|
});
|
|
86
95
|
}
|
|
87
96
|
});
|
|
@@ -113,6 +122,12 @@ const useDownload = () => {
|
|
|
113
122
|
});
|
|
114
123
|
}
|
|
115
124
|
resolve(blob);
|
|
125
|
+
} else if (eventTarget.status === 404) {
|
|
126
|
+
GmMessage.error("\u6587\u4EF6\u4E0D\u5B58\u5728\uFF0C\u6216\u5DF2\u88AB\u5220\u9664");
|
|
127
|
+
reject(e);
|
|
128
|
+
} else {
|
|
129
|
+
GmMessage.error("\u4E0B\u8F7D\u5F02\u5E38\uFF0C\u8BF7\u91CD\u8BD5\uFF01");
|
|
130
|
+
reject(e);
|
|
116
131
|
}
|
|
117
132
|
};
|
|
118
133
|
xhr.onerror = function(e) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../../../../../packages/hooks/base/useDownload/index.ts"],"sourcesContent":["import { h, ref } from 'vue';\nimport FileSaver from 'file-saver';\n\nimport GmNotification from '@giime/components/src/plugins/notification';\nimport { v4 as uuidv4 } from 'uuid';\nimport JSZip from 'jszip';\nimport { GmMessage } from '@giime/components/src/plugins/message';\nimport type { AxiosResponse } from 'axios';\n\nexport interface DownloadOptions {\n filename?: string;\n}\nexport interface DateownloadZipItem {\n url: string;\n filename?: string;\n}\n\nexport const useDownload = () => {\n const getUrlFilename = (url: string) => {\n const filename = url.split('/').pop()?.split('?')[0] || 'file';\n return filename;\n };\n /**\n * 通过url下载\n * @param url\n * @param options\n */\n const downloadByUrl = async (url: string, options?: DownloadOptions) => {\n const filename = options?.filename || getUrlFilename(url);\n const curId = uuidv4();\n const modalInfo = GmNotification({\n title: '下载中',\n message: h('div', { className: curId }, [`当前下载进度 0%`]),\n duration: 0,\n });\n await createDownload({\n url,\n filename,\n uuid: curId,\n });\n modalInfo.close();\n };\n /**\n * 通过接口响应结果下载\n * @param res\n * @param options\n */\n const downloadByRes = async (res: AxiosResponse<any, any>, options?: DownloadOptions) => {\n let contentDispositionName = (res?.headers?.['content-disposition'] || res?.headers?.['Content-Disposition'])?.split('filename=')[1];\n try {\n contentDispositionName = decodeURIComponent(contentDispositionName);\n } catch {}\n const filename = options?.filename || contentDispositionName || 'file';\n const resBlob = await res.data;\n const curId = uuidv4();\n const modalInfo = GmNotification({\n title: '下载中',\n message: h('div', { className: curId }, [`当前下载进度 0%`]),\n duration: 0,\n });\n // 设置type类型\n const blob = new Blob([resBlob]);\n const fileUrl = window.URL.createObjectURL(blob);\n await createDownload({\n url: fileUrl,\n filename,\n uuid: curId,\n });\n modalInfo.close();\n };\n /**\n * 下载多文件 转为zip\n * @param fileList\n * @param filename\n */\n const downloadToZip = async (fileList: DateownloadZipItem[], filename: string) => {\n return new Promise((resolve, reject) => {\n const currentContentClass = `message${Date.now()}`;\n const downloadCount = ref(0);\n const len = fileList.length;\n const modalInfo = GmNotification({\n title: '下载中',\n message: h('div', [h('div', { className: currentContentClass }, [`总下载文件数:${len},已下载文件数:${downloadCount.value}`])]),\n duration: 0,\n });\n // h('div', { className: currentClass }, [`当前下载进度 ${progress.value}%`]),\n const zipInstance = new JSZip();\n for (let i = 0; i < len; i++) {\n const currentItem = fileList[i];\n // const fileBlob = await\n const downblobOptions = {\n url: currentItem.url,\n filename: currentItem.filename ?? getUrlFilename(currentItem.url),\n isZip: true,\n };\n createDownload(downblobOptions).then(res => {\n zipInstance.file(downblobOptions.filename, res);\n downloadCount.value++;\n editElementContent(currentContentClass, `总下载文件数:${len},已下载文件数:${downloadCount.value}`);\n if (downloadCount.value == len) {\n editElementContent(currentContentClass, `正在合并...`);\n zipInstance\n .generateAsync({ type: 'blob' })\n .then(async res => {\n modalInfo.close();\n\n const fileUrl = window.URL.createObjectURL(res);\n // FileSaver.saveAs(res, filename);\n await downloadByUrl(fileUrl, { filename });\n resolve(true);\n })\n .catch(error => {\n console.error('error', error);\n reject(error);\n });\n }\n });\n }\n });\n };\n const createDownload = (options: { url: string; filename: string; uuid?: string; isZip?: boolean }) => {\n return new Promise<Blob>((resolve, reject) => {\n // 创建一个新的 XMLHttpRequest 对象\n const xhr = new XMLHttpRequest();\n // 初始化一个GET请求\n xhr.open('GET', options.url, true);\n xhr.responseType = 'blob'; // 设置响应类型为blob,以便处理二进制文件\n\n // 监听 progress 事件\n xhr.onprogress = function (event) {\n if (event.lengthComputable) {\n const percentComplete = Math.floor((event.loaded / event.total) * 100);\n if (options.uuid) {\n editElementContent(options.uuid, `当前下载进度 ${percentComplete}%`);\n }\n }\n };\n\n // 监听 load 事件,表示下载完成\n xhr.onload = function (e) {\n const eventTarget = e.target as XMLHttpRequest;\n if ([200, 304].includes(eventTarget.status)) {\n const blob = eventTarget.response;\n // const url = window.URL.createObjectURL(blob);\n if (!options.isZip) {\n FileSaver.saveAs(blob, options.filename);\n GmNotification({\n type: 'success',\n title: '温馨提示',\n message: '下载完成',\n duration: 3000,\n });\n }\n\n resolve(blob);\n }\n };\n\n // 监听 error 事件\n xhr.onerror = function (e) {\n GmMessage.error('下载异常,请重试');\n reject(e);\n };\n\n // 发送请求\n xhr.send();\n });\n };\n return { downloadByUrl, downloadByRes, downloadToZip };\n};\n\n// 动态更新 notify 中的message 信息\nconst editElementContent = (className: string, content: string) => {\n // eslint-disable-next-line unicorn/prefer-query-selector\n const currentEle = document.getElementsByClassName(className)[0];\n if (currentEle) {\n currentEle.innerHTML = content;\n }\n};\n"],"names":["uuidv4","res"],"mappings":";;;;;;;AAiBO,MAAM,cAAc,MAAM;AAC/B,EAAM,MAAA,cAAA,GAAiB,CAAC,GAAgB,KAAA;AACtC,IAAM,MAAA,QAAA,GAAW,GAAI,CAAA,KAAA,CAAM,GAAG,CAAA,CAAE,GAAI,EAAA,EAAG,KAAM,CAAA,GAAG,CAAE,CAAA,CAAC,CAAK,IAAA,MAAA,CAAA;AACxD,IAAO,OAAA,QAAA,CAAA;AAAA,GACT,CAAA;AAMA,EAAM,MAAA,aAAA,GAAgB,OAAO,GAAA,EAAa,OAA8B,KAAA;AACtE,IAAA,MAAM,QAAW,GAAA,OAAA,EAAS,QAAY,IAAA,cAAA,CAAe,GAAG,CAAA,CAAA;AACxD,IAAA,MAAM,QAAQA,EAAO,EAAA,CAAA;AACrB,IAAA,MAAM,YAAY,cAAe,CAAA;AAAA,MAC/B,KAAO,EAAA,oBAAA;AAAA,MACP,OAAA,EAAS,EAAE,KAAO,EAAA,EAAE,WAAW,KAAM,EAAA,EAAG,CAAC,CAAA,uCAAA,CAAW,CAAC,CAAA;AAAA,MACrD,QAAU,EAAA,CAAA;AAAA,KACX,CAAA,CAAA;AACD,IAAA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ACH,CAAA;AACA,EAAO,OAAA,EAAE,aAAe,EAAA,aAAA,EAAe,aAAc,EAAA,CAAA;AACvD,EAAA;AAGA,MAAM,kBAAA,GAAqB,CAAC,SAAA,EAAmB,OAAoB,KAAA;AAEjE,EAAA,MAAM,UAAa,GAAA,QAAA,CAAS,sBAAuB,CAAA,SAAS,EAAE,CAAC,CAAA,CAAA;AAC/D,EAAA,IAAI,UAAY,EAAA;AACd,IAAA,UAAA,CAAW,SAAY,GAAA,OAAA,CAAA;AAAA,GACzB;AACF,CAAA;;;;"}
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../../../../../packages/hooks/base/useDownload/index.ts"],"sourcesContent":["import { h, ref } from 'vue';\nimport FileSaver from 'file-saver';\n\nimport GmNotification from '@giime/components/src/plugins/notification';\nimport { v4 as uuidv4 } from 'uuid';\nimport JSZip from 'jszip';\nimport { GmMessage } from '@giime/components/src/plugins/message';\nimport type { AxiosResponse } from 'axios';\n\nexport interface DownloadOptions {\n filename?: string;\n}\nexport interface DateownloadZipItem {\n url: string;\n filename?: string;\n}\n\nexport const useDownload = () => {\n const getUrlFilename = (url: string) => {\n const filename = url.split('/').pop()?.split('?')[0] || 'file';\n return filename;\n };\n /**\n * 通过url下载\n * @param url\n * @param options\n */\n const downloadByUrl = async (url: string, options?: DownloadOptions) => {\n const filename = options?.filename || getUrlFilename(url);\n const curId = uuidv4();\n const modalInfo = GmNotification({\n title: '下载中',\n message: h('div', { className: curId }, [`当前下载进度 0%`]),\n duration: 0,\n });\n try {\n await createDownload({\n url,\n filename,\n uuid: curId,\n });\n } finally {\n modalInfo.close();\n }\n };\n /**\n * 通过接口响应结果下载\n * @param res\n * @param options\n */\n const downloadByRes = async (res: AxiosResponse<any, any>, options?: DownloadOptions) => {\n let contentDispositionName = (res?.headers?.['content-disposition'] || res?.headers?.['Content-Disposition'])?.split('filename=')[1];\n try {\n contentDispositionName = decodeURIComponent(contentDispositionName);\n } catch {}\n const filename = options?.filename || contentDispositionName || 'file';\n const resBlob = await res.data;\n const curId = uuidv4();\n const modalInfo = GmNotification({\n title: '下载中',\n message: h('div', { className: curId }, [`当前下载进度 0%`]),\n duration: 0,\n });\n // 设置type类型\n const blob = new Blob([resBlob]);\n const fileUrl = window.URL.createObjectURL(blob);\n try {\n await createDownload({\n url: fileUrl,\n filename,\n uuid: curId,\n });\n } finally {\n modalInfo.close();\n }\n };\n /**\n * 下载多文件 转为zip\n * @param fileList\n * @param filename\n */\n const downloadToZip = async (fileList: DateownloadZipItem[], filename: string) => {\n return new Promise((resolve, reject) => {\n const currentContentClass = `message${Date.now()}`;\n const downloadCount = ref(0);\n const len = fileList.length;\n const modalInfo = GmNotification({\n title: '下载中',\n message: h('div', [h('div', { className: currentContentClass }, [`总下载文件数:${len},已下载文件数:${downloadCount.value}`])]),\n duration: 0,\n });\n // h('div', { className: currentClass }, [`当前下载进度 ${progress.value}%`]),\n const zipInstance = new JSZip();\n for (let i = 0; i < len; i++) {\n const currentItem = fileList[i];\n // const fileBlob = await\n const downblobOptions = {\n url: currentItem.url,\n filename: currentItem.filename ?? getUrlFilename(currentItem.url),\n isZip: true,\n };\n createDownload(downblobOptions)\n .then(res => {\n zipInstance.file(downblobOptions.filename, res);\n downloadCount.value++;\n editElementContent(currentContentClass, `总下载文件数:${len},已下载文件数:${downloadCount.value}`);\n if (downloadCount.value == len) {\n editElementContent(currentContentClass, `正在合并...`);\n zipInstance\n .generateAsync({ type: 'blob' })\n .then(async res => {\n modalInfo.close();\n\n const fileUrl = window.URL.createObjectURL(res);\n // FileSaver.saveAs(res, filename);\n await downloadByUrl(fileUrl, { filename });\n resolve(true);\n })\n .catch(error => {\n console.error('error', error);\n reject(error);\n });\n }\n })\n .catch(error => {\n reject(error);\n modalInfo.close();\n });\n }\n });\n };\n const createDownload = (options: { url: string; filename: string; uuid?: string; isZip?: boolean }) => {\n return new Promise<Blob>((resolve, reject) => {\n // 创建一个新的 XMLHttpRequest 对象\n const xhr = new XMLHttpRequest();\n // 初始化一个GET请求\n xhr.open('GET', options.url, true);\n xhr.responseType = 'blob'; // 设置响应类型为blob,以便处理二进制文件\n\n // 监听 progress 事件\n xhr.onprogress = function (event) {\n if (event.lengthComputable) {\n const percentComplete = Math.floor((event.loaded / event.total) * 100);\n if (options.uuid) {\n editElementContent(options.uuid, `当前下载进度 ${percentComplete}%`);\n }\n }\n };\n\n // 监听 load 事件,表示下载完成\n xhr.onload = function (e) {\n const eventTarget = e.target as XMLHttpRequest;\n if ([200, 304].includes(eventTarget.status)) {\n const blob = eventTarget.response;\n // const url = window.URL.createObjectURL(blob);\n if (!options.isZip) {\n FileSaver.saveAs(blob, options.filename);\n GmNotification({\n type: 'success',\n title: '温馨提示',\n message: '下载完成',\n duration: 3000,\n });\n }\n\n resolve(blob);\n } else if (eventTarget.status === 404) {\n GmMessage.error('文件不存在,或已被删除');\n reject(e);\n } else {\n GmMessage.error('下载异常,请重试!');\n reject(e);\n }\n };\n\n // 监听 error 事件\n xhr.onerror = function (e) {\n GmMessage.error('下载异常,请重试');\n reject(e);\n };\n\n // 发送请求\n xhr.send();\n });\n };\n return { downloadByUrl, downloadByRes, downloadToZip };\n};\n\n// 动态更新 notify 中的message 信息\nconst editElementContent = (className: string, content: string) => {\n // eslint-disable-next-line unicorn/prefer-query-selector\n const currentEle = document.getElementsByClassName(className)[0];\n if (currentEle) {\n currentEle.innerHTML = content;\n }\n};\n"],"names":["uuidv4","res"],"mappings":";;;;;;;AAiBO,MAAM,cAAc,MAAM;AAC/B,EAAM,MAAA,cAAA,GAAiB,CAAC,GAAgB,KAAA;AACtC,IAAM,MAAA,QAAA,GAAW,GAAI,CAAA,KAAA,CAAM,GAAG,CAAA,CAAE,GAAI,EAAA,EAAG,KAAM,CAAA,GAAG,CAAE,CAAA,CAAC,CAAK,IAAA,MAAA,CAAA;AACxD,IAAO,OAAA,QAAA,CAAA;AAAA,GACT,CAAA;AAMA,EAAM,MAAA,aAAA,GAAgB,OAAO,GAAA,EAAa,OAA8B,KAAA;AACt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ploadRawFile, UploadRequestOptions } from 'element-plus';
|
|
1
2
|
export interface UseUploadFileOptions {
|
|
2
3
|
/**领域编码 */
|
|
3
4
|
domainCode?: string;
|
|
@@ -7,13 +8,19 @@ export interface UseUploadFileOptions {
|
|
|
7
8
|
accept?: string;
|
|
8
9
|
/**文件权限,默认继承桶 */
|
|
9
10
|
acl?: string;
|
|
11
|
+
/**是否禁止上传文件到存储桶 */
|
|
12
|
+
disablePutFile?: boolean;
|
|
13
|
+
/** */
|
|
14
|
+
elOptions?: UploadRequestOptions;
|
|
10
15
|
}
|
|
11
16
|
export declare const useUploadFile: () => {
|
|
12
17
|
isLoading: import("vue").Ref<boolean>;
|
|
13
|
-
uploadFile: (file:
|
|
18
|
+
uploadFile: (file: UploadRawFile, options?: UseUploadFileOptions) => Promise<{
|
|
14
19
|
url: string;
|
|
15
20
|
exists: boolean;
|
|
16
21
|
uploadUrl: string;
|
|
17
22
|
key: string;
|
|
18
23
|
}>;
|
|
24
|
+
cancelUpload: (fileUid: number) => void;
|
|
25
|
+
cancelAllUploads: () => void;
|
|
19
26
|
};
|