bkui-vue 0.0.1-beta.145 → 0.0.1-beta.148

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
@@ -33,7 +33,7 @@ var __publicField = (obj, key2, value) => {
33
33
  __defNormalProp(obj, typeof key2 !== "symbol" ? key2 + "" : key2, value);
34
34
  return value;
35
35
  };
36
- import { inject, createVNode, h as h$1, mergeProps, defineComponent, reactive, ref, computed, watch, onMounted, onBeforeUnmount, getCurrentInstance, nextTick, Transition, provide, createTextVNode, isVNode, withDirectives, vShow, Fragment, toRefs, onUnmounted, Teleport, resolveDirective, customRef, onBeforeMount, toRef, vModelText, watchEffect, onUpdated, render as render$1, shallowRef, createApp, toRaw, withModifiers, TransitionGroup } from "vue";
36
+ import { inject, createVNode, h as h$1, mergeProps, defineComponent, reactive, ref, computed, watch, onMounted, onBeforeUnmount, getCurrentInstance, nextTick, Transition, provide, createTextVNode, isVNode, withDirectives, vShow, renderSlot, Fragment, toRefs, onUnmounted, Teleport, resolveDirective, customRef, onBeforeMount, toRef, vModelText, watchEffect, onUpdated, render as render$1, shallowRef, createApp, toRaw, withModifiers, TransitionGroup } from "vue";
37
37
  var reset = "";
38
38
  var alert = "";
39
39
  var affix = "";
@@ -9784,6 +9784,7 @@ const propsCollapsePanel = __spreadValues({
9784
9784
  title: PropTypes.any,
9785
9785
  content: PropTypes.string,
9786
9786
  disabled: PropTypes.bool.def(false),
9787
+ isFormList: PropTypes.bool.def(false),
9787
9788
  renderDirective: PropTypes.commonType(["if", "show"], "render").def("show"),
9788
9789
  modelValue: PropTypes.bool.def(false)
9789
9790
  }, CollapsePanelEventProps);
@@ -9878,6 +9879,7 @@ var CollapsePanel = defineComponent({
9878
9879
  slots
9879
9880
  }) {
9880
9881
  const localActiveItems = inject("localActiveItems");
9882
+ const handleItemClick = inject("handleItemClick");
9881
9883
  const isActive = ref(props2.modelValue);
9882
9884
  watch(() => props2.modelValue, (newVal) => {
9883
9885
  isActive.value = newVal;
@@ -9889,7 +9891,7 @@ var CollapsePanel = defineComponent({
9889
9891
  }, {
9890
9892
  immediate: true
9891
9893
  });
9892
- function handleItemClick(props3) {
9894
+ function clickItem(props3) {
9893
9895
  const {
9894
9896
  disabled,
9895
9897
  name,
@@ -9904,14 +9906,14 @@ var CollapsePanel = defineComponent({
9904
9906
  isActive.value = !isActive.value;
9905
9907
  emit("change", data2);
9906
9908
  emit("update:modelValue", isActive.value);
9909
+ handleItemClick({
9910
+ name
9911
+ });
9907
9912
  }
9908
9913
  const transition = ref(collapseMotion$1(emit));
9909
- const {
9910
- content
9911
- } = props2;
9912
9914
  function getContent() {
9913
- if (content) {
9914
- return content;
9915
+ if (props2.content) {
9916
+ return props2.content;
9915
9917
  }
9916
9918
  if (typeof slots.content === "function") {
9917
9919
  return slots.content(h$1);
@@ -9943,7 +9945,9 @@ var CollapsePanel = defineComponent({
9943
9945
  } else {
9944
9946
  title = props2.title;
9945
9947
  }
9946
- return createVNode(Fragment, null, [createVNode("span", {
9948
+ return createVNode("div", {
9949
+ "class": "bk-collapse-header"
9950
+ }, [createVNode("span", {
9947
9951
  "class": "bk-collapse-title"
9948
9952
  }, [title]), createVNode(angleRight, {
9949
9953
  "class": `bk-collapse-icon ${isActive.value && "rotate-icon" || ""}`
@@ -9954,8 +9958,7 @@ var CollapsePanel = defineComponent({
9954
9958
  return createVNode("div", {
9955
9959
  "class": `bk-collapse-item ${props2.disabled ? "is-disabled" : ""} ${isActive.value ? "bk-collapse-item-active" : ""}`
9956
9960
  }, [createVNode("div", {
9957
- "class": "bk-collapse-header",
9958
- "onClick": () => handleItemClick(props2)
9961
+ "onClick": () => clickItem(props2)
9959
9962
  }, [renderHeader()]), createVNode(Transition, transition.value, _isSlot$8(_slot = renderPanel()) ? _slot : {
9960
9963
  default: () => [_slot]
9961
9964
  })]);
@@ -9983,7 +9986,6 @@ var Collapse = defineComponent({
9983
9986
  }, {
9984
9987
  immediate: true
9985
9988
  });
9986
- provide("localActiveItems", localActiveItems.value);
9987
9989
  const handleItemClick = (item) => {
9988
9990
  const {
9989
9991
  name
@@ -10006,14 +10008,17 @@ var Collapse = defineComponent({
10006
10008
  emit("item-click", item);
10007
10009
  emit("update:modelValue", localActiveItems.value);
10008
10010
  };
10011
+ provide("localActiveItems", localActiveItems.value);
10012
+ provide("handleItemClick", handleItemClick);
10009
10013
  const className = "bk-collapse-wrapper";
10010
10014
  if (!Array.isArray(props2.list) || !props2.list.length) {
10011
- return () => {
10012
- var _a;
10013
- return createVNode("div", {
10014
- "class": className
10015
- }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
10016
- };
10015
+ return () => createVNode("div", {
10016
+ class: className
10017
+ }, [renderSlot(slots, "default", {
10018
+ props: {
10019
+ isList: true
10020
+ }
10021
+ })]);
10017
10022
  }
10018
10023
  const collapseData = computed(() => (props2.list || []).map((item, index) => {
10019
10024
  if (typeof item === "string" || typeof item === "number" || typeof item === "boolean") {
@@ -10041,6 +10046,7 @@ var Collapse = defineComponent({
10041
10046
  "item-click": handleItemClick,
10042
10047
  "disabled": item.disabled,
10043
10048
  "name": name,
10049
+ "isFormList": true,
10044
10050
  "title": title,
10045
10051
  "content": item[props2.contentField]
10046
10052
  }, null);
@@ -11222,7 +11228,7 @@ const PopoverProps = __spreadValues({
11222
11228
  arrow: PropTypes.bool.def(true),
11223
11229
  padding: PropTypes.number.def(5),
11224
11230
  offset: PropTypes.number.def(6),
11225
- boundary: PropTypes.string.def(void 0),
11231
+ boundary: PropTypes.oneOfType([PropTypes.string.def("parent"), PropTypes.instanceOf(HTMLElement)]),
11226
11232
  zIndex: PropTypes.number.def(void 0),
11227
11233
  disableTeleport: PropTypes.bool.def(false),
11228
11234
  autoPlacement: PropTypes.bool.def(false),
@@ -12694,7 +12700,7 @@ var useFloating = (props2, ctx, refReference, refContent, refArrow, refRoot) =>
12694
12700
  });
12695
12701
  };
12696
12702
  const showPopover = () => {
12697
- localIsShow.value = true;
12703
+ !props2.disabled && (localIsShow.value = true);
12698
12704
  };
12699
12705
  let popShowTimerId = void 0;
12700
12706
  let isMouseenter = false;
@@ -15176,7 +15182,7 @@ var useTagRender = (props2, ctx) => {
15176
15182
  };
15177
15183
  return {
15178
15184
  rendAsTag: () => {
15179
- var _a, _b, _c, _d, _e, _f, _g, _h, _i;
15185
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
15180
15186
  return h$1(renderAs, {
15181
15187
  class: props2.className
15182
15188
  }, [(_c = (_b = (_a = ctx.slots).beforeContent) == null ? void 0 : _b.call(_a)) != null ? _c : "", withDirectives(h$1(contentAs, {
@@ -15184,7 +15190,7 @@ var useTagRender = (props2, ctx) => {
15184
15190
  style: props2.contentStyle
15185
15191
  }, [(_f = (_e = (_d = ctx.slots).default) == null ? void 0 : _e.call(_d, {
15186
15192
  data: props2.list
15187
- })) != null ? _f : ""]), [[vVirtualRender, dirModifier]]), (_i = (_h = (_g = ctx.slots).afterContent) == null ? void 0 : _h.call(_g)) != null ? _i : ""]);
15193
+ })) != null ? _f : ""]), [[vVirtualRender, dirModifier]]), (_i = (_h = (_g = ctx.slots).afterContent) == null ? void 0 : _h.call(_g)) != null ? _i : "", (_l = (_k = (_j = ctx.slots).afterSection) == null ? void 0 : _k.call(_j)) != null ? _l : ""]);
15188
15194
  }
15189
15195
  };
15190
15196
  };
@@ -15402,7 +15408,7 @@ var Component$e = defineComponent({
15402
15408
  reset: reset2
15403
15409
  });
15404
15410
  return () => {
15405
- var _a, _b, _c, _d, _e, _f, _g, _h, _i;
15411
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
15406
15412
  return h$1(renderAs || "div", {
15407
15413
  ref: refRoot,
15408
15414
  class: wrapperClass.value,
@@ -15415,7 +15421,7 @@ var Component$e = defineComponent({
15415
15421
  })) != null ? _f : ""]), [[vVirtualRender, dirModifier]]), (_i = (_h = (_g = ctx.slots).afterContent) == null ? void 0 : _h.call(_g)) != null ? _i : "", h$1("div", {
15416
15422
  class: [resolveClassName("virtual-section")],
15417
15423
  style: innerStyle.value
15418
- })]);
15424
+ }), (_l = (_k = (_j = ctx.slots).afterSection) == null ? void 0 : _k.call(_j)) != null ? _l : ""]);
15419
15425
  };
15420
15426
  }
15421
15427
  });
@@ -17347,7 +17353,7 @@ const useClass = (props2, root, reactiveProp, pageData) => {
17347
17353
  if (/^\d+\.?\d*px$/ig.test(strHeight)) {
17348
17354
  return Number(strHeight.replace("px", ""));
17349
17355
  }
17350
- if (/^\d+\.?\d*%$/ig.test(strHeight)) {
17356
+ if (/^\d+\.?\d*%$/ig.test(strHeight) && typeof defaultValue === "number") {
17351
17357
  const percent = Number(strHeight.replace("%", ""));
17352
17358
  return defaultValue * percent / 100;
17353
17359
  }
@@ -17363,10 +17369,13 @@ const useClass = (props2, root, reactiveProp, pageData) => {
17363
17369
  const contentHeight = resolveHeight - resolveHeadHeight - resolveFooterHeight;
17364
17370
  const height = props2.height !== "auto" ? `${contentHeight}px` : false;
17365
17371
  const minHeight = resolveMinHeight - resolveHeadHeight - resolveFooterHeight;
17372
+ const resolveMaxHeight = resolvePropHeight(props2.maxHeight, void 0);
17373
+ const maxHeight = typeof resolveMaxHeight === "number" ? `${resolveMaxHeight - resolveHeadHeight - resolveFooterHeight}px` : false;
17366
17374
  Object.assign(contentStyle, {
17367
17375
  display: (pageData == null ? void 0 : pageData.length) ? "block" : false,
17368
17376
  "min-height": `${minHeight}px`,
17369
- height
17377
+ height,
17378
+ maxHeight
17370
17379
  });
17371
17380
  };
17372
17381
  onMounted(() => {
@@ -17678,6 +17687,10 @@ var Component$c = defineComponent({
17678
17687
  "scroll-loading": true,
17679
17688
  _bottom: true
17680
17689
  };
17690
+ const fixedBottomBorder = {
17691
+ [resolveClassName("fixed-bottom-border")]: true,
17692
+ "_is-empty": !props2.data.length
17693
+ };
17681
17694
  const {
17682
17695
  renderScrollLoading
17683
17696
  } = useScrollLoading(props2, ctx);
@@ -17707,7 +17720,10 @@ var Component$c = defineComponent({
17707
17720
  "scrollEvent": true,
17708
17721
  "enabled": props2.virtualEnabled
17709
17722
  }), {
17710
- default: (scope) => tableRender.renderTableBodySchema(scope.data || props2.data)
17723
+ default: (scope) => tableRender.renderTableBodySchema(scope.data || props2.data),
17724
+ afterSection: () => createVNode("div", {
17725
+ "class": fixedBottomBorder
17726
+ }, null)
17711
17727
  }),
17712
17728
  createVNode("div", {
17713
17729
  "class": fixedWrapperClass
@@ -18918,7 +18934,7 @@ var TabNav = defineComponent({
18918
18934
  "onClick": () => this.handleTabRemove(index, item)
18919
18935
  }, null)]);
18920
18936
  });
18921
- const renderSlot = () => {
18937
+ const renderSlot2 = () => {
18922
18938
  var _a, _b;
18923
18939
  const list = [];
18924
18940
  if (typeof this.$slots.add === "function") {
@@ -18948,7 +18964,7 @@ var TabNav = defineComponent({
18948
18964
  "class": "bk-tab-header"
18949
18965
  }, [createVNode("div", {
18950
18966
  "class": "bk-tab-header-nav"
18951
- }, [renderNavs()]), renderSlot(), typeof this.$slots.setting === "function" && createVNode("div", {
18967
+ }, [renderNavs()]), renderSlot2(), typeof this.$slots.setting === "function" && createVNode("div", {
18952
18968
  "class": "bk-tab-header-setting"
18953
18969
  }, [this.$slots.setting()])]);
18954
18970
  }
@@ -25935,86 +25951,70 @@ var Row = defineComponent({
25935
25951
  }
25936
25952
  });
25937
25953
  const BkContainer = withInstallProps(Container, { Row, Col });
25954
+ const PLACEMENT_OPTIONS = ["auto", "auto-start", "auto-end", "top", "right", "bottom", "left", "top-start", "top-end", "bottom-start", "bottom-end", "right-start", "right-end", "left-start", "left-end"];
25955
+ const TRIGGER_OPTIONS = ["hover", "click", "manual"];
25938
25956
  var Dropdown = defineComponent({
25939
25957
  name: "Dropdown",
25940
25958
  props: {
25941
25959
  isShow: PropTypes.bool.def(false),
25942
- placement: PropTypes.commonType(["auto", "auto-start", "auto-end", "top", "right", "bottom", "left", "top-start", "top-end", "bottom-start", "bottom-end", "right-start", "right-end", "left-start", "left-end"], "placement").def("bottom"),
25943
- trigger: PropTypes.commonType(["hover", "click", "manual"], "trigger").def("hover"),
25960
+ placement: PropTypes.commonType(PLACEMENT_OPTIONS, "placement").def("bottom"),
25961
+ trigger: PropTypes.commonType(TRIGGER_OPTIONS, "trigger").def("hover"),
25944
25962
  disabled: PropTypes.bool.def(false),
25963
+ popoverOptions: PropTypes.object.def({}),
25945
25964
  extCls: PropTypes.string
25946
25965
  },
25947
25966
  emits: ["showChange", "show", "hide"],
25948
- setup(props2, {
25967
+ setup(_props, {
25949
25968
  emit
25950
25969
  }) {
25951
- let popoverInstance = /* @__PURE__ */ Object.create(null);
25952
- const reference2 = ref(null);
25953
- const refContent = ref(null);
25954
- onMounted(() => {
25955
- registerDropdown();
25956
- });
25957
- onBeforeUnmount(() => {
25958
- destoryDropdown();
25959
- });
25960
- watch(() => props2.isShow, (val) => {
25961
- nextTick(() => {
25962
- if (props2.trigger === "manual" && popoverInstance && !props2.disabled) {
25963
- val ? popoverInstance.show() : popoverInstance.hide();
25964
- }
25965
- });
25966
- });
25967
- watch(() => props2.disabled, (val) => handleUpdateDisabled(val));
25970
+ const handleShowChagne = (val) => {
25971
+ emit("showChange", val);
25972
+ };
25968
25973
  const afterShow = () => {
25969
25974
  emit("show");
25975
+ handleShowChagne(true);
25970
25976
  };
25971
25977
  const afterHidden = () => {
25972
25978
  emit("hide");
25973
- };
25974
- const registerDropdown = () => {
25975
- if (props2.disabled)
25976
- return;
25977
- popoverInstance = new BKPopover(reference2.value, refContent.value, {
25978
- placement: props2.placement,
25979
- trigger: props2.trigger,
25980
- afterShow,
25981
- afterHidden
25982
- });
25983
- props2.trigger === "manual" && props2.isShow && popoverInstance.show();
25984
- };
25985
- const destoryDropdown = () => {
25986
- if (popoverInstance) {
25987
- const instance = popoverInstance;
25988
- instance.isShow && instance.hide();
25989
- instance.destroy();
25990
- popoverInstance = null;
25991
- props2.trigger === "manual" && emit("showChange", false);
25992
- }
25993
- };
25994
- const handleUpdateDisabled = (val) => {
25995
- const instance = popoverInstance;
25996
- props2.trigger === "manual" && !val && emit("showChange", false);
25997
- instance.updateDisabled(val);
25979
+ handleShowChagne(false);
25998
25980
  };
25999
25981
  return {
26000
- reference: reference2,
26001
- refContent
25982
+ afterShow,
25983
+ afterHidden
26002
25984
  };
26003
25985
  },
26004
25986
  render() {
26005
- var _a, _b, _c, _d;
26006
25987
  const wrapperClasses = classes({
26007
25988
  "bk-dropdown": true
26008
25989
  }, this.$props.extCls);
25990
+ const basePopoverOptions = {
25991
+ theme: "light bk-dropdown-popover",
25992
+ trigger: this.trigger,
25993
+ arrow: false,
25994
+ placement: this.placement,
25995
+ isShow: this.isShow,
25996
+ disabled: this.disabled
25997
+ };
25998
+ const popoverOptions = lodash.exports.merge(basePopoverOptions, this.popoverOptions);
26009
25999
  return createVNode("div", {
26010
26000
  "class": wrapperClasses
26011
- }, [createVNode("div", {
26012
- "ref": "reference",
26013
- "class": "bk-dropdown-reference"
26014
- }, [(_b = (_a = this.$slots).default) == null ? void 0 : _b.call(_a)]), createVNode("div", {
26015
- "ref": "refContent",
26016
- "class": "bk-dropdown-content"
26017
- }, [(_d = (_c = this.$slots).content) == null ? void 0 : _d.call(_c)])]);
26001
+ }, [createVNode(BkPopover2, mergeProps(popoverOptions, {
26002
+ "onAfterShow": this.afterShow,
26003
+ "onAfterHidden": this.afterHidden
26004
+ }), {
26005
+ default: () => {
26006
+ var _a, _b;
26007
+ return createVNode("div", {
26008
+ "class": "bk-dropdown-reference"
26009
+ }, [createTextVNode(" "), (_b = (_a = this.$slots).default) == null ? void 0 : _b.call(_a), createTextVNode(" ")]);
26010
+ },
26011
+ content: () => {
26012
+ var _a, _b;
26013
+ return createVNode("div", {
26014
+ "class": "bk-dropdown-content"
26015
+ }, [createTextVNode(" "), (_b = (_a = this.$slots).content) == null ? void 0 : _b.call(_a), createTextVNode(" ")]);
26016
+ }
26017
+ })]);
26018
26018
  }
26019
26019
  });
26020
26020
  var DropdownItem = defineComponent({
@@ -26251,8 +26251,8 @@ class Store {
26251
26251
  constructor(props2) {
26252
26252
  const { list } = props2;
26253
26253
  this.data = list;
26254
- this.nodes = this.data.map((node) => new Node$1(node, this.config));
26255
26254
  this.config = props2;
26255
+ this.nodes = this.data.map((node) => new Node$1(node, this.config));
26256
26256
  }
26257
26257
  getNodes() {
26258
26258
  return this.nodes;