@chamn/engine 0.0.10 → 0.0.12

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 (205) hide show
  1. package/dist/component/CustomSchemaForm/components/Form/context.d.ts +2 -0
  2. package/dist/component/CustomSchemaForm/components/Form/index.d.ts +1 -0
  3. package/dist/component/CustomSchemaForm/components/SetterSwitcher/index.d.ts +2 -0
  4. package/dist/component/CustomSchemaForm/index.d.ts +3 -0
  5. package/dist/component/Workbench/index.d.ts +4 -0
  6. package/dist/core/pluginManager.d.ts +5 -0
  7. package/dist/index.d.ts +1 -0
  8. package/dist/index.js +197 -0
  9. package/dist/index.js.map +1 -0
  10. package/dist/{index.es.js → index.mjs} +3849 -3814
  11. package/dist/index.mjs.map +1 -0
  12. package/dist/material/innerMaterial.d.ts +1 -1
  13. package/dist/plugins/RightPanel/view.d.ts +4 -0
  14. package/package.json +12 -9
  15. package/.eslintignore +0 -1
  16. package/.eslintrc.js +0 -36
  17. package/.prettierrc.json +0 -7
  18. package/.storybook/main.js +0 -24
  19. package/.storybook/preview.js +0 -9
  20. package/CHANGELOG.md +0 -54
  21. package/__tests__/demo.test.ts +0 -3
  22. package/build.config.js +0 -88
  23. package/dist/index.cjs.js +0 -197
  24. package/dist/index.cjs.js.map +0 -1
  25. package/dist/index.es.js.map +0 -1
  26. package/index.html +0 -16
  27. package/jest.config.js +0 -196
  28. package/public/Engine.module.scss.d.ts +0 -5
  29. package/public/_dev_/render.d.ts +0 -2
  30. package/public/component/CSSEditor/style.module.scss.d.ts +0 -6
  31. package/public/component/CSSPropertiesEditor/style.module.scss.d.ts +0 -15
  32. package/public/component/CSSPropertiesVariableBindEditor/style.module.scss.d.ts +0 -15
  33. package/public/component/CustomSchemaForm/components/Form/Field/style.module.scss.d.ts +0 -8
  34. package/public/component/CustomSchemaForm/components/SetterSwitcher/style.module.scss.d.ts +0 -7
  35. package/public/component/CustomSchemaForm/components/Setters/ArraySetter/style.module.scss.d.ts +0 -7
  36. package/public/component/CustomSchemaForm/components/Setters/CSSValueSetter/style.module.scss.d.ts +0 -6
  37. package/public/component/CustomSchemaForm/style.module.scss.d.ts +0 -11
  38. package/public/component/Workbench/style.module.scss.d.ts +0 -25
  39. package/public/plugins/AdvancePanel/style.module.scss.d.ts +0 -7
  40. package/public/plugins/ComponentLibrary/components/DragItem/style.module.scss.d.ts +0 -9
  41. package/public/plugins/ComponentLibrary/components/ListView/style.module.scss.d.ts +0 -12
  42. package/public/plugins/ComponentLibrary/style.module.scss.d.ts +0 -11
  43. package/public/plugins/Designer/components/DefaultSelectToolBar/style.module.scss.d.ts +0 -11
  44. package/public/plugins/Designer/style.module.scss.d.ts +0 -5
  45. package/public/plugins/GlobalStatePanel/style.module.scss.d.ts +0 -5
  46. package/public/plugins/OutlineTree/components/TreeView/style.module.scss.d.ts +0 -16
  47. package/public/plugins/PropertyPanel/style.module.scss.d.ts +0 -10
  48. package/public/plugins/RightPanel/style.module.scss.d.ts +0 -10
  49. package/public/plugins/VisualPanelPlus/style.module.scss.d.ts +0 -10
  50. package/public/render.umd.js +0 -42
  51. package/public/render.umd.js.map +0 -1
  52. package/src/Engine.module.scss +0 -10
  53. package/src/Engine.module.scss.d.ts +0 -5
  54. package/src/_dev_/index.css +0 -22
  55. package/src/_dev_/index.tsx +0 -5
  56. package/src/_dev_/page/Editor/index.tsx +0 -198
  57. package/src/_dev_/page/Editor/indexCustom.tsx +0 -274
  58. package/src/_dev_/page/Preview/index.tsx +0 -56
  59. package/src/_dev_/render.ts +0 -3
  60. package/src/_dev_/router.tsx +0 -14
  61. package/src/assets/react.svg +0 -4
  62. package/src/assets/styles/mixin.scss +0 -15
  63. package/src/component/CSSEditor/index.tsx +0 -247
  64. package/src/component/CSSEditor/style.module.scss +0 -22
  65. package/src/component/CSSEditor/style.module.scss.d.ts +0 -6
  66. package/src/component/CSSPropertiesEditor/cssProperties.ts +0 -1062
  67. package/src/component/CSSPropertiesEditor/index.tsx +0 -389
  68. package/src/component/CSSPropertiesEditor/style.module.scss +0 -46
  69. package/src/component/CSSPropertiesEditor/style.module.scss.d.ts +0 -15
  70. package/src/component/CSSPropertiesEditor/util.ts +0 -19
  71. package/src/component/CSSPropertiesVariableBindEditor/cssProperties.ts +0 -782
  72. package/src/component/CSSPropertiesVariableBindEditor/index.tsx +0 -366
  73. package/src/component/CSSPropertiesVariableBindEditor/style.module.scss +0 -48
  74. package/src/component/CSSPropertiesVariableBindEditor/style.module.scss.d.ts +0 -15
  75. package/src/component/CSSPropertiesVariableBindEditor/util.ts +0 -19
  76. package/src/component/ClassNameEditor/index.tsx +0 -91
  77. package/src/component/ClassNameEditor/style.module.scss +0 -0
  78. package/src/component/CustomSchemaForm/components/Form/Field/index.tsx +0 -81
  79. package/src/component/CustomSchemaForm/components/Form/Field/style.module.scss +0 -32
  80. package/src/component/CustomSchemaForm/components/Form/Field/style.module.scss.d.ts +0 -8
  81. package/src/component/CustomSchemaForm/components/Form/context.ts +0 -23
  82. package/src/component/CustomSchemaForm/components/Form/index.tsx +0 -71
  83. package/src/component/CustomSchemaForm/components/SetterSwitcher/index.tsx +0 -273
  84. package/src/component/CustomSchemaForm/components/SetterSwitcher/style.module.scss +0 -16
  85. package/src/component/CustomSchemaForm/components/SetterSwitcher/style.module.scss.d.ts +0 -7
  86. package/src/component/CustomSchemaForm/components/Setters/ArraySetter/ArrayItem.tsx +0 -55
  87. package/src/component/CustomSchemaForm/components/Setters/ArraySetter/SortItemOrderModal.tsx +0 -160
  88. package/src/component/CustomSchemaForm/components/Setters/ArraySetter/index.tsx +0 -129
  89. package/src/component/CustomSchemaForm/components/Setters/ArraySetter/style.module.scss +0 -22
  90. package/src/component/CustomSchemaForm/components/Setters/ArraySetter/style.module.scss.d.ts +0 -7
  91. package/src/component/CustomSchemaForm/components/Setters/BooleanSetter/index.tsx +0 -32
  92. package/src/component/CustomSchemaForm/components/Setters/CSSValueSetter/index.tsx +0 -78
  93. package/src/component/CustomSchemaForm/components/Setters/CSSValueSetter/style.module.scss +0 -7
  94. package/src/component/CustomSchemaForm/components/Setters/CSSValueSetter/style.module.scss.d.ts +0 -6
  95. package/src/component/CustomSchemaForm/components/Setters/ExpressionSetter/index.tsx +0 -47
  96. package/src/component/CustomSchemaForm/components/Setters/FunctionSetter/defaultDts.ts +0 -28
  97. package/src/component/CustomSchemaForm/components/Setters/FunctionSetter/index.tsx +0 -93
  98. package/src/component/CustomSchemaForm/components/Setters/JSONSetter/index.tsx +0 -80
  99. package/src/component/CustomSchemaForm/components/Setters/NumberSetter/index.tsx +0 -34
  100. package/src/component/CustomSchemaForm/components/Setters/SelectSetter/index.tsx +0 -35
  101. package/src/component/CustomSchemaForm/components/Setters/ShapeSetter/index.tsx +0 -65
  102. package/src/component/CustomSchemaForm/components/Setters/StringSetter/index.tsx +0 -30
  103. package/src/component/CustomSchemaForm/components/Setters/TextAreaSetter/index.tsx +0 -31
  104. package/src/component/CustomSchemaForm/components/Setters/index.ts +0 -26
  105. package/src/component/CustomSchemaForm/components/Setters/type.ts +0 -18
  106. package/src/component/CustomSchemaForm/context.ts +0 -20
  107. package/src/component/CustomSchemaForm/index.tsx +0 -93
  108. package/src/component/CustomSchemaForm/style.module.scss +0 -15
  109. package/src/component/CustomSchemaForm/style.module.scss.d.ts +0 -11
  110. package/src/component/CustomSchemaForm/utils.ts +0 -13
  111. package/src/component/MonacoEditor/index.tsx +0 -81
  112. package/src/component/Workbench/index.tsx +0 -329
  113. package/src/component/Workbench/style.module.scss +0 -159
  114. package/src/component/Workbench/style.module.scss.d.ts +0 -25
  115. package/src/core/pluginManager.ts +0 -151
  116. package/src/i18n/en_US/index.ts +0 -5
  117. package/src/i18n/index.ts +0 -39
  118. package/src/i18n/zh_CN/index.ts +0 -5
  119. package/src/index.tsx +0 -150
  120. package/src/material/innerMaterial.ts +0 -343
  121. package/src/plugins/AdvancePanel/index.tsx +0 -191
  122. package/src/plugins/AdvancePanel/style.module.scss +0 -8
  123. package/src/plugins/AdvancePanel/style.module.scss.d.ts +0 -7
  124. package/src/plugins/ComponentLibrary/components/DragItem/index.tsx +0 -65
  125. package/src/plugins/ComponentLibrary/components/DragItem/style.module.scss +0 -58
  126. package/src/plugins/ComponentLibrary/components/DragItem/style.module.scss.d.ts +0 -9
  127. package/src/plugins/ComponentLibrary/components/ListView/index.tsx +0 -50
  128. package/src/plugins/ComponentLibrary/components/ListView/style.module.scss +0 -27
  129. package/src/plugins/ComponentLibrary/components/ListView/style.module.scss.d.ts +0 -12
  130. package/src/plugins/ComponentLibrary/index.tsx +0 -184
  131. package/src/plugins/ComponentLibrary/localize/en_US/index.ts +0 -3
  132. package/src/plugins/ComponentLibrary/localize/index.ts +0 -3
  133. package/src/plugins/ComponentLibrary/localize/zh_CN/index.ts +0 -3
  134. package/src/plugins/ComponentLibrary/style.module.scss +0 -31
  135. package/src/plugins/ComponentLibrary/style.module.scss.d.ts +0 -11
  136. package/src/plugins/ComponentLibrary/util.ts +0 -14
  137. package/src/plugins/ComponentStatePanel/index.tsx +0 -59
  138. package/src/plugins/Designer/components/DefaultSelectToolBar/index.tsx +0 -94
  139. package/src/plugins/Designer/components/DefaultSelectToolBar/style.module.scss +0 -59
  140. package/src/plugins/Designer/components/DefaultSelectToolBar/style.module.scss.d.ts +0 -11
  141. package/src/plugins/Designer/components/GhostView/index.tsx +0 -18
  142. package/src/plugins/Designer/config.ts +0 -1
  143. package/src/plugins/Designer/index.tsx +0 -61
  144. package/src/plugins/Designer/localize/en_US/index.ts +0 -3
  145. package/src/plugins/Designer/localize/index.ts +0 -3
  146. package/src/plugins/Designer/localize/zh_CN/index.ts +0 -3
  147. package/src/plugins/Designer/style.module.scss +0 -10
  148. package/src/plugins/Designer/style.module.scss.d.ts +0 -5
  149. package/src/plugins/Designer/util.ts +0 -18
  150. package/src/plugins/Designer/view.tsx +0 -225
  151. package/src/plugins/DisplaySourceSchema/index.tsx +0 -76
  152. package/src/plugins/GlobalStatePanel/index.tsx +0 -96
  153. package/src/plugins/GlobalStatePanel/localize/en_US/index.ts +0 -3
  154. package/src/plugins/GlobalStatePanel/localize/index.ts +0 -3
  155. package/src/plugins/GlobalStatePanel/localize/zh_CN/index.ts +0 -3
  156. package/src/plugins/GlobalStatePanel/style.module.scss +0 -8
  157. package/src/plugins/GlobalStatePanel/style.module.scss.d.ts +0 -5
  158. package/src/plugins/History/index.tsx +0 -110
  159. package/src/plugins/OutlineTree/components/TreeView/context.ts +0 -43
  160. package/src/plugins/OutlineTree/components/TreeView/dataStruct.ts +0 -58
  161. package/src/plugins/OutlineTree/components/TreeView/index.tsx +0 -376
  162. package/src/plugins/OutlineTree/components/TreeView/style.module.scss +0 -93
  163. package/src/plugins/OutlineTree/components/TreeView/style.module.scss.d.ts +0 -16
  164. package/src/plugins/OutlineTree/components/TreeView/treeNode.tsx +0 -271
  165. package/src/plugins/OutlineTree/index.tsx +0 -39
  166. package/src/plugins/OutlineTree/localize/en_US/index.ts +0 -3
  167. package/src/plugins/OutlineTree/localize/index.ts +0 -3
  168. package/src/plugins/OutlineTree/localize/zh_CN/index.ts +0 -3
  169. package/src/plugins/OutlineTree/util.tsx +0 -302
  170. package/src/plugins/PropertyPanel/index.tsx +0 -63
  171. package/src/plugins/PropertyPanel/style.module.scss +0 -12
  172. package/src/plugins/PropertyPanel/style.module.scss.d.ts +0 -10
  173. package/src/plugins/PropertyPanel/utils.ts +0 -13
  174. package/src/plugins/RightPanel/index.tsx +0 -30
  175. package/src/plugins/RightPanel/style.module.scss +0 -16
  176. package/src/plugins/RightPanel/style.module.scss.d.ts +0 -10
  177. package/src/plugins/RightPanel/view.tsx +0 -177
  178. package/src/plugins/VisualPanel/index.tsx +0 -185
  179. package/src/plugins/VisualPanel/style.module.scss +0 -17
  180. package/src/plugins/VisualPanelPlus/index.tsx +0 -103
  181. package/src/plugins/VisualPanelPlus/style.module.scss +0 -20
  182. package/src/plugins/VisualPanelPlus/style.module.scss.d.ts +0 -10
  183. package/src/plugins/index.tsx +0 -26
  184. package/src/stories/Button.jsx +0 -50
  185. package/src/stories/Button.stories.jsx +0 -40
  186. package/src/stories/Introduction.stories.mdx +0 -194
  187. package/src/stories/assets/code-brackets.svg +0 -1
  188. package/src/stories/assets/colors.svg +0 -1
  189. package/src/stories/assets/comments.svg +0 -1
  190. package/src/stories/assets/direction.svg +0 -1
  191. package/src/stories/assets/flow.svg +0 -1
  192. package/src/stories/assets/plugin.svg +0 -1
  193. package/src/stories/assets/repo.svg +0 -1
  194. package/src/stories/assets/stackalt.svg +0 -1
  195. package/src/stories/button.css +0 -30
  196. package/src/stories/plugins/CSSEditor.stories.tsx +0 -75
  197. package/src/stories/plugins/VisualPanelPlus.stories.tsx +0 -74
  198. package/src/style.d.ts +0 -2
  199. package/src/typing.d.ts +0 -9
  200. package/src/utils/css.ts +0 -88
  201. package/src/utils/defaultEngineConfig.tsx +0 -55
  202. package/src/utils/index.ts +0 -12
  203. package/src/utils/logger.ts +0 -4
  204. package/src/vite-env.d.ts +0 -1
  205. package/tsconfig.json +0 -32
@@ -1,343 +0,0 @@
1
- import { CMaterialPropsType, CMaterialType, HTMl_TAGS } from '@chamn/model';
2
- import { capitalize } from 'lodash-es';
3
-
4
- const customAttributesMeta: CMaterialPropsType[number] = {
5
- name: '$$attributes',
6
- title: '属性',
7
- valueType: 'object',
8
- setters: [
9
- {
10
- componentName: 'ArraySetter',
11
- props: {
12
- item: {
13
- setters: [
14
- {
15
- componentName: 'ShapeSetter',
16
- props: {
17
- elements: [
18
- {
19
- name: 'key',
20
- title: '属性名',
21
- valueType: 'string',
22
- setters: ['StringSetter'],
23
- },
24
- {
25
- name: 'value',
26
- title: '值',
27
- valueType: 'string',
28
- setters: ['StringSetter', 'NumberSetter', 'JSONSetter', 'FunctionSetter', 'ExpressionSetter'],
29
- },
30
- ],
31
- collapse: false,
32
- },
33
- initialValue: {},
34
- },
35
- ],
36
- initialValue: {},
37
- },
38
- },
39
- initialValue: [],
40
- },
41
- ],
42
- };
43
-
44
- const widthPropsMeta: CMaterialPropsType[number] = {
45
- name: 'width',
46
- title: '宽度',
47
- valueType: 'string',
48
- setters: ['StringSetter', 'ExpressionSetter'],
49
- };
50
-
51
- const heightPropsMeta: CMaterialPropsType[number] = {
52
- name: 'height',
53
- title: '高度',
54
- valueType: 'string',
55
- setters: ['StringSetter', 'ExpressionSetter'],
56
- };
57
-
58
- const htmlNativeComponentMeta = HTMl_TAGS.map((tag) => {
59
- const DivMeta: CMaterialType = {
60
- title: capitalize(tag),
61
- componentName: tag,
62
- props: [customAttributesMeta],
63
- snippets: [],
64
- };
65
-
66
- return DivMeta;
67
- });
68
-
69
- const BaseComponentMeta: CMaterialType[] = [
70
- {
71
- title: '块',
72
- componentName: 'CBlock',
73
- isSupportStyle: true,
74
- props: [
75
- widthPropsMeta,
76
- heightPropsMeta,
77
- {
78
- name: 'children',
79
- title: '文本',
80
- valueType: 'string',
81
- setters: ['StringSetter', 'ExpressionSetter'],
82
- },
83
- customAttributesMeta,
84
- ],
85
- groupName: '原子组件',
86
- snippets: [
87
- {
88
- title: '块',
89
- snapshotText: 'Block',
90
- category: '基础组件',
91
- schema: {
92
- props: {
93
- width: '100%',
94
- height: '100px',
95
- },
96
- },
97
- },
98
- ],
99
- },
100
- {
101
- title: '容器',
102
- componentName: 'CContainer',
103
- isSupportStyle: true,
104
- isContainer: true,
105
- props: [
106
- widthPropsMeta,
107
- heightPropsMeta,
108
- {
109
- name: 'afterMount',
110
- title: '渲染之后',
111
- valueType: 'function',
112
- setters: ['FunctionSetter', 'ExpressionSetter'],
113
- },
114
- {
115
- name: 'beforeDestroy',
116
- title: '销毁之前',
117
- valueType: 'function',
118
- setters: ['FunctionSetter', 'ExpressionSetter'],
119
- },
120
- customAttributesMeta,
121
- ],
122
- groupName: '原子组件',
123
- snippets: [
124
- {
125
- title: '容器',
126
- snapshotText: 'Con',
127
- category: '基础组件',
128
- schema: {
129
- props: {
130
- width: '100%',
131
- height: '100px',
132
- },
133
- },
134
- },
135
- ],
136
- },
137
- {
138
- title: '图片',
139
- componentName: 'CImage',
140
- isSupportStyle: true,
141
- props: [
142
- {
143
- name: 'src',
144
- title: '地址',
145
- valueType: 'string',
146
- setters: ['StringSetter', 'ExpressionSetter'],
147
- },
148
- widthPropsMeta,
149
- heightPropsMeta,
150
- customAttributesMeta,
151
- ],
152
- groupName: '原子组件',
153
- snippets: [
154
- {
155
- title: '图片',
156
- snapshotText: 'Img',
157
- category: '基础组件',
158
- schema: {
159
- props: {
160
- width: '300px',
161
- height: '150px',
162
- },
163
- },
164
- },
165
- ],
166
- },
167
- {
168
- title: '视频',
169
- componentName: 'CVideo',
170
- isSupportStyle: true,
171
- props: [
172
- {
173
- name: 'src',
174
- title: '地址',
175
- valueType: 'string',
176
- setters: ['StringSetter', 'ExpressionSetter'],
177
- },
178
- {
179
- name: 'autoPlay',
180
- title: '自动播放',
181
- valueType: 'string',
182
- setters: ['BooleanSetter', 'ExpressionSetter'],
183
- },
184
- {
185
- name: 'controls',
186
- title: '控制面板',
187
- valueType: 'string',
188
- setters: ['BooleanSetter', 'ExpressionSetter'],
189
- },
190
- widthPropsMeta,
191
- heightPropsMeta,
192
- customAttributesMeta,
193
- ],
194
- fixedProps: {
195
- autoPlay: false,
196
- },
197
- groupName: '原子组件',
198
- snippets: [
199
- {
200
- title: '视频',
201
- snapshotText: 'Video',
202
- category: '基础组件',
203
- schema: {
204
- props: {
205
- width: '300px',
206
- height: '150px',
207
- src: 'https://vjs.zencdn.net/v/oceans.mp4',
208
- },
209
- },
210
- },
211
- ],
212
- },
213
- {
214
- title: '音频',
215
- groupName: '原子组件',
216
- componentName: 'CAudio',
217
- isSupportStyle: true,
218
- props: [
219
- {
220
- name: 'src',
221
- title: '地址',
222
- valueType: 'string',
223
- setters: ['StringSetter', 'ExpressionSetter'],
224
- },
225
- {
226
- name: 'autoPlay',
227
- title: '自动播放',
228
- valueType: 'string',
229
- setters: ['BooleanSetter', 'ExpressionSetter'],
230
- },
231
- {
232
- name: 'controls',
233
- title: '控制面板',
234
- valueType: 'string',
235
- setters: ['BooleanSetter', 'ExpressionSetter'],
236
- },
237
- widthPropsMeta,
238
- heightPropsMeta,
239
- customAttributesMeta,
240
- ],
241
- snippets: [
242
- {
243
- title: '音频',
244
- snapshotText: 'Audio',
245
- category: '基础组件',
246
- schema: {
247
- props: {
248
- src: 'https://vjs.zencdn.net/v/oceans.mp4',
249
- },
250
- },
251
- },
252
- ],
253
- },
254
- {
255
- title: '文本',
256
- componentName: 'CText',
257
- groupName: '原子组件',
258
- isSupportStyle: true,
259
- props: [
260
- {
261
- name: 'content',
262
- title: '内容',
263
- valueType: 'string',
264
- setters: ['TextAreaSetter', 'ExpressionSetter'],
265
- },
266
- customAttributesMeta,
267
- ],
268
- snippets: [
269
- {
270
- title: '文本',
271
- snapshotText: 'Text',
272
- category: '基础组件',
273
- schema: {
274
- props: {
275
- content: 'text',
276
- },
277
- },
278
- },
279
- ],
280
- },
281
- {
282
- title: 'Canvas',
283
- componentName: 'CCanvas',
284
- isSupportStyle: true,
285
- props: [widthPropsMeta, heightPropsMeta, customAttributesMeta],
286
- groupName: '原子组件',
287
- snippets: [
288
- {
289
- title: '画布',
290
- snapshotText: 'Cavs',
291
- category: '基础组件',
292
- schema: {
293
- props: {
294
- width: '300px',
295
- height: '150px',
296
- },
297
- },
298
- },
299
- ],
300
- },
301
- {
302
- title: 'HTML 标签',
303
- componentName: 'CNativeTag',
304
- isSupportStyle: true,
305
- props: [
306
- {
307
- name: 'htmlTag',
308
- title: '标签名',
309
- valueType: 'string',
310
- setters: [
311
- {
312
- componentName: 'SelectSetter',
313
- props: {
314
- options: HTMl_TAGS.map((tag) => {
315
- return {
316
- name: tag,
317
- value: tag,
318
- };
319
- }),
320
- },
321
- },
322
- ],
323
- },
324
- customAttributesMeta,
325
- ],
326
- groupName: '原子组件',
327
- snippets: [
328
- {
329
- title: 'HTML',
330
- snapshotText: 'HTML',
331
- category: '基础组件',
332
- schema: {
333
- props: {
334
- htmlTag: 'div',
335
- children: 'html tag',
336
- },
337
- },
338
- },
339
- ],
340
- },
341
- ];
342
-
343
- export const InnerComponentMeta = [...BaseComponentMeta, ...htmlNativeComponentMeta];
@@ -1,191 +0,0 @@
1
- import { useEffect, useRef } from 'react';
2
- import { CMaterialPropsType, CNode, CRootNode } from '@chamn/model';
3
- import { CustomSchemaForm, CustomSchemaFormInstance, CustomSchemaFormProps } from '../../component/CustomSchemaForm';
4
- import { CPluginCtx } from '../../core/pluginManager';
5
- import { CRightPanelItem } from '../RightPanel/view';
6
- import styles from './style.module.scss';
7
-
8
- export type AdvancePanelProps = {
9
- node: CNode | CRootNode;
10
- pluginCtx: CPluginCtx;
11
- };
12
-
13
- const properties: CMaterialPropsType = [
14
- {
15
- name: 'condition',
16
- title: {
17
- label: 'Render',
18
- tip: 'controller component render',
19
- },
20
- valueType: 'boolean',
21
- setters: ['BooleanSetter', 'ExpressionSetter'],
22
- },
23
- {
24
- name: 'loop',
25
- title: 'loop render',
26
- valueType: 'object',
27
- setters: [
28
- {
29
- componentName: 'ShapeSetter',
30
- props: {
31
- elements: [
32
- {
33
- name: 'open',
34
- title: 'open',
35
- valueType: 'boolean',
36
- setters: ['BooleanSetter', 'ExpressionSetter'],
37
- },
38
- {
39
- name: 'data',
40
- title: 'data',
41
- valueType: 'array',
42
- setters: [
43
- {
44
- componentName: 'ArraySetter',
45
- initialValue: [],
46
- props: {
47
- item: {
48
- setters: ['JSONSetter', 'ExpressionSetter'],
49
- initialValue: {},
50
- },
51
- },
52
- },
53
- 'JSONSetter',
54
- 'ExpressionSetter',
55
- ],
56
- },
57
- {
58
- name: 'forName',
59
- title: {
60
- label: 'name',
61
- tip: 'loop element name',
62
- },
63
- valueType: 'string',
64
- setters: ['StringSetter'],
65
- },
66
- {
67
- name: 'forIndex',
68
- title: {
69
- label: 'index',
70
- tip: 'loop element index',
71
- },
72
- valueType: 'string',
73
- setters: ['StringSetter'],
74
- },
75
- {
76
- name: 'key',
77
- title: {
78
- label: 'key',
79
- tip: 'loop element key',
80
- },
81
- valueType: 'expression',
82
- setters: ['ExpressionSetter'],
83
- },
84
- {
85
- name: 'name',
86
- title: {
87
- label: 'variable \n name',
88
- tip: 'loop variable name',
89
- },
90
- valueType: 'string',
91
- setters: [
92
- {
93
- componentName: 'StringSetter',
94
- props: {
95
- prefix: 'loopData',
96
- },
97
- },
98
- ],
99
- },
100
- ],
101
- },
102
- initialValue: {
103
- open: false,
104
- data: [],
105
- },
106
- },
107
- ],
108
- },
109
- {
110
- name: 'refId',
111
- title: {
112
- label: 'refId',
113
- tip: 'unique node flag',
114
- },
115
- valueType: 'string',
116
- setters: ['StringSetter'],
117
- },
118
- {
119
- name: 'stateName',
120
- title: {
121
- label: (
122
- <>
123
- state <br></br> name
124
- </>
125
- ) as any,
126
- tip: 'alias for state',
127
- },
128
- valueType: 'string',
129
- setters: ['StringSetter'],
130
- },
131
- ];
132
-
133
- export const AdvancePanel = (props: AdvancePanelProps) => {
134
- const { node } = props;
135
- const onSetterChange: CustomSchemaFormProps['onSetterChange'] = (keyPaths, setterName) => {
136
- node.value.configure = node.value.configure || {};
137
- node.value.configure.advanceSetter = node.value.configure.advanceSetter || {};
138
- node.value.configure.advanceSetter[keyPaths.join('.')] = {
139
- name: keyPaths.join('.'),
140
- setter: setterName,
141
- };
142
- };
143
-
144
- const loopObj = node.value.loop;
145
- const formRef = useRef<CustomSchemaFormInstance>(null);
146
-
147
- useEffect(() => {
148
- const newValue = {
149
- condition: node.value.condition || true,
150
- loop: {
151
- open: loopObj?.open || false,
152
- data: loopObj?.data || [],
153
- forName: loopObj?.forName || 'item',
154
- forIndex: loopObj?.forIndex || 'index',
155
- key: loopObj?.key || '',
156
- name: loopObj?.name || '',
157
- },
158
- refId: node.value.refId,
159
- stateName: node.value.stateName,
160
- };
161
- formRef.current?.setFields(newValue);
162
- }, [node]);
163
-
164
- const onValueChange = (newVal: { refId: string; loop: any; condition: any; stateName: any }) => {
165
- node.value.loop = newVal.loop;
166
- node.value.condition = newVal.condition;
167
- node.value.refId = newVal.refId;
168
- node.value.stateName = newVal.stateName;
169
-
170
- node.updateValue();
171
- };
172
- return (
173
- <div className={styles.advanceBox}>
174
- <CustomSchemaForm
175
- key={node.id}
176
- defaultSetterConfig={node.value.configure?.advanceSetter || {}}
177
- onSetterChange={onSetterChange}
178
- properties={properties}
179
- initialValue={{}}
180
- ref={formRef}
181
- onValueChange={onValueChange}
182
- />
183
- </div>
184
- );
185
- };
186
-
187
- export const AdvancePanelConfig: CRightPanelItem = {
188
- key: 'Advance',
189
- name: 'Advance',
190
- view: ({ node, pluginCtx }) => <AdvancePanel node={node} pluginCtx={pluginCtx} />,
191
- };
@@ -1,8 +0,0 @@
1
- .advanceBox {
2
- padding: 0 20px;
3
- :global {
4
- .ant-input-affix-wrapper .ant-input-prefix {
5
- margin-inline-end: 0;
6
- }
7
- }
8
- }
@@ -1,7 +0,0 @@
1
- import globalClassNames from '../../style.d';
2
- declare const classNames: typeof globalClassNames & {
3
- readonly advanceBox: 'advanceBox';
4
- readonly 'ant-input-affix-wrapper': 'ant-input-affix-wrapper';
5
- readonly 'ant-input-prefix': 'ant-input-prefix';
6
- };
7
- export = classNames;
@@ -1,65 +0,0 @@
1
- import { Popover } from 'antd';
2
- import clsx from 'clsx';
3
- import React, { useMemo } from 'react';
4
- import styles from './style.module.scss';
5
-
6
- export type DragComponentItemProps = {
7
- id: string;
8
- name: string;
9
- description?: any;
10
- icon: React.ReactNode | string;
11
- iconText?: string;
12
- style?: React.CSSProperties;
13
- containerClassName?: string;
14
- };
15
-
16
- export const DragComponentItem = (props: DragComponentItemProps) => {
17
- const dragInfo = {
18
- [DRAG_ITEM_KEY]: props.id,
19
- };
20
-
21
- const icon = useMemo(() => {
22
- if (props.iconText) {
23
- return (
24
- <div className={styles.iconText}>
25
- {String(props.iconText).toUpperCase()}
26
- </div>
27
- );
28
- }
29
- if (typeof props.icon === 'string') {
30
- return <img className={styles.iconImg} src={props.icon} />;
31
- } else {
32
- return props.icon;
33
- }
34
- }, [props.icon]);
35
-
36
- const contentView = (
37
- <div className={clsx([styles.square, props.containerClassName])}>
38
- <div {...dragInfo} className={styles.componentItem} style={props.style}>
39
- <div className={styles.iconBox}>{icon}</div>
40
- <span>{props.name}</span>
41
- </div>
42
- </div>
43
- );
44
-
45
- if (props.description) {
46
- return (
47
- <Popover
48
- overlayInnerStyle={{
49
- maxWidth: '300px',
50
- maxHeight: '200px',
51
- overflow: 'auto',
52
- }}
53
- content={props.description || ''}
54
- zIndex={1000}
55
- placement="right"
56
- >
57
- {contentView}
58
- </Popover>
59
- );
60
- } else {
61
- return contentView;
62
- }
63
- };
64
-
65
- export const DRAG_ITEM_KEY = 'data-drag-key';
@@ -1,58 +0,0 @@
1
- .square {
2
- user-select: none;
3
- position: relative;
4
- flex: 33.3% 0;
5
- &::before {
6
- content: '';
7
- padding-top: 100%;
8
- float: left;
9
- }
10
- &::after {
11
- content: '';
12
- display: block;
13
- clear: both;
14
- }
15
- }
16
-
17
- .componentItem {
18
- user-select: none;
19
- overflow: hidden;
20
- position: absolute;
21
- width: 100%;
22
- height: 100%;
23
- display: flex;
24
- flex-direction: column;
25
- align-items: center;
26
- justify-content: center;
27
- border-right: 1px solid $borderColor;
28
- border-bottom: 1px solid $borderColor;
29
- transition: all 0.2s;
30
-
31
- &:hover {
32
- box-shadow: 0 6px 16px 0 rgb(0 0 0 / 15%);
33
- border-color: transparent;
34
- cursor: grab;
35
- }
36
- &:active {
37
- cursor: grabbing;
38
- }
39
- }
40
-
41
- .iconImg {
42
- width: 100%;
43
- }
44
-
45
- .iconBox {
46
- width: 60%;
47
- height: 60%;
48
- overflow: hidden;
49
- display: flex;
50
- align-items: center;
51
- justify-content: center;
52
- }
53
-
54
- .iconText {
55
- font-size: 18px;
56
- font-weight: bolder;
57
- color: $textColor;
58
- }
@@ -1,9 +0,0 @@
1
- import globalClassNames from '../../../../style.d';
2
- declare const classNames: typeof globalClassNames & {
3
- readonly square: 'square';
4
- readonly componentItem: 'componentItem';
5
- readonly iconImg: 'iconImg';
6
- readonly iconBox: 'iconBox';
7
- readonly iconText: 'iconText';
8
- };
9
- export = classNames;