@gez/date-time-kit 2.0.0-alpha.23 → 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.
- package/dist/assets/date.svg +1 -0
- package/dist/assets/index.d.ts +2 -1
- package/dist/assets/index.mjs +2 -1
- package/dist/components/calendar/index.d.ts +6 -4
- package/dist/components/calendar/index.mjs +25 -29
- package/dist/components/date-time-selector/common.d.ts +6 -0
- package/dist/components/date-time-selector/common.mjs +7 -0
- package/dist/components/date-time-selector/index.d.ts +40 -14
- package/dist/components/date-time-selector/index.html.mjs +4 -1
- package/dist/components/date-time-selector/index.mjs +182 -67
- package/dist/components/date-time-selector/styleStr.mjs +2 -1
- package/dist/components/hhmmss-ms-list-grp/base.d.ts +20 -12
- package/dist/components/hhmmss-ms-list-grp/base.mjs +62 -104
- package/dist/components/hhmmss-ms-list-grp/css.mjs +1 -1
- package/dist/components/hhmmss-ms-list-grp/html.mjs +2 -2
- package/dist/components/hhmmss-ms-list-grp/index.d.ts +0 -1
- package/dist/components/hhmmss-ms-list-grp/index.mjs +2 -3
- package/dist/components/hhmmss-ms-list-grp/selector.d.ts +25 -8
- package/dist/components/hhmmss-ms-list-grp/selector.mjs +58 -32
- package/dist/components/i18n/index.d.ts +3 -4
- package/dist/components/i18n/index.mjs +4 -9
- package/dist/components/num-list/index.d.ts +10 -6
- package/dist/components/num-list/index.mjs +37 -33
- package/dist/components/period-selector/index.d.ts +20 -15
- package/dist/components/period-selector/index.mjs +93 -180
- package/dist/components/popover/attr-sync-helper.d.ts +1 -0
- package/dist/components/popover/attr-sync-helper.mjs +5 -3
- package/dist/components/popover/index.d.ts +7 -7
- package/dist/components/popover/index.mjs +34 -46
- package/dist/components/quick-selector/index.d.ts +10 -7
- package/dist/components/quick-selector/index.mjs +52 -99
- package/dist/components/web-component-base/index.d.ts +20 -6
- package/dist/components/web-component-base/index.mjs +70 -29
- package/dist/components/yyyymm-nav/index.d.ts +2 -4
- package/dist/components/yyyymm-nav/index.mjs +18 -45
- package/dist/components/yyyymmdd-list-grp/base.d.ts +55 -0
- package/dist/components/yyyymmdd-list-grp/base.mjs +157 -0
- package/dist/components/yyyymmdd-list-grp/css.d.ts +3 -0
- package/dist/components/yyyymmdd-list-grp/css.mjs +9 -0
- package/dist/components/yyyymmdd-list-grp/html.d.ts +2 -0
- package/dist/components/yyyymmdd-list-grp/html.mjs +9 -0
- package/dist/components/yyyymmdd-list-grp/index.d.ts +7 -43
- package/dist/components/yyyymmdd-list-grp/index.mjs +5 -173
- package/dist/components/yyyymmdd-list-grp/selector.d.ts +51 -0
- package/dist/components/yyyymmdd-list-grp/selector.mjs +121 -0
- package/dist/i18n.d.ts +1 -0
- package/dist/i18n.mjs +25 -16
- package/dist/utils.d.ts +1 -1
- package/package.json +2 -2
- package/src/assets/date.svg +1 -0
- package/src/assets/index.ts +2 -1
- package/src/components/calendar/index.ts +27 -35
- package/src/components/date-time-selector/common.ts +6 -0
- package/src/components/date-time-selector/index.html.ts +18 -11
- package/src/components/date-time-selector/index.ts +196 -75
- package/src/components/date-time-selector/styleStr.ts +21 -9
- package/src/components/hhmmss-ms-list-grp/base.ts +69 -118
- package/src/components/hhmmss-ms-list-grp/css.ts +3 -3
- package/src/components/hhmmss-ms-list-grp/html.ts +30 -37
- package/src/components/hhmmss-ms-list-grp/index.ts +6 -7
- package/src/components/hhmmss-ms-list-grp/selector.ts +68 -42
- package/src/components/i18n/index.ts +4 -15
- package/src/components/num-list/index.ts +28 -29
- package/src/components/period-selector/index.ts +101 -189
- package/src/components/popover/attr-sync-helper.ts +9 -3
- package/src/components/popover/index.ts +24 -39
- package/src/components/quick-selector/index.ts +49 -105
- package/src/components/web-component-base/index.ts +96 -30
- package/src/components/yyyymm-nav/index.ts +20 -50
- package/src/components/yyyymmdd-list-grp/base.ts +199 -0
- package/src/components/yyyymmdd-list-grp/css.ts +141 -0
- package/src/components/yyyymmdd-list-grp/html.ts +36 -0
- package/src/components/yyyymmdd-list-grp/index.ts +8 -217
- package/src/components/yyyymmdd-list-grp/selector.ts +158 -0
- package/src/i18n.ts +26 -16
- package/src/utils.ts +2 -2
- package/dist/components/yyyymmdd-list-grp/index.css.d.ts +0 -2
- package/dist/components/yyyymmdd-list-grp/index.css.mjs +0 -6
- package/dist/components/yyyymmdd-list-grp/index.html.d.ts +0 -2
- package/dist/components/yyyymmdd-list-grp/index.html.mjs +0 -8
- package/src/components/yyyymmdd-list-grp/index.css.ts +0 -36
- package/src/components/yyyymmdd-list-grp/index.html.ts +0 -20
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 18 18"><path d="M12.75.042c.345 0 .625.28.625.625v.625H14c1.726 0 3.125 1.4 3.125 3.125v10c0 1.726-1.4 3.125-3.125 3.125H4a3.125 3.125 0 0 1-3.125-3.125v-10c0-1.726 1.4-3.125 3.125-3.125h.625V.667a.625.625 0 1 1 1.25 0v.625h6.25V.667c0-.345.28-.625.625-.625M2.125 14.417c0 1.035.84 1.875 1.875 1.875h10c1.035 0 1.875-.84 1.875-1.875V6.708H2.125zm3.19-2.29a.626.626 0 0 1 0 1.245l-.065.003h-.833a.625.625 0 0 1 0-1.25h.833l.064.003Zm4.165 0a.626.626 0 0 1 0 1.245l-.063.003h-.834a.625.625 0 0 1 0-1.25h.834zm4.168 0a.625.625 0 0 1 0 1.245l-.065.003h-.833a.625.625 0 0 1 0-1.25h.833zM5.314 8.796a.625.625 0 0 1 0 1.243l-.064.004h-.833a.625.625 0 0 1 0-1.25h.833zm4.166 0a.626.626 0 0 1 0 1.243l-.063.004h-.834a.626.626 0 0 1 0-1.25h.834zm4.168 0a.625.625 0 0 1 0 1.243l-.065.004h-.833a.625.625 0 0 1 0-1.25h.833zM4 2.542c-1.036 0-1.875.84-1.875 1.875v1.041h13.75V4.417c0-1.036-.84-1.875-1.875-1.875h-.625v.625l-.003.063a.626.626 0 0 1-1.244 0l-.003-.063v-.625h-6.25v.625l-.003.063a.626.626 0 0 1-1.244 0l-.003-.063v-.625z"/></svg>
|
package/dist/assets/index.d.ts
CHANGED
|
@@ -6,5 +6,6 @@ export declare const arrowLeftDoubleSvg = "<svg class=\"bidirectional-flip\" wid
|
|
|
6
6
|
export declare const arrowRightDoubleSvg = "<svg class=\"bidirectional-flip\" width=\"17\" height=\"17\" fill=\"currentColor\"><path d=\"M7.963 1.703a.5.5 0 0 0-.707.707l5.87 5.87-5.774 5.774a.5.5 0 0 0 .707.707l6.128-6.128a.5.5 0 0 0-.051-.751.493.493 0 0 0-.045-.051L7.963 1.703ZM3.963 1.703a.5.5 0 0 0-.707.707l5.87 5.87-5.774 5.774a.5.5 0 0 0 .707.707l6.128-6.128a.5.5 0 0 0-.051-.751.493.493 0 0 0-.045-.051L3.963 1.703Z\"/></svg>";
|
|
7
7
|
export declare const arrowDownSvg = "<svg class=\"bidirectional-flip\" width=\"15\" height=\"15\" fill=\"currentColor\"><path d=\"m8.02 10.54 3.96-4.4a.583.583 0 0 0-.433-.973h-7.88a.583.583 0 0 0-.434.973l3.94 4.378c.216.24.585.26.824.044l.022-.021Z\"/></svg>";
|
|
8
8
|
export declare const backArrowSvg = "<svg class=\"bidirectional-flip\" width=\"24\" height=\"24\" fill=\"currentColor\"><path d=\"M9.894 5.106a.75.75 0 0 1 0 1.06L4.811 11.25 21 11.25a.75.75 0 0 1 0 1.5l-16.191-.001 5.085 5.085a.75.75 0 0 1-1.06 1.06L2.47 12.53a.75.75 0 0 1 0-1.06l6.364-6.364a.75.75 0 0 1 1.06 0Z\"/></svg>";
|
|
9
|
-
export declare const timeSvg = "<svg
|
|
9
|
+
export declare const timeSvg = "<svg viewBox=\"0 0 14 15\" fill=\"currentColor\"><path d=\"M7.4335 4.241a.4376.4376 0 0 0-.871.0594v3.783l.0044.0622a.4375.4375 0 0 0 .1921.3029L8.9242 9.877l.0566.0317a.4376.4376 0 0 0 .5495-.1559l.0317-.0566a.4376.4376 0 0 0-.1559-.5495L7.4375 7.8471V4.3004l-.004-.0593ZM7 1.6667c-3.2217 0-5.8333 2.6116-5.8333 5.8333 0 3.2217 2.6116 5.8333 5.8333 5.8333 3.2217 0 5.8333-2.6116 5.8333-5.8333 0-3.2217-2.6116-5.8333-5.8333-5.8333Zm0 .814c2.7721 0 5.0194 2.2472 5.0194 5.0193 0 2.7721-2.2473 5.0194-5.0194 5.0194S1.9806 10.2721 1.9806 7.5 4.228 2.4806 7 2.4806Z\"/></svg>";
|
|
10
10
|
export declare const closeBarSvg = "<svg><rect width=\"40\" height=\"4\" rx=\"2\"/></svg>";
|
|
11
|
+
export declare const dateSvg = "<svg viewBox=\"0 0 18 18\" fill=\"currentColor\"><path d=\"M12.75.042c.345 0 .625.28.625.625v.625H14c1.726 0 3.125 1.4 3.125 3.125v10c0 1.726-1.4 3.125-3.125 3.125H4a3.125 3.125 0 0 1-3.125-3.125v-10c0-1.726 1.4-3.125 3.125-3.125h.625V.667a.625.625 0 1 1 1.25 0v.625h6.25V.667c0-.345.28-.625.625-.625M2.125 14.417c0 1.035.84 1.875 1.875 1.875h10c1.035 0 1.875-.84 1.875-1.875V6.708H2.125zm3.19-2.29a.626.626 0 0 1 0 1.245l-.065.003h-.833a.625.625 0 0 1 0-1.25h.833l.064.003Zm4.165 0a.626.626 0 0 1 0 1.245l-.063.003h-.834a.625.625 0 0 1 0-1.25h.834zm4.168 0a.625.625 0 0 1 0 1.245l-.065.003h-.833a.625.625 0 0 1 0-1.25h.833zM5.314 8.796a.625.625 0 0 1 0 1.243l-.064.004h-.833a.625.625 0 0 1 0-1.25h.833zm4.166 0a.626.626 0 0 1 0 1.243l-.063.004h-.834a.626.626 0 0 1 0-1.25h.834zm4.168 0a.625.625 0 0 1 0 1.243l-.065.004h-.833a.625.625 0 0 1 0-1.25h.833zM4 2.542c-1.036 0-1.875.84-1.875 1.875v1.041h13.75V4.417c0-1.036-.84-1.875-1.875-1.875h-.625v.625l-.003.063a.626.626 0 0 1-1.244 0l-.003-.063v-.625h-6.25v.625l-.003.063a.626.626 0 0 1-1.244 0l-.003-.063v-.625z\"/></svg>";
|
package/dist/assets/index.mjs
CHANGED
|
@@ -10,5 +10,6 @@ export const arrowLeftDoubleSvg = '<svg class="bidirectional-flip" width="16" he
|
|
|
10
10
|
export const arrowRightDoubleSvg = '<svg class="bidirectional-flip" width="17" height="17" fill="currentColor"><path d="M7.963 1.703a.5.5 0 0 0-.707.707l5.87 5.87-5.774 5.774a.5.5 0 0 0 .707.707l6.128-6.128a.5.5 0 0 0-.051-.751.493.493 0 0 0-.045-.051L7.963 1.703ZM3.963 1.703a.5.5 0 0 0-.707.707l5.87 5.87-5.774 5.774a.5.5 0 0 0 .707.707l6.128-6.128a.5.5 0 0 0-.051-.751.493.493 0 0 0-.045-.051L3.963 1.703Z"/></svg>';
|
|
11
11
|
export const arrowDownSvg = '<svg class="bidirectional-flip" width="15" height="15" fill="currentColor"><path d="m8.02 10.54 3.96-4.4a.583.583 0 0 0-.433-.973h-7.88a.583.583 0 0 0-.434.973l3.94 4.378c.216.24.585.26.824.044l.022-.021Z"/></svg>';
|
|
12
12
|
export const backArrowSvg = '<svg class="bidirectional-flip" width="24" height="24" fill="currentColor"><path d="M9.894 5.106a.75.75 0 0 1 0 1.06L4.811 11.25 21 11.25a.75.75 0 0 1 0 1.5l-16.191-.001 5.085 5.085a.75.75 0 0 1-1.06 1.06L2.47 12.53a.75.75 0 0 1 0-1.06l6.364-6.364a.75.75 0 0 1 1.06 0Z"/></svg>';
|
|
13
|
-
export const timeSvg = '<svg
|
|
13
|
+
export const timeSvg = '<svg viewBox="0 0 14 15" fill="currentColor"><path d="M7.4335 4.241a.4376.4376 0 0 0-.871.0594v3.783l.0044.0622a.4375.4375 0 0 0 .1921.3029L8.9242 9.877l.0566.0317a.4376.4376 0 0 0 .5495-.1559l.0317-.0566a.4376.4376 0 0 0-.1559-.5495L7.4375 7.8471V4.3004l-.004-.0593ZM7 1.6667c-3.2217 0-5.8333 2.6116-5.8333 5.8333 0 3.2217 2.6116 5.8333 5.8333 5.8333 3.2217 0 5.8333-2.6116 5.8333-5.8333 0-3.2217-2.6116-5.8333-5.8333-5.8333Zm0 .814c2.7721 0 5.0194 2.2472 5.0194 5.0193 0 2.7721-2.2473 5.0194-5.0194 5.0194S1.9806 10.2721 1.9806 7.5 4.228 2.4806 7 2.4806Z"/></svg>';
|
|
14
14
|
export const closeBarSvg = '<svg><rect width="40" height="4" rx="2"/></svg>';
|
|
15
|
+
export const dateSvg = '<svg viewBox="0 0 18 18" fill="currentColor"><path d="M12.75.042c.345 0 .625.28.625.625v.625H14c1.726 0 3.125 1.4 3.125 3.125v10c0 1.726-1.4 3.125-3.125 3.125H4a3.125 3.125 0 0 1-3.125-3.125v-10c0-1.726 1.4-3.125 3.125-3.125h.625V.667a.625.625 0 1 1 1.25 0v.625h6.25V.667c0-.345.28-.625.625-.625M2.125 14.417c0 1.035.84 1.875 1.875 1.875h10c1.035 0 1.875-.84 1.875-1.875V6.708H2.125zm3.19-2.29a.626.626 0 0 1 0 1.245l-.065.003h-.833a.625.625 0 0 1 0-1.25h.833l.064.003Zm4.165 0a.626.626 0 0 1 0 1.245l-.063.003h-.834a.625.625 0 0 1 0-1.25h.834zm4.168 0a.625.625 0 0 1 0 1.245l-.065.003h-.833a.625.625 0 0 1 0-1.25h.833zM5.314 8.796a.625.625 0 0 1 0 1.243l-.064.004h-.833a.625.625 0 0 1 0-1.25h.833zm4.166 0a.626.626 0 0 1 0 1.243l-.063.004h-.834a.626.626 0 0 1 0-1.25h.834zm4.168 0a.625.625 0 0 1 0 1.243l-.065.004h-.833a.625.625 0 0 1 0-1.25h.833zM4 2.542c-1.036 0-1.875.84-1.875 1.875v1.041h13.75V4.417c0-1.036-.84-1.875-1.875-1.875h-.625v.625l-.003.063a.626.626 0 0 1-1.244 0l-.003-.063v-.625h-6.25v.625l-.003.063a.626.626 0 0 1-1.244 0l-.003-.063v-.625z"/></svg>';
|
|
@@ -53,7 +53,13 @@ export type EventMap = Emit2EventMap<Emits>;
|
|
|
53
53
|
*/
|
|
54
54
|
export declare class Ele extends UiBase<Attrs, Emits> {
|
|
55
55
|
static tagName: "dt-calendar-base";
|
|
56
|
+
protected static _style: string;
|
|
57
|
+
protected static _template: string;
|
|
56
58
|
static get observedAttributes(): string[];
|
|
59
|
+
get _staticEls(): {
|
|
60
|
+
readonly weeks: any[];
|
|
61
|
+
readonly items: any[];
|
|
62
|
+
};
|
|
57
63
|
get showingTime(): number | string | Date;
|
|
58
64
|
get timeStart(): number | string | Date;
|
|
59
65
|
get timeEnd(): number | string | Date;
|
|
@@ -69,11 +75,7 @@ export declare class Ele extends UiBase<Attrs, Emits> {
|
|
|
69
75
|
set weekStartAt(val: Weeks);
|
|
70
76
|
get showOtherMonth(): boolean;
|
|
71
77
|
set showOtherMonth(val: boolean);
|
|
72
|
-
protected _style: string;
|
|
73
|
-
protected _template: string;
|
|
74
|
-
constructor();
|
|
75
78
|
connectedCallback(): void;
|
|
76
|
-
disconnectedCallback(): void;
|
|
77
79
|
protected _onAttrChanged(name: string, oldValue: string | null, newValue: string | null): void;
|
|
78
80
|
private _onWeekStartAtChange;
|
|
79
81
|
private _onTimeChange;
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
var __freeze = Object.freeze;
|
|
1
2
|
var __defProp = Object.defineProperty;
|
|
2
3
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
4
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
|
-
|
|
5
|
+
var __template = (cooked, raw) => __freeze(__defProp(cooked, "raw", { value: __freeze(raw || cooked.slice()) }));
|
|
6
|
+
var _a, _b, _c;
|
|
7
|
+
import { closestByEvent } from "../../utils.mjs";
|
|
5
8
|
import {
|
|
6
9
|
UiBase
|
|
7
10
|
} from "../web-component-base/index.mjs";
|
|
@@ -11,19 +14,15 @@ import { getWeekInOrder, weekKey } from "./weeks.mjs";
|
|
|
11
14
|
export { weekKey, getWeekInOrder } from "./weeks.mjs";
|
|
12
15
|
export class Ele extends UiBase {
|
|
13
16
|
constructor() {
|
|
14
|
-
super();
|
|
15
|
-
__publicField(this, "
|
|
16
|
-
__publicField(this, "_template", html);
|
|
17
|
-
__publicField(this, "_onWeekStartAtChange", debounce(() => {
|
|
18
|
-
if (!this.isConnected) return;
|
|
17
|
+
super(...arguments);
|
|
18
|
+
__publicField(this, "_onWeekStartAtChange", super._genRenderFn(() => {
|
|
19
19
|
const weekOrder = getWeekInOrder(this.weekStartAt);
|
|
20
|
-
this.
|
|
20
|
+
this._els.weeks.forEach((ele, i) => {
|
|
21
21
|
ele.setAttribute("i18n-key", "date.".concat(weekOrder[i]));
|
|
22
22
|
});
|
|
23
23
|
this._onTimeChange();
|
|
24
|
-
}
|
|
25
|
-
__publicField(this, "_onTimeChange",
|
|
26
|
-
if (!this.isConnected) return;
|
|
24
|
+
}));
|
|
25
|
+
__publicField(this, "_onTimeChange", super._genRenderFn(() => {
|
|
27
26
|
const currentTime = this.showingTime;
|
|
28
27
|
let timeStart = this.timeStart;
|
|
29
28
|
let timeEnd = this.timeEnd;
|
|
@@ -52,7 +51,7 @@ export class Ele extends UiBase {
|
|
|
52
51
|
const weekStartOffset = weekKey.indexOf(weekStartAt);
|
|
53
52
|
const adjustedFirstWeek = (firstWeekOfCurMonth - weekStartOffset + 7) % 7;
|
|
54
53
|
let itemIdx = 0;
|
|
55
|
-
const items = this.
|
|
54
|
+
const items = this._els.items;
|
|
56
55
|
const changeItemText = (item, text) => {
|
|
57
56
|
item.querySelector("span").textContent = text;
|
|
58
57
|
};
|
|
@@ -84,8 +83,8 @@ export class Ele extends UiBase {
|
|
|
84
83
|
ele.dataset.time = time.toISOString();
|
|
85
84
|
changeItemText(ele, this.formatter(i));
|
|
86
85
|
}
|
|
87
|
-
const inRangeItem =
|
|
88
|
-
|
|
86
|
+
const inRangeItem = items.filter(
|
|
87
|
+
(e) => e.classList.contains("in-range")
|
|
89
88
|
);
|
|
90
89
|
if (inRangeItem.length) {
|
|
91
90
|
inRangeItem[0].classList.add("range-start");
|
|
@@ -99,7 +98,7 @@ export class Ele extends UiBase {
|
|
|
99
98
|
ele.part.add("next");
|
|
100
99
|
changeItemText(ele, this.showOtherMonth ? this.formatter(i) : " ");
|
|
101
100
|
}
|
|
102
|
-
}
|
|
101
|
+
}));
|
|
103
102
|
__publicField(this, "_onClick", (e) => {
|
|
104
103
|
const item = closestByEvent(e, ".item[data-time]:not(.disabled)", this);
|
|
105
104
|
if (!item) return;
|
|
@@ -112,8 +111,7 @@ export class Ele extends UiBase {
|
|
|
112
111
|
const time = new Date(item.dataset.time);
|
|
113
112
|
super.dispatchEvent("hover-item", time, true);
|
|
114
113
|
});
|
|
115
|
-
__publicField(this, "formatter", (i) => "" + i);
|
|
116
|
-
this._applyTemplate();
|
|
114
|
+
__publicField(this, "formatter", (i) => (i < 10 ? "0" : "") + i);
|
|
117
115
|
}
|
|
118
116
|
static get observedAttributes() {
|
|
119
117
|
return [
|
|
@@ -126,6 +124,13 @@ export class Ele extends UiBase {
|
|
|
126
124
|
"week-start-at"
|
|
127
125
|
];
|
|
128
126
|
}
|
|
127
|
+
get _staticEls() {
|
|
128
|
+
return {
|
|
129
|
+
...super._staticEls,
|
|
130
|
+
weeks: this.$(_a || (_a = __template([".week"]))),
|
|
131
|
+
items: this.$(_b || (_b = __template([".item"])))
|
|
132
|
+
};
|
|
133
|
+
}
|
|
129
134
|
get showingTime() {
|
|
130
135
|
const v = this._getAttr("showing-time", "" + Date.now());
|
|
131
136
|
return new Date(Number.isNaN(+v) ? v : +v);
|
|
@@ -183,19 +188,8 @@ export class Ele extends UiBase {
|
|
|
183
188
|
if (!super.connectedCallback()) return;
|
|
184
189
|
this._onWeekStartAtChange();
|
|
185
190
|
this._onTimeChange();
|
|
186
|
-
this.
|
|
187
|
-
this.
|
|
188
|
-
"pointerover",
|
|
189
|
-
this._onPointerOver
|
|
190
|
-
);
|
|
191
|
-
}
|
|
192
|
-
disconnectedCallback() {
|
|
193
|
-
if (!super.disconnectedCallback()) return;
|
|
194
|
-
this.removeEventListener("click", this._onClick);
|
|
195
|
-
this.shadowRoot.querySelector(".wrapper").removeEventListener(
|
|
196
|
-
"pointerover",
|
|
197
|
-
this._onPointerOver
|
|
198
|
-
);
|
|
191
|
+
this._bindEvt(this)("click", this._onClick);
|
|
192
|
+
this._bindEvt(_c || (_c = __template([".wrapper"])))("pointerover", this._onPointerOver);
|
|
199
193
|
}
|
|
200
194
|
_onAttrChanged(name, oldValue, newValue) {
|
|
201
195
|
super._onAttrChanged(name, oldValue, newValue);
|
|
@@ -214,4 +208,6 @@ export class Ele extends UiBase {
|
|
|
214
208
|
}
|
|
215
209
|
}
|
|
216
210
|
__publicField(Ele, "tagName", "dt-calendar-base");
|
|
211
|
+
__publicField(Ele, "_style", styleStr);
|
|
212
|
+
__publicField(Ele, "_template", html);
|
|
217
213
|
Ele.define();
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
import { type Weeks } from '../calendar';
|
|
2
|
-
import { type
|
|
1
|
+
import { type Ele as CalendarBaseEle, type Weeks } from '../calendar';
|
|
2
|
+
import { type Ele as HhMmSsMsSelectorEle } from '../hhmmss-ms-list-grp/selector';
|
|
3
|
+
import type { Ele as PopoverEle } from '../popover';
|
|
3
4
|
import { type reExportPopoverAttrs } from '../popover/attr-sync-helper';
|
|
4
5
|
import { type BaseAttrs, type BaseEmits, type Emit2EventMap, UiBase } from '../web-component-base';
|
|
5
|
-
|
|
6
|
+
import { Ele as YyyyMmNavEle } from '../yyyymm-nav';
|
|
7
|
+
import { type Ele as YyyyMmDdSelector } from '../yyyymmdd-list-grp/selector';
|
|
8
|
+
export declare const granularityList: readonly ["year", "month", "day", "hour", "minute", "second", "millisecond"];
|
|
6
9
|
export type Granularity = (typeof granularityList)[number];
|
|
7
10
|
export type Attrs = BaseAttrs & reExportPopoverAttrs & {
|
|
8
11
|
/**
|
|
@@ -28,6 +31,11 @@ export type Attrs = BaseAttrs & reExportPopoverAttrs & {
|
|
|
28
31
|
* 例如设置为 'minute',则表示只能选择到分钟,秒和毫秒将被忽略。忽略的时间单位将被重置为 0。
|
|
29
32
|
*/
|
|
30
33
|
'min-granularity'?: Granularity;
|
|
34
|
+
/**
|
|
35
|
+
* 选择器的粒度,表示最大可选的时间单位。默认为 year。
|
|
36
|
+
* 例如设置为 'day',则表示只能选择到日,年和月秒将被忽略。忽略的时间单位将被重置为 0、1972(离1970最近的闰年)。
|
|
37
|
+
*/
|
|
38
|
+
'max-granularity'?: Granularity;
|
|
31
39
|
/**
|
|
32
40
|
* The minimum time of the calendar display range.
|
|
33
41
|
* @type {`string | number`} A value that can be passed to the Date constructor.
|
|
@@ -48,10 +56,13 @@ export type EventMap = Emit2EventMap<Emits>;
|
|
|
48
56
|
* 日期时间选择器(单个时间点)
|
|
49
57
|
* 包括日历和时分秒毫秒选择。
|
|
50
58
|
*
|
|
51
|
-
* 存在一个 timeFormatter 方法,用于格式化时分秒毫秒显示时间。
|
|
59
|
+
* - 存在一个 timeFormatter 方法,用于格式化时分秒毫秒显示时间。
|
|
60
|
+
* - 存在一个 dateFormatter 方法,用于格式化年月日显示时间。
|
|
52
61
|
*/
|
|
53
62
|
export declare class Ele extends UiBase<Attrs, Emits> {
|
|
54
63
|
static readonly tagName: "dt-date-time-selector";
|
|
64
|
+
protected static _style: string;
|
|
65
|
+
protected static _template: string;
|
|
55
66
|
static get observedAttributes(): string[];
|
|
56
67
|
private _getTimeAttr;
|
|
57
68
|
private _setTimeAttr;
|
|
@@ -68,21 +79,36 @@ export declare class Ele extends UiBase<Attrs, Emits> {
|
|
|
68
79
|
set weekStartAt(val: Weeks);
|
|
69
80
|
get minGranularity(): NonNullable<Attrs["min-granularity"]>;
|
|
70
81
|
set minGranularity(val: NonNullable<Attrs['min-granularity']>);
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
82
|
+
get maxGranularity(): NonNullable<Attrs["max-granularity"]>;
|
|
83
|
+
set maxGranularity(val: NonNullable<Attrs['max-granularity']>);
|
|
84
|
+
get _staticEls(): {
|
|
85
|
+
readonly hostWrapper: HTMLElement;
|
|
86
|
+
readonly nav: YyyyMmNavEle;
|
|
87
|
+
readonly calendar: CalendarBaseEle;
|
|
88
|
+
readonly timeSelectors: any[];
|
|
89
|
+
readonly timeSelectorInCalendar: HhMmSsMsSelectorEle;
|
|
90
|
+
readonly timeSelectorOnly: HhMmSsMsSelectorEle;
|
|
91
|
+
readonly dateSelector: YyyyMmDdSelector;
|
|
92
|
+
readonly popover: PopoverEle;
|
|
93
|
+
readonly slots: any[];
|
|
94
|
+
};
|
|
95
|
+
private get _granType();
|
|
96
|
+
private _updateSlot;
|
|
97
|
+
private _updateOpenState;
|
|
98
|
+
get open(): boolean;
|
|
99
|
+
set open(v: boolean);
|
|
100
|
+
private _ob;
|
|
78
101
|
connectedCallback(): void;
|
|
79
|
-
disconnectedCallback(): void;
|
|
102
|
+
disconnectedCallback(): boolean | void;
|
|
80
103
|
protected _onAttrChanged(name: string, oldValue: string | null, newValue: string | null): void;
|
|
81
104
|
private _render;
|
|
82
105
|
private _onCalendarSelect;
|
|
83
106
|
private _onNavChange;
|
|
84
107
|
private _onNavOpenToggle;
|
|
85
108
|
private _onTimeSelectorChange;
|
|
86
|
-
|
|
87
|
-
|
|
109
|
+
private _onSelectorOpenChange;
|
|
110
|
+
get timeFormatter(): HhMmSsMsSelectorEle["timeFormatter"];
|
|
111
|
+
set timeFormatter(fn: HhMmSsMsSelectorEle['timeFormatter']);
|
|
112
|
+
get dateFormatter(): YyyyMmDdSelector["dateFormatter"];
|
|
113
|
+
set dateFormatter(fn: YyyyMmDdSelector['dateFormatter']);
|
|
88
114
|
}
|
|
@@ -11,4 +11,7 @@ import { Ele as CalendarBaseEle } from "../calendar/index.mjs";
|
|
|
11
11
|
CalendarBaseEle.define();
|
|
12
12
|
import { Ele as HhMmSsMsSelector } from "../hhmmss-ms-list-grp/selector.mjs";
|
|
13
13
|
HhMmSsMsSelector.define();
|
|
14
|
-
|
|
14
|
+
import { Ele as YyyyMmDdSelector } from "../yyyymmdd-list-grp/selector.mjs";
|
|
15
|
+
YyyyMmDdSelector.define();
|
|
16
|
+
import { GranType } from "./common.mjs";
|
|
17
|
+
export default html(_a || (_a = __template(['<div class="host-wrapper" data-type="', '">\n<dt-popover part="popover">\n <slot slot="trigger" name="trigger" data-type="', " ", '">\n <button>select date and time</button>\n </slot>\n <div slot="pop" class="wrapper" part="pop">\n <dt-yyyymm-nav\n show-ctrl-btn-month-add\n show-ctrl-btn-month-sub\n ></dt-yyyymm-nav>\n <dt-calendar-base></dt-calendar-base>\n <dt-hhmmss-ms-selector></dt-hhmmss-ms-selector>\n </div>\n</dt-popover>\n<dt-hhmmss-ms-selector class="timeOnly"><slot data-type="', '"></slot></dt-hhmmss-ms-selector>\n<dt-yyyymmdd-selector><slot data-type="', '"></slot></dt-yyyymmdd-selector>\n</div>'])), GranType.CalendarTime, GranType.CalendarTime, GranType.Calendar, GranType.Time, GranType.Date);
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
var __freeze = Object.freeze;
|
|
1
2
|
var __defProp = Object.defineProperty;
|
|
2
3
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
4
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
|
-
|
|
5
|
+
var __template = (cooked, raw) => __freeze(__defProp(cooked, "raw", { value: __freeze(raw || cooked.slice()) }));
|
|
6
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
7
|
+
import { closestByEvent } from "../../utils.mjs";
|
|
5
8
|
import {
|
|
6
9
|
weekKey
|
|
7
10
|
} from "../calendar/index.mjs";
|
|
@@ -10,6 +13,7 @@ import {
|
|
|
10
13
|
} from "../hhmmss-ms-list-grp/selector.mjs";
|
|
11
14
|
import {
|
|
12
15
|
clearupPopEleAttrSync2Parent,
|
|
16
|
+
isPopoverAttrKey,
|
|
13
17
|
parentPopAttrSync2PopEle,
|
|
14
18
|
popEleAttrSync2Parent,
|
|
15
19
|
popoverAttrKeys
|
|
@@ -20,53 +24,78 @@ import {
|
|
|
20
24
|
import {
|
|
21
25
|
Ele as YyyyMmNavEle
|
|
22
26
|
} from "../yyyymm-nav/index.mjs";
|
|
27
|
+
import {
|
|
28
|
+
granularityList as dateGranularityList
|
|
29
|
+
} from "../yyyymmdd-list-grp/selector.mjs";
|
|
30
|
+
import { GranType } from "./common.mjs";
|
|
23
31
|
import html from "./index.html.mjs";
|
|
24
32
|
import { styleStr } from "./styleStr.mjs";
|
|
25
|
-
export const granularityList = [
|
|
33
|
+
export const granularityList = [
|
|
34
|
+
...dateGranularityList,
|
|
35
|
+
...timeGranularityList
|
|
36
|
+
];
|
|
26
37
|
export class Ele extends UiBase {
|
|
27
38
|
constructor() {
|
|
28
|
-
super();
|
|
29
|
-
__publicField(this, "
|
|
30
|
-
__publicField(this, "
|
|
31
|
-
|
|
32
|
-
if (!this.isConnected) return;
|
|
39
|
+
super(...arguments);
|
|
40
|
+
__publicField(this, "_ob", null);
|
|
41
|
+
__publicField(this, "_render", super._genRenderFn(() => {
|
|
42
|
+
this._updateOpenState();
|
|
33
43
|
const currentTime = this.currentTime;
|
|
34
|
-
const {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
_calendar.showingTime = this.showingTime;
|
|
44
|
+
const { _els, _granType } = this;
|
|
45
|
+
_els.hostWrapper.dataset.type = _granType;
|
|
46
|
+
_els.nav.millisecond = +currentTime;
|
|
38
47
|
const { min, max } = this._getMaxMinTime();
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
48
|
+
Object.assign(_els.calendar, {
|
|
49
|
+
weekStartAt: this.weekStartAt,
|
|
50
|
+
timeStart: +currentTime,
|
|
51
|
+
timeEnd: +currentTime,
|
|
52
|
+
showingTime: this.showingTime,
|
|
53
|
+
minTime: min,
|
|
54
|
+
maxTime: max
|
|
55
|
+
});
|
|
56
|
+
this._updateSlot();
|
|
57
|
+
if (_granType === GranType.Time) {
|
|
58
|
+
Object.assign(_els.timeSelectorOnly, {
|
|
59
|
+
maxGranularity: this.maxGranularity,
|
|
60
|
+
minGranularity: this.minGranularity,
|
|
61
|
+
currentTime
|
|
62
|
+
});
|
|
63
|
+
} else if (_granType === GranType.Date) {
|
|
64
|
+
Object.assign(_els.dateSelector, {
|
|
65
|
+
maxGranularity: this.maxGranularity,
|
|
66
|
+
minGranularity: this.minGranularity,
|
|
67
|
+
currentTime
|
|
68
|
+
});
|
|
69
|
+
} else if (_granType === GranType.CalendarTime) {
|
|
70
|
+
Object.assign(_els.timeSelectorInCalendar, {
|
|
71
|
+
minGranularity: this.minGranularity,
|
|
72
|
+
currentTime
|
|
73
|
+
});
|
|
44
74
|
}
|
|
45
|
-
|
|
46
|
-
_timeSelector.minGranularity = this.minGranularity;
|
|
47
|
-
_timeSelector.currentTime = currentTime;
|
|
48
|
-
}, 0));
|
|
75
|
+
}));
|
|
49
76
|
__publicField(this, "_onCalendarSelect", (e) => {
|
|
50
77
|
e.stopPropagation();
|
|
51
|
-
this.currentTime = +e.detail + (this.minGranularity === "day" ? 0 : this.
|
|
78
|
+
this.currentTime = +e.detail + (this.minGranularity === "day" ? 0 : this._els.timeSelectorInCalendar.millisecond);
|
|
52
79
|
});
|
|
53
80
|
__publicField(this, "_onNavChange", (e) => {
|
|
54
81
|
e.stopPropagation();
|
|
55
82
|
const wrapper = closestByEvent(e, ".wrapper");
|
|
56
83
|
if (!wrapper) return;
|
|
57
84
|
const { newTime } = e.detail;
|
|
58
|
-
this.
|
|
85
|
+
this._els.calendar.showingTime = +newTime;
|
|
59
86
|
});
|
|
60
87
|
__publicField(this, "_onNavOpenToggle", (e) => {
|
|
61
|
-
var
|
|
88
|
+
var _a2;
|
|
62
89
|
if (!(e.target instanceof YyyyMmNavEle)) return;
|
|
63
90
|
e.stopPropagation();
|
|
64
|
-
(
|
|
91
|
+
(_a2 = e.target.nextElementSibling) == null ? void 0 : _a2.classList.toggle("hide", e.detail);
|
|
65
92
|
});
|
|
66
93
|
__publicField(this, "_onTimeSelectorChange", (e) => {
|
|
67
94
|
this.currentTime = e.detail;
|
|
68
95
|
});
|
|
69
|
-
this
|
|
96
|
+
__publicField(this, "_onSelectorOpenChange", (e) => {
|
|
97
|
+
this.open = e.detail;
|
|
98
|
+
});
|
|
70
99
|
}
|
|
71
100
|
static get observedAttributes() {
|
|
72
101
|
return [
|
|
@@ -77,6 +106,7 @@ export class Ele extends UiBase {
|
|
|
77
106
|
"min-time",
|
|
78
107
|
"max-time",
|
|
79
108
|
"min-granularity",
|
|
109
|
+
"max-granularity",
|
|
80
110
|
...popoverAttrKeys
|
|
81
111
|
];
|
|
82
112
|
}
|
|
@@ -151,64 +181,140 @@ export class Ele extends UiBase {
|
|
|
151
181
|
if (!granularityList.includes(val)) return;
|
|
152
182
|
this.setAttribute("min-granularity", val);
|
|
153
183
|
}
|
|
154
|
-
get
|
|
155
|
-
|
|
156
|
-
return (_a = this.shadowRoot) == null ? void 0 : _a.querySelector("dt-yyyymm-nav");
|
|
184
|
+
get maxGranularity() {
|
|
185
|
+
return this._getAttr("max-granularity", "year");
|
|
157
186
|
}
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
187
|
+
set maxGranularity(val) {
|
|
188
|
+
if (!granularityList.includes(val)) return;
|
|
189
|
+
this.setAttribute("max-granularity", val);
|
|
190
|
+
}
|
|
191
|
+
get _staticEls() {
|
|
192
|
+
return {
|
|
193
|
+
...super._staticEls,
|
|
194
|
+
hostWrapper: this.$0(_a || (_a = __template([".host-wrapper"]))),
|
|
195
|
+
nav: this.$0(_b || (_b = __template(["dt-yyyymm-nav"]))),
|
|
196
|
+
calendar: this.$0(_c || (_c = __template(["dt-calendar-base"]))),
|
|
197
|
+
timeSelectors: this.$(_d || (_d = __template(["dt-hhmmss-ms-selector"]))),
|
|
198
|
+
timeSelectorInCalendar: this.$0(_e || (_e = __template(["dt-popover dt-hhmmss-ms-selector"]))),
|
|
199
|
+
timeSelectorOnly: this.$0(_f || (_f = __template(["dt-hhmmss-ms-selector.timeOnly"]))),
|
|
200
|
+
dateSelector: this.$0(_g || (_g = __template(["dt-yyyymmdd-selector"]))),
|
|
201
|
+
popover: this.$0(_h || (_h = __template(["dt-popover"]))),
|
|
202
|
+
slots: this.$(_i || (_i = __template(["slot"])))
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
get _granType() {
|
|
206
|
+
let minGranIdx = granularityList.indexOf(this.minGranularity);
|
|
207
|
+
let maxGranIdx = granularityList.indexOf(this.maxGranularity);
|
|
208
|
+
if (minGranIdx === -1) minGranIdx = granularityList.length - 1;
|
|
209
|
+
if (maxGranIdx === -1) maxGranIdx = 0;
|
|
210
|
+
if (minGranIdx < maxGranIdx)
|
|
211
|
+
[minGranIdx, maxGranIdx] = [maxGranIdx, minGranIdx];
|
|
212
|
+
const dayGranIdx = granularityList.indexOf("day");
|
|
213
|
+
if (maxGranIdx === 0 && minGranIdx === dayGranIdx) {
|
|
214
|
+
return GranType.Calendar;
|
|
215
|
+
} else if (dayGranIdx < maxGranIdx && dayGranIdx < minGranIdx) {
|
|
216
|
+
return GranType.Time;
|
|
217
|
+
} else if (maxGranIdx <= dayGranIdx && minGranIdx <= dayGranIdx) {
|
|
218
|
+
return GranType.Date;
|
|
219
|
+
} else {
|
|
220
|
+
return GranType.CalendarTime;
|
|
221
|
+
}
|
|
163
222
|
}
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
223
|
+
_updateSlot() {
|
|
224
|
+
const { _els, _granType } = this;
|
|
225
|
+
const hasSlotTrigger = !!this.querySelector('[slot="trigger"]');
|
|
226
|
+
_els.slots.forEach((slot) => {
|
|
227
|
+
const slotType = slot.dataset.type;
|
|
228
|
+
const enabled = slotType.split(" ").includes(_granType);
|
|
229
|
+
if (enabled) {
|
|
230
|
+
slot.setAttribute("name", "trigger");
|
|
231
|
+
} else {
|
|
232
|
+
slot.removeAttribute("name");
|
|
233
|
+
}
|
|
234
|
+
if (slotType === GranType.Time || slotType === GranType.Date) {
|
|
235
|
+
if (hasSlotTrigger) {
|
|
236
|
+
slot.setAttribute("slot", "trigger");
|
|
237
|
+
} else {
|
|
238
|
+
slot.removeAttribute("slot");
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
_updateOpenState(force = this.hasAttribute("pop-open")) {
|
|
244
|
+
const { _els, _granType } = this;
|
|
245
|
+
_els.popover.toggleAttribute(
|
|
246
|
+
"open",
|
|
247
|
+
force && _granType !== GranType.Time && _granType !== GranType.Date
|
|
168
248
|
);
|
|
249
|
+
_els.dateSelector.toggleAttribute(
|
|
250
|
+
"pop-open",
|
|
251
|
+
force && _granType === GranType.Date
|
|
252
|
+
);
|
|
253
|
+
_els.timeSelectorOnly.toggleAttribute(
|
|
254
|
+
"pop-open",
|
|
255
|
+
force && _granType === GranType.Time
|
|
256
|
+
);
|
|
257
|
+
this.toggleAttribute("pop-open", force);
|
|
169
258
|
}
|
|
170
|
-
get
|
|
171
|
-
return this.
|
|
259
|
+
get open() {
|
|
260
|
+
return this.hasAttribute("pop-open");
|
|
261
|
+
}
|
|
262
|
+
set open(v) {
|
|
263
|
+
this._updateOpenState(v);
|
|
172
264
|
}
|
|
173
265
|
connectedCallback() {
|
|
174
266
|
if (!super.connectedCallback()) return;
|
|
175
|
-
|
|
267
|
+
const { _els } = this;
|
|
176
268
|
this._render();
|
|
177
|
-
popEleAttrSync2Parent(this,
|
|
178
|
-
this.
|
|
179
|
-
this.
|
|
180
|
-
this.
|
|
181
|
-
|
|
182
|
-
this._onNavOpenToggle
|
|
183
|
-
);
|
|
184
|
-
this._timeSelector.addEventListener(
|
|
269
|
+
popEleAttrSync2Parent(this, _els.popover);
|
|
270
|
+
this._bindEvt(_els.calendar)("select-time", this._onCalendarSelect);
|
|
271
|
+
this._bindEvt(_els.nav)("change", this._onNavChange);
|
|
272
|
+
this._bindEvt(_els.nav)("popover-open-change", this._onNavOpenToggle);
|
|
273
|
+
this._bindEvt(_els.timeSelectors)(
|
|
185
274
|
"select-time",
|
|
186
275
|
this._onTimeSelectorChange
|
|
187
276
|
);
|
|
188
|
-
this.
|
|
277
|
+
this._bindEvt(_els.timeSelectorInCalendar)(
|
|
278
|
+
"open-change",
|
|
279
|
+
this._stopEvent
|
|
280
|
+
);
|
|
281
|
+
this._bindEvt(_els.dateSelector)(
|
|
282
|
+
"open-change",
|
|
283
|
+
this._onSelectorOpenChange
|
|
284
|
+
);
|
|
285
|
+
this._bindEvt(_els.dateSelector)("select-time", this._onCalendarSelect);
|
|
286
|
+
this._bindEvt(_els.timeSelectorOnly)(
|
|
287
|
+
"open-change",
|
|
288
|
+
this._onSelectorOpenChange
|
|
289
|
+
);
|
|
290
|
+
this._ob = new MutationObserver(() => this._updateSlot());
|
|
291
|
+
this._ob.observe(this, { childList: true });
|
|
189
292
|
this.dispatchEvent("select-time", this.currentTime);
|
|
190
293
|
}
|
|
191
294
|
disconnectedCallback() {
|
|
192
|
-
|
|
295
|
+
var _a2;
|
|
193
296
|
clearupPopEleAttrSync2Parent(this);
|
|
194
|
-
this.
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
);
|
|
198
|
-
this._navEle.removeEventListener("change", this._onNavChange);
|
|
199
|
-
this._navEle.removeEventListener(
|
|
200
|
-
"popover-open-change",
|
|
201
|
-
this._onNavOpenToggle
|
|
202
|
-
);
|
|
203
|
-
this._timeSelector.removeEventListener(
|
|
204
|
-
"select-time",
|
|
205
|
-
this._onTimeSelectorChange
|
|
206
|
-
);
|
|
207
|
-
this._timeSelector.removeEventListener("open-change", this._stopEvent);
|
|
297
|
+
(_a2 = this._ob) == null ? void 0 : _a2.disconnect();
|
|
298
|
+
this._ob = null;
|
|
299
|
+
return super.disconnectedCallback();
|
|
208
300
|
}
|
|
209
301
|
_onAttrChanged(name, oldValue, newValue) {
|
|
210
302
|
super._onAttrChanged(name, oldValue, newValue);
|
|
211
|
-
|
|
303
|
+
const { _els } = this;
|
|
304
|
+
if (isPopoverAttrKey(name)) {
|
|
305
|
+
if (oldValue === newValue) return;
|
|
306
|
+
if (name === "pop-open") {
|
|
307
|
+
this._updateOpenState();
|
|
308
|
+
return;
|
|
309
|
+
}
|
|
310
|
+
parentPopAttrSync2PopEle(name, oldValue, newValue, _els.popover);
|
|
311
|
+
if (newValue === null) {
|
|
312
|
+
_els.timeSelectorOnly.removeAttribute(name);
|
|
313
|
+
_els.dateSelector.removeAttribute(name);
|
|
314
|
+
return;
|
|
315
|
+
}
|
|
316
|
+
_els.timeSelectorOnly.setAttribute(name, newValue);
|
|
317
|
+
_els.dateSelector.setAttribute(name, newValue);
|
|
212
318
|
return;
|
|
213
319
|
}
|
|
214
320
|
this._render();
|
|
@@ -217,12 +323,21 @@ export class Ele extends UiBase {
|
|
|
217
323
|
}
|
|
218
324
|
}
|
|
219
325
|
get timeFormatter() {
|
|
220
|
-
return this.
|
|
326
|
+
return this._els.timeSelectorInCalendar.timeFormatter;
|
|
221
327
|
}
|
|
222
328
|
set timeFormatter(fn) {
|
|
223
329
|
if (typeof fn !== "function") return;
|
|
224
|
-
this.
|
|
330
|
+
this._els.timeSelectorInCalendar.timeFormatter = this._els.timeSelectorOnly.timeFormatter = fn;
|
|
331
|
+
}
|
|
332
|
+
get dateFormatter() {
|
|
333
|
+
return this._els.dateSelector.dateFormatter;
|
|
334
|
+
}
|
|
335
|
+
set dateFormatter(fn) {
|
|
336
|
+
if (typeof fn !== "function") return;
|
|
337
|
+
this._els.dateSelector.dateFormatter = fn;
|
|
225
338
|
}
|
|
226
339
|
}
|
|
227
340
|
__publicField(Ele, "tagName", "dt-date-time-selector");
|
|
341
|
+
__publicField(Ele, "_style", styleStr);
|
|
342
|
+
__publicField(Ele, "_template", html);
|
|
228
343
|
Ele.define();
|
|
@@ -3,4 +3,5 @@ var __defProp = Object.defineProperty;
|
|
|
3
3
|
var __template = (cooked, raw) => __freeze(__defProp(cooked, "raw", { value: __freeze(raw || cooked.slice()) }));
|
|
4
4
|
var _a;
|
|
5
5
|
import { css } from "../../utils.mjs";
|
|
6
|
-
|
|
6
|
+
import { GranType } from "./common.mjs";
|
|
7
|
+
export const styleStr = css(_a || (_a = __template(["\n:host { font-size: 14px; }\n\n.host-wrapper { display: contents; }\n\n.host-wrapper:not([data-type*='", "']) dt-popover,\n.host-wrapper:not([data-type*='", "']) dt-hhmmss-ms-selector,\n.host-wrapper[data-type*='", "'] > dt-hhmmss-ms-selector,\n.host-wrapper:not([data-type*='", "']) dt-yyyymmdd-selector {\n display: none;\n}\n\ndt-popover { width: 100%; }\n.wrapper {\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 15px;\n width: 285px;\n}\n.wrapper > * { width: 100%; }\n\ndt-calendar-base {\n // 254 = item height 6 * 30 + week 14 + gap 10 * 6\n height: 254px;\n}\ndt-calendar-base::part(week) {\n font-size: 12px;\n line-height: 14px;\n}\ndt-calendar-base::part(item) {\n font-size: 14px;\n}\ndt-calendar-base.hide {\n display: none;\n}\n\ndt-yyyymm-nav::part(list-grp) {\n height: 254px;\n margin-top: 15px;\n}\n\n.timeOnly::part(pop),\ndt-yyyymmdd-selector::part(pop) {\n width: 285px;\n}\n\n@media (max-width: 750px) {\n .wrapper,\n .timeOnly::part(pop),\n dt-yyyymmdd-selector::part(pop) {\n width: 100%;\n }\n}\n"])), GranType.Calendar, GranType.Time, GranType.Calendar, GranType.Date);
|