Skip to content

Commit

Permalink
Merge pull request #4 from charlzyx/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
charlzyx authored Jan 19, 2024
2 parents 0d8099b + b7257f7 commit 8d3911b
Show file tree
Hide file tree
Showing 83 changed files with 1,948 additions and 1,076 deletions.
31 changes: 13 additions & 18 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,6 @@ permissions:
discussions: write

jobs:
create-release:
runs-on: ubuntu-latest
outputs:
RELEASE_UPLOAD_ID: ${{ steps.create_release.outputs.id }}

steps:
- uses: actions/checkout@v3
- name: Query version number
id: get_version
run: |
echo "using version tag ${GITHUB_REF:10}"
echo ::set-output name=VERSION::"${GITHUB_REF:10}"
- name: Create Release
id: create_release
uses: softprops/action-gh-release@v1
with:
tag_name: "${{ steps.get_version.outputs.VERSION }}"
body: '<a href="https://github.com/charlzyx/proformily/blob/master/CHANGELOG.md">CHANGELOG</a>'
publish-npm:
runs-on: ubuntu-latest
steps:
Expand All @@ -49,16 +31,21 @@ jobs:
version=$(echo $tag_name | cut -d'/' -f2)
tag="latest"
pre_release=false
# 检查是否预发布
if [[ $tag_name == *"alpha"* ]]; then
tag="alpha"
pre_release=true
fi
if [[ $tag_name == *"beta"* ]]; then
tag="beta"
pre_release=true
fi
echo "::set-output name=pre_release::$pre_release"
echo "::set-output name=module_name::$module_name"
echo "::set-output name=tag_name::$tag_name"
echo "::set-output name=version::$version"
echo "::set-output name=tag::$tag"
- uses: oven-sh/setup-bun@v1
Expand All @@ -77,3 +64,11 @@ jobs:
npm publish --access=public --tag ${{steps.parse_tag.outputs.tag}}
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_ACCESS_TOKEN}}
- name: Create Release
id: create_release
uses: softprops/action-gh-release@v1
with:
prerelease: "${{ steps.parse_tag.outputs.pre_release }}"
tag_name: "${{ steps.parse_tag.outputs.tag_name }}"
body: '<a href="https://github.com/charlzyx/pro.formily/blob/master/CHANGELOG.md">CHANGELOG</a>'

8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

|||
|--|--|
|@proformily/antd| [![version](https://badgen.net/npm/v/@proformily/antd)](https://www.npmjs.com/package/@proformily/antd) |
|@proformily/antd-v5| [![version](https://badgen.net/npm/v/@proformily/antd-v5)](https://www.npmjs.com/package/@proformily/antd-v5)|
|@pro.formily/antd| [![version](https://badgen.net/npm/v/@pro.formily/antd)](https://www.npmjs.com/package/@pro.formily/antd) |
|@pro.formily/antd-v5| [![version](https://badgen.net/npm/v/@pro.formily/antd-v5)](https://www.npmjs.com/package/@pro.formily/antd-v5)|

为 formily 宇宙添加的开箱即用的高级组件库, @formily/antd@4,5 双版本适配

Expand All @@ -15,9 +15,9 @@

## 在线文档地址

[for/antd@4](https://charlzyx.github.io/proformily/antd/)
[for/antd@4](https://charlzyx.github.io/pro.formily/antd/)

[for/antd@5](https://charlzyx.github.io/proformily/antd-v5/)
[for/antd@5](https://charlzyx.github.io/pro.formily/antd-v5/)


## powered by
Expand Down
Binary file modified bun.lockb
Binary file not shown.
8 changes: 6 additions & 2 deletions docs/_meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,14 @@
},
{
"text": "antd@4",
"link": "https://charlzyx.github.io/proformily/antd"
"link": "https://charlzyx.github.io/pro.formily/antd"
},
{
"text": "antd@5",
"link": "https://charlzyx.github.io/proformily/antd-v5"
"link": "https://charlzyx.github.io/pro.formily/antd-v5"
},
{
"text": "arco.design",
"link": "https://charlzyx.github.io/pro.formily/arco"
}
]
24 changes: 9 additions & 15 deletions docs/components/demos/DictDemo.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import { createForm } from "@formily/core";
import { FormProvider, createSchemaField } from "@formily/react";
import { Dict, dict, dictEffects, registerDictLoader } from "@pro.formily/antd";
import {
Checkbox,
FormGrid,
Expand All @@ -8,47 +11,38 @@ import {
Select,
Space,
} from "@formily/antd";
import { createForm } from "@formily/core";
import { FormProvider, createSchemaField } from "@formily/react";
import { Dict, dict, dictEffects, registerDictLoader } from "@proformily/antd";
import React, { useMemo } from "react";

const loaders = {
bool: () => {
registerDictLoader("bool", (convert) => {
registerDictLoader("bool", () => {
return Promise.resolve([
{ label: "是", value: 1, color: "success" },
{ label: "否", value: 0, color: "error" },
]).then((list) => {
return convert(list);
});
]);
});
},
status: () => {
registerDictLoader("status", (convert) => {
registerDictLoader("status", () => {
return Promise.resolve([
{ label: "已上线", value: 0, color: "success" },
{ label: "运行中", value: 1, color: "processing" },
{ label: "关闭", value: 2, color: "default" },
{ label: "已宕机", value: 3, color: "error" },
{ label: "已超载", value: 4, color: "warning" },
]).then((list) => {
return convert(list);
});
]);
});
},
classify: () => {
registerDictLoader("classify", (convert) => {
registerDictLoader("classify", () => {
return Promise.resolve([
{ label: "文艺", value: 0 },
{ label: "喜剧", value: 1 },
{ label: "爱情", value: 2 },
{ label: "动画", value: 3 },
{ label: "悬疑", value: 4 },
{ label: "科幻", value: 5 },
]).then((list) => {
return convert(list);
});
]);
});
},
};
Expand Down
2 changes: 1 addition & 1 deletion docs/components/demos/ImageView.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ImageView } from "@proformily/antd";
import { Divider } from "antd";
import { ImageView } from "@pro.formily/antd";
import React from "react";

const App = () => {
Expand Down
2 changes: 1 addition & 1 deletion docs/components/demos/Linkage.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Linkage } from "@proformily/antd";
import { Button, Divider, Space } from "antd";
import { Linkage } from "@pro.formily/antd";
import list from "china-location/dist/location.json";
import React, { useEffect, useState } from "react";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,27 +20,18 @@ import moment from "moment";
import "moment/locale/zh-cn";
moment.locale("zh-cn");

import {
ArrayTablePro,
useArrayCompPropsOf,
useFormArrayProps,
} from "@proformily/antd";
import { ProArrayTable } from "@pro.formily/antd";
import { useEffect } from "react";

const CustomeToolbar = () => {
const array = ArrayBase.useArray!();
const [, $row] = useArrayCompPropsOf(array?.field, "rowSelection");
const row = ProArrayTable.useTableRowSelection();
return (
<Space>
<Button
type="primary"
onClick={() => {
// ok
if (!array) return;
console.log(array.field.componentProps.rowSelection.selectedRowKeys);
if (!$row) return;
// but quick
console.log($row!.selectedRowKeys);
if (!row) return;
console.log(row.selectedRowKeys);
}}
>
自定义 toolbar , 点我试试
Expand All @@ -50,16 +41,14 @@ const CustomeToolbar = () => {
};
const CustomeFooter = () => {
const array = ArrayBase.useArray!();
const [, $page] = useArrayCompPropsOf(array?.field, "pagination");
console.log("🚀 ~ CustomeFooter ~ $page:", $page);
const totalPage =
$page === false
? 0
: (($page?.total || 0)! / ($page?.pageSize || 1)).toFixed(0);
const page = ProArrayTable.useTablePagination();
const totalPage = page
? ((page.total || 0)! / (page.pageSize || 1)).toFixed(0)
: 0;
return (
<Space>
自定义底部
{$page === false ? 0 : $page?.current}/{totalPage}, 共计
{!page ? 0 : page?.current}/{totalPage}, 共计
{array?.field?.value?.length}条数据
</Space>
);
Expand Down Expand Up @@ -87,7 +76,7 @@ const SchemaField = createSchemaField({
FormItem,
Editable,
Input,
ArrayTablePro: ArrayTablePro,
ProArrayTable,
// 组件名称必须包含 Toolbar
CustomeToolbar,
// 组件名称必须包含 Footer
Expand All @@ -113,29 +102,29 @@ const row: ISchema = {
properties: {
_sort: {
type: "void",
"x-component": "ArrayTablePro.Column",
"x-component": "ProArrayTable.Column",
"x-component-props": { width: 60, title: "Sort", align: "center" },
properties: {
sort: {
type: "void",
"x-component": "ArrayTablePro.SortHandle",
"x-component": "ProArrayTable.SortHandle",
},
},
},
_index: {
type: "void",
"x-component": "ArrayTablePro.Column",
"x-component": "ProArrayTable.Column",
"x-component-props": { width: 60, title: "Index", align: "center" },
properties: {
index: {
type: "void",
"x-component": "ArrayTablePro.Index",
"x-component": "ProArrayTable.Index",
},
},
},
_a1: {
type: "void",
"x-component": "ArrayTablePro.Column",
"x-component": "ProArrayTable.Column",
"x-component-props": { width: 160, title: "A1" },
properties: {
a1: {
Expand All @@ -147,7 +136,7 @@ const row: ISchema = {
},
_a2: {
type: "void",
"x-component": "ArrayTablePro.Column",
"x-component": "ProArrayTable.Column",
"x-component-props": { width: 160, title: "A2" },
properties: {
a2: {
Expand All @@ -159,7 +148,7 @@ const row: ISchema = {
},
_a3: {
type: "void",
"x-component": "ArrayTablePro.Column",
"x-component": "ProArrayTable.Column",
"x-component-props": { width: 160, title: "A3" },
properties: {
a3: {
Expand All @@ -171,7 +160,7 @@ const row: ISchema = {
},
_action: {
type: "void",
"x-component": "ArrayTablePro.Column",
"x-component": "ProArrayTable.Column",
"x-component-props": {
title: "Action",
width: 140,
Expand All @@ -185,15 +174,15 @@ const row: ISchema = {
properties: {
remove: {
type: "void",
"x-component": "ArrayTablePro.Remove",
"x-component": "ProArrayTable.Remove",
},
moveDown: {
type: "void",
"x-component": "ArrayTablePro.MoveDown",
"x-component": "ProArrayTable.MoveDown",
},
moveUp: {
type: "void",
"x-component": "ArrayTablePro.MoveUp",
"x-component": "ProArrayTable.MoveUp",
},
},
},
Expand All @@ -213,15 +202,15 @@ delete (subRow as any).items.properties._action;
...(row.items as any).properties,
_expand: {
type: "void",
"x-component": "ArrayTablePro.RowExpand",
"x-component": "ProArrayTable.RowExpand",
properties: {
summary: {
type: "void",
"x-component": "RowSummary",
},
subitems: {
type: "array",
"x-component": "ArrayTablePro",
"x-component": "ProArrayTable",
"x-read-pretty": true,
"x-component-props": {
showHeader: false,
Expand All @@ -240,9 +229,10 @@ const schema: ISchema = {
array: {
type: "array",
title: "Array Table Pro Max",
"x-component": "ArrayTablePro",
"x-component": "ProArrayTable",
"x-component-props": {
scroll: { x: "100%" },
resizeable: true,
rowSelection: true,
expandable: {
rowExpandable: (record: any) => Array.isArray(record.subitems),
Expand All @@ -256,7 +246,7 @@ const schema: ISchema = {
},
add: {
type: "void",
"x-component": "ArrayTablePro.Addition",
"x-component": "ProArrayTable.Addition",
title: "添加条目",
},
footer: {
Expand Down Expand Up @@ -290,7 +280,7 @@ const range = (count: number) =>

export default () => {
console.log("form", form);
const [row, $row] = useFormArrayProps(form, "array", "rowSelection");
// const [row, $row] = useFormArrayProps(form, "array", "rowSelection");
useEffect(() => {
console.log("row is change ", row);
}, [row]);
Expand All @@ -305,7 +295,7 @@ export default () => {
</FormButtonGroup>
</Divider>
<Space>
<Button
{/* <Button
onClick={() => {
// simple way
const hasIndex =
Expand All @@ -327,11 +317,12 @@ export default () => {
}}
>
切换第三项选中框
</Button>
</Button> */}
<Button
onClick={() => {
form.setInitialValues({
array: range(10 * 10000),
// array: range(10 * 10000),
array: range(10 * 10),
});
}}
>
Expand Down
Loading

0 comments on commit 8d3911b

Please sign in to comment.