@next-bricks/visual-builder 0.2.3 → 0.3.0

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 (171) hide show
  1. package/dist/bricks.json +6 -1
  2. package/dist/chunks/1646.1f7cb786.js +2 -0
  3. package/dist/chunks/1646.1f7cb786.js.map +1 -0
  4. package/dist/chunks/2024.c21ef9ab.js +2 -0
  5. package/dist/chunks/2024.c21ef9ab.js.map +1 -0
  6. package/dist/chunks/2108.3533f319.js +2 -0
  7. package/dist/chunks/2108.3533f319.js.map +1 -0
  8. package/dist/chunks/2255.eeeb50de.js +2 -0
  9. package/dist/chunks/2255.eeeb50de.js.map +1 -0
  10. package/dist/chunks/2323.87f82188.js +2 -0
  11. package/dist/chunks/2323.87f82188.js.map +1 -0
  12. package/dist/chunks/2754.8eacc0dd.js +2 -0
  13. package/dist/chunks/2754.8eacc0dd.js.map +1 -0
  14. package/dist/chunks/2784.5d899d00.js +2 -0
  15. package/dist/chunks/2993.b7cd44ac.js +2 -0
  16. package/dist/chunks/2993.b7cd44ac.js.map +1 -0
  17. package/dist/chunks/3458.5f8a0115.js +2 -0
  18. package/dist/chunks/3458.5f8a0115.js.map +1 -0
  19. package/dist/chunks/3516.5a9e1d3b.js +3 -0
  20. package/dist/chunks/3516.5a9e1d3b.js.map +1 -0
  21. package/dist/chunks/3914.28d96b38.js +2 -0
  22. package/dist/chunks/3914.28d96b38.js.map +1 -0
  23. package/dist/chunks/4049.162550b0.js +2 -0
  24. package/dist/chunks/4049.162550b0.js.map +1 -0
  25. package/dist/chunks/4454.9b2242d9.js +2 -0
  26. package/dist/chunks/4454.9b2242d9.js.map +1 -0
  27. package/dist/chunks/4717.50a5d119.js +2 -0
  28. package/dist/chunks/4717.50a5d119.js.map +1 -0
  29. package/dist/chunks/4728.28e9ff8b.js +2 -0
  30. package/dist/chunks/4728.28e9ff8b.js.map +1 -0
  31. package/dist/chunks/5151.64868234.js +2 -0
  32. package/dist/chunks/5151.64868234.js.map +1 -0
  33. package/dist/chunks/5202.4daa0da0.js +2 -0
  34. package/dist/chunks/5202.4daa0da0.js.map +1 -0
  35. package/dist/chunks/5628.dead23b0.js +2 -0
  36. package/dist/chunks/5628.dead23b0.js.map +1 -0
  37. package/dist/chunks/5637.1c2d8816.js +2 -0
  38. package/dist/chunks/5637.1c2d8816.js.map +1 -0
  39. package/dist/chunks/6205.94095db4.js +2 -0
  40. package/dist/chunks/6205.94095db4.js.map +1 -0
  41. package/dist/chunks/6473.43cc6a8e.js +2 -0
  42. package/dist/chunks/6473.43cc6a8e.js.map +1 -0
  43. package/dist/chunks/6635.d0184ca5.js +3 -0
  44. package/dist/chunks/6635.d0184ca5.js.map +1 -0
  45. package/dist/chunks/7110.47509cab.js +2 -0
  46. package/dist/chunks/7110.47509cab.js.map +1 -0
  47. package/dist/chunks/7164.e6387b6f.js +2 -0
  48. package/dist/chunks/7164.e6387b6f.js.map +1 -0
  49. package/dist/chunks/7746.1a6a4b8f.js +2 -0
  50. package/dist/chunks/7746.1a6a4b8f.js.map +1 -0
  51. package/dist/chunks/7915.375e4b05.js +2 -0
  52. package/dist/chunks/7915.375e4b05.js.map +1 -0
  53. package/dist/chunks/8008.5fbc952c.js +3 -0
  54. package/dist/chunks/8008.5fbc952c.js.map +1 -0
  55. package/dist/chunks/8316.f28802f7.js +2 -0
  56. package/dist/chunks/8691.e37d630f.js +2 -0
  57. package/dist/chunks/8691.e37d630f.js.map +1 -0
  58. package/dist/chunks/873.4474344a.js +2 -0
  59. package/dist/chunks/{873.591f7647.js.map → 873.4474344a.js.map} +1 -1
  60. package/dist/chunks/9185.e663a4fa.js +2 -0
  61. package/dist/chunks/9185.e663a4fa.js.map +1 -0
  62. package/dist/chunks/9431.b1452fd7.js +2 -0
  63. package/dist/chunks/9431.b1452fd7.js.map +1 -0
  64. package/dist/chunks/9549.7a740eb0.js +2 -0
  65. package/dist/chunks/9549.7a740eb0.js.map +1 -0
  66. package/dist/chunks/main.c749570c.js +2 -0
  67. package/dist/chunks/main.c749570c.js.map +1 -0
  68. package/dist/chunks/workbench-action-list.30a8dd89.js +2 -0
  69. package/dist/chunks/{workbench-action-list.7ff907fe.js.map → workbench-action-list.30a8dd89.js.map} +1 -1
  70. package/dist/chunks/workbench-action.62cf3827.js +3 -0
  71. package/dist/chunks/{workbench-action.be09a1b2.js.map → workbench-action.62cf3827.js.map} +1 -1
  72. package/dist/chunks/workbench-pane.7a0b00a4.js +3 -0
  73. package/dist/chunks/workbench-pane.7a0b00a4.js.map +1 -0
  74. package/dist/chunks/workbench-sidebar.7ceb3241.js +2 -0
  75. package/dist/chunks/workbench-sidebar.7ceb3241.js.map +1 -0
  76. package/dist/chunks/workbench-tree.ef7e9a45.js +2 -0
  77. package/dist/chunks/workbench-tree.ef7e9a45.js.map +1 -0
  78. package/dist/index.3b3d558d.js +2 -0
  79. package/dist/index.3b3d558d.js.map +1 -0
  80. package/dist/manifest.json +216 -0
  81. package/dist-types/bootstrap.d.ts +1 -0
  82. package/dist-types/interfaces.d.ts +33 -0
  83. package/dist-types/shared/workbench/WorkbenchActionsContext.d.ts +10 -0
  84. package/dist-types/shared/workbench/WorkbenchTree.d.ts +36 -0
  85. package/dist-types/shared/workbench/WorkbenchTree.spec.d.ts +1 -0
  86. package/dist-types/shared/workbench/WorkbenchTreeContext.d.ts +31 -0
  87. package/dist-types/shared/workbench/WorkbenchTreeDndContext.d.ts +20 -0
  88. package/dist-types/shared/workbench-mini-action-bar/WorkbenchMiniActionBar.d.ts +15 -0
  89. package/dist-types/shared/workbench-mini-action-bar/WorkbenchMiniActionBar.spec.d.ts +1 -0
  90. package/dist-types/utils/deepMatch.d.ts +2 -0
  91. package/dist-types/utils/deepMatch.spec.d.ts +1 -0
  92. package/dist-types/utils/normalizeTreeNodeWithPath.d.ts +3 -0
  93. package/dist-types/utils/normalizeTreeNodeWithPath.spec.d.ts +1 -0
  94. package/dist-types/utils/setDragImage.d.ts +2 -0
  95. package/dist-types/workbench-tree/index.d.ts +35 -0
  96. package/dist-types/workbench-tree/index.spec.d.ts +1 -0
  97. package/package.json +7 -4
  98. package/dist/chunks/110.ccb7f4ac.js +0 -2
  99. package/dist/chunks/110.ccb7f4ac.js.map +0 -1
  100. package/dist/chunks/151.87571956.js +0 -2
  101. package/dist/chunks/151.87571956.js.map +0 -1
  102. package/dist/chunks/164.b670956e.js +0 -2
  103. package/dist/chunks/164.b670956e.js.map +0 -1
  104. package/dist/chunks/202.22c83af5.js +0 -2
  105. package/dist/chunks/202.22c83af5.js.map +0 -1
  106. package/dist/chunks/205.b8a43bd2.js +0 -2
  107. package/dist/chunks/205.b8a43bd2.js.map +0 -1
  108. package/dist/chunks/24.10efe4b7.js +0 -2
  109. package/dist/chunks/24.10efe4b7.js.map +0 -1
  110. package/dist/chunks/255.97a762fc.js +0 -2
  111. package/dist/chunks/255.97a762fc.js.map +0 -1
  112. package/dist/chunks/316.4d9f5c86.js +0 -2
  113. package/dist/chunks/323.34d6bd43.js +0 -2
  114. package/dist/chunks/323.34d6bd43.js.map +0 -1
  115. package/dist/chunks/431.ae29ef4b.js +0 -2
  116. package/dist/chunks/431.ae29ef4b.js.map +0 -1
  117. package/dist/chunks/454.c0760d73.js +0 -2
  118. package/dist/chunks/454.c0760d73.js.map +0 -1
  119. package/dist/chunks/458.cf76e3e0.js +0 -2
  120. package/dist/chunks/458.cf76e3e0.js.map +0 -1
  121. package/dist/chunks/473.923b3482.js +0 -2
  122. package/dist/chunks/473.923b3482.js.map +0 -1
  123. package/dist/chunks/49.852046ea.js +0 -2
  124. package/dist/chunks/49.852046ea.js.map +0 -1
  125. package/dist/chunks/527.5be42cf3.js +0 -3
  126. package/dist/chunks/527.5be42cf3.js.map +0 -1
  127. package/dist/chunks/549.8a556102.js +0 -2
  128. package/dist/chunks/549.8a556102.js.map +0 -1
  129. package/dist/chunks/635.a5f074b7.js +0 -3
  130. package/dist/chunks/635.a5f074b7.js.map +0 -1
  131. package/dist/chunks/637.fe68fbac.js +0 -2
  132. package/dist/chunks/637.fe68fbac.js.map +0 -1
  133. package/dist/chunks/646.5b6a2c5f.js +0 -2
  134. package/dist/chunks/646.5b6a2c5f.js.map +0 -1
  135. package/dist/chunks/691.ded64677.js +0 -2
  136. package/dist/chunks/691.ded64677.js.map +0 -1
  137. package/dist/chunks/717.a73ab4bb.js +0 -2
  138. package/dist/chunks/717.a73ab4bb.js.map +0 -1
  139. package/dist/chunks/728.b89311bf.js +0 -2
  140. package/dist/chunks/728.b89311bf.js.map +0 -1
  141. package/dist/chunks/746.d7fd7ff7.js +0 -2
  142. package/dist/chunks/746.d7fd7ff7.js.map +0 -1
  143. package/dist/chunks/754.49431b88.js +0 -2
  144. package/dist/chunks/754.49431b88.js.map +0 -1
  145. package/dist/chunks/784.27ac6201.js +0 -2
  146. package/dist/chunks/8.cbc77394.js +0 -3
  147. package/dist/chunks/8.cbc77394.js.map +0 -1
  148. package/dist/chunks/873.591f7647.js +0 -2
  149. package/dist/chunks/914.faee1705.js +0 -2
  150. package/dist/chunks/914.faee1705.js.map +0 -1
  151. package/dist/chunks/915.41736988.js +0 -2
  152. package/dist/chunks/915.41736988.js.map +0 -1
  153. package/dist/chunks/993.39861397.js +0 -2
  154. package/dist/chunks/993.39861397.js.map +0 -1
  155. package/dist/chunks/main.914e7ea4.js +0 -2
  156. package/dist/chunks/main.914e7ea4.js.map +0 -1
  157. package/dist/chunks/workbench-action-list.7ff907fe.js +0 -2
  158. package/dist/chunks/workbench-action.be09a1b2.js +0 -3
  159. package/dist/chunks/workbench-pane.485873c1.js +0 -3
  160. package/dist/chunks/workbench-pane.485873c1.js.map +0 -1
  161. package/dist/chunks/workbench-sidebar.17518310.js +0 -2
  162. package/dist/chunks/workbench-sidebar.17518310.js.map +0 -1
  163. package/dist/index.1ee7377f.js +0 -2
  164. package/dist/index.1ee7377f.js.map +0 -1
  165. /package/dist/chunks/{784.27ac6201.js.LICENSE.txt → 2784.5d899d00.js.LICENSE.txt} +0 -0
  166. /package/dist/chunks/{527.5be42cf3.js.LICENSE.txt → 3516.5a9e1d3b.js.LICENSE.txt} +0 -0
  167. /package/dist/chunks/{635.a5f074b7.js.LICENSE.txt → 6635.d0184ca5.js.LICENSE.txt} +0 -0
  168. /package/dist/chunks/{8.cbc77394.js.LICENSE.txt → 8008.5fbc952c.js.LICENSE.txt} +0 -0
  169. /package/dist/chunks/{316.4d9f5c86.js.LICENSE.txt → 8316.f28802f7.js.LICENSE.txt} +0 -0
  170. /package/dist/chunks/{workbench-action.be09a1b2.js.LICENSE.txt → workbench-action.62cf3827.js.LICENSE.txt} +0 -0
  171. /package/dist/chunks/{workbench-pane.485873c1.js.LICENSE.txt → workbench-pane.7a0b00a4.js.LICENSE.txt} +0 -0
@@ -0,0 +1,216 @@
1
+ {
2
+ "manifest_version": 1,
3
+ "package": "@next-bricks/visual-builder",
4
+ "name": "visual-builder",
5
+ "bricks": [
6
+ {
7
+ "name": "visual-builder.workbench-pane",
8
+ "properties": [
9
+ {
10
+ "name": "titleLabel",
11
+ "type": "string"
12
+ },
13
+ {
14
+ "name": "active",
15
+ "type": "boolean"
16
+ },
17
+ {
18
+ "name": "badge",
19
+ "type": "number"
20
+ }
21
+ ],
22
+ "events": [
23
+ {
24
+ "name": "active.change",
25
+ "detail": {
26
+ "type": "boolean"
27
+ }
28
+ },
29
+ {
30
+ "name": "active.firstActivated",
31
+ "detail": {
32
+ "type": "void"
33
+ }
34
+ }
35
+ ],
36
+ "slots": [],
37
+ "methods": []
38
+ },
39
+ {
40
+ "name": "visual-builder.workbench-sidebar",
41
+ "properties": [
42
+ {
43
+ "name": "titleLabel",
44
+ "type": "string"
45
+ }
46
+ ],
47
+ "events": [],
48
+ "slots": [],
49
+ "methods": []
50
+ },
51
+ {
52
+ "name": "visual-builder.workbench-tree",
53
+ "properties": [
54
+ {
55
+ "name": "nodes",
56
+ "attribute": false,
57
+ "type": "WorkbenchNodeData[]"
58
+ },
59
+ {
60
+ "name": "actions",
61
+ "attribute": false,
62
+ "type": "WorkbenchTreeAction[]"
63
+ },
64
+ {
65
+ "name": "actionsHidden",
66
+ "type": "boolean"
67
+ },
68
+ {
69
+ "name": "placeholder",
70
+ "type": "string"
71
+ },
72
+ {
73
+ "name": "isTransformName",
74
+ "type": "boolean"
75
+ },
76
+ {
77
+ "name": "searchPlaceholder",
78
+ "type": "string"
79
+ },
80
+ {
81
+ "name": "noSearch",
82
+ "type": "boolean"
83
+ },
84
+ {
85
+ "name": "activeKey",
86
+ "attribute": false,
87
+ "type": "string | number"
88
+ },
89
+ {
90
+ "name": "showMatchedNodeOnly",
91
+ "type": "boolean"
92
+ },
93
+ {
94
+ "name": "matchNodeDataFields",
95
+ "attribute": false,
96
+ "type": "string | string[]"
97
+ },
98
+ {
99
+ "name": "fixedActionsFor",
100
+ "attribute": false,
101
+ "type": "Record<string, unknown> | Record<string, unknown>[]"
102
+ },
103
+ {
104
+ "name": "collapsible",
105
+ "type": "boolean"
106
+ },
107
+ {
108
+ "name": "collapsedNodes",
109
+ "attribute": false,
110
+ "type": "string[]"
111
+ },
112
+ {
113
+ "name": "allowDrag",
114
+ "type": "boolean"
115
+ },
116
+ {
117
+ "name": "allowDragToRoot",
118
+ "type": "boolean"
119
+ },
120
+ {
121
+ "name": "allowDragToInside",
122
+ "type": "boolean"
123
+ },
124
+ {
125
+ "name": "nodeKey",
126
+ "type": "string"
127
+ },
128
+ {
129
+ "name": "skipNotify",
130
+ "type": "boolean"
131
+ }
132
+ ],
133
+ "events": [
134
+ {
135
+ "name": "action.click",
136
+ "detail": {
137
+ "type": "ActionClickDetail"
138
+ }
139
+ },
140
+ {
141
+ "name": "node.click",
142
+ "detail": {
143
+ "type": "unknown"
144
+ }
145
+ },
146
+ {
147
+ "name": "node.drop",
148
+ "detail": {
149
+ "type": "any"
150
+ }
151
+ },
152
+ {
153
+ "name": "context.menu",
154
+ "detail": {
155
+ "type": "unknown"
156
+ }
157
+ },
158
+ {
159
+ "name": "node.toggle",
160
+ "detail": {
161
+ "type": "{\n nodeId: string;\n collapsed: boolean;\n }"
162
+ }
163
+ }
164
+ ],
165
+ "slots": [],
166
+ "methods": [],
167
+ "description": ""
168
+ },
169
+ {
170
+ "name": "visual-builder.workbench-action",
171
+ "properties": [
172
+ {
173
+ "name": "icon",
174
+ "attribute": false,
175
+ "type": "GeneralIconProps"
176
+ },
177
+ {
178
+ "name": "to",
179
+ "type": "string"
180
+ },
181
+ {
182
+ "name": "active",
183
+ "type": "boolean"
184
+ },
185
+ {
186
+ "name": "href",
187
+ "type": "string"
188
+ },
189
+ {
190
+ "name": "target",
191
+ "type": "string"
192
+ }
193
+ ],
194
+ "events": [],
195
+ "slots": [],
196
+ "methods": []
197
+ },
198
+ {
199
+ "name": "visual-builder.workbench-action-list",
200
+ "properties": [
201
+ {
202
+ "name": "appId",
203
+ "type": "string"
204
+ },
205
+ {
206
+ "name": "menu",
207
+ "attribute": false,
208
+ "type": "SidebarMenu"
209
+ }
210
+ ],
211
+ "events": [],
212
+ "slots": [],
213
+ "methods": []
214
+ }
215
+ ]
216
+ }
@@ -2,3 +2,4 @@ import "./workbench-pane/index.js";
2
2
  import "./workbench-sidebar/index.js";
3
3
  import "./workbench-action/index.js";
4
4
  import "./workbench-action-list/index.js";
5
+ import "./workbench-tree/index.js";
@@ -0,0 +1,33 @@
1
+ import { GeneralIconProps } from "@next-bricks/icons/general-icon";
2
+ export interface WorkbenchNodeData<T = unknown> {
3
+ if?: boolean;
4
+ key: string | number;
5
+ name: string;
6
+ icon?: GeneralIconProps;
7
+ data?: T;
8
+ labelColor?: string;
9
+ link?: {
10
+ to: string;
11
+ } | {
12
+ href: string;
13
+ };
14
+ badge?: GeneralIconProps;
15
+ children?: WorkbenchNodeData[];
16
+ matched?: boolean;
17
+ matchedSelf?: boolean;
18
+ path?: string;
19
+ isContainer?: boolean;
20
+ originKey?: string;
21
+ parentPath?: string;
22
+ unreachable?: boolean;
23
+ }
24
+ export interface WorkbenchTreeAction {
25
+ action: string;
26
+ icon: GeneralIconProps;
27
+ title?: string;
28
+ if?: string | boolean;
29
+ }
30
+ export interface ActionClickDetail {
31
+ action: string;
32
+ data?: unknown;
33
+ }
@@ -0,0 +1,10 @@
1
+ /// <reference types="react" resolution-mode="require"/>
2
+ /// <reference types="react" resolution-mode="require"/>
3
+ import type { ActionClickDetail, WorkbenchTreeAction } from "../../interfaces.js";
4
+ export interface ContextOfWorkbenchActions {
5
+ actions?: WorkbenchTreeAction[];
6
+ actionsHidden?: boolean;
7
+ onActionClick?(detail: ActionClickDetail): void;
8
+ }
9
+ export declare const WorkbenchActionsContext: React.Context<ContextOfWorkbenchActions>;
10
+ export declare function useWorkbenchActionsContext(): ContextOfWorkbenchActions;
@@ -0,0 +1,36 @@
1
+ import { type ReactElement } from "react";
2
+ import { dragStatusEnum } from "./WorkbenchTreeDndContext.js";
3
+ import type { WorkbenchNodeData } from "../../interfaces.js";
4
+ import type { Link, LinkProps } from "@next-bricks/basic/link";
5
+ import type { GeneralIcon, GeneralIconProps } from "@next-bricks/icons/general-icon";
6
+ export declare const WrappedLink: import("@next-core/react-element").WrappedBrick<Link, LinkProps>;
7
+ export declare const WrappedGeneralIcon: import("@next-core/react-element").WrappedBrick<GeneralIcon, GeneralIconProps>;
8
+ export interface dropEmitProps {
9
+ nodes: WorkbenchNodeData[];
10
+ curNode: WorkbenchNodeData;
11
+ overNode: WorkbenchNodeData;
12
+ status: dragStatusEnum;
13
+ }
14
+ export interface WorkbenchTreeProps {
15
+ nodes: WorkbenchNodeData[];
16
+ placeholder?: string;
17
+ searchPlaceholder?: string;
18
+ noSearch?: boolean;
19
+ isDrag?: boolean;
20
+ allowDrag?: boolean;
21
+ allowDragToRoot?: boolean;
22
+ allowDragToInside?: boolean;
23
+ dropEmit?: (detail: dropEmitProps) => void;
24
+ }
25
+ export interface TreeListProps {
26
+ nodes: WorkbenchNodeData[];
27
+ level: number;
28
+ }
29
+ export declare function WorkbenchTree({ nodes: originNode, placeholder, searchPlaceholder, isDrag, noSearch, allowDrag, allowDragToRoot, allowDragToInside, dropEmit, }: WorkbenchTreeProps): ReactElement;
30
+ export interface TreeNodeProps {
31
+ node: WorkbenchNodeData;
32
+ level: number;
33
+ isFirst?: boolean;
34
+ isLast?: boolean;
35
+ skipNotify?: boolean;
36
+ }
@@ -0,0 +1 @@
1
+ import "@testing-library/jest-dom";
@@ -0,0 +1,31 @@
1
+ /// <reference types="react" resolution-mode="require"/>
2
+ import type { WorkbenchNodeData } from "../../interfaces.js";
3
+ import { dragStatusEnum } from "./WorkbenchTreeDndContext.js";
4
+ export interface dropOptions {
5
+ curElement: HTMLElement;
6
+ overElement: HTMLElement;
7
+ parentElement: HTMLElement;
8
+ overStatus: dragStatusEnum;
9
+ }
10
+ export interface ContextOfWorkbenchTree {
11
+ hoverKey?: string | number;
12
+ activeKey?: string | number;
13
+ basePaddingLeft?: number;
14
+ showMatchedNodeOnly?: boolean;
15
+ isTransformName?: boolean;
16
+ fixedActionsFor?: Record<string, unknown> | Record<string, unknown>[];
17
+ collapsible?: boolean;
18
+ collapsedNodes?: (string | number)[];
19
+ nodeKey?: string;
20
+ clickFactory?(node: WorkbenchNodeData): () => void;
21
+ mouseEnterFactory?(node: WorkbenchNodeData): () => void;
22
+ mouseLeaveFactory?(node: WorkbenchNodeData): () => void;
23
+ contextMenuFactory?(node?: WorkbenchNodeData): (event: React.MouseEvent) => void;
24
+ matchNode?(node: WorkbenchNodeData, lowerTrimmedQuery?: string): boolean;
25
+ onNodeToggle?(nodeId: string | number, collapsed: boolean): void;
26
+ getCollapsedId?(node: WorkbenchNodeData): string | number;
27
+ onBrickDrop?(e: React.DragEvent<HTMLElement>, options: dropOptions): void;
28
+ skipNotify?: boolean;
29
+ }
30
+ export declare const WorkbenchTreeContext: React.Context<ContextOfWorkbenchTree>;
31
+ export declare function useWorkbenchTreeContext(): ContextOfWorkbenchTree;
@@ -0,0 +1,20 @@
1
+ /// <reference types="react" resolution-mode="require"/>
2
+ import { WorkbenchNodeData } from "../../interfaces.js";
3
+ export declare enum dragStatusEnum {
4
+ inside = "inside",
5
+ top = "top",
6
+ bottom = "bottom"
7
+ }
8
+ interface WorkbenchTreeDndContext {
9
+ allow?: boolean;
10
+ allowDragToRoot?: boolean;
11
+ dragElement?: HTMLElement;
12
+ dragOverElement?: HTMLElement;
13
+ dragStatus?: dragStatusEnum;
14
+ onDragStart?: (e: React.DragEvent<HTMLElement>, node: WorkbenchNodeData) => void;
15
+ onDragOver?: (e: React.DragEvent<HTMLElement>) => void;
16
+ onDrop?: (e: React.DragEvent<HTMLElement>) => void;
17
+ }
18
+ export declare const WorkbenchTreeDndContext: React.Context<WorkbenchTreeDndContext>;
19
+ export declare function useWorkbenchTreeDndContext(): WorkbenchTreeDndContext;
20
+ export {};
@@ -0,0 +1,15 @@
1
+ import React from "react";
2
+ import { WorkbenchTreeAction, ActionClickDetail } from "../../interfaces.js";
3
+ import type { GeneralIcon, GeneralIconProps } from "@next-bricks/icons/general-icon";
4
+ export declare const WrappedGeneralIcon: import("@next-core/react-element").WrappedBrick<GeneralIcon, GeneralIconProps>;
5
+ export interface WorkbenchSubActionBarProps {
6
+ data?: unknown;
7
+ className?: string;
8
+ gap?: number;
9
+ isFirst?: boolean;
10
+ isLast?: boolean;
11
+ actions?: WorkbenchTreeAction[];
12
+ actionsHidden?: boolean;
13
+ onActionClick?(detail: ActionClickDetail): void;
14
+ }
15
+ export declare function WorkbenchMiniActionBar({ data, className, gap, isFirst, isLast, actions, actionsHidden, onActionClick, }: WorkbenchSubActionBarProps): React.ReactElement;
@@ -0,0 +1,2 @@
1
+ export declare function deepFilter<T>(data: Array<T>, q: string): Array<T>;
2
+ export declare function deepMatch(data: unknown, lowerTrimmedQuery: string): boolean;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,3 @@
1
+ import { WorkbenchNodeData } from "../interfaces.js";
2
+ export declare function getNodeTreeByPath(nodes: WorkbenchNodeData[], nodeKey: string): Array<WorkbenchNodeData>;
3
+ export declare function getNodesByPathTree(nodes: Array<WorkbenchNodeData>): Array<WorkbenchNodeData>;
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" resolution-mode="require"/>
2
+ export declare function setDragImage(e: DragEvent | React.DragEvent, title: string): void;
@@ -0,0 +1,35 @@
1
+ /// <reference types="react" resolution-mode="require"/>
2
+ import { ReactNextElement } from "@next-core/react-element";
3
+ import type { WorkbenchNodeData, WorkbenchTreeAction } from "../interfaces.js";
4
+ import "@next-core/theme";
5
+ /**
6
+ * @id next-builder.workbench-tree
7
+ * @author steve
8
+ * @history
9
+ * 1.x.0: 新增构件 `next-builder.workbench-tree`
10
+ * @docKind brick
11
+ * @noInheritDoc
12
+ */
13
+ declare class WorkbenchTreeElement extends ReactNextElement {
14
+ #private;
15
+ accessor nodes: WorkbenchNodeData[];
16
+ accessor actions: WorkbenchTreeAction[];
17
+ accessor actionsHidden: boolean;
18
+ accessor placeholder: string;
19
+ accessor isTransformName: boolean;
20
+ accessor searchPlaceholder: string;
21
+ accessor noSearch: boolean;
22
+ accessor activeKey: string | number;
23
+ accessor showMatchedNodeOnly: boolean;
24
+ accessor matchNodeDataFields: string | string[];
25
+ accessor fixedActionsFor: Record<string, unknown> | Record<string, unknown>[];
26
+ accessor collapsible: boolean;
27
+ accessor collapsedNodes: string[];
28
+ accessor allowDrag: boolean;
29
+ accessor allowDragToRoot: boolean;
30
+ accessor allowDragToInside: boolean;
31
+ accessor nodeKey: string;
32
+ accessor skipNotify: boolean;
33
+ render(): JSX.Element;
34
+ }
35
+ export { WorkbenchTreeElement };
@@ -0,0 +1 @@
1
+ import "./index.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@next-bricks/visual-builder",
3
- "version": "0.2.3",
3
+ "version": "0.3.0",
4
4
  "homepage": "https://github.com/easyops-cn/next-bricks/tree/master/bricks/visual-builder",
5
5
  "repository": {
6
6
  "type": "git",
@@ -11,11 +11,13 @@
11
11
  "sideEffects": true,
12
12
  "files": [
13
13
  "dist",
14
- "dist-types"
14
+ "dist-types",
15
+ "docs"
15
16
  ],
16
17
  "exports": {
17
18
  "./package.json": "./package.json",
18
19
  "./dist/bricks.json": "./dist/bricks.json",
20
+ "./dist/manifest.json": "./dist/manifest.json",
19
21
  "./*": {
20
22
  "types": "./dist-types/*/index.d.ts"
21
23
  }
@@ -25,12 +27,13 @@
25
27
  "build": "npm run build:main && npm run build:types",
26
28
  "build:main": "cross-env NODE_ENV=production build-next-bricks",
27
29
  "build:types": "tsc --emitDeclarationOnly --declaration --declarationDir dist-types --project tsconfig.json",
30
+ "build:manifest": "cross-env NODE_ENV=production build-next-bricks --manifest-only",
28
31
  "prepublishOnly": "cp package.json package.json.bak && npm pkg delete dependencies",
29
32
  "postpublish": "mv package.json.bak package.json"
30
33
  },
31
34
  "devDependencies": {
32
- "@next-core/build-next-bricks": "^1.5.3",
35
+ "@next-core/build-next-bricks": "^1.7.2",
33
36
  "@next-core/test-next": "^1.0.6"
34
37
  },
35
- "gitHead": "49a0208d46261323e82f5800c7f8c46a03a2ca15"
38
+ "gitHead": "39c905308f0f4db5e5d84b8ffdde38aa94dbe394"
36
39
  }
@@ -1,2 +0,0 @@
1
- "use strict";(self.webpackChunk_next_bricks_visual_builder=self.webpackChunk_next_bricks_visual_builder||[]).push([[110],{7110:(e,r,t)=>{function n(e){return class extends HTMLElement{get $$typeof(){return"provider"}resolve(){return e(...arguments)}}}function s(e){var r=Object.getOwnPropertyNames(e);for(var t of r){var n=e[t];n&&"object"==typeof n&&s(n)}return Object.freeze(e)}function o(e,r){return Object.prototype.hasOwnProperty.call(e,r)}function i(e){var r=typeof e;return null!=e&&("object"==r||"function"==r)}t.r(r),t.d(r,{JsonStorage:()=>a,createProviderClass:()=>n,deepFreeze:()=>s,hasOwnProperty:()=>o,isObject:()=>i,unwrapProvider:()=>c});class a{constructor(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"brick-next-";this.storage=e,this.prefix=r}setItem(e,r){this.storage.setItem(this.prefix+e,JSON.stringify(r))}getItem(e){var r;return JSON.parse(null!==(r=this.storage.getItem(this.prefix+e))&&void 0!==r?r:"null")}removeItem(e){return this.storage.removeItem(this.prefix+e)}clear(){return this.storage.clear()}}var u=new Map;function c(e){return function(){for(var r=arguments.length,t=new Array(r),n=0;n<r;n++)t[n]=arguments[n];var s=function(e){var r=u.get(e);return r||(r=document.createElement(e),u.set(e,r),r)}(e);return s.resolve(...t)}}}}]);
2
- //# sourceMappingURL=110.ccb7f4ac.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"chunks/110.ccb7f4ac.js","mappings":"yIAAO,SAASA,EAAoBC,GAClC,OAAO,cAAcC,YACfC,eACF,MAAO,UACT,CACAC,UACE,OAAOH,KAAOI,UAChB,EAEJ,CCNO,SAASC,EAAWC,GAEzB,IAAIC,EAAYC,OAAOC,oBAAoBH,GAI3C,IAAK,IAAII,KAAQH,EAAW,CAC1B,IAAII,EAAQL,EAAOI,GACfC,GAA0B,iBAAVA,GAClBN,EAAWM,EAEf,CACA,OAAOH,OAAOI,OAAON,EACvB,CChBO,SAAS,EAAeA,EAAQO,GACrC,OAAOL,OAAOM,UAAUC,eAAeC,KAAKV,EAAQO,EACtD,CCDO,SAASI,EAASN,GACvB,IAAIO,SAAcP,EAClB,OAAgB,MAATA,IAA0B,UAARO,GAA4B,YAARA,EAC/C,C,sICCO,MAAMC,EACXC,YAAYC,GACV,IAAIC,EAASlB,UAAUmB,OAAS,QAAsBC,IAAjBpB,UAAU,GAAmBA,UAAU,GAAK,cACjFqB,KAAKJ,QAAUA,EACfI,KAAKH,OAASA,CAChB,CACAI,QAAQhB,EAAMC,GACZc,KAAKJ,QAAQK,QAAQD,KAAKH,OAASZ,EAAMiB,KAAKC,UAAUjB,GAC1D,CACAkB,QAAQnB,GACN,IAAIoB,EACJ,OAAOH,KAAKI,MAA6E,QAAtED,EAAwBL,KAAKJ,QAAQQ,QAAQJ,KAAKH,OAASZ,UAA6C,IAA1BoB,EAAmCA,EAAwB,OAC9J,CACAE,WAAWtB,GACT,OAAOe,KAAKJ,QAAQW,WAAWP,KAAKH,OAASZ,EAC/C,CACAuB,QACE,OAAOR,KAAKJ,QAAQY,OACtB,ECvBF,IAAIC,EAAO,IAAIC,IAUR,SAASC,EAAeC,GAC7B,OAAO,WACL,IAAK,IAAIC,EAAOlC,UAAUmB,OAAQgB,EAAO,IAAIC,MAAMF,GAAOG,EAAO,EAAGA,EAAOH,EAAMG,IAC/EF,EAAKE,GAAQrC,UAAUqC,GAEzB,IAAIC,EAdR,SAA0BL,GACxB,IAAIK,EAAQR,EAAKS,IAAIN,GACrB,OAAIK,IAGJA,EAAQE,SAASC,cAAcR,GAC/BH,EAAKY,IAAIT,EAAUK,GACZA,EACT,CAMgBK,CAAiBV,GAC7B,OAAOK,EAAMvC,WAAWoC,EAC1B,CACF,C","sources":["webpack:///../../node_modules/@next-core/utils/dist/esm/general/createProviderClass.js","webpack:///../../node_modules/@next-core/utils/dist/esm/general/deepFreeze.js","webpack:///../../node_modules/@next-core/utils/dist/esm/general/hasOwnProperty.js","webpack:///../../node_modules/@next-core/utils/dist/esm/general/isObject.js","webpack:///../../node_modules/@next-core/utils/dist/esm/general/JsonStorage.js","webpack:///../../node_modules/@next-core/utils/dist/esm/general/unwrapProvider.js"],"sourcesContent":["export function createProviderClass(api) {\n return class extends HTMLElement {\n get $$typeof() {\n return \"provider\";\n }\n resolve() {\n return api(...arguments);\n }\n };\n}\n//# sourceMappingURL=createProviderClass.js.map","// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/freeze\n\n/** @internal */\nexport function deepFreeze(object) {\n // Retrieve the property names defined on object\n var propNames = Object.getOwnPropertyNames(object);\n\n // Freeze properties before freezing self\n\n for (var name of propNames) {\n var value = object[name];\n if (value && typeof value === \"object\") {\n deepFreeze(value);\n }\n }\n return Object.freeze(object);\n}\n//# sourceMappingURL=deepFreeze.js.map","export function hasOwnProperty(object, property) {\n return Object.prototype.hasOwnProperty.call(object, property);\n}\n//# sourceMappingURL=hasOwnProperty.js.map","// Ref https://github.com/lodash/lodash/blob/4.17.11/lodash.js#L11744\nexport function isObject(value) {\n var type = typeof value;\n return value != null && (type == \"object\" || type == \"function\");\n}\n//# sourceMappingURL=isObject.js.map","// This is copied from\n// [@next-libs/storage](https://github.com/easyops-cn/next-libs/tree/master/libs/storage),\n// and the types is refined.\n// The usage of JsonStorage from @next-libs/storage should be deprecated,\n// and migrated to from @next-core/brick-utils.\nexport class JsonStorage {\n constructor(storage) {\n var prefix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : \"brick-next-\";\n this.storage = storage;\n this.prefix = prefix;\n }\n setItem(name, value) {\n this.storage.setItem(this.prefix + name, JSON.stringify(value));\n }\n getItem(name) {\n var _this$storage$getItem;\n return JSON.parse((_this$storage$getItem = this.storage.getItem(this.prefix + name)) !== null && _this$storage$getItem !== void 0 ? _this$storage$getItem : \"null\");\n }\n removeItem(name) {\n return this.storage.removeItem(this.prefix + name);\n }\n clear() {\n return this.storage.clear();\n }\n}\n//# sourceMappingURL=JsonStorage.js.map","var pool = new Map();\nfunction getProviderBrick(provider) {\n var brick = pool.get(provider);\n if (brick) {\n return brick;\n }\n brick = document.createElement(provider);\n pool.set(provider, brick);\n return brick;\n}\nexport function unwrapProvider(provider) {\n return function () {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n var brick = getProviderBrick(provider);\n return brick.resolve(...args);\n };\n}\n//# sourceMappingURL=unwrapProvider.js.map"],"names":["createProviderClass","api","HTMLElement","$$typeof","resolve","arguments","deepFreeze","object","propNames","Object","getOwnPropertyNames","name","value","freeze","property","prototype","hasOwnProperty","call","isObject","type","JsonStorage","constructor","storage","prefix","length","undefined","this","setItem","JSON","stringify","getItem","_this$storage$getItem","parse","removeItem","clear","pool","Map","unwrapProvider","provider","_len","args","Array","_key","brick","get","document","createElement","set","getProviderBrick"],"sourceRoot":""}