@quansitech/antd-admin 1.0.1 → 1.1.0
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/components/Column/Readonly/Action.tsx +1 -1
- package/components/Column/Ueditor.tsx +1 -1
- package/components/Form/Actions.tsx +1 -1
- package/components/Form.tsx +5 -8
- package/components/Layout/New.tsx +1 -1
- package/components/Table/ToolbarActions.tsx +1 -1
- package/components/Table.tsx +1 -4
- package/components/Tabs.tsx +1 -1
- package/lib/helpers.tsx +1 -1
- package/lib/writeExtra.js +31 -0
- package/package.json +1 -1
- package/readme.md +23 -0
|
@@ -5,7 +5,7 @@ import {Badge, Flex} from "antd";
|
|
|
5
5
|
import {ColumnReadonlyProps} from "./types";
|
|
6
6
|
import {asyncFilter, handleRules} from "../../../lib/helpers";
|
|
7
7
|
import {Rules} from "@rc-component/async-validator/lib/interface";
|
|
8
|
-
import upperFirst from "lodash
|
|
8
|
+
import {upperFirst} from "lodash";
|
|
9
9
|
import {TableColumnActionProps} from "./Action/types";
|
|
10
10
|
|
|
11
11
|
type ComponentType = {
|
|
@@ -3,7 +3,7 @@ import {Component} from "react";
|
|
|
3
3
|
import {createScript, filterObjectKeys} from "../../lib/helpers";
|
|
4
4
|
import {Spin} from "antd";
|
|
5
5
|
import {ModalContext, ModalContextProps} from "../ModalContext";
|
|
6
|
-
import uniqueId from "lodash
|
|
6
|
+
import {uniqueId} from "lodash";
|
|
7
7
|
|
|
8
8
|
declare global {
|
|
9
9
|
interface Window {
|
|
@@ -3,7 +3,7 @@ import {lazy, useEffect, useState} from "react";
|
|
|
3
3
|
import {ReactComponentLike} from "prop-types";
|
|
4
4
|
import {Badge, Space} from "antd";
|
|
5
5
|
import container from "../../lib/container";
|
|
6
|
-
import upperFirst from "lodash
|
|
6
|
+
import {upperFirst} from "lodash";
|
|
7
7
|
|
|
8
8
|
export default function (props: {
|
|
9
9
|
actions?: FormActionType[]
|
package/components/Form.tsx
CHANGED
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
import {BetaSchemaForm, ProFormColumnsType, ProFormInstance, ProSkeleton} from "@ant-design/pro-components";
|
|
2
2
|
import type {FormSchema} from "@ant-design/pro-form/es/components/SchemaForm/typing";
|
|
3
3
|
import React, {lazy, Suspense, useContext, useEffect, useRef, useState} from "react";
|
|
4
|
-
import upperFirst from "lodash
|
|
4
|
+
import {cloneDeep, upperFirst} from "lodash";
|
|
5
5
|
import container from "../lib/container";
|
|
6
6
|
import {FormActionType} from "./Form/Action/types";
|
|
7
7
|
import Actions from "./Form/Actions";
|
|
8
8
|
import {FormContext} from "./FormContext";
|
|
9
9
|
import {Col, Row, Spin} from "antd";
|
|
10
10
|
import http from "../lib/http";
|
|
11
|
-
import {RuleObject} from "rc-field-form/lib/interface";
|
|
12
11
|
import customRule from "../lib/customRule";
|
|
13
|
-
import cloneDeep from "lodash/cloneDeep";
|
|
14
12
|
import {ModalContext} from "./ModalContext";
|
|
15
13
|
import {TableContext} from "./TableContext";
|
|
16
14
|
import {commonHandler} from "../lib/schemaHandler";
|
|
15
|
+
import {Rule} from "antd/es/form";
|
|
17
16
|
|
|
18
17
|
type SubmitRequestType = {
|
|
19
18
|
url: string,
|
|
@@ -42,7 +41,7 @@ export default function (props: FormSchema & {
|
|
|
42
41
|
useEffect(() => {
|
|
43
42
|
setColumns((cloneDeep(props.columns)?.map((c: ProFormColumnsType & {
|
|
44
43
|
formItemProps?: {
|
|
45
|
-
rules?: (
|
|
44
|
+
rules?: (Rule & {
|
|
46
45
|
customType?: string
|
|
47
46
|
})[]
|
|
48
47
|
}
|
|
@@ -55,10 +54,8 @@ export default function (props: FormSchema & {
|
|
|
55
54
|
c.formItemProps.rules = []
|
|
56
55
|
}
|
|
57
56
|
c.formItemProps.rules = c.formItemProps.rules.map(rule => {
|
|
58
|
-
if (rule.customType) {
|
|
59
|
-
|
|
60
|
-
rule.validator = customRule[rule.customType]
|
|
61
|
-
}
|
|
57
|
+
if (rule.customType && customRule[rule.customType]) {
|
|
58
|
+
rule.validator = customRule[rule.customType]
|
|
62
59
|
}
|
|
63
60
|
return rule
|
|
64
61
|
})
|
|
@@ -9,7 +9,7 @@ import {MenuInfo} from "rc-menu/lib/interface";
|
|
|
9
9
|
import http from "../../lib/http";
|
|
10
10
|
// @ts-ignore
|
|
11
11
|
import {Route} from '@ant-design/pro-layout/lib/typing';
|
|
12
|
-
import assign from "lodash
|
|
12
|
+
import {assign} from "lodash";
|
|
13
13
|
import {MoonOutlined, SunOutlined} from "@ant-design/icons";
|
|
14
14
|
|
|
15
15
|
export default function ({children, pageTitle, siteTitle}: {
|
|
@@ -3,7 +3,7 @@ import container from "../../lib/container";
|
|
|
3
3
|
import {ReactComponentLike} from "prop-types";
|
|
4
4
|
import {Badge, Space} from "antd";
|
|
5
5
|
import {TableActionProps} from "./Action/types";
|
|
6
|
-
import upperFirst from "lodash
|
|
6
|
+
import {upperFirst} from "lodash";
|
|
7
7
|
|
|
8
8
|
export default function ({
|
|
9
9
|
actions,
|
package/components/Table.tsx
CHANGED
|
@@ -9,8 +9,7 @@ import {
|
|
|
9
9
|
} from "@ant-design/pro-components";
|
|
10
10
|
import type {SortOrder} from "antd/lib/table/interface";
|
|
11
11
|
import {TablePaginationConfig} from "antd/es/table";
|
|
12
|
-
import isArray from "lodash
|
|
13
|
-
import upperFirst from "lodash/upperFirst"
|
|
12
|
+
import {cloneDeep, isArray, uniqueId, upperFirst} from "lodash"
|
|
14
13
|
import {TableContext} from "./TableContext";
|
|
15
14
|
import ToolbarActions from "./Table/ToolbarActions";
|
|
16
15
|
import container from "../lib/container";
|
|
@@ -19,8 +18,6 @@ import http from "../lib/http";
|
|
|
19
18
|
import {Spin} from "antd";
|
|
20
19
|
import "./Table.scss"
|
|
21
20
|
import {ModalContext} from "./ModalContext";
|
|
22
|
-
import cloneDeep from "lodash/cloneDeep";
|
|
23
|
-
import uniqueId from "lodash/uniqueId";
|
|
24
21
|
import {commonHandler} from "../lib/schemaHandler";
|
|
25
22
|
|
|
26
23
|
export type TableProps = ProTableProps<any, any> & {
|
package/components/Tabs.tsx
CHANGED
|
@@ -3,7 +3,7 @@ import {lazy, Suspense, useEffect, useState} from "react";
|
|
|
3
3
|
import type {Tab} from 'rc-tabs/lib/interface';
|
|
4
4
|
import container from "../lib/container";
|
|
5
5
|
import {routerNavigateTo} from "../lib/helpers";
|
|
6
|
-
import upperFirst from "lodash
|
|
6
|
+
import {upperFirst} from "lodash";
|
|
7
7
|
import {ProSkeleton} from "@ant-design/pro-components";
|
|
8
8
|
|
|
9
9
|
type TabProps = {
|
package/lib/helpers.tsx
CHANGED
|
@@ -5,7 +5,7 @@ import {Rules, ValidateError, ValidateFieldsError, Values} from "@rc-component/a
|
|
|
5
5
|
import {Spin} from "antd";
|
|
6
6
|
import http from "./http";
|
|
7
7
|
import container from "./container";
|
|
8
|
-
import upperFirst from "lodash
|
|
8
|
+
import {upperFirst} from "lodash";
|
|
9
9
|
import {lazy, Suspense} from "react";
|
|
10
10
|
import global from "./global";
|
|
11
11
|
import {ModalContext} from "../components/ModalContext";
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import fs from "node:fs"
|
|
2
|
+
import path from "node:path"
|
|
3
|
+
import * as process from "node:process";
|
|
4
|
+
|
|
5
|
+
export default function () {
|
|
6
|
+
// 分析额外组件
|
|
7
|
+
if (!fs.existsSync(process.cwd() + '/vendor')) {
|
|
8
|
+
throw new Error('Please run `composer install` first.');
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const installed = JSON.parse(fs.readFileSync(process.cwd() + '/vendor/composer/installed.json'))
|
|
12
|
+
const extras = installed.packages.filter(p => !!p.extra?.qscmf?.['antd-admin']).map(p => ({
|
|
13
|
+
name: p.name,
|
|
14
|
+
path: p['install-path'],
|
|
15
|
+
component: p.extra.qscmf['antd-admin'].component,
|
|
16
|
+
}));
|
|
17
|
+
|
|
18
|
+
const extra_script = `
|
|
19
|
+
import container from "@quansitech/antd-admin/lib/container.ts";
|
|
20
|
+
|
|
21
|
+
${extras.map(e => {
|
|
22
|
+
const cs = [];
|
|
23
|
+
for (const componentKey in e.component) {
|
|
24
|
+
cs.push(`container.register('${componentKey}', () => import('../../../vendor${path.join('/', e.path, e.component[componentKey])}'));`)
|
|
25
|
+
}
|
|
26
|
+
return cs.join('\n');
|
|
27
|
+
})}
|
|
28
|
+
`
|
|
29
|
+
|
|
30
|
+
fs.writeFileSync(process.cwd() + '/resources/js/backend/extra.ts', extra_script);
|
|
31
|
+
}
|
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -126,3 +126,26 @@ container.register('Column.Readonly.Action.组件名', () => import('[组件路
|
|
|
126
126
|
|
|
127
127
|
- 若要补充组件库,请把组件放``` compontents/Column/Readonly/Action/ ``` 目录下
|
|
128
128
|
|
|
129
|
+
## 更新日志
|
|
130
|
+
|
|
131
|
+
### 1.1.0
|
|
132
|
+
|
|
133
|
+
#### 1.增加composer包注册组件机制
|
|
134
|
+
|
|
135
|
+
在包的composer.json中添加如下配置
|
|
136
|
+
|
|
137
|
+
```json5
|
|
138
|
+
{
|
|
139
|
+
// 省略其它配置
|
|
140
|
+
"extra": {
|
|
141
|
+
"qscmf": {
|
|
142
|
+
"antd-admin": {
|
|
143
|
+
"component": {
|
|
144
|
+
"【container注册位置】": "【目标组件路径】",
|
|
145
|
+
"Column.Extra": "resourses/js/Component/Extra.tsx"
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
```
|