bkui-vue 0.0.1-beta.332 → 0.0.1-beta.333

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
@@ -14039,7 +14039,7 @@ var RadioButton = defineComponent({
14039
14039
  return null;
14040
14040
  }
14041
14041
  return createVNode("span", {
14042
- "class": "bk-radio-label"
14042
+ "class": "bk-radio-button-label"
14043
14043
  }, [this.$slots.default ? this.$slots.default() : this.label]);
14044
14044
  };
14045
14045
  return createVNode("label", {
@@ -21948,6 +21948,7 @@ var Confirm = defineComponent({
21948
21948
  };
21949
21949
  },
21950
21950
  render() {
21951
+ var _a, _b, _c;
21951
21952
  return createVNode("div", {
21952
21953
  "class": "bk-picker-confirm",
21953
21954
  "ref": "elRef",
@@ -21959,7 +21960,9 @@ var Confirm = defineComponent({
21959
21960
  "onClick": this.handleToggleTime
21960
21961
  }, {
21961
21962
  default: () => [this.labels.time]
21962
- }) : "", this.clearable ? createVNode("a", {
21963
+ }) : "", (_c = (_b = (_a = this.$slots).confirm) == null ? void 0 : _b.call(_a)) != null ? _c : createVNode("div", {
21964
+ "class": "bk-picker-confirm-action"
21965
+ }, [this.clearable ? createVNode("a", {
21963
21966
  "href": "javascript: void(0);",
21964
21967
  "onClick": this.handleClear,
21965
21968
  "onKeydown": this.handleClear
@@ -21968,7 +21971,7 @@ var Confirm = defineComponent({
21968
21971
  "class": "confirm",
21969
21972
  "onClick": this.handleSuccess,
21970
21973
  "onKeydown_enter": this.handleSuccess
21971
- }, [this.labels.ok])]);
21974
+ }, [this.labels.ok])])]);
21972
21975
  }
21973
21976
  });
21974
21977
  var oneDay = 1e3 * 60 * 60 * 24;
@@ -24138,15 +24141,6 @@ const formatDate = (val, type, multiple, format2) => {
24138
24141
  };
24139
24142
  const datePickerKey = Symbol("date-picker");
24140
24143
  const timePickerKey = Symbol("time-picker");
24141
- function findChildComponents(context, componentName) {
24142
- return (context.$children || []).reduce((components2, child) => {
24143
- if (child.$options.name === componentName) {
24144
- components2.push(child);
24145
- }
24146
- const foundChilds = findChildComponents(child, componentName);
24147
- return components2.concat(foundChilds);
24148
- }, []);
24149
- }
24150
24144
  function iconBtnCls(direction, type = "") {
24151
24145
  return [
24152
24146
  "bk-picker-panel-icon-btn",
@@ -25732,6 +25726,25 @@ var DateRangePanel = defineComponent({
25732
25726
  };
25733
25727
  setPanelDates(props2.startDate || state.dates[0] || new Date());
25734
25728
  });
25729
+ watch(() => state.currentView, (v2) => {
25730
+ const leftMonth = state.leftPanelDate.getMonth();
25731
+ const rightMonth = state.rightPanelDate.getMonth();
25732
+ const isSameYear = state.leftPanelDate.getFullYear() === state.rightPanelDate.getFullYear();
25733
+ if (v2 === "date" && isSameYear && leftMonth === rightMonth) {
25734
+ changePanelDate("right", "Month", 1);
25735
+ }
25736
+ if (v2 === "month" && isSameYear) {
25737
+ changePanelDate("right", "FullYear", 1);
25738
+ }
25739
+ if (v2 === "year" && isSameYear) {
25740
+ changePanelDate("right", "FullYear", 10);
25741
+ }
25742
+ if (state.currentView === "time") {
25743
+ nextTick(() => {
25744
+ timePickerRef.value.updateScroll();
25745
+ });
25746
+ }
25747
+ });
25735
25748
  const isTime = computed(() => state.currentView === "time");
25736
25749
  const leftDatePanelLabel = computed(() => panelLabelConfig("left"));
25737
25750
  const rightDatePanelLabel = computed(() => panelLabelConfig("right"));
@@ -25776,6 +25789,7 @@ var DateRangePanel = defineComponent({
25776
25789
  emit("pick-click");
25777
25790
  }
25778
25791
  const timeDisabled = computed(() => !(state.dates[0] && state.dates[1]));
25792
+ const timePickerRef = ref(null);
25779
25793
  return __spreadProps(__spreadValues({}, toRefs(state)), {
25780
25794
  isTime,
25781
25795
  hasShortcuts,
@@ -25802,7 +25816,8 @@ var DateRangePanel = defineComponent({
25802
25816
  handleToggleTime,
25803
25817
  handlePickSuccess,
25804
25818
  handlePickClear,
25805
- handlePickClick
25819
+ handlePickClick,
25820
+ timePickerRef
25806
25821
  });
25807
25822
  },
25808
25823
  render() {
@@ -25979,7 +25994,7 @@ var DateRangePanel = defineComponent({
25979
25994
  "onPick-toggle-time": this.handleToggleTime,
25980
25995
  "onPick-clear": this.handlePickClear,
25981
25996
  "onPick-success": this.handlePickSuccess
25982
- }, null) : ""]), shortcuts]);
25997
+ }, this.$slots) : ""]), shortcuts]);
25983
25998
  }
25984
25999
  });
25985
26000
  var Component$a = defineComponent({
@@ -26072,6 +26087,7 @@ var Component$a = defineComponent({
26072
26087
  const hasHeader = computed(() => !!slots.header);
26073
26088
  const hasFooter = computed(() => !!slots.footer);
26074
26089
  const hasShortcuts = computed(() => !!slots.shortcuts);
26090
+ const hasConfirm = computed(() => !!slots.confirm);
26075
26091
  const fontSizeCls = computed(() => {
26076
26092
  let cls = "";
26077
26093
  if (props2.fontSize === "medium") {
@@ -26341,6 +26357,10 @@ var Component$a = defineComponent({
26341
26357
  emit("shortcut-change", state.shortcut, shortcutIndex);
26342
26358
  };
26343
26359
  const triggerRef = ref(null);
26360
+ const handleToggleTime = () => {
26361
+ var _a, _b;
26362
+ (_b = (_a = pickerPanelRef.value).handleToggleTime) == null ? void 0 : _b.call(_a);
26363
+ };
26344
26364
  return __spreadProps(__spreadValues({}, toRefs(state)), {
26345
26365
  panel,
26346
26366
  publicStringValue,
@@ -26351,6 +26371,7 @@ var Component$a = defineComponent({
26351
26371
  hasHeader,
26352
26372
  hasFooter,
26353
26373
  hasShortcuts,
26374
+ hasConfirm,
26354
26375
  fontSizeCls,
26355
26376
  longWidthCls,
26356
26377
  localReadonly,
@@ -26370,7 +26391,8 @@ var Component$a = defineComponent({
26370
26391
  handleInputChange,
26371
26392
  handleClear,
26372
26393
  onPick,
26373
- onPickSuccess
26394
+ onPickSuccess,
26395
+ handleToggleTime
26374
26396
  });
26375
26397
  },
26376
26398
  render() {
@@ -26448,6 +26470,10 @@ var Component$a = defineComponent({
26448
26470
  })) || null;
26449
26471
  }
26450
26472
  } : {};
26473
+ const confirmSlot = this.hasConfirm ? {
26474
+ confirm: this.$slots.confirm
26475
+ } : {};
26476
+ const slots = __spreadValues(__spreadValues({}, shortcutsSlot), confirmSlot);
26451
26477
  return withDirectives(createVNode("div", {
26452
26478
  "class": ["bk-date-picker", this.type === "datetimerange" ? "long" : "", this.longWidthCls]
26453
26479
  }, [createVNode("div", {
@@ -26491,7 +26517,7 @@ var Component$a = defineComponent({
26491
26517
  "onPick-clear": this.handleClear,
26492
26518
  "onPick-success": this.onPickSuccess,
26493
26519
  "onSelection-mode-change": this.onSelectionModeChange
26494
- }, shortcutsSlot) : createVNode(DatePanel, {
26520
+ }, slots) : createVNode(DatePanel, {
26495
26521
  "ref": "pickerPanelRef",
26496
26522
  "clearable": this.clearable,
26497
26523
  "showTime": this.type === "datetime" || this.type === "datetimerange",
@@ -26509,7 +26535,7 @@ var Component$a = defineComponent({
26509
26535
  "onPick-clear": this.handleClear,
26510
26536
  "onPick-success": this.onPickSuccess,
26511
26537
  "onSelection-mode-change": this.onSelectionModeChange
26512
- }, shortcutsSlot), this.hasFooter ? createVNode("div", {
26538
+ }, slots), this.hasFooter ? createVNode("div", {
26513
26539
  "class": ["bk-date-picker-footer-wrapper", this.footerSlotCls]
26514
26540
  }, [(_f = (_e = (_d = this.$slots).footer) == null ? void 0 : _e.call(_d)) != null ? _f : null]) : null];
26515
26541
  }
@@ -26650,8 +26676,8 @@ var TimePicker = defineComponent({
26650
26676
  watch(() => state.visible, (visible) => {
26651
26677
  if (visible) {
26652
26678
  nextTick(() => {
26653
- const spinners = findChildComponents(proxy, "TimeSpinner");
26654
- spinners.forEach((instance) => instance.updateScroll());
26679
+ var _a, _b;
26680
+ (_b = (_a = proxy.pickerPanelRef) == null ? void 0 : _a.timeSpinnerRef) == null ? void 0 : _b.updateScroll();
26655
26681
  });
26656
26682
  }
26657
26683
  });
@@ -28965,22 +28991,21 @@ var FormItem = defineComponent({
28965
28991
  const rule = rules[stepIndex];
28966
28992
  return Promise.resolve().then(() => {
28967
28993
  const result = rule.validator(value);
28968
- const errorMessage = getRuleMessage(rule);
28969
28994
  if (typeof result !== "boolean" && typeof result.then === "function") {
28970
28995
  return result.then((data2) => {
28971
28996
  if (data2 === false) {
28972
- return Promise.reject(errorMessage);
28997
+ return Promise.reject(getRuleMessage(rule));
28973
28998
  }
28974
28999
  }).then(() => doValidate(), () => {
28975
29000
  state.isError = true;
28976
- state.errorMessage = errorMessage;
28977
- return Promise.reject(errorMessage);
29001
+ state.errorMessage = getRuleMessage(rule);
29002
+ return Promise.reject(state.errorMessage);
28978
29003
  });
28979
29004
  }
28980
29005
  if (!result) {
28981
29006
  state.isError = true;
28982
- state.errorMessage = errorMessage;
28983
- return Promise.reject(errorMessage);
29007
+ state.errorMessage = getRuleMessage(rule);
29008
+ return Promise.reject(state.errorMessage);
28984
29009
  }
28985
29010
  return doValidate();
28986
29011
  });