@94ai/nf-table 3.2.54 → 3.2.57

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.
@@ -57,6 +57,12 @@ __sfc_main$2.props = {
57
57
  type: String,
58
58
  default: "取 消"
59
59
  },
60
+ basicFieldDesc: {
61
+ key: "basicFieldDesc",
62
+ required: false,
63
+ type: String,
64
+ default: "基础字段"
65
+ },
60
66
  tableColumns: {
61
67
  key: "tableColumns",
62
68
  required: false,
@@ -161,7 +167,7 @@ __sfc_main$2.setup = (__props, __ctx) => {
161
167
  const obj = {};
162
168
  props.tableColumns.filter((item) => !item.destory).map((item) => {
163
169
  if (!item.type) {
164
- const key = item.category || "基础字段";
170
+ const key = item.category || props.basicFieldDesc;
165
171
  if (!obj[key]) {
166
172
  obj[key] = [];
167
173
  }
@@ -5250,36 +5256,6 @@ const __sfc_main$1 = vueDemi.defineComponent({
5250
5256
  name: "NfColumnCheckDrawer"
5251
5257
  });
5252
5258
  __sfc_main$1.props = {
5253
- selectEmptyWarningTips: {
5254
- key: "selectEmptyWarningTips",
5255
- required: false,
5256
- type: String,
5257
- default: "请选择至少一个选项"
5258
- },
5259
- tableColumns: {
5260
- key: "tableColumns",
5261
- required: false,
5262
- type: Array,
5263
- default: () => []
5264
- },
5265
- storageKey: {
5266
- key: "storageKey",
5267
- required: false,
5268
- type: String,
5269
- default: "nf-table-columns-cached-key"
5270
- },
5271
- operationPropKey: {
5272
- key: "operationPropKey",
5273
- required: false,
5274
- type: String,
5275
- default: "operation"
5276
- },
5277
- columnEdit: {
5278
- key: "columnEdit",
5279
- required: false,
5280
- type: Boolean,
5281
- default: false
5282
- },
5283
5259
  searchPlaceholder: {
5284
5260
  key: "searchPlaceholder",
5285
5261
  required: false,
@@ -5310,6 +5286,12 @@ __sfc_main$1.props = {
5310
5286
  type: String,
5311
5287
  default: "基础字段"
5312
5288
  },
5289
+ selectEmptyWarningTips: {
5290
+ key: "selectEmptyWarningTips",
5291
+ required: false,
5292
+ type: String,
5293
+ default: "请选择至少一个选项"
5294
+ },
5313
5295
  getCheckedLengthDesc: {
5314
5296
  key: "getCheckedLengthDesc",
5315
5297
  required: false,
@@ -5321,6 +5303,30 @@ __sfc_main$1.props = {
5321
5303
  required: false,
5322
5304
  type: Function,
5323
5305
  default: (length) => "全选(" + length + ")"
5306
+ },
5307
+ columnEdit: {
5308
+ key: "columnEdit",
5309
+ required: false,
5310
+ type: Boolean,
5311
+ default: false
5312
+ },
5313
+ tableColumns: {
5314
+ key: "tableColumns",
5315
+ required: false,
5316
+ type: Array,
5317
+ default: () => []
5318
+ },
5319
+ storageKey: {
5320
+ key: "storageKey",
5321
+ required: false,
5322
+ type: String,
5323
+ default: "nf-table-columns-cached-key"
5324
+ },
5325
+ operationPropKey: {
5326
+ key: "operationPropKey",
5327
+ required: false,
5328
+ type: String,
5329
+ default: "operation"
5324
5330
  }
5325
5331
  };
5326
5332
  __sfc_main$1.setup = (__props, __ctx) => {
@@ -5771,12 +5777,6 @@ const __sfc_main = vueDemi.defineComponent({
5771
5777
  name: "nf-table"
5772
5778
  });
5773
5779
  __sfc_main.props = {
5774
- emptyImageSize: {
5775
- key: "emptyImageSize",
5776
- required: false,
5777
- type: Number,
5778
- default: 145
5779
- },
5780
5780
  data: {
5781
5781
  key: "data",
5782
5782
  required: false,
@@ -5831,6 +5831,18 @@ __sfc_main.props = {
5831
5831
  type: Array,
5832
5832
  default: () => []
5833
5833
  },
5834
+ dragCached: {
5835
+ key: "dragCached",
5836
+ required: false,
5837
+ type: Boolean,
5838
+ default: true
5839
+ },
5840
+ emptyImageSize: {
5841
+ key: "emptyImageSize",
5842
+ required: false,
5843
+ type: Number,
5844
+ default: 145
5845
+ },
5834
5846
  calHeight: {
5835
5847
  key: "calHeight",
5836
5848
  required: false,
@@ -5963,23 +5975,17 @@ __sfc_main.props = {
5963
5975
  type: String,
5964
5976
  default: "确定"
5965
5977
  },
5966
- columnCheckWidth: {
5967
- key: "columnCheckWidth",
5968
- required: false,
5969
- type: String,
5970
- default: "600px"
5971
- },
5972
- columnCheckConfirmText: {
5973
- key: "columnCheckConfirmText",
5978
+ columnCheckBasicFieldDesc: {
5979
+ key: "columnCheckBasicFieldDesc",
5974
5980
  required: false,
5975
5981
  type: String,
5976
- default: "保 存"
5982
+ default: "基础字段"
5977
5983
  },
5978
- columnCheckCancelText: {
5979
- key: "columnCheckCancelText",
5984
+ columnCheckWidth: {
5985
+ key: "columnCheckWidth",
5980
5986
  required: false,
5981
5987
  type: String,
5982
- default: "取 消"
5988
+ default: "600px"
5983
5989
  },
5984
5990
  columnCheckModalAppendToBody: {
5985
5991
  key: "columnCheckModalAppendToBody",
@@ -6083,12 +6089,6 @@ __sfc_main.props = {
6083
6089
  type: String,
6084
6090
  default: "不固定"
6085
6091
  },
6086
- columnCheckBasicFieldDesc: {
6087
- key: "columnCheckBasicFieldDesc",
6088
- required: false,
6089
- type: String,
6090
- default: "基础字段"
6091
- },
6092
6092
  columnCheckGetCheckedLengthDesc: {
6093
6093
  key: "columnCheckGetCheckedLengthDesc",
6094
6094
  required: false,
@@ -6294,7 +6294,7 @@ __sfc_main.setup = (__props, __ctx) => {
6294
6294
  index: index2
6295
6295
  };
6296
6296
  });
6297
- commonUtils.CachedManager.syncCachedSet(props.storageKey, columnState);
6297
+ return commonUtils.CachedManager.syncCachedSet(props.storageKey, columnState);
6298
6298
  }
6299
6299
  };
6300
6300
  const syncShowItemToInitHidden = () => {
@@ -6347,33 +6347,44 @@ __sfc_main.setup = (__props, __ctx) => {
6347
6347
  }
6348
6348
  const cachedPriority = props.priority === "cached";
6349
6349
  if (cachedPriority ? cached : (_a2 = localShowColumn.value) == null ? void 0 : _a2.length) {
6350
- cachedPriority ? await syncCookiesToLocalShowColumn() : syncLocalShowColumnToCookies();
6350
+ cachedPriority ? await syncCookiesToLocalShowColumn() : await syncLocalShowColumnToCookies();
6351
6351
  } else if (cachedPriority ? (_b = localShowColumn.value) == null ? void 0 : _b.length : cached) {
6352
- cachedPriority ? syncLocalShowColumnToCookies() : await syncCookiesToLocalShowColumn();
6352
+ cachedPriority ? await syncLocalShowColumnToCookies() : await syncCookiesToLocalShowColumn();
6353
6353
  }
6354
6354
  } catch (e) {
6355
6355
  console.log(e);
6356
6356
  }
6357
6357
  }
6358
+ if (props.dragCached) {
6359
+ await commonUtils.CachedManager.asyncCachedGet(`${props.storageKey}$drag-column-width`);
6360
+ }
6361
+ };
6362
+ const getMinWidth = (column) => {
6363
+ const fs = 14;
6364
+ const label = column.customLabel || column.label;
6365
+ const char = label.match(/[\u2E80-\u9FFF]/g);
6366
+ const charLen = char ? char.length : 0;
6367
+ const num = label.match(/\d|\./g);
6368
+ const numLen = num ? num.length : 0;
6369
+ const otherLen = label.length - charLen - numLen;
6370
+ return fs * (charLen * 1 + numLen * 0.7 + otherLen * 0.58) + 20 + (column.sortable ? 24 : 0);
6358
6371
  };
6359
- initCachedData();
6360
6372
  const tableColumns = vueDemi.ref([]);
6361
6373
  const elTableRefKey = vueDemi.ref(Date.now());
6362
- const syncCookiesToTableColumn = async (readCached = true) => {
6374
+ const syncCookiesToTableColumn = async (readCached = true, init = false) => {
6363
6375
  props.columns._skip = true;
6364
6376
  const columns = props.columns.map((item, index2) => {
6365
6377
  var _a2;
6366
- ((_a2 = item.label) == null ? void 0 : _a2.length) || 0;
6367
6378
  const attr = item.attr || {};
6368
6379
  if (!attr["min-width"] && item.label) {
6369
- const fs = 14;
6370
- const char = item.label.match(/[\u2E80-\u9FFF]/g);
6371
- const charLen = char ? char.length : 0;
6372
- const num = item.label.match(/\d|\./g);
6373
- const numLen = num ? num.length : 0;
6374
- const otherLen = item.label.length - charLen - numLen;
6375
- const minWidth = fs * (charLen * 1.1 + numLen * 0.65 + otherLen * 0.5) + 32 + (attr.sortable ? 24 : 0);
6376
- attr["min-width"] = String(minWidth) + "px";
6380
+ attr["min-width"] = String(getMinWidth(item)) + "px";
6381
+ }
6382
+ if (init && props.dragCached) {
6383
+ const prop = item.prop || ((_a2 = item.attr) == null ? void 0 : _a2.prop);
6384
+ let columnWidth = commonUtils.CachedManager.syncCachedGet(`${props.storageKey}$drag-column-width`) || {};
6385
+ if (columnWidth[prop]) {
6386
+ attr.width = columnWidth[prop];
6387
+ }
6377
6388
  }
6378
6389
  item.attr = {
6379
6390
  ...item.attr,
@@ -6423,7 +6434,11 @@ __sfc_main.setup = (__props, __ctx) => {
6423
6434
  });
6424
6435
  elTableRefKey.value = Date.now();
6425
6436
  };
6426
- syncCookiesToTableColumn();
6437
+ const initColumn = async () => {
6438
+ await initCachedData();
6439
+ syncCookiesToTableColumn(true, true);
6440
+ };
6441
+ initColumn();
6427
6442
  vueDemi.onBeforeMount(() => {
6428
6443
  vueDemi.watch(() => {
6429
6444
  return props.columns;
@@ -6548,8 +6563,14 @@ __sfc_main.setup = (__props, __ctx) => {
6548
6563
  const headerDragend = async (newWidth, oldWidth, column, event) => {
6549
6564
  var _a2, _b;
6550
6565
  await vueDemi.nextTick();
6551
- if (newWidth < column.minWidth) {
6552
- column.width = column.minWidth;
6566
+ const minWidth = getMinWidth(column);
6567
+ if (newWidth < minWidth) {
6568
+ column.width = minWidth;
6569
+ }
6570
+ if (props.dragCached) {
6571
+ const columnCachedData = await commonUtils.CachedManager.asyncCachedGet(`${props.storageKey}$drag-column-width`) || {};
6572
+ columnCachedData[column.property] = column.width;
6573
+ await commonUtils.CachedManager.asyncCachedSet(`${props.storageKey}$drag-column-width`, columnCachedData);
6553
6574
  }
6554
6575
  await ((_b = (_a2 = props.tableEvents)["header-dragend"]) == null ? void 0 : _b.call(_a2, newWidth, oldWidth, column, event));
6555
6576
  };
@@ -6777,13 +6798,7 @@ var _sfc_render = function render3() {
6777
6798
  }, [_vm._t("searchBox", function() {
6778
6799
  var _a2;
6779
6800
  return [_c("nf-search-form", _vm._g(_vm._b({
6780
- ref: "nfSearchFormRef",
6781
- attrs: {
6782
- "operation-prop-key": _vm.operationPropKey,
6783
- "storage-key": _vm.searchFormStorageKey,
6784
- "property": _vm.priority,
6785
- "select-empty-warning-tips": _vm.selectEmptyWarningTips
6786
- }
6801
+ ref: "nfSearchFormRef"
6787
6802
  }, "nf-search-form", _vm.searchFormAttrs, false), _vm.searchFormEvents), [_vm._l(((_a2 = _vm.nfSearchFormRef) == null ? void 0 : _a2.renderSearchFormItemOptions) || [], function(item) {
6788
6803
  var _a3;
6789
6804
  return [((_a3 = item.tooltip) == null ? void 0 : _a3.slot) ? [_vm._t(item.tooltip.slot, null, {
@@ -6833,33 +6848,13 @@ var _sfc_render = function render3() {
6833
6848
  "height": _vm.elTableHeight
6834
6849
  }
6835
6850
  }, "el-table", _vm.tableAttrer, false), _vm.tableEventer), [_vm._l(_vm.tableColumns, function(column) {
6836
- return [_vm.isShow(column) ? [column.type ? [column.render || column.prop || column.slot ? _c("el-table-column", _vm._b({
6837
- key: column.key || column.prop,
6838
- attrs: {
6839
- "type": column.type,
6840
- "label": column.label
6841
- },
6842
- scopedSlots: _vm._u([{
6843
- key: "default",
6844
- fn: function(scope) {
6845
- return [column.render ? _c("render-component", {
6846
- attrs: {
6847
- "render": column.render,
6848
- "row": scope.row
6849
- }
6850
- }) : [column.slot ? _vm._t(column.slot, null, {
6851
- "row": scope.row,
6852
- "index": scope.$index
6853
- }) : _c("span", [_vm._v(_vm._s(scope.row[column.prop]))])]];
6854
- }
6855
- }], null, true)
6856
- }, "el-table-column", column.attr, false)) : _c("el-table-column", _vm._b({
6857
- key: column.key || column.prop,
6851
+ return [_vm.isShow(column) ? [column.type ? _c("el-table-column", _vm._b({
6852
+ key: column.key || column.prop || column.type,
6858
6853
  attrs: {
6859
6854
  "type": column.type,
6860
6855
  "label": column.label
6861
6856
  }
6862
- }, "el-table-column", column.attr, false))] : [column.attr && column.attr.formatter ? _c("el-table-column", _vm._b({
6857
+ }, "el-table-column", column.attr, false)) : [column.attr && column.attr.formatter ? _c("el-table-column", _vm._b({
6863
6858
  key: column.key || column.prop,
6864
6859
  attrs: {
6865
6860
  "prop": column.prop,
@@ -7368,14 +7363,15 @@ var _sfc_render = function render3() {
7368
7363
  })], 2)], 2), _vm.nfColumCheckDialogVisible && _vm.checkMode === "dialog" ? _c("column-check-dialog", {
7369
7364
  ref: "columnCheckDialog",
7370
7365
  attrs: {
7366
+ "title": _vm.columnCheckTitle,
7367
+ "confirm-text": _vm.columnCheckConfirmButtonText,
7368
+ "cancel-text": _vm.columnCheckCancelButtonText,
7369
+ "basic-field-desc": _vm.columnCheckBasicFieldDesc,
7371
7370
  "show": _vm.nfColumCheckDialogVisible,
7372
7371
  "table-columns": _vm.columns,
7373
7372
  "column-edit": _vm.columnEdit,
7374
7373
  "storage-key": _vm.storageKey,
7375
- "title": _vm.columnCheckTitle,
7376
7374
  "width": _vm.columnCheckWidth,
7377
- "confirm-text": _vm.columnCheckConfirmText,
7378
- "cancel-text": _vm.columnCheckCancelText,
7379
7375
  "modal-append-to-body": _vm.columnCheckModalAppendToBody,
7380
7376
  "modal": _vm.columnCheckModal,
7381
7377
  "fullscreen": _vm.columnCheckFullscreen,
@@ -7404,10 +7400,10 @@ var _sfc_render = function render3() {
7404
7400
  })], 2) : _vm._e(), _vm.checkMode === "drawer" ? _c("nf-drawer", {
7405
7401
  ref: "columnCheckNfDrawer",
7406
7402
  attrs: {
7407
- "size": "680px",
7408
7403
  "title": _vm.columnCheckTitle,
7409
7404
  "cancel-button-text": _vm.columnCheckCancelButtonText,
7410
7405
  "confirm-button-text": _vm.columnCheckConfirmButtonText,
7406
+ "size": "680px",
7411
7407
  "visible": _vm.nfColumCheckDialogVisible,
7412
7408
  "tabs": _vm.columnCheckTabs,
7413
7409
  "destroy-on-close": true,
@@ -7433,13 +7429,13 @@ var _sfc_render = function render3() {
7433
7429
  "clear-desc": _vm.columnCheckClearDesc,
7434
7430
  "no-fixed-desc": _vm.columnCheckNoFixedDesc,
7435
7431
  "basic-field-desc": _vm.columnCheckBasicFieldDesc,
7436
- "column-edit": _vm.columnEdit,
7432
+ "select-empty-warning-tips": _vm.selectEmptyWarningTips,
7437
7433
  "get-checked-length-desc": _vm.columnCheckGetCheckedLengthDesc,
7438
7434
  "get-all-check-desc": _vm.columnCheckGetAllCheckDesc,
7435
+ "column-edit": _vm.columnEdit,
7439
7436
  "operation-prop-key": _vm.operationPropKey,
7440
7437
  "storage-key": _vm.storageKey,
7441
- "table-columns": _vm.columns,
7442
- "select-empty-warning-tips": _vm.selectEmptyWarningTips
7438
+ "table-columns": _vm.columns
7443
7439
  }
7444
7440
  })], 2) : _vm._e()], 2);
7445
7441
  };