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

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,6 +55,7 @@ var loading = "";
55
55
  var modal = "";
56
56
  var progress = "";
57
57
  var radio = "";
58
+ var radioButton = "";
58
59
  var rate = "";
59
60
  var star$1 = "";
60
61
  var swiper = "";
@@ -8075,34 +8076,6 @@ const formKey = Symbol("form");
8075
8076
  const formItemKey = Symbol("formItem");
8076
8077
  const useForm = () => inject(formKey);
8077
8078
  const useFormItem = () => inject(formItemKey, void 0);
8078
- const on$2 = (() => {
8079
- if (document.addEventListener) {
8080
- return (element, event, handler) => {
8081
- if (element && event && handler) {
8082
- element.addEventListener(event, handler, true);
8083
- }
8084
- };
8085
- }
8086
- return (element, event, handler) => {
8087
- if (element && event && handler) {
8088
- element.attachEvent(`on${event}`, handler);
8089
- }
8090
- };
8091
- })();
8092
- const off$2 = (() => {
8093
- if (document.removeEventListener) {
8094
- return (element, event, handler) => {
8095
- if (element && event) {
8096
- element.removeEventListener(event, handler, true);
8097
- }
8098
- };
8099
- }
8100
- return (element, event, handler) => {
8101
- if (element && event) {
8102
- element.detachEvent(`on${event}`, handler);
8103
- }
8104
- };
8105
- })();
8106
8079
  function scrollTop(el, from = 0, to, duration = 500, endCallback) {
8107
8080
  const difference = Math.abs(from - to);
8108
8081
  const step = Math.ceil(difference / duration * 50);
@@ -13842,7 +13815,7 @@ var RadioButton = defineComponent({
13842
13815
  },
13843
13816
  render() {
13844
13817
  const radioClass = classes({
13845
- "bk-radio-button": true,
13818
+ "bk-radio-item": true,
13846
13819
  "is-focused": this.isFocused,
13847
13820
  "is-disabled": this.isDisabled,
13848
13821
  "is-checked": this.isChecked
@@ -13852,14 +13825,14 @@ var RadioButton = defineComponent({
13852
13825
  return null;
13853
13826
  }
13854
13827
  return createVNode("div", {
13855
- "class": "bk-radio-button-label"
13828
+ "class": "bk-radio-item-label"
13856
13829
  }, [this.$slots.default ? this.$slots.default() : this.label]);
13857
13830
  };
13858
13831
  return createVNode("label", {
13859
13832
  "class": radioClass,
13860
13833
  "tabindex": "0"
13861
13834
  }, [createVNode("input", {
13862
- "class": "bk-radio-button-input",
13835
+ "class": "bk-radio-item-input",
13863
13836
  "type": "radio",
13864
13837
  "tabindex": "0",
13865
13838
  "value": this.label,
@@ -13875,7 +13848,8 @@ const radioGroupProps = {
13875
13848
  name: PropTypes.string.def(""),
13876
13849
  modelValue: PropTypes.oneOfType([String, Number, Boolean]),
13877
13850
  disabled: PropTypes.bool,
13878
- withValidate: PropTypes.bool.def(true)
13851
+ withValidate: PropTypes.bool.def(true),
13852
+ type: PropTypes.oneOf(["button", "capsule"]).def("button")
13879
13853
  };
13880
13854
  var RadioGroup = defineComponent({
13881
13855
  name: "RadioGroup",
@@ -13928,7 +13902,7 @@ var RadioGroup = defineComponent({
13928
13902
  render() {
13929
13903
  var _a;
13930
13904
  return createVNode("div", {
13931
- "class": "bk-radio-group"
13905
+ "class": ["bk-radio-group", `bk-radio-${this.type}`]
13932
13906
  }, [(_a = this.$slots) == null ? void 0 : _a.default()]);
13933
13907
  }
13934
13908
  });
@@ -15520,7 +15494,7 @@ var SelectTagInput = defineComponent({
15520
15494
  modelValue: PropTypes.any,
15521
15495
  collapseTags: PropTypes.bool.def(false)
15522
15496
  },
15523
- emits: ["update:modelValue", "remove", "enter"],
15497
+ emits: ["update:modelValue", "remove", "enter", "keydown"],
15524
15498
  setup(props2, {
15525
15499
  emit
15526
15500
  }) {
@@ -15561,6 +15535,7 @@ var SelectTagInput = defineComponent({
15561
15535
  break;
15562
15536
  }
15563
15537
  }
15538
+ emit("keydown", e.target.value, e);
15564
15539
  };
15565
15540
  const getTagDOM = (index2) => {
15566
15541
  const tags = [...proxy.$el.querySelectorAll(".bk-tag")];
@@ -15829,7 +15804,8 @@ var Component$j = defineComponent({
15829
15804
  isShow: isPopoverShow.value,
15830
15805
  reference: selectTagInputRef.value,
15831
15806
  offset: 6,
15832
- popoverDelay: 0
15807
+ popoverDelay: 0,
15808
+ renderType: RenderType.AUTO
15833
15809
  }, popoverOptions.value));
15834
15810
  const {
15835
15811
  register,
@@ -15879,7 +15855,7 @@ var Component$j = defineComponent({
15879
15855
  setTimeout(() => {
15880
15856
  focusInput();
15881
15857
  initActiveOptionValue();
15882
- }, 0);
15858
+ }, 10);
15883
15859
  }
15884
15860
  });
15885
15861
  const initActiveOptionValue = () => {
@@ -16059,8 +16035,8 @@ var Component$j = defineComponent({
16059
16035
  }
16060
16036
  };
16061
16037
  const handleKeydown = (e) => {
16062
- var _a, _b, _c, _d;
16063
- if (!((_a = triggerRef.value) == null ? void 0 : _a.contains(e.target)) && !((_b = contentRef.value) == null ? void 0 : _b.contains(e.target)) && !customContent.value)
16038
+ var _a, _b;
16039
+ if (!isPopoverShow.value)
16064
16040
  return;
16065
16041
  const availableOptions = options.value.filter((option) => !option.disabled && option.visible);
16066
16042
  const index2 = availableOptions.findIndex((option) => option.value === activeOptionValue.value);
@@ -16070,13 +16046,13 @@ var Component$j = defineComponent({
16070
16046
  case "ArrowDown": {
16071
16047
  e.preventDefault();
16072
16048
  const nextIndex = index2 >= availableOptions.length - 1 ? 0 : index2 + 1;
16073
- activeOptionValue.value = (_c = availableOptions[nextIndex]) == null ? void 0 : _c.value;
16049
+ activeOptionValue.value = (_a = availableOptions[nextIndex]) == null ? void 0 : _a.value;
16074
16050
  break;
16075
16051
  }
16076
16052
  case "ArrowUp": {
16077
16053
  e.preventDefault();
16078
16054
  const preIndex = index2 === 0 ? availableOptions.length - 1 : index2 - 1;
16079
- activeOptionValue.value = (_d = availableOptions[preIndex]) == null ? void 0 : _d.value;
16055
+ activeOptionValue.value = (_b = availableOptions[preIndex]) == null ? void 0 : _b.value;
16080
16056
  break;
16081
16057
  }
16082
16058
  case "Backspace": {
@@ -16087,12 +16063,8 @@ var Component$j = defineComponent({
16087
16063
  break;
16088
16064
  }
16089
16065
  case "Enter": {
16090
- if (!isPopoverShow.value) {
16091
- isPopoverShow.value = true;
16092
- } else {
16093
- const option = optionsMap.value.get(activeOptionValue.value);
16094
- handleOptionSelected(option);
16095
- }
16066
+ const option = optionsMap.value.get(activeOptionValue.value);
16067
+ handleOptionSelected(option);
16096
16068
  break;
16097
16069
  }
16098
16070
  }
@@ -16133,10 +16105,6 @@ var Component$j = defineComponent({
16133
16105
  showOnInit.value && showPopover();
16134
16106
  autoFocus.value && focusInput();
16135
16107
  });
16136
- on$2(document, "keydown", handleKeydown);
16137
- });
16138
- onBeforeMount(() => {
16139
- off$2(document, "keydown", handleKeydown);
16140
16108
  });
16141
16109
  return {
16142
16110
  selected,
@@ -16235,7 +16203,8 @@ var Component$j = defineComponent({
16235
16203
  "disabled": this.isDisabled,
16236
16204
  "onRemove": this.handleDeleteTag,
16237
16205
  "collapseTags": this.isCollapseTags,
16238
- "onEnter": this.handleInputEnter
16206
+ "onEnter": this.handleInputEnter,
16207
+ "onKeydown": (_v, e) => this.handleKeydown(e)
16239
16208
  }, {
16240
16209
  prefix: () => {
16241
16210
  var _a, _b;
@@ -16259,7 +16228,8 @@ var Component$j = defineComponent({
16259
16228
  "size": this.size,
16260
16229
  "withValidate": false,
16261
16230
  "onInput": this.handleInputChange,
16262
- "onEnter": this.handleInputEnter
16231
+ "onEnter": this.handleInputEnter,
16232
+ "onKeydown": (_v, e) => this.handleKeydown(e)
16263
16233
  }, {
16264
16234
  prefix: () => {
16265
16235
  var _a, _b;
@@ -21701,6 +21671,7 @@ var TabTypeEnum = /* @__PURE__ */ ((TabTypeEnum2) => {
21701
21671
  TabTypeEnum2["BORDER_CARD"] = "border-card";
21702
21672
  TabTypeEnum2["UNBORDER_CARD"] = "unborder-card";
21703
21673
  TabTypeEnum2["CARD_TAB"] = "card-tab";
21674
+ TabTypeEnum2["CARD_GRID"] = "card-grid";
21704
21675
  return TabTypeEnum2;
21705
21676
  })(TabTypeEnum || {});
21706
21677
  var PositionEnum = /* @__PURE__ */ ((PositionEnum2) => {
@@ -21995,12 +21966,12 @@ var TabNav = defineComponent({
21995
21966
  drop(index2, sortType);
21996
21967
  },
21997
21968
  "class": getNavItemClass()
21998
- }, [createVNode("div", null, [tabLabel]), getValue(item.closable, closable) && createVNode(close$1, {
21999
- "class": resolveClassName("tab-header-item-close"),
21969
+ }, [createVNode("div", null, [tabLabel]), getValue(item.closable, closable) ? createVNode("span", {
21970
+ "class": resolveClassName("tab-header--close"),
22000
21971
  "onClick": () => this.handleTabRemove(index2, item)
22001
- }, null)]);
21972
+ }, [createVNode(close$1, null, null)]) : ""]);
22002
21973
  });
22003
- const renderSlot2 = () => {
21974
+ const renderOperation = () => {
22004
21975
  var _a, _b;
22005
21976
  const list = [];
22006
21977
  if (typeof this.$slots.add === "function") {
@@ -22033,19 +22004,18 @@ var TabNav = defineComponent({
22033
22004
  }
22034
22005
  return "";
22035
22006
  };
22007
+ const setting = typeof this.$slots.setting === "function" ? createVNode("div", {
22008
+ "class": resolveClassName("tab-header-setting")
22009
+ }, [this.$slots.setting()]) : null;
22010
+ const operations = renderOperation();
22036
22011
  return createVNode("div", {
22037
22012
  "style": {
22038
22013
  lineHeight: `${labelHeight}px`
22039
22014
  },
22040
22015
  "class": resolveClassName("tab-header")
22041
22016
  }, [createVNode("div", {
22042
- "class": resolveClassName("tab-header-nav")
22043
- }, [renderNavs(), renderActiveBar(), createVNode("div", {
22044
- "style": this.activeBarStyle,
22045
- "class": resolveClassName("tab-header-active-bar")
22046
- }, null)]), renderSlot2(), typeof this.$slots.setting === "function" && createVNode("div", {
22047
- "class": resolveClassName("tab-header-setting")
22048
- }, [this.$slots.setting()])]);
22017
+ "class": [resolveClassName("tab-header-nav"), operations || setting ? "tab-header-auto" : ""]
22018
+ }, [renderActiveBar(), renderNavs()]), operations, setting]);
22049
22019
  }
22050
22020
  });
22051
22021
  var Tab = defineComponent({
@@ -28884,14 +28854,14 @@ const treeProps = {
28884
28854
  ]).def(void 0),
28885
28855
  emptyText: PropTypes.string.def("\u6CA1\u6709\u6570\u636E"),
28886
28856
  draggable: PropTypes.bool.def(false),
28887
- disableDrag: PropTypes.func.def(null),
28888
- disableDrop: PropTypes.func.def(null),
28857
+ disableDrag: PropTypes.func,
28858
+ disableDrop: PropTypes.func,
28889
28859
  dragSort: PropTypes.bool.def(false),
28890
28860
  selectable: PropTypes.oneOfType([PropTypes.bool, PropTypes.func]).def(true),
28891
28861
  disabledFolderSelectable: PropTypes.bool.def(false),
28892
28862
  showCheckbox: PropTypes.bool.def(false),
28893
28863
  showNodeTypeIcon: PropTypes.bool.def(true),
28894
- selected: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.object]).def(null),
28864
+ selected: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.object]),
28895
28865
  autoCheckChildren: PropTypes.bool.def(true),
28896
28866
  autoOpenParentNode: PropTypes.bool.def(true),
28897
28867
  expandAll: PropTypes.bool.def(false),
@@ -39238,7 +39208,7 @@ var SearchSelectInput = defineComponent({
39238
39208
  e && setMenuList();
39239
39209
  }
39240
39210
  function handleInputChange(event) {
39241
- var _a, _b, _c, _d, _e, _f, _g;
39211
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i;
39242
39212
  clearInput();
39243
39213
  let text = event.target.innerText;
39244
39214
  if (/(\r|\n)/gm.test(text) || /\s{2}/gm.test(text)) {
@@ -39250,13 +39220,20 @@ var SearchSelectInput = defineComponent({
39250
39220
  debounceSetMenuList();
39251
39221
  } else if (!keyword.value && text.length < (((_c = (_b = usingItem.value) == null ? void 0 : _b.inputInnerText) == null ? void 0 : _c.length) || 1)) {
39252
39222
  const outerText = text.replace("\xA0", " ").replace(((_d = usingItem.value) == null ? void 0 : _d.keyInnerText.replace("\xA0", " ").trim()) || "", "").trim();
39223
+ const hasKeyword = text && ((_e = usingItem.value) == null ? void 0 : _e.keyInnerText) && text.replace("\xA0", " ").includes(usingItem.value.keyInnerText.replace("\xA0", " ").trim());
39224
+ if (hasKeyword && outerText && ((_f = usingItem.value.values) == null ? void 0 : _f.length)) {
39225
+ keyword.value = outerText;
39226
+ console.info("outerText", outerText);
39227
+ debounceSetMenuList();
39228
+ return;
39229
+ }
39253
39230
  if (outerText || !(text == null ? void 0 : text.length)) {
39254
39231
  usingItem.value = null;
39255
39232
  }
39256
39233
  keyword.value = outerText ? text : "";
39257
39234
  debounceSetMenuList();
39258
- } else if (!((_f = (_e = usingItem.value) == null ? void 0 : _e.values) == null ? void 0 : _f.length)) {
39259
- keyword.value = text.replace("\xA0", " ").replace(((_g = usingItem.value) == null ? void 0 : _g.keyInnerText.replace("\xA0", " ")) || "", "").trim();
39235
+ } else if (!((_h = (_g = usingItem.value) == null ? void 0 : _g.values) == null ? void 0 : _h.length)) {
39236
+ keyword.value = text.replace("\xA0", " ").replace(((_i = usingItem.value) == null ? void 0 : _i.keyInnerText.replace("\xA0", " ")) || "", "").trim();
39260
39237
  setInputFocus();
39261
39238
  debounceSetMenuList();
39262
39239
  }
@@ -39331,6 +39308,21 @@ var SearchSelectInput = defineComponent({
39331
39308
  showNoSelectValueError.value = true;
39332
39309
  return;
39333
39310
  }
39311
+ if (keyword.value) {
39312
+ const value = {
39313
+ id: keyword.value,
39314
+ name: keyword.value
39315
+ };
39316
+ const res2 = await validateUsingItemValues(value);
39317
+ if (!res2)
39318
+ return;
39319
+ usingItem.value.addValue(value);
39320
+ emit("add", usingItem.value);
39321
+ keyword.value = "";
39322
+ usingItem.value = null;
39323
+ setInputFocus(true);
39324
+ return;
39325
+ }
39334
39326
  const res = await validateUsingItemValues();
39335
39327
  if (!res)
39336
39328
  return;
@@ -39344,7 +39336,7 @@ var SearchSelectInput = defineComponent({
39344
39336
  return;
39345
39337
  }
39346
39338
  if ((_a = usingItem.value) == null ? void 0 : _a.values.length) {
39347
- if (((_b = usingItem.value) == null ? void 0 : _b.multiple) || usingItem.value.isInValueList(usingItem.value.values[0])) {
39339
+ if (((_b = usingItem.value) == null ? void 0 : _b.multiple) || usingItem.value.isInValueList(usingItem.value.values[0]) || props2.mode === SearchInputMode.EDIT && !keyword.value) {
39348
39340
  usingItem.value.values.splice(-1, 1);
39349
39341
  keyword.value = "";
39350
39342
  setInputFocus();
@@ -39358,7 +39350,7 @@ var SearchSelectInput = defineComponent({
39358
39350
  onValidate("");
39359
39351
  }
39360
39352
  async function handleSelectItem(item, type) {
39361
- var _a, _b, _c, _d;
39353
+ var _a, _b, _c, _d, _e;
39362
39354
  if ((_a = item.value) == null ? void 0 : _a.id) {
39363
39355
  if (props2.valueBehavior === ValueBehavior.NEEDKEY && item.value || !props2.validateValues) {
39364
39356
  const seleted = new SelectedItem(__spreadProps(__spreadValues({}, item), {
@@ -39393,7 +39385,7 @@ var SearchSelectInput = defineComponent({
39393
39385
  return;
39394
39386
  if (!usingItem.value.multiple)
39395
39387
  setSelectedItem();
39396
- if (props2.valueBehavior === ValueBehavior.NEEDKEY && usingItem.value.multiple) {
39388
+ if (props2.valueBehavior === ValueBehavior.NEEDKEY && ((_e = usingItem.value) == null ? void 0 : _e.multiple)) {
39397
39389
  setInputFocus();
39398
39390
  }
39399
39391
  }