yy-forms 1.0.45 → 1.0.47
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/dist/index.esm.js +24 -0
- package/dist/index.js +24 -0
- package/package.json +2 -1
- package/.fatherrc.js +0 -37
- package/CHANGELOG.md +0 -254
- package/es/Provider.js +0 -248
- package/es/index.d.ts +0 -145
- package/es/index.js +0 -44
- package/es/settings/index.js +0 -975
- package/es/styles/atom.less +0 -1134
- package/es/styles/index.less +0 -358
- package/es/transformer/form-render.js +0 -75
- package/es/utils/context.js +0 -3
- package/es/utils/hooks.js +0 -48
- package/es/utils/index.js +0 -706
- package/es/utils/mapping.js +0 -31
- package/es/utils/serialize.js +0 -276
- package/es/widgets/htmlInput.js +0 -20
- package/es/widgets/idInput.js +0 -23
- package/es/widgets/index.js +0 -5
- package/es/widgets/jsonInput.js +0 -24
- package/es/widgets/list.js +0 -24
- package/es/widgets/percentSlider.js +0 -89
- package/src/Provider.jsx +0 -239
- package/src/components/Canvas/core/RenderChildren.jsx +0 -18
- package/src/components/Canvas/core/RenderField.jsx +0 -131
- package/src/components/Canvas/core/Wrapper.jsx +0 -298
- package/src/components/Canvas/core/Wrapper.less +0 -57
- package/src/components/Canvas/core/index.jsx +0 -171
- package/src/components/Canvas/index.jsx +0 -178
- package/src/components/Settings/GlobalSettings.jsx +0 -50
- package/src/components/Settings/ItemSettings.jsx +0 -155
- package/src/components/Settings/index.jsx +0 -75
- package/src/components/Settings/index.less +0 -25
- package/src/components/Sidebar/Element.jsx +0 -80
- package/src/components/Sidebar/Element.less +0 -18
- package/src/components/Sidebar/index.jsx +0 -47
- package/src/components/Sidebar/index.less +0 -23
- package/src/i18next/index.ts +0 -14
- package/src/i18next/locales/enUS.json +0 -51
- package/src/i18next/locales/resources.ts +0 -7
- package/src/i18next/locales/zhCN.json +0 -3
- package/src/index.d.ts +0 -145
- package/src/index.js +0 -45
- package/src/settings/index.js +0 -2030
- package/src/styles/atom.less +0 -1134
- package/src/styles/index.less +0 -358
- package/src/transformer/form-render.js +0 -65
- package/src/utils/context.js +0 -4
- package/src/utils/hooks.js +0 -35
- package/src/utils/index.js +0 -678
- package/src/utils/mapping.js +0 -29
- package/src/utils/serialize.js +0 -368
- package/src/widgets/htmlInput.jsx +0 -24
- package/src/widgets/idInput.jsx +0 -27
- package/src/widgets/index.js +0 -6
- package/src/widgets/jsonInput.jsx +0 -29
- package/src/widgets/list.jsx +0 -28
- package/src/widgets/percentSlider.jsx +0 -74
package/es/index.d.ts
DELETED
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
import { FC, ForwardRefExoticComponent, ReactNode, RefAttributes } from 'react';
|
|
2
|
-
|
|
3
|
-
export interface Transformer {
|
|
4
|
-
/** 正向的转换函数 */
|
|
5
|
-
from?: (schema: any) => any;
|
|
6
|
-
/** 反向的转换函数 */
|
|
7
|
-
to?: (schema: any) => any;
|
|
8
|
-
/** 反向的转换函数 */
|
|
9
|
-
fromSetting?: (schema: any) => any;
|
|
10
|
-
/** 反向的转换函数 */
|
|
11
|
-
toSetting?: (schema: any) => any;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export interface ExtraButton {
|
|
15
|
-
/** 按钮文案 */
|
|
16
|
-
text: string;
|
|
17
|
-
/** 点击回调 */
|
|
18
|
-
onClick?: (event: any) => void;
|
|
19
|
-
[key: string]: any;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export interface ControlButton {
|
|
23
|
-
/** 按钮文案 */
|
|
24
|
-
text?: string;
|
|
25
|
-
/** 点击回调 */
|
|
26
|
-
onClick?: (event: any, schema: any) => void;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export interface SettingWidget {
|
|
30
|
-
/** 按钮生成的 schema 的 key 值 */
|
|
31
|
-
name: string;
|
|
32
|
-
/** 在左侧栏按钮展示文案 */
|
|
33
|
-
text: string;
|
|
34
|
-
/** 在左侧栏按钮展示图标 */
|
|
35
|
-
icon?: string | ReactNode;
|
|
36
|
-
/** 如果是基本组件,这个字段注明它对应的 widgets */
|
|
37
|
-
widget?: string;
|
|
38
|
-
/** 组件对应的 schema 片段 */
|
|
39
|
-
schema?: any;
|
|
40
|
-
/** 组件的配置信息,使用 form-render 的 schema 来描述 */
|
|
41
|
-
setting?: any;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export interface Setting {
|
|
45
|
-
/** 最外层的分组名称 */
|
|
46
|
-
title: string;
|
|
47
|
-
/** 每个组件的配置,在左侧栏是一个按钮 */
|
|
48
|
-
widgets: SettingWidget[];
|
|
49
|
-
show?: boolean;
|
|
50
|
-
useCommon?: boolean;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
export interface FRGeneratorProps {
|
|
54
|
-
getId?: (name: string) => string;
|
|
55
|
-
/** 国际化配置 */
|
|
56
|
-
locale?: 'cn' | 'en';
|
|
57
|
-
/** 隐藏组件 ID */
|
|
58
|
-
hideId?: boolean;
|
|
59
|
-
/** 固定 id */
|
|
60
|
-
fixedName?: boolean;
|
|
61
|
-
/** 组件删除控制 */
|
|
62
|
-
canDelete?: boolean | Function;
|
|
63
|
-
/** 默认一进入编辑器展示的表单对应的 schema */
|
|
64
|
-
defaultValue?: any;
|
|
65
|
-
/** 自定义 schema 到 form-render 的 schema 的双向转换函数 */
|
|
66
|
-
transformer?: Transformer;
|
|
67
|
-
/** 编辑区顶部的自定义按钮 */
|
|
68
|
-
extraButtons?: (ExtraButton | boolean | string)[];
|
|
69
|
-
/** 选中项操作按钮 */
|
|
70
|
-
controlButtons?: (ControlButton | boolean | Function)[];
|
|
71
|
-
/** 预览态控制 */
|
|
72
|
-
preview?: boolean;
|
|
73
|
-
/** 左右侧栏配置 */
|
|
74
|
-
settings?: Setting[];
|
|
75
|
-
/** 通用配置 */
|
|
76
|
-
commonSettings?: any;
|
|
77
|
-
/** 全局配置 */
|
|
78
|
-
globalSettings?: any;
|
|
79
|
-
/** 自定义组件 */
|
|
80
|
-
widgets?: any;
|
|
81
|
-
/** 配置栏自定义组件 */
|
|
82
|
-
settingsWidgets?: any;
|
|
83
|
-
/** 组件和 schema 的映射规则 */
|
|
84
|
-
mapping?: any;
|
|
85
|
-
/** 配置表单校验 */
|
|
86
|
-
validation?: boolean;
|
|
87
|
-
fieldRender?: (
|
|
88
|
-
schema?: any,
|
|
89
|
-
widgetProps?: any,
|
|
90
|
-
children?: ReactNode,
|
|
91
|
-
originNode?: ReactNode
|
|
92
|
-
) => ReactNode;
|
|
93
|
-
fieldWrapperRender?: (
|
|
94
|
-
schema?: any,
|
|
95
|
-
isSelected?: boolean,
|
|
96
|
-
children?: ReactNode,
|
|
97
|
-
originNode?: ReactNode
|
|
98
|
-
) => ReactNode;
|
|
99
|
-
elementRender?: (
|
|
100
|
-
schema?: any,
|
|
101
|
-
widgetProps?: SettingWidget,
|
|
102
|
-
originNode?: ReactNode
|
|
103
|
-
) => ReactNode;
|
|
104
|
-
/** 表单 data 变化回调 */
|
|
105
|
-
onChange?: (data: any) => void;
|
|
106
|
-
/** 表单 schema 变化回调 */
|
|
107
|
-
onSchemaChange?: (schema: any) => void;
|
|
108
|
-
/** 画布组件选择回调 */
|
|
109
|
-
onCanvasSelect?: (schema: any) => void;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
export interface SettingsProps {
|
|
113
|
-
/** 自定义组件 */
|
|
114
|
-
widgets?: any;
|
|
115
|
-
}
|
|
116
|
-
export interface CanvasProps {
|
|
117
|
-
/** 画布组件选择回调 */
|
|
118
|
-
onCanvasSelect?: (schema: any) => void;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
export interface SidebarProps {
|
|
122
|
-
/** 固定 id */
|
|
123
|
-
fixedName?: boolean;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
export interface Generator
|
|
127
|
-
extends ForwardRefExoticComponent<
|
|
128
|
-
FRGeneratorProps & RefAttributes<HTMLElement>
|
|
129
|
-
> {
|
|
130
|
-
Provider: FC<FRGeneratorProps>;
|
|
131
|
-
Settings: FC<SettingsProps>;
|
|
132
|
-
Canvas: FC<CanvasProps>;
|
|
133
|
-
Sidebar: FC<SidebarProps>;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
declare const FRGenerator: Generator;
|
|
137
|
-
declare const defaultSettings: Setting[];
|
|
138
|
-
declare const defaultCommonSettings: any;
|
|
139
|
-
declare const defaultGlobalSettings: any;
|
|
140
|
-
declare const fromSetting: (schema: any) => any;
|
|
141
|
-
declare const toSetting: (schema: any) => any;
|
|
142
|
-
|
|
143
|
-
export { defaultSettings, defaultCommonSettings, defaultGlobalSettings };
|
|
144
|
-
export { fromSetting, toSetting };
|
|
145
|
-
export default FRGenerator;
|
package/es/index.js
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
var _excluded = ["fixedName", "settingsWidgets", "onCanvasSelect", "locale"];
|
|
2
|
-
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
3
|
-
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
4
|
-
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
5
|
-
import React, { useEffect, forwardRef } from 'react';
|
|
6
|
-
import { useTranslation } from 'react-i18next';
|
|
7
|
-
import Canvas from './components/Canvas';
|
|
8
|
-
import Settings from './components/Settings';
|
|
9
|
-
import Sidebar from './components/Sidebar';
|
|
10
|
-
import Provider from './Provider';
|
|
11
|
-
import './i18next';
|
|
12
|
-
import './styles/index.less';
|
|
13
|
-
var Generator = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
14
|
-
var fixedName = _ref.fixedName,
|
|
15
|
-
settingsWidgets = _ref.settingsWidgets,
|
|
16
|
-
onCanvasSelect = _ref.onCanvasSelect,
|
|
17
|
-
_ref$locale = _ref.locale,
|
|
18
|
-
locale = _ref$locale === void 0 ? 'cn' : _ref$locale,
|
|
19
|
-
props = _objectWithoutProperties(_ref, _excluded);
|
|
20
|
-
var _useTranslation = useTranslation(),
|
|
21
|
-
i18n = _useTranslation.i18n;
|
|
22
|
-
useEffect(function () {
|
|
23
|
-
i18n.changeLanguage(locale);
|
|
24
|
-
}, [locale]);
|
|
25
|
-
return /*#__PURE__*/React.createElement(Provider, _extends({
|
|
26
|
-
ref: ref
|
|
27
|
-
}, props), /*#__PURE__*/React.createElement("div", {
|
|
28
|
-
className: "fr-generator-container"
|
|
29
|
-
}, /*#__PURE__*/React.createElement(Sidebar, {
|
|
30
|
-
fixedName: fixedName
|
|
31
|
-
}), /*#__PURE__*/React.createElement(Canvas, {
|
|
32
|
-
onSelect: onCanvasSelect
|
|
33
|
-
}), /*#__PURE__*/React.createElement(Settings, {
|
|
34
|
-
widgets: settingsWidgets
|
|
35
|
-
})));
|
|
36
|
-
});
|
|
37
|
-
Generator.Provider = Provider;
|
|
38
|
-
Generator.Sidebar = Sidebar;
|
|
39
|
-
Generator.Canvas = Canvas;
|
|
40
|
-
Generator.Settings = Settings;
|
|
41
|
-
export { defaultCommonSettings, defaultGlobalSettings, defaultSettings } from './settings';
|
|
42
|
-
export { fromSetting, toSetting } from './transformer/form-render';
|
|
43
|
-
export default Generator;
|
|
44
|
-
export * from './utils/serialize';
|