bkui-vue 2.0.2-beta.6 → 2.0.2-beta.8

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.
@@ -1707,31 +1707,63 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
1707
1707
  * @param value - 节点ID数组
1708
1708
  */
1709
1709
  var expandByNodeList = function expandByNodeList(value) {
1710
- var targetList = [];
1711
- // 如果配置了多选,找出最长的序列,即其最远的路径,以展开所有面板
1712
- if (store.config.multiple) {
1713
- var _iterator = _createForOfIteratorHelper(value),
1714
- _step;
1715
- try {
1716
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
1717
- var subArray = _step.value;
1718
- if (subArray.length > targetList.length) {
1719
- targetList = subArray;
1710
+ // 判断是否为初始加载
1711
+ var isInitialLoad = checkValue.value.length === 0;
1712
+ // 如果是初始加载或单选情况,按原来的逻辑处理
1713
+ if (isInitialLoad || !store.config.multiple) {
1714
+ var targetList = [];
1715
+ // 处理多选情况
1716
+ if (store.config.multiple) {
1717
+ var _iterator = _createForOfIteratorHelper(value),
1718
+ _step;
1719
+ try {
1720
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
1721
+ var subArray = _step.value;
1722
+ if (subArray.length > targetList.length) {
1723
+ targetList = subArray;
1724
+ }
1720
1725
  }
1726
+ } catch (err) {
1727
+ _iterator.e(err);
1728
+ } finally {
1729
+ _iterator.f();
1721
1730
  }
1722
- } catch (err) {
1723
- _iterator.e(err);
1724
- } finally {
1725
- _iterator.f();
1731
+ } else {
1732
+ // 单选情况
1733
+ targetList = value;
1726
1734
  }
1727
- } else {
1728
- targetList = value;
1735
+ // 执行展开操作
1736
+ targetList.forEach(function (id) {
1737
+ var node = store.getNodeById(id);
1738
+ if (node) {
1739
+ // 只展开,不需要重复触发
1740
+ var expandNode = function expandNode(node) {
1741
+ var _node$children;
1742
+ if (!node || node !== null && node !== void 0 && node.isDisabled) return;
1743
+ var level = node.level;
1744
+ // 确保面板只更新到当前节点层级
1745
+ menus.list = menus.list.slice(0, level);
1746
+ activePath.value = activePath.value.slice(0, level - 1);
1747
+ // 如果节点有子节点,直接添加到面板
1748
+ if ((_node$children = node.children) !== null && _node$children !== void 0 && _node$children.length) {
1749
+ if (menus.list.length === level) {
1750
+ menus.list.push(node.children);
1751
+ activePath.value.push(node);
1752
+ }
1753
+ }
1754
+ };
1755
+ // 展开节点的所有父节点
1756
+ var expandParents = function expandParents(node) {
1757
+ if (node.parent) {
1758
+ expandParents(node.parent);
1759
+ }
1760
+ expandNode(node);
1761
+ };
1762
+ expandParents(node);
1763
+ }
1764
+ });
1729
1765
  }
1730
- // 遍历最长路径的节点,如果节点有children,展开子面板
1731
- targetList.forEach(function (id) {
1732
- var node = store.getNodeById(id);
1733
- nodeExpandHandler(node);
1734
- });
1766
+ // 用户交互过程中的选择由nodeExpandHandler单独处理,这里不干预
1735
1767
  };
1736
1768
  /** 节点选中回调
1737
1769
  * 根据单选、多选配置checkValue
@@ -1754,14 +1786,14 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
1754
1786
  };
1755
1787
  /** node点击展开回调 */
1756
1788
  var nodeExpandHandler = function nodeExpandHandler(node) {
1757
- var _node$children;
1789
+ var _node$children2;
1758
1790
  if (!node || node !== null && node !== void 0 && node.isDisabled) return;
1759
1791
  menus.list = menus.list.slice(0, node.level);
1760
1792
  activePath.value = activePath.value.slice(0, node.level - 1);
1761
1793
  /** 如果所点击的node具有children元素,则直接展开
1762
1794
  * 否则判断是否开启了远程加载,进行远程加载列表
1763
1795
  */
1764
- if ((_node$children = node.children) !== null && _node$children !== void 0 && _node$children.length) {
1796
+ if ((_node$children2 = node.children) !== null && _node$children2 !== void 0 && _node$children2.length) {
1765
1797
  menus.list.push(node.children);
1766
1798
  activePath.value.push(node);
1767
1799
  return;
@@ -2711,7 +2743,7 @@ var Store = /*#__PURE__*/function () {
2711
2743
  var _this = this;
2712
2744
  // 定义suffixIcon函数,用于根据不同情况渲染后缀图标
2713
2745
  var suffixIcon = function suffixIcon() {
2714
- if (_this.clearable && _this.isHover && !_this.disabled) {
2746
+ if (_this.clearable && _this.isHover && !_this.disabled && _this.modelValue.length > 0) {
2715
2747
  // 当可清空、鼠标悬浮且未禁用时,渲染清空图标
2716
2748
  return (0,external_vue_.createVNode)(icon_namespaceObject.Close, {
2717
2749
  "class": _this.resolveClassName('icon-clear-icon'),
package/lib/index.js CHANGED
@@ -3,5 +3,5 @@ export * from './hooks';
3
3
  export { default } from './preset';
4
4
  export * from './config-provider';
5
5
  export * from './directives';
6
- export const version = "2.0.2-beta.6";
6
+ export const version = "2.0.2-beta.8";
7
7
  window.__bkui_vue_version__ = version;
@@ -1686,7 +1686,7 @@ var inputEmitEventsType = (_inputEmitEventsType = {}, _defineProperty(_definePro
1686
1686
  }), EVENTS.CHANGE, EventFunction), EVENTS.CLEAR, function () {
1687
1687
  return true;
1688
1688
  }), EVENTS.INPUT, EventFunction), EVENTS.KEYPRESS, EventFunction), EVENTS.KEYDOWN, EventFunction), EVENTS.KEYUP, EventFunction), EVENTS.ENTER, EventFunction), _defineProperty(_defineProperty(_defineProperty(_defineProperty(_inputEmitEventsType, EVENTS.PASTE, PastEventFunction), EVENTS.COMPOSITIONSTART, CompositionEventFunction), EVENTS.COMPOSITIONUPDATE, CompositionEventFunction), EVENTS.COMPOSITIONEND, CompositionEventFunction));
1689
- /* harmony default export */ const input = ((0,external_vue_namespaceObject.defineComponent)({
1689
+ var Input = (0,external_vue_namespaceObject.defineComponent)({
1690
1690
  name: 'Input',
1691
1691
  directives: {
1692
1692
  bkTooltips: src_tooltips
@@ -1835,10 +1835,11 @@ var inputEmitEventsType = (_inputEmitEventsType = {}, _defineProperty(_definePro
1835
1835
  (_inputRef$value = inputRef.value) === null || _inputRef$value === void 0 || (_inputRef$value$focus = _inputRef$value.focus) === null || _inputRef$value$focus === void 0 || _inputRef$value$focus.call(_inputRef$value);
1836
1836
  }
1837
1837
  });
1838
+ function focus() {
1839
+ inputRef.value.focus();
1840
+ }
1838
1841
  ctx.expose({
1839
- focus: function focus() {
1840
- inputRef.value.focus();
1841
- },
1842
+ focus: focus,
1842
1843
  blur: function blur() {
1843
1844
  inputRef.value.blur();
1844
1845
  isFocused.value = false;
@@ -2050,8 +2051,10 @@ var inputEmitEventsType = (_inputEmitEventsType = {}, _defineProperty(_definePro
2050
2051
  "class": getCls('suffix-area--text')
2051
2052
  }, [props.suffix])])]), [[(0,external_vue_namespaceObject.resolveDirective)("bk-tooltips"), tooltips.value]]);
2052
2053
  };
2053
- }
2054
- }));
2054
+ },
2055
+ expose: ['focus', 'blur', 'clear']
2056
+ });
2057
+ /* harmony default export */ const input = (Input);
2055
2058
  ;// ../../packages/input/src/index.ts
2056
2059
  /*
2057
2060
  * Tencent is pleased to support the open source community by making
@@ -1,4 +1,4 @@
1
- import { ExtractPropTypes } from 'vue';
1
+ import { type ExtractPropTypes } from 'vue';
2
2
  export type InputAutoSize = {
3
3
  minRows?: number;
4
4
  maxRows?: number;
@@ -112,7 +112,7 @@ export declare const inputType: {
112
112
  default: boolean;
113
113
  };
114
114
  };
115
- export declare const enum EVENTS {
115
+ export declare enum EVENTS {
116
116
  BLUR = "blur",
117
117
  CHANGE = "change",
118
118
  CLEAR = "clear",
@@ -148,7 +148,7 @@ export declare const inputEmitEventsType: {
148
148
  compositionend: typeof CompositionEventFunction;
149
149
  };
150
150
  export type InputType = ExtractPropTypes<typeof inputType>;
151
- declare const _default: import("vue").DefineComponent<{
151
+ declare const Input: import("vue").DefineComponent<{
152
152
  type: import("vue-types").VueTypeValidableDef<string> & {
153
153
  default: string;
154
154
  } & {
@@ -423,4 +423,4 @@ declare const _default: import("vue").DefineComponent<{
423
423
  autosize: boolean | InputAutoSize;
424
424
  stopPropagation: boolean;
425
425
  }, {}>;
426
- export default _default;
426
+ export default Input;
@@ -508,7 +508,7 @@ var external_vue_x = (y) => {
508
508
  var x = {}; __webpack_require__.d(x, y); return x
509
509
  }
510
510
  var external_vue_y = (x) => (() => (x))
511
- const external_vue_namespaceObject = external_vue_x({ ["Fragment"]: () => (__WEBPACK_EXTERNAL_MODULE_vue__.Fragment), ["createVNode"]: () => (__WEBPACK_EXTERNAL_MODULE_vue__.createVNode), ["defineComponent"]: () => (__WEBPACK_EXTERNAL_MODULE_vue__.defineComponent), ["getCurrentInstance"]: () => (__WEBPACK_EXTERNAL_MODULE_vue__.getCurrentInstance), ["isVNode"]: () => (__WEBPACK_EXTERNAL_MODULE_vue__.isVNode), ["mergeProps"]: () => (__WEBPACK_EXTERNAL_MODULE_vue__.mergeProps), ["useAttrs"]: () => (__WEBPACK_EXTERNAL_MODULE_vue__.useAttrs), ["useSlots"]: () => (__WEBPACK_EXTERNAL_MODULE_vue__.useSlots) });
511
+ const external_vue_namespaceObject = external_vue_x({ ["createVNode"]: () => (__WEBPACK_EXTERNAL_MODULE_vue__.createVNode), ["defineComponent"]: () => (__WEBPACK_EXTERNAL_MODULE_vue__.defineComponent), ["getCurrentInstance"]: () => (__WEBPACK_EXTERNAL_MODULE_vue__.getCurrentInstance), ["isVNode"]: () => (__WEBPACK_EXTERNAL_MODULE_vue__.isVNode), ["mergeProps"]: () => (__WEBPACK_EXTERNAL_MODULE_vue__.mergeProps), ["useAttrs"]: () => (__WEBPACK_EXTERNAL_MODULE_vue__.useAttrs), ["useSlots"]: () => (__WEBPACK_EXTERNAL_MODULE_vue__.useSlots) });
512
512
  // EXTERNAL MODULE: ../../node_modules/@babel/runtime/regenerator/index.js
513
513
  var regenerator = __webpack_require__(5799);
514
514
  var regenerator_default = /*#__PURE__*/__webpack_require__.n(regenerator);
@@ -654,14 +654,14 @@ sliderProps.width["default"] = '400';
654
654
  var modelSlot = {
655
655
  header: function header() {
656
656
  var _slots$header, _slots$header2;
657
- return (0,external_vue_namespaceObject.createVNode)(external_vue_namespaceObject.Fragment, null, [(0,external_vue_namespaceObject.createVNode)("div", {
657
+ return (0,external_vue_namespaceObject.createVNode)("div", {
658
658
  "class": "".concat(resolveClassName('sideslider-header'))
659
659
  }, [(0,external_vue_namespaceObject.createVNode)("div", {
660
660
  "class": "".concat(resolveClassName('sideslider-close')),
661
661
  "onClick": handleClose
662
662
  }, [props.direction === 'left' ? (0,external_vue_namespaceObject.createVNode)(icon_namespaceObject.AngleLeft, null, null) : (0,external_vue_namespaceObject.createVNode)(icon_namespaceObject.AngleRight, null, null)]), (0,external_vue_namespaceObject.createVNode)("div", {
663
663
  "class": "".concat(resolveClassName('sideslider-title'))
664
- }, [(_slots$header = (_slots$header2 = slots.header) === null || _slots$header2 === void 0 ? void 0 : _slots$header2.call(slots)) !== null && _slots$header !== void 0 ? _slots$header : props.title])])]);
664
+ }, [(_slots$header = (_slots$header2 = slots.header) === null || _slots$header2 === void 0 ? void 0 : _slots$header2.call(slots)) !== null && _slots$header !== void 0 ? _slots$header : props.title])]);
665
665
  },
666
666
  "default": function _default() {
667
667
  var _slots$default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bkui-vue",
3
- "version": "2.0.2-beta.6",
3
+ "version": "2.0.2-beta.8",
4
4
  "workspaces": [
5
5
  "packages/**",
6
6
  "scripts/cli",