@gez/date-time-kit 1.1.4 → 2.0.0-alpha.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.
Files changed (83) hide show
  1. package/dist/assets/arrow-down.svg +1 -0
  2. package/dist/assets/arrow-left-double.svg +1 -0
  3. package/dist/assets/arrow-left.svg +1 -0
  4. package/dist/assets/arrow-right-double.svg +1 -0
  5. package/dist/assets/arrow-right.svg +1 -0
  6. package/dist/assets/back-arrow.svg +1 -0
  7. package/dist/assets/time.svg +1 -0
  8. package/dist/components/calendar/index.css +108 -0
  9. package/dist/components/calendar/index.d.ts +84 -0
  10. package/dist/components/calendar/index.mjs +238 -0
  11. package/dist/components/date-time-selector/index.d.ts +53 -0
  12. package/dist/components/date-time-selector/index.mjs +180 -0
  13. package/dist/components/date-time-selector/styleStr.d.ts +1 -0
  14. package/dist/components/date-time-selector/styleStr.mjs +6 -0
  15. package/dist/components/hhmmss-ms-list-grp/index.css +60 -0
  16. package/dist/components/hhmmss-ms-list-grp/index.d.ts +54 -0
  17. package/dist/components/hhmmss-ms-list-grp/index.mjs +226 -0
  18. package/dist/components/i18n/index.d.ts +13 -0
  19. package/dist/components/i18n/index.mjs +42 -0
  20. package/dist/components/num-list/index.css +35 -0
  21. package/dist/components/num-list/index.d.ts +68 -0
  22. package/dist/components/num-list/index.mjs +259 -0
  23. package/dist/components/period-selector/index.css +153 -0
  24. package/dist/components/period-selector/index.d.ts +77 -0
  25. package/dist/components/period-selector/index.mjs +331 -0
  26. package/dist/components/popover/index.d.ts +34 -0
  27. package/dist/components/popover/index.mjs +104 -0
  28. package/dist/components/quick-selector/index.css +167 -0
  29. package/dist/components/quick-selector/index.d.ts +86 -0
  30. package/dist/components/quick-selector/index.mjs +379 -0
  31. package/dist/components/web-component-base/index.css +9 -0
  32. package/dist/components/web-component-base/index.d.ts +46 -0
  33. package/dist/components/web-component-base/index.mjs +118 -0
  34. package/dist/components/web-component-base/scrollbar.css +25 -0
  35. package/dist/components/yyyymm-nav/index.css +92 -0
  36. package/dist/components/yyyymm-nav/index.d.ts +62 -0
  37. package/dist/components/yyyymm-nav/index.mjs +160 -0
  38. package/dist/components/yyyymmdd-list-grp/index.css +32 -0
  39. package/dist/components/yyyymmdd-list-grp/index.d.ts +52 -0
  40. package/dist/components/yyyymmdd-list-grp/index.mjs +181 -0
  41. package/dist/i18n.d.ts +36 -0
  42. package/dist/i18n.mjs +368 -0
  43. package/dist/index.d.ts +8 -0
  44. package/dist/index.mjs +17 -0
  45. package/dist/utils.d.ts +12 -0
  46. package/dist/utils.mjs +21 -0
  47. package/package.json +37 -63
  48. package/src/assets/arrow-down.svg +1 -0
  49. package/src/assets/arrow-left-double.svg +1 -0
  50. package/src/assets/arrow-left.svg +1 -0
  51. package/src/assets/arrow-right-double.svg +1 -0
  52. package/src/assets/arrow-right.svg +1 -0
  53. package/src/assets/back-arrow.svg +1 -0
  54. package/src/assets/time.svg +1 -0
  55. package/src/components/calendar/index.scss +128 -0
  56. package/src/components/calendar/index.ts +453 -0
  57. package/src/components/date-time-selector/index.ts +239 -0
  58. package/src/components/date-time-selector/styleStr.ts +86 -0
  59. package/src/components/hhmmss-ms-list-grp/index.scss +61 -0
  60. package/src/components/hhmmss-ms-list-grp/index.ts +387 -0
  61. package/src/components/i18n/index.ts +48 -0
  62. package/src/components/num-list/index.scss +38 -0
  63. package/src/components/num-list/index.ts +357 -0
  64. package/src/components/period-selector/index.scss +161 -0
  65. package/src/components/period-selector/index.ts +581 -0
  66. package/src/components/popover/index.ts +127 -0
  67. package/src/components/quick-selector/index.scss +183 -0
  68. package/src/components/quick-selector/index.ts +656 -0
  69. package/src/components/web-component-base/index.scss +11 -0
  70. package/src/components/web-component-base/index.ts +235 -0
  71. package/src/components/web-component-base/scrollbar.scss +30 -0
  72. package/src/components/yyyymm-nav/index.scss +108 -0
  73. package/src/components/yyyymm-nav/index.ts +319 -0
  74. package/src/components/yyyymmdd-list-grp/index.scss +33 -0
  75. package/src/components/yyyymmdd-list-grp/index.ts +290 -0
  76. package/src/i18n.ts +415 -0
  77. package/src/index.ts +13 -0
  78. package/src/utils.ts +36 -0
  79. package/README.md +0 -152
  80. package/dist/index.css +0 -1
  81. package/dist/index.html +0 -85
  82. package/dist/index.js +0 -145
  83. package/type.d.ts +0 -164
@@ -0,0 +1,68 @@
1
+ import { type BaseAttrs, type Emit2EventMap, UiBase } from '../web-component-base';
2
+ export interface Attrs extends BaseAttrs {
3
+ /**
4
+ * The current number in the list. The component will scroll to this number when rendered.
5
+ * @type {number}
6
+ */
7
+ 'current-num': number;
8
+ /**
9
+ * The minimum number in the list (include). If not set, there is no minimum limit.
10
+ * @type {number}
11
+ * @default -Infinity
12
+ */
13
+ 'min-num'?: number;
14
+ /**
15
+ * The maximum number in the list (include). If not set, there is no maximum limit.
16
+ * @type {number}
17
+ * @default Infinity
18
+ */
19
+ 'max-num'?: number;
20
+ /**
21
+ * The position to scroll the current number into view.
22
+ * @type {`"center" | "end" | "nearest" | "start"`}
23
+ * @default "start"
24
+ */
25
+ position?: ScrollLogicalPosition;
26
+ }
27
+ export interface Emits {
28
+ 'select-num': {
29
+ oldNum: number;
30
+ newNum: number;
31
+ };
32
+ }
33
+ export type EventMap = Emit2EventMap<Emits>;
34
+ /**
35
+ * 基础的数字列表组件。允许无限滚动。点击后可以滚动定位到当前数字。
36
+ *
37
+ * 存在一个 formatter 方法,可以重写该方法以自定义数字的显示格式。
38
+ */
39
+ export declare class Ele extends UiBase<Attrs, Emits> {
40
+ static tagName: "dt-num-list";
41
+ static get observedAttributes(): string[];
42
+ protected _style: string;
43
+ protected _template: string;
44
+ constructor();
45
+ private get _containerEle();
46
+ private get _currentItemEle();
47
+ get currentNum(): number;
48
+ set currentNum(val: number);
49
+ get minNum(): number;
50
+ set minNum(val: number);
51
+ get maxNum(): number;
52
+ set maxNum(val: number);
53
+ private _createItem;
54
+ private _intersectionOb;
55
+ private _destroyOb;
56
+ private _initOb;
57
+ private _loadBefore;
58
+ private _loadAfter;
59
+ connectedCallback(): void;
60
+ disconnectedCallback(): void;
61
+ protected _onAttrChanged(name: string, oldValue: string, newValue: string): void;
62
+ private get _itemHeight();
63
+ private get _pageSize();
64
+ scrollToCurrent: () => void;
65
+ private _render;
66
+ private _onClick;
67
+ formatter: (num: number) => string;
68
+ }
@@ -0,0 +1,259 @@
1
+ var __freeze = Object.freeze;
2
+ var __defProp = Object.defineProperty;
3
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
+ var __template = (cooked, raw) => __freeze(__defProp(cooked, "raw", { value: __freeze(raw || cooked.slice()) }));
6
+ var _a, _b;
7
+ import { closestByEvent, css, debounce, html } from "../../utils.mjs";
8
+ import {
9
+ UiBase
10
+ } from "../web-component-base/index.mjs";
11
+ const styleStr = css(_a || (_a = __template(["\n:host {\n --color-current-bg: var(--calendar-item-in-range-bg, #002BE726);\n --color-current-text: var(--calendar-item-in-range-text, #002BE7);\n --color-hover-bg: var(--calendar-item-hover-bg, #0000000D);\n --color-hover-text: var(--calendar-item-hover-text, #000);\n display: block;\n overflow: hidden auto;\n position: relative !important;\n overflow-anchor: none;\n}\n\n.container {\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 5px;\n}\n\n.item {\n cursor: pointer;\n user-select: none;\n width: 100%;\n text-align: center;\n border-radius: 2px;\n padding: 5px 2px;\n box-sizing: border-box;\n}\n.item.item-current {\n color: var(--color-current-text);\n background-color: var(--color-current-bg);\n}\n.item:hover {\n color: var(--color-hover-text);\n background-color: var(--color-hover-bg);\n}\n"])));
12
+ export class Ele extends UiBase {
13
+ constructor() {
14
+ super();
15
+ __publicField(this, "_style", styleStr);
16
+ __publicField(this, "_template", html(_b || (_b = __template(['<div class="container" part="container"></div>']))));
17
+ __publicField(this, "_createItem", (num, currentNum = this.currentNum) => {
18
+ const ele = document.createElement("div");
19
+ ele.setAttribute("part", ele.className = "item");
20
+ ele.classList.toggle("item-current", num === currentNum);
21
+ ele.part.toggle("item-current", num === currentNum);
22
+ ele.dataset.number = num + "";
23
+ ele.textContent = this.formatter(num);
24
+ return ele;
25
+ });
26
+ __publicField(this, "_intersectionOb", null);
27
+ __publicField(this, "_loadBefore", debounce(() => {
28
+ var _a2, _b2, _c, _d;
29
+ const container = this._containerEle;
30
+ const firstItem = container.firstElementChild;
31
+ const lastItem = container.lastElementChild;
32
+ const firstNum = Number(firstItem.dataset.number);
33
+ const curNum = this.currentNum;
34
+ const pageSize = this._pageSize;
35
+ const itemHeight = this._itemHeight;
36
+ const items = [...Array(pageSize * 2)].map(
37
+ (_, i) => this._createItem(firstNum - pageSize * 2 + i, curNum)
38
+ );
39
+ (_a2 = this._intersectionOb) == null ? void 0 : _a2.unobserve(firstItem);
40
+ (_b2 = this._intersectionOb) == null ? void 0 : _b2.unobserve(lastItem);
41
+ const scrollTop = this.scrollTop;
42
+ container.prepend(...items);
43
+ for (let i = 0; i < items.length; ++i) {
44
+ container.removeChild(container.lastElementChild);
45
+ }
46
+ const addedHeight = items.length * itemHeight;
47
+ this.scrollTo({
48
+ top: scrollTop + addedHeight,
49
+ behavior: "instant"
50
+ });
51
+ (_c = this._intersectionOb) == null ? void 0 : _c.observe(items[0]);
52
+ (_d = this._intersectionOb) == null ? void 0 : _d.observe(container.lastElementChild);
53
+ }, 0));
54
+ __publicField(this, "_loadAfter", debounce(() => {
55
+ var _a2, _b2, _c, _d;
56
+ const container = this._containerEle;
57
+ const firstItem = container.firstElementChild;
58
+ const lastItem = container.lastElementChild;
59
+ const curNum = this.currentNum;
60
+ const pageSize = this._pageSize;
61
+ const itemHeight = this._itemHeight;
62
+ const lastNum = Number(lastItem.textContent);
63
+ const items = [...Array(pageSize * 2)].map(
64
+ (_, i) => this._createItem(lastNum + i + 1, curNum)
65
+ );
66
+ (_a2 = this._intersectionOb) == null ? void 0 : _a2.unobserve(firstItem);
67
+ (_b2 = this._intersectionOb) == null ? void 0 : _b2.unobserve(lastItem);
68
+ const scrollTop = this.scrollTop;
69
+ container.append(...items);
70
+ for (let i = 0; i < items.length; ++i) {
71
+ container.removeChild(container.firstElementChild);
72
+ }
73
+ const addedHeight = items.length * itemHeight;
74
+ this.scrollTo({
75
+ top: scrollTop - addedHeight,
76
+ behavior: "instant"
77
+ });
78
+ (_c = this._intersectionOb) == null ? void 0 : _c.observe(container.firstElementChild);
79
+ (_d = this._intersectionOb) == null ? void 0 : _d.observe(items[items.length - 1]);
80
+ }, 0));
81
+ __publicField(this, "scrollToCurrent", () => {
82
+ var _a2;
83
+ const ele = this._currentItemEle;
84
+ if (!ele) return;
85
+ (_a2 = this._intersectionOb) == null ? void 0 : _a2.observe(ele);
86
+ const containerRect = this._containerEle.getBoundingClientRect();
87
+ const eleRect = ele.getBoundingClientRect();
88
+ const offsetTop = eleRect.top - containerRect.top + this.scrollTop;
89
+ this.scrollTo({
90
+ top: offsetTop
91
+ });
92
+ });
93
+ __publicField(this, "_render", debounce(() => {
94
+ if (!this.isConnected) return;
95
+ this._destroyOb();
96
+ const container = this._containerEle;
97
+ container.innerHTML = "";
98
+ if (!this.hasAttribute("current-num")) return;
99
+ const currentNum = this.currentNum;
100
+ const minNum = this.minNum;
101
+ const maxNum = this.maxNum;
102
+ if (minNum === Number.NEGATIVE_INFINITY && maxNum === Number.POSITIVE_INFINITY) {
103
+ this._initOb();
104
+ const pageSize = this._pageSize;
105
+ for (let i = -pageSize * 2; i <= pageSize * 2; ++i) {
106
+ container.appendChild(
107
+ this._createItem(currentNum + i, currentNum)
108
+ );
109
+ }
110
+ } else
111
+ for (let i = minNum; i <= maxNum; ++i) {
112
+ container.appendChild(this._createItem(i, currentNum));
113
+ }
114
+ setTimeout(this.scrollToCurrent, 0);
115
+ }, 0));
116
+ __publicField(this, "_onClick", (e) => {
117
+ var _a2;
118
+ if (!this.isConnected) return;
119
+ const container = this._containerEle;
120
+ const oldCurrent = container.querySelector(".item-current");
121
+ const item = closestByEvent(e, ".item", this);
122
+ if (!item || item === oldCurrent) return;
123
+ oldCurrent == null ? void 0 : oldCurrent.classList.remove("item-current");
124
+ oldCurrent == null ? void 0 : oldCurrent.part.remove("item-current");
125
+ item.classList.add("item-current");
126
+ item.part.add("item-current");
127
+ this.scrollToCurrent();
128
+ super.dispatchEvent(
129
+ "select-num",
130
+ {
131
+ oldNum: +((_a2 = oldCurrent == null ? void 0 : oldCurrent.dataset.number) != null ? _a2 : this.currentNum),
132
+ newNum: +item.dataset.number
133
+ },
134
+ true
135
+ );
136
+ });
137
+ __publicField(this, "formatter", (num) => "" + num);
138
+ this._applyTemplate();
139
+ }
140
+ static get observedAttributes() {
141
+ return [
142
+ ...super.observedAttributes,
143
+ "current-num",
144
+ "min-num",
145
+ "max-num"
146
+ ];
147
+ }
148
+ get _containerEle() {
149
+ var _a2;
150
+ return (_a2 = this.shadowRoot) == null ? void 0 : _a2.querySelector(".container");
151
+ }
152
+ get _currentItemEle() {
153
+ return this._containerEle.querySelector(".item-current");
154
+ }
155
+ get currentNum() {
156
+ return Number(this._getAttr("current-num"));
157
+ }
158
+ set currentNum(val) {
159
+ this.setAttribute("current-num", String(val));
160
+ }
161
+ get minNum() {
162
+ return Number(this._getAttr("min-num", "-Infinity"));
163
+ }
164
+ set minNum(val) {
165
+ let min = +val;
166
+ if (Number.isNaN(min)) min = Number.NEGATIVE_INFINITY;
167
+ if (min > this.maxNum) [this.maxNum, min] = [min, this.maxNum];
168
+ this.setAttribute("min-num", String(val));
169
+ }
170
+ get maxNum() {
171
+ return Number(this._getAttr("max-num", "Infinity"));
172
+ }
173
+ set maxNum(val) {
174
+ let max = +val;
175
+ if (Number.isNaN(max)) max = Number.POSITIVE_INFINITY;
176
+ if (max < this.minNum) [this.minNum, max] = [max, this.minNum];
177
+ this.setAttribute("max-num", String(val));
178
+ }
179
+ _destroyOb() {
180
+ var _a2;
181
+ (_a2 = this._intersectionOb) == null ? void 0 : _a2.disconnect();
182
+ this._intersectionOb = null;
183
+ }
184
+ _initOb() {
185
+ this._destroyOb();
186
+ if (!this.shadowRoot) return;
187
+ this._intersectionOb = new IntersectionObserver(
188
+ (entries, observer) => {
189
+ const container = this._containerEle;
190
+ const firstItem = container.firstElementChild;
191
+ const lastItem = container.lastElementChild;
192
+ for (const { target, isIntersecting } of entries) {
193
+ if (!isIntersecting) continue;
194
+ observer.unobserve(target);
195
+ if (target === this._currentItemEle) {
196
+ observer.observe(firstItem);
197
+ observer.observe(lastItem);
198
+ }
199
+ if (target === firstItem) {
200
+ this._loadBefore();
201
+ } else if (target === lastItem) {
202
+ this._loadAfter();
203
+ }
204
+ }
205
+ },
206
+ { root: this }
207
+ );
208
+ }
209
+ connectedCallback() {
210
+ if (!super.connectedCallback()) return;
211
+ this._render();
212
+ this.addEventListener("click", this._onClick);
213
+ }
214
+ disconnectedCallback() {
215
+ if (!super.disconnectedCallback()) return;
216
+ this.removeEventListener("click", this._onClick);
217
+ this._destroyOb();
218
+ }
219
+ _onAttrChanged(name, oldValue, newValue) {
220
+ var _a2;
221
+ super._onAttrChanged(name, oldValue, newValue);
222
+ if (name === "current-num" && newValue === ((_a2 = this._containerEle.querySelector(".item-current")) == null ? void 0 : _a2.dataset.number)) {
223
+ return;
224
+ }
225
+ this._render();
226
+ }
227
+ get _itemHeight() {
228
+ const container = this._containerEle;
229
+ const items = Array.from(
230
+ container.querySelectorAll(".item")
231
+ );
232
+ const len = items.length;
233
+ if (len === 1) {
234
+ container.append(this._createItem(0, 1));
235
+ } else if (len === 0) {
236
+ container.append(this._createItem(0, 1), this._createItem(0, 1));
237
+ }
238
+ const h = container.firstElementChild.offsetHeight;
239
+ const itemNum = Math.max(2, len);
240
+ const gap = Math.max(
241
+ 0,
242
+ (container.clientHeight - h * itemNum) / (itemNum - 1)
243
+ );
244
+ if (len === 0) {
245
+ container.removeChild(container.lastElementChild);
246
+ container.removeChild(container.lastElementChild);
247
+ } else if (len === 1) {
248
+ container.removeChild(container.lastElementChild);
249
+ }
250
+ return h + gap;
251
+ }
252
+ get _pageSize() {
253
+ const thisHeight = this.clientHeight;
254
+ if (thisHeight === 0) return 10;
255
+ return Math.min(10, Math.ceil(thisHeight / this._itemHeight));
256
+ }
257
+ }
258
+ __publicField(Ele, "tagName", "dt-num-list");
259
+ Ele.define();
@@ -0,0 +1,153 @@
1
+ :host {
2
+ display: flex;
3
+ flex-direction: column;
4
+ gap: 15px;
5
+ }
6
+
7
+ .date-echo {
8
+ display: flex;
9
+ gap: 5px;
10
+ align-items: center;
11
+ }
12
+
13
+ .start-date-echo-wrapper,
14
+ .end-date-echo-wrapper {
15
+ width: 100%;
16
+ flex: 1;
17
+ display: flex;
18
+ flex-direction: column;
19
+ gap: 2px;
20
+ border-radius: 6px;
21
+ border: 1px solid rgba(0, 0, 0, 0.1490196078);
22
+ padding: 4px;
23
+ }
24
+ .start-date-echo-wrapper.active,
25
+ .end-date-echo-wrapper.active {
26
+ border-color: #333;
27
+ }
28
+
29
+ .date-echo .label {
30
+ font-size: 14px;
31
+ line-height: 1;
32
+ }
33
+
34
+ .start-date-echo, .end-date-echo {
35
+ font-size: 16px;
36
+ line-height: 1;
37
+ font-weight: bold;
38
+ }
39
+
40
+ .dividing-line {
41
+ display: block;
42
+ height: 1px;
43
+ width: 20px;
44
+ background-color: #eee;
45
+ }
46
+
47
+ dt-yyyymm-nav::part(list-grp) {
48
+ height: 254px;
49
+ margin-top: 15px;
50
+ }
51
+
52
+ dt-calendar-base.hide {
53
+ display: none;
54
+ }
55
+
56
+ .calendars {
57
+ display: flex;
58
+ gap: 20px;
59
+ }
60
+
61
+ .wrapper {
62
+ flex: 1;
63
+ height: 100%;
64
+ display: flex;
65
+ flex-direction: column;
66
+ gap: 15px;
67
+ }
68
+
69
+ dt-popover {
70
+ position: relative;
71
+ }
72
+
73
+ [open] .time-echo-wrapper {
74
+ border-color: #18181B;
75
+ }
76
+
77
+ .time-echo-wrapper {
78
+ width: 100%;
79
+ padding: 4px;
80
+ display: flex;
81
+ gap: 5px;
82
+ border-radius: 4px;
83
+ min-height: 30px;
84
+ border: 1px solid rgba(0, 0, 0, 0.0666666667);
85
+ box-sizing: border-box;
86
+ align-items: center;
87
+ cursor: pointer;
88
+ }
89
+
90
+ .time-selector {
91
+ position: absolute;
92
+ width: 100%;
93
+ height: 461px;
94
+ box-sizing: border-box;
95
+ background-color: #fff;
96
+ display: flex;
97
+ flex-direction: column;
98
+ gap: 15px;
99
+ padding: 15px;
100
+ border-radius: 6px;
101
+ border: 1px solid #eee;
102
+ box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
103
+ }
104
+ .time-selector .title {
105
+ font-size: 16px;
106
+ margin: 0;
107
+ line-height: 1;
108
+ }
109
+
110
+ dt-hhmmss-ms-list-grp::part(list-container) {
111
+ gap: 2px;
112
+ }
113
+ dt-hhmmss-ms-list-grp::part(list) {
114
+ scroll-behavior: smooth;
115
+ }
116
+ dt-hhmmss-ms-list-grp::part(item) {
117
+ font-size: 14px;
118
+ line-height: 17px;
119
+ }
120
+
121
+ #time-selector-done-btn {
122
+ border: none;
123
+ min-height: 30px;
124
+ border-radius: 6px;
125
+ padding: 5px 10px;
126
+ font-size: 14px;
127
+ background-color: #18181B;
128
+ color: #fff;
129
+ }
130
+
131
+ .time-icon {
132
+ display: inline-block;
133
+ width: 20px;
134
+ height: 20px;
135
+ background: url("@/assets/time.svg") 50%/20px 20px no-repeat;
136
+ }
137
+
138
+ .time-echo {
139
+ font-size: 14px;
140
+ color: #999;
141
+ line-height: 1;
142
+ }
143
+
144
+ dt-calendar-base {
145
+ height: 254px;
146
+ }
147
+ dt-calendar-base::part(week) {
148
+ font-size: 12px;
149
+ line-height: 14px;
150
+ }
151
+ dt-calendar-base::part(item) {
152
+ font-size: 14px;
153
+ }
@@ -0,0 +1,77 @@
1
+ import { type BaseAttrs, UiBase } from '../web-component-base';
2
+ import { type Weeks } from '../calendar';
3
+ export interface Attrs extends BaseAttrs {
4
+ /**
5
+ * The start time of the calendar display range.
6
+ * @type {`string | number`} A value that can be passed to the Date constructor.
7
+ * @default Date.now()
8
+ */
9
+ 'time-start'?: string | number;
10
+ /**
11
+ * The end time of the calendar display range.
12
+ * @type {`string | number`} A value that can be passed to the Date constructor.
13
+ * @default 'time-start'
14
+ */
15
+ 'time-end': string | number;
16
+ /**
17
+ * 选择器的粒度,表示最小可选的时间单位。默认为 millisecond。
18
+ * 例如设置为 'minute',则表示只能选择到分钟,秒和毫秒将被忽略。
19
+ */
20
+ 'min-granularity'?: 'day' | 'hour' | 'minute' | 'second' | 'millisecond';
21
+ /**
22
+ * Set which day of the week is the first day.
23
+ * @type `'sun' | 'mon' | 'tue' | 'wed' | 'thu' | 'fri' | 'sat'`
24
+ * @default 'sun'
25
+ */
26
+ 'week-start-at'?: Weeks;
27
+ }
28
+ export interface Emits {
29
+ change: {
30
+ oldStartTime: Date;
31
+ oldEndTime: Date;
32
+ newStartTime: Date;
33
+ newEndTime: Date;
34
+ };
35
+ }
36
+ /**
37
+ * 时间段选择器(两个日历)
38
+ *
39
+ * 存在一个 timeFormatter 方法,可以重写该方法以自定义时分秒毫秒的回显格式。
40
+ */
41
+ export declare class Ele extends UiBase<Attrs, Emits> {
42
+ static readonly tagName: "dt-period-selector";
43
+ static get observedAttributes(): string[];
44
+ get timeStart(): number | string | Date;
45
+ set timeStart(val: number | string | Date);
46
+ get timeEnd(): number | string | Date;
47
+ set timeEnd(val: number | string | Date);
48
+ get weekStartAt(): Weeks;
49
+ set weekStartAt(val: Weeks);
50
+ protected _style: string;
51
+ protected _template: string;
52
+ constructor();
53
+ private get _startNavEle();
54
+ private get _endNavEle();
55
+ private get _startCalendar();
56
+ private get _endCalendar();
57
+ private get _startTimeSelector();
58
+ private get _endTimeSelector();
59
+ private get _startTimePopover();
60
+ private get _endTimePopover();
61
+ private _selectedDate;
62
+ connectedCallback(): void;
63
+ disconnectedCallback(): void;
64
+ protected _onAttrChanged(name: string, oldValue: string, newValue: string): void;
65
+ private _updateNavCtrlBtn;
66
+ private _render;
67
+ private _updateDateEcho;
68
+ private _onCalendarSelect;
69
+ private _onCalendarItemHover;
70
+ private _onNavChange;
71
+ private _onNavOpenToggle;
72
+ private _onTimePopoverOpenChange;
73
+ private _onTimeSelectorDoneClick;
74
+ showCalendarDatePoint(): void;
75
+ timeFormatter: (time: Date) => string;
76
+ dateFormatter: (time: Date) => string;
77
+ }