fast-element-plus 2.0.15 → 2.0.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +28 -0
- package/dist/component.d.ts +6570 -2
- package/dist/component.mjs.map +1 -1
- package/dist/components/avatar/src/avatar.d.ts +19 -7
- package/dist/components/avatar/src/avatar.mjs +5 -0
- package/dist/components/avatar/src/avatar.mjs.map +1 -1
- package/dist/components/button/src/button.d.ts +4 -4
- package/dist/components/button/src/button.mjs +3 -4
- package/dist/components/button/src/button.mjs.map +1 -1
- package/dist/components/carNumber/src/carNumber.mjs +7 -9
- package/dist/components/carNumber/src/carNumber.mjs.map +1 -1
- package/dist/components/contextMenu/index.d.ts +1 -1
- package/dist/components/contextMenu/index.mjs.map +1 -1
- package/dist/components/contextMenu/src/contextMenu.d.ts +2 -2
- package/dist/components/contextMenu/src/contextMenu.mjs +10 -9
- package/dist/components/contextMenu/src/contextMenu.mjs.map +1 -1
- package/dist/components/dialog/src/dialog.d.ts +7 -4
- package/dist/components/dialog/src/dialog.mjs +10 -11
- package/dist/components/dialog/src/dialog.mjs.map +1 -1
- package/dist/components/drawer/src/drawer.d.ts +2 -2
- package/dist/components/drawer/src/drawer.mjs +18 -18
- package/dist/components/drawer/src/drawer.mjs.map +1 -1
- package/dist/components/form/src/form.d.ts +34 -16
- package/dist/components/form/src/form.mjs +8 -9
- package/dist/components/form/src/form.mjs.map +1 -1
- package/dist/components/form/src/formItem.d.ts +4 -4
- package/dist/components/form/src/formItem.mjs +18 -17
- package/dist/components/form/src/formItem.mjs.map +1 -1
- package/dist/components/form/utils/form.d.ts +3 -3
- package/dist/components/form/utils/form.mjs +6 -10
- package/dist/components/form/utils/form.mjs.map +1 -1
- package/dist/components/icon/src/icon.mjs.map +1 -1
- package/dist/components/iconSelector/src/iconSelector.d.ts +2 -2
- package/dist/components/iconSelector/src/iconSelector.mjs +4 -5
- package/dist/components/iconSelector/src/iconSelector.mjs.map +1 -1
- package/dist/components/image/src/image.d.ts +1 -1
- package/dist/components/image/src/image.mjs +3 -3
- package/dist/components/image/src/image.mjs.map +1 -1
- package/dist/components/inputDialogPage/src/inputDialogPage.d.ts +4 -4
- package/dist/components/inputDialogPage/src/inputDialogPage.mjs +11 -15
- package/dist/components/inputDialogPage/src/inputDialogPage.mjs.map +1 -1
- package/dist/components/layoutGrid/index.d.ts +1 -1
- package/dist/components/layoutGrid/index.mjs.map +1 -1
- package/dist/components/layoutGrid/src/layoutGrid.d.ts +23 -11
- package/dist/components/layoutGrid/src/layoutGrid.mjs +44 -45
- package/dist/components/layoutGrid/src/layoutGrid.mjs.map +1 -1
- package/dist/components/layoutGrid/src/layoutGrid.type.d.ts +1 -1
- package/dist/components/layoutGrid/src/layoutGridItem.mjs +13 -14
- package/dist/components/layoutGrid/src/layoutGridItem.mjs.map +1 -1
- package/dist/components/select/index.d.ts +1 -1
- package/dist/components/select/index.mjs.map +1 -1
- package/dist/components/select/src/select.d.ts +29 -14
- package/dist/components/select/src/select.mjs +47 -45
- package/dist/components/select/src/select.mjs.map +1 -1
- package/dist/components/select/src/selectOption.mjs +4 -5
- package/dist/components/select/src/selectOption.mjs.map +1 -1
- package/dist/components/selectPage/src/selectPage.d.ts +29 -14
- package/dist/components/selectPage/src/selectPage.mjs +45 -52
- package/dist/components/selectPage/src/selectPage.mjs.map +1 -1
- package/dist/components/selectV2/src/selectV2.d.ts +51 -31
- package/dist/components/selectV2/src/selectV2.mjs +66 -64
- package/dist/components/selectV2/src/selectV2.mjs.map +1 -1
- package/dist/components/table/index.d.ts +3 -3
- package/dist/components/table/index.mjs +1 -3
- package/dist/components/table/index.mjs.map +1 -1
- package/dist/components/table/src/table.d.ts +72 -38
- package/dist/components/table/src/table.mjs +98 -104
- package/dist/components/table/src/table.mjs.map +1 -1
- package/dist/components/table/src/table.type.d.ts +2 -2
- package/dist/components/table/src/table.type.mjs.map +1 -1
- package/dist/components/table/src/tableColumn.d.ts +7 -7
- package/dist/components/table/src/tableColumn.mjs +25 -45
- package/dist/components/table/src/tableColumn.mjs.map +1 -1
- package/dist/components/table/src/tableColumnSettingDialog.mjs +32 -22
- package/dist/components/table/src/tableColumnSettingDialog.mjs.map +1 -1
- package/dist/components/table/src/tablePagination.mjs +2 -3
- package/dist/components/table/src/tablePagination.mjs.map +1 -1
- package/dist/components/table/src/tableSearchForm.d.ts +4 -4
- package/dist/components/table/src/tableSearchForm.mjs +35 -44
- package/dist/components/table/src/tableSearchForm.mjs.map +1 -1
- package/dist/components/table/src/tableSearchFormItem.d.ts +1 -7
- package/dist/components/table/src/tableSearchFormItem.mjs +3 -6
- package/dist/components/table/src/tableSearchFormItem.mjs.map +1 -1
- package/dist/components/table/src/useTable.d.ts +4 -4
- package/dist/components/table/src/useTable.mjs +19 -20
- package/dist/components/table/src/useTable.mjs.map +1 -1
- package/dist/components/table/utils/table.mjs +6 -8
- package/dist/components/table/utils/table.mjs.map +1 -1
- package/dist/components/tree/index.d.ts +1 -1
- package/dist/components/tree/index.mjs.map +1 -1
- package/dist/components/tree/src/tree.d.ts +9 -9
- package/dist/components/tree/src/tree.mjs +29 -27
- package/dist/components/tree/src/tree.mjs.map +1 -1
- package/dist/components/treeSelect/src/treeSelect.d.ts +38 -35
- package/dist/components/treeSelect/src/treeSelect.mjs +47 -45
- package/dist/components/treeSelect/src/treeSelect.mjs.map +1 -1
- package/dist/components/upload/src/upload.d.ts +1 -1
- package/dist/components/upload/src/upload.mjs +5 -6
- package/dist/components/upload/src/upload.mjs.map +1 -1
- package/dist/components/upload/src/useUpload.mjs +8 -10
- package/dist/components/upload/src/useUpload.mjs.map +1 -1
- package/dist/components/upload/utils/upload.d.ts +1 -1
- package/dist/components/upload/utils/upload.mjs +1 -1
- package/dist/components/upload/utils/upload.mjs.map +1 -1
- package/dist/components/uploadImage/src/uploadImage.d.ts +8 -5
- package/dist/components/uploadImage/src/uploadImage.mjs +18 -13
- package/dist/components/uploadImage/src/uploadImage.mjs.map +1 -1
- package/dist/components/uploadImages/src/uploadImages.d.ts +8 -5
- package/dist/components/uploadImages/src/uploadImages.mjs +16 -11
- package/dist/components/uploadImages/src/uploadImages.mjs.map +1 -1
- package/dist/directives/click-copy/index.d.ts +1 -1
- package/dist/directives/click-copy/index.mjs +5 -9
- package/dist/directives/click-copy/index.mjs.map +1 -1
- package/dist/directives/click-debounce/index.d.ts +1 -1
- package/dist/directives/click-draggable/index.d.ts +1 -1
- package/dist/directives/click-icon-copy/index.d.ts +1 -1
- package/dist/directives/click-icon-copy/index.mjs.map +1 -1
- package/dist/directives/click-longpress/index.d.ts +1 -1
- package/dist/directives/click-throttle/index.d.ts +1 -1
- package/dist/element-plus.mjs +5 -6
- package/dist/element-plus.mjs.map +1 -1
- package/dist/hooks/use-screenFull/index.mjs.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/dist/index.global.min.js +4 -4
- package/dist/index.global.min.js.map +1 -1
- package/dist/index.mjs +1 -3
- package/dist/index.mjs.map +1 -1
- package/dist/utils/async/index.mjs +6 -4
- package/dist/utils/async/index.mjs.map +1 -1
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/object/index.d.ts +8 -0
- package/dist/utils/object/index.mjs +113 -0
- package/dist/utils/object/index.mjs.map +1 -0
- package/dist/utils/string/index.mjs +19 -11
- package/dist/utils/string/index.mjs.map +1 -1
- package/dist/utils/vue/emits.mjs.map +1 -1
- package/dist/utils/vue/install.mjs.map +1 -1
- package/dist/utils/vue/render.mjs.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.mjs +1 -1
- package/dist/version.mjs.map +1 -1
- package/package.json +5 -10
- package/dist/components/table/src/page.type.mjs +0 -45
- package/dist/components/table/src/page.type.mjs.map +0 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { debounce } from "../../../utils/async/index.mjs";
|
|
2
2
|
import { createDateRangeShortcuts, createOneMonthRangeFromToday } from "../../../utils/date/index.mjs";
|
|
3
|
+
import { omit, pick } from "../../../utils/object/index.mjs";
|
|
3
4
|
import { randomString } from "../../../utils/string/index.mjs";
|
|
4
5
|
import { useExpose } from "../../../utils/vue/expose.mjs";
|
|
5
6
|
import { definePropType, useProps } from "../../../utils/vue/props.mjs";
|
|
@@ -13,10 +14,9 @@ import tableColumnSettingDialog_default from "./tableColumnSettingDialog.mjs";
|
|
|
13
14
|
import tablePagination_default from "./tablePagination.mjs";
|
|
14
15
|
import tableSearchForm_default from "./tableSearchForm.mjs";
|
|
15
16
|
import { NotData } from "@fast-element-plus/icons-vue";
|
|
16
|
-
import { Fragment, computed, createTextVNode, createVNode, defineComponent, mergeProps, onActivated, onMounted,
|
|
17
|
+
import { Fragment, computed, createTextVNode, createVNode, defineComponent, mergeProps, onActivated, onMounted, resolveDirective, shallowRef, watch, watchEffect, withDirectives } from "vue";
|
|
17
18
|
import { Eleme, More, Refresh, Search, Setting } from "@element-plus/icons-vue";
|
|
18
19
|
import { ElButton, ElDatePicker, ElDropdown, ElDropdownItem, ElDropdownMenu, ElIcon, ElImageViewer, ElInput, ElPagination, ElTable, ElTableColumn, useSizeProp } from "element-plus";
|
|
19
|
-
import { isArray, isBoolean, isFunction, isNil, isNull, isNumber, isObject, isString, omit, pick } from "lodash-unified";
|
|
20
20
|
//#region src/components/table/src/table.tsx
|
|
21
21
|
/** Element Plus Table 的透传 Props 定义。 */
|
|
22
22
|
const tableProps = {
|
|
@@ -388,53 +388,53 @@ const faTableProps = {
|
|
|
388
388
|
/** FaTable 的运行时 Emits 定义。 */
|
|
389
389
|
const faTableEmits = {
|
|
390
390
|
/** @description 当用户手动勾选数据行的 Checkbox 时触发的事件 */
|
|
391
|
-
select: (selection, row) => isArray(selection) &&
|
|
391
|
+
select: (selection, row) => Array.isArray(selection) && typeof row === "object" && row !== null,
|
|
392
392
|
/** @description 当用户手动勾选全选 Checkbox 时触发的事件 */
|
|
393
|
-
selectAll: (selection) => isArray(selection),
|
|
393
|
+
selectAll: (selection) => Array.isArray(selection),
|
|
394
394
|
/** @description 当选择项发生变化时会触发该事件 */
|
|
395
|
-
selectionChange: (newSelection) => isArray(newSelection),
|
|
395
|
+
selectionChange: (newSelection) => Array.isArray(newSelection),
|
|
396
396
|
/** @description 当单元格 hover 进入时会触发该事件 */
|
|
397
|
-
cellMouseEnter: (row, column, cell, event) =>
|
|
397
|
+
cellMouseEnter: (row, column, cell, event) => typeof row === "object" && row !== null && typeof column === "object" && column !== null && cell instanceof HTMLTableCellElement && event instanceof Event,
|
|
398
398
|
/** @description 当单元格 hover 退出时会触发该事件 */
|
|
399
|
-
cellMouseLeave: (row, column, cell, event) =>
|
|
399
|
+
cellMouseLeave: (row, column, cell, event) => typeof row === "object" && row !== null && typeof column === "object" && column !== null && cell instanceof HTMLTableCellElement && event instanceof Event,
|
|
400
400
|
/** @description 当某个单元格被点击时会触发该事件 */
|
|
401
|
-
cellClick: (row, column, cell, event) =>
|
|
401
|
+
cellClick: (row, column, cell, event) => typeof row === "object" && row !== null && typeof column === "object" && column !== null && cell instanceof HTMLTableCellElement && event instanceof Event,
|
|
402
402
|
/** @description 当某个单元格被双击击时会触发该事件 */
|
|
403
|
-
cellDblclick: (row, column, cell, event) =>
|
|
403
|
+
cellDblclick: (row, column, cell, event) => typeof row === "object" && row !== null && typeof column === "object" && column !== null && cell instanceof HTMLTableCellElement && event instanceof Event,
|
|
404
404
|
/** @description 当某个单元格被鼠标右键点击时会触发该事件 */
|
|
405
|
-
cellContextmenu: (row, column, cell, event) =>
|
|
405
|
+
cellContextmenu: (row, column, cell, event) => typeof row === "object" && row !== null && typeof column === "object" && column !== null && cell instanceof HTMLTableCellElement && event instanceof Event,
|
|
406
406
|
/** @description 当某一行被点击时会触发该事件 */
|
|
407
|
-
rowClick: (row, column, event) =>
|
|
407
|
+
rowClick: (row, column, event) => typeof row === "object" && row !== null && typeof column === "object" && column !== null && event instanceof Event,
|
|
408
408
|
/** @description 当某一行被鼠标右键点击时会触发该事件 */
|
|
409
|
-
rowContextmenu: (row, column, event) =>
|
|
409
|
+
rowContextmenu: (row, column, event) => typeof row === "object" && row !== null && typeof column === "object" && column !== null && event instanceof Event,
|
|
410
410
|
/** @description 当某一行被双击时会触发该事件 */
|
|
411
|
-
rowDblclick: (row, column, event) =>
|
|
411
|
+
rowDblclick: (row, column, event) => typeof row === "object" && row !== null && typeof column === "object" && column !== null && event instanceof Event,
|
|
412
412
|
/** @description 当某一列的表头被点击时会触发该事件 */
|
|
413
|
-
headerClick: (column, event) =>
|
|
413
|
+
headerClick: (column, event) => typeof column === "object" && column !== null && event instanceof Event,
|
|
414
414
|
/** @description 当某一列的表头被鼠标右键点击时触发该事件 */
|
|
415
|
-
headerContextmenu: (column, event) =>
|
|
415
|
+
headerContextmenu: (column, event) => typeof column === "object" && column !== null && event instanceof Event,
|
|
416
416
|
/** @description 当表格的排序条件发生变化的时候会触发该事件 */
|
|
417
|
-
sortChange: (data) =>
|
|
417
|
+
sortChange: (data) => typeof data === "object" && data !== null,
|
|
418
418
|
/** @description column 的 key, 如果需要使用 filter-change 事件,则需要此属性标识是哪个 column 的筛选条件 */
|
|
419
|
-
filterChange: (newFilters) =>
|
|
419
|
+
filterChange: (newFilters) => typeof newFilters === "object" && newFilters !== null,
|
|
420
420
|
/** @description 当表格的当前行发生变化的时候会触发该事件,如果要高亮当前行,请打开表格的 highlight-current-row 属性 */
|
|
421
|
-
currentChange: (currentRow, oldCurrentRow) =>
|
|
421
|
+
currentChange: (currentRow, oldCurrentRow) => typeof currentRow === "object" && currentRow !== null && (oldCurrentRow === null || typeof oldCurrentRow === "object" && oldCurrentRow !== null),
|
|
422
422
|
/** @description 当拖动表头改变了列的宽度的时候会触发该事件 */
|
|
423
|
-
headerDragend: (newWidth, oldWidth, column, event) =>
|
|
423
|
+
headerDragend: (newWidth, oldWidth, column, event) => typeof newWidth === "number" && typeof oldWidth === "number" && typeof column === "object" && column !== null && event instanceof MouseEvent,
|
|
424
424
|
/** @description 当用户对某一行展开或者关闭的时候会触发该事件(展开行时,回调的第二个参数为 expandedRows;树形表格时第二参数为 expanded) */
|
|
425
|
-
expandChange: (row, expanded) =>
|
|
425
|
+
expandChange: (row, expanded) => typeof row === "object" && row !== null && (typeof expanded === "boolean" || Array.isArray(expanded)),
|
|
426
426
|
/** @description 表格滚动时触发 */
|
|
427
|
-
scroll: (data) =>
|
|
427
|
+
scroll: (data) => typeof data === "object" && data !== null,
|
|
428
428
|
/** @description 表格刷新事件 */
|
|
429
|
-
refresh: (params) =>
|
|
429
|
+
refresh: (params) => typeof params === "object" && params !== null,
|
|
430
430
|
/** @description 表格重置事件 */
|
|
431
|
-
reset: (params) =>
|
|
431
|
+
reset: (params) => typeof params === "object" && params !== null,
|
|
432
432
|
/** @description 分页页码改变事件 */
|
|
433
|
-
sizeChange: (pageSize) =>
|
|
433
|
+
sizeChange: (pageSize) => typeof pageSize === "number",
|
|
434
434
|
/** @description 分页改变事件 */
|
|
435
|
-
paginationChange: (pageIndex, pageSize) =>
|
|
435
|
+
paginationChange: (pageIndex, pageSize) => typeof pageIndex === "number" && typeof pageSize === "number",
|
|
436
436
|
/** @description 自定义单元格点击事件 */
|
|
437
|
-
customCellClick: (emitName, { row, column, $index }) => (
|
|
437
|
+
customCellClick: (emitName, { row, column, $index }) => (emitName == null || typeof emitName === "string") && typeof row === "object" && row !== null && typeof column === "object" && column !== null && typeof $index === "number"
|
|
438
438
|
};
|
|
439
439
|
var table_default = defineComponent({
|
|
440
440
|
name: "FaTable",
|
|
@@ -442,22 +442,22 @@ var table_default = defineComponent({
|
|
|
442
442
|
emits: faTableEmits,
|
|
443
443
|
slots: makeSlots(),
|
|
444
444
|
setup(props, { slots, emit, expose }) {
|
|
445
|
-
const
|
|
445
|
+
const columnSettingRef = shallowRef(null);
|
|
446
|
+
const { globalSize, state, elementRef, tableRef, handleTableColumnAutoWidth, loadTableColumns, handleSizeChange, handlePaginationChange, defaultSearchTime, tableSearch, tableReset, doRender, doLoading, handleCustomCellClick } = useTable(props, slots, emit);
|
|
446
447
|
const notifyColumnsChange = debounce(() => props.columnsChange?.(state.orgColumns), 500);
|
|
447
448
|
const resizeTableColumns = debounce(handleTableColumnAutoWidth, 100);
|
|
448
|
-
const columnSettingRef = ref();
|
|
449
449
|
let lastRowIndex = 0;
|
|
450
450
|
const getInitParam = () => {
|
|
451
451
|
return typeof props.initParam === "object" && props.initParam !== null ? props.initParam : {};
|
|
452
452
|
};
|
|
453
453
|
const getRowKey = (row) => {
|
|
454
|
-
const value =
|
|
454
|
+
const value = typeof props.rowKey === "function" ? props.rowKey(row) : tableUtil.handleRowAccordingToProp(row, props.rowKey);
|
|
455
455
|
return typeof value === "string" || typeof value === "number" ? value : void 0;
|
|
456
456
|
};
|
|
457
457
|
const indexMethod = (index) => {
|
|
458
458
|
if (index === 0) lastRowIndex = 0;
|
|
459
|
-
if (state.spanColumns
|
|
460
|
-
if (
|
|
459
|
+
if (state.spanColumns.length > 0) {
|
|
460
|
+
if ((state.tableSpanData["__table-index"]?.[index] ?? 0) === 0) return lastRowIndex + (state.tablePagination.pageIndex - 1) * state.tablePagination.pageSize + 1;
|
|
461
461
|
else {
|
|
462
462
|
lastRowIndex++;
|
|
463
463
|
return lastRowIndex + (state.tablePagination.pageIndex - 1) * state.tablePagination.pageSize;
|
|
@@ -468,7 +468,7 @@ var table_default = defineComponent({
|
|
|
468
468
|
const handleSelect = (selection, row) => {
|
|
469
469
|
if (props.single) {
|
|
470
470
|
tableRef.value?.clearSelection();
|
|
471
|
-
if (selection.length > 0
|
|
471
|
+
if (selection.length > 0) tableRef.value?.toggleRowSelection(row);
|
|
472
472
|
}
|
|
473
473
|
emit("select", selection, row);
|
|
474
474
|
};
|
|
@@ -517,7 +517,7 @@ var table_default = defineComponent({
|
|
|
517
517
|
else if (column.multiOrder === "descending") column.multiOrder = "ascending";
|
|
518
518
|
else column.multiOrder = void 0;
|
|
519
519
|
const initSortList = getInitParam()["sortList"];
|
|
520
|
-
state.searchParam.sortList = [...isArray(initSortList) ? initSortList : [], ...state.searchParam.sortList ?? []].filter((item, index, list) => list.findIndex((candidate) => candidate.enField === item.enField) === index);
|
|
520
|
+
state.searchParam.sortList = [...Array.isArray(initSortList) ? initSortList : [], ...state.searchParam.sortList ?? []].filter((item, index, list) => list.findIndex((candidate) => candidate.enField === item.enField) === index);
|
|
521
521
|
const orgColumn = state.orgColumns.find((f) => f.prop === normalizedProp);
|
|
522
522
|
const enField = orgColumn?.sortableField ?? orgColumn?.prop ?? column.property;
|
|
523
523
|
const fieldIndex = state.searchParam.sortList.findIndex((f) => f.enField === enField);
|
|
@@ -555,13 +555,13 @@ var table_default = defineComponent({
|
|
|
555
555
|
}
|
|
556
556
|
const columnInfo = state.tableColumns.find((f) => f.prop === column.property);
|
|
557
557
|
if (columnInfo?.dataDeleteField) {
|
|
558
|
-
if (row
|
|
558
|
+
if (row[columnInfo.dataDeleteField] === true) {
|
|
559
559
|
if (localCellClassName) localCellClassName += " fa-table__data-delete-column";
|
|
560
560
|
else localCellClassName = "fa-table__data-delete-column";
|
|
561
561
|
}
|
|
562
562
|
}
|
|
563
563
|
if (props.cellClassName) {
|
|
564
|
-
const cellClassName =
|
|
564
|
+
const cellClassName = typeof props.cellClassName === "string" ? props.cellClassName : props.cellClassName({
|
|
565
565
|
row,
|
|
566
566
|
column,
|
|
567
567
|
rowIndex,
|
|
@@ -575,7 +575,7 @@ var table_default = defineComponent({
|
|
|
575
575
|
const handleHeaderCellClassName = ({ row, column, rowIndex, columnIndex }) => {
|
|
576
576
|
column.order = column.multiOrder === "ascending" || column.multiOrder === "descending" ? column.multiOrder : null;
|
|
577
577
|
if (props.headerCellClassName) {
|
|
578
|
-
if (
|
|
578
|
+
if (typeof props.headerCellClassName === "function") return props.headerCellClassName({
|
|
579
579
|
row,
|
|
580
580
|
column,
|
|
581
581
|
rowIndex,
|
|
@@ -587,9 +587,15 @@ var table_default = defineComponent({
|
|
|
587
587
|
};
|
|
588
588
|
const handleSpanMethod = ({ column, rowIndex }) => {
|
|
589
589
|
/** @description 原生的 span-method 会失效 */
|
|
590
|
-
const
|
|
590
|
+
const property = column.property;
|
|
591
|
+
const columnKey = column.columnKey;
|
|
592
|
+
const pKey = property ?? columnKey;
|
|
593
|
+
if (pKey === void 0 || pKey === null) return {
|
|
594
|
+
rowspan: 1,
|
|
595
|
+
colspan: 1
|
|
596
|
+
};
|
|
591
597
|
if (state.spanColumns.findIndex((f) => f.prop === pKey) !== -1) {
|
|
592
|
-
const rowspan =
|
|
598
|
+
const rowspan = state.tableSpanData[pKey]?.[rowIndex] ?? 0;
|
|
593
599
|
if (rowspan > 0) return {
|
|
594
600
|
rowspan,
|
|
595
601
|
colspan: 1
|
|
@@ -618,52 +624,6 @@ var table_default = defineComponent({
|
|
|
618
624
|
state.previewList = [url];
|
|
619
625
|
state.imagePreview = true;
|
|
620
626
|
};
|
|
621
|
-
onMounted(async () => {
|
|
622
|
-
state.initParam = getInitParam();
|
|
623
|
-
defaultSearchTime();
|
|
624
|
-
Object.entries(getInitParam()).forEach(([key, value]) => {
|
|
625
|
-
state.searchParam[key] = value;
|
|
626
|
-
});
|
|
627
|
-
await tableSearch();
|
|
628
|
-
watch(() => props.columns, () => {
|
|
629
|
-
loadTableColumns();
|
|
630
|
-
}, {
|
|
631
|
-
deep: true,
|
|
632
|
-
immediate: true
|
|
633
|
-
});
|
|
634
|
-
watch(() => props.initParam, () => {
|
|
635
|
-
Object.entries(getInitParam()).forEach(([key, value]) => {
|
|
636
|
-
state.searchParam[key] = value;
|
|
637
|
-
});
|
|
638
|
-
}, { deep: true });
|
|
639
|
-
watch(() => props.data, () => {
|
|
640
|
-
if (!props.requestApi && props.autoRefresh) return tableSearch();
|
|
641
|
-
}, {
|
|
642
|
-
deep: true,
|
|
643
|
-
immediate: true
|
|
644
|
-
});
|
|
645
|
-
watchEffect(() => {
|
|
646
|
-
const element = elementRef.value;
|
|
647
|
-
if (element) {
|
|
648
|
-
const observer = new ResizeObserver((entries) => {
|
|
649
|
-
for (const entry of entries) {
|
|
650
|
-
const { width, height } = entry.contentRect;
|
|
651
|
-
const widthChanged = state.tableWidth !== width;
|
|
652
|
-
state.tableWidth = width;
|
|
653
|
-
state.tableHeight = height;
|
|
654
|
-
if (widthChanged) resizeTableColumns();
|
|
655
|
-
}
|
|
656
|
-
});
|
|
657
|
-
observer.observe(element);
|
|
658
|
-
return () => {
|
|
659
|
-
observer.disconnect();
|
|
660
|
-
};
|
|
661
|
-
}
|
|
662
|
-
});
|
|
663
|
-
});
|
|
664
|
-
onActivated(() => {
|
|
665
|
-
handleTableColumnAutoWidth();
|
|
666
|
-
});
|
|
667
627
|
const tableColumnOmitNames = [
|
|
668
628
|
"multiOrder",
|
|
669
629
|
"columnId",
|
|
@@ -674,11 +634,53 @@ var table_default = defineComponent({
|
|
|
674
634
|
"pureSearch",
|
|
675
635
|
"search"
|
|
676
636
|
];
|
|
677
|
-
const searchFormSlotNames = computed(() => [...new Set(state.searchColumns.flatMap((column) =>
|
|
678
|
-
const tableColumnSlotNames = computed(() => [...new Set(state.tableColumns.flatMap((column) => [column.slot, column.headerSlot].filter((name) =>
|
|
637
|
+
const searchFormSlotNames = computed(() => [...new Set(state.searchColumns.flatMap((column) => typeof column.search?.slot === "string" ? [column.search.slot] : []))]);
|
|
638
|
+
const tableColumnSlotNames = computed(() => [...new Set(state.tableColumns.flatMap((column) => [column.slot, column.headerSlot].filter((name) => typeof name === "string")))]);
|
|
679
639
|
const searchInputClearable = computed(() => {
|
|
680
640
|
const value = state.searchParam.searchValue;
|
|
681
|
-
return value !== void 0 && value !==
|
|
641
|
+
return value !== void 0 && value !== "" || state.searchValueUpdate.length > 0;
|
|
642
|
+
});
|
|
643
|
+
watch(() => props.columns, () => {
|
|
644
|
+
loadTableColumns();
|
|
645
|
+
}, { deep: true });
|
|
646
|
+
watch(() => props.initParam, () => {
|
|
647
|
+
Object.entries(getInitParam()).forEach(([key, value]) => {
|
|
648
|
+
state.searchParam[key] = value;
|
|
649
|
+
});
|
|
650
|
+
}, { deep: true });
|
|
651
|
+
watch(() => props.data, () => {
|
|
652
|
+
if (!props.requestApi && props.autoRefresh) return tableSearch();
|
|
653
|
+
}, { deep: true });
|
|
654
|
+
watchEffect(() => {
|
|
655
|
+
const element = elementRef.value;
|
|
656
|
+
if (element) {
|
|
657
|
+
const observer = new ResizeObserver((entries) => {
|
|
658
|
+
for (const entry of entries) {
|
|
659
|
+
const { width, height } = entry.contentRect;
|
|
660
|
+
const widthChanged = state.tableWidth !== width;
|
|
661
|
+
state.tableWidth = width;
|
|
662
|
+
state.tableHeight = height;
|
|
663
|
+
if (widthChanged) resizeTableColumns();
|
|
664
|
+
}
|
|
665
|
+
});
|
|
666
|
+
observer.observe(element);
|
|
667
|
+
return () => {
|
|
668
|
+
observer.disconnect();
|
|
669
|
+
};
|
|
670
|
+
}
|
|
671
|
+
});
|
|
672
|
+
onMounted(async () => {
|
|
673
|
+
state.initParam = getInitParam();
|
|
674
|
+
defaultSearchTime();
|
|
675
|
+
Object.entries(getInitParam()).forEach(([key, value]) => {
|
|
676
|
+
state.searchParam[key] = value;
|
|
677
|
+
});
|
|
678
|
+
await tableSearch();
|
|
679
|
+
loadTableColumns();
|
|
680
|
+
if (!props.requestApi && props.autoRefresh) await tableSearch();
|
|
681
|
+
});
|
|
682
|
+
onActivated(() => {
|
|
683
|
+
handleTableColumnAutoWidth();
|
|
682
684
|
});
|
|
683
685
|
const elTableProps = useProps(props, tableProps, [
|
|
684
686
|
"data",
|
|
@@ -690,13 +692,13 @@ var table_default = defineComponent({
|
|
|
690
692
|
"ref": elementRef,
|
|
691
693
|
"class": [
|
|
692
694
|
"fa-table",
|
|
693
|
-
`fa-table-${
|
|
694
|
-
`fa-table__${props.tableKey
|
|
695
|
+
`fa-table-${globalSize.value}`,
|
|
696
|
+
`fa-table__${props.tableKey}`,
|
|
695
697
|
{ fa__click__disabled: state.loading }
|
|
696
698
|
],
|
|
697
699
|
"style": {
|
|
698
|
-
"--fa-table-width":
|
|
699
|
-
"--fa-table-height":
|
|
700
|
+
"--fa-table-width": state.tableWidth ? `${state.tableWidth}px` : "",
|
|
701
|
+
"--fa-table-height": state.tableHeight ? `${state.tableHeight}px` : ""
|
|
700
702
|
}
|
|
701
703
|
}, [
|
|
702
704
|
createVNode(tableSearchForm_default, {
|
|
@@ -731,13 +733,9 @@ var table_default = defineComponent({
|
|
|
731
733
|
"onCompositionend": () => {
|
|
732
734
|
state.searchValueUpdate = "";
|
|
733
735
|
},
|
|
734
|
-
"onChange":
|
|
735
|
-
tableSearch();
|
|
736
|
-
}
|
|
736
|
+
"onChange": tableSearch
|
|
737
737
|
}, null), createVNode("div", { "class": "fa-table__main-header-right__div-search__hidden" }, [state.searchParam.searchValue, state.searchValueUpdate])]),
|
|
738
|
-
props.requestApi && !props.hideSearchTime && createVNode(ElDatePicker, mergeProps({ onChange:
|
|
739
|
-
tableSearch();
|
|
740
|
-
} }, {
|
|
738
|
+
props.requestApi && !props.hideSearchTime && createVNode(ElDatePicker, mergeProps({ onChange: tableSearch }, {
|
|
741
739
|
"class": "fa-table__main-header-right__data-search",
|
|
742
740
|
"popperClass": "fa-table__main-header-right__data-search__popper",
|
|
743
741
|
"disabled": state.loading,
|
|
@@ -758,9 +756,7 @@ var table_default = defineComponent({
|
|
|
758
756
|
"title": "刷新",
|
|
759
757
|
"circle": true,
|
|
760
758
|
"icon": Refresh,
|
|
761
|
-
"onClick":
|
|
762
|
-
tableSearch();
|
|
763
|
-
}
|
|
759
|
+
"onClick": tableSearch
|
|
764
760
|
}, null),
|
|
765
761
|
props.searchBtn && state.searchColumns.length > 0 && createVNode(ElButton, {
|
|
766
762
|
"loading": state.loading,
|
|
@@ -783,9 +779,7 @@ var table_default = defineComponent({
|
|
|
783
779
|
dropdown: () => createVNode(ElDropdownMenu, null, { default: () => [slots.columnSetting?.(), createVNode(ElDropdownItem, {
|
|
784
780
|
"title": "表格列配置",
|
|
785
781
|
"divided": true,
|
|
786
|
-
"onClick": () =>
|
|
787
|
-
columnSettingRef.value?.open();
|
|
788
|
-
}
|
|
782
|
+
"onClick": () => columnSettingRef.value?.open()
|
|
789
783
|
}, { default: () => [createTextVNode("表格列配置")] })] })
|
|
790
784
|
}),
|
|
791
785
|
slots.toolButton?.({
|
|
@@ -886,7 +880,7 @@ var table_default = defineComponent({
|
|
|
886
880
|
...getTableDefaultSlots(state)
|
|
887
881
|
})])
|
|
888
882
|
}),
|
|
889
|
-
state.tableColumns
|
|
883
|
+
state.tableColumns.length === 0 ? slots.default?.() : state.tableColumns.map((col) => col.show && (col.type === "expand" ? createVNode(ElTableColumn, mergeProps(col, {
|
|
890
884
|
"width": 35,
|
|
891
885
|
"fixed": col.fixed ?? "left",
|
|
892
886
|
"resizable": false
|