bkui-vue 0.0.1-beta.20 → 0.0.1-beta.21

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.
Files changed (46) hide show
  1. package/README.md +7 -3
  2. package/README_EN.md +7 -3
  3. package/dist/bkui-vue.cjs.js +230 -208
  4. package/dist/bkui-vue.esm.js +230 -208
  5. package/dist/bkui-vue.umd.js +230 -208
  6. package/dist/style.css +127 -85
  7. package/lib/button/button.css +9 -0
  8. package/lib/button/button.d.ts +25 -1
  9. package/lib/button/button.less +18 -10
  10. package/lib/button/button.variable.css +9 -0
  11. package/lib/button/index.d.ts +42 -4
  12. package/lib/button/index.js +1 -1
  13. package/lib/code-diff/code-diff.css +114 -0
  14. package/lib/code-diff/code-diff.d.ts +71 -0
  15. package/lib/code-diff/code-diff.less +144 -0
  16. package/lib/code-diff/code-diff.variable.css +207 -0
  17. package/lib/code-diff/index.d.ts +6 -0
  18. package/lib/date-picker/date-picker.d.ts +20 -130
  19. package/lib/date-picker/index.js +1 -1
  20. package/lib/date-picker/interface.d.ts +1 -1
  21. package/lib/date-picker/props.d.ts +111 -0
  22. package/lib/directives/clickoutside.d.ts +3 -23
  23. package/lib/directives/index.js +2 -2
  24. package/lib/input/index.d.ts +58 -4
  25. package/lib/input/index.js +2 -2
  26. package/lib/input/input.css +19 -2
  27. package/lib/input/input.d.ts +31 -1
  28. package/lib/input/input.less +25 -3
  29. package/lib/input/input.variable.css +19 -2
  30. package/lib/loading/index.d.ts +31 -9
  31. package/lib/loading/index.js +1 -1
  32. package/lib/loading/loading.css +98 -71
  33. package/lib/loading/loading.d.ts +23 -8
  34. package/lib/loading/loading.less +62 -49
  35. package/lib/loading/loading.variable.css +98 -71
  36. package/lib/shared/index.js +1 -1
  37. package/lib/shared/vue-types.d.ts +4 -0
  38. package/lib/tree/index.d.ts +17 -24
  39. package/lib/tree/index.js +1 -1
  40. package/lib/tree/props.d.ts +9 -8
  41. package/lib/tree/tree.css +1 -12
  42. package/lib/tree/tree.d.ts +8 -11
  43. package/lib/tree/tree.less +10 -24
  44. package/lib/tree/tree.variable.css +1 -12
  45. package/lib/tree/util.d.ts +9 -1
  46. package/package.json +1 -1
@@ -186,7 +186,7 @@ var __publicField = (obj, key, value) => {
186
186
  }
187
187
  return node;
188
188
  }
189
- function isElement$1(node) {
189
+ function isElement$2(node) {
190
190
  var OwnElement = getWindow(node).Element;
191
191
  return node instanceof OwnElement || node instanceof Element;
192
192
  }
@@ -340,7 +340,7 @@ var __publicField = (obj, key, value) => {
340
340
  return ["table", "td", "th"].indexOf(getNodeName(element)) >= 0;
341
341
  }
342
342
  function getDocumentElement(element) {
343
- return ((isElement$1(element) ? element.ownerDocument : element.document) || window.document).documentElement;
343
+ return ((isElement$2(element) ? element.ownerDocument : element.document) || window.document).documentElement;
344
344
  }
345
345
  function getParentNode(element) {
346
346
  if (getNodeName(element) === "html") {
@@ -748,17 +748,17 @@ var __publicField = (obj, key, value) => {
748
748
  return rect;
749
749
  }
750
750
  function getClientRectFromMixedType(element, clippingParent) {
751
- return clippingParent === viewport ? rectToClientRect(getViewportRect(element)) : isElement$1(clippingParent) ? getInnerBoundingClientRect(clippingParent) : rectToClientRect(getDocumentRect(getDocumentElement(element)));
751
+ return clippingParent === viewport ? rectToClientRect(getViewportRect(element)) : isElement$2(clippingParent) ? getInnerBoundingClientRect(clippingParent) : rectToClientRect(getDocumentRect(getDocumentElement(element)));
752
752
  }
753
753
  function getClippingParents(element) {
754
754
  var clippingParents2 = listScrollParents(getParentNode(element));
755
755
  var canEscapeClipping = ["absolute", "fixed"].indexOf(getComputedStyle(element).position) >= 0;
756
756
  var clipperElement = canEscapeClipping && isHTMLElement(element) ? getOffsetParent(element) : element;
757
- if (!isElement$1(clipperElement)) {
757
+ if (!isElement$2(clipperElement)) {
758
758
  return [];
759
759
  }
760
760
  return clippingParents2.filter(function(clippingParent) {
761
- return isElement$1(clippingParent) && contains(clippingParent, clipperElement) && getNodeName(clippingParent) !== "body";
761
+ return isElement$2(clippingParent) && contains(clippingParent, clipperElement) && getNodeName(clippingParent) !== "body";
762
762
  });
763
763
  }
764
764
  function getClippingRect(element, boundary, rootBoundary) {
@@ -840,7 +840,7 @@ var __publicField = (obj, key, value) => {
840
840
  var altContext = elementContext === popper$1 ? reference : popper$1;
841
841
  var popperRect = state.rects.popper;
842
842
  var element = state.elements[altBoundary ? altContext : elementContext];
843
- var clippingClientRect = getClippingRect(isElement$1(element) ? element : element.contextElement || getDocumentElement(state.elements.popper), boundary, rootBoundary);
843
+ var clippingClientRect = getClippingRect(isElement$2(element) ? element : element.contextElement || getDocumentElement(state.elements.popper), boundary, rootBoundary);
844
844
  var referenceClientRect = getBoundingClientRect(state.elements.reference);
845
845
  var popperOffsets2 = computeOffsets({
846
846
  reference: referenceClientRect,
@@ -1357,7 +1357,7 @@ var __publicField = (obj, key, value) => {
1357
1357
  cleanupModifierEffects();
1358
1358
  state.options = Object.assign({}, defaultOptions, state.options, options2);
1359
1359
  state.scrollParents = {
1360
- reference: isElement$1(reference2) ? listScrollParents(reference2) : reference2.contextElement ? listScrollParents(reference2.contextElement) : [],
1360
+ reference: isElement$2(reference2) ? listScrollParents(reference2) : reference2.contextElement ? listScrollParents(reference2.contextElement) : [],
1361
1361
  popper: listScrollParents(popper2)
1362
1362
  };
1363
1363
  var orderedModifiers = orderModifiers(mergeByName([].concat(defaultModifiers2, state.options.modifiers)));
@@ -1407,7 +1407,7 @@ var __publicField = (obj, key, value) => {
1407
1407
  resolve(state);
1408
1408
  });
1409
1409
  }),
1410
- destroy: function destroy2() {
1410
+ destroy: function destroy() {
1411
1411
  cleanupModifierEffects();
1412
1412
  isDestroyed = true;
1413
1413
  }
@@ -1556,7 +1556,7 @@ var __publicField = (obj, key, value) => {
1556
1556
  return result;
1557
1557
  };
1558
1558
  }
1559
- function isElement(obj) {
1559
+ function isElement$1(obj) {
1560
1560
  try {
1561
1561
  return obj instanceof HTMLElement;
1562
1562
  } catch (e) {
@@ -1658,13 +1658,13 @@ var __publicField = (obj, key, value) => {
1658
1658
  }
1659
1659
  restorePopContent() {
1660
1660
  const target = this.getAppendToTarget();
1661
- if (isElement(target) && target.contains(this.popperRefer) && this.container && !this.container.contains(this.popperRefer)) {
1661
+ if (isElement$1(target) && target.contains(this.popperRefer) && this.container && !this.container.contains(this.popperRefer)) {
1662
1662
  this.container.append(this.popperRefer);
1663
1663
  }
1664
1664
  }
1665
1665
  appendToTarget() {
1666
1666
  const target = this.getAppendToTarget();
1667
- if (isElement(target) && target.contains(this.popperRefer)) {
1667
+ if (isElement$1(target) && target.contains(this.popperRefer)) {
1668
1668
  target.append(this.popperRefer);
1669
1669
  }
1670
1670
  }
@@ -1745,7 +1745,7 @@ var __publicField = (obj, key, value) => {
1745
1745
  return null;
1746
1746
  }
1747
1747
  isElement(obj) {
1748
- return isElement(obj);
1748
+ return isElement$1(obj);
1749
1749
  }
1750
1750
  registerEvents() {
1751
1751
  if (this.isElement(this.referenceTarget)) {
@@ -2273,6 +2273,12 @@ ${$(r2)}`), n2;
2273
2273
  class z extends R() {
2274
2274
  }
2275
2275
  const propTypesNS = R({});
2276
+ function stringEnum(o2) {
2277
+ return o2.reduce((res, key) => {
2278
+ res[key] = key;
2279
+ return res;
2280
+ }, /* @__PURE__ */ Object.create(null));
2281
+ }
2276
2282
  class PropTypes extends propTypesNS {
2277
2283
  static size(sizes = ["small", "default", "large"]) {
2278
2284
  return j("Size", {
@@ -2296,8 +2302,7 @@ ${$(r2)}`), n2;
2296
2302
  }
2297
2303
  console.error(`invalid theme, ${val}, the theme must be one of \u3010${themes.join(" | ")}\u3011`);
2298
2304
  return false;
2299
- },
2300
- default: "primary"
2305
+ }
2301
2306
  });
2302
2307
  }
2303
2308
  static placement(placements2 = ["top", "left", "right", "bottom"]) {
@@ -2869,12 +2874,12 @@ ${$(r2)}`), n2;
2869
2874
  }) {
2870
2875
  const container = vue.ref(null);
2871
2876
  const el = vue.ref(null);
2872
- const visiable = vue.ref(false);
2877
+ const visible = vue.ref(false);
2873
2878
  const zIndex = vue.ref(bkZIndexManager.getModalNextIndex());
2874
2879
  const styleBottom = `${props.bottom}px`;
2875
2880
  const styleRight = `${props.right}px`;
2876
2881
  const scrollHandler = throttle(() => {
2877
- visiable.value = el.value.scrollTop >= props.visibilityHeight;
2882
+ visible.value = el.value.scrollTop >= props.visibilityHeight;
2878
2883
  }, 30);
2879
2884
  const scrollTop = () => {
2880
2885
  el.value.scrollTo({
@@ -2882,7 +2887,7 @@ ${$(r2)}`), n2;
2882
2887
  behavior: "smooth"
2883
2888
  });
2884
2889
  };
2885
- vue.watch(() => visiable, () => {
2890
+ vue.watch(() => visible, () => {
2886
2891
  zIndex.value = bkZIndexManager.getModalNextIndex();
2887
2892
  });
2888
2893
  vue.onMounted(() => {
@@ -2905,7 +2910,7 @@ ${$(r2)}`), n2;
2905
2910
  }, {
2906
2911
  default: () => {
2907
2912
  var _a, _b;
2908
- return [visiable.value ? vue.createVNode("div", {
2913
+ return [visible.value ? vue.createVNode("div", {
2909
2914
  "class": `bk-backtop ${props.extCls}`,
2910
2915
  "style": {
2911
2916
  right: styleRight,
@@ -3060,11 +3065,12 @@ ${$(r2)}`), n2;
3060
3065
  const BkBreadcrumb = withInstallProps(Component$q, { Item: BreadcrumbItem });
3061
3066
  let BkLoadingMode;
3062
3067
  (function(BkLoadingMode2) {
3063
- BkLoadingMode2["Spin"] = "spin";
3064
3068
  BkLoadingMode2["Default"] = "default";
3069
+ BkLoadingMode2["Spin"] = "spin";
3065
3070
  })(BkLoadingMode || (BkLoadingMode = {}));
3066
3071
  let BkLoadingSize;
3067
3072
  (function(BkLoadingSize2) {
3073
+ BkLoadingSize2["Mini"] = "mini";
3068
3074
  BkLoadingSize2["Small"] = "small";
3069
3075
  BkLoadingSize2["Large"] = "large";
3070
3076
  })(BkLoadingSize || (BkLoadingSize = {}));
@@ -3079,8 +3085,8 @@ ${$(r2)}`), n2;
3079
3085
  loading: PropTypes.bool,
3080
3086
  theme: PropTypes.theme(["white", "primary", "warning", "success", "danger"]),
3081
3087
  title: PropTypes.string.def(""),
3082
- size: PropTypes.size(),
3083
- mode: PropTypes.oneOf(Object.values(BkLoadingMode))
3088
+ size: PropTypes.commonType(Object.values(BkLoadingSize)).def("small"),
3089
+ mode: PropTypes.commonType(Object.values(BkLoadingMode)).def("default")
3084
3090
  };
3085
3091
  var Component$p = vue.defineComponent({
3086
3092
  name: "Loading",
@@ -3097,13 +3103,14 @@ ${$(r2)}`), n2;
3097
3103
  const loadingWrapperCls = vue.computed(() => classes({
3098
3104
  "bk-nested-loading": !!ctx.slots.default
3099
3105
  }, "bk-loading-wrapper"));
3106
+ console.log(props.theme);
3100
3107
  const containerCls = vue.computed(() => classes({
3101
- [`bk-loading-size-${props.size}`]: !props.size,
3102
- [`bk-loading-${props.theme}`]: !props.theme
3108
+ [`bk-loading-size-${props.size}`]: !!props.size,
3109
+ [`bk-loading-${props.theme}`]: !!props.theme
3103
3110
  }, "bk-loading-indicator"));
3104
3111
  const hasTitle = vue.computed(() => !!props.title);
3105
3112
  const indicator = vue.computed(() => {
3106
- const isSpinMode = props.mode === "spin";
3113
+ const isSpinMode = props.mode === BkLoadingMode.Spin;
3107
3114
  if (typeof props.indicator === "function") {
3108
3115
  return vue.createVNode(props.indicator, null, null);
3109
3116
  }
@@ -3132,8 +3139,11 @@ ${$(r2)}`), n2;
3132
3139
  hoverTheme: PropTypes.theme(["primary", "warning", "success", "danger"]).def(""),
3133
3140
  size: PropTypes.size(),
3134
3141
  title: PropTypes.string,
3142
+ icon: PropTypes.string,
3143
+ iconRight: PropTypes.string,
3135
3144
  disabled: PropTypes.bool,
3136
3145
  loading: PropTypes.bool,
3146
+ laodingMode: PropTypes.commonType(Object.values(BkLoadingMode)),
3137
3147
  outline: PropTypes.bool,
3138
3148
  text: PropTypes.bool,
3139
3149
  nativeType: {
@@ -3142,14 +3152,15 @@ ${$(r2)}`), n2;
3142
3152
  };
3143
3153
  var Component$o = vue.defineComponent({
3144
3154
  name: "Button",
3145
- emits: ["click"],
3146
3155
  props: buttonProps,
3156
+ emits: ["click", "mouseover"],
3147
3157
  setup(props, {
3148
3158
  slots,
3149
3159
  attrs,
3150
3160
  emit
3151
3161
  }) {
3152
3162
  var _a;
3163
+ const isHover = vue.ref(false);
3153
3164
  const showSlot = (_a = slots.default) != null ? _a : false;
3154
3165
  const btnClsPrefix = "bk-button";
3155
3166
  const btnCls = vue.computed(() => {
@@ -3164,28 +3175,44 @@ ${$(r2)}`), n2;
3164
3175
  "no-slot": !showSlot
3165
3176
  }, `${themeCls} ${btnClsPrefix} ${hoverTheme}`);
3166
3177
  });
3167
- const bkLoadingCls = `${btnClsPrefix}-loading`;
3168
- const loadingTheme = ["", "default"].includes(props.theme) ? "default" : "white";
3178
+ const loadingTheme = vue.computed(() => {
3179
+ if (props.text || props.outline || props.hoverTheme) {
3180
+ if (isHover.value && !props.text)
3181
+ return "white";
3182
+ return props.hoverTheme || props.theme;
3183
+ }
3184
+ return ["", "default"].includes(props.theme) ? "" : "white";
3185
+ });
3186
+ const loadingSize = vue.computed(() => props.size === BkLoadingSize.Small ? BkLoadingSize.Mini : BkLoadingSize.Small);
3169
3187
  const handleClick = () => {
3170
3188
  emit("click");
3171
3189
  };
3190
+ const handleMouseOver = () => {
3191
+ isHover.value = true;
3192
+ emit("mouseover");
3193
+ };
3194
+ const handleMouseout = () => {
3195
+ isHover.value = false;
3196
+ };
3172
3197
  return () => {
3173
- var _a2, _b;
3198
+ var _a2;
3174
3199
  return vue.createVNode("button", vue.mergeProps({
3175
3200
  "title": props.title,
3176
3201
  "disabled": props.disabled,
3177
3202
  "class": btnCls.value,
3178
3203
  "type": props.nativeType
3179
3204
  }, attrs, {
3180
- "onClick": handleClick
3181
- }), [props.loading ? vue.createVNode("div", {
3182
- "class": bkLoadingCls
3183
- }, [vue.createVNode(BkLoading, {
3184
- "theme": loadingTheme,
3185
- "size": BkLoadingSize.Small
3186
- }, null)]) : vue.createVNode("div", {
3187
- "class": "bk-button-content-wrapper"
3188
- }, [vue.createVNode("span", null, [(_b = (_a2 = slots.default) == null ? void 0 : _a2.call(slots)) != null ? _b : "default"])])]);
3205
+ "onClick": handleClick,
3206
+ "onMouseover": handleMouseOver,
3207
+ "onMouseleave": handleMouseout
3208
+ }), [props.loading && vue.createVNode(BkLoading, {
3209
+ "class": `${btnClsPrefix}-loading`,
3210
+ "mode": props.laodingMode,
3211
+ "theme": loadingTheme.value,
3212
+ "size": loadingSize.value
3213
+ }, null), slots.default && vue.createVNode("span", {
3214
+ "class": `${btnClsPrefix}-text`
3215
+ }, [(_a2 = slots.default) == null ? void 0 : _a2.call(slots)])]);
3189
3216
  };
3190
3217
  }
3191
3218
  });
@@ -3850,19 +3877,24 @@ ${$(r2)}`), n2;
3850
3877
  max: PropTypes.integer,
3851
3878
  min: PropTypes.integer,
3852
3879
  maxlength: PropTypes.integer,
3880
+ behavior: PropTypes.commonType(["simplicity", "normal"]).def("normal"),
3853
3881
  showWordLimit: PropTypes.bool,
3854
3882
  showControl: PropTypes.bool.def(true),
3883
+ showClearOnlyHover: PropTypes.bool.def(false),
3855
3884
  precision: PropTypes.number.def(0).validate((val) => val >= 0 && val < 20),
3856
3885
  modelValue: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
3857
3886
  size: PropTypes.size()
3858
3887
  };
3888
+ const inputEvents = ["update:modelValue", "focus", "blur", "change", "clear", "input", "keypress", "keydown", "keyup", "enter", "paste"];
3889
+ const EventEnum = stringEnum([...inputEvents]);
3859
3890
  var Component$g = vue.defineComponent({
3860
3891
  name: "Input",
3861
3892
  inheritAttrs: false,
3862
3893
  props: inputType,
3863
- emits: ["update:modelValue", "focus", "blur", "change", "clear", "input", "keydown"],
3894
+ emits: [...inputEvents],
3864
3895
  setup(props, ctx) {
3865
3896
  const isFocused = vue.ref(false);
3897
+ const isCNInput = vue.ref(false);
3866
3898
  const inputClsPrefix = "bk-input";
3867
3899
  const _a = ctx.attrs, {
3868
3900
  class: cls,
@@ -3876,6 +3908,7 @@ ${$(r2)}`), n2;
3876
3908
  "is-focused": isFocused.value,
3877
3909
  "is-readonly": props.readonly,
3878
3910
  "is-disabled": props.disabled,
3911
+ "is-simplicity": props.behavior === "simplicity",
3879
3912
  [`${cls}`]: !!cls
3880
3913
  }, inputClsPrefix));
3881
3914
  const suffixIconMap = {
@@ -3900,33 +3933,51 @@ ${$(r2)}`), n2;
3900
3933
  const isNumberInput = vue.computed(() => props.type === "number");
3901
3934
  const ceilMaxLength = vue.computed(() => Math.floor(props.maxlength));
3902
3935
  const pwdVisible = vue.ref(false);
3936
+ const clearCls = vue.computed(() => classes({
3937
+ "show-clear-only-hover": props.showClearOnlyHover
3938
+ }, suffixCls));
3903
3939
  function clear() {
3904
- ctx.emit("update:modelValue", "");
3905
- ctx.emit("change", "");
3906
- ctx.emit("clear");
3940
+ ctx.emit(EventEnum["update:modelValue"], "");
3941
+ ctx.emit(EventEnum.change, "");
3942
+ ctx.emit(EventEnum.clear);
3907
3943
  }
3908
3944
  function handleFocus(e) {
3909
3945
  isFocused.value = true;
3910
- ctx.emit("focus", e);
3946
+ ctx.emit(EventEnum.focus, e);
3911
3947
  }
3912
3948
  function handleBlur(e) {
3913
3949
  isFocused.value = false;
3914
- ctx.emit("blur", e);
3915
- }
3916
- function handleInput(e) {
3917
- ctx.emit("update:modelValue", isNumberInput.value ? +e.target.value : e.target.value);
3918
- ctx.emit("input", e.target.value);
3950
+ ctx.emit(EventEnum.blur, e);
3951
+ }
3952
+ function eventHandler(eventName) {
3953
+ return (e) => {
3954
+ let originEventName = eventName;
3955
+ if (e.code === "Enter" || e.key === "Enter" || e.keyCode === 13) {
3956
+ originEventName = EventEnum.enter;
3957
+ if (e.type !== EventEnum.keyup)
3958
+ return;
3959
+ }
3960
+ if (isCNInput.value && [EventEnum.input, EventEnum.change].some((e2) => eventName === e2))
3961
+ return;
3962
+ if (eventName === EventEnum.input) {
3963
+ ctx.emit(EventEnum["update:modelValue"], isNumberInput.value ? +e.target.value : e.target.value);
3964
+ }
3965
+ ctx.emit(originEventName, e.target.value, e);
3966
+ };
3919
3967
  }
3920
- function handleKeydown(e) {
3921
- ctx.emit("keydown", e.target.value, e);
3968
+ const [handleKeyup, handleKeydown, handleKeyPress, handlePaste, handleChange, handleInput] = [EventEnum.keyup, EventEnum.keydown, EventEnum.keypress, EventEnum.paste, EventEnum.change, EventEnum.input].map(eventHandler);
3969
+ function handleCompositionStart() {
3970
+ isCNInput.value = true;
3922
3971
  }
3923
- function handleChange(e) {
3924
- ctx.emit("change", e.target.value, e);
3972
+ function handleCompositionEnd(e) {
3973
+ isCNInput.value = false;
3974
+ handleInput(e);
3925
3975
  }
3926
3976
  function handleNumber(step, INC = true) {
3977
+ const numStep = parseInt(String(step), 10);
3927
3978
  const precision = Number.isInteger(props.precision) ? props.precision : 0;
3928
3979
  const val = parseFloat(props.modelValue.toString());
3929
- const factor = Number.isInteger(step) ? step : 1;
3980
+ const factor = Number.isInteger(numStep) ? numStep : 1;
3930
3981
  let newVal = val + (INC ? factor : -1 * factor);
3931
3982
  if (Number.isInteger(props.max)) {
3932
3983
  newVal = Math.min(newVal, props.max);
@@ -3937,12 +3988,12 @@ ${$(r2)}`), n2;
3937
3988
  return +newVal.toFixed(precision);
3938
3989
  }
3939
3990
  function handleInc() {
3940
- const newVal = handleNumber(parseInt(String(props.step), 10));
3941
- ctx.emit("update:modelValue", newVal);
3991
+ const newVal = handleNumber(props.step);
3992
+ ctx.emit(EventEnum["update:modelValue"], newVal);
3942
3993
  }
3943
3994
  function handleDec() {
3944
- const newVal = handleNumber(parseInt(String(props.step), 10), false);
3945
- ctx.emit("update:modelValue", newVal);
3995
+ const newVal = handleNumber(props.step, false);
3996
+ ctx.emit(EventEnum["update:modelValue"], newVal);
3946
3997
  }
3947
3998
  function getCls(name) {
3948
3999
  return `${inputClsPrefix}--${name}`;
@@ -3973,11 +4024,16 @@ ${$(r2)}`), n2;
3973
4024
  "onInput": handleInput,
3974
4025
  "onFocus": handleFocus,
3975
4026
  "onBlur": handleBlur,
4027
+ "onPaste": handlePaste,
3976
4028
  "onChange": handleChange,
3977
- "onKeydown": handleKeydown
4029
+ "onKeypress": handleKeyPress,
4030
+ "onKeydown": handleKeydown,
4031
+ "onKeyup": handleKeyup,
4032
+ "onCompositionstart": handleCompositionStart,
4033
+ "onCompositionend": handleCompositionEnd
3978
4034
  }), null), props.clearable && !!props.modelValue && vue.createVNode(close$1, {
3979
4035
  "onClick": clear,
3980
- "class": suffixCls
4036
+ "class": clearCls.value
3981
4037
  }, null), suffixIcon.value, typeof props.maxlength === "number" && props.showWordLimit && vue.createVNode("p", {
3982
4038
  "class": getCls("max-length")
3983
4039
  }, [props.modelValue.toString().length, vue.createTextVNode("/"), vue.createVNode("span", null, [ceilMaxLength.value])]), isNumberInput.value && props.showControl && vue.createVNode("div", {
@@ -5004,92 +5060,72 @@ ${$(r2)}`), n2;
5004
5060
  mousewheelHandler(el, binding.value);
5005
5061
  }
5006
5062
  };
5007
- const nodeMap = /* @__PURE__ */ new Map();
5008
- function parseBindingValue(value) {
5009
- const isTouch = "ontouchstart" in window || (navigator == null ? void 0 : navigator.maxTouchPoints) > 0;
5010
- const defaultOption = {
5011
- handler() {
5012
- },
5013
- capture: true,
5014
- disabled: false,
5015
- detectIframe: true,
5016
- exclude: [],
5017
- events: isTouch ? ["ontouchstart"] : ["click"]
5018
- };
5019
- if (typeof value === "function") {
5020
- defaultOption.handler = value;
5021
- return defaultOption;
5022
- }
5023
- return Object.assign({}, defaultOption);
5024
- }
5025
- function onEvent(config) {
5026
- var _a;
5027
- const { el, event, handler, disabled } = config;
5028
- const path = (_a = event.composedPath) == null ? void 0 : _a.call(event);
5029
- const isClickOutside = path ? path.indexOf(el) < 0 : !el.contains(event.target);
5030
- if (!isClickOutside || !!disabled)
5031
- return;
5032
- handler(event);
5033
- }
5034
- function onIframeClick(config) {
5035
- const { activeElement } = document;
5036
- const { el, handler, disabled, event } = config;
5037
- if (activeElement && activeElement.tagName === "IFRAME" && !el.contains(activeElement) && !disabled) {
5038
- handler(event);
5039
- }
5040
- }
5041
- function getEventConfigList(el, options) {
5042
- const configList = options.events.map((name) => ({
5043
- event: name,
5044
- target: document.documentElement,
5045
- capture: options.capture,
5046
- handler: (event) => onEvent({ el, event, handler: options.handler, disabled: options.disabled })
5047
- }));
5048
- if (options.detectIframe) {
5049
- configList.push({
5050
- event: "blur",
5051
- target: window,
5052
- capture: options.capture,
5053
- handler: (event) => onIframeClick({ el, event, handler: options.handler, disabled: options.disabled })
5054
- });
5055
- }
5056
- return configList;
5057
- }
5058
- function init(el, options) {
5059
- if (nodeMap.has(el)) {
5060
- destroy(el);
5063
+ const isElement = (e) => {
5064
+ if (typeof Element === "undefined")
5065
+ return false;
5066
+ return e instanceof Element;
5067
+ };
5068
+ const nodeList = /* @__PURE__ */ new Map();
5069
+ let startClick;
5070
+ document.addEventListener("mousedown", (e) => startClick = e);
5071
+ document.addEventListener("mouseup", (e) => {
5072
+ for (const handlers of nodeList.values()) {
5073
+ for (const { documentHandler } of handlers) {
5074
+ documentHandler(e, startClick);
5075
+ }
5061
5076
  }
5062
- const configList = getEventConfigList(el, options);
5063
- nodeMap.set(el, configList);
5064
- configList.forEach((config) => {
5065
- const { target, event, handler, capture } = config;
5066
- target.addEventListener(event, handler, capture);
5067
- });
5068
- }
5069
- function destroy(el) {
5070
- var _a;
5071
- const configList = (_a = nodeMap.get(el)) != null ? _a : [];
5072
- configList.forEach((config) => {
5073
- const { target, event, handler, capture } = config;
5074
- target.removeEventListener(event, handler, capture);
5075
- });
5076
- nodeMap.delete(el);
5077
+ });
5078
+ function createDocumentHandler(el, binding) {
5079
+ let excludes = [];
5080
+ if (Array.isArray(binding.arg)) {
5081
+ excludes = binding.arg;
5082
+ } else if (isElement(binding.arg)) {
5083
+ excludes.push(binding.arg);
5084
+ }
5085
+ return function(mouseup, mousedown) {
5086
+ const { popperRef } = binding.instance;
5087
+ const mouseUpTarget = mouseup.target;
5088
+ const mouseDownTarget = mousedown == null ? void 0 : mousedown.target;
5089
+ const isBound = !binding || !binding.instance;
5090
+ const isTargetExists = !mouseUpTarget || !mouseDownTarget;
5091
+ const isContainedByEl = el.contains(mouseUpTarget) || el.contains(mouseDownTarget);
5092
+ const isSelf = el === mouseUpTarget;
5093
+ const isTargetExcluded = excludes.length && excludes.some((item) => item == null ? void 0 : item.contains(mouseUpTarget)) || excludes.length && excludes.includes(mouseDownTarget);
5094
+ const isContainedByPopper = popperRef && (popperRef.contains(mouseUpTarget) || popperRef.contains(mouseDownTarget));
5095
+ if (isBound || isTargetExists || isContainedByEl || isSelf || isTargetExcluded || isContainedByPopper) {
5096
+ return;
5097
+ }
5098
+ binding.value(mouseup, mousedown);
5099
+ };
5077
5100
  }
5078
- const clickoutside = {
5101
+ const ClickOutside = {
5079
5102
  beforeMount(el, binding) {
5080
- const options = parseBindingValue(binding.value);
5081
- if (options.disabled)
5082
- return;
5083
- nodeMap.set(el, getEventConfigList(el, options));
5103
+ if (!nodeList.has(el)) {
5104
+ nodeList.set(el, []);
5105
+ }
5106
+ nodeList.get(el).push({
5107
+ documentHandler: createDocumentHandler(el, binding),
5108
+ bindingFn: binding.value
5109
+ });
5084
5110
  },
5085
5111
  updated(el, binding) {
5086
- const newOptions = parseBindingValue(binding.value);
5087
- if (newOptions.disabled && !nodeMap.has(el))
5088
- return;
5089
- init(el, newOptions);
5112
+ if (!nodeList.has(el)) {
5113
+ nodeList.set(el, []);
5114
+ }
5115
+ const handlers = nodeList.get(el);
5116
+ const oldHandlerIndex = handlers.findIndex((item) => item.bindingFn === binding.oldValue);
5117
+ const newHandler = {
5118
+ documentHandler: createDocumentHandler(el, binding),
5119
+ bindingFn: binding.value
5120
+ };
5121
+ if (oldHandlerIndex >= 0) {
5122
+ handlers.splice(oldHandlerIndex, 1, newHandler);
5123
+ } else {
5124
+ handlers.push(newHandler);
5125
+ }
5090
5126
  },
5091
5127
  unmounted(el) {
5092
- destroy(el);
5128
+ nodeList.delete(el);
5093
5129
  }
5094
5130
  };
5095
5131
  var popper = "";
@@ -5203,7 +5239,7 @@ ${$(r2)}`), n2;
5203
5239
  var Component$a = vue.defineComponent({
5204
5240
  name: "Select",
5205
5241
  directives: {
5206
- clickoutside
5242
+ clickoutside: ClickOutside
5207
5243
  },
5208
5244
  props: {
5209
5245
  modelValue: PropTypes.any,
@@ -5739,7 +5775,7 @@ ${$(r2)}`), n2;
5739
5775
  });
5740
5776
  defaultSteps.value.splice(0, defaultSteps.value.length, ...defaults);
5741
5777
  };
5742
- const init2 = () => {
5778
+ const init = () => {
5743
5779
  var _a;
5744
5780
  defaultSteps.value.splice(0, defaultSteps.value.length, ...[{
5745
5781
  title: "\u6B65\u9AA41",
@@ -5771,7 +5807,7 @@ ${$(r2)}`), n2;
5771
5807
  console.warn(e);
5772
5808
  }
5773
5809
  };
5774
- vue.onMounted(init2);
5810
+ vue.onMounted(init);
5775
5811
  return {
5776
5812
  defaultSteps,
5777
5813
  jumpTo
@@ -11534,7 +11570,20 @@ ${$(r2)}`), n2;
11534
11570
  type: String,
11535
11571
  default: "bottom-start",
11536
11572
  validator: (value) => {
11537
- const validList = ["top", "top-start", "top-end", "bottom", "bottom-start", "bottom-end", "left", "left-start", "left-end", "right", "right-start", "right-end"];
11573
+ const validList = [
11574
+ "top",
11575
+ "top-start",
11576
+ "top-end",
11577
+ "bottom",
11578
+ "bottom-start",
11579
+ "bottom-end",
11580
+ "left",
11581
+ "left-start",
11582
+ "left-end",
11583
+ "right",
11584
+ "right-start",
11585
+ "right-end"
11586
+ ];
11538
11587
  if (validList.indexOf(value) < 0) {
11539
11588
  console.error(`placement property is not valid: '${value}'`);
11540
11589
  return false;
@@ -11601,7 +11650,7 @@ ${$(r2)}`), n2;
11601
11650
  var Component$1 = vue.defineComponent({
11602
11651
  name: "DatePicker",
11603
11652
  directives: {
11604
- clickoutside
11653
+ clickoutside: ClickOutside
11605
11654
  },
11606
11655
  props: datePickerProps,
11607
11656
  emits: ["open-change", "input", "change", "update:modelValue", "clear", "shortcut-change", "pick-success"],
@@ -11720,6 +11769,7 @@ ${$(r2)}`), n2;
11720
11769
  };
11721
11770
  vue.watch(() => state.visible, (visible) => {
11722
11771
  var _a, _b;
11772
+ console.error(123);
11723
11773
  if (visible === false) {
11724
11774
  (_a = pickerDropdownRef.value) == null ? void 0 : _a.destoryDropdown();
11725
11775
  }
@@ -12247,7 +12297,7 @@ ${$(r2)}`), n2;
12247
12297
  if (!typeFlag.value) {
12248
12298
  generalInit();
12249
12299
  } else {
12250
- init2();
12300
+ init();
12251
12301
  }
12252
12302
  }
12253
12303
  };
@@ -12284,7 +12334,7 @@ ${$(r2)}`), n2;
12284
12334
  emit("change", dataList.value, [...handleListFormat(hasSelectedList.value, false)], []);
12285
12335
  }
12286
12336
  };
12287
- const init2 = () => {
12337
+ const init = () => {
12288
12338
  if (!props.targetList.length || props.targetList.length > props.sourceList.length) {
12289
12339
  dataList.value.splice(0, dataList.value.length, ...props.sourceList);
12290
12340
  hasSelectedList.value = [];
@@ -12417,7 +12467,7 @@ ${$(r2)}`), n2;
12417
12467
  if (!typeFlag.value) {
12418
12468
  generalInit();
12419
12469
  } else {
12420
- init2();
12470
+ init();
12421
12471
  }
12422
12472
  initSort();
12423
12473
  }
@@ -12750,7 +12800,10 @@ ${$(r2)}`), n2;
12750
12800
  };
12751
12801
  const getLabel = (item, props) => getStringOrFuncStr(item, props, "label");
12752
12802
  const getSchemaVal = (schema, uuid2) => schema.get(uuid2) || {};
12753
- const getNodeAttr = (schema, uuid2, key) => (getSchemaVal(schema, uuid2) || {})[key];
12803
+ const getNodeAttr = (schema, uuid2, key) => {
12804
+ var _a;
12805
+ return (_a = getSchemaVal(schema, uuid2)) == null ? void 0 : _a[key];
12806
+ };
12754
12807
  const getTreeStyle = (item, props) => {
12755
12808
  const levelLine = getPropsOneOfBoolValueWithDefault(props, "levelLine", item, DEFAULT_LEVLE_LINE, null, ["tree"]);
12756
12809
  return {
@@ -12761,14 +12814,11 @@ ${$(r2)}`), n2;
12761
12814
  };
12762
12815
  };
12763
12816
  const getNodeItemStyle = (item, props, flatData = {}) => {
12764
- const { levelLineSchema, schema } = flatData;
12765
- const { childNodeCount = 0, isLeaf = false, lastNode = null } = levelLineSchema[item.__uuid] || {};
12766
- const lastNodeCount = isLeaf ? 0 : (levelLineSchema[lastNode] || { childNodeCount: 0 }).childNodeCount;
12817
+ const { schema } = flatData;
12767
12818
  const depth = getNodeAttr(schema, item.__uuid, "__depth");
12768
12819
  return __spreadValues({
12769
12820
  "--depth": depth,
12770
- paddingLeft: 0,
12771
- "--lines": childNodeCount - lastNodeCount
12821
+ paddingLeft: 0
12772
12822
  }, typeof props.levelLine === "function" ? {
12773
12823
  "--level-line": getPropsOneOfBoolValueWithDefault(props, "levelLine", item, DEFAULT_LEVLE_LINE, null, [
12774
12824
  "node"
@@ -12781,16 +12831,20 @@ ${$(r2)}`), n2;
12781
12831
  "is-root": __isRoot,
12782
12832
  "bk-tree-node": true,
12783
12833
  "is-open": __isOpen,
12784
- "is-virtual-render": props.virtualRender
12834
+ "is-virtual-render": props.virtualRender,
12835
+ "level-line": props.levelLine
12785
12836
  };
12786
12837
  };
12787
12838
  const updateTreeNode = (path, treeData, childKey, nodekey, nodeValue) => {
12839
+ assignTreeNode(path, treeData, childKey, { [nodekey]: nodeValue });
12840
+ };
12841
+ const assignTreeNode = (path, treeData, childKey, assignVal) => {
12788
12842
  const paths = path.split("-");
12789
12843
  const targetNode = paths.reduce((pre, nodeIndex) => {
12790
12844
  const index = Number(nodeIndex);
12791
12845
  return Array.isArray(pre) ? pre[index] : pre[childKey][index];
12792
12846
  }, treeData);
12793
- Object.assign(targetNode, { [nodekey]: nodeValue });
12847
+ Object.assign(targetNode, assignVal || {});
12794
12848
  };
12795
12849
  const treeProps = {
12796
12850
  data: PropTypes.arrayOf(PropTypes.any).def([]),
@@ -12809,7 +12863,10 @@ ${$(r2)}`), n2;
12809
12863
  }),
12810
12864
  PropTypes.bool.def(false)
12811
12865
  ]).def(true),
12812
- asyncLoad: PropTypes.func.def(null)
12866
+ async: PropTypes.shape({
12867
+ callback: PropTypes.func.def(null),
12868
+ cache: PropTypes.bool.def(true)
12869
+ })
12813
12870
  };
12814
12871
  var Component = vue.defineComponent({
12815
12872
  name: "Tree",
@@ -12826,13 +12883,9 @@ ${$(r2)}`), n2;
12826
12883
  const formatData2 = getFlatdata(props, newData, schemaValues.value);
12827
12884
  flatData.data = formatData2[0];
12828
12885
  flatData.schema = formatData2[1];
12829
- computeLevelHeight();
12830
12886
  }, {
12831
12887
  deep: true
12832
12888
  });
12833
- vue.watch(() => [props.levelLine], () => {
12834
- computeLevelHeight();
12835
- });
12836
12889
  const schemaValues = vue.computed(() => Array.from(flatData.schema.values()));
12837
12890
  const getSchemaVal2 = (key) => flatData.schema.get(key);
12838
12891
  const getNodeAttr2 = (node, attr) => {
@@ -12847,7 +12900,6 @@ ${$(r2)}`), n2;
12847
12900
  const isNodeOpened = (node) => getNodeAttr2(node, "__isOpen");
12848
12901
  const hasChildNode = (node) => getNodeAttr2(node, "__hasChild");
12849
12902
  const renderData = vue.computed(() => flatData.data.filter((item) => checkNodeIsOpen(item)));
12850
- const renderNodePathColl = vue.computed(() => renderData.value.map((node) => getNodePath(node)));
12851
12903
  const isItemOpen = (item) => {
12852
12904
  var _a;
12853
12905
  if (typeof item === "object") {
@@ -12915,7 +12967,10 @@ ${$(r2)}`), n2;
12915
12967
  const setNodeOpened = (item) => {
12916
12968
  const newVal = !isItemOpen(item);
12917
12969
  setNodeAttr(item, "__isOpen", newVal);
12918
- computeLevelHeight();
12970
+ if (newVal) {
12971
+ return;
12972
+ }
12973
+ renderData.value.filter((node) => String.prototype.startsWith.call(getNodePath(node), getNodePath(item))).forEach((filterNode) => setNodeAttr(filterNode, "__isOpen", newVal));
12919
12974
  };
12920
12975
  const setNodeRemoteLoad = (resp, item) => {
12921
12976
  if (typeof resp === "object" && resp !== null) {
@@ -12926,12 +12981,20 @@ ${$(r2)}`), n2;
12926
12981
  };
12927
12982
  const hanldeTreeNodeClick = (item) => {
12928
12983
  if (item.async) {
12929
- if (typeof props.asyncLoad === "function") {
12984
+ const {
12985
+ callback = null,
12986
+ cache = true
12987
+ } = props.async || {};
12988
+ if (typeof callback === "function" && !item.cached) {
12930
12989
  Object.assign(item, {
12931
12990
  loading: true
12932
12991
  });
12933
- props.asyncLoad(item, (resp) => setNodeRemoteLoad(resp, item)).then((resp) => setNodeRemoteLoad(resp, item)).catch((err) => console.error("load remote data error:", err)).finally(() => {
12934
- updateTreeNode(getNodePath(item), props.data, props.children, "loading", false);
12992
+ callback(item, (resp) => setNodeRemoteLoad(resp, item)).then((resp) => setNodeRemoteLoad(resp, item)).catch((err) => console.error("load remote data error:", err)).finally(() => {
12993
+ assignTreeNode(getNodePath(item), props.data, props.children, __spreadValues({
12994
+ loading: false
12995
+ }, cache ? {
12996
+ cached: true
12997
+ } : {}));
12935
12998
  });
12936
12999
  } else {
12937
13000
  console.error("async need to set prop: asyncLoad with function wich will return promise object");
@@ -12941,47 +13004,6 @@ ${$(r2)}`), n2;
12941
13004
  setNodeOpened(item);
12942
13005
  }
12943
13006
  };
12944
- const computeLevelHeight = () => {
12945
- if (!!props.levelLine) {
12946
- setTimeout(() => {
12947
- let showNodeCount = renderData.value.length;
12948
- const nodeSchema = {};
12949
- const setDefaultNodeSchema = (uuid2, lastNode = null, isLeaf = false) => {
12950
- if (!Object.prototype.hasOwnProperty.call(nodeSchema, uuid2)) {
12951
- Object.assign(nodeSchema, {
12952
- [uuid2]: __spreadValues(__spreadValues({
12953
- childNodeCount: 0,
12954
- isLastNode: false
12955
- }, lastNode !== null ? {
12956
- lastNode
12957
- } : {}), isLeaf !== null ? {
12958
- isLeaf
12959
- } : {})
12960
- });
12961
- }
12962
- };
12963
- for (; showNodeCount > 0; showNodeCount--) {
12964
- const node = renderData.value[showNodeCount - 1];
12965
- const parentId = getNodeAttr2(node, "__parentId");
12966
- const nodepath = getNodePath(node);
12967
- const isLeaf = !renderNodePathColl.value.includes(`${nodepath}-0`);
12968
- setDefaultNodeSchema(node.__uuid, null, isLeaf);
12969
- setDefaultNodeSchema(parentId, node.__uuid);
12970
- const parentSchema = nodeSchema[parentId];
12971
- const currentNodeSchema = nodeSchema[node.__uuid];
12972
- const {
12973
- childNodeCount = 0
12974
- } = currentNodeSchema;
12975
- currentNodeSchema.childNodeCount = childNodeCount + 1;
12976
- currentNodeSchema.isLastNode = parentSchema.lastNode === node.__uuid;
12977
- parentSchema.childNodeCount += currentNodeSchema.childNodeCount;
12978
- }
12979
- flatData.levelLineSchema = nodeSchema;
12980
- });
12981
- } else {
12982
- flatData.levelLineSchema = {};
12983
- }
12984
- };
12985
13007
  const checkNodeIsOpen = (node) => isRootNode(node) || isItemOpen(node) || isItemOpen(getNodeAttr2(node, "__parentId"));
12986
13008
  const filterNextNode = (depth, node) => {
12987
13009
  if (isRootNode(node)) {
@@ -13000,7 +13022,7 @@ ${$(r2)}`), n2;
13000
13022
  return schemaValues.value.some((val) => val.__path === nextNodePath);
13001
13023
  };
13002
13024
  const getVirtualLines = (node) => {
13003
- if (!props.virtualRender) {
13025
+ if (!props.levelLine) {
13004
13026
  return null;
13005
13027
  }
13006
13028
  const getNodeLineStyle = (dpth) => ({
@@ -13012,7 +13034,6 @@ ${$(r2)}`), n2;
13012
13034
  "style": getNodeLineStyle(maxDeep - index)
13013
13035
  }, null));
13014
13036
  };
13015
- computeLevelHeight();
13016
13037
  return {
13017
13038
  renderData,
13018
13039
  flatData,
@@ -13036,7 +13057,8 @@ ${$(r2)}`), n2;
13036
13057
  "style": getTreeStyle(null, props),
13037
13058
  "list": this.renderData,
13038
13059
  "lineHeight": props.lineHeight,
13039
- "enabled": props.virtualRender
13060
+ "enabled": props.virtualRender,
13061
+ "throttleDelay": 0
13040
13062
  }, {
13041
13063
  default: (scoped) => (scoped.data || []).map(renderTreeNode)
13042
13064
  });
@@ -13445,7 +13467,7 @@ ${$(r2)}`), n2;
13445
13467
  exports2.Tree = BkTree;
13446
13468
  exports2.VirtualRender = BkVirtualRender;
13447
13469
  exports2.bkTooltips = tooltips;
13448
- exports2.clickoutside = clickoutside;
13470
+ exports2.clickoutside = ClickOutside;
13449
13471
  exports2["default"] = preset;
13450
13472
  exports2.mousewheel = mousewheel;
13451
13473
  Object.defineProperties(exports2, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });