|
@@ -1,71 +1,101 @@
|
|
|
-import { defaultStyle as iconDefStyle } from '@/core/components/icon'
|
|
|
-import { defaultStyle as rectDefStyle } from '@/core/components/rectangle'
|
|
|
-import { defaultStyle as circleDefStyle } from '@/core/components/circle'
|
|
|
-import { defaultStyle as triangleDefStyle } from '@/core/components/triangle'
|
|
|
-import { defaultStyle as arrowDefStyle } from '@/core/components/arrow'
|
|
|
-import { PaperKey } from '@/example/components/slide/actions'
|
|
|
-import { mergeFuns } from '@/utils/shared'
|
|
|
-import { getRealPixel } from './tabulation/gen-tab'
|
|
|
-import { defaultTableStyle } from '@/core/components/serial'
|
|
|
-import { Draw } from '@/example/components/container/use-draw'
|
|
|
+import { defaultStyle as iconDefStyle } from "@/core/components/icon";
|
|
|
+import { defaultStyle as rectDefStyle } from "@/core/components/rectangle";
|
|
|
+import { defaultStyle as circleDefStyle } from "@/core/components/circle";
|
|
|
+import { defaultStyle as triangleDefStyle } from "@/core/components/triangle";
|
|
|
+import { defaultStyle as arrowDefStyle } from "@/core/components/arrow";
|
|
|
+import { defaultStyle as serialDefStyle, defaultTableStyle as serialTableDefStyle } from "@/core/components/serial";
|
|
|
+import { defaultStyle as tableDefStyle } from "@/core/components/table";
|
|
|
+import { PaperKey } from "@/example/components/slide/actions";
|
|
|
+import { mergeFuns } from "@/utils/shared";
|
|
|
+import { getRealPixel } from "./tabulation/gen-tab";
|
|
|
+import { Draw } from "@/example/components/container/use-draw";
|
|
|
|
|
|
-const setDefStyle = <T extends {}>(sys: T, custom: Partial<T>) => {
|
|
|
- const backs: (() => void)[] = []
|
|
|
+const setDefStyle = <T extends {}>(
|
|
|
+ sys: T,
|
|
|
+ custom: Partial<T>,
|
|
|
+ itemKey?: string
|
|
|
+) => {
|
|
|
+ const backs: (() => void)[] = [];
|
|
|
for (const key in custom) {
|
|
|
- const oldVal = sys[key]
|
|
|
- sys[key] = custom[key]!
|
|
|
- backs.push(() => sys[key] = oldVal)
|
|
|
+ const oldVal = sys[key];
|
|
|
+ sys[key] = custom[key]!;
|
|
|
+ backs.push(() => {
|
|
|
+ sys[key] = oldVal;
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
- return mergeFuns(backs)
|
|
|
-}
|
|
|
+ return mergeFuns(backs);
|
|
|
+};
|
|
|
|
|
|
export const tabCustomStyle = (p: PaperKey, draw: Draw) => {
|
|
|
- draw.mountFilter.setMenusFilter('icon', (data) => {
|
|
|
- data.strokeWidth.props = {
|
|
|
- ...data.strokeWidth.props,
|
|
|
- proportion: true
|
|
|
- }
|
|
|
- return data
|
|
|
- })
|
|
|
+ const types = ["icon", "table", "serial"] as const;
|
|
|
+ types.forEach((type) => {
|
|
|
+ draw.mountFilter.setMenusFilter(type, (data) => {
|
|
|
+ data.strokeWidth.props = {
|
|
|
+ ...data.strokeWidth.props,
|
|
|
+ proportion: true,
|
|
|
+ };
|
|
|
+ return data;
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
const backs = [
|
|
|
() => {
|
|
|
- draw.mountFilter.setMenusFilter('icon')
|
|
|
+ types.forEach((type) => {
|
|
|
+ draw.mountFilter.setMenusFilter(type);
|
|
|
+ });
|
|
|
},
|
|
|
- setDefStyle(iconDefStyle, {
|
|
|
- width: getRealPixel(10, p),
|
|
|
- height: getRealPixel(10, p),
|
|
|
- strokeWidth: getRealPixel(1, p)
|
|
|
- } as any),
|
|
|
- setDefStyle(defaultTableStyle, {
|
|
|
- nameColWidth: defaultTableStyle.valueColWidth = getRealPixel(20, p),
|
|
|
+ setDefStyle(
|
|
|
+ iconDefStyle,
|
|
|
+ {
|
|
|
+ width: getRealPixel(10, p),
|
|
|
+ height: getRealPixel(10, p),
|
|
|
+ strokeWidth: getRealPixel(1, p),
|
|
|
+ } as any,
|
|
|
+ "icon"
|
|
|
+ ),
|
|
|
+ setDefStyle(serialDefStyle, {
|
|
|
+ nameColWidth: getRealPixel(20, p),
|
|
|
fontSize: getRealPixel(4, p),
|
|
|
padding: getRealPixel(2, p),
|
|
|
colHeight: getRealPixel(8, p),
|
|
|
+ strokeWidth: getRealPixel(1, p),
|
|
|
+ tableStrokeWidth: getRealPixel(2, p),
|
|
|
+ fill: null,
|
|
|
repColCount: 2,
|
|
|
- }),
|
|
|
- setDefStyle(rectDefStyle, {strokeWidth: getRealPixel(1, p)}),
|
|
|
- setDefStyle(circleDefStyle, {strokeWidth: getRealPixel(1, p)}),
|
|
|
- setDefStyle(triangleDefStyle, {strokeWidth: getRealPixel(1, p)}),
|
|
|
- setDefStyle(arrowDefStyle, {strokeWidth: getRealPixel(1, p)}),
|
|
|
- ]
|
|
|
- console.log(iconDefStyle)
|
|
|
+ } as any),
|
|
|
+ setDefStyle(serialTableDefStyle, {
|
|
|
+ tableStrokeWidth: getRealPixel(2, p),
|
|
|
+ } as any),
|
|
|
+ setDefStyle(tableDefStyle, { strokeWidth: getRealPixel(2, p) }),
|
|
|
+ setDefStyle(rectDefStyle, { strokeWidth: getRealPixel(1, p) }),
|
|
|
+ setDefStyle(circleDefStyle, { strokeWidth: getRealPixel(1, p) }),
|
|
|
+ setDefStyle(triangleDefStyle, { strokeWidth: getRealPixel(1, p) }),
|
|
|
+ setDefStyle(arrowDefStyle, { strokeWidth: getRealPixel(1, p) }),
|
|
|
+ ];
|
|
|
|
|
|
- return mergeFuns(backs)
|
|
|
-}
|
|
|
+ return mergeFuns(backs);
|
|
|
+};
|
|
|
|
|
|
export const overviewCustomStyle = (draw: Draw) => {
|
|
|
- draw.mountFilter.setMenusFilter('icon', (data) => {
|
|
|
+ draw.mountFilter.setMenusFilter("icon", (data) => {
|
|
|
data.strokeWidth.props = {
|
|
|
...data.strokeWidth.props,
|
|
|
- proportion: true
|
|
|
- }
|
|
|
- return data
|
|
|
- })
|
|
|
+ proportion: true,
|
|
|
+ };
|
|
|
+ return data;
|
|
|
+ });
|
|
|
const backs = [
|
|
|
() => {
|
|
|
- draw.mountFilter.setMenusFilter('icon')
|
|
|
- }
|
|
|
- ]
|
|
|
- return mergeFuns(backs)
|
|
|
-}
|
|
|
+ draw.mountFilter.setMenusFilter("icon");
|
|
|
+ },
|
|
|
+ setDefStyle(
|
|
|
+ iconDefStyle,
|
|
|
+ {
|
|
|
+ strokeWidth: 1,
|
|
|
+ } as any,
|
|
|
+ "icon"
|
|
|
+ ),
|
|
|
+ ];
|
|
|
+ return mergeFuns(backs);
|
|
|
+};
|