Skip to content

Commit 8651e8a

Browse files
authored
Merge pull request #1877 from DevCloudFE/dev
update main from dev
2 parents 7c9acbf + 69917a5 commit 8651e8a

File tree

18 files changed

+301
-53
lines changed

18 files changed

+301
-53
lines changed

packages/devui-vue/devui/action-timeline/src/action-timeline.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,10 @@ export default defineComponent({
4848
<div class={timelineItemClass(index, parentIndex, actionData, item)}>
4949
<div class="vertical-list-item-top">
5050
<div class="vertical-list-item-top-left">
51-
<div class={itemIconClass(item, true)}>
51+
{ctx.slots.iconContent?.({ option: item }) || <div class={itemIconClass(item, true)}>
5252
{!item.icon && <div class="list-empty-icon-dot"></div>}
5353
<em class={itemIconClass(item)}></em>
54-
</div>
54+
</div>}
5555
<div class="vertical-list-item-top-left-title">{ctx.slots.title?.({ option: item })}</div>
5656
</div>
5757
<div class="dp-action-timeline-item-data">{item.createdAt}</div>
@@ -62,10 +62,10 @@ export default defineComponent({
6262
const renderHorizontalBody = (actionData: ActionData, parentIndex: number) =>
6363
actionData.actions?.map((item, index) => (
6464
<div class={timelineItemClass(index, parentIndex, actionData, item)}>
65-
<div class={itemIconClass(item, true)}>
65+
{ctx.slots.iconContent?.({ option: item }) || <div class={itemIconClass(item, true)}>
6666
{!item.icon && <div class="list-empty-icon-dot"></div>}
6767
<em class={itemIconClass(item)}></em>
68-
</div>
68+
</div>}
6969
<div class="dp-action-timeline-list-data">{ctx.slots.content?.({ option: item })}</div>
7070
<div class="dp-action-timeline-item-date">{item.createdAt}</div>
7171
{!(actionData.actions && data?.value && index === actionData.actions.length - 1 && parentIndex === data?.value?.length - 1) && (
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
export const getPropsSlot = (slots, props, prop = 'default') => {
1+
export const getPropsSlot = (slots: any, props: any, prop = 'default') => {
22
return props[prop] ?? slots[prop]?.();
33
};

packages/devui-vue/devui/category-search/src/composables/use-category-search.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { ref, computed, toRefs, provide, watch, onMounted, reactive } from 'vue';
22
import type { Ref, SetupContext } from 'vue';
3-
import { mergeWith, cloneDeep, merge } from 'lodash-es';
3+
import { mergeWith, cloneDeep, merge } from 'lodash';
44
import RadioMenu from '../components/radio-menu';
55
import CheckboxMenu from '../components/checkbox-menu';
66
import LabelMenu from '../components/label-menu';

packages/devui-vue/devui/editor-md/src/components/toolbar.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,20 @@ import './toolbar.scss';
66
export default defineComponent({
77
name: 'DMdToolbar',
88
setup() {
9-
const { toolbars, toolbarConfig } = useToolbar();
10-
9+
const { toolbars, toolbarConfig, customToolbars } = useToolbar();
10+
const tempToolbars = { ...toolbars, ...customToolbars?.value };
1111
return () => (
1212
<div class="md-toolbar-container">
1313
{toolbarConfig.value.map((item, index) =>
1414
Array.isArray(item) ? (
1515
<>
1616
{item.map((key, idx) => (
17-
<ToolbarItem config={toolbars[key]} key={`${index}-${idx}`} />
17+
<ToolbarItem config={tempToolbars[key]} key={`${index}-${idx}`} />
1818
))}
1919
<span class="md-toolbar-span"></span>
2020
</>
2121
) : (
22-
<ToolbarItem config={toolbars[item]} key={index} />
22+
<ToolbarItem config={tempToolbars[item]} key={index} />
2323
)
2424
)}
2525
</div>

packages/devui-vue/devui/editor-md/src/composables/use-editor-md-toolbar.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { inject } from 'vue';
22
import { EditorMdInjectionKey, IEditorMdInjection } from '../editor-md-types';
33

44
export function useToolbar() {
5-
const { toolbars, toolbarConfig } = inject(EditorMdInjectionKey) as IEditorMdInjection;
5+
const { toolbars, toolbarConfig, customToolbars } = inject(EditorMdInjectionKey) as IEditorMdInjection;
66

7-
return { toolbars, toolbarConfig };
7+
return { toolbars, toolbarConfig, customToolbars };
88
}

packages/devui-vue/devui/editor-md/src/composables/use-editor-md.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -414,8 +414,10 @@ export function useEditorMd(props: EditorMdProps, ctx: SetupContext) {
414414
renderRef,
415415
containerRef,
416416
toolbars,
417+
toolbarConfig,
417418
previewHtmlList,
418419
isHintShow,
420+
customToolbars,
419421
getEditorIns,
420422
onPaste,
421423
previewContentChange,

packages/devui-vue/devui/editor-md/src/editor-md-types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ export interface IEditorMdInjection {
136136
showFullscreen: Ref<boolean>;
137137
toolbars: Record<string, IToolbarItemConfig>;
138138
toolbarConfig: Ref<ToolbarConfigProp>;
139+
customToolbars: Ref<Record<string, IToolbarItemConfig> | undefined> | undefined;
139140
getEditorIns: () => any;
140141
t: (name: string) => string;
141142
}

packages/devui-vue/devui/editor-md/src/editor-md.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ export default defineComponent({
1717
const {
1818
mode,
1919
toolbarConfig,
20+
customToolbars,
2021
editorContainerHeight,
2122
hidePreviewView,
2223
placeholder,
@@ -66,6 +67,7 @@ export default defineComponent({
6667
showFullscreen,
6768
toolbars,
6869
toolbarConfig,
70+
customToolbars,
6971
getEditorIns,
7072
t: locale,
7173
});

packages/devui-vue/devui/editor-md/src/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,5 +84,5 @@ export function locale(key: string): string {
8484
loading: '正在加载中...',
8585
pasting: '您粘贴内容较多, 正在努力加载中,请耐心等待...',
8686
};
87-
return localeMap[key];
87+
return localeMap[key] || key;
8888
}

packages/devui-vue/devui/input-number/__tests__/input-number.spec.tsx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,3 +279,20 @@ describe('d-input-number', () => {
279279
expect(selectFn).toBeCalledTimes(2);
280280
});
281281
});
282+
283+
284+
it('allowEmpty', async () => {
285+
const num = ref();
286+
const wrapper = mount({
287+
setup() {
288+
return () => <DInputNumber v-model={num.value} allowEmpty={true} ></DInputNumber>;
289+
},
290+
});
291+
num.value = undefined;
292+
const inputInner = wrapper.find(ns.e('input-box'));
293+
expect((inputInner.element as HTMLInputElement).value).toBeNull;
294+
num.value = 51;
295+
expect((inputInner.element as HTMLInputElement).value).toBe('51');
296+
num.value = '';
297+
expect((inputInner.element as HTMLInputElement).value).toBeNull;
298+
});

0 commit comments

Comments
 (0)