bkui-vue 0.0.1-beta.435 → 0.0.1-beta.437

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
@@ -17352,6 +17352,9 @@ const overflowModeType = j("showOverflowTooltipMode", {
17352
17352
  const columnType = j("columnType", {
17353
17353
  default: "none"
17354
17354
  });
17355
+ const TableAlign = j("columnType", {
17356
+ default: ""
17357
+ });
17355
17358
  const fullType = j("full", {
17356
17359
  default: "full"
17357
17360
  });
@@ -17412,7 +17415,9 @@ const IColumnType = {
17412
17415
  PropTypes.string
17413
17416
  ]).def(false),
17414
17417
  colspan: PropTypes.oneOfType([PropTypes.func.def(() => 1), PropTypes.number.def(1)]),
17415
- rowspan: PropTypes.oneOfType([PropTypes.func.def(() => 1), PropTypes.number.def(1)])
17418
+ rowspan: PropTypes.oneOfType([PropTypes.func.def(() => 1), PropTypes.number.def(1)]),
17419
+ align: TableAlign,
17420
+ className: PropTypes.oneOfType([PropTypes.string, PropTypes.func])
17416
17421
  };
17417
17422
  const tableProps = {
17418
17423
  data: PropTypes.arrayOf(PropTypes.any).def([]),
@@ -17436,7 +17441,7 @@ const tableProps = {
17436
17441
  PropTypes.string
17437
17442
  ]).def([BORDER_OPTION.ROW]),
17438
17443
  pagination: PropTypes.oneOfType([PropTypes.bool.def(false), PropTypes.object.def({})]).def(false),
17439
- paginationHeihgt: PropTypes.number.def(LINE_HEIGHT),
17444
+ paginationHeight: PropTypes.number.def(60),
17440
17445
  remotePagination: PropTypes.bool.def(false),
17441
17446
  emptyText: PropTypes.string,
17442
17447
  settings: PropTypes.oneOfType([
@@ -17485,7 +17490,9 @@ const tableProps = {
17485
17490
  resizerWay: j("ResizerWay", {
17486
17491
  default: "debounce"
17487
17492
  }),
17488
- observerResize: PropTypes.bool.def(true)
17493
+ observerResize: PropTypes.bool.def(true),
17494
+ align: TableAlign,
17495
+ headerAlign: TableAlign
17489
17496
  };
17490
17497
  var Column = defineComponent({
17491
17498
  name: "TableColumn",
@@ -19069,6 +19076,14 @@ var TableRow = defineComponent({
19069
19076
  return createVNode(Fragment, null, [(_b = (_a = this.$slots).default) == null ? void 0 : _b.call(_a)]);
19070
19077
  }
19071
19078
  });
19079
+ class TablePlugins {
19080
+ constructor(props2, ctx) {
19081
+ __publicField(this, "props", null);
19082
+ __publicField(this, "ctx", null);
19083
+ this.props = props2;
19084
+ this.ctx = ctx;
19085
+ }
19086
+ }
19072
19087
  var BodyEmpty = defineComponent({
19073
19088
  name: "BodyEmpty",
19074
19089
  props: {
@@ -19285,7 +19300,8 @@ var HeadSort = defineComponent({
19285
19300
  name: "HeadSort",
19286
19301
  props: {
19287
19302
  column: PropTypes.any.def({}),
19288
- defaultSort: PropTypes.oneOf(SORT_OPTIONS).def(SORT_OPTION.NULL)
19303
+ defaultSort: PropTypes.oneOf(SORT_OPTIONS).def(SORT_OPTION.NULL),
19304
+ active: PropTypes.bool
19289
19305
  },
19290
19306
  emits: ["change"],
19291
19307
  setup(props2, {
@@ -19298,6 +19314,7 @@ var HeadSort = defineComponent({
19298
19314
  sortType.value = val;
19299
19315
  });
19300
19316
  const handleSortClick = (e, type) => {
19317
+ var _a2;
19301
19318
  e.stopImmediatePropagation();
19302
19319
  e.stopPropagation();
19303
19320
  e.preventDefault();
@@ -19308,36 +19325,28 @@ var HeadSort = defineComponent({
19308
19325
  if (sortType.value === type) {
19309
19326
  currentSort = SORT_OPTION.NULL;
19310
19327
  }
19328
+ const execFn = getSortFn(props2.column, currentSort);
19311
19329
  const sort = resolveSort(props2.column.sort);
19312
19330
  if ((sort == null ? void 0 : sort.value) === "custom") {
19313
- emit("change", sort == null ? void 0 : sort.sortFn, currentSort);
19331
+ emit("change", (_a2 = sort == null ? void 0 : sort.sortFn) != null ? _a2 : execFn, currentSort);
19314
19332
  return;
19315
19333
  }
19316
- const execFn = getSortFn(props2.column, currentSort);
19317
19334
  emit("change", execFn, currentSort);
19318
19335
  };
19319
19336
  return () => createVNode("span", {
19320
19337
  "class": resolveClassName("head-cell-sort"),
19321
19338
  "onClick": (e) => handleSortClick(e, SORT_OPTION.NULL)
19322
19339
  }, [createVNode(angleDownFill, {
19323
- "class": ["sort-action", "sort-asc", sortType.value === SORT_OPTION.ASC ? "active" : ""],
19340
+ "class": ["sort-action", "sort-asc", props2.active && sortType.value === SORT_OPTION.ASC ? "active" : ""],
19324
19341
  "style": "align-items: flex-end;",
19325
19342
  "onClick": (e) => handleSortClick(e, SORT_OPTION.ASC)
19326
19343
  }, null), createVNode(angleUpFill, {
19327
- "class": ["sort-action", "sort-desc", sortType.value === SORT_OPTION.DESC ? "active" : ""],
19344
+ "class": ["sort-action", "sort-desc", props2.active && sortType.value === SORT_OPTION.DESC ? "active" : ""],
19328
19345
  "style": "align-items: flex-start;",
19329
19346
  "onClick": (e) => handleSortClick(e, SORT_OPTION.DESC)
19330
19347
  }, null)]);
19331
19348
  }
19332
19349
  });
19333
- class TablePlugins {
19334
- constructor(props2, ctx) {
19335
- __publicField(this, "props", null);
19336
- __publicField(this, "ctx", null);
19337
- this.props = props2;
19338
- this.ctx = ctx;
19339
- }
19340
- }
19341
19350
  function _isSlot$3(s2) {
19342
19351
  return typeof s2 === "function" || Object.prototype.toString.call(s2) === "[object Object]" && !isVNode(s2);
19343
19352
  }
@@ -19674,6 +19683,7 @@ class TableRender {
19674
19683
  this.events = /* @__PURE__ */ new Map();
19675
19684
  this.styleRef = styleRef;
19676
19685
  this.t = t2;
19686
+ this.activeSortIndex = ref(-1);
19677
19687
  }
19678
19688
  get propActiveCols() {
19679
19689
  return this.reactiveProp.activeColumns;
@@ -19799,6 +19809,7 @@ class TableRender {
19799
19809
  [columnName]: nextSort
19800
19810
  });
19801
19811
  const sortFn = getSortFn(column, nextSort);
19812
+ this.activeSortIndex.value = index2;
19802
19813
  this.emitEvent(EVENTS$1.ON_SORT_BY_CLICK, [{
19803
19814
  sortFn,
19804
19815
  column,
@@ -19813,6 +19824,7 @@ class TableRender {
19813
19824
  Object.assign(this.reactiveProp.defaultSort, {
19814
19825
  [columnName]: type
19815
19826
  });
19827
+ this.activeSortIndex.value = index2;
19816
19828
  this.emitEvent(EVENTS$1.ON_SORT_BY_CLICK, [{
19817
19829
  sortFn,
19818
19830
  column,
@@ -19824,6 +19836,7 @@ class TableRender {
19824
19836
  return createVNode(HeadSort, {
19825
19837
  "column": column,
19826
19838
  "defaultSort": nextSort,
19839
+ "active": this.activeSortIndex.value === index2,
19827
19840
  "onChange": handleSortClick
19828
19841
  }, null);
19829
19842
  }
@@ -19919,17 +19932,29 @@ class TableRender {
19919
19932
  }, null);
19920
19933
  }
19921
19934
  };
19922
- return createVNode("thead", {
19935
+ return createVNode(Fragment, null, [createVNode("thead", {
19923
19936
  "style": rowStyle
19924
19937
  }, [createVNode(TableRow, null, {
19925
- default: () => [createVNode("tr", null, [this.filterColgroups.map((column, index2) => createVNode("th", mergeProps({
19938
+ default: () => [createVNode("tr", null, [this.filterColGroups.map((column, index2) => createVNode("th", mergeProps({
19926
19939
  "colspan": 1,
19927
19940
  "rowspan": 1,
19928
- "class": this.getHeadColumnClass(column, index2),
19941
+ "class": [this.getHeadColumnClass(column, index2), this.getColumnCustomClass(column), column.align || this.props.headerAlign || this.props.align],
19929
19942
  "style": resolveFixedColumnStyle(column, this.styleRef.value.hasScrollY),
19930
19943
  "onClick": () => this.handleColumnHeadClick(index2, column)
19931
19944
  }, resolveEventListener(column)), [renderHeadCell(column, index2)])), getScrollFix()])]
19932
- })]);
19945
+ })])]);
19946
+ }
19947
+ getColumnCustomClass(column, row) {
19948
+ const rowClass = column.className;
19949
+ if (rowClass) {
19950
+ if (typeof rowClass === "function") {
19951
+ return rowClass(row);
19952
+ }
19953
+ if (typeof rowClass === "string") {
19954
+ return rowClass;
19955
+ }
19956
+ }
19957
+ return "";
19933
19958
  }
19934
19959
  renderTBody(rows) {
19935
19960
  const {
@@ -19952,7 +19977,7 @@ class TableRender {
19952
19977
  "onDblclick": (e) => this.handleRowDblClick(e, row, rowIndex, rows),
19953
19978
  "onMouseenter": (e) => this.handleRowEnter(e, row, rowIndex, rows),
19954
19979
  "onMouseleave": (e) => this.handleRowLeave(e, row, rowIndex, rows)
19955
- }, [this.filterColgroups.map((column, index2) => {
19980
+ }, [this.filterColGroups.map((column, index2) => {
19956
19981
  var _a, _b;
19957
19982
  const cellStyle = [resolveFixedColumnStyle(column), ...formatPropAsArray(this.props.cellStyle, [column, index2, row, rowIndex, this])];
19958
19983
  const tdCtxClass = {
@@ -19971,7 +19996,7 @@ class TableRender {
19971
19996
  } = (_b = (_a = row[skipRowKey]) == null ? void 0 : _a[columnIdKey]) != null ? _b : {};
19972
19997
  if (!skipRow && !skipCol) {
19973
19998
  let _slot;
19974
- const cellClass = [this.getColumnClass(column, index2), ...formatPropAsArray(this.props.cellClass, [column, index2, row, rowIndex, this]), {
19999
+ const cellClass = [this.getColumnClass(column, index2), this.getColumnCustomClass(column, row), column.align || this.props.align, ...formatPropAsArray(this.props.cellClass, [column, index2, row, rowIndex, this]), {
19975
20000
  "expand-row": row[TABLE_ROW_ATTRIBUTE.ROW_EXPAND],
19976
20001
  "is-last": rowIndex + rowspan >= rowLength
19977
20002
  }];
@@ -20027,7 +20052,7 @@ class TableRender {
20027
20052
  return [createVNode("tr", {
20028
20053
  "class": resovledClass
20029
20054
  }, [createVNode("td", {
20030
- "colspan": this.filterColgroups.length,
20055
+ "colspan": this.filterColGroups.length,
20031
20056
  "rowspan": 1
20032
20057
  }, [(_c = (_b = (_a = this.context.slots).expandRow) == null ? void 0 : _b.call(_a, getRowSourceData(row))) != null ? _c : createVNode("div", {
20033
20058
  "class": "expand-cell-ctx"
@@ -20137,7 +20162,7 @@ class TableRender {
20137
20162
  return this.props.columnPick !== "disabled" && this.propActiveCols.some((col) => col.index === colIndex && col.active);
20138
20163
  }
20139
20164
  renderColGroup() {
20140
- return createVNode("colgroup", null, [(this.filterColgroups || []).map((column, index2) => {
20165
+ return createVNode("colgroup", null, [(this.filterColGroups || []).map((column, index2) => {
20141
20166
  const colCls = classes({
20142
20167
  active: this.isColActive(index2)
20143
20168
  });
@@ -20148,7 +20173,7 @@ class TableRender {
20148
20173
  }, null);
20149
20174
  })]);
20150
20175
  }
20151
- get filterColgroups() {
20176
+ get filterColGroups() {
20152
20177
  return this.colgroups.filter((col) => !col.isHidden);
20153
20178
  }
20154
20179
  get setting() {
@@ -20413,6 +20438,15 @@ const useClass = (props2, targetColumns, root, reactiveProp, pageData) => {
20413
20438
  [resolveClassName("table-footer")]: true,
20414
20439
  ["is-hidden"]: !props2.pagination || !props2.data.length
20415
20440
  }));
20441
+ const getTableHeight = () => {
20442
+ if (props2.height === "number") {
20443
+ return `${props2.height}px`;
20444
+ }
20445
+ if (typeof props2.height === "string") {
20446
+ return props2.height;
20447
+ }
20448
+ return "";
20449
+ };
20416
20450
  const resolveWidth2 = () => {
20417
20451
  if (resolvedColumns.value.every((col) => /^\d+\.?\d*(px)?$/ig.test(`${col.width}`))) {
20418
20452
  const rectWidth = resolvedColumns.value.reduce((width, col) => width + Number(`${col.width}`.replace(/px/ig, "")), 0);
@@ -20421,11 +20455,12 @@ const useClass = (props2, targetColumns, root, reactiveProp, pageData) => {
20421
20455
  }
20422
20456
  return "100%";
20423
20457
  };
20424
- const wrapperStyle = computed(() => __spreadValues({
20458
+ const wrapperStyle = computed(() => ({
20425
20459
  minHeight: resolveNumberOrStringToPix(props2.minHeight, "auto"),
20426
20460
  width: resolveWidth2(),
20427
- maxWidth: "100%"
20428
- }, typeof props2.height === "number" ? { height: `${props2.height}px` } : null));
20461
+ maxWidth: "100%",
20462
+ height: getTableHeight()
20463
+ }));
20429
20464
  const resolvePropHeight = (height, defaultValue) => {
20430
20465
  const strHeight = String(height);
20431
20466
  if (/^\d+\.?\d*$/.test(strHeight)) {
@@ -20451,7 +20486,7 @@ const useClass = (props2, targetColumns, root, reactiveProp, pageData) => {
20451
20486
  const resolveHeight = resolvePropHeight(props2.height, autoHeight.value);
20452
20487
  const resolveHeadHeight = getHeadHeight();
20453
20488
  const resolveMinHeight = resolvePropHeight(props2.minHeight, autoHeight.value);
20454
- const resolveFooterHeight = props2.pagination && props2.data.length ? props2.paginationHeihgt : 0;
20489
+ const resolveFooterHeight = props2.pagination && props2.data.length ? props2.paginationHeight : 0;
20455
20490
  const contentHeight = resolveHeight - resolveHeadHeight - resolveFooterHeight;
20456
20491
  const height = props2.height !== "auto" ? `${contentHeight}px` : false;
20457
20492
  const minHeight = resolveMinHeight - resolveHeadHeight - resolveFooterHeight;
@@ -20480,7 +20515,7 @@ const useClass = (props2, targetColumns, root, reactiveProp, pageData) => {
20480
20515
  return;
20481
20516
  }
20482
20517
  const querySelector = props2.virtualEnabled ? `.${resolveClassName("virtual-section")}` : `.${resolveClassName("table-body-content")}`;
20483
- const rootBody = root2.querySelector(".bk-table-body");
20518
+ const rootBody = root2.querySelector(`.${resolveClassName("table-body")}`);
20484
20519
  hasScrollY.value = hasRootScrollY(rootBody, querySelector, 0);
20485
20520
  };
20486
20521
  const getColumnsWidthOffsetWidth = () => {
@@ -21155,7 +21190,7 @@ var Component$f = defineComponent({
21155
21190
  display: "none"
21156
21191
  };
21157
21192
  const footerStyle = computed(() => ({
21158
- "--footer-height": hasFooter.value ? `${props2.paginationHeihgt}px` : "0"
21193
+ "--footer-height": hasFooter.value ? `${props2.paginationHeight}px` : "0"
21159
21194
  }));
21160
21195
  const fixedContainerStyle = computed(() => __spreadValues({
21161
21196
  right: hasScrollYRef.value ? `${SCROLLY_WIDTH}px` : 0
@@ -22353,6 +22388,17 @@ const tabNavEventProps = {
22353
22388
  default: () => ({})
22354
22389
  }
22355
22390
  };
22391
+ const tabPanelProps = {
22392
+ name: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).def(""),
22393
+ label: PropTypes.string || PropTypes.func,
22394
+ tips: PropTypes.string,
22395
+ closable: PropTypes.bool,
22396
+ visible: PropTypes.bool.def(true),
22397
+ disabled: PropTypes.bool,
22398
+ sortable: PropTypes.bool,
22399
+ renderDirective: renderDirectiveType(),
22400
+ panel: PropTypes.string || PropTypes.func
22401
+ };
22356
22402
  const tabProps = {
22357
22403
  active: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).def(""),
22358
22404
  type: j("type", {}).def("border-card"),
@@ -22391,18 +22437,11 @@ const tabNavProps = __spreadValues({
22391
22437
  changeOnHover: PropTypes.bool.def(false),
22392
22438
  changeOnHoverDelay: PropTypes.number.def(1e3)
22393
22439
  }, tabNavEventProps);
22394
- const tabPanelProps = {
22395
- name: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).def(""),
22396
- label: PropTypes.string || PropTypes.func,
22397
- closable: PropTypes.bool,
22398
- visible: PropTypes.bool.def(true),
22399
- disabled: PropTypes.bool,
22400
- sortable: PropTypes.bool,
22401
- renderDirective: renderDirectiveType(),
22402
- panel: PropTypes.string || PropTypes.func
22403
- };
22404
22440
  var TabNav = defineComponent({
22405
22441
  name: "TabNav",
22442
+ directives: {
22443
+ bkTooltips: tooltips
22444
+ },
22406
22445
  props: tabNavProps,
22407
22446
  setup(props2) {
22408
22447
  const activeRef = ref(null);
@@ -22465,7 +22504,8 @@ var TabNav = defineComponent({
22465
22504
  closable,
22466
22505
  visible,
22467
22506
  disabled,
22468
- sortable
22507
+ sortable,
22508
+ tips
22469
22509
  } = item.props;
22470
22510
  if (!visible) {
22471
22511
  return false;
@@ -22494,6 +22534,7 @@ var TabNav = defineComponent({
22494
22534
  visible,
22495
22535
  disabled,
22496
22536
  sortable,
22537
+ tips,
22497
22538
  tabLabel: renderLabel(label)
22498
22539
  });
22499
22540
  return true;
@@ -22585,7 +22626,7 @@ var TabNav = defineComponent({
22585
22626
  return classNames.join(" ");
22586
22627
  };
22587
22628
  const getValue = (curentValue, parentValue) => !disabled && (curentValue || parentValue);
22588
- return createVNode("div", {
22629
+ return withDirectives(createVNode("div", {
22589
22630
  "key": name,
22590
22631
  "onClick": () => !disabled && this.handleTabChange(name),
22591
22632
  "draggable": getValue(item.sortable, sortable),
@@ -22613,7 +22654,10 @@ var TabNav = defineComponent({
22613
22654
  }, [createVNode("div", null, [tabLabel]), getValue(item.closable, closable) ? createVNode("span", {
22614
22655
  "class": resolveClassName("tab-header--close"),
22615
22656
  "onClick": () => this.handleTabRemove(index2, item)
22616
- }, [createVNode(close$1, null, null)]) : ""]);
22657
+ }, [createVNode(close$1, null, null)]) : ""]), [[resolveDirective("bk-tooltips"), {
22658
+ content: item.tips,
22659
+ disabled: !item.tips
22660
+ }]]);
22617
22661
  });
22618
22662
  const renderOperation = () => {
22619
22663
  var _a, _b;
@@ -22723,9 +22767,9 @@ var Tab = defineComponent({
22723
22767
  onMounted(() => {
22724
22768
  setPanelInstances();
22725
22769
  isMounted.value = true;
22726
- });
22727
- onUpdated(() => {
22728
- setPanelInstances();
22770
+ onUpdated(() => {
22771
+ setPanelInstances();
22772
+ });
22729
22773
  });
22730
22774
  const methods = {
22731
22775
  tabAdd(e) {