aldehyde 0.2.333 → 0.2.335

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.
Files changed (130) hide show
  1. package/lib/controls/rfield/index.js +1 -1
  2. package/lib/controls/rfield/index.js.map +1 -1
  3. package/lib/detail/button/inline-edit-button.d.ts +13 -0
  4. package/lib/detail/button/inline-edit-button.d.ts.map +1 -0
  5. package/lib/detail/button/inline-edit-button.js +17 -0
  6. package/lib/detail/button/inline-edit-button.js.map +1 -0
  7. package/lib/index.d.ts +2 -1
  8. package/lib/index.d.ts.map +1 -1
  9. package/lib/index.js +3 -1
  10. package/lib/index.js.map +1 -1
  11. package/lib/layout2/components/theme-button.js +1 -1
  12. package/lib/layout2/components/theme-button.js.map +1 -1
  13. package/lib/layout2/components/user-button.d.ts +2 -1
  14. package/lib/layout2/components/user-button.d.ts.map +1 -1
  15. package/lib/layout2/components/user-button.js +8 -2
  16. package/lib/layout2/components/user-button.js.map +1 -1
  17. package/lib/layout3/components/tabs-layout.js +1 -1
  18. package/lib/layout3/components/tabs-layout.js.map +1 -1
  19. package/lib/layout3/css/header.css +166 -138
  20. package/lib/layout3/css/main.css +74 -4
  21. package/lib/layout3/css/sider.css +5 -4
  22. package/lib/layout3/css/tabs-layout.css +1 -4
  23. package/lib/layout3/header.d.ts.map +1 -1
  24. package/lib/layout3/header.js +2 -1
  25. package/lib/layout3/header.js.map +1 -1
  26. package/lib/layout3/page.d.ts.map +1 -1
  27. package/lib/layout3/page.js +1 -1
  28. package/lib/layout3/page.js.map +1 -1
  29. package/lib/layout3/sider.js +1 -1
  30. package/lib/layout3/sider.js.map +1 -1
  31. package/lib/layout4/components/tabs-layout.d.ts +5 -0
  32. package/lib/layout4/components/tabs-layout.d.ts.map +1 -0
  33. package/lib/layout4/components/tabs-layout.js +68 -0
  34. package/lib/layout4/components/tabs-layout.js.map +1 -0
  35. package/lib/layout4/css/header.css +164 -0
  36. package/lib/layout4/css/main.css +119 -0
  37. package/lib/layout4/css/sider.css +11 -0
  38. package/lib/layout4/css/tabs-layout.css +43 -0
  39. package/lib/layout4/header.d.ts +11 -0
  40. package/lib/layout4/header.d.ts.map +1 -0
  41. package/lib/layout4/header.js +137 -0
  42. package/lib/layout4/header.js.map +1 -0
  43. package/lib/layout4/imgs/header-bg.png +0 -0
  44. package/lib/layout4/imgs/home.png +0 -0
  45. package/lib/layout4/imgs/menu-item-bg.png +0 -0
  46. package/lib/layout4/imgs/user.png +0 -0
  47. package/lib/layout4/main.d.ts +8 -0
  48. package/lib/layout4/main.d.ts.map +1 -0
  49. package/lib/layout4/main.js +14 -0
  50. package/lib/layout4/main.js.map +1 -0
  51. package/lib/layout4/page.d.ts +8 -0
  52. package/lib/layout4/page.d.ts.map +1 -0
  53. package/lib/layout4/page.js +60 -0
  54. package/lib/layout4/page.js.map +1 -0
  55. package/lib/layout4/sider.d.ts +10 -0
  56. package/lib/layout4/sider.d.ts.map +1 -0
  57. package/lib/layout4/sider.js +125 -0
  58. package/lib/layout4/sider.js.map +1 -0
  59. package/lib/lowcode-components/base-table/index.d.ts.map +1 -1
  60. package/lib/lowcode-components/base-table/index.js +9 -6
  61. package/lib/lowcode-components/base-table/index.js.map +1 -1
  62. package/lib/lowcode-components/lowcode-view/component/screen-fit/index.d.ts +0 -4
  63. package/lib/lowcode-components/lowcode-view/component/screen-fit/index.d.ts.map +1 -1
  64. package/lib/lowcode-components/lowcode-view/component/screen-fit/index.js +7 -5
  65. package/lib/lowcode-components/lowcode-view/component/screen-fit/index.js.map +1 -1
  66. package/lib/lowcode-components/lowcode-view/index.d.ts.map +1 -1
  67. package/lib/lowcode-components/lowcode-view/index.js +3 -8
  68. package/lib/lowcode-components/lowcode-view/index.js.map +1 -1
  69. package/lib/table/act-table.d.ts +8 -0
  70. package/lib/table/act-table.d.ts.map +1 -1
  71. package/lib/table/act-table.js +52 -13
  72. package/lib/table/act-table.js.map +1 -1
  73. package/lib/table/column/column-builder.d.ts.map +1 -1
  74. package/lib/table/column/column-builder.js +32 -8
  75. package/lib/table/column/column-builder.js.map +1 -1
  76. package/lib/table/relation-table.d.ts.map +1 -1
  77. package/lib/table/relation-table.js +2 -0
  78. package/lib/table/relation-table.js.map +1 -1
  79. package/lib/tmpl/hcservice-v3.d.ts +4 -0
  80. package/lib/tmpl/hcservice-v3.d.ts.map +1 -1
  81. package/lib/tmpl/hcservice-v3.js +6 -0
  82. package/lib/tmpl/hcservice-v3.js.map +1 -1
  83. package/lib/tmpl/interface.d.ts +6 -1
  84. package/lib/tmpl/interface.d.ts.map +1 -1
  85. package/lib/tmpl/interface.js.map +1 -1
  86. package/lib/tmpl/tmpl-config-analysis.d.ts.map +1 -1
  87. package/lib/tmpl/tmpl-config-analysis.js +2 -2
  88. package/lib/tmpl/tmpl-config-analysis.js.map +1 -1
  89. package/lib/tree/index.css +11 -9
  90. package/lib/tree/tmpl-tree.js +1 -1
  91. package/lib/tree/tmpl-tree.js.map +1 -1
  92. package/package.json +1 -1
  93. package/src/aldehyde/controls/rfield/index.tsx +1 -1
  94. package/src/aldehyde/detail/button/inline-edit-button.tsx +40 -0
  95. package/src/aldehyde/index.tsx +6 -1
  96. package/src/aldehyde/layout2/components/theme-button.tsx +1 -1
  97. package/src/aldehyde/layout2/components/user-button.tsx +23 -14
  98. package/src/aldehyde/layout3/components/tabs-layout.tsx +1 -1
  99. package/src/aldehyde/layout3/css/header.css +166 -138
  100. package/src/aldehyde/layout3/css/main.css +74 -4
  101. package/src/aldehyde/layout3/css/sider.css +5 -4
  102. package/src/aldehyde/layout3/css/tabs-layout.css +1 -4
  103. package/src/aldehyde/layout3/header.tsx +8 -6
  104. package/src/aldehyde/layout3/page.tsx +1 -0
  105. package/src/aldehyde/layout3/sider.tsx +1 -1
  106. package/src/aldehyde/layout4/components/tabs-layout.tsx +106 -0
  107. package/src/aldehyde/layout4/css/header.css +164 -0
  108. package/src/aldehyde/layout4/css/main.css +119 -0
  109. package/src/aldehyde/layout4/css/sider.css +11 -0
  110. package/src/aldehyde/layout4/css/tabs-layout.css +43 -0
  111. package/src/aldehyde/layout4/header.tsx +182 -0
  112. package/src/aldehyde/layout4/imgs/header-bg.png +0 -0
  113. package/src/aldehyde/layout4/imgs/home.png +0 -0
  114. package/src/aldehyde/layout4/imgs/menu-item-bg.png +0 -0
  115. package/src/aldehyde/layout4/imgs/user.png +0 -0
  116. package/src/aldehyde/layout4/imgs/user.svg +27 -0
  117. package/src/aldehyde/layout4/main.tsx +27 -0
  118. package/src/aldehyde/layout4/page.tsx +91 -0
  119. package/src/aldehyde/layout4/sider.tsx +178 -0
  120. package/src/aldehyde/lowcode-components/base-table/index.tsx +22 -19
  121. package/src/aldehyde/lowcode-components/lowcode-view/component/screen-fit/index.tsx +7 -10
  122. package/src/aldehyde/lowcode-components/lowcode-view/index.tsx +2 -7
  123. package/src/aldehyde/table/act-table.tsx +275 -229
  124. package/src/aldehyde/table/column/column-builder.tsx +550 -505
  125. package/src/aldehyde/table/relation-table.tsx +1 -0
  126. package/src/aldehyde/tmpl/hcservice-v3.tsx +16 -0
  127. package/src/aldehyde/tmpl/interface.tsx +6 -1
  128. package/src/aldehyde/tmpl/tmpl-config-analysis.tsx +6 -6
  129. package/src/aldehyde/tree/index.css +11 -9
  130. package/src/aldehyde/tree/tmpl-tree.tsx +1 -1
@@ -0,0 +1,178 @@
1
+ import { ConfigProvider, Layout, Menu, MenuProps, Space, Tooltip, theme } from "antd";
2
+ import React, { useEffect, useRef, useState } from "react";
3
+ import { NavLink, useParams, useSearchParams } from "react-router-dom";
4
+ import {
5
+ getLeftMostRouteInfo,
6
+ getTargetMenuItemIdRouteList,
7
+ handlePropsMenuToAntdMenu,
8
+ } from "../layout2/util/menu-util";
9
+ import { useLayoutContext } from "../layout2/layout-context";
10
+ import { MenuType } from "../layout2/type/layout-type";
11
+ import { useLocale } from "../locale/useLocale";
12
+ import IconFont from "../layout2/components/icon-font";
13
+ import "./css/sider.css"
14
+
15
+ type SiderPropsType = {
16
+ menuList: MenuType[];
17
+ collapsed: boolean;
18
+ };
19
+
20
+ type MenuItem = Required<MenuProps>["items"][number];
21
+ type SecoundFloorMenuList = MenuType[][];
22
+
23
+ /**
24
+ * @param menuList 自定义的menu
25
+ * @returns 下标为 n 对应第 n 个根节点对应的第二层级menu
26
+ * @desc 获取第二层级 menu 与其下标映射的数组
27
+ */
28
+ const getSecoundFloorMenuList = (
29
+ menuList: MenuType[]
30
+ ): SecoundFloorMenuList => {
31
+ const secoundFloorMenuList: SecoundFloorMenuList = Array.from({
32
+ length: menuList.length,
33
+ }).map(() => Array.from({ length: 0 }));
34
+
35
+ for (let i = 0; i < menuList.length; i++) {
36
+ const menuItem = menuList[i];
37
+ Array.isArray(menuItem.children) &&
38
+ (secoundFloorMenuList[i] = menuItem.children);
39
+ }
40
+ return secoundFloorMenuList;
41
+ };
42
+
43
+ const { useToken } = theme;
44
+
45
+ const Sider: React.FC<SiderPropsType> = ({ menuList, collapsed }) => {
46
+ const { setDocumentTitle, menuItemIdToFirstFloorIdxMap } = useLayoutContext();
47
+ const { translate, getLocale } = useLocale();
48
+ const secoundFloorMenuList = useRef<SecoundFloorMenuList>([]);
49
+ const [menu, setMenu] = useState<MenuItem[]>([]);
50
+ // menu select
51
+ const [selectedKeys, setSelectedKeys] = useState([]);
52
+ const [openKeys, setOpenKeys] = useState([]);
53
+ const { sourceId } = useParams();
54
+ const [search] = useSearchParams();
55
+ const menuId: string = search.get("menuId");
56
+ const { token: { colorPrimary } } = useToken();
57
+
58
+ useEffect(() => {
59
+ secoundFloorMenuList.current = getSecoundFloorMenuList(menuList);
60
+ }, [menuList]);
61
+
62
+ // menu
63
+ const getMenuWithSecoundFloor = (secoundFloorMenu: SecoundFloorMenuList[number]) => {
64
+ return handlePropsMenuToAntdMenu(secoundFloorMenu, (menuItem) => {
65
+ const { disabled, label, children, icon } = menuItem;
66
+ const renderIcon = icon ? <IconFont type={icon} /> : "";
67
+ if (disabled)
68
+ return (
69
+ <div
70
+ style={{
71
+ color: "inherit",
72
+ width: "100%",
73
+ height: "100%",
74
+ display: "block",
75
+ }}
76
+ >
77
+ {translate("${" + label + "}")}
78
+ </div>
79
+ );
80
+ const { path, target } = getLeftMostRouteInfo(menuItem);
81
+ if (Array.isArray(children) && !children.length)
82
+ return (
83
+ <Tooltip title={translate("${" + label + "}")}>
84
+ <NavLink
85
+ to={`/${path}`}
86
+ target={target}
87
+ style={{
88
+ color: "inherit",
89
+ width: "100%",
90
+ height: "100%",
91
+ display: "block",
92
+ textOverflow: "ellipsis",
93
+ overflow: "hidden",
94
+ }}
95
+ >
96
+ <Space size={"small"}>{renderIcon}{translate("${" + label + "}")}</Space>
97
+ </NavLink>
98
+ </Tooltip>
99
+ );
100
+ return <Space size={"small"}>{renderIcon}{translate("${" + label + "}")}</Space>;
101
+ });
102
+ };
103
+
104
+ useEffect(() => {
105
+ if (!menuList.length) {
106
+ setMenu([]);
107
+ return;
108
+ }
109
+ const targetId =
110
+ menuId !== undefined ? menuId : sourceId !== undefined ? sourceId : null;
111
+ if (!targetId) return;
112
+ const curSiderMenuList =
113
+ secoundFloorMenuList.current[menuItemIdToFirstFloorIdxMap[targetId]];
114
+ if (curSiderMenuList) {
115
+ setMenu(getMenuWithSecoundFloor(curSiderMenuList));
116
+ const temIds = getTargetMenuItemIdRouteList(curSiderMenuList, targetId);
117
+ setTimeout(() => {
118
+ setSelectedKeys(temIds);
119
+ setOpenKeys(temIds);
120
+ }, 10);
121
+ }
122
+ }, [sourceId, menuId, menuList, getLocale()]);
123
+
124
+ // default select keys
125
+ useEffect(() => {
126
+ if (sourceId === undefined) {
127
+ if (secoundFloorMenuList.current[0] !== undefined) {
128
+ setMenu(getMenuWithSecoundFloor(secoundFloorMenuList.current[0]));
129
+ setSelectedKeys([]);
130
+ setOpenKeys([]);
131
+ }
132
+ setDocumentTitle("");
133
+ } else {
134
+ const documentTitle =
135
+ menuList[menuItemIdToFirstFloorIdxMap[sourceId]]?.label;
136
+ setDocumentTitle(translate("${" + documentTitle + "}"));
137
+ }
138
+ }, [menuList, sourceId, getLocale()]);
139
+
140
+ return (
141
+ <Layout.Sider
142
+ collapsed={collapsed}
143
+ collapsedWidth={0}
144
+ width={200}
145
+ className="v4-layout-sider"
146
+ >
147
+ <ConfigProvider
148
+ theme={{
149
+ components: {
150
+ Menu: {
151
+ itemBg: "transparent",
152
+ itemColor: colorPrimary,
153
+ itemSelectedColor: "#ffffff",
154
+ fontSize: 14,
155
+ subMenuItemBg: "transparent",
156
+ subMenuItemSelectedColor: "#ffffff"
157
+ },
158
+ },
159
+ }}
160
+ >
161
+ <Menu
162
+ mode="inline"
163
+ items={menu}
164
+ selectedKeys={selectedKeys}
165
+ openKeys={openKeys}
166
+ inlineCollapsed={false}
167
+ style={{
168
+ userSelect: "none",
169
+ borderInlineEnd: "none"
170
+ }}
171
+ onOpenChange={(val) => setOpenKeys([...val])}
172
+ />
173
+ </ConfigProvider>
174
+ </Layout.Sider>
175
+ );
176
+ };
177
+
178
+ export default Sider;
@@ -1,5 +1,6 @@
1
1
  import React, { ForwardedRef, forwardRef, useEffect, useImperativeHandle, useRef, useState } from 'react';
2
2
  import _ from "lodash";
3
+ import { ConfigProvider } from "antd";
3
4
  import HcserviceV3 from "../../tmpl/hcservice-v3";
4
5
  import { DataConfigProps } from "../data";
5
6
  import { ViewControl } from "../../index";
@@ -213,22 +214,10 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
213
214
  <tr >
214
215
  <td colSpan={columns?.length}>{renderEmpty()}</td>
215
216
  </tr>
216
- </tbody> : <>
217
- <tbody style={{ ...bodyStyle, animation: carousel.enable && data?.length > bodyStyle.pageSize ? `scroll ${carousel.speed || 3}s linear infinite` : `none` }} className="scroll-body" >
218
- {data?.map((item: Record<string, any>, index: number) => <tr key={index} className={'base-table-tr'}>
219
- {columns?.map((column: ITableColumn, i: number) =>
220
- <td key={i} style={{ textAlign: column.valueAlign }}>
221
- <ViewControl
222
- serverKey={dataConfig?.serverKey}
223
- fieldConfig={column}
224
- value={item[column.dataIndex]}
225
- holderType={"table"}
226
- />
227
- </td>)}
228
- </tr>)}
229
- </tbody>
230
- {(data?.length > bodyStyle.pageSize) && carousel.enable &&
231
- <tbody style={{ ...bodyStyle, animation: `scroll ${carousel.speed || 3}s linear infinite` }} className="scroll-body" >
217
+ </tbody> :
218
+ // 表格antd组件样式兼容
219
+ <ConfigProvider badge={{ style: { color: bodyStyle.color || "#000000" } }}>
220
+ <tbody style={{ ...bodyStyle, animation: carousel.enable && data?.length > bodyStyle.pageSize ? `scroll ${carousel.speed || 3}s linear infinite` : `none` }} className="scroll-body" >
232
221
  {data?.map((item: Record<string, any>, index: number) => <tr key={index} className={'base-table-tr'}>
233
222
  {columns?.map((column: ITableColumn, i: number) =>
234
223
  <td key={i} style={{ textAlign: column.valueAlign }}>
@@ -237,11 +226,25 @@ const Index = forwardRef((props: ComponentProps, ref: ForwardedRef<ComponentRef>
237
226
  fieldConfig={column}
238
227
  value={item[column.dataIndex]}
239
228
  holderType={"table"}
240
- /></td>)}
229
+ />
230
+ </td>)}
241
231
  </tr>)}
242
232
  </tbody>
243
- }
244
- </>}
233
+ {(data?.length > bodyStyle.pageSize) && carousel.enable &&
234
+ <tbody style={{ ...bodyStyle, animation: `scroll ${carousel.speed || 3}s linear infinite` }} className="scroll-body" >
235
+ {data?.map((item: Record<string, any>, index: number) => <tr key={index} className={'base-table-tr'}>
236
+ {columns?.map((column: ITableColumn, i: number) =>
237
+ <td key={i} style={{ textAlign: column.valueAlign }}>
238
+ <ViewControl
239
+ serverKey={dataConfig?.serverKey}
240
+ fieldConfig={column}
241
+ value={item[column.dataIndex]}
242
+ holderType={"table"}
243
+ /></td>)}
244
+ </tr>)}
245
+ </tbody>
246
+ }
247
+ </ConfigProvider>}
245
248
  </table>
246
249
  }
247
250
  </div>
@@ -11,17 +11,14 @@ interface ScreenFitProps {
11
11
  delay?: number,
12
12
  mode?: AdaptationType,
13
13
  scaleChange?: (xScale: number, yScale: number) => void,
14
- containerStyle: {
15
- width: number,
16
- height: number,
17
- },
18
14
  }
19
15
 
20
16
 
21
17
  export default function ScreenFit(props: ScreenFitProps) {
22
- const { width, height, bodyOverflowHidden = true, delay = 500, scaleChange, containerStyle } = props
18
+ const { width, height, bodyOverflowHidden = true, delay = 200, scaleChange } = props
23
19
  let bodyOverflow: string
24
- const elRef = useRef<HTMLDivElement>(null)
20
+ const elRef = useRef<HTMLDivElement>(null);
21
+ const canvasRef = useRef(null);
25
22
  const [size, setSize] = useState({ width, height, originalHeight: 0, originalWidth: 0 })
26
23
 
27
24
  let observer: MutationObserver;
@@ -38,8 +35,8 @@ export default function ScreenFit(props: ScreenFitProps) {
38
35
 
39
36
  function updateScale() {
40
37
  // 获取真实视口尺寸
41
- const currentWidth = containerStyle.width || 0;
42
- const currentHeight = containerStyle.height || 0;
38
+ const currentWidth = canvasRef.current?.clientWidth || 0;
39
+ const currentHeight = canvasRef.current?.clientHeight || 0;
43
40
  // 获取大屏最终的宽高
44
41
  const realWidth = size.width || size.originalWidth;
45
42
  const realHeight = size.height || size.originalHeight;
@@ -76,7 +73,7 @@ export default function ScreenFit(props: ScreenFitProps) {
76
73
  }
77
74
 
78
75
  const onResize = debounce(() => {
79
- if (!elRef.current) return;
76
+ if (!elRef.current && !canvasRef.current) return;
80
77
  updateSize();
81
78
  updateScale();
82
79
  }, delay)
@@ -113,7 +110,7 @@ export default function ScreenFit(props: ScreenFitProps) {
113
110
  }, [])
114
111
 
115
112
  return (
116
- <div className={'react-screen-box'}>
113
+ <div ref={canvasRef} className={'react-screen-box'}>
117
114
  <div className={'screen-wrapper'} ref={elRef}>
118
115
  {props.children}
119
116
  </div>
@@ -1,4 +1,4 @@
1
- import React, { CSSProperties, useEffect, useState, useRef, createContext } from 'react'
1
+ import React, { CSSProperties, useEffect, useState, createContext } from 'react'
2
2
  import { useParams } from 'react-router-dom';
3
3
  import isEqual from "lodash/isEqual";
4
4
  import chunk from "lodash/chunk";
@@ -39,7 +39,6 @@ interface Props {
39
39
  const LowcodeView = (props: Props) => {
40
40
  const { isFullScreen } = props;
41
41
  const { ddpageId } = useParams();
42
- const canvasRef = useRef(null);
43
42
  const [loading, setLoading] = useState<boolean>(false);
44
43
  const [layerManager, setLayerManager] = useState<LayerManagerDataType>();
45
44
  const [canvasConfig, setCanvasConfig] = useState<CanvasConfig>();
@@ -146,7 +145,7 @@ const LowcodeView = (props: Props) => {
146
145
 
147
146
  return (
148
147
  <ControllerContext.Provider value={{ setControllers }}>
149
- <div ref={canvasRef} className='lowcodeView' style={{ height: isFullScreen ? "100vh" : "calc(100vh - 121px)", ...screenFitStyleMap[adaptationType || "scale"] }}>
148
+ <div className='lowcodeView' style={{ height: isFullScreen ? "100vh" : "calc(100vh - 121px)", ...screenFitStyleMap[adaptationType || "scale"] }}>
150
149
  {loading || !layerManager ?
151
150
  <Loading />
152
151
  :
@@ -155,10 +154,6 @@ const LowcodeView = (props: Props) => {
155
154
  width={width}
156
155
  height={height}
157
156
  mode={adaptationType}
158
- containerStyle={{
159
- width: canvasRef.current?.clientWidth,
160
- height: canvasRef.current?.clientHeight
161
- }}
162
157
  >
163
158
  {canvasDom()}
164
159
  </ScreenFit>)