Commit 9b3fb762 authored by chareice's avatar chareice
Browse files

chore: client export

parent bf9cc35e
Showing with 139 additions and 113 deletions
+139 -113
......@@ -12,6 +12,7 @@
"module": "es/index.js",
"typings": "es/index.d.ts",
"dependencies": {
"@ant-design/icons": "^4.7.0",
"@antv/g2plot": "^2.4.18",
"@dnd-kit/core": "^5.0.1",
"@dnd-kit/sortable": "^6.0.0",
......@@ -19,6 +20,7 @@
"@formily/antd": "2.0.20",
"@formily/core": "2.0.20",
"@formily/react": "2.0.20",
"@formily/shared": "^2.2.10",
"@nocobase/sdk": "0.8.0-alpha.1",
"@nocobase/utils": "0.8.0-alpha.1",
"ahooks": "^3.0.5",
......
import 'antd/dist/antd.css';
import './global.less';
export * as reactI18nNext from 'react-i18next';
export * as antd from 'antd';
export * as formilyReact from '@formily/react';
export * as antdIcons from '@ant-design/icons';
export * as emotionCss from '@emotion/css';
export * from './acl';
export * from './antd-config-provider';
......@@ -25,4 +30,3 @@ export * from './schema-templates';
export * from './settings-form';
export * from './system-settings';
export * from './user';
......@@ -10,21 +10,22 @@
}
],
"dependencies": {
"@nocobase/actions": "0.8.0-alpha.1",
"@nocobase/client": "0.8.0-alpha.1",
"@nocobase/database": "0.8.0-alpha.1",
"@nocobase/server": "0.8.0-alpha.1",
"@nocobase/utils": "0.8.0-alpha.1",
"@nocobase/actions": "workspace:*",
"@nocobase/client": "workspace:*",
"@nocobase/database": "workspace:*",
"@nocobase/server": "workspace:*",
"@nocobase/utils": "workspace:*",
"classnames": "^2.3.1",
"cron-parser": "4.4.0",
"json-templates": "^4.2.0",
"koa-compose": "^4.1.0",
"lodash": "^4.17.21",
"moment": "2.x",
"react-js-cron": "^1.4.0",
"sequelize": "^6.25.3"
},
"devDependencies": {
"@nocobase/test": "0.8.0-alpha.1"
"@nocobase/test": "workspace:*"
},
"gitHead": "b17d1ecae5dd0b9d4e7170dcf9663bb225598990"
}
import React from "react";
import { observer, useForm } from "@formily/react";
import { Select } from "antd";
import { useTranslation } from "react-i18next";
import React from 'react';
import { emotionCss, formilyReact, reactI18nNext, antd } from '@nocobase/client';
import { useCollectionManager, useCompile } from "@nocobase/client";
const { Select } = antd;
const { observer, useForm } = formilyReact;
const { useTranslation } = reactI18nNext;
import { useCollectionManager, useCompile } from '@nocobase/client';
export const DateFieldsSelect: React.FC<any> = observer((props) => {
const { t } = useTranslation();
......@@ -13,17 +15,13 @@ export const DateFieldsSelect: React.FC<any> = observer((props) => {
const fields = getCollectionFields(values?.config?.collection);
return (
<Select
placeholder={t('Select Field')}
{...props}
>
<Select placeholder={t('Select Field')} {...props}>
{fields
.filter(field => (
!field.hidden
&& (field.uiSchema ? field.type === 'date' : false)
))
.map(field => (
<Select.Option key={field.name} value={field.name}>{compile(field.uiSchema?.title)}</Select.Option>
.filter((field) => !field.hidden && (field.uiSchema ? field.type === 'date' : false))
.map((field) => (
<Select.Option key={field.name} value={field.name}>
{compile(field.uiSchema?.title)}
</Select.Option>
))}
</Select>
);
......
import { css } from "@emotion/css";
import { DatePicker, Select } from "antd";
import moment from "moment";
import React, { useState } from "react";
import { useTranslation } from "react-i18next";
import { OnField } from "./OnField";
import { emotionCss, antd, reactI18nNext } from '@nocobase/client';
const { css } = emotionCss;
const { useTranslation } = reactI18nNext;
import { DatePicker, Select } from 'antd';
import moment from 'moment';
import React, { useState } from 'react';
import { OnField } from './OnField';
export function EndsByField({ value, onChange }) {
const { t } = useTranslation();
const [type, setType] = useState(typeof value === 'object' && !(value instanceof Date) ? 'field' : 'date');
return (
<fieldset className={css`
display: flex;
gap: .5em;
`}>
<Select value={type} onChange={t => {
onChange(t === 'field' ? {} : null);
setType(t);
}}>
<fieldset
className={css`
display: flex;
gap: 0.5em;
`}
>
<Select
value={type}
onChange={(t) => {
onChange(t === 'field' ? {} : null);
setType(t);
}}
>
<Select.Option value={'field'}>{t('By field')}</Select.Option>
<Select.Option value={'date'}>{t('By custom date')}</Select.Option>
</Select>
{type === 'field'
? <OnField value={value} onChange={onChange} />
: <DatePicker showTime value={moment(value)} onChange={onChange} />
}
{type === 'field' ? (
<OnField value={value} onChange={onChange} />
) : (
<DatePicker showTime value={moment(value)} onChange={onChange} />
)}
</fieldset>
);
}
import React, { useState } from "react";
import { css } from "@emotion/css";
import { InputNumber, Select } from "antd";
import { useTranslation } from "react-i18next";
import { DateFieldsSelect } from "./DateFieldsSelect";
import { emotionCss, antd, reactI18nNext } from '@nocobase/client';
const { css } = emotionCss;
const { useTranslation } = reactI18nNext;
import React, { useState } from 'react';
const { InputNumber, Select } = antd;
import { DateFieldsSelect } from './DateFieldsSelect';
export function OnField({ value, onChange }) {
const { t } = useTranslation();
const [dir, setDir] = useState(value.offset ? value.offset / Math.abs(value.offset) : 0);
return (
<fieldset className={css`
display: flex;
gap: .5em;
`}>
<DateFieldsSelect value={value.field} onChange={field => onChange({ ...value, field })} />
{value.field
? (
<Select value={dir} onChange={(v) => {
<fieldset
className={css`
display: flex;
gap: 0.5em;
`}
>
<DateFieldsSelect value={value.field} onChange={(field) => onChange({ ...value, field })} />
{value.field ? (
<Select
value={dir}
onChange={(v) => {
setDir(v);
onChange({ ...value, offset: Math.abs(value.offset) * v });
}}>
<Select.Option value={0}>{t('Exactly at')}</Select.Option>
<Select.Option value={-1}>{t('Before')}</Select.Option>
<Select.Option value={1}>{t('After')}</Select.Option>
}}
>
<Select.Option value={0}>{t('Exactly at')}</Select.Option>
<Select.Option value={-1}>{t('Before')}</Select.Option>
<Select.Option value={1}>{t('After')}</Select.Option>
</Select>
) : null}
{dir ? (
<>
<InputNumber value={Math.abs(value.offset)} onChange={(v) => onChange({ ...value, offset: v * dir })} />
<Select value={value.unit || 86400000} onChange={(unit) => onChange({ ...value, unit })}>
<Select.Option value={86400000}>{t('Days')}</Select.Option>
<Select.Option value={3600000}>{t('Hours')}</Select.Option>
<Select.Option value={60000}>{t('Minutes')}</Select.Option>
<Select.Option value={1000}>{t('Seconds')}</Select.Option>
</Select>
)
: null}
{dir
? (
<>
<InputNumber value={Math.abs(value.offset)} onChange={(v) => onChange({ ...value, offset: v * dir })}/>
<Select value={value.unit || 86400000} onChange={unit => onChange({ ...value, unit })}>
<Select.Option value={86400000}>{t('Days')}</Select.Option>
<Select.Option value={3600000}>{t('Hours')}</Select.Option>
<Select.Option value={60000}>{t('Minutes')}</Select.Option>
<Select.Option value={1000}>{t('Seconds')}</Select.Option>
</Select>
</>
)
: null}
</>
) : null}
</fieldset>
);
}
import { TableOutlined } from '@ant-design/icons';
import { SchemaComponentOptions, SchemaInitializer, SchemaInitializerContext } from '@nocobase/client';
import {
SchemaComponentOptions,
SchemaInitializer,
SchemaInitializerContext,
reactI18nNext,
antdIcons,
} from '@nocobase/client';
import React, { useContext } from 'react';
import { useTranslation } from 'react-i18next';
const { useTranslation } = reactI18nNext;
const { TableOutlined } = antdIcons;
import { HelloDesigner } from './HelloDesigner';
export const HelloBlockInitializer = (props) => {
......
......@@ -3,9 +3,9 @@
"version": "0.8.0-alpha.1",
"main": "lib/server/index.js",
"devDependencies": {
"@nocobase/client": "0.8.0-alpha.1",
"@nocobase/server": "0.8.0-alpha.1",
"@nocobase/test": "0.8.0-alpha.1"
"@nocobase/client": "workspace:*",
"@nocobase/server": "workspace:*",
"@nocobase/test": "workspace:*"
},
"peerDependencies": {
"@nocobase/client": "*",
......
import { useFieldSchema } from '@formily/react';
import {
GeneralSchemaDesigner,
SchemaSettings,
useCollection
} from '@nocobase/client';
import { formilyReact } from '@nocobase/client';
const { useFieldSchema } = formilyReact;
import { GeneralSchemaDesigner, SchemaSettings, useCollection } from '@nocobase/client';
import React from 'react';
export const HelloDesigner = () => {
......
import { TableOutlined } from '@ant-design/icons';
const { TableOutlined } = antdIcons;
import {
SchemaComponentOptions,
SchemaInitializer,
SchemaInitializerContext, SettingsCenterProvider
SchemaInitializerContext,
SettingsCenterProvider,
reactI18nNext,
antdIcons,
} from '@nocobase/client';
import { Card } from 'antd';
import React, { useContext } from 'react';
import { useTranslation } from 'react-i18next';
import { HelloDesigner } from './HelloDesigner';
const { useTranslation } = reactI18nNext;
export const HelloBlockInitializer = (props) => {
const { insert } = props;
const { t } = useTranslation();
......
......@@ -6,9 +6,9 @@
"nodejs-snowflake": "2.0.1"
},
"devDependencies": {
"@nocobase/client": "0.8.0-alpha.1",
"@nocobase/server": "0.8.0-alpha.1",
"@nocobase/test": "0.8.0-alpha.1"
"@nocobase/client": "workspace:*",
"@nocobase/server": "workspace:*",
"@nocobase/test": "workspace:*"
},
"peerDependencies": {
"@nocobase/client": "*",
......
import React from 'react';
import { Select } from 'antd';
import { i18n } from '@nocobase/client';
import { useTranslation } from 'react-i18next';
import { i18n, reactI18nNext } from '@nocobase/client';
const { useTranslation } = reactI18nNext;
i18n.addResources('zh-CN', '@nocobase/plugin-sample-shop-i18n', {
Pending: '已下单',
Paid: '已支付',
Delivered: '已发货',
Received: '已签收'
Received: '已签收',
});
const ORDER_STATUS_LIST = [
......@@ -17,14 +16,14 @@ const ORDER_STATUS_LIST = [
{ value: 1, label: 'Paid' },
{ value: 2, label: 'Delivered' },
{ value: 3, label: 'Received' },
]
];
function OrderStatusSelect() {
const { t } = useTranslation('@nocobase/plugin-sample-shop-i18n');
return (
<Select style={{ minWidth: '8em' }}>
{ORDER_STATUS_LIST.map(item => (
{ORDER_STATUS_LIST.map((item) => (
<Select.Option value={item.value}>{t(item.label)}</Select.Option>
))}
</Select>
......
......@@ -247,6 +247,7 @@ importers:
 
packages/core/client:
specifiers:
'@ant-design/icons': ^4.7.0
'@antv/g2plot': ^2.4.18
'@dnd-kit/core': ^5.0.1
'@dnd-kit/sortable': ^6.0.0
......@@ -254,6 +255,7 @@ importers:
'@formily/antd': 2.0.20
'@formily/core': 2.0.20
'@formily/react': 2.0.20
'@formily/shared': ^2.2.10
'@nocobase/sdk': 0.8.0-alpha.1
'@nocobase/utils': 0.8.0-alpha.1
'@testing-library/react': ^12.1.2
......@@ -285,13 +287,15 @@ importers:
solarlunar-es: ^1.0.9
use-deep-compare-effect: ^1.8.1
dependencies:
'@ant-design/icons': 4.7.0
'@antv/g2plot': 2.4.20
'@dnd-kit/core': 5.0.3
'@dnd-kit/sortable': 6.0.1_@dnd-kit+core@5.0.3
'@emotion/css': 11.10.5
'@formily/antd': 2.0.20_antd@4.19.5
'@formily/antd': 2.0.20_ygohokjero4g4tajqgx7qfgc4m
'@formily/core': 2.0.20
'@formily/react': 2.0.20
'@formily/shared': 2.2.10
'@nocobase/sdk': link:../sdk
'@nocobase/utils': link:../utils
ahooks: 3.7.2
......@@ -834,17 +838,18 @@ importers:
 
packages/plugins/workflow:
specifiers:
'@nocobase/actions': 0.8.0-alpha.1
'@nocobase/client': 0.8.0-alpha.1
'@nocobase/database': 0.8.0-alpha.1
'@nocobase/server': 0.8.0-alpha.1
'@nocobase/test': 0.8.0-alpha.1
'@nocobase/utils': 0.8.0-alpha.1
'@nocobase/actions': workspace:*
'@nocobase/client': workspace:*
'@nocobase/database': workspace:*
'@nocobase/server': workspace:*
'@nocobase/test': workspace:*
'@nocobase/utils': workspace:*
classnames: ^2.3.1
cron-parser: 4.4.0
json-templates: ^4.2.0
koa-compose: ^4.1.0
lodash: ^4.17.21
moment: 2.x
react-js-cron: ^1.4.0
sequelize: ^6.25.3
dependencies:
......@@ -858,6 +863,7 @@ importers:
json-templates: 4.2.0
koa-compose: 4.1.0
lodash: 4.17.21
moment: 2.29.4
react-js-cron: 1.4.0
sequelize: 6.25.3
devDependencies:
......@@ -959,9 +965,9 @@ importers:
 
packages/samples/hello:
specifiers:
'@nocobase/client': 0.8.0-alpha.1
'@nocobase/server': 0.8.0-alpha.1
'@nocobase/test': 0.8.0-alpha.1
'@nocobase/client': workspace:*
'@nocobase/server': workspace:*
'@nocobase/test': workspace:*
devDependencies:
'@nocobase/client': link:../../core/client
'@nocobase/server': link:../../core/server
......@@ -1002,9 +1008,9 @@ importers:
 
packages/samples/shop-i18n:
specifiers:
'@nocobase/client': 0.8.0-alpha.1
'@nocobase/server': 0.8.0-alpha.1
'@nocobase/test': 0.8.0-alpha.1
'@nocobase/client': workspace:*
'@nocobase/server': workspace:*
'@nocobase/test': workspace:*
nodejs-snowflake: 2.0.1
dependencies:
nodejs-snowflake: 2.0.1
......@@ -4791,7 +4797,7 @@ packages:
- supports-color
dev: false
 
/@formily/antd/2.0.20_antd@4.19.5:
/@formily/antd/2.0.20_ygohokjero4g4tajqgx7qfgc4m:
resolution: {integrity: sha512-bUfbuqFJXTrkLNh8op2aeByQH+uBwoC1o9RU78INJ8G9DWqh7j27aMo/BWeTMgxZo6PvTDlPShzGh2lG12EQ/Q==}
engines: {npm: '>=3.0.0'}
peerDependencies:
......@@ -4808,6 +4814,7 @@ packages:
'@types/react-dom':
optional: true
dependencies:
'@ant-design/icons': 4.7.0
'@formily/core': 2.0.20
'@formily/grid': 2.0.20
'@formily/json-schema': 2.0.20
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment