@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,260 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { createBehavior, createResource } from '@yimoka/designable-core';
3
+ import { DroppableWidget } from '@yimoka/designable-react';
4
+ import { createContainerPropsSchema, designPlaceholderStyle, hasDesignerProps, splitDesignableStyleProps, } from "../shared.js";
5
+ const getCssSize = (value) => {
6
+ if (typeof value === 'number')
7
+ return `${value}px`;
8
+ return value;
9
+ };
10
+ const layoutSizeMap = {
11
+ default: {
12
+ gap: 12,
13
+ minHeight: 72,
14
+ padding: 12,
15
+ titleFontSize: 13,
16
+ },
17
+ large: {
18
+ gap: 14,
19
+ minHeight: 84,
20
+ padding: 14,
21
+ titleFontSize: 14,
22
+ },
23
+ small: {
24
+ gap: 8,
25
+ minHeight: 56,
26
+ padding: 8,
27
+ titleFontSize: 12,
28
+ },
29
+ };
30
+ const resolveFormLayoutConfig = (layoutProps) => ({
31
+ bordered: layoutProps.bordered ?? true,
32
+ className: layoutProps.className,
33
+ colon: layoutProps.colon,
34
+ feedbackLayout: layoutProps.feedbackLayout,
35
+ fullness: layoutProps.fullness,
36
+ inset: layoutProps.inset,
37
+ labelAlign: layoutProps.labelAlign,
38
+ labelCol: layoutProps.labelCol ?? 6,
39
+ labelWidth: layoutProps.labelWidth,
40
+ labelWrap: layoutProps.labelWrap,
41
+ layout: layoutProps.layout ?? 'horizontal',
42
+ shallow: layoutProps.shallow,
43
+ size: layoutProps.size ?? 'default',
44
+ title: layoutProps.title,
45
+ tooltipLayout: layoutProps.tooltipLayout,
46
+ wrapperAlign: layoutProps.wrapperAlign,
47
+ wrapperCol: layoutProps.wrapperCol ?? 16,
48
+ wrapperWidth: layoutProps.wrapperWidth,
49
+ wrapperWrap: layoutProps.wrapperWrap,
50
+ });
51
+ const getLayoutSizeStyle = (size) => (layoutSizeMap[size ?? 'default'] ?? layoutSizeMap.default);
52
+ const getSectionDataProps = (config) => ({
53
+ 'data-bordered': String(Boolean(config.bordered)),
54
+ 'data-colon': String(Boolean(config.colon)),
55
+ 'data-designable-form-layout': '',
56
+ 'data-feedback-layout': config.feedbackLayout,
57
+ 'data-fullness': String(Boolean(config.fullness)),
58
+ 'data-inset': String(Boolean(config.inset)),
59
+ 'data-label-align': config.labelAlign,
60
+ 'data-label-col': config.labelCol,
61
+ 'data-label-wrap': String(Boolean(config.labelWrap)),
62
+ 'data-layout': config.layout,
63
+ 'data-shallow': String(Boolean(config.shallow)),
64
+ 'data-size': config.size,
65
+ 'data-tooltip-layout': config.tooltipLayout,
66
+ 'data-wrapper-align': config.wrapperAlign,
67
+ 'data-wrapper-col': config.wrapperCol,
68
+ 'data-wrapper-wrap': String(Boolean(config.wrapperWrap)),
69
+ });
70
+ const getSectionStyle = (bordered, sizeStyle) => ({
71
+ background: '#fff',
72
+ border: bordered ? '1px solid #d9e4f2' : 0,
73
+ borderRadius: bordered ? 6 : 0,
74
+ display: 'grid',
75
+ gap: sizeStyle.gap,
76
+ minHeight: sizeStyle.minHeight,
77
+ padding: sizeStyle.padding,
78
+ width: '100%',
79
+ });
80
+ const getGridTemplateColumns = (config) => {
81
+ if (config.layout !== 'horizontal')
82
+ return undefined;
83
+ const labelSize = getCssSize(config.labelWidth) || `${config.labelCol}fr`;
84
+ const wrapperSize = getCssSize(config.wrapperWidth) || `${config.wrapperCol}fr`;
85
+ return `${labelSize} ${wrapperSize}`;
86
+ };
87
+ const getContentStyle = (config, sizeStyle) => ({
88
+ alignItems: config.wrapperAlign === 'right' ? 'flex-end' : 'stretch',
89
+ display: config.layout === 'inline' ? 'flex' : 'grid',
90
+ flexWrap: config.labelWrap || config.wrapperWrap ? 'wrap' : 'nowrap',
91
+ gap: sizeStyle.gap,
92
+ gridTemplateColumns: getGridTemplateColumns(config),
93
+ justifyItems: config.wrapperAlign === 'right' ? 'end' : 'stretch',
94
+ paddingInlineStart: config.inset ? sizeStyle.padding : undefined,
95
+ textAlign: config.labelAlign,
96
+ width: config.fullness ? '100%' : undefined,
97
+ });
98
+ const renderLayoutTitle = (title, sizeStyle) => {
99
+ if (!title)
100
+ return null;
101
+ return (_jsx("div", { style: {
102
+ color: '#253040',
103
+ fontSize: sizeStyle.titleFontSize,
104
+ fontWeight: 600,
105
+ lineHeight: '20px',
106
+ }, children: title }));
107
+ };
108
+ const renderLayoutContent = (children, isDesignMode) => {
109
+ if (children)
110
+ return children;
111
+ if (!isDesignMode)
112
+ return null;
113
+ return (_jsx("div", { style: designPlaceholderStyle, children: "\u62D6\u5165\u5B57\u6BB5\u7EC4\u6210\u5E03\u5C40\u533A\u57DF" }));
114
+ };
115
+ export const FormLayout = (props) => {
116
+ const { componentProps: layoutProps, designerProps, wrapperStyle, } = splitDesignableStyleProps(props);
117
+ const { children } = layoutProps;
118
+ const config = resolveFormLayoutConfig(layoutProps);
119
+ const isDesignMode = hasDesignerProps(designerProps);
120
+ const sizeStyle = getLayoutSizeStyle(config.size);
121
+ return (_jsx(DroppableWidget, { ...designerProps, placeholder: false, style: wrapperStyle, children: _jsxs("section", { ...getSectionDataProps(config), className: config.className, style: getSectionStyle(config.bordered, sizeStyle), children: [renderLayoutTitle(config.title, sizeStyle), _jsx("div", { style: getContentStyle(config, sizeStyle), children: renderLayoutContent(children, isDesignMode) })] }) }));
122
+ };
123
+ FormLayout.Behavior = createBehavior({
124
+ name: 'FormLayout',
125
+ selector: node => node.componentName === 'FormLayout',
126
+ designerProps: {
127
+ droppable: true,
128
+ propsSchema: createContainerPropsSchema({
129
+ layout: {
130
+ type: 'string',
131
+ enum: ['horizontal', 'vertical', 'inline'],
132
+ 'x-decorator': 'FormItem',
133
+ 'x-component': 'Select',
134
+ title: '布局',
135
+ },
136
+ labelCol: {
137
+ type: 'number',
138
+ 'x-decorator': 'FormItem',
139
+ 'x-component': 'NumberPicker',
140
+ title: '标签栅格',
141
+ },
142
+ wrapperCol: {
143
+ type: 'number',
144
+ 'x-decorator': 'FormItem',
145
+ 'x-component': 'NumberPicker',
146
+ title: '控件栅格',
147
+ },
148
+ labelWidth: {
149
+ type: 'string',
150
+ 'x-decorator': 'FormItem',
151
+ 'x-component': 'SizeInput',
152
+ title: '标签宽度',
153
+ },
154
+ wrapperWidth: {
155
+ type: 'string',
156
+ 'x-decorator': 'FormItem',
157
+ 'x-component': 'SizeInput',
158
+ title: '控件宽度',
159
+ },
160
+ feedbackLayout: {
161
+ type: 'string',
162
+ enum: ['loose', 'terse', 'popover', 'none'],
163
+ 'x-decorator': 'FormItem',
164
+ 'x-component': 'Select',
165
+ title: '反馈布局',
166
+ },
167
+ tooltipLayout: {
168
+ type: 'string',
169
+ enum: ['icon', 'text'],
170
+ 'x-decorator': 'FormItem',
171
+ 'x-component': 'Select',
172
+ title: '提示布局',
173
+ },
174
+ labelAlign: {
175
+ type: 'string',
176
+ enum: ['left', 'right'],
177
+ 'x-decorator': 'FormItem',
178
+ 'x-component': 'Select',
179
+ title: '标签对齐',
180
+ },
181
+ wrapperAlign: {
182
+ type: 'string',
183
+ enum: ['left', 'right'],
184
+ 'x-decorator': 'FormItem',
185
+ 'x-component': 'Select',
186
+ title: '控件对齐',
187
+ },
188
+ colon: {
189
+ type: 'boolean',
190
+ 'x-decorator': 'FormItem',
191
+ 'x-component': 'Switch',
192
+ title: '显示冒号',
193
+ },
194
+ labelWrap: {
195
+ type: 'boolean',
196
+ 'x-decorator': 'FormItem',
197
+ 'x-component': 'Switch',
198
+ title: '标签换行',
199
+ },
200
+ wrapperWrap: {
201
+ type: 'boolean',
202
+ 'x-decorator': 'FormItem',
203
+ 'x-component': 'Switch',
204
+ title: '控件换行',
205
+ },
206
+ fullness: {
207
+ type: 'boolean',
208
+ 'x-decorator': 'FormItem',
209
+ 'x-component': 'Switch',
210
+ title: '控件占满',
211
+ },
212
+ inset: {
213
+ type: 'boolean',
214
+ 'x-decorator': 'FormItem',
215
+ 'x-component': 'Switch',
216
+ title: '内联布局',
217
+ },
218
+ shallow: {
219
+ type: 'boolean',
220
+ 'x-decorator': 'FormItem',
221
+ 'x-component': 'Switch',
222
+ title: '浅传递',
223
+ },
224
+ bordered: {
225
+ type: 'boolean',
226
+ 'x-decorator': 'FormItem',
227
+ 'x-component': 'Switch',
228
+ title: '显示边框',
229
+ },
230
+ size: {
231
+ type: 'string',
232
+ enum: ['large', 'small', 'default'],
233
+ 'x-decorator': 'FormItem',
234
+ 'x-component': 'Select',
235
+ title: '尺寸',
236
+ },
237
+ }),
238
+ defaultProps: {
239
+ bordered: true,
240
+ labelCol: 6,
241
+ layout: 'horizontal',
242
+ wrapperCol: 16,
243
+ },
244
+ },
245
+ });
246
+ FormLayout.Resource = createResource({
247
+ icon: 'FormOutlined',
248
+ elements: [
249
+ {
250
+ componentName: 'FormLayout',
251
+ props: {
252
+ title: '表单布局',
253
+ bordered: true,
254
+ labelCol: 6,
255
+ layout: 'horizontal',
256
+ wrapperCol: 16,
257
+ },
258
+ },
259
+ ],
260
+ });
@@ -0,0 +1,15 @@
1
+ import { Tabs as AntdTabs } from '@yimoka/antd';
2
+ import { DnFC } from '@yimoka/designable-react';
3
+ import React from 'react';
4
+ interface IFormTabPaneProps {
5
+ children?: React.ReactNode;
6
+ disabled?: boolean;
7
+ forceRender?: boolean;
8
+ name?: string;
9
+ tab?: React.ReactNode;
10
+ tabKey?: string;
11
+ title?: React.ReactNode;
12
+ }
13
+ export declare const FormTab: DnFC<React.ComponentProps<typeof AntdTabs>>;
14
+ export declare const FormTabPane: DnFC<IFormTabPaneProps>;
15
+ export {};
@@ -0,0 +1,186 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Tabs as AntdTabs } from '@yimoka/antd';
3
+ import { createBehavior, createResource } from '@yimoka/designable-core';
4
+ import { DroppableWidget, useTreeNode } from '@yimoka/designable-react';
5
+ import React from 'react';
6
+ import { createContainerPropsSchema, createNumberProperty, createSwitchProperty, createValueProperty, designPlaceholderStyle, hasDesignerProps, splitDesignableStyleProps, } from "../shared.js";
7
+ const getPaneProps = (child) => (child.props && typeof child.props === 'object'
8
+ ? child.props
9
+ : {});
10
+ const toReactNode = (value) => (React.isValidElement(value)
11
+ || typeof value === 'string'
12
+ || typeof value === 'number'
13
+ ? value
14
+ : undefined);
15
+ const getPaneKey = (child, props, index) => (String(props.name ?? props.tabKey ?? child.key ?? `tab_${index + 1}`));
16
+ const renderEditableTab = (tab, paneId) => {
17
+ if (tab === undefined || tab === null)
18
+ return undefined;
19
+ return (_jsx("span", { "data-content-editable": "tab", "data-content-editable-node-id": paneId, children: tab }));
20
+ };
21
+ const resolvePaneTab = (nodeProps, paneProps, index) => {
22
+ const title = toReactNode(nodeProps.title) ?? paneProps.title;
23
+ const tab = toReactNode(nodeProps.tab) ?? paneProps.tab;
24
+ return tab ?? title ?? `选项 ${index + 1}`;
25
+ };
26
+ const createFormTabItem = (child, index, paneNode) => {
27
+ const nodeProps = paneNode?.props ?? {};
28
+ const paneProps = getPaneProps(child);
29
+ return {
30
+ key: String(nodeProps.name ?? nodeProps.tabKey ?? getPaneKey(child, paneProps, index)),
31
+ label: renderEditableTab(resolvePaneTab(nodeProps, paneProps, index), paneNode?.id),
32
+ children: child,
33
+ };
34
+ };
35
+ const getFormTabItems = (children, nodeChildren, fallbackItems) => {
36
+ const childItems = React.Children.toArray(children)
37
+ .filter(React.isValidElement)
38
+ .map((child, index) => createFormTabItem(child, index, nodeChildren?.[index]));
39
+ if (childItems.length)
40
+ return childItems;
41
+ return fallbackItems;
42
+ };
43
+ const renderFormTabPaneContent = (children, isDesignMode, tab, title) => {
44
+ if (children)
45
+ return children;
46
+ if (!isDesignMode)
47
+ return null;
48
+ return (_jsx("div", { style: designPlaceholderStyle, children: tab || title || '选项卡内容' }));
49
+ };
50
+ export const FormTab = (props) => {
51
+ const { componentProps: tabProps, designerProps, wrapperStyle, } = splitDesignableStyleProps(props);
52
+ const { children, ...restTabProps } = tabProps;
53
+ const node = useTreeNode();
54
+ const items = getFormTabItems(children, node?.children, restTabProps.items);
55
+ return (_jsx("div", { ...designerProps, style: wrapperStyle, children: _jsx(AntdTabs, { ...restTabProps, items: items }) }));
56
+ };
57
+ FormTab.Behavior = createBehavior({
58
+ name: 'FormTab',
59
+ selector: node => node.componentName === 'FormTab',
60
+ designerProps: {
61
+ droppable: true,
62
+ propsSchema: createContainerPropsSchema({
63
+ activeKey: createValueProperty('当前激活项', 'tab_1'),
64
+ defaultActiveKey: createValueProperty('默认激活项', 'tab_1'),
65
+ type: {
66
+ type: 'string',
67
+ enum: ['line', 'card'],
68
+ 'x-decorator': 'FormItem',
69
+ 'x-component': 'Select',
70
+ title: '类型',
71
+ },
72
+ size: {
73
+ type: 'string',
74
+ enum: ['large', 'small', 'default'],
75
+ 'x-decorator': 'FormItem',
76
+ 'x-component': 'Select',
77
+ title: '尺寸',
78
+ },
79
+ tabPosition: {
80
+ type: 'string',
81
+ enum: ['top', 'right', 'bottom', 'left'],
82
+ 'x-decorator': 'FormItem',
83
+ 'x-component': 'Select',
84
+ title: '标签位置',
85
+ },
86
+ centered: {
87
+ type: 'boolean',
88
+ 'x-decorator': 'FormItem',
89
+ 'x-component': 'Switch',
90
+ title: '标签居中',
91
+ },
92
+ animated: {
93
+ type: 'boolean',
94
+ 'x-decorator': 'FormItem',
95
+ 'x-component': 'Switch',
96
+ title: '启用动画',
97
+ },
98
+ tabBarGutter: createNumberProperty('标签间距'),
99
+ destroyInactiveTabPane: createSwitchProperty('销毁隐藏面板'),
100
+ }),
101
+ },
102
+ });
103
+ FormTab.Resource = createResource({
104
+ icon: 'ProfileOutlined',
105
+ elements: [
106
+ {
107
+ componentName: 'FormTab',
108
+ props: {
109
+ type: 'line',
110
+ },
111
+ children: [
112
+ {
113
+ componentName: 'FormTab.TabPane',
114
+ props: {
115
+ name: 'tab_1',
116
+ tab: '选项一',
117
+ },
118
+ },
119
+ {
120
+ componentName: 'FormTab.TabPane',
121
+ props: {
122
+ name: 'tab_2',
123
+ tab: '选项二',
124
+ },
125
+ },
126
+ ],
127
+ },
128
+ ],
129
+ });
130
+ export const FormTabPane = (props) => {
131
+ const { componentProps: paneProps, designerProps, wrapperStyle, } = splitDesignableStyleProps(props);
132
+ const { children, tab, title } = paneProps;
133
+ const isDesignMode = hasDesignerProps(designerProps);
134
+ return (_jsx(DroppableWidget, { ...designerProps, placeholder: false, style: wrapperStyle, children: _jsx("div", { "data-designable-form-tab-pane": "", style: { minHeight: 48 }, children: renderFormTabPaneContent(children, isDesignMode, tab, title) }) }));
135
+ };
136
+ FormTabPane.Behavior = createBehavior({
137
+ name: 'FormTab.TabPane',
138
+ selector: node => node.componentName === 'FormTab.TabPane',
139
+ designerProps: {
140
+ droppable: true,
141
+ propsSchema: createContainerPropsSchema({
142
+ name: {
143
+ type: 'string',
144
+ 'x-decorator': 'FormItem',
145
+ 'x-component': 'Input',
146
+ title: '标识',
147
+ },
148
+ tab: {
149
+ type: 'string',
150
+ 'x-decorator': 'FormItem',
151
+ 'x-component': 'Input',
152
+ title: '面板标题',
153
+ },
154
+ tabKey: {
155
+ type: 'string',
156
+ 'x-decorator': 'FormItem',
157
+ 'x-component': 'Input',
158
+ title: '标签 Key',
159
+ },
160
+ disabled: {
161
+ type: 'boolean',
162
+ 'x-decorator': 'FormItem',
163
+ 'x-component': 'Switch',
164
+ title: '禁用',
165
+ },
166
+ forceRender: {
167
+ type: 'boolean',
168
+ 'x-decorator': 'FormItem',
169
+ 'x-component': 'Switch',
170
+ title: '强制渲染',
171
+ },
172
+ }),
173
+ },
174
+ });
175
+ FormTabPane.Resource = createResource({
176
+ icon: 'ProfileOutlined',
177
+ elements: [
178
+ {
179
+ componentName: 'FormTab.TabPane',
180
+ props: {
181
+ name: 'tab',
182
+ tab: '选项',
183
+ },
184
+ },
185
+ ],
186
+ });
@@ -0,0 +1,4 @@
1
+ import { Col as AntdCol } from '@yimoka/antd';
2
+ import { DnFC } from '@yimoka/designable-react';
3
+ import React from 'react';
4
+ export declare const GridCol: DnFC<React.ComponentProps<typeof AntdCol>>;
@@ -0,0 +1,53 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Col as AntdCol } from '@yimoka/antd';
3
+ import { createBehavior, createResource } from '@yimoka/designable-core';
4
+ import { DroppableWidget } from '@yimoka/designable-react';
5
+ import { createContainerPropsSchema, createInputProperty, splitDesignableStyleProps } from "../shared.js";
6
+ const createNumberGridColProperty = (title) => ({
7
+ type: 'number',
8
+ 'x-decorator': 'FormItem',
9
+ 'x-component': 'NumberPicker',
10
+ title,
11
+ });
12
+ export const GridCol = (props) => {
13
+ const { componentProps: colProps, designerProps, wrapperStyle, } = splitDesignableStyleProps(props);
14
+ const { children, ...restColProps } = colProps;
15
+ return (_jsx(AntdCol, { ...restColProps, style: { minHeight: 40 }, children: _jsx(DroppableWidget, { ...designerProps, placeholder: false, style: {
16
+ boxSizing: 'border-box',
17
+ minHeight: 40,
18
+ width: '100%',
19
+ ...wrapperStyle,
20
+ }, children: children }) }));
21
+ };
22
+ GridCol.Behavior = createBehavior({
23
+ name: 'GridCol',
24
+ selector: node => node.componentName === 'GridCol',
25
+ designerProps: {
26
+ droppable: true,
27
+ propsSchema: createContainerPropsSchema({
28
+ span: createNumberGridColProperty('占位格数'),
29
+ offset: createNumberGridColProperty('左侧间隔'),
30
+ order: createNumberGridColProperty('排序'),
31
+ pull: createNumberGridColProperty('左移格数'),
32
+ push: createNumberGridColProperty('右移格数'),
33
+ xs: createNumberGridColProperty('手机格数'),
34
+ sm: createNumberGridColProperty('小屏格数'),
35
+ md: createNumberGridColProperty('平板格数'),
36
+ lg: createNumberGridColProperty('桌面格数'),
37
+ xl: createNumberGridColProperty('宽屏格数'),
38
+ xxl: createNumberGridColProperty('超宽屏格数'),
39
+ flex: createInputProperty('弹性布局'),
40
+ }),
41
+ },
42
+ });
43
+ GridCol.Resource = createResource({
44
+ icon: 'ColumnHeightOutlined',
45
+ elements: [
46
+ {
47
+ componentName: 'GridCol',
48
+ props: {
49
+ span: 12,
50
+ },
51
+ },
52
+ ],
53
+ });
@@ -0,0 +1,4 @@
1
+ import { Row as AntdRow } from '@yimoka/antd';
2
+ import { DnFC } from '@yimoka/designable-react';
3
+ import React from 'react';
4
+ export declare const GridRow: DnFC<React.ComponentProps<typeof AntdRow>>;
@@ -0,0 +1,70 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Row as AntdRow } from '@yimoka/antd';
3
+ import { createBehavior, createResource } from '@yimoka/designable-core';
4
+ import { DroppableWidget } from '@yimoka/designable-react';
5
+ import { createContainerPropsSchema, splitDesignableStyleProps } from "../shared.js";
6
+ export const GridRow = (props) => {
7
+ const { componentProps: rowProps, designerProps, wrapperStyle, } = splitDesignableStyleProps(props);
8
+ const { children, ...restRowProps } = rowProps;
9
+ return (_jsx(DroppableWidget, { ...designerProps, placeholder: false, style: wrapperStyle, children: _jsx(AntdRow, { ...restRowProps, style: { minHeight: 40 }, children: children }) }));
10
+ };
11
+ GridRow.Behavior = createBehavior({
12
+ name: 'GridRow',
13
+ selector: node => node.componentName === 'GridRow',
14
+ designerProps: {
15
+ droppable: true,
16
+ propsSchema: createContainerPropsSchema({
17
+ gutter: {
18
+ type: 'number',
19
+ 'x-decorator': 'FormItem',
20
+ 'x-component': 'NumberPicker',
21
+ title: '栅格间隔',
22
+ },
23
+ wrap: {
24
+ type: 'boolean',
25
+ 'x-decorator': 'FormItem',
26
+ 'x-component': 'Switch',
27
+ title: '自动换行',
28
+ },
29
+ justify: {
30
+ type: 'string',
31
+ enum: ['start', 'end', 'center', 'space-around', 'space-between', 'space-evenly'],
32
+ 'x-decorator': 'FormItem',
33
+ 'x-component': 'Select',
34
+ title: '水平排列',
35
+ },
36
+ align: {
37
+ type: 'string',
38
+ enum: ['top', 'middle', 'bottom', 'stretch'],
39
+ 'x-decorator': 'FormItem',
40
+ 'x-component': 'Select',
41
+ title: '垂直对齐',
42
+ },
43
+ }),
44
+ },
45
+ });
46
+ GridRow.Resource = createResource({
47
+ icon: 'ColumnWidthOutlined',
48
+ elements: [
49
+ {
50
+ componentName: 'GridRow',
51
+ props: {
52
+ gutter: 16,
53
+ },
54
+ children: [
55
+ {
56
+ componentName: 'GridCol',
57
+ props: {
58
+ span: 12,
59
+ },
60
+ },
61
+ {
62
+ componentName: 'GridCol',
63
+ props: {
64
+ span: 12,
65
+ },
66
+ },
67
+ ],
68
+ },
69
+ ],
70
+ });
@@ -0,0 +1,4 @@
1
+ import { HTMLContent as AntdHTMLContent } from '@yimoka/antd';
2
+ import { DnFC } from '@yimoka/designable-react';
3
+ import React from 'react';
4
+ export declare const HTMLContent: DnFC<React.ComponentProps<typeof AntdHTMLContent>>;
@@ -0,0 +1,34 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { HTMLContent as AntdHTMLContent } from '@yimoka/antd';
3
+ import { createBehavior, createResource } from '@yimoka/designable-core';
4
+ import { createContainerPropsSchema, pickControlVisualStyle, splitDesignableStyleProps, } from "../shared.js";
5
+ export const HTMLContent = (props) => {
6
+ const { componentProps: contentProps, designerProps, wrapperStyle, } = splitDesignableStyleProps(props);
7
+ const controlStyle = pickControlVisualStyle(wrapperStyle);
8
+ return (_jsx("div", { ...designerProps, style: { width: '100%', ...wrapperStyle }, children: _jsx(AntdHTMLContent, { ...contentProps, style: controlStyle, value: String(contentProps.value ?? '') }) }));
9
+ };
10
+ HTMLContent.Behavior = createBehavior({
11
+ name: 'HTMLContent',
12
+ selector: node => node.componentName === 'HTMLContent',
13
+ designerProps: {
14
+ propsSchema: createContainerPropsSchema({
15
+ value: {
16
+ type: 'string',
17
+ 'x-decorator': 'FormItem',
18
+ 'x-component': 'TextArea',
19
+ title: 'HTML 内容',
20
+ },
21
+ }),
22
+ },
23
+ });
24
+ HTMLContent.Resource = createResource({
25
+ icon: '',
26
+ elements: [
27
+ {
28
+ componentName: 'HTMLContent',
29
+ props: {
30
+ value: '<p>富文本内容</p>',
31
+ },
32
+ },
33
+ ],
34
+ });
@@ -0,0 +1,8 @@
1
+ import { DnFC } from '@yimoka/designable-react';
2
+ import React from 'react';
3
+ export interface II18nEditorDesignerProps {
4
+ fieldMap?: Record<string, string>;
5
+ readOnly?: boolean;
6
+ style?: React.CSSProperties;
7
+ }
8
+ export declare const I18nEditor: DnFC<II18nEditorDesignerProps>;