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

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() {
@@ -20451,7 +20476,7 @@ const useClass = (props2, targetColumns, root, reactiveProp, pageData) => {
20451
20476
  const resolveHeight = resolvePropHeight(props2.height, autoHeight.value);
20452
20477
  const resolveHeadHeight = getHeadHeight();
20453
20478
  const resolveMinHeight = resolvePropHeight(props2.minHeight, autoHeight.value);
20454
- const resolveFooterHeight = props2.pagination && props2.data.length ? props2.paginationHeihgt : 0;
20479
+ const resolveFooterHeight = props2.pagination && props2.data.length ? props2.paginationHeight : 0;
20455
20480
  const contentHeight = resolveHeight - resolveHeadHeight - resolveFooterHeight;
20456
20481
  const height = props2.height !== "auto" ? `${contentHeight}px` : false;
20457
20482
  const minHeight = resolveMinHeight - resolveHeadHeight - resolveFooterHeight;
@@ -21155,7 +21180,7 @@ var Component$f = defineComponent({
21155
21180
  display: "none"
21156
21181
  };
21157
21182
  const footerStyle = computed(() => ({
21158
- "--footer-height": hasFooter.value ? `${props2.paginationHeihgt}px` : "0"
21183
+ "--footer-height": hasFooter.value ? `${props2.paginationHeight}px` : "0"
21159
21184
  }));
21160
21185
  const fixedContainerStyle = computed(() => __spreadValues({
21161
21186
  right: hasScrollYRef.value ? `${SCROLLY_WIDTH}px` : 0
@@ -22353,6 +22378,17 @@ const tabNavEventProps = {
22353
22378
  default: () => ({})
22354
22379
  }
22355
22380
  };
22381
+ const tabPanelProps = {
22382
+ name: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).def(""),
22383
+ label: PropTypes.string || PropTypes.func,
22384
+ tips: PropTypes.string,
22385
+ closable: PropTypes.bool,
22386
+ visible: PropTypes.bool.def(true),
22387
+ disabled: PropTypes.bool,
22388
+ sortable: PropTypes.bool,
22389
+ renderDirective: renderDirectiveType(),
22390
+ panel: PropTypes.string || PropTypes.func
22391
+ };
22356
22392
  const tabProps = {
22357
22393
  active: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).def(""),
22358
22394
  type: j("type", {}).def("border-card"),
@@ -22391,18 +22427,11 @@ const tabNavProps = __spreadValues({
22391
22427
  changeOnHover: PropTypes.bool.def(false),
22392
22428
  changeOnHoverDelay: PropTypes.number.def(1e3)
22393
22429
  }, 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
22430
  var TabNav = defineComponent({
22405
22431
  name: "TabNav",
22432
+ directives: {
22433
+ bkTooltips: tooltips
22434
+ },
22406
22435
  props: tabNavProps,
22407
22436
  setup(props2) {
22408
22437
  const activeRef = ref(null);
@@ -22465,7 +22494,8 @@ var TabNav = defineComponent({
22465
22494
  closable,
22466
22495
  visible,
22467
22496
  disabled,
22468
- sortable
22497
+ sortable,
22498
+ tips
22469
22499
  } = item.props;
22470
22500
  if (!visible) {
22471
22501
  return false;
@@ -22494,6 +22524,7 @@ var TabNav = defineComponent({
22494
22524
  visible,
22495
22525
  disabled,
22496
22526
  sortable,
22527
+ tips,
22497
22528
  tabLabel: renderLabel(label)
22498
22529
  });
22499
22530
  return true;
@@ -22585,7 +22616,7 @@ var TabNav = defineComponent({
22585
22616
  return classNames.join(" ");
22586
22617
  };
22587
22618
  const getValue = (curentValue, parentValue) => !disabled && (curentValue || parentValue);
22588
- return createVNode("div", {
22619
+ return withDirectives(createVNode("div", {
22589
22620
  "key": name,
22590
22621
  "onClick": () => !disabled && this.handleTabChange(name),
22591
22622
  "draggable": getValue(item.sortable, sortable),
@@ -22613,7 +22644,10 @@ var TabNav = defineComponent({
22613
22644
  }, [createVNode("div", null, [tabLabel]), getValue(item.closable, closable) ? createVNode("span", {
22614
22645
  "class": resolveClassName("tab-header--close"),
22615
22646
  "onClick": () => this.handleTabRemove(index2, item)
22616
- }, [createVNode(close$1, null, null)]) : ""]);
22647
+ }, [createVNode(close$1, null, null)]) : ""]), [[resolveDirective("bk-tooltips"), {
22648
+ content: item.tips,
22649
+ disabled: !item.tips
22650
+ }]]);
22617
22651
  });
22618
22652
  const renderOperation = () => {
22619
22653
  var _a, _b;
@@ -22723,9 +22757,9 @@ var Tab = defineComponent({
22723
22757
  onMounted(() => {
22724
22758
  setPanelInstances();
22725
22759
  isMounted.value = true;
22726
- });
22727
- onUpdated(() => {
22728
- setPanelInstances();
22760
+ onUpdated(() => {
22761
+ setPanelInstances();
22762
+ });
22729
22763
  });
22730
22764
  const methods = {
22731
22765
  tabAdd(e) {