@jetbrains/ring-ui-built 7.0.125 → 8.0.0-beta.11
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/components/_helpers/anchor.js +1 -1
- package/components/_helpers/avatar-info.js +3 -5
- package/components/_helpers/caption.js +1 -1
- package/components/_helpers/dialog.js +3 -0
- package/components/_helpers/icon-svg.js +37 -52
- package/components/_helpers/legacy-table.js +3 -0
- package/components/_helpers/tab-link.js +1 -1
- package/components/_helpers/table.js +2 -2
- package/components/_helpers/theme.js +49 -37
- package/components/alert/alert-actions.js +1 -1
- package/components/alert/alert-heading.js +1 -1
- package/components/alert/alert.js +2 -2
- package/components/alert-service/alert-service.js +2 -2
- package/components/auth/auth-core.js +2 -2
- package/components/auth/auth.js +2 -2
- package/components/auth/down-notification.js +2 -2
- package/components/auth/iframe-flow.js +15 -10
- package/components/auth/storage.js +2 -2
- package/components/auth-dialog/auth-dialog.js +11 -6
- package/components/auth-dialog-service/auth-dialog-service.js +19 -11
- package/components/avatar/avatar-info.js +1 -1
- package/components/avatar/avatar-size.d.ts +0 -4
- package/components/avatar/avatar-size.js +0 -4
- package/components/avatar/avatar.js +1 -8
- package/components/avatar/fallback-avatar.js +3 -48
- package/components/avatar-stack/avatar-stack.js +5 -5
- package/components/banner/banner.js +5 -6
- package/components/button/button.d.ts +0 -4
- package/components/button/button.js +4 -10
- package/components/button-group/button-group.js +1 -1
- package/components/button-toolbar/button-toolbar.js +1 -1
- package/components/checkbox/checkbox.d.ts +1 -1
- package/components/checkbox/checkbox.js +1 -2
- package/components/clipboard/clipboard.js +2 -2
- package/components/code/code.js +1 -2
- package/components/collapse/collapse-content.js +35 -43
- package/components/collapse/collapse-context.d.ts +1 -0
- package/components/collapse/collapse-context.js +1 -0
- package/components/collapse/collapse-control.js +5 -5
- package/components/collapse/collapse.js +34 -25
- package/components/collapsible-group/collapsible-group.d.ts +5 -1
- package/components/collapsible-group/collapsible-group.js +80 -98
- package/components/components/util-stories.js +63 -1
- package/components/confirm/confirm.js +30 -21
- package/components/confirm-service/confirm-service.js +21 -13
- package/components/contenteditable/contenteditable.js +4 -5
- package/components/control-help/control-help.js +1 -1
- package/components/control-label/control-label.js +1 -1
- package/components/data-list/data-list.d.ts +4 -4
- package/components/data-list/data-list.js +5 -5
- package/components/data-list/data-list.mock.d.ts +1 -1
- package/components/data-list/data-list.mock.js +2 -2
- package/components/data-list/item.d.ts +1 -1
- package/components/data-list/item.js +3 -3
- package/components/data-list/selection.d.ts +1 -1
- package/components/data-list/selection.js +2 -2
- package/components/data-list/title.js +1 -2
- package/components/date-picker/date-input.js +2 -2
- package/components/date-picker/date-picker.js +2 -3
- package/components/date-picker/date-popup.js +4 -5
- package/components/date-picker/month-names.js +1 -1
- package/components/date-picker/month-slider.js +1 -1
- package/components/date-picker/month.d.ts +0 -2
- package/components/date-picker/month.js +17 -18
- package/components/date-picker/months.js +43 -36
- package/components/date-picker/use-scroll-behavior.js +45 -45
- package/components/date-picker/weekdays.js +1 -1
- package/components/date-picker/years.js +61 -55
- package/components/dialog/dialog-body-scroll-preventer.js +49 -2
- package/components/dialog/dialog-controls.d.ts +13 -0
- package/components/dialog/dialog-controls.js +113 -0
- package/components/dialog/dialog-geometry.d.ts +31 -0
- package/components/dialog/dialog-geometry.js +63 -0
- package/components/dialog/dialog.d.ts +15 -7
- package/components/dialog/dialog.js +185 -37
- package/components/dropdown/anchor.js +3 -3
- package/components/dropdown/dropdown.js +3 -3
- package/components/dropdown-menu/dropdown-menu.d.ts +4 -4
- package/components/dropdown-menu/dropdown-menu.js +63 -58
- package/components/editable-heading/editable-heading.d.ts +1 -2
- package/components/editable-heading/editable-heading.js +14 -13
- package/components/error-bubble/error-bubble.js +1 -1
- package/components/error-message/error-message.js +1 -2
- package/components/footer/footer.js +1 -1
- package/components/global/compose-refs.d.ts +2 -1
- package/components/global/compose-refs.js +44 -8
- package/components/global/configuration.d.ts +0 -5
- package/components/global/configuration.js +2 -10
- package/components/global/controls-height.js +1 -1
- package/components/global/create-stateful-context.js +11 -11
- package/components/global/focus-sensor-hoc.js +1 -0
- package/components/global/focus-with-temporary-tabindex.d.ts +11 -0
- package/components/global/focus-with-temporary-tabindex.js +23 -0
- package/components/global/get-viewport-size.d.ts +5 -0
- package/components/global/get-viewport-size.js +6 -0
- package/components/global/intersection-observer-context.d.ts +46 -0
- package/components/global/intersection-observer-context.js +138 -0
- package/components/global/is-within-interactive-element.d.ts +6 -0
- package/components/global/is-within-interactive-element.js +11 -0
- package/components/global/is-within-navigable-element.d.ts +6 -0
- package/components/global/is-within-navigable-element.js +11 -0
- package/components/global/parse-css-duration.d.ts +5 -0
- package/components/global/parse-css-duration.js +14 -0
- package/components/global/rerender-hoc.d.ts +4 -2
- package/components/global/rerender-hoc.js +11 -24
- package/components/global/schedule-with-cleanup.d.ts +12 -0
- package/components/global/schedule-with-cleanup.js +36 -0
- package/components/{table/selection.d.ts → global/table-selection.d.ts} +15 -15
- package/components/{table/selection.js → global/table-selection.js} +5 -5
- package/components/global/theme.d.ts +4 -3
- package/components/global/theme.js +1 -1
- package/components/global/variables.interface.d.ts +0 -4
- package/components/header/header-icon.js +3 -3
- package/components/header/header.js +3 -3
- package/components/header/links.js +1 -1
- package/components/header/logo.js +1 -2
- package/components/header/profile.js +5 -5
- package/components/header/services.js +3 -3
- package/components/header/smart-profile.js +3 -3
- package/components/header/smart-services.js +3 -3
- package/components/heading/heading.js +1 -1
- package/components/http/http.js +6 -23
- package/components/i18n/i18n-context.js +4 -4
- package/components/icon/icon-svg.js +1 -2
- package/components/icon/icon.d.ts +0 -1
- package/components/icon/icon.js +2 -6
- package/components/icon/index.js +1 -2
- package/components/input/input.d.ts +1 -1
- package/components/input/input.js +3 -3
- package/components/internal/reorder-animation-context.js +159 -0
- package/components/internal/reorder-handle.js +750 -0
- package/components/internal/reorder-layout-context.js +141 -0
- package/components/internal/table-header.js +685 -0
- package/components/internal/virtualization.js +368 -0
- package/components/island/adaptive-island-hoc.js +3 -3
- package/components/island/content.d.ts +7 -2
- package/components/island/content.js +27 -18
- package/components/island/header.js +4 -3
- package/components/island/island.js +1 -1
- package/components/{table → legacy-table}/cell.js +1 -1
- package/components/{table → legacy-table}/header-cell.js +2 -3
- package/components/{table → legacy-table}/header.js +2 -3
- package/components/{table → legacy-table}/multitable.d.ts +1 -1
- package/components/{table → legacy-table}/row-with-focus-sensor.js +3 -3
- package/components/{table → legacy-table}/row.d.ts +1 -1
- package/components/{table → legacy-table}/row.js +5 -5
- package/components/legacy-table/selection-adapter.d.ts +6 -0
- package/components/{table → legacy-table}/selection-shortcuts-hoc.d.ts +5 -5
- package/components/{table → legacy-table}/simple-table.d.ts +2 -2
- package/components/{table → legacy-table}/simple-table.js +5 -5
- package/components/{table → legacy-table}/smart-table.d.ts +5 -5
- package/components/{table → legacy-table}/smart-table.js +6 -6
- package/components/legacy-table/table.d.ts +109 -0
- package/components/legacy-table/table.js +369 -0
- package/components/list/consts.d.ts +0 -1
- package/components/list/consts.js +0 -1
- package/components/list/list-item.js +3 -5
- package/components/list/list-users-groups-source.js +1 -2
- package/components/list/list.d.ts +0 -4
- package/components/list/list.js +1 -2
- package/components/login-dialog/login-dialog.js +17 -12
- package/components/login-dialog/service.js +19 -11
- package/components/message/message.js +1 -1
- package/components/pager/pager.js +3 -3
- package/components/popup/popup.js +1 -1
- package/components/popup/popup.target.d.ts +3 -2
- package/components/popup/popup.target.js +32 -28
- package/components/popup-menu/popup-menu.js +1 -1
- package/components/query-assist/query-assist-suggestions.js +1 -2
- package/components/query-assist/query-assist.d.ts +3 -1
- package/components/query-assist/query-assist.js +2 -2
- package/components/radio/radio-item.d.ts +3 -3
- package/components/radio/radio-item.js +33 -19
- package/components/radio/radio.d.ts +2 -2
- package/components/radio/radio.js +2 -2
- package/components/scrollable-section/scrollable-section.js +1 -1
- package/components/select/chevron-button.js +3 -3
- package/components/select/select-filter.js +3 -3
- package/components/select/select-popup.d.ts +3 -2
- package/components/select/select-popup.js +9 -4
- package/components/select/select.d.ts +6 -2
- package/components/select/select.js +5 -4
- package/components/selection-toolbar/selection-toolbar.d.ts +11 -0
- package/components/selection-toolbar/selection-toolbar.js +200 -0
- package/components/slider/slider.js +100 -97
- package/components/storage/storage-local.js +2 -2
- package/components/storage/storage.js +2 -2
- package/components/style.css +1 -1
- package/components/tab-trap/tab-trap.d.ts +3 -3
- package/components/tab-trap/tab-trap.js +83 -80
- package/components/table/default-item-renderer.d.ts +55 -0
- package/components/table/default-item-renderer.js +240 -0
- package/components/table/internal/reorder-animation-context.d.ts +21 -0
- package/components/table/internal/reorder-handle.d.ts +9 -0
- package/components/table/internal/reorder-layout-context.d.ts +16 -0
- package/components/table/internal/table-header.d.ts +1 -0
- package/components/table/internal/virtualization.d.ts +41 -0
- package/components/table/item-virtualization.d.ts +37 -0
- package/components/table/item-virtualization.js +73 -0
- package/components/table/reorder-animation.d.ts +37 -0
- package/components/table/reorder-animation.js +18 -0
- package/components/table/reorder-item-layout.d.ts +32 -0
- package/components/table/reorder-item-layout.js +57 -0
- package/components/table/table-const.d.ts +10 -0
- package/components/table/table-const.js +13 -0
- package/components/table/table-primitives.d.ts +64 -0
- package/components/table/table-primitives.js +180 -0
- package/components/table/table-props.d.ts +304 -0
- package/components/table/table-props.js +1 -0
- package/components/table/table.d.ts +231 -107
- package/components/table/table.js +351 -346
- package/components/tabs/collapsible-more.js +1 -1
- package/components/tabs/collapsible-tab.js +1 -1
- package/components/tabs/collapsible-tabs.js +1 -1
- package/components/tabs/dumb-tabs.js +1 -1
- package/components/tabs/smart-tabs.js +1 -1
- package/components/tabs/tab-link.js +1 -1
- package/components/tabs/tabs.js +1 -1
- package/components/tag/tag.js +1 -1
- package/components/tags-input/tags-input.d.ts +3 -1
- package/components/tags-input/tags-input.js +4 -4
- package/components/tags-list/tags-list.js +2 -2
- package/components/toggle/toggle.js +1 -1
- package/components/tooltip/tooltip.d.ts +2 -1
- package/components/tooltip/tooltip.js +5 -3
- package/components/upload/upload.d.ts +4 -3
- package/components/upload/upload.js +7 -30
- package/components/user-agreement/service.js +12 -4
- package/components/user-agreement/user-agreement.js +24 -20
- package/components/user-card/card.js +4 -4
- package/components/user-card/smart-user-card-tooltip.js +3 -3
- package/components/user-card/tooltip.js +3 -3
- package/components/user-card/user-card.js +5 -5
- package/components/util-stories.d.ts +26 -0
- package/package.json +11 -12
- package/components/__mocks__/old-browsers-message.js +0 -3
- package/components/_helpers/dialog-body-scroll-preventer.js +0 -50
- package/components/_helpers/grid.js +0 -3
- package/components/_helpers/sidebar.js +0 -110
- package/components/content-layout/content-layout.d.ts +0 -20
- package/components/content-layout/content-layout.js +0 -50
- package/components/content-layout/sidebar.d.ts +0 -26
- package/components/content-layout/sidebar.js +0 -5
- package/components/date-picker/use-intersection-observer.d.ts +0 -6
- package/components/date-picker/use-intersection-observer.js +0 -93
- package/components/expand/collapsible-group.d.ts +0 -8
- package/components/expand/collapsible-group.js +0 -52
- package/components/global/composeRefs.d.ts +0 -6
- package/components/global/composeRefs.js +0 -9
- package/components/global/use-event-callback.d.ts +0 -4
- package/components/global/use-event-callback.js +0 -49
- package/components/grid/col.d.ts +0 -16
- package/components/grid/col.js +0 -63
- package/components/grid/grid.d.ts +0 -13
- package/components/grid/grid.js +0 -27
- package/components/grid/row.d.ts +0 -21
- package/components/grid/row.js +0 -72
- package/components/old-browsers-message/old-browsers-message-stop.d.ts +0 -1
- package/components/old-browsers-message/old-browsers-message-stop.js +0 -5
- package/components/old-browsers-message/old-browsers-message.d.ts +0 -5
- package/components/old-browsers-message/old-browsers-message.js +0 -89
- package/components/old-browsers-message/white-list.d.ts +0 -2
- package/components/old-browsers-message/white-list.js +0 -30
- package/components/table/selection-adapter.d.ts +0 -6
- /package/components/{table → legacy-table}/cell.d.ts +0 -0
- /package/components/{table → legacy-table}/disable-hover-hoc.d.ts +0 -0
- /package/components/{table → legacy-table}/disable-hover-hoc.js +0 -0
- /package/components/{table → legacy-table}/header-cell.d.ts +0 -0
- /package/components/{table → legacy-table}/header.d.ts +0 -0
- /package/components/{table → legacy-table}/multitable.js +0 -0
- /package/components/{table → legacy-table}/row-with-focus-sensor.d.ts +0 -0
- /package/components/{table → legacy-table}/selection-adapter.js +0 -0
- /package/components/{table → legacy-table}/selection-shortcuts-hoc.js +0 -0
|
@@ -1,20 +1,18 @@
|
|
|
1
|
-
import { c } from 'react
|
|
2
|
-
import { useState, useRef, useEffect, useLayoutEffect } from 'react';
|
|
1
|
+
import { c } from 'react/compiler-runtime';
|
|
2
|
+
import { useState, useRef, useEffectEvent, useEffect, useLayoutEffect } from 'react';
|
|
3
3
|
import units, { isSafariOnIPhone, scrollerReRenderDelayIPhone } from './consts.js';
|
|
4
|
-
import useEventCallback from '../global/use-event-callback.js';
|
|
5
4
|
import 'date-fns/add';
|
|
6
5
|
import 'date-fns';
|
|
7
6
|
import '../global/sniffer.js';
|
|
8
7
|
import 'sniffr';
|
|
9
|
-
import 'util-deprecate';
|
|
10
8
|
|
|
11
9
|
function useScrollBehavior(scrollDate, onContainerScroll, locale, selfScrollDateSource, arith, scheduleScroll) {
|
|
12
|
-
const $ = c(
|
|
13
|
-
if ($[0] !== "
|
|
14
|
-
for (let $i = 0; $i <
|
|
10
|
+
const $ = c(38);
|
|
11
|
+
if ($[0] !== "a3a62d0eaf68edc8b0ddbd21981a78487012d4433139cd433e355b8f989ab2de") {
|
|
12
|
+
for (let $i = 0; $i < 38; $i += 1) {
|
|
15
13
|
$[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
16
14
|
}
|
|
17
|
-
$[0] = "
|
|
15
|
+
$[0] = "a3a62d0eaf68edc8b0ddbd21981a78487012d4433139cd433e355b8f989ab2de";
|
|
18
16
|
}
|
|
19
17
|
let t0;
|
|
20
18
|
if ($[1] !== arith || $[2] !== scrollDate.date) {
|
|
@@ -61,7 +59,7 @@ function useScrollBehavior(scrollDate, onContainerScroll, locale, selfScrollDate
|
|
|
61
59
|
} else {
|
|
62
60
|
t2 = $[12];
|
|
63
61
|
}
|
|
64
|
-
const syncSelfState =
|
|
62
|
+
const syncSelfState = useEffectEvent(t2);
|
|
65
63
|
const didMountRef = useRef(false);
|
|
66
64
|
let t3;
|
|
67
65
|
if ($[13] !== scrollDate.date || $[14] !== scrollDate.source || $[15] !== selfScrollDateSource || $[16] !== syncSelfState) {
|
|
@@ -88,19 +86,18 @@ function useScrollBehavior(scrollDate, onContainerScroll, locale, selfScrollDate
|
|
|
88
86
|
t3 = $[17];
|
|
89
87
|
}
|
|
90
88
|
let t4;
|
|
91
|
-
if ($[18] !== scrollDate || $[19] !== selfScrollDateSource
|
|
92
|
-
t4 = [scrollDate, selfScrollDateSource
|
|
89
|
+
if ($[18] !== scrollDate || $[19] !== selfScrollDateSource) {
|
|
90
|
+
t4 = [scrollDate, selfScrollDateSource];
|
|
93
91
|
$[18] = scrollDate;
|
|
94
92
|
$[19] = selfScrollDateSource;
|
|
95
|
-
$[20] =
|
|
96
|
-
$[21] = t4;
|
|
93
|
+
$[20] = t4;
|
|
97
94
|
} else {
|
|
98
|
-
t4 = $[
|
|
95
|
+
t4 = $[20];
|
|
99
96
|
}
|
|
100
97
|
useEffect(t3, t4);
|
|
101
98
|
const ignoreNextScrollEventRef = useRef(true);
|
|
102
99
|
let t5;
|
|
103
|
-
if ($[
|
|
100
|
+
if ($[21] !== scrollTop) {
|
|
104
101
|
t5 = function setContainerScrollFromState() {
|
|
105
102
|
const container_0 = containerRef.current;
|
|
106
103
|
if (!container_0) {
|
|
@@ -109,24 +106,24 @@ function useScrollBehavior(scrollDate, onContainerScroll, locale, selfScrollDate
|
|
|
109
106
|
ignoreNextScrollEventRef.current = true;
|
|
110
107
|
container_0.scrollTop = scrollTop;
|
|
111
108
|
};
|
|
112
|
-
$[
|
|
113
|
-
$[
|
|
109
|
+
$[21] = scrollTop;
|
|
110
|
+
$[22] = t5;
|
|
114
111
|
} else {
|
|
115
|
-
t5 = $[
|
|
112
|
+
t5 = $[22];
|
|
116
113
|
}
|
|
117
114
|
let t6;
|
|
118
|
-
if ($[
|
|
115
|
+
if ($[23] !== items || $[24] !== scrollTop) {
|
|
119
116
|
t6 = [items, scrollTop];
|
|
120
|
-
$[
|
|
121
|
-
$[
|
|
122
|
-
$[
|
|
117
|
+
$[23] = items;
|
|
118
|
+
$[24] = scrollTop;
|
|
119
|
+
$[25] = t6;
|
|
123
120
|
} else {
|
|
124
|
-
t6 = $[
|
|
121
|
+
t6 = $[25];
|
|
125
122
|
}
|
|
126
123
|
useLayoutEffect(t5, t6);
|
|
127
124
|
const updateStateTimerRef = useRef(null);
|
|
128
125
|
let t7;
|
|
129
|
-
if ($[
|
|
126
|
+
if ($[26] !== arith || $[27] !== items || $[28] !== locale || $[29] !== onContainerScroll || $[30] !== scheduleScroll || $[31] !== selfScrollDateSource) {
|
|
130
127
|
t7 = () => {
|
|
131
128
|
scheduleScroll(() => {
|
|
132
129
|
if (updateStateTimerRef.current != null) {
|
|
@@ -165,20 +162,19 @@ function useScrollBehavior(scrollDate, onContainerScroll, locale, selfScrollDate
|
|
|
165
162
|
}
|
|
166
163
|
});
|
|
167
164
|
};
|
|
168
|
-
$[
|
|
169
|
-
$[
|
|
170
|
-
$[
|
|
171
|
-
$[
|
|
172
|
-
$[
|
|
173
|
-
$[
|
|
174
|
-
$[
|
|
165
|
+
$[26] = arith;
|
|
166
|
+
$[27] = items;
|
|
167
|
+
$[28] = locale;
|
|
168
|
+
$[29] = onContainerScroll;
|
|
169
|
+
$[30] = scheduleScroll;
|
|
170
|
+
$[31] = selfScrollDateSource;
|
|
171
|
+
$[32] = t7;
|
|
175
172
|
} else {
|
|
176
|
-
t7 = $[
|
|
173
|
+
t7 = $[32];
|
|
177
174
|
}
|
|
178
|
-
const handleScroll =
|
|
175
|
+
const handleScroll = useEffectEvent(t7);
|
|
179
176
|
let t8;
|
|
180
|
-
|
|
181
|
-
if ($[34] !== handleScroll) {
|
|
177
|
+
if ($[33] !== handleScroll) {
|
|
182
178
|
t8 = () => {
|
|
183
179
|
const container_2 = containerRef.current;
|
|
184
180
|
if (!container_2) {
|
|
@@ -193,25 +189,29 @@ function useScrollBehavior(scrollDate, onContainerScroll, locale, selfScrollDate
|
|
|
193
189
|
}
|
|
194
190
|
};
|
|
195
191
|
};
|
|
196
|
-
|
|
197
|
-
$[34] =
|
|
198
|
-
|
|
199
|
-
$[
|
|
192
|
+
$[33] = handleScroll;
|
|
193
|
+
$[34] = t8;
|
|
194
|
+
} else {
|
|
195
|
+
t8 = $[34];
|
|
196
|
+
}
|
|
197
|
+
let t9;
|
|
198
|
+
if ($[35] === Symbol.for("react.memo_cache_sentinel")) {
|
|
199
|
+
t9 = [];
|
|
200
|
+
$[35] = t9;
|
|
200
201
|
} else {
|
|
201
|
-
|
|
202
|
-
t9 = $[36];
|
|
202
|
+
t9 = $[35];
|
|
203
203
|
}
|
|
204
204
|
useEffect(t8, t9);
|
|
205
205
|
let t10;
|
|
206
|
-
if ($[
|
|
206
|
+
if ($[36] !== items) {
|
|
207
207
|
t10 = {
|
|
208
208
|
containerRef,
|
|
209
209
|
items
|
|
210
210
|
};
|
|
211
|
-
$[
|
|
212
|
-
$[
|
|
211
|
+
$[36] = items;
|
|
212
|
+
$[37] = t10;
|
|
213
213
|
} else {
|
|
214
|
-
t10 = $[
|
|
214
|
+
t10 = $[37];
|
|
215
215
|
}
|
|
216
216
|
return t10;
|
|
217
217
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c } from 'react
|
|
1
|
+
import { c } from 'react/compiler-runtime';
|
|
2
2
|
import { useState, useRef, useEffect } from 'react';
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
import { addYears } from 'date-fns/addYears';
|
|
@@ -13,15 +13,13 @@ import { ScrollArith } from './scroll-arith.js';
|
|
|
13
13
|
import { useScrollBehavior } from './use-scroll-behavior.js';
|
|
14
14
|
import { animateDate } from './animate-date.js';
|
|
15
15
|
import scheduleRAF from '../global/schedule-raf.js';
|
|
16
|
-
import {
|
|
16
|
+
import { useIntersectionObserverHandle, IntersectionObserverContext, useIsIntersecting } from '../global/intersection-observer-context.js';
|
|
17
17
|
import { s as styles } from '../_helpers/date-picker.js';
|
|
18
18
|
import { jsx } from 'react/jsx-runtime';
|
|
19
19
|
import 'date-fns/add';
|
|
20
20
|
import 'date-fns';
|
|
21
21
|
import '../global/sniffer.js';
|
|
22
22
|
import 'sniffr';
|
|
23
|
-
import '../global/use-event-callback.js';
|
|
24
|
-
import 'util-deprecate';
|
|
25
23
|
|
|
26
24
|
const {
|
|
27
25
|
yearHeight
|
|
@@ -36,14 +34,14 @@ const scheduleScroll = scheduleRAF();
|
|
|
36
34
|
/**
|
|
37
35
|
* Reduces "empty" years during fast scrolling.
|
|
38
36
|
*/
|
|
39
|
-
const
|
|
37
|
+
const intersectionObserverRootMargin = units.calHeight / 2;
|
|
40
38
|
function Years(t0) {
|
|
41
|
-
const $ = c(
|
|
42
|
-
if ($[0] !== "
|
|
43
|
-
for (let $i = 0; $i <
|
|
39
|
+
const $ = c(25);
|
|
40
|
+
if ($[0] !== "d83f39ae52d8a31382391108984551694ebcf0097c6e55663ca967ea74179702") {
|
|
41
|
+
for (let $i = 0; $i < 25; $i += 1) {
|
|
44
42
|
$[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
45
43
|
}
|
|
46
|
-
$[0] = "
|
|
44
|
+
$[0] = "d83f39ae52d8a31382391108984551694ebcf0097c6e55663ca967ea74179702";
|
|
47
45
|
}
|
|
48
46
|
const {
|
|
49
47
|
scrollDate,
|
|
@@ -154,81 +152,89 @@ function Years(t0) {
|
|
|
154
152
|
containerRef,
|
|
155
153
|
items
|
|
156
154
|
} = useScrollBehavior(localScrollDate, syncCalendarScrollDate, undefined, "yearsScroll", scrollArith, scheduleScroll);
|
|
157
|
-
const
|
|
158
|
-
let
|
|
159
|
-
if ($[12] !== handleYearClick || $[13] !==
|
|
160
|
-
let
|
|
161
|
-
if ($[
|
|
162
|
-
|
|
155
|
+
const t7 = useIntersectionObserverHandle(containerRef, intersectionObserverRootMargin);
|
|
156
|
+
let t8;
|
|
157
|
+
if ($[12] !== handleYearClick || $[13] !== items || $[14] !== localScrollDate.date) {
|
|
158
|
+
let t9;
|
|
159
|
+
if ($[16] !== handleYearClick || $[17] !== localScrollDate.date) {
|
|
160
|
+
t9 = year_0 => /*#__PURE__*/jsx(Year, {
|
|
163
161
|
year: year_0,
|
|
164
162
|
scrollDate: localScrollDate.date,
|
|
165
|
-
handleYearClick: handleYearClick
|
|
166
|
-
intersectionObserverHandle: intersectionObserverHandle
|
|
163
|
+
handleYearClick: handleYearClick
|
|
167
164
|
}, +year_0);
|
|
168
|
-
$[
|
|
169
|
-
$[
|
|
170
|
-
$[
|
|
171
|
-
$[20] = t8;
|
|
165
|
+
$[16] = handleYearClick;
|
|
166
|
+
$[17] = localScrollDate.date;
|
|
167
|
+
$[18] = t9;
|
|
172
168
|
} else {
|
|
173
|
-
|
|
169
|
+
t9 = $[18];
|
|
174
170
|
}
|
|
175
|
-
|
|
171
|
+
t8 = items.map(t9);
|
|
176
172
|
$[12] = handleYearClick;
|
|
177
|
-
$[13] =
|
|
178
|
-
$[14] =
|
|
179
|
-
$[15] =
|
|
180
|
-
$[16] = t7;
|
|
173
|
+
$[13] = items;
|
|
174
|
+
$[14] = localScrollDate.date;
|
|
175
|
+
$[15] = t8;
|
|
181
176
|
} else {
|
|
182
|
-
|
|
177
|
+
t8 = $[15];
|
|
183
178
|
}
|
|
184
|
-
let
|
|
185
|
-
if ($[
|
|
186
|
-
|
|
179
|
+
let t9;
|
|
180
|
+
if ($[19] !== containerRef || $[20] !== t8) {
|
|
181
|
+
t9 = /*#__PURE__*/jsx("div", {
|
|
187
182
|
className: styles.years,
|
|
188
183
|
ref: containerRef,
|
|
189
184
|
"data-test": "ring-date-popup--years",
|
|
190
|
-
children:
|
|
185
|
+
children: t8
|
|
186
|
+
});
|
|
187
|
+
$[19] = containerRef;
|
|
188
|
+
$[20] = t8;
|
|
189
|
+
$[21] = t9;
|
|
190
|
+
} else {
|
|
191
|
+
t9 = $[21];
|
|
192
|
+
}
|
|
193
|
+
let t10;
|
|
194
|
+
if ($[22] !== t7 || $[23] !== t9) {
|
|
195
|
+
t10 = /*#__PURE__*/jsx(IntersectionObserverContext, {
|
|
196
|
+
value: t7,
|
|
197
|
+
children: t9
|
|
191
198
|
});
|
|
192
|
-
$[21] = containerRef;
|
|
193
199
|
$[22] = t7;
|
|
194
|
-
$[23] =
|
|
200
|
+
$[23] = t9;
|
|
201
|
+
$[24] = t10;
|
|
195
202
|
} else {
|
|
196
|
-
|
|
203
|
+
t10 = $[24];
|
|
197
204
|
}
|
|
198
|
-
return
|
|
205
|
+
return t10;
|
|
199
206
|
}
|
|
200
207
|
function Year(t0) {
|
|
201
208
|
const $ = c(24);
|
|
202
|
-
if ($[0] !== "
|
|
209
|
+
if ($[0] !== "d83f39ae52d8a31382391108984551694ebcf0097c6e55663ca967ea74179702") {
|
|
203
210
|
for (let $i = 0; $i < 24; $i += 1) {
|
|
204
211
|
$[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
205
212
|
}
|
|
206
|
-
$[0] = "
|
|
213
|
+
$[0] = "d83f39ae52d8a31382391108984551694ebcf0097c6e55663ca967ea74179702";
|
|
207
214
|
}
|
|
208
215
|
const {
|
|
209
216
|
year,
|
|
210
217
|
scrollDate,
|
|
211
|
-
handleYearClick
|
|
212
|
-
intersectionObserverHandle
|
|
218
|
+
handleYearClick
|
|
213
219
|
} = t0;
|
|
214
220
|
const buttonRef = useRef(null);
|
|
215
|
-
const
|
|
221
|
+
const isIntersecting = useIsIntersecting(buttonRef);
|
|
216
222
|
const t1 = +year;
|
|
217
|
-
const t2 = !
|
|
223
|
+
const t2 = !isIntersecting;
|
|
218
224
|
let t3;
|
|
219
|
-
if ($[1] !==
|
|
220
|
-
t3 =
|
|
221
|
-
$[1] =
|
|
222
|
-
$[2] =
|
|
225
|
+
if ($[1] !== isIntersecting || $[2] !== scrollDate || $[3] !== year) {
|
|
226
|
+
t3 = isIntersecting && isSameYear(year, scrollDate) && styles.currentYear;
|
|
227
|
+
$[1] = isIntersecting;
|
|
228
|
+
$[2] = scrollDate;
|
|
223
229
|
$[3] = year;
|
|
224
230
|
$[4] = t3;
|
|
225
231
|
} else {
|
|
226
232
|
t3 = $[4];
|
|
227
233
|
}
|
|
228
234
|
let t4;
|
|
229
|
-
if ($[5] !==
|
|
230
|
-
t4 =
|
|
231
|
-
$[5] =
|
|
235
|
+
if ($[5] !== isIntersecting || $[6] !== year) {
|
|
236
|
+
t4 = isIntersecting && isThisYear(year) && styles.today;
|
|
237
|
+
$[5] = isIntersecting;
|
|
232
238
|
$[6] = year;
|
|
233
239
|
$[7] = t4;
|
|
234
240
|
} else {
|
|
@@ -244,19 +250,19 @@ function Year(t0) {
|
|
|
244
250
|
t5 = $[10];
|
|
245
251
|
}
|
|
246
252
|
let t6;
|
|
247
|
-
if ($[11] !== handleYearClick || $[12] !==
|
|
248
|
-
t6 =
|
|
253
|
+
if ($[11] !== handleYearClick || $[12] !== isIntersecting || $[13] !== year) {
|
|
254
|
+
t6 = isIntersecting ? () => handleYearClick(year) : undefined;
|
|
249
255
|
$[11] = handleYearClick;
|
|
250
|
-
$[12] =
|
|
256
|
+
$[12] = isIntersecting;
|
|
251
257
|
$[13] = year;
|
|
252
258
|
$[14] = t6;
|
|
253
259
|
} else {
|
|
254
260
|
t6 = $[14];
|
|
255
261
|
}
|
|
256
262
|
let t7;
|
|
257
|
-
if ($[15] !==
|
|
258
|
-
t7 =
|
|
259
|
-
$[15] =
|
|
263
|
+
if ($[15] !== isIntersecting || $[16] !== year) {
|
|
264
|
+
t7 = isIntersecting ? format(year, "yyyy") : "\xA0";
|
|
265
|
+
$[15] = isIntersecting;
|
|
260
266
|
$[16] = year;
|
|
261
267
|
$[17] = t7;
|
|
262
268
|
} else {
|
|
@@ -1,2 +1,49 @@
|
|
|
1
|
-
import 'scrollbar-width';
|
|
2
|
-
|
|
1
|
+
import scrollbarWidth from 'scrollbar-width';
|
|
2
|
+
import { s as styles } from '../_helpers/dialog.js';
|
|
3
|
+
|
|
4
|
+
const isPrevented = new Set();
|
|
5
|
+
let previousDocumentWidth = null;
|
|
6
|
+
const prevent = key => {
|
|
7
|
+
if (isPrevented.has(key)) {
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
isPrevented.add(key);
|
|
11
|
+
if (isPrevented.size > 1) {
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
const documentHasScroll = document.documentElement.scrollHeight > window.innerHeight || getComputedStyle(document.documentElement).overflowY === 'scroll';
|
|
15
|
+
document.documentElement.classList.add(styles.documentWithoutScroll);
|
|
16
|
+
const scrollWidth = scrollbarWidth();
|
|
17
|
+
const {
|
|
18
|
+
scrollbarGutter
|
|
19
|
+
} = getComputedStyle(document.documentElement);
|
|
20
|
+
const documentHasScrollbarGutter = scrollbarGutter === 'stable' || scrollbarGutter === 'both-edges';
|
|
21
|
+
if (documentHasScroll && scrollWidth !== null && scrollWidth !== undefined && scrollWidth > 0 && !documentHasScrollbarGutter) {
|
|
22
|
+
previousDocumentWidth = document.documentElement.style.width;
|
|
23
|
+
document.documentElement.style.width = `calc(100% - ${scrollWidth}px)`;
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
const reset = key => {
|
|
27
|
+
if (isPrevented.size === 0) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
isPrevented.delete(key);
|
|
31
|
+
if (isPrevented.size > 0) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
document.documentElement.classList.remove(styles.documentWithoutScroll);
|
|
35
|
+
if (previousDocumentWidth !== null && previousDocumentWidth !== undefined) {
|
|
36
|
+
document.documentElement.style.width = previousDocumentWidth;
|
|
37
|
+
previousDocumentWidth = null;
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
const preventerFactory = key => {
|
|
41
|
+
const preventerKey = key || Math.random();
|
|
42
|
+
return {
|
|
43
|
+
prevent: () => prevent(preventerKey),
|
|
44
|
+
reset: () => reset(preventerKey)
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
var dialogBodyScrollPreventer = preventerFactory('default-preventer');
|
|
48
|
+
|
|
49
|
+
export { dialogBodyScrollPreventer as default, preventerFactory };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { InteractionDirection } from './dialog-geometry';
|
|
3
|
+
interface DialogControlsProps {
|
|
4
|
+
movable: boolean | undefined;
|
|
5
|
+
resizable: boolean | undefined;
|
|
6
|
+
showCloseButton: boolean;
|
|
7
|
+
closeButtonTitle: string | undefined;
|
|
8
|
+
onCloseClick: React.MouseEventHandler<HTMLElement>;
|
|
9
|
+
onStartInteraction: (event: React.PointerEvent<HTMLElement>, direction: InteractionDirection) => void;
|
|
10
|
+
onStopInteraction: React.PointerEventHandler<HTMLElement>;
|
|
11
|
+
}
|
|
12
|
+
export default function DialogControls({ movable, resizable, showCloseButton, closeButtonTitle, onCloseClick, onStartInteraction, onStopInteraction, }: DialogControlsProps): React.JSX.Element;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { c } from 'react/compiler-runtime';
|
|
2
|
+
import 'react';
|
|
3
|
+
import closeIcon from '@jetbrains/icons/close';
|
|
4
|
+
import resizeIcon from '@jetbrains/icons/resize-corner-12px';
|
|
5
|
+
import { Button } from '../button/button.js';
|
|
6
|
+
import Icon from '../icon/icon.js';
|
|
7
|
+
import { s as styles } from '../_helpers/dialog.js';
|
|
8
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
9
|
+
import 'classnames';
|
|
10
|
+
import '@jetbrains/icons/chevron-down';
|
|
11
|
+
import '@jetbrains/icons/chevron-12px-down';
|
|
12
|
+
import '../link/clickable-link.js';
|
|
13
|
+
import '../global/controls-height.js';
|
|
14
|
+
import 'util-deprecate';
|
|
15
|
+
import '../global/configuration.js';
|
|
16
|
+
import '../_helpers/button.classes.js';
|
|
17
|
+
import '../icon/icon.constants.js';
|
|
18
|
+
import '../_helpers/icon-svg.js';
|
|
19
|
+
import '../global/memoize.js';
|
|
20
|
+
|
|
21
|
+
const resizeDirections = ['n', 'ne', 'e', 's', 'sw', 'w', 'nw', 'se'];
|
|
22
|
+
function DialogControls(t0) {
|
|
23
|
+
const $ = c(16);
|
|
24
|
+
if ($[0] !== "3b5393fdb3ab1f8cc9dae0ff6911750d56209b75ddbd239bbce35cfb2f2ab34c") {
|
|
25
|
+
for (let $i = 0; $i < 16; $i += 1) {
|
|
26
|
+
$[$i] = Symbol.for("react.memo_cache_sentinel");
|
|
27
|
+
}
|
|
28
|
+
$[0] = "3b5393fdb3ab1f8cc9dae0ff6911750d56209b75ddbd239bbce35cfb2f2ab34c";
|
|
29
|
+
}
|
|
30
|
+
const {
|
|
31
|
+
movable,
|
|
32
|
+
resizable,
|
|
33
|
+
showCloseButton,
|
|
34
|
+
closeButtonTitle,
|
|
35
|
+
onCloseClick,
|
|
36
|
+
onStartInteraction,
|
|
37
|
+
onStopInteraction
|
|
38
|
+
} = t0;
|
|
39
|
+
let t1;
|
|
40
|
+
if ($[1] !== movable || $[2] !== onStopInteraction) {
|
|
41
|
+
t1 = movable && /*#__PURE__*/jsx("div", {
|
|
42
|
+
"aria-hidden": "true",
|
|
43
|
+
className: styles.moveHandle,
|
|
44
|
+
"data-ring-dialog-move-handle": "",
|
|
45
|
+
"data-test": "ring-dialog-move-handle",
|
|
46
|
+
onLostPointerCapture: onStopInteraction
|
|
47
|
+
});
|
|
48
|
+
$[1] = movable;
|
|
49
|
+
$[2] = onStopInteraction;
|
|
50
|
+
$[3] = t1;
|
|
51
|
+
} else {
|
|
52
|
+
t1 = $[3];
|
|
53
|
+
}
|
|
54
|
+
let t2;
|
|
55
|
+
if ($[4] !== closeButtonTitle || $[5] !== onCloseClick || $[6] !== showCloseButton) {
|
|
56
|
+
t2 = showCloseButton && /*#__PURE__*/jsx(Button, {
|
|
57
|
+
icon: closeIcon,
|
|
58
|
+
"data-test": "ring-dialog-close-button",
|
|
59
|
+
className: styles.closeButton,
|
|
60
|
+
iconClassName: styles.closeIcon,
|
|
61
|
+
onClick: onCloseClick,
|
|
62
|
+
title: closeButtonTitle,
|
|
63
|
+
"aria-label": closeButtonTitle || "close dialog"
|
|
64
|
+
});
|
|
65
|
+
$[4] = closeButtonTitle;
|
|
66
|
+
$[5] = onCloseClick;
|
|
67
|
+
$[6] = showCloseButton;
|
|
68
|
+
$[7] = t2;
|
|
69
|
+
} else {
|
|
70
|
+
t2 = $[7];
|
|
71
|
+
}
|
|
72
|
+
let t3;
|
|
73
|
+
if ($[8] !== onStartInteraction || $[9] !== onStopInteraction || $[10] !== resizable) {
|
|
74
|
+
t3 = resizable && /*#__PURE__*/jsxs(Fragment, {
|
|
75
|
+
children: [resizeDirections.map(direction => /*#__PURE__*/jsx("div", {
|
|
76
|
+
"aria-hidden": "true",
|
|
77
|
+
className: styles.resizeHandle,
|
|
78
|
+
"data-resize-direction": direction,
|
|
79
|
+
"data-test": `ring-dialog-resize-handle-${direction}`,
|
|
80
|
+
onPointerDown: event => onStartInteraction(event, direction),
|
|
81
|
+
onPointerUp: onStopInteraction,
|
|
82
|
+
onPointerCancel: onStopInteraction,
|
|
83
|
+
onLostPointerCapture: onStopInteraction
|
|
84
|
+
}, direction)), /*#__PURE__*/jsx(Icon, {
|
|
85
|
+
"aria-hidden": "true",
|
|
86
|
+
className: styles.resizeMarker,
|
|
87
|
+
"data-test": "ring-dialog-resize-marker",
|
|
88
|
+
glyph: resizeIcon
|
|
89
|
+
})]
|
|
90
|
+
});
|
|
91
|
+
$[8] = onStartInteraction;
|
|
92
|
+
$[9] = onStopInteraction;
|
|
93
|
+
$[10] = resizable;
|
|
94
|
+
$[11] = t3;
|
|
95
|
+
} else {
|
|
96
|
+
t3 = $[11];
|
|
97
|
+
}
|
|
98
|
+
let t4;
|
|
99
|
+
if ($[12] !== t1 || $[13] !== t2 || $[14] !== t3) {
|
|
100
|
+
t4 = /*#__PURE__*/jsxs(Fragment, {
|
|
101
|
+
children: [t1, t2, t3]
|
|
102
|
+
});
|
|
103
|
+
$[12] = t1;
|
|
104
|
+
$[13] = t2;
|
|
105
|
+
$[14] = t3;
|
|
106
|
+
$[15] = t4;
|
|
107
|
+
} else {
|
|
108
|
+
t4 = $[15];
|
|
109
|
+
}
|
|
110
|
+
return t4;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export { DialogControls as default };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export type ResizeDirection = 'n' | 'ne' | 'e' | 'se' | 's' | 'sw' | 'w' | 'nw';
|
|
2
|
+
export type InteractionDirection = 'move' | ResizeDirection;
|
|
3
|
+
export interface Geometry {
|
|
4
|
+
left: number;
|
|
5
|
+
top: number;
|
|
6
|
+
width: number;
|
|
7
|
+
height: number;
|
|
8
|
+
}
|
|
9
|
+
export interface DialogState {
|
|
10
|
+
shortcutsScope: string;
|
|
11
|
+
geometry: Geometry | null;
|
|
12
|
+
resized: boolean;
|
|
13
|
+
}
|
|
14
|
+
export interface Interaction {
|
|
15
|
+
pointerId: number;
|
|
16
|
+
direction: InteractionDirection;
|
|
17
|
+
startX: number;
|
|
18
|
+
startY: number;
|
|
19
|
+
minWidth: number;
|
|
20
|
+
minHeight: number;
|
|
21
|
+
geometry: Geometry;
|
|
22
|
+
}
|
|
23
|
+
export declare const getNativeTabIndex: (autoFocusFirst: boolean | undefined) => -1 | undefined;
|
|
24
|
+
export declare const getTrapDisabled: (trapFocus: boolean, trapDisabled: boolean | undefined) => boolean;
|
|
25
|
+
export declare const getResizeMinimum: (element: Element) => {
|
|
26
|
+
minWidth: number;
|
|
27
|
+
minHeight: number;
|
|
28
|
+
};
|
|
29
|
+
export declare const moveGeometry: (start: Geometry, dx: number, dy: number, viewportWidth: number, viewportHeight: number) => Geometry;
|
|
30
|
+
export declare const fitGeometry: (geometry: Geometry, viewportWidth: number, viewportHeight: number) => Geometry;
|
|
31
|
+
export declare const resizeGeometry: ({ geometry: start, direction, minWidth, minHeight }: Interaction, dx: number, dy: number, viewportWidth: number, viewportHeight: number) => Geometry;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import 'core-js/modules/es.array.includes.js';
|
|
2
|
+
|
|
3
|
+
const MIN_WIDTH = 256;
|
|
4
|
+
const MIN_HEIGHT = 160;
|
|
5
|
+
const clamp = (value, min, max) => Math.min(Math.max(value, min), max);
|
|
6
|
+
const getNativeTabIndex = autoFocusFirst => autoFocusFirst ? undefined : -1;
|
|
7
|
+
const getTrapDisabled = (trapFocus, trapDisabled) => trapDisabled !== null && trapDisabled !== void 0 ? trapDisabled : !trapFocus;
|
|
8
|
+
const getResizeMinimum = element => {
|
|
9
|
+
const {
|
|
10
|
+
minWidth,
|
|
11
|
+
minHeight
|
|
12
|
+
} = getComputedStyle(element);
|
|
13
|
+
const parsedWidth = parseFloat(minWidth);
|
|
14
|
+
const parsedHeight = parseFloat(minHeight);
|
|
15
|
+
return {
|
|
16
|
+
minWidth: Number.isNaN(parsedWidth) ? MIN_WIDTH : parsedWidth,
|
|
17
|
+
minHeight: Number.isNaN(parsedHeight) ? MIN_HEIGHT : parsedHeight
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
const moveGeometry = (start, dx, dy, viewportWidth, viewportHeight) => ({
|
|
21
|
+
...start,
|
|
22
|
+
left: clamp(start.left + dx, 0, Math.max(0, viewportWidth - start.width)),
|
|
23
|
+
top: clamp(start.top + dy, 0, Math.max(0, viewportHeight - start.height))
|
|
24
|
+
});
|
|
25
|
+
const fitGeometry = (geometry, viewportWidth, viewportHeight) => {
|
|
26
|
+
const width = Math.min(geometry.width, viewportWidth);
|
|
27
|
+
const height = Math.min(geometry.height, viewportHeight);
|
|
28
|
+
return {
|
|
29
|
+
left: clamp(geometry.left, 0, Math.max(0, viewportWidth - width)),
|
|
30
|
+
top: clamp(geometry.top, 0, Math.max(0, viewportHeight - height)),
|
|
31
|
+
width,
|
|
32
|
+
height
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
const resizeGeometry = ({
|
|
36
|
+
geometry: start,
|
|
37
|
+
direction,
|
|
38
|
+
minWidth,
|
|
39
|
+
minHeight
|
|
40
|
+
}, dx, dy, viewportWidth, viewportHeight) => {
|
|
41
|
+
let left = start.left;
|
|
42
|
+
let right = start.left + start.width;
|
|
43
|
+
let top = start.top;
|
|
44
|
+
let bottom = start.top + start.height;
|
|
45
|
+
if (direction.includes('w')) {
|
|
46
|
+
left = clamp(start.left + dx, 0, right - Math.min(minWidth, right));
|
|
47
|
+
} else if (direction.includes('e')) {
|
|
48
|
+
right = clamp(right + dx, left + Math.min(minWidth, viewportWidth - left), viewportWidth);
|
|
49
|
+
}
|
|
50
|
+
if (direction.includes('n')) {
|
|
51
|
+
top = clamp(start.top + dy, 0, bottom - Math.min(minHeight, bottom));
|
|
52
|
+
} else if (direction.includes('s')) {
|
|
53
|
+
bottom = clamp(bottom + dy, top + Math.min(minHeight, viewportHeight - top), viewportHeight);
|
|
54
|
+
}
|
|
55
|
+
return {
|
|
56
|
+
left,
|
|
57
|
+
top,
|
|
58
|
+
width: right - left,
|
|
59
|
+
height: bottom - top
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
export { fitGeometry, getNativeTabIndex, getResizeMinimum, getTrapDisabled, moveGeometry, resizeGeometry };
|