react-antd-xform 1.0.8 → 1.0.9
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 +17 -0
- package/dist/form/type.d.ts +12 -0
- package/dist/form-ui/common-utils.js +18 -0
- package/package.json +8 -3
package/README.md
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
## 📦 安装
|
|
2
|
+
|
|
3
|
+
选择你喜欢的包管理器进行安装:
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
# npm
|
|
7
|
+
npm install react-antd-xform --save
|
|
8
|
+
|
|
9
|
+
# yarn
|
|
10
|
+
yarn add react-antd-xform
|
|
11
|
+
|
|
12
|
+
# pnpm
|
|
13
|
+
pnpm add react-antd-xform
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
文档地址:https://jhuazhang.github.io/react-antd-xform 或者访问http://handn.xyz/react-antd-xform
|
package/dist/form/type.d.ts
CHANGED
|
@@ -214,6 +214,17 @@ export interface FormItemCreationOptions {
|
|
|
214
214
|
/** 组件是否具有固有宽度,默认为 true。该选项为 true 时,controlWidth 将不对组件产生效果 */
|
|
215
215
|
hasIntrinsicWidth?: boolean;
|
|
216
216
|
}
|
|
217
|
+
export interface BaseOptionType {
|
|
218
|
+
disabled?: boolean;
|
|
219
|
+
className?: string;
|
|
220
|
+
title?: string;
|
|
221
|
+
[name: string]: any;
|
|
222
|
+
}
|
|
223
|
+
export interface DefaultOptionType extends BaseOptionType {
|
|
224
|
+
label?: React.ReactNode;
|
|
225
|
+
value?: string | number | null;
|
|
226
|
+
children?: Omit<DefaultOptionType, 'children'>[];
|
|
227
|
+
}
|
|
217
228
|
export interface FormItemProps extends Omit<FieldConfig<any>, 'defaultValueProp' | 'valueProp' | 'htmlId'> {
|
|
218
229
|
use?: boolean;
|
|
219
230
|
component: string | React.ComponentType<FormItemComponentProps>;
|
|
@@ -236,6 +247,7 @@ export interface FormItemProps extends Omit<FieldConfig<any>, 'defaultValueProp'
|
|
|
236
247
|
rightNode?: React.ReactNode;
|
|
237
248
|
isPreview?: boolean;
|
|
238
249
|
variant?: Variant;
|
|
250
|
+
options?: DefaultOptionType[];
|
|
239
251
|
}
|
|
240
252
|
export interface FormItemViewProps {
|
|
241
253
|
/** `<label />` 的 id 属性 */
|
|
@@ -7,6 +7,24 @@ import weekOfYear from "../node_modules/.pnpm/dayjs@1.11.18/node_modules/dayjs/p
|
|
|
7
7
|
dayjs.extend(weekOfYear);
|
|
8
8
|
dayjs.extend(weekYear);
|
|
9
9
|
dayjs.extend(isoweek);
|
|
10
|
+
if (!dayjs.__patchedForAntd__) {
|
|
11
|
+
dayjs.__patchedForAntd__ = true;
|
|
12
|
+
if (!dayjs.prototype.weekday) {
|
|
13
|
+
dayjs.prototype.weekday = function() {
|
|
14
|
+
return this.day();
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
if (!dayjs.prototype.localeData) {
|
|
18
|
+
dayjs.prototype.localeData = function() {
|
|
19
|
+
return {
|
|
20
|
+
firstDayOfWeek: () => 1,
|
|
21
|
+
// 默认中文环境周一开头
|
|
22
|
+
weekdaysShort: () => ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
|
|
23
|
+
monthsShort: () => "Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_")
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
}
|
|
10
28
|
function isEmptyValue(value) {
|
|
11
29
|
return !value && value !== 0 || Array.isArray(value) && value.length === 0;
|
|
12
30
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-antd-xform",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.9",
|
|
4
4
|
"description": "基于mobx的form解决方案",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -15,8 +15,11 @@
|
|
|
15
15
|
"dev": "sb dev -p 6006",
|
|
16
16
|
"build-storybook": "sb build",
|
|
17
17
|
"docs:dev": "dumi dev",
|
|
18
|
-
"docs:build": "dumi build",
|
|
19
|
-
"docs:
|
|
18
|
+
"docs:build-site": "dumi build",
|
|
19
|
+
"docs:build": "cross-env DUMI_ENV=devbuild dumi build",
|
|
20
|
+
"docs:serve": "dumi serve",
|
|
21
|
+
"predeploy": "npm run docs:build",
|
|
22
|
+
"deploy": "gh-pages -d docs-dist -b gh-pages"
|
|
20
23
|
},
|
|
21
24
|
"keywords": [],
|
|
22
25
|
"author": "",
|
|
@@ -46,8 +49,10 @@
|
|
|
46
49
|
"@types/react-syntax-highlighter": "^15.5.13",
|
|
47
50
|
"@vitejs/plugin-react": "^4.6.0",
|
|
48
51
|
"babel-plugin-transform-remove-console": "^6.9.4",
|
|
52
|
+
"cross-env": "^10.0.0",
|
|
49
53
|
"dumi": "^2.4.21",
|
|
50
54
|
"dumi-theme-antd": "^0.4.4",
|
|
55
|
+
"gh-pages": "^6.3.0",
|
|
51
56
|
"react": "^18.2.0",
|
|
52
57
|
"react-dom": "^18.2.0",
|
|
53
58
|
"react-json-view": "^1.21.3",
|