@uzum-tech/ui 1.2.0 → 1.2.1

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,5 +1,5 @@
1
1
  import { DatePickerType } from '../config';
2
- import { DateCommonItem } from '../utils';
2
+ import { DateCommonItem, DateItem } from '../utils';
3
3
  /**
4
4
  * Date Panel
5
5
  * Update picker value on:
@@ -12,6 +12,12 @@ declare const _default: import("vue").DefineComponent<{
12
12
  readonly default: () => string[];
13
13
  };
14
14
  readonly active: BooleanConstructor;
15
+ /**
16
+ * Date Panel
17
+ * Update picker value on:
18
+ * 1. item click
19
+ * 2. clear click
20
+ */
15
21
  readonly dateFormat: StringConstructor;
16
22
  readonly type: import("vue").PropType<DatePickerType>;
17
23
  readonly timeFormat: {
@@ -1209,7 +1215,7 @@ declare const _default: import("vue").DefineComponent<{
1209
1215
  isHourDisabled: import("vue").ComputedRef<import("../../../time-picker/src/interface").IsHourDisabled | undefined>;
1210
1216
  isMinuteDisabled: import("vue").ComputedRef<import("../../../time-picker/src/interface").IsMinuteDisabled | undefined>;
1211
1217
  isSecondDisabled: import("vue").ComputedRef<import("../../../time-picker/src/interface").IsSecondDisabled | undefined>;
1212
- dateArray: import("vue").ComputedRef<import("../utils").DateItem[]>;
1218
+ dateArray: import("vue").ComputedRef<DateItem[]>;
1213
1219
  monthArray: import("vue").ComputedRef<import("../utils").MonthItem[]>;
1214
1220
  yearArray: import("vue").ComputedRef<import("../utils").YearItem[]>;
1215
1221
  quarterArray: import("vue").ComputedRef<import("../utils").QuarterItem[]>;
@@ -1231,6 +1237,12 @@ declare const _default: import("vue").DefineComponent<{
1231
1237
  readonly default: () => string[];
1232
1238
  };
1233
1239
  readonly active: BooleanConstructor;
1240
+ /**
1241
+ * Date Panel
1242
+ * Update picker value on:
1243
+ * 1. item click
1244
+ * 2. clear click
1245
+ */
1234
1246
  readonly dateFormat: StringConstructor;
1235
1247
  readonly type: import("vue").PropType<DatePickerType>;
1236
1248
  readonly timeFormat: {
@@ -4,6 +4,7 @@ import { UBaseFocusDetector } from '../../../_internal';
4
4
  import { warnOnce } from '../../../_utils';
5
5
  import { useCalendar, useCalendarProps } from './use-calendar';
6
6
  import PanelHeader from './panelHeader';
7
+ import { getMsByDateCommonItem } from '../utils';
7
8
  /**
8
9
  * Date Panel
9
10
  * Update picker value on:
@@ -29,13 +30,17 @@ export default defineComponent({
29
30
  const isWithoutDay = computed(() => withoutDayTypes.includes(type));
30
31
  const isMonth = computed(() => monthTypes.includes(type));
31
32
  const isYear = computed(() => type === 'year');
33
+ const updateMonth = (item) => {
34
+ const dateItem = item;
35
+ calendar.handleDateClick(Object.assign(Object.assign({}, dateItem), { dateObject: Object.assign(Object.assign({}, dateItem.dateObject), { month: dateItem.dateObject.month || 0, date: 1 }), ts: getMsByDateCommonItem(dateItem) }));
36
+ };
32
37
  const handleMonthClick = (value, _doUpdate, item) => {
33
38
  calendar.onUpdateCalendarValue(value);
34
- isMonth.value && calendar.handleDateClick(item);
39
+ isMonth.value && updateMonth(item);
35
40
  };
36
41
  const handleYearClick = (value, _doUpdate, item) => {
37
42
  calendar.onUpdateCalendarValue(value);
38
- isYear.value && calendar.handleDateClick(item);
43
+ isYear.value && updateMonth(item);
39
44
  };
40
45
  return Object.assign(Object.assign({}, calendar), { isWithoutDay,
41
46
  isMonth,
@@ -15,6 +15,7 @@ import { UBaseFocusDetector } from '../../../_internal';
15
15
  import { warnOnce } from '../../../_utils';
16
16
  import { useDualCalendar, useDualCalendarProps } from './use-dual-calendar';
17
17
  import PanelHeader from './panelHeader';
18
+ import { getMsByDateCommonItem } from '../utils';
18
19
  export default defineComponent({
19
20
  name: 'DateRangePanel',
20
21
  props: useDualCalendarProps,
@@ -34,30 +35,30 @@ export default defineComponent({
34
35
  const isWithoutDay = computed(() => withoutDayTypes.includes(type));
35
36
  const isMonthRange = computed(() => monthRanges.includes(type));
36
37
  const isYearRange = computed(() => type === 'yearrange');
37
- const monthToDateItem = (value, item, isEnd = false) => {
38
+ const monthToDateItem = (item, isEnd = false) => {
38
39
  const _a = item, { dateObject } = _a, monthItem = __rest(_a, ["dateObject"]);
39
- return Object.assign(Object.assign({}, monthItem), { dateObject: Object.assign(Object.assign({}, dateObject), { date: 1 }), inCurrentMonth: false, isCurrentDate: false, inSpan: false, startOfSpan: false, endOfSpan: isEnd, selected: isEnd, ts: value, type: 'date' });
40
+ return Object.assign(Object.assign({}, monthItem), { dateObject: Object.assign(Object.assign({}, dateObject), { date: 1 }), inCurrentMonth: false, isCurrentDate: false, inSpan: false, startOfSpan: false, endOfSpan: isEnd, selected: isEnd, ts: getMsByDateCommonItem(item), type: 'date' });
40
41
  };
41
- const setMonthRange = (value, item, isEnd = false) => {
42
- const monthItem = monthToDateItem(value, item, isEnd);
42
+ const setMonthRange = (item, isEnd = false) => {
43
+ const monthItem = monthToDateItem(item, isEnd);
43
44
  calendar.handleDateMouseEnter(monthItem);
44
45
  calendar.handleDateClick(monthItem);
45
46
  };
46
47
  const handleMonthStartClick = (value, _doUpdate, item) => {
47
48
  calendar.onUpdateStartCalendarValue(value);
48
- isMonthRange.value && setMonthRange(value, item);
49
+ isMonthRange.value && setMonthRange(item);
49
50
  };
50
51
  const handleMonthEndClick = (value, _doUpdate, item) => {
51
52
  calendar.onUpdateEndCalendarValue(value);
52
- isMonthRange.value && setMonthRange(value, item, true);
53
+ isMonthRange.value && setMonthRange(item, true);
53
54
  };
54
55
  const handleYearStartClick = (value, _doUpdate, item) => {
55
56
  calendar.onUpdateStartCalendarValue(value);
56
- isYearRange.value && setMonthRange(value, item);
57
+ isYearRange.value && setMonthRange(item);
57
58
  };
58
59
  const handleYearEndClick = (value, _doUpdate, item) => {
59
60
  calendar.onUpdateEndCalendarValue(value);
60
- isYearRange.value && setMonthRange(value, item, true);
61
+ isYearRange.value && setMonthRange(item, true);
61
62
  };
62
63
  return Object.assign(Object.assign({}, calendar), { isMonthRange,
63
64
  isYearRange,
@@ -63,4 +63,5 @@ declare function getDefaultTime(timeValue: string | undefined): {
63
63
  seconds: number;
64
64
  } | undefined;
65
65
  declare function pluckValueFromRange(value: Value | null, type: 'start' | 'end'): number | null;
66
- export { dateArray, monthArray, yearArray, quarterArray, strictParse, getDerivedTimeFromKeyboardEvent, getDefaultTime, pluckValueFromRange };
66
+ declare function getMsByDateCommonItem(item?: DateCommonItem): number;
67
+ export { dateArray, monthArray, yearArray, quarterArray, strictParse, getDerivedTimeFromKeyboardEvent, getDefaultTime, getMsByDateCommonItem, pluckValueFromRange };
@@ -188,4 +188,16 @@ function getDefaultTime(timeValue) {
188
188
  function pluckValueFromRange(value, type) {
189
189
  return Array.isArray(value) ? value[type === 'start' ? 0 : 1] : null;
190
190
  }
191
- export { dateArray, monthArray, yearArray, quarterArray, strictParse, getDerivedTimeFromKeyboardEvent, getDefaultTime, pluckValueFromRange };
191
+ function isDateItem(item) {
192
+ return !!item;
193
+ }
194
+ function getMsByDateCommonItem(item) {
195
+ if (!isDateItem(item))
196
+ return 0;
197
+ const { dateObject: { year, month, date } } = item;
198
+ const resultDate = new Date();
199
+ resultDate.setFullYear(year, month || 0, date || 1);
200
+ resultDate.setHours(0, 0, 0);
201
+ return resultDate.getTime();
202
+ }
203
+ export { dateArray, monthArray, yearArray, quarterArray, strictParse, getDerivedTimeFromKeyboardEvent, getDefaultTime, getMsByDateCommonItem, pluckValueFromRange };
package/es/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- declare const _default: "1.2.0";
1
+ declare const _default: "1.2.1";
2
2
  export default _default;
package/es/version.js CHANGED
@@ -1 +1 @@
1
- export default '1.2.0';
1
+ export default '1.2.1';
@@ -1,5 +1,5 @@
1
1
  import { DatePickerType } from '../config';
2
- import { DateCommonItem } from '../utils';
2
+ import { DateCommonItem, DateItem } from '../utils';
3
3
  /**
4
4
  * Date Panel
5
5
  * Update picker value on:
@@ -12,6 +12,12 @@ declare const _default: import("vue").DefineComponent<{
12
12
  readonly default: () => string[];
13
13
  };
14
14
  readonly active: BooleanConstructor;
15
+ /**
16
+ * Date Panel
17
+ * Update picker value on:
18
+ * 1. item click
19
+ * 2. clear click
20
+ */
15
21
  readonly dateFormat: StringConstructor;
16
22
  readonly type: import("vue").PropType<DatePickerType>;
17
23
  readonly timeFormat: {
@@ -1209,7 +1215,7 @@ declare const _default: import("vue").DefineComponent<{
1209
1215
  isHourDisabled: import("vue").ComputedRef<import("../../../time-picker/src/interface").IsHourDisabled | undefined>;
1210
1216
  isMinuteDisabled: import("vue").ComputedRef<import("../../../time-picker/src/interface").IsMinuteDisabled | undefined>;
1211
1217
  isSecondDisabled: import("vue").ComputedRef<import("../../../time-picker/src/interface").IsSecondDisabled | undefined>;
1212
- dateArray: import("vue").ComputedRef<import("../utils").DateItem[]>;
1218
+ dateArray: import("vue").ComputedRef<DateItem[]>;
1213
1219
  monthArray: import("vue").ComputedRef<import("../utils").MonthItem[]>;
1214
1220
  yearArray: import("vue").ComputedRef<import("../utils").YearItem[]>;
1215
1221
  quarterArray: import("vue").ComputedRef<import("../utils").QuarterItem[]>;
@@ -1231,6 +1237,12 @@ declare const _default: import("vue").DefineComponent<{
1231
1237
  readonly default: () => string[];
1232
1238
  };
1233
1239
  readonly active: BooleanConstructor;
1240
+ /**
1241
+ * Date Panel
1242
+ * Update picker value on:
1243
+ * 1. item click
1244
+ * 2. clear click
1245
+ */
1234
1246
  readonly dateFormat: StringConstructor;
1235
1247
  readonly type: import("vue").PropType<DatePickerType>;
1236
1248
  readonly timeFormat: {
@@ -9,6 +9,7 @@ const _internal_1 = require("../../../_internal");
9
9
  const _utils_1 = require("../../../_utils");
10
10
  const use_calendar_1 = require("./use-calendar");
11
11
  const panelHeader_1 = __importDefault(require("./panelHeader"));
12
+ const utils_1 = require("../utils");
12
13
  /**
13
14
  * Date Panel
14
15
  * Update picker value on:
@@ -34,13 +35,17 @@ exports.default = (0, vue_1.defineComponent)({
34
35
  const isWithoutDay = (0, vue_1.computed)(() => withoutDayTypes.includes(type));
35
36
  const isMonth = (0, vue_1.computed)(() => monthTypes.includes(type));
36
37
  const isYear = (0, vue_1.computed)(() => type === 'year');
38
+ const updateMonth = (item) => {
39
+ const dateItem = item;
40
+ calendar.handleDateClick(Object.assign(Object.assign({}, dateItem), { dateObject: Object.assign(Object.assign({}, dateItem.dateObject), { month: dateItem.dateObject.month || 0, date: 1 }), ts: (0, utils_1.getMsByDateCommonItem)(dateItem) }));
41
+ };
37
42
  const handleMonthClick = (value, _doUpdate, item) => {
38
43
  calendar.onUpdateCalendarValue(value);
39
- isMonth.value && calendar.handleDateClick(item);
44
+ isMonth.value && updateMonth(item);
40
45
  };
41
46
  const handleYearClick = (value, _doUpdate, item) => {
42
47
  calendar.onUpdateCalendarValue(value);
43
- isYear.value && calendar.handleDateClick(item);
48
+ isYear.value && updateMonth(item);
44
49
  };
45
50
  return Object.assign(Object.assign({}, calendar), { isWithoutDay,
46
51
  isMonth,
@@ -20,6 +20,7 @@ const _internal_1 = require("../../../_internal");
20
20
  const _utils_1 = require("../../../_utils");
21
21
  const use_dual_calendar_1 = require("./use-dual-calendar");
22
22
  const panelHeader_1 = __importDefault(require("./panelHeader"));
23
+ const utils_1 = require("../utils");
23
24
  exports.default = (0, vue_1.defineComponent)({
24
25
  name: 'DateRangePanel',
25
26
  props: use_dual_calendar_1.useDualCalendarProps,
@@ -39,30 +40,30 @@ exports.default = (0, vue_1.defineComponent)({
39
40
  const isWithoutDay = (0, vue_1.computed)(() => withoutDayTypes.includes(type));
40
41
  const isMonthRange = (0, vue_1.computed)(() => monthRanges.includes(type));
41
42
  const isYearRange = (0, vue_1.computed)(() => type === 'yearrange');
42
- const monthToDateItem = (value, item, isEnd = false) => {
43
+ const monthToDateItem = (item, isEnd = false) => {
43
44
  const _a = item, { dateObject } = _a, monthItem = __rest(_a, ["dateObject"]);
44
- return Object.assign(Object.assign({}, monthItem), { dateObject: Object.assign(Object.assign({}, dateObject), { date: 1 }), inCurrentMonth: false, isCurrentDate: false, inSpan: false, startOfSpan: false, endOfSpan: isEnd, selected: isEnd, ts: value, type: 'date' });
45
+ return Object.assign(Object.assign({}, monthItem), { dateObject: Object.assign(Object.assign({}, dateObject), { date: 1 }), inCurrentMonth: false, isCurrentDate: false, inSpan: false, startOfSpan: false, endOfSpan: isEnd, selected: isEnd, ts: (0, utils_1.getMsByDateCommonItem)(item), type: 'date' });
45
46
  };
46
- const setMonthRange = (value, item, isEnd = false) => {
47
- const monthItem = monthToDateItem(value, item, isEnd);
47
+ const setMonthRange = (item, isEnd = false) => {
48
+ const monthItem = monthToDateItem(item, isEnd);
48
49
  calendar.handleDateMouseEnter(monthItem);
49
50
  calendar.handleDateClick(monthItem);
50
51
  };
51
52
  const handleMonthStartClick = (value, _doUpdate, item) => {
52
53
  calendar.onUpdateStartCalendarValue(value);
53
- isMonthRange.value && setMonthRange(value, item);
54
+ isMonthRange.value && setMonthRange(item);
54
55
  };
55
56
  const handleMonthEndClick = (value, _doUpdate, item) => {
56
57
  calendar.onUpdateEndCalendarValue(value);
57
- isMonthRange.value && setMonthRange(value, item, true);
58
+ isMonthRange.value && setMonthRange(item, true);
58
59
  };
59
60
  const handleYearStartClick = (value, _doUpdate, item) => {
60
61
  calendar.onUpdateStartCalendarValue(value);
61
- isYearRange.value && setMonthRange(value, item);
62
+ isYearRange.value && setMonthRange(item);
62
63
  };
63
64
  const handleYearEndClick = (value, _doUpdate, item) => {
64
65
  calendar.onUpdateEndCalendarValue(value);
65
- isYearRange.value && setMonthRange(value, item, true);
66
+ isYearRange.value && setMonthRange(item, true);
66
67
  };
67
68
  return Object.assign(Object.assign({}, calendar), { isMonthRange,
68
69
  isYearRange,
@@ -63,4 +63,5 @@ declare function getDefaultTime(timeValue: string | undefined): {
63
63
  seconds: number;
64
64
  } | undefined;
65
65
  declare function pluckValueFromRange(value: Value | null, type: 'start' | 'end'): number | null;
66
- export { dateArray, monthArray, yearArray, quarterArray, strictParse, getDerivedTimeFromKeyboardEvent, getDefaultTime, pluckValueFromRange };
66
+ declare function getMsByDateCommonItem(item?: DateCommonItem): number;
67
+ export { dateArray, monthArray, yearArray, quarterArray, strictParse, getDerivedTimeFromKeyboardEvent, getDefaultTime, getMsByDateCommonItem, pluckValueFromRange };
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.pluckValueFromRange = exports.getDefaultTime = exports.getDerivedTimeFromKeyboardEvent = exports.strictParse = exports.quarterArray = exports.yearArray = exports.monthArray = exports.dateArray = void 0;
3
+ exports.pluckValueFromRange = exports.getMsByDateCommonItem = exports.getDefaultTime = exports.getDerivedTimeFromKeyboardEvent = exports.strictParse = exports.quarterArray = exports.yearArray = exports.monthArray = exports.dateArray = void 0;
4
4
  const date_fns_1 = require("date-fns"); //
5
5
  const config_1 = require("./config");
6
6
  function getDerivedTimeFromKeyboardEvent(prevValue, event) {
@@ -199,3 +199,16 @@ function pluckValueFromRange(value, type) {
199
199
  return Array.isArray(value) ? value[type === 'start' ? 0 : 1] : null;
200
200
  }
201
201
  exports.pluckValueFromRange = pluckValueFromRange;
202
+ function isDateItem(item) {
203
+ return !!item;
204
+ }
205
+ function getMsByDateCommonItem(item) {
206
+ if (!isDateItem(item))
207
+ return 0;
208
+ const { dateObject: { year, month, date } } = item;
209
+ const resultDate = new Date();
210
+ resultDate.setFullYear(year, month || 0, date || 1);
211
+ resultDate.setHours(0, 0, 0);
212
+ return resultDate.getTime();
213
+ }
214
+ exports.getMsByDateCommonItem = getMsByDateCommonItem;
package/lib/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- declare const _default: "1.2.0";
1
+ declare const _default: "1.2.1";
2
2
  export default _default;
package/lib/version.js CHANGED
@@ -1,3 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = '1.2.0';
3
+ exports.default = '1.2.1';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uzum-tech/ui",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "description": "A Vue 3 Component Library. Fairly Complete, Theme Customizable, Uses TypeScript, Fast",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
package/web-types.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "$schema": "https://raw.githubusercontent.com/JetBrains/web-types/master/schema/web-types.json",
3
3
  "framework": "vue",
4
4
  "name": "@uzum-tech/ui",
5
- "version": "1.2.0",
5
+ "version": "1.2.1",
6
6
  "js-types-syntax": "typescript",
7
7
  "contributions": {
8
8
  "html": {