bkui-vue 0.0.1-beta.434 → 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
@@ -17269,6 +17269,8 @@ var EMIT_EVENTS = /* @__PURE__ */ ((EMIT_EVENTS2) => {
17269
17269
  EMIT_EVENTS2["ROW_CLICK"] = "rowClick";
17270
17270
  EMIT_EVENTS2["ROW_DBL_CLICK"] = "rowDblclick";
17271
17271
  EMIT_EVENTS2["ROW_EXPAND_CLICK"] = "rowExpand";
17272
+ EMIT_EVENTS2["ROW_MOUSE_ENTER"] = "rowMouseEnter";
17273
+ EMIT_EVENTS2["ROW_MOUSE_LEAVE"] = "rowMouseLeave";
17272
17274
  EMIT_EVENTS2["PAGE_LIMIT_CHANGE"] = "pageLimitChange";
17273
17275
  EMIT_EVENTS2["PAGE_VALUE_CHANGE"] = "pageValueChange";
17274
17276
  EMIT_EVENTS2["SETTING_CHANGE"] = "settingChange";
@@ -17350,6 +17352,9 @@ const overflowModeType = j("showOverflowTooltipMode", {
17350
17352
  const columnType = j("columnType", {
17351
17353
  default: "none"
17352
17354
  });
17355
+ const TableAlign = j("columnType", {
17356
+ default: ""
17357
+ });
17353
17358
  const fullType = j("full", {
17354
17359
  default: "full"
17355
17360
  });
@@ -17410,7 +17415,9 @@ const IColumnType = {
17410
17415
  PropTypes.string
17411
17416
  ]).def(false),
17412
17417
  colspan: PropTypes.oneOfType([PropTypes.func.def(() => 1), PropTypes.number.def(1)]),
17413
- 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])
17414
17421
  };
17415
17422
  const tableProps = {
17416
17423
  data: PropTypes.arrayOf(PropTypes.any).def([]),
@@ -17434,7 +17441,7 @@ const tableProps = {
17434
17441
  PropTypes.string
17435
17442
  ]).def([BORDER_OPTION.ROW]),
17436
17443
  pagination: PropTypes.oneOfType([PropTypes.bool.def(false), PropTypes.object.def({})]).def(false),
17437
- paginationHeihgt: PropTypes.number.def(LINE_HEIGHT),
17444
+ paginationHeight: PropTypes.number.def(60),
17438
17445
  remotePagination: PropTypes.bool.def(false),
17439
17446
  emptyText: PropTypes.string,
17440
17447
  settings: PropTypes.oneOfType([
@@ -17483,7 +17490,9 @@ const tableProps = {
17483
17490
  resizerWay: j("ResizerWay", {
17484
17491
  default: "debounce"
17485
17492
  }),
17486
- observerResize: PropTypes.bool.def(true)
17493
+ observerResize: PropTypes.bool.def(true),
17494
+ align: TableAlign,
17495
+ headerAlign: TableAlign
17487
17496
  };
17488
17497
  var Column = defineComponent({
17489
17498
  name: "TableColumn",
@@ -19067,6 +19076,14 @@ var TableRow = defineComponent({
19067
19076
  return createVNode(Fragment, null, [(_b = (_a = this.$slots).default) == null ? void 0 : _b.call(_a)]);
19068
19077
  }
19069
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
+ }
19070
19087
  var BodyEmpty = defineComponent({
19071
19088
  name: "BodyEmpty",
19072
19089
  props: {
@@ -19283,7 +19300,8 @@ var HeadSort = defineComponent({
19283
19300
  name: "HeadSort",
19284
19301
  props: {
19285
19302
  column: PropTypes.any.def({}),
19286
- defaultSort: PropTypes.oneOf(SORT_OPTIONS).def(SORT_OPTION.NULL)
19303
+ defaultSort: PropTypes.oneOf(SORT_OPTIONS).def(SORT_OPTION.NULL),
19304
+ active: PropTypes.bool
19287
19305
  },
19288
19306
  emits: ["change"],
19289
19307
  setup(props2, {
@@ -19296,6 +19314,7 @@ var HeadSort = defineComponent({
19296
19314
  sortType.value = val;
19297
19315
  });
19298
19316
  const handleSortClick = (e, type) => {
19317
+ var _a2;
19299
19318
  e.stopImmediatePropagation();
19300
19319
  e.stopPropagation();
19301
19320
  e.preventDefault();
@@ -19306,36 +19325,28 @@ var HeadSort = defineComponent({
19306
19325
  if (sortType.value === type) {
19307
19326
  currentSort = SORT_OPTION.NULL;
19308
19327
  }
19328
+ const execFn = getSortFn(props2.column, currentSort);
19309
19329
  const sort = resolveSort(props2.column.sort);
19310
19330
  if ((sort == null ? void 0 : sort.value) === "custom") {
19311
- emit("change", sort == null ? void 0 : sort.sortFn, currentSort);
19331
+ emit("change", (_a2 = sort == null ? void 0 : sort.sortFn) != null ? _a2 : execFn, currentSort);
19312
19332
  return;
19313
19333
  }
19314
- const execFn = getSortFn(props2.column, currentSort);
19315
19334
  emit("change", execFn, currentSort);
19316
19335
  };
19317
19336
  return () => createVNode("span", {
19318
19337
  "class": resolveClassName("head-cell-sort"),
19319
19338
  "onClick": (e) => handleSortClick(e, SORT_OPTION.NULL)
19320
19339
  }, [createVNode(angleDownFill, {
19321
- "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" : ""],
19322
19341
  "style": "align-items: flex-end;",
19323
19342
  "onClick": (e) => handleSortClick(e, SORT_OPTION.ASC)
19324
19343
  }, null), createVNode(angleUpFill, {
19325
- "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" : ""],
19326
19345
  "style": "align-items: flex-start;",
19327
19346
  "onClick": (e) => handleSortClick(e, SORT_OPTION.DESC)
19328
19347
  }, null)]);
19329
19348
  }
19330
19349
  });
19331
- class TablePlugins {
19332
- constructor(props2, ctx) {
19333
- __publicField(this, "props", null);
19334
- __publicField(this, "ctx", null);
19335
- this.props = props2;
19336
- this.ctx = ctx;
19337
- }
19338
- }
19339
19350
  function _isSlot$3(s2) {
19340
19351
  return typeof s2 === "function" || Object.prototype.toString.call(s2) === "[object Object]" && !isVNode(s2);
19341
19352
  }
@@ -19672,6 +19683,7 @@ class TableRender {
19672
19683
  this.events = /* @__PURE__ */ new Map();
19673
19684
  this.styleRef = styleRef;
19674
19685
  this.t = t2;
19686
+ this.activeSortIndex = ref(-1);
19675
19687
  }
19676
19688
  get propActiveCols() {
19677
19689
  return this.reactiveProp.activeColumns;
@@ -19797,6 +19809,7 @@ class TableRender {
19797
19809
  [columnName]: nextSort
19798
19810
  });
19799
19811
  const sortFn = getSortFn(column, nextSort);
19812
+ this.activeSortIndex.value = index2;
19800
19813
  this.emitEvent(EVENTS$1.ON_SORT_BY_CLICK, [{
19801
19814
  sortFn,
19802
19815
  column,
@@ -19811,6 +19824,7 @@ class TableRender {
19811
19824
  Object.assign(this.reactiveProp.defaultSort, {
19812
19825
  [columnName]: type
19813
19826
  });
19827
+ this.activeSortIndex.value = index2;
19814
19828
  this.emitEvent(EVENTS$1.ON_SORT_BY_CLICK, [{
19815
19829
  sortFn,
19816
19830
  column,
@@ -19822,6 +19836,7 @@ class TableRender {
19822
19836
  return createVNode(HeadSort, {
19823
19837
  "column": column,
19824
19838
  "defaultSort": nextSort,
19839
+ "active": this.activeSortIndex.value === index2,
19825
19840
  "onChange": handleSortClick
19826
19841
  }, null);
19827
19842
  }
@@ -19917,17 +19932,29 @@ class TableRender {
19917
19932
  }, null);
19918
19933
  }
19919
19934
  };
19920
- return createVNode("thead", {
19935
+ return createVNode(Fragment, null, [createVNode("thead", {
19921
19936
  "style": rowStyle
19922
19937
  }, [createVNode(TableRow, null, {
19923
- 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({
19924
19939
  "colspan": 1,
19925
19940
  "rowspan": 1,
19926
- "class": this.getHeadColumnClass(column, index2),
19941
+ "class": [this.getHeadColumnClass(column, index2), this.getColumnCustomClass(column), column.align || this.props.headerAlign || this.props.align],
19927
19942
  "style": resolveFixedColumnStyle(column, this.styleRef.value.hasScrollY),
19928
19943
  "onClick": () => this.handleColumnHeadClick(index2, column)
19929
19944
  }, resolveEventListener(column)), [renderHeadCell(column, index2)])), getScrollFix()])]
19930
- })]);
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 "";
19931
19958
  }
19932
19959
  renderTBody(rows) {
19933
19960
  const {
@@ -19947,8 +19974,10 @@ class TableRender {
19947
19974
  "style": rowStyle,
19948
19975
  "class": rowClass,
19949
19976
  "onClick": (e) => this.handleRowClick(e, row, rowIndex, rows),
19950
- "onDblclick": (e) => this.handleRowDblClick(e, row, rowIndex, rows)
19951
- }, [this.filterColgroups.map((column, index2) => {
19977
+ "onDblclick": (e) => this.handleRowDblClick(e, row, rowIndex, rows),
19978
+ "onMouseenter": (e) => this.handleRowEnter(e, row, rowIndex, rows),
19979
+ "onMouseleave": (e) => this.handleRowLeave(e, row, rowIndex, rows)
19980
+ }, [this.filterColGroups.map((column, index2) => {
19952
19981
  var _a, _b;
19953
19982
  const cellStyle = [resolveFixedColumnStyle(column), ...formatPropAsArray(this.props.cellStyle, [column, index2, row, rowIndex, this])];
19954
19983
  const tdCtxClass = {
@@ -19967,7 +19996,7 @@ class TableRender {
19967
19996
  } = (_b = (_a = row[skipRowKey]) == null ? void 0 : _a[columnIdKey]) != null ? _b : {};
19968
19997
  if (!skipRow && !skipCol) {
19969
19998
  let _slot;
19970
- 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]), {
19971
20000
  "expand-row": row[TABLE_ROW_ATTRIBUTE.ROW_EXPAND],
19972
20001
  "is-last": rowIndex + rowspan >= rowLength
19973
20002
  }];
@@ -20023,7 +20052,7 @@ class TableRender {
20023
20052
  return [createVNode("tr", {
20024
20053
  "class": resovledClass
20025
20054
  }, [createVNode("td", {
20026
- "colspan": this.filterColgroups.length,
20055
+ "colspan": this.filterColGroups.length,
20027
20056
  "rowspan": 1
20028
20057
  }, [(_c = (_b = (_a = this.context.slots).expandRow) == null ? void 0 : _b.call(_a, getRowSourceData(row))) != null ? _c : createVNode("div", {
20029
20058
  "class": "expand-cell-ctx"
@@ -20038,6 +20067,12 @@ class TableRender {
20038
20067
  handleRowDblClick(e, row, index2, rows) {
20039
20068
  this.context.emit(EMIT_EVENTS.ROW_DBL_CLICK, e, row, index2, rows, this);
20040
20069
  }
20070
+ handleRowEnter(e, row, index2, rows) {
20071
+ this.context.emit(EMIT_EVENTS.ROW_MOUSE_ENTER, e, row, index2, rows, this);
20072
+ }
20073
+ handleRowLeave(e, row, index2, rows) {
20074
+ this.context.emit(EMIT_EVENTS.ROW_MOUSE_LEAVE, e, row, index2, rows, this);
20075
+ }
20041
20076
  getExpandCell(row) {
20042
20077
  const isExpand = !!row[TABLE_ROW_ATTRIBUTE.ROW_EXPAND];
20043
20078
  return isExpand ? createVNode(downShape, null, null) : createVNode(rightShape, null, null);
@@ -20127,7 +20162,7 @@ class TableRender {
20127
20162
  return this.props.columnPick !== "disabled" && this.propActiveCols.some((col) => col.index === colIndex && col.active);
20128
20163
  }
20129
20164
  renderColGroup() {
20130
- return createVNode("colgroup", null, [(this.filterColgroups || []).map((column, index2) => {
20165
+ return createVNode("colgroup", null, [(this.filterColGroups || []).map((column, index2) => {
20131
20166
  const colCls = classes({
20132
20167
  active: this.isColActive(index2)
20133
20168
  });
@@ -20138,7 +20173,7 @@ class TableRender {
20138
20173
  }, null);
20139
20174
  })]);
20140
20175
  }
20141
- get filterColgroups() {
20176
+ get filterColGroups() {
20142
20177
  return this.colgroups.filter((col) => !col.isHidden);
20143
20178
  }
20144
20179
  get setting() {
@@ -20441,7 +20476,7 @@ const useClass = (props2, targetColumns, root, reactiveProp, pageData) => {
20441
20476
  const resolveHeight = resolvePropHeight(props2.height, autoHeight.value);
20442
20477
  const resolveHeadHeight = getHeadHeight();
20443
20478
  const resolveMinHeight = resolvePropHeight(props2.minHeight, autoHeight.value);
20444
- const resolveFooterHeight = props2.pagination && props2.data.length ? props2.paginationHeihgt : 0;
20479
+ const resolveFooterHeight = props2.pagination && props2.data.length ? props2.paginationHeight : 0;
20445
20480
  const contentHeight = resolveHeight - resolveHeadHeight - resolveFooterHeight;
20446
20481
  const height = props2.height !== "auto" ? `${contentHeight}px` : false;
20447
20482
  const minHeight = resolveMinHeight - resolveHeadHeight - resolveFooterHeight;
@@ -21145,7 +21180,7 @@ var Component$f = defineComponent({
21145
21180
  display: "none"
21146
21181
  };
21147
21182
  const footerStyle = computed(() => ({
21148
- "--footer-height": hasFooter.value ? `${props2.paginationHeihgt}px` : "0"
21183
+ "--footer-height": hasFooter.value ? `${props2.paginationHeight}px` : "0"
21149
21184
  }));
21150
21185
  const fixedContainerStyle = computed(() => __spreadValues({
21151
21186
  right: hasScrollYRef.value ? `${SCROLLY_WIDTH}px` : 0
@@ -22343,6 +22378,17 @@ const tabNavEventProps = {
22343
22378
  default: () => ({})
22344
22379
  }
22345
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
+ };
22346
22392
  const tabProps = {
22347
22393
  active: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).def(""),
22348
22394
  type: j("type", {}).def("border-card"),
@@ -22381,18 +22427,11 @@ const tabNavProps = __spreadValues({
22381
22427
  changeOnHover: PropTypes.bool.def(false),
22382
22428
  changeOnHoverDelay: PropTypes.number.def(1e3)
22383
22429
  }, tabNavEventProps);
22384
- const tabPanelProps = {
22385
- name: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).def(""),
22386
- label: PropTypes.string || PropTypes.func,
22387
- closable: PropTypes.bool,
22388
- visible: PropTypes.bool.def(true),
22389
- disabled: PropTypes.bool,
22390
- sortable: PropTypes.bool,
22391
- renderDirective: renderDirectiveType(),
22392
- panel: PropTypes.string || PropTypes.func
22393
- };
22394
22430
  var TabNav = defineComponent({
22395
22431
  name: "TabNav",
22432
+ directives: {
22433
+ bkTooltips: tooltips
22434
+ },
22396
22435
  props: tabNavProps,
22397
22436
  setup(props2) {
22398
22437
  const activeRef = ref(null);
@@ -22455,7 +22494,8 @@ var TabNav = defineComponent({
22455
22494
  closable,
22456
22495
  visible,
22457
22496
  disabled,
22458
- sortable
22497
+ sortable,
22498
+ tips
22459
22499
  } = item.props;
22460
22500
  if (!visible) {
22461
22501
  return false;
@@ -22484,6 +22524,7 @@ var TabNav = defineComponent({
22484
22524
  visible,
22485
22525
  disabled,
22486
22526
  sortable,
22527
+ tips,
22487
22528
  tabLabel: renderLabel(label)
22488
22529
  });
22489
22530
  return true;
@@ -22575,7 +22616,7 @@ var TabNav = defineComponent({
22575
22616
  return classNames.join(" ");
22576
22617
  };
22577
22618
  const getValue = (curentValue, parentValue) => !disabled && (curentValue || parentValue);
22578
- return createVNode("div", {
22619
+ return withDirectives(createVNode("div", {
22579
22620
  "key": name,
22580
22621
  "onClick": () => !disabled && this.handleTabChange(name),
22581
22622
  "draggable": getValue(item.sortable, sortable),
@@ -22603,7 +22644,10 @@ var TabNav = defineComponent({
22603
22644
  }, [createVNode("div", null, [tabLabel]), getValue(item.closable, closable) ? createVNode("span", {
22604
22645
  "class": resolveClassName("tab-header--close"),
22605
22646
  "onClick": () => this.handleTabRemove(index2, item)
22606
- }, [createVNode(close$1, null, null)]) : ""]);
22647
+ }, [createVNode(close$1, null, null)]) : ""]), [[resolveDirective("bk-tooltips"), {
22648
+ content: item.tips,
22649
+ disabled: !item.tips
22650
+ }]]);
22607
22651
  });
22608
22652
  const renderOperation = () => {
22609
22653
  var _a, _b;
@@ -22713,9 +22757,9 @@ var Tab = defineComponent({
22713
22757
  onMounted(() => {
22714
22758
  setPanelInstances();
22715
22759
  isMounted.value = true;
22716
- });
22717
- onUpdated(() => {
22718
- setPanelInstances();
22760
+ onUpdated(() => {
22761
+ setPanelInstances();
22762
+ });
22719
22763
  });
22720
22764
  const methods = {
22721
22765
  tabAdd(e) {
@@ -31387,7 +31431,7 @@ var FormItem = defineComponent({
31387
31431
  rules = props2.rules;
31388
31432
  }
31389
31433
  rules = getTriggerRules(trigger, mergeRules(rules, getRulesFromProps(props2, t2), t2));
31390
- if (rules.length > 0) {
31434
+ if (rules.length > 0 && showError) {
31391
31435
  state.isError = false;
31392
31436
  state.errorMessage = "";
31393
31437
  }
@@ -31397,7 +31441,7 @@ var FormItem = defineComponent({
31397
31441
  return () => {
31398
31442
  stepIndex = stepIndex + 1;
31399
31443
  if (stepIndex >= rules.length) {
31400
- form2.emit("validate", props2.property, true, null);
31444
+ form2.emit("validate", props2.property, true, "");
31401
31445
  return Promise.resolve(true);
31402
31446
  }
31403
31447
  const rule = rules[stepIndex];