@yimoka/designable-playground 0.0.0-stage → 0.1.1

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 (262) hide show
  1. package/README.md +8 -2
  2. package/dist/demo/components/Alert/index.d.ts +4 -0
  3. package/dist/demo/components/Alert/index.js +41 -0
  4. package/dist/demo/components/ArrayCards/index.d.ts +17 -0
  5. package/dist/demo/components/ArrayCards/index.js +62 -0
  6. package/dist/demo/components/ArrayList/index.d.ts +25 -0
  7. package/dist/demo/components/ArrayList/index.js +143 -0
  8. package/dist/demo/components/ArrayTable/index.d.ts +39 -0
  9. package/dist/demo/components/ArrayTable/index.js +247 -0
  10. package/dist/demo/components/AutoComplete/index.d.ts +4 -0
  11. package/dist/demo/components/AutoComplete/index.js +52 -0
  12. package/dist/demo/components/Avatar/index.d.ts +4 -0
  13. package/dist/demo/components/Avatar/index.js +34 -0
  14. package/dist/demo/components/Badge/index.d.ts +4 -0
  15. package/dist/demo/components/Badge/index.js +35 -0
  16. package/dist/demo/components/Button/index.d.ts +4 -0
  17. package/dist/demo/components/Button/index.js +86 -0
  18. package/dist/demo/components/Card/index.d.ts +4 -0
  19. package/dist/demo/components/Card/index.js +72 -0
  20. package/dist/demo/components/Carousel/index.d.ts +4 -0
  21. package/dist/demo/components/Carousel/index.js +33 -0
  22. package/dist/demo/components/Cascader/index.d.ts +4 -0
  23. package/dist/demo/components/Cascader/index.js +60 -0
  24. package/dist/demo/components/Checkbox/index.d.ts +8 -0
  25. package/dist/demo/components/Checkbox/index.js +55 -0
  26. package/dist/demo/components/ColorPicker/index.d.ts +4 -0
  27. package/dist/demo/components/ColorPicker/index.js +38 -0
  28. package/dist/demo/components/DatePicker/index.d.ts +4 -0
  29. package/dist/demo/components/DatePicker/index.js +61 -0
  30. package/dist/demo/components/DateRangePicker/index.d.ts +4 -0
  31. package/dist/demo/components/DateRangePicker/index.js +58 -0
  32. package/dist/demo/components/Divider/index.d.ts +4 -0
  33. package/dist/demo/components/Divider/index.js +39 -0
  34. package/dist/demo/components/Empty/index.d.ts +4 -0
  35. package/dist/demo/components/Empty/index.js +29 -0
  36. package/dist/demo/components/Flex/index.d.ts +4 -0
  37. package/dist/demo/components/Flex/index.js +51 -0
  38. package/dist/demo/components/Form/index.d.ts +21 -0
  39. package/dist/demo/components/Form/index.js +116 -0
  40. package/dist/demo/components/FormCollapse/index.d.ts +28 -0
  41. package/dist/demo/components/FormCollapse/index.js +164 -0
  42. package/dist/demo/components/FormGrid/index.d.ts +22 -0
  43. package/dist/demo/components/FormGrid/index.js +134 -0
  44. package/dist/demo/components/FormItem/index.d.ts +14 -0
  45. package/dist/demo/components/FormItem/index.js +33 -0
  46. package/dist/demo/components/FormLayout/index.d.ts +26 -0
  47. package/dist/demo/components/FormLayout/index.js +260 -0
  48. package/dist/demo/components/FormTab/index.d.ts +15 -0
  49. package/dist/demo/components/FormTab/index.js +186 -0
  50. package/dist/demo/components/GridCol/index.d.ts +4 -0
  51. package/dist/demo/components/GridCol/index.js +53 -0
  52. package/dist/demo/components/GridRow/index.d.ts +4 -0
  53. package/dist/demo/components/GridRow/index.js +70 -0
  54. package/dist/demo/components/HTMLContent/index.d.ts +4 -0
  55. package/dist/demo/components/HTMLContent/index.js +34 -0
  56. package/dist/demo/components/I18nEditor/index.d.ts +8 -0
  57. package/dist/demo/components/I18nEditor/index.js +64 -0
  58. package/dist/demo/components/Image/index.d.ts +4 -0
  59. package/dist/demo/components/Image/index.js +36 -0
  60. package/dist/demo/components/Input/index.d.ts +4 -0
  61. package/dist/demo/components/Input/index.js +36 -0
  62. package/dist/demo/components/InputSearch/index.d.ts +4 -0
  63. package/dist/demo/components/InputSearch/index.js +40 -0
  64. package/dist/demo/components/Link/index.d.ts +4 -0
  65. package/dist/demo/components/Link/index.js +37 -0
  66. package/dist/demo/components/Mentions/index.d.ts +4 -0
  67. package/dist/demo/components/Mentions/index.js +41 -0
  68. package/dist/demo/components/NumberPicker/index.d.ts +6 -0
  69. package/dist/demo/components/NumberPicker/index.js +63 -0
  70. package/dist/demo/components/ObjectContainer/index.d.ts +14 -0
  71. package/dist/demo/components/ObjectContainer/index.js +46 -0
  72. package/dist/demo/components/Password/index.d.ts +6 -0
  73. package/dist/demo/components/Password/index.js +44 -0
  74. package/dist/demo/components/QRCode/index.d.ts +4 -0
  75. package/dist/demo/components/QRCode/index.js +34 -0
  76. package/dist/demo/components/Radio/index.d.ts +6 -0
  77. package/dist/demo/components/Radio/index.js +49 -0
  78. package/dist/demo/components/Rate/index.d.ts +6 -0
  79. package/dist/demo/components/Rate/index.js +43 -0
  80. package/dist/demo/components/Search/index.d.ts +4 -0
  81. package/dist/demo/components/Search/index.js +42 -0
  82. package/dist/demo/components/SearchSelect/index.d.ts +4 -0
  83. package/dist/demo/components/SearchSelect/index.js +53 -0
  84. package/dist/demo/components/Select/index.d.ts +4 -0
  85. package/dist/demo/components/Select/index.js +59 -0
  86. package/dist/demo/components/Slider/index.d.ts +6 -0
  87. package/dist/demo/components/Slider/index.js +61 -0
  88. package/dist/demo/components/Space/index.d.ts +9 -0
  89. package/dist/demo/components/Space/index.js +61 -0
  90. package/dist/demo/components/Statistic/index.d.ts +4 -0
  91. package/dist/demo/components/Statistic/index.js +33 -0
  92. package/dist/demo/components/Switch/index.d.ts +4 -0
  93. package/dist/demo/components/Switch/index.js +49 -0
  94. package/dist/demo/components/Tabs/index.d.ts +10 -0
  95. package/dist/demo/components/Tabs/index.js +181 -0
  96. package/dist/demo/components/Tag/index.d.ts +4 -0
  97. package/dist/demo/components/Tag/index.js +33 -0
  98. package/dist/demo/components/Text/index.d.ts +11 -0
  99. package/dist/demo/components/Text/index.js +64 -0
  100. package/dist/demo/components/TextArea/index.d.ts +6 -0
  101. package/dist/demo/components/TextArea/index.js +43 -0
  102. package/dist/demo/components/TimePicker/index.d.ts +4 -0
  103. package/dist/demo/components/TimePicker/index.js +69 -0
  104. package/dist/demo/components/TimeRangePicker/index.d.ts +4 -0
  105. package/dist/demo/components/TimeRangePicker/index.js +68 -0
  106. package/dist/demo/components/Transfer/index.d.ts +6 -0
  107. package/dist/demo/components/Transfer/index.js +59 -0
  108. package/dist/demo/components/TreeSelect/index.d.ts +4 -0
  109. package/dist/demo/components/TreeSelect/index.js +63 -0
  110. package/dist/demo/components/Upload/index.d.ts +8 -0
  111. package/dist/demo/components/Upload/index.js +64 -0
  112. package/dist/demo/components/index.d.ts +55 -0
  113. package/dist/demo/components/index.js +55 -0
  114. package/dist/demo/components/shared.d.ts +143 -0
  115. package/dist/demo/components/shared.js +315 -0
  116. package/dist/src/Playground.d.ts +3 -0
  117. package/dist/src/Playground.js +304 -0
  118. package/dist/src/antd/AntdPlayground.d.ts +16 -0
  119. package/dist/src/antd/AntdPlayground.js +136 -0
  120. package/dist/src/antd/index.d.ts +1 -0
  121. package/dist/src/antd/index.js +1 -0
  122. package/dist/src/context.d.ts +4 -0
  123. package/dist/src/context.js +13 -0
  124. package/dist/src/examples/index.d.ts +267 -0
  125. package/dist/src/examples/index.js +824 -0
  126. package/dist/src/hooks/index.d.ts +4 -0
  127. package/dist/src/hooks/index.js +4 -0
  128. package/dist/src/hooks/remoteSchemaAdapter.d.ts +53 -0
  129. package/dist/src/hooks/remoteSchemaAdapter.js +262 -0
  130. package/dist/src/hooks/usePlayground.d.ts +38 -0
  131. package/dist/src/hooks/usePlayground.js +642 -0
  132. package/dist/src/hooks/usePlaygroundRemotePersistence.d.ts +135 -0
  133. package/dist/src/hooks/usePlaygroundRemotePersistence.js +736 -0
  134. package/dist/src/hooks/useSchemaEditorDraft.d.ts +4 -0
  135. package/dist/src/hooks/useSchemaEditorDraft.js +44 -0
  136. package/dist/src/index.d.ts +14 -0
  137. package/dist/src/index.js +14 -0
  138. package/dist/src/layouts/PlaygroundLayout/ErrorBoundaries.d.ts +59 -0
  139. package/dist/src/layouts/PlaygroundLayout/ErrorBoundaries.js +161 -0
  140. package/dist/src/layouts/PlaygroundLayout/index.d.ts +7 -0
  141. package/dist/src/layouts/PlaygroundLayout/index.js +443 -0
  142. package/dist/src/layouts/index.d.ts +1 -0
  143. package/dist/src/layouts/index.js +1 -0
  144. package/dist/src/panels/CompositePanel/index.d.ts +6 -0
  145. package/dist/src/panels/CompositePanel/index.js +139 -0
  146. package/dist/src/panels/ToolbarPanel/index.d.ts +3 -0
  147. package/dist/src/panels/ToolbarPanel/index.js +24 -0
  148. package/dist/src/panels/index.d.ts +2 -0
  149. package/dist/src/panels/index.js +2 -0
  150. package/dist/src/presets/antd.d.ts +19 -0
  151. package/dist/src/presets/antd.js +112 -0
  152. package/dist/src/presets/index.d.ts +4 -0
  153. package/dist/src/presets/index.js +3 -0
  154. package/dist/src/presets/runtime-array-helpers.d.ts +8 -0
  155. package/dist/src/presets/runtime-array-helpers.js +147 -0
  156. package/dist/src/presets/runtime-component-props.d.ts +3 -0
  157. package/dist/src/presets/runtime-component-props.js +5 -0
  158. package/dist/src/presets/runtime-components.d.ts +5 -0
  159. package/dist/src/presets/runtime-components.js +419 -0
  160. package/dist/src/presets/runtime-form-components.d.ts +9 -0
  161. package/dist/src/presets/runtime-form-components.js +94 -0
  162. package/dist/src/presets/scenario-catalog.d.ts +6 -0
  163. package/dist/src/presets/scenario-catalog.js +128 -0
  164. package/dist/src/presets/scenarios.d.ts +52 -0
  165. package/dist/src/presets/scenarios.js +603 -0
  166. package/dist/src/runtime/actions.d.ts +19 -0
  167. package/dist/src/runtime/actions.js +307 -0
  168. package/dist/src/runtime/contracts.d.ts +149 -0
  169. package/dist/src/runtime/contracts.js +1 -0
  170. package/dist/src/runtime/document-bindings.d.ts +3 -0
  171. package/dist/src/runtime/document-bindings.js +101 -0
  172. package/dist/src/runtime/document-core.d.ts +57 -0
  173. package/dist/src/runtime/document-core.js +379 -0
  174. package/dist/src/runtime/document-entity.d.ts +12 -0
  175. package/dist/src/runtime/document-entity.js +351 -0
  176. package/dist/src/runtime/document-expressions.d.ts +35 -0
  177. package/dist/src/runtime/document-expressions.js +346 -0
  178. package/dist/src/runtime/document-security.d.ts +34 -0
  179. package/dist/src/runtime/document-security.js +538 -0
  180. package/dist/src/runtime/document.d.ts +16 -0
  181. package/dist/src/runtime/document.js +212 -0
  182. package/dist/src/runtime/environment.d.ts +16 -0
  183. package/dist/src/runtime/environment.js +76 -0
  184. package/dist/src/runtime/i18n-schema.d.ts +36 -0
  185. package/dist/src/runtime/i18n-schema.js +338 -0
  186. package/dist/src/runtime/i18n.d.ts +25 -0
  187. package/dist/src/runtime/i18n.js +447 -0
  188. package/dist/src/runtime/index.d.ts +8 -0
  189. package/dist/src/runtime/index.js +8 -0
  190. package/dist/src/runtime/navigation.d.ts +5 -0
  191. package/dist/src/runtime/navigation.js +43 -0
  192. package/dist/src/runtime/playground.d.ts +30 -0
  193. package/dist/src/runtime/playground.js +243 -0
  194. package/dist/src/runtime/preview-boundaries.d.ts +13 -0
  195. package/dist/src/runtime/preview-boundaries.js +43 -0
  196. package/dist/src/runtime/preview.d.ts +44 -0
  197. package/dist/src/runtime/preview.js +574 -0
  198. package/dist/src/runtime/settings/RuntimeJsonEditor.d.ts +10 -0
  199. package/dist/src/runtime/settings/RuntimeJsonEditor.js +21 -0
  200. package/dist/src/runtime/settings/RuntimeStoreEntitySettings.d.ts +15 -0
  201. package/dist/src/runtime/settings/RuntimeStoreEntitySettings.js +65 -0
  202. package/dist/src/runtime/templates.d.ts +1560 -0
  203. package/dist/src/runtime/templates.js +508 -0
  204. package/dist/src/runtime/website-contact-template.d.ts +1 -0
  205. package/dist/src/runtime/website-contact-template.js +66 -0
  206. package/dist/src/runtime/website-template-shared.d.ts +14 -0
  207. package/dist/src/runtime/website-template-shared.js +210 -0
  208. package/dist/src/runtime/website-templates.d.ts +5 -0
  209. package/dist/src/runtime/website-templates.js +976 -0
  210. package/dist/src/shared/clipboard.d.ts +4 -0
  211. package/dist/src/shared/clipboard.js +56 -0
  212. package/dist/src/shared/componentRegistry.d.ts +133 -0
  213. package/dist/src/shared/componentRegistry.js +381 -0
  214. package/dist/src/shared/formilyCompatibility.d.ts +8 -0
  215. package/dist/src/shared/formilyCompatibility.js +40 -0
  216. package/dist/src/shared/index.d.ts +6 -0
  217. package/dist/src/shared/index.js +6 -0
  218. package/dist/src/shared/productionAcceptance.d.ts +63 -0
  219. package/dist/src/shared/productionAcceptance.js +201 -0
  220. package/dist/src/shared/schema-options.d.ts +16 -0
  221. package/dist/src/shared/schema-options.js +138 -0
  222. package/dist/src/shared/schema.d.ts +63 -0
  223. package/dist/src/shared/schema.js +627 -0
  224. package/dist/src/shared/styleSecurity.d.ts +2 -0
  225. package/dist/src/shared/styleSecurity.js +35 -0
  226. package/dist/src/transformers/formily.d.ts +34 -0
  227. package/dist/src/transformers/formily.js +943 -0
  228. package/dist/src/transformers/index.d.ts +1 -0
  229. package/dist/src/transformers/index.js +1 -0
  230. package/dist/src/types.d.ts +186 -0
  231. package/dist/src/types.js +1 -0
  232. package/dist/src/widgets/ActionsWidget/index.d.ts +3 -0
  233. package/dist/src/widgets/ActionsWidget/index.js +10 -0
  234. package/dist/src/widgets/ComponentTreeWidget/index.d.ts +3 -0
  235. package/dist/src/widgets/ComponentTreeWidget/index.js +333 -0
  236. package/dist/src/widgets/NodeActionsWidget/index.d.ts +2 -0
  237. package/dist/src/widgets/NodeActionsWidget/index.js +125 -0
  238. package/dist/src/widgets/OutlineTreeWidget/index.d.ts +3 -0
  239. package/dist/src/widgets/OutlineTreeWidget/index.js +432 -0
  240. package/dist/src/widgets/OutlineTreeWidget/shared.d.ts +32 -0
  241. package/dist/src/widgets/OutlineTreeWidget/shared.js +79 -0
  242. package/dist/src/widgets/PreviewWidget/index.d.ts +2 -0
  243. package/dist/src/widgets/PreviewWidget/index.js +1566 -0
  244. package/dist/src/widgets/ProductionReadinessWidget/index.d.ts +18 -0
  245. package/dist/src/widgets/ProductionReadinessWidget/index.js +356 -0
  246. package/dist/src/widgets/RemotePersistenceStatusWidget/index.d.ts +18 -0
  247. package/dist/src/widgets/RemotePersistenceStatusWidget/index.js +438 -0
  248. package/dist/src/widgets/RemoteVersionHistoryWidget/index.d.ts +39 -0
  249. package/dist/src/widgets/RemoteVersionHistoryWidget/index.js +475 -0
  250. package/dist/src/widgets/ResourceWidget/index.d.ts +3 -0
  251. package/dist/src/widgets/ResourceWidget/index.js +491 -0
  252. package/dist/src/widgets/SchemaCodeView/index.d.ts +7 -0
  253. package/dist/src/widgets/SchemaCodeView/index.js +225 -0
  254. package/dist/src/widgets/SchemaEditorWidget/index.d.ts +10 -0
  255. package/dist/src/widgets/SchemaEditorWidget/index.js +484 -0
  256. package/dist/src/widgets/SettingsPanelWidget/index.d.ts +3 -0
  257. package/dist/src/widgets/SettingsPanelWidget/index.js +190 -0
  258. package/dist/src/widgets/StorageActionsWidget/index.d.ts +2 -0
  259. package/dist/src/widgets/StorageActionsWidget/index.js +284 -0
  260. package/dist/src/widgets/index.d.ts +13 -0
  261. package/dist/src/widgets/index.js +13 -0
  262. package/package.json +100 -4
@@ -0,0 +1,143 @@
1
+ import { type IDataBindingDescriptor } from '@yimoka/designable-antd';
2
+ import type React from 'react';
3
+ export { getOptionsFromSchema, withSchemaOptions, withSchemaTransferDataSource, withSchemaTreeData, } from "../../src/shared/schema-options.js";
4
+ export type SettingsSchemaProperties = Record<string, Record<string, unknown>>;
5
+ export declare const createDataBindingProperty: (manualKeys: IDataBindingDescriptor["manualKeys"]) => {
6
+ type: string;
7
+ title: string;
8
+ 'x-component': string;
9
+ 'x-component-props': {
10
+ descriptor: IDataBindingDescriptor;
11
+ };
12
+ 'x-designable-controlled-props': string[];
13
+ };
14
+ export declare const designPlaceholderStyle: React.CSSProperties;
15
+ export declare const hasDesignerProps: (props: Record<string, unknown>) => boolean;
16
+ export declare const splitDesignableStyleProps: <T extends Record<string, unknown>>(props: T) => {
17
+ componentProps: Record<string, unknown>;
18
+ designerProps: Record<string, unknown>;
19
+ wrapperStyle: React.CSSProperties | undefined;
20
+ };
21
+ export declare const pickControlVisualStyle: (style: React.CSSProperties | undefined) => React.CSSProperties | undefined;
22
+ export declare const fieldMetaProperties: SettingsSchemaProperties;
23
+ export declare const displayProperty: {
24
+ type: string;
25
+ title: string;
26
+ 'x-decorator': string;
27
+ 'x-component': string;
28
+ };
29
+ export declare const fieldStateProperties: SettingsSchemaProperties;
30
+ export declare const fieldAdvancedProperties: SettingsSchemaProperties;
31
+ export declare const containerAdvancedProperties: SettingsSchemaProperties;
32
+ export declare const containerMetaProperties: SettingsSchemaProperties;
33
+ export declare const placeholderProperty: {
34
+ type: string;
35
+ title: string;
36
+ 'x-decorator': string;
37
+ 'x-component': string;
38
+ };
39
+ export declare const allowClearProperty: {
40
+ type: string;
41
+ title: string;
42
+ 'x-decorator': string;
43
+ 'x-component': string;
44
+ };
45
+ export declare const autoFocusProperty: {
46
+ type: string;
47
+ title: string;
48
+ 'x-decorator': string;
49
+ 'x-component': string;
50
+ };
51
+ export declare const sizeProperty: {
52
+ type: string;
53
+ title: string;
54
+ 'x-decorator': string;
55
+ 'x-component': string;
56
+ };
57
+ export declare const optionsProperty: {
58
+ type: string;
59
+ title: string;
60
+ 'x-decorator': string;
61
+ 'x-component': string;
62
+ };
63
+ export declare const showSearchProperty: {
64
+ type: string;
65
+ title: string;
66
+ 'x-decorator': string;
67
+ 'x-component': string;
68
+ };
69
+ export declare const createSwitchProperty: (title: string) => {
70
+ type: string;
71
+ title: string;
72
+ 'x-decorator': string;
73
+ 'x-component': string;
74
+ };
75
+ export declare const createNumberProperty: (title: string) => {
76
+ type: string;
77
+ title: string;
78
+ 'x-decorator': string;
79
+ 'x-component': string;
80
+ };
81
+ export declare const createSelectProperty: (title: string, values: Array<string | null>) => {
82
+ type: string;
83
+ title: string;
84
+ 'x-decorator': string;
85
+ 'x-component': string;
86
+ };
87
+ export declare const createInputProperty: (title: string) => {
88
+ type: string;
89
+ title: string;
90
+ 'x-decorator': string;
91
+ 'x-component': string;
92
+ };
93
+ export declare const createJSONProperty: (title: string, type?: string, placeholder?: string) => {
94
+ type: string;
95
+ title: string;
96
+ 'x-decorator': string;
97
+ 'x-component': string;
98
+ };
99
+ export declare const createExpressionProperty: (title: string, placeholder?: string) => {
100
+ type: string;
101
+ title: string;
102
+ 'x-decorator': string;
103
+ 'x-component': string;
104
+ };
105
+ export declare const createValueProperty: (title: string, placeholder?: string) => {
106
+ type: string;
107
+ title: string;
108
+ 'x-decorator': string;
109
+ 'x-component': string;
110
+ };
111
+ export declare const statusProperty: {
112
+ type: string;
113
+ title: string;
114
+ 'x-decorator': string;
115
+ 'x-component': string;
116
+ };
117
+ export declare const createDataSourceProperty: (title: string) => {
118
+ type: string;
119
+ title: string;
120
+ 'x-decorator': string;
121
+ 'x-component': string;
122
+ };
123
+ export declare const inputAddonProperties: SettingsSchemaProperties;
124
+ export declare const inputLimitProperties: SettingsSchemaProperties;
125
+ export declare const selectSearchProperties: SettingsSchemaProperties;
126
+ export declare const selectPopupProperties: SettingsSchemaProperties;
127
+ export declare const multiSelectProperties: SettingsSchemaProperties;
128
+ export declare const createFieldPropsSchema: (properties: SettingsSchemaProperties) => {
129
+ type: string;
130
+ properties: {
131
+ [x: string]: Record<string, unknown>;
132
+ };
133
+ };
134
+ export declare const createFieldResourceProps: (name: string, title: string, props?: Record<string, unknown>) => {
135
+ name: string;
136
+ title: string;
137
+ };
138
+ export declare const createContainerPropsSchema: (properties: SettingsSchemaProperties) => {
139
+ type: string;
140
+ properties: {
141
+ [x: string]: Record<string, unknown>;
142
+ };
143
+ };
@@ -0,0 +1,315 @@
1
+ import { createDataBindingSetterSchema, } from '@yimoka/designable-antd';
2
+ export { getOptionsFromSchema, withSchemaOptions, withSchemaTransferDataSource, withSchemaTreeData, } from "../../src/shared/schema-options.js";
3
+ export const createDataBindingProperty = (manualKeys) => createDataBindingSetterSchema({
4
+ manualKeys,
5
+ storeKey: 'dataKey',
6
+ });
7
+ export const designPlaceholderStyle = {
8
+ color: '#7b8797',
9
+ fontSize: 12,
10
+ lineHeight: '20px',
11
+ };
12
+ export const hasDesignerProps = (props) => (Object.keys(props).length > 0);
13
+ export const splitDesignableStyleProps = (props) => {
14
+ const designerProps = {};
15
+ const componentProps = {};
16
+ let wrapperStyle;
17
+ Object.entries(props).forEach(([key, value]) => {
18
+ if (key.startsWith('data-designer')) {
19
+ designerProps[key] = value;
20
+ return;
21
+ }
22
+ if (key === 'style') {
23
+ wrapperStyle = value;
24
+ return;
25
+ }
26
+ componentProps[key] = value;
27
+ });
28
+ return {
29
+ componentProps,
30
+ designerProps,
31
+ wrapperStyle,
32
+ };
33
+ };
34
+ const CONTROL_VISUAL_STYLE_KEYS = [
35
+ 'background',
36
+ 'backgroundColor',
37
+ 'border',
38
+ 'borderBottom',
39
+ 'borderBottomColor',
40
+ 'borderBottomLeftRadius',
41
+ 'borderBottomRightRadius',
42
+ 'borderBottomStyle',
43
+ 'borderBottomWidth',
44
+ 'borderColor',
45
+ 'borderLeft',
46
+ 'borderLeftColor',
47
+ 'borderLeftStyle',
48
+ 'borderLeftWidth',
49
+ 'borderRadius',
50
+ 'borderRight',
51
+ 'borderRightColor',
52
+ 'borderRightStyle',
53
+ 'borderRightWidth',
54
+ 'borderStyle',
55
+ 'borderTop',
56
+ 'borderTopColor',
57
+ 'borderTopLeftRadius',
58
+ 'borderTopRightRadius',
59
+ 'borderTopStyle',
60
+ 'borderTopWidth',
61
+ 'borderWidth',
62
+ 'boxShadow',
63
+ 'color',
64
+ 'font',
65
+ 'fontFamily',
66
+ 'fontSize',
67
+ 'fontStyle',
68
+ 'fontWeight',
69
+ 'lineHeight',
70
+ 'padding',
71
+ 'paddingBottom',
72
+ 'paddingLeft',
73
+ 'paddingRight',
74
+ 'paddingTop',
75
+ 'textAlign',
76
+ 'textDecoration',
77
+ ];
78
+ const CONTROL_VISUAL_STYLE_KEY_SET = new Set(CONTROL_VISUAL_STYLE_KEYS);
79
+ export const pickControlVisualStyle = (style) => {
80
+ if (!style)
81
+ return undefined;
82
+ const controlStyle = {};
83
+ Object.entries(style).forEach(([key, value]) => {
84
+ if (CONTROL_VISUAL_STYLE_KEY_SET.has(key) && value !== undefined) {
85
+ controlStyle[key] = value;
86
+ }
87
+ });
88
+ return Object.keys(controlStyle).length ? controlStyle : undefined;
89
+ };
90
+ const createSetter = (title, component, type, props = {}) => ({
91
+ type,
92
+ title,
93
+ 'x-decorator': 'FormItem',
94
+ 'x-component': component,
95
+ ...props,
96
+ });
97
+ export const fieldMetaProperties = {
98
+ name: createSetter('字段标识', 'Input', 'string'),
99
+ title: createSetter('字段标题', 'Input', 'string'),
100
+ description: createSetter('字段说明', 'Input', 'string'),
101
+ required: createSetter('必填', 'Switch', 'boolean'),
102
+ };
103
+ export const displayProperty = createSetter('显示策略', 'Select', 'string', {
104
+ enum: ['visible', 'hidden', 'none', null],
105
+ 'x-component-props': {
106
+ options: [
107
+ { label: '默认', value: null },
108
+ { label: '显示', value: 'visible' },
109
+ { label: '隐藏', value: 'hidden' },
110
+ { label: '不渲染', value: 'none' },
111
+ ],
112
+ },
113
+ });
114
+ export const fieldStateProperties = {
115
+ disabled: createSetter('禁用', 'Switch', 'boolean'),
116
+ readOnly: createSetter('只读', 'Switch', 'boolean'),
117
+ hidden: createSetter('隐藏', 'Switch', 'boolean'),
118
+ 'x-display': displayProperty,
119
+ };
120
+ export const fieldAdvancedProperties = {
121
+ default: createSetter('默认值', 'ValueInput', 'string'),
122
+ enum: createSetter('枚举值', 'EnumInput', 'array'),
123
+ enumNames: createSetter('枚举标签', 'EnumInput', 'array'),
124
+ oneOf: createSetter('选项分支', 'OneOfInput', 'array'),
125
+ 'x-enum': createSetter('扩展枚举', 'OptionsInput', 'array'),
126
+ 'x-visible': createSetter('可见表达式', 'ValueInput', 'boolean', {
127
+ 'x-component-props': {
128
+ include: ['BOOLEAN', 'EXPRESSION'],
129
+ placeholder: '{{$values.enabled}}',
130
+ },
131
+ }),
132
+ 'x-hidden': createSetter('隐藏表达式', 'ValueInput', 'boolean', {
133
+ 'x-component-props': {
134
+ include: ['BOOLEAN', 'EXPRESSION'],
135
+ placeholder: '{{$values.hidden}}',
136
+ },
137
+ }),
138
+ 'x-disabled': createSetter('禁用表达式', 'ValueInput', 'boolean', {
139
+ 'x-component-props': {
140
+ include: ['BOOLEAN', 'EXPRESSION'],
141
+ placeholder: '{{$values.locked}}',
142
+ },
143
+ }),
144
+ 'x-read-only': createSetter('只读表达式', 'ValueInput', 'boolean', {
145
+ 'x-component-props': {
146
+ include: ['BOOLEAN', 'EXPRESSION'],
147
+ placeholder: '{{$values.readonly}}',
148
+ },
149
+ }),
150
+ 'x-pattern': createSetter('交互模式', 'Select', 'string', {
151
+ enum: ['editable', 'disabled', 'readOnly', 'readPretty'],
152
+ 'x-component-props': {
153
+ options: [
154
+ { label: '可编辑', value: 'editable' },
155
+ { label: '禁用', value: 'disabled' },
156
+ { label: '只读', value: 'readOnly' },
157
+ { label: '阅读态', value: 'readPretty' },
158
+ ],
159
+ },
160
+ }),
161
+ 'x-read-pretty': createSetter('阅读态', 'Switch', 'boolean'),
162
+ 'x-decorator-props': {
163
+ type: 'object',
164
+ title: '表单项',
165
+ properties: {
166
+ tooltip: createSetter('提示', 'Input', 'string'),
167
+ help: createSetter('帮助', 'Input', 'string'),
168
+ extra: createSetter('补充', 'Input', 'string'),
169
+ labelCol: createSetter('标签栅格', 'NumberPicker', 'number'),
170
+ wrapperCol: createSetter('控件栅格', 'NumberPicker', 'number'),
171
+ labelWidth: createSetter('标签宽度', 'SizeInput', 'string'),
172
+ wrapperWidth: createSetter('控件宽度', 'SizeInput', 'string'),
173
+ labelAlign: createSetter('标签对齐', 'Select', 'string', {
174
+ enum: ['left', 'right', null],
175
+ }),
176
+ wrapperAlign: createSetter('控件对齐', 'Select', 'string', {
177
+ enum: ['left', 'right', null],
178
+ }),
179
+ layout: createSetter('布局', 'Select', 'string', {
180
+ enum: ['vertical', 'horizontal', 'inline', null],
181
+ }),
182
+ size: createSetter('尺寸', 'Select', 'string', {
183
+ enum: ['large', 'small', 'middle', 'default', null],
184
+ }),
185
+ feedbackLayout: createSetter('反馈布局', 'Select', 'string', {
186
+ enum: ['loose', 'terse', 'popover', 'none', null],
187
+ }),
188
+ tooltipLayout: createSetter('提示布局', 'Select', 'string', {
189
+ enum: ['icon', 'text', null],
190
+ }),
191
+ colon: createSetter('显示冒号', 'Switch', 'boolean'),
192
+ labelWrap: createSetter('标签换行', 'Switch', 'boolean'),
193
+ wrapperWrap: createSetter('控件换行', 'Switch', 'boolean'),
194
+ fullness: createSetter('宽度铺满', 'Switch', 'boolean'),
195
+ inset: createSetter('内嵌布局', 'Switch', 'boolean'),
196
+ bordered: createSetter('显示边框', 'Switch', 'boolean'),
197
+ },
198
+ },
199
+ 'x-validator': createSetter('校验规则', 'ValidatorInput', 'array', {
200
+ 'x-component-props': {
201
+ placeholder: '[{"required":true,"message":"请输入"}]',
202
+ rows: 4,
203
+ },
204
+ }),
205
+ 'x-reactions': createSetter('联动规则', 'ReactionsInput', 'array', {
206
+ 'x-component-props': {
207
+ placeholder: '[{"dependencies":["field"],"fulfill":{"state":{"visible":true}}}]',
208
+ rows: 4,
209
+ },
210
+ }),
211
+ 'x-data': createSetter('数据源', 'DataSourceInput', 'object', {
212
+ 'x-component-props': {
213
+ placeholder: '{"url":"/api/options","method":"GET"}',
214
+ rows: 4,
215
+ },
216
+ }),
217
+ };
218
+ export const containerAdvancedProperties = {
219
+ 'x-visible': fieldAdvancedProperties['x-visible'],
220
+ 'x-hidden': fieldAdvancedProperties['x-hidden'],
221
+ 'x-disabled': fieldAdvancedProperties['x-disabled'],
222
+ 'x-read-only': fieldAdvancedProperties['x-read-only'],
223
+ 'x-pattern': fieldAdvancedProperties['x-pattern'],
224
+ 'x-read-pretty': fieldAdvancedProperties['x-read-pretty'],
225
+ 'x-decorator-props': fieldAdvancedProperties['x-decorator-props'],
226
+ 'x-reactions': fieldAdvancedProperties['x-reactions'],
227
+ };
228
+ export const containerMetaProperties = {
229
+ title: createSetter('标题', 'Input', 'string'),
230
+ description: createSetter('说明', 'Input', 'string'),
231
+ hidden: createSetter('隐藏', 'Switch', 'boolean'),
232
+ 'x-display': displayProperty,
233
+ };
234
+ export const placeholderProperty = createSetter('占位符', 'Input', 'string');
235
+ export const allowClearProperty = createSetter('可清除', 'Switch', 'boolean');
236
+ export const autoFocusProperty = createSetter('自动聚焦', 'Switch', 'boolean');
237
+ export const sizeProperty = createSetter('尺寸', 'Select', 'string', {
238
+ enum: ['small', 'middle', 'large', null],
239
+ });
240
+ export const optionsProperty = createSetter('选项', 'OptionsInput', 'array');
241
+ export const showSearchProperty = createSetter('可搜索', 'Switch', 'boolean');
242
+ export const createSwitchProperty = (title) => (createSetter(title, 'Switch', 'boolean'));
243
+ export const createNumberProperty = (title) => (createSetter(title, 'NumberPicker', 'number'));
244
+ export const createSelectProperty = (title, values) => createSetter(title, 'Select', 'string', { enum: values });
245
+ export const createInputProperty = (title) => (createSetter(title, 'Input', 'string'));
246
+ export const createJSONProperty = (title, type = 'object', placeholder) => createSetter(title, 'JSONInput', type, {
247
+ 'x-component-props': {
248
+ placeholder,
249
+ rows: 4,
250
+ },
251
+ });
252
+ export const createExpressionProperty = (title, placeholder) => createSetter(title, 'ValueInput', 'string', {
253
+ 'x-component-props': {
254
+ include: ['EXPRESSION'],
255
+ placeholder,
256
+ },
257
+ });
258
+ export const createValueProperty = (title, placeholder) => createSetter(title, 'ValueInput', 'string', {
259
+ 'x-component-props': {
260
+ include: ['TEXT', 'JSON', 'EXPRESSION'],
261
+ placeholder,
262
+ },
263
+ });
264
+ export const statusProperty = createSelectProperty('状态', ['error', 'warning', null]);
265
+ export const createDataSourceProperty = (title) => createSetter(title, 'DataSourceInput', 'object');
266
+ export const inputAddonProperties = {
267
+ addonBefore: createInputProperty('前置标签'),
268
+ addonAfter: createInputProperty('后置标签'),
269
+ prefix: createInputProperty('前缀'),
270
+ suffix: createInputProperty('后缀'),
271
+ };
272
+ export const inputLimitProperties = {
273
+ maxLength: createNumberProperty('最大长度'),
274
+ showCount: createSwitchProperty('显示计数'),
275
+ };
276
+ export const selectSearchProperties = {
277
+ filterOption: createSetter('过滤选项', 'ValueInput', 'boolean', {
278
+ 'x-component-props': {
279
+ include: ['BOOLEAN', 'EXPRESSION'],
280
+ },
281
+ }),
282
+ optionFilterProp: createSelectProperty('搜索字段', ['label', 'value', 'children', null]),
283
+ };
284
+ export const selectPopupProperties = {
285
+ listHeight: createNumberProperty('弹层高度'),
286
+ notFoundContent: createInputProperty('空状态文案'),
287
+ virtual: createSwitchProperty('虚拟滚动'),
288
+ };
289
+ export const multiSelectProperties = {
290
+ maxTagCount: createNumberProperty('最大标签数'),
291
+ maxTagTextLength: createNumberProperty('标签文本长度'),
292
+ maxTagPlaceholder: createInputProperty('折叠标签文案'),
293
+ };
294
+ export const createFieldPropsSchema = (properties) => ({
295
+ type: 'object',
296
+ properties: {
297
+ ...fieldMetaProperties,
298
+ ...fieldStateProperties,
299
+ ...properties,
300
+ ...fieldAdvancedProperties,
301
+ },
302
+ });
303
+ export const createFieldResourceProps = (name, title, props = {}) => ({
304
+ name,
305
+ title,
306
+ ...props,
307
+ });
308
+ export const createContainerPropsSchema = (properties) => ({
309
+ type: 'object',
310
+ properties: {
311
+ ...containerMetaProperties,
312
+ ...properties,
313
+ ...containerAdvancedProperties,
314
+ },
315
+ });
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ import type { IPlaygroundProps } from "./types.js";
3
+ export declare const Playground: <S = unknown>(props: IPlaygroundProps<S>) => React.ReactElement;