bkui-vue 0.0.1-beta.207 → 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 (48) hide show
  1. package/dist/index.cjs.js +31 -31
  2. package/dist/index.esm.js +112 -81
  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/input/index.js +1 -1
  16. package/lib/link/index.d.ts +4 -4
  17. package/lib/link/link.d.ts +1 -1
  18. package/lib/modal/index.d.ts +4 -0
  19. package/lib/modal/index.js +1 -1
  20. package/lib/modal/modal.d.ts +1 -0
  21. package/lib/popover/index.d.ts +4 -4
  22. package/lib/popover/popover.d.ts +1 -1
  23. package/lib/popover2/index.d.ts +4 -4
  24. package/lib/popover2/popover2.d.ts +1 -1
  25. package/lib/resize-layout/index.d.ts +4 -4
  26. package/lib/resize-layout/resize-layout.css +3 -3
  27. package/lib/resize-layout/resize-layout.d.ts +1 -1
  28. package/lib/resize-layout/resize-layout.less +3 -3
  29. package/lib/resize-layout/resize-layout.variable.css +3 -3
  30. package/lib/select/index.d.ts +4 -4
  31. package/lib/select/index.js +1 -1
  32. package/lib/select/select.d.ts +1 -1
  33. package/lib/shared/index.js +1 -1
  34. package/lib/shared/pop-manager.d.ts +1 -2
  35. package/lib/switcher/index.d.ts +4 -4
  36. package/lib/switcher/switcher.d.ts +1 -1
  37. package/lib/table/const.d.ts +4 -1
  38. package/lib/table/index.js +1 -1
  39. package/lib/table/plugins/use-fixed-column.d.ts +2 -5
  40. package/lib/table/table.css +4 -0
  41. package/lib/table/table.less +5 -0
  42. package/lib/table/table.variable.css +4 -0
  43. package/lib/table/utils.d.ts +1 -0
  44. package/lib/upload/index.d.ts +4 -4
  45. package/lib/upload/upload-list.d.ts +1 -1
  46. package/lib/upload/upload-trigger.d.ts +1 -1
  47. package/lib/upload/upload.d.ts +1 -1
  48. 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
  *
@@ -9435,7 +9435,9 @@ var Component$y = defineComponent({
9435
9435
  ctx.emit(EVENTS$2.UPDATE, val);
9436
9436
  ctx.emit(EVENTS$2.CHANGE, val);
9437
9437
  }
9438
- (_a2 = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a2.call(formItem, "blur");
9438
+ if (props2.withValidate) {
9439
+ (_a2 = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a2.call(formItem, "blur");
9440
+ }
9439
9441
  }
9440
9442
  function eventHandler(eventName) {
9441
9443
  return (e) => {
@@ -10197,7 +10199,8 @@ var Component$v = defineComponent({
10197
10199
  emits: ["quick-close", "quickClose", "hidden", "shown", "close"],
10198
10200
  data() {
10199
10201
  return {
10200
- visible: false
10202
+ visible: false,
10203
+ bkPopIndexManager: null
10201
10204
  };
10202
10205
  },
10203
10206
  computed: {
@@ -10234,31 +10237,34 @@ var Component$v = defineComponent({
10234
10237
  }, 250);
10235
10238
  }
10236
10239
  },
10240
+ immediate: true,
10237
10241
  deep: true
10238
10242
  },
10239
10243
  visible(val) {
10244
+ var _a, _b;
10240
10245
  if (val) {
10246
+ this.bkPopIndexManager = new BKPopIndexManager();
10247
+ this.bkPopIndexManager.onMaskClick((_e) => {
10248
+ this.handleClickOutSide();
10249
+ });
10241
10250
  this.$nextTick(() => {
10242
10251
  const hideMaskStyle = {
10243
10252
  "background-color": "rgba(0,0,0,0)"
10244
10253
  };
10245
10254
  const appendStyle = this.showMask ? {} : hideMaskStyle;
10246
- bkPopIndexManager.show(this.$el, this.showMask, appendStyle, this.transfer, this.zIndex);
10255
+ this.bkPopIndexManager.show(this.$el, this.showMask, appendStyle, this.transfer, this.zIndex);
10247
10256
  this.$emit("shown");
10248
10257
  });
10249
10258
  } else {
10250
- 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();
10251
10261
  }
10252
10262
  }
10253
10263
  },
10254
- created() {
10255
- bkPopIndexManager.onMaskClick((_e) => {
10256
- this.handleClickOutSide();
10257
- });
10258
- },
10259
10264
  beforeUnmount() {
10260
- bkPopIndexManager.hide(this.$el);
10261
- 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();
10262
10268
  },
10263
10269
  methods: {
10264
10270
  handleClickOutSide() {
@@ -11193,7 +11199,7 @@ const nodeList = /* @__PURE__ */ new Map();
11193
11199
  const tooltips = {
11194
11200
  beforeMount(el, binding) {
11195
11201
  const opts = getOpts(binding);
11196
- const { trigger } = opts.value;
11202
+ const { trigger } = opts;
11197
11203
  const popper2 = renderContent(opts);
11198
11204
  if (trigger === "hover") {
11199
11205
  let hideTimeout = null;
@@ -11227,11 +11233,14 @@ const tooltips = {
11227
11233
  });
11228
11234
  }
11229
11235
  nodeList.set(el, {
11230
- binding,
11236
+ opts,
11231
11237
  popper: popper2,
11232
11238
  popperInstance: null
11233
11239
  });
11234
11240
  },
11241
+ updated(el, binding) {
11242
+ nodeList.get(el).opts = getOpts(binding);
11243
+ },
11235
11244
  unmounted(el) {
11236
11245
  hide$1(el);
11237
11246
  nodeList.delete(el);
@@ -11256,16 +11265,16 @@ function initOptions() {
11256
11265
  return defaultOpts;
11257
11266
  }
11258
11267
  function getOpts(binding) {
11259
- const opts = ref(initOptions());
11268
+ const opts = initOptions();
11260
11269
  if (typeof binding.value === "object") {
11261
- Object.assign(opts.value, binding.value);
11270
+ Object.assign(opts, binding.value);
11262
11271
  } else {
11263
- opts.value.content = binding.value;
11272
+ opts.content = binding.value;
11264
11273
  }
11265
11274
  return opts;
11266
11275
  }
11267
11276
  function renderContent(opts) {
11268
- const { content: value, arrow: hasArrow, theme, extCls } = opts.value;
11277
+ const { content: value, arrow: hasArrow, theme, extCls } = opts;
11269
11278
  const isLight = theme === "light";
11270
11279
  const zIndex = bkZIndexManager.getPopperIndex();
11271
11280
  const content = document.createElement("div");
@@ -11285,8 +11294,8 @@ function renderArrow() {
11285
11294
  return arrow2;
11286
11295
  }
11287
11296
  function createPopperInstance(el, popper2) {
11288
- const { binding } = nodeList.get(el);
11289
- const { placement, distance: distance2, showOnInit } = getOpts(binding).value;
11297
+ const { opts } = nodeList.get(el);
11298
+ const { placement, distance: distance2, showOnInit } = opts;
11290
11299
  const popperInstance = createPopper(el, popper2, {
11291
11300
  placement,
11292
11301
  modifiers: [
@@ -11303,8 +11312,8 @@ function createPopperInstance(el, popper2) {
11303
11312
  return popperInstance;
11304
11313
  }
11305
11314
  function show(el) {
11306
- const { popper: popper2, binding } = nodeList.get(el);
11307
- 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;
11308
11317
  if (disabled)
11309
11318
  return;
11310
11319
  popper2.innerText = content;
@@ -11328,8 +11337,8 @@ function show(el) {
11328
11337
  function hide$1(el) {
11329
11338
  if (!nodeList.get(el))
11330
11339
  return;
11331
- const { popper: popper2, popperInstance, binding } = nodeList.get(el);
11332
- const { onHide } = getOpts(binding).value;
11340
+ const { popper: popper2, popperInstance, opts } = nodeList.get(el);
11341
+ const { onHide } = opts;
11333
11342
  if (popper2 && document.body.contains(popper2)) {
11334
11343
  popper2.removeAttribute("data-show");
11335
11344
  popperInstance == null ? void 0 : popperInstance.destroy();
@@ -15627,6 +15636,7 @@ var Component$j = defineComponent({
15627
15636
  "disabled": this.isDisabled,
15628
15637
  "behavior": this.behavior,
15629
15638
  "size": this.size,
15639
+ "withValidate": false,
15630
15640
  "onInput": this.handleInputChange,
15631
15641
  "onEnter": this.handleInputEnter
15632
15642
  }, {
@@ -16162,7 +16172,10 @@ const TABLE_ROW_ATTRIBUTE = {
16162
16172
  ROW_SELECTION_INDETERMINATE: "__row_selection_indeterminate",
16163
16173
  ROW_SOURCE_DATA: "__row_source_data"
16164
16174
  };
16165
- const SCROLLY_WIDTH = 4;
16175
+ const COLUMN_ATTRIBUTE = {
16176
+ COL_UID: "__col_$uuid"
16177
+ };
16178
+ const SCROLLY_WIDTH = 6;
16166
16179
  const LINE_HEIGHT = 42;
16167
16180
  const SETTING_SIZE = {
16168
16181
  large: 78,
@@ -17089,6 +17102,10 @@ const getElementTextWidth = (element, text) => {
17089
17102
  }
17090
17103
  return getTextWidth(text || (element == null ? void 0 : element.innerHTML), getCanvasFont(element));
17091
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
+ };
17092
17109
  var TableCell = defineComponent({
17093
17110
  name: "TableCell",
17094
17111
  props: {
@@ -17512,10 +17529,9 @@ var Settings = defineComponent({
17512
17529
  checkAll.value = !checkAll.value;
17513
17530
  const fields = localSettings.value.fields || props2.columns || [];
17514
17531
  if (checkAll.value) {
17515
- checkedFields.value = fields.map((item, index) => resolvedColVal(item, index));
17532
+ checkedFields.value = fields.filter((f2) => !f2.disabled).map((item, index) => resolvedColVal(item, index));
17516
17533
  } else {
17517
- const readonlyFields = fields.filter((item) => item.disabled).map((item, index) => resolvedColVal(item, index));
17518
- checkedFields.value.splice(0, checkedFields.value.length, ...readonlyFields);
17534
+ checkedFields.value.splice(0, checkedFields.value.length);
17519
17535
  }
17520
17536
  };
17521
17537
  const isLimit = computed(() => {
@@ -17659,54 +17675,75 @@ var useFixedColumn = (props2, colgroups, hasScrollY) => {
17659
17675
  return outOffset;
17660
17676
  }, hasScrollY ? SCROLLY_WIDTH : 0)
17661
17677
  };
17662
- const resolveFixRightOffset = resolveFixOffset.right;
17663
- const getFixedColumnStyleResolve = () => {
17664
- const resolveFixedColumnStyle = (column, fixedOffset2) => {
17665
- if (!column.fixed) {
17666
- 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;
17667
17698
  }
17668
- const fixedPos = resolveFixColPos(column);
17669
- const opt = fixedPos === "right" ? -1 : 1;
17670
- const offsetX = `${fixedOffset2[fixedPos]}px`;
17671
- fixedOffset2[fixedPos] = fixedOffset2[fixedPos] + getColumnReactWidth(column) * opt;
17672
- return {
17673
- [fixedPos]: offsetX
17674
- };
17675
- };
17676
- const rightOffsetWidth = resolveFixRightOffset(true);
17699
+ }
17700
+ return preOffset;
17701
+ };
17702
+ const resolveFixedColumnStyle = (column) => {
17703
+ if (!column.fixed) {
17704
+ return {};
17705
+ }
17677
17706
  const fixedOffset = {
17678
17707
  left: 0,
17679
- right: rightOffsetWidth
17708
+ right: 0
17680
17709
  };
17710
+ const fixedPos = resolveFixColPos(column);
17711
+ fixedOffset[fixedPos] = getPreColumnOffset(fixedPos, column);
17681
17712
  return {
17682
- fixedOffset,
17683
- resolveFixedColumnStyle
17713
+ [fixedPos]: `${fixedOffset[fixedPos]}px`
17684
17714
  };
17685
17715
  };
17686
- const renderFixedColumns = (scrollX, offsetRight) => {
17687
- const resolveColumnStyle = (colPos) => ({
17688
- width: `${resolveFixOffset[colPos](false)}px`,
17689
- bottom: `${footHeight.value}px`
17690
- });
17691
- const colPosExist = {
17692
- left: false,
17693
- 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
17694
17732
  };
17695
- return colgroups.filter((col) => !col.isHidden && col.fixed).map((col) => {
17696
- const colPos = resolveFixColPos(col);
17697
- const isExist = colPosExist[colPos];
17698
- colPosExist[colPos] = true;
17699
- return isExist ? "" : createVNode("div", {
17700
- "class": resolveColumnClass(col, scrollX, offsetRight),
17701
- "style": resolveColumnStyle(colPos)
17702
- }, null);
17703
- });
17704
- };
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));
17705
17742
  const fixedWrapperClass = resolveClassName("table-fixed");
17706
17743
  return {
17707
17744
  renderFixedColumns,
17708
17745
  fixedWrapperClass,
17709
- getFixedColumnStyleResolve
17746
+ resolveFixedColumnStyle
17710
17747
  };
17711
17748
  };
17712
17749
  function _isSlot$1(s2) {
@@ -17752,6 +17789,7 @@ class TableRender {
17752
17789
  return null;
17753
17790
  }
17754
17791
  const handleSettingsChanged = (arg) => {
17792
+ var _a;
17755
17793
  const {
17756
17794
  checked = [],
17757
17795
  size,
@@ -17759,9 +17797,10 @@ class TableRender {
17759
17797
  } = arg;
17760
17798
  this.reactiveProp.setting.size = size;
17761
17799
  this.reactiveProp.setting.height = height;
17800
+ const settingFields = ((_a = this.props.settings) == null ? void 0 : _a.fields) || [];
17762
17801
  if (checked.length) {
17763
17802
  this.colgroups.forEach((col) => {
17764
- col.isHidden = !(checked != null ? checked : []).includes(resolvePropVal(col, ["field", "type"], [col]));
17803
+ col.isHidden = isColumnHidden(settingFields, col, checked);
17765
17804
  });
17766
17805
  }
17767
17806
  this.emitEvent(EVENTS$1.ON_SETTING_CHANGE, [arg]);
@@ -17934,12 +17973,8 @@ class TableRender {
17934
17973
  });
17935
17974
  }, {});
17936
17975
  const {
17937
- getFixedColumnStyleResolve
17976
+ resolveFixedColumnStyle
17938
17977
  } = useFixedColumn(this.props, this.colgroups);
17939
- const {
17940
- resolveFixedColumnStyle,
17941
- fixedOffset
17942
- } = getFixedColumnStyleResolve();
17943
17978
  return createVNode("thead", {
17944
17979
  "style": rowStyle
17945
17980
  }, [createVNode(TableRow, null, {
@@ -17949,7 +17984,7 @@ class TableRender {
17949
17984
  "colspan": 1,
17950
17985
  "rowspan": 1,
17951
17986
  "class": this.getHeadColumnClass(column, index),
17952
- "style": resolveFixedColumnStyle(column, fixedOffset),
17987
+ "style": resolveFixedColumnStyle(column),
17953
17988
  "onClick": () => this.handleColumnHeadClick(index)
17954
17989
  }, resolveEventListener(column)), [createVNode(TableCell, null, _isSlot$1(_slot = renderHeadCell(column, index)) ? _slot : {
17955
17990
  default: () => [_slot]
@@ -17959,17 +17994,13 @@ class TableRender {
17959
17994
  }
17960
17995
  renderTBody(rows) {
17961
17996
  const {
17962
- getFixedColumnStyleResolve
17997
+ resolveFixedColumnStyle
17963
17998
  } = useFixedColumn(this.props, this.colgroups);
17964
17999
  return createVNode("tbody", null, [rows.map((row, rowIndex) => {
17965
18000
  const rowStyle = [...formatPropAsArray(this.props.rowStyle, [row, rowIndex, this]), {
17966
18001
  "--row-height": `${this.getRowHeight(row, rowIndex)}px`
17967
18002
  }];
17968
18003
  const rowClass = [...formatPropAsArray(this.props.rowClass, [row, rowIndex, this]), `hover-${this.props.rowHover}`];
17969
- const {
17970
- resolveFixedColumnStyle,
17971
- fixedOffset
17972
- } = getFixedColumnStyleResolve();
17973
18004
  const rowKey = row[TABLE_ROW_ATTRIBUTE.ROW_UID];
17974
18005
  return [createVNode(TableRow, {
17975
18006
  "key": rowKey
@@ -17981,7 +18012,7 @@ class TableRender {
17981
18012
  "onDblclick": (e) => this.handleRowDblClick(e, row, rowIndex, rows)
17982
18013
  }, [this.filterColgroups.map((column, index) => {
17983
18014
  let _slot2;
17984
- 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])];
17985
18016
  const cellClass = [this.getColumnClass(column, index), ...formatPropAsArray(this.props.cellClass, [column, index, row, rowIndex, this]), {
17986
18017
  "expand-row": row[TABLE_ROW_ATTRIBUTE.ROW_EXPAND]
17987
18018
  }];
@@ -18457,12 +18488,12 @@ const useInit = (props2, targetColumns) => {
18457
18488
  var _a2, _b2;
18458
18489
  const checked = ((_a2 = props2.settings) == null ? void 0 : _a2.checked) || [];
18459
18490
  const settingFields = ((_b2 = props2.settings) == null ? void 0 : _b2.fields) || [];
18460
- const isSettingField = (col) => settingFields.some((field) => field.field === resolvePropVal(col, "field", [col]));
18461
18491
  colgroups.splice(0, colgroups.length, ...getColumns().map((col) => __spreadProps(__spreadValues({}, col), {
18462
18492
  calcWidth: null,
18463
18493
  resizeWidth: null,
18464
18494
  listeners: /* @__PURE__ */ new Map(),
18465
- 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()
18466
18497
  })));
18467
18498
  };
18468
18499
  const { dragOffsetXStyle, dragOffsetX, resetResizeEvents, registerResizeEvent } = useColumnResize(colgroups, true);
@@ -18572,14 +18603,14 @@ const useInit = (props2, targetColumns) => {
18572
18603
  asyncSelection(row, selected, false);
18573
18604
  }
18574
18605
  };
18575
- const resolveSelectionRow = (row, thenFn = () => false) => {
18606
+ const resolveSelectionRow = (row, thenFn = (row2) => validateSelectionFn(row2)) => {
18576
18607
  if (typeof props2.isSelectedFn === "function") {
18577
18608
  return Reflect.apply(props2.isSelectedFn, globalThis, [{ row, data: props2.data }]);
18578
18609
  }
18579
18610
  if (typeof props2.selectionKey === "string" && props2.selectionKey.length) {
18580
18611
  return lodash.exports.get(row, props2.selectionKey);
18581
18612
  }
18582
- return thenFn();
18613
+ return thenFn(row);
18583
18614
  };
18584
18615
  const resolveSelection = (row, _rowId) => resolveSelectionRow(row, () => {
18585
18616
  var _a2;