bkui-vue 0.0.1-beta.208 → 0.0.1-beta.209

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.
Files changed (43) hide show
  1. package/dist/index.cjs.js +31 -31
  2. package/dist/index.esm.js +108 -80
  3. package/dist/index.umd.js +30 -30
  4. package/dist/style.css +1 -1
  5. package/dist/style.variable.css +1 -1
  6. package/lib/button/button.d.ts +1 -1
  7. package/lib/button/index.d.ts +4 -4
  8. package/lib/cascader/cascader.d.ts +1 -1
  9. package/lib/cascader/index.d.ts +4 -4
  10. package/lib/color-picker/color-picker.d.ts +1 -1
  11. package/lib/color-picker/index.d.ts +4 -4
  12. package/lib/directives/index.js +1 -1
  13. package/lib/dropdown/dropdown.d.ts +1 -1
  14. package/lib/dropdown/index.d.ts +4 -4
  15. package/lib/link/index.d.ts +4 -4
  16. package/lib/link/link.d.ts +1 -1
  17. package/lib/modal/index.d.ts +4 -0
  18. package/lib/modal/index.js +1 -1
  19. package/lib/modal/modal.d.ts +1 -0
  20. package/lib/popover/index.d.ts +4 -4
  21. package/lib/popover/popover.d.ts +1 -1
  22. package/lib/popover2/index.d.ts +4 -4
  23. package/lib/popover2/popover2.d.ts +1 -1
  24. package/lib/resize-layout/index.d.ts +4 -4
  25. package/lib/resize-layout/resize-layout.d.ts +1 -1
  26. package/lib/select/index.d.ts +4 -4
  27. package/lib/select/select.d.ts +1 -1
  28. package/lib/shared/index.js +1 -1
  29. package/lib/shared/pop-manager.d.ts +1 -2
  30. package/lib/switcher/index.d.ts +4 -4
  31. package/lib/switcher/switcher.d.ts +1 -1
  32. package/lib/table/const.d.ts +4 -1
  33. package/lib/table/index.js +1 -1
  34. package/lib/table/plugins/use-fixed-column.d.ts +2 -5
  35. package/lib/table/table.css +4 -0
  36. package/lib/table/table.less +5 -0
  37. package/lib/table/table.variable.css +4 -0
  38. package/lib/table/utils.d.ts +1 -0
  39. package/lib/upload/index.d.ts +4 -4
  40. package/lib/upload/upload-list.d.ts +1 -1
  41. package/lib/upload/upload-trigger.d.ts +1 -1
  42. package/lib/upload/upload.d.ts +1 -1
  43. package/package.json +1 -1
package/dist/index.esm.js CHANGED
@@ -7564,7 +7564,7 @@ class BKPopIndexManager {
7564
7564
  }
7565
7565
  }
7566
7566
  }
7567
- const bkPopIndexManager = new BKPopIndexManager();
7567
+ new BKPopIndexManager();
7568
7568
  /*!
7569
7569
  * is-plain-object <https://github.com/jonschlinkert/is-plain-object>
7570
7570
  *
@@ -10199,7 +10199,8 @@ var Component$v = defineComponent({
10199
10199
  emits: ["quick-close", "quickClose", "hidden", "shown", "close"],
10200
10200
  data() {
10201
10201
  return {
10202
- visible: false
10202
+ visible: false,
10203
+ bkPopIndexManager: null
10203
10204
  };
10204
10205
  },
10205
10206
  computed: {
@@ -10236,31 +10237,34 @@ var Component$v = defineComponent({
10236
10237
  }, 250);
10237
10238
  }
10238
10239
  },
10240
+ immediate: true,
10239
10241
  deep: true
10240
10242
  },
10241
10243
  visible(val) {
10244
+ var _a, _b;
10242
10245
  if (val) {
10246
+ this.bkPopIndexManager = new BKPopIndexManager();
10247
+ this.bkPopIndexManager.onMaskClick((_e) => {
10248
+ this.handleClickOutSide();
10249
+ });
10243
10250
  this.$nextTick(() => {
10244
10251
  const hideMaskStyle = {
10245
10252
  "background-color": "rgba(0,0,0,0)"
10246
10253
  };
10247
10254
  const appendStyle = this.showMask ? {} : hideMaskStyle;
10248
- bkPopIndexManager.show(this.$el, this.showMask, appendStyle, this.transfer, this.zIndex);
10255
+ this.bkPopIndexManager.show(this.$el, this.showMask, appendStyle, this.transfer, this.zIndex);
10249
10256
  this.$emit("shown");
10250
10257
  });
10251
10258
  } else {
10252
- bkPopIndexManager.hide(this.$el, this.transfer);
10259
+ (_a = this.bkPopIndexManager) == null ? void 0 : _a.hide(this.$el, this.transfer);
10260
+ (_b = this.bkPopIndexManager) == null ? void 0 : _b.destroy();
10253
10261
  }
10254
10262
  }
10255
10263
  },
10256
- created() {
10257
- bkPopIndexManager.onMaskClick((_e) => {
10258
- this.handleClickOutSide();
10259
- });
10260
- },
10261
10264
  beforeUnmount() {
10262
- bkPopIndexManager.hide(this.$el);
10263
- bkPopIndexManager.destroy();
10265
+ var _a, _b;
10266
+ (_a = this.bkPopIndexManager) == null ? void 0 : _a.hide(this.$el);
10267
+ (_b = this.bkPopIndexManager) == null ? void 0 : _b.destroy();
10264
10268
  },
10265
10269
  methods: {
10266
10270
  handleClickOutSide() {
@@ -11195,7 +11199,7 @@ const nodeList = /* @__PURE__ */ new Map();
11195
11199
  const tooltips = {
11196
11200
  beforeMount(el, binding) {
11197
11201
  const opts = getOpts(binding);
11198
- const { trigger } = opts.value;
11202
+ const { trigger } = opts;
11199
11203
  const popper2 = renderContent(opts);
11200
11204
  if (trigger === "hover") {
11201
11205
  let hideTimeout = null;
@@ -11229,11 +11233,14 @@ const tooltips = {
11229
11233
  });
11230
11234
  }
11231
11235
  nodeList.set(el, {
11232
- binding,
11236
+ opts,
11233
11237
  popper: popper2,
11234
11238
  popperInstance: null
11235
11239
  });
11236
11240
  },
11241
+ updated(el, binding) {
11242
+ nodeList.get(el).opts = getOpts(binding);
11243
+ },
11237
11244
  unmounted(el) {
11238
11245
  hide$1(el);
11239
11246
  nodeList.delete(el);
@@ -11258,16 +11265,16 @@ function initOptions() {
11258
11265
  return defaultOpts;
11259
11266
  }
11260
11267
  function getOpts(binding) {
11261
- const opts = ref(initOptions());
11268
+ const opts = initOptions();
11262
11269
  if (typeof binding.value === "object") {
11263
- Object.assign(opts.value, binding.value);
11270
+ Object.assign(opts, binding.value);
11264
11271
  } else {
11265
- opts.value.content = binding.value;
11272
+ opts.content = binding.value;
11266
11273
  }
11267
11274
  return opts;
11268
11275
  }
11269
11276
  function renderContent(opts) {
11270
- const { content: value, arrow: hasArrow, theme, extCls } = opts.value;
11277
+ const { content: value, arrow: hasArrow, theme, extCls } = opts;
11271
11278
  const isLight = theme === "light";
11272
11279
  const zIndex = bkZIndexManager.getPopperIndex();
11273
11280
  const content = document.createElement("div");
@@ -11287,8 +11294,8 @@ function renderArrow() {
11287
11294
  return arrow2;
11288
11295
  }
11289
11296
  function createPopperInstance(el, popper2) {
11290
- const { binding } = nodeList.get(el);
11291
- const { placement, distance: distance2, showOnInit } = getOpts(binding).value;
11297
+ const { opts } = nodeList.get(el);
11298
+ const { placement, distance: distance2, showOnInit } = opts;
11292
11299
  const popperInstance = createPopper(el, popper2, {
11293
11300
  placement,
11294
11301
  modifiers: [
@@ -11305,8 +11312,8 @@ function createPopperInstance(el, popper2) {
11305
11312
  return popperInstance;
11306
11313
  }
11307
11314
  function show(el) {
11308
- const { popper: popper2, binding } = nodeList.get(el);
11309
- const { disabled, content, arrow: hasArrow, onShow } = getOpts(binding).value;
11315
+ const { popper: popper2, opts } = nodeList.get(el);
11316
+ const { disabled, content, arrow: hasArrow, onShow } = opts;
11310
11317
  if (disabled)
11311
11318
  return;
11312
11319
  popper2.innerText = content;
@@ -11330,8 +11337,8 @@ function show(el) {
11330
11337
  function hide$1(el) {
11331
11338
  if (!nodeList.get(el))
11332
11339
  return;
11333
- const { popper: popper2, popperInstance, binding } = nodeList.get(el);
11334
- const { onHide } = getOpts(binding).value;
11340
+ const { popper: popper2, popperInstance, opts } = nodeList.get(el);
11341
+ const { onHide } = opts;
11335
11342
  if (popper2 && document.body.contains(popper2)) {
11336
11343
  popper2.removeAttribute("data-show");
11337
11344
  popperInstance == null ? void 0 : popperInstance.destroy();
@@ -16165,7 +16172,10 @@ const TABLE_ROW_ATTRIBUTE = {
16165
16172
  ROW_SELECTION_INDETERMINATE: "__row_selection_indeterminate",
16166
16173
  ROW_SOURCE_DATA: "__row_source_data"
16167
16174
  };
16168
- const SCROLLY_WIDTH = 4;
16175
+ const COLUMN_ATTRIBUTE = {
16176
+ COL_UID: "__col_$uuid"
16177
+ };
16178
+ const SCROLLY_WIDTH = 6;
16169
16179
  const LINE_HEIGHT = 42;
16170
16180
  const SETTING_SIZE = {
16171
16181
  large: 78,
@@ -17092,6 +17102,10 @@ const getElementTextWidth = (element, text) => {
17092
17102
  }
17093
17103
  return getTextWidth(text || (element == null ? void 0 : element.innerHTML), getCanvasFont(element));
17094
17104
  };
17105
+ const isColumnHidden = (settingFields, column, checked) => {
17106
+ const isSettingField = (col) => settingFields.some((field) => field.field === resolvePropVal(col, ["field", "type"], [col]));
17107
+ return isSettingField(column) && checked.length && !checked.includes(resolvePropVal(column, ["field", "type"], [column]));
17108
+ };
17095
17109
  var TableCell = defineComponent({
17096
17110
  name: "TableCell",
17097
17111
  props: {
@@ -17515,10 +17529,9 @@ var Settings = defineComponent({
17515
17529
  checkAll.value = !checkAll.value;
17516
17530
  const fields = localSettings.value.fields || props2.columns || [];
17517
17531
  if (checkAll.value) {
17518
- checkedFields.value = fields.map((item, index) => resolvedColVal(item, index));
17532
+ checkedFields.value = fields.filter((f2) => !f2.disabled).map((item, index) => resolvedColVal(item, index));
17519
17533
  } else {
17520
- const readonlyFields = fields.filter((item) => item.disabled).map((item, index) => resolvedColVal(item, index));
17521
- checkedFields.value.splice(0, checkedFields.value.length, ...readonlyFields);
17534
+ checkedFields.value.splice(0, checkedFields.value.length);
17522
17535
  }
17523
17536
  };
17524
17537
  const isLimit = computed(() => {
@@ -17662,54 +17675,75 @@ var useFixedColumn = (props2, colgroups, hasScrollY) => {
17662
17675
  return outOffset;
17663
17676
  }, hasScrollY ? SCROLLY_WIDTH : 0)
17664
17677
  };
17665
- const resolveFixRightOffset = resolveFixOffset.right;
17666
- const getFixedColumnStyleResolve = () => {
17667
- const resolveFixedColumnStyle = (column, fixedOffset2) => {
17668
- if (!column.fixed) {
17669
- return {};
17678
+ const getPreColumnOffset = (fixedPos, column) => {
17679
+ const sourceId = column[COLUMN_ATTRIBUTE.COL_UID];
17680
+ const opt = fixedPos === "right" ? -1 : 1;
17681
+ const {
17682
+ length
17683
+ } = colgroups;
17684
+ let start2 = fixedPos === "right" ? length * opt : 1;
17685
+ let preOffset = 0;
17686
+ for (start2; ; ) {
17687
+ start2 += -1 * opt;
17688
+ const index = Math.abs(start2);
17689
+ const current = colgroups[index];
17690
+ const curFixedPos = resolveFixColPos(current);
17691
+ const id = current[COLUMN_ATTRIBUTE.COL_UID];
17692
+ if (curFixedPos === fixedPos && sourceId !== id) {
17693
+ const width = getColumnReactWidth(current);
17694
+ preOffset += width;
17695
+ }
17696
+ if (start2 === 0 || sourceId === id) {
17697
+ break;
17670
17698
  }
17671
- const fixedPos = resolveFixColPos(column);
17672
- const opt = fixedPos === "right" ? -1 : 1;
17673
- const offsetX = `${fixedOffset2[fixedPos]}px`;
17674
- fixedOffset2[fixedPos] = fixedOffset2[fixedPos] + getColumnReactWidth(column) * opt;
17675
- return {
17676
- [fixedPos]: offsetX
17677
- };
17678
- };
17679
- const rightOffsetWidth = resolveFixRightOffset(true);
17699
+ }
17700
+ return preOffset;
17701
+ };
17702
+ const resolveFixedColumnStyle = (column) => {
17703
+ if (!column.fixed) {
17704
+ return {};
17705
+ }
17680
17706
  const fixedOffset = {
17681
17707
  left: 0,
17682
- right: rightOffsetWidth
17708
+ right: 0
17683
17709
  };
17710
+ const fixedPos = resolveFixColPos(column);
17711
+ fixedOffset[fixedPos] = getPreColumnOffset(fixedPos, column);
17684
17712
  return {
17685
- fixedOffset,
17686
- resolveFixedColumnStyle
17713
+ [fixedPos]: `${fixedOffset[fixedPos]}px`
17687
17714
  };
17688
17715
  };
17689
- const renderFixedColumns = (scrollX, offsetRight) => {
17690
- const resolveColumnStyle = (colPos) => ({
17691
- width: `${resolveFixOffset[colPos](false)}px`,
17692
- bottom: `${footHeight.value}px`
17693
- });
17694
- const colPosExist = {
17695
- left: false,
17696
- right: false
17716
+ const resolveColumnStyle = (colPos) => ({
17717
+ width: `${resolveFixOffset[colPos](false)}px`,
17718
+ bottom: `${footHeight.value}px`
17719
+ });
17720
+ const colPosExist = {
17721
+ left: false,
17722
+ right: false
17723
+ };
17724
+ const fixedColumns = computed(() => colgroups.filter((col) => !col.isHidden && col.fixed).map((col) => {
17725
+ const colPos = resolveFixColPos(col);
17726
+ const isExist = colPosExist[colPos];
17727
+ colPosExist[colPos] = true;
17728
+ return {
17729
+ isExist,
17730
+ colPos,
17731
+ column: col
17697
17732
  };
17698
- return colgroups.filter((col) => !col.isHidden && col.fixed).map((col) => {
17699
- const colPos = resolveFixColPos(col);
17700
- const isExist = colPosExist[colPos];
17701
- colPosExist[colPos] = true;
17702
- return isExist ? "" : createVNode("div", {
17703
- "class": resolveColumnClass(col, scrollX, offsetRight),
17704
- "style": resolveColumnStyle(colPos)
17705
- }, null);
17706
- });
17707
- };
17733
+ }));
17734
+ const renderFixedColumns = (scrollX, offsetRight) => fixedColumns.value.map(({
17735
+ isExist,
17736
+ colPos,
17737
+ column
17738
+ }) => isExist ? "" : createVNode("div", {
17739
+ "class": resolveColumnClass(column, scrollX, offsetRight),
17740
+ "style": resolveColumnStyle(colPos)
17741
+ }, null));
17708
17742
  const fixedWrapperClass = resolveClassName("table-fixed");
17709
17743
  return {
17710
17744
  renderFixedColumns,
17711
17745
  fixedWrapperClass,
17712
- getFixedColumnStyleResolve
17746
+ resolveFixedColumnStyle
17713
17747
  };
17714
17748
  };
17715
17749
  function _isSlot$1(s2) {
@@ -17755,6 +17789,7 @@ class TableRender {
17755
17789
  return null;
17756
17790
  }
17757
17791
  const handleSettingsChanged = (arg) => {
17792
+ var _a;
17758
17793
  const {
17759
17794
  checked = [],
17760
17795
  size,
@@ -17762,9 +17797,10 @@ class TableRender {
17762
17797
  } = arg;
17763
17798
  this.reactiveProp.setting.size = size;
17764
17799
  this.reactiveProp.setting.height = height;
17800
+ const settingFields = ((_a = this.props.settings) == null ? void 0 : _a.fields) || [];
17765
17801
  if (checked.length) {
17766
17802
  this.colgroups.forEach((col) => {
17767
- col.isHidden = !(checked != null ? checked : []).includes(resolvePropVal(col, ["field", "type"], [col]));
17803
+ col.isHidden = isColumnHidden(settingFields, col, checked);
17768
17804
  });
17769
17805
  }
17770
17806
  this.emitEvent(EVENTS$1.ON_SETTING_CHANGE, [arg]);
@@ -17937,12 +17973,8 @@ class TableRender {
17937
17973
  });
17938
17974
  }, {});
17939
17975
  const {
17940
- getFixedColumnStyleResolve
17976
+ resolveFixedColumnStyle
17941
17977
  } = useFixedColumn(this.props, this.colgroups);
17942
- const {
17943
- resolveFixedColumnStyle,
17944
- fixedOffset
17945
- } = getFixedColumnStyleResolve();
17946
17978
  return createVNode("thead", {
17947
17979
  "style": rowStyle
17948
17980
  }, [createVNode(TableRow, null, {
@@ -17952,7 +17984,7 @@ class TableRender {
17952
17984
  "colspan": 1,
17953
17985
  "rowspan": 1,
17954
17986
  "class": this.getHeadColumnClass(column, index),
17955
- "style": resolveFixedColumnStyle(column, fixedOffset),
17987
+ "style": resolveFixedColumnStyle(column),
17956
17988
  "onClick": () => this.handleColumnHeadClick(index)
17957
17989
  }, resolveEventListener(column)), [createVNode(TableCell, null, _isSlot$1(_slot = renderHeadCell(column, index)) ? _slot : {
17958
17990
  default: () => [_slot]
@@ -17962,17 +17994,13 @@ class TableRender {
17962
17994
  }
17963
17995
  renderTBody(rows) {
17964
17996
  const {
17965
- getFixedColumnStyleResolve
17997
+ resolveFixedColumnStyle
17966
17998
  } = useFixedColumn(this.props, this.colgroups);
17967
17999
  return createVNode("tbody", null, [rows.map((row, rowIndex) => {
17968
18000
  const rowStyle = [...formatPropAsArray(this.props.rowStyle, [row, rowIndex, this]), {
17969
18001
  "--row-height": `${this.getRowHeight(row, rowIndex)}px`
17970
18002
  }];
17971
18003
  const rowClass = [...formatPropAsArray(this.props.rowClass, [row, rowIndex, this]), `hover-${this.props.rowHover}`];
17972
- const {
17973
- resolveFixedColumnStyle,
17974
- fixedOffset
17975
- } = getFixedColumnStyleResolve();
17976
18004
  const rowKey = row[TABLE_ROW_ATTRIBUTE.ROW_UID];
17977
18005
  return [createVNode(TableRow, {
17978
18006
  "key": rowKey
@@ -17984,7 +18012,7 @@ class TableRender {
17984
18012
  "onDblclick": (e) => this.handleRowDblClick(e, row, rowIndex, rows)
17985
18013
  }, [this.filterColgroups.map((column, index) => {
17986
18014
  let _slot2;
17987
- const cellStyle = [resolveFixedColumnStyle(column, fixedOffset), ...formatPropAsArray(this.props.cellStyle, [column, index, row, rowIndex, this])];
18015
+ const cellStyle = [resolveFixedColumnStyle(column), ...formatPropAsArray(this.props.cellStyle, [column, index, row, rowIndex, this])];
17988
18016
  const cellClass = [this.getColumnClass(column, index), ...formatPropAsArray(this.props.cellClass, [column, index, row, rowIndex, this]), {
17989
18017
  "expand-row": row[TABLE_ROW_ATTRIBUTE.ROW_EXPAND]
17990
18018
  }];
@@ -18460,12 +18488,12 @@ const useInit = (props2, targetColumns) => {
18460
18488
  var _a2, _b2;
18461
18489
  const checked = ((_a2 = props2.settings) == null ? void 0 : _a2.checked) || [];
18462
18490
  const settingFields = ((_b2 = props2.settings) == null ? void 0 : _b2.fields) || [];
18463
- const isSettingField = (col) => settingFields.some((field) => field.field === resolvePropVal(col, "field", [col]));
18464
18491
  colgroups.splice(0, colgroups.length, ...getColumns().map((col) => __spreadProps(__spreadValues({}, col), {
18465
18492
  calcWidth: null,
18466
18493
  resizeWidth: null,
18467
18494
  listeners: /* @__PURE__ */ new Map(),
18468
- isHidden: isSettingField(col) && checked.length && !checked.includes(resolvePropVal(col, ["field", "type"], [col]))
18495
+ isHidden: isColumnHidden(settingFields, col, checked),
18496
+ [COLUMN_ATTRIBUTE.COL_UID]: uuid_1.v4()
18469
18497
  })));
18470
18498
  };
18471
18499
  const { dragOffsetXStyle, dragOffsetX, resetResizeEvents, registerResizeEvent } = useColumnResize(colgroups, true);
@@ -18575,14 +18603,14 @@ const useInit = (props2, targetColumns) => {
18575
18603
  asyncSelection(row, selected, false);
18576
18604
  }
18577
18605
  };
18578
- const resolveSelectionRow = (row, thenFn = () => false) => {
18606
+ const resolveSelectionRow = (row, thenFn = (row2) => validateSelectionFn(row2)) => {
18579
18607
  if (typeof props2.isSelectedFn === "function") {
18580
18608
  return Reflect.apply(props2.isSelectedFn, globalThis, [{ row, data: props2.data }]);
18581
18609
  }
18582
18610
  if (typeof props2.selectionKey === "string" && props2.selectionKey.length) {
18583
18611
  return lodash.exports.get(row, props2.selectionKey);
18584
18612
  }
18585
- return thenFn();
18613
+ return thenFn(row);
18586
18614
  };
18587
18615
  const resolveSelection = (row, _rowId) => resolveSelectionRow(row, () => {
18588
18616
  var _a2;