fast-element-plus 2.0.16 → 2.0.18
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 +26 -0
- package/CONTRIBUTING.md +8 -0
- package/dist/component.d.ts +6564 -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/src/contextMenu.mjs +8 -7
- 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 +6 -7
- package/dist/components/dialog/src/dialog.mjs.map +1 -1
- package/dist/components/drawer/src/drawer.mjs +14 -14
- package/dist/components/drawer/src/drawer.mjs.map +1 -1
- package/dist/components/form/src/form.d.ts +36 -24
- 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 +3 -3
- 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 +2 -2
- package/dist/components/form/utils/form.mjs +2 -2
- 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 +2 -2
- package/dist/components/image/src/image.mjs.map +1 -1
- package/dist/components/inputDialogPage/src/inputDialogPage.mjs +10 -12
- package/dist/components/inputDialogPage/src/inputDialogPage.mjs.map +1 -1
- package/dist/components/layoutGrid/src/layoutGrid.d.ts +23 -11
- package/dist/components/layoutGrid/src/layoutGrid.mjs +42 -43
- 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/src/select.d.ts +27 -12
- package/dist/components/select/src/select.mjs +46 -44
- 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 +24 -9
- 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 +49 -29
- package/dist/components/selectV2/src/selectV2.mjs +64 -62
- package/dist/components/selectV2/src/selectV2.mjs.map +1 -1
- package/dist/components/table/src/table.d.ts +63 -29
- package/dist/components/table/src/table.mjs +77 -81
- 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 +13 -13
- package/dist/components/table/src/tableColumn.mjs +17 -30
- package/dist/components/table/src/tableColumn.mjs.map +1 -1
- package/dist/components/table/src/tableColumnSettingDialog.mjs +24 -14
- 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 +24 -27
- 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 +13 -14
- package/dist/components/table/src/useTable.mjs.map +1 -1
- package/dist/components/table/utils/table.mjs +5 -7
- package/dist/components/table/utils/table.mjs.map +1 -1
- package/dist/components/tree/src/tree.d.ts +6 -6
- package/dist/components/tree/src/tree.mjs +28 -26
- package/dist/components/tree/src/tree.mjs.map +1 -1
- package/dist/components/treeSelect/src/treeSelect.d.ts +30 -27
- package/dist/components/treeSelect/src/treeSelect.mjs +45 -43
- 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 +4 -5
- package/dist/components/upload/src/upload.mjs.map +1 -1
- package/dist/components/upload/src/useUpload.mjs +5 -7
- package/dist/components/upload/src/useUpload.mjs.map +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 +4 -16
- package/dist/components/uploadImage/src/uploadImage.mjs +7 -13
- package/dist/components/uploadImage/src/uploadImage.mjs.map +1 -1
- package/dist/components/uploadImages/src/uploadImages.d.ts +1 -1
- package/dist/components/uploadImages/src/uploadImages.mjs +7 -8
- package/dist/components/uploadImages/src/uploadImages.mjs.map +1 -1
- package/dist/directives/click-copy/index.mjs +5 -9
- package/dist/directives/click-copy/index.mjs.map +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/utils/async/index.mjs.map +1 -1
- package/dist/utils/date/index.mjs.map +1 -1
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/object/index.d.ts +30 -0
- package/dist/utils/object/index.mjs +159 -0
- package/dist/utils/object/index.mjs.map +1 -0
- 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 +7 -11
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { TableColumnCtx, TableProps } from "element-plus";
|
|
2
2
|
import type { CSSProperties, PropType } from "vue";
|
|
3
|
-
import type {
|
|
3
|
+
import type { FaLayoutGridBreakpoint } from "../../layoutGrid";
|
|
4
4
|
import type { PagedInput, PagedResult } from "../src/page.type";
|
|
5
5
|
import type { DefaultRow } from "./table.state";
|
|
6
6
|
import type { FaTableColumnCtx, FaTableDataRange, FaTableDefaultSlotsResult } from "./table.type";
|
|
@@ -18,7 +18,7 @@ export declare const tableProps: {
|
|
|
18
18
|
*/
|
|
19
19
|
data: {
|
|
20
20
|
type: PropType<DefaultRow[]>;
|
|
21
|
-
default: () =>
|
|
21
|
+
default: () => never[];
|
|
22
22
|
};
|
|
23
23
|
/**
|
|
24
24
|
* @description size of Table
|
|
@@ -165,7 +165,11 @@ export declare const tableProps: {
|
|
|
165
165
|
*/
|
|
166
166
|
treeProps: {
|
|
167
167
|
type: PropType<TreeProps>;
|
|
168
|
-
default: () =>
|
|
168
|
+
default: () => {
|
|
169
|
+
hasChildren: string;
|
|
170
|
+
children: string;
|
|
171
|
+
checkStrictly: boolean;
|
|
172
|
+
};
|
|
169
173
|
};
|
|
170
174
|
/**
|
|
171
175
|
* @description whether to lazy loading data
|
|
@@ -177,7 +181,7 @@ export declare const tableProps: {
|
|
|
177
181
|
load: PropType<TableProps<DefaultRow>["load"]>;
|
|
178
182
|
style: {
|
|
179
183
|
type: PropType<CSSProperties>;
|
|
180
|
-
default: () =>
|
|
184
|
+
default: () => {};
|
|
181
185
|
};
|
|
182
186
|
className: {
|
|
183
187
|
type: StringConstructor;
|
|
@@ -250,7 +254,7 @@ export declare const faTableProps: {
|
|
|
250
254
|
/** @description 表格数据 */
|
|
251
255
|
data: {
|
|
252
256
|
type: PropType<DefaultRow[]>;
|
|
253
|
-
default: () =>
|
|
257
|
+
default: () => never[];
|
|
254
258
|
};
|
|
255
259
|
/** @description 请求api */
|
|
256
260
|
requestApi: {
|
|
@@ -265,7 +269,7 @@ export declare const faTableProps: {
|
|
|
265
269
|
/** @description 列配置 */
|
|
266
270
|
columns: {
|
|
267
271
|
type: PropType<false | FaTableColumnCtx[]>;
|
|
268
|
-
default: () =>
|
|
272
|
+
default: () => boolean;
|
|
269
273
|
};
|
|
270
274
|
/** @description 表格列改变 */
|
|
271
275
|
columnsChange: {
|
|
@@ -273,8 +277,14 @@ export declare const faTableProps: {
|
|
|
273
277
|
};
|
|
274
278
|
/** @description 搜索表单 Grid布局列配置 */
|
|
275
279
|
searchFormCols: {
|
|
276
|
-
type: PropType<string | number | Record<
|
|
277
|
-
default: () =>
|
|
280
|
+
type: PropType<string | number | Record<FaLayoutGridBreakpoint, number>>;
|
|
281
|
+
default: () => {
|
|
282
|
+
xs: number;
|
|
283
|
+
sm: number;
|
|
284
|
+
md: number;
|
|
285
|
+
lg: number;
|
|
286
|
+
xl: number;
|
|
287
|
+
};
|
|
278
288
|
};
|
|
279
289
|
/** @description 折叠搜素 */
|
|
280
290
|
collapsedSearch: {
|
|
@@ -350,8 +360,8 @@ export declare const faTableProps: {
|
|
|
350
360
|
children?: string;
|
|
351
361
|
}>;
|
|
352
362
|
default: () => {
|
|
353
|
-
span
|
|
354
|
-
children
|
|
363
|
+
span: undefined;
|
|
364
|
+
children: string;
|
|
355
365
|
};
|
|
356
366
|
};
|
|
357
367
|
/** @description 自动刷新,当传入 data 时候,如果存在更改则自动刷新 */
|
|
@@ -493,7 +503,11 @@ export declare const faTableProps: {
|
|
|
493
503
|
*/
|
|
494
504
|
treeProps: {
|
|
495
505
|
type: PropType<TreeProps>;
|
|
496
|
-
default: () =>
|
|
506
|
+
default: () => {
|
|
507
|
+
hasChildren: string;
|
|
508
|
+
children: string;
|
|
509
|
+
checkStrictly: boolean;
|
|
510
|
+
};
|
|
497
511
|
};
|
|
498
512
|
/**
|
|
499
513
|
* @description whether to lazy loading data
|
|
@@ -505,7 +519,7 @@ export declare const faTableProps: {
|
|
|
505
519
|
load: PropType<TableProps<DefaultRow>["load"]>;
|
|
506
520
|
style: {
|
|
507
521
|
type: PropType<CSSProperties>;
|
|
508
|
-
default: () =>
|
|
522
|
+
default: () => {};
|
|
509
523
|
};
|
|
510
524
|
className: {
|
|
511
525
|
type: StringConstructor;
|
|
@@ -683,7 +697,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
683
697
|
/** @description 表格数据 */
|
|
684
698
|
data: {
|
|
685
699
|
type: PropType<DefaultRow[]>;
|
|
686
|
-
default: () =>
|
|
700
|
+
default: () => never[];
|
|
687
701
|
};
|
|
688
702
|
/** @description 请求api */
|
|
689
703
|
requestApi: {
|
|
@@ -698,7 +712,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
698
712
|
/** @description 列配置 */
|
|
699
713
|
columns: {
|
|
700
714
|
type: PropType<false | FaTableColumnCtx[]>;
|
|
701
|
-
default: () =>
|
|
715
|
+
default: () => boolean;
|
|
702
716
|
};
|
|
703
717
|
/** @description 表格列改变 */
|
|
704
718
|
columnsChange: {
|
|
@@ -706,8 +720,14 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
706
720
|
};
|
|
707
721
|
/** @description 搜索表单 Grid布局列配置 */
|
|
708
722
|
searchFormCols: {
|
|
709
|
-
type: PropType<string | number | Record<
|
|
710
|
-
default: () =>
|
|
723
|
+
type: PropType<string | number | Record<FaLayoutGridBreakpoint, number>>;
|
|
724
|
+
default: () => {
|
|
725
|
+
xs: number;
|
|
726
|
+
sm: number;
|
|
727
|
+
md: number;
|
|
728
|
+
lg: number;
|
|
729
|
+
xl: number;
|
|
730
|
+
};
|
|
711
731
|
};
|
|
712
732
|
/** @description 折叠搜素 */
|
|
713
733
|
collapsedSearch: {
|
|
@@ -783,8 +803,8 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
783
803
|
children?: string;
|
|
784
804
|
}>;
|
|
785
805
|
default: () => {
|
|
786
|
-
span
|
|
787
|
-
children
|
|
806
|
+
span: undefined;
|
|
807
|
+
children: string;
|
|
788
808
|
};
|
|
789
809
|
};
|
|
790
810
|
/** @description 自动刷新,当传入 data 时候,如果存在更改则自动刷新 */
|
|
@@ -926,7 +946,11 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
926
946
|
*/
|
|
927
947
|
treeProps: {
|
|
928
948
|
type: PropType<TreeProps>;
|
|
929
|
-
default: () =>
|
|
949
|
+
default: () => {
|
|
950
|
+
hasChildren: string;
|
|
951
|
+
children: string;
|
|
952
|
+
checkStrictly: boolean;
|
|
953
|
+
};
|
|
930
954
|
};
|
|
931
955
|
/**
|
|
932
956
|
* @description whether to lazy loading data
|
|
@@ -938,7 +962,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
938
962
|
load: PropType<TableProps<DefaultRow>["load"]>;
|
|
939
963
|
style: {
|
|
940
964
|
type: PropType<CSSProperties>;
|
|
941
|
-
default: () =>
|
|
965
|
+
default: () => {};
|
|
942
966
|
};
|
|
943
967
|
className: {
|
|
944
968
|
type: StringConstructor;
|
|
@@ -1136,7 +1160,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
1136
1160
|
/** @description 表格数据 */
|
|
1137
1161
|
data: {
|
|
1138
1162
|
type: PropType<DefaultRow[]>;
|
|
1139
|
-
default: () =>
|
|
1163
|
+
default: () => never[];
|
|
1140
1164
|
};
|
|
1141
1165
|
/** @description 请求api */
|
|
1142
1166
|
requestApi: {
|
|
@@ -1151,7 +1175,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
1151
1175
|
/** @description 列配置 */
|
|
1152
1176
|
columns: {
|
|
1153
1177
|
type: PropType<false | FaTableColumnCtx[]>;
|
|
1154
|
-
default: () =>
|
|
1178
|
+
default: () => boolean;
|
|
1155
1179
|
};
|
|
1156
1180
|
/** @description 表格列改变 */
|
|
1157
1181
|
columnsChange: {
|
|
@@ -1159,8 +1183,14 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
1159
1183
|
};
|
|
1160
1184
|
/** @description 搜索表单 Grid布局列配置 */
|
|
1161
1185
|
searchFormCols: {
|
|
1162
|
-
type: PropType<string | number | Record<
|
|
1163
|
-
default: () =>
|
|
1186
|
+
type: PropType<string | number | Record<FaLayoutGridBreakpoint, number>>;
|
|
1187
|
+
default: () => {
|
|
1188
|
+
xs: number;
|
|
1189
|
+
sm: number;
|
|
1190
|
+
md: number;
|
|
1191
|
+
lg: number;
|
|
1192
|
+
xl: number;
|
|
1193
|
+
};
|
|
1164
1194
|
};
|
|
1165
1195
|
/** @description 折叠搜素 */
|
|
1166
1196
|
collapsedSearch: {
|
|
@@ -1236,8 +1266,8 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
1236
1266
|
children?: string;
|
|
1237
1267
|
}>;
|
|
1238
1268
|
default: () => {
|
|
1239
|
-
span
|
|
1240
|
-
children
|
|
1269
|
+
span: undefined;
|
|
1270
|
+
children: string;
|
|
1241
1271
|
};
|
|
1242
1272
|
};
|
|
1243
1273
|
/** @description 自动刷新,当传入 data 时候,如果存在更改则自动刷新 */
|
|
@@ -1379,7 +1409,11 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
1379
1409
|
*/
|
|
1380
1410
|
treeProps: {
|
|
1381
1411
|
type: PropType<TreeProps>;
|
|
1382
|
-
default: () =>
|
|
1412
|
+
default: () => {
|
|
1413
|
+
hasChildren: string;
|
|
1414
|
+
children: string;
|
|
1415
|
+
checkStrictly: boolean;
|
|
1416
|
+
};
|
|
1383
1417
|
};
|
|
1384
1418
|
/**
|
|
1385
1419
|
* @description whether to lazy loading data
|
|
@@ -1391,7 +1425,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
1391
1425
|
load: PropType<TableProps<DefaultRow>["load"]>;
|
|
1392
1426
|
style: {
|
|
1393
1427
|
type: PropType<CSSProperties>;
|
|
1394
|
-
default: () =>
|
|
1428
|
+
default: () => {};
|
|
1395
1429
|
};
|
|
1396
1430
|
className: {
|
|
1397
1431
|
type: StringConstructor;
|
|
@@ -1499,7 +1533,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
1499
1533
|
preserveExpandedContent: boolean;
|
|
1500
1534
|
nativeScrollbar: boolean;
|
|
1501
1535
|
tableKey: string;
|
|
1502
|
-
searchFormCols: string | number | Record<
|
|
1536
|
+
searchFormCols: string | number | Record<FaLayoutGridBreakpoint, number>;
|
|
1503
1537
|
collapsedSearch: boolean;
|
|
1504
1538
|
advancedSearchDrawer: boolean;
|
|
1505
1539
|
searchForm: boolean;
|
|
@@ -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,16 +442,16 @@ 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) => {
|
|
@@ -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);
|
|
@@ -561,7 +561,7 @@ var table_default = defineComponent({
|
|
|
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,
|
|
@@ -624,52 +624,6 @@ var table_default = defineComponent({
|
|
|
624
624
|
state.previewList = [url];
|
|
625
625
|
state.imagePreview = true;
|
|
626
626
|
};
|
|
627
|
-
onMounted(async () => {
|
|
628
|
-
state.initParam = getInitParam();
|
|
629
|
-
defaultSearchTime();
|
|
630
|
-
Object.entries(getInitParam()).forEach(([key, value]) => {
|
|
631
|
-
state.searchParam[key] = value;
|
|
632
|
-
});
|
|
633
|
-
await tableSearch();
|
|
634
|
-
watch(() => props.columns, () => {
|
|
635
|
-
loadTableColumns();
|
|
636
|
-
}, {
|
|
637
|
-
deep: true,
|
|
638
|
-
immediate: true
|
|
639
|
-
});
|
|
640
|
-
watch(() => props.initParam, () => {
|
|
641
|
-
Object.entries(getInitParam()).forEach(([key, value]) => {
|
|
642
|
-
state.searchParam[key] = value;
|
|
643
|
-
});
|
|
644
|
-
}, { deep: true });
|
|
645
|
-
watch(() => props.data, () => {
|
|
646
|
-
if (!props.requestApi && props.autoRefresh) return tableSearch();
|
|
647
|
-
}, {
|
|
648
|
-
deep: true,
|
|
649
|
-
immediate: true
|
|
650
|
-
});
|
|
651
|
-
watchEffect(() => {
|
|
652
|
-
const element = elementRef.value;
|
|
653
|
-
if (element) {
|
|
654
|
-
const observer = new ResizeObserver((entries) => {
|
|
655
|
-
for (const entry of entries) {
|
|
656
|
-
const { width, height } = entry.contentRect;
|
|
657
|
-
const widthChanged = state.tableWidth !== width;
|
|
658
|
-
state.tableWidth = width;
|
|
659
|
-
state.tableHeight = height;
|
|
660
|
-
if (widthChanged) resizeTableColumns();
|
|
661
|
-
}
|
|
662
|
-
});
|
|
663
|
-
observer.observe(element);
|
|
664
|
-
return () => {
|
|
665
|
-
observer.disconnect();
|
|
666
|
-
};
|
|
667
|
-
}
|
|
668
|
-
});
|
|
669
|
-
});
|
|
670
|
-
onActivated(() => {
|
|
671
|
-
handleTableColumnAutoWidth();
|
|
672
|
-
});
|
|
673
627
|
const tableColumnOmitNames = [
|
|
674
628
|
"multiOrder",
|
|
675
629
|
"columnId",
|
|
@@ -680,12 +634,54 @@ var table_default = defineComponent({
|
|
|
680
634
|
"pureSearch",
|
|
681
635
|
"search"
|
|
682
636
|
];
|
|
683
|
-
const searchFormSlotNames = computed(() => [...new Set(state.searchColumns.flatMap((column) =>
|
|
684
|
-
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")))]);
|
|
685
639
|
const searchInputClearable = computed(() => {
|
|
686
640
|
const value = state.searchParam.searchValue;
|
|
687
641
|
return value !== void 0 && value !== "" || state.searchValueUpdate.length > 0;
|
|
688
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();
|
|
684
|
+
});
|
|
689
685
|
const elTableProps = useProps(props, tableProps, [
|
|
690
686
|
"data",
|
|
691
687
|
"spanMethod",
|
|
@@ -696,7 +692,7 @@ var table_default = defineComponent({
|
|
|
696
692
|
"ref": elementRef,
|
|
697
693
|
"class": [
|
|
698
694
|
"fa-table",
|
|
699
|
-
`fa-table-${
|
|
695
|
+
`fa-table-${globalSize.value}`,
|
|
700
696
|
`fa-table__${props.tableKey}`,
|
|
701
697
|
{ fa__click__disabled: state.loading }
|
|
702
698
|
],
|