@94ai/nf-table 100.1.20 → 100.1.22
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 +2 -0
- package/lib/nf-table.cjs.js +28 -12
- package/lib/nf-table.esm-bundler.js +28 -12
- package/lib/nf-table.vue.d.ts +1 -0
- package/package/nf-table.vue +32 -12
- package/package.json +7 -7
package/lib/index.d.ts
CHANGED
|
@@ -928,6 +928,7 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
|
|
|
928
928
|
'filtered-value'?: string[] | undefined;
|
|
929
929
|
} | undefined;
|
|
930
930
|
}[]>;
|
|
931
|
+
calcTableHeight: () => void;
|
|
931
932
|
syncLocalShowColumnToCookies: () => void;
|
|
932
933
|
syncCookiesToLocalShowColumn: () => Promise<void>;
|
|
933
934
|
syncCookiesToTableColumn: (readCached?: boolean) => Promise<void>;
|
|
@@ -1529,6 +1530,7 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
|
|
|
1529
1530
|
'filtered-value'?: string[] | undefined;
|
|
1530
1531
|
} | undefined;
|
|
1531
1532
|
}[]>;
|
|
1533
|
+
calcTableHeight: () => void;
|
|
1532
1534
|
syncLocalShowColumnToCookies: () => void;
|
|
1533
1535
|
syncCookiesToLocalShowColumn: () => Promise<void>;
|
|
1534
1536
|
syncCookiesToTableColumn: (readCached?: boolean) => Promise<void>;
|
package/lib/nf-table.cjs.js
CHANGED
|
@@ -6226,8 +6226,10 @@ __sfc_main.setup = (__props, __ctx) => {
|
|
|
6226
6226
|
}, {
|
|
6227
6227
|
immediate: true
|
|
6228
6228
|
});
|
|
6229
|
-
const initLocalShow = () => {
|
|
6230
|
-
|
|
6229
|
+
const initLocalShow = (init = false) => {
|
|
6230
|
+
if (!init) {
|
|
6231
|
+
props.columns._skip = true;
|
|
6232
|
+
}
|
|
6231
6233
|
const result = props.columns.filter((item) => {
|
|
6232
6234
|
var _a2, _b;
|
|
6233
6235
|
const prop = item.prop || ((_a2 = item.attr) == null ? void 0 : _a2.prop);
|
|
@@ -6239,9 +6241,11 @@ __sfc_main.setup = (__props, __ctx) => {
|
|
|
6239
6241
|
var _a2;
|
|
6240
6242
|
return item.prop || ((_a2 = item.attr) == null ? void 0 : _a2.prop);
|
|
6241
6243
|
});
|
|
6242
|
-
|
|
6243
|
-
|
|
6244
|
-
|
|
6244
|
+
if (!init) {
|
|
6245
|
+
vueDemi.nextTick(() => {
|
|
6246
|
+
props.columns._skip = false;
|
|
6247
|
+
});
|
|
6248
|
+
}
|
|
6245
6249
|
if (result.length) {
|
|
6246
6250
|
return result;
|
|
6247
6251
|
}
|
|
@@ -6250,7 +6254,7 @@ __sfc_main.setup = (__props, __ctx) => {
|
|
|
6250
6254
|
return item.prop || ((_a2 = item.attr) == null ? void 0 : _a2.prop);
|
|
6251
6255
|
});
|
|
6252
6256
|
};
|
|
6253
|
-
const localShowColumn = vueDemi.ref(initLocalShow());
|
|
6257
|
+
const localShowColumn = vueDemi.ref(initLocalShow(true));
|
|
6254
6258
|
vueDemi.watch(() => {
|
|
6255
6259
|
var _a2;
|
|
6256
6260
|
return (_a2 = localShowColumn.value) == null ? void 0 : _a2.length;
|
|
@@ -6551,7 +6555,7 @@ __sfc_main.setup = (__props, __ctx) => {
|
|
|
6551
6555
|
};
|
|
6552
6556
|
const columnCheckConfirm = async (cb, error) => {
|
|
6553
6557
|
try {
|
|
6554
|
-
const value =
|
|
6558
|
+
const value = columnCheckDrawer.value.syncTableColumnsToCookies();
|
|
6555
6559
|
columnCheckConfirmFeedback(value);
|
|
6556
6560
|
await syncCookiesToLocalShowColumn();
|
|
6557
6561
|
await syncCookiesToTableColumn();
|
|
@@ -6562,7 +6566,7 @@ __sfc_main.setup = (__props, __ctx) => {
|
|
|
6562
6566
|
console.log(e);
|
|
6563
6567
|
}
|
|
6564
6568
|
};
|
|
6565
|
-
|
|
6569
|
+
const calcTableHeight = () => {
|
|
6566
6570
|
var _a2, _b;
|
|
6567
6571
|
if (props.calHeight && nfTableContent.value) {
|
|
6568
6572
|
const tableContentH = (_a2 = nfTableContent.value) == null ? void 0 : _a2.offsetHeight;
|
|
@@ -6574,6 +6578,14 @@ __sfc_main.setup = (__props, __ctx) => {
|
|
|
6574
6578
|
} else {
|
|
6575
6579
|
elTableHeight.value = (_b = props.tableAttrs) == null ? void 0 : _b.height;
|
|
6576
6580
|
}
|
|
6581
|
+
};
|
|
6582
|
+
vueDemi.onMounted(() => {
|
|
6583
|
+
calcTableHeight();
|
|
6584
|
+
props.columns.forEach((i) => {
|
|
6585
|
+
if (i.singleHeadMutiColSlot) {
|
|
6586
|
+
console.log("🔅 ~ onMounted ~ props.columns:", props.columns);
|
|
6587
|
+
}
|
|
6588
|
+
});
|
|
6577
6589
|
});
|
|
6578
6590
|
return Object.assign({
|
|
6579
6591
|
elTableRef,
|
|
@@ -6713,6 +6725,10 @@ __sfc_main.setup = (__props, __ctx) => {
|
|
|
6713
6725
|
* 渲染表格项数据
|
|
6714
6726
|
*/
|
|
6715
6727
|
tableColumns,
|
|
6728
|
+
/**
|
|
6729
|
+
* 计算表格高度
|
|
6730
|
+
*/
|
|
6731
|
+
calcTableHeight,
|
|
6716
6732
|
/**
|
|
6717
6733
|
* 列编辑同步组件到cookies
|
|
6718
6734
|
*/
|
|
@@ -6799,7 +6815,7 @@ var _sfc_render = function render3() {
|
|
|
6799
6815
|
}
|
|
6800
6816
|
}, "el-table", _vm.tableAttrer, false), _vm.tableEventer), [_vm._l(_vm.tableColumns, function(column) {
|
|
6801
6817
|
return [_vm.isShow(column) ? [column.type ? [column.render || column.prop || column.slot ? _c("el-table-column", _vm._b({
|
|
6802
|
-
key: column.
|
|
6818
|
+
key: column.key || column.prop,
|
|
6803
6819
|
attrs: {
|
|
6804
6820
|
"type": column.type,
|
|
6805
6821
|
"label": column.label
|
|
@@ -6819,13 +6835,13 @@ var _sfc_render = function render3() {
|
|
|
6819
6835
|
}
|
|
6820
6836
|
}], null, true)
|
|
6821
6837
|
}, "el-table-column", column.attr, false)) : _c("el-table-column", _vm._b({
|
|
6822
|
-
key: column.
|
|
6838
|
+
key: column.key || column.prop,
|
|
6823
6839
|
attrs: {
|
|
6824
6840
|
"type": column.type,
|
|
6825
6841
|
"label": column.label
|
|
6826
6842
|
}
|
|
6827
6843
|
}, "el-table-column", column.attr, false))] : [column.attr && column.attr.formatter ? _c("el-table-column", _vm._b({
|
|
6828
|
-
key: column.
|
|
6844
|
+
key: column.key || column.prop,
|
|
6829
6845
|
attrs: {
|
|
6830
6846
|
"prop": column.prop,
|
|
6831
6847
|
"label": column.label
|
|
@@ -6840,7 +6856,7 @@ var _sfc_render = function render3() {
|
|
|
6840
6856
|
}
|
|
6841
6857
|
}], null, true)
|
|
6842
6858
|
}, "el-table-column", column.attr, false), [column.singleHeadMutiColSlot ? _vm._t(column.singleHeadMutiColSlot) : _vm._e()], 2) : _c("el-table-column", _vm._b({
|
|
6843
|
-
key: column.
|
|
6859
|
+
key: column.key || column.prop,
|
|
6844
6860
|
attrs: {
|
|
6845
6861
|
"prop": column.prop,
|
|
6846
6862
|
"label": column.label
|
|
@@ -6224,8 +6224,10 @@ __sfc_main.setup = (__props, __ctx) => {
|
|
|
6224
6224
|
}, {
|
|
6225
6225
|
immediate: true
|
|
6226
6226
|
});
|
|
6227
|
-
const initLocalShow = () => {
|
|
6228
|
-
|
|
6227
|
+
const initLocalShow = (init = false) => {
|
|
6228
|
+
if (!init) {
|
|
6229
|
+
props.columns._skip = true;
|
|
6230
|
+
}
|
|
6229
6231
|
const result = props.columns.filter((item) => {
|
|
6230
6232
|
var _a2, _b;
|
|
6231
6233
|
const prop = item.prop || ((_a2 = item.attr) == null ? void 0 : _a2.prop);
|
|
@@ -6237,9 +6239,11 @@ __sfc_main.setup = (__props, __ctx) => {
|
|
|
6237
6239
|
var _a2;
|
|
6238
6240
|
return item.prop || ((_a2 = item.attr) == null ? void 0 : _a2.prop);
|
|
6239
6241
|
});
|
|
6240
|
-
|
|
6241
|
-
|
|
6242
|
-
|
|
6242
|
+
if (!init) {
|
|
6243
|
+
nextTick(() => {
|
|
6244
|
+
props.columns._skip = false;
|
|
6245
|
+
});
|
|
6246
|
+
}
|
|
6243
6247
|
if (result.length) {
|
|
6244
6248
|
return result;
|
|
6245
6249
|
}
|
|
@@ -6248,7 +6252,7 @@ __sfc_main.setup = (__props, __ctx) => {
|
|
|
6248
6252
|
return item.prop || ((_a2 = item.attr) == null ? void 0 : _a2.prop);
|
|
6249
6253
|
});
|
|
6250
6254
|
};
|
|
6251
|
-
const localShowColumn = ref(initLocalShow());
|
|
6255
|
+
const localShowColumn = ref(initLocalShow(true));
|
|
6252
6256
|
watch(() => {
|
|
6253
6257
|
var _a2;
|
|
6254
6258
|
return (_a2 = localShowColumn.value) == null ? void 0 : _a2.length;
|
|
@@ -6549,7 +6553,7 @@ __sfc_main.setup = (__props, __ctx) => {
|
|
|
6549
6553
|
};
|
|
6550
6554
|
const columnCheckConfirm = async (cb, error) => {
|
|
6551
6555
|
try {
|
|
6552
|
-
const value =
|
|
6556
|
+
const value = columnCheckDrawer.value.syncTableColumnsToCookies();
|
|
6553
6557
|
columnCheckConfirmFeedback(value);
|
|
6554
6558
|
await syncCookiesToLocalShowColumn();
|
|
6555
6559
|
await syncCookiesToTableColumn();
|
|
@@ -6560,7 +6564,7 @@ __sfc_main.setup = (__props, __ctx) => {
|
|
|
6560
6564
|
console.log(e);
|
|
6561
6565
|
}
|
|
6562
6566
|
};
|
|
6563
|
-
|
|
6567
|
+
const calcTableHeight = () => {
|
|
6564
6568
|
var _a2, _b;
|
|
6565
6569
|
if (props.calHeight && nfTableContent.value) {
|
|
6566
6570
|
const tableContentH = (_a2 = nfTableContent.value) == null ? void 0 : _a2.offsetHeight;
|
|
@@ -6572,6 +6576,14 @@ __sfc_main.setup = (__props, __ctx) => {
|
|
|
6572
6576
|
} else {
|
|
6573
6577
|
elTableHeight.value = (_b = props.tableAttrs) == null ? void 0 : _b.height;
|
|
6574
6578
|
}
|
|
6579
|
+
};
|
|
6580
|
+
onMounted(() => {
|
|
6581
|
+
calcTableHeight();
|
|
6582
|
+
props.columns.forEach((i) => {
|
|
6583
|
+
if (i.singleHeadMutiColSlot) {
|
|
6584
|
+
console.log("🔅 ~ onMounted ~ props.columns:", props.columns);
|
|
6585
|
+
}
|
|
6586
|
+
});
|
|
6575
6587
|
});
|
|
6576
6588
|
return Object.assign({
|
|
6577
6589
|
elTableRef,
|
|
@@ -6711,6 +6723,10 @@ __sfc_main.setup = (__props, __ctx) => {
|
|
|
6711
6723
|
* 渲染表格项数据
|
|
6712
6724
|
*/
|
|
6713
6725
|
tableColumns,
|
|
6726
|
+
/**
|
|
6727
|
+
* 计算表格高度
|
|
6728
|
+
*/
|
|
6729
|
+
calcTableHeight,
|
|
6714
6730
|
/**
|
|
6715
6731
|
* 列编辑同步组件到cookies
|
|
6716
6732
|
*/
|
|
@@ -6797,7 +6813,7 @@ var _sfc_render = function render3() {
|
|
|
6797
6813
|
}
|
|
6798
6814
|
}, "el-table", _vm.tableAttrer, false), _vm.tableEventer), [_vm._l(_vm.tableColumns, function(column) {
|
|
6799
6815
|
return [_vm.isShow(column) ? [column.type ? [column.render || column.prop || column.slot ? _c("el-table-column", _vm._b({
|
|
6800
|
-
key: column.
|
|
6816
|
+
key: column.key || column.prop,
|
|
6801
6817
|
attrs: {
|
|
6802
6818
|
"type": column.type,
|
|
6803
6819
|
"label": column.label
|
|
@@ -6817,13 +6833,13 @@ var _sfc_render = function render3() {
|
|
|
6817
6833
|
}
|
|
6818
6834
|
}], null, true)
|
|
6819
6835
|
}, "el-table-column", column.attr, false)) : _c("el-table-column", _vm._b({
|
|
6820
|
-
key: column.
|
|
6836
|
+
key: column.key || column.prop,
|
|
6821
6837
|
attrs: {
|
|
6822
6838
|
"type": column.type,
|
|
6823
6839
|
"label": column.label
|
|
6824
6840
|
}
|
|
6825
6841
|
}, "el-table-column", column.attr, false))] : [column.attr && column.attr.formatter ? _c("el-table-column", _vm._b({
|
|
6826
|
-
key: column.
|
|
6842
|
+
key: column.key || column.prop,
|
|
6827
6843
|
attrs: {
|
|
6828
6844
|
"prop": column.prop,
|
|
6829
6845
|
"label": column.label
|
|
@@ -6838,7 +6854,7 @@ var _sfc_render = function render3() {
|
|
|
6838
6854
|
}
|
|
6839
6855
|
}], null, true)
|
|
6840
6856
|
}, "el-table-column", column.attr, false), [column.singleHeadMutiColSlot ? _vm._t(column.singleHeadMutiColSlot) : _vm._e()], 2) : _c("el-table-column", _vm._b({
|
|
6841
|
-
key: column.
|
|
6857
|
+
key: column.key || column.prop,
|
|
6842
6858
|
attrs: {
|
|
6843
6859
|
"prop": column.prop,
|
|
6844
6860
|
"label": column.label
|
package/lib/nf-table.vue.d.ts
CHANGED
|
@@ -335,6 +335,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue-demi").DefineCompone
|
|
|
335
335
|
'filtered-value'?: string[] | undefined;
|
|
336
336
|
} | undefined;
|
|
337
337
|
}[]>;
|
|
338
|
+
calcTableHeight: () => void;
|
|
338
339
|
syncLocalShowColumnToCookies: () => void;
|
|
339
340
|
syncCookiesToLocalShowColumn: () => Promise<void>;
|
|
340
341
|
syncCookiesToTableColumn: (readCached?: boolean) => Promise<void>;
|
package/package/nf-table.vue
CHANGED
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
<template v-for="column in tableColumns">
|
|
55
55
|
<template v-if="isShow(column)">
|
|
56
56
|
<template v-if="column.type">
|
|
57
|
-
<el-table-column :key="column.
|
|
57
|
+
<el-table-column :key="column.key || column.prop" :type="column.type" :label="column.label" v-bind="column.attr"
|
|
58
58
|
v-if="column.render || column.prop || column.slot">
|
|
59
59
|
<template slot-scope="scope">
|
|
60
60
|
<render-component v-if="column.render" :render="column.render" :row="scope.row" />
|
|
@@ -64,13 +64,13 @@
|
|
|
64
64
|
</template>
|
|
65
65
|
</template>
|
|
66
66
|
</el-table-column>
|
|
67
|
-
<el-table-column :key="column.
|
|
67
|
+
<el-table-column :key="column.key || column.prop" :type="column.type" :label="column.label" v-bind="column.attr"
|
|
68
68
|
v-else />
|
|
69
69
|
</template>
|
|
70
70
|
<template v-else>
|
|
71
71
|
<el-table-column
|
|
72
72
|
v-if="column.attr&&column.attr.formatter"
|
|
73
|
-
:key="column.
|
|
73
|
+
:key="column.key || column.prop"
|
|
74
74
|
:prop="column.prop"
|
|
75
75
|
:label="column.label"
|
|
76
76
|
v-bind="column.attr"
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
</span>
|
|
86
86
|
</template>
|
|
87
87
|
</el-table-column>
|
|
88
|
-
<el-table-column v-else :key="column.
|
|
88
|
+
<el-table-column v-else :key="column.key || column.prop" :prop="column.prop" :label="column.label"
|
|
89
89
|
v-bind="column.attr">
|
|
90
90
|
<slot v-if="column.singleHeadMutiColSlot" :name="column.singleHeadMutiColSlot" />
|
|
91
91
|
<template slot="header" slot-scope="scope">
|
|
@@ -807,8 +807,10 @@ watch(() => {
|
|
|
807
807
|
immediate: true
|
|
808
808
|
})
|
|
809
809
|
// 同步用户参数
|
|
810
|
-
const initLocalShow = () => {
|
|
811
|
-
|
|
810
|
+
const initLocalShow = (init = false) => {
|
|
811
|
+
if (!init) {
|
|
812
|
+
props.columns._skip = true
|
|
813
|
+
}
|
|
812
814
|
const result = props.columns.filter(item => {
|
|
813
815
|
const prop = item.prop || item.attr?.prop
|
|
814
816
|
if (props.showColumn?.includes(prop!)) {
|
|
@@ -816,15 +818,17 @@ const initLocalShow = () => {
|
|
|
816
818
|
}
|
|
817
819
|
return !item.initHidden
|
|
818
820
|
}).map(item => item.prop! || item.attr?.prop!)
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
821
|
+
if (!init) {
|
|
822
|
+
nextTick(() => {
|
|
823
|
+
props.columns._skip = false
|
|
824
|
+
})
|
|
825
|
+
}
|
|
822
826
|
if (result.length) {
|
|
823
827
|
return result
|
|
824
828
|
}
|
|
825
829
|
return props.columns.map(item => item.prop! || item.attr?.prop!)
|
|
826
830
|
}
|
|
827
|
-
const localShowColumn = ref<string[]>(initLocalShow())
|
|
831
|
+
const localShowColumn = ref<string[]>(initLocalShow(true))
|
|
828
832
|
watch(() => localShowColumn.value?.length, () => {
|
|
829
833
|
emit('update:showColumn', localShowColumn.value)
|
|
830
834
|
}, {
|
|
@@ -1138,7 +1142,7 @@ const fieldsConfirm = async (value) => {
|
|
|
1138
1142
|
*/
|
|
1139
1143
|
const columnCheckConfirm = async (cb, error) => {
|
|
1140
1144
|
try {
|
|
1141
|
-
const value =
|
|
1145
|
+
const value = columnCheckDrawer.value.syncTableColumnsToCookies()
|
|
1142
1146
|
columnCheckConfirmFeedback(value)
|
|
1143
1147
|
await syncCookiesToLocalShowColumn()
|
|
1144
1148
|
await syncCookiesToTableColumn()
|
|
@@ -1150,7 +1154,10 @@ const columnCheckConfirm = async (cb, error) => {
|
|
|
1150
1154
|
}
|
|
1151
1155
|
}
|
|
1152
1156
|
|
|
1153
|
-
|
|
1157
|
+
/**
|
|
1158
|
+
* 计算表格高度
|
|
1159
|
+
*/
|
|
1160
|
+
const calcTableHeight = () => {
|
|
1154
1161
|
if (
|
|
1155
1162
|
props.calHeight && nfTableContent.value
|
|
1156
1163
|
) {
|
|
@@ -1163,6 +1170,15 @@ onMounted(() => {
|
|
|
1163
1170
|
} else {
|
|
1164
1171
|
elTableHeight.value = props.tableAttrs?.height
|
|
1165
1172
|
}
|
|
1173
|
+
}
|
|
1174
|
+
|
|
1175
|
+
onMounted(() => {
|
|
1176
|
+
calcTableHeight()
|
|
1177
|
+
props.columns.forEach(i => {
|
|
1178
|
+
if (i.singleHeadMutiColSlot) {
|
|
1179
|
+
console.log('🔅 ~ onMounted ~ props.columns:', props.columns)
|
|
1180
|
+
}
|
|
1181
|
+
})
|
|
1166
1182
|
})
|
|
1167
1183
|
|
|
1168
1184
|
|
|
@@ -1279,6 +1295,10 @@ defineExpose({
|
|
|
1279
1295
|
* 渲染表格项数据
|
|
1280
1296
|
*/
|
|
1281
1297
|
tableColumns,
|
|
1298
|
+
/**
|
|
1299
|
+
* 计算表格高度
|
|
1300
|
+
*/
|
|
1301
|
+
calcTableHeight,
|
|
1282
1302
|
/**
|
|
1283
1303
|
* 列编辑同步组件到cookies
|
|
1284
1304
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@94ai/nf-table",
|
|
3
|
-
"version": "100.1.
|
|
3
|
+
"version": "100.1.22",
|
|
4
4
|
"description": "> TODO: description",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"author": "zoujiahe <zoujiahe@94ai.com>",
|
|
@@ -14,11 +14,11 @@
|
|
|
14
14
|
"url": "http://94ai.gitlab.com/zoujiahe/common-ui.git"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@94ai/common-utils": "^100.1.
|
|
18
|
-
"@94ai/nf-drawer": "^100.1.
|
|
19
|
-
"@94ai/nf-message": "^100.1.
|
|
20
|
-
"@94ai/nf-search-form": "^100.1.
|
|
21
|
-
"@94ai/nf-theme-chalk": "^100.1.
|
|
17
|
+
"@94ai/common-utils": "^100.1.22",
|
|
18
|
+
"@94ai/nf-drawer": "^100.1.22",
|
|
19
|
+
"@94ai/nf-message": "^100.1.22",
|
|
20
|
+
"@94ai/nf-search-form": "^100.1.22",
|
|
21
|
+
"@94ai/nf-theme-chalk": "^100.1.22",
|
|
22
22
|
"idb-keyval": "^6.2.1",
|
|
23
23
|
"vue-demi": "^0.14.5",
|
|
24
24
|
"vuedraggable": "^2.24.3"
|
|
@@ -36,5 +36,5 @@
|
|
|
36
36
|
"types": "lib/index.d.ts",
|
|
37
37
|
"main": "lib/nf-table.cjs.js",
|
|
38
38
|
"module": "lib/nf-table.esm-bundler.js",
|
|
39
|
-
"gitHead": "
|
|
39
|
+
"gitHead": "afcd14101f617ec64d20d834d67d055c6e8dd548"
|
|
40
40
|
}
|