@cloud-ru/ds-uikit-product-page-layout 2.3.0 → 2.3.1-preview-ebce28cc.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloud-ru/ds-uikit-product-page-layout",
|
|
3
|
-
"version": "2.3.0",
|
|
3
|
+
"version": "2.3.1-preview-ebce28cc.0",
|
|
4
4
|
"description": "Набор страничных раскладок продуктового кабинета — каталог, детальная страница сервиса, форма, дерево-навигация, сайдбар и общие слоты — с адаптацией desktop/mobile через AdaptiveProvider.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -40,27 +40,27 @@
|
|
|
40
40
|
],
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"classnames": "^2.5.1",
|
|
43
|
-
"@cloud-ru/ds-
|
|
44
|
-
"@cloud-ru/ds-
|
|
45
|
-
"@cloud-ru/ds-
|
|
46
|
-
"@cloud-ru/ds-
|
|
47
|
-
"@cloud-ru/ds-
|
|
48
|
-
"@cloud-ru/ds-icons": "
|
|
49
|
-
"@cloud-ru/ds-
|
|
50
|
-
"@cloud-ru/ds-
|
|
51
|
-
"@cloud-ru/ds-
|
|
52
|
-
"@cloud-ru/ds-
|
|
53
|
-
"@cloud-ru/ds-
|
|
54
|
-
"@cloud-ru/ds-
|
|
55
|
-
"@cloud-ru/ds-
|
|
56
|
-
"@cloud-ru/ds-
|
|
57
|
-
"@cloud-ru/ds-truncate-string": "
|
|
58
|
-
"@cloud-ru/ds-
|
|
59
|
-
"@cloud-ru/ds-
|
|
60
|
-
"@cloud-ru/ds-uikit-product-
|
|
61
|
-
"@cloud-ru/ds-uikit-product-
|
|
62
|
-
"@cloud-ru/ds-utils": "
|
|
63
|
-
"@cloud-ru/ds-
|
|
43
|
+
"@cloud-ru/ds-block": "1.0.6",
|
|
44
|
+
"@cloud-ru/ds-adaptive": "1.0.5",
|
|
45
|
+
"@cloud-ru/ds-icon-predefined": "1.0.6",
|
|
46
|
+
"@cloud-ru/ds-dropdown": "1.2.3",
|
|
47
|
+
"@cloud-ru/ds-button": "1.0.7",
|
|
48
|
+
"@cloud-ru/ds-icons": "1.7.4",
|
|
49
|
+
"@cloud-ru/ds-locale": "1.0.0",
|
|
50
|
+
"@cloud-ru/ds-loader": "1.0.6",
|
|
51
|
+
"@cloud-ru/ds-list": "3.1.3",
|
|
52
|
+
"@cloud-ru/ds-modal": "2.1.3",
|
|
53
|
+
"@cloud-ru/ds-search": "1.0.21",
|
|
54
|
+
"@cloud-ru/ds-popover": "1.1.5",
|
|
55
|
+
"@cloud-ru/ds-status": "1.1.18",
|
|
56
|
+
"@cloud-ru/ds-tree": "1.0.47",
|
|
57
|
+
"@cloud-ru/ds-truncate-string": "1.0.21",
|
|
58
|
+
"@cloud-ru/ds-tooltip": "1.0.20",
|
|
59
|
+
"@cloud-ru/ds-typography": "1.0.2",
|
|
60
|
+
"@cloud-ru/ds-uikit-product-copy": "1.1.20",
|
|
61
|
+
"@cloud-ru/ds-uikit-product-button-predefined": "1.0.46",
|
|
62
|
+
"@cloud-ru/ds-utils": "1.4.1",
|
|
63
|
+
"@cloud-ru/ds-uikit-product-quota": "2.1.2-preview-ebce28cc.0"
|
|
64
64
|
},
|
|
65
65
|
"publishConfig": {
|
|
66
66
|
"access": "public"
|
|
@@ -2,8 +2,9 @@ import { LAYOUT_TYPE, withLayoutType } from '@cloud-ru/ds-adaptive';
|
|
|
2
2
|
import { Button, VIEW } from '@cloud-ru/ds-button';
|
|
3
3
|
import { KebabSVG } from '@cloud-ru/ds-icons/interface/system';
|
|
4
4
|
import { Droplist, DroplistProps, Item } from '@cloud-ru/ds-list';
|
|
5
|
+
import { ModalCustom } from '@cloud-ru/ds-modal';
|
|
5
6
|
import { Tooltip } from '@cloud-ru/ds-tooltip';
|
|
6
|
-
import { quotaLocale,
|
|
7
|
+
import { quotaLocale, QuotaWidgetContent } from '@cloud-ru/ds-uikit-product-quota';
|
|
7
8
|
import { useDynamicList } from '@cloud-ru/ds-utils';
|
|
8
9
|
import { MouseEvent, ReactNode, useMemo, useRef, useState } from 'react';
|
|
9
10
|
|
|
@@ -27,6 +28,9 @@ function MobileActionsBase({ items, maxVisibleItems }: ActionsProps) {
|
|
|
27
28
|
const containerRef = useRef<HTMLDivElement>(null);
|
|
28
29
|
|
|
29
30
|
const [isOpen, setIsOpen] = useState(false);
|
|
31
|
+
const [openQuotaIndex, setOpenQuotaIndex] = useState<number>();
|
|
32
|
+
const activeAction = openQuotaIndex === undefined ? undefined : items[openQuotaIndex];
|
|
33
|
+
const openQuota = activeAction?.variant === BUTTON_TYPE.Quota ? activeAction : undefined;
|
|
30
34
|
const availableItems = useMemo(() => items.filter(item => !item.hidden), [items]);
|
|
31
35
|
const { visibleItems, hiddenItems } = useDynamicList({
|
|
32
36
|
parentContainerRef: containerRef,
|
|
@@ -40,10 +44,10 @@ function MobileActionsBase({ items, maxVisibleItems }: ActionsProps) {
|
|
|
40
44
|
return null;
|
|
41
45
|
}
|
|
42
46
|
|
|
43
|
-
const
|
|
44
|
-
const
|
|
47
|
+
const overflowItems = hiddenItems.concat(visibleItems.filter(action => action.variant === BUTTON_TYPE.Kebab));
|
|
48
|
+
const visibleActions = visibleItems.filter(action => action.variant !== BUTTON_TYPE.Kebab);
|
|
45
49
|
|
|
46
|
-
const droplistItems =
|
|
50
|
+
const droplistItems = overflowItems.reduce<Item[]>((acc, action) => {
|
|
47
51
|
if (action.variant === 'custom') {
|
|
48
52
|
const { asListItem } = action.render();
|
|
49
53
|
acc.push({
|
|
@@ -87,19 +91,14 @@ function MobileActionsBase({ items, maxVisibleItems }: ActionsProps) {
|
|
|
87
91
|
break;
|
|
88
92
|
}
|
|
89
93
|
case BUTTON_TYPE.Quota: {
|
|
90
|
-
// QuotaWidget самодостаточен (свой триггер + dropdown) — рендерим инлайн как inactive-айтем.
|
|
91
|
-
const quotaWidget = <QuotaWidget {...action} buttonProps={{ size: 'm', fullWidth: true }} />;
|
|
92
|
-
|
|
93
94
|
acc.push({
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
},
|
|
102
|
-
],
|
|
95
|
+
content: { label: action.buttonProps?.label ?? tQuota('quotas') },
|
|
96
|
+
disabled: action.buttonProps?.disabled,
|
|
97
|
+
onClick: () => {
|
|
98
|
+
setIsOpen(false);
|
|
99
|
+
setOpenQuotaIndex(items.indexOf(action));
|
|
100
|
+
action.onWidgetOpen?.();
|
|
101
|
+
},
|
|
103
102
|
});
|
|
104
103
|
break;
|
|
105
104
|
}
|
|
@@ -160,7 +159,31 @@ function MobileActionsBase({ items, maxVisibleItems }: ActionsProps) {
|
|
|
160
159
|
</Droplist>
|
|
161
160
|
)}
|
|
162
161
|
|
|
163
|
-
{
|
|
162
|
+
{openQuota && (
|
|
163
|
+
<ModalCustom open onClose={() => setOpenQuotaIndex(undefined)}>
|
|
164
|
+
<ModalCustom.Header title={tQuota('quotas')} subtitle={openQuota.projectName} />
|
|
165
|
+
<ModalCustom.Body
|
|
166
|
+
content={
|
|
167
|
+
<QuotaWidgetContent
|
|
168
|
+
quotas={openQuota.quotas}
|
|
169
|
+
quotasUrl={openQuota.quotasUrl}
|
|
170
|
+
projectName={openQuota.projectName}
|
|
171
|
+
loading={openQuota.loading}
|
|
172
|
+
error={openQuota.error}
|
|
173
|
+
onRefresh={openQuota.onRefresh}
|
|
174
|
+
canEditQuota={openQuota.canEditQuota}
|
|
175
|
+
onIncreaseQuotaClick={openQuota.onIncreaseQuotaClick}
|
|
176
|
+
onQuotasUrlClick={openQuota.onQuotasUrlClick}
|
|
177
|
+
disableSorting={openQuota.disableSorting}
|
|
178
|
+
skeletonRowCount={openQuota.skeletonRowCount}
|
|
179
|
+
hideMobileHeader
|
|
180
|
+
/>
|
|
181
|
+
}
|
|
182
|
+
/>
|
|
183
|
+
</ModalCustom>
|
|
184
|
+
)}
|
|
185
|
+
|
|
186
|
+
{visibleActions.map((action, index) => (
|
|
164
187
|
<ActionView
|
|
165
188
|
{...action}
|
|
166
189
|
key={index}
|