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

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
@@ -9776,7 +9776,7 @@ const propsCollapse = {
9776
9776
  const CollapsePanelEventProps = {
9777
9777
  itemClick: {
9778
9778
  type: Function,
9779
- default: () => ({})
9779
+ default: null
9780
9780
  }
9781
9781
  };
9782
9782
  const propsCollapsePanel = __spreadValues({
@@ -9902,13 +9902,16 @@ var CollapsePanel = defineComponent({
9902
9902
  const data2 = {
9903
9903
  name
9904
9904
  };
9905
- itemClick(data2);
9906
9905
  isActive.value = !isActive.value;
9907
9906
  emit("change", data2);
9908
9907
  emit("update:modelValue", isActive.value);
9909
- handleItemClick({
9910
- name
9911
- });
9908
+ if (typeof itemClick === "function") {
9909
+ itemClick(data2);
9910
+ } else if (typeof handleItemClick === "function") {
9911
+ handleItemClick({
9912
+ name
9913
+ });
9914
+ }
9912
9915
  }
9913
9916
  const transition = ref(collapseMotion$1(emit));
9914
9917
  function getContent() {
@@ -10032,15 +10035,19 @@ var Collapse = defineComponent({
10032
10035
  }, item);
10033
10036
  }));
10034
10037
  const renderItems = () => collapseData.value.map((item, index) => {
10038
+ var _a, _b, _c;
10035
10039
  const name = item[props2.idFiled] || index;
10036
10040
  let title = item[props2.titleField];
10037
10041
  if (slots.title) {
10038
10042
  if (typeof slots.title === "function") {
10039
- title = slots.title(item);
10043
+ title = slots.title(item, index);
10040
10044
  } else {
10041
10045
  title = slots.title;
10042
10046
  }
10043
10047
  }
10048
+ if (slots.default) {
10049
+ title = (_a = slots.default) == null ? void 0 : _a.call(slots, item, index);
10050
+ }
10044
10051
  return createVNode(CollapsePanel, {
10045
10052
  "key": index,
10046
10053
  "item-click": handleItemClick,
@@ -10048,7 +10055,7 @@ var Collapse = defineComponent({
10048
10055
  "name": name,
10049
10056
  "isFormList": true,
10050
10057
  "title": title,
10051
- "content": item[props2.contentField]
10058
+ "content": (_c = (_b = slots.content) == null ? void 0 : _b.call(slots, item, index)) != null ? _c : item[props2.contentField]
10052
10059
  }, null);
10053
10060
  });
10054
10061
  return () => createVNode("div", {
@@ -10165,7 +10172,7 @@ var Component$t = defineComponent({
10165
10172
  "name": this.animateType
10166
10173
  }, {
10167
10174
  default: () => {
10168
- var _a, _b, _c, _d, _e, _f, _g, _h, _i;
10175
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
10169
10176
  return [this.isShow ? createVNode("div", {
10170
10177
  "class": bodyClass
10171
10178
  }, [createVNode("div", {
@@ -10175,7 +10182,9 @@ var Component$t = defineComponent({
10175
10182
  "style": [this.dialogType === "show" ? "padding-bottom: 20px" : "", __spreadValues({}, maxHeight)]
10176
10183
  }, [(_f = (_e = (_d = this.$slots).default) == null ? void 0 : _e.call(_d)) != null ? _f : ""]), this.dialogType === "show" ? "" : createVNode("div", {
10177
10184
  "class": "bk-modal-footer"
10178
- }, [(_i = (_h = (_g = this.$slots).footer) == null ? void 0 : _h.call(_g)) != null ? _i : ""])]) : ""];
10185
+ }, [(_i = (_h = (_g = this.$slots).footer) == null ? void 0 : _h.call(_g)) != null ? _i : ""]), createVNode("div", {
10186
+ "class": ["bk-modal-close", this.closeIcon ? "" : "close-icon"]
10187
+ }, [(_l = (_k = (_j = this.$slots).close) == null ? void 0 : _k.call(_j)) != null ? _l : ""])]) : ""];
10179
10188
  }
10180
10189
  })]);
10181
10190
  }
@@ -10341,10 +10350,7 @@ var Dialog = defineComponent({
10341
10350
  }, [createVNode("span", {
10342
10351
  "class": "bk-dialog-title",
10343
10352
  "style": `text-align: ${this.headerAlign}`
10344
- }, [(_f = (_e = (_d = this.$slots).header) == null ? void 0 : _e.call(_d)) != null ? _f : this.title]), createVNode("span", {
10345
- "class": ["bk-dialog-close", this.closeIcon ? "" : "close-icon"],
10346
- "onClick": this.handleClose
10347
- }, [createTextVNode("+")])])];
10353
+ }, [(_f = (_e = (_d = this.$slots).header) == null ? void 0 : _e.call(_d)) != null ? _f : this.title])])];
10348
10354
  },
10349
10355
  default: () => {
10350
10356
  var _a, _b, _c;
@@ -10396,7 +10402,11 @@ var Dialog = defineComponent({
10396
10402
  }, {
10397
10403
  default: () => [this.confirmText]
10398
10404
  })]) : ""]);
10399
- }
10405
+ },
10406
+ close: () => createVNode("span", {
10407
+ "class": "bk-dialog-close",
10408
+ "onClick": this.handleClose
10409
+ }, [createTextVNode("+")])
10400
10410
  };
10401
10411
  const className = `bk-dialog-wrapper ${this.scrollable ? "scroll-able" : ""} ${this.multiInstance ? "multi-instance" : ""}`;
10402
10412
  return createVNode(BkModal, mergeProps(this.$props, {
@@ -26091,6 +26101,13 @@ var CascaderPanel = defineComponent({
26091
26101
  const nodeClear = () => {
26092
26102
  emit("input", []);
26093
26103
  };
26104
+ const syncCheckedValue = (value) => {
26105
+ value.forEach((id) => {
26106
+ const node = store.getNodeById(id);
26107
+ nodeExpandHandler(node);
26108
+ });
26109
+ checkValue.value = value;
26110
+ };
26094
26111
  const nodeExpandHandler = (node) => {
26095
26112
  var _a;
26096
26113
  if (node.isDisabled)
@@ -26111,7 +26128,6 @@ var CascaderPanel = defineComponent({
26111
26128
  node.loading = false;
26112
26129
  };
26113
26130
  store.config.remoteMethod(node, updateNodes);
26114
- console.log("remote fuck here");
26115
26131
  }
26116
26132
  };
26117
26133
  const nodeEvent = (node) => {
@@ -26166,7 +26182,8 @@ var CascaderPanel = defineComponent({
26166
26182
  checkValue,
26167
26183
  nodeClear,
26168
26184
  checkNode,
26169
- iconRender
26185
+ iconRender,
26186
+ syncCheckedValue
26170
26187
  };
26171
26188
  },
26172
26189
  render() {
@@ -26268,6 +26285,9 @@ class Store {
26268
26285
  const nodes = this.getFlattedNodes().filter((node) => arrayEqual(node.path, value));
26269
26286
  return (_a = nodes[0]) != null ? _a : null;
26270
26287
  }
26288
+ getNodeById(id) {
26289
+ return this.getFlattedNodes().find((node) => node.id === id);
26290
+ }
26271
26291
  appendNode(nodeData, parentNode) {
26272
26292
  const node = new Node$1(nodeData, this.config, parentNode);
26273
26293
  const children = parentNode ? parentNode.children : this.nodes;
@@ -26287,7 +26307,7 @@ var Component$5 = defineComponent({
26287
26307
  BkPopover
26288
26308
  },
26289
26309
  props: {
26290
- modelValue: PropTypes.array.def([]),
26310
+ modelValue: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.number).def([]), PropTypes.arrayOf(PropTypes.string).def([])]),
26291
26311
  list: PropTypes.array.def([]),
26292
26312
  placeholder: PropTypes.string.def("\u8BF7\u9009\u62E9"),
26293
26313
  filterable: PropTypes.bool.def(false),
@@ -26323,7 +26343,13 @@ var Component$5 = defineComponent({
26323
26343
  const panelShow = ref(false);
26324
26344
  const selectedText = ref("");
26325
26345
  const selectedTags = ref([]);
26346
+ const checkedValue = ref(props2.modelValue);
26347
+ const cascaderPanel = ref();
26348
+ watch(() => props2.modelValue, (value) => {
26349
+ updateValue(value);
26350
+ });
26326
26351
  const updateValue = (val) => {
26352
+ cascaderPanel.value.syncCheckedValue(val);
26327
26353
  if (multiple) {
26328
26354
  selectedTags.value = store.getCheckedNodes().map((node) => ({
26329
26355
  text: node.pathNames.join(separator2),
@@ -26337,6 +26363,9 @@ var Component$5 = defineComponent({
26337
26363
  const node = store.getNodeByValue(val);
26338
26364
  selectedText.value = node.pathNames.join(separator2);
26339
26365
  }
26366
+ };
26367
+ const inputChangeHandler = (val) => {
26368
+ updateValue(val);
26340
26369
  emit("update:modelValue", val);
26341
26370
  emit("change", val);
26342
26371
  };
@@ -26365,13 +26394,16 @@ var Component$5 = defineComponent({
26365
26394
  hidePopover,
26366
26395
  inputClickHandler,
26367
26396
  selectedText,
26397
+ checkedValue,
26368
26398
  panelShow,
26369
26399
  handleClear,
26370
26400
  isHover,
26371
26401
  setHover,
26372
26402
  cancelHover,
26373
26403
  selectedTags,
26374
- removeTag
26404
+ removeTag,
26405
+ inputChangeHandler,
26406
+ cascaderPanel
26375
26407
  };
26376
26408
  },
26377
26409
  render() {
@@ -26432,7 +26464,8 @@ var Component$5 = defineComponent({
26432
26464
  "class": "bk-cascader-popover"
26433
26465
  }, [createVNode(CascaderPanel, {
26434
26466
  "store": this.store,
26435
- "onInput": (val) => this.updateValue(val)
26467
+ "ref": "cascaderPanel",
26468
+ "onInput": (val) => this.inputChangeHandler(val)
26436
26469
  }, null)])
26437
26470
  })]);
26438
26471
  }