plain-design 1.0.0-beta.35 → 1.0.0-beta.38
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/plain-design.commonjs.min.js +1 -1
- package/dist/plain-design.min.css +2 -2
- package/dist/plain-design.min.js +1 -1
- package/dist/report.html +2 -2
- package/package.json +4 -4
- package/src/packages/components/$object/createObjectService.tsx +31 -20
- package/src/packages/components/$object/object.service.utils.ts +7 -3
- package/src/packages/components/$previewer/ImagePreviewerFixedContainer.tsx +1 -0
- package/src/packages/components/AutoTable/use/useTableOption.table.tsx +3 -3
- package/src/packages/components/AutoTable/utils/TableOption.space.tsx +3 -0
- package/src/packages/components/Carousel/index.tsx +5 -5
- package/src/packages/components/ImagePreviewer/ImagePreviewer.tsx +77 -75
- package/src/packages/components/ImagePreviewer/ImagePreviewerCarouselImage.tsx +1 -1
- package/src/packages/components/ImagePreviewer/ImagePreviewerGallery.tsx +1 -1
- package/src/packages/components/PlcOv/index.tsx +14 -4
- package/src/packages/components/StackCard/index.tsx +5 -5
- package/src/packages/components/Table/standard/PlcOperation/outer-operation.scss +2 -0
- package/src/packages/components/Table/table/body/useCellValue.tsx +10 -6
- package/src/packages/components/Table/table/use/useTableFormEditor.tsx +1 -1
- package/src/packages/components/Table/table/use/useTableModifyEditor.tsx +1 -1
- package/src/packages/components/VirtualTable/virtual-table.scss +1 -2
- package/src/packages/components/useDialog/index.tsx +1 -1
- package/src/packages/utils/inheritSlots.ts +28 -0
@@ -0,0 +1,28 @@
|
|
1
|
+
import {RenderNode} from "plain-design-composition";
|
2
|
+
|
3
|
+
export function inheritSlots<
|
4
|
+
Slots extends Record<string, (() => RenderNode) & { isExist: () => boolean }>,
|
5
|
+
ScopeSlots extends Record<string, ((...args: any[]) => RenderNode) & { isExist: () => boolean }>,
|
6
|
+
>(
|
7
|
+
{
|
8
|
+
slots,
|
9
|
+
scopeSlots,
|
10
|
+
defaultSlots,
|
11
|
+
defaultScopeSlots,
|
12
|
+
}: {
|
13
|
+
slots?: Slots,
|
14
|
+
scopeSlots?: ScopeSlots,
|
15
|
+
defaultSlots?: { [k in keyof Slots]: Omit<Slots[k], 'isExist'> },
|
16
|
+
defaultScopeSlots?: { [k in keyof ScopeSlots]: Omit<ScopeSlots[k], 'isExist'> },
|
17
|
+
}
|
18
|
+
) {
|
19
|
+
const ret = {} as any;
|
20
|
+
|
21
|
+
!!defaultSlots && Object.entries(defaultSlots).forEach(([key, val]) => {ret[key] = val;});
|
22
|
+
!!defaultScopeSlots && Object.entries(defaultScopeSlots).forEach(([key, val]) => {ret[key] = val;});
|
23
|
+
|
24
|
+
!!slots && Object.keys(slots).forEach((k: keyof Slots) => {if (slots[k].isExist()) {ret[k] = () => slots[k]();}});
|
25
|
+
!!scopeSlots && Object.keys(scopeSlots).forEach((k: keyof ScopeSlots) => {if (scopeSlots[k].isExist()) {ret[k] = (...args: any[]) => scopeSlots[k](...args);}});
|
26
|
+
|
27
|
+
return ret;
|
28
|
+
}
|