bkui-vue 0.0.1-beta.87 → 0.0.1-beta.88

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
@@ -8741,7 +8741,7 @@ var BreadcrumbItem = defineComponent({
8741
8741
  "bk-breadcrumb-item": true
8742
8742
  }, `${props.extCls || ""}`);
8743
8743
  return () => {
8744
- var _a;
8744
+ var _a, _b;
8745
8745
  return createVNode("span", {
8746
8746
  "class": classCtx
8747
8747
  }, [createVNode("span", {
@@ -8749,7 +8749,7 @@ var BreadcrumbItem = defineComponent({
8749
8749
  "class": `bk-breadcrumb-item-inner ${to ? "is-link" : ""}`,
8750
8750
  "role": "link",
8751
8751
  "onClick": handleClick
8752
- }, [(_a = slots == null ? void 0 : slots.default) == null ? void 0 : _a.call(slots)]), (parent == null ? void 0 : parent.separatorClass) ? createVNode("i", {
8752
+ }, [(_a = slots == null ? void 0 : slots.default) == null ? void 0 : _a.call(slots)]), (slots == null ? void 0 : slots.separator) ? (_b = slots == null ? void 0 : slots.separator) == null ? void 0 : _b.call(slots) : (parent == null ? void 0 : parent.separatorClass) ? createVNode("i", {
8753
8753
  "class": `bk-breadcrumb-separator ${parent.separatorClass}`
8754
8754
  }, null) : createVNode("span", {
8755
8755
  "class": "bk-breadcrumb-separator",
@@ -9827,7 +9827,7 @@ var Component$p = defineComponent({
9827
9827
  };
9828
9828
  data2.positionX = 0;
9829
9829
  data2.positionY = 0;
9830
- }, 1e3);
9830
+ }, 250);
9831
9831
  }
9832
9832
  });
9833
9833
  const handleClose = () => {
@@ -9912,15 +9912,15 @@ var Component$p = defineComponent({
9912
9912
  return [createVNode("div", {
9913
9913
  "class": ["bk-dialog-tool", this.fullscreen || !this.draggable ? "" : "move", this.draggable ? "content-dragging" : ""],
9914
9914
  "onMousedown": this.moveHandler
9915
- }, [(_c = (_b = (_a = this.$slots).tools) == null ? void 0 : _b.call(_a)) != null ? _c : "", createVNode("span", {
9916
- "class": ["bk-dialog-close", this.closeIcon ? "" : "close-icon"],
9917
- "onClick": this.handleClose
9918
- }, [createTextVNode("+")])]), createVNode("div", {
9915
+ }, [(_c = (_b = (_a = this.$slots).tools) == null ? void 0 : _b.call(_a)) != null ? _c : ""]), createVNode("div", {
9919
9916
  "class": "bk-dialog-header"
9920
9917
  }, [createVNode("span", {
9921
9918
  "class": "bk-dialog-title",
9922
9919
  "style": `text-align: ${this.headerAlign}`
9923
- }, [(_f = (_e = (_d = this.$slots).header) == null ? void 0 : _e.call(_d)) != null ? _f : this.title])])];
9920
+ }, [(_f = (_e = (_d = this.$slots).header) == null ? void 0 : _e.call(_d)) != null ? _f : this.title]), createVNode("span", {
9921
+ "class": ["bk-dialog-close", this.closeIcon ? "" : "close-icon"],
9922
+ "onClick": this.handleClose
9923
+ }, [createTextVNode("+")])])];
9924
9924
  },
9925
9925
  default: () => {
9926
9926
  var _a, _b, _c;
@@ -12643,7 +12643,7 @@ var Component$c = defineComponent({
12643
12643
  offText: PropTypes.string.def("OFF"),
12644
12644
  isSquare: PropTypes.bool,
12645
12645
  extCls: PropTypes.string,
12646
- preCheck: PropTypes.func.def(void 0),
12646
+ beforeChange: PropTypes.func.def(void 0),
12647
12647
  trueValue: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.bool]).def(true),
12648
12648
  falseValue: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.bool]).def(false),
12649
12649
  value: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.bool]).def(false),
@@ -12669,7 +12669,7 @@ var Component$c = defineComponent({
12669
12669
  "is-checked": isChecked.value,
12670
12670
  "is-unchecked": !isChecked.value,
12671
12671
  "is-loading": isLoading.value,
12672
- primary: props.theme === "primary"
12672
+ "bk-primary": props.theme === "primary"
12673
12673
  };
12674
12674
  if (props.size && !props.showText) {
12675
12675
  const sizeStr = `bk-switcher-${props.size}`;
@@ -12701,8 +12701,8 @@ var Component$c = defineComponent({
12701
12701
  (_a = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a.call(formItem, "change");
12702
12702
  };
12703
12703
  let goodJob = true;
12704
- if (typeof props.preCheck === "function") {
12705
- goodJob = props.preCheck(lastValue);
12704
+ if (typeof props.beforeChange === "function") {
12705
+ goodJob = props.beforeChange(lastValue);
12706
12706
  if (typeof goodJob.then === "function") {
12707
12707
  isLoading.value = true;
12708
12708
  return goodJob.then(() => {
@@ -13512,6 +13512,47 @@ var userPagination = (props) => {
13512
13512
  watchEffectFn
13513
13513
  };
13514
13514
  };
13515
+ var useScrollLoading = (props, ctx) => {
13516
+ const refScrollLoading = toRef(props, "scrollLoading");
13517
+ const getLoadingOption = () => {
13518
+ if (typeof refScrollLoading.value === "boolean") {
13519
+ return {
13520
+ loading: !!refScrollLoading.value,
13521
+ inline: true,
13522
+ title: "",
13523
+ size: BkLoadingSize.Normal,
13524
+ mode: BkLoadingMode.Default,
13525
+ indicator: null
13526
+ };
13527
+ }
13528
+ return refScrollLoading.value;
13529
+ };
13530
+ const isRender = computed(() => refScrollLoading.value !== null && (typeof refScrollLoading.value === "boolean" && refScrollLoading.value || typeof refScrollLoading.value === "object"));
13531
+ const renderScrollLoading = () => {
13532
+ var _a, _b, _c;
13533
+ if (isRender.value) {
13534
+ const {
13535
+ loading: loading2,
13536
+ size,
13537
+ mode,
13538
+ title,
13539
+ inline,
13540
+ indicator
13541
+ } = getLoadingOption();
13542
+ return (_c = (_b = (_a = ctx.slots).fixedBottom) == null ? void 0 : _b.call(_a)) != null ? _c : createVNode(BkLoading, {
13543
+ loading: loading2,
13544
+ size,
13545
+ mode,
13546
+ title,
13547
+ inline,
13548
+ indicator
13549
+ }, null);
13550
+ }
13551
+ };
13552
+ return {
13553
+ renderScrollLoading
13554
+ };
13555
+ };
13515
13556
  var SortScope = /* @__PURE__ */ ((SortScope2) => {
13516
13557
  SortScope2["CURRENT"] = "current";
13517
13558
  SortScope2["ALL"] = "all";
@@ -13576,7 +13617,11 @@ const tableProps = {
13576
13617
  rowClass: PropTypes.oneOfType([PropTypes.string, PropTypes.object, PropTypes.func]).def({}),
13577
13618
  rowStyle: PropTypes.oneOfType([PropTypes.string, PropTypes.object, PropTypes.func]).def({}),
13578
13619
  cellStyle: PropTypes.oneOfType([PropTypes.string, PropTypes.object, PropTypes.func]).def({}),
13579
- cellClass: PropTypes.oneOfType([PropTypes.string, PropTypes.object, PropTypes.func]).def({})
13620
+ cellClass: PropTypes.oneOfType([PropTypes.string, PropTypes.object, PropTypes.func]).def({}),
13621
+ scrollLoading: PropTypes.oneOfType([
13622
+ PropTypes.object,
13623
+ PropTypes.bool
13624
+ ]).def(void 0)
13580
13625
  };
13581
13626
  function _isSlot$2(s2) {
13582
13627
  return typeof s2 === "function" || Object.prototype.toString.call(s2) === "[object Object]" && !isVNode(s2);
@@ -14880,7 +14925,7 @@ var Component$9 = defineComponent({
14880
14925
  const {
14881
14926
  bottom: bottom2
14882
14927
  } = pos;
14883
- if (bottom2 <= 2 && preBottom !== bottom2) {
14928
+ if (bottom2 <= 2 && preBottom > bottom2) {
14884
14929
  debounce(60, () => {
14885
14930
  ctx.emit(EMITEVENTS.SCROLL_BOTTOM, __spreadProps(__spreadValues({}, pos), {
14886
14931
  translateX,
@@ -14903,9 +14948,6 @@ var Component$9 = defineComponent({
14903
14948
  observerIns = null;
14904
14949
  tableRender.destroy();
14905
14950
  });
14906
- ctx.expose({
14907
- plugins: tableRender.plugins
14908
- });
14909
14951
  const tableBodyClass = __spreadProps(__spreadValues({}, contentClass), {
14910
14952
  "__is-empty": !pageData.length
14911
14953
  });
@@ -14918,8 +14960,12 @@ var Component$9 = defineComponent({
14918
14960
  "offset-x": true
14919
14961
  };
14920
14962
  const loadingRowClass = {
14921
- [resolveClassName("table-loading_bottom")]: true
14963
+ "scroll-loading": true,
14964
+ _bottom: true
14922
14965
  };
14966
+ const {
14967
+ renderScrollLoading
14968
+ } = useScrollLoading(props, ctx);
14923
14969
  return () => createVNode("div", {
14924
14970
  "class": tableClass.value,
14925
14971
  "style": wrapperStyle.value,
@@ -14950,7 +14996,7 @@ var Component$9 = defineComponent({
14950
14996
  "style": dragOffsetXStyle.value
14951
14997
  }, null), createVNode("div", {
14952
14998
  "class": loadingRowClass
14953
- }, null)]),
14999
+ }, [renderScrollLoading()])]),
14954
15000
  createVNode("div", {
14955
15001
  "class": footerClass.value
14956
15002
  }, [hasFooter.value && tableRender.renderTableFooter(localPagination.value)])
@@ -21409,7 +21455,8 @@ const treeProps = {
21409
21455
  dragSort: PropTypes.bool.def(false),
21410
21456
  selectable: PropTypes.bool.def(true),
21411
21457
  selected: PropTypes.oneOfType([PropTypes.string, null, PropTypes.number, PropTypes.object]).def(null),
21412
- autoCheckChildren: PropTypes.bool.def(true)
21458
+ autoCheckChildren: PropTypes.bool.def(true),
21459
+ autoOpenParentNode: PropTypes.bool.def(true)
21413
21460
  };
21414
21461
  var useEmpty = (props, {
21415
21462
  slots
@@ -21461,7 +21508,8 @@ var useNodeAttribute = (flatData, props) => {
21461
21508
  }
21462
21509
  return false;
21463
21510
  };
21464
- const checkNodeIsOpen = (node) => isRootNode(node) || isItemOpen(node) || isItemOpen(getNodeAttr2(node, NODE_ATTRIBUTES.PARENT_ID));
21511
+ const isParentNodeOpened = (node) => isItemOpen(getNodeAttr2(node, NODE_ATTRIBUTES.PARENT_ID));
21512
+ const checkNodeIsOpen = (node) => isRootNode(node) || isParentNodeOpened(node);
21465
21513
  const getSourceNodeByPath = (path) => {
21466
21514
  const paths = path.split("-");
21467
21515
  return paths.reduce((pre, nodeIndex) => {
@@ -21772,15 +21820,14 @@ var useNodeAction = (props, ctx, flatData, renderData, schemaValues, initOption)
21772
21820
  };
21773
21821
  const setNodeOpened = (item, isOpen = null, e = null, fireEmit = true) => {
21774
21822
  const newVal = isOpen === null ? !isItemOpen(item) : !!isOpen;
21823
+ if (!newVal) {
21824
+ renderData.value.filter((node) => String.prototype.startsWith.call(getNodePath(node), getNodePath(item))).forEach((filterNode) => setNodeAttr(filterNode, NODE_ATTRIBUTES.IS_OPEN, newVal));
21825
+ }
21775
21826
  setNodeAttr(item, NODE_ATTRIBUTES.IS_OPEN, newVal);
21776
21827
  if (fireEmit) {
21777
21828
  const emitEvent = isItemOpen(item) ? EVENTS.NODE_EXPAND : EVENTS.NODE_COLLAPSE;
21778
21829
  ctx.emit(emitEvent, [item, resolveScopedSlotParam(item), getSchemaVal2(item[NODE_ATTRIBUTES.UUID]), e]);
21779
21830
  }
21780
- if (newVal) {
21781
- return;
21782
- }
21783
- renderData.value.filter((node) => String.prototype.startsWith.call(getNodePath(node), getNodePath(item))).forEach((filterNode) => setNodeAttr(filterNode, NODE_ATTRIBUTES.IS_OPEN, newVal));
21784
21831
  };
21785
21832
  const setNodeAction = (args, action, value) => {
21786
21833
  if (Array.isArray(args)) {
@@ -22267,7 +22314,8 @@ var useTreeInit = (props) => {
22267
22314
  [NODE_ATTRIBUTES.IS_MATCH]: () => true,
22268
22315
  [NODE_ATTRIBUTES.IS_SELECTED]: (uuid2) => props2.selected === uuid2,
22269
22316
  [NODE_ATTRIBUTES.IS_CACHED]: () => false,
22270
- [NODE_ATTRIBUTES.IS_ASYNC]: () => null
22317
+ [NODE_ATTRIBUTES.IS_ASYNC]: () => null,
22318
+ [NODE_ATTRIBUTES.IS_LOADING]: () => false
22271
22319
  };
22272
22320
  function getCachedTreeNodeAttr(uuid2, node, cachedAttr, defVal = void 0) {
22273
22321
  let defaultValue = defVal;
@@ -22294,11 +22342,11 @@ var useTreeInit = (props) => {
22294
22342
  }
22295
22343
  return getCachedTreeNodeAttr(uuid2, node, NODE_ATTRIBUTES.IS_SELECTED, props2.selected === uuid2);
22296
22344
  }
22297
- function isCachedTreeNodeLoading(uuid2, node) {
22298
- if (Object.prototype.hasOwnProperty.call(node, NODE_ATTRIBUTES.IS_LOADING)) {
22299
- return node[NODE_ATTRIBUTES.IS_LOADING];
22300
- }
22301
- return getCachedTreeNodeAttr(uuid2, node, NODE_ATTRIBUTES.IS_LOADING, false);
22345
+ function isNodeOpend(uuid2, item, parent) {
22346
+ var _a2;
22347
+ const isItemOpened = getCachedTreeNodeAttr(uuid2, item, NODE_ATTRIBUTES.IS_OPEN);
22348
+ const isParentOpened = schema.has(parent) ? (_a2 = schema.get(parent)) == null ? void 0 : _a2[NODE_ATTRIBUTES.IS_OPEN] : true;
22349
+ return isItemOpened && isParentOpened;
22302
22350
  }
22303
22351
  function validateIsOpenLoopFn(target) {
22304
22352
  return !target[NODE_ATTRIBUTES.IS_OPEN];
@@ -22314,6 +22362,12 @@ var useTreeInit = (props) => {
22314
22362
  const uuid2 = `${getUid(item)}`;
22315
22363
  const currentPath = path !== null ? `${path}-${i}` : `${i}`;
22316
22364
  const hasChildren = !!(item[children] || []).length;
22365
+ let isOpened = getCachedTreeNodeAttr(uuid2, item, NODE_ATTRIBUTES.IS_OPEN);
22366
+ if (props2.autoOpenParentNode) {
22367
+ isOpened && loopUpdateNodeAttr(parent, NODE_ATTRIBUTES.IS_OPEN, true, validateIsOpenLoopFn);
22368
+ } else {
22369
+ isOpened = isNodeOpend(uuid2, item, parent);
22370
+ }
22317
22371
  const attrs = {
22318
22372
  [NODE_ATTRIBUTES.DEPTH]: depth,
22319
22373
  [NODE_ATTRIBUTES.INDEX]: i,
@@ -22325,11 +22379,11 @@ var useTreeInit = (props) => {
22325
22379
  [NODE_ATTRIBUTES.ORDER]: order2,
22326
22380
  [NODE_ATTRIBUTES.IS_SELECTED]: isCachedTreeNodeSelected(uuid2, item),
22327
22381
  [NODE_ATTRIBUTES.IS_MATCH]: getCachedTreeNodeAttr(uuid2, item, NODE_ATTRIBUTES.IS_MATCH),
22328
- [NODE_ATTRIBUTES.IS_OPEN]: getCachedTreeNodeAttr(uuid2, item, NODE_ATTRIBUTES.IS_OPEN),
22382
+ [NODE_ATTRIBUTES.IS_OPEN]: isOpened,
22329
22383
  [NODE_ATTRIBUTES.IS_CHECKED]: getCachedTreeNodeAttr(uuid2, item, NODE_ATTRIBUTES.IS_CHECKED),
22330
22384
  [NODE_ATTRIBUTES.IS_CACHED]: getCachedTreeNodeAttr(uuid2, item, NODE_ATTRIBUTES.IS_CACHED),
22331
22385
  [NODE_ATTRIBUTES.IS_ASYNC]: getCachedTreeNodeAttr(uuid2, item, NODE_ATTRIBUTES.IS_ASYNC),
22332
- [NODE_ATTRIBUTES.IS_LOADING]: isCachedTreeNodeLoading(uuid2, item),
22386
+ [NODE_ATTRIBUTES.IS_LOADING]: getCachedTreeNodeAttr(uuid2, item, NODE_ATTRIBUTES.IS_LOADING),
22333
22387
  [children]: null
22334
22388
  };
22335
22389
  Object.assign(item, {
@@ -22340,9 +22394,6 @@ var useTreeInit = (props) => {
22340
22394
  outputData.push(__spreadProps(__spreadValues({}, item), {
22341
22395
  [children]: null
22342
22396
  }));
22343
- if (attrs[NODE_ATTRIBUTES.IS_OPEN]) {
22344
- loopUpdateNodeAttr(parent, NODE_ATTRIBUTES.IS_OPEN, true, validateIsOpenLoopFn);
22345
- }
22346
22397
  if (Object.prototype.hasOwnProperty.call(item, children)) {
22347
22398
  flatten(item[children] || [], depth + 1, uuid2, currentPath);
22348
22399
  }