@94ai/nf-table 3.2.71 → 3.2.75
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/nf-table.cjs.js +94 -94
- package/lib/nf-table.esm-bundler.js +94 -94
- package/package/nf-table.vue +2 -2
- package/package.json +8 -8
package/lib/nf-table.cjs.js
CHANGED
|
@@ -150,14 +150,14 @@ __sfc_main$2.props = {
|
|
|
150
150
|
};
|
|
151
151
|
__sfc_main$2.setup = (__props, __ctx) => {
|
|
152
152
|
var _a;
|
|
153
|
-
const
|
|
153
|
+
const props = __props;
|
|
154
154
|
const emit = __ctx.emit;
|
|
155
155
|
(_a = vueDemi.getCurrentInstance()) == null ? void 0 : _a.proxy;
|
|
156
156
|
const tableData = vueDemi.ref({});
|
|
157
157
|
const unChangedColumn = vueDemi.ref([]);
|
|
158
158
|
const visible = vueDemi.computed({
|
|
159
159
|
get() {
|
|
160
|
-
return
|
|
160
|
+
return props.show;
|
|
161
161
|
},
|
|
162
162
|
set(val) {
|
|
163
163
|
emit("update:show", val);
|
|
@@ -165,9 +165,9 @@ __sfc_main$2.setup = (__props, __ctx) => {
|
|
|
165
165
|
});
|
|
166
166
|
const fields = vueDemi.computed(() => {
|
|
167
167
|
const obj = {};
|
|
168
|
-
|
|
168
|
+
props.tableColumns.filter((item) => !item.destory).map((item) => {
|
|
169
169
|
if (!item.type) {
|
|
170
|
-
const key = item.category ||
|
|
170
|
+
const key = item.category || props.basicFieldDesc;
|
|
171
171
|
if (!obj[key]) {
|
|
172
172
|
obj[key] = [];
|
|
173
173
|
}
|
|
@@ -186,7 +186,7 @@ __sfc_main$2.setup = (__props, __ctx) => {
|
|
|
186
186
|
const submit = () => {
|
|
187
187
|
visible.value = false;
|
|
188
188
|
const columnState = {};
|
|
189
|
-
|
|
189
|
+
props.tableColumns.map((i, index2) => {
|
|
190
190
|
var _a2;
|
|
191
191
|
columnState[i.prop] = {
|
|
192
192
|
initHidden: !tableData.value[i.prop] || false,
|
|
@@ -196,24 +196,24 @@ __sfc_main$2.setup = (__props, __ctx) => {
|
|
|
196
196
|
};
|
|
197
197
|
});
|
|
198
198
|
emit("save", tableData.value);
|
|
199
|
-
if (
|
|
200
|
-
commonUtils.CachedManager.syncCachedSet(
|
|
199
|
+
if (props.columnEdit) {
|
|
200
|
+
commonUtils.CachedManager.syncCachedSet(props.storageKey, columnState);
|
|
201
201
|
}
|
|
202
202
|
};
|
|
203
203
|
const addInitValue = () => {
|
|
204
204
|
const obj = {};
|
|
205
|
-
|
|
205
|
+
props.tableColumns.forEach((v) => {
|
|
206
206
|
obj[v.prop] = !v.initHidden;
|
|
207
207
|
});
|
|
208
208
|
tableData.value = obj;
|
|
209
|
-
if (
|
|
209
|
+
if (props.tableColumns.findIndex((item) => !!item.type) > -1) {
|
|
210
210
|
unChangedColumn.value.push("selection");
|
|
211
211
|
}
|
|
212
|
-
if (
|
|
212
|
+
if (props.tableColumns.findIndex((item) => {
|
|
213
213
|
var _a2;
|
|
214
|
-
return (item.prop || ((_a2 = item.attr) == null ? void 0 : _a2.prop)) ===
|
|
214
|
+
return (item.prop || ((_a2 = item.attr) == null ? void 0 : _a2.prop)) === props.operationPropKey;
|
|
215
215
|
}) > -1) {
|
|
216
|
-
unChangedColumn.value.push(
|
|
216
|
+
unChangedColumn.value.push(props.operationPropKey);
|
|
217
217
|
}
|
|
218
218
|
};
|
|
219
219
|
vueDemi.onMounted(() => {
|
|
@@ -4863,9 +4863,9 @@ const require$$0 = /* @__PURE__ */ getAugmentedNamespace(sortable_esm);
|
|
|
4863
4863
|
if (!componentData) {
|
|
4864
4864
|
return attributes;
|
|
4865
4865
|
}
|
|
4866
|
-
var on2 = componentData.on,
|
|
4866
|
+
var on2 = componentData.on, props2 = componentData.props, componentDataAttrs = componentData.attrs;
|
|
4867
4867
|
update("on", on2);
|
|
4868
|
-
update("props",
|
|
4868
|
+
update("props", props2);
|
|
4869
4869
|
Object.assign(attributes.attrs, componentDataAttrs);
|
|
4870
4870
|
return attributes;
|
|
4871
4871
|
}
|
|
@@ -4875,7 +4875,7 @@ const require$$0 = /* @__PURE__ */ getAugmentedNamespace(sortable_esm);
|
|
|
4875
4875
|
return "on" + evt;
|
|
4876
4876
|
});
|
|
4877
4877
|
var draggingElement = null;
|
|
4878
|
-
var
|
|
4878
|
+
var props = {
|
|
4879
4879
|
options: Object,
|
|
4880
4880
|
list: {
|
|
4881
4881
|
type: Array,
|
|
@@ -4918,7 +4918,7 @@ const require$$0 = /* @__PURE__ */ getAugmentedNamespace(sortable_esm);
|
|
|
4918
4918
|
var draggableComponent = {
|
|
4919
4919
|
name: "draggable",
|
|
4920
4920
|
inheritAttrs: false,
|
|
4921
|
-
props
|
|
4921
|
+
props,
|
|
4922
4922
|
data: function data() {
|
|
4923
4923
|
return {
|
|
4924
4924
|
transitionMode: false,
|
|
@@ -5332,20 +5332,20 @@ __sfc_main$1.props = {
|
|
|
5332
5332
|
__sfc_main$1.setup = (__props, __ctx) => {
|
|
5333
5333
|
var _a;
|
|
5334
5334
|
const instance = (_a = vueDemi.getCurrentInstance()) == null ? void 0 : _a.proxy;
|
|
5335
|
-
const
|
|
5335
|
+
const props = __props;
|
|
5336
5336
|
const currentTable = vueDemi.ref([]);
|
|
5337
5337
|
const showColumn = vueDemi.ref([]);
|
|
5338
5338
|
const unChangedColumn = vueDemi.ref([]);
|
|
5339
5339
|
const fixedColumn = vueDemi.ref([]);
|
|
5340
5340
|
const unFixedColumn = vueDemi.ref([]);
|
|
5341
5341
|
vueDemi.onBeforeMount(() => {
|
|
5342
|
-
currentTable.value = commonUtils.deepClone(
|
|
5342
|
+
currentTable.value = commonUtils.deepClone(props.tableColumns.filter((item) => !item.destory)).sort((a, b) => a._index - b._index < 0 ? -1 : a._index - b._index > 0 ? 1 : 0);
|
|
5343
5343
|
currentTable.value.map((i) => {
|
|
5344
5344
|
if (!i.attr) {
|
|
5345
5345
|
i.attr = {};
|
|
5346
5346
|
}
|
|
5347
5347
|
});
|
|
5348
|
-
const list =
|
|
5348
|
+
const list = props.tableColumns.filter((item) => !item.destory);
|
|
5349
5349
|
setFields(list);
|
|
5350
5350
|
updateColumn();
|
|
5351
5351
|
if (currentTable.value.findIndex((item) => !!item.type) > -1) {
|
|
@@ -5353,9 +5353,9 @@ __sfc_main$1.setup = (__props, __ctx) => {
|
|
|
5353
5353
|
}
|
|
5354
5354
|
if (currentTable.value.findIndex((item) => {
|
|
5355
5355
|
var _a2;
|
|
5356
|
-
return (item.prop || ((_a2 = item.attr) == null ? void 0 : _a2.prop)) ===
|
|
5356
|
+
return (item.prop || ((_a2 = item.attr) == null ? void 0 : _a2.prop)) === props.operationPropKey;
|
|
5357
5357
|
}) > -1) {
|
|
5358
|
-
unChangedColumn.value.push(
|
|
5358
|
+
unChangedColumn.value.push(props.operationPropKey);
|
|
5359
5359
|
}
|
|
5360
5360
|
if (currentTable.value.every((i) => !i.initHidden)) {
|
|
5361
5361
|
showColumn.value = currentTable.value.map((i) => i.prop);
|
|
@@ -5368,7 +5368,7 @@ __sfc_main$1.setup = (__props, __ctx) => {
|
|
|
5368
5368
|
const setFields = (tableColumns) => {
|
|
5369
5369
|
const obj = {};
|
|
5370
5370
|
tableColumns.map((item) => {
|
|
5371
|
-
const key = item.category ||
|
|
5371
|
+
const key = item.category || props.basicFieldDesc;
|
|
5372
5372
|
if (!obj[key]) {
|
|
5373
5373
|
obj[key] = [];
|
|
5374
5374
|
}
|
|
@@ -5458,12 +5458,12 @@ __sfc_main$1.setup = (__props, __ctx) => {
|
|
|
5458
5458
|
const syncTableColumnsToCookies = () => {
|
|
5459
5459
|
var _a2;
|
|
5460
5460
|
const newTableColumns = [...fixedColumn.value, ...unFixedColumn.value];
|
|
5461
|
-
if (newTableColumns.filter((item) => !item.type && item.prop !==
|
|
5461
|
+
if (newTableColumns.filter((item) => !item.type && item.prop !== props.operationPropKey && !item.initHidden).length === 0) {
|
|
5462
5462
|
(_a2 = instance == null ? void 0 : instance.$openMessage) == null ? void 0 : _a2.warning({
|
|
5463
|
-
message:
|
|
5463
|
+
message: props.selectEmptyWarningTips,
|
|
5464
5464
|
duration: 2e3
|
|
5465
5465
|
});
|
|
5466
|
-
throw new Error(
|
|
5466
|
+
throw new Error(props.selectEmptyWarningTips);
|
|
5467
5467
|
}
|
|
5468
5468
|
const selectionPropItemIndex = newTableColumns.findIndex((item) => !!item.type);
|
|
5469
5469
|
if (selectionPropItemIndex > -1) {
|
|
@@ -5471,7 +5471,7 @@ __sfc_main$1.setup = (__props, __ctx) => {
|
|
|
5471
5471
|
}
|
|
5472
5472
|
const operationPropItemIndex = newTableColumns.findIndex((item) => {
|
|
5473
5473
|
var _a3;
|
|
5474
|
-
return (item.prop || ((_a3 = item.attr) == null ? void 0 : _a3.prop)) ===
|
|
5474
|
+
return (item.prop || ((_a3 = item.attr) == null ? void 0 : _a3.prop)) === props.operationPropKey;
|
|
5475
5475
|
});
|
|
5476
5476
|
if (operationPropItemIndex > -1) {
|
|
5477
5477
|
newTableColumns.push(newTableColumns.splice(operationPropItemIndex, 1)[0]);
|
|
@@ -5488,8 +5488,8 @@ __sfc_main$1.setup = (__props, __ctx) => {
|
|
|
5488
5488
|
};
|
|
5489
5489
|
obj[i.prop] = !columnState[i.prop].initHidden;
|
|
5490
5490
|
});
|
|
5491
|
-
if (
|
|
5492
|
-
commonUtils.CachedManager.syncCachedSet(
|
|
5491
|
+
if (props.columnEdit) {
|
|
5492
|
+
commonUtils.CachedManager.syncCachedSet(props.storageKey, columnState);
|
|
5493
5493
|
}
|
|
5494
5494
|
return obj;
|
|
5495
5495
|
};
|
|
@@ -5773,12 +5773,6 @@ const _sfc_render$1 = null;
|
|
|
5773
5773
|
const _sfc_staticRenderFns$1 = null;
|
|
5774
5774
|
var __component__$1 = /* @__PURE__ */ vue2RuntimeHelpers.normalizeComponent(_sfc_main, _sfc_render$1, _sfc_staticRenderFns$1, false, null, null, null, null);
|
|
5775
5775
|
const RenderComponent = __component__$1.exports;
|
|
5776
|
-
async function clearDragCached() {
|
|
5777
|
-
await commonUtils.CachedManager.asyncCachedSet(`${props.storageKey}$drag-column-width`, null);
|
|
5778
|
-
}
|
|
5779
|
-
async function clearColumnEditCached() {
|
|
5780
|
-
await commonUtils.CachedManager.asyncCachedSet(props.storageKey, null);
|
|
5781
|
-
}
|
|
5782
5776
|
const __sfc_main = vueDemi.defineComponent({
|
|
5783
5777
|
name: "nf-table"
|
|
5784
5778
|
});
|
|
@@ -6186,7 +6180,7 @@ __sfc_main.props = {
|
|
|
6186
6180
|
};
|
|
6187
6181
|
__sfc_main.setup = (__props, __ctx) => {
|
|
6188
6182
|
var _a;
|
|
6189
|
-
const
|
|
6183
|
+
const props = __props;
|
|
6190
6184
|
const emit = __ctx.emit;
|
|
6191
6185
|
const instance = (_a = vueDemi.getCurrentInstance()) == null ? void 0 : _a.proxy;
|
|
6192
6186
|
const elTableRef = vueDemi.ref();
|
|
@@ -6202,15 +6196,15 @@ __sfc_main.setup = (__props, __ctx) => {
|
|
|
6202
6196
|
const elTableHeight = vueDemi.ref();
|
|
6203
6197
|
const nfColumCheckDialogVisible = vueDemi.ref(false);
|
|
6204
6198
|
const showData = vueDemi.computed(() => {
|
|
6205
|
-
const pageSize =
|
|
6206
|
-
const currentPage =
|
|
6207
|
-
const noTotal = typeof
|
|
6199
|
+
const pageSize = props.pageAttrs["page-size"];
|
|
6200
|
+
const currentPage = props.pageAttrs["current-page"] || 1;
|
|
6201
|
+
const noTotal = typeof props.pageAttrs.total === "undefined";
|
|
6208
6202
|
if (!pageSize || !noTotal)
|
|
6209
|
-
return
|
|
6210
|
-
if (
|
|
6211
|
-
return
|
|
6203
|
+
return props.data;
|
|
6204
|
+
if (props.data.length > pageSize) {
|
|
6205
|
+
return props.data.slice((currentPage - 1) * pageSize, currentPage * pageSize);
|
|
6212
6206
|
} else {
|
|
6213
|
-
return
|
|
6207
|
+
return props.data;
|
|
6214
6208
|
}
|
|
6215
6209
|
});
|
|
6216
6210
|
const hasOperationSlot = vueDemi.computed(() => {
|
|
@@ -6221,10 +6215,10 @@ __sfc_main.setup = (__props, __ctx) => {
|
|
|
6221
6215
|
});
|
|
6222
6216
|
const loadingInstance = vueDemi.ref();
|
|
6223
6217
|
vueDemi.watch(() => {
|
|
6224
|
-
return
|
|
6218
|
+
return props.loading;
|
|
6225
6219
|
}, async () => {
|
|
6226
6220
|
var _a2, _b;
|
|
6227
|
-
if (
|
|
6221
|
+
if (props.loading) {
|
|
6228
6222
|
await vueDemi.nextTick();
|
|
6229
6223
|
const {
|
|
6230
6224
|
target,
|
|
@@ -6234,7 +6228,7 @@ __sfc_main.setup = (__props, __ctx) => {
|
|
|
6234
6228
|
spinner,
|
|
6235
6229
|
background,
|
|
6236
6230
|
customClass
|
|
6237
|
-
} =
|
|
6231
|
+
} = props;
|
|
6238
6232
|
loadingInstance.value = elementUi.Loading.service({
|
|
6239
6233
|
target: target || ((_a2 = elTableRef.value) == null ? void 0 : _a2.$el) || document.body,
|
|
6240
6234
|
lock,
|
|
@@ -6252,12 +6246,12 @@ __sfc_main.setup = (__props, __ctx) => {
|
|
|
6252
6246
|
});
|
|
6253
6247
|
const initLocalShow = (init = false) => {
|
|
6254
6248
|
if (!init) {
|
|
6255
|
-
|
|
6249
|
+
props.columns._skip = true;
|
|
6256
6250
|
}
|
|
6257
|
-
const result =
|
|
6251
|
+
const result = props.columns.filter((item) => {
|
|
6258
6252
|
var _a2, _b;
|
|
6259
6253
|
const prop = item.prop || ((_a2 = item.attr) == null ? void 0 : _a2.prop);
|
|
6260
|
-
if ((_b =
|
|
6254
|
+
if ((_b = props.showColumn) == null ? void 0 : _b.includes(prop)) {
|
|
6261
6255
|
item.initHidden = false;
|
|
6262
6256
|
}
|
|
6263
6257
|
return !item.initHidden;
|
|
@@ -6267,13 +6261,13 @@ __sfc_main.setup = (__props, __ctx) => {
|
|
|
6267
6261
|
});
|
|
6268
6262
|
if (!init) {
|
|
6269
6263
|
vueDemi.nextTick(() => {
|
|
6270
|
-
|
|
6264
|
+
props.columns._skip = false;
|
|
6271
6265
|
});
|
|
6272
6266
|
}
|
|
6273
6267
|
if (result.length) {
|
|
6274
6268
|
return result;
|
|
6275
6269
|
}
|
|
6276
|
-
return
|
|
6270
|
+
return props.columns.map((item) => {
|
|
6277
6271
|
var _a2;
|
|
6278
6272
|
return item.prop || ((_a2 = item.attr) == null ? void 0 : _a2.prop);
|
|
6279
6273
|
});
|
|
@@ -6288,9 +6282,9 @@ __sfc_main.setup = (__props, __ctx) => {
|
|
|
6288
6282
|
immediate: true
|
|
6289
6283
|
});
|
|
6290
6284
|
const syncLocalShowColumnToCookies = () => {
|
|
6291
|
-
if (
|
|
6285
|
+
if (props.columnEdit) {
|
|
6292
6286
|
const columnState = {};
|
|
6293
|
-
|
|
6287
|
+
props.columns.map((i, index2) => {
|
|
6294
6288
|
var _a2, _b;
|
|
6295
6289
|
const prop = i.prop || ((_a2 = i.attr) == null ? void 0 : _a2.prop);
|
|
6296
6290
|
columnState[prop] = {
|
|
@@ -6300,12 +6294,12 @@ __sfc_main.setup = (__props, __ctx) => {
|
|
|
6300
6294
|
index: index2
|
|
6301
6295
|
};
|
|
6302
6296
|
});
|
|
6303
|
-
return commonUtils.CachedManager.syncCachedSet(
|
|
6297
|
+
return commonUtils.CachedManager.syncCachedSet(props.storageKey, columnState);
|
|
6304
6298
|
}
|
|
6305
6299
|
};
|
|
6306
6300
|
const syncShowItemToInitHidden = () => {
|
|
6307
|
-
|
|
6308
|
-
|
|
6301
|
+
props.columns._skip = true;
|
|
6302
|
+
props.columns.forEach((item) => {
|
|
6309
6303
|
var _a2, _b;
|
|
6310
6304
|
const prop = item.prop || ((_a2 = item.attr) == null ? void 0 : _a2.prop);
|
|
6311
6305
|
if ((_b = localShowColumn.value) == null ? void 0 : _b.includes(prop)) {
|
|
@@ -6315,15 +6309,15 @@ __sfc_main.setup = (__props, __ctx) => {
|
|
|
6315
6309
|
}
|
|
6316
6310
|
});
|
|
6317
6311
|
vueDemi.nextTick(() => {
|
|
6318
|
-
|
|
6312
|
+
props.columns._skip = false;
|
|
6319
6313
|
});
|
|
6320
6314
|
};
|
|
6321
6315
|
const syncCookiesToLocalShowColumn = async () => {
|
|
6322
|
-
if (
|
|
6316
|
+
if (props.columnEdit) {
|
|
6323
6317
|
try {
|
|
6324
|
-
let columnState = commonUtils.CachedManager.syncCachedGet(
|
|
6318
|
+
let columnState = commonUtils.CachedManager.syncCachedGet(props.storageKey);
|
|
6325
6319
|
if (!columnState) {
|
|
6326
|
-
columnState = await commonUtils.CachedManager.asyncCachedGet(
|
|
6320
|
+
columnState = await commonUtils.CachedManager.asyncCachedGet(props.storageKey);
|
|
6327
6321
|
}
|
|
6328
6322
|
if (columnState) {
|
|
6329
6323
|
if (typeof columnState === "string") {
|
|
@@ -6345,13 +6339,13 @@ __sfc_main.setup = (__props, __ctx) => {
|
|
|
6345
6339
|
};
|
|
6346
6340
|
const initCachedData = async () => {
|
|
6347
6341
|
var _a2, _b;
|
|
6348
|
-
if (
|
|
6342
|
+
if (props.columnEdit) {
|
|
6349
6343
|
try {
|
|
6350
|
-
let cached = commonUtils.CachedManager.syncCachedGet(
|
|
6344
|
+
let cached = commonUtils.CachedManager.syncCachedGet(props.storageKey);
|
|
6351
6345
|
if (!cached) {
|
|
6352
|
-
cached = await commonUtils.CachedManager.asyncCachedGet(
|
|
6346
|
+
cached = await commonUtils.CachedManager.asyncCachedGet(props.storageKey);
|
|
6353
6347
|
}
|
|
6354
|
-
const cachedPriority =
|
|
6348
|
+
const cachedPriority = props.priority === "cached";
|
|
6355
6349
|
if (cachedPriority ? cached : (_a2 = localShowColumn.value) == null ? void 0 : _a2.length) {
|
|
6356
6350
|
cachedPriority ? await syncCookiesToLocalShowColumn() : await syncLocalShowColumnToCookies();
|
|
6357
6351
|
} else if (cachedPriority ? (_b = localShowColumn.value) == null ? void 0 : _b.length : cached) {
|
|
@@ -6361,8 +6355,8 @@ __sfc_main.setup = (__props, __ctx) => {
|
|
|
6361
6355
|
console.log(e);
|
|
6362
6356
|
}
|
|
6363
6357
|
}
|
|
6364
|
-
if (
|
|
6365
|
-
await commonUtils.CachedManager.asyncCachedGet(`${
|
|
6358
|
+
if (props.dragCached) {
|
|
6359
|
+
await commonUtils.CachedManager.asyncCachedGet(`${props.storageKey}$drag-column-width`);
|
|
6366
6360
|
}
|
|
6367
6361
|
};
|
|
6368
6362
|
const getMinWidth = (column) => {
|
|
@@ -6385,16 +6379,16 @@ __sfc_main.setup = (__props, __ctx) => {
|
|
|
6385
6379
|
const tableColumns = vueDemi.ref([]);
|
|
6386
6380
|
const elTableRefKey = vueDemi.ref(Date.now());
|
|
6387
6381
|
const syncCookiesToTableColumn = async (readCached = true, init = false) => {
|
|
6388
|
-
|
|
6389
|
-
const columns =
|
|
6382
|
+
props.columns._skip = true;
|
|
6383
|
+
const columns = props.columns.map((item, index2) => {
|
|
6390
6384
|
var _a2;
|
|
6391
6385
|
const attr = item.attr || {};
|
|
6392
6386
|
if (!attr["min-width"] && item.label) {
|
|
6393
6387
|
attr["min-width"] = String(getMinWidth(item)) + "px";
|
|
6394
6388
|
}
|
|
6395
|
-
if (init &&
|
|
6389
|
+
if (init && props.dragCached) {
|
|
6396
6390
|
const prop = item.prop || ((_a2 = item.attr) == null ? void 0 : _a2.prop);
|
|
6397
|
-
let columnWidth = commonUtils.CachedManager.syncCachedGet(`${
|
|
6391
|
+
let columnWidth = commonUtils.CachedManager.syncCachedGet(`${props.storageKey}$drag-column-width`) || {};
|
|
6398
6392
|
if (columnWidth[prop]) {
|
|
6399
6393
|
attr.width = columnWidth[prop];
|
|
6400
6394
|
}
|
|
@@ -6411,13 +6405,13 @@ __sfc_main.setup = (__props, __ctx) => {
|
|
|
6411
6405
|
item.__index = index2;
|
|
6412
6406
|
return item;
|
|
6413
6407
|
});
|
|
6414
|
-
if (readCached &&
|
|
6408
|
+
if (readCached && props.columnEdit) {
|
|
6415
6409
|
try {
|
|
6416
|
-
let columnState = commonUtils.CachedManager.syncCachedGet(
|
|
6410
|
+
let columnState = commonUtils.CachedManager.syncCachedGet(props.storageKey);
|
|
6417
6411
|
if (!columnState) {
|
|
6418
|
-
columnState = await commonUtils.CachedManager.asyncCachedGet(
|
|
6412
|
+
columnState = await commonUtils.CachedManager.asyncCachedGet(props.storageKey);
|
|
6419
6413
|
}
|
|
6420
|
-
|
|
6414
|
+
props.columns._skip = true;
|
|
6421
6415
|
if (columnState) {
|
|
6422
6416
|
if (typeof columnState === "string") {
|
|
6423
6417
|
columnState = JSON.parse(columnState);
|
|
@@ -6443,7 +6437,7 @@ __sfc_main.setup = (__props, __ctx) => {
|
|
|
6443
6437
|
}
|
|
6444
6438
|
tableColumns.value = columns.sort((a, b) => a._index - b._index < 0 ? -1 : a._index - b._index > 0 ? 1 : 0);
|
|
6445
6439
|
vueDemi.nextTick(() => {
|
|
6446
|
-
|
|
6440
|
+
props.columns._skip = false;
|
|
6447
6441
|
});
|
|
6448
6442
|
elTableRefKey.value = Date.now();
|
|
6449
6443
|
};
|
|
@@ -6454,9 +6448,9 @@ __sfc_main.setup = (__props, __ctx) => {
|
|
|
6454
6448
|
initColumn();
|
|
6455
6449
|
vueDemi.onBeforeMount(() => {
|
|
6456
6450
|
vueDemi.watch(() => {
|
|
6457
|
-
return
|
|
6451
|
+
return props.columns;
|
|
6458
6452
|
}, async () => {
|
|
6459
|
-
if (
|
|
6453
|
+
if (props.columns._skip) {
|
|
6460
6454
|
return;
|
|
6461
6455
|
}
|
|
6462
6456
|
localShowColumn.value = initLocalShow();
|
|
@@ -6479,30 +6473,30 @@ __sfc_main.setup = (__props, __ctx) => {
|
|
|
6479
6473
|
},
|
|
6480
6474
|
resizable: true,
|
|
6481
6475
|
border: true,
|
|
6482
|
-
...
|
|
6476
|
+
...props.tableAttrs
|
|
6483
6477
|
};
|
|
6484
6478
|
delete obj.data;
|
|
6485
6479
|
return obj;
|
|
6486
6480
|
});
|
|
6487
6481
|
const tableEventer = vueDemi.computed(() => {
|
|
6488
6482
|
const obj = {
|
|
6489
|
-
...
|
|
6483
|
+
...props.tableEvents,
|
|
6490
6484
|
"header-dragend": headerDragend
|
|
6491
6485
|
};
|
|
6492
6486
|
return obj;
|
|
6493
6487
|
});
|
|
6494
6488
|
const pageSizes = vueDemi.ref([10, 20, 30, 40, 50, 100, 200]);
|
|
6495
6489
|
const initPageSizes = () => {
|
|
6496
|
-
const pageSizeArr =
|
|
6497
|
-
if (
|
|
6498
|
-
pageSizes.value.unshift(
|
|
6490
|
+
const pageSizeArr = props.pageAttrs["page-sizes"];
|
|
6491
|
+
if (props.pageAttrs["page-size"] < ((pageSizeArr == null ? void 0 : pageSizeArr.length) ? pageSizeArr[0] : 10)) {
|
|
6492
|
+
pageSizes.value.unshift(props.pageAttrs["page-size"]);
|
|
6499
6493
|
}
|
|
6500
6494
|
};
|
|
6501
6495
|
const showPage = vueDemi.computed(() => {
|
|
6502
|
-
return showData.value.length >
|
|
6496
|
+
return showData.value.length > props.pageAttrs["page-size"];
|
|
6503
6497
|
});
|
|
6504
6498
|
const renderPage = vueDemi.computed(() => {
|
|
6505
|
-
return
|
|
6499
|
+
return props.alwaysShowPage || showPage.value;
|
|
6506
6500
|
});
|
|
6507
6501
|
initPageSizes();
|
|
6508
6502
|
const pageAttrer = vueDemi.computed(() => {
|
|
@@ -6511,8 +6505,8 @@ __sfc_main.setup = (__props, __ctx) => {
|
|
|
6511
6505
|
background: false,
|
|
6512
6506
|
layout: "total, sizes, prev, pager, next, jumper",
|
|
6513
6507
|
"page-sizes": pageSizes.value,
|
|
6514
|
-
total: typeof
|
|
6515
|
-
...
|
|
6508
|
+
total: typeof props.pageAttrs.total === "undefined" ? (_a2 = props.data) == null ? void 0 : _a2.length : void 0,
|
|
6509
|
+
...props.pageAttrs
|
|
6516
6510
|
};
|
|
6517
6511
|
});
|
|
6518
6512
|
const isShow = (row) => {
|
|
@@ -6580,15 +6574,21 @@ __sfc_main.setup = (__props, __ctx) => {
|
|
|
6580
6574
|
if (newWidth < minWidth) {
|
|
6581
6575
|
column.width = minWidth;
|
|
6582
6576
|
}
|
|
6583
|
-
if (
|
|
6584
|
-
const columnCachedData = await commonUtils.CachedManager.asyncCachedGet(`${
|
|
6577
|
+
if (props.dragCached) {
|
|
6578
|
+
const columnCachedData = await commonUtils.CachedManager.asyncCachedGet(`${props.storageKey}$drag-column-width`) || {};
|
|
6585
6579
|
columnCachedData[column.property] = column.width;
|
|
6586
|
-
await commonUtils.CachedManager.asyncCachedSet(`${
|
|
6580
|
+
await commonUtils.CachedManager.asyncCachedSet(`${props.storageKey}$drag-column-width`, columnCachedData);
|
|
6587
6581
|
}
|
|
6588
|
-
await ((_b = (_a2 =
|
|
6582
|
+
await ((_b = (_a2 = props.tableEvents)["header-dragend"]) == null ? void 0 : _b.call(_a2, newWidth, oldWidth, column, event));
|
|
6589
6583
|
};
|
|
6584
|
+
async function clearDragCached() {
|
|
6585
|
+
await commonUtils.CachedManager.asyncCachedSet(`${props.storageKey}$drag-column-width`, null);
|
|
6586
|
+
}
|
|
6587
|
+
async function clearColumnEditCached() {
|
|
6588
|
+
await commonUtils.CachedManager.asyncCachedSet(props.storageKey, null);
|
|
6589
|
+
}
|
|
6590
6590
|
const columnCheckConfirmFeedback = (value) => {
|
|
6591
|
-
if (!
|
|
6591
|
+
if (!props.columnEdit) {
|
|
6592
6592
|
const itemsList = [];
|
|
6593
6593
|
for (const key in value) {
|
|
6594
6594
|
if (value[key]) {
|
|
@@ -6620,7 +6620,7 @@ __sfc_main.setup = (__props, __ctx) => {
|
|
|
6620
6620
|
};
|
|
6621
6621
|
const calcTableHeight = () => {
|
|
6622
6622
|
var _a2, _b;
|
|
6623
|
-
if (
|
|
6623
|
+
if (props.calHeight && nfTableContent.value) {
|
|
6624
6624
|
const tableContentH = (_a2 = nfTableContent.value) == null ? void 0 : _a2.offsetHeight;
|
|
6625
6625
|
const actionH = nfTableActionContainerRef.value.offsetHeight;
|
|
6626
6626
|
const h = tableContentH - actionH;
|
|
@@ -6628,14 +6628,14 @@ __sfc_main.setup = (__props, __ctx) => {
|
|
|
6628
6628
|
elTableHeight.value = h;
|
|
6629
6629
|
}
|
|
6630
6630
|
} else {
|
|
6631
|
-
elTableHeight.value = (_b =
|
|
6631
|
+
elTableHeight.value = (_b = props.tableAttrs) == null ? void 0 : _b.height;
|
|
6632
6632
|
}
|
|
6633
6633
|
};
|
|
6634
6634
|
vueDemi.onMounted(() => {
|
|
6635
6635
|
calcTableHeight();
|
|
6636
|
-
|
|
6636
|
+
props.columns.forEach((i) => {
|
|
6637
6637
|
if (i.singleHeadMutiColSlot) {
|
|
6638
|
-
console.log("🔅 ~ onMounted ~ props.columns:",
|
|
6638
|
+
console.log("🔅 ~ onMounted ~ props.columns:", props.columns);
|
|
6639
6639
|
}
|
|
6640
6640
|
});
|
|
6641
6641
|
});
|
|
@@ -148,14 +148,14 @@ __sfc_main$2.props = {
|
|
|
148
148
|
};
|
|
149
149
|
__sfc_main$2.setup = (__props, __ctx) => {
|
|
150
150
|
var _a;
|
|
151
|
-
const
|
|
151
|
+
const props = __props;
|
|
152
152
|
const emit = __ctx.emit;
|
|
153
153
|
(_a = getCurrentInstance()) == null ? void 0 : _a.proxy;
|
|
154
154
|
const tableData = ref({});
|
|
155
155
|
const unChangedColumn = ref([]);
|
|
156
156
|
const visible = computed({
|
|
157
157
|
get() {
|
|
158
|
-
return
|
|
158
|
+
return props.show;
|
|
159
159
|
},
|
|
160
160
|
set(val) {
|
|
161
161
|
emit("update:show", val);
|
|
@@ -163,9 +163,9 @@ __sfc_main$2.setup = (__props, __ctx) => {
|
|
|
163
163
|
});
|
|
164
164
|
const fields = computed(() => {
|
|
165
165
|
const obj = {};
|
|
166
|
-
|
|
166
|
+
props.tableColumns.filter((item) => !item.destory).map((item) => {
|
|
167
167
|
if (!item.type) {
|
|
168
|
-
const key = item.category ||
|
|
168
|
+
const key = item.category || props.basicFieldDesc;
|
|
169
169
|
if (!obj[key]) {
|
|
170
170
|
obj[key] = [];
|
|
171
171
|
}
|
|
@@ -184,7 +184,7 @@ __sfc_main$2.setup = (__props, __ctx) => {
|
|
|
184
184
|
const submit = () => {
|
|
185
185
|
visible.value = false;
|
|
186
186
|
const columnState = {};
|
|
187
|
-
|
|
187
|
+
props.tableColumns.map((i, index2) => {
|
|
188
188
|
var _a2;
|
|
189
189
|
columnState[i.prop] = {
|
|
190
190
|
initHidden: !tableData.value[i.prop] || false,
|
|
@@ -194,24 +194,24 @@ __sfc_main$2.setup = (__props, __ctx) => {
|
|
|
194
194
|
};
|
|
195
195
|
});
|
|
196
196
|
emit("save", tableData.value);
|
|
197
|
-
if (
|
|
198
|
-
CachedManager.syncCachedSet(
|
|
197
|
+
if (props.columnEdit) {
|
|
198
|
+
CachedManager.syncCachedSet(props.storageKey, columnState);
|
|
199
199
|
}
|
|
200
200
|
};
|
|
201
201
|
const addInitValue = () => {
|
|
202
202
|
const obj = {};
|
|
203
|
-
|
|
203
|
+
props.tableColumns.forEach((v) => {
|
|
204
204
|
obj[v.prop] = !v.initHidden;
|
|
205
205
|
});
|
|
206
206
|
tableData.value = obj;
|
|
207
|
-
if (
|
|
207
|
+
if (props.tableColumns.findIndex((item) => !!item.type) > -1) {
|
|
208
208
|
unChangedColumn.value.push("selection");
|
|
209
209
|
}
|
|
210
|
-
if (
|
|
210
|
+
if (props.tableColumns.findIndex((item) => {
|
|
211
211
|
var _a2;
|
|
212
|
-
return (item.prop || ((_a2 = item.attr) == null ? void 0 : _a2.prop)) ===
|
|
212
|
+
return (item.prop || ((_a2 = item.attr) == null ? void 0 : _a2.prop)) === props.operationPropKey;
|
|
213
213
|
}) > -1) {
|
|
214
|
-
unChangedColumn.value.push(
|
|
214
|
+
unChangedColumn.value.push(props.operationPropKey);
|
|
215
215
|
}
|
|
216
216
|
};
|
|
217
217
|
onMounted(() => {
|
|
@@ -4861,9 +4861,9 @@ const require$$0 = /* @__PURE__ */ getAugmentedNamespace(sortable_esm);
|
|
|
4861
4861
|
if (!componentData) {
|
|
4862
4862
|
return attributes;
|
|
4863
4863
|
}
|
|
4864
|
-
var on2 = componentData.on,
|
|
4864
|
+
var on2 = componentData.on, props2 = componentData.props, componentDataAttrs = componentData.attrs;
|
|
4865
4865
|
update("on", on2);
|
|
4866
|
-
update("props",
|
|
4866
|
+
update("props", props2);
|
|
4867
4867
|
Object.assign(attributes.attrs, componentDataAttrs);
|
|
4868
4868
|
return attributes;
|
|
4869
4869
|
}
|
|
@@ -4873,7 +4873,7 @@ const require$$0 = /* @__PURE__ */ getAugmentedNamespace(sortable_esm);
|
|
|
4873
4873
|
return "on" + evt;
|
|
4874
4874
|
});
|
|
4875
4875
|
var draggingElement = null;
|
|
4876
|
-
var
|
|
4876
|
+
var props = {
|
|
4877
4877
|
options: Object,
|
|
4878
4878
|
list: {
|
|
4879
4879
|
type: Array,
|
|
@@ -4916,7 +4916,7 @@ const require$$0 = /* @__PURE__ */ getAugmentedNamespace(sortable_esm);
|
|
|
4916
4916
|
var draggableComponent = {
|
|
4917
4917
|
name: "draggable",
|
|
4918
4918
|
inheritAttrs: false,
|
|
4919
|
-
props
|
|
4919
|
+
props,
|
|
4920
4920
|
data: function data() {
|
|
4921
4921
|
return {
|
|
4922
4922
|
transitionMode: false,
|
|
@@ -5330,20 +5330,20 @@ __sfc_main$1.props = {
|
|
|
5330
5330
|
__sfc_main$1.setup = (__props, __ctx) => {
|
|
5331
5331
|
var _a;
|
|
5332
5332
|
const instance = (_a = getCurrentInstance()) == null ? void 0 : _a.proxy;
|
|
5333
|
-
const
|
|
5333
|
+
const props = __props;
|
|
5334
5334
|
const currentTable = ref([]);
|
|
5335
5335
|
const showColumn = ref([]);
|
|
5336
5336
|
const unChangedColumn = ref([]);
|
|
5337
5337
|
const fixedColumn = ref([]);
|
|
5338
5338
|
const unFixedColumn = ref([]);
|
|
5339
5339
|
onBeforeMount(() => {
|
|
5340
|
-
currentTable.value = deepClone(
|
|
5340
|
+
currentTable.value = deepClone(props.tableColumns.filter((item) => !item.destory)).sort((a, b) => a._index - b._index < 0 ? -1 : a._index - b._index > 0 ? 1 : 0);
|
|
5341
5341
|
currentTable.value.map((i) => {
|
|
5342
5342
|
if (!i.attr) {
|
|
5343
5343
|
i.attr = {};
|
|
5344
5344
|
}
|
|
5345
5345
|
});
|
|
5346
|
-
const list =
|
|
5346
|
+
const list = props.tableColumns.filter((item) => !item.destory);
|
|
5347
5347
|
setFields(list);
|
|
5348
5348
|
updateColumn();
|
|
5349
5349
|
if (currentTable.value.findIndex((item) => !!item.type) > -1) {
|
|
@@ -5351,9 +5351,9 @@ __sfc_main$1.setup = (__props, __ctx) => {
|
|
|
5351
5351
|
}
|
|
5352
5352
|
if (currentTable.value.findIndex((item) => {
|
|
5353
5353
|
var _a2;
|
|
5354
|
-
return (item.prop || ((_a2 = item.attr) == null ? void 0 : _a2.prop)) ===
|
|
5354
|
+
return (item.prop || ((_a2 = item.attr) == null ? void 0 : _a2.prop)) === props.operationPropKey;
|
|
5355
5355
|
}) > -1) {
|
|
5356
|
-
unChangedColumn.value.push(
|
|
5356
|
+
unChangedColumn.value.push(props.operationPropKey);
|
|
5357
5357
|
}
|
|
5358
5358
|
if (currentTable.value.every((i) => !i.initHidden)) {
|
|
5359
5359
|
showColumn.value = currentTable.value.map((i) => i.prop);
|
|
@@ -5366,7 +5366,7 @@ __sfc_main$1.setup = (__props, __ctx) => {
|
|
|
5366
5366
|
const setFields = (tableColumns) => {
|
|
5367
5367
|
const obj = {};
|
|
5368
5368
|
tableColumns.map((item) => {
|
|
5369
|
-
const key = item.category ||
|
|
5369
|
+
const key = item.category || props.basicFieldDesc;
|
|
5370
5370
|
if (!obj[key]) {
|
|
5371
5371
|
obj[key] = [];
|
|
5372
5372
|
}
|
|
@@ -5456,12 +5456,12 @@ __sfc_main$1.setup = (__props, __ctx) => {
|
|
|
5456
5456
|
const syncTableColumnsToCookies = () => {
|
|
5457
5457
|
var _a2;
|
|
5458
5458
|
const newTableColumns = [...fixedColumn.value, ...unFixedColumn.value];
|
|
5459
|
-
if (newTableColumns.filter((item) => !item.type && item.prop !==
|
|
5459
|
+
if (newTableColumns.filter((item) => !item.type && item.prop !== props.operationPropKey && !item.initHidden).length === 0) {
|
|
5460
5460
|
(_a2 = instance == null ? void 0 : instance.$openMessage) == null ? void 0 : _a2.warning({
|
|
5461
|
-
message:
|
|
5461
|
+
message: props.selectEmptyWarningTips,
|
|
5462
5462
|
duration: 2e3
|
|
5463
5463
|
});
|
|
5464
|
-
throw new Error(
|
|
5464
|
+
throw new Error(props.selectEmptyWarningTips);
|
|
5465
5465
|
}
|
|
5466
5466
|
const selectionPropItemIndex = newTableColumns.findIndex((item) => !!item.type);
|
|
5467
5467
|
if (selectionPropItemIndex > -1) {
|
|
@@ -5469,7 +5469,7 @@ __sfc_main$1.setup = (__props, __ctx) => {
|
|
|
5469
5469
|
}
|
|
5470
5470
|
const operationPropItemIndex = newTableColumns.findIndex((item) => {
|
|
5471
5471
|
var _a3;
|
|
5472
|
-
return (item.prop || ((_a3 = item.attr) == null ? void 0 : _a3.prop)) ===
|
|
5472
|
+
return (item.prop || ((_a3 = item.attr) == null ? void 0 : _a3.prop)) === props.operationPropKey;
|
|
5473
5473
|
});
|
|
5474
5474
|
if (operationPropItemIndex > -1) {
|
|
5475
5475
|
newTableColumns.push(newTableColumns.splice(operationPropItemIndex, 1)[0]);
|
|
@@ -5486,8 +5486,8 @@ __sfc_main$1.setup = (__props, __ctx) => {
|
|
|
5486
5486
|
};
|
|
5487
5487
|
obj[i.prop] = !columnState[i.prop].initHidden;
|
|
5488
5488
|
});
|
|
5489
|
-
if (
|
|
5490
|
-
CachedManager.syncCachedSet(
|
|
5489
|
+
if (props.columnEdit) {
|
|
5490
|
+
CachedManager.syncCachedSet(props.storageKey, columnState);
|
|
5491
5491
|
}
|
|
5492
5492
|
return obj;
|
|
5493
5493
|
};
|
|
@@ -5771,12 +5771,6 @@ const _sfc_render$1 = null;
|
|
|
5771
5771
|
const _sfc_staticRenderFns$1 = null;
|
|
5772
5772
|
var __component__$1 = /* @__PURE__ */ normalizeComponent(_sfc_main, _sfc_render$1, _sfc_staticRenderFns$1, false, null, null, null, null);
|
|
5773
5773
|
const RenderComponent = __component__$1.exports;
|
|
5774
|
-
async function clearDragCached() {
|
|
5775
|
-
await CachedManager.asyncCachedSet(`${props.storageKey}$drag-column-width`, null);
|
|
5776
|
-
}
|
|
5777
|
-
async function clearColumnEditCached() {
|
|
5778
|
-
await CachedManager.asyncCachedSet(props.storageKey, null);
|
|
5779
|
-
}
|
|
5780
5774
|
const __sfc_main = defineComponent({
|
|
5781
5775
|
name: "nf-table"
|
|
5782
5776
|
});
|
|
@@ -6184,7 +6178,7 @@ __sfc_main.props = {
|
|
|
6184
6178
|
};
|
|
6185
6179
|
__sfc_main.setup = (__props, __ctx) => {
|
|
6186
6180
|
var _a;
|
|
6187
|
-
const
|
|
6181
|
+
const props = __props;
|
|
6188
6182
|
const emit = __ctx.emit;
|
|
6189
6183
|
const instance = (_a = getCurrentInstance()) == null ? void 0 : _a.proxy;
|
|
6190
6184
|
const elTableRef = ref();
|
|
@@ -6200,15 +6194,15 @@ __sfc_main.setup = (__props, __ctx) => {
|
|
|
6200
6194
|
const elTableHeight = ref();
|
|
6201
6195
|
const nfColumCheckDialogVisible = ref(false);
|
|
6202
6196
|
const showData = computed(() => {
|
|
6203
|
-
const pageSize =
|
|
6204
|
-
const currentPage =
|
|
6205
|
-
const noTotal = typeof
|
|
6197
|
+
const pageSize = props.pageAttrs["page-size"];
|
|
6198
|
+
const currentPage = props.pageAttrs["current-page"] || 1;
|
|
6199
|
+
const noTotal = typeof props.pageAttrs.total === "undefined";
|
|
6206
6200
|
if (!pageSize || !noTotal)
|
|
6207
|
-
return
|
|
6208
|
-
if (
|
|
6209
|
-
return
|
|
6201
|
+
return props.data;
|
|
6202
|
+
if (props.data.length > pageSize) {
|
|
6203
|
+
return props.data.slice((currentPage - 1) * pageSize, currentPage * pageSize);
|
|
6210
6204
|
} else {
|
|
6211
|
-
return
|
|
6205
|
+
return props.data;
|
|
6212
6206
|
}
|
|
6213
6207
|
});
|
|
6214
6208
|
const hasOperationSlot = computed(() => {
|
|
@@ -6219,10 +6213,10 @@ __sfc_main.setup = (__props, __ctx) => {
|
|
|
6219
6213
|
});
|
|
6220
6214
|
const loadingInstance = ref();
|
|
6221
6215
|
watch(() => {
|
|
6222
|
-
return
|
|
6216
|
+
return props.loading;
|
|
6223
6217
|
}, async () => {
|
|
6224
6218
|
var _a2, _b;
|
|
6225
|
-
if (
|
|
6219
|
+
if (props.loading) {
|
|
6226
6220
|
await nextTick();
|
|
6227
6221
|
const {
|
|
6228
6222
|
target,
|
|
@@ -6232,7 +6226,7 @@ __sfc_main.setup = (__props, __ctx) => {
|
|
|
6232
6226
|
spinner,
|
|
6233
6227
|
background,
|
|
6234
6228
|
customClass
|
|
6235
|
-
} =
|
|
6229
|
+
} = props;
|
|
6236
6230
|
loadingInstance.value = Loading.service({
|
|
6237
6231
|
target: target || ((_a2 = elTableRef.value) == null ? void 0 : _a2.$el) || document.body,
|
|
6238
6232
|
lock,
|
|
@@ -6250,12 +6244,12 @@ __sfc_main.setup = (__props, __ctx) => {
|
|
|
6250
6244
|
});
|
|
6251
6245
|
const initLocalShow = (init = false) => {
|
|
6252
6246
|
if (!init) {
|
|
6253
|
-
|
|
6247
|
+
props.columns._skip = true;
|
|
6254
6248
|
}
|
|
6255
|
-
const result =
|
|
6249
|
+
const result = props.columns.filter((item) => {
|
|
6256
6250
|
var _a2, _b;
|
|
6257
6251
|
const prop = item.prop || ((_a2 = item.attr) == null ? void 0 : _a2.prop);
|
|
6258
|
-
if ((_b =
|
|
6252
|
+
if ((_b = props.showColumn) == null ? void 0 : _b.includes(prop)) {
|
|
6259
6253
|
item.initHidden = false;
|
|
6260
6254
|
}
|
|
6261
6255
|
return !item.initHidden;
|
|
@@ -6265,13 +6259,13 @@ __sfc_main.setup = (__props, __ctx) => {
|
|
|
6265
6259
|
});
|
|
6266
6260
|
if (!init) {
|
|
6267
6261
|
nextTick(() => {
|
|
6268
|
-
|
|
6262
|
+
props.columns._skip = false;
|
|
6269
6263
|
});
|
|
6270
6264
|
}
|
|
6271
6265
|
if (result.length) {
|
|
6272
6266
|
return result;
|
|
6273
6267
|
}
|
|
6274
|
-
return
|
|
6268
|
+
return props.columns.map((item) => {
|
|
6275
6269
|
var _a2;
|
|
6276
6270
|
return item.prop || ((_a2 = item.attr) == null ? void 0 : _a2.prop);
|
|
6277
6271
|
});
|
|
@@ -6286,9 +6280,9 @@ __sfc_main.setup = (__props, __ctx) => {
|
|
|
6286
6280
|
immediate: true
|
|
6287
6281
|
});
|
|
6288
6282
|
const syncLocalShowColumnToCookies = () => {
|
|
6289
|
-
if (
|
|
6283
|
+
if (props.columnEdit) {
|
|
6290
6284
|
const columnState = {};
|
|
6291
|
-
|
|
6285
|
+
props.columns.map((i, index2) => {
|
|
6292
6286
|
var _a2, _b;
|
|
6293
6287
|
const prop = i.prop || ((_a2 = i.attr) == null ? void 0 : _a2.prop);
|
|
6294
6288
|
columnState[prop] = {
|
|
@@ -6298,12 +6292,12 @@ __sfc_main.setup = (__props, __ctx) => {
|
|
|
6298
6292
|
index: index2
|
|
6299
6293
|
};
|
|
6300
6294
|
});
|
|
6301
|
-
return CachedManager.syncCachedSet(
|
|
6295
|
+
return CachedManager.syncCachedSet(props.storageKey, columnState);
|
|
6302
6296
|
}
|
|
6303
6297
|
};
|
|
6304
6298
|
const syncShowItemToInitHidden = () => {
|
|
6305
|
-
|
|
6306
|
-
|
|
6299
|
+
props.columns._skip = true;
|
|
6300
|
+
props.columns.forEach((item) => {
|
|
6307
6301
|
var _a2, _b;
|
|
6308
6302
|
const prop = item.prop || ((_a2 = item.attr) == null ? void 0 : _a2.prop);
|
|
6309
6303
|
if ((_b = localShowColumn.value) == null ? void 0 : _b.includes(prop)) {
|
|
@@ -6313,15 +6307,15 @@ __sfc_main.setup = (__props, __ctx) => {
|
|
|
6313
6307
|
}
|
|
6314
6308
|
});
|
|
6315
6309
|
nextTick(() => {
|
|
6316
|
-
|
|
6310
|
+
props.columns._skip = false;
|
|
6317
6311
|
});
|
|
6318
6312
|
};
|
|
6319
6313
|
const syncCookiesToLocalShowColumn = async () => {
|
|
6320
|
-
if (
|
|
6314
|
+
if (props.columnEdit) {
|
|
6321
6315
|
try {
|
|
6322
|
-
let columnState = CachedManager.syncCachedGet(
|
|
6316
|
+
let columnState = CachedManager.syncCachedGet(props.storageKey);
|
|
6323
6317
|
if (!columnState) {
|
|
6324
|
-
columnState = await CachedManager.asyncCachedGet(
|
|
6318
|
+
columnState = await CachedManager.asyncCachedGet(props.storageKey);
|
|
6325
6319
|
}
|
|
6326
6320
|
if (columnState) {
|
|
6327
6321
|
if (typeof columnState === "string") {
|
|
@@ -6343,13 +6337,13 @@ __sfc_main.setup = (__props, __ctx) => {
|
|
|
6343
6337
|
};
|
|
6344
6338
|
const initCachedData = async () => {
|
|
6345
6339
|
var _a2, _b;
|
|
6346
|
-
if (
|
|
6340
|
+
if (props.columnEdit) {
|
|
6347
6341
|
try {
|
|
6348
|
-
let cached = CachedManager.syncCachedGet(
|
|
6342
|
+
let cached = CachedManager.syncCachedGet(props.storageKey);
|
|
6349
6343
|
if (!cached) {
|
|
6350
|
-
cached = await CachedManager.asyncCachedGet(
|
|
6344
|
+
cached = await CachedManager.asyncCachedGet(props.storageKey);
|
|
6351
6345
|
}
|
|
6352
|
-
const cachedPriority =
|
|
6346
|
+
const cachedPriority = props.priority === "cached";
|
|
6353
6347
|
if (cachedPriority ? cached : (_a2 = localShowColumn.value) == null ? void 0 : _a2.length) {
|
|
6354
6348
|
cachedPriority ? await syncCookiesToLocalShowColumn() : await syncLocalShowColumnToCookies();
|
|
6355
6349
|
} else if (cachedPriority ? (_b = localShowColumn.value) == null ? void 0 : _b.length : cached) {
|
|
@@ -6359,8 +6353,8 @@ __sfc_main.setup = (__props, __ctx) => {
|
|
|
6359
6353
|
console.log(e);
|
|
6360
6354
|
}
|
|
6361
6355
|
}
|
|
6362
|
-
if (
|
|
6363
|
-
await CachedManager.asyncCachedGet(`${
|
|
6356
|
+
if (props.dragCached) {
|
|
6357
|
+
await CachedManager.asyncCachedGet(`${props.storageKey}$drag-column-width`);
|
|
6364
6358
|
}
|
|
6365
6359
|
};
|
|
6366
6360
|
const getMinWidth = (column) => {
|
|
@@ -6383,16 +6377,16 @@ __sfc_main.setup = (__props, __ctx) => {
|
|
|
6383
6377
|
const tableColumns = ref([]);
|
|
6384
6378
|
const elTableRefKey = ref(Date.now());
|
|
6385
6379
|
const syncCookiesToTableColumn = async (readCached = true, init = false) => {
|
|
6386
|
-
|
|
6387
|
-
const columns =
|
|
6380
|
+
props.columns._skip = true;
|
|
6381
|
+
const columns = props.columns.map((item, index2) => {
|
|
6388
6382
|
var _a2;
|
|
6389
6383
|
const attr = item.attr || {};
|
|
6390
6384
|
if (!attr["min-width"] && item.label) {
|
|
6391
6385
|
attr["min-width"] = String(getMinWidth(item)) + "px";
|
|
6392
6386
|
}
|
|
6393
|
-
if (init &&
|
|
6387
|
+
if (init && props.dragCached) {
|
|
6394
6388
|
const prop = item.prop || ((_a2 = item.attr) == null ? void 0 : _a2.prop);
|
|
6395
|
-
let columnWidth = CachedManager.syncCachedGet(`${
|
|
6389
|
+
let columnWidth = CachedManager.syncCachedGet(`${props.storageKey}$drag-column-width`) || {};
|
|
6396
6390
|
if (columnWidth[prop]) {
|
|
6397
6391
|
attr.width = columnWidth[prop];
|
|
6398
6392
|
}
|
|
@@ -6409,13 +6403,13 @@ __sfc_main.setup = (__props, __ctx) => {
|
|
|
6409
6403
|
item.__index = index2;
|
|
6410
6404
|
return item;
|
|
6411
6405
|
});
|
|
6412
|
-
if (readCached &&
|
|
6406
|
+
if (readCached && props.columnEdit) {
|
|
6413
6407
|
try {
|
|
6414
|
-
let columnState = CachedManager.syncCachedGet(
|
|
6408
|
+
let columnState = CachedManager.syncCachedGet(props.storageKey);
|
|
6415
6409
|
if (!columnState) {
|
|
6416
|
-
columnState = await CachedManager.asyncCachedGet(
|
|
6410
|
+
columnState = await CachedManager.asyncCachedGet(props.storageKey);
|
|
6417
6411
|
}
|
|
6418
|
-
|
|
6412
|
+
props.columns._skip = true;
|
|
6419
6413
|
if (columnState) {
|
|
6420
6414
|
if (typeof columnState === "string") {
|
|
6421
6415
|
columnState = JSON.parse(columnState);
|
|
@@ -6441,7 +6435,7 @@ __sfc_main.setup = (__props, __ctx) => {
|
|
|
6441
6435
|
}
|
|
6442
6436
|
tableColumns.value = columns.sort((a, b) => a._index - b._index < 0 ? -1 : a._index - b._index > 0 ? 1 : 0);
|
|
6443
6437
|
nextTick(() => {
|
|
6444
|
-
|
|
6438
|
+
props.columns._skip = false;
|
|
6445
6439
|
});
|
|
6446
6440
|
elTableRefKey.value = Date.now();
|
|
6447
6441
|
};
|
|
@@ -6452,9 +6446,9 @@ __sfc_main.setup = (__props, __ctx) => {
|
|
|
6452
6446
|
initColumn();
|
|
6453
6447
|
onBeforeMount(() => {
|
|
6454
6448
|
watch(() => {
|
|
6455
|
-
return
|
|
6449
|
+
return props.columns;
|
|
6456
6450
|
}, async () => {
|
|
6457
|
-
if (
|
|
6451
|
+
if (props.columns._skip) {
|
|
6458
6452
|
return;
|
|
6459
6453
|
}
|
|
6460
6454
|
localShowColumn.value = initLocalShow();
|
|
@@ -6477,30 +6471,30 @@ __sfc_main.setup = (__props, __ctx) => {
|
|
|
6477
6471
|
},
|
|
6478
6472
|
resizable: true,
|
|
6479
6473
|
border: true,
|
|
6480
|
-
...
|
|
6474
|
+
...props.tableAttrs
|
|
6481
6475
|
};
|
|
6482
6476
|
delete obj.data;
|
|
6483
6477
|
return obj;
|
|
6484
6478
|
});
|
|
6485
6479
|
const tableEventer = computed(() => {
|
|
6486
6480
|
const obj = {
|
|
6487
|
-
...
|
|
6481
|
+
...props.tableEvents,
|
|
6488
6482
|
"header-dragend": headerDragend
|
|
6489
6483
|
};
|
|
6490
6484
|
return obj;
|
|
6491
6485
|
});
|
|
6492
6486
|
const pageSizes = ref([10, 20, 30, 40, 50, 100, 200]);
|
|
6493
6487
|
const initPageSizes = () => {
|
|
6494
|
-
const pageSizeArr =
|
|
6495
|
-
if (
|
|
6496
|
-
pageSizes.value.unshift(
|
|
6488
|
+
const pageSizeArr = props.pageAttrs["page-sizes"];
|
|
6489
|
+
if (props.pageAttrs["page-size"] < ((pageSizeArr == null ? void 0 : pageSizeArr.length) ? pageSizeArr[0] : 10)) {
|
|
6490
|
+
pageSizes.value.unshift(props.pageAttrs["page-size"]);
|
|
6497
6491
|
}
|
|
6498
6492
|
};
|
|
6499
6493
|
const showPage = computed(() => {
|
|
6500
|
-
return showData.value.length >
|
|
6494
|
+
return showData.value.length > props.pageAttrs["page-size"];
|
|
6501
6495
|
});
|
|
6502
6496
|
const renderPage = computed(() => {
|
|
6503
|
-
return
|
|
6497
|
+
return props.alwaysShowPage || showPage.value;
|
|
6504
6498
|
});
|
|
6505
6499
|
initPageSizes();
|
|
6506
6500
|
const pageAttrer = computed(() => {
|
|
@@ -6509,8 +6503,8 @@ __sfc_main.setup = (__props, __ctx) => {
|
|
|
6509
6503
|
background: false,
|
|
6510
6504
|
layout: "total, sizes, prev, pager, next, jumper",
|
|
6511
6505
|
"page-sizes": pageSizes.value,
|
|
6512
|
-
total: typeof
|
|
6513
|
-
...
|
|
6506
|
+
total: typeof props.pageAttrs.total === "undefined" ? (_a2 = props.data) == null ? void 0 : _a2.length : void 0,
|
|
6507
|
+
...props.pageAttrs
|
|
6514
6508
|
};
|
|
6515
6509
|
});
|
|
6516
6510
|
const isShow = (row) => {
|
|
@@ -6578,15 +6572,21 @@ __sfc_main.setup = (__props, __ctx) => {
|
|
|
6578
6572
|
if (newWidth < minWidth) {
|
|
6579
6573
|
column.width = minWidth;
|
|
6580
6574
|
}
|
|
6581
|
-
if (
|
|
6582
|
-
const columnCachedData = await CachedManager.asyncCachedGet(`${
|
|
6575
|
+
if (props.dragCached) {
|
|
6576
|
+
const columnCachedData = await CachedManager.asyncCachedGet(`${props.storageKey}$drag-column-width`) || {};
|
|
6583
6577
|
columnCachedData[column.property] = column.width;
|
|
6584
|
-
await CachedManager.asyncCachedSet(`${
|
|
6578
|
+
await CachedManager.asyncCachedSet(`${props.storageKey}$drag-column-width`, columnCachedData);
|
|
6585
6579
|
}
|
|
6586
|
-
await ((_b = (_a2 =
|
|
6580
|
+
await ((_b = (_a2 = props.tableEvents)["header-dragend"]) == null ? void 0 : _b.call(_a2, newWidth, oldWidth, column, event));
|
|
6587
6581
|
};
|
|
6582
|
+
async function clearDragCached() {
|
|
6583
|
+
await CachedManager.asyncCachedSet(`${props.storageKey}$drag-column-width`, null);
|
|
6584
|
+
}
|
|
6585
|
+
async function clearColumnEditCached() {
|
|
6586
|
+
await CachedManager.asyncCachedSet(props.storageKey, null);
|
|
6587
|
+
}
|
|
6588
6588
|
const columnCheckConfirmFeedback = (value) => {
|
|
6589
|
-
if (!
|
|
6589
|
+
if (!props.columnEdit) {
|
|
6590
6590
|
const itemsList = [];
|
|
6591
6591
|
for (const key in value) {
|
|
6592
6592
|
if (value[key]) {
|
|
@@ -6618,7 +6618,7 @@ __sfc_main.setup = (__props, __ctx) => {
|
|
|
6618
6618
|
};
|
|
6619
6619
|
const calcTableHeight = () => {
|
|
6620
6620
|
var _a2, _b;
|
|
6621
|
-
if (
|
|
6621
|
+
if (props.calHeight && nfTableContent.value) {
|
|
6622
6622
|
const tableContentH = (_a2 = nfTableContent.value) == null ? void 0 : _a2.offsetHeight;
|
|
6623
6623
|
const actionH = nfTableActionContainerRef.value.offsetHeight;
|
|
6624
6624
|
const h = tableContentH - actionH;
|
|
@@ -6626,14 +6626,14 @@ __sfc_main.setup = (__props, __ctx) => {
|
|
|
6626
6626
|
elTableHeight.value = h;
|
|
6627
6627
|
}
|
|
6628
6628
|
} else {
|
|
6629
|
-
elTableHeight.value = (_b =
|
|
6629
|
+
elTableHeight.value = (_b = props.tableAttrs) == null ? void 0 : _b.height;
|
|
6630
6630
|
}
|
|
6631
6631
|
};
|
|
6632
6632
|
onMounted(() => {
|
|
6633
6633
|
calcTableHeight();
|
|
6634
|
-
|
|
6634
|
+
props.columns.forEach((i) => {
|
|
6635
6635
|
if (i.singleHeadMutiColSlot) {
|
|
6636
|
-
console.log("🔅 ~ onMounted ~ props.columns:",
|
|
6636
|
+
console.log("🔅 ~ onMounted ~ props.columns:", props.columns);
|
|
6637
6637
|
}
|
|
6638
6638
|
});
|
|
6639
6639
|
});
|
package/package/nf-table.vue
CHANGED
|
@@ -1138,11 +1138,11 @@ const headerDragend = async (newWidth, oldWidth, column, event) => {
|
|
|
1138
1138
|
await props.tableEvents['header-dragend']?.(newWidth, oldWidth, column, event)
|
|
1139
1139
|
}
|
|
1140
1140
|
|
|
1141
|
-
|
|
1141
|
+
async function clearDragCached() {
|
|
1142
1142
|
await CachedManager.asyncCachedSet(`${props.storageKey}$drag-column-width`, null)
|
|
1143
1143
|
}
|
|
1144
1144
|
|
|
1145
|
-
|
|
1145
|
+
async function clearColumnEditCached() {
|
|
1146
1146
|
await CachedManager.asyncCachedSet(props.storageKey, null)
|
|
1147
1147
|
}
|
|
1148
1148
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@94ai/nf-table",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.75",
|
|
4
4
|
"description": "> TODO: description",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"author": "zoujiahe <zoujiahe@94ai.com>",
|
|
@@ -14,12 +14,12 @@
|
|
|
14
14
|
"url": "http://94ai.gitlab.com/zoujiahe/common-ui.git"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@94ai/common-utils": "^3.2.
|
|
18
|
-
"@94ai/nf-button": "^3.2.
|
|
19
|
-
"@94ai/nf-drawer": "^3.2.
|
|
20
|
-
"@94ai/nf-message": "^3.2.
|
|
21
|
-
"@94ai/nf-search-form": "^3.2.
|
|
22
|
-
"@94ai/nf-theme-chalk": "^3.2.
|
|
17
|
+
"@94ai/common-utils": "^3.2.75",
|
|
18
|
+
"@94ai/nf-button": "^3.2.75",
|
|
19
|
+
"@94ai/nf-drawer": "^3.2.75",
|
|
20
|
+
"@94ai/nf-message": "^3.2.75",
|
|
21
|
+
"@94ai/nf-search-form": "^3.2.75",
|
|
22
|
+
"@94ai/nf-theme-chalk": "^3.2.75",
|
|
23
23
|
"idb-keyval": "^6.2.1",
|
|
24
24
|
"vue-demi": "^0.14.5",
|
|
25
25
|
"vuedraggable": "^2.24.3"
|
|
@@ -37,5 +37,5 @@
|
|
|
37
37
|
"types": "lib/index.d.ts",
|
|
38
38
|
"main": "lib/nf-table.cjs.js",
|
|
39
39
|
"module": "lib/nf-table.esm-bundler.js",
|
|
40
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "3e303fef4a30e065979f80c4df5000243b57d652"
|
|
41
41
|
}
|