@fibrae/semi-foundation 0.1.1 → 0.3.0
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/anchor/foundation.d.ts +1 -4
- package/dist/anchor/foundation.js +21 -22
- package/dist/audio-player/foundation.d.ts +10 -13
- package/dist/audio-player/foundation.js +19 -20
- package/dist/auto-complete/foundation.d.ts +12 -14
- package/dist/auto-complete/foundation.js +51 -52
- package/dist/avatar/foundation.d.ts +5 -6
- package/dist/avatar/foundation.js +16 -16
- package/dist/avatar/variables.scss +0 -1
- package/dist/backtop/foundation.d.ts +2 -5
- package/dist/backtop/foundation.js +7 -8
- package/dist/banner/foundation.d.ts +1 -1
- package/dist/banner/foundation.js +4 -4
- package/dist/base/auto-close-foundation.d.ts +8 -9
- package/dist/base/auto-close-foundation.js +15 -15
- package/dist/base/foundation.d.ts +4 -4
- package/dist/base/foundation.js +12 -11
- package/dist/base/list-store.d.ts +0 -1
- package/dist/breadcrumb/foundation.d.ts +5 -5
- package/dist/breadcrumb/foundation.js +9 -10
- package/dist/breadcrumb/item-foundation.d.ts +3 -3
- package/dist/breadcrumb/item-foundation.js +6 -6
- package/dist/calendar/event-util.d.ts +0 -10
- package/dist/calendar/event-util.js +1 -11
- package/dist/calendar/foundation.d.ts +1 -6
- package/dist/calendar/foundation.js +5 -9
- package/dist/calendar/month-foundation.d.ts +2 -3
- package/dist/calendar/month-foundation.js +6 -7
- package/dist/carousel/foundation.d.ts +17 -19
- package/dist/carousel/foundation.js +51 -51
- package/dist/cascader/foundation.d.ts +36 -32
- package/dist/cascader/foundation.js +145 -132
- package/dist/cascader/util.d.ts +1 -8
- package/dist/cascader/util.js +1 -8
- package/dist/checkbox/checkbox-foundation.d.ts +3 -7
- package/dist/checkbox/checkbox-foundation.js +15 -17
- package/dist/checkbox/checkbox-group-foundation.d.ts +2 -3
- package/dist/checkbox/checkbox-group-foundation.js +8 -8
- package/dist/code-highlight/index.d.ts +1 -2
- package/dist/code-highlight/index.js +3 -3
- package/dist/collapse/foundation.d.ts +2 -2
- package/dist/collapse/foundation.js +7 -7
- package/dist/collapsible/foundation.d.ts +3 -3
- package/dist/collapsible/foundation.js +8 -8
- package/dist/color-picker/alpha-slider-foundation.d.ts +2 -4
- package/dist/color-picker/alpha-slider-foundation.js +10 -10
- package/dist/color-picker/color-choose-area-foundation.d.ts +2 -5
- package/dist/color-picker/color-choose-area-foundation.js +14 -14
- package/dist/color-picker/color-picker.scss +0 -2
- package/dist/color-picker/color-slider-foundation.d.ts +2 -4
- package/dist/color-picker/color-slider-foundation.js +10 -10
- package/dist/color-picker/data-part-foundation.d.ts +5 -5
- package/dist/color-picker/data-part-foundation.js +11 -11
- package/dist/color-picker/foundation.d.ts +4 -4
- package/dist/color-picker/foundation.js +10 -10
- package/dist/color-picker/interface.d.ts +0 -1
- package/dist/config-provider/breakpoint-observer.d.ts +3 -3
- package/dist/config-provider/breakpoint-observer.js +6 -6
- package/dist/config-provider/responsive-types.d.ts +0 -16
- package/dist/cropper/foundation.d.ts +15 -16
- package/dist/cropper/foundation.js +26 -24
- package/dist/date-picker/_utils/get-default-picker-date.d.ts +0 -3
- package/dist/date-picker/_utils/get-default-picker-date.js +0 -3
- package/dist/date-picker/_utils/get-inset-input-format-token.d.ts +0 -2
- package/dist/date-picker/_utils/get-inset-input-format-token.js +0 -2
- package/dist/date-picker/_utils/get-inset-input-value-from-inset-input-str.d.ts +0 -2
- package/dist/date-picker/_utils/get-inset-input-value-from-inset-input-str.js +0 -2
- package/dist/date-picker/_utils/parser.d.ts +0 -3
- package/dist/date-picker/_utils/parser.js +0 -7
- package/dist/date-picker/_utils/picker-type.d.ts +1 -3
- package/dist/date-picker/_utils/picker-type.js +0 -2
- package/dist/date-picker/_utils/to-callback-args.d.ts +0 -1
- package/dist/date-picker/_utils/to-callback-args.js +0 -1
- package/dist/date-picker/date-picker.scss +0 -3
- package/dist/date-picker/foundation.d.ts +39 -58
- package/dist/date-picker/foundation.js +126 -153
- package/dist/date-picker/input-foundation.d.ts +10 -16
- package/dist/date-picker/input-foundation.js +28 -30
- package/dist/date-picker/month-foundation.d.ts +0 -3
- package/dist/date-picker/month-foundation.js +0 -2
- package/dist/date-picker/months-grid-foundation.d.ts +17 -26
- package/dist/date-picker/months-grid-foundation.js +65 -75
- package/dist/date-picker/year-and-month-foundation.d.ts +3 -3
- package/dist/date-picker/year-and-month-foundation.js +11 -11
- package/dist/drag-move/foundation.d.ts +2 -3
- package/dist/drag-move/foundation.js +15 -13
- package/dist/dropdown/foundation.d.ts +8 -7
- package/dist/dropdown/foundation.js +32 -28
- package/dist/dropdown/menu-foundation.d.ts +1 -2
- package/dist/dropdown/menu-foundation.js +11 -11
- package/dist/feedback/foundation.d.ts +9 -10
- package/dist/feedback/foundation.js +33 -33
- package/dist/feedback/variables.scss +1 -5
- package/dist/float-button/float-button.css +0 -1
- package/dist/float-button/float-button.scss +0 -2
- package/dist/form/form-api-proxy.d.ts +8 -7
- package/dist/form/form-api-proxy.js +25 -25
- package/dist/form/form.scss +0 -12
- package/dist/form/foundation.d.ts +5 -5
- package/dist/form/foundation.js +60 -76
- package/dist/form/interface.d.ts +2 -15
- package/dist/form/utils.d.ts +0 -8
- package/dist/form/utils.js +0 -7
- package/dist/form/variables.scss +1 -4
- package/dist/grid/variables.scss +0 -10
- package/dist/highlight/foundation.d.ts +0 -2
- package/dist/highlight/foundation.js +1 -3
- package/dist/hot-keys/foundation.d.ts +2 -3
- package/dist/hot-keys/foundation.js +5 -5
- package/dist/image/image-foundation.d.ts +4 -6
- package/dist/image/image-foundation.js +10 -10
- package/dist/image/preview-footer-foundation.d.ts +3 -4
- package/dist/image/preview-footer-foundation.js +10 -10
- package/dist/image/preview-foundation.d.ts +0 -3
- package/dist/image/preview-foundation.js +7 -6
- package/dist/image/preview-image-foundation.d.ts +6 -9
- package/dist/image/preview-image-foundation.js +14 -14
- package/dist/image/preview-inner-foundation.d.ts +9 -10
- package/dist/image/preview-inner-foundation.js +38 -38
- package/dist/input/foundation.d.ts +10 -11
- package/dist/input/foundation.js +47 -49
- package/dist/input/text-entry-foundation.d.ts +3 -5
- package/dist/input/text-entry-foundation.js +14 -15
- package/dist/input/textarea-foundation.d.ts +7 -8
- package/dist/input/textarea-foundation.js +36 -36
- package/dist/input-number/caret.d.ts +0 -1
- package/dist/input-number/caret.js +0 -1
- package/dist/input-number/foundation.d.ts +16 -19
- package/dist/input-number/foundation.js +54 -58
- package/dist/json-viewer/foundation.d.ts +8 -10
- package/dist/json-viewer/foundation.js +23 -24
- package/dist/locale/interface.d.ts +0 -3
- package/dist/lottie/foundation.d.ts +1 -1
- package/dist/lottie/foundation.js +4 -4
- package/dist/markdown-render/foundation.d.ts +2 -7
- package/dist/markdown-render/foundation.js +5 -9
- package/dist/modal/modal-content-foundation.d.ts +7 -7
- package/dist/modal/modal-content-foundation.js +20 -20
- package/dist/modal/modal-foundation.d.ts +6 -6
- package/dist/modal/modal-foundation.js +24 -24
- package/dist/navigation/foundation.d.ts +1 -8
- package/dist/navigation/foundation.js +14 -20
- package/dist/navigation/item-foundation.d.ts +1 -1
- package/dist/navigation/item-foundation.js +8 -8
- package/dist/navigation/sub-nav-foundation.d.ts +3 -4
- package/dist/navigation/sub-nav-foundation.js +17 -17
- package/dist/notification/notification-list-foundation.d.ts +7 -8
- package/dist/notification/notification-list-foundation.js +12 -13
- package/dist/notification/variables.scss +0 -1
- package/dist/overflow-list/foundation.d.ts +4 -6
- package/dist/overflow-list/foundation.js +18 -19
- package/dist/pagination/foundation.d.ts +8 -10
- package/dist/pagination/foundation.js +28 -28
- package/dist/pincode/foundation.d.ts +6 -9
- package/dist/pincode/foundation.js +23 -26
- package/dist/popconfirm/popconfirm-foundation.d.ts +7 -9
- package/dist/popconfirm/popconfirm-foundation.js +26 -26
- package/dist/progress/generates.d.ts +1 -4
- package/dist/progress/generates.js +1 -4
- package/dist/progress/utils.d.ts +1 -1
- package/dist/progress/utils.js +1 -1
- package/dist/radio/radio-foundation.d.ts +5 -9
- package/dist/radio/radio-foundation.js +15 -16
- package/dist/radio/radio-group-foundation.d.ts +2 -3
- package/dist/radio/radio-group-foundation.js +9 -9
- package/dist/rating/foundation.d.ts +10 -15
- package/dist/rating/foundation.js +35 -38
- package/dist/resizable/group/index.d.ts +6 -10
- package/dist/resizable/group/index.js +40 -44
- package/dist/resizable/resizable.scss +0 -1
- package/dist/resizable/single/index.d.ts +3 -7
- package/dist/resizable/single/index.js +10 -13
- package/dist/scroll-list/item-foundation.d.ts +7 -9
- package/dist/scroll-list/item-foundation.js +35 -36
- package/dist/scroll-list/variables.scss +1 -6
- package/dist/select/foundation.d.ts +42 -57
- package/dist/select/foundation.js +214 -279
- package/dist/select/option-foundation.d.ts +23 -28
- package/dist/select/option-foundation.js +10 -19
- package/dist/select/variables.scss +1 -8
- package/dist/side-sheet/side-sheet-foundation.d.ts +7 -12
- package/dist/side-sheet/side-sheet-foundation.js +23 -27
- package/dist/side-sheet/variables.scss +1 -3
- package/dist/slider/foundation.d.ts +17 -28
- package/dist/slider/foundation.js +47 -59
- package/dist/slider/variables.scss +1 -5
- package/dist/sortable/accessibility.d.ts +1 -1
- package/dist/sortable/accessibility.js +2 -2
- package/dist/spin/foundation.d.ts +2 -4
- package/dist/spin/foundation.js +6 -7
- package/dist/spin/variables.scss +1 -3
- package/dist/steps/utils.d.ts +1 -1
- package/dist/switch/foundation.d.ts +2 -3
- package/dist/switch/foundation.js +7 -7
- package/dist/switch/switch.scss +1 -1
- package/dist/switch/variables.scss +1 -5
- package/dist/table/foundation.d.ts +24 -33
- package/dist/table/foundation.js +144 -108
- package/dist/table/table.scss +0 -1
- package/dist/table/utils.d.ts +2 -10
- package/dist/table/utils.js +0 -13
- package/dist/table/variables.scss +1 -5
- package/dist/tabs/foundation.d.ts +5 -14
- package/dist/tabs/foundation.js +17 -21
- package/dist/tabs/tabs.scss +1 -1
- package/dist/tag/focus.js +0 -1
- package/dist/tag-input/foundation.d.ts +11 -13
- package/dist/tag-input/foundation.js +52 -53
- package/dist/tag-input/tag-input.scss +0 -1
- package/dist/tag-input/utils/tag-focus.d.ts +0 -1
- package/dist/tag-input/utils/tag-focus.js +0 -1
- package/dist/time-picker/combox-foundation.d.ts +3 -11
- package/dist/time-picker/combox-foundation.js +3 -10
- package/dist/time-picker/foundation.d.ts +13 -23
- package/dist/time-picker/foundation.js +39 -48
- package/dist/time-picker/input-foundation.d.ts +4 -4
- package/dist/time-picker/input-foundation.js +13 -13
- package/dist/time-picker/utils/index.d.ts +0 -11
- package/dist/time-picker/utils/index.js +0 -11
- package/dist/toast/toast-list-foundation.d.ts +7 -7
- package/dist/toast/toast-list-foundation.js +14 -14
- package/dist/tooltip/adjust-position.d.ts +1 -2
- package/dist/tooltip/constants.d.ts +0 -3
- package/dist/tooltip/constants.js +0 -3
- package/dist/tooltip/foundation.d.ts +9 -12
- package/dist/tooltip/foundation.js +67 -63
- package/dist/tooltip/position.scss +0 -1
- package/dist/transfer/foundation.d.ts +22 -13
- package/dist/transfer/foundation.js +38 -24
- package/dist/tree/foundation.d.ts +14 -16
- package/dist/tree/foundation.js +61 -62
- package/dist/tree/shared.d.ts +2 -4
- package/dist/tree/shared.js +0 -2
- package/dist/tree/tree-util.d.ts +0 -5
- package/dist/tree/tree-util.js +0 -5
- package/dist/tree-select/foundation.d.ts +26 -22
- package/dist/tree-select/foundation.js +91 -86
- package/dist/typography/ellipsis.d.ts +5 -7
- package/dist/typography/ellipsis.js +8 -10
- package/dist/typography/format-numeral.d.ts +1 -1
- package/dist/typography/format-numeral.js +2 -2
- package/dist/typography/typography.scss +0 -1
- package/dist/upload/constants.d.ts +1 -1
- package/dist/upload/foundation.d.ts +17 -23
- package/dist/upload/foundation.js +93 -103
- package/dist/upload/utils.d.ts +3 -8
- package/dist/upload/utils.js +6 -11
- package/dist/user-guide/foundation.d.ts +3 -5
- package/dist/user-guide/foundation.js +19 -19
- package/dist/utils/a11y.d.ts +2 -6
- package/dist/utils/a11y.js +1 -4
- package/dist/utils/announcer.d.ts +2 -2
- package/dist/utils/announcer.js +4 -4
- package/dist/utils/array.d.ts +0 -6
- package/dist/utils/array.js +0 -6
- package/dist/utils/date-fns-extra.js +1 -5
- package/dist/utils/dom.d.ts +0 -1
- package/dist/utils/dom.js +0 -1
- package/dist/utils/escape-html.js +0 -3
- package/dist/utils/field-sizing.d.ts +0 -2
- package/dist/utils/field-sizing.js +0 -2
- package/dist/utils/focus-handle.d.ts +1 -2
- package/dist/utils/focus-handle.js +1 -3
- package/dist/utils/focus-scope.d.ts +5 -6
- package/dist/utils/focus-scope.js +10 -11
- package/dist/utils/is-promise.d.ts +1 -1
- package/dist/utils/release-holder.d.ts +2 -2
- package/dist/utils/release-holder.js +4 -4
- package/dist/utils/scroll-lock.d.ts +3 -4
- package/dist/utils/scroll-lock.js +3 -4
- package/dist/utils/tween.d.ts +0 -1
- package/dist/utils/tween.js +0 -1
- package/dist/utils/uuid.d.ts +0 -1
- package/dist/utils/uuid.js +0 -1
- package/dist/utils/warning.d.ts +0 -1
- package/dist/utils/warning.js +0 -1
- package/dist/video-player/foundation.d.ts +15 -15
- package/dist/video-player/foundation.js +89 -89
- package/dist/video-player/progress-foundation.d.ts +2 -3
- package/dist/video-player/progress-foundation.js +12 -13
- package/dist/video-player/variables.scss +1 -1
- package/package.json +2 -2
|
@@ -22,7 +22,7 @@ var InputFoundation = class InputFoundation extends BaseFoundation {
|
|
|
22
22
|
return `${rangeStart}${props.rangeSeparator}${rangeEnd}`;
|
|
23
23
|
}
|
|
24
24
|
#autoFillTimeToInsetInputValue({ panel, field, insetInputValue, format: format$1 }) {
|
|
25
|
-
const { type, defaultPickerValue, dateFnsLocale } = this.
|
|
25
|
+
const { type, defaultPickerValue, dateFnsLocale } = this.adapter.getProps();
|
|
26
26
|
const { dateInput, timeInput } = insetInputValue[panel];
|
|
27
27
|
if (!type.includes("Time") || field !== "dateInput" || timeInput) return insetInputValue;
|
|
28
28
|
const dateFormatToken = format$1.split(" ")[0] ?? strings.FORMAT_FULL_DATE;
|
|
@@ -42,7 +42,6 @@ var InputFoundation = class InputFoundation extends BaseFoundation {
|
|
|
42
42
|
}
|
|
43
43
|
};
|
|
44
44
|
}
|
|
45
|
-
/** The text the trigger input shows for `value` */
|
|
46
45
|
static formatShowText({ type, dateFnsLocale, format, rangeSeparator }, value, customFormat) {
|
|
47
46
|
const formatToken = customFormat || format || getDefaultFormatTokenByType(type);
|
|
48
47
|
switch (type) {
|
|
@@ -59,7 +58,6 @@ var InputFoundation = class InputFoundation extends BaseFoundation {
|
|
|
59
58
|
default: return "";
|
|
60
59
|
}
|
|
61
60
|
}
|
|
62
|
-
/** The trigger text: the text being typed, else `value` formatted */
|
|
63
61
|
static getShowText(props) {
|
|
64
62
|
if (props.inputValue != null) return props.inputValue;
|
|
65
63
|
return props.value?.length ? InputFoundation.formatShowText(props, props.value) : "";
|
|
@@ -148,37 +146,37 @@ var InputFoundation = class InputFoundation extends BaseFoundation {
|
|
|
148
146
|
default: return "";
|
|
149
147
|
}
|
|
150
148
|
}
|
|
151
|
-
handleChange(value, e) {
|
|
152
|
-
this.
|
|
153
|
-
}
|
|
154
|
-
handleInputComplete(e) {
|
|
155
|
-
if (e.key === KEY_CODE_ENTER) this.
|
|
156
|
-
}
|
|
157
|
-
handleInputClear(e) {
|
|
158
|
-
this.
|
|
159
|
-
}
|
|
149
|
+
handleChange = (value, e) => {
|
|
150
|
+
this.adapter.notifyChange(value, e);
|
|
151
|
+
};
|
|
152
|
+
handleInputComplete = (e) => {
|
|
153
|
+
if (e.key === KEY_CODE_ENTER && e.target instanceof HTMLInputElement) this.adapter.notifyEnter(e.target.value);
|
|
154
|
+
};
|
|
155
|
+
handleInputClear = (e) => {
|
|
156
|
+
this.adapter.notifyClear(e);
|
|
157
|
+
};
|
|
160
158
|
handleRangeInputClear(e) {
|
|
161
159
|
e.stopPropagation();
|
|
162
|
-
this.
|
|
160
|
+
this.adapter.notifyRangeInputClear(e);
|
|
163
161
|
}
|
|
164
|
-
handleRangeInputClearClick(e) {
|
|
162
|
+
handleRangeInputClearClick = (e) => {
|
|
165
163
|
if (e.detail === 0) this.handleRangeInputClear(e);
|
|
166
|
-
}
|
|
167
|
-
handleRangeInputClearMouseDown(e) {
|
|
164
|
+
};
|
|
165
|
+
handleRangeInputClearMouseDown = (e) => {
|
|
168
166
|
if (isSecondaryPress(e)) e.preventDefault();
|
|
169
167
|
else this.handleRangeInputClear(e);
|
|
170
|
-
}
|
|
171
|
-
handleRangeInputEnterPress(e, rangeInputValue) {
|
|
172
|
-
if (e.key === KEY_CODE_ENTER) this.
|
|
173
|
-
}
|
|
174
|
-
handleRangeInputEndKeyPress(e) {
|
|
175
|
-
if (e.key === KEY_CODE_TAB) this.
|
|
176
|
-
}
|
|
177
|
-
handleRangeInputFocus(e, rangeType) {
|
|
178
|
-
this.
|
|
179
|
-
}
|
|
180
|
-
handleInsetInputChange({ value, panel, field, insetInputValue }) {
|
|
181
|
-
const props = this.
|
|
168
|
+
};
|
|
169
|
+
handleRangeInputEnterPress = (e, rangeInputValue) => {
|
|
170
|
+
if (e.key === KEY_CODE_ENTER) this.adapter.notifyEnter(rangeInputValue);
|
|
171
|
+
};
|
|
172
|
+
handleRangeInputEndKeyPress = (e) => {
|
|
173
|
+
if (e.key === KEY_CODE_TAB) this.adapter.notifyTabPress(e);
|
|
174
|
+
};
|
|
175
|
+
handleRangeInputFocus = (e, rangeType) => {
|
|
176
|
+
this.adapter.notifyRangeInputFocus(e, rangeType);
|
|
177
|
+
};
|
|
178
|
+
handleInsetInputChange = ({ value, panel, field, insetInputValue }) => {
|
|
179
|
+
const props = this.adapter.getProps();
|
|
182
180
|
const { format, type, rangeSeparator } = props;
|
|
183
181
|
const insetFormatToken = getInsetInputFormatToken({
|
|
184
182
|
type,
|
|
@@ -204,11 +202,11 @@ var InputFoundation = class InputFoundation extends BaseFoundation {
|
|
|
204
202
|
format: insetFormatToken
|
|
205
203
|
});
|
|
206
204
|
const finalInsetInputStr = InputFoundation.concatInsetInputValue(props, { insetInputValue: filledTimeInsetInputValue });
|
|
207
|
-
this.
|
|
205
|
+
this.adapter.notifyInsetInputChange({
|
|
208
206
|
insetInputValue: filledTimeInsetInputValue,
|
|
209
207
|
format: insetFormatToken,
|
|
210
208
|
insetInputStr: finalInsetInputStr
|
|
211
209
|
});
|
|
212
|
-
}
|
|
210
|
+
};
|
|
213
211
|
};
|
|
214
212
|
export { InputFoundation as default };
|
|
@@ -26,7 +26,6 @@ export interface MonthFoundationProps {
|
|
|
26
26
|
renderFullDate: RenderFullDateType;
|
|
27
27
|
hoverDay: string;
|
|
28
28
|
rangeInputFocus: string | boolean;
|
|
29
|
-
/** which range inputs have been focused since the panel opened */
|
|
30
29
|
focusRecords: FocusRecords;
|
|
31
30
|
locale: any;
|
|
32
31
|
multiple: boolean;
|
|
@@ -48,10 +47,8 @@ export interface MonthTable {
|
|
|
48
47
|
export type DayStatusOptions = Pick<MonthFoundationProps, 'selected' | 'rangeStart' | 'rangeEnd' | 'offsetRangeStart' | 'offsetRangeEnd' | 'disabledDate' | 'hoverDay' | 'rangeInputFocus' | 'focusRecords'> & {
|
|
49
48
|
todayText: string;
|
|
50
49
|
};
|
|
51
|
-
/** The pure computations behind one month grid of the DatePicker panel */
|
|
52
50
|
export default class CalendarMonthFoundation {
|
|
53
51
|
#private;
|
|
54
|
-
/** The weekday keys of a row, starting from `weekStartsOn` */
|
|
55
52
|
static getWeekdays(weekStartsOn: WeekStartNumber): string[];
|
|
56
53
|
static getMonthTable(month: Date, weekStartsOn: WeekStartNumber): MonthTable;
|
|
57
54
|
/**
|
|
@@ -13,7 +13,6 @@ const MONTH_SWITCHES = {
|
|
|
13
13
|
1: "nextMonth",
|
|
14
14
|
12: "nextYear"
|
|
15
15
|
};
|
|
16
|
-
/** The pure computations behind one month grid of the DatePicker panel */
|
|
17
16
|
var CalendarMonthFoundation = class CalendarMonthFoundation {
|
|
18
17
|
static #getSingleDayStatus(fullDate, { todayText, selected, disabledDate, rangeStart, rangeEnd, rangeInputFocus, focusRecords }) {
|
|
19
18
|
const disabledOptions = {
|
|
@@ -110,7 +109,6 @@ var CalendarMonthFoundation = class CalendarMonthFoundation {
|
|
|
110
109
|
isInOffsetRange
|
|
111
110
|
};
|
|
112
111
|
}
|
|
113
|
-
/** The weekday keys of a row, starting from `weekStartsOn` */
|
|
114
112
|
static getWeekdays(weekStartsOn) {
|
|
115
113
|
return getDayofWeek({ weekStartsOn });
|
|
116
114
|
}
|
|
@@ -95,13 +95,7 @@ export interface MonthsGridAdapter extends DefaultAdapter<MonthsGridFoundationPr
|
|
|
95
95
|
}
|
|
96
96
|
export default class MonthsGridFoundation extends BaseFoundation<MonthsGridAdapter, MonthsGridFoundationProps, MonthsGridFoundationState> {
|
|
97
97
|
#private;
|
|
98
|
-
/**
|
|
99
|
-
* Shifts the other panel when the panel being changed lands on the other panel's month.
|
|
100
|
-
*
|
|
101
|
-
* @example
|
|
102
|
-
* - panelType=right, target=new Date('2022-09-01') and left panel is in '2022-09' => call it, left panel minus one month to '2022-08'
|
|
103
|
-
* - panelType=left, target=new Date('2021-12-01') and right panel is in '2021-12' => call it, right panel add one month to '2021-01'
|
|
104
|
-
*/
|
|
98
|
+
/** Shifts the other panel when the panel being changed lands on the other panel's month. */
|
|
105
99
|
protected handleSyncChangeMonths({ panelType, target }: {
|
|
106
100
|
panelType: PanelType;
|
|
107
101
|
target: Date;
|
|
@@ -115,8 +109,7 @@ export default class MonthsGridFoundation extends BaseFoundation<MonthsGridAdapt
|
|
|
115
109
|
/** The time part of `format`, in the tokens the time panel uses */
|
|
116
110
|
static getValidTimeFormat(format?: string): string;
|
|
117
111
|
static getValidDateFormat(props: Pick<MonthsGridFoundationProps, 'format' | 'type'>): string;
|
|
118
|
-
|
|
119
|
-
static calcDisabledTime({ disabledTime, type }: Pick<MonthsGridFoundationProps, 'disabledTime' | 'type'>, state: Pick<MonthsGridFoundationState, 'rangeStart' | 'rangeEnd' | 'monthLeft'>, panelType: PanelType): {
|
|
112
|
+
static calcDisabledTime({ disabledTime, type }: Pick<MonthsGridFoundationProps, 'disabledTime' | 'type'>, { rangeStart, rangeEnd, monthLeft }: Pick<MonthsGridFoundationState, 'rangeStart' | 'rangeEnd' | 'monthLeft'>, panelType: PanelType): {
|
|
120
113
|
disabledHours?: () => number[];
|
|
121
114
|
disabledMinutes?: (hour: number) => number[];
|
|
122
115
|
disabledSeconds?: (hour: number, minute: number) => number[];
|
|
@@ -126,11 +119,9 @@ export default class MonthsGridFoundation extends BaseFoundation<MonthsGridAdapt
|
|
|
126
119
|
* number of weeks makes the scroll list unstable
|
|
127
120
|
*/
|
|
128
121
|
static getYAMOpenType(state: Pick<MonthsGridFoundationState, 'monthLeft' | 'monthRight'>): "left" | "right" | "none" | "both";
|
|
129
|
-
/** The panel shows a scroll list, its year and month picker or its time picker, instead of the month */
|
|
130
122
|
static isYearOrTime(panel: PanelState): boolean;
|
|
131
123
|
/** The `x-open-type` of a panel: what it shows in place of, or beside, its month */
|
|
132
124
|
static getOpenType(panel: PanelState): "time" | "date" | "year";
|
|
133
|
-
/** The title of a month in the navigation, from the locale's `monthText` pattern */
|
|
134
125
|
static formatMonthText(locale: Pick<Locale['DatePicker'], 'monthText' | 'months'>, month?: Date): string;
|
|
135
126
|
/** The texts of a panel's date and time switch; the date is the picked range endpoint, else the shown date */
|
|
136
127
|
static getSwitchTexts({ rangeEndpoint, showDate, dateFormat, format: formatProp, locale, dateFnsLocale }: {
|
|
@@ -159,22 +150,22 @@ export default class MonthsGridFoundation extends BaseFoundation<MonthsGridAdapt
|
|
|
159
150
|
}>;
|
|
160
151
|
init(): void;
|
|
161
152
|
/** Moves the panels when `defaultPickerValue` changes; the first value is applied by getInitialState */
|
|
162
|
-
initDefaultPickerValue()
|
|
163
|
-
updateSelectedFromProps(values: (Date | null)[], refreshPicker?: boolean)
|
|
164
|
-
toYearMonth(panelType: PanelType, target: Date)
|
|
165
|
-
prevMonth(panelType: PanelType)
|
|
166
|
-
nextMonth(panelType: PanelType)
|
|
167
|
-
prevYear(panelType: PanelType)
|
|
168
|
-
nextYear(panelType: PanelType)
|
|
169
|
-
handleDayClick(day: MonthDayInfo, panelType: PanelType)
|
|
170
|
-
handleDayHover({ fullDate }?: {
|
|
153
|
+
initDefaultPickerValue: () => void;
|
|
154
|
+
updateSelectedFromProps: (values: (Date | null)[], refreshPicker?: boolean) => void;
|
|
155
|
+
toYearMonth: (panelType: PanelType, target: Date) => void;
|
|
156
|
+
prevMonth: (panelType: PanelType) => void;
|
|
157
|
+
nextMonth: (panelType: PanelType) => void;
|
|
158
|
+
prevYear: (panelType: PanelType) => void;
|
|
159
|
+
nextYear: (panelType: PanelType) => void;
|
|
160
|
+
handleDayClick: (day: MonthDayInfo, panelType: PanelType) => void;
|
|
161
|
+
handleDayHover: ({ fullDate }?: {
|
|
171
162
|
fullDate: string;
|
|
172
|
-
})
|
|
173
|
-
handleTimeChange(newTime: {
|
|
163
|
+
}) => void;
|
|
164
|
+
handleTimeChange: (newTime: {
|
|
174
165
|
timeStampValue: number;
|
|
175
|
-
}, panelType: PanelType)
|
|
176
|
-
showYearPicker(panelType: PanelType)
|
|
177
|
-
showTimePicker(panelType: PanelType)
|
|
178
|
-
showDatePanel(panelType: PanelType)
|
|
166
|
+
}, panelType: PanelType) => void;
|
|
167
|
+
showYearPicker: (panelType: PanelType) => void;
|
|
168
|
+
showTimePicker: (panelType: PanelType) => void;
|
|
169
|
+
showDatePanel: (panelType: PanelType) => void;
|
|
179
170
|
}
|
|
180
171
|
export {};
|
|
@@ -24,9 +24,9 @@ const dateCalcFns = {
|
|
|
24
24
|
};
|
|
25
25
|
var MonthsGridFoundation = class MonthsGridFoundation extends BaseFoundation {
|
|
26
26
|
#initDatePickerFromValue(values, refreshPicker = true) {
|
|
27
|
-
const { monthLeft } = this.
|
|
27
|
+
const { monthLeft } = this.adapter.getStates();
|
|
28
28
|
const newMonthLeft = { ...monthLeft };
|
|
29
|
-
this.
|
|
29
|
+
this.adapter.updateMonthOnLeft(newMonthLeft);
|
|
30
30
|
const newSelected = /* @__PURE__ */ new Set();
|
|
31
31
|
const isMultiple = this.#isMultiple();
|
|
32
32
|
if (!isMultiple) {
|
|
@@ -39,7 +39,7 @@ var MonthsGridFoundation = class MonthsGridFoundation extends BaseFoundation {
|
|
|
39
39
|
if (!values?.some((item) => item && differenceInCalendarMonths(item, monthLeft.pickerDate) === 0)) this.#handleShowDateAndTime(strings.PANEL_TYPE_LEFT, values[0] || newMonthLeft.pickerDate);
|
|
40
40
|
} else this.#handleShowDateAndTime(strings.PANEL_TYPE_LEFT, values[0] || newMonthLeft.pickerDate);
|
|
41
41
|
} else this.#handleShowDateAndTime(strings.PANEL_TYPE_LEFT, newMonthLeft.pickerDate);
|
|
42
|
-
this.
|
|
42
|
+
this.adapter.updateDaySelected(newSelected);
|
|
43
43
|
}
|
|
44
44
|
#initDateRangePickerFromValue(values, withTime = false) {
|
|
45
45
|
const monthLeft = this.getState("monthLeft");
|
|
@@ -69,9 +69,9 @@ var MonthsGridFoundation = class MonthsGridFoundation extends BaseFoundation {
|
|
|
69
69
|
let rangeStart = values[0] ? format(values[0], formatToken) : "";
|
|
70
70
|
let rangeEnd = values[1] ? format(values[1], formatToken) : "";
|
|
71
71
|
if (this.#isNeedSwap(rangeStart, rangeEnd)) [rangeStart, rangeEnd] = [rangeEnd, rangeStart];
|
|
72
|
-
this.
|
|
73
|
-
this.
|
|
74
|
-
this.
|
|
72
|
+
this.adapter.setRangeStart(rangeStart);
|
|
73
|
+
this.adapter.setRangeEnd(rangeEnd);
|
|
74
|
+
this.adapter.setHoverDay(rangeEnd);
|
|
75
75
|
}
|
|
76
76
|
#initDateTimePickerFromValue(values) {
|
|
77
77
|
this.#initDatePickerFromValue(values);
|
|
@@ -90,7 +90,7 @@ var MonthsGridFoundation = class MonthsGridFoundation extends BaseFoundation {
|
|
|
90
90
|
return isMultiple(this.getProps());
|
|
91
91
|
}
|
|
92
92
|
#mergeDateAndTime(date, time) {
|
|
93
|
-
const dateFnsLocale = this.
|
|
93
|
+
const dateFnsLocale = this.adapter.getProp("dateFnsLocale");
|
|
94
94
|
const day = isValidDate(date) ? date : compatibleParse(date, strings.FORMAT_FULL_DATE, void 0, dateFnsLocale);
|
|
95
95
|
return set(day, {
|
|
96
96
|
hours: time.getHours(),
|
|
@@ -136,7 +136,7 @@ var MonthsGridFoundation = class MonthsGridFoundation extends BaseFoundation {
|
|
|
136
136
|
[rangeStart, rangeEnd] = [rangeEnd, rangeStart];
|
|
137
137
|
[startDate, endDate] = [endDate, startDate];
|
|
138
138
|
}
|
|
139
|
-
if (!isControlledComponent) this.
|
|
139
|
+
if (!isControlledComponent) this.adapter.setRangeEnd(rangeEnd);
|
|
140
140
|
} else {
|
|
141
141
|
startDate = this.#mergeDateAndTime(timeDate, timeDate);
|
|
142
142
|
rangeStart = format(startDate, strings.FORMAT_DATE_TIME);
|
|
@@ -144,24 +144,24 @@ var MonthsGridFoundation = class MonthsGridFoundation extends BaseFoundation {
|
|
|
144
144
|
[rangeStart, rangeEnd] = [rangeEnd, rangeStart];
|
|
145
145
|
[startDate, endDate] = [endDate, startDate];
|
|
146
146
|
}
|
|
147
|
-
if (!isControlledComponent) this.
|
|
147
|
+
if (!isControlledComponent) this.adapter.setRangeStart(rangeStart);
|
|
148
148
|
}
|
|
149
|
-
this.
|
|
149
|
+
this.adapter.notifySelectedChange([startDate, endDate]);
|
|
150
150
|
}
|
|
151
151
|
}
|
|
152
152
|
#updatePanelDetail(panelType, kvs) {
|
|
153
153
|
const { monthLeft, monthRight } = this.getStates();
|
|
154
|
-
if (panelType === strings.PANEL_TYPE_RIGHT) this.
|
|
154
|
+
if (panelType === strings.PANEL_TYPE_RIGHT) this.adapter.updateMonthOnRight({
|
|
155
155
|
...monthRight,
|
|
156
156
|
...kvs
|
|
157
157
|
});
|
|
158
|
-
else this.
|
|
158
|
+
else this.adapter.updateMonthOnLeft({
|
|
159
159
|
...monthLeft,
|
|
160
160
|
...kvs
|
|
161
161
|
});
|
|
162
162
|
}
|
|
163
163
|
#toMonth(panelType, target) {
|
|
164
|
-
const { type } = this.
|
|
164
|
+
const { type } = this.adapter.getProps();
|
|
165
165
|
const diff = this.#getDiff("month", target, panelType);
|
|
166
166
|
this.#handleYearOrMonthChange(diff < 0 ? "prevMonth" : "nextMonth", panelType, Math.abs(diff), false);
|
|
167
167
|
if (isRangeType(type)) this.handleSyncChangeMonths({
|
|
@@ -186,11 +186,11 @@ var MonthsGridFoundation = class MonthsGridFoundation extends BaseFoundation {
|
|
|
186
186
|
if (panelDateHasUpdate) {
|
|
187
187
|
if (!isRange) {
|
|
188
188
|
const { notifyValue, notifyDate } = toCallbackArgs(targetMonth, this.getProps());
|
|
189
|
-
this.
|
|
189
|
+
this.adapter.notifyPanelChange(notifyDate, notifyValue);
|
|
190
190
|
} else if (!(isLeftPanelInRange && notSeparateInRange)) {
|
|
191
191
|
const states = this.getStates();
|
|
192
192
|
const { notifyValue, notifyDate } = toCallbackArgs([states.monthLeft.pickerDate, states.monthRight.pickerDate], this.getProps());
|
|
193
|
-
this.
|
|
193
|
+
this.adapter.notifyPanelChange(notifyDate, notifyValue);
|
|
194
194
|
}
|
|
195
195
|
}
|
|
196
196
|
if (autoSwitchDate) this.#updateDateAfterChangeYM(type, targetMonth);
|
|
@@ -213,7 +213,7 @@ var MonthsGridFoundation = class MonthsGridFoundation extends BaseFoundation {
|
|
|
213
213
|
rangeStart,
|
|
214
214
|
rangeEnd
|
|
215
215
|
})) return;
|
|
216
|
-
this.
|
|
216
|
+
this.adapter.notifySelectedChange([fullDate], options);
|
|
217
217
|
}
|
|
218
218
|
}
|
|
219
219
|
#handleDateSelected(day, panelType) {
|
|
@@ -230,8 +230,8 @@ var MonthsGridFoundation = class MonthsGridFoundation extends BaseFoundation {
|
|
|
230
230
|
else if (!max || newSelected.size < max) newSelected.add(dateStr);
|
|
231
231
|
const newSelectedDates = [...newSelected].map((_dateStr) => type === "dateTime" ? this.#mergeDateAndTime(_dateStr, time) : compatibleParse(_dateStr, strings.FORMAT_FULL_DATE, void 0, dateFnsLocale));
|
|
232
232
|
this.#handleShowDateAndTime(panelType, time);
|
|
233
|
-
if (!isControlledComponent) this.
|
|
234
|
-
this.
|
|
233
|
+
if (!isControlledComponent) this.adapter.updateDaySelected(newSelected);
|
|
234
|
+
this.adapter.notifySelectedChange(newSelectedDates);
|
|
235
235
|
}
|
|
236
236
|
#handleShowDateAndTime(panelType, pickerDate, showDate) {
|
|
237
237
|
const _showDate = showDate || pickerDate;
|
|
@@ -242,7 +242,7 @@ var MonthsGridFoundation = class MonthsGridFoundation extends BaseFoundation {
|
|
|
242
242
|
}
|
|
243
243
|
#handleRangeSelected({ fullDate }) {
|
|
244
244
|
let { rangeStart, rangeEnd } = this.getStates();
|
|
245
|
-
const { startDateOffset, endDateOffset, type, dateFnsLocale, rangeInputFocus } = this.
|
|
245
|
+
const { startDateOffset, endDateOffset, type, dateFnsLocale, rangeInputFocus } = this.adapter.getProps();
|
|
246
246
|
let rangeStartReset = false;
|
|
247
247
|
let rangeEndReset = false;
|
|
248
248
|
const isDateRangeAndHasOffset = (startDateOffset || endDateOffset) && type === "dateRange";
|
|
@@ -264,16 +264,16 @@ var MonthsGridFoundation = class MonthsGridFoundation extends BaseFoundation {
|
|
|
264
264
|
}
|
|
265
265
|
if (isRangeType(type)) {
|
|
266
266
|
if (isDateRangeAndHasOffset) {
|
|
267
|
-
this.
|
|
268
|
-
this.
|
|
267
|
+
this.adapter.setRangeStart(rangeStart);
|
|
268
|
+
this.adapter.setRangeEnd(rangeEnd);
|
|
269
269
|
} else if (rangeInputFocus === "rangeEnd") {
|
|
270
|
-
this.
|
|
271
|
-
if (rangeStartReset) this.
|
|
272
|
-
if (!this.
|
|
270
|
+
this.adapter.setRangeEnd(rangeEnd);
|
|
271
|
+
if (rangeStartReset) this.adapter.setRangeStart(rangeStart);
|
|
272
|
+
if (!this.adapter.hasOtherRangeInputBeenFocused("rangeEnd") || !rangeStart) this.adapter.setRangeInputFocus("rangeStart");
|
|
273
273
|
} else if (rangeInputFocus === "rangeStart" || !rangeInputFocus) {
|
|
274
|
-
this.
|
|
275
|
-
if (rangeEndReset) this.
|
|
276
|
-
if (!this.
|
|
274
|
+
this.adapter.setRangeStart(rangeStart);
|
|
275
|
+
if (rangeEndReset) this.adapter.setRangeEnd(rangeEnd);
|
|
276
|
+
if (!this.adapter.hasOtherRangeInputBeenFocused("rangeStart") || !rangeEnd) this.adapter.setRangeInputFocus("rangeEnd");
|
|
277
277
|
}
|
|
278
278
|
}
|
|
279
279
|
const dateFormat = MonthsGridFoundation.getValidDateFormat(this.getProps());
|
|
@@ -289,29 +289,23 @@ var MonthsGridFoundation = class MonthsGridFoundation extends BaseFoundation {
|
|
|
289
289
|
else date = [start, end];
|
|
290
290
|
}
|
|
291
291
|
const needCheckFocusRecord = !(type === "dateRange" && isDateRangeAndHasOffset);
|
|
292
|
-
this.
|
|
292
|
+
this.adapter.notifySelectedChange(date, {
|
|
293
293
|
needCheckFocusRecord,
|
|
294
294
|
rangeInputFocus
|
|
295
295
|
});
|
|
296
296
|
}
|
|
297
297
|
}
|
|
298
|
-
/**
|
|
299
|
-
* Shifts the other panel when the panel being changed lands on the other panel's month.
|
|
300
|
-
*
|
|
301
|
-
* @example
|
|
302
|
-
* - panelType=right, target=new Date('2022-09-01') and left panel is in '2022-09' => call it, left panel minus one month to '2022-08'
|
|
303
|
-
* - panelType=left, target=new Date('2021-12-01') and right panel is in '2021-12' => call it, right panel add one month to '2021-01'
|
|
304
|
-
*/
|
|
298
|
+
/** Shifts the other panel when the panel being changed lands on the other panel's month. */
|
|
305
299
|
handleSyncChangeMonths({ panelType, target }) {
|
|
306
|
-
const { type } = this.
|
|
307
|
-
const { monthLeft, monthRight } = this.
|
|
300
|
+
const { type } = this.adapter.getProps();
|
|
301
|
+
const { monthLeft, monthRight } = this.adapter.getStates();
|
|
308
302
|
if (isRangeType(type)) {
|
|
309
303
|
if (panelType === "right" && differenceInCalendarMonths(target, monthLeft.pickerDate) === 0) this.#handleYearOrMonthChange("prevMonth", "left", 1, true);
|
|
310
304
|
else if (panelType === "left" && differenceInCalendarMonths(monthRight.pickerDate, target) === 0) this.#handleYearOrMonthChange("nextMonth", "right", 1, true);
|
|
311
305
|
}
|
|
312
306
|
}
|
|
313
307
|
getTargetChangeDate({ panelType, switchType }) {
|
|
314
|
-
const { monthRight, monthLeft } = this.
|
|
308
|
+
const { monthRight, monthLeft } = this.adapter.getStates();
|
|
315
309
|
const currentDate = panelType === "left" ? monthLeft.pickerDate : monthRight.pickerDate;
|
|
316
310
|
return dateCalcFns[switchType](currentDate, 1);
|
|
317
311
|
}
|
|
@@ -372,10 +366,8 @@ var MonthsGridFoundation = class MonthsGridFoundation extends BaseFoundation {
|
|
|
372
366
|
static getValidDateFormat(props) {
|
|
373
367
|
return props.format || getDefaultFormatToken(props.type);
|
|
374
368
|
}
|
|
375
|
-
|
|
376
|
-
static calcDisabledTime({ disabledTime, type }, state, panelType) {
|
|
369
|
+
static calcDisabledTime({ disabledTime, type }, { rangeStart, rangeEnd, monthLeft }, panelType) {
|
|
377
370
|
if (typeof disabledTime === "function" && panelType && isDateTimeType(type)) {
|
|
378
|
-
const { rangeStart, rangeEnd, monthLeft } = state;
|
|
379
371
|
const selected = [];
|
|
380
372
|
if (type === "dateTimeRange") {
|
|
381
373
|
if (rangeStart) selected.push(rangeStart);
|
|
@@ -397,7 +389,6 @@ var MonthsGridFoundation = class MonthsGridFoundation extends BaseFoundation {
|
|
|
397
389
|
else if (rightYearPickerOpen) return "right";
|
|
398
390
|
return "none";
|
|
399
391
|
}
|
|
400
|
-
/** The panel shows a scroll list, its year and month picker or its time picker, instead of the month */
|
|
401
392
|
static isYearOrTime(panel) {
|
|
402
393
|
return Boolean(panel && (panel.isTimePickerOpen || panel.isYearPickerOpen));
|
|
403
394
|
}
|
|
@@ -405,7 +396,6 @@ var MonthsGridFoundation = class MonthsGridFoundation extends BaseFoundation {
|
|
|
405
396
|
static getOpenType(panel) {
|
|
406
397
|
return panel.isYearPickerOpen ? "year" : panel.isTimePickerOpen ? "time" : "date";
|
|
407
398
|
}
|
|
408
|
-
/** The title of a month in the navigation, from the locale's `monthText` pattern */
|
|
409
399
|
static formatMonthText(locale, month) {
|
|
410
400
|
if (!month) return "";
|
|
411
401
|
const monthName = locale.months[month.getMonth() + 1];
|
|
@@ -447,7 +437,7 @@ var MonthsGridFoundation = class MonthsGridFoundation extends BaseFoundation {
|
|
|
447
437
|
this.updateSelectedFromProps(this.getProp("selectedValue"));
|
|
448
438
|
}
|
|
449
439
|
/** Moves the panels when `defaultPickerValue` changes; the first value is applied by getInitialState */
|
|
450
|
-
initDefaultPickerValue() {
|
|
440
|
+
initDefaultPickerValue = () => {
|
|
451
441
|
const { defaultPickerValue, type, format, dateFnsLocale } = this.getProps();
|
|
452
442
|
if (defaultPickerValue === void 0) return;
|
|
453
443
|
const { nowDate, nextDate } = getDefaultPickerDate({
|
|
@@ -459,8 +449,8 @@ var MonthsGridFoundation = class MonthsGridFoundation extends BaseFoundation {
|
|
|
459
449
|
this.#updatePanelDetail(strings.PANEL_TYPE_LEFT, { pickerDate: nowDate });
|
|
460
450
|
this.#updatePanelDetail(strings.PANEL_TYPE_RIGHT, { pickerDate: nextDate });
|
|
461
451
|
}
|
|
462
|
-
}
|
|
463
|
-
updateSelectedFromProps(values, refreshPicker = true) {
|
|
452
|
+
};
|
|
453
|
+
updateSelectedFromProps = (values, refreshPicker = true) => {
|
|
464
454
|
const type = this.getProp("type");
|
|
465
455
|
const { selected, rangeStart, rangeEnd } = this.getStates();
|
|
466
456
|
if (values && values?.length) switch (type) {
|
|
@@ -476,28 +466,28 @@ var MonthsGridFoundation = class MonthsGridFoundation extends BaseFoundation {
|
|
|
476
466
|
case "dateTimeRange": this.#initDateTimeRangePickerFormValue(values);
|
|
477
467
|
}
|
|
478
468
|
else if (Array.isArray(values) && !values.length || !values) {
|
|
479
|
-
if (selected instanceof Set && selected.size) this.
|
|
480
|
-
if (rangeStart) this.
|
|
481
|
-
if (rangeEnd) this.
|
|
469
|
+
if (selected instanceof Set && selected.size) this.adapter.updateDaySelected(/* @__PURE__ */ new Set());
|
|
470
|
+
if (rangeStart) this.adapter.setRangeStart("");
|
|
471
|
+
if (rangeEnd) this.adapter.setRangeEnd("");
|
|
482
472
|
}
|
|
483
|
-
}
|
|
484
|
-
toYearMonth(panelType, target) {
|
|
473
|
+
};
|
|
474
|
+
toYearMonth = (panelType, target) => {
|
|
485
475
|
this.#toYear(panelType, target);
|
|
486
476
|
this.#toMonth(panelType, target);
|
|
487
|
-
}
|
|
488
|
-
prevMonth(panelType) {
|
|
477
|
+
};
|
|
478
|
+
prevMonth = (panelType) => {
|
|
489
479
|
this.handleSwitchMonthOrYear("prevMonth", panelType);
|
|
490
|
-
}
|
|
491
|
-
nextMonth(panelType) {
|
|
480
|
+
};
|
|
481
|
+
nextMonth = (panelType) => {
|
|
492
482
|
this.handleSwitchMonthOrYear("nextMonth", panelType);
|
|
493
|
-
}
|
|
494
|
-
prevYear(panelType) {
|
|
483
|
+
};
|
|
484
|
+
prevYear = (panelType) => {
|
|
495
485
|
this.handleSwitchMonthOrYear("prevYear", panelType);
|
|
496
|
-
}
|
|
497
|
-
nextYear(panelType) {
|
|
486
|
+
};
|
|
487
|
+
nextYear = (panelType) => {
|
|
498
488
|
this.handleSwitchMonthOrYear("nextYear", panelType);
|
|
499
|
-
}
|
|
500
|
-
handleDayClick(day, panelType) {
|
|
489
|
+
};
|
|
490
|
+
handleDayClick = (day, panelType) => {
|
|
501
491
|
const type = this.getProp("type");
|
|
502
492
|
switch (true) {
|
|
503
493
|
case type === "date" || type === "dateTime":
|
|
@@ -505,18 +495,18 @@ var MonthsGridFoundation = class MonthsGridFoundation extends BaseFoundation {
|
|
|
505
495
|
break;
|
|
506
496
|
case type === "dateRange" || type === "dateTimeRange": this.#handleRangeSelected(day);
|
|
507
497
|
}
|
|
508
|
-
}
|
|
509
|
-
handleDayHover({ fullDate } = { fullDate: "" }) {
|
|
498
|
+
};
|
|
499
|
+
handleDayHover = ({ fullDate } = { fullDate: "" }) => {
|
|
510
500
|
const { startDateOffset, endDateOffset, type } = this.getProps();
|
|
511
|
-
this.
|
|
501
|
+
this.adapter.setHoverDay(fullDate);
|
|
512
502
|
if ((startDateOffset || endDateOffset) && type === "dateRange") {
|
|
513
503
|
const offsetRangeStart = getFullDateOffset(startDateOffset, fullDate);
|
|
514
504
|
const offsetRangeEnd = getFullDateOffset(endDateOffset, fullDate);
|
|
515
|
-
this.
|
|
516
|
-
this.
|
|
505
|
+
this.adapter.setOffsetRangeStart(offsetRangeStart);
|
|
506
|
+
this.adapter.setOffsetRangeEnd(offsetRangeEnd);
|
|
517
507
|
}
|
|
518
|
-
}
|
|
519
|
-
handleTimeChange(newTime, panelType) {
|
|
508
|
+
};
|
|
509
|
+
handleTimeChange = (newTime, panelType) => {
|
|
520
510
|
const { rangeEnd, rangeStart } = this.getStates();
|
|
521
511
|
const { type, dateFnsLocale } = this.getProps();
|
|
522
512
|
const { showDate } = this.#getPanelDetail(panelType);
|
|
@@ -533,25 +523,25 @@ var MonthsGridFoundation = class MonthsGridFoundation extends BaseFoundation {
|
|
|
533
523
|
fullValidDate
|
|
534
524
|
}, panelType);
|
|
535
525
|
}
|
|
536
|
-
}
|
|
537
|
-
showYearPicker(panelType) {
|
|
526
|
+
};
|
|
527
|
+
showYearPicker = (panelType) => {
|
|
538
528
|
this.#updatePanelDetail(panelType, {
|
|
539
529
|
isTimePickerOpen: false,
|
|
540
530
|
isYearPickerOpen: true
|
|
541
531
|
});
|
|
542
|
-
}
|
|
543
|
-
showTimePicker(panelType) {
|
|
532
|
+
};
|
|
533
|
+
showTimePicker = (panelType) => {
|
|
544
534
|
if (this.getProp("disabledTimePicker")) return;
|
|
545
535
|
this.#updatePanelDetail(panelType, {
|
|
546
536
|
isTimePickerOpen: true,
|
|
547
537
|
isYearPickerOpen: false
|
|
548
538
|
});
|
|
549
|
-
}
|
|
550
|
-
showDatePanel(panelType) {
|
|
539
|
+
};
|
|
540
|
+
showDatePanel = (panelType) => {
|
|
551
541
|
this.#updatePanelDetail(panelType, {
|
|
552
542
|
isTimePickerOpen: false,
|
|
553
543
|
isYearPickerOpen: false
|
|
554
544
|
});
|
|
555
|
-
}
|
|
545
|
+
};
|
|
556
546
|
};
|
|
557
547
|
export { MonthsGridFoundation as default };
|
|
@@ -68,8 +68,8 @@ export default class YearAndMonthFoundation extends BaseFoundation<YearAndMonthA
|
|
|
68
68
|
static getYearList(props: YearAndMonthFoundationProps, panelType: PanelType): YearScrollItem[];
|
|
69
69
|
/** The month column of a panel; in the right panel of the same year no month may come before the left one */
|
|
70
70
|
static getMonthList(props: YearAndMonthFoundationProps, panelType: PanelType): MonthScrollItem[];
|
|
71
|
-
selectYear(item: YearScrollItem, panelType?: PanelType)
|
|
72
|
-
selectMonth(item: MonthScrollItem, panelType?: PanelType)
|
|
73
|
-
backToMain()
|
|
71
|
+
selectYear: (item: YearScrollItem, panelType?: PanelType) => void;
|
|
72
|
+
selectMonth: (item: MonthScrollItem, panelType?: PanelType) => void;
|
|
73
|
+
backToMain: () => void;
|
|
74
74
|
}
|
|
75
75
|
export {};
|
|
@@ -6,7 +6,7 @@ import getYearAndMonth from "./_utils/get-year-and-month.js";
|
|
|
6
6
|
const MONTHS = Array.from({ length: 12 }, (_v, idx) => idx + 1);
|
|
7
7
|
var YearAndMonthFoundation = class YearAndMonthFoundation extends BaseFoundation {
|
|
8
8
|
#autoSelectMonth(item, panelType, year, currentMonth) {
|
|
9
|
-
const { disabledDate } = this.
|
|
9
|
+
const { disabledDate } = this.adapter.getProps();
|
|
10
10
|
const oppositeType = panelType === strings.PANEL_TYPE_LEFT ? "right" : "left";
|
|
11
11
|
const isValid = (month) => !disabledDate(new Date(item.year, month - 1));
|
|
12
12
|
const isCurrentMonthDisabled = !isValid(currentMonth[panelType]);
|
|
@@ -38,7 +38,7 @@ var YearAndMonthFoundation = class YearAndMonthFoundation extends BaseFoundation
|
|
|
38
38
|
right: currentMonth[panelType]
|
|
39
39
|
};
|
|
40
40
|
}
|
|
41
|
-
this.
|
|
41
|
+
this.adapter.notifySelect({
|
|
42
42
|
currentYear: finalYear,
|
|
43
43
|
currentMonth: finalMonth
|
|
44
44
|
});
|
|
@@ -77,7 +77,7 @@ var YearAndMonthFoundation = class YearAndMonthFoundation extends BaseFoundation
|
|
|
77
77
|
value: locale.fullMonths[month]
|
|
78
78
|
}));
|
|
79
79
|
}
|
|
80
|
-
selectYear(item, panelType) {
|
|
80
|
+
selectYear = (item, panelType) => {
|
|
81
81
|
const { currentYear, currentMonth } = YearAndMonthFoundation.getYearAndMonth(this.getProps());
|
|
82
82
|
const { type } = this.getProps();
|
|
83
83
|
const left = strings.PANEL_TYPE_LEFT;
|
|
@@ -89,13 +89,13 @@ var YearAndMonthFoundation = class YearAndMonthFoundation extends BaseFoundation
|
|
|
89
89
|
if (panelType === left && item.value > year[right] || panelType === left && isSameYearIllegalDate) year[right] = item.value + 1;
|
|
90
90
|
else if (panelType === right && isSameYearIllegalDate) year[left] = item.value - 1;
|
|
91
91
|
}
|
|
92
|
-
this.
|
|
92
|
+
this.adapter.notifySelect({
|
|
93
93
|
currentMonth,
|
|
94
94
|
currentYear: year
|
|
95
95
|
});
|
|
96
96
|
if (type !== "year") this.#autoSelectMonth(item, panelType, year, currentMonth);
|
|
97
|
-
}
|
|
98
|
-
selectMonth(item, panelType) {
|
|
97
|
+
};
|
|
98
|
+
selectMonth = (item, panelType) => {
|
|
99
99
|
const { currentMonth, currentYear } = YearAndMonthFoundation.getYearAndMonth(this.getProps());
|
|
100
100
|
const { type } = this.getProps();
|
|
101
101
|
const left = strings.PANEL_TYPE_LEFT;
|
|
@@ -103,13 +103,13 @@ var YearAndMonthFoundation = class YearAndMonthFoundation extends BaseFoundation
|
|
|
103
103
|
const month = { ...currentMonth };
|
|
104
104
|
month[panelType] = item.month;
|
|
105
105
|
if (type === "monthRange" && panelType === left && currentYear[left] === currentYear[right] && item.month > month[right]) month[right] = item.month;
|
|
106
|
-
this.
|
|
106
|
+
this.adapter.notifySelect({
|
|
107
107
|
currentYear,
|
|
108
108
|
currentMonth: month
|
|
109
109
|
});
|
|
110
|
-
}
|
|
111
|
-
backToMain() {
|
|
112
|
-
this.
|
|
113
|
-
}
|
|
110
|
+
};
|
|
111
|
+
backToMain = () => {
|
|
112
|
+
this.adapter.notifyBackToMain();
|
|
113
|
+
};
|
|
114
114
|
};
|
|
115
115
|
export { YearAndMonthFoundation as default };
|
|
@@ -8,7 +8,6 @@ export interface DragMoveAdapter<P extends DragMoveBaseProps = DragMoveBaseProps
|
|
|
8
8
|
notifyTouchEnd: (e: PointerEvent) => void;
|
|
9
9
|
notifyTouchCancel: (e: PointerEvent) => void;
|
|
10
10
|
}
|
|
11
|
-
/** The props the foundation reads with getProp */
|
|
12
11
|
export interface DragMoveBaseProps {
|
|
13
12
|
handler?: () => HTMLElement | null;
|
|
14
13
|
constrainer?: 'parent' | (() => HTMLElement | null);
|
|
@@ -25,7 +24,7 @@ export default class DragMoveFoundation<P extends DragMoveBaseProps = DragMoveBa
|
|
|
25
24
|
* Prepares host children as they appear: the position strategy, a move cursor on the handler, and
|
|
26
25
|
* `touch-action: none` so a touch drag is not taken over by scrolling.
|
|
27
26
|
*/
|
|
28
|
-
prepareElements(elements: Element[])
|
|
29
|
-
updatePositionStrategy()
|
|
27
|
+
prepareElements: (elements: Element[]) => void;
|
|
28
|
+
updatePositionStrategy: () => void;
|
|
30
29
|
destroy(): void;
|
|
31
30
|
}
|