@v-c/picker 0.0.1 → 0.0.2

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.
@@ -1,6 +1,6 @@
1
1
  import { usePickerContext } from "../context.js";
2
2
  import { leftPad } from "../../utils/miscUtil.js";
3
- import { getMaskRange, raf as raf$1 } from "./util.js";
3
+ import { getMaskRange, raf } from "./util.js";
4
4
  import useLockEffect from "../hooks/useLockEffect.js";
5
5
  import Icon_default from "./Icon.js";
6
6
  import MaskFormat from "./MaskFormat.js";
@@ -174,12 +174,12 @@ var Input_default = /* @__PURE__ */ defineComponent((props, { attrs, expose }) =
174
174
  return;
175
175
  }
176
176
  inputRef.value?.setSelectionRange(selectionStart.value, selectionEnd.value);
177
- rafRef.value = raf$1(() => {
177
+ rafRef.value = raf(() => {
178
178
  inputRef.value?.setSelectionRange(selectionStart.value, selectionEnd.value);
179
179
  });
180
180
  }, { flush: "post" });
181
181
  onBeforeUnmount(() => {
182
- raf$1.cancel(rafRef.value);
182
+ raf.cancel(rafRef.value);
183
183
  });
184
184
  return () => {
185
185
  const { className, active, showActiveCls, suffixIcon, format, validateFormat, onChange, onInput, helped, onHelp, onSubmit, onKeyDown, preserveInvalidOnBlur, invalid, clearIcon, ...restProps } = props;
@@ -4,14 +4,15 @@ Object.defineProperties(exports, {
4
4
  });
5
5
  const require_rolldown_runtime = require("../../_virtual/rolldown_runtime.cjs");
6
6
  let vue = require("vue");
7
- let _v_c_util = require("@v-c/util");
7
+ let _v_c_util_dist_raf = require("@v-c/util/dist/raf");
8
+ _v_c_util_dist_raf = require_rolldown_runtime.__toESM(_v_c_util_dist_raf);
8
9
  function useDelayState(value, defaultValue, onChange) {
9
10
  const internalValue = (0, vue.ref)(defaultValue);
10
11
  const state = (0, vue.computed)(() => value.value !== void 0 ? value.value : internalValue.value);
11
12
  const nextValueRef = (0, vue.ref)(state.value);
12
13
  const rafRef = (0, vue.ref)();
13
14
  const cancelRaf = () => {
14
- if (rafRef.value) _v_c_util.raf.cancel(rafRef.value);
15
+ if (rafRef.value) _v_c_util_dist_raf.default.cancel(rafRef.value);
15
16
  };
16
17
  const doUpdate = () => {
17
18
  if (value.value === void 0) internalValue.value = nextValueRef.value;
@@ -21,7 +22,7 @@ function useDelayState(value, defaultValue, onChange) {
21
22
  cancelRaf();
22
23
  nextValueRef.value = next;
23
24
  if (next || immediately) doUpdate();
24
- else rafRef.value = (0, _v_c_util.raf)(doUpdate);
25
+ else rafRef.value = (0, _v_c_util_dist_raf.default)(doUpdate);
25
26
  };
26
27
  (0, vue.watch)(value, () => {
27
28
  if (value.value !== void 0) nextValueRef.value = value.value;
@@ -1,5 +1,5 @@
1
1
  import { computed, onBeforeUnmount, ref, watch } from "vue";
2
- import { raf } from "@v-c/util";
2
+ import raf from "@v-c/util/dist/raf";
3
3
  function useDelayState(value, defaultValue, onChange) {
4
4
  const internalValue = ref(defaultValue);
5
5
  const state = computed(() => value.value !== void 0 ? value.value : internalValue.value);
@@ -4,7 +4,8 @@ Object.defineProperties(exports, {
4
4
  });
5
5
  const require_rolldown_runtime = require("../../../_virtual/rolldown_runtime.cjs");
6
6
  let vue = require("vue");
7
- let _v_c_util = require("@v-c/util");
7
+ let _v_c_util_dist_raf = require("@v-c/util/dist/raf");
8
+ _v_c_util_dist_raf = require_rolldown_runtime.__toESM(_v_c_util_dist_raf);
8
9
  var SPEED_PTG = 1 / 3;
9
10
  function useScrollTo(ulRef, value) {
10
11
  const scrollingRef = (0, vue.ref)(false);
@@ -13,7 +14,7 @@ function useScrollTo(ulRef, value) {
13
14
  const scrollRafTimesRef = (0, vue.ref)(0);
14
15
  const isScrolling = () => scrollingRef.value;
15
16
  const stopScroll = () => {
16
- if (scrollRafRef.value) _v_c_util.raf.cancel(scrollRafRef.value);
17
+ if (scrollRafRef.value) _v_c_util_dist_raf.default.cancel(scrollRafRef.value);
17
18
  scrollingRef.value = false;
18
19
  };
19
20
  const startScroll = () => {
@@ -35,7 +36,7 @@ function useScrollTo(ulRef, value) {
35
36
  const targetTop = targetLiTop - firstLiTop;
36
37
  const isVisible = ul.offsetParent !== null;
37
38
  if (targetLiTop === 0 && targetLi !== firstLi || !isVisible) {
38
- if (scrollRafTimesRef.value <= 5) scrollRafRef.value = (0, _v_c_util.raf)(doScroll);
39
+ if (scrollRafTimesRef.value <= 5) scrollRafRef.value = (0, _v_c_util_dist_raf.default)(doScroll);
39
40
  return;
40
41
  }
41
42
  const nextTop = currentTop + (targetTop - currentTop) * SPEED_PTG;
@@ -51,7 +52,7 @@ function useScrollTo(ulRef, value) {
51
52
  return;
52
53
  }
53
54
  ul.scrollTop = nextTop;
54
- scrollRafRef.value = (0, _v_c_util.raf)(doScroll);
55
+ scrollRafRef.value = (0, _v_c_util_dist_raf.default)(doScroll);
55
56
  };
56
57
  if (targetLi && firstLi) doScroll();
57
58
  }
@@ -1,5 +1,5 @@
1
1
  import { ref, unref } from "vue";
2
- import { raf } from "@v-c/util";
2
+ import raf from "@v-c/util/dist/raf";
3
3
  var SPEED_PTG = 1 / 3;
4
4
  function useScrollTo(ulRef, value) {
5
5
  const scrollingRef = ref(false);
@@ -3,27 +3,27 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  const require_rolldown_runtime = require("../_virtual/rolldown_runtime.cjs");
6
- let dayjs_esm = require("dayjs/esm");
7
- dayjs_esm = require_rolldown_runtime.__toESM(dayjs_esm);
8
- let dayjs_esm_plugin_advancedFormat_index = require("dayjs/esm/plugin/advancedFormat/index");
9
- dayjs_esm_plugin_advancedFormat_index = require_rolldown_runtime.__toESM(dayjs_esm_plugin_advancedFormat_index);
10
- let dayjs_esm_plugin_customParseFormat_index = require("dayjs/esm/plugin/customParseFormat/index");
11
- dayjs_esm_plugin_customParseFormat_index = require_rolldown_runtime.__toESM(dayjs_esm_plugin_customParseFormat_index);
12
- let dayjs_esm_plugin_localeData_index = require("dayjs/esm/plugin/localeData/index");
13
- dayjs_esm_plugin_localeData_index = require_rolldown_runtime.__toESM(dayjs_esm_plugin_localeData_index);
14
- let dayjs_esm_plugin_weekday_index = require("dayjs/esm/plugin/weekday/index");
15
- dayjs_esm_plugin_weekday_index = require_rolldown_runtime.__toESM(dayjs_esm_plugin_weekday_index);
16
- let dayjs_esm_plugin_weekOfYear_index = require("dayjs/esm/plugin/weekOfYear/index");
17
- dayjs_esm_plugin_weekOfYear_index = require_rolldown_runtime.__toESM(dayjs_esm_plugin_weekOfYear_index);
18
- let dayjs_esm_plugin_weekYear_index = require("dayjs/esm/plugin/weekYear/index");
19
- dayjs_esm_plugin_weekYear_index = require_rolldown_runtime.__toESM(dayjs_esm_plugin_weekYear_index);
20
- dayjs_esm.default.extend(dayjs_esm_plugin_customParseFormat_index.default);
21
- dayjs_esm.default.extend(dayjs_esm_plugin_advancedFormat_index.default);
22
- dayjs_esm.default.extend(dayjs_esm_plugin_weekday_index.default);
23
- dayjs_esm.default.extend(dayjs_esm_plugin_localeData_index.default);
24
- dayjs_esm.default.extend(dayjs_esm_plugin_weekOfYear_index.default);
25
- dayjs_esm.default.extend(dayjs_esm_plugin_weekYear_index.default);
26
- dayjs_esm.default.extend((_, c) => {
6
+ let dayjs = require("dayjs");
7
+ dayjs = require_rolldown_runtime.__toESM(dayjs);
8
+ let dayjs_plugin_advancedFormat = require("dayjs/plugin/advancedFormat");
9
+ dayjs_plugin_advancedFormat = require_rolldown_runtime.__toESM(dayjs_plugin_advancedFormat);
10
+ let dayjs_plugin_customParseFormat = require("dayjs/plugin/customParseFormat");
11
+ dayjs_plugin_customParseFormat = require_rolldown_runtime.__toESM(dayjs_plugin_customParseFormat);
12
+ let dayjs_plugin_localeData = require("dayjs/plugin/localeData");
13
+ dayjs_plugin_localeData = require_rolldown_runtime.__toESM(dayjs_plugin_localeData);
14
+ let dayjs_plugin_weekday = require("dayjs/plugin/weekday");
15
+ dayjs_plugin_weekday = require_rolldown_runtime.__toESM(dayjs_plugin_weekday);
16
+ let dayjs_plugin_weekOfYear = require("dayjs/plugin/weekOfYear");
17
+ dayjs_plugin_weekOfYear = require_rolldown_runtime.__toESM(dayjs_plugin_weekOfYear);
18
+ let dayjs_plugin_weekYear = require("dayjs/plugin/weekYear");
19
+ dayjs_plugin_weekYear = require_rolldown_runtime.__toESM(dayjs_plugin_weekYear);
20
+ dayjs.default.extend(dayjs_plugin_customParseFormat.default);
21
+ dayjs.default.extend(dayjs_plugin_advancedFormat.default);
22
+ dayjs.default.extend(dayjs_plugin_weekday.default);
23
+ dayjs.default.extend(dayjs_plugin_localeData.default);
24
+ dayjs.default.extend(dayjs_plugin_weekOfYear.default);
25
+ dayjs.default.extend(dayjs_plugin_weekYear.default);
26
+ dayjs.default.extend((_, c) => {
27
27
  const proto = c.prototype;
28
28
  const oldFormat = proto.format;
29
29
  proto.format = function f(formatStr) {
@@ -53,11 +53,11 @@ function parseLocale(locale) {
53
53
  function parseNoMatchNotice() {}
54
54
  var generateConfig = {
55
55
  getNow: () => {
56
- const now = (0, dayjs_esm.default)();
56
+ const now = (0, dayjs.default)();
57
57
  if ("tz" in now && typeof now.tz === "function") return now.tz();
58
58
  return now;
59
59
  },
60
- getFixedDate: (string) => (0, dayjs_esm.default)(string, ["YYYY-M-DD", "YYYY-MM-DD"]),
60
+ getFixedDate: (string) => (0, dayjs.default)(string, ["YYYY-M-DD", "YYYY-MM-DD"]),
61
61
  getEndDate: (date) => date.endOf("month"),
62
62
  getWeekDay: (date) => {
63
63
  const clone = date.locale("en");
@@ -83,11 +83,11 @@ var generateConfig = {
83
83
  isAfter: (date1, date2) => date1.isAfter(date2),
84
84
  isValidate: (date) => date.isValid(),
85
85
  locale: {
86
- getWeekFirstDay: (locale) => (0, dayjs_esm.default)().locale(parseLocale(locale)).localeData().firstDayOfWeek(),
86
+ getWeekFirstDay: (locale) => (0, dayjs.default)().locale(parseLocale(locale)).localeData().firstDayOfWeek(),
87
87
  getWeekFirstDate: (locale, date) => date.locale(parseLocale(locale)).weekday(0),
88
88
  getWeek: (locale, date) => date.locale(parseLocale(locale)).week(),
89
- getShortWeekDays: (locale) => (0, dayjs_esm.default)().locale(parseLocale(locale)).localeData().weekdaysMin(),
90
- getShortMonths: (locale) => (0, dayjs_esm.default)().locale(parseLocale(locale)).localeData().monthsShort(),
89
+ getShortWeekDays: (locale) => (0, dayjs.default)().locale(parseLocale(locale)).localeData().weekdaysMin(),
90
+ getShortMonths: (locale) => (0, dayjs.default)().locale(parseLocale(locale)).localeData().monthsShort(),
91
91
  format: (locale, date, format) => date.locale(parseLocale(locale)).format(format),
92
92
  parse: (locale, text, formats) => {
93
93
  const localeStr = parseLocale(locale);
@@ -97,7 +97,7 @@ var generateConfig = {
97
97
  if (format.includes("wo") || format.includes("Wo")) {
98
98
  const year = formatText.split("-")[0];
99
99
  const weekStr = formatText.split("-")[1];
100
- const firstWeek = (0, dayjs_esm.default)(year, "YYYY").startOf("year").locale(localeStr);
100
+ const firstWeek = (0, dayjs.default)(year, "YYYY").startOf("year").locale(localeStr);
101
101
  for (let j = 0; j <= 52; j += 1) {
102
102
  const nextWeek = firstWeek.add(j, "week");
103
103
  if (nextWeek.format("Wo") === weekStr) return nextWeek;
@@ -105,7 +105,7 @@ var generateConfig = {
105
105
  parseNoMatchNotice();
106
106
  return null;
107
107
  }
108
- const date = (0, dayjs_esm.default)(formatText, format, true).locale(localeStr);
108
+ const date = (0, dayjs.default)(formatText, format, true).locale(localeStr);
109
109
  if (date.isValid()) return date;
110
110
  }
111
111
  if (text) parseNoMatchNotice();
@@ -1,10 +1,10 @@
1
- import dayjs from "dayjs/esm";
2
- import advancedFormat from "dayjs/esm/plugin/advancedFormat/index";
3
- import customParseFormat from "dayjs/esm/plugin/customParseFormat/index";
4
- import localeData from "dayjs/esm/plugin/localeData/index";
5
- import weekday from "dayjs/esm/plugin/weekday/index";
6
- import weekOfYear from "dayjs/esm/plugin/weekOfYear/index";
7
- import weekYear from "dayjs/esm/plugin/weekYear/index";
1
+ import dayjs from "dayjs";
2
+ import advancedFormat from "dayjs/plugin/advancedFormat";
3
+ import customParseFormat from "dayjs/plugin/customParseFormat";
4
+ import localeData from "dayjs/plugin/localeData";
5
+ import weekday from "dayjs/plugin/weekday";
6
+ import weekOfYear from "dayjs/plugin/weekOfYear";
7
+ import weekYear from "dayjs/plugin/weekYear";
8
8
  dayjs.extend(customParseFormat);
9
9
  dayjs.extend(advancedFormat);
10
10
  dayjs.extend(weekday);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@v-c/picker",
3
3
  "type": "module",
4
- "version": "0.0.1",
4
+ "version": "0.0.2",
5
5
  "description": "picker ui component for vue",
6
6
  "publishConfig": {
7
7
  "access": "public"
@@ -28,10 +28,15 @@
28
28
  "import": "./dist/locale/*.js",
29
29
  "require": "./dist/locale/*.cjs"
30
30
  },
31
+ "./generate": {
32
+ "types": "./dist/generate/index.d.ts",
33
+ "import": "./dist/generate/index.js",
34
+ "require": "./dist/generate/index.cjs"
35
+ },
31
36
  "./generate/*": {
37
+ "types": "./dist/generate/*.d.ts",
32
38
  "import": "./dist/generate/*.js",
33
- "require": "./dist/generate/*.cjs",
34
- "types": "./dist/generate/*.d.ts"
39
+ "require": "./dist/generate/*.cjs"
35
40
  },
36
41
  "./dist/*": {
37
42
  "types": "./dist/*.d.ts",
@@ -68,7 +73,8 @@
68
73
  },
69
74
  "dependencies": {
70
75
  "@v-c/overflow": "^1.0.1",
71
- "@v-c/util": "^1.0.6"
76
+ "@v-c/util": "^1.0.6",
77
+ "@v-c/trigger": "^1.0.2"
72
78
  },
73
79
  "devDependencies": {
74
80
  "@types/luxon": "^3.7.1"