@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.
- package/README.md +8 -2
- package/dist/demo/components/Alert/index.d.ts +4 -0
- package/dist/demo/components/Alert/index.js +41 -0
- package/dist/demo/components/ArrayCards/index.d.ts +17 -0
- package/dist/demo/components/ArrayCards/index.js +62 -0
- package/dist/demo/components/ArrayList/index.d.ts +25 -0
- package/dist/demo/components/ArrayList/index.js +143 -0
- package/dist/demo/components/ArrayTable/index.d.ts +39 -0
- package/dist/demo/components/ArrayTable/index.js +247 -0
- package/dist/demo/components/AutoComplete/index.d.ts +4 -0
- package/dist/demo/components/AutoComplete/index.js +52 -0
- package/dist/demo/components/Avatar/index.d.ts +4 -0
- package/dist/demo/components/Avatar/index.js +34 -0
- package/dist/demo/components/Badge/index.d.ts +4 -0
- package/dist/demo/components/Badge/index.js +35 -0
- package/dist/demo/components/Button/index.d.ts +4 -0
- package/dist/demo/components/Button/index.js +86 -0
- package/dist/demo/components/Card/index.d.ts +4 -0
- package/dist/demo/components/Card/index.js +72 -0
- package/dist/demo/components/Carousel/index.d.ts +4 -0
- package/dist/demo/components/Carousel/index.js +33 -0
- package/dist/demo/components/Cascader/index.d.ts +4 -0
- package/dist/demo/components/Cascader/index.js +60 -0
- package/dist/demo/components/Checkbox/index.d.ts +8 -0
- package/dist/demo/components/Checkbox/index.js +55 -0
- package/dist/demo/components/ColorPicker/index.d.ts +4 -0
- package/dist/demo/components/ColorPicker/index.js +38 -0
- package/dist/demo/components/DatePicker/index.d.ts +4 -0
- package/dist/demo/components/DatePicker/index.js +61 -0
- package/dist/demo/components/DateRangePicker/index.d.ts +4 -0
- package/dist/demo/components/DateRangePicker/index.js +58 -0
- package/dist/demo/components/Divider/index.d.ts +4 -0
- package/dist/demo/components/Divider/index.js +39 -0
- package/dist/demo/components/Empty/index.d.ts +4 -0
- package/dist/demo/components/Empty/index.js +29 -0
- package/dist/demo/components/Flex/index.d.ts +4 -0
- package/dist/demo/components/Flex/index.js +51 -0
- package/dist/demo/components/Form/index.d.ts +21 -0
- package/dist/demo/components/Form/index.js +116 -0
- package/dist/demo/components/FormCollapse/index.d.ts +28 -0
- package/dist/demo/components/FormCollapse/index.js +164 -0
- package/dist/demo/components/FormGrid/index.d.ts +22 -0
- package/dist/demo/components/FormGrid/index.js +134 -0
- package/dist/demo/components/FormItem/index.d.ts +14 -0
- package/dist/demo/components/FormItem/index.js +33 -0
- package/dist/demo/components/FormLayout/index.d.ts +26 -0
- package/dist/demo/components/FormLayout/index.js +260 -0
- package/dist/demo/components/FormTab/index.d.ts +15 -0
- package/dist/demo/components/FormTab/index.js +186 -0
- package/dist/demo/components/GridCol/index.d.ts +4 -0
- package/dist/demo/components/GridCol/index.js +53 -0
- package/dist/demo/components/GridRow/index.d.ts +4 -0
- package/dist/demo/components/GridRow/index.js +70 -0
- package/dist/demo/components/HTMLContent/index.d.ts +4 -0
- package/dist/demo/components/HTMLContent/index.js +34 -0
- package/dist/demo/components/I18nEditor/index.d.ts +8 -0
- package/dist/demo/components/I18nEditor/index.js +64 -0
- package/dist/demo/components/Image/index.d.ts +4 -0
- package/dist/demo/components/Image/index.js +36 -0
- package/dist/demo/components/Input/index.d.ts +4 -0
- package/dist/demo/components/Input/index.js +36 -0
- package/dist/demo/components/InputSearch/index.d.ts +4 -0
- package/dist/demo/components/InputSearch/index.js +40 -0
- package/dist/demo/components/Link/index.d.ts +4 -0
- package/dist/demo/components/Link/index.js +37 -0
- package/dist/demo/components/Mentions/index.d.ts +4 -0
- package/dist/demo/components/Mentions/index.js +41 -0
- package/dist/demo/components/NumberPicker/index.d.ts +6 -0
- package/dist/demo/components/NumberPicker/index.js +63 -0
- package/dist/demo/components/ObjectContainer/index.d.ts +14 -0
- package/dist/demo/components/ObjectContainer/index.js +46 -0
- package/dist/demo/components/Password/index.d.ts +6 -0
- package/dist/demo/components/Password/index.js +44 -0
- package/dist/demo/components/QRCode/index.d.ts +4 -0
- package/dist/demo/components/QRCode/index.js +34 -0
- package/dist/demo/components/Radio/index.d.ts +6 -0
- package/dist/demo/components/Radio/index.js +49 -0
- package/dist/demo/components/Rate/index.d.ts +6 -0
- package/dist/demo/components/Rate/index.js +43 -0
- package/dist/demo/components/Search/index.d.ts +4 -0
- package/dist/demo/components/Search/index.js +42 -0
- package/dist/demo/components/SearchSelect/index.d.ts +4 -0
- package/dist/demo/components/SearchSelect/index.js +53 -0
- package/dist/demo/components/Select/index.d.ts +4 -0
- package/dist/demo/components/Select/index.js +59 -0
- package/dist/demo/components/Slider/index.d.ts +6 -0
- package/dist/demo/components/Slider/index.js +61 -0
- package/dist/demo/components/Space/index.d.ts +9 -0
- package/dist/demo/components/Space/index.js +61 -0
- package/dist/demo/components/Statistic/index.d.ts +4 -0
- package/dist/demo/components/Statistic/index.js +33 -0
- package/dist/demo/components/Switch/index.d.ts +4 -0
- package/dist/demo/components/Switch/index.js +49 -0
- package/dist/demo/components/Tabs/index.d.ts +10 -0
- package/dist/demo/components/Tabs/index.js +181 -0
- package/dist/demo/components/Tag/index.d.ts +4 -0
- package/dist/demo/components/Tag/index.js +33 -0
- package/dist/demo/components/Text/index.d.ts +11 -0
- package/dist/demo/components/Text/index.js +64 -0
- package/dist/demo/components/TextArea/index.d.ts +6 -0
- package/dist/demo/components/TextArea/index.js +43 -0
- package/dist/demo/components/TimePicker/index.d.ts +4 -0
- package/dist/demo/components/TimePicker/index.js +69 -0
- package/dist/demo/components/TimeRangePicker/index.d.ts +4 -0
- package/dist/demo/components/TimeRangePicker/index.js +68 -0
- package/dist/demo/components/Transfer/index.d.ts +6 -0
- package/dist/demo/components/Transfer/index.js +59 -0
- package/dist/demo/components/TreeSelect/index.d.ts +4 -0
- package/dist/demo/components/TreeSelect/index.js +63 -0
- package/dist/demo/components/Upload/index.d.ts +8 -0
- package/dist/demo/components/Upload/index.js +64 -0
- package/dist/demo/components/index.d.ts +55 -0
- package/dist/demo/components/index.js +55 -0
- package/dist/demo/components/shared.d.ts +143 -0
- package/dist/demo/components/shared.js +315 -0
- package/dist/src/Playground.d.ts +3 -0
- package/dist/src/Playground.js +304 -0
- package/dist/src/antd/AntdPlayground.d.ts +16 -0
- package/dist/src/antd/AntdPlayground.js +136 -0
- package/dist/src/antd/index.d.ts +1 -0
- package/dist/src/antd/index.js +1 -0
- package/dist/src/context.d.ts +4 -0
- package/dist/src/context.js +13 -0
- package/dist/src/examples/index.d.ts +267 -0
- package/dist/src/examples/index.js +824 -0
- package/dist/src/hooks/index.d.ts +4 -0
- package/dist/src/hooks/index.js +4 -0
- package/dist/src/hooks/remoteSchemaAdapter.d.ts +53 -0
- package/dist/src/hooks/remoteSchemaAdapter.js +262 -0
- package/dist/src/hooks/usePlayground.d.ts +38 -0
- package/dist/src/hooks/usePlayground.js +642 -0
- package/dist/src/hooks/usePlaygroundRemotePersistence.d.ts +135 -0
- package/dist/src/hooks/usePlaygroundRemotePersistence.js +736 -0
- package/dist/src/hooks/useSchemaEditorDraft.d.ts +4 -0
- package/dist/src/hooks/useSchemaEditorDraft.js +44 -0
- package/dist/src/index.d.ts +14 -0
- package/dist/src/index.js +14 -0
- package/dist/src/layouts/PlaygroundLayout/ErrorBoundaries.d.ts +59 -0
- package/dist/src/layouts/PlaygroundLayout/ErrorBoundaries.js +161 -0
- package/dist/src/layouts/PlaygroundLayout/index.d.ts +7 -0
- package/dist/src/layouts/PlaygroundLayout/index.js +443 -0
- package/dist/src/layouts/index.d.ts +1 -0
- package/dist/src/layouts/index.js +1 -0
- package/dist/src/panels/CompositePanel/index.d.ts +6 -0
- package/dist/src/panels/CompositePanel/index.js +139 -0
- package/dist/src/panels/ToolbarPanel/index.d.ts +3 -0
- package/dist/src/panels/ToolbarPanel/index.js +24 -0
- package/dist/src/panels/index.d.ts +2 -0
- package/dist/src/panels/index.js +2 -0
- package/dist/src/presets/antd.d.ts +19 -0
- package/dist/src/presets/antd.js +112 -0
- package/dist/src/presets/index.d.ts +4 -0
- package/dist/src/presets/index.js +3 -0
- package/dist/src/presets/runtime-array-helpers.d.ts +8 -0
- package/dist/src/presets/runtime-array-helpers.js +147 -0
- package/dist/src/presets/runtime-component-props.d.ts +3 -0
- package/dist/src/presets/runtime-component-props.js +5 -0
- package/dist/src/presets/runtime-components.d.ts +5 -0
- package/dist/src/presets/runtime-components.js +419 -0
- package/dist/src/presets/runtime-form-components.d.ts +9 -0
- package/dist/src/presets/runtime-form-components.js +94 -0
- package/dist/src/presets/scenario-catalog.d.ts +6 -0
- package/dist/src/presets/scenario-catalog.js +128 -0
- package/dist/src/presets/scenarios.d.ts +52 -0
- package/dist/src/presets/scenarios.js +603 -0
- package/dist/src/runtime/actions.d.ts +19 -0
- package/dist/src/runtime/actions.js +307 -0
- package/dist/src/runtime/contracts.d.ts +149 -0
- package/dist/src/runtime/contracts.js +1 -0
- package/dist/src/runtime/document-bindings.d.ts +3 -0
- package/dist/src/runtime/document-bindings.js +101 -0
- package/dist/src/runtime/document-core.d.ts +57 -0
- package/dist/src/runtime/document-core.js +379 -0
- package/dist/src/runtime/document-entity.d.ts +12 -0
- package/dist/src/runtime/document-entity.js +351 -0
- package/dist/src/runtime/document-expressions.d.ts +35 -0
- package/dist/src/runtime/document-expressions.js +346 -0
- package/dist/src/runtime/document-security.d.ts +34 -0
- package/dist/src/runtime/document-security.js +538 -0
- package/dist/src/runtime/document.d.ts +16 -0
- package/dist/src/runtime/document.js +212 -0
- package/dist/src/runtime/environment.d.ts +16 -0
- package/dist/src/runtime/environment.js +76 -0
- package/dist/src/runtime/i18n-schema.d.ts +36 -0
- package/dist/src/runtime/i18n-schema.js +338 -0
- package/dist/src/runtime/i18n.d.ts +25 -0
- package/dist/src/runtime/i18n.js +447 -0
- package/dist/src/runtime/index.d.ts +8 -0
- package/dist/src/runtime/index.js +8 -0
- package/dist/src/runtime/navigation.d.ts +5 -0
- package/dist/src/runtime/navigation.js +43 -0
- package/dist/src/runtime/playground.d.ts +30 -0
- package/dist/src/runtime/playground.js +243 -0
- package/dist/src/runtime/preview-boundaries.d.ts +13 -0
- package/dist/src/runtime/preview-boundaries.js +43 -0
- package/dist/src/runtime/preview.d.ts +44 -0
- package/dist/src/runtime/preview.js +574 -0
- package/dist/src/runtime/settings/RuntimeJsonEditor.d.ts +10 -0
- package/dist/src/runtime/settings/RuntimeJsonEditor.js +21 -0
- package/dist/src/runtime/settings/RuntimeStoreEntitySettings.d.ts +15 -0
- package/dist/src/runtime/settings/RuntimeStoreEntitySettings.js +65 -0
- package/dist/src/runtime/templates.d.ts +1560 -0
- package/dist/src/runtime/templates.js +508 -0
- package/dist/src/runtime/website-contact-template.d.ts +1 -0
- package/dist/src/runtime/website-contact-template.js +66 -0
- package/dist/src/runtime/website-template-shared.d.ts +14 -0
- package/dist/src/runtime/website-template-shared.js +210 -0
- package/dist/src/runtime/website-templates.d.ts +5 -0
- package/dist/src/runtime/website-templates.js +976 -0
- package/dist/src/shared/clipboard.d.ts +4 -0
- package/dist/src/shared/clipboard.js +56 -0
- package/dist/src/shared/componentRegistry.d.ts +133 -0
- package/dist/src/shared/componentRegistry.js +381 -0
- package/dist/src/shared/formilyCompatibility.d.ts +8 -0
- package/dist/src/shared/formilyCompatibility.js +40 -0
- package/dist/src/shared/index.d.ts +6 -0
- package/dist/src/shared/index.js +6 -0
- package/dist/src/shared/productionAcceptance.d.ts +63 -0
- package/dist/src/shared/productionAcceptance.js +201 -0
- package/dist/src/shared/schema-options.d.ts +16 -0
- package/dist/src/shared/schema-options.js +138 -0
- package/dist/src/shared/schema.d.ts +63 -0
- package/dist/src/shared/schema.js +627 -0
- package/dist/src/shared/styleSecurity.d.ts +2 -0
- package/dist/src/shared/styleSecurity.js +35 -0
- package/dist/src/transformers/formily.d.ts +34 -0
- package/dist/src/transformers/formily.js +943 -0
- package/dist/src/transformers/index.d.ts +1 -0
- package/dist/src/transformers/index.js +1 -0
- package/dist/src/types.d.ts +186 -0
- package/dist/src/types.js +1 -0
- package/dist/src/widgets/ActionsWidget/index.d.ts +3 -0
- package/dist/src/widgets/ActionsWidget/index.js +10 -0
- package/dist/src/widgets/ComponentTreeWidget/index.d.ts +3 -0
- package/dist/src/widgets/ComponentTreeWidget/index.js +333 -0
- package/dist/src/widgets/NodeActionsWidget/index.d.ts +2 -0
- package/dist/src/widgets/NodeActionsWidget/index.js +125 -0
- package/dist/src/widgets/OutlineTreeWidget/index.d.ts +3 -0
- package/dist/src/widgets/OutlineTreeWidget/index.js +432 -0
- package/dist/src/widgets/OutlineTreeWidget/shared.d.ts +32 -0
- package/dist/src/widgets/OutlineTreeWidget/shared.js +79 -0
- package/dist/src/widgets/PreviewWidget/index.d.ts +2 -0
- package/dist/src/widgets/PreviewWidget/index.js +1566 -0
- package/dist/src/widgets/ProductionReadinessWidget/index.d.ts +18 -0
- package/dist/src/widgets/ProductionReadinessWidget/index.js +356 -0
- package/dist/src/widgets/RemotePersistenceStatusWidget/index.d.ts +18 -0
- package/dist/src/widgets/RemotePersistenceStatusWidget/index.js +438 -0
- package/dist/src/widgets/RemoteVersionHistoryWidget/index.d.ts +39 -0
- package/dist/src/widgets/RemoteVersionHistoryWidget/index.js +475 -0
- package/dist/src/widgets/ResourceWidget/index.d.ts +3 -0
- package/dist/src/widgets/ResourceWidget/index.js +491 -0
- package/dist/src/widgets/SchemaCodeView/index.d.ts +7 -0
- package/dist/src/widgets/SchemaCodeView/index.js +225 -0
- package/dist/src/widgets/SchemaEditorWidget/index.d.ts +10 -0
- package/dist/src/widgets/SchemaEditorWidget/index.js +484 -0
- package/dist/src/widgets/SettingsPanelWidget/index.d.ts +3 -0
- package/dist/src/widgets/SettingsPanelWidget/index.js +190 -0
- package/dist/src/widgets/StorageActionsWidget/index.d.ts +2 -0
- package/dist/src/widgets/StorageActionsWidget/index.js +284 -0
- package/dist/src/widgets/index.d.ts +13 -0
- package/dist/src/widgets/index.js +13 -0
- package/package.json +100 -4
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Input as AntdInput, Tag } from '@yimoka/antd';
|
|
3
|
+
import { createBehavior, createResource } from '@yimoka/designable-core';
|
|
4
|
+
const splitI18nEditorDesignProps = (props) => {
|
|
5
|
+
const componentProps = { ...props };
|
|
6
|
+
const designerProps = {};
|
|
7
|
+
Object.keys(componentProps).forEach((key) => {
|
|
8
|
+
if (!key.startsWith('data-designer'))
|
|
9
|
+
return;
|
|
10
|
+
designerProps[key] = componentProps[key];
|
|
11
|
+
delete componentProps[key];
|
|
12
|
+
});
|
|
13
|
+
const wrapperStyle = componentProps.style;
|
|
14
|
+
delete componentProps.style;
|
|
15
|
+
return { componentProps, designerProps, wrapperStyle };
|
|
16
|
+
};
|
|
17
|
+
export const I18nEditor = (props) => {
|
|
18
|
+
const { componentProps, designerProps, wrapperStyle, } = splitI18nEditorDesignProps(props);
|
|
19
|
+
const { fieldMap, readOnly } = componentProps;
|
|
20
|
+
const fieldCount = fieldMap ? Object.keys(fieldMap).length : 0;
|
|
21
|
+
return (_jsxs("div", { ...designerProps, style: {
|
|
22
|
+
border: '1px solid #d9d9d9',
|
|
23
|
+
borderRadius: 6,
|
|
24
|
+
padding: 12,
|
|
25
|
+
width: '100%',
|
|
26
|
+
...wrapperStyle,
|
|
27
|
+
}, children: [_jsxs("div", { style: { alignItems: 'center', display: 'flex', gap: 8, marginBottom: 8 }, children: [_jsx("strong", { children: "\u591A\u8BED\u8A00\u7F16\u8F91\u5668" }), _jsx(Tag, { children: readOnly ? '只读' : '可编辑' }), fieldCount > 0 ? _jsxs(Tag, { children: [fieldCount, " \u4E2A\u5B57\u6BB5"] }) : null] }), _jsx(AntdInput, { disabled: true, placeholder: "\u9009\u62E9\u8BED\u8A00\u540E\u7F16\u8F91\u5185\u5BB9" })] }));
|
|
28
|
+
};
|
|
29
|
+
I18nEditor.Behavior = createBehavior({
|
|
30
|
+
name: 'I18nEditor',
|
|
31
|
+
selector: node => node.componentName === 'I18nEditor',
|
|
32
|
+
designerProps: {
|
|
33
|
+
propsSchema: {
|
|
34
|
+
type: 'object',
|
|
35
|
+
properties: {
|
|
36
|
+
readOnly: {
|
|
37
|
+
type: 'boolean',
|
|
38
|
+
title: '只读',
|
|
39
|
+
'x-decorator': 'FormItem',
|
|
40
|
+
'x-component': 'Switch',
|
|
41
|
+
},
|
|
42
|
+
fieldMap: {
|
|
43
|
+
type: 'object',
|
|
44
|
+
title: '字段映射',
|
|
45
|
+
'x-decorator': 'FormItem',
|
|
46
|
+
'x-component': 'JSONInput',
|
|
47
|
+
'x-component-props': {
|
|
48
|
+
placeholder: '{"titleI18n":"title"}',
|
|
49
|
+
rows: 4,
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
});
|
|
56
|
+
I18nEditor.Resource = createResource({
|
|
57
|
+
icon: 'TranslationOutlined',
|
|
58
|
+
elements: [
|
|
59
|
+
{
|
|
60
|
+
componentName: 'I18nEditor',
|
|
61
|
+
props: {},
|
|
62
|
+
},
|
|
63
|
+
],
|
|
64
|
+
});
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Image as AntdImage } from '@yimoka/antd';
|
|
3
|
+
import { createBehavior, createResource } from '@yimoka/designable-core';
|
|
4
|
+
import { createContainerPropsSchema, createInputProperty, createNumberProperty, createSwitchProperty, splitDesignableStyleProps, } from "../shared.js";
|
|
5
|
+
export const Image = (props) => {
|
|
6
|
+
const { componentProps: imageProps, designerProps, wrapperStyle, } = splitDesignableStyleProps(props);
|
|
7
|
+
return (_jsx("div", { ...designerProps, style: { display: 'inline-flex', ...wrapperStyle }, children: _jsx(AntdImage, { ...imageProps }) }));
|
|
8
|
+
};
|
|
9
|
+
Image.Behavior = createBehavior({
|
|
10
|
+
name: 'Image',
|
|
11
|
+
selector: node => node.componentName === 'Image',
|
|
12
|
+
designerProps: {
|
|
13
|
+
propsSchema: createContainerPropsSchema({
|
|
14
|
+
value: createInputProperty('图片地址'),
|
|
15
|
+
src: createInputProperty('图片源'),
|
|
16
|
+
alt: createInputProperty('替代文本'),
|
|
17
|
+
fallback: createInputProperty('兜底图片'),
|
|
18
|
+
width: createNumberProperty('宽度'),
|
|
19
|
+
height: createNumberProperty('高度'),
|
|
20
|
+
placeholder: createInputProperty('占位内容'),
|
|
21
|
+
preview: createSwitchProperty('启用预览'),
|
|
22
|
+
}),
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
Image.Resource = createResource({
|
|
26
|
+
icon: '',
|
|
27
|
+
elements: [
|
|
28
|
+
{
|
|
29
|
+
componentName: 'Image',
|
|
30
|
+
props: {
|
|
31
|
+
alt: '图片',
|
|
32
|
+
width: 120,
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
],
|
|
36
|
+
});
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Input as AntdInput } from '@yimoka/antd';
|
|
3
|
+
import { createBehavior, createResource } from '@yimoka/designable-core';
|
|
4
|
+
import { allowClearProperty, autoFocusProperty, createFieldResourceProps, createFieldPropsSchema, createSwitchProperty, inputAddonProperties, inputLimitProperties, pickControlVisualStyle, placeholderProperty, sizeProperty, statusProperty, splitDesignableStyleProps, } from "../shared.js";
|
|
5
|
+
export const Input = (props) => {
|
|
6
|
+
const { componentProps, designerProps, wrapperStyle, } = splitDesignableStyleProps(props);
|
|
7
|
+
const controlStyle = pickControlVisualStyle(wrapperStyle);
|
|
8
|
+
return (_jsx("div", { ...designerProps, style: { display: 'inline-block', width: '100%', ...wrapperStyle }, children: _jsx(AntdInput, { ...componentProps, style: { width: '100%', ...controlStyle } }) }));
|
|
9
|
+
};
|
|
10
|
+
Input.Behavior = createBehavior({
|
|
11
|
+
name: 'Input',
|
|
12
|
+
selector: node => node.componentName === 'Input',
|
|
13
|
+
designerProps: {
|
|
14
|
+
propsSchema: createFieldPropsSchema({
|
|
15
|
+
placeholder: placeholderProperty,
|
|
16
|
+
...inputAddonProperties,
|
|
17
|
+
allowClear: allowClearProperty,
|
|
18
|
+
autoFocus: autoFocusProperty,
|
|
19
|
+
bordered: createSwitchProperty('显示边框'),
|
|
20
|
+
status: statusProperty,
|
|
21
|
+
size: sizeProperty,
|
|
22
|
+
...inputLimitProperties,
|
|
23
|
+
}),
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
Input.Resource = createResource({
|
|
27
|
+
icon: '',
|
|
28
|
+
elements: [
|
|
29
|
+
{
|
|
30
|
+
componentName: 'Input',
|
|
31
|
+
props: createFieldResourceProps('input', '输入框', {
|
|
32
|
+
placeholder: '请输入',
|
|
33
|
+
}),
|
|
34
|
+
},
|
|
35
|
+
],
|
|
36
|
+
});
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Input as AntdInput } from '@yimoka/antd';
|
|
3
|
+
import { createBehavior, createResource } from '@yimoka/designable-core';
|
|
4
|
+
import { allowClearProperty, autoFocusProperty, createFieldResourceProps, createFieldPropsSchema, createSwitchProperty, inputAddonProperties, inputLimitProperties, pickControlVisualStyle, placeholderProperty, sizeProperty, statusProperty, splitDesignableStyleProps, } from "../shared.js";
|
|
5
|
+
export const InputSearch = (props) => {
|
|
6
|
+
const { componentProps, designerProps, wrapperStyle, } = splitDesignableStyleProps(props);
|
|
7
|
+
const controlStyle = pickControlVisualStyle(wrapperStyle);
|
|
8
|
+
return (_jsx("div", { ...designerProps, style: { display: 'inline-block', width: '100%', ...wrapperStyle }, children: _jsx(AntdInput.Search, { ...componentProps, style: { width: '100%', ...controlStyle } }) }));
|
|
9
|
+
};
|
|
10
|
+
InputSearch.Behavior = createBehavior({
|
|
11
|
+
name: 'InputSearch',
|
|
12
|
+
selector: node => node.componentName === 'InputSearch',
|
|
13
|
+
designerProps: {
|
|
14
|
+
propsSchema: createFieldPropsSchema({
|
|
15
|
+
placeholder: placeholderProperty,
|
|
16
|
+
...inputAddonProperties,
|
|
17
|
+
allowClear: allowClearProperty,
|
|
18
|
+
autoFocus: autoFocusProperty,
|
|
19
|
+
bordered: createSwitchProperty('显示边框'),
|
|
20
|
+
enterButton: createSwitchProperty('显示搜索按钮'),
|
|
21
|
+
loading: createSwitchProperty('加载中'),
|
|
22
|
+
maxLength: inputLimitProperties.maxLength,
|
|
23
|
+
showCount: inputLimitProperties.showCount,
|
|
24
|
+
status: statusProperty,
|
|
25
|
+
size: sizeProperty,
|
|
26
|
+
}),
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
InputSearch.Resource = createResource({
|
|
30
|
+
icon: '',
|
|
31
|
+
elements: [
|
|
32
|
+
{
|
|
33
|
+
componentName: 'InputSearch',
|
|
34
|
+
props: createFieldResourceProps('inputSearch', '搜索输入', {
|
|
35
|
+
allowClear: true,
|
|
36
|
+
placeholder: '请输入搜索关键词',
|
|
37
|
+
}),
|
|
38
|
+
},
|
|
39
|
+
],
|
|
40
|
+
});
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Typography } from '@yimoka/antd';
|
|
3
|
+
import { createBehavior, createResource } from '@yimoka/designable-core';
|
|
4
|
+
import { createContainerPropsSchema, createInputProperty, createSelectProperty, createSwitchProperty, pickControlVisualStyle, splitDesignableStyleProps, } from "../shared.js";
|
|
5
|
+
export const Link = (props) => {
|
|
6
|
+
const { componentProps: linkProps, designerProps, wrapperStyle, } = splitDesignableStyleProps(props);
|
|
7
|
+
const { children, ...restLinkProps } = linkProps;
|
|
8
|
+
const controlStyle = pickControlVisualStyle(wrapperStyle);
|
|
9
|
+
return (_jsx("div", { ...designerProps, style: { display: 'inline-flex', ...wrapperStyle }, children: _jsx(Typography.Link, { ...restLinkProps, style: controlStyle, onClick: (event) => {
|
|
10
|
+
event.preventDefault();
|
|
11
|
+
}, children: children }) }));
|
|
12
|
+
};
|
|
13
|
+
Link.Behavior = createBehavior({
|
|
14
|
+
name: 'Link',
|
|
15
|
+
selector: node => node.componentName === 'Link',
|
|
16
|
+
designerProps: {
|
|
17
|
+
propsSchema: createContainerPropsSchema({
|
|
18
|
+
children: createInputProperty('链接文本'),
|
|
19
|
+
href: createInputProperty('链接地址'),
|
|
20
|
+
target: createSelectProperty('打开方式', ['_blank', '_self', '_parent', '_top', null]),
|
|
21
|
+
disabled: createSwitchProperty('禁用'),
|
|
22
|
+
underline: createSwitchProperty('下划线'),
|
|
23
|
+
}),
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
Link.Resource = createResource({
|
|
27
|
+
icon: '',
|
|
28
|
+
elements: [
|
|
29
|
+
{
|
|
30
|
+
componentName: 'Link',
|
|
31
|
+
props: {
|
|
32
|
+
children: '链接',
|
|
33
|
+
href: 'https://example.com',
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
],
|
|
37
|
+
});
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Mentions as AntdMentions } from '@yimoka/antd';
|
|
3
|
+
import { createBehavior, createResource } from '@yimoka/designable-core';
|
|
4
|
+
import { allowClearProperty, autoFocusProperty, createDataBindingProperty, createFieldResourceProps, createFieldPropsSchema, createJSONProperty, createNumberProperty, createSelectProperty, createSwitchProperty, pickControlVisualStyle, placeholderProperty, sizeProperty, splitDesignableStyleProps, withSchemaOptions, } from "../shared.js";
|
|
5
|
+
export const Mentions = (props) => {
|
|
6
|
+
const { componentProps: mentionsProps, designerProps, wrapperStyle, } = splitDesignableStyleProps(props);
|
|
7
|
+
const controlStyle = pickControlVisualStyle(wrapperStyle);
|
|
8
|
+
return (_jsx("div", { ...designerProps, style: { display: 'inline-block', width: '100%', ...wrapperStyle }, children: _jsx(AntdMentions, { ...withSchemaOptions(mentionsProps), style: { width: '100%', ...controlStyle } }) }));
|
|
9
|
+
};
|
|
10
|
+
Mentions.Behavior = createBehavior({
|
|
11
|
+
name: 'Mentions',
|
|
12
|
+
selector: node => node.componentName === 'Mentions',
|
|
13
|
+
designerProps: {
|
|
14
|
+
propsSchema: createFieldPropsSchema({
|
|
15
|
+
dataBinding: createDataBindingProperty(['options', 'data']),
|
|
16
|
+
placeholder: placeholderProperty,
|
|
17
|
+
allowClear: allowClearProperty,
|
|
18
|
+
autoFocus: autoFocusProperty,
|
|
19
|
+
prefix: createJSONProperty('触发前缀', 'array', '["@"]'),
|
|
20
|
+
split: createSelectProperty('分隔符', [' ', '', null]),
|
|
21
|
+
rows: createNumberProperty('行数'),
|
|
22
|
+
autoSize: createSwitchProperty('自适应高度'),
|
|
23
|
+
size: sizeProperty,
|
|
24
|
+
}),
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
Mentions.Resource = createResource({
|
|
28
|
+
icon: '',
|
|
29
|
+
elements: [
|
|
30
|
+
{
|
|
31
|
+
componentName: 'Mentions',
|
|
32
|
+
props: createFieldResourceProps('mentions', '提及', {
|
|
33
|
+
placeholder: '输入 @ 提及成员',
|
|
34
|
+
options: [
|
|
35
|
+
{ label: '张三', value: 'zhangsan' },
|
|
36
|
+
{ label: '李四', value: 'lisi' },
|
|
37
|
+
],
|
|
38
|
+
}),
|
|
39
|
+
},
|
|
40
|
+
],
|
|
41
|
+
});
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { InputNumber as AntdInputNumber } from '@yimoka/antd';
|
|
2
|
+
import { DnFC } from '@yimoka/designable-react';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
type NumberPickerProps = React.ComponentProps<typeof AntdInputNumber>;
|
|
5
|
+
export declare const NumberPicker: DnFC<NumberPickerProps>;
|
|
6
|
+
export {};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { InputNumber as AntdInputNumber } from '@yimoka/antd';
|
|
3
|
+
import { createBehavior, createResource } from '@yimoka/designable-core';
|
|
4
|
+
import { createExpressionProperty, createFieldResourceProps, createFieldPropsSchema, createInputProperty, createSwitchProperty, inputAddonProperties, pickControlVisualStyle, placeholderProperty, sizeProperty, statusProperty, splitDesignableStyleProps, } from "../shared.js";
|
|
5
|
+
export const NumberPicker = (props) => {
|
|
6
|
+
const { componentProps: numberPickerProps, designerProps, wrapperStyle, } = splitDesignableStyleProps(props);
|
|
7
|
+
const controlStyle = pickControlVisualStyle(wrapperStyle);
|
|
8
|
+
return (_jsx("div", { ...designerProps, style: { display: 'inline-block', width: '100%', ...wrapperStyle }, children: _jsx(AntdInputNumber, { ...numberPickerProps, style: { width: '100%', ...controlStyle } }) }));
|
|
9
|
+
};
|
|
10
|
+
NumberPicker.Behavior = createBehavior({
|
|
11
|
+
name: 'NumberPicker',
|
|
12
|
+
selector: node => node.componentName === 'NumberPicker',
|
|
13
|
+
designerProps: {
|
|
14
|
+
propsSchema: createFieldPropsSchema({
|
|
15
|
+
placeholder: placeholderProperty,
|
|
16
|
+
...inputAddonProperties,
|
|
17
|
+
min: {
|
|
18
|
+
type: 'number',
|
|
19
|
+
'x-decorator': 'FormItem',
|
|
20
|
+
'x-component': 'NumberPicker',
|
|
21
|
+
title: '最小值',
|
|
22
|
+
},
|
|
23
|
+
max: {
|
|
24
|
+
type: 'number',
|
|
25
|
+
'x-decorator': 'FormItem',
|
|
26
|
+
'x-component': 'NumberPicker',
|
|
27
|
+
title: '最大值',
|
|
28
|
+
},
|
|
29
|
+
step: {
|
|
30
|
+
type: 'number',
|
|
31
|
+
'x-decorator': 'FormItem',
|
|
32
|
+
'x-component': 'NumberPicker',
|
|
33
|
+
title: '步长',
|
|
34
|
+
},
|
|
35
|
+
precision: {
|
|
36
|
+
type: 'number',
|
|
37
|
+
'x-decorator': 'FormItem',
|
|
38
|
+
'x-component': 'NumberPicker',
|
|
39
|
+
title: '精度',
|
|
40
|
+
},
|
|
41
|
+
decimalSeparator: createInputProperty('小数分隔符'),
|
|
42
|
+
formatter: createExpressionProperty('格式化', '{{(value) => value}}'),
|
|
43
|
+
parser: createExpressionProperty('解析器', '{{(value) => value}}'),
|
|
44
|
+
stringMode: createSwitchProperty('字符串模式'),
|
|
45
|
+
bordered: createSwitchProperty('显示边框'),
|
|
46
|
+
keyboard: createSwitchProperty('键盘控制'),
|
|
47
|
+
controls: createSwitchProperty('显示控制按钮'),
|
|
48
|
+
status: statusProperty,
|
|
49
|
+
size: sizeProperty,
|
|
50
|
+
}),
|
|
51
|
+
},
|
|
52
|
+
});
|
|
53
|
+
NumberPicker.Resource = createResource({
|
|
54
|
+
icon: 'NumberSource',
|
|
55
|
+
elements: [
|
|
56
|
+
{
|
|
57
|
+
componentName: 'NumberPicker',
|
|
58
|
+
props: createFieldResourceProps('number', '数字', {
|
|
59
|
+
placeholder: '请输入数字',
|
|
60
|
+
}),
|
|
61
|
+
},
|
|
62
|
+
],
|
|
63
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { DnFC } from '@yimoka/designable-react';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
export interface IObjectContainerProps {
|
|
4
|
+
bordered?: boolean;
|
|
5
|
+
children?: React.ReactNode;
|
|
6
|
+
collapsible?: boolean;
|
|
7
|
+
defaultCollapsed?: boolean;
|
|
8
|
+
layout?: 'vertical' | 'horizontal' | 'inline';
|
|
9
|
+
name?: string;
|
|
10
|
+
size?: 'large' | 'middle' | 'small';
|
|
11
|
+
style?: React.CSSProperties;
|
|
12
|
+
title?: React.ReactNode;
|
|
13
|
+
}
|
|
14
|
+
export declare const ObjectContainer: DnFC<IObjectContainerProps>;
|
|
@@ -0,0 +1,46 @@
|
|
|
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 { createSelectProperty, createSwitchProperty, createFieldPropsSchema, designPlaceholderStyle, hasDesignerProps, sizeProperty, splitDesignableStyleProps, } from "../shared.js";
|
|
5
|
+
export const ObjectContainer = (props) => {
|
|
6
|
+
const { componentProps: objectProps, designerProps, wrapperStyle, } = splitDesignableStyleProps(props);
|
|
7
|
+
const { bordered = true, children, layout = 'vertical', title, } = objectProps;
|
|
8
|
+
const isDesignMode = hasDesignerProps(designerProps);
|
|
9
|
+
return (_jsx(DroppableWidget, { ...designerProps, placeholder: false, style: wrapperStyle, children: _jsxs("section", { style: {
|
|
10
|
+
minHeight: 64,
|
|
11
|
+
width: '100%',
|
|
12
|
+
border: bordered ? '1px dashed #d9d9d9' : '0',
|
|
13
|
+
borderRadius: 4,
|
|
14
|
+
display: layout === 'inline' ? 'flex' : 'block',
|
|
15
|
+
gap: layout === 'inline' ? 12 : undefined,
|
|
16
|
+
padding: 12,
|
|
17
|
+
}, children: [title ? (_jsx("div", { style: { color: '#333', fontSize: 14, marginBottom: 8 }, children: title })) : null, children || (isDesignMode ? (_jsx("div", { style: designPlaceholderStyle, children: "\u62D6\u5165\u5B57\u6BB5\u7EC4\u6210\u5BF9\u8C61" })) : null)] }) }));
|
|
18
|
+
};
|
|
19
|
+
ObjectContainer.Behavior = createBehavior({
|
|
20
|
+
name: 'Object',
|
|
21
|
+
selector: node => node.componentName === 'Object',
|
|
22
|
+
designerProps: {
|
|
23
|
+
droppable: true,
|
|
24
|
+
propsSchema: createFieldPropsSchema({
|
|
25
|
+
bordered: {
|
|
26
|
+
...createSwitchProperty('显示边框'),
|
|
27
|
+
},
|
|
28
|
+
layout: createSelectProperty('布局', ['vertical', 'horizontal', 'inline', null]),
|
|
29
|
+
size: sizeProperty,
|
|
30
|
+
collapsible: createSwitchProperty('允许折叠'),
|
|
31
|
+
defaultCollapsed: createSwitchProperty('默认收起'),
|
|
32
|
+
}),
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
ObjectContainer.Resource = createResource({
|
|
36
|
+
icon: 'BlockOutlined',
|
|
37
|
+
elements: [
|
|
38
|
+
{
|
|
39
|
+
componentName: 'Object',
|
|
40
|
+
props: {
|
|
41
|
+
name: 'object',
|
|
42
|
+
title: '对象',
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
],
|
|
46
|
+
});
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Input as AntdInput } from '@yimoka/antd';
|
|
3
|
+
import { createBehavior, createResource } from '@yimoka/designable-core';
|
|
4
|
+
import { allowClearProperty, autoFocusProperty, createFieldResourceProps, createFieldPropsSchema, createSwitchProperty, inputAddonProperties, inputLimitProperties, pickControlVisualStyle, placeholderProperty, sizeProperty, statusProperty, splitDesignableStyleProps, } from "../shared.js";
|
|
5
|
+
export const Password = (props) => {
|
|
6
|
+
const { componentProps: passwordProps, designerProps, wrapperStyle, } = splitDesignableStyleProps(props);
|
|
7
|
+
const controlStyle = pickControlVisualStyle(wrapperStyle);
|
|
8
|
+
return (_jsx("div", { ...designerProps, style: { display: 'inline-block', width: '100%', ...wrapperStyle }, children: _jsx(AntdInput.Password, { ...passwordProps, style: { width: '100%', ...controlStyle } }) }));
|
|
9
|
+
};
|
|
10
|
+
Password.Behavior = createBehavior({
|
|
11
|
+
name: 'Password',
|
|
12
|
+
selector: node => node.componentName === 'Password',
|
|
13
|
+
designerProps: {
|
|
14
|
+
propsSchema: createFieldPropsSchema({
|
|
15
|
+
placeholder: placeholderProperty,
|
|
16
|
+
...inputAddonProperties,
|
|
17
|
+
allowClear: allowClearProperty,
|
|
18
|
+
autoFocus: autoFocusProperty,
|
|
19
|
+
bordered: createSwitchProperty('显示边框'),
|
|
20
|
+
visibilityToggle: createSwitchProperty('显示切换按钮'),
|
|
21
|
+
checkStrength: createSwitchProperty('校验强度'),
|
|
22
|
+
status: statusProperty,
|
|
23
|
+
size: sizeProperty,
|
|
24
|
+
showCount: inputLimitProperties.showCount,
|
|
25
|
+
maxLength: {
|
|
26
|
+
type: 'number',
|
|
27
|
+
'x-decorator': 'FormItem',
|
|
28
|
+
'x-component': 'NumberPicker',
|
|
29
|
+
title: '最大长度',
|
|
30
|
+
},
|
|
31
|
+
}),
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
Password.Resource = createResource({
|
|
35
|
+
icon: 'LockOutlined',
|
|
36
|
+
elements: [
|
|
37
|
+
{
|
|
38
|
+
componentName: 'Password',
|
|
39
|
+
props: createFieldResourceProps('password', '密码', {
|
|
40
|
+
placeholder: '请输入密码',
|
|
41
|
+
}),
|
|
42
|
+
},
|
|
43
|
+
],
|
|
44
|
+
});
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { QRCode as AntdQRCode } from '@yimoka/antd';
|
|
3
|
+
import { createBehavior, createResource } from '@yimoka/designable-core';
|
|
4
|
+
import { createContainerPropsSchema, createInputProperty, createNumberProperty, createSelectProperty, splitDesignableStyleProps, } from "../shared.js";
|
|
5
|
+
export const QRCode = (props) => {
|
|
6
|
+
const { componentProps: qrCodeProps, designerProps, wrapperStyle, } = splitDesignableStyleProps(props);
|
|
7
|
+
return (_jsx("div", { ...designerProps, style: { display: 'inline-flex', ...wrapperStyle }, children: _jsx(AntdQRCode, { ...qrCodeProps, value: String(qrCodeProps.value ?? '') }) }));
|
|
8
|
+
};
|
|
9
|
+
QRCode.Behavior = createBehavior({
|
|
10
|
+
name: 'QRCode',
|
|
11
|
+
selector: node => node.componentName === 'QRCode',
|
|
12
|
+
designerProps: {
|
|
13
|
+
propsSchema: createContainerPropsSchema({
|
|
14
|
+
value: createInputProperty('内容'),
|
|
15
|
+
size: createNumberProperty('尺寸'),
|
|
16
|
+
color: createInputProperty('颜色'),
|
|
17
|
+
bgColor: createInputProperty('背景色'),
|
|
18
|
+
errorLevel: createSelectProperty('纠错等级', ['L', 'M', 'Q', 'H']),
|
|
19
|
+
status: createSelectProperty('状态', ['active', 'expired', 'loading', 'scanned']),
|
|
20
|
+
}),
|
|
21
|
+
},
|
|
22
|
+
});
|
|
23
|
+
QRCode.Resource = createResource({
|
|
24
|
+
icon: '',
|
|
25
|
+
elements: [
|
|
26
|
+
{
|
|
27
|
+
componentName: 'QRCode',
|
|
28
|
+
props: {
|
|
29
|
+
size: 96,
|
|
30
|
+
value: 'https://example.com',
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
],
|
|
34
|
+
});
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Radio as AntdRadio } from '@yimoka/antd';
|
|
3
|
+
import { createBehavior, createResource } from '@yimoka/designable-core';
|
|
4
|
+
import { autoFocusProperty, createDataBindingProperty, createFieldResourceProps, createFieldPropsSchema, splitDesignableStyleProps, withSchemaOptions, } from "../shared.js";
|
|
5
|
+
const defaultOptions = [
|
|
6
|
+
{ label: '选项一', value: 'option1' },
|
|
7
|
+
{ label: '选项二', value: 'option2' },
|
|
8
|
+
];
|
|
9
|
+
export const Radio = (props) => {
|
|
10
|
+
const { componentProps: radioProps, designerProps, wrapperStyle, } = splitDesignableStyleProps(props);
|
|
11
|
+
const normalizedRadioProps = withSchemaOptions(radioProps);
|
|
12
|
+
const hasExplicitDataSource = ['options', 'data', 'dataKey'].some(key => (Object.prototype.hasOwnProperty.call(normalizedRadioProps, key)));
|
|
13
|
+
return (_jsx("div", { ...designerProps, style: { display: 'inline-block', width: '100%', ...wrapperStyle }, children: _jsx(AntdRadio.Group, { ...(!hasExplicitDataSource ? { options: defaultOptions } : {}), ...normalizedRadioProps }) }));
|
|
14
|
+
};
|
|
15
|
+
Radio.Behavior = createBehavior({
|
|
16
|
+
name: 'Radio',
|
|
17
|
+
selector: node => node.componentName === 'Radio',
|
|
18
|
+
designerProps: {
|
|
19
|
+
propsSchema: createFieldPropsSchema({
|
|
20
|
+
dataBinding: createDataBindingProperty(['options', 'data']),
|
|
21
|
+
autoFocus: autoFocusProperty,
|
|
22
|
+
optionType: {
|
|
23
|
+
type: 'string',
|
|
24
|
+
enum: ['default', 'button'],
|
|
25
|
+
'x-decorator': 'FormItem',
|
|
26
|
+
'x-component': 'Select',
|
|
27
|
+
title: '选项样式',
|
|
28
|
+
},
|
|
29
|
+
buttonStyle: {
|
|
30
|
+
type: 'string',
|
|
31
|
+
enum: ['outline', 'solid'],
|
|
32
|
+
'x-decorator': 'FormItem',
|
|
33
|
+
'x-component': 'Select',
|
|
34
|
+
title: '按钮风格',
|
|
35
|
+
},
|
|
36
|
+
}),
|
|
37
|
+
},
|
|
38
|
+
});
|
|
39
|
+
Radio.Resource = createResource({
|
|
40
|
+
icon: 'CheckCircleOutlined',
|
|
41
|
+
elements: [
|
|
42
|
+
{
|
|
43
|
+
componentName: 'Radio',
|
|
44
|
+
props: createFieldResourceProps('radio', '单选', {
|
|
45
|
+
options: defaultOptions,
|
|
46
|
+
}),
|
|
47
|
+
},
|
|
48
|
+
],
|
|
49
|
+
});
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Rate as AntdRate } from '@yimoka/antd';
|
|
3
|
+
import { createBehavior, createResource } from '@yimoka/designable-core';
|
|
4
|
+
import { allowClearProperty, autoFocusProperty, createExpressionProperty, createFieldResourceProps, createFieldPropsSchema, createInputProperty, splitDesignableStyleProps, } from "../shared.js";
|
|
5
|
+
export const Rate = (props) => {
|
|
6
|
+
const { componentProps: rateProps, designerProps, wrapperStyle, } = splitDesignableStyleProps(props);
|
|
7
|
+
return (_jsx("div", { ...designerProps, style: { display: 'inline-block', ...wrapperStyle }, children: _jsx(AntdRate, { ...rateProps }) }));
|
|
8
|
+
};
|
|
9
|
+
Rate.Behavior = createBehavior({
|
|
10
|
+
name: 'Rate',
|
|
11
|
+
selector: node => node.componentName === 'Rate',
|
|
12
|
+
designerProps: {
|
|
13
|
+
propsSchema: createFieldPropsSchema({
|
|
14
|
+
count: {
|
|
15
|
+
type: 'number',
|
|
16
|
+
'x-decorator': 'FormItem',
|
|
17
|
+
'x-component': 'NumberPicker',
|
|
18
|
+
title: '数量',
|
|
19
|
+
},
|
|
20
|
+
allowHalf: {
|
|
21
|
+
type: 'boolean',
|
|
22
|
+
'x-decorator': 'FormItem',
|
|
23
|
+
'x-component': 'Switch',
|
|
24
|
+
title: '允许半选',
|
|
25
|
+
},
|
|
26
|
+
allowClear: allowClearProperty,
|
|
27
|
+
autoFocus: autoFocusProperty,
|
|
28
|
+
character: createInputProperty('自定义字符'),
|
|
29
|
+
tooltips: createExpressionProperty('提示文案', '{{["很差","较差","一般","不错","很好"]}}'),
|
|
30
|
+
}),
|
|
31
|
+
},
|
|
32
|
+
});
|
|
33
|
+
Rate.Resource = createResource({
|
|
34
|
+
icon: 'StarOutlined',
|
|
35
|
+
elements: [
|
|
36
|
+
{
|
|
37
|
+
componentName: 'Rate',
|
|
38
|
+
props: createFieldResourceProps('rate', '评分', {
|
|
39
|
+
count: 5,
|
|
40
|
+
}),
|
|
41
|
+
},
|
|
42
|
+
],
|
|
43
|
+
});
|