bkui-vue 0.0.1-beta.413 → 0.0.1-beta.415

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
@@ -55,7 +55,6 @@ var loading = "";
55
55
  var modal = "";
56
56
  var progress = "";
57
57
  var radio = "";
58
- var radioButton = "";
59
58
  var rate = "";
60
59
  var star$1 = "";
61
60
  var swiper = "";
@@ -7404,7 +7403,7 @@ class BkMaskManager {
7404
7403
  this.zIndexStore = /* @__PURE__ */ new Map();
7405
7404
  this.lastUUID = null;
7406
7405
  this.maskStyle = {
7407
- position: "absolute",
7406
+ position: "fixed",
7408
7407
  left: 0,
7409
7408
  top: 0,
7410
7409
  bottom: 0,
@@ -11254,6 +11253,7 @@ const PopoverProps = __spreadValues({
11254
11253
  height: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).def("auto"),
11255
11254
  maxHeight: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).def("auto"),
11256
11255
  content: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).def(""),
11256
+ allowHTML: PropTypes.bool.def(false),
11257
11257
  placement: PropTypes.oneOfType([placementType().def(PlacementEnum.TOP), PropTypes.string]).def(PlacementEnum.TOP),
11258
11258
  theme: PropTypes.string.def("dark"),
11259
11259
  trigger: PropTypes.oneOfType([triggerType(), PropTypes.string]).def("hover"),
@@ -13208,6 +13208,14 @@ var Component$q = defineComponent({
13208
13208
  }
13209
13209
  return localIsShow.value;
13210
13210
  });
13211
+ const renderContent2 = () => {
13212
+ if (props2.allowHTML) {
13213
+ return h$1("div", {
13214
+ innerHTML: props2.content
13215
+ });
13216
+ }
13217
+ return content;
13218
+ };
13211
13219
  return {
13212
13220
  boundary,
13213
13221
  arrow: props2.arrow,
@@ -13222,7 +13230,8 @@ var Component$q = defineComponent({
13222
13230
  hide: hide2,
13223
13231
  show: show2,
13224
13232
  stopHide,
13225
- contentIsShow
13233
+ contentIsShow,
13234
+ renderContent: renderContent2
13226
13235
  };
13227
13236
  },
13228
13237
  render() {
@@ -13249,7 +13258,7 @@ var Component$q = defineComponent({
13249
13258
  }, {
13250
13259
  default: () => {
13251
13260
  var _a, _b, _c;
13252
- return [this.contentIsShow ? (_c = (_b = (_a = this.$slots).content) == null ? void 0 : _b.call(_a)) != null ? _c : this.content : ""];
13261
+ return [this.contentIsShow ? (_c = (_b = (_a = this.$slots).content) == null ? void 0 : _b.call(_a)) != null ? _c : this.renderContent() : ""];
13253
13262
  },
13254
13263
  arrow: () => this.arrow ? createVNode(Arrow, {
13255
13264
  "ref": "refArrow"
@@ -13815,7 +13824,7 @@ var RadioButton = defineComponent({
13815
13824
  },
13816
13825
  render() {
13817
13826
  const radioClass = classes({
13818
- "bk-radio-item": true,
13827
+ "bk-radio-button": true,
13819
13828
  "is-focused": this.isFocused,
13820
13829
  "is-disabled": this.isDisabled,
13821
13830
  "is-checked": this.isChecked
@@ -13825,14 +13834,14 @@ var RadioButton = defineComponent({
13825
13834
  return null;
13826
13835
  }
13827
13836
  return createVNode("div", {
13828
- "class": "bk-radio-item-label"
13837
+ "class": "bk-radio-button-label"
13829
13838
  }, [this.$slots.default ? this.$slots.default() : this.label]);
13830
13839
  };
13831
13840
  return createVNode("label", {
13832
13841
  "class": radioClass,
13833
13842
  "tabindex": "0"
13834
13843
  }, [createVNode("input", {
13835
- "class": "bk-radio-item-input",
13844
+ "class": "bk-radio-button-input",
13836
13845
  "type": "radio",
13837
13846
  "tabindex": "0",
13838
13847
  "value": this.label,
@@ -13849,7 +13858,7 @@ const radioGroupProps = {
13849
13858
  modelValue: PropTypes.oneOfType([String, Number, Boolean]),
13850
13859
  disabled: PropTypes.bool,
13851
13860
  withValidate: PropTypes.bool.def(true),
13852
- type: PropTypes.oneOf(["button", "capsule"]).def("button")
13861
+ type: PropTypes.oneOf(["tab", "capsule"]).def("tab")
13853
13862
  };
13854
13863
  var RadioGroup = defineComponent({
13855
13864
  name: "RadioGroup",
@@ -15040,6 +15049,7 @@ const createInstance = (el, binding) => {
15040
15049
  const targetOptions = resolveOptions(el, binding);
15041
15050
  targetOptions.isShow = true;
15042
15051
  targetOptions.content = targetOptions.content || el.innerHTML;
15052
+ targetOptions.allowHTML = true;
15043
15053
  Object.assign(targetOptions, {
15044
15054
  onContentMouseenter: handleContentEnter,
15045
15055
  onContentMouseleave: handleContentLeave
@@ -16971,27 +16981,48 @@ var Column = defineComponent({
16971
16981
  props: __spreadProps(__spreadValues({}, IColumnType), {
16972
16982
  prop: PropTypes.oneOfType([PropTypes.func.def(() => ""), PropTypes.string.def("")])
16973
16983
  }),
16974
- setup(props2, {
16975
- slots
16976
- }) {
16977
- const initColumns = inject(PROVIDE_KEY_INIT_COL, (_column) => {
16984
+ setup(props2) {
16985
+ const initColumns = inject(PROVIDE_KEY_INIT_COL, (_column, _remove = false) => {
16978
16986
  }, false);
16979
- onBeforeMount(() => {
16980
- const column = reactive(__spreadProps(__spreadValues({}, props2), {
16981
- field: props2.prop || props2.field
16982
- }));
16983
- initColumns(column);
16984
- column.render = slots.default ? (args) => {
16985
- var _a;
16986
- return (_a = slots.default) == null ? void 0 : _a.call(slots, args);
16987
- } : void 0;
16987
+ const column = reactive(__spreadProps(__spreadValues({}, props2), {
16988
+ field: props2.prop || props2.field
16989
+ }));
16990
+ onUnmounted(() => {
16991
+ initColumns(column, true);
16988
16992
  });
16989
- return () => {
16990
- var _a;
16991
- return createVNode(Fragment, null, [(_a = slots.default) == null ? void 0 : _a.call(slots, {
16992
- row: {}
16993
- })]);
16993
+ return {
16994
+ initColumns,
16995
+ column
16994
16996
  };
16997
+ },
16998
+ mounted() {
16999
+ const selfVnode = this._;
17000
+ const colList = selfVnode.parent.vnode.children.default() || [];
17001
+ const sortColumns = [];
17002
+ const reduceColumns = (nodes) => {
17003
+ this.column.render = this.$slots.default ? (args) => {
17004
+ var _a, _b;
17005
+ return (_b = (_a = this.$slots).default) == null ? void 0 : _b.call(_a, args);
17006
+ } : void 0;
17007
+ nodes.forEach((node) => {
17008
+ var _a, _b;
17009
+ if (((_a = node.type) == null ? void 0 : _a.name) === "TableColumn") {
17010
+ const resolveProp = __spreadProps(__spreadValues({}, node.props), {
17011
+ field: node.props.prop || node.props.field
17012
+ });
17013
+ if (resolveProp.label === this.column.label && resolveProp.field === this.column.field) {
17014
+ sortColumns.push(unref(this.column));
17015
+ } else {
17016
+ sortColumns.push(unref(resolveProp));
17017
+ }
17018
+ }
17019
+ if (Object.hasOwnProperty.call(node.props || {}, "key") && ((_b = node.children) == null ? void 0 : _b.length)) {
17020
+ reduceColumns(node.children);
17021
+ }
17022
+ });
17023
+ };
17024
+ reduceColumns(colList);
17025
+ this.initColumns(sortColumns);
16995
17026
  }
16996
17027
  });
16997
17028
  const resolvePaginationOption = (propPagination, defVal) => {
@@ -19549,20 +19580,34 @@ class TableRender {
19549
19580
  }
19550
19581
  }
19551
19582
  var useColumn = (props2, targetColumns) => {
19552
- const initColumns = (column) => {
19583
+ const initColumns = (column, remove = false) => {
19553
19584
  let resolveColumns = [];
19554
19585
  if (!Array.isArray(column)) {
19555
19586
  resolveColumns = [column];
19556
19587
  } else {
19557
19588
  resolveColumns = column;
19558
19589
  }
19559
- resolveColumns.forEach((col) => {
19560
- const matchCol = targetColumns.find((c2) => c2.label === col.label && c2.field === col.field);
19561
- if (!matchCol) {
19562
- const unrefCol = unref(col);
19563
- targetColumns.push(unrefCol);
19564
- }
19565
- });
19590
+ if (!remove) {
19591
+ const resetColumns = resolveColumns.map((col) => {
19592
+ const exist = targetColumns.find((tc) => tc.label === col.label && tc.field === col.field);
19593
+ if (exist) {
19594
+ return exist;
19595
+ }
19596
+ return unref(col);
19597
+ });
19598
+ targetColumns.length = 0;
19599
+ targetColumns.push(...resetColumns);
19600
+ } else {
19601
+ resolveColumns.forEach((col) => {
19602
+ const matchColIndex = targetColumns.findIndex((c2) => c2.label === col.label && c2.field === col.field);
19603
+ if (remove) {
19604
+ if (matchColIndex >= 0) {
19605
+ targetColumns.splice(matchColIndex, 1);
19606
+ }
19607
+ return;
19608
+ }
19609
+ });
19610
+ }
19566
19611
  };
19567
19612
  const getColumns = () => {
19568
19613
  var _a;
@@ -19766,6 +19811,7 @@ const useClass = (props2, targetColumns, root, reactiveProp, pageData) => {
19766
19811
  [resolveClassName("table-head")]: true,
19767
19812
  "has-settings": !!props2.settings
19768
19813
  });
19814
+ const resolvedColumns = computed(() => getColumns());
19769
19815
  const config = resolveHeadConfig(props2);
19770
19816
  const headStyle = computed(() => ({
19771
19817
  "--row-height": `${resolvePropVal(config, "height", ["thead"])}px`,
@@ -19780,9 +19826,8 @@ const useClass = (props2, targetColumns, root, reactiveProp, pageData) => {
19780
19826
  ["is-hidden"]: !props2.pagination || !props2.data.length
19781
19827
  }));
19782
19828
  const resolveWidth2 = () => {
19783
- const columns = getColumns();
19784
- if (columns.every((col) => /^\d+\.?\d*(px)?$/ig.test(`${col.width}`))) {
19785
- const rectWidth = columns.reduce((width, col) => width + Number(`${col.width}`.replace(/px/ig, "")), 0);
19829
+ if (resolvedColumns.value.every((col) => /^\d+\.?\d*(px)?$/ig.test(`${col.width}`))) {
19830
+ const rectWidth = resolvedColumns.value.reduce((width, col) => width + Number(`${col.width}`.replace(/px/ig, "")), 0);
19786
19831
  const offset2 = hasScrollY.value ? SCROLLY_WIDTH : 0;
19787
19832
  return `${rectWidth + offset2}px`;
19788
19833
  }
@@ -19893,12 +19938,13 @@ const useInit = (props2, targetColumns) => {
19893
19938
  }
19894
19939
  return minWidth;
19895
19940
  };
19941
+ const resolvedColumns = computed(() => getColumns());
19896
19942
  const updateColGroups = (settings) => {
19897
19943
  var _a2, _b2;
19898
19944
  const checked = (settings == null ? void 0 : settings.checked) || ((_a2 = props2.settings) == null ? void 0 : _a2.checked) || [];
19899
19945
  const settingFields = (settings == null ? void 0 : settings.fields) || ((_b2 = props2.settings) == null ? void 0 : _b2.fields) || [];
19900
19946
  colgroups.length = 0;
19901
- colgroups.push(...getColumns().map((col) => __spreadProps(__spreadValues({}, col), {
19947
+ colgroups.push(...resolvedColumns.value.map((col) => __spreadProps(__spreadValues({}, col), {
19902
19948
  calcWidth: null,
19903
19949
  resizeWidth: null,
19904
19950
  minWidth: resolveMinWidth(col),
@@ -19924,7 +19970,7 @@ const useInit = (props2, targetColumns) => {
19924
19970
  resetResizeEvents();
19925
19971
  registerResizeEvent();
19926
19972
  }, 120);
19927
- watch(() => [props2.columns, targetColumns], () => {
19973
+ watch(() => resolvedColumns, () => {
19928
19974
  debounceColUpdate();
19929
19975
  }, { immediate: true, deep: true });
19930
19976
  const defSort = props2.columns.reduce((out, col, index2) => {
@@ -20479,6 +20525,7 @@ var Component$e = defineComponent({
20479
20525
  onBeforeUnmount(() => {
20480
20526
  tableRender.destroy();
20481
20527
  });
20528
+ const getRoot = () => root.value;
20482
20529
  ctx.expose({
20483
20530
  setRowExpand,
20484
20531
  clearSelection,
@@ -20486,7 +20533,8 @@ var Component$e = defineComponent({
20486
20533
  toggleRowSelection,
20487
20534
  getSelection,
20488
20535
  clearSort,
20489
- scrollTo
20536
+ scrollTo,
20537
+ getRoot
20490
20538
  });
20491
20539
  const tableBodyClass = computed(() => __spreadProps(__spreadValues({}, contentClass), {
20492
20540
  "__is-empty": !pageData.length