giime 0.8.11 → 0.8.13
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 +66 -65
- package/es/components/src/base/tableColumn/TableColumn.vue2.mjs +5 -5
- package/es/components/src/base/tableColumn/TableColumn.vue2.mjs.map +1 -1
- package/es/components/src/composite/tablePro/TableColumnVNodeRenderer.d.ts +4 -2
- package/es/components/src/composite/tablePro/TableColumnVNodeRenderer.mjs +44 -16
- package/es/components/src/composite/tablePro/TableColumnVNodeRenderer.mjs.map +1 -1
- package/es/components/src/composite/tablePro/TablePro.vue.mjs +1 -1
- package/es/components/src/composite/tablePro/TablePro.vue2.mjs +2 -2
- package/es/components/src/composite/tablePro/TablePro.vue2.mjs.map +1 -1
- package/es/components/src/composite/tablePro/tableColumnPro/TableColumnPro.vue2.mjs +5 -5
- package/es/components/src/composite/tablePro/tableColumnPro/TableColumnPro.vue2.mjs.map +1 -1
- package/es/components/src/composite/tablePro/tableHelper.d.ts +8 -1
- package/es/components/src/composite/tablePro/tableHelper.mjs +10 -1
- package/es/components/src/composite/tablePro/tableHelper.mjs.map +1 -1
- package/es/components/src/composite/uploadFile/UploadFile.vue.d.ts +4 -90
- package/es/components/src/composite/uploadFile/UploadFile.vue.mjs +1 -1
- package/es/components/src/composite/uploadFile/UploadFile.vue2.mjs +47 -41
- package/es/components/src/composite/uploadFile/UploadFile.vue2.mjs.map +1 -1
- package/es/components/src/composite/uploadFile/index.d.ts +4 -190
- package/es/components/src/composite/uploadFile/uploadFile.d.ts +1 -51
- package/es/components/src/composite/uploadFile/uploadFile.mjs +0 -50
- package/es/components/src/composite/uploadFile/uploadFile.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 +30 -6
- package/es/hooks/base/useDownload/index.mjs.map +1 -1
- package/es/index.css +66 -65
- package/lib/components/src/base/tableColumn/TableColumn.vue2.js +4 -4
- package/lib/components/src/base/tableColumn/TableColumn.vue2.js.map +1 -1
- package/lib/components/src/composite/tablePro/TableColumnVNodeRenderer.d.ts +4 -2
- package/lib/components/src/composite/tablePro/TableColumnVNodeRenderer.js +43 -15
- package/lib/components/src/composite/tablePro/TableColumnVNodeRenderer.js.map +1 -1
- package/lib/components/src/composite/tablePro/TablePro.vue.js +1 -1
- package/lib/components/src/composite/tablePro/TablePro.vue2.js +2 -2
- package/lib/components/src/composite/tablePro/TablePro.vue2.js.map +1 -1
- package/lib/components/src/composite/tablePro/tableColumnPro/TableColumnPro.vue2.js +4 -4
- package/lib/components/src/composite/tablePro/tableColumnPro/TableColumnPro.vue2.js.map +1 -1
- package/lib/components/src/composite/tablePro/tableHelper.d.ts +8 -1
- package/lib/components/src/composite/tablePro/tableHelper.js +10 -1
- package/lib/components/src/composite/tablePro/tableHelper.js.map +1 -1
- package/lib/components/src/composite/uploadFile/UploadFile.vue.d.ts +4 -90
- package/lib/components/src/composite/uploadFile/UploadFile.vue.js +1 -1
- package/lib/components/src/composite/uploadFile/UploadFile.vue2.js +47 -41
- package/lib/components/src/composite/uploadFile/UploadFile.vue2.js.map +1 -1
- package/lib/components/src/composite/uploadFile/index.d.ts +4 -190
- package/lib/components/src/composite/uploadFile/uploadFile.d.ts +1 -51
- package/lib/components/src/composite/uploadFile/uploadFile.js +0 -50
- package/lib/components/src/composite/uploadFile/uploadFile.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 +30 -6
- package/lib/hooks/base/useDownload/index.js.map +1 -1
- package/lib/index.css +66 -65
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableColumnVNodeRenderer.js","sources":["../../../../../../../packages/components/src/composite/tablePro/TableColumnVNodeRenderer.tsx"],"sourcesContent":["//
|
|
1
|
+
{"version":3,"file":"TableColumnVNodeRenderer.js","sources":["../../../../../../../packages/components/src/composite/tablePro/TableColumnVNodeRenderer.tsx"],"sourcesContent":["// TableColumnVNodeRenderer - 支持多级表头\nimport { computed, defineComponent, h, cloneVNode } from 'vue';\nimport type { TableColumnProProps } from './tableColumnPro/tableColumnPro';\nimport type { PropType, VNode } from 'vue';\n\nexport default defineComponent({\n functional: true,\n props: {\n // 当前原始vnode vue模板中的attribute\n vnode: {\n type: [Object, Array],\n required: true,\n },\n // 真实渲染的propsList\n propsList: {\n type: Array as PropType<TableColumnProProps[]>,\n default: () => [],\n },\n defaultPropsList: {\n type: Array as PropType<TableColumnProProps[]>,\n default: () => [],\n },\n },\n setup(props) {\n /** 合并propsList和defaultPropsList */\n const mergePropsList = computed(() => {\n return props.defaultPropsList.map(it => {\n const findProp = props.propsList.find(item => item.prop === it.prop);\n if (findProp) {\n return findProp;\n }\n return it;\n });\n });\n\n /**\n * 递归处理 vnode 树,应用 propsList 配置\n * @param vnode 要处理的 vnode\n * @returns 处理后的 vnode\n */\n const processVNode = (vnode: any): any => {\n if (!vnode) return null;\n\n // 如果是 GmTableColumnPro,查找并应用配置\n if (vnode.type?.name === 'GmTableColumnPro') {\n const propsConfig = mergePropsList.value.find(it => it.prop === vnode.props?.prop);\n\n // 如果配置中标记为不显示或类型是 edit,跳过渲染\n if (propsConfig && (!propsConfig.isShow || propsConfig.type === 'edit')) {\n return null;\n }\n\n // 应用配置到 vnode props\n if (propsConfig) {\n const newProps = {\n ...vnode.props,\n width: propsConfig.width,\n label: propsConfig.label,\n fixed: propsConfig.fixed,\n };\n return cloneVNode(vnode, newProps);\n }\n\n return vnode;\n }\n\n // 如果是其他组件(如 gm-table-column 用于多级表头),递归处理子节点\n if (vnode.children) {\n let newChildren = vnode.children;\n\n // 如果 children 是对象(包含 slots),递归处理 default slot\n if (typeof vnode.children === 'object' && vnode.children.default) {\n const originalDefault = vnode.children.default;\n newChildren = {\n ...vnode.children,\n default: (slotProps: any) => {\n const childVnodes = originalDefault(slotProps);\n if (Array.isArray(childVnodes)) {\n return childVnodes.map(processVNode).filter(Boolean);\n }\n return processVNode(childVnodes);\n },\n };\n }\n // 如果 children 是数组,递归处理每个子节点\n else if (Array.isArray(vnode.children)) {\n newChildren = vnode.children.map(processVNode).filter(Boolean);\n }\n\n return cloneVNode(vnode, vnode.props, newChildren);\n }\n\n return vnode;\n };\n\n const render = computed(() => {\n const vnodeArray = Array.isArray(props.vnode) ? props.vnode : [props.vnode];\n return vnodeArray\n .map(vnode => {\n const processed = processVNode(vnode);\n return processed ? h(processed) : null;\n })\n .filter(Boolean);\n });\n\n return () => render.value;\n },\n});\n"],"names":["functional","props","vnode","type","Object","Array","required","propsList","default","defaultPropsList","setup","mergePropsList","computed","map","it","findProp","find","item","prop","processVNode","name","propsConfig","value","isShow","newProps","width","label","fixed","cloneVNode","children","newChildren","originalDefault","slotProps","childVnodes","isArray","filter","Boolean","render","vnodeArray","processed","h"],"mappings":";;;;;;AAKA,mEAA+B;AAAA,EAC7BA,UAAAA,EAAY,IAAA;AAAA,EACZC,KAAAA,EAAO;AAAA;AAAA,IAELC,KAAAA,EAAO;AAAA,MACLC,IAAAA,EAAM,CAACC,MAAAA,EAAQC,KAAK,CAAA;AAAA,MACpBC,QAAAA,EAAU;AAAA,KACZ;AAAA;AAAA,IAEAC,SAAAA,EAAW;AAAA,MACTJ,IAAAA,EAAME,KAAAA;AAAAA,MACNG,OAAAA,EAASA,MAAM;AAAA,KACjB;AAAA,IACAC,gBAAAA,EAAkB;AAAA,MAChBN,IAAAA,EAAME,KAAAA;AAAAA,MACNG,OAAAA,EAASA,MAAM;AAAA;AACjB,GACF;AAAA,EACAE,MAAMT,KAAAA,EAAO;AAEX,IAAA,MAAMU,cAAAA,GAAiBC,aAAS,MAAM;AACpC,MAAA,OAAOX,KAAAA,CAAMQ,gBAAAA,CAAiBI,GAAAA,CAAIC,CAAAA,EAAAA,KAAM;AACtC,QAAA,MAAMC,QAAAA,GAAWd,MAAMM,SAAAA,CAA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pC,CAAC,CAAA,CACAJ,MAAAA,CAAOC,OAAO,CAAA;AAAA,IACnB,CAAC,CAAA;AAED,IAAA,OAAO,MAAMC,MAAAA,CAAOf,KAAAA;AAAAA,EACtB;AACF,CAAC,CAAA;;;;"}
|
|
@@ -6,7 +6,7 @@ var TablePro_vue_vue_type_script_setup_true_lang = require('./TablePro.vue2.js')
|
|
|
6
6
|
require('./TablePro.vue3.js');
|
|
7
7
|
var _pluginVue_exportHelper = require('../../../../_virtual/_plugin-vue_export-helper.js');
|
|
8
8
|
|
|
9
|
-
var TablePro = /* @__PURE__ */ _pluginVue_exportHelper.default(TablePro_vue_vue_type_script_setup_true_lang.default, [["__scopeId", "data-v-
|
|
9
|
+
var TablePro = /* @__PURE__ */ _pluginVue_exportHelper.default(TablePro_vue_vue_type_script_setup_true_lang.default, [["__scopeId", "data-v-050a4f74"]]);
|
|
10
10
|
|
|
11
11
|
exports.default = TablePro;
|
|
12
12
|
//# sourceMappingURL=TablePro.vue.js.map
|
|
@@ -15,7 +15,7 @@ var tablePro = require('./tablePro.js');
|
|
|
15
15
|
var tableHelper = require('./tableHelper.js');
|
|
16
16
|
var tableColumnPro = require('./tableColumnPro/tableColumnPro.js');
|
|
17
17
|
|
|
18
|
-
const _withScopeId = (n) => (vue.pushScopeId("data-v-
|
|
18
|
+
const _withScopeId = (n) => (vue.pushScopeId("data-v-050a4f74"), n = n(), vue.popScopeId(), n);
|
|
19
19
|
const _hoisted_1 = { class: "gm-text-center" };
|
|
20
20
|
const _hoisted_2 = {
|
|
21
21
|
key: 0,
|
|
@@ -56,7 +56,7 @@ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
56
56
|
});
|
|
57
57
|
const colDefaultPropsList = vue.computed(() => {
|
|
58
58
|
const vNodes = slots.default?.() || [];
|
|
59
|
-
const children = tableHelper.getVnodesByGmName(vNodes, tableColumnPro.TableColumnProName);
|
|
59
|
+
const children = tableHelper.getVnodesByGmName(vNodes, tableColumnPro.TableColumnProName, true);
|
|
60
60
|
const colProps = children.map((vNode) => vNode.props) ?? [];
|
|
61
61
|
colProps.forEach((it) => {
|
|
62
62
|
for (const key in tableColumnPro.tableColumnProProps) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TablePro.vue2.js","sources":["../../../../../../../packages/components/src/composite/tablePro/TablePro.vue"],"sourcesContent":["<template>\n <div ref=\"gmTableDivRef\">\n <gm-table\n v-if=\"gmTableHeaderRef?.isInited\"\n ref=\"GmTbaleRef\"\n v-bind=\"props\"\n :height=\"autoHeight ? tableMaxHeight : height\"\n border\n class=\"gmTablePro\"\n :class=\"[props.border ? '' : 'gmTableNoBorder']\"\n v-on=\"elEvents\"\n @selection-change=\"(value: TableColumnProProps[]) => $emit('selection-change', value)\"\n @sort-change=\"handleSortChange\"\n @header-dragend=\"headerDragend\"\n >\n <!-- <template #empty>\n <gm-empty image=\"https://thirdorder.giikin.com/third/20240601/3c5850781351121f81b9e21ec7e75a204898949.png\" />\n </template> -->\n <slot name=\"native\" />\n <template v-if=\"slots.append\" #append>\n <slot name=\"append\" />\n </template>\n <template v-if=\"slots.empty\" #empty>\n <slot name=\"empty\" />\n </template>\n <template v-if=\"props.selection\">\n <gm-table-column :key=\"999999\" type=\"selection\" width=\"55\" />\n </template>\n <TableColumnVNodeRenderer :vnode=\"tableColumnVnode\" :propsList=\"colPropsList\" :defaultPropsList=\"colDefaultPropsList\" />\n <!-- 操作 -->\n <gm-table-column\n v-if=\"customHeader || customOperate\"\n prop=\"gmEdit\"\n min-width=\"100\"\n :width=\"editProps?.width\"\n :fixed=\"operateFixed ? 'right' : false\"\n >\n <template #header>\n <div class=\"gm-text-center\">\n <gm-button v-if=\"customHeader\" type=\"primary\" link size=\"small\" @click=\"setTable('header')\"> 表头 </gm-button>\n <gm-button v-if=\"customOperate\" type=\"primary\" link size=\"small\" @click=\"setTable('operate')\"> 操作 </gm-button>\n </div>\n </template>\n <template #default=\"slotValue\">\n <!-- <div\n v-if=\"\n tableOperateVnode &&\n tableOperateVnode.children &&\n gmCustomOperationsRef &&\n gmCustomOperationsRef.isInited &&\n slotValue &&\n slotValue.row &&\n tableOperateVnode.children?.default(slotValue) &&\n customBtnPropsList\n \"\n >\n <TableProEditSlot\n v-model:customBtnPropsList=\"customBtnPropsList\"\n v-model:customDefaultPropsList=\"customDefaultPropsList\"\n :tableOperateVnode=\"tableOperateVnode\"\n :isInited=\"gmCustomOperationsRef?.isInited\"\n :slotValue=\"slotValue\"\n />\n </div> -->\n <div\n v-if=\"\n tableOperateVnode &&\n tableOperateVnode.children &&\n gmCustomOperationsRef &&\n gmCustomOperationsRef.isInited &&\n slotValue &&\n slotValue.row &&\n tableOperateVnode.children?.default(slotValue) &&\n customBtnPropsList\n \"\n class=\"gm-flex gm-flex-wrap gm-justify-center\"\n >\n <TableOperateVNodeRenderer :vnode=\"tableOperateVnode.children?.default(slotValue)\" :customPropsList=\"customBtnPropsList\" />\n </div>\n </template>\n </gm-table-column>\n </gm-table>\n </div>\n\n <gm-table-header-form\n ref=\"gmTableHeaderRef\"\n v-model:isShowDrawer=\"drawerHeaderVisible\"\n v-model:colPropsList=\"colPropsList\"\n :colDefaultPropsList=\"colDefaultPropsList\"\n :keyWord=\"props.page\"\n :disabledRemoteCol=\"props.disabledRemoteCol\"\n type=\"HeaderList\"\n @updateColumns=\"resetWidthOnHeaderDrag()\"\n />\n\n <gm-operate-button-form\n ref=\"gmCustomOperationsRef\"\n v-model:isShowDrawer=\"drawerOperateVisible\"\n v-model:customBtnPropsList=\"customBtnPropsList\"\n :customDefaultPropsList=\"customDefaultPropsList\"\n :keyWord=\"props.page\"\n :disabledRemoteBtn=\"props.disabledRemoteBtn\"\n type=\"OperateList\"\n />\n</template>\n\n<script setup lang=\"ts\">\nimport { computed, inject, nextTick, ref } from 'vue';\nimport { hasOwn } from '@giime/utils/src/objects';\nimport { getGmExports } from '@giime/utils/src/elementPlus/exports';\nimport { getGmEvent } from '@giime/utils/src/elementPlus/event';\nimport { TableCtxKey } from '@giime/constants/table';\nimport { useElementBounding, useWindowSize } from '@vueuse/core';\nimport { operateButtonProps } from '../operateButton/operateButton';\n// import TableProEditSlot from './TableProEditSlot.vue';\n// import { cloneDeep } from 'lodash-es';\nimport TableOperateVNodeRenderer from './TableOperateVNodeRenderer';\nimport TableColumnVNodeRenderer from './TableColumnVNodeRenderer';\nimport { tableProEmits, tableProProps } from './tablePro';\nimport { getVnodesByGmName } from './tableHelper';\nimport { TableColumnProName, type TableColumnProProps, tableColumnProProps } from './tableColumnPro/tableColumnPro';\nimport type { TableProSortValue } from './tablePro';\nimport type { OperateButtonFormInstance } from '../operateButton/operateButtonForm';\nimport type { TableHeaderFormInstance } from './tableHeaderForm';\nimport type { OperateButtonProps } from '../operateButton/operateButton';\nimport type { Sort, TableInstance } from 'element-plus';\n\ndefineOptions({\n name: 'GmTablePro',\n});\nconst tableCtx = inject(TableCtxKey);\nconst props = defineProps(tableProProps);\n\nconst gmTableDivRef = ref<HTMLDivElement>();\n// 用于计算table高度\nconst { top: divTop } = useElementBounding(gmTableDivRef);\nconst { height: windowHeight } = useWindowSize();\nconst tableMaxHeight = computed(() => Math.floor(windowHeight.value - divTop.value - 60 - props.heightOffset)); // 高度 - 顶部距离 - 分页器116 - 用户自定义需要减去的高度\nconst GmTbaleRef = ref<TableInstance>();\nif (tableCtx && tableCtx.tableId === props.page) {\n tableCtx.tableRef = GmTbaleRef;\n}\nconst gmCustomOperationsRef = ref<OperateButtonFormInstance>();\nconst gmTableHeaderRef = ref<TableHeaderFormInstance>();\n\nconst emit = defineEmits(tableProEmits);\n// 需要手动重新实现的事件\nconst notResendEvents = ['sort-change', 'header-dragend', 'selection-change'];\nconst resendEvent = { ...tableProEmits };\nnotResendEvents.forEach(it => Reflect.deleteProperty(resendEvent, it));\n// 重发el的事件\nconst elEvents = getGmEvent(resendEvent, emit);\nconst slots = defineSlots<{\n default(data?: any): any[];\n append?(data?: any): any[];\n empty?(data?: any): any[];\n native?(data?: any): any[];\n}>();\n// 列 当前原始vnode\nconst tableColumnVnode = computed(() => {\n const vNodes = slots.default?.() || [];\n // const nodes = vNodes.filter(vNode => vNode.props && vNode.props.type !== 'edit');\n return vNodes;\n});\n// 默认表头Props列表\nconst colDefaultPropsList = computed(() => {\n const vNodes = slots.default?.() || [];\n const children = getVnodesByGmName(vNodes, TableColumnProName);\n // const result = children.filter(vNode => vNode.props && vNode.props.type !== 'edit');\n\n const colProps: TableColumnProProps[] = children.map((vNode: { props: any }) => vNode.props) ?? [];\n // 循环插入props所需的默认值\n colProps.forEach(it => {\n for (const key in tableColumnProProps) {\n // 如果当前props含有默认值\n if (hasOwn(it, key)) {\n continue;\n }\n if (hasOwn(tableColumnProProps, key)) {\n const element = tableColumnProProps[key as keyof TableColumnProProps];\n // 如果btn 定义中含有默认值 则赋值给props\n if (hasOwn(element, 'default')) {\n Reflect.set(it, key, Reflect.get(element, 'default'));\n }\n }\n }\n });\n return colProps;\n});\n// 已选中表头\nconst colPropsList = ref<TableColumnProProps[]>(colDefaultPropsList.value);\nconst editProps = computed(() => colPropsList.value.find(it => it.type === 'edit'));\n\n// 操作按钮组 当前原始vnode\nconst tableOperateVnode = computed(() => {\n const vNodes = slots.default?.() || [];\n const nodes = vNodes.find(vNode => vNode.props && vNode.props.type === 'edit');\n return nodes;\n});\n\nconst customDefaultPropsList = computed(() => {\n const defaultVnodes = tableOperateVnode.value?.children?.default?.({ row: {} });\n if (Array.isArray(defaultVnodes) && defaultVnodes.some(it => it?.children === 'v-if')) {\n console.error(`警告:为确保表格操作按钮能正常渲染,请把表格${props.page}操作按钮中使用的\"v-if\"替换为\"v-see\"`);\n }\n const children = getVnodesByGmName(defaultVnodes, 'GmOperateButton');\n const btnProps: OperateButtonProps[] = children.map((vNode: { props: any }) => vNode.props) ?? [];\n // console.log(btnProps);\n // 循环插入props所需的默认值\n btnProps.forEach(it => {\n for (const key in operateButtonProps) {\n // 如果当前props含有默认值\n if (hasOwn(it, key)) {\n continue;\n }\n if (hasOwn(operateButtonProps, key)) {\n const element = operateButtonProps[key as keyof OperateButtonProps];\n // 如果btn 定义中含有默认值 则赋值给props\n if (hasOwn(element, 'default')) {\n Reflect.set(it, key, Reflect.get(element, 'default'));\n }\n }\n }\n });\n // console.log(btnProps)\n return btnProps;\n});\n// customDefaultPropsList2();\n// const customDefaultPropsList = ref<OperateButtonProps[]>([]);\nconst customBtnPropsList = ref<OperateButtonProps[]>(customDefaultPropsList.value);\n\n// 表格头部弹层\nconst drawerHeaderVisible = ref(false); // 表头设置弹层\nconst drawerOperateVisible = ref(false); // 按钮设置弹层\nconst setTable = (event: string) => {\n if (event === 'header') {\n drawerHeaderVisible.value = true;\n }\n if (event === 'operate') {\n drawerOperateVisible.value = true;\n }\n};\n\n/**\n * 表头拖动,修改width\n */\nconst headerDragend = async (newWidth: number, oldWidth: number, column: any) => {\n const findItem = colPropsList.value.find(it => it.prop === column.property);\n const editItem = column.property === 'gmEdit' ? colPropsList.value.find(it => it.type === 'edit') : null;\n if (!findItem && !editItem) {\n return;\n }\n if (findItem) {\n findItem.width = newWidth;\n }\n if (editItem) {\n editItem.width = newWidth;\n }\n // 设置列宽\n await nextTick();\n resetWidthOnHeaderDrag(column);\n gmTableHeaderRef.value?.syncPropsList();\n gmTableHeaderRef.value?.submitSettings({ hiddenMessage: true });\n};\n/**\n * 当表头拖动后,重新计算补充列宽度\n * 当全部列都设置了宽度,把设置过minWidth的列设置为补充列,补充表格剩余宽度\n */\nconst resetWidthOnHeaderDrag = (column?: any) => {\n if (props.disabledResetWidth) {\n return;\n }\n // 当全部列都设置了宽度 才执行后续步骤\n if (colPropsList.value.some(it => it.isShow && !it.width)) {\n return;\n }\n const minWidthCols = colPropsList.value.filter(\n // 是在展示中的列,并且不是操作列,并且设置了最小宽度\n it => it.isShow === true && it.type !== 'edit' && it.prop !== 'edit' && ((it as any)['min-width'] || it.minWidth),\n );\n for (const item of minWidthCols) {\n // 只有一个minWidth时, 也需要设置width = ''\n if (column?.property === item.prop && minWidthCols.length !== 1) {\n continue;\n }\n item.width = '';\n }\n};\n/**\n * 搜索模块\n */\nconst sortValue = defineModel<TableProSortValue[]>('sortValue');\n\nconst handleSortChange = (sort: Sort) => {\n if (sortValue.value) {\n sortValue.value.length = 0;\n switch (sort.order) {\n case 'ascending':\n sortValue.value.push({ field: sort.prop, order: 'asc' });\n break;\n case 'descending':\n sortValue.value.push({ field: sort.prop, order: 'desc' });\n break;\n }\n }\n\n emit('sort-change', sort);\n};\nconst exposeEvents = [\n 'clearSelection',\n 'getSelectionRows',\n 'toggleRowSelection',\n 'toggleAllSelection',\n 'toggleRowExpansion',\n 'setCurrentRow',\n 'setChecked',\n 'clearSort',\n 'clearFilter',\n 'doLayout',\n 'sort',\n 'scrollTo',\n 'setScrollTop',\n 'setScrollLeft',\n] as const;\nconst { exposeFns } = getGmExports(GmTbaleRef, exposeEvents);\ndefineExpose({\n colPropsList,\n ...exposeFns,\n});\n</script>\n\n<style lang=\"scss\" scoped>\n:deep(.gmTableNoBorder .el-table__body .el-table__cell) {\n border-right: none;\n}\n:deep(.gmTableNoBorder .el-table__inner-wrapper:before) {\n height: 0;\n}\n:deep(.gmTableNoBorder.el-table--border .el-table__inner-wrapper:after) {\n height: 0;\n}\n:deep(.gmTableNoBorder.el-table--border:after) {\n height: 0;\n}\n:deep(.gmTableNoBorder.el-table--border:before) {\n height: 0;\n}\n:deep(.gmTableNoBorder .el-table__border-left-patch) {\n height: 0;\n}\n</style>\n"],"names":["inject","TableCtxKey","ref","useElementBounding","useWindowSize","computed","tableProEmits","getGmEvent","_useSlots","getVnodesByGmName","TableColumnProName","tableColumnProProps","hasOwn","operateButtonProps","nextTick","_useModel","getGmExports"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkIA,IAAA,MAAM,QAAA,GAAWA,WAAOC,iBAAW,CAAA;AACnC,IAAA,MAAM,KAAA,GAAQ,OAAA;AAEd,IAAA,MAAM,gBAAgBC,OAAA,EAAoB;AAE1C,IAAA,MAA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IAAA,MAAM,YAAA,GAAe;AAAA,MACnB,gBAAA;AAAA,MACA,kBAAA;AAAA,MACA,oBAAA;AAAA,MACA,oBAAA;AAAA,MACA,oBAAA;AAAA,MACA,eAAA;AAAA,MACA,YAAA;AAAA,MACA,WAAA;AAAA,MACA,aAAA;AAAA,MACA,UAAA;AAAA,MACA,MAAA;AAAA,MACA,UAAA;AAAA,MACA,cAAA;AAAA,MACA;AAAA,KACF;AACA,IAAA,MAAM,EAAE,SAAA,EAAU,GAAIC,sBAAA,CAAa,YAAY,YAAY,CAAA;AAC3D,IAAA,QAAA,CAAa;AAAA,MACX,YAAA;AAAA,MACA,GAAG;AAAA,KACJ,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"TablePro.vue2.js","sources":["../../../../../../../packages/components/src/composite/tablePro/TablePro.vue"],"sourcesContent":["<template>\n <div ref=\"gmTableDivRef\">\n <gm-table\n v-if=\"gmTableHeaderRef?.isInited\"\n ref=\"GmTbaleRef\"\n v-bind=\"props\"\n :height=\"autoHeight ? tableMaxHeight : height\"\n border\n class=\"gmTablePro\"\n :class=\"[props.border ? '' : 'gmTableNoBorder']\"\n v-on=\"elEvents\"\n @selection-change=\"(value: TableColumnProProps[]) => $emit('selection-change', value)\"\n @sort-change=\"handleSortChange\"\n @header-dragend=\"headerDragend\"\n >\n <!-- <template #empty>\n <gm-empty image=\"https://thirdorder.giikin.com/third/20240601/3c5850781351121f81b9e21ec7e75a204898949.png\" />\n </template> -->\n <slot name=\"native\" />\n <template v-if=\"slots.append\" #append>\n <slot name=\"append\" />\n </template>\n <template v-if=\"slots.empty\" #empty>\n <slot name=\"empty\" />\n </template>\n <template v-if=\"props.selection\">\n <gm-table-column :key=\"999999\" type=\"selection\" width=\"55\" />\n </template>\n <TableColumnVNodeRenderer :vnode=\"tableColumnVnode\" :propsList=\"colPropsList\" :defaultPropsList=\"colDefaultPropsList\" />\n <!-- 操作 -->\n <gm-table-column\n v-if=\"customHeader || customOperate\"\n prop=\"gmEdit\"\n min-width=\"100\"\n :width=\"editProps?.width\"\n :fixed=\"operateFixed ? 'right' : false\"\n >\n <template #header>\n <div class=\"gm-text-center\">\n <gm-button v-if=\"customHeader\" type=\"primary\" link size=\"small\" @click=\"setTable('header')\"> 表头 </gm-button>\n <gm-button v-if=\"customOperate\" type=\"primary\" link size=\"small\" @click=\"setTable('operate')\"> 操作 </gm-button>\n </div>\n </template>\n <template #default=\"slotValue\">\n <!-- <div\n v-if=\"\n tableOperateVnode &&\n tableOperateVnode.children &&\n gmCustomOperationsRef &&\n gmCustomOperationsRef.isInited &&\n slotValue &&\n slotValue.row &&\n tableOperateVnode.children?.default(slotValue) &&\n customBtnPropsList\n \"\n >\n <TableProEditSlot\n v-model:customBtnPropsList=\"customBtnPropsList\"\n v-model:customDefaultPropsList=\"customDefaultPropsList\"\n :tableOperateVnode=\"tableOperateVnode\"\n :isInited=\"gmCustomOperationsRef?.isInited\"\n :slotValue=\"slotValue\"\n />\n </div> -->\n <div\n v-if=\"\n tableOperateVnode &&\n tableOperateVnode.children &&\n gmCustomOperationsRef &&\n gmCustomOperationsRef.isInited &&\n slotValue &&\n slotValue.row &&\n tableOperateVnode.children?.default(slotValue) &&\n customBtnPropsList\n \"\n class=\"gm-flex gm-flex-wrap gm-justify-center\"\n >\n <TableOperateVNodeRenderer :vnode=\"tableOperateVnode.children?.default(slotValue)\" :customPropsList=\"customBtnPropsList\" />\n </div>\n </template>\n </gm-table-column>\n </gm-table>\n </div>\n\n <gm-table-header-form\n ref=\"gmTableHeaderRef\"\n v-model:isShowDrawer=\"drawerHeaderVisible\"\n v-model:colPropsList=\"colPropsList\"\n :colDefaultPropsList=\"colDefaultPropsList\"\n :keyWord=\"props.page\"\n :disabledRemoteCol=\"props.disabledRemoteCol\"\n type=\"HeaderList\"\n @updateColumns=\"resetWidthOnHeaderDrag()\"\n />\n\n <gm-operate-button-form\n ref=\"gmCustomOperationsRef\"\n v-model:isShowDrawer=\"drawerOperateVisible\"\n v-model:customBtnPropsList=\"customBtnPropsList\"\n :customDefaultPropsList=\"customDefaultPropsList\"\n :keyWord=\"props.page\"\n :disabledRemoteBtn=\"props.disabledRemoteBtn\"\n type=\"OperateList\"\n />\n</template>\n\n<script setup lang=\"ts\">\nimport { computed, inject, nextTick, ref } from 'vue';\nimport { hasOwn } from '@giime/utils/src/objects';\nimport { getGmExports } from '@giime/utils/src/elementPlus/exports';\nimport { getGmEvent } from '@giime/utils/src/elementPlus/event';\nimport { TableCtxKey } from '@giime/constants/table';\nimport { useElementBounding, useWindowSize } from '@vueuse/core';\nimport { operateButtonProps } from '../operateButton/operateButton';\n// import TableProEditSlot from './TableProEditSlot.vue';\n// import { cloneDeep } from 'lodash-es';\nimport TableOperateVNodeRenderer from './TableOperateVNodeRenderer';\nimport TableColumnVNodeRenderer from './TableColumnVNodeRenderer';\nimport { tableProEmits, tableProProps } from './tablePro';\nimport { getVnodesByGmName } from './tableHelper';\nimport { TableColumnProName, type TableColumnProProps, tableColumnProProps } from './tableColumnPro/tableColumnPro';\nimport type { TableProSortValue } from './tablePro';\nimport type { OperateButtonFormInstance } from '../operateButton/operateButtonForm';\nimport type { TableHeaderFormInstance } from './tableHeaderForm';\nimport type { OperateButtonProps } from '../operateButton/operateButton';\nimport type { Sort, TableInstance } from 'element-plus';\n\ndefineOptions({\n name: 'GmTablePro',\n});\nconst tableCtx = inject(TableCtxKey);\nconst props = defineProps(tableProProps);\n\nconst gmTableDivRef = ref<HTMLDivElement>();\n// 用于计算table高度\nconst { top: divTop } = useElementBounding(gmTableDivRef);\nconst { height: windowHeight } = useWindowSize();\nconst tableMaxHeight = computed(() => Math.floor(windowHeight.value - divTop.value - 60 - props.heightOffset)); // 高度 - 顶部距离 - 分页器116 - 用户自定义需要减去的高度\nconst GmTbaleRef = ref<TableInstance>();\nif (tableCtx && tableCtx.tableId === props.page) {\n tableCtx.tableRef = GmTbaleRef;\n}\nconst gmCustomOperationsRef = ref<OperateButtonFormInstance>();\nconst gmTableHeaderRef = ref<TableHeaderFormInstance>();\n\nconst emit = defineEmits(tableProEmits);\n// 需要手动重新实现的事件\nconst notResendEvents = ['sort-change', 'header-dragend', 'selection-change'];\nconst resendEvent = { ...tableProEmits };\nnotResendEvents.forEach(it => Reflect.deleteProperty(resendEvent, it));\n// 重发el的事件\nconst elEvents = getGmEvent(resendEvent, emit);\nconst slots = defineSlots<{\n default(data?: any): any[];\n append?(data?: any): any[];\n empty?(data?: any): any[];\n native?(data?: any): any[];\n}>();\n// 列 当前原始vnode\nconst tableColumnVnode = computed(() => {\n const vNodes = slots.default?.() || [];\n // const nodes = vNodes.filter(vNode => vNode.props && vNode.props.type !== 'edit');\n return vNodes;\n});\n// 默认表头Props列表(递归提取所有 GmTableColumnPro,包括嵌套的)\nconst colDefaultPropsList = computed(() => {\n const vNodes = slots.default?.() || [];\n const children = getVnodesByGmName(vNodes, TableColumnProName, true); // 启用递归提取\n // const result = children.filter(vNode => vNode.props && vNode.props.type !== 'edit');\n\n const colProps: TableColumnProProps[] = children.map((vNode: { props: any }) => vNode.props) ?? [];\n // 循环插入props所需的默认值\n colProps.forEach(it => {\n for (const key in tableColumnProProps) {\n // 如果当前props含有默认值\n if (hasOwn(it, key)) {\n continue;\n }\n if (hasOwn(tableColumnProProps, key)) {\n const element = tableColumnProProps[key as keyof TableColumnProProps];\n // 如果btn 定义中含有默认值 则赋值给props\n if (hasOwn(element, 'default')) {\n Reflect.set(it, key, Reflect.get(element, 'default'));\n }\n }\n }\n });\n return colProps;\n});\n// 已选中表头\nconst colPropsList = ref<TableColumnProProps[]>(colDefaultPropsList.value);\nconst editProps = computed(() => colPropsList.value.find(it => it.type === 'edit'));\n\n// 操作按钮组 当前原始vnode\nconst tableOperateVnode = computed(() => {\n const vNodes = slots.default?.() || [];\n const nodes = vNodes.find(vNode => vNode.props && vNode.props.type === 'edit');\n return nodes;\n});\n\nconst customDefaultPropsList = computed(() => {\n const defaultVnodes = tableOperateVnode.value?.children?.default?.({ row: {} });\n if (Array.isArray(defaultVnodes) && defaultVnodes.some(it => it?.children === 'v-if')) {\n console.error(`警告:为确保表格操作按钮能正常渲染,请把表格${props.page}操作按钮中使用的\"v-if\"替换为\"v-see\"`);\n }\n const children = getVnodesByGmName(defaultVnodes, 'GmOperateButton');\n const btnProps: OperateButtonProps[] = children.map((vNode: { props: any }) => vNode.props) ?? [];\n // console.log(btnProps);\n // 循环插入props所需的默认值\n btnProps.forEach(it => {\n for (const key in operateButtonProps) {\n // 如果当前props含有默认值\n if (hasOwn(it, key)) {\n continue;\n }\n if (hasOwn(operateButtonProps, key)) {\n const element = operateButtonProps[key as keyof OperateButtonProps];\n // 如果btn 定义中含有默认值 则赋值给props\n if (hasOwn(element, 'default')) {\n Reflect.set(it, key, Reflect.get(element, 'default'));\n }\n }\n }\n });\n // console.log(btnProps)\n return btnProps;\n});\n// customDefaultPropsList2();\n// const customDefaultPropsList = ref<OperateButtonProps[]>([]);\nconst customBtnPropsList = ref<OperateButtonProps[]>(customDefaultPropsList.value);\n\n// 表格头部弹层\nconst drawerHeaderVisible = ref(false); // 表头设置弹层\nconst drawerOperateVisible = ref(false); // 按钮设置弹层\nconst setTable = (event: string) => {\n if (event === 'header') {\n drawerHeaderVisible.value = true;\n }\n if (event === 'operate') {\n drawerOperateVisible.value = true;\n }\n};\n\n/**\n * 表头拖动,修改width\n */\nconst headerDragend = async (newWidth: number, oldWidth: number, column: any) => {\n const findItem = colPropsList.value.find(it => it.prop === column.property);\n const editItem = column.property === 'gmEdit' ? colPropsList.value.find(it => it.type === 'edit') : null;\n if (!findItem && !editItem) {\n return;\n }\n if (findItem) {\n findItem.width = newWidth;\n }\n if (editItem) {\n editItem.width = newWidth;\n }\n // 设置列宽\n await nextTick();\n resetWidthOnHeaderDrag(column);\n gmTableHeaderRef.value?.syncPropsList();\n gmTableHeaderRef.value?.submitSettings({ hiddenMessage: true });\n};\n/**\n * 当表头拖动后,重新计算补充列宽度\n * 当全部列都设置了宽度,把设置过minWidth的列设置为补充列,补充表格剩余宽度\n */\nconst resetWidthOnHeaderDrag = (column?: any) => {\n if (props.disabledResetWidth) {\n return;\n }\n // 当全部列都设置了宽度 才执行后续步骤\n if (colPropsList.value.some(it => it.isShow && !it.width)) {\n return;\n }\n const minWidthCols = colPropsList.value.filter(\n // 是在展示中的列,并且不是操作列,并且设置了最小宽度\n it => it.isShow === true && it.type !== 'edit' && it.prop !== 'edit' && ((it as any)['min-width'] || it.minWidth),\n );\n for (const item of minWidthCols) {\n // 只有一个minWidth时, 也需要设置width = ''\n if (column?.property === item.prop && minWidthCols.length !== 1) {\n continue;\n }\n item.width = '';\n }\n};\n/**\n * 搜索模块\n */\nconst sortValue = defineModel<TableProSortValue[]>('sortValue');\n\nconst handleSortChange = (sort: Sort) => {\n if (sortValue.value) {\n sortValue.value.length = 0;\n switch (sort.order) {\n case 'ascending':\n sortValue.value.push({ field: sort.prop, order: 'asc' });\n break;\n case 'descending':\n sortValue.value.push({ field: sort.prop, order: 'desc' });\n break;\n }\n }\n\n emit('sort-change', sort);\n};\nconst exposeEvents = [\n 'clearSelection',\n 'getSelectionRows',\n 'toggleRowSelection',\n 'toggleAllSelection',\n 'toggleRowExpansion',\n 'setCurrentRow',\n 'setChecked',\n 'clearSort',\n 'clearFilter',\n 'doLayout',\n 'sort',\n 'scrollTo',\n 'setScrollTop',\n 'setScrollLeft',\n] as const;\nconst { exposeFns } = getGmExports(GmTbaleRef, exposeEvents);\ndefineExpose({\n colPropsList,\n ...exposeFns,\n});\n</script>\n\n<style lang=\"scss\" scoped>\n:deep(.gmTableNoBorder .el-table__body .el-table__cell) {\n border-right: none;\n}\n:deep(.gmTableNoBorder .el-table__inner-wrapper:before) {\n height: 0;\n}\n:deep(.gmTableNoBorder.el-table--border .el-table__inner-wrapper:after) {\n height: 0;\n}\n:deep(.gmTableNoBorder.el-table--border:after) {\n height: 0;\n}\n:deep(.gmTableNoBorder.el-table--border:before) {\n height: 0;\n}\n:deep(.gmTableNoBorder .el-table__border-left-patch) {\n height: 0;\n}\n</style>\n"],"names":["inject","TableCtxKey","ref","useElementBounding","useWindowSize","computed","tableProEmits","getGmEvent","_useSlots","getVnodesByGmName","TableColumnProName","tableColumnProProps","hasOwn","operateButtonProps","nextTick","_useModel","getGmExports"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkIA,IAAA,MAAM,QAAA,GAAWA,WAAOC,iBAAW,CAAA;AACnC,IAAA,MAAM,KAAA,GAAQ,OAAA;AAEd,IAAA,MAAM,gBAAgBC,OAAA,EAAoB;AAE1C,IAAA,MAAM,EAAE,GAAA,EAAK,MAAA,EAAO,GAAIC,wBAAmB,aAAa,CAAA;AACxD,IAAA,MAAM,EAAE,MAAA,EAAQ,YAAA,EAAa,GAAIC,kBAAA,EAAc;AAC/C,IAAA,MAAM,cAAA,GAAiBC,YAAA,CAAS,MAAM,IAAA,CAAK,KAAA,CAAM,YAAA,CAAa,KAAA,GAAQ,MAAA,CAAO,KAAA,GAAQ,EAAA,GAAK,KAAA,CAAM,YAAY,CAAC,CAAA;AAC7G,IAAA,MAAM,aAAaH,OAAA,EAAmB;AACtC,IAAA,IAAI,QAAA,IAAY,QAAA,CAAS,OAAA,KAAY,KAAA,CAAM,IAAA,EAAM;AAC/C,MAAA,QAAA,CAAS,QAAA,GAAW,UAAA;AAAA,IACtB;AACA,IAAA,MAAM,wBAAwBA,OAAA,EAA+B;AAC7D,IAAA,MAAM,mBAAmBA,OAAA,EAA6B;AAEtD,IAAA,MAAM,IAAA,GAAO,MAAA;AAEb,IAAA,MAAM,eAAA,GAAkB,CAAC,aAAA,EAAe,gBAAA,EAAkB,kBAAkB,CAAA;AAC5E,IAAA,MAAM,WAAA,GAAc,EAAE,GAAGI,sBAAA,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? {
|
|
25
25
|
name: "default",
|
|
26
|
-
fn: vue.withCtx((
|
|
27
|
-
|
|
26
|
+
fn: vue.withCtx((scope) => [
|
|
27
|
+
vue.renderSlot(_ctx.$slots, "default", vue.normalizeProps(vue.guardReactiveProps(scope)))
|
|
28
28
|
]),
|
|
29
29
|
key: "0"
|
|
30
30
|
} : void 0,
|
|
31
31
|
vue.unref(slots).header ? {
|
|
32
32
|
name: "header",
|
|
33
|
-
fn: vue.withCtx((
|
|
34
|
-
vue.renderSlot(_ctx.$slots, "header", vue.normalizeProps(vue.guardReactiveProps(
|
|
33
|
+
fn: vue.withCtx((scope) => [
|
|
34
|
+
vue.renderSlot(_ctx.$slots, "header", vue.normalizeProps(vue.guardReactiveProps(scope)))
|
|
35
35
|
]),
|
|
36
36
|
key: "1"
|
|
37
37
|
} : void 0
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableColumnPro.vue2.js","sources":["../../../../../../../../packages/components/src/composite/tablePro/tableColumnPro/TableColumnPro.vue"],"sourcesContent":["<template>\n <gm-table-column v-bind=\"props\" :sortable=\"proSortable\">\n <template v-if=\"slots.default\" #default=\"
|
|
1
|
+
{"version":3,"file":"TableColumnPro.vue2.js","sources":["../../../../../../../../packages/components/src/composite/tablePro/tableColumnPro/TableColumnPro.vue"],"sourcesContent":["<template>\n <gm-table-column v-bind=\"props\" :sortable=\"proSortable\">\n <!-- 完全透传,与 gm-table-column 保持一致 -->\n <template v-if=\"slots.default\" #default=\"scope\">\n <slot v-bind=\"scope\" />\n </template>\n\n <template v-if=\"slots.header\" #header=\"scope\">\n <slot name=\"header\" v-bind=\"scope\" />\n </template>\n </gm-table-column>\n</template>\n<script lang=\"ts\" setup>\nimport { computed, useSlots } from 'vue';\nimport { TableColumnProName, tableColumnProProps } from './tableColumnPro';\n\ndefineOptions({\n name: TableColumnProName,\n});\nconst slots = useSlots();\nconst props = defineProps(tableColumnProProps);\nconst proSortable = computed(() => (props.isSort ? 'custom' : props.sortable));\n</script>\n"],"names":["useSlots","computed"],"mappings":";;;;;;;;;;;;;;AAmBA,IAAA,MAAM,QAAQA,YAAA,EAAS;AACvB,IAAA,MAAM,KAAA,GAAQ,OAAA;AACd,IAAA,MAAM,cAAcC,YAAA,CAAS,MAAO,MAAM,MAAA,GAAS,QAAA,GAAW,MAAM,QAAS,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* 从 vnode 数组中提取指定名称的组件
|
|
3
|
+
* @param defaultVnodes vnode 数组
|
|
4
|
+
* @param name 目标组件名称
|
|
5
|
+
* @param recursive 是否递归提取嵌套组件(用于支持多级表头)
|
|
6
|
+
* @returns 提取的 vnode 数组
|
|
7
|
+
*/
|
|
8
|
+
export declare const getVnodesByGmName: (defaultVnodes: any[], name: string, recursive?: boolean) => any[];
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
var vue = require('vue');
|
|
4
4
|
var is = require('../../../../utils/src/is.js');
|
|
5
5
|
|
|
6
|
-
const getVnodesByGmName = (defaultVnodes, name) => {
|
|
6
|
+
const getVnodesByGmName = (defaultVnodes, name, recursive = false) => {
|
|
7
7
|
const children = [];
|
|
8
8
|
if (Array.isArray(defaultVnodes)) {
|
|
9
9
|
for (const childNode of defaultVnodes) {
|
|
@@ -15,6 +15,15 @@ const getVnodesByGmName = (defaultVnodes, name) => {
|
|
|
15
15
|
children.push(vnode);
|
|
16
16
|
}
|
|
17
17
|
});
|
|
18
|
+
} else if (recursive && childNode.children) {
|
|
19
|
+
if (typeof childNode.children === "object" && childNode.children.default) {
|
|
20
|
+
const nestedVnodes = childNode.children.default();
|
|
21
|
+
const nestedChildren = getVnodesByGmName(Array.isArray(nestedVnodes) ? nestedVnodes : [nestedVnodes], name, true);
|
|
22
|
+
children.push(...nestedChildren);
|
|
23
|
+
} else if (Array.isArray(childNode.children)) {
|
|
24
|
+
const nestedChildren = getVnodesByGmName(childNode.children, name, true);
|
|
25
|
+
children.push(...nestedChildren);
|
|
26
|
+
}
|
|
18
27
|
}
|
|
19
28
|
}
|
|
20
29
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tableHelper.js","sources":["../../../../../../../packages/components/src/composite/tablePro/tableHelper.ts"],"sourcesContent":["import { Fragment } from 'vue';\nimport { isString } from '@giime/utils/src/is';\nexport const getVnodesByGmName = (defaultVnodes: any[], name: string) => {\n const children = [];\n if (Array.isArray(defaultVnodes)) {\n for (const childNode of defaultVnodes) {\n if (childNode.type?.name === name || childNode.shapeFlag & 2) {\n children.push(childNode);\n } else if (childNode.type === Fragment && Array.isArray(childNode.children)) {\n childNode.children.forEach((vnode: any) => {\n // No rendering when vnode is dynamic slot or text\n if (vnode?.patchFlag !== 1024 && !isString(vnode?.children)) {\n children.push(vnode);\n }\n });\n }\n }\n }\n return children;\n};\n"],"names":["Fragment","isString"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"tableHelper.js","sources":["../../../../../../../packages/components/src/composite/tablePro/tableHelper.ts"],"sourcesContent":["import { Fragment } from 'vue';\nimport { isString } from '@giime/utils/src/is';\n\n/**\n * 从 vnode 数组中提取指定名称的组件\n * @param defaultVnodes vnode 数组\n * @param name 目标组件名称\n * @param recursive 是否递归提取嵌套组件(用于支持多级表头)\n * @returns 提取的 vnode 数组\n */\nexport const getVnodesByGmName = (defaultVnodes: any[], name: string, recursive = false): any[] => {\n const children: any[] = [];\n if (Array.isArray(defaultVnodes)) {\n for (const childNode of defaultVnodes) {\n // 匹配目标组件\n if (childNode.type?.name === name || childNode.shapeFlag & 2) {\n children.push(childNode);\n }\n // 处理 Fragment\n else if (childNode.type === Fragment && Array.isArray(childNode.children)) {\n childNode.children.forEach((vnode: any) => {\n // No rendering when vnode is dynamic slot or text\n if (vnode?.patchFlag !== 1024 && !isString(vnode?.children)) {\n children.push(vnode);\n }\n });\n }\n // 递归提取嵌套在其他组件中的目标组件(用于多级表头)\n else if (recursive && childNode.children) {\n // 如果有 default slot,递归提取\n if (typeof childNode.children === 'object' && childNode.children.default) {\n const nestedVnodes = childNode.children.default();\n const nestedChildren: any[] = getVnodesByGmName(Array.isArray(nestedVnodes) ? nestedVnodes : [nestedVnodes], name, true);\n children.push(...nestedChildren);\n }\n // 如果 children 是数组,递归提取\n else if (Array.isArray(childNode.children)) {\n const nestedChildren: any[] = getVnodesByGmName(childNode.children, name, true);\n children.push(...nestedChildren);\n }\n }\n }\n }\n return children;\n};\n"],"names":["Fragment","isString"],"mappings":";;;;;AAUO,MAAM,iBAAA,GAAoB,CAAC,aAAA,EAAsB,IAAA,EAAc,YAAY,KAAA,KAAiB;AACjG,EAAA,MAAM,WAAkB,EAAC;AACzB,EAAA,IAAI,KAAA,CAAM,OAAA,CAAQ,aAAa,CAAA,EAAG;AAChC,IAAA,KAAA,MAAW,aAAa,aAAA,EAAe;AAErC,MAAA,IAAI,UAAU,IAAA,EAAM,IAAA,KAAS,IAAA,IAAQ,SAAA,CAAU,YAAY,CAAA,EAAG;AAC5D,QAAA,QAAA,CAAS,KAAK,SAAS,CAAA;AAAA,MACzB,CAAA,MAAA,IAES,UAAU,IAAA,KAASA,YAAA,IAAY,MAAM,OAAA,CAAQ,SAAA,CAAU,QAAQ,CAAA,EAAG;AACzE,QAAA,SAAA,CAAU,QAAA,CAAS,OAAA,CAAQ,CAAC,KAAA,KAAe;AAEzC,UAAA,IAAI,OAAO,SAAA,KAAc,IAAA,IAAQ,CAACC,WAAA,CAAS,KAAA,EAAO,QAAQ,CAAA,EAAG;AAC3D,YAAA,QAAA,CAAS,KAAK,KAAK,CAAA;AAAA,UACrB;AAAA,QACF,CAAC,CAAA;AAAA,MACH,CAAA,MAAA,IAES,SAAA,IAAa,SAAA,CAAU,QAAA,EAAU;AAExC,QAAA,IAAI,OAAO,SAAA,CAAU,QAAA,KAAa,QAAA,IAAY,SAAA,CAAU,SAAS,OAAA,EAAS;AACxE,UAAA,MAAM,YAAA,GAAe,SAAA,CAAU,QAAA,CAAS,OAAA,EAAQ;AAChD,UAAA,MAAM,cAAA,GAAwB,iBAAA,CAAkB,KAAA,CAAM,OAAA,CAAQ,YAAY,CAAA,GAAI,YAAA,GAAe,CAAC,YAAY,CAAA,EAAG,IAAA,EAAM,IAAI,CAAA;AACvH,UAAA,QAAA,CAAS,IAAA,CAAK,GAAG,cAAc,CAAA;AAAA,QACjC,CAAA,MAAA,IAES,KAAA,CAAM,OAAA,CAAQ,SAAA,CAAU,QAAQ,CAAA,EAAG;AAC1C,UAAA,MAAM,cAAA,GAAwB,iBAAA,CAAkB,SAAA,CAAU,QAAA,EAAU,MAAM,IAAI,CAAA;AAC9E,UAAA,QAAA,CAAS,IAAA,CAAK,GAAG,cAAc,CAAA;AAAA,QACjC;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACA,EAAA,OAAO,QAAA;AACT;;;;"}
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import type { UploadFile, UploadFiles, UploadInstance, UploadRawFile, UploadStatus } from 'element-plus';
|
|
2
2
|
declare var __VLS_11: {}, __VLS_29: {
|
|
3
3
|
file: UploadFile;
|
|
4
|
+
}, __VLS_51: {
|
|
5
|
+
file: UploadFile;
|
|
4
6
|
};
|
|
5
7
|
type __VLS_Slots = {} & {
|
|
6
8
|
default?: (props: typeof __VLS_11) => any;
|
|
7
9
|
} & {
|
|
8
10
|
file?: (props: typeof __VLS_29) => any;
|
|
11
|
+
} & {
|
|
12
|
+
fileBottom?: (props: typeof __VLS_51) => any;
|
|
9
13
|
};
|
|
10
14
|
declare const _default: __VLS_WithSlots<import("vue").DefineComponent<{
|
|
11
15
|
listType: {
|
|
@@ -28,34 +32,6 @@ declare const _default: __VLS_WithSlots<import("vue").DefineComponent<{
|
|
|
28
32
|
type: BooleanConstructor;
|
|
29
33
|
default: boolean;
|
|
30
34
|
};
|
|
31
|
-
folder: {
|
|
32
|
-
type: StringConstructor;
|
|
33
|
-
default: string;
|
|
34
|
-
};
|
|
35
|
-
seat: {
|
|
36
|
-
type: StringConstructor;
|
|
37
|
-
default: string;
|
|
38
|
-
};
|
|
39
|
-
parallel: {
|
|
40
|
-
type: NumberConstructor;
|
|
41
|
-
default: null;
|
|
42
|
-
};
|
|
43
|
-
partSize: {
|
|
44
|
-
type: NumberConstructor;
|
|
45
|
-
default: null;
|
|
46
|
-
};
|
|
47
|
-
options: {
|
|
48
|
-
type: ObjectConstructor;
|
|
49
|
-
default: () => {};
|
|
50
|
-
};
|
|
51
|
-
bucket: {
|
|
52
|
-
type: StringConstructor;
|
|
53
|
-
default: string;
|
|
54
|
-
};
|
|
55
|
-
fileName: {
|
|
56
|
-
type: StringConstructor;
|
|
57
|
-
default: string;
|
|
58
|
-
};
|
|
59
35
|
showDelete: {
|
|
60
36
|
type: BooleanConstructor;
|
|
61
37
|
default: boolean;
|
|
@@ -68,18 +44,6 @@ declare const _default: __VLS_WithSlots<import("vue").DefineComponent<{
|
|
|
68
44
|
type: BooleanConstructor;
|
|
69
45
|
default: boolean;
|
|
70
46
|
};
|
|
71
|
-
saveStore: {
|
|
72
|
-
type: BooleanConstructor;
|
|
73
|
-
default: boolean;
|
|
74
|
-
};
|
|
75
|
-
platform: {
|
|
76
|
-
type: StringConstructor;
|
|
77
|
-
default: string;
|
|
78
|
-
};
|
|
79
|
-
cdn: {
|
|
80
|
-
type: StringConstructor;
|
|
81
|
-
default: string;
|
|
82
|
-
};
|
|
83
47
|
width: {
|
|
84
48
|
type: NumberConstructor;
|
|
85
49
|
default: number;
|
|
@@ -355,34 +319,6 @@ declare const _default: __VLS_WithSlots<import("vue").DefineComponent<{
|
|
|
355
319
|
type: BooleanConstructor;
|
|
356
320
|
default: boolean;
|
|
357
321
|
};
|
|
358
|
-
folder: {
|
|
359
|
-
type: StringConstructor;
|
|
360
|
-
default: string;
|
|
361
|
-
};
|
|
362
|
-
seat: {
|
|
363
|
-
type: StringConstructor;
|
|
364
|
-
default: string;
|
|
365
|
-
};
|
|
366
|
-
parallel: {
|
|
367
|
-
type: NumberConstructor;
|
|
368
|
-
default: null;
|
|
369
|
-
};
|
|
370
|
-
partSize: {
|
|
371
|
-
type: NumberConstructor;
|
|
372
|
-
default: null;
|
|
373
|
-
};
|
|
374
|
-
options: {
|
|
375
|
-
type: ObjectConstructor;
|
|
376
|
-
default: () => {};
|
|
377
|
-
};
|
|
378
|
-
bucket: {
|
|
379
|
-
type: StringConstructor;
|
|
380
|
-
default: string;
|
|
381
|
-
};
|
|
382
|
-
fileName: {
|
|
383
|
-
type: StringConstructor;
|
|
384
|
-
default: string;
|
|
385
|
-
};
|
|
386
322
|
showDelete: {
|
|
387
323
|
type: BooleanConstructor;
|
|
388
324
|
default: boolean;
|
|
@@ -395,18 +331,6 @@ declare const _default: __VLS_WithSlots<import("vue").DefineComponent<{
|
|
|
395
331
|
type: BooleanConstructor;
|
|
396
332
|
default: boolean;
|
|
397
333
|
};
|
|
398
|
-
saveStore: {
|
|
399
|
-
type: BooleanConstructor;
|
|
400
|
-
default: boolean;
|
|
401
|
-
};
|
|
402
|
-
platform: {
|
|
403
|
-
type: StringConstructor;
|
|
404
|
-
default: string;
|
|
405
|
-
};
|
|
406
|
-
cdn: {
|
|
407
|
-
type: StringConstructor;
|
|
408
|
-
default: string;
|
|
409
|
-
};
|
|
410
334
|
width: {
|
|
411
335
|
type: NumberConstructor;
|
|
412
336
|
default: number;
|
|
@@ -657,7 +581,6 @@ declare const _default: __VLS_WithSlots<import("vue").DefineComponent<{
|
|
|
657
581
|
"onUpdate:checkoutFiles"?: ((value: any[]) => any) | undefined;
|
|
658
582
|
}, {
|
|
659
583
|
size: number;
|
|
660
|
-
options: Record<string, any>;
|
|
661
584
|
method: string;
|
|
662
585
|
data: ({
|
|
663
586
|
[x: string]: any;
|
|
@@ -695,9 +618,7 @@ declare const _default: __VLS_WithSlots<import("vue").DefineComponent<{
|
|
|
695
618
|
autoUpload: boolean;
|
|
696
619
|
listType: "text" | "picture" | "picture-card";
|
|
697
620
|
httpRequest: import("element-plus").UploadRequestHandler;
|
|
698
|
-
fileName: string;
|
|
699
621
|
acl: string;
|
|
700
|
-
platform: string;
|
|
701
622
|
fileWidth: string;
|
|
702
623
|
fileHeight: string;
|
|
703
624
|
fileStyle: Record<string, any>;
|
|
@@ -712,13 +633,6 @@ declare const _default: __VLS_WithSlots<import("vue").DefineComponent<{
|
|
|
712
633
|
deleteTip: boolean;
|
|
713
634
|
disabledCheckboxUids: number[];
|
|
714
635
|
onAllComplete: () => void;
|
|
715
|
-
folder: string;
|
|
716
|
-
seat: string;
|
|
717
|
-
parallel: number;
|
|
718
|
-
partSize: number;
|
|
719
|
-
bucket: string;
|
|
720
|
-
saveStore: boolean;
|
|
721
|
-
cdn: string;
|
|
722
636
|
}, {}>, __VLS_Slots>;
|
|
723
637
|
export default _default;
|
|
724
638
|
type __VLS_WithSlots<T, S> = T & {
|
|
@@ -7,7 +7,7 @@ require('./UploadFile.vue3.js');
|
|
|
7
7
|
require('./UploadFile.vue4.js');
|
|
8
8
|
var _pluginVue_exportHelper = require('../../../../_virtual/_plugin-vue_export-helper.js');
|
|
9
9
|
|
|
10
|
-
var UploadFile = /* @__PURE__ */ _pluginVue_exportHelper.default(UploadFile_vue_vue_type_script_setup_true_lang.default, [["__scopeId", "data-v-
|
|
10
|
+
var UploadFile = /* @__PURE__ */ _pluginVue_exportHelper.default(UploadFile_vue_vue_type_script_setup_true_lang.default, [["__scopeId", "data-v-c615121c"]]);
|
|
11
11
|
|
|
12
12
|
exports.default = UploadFile;
|
|
13
13
|
//# sourceMappingURL=UploadFile.vue.js.map
|
|
@@ -12,7 +12,7 @@ var index$3 = require('../fileComponent/index.js');
|
|
|
12
12
|
var index$4 = require('../previewFile/index.js');
|
|
13
13
|
var uploadFile = require('./uploadFile.js');
|
|
14
14
|
|
|
15
|
-
const _withScopeId = (n) => (vue.pushScopeId("data-v-
|
|
15
|
+
const _withScopeId = (n) => (vue.pushScopeId("data-v-c615121c"), n = n(), vue.popScopeId(), n);
|
|
16
16
|
const _hoisted_1 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ vue.createElementVNode(
|
|
17
17
|
"div",
|
|
18
18
|
{ class: "el-upload__text gm-text-center !gm-text-xs gm-text-gray-500" },
|
|
@@ -23,9 +23,10 @@ const _hoisted_1 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ vue.create
|
|
|
23
23
|
-1
|
|
24
24
|
/* HOISTED */
|
|
25
25
|
));
|
|
26
|
-
const _hoisted_2 = { class: "
|
|
27
|
-
const _hoisted_3 =
|
|
26
|
+
const _hoisted_2 = { class: "gm-relative gm-flex gm-items-center gm-justify-center gm-overflow-hidden gm-rounded-md" };
|
|
27
|
+
const _hoisted_3 = { class: "el-upload-list__item-actions" };
|
|
28
28
|
const _hoisted_4 = ["onClick"];
|
|
29
|
+
const _hoisted_5 = ["onClick"];
|
|
29
30
|
var _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
30
31
|
...{
|
|
31
32
|
name: "GmUploadFile"
|
|
@@ -224,49 +225,54 @@ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
224
225
|
vue.createElementVNode(
|
|
225
226
|
"div",
|
|
226
227
|
{
|
|
227
|
-
|
|
228
|
-
style: vue.normalizeStyle({ width: _ctx.width + "px", height: _ctx.height + "px" })
|
|
228
|
+
style: vue.normalizeStyle({ width: _ctx.width + "px" })
|
|
229
229
|
},
|
|
230
230
|
[
|
|
231
|
-
vue.
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
231
|
+
vue.createElementVNode("div", _hoisted_2, [
|
|
232
|
+
vue.createVNode(vue.unref(index$3.GmFileComponent), {
|
|
233
|
+
file,
|
|
234
|
+
size: _ctx.width - 40,
|
|
235
|
+
url: _ctx.url,
|
|
236
|
+
controls: false,
|
|
237
|
+
"show-icon": true,
|
|
238
|
+
field: _ctx.field,
|
|
239
|
+
fileWidth: _ctx.width + "px",
|
|
240
|
+
fileHeight: _ctx.height + "px",
|
|
241
|
+
fileStyle: { border: "1px solid #dcdfe6", overflow: "hidden", borderRadius: "5px" }
|
|
242
|
+
}, null, 8, ["file", "size", "url", "field", "fileWidth", "fileHeight"]),
|
|
243
|
+
vue.createElementVNode("div", _hoisted_3, [
|
|
244
|
+
vue.createElementVNode("span", {
|
|
245
|
+
class: "el-upload-list__item-preview",
|
|
246
|
+
onClick: ($event) => handlePreview(file)
|
|
247
|
+
}, [
|
|
248
|
+
vue.createVNode(_component_el_icon, null, {
|
|
249
|
+
default: vue.withCtx(() => [
|
|
250
|
+
vue.createVNode(vue.unref(iconsVue.View))
|
|
251
|
+
]),
|
|
252
|
+
_: 1
|
|
253
|
+
/* STABLE */
|
|
254
|
+
})
|
|
255
|
+
], 8, _hoisted_4),
|
|
256
|
+
_ctx.showDelete ? (vue.openBlock(), vue.createElementBlock("span", {
|
|
257
|
+
key: 0,
|
|
258
|
+
class: "el-upload-list__item-delete",
|
|
259
|
+
onClick: ($event) => handleRemove(file, fileList.value)
|
|
260
|
+
}, [
|
|
261
|
+
vue.createVNode(_component_el_icon, null, {
|
|
262
|
+
default: vue.withCtx(() => [
|
|
263
|
+
vue.createVNode(vue.unref(iconsVue.Delete))
|
|
264
|
+
]),
|
|
265
|
+
_: 1
|
|
266
|
+
/* STABLE */
|
|
267
|
+
})
|
|
268
|
+
], 8, _hoisted_5)) : vue.createCommentVNode("v-if", true)
|
|
269
|
+
])
|
|
270
|
+
]),
|
|
271
|
+
vue.renderSlot(_ctx.$slots, "fileBottom", { file }, void 0, true)
|
|
239
272
|
],
|
|
240
273
|
4
|
|
241
274
|
/* STYLE */
|
|
242
|
-
)
|
|
243
|
-
vue.createElementVNode("div", _hoisted_2, [
|
|
244
|
-
vue.createElementVNode("span", {
|
|
245
|
-
class: "el-upload-list__item-preview",
|
|
246
|
-
onClick: ($event) => handlePreview(file)
|
|
247
|
-
}, [
|
|
248
|
-
vue.createVNode(_component_el_icon, null, {
|
|
249
|
-
default: vue.withCtx(() => [
|
|
250
|
-
vue.createVNode(vue.unref(iconsVue.View))
|
|
251
|
-
]),
|
|
252
|
-
_: 1
|
|
253
|
-
/* STABLE */
|
|
254
|
-
})
|
|
255
|
-
], 8, _hoisted_3),
|
|
256
|
-
_ctx.showDelete ? (vue.openBlock(), vue.createElementBlock("span", {
|
|
257
|
-
key: 0,
|
|
258
|
-
class: "el-upload-list__item-delete",
|
|
259
|
-
onClick: ($event) => handleRemove(file, fileList.value)
|
|
260
|
-
}, [
|
|
261
|
-
vue.createVNode(_component_el_icon, null, {
|
|
262
|
-
default: vue.withCtx(() => [
|
|
263
|
-
vue.createVNode(vue.unref(iconsVue.Delete))
|
|
264
|
-
]),
|
|
265
|
-
_: 1
|
|
266
|
-
/* STABLE */
|
|
267
|
-
})
|
|
268
|
-
], 8, _hoisted_4)) : vue.createCommentVNode("v-if", true)
|
|
269
|
-
])
|
|
275
|
+
)
|
|
270
276
|
], true)
|
|
271
277
|
]),
|
|
272
278
|
key: "0"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UploadFile.vue2.js","sources":["../../../../../../../packages/components/src/composite/uploadFile/UploadFile.vue"],"sourcesContent":["<template>\n <div>\n <div\n ref=\"pasteFileRef\"\n :class=\"{ 'gm-upload-file-picture-card': listType === 'picture-card', 'gm-upload-file-disabled': disabled }\"\n class=\"gm-upload-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\" :url=\"url\" :controls=\"false\" :show-icon=\"true\" :field=\"field\" />\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 </el-upload>\n </el-checkbox-group>\n\n <GmPreviewFile\n v-model:dialogVisible=\"dialogVisible\"\n v-model:file-index=\"fileIndex\"\n :file-list=\"fileList\"\n :controls=\"controls\"\n :oncontextmenu=\"oncontextmenu\"\n :controlslist=\"controlslist\"\n :field=\"field\"\n />\n </div>\n </div>\n</template>\n\n<script setup lang=\"ts\">\nimport { ref } from 'vue';\nimport { ElMessageBox } from 'element-plus';\nimport { useUploadTaskStore } from '@giime/hooks/store/useUploadTask';\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 '../fileComponent';\nimport GmPreviewFile from '../previewFile';\nimport { uploadFileProps } from './uploadFile';\nimport type { GmUploadProUserFileResponse } from './uploadFile';\nimport type { UploadFile, UploadFiles, UploadInstance, UploadProps, UploadRawFile, UploadRequestOptions, UploadStatus } from 'element-plus';\n\ndefineOptions({\n name: 'GmUploadFile',\n});\n\nconst props = defineProps(uploadFileProps);\nconst emit = defineEmits([\"handleRemove\"]);\n\nconst { uploadFileTask } = useUploadTaskStore();\n\n/** 上传文件 */\nconst fileList = defineModel<UploadFile[]>('fileList', { required: true, default: () => [] });\n/** 多选数据 */\nconst checkoutFiles = defineModel<any[]>('checkoutFiles', { default: () => [] });\n\nconst loadingUids = ref<Set<number>>(new Set());\n\n/* 上传 */\nconst httpRequest = async (options: UploadRequestOptions) => {\n loadingUids.value.add(options.file.uid);\n const { file } = options;\n\n const res: any = await uploadFileTask(file, {\n domainCode: props.domainCode,\n sceneCode: props.sceneCode,\n accept: props.accept,\n acl: props.acl,\n elOptions: options,\n });\n\n return { ...res, file };\n};\n\n/**判断是否全部上传完成 并触发事件 */\nconst checkAllUploadComplete = () => {\n if (loadingUids.value.size === 0) {\n // 全部文件上传完成\n props.onAllComplete?.();\n }\n};\n// 上传成功\nconst coverFileSuccess: UploadProps['onSuccess'] = (response: GmUploadProUserFileResponse, uploadFile, uploadFiles) => {\n loadingUids.value.delete(uploadFile.uid);\n uploadFile.url = response.url;\n props.onSuccess?.(response, uploadFile, uploadFiles);\n // 判断是否全部上传完成\n checkAllUploadComplete();\n};\n// 上传失败\nconst coverFileError: UploadProps['onError'] = (error, uploadFile, uploadFiles) => {\n loadingUids.value.delete(uploadFile.uid);\n props.onError?.(error, uploadFile, uploadFiles);\n // 判断是否全部上传完成\n checkAllUploadComplete();\n};\n\n/* 删除文件前 */\nconst beforeRemove = (file: UploadFile, files: UploadFiles) => {\n if (props.disabled) {\n return false;\n }\n return props.beforeRemove ? 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};\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 pasteFileRef = ref<HTMLElement>();\n/* 手动上传 */\nconst submit = () => {\n uploadFileRef.value!.submit();\n};\n\n/** 取消上传 */\nconst abort = (file: UploadFile) => {\n uploadFileRef.value!.abort(file);\n};\n\n/** 清空已上传的文件列表 */\nconst clearFiles = (status?: UploadStatus[]) => {\n uploadFileRef.value!.clearFiles(status);\n};\n\n/** 手动选择文件 */\nconst handleStart = (rawFile: UploadRawFile) => {\n uploadFileRef.value!.handleStart(rawFile);\n};\n\n/** 预览 */\nconst dialogVisible = ref(false);\nconst fileIndex = ref(0);\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 (Array.isArray(files) && files.length > 0) {\n files.forEach(file => {\n if (file instanceof File) {\n const rawFile = file as UploadRawFile;\n handleStart(rawFile);\n\n // 粘贴成功自动上传\n if (props.autoUpload) {\n submit();\n }\n }\n });\n }\n});\n\nonError((error: Error) => {\n console.error('粘贴错误:', error);\n ElMessageBox.alert(error.message, '提示', {\n type: 'error',\n });\n});\n\ndefineExpose({\n submit,\n abort,\n clearFiles,\n handleStart,\n uploadFileRef,\n});\n</script>\n\n<style scoped lang=\"scss\">\n.gm-upload-preview-dialog {\n :deep(.el-dialog__body) {\n padding: 0;\n }\n}\n.gm-upload-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-file {\n line-height: normal;\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: normal;\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-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":["useUploadTaskStore","_useModel","ref","GmConfirmBox","usePasteFile","ElMessageBox"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsFA,IAAA,MAAM,KAAA,GAAQ,OAAA;AACd,IAAA,MAAM,IAAA,GAAO,MAAA;AAEb,IAAA,MAAM,EAAE,cAAA,EAAe,GAAIA,wBAAA,EAAmB;AAG9C,IAAA,MAAM,QAAA,GAAWC,YAAA,CAAyB,OAAA,EAAC,UAAiD,CAAA;AAE5F,IAAA,MAAM,aAAA,GAAgBA,YAAA,CAAkB,OAAA,EAAC,eAAsC,CAAA;AAE/E,IAAA,MAAM,WAAA,GAAcC,OAAA,iBAAiB,IAAI,GAAA,EAAK,CAAA;AAG9C,IAAA,MAAM,WAAA,GAAc,OAAO,OAAA,KAAkC;AAC3D,MAAA,WAAA,CAAY,KAAA,CAAM,GAAA,CAAI,OAAA,CAAQ,IAAA,CAAK,GAAG,CAAA;AACtC,MAAA,MAAM,EAAE,MAAK,GAAI,OAAA;AAEjB,MAAA,MAAM,GAAA,GAAW,MAAM,cAAA,CAAe,IAAA,EAAM;AAAA,QAC1C,YAAY,KAAA,CAAM,UAAA;AAAA,QAClB,WAAW,KAAA,CAAM,SAAA;AAAA,QACjB,QAAQ,KAAA,CAAM,MAAA;AAAA,QACd,KAAK,KAAA,CAAM,GAAA;AAAA,QACX,SAAA,EAAW;AAAA,OACZ,CAAA;AAED,MAAA,OAAO,EAAE,GAAG,GAAA,EAAK,I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;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"UploadFile.vue2.js","sources":["../../../../../../../packages/components/src/composite/uploadFile/UploadFile.vue"],"sourcesContent":["<template>\n <div>\n <div\n ref=\"pasteFileRef\"\n :class=\"{ 'gm-upload-file-picture-card': listType === 'picture-card', 'gm-upload-file-disabled': disabled }\"\n class=\"gm-upload-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 :style=\"{ width: width + 'px' }\">\n <div class=\"gm-relative gm-flex gm-items-center gm-justify-center gm-overflow-hidden gm-rounded-md\">\n <GmFileComponent\n :file=\"file\"\n :size=\"width - 40\"\n :url=\"url\"\n :controls=\"false\"\n :show-icon=\"true\"\n :field=\"field\"\n :fileWidth=\"width + 'px'\"\n :fileHeight=\"height + 'px'\"\n :fileStyle=\"{ border: '1px solid #dcdfe6', overflow: 'hidden', borderRadius: '5px' }\"\n />\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 </div>\n <slot name=\"fileBottom\" :file=\"file\" />\n </div>\n </slot>\n </template>\n </el-upload>\n </el-checkbox-group>\n\n <GmPreviewFile\n v-model:dialogVisible=\"dialogVisible\"\n v-model:file-index=\"fileIndex\"\n :file-list=\"fileList\"\n :controls=\"controls\"\n :oncontextmenu=\"oncontextmenu\"\n :controlslist=\"controlslist\"\n :field=\"field\"\n />\n </div>\n </div>\n</template>\n\n<script setup lang=\"ts\">\nimport { ref } from 'vue';\nimport { ElMessageBox } from 'element-plus';\nimport { useUploadTaskStore } from '@giime/hooks/store/useUploadTask';\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 '../fileComponent';\nimport GmPreviewFile from '../previewFile';\nimport { uploadFileProps } from './uploadFile';\nimport type { GmUploadProUserFileResponse } from './uploadFile';\nimport type { UploadFile, UploadFiles, UploadInstance, UploadProps, UploadRawFile, UploadRequestOptions, UploadStatus } from 'element-plus';\n\ndefineOptions({\n name: 'GmUploadFile',\n});\n\nconst props = defineProps(uploadFileProps);\nconst emit = defineEmits([\"handleRemove\"]);\n\nconst { uploadFileTask } = useUploadTaskStore();\n\n/** 上传文件 */\nconst fileList = defineModel<UploadFile[]>('fileList', { required: true, default: () => [] });\n/** 多选数据 */\nconst checkoutFiles = defineModel<any[]>('checkoutFiles', { default: () => [] });\n\nconst loadingUids = ref<Set<number>>(new Set());\n\n/* 上传 */\nconst httpRequest = async (options: UploadRequestOptions) => {\n loadingUids.value.add(options.file.uid);\n const { file } = options;\n\n const res: any = await uploadFileTask(file, {\n domainCode: props.domainCode,\n sceneCode: props.sceneCode,\n accept: props.accept,\n acl: props.acl,\n elOptions: options,\n });\n\n return { ...res, file };\n};\n\n/**判断是否全部上传完成 并触发事件 */\nconst checkAllUploadComplete = () => {\n if (loadingUids.value.size === 0) {\n // 全部文件上传完成\n props.onAllComplete?.();\n }\n};\n// 上传成功\nconst coverFileSuccess: UploadProps['onSuccess'] = (response: GmUploadProUserFileResponse, uploadFile, uploadFiles) => {\n loadingUids.value.delete(uploadFile.uid);\n uploadFile.url = response.url;\n props.onSuccess?.(response, uploadFile, uploadFiles);\n // 判断是否全部上传完成\n checkAllUploadComplete();\n};\n// 上传失败\nconst coverFileError: UploadProps['onError'] = (error, uploadFile, uploadFiles) => {\n loadingUids.value.delete(uploadFile.uid);\n props.onError?.(error, uploadFile, uploadFiles);\n // 判断是否全部上传完成\n checkAllUploadComplete();\n};\n\n/* 删除文件前 */\nconst beforeRemove = (file: UploadFile, files: UploadFiles) => {\n if (props.disabled) {\n return false;\n }\n return props.beforeRemove ? 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};\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 pasteFileRef = ref<HTMLElement>();\n/* 手动上传 */\nconst submit = () => {\n uploadFileRef.value!.submit();\n};\n\n/** 取消上传 */\nconst abort = (file: UploadFile) => {\n uploadFileRef.value!.abort(file);\n};\n\n/** 清空已上传的文件列表 */\nconst clearFiles = (status?: UploadStatus[]) => {\n uploadFileRef.value!.clearFiles(status);\n};\n\n/** 手动选择文件 */\nconst handleStart = (rawFile: UploadRawFile) => {\n uploadFileRef.value!.handleStart(rawFile);\n};\n\n/** 预览 */\nconst dialogVisible = ref(false);\nconst fileIndex = ref(0);\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 (Array.isArray(files) && files.length > 0) {\n files.forEach(file => {\n if (file instanceof File) {\n const rawFile = file as UploadRawFile;\n handleStart(rawFile);\n\n // 粘贴成功自动上传\n if (props.autoUpload) {\n submit();\n }\n }\n });\n }\n});\n\nonError((error: Error) => {\n console.error('粘贴错误:', error);\n ElMessageBox.alert(error.message, '提示', {\n type: 'error',\n });\n});\n\ndefineExpose({\n submit,\n abort,\n clearFiles,\n handleStart,\n uploadFileRef,\n});\n</script>\n\n<style scoped lang=\"scss\">\n.gm-upload-preview-dialog {\n :deep(.el-dialog__body) {\n padding: 0;\n }\n}\n.gm-upload-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-file {\n line-height: normal;\n li > {\n .el-checkbox {\n position: absolute;\n left: 10px;\n top: 0;\n z-index: 9;\n }\n }\n .el-upload-list--picture-card {\n gap: 10px;\n }\n .el-upload-list__item {\n margin: 0;\n border: none;\n }\n .el-upload-list__item-file-name {\n line-height: normal;\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-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":["useUploadTaskStore","_useModel","ref","GmConfirmBox","usePasteFile","ElMessageBox"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmGA,IAAA,MAAM,KAAA,G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