@gez/date-time-kit 2.0.0-alpha.24 → 2.0.0-alpha.25

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.
@@ -2,7 +2,7 @@ import { type Ele as CalendarBaseEle, type Weeks } from '../calendar';
2
2
  import { Ele as HhMmSsMsSelectorEle } from '../hhmmss-ms-list-grp/selector';
3
3
  import { type BaseAttrs, type BaseEmits, UiBase } from '../web-component-base';
4
4
  import { Ele as YyyyMmNavEle } from '../yyyymm-nav';
5
- export declare const granularityList: readonly ["day", "hour", "minute", "second", "millisecond"];
5
+ export declare const granularityList: readonly ["year", "month", "day", "hour", "minute", "second", "millisecond"];
6
6
  export type Granularity = (typeof granularityList)[number];
7
7
  export interface Attrs extends BaseAttrs {
8
8
  /**
@@ -16,9 +16,13 @@ import { UiBase } from "../web-component-base/index.mjs";
16
16
  import {
17
17
  Ele as YyyyMmNavEle
18
18
  } from "../yyyymm-nav/index.mjs";
19
+ import { granularityList as dateGranularityList } from "../yyyymmdd-list-grp/selector.mjs";
19
20
  import styleStr from "./index.css.mjs";
20
21
  import html from "./index.html.mjs";
21
- export const granularityList = ["day", ...timeGranularityList];
22
+ export const granularityList = [
23
+ ...dateGranularityList,
24
+ ...timeGranularityList
25
+ ];
22
26
  const diffInMonth = (a, b) => {
23
27
  if (a > b) [a, b] = [b, a];
24
28
  const aYear = a.getFullYear();
@@ -55,7 +59,7 @@ export class Ele extends UiBase {
55
59
  }
56
60
  if (this.minGranularity === "day") {
57
61
  _els.timeSelectors.forEach((e) => e.style.display = "none");
58
- } else {
62
+ } else if (timeGranularityList.includes(this.minGranularity)) {
59
63
  _els.timeSelectors.forEach((e) => e.style.display = "");
60
64
  _els.startTimeSelector.currentTime = timeStart;
61
65
  _els.endTimeSelector.currentTime = timeEnd;
@@ -5,7 +5,7 @@ import { type reExportPopoverAttrs } from '../popover/attr-sync-helper';
5
5
  import { type BaseAttrs, type BaseEmits, type Emit2EventMap, UiBase } from '../web-component-base';
6
6
  import { type DataLimit, type GenPeriodTimesOptions, type PeriodTimeInfo, type QuickGenPeriodTimesOptions, type QuickKey, UTCInfo2LocaleInfo, genPeriodTimes, localeInfo2UTCInfo, quickGenPeriodTime, quickGenPeriodTimeInfo, quickGenPeriodTimes } from './quick-key';
7
7
  export { type QuickKey, type DataLimit, type GenPeriodTimesOptions, type QuickGenPeriodTimesOptions, type PeriodTimeInfo, type Weeks, genPeriodTimes, quickGenPeriodTime, quickGenPeriodTimes, quickGenPeriodTimeInfo, localeInfo2UTCInfo, UTCInfo2LocaleInfo };
8
- export declare const granularityList: readonly ["day", "hour", "minute", "second", "millisecond"];
8
+ export declare const granularityList: readonly ["year", "month", "day", "hour", "minute", "second", "millisecond"];
9
9
  export type Granularity = (typeof granularityList)[number];
10
10
  export type Attrs = BaseAttrs & reExportPopoverAttrs & {
11
11
  /**
@@ -18,6 +18,7 @@ import {
18
18
  import {
19
19
  UiBase
20
20
  } from "../web-component-base/index.mjs";
21
+ import { granularityList as dateGranularityList } from "../yyyymmdd-list-grp/selector.mjs";
21
22
  import styleStr from "./index.css.mjs";
22
23
  import html, { utcText } from "./index.html.mjs";
23
24
  import {
@@ -37,7 +38,10 @@ export {
37
38
  localeInfo2UTCInfo,
38
39
  UTCInfo2LocaleInfo
39
40
  };
40
- export const granularityList = ["day", ...timeGranularityList];
41
+ export const granularityList = [
42
+ ...dateGranularityList,
43
+ ...timeGranularityList
44
+ ];
41
45
  export class Ele extends UiBase {
42
46
  constructor() {
43
47
  super(...arguments);
package/package.json CHANGED
@@ -20,7 +20,7 @@
20
20
  "unbuild": "3.6.0",
21
21
  "vitest": "3.2.4"
22
22
  },
23
- "version": "2.0.0-alpha.24",
23
+ "version": "2.0.0-alpha.25",
24
24
  "type": "module",
25
25
  "private": false,
26
26
  "exports": {
@@ -39,5 +39,5 @@
39
39
  "template",
40
40
  "public"
41
41
  ],
42
- "gitHead": "eaa31e44f36344b169fe6bd8ceca4587af8a6dda"
42
+ "gitHead": "5f7bbab4613cfb586c7cd0e30a41f88a7f63eb70"
43
43
  }
@@ -17,10 +17,14 @@ import {
17
17
  Ele as YyyyMmNavEle,
18
18
  type EventMap as YyyyMmNavEvent
19
19
  } from '../yyyymm-nav';
20
+ import { granularityList as dateGranularityList } from '../yyyymmdd-list-grp/selector';
20
21
  import styleStr from './index.css';
21
22
  import html from './index.html';
22
23
 
23
- export const granularityList = ['day', ...timeGranularityList] as const;
24
+ export const granularityList = [
25
+ ...dateGranularityList,
26
+ ...timeGranularityList
27
+ ] as const;
24
28
  export type Granularity = (typeof granularityList)[number];
25
29
 
26
30
  export interface Attrs extends BaseAttrs {
@@ -213,12 +217,15 @@ export class Ele extends UiBase<Attrs, Emits> {
213
217
  }
214
218
  if (this.minGranularity === 'day') {
215
219
  _els.timeSelectors.forEach((e) => (e.style.display = 'none'));
216
- } else {
220
+ } else if (
221
+ timeGranularityList.includes(this.minGranularity as TimeGranularity)
222
+ ) {
217
223
  _els.timeSelectors.forEach((e) => (e.style.display = ''));
218
224
  _els.startTimeSelector.currentTime = timeStart;
219
225
  _els.endTimeSelector.currentTime = timeEnd;
220
226
  _els.startTimeSelector.minGranularity =
221
- _els.endTimeSelector.minGranularity = this.minGranularity;
227
+ _els.endTimeSelector.minGranularity = this
228
+ .minGranularity as TimeGranularity;
222
229
  }
223
230
  this._updateDateEcho();
224
231
  this._updateNavCtrlBtn();
@@ -17,6 +17,7 @@ import {
17
17
  type Emit2EventMap,
18
18
  UiBase
19
19
  } from '../web-component-base';
20
+ import { granularityList as dateGranularityList } from '../yyyymmdd-list-grp/selector';
20
21
  import styleStr from './index.css';
21
22
  import html, { utcText } from './index.html';
22
23
  import {
@@ -49,7 +50,10 @@ export {
49
50
  UTCInfo2LocaleInfo
50
51
  };
51
52
 
52
- export const granularityList = ['day', ...timeGranularityList] as const;
53
+ export const granularityList = [
54
+ ...dateGranularityList,
55
+ ...timeGranularityList
56
+ ] as const;
53
57
  export type Granularity = (typeof granularityList)[number];
54
58
 
55
59
  export type Attrs = BaseAttrs &