znyg-frontend-common 1.0.74 → 1.0.76
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/es/components/znTable/index.d.ts +428 -1
- package/es/components/znTable/src/components/ColSetting.vue.d.ts +2 -0
- package/es/components/znTable/src/components/ColSetting.vue2.mjs +5 -5
- package/es/components/znTable/src/components/ColSetting.vue2.mjs.map +1 -1
- package/es/components/znTable/src/index.vue.d.ts +428 -1
- package/es/components/znTable/src/index.vue2.mjs +13 -13
- package/es/components/znTable/src/index.vue2.mjs.map +1 -1
- package/es/hooks/useDialogV2/src/index.d.ts +1 -1
- package/es/hooks/useDialogV2/src/index.mjs +1 -1
- package/es/hooks/useDialogV2/src/index.mjs.map +1 -1
- package/es/hooks/useDrawerV2/src/index.d.ts +1 -1
- package/es/hooks/useDrawerV2/src/index.mjs +1 -1
- package/es/hooks/useDrawerV2/src/index.mjs.map +1 -1
- package/es/index.mjs +1 -1
- package/es/index.mjs.map +1 -1
- package/lib/components/znTable/index.d.ts +428 -1
- package/lib/components/znTable/src/components/ColSetting.vue.d.ts +2 -0
- package/lib/components/znTable/src/components/ColSetting.vue2.js +6 -6
- package/lib/components/znTable/src/components/ColSetting.vue2.js.map +1 -1
- package/lib/components/znTable/src/index.vue.d.ts +428 -1
- package/lib/components/znTable/src/index.vue2.js +8 -8
- package/lib/components/znTable/src/index.vue2.js.map +1 -1
- package/lib/hooks/useDialogV2/src/index.d.ts +1 -1
- package/lib/hooks/useDialogV2/src/index.js +1 -1
- package/lib/hooks/useDialogV2/src/index.js.map +1 -1
- package/lib/hooks/useDrawerV2/src/index.d.ts +1 -1
- package/lib/hooks/useDrawerV2/src/index.js +1 -1
- package/lib/hooks/useDrawerV2/src/index.js.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1060,7 +1060,429 @@ export declare const ZnTable: import("../../types").SFCWithInstall<import("vue")
|
|
|
1060
1060
|
flatColumnsFunc: (columns: ColumnProps[], flatArr?: ColumnProps[]) => ColumnProps<any>[];
|
|
1061
1061
|
searchColumns: import("vue").ComputedRef<ColumnProps<any>[]>;
|
|
1062
1062
|
colRef: import("vue").Ref<any, any>;
|
|
1063
|
-
colSetting: import("vue").
|
|
1063
|
+
colSetting: import("vue").Ref<{
|
|
1064
|
+
type?: import("./src/interface/index").TypeProps;
|
|
1065
|
+
tag?: boolean;
|
|
1066
|
+
isShow?: boolean;
|
|
1067
|
+
isShowInView?: boolean;
|
|
1068
|
+
search?: {
|
|
1069
|
+
el?: import("./src/interface/index").SearchType;
|
|
1070
|
+
label?: string;
|
|
1071
|
+
props?: any;
|
|
1072
|
+
key?: string;
|
|
1073
|
+
tooltip?: string;
|
|
1074
|
+
order?: number;
|
|
1075
|
+
span?: number;
|
|
1076
|
+
offset?: number;
|
|
1077
|
+
defaultValue?: any;
|
|
1078
|
+
render?: (scope: import("./src/interface/index").SearchRenderScope) => import("vue").VNode;
|
|
1079
|
+
xs?: {
|
|
1080
|
+
span?: number;
|
|
1081
|
+
offset?: number;
|
|
1082
|
+
};
|
|
1083
|
+
sm?: {
|
|
1084
|
+
span?: number;
|
|
1085
|
+
offset?: number;
|
|
1086
|
+
};
|
|
1087
|
+
md?: {
|
|
1088
|
+
span?: number;
|
|
1089
|
+
offset?: number;
|
|
1090
|
+
};
|
|
1091
|
+
lg?: {
|
|
1092
|
+
span?: number;
|
|
1093
|
+
offset?: number;
|
|
1094
|
+
};
|
|
1095
|
+
xl?: {
|
|
1096
|
+
span?: number;
|
|
1097
|
+
offset?: number;
|
|
1098
|
+
};
|
|
1099
|
+
};
|
|
1100
|
+
dictCode?: string;
|
|
1101
|
+
enum?: import("./src/interface/index").EnumProps[] | ((params?: any) => Promise<any>) | {
|
|
1102
|
+
[x: string]: any;
|
|
1103
|
+
label?: string;
|
|
1104
|
+
value?: string | number | boolean | any[];
|
|
1105
|
+
disabled?: boolean;
|
|
1106
|
+
tagType?: string;
|
|
1107
|
+
children?: any[];
|
|
1108
|
+
}[];
|
|
1109
|
+
isFilterEnum?: boolean;
|
|
1110
|
+
fieldNames?: {
|
|
1111
|
+
label: string;
|
|
1112
|
+
value: string;
|
|
1113
|
+
children?: string;
|
|
1114
|
+
};
|
|
1115
|
+
headerRender?: (scope: import("./src/interface/index").HeaderRenderScope<any>) => import("vue").VNode;
|
|
1116
|
+
render?: (scope: import("./src/interface/index").RenderScope<any>) => import("vue").VNode | string | `dateFormat@${string}`;
|
|
1117
|
+
renderInView?: (scope: import("./src/interface/index").RenderScope<any>) => import("vue").VNode | string;
|
|
1118
|
+
_children?: any[];
|
|
1119
|
+
props?: {
|
|
1120
|
+
[x: string]: any;
|
|
1121
|
+
btns?: {
|
|
1122
|
+
[x: string]: any;
|
|
1123
|
+
name: string;
|
|
1124
|
+
label: string;
|
|
1125
|
+
type?: "primary" | "success" | "warning" | "danger" | "info" | "text";
|
|
1126
|
+
size?: "large" | "default" | "small";
|
|
1127
|
+
disabled?: boolean;
|
|
1128
|
+
icon?: any;
|
|
1129
|
+
show?: boolean | ((row: any) => boolean);
|
|
1130
|
+
}[];
|
|
1131
|
+
maxCount?: number;
|
|
1132
|
+
moreText?: string;
|
|
1133
|
+
minWidth?: string;
|
|
1134
|
+
};
|
|
1135
|
+
width?: string | number;
|
|
1136
|
+
fixed?: boolean | string;
|
|
1137
|
+
filters?: {
|
|
1138
|
+
text: string;
|
|
1139
|
+
value: string;
|
|
1140
|
+
}[];
|
|
1141
|
+
label?: string;
|
|
1142
|
+
index?: number | ((index: number) => number);
|
|
1143
|
+
minWidth?: string | number;
|
|
1144
|
+
id?: string;
|
|
1145
|
+
realWidth?: number;
|
|
1146
|
+
className?: string;
|
|
1147
|
+
labelClassName?: string;
|
|
1148
|
+
property?: string;
|
|
1149
|
+
prop?: string;
|
|
1150
|
+
sortable?: boolean | string;
|
|
1151
|
+
sortMethod?: (a: any, b: any) => number;
|
|
1152
|
+
sortBy?: string | string[] | ((row: any, index: number) => string);
|
|
1153
|
+
resizable?: boolean;
|
|
1154
|
+
columnKey?: string;
|
|
1155
|
+
rawColumnKey?: string;
|
|
1156
|
+
align?: string;
|
|
1157
|
+
headerAlign?: string;
|
|
1158
|
+
showOverflowTooltip?: boolean | {
|
|
1159
|
+
showArrow?: import("element-plus/es/utils").EpPropMergeType<BooleanConstructor, unknown, unknown>;
|
|
1160
|
+
appendTo?: import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => string | HTMLElement) | (() => string | HTMLElement) | ((new (...args: any[]) => string | HTMLElement) | (() => string | HTMLElement))[], unknown, unknown>;
|
|
1161
|
+
transition?: string;
|
|
1162
|
+
effect?: import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => string) | (() => import("element-plus").PopperEffect) | ((new (...args: any[]) => string) | (() => import("element-plus").PopperEffect))[], unknown, unknown>;
|
|
1163
|
+
enterable?: import("element-plus/es/utils").EpPropMergeType<BooleanConstructor, unknown, unknown>;
|
|
1164
|
+
popperClass?: import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => string | {
|
|
1165
|
+
[x: string]: boolean;
|
|
1166
|
+
} | (string | {
|
|
1167
|
+
[x: string]: boolean;
|
|
1168
|
+
} | (string | {
|
|
1169
|
+
[x: string]: boolean;
|
|
1170
|
+
} | (string | {
|
|
1171
|
+
[x: string]: boolean;
|
|
1172
|
+
} | (string | {
|
|
1173
|
+
[x: string]: boolean;
|
|
1174
|
+
} | (string | {
|
|
1175
|
+
[x: string]: boolean;
|
|
1176
|
+
} | (string | {
|
|
1177
|
+
[x: string]: boolean;
|
|
1178
|
+
} | (string | {
|
|
1179
|
+
[x: string]: boolean;
|
|
1180
|
+
} | (string | {
|
|
1181
|
+
[x: string]: boolean;
|
|
1182
|
+
} | (string | {
|
|
1183
|
+
[x: string]: boolean;
|
|
1184
|
+
} | (string | {
|
|
1185
|
+
[x: string]: boolean;
|
|
1186
|
+
} | (string | {
|
|
1187
|
+
[x: string]: boolean;
|
|
1188
|
+
} | any)[])[])[])[])[])[])[])[])[])[])[]) | (() => string | {
|
|
1189
|
+
[x: string]: boolean;
|
|
1190
|
+
} | (string | {
|
|
1191
|
+
[x: string]: boolean;
|
|
1192
|
+
} | (string | {
|
|
1193
|
+
[x: string]: boolean;
|
|
1194
|
+
} | (string | {
|
|
1195
|
+
[x: string]: boolean;
|
|
1196
|
+
} | (string | {
|
|
1197
|
+
[x: string]: boolean;
|
|
1198
|
+
} | (string | {
|
|
1199
|
+
[x: string]: boolean;
|
|
1200
|
+
} | (string | {
|
|
1201
|
+
[x: string]: boolean;
|
|
1202
|
+
} | (string | {
|
|
1203
|
+
[x: string]: boolean;
|
|
1204
|
+
} | (string | {
|
|
1205
|
+
[x: string]: boolean;
|
|
1206
|
+
} | (string | {
|
|
1207
|
+
[x: string]: boolean;
|
|
1208
|
+
} | (string | {
|
|
1209
|
+
[x: string]: boolean;
|
|
1210
|
+
} | (string | {
|
|
1211
|
+
[x: string]: boolean;
|
|
1212
|
+
} | any)[])[])[])[])[])[])[])[])[])[])[]) | ((new (...args: any[]) => string | {
|
|
1213
|
+
[x: string]: boolean;
|
|
1214
|
+
} | (string | {
|
|
1215
|
+
[x: string]: boolean;
|
|
1216
|
+
} | (string | {
|
|
1217
|
+
[x: string]: boolean;
|
|
1218
|
+
} | (string | {
|
|
1219
|
+
[x: string]: boolean;
|
|
1220
|
+
} | (string | {
|
|
1221
|
+
[x: string]: boolean;
|
|
1222
|
+
} | (string | {
|
|
1223
|
+
[x: string]: boolean;
|
|
1224
|
+
} | (string | {
|
|
1225
|
+
[x: string]: boolean;
|
|
1226
|
+
} | (string | {
|
|
1227
|
+
[x: string]: boolean;
|
|
1228
|
+
} | (string | {
|
|
1229
|
+
[x: string]: boolean;
|
|
1230
|
+
} | (string | {
|
|
1231
|
+
[x: string]: boolean;
|
|
1232
|
+
} | (string | {
|
|
1233
|
+
[x: string]: boolean;
|
|
1234
|
+
} | (string | {
|
|
1235
|
+
[x: string]: boolean;
|
|
1236
|
+
} | any)[])[])[])[])[])[])[])[])[])[])[]) | (() => string | {
|
|
1237
|
+
[x: string]: boolean;
|
|
1238
|
+
} | (string | {
|
|
1239
|
+
[x: string]: boolean;
|
|
1240
|
+
} | (string | {
|
|
1241
|
+
[x: string]: boolean;
|
|
1242
|
+
} | (string | {
|
|
1243
|
+
[x: string]: boolean;
|
|
1244
|
+
} | (string | {
|
|
1245
|
+
[x: string]: boolean;
|
|
1246
|
+
} | (string | {
|
|
1247
|
+
[x: string]: boolean;
|
|
1248
|
+
} | (string | {
|
|
1249
|
+
[x: string]: boolean;
|
|
1250
|
+
} | (string | {
|
|
1251
|
+
[x: string]: boolean;
|
|
1252
|
+
} | (string | {
|
|
1253
|
+
[x: string]: boolean;
|
|
1254
|
+
} | (string | {
|
|
1255
|
+
[x: string]: boolean;
|
|
1256
|
+
} | (string | {
|
|
1257
|
+
[x: string]: boolean;
|
|
1258
|
+
} | (string | {
|
|
1259
|
+
[x: string]: boolean;
|
|
1260
|
+
} | any)[])[])[])[])[])[])[])[])[])[])[]))[], unknown, unknown>;
|
|
1261
|
+
offset?: number;
|
|
1262
|
+
placement?: import("element-plus/es/utils").EpPropMergeType<StringConstructor, import("element-plus").Placement, unknown>;
|
|
1263
|
+
popperOptions?: {
|
|
1264
|
+
placement?: import("element-plus").Placement;
|
|
1265
|
+
modifiers?: {
|
|
1266
|
+
name?: any;
|
|
1267
|
+
enabled?: boolean;
|
|
1268
|
+
phase?: import("@popperjs/core").ModifierPhases;
|
|
1269
|
+
requires?: Array<string>;
|
|
1270
|
+
requiresIfExists?: Array<string>;
|
|
1271
|
+
fn?: (arg0: import("@popperjs/core").ModifierArguments<any>) => import("@popperjs/core").State | void;
|
|
1272
|
+
effect?: (arg0: import("@popperjs/core").ModifierArguments<any>) => (() => void) | void;
|
|
1273
|
+
options?: Partial<any>;
|
|
1274
|
+
data?: import("@popperjs/core").Obj;
|
|
1275
|
+
}[];
|
|
1276
|
+
strategy?: import("@popperjs/core").PositioningStrategy;
|
|
1277
|
+
onFirstUpdate?: (arg0: Partial<import("@popperjs/core").State>) => void;
|
|
1278
|
+
};
|
|
1279
|
+
showAfter?: number;
|
|
1280
|
+
hideAfter?: number;
|
|
1281
|
+
};
|
|
1282
|
+
tooltipFormatter?: import("element-plus/es/components/table/src/util").TableOverflowTooltipFormatter<any>;
|
|
1283
|
+
formatter?: (row: any, column: import("element-plus").TableColumnCtx<any>, cellValue: any, index: number) => import("vue").VNode | string;
|
|
1284
|
+
selectable?: (row: any, index: number) => boolean;
|
|
1285
|
+
reserveSelection?: boolean;
|
|
1286
|
+
filterMethod?: import("element-plus/es/components/table/src/table-column/defaults").FilterMethods<any>;
|
|
1287
|
+
filteredValue?: string[];
|
|
1288
|
+
filterPlacement?: string;
|
|
1289
|
+
filterMultiple?: boolean;
|
|
1290
|
+
filterClassName?: string;
|
|
1291
|
+
sortOrders?: ("ascending" | "descending" | null)[];
|
|
1292
|
+
colSpan?: number;
|
|
1293
|
+
rowSpan?: number;
|
|
1294
|
+
level?: number;
|
|
1295
|
+
filterable?: boolean | {
|
|
1296
|
+
text: string;
|
|
1297
|
+
value: string;
|
|
1298
|
+
}[] | import("element-plus/es/components/table/src/table-column/defaults").FilterMethods<any>;
|
|
1299
|
+
order?: string;
|
|
1300
|
+
isColumnGroup?: boolean;
|
|
1301
|
+
isSubColumn?: boolean;
|
|
1302
|
+
columns?: {
|
|
1303
|
+
id: string;
|
|
1304
|
+
realWidth: number;
|
|
1305
|
+
type: string;
|
|
1306
|
+
label: string;
|
|
1307
|
+
className: string;
|
|
1308
|
+
labelClassName: string;
|
|
1309
|
+
property: string;
|
|
1310
|
+
prop: string;
|
|
1311
|
+
width: string | number;
|
|
1312
|
+
minWidth: string | number;
|
|
1313
|
+
renderHeader: (data: {
|
|
1314
|
+
column: import("element-plus").TableColumnCtx<any>;
|
|
1315
|
+
$index: number;
|
|
1316
|
+
}) => import("vue").VNode;
|
|
1317
|
+
sortable: boolean | string;
|
|
1318
|
+
sortMethod: (a: any, b: any) => number;
|
|
1319
|
+
sortBy: string | string[] | ((row: any, index: number) => string);
|
|
1320
|
+
resizable: boolean;
|
|
1321
|
+
columnKey: string;
|
|
1322
|
+
rawColumnKey: string;
|
|
1323
|
+
align: string;
|
|
1324
|
+
headerAlign: string;
|
|
1325
|
+
showOverflowTooltip?: boolean | {
|
|
1326
|
+
showArrow?: import("element-plus/es/utils").EpPropMergeType<BooleanConstructor, unknown, unknown>;
|
|
1327
|
+
appendTo?: import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => string | HTMLElement) | (() => string | HTMLElement) | ((new (...args: any[]) => string | HTMLElement) | (() => string | HTMLElement))[], unknown, unknown>;
|
|
1328
|
+
transition?: string;
|
|
1329
|
+
effect?: import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => string) | (() => import("element-plus").PopperEffect) | ((new (...args: any[]) => string) | (() => import("element-plus").PopperEffect))[], unknown, unknown>;
|
|
1330
|
+
enterable?: import("element-plus/es/utils").EpPropMergeType<BooleanConstructor, unknown, unknown>;
|
|
1331
|
+
popperClass?: import("element-plus/es/utils").EpPropMergeType<(new (...args: any[]) => string | {
|
|
1332
|
+
[x: string]: boolean;
|
|
1333
|
+
} | (string | {
|
|
1334
|
+
[x: string]: boolean;
|
|
1335
|
+
} | (string | {
|
|
1336
|
+
[x: string]: boolean;
|
|
1337
|
+
} | (string | {
|
|
1338
|
+
[x: string]: boolean;
|
|
1339
|
+
} | (string | {
|
|
1340
|
+
[x: string]: boolean;
|
|
1341
|
+
} | (string | {
|
|
1342
|
+
[x: string]: boolean;
|
|
1343
|
+
} | (string | {
|
|
1344
|
+
[x: string]: boolean;
|
|
1345
|
+
} | (string | {
|
|
1346
|
+
[x: string]: boolean;
|
|
1347
|
+
} | (string | {
|
|
1348
|
+
[x: string]: boolean;
|
|
1349
|
+
} | (string | {
|
|
1350
|
+
[x: string]: boolean;
|
|
1351
|
+
} | (string | {
|
|
1352
|
+
[x: string]: boolean;
|
|
1353
|
+
} | (string | {
|
|
1354
|
+
[x: string]: boolean;
|
|
1355
|
+
} | any)[])[])[])[])[])[])[])[])[])[])[]) | (() => string | {
|
|
1356
|
+
[x: string]: boolean;
|
|
1357
|
+
} | (string | {
|
|
1358
|
+
[x: string]: boolean;
|
|
1359
|
+
} | (string | {
|
|
1360
|
+
[x: string]: boolean;
|
|
1361
|
+
} | (string | {
|
|
1362
|
+
[x: string]: boolean;
|
|
1363
|
+
} | (string | {
|
|
1364
|
+
[x: string]: boolean;
|
|
1365
|
+
} | (string | {
|
|
1366
|
+
[x: string]: boolean;
|
|
1367
|
+
} | (string | {
|
|
1368
|
+
[x: string]: boolean;
|
|
1369
|
+
} | (string | {
|
|
1370
|
+
[x: string]: boolean;
|
|
1371
|
+
} | (string | {
|
|
1372
|
+
[x: string]: boolean;
|
|
1373
|
+
} | (string | {
|
|
1374
|
+
[x: string]: boolean;
|
|
1375
|
+
} | (string | {
|
|
1376
|
+
[x: string]: boolean;
|
|
1377
|
+
} | (string | {
|
|
1378
|
+
[x: string]: boolean;
|
|
1379
|
+
} | any)[])[])[])[])[])[])[])[])[])[])[]) | ((new (...args: any[]) => string | {
|
|
1380
|
+
[x: string]: boolean;
|
|
1381
|
+
} | (string | {
|
|
1382
|
+
[x: string]: boolean;
|
|
1383
|
+
} | (string | {
|
|
1384
|
+
[x: string]: boolean;
|
|
1385
|
+
} | (string | {
|
|
1386
|
+
[x: string]: boolean;
|
|
1387
|
+
} | (string | {
|
|
1388
|
+
[x: string]: boolean;
|
|
1389
|
+
} | (string | {
|
|
1390
|
+
[x: string]: boolean;
|
|
1391
|
+
} | (string | {
|
|
1392
|
+
[x: string]: boolean;
|
|
1393
|
+
} | (string | {
|
|
1394
|
+
[x: string]: boolean;
|
|
1395
|
+
} | (string | {
|
|
1396
|
+
[x: string]: boolean;
|
|
1397
|
+
} | (string | {
|
|
1398
|
+
[x: string]: boolean;
|
|
1399
|
+
} | (string | {
|
|
1400
|
+
[x: string]: boolean;
|
|
1401
|
+
} | (string | {
|
|
1402
|
+
[x: string]: boolean;
|
|
1403
|
+
} | any)[])[])[])[])[])[])[])[])[])[])[]) | (() => string | {
|
|
1404
|
+
[x: string]: boolean;
|
|
1405
|
+
} | (string | {
|
|
1406
|
+
[x: string]: boolean;
|
|
1407
|
+
} | (string | {
|
|
1408
|
+
[x: string]: boolean;
|
|
1409
|
+
} | (string | {
|
|
1410
|
+
[x: string]: boolean;
|
|
1411
|
+
} | (string | {
|
|
1412
|
+
[x: string]: boolean;
|
|
1413
|
+
} | (string | {
|
|
1414
|
+
[x: string]: boolean;
|
|
1415
|
+
} | (string | {
|
|
1416
|
+
[x: string]: boolean;
|
|
1417
|
+
} | (string | {
|
|
1418
|
+
[x: string]: boolean;
|
|
1419
|
+
} | (string | {
|
|
1420
|
+
[x: string]: boolean;
|
|
1421
|
+
} | (string | {
|
|
1422
|
+
[x: string]: boolean;
|
|
1423
|
+
} | (string | {
|
|
1424
|
+
[x: string]: boolean;
|
|
1425
|
+
} | (string | {
|
|
1426
|
+
[x: string]: boolean;
|
|
1427
|
+
} | any)[])[])[])[])[])[])[])[])[])[])[]))[], unknown, unknown>;
|
|
1428
|
+
offset?: number;
|
|
1429
|
+
placement?: import("element-plus/es/utils").EpPropMergeType<StringConstructor, import("element-plus").Placement, unknown>;
|
|
1430
|
+
popperOptions?: {
|
|
1431
|
+
placement?: import("element-plus").Placement;
|
|
1432
|
+
modifiers?: {
|
|
1433
|
+
name?: any;
|
|
1434
|
+
enabled?: boolean;
|
|
1435
|
+
phase?: import("@popperjs/core").ModifierPhases;
|
|
1436
|
+
requires?: Array<string>;
|
|
1437
|
+
requiresIfExists?: Array<string>;
|
|
1438
|
+
fn?: (arg0: import("@popperjs/core").ModifierArguments<any>) => import("@popperjs/core").State | void;
|
|
1439
|
+
effect?: (arg0: import("@popperjs/core").ModifierArguments<any>) => (() => void) | void;
|
|
1440
|
+
options?: Partial<any>;
|
|
1441
|
+
data?: import("@popperjs/core").Obj;
|
|
1442
|
+
}[];
|
|
1443
|
+
strategy?: import("@popperjs/core").PositioningStrategy;
|
|
1444
|
+
onFirstUpdate?: (arg0: Partial<import("@popperjs/core").State>) => void;
|
|
1445
|
+
};
|
|
1446
|
+
showAfter?: number;
|
|
1447
|
+
hideAfter?: number;
|
|
1448
|
+
};
|
|
1449
|
+
tooltipFormatter?: import("element-plus/es/components/table/src/util").TableOverflowTooltipFormatter<any>;
|
|
1450
|
+
fixed: boolean | string;
|
|
1451
|
+
formatter: (row: any, column: import("element-plus").TableColumnCtx<any>, cellValue: any, index: number) => import("vue").VNode | string;
|
|
1452
|
+
selectable: (row: any, index: number) => boolean;
|
|
1453
|
+
reserveSelection: boolean;
|
|
1454
|
+
filterMethod: import("element-plus/es/components/table/src/table-column/defaults").FilterMethods<any>;
|
|
1455
|
+
filteredValue: string[];
|
|
1456
|
+
filters: {
|
|
1457
|
+
text: string;
|
|
1458
|
+
value: string;
|
|
1459
|
+
}[];
|
|
1460
|
+
filterPlacement: string;
|
|
1461
|
+
filterMultiple: boolean;
|
|
1462
|
+
filterClassName: string;
|
|
1463
|
+
index: number | ((index: number) => number);
|
|
1464
|
+
sortOrders: ("ascending" | "descending" | null)[];
|
|
1465
|
+
renderCell: (data: any) => void;
|
|
1466
|
+
colSpan: number;
|
|
1467
|
+
rowSpan: number;
|
|
1468
|
+
children: any[];
|
|
1469
|
+
level: number;
|
|
1470
|
+
filterable: boolean | {
|
|
1471
|
+
text: string;
|
|
1472
|
+
value: string;
|
|
1473
|
+
}[] | import("element-plus/es/components/table/src/table-column/defaults").FilterMethods<any>;
|
|
1474
|
+
order: string;
|
|
1475
|
+
isColumnGroup: boolean;
|
|
1476
|
+
isSubColumn: boolean;
|
|
1477
|
+
columns: any[];
|
|
1478
|
+
getColumnIndex: () => number;
|
|
1479
|
+
no: number;
|
|
1480
|
+
filterOpened?: boolean;
|
|
1481
|
+
}[];
|
|
1482
|
+
getColumnIndex?: () => number;
|
|
1483
|
+
no?: number;
|
|
1484
|
+
filterOpened?: boolean;
|
|
1485
|
+
}[], ColumnProps<any>[] | {
|
|
1064
1486
|
type?: import("./src/interface/index").TypeProps;
|
|
1065
1487
|
tag?: boolean;
|
|
1066
1488
|
isShow?: boolean;
|
|
@@ -1483,8 +1905,11 @@ export declare const ZnTable: import("../../types").SFCWithInstall<import("vue")
|
|
|
1483
1905
|
no?: number;
|
|
1484
1906
|
filterOpened?: boolean;
|
|
1485
1907
|
}[]>;
|
|
1908
|
+
isUpdatingColumns: import("vue").Ref<boolean, boolean>;
|
|
1909
|
+
initColSetting: () => void;
|
|
1486
1910
|
updateTableColumns: (newColSetting: ColumnProps[]) => void;
|
|
1487
1911
|
openColSetting: () => void;
|
|
1912
|
+
closeColSetting: () => void;
|
|
1488
1913
|
emit: (event: "search" | "reset" | "dragSort" | "handleOperateBtnsClick", ...args: any[]) => void;
|
|
1489
1914
|
_search: () => void;
|
|
1490
1915
|
_reset: () => void;
|
|
@@ -2774,11 +3199,13 @@ export declare const ZnTable: import("../../types").SFCWithInstall<import("vue")
|
|
|
2774
3199
|
no?: number;
|
|
2775
3200
|
filterOpened?: boolean;
|
|
2776
3201
|
}[]>;
|
|
3202
|
+
isUpdatingFromParent: import("vue").Ref<boolean, boolean>;
|
|
2777
3203
|
updateTimer: number;
|
|
2778
3204
|
safeEmit: (eventName: string, data: any) => void;
|
|
2779
3205
|
debouncedUpdate: (data: ColumnProps[]) => void;
|
|
2780
3206
|
initSortable: () => void;
|
|
2781
3207
|
openColSetting: () => void;
|
|
3208
|
+
closeColSetting: () => void;
|
|
2782
3209
|
handleSwitchChange: () => void;
|
|
2783
3210
|
readonly DCaret: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
2784
3211
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:colSetting" | "updateColumns")[], "update:colSetting" | "updateColumns", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
@@ -857,11 +857,13 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
|
|
|
857
857
|
no?: number;
|
|
858
858
|
filterOpened?: boolean;
|
|
859
859
|
}[]>;
|
|
860
|
+
isUpdatingFromParent: import("vue").Ref<boolean, boolean>;
|
|
860
861
|
updateTimer: number;
|
|
861
862
|
safeEmit: (eventName: string, data: any) => void;
|
|
862
863
|
debouncedUpdate: (data: ColumnProps[]) => void;
|
|
863
864
|
initSortable: () => void;
|
|
864
865
|
openColSetting: () => void;
|
|
866
|
+
closeColSetting: () => void;
|
|
865
867
|
handleSwitchChange: () => void;
|
|
866
868
|
readonly DCaret: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
867
869
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:colSetting" | "updateColumns")[], "update:colSetting" | "updateColumns", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import{defineComponent as e,ref as l,getCurrentInstance as t,watch as a,nextTick as o,onUnmounted as n,resolveComponent as r,createElementBlock as s,openBlock as i,Fragment as d,createCommentVNode as
|
|
1
|
+
import{defineComponent as e,ref as l,getCurrentInstance as t,watch as a,nextTick as o,onUnmounted as n,resolveComponent as r,createElementBlock as s,openBlock as i,Fragment as d,createCommentVNode as u,createVNode as c,withCtx as m,createElementVNode as p,unref as f,normalizeClass as h,renderSlot as v}from"vue";import g from"../assets/notData.png.mjs";import b from"sortablejs";import{DCaret as y}from"@element-plus/icons-vue";var w=Object.defineProperty,S=(e,l)=>w(e,"name",{value:l,configurable:!0});const U={class:"col-setting-header",style:{display:"flex","align-items":"center"}},C=["id"],V={style:{display:"flex","align-items":"center"}},_={class:"table-main"};var x=e({__name:"ColSetting",props:{colSetting:{type:Array,required:!0}},emits:["update:colSetting","updateColumns"],setup(e,{expose:w,emit:x}){const O=e,T=x,k=l(!1),I=l();let J=null;const N=t(),j=l([]),A=l(!1);let E=null;const $=S(((e,l)=>{if(N&&!N.isUnmounted)try{T(e,l)}catch(l){console.warn(`发送事件 ${e} 时出错:`,l)}else console.warn("组件已销毁,跳过事件发送",{hasInstance:!!N,isUnmounted:N?.isUnmounted})}),"safeEmit"),q=S((e=>{E&&clearTimeout(E),E=window.setTimeout((()=>{if(N&&!N.isUnmounted)try{const l=JSON.parse(JSON.stringify(e));$("updateColumns",l)}catch(e){console.warn("更新数据时出错:",e)}}),100)}),"debouncedUpdate");a((()=>O.colSetting),(e=>{if(e&&Array.isArray(e)){A.value=!0;try{j.value=JSON.parse(JSON.stringify(e))}catch(l){console.warn("更新本地列设置时出错:",l),j.value=[...e]}o((()=>{setTimeout((()=>{A.value=!1}),50)}))}}),{immediate:!0,deep:!0});const D=S((()=>{N&&!N.isUnmounted&&o((()=>{if(N&&!N.isUnmounted&&I.value)try{const e=I.value.$el?.querySelector("tbody");if(!e)return void console.warn("未找到tbody元素");if(J){try{J.destroy()}catch(e){console.warn("销毁sortable实例时出错:",e)}J=null}J=b.create(e,{handle:".drag-handle",animation:300,ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",forceFallback:!0,fallbackTolerance:3,
|
|
2
2
|
// 禁用原生HTML5拖拽
|
|
3
|
-
dragoverBubble:!1,removeCloneOnHide:!0,onStart:S((e=>{if(!e.item||!e.from||!N||N.isUnmounted)return!1}),"onStart"),onEnd:S((e=>{if(!N||N.isUnmounted)return;const{oldIndex:l,newIndex:t}=e;if(void 0!==l&&void 0!==t&&l!==t&&!(l<0||t<0||l>=j.value.length||t>=j.value.length))try{const e=[...j.value],a=e.splice(l,1)[0];a&&(e.splice(t,0,a),j.value=e
|
|
4
|
-
/* HOISTED */)]))),default:m((()=>[
|
|
3
|
+
dragoverBubble:!1,removeCloneOnHide:!0,onStart:S((e=>{if(!e.item||!e.from||!N||N.isUnmounted)return!1}),"onStart"),onEnd:S((e=>{if(!N||N.isUnmounted)return;if(A.value)return;const{oldIndex:l,newIndex:t}=e;if(void 0!==l&&void 0!==t&&l!==t&&!(l<0||t<0||l>=j.value.length||t>=j.value.length))try{const e=[...j.value],a=e.splice(l,1)[0];a&&(e.splice(t,0,a),j.value=e,q(e))}catch(e){console.warn("拖拽排序时出错:",e)}}),"onEnd")})}catch(e){console.warn("初始化sortable时出错:",e)}}))}),"initSortable"),H=S((()=>{N&&!N.isUnmounted&&(k.value=!0,setTimeout((()=>{N&&!N.isUnmounted&&D()}),200))}),"openColSetting"),z=S((()=>{N&&!N.isUnmounted&&(k.value=!1)}),"closeColSetting"),B=S((()=>{if(N&&!N.isUnmounted&&!A.value)try{q(j.value)}catch(e){console.warn("开关切换时出错:",e)}}),"handleSwitchChange");return a(k,(e=>{if(!e&&J)try{J.destroy(),J=null}catch(e){console.warn("关闭抽屉时销毁sortable实例出错:",e)}})),n((()=>{if(E&&(clearTimeout(E),E=null),J)try{J.destroy(),J=null}catch(e){console.warn("组件销毁时清理sortable实例出错:",e)}})),w({openColSetting:H,closeColSetting:z}),(e,l)=>{const t=r("el-icon"),a=r("el-table-column"),o=r("el-switch"),n=r("el-table"),b=r("el-drawer");return i(),s(d,null,[u(" 列设置 "),c(b,{modelValue:k.value,"onUpdate:modelValue":l[0]||(l[0]=e=>k.value=e),title:"列设置",size:"450px"},{header:m((({close:l,titleId:t,titleClass:a})=>[p("div",U,[p("h4",{id:t,class:h(a)},"列设置",10,C),p("div",V,[u(" 列设置头部插槽 "),v(e.$slots,"colSettingHeader")])])])),default:m((()=>[p("div",_,[c(n,{ref_key:"tableRef",ref:I,data:j.value,border:!0,"row-key":"prop","default-expand-all":"","tree-props":{children:"_children"}},{empty:m((()=>l[1]||(l[1]=[p("div",{class:"table-empty"},[p("img",{src:g,alt:"notData"}),p("div",null,"暂无可配置列")],-1
|
|
4
|
+
/* HOISTED */)]))),default:m((()=>[c(a,{align:"center",label:"拖拽",width:"60"},{default:m((()=>[c(t,{class:"drag-handle",style:{cursor:"move",color:"#409eff"}},{default:m((()=>[c(f(y))])),_:1
|
|
5
5
|
/* STABLE */})])),_:1
|
|
6
|
-
/* STABLE */}),
|
|
7
|
-
/* STABLE */}),
|
|
6
|
+
/* STABLE */}),c(a,{prop:"label",align:"center",label:"列名"}),c(a,{prop:"isShow",align:"center",label:"显示"},{default:m((e=>[c(o,{modelValue:e.row.isShow,"onUpdate:modelValue":S((l=>e.row.isShow=l),"onUpdate:modelValue"),onChange:B},null,8,["modelValue","onUpdate:modelValue"])])),_:1
|
|
7
|
+
/* STABLE */}),c(a,{prop:"sortable",align:"center",label:"排序"},{default:m((e=>[c(o,{modelValue:e.row.sortable,"onUpdate:modelValue":S((l=>e.row.sortable=l),"onUpdate:modelValue"),onChange:B},null,8,["modelValue","onUpdate:modelValue"])])),_:1
|
|
8
8
|
/* STABLE */})])),_:1
|
|
9
9
|
/* STABLE */},8,["data"])])])),_:3
|
|
10
10
|
/* FORWARDED */},8,["modelValue"])],2112
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ColSetting.vue2.mjs","sources":["../../../../../../../packages/components/znTable/src/components/ColSetting.vue"],"sourcesContent":["<template>\n <!-- 列设置 -->\n <el-drawer v-model=\"drawerVisible\" title=\"列设置\" size=\"450px\">\n <!-- 自定义头部 -->\n <template #header=\"{ close, titleId, titleClass }\">\n <div class=\"col-setting-header\" style=\"display: flex; align-items: center;\">\n <h4 :id=\"titleId\" :class=\"titleClass\">列设置</h4>\n <div style=\"display: flex; align-items: center;\">\n <!-- 列设置头部插槽 -->\n <slot name=\"colSettingHeader\"></slot>\n </div>\n </div>\n </template>\n\n <div class=\"table-main\">\n <el-table ref=\"tableRef\" :data=\"localColSetting\" :border=\"true\" row-key=\"prop\" default-expand-all :tree-props=\"{ children: '_children' }\">\n <el-table-column align=\"center\" label=\"拖拽\" width=\"60\">\n <template #default>\n <el-icon class=\"drag-handle\" style=\"cursor: move; color: #409eff\">\n <DCaret />\n </el-icon>\n </template>\n </el-table-column>\n <el-table-column prop=\"label\" align=\"center\" label=\"列名\" />\n <el-table-column v-slot=\"scope\" prop=\"isShow\" align=\"center\" label=\"显示\">\n <el-switch v-model=\"scope.row.isShow\" @change=\"handleSwitchChange\"></el-switch>\n </el-table-column>\n <el-table-column v-slot=\"scope\" prop=\"sortable\" align=\"center\" label=\"排序\">\n <el-switch v-model=\"scope.row.sortable\" @change=\"handleSwitchChange\"></el-switch>\n </el-table-column>\n <template #empty>\n <div class=\"table-empty\">\n <img src=\"../assets/notData.png\" alt=\"notData\" />\n <div>暂无可配置列</div>\n </div>\n </template>\n </el-table>\n </div>\n </el-drawer>\n</template>\n\n<script setup lang=\"ts\" name=\"ColSetting\">\n import { nextTick, onMounted, onUnmounted, ref, watch, getCurrentInstance } from 'vue'\n import Sortable from 'sortablejs'\n\n import { ColumnProps } from '../interface'\n import { DCaret } from '@element-plus/icons-vue'\n\n const props = defineProps({\n colSetting: { type: Array, required: true }\n})\n const emit = defineEmits(['update:colSetting', 'updateColumns'])\n\n const drawerVisible = ref<boolean>(false)\n const tableRef = ref()\n let sortableInstance: Sortable | null = null\n\n // 获取当前组件实例,用于检查组件是否已销毁\n const instance = getCurrentInstance()\n\n // 添加本地状态\n const localColSetting = ref<ColumnProps[]>([])\n\n // 防抖标志\n let updateTimer: number | null = null\n\n // 安全的emit函数\n const safeEmit = (eventName: string, data: any) => {\n // console.log('safeEmit调用:', {\n // eventName,\n // hasInstance: !!instance,\n // isUnmounted: instance?.isUnmounted,\n // dataLength: Array.isArray(data) ? data.length : 'not array'\n // })\n\n // 检查组件实例是否还存在\n if (!instance || instance.isUnmounted) {\n console.warn('组件已销毁,跳过事件发送', {\n hasInstance: !!instance,\n isUnmounted: instance?.isUnmounted\n })\n return\n }\n\n try {\n // console.log('正在发送事件:', eventName)\n emit(eventName as any, data)\n // console.log('事件发送成功:', eventName)\n } catch (error) {\n console.warn(`发送事件 ${eventName} 时出错:`, error)\n }\n }\n\n // 防抖的更新函数\n const debouncedUpdate = (data: ColumnProps[]) => {\n // console.log('debouncedUpdate调用:', {\n // hasData: !!data,\n // dataLength: Array.isArray(data) ? data.length : 'not array',\n // hasTimer: !!updateTimer\n // })\n\n if (updateTimer) {\n // console.log('清除之前的定时器')\n clearTimeout(updateTimer)\n }\n\n updateTimer = window.setTimeout(() => {\n // console.log('防抖定时器执行:', {\n // hasInstance: !!instance,\n // isUnmounted: instance?.isUnmounted\n // })\n\n if (!instance || instance.isUnmounted) {\n // console.warn('防抖更新时组件已销毁')\n return\n }\n\n try {\n // 深拷贝数据避免响应式问题\n const clonedData = JSON.parse(JSON.stringify(data))\n // console.log('开始发送防抖更新事件')\n safeEmit('update:colSetting', clonedData)\n safeEmit('updateColumns', clonedData)\n } catch (error) {\n console.warn('更新数据时出错:', error)\n }\n }, 100) // 100ms防抖\n }\n\n // 监听 props 变化,更新本地状态\n watch(\n () => props.colSetting,\n (newVal) => {\n if (!newVal || !Array.isArray(newVal)) return\n\n try {\n localColSetting.value = JSON.parse(JSON.stringify(newVal))\n } catch (error) {\n console.warn('更新本地列设置时出错:', error)\n localColSetting.value = [...newVal]\n }\n },\n { immediate: true, deep: true }\n )\n\n // 初始化拖拽排序\n const initSortable = () => {\n if (!instance || instance.isUnmounted) {\n return\n }\n\n nextTick(() => {\n if (!instance || instance.isUnmounted || !tableRef.value) {\n return\n }\n\n try {\n const tbody = tableRef.value.$el?.querySelector('tbody')\n if (!tbody) {\n console.warn('未找到tbody元素')\n return\n }\n\n // 销毁之前的实例\n if (sortableInstance) {\n try {\n sortableInstance.destroy()\n } catch (error) {\n console.warn('销毁sortable实例时出错:', error)\n }\n sortableInstance = null\n }\n\n sortableInstance = Sortable.create(tbody, {\n handle: '.drag-handle',\n animation: 300,\n ghostClass: 'sortable-ghost',\n chosenClass: 'sortable-chosen',\n dragClass: 'sortable-drag',\n forceFallback: true,\n fallbackTolerance: 3,\n // 禁用原生HTML5拖拽\n dragoverBubble: false,\n removeCloneOnHide: true,\n onStart: (evt) => {\n if (!evt.item || !evt.from || !instance || instance.isUnmounted) {\n return false\n }\n },\n onEnd: (evt) => {\n // 检查组件状态\n if (!instance || instance.isUnmounted) {\n return\n }\n\n const { oldIndex, newIndex } = evt\n\n if (oldIndex === undefined || newIndex === undefined || oldIndex === newIndex) {\n return\n }\n\n if (oldIndex < 0 || newIndex < 0 || oldIndex >= localColSetting.value.length || newIndex >= localColSetting.value.length) {\n return\n }\n\n try {\n const newData = [...localColSetting.value]\n const movedItem = newData.splice(oldIndex, 1)[0]\n\n if (movedItem) {\n newData.splice(newIndex, 0, movedItem)\n localColSetting.value = newData\n\n // 使用防抖更新\n debouncedUpdate(newData)\n }\n } catch (error) {\n console.warn('拖拽排序时出错:', error)\n }\n }\n })\n } catch (error) {\n console.warn('初始化sortable时出错:', error)\n }\n })\n }\n\n const openColSetting = () => {\n if (!instance || instance.isUnmounted) {\n return\n }\n\n drawerVisible.value = true\n\n // 延迟初始化拖拽\n setTimeout(() => {\n if (!instance || instance.isUnmounted) {\n return\n }\n initSortable()\n }, 200)\n }\n\n const handleSwitchChange = () => {\n // console.log('handleSwitchChange调用:', {\n // hasInstance: !!instance,\n // isUnmounted: instance?.isUnmounted,\n // localColSettingLength: localColSetting.value.length\n // })\n\n if (!instance || instance.isUnmounted) {\n // console.warn('开关切换时组件已销毁')\n return\n }\n\n try {\n // console.log('开关切换,准备防抖更新')\n // 使用防抖更新\n debouncedUpdate(localColSetting.value)\n } catch (error) {\n console.warn('开关切换时出错:', error)\n }\n }\n\n // 监听抽屉关闭,清理拖拽实例\n watch(drawerVisible, (newVal) => {\n if (!newVal && sortableInstance) {\n try {\n sortableInstance.destroy()\n sortableInstance = null\n } catch (error) {\n console.warn('关闭抽屉时销毁sortable实例出错:', error)\n }\n }\n })\n\n // 组件销毁时清理\n onUnmounted(() => {\n if (updateTimer) {\n clearTimeout(updateTimer)\n updateTimer = null\n }\n\n if (sortableInstance) {\n try {\n sortableInstance.destroy()\n sortableInstance = null\n } catch (error) {\n console.warn('组件销毁时清理sortable实例出错:', error)\n }\n }\n })\n\n defineExpose({\n openColSetting\n })\n</script>\n"],"names":["props","__props","emit","__emit","drawerVisible","ref","tableRef","sortableInstance","instance","getCurrentInstance","localColSetting","updateTimer","safeEmit","__name","eventName","data","isUnmounted","error","console","warn","hasInstance","debouncedUpdate","clearTimeout","window","setTimeout","clonedData","JSON","parse","stringify","watch","colSetting","newVal","Array","isArray","value","immediate","deep","initSortable","nextTick","tbody","$el","querySelector","destroy","Sortable","create","handle","animation","ghostClass","chosenClass","dragClass","forceFallback","fallbackTolerance","dragoverBubble","removeCloneOnHide","onStart","evt","item","from","onEnd","oldIndex","newIndex","length","newData","movedItem","splice","openColSetting","handleSwitchChange","onUnmounted","__expose"],"mappings":"6yBAgDE,MAAMA,EAAQC,EAGRC,EAAOC,EAEPC,EAAgBC,GAAa,GAC7BC,EAAWD,IACjB,IAAIE,EAAoC,KAGxC,MAAMC,EAAWC,IAGXC,EAAkBL,EAAmB,IAG3C,IAAIM,EAA6B,KAG3B,MAAAC,EAAYC,GAAA,CAAAC,EAAmBC,KAS/B,GAACP,IAAYA,EAASQ,YAQtB,IAEFd,EAAKY,EAAkBC,SAEhBE,GACPC,QAAQC,KAAK,QAAQL,SAAkBG,EAAK,MAZ5CC,QAAQC,KAAK,eAAgB,CAC3BC,cAAeZ,EACfQ,YAAaR,GAAUQ,aAUmB,GAtB/B,YA2BXK,KAAmBN,IAOnBJ,GAEFW,aAAaX,GAGDA,EAAAY,OAAOC,YAAW,KAM1B,GAAChB,IAAYA,EAASQ,YAKtB,IAEF,MAAMS,EAAa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C9B6B,EAAYD,EAAQE,OAAOL,EAAU,GAAG,GAE1CI,IACMD,EAAAE,OAAOJ,EAAU,EAAGG,GAC5BrD,EAAgBwB,MAAQ4B,EAGxBzC,EAAgByC,UAEX7C,GACCC,QAAAC,KAAK,WAAYF,EAAK,IA5B3B,iBAgCFA,GACCC,QAAAC,KAAK,kBAAmBF,EAAK,IAExC,GA9EkB,gBAiFfgD,EAAuBpD,GAAA,KACtBL,IAAYA,EAASQ,cAI1BZ,EAAc8B,OAAQ,EAGtBV,YAAW,KACJhB,IAAYA,EAASQ,aAGbqB,GAAA,GACZ,KAAG,GAbe,kBAgBjB6B,EAA2BrD,GAAA,KAO3B,GAACL,IAAYA,EAASQ,YAKtB,IAGFK,EAAgBX,EAAgBwB,aACzBjB,GACCC,QAAAC,KAAK,WAAYF,EAAK,IAjBP,6BAsBrBY,EAAAzB,GAAgB2B,IAChB,IAACA,GAAUxB,EACT,IACFA,EAAiBmC,UACEnC,EAAA,WACZU,GACCC,QAAAC,KAAK,uBAAwBF,EAAK,CAC5C,IAKJkD,GAAY,KAMV,GALIxD,IACFW,aAAaX,GACCA,EAAA,MAGZJ,EACE,IACFA,EAAiBmC,UACEnC,EAAA,WACZU,GACCC,QAAAC,KAAK,uBAAwBF,EAAK,CAC5C,IAISmD,EAAA,CACXH;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"ColSetting.vue2.mjs","sources":["../../../../../../../packages/components/znTable/src/components/ColSetting.vue"],"sourcesContent":["<template>\n <!-- 列设置 -->\n <el-drawer v-model=\"drawerVisible\" title=\"列设置\" size=\"450px\">\n <!-- 自定义头部 -->\n <template #header=\"{ close, titleId, titleClass }\">\n <div class=\"col-setting-header\" style=\"display: flex; align-items: center;\">\n <h4 :id=\"titleId\" :class=\"titleClass\">列设置</h4>\n <div style=\"display: flex; align-items: center;\">\n <!-- 列设置头部插槽 -->\n <slot name=\"colSettingHeader\"></slot>\n </div>\n </div>\n </template>\n\n <div class=\"table-main\">\n <el-table ref=\"tableRef\" :data=\"localColSetting\" :border=\"true\" row-key=\"prop\" default-expand-all :tree-props=\"{ children: '_children' }\">\n <el-table-column align=\"center\" label=\"拖拽\" width=\"60\">\n <template #default>\n <el-icon class=\"drag-handle\" style=\"cursor: move; color: #409eff\">\n <DCaret />\n </el-icon>\n </template>\n </el-table-column>\n <el-table-column prop=\"label\" align=\"center\" label=\"列名\" />\n <el-table-column v-slot=\"scope\" prop=\"isShow\" align=\"center\" label=\"显示\">\n <el-switch v-model=\"scope.row.isShow\" @change=\"handleSwitchChange\"></el-switch>\n </el-table-column>\n <el-table-column v-slot=\"scope\" prop=\"sortable\" align=\"center\" label=\"排序\">\n <el-switch v-model=\"scope.row.sortable\" @change=\"handleSwitchChange\"></el-switch>\n </el-table-column>\n <template #empty>\n <div class=\"table-empty\">\n <img src=\"../assets/notData.png\" alt=\"notData\" />\n <div>暂无可配置列</div>\n </div>\n </template>\n </el-table>\n </div>\n </el-drawer>\n</template>\n\n<script setup lang=\"ts\" name=\"ColSetting\">\n import { nextTick, onMounted, onUnmounted, ref, watch, getCurrentInstance } from 'vue'\n import Sortable from 'sortablejs'\n\n import { ColumnProps } from '../interface'\n import { DCaret } from '@element-plus/icons-vue'\n\n const props = defineProps({\n colSetting: { type: Array, required: true }\n})\n const emit = defineEmits(['update:colSetting', 'updateColumns'])\n\n const drawerVisible = ref<boolean>(false)\n const tableRef = ref()\n let sortableInstance: Sortable | null = null\n\n // 获取当前组件实例,用于检查组件是否已销毁\n const instance = getCurrentInstance()\n\n // 添加本地状态\n const localColSetting = ref<ColumnProps[]>([])\n \n // 添加更新标志,防止循环更新\n const isUpdatingFromParent = ref(false)\n\n // 防抖标志\n let updateTimer: number | null = null\n\n // 安全的emit函数\n const safeEmit = (eventName: string, data: any) => {\n // console.log('safeEmit调用:', {\n // eventName,\n // hasInstance: !!instance,\n // isUnmounted: instance?.isUnmounted,\n // dataLength: Array.isArray(data) ? data.length : 'not array'\n // })\n\n // 检查组件实例是否还存在\n if (!instance || instance.isUnmounted) {\n console.warn('组件已销毁,跳过事件发送', {\n hasInstance: !!instance,\n isUnmounted: instance?.isUnmounted\n })\n return\n }\n\n try {\n // console.log('正在发送事件:', eventName)\n emit(eventName as any, data)\n // console.log('事件发送成功:', eventName)\n } catch (error) {\n console.warn(`发送事件 ${eventName} 时出错:`, error)\n }\n }\n\n // 防抖的更新函数\n const debouncedUpdate = (data: ColumnProps[]) => {\n // console.log('debouncedUpdate调用:', {\n // hasData: !!data,\n // dataLength: Array.isArray(data) ? data.length : 'not array',\n // hasTimer: !!updateTimer\n // })\n\n if (updateTimer) {\n // console.log('清除之前的定时器')\n clearTimeout(updateTimer)\n }\n\n updateTimer = window.setTimeout(() => {\n // console.log('防抖定时器执行:', {\n // hasInstance: !!instance,\n // isUnmounted: instance?.isUnmounted\n // })\n\n if (!instance || instance.isUnmounted) {\n // console.warn('防抖更新时组件已销毁')\n return\n }\n\n try {\n // 深拷贝数据避免响应式问题\n const clonedData = JSON.parse(JSON.stringify(data))\n // console.log('开始发送防抖更新事件')\n // safeEmit('update:colSetting', clonedData) // 移除这个事件,避免双重更新\n safeEmit('updateColumns', clonedData)\n } catch (error) {\n console.warn('更新数据时出错:', error)\n }\n }, 100) // 100ms防抖\n }\n\n // 监听 props 变化,更新本地状态\n watch(\n () => props.colSetting,\n (newVal) => {\n if (!newVal || !Array.isArray(newVal)) return\n\n // 设置标志,表示正在从父组件更新\n isUpdatingFromParent.value = true\n \n try {\n localColSetting.value = JSON.parse(JSON.stringify(newVal))\n } catch (error) {\n console.warn('更新本地列设置时出错:', error)\n localColSetting.value = [...newVal]\n }\n \n // 延迟重置标志,确保本次更新完成\n nextTick(() => {\n setTimeout(() => {\n isUpdatingFromParent.value = false\n }, 50)\n })\n },\n { immediate: true, deep: true }\n )\n\n // 初始化拖拽排序\n const initSortable = () => {\n if (!instance || instance.isUnmounted) {\n return\n }\n\n nextTick(() => {\n if (!instance || instance.isUnmounted || !tableRef.value) {\n return\n }\n\n try {\n const tbody = tableRef.value.$el?.querySelector('tbody')\n if (!tbody) {\n console.warn('未找到tbody元素')\n return\n }\n\n // 销毁之前的实例\n if (sortableInstance) {\n try {\n sortableInstance.destroy()\n } catch (error) {\n console.warn('销毁sortable实例时出错:', error)\n }\n sortableInstance = null\n }\n\n sortableInstance = Sortable.create(tbody, {\n handle: '.drag-handle',\n animation: 300,\n ghostClass: 'sortable-ghost',\n chosenClass: 'sortable-chosen',\n dragClass: 'sortable-drag',\n forceFallback: true,\n fallbackTolerance: 3,\n // 禁用原生HTML5拖拽\n dragoverBubble: false,\n removeCloneOnHide: true,\n onStart: (evt) => {\n if (!evt.item || !evt.from || !instance || instance.isUnmounted) {\n return false\n }\n },\n onEnd: (evt) => {\n // 检查组件状态\n if (!instance || instance.isUnmounted) {\n return\n }\n \n // 如果正在从父组件更新,跳过事件发送\n if (isUpdatingFromParent.value) {\n return\n }\n\n const { oldIndex, newIndex } = evt\n\n if (oldIndex === undefined || newIndex === undefined || oldIndex === newIndex) {\n return\n }\n\n if (oldIndex < 0 || newIndex < 0 || oldIndex >= localColSetting.value.length || newIndex >= localColSetting.value.length) {\n return\n }\n\n try {\n const newData = [...localColSetting.value]\n const movedItem = newData.splice(oldIndex, 1)[0]\n\n if (movedItem) {\n newData.splice(newIndex, 0, movedItem)\n localColSetting.value = newData\n\n // 使用防抖更新\n debouncedUpdate(newData)\n }\n } catch (error) {\n console.warn('拖拽排序时出错:', error)\n }\n }\n })\n } catch (error) {\n console.warn('初始化sortable时出错:', error)\n }\n })\n }\n\n const openColSetting = () => {\n if (!instance || instance.isUnmounted) {\n return\n }\n\n drawerVisible.value = true\n\n // 延迟初始化拖拽\n setTimeout(() => {\n if (!instance || instance.isUnmounted) {\n return\n }\n initSortable()\n }, 200)\n }\n\n const closeColSetting = () => {\n if (!instance || instance.isUnmounted) {\n return\n }\n\n drawerVisible.value = false\n }\n\n const handleSwitchChange = () => {\n // console.log('handleSwitchChange调用:', {\n // hasInstance: !!instance,\n // isUnmounted: instance?.isUnmounted,\n // localColSettingLength: localColSetting.value.length\n // })\n\n if (!instance || instance.isUnmounted) {\n // console.warn('开关切换时组件已销毁')\n return\n }\n \n // 如果正在从父组件更新,跳过事件发送\n if (isUpdatingFromParent.value) {\n return\n }\n\n try {\n // console.log('开关切换,准备防抖更新')\n // 使用防抖更新\n debouncedUpdate(localColSetting.value)\n } catch (error) {\n console.warn('开关切换时出错:', error)\n }\n }\n\n // 监听抽屉关闭,清理拖拽实例\n watch(drawerVisible, (newVal) => {\n if (!newVal && sortableInstance) {\n try {\n sortableInstance.destroy()\n sortableInstance = null\n } catch (error) {\n console.warn('关闭抽屉时销毁sortable实例出错:', error)\n }\n }\n })\n\n // 组件销毁时清理\n onUnmounted(() => {\n if (updateTimer) {\n clearTimeout(updateTimer)\n updateTimer = null\n }\n\n if (sortableInstance) {\n try {\n sortableInstance.destroy()\n sortableInstance = null\n } catch (error) {\n console.warn('组件销毁时清理sortable实例出错:', error)\n }\n }\n })\n\n defineExpose({\n openColSetting,\n closeColSetting\n })\n</script>\n"],"names":["props","__props","emit","__emit","drawerVisible","ref","tableRef","sortableInstance","instance","getCurrentInstance","localColSetting","isUpdatingFromParent","updateTimer","safeEmit","__name","eventName","data","isUnmounted","error","console","warn","hasInstance","debouncedUpdate","clearTimeout","window","setTimeout","clonedData","JSON","parse","stringify","watch","colSetting","newVal","Array","isArray","value","nextTick","immediate","deep","initSortable","tbody","$el","querySelector","destroy","Sortable","create","handle","animation","ghostClass","chosenClass","dragClass","forceFallback","fallbackTolerance","dragoverBubble","removeCloneOnHide","onStart","evt","item","from","onEnd","oldIndex","newIndex","length","newData","movedItem","splice","openColSetting","closeColSetting","handleSwitchChange","onUnmounted","__expose"],"mappings":"6yBAgDE,MAAMA,EAAQC,EAGRC,EAAOC,EAEPC,EAAgBC,GAAa,GAC7BC,EAAWD,IACjB,IAAIE,EAAoC,KAGxC,MAAMC,EAAWC,IAGXC,EAAkBL,EAAmB,IAGrCM,EAAuBN,GAAI,GAGjC,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