@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
|
@@ -8,8 +8,8 @@ var ColorPickerFoundation = class ColorPickerFoundation extends BaseFoundation {
|
|
|
8
8
|
super({ ...adapter });
|
|
9
9
|
}
|
|
10
10
|
#commit(color) {
|
|
11
|
-
this.
|
|
12
|
-
if (!this.
|
|
11
|
+
this.adapter.notifyChange(color);
|
|
12
|
+
if (!this.isControlledComponent("value")) this.adapter.setState({ currentColor: color });
|
|
13
13
|
}
|
|
14
14
|
handleChangeH(currentColor, newH) {
|
|
15
15
|
const hsva = {
|
|
@@ -38,7 +38,7 @@ var ColorPickerFoundation = class ColorPickerFoundation extends BaseFoundation {
|
|
|
38
38
|
});
|
|
39
39
|
}
|
|
40
40
|
getCurrentColor() {
|
|
41
|
-
return this.
|
|
41
|
+
return this.isControlledComponent("value") ? this.getProp("value") ?? this.getProp("defaultValue") : this.getState("currentColor");
|
|
42
42
|
}
|
|
43
43
|
/** The full color of a value given in `format`; without alpha support the opacity is dropped */
|
|
44
44
|
static getColorValue(color, format, alpha) {
|
|
@@ -133,15 +133,15 @@ var ColorPickerFoundation = class ColorPickerFoundation extends BaseFoundation {
|
|
|
133
133
|
}
|
|
134
134
|
}
|
|
135
135
|
/** After a controlled `value` is dropped, the uncontrolled state restarts from `defaultValue` */
|
|
136
|
-
resetToDefault() {
|
|
137
|
-
this.
|
|
138
|
-
}
|
|
139
|
-
handleChange(color, format) {
|
|
136
|
+
resetToDefault = () => {
|
|
137
|
+
this.adapter.setState({ currentColor: this.getProp("defaultValue") });
|
|
138
|
+
};
|
|
139
|
+
handleChange = (color, format) => {
|
|
140
140
|
this.#commit(ColorPickerFoundation.getColorValue(color, format, Boolean(this.getProp("alpha"))));
|
|
141
|
-
}
|
|
142
|
-
handleAlphaChangeByHandle(newAlpha) {
|
|
141
|
+
};
|
|
142
|
+
handleAlphaChangeByHandle = (newAlpha) => {
|
|
143
143
|
this.handleChangeA(this.getCurrentColor(), newAlpha.a);
|
|
144
|
-
}
|
|
144
|
+
};
|
|
145
145
|
handleColorChangeByHandle(newHue) {
|
|
146
146
|
this.handleChangeH(this.getCurrentColor(), newHue.h);
|
|
147
147
|
}
|
|
@@ -22,7 +22,6 @@ export interface HslColor {
|
|
|
22
22
|
export interface HslaColor extends HslColor {
|
|
23
23
|
a: number;
|
|
24
24
|
}
|
|
25
|
-
/** The text formats of the color input */
|
|
26
25
|
export type ColorFormat = 'hex' | 'rgba' | 'hsva';
|
|
27
26
|
/** The keydown fields the range handlers read; a framework's synthetic event fits */
|
|
28
27
|
export type RangeKeyEvent = Pick<KeyboardEvent, 'key' | 'altKey' | 'ctrlKey' | 'metaKey' | 'preventDefault'>;
|
|
@@ -13,9 +13,9 @@ export interface ObserveProps {
|
|
|
13
13
|
export default class BreakpointObserver {
|
|
14
14
|
#private;
|
|
15
15
|
constructor(props: ObserveProps, render: (screens: BreakpointScreens) => void);
|
|
16
|
-
sync(props: ObserveProps)
|
|
17
|
-
commit()
|
|
18
|
-
destroy()
|
|
16
|
+
sync: (props: ObserveProps) => void;
|
|
17
|
+
commit: () => void;
|
|
18
|
+
destroy: () => void;
|
|
19
19
|
subscribe: {
|
|
20
20
|
(callback: OnBreakpointScreensCallback): () => void;
|
|
21
21
|
(breakpoints: Breakpoint[], callback: OnBreakpointChangeCallback): () => void;
|
|
@@ -81,10 +81,10 @@ var BreakpointObserver = class {
|
|
|
81
81
|
if (!breakpoints || breakpoints.includes(screen)) callback(screen, matches);
|
|
82
82
|
});
|
|
83
83
|
}
|
|
84
|
-
sync(props) {
|
|
84
|
+
sync = (props) => {
|
|
85
85
|
this.#props = props;
|
|
86
|
-
}
|
|
87
|
-
commit() {
|
|
86
|
+
};
|
|
87
|
+
commit = () => {
|
|
88
88
|
const prev = this.#committed;
|
|
89
89
|
const props = this.#props;
|
|
90
90
|
const prevScreens = this.#screens;
|
|
@@ -103,12 +103,12 @@ var BreakpointObserver = class {
|
|
|
103
103
|
for (const screen of changed) if (!breakpoints || breakpoints.includes(screen)) callback(screen, screens[screen]);
|
|
104
104
|
});
|
|
105
105
|
}
|
|
106
|
-
}
|
|
107
|
-
destroy() {
|
|
106
|
+
};
|
|
107
|
+
destroy = () => {
|
|
108
108
|
this.#unregister();
|
|
109
109
|
this.#screensListeners.clear();
|
|
110
110
|
this.#changeListeners.clear();
|
|
111
|
-
}
|
|
111
|
+
};
|
|
112
112
|
subscribe = (arg1, arg2) => {
|
|
113
113
|
if (typeof arg1 === "function") {
|
|
114
114
|
this.#screensListeners.add(arg1);
|
|
@@ -7,26 +7,10 @@ export interface BreakpointScreens {
|
|
|
7
7
|
xl: boolean;
|
|
8
8
|
xxl: boolean;
|
|
9
9
|
}
|
|
10
|
-
/**
|
|
11
|
-
* Subscribe callback: get all breakpoint matches
|
|
12
|
-
*/
|
|
13
10
|
export type OnBreakpointScreensCallback = (screens: BreakpointScreens) => void;
|
|
14
|
-
/**
|
|
15
|
-
* Subscribe callback: get single breakpoint change
|
|
16
|
-
*/
|
|
17
11
|
export type OnBreakpointChangeCallback = (screen: Breakpoint, match: boolean) => void;
|
|
18
12
|
export interface ResponsiveConfig {
|
|
19
|
-
/**
|
|
20
|
-
* Custom responsive map
|
|
21
|
-
*/
|
|
22
13
|
responsiveMap?: ResponsiveMap;
|
|
23
|
-
/**
|
|
24
|
-
* Subscribe to breakpoint changes. Returns an unsubscribe function.
|
|
25
|
-
*
|
|
26
|
-
* Overloads:
|
|
27
|
-
* - onBreakpoint(callback): callback receives full screens map
|
|
28
|
-
* - onBreakpoint(breakpoints, callback): callback receives (screen, match)
|
|
29
|
-
*/
|
|
30
14
|
onBreakpoint?: {
|
|
31
15
|
(callback: OnBreakpointScreensCallback): () => void;
|
|
32
16
|
(breakpoints: Breakpoint[], callback: OnBreakpointChangeCallback): () => void;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import BaseFoundation, { DefaultAdapter } from "../base/foundation.js";
|
|
2
|
-
/** The props the foundation and the adapter read */
|
|
3
2
|
export interface CropperFoundationProps {
|
|
4
3
|
src?: string;
|
|
5
4
|
aspectRatio?: number;
|
|
@@ -51,41 +50,41 @@ export interface CropperState {
|
|
|
51
50
|
}
|
|
52
51
|
export default class CropperFoundation extends BaseFoundation<CropperAdapter<CropperFoundationProps>, CropperFoundationProps, CropperState> {
|
|
53
52
|
#private;
|
|
54
|
-
handleCornerPointerMove: (e:
|
|
53
|
+
handleCornerPointerMove: (e: Pick<PointerEvent, "clientX" | "clientY" | "preventDefault">) => void;
|
|
55
54
|
/** Follows pointerup and pointercancel; also fires when the corner leaves the page mid-drag */
|
|
56
55
|
handleCornerLostPointerCapture: () => void;
|
|
57
|
-
handleCropperBoxPointerMove: ({ clientX, clientY }:
|
|
56
|
+
handleCropperBoxPointerMove: ({ clientX, clientY }: Pick<PointerEvent, "clientX" | "clientY">) => void;
|
|
58
57
|
handleCropperBoxLostPointerCapture: () => void;
|
|
59
|
-
handleMaskPointerMove: ({ clientX, clientY }:
|
|
58
|
+
handleMaskPointerMove: ({ clientX, clientY }: Pick<PointerEvent, "clientX" | "clientY">) => void;
|
|
60
59
|
handleMaskLostPointerCapture: () => void;
|
|
61
60
|
init(): void;
|
|
62
61
|
destroy(): void;
|
|
63
|
-
handleResize()
|
|
62
|
+
handleResize: () => void;
|
|
64
63
|
/**
|
|
65
64
|
* Refits the crop box to a changed `aspectRatio`: height stays, width follows, and a box too big for the
|
|
66
65
|
* container shrinks. It stays centered, moved only as far as the container edges require.
|
|
67
66
|
*/
|
|
68
|
-
applyAspectRatio()
|
|
69
|
-
handleImageLoad(
|
|
67
|
+
applyAspectRatio: () => void;
|
|
68
|
+
handleImageLoad: ({ target }: Pick<Event, "target">) => void;
|
|
70
69
|
/**
|
|
71
70
|
* Brings the state to the `rotate` and `zoom` props once the image has loaded; a controlled zoom also undoes
|
|
72
71
|
* wheel zooming the parent does not accept. Turns and scales around the cropper box center.
|
|
73
72
|
*/
|
|
74
|
-
syncRotateAndZoom({ rotate: newRotate, zoom: newZoom }?: {
|
|
73
|
+
syncRotateAndZoom: ({ rotate: newRotate, zoom: newZoom }?: {
|
|
75
74
|
rotate?: number;
|
|
76
75
|
zoom?: number;
|
|
77
|
-
})
|
|
78
|
-
handleWheel: (e:
|
|
79
|
-
updatePreview()
|
|
80
|
-
handleCornerPointerDown: (e:
|
|
81
|
-
handleCropperBoxPointerDown: (e:
|
|
76
|
+
}) => void;
|
|
77
|
+
handleWheel: (e: Pick<WheelEvent, "clientX" | "clientY" | "deltaY" | "preventDefault">) => void;
|
|
78
|
+
updatePreview: () => void;
|
|
79
|
+
handleCornerPointerDown: (e: Pick<PointerEvent, "button" | "currentTarget" | "pointerId" | "preventDefault">) => void;
|
|
80
|
+
handleCropperBoxPointerDown: (e: Pick<PointerEvent, "button" | "clientX" | "clientY" | "currentTarget" | "pointerId" | "target">) => void;
|
|
82
81
|
/**
|
|
83
82
|
* Moves the box with the arrow keys by KEYBOARD_STEP px; Shift moves the bottom right corner instead, through
|
|
84
83
|
* the drag path, so the box keeps to the container and the aspect ratio. Only with resize handles shown, as
|
|
85
84
|
* with a pointer.
|
|
86
85
|
*/
|
|
87
|
-
handleCropperBoxKeyDown: (e:
|
|
88
|
-
handleMaskPointerDown: (e:
|
|
89
|
-
getCropperCanvas()
|
|
86
|
+
handleCropperBoxKeyDown: (e: Pick<KeyboardEvent, "altKey" | "ctrlKey" | "key" | "metaKey" | "preventDefault" | "shiftKey">) => void;
|
|
87
|
+
handleMaskPointerDown: (e: Pick<PointerEvent, "button" | "clientX" | "clientY" | "currentTarget" | "pointerId" | "target">) => void;
|
|
88
|
+
getCropperCanvas: () => HTMLCanvasElement;
|
|
90
89
|
}
|
|
91
90
|
export {};
|
|
@@ -274,14 +274,14 @@ var CropperFoundation = class extends BaseFoundation {
|
|
|
274
274
|
}
|
|
275
275
|
}
|
|
276
276
|
#readContainerSize() {
|
|
277
|
-
const container = this.
|
|
277
|
+
const container = this.adapter.getContainer();
|
|
278
278
|
return {
|
|
279
279
|
width: container.clientWidth,
|
|
280
280
|
height: container.clientHeight
|
|
281
281
|
};
|
|
282
282
|
}
|
|
283
283
|
#toContainerPoint(clientX, clientY) {
|
|
284
|
-
const container = this.
|
|
284
|
+
const container = this.adapter.getContainer();
|
|
285
285
|
const rect = container.getBoundingClientRect();
|
|
286
286
|
return {
|
|
287
287
|
x: clientX - rect.left - container.clientLeft,
|
|
@@ -383,7 +383,6 @@ var CropperFoundation = class extends BaseFoundation {
|
|
|
383
383
|
else if (dir.includes("r")) dir = dir.replace("r", "l");
|
|
384
384
|
this.#resizeDir = dir;
|
|
385
385
|
}
|
|
386
|
-
/** `point` is in container coordinates */
|
|
387
386
|
#resizeCornerFree = (point) => {
|
|
388
387
|
const { cropperBox } = this.getStates();
|
|
389
388
|
const offsetX = clamp(point.x, ...this.#rangeX);
|
|
@@ -518,7 +517,7 @@ var CropperFoundation = class extends BaseFoundation {
|
|
|
518
517
|
destroy() {
|
|
519
518
|
this.#removePreview();
|
|
520
519
|
}
|
|
521
|
-
handleResize() {
|
|
520
|
+
handleResize = () => {
|
|
522
521
|
const { loaded } = this.getStates();
|
|
523
522
|
if (!loaded) return;
|
|
524
523
|
const newContainerData = this.#readContainerSize();
|
|
@@ -538,12 +537,12 @@ var CropperFoundation = class extends BaseFoundation {
|
|
|
538
537
|
imgData: newImgData,
|
|
539
538
|
cropperBox: newCropperBox
|
|
540
539
|
});
|
|
541
|
-
}
|
|
540
|
+
};
|
|
542
541
|
/**
|
|
543
542
|
* Refits the crop box to a changed `aspectRatio`: height stays, width follows, and a box too big for the
|
|
544
543
|
* container shrinks. It stays centered, moved only as far as the container edges require.
|
|
545
544
|
*/
|
|
546
|
-
applyAspectRatio() {
|
|
545
|
+
applyAspectRatio = () => {
|
|
547
546
|
const { aspectRatio } = this.getProps();
|
|
548
547
|
const { cropperBox, loaded } = this.getStates();
|
|
549
548
|
const { width: containerWidth, height: containerHeight } = this.#containerData;
|
|
@@ -566,20 +565,21 @@ var CropperFoundation = class extends BaseFoundation {
|
|
|
566
565
|
y: clamp(cropperBox.centerPoint.y, height / 2, containerHeight - height / 2)
|
|
567
566
|
}
|
|
568
567
|
} });
|
|
569
|
-
}
|
|
570
|
-
handleImageLoad(
|
|
571
|
-
|
|
568
|
+
};
|
|
569
|
+
handleImageLoad = ({ target }) => {
|
|
570
|
+
if (!(target instanceof HTMLImageElement)) return;
|
|
571
|
+
const { naturalWidth, naturalHeight } = target;
|
|
572
572
|
this.#containerData = this.#readContainerSize();
|
|
573
573
|
this.#imgData.originalWidth = naturalWidth;
|
|
574
574
|
this.#imgData.originalHeight = naturalHeight;
|
|
575
575
|
this.#layoutImage();
|
|
576
576
|
this.#renderPreview();
|
|
577
|
-
}
|
|
577
|
+
};
|
|
578
578
|
/**
|
|
579
579
|
* Brings the state to the `rotate` and `zoom` props once the image has loaded; a controlled zoom also undoes
|
|
580
580
|
* wheel zooming the parent does not accept. Turns and scales around the cropper box center.
|
|
581
581
|
*/
|
|
582
|
-
syncRotateAndZoom({ rotate: newRotate, zoom: newZoom } = this.getProps()) {
|
|
582
|
+
syncRotateAndZoom = ({ rotate: newRotate, zoom: newZoom } = this.getProps()) => {
|
|
583
583
|
const { rotate, zoom, imgData, cropperBox, loaded } = this.getStates();
|
|
584
584
|
const rotateChanged = newRotate !== void 0 && !Object.is(newRotate, rotate);
|
|
585
585
|
const zoomChanged = newZoom !== void 0 && !Object.is(newZoom, zoom);
|
|
@@ -620,7 +620,7 @@ var CropperFoundation = class extends BaseFoundation {
|
|
|
620
620
|
}
|
|
621
621
|
}
|
|
622
622
|
});
|
|
623
|
-
}
|
|
623
|
+
};
|
|
624
624
|
handleWheel = (e) => {
|
|
625
625
|
e.preventDefault();
|
|
626
626
|
if (!this.getStates().loaded) return;
|
|
@@ -650,9 +650,9 @@ var CropperFoundation = class extends BaseFoundation {
|
|
|
650
650
|
imgData: newImgDataState,
|
|
651
651
|
zoom: _zoom
|
|
652
652
|
});
|
|
653
|
-
this.
|
|
653
|
+
this.adapter.notifyZoomChange(_zoom);
|
|
654
654
|
};
|
|
655
|
-
updatePreview() {
|
|
655
|
+
updatePreview = () => {
|
|
656
656
|
if (!this.#previewImg) return;
|
|
657
657
|
const { cropperBox, imgData, rotate } = this.getStates();
|
|
658
658
|
const { width, height } = imgData;
|
|
@@ -682,18 +682,19 @@ var CropperFoundation = class extends BaseFoundation {
|
|
|
682
682
|
this.#previewImg.style.transformOrigin = "center";
|
|
683
683
|
this.#previewContainer.style.width = `${previewWidth}px`;
|
|
684
684
|
this.#previewContainer.style.height = `${previewHeight}px`;
|
|
685
|
-
}
|
|
685
|
+
};
|
|
686
686
|
handleCornerPointerDown = (e) => {
|
|
687
687
|
const currentTarget = e.currentTarget;
|
|
688
|
-
if (!currentTarget || isSecondaryPress(e)) return;
|
|
688
|
+
if (!(currentTarget instanceof HTMLElement) || isSecondaryPress(e)) return;
|
|
689
689
|
e.preventDefault();
|
|
690
690
|
currentTarget.setPointerCapture(e.pointerId);
|
|
691
691
|
this.#startCornerResize(currentTarget.dataset.dir);
|
|
692
692
|
};
|
|
693
693
|
handleCropperBoxPointerDown = (e) => {
|
|
694
|
-
if (e.target.dataset.dir) return;
|
|
695
|
-
|
|
696
|
-
|
|
694
|
+
if (e.target instanceof HTMLElement && e.target.dataset.dir) return;
|
|
695
|
+
const { currentTarget } = e;
|
|
696
|
+
if (!(currentTarget instanceof Element) || isSecondaryPress(e)) return;
|
|
697
|
+
currentTarget.setPointerCapture(e.pointerId);
|
|
697
698
|
this.#cropperBoxMoveStart = {
|
|
698
699
|
x: e.clientX,
|
|
699
700
|
y: e.clientY
|
|
@@ -725,20 +726,21 @@ var CropperFoundation = class extends BaseFoundation {
|
|
|
725
726
|
}
|
|
726
727
|
};
|
|
727
728
|
handleMaskPointerDown = (e) => {
|
|
728
|
-
|
|
729
|
-
e.
|
|
729
|
+
const { currentTarget } = e;
|
|
730
|
+
if (!(currentTarget instanceof Element) || currentTarget !== e.target || isSecondaryPress(e)) return;
|
|
731
|
+
currentTarget.setPointerCapture(e.pointerId);
|
|
730
732
|
this.#imgMoveStart = {
|
|
731
733
|
x: e.clientX,
|
|
732
734
|
y: e.clientY
|
|
733
735
|
};
|
|
734
736
|
};
|
|
735
|
-
getCropperCanvas() {
|
|
737
|
+
getCropperCanvas = () => {
|
|
736
738
|
if (!this.getStates().loaded) throw new Error("[Semi] Cropper: getCropperCanvas called before the image loaded");
|
|
737
739
|
const { cropperBox, imgData, rotate, zoom } = this.getStates();
|
|
738
740
|
const { fill } = this.getProps();
|
|
739
741
|
const canvas = document.createElement("canvas");
|
|
740
742
|
const ctx = canvas.getContext("2d");
|
|
741
|
-
const img = this.
|
|
743
|
+
const img = this.adapter.getImg();
|
|
742
744
|
const angle = rotate * Math.PI / 180;
|
|
743
745
|
const sine = Math.abs(Math.sin(angle));
|
|
744
746
|
const cosine = Math.abs(Math.cos(angle));
|
|
@@ -799,6 +801,6 @@ var CropperFoundation = class extends BaseFoundation {
|
|
|
799
801
|
const imgDataResult = ctx.getImageData(realLeft, realTop, realWidth, realHeight);
|
|
800
802
|
ctx2.putImageData(imgDataResult, relativeCropLeft < 0 ? -relativeCropLeft : 0, relativeCropTop < 0 ? -relativeCropTop : 0);
|
|
801
803
|
return canvas2;
|
|
802
|
-
}
|
|
804
|
+
};
|
|
803
805
|
};
|
|
804
806
|
export { CropperFoundation as default };
|
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
import { Locale } from "date-fns";
|
|
2
|
-
/**
|
|
3
|
-
* get left panel picker date and right panel picker date
|
|
4
|
-
*/
|
|
5
2
|
export default function getDefaultPickerDate({ defaultPickerValue, format, dateFnsLocale: Locale }: GetDefaultPickerValueDateOptions): {
|
|
6
3
|
nowDate: Date;
|
|
7
4
|
nextDate: Date;
|
|
@@ -4,9 +4,6 @@ import isTimestamp from "./is-timestamp.js";
|
|
|
4
4
|
import { compatibleParse } from "./parser.js";
|
|
5
5
|
import { addMonths } from "date-fns";
|
|
6
6
|
// src/date-picker/_utils/get-default-picker-date.ts
|
|
7
|
-
/**
|
|
8
|
-
* get left panel picker date and right panel picker date
|
|
9
|
-
*/
|
|
10
7
|
function getDefaultPickerDate({ defaultPickerValue, format, dateFnsLocale }) {
|
|
11
8
|
let nowDate = Array.isArray(defaultPickerValue) ? defaultPickerValue[0] : defaultPickerValue;
|
|
12
9
|
let nextDate = Array.isArray(defaultPickerValue) ? defaultPickerValue[1] : void 0;
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { getDefaultFormatTokenByType } from "./get-default-format-token.js";
|
|
2
2
|
// src/date-picker/_utils/get-inset-input-format-token.ts
|
|
3
3
|
/**
|
|
4
|
-
* Get the placeholder of the insetInput input
|
|
5
|
-
*
|
|
6
4
|
* If type is time related, we only recognize the format like `dateFormat timeFormat`
|
|
7
5
|
* - 'yyyy-MM-dd HH:mm:ss' // ok
|
|
8
6
|
* - 'yyyy-MM-dd HH:mm:ss' // bad format
|
|
@@ -1,12 +1,5 @@
|
|
|
1
1
|
import { isValid, parse, parseISO } from "date-fns";
|
|
2
2
|
// src/date-picker/_utils/parser.ts
|
|
3
|
-
/**
|
|
4
|
-
* @file
|
|
5
|
-
* Various date-related analysis methods
|
|
6
|
-
*/
|
|
7
|
-
/**
|
|
8
|
-
* Parsing value to Date object
|
|
9
|
-
*/
|
|
10
3
|
function compatibleParse(value, formatToken, baseDate, locale) {
|
|
11
4
|
let result = null;
|
|
12
5
|
if (value) {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Type } from "../input-foundation.js";
|
|
2
|
-
/** dateRange, dateTimeRange and monthRange select a start and an end */
|
|
3
2
|
export declare function isRangeType(type?: Type): boolean;
|
|
4
3
|
/** `multiple` applies to the date type only; the other types ignore it */
|
|
5
4
|
export declare function isMultiple({ type, multiple }: {
|
|
@@ -12,8 +11,7 @@ export declare function needConfirm({ type, needConfirm: confirm }: {
|
|
|
12
11
|
type?: Type;
|
|
13
12
|
needConfirm?: boolean;
|
|
14
13
|
}): boolean;
|
|
15
|
-
|
|
16
|
-
export declare function isYearOrMonthType(type?: Type): type is "year" | "month" | "monthRange";
|
|
14
|
+
export declare function isYearOrMonthType(type?: Type): type is "month" | "year" | "monthRange";
|
|
17
15
|
/** monthRange shows its range in one trigger input; the other range types split it into a start and an end input */
|
|
18
16
|
export declare function isSplitRangeInputs(type?: Type): boolean;
|
|
19
17
|
/** An empty range (cleared) or one with two valid dates; a half-picked range is neither committed nor confirmed */
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import isValidDate from "./is-valid-date.js";
|
|
2
2
|
// src/date-picker/_utils/picker-type.ts
|
|
3
|
-
/** dateRange, dateTimeRange and monthRange select a start and an end */
|
|
4
3
|
function isRangeType(type) {
|
|
5
4
|
return typeof type === "string" && type.endsWith("Range");
|
|
6
5
|
}
|
|
@@ -15,7 +14,6 @@ function isDateTimeType(type) {
|
|
|
15
14
|
function needConfirm({ type, needConfirm: confirm }) {
|
|
16
15
|
return isDateTimeType(type) && confirm === true;
|
|
17
16
|
}
|
|
18
|
-
/** These types pick in the year and month panel instead of the day grid */
|
|
19
17
|
function isYearOrMonthType(type) {
|
|
20
18
|
return type === "year" || type === "month" || type === "monthRange";
|
|
21
19
|
}
|
|
@@ -5,7 +5,6 @@ import { Type } from "../input-foundation.js";
|
|
|
5
5
|
* zonedTimeToUtc(a, "+09:00") turns it into 21:00 (+8), i.e. 22:00 in +9.
|
|
6
6
|
*/
|
|
7
7
|
export declare function toCallbackDates(value: Date | Date[], timeZone?: string | number): Date[];
|
|
8
|
-
/** Builds the date and string arguments of the callbacks, with the dates converted by `toCallbackDates` */
|
|
9
8
|
export default function toCallbackArgs(value: Date | Date[], options: {
|
|
10
9
|
type?: Type;
|
|
11
10
|
format?: string;
|
|
@@ -13,7 +13,6 @@ function toCallbackDates(value, timeZone) {
|
|
|
13
13
|
const dates = Array.isArray(value) ? value : value && [value] || [];
|
|
14
14
|
return isValidTimeZone(timeZone) ? dates.map((date) => zonedTimeToUtc(date, timeZone)) : dates;
|
|
15
15
|
}
|
|
16
|
-
/** Builds the date and string arguments of the callbacks, with the dates converted by `toCallbackDates` */
|
|
17
16
|
function toCallbackArgs(value, options) {
|
|
18
17
|
const { type, format: format$1, timeZone, dateFnsLocale } = options;
|
|
19
18
|
const dates = toCallbackDates(value, timeZone);
|
|
@@ -94,7 +94,6 @@ $module-list: #{$prefix}-scrolllist;
|
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
-
// With a left or right preset panel and no inset input, the month panel gets a fixed height
|
|
98
97
|
&[x-preset-position='left'][x-insetinput='false'],
|
|
99
98
|
&[x-preset-position='right'][x-insetinput='false'] {
|
|
100
99
|
.#{$module}-month {
|
|
@@ -1229,7 +1228,6 @@ $module-list: #{$prefix}-scrolllist;
|
|
|
1229
1228
|
}
|
|
1230
1229
|
}
|
|
1231
1230
|
|
|
1232
|
-
// Keeps the year/month ScrollList from scrolling when the number of weeks changes the height
|
|
1233
1231
|
&[x-panel-yearandmonth-open-type='left'],
|
|
1234
1232
|
&[x-panel-yearandmonth-open-type='right'] {
|
|
1235
1233
|
.#{$module}-weeks {
|
|
@@ -1604,7 +1602,6 @@ $module-list: #{$prefix}-scrolllist;
|
|
|
1604
1602
|
|
|
1605
1603
|
&-dateTimeRange {
|
|
1606
1604
|
width: max-content;
|
|
1607
|
-
// Capped at the viewport limit so min-width never exceeds max-width (forced overflow)
|
|
1608
1605
|
min-width: min(#{$width-datepicker_panel_compact * 2}, #{$compact-max-width});
|
|
1609
1606
|
max-width: $compact-max-width;
|
|
1610
1607
|
|