bkui-vue 0.0.1-beta.83 → 0.0.1-beta.84

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
@@ -13482,7 +13482,7 @@ const tableProps = {
13482
13482
  PropTypes.bool,
13483
13483
  PropTypes.string
13484
13484
  ]).def(false)
13485
- })),
13485
+ })).def([]),
13486
13486
  activeColumn: PropTypes.oneOfType([PropTypes.number.def(-1), PropTypes.arrayOf(PropTypes.number.def(-1))]),
13487
13487
  columnPick: PropTypes.commonType(["multi", "single", "disabled"], "columnPick").def("disabled"),
13488
13488
  height: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).def("auto"),
@@ -14381,6 +14381,14 @@ class TableRender {
14381
14381
  }, [this.renderColGroup(), this.renderHeader()])];
14382
14382
  }
14383
14383
  renderTableBodySchema(rows) {
14384
+ var _a, _b, _c;
14385
+ if (!rows.length) {
14386
+ return (_c = (_b = (_a = this.context.slots).empty) == null ? void 0 : _b.call(_a)) != null ? _c : createVNode(BodyEmpty, {
14387
+ "filterList": rows,
14388
+ "list": this.props.data,
14389
+ "emptyText": this.props.emptyText
14390
+ }, null);
14391
+ }
14384
14392
  return createVNode("table", {
14385
14393
  "cellpadding": 0,
14386
14394
  "cellspacing": 0
@@ -14526,11 +14534,10 @@ class TableRender {
14526
14534
  }, [renderHeadCell(column, index)])]))])]);
14527
14535
  }
14528
14536
  renderTBody(rows) {
14529
- var _a, _b, _c;
14530
14537
  const {
14531
14538
  getFixedColumnStyleResolve
14532
14539
  } = useFixedColumn(this.props, this.colgroups);
14533
- return createVNode("tbody", null, [rows.length ? rows.map((row, rowIndex) => {
14540
+ return createVNode("tbody", null, [rows.map((row, rowIndex) => {
14534
14541
  const rowStyle = {
14535
14542
  "--row-height": `${this.getRowHeight(row, rowIndex)}px`
14536
14543
  };
@@ -14550,14 +14557,7 @@ class TableRender {
14550
14557
  }, [createVNode("div", {
14551
14558
  "class": "cell"
14552
14559
  }, [this.renderCell(row, column, rowIndex, rows)])]))]);
14553
- }) : createVNode("tr", null, [createVNode("td", {
14554
- "colspan": this.props.columns.length,
14555
- "class": "empty-cell"
14556
- }, [(_c = (_b = (_a = this.context.slots).empty) == null ? void 0 : _b.call(_a)) != null ? _c : createVNode(BodyEmpty, {
14557
- "filterList": rows,
14558
- "list": this.props.data,
14559
- "emptyText": this.props.emptyText
14560
- }, null)])])]);
14560
+ })]);
14561
14561
  }
14562
14562
  handleRowClick(e, row, index, rows) {
14563
14563
  this.context.emit("rowClick", e, row, index, rows, this);
@@ -14594,7 +14594,7 @@ class TableRender {
14594
14594
  return this.reactiveProp.setting;
14595
14595
  }
14596
14596
  }
14597
- const useClass = (props, root, reactiveProp) => {
14597
+ const useClass = (props, root, reactiveProp, pageData) => {
14598
14598
  const autoHeight = ref(200);
14599
14599
  const hasScrollY = ref(false);
14600
14600
  const hasFooter = computed(() => props.pagination && props.data.length);
@@ -14613,9 +14613,9 @@ const useClass = (props, root, reactiveProp) => {
14613
14613
  "--scroll-head-left": `-${reactiveProp.scrollTranslateX}px`,
14614
14614
  "--scroll-left": `${reactiveProp.scrollTranslateX}px`
14615
14615
  }));
14616
- const contentClass = classes({
14616
+ const contentClass = {
14617
14617
  [resolveClassName("table-body")]: true
14618
- });
14618
+ };
14619
14619
  const footerClass = computed(() => classes({
14620
14620
  [resolveClassName("table-footer")]: true,
14621
14621
  ["is-hidden"]: !props.pagination || !props.data.length
@@ -14649,7 +14649,7 @@ const useClass = (props, root, reactiveProp) => {
14649
14649
  const maxHeight = resolveMaxHeight - resolveHeadHeight - resolveFooterHeight;
14650
14650
  const minHeight = resolveMinHeight - resolveHeadHeight - resolveFooterHeight;
14651
14651
  Object.assign(contentStyle, {
14652
- display: "block",
14652
+ display: (pageData == null ? void 0 : pageData.length) ? "block" : false,
14653
14653
  "max-height": `${maxHeight}px`,
14654
14654
  "min-height": `${minHeight}px`,
14655
14655
  height
@@ -14689,7 +14689,8 @@ var Component$9 = defineComponent({
14689
14689
  props: tableProps,
14690
14690
  emits: EMIT_EVENT_TYPES,
14691
14691
  setup(props, ctx) {
14692
- const colgroups = reactive(props.columns.map((col) => __spreadProps(__spreadValues({}, col), {
14692
+ var _a;
14693
+ const colgroups = reactive(((_a = props.columns) != null ? _a : []).map((col) => __spreadProps(__spreadValues({}, col), {
14693
14694
  calcWidth: null,
14694
14695
  resizeWidth: null,
14695
14696
  listeners: /* @__PURE__ */ new Map()
@@ -14734,7 +14735,7 @@ var Component$9 = defineComponent({
14734
14735
  updateBorderClass,
14735
14736
  resetTableHeight,
14736
14737
  hasFooter
14737
- } = useClass(props, root, reactiveProp);
14738
+ } = useClass(props, root, reactiveProp, pageData);
14738
14739
  const {
14739
14740
  renderFixedColumns,
14740
14741
  fixedWrapperClass
@@ -14783,14 +14784,14 @@ var Component$9 = defineComponent({
14783
14784
  index
14784
14785
  });
14785
14786
  }).on(EVENTS$1.ON_SETTING_CHANGE, (args) => {
14786
- var _a, _b;
14787
+ var _a2, _b;
14787
14788
  const {
14788
14789
  checked = [],
14789
14790
  size,
14790
14791
  height
14791
14792
  } = args;
14792
14793
  checked.length && resolveColumnWidth(root.value, colgroups, 20);
14793
- (_b = (_a = refVirtualRender.value) == null ? void 0 : _a.reset) == null ? void 0 : _b.call(_a);
14794
+ (_b = (_a2 = refVirtualRender.value) == null ? void 0 : _a2.reset) == null ? void 0 : _b.call(_a2);
14794
14795
  ctx.emit(EMITEVENTS.SETTING_CHANGE, {
14795
14796
  checked,
14796
14797
  size,
@@ -14825,6 +14826,13 @@ var Component$9 = defineComponent({
14825
14826
  ctx.expose({
14826
14827
  plugins: tableRender.plugins
14827
14828
  });
14829
+ const tableBodyClass = __spreadProps(__spreadValues({}, contentClass), {
14830
+ "__is-empty": !pageData.length
14831
+ });
14832
+ const tableBodyContentClass = {
14833
+ [resolveClassName("table-body-content")]: true,
14834
+ "with-virtual-render": props.virtualEnabled
14835
+ };
14828
14836
  return () => createVNode("div", {
14829
14837
  "class": tableClass.value,
14830
14838
  "style": wrapperStyle.value,
@@ -14837,9 +14845,10 @@ var Component$9 = defineComponent({
14837
14845
  createVNode(BkVirtualRender, {
14838
14846
  "ref": refVirtualRender,
14839
14847
  "lineHeight": tableRender.getRowHeight,
14840
- "class": contentClass,
14848
+ "class": tableBodyClass,
14841
14849
  "style": contentStyle,
14842
14850
  "list": pageData,
14851
+ "contentClassName": tableBodyContentClass,
14843
14852
  "onContentScroll": handleScrollChanged,
14844
14853
  "throttleDelay": 0,
14845
14854
  "scrollEvent": true,
@@ -22349,7 +22358,19 @@ var useTreeInit = (props) => {
22349
22358
  }
22350
22359
  return uid || item[NODE_ATTRIBUTES.UUID] || uuid_1.v4();
22351
22360
  }
22361
+ const cachedDefaultVal = {
22362
+ [NODE_ATTRIBUTES.IS_OPEN]: () => false,
22363
+ [NODE_ATTRIBUTES.IS_CHECKED]: () => false,
22364
+ [NODE_ATTRIBUTES.IS_MATCH]: () => true,
22365
+ [NODE_ATTRIBUTES.IS_SELECTED]: (uuid2) => props2.selected === uuid2,
22366
+ [NODE_ATTRIBUTES.IS_CACHED]: () => false,
22367
+ [NODE_ATTRIBUTES.IS_ASYNC]: () => null
22368
+ };
22352
22369
  function getCachedTreeNodeAttr(uuid2, node, cachedAttr, defVal = void 0) {
22370
+ let defaultValue = defVal;
22371
+ if (defVal === void 0 && typeof cachedDefaultVal[cachedAttr] === "function") {
22372
+ defaultValue = cachedDefaultVal[cachedAttr](uuid2, node);
22373
+ }
22353
22374
  const sourceAttr = NODE_SOURCE_ATTRS[cachedAttr];
22354
22375
  if (Object.prototype.hasOwnProperty.call(node, sourceAttr)) {
22355
22376
  return node[sourceAttr];
@@ -22360,27 +22381,15 @@ var useTreeInit = (props) => {
22360
22381
  result = cached[cachedAttr];
22361
22382
  }
22362
22383
  if (result === void 0 || result === null) {
22363
- result = defVal;
22384
+ result = defaultValue;
22364
22385
  }
22365
22386
  return result;
22366
22387
  }
22367
- function isCachedTreeNodeOpened(uuid2, node) {
22368
- return getCachedTreeNodeAttr(uuid2, node, NODE_ATTRIBUTES.IS_OPEN, false);
22369
- }
22370
- function isCachedTreeNodeChecked(uuid2, node) {
22371
- return getCachedTreeNodeAttr(uuid2, node, NODE_ATTRIBUTES.IS_CHECKED, false);
22372
- }
22373
- function isCachedTreeNodeMatch(uuid2, node) {
22374
- return getCachedTreeNodeAttr(uuid2, node, NODE_ATTRIBUTES.IS_MATCH, true);
22375
- }
22376
22388
  function isCachedTreeNodeSelected(uuid2, node) {
22377
- return getCachedTreeNodeAttr(uuid2, node, NODE_ATTRIBUTES.IS_SELECTED, false);
22378
- }
22379
- function isCachedTreeNodeHasCached(uuid2, node) {
22380
- return getCachedTreeNodeAttr(uuid2, node, NODE_ATTRIBUTES.IS_CACHED, false);
22381
- }
22382
- function isCachedTreeNodeAsync(uuid2, node) {
22383
- return getCachedTreeNodeAttr(uuid2, node, NODE_ATTRIBUTES.IS_ASYNC, null);
22389
+ if (!props2.selectable) {
22390
+ return false;
22391
+ }
22392
+ return getCachedTreeNodeAttr(uuid2, node, NODE_ATTRIBUTES.IS_SELECTED, props2.selected === uuid2);
22384
22393
  }
22385
22394
  function isCachedTreeNodeLoading(uuid2, node) {
22386
22395
  if (Object.prototype.hasOwnProperty.call(node, NODE_ATTRIBUTES.IS_LOADING)) {
@@ -22411,12 +22420,12 @@ var useTreeInit = (props) => {
22411
22420
  [NODE_ATTRIBUTES.PATH]: currentPath,
22412
22421
  [NODE_ATTRIBUTES.IS_ROOT]: parent === null,
22413
22422
  [NODE_ATTRIBUTES.ORDER]: order2,
22414
- [NODE_ATTRIBUTES.IS_SELECTED]: props2.selectable ? isCachedTreeNodeSelected(uuid2, item) : false,
22415
- [NODE_ATTRIBUTES.IS_MATCH]: isCachedTreeNodeMatch(uuid2, item),
22416
- [NODE_ATTRIBUTES.IS_OPEN]: isCachedTreeNodeOpened(uuid2, item),
22417
- [NODE_ATTRIBUTES.IS_CHECKED]: isCachedTreeNodeChecked(uuid2, item),
22418
- [NODE_ATTRIBUTES.IS_CACHED]: isCachedTreeNodeHasCached(uuid2, item),
22419
- [NODE_ATTRIBUTES.IS_ASYNC]: isCachedTreeNodeAsync(uuid2, item),
22423
+ [NODE_ATTRIBUTES.IS_SELECTED]: isCachedTreeNodeSelected(uuid2, item),
22424
+ [NODE_ATTRIBUTES.IS_MATCH]: getCachedTreeNodeAttr(uuid2, item, NODE_ATTRIBUTES.IS_MATCH),
22425
+ [NODE_ATTRIBUTES.IS_OPEN]: getCachedTreeNodeAttr(uuid2, item, NODE_ATTRIBUTES.IS_OPEN),
22426
+ [NODE_ATTRIBUTES.IS_CHECKED]: getCachedTreeNodeAttr(uuid2, item, NODE_ATTRIBUTES.IS_CHECKED),
22427
+ [NODE_ATTRIBUTES.IS_CACHED]: getCachedTreeNodeAttr(uuid2, item, NODE_ATTRIBUTES.IS_CACHED),
22428
+ [NODE_ATTRIBUTES.IS_ASYNC]: getCachedTreeNodeAttr(uuid2, item, NODE_ATTRIBUTES.IS_ASYNC),
22420
22429
  [NODE_ATTRIBUTES.IS_LOADING]: isCachedTreeNodeLoading(uuid2, item),
22421
22430
  [children]: null
22422
22431
  };