bge-ui 1.3.5 → 1.3.6

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.js CHANGED
@@ -15017,7 +15017,15 @@ const formatDate = (value, formatProp, formatLocale, rangeSeparator, modelAuto,
15017
15017
  return formatProp(value);
15018
15018
  const options = formatLocale ? { locale: formatLocale } : void 0;
15019
15019
  if (Array.isArray(value)) {
15020
- return `${format(value[0], pattern4, options)}${modelAuto && !value[1] ? "" : rangeSeparator}${value[1] ? format(value[1], pattern4, options) : ""}`;
15020
+ let result = "";
15021
+ if (isValidDate(value[0])) {
15022
+ result += `${format(value[0], pattern4, options)}`;
15023
+ }
15024
+ result += `${modelAuto && !value[1] ? "" : rangeSeparator}`;
15025
+ if (isValidDate(value[1])) {
15026
+ result += `${format(value[1], pattern4, options)}`;
15027
+ }
15028
+ return result;
15021
15029
  }
15022
15030
  return format(value, pattern4, options);
15023
15031
  };
@@ -15033,7 +15041,7 @@ const checkRangeEnabled = (fn2, range3) => {
15033
15041
  };
15034
15042
  const isValidDate = (value) => {
15035
15043
  if (Array.isArray(value)) {
15036
- return isValid(value[0]) && (value[1] ? isValid(value[1]) : true);
15044
+ return isValid(value[0]) || (value[1] ? isValid(value[1]) : true);
15037
15045
  }
15038
15046
  return value ? isValid(value) : false;
15039
15047
  };
@@ -17455,7 +17463,6 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
17455
17463
  return [formatDatePreview(dates[0]), formatDatePreview(dates[1])];
17456
17464
  };
17457
17465
  const formatDatePreview = (date4) => {
17458
- console.log(defaultedPreviewFormat.value);
17459
17466
  return formatDate(
17460
17467
  date4,
17461
17468
  defaultedPreviewFormat.value,
@@ -22514,13 +22521,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
22514
22521
  }
22515
22522
  }
22516
22523
  function close(type4) {
22517
- if (type4 === "start") {
22518
- date4.value[0] = "";
22519
- } else if (type4 === "end") {
22520
- date4.value[1] = "";
22521
- } else {
22522
- date4.value = "";
22523
- }
22524
+ date4.value = void 0;
22524
22525
  }
22525
22526
  const emit = __emit;
22526
22527
  const inputValue = ref();
@@ -22570,7 +22571,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
22570
22571
  createTextVNode(toDisplayString(inputValue.value && inputValue.value[0] || "结束日期") + " ", 1),
22571
22572
  createVNode(_component_MonoClose, {
22572
22573
  class: "bge-datepicker__close",
22573
- onClick: _cache[0] || (_cache[0] = withModifiers(($event) => close("start"), ["stop"]))
22574
+ onClick: _cache[0] || (_cache[0] = withModifiers(($event) => close(), ["stop"]))
22574
22575
  }),
22575
22576
  createVNode(_component_MonoCalendar, { class: "bge-datepicker__icon" })
22576
22577
  ], 2),
@@ -22582,7 +22583,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
22582
22583
  createTextVNode(toDisplayString(inputValue.value && inputValue.value[1] || "结束日期") + " ", 1),
22583
22584
  createVNode(_component_MonoClose, {
22584
22585
  class: "bge-datepicker__close",
22585
- onClick: _cache[2] || (_cache[2] = withModifiers(($event) => close("end"), ["stop"]))
22586
+ onClick: _cache[2] || (_cache[2] = withModifiers(($event) => close(), ["stop"]))
22586
22587
  }),
22587
22588
  createVNode(_component_MonoCalendar, { class: "bge-datepicker__icon" })
22588
22589
  ], 2)
@@ -22605,7 +22606,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
22605
22606
  };
22606
22607
  }
22607
22608
  });
22608
- const UiDatePicker = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-07284380"]]);
22609
+ const UiDatePicker = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-a163f1fb"]]);
22609
22610
  const components = {
22610
22611
  UiButton: _sfc_main$2e,
22611
22612
  UiLink: _sfc_main$2d,
package/dist/style.css CHANGED
@@ -1651,7 +1651,7 @@ to {
1651
1651
  }
1652
1652
  .bge-option.active[data-v-8a6e1228] {
1653
1653
  color: var(--tc-title);
1654
- }.bge-datepicker[data-v-07284380] {
1654
+ }.bge-datepicker[data-v-a163f1fb] {
1655
1655
  width: 100%;
1656
1656
  display: flex;
1657
1657
  align-items: center;
@@ -1662,7 +1662,7 @@ to {
1662
1662
  font-weight: 500;
1663
1663
  cursor: pointer;
1664
1664
  }
1665
- .bge-datepicker .bge-datepicker__input[data-v-07284380] {
1665
+ .bge-datepicker .bge-datepicker__input[data-v-a163f1fb] {
1666
1666
  font-size: 12px;
1667
1667
  line-height: 20px;
1668
1668
  font-weight: 500;
@@ -1676,32 +1676,32 @@ to {
1676
1676
  flex: 1;
1677
1677
  border-radius: var(--radius-small, 4px);
1678
1678
  }
1679
- .bge-datepicker .bge-datepicker__input .bge-datepicker__icon[data-v-07284380],
1680
- .bge-datepicker .bge-datepicker__input .bge-datepicker__close[data-v-07284380] {
1679
+ .bge-datepicker .bge-datepicker__input .bge-datepicker__icon[data-v-a163f1fb],
1680
+ .bge-datepicker .bge-datepicker__input .bge-datepicker__close[data-v-a163f1fb] {
1681
1681
  font-size: 16px !important;
1682
1682
  color: var(--tc-quaternary);
1683
1683
  }
1684
- .bge-datepicker .bge-datepicker__input .bge-datepicker__icon[data-v-07284380]:hover,
1685
- .bge-datepicker .bge-datepicker__input .bge-datepicker__close[data-v-07284380]:hover {
1684
+ .bge-datepicker .bge-datepicker__input .bge-datepicker__icon[data-v-a163f1fb]:hover,
1685
+ .bge-datepicker .bge-datepicker__input .bge-datepicker__close[data-v-a163f1fb]:hover {
1686
1686
  color: var(--tc-title);
1687
1687
  }
1688
- .bge-datepicker .bge-datepicker__input .bge-datepicker__close[data-v-07284380] {
1688
+ .bge-datepicker .bge-datepicker__input .bge-datepicker__close[data-v-a163f1fb] {
1689
1689
  display: none;
1690
1690
  }
1691
- .bge-datepicker .bge-datepicker__input[data-v-07284380]:hover {
1691
+ .bge-datepicker .bge-datepicker__input[data-v-a163f1fb]:hover {
1692
1692
  background: var(--bg-opacity-hover);
1693
1693
  border: solid 1px transparent;
1694
1694
  }
1695
- .bge-datepicker .bge-datepicker__input.focus[data-v-07284380] {
1695
+ .bge-datepicker .bge-datepicker__input.focus[data-v-a163f1fb] {
1696
1696
  border: solid 1px var(--tc-theme);
1697
1697
  }
1698
- .bge-datepicker .bge-datepicker__input.inputed[data-v-07284380] {
1698
+ .bge-datepicker .bge-datepicker__input.inputed[data-v-a163f1fb] {
1699
1699
  color: var(--tc-title);
1700
1700
  }
1701
- .bge-datepicker .bge-datepicker__input.inputed:hover .bge-datepicker__close[data-v-07284380] {
1701
+ .bge-datepicker .bge-datepicker__input.inputed:hover .bge-datepicker__close[data-v-a163f1fb] {
1702
1702
  display: block;
1703
1703
  }
1704
- .bge-datepicker .bge-datepicker__input.inputed:hover .bge-datepicker__icon[data-v-07284380] {
1704
+ .bge-datepicker .bge-datepicker__input.inputed:hover .bge-datepicker__icon[data-v-a163f1fb] {
1705
1705
  display: none;
1706
1706
  }.dp__input_wrap {
1707
1707
  position: relative;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bge-ui",
3
- "version": "1.3.5",
3
+ "version": "1.3.6",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "./src/index.ts",
@@ -166,7 +166,6 @@
166
166
  };
167
167
 
168
168
  const formatDatePreview = (date: Date) => {
169
- console.log(defaultedPreviewFormat.value)
170
169
  return formatDate(
171
170
  date,
172
171
  defaultedPreviewFormat.value as string,
@@ -81,7 +81,6 @@ export const useCalendarClass = (modelValue: WritableComputedRef<InternalModuleV
81
81
  if (props.hideOffsetDates && !day.current) return false;
82
82
  return isDateEqual(getDate(day.value), modelValue.value[isStart ? 0 : 1]);
83
83
  }
84
-
85
84
  if (defaultedRange.value.enabled) {
86
85
  return (
87
86
  (checkDateEqual(day, isStart) && checkDateBefore(isStart)) ||
@@ -264,7 +264,6 @@ export const useExternalInternalMapper = (emit: VueEmit, props: AllPropsType, is
264
264
  */
265
265
  const parseExternalModelValue = (value: ModelValue): void => {
266
266
  const mappedDate = mapExternalToInternal(value);
267
-
268
267
  if (isValidDate(convertType(mappedDate))) {
269
268
  internalModelValue.value = convertType(mappedDate);
270
269
  formatInputValue();
@@ -49,13 +49,14 @@ function toggle(type: string) {
49
49
  }
50
50
 
51
51
  function close(type?: string) {
52
- if (type === 'start') {
53
- date.value[0] = ''
54
- } else if (type === 'end') {
55
- date.value[1] = ''
56
- } else {
57
- date.value = ''
58
- }
52
+ date.value = undefined
53
+ // if (type === 'start') {
54
+ // date.value[0] = undefined
55
+ // } else if (type === 'end') {
56
+ // date.value[1] = undefined
57
+ // } else {
58
+ // date.value = undefined
59
+ // }
59
60
  }
60
61
 
61
62
  const emit = defineEmits([
@@ -317,11 +317,19 @@ export const formatDate = (
317
317
  ) => {
318
318
  if (typeof formatProp === 'function' && !parser) return formatProp(value);
319
319
  const options = formatLocale ? { locale: formatLocale } : undefined;
320
-
321
320
  if (Array.isArray(value)) {
322
- return `${format(value[0], pattern, options)}${modelAuto && !value[1] ? '' : rangeSeparator}${
323
- value[1] ? format(value[1], pattern, options) : ''
324
- }`;
321
+ let result = ''
322
+ if (isValidDate(value[0])) {
323
+ result += `${format(value[0], pattern, options)}`
324
+ }
325
+ result += `${modelAuto && !value[1] ? '' : rangeSeparator}`
326
+ if (isValidDate(value[1])) {
327
+ result += `${format(value[1], pattern, options)}`
328
+ }
329
+ return result
330
+ // return `${format(value[0], pattern, options)}${modelAuto && !value[1] ? '' : rangeSeparator}${
331
+ // value[1] ? format(value[1], pattern, options) : ''
332
+ // }`;
325
333
  }
326
334
 
327
335
  return format(value, pattern, options);
@@ -340,7 +348,7 @@ export const checkRangeEnabled = <T>(fn: () => T, range: boolean): T => {
340
348
 
341
349
  export const isValidDate = (value: Date | Date[] | null | (Date | null)[]): boolean => {
342
350
  if (Array.isArray(value)) {
343
- return isValid(value[0]) && (value[1] ? isValid(value[1]) : true);
351
+ return isValid(value[0]) || (value[1] ? isValid(value[1]) : true);
344
352
  }
345
353
  return value ? isValid(value) : false;
346
354
  };