, ['icon', 'src']>(
({ slots, children, ...props }) => {
return (
<>
- {slots.icon ? children : null}
+
+ {slots.icon || slots.src ? children : null}
+
: props.icon}
- src={slots.src ? : props.src}
+ src={
+ slots.src ? : props.src || undefined
+ }
>
- {slots.icon ? null : children}
+ {slots.icon || slots.src ? null : children}
>
);
diff --git a/frontend/antd/avatar/group/avatar.group.less b/frontend/antd/avatar/group/avatar.group.less
new file mode 100644
index 00000000..46b57881
--- /dev/null
+++ b/frontend/antd/avatar/group/avatar.group.less
@@ -0,0 +1,11 @@
+.ms-gr-container {
+ .ms-gr-antd-avatar-group {
+ > *:not(:first-child) {
+ react-portal-target {
+ .ms-gr-ant-avatar {
+ margin-inline-start: var(--ms-gr-ant-avatar-group-overlapping);
+ }
+ }
+ }
+ }
+}
diff --git a/frontend/antd/avatar/group/avatar.group.tsx b/frontend/antd/avatar/group/avatar.group.tsx
index ecc93959..8cd24a22 100644
--- a/frontend/antd/avatar/group/avatar.group.tsx
+++ b/frontend/antd/avatar/group/avatar.group.tsx
@@ -4,6 +4,8 @@ import React from 'react';
import { useTargets } from '@utils/hooks/useTargets';
import { Avatar as AAvatar, type GetProps } from 'antd';
+import './avatar.group.less';
+
export const AvatarGroup = sveltify<
GetProps,
['max.popover.title', 'max.popover.content']
@@ -11,11 +13,15 @@ export const AvatarGroup = sveltify<
const targets = useTargets(children);
return (
<>
- {children}
+ {children}
{targets.map((target, index) => {
return ;
})}
diff --git a/frontend/antd/card/Index.svelte b/frontend/antd/card/Index.svelte
index ee0d524d..a45a4ec9 100644
--- a/frontend/antd/card/Index.svelte
+++ b/frontend/antd/card/Index.svelte
@@ -5,12 +5,18 @@
bindEvents,
importComponent,
} from '@svelte-preprocess-react/component';
- import { getSlotContext, getSlots } from '@svelte-preprocess-react/slot';
+ import {
+ getSetSlotParamsFn,
+ getSlotContext,
+ getSlots,
+ } from '@svelte-preprocess-react/slot';
import type React from 'react';
import type { Gradio } from '@gradio/utils';
import cls from 'classnames';
import { type Writable, writable } from 'svelte/store';
+ import { getItems } from '../tabs/context';
+
const AwaitedCard = importComponent(() => import('./card'));
export let gradio: Gradio;
export let _internal: Record = {};
@@ -22,6 +28,8 @@
export let elem_classes: string[] = [];
export let elem_style: React.CSSProperties = {};
export let visible = true;
+ const setSlotParams = getSetSlotParamsFn();
+
const slots = getSlots();
const [mergedProps, update] = getSlotContext({
gradio,
@@ -45,6 +53,8 @@
elem_style,
restProps: $$restProps,
});
+
+ const { tabList } = getItems(['tabList']);
{#if $mergedProps.visible}
@@ -58,6 +68,8 @@
{...bindEvents($mergedProps)}
containsGrid={$mergedProps._internal.contains_grid}
slots={$slots}
+ tabListItems={$tabList}
+ {setSlotParams}
>
diff --git a/frontend/antd/card/card.tsx b/frontend/antd/card/card.tsx
index af34731b..91ca3a86 100644
--- a/frontend/antd/card/card.tsx
+++ b/frontend/antd/card/card.tsx
@@ -1,41 +1,80 @@
import { sveltify } from '@svelte-preprocess-react';
import { ReactSlot } from '@svelte-preprocess-react/react-slot';
-import React from 'react';
+import type { SetSlotParams } from '@svelte-preprocess-react/slot';
+import React, { useMemo } from 'react';
import { useTargets } from '@utils/hooks/useTargets';
+import { renderItems } from '@utils/renderItems';
import { Card as ACard, type GetProps } from 'antd';
+import { type Item } from '../tabs/context';
+
export const Card = sveltify<
GetProps & {
containsGrid?: boolean;
+ tabListItems: Item[];
+ setSlotParams: SetSlotParams;
},
- ['actions', 'cover', 'extra', 'tabBarExtraContent', 'title']
->(({ children, containsGrid, slots, ...props }) => {
- const targets = useTargets(children, 'actions');
- return (
- : props.title}
- extra={slots.extra ? : props.extra}
- cover={slots.cover ? : props.cover}
- tabBarExtraContent={
- slots.tabBarExtraContent ? (
-
- ) : (
- props.tabBarExtraContent
- )
- }
- actions={
- targets.length > 0
- ? targets.map((target, index) => {
- return ;
- })
- : props.actions
- }
- >
- {containsGrid ? : null}
- {children}
-
- );
-});
+ [
+ 'actions',
+ 'cover',
+ 'extra',
+ 'tabBarExtraContent',
+ 'title',
+ 'tabProps.addIcon',
+ 'tabProps.removeIcon',
+ 'tabProps.renderTabBar',
+ 'tabProps.tabBarExtraContent',
+ 'tabProps.tabBarExtraContent.left',
+ 'tabProps.tabBarExtraContent.right',
+ 'tabProps.more.icon',
+ ]
+>(
+ ({
+ children,
+ containsGrid,
+ slots,
+ tabListItems,
+ tabList,
+ tabProps,
+ ...props
+ }) => {
+ const targets = useTargets(children, 'actions');
+
+ return (
+ {
+ return (
+ tabList ||
+ renderItems['tabList']>[number]>(
+ tabListItems
+ )
+ );
+ }, [tabList, tabListItems])}
+ title={slots.title ? : props.title}
+ extra={slots.extra ? : props.extra}
+ cover={slots.cover ? : props.cover}
+ tabBarExtraContent={
+ slots.tabBarExtraContent ? (
+
+ ) : (
+ props.tabBarExtraContent
+ )
+ }
+ actions={
+ targets.length > 0
+ ? targets.map((target, index) => {
+ return ;
+ })
+ : props.actions
+ }
+ >
+ {containsGrid ? : null}
+ {children}
+
+ );
+ }
+);
export default Card;
diff --git a/frontend/antd/cascader/cascader.tsx b/frontend/antd/cascader/cascader.tsx
index 017163d8..49168b02 100644
--- a/frontend/antd/cascader/cascader.tsx
+++ b/frontend/antd/cascader/cascader.tsx
@@ -30,6 +30,7 @@ export const Cascader = sveltify<
'maxTagPlaceholder',
'notFoundContent',
'expandIcon',
+ 'prefix',
'removeIcon',
'displayRender',
'tagRender',
@@ -107,6 +108,9 @@ export const Cascader = sveltify<
loadData={onLoadData}
optionRender={optionRenderFunction}
getPopupContainer={getPopupContainerFunction}
+ prefix={
+ slots.prefix ? : props.prefix
+ }
dropdownRender={
slots.dropdownRender
? renderParamsSlot({
diff --git a/frontend/antd/date-picker/date-picker.tsx b/frontend/antd/date-picker/date-picker.tsx
index 7d4bbc3d..75a2e496 100644
--- a/frontend/antd/date-picker/date-picker.tsx
+++ b/frontend/antd/date-picker/date-picker.tsx
@@ -49,6 +49,7 @@ export const DatePicker = sveltify<
},
[
'allowClear.clearIcon',
+ 'prefix',
'prevIcon',
'nextIcon',
'suffixIcon',
@@ -149,7 +150,7 @@ export const DatePicker = sveltify<
renderItems[number]>(
presetItems
)
- ).map((preset) => {
+ )?.map((preset) => {
return {
...preset,
value: formatDayjs(preset.value),
@@ -181,6 +182,9 @@ export const DatePicker = sveltify<
props.prevIcon
)
}
+ prefix={
+ slots.prefix ? : props.prefix
+ }
nextIcon={
slots.nextIcon ? (
diff --git a/frontend/antd/date-picker/range-picker/date-picker.range-picker.tsx b/frontend/antd/date-picker/range-picker/date-picker.range-picker.tsx
index 3847f372..91d665d7 100644
--- a/frontend/antd/date-picker/range-picker/date-picker.range-picker.tsx
+++ b/frontend/antd/date-picker/range-picker/date-picker.range-picker.tsx
@@ -44,6 +44,7 @@ export const DateRangePicker = sveltify<
},
[
'allowClear.clearIcon',
+ 'prefix',
'prevIcon',
'nextIcon',
'suffixIcon',
@@ -154,7 +155,7 @@ export const DateRangePicker = sveltify<
renderItems[number]>(
presetItems
)
- ).map((preset) => {
+ )?.map((preset) => {
return {
...preset,
value: formatDates(preset.value as any),
@@ -183,6 +184,9 @@ export const DateRangePicker = sveltify<
})
: props.renderExtraFooter
}
+ prefix={
+ slots.prefix ? : props.prefix
+ }
prevIcon={
slots.prevIcon ? (
diff --git a/frontend/antd/select/select.tsx b/frontend/antd/select/select.tsx
index 48c4d0f4..d1f98d43 100644
--- a/frontend/antd/select/select.tsx
+++ b/frontend/antd/select/select.tsx
@@ -26,6 +26,7 @@ export const Select = sveltify<
'optionRender',
'tagRender',
'labelRender',
+ 'prefix',
]
>(
({
@@ -83,6 +84,9 @@ export const Select = sveltify<
}
: props.allowClear
}
+ prefix={
+ slots.prefix ? : props.prefix
+ }
removeIcon={
slots.removeIcon ? (
diff --git a/frontend/antd/table/column/Index.svelte b/frontend/antd/table/column/Index.svelte
index 9e848fbc..148a773f 100644
--- a/frontend/antd/table/column/Index.svelte
+++ b/frontend/antd/table/column/Index.svelte
@@ -11,9 +11,13 @@
import type React from 'react';
import type { Gradio } from '@gradio/utils';
import { createFunction } from '@utils/createFunction';
+ import { renderItems } from '@utils/renderItems';
+ import { renderParamsSlot } from '@utils/renderParamsSlot';
+ import { renderSlot } from '@utils/renderSlot';
import cls from 'classnames';
import { writable } from 'svelte/store';
+ import { getItems as getMenuItems } from '../../menu/context';
import { getSetColumnItemFn, type Item } from '../context';
export let gradio: Gradio;
@@ -59,7 +63,9 @@
as_item,
restProps: $$restProps,
});
-
+ const { 'filterDropdownProps.menu.items': dropdownMenuItems } = getMenuItems([
+ 'filterDropdownProps.menu.items',
+ ]);
const setColumnItem = getSetColumnItemFn();
const setSlotParams = getSetSlotParamsFn();
$: {
@@ -67,6 +73,59 @@
$mergedProps.props.showSorterTooltip ||
$mergedProps.restProps.showSorterTooltip;
const sorter = $mergedProps.props.sorter || $mergedProps.restProps.sorter;
+
+ const filterDropdownMenu = {
+ ...($mergedProps.restProps.filterDropdownProps?.menu || {}),
+ ...($mergedProps.props.filterDropdownProps?.menu || {}),
+ items:
+ $mergedProps.props.filterDropdownProps?.menu?.items ||
+ $mergedProps.restProps.filterDropdownProps?.menu?.items ||
+ $dropdownMenuItems.length > 0
+ ? renderItems($dropdownMenuItems, { clone: true })
+ : undefined,
+ expandIcon:
+ renderParamsSlot(
+ {
+ setSlotParams,
+ slots: $slots,
+ key: 'filterDropdownProps.menu.expandIcon',
+ },
+ {
+ clone: true,
+ }
+ ) ||
+ $mergedProps.props.filterDropdownProps?.menu?.expandIcon ||
+ $mergedProps.restProps.filterDropdownProps?.menu?.expandIcon,
+ overflowedIndicator:
+ renderSlot($slots['filterDropdownProps.menu.overflowedIndicator']) ||
+ $mergedProps.props.filterDropdownProps?.menu?.overflowedIndicator ||
+ $mergedProps.restProps.filterDropdownProps?.menu?.overflowedIndicator,
+ };
+
+ const filterDropdownProps = {
+ ...($mergedProps.restProps.filterDropdownProps || {}),
+ ...($mergedProps.props.filterDropdownProps || {}),
+ dropdownRender: $slots['filterDropdownProps.dropdownRender']
+ ? renderParamsSlot(
+ {
+ setSlotParams,
+ slots: $slots,
+ key: 'filterDropdownProps.dropdownRender',
+ },
+ {
+ clone: true,
+ }
+ )
+ : createFunction(
+ $mergedProps.props.filterDropdownProps?.dropdownRender ||
+ $mergedProps.restProps.filterDropdownProps?.dropdownRender
+ ),
+ menu:
+ Object.values(filterDropdownMenu).filter(Boolean).length > 0
+ ? filterDropdownMenu
+ : undefined,
+ };
+
setColumnItem- (
$slotKey,
$mergedProps._internal.index || 0,
@@ -86,6 +145,10 @@
render: createFunction(
$mergedProps.props.render || $mergedProps.restProps.render
),
+ filterDropdownProps:
+ Object.values(filterDropdownProps).filter(Boolean).length > 0
+ ? filterDropdownProps
+ : undefined,
filterIcon: createFunction(
$mergedProps.props.filterIcon ||
$mergedProps.restProps.filterIcon
diff --git a/frontend/antd/table/expandable/Expandable.svelte b/frontend/antd/table/expandable/Expandable.svelte
index 07a8dcb6..ea88bbec 100644
--- a/frontend/antd/table/expandable/Expandable.svelte
+++ b/frontend/antd/table/expandable/Expandable.svelte
@@ -75,7 +75,8 @@
...events,
expandedRowClassName: createFunction(
$mergedProps.props.expandedRowClassName ||
- $mergedProps.restProps.expandedRowClassName
+ $mergedProps.restProps.expandedRowClassName,
+ true
),
expandedRowRender: createFunction(
$mergedProps.props.expandedRowRender ||
diff --git a/frontend/antd/table/table.tsx b/frontend/antd/table/table.tsx
index f60a2948..efef003b 100644
--- a/frontend/antd/table/table.tsx
+++ b/frontend/antd/table/table.tsx
@@ -127,13 +127,13 @@ export const Table = sveltify<
rowSelection={useMemo(() => {
return (
rowSelection ||
- renderItems(rowSelectionItems)[0]
+ renderItems(rowSelectionItems)?.[0]
);
}, [rowSelection, rowSelectionItems])}
expandable={useMemo(() => {
return (
expandable ||
- renderItems(expandableItems)[0]
+ renderItems(expandableItems)?.[0]
);
}, [expandable, expandableItems])}
rowClassName={rowClassNameFunction}
diff --git a/frontend/antd/tree-select/tree-select.tsx b/frontend/antd/tree-select/tree-select.tsx
index d76e9208..55dcac28 100644
--- a/frontend/antd/tree-select/tree-select.tsx
+++ b/frontend/antd/tree-select/tree-select.tsx
@@ -24,6 +24,7 @@ export const TreeSelect = sveltify<
'maxTagPlaceholder',
'notFoundContent',
'suffixIcon',
+ 'prefix',
'switcherIcon',
'dropdownRender',
'tagRender',
@@ -77,6 +78,7 @@ export const TreeSelect = sveltify<
) : (
props.suffixIcon
),
+ prefix: slots.prefix ? : props.prefix,
switcherIcon: slots.switcherIcon
? renderParamsSlot({ slots, setSlotParams, key: 'switcherIcon' })
: props.switcherIcon,
diff --git a/frontend/legacy/Chatbot/shared/Pending.svelte b/frontend/legacy/Chatbot/shared/Pending.svelte
index 658150ed..4da0f1b4 100644
--- a/frontend/legacy/Chatbot/shared/Pending.svelte
+++ b/frontend/legacy/Chatbot/shared/Pending.svelte
@@ -10,11 +10,11 @@
style:border-radius={layout === 'bubble' ? 'var(--radius-xxl)' : 'none'}
>
Loading content
-
+
-
+
-
+