bkui-vue 0.0.1-beta.106 → 0.0.1-beta.109

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/dist/index.esm.js CHANGED
@@ -15024,10 +15024,13 @@ var Component$d = defineComponent({
15024
15024
  innerHeight.value = props.abosuteHeight;
15025
15025
  }
15026
15026
  };
15027
- const afterListDataReset = () => {
15027
+ const afterListDataReset = (scrollTop = true) => {
15028
15028
  var _a;
15029
15029
  const el = (_a = refRoot.value) == null ? void 0 : _a.parentNode;
15030
15030
  computedVirtualIndex(props.lineHeight, handleScrollCallback, pagination2, el, null);
15031
+ if (scrollTop && refRoot.value) {
15032
+ refRoot.value.scrollTo(0, 0);
15033
+ }
15031
15034
  };
15032
15035
  const localList = computed(() => (props.list || []).map((item, index) => __spreadProps(__spreadValues({}, item), {
15033
15036
  $index: index
@@ -15390,7 +15393,7 @@ var useList = () => {
15390
15393
  showPreBatch.value = false;
15391
15394
  showNextBatch.value = false;
15392
15395
  const stack = [];
15393
- if (proxy.totalPageNum <= PAGE_ITEMS_NUM) {
15396
+ if (proxy.totalPageNum <= PAGE_ITEMS_NUM + 2) {
15394
15397
  for (let i2 = 2; i2 <= proxy.totalPageNum - 1; i2++) {
15395
15398
  stack.push(i2);
15396
15399
  }
@@ -15935,7 +15938,7 @@ const getRowText = (row, key, column) => {
15935
15938
  if (column.type === "index") {
15936
15939
  return row[TABLE_ROW_ATTRIBUTE.ROW_INDEX] + 1;
15937
15940
  }
15938
- return row[key];
15941
+ return lodash.exports.get(row, key);
15939
15942
  };
15940
15943
  const formatPropAsArray = (prop, args) => {
15941
15944
  if (Array.isArray(prop)) {
@@ -15967,9 +15970,9 @@ const getRowKey = (item, props, index) => {
15967
15970
  }
15968
15971
  return uuid_1.v4();
15969
15972
  };
15970
- const hasRootScrollY = (root) => {
15973
+ const hasRootScrollY = (root, querySelector) => {
15971
15974
  if (root) {
15972
- const tableBody = root.querySelector(".bk-table-body table");
15975
+ const tableBody = root.querySelector(querySelector);
15973
15976
  if (tableBody) {
15974
15977
  return tableBody.offsetHeight > root.offsetHeight;
15975
15978
  }
@@ -16084,6 +16087,7 @@ var HeadFilter = defineComponent({
16084
16087
  var SortType = /* @__PURE__ */ ((SortType2) => {
16085
16088
  SortType2["ASC"] = "asc";
16086
16089
  SortType2["DESC"] = "desc";
16090
+ SortType2["NULL"] = "null";
16087
16091
  return SortType2;
16088
16092
  })(SortType || {});
16089
16093
  var HeadSort = defineComponent({
@@ -16101,7 +16105,11 @@ var HeadSort = defineComponent({
16101
16105
  e.stopImmediatePropagation();
16102
16106
  e.stopPropagation();
16103
16107
  e.preventDefault();
16104
- sortType.value = type;
16108
+ if (sortType.value === type) {
16109
+ sortType.value = SortType.NULL;
16110
+ } else {
16111
+ sortType.value = type;
16112
+ }
16105
16113
  if (props.column.sort === "custom") {
16106
16114
  emit("change", null, type);
16107
16115
  return;
@@ -16117,7 +16125,7 @@ var HeadSort = defineComponent({
16117
16125
  return String.prototype.localeCompare.call(val0, val1);
16118
16126
  };
16119
16127
  const sortFn = typeof ((_a = props.column.sort) == null ? void 0 : _a.sortFn) === "function" ? (_b = props.column.sort) == null ? void 0 : _b.sortFn : sortFn0;
16120
- const execFn = (_a2, _b2) => sortFn(_a2, _b2) * (type === SortType.DESC ? -1 : 1);
16128
+ const execFn = sortType.value === SortType.NULL ? () => true : (_a2, _b2) => sortFn(_a2, _b2) * (type === SortType.DESC ? -1 : 1);
16121
16129
  emit("change", execFn, type);
16122
16130
  };
16123
16131
  return () => createVNode("span", {
@@ -16795,10 +16803,13 @@ var useColumnResize = (colgroups, immediate = true) => {
16795
16803
  const targetTable = e.target.closest("table");
16796
16804
  targetTable.querySelectorAll("th").forEach((th) => th.style.setProperty("user-select", "inherit"));
16797
16805
  };
16806
+ const updateOffsetX = (e) => lodash.exports.throttle(() => {
16807
+ dragOffsetX.value = e.clientX - startX + dragStartOffsetX;
16808
+ }, 60);
16798
16809
  const handleMouseMove = (e) => {
16799
16810
  const bodyStyle = document.body.style;
16800
16811
  bodyStyle.setProperty("cursor", "");
16801
- dragOffsetX.value = e.clientX - startX + dragStartOffsetX;
16812
+ updateOffsetX(e)();
16802
16813
  };
16803
16814
  const handler = {
16804
16815
  [EVENTS2.MOUSE_DOWN]: (e, column) => {
@@ -16876,7 +16887,7 @@ var useColumnResize = (colgroups, immediate = true) => {
16876
16887
  position: "absolute",
16877
16888
  top: 0,
16878
16889
  bottom: 0,
16879
- left: `${dragOffsetX.value}px`,
16890
+ left: 0,
16880
16891
  width: "1px",
16881
16892
  "background-color": "#ebeef5"
16882
16893
  }));
@@ -16929,41 +16940,17 @@ const useClass = (props, root, reactiveProp, pageData) => {
16929
16940
  }
16930
16941
  return defaultValue;
16931
16942
  };
16932
- const getRowsHeight = () => {
16933
- if (!(pageData == null ? void 0 : pageData.length)) {
16934
- return 0;
16935
- }
16936
- if (typeof props.rowHeight === "function") {
16937
- return pageData.reduce((out, row, rowIndex) => {
16938
- const result = Reflect.apply(props.rowHeight, globalThis, ["tbody", row, rowIndex]);
16939
- let resultHeight = out;
16940
- if (/^\d+\.?\d*px?$/.test(`${result}`)) {
16941
- resultHeight += Number(result.replace(/px$/, ""));
16942
- }
16943
- return resultHeight;
16944
- }, 0);
16945
- }
16946
- if (/^\d+\.?\d*px?$/.test(`${props.rowHeight}`)) {
16947
- const rowHeight = props.rowHeight.replace(/px$/, "");
16948
- return pageData.length * Number(rowHeight);
16949
- }
16950
- return 0;
16951
- };
16952
16943
  const contentStyle = reactive({});
16953
16944
  const resolveContentStyle = () => {
16954
16945
  const resolveHeight = resolvePropHeight(props.height, autoHeight.value);
16955
16946
  const resolveHeadHeight = props.showHead ? resolvePropHeight(props.headHeight, 40) + 2 : 0;
16956
- const resolveMaxHeight = resolvePropHeight(props.maxHeight, autoHeight.value);
16957
16947
  const resolveMinHeight = resolvePropHeight(props.minHeight, autoHeight.value);
16958
16948
  const resolveFooterHeight = props.pagination && props.data.length ? 40 : 0;
16959
16949
  const contentHeight = resolveHeight - resolveHeadHeight - resolveFooterHeight;
16960
16950
  const height = props.height !== "auto" ? `${contentHeight}px` : false;
16961
- const maxHeight = resolveMaxHeight - resolveHeadHeight - resolveFooterHeight;
16962
16951
  const minHeight = resolveMinHeight - resolveHeadHeight - resolveFooterHeight;
16963
- const rowsHeight = getRowsHeight();
16964
16952
  Object.assign(contentStyle, {
16965
16953
  display: (pageData == null ? void 0 : pageData.length) ? "block" : false,
16966
- "max-height": `${maxHeight > rowsHeight ? maxHeight : rowsHeight}px`,
16967
16954
  "min-height": `${minHeight}px`,
16968
16955
  height
16969
16956
  });
@@ -16980,13 +16967,8 @@ const useClass = (props, root, reactiveProp, pageData) => {
16980
16967
  }
16981
16968
  };
16982
16969
  const updateBorderClass = (root2) => {
16983
- hasScrollY.value = hasRootScrollY(root2);
16984
- if (root2) {
16985
- const tableBody = root2.querySelector(".bk-table-body table");
16986
- if (tableBody) {
16987
- hasScrollY.value = tableBody.offsetHeight > root2.offsetHeight;
16988
- }
16989
- }
16970
+ const querySelector = props.virtualEnabled ? `.${resolveClassName("virtual-section")}` : `.${resolveClassName("table-body-content")}`;
16971
+ hasScrollY.value = hasRootScrollY(root2, querySelector);
16990
16972
  };
16991
16973
  const getColumnsWidthOffsetWidth = () => {
16992
16974
  let offsetWidth = 0;
@@ -17026,7 +17008,7 @@ const useInit = (props) => {
17026
17008
  watch(() => props.columns, () => {
17027
17009
  updateColGroups();
17028
17010
  }, { immediate: true, deep: true });
17029
- const { dragOffsetXStyle } = useColumnResize(colgroups, true);
17011
+ const { dragOffsetXStyle, dragOffsetX } = useColumnResize(colgroups, true);
17030
17012
  const { activeColumns } = useActiveColumns(props);
17031
17013
  const reactiveSchema = reactive({
17032
17014
  rowActions: /* @__PURE__ */ new Map(),
@@ -17077,6 +17059,7 @@ const useInit = (props) => {
17077
17059
  return {
17078
17060
  colgroups,
17079
17061
  dragOffsetXStyle,
17062
+ dragOffsetX,
17080
17063
  reactiveSchema,
17081
17064
  indexData,
17082
17065
  fixedWrapperClass,
@@ -17100,6 +17083,7 @@ var Component$b = defineComponent({
17100
17083
  const {
17101
17084
  colgroups,
17102
17085
  dragOffsetXStyle,
17086
+ dragOffsetX,
17103
17087
  reactiveSchema,
17104
17088
  indexData,
17105
17089
  renderFixedColumns,
@@ -17145,6 +17129,7 @@ var Component$b = defineComponent({
17145
17129
  }
17146
17130
  });
17147
17131
  tableRender.on(EVENTS$1.ON_SORT_BY_CLICK, (args) => {
17132
+ var _a, _b;
17148
17133
  const {
17149
17134
  sortFn,
17150
17135
  column,
@@ -17153,7 +17138,8 @@ var Component$b = defineComponent({
17153
17138
  } = args;
17154
17139
  if (typeof sortFn === "function") {
17155
17140
  columnSortFn = sortFn;
17156
- pageData.sort(columnSortFn);
17141
+ resolvePageData(columnFilterFn, columnSortFn);
17142
+ (_b = (_a = refVirtualRender.value) == null ? void 0 : _a.reset) == null ? void 0 : _b.call(_a);
17157
17143
  }
17158
17144
  ctx.emit(EMITEVENTS.COLUMN_SORT, {
17159
17145
  column,
@@ -17161,6 +17147,7 @@ var Component$b = defineComponent({
17161
17147
  type
17162
17148
  });
17163
17149
  }).on(EVENTS$1.ON_FILTER_CLICK, (args) => {
17150
+ var _a, _b;
17164
17151
  const {
17165
17152
  filterFn,
17166
17153
  checked,
@@ -17170,6 +17157,7 @@ var Component$b = defineComponent({
17170
17157
  if (typeof filterFn === "function") {
17171
17158
  columnFilterFn = filterFn;
17172
17159
  resolvePageData(columnFilterFn, columnSortFn);
17160
+ (_b = (_a = refVirtualRender.value) == null ? void 0 : _a.reset) == null ? void 0 : _b.call(_a);
17173
17161
  }
17174
17162
  ctx.emit(EMITEVENTS.COLUMN_FILTER, {
17175
17163
  checked,
@@ -17256,9 +17244,12 @@ var Component$b = defineComponent({
17256
17244
  "with-virtual-render": props.virtualEnabled
17257
17245
  };
17258
17246
  const resizeColumnClass = {
17259
- [resolveClassName("drag-column")]: true,
17247
+ column_drag_line: true,
17260
17248
  "offset-x": true
17261
17249
  };
17250
+ const resizeColumnStyle = computed(() => __spreadProps(__spreadValues({}, dragOffsetXStyle.value), {
17251
+ left: `${dragOffsetX.value - reactiveSchema.scrollTranslateX}px`
17252
+ }));
17262
17253
  const loadingRowClass = {
17263
17254
  "scroll-loading": true,
17264
17255
  _bottom: true
@@ -17293,7 +17284,7 @@ var Component$b = defineComponent({
17293
17284
  "class": fixedWrapperClass
17294
17285
  }, [renderFixedColumns(), createVNode("div", {
17295
17286
  "class": resizeColumnClass,
17296
- "style": dragOffsetXStyle.value
17287
+ "style": resizeColumnStyle.value
17297
17288
  }, null), createVNode("div", {
17298
17289
  "class": loadingRowClass
17299
17290
  }, [renderScrollLoading()])]),
@@ -18496,7 +18487,7 @@ var TabNav = defineComponent({
18496
18487
  }, null)]);
18497
18488
  });
18498
18489
  const renderSlot = () => {
18499
- var _a, _b, _c, _d;
18490
+ var _a, _b;
18500
18491
  const list = [];
18501
18492
  if (typeof this.$slots.add === "function") {
18502
18493
  list.push((_b = (_a = this.$slots).add) == null ? void 0 : _b.call(_a, h$1));
@@ -18508,9 +18499,6 @@ var TabNav = defineComponent({
18508
18499
  "height": 26
18509
18500
  }, null)]));
18510
18501
  }
18511
- if (typeof this.$slots.setting === "function") {
18512
- list.push((_d = (_c = this.$slots).setting) == null ? void 0 : _d.call(_c, h$1));
18513
- }
18514
18502
  if (list.length) {
18515
18503
  return createVNode("div", {
18516
18504
  "class": "bk-tab-header-operation"
@@ -18528,7 +18516,9 @@ var TabNav = defineComponent({
18528
18516
  "class": "bk-tab-header"
18529
18517
  }, [createVNode("div", {
18530
18518
  "class": "bk-tab-header-nav"
18531
- }, [renderNavs()]), renderSlot()]);
18519
+ }, [renderNavs()]), renderSlot(), typeof this.$slots.setting === "function" && createVNode("div", {
18520
+ "class": "bk-tab-header-setting"
18521
+ }, [this.$slots.setting()])]);
18532
18522
  }
18533
18523
  });
18534
18524
  var Tab = defineComponent({
@@ -25140,7 +25130,11 @@ var FormItem = defineComponent({
25140
25130
  return Promise.resolve().then(() => {
25141
25131
  const result = rule.validator(value);
25142
25132
  if (typeof result !== "boolean" && typeof result.then === "function") {
25143
- return result.then(() => doValidate, () => {
25133
+ return result.then((data2) => {
25134
+ if (data2 === false) {
25135
+ return Promise.reject(rule.message);
25136
+ }
25137
+ }).then(() => doValidate(), () => {
25144
25138
  state.isError = true;
25145
25139
  state.errorMessage = rule.message;
25146
25140
  return Promise.reject(rule.message);