@94ai/nf-table 3.2.25 → 3.2.29
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/lib/index.d.ts +10 -10
- package/lib/nf-table.cjs.js +46 -29
- package/lib/nf-table.esm-bundler.js +46 -29
- package/lib/nf-table.vue.d.ts +4 -4
- package/package/nf-table.vue +48 -31
- package/package.json +6 -6
package/lib/index.d.ts
CHANGED
|
@@ -37,7 +37,7 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
|
|
|
37
37
|
default: string;
|
|
38
38
|
};
|
|
39
39
|
columns: {
|
|
40
|
-
type: import("vue-demi").PropType<
|
|
40
|
+
type: import("vue-demi").PropType<any>;
|
|
41
41
|
default: () => never[];
|
|
42
42
|
};
|
|
43
43
|
searchFormAttrs: {
|
|
@@ -300,7 +300,7 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
|
|
|
300
300
|
default: string;
|
|
301
301
|
};
|
|
302
302
|
columns: {
|
|
303
|
-
type: import("vue-demi").PropType<
|
|
303
|
+
type: import("vue-demi").PropType<any>;
|
|
304
304
|
default: () => never[];
|
|
305
305
|
};
|
|
306
306
|
searchFormAttrs: {
|
|
@@ -538,7 +538,7 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
|
|
|
538
538
|
text: string;
|
|
539
539
|
selectEmptyWarningTips: string;
|
|
540
540
|
operationPropKey: string;
|
|
541
|
-
columns:
|
|
541
|
+
columns: any;
|
|
542
542
|
searchFormAttrs: import("./types").NfSearchFormAttributes;
|
|
543
543
|
searchFormEvents: Partial<Record<import("./types").NfSearchFormEventKey, Function>>;
|
|
544
544
|
tableAttrs: import("./types").ElTableAttributes;
|
|
@@ -631,7 +631,7 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
|
|
|
631
631
|
default: string;
|
|
632
632
|
};
|
|
633
633
|
columns: {
|
|
634
|
-
type: import("vue-demi").PropType<
|
|
634
|
+
type: import("vue-demi").PropType<any>;
|
|
635
635
|
default: () => never[];
|
|
636
636
|
};
|
|
637
637
|
searchFormAttrs: {
|
|
@@ -929,7 +929,7 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
|
|
|
929
929
|
}[]>;
|
|
930
930
|
syncLocalShowColumnToCookies: () => void;
|
|
931
931
|
syncCookiesToLocalShowColumn: () => void;
|
|
932
|
-
syncCookiesToTableColumn: () => void;
|
|
932
|
+
syncCookiesToTableColumn: (readCached?: boolean) => void;
|
|
933
933
|
}> & import("vue/types/v3-component-options").ExtractComputedReturns<{}> & import("vue-demi").ComponentCustomProperties & Readonly<import("vue-demi").ExtractPropTypes<{
|
|
934
934
|
data: {
|
|
935
935
|
type: import("vue-demi").PropType<Record<string, any>[]>;
|
|
@@ -968,7 +968,7 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
|
|
|
968
968
|
default: string;
|
|
969
969
|
};
|
|
970
970
|
columns: {
|
|
971
|
-
type: import("vue-demi").PropType<
|
|
971
|
+
type: import("vue-demi").PropType<any>;
|
|
972
972
|
default: () => never[];
|
|
973
973
|
};
|
|
974
974
|
searchFormAttrs: {
|
|
@@ -1231,7 +1231,7 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
|
|
|
1231
1231
|
default: string;
|
|
1232
1232
|
};
|
|
1233
1233
|
columns: {
|
|
1234
|
-
type: import("vue-demi").PropType<
|
|
1234
|
+
type: import("vue-demi").PropType<any>;
|
|
1235
1235
|
default: () => never[];
|
|
1236
1236
|
};
|
|
1237
1237
|
searchFormAttrs: {
|
|
@@ -1529,7 +1529,7 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
|
|
|
1529
1529
|
}[]>;
|
|
1530
1530
|
syncLocalShowColumnToCookies: () => void;
|
|
1531
1531
|
syncCookiesToLocalShowColumn: () => void;
|
|
1532
|
-
syncCookiesToTableColumn: () => void;
|
|
1532
|
+
syncCookiesToTableColumn: (readCached?: boolean) => void;
|
|
1533
1533
|
}, {}, {}, {}, import("vue/types/v3-component-options").ComponentOptionsMixin, import("vue/types/v3-component-options").ComponentOptionsMixin, {
|
|
1534
1534
|
fieldsChange: (event: string[]) => void;
|
|
1535
1535
|
"update:showColumn": (event: string[] | undefined) => void;
|
|
@@ -1543,7 +1543,7 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
|
|
|
1543
1543
|
text: string;
|
|
1544
1544
|
selectEmptyWarningTips: string;
|
|
1545
1545
|
operationPropKey: string;
|
|
1546
|
-
columns:
|
|
1546
|
+
columns: any;
|
|
1547
1547
|
searchFormAttrs: import("./types").NfSearchFormAttributes;
|
|
1548
1548
|
searchFormEvents: Partial<Record<import("./types").NfSearchFormEventKey, Function>>;
|
|
1549
1549
|
tableAttrs: import("./types").ElTableAttributes;
|
|
@@ -1637,7 +1637,7 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
|
|
|
1637
1637
|
default: string;
|
|
1638
1638
|
};
|
|
1639
1639
|
columns: {
|
|
1640
|
-
type: import("vue-demi").PropType<
|
|
1640
|
+
type: import("vue-demi").PropType<any>;
|
|
1641
1641
|
default: () => never[];
|
|
1642
1642
|
};
|
|
1643
1643
|
searchFormAttrs: {
|
package/lib/nf-table.cjs.js
CHANGED
|
@@ -5761,7 +5761,7 @@ __sfc_main.props = {
|
|
|
5761
5761
|
columns: {
|
|
5762
5762
|
key: "columns",
|
|
5763
5763
|
required: false,
|
|
5764
|
-
type: Array,
|
|
5764
|
+
type: [Array, null],
|
|
5765
5765
|
default: () => []
|
|
5766
5766
|
},
|
|
5767
5767
|
searchFormAttrs: {
|
|
@@ -6214,17 +6214,26 @@ __sfc_main.setup = (__props, __ctx) => {
|
|
|
6214
6214
|
immediate: true
|
|
6215
6215
|
});
|
|
6216
6216
|
const initLocalShow = () => {
|
|
6217
|
-
|
|
6217
|
+
props.columns._skip = true;
|
|
6218
|
+
const result = props.columns.filter((item) => {
|
|
6218
6219
|
var _a2, _b2;
|
|
6219
6220
|
const prop = item.prop || ((_a2 = item.attr) == null ? void 0 : _a2.prop);
|
|
6220
6221
|
if ((_b2 = props.showColumn) == null ? void 0 : _b2.includes(prop)) {
|
|
6221
6222
|
item.initHidden = false;
|
|
6222
6223
|
}
|
|
6223
|
-
return item.initHidden;
|
|
6224
|
+
return !item.initHidden;
|
|
6224
6225
|
}).map((item) => {
|
|
6225
6226
|
var _a2;
|
|
6226
6227
|
return item.prop || ((_a2 = item.attr) == null ? void 0 : _a2.prop);
|
|
6227
6228
|
});
|
|
6229
|
+
props.columns._skip = false;
|
|
6230
|
+
if (result.length) {
|
|
6231
|
+
return result;
|
|
6232
|
+
}
|
|
6233
|
+
return props.columns.map((item) => {
|
|
6234
|
+
var _a2;
|
|
6235
|
+
return item.prop || ((_a2 = item.attr) == null ? void 0 : _a2.prop);
|
|
6236
|
+
});
|
|
6228
6237
|
};
|
|
6229
6238
|
const localShowColumn = vueDemi.ref(initLocalShow());
|
|
6230
6239
|
vueDemi.watch(() => {
|
|
@@ -6252,6 +6261,19 @@ __sfc_main.setup = (__props, __ctx) => {
|
|
|
6252
6261
|
(_a2 = instance == null ? void 0 : instance.$cookies) == null ? void 0 : _a2.set(props.storageKey, JSON.stringify(columnState), -1);
|
|
6253
6262
|
}
|
|
6254
6263
|
};
|
|
6264
|
+
const syncShowItemToInitHidden = () => {
|
|
6265
|
+
props.columns._skip = true;
|
|
6266
|
+
props.columns.forEach((item) => {
|
|
6267
|
+
var _a2, _b2;
|
|
6268
|
+
const prop = item.prop || ((_a2 = item.attr) == null ? void 0 : _a2.prop);
|
|
6269
|
+
if ((_b2 = localShowColumn.value) == null ? void 0 : _b2.includes(prop)) {
|
|
6270
|
+
item.initHidden = false;
|
|
6271
|
+
} else {
|
|
6272
|
+
item.initHidden = true;
|
|
6273
|
+
}
|
|
6274
|
+
});
|
|
6275
|
+
props.columns._skip = false;
|
|
6276
|
+
};
|
|
6255
6277
|
const syncCookiesToLocalShowColumn = () => {
|
|
6256
6278
|
var _a2;
|
|
6257
6279
|
if (props.columnEdit) {
|
|
@@ -6267,15 +6289,7 @@ __sfc_main.setup = (__props, __ctx) => {
|
|
|
6267
6289
|
}
|
|
6268
6290
|
}
|
|
6269
6291
|
localShowColumn.value = showColumnItems;
|
|
6270
|
-
|
|
6271
|
-
var _a3, _b2;
|
|
6272
|
-
const prop = item.prop || ((_a3 = item.attr) == null ? void 0 : _a3.prop);
|
|
6273
|
-
if ((_b2 = localShowColumn.value) == null ? void 0 : _b2.includes(prop)) {
|
|
6274
|
-
item.initHidden = false;
|
|
6275
|
-
} else {
|
|
6276
|
-
item.initHidden = true;
|
|
6277
|
-
}
|
|
6278
|
-
});
|
|
6292
|
+
syncShowItemToInitHidden();
|
|
6279
6293
|
}
|
|
6280
6294
|
}
|
|
6281
6295
|
};
|
|
@@ -6290,8 +6304,9 @@ __sfc_main.setup = (__props, __ctx) => {
|
|
|
6290
6304
|
}
|
|
6291
6305
|
const tableColumns = vueDemi.ref([]);
|
|
6292
6306
|
const elTableRefKey = vueDemi.ref(Date.now());
|
|
6293
|
-
const syncCookiesToTableColumn = () => {
|
|
6307
|
+
const syncCookiesToTableColumn = (readCached = true) => {
|
|
6294
6308
|
var _a2;
|
|
6309
|
+
props.columns._skip = true;
|
|
6295
6310
|
const columns = props.columns.map((item, index2) => {
|
|
6296
6311
|
var _a3;
|
|
6297
6312
|
((_a3 = item.label) == null ? void 0 : _a3.length) || 0;
|
|
@@ -6316,7 +6331,7 @@ __sfc_main.setup = (__props, __ctx) => {
|
|
|
6316
6331
|
item.__index = index2;
|
|
6317
6332
|
return item;
|
|
6318
6333
|
});
|
|
6319
|
-
if (props.columnEdit) {
|
|
6334
|
+
if (readCached && props.columnEdit) {
|
|
6320
6335
|
let columnState = (_a2 = instance == null ? void 0 : instance.$cookies) == null ? void 0 : _a2.get(props.storageKey);
|
|
6321
6336
|
if (columnState) {
|
|
6322
6337
|
if (typeof columnState === "string") {
|
|
@@ -6338,21 +6353,34 @@ __sfc_main.setup = (__props, __ctx) => {
|
|
|
6338
6353
|
}
|
|
6339
6354
|
}
|
|
6340
6355
|
}
|
|
6356
|
+
props.columns._skip = true;
|
|
6341
6357
|
tableColumns.value = columns.sort((a, b) => a._index - b._index < 0 ? -1 : a._index - b._index > 0 ? 1 : 0);
|
|
6342
6358
|
elTableRefKey.value = Date.now();
|
|
6343
6359
|
};
|
|
6344
6360
|
syncCookiesToTableColumn();
|
|
6361
|
+
vueDemi.onBeforeMount(() => {
|
|
6362
|
+
vueDemi.watch(() => {
|
|
6363
|
+
return props.columns;
|
|
6364
|
+
}, () => {
|
|
6365
|
+
if (props.columns._skip) {
|
|
6366
|
+
return;
|
|
6367
|
+
}
|
|
6368
|
+
syncCookiesToTableColumn();
|
|
6369
|
+
}, {
|
|
6370
|
+
deep: true
|
|
6371
|
+
});
|
|
6372
|
+
});
|
|
6345
6373
|
const tableAttrer = vueDemi.computed(() => {
|
|
6346
6374
|
const obj = {
|
|
6347
6375
|
"header-cell-style": {
|
|
6348
|
-
"text-align": "
|
|
6376
|
+
"text-align": "center",
|
|
6349
6377
|
"background": "#F5F7FA",
|
|
6350
6378
|
"height": "48px",
|
|
6351
6379
|
"color": "#303133",
|
|
6352
6380
|
"font-size": "14px"
|
|
6353
6381
|
},
|
|
6354
6382
|
"cell-style": {
|
|
6355
|
-
"text-align": "
|
|
6383
|
+
"text-align": "center"
|
|
6356
6384
|
},
|
|
6357
6385
|
resizable: true,
|
|
6358
6386
|
border: true,
|
|
@@ -6459,16 +6487,6 @@ __sfc_main.setup = (__props, __ctx) => {
|
|
|
6459
6487
|
}
|
|
6460
6488
|
await ((_b2 = (_a2 = props.tableEvents)["header-dragend"]) == null ? void 0 : _b2.call(_a2, newWidth, oldWidth, column, event));
|
|
6461
6489
|
};
|
|
6462
|
-
const syncShowItemToInitHidden = () => {
|
|
6463
|
-
props.columns.forEach((item) => {
|
|
6464
|
-
var _a2;
|
|
6465
|
-
if ((_a2 = localShowColumn.value) == null ? void 0 : _a2.includes(item.prop)) {
|
|
6466
|
-
item.initHidden = false;
|
|
6467
|
-
} else {
|
|
6468
|
-
item.initHidden = true;
|
|
6469
|
-
}
|
|
6470
|
-
});
|
|
6471
|
-
};
|
|
6472
6490
|
const columnCheckConfirmFeedback = (value) => {
|
|
6473
6491
|
if (!props.columnEdit) {
|
|
6474
6492
|
const itemsList = [];
|
|
@@ -6514,7 +6532,6 @@ __sfc_main.setup = (__props, __ctx) => {
|
|
|
6514
6532
|
}
|
|
6515
6533
|
});
|
|
6516
6534
|
return Object.assign({
|
|
6517
|
-
props,
|
|
6518
6535
|
elTableRef,
|
|
6519
6536
|
nfTableActionContainerRef,
|
|
6520
6537
|
nfTablePaginationRef,
|
|
@@ -7277,7 +7294,7 @@ var _sfc_render = function render3() {
|
|
|
7277
7294
|
ref: "columnCheckDialog",
|
|
7278
7295
|
attrs: {
|
|
7279
7296
|
"show": _vm.nfColumCheckDialogVisible,
|
|
7280
|
-
"table-columns": _vm.
|
|
7297
|
+
"table-columns": _vm.columns,
|
|
7281
7298
|
"show-column": _vm.localShowColumn,
|
|
7282
7299
|
"storage-key": _vm.storageKey,
|
|
7283
7300
|
"title": _vm.columnCheckTitle,
|
|
@@ -7343,7 +7360,7 @@ var _sfc_render = function render3() {
|
|
|
7343
7360
|
"get-all-check-desc": _vm.columnCheckGetAllCheckDesc,
|
|
7344
7361
|
"operation-prop-key": _vm.operationPropKey,
|
|
7345
7362
|
"storage-key": _vm.storageKey,
|
|
7346
|
-
"table-columns": _vm.
|
|
7363
|
+
"table-columns": _vm.columns,
|
|
7347
7364
|
"select-empty-warning-tips": _vm.selectEmptyWarningTips
|
|
7348
7365
|
}
|
|
7349
7366
|
})], 2) : _vm._e()], 2);
|
|
@@ -5759,7 +5759,7 @@ __sfc_main.props = {
|
|
|
5759
5759
|
columns: {
|
|
5760
5760
|
key: "columns",
|
|
5761
5761
|
required: false,
|
|
5762
|
-
type: Array,
|
|
5762
|
+
type: [Array, null],
|
|
5763
5763
|
default: () => []
|
|
5764
5764
|
},
|
|
5765
5765
|
searchFormAttrs: {
|
|
@@ -6212,17 +6212,26 @@ __sfc_main.setup = (__props, __ctx) => {
|
|
|
6212
6212
|
immediate: true
|
|
6213
6213
|
});
|
|
6214
6214
|
const initLocalShow = () => {
|
|
6215
|
-
|
|
6215
|
+
props.columns._skip = true;
|
|
6216
|
+
const result = props.columns.filter((item) => {
|
|
6216
6217
|
var _a2, _b2;
|
|
6217
6218
|
const prop = item.prop || ((_a2 = item.attr) == null ? void 0 : _a2.prop);
|
|
6218
6219
|
if ((_b2 = props.showColumn) == null ? void 0 : _b2.includes(prop)) {
|
|
6219
6220
|
item.initHidden = false;
|
|
6220
6221
|
}
|
|
6221
|
-
return item.initHidden;
|
|
6222
|
+
return !item.initHidden;
|
|
6222
6223
|
}).map((item) => {
|
|
6223
6224
|
var _a2;
|
|
6224
6225
|
return item.prop || ((_a2 = item.attr) == null ? void 0 : _a2.prop);
|
|
6225
6226
|
});
|
|
6227
|
+
props.columns._skip = false;
|
|
6228
|
+
if (result.length) {
|
|
6229
|
+
return result;
|
|
6230
|
+
}
|
|
6231
|
+
return props.columns.map((item) => {
|
|
6232
|
+
var _a2;
|
|
6233
|
+
return item.prop || ((_a2 = item.attr) == null ? void 0 : _a2.prop);
|
|
6234
|
+
});
|
|
6226
6235
|
};
|
|
6227
6236
|
const localShowColumn = ref(initLocalShow());
|
|
6228
6237
|
watch(() => {
|
|
@@ -6250,6 +6259,19 @@ __sfc_main.setup = (__props, __ctx) => {
|
|
|
6250
6259
|
(_a2 = instance == null ? void 0 : instance.$cookies) == null ? void 0 : _a2.set(props.storageKey, JSON.stringify(columnState), -1);
|
|
6251
6260
|
}
|
|
6252
6261
|
};
|
|
6262
|
+
const syncShowItemToInitHidden = () => {
|
|
6263
|
+
props.columns._skip = true;
|
|
6264
|
+
props.columns.forEach((item) => {
|
|
6265
|
+
var _a2, _b2;
|
|
6266
|
+
const prop = item.prop || ((_a2 = item.attr) == null ? void 0 : _a2.prop);
|
|
6267
|
+
if ((_b2 = localShowColumn.value) == null ? void 0 : _b2.includes(prop)) {
|
|
6268
|
+
item.initHidden = false;
|
|
6269
|
+
} else {
|
|
6270
|
+
item.initHidden = true;
|
|
6271
|
+
}
|
|
6272
|
+
});
|
|
6273
|
+
props.columns._skip = false;
|
|
6274
|
+
};
|
|
6253
6275
|
const syncCookiesToLocalShowColumn = () => {
|
|
6254
6276
|
var _a2;
|
|
6255
6277
|
if (props.columnEdit) {
|
|
@@ -6265,15 +6287,7 @@ __sfc_main.setup = (__props, __ctx) => {
|
|
|
6265
6287
|
}
|
|
6266
6288
|
}
|
|
6267
6289
|
localShowColumn.value = showColumnItems;
|
|
6268
|
-
|
|
6269
|
-
var _a3, _b2;
|
|
6270
|
-
const prop = item.prop || ((_a3 = item.attr) == null ? void 0 : _a3.prop);
|
|
6271
|
-
if ((_b2 = localShowColumn.value) == null ? void 0 : _b2.includes(prop)) {
|
|
6272
|
-
item.initHidden = false;
|
|
6273
|
-
} else {
|
|
6274
|
-
item.initHidden = true;
|
|
6275
|
-
}
|
|
6276
|
-
});
|
|
6290
|
+
syncShowItemToInitHidden();
|
|
6277
6291
|
}
|
|
6278
6292
|
}
|
|
6279
6293
|
};
|
|
@@ -6288,8 +6302,9 @@ __sfc_main.setup = (__props, __ctx) => {
|
|
|
6288
6302
|
}
|
|
6289
6303
|
const tableColumns = ref([]);
|
|
6290
6304
|
const elTableRefKey = ref(Date.now());
|
|
6291
|
-
const syncCookiesToTableColumn = () => {
|
|
6305
|
+
const syncCookiesToTableColumn = (readCached = true) => {
|
|
6292
6306
|
var _a2;
|
|
6307
|
+
props.columns._skip = true;
|
|
6293
6308
|
const columns = props.columns.map((item, index2) => {
|
|
6294
6309
|
var _a3;
|
|
6295
6310
|
((_a3 = item.label) == null ? void 0 : _a3.length) || 0;
|
|
@@ -6314,7 +6329,7 @@ __sfc_main.setup = (__props, __ctx) => {
|
|
|
6314
6329
|
item.__index = index2;
|
|
6315
6330
|
return item;
|
|
6316
6331
|
});
|
|
6317
|
-
if (props.columnEdit) {
|
|
6332
|
+
if (readCached && props.columnEdit) {
|
|
6318
6333
|
let columnState = (_a2 = instance == null ? void 0 : instance.$cookies) == null ? void 0 : _a2.get(props.storageKey);
|
|
6319
6334
|
if (columnState) {
|
|
6320
6335
|
if (typeof columnState === "string") {
|
|
@@ -6336,21 +6351,34 @@ __sfc_main.setup = (__props, __ctx) => {
|
|
|
6336
6351
|
}
|
|
6337
6352
|
}
|
|
6338
6353
|
}
|
|
6354
|
+
props.columns._skip = true;
|
|
6339
6355
|
tableColumns.value = columns.sort((a, b) => a._index - b._index < 0 ? -1 : a._index - b._index > 0 ? 1 : 0);
|
|
6340
6356
|
elTableRefKey.value = Date.now();
|
|
6341
6357
|
};
|
|
6342
6358
|
syncCookiesToTableColumn();
|
|
6359
|
+
onBeforeMount(() => {
|
|
6360
|
+
watch(() => {
|
|
6361
|
+
return props.columns;
|
|
6362
|
+
}, () => {
|
|
6363
|
+
if (props.columns._skip) {
|
|
6364
|
+
return;
|
|
6365
|
+
}
|
|
6366
|
+
syncCookiesToTableColumn();
|
|
6367
|
+
}, {
|
|
6368
|
+
deep: true
|
|
6369
|
+
});
|
|
6370
|
+
});
|
|
6343
6371
|
const tableAttrer = computed(() => {
|
|
6344
6372
|
const obj = {
|
|
6345
6373
|
"header-cell-style": {
|
|
6346
|
-
"text-align": "
|
|
6374
|
+
"text-align": "center",
|
|
6347
6375
|
"background": "#F5F7FA",
|
|
6348
6376
|
"height": "48px",
|
|
6349
6377
|
"color": "#303133",
|
|
6350
6378
|
"font-size": "14px"
|
|
6351
6379
|
},
|
|
6352
6380
|
"cell-style": {
|
|
6353
|
-
"text-align": "
|
|
6381
|
+
"text-align": "center"
|
|
6354
6382
|
},
|
|
6355
6383
|
resizable: true,
|
|
6356
6384
|
border: true,
|
|
@@ -6457,16 +6485,6 @@ __sfc_main.setup = (__props, __ctx) => {
|
|
|
6457
6485
|
}
|
|
6458
6486
|
await ((_b2 = (_a2 = props.tableEvents)["header-dragend"]) == null ? void 0 : _b2.call(_a2, newWidth, oldWidth, column, event));
|
|
6459
6487
|
};
|
|
6460
|
-
const syncShowItemToInitHidden = () => {
|
|
6461
|
-
props.columns.forEach((item) => {
|
|
6462
|
-
var _a2;
|
|
6463
|
-
if ((_a2 = localShowColumn.value) == null ? void 0 : _a2.includes(item.prop)) {
|
|
6464
|
-
item.initHidden = false;
|
|
6465
|
-
} else {
|
|
6466
|
-
item.initHidden = true;
|
|
6467
|
-
}
|
|
6468
|
-
});
|
|
6469
|
-
};
|
|
6470
6488
|
const columnCheckConfirmFeedback = (value) => {
|
|
6471
6489
|
if (!props.columnEdit) {
|
|
6472
6490
|
const itemsList = [];
|
|
@@ -6512,7 +6530,6 @@ __sfc_main.setup = (__props, __ctx) => {
|
|
|
6512
6530
|
}
|
|
6513
6531
|
});
|
|
6514
6532
|
return Object.assign({
|
|
6515
|
-
props,
|
|
6516
6533
|
elTableRef,
|
|
6517
6534
|
nfTableActionContainerRef,
|
|
6518
6535
|
nfTablePaginationRef,
|
|
@@ -7275,7 +7292,7 @@ var _sfc_render = function render3() {
|
|
|
7275
7292
|
ref: "columnCheckDialog",
|
|
7276
7293
|
attrs: {
|
|
7277
7294
|
"show": _vm.nfColumCheckDialogVisible,
|
|
7278
|
-
"table-columns": _vm.
|
|
7295
|
+
"table-columns": _vm.columns,
|
|
7279
7296
|
"show-column": _vm.localShowColumn,
|
|
7280
7297
|
"storage-key": _vm.storageKey,
|
|
7281
7298
|
"title": _vm.columnCheckTitle,
|
|
@@ -7341,7 +7358,7 @@ var _sfc_render = function render3() {
|
|
|
7341
7358
|
"get-all-check-desc": _vm.columnCheckGetAllCheckDesc,
|
|
7342
7359
|
"operation-prop-key": _vm.operationPropKey,
|
|
7343
7360
|
"storage-key": _vm.storageKey,
|
|
7344
|
-
"table-columns": _vm.
|
|
7361
|
+
"table-columns": _vm.columns,
|
|
7345
7362
|
"select-empty-warning-tips": _vm.selectEmptyWarningTips
|
|
7346
7363
|
}
|
|
7347
7364
|
})], 2) : _vm._e()], 2);
|
package/lib/nf-table.vue.d.ts
CHANGED
|
@@ -38,7 +38,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue-demi").DefineCompone
|
|
|
38
38
|
default: string;
|
|
39
39
|
};
|
|
40
40
|
columns: {
|
|
41
|
-
type: import("vue-demi").PropType<
|
|
41
|
+
type: import("vue-demi").PropType<any>;
|
|
42
42
|
default: () => never[];
|
|
43
43
|
};
|
|
44
44
|
searchFormAttrs: {
|
|
@@ -336,7 +336,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue-demi").DefineCompone
|
|
|
336
336
|
}[]>;
|
|
337
337
|
syncLocalShowColumnToCookies: () => void;
|
|
338
338
|
syncCookiesToLocalShowColumn: () => void;
|
|
339
|
-
syncCookiesToTableColumn: () => void;
|
|
339
|
+
syncCookiesToTableColumn: (readCached?: boolean) => void;
|
|
340
340
|
}, {}, {}, {}, import("vue/types/v3-component-options").ComponentOptionsMixin, import("vue/types/v3-component-options").ComponentOptionsMixin, {
|
|
341
341
|
fieldsChange: (event: string[]) => void;
|
|
342
342
|
"update:showColumn": (event: string[] | undefined) => void;
|
|
@@ -378,7 +378,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue-demi").DefineCompone
|
|
|
378
378
|
default: string;
|
|
379
379
|
};
|
|
380
380
|
columns: {
|
|
381
|
-
type: import("vue-demi").PropType<
|
|
381
|
+
type: import("vue-demi").PropType<any>;
|
|
382
382
|
default: () => never[];
|
|
383
383
|
};
|
|
384
384
|
searchFormAttrs: {
|
|
@@ -613,7 +613,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue-demi").DefineCompone
|
|
|
613
613
|
text: string;
|
|
614
614
|
selectEmptyWarningTips: string;
|
|
615
615
|
operationPropKey: string;
|
|
616
|
-
columns: NfTableColumnAttributes[];
|
|
616
|
+
columns: NfTableColumnAttributes[] | any;
|
|
617
617
|
searchFormAttrs: NfSearchFormAttributes;
|
|
618
618
|
searchFormEvents: Partial<Record<NfSearchFormEventKey, Function>>;
|
|
619
619
|
tableAttrs: ElTableAttributes;
|
package/package/nf-table.vue
CHANGED
|
@@ -467,7 +467,7 @@
|
|
|
467
467
|
<column-check-dialog
|
|
468
468
|
v-if="nfColumCheckDialogVisible && checkMode === 'dialog'"
|
|
469
469
|
:show.sync="nfColumCheckDialogVisible"
|
|
470
|
-
:table-columns="
|
|
470
|
+
:table-columns="columns"
|
|
471
471
|
:show-column="localShowColumn"
|
|
472
472
|
:storage-key="storageKey"
|
|
473
473
|
@save="fieldsConfirm"
|
|
@@ -520,7 +520,7 @@
|
|
|
520
520
|
:operation-prop-key="operationPropKey"
|
|
521
521
|
ref="columnCheckDrawer"
|
|
522
522
|
:storage-key="storageKey"
|
|
523
|
-
:table-columns="
|
|
523
|
+
:table-columns="columns"
|
|
524
524
|
:select-empty-warning-tips="selectEmptyWarningTips"
|
|
525
525
|
/>
|
|
526
526
|
</nf-drawer>
|
|
@@ -545,6 +545,7 @@ import {
|
|
|
545
545
|
getCurrentInstance,
|
|
546
546
|
nextTick,
|
|
547
547
|
onMounted,
|
|
548
|
+
onBeforeMount,
|
|
548
549
|
ref,
|
|
549
550
|
watch
|
|
550
551
|
} from 'vue-demi'
|
|
@@ -563,7 +564,7 @@ import { ITabItem } from '@94ai/nf-drawer/lib/types'
|
|
|
563
564
|
|
|
564
565
|
const props = withDefaults(defineProps<{
|
|
565
566
|
data?: Record<string, any>[],
|
|
566
|
-
columns?: NfTableColumnAttributes[],
|
|
567
|
+
columns?: NfTableColumnAttributes[] | any,
|
|
567
568
|
searchFormAttrs?: NfSearchFormAttributes,
|
|
568
569
|
searchFormEvents?: Partial<Record<NfSearchFormEventKey, Function>>,
|
|
569
570
|
tableAttrs?: ElTableAttributes,
|
|
@@ -803,13 +804,19 @@ watch(() => {
|
|
|
803
804
|
})
|
|
804
805
|
// 同步用户参数
|
|
805
806
|
const initLocalShow = () => {
|
|
806
|
-
|
|
807
|
+
props.columns._skip = true
|
|
808
|
+
const result = props.columns.filter(item => {
|
|
807
809
|
const prop = item.prop || item.attr?.prop
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
return item.initHidden
|
|
810
|
+
if (props.showColumn?.includes(prop!)) {
|
|
811
|
+
item.initHidden = false
|
|
812
|
+
}
|
|
813
|
+
return !item.initHidden
|
|
812
814
|
}).map(item => item.prop! || item.attr?.prop!)
|
|
815
|
+
props.columns._skip = false
|
|
816
|
+
if (result.length) {
|
|
817
|
+
return result
|
|
818
|
+
}
|
|
819
|
+
return props.columns.map(item => item.prop! || item.attr?.prop!)
|
|
813
820
|
}
|
|
814
821
|
const localShowColumn = ref<string[]>(initLocalShow())
|
|
815
822
|
watch(() => localShowColumn.value?.length, () => {
|
|
@@ -834,6 +841,19 @@ const syncLocalShowColumnToCookies = () => {
|
|
|
834
841
|
instance?.$cookies?.set(props.storageKey, JSON.stringify(columnState), -1)
|
|
835
842
|
}
|
|
836
843
|
}
|
|
844
|
+
|
|
845
|
+
const syncShowItemToInitHidden = () => {
|
|
846
|
+
props.columns._skip = true
|
|
847
|
+
props.columns.forEach(item => {
|
|
848
|
+
const prop = item.prop || item.attr?.prop
|
|
849
|
+
if (localShowColumn.value?.includes(prop!)) {
|
|
850
|
+
item.initHidden = false
|
|
851
|
+
} else {
|
|
852
|
+
item.initHidden = true
|
|
853
|
+
}
|
|
854
|
+
})
|
|
855
|
+
props.columns._skip = false
|
|
856
|
+
}
|
|
837
857
|
const syncCookiesToLocalShowColumn = () => {
|
|
838
858
|
if (props.columnEdit) {
|
|
839
859
|
let columnState: string | NfTableColumnAttributes | null = instance?.$cookies?.get(props.storageKey)
|
|
@@ -848,15 +868,7 @@ const syncCookiesToLocalShowColumn = () => {
|
|
|
848
868
|
}
|
|
849
869
|
}
|
|
850
870
|
localShowColumn.value = showColumnItems
|
|
851
|
-
|
|
852
|
-
props.columns.forEach(item => {
|
|
853
|
-
const prop = item.prop || item.attr?.prop
|
|
854
|
-
if (localShowColumn.value?.includes(prop!)) {
|
|
855
|
-
item.initHidden = false
|
|
856
|
-
} else {
|
|
857
|
-
item.initHidden = true
|
|
858
|
-
}
|
|
859
|
-
})
|
|
871
|
+
syncShowItemToInitHidden()
|
|
860
872
|
}
|
|
861
873
|
}
|
|
862
874
|
}
|
|
@@ -873,7 +885,8 @@ if (props.columnEdit) {
|
|
|
873
885
|
|
|
874
886
|
const tableColumns = ref<NfTableColumnAttributes[]>([])
|
|
875
887
|
const elTableRefKey = ref(Date.now())
|
|
876
|
-
const syncCookiesToTableColumn = () => {
|
|
888
|
+
const syncCookiesToTableColumn = (readCached = true) => {
|
|
889
|
+
props.columns._skip = true
|
|
877
890
|
const columns = props.columns!.map((item, index) => {
|
|
878
891
|
const len = item.label?.length || 0
|
|
879
892
|
const fz = 15 // 每个字大小,其实是每个字的比例值,大概会比字体大小差不多大一点,
|
|
@@ -903,7 +916,7 @@ const syncCookiesToTableColumn = () => {
|
|
|
903
916
|
item.__index = index
|
|
904
917
|
return item
|
|
905
918
|
})
|
|
906
|
-
if (props.columnEdit) {
|
|
919
|
+
if (readCached && props.columnEdit) {
|
|
907
920
|
// 读取缓存 Column 配置
|
|
908
921
|
let columnState: string | NfTableColumnAttributes | null = instance?.$cookies?.get(props.storageKey)
|
|
909
922
|
if (columnState) {
|
|
@@ -924,22 +937,36 @@ const syncCookiesToTableColumn = () => {
|
|
|
924
937
|
}
|
|
925
938
|
}
|
|
926
939
|
}
|
|
940
|
+
props.columns._skip = true
|
|
927
941
|
tableColumns.value = columns.sort((a, b) => a._index! - b._index! < 0 ? -1 : a._index! - b._index! > 0 ? 1 : 0)
|
|
928
942
|
elTableRefKey.value = Date.now()
|
|
929
943
|
}
|
|
930
944
|
|
|
931
945
|
syncCookiesToTableColumn()
|
|
932
946
|
|
|
947
|
+
onBeforeMount(() => {
|
|
948
|
+
watch(() => {
|
|
949
|
+
return props.columns
|
|
950
|
+
}, () => {
|
|
951
|
+
if (props.columns._skip) {
|
|
952
|
+
return
|
|
953
|
+
}
|
|
954
|
+
syncCookiesToTableColumn()
|
|
955
|
+
}, {
|
|
956
|
+
deep: true
|
|
957
|
+
})
|
|
958
|
+
})
|
|
959
|
+
|
|
933
960
|
const tableAttrer = computed(() => {
|
|
934
961
|
const obj: Record<string, any> = {
|
|
935
962
|
'header-cell-style': {
|
|
936
|
-
'text-align': '
|
|
963
|
+
'text-align': 'center',
|
|
937
964
|
'background': '#F5F7FA',
|
|
938
965
|
'height': '48px',
|
|
939
966
|
'color': '#303133',
|
|
940
967
|
'font-size': '14px'
|
|
941
968
|
},
|
|
942
|
-
'cell-style': { 'text-align': '
|
|
969
|
+
'cell-style': { 'text-align': 'center' },
|
|
943
970
|
resizable: true,
|
|
944
971
|
border: true,
|
|
945
972
|
...props.tableAttrs
|
|
@@ -1040,15 +1067,6 @@ const headerDragend = async (newWidth, oldWidth, column, event) => {
|
|
|
1040
1067
|
await props.tableEvents['header-dragend']?.(newWidth, oldWidth, column, event)
|
|
1041
1068
|
}
|
|
1042
1069
|
|
|
1043
|
-
const syncShowItemToInitHidden = () => {
|
|
1044
|
-
props.columns.forEach(item => {
|
|
1045
|
-
if (localShowColumn.value?.includes(item.prop!)) {
|
|
1046
|
-
item.initHidden = false
|
|
1047
|
-
} else {
|
|
1048
|
-
item.initHidden = true
|
|
1049
|
-
}
|
|
1050
|
-
})
|
|
1051
|
-
}
|
|
1052
1070
|
|
|
1053
1071
|
const columnCheckConfirmFeedback = (value: Record<string, any>) => {
|
|
1054
1072
|
if (!props.columnEdit) {
|
|
@@ -1072,7 +1090,6 @@ const fieldsConfirm = (value) => {
|
|
|
1072
1090
|
syncCookiesToLocalShowColumn()
|
|
1073
1091
|
syncCookiesToTableColumn()
|
|
1074
1092
|
emit('fieldsChange', localShowColumn.value)
|
|
1075
|
-
|
|
1076
1093
|
}
|
|
1077
1094
|
/**
|
|
1078
1095
|
* 抽屉确定
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@94ai/nf-table",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.29",
|
|
4
4
|
"description": "> TODO: description",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"author": "zoujiahe <zoujiahe@94ai.com>",
|
|
@@ -14,10 +14,10 @@
|
|
|
14
14
|
"url": "http://94ai.gitlab.com/zoujiahe/common-ui.git"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@94ai/nf-drawer": "^3.2.
|
|
18
|
-
"@94ai/nf-message": "^3.2.
|
|
19
|
-
"@94ai/nf-search-form": "^3.2.
|
|
20
|
-
"@94ai/nf-theme-chalk": "^3.2.
|
|
17
|
+
"@94ai/nf-drawer": "^3.2.29",
|
|
18
|
+
"@94ai/nf-message": "^3.2.29",
|
|
19
|
+
"@94ai/nf-search-form": "^3.2.29",
|
|
20
|
+
"@94ai/nf-theme-chalk": "^3.2.29",
|
|
21
21
|
"vue-cookies": "^1.8.3",
|
|
22
22
|
"vue-demi": "^0.14.5",
|
|
23
23
|
"vuedraggable": "^2.24.3"
|
|
@@ -35,5 +35,5 @@
|
|
|
35
35
|
"types": "lib/index.d.ts",
|
|
36
36
|
"main": "lib/nf-table.cjs.js",
|
|
37
37
|
"module": "lib/nf-table.esm-bundler.js",
|
|
38
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "d50a6e5d90176f48f79efc659a7f66bbc31721e2"
|
|
39
39
|
}
|