From 09159f029652235112df91eae3a48cf78c2c749f Mon Sep 17 00:00:00 2001 From: ChengLei Shao Date: Fri, 16 Aug 2024 13:35:13 +0800 Subject: [PATCH 01/13] chore: upgrade mysql2 version (#5070) --- .../plugin-multi-app-manager/package.json | 2 +- yarn.lock | 28 ++++++++++++++++--- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/packages/plugins/@nocobase/plugin-multi-app-manager/package.json b/packages/plugins/@nocobase/plugin-multi-app-manager/package.json index b332a48eb2..6b53a0024d 100644 --- a/packages/plugins/@nocobase/plugin-multi-app-manager/package.json +++ b/packages/plugins/@nocobase/plugin-multi-app-manager/package.json @@ -15,7 +15,7 @@ "antd": "5.x", "antd-style": "3.x", "async-mutex": "^0.3.2", - "mysql2": "^2.3.3", + "mysql2": "^3.11.0", "pg": "^8.7.3", "react": "18.x", "react-i18next": "^11.15.1", diff --git a/yarn.lock b/yarn.lock index 02230c094c..e73056cc50 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9043,6 +9043,11 @@ aws-sign2@~0.7.0: resolved "https://registry.npmmirror.com/aws-sign2/-/aws-sign2-0.7.0.tgz#b46e890934a9591f2d2f6f86d7e6a9f1b3fe76a8" integrity sha512-08kcGqnYf/YmjoRhfxyu+CLxBjUtHLXLXX/vUfx9l2LYzG3c1m61nrpyFUZI6zeS+Li/wWMMidD9KgrqtGq3mA== +aws-ssl-profiles@^1.1.1: + version "1.1.1" + resolved "https://registry.npmmirror.com/aws-ssl-profiles/-/aws-ssl-profiles-1.1.1.tgz#21ef8ad77d753927f6c01b144c5ef4cc4f150cdc" + integrity sha512-+H+kuK34PfMaI9PNU/NSjBKL5hh/KDM9J72kwYeYEm0A8B1AC4fuCy3qsjnA7lxklgyXsB68yn8Z2xoZEjgwCQ== + aws4@^1.8.0: version "1.12.0" resolved "https://registry.npmmirror.com/aws4/-/aws4-1.12.0.tgz#ce1c9d143389679e253b314241ea9aa5cec980d3" @@ -12140,7 +12145,7 @@ delegates@^1.0.0: resolved "https://registry.npmmirror.com/delegates/-/delegates-1.0.0.tgz#84c6e159b81904fdca59a0ef44cd870d31250f9a" integrity sha512-bd2L678uiWATM6m5Z1VzNCErI3jiGzt6HGY8OVICs40JQq/HALfbyNJmp0UDakEY4pMMaN0Ly5om/B1VI/+xfQ== -denque@^2.0.1: +denque@^2.0.1, denque@^2.1.0: version "2.1.0" resolved "https://registry.npmmirror.com/denque/-/denque-2.1.0.tgz#e93e1a6569fb5e66f16a3c2a2964617d349d6ab1" integrity sha512-HVQE3AAb/pxF8fQAoiqpvg9i3evqug3hoiwakOyZAwJm+6vZehbkYXZ0l4JxS+I3QxM97v5aaRNhj8v5oBhekw== @@ -17790,7 +17795,7 @@ long@^4.0.0: resolved "https://registry.npmmirror.com/long/-/long-4.0.0.tgz#9a7b71cfb7d361a194ea555241c92f7468d5bf28" integrity sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA== -long@^5.2.0: +long@^5.2.0, long@^5.2.1: version "5.2.3" resolved "https://registry.npmmirror.com/long/-/long-5.2.3.tgz#a3ba97f3877cf1d778eccbcb048525ebb77499e1" integrity sha512-lcHwpNoggQTObv5apGNCTdJrO69eHOZMi4BNC+rTLER8iHAqGrUVeLh/irVIM7zTw2bOXA8T6uNPeujwOLg/2Q== @@ -17843,7 +17848,7 @@ lru-cache@6.0.0, lru-cache@^6.0.0: dependencies: yallist "^4.0.0" -lru-cache@8.0.5: +lru-cache@8.0.5, lru-cache@^8.0.0: version "8.0.5" resolved "https://registry.npmmirror.com/lru-cache/-/lru-cache-8.0.5.tgz#983fe337f3e176667f8e567cfcce7cb064ea214e" integrity sha512-MhWWlVnuab1RG5/zMRRcVGXZLCXrZTgfwMikgzCegsPnG62yDQo5JnqKkrK4jO5iKqDAZGItAqN5CtKBCBWRUA== @@ -19251,6 +19256,21 @@ mysql2@^2.3.3: seq-queue "^0.0.5" sqlstring "^2.3.2" +mysql2@^3.11.0: + version "3.11.0" + resolved "https://registry.npmmirror.com/mysql2/-/mysql2-3.11.0.tgz#2a7bd7c615ab43f8167ed9922063b968f3e48f33" + integrity sha512-J9phbsXGvTOcRVPR95YedzVSxJecpW5A5+cQ57rhHIFXteTP10HCs+VBjS7DHIKfEaI1zQ5tlVrquCd64A6YvA== + dependencies: + aws-ssl-profiles "^1.1.1" + denque "^2.1.0" + generate-function "^2.3.1" + iconv-lite "^0.6.3" + long "^5.2.1" + lru-cache "^8.0.0" + named-placeholders "^1.1.3" + seq-queue "^0.0.5" + sqlstring "^2.3.2" + mz@^2.7.0: version "2.7.0" resolved "https://registry.npmmirror.com/mz/-/mz-2.7.0.tgz#95008057a56cafadc2bc63dde7f9ff6955948e32" @@ -19260,7 +19280,7 @@ mz@^2.7.0: object-assign "^4.0.1" thenify-all "^1.0.0" -named-placeholders@^1.1.2: +named-placeholders@^1.1.2, named-placeholders@^1.1.3: version "1.1.3" resolved "https://registry.npmmirror.com/named-placeholders/-/named-placeholders-1.1.3.tgz#df595799a36654da55dda6152ba7a137ad1d9351" integrity sha512-eLoBxg6wE/rZkJPhU/xRX1WTpkFEwDJEN96oxFrTsqBdbT5ec295Q+CoHrL9IT0DipqKhmGcaZmwOt8OON5x1w== From e245da8f29b23a288c15a6d2d2477fa754c18426 Mon Sep 17 00:00:00 2001 From: Junyi Date: Fri, 16 Aug 2024 15:47:51 +0800 Subject: [PATCH 02/13] refactor(plugin-workflow): add calculation nodes group (#5035) --- .../src/client/DynamicCalculation.tsx | 4 ++-- .../plugin-workflow-dynamic-calculation/src/locale/zh-CN.json | 2 +- .../@nocobase/plugin-workflow/src/client/AddButton.tsx | 1 + .../plugin-workflow/src/client/nodes/calculation.tsx | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/plugins/@nocobase/plugin-workflow-dynamic-calculation/src/client/DynamicCalculation.tsx b/packages/plugins/@nocobase/plugin-workflow-dynamic-calculation/src/client/DynamicCalculation.tsx index a5569fd2b7..a5c0dc293f 100644 --- a/packages/plugins/@nocobase/plugin-workflow-dynamic-calculation/src/client/DynamicCalculation.tsx +++ b/packages/plugins/@nocobase/plugin-workflow-dynamic-calculation/src/client/DynamicCalculation.tsx @@ -43,9 +43,9 @@ function DynamicExpression({ value, onChange }) { } export default class extends Instruction { - title = `{{t("Dynamic Calculation", { ns: "${NAMESPACE}" })}}`; + title = `{{t("Dynamic expression calculation", { ns: "${NAMESPACE}" })}}`; type = 'dynamic-calculation'; - group = 'extended'; + group = 'calculation'; description = `{{t("Calculate an expression based on a calculation engine and obtain a value as the result. Variables in the upstream nodes can be used in the expression. The expression is dynamic one from an expression collections.", { ns: "${NAMESPACE}" })}}`; fieldset = { expression: { diff --git a/packages/plugins/@nocobase/plugin-workflow-dynamic-calculation/src/locale/zh-CN.json b/packages/plugins/@nocobase/plugin-workflow-dynamic-calculation/src/locale/zh-CN.json index 8c47d4fa51..a0ad3e030c 100644 --- a/packages/plugins/@nocobase/plugin-workflow-dynamic-calculation/src/locale/zh-CN.json +++ b/packages/plugins/@nocobase/plugin-workflow-dynamic-calculation/src/locale/zh-CN.json @@ -1,6 +1,6 @@ { "Expression": "表达式", - "Dynamic Calculation": "动态表达式计算", + "Dynamic expression calculation": "动态表达式计算", "Calculate an expression based on a calculation engine and obtain a value as the result. Variables in the upstream nodes can be used in the expression. The expression is dynamic one from an expression collections.": "基于计算引擎计算表达式并获取值作为结果。可以在表达式中使用上游节点的变量。表达式是从表达式表中动态获取的。", "Select dynamic expression": "选择动态表达式", "Select the dynamic expression queried from the upstream node. You need to query it from an expression collection.": "从上游节点中选择查询出来的动态表达式。你需要从动态表达式类型的数据表中查询。", diff --git a/packages/plugins/@nocobase/plugin-workflow/src/client/AddButton.tsx b/packages/plugins/@nocobase/plugin-workflow/src/client/AddButton.tsx index 594ebca815..c3a6d6d657 100644 --- a/packages/plugins/@nocobase/plugin-workflow/src/client/AddButton.tsx +++ b/packages/plugins/@nocobase/plugin-workflow/src/client/AddButton.tsx @@ -38,6 +38,7 @@ export function AddButton(props: AddButtonProps) { const groups = useMemo(() => { return [ { key: 'control', label: `{{t("Control", { ns: "${NAMESPACE}" })}}` }, + { key: 'calculation', label: `{{t("Calculation", { ns: "${NAMESPACE}" })}}` }, { key: 'collection', label: `{{t("Collection operations", { ns: "${NAMESPACE}" })}}` }, { key: 'manual', label: `{{t("Manual", { ns: "${NAMESPACE}" })}}` }, { key: 'extended', label: `{{t("Extended types", { ns: "${NAMESPACE}" })}}` }, diff --git a/packages/plugins/@nocobase/plugin-workflow/src/client/nodes/calculation.tsx b/packages/plugins/@nocobase/plugin-workflow/src/client/nodes/calculation.tsx index e8636033eb..e083a69f43 100644 --- a/packages/plugins/@nocobase/plugin-workflow/src/client/nodes/calculation.tsx +++ b/packages/plugins/@nocobase/plugin-workflow/src/client/nodes/calculation.tsx @@ -20,7 +20,7 @@ import { Instruction } from '.'; export default class extends Instruction { title = `{{t("Calculation", { ns: "${NAMESPACE}" })}}`; type = 'calculation'; - group = 'control'; + group = 'calculation'; description = `{{t("Calculate an expression based on a calculation engine and obtain a value as the result. Variables in the upstream nodes can be used in the expression.", { ns: "${NAMESPACE}" })}}`; fieldset = { engine: { From b9d1604eb8b016b4357a7a09d5dfd0479cafc25d Mon Sep 17 00:00:00 2001 From: YANG QIA <2013xile@gmail.com> Date: Fri, 16 Aug 2024 15:50:02 +0800 Subject: [PATCH 03/13] feat(data-vi): allow to set link for statistic chart (#5073) --- .../chart/antd/components/Statistic.tsx | 29 +++++++++++++++++++ .../src/client/chart/antd/statistic.ts | 12 ++++++-- 2 files changed, 39 insertions(+), 2 deletions(-) create mode 100644 packages/plugins/@nocobase/plugin-data-visualization/src/client/chart/antd/components/Statistic.tsx diff --git a/packages/plugins/@nocobase/plugin-data-visualization/src/client/chart/antd/components/Statistic.tsx b/packages/plugins/@nocobase/plugin-data-visualization/src/client/chart/antd/components/Statistic.tsx new file mode 100644 index 0000000000..f0ef40929f --- /dev/null +++ b/packages/plugins/@nocobase/plugin-data-visualization/src/client/chart/antd/components/Statistic.tsx @@ -0,0 +1,29 @@ +/** + * This file is part of the NocoBase (R) project. + * Copyright (c) 2020-2024 NocoBase Co., Ltd. + * Authors: NocoBase Team. + * + * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License. + * For more information, please refer to: https://www.nocobase.com/agreement. + */ + +import React from 'react'; +import { Statistic as AntdStatistic } from 'antd'; + +export const Statistic: React.FC = (props: any) => { + const { link, ...options } = props; + return ( +
{ + if (link) { + window.open(link, '__blank'); + } + }} + style={{ + cursor: link ? 'pointer' : 'auto', + }} + > + +
+ ); +}; diff --git a/packages/plugins/@nocobase/plugin-data-visualization/src/client/chart/antd/statistic.ts b/packages/plugins/@nocobase/plugin-data-visualization/src/client/chart/antd/statistic.ts index 0e43338944..12eb95e32c 100644 --- a/packages/plugins/@nocobase/plugin-data-visualization/src/client/chart/antd/statistic.ts +++ b/packages/plugins/@nocobase/plugin-data-visualization/src/client/chart/antd/statistic.ts @@ -8,16 +8,16 @@ */ import { AntdChart } from './antd'; -import { Statistic as AntdStatistic } from 'antd'; import { lang } from '../../locale'; import { ChartType, RenderProps } from '../chart'; +import { Statistic as C } from './components/Statistic'; export class Statistic extends AntdChart { constructor() { super({ name: 'statistic', title: 'Statistic', - Component: AntdStatistic, + Component: C, config: [ { property: 'field', @@ -33,6 +33,14 @@ export class Statistic extends AntdChart { 'x-component': 'Input', }, }, + { + link: { + title: lang('Link'), + type: 'string', + 'x-decorator': 'FormItem', + 'x-component': 'Input', + }, + }, ], }); } From 7cf2c6add597f48d970ab15b0926b1cc12bf759e Mon Sep 17 00:00:00 2001 From: Katherine Date: Fri, 16 Aug 2024 16:36:11 +0800 Subject: [PATCH 04/13] fix: the display of data source status (#5069) * fix: the display of data source status * fix: bug --- .../src/client/component/BreadcumbTitle.tsx | 5 ++++- .../component/CollectionsManager/ConfigurationTable.tsx | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/plugins/@nocobase/plugin-data-source-manager/src/client/component/BreadcumbTitle.tsx b/packages/plugins/@nocobase/plugin-data-source-manager/src/client/component/BreadcumbTitle.tsx index 9391208a84..7c32fe3d0b 100644 --- a/packages/plugins/@nocobase/plugin-data-source-manager/src/client/component/BreadcumbTitle.tsx +++ b/packages/plugins/@nocobase/plugin-data-source-manager/src/client/component/BreadcumbTitle.tsx @@ -23,7 +23,10 @@ export const BreadcumbTitle = () => { const dm = useDataSourceManager(); const { displayName } = dm.getDataSource(name) || {}; const { dataSource } = useContext(DataSourceContext); - const dataSourceValue = useMemo(() => dataSource || dm.getDataSource(name), [dataSource, name]); + const dataSourceValue = useMemo( + () => (dataSource && dataSource?.name === name ? dataSource : dm.getDataSource(name)), + [dataSource, name], + ); const items = useMemo(() => { const status = dataSourceValue?.status; const option = statusEnum.find((v) => v.value === status); diff --git a/packages/plugins/@nocobase/plugin-data-source-manager/src/client/component/CollectionsManager/ConfigurationTable.tsx b/packages/plugins/@nocobase/plugin-data-source-manager/src/client/component/CollectionsManager/ConfigurationTable.tsx index 57fac41ec4..30e9c6416d 100644 --- a/packages/plugins/@nocobase/plugin-data-source-manager/src/client/component/CollectionsManager/ConfigurationTable.tsx +++ b/packages/plugins/@nocobase/plugin-data-source-manager/src/client/component/CollectionsManager/ConfigurationTable.tsx @@ -148,7 +148,7 @@ export const ConfigurationTable = () => { method: 'post', }); field.data.loading = false; - setDataSource(data?.data); + setDataSource({ ...data?.data, name }); if (data?.data?.status === 'reloading') { message.warning(t('Data source synchronization in progress')); } else if (data?.data?.status === 'loaded') { From e232ed75827cd76778ce796f04e60f58ada581a9 Mon Sep 17 00:00:00 2001 From: Katherine Date: Fri, 16 Aug 2024 16:50:51 +0800 Subject: [PATCH 05/13] refactor: datetime field support timezone, defaultToCurrentTime, and onUpdateToCurrentTime (#5012) * refactor: date field support timezone, defaultToCurrentTime, and onUpdateToCurrentTime * refactor: availableTypes unixTimestamp * chore: defaultToCurrentTime * chore: unix timestamp field * fix: bug * chore: field type map * refactor: local improve * fix: bug * fix: bug * chore: timezone test * chore: test * fix: test * fix: test * chore: field setter * chore: test * chore: date only field * chore: test * chore: test * fix: bug * fix: unixTimestamp * fix: unixTimestamp * chore: accuracy * fix: bug * fix: bug * fix: unixTimestamp * fix: unixTimestamp * fix: date & datetime * refactor: add DateFieldInterface * fix: bug * chore: test * chore: test * chore: test * refactor: locale improve * refactor: local improve * fix: bug * refactor: unixTimestamp not support default value --------- Co-authored-by: Chareice --- .../collection-manager/collectionPlugin.ts | 2 + .../interfaces/components/index.tsx | 38 ++++- .../src/collection-manager/interfaces/date.ts | 60 ++++++++ .../collection-manager/interfaces/datetime.ts | 3 + .../collection-manager/interfaces/index.ts | 1 + .../interfaces/properties/index.ts | 44 +++++- .../interfaces/unixTimestamp.tsx | 54 ++++++- packages/core/client/src/locale/zh-CN.json | 7 +- .../schema-component/antd/date-picker/util.ts | 9 +- .../antd/unix-timestamp/UnixTimestamp.tsx | 41 +----- .../__tests__/UnixTimestamp.test.tsx | 78 +--------- .../src/__tests__/fields/date-only.test.ts | 42 ++++++ .../src/__tests__/fields/date.test.ts | 137 +++++++++++++++++- .../fields/unix-timestamp-field.tests.ts | 86 +++++++++++ packages/core/database/src/database.ts | 8 +- .../core/database/src/fields/date-field.ts | 68 ++++++++- .../database/src/fields/date-only-field.ts | 21 +++ packages/core/database/src/fields/field.ts | 8 +- packages/core/database/src/fields/index.ts | 6 + .../src/fields/unix-timestamp-field.ts | 60 ++++++++ packages/core/database/src/model.ts | 20 ++- packages/core/database/src/repository.ts | 4 +- .../core/database/src/view/field-type-map.ts | 14 +- packages/core/server/src/application.ts | 21 +-- 24 files changed, 674 insertions(+), 158 deletions(-) create mode 100644 packages/core/client/src/collection-manager/interfaces/date.ts create mode 100644 packages/core/database/src/__tests__/fields/date-only.test.ts create mode 100644 packages/core/database/src/__tests__/fields/unix-timestamp-field.tests.ts create mode 100644 packages/core/database/src/fields/date-only-field.ts create mode 100644 packages/core/database/src/fields/unix-timestamp-field.ts diff --git a/packages/core/client/src/collection-manager/collectionPlugin.ts b/packages/core/client/src/collection-manager/collectionPlugin.ts index 8d71266aaa..270393cf9d 100644 --- a/packages/core/client/src/collection-manager/collectionPlugin.ts +++ b/packages/core/client/src/collection-manager/collectionPlugin.ts @@ -52,6 +52,7 @@ import { UUIDFieldInterface, NanoidFieldInterface, UnixTimestampFieldInterface, + DateFieldInterface, } from './interfaces'; import { GeneralCollectionTemplate, @@ -173,6 +174,7 @@ export class CollectionPlugin extends Plugin { UUIDFieldInterface, NanoidFieldInterface, UnixTimestampFieldInterface, + DateFieldInterface, ]); } diff --git a/packages/core/client/src/collection-manager/interfaces/components/index.tsx b/packages/core/client/src/collection-manager/interfaces/components/index.tsx index ccb5915a60..2fbd571127 100644 --- a/packages/core/client/src/collection-manager/interfaces/components/index.tsx +++ b/packages/core/client/src/collection-manager/interfaces/components/index.tsx @@ -7,8 +7,8 @@ * For more information, please refer to: https://www.nocobase.com/agreement. */ -import { Switch } from 'antd'; -import React from 'react'; +import { Switch, Radio, Input } from 'antd'; +import React, { useEffect, useState } from 'react'; export const TargetKey = () => { return
Target key
; @@ -50,3 +50,37 @@ export const ForeignKey2 = () => { ); }; + +// 自定义 Radio 组件 +export const CustomRadio = (props) => { + const { options, onChange } = props; + const [value, setValue] = useState(props.value); + useEffect(() => { + setValue(['server', 'client'].includes(props.value) ? props.value : 'custom'); + }, [props.value]); + const handleRadioChange = (e) => { + setValue(e.target.value); + if (e.target.value !== 'custom') { + onChange?.(e.target.value); + } + }; + + return ( + + {options.map((option) => ( + + {option.label} + {option.value === 'custom' && value === 'custom' ? ( + { + onChange?.(e.target.value); + }} + value={['server', 'client', 'custom'].includes(props.value) ? null : props.value} + /> + ) : null} + + ))} + + ); +}; diff --git a/packages/core/client/src/collection-manager/interfaces/date.ts b/packages/core/client/src/collection-manager/interfaces/date.ts new file mode 100644 index 0000000000..59d23be7fa --- /dev/null +++ b/packages/core/client/src/collection-manager/interfaces/date.ts @@ -0,0 +1,60 @@ +/** + * This file is part of the NocoBase (R) project. + * Copyright (c) 2020-2024 NocoBase Co., Ltd. + * Authors: NocoBase Team. + * + * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License. + * For more information, please refer to: https://www.nocobase.com/agreement. + */ + +import { CollectionFieldInterface } from '../../data-source/collection-field-interface/CollectionFieldInterface'; +import { dateTimeProps, defaultProps, operators } from './properties'; + +export class DateFieldInterface extends CollectionFieldInterface { + name = 'date'; + type = 'object'; + group = 'datetime'; + order = 1; + title = '{{t("Date")}}'; + sortable = true; + default = { + type: 'dateOnly', + uiSchema: { + type: 'string', + 'x-component': 'DatePicker', + 'x-component-props': { + dateOnly: true, + }, + }, + }; + availableTypes = ['date', 'dateOnly', 'string']; + hasDefaultValue = true; + properties = { + ...defaultProps, + 'uiSchema.x-component-props.dateFormat': { + type: 'string', + title: '{{t("Date format")}}', + 'x-component': 'Radio.Group', + 'x-decorator': 'FormItem', + default: 'YYYY-MM-DD', + enum: [ + { + label: '{{t("Year/Month/Day")}}', + value: 'YYYY/MM/DD', + }, + { + label: '{{t("Year-Month-Day")}}', + value: 'YYYY-MM-DD', + }, + { + label: '{{t("Day/Month/Year")}}', + value: 'DD/MM/YYYY', + }, + ], + }, + }; + filterable = { + operators: operators.datetime, + }; + titleUsable = true; +} diff --git a/packages/core/client/src/collection-manager/interfaces/datetime.ts b/packages/core/client/src/collection-manager/interfaces/datetime.ts index 615d11e9ea..3492a87b6a 100644 --- a/packages/core/client/src/collection-manager/interfaces/datetime.ts +++ b/packages/core/client/src/collection-manager/interfaces/datetime.ts @@ -19,6 +19,9 @@ export class DatetimeFieldInterface extends CollectionFieldInterface { sortable = true; default = { type: 'date', + defaultToCurrentTime: false, + onUpdateToCurrentTime: false, + timezone: 'server', uiSchema: { type: 'string', 'x-component': 'DatePicker', diff --git a/packages/core/client/src/collection-manager/interfaces/index.ts b/packages/core/client/src/collection-manager/interfaces/index.ts index 6778d83413..663f55ac2d 100644 --- a/packages/core/client/src/collection-manager/interfaces/index.ts +++ b/packages/core/client/src/collection-manager/interfaces/index.ts @@ -46,3 +46,4 @@ export * from './sort'; export * from './uuid'; export * from './nanoid'; export * from './unixTimestamp'; +export * from './date'; diff --git a/packages/core/client/src/collection-manager/interfaces/properties/index.ts b/packages/core/client/src/collection-manager/interfaces/properties/index.ts index 1ef36e4b61..df63fd215b 100644 --- a/packages/core/client/src/collection-manager/interfaces/properties/index.ts +++ b/packages/core/client/src/collection-manager/interfaces/properties/index.ts @@ -10,6 +10,7 @@ import { Field } from '@formily/core'; import { ISchema } from '@formily/react'; import { uid } from '@formily/shared'; +import { CustomRadio } from '../components'; export * as operators from './operators'; export const type: ISchema = { @@ -225,6 +226,29 @@ export const reverseFieldProperties: Record = { }; export const dateTimeProps: { [key: string]: ISchema } = { + timezone: { + type: 'string', + title: '{{t("Timezone")}}', + 'x-component': CustomRadio, + 'x-decorator': 'FormItem', + default: 'server', + 'x-component-props': { + options: [ + { + label: '{{t("None")}}', + value: 'server', + }, + { + label: '{{t("Client\'s time zone")}}', + value: 'client', + }, + { + label: '{{t("Custom")}}', + value: 'custom', + }, + ], + }, + }, 'uiSchema.x-component-props.dateFormat': { type: 'string', title: '{{t("Date format")}}', @@ -253,10 +277,10 @@ export const dateTimeProps: { [key: string]: ISchema } = { 'x-content': '{{t("Show time")}}', 'x-reactions': [ `{{(field) => { - field.query('..[].timeFormat').take(f => { - f.display = field.value ? 'visible' : 'none'; - }); - }}}`, + field.query('..[].timeFormat').take(f => { + f.display = field.value ? 'visible' : 'none'; + }); + }}}`, ], }, 'uiSchema.x-component-props.timeFormat': { @@ -276,6 +300,18 @@ export const dateTimeProps: { [key: string]: ISchema } = { }, ], }, + defaultToCurrentTime: { + type: 'boolean', + 'x-decorator': 'FormItem', + 'x-component': 'Checkbox', + 'x-content': '{{t("Default value to current time")}}', + }, + onUpdateToCurrentTime: { + type: 'boolean', + 'x-decorator': 'FormItem', + 'x-component': 'Checkbox', + 'x-content': '{{t("Automatically update timestamp on update")}}', + }, }; export const dataSource: ISchema = { diff --git a/packages/core/client/src/collection-manager/interfaces/unixTimestamp.tsx b/packages/core/client/src/collection-manager/interfaces/unixTimestamp.tsx index 47b3ebc2cf..8e9db2b6d1 100644 --- a/packages/core/client/src/collection-manager/interfaces/unixTimestamp.tsx +++ b/packages/core/client/src/collection-manager/interfaces/unixTimestamp.tsx @@ -8,8 +8,8 @@ */ import { CollectionFieldInterface } from '../../data-source/collection-field-interface/CollectionFieldInterface'; -import { dateTimeProps, defaultProps, operators } from './properties'; - +import { defaultProps, operators } from './properties'; +import { CustomRadio } from './components'; export class UnixTimestampFieldInterface extends CollectionFieldInterface { name = 'unixTimestamp'; type = 'object'; @@ -18,21 +18,47 @@ export class UnixTimestampFieldInterface extends CollectionFieldInterface { title = '{{t("Unix Timestamp")}}'; sortable = true; default = { - type: 'bigInt', + type: 'unixTimestamp', + accuracy: 'second', + timezone: 'server', + defaultToCurrentTime: false, + onUpdateToCurrentTime: false, uiSchema: { type: 'number', 'x-component': 'UnixTimestamp', 'x-component-props': { - accuracy: 'second', showTime: true, }, }, }; - availableTypes = ['integer', 'bigInt']; - hasDefaultValue = true; + availableTypes = ['integer', 'bigInt', 'unixTimestamp']; + hasDefaultValue = false; properties = { ...defaultProps, - 'uiSchema.x-component-props.accuracy': { + timezone: { + type: 'string', + title: '{{t("Timezone")}}', + 'x-component': CustomRadio, + 'x-decorator': 'FormItem', + default: 'server', + 'x-component-props': { + options: [ + { + label: '{{t("None")}}', + value: 'server', + }, + { + label: '{{t("Client\'s time zone")}}', + value: 'client', + }, + { + label: 'custom', + value: 'custom', + }, + ], + }, + }, + accuracy: { type: 'string', title: '{{t("Accuracy")}}', 'x-component': 'Radio.Group', @@ -43,6 +69,20 @@ export class UnixTimestampFieldInterface extends CollectionFieldInterface { { value: 'second', label: '{{t("Second")}}' }, ], }, + defaultToCurrentTime: { + type: 'boolean', + 'x-decorator': 'FormItem', + 'x-component': 'Checkbox', + 'x-content': '{{t("Default value to current time")}}', + default: true, + }, + onUpdateToCurrentTime: { + type: 'boolean', + 'x-decorator': 'FormItem', + 'x-component': 'Checkbox', + 'x-content': '{{t("Automatically update timestamp on update")}}', + default: true, + }, }; filterable = { operators: operators.number, diff --git a/packages/core/client/src/locale/zh-CN.json b/packages/core/client/src/locale/zh-CN.json index 9535a2dbf2..84c45b1c84 100644 --- a/packages/core/client/src/locale/zh-CN.json +++ b/packages/core/client/src/locale/zh-CN.json @@ -283,7 +283,7 @@ "Checkbox group": "复选框", "China region": "中国行政区", "Date & Time": "日期 & 时间", - "Datetime": "日期", + "Datetime": "日期时间", "Relation": "关系类型", "Link to": "关联", "Link to description": "用于快速创建表关系,可兼容大多数普通场景。适合非开发人员使用。作为字段存在时,它是一个下拉选择用于选择目标数据表的数据。创建后,将同时在目标数据表中生成当前数据表的关联字段。", @@ -967,5 +967,8 @@ "Clear default value": "清除默认值", "Open in new window": "新窗口打开", "Sorry, the page you visited does not exist.": "抱歉,你访问的页面不存在。", - "Set Template Engine": "设置模板引擎" + "Set Template Engine": "设置模板引擎", + "Default value to current time":"设置字段默认值为当前时间", + "Automatically update timestamp on update":"当记录更新时自动设置字段值为当前时间", + "Client's time zone":"客户端时区" } diff --git a/packages/core/client/src/schema-component/antd/date-picker/util.ts b/packages/core/client/src/schema-component/antd/date-picker/util.ts index 59026b3efb..9c80b91a28 100644 --- a/packages/core/client/src/schema-component/antd/date-picker/util.ts +++ b/packages/core/client/src/schema-component/antd/date-picker/util.ts @@ -78,17 +78,20 @@ export const mapDatePicker = function () { return (props: any) => { const format = getDefaultFormat(props) as any; const onChange = props.onChange; - return { ...props, format: format, value: str2moment(props.value, props), - onChange: (value: Dayjs | null) => { + onChange: (value: Dayjs | null, dateString) => { if (onChange) { if (!props.showTime && value) { value = value.startOf('day'); } - onChange(moment2str(value, props)); + if (props.dateOnly) { + onChange(dateString); + } else { + onChange(moment2str(value, props)); + } } }, }; diff --git a/packages/core/client/src/schema-component/antd/unix-timestamp/UnixTimestamp.tsx b/packages/core/client/src/schema-component/antd/unix-timestamp/UnixTimestamp.tsx index 5d19a1e118..e83f9d00bc 100644 --- a/packages/core/client/src/schema-component/antd/unix-timestamp/UnixTimestamp.tsx +++ b/packages/core/client/src/schema-component/antd/unix-timestamp/UnixTimestamp.tsx @@ -8,57 +8,32 @@ */ import { connect, mapReadPretty } from '@formily/react'; -import React, { useMemo } from 'react'; +import React from 'react'; import { DatePicker } from '../date-picker'; -import dayjs from 'dayjs'; - -const toValue = (value: any, accuracy) => { - if (value) { - return timestampToDate(value, accuracy); - } - return null; -}; - -function timestampToDate(timestamp, accuracy = 'millisecond') { - if (accuracy === 'second') { - timestamp *= 1000; // 如果精确度是秒级,则将时间戳乘以1000转换为毫秒级 - } - return dayjs(timestamp); -} - -function getTimestamp(date, accuracy = 'millisecond') { - if (accuracy === 'second') { - return dayjs(date).unix(); - } else { - return dayjs(date).valueOf(); // 默认返回毫秒级时间戳 - } -} interface UnixTimestampProps { - value?: number; - accuracy?: 'millisecond' | 'second'; + value?: any; onChange?: (value: number) => void; } export const UnixTimestamp = connect( (props: UnixTimestampProps) => { - const { value, onChange, accuracy = 'second' } = props; - const v = useMemo(() => toValue(value, accuracy), [value, accuracy]); + const { value, onChange } = props; + return ( { if (onChange) { - onChange(getTimestamp(v, accuracy)); + onChange(v); } }} /> ); }, mapReadPretty((props) => { - const { value, accuracy = 'second' } = props; - const v = useMemo(() => toValue(value, accuracy), [value, accuracy]); - return ; + const { value } = props; + return ; }), ); diff --git a/packages/core/client/src/schema-component/antd/unix-timestamp/__tests__/UnixTimestamp.test.tsx b/packages/core/client/src/schema-component/antd/unix-timestamp/__tests__/UnixTimestamp.test.tsx index ba82c73147..c9c107f45c 100644 --- a/packages/core/client/src/schema-component/antd/unix-timestamp/__tests__/UnixTimestamp.test.tsx +++ b/packages/core/client/src/schema-component/antd/unix-timestamp/__tests__/UnixTimestamp.test.tsx @@ -13,11 +13,9 @@ import { UnixTimestamp } from '@nocobase/client'; describe('UnixTimestamp', () => { it('renders without errors', async () => { const { container } = await renderAppOptions({ - Component: UnixTimestamp, - props: { - accuracy: 'millisecond', - }, - value: 0, + Component: UnixTimestamp as any, + props: {}, + value: null, }); expect(container).toMatchInlineSnapshot(`
@@ -69,78 +67,10 @@ describe('UnixTimestamp', () => { `); }); - it('millisecond', async () => { - await renderAppOptions({ - Component: UnixTimestamp, - value: 1712819630000, - props: { - accuracy: 'millisecond', - }, - }); - await waitFor(() => { - expect(screen.getByRole('textbox')).toHaveValue('2024-04-11'); - }); - }); - - it('second', async () => { - await renderAppOptions({ - Component: UnixTimestamp, - value: 1712819630, - props: { - accuracy: 'second', - }, - }); - - await waitFor(() => { - expect(screen.getByRole('textbox')).toHaveValue('2024-04-11'); - }); - }); - - it('string', async () => { - await renderAppOptions({ - Component: UnixTimestamp, - value: '2024-04-11', - props: { - accuracy: 'millisecond', - }, - }); - - await waitFor(() => { - expect(screen.getByRole('textbox')).toHaveValue('2024-04-11'); - }); - }); - - it('change', async () => { - const onChange = vitest.fn(); - await renderAppOptions({ - Component: UnixTimestamp, - value: '2024-04-11', - onChange, - props: { - accuracy: 'millisecond', - }, - }); - await userEvent.click(screen.getByRole('textbox')); - - await waitFor(() => { - expect(screen.queryByRole('table')).toBeInTheDocument(); - }); - - await userEvent.click(document.querySelector('td[title="2024-04-12"]')); - - await waitFor(() => { - expect(screen.getByRole('textbox')).toHaveValue('2024-04-12'); - }); - expect(onChange).toBeCalledWith(1712880000000); - }); - it('read pretty', async () => { const { container } = await renderReadPrettyApp({ - Component: UnixTimestamp, + Component: UnixTimestamp as any, value: '2024-04-11', - props: { - accuracy: 'millisecond', - }, }); expect(screen.getByText('2024-04-11')).toBeInTheDocument(); diff --git a/packages/core/database/src/__tests__/fields/date-only.test.ts b/packages/core/database/src/__tests__/fields/date-only.test.ts new file mode 100644 index 0000000000..1b6d9a60f7 --- /dev/null +++ b/packages/core/database/src/__tests__/fields/date-only.test.ts @@ -0,0 +1,42 @@ +/** + * This file is part of the NocoBase (R) project. + * Copyright (c) 2020-2024 NocoBase Co., Ltd. + * Authors: NocoBase Team. + * + * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License. + * For more information, please refer to: https://www.nocobase.com/agreement. + */ + +import { Database, mockDatabase } from '@nocobase/database'; + +describe('date only', () => { + let db: Database; + + beforeEach(async () => { + db = mockDatabase({ + timezone: '+08:00', + }); + await db.clean({ drop: true }); + }); + + afterEach(async () => { + await db.close(); + }); + + it('should set date field with dateOnly', async () => { + db.collection({ + name: 'tests', + fields: [{ name: 'date1', type: 'dateOnly' }], + }); + + await db.sync(); + + const item = await db.getRepository('tests').create({ + values: { + date1: '2023-03-24', + }, + }); + + expect(item.get('date1')).toBe('2023-03-24'); + }); +}); diff --git a/packages/core/database/src/__tests__/fields/date.test.ts b/packages/core/database/src/__tests__/fields/date.test.ts index e1a2ff189e..4c6b373721 100644 --- a/packages/core/database/src/__tests__/fields/date.test.ts +++ b/packages/core/database/src/__tests__/fields/date.test.ts @@ -11,6 +11,69 @@ import { mockDatabase } from '../'; import { Database } from '../../database'; import { Repository } from '../../repository'; +describe('timezone', () => { + let db: Database; + + beforeEach(async () => { + db = mockDatabase({ + timezone: '+08:00', + }); + await db.clean({ drop: true }); + }); + + afterEach(async () => { + await db.close(); + }); + + describe('timezone', () => { + test('custom', async () => { + db.collection({ + name: 'tests', + timestamps: false, + fields: [{ name: 'date1', type: 'date', timezone: '+06:00' }], + }); + + await db.sync(); + const repository = db.getRepository('tests'); + const instance = await repository.create({ values: { date1: '2023-03-24 00:00:00' } }); + const date1 = instance.get('date1'); + expect(date1.toISOString()).toEqual('2023-03-23T18:00:00.000Z'); + }); + + test('client', async () => { + db.collection({ + name: 'tests', + timestamps: false, + fields: [{ name: 'date1', type: 'date', timezone: 'client' }], + }); + + await db.sync(); + const repository = db.getRepository('tests'); + const instance = await repository.create({ + values: { date1: '2023-03-24 01:00:00' }, + context: { + timezone: '+01:00', + }, + }); + const date1 = instance.get('date1'); + expect(date1.toISOString()).toEqual('2023-03-24T00:00:00.000Z'); + }); + + test('server', async () => { + db.collection({ + name: 'tests', + fields: [{ name: 'date1', type: 'date', timezone: 'server' }], + }); + + await db.sync(); + const repository = db.getRepository('tests'); + const instance = await repository.create({ values: { date1: '2023-03-24 08:00:00' } }); + const date1 = instance.get('date1'); + expect(date1.toISOString()).toEqual('2023-03-24T00:00:00.000Z'); + }); + }); +}); + describe('date-field', () => { let db: Database; let repository: Repository; @@ -30,16 +93,80 @@ describe('date-field', () => { await db.close(); }); - const createExpectToBe = async (key, actual, expected) => { - const instance = await repository.create({ + it('should set default to current time', async () => { + const c1 = db.collection({ + name: 'test11', + fields: [ + { + name: 'date1', + type: 'date', + defaultToCurrentTime: true, + }, + ], + }); + + await db.sync(); + + const instance = await c1.repository.create({}); + const date1 = instance.get('date1'); + expect(date1).toBeDefined(); + }); + + it('should set to current time when update', async () => { + const c1 = db.collection({ + name: 'test11', + fields: [ + { + name: 'date1', + type: 'date', + onUpdateToCurrentTime: true, + }, + { + name: 'title', + type: 'string', + }, + ], + }); + + await db.sync(); + + const instance = await c1.repository.create({ values: { - [key]: actual, + title: 'test', }, }); - return expect(instance.get(key).toISOString()).toEqual(expected); - }; + + const date1Val = instance.get('date1'); + expect(date1Val).toBeDefined(); + + console.log('update'); + await c1.repository.update({ + values: { + title: 'test2', + }, + filter: { + id: instance.get('id'), + }, + }); + + await instance.reload(); + + const date1Val2 = instance.get('date1'); + expect(date1Val2).toBeDefined(); + + expect(date1Val2.getTime()).toBeGreaterThan(date1Val.getTime()); + }); test('create', async () => { + const createExpectToBe = async (key, actual, expected) => { + const instance = await repository.create({ + values: { + [key]: actual, + }, + }); + return expect(instance.get(key).toISOString()).toEqual(expected); + }; + // sqlite 时区不能自定义,只有 +00:00,postgres 和 mysql 可以自定义 DB_TIMEZONE await createExpectToBe('date1', '2023-03-24', '2023-03-24T00:00:00.000Z'); await createExpectToBe('date1', '2023-03-24T16:00:00.000Z', '2023-03-24T16:00:00.000Z'); diff --git a/packages/core/database/src/__tests__/fields/unix-timestamp-field.tests.ts b/packages/core/database/src/__tests__/fields/unix-timestamp-field.tests.ts new file mode 100644 index 0000000000..d590653811 --- /dev/null +++ b/packages/core/database/src/__tests__/fields/unix-timestamp-field.tests.ts @@ -0,0 +1,86 @@ +/** + * This file is part of the NocoBase (R) project. + * Copyright (c) 2020-2024 NocoBase Co., Ltd. + * Authors: NocoBase Team. + * + * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License. + * For more information, please refer to: https://www.nocobase.com/agreement. + */ + +import { Database, mockDatabase } from '@nocobase/database'; +import moment from 'moment'; + +describe('unix timestamp field', () => { + let db: Database; + + beforeEach(async () => { + db = mockDatabase(); + await db.clean({ drop: true }); + }); + + afterEach(async () => { + await db.close(); + }); + + it('should set default to current time', async () => { + const c1 = db.collection({ + name: 'test11', + fields: [ + { + name: 'date1', + type: 'unixTimestamp', + defaultToCurrentTime: true, + }, + ], + }); + + await db.sync(); + + const instance = await c1.repository.create({}); + const date1 = instance.get('date1'); + expect(date1).toBeDefined(); + + console.log(instance.toJSON()); + }); + + it('should set date value', async () => { + const c1 = db.collection({ + name: 'test12', + fields: [ + { + name: 'date1', + type: 'unixTimestamp', + }, + ], + }); + + await db.sync(); + + await c1.repository.create({ + values: { + date1: '2021-01-01T00:00:00Z', + }, + }); + + const item = await c1.repository.findOne(); + const val = item.get('date1'); + const date = moment(val).utc().format('YYYY-MM-DD HH:mm:ss'); + expect(date).toBe('2021-01-01 00:00:00'); + }); + + describe('timezone', () => { + test('custom', async () => { + db.collection({ + name: 'tests', + timestamps: false, + fields: [{ name: 'date1', type: 'unixTimestamp', timezone: '+06:00' }], + }); + + await db.sync(); + const repository = db.getRepository('tests'); + const instance = await repository.create({ values: { date1: '2023-03-24 00:00:00' } }); + const date1 = instance.get('date1'); + expect(date1.toISOString()).toEqual('2023-03-23T18:00:00.000Z'); + }); + }); +}); diff --git a/packages/core/database/src/database.ts b/packages/core/database/src/database.ts index 6300eb55bf..bf10c3bf17 100644 --- a/packages/core/database/src/database.ts +++ b/packages/core/database/src/database.ts @@ -34,7 +34,6 @@ import { import { SequelizeStorage, Umzug } from 'umzug'; import { Collection, CollectionOptions, RepositoryType } from './collection'; import { CollectionFactory } from './collection-factory'; -import { CollectionGroupManager } from './collection-group-manager'; import { ImporterReader, ImportFileExtension } from './collection-importer'; import DatabaseUtils from './database-utils'; import ReferencesMap from './features/references-map'; @@ -42,7 +41,6 @@ import { referentialIntegrityCheck } from './features/referential-integrity-chec import { ArrayFieldRepository } from './field-repository/array-field-repository'; import * as FieldTypes from './fields'; import { Field, FieldContext, RelationField } from './fields'; -import { checkDatabaseVersion } from './helpers'; import { InheritedCollection } from './inherited-collection'; import InheritanceMap from './inherited-map'; import { InterfaceManager } from './interface-manager'; @@ -221,6 +219,9 @@ export class Database extends EventEmitter implements AsyncEmitter { } } + // @ts-ignore + opts.rawTimezone = opts.timezone; + if (options.dialect === 'sqlite') { delete opts.timezone; } else if (!opts.timezone) { @@ -848,7 +849,8 @@ export class Database extends EventEmitter implements AsyncEmitter { * @internal */ async checkVersion() { - return await checkDatabaseVersion(this); + return true; + // return await checkDatabaseVersion(this); } /** diff --git a/packages/core/database/src/fields/date-field.ts b/packages/core/database/src/fields/date-field.ts index f40b27de3e..8cae2221d5 100644 --- a/packages/core/database/src/fields/date-field.ts +++ b/packages/core/database/src/fields/date-field.ts @@ -10,8 +10,14 @@ import { DataTypes } from 'sequelize'; import { BaseColumnFieldOptions, Field } from './field'; +const datetimeRegex = /^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$/; + +function isValidDatetime(str) { + return datetimeRegex.test(str); +} + export class DateField extends Field { - get dataType() { + get dataType(): any { return DataTypes.DATE(3); } @@ -33,6 +39,59 @@ export class DateField extends Field { return props.gmt; } + init() { + const { name, defaultToCurrentTime, onUpdateToCurrentTime, timezone } = this.options; + + this.resolveTimeZone = (context) => { + // @ts-ignore + const serverTimeZone = this.database.options.rawTimezone; + if (timezone === 'server') { + return serverTimeZone; + } + + if (timezone === 'client') { + return context?.timezone || serverTimeZone; + } + + if (timezone) { + return timezone; + } + + return serverTimeZone; + }; + + this.beforeSave = async (instance, options) => { + const value = instance.get(name); + + if (!value && instance.isNewRecord && defaultToCurrentTime) { + instance.set(name, new Date()); + return; + } + + if (onUpdateToCurrentTime) { + instance.set(name, new Date()); + return; + } + }; + } + + setter(value, options) { + if (value === null) { + return value; + } + if (value instanceof Date) { + return value; + } + + if (typeof value === 'string' && isValidDatetime(value)) { + const dateTimezone = this.resolveTimeZone(options?.context); + const dateString = `${value} ${dateTimezone}`; + return new Date(dateString); + } + + return value; + } + bind() { super.bind(); @@ -51,6 +110,13 @@ export class DateField extends Field { // @ts-ignore model.refreshAttributes(); } + + this.on('beforeSave', this.beforeSave); + } + + unbind() { + super.unbind(); + this.off('beforeSave', this.beforeSave); } } diff --git a/packages/core/database/src/fields/date-only-field.ts b/packages/core/database/src/fields/date-only-field.ts new file mode 100644 index 0000000000..5fce9d1b74 --- /dev/null +++ b/packages/core/database/src/fields/date-only-field.ts @@ -0,0 +1,21 @@ +/** + * This file is part of the NocoBase (R) project. + * Copyright (c) 2020-2024 NocoBase Co., Ltd. + * Authors: NocoBase Team. + * + * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License. + * For more information, please refer to: https://www.nocobase.com/agreement. + */ + +import { BaseColumnFieldOptions, Field } from './field'; +import { DataTypes } from 'sequelize'; + +export class DateOnlyField extends Field { + get dataType(): any { + return DataTypes.DATEONLY; + } +} + +export interface DateOnlyFieldOptions extends BaseColumnFieldOptions { + type: 'dateOnly'; +} diff --git a/packages/core/database/src/fields/field.ts b/packages/core/database/src/fields/field.ts index b9f230dd4f..e4b0b70024 100644 --- a/packages/core/database/src/fields/field.ts +++ b/packages/core/database/src/fields/field.ts @@ -56,7 +56,7 @@ export abstract class Field { return this.options.type; } - abstract get dataType(); + abstract get dataType(): any; isRelationField() { return false; @@ -171,11 +171,13 @@ export abstract class Field { Object.assign(opts, { type: this.database.sequelize.normalizeDataType(this.dataType) }); } + Object.assign(opts, this.additionalSequelizeOptions()); + return opts; } - isSqlite() { - return this.database.sequelize.getDialect() === 'sqlite'; + additionalSequelizeOptions() { + return {}; } typeToString() { diff --git a/packages/core/database/src/fields/index.ts b/packages/core/database/src/fields/index.ts index 610b6f1ad1..d698e44cd6 100644 --- a/packages/core/database/src/fields/index.ts +++ b/packages/core/database/src/fields/index.ts @@ -36,6 +36,8 @@ import { UUIDFieldOptions } from './uuid-field'; import { VirtualFieldOptions } from './virtual-field'; import { NanoidFieldOptions } from './nanoid-field'; import { EncryptionField } from './encryption-field'; +import { UnixTimestampFieldOptions } from './unix-timestamp-field'; +import { DateOnlyFieldOptions } from './date-only-field'; export * from './array-field'; export * from './belongs-to-field'; @@ -43,6 +45,7 @@ export * from './belongs-to-many-field'; export * from './boolean-field'; export * from './context-field'; export * from './date-field'; +export * from './date-only-field'; export * from './field'; export * from './has-many-field'; export * from './has-one-field'; @@ -61,6 +64,7 @@ export * from './uuid-field'; export * from './virtual-field'; export * from './nanoid-field'; export * from './encryption-field'; +export * from './unix-timestamp-field'; export type FieldOptions = | BaseFieldOptions @@ -81,6 +85,8 @@ export type FieldOptions = | SetFieldOptions | TimeFieldOptions | DateFieldOptions + | DateOnlyFieldOptions + | UnixTimestampFieldOptions | UidFieldOptions | UUIDFieldOptions | NanoidFieldOptions diff --git a/packages/core/database/src/fields/unix-timestamp-field.ts b/packages/core/database/src/fields/unix-timestamp-field.ts new file mode 100644 index 0000000000..fc634ecde5 --- /dev/null +++ b/packages/core/database/src/fields/unix-timestamp-field.ts @@ -0,0 +1,60 @@ +/** + * This file is part of the NocoBase (R) project. + * Copyright (c) 2020-2024 NocoBase Co., Ltd. + * Authors: NocoBase Team. + * + * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License. + * For more information, please refer to: https://www.nocobase.com/agreement. + */ + +import { DataTypes } from 'sequelize'; +import { DateField } from './date-field'; +import { BaseColumnFieldOptions } from './field'; + +export class UnixTimestampField extends DateField { + get dataType() { + return DataTypes.BIGINT; + } + + additionalSequelizeOptions(): {} { + const { name } = this.options; + let { accuracy } = this.options; + + if (this.options?.uiSchema['x-component-props']?.accuracy) { + accuracy = this.options?.uiSchema['x-component-props']?.accuracy; + } + + if (!accuracy) { + accuracy = 'second'; + } + + let rationalNumber = 1000; + + if (accuracy === 'millisecond') { + rationalNumber = 1; + } + + return { + get() { + const value = this.getDataValue(name); + if (value === null || value === undefined) { + return value; + } + + return new Date(value * rationalNumber); + }, + set(value) { + if (value === null || value === undefined) { + this.setDataValue(name, value); + } else { + // date to unix timestamp + this.setDataValue(name, Math.floor(new Date(value).getTime() / rationalNumber)); + } + }, + }; + } +} + +export interface UnixTimestampFieldOptions extends BaseColumnFieldOptions { + type: 'unix-timestamp'; +} diff --git a/packages/core/database/src/model.ts b/packages/core/database/src/model.ts index a7581dece3..9ec745fcca 100644 --- a/packages/core/database/src/model.ts +++ b/packages/core/database/src/model.ts @@ -7,7 +7,7 @@ * For more information, please refer to: https://www.nocobase.com/agreement. */ -import lodash, { isPlainObject } from 'lodash'; +import lodash from 'lodash'; import { Model as SequelizeModel, ModelStatic } from 'sequelize'; import { Collection } from './collection'; import { Database } from './database'; @@ -30,7 +30,8 @@ interface JSONTransformerOptions { export class Model extends SequelizeModel - implements IModel { + implements IModel +{ public static database: Database; public static collection: Collection; @@ -49,6 +50,21 @@ export class Model(values, { ...options, @@ -645,7 +645,7 @@ export class Repository exten * @internal */ public perfHistograms = new Map(); - protected plugins = new Map(); - protected _appSupervisor: AppSupervisor = AppSupervisor.getInstance(); - protected _started: Date | null = null; - private _authenticated = false; - private _maintaining = false; - private _maintainingCommandStatus: MaintainingCommandStatus; - private _maintainingStatusBeforeCommand: MaintainingCommandStatus | null; - private _actionCommand: Command; - /** * @internal */ public syncManager: SyncManager; public requestLogger: Logger; + protected plugins = new Map(); + protected _appSupervisor: AppSupervisor = AppSupervisor.getInstance(); + private _authenticated = false; + private _maintaining = false; + private _maintainingCommandStatus: MaintainingCommandStatus; + private _maintainingStatusBeforeCommand: MaintainingCommandStatus | null; + private _actionCommand: Command; private sqlLogger: Logger; - protected _logger: SystemLogger; constructor(public options: ApplicationOptions) { super(); @@ -241,6 +238,8 @@ export class Application exten } } + protected _started: Date | null = null; + /** * @experimental */ @@ -248,6 +247,8 @@ export class Application exten return this._started; } + protected _logger: SystemLogger; + get logger() { return this._logger; } From 39bc5717881454cb1bf210673418e1be49f45614 Mon Sep 17 00:00:00 2001 From: GitHub Actions Bot Date: Fri, 16 Aug 2024 09:56:16 +0000 Subject: [PATCH 06/13] =?UTF-8?q?chore(versions):=20=F0=9F=98=8A=20publish?= =?UTF-8?q?=20v1.2.35-alpha?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lerna.json | 2 +- packages/core/acl/package.json | 6 +- packages/core/actions/package.json | 8 +- packages/core/app/package.json | 10 +- packages/core/auth/package.json | 12 +- packages/core/build/package.json | 2 +- packages/core/cache/package.json | 2 +- packages/core/cli/package.json | 6 +- packages/core/client/package.json | 8 +- .../core/create-nocobase-app/package.json | 2 +- .../core/data-source-manager/package.json | 12 +- packages/core/database/package.json | 6 +- packages/core/devtools/package.json | 8 +- packages/core/evaluators/package.json | 4 +- packages/core/logger/package.json | 2 +- packages/core/resourcer/package.json | 4 +- packages/core/sdk/package.json | 2 +- packages/core/server/package.json | 26 ++-- packages/core/telemetry/package.json | 4 +- packages/core/test/package.json | 4 +- packages/core/utils/package.json | 2 +- .../plugins/@nocobase/plugin-acl/package.json | 2 +- .../plugin-action-bulk-edit/package.json | 2 +- .../plugin-action-bulk-update/package.json | 2 +- .../plugin-action-custom-request/package.json | 2 +- .../plugin-action-duplicate/package.json | 2 +- .../plugin-action-export/package.json | 2 +- .../plugin-action-import/package.json | 2 +- .../plugin-action-print/package.json | 2 +- .../@nocobase/plugin-api-doc/package.json | 2 +- .../@nocobase/plugin-api-keys/package.json | 2 +- .../@nocobase/plugin-audit-logs/package.json | 2 +- .../@nocobase/plugin-auth-sms/package.json | 2 +- .../@nocobase/plugin-auth/package.json | 2 +- .../plugin-backup-restore/package.json | 2 +- .../plugin-block-iframe/package.json | 2 +- .../plugin-block-workbench/package.json | 2 +- .../@nocobase/plugin-calendar/package.json | 2 +- .../@nocobase/plugin-charts/package.json | 2 +- .../@nocobase/plugin-client/package.json | 2 +- .../plugin-collection-sql/package.json | 2 +- .../plugin-data-source-main/package.json | 2 +- .../plugin-data-source-manager/package.json | 2 +- .../plugin-data-visualization/package.json | 4 +- .../plugin-disable-pm-add/package.json | 2 +- .../plugin-error-handler/package.json | 2 +- .../plugin-field-china-region/package.json | 2 +- .../plugin-field-formula/package.json | 2 +- .../plugin-field-markdown-vditor/package.json | 2 +- .../plugin-field-sequence/package.json | 2 +- .../plugin-file-manager/package.json | 2 +- .../@nocobase/plugin-gantt/package.json | 2 +- .../package.json | 2 +- .../@nocobase/plugin-kanban/package.json | 2 +- .../plugin-localization/package.json | 2 +- .../@nocobase/plugin-logger/package.json | 2 +- .../plugins/@nocobase/plugin-map/package.json | 2 +- .../plugin-mobile-client/package.json | 2 +- .../plugin-mock-collections/package.json | 2 +- .../plugin-multi-app-manager/package.json | 2 +- .../package.json | 2 +- .../plugin-notifications/package.json | 2 +- .../plugin-sample-hello/package.json | 2 +- .../plugin-snapshot-field/package.json | 2 +- .../plugin-system-settings/package.json | 2 +- .../plugin-theme-editor/package.json | 2 +- .../plugin-ui-schema-storage/package.json | 2 +- .../@nocobase/plugin-users/package.json | 2 +- .../plugin-verification/package.json | 2 +- .../package.json | 2 +- .../plugin-workflow-aggregate/package.json | 2 +- .../plugin-workflow-delay/package.json | 2 +- .../package.json | 2 +- .../plugin-workflow-loop/package.json | 2 +- .../plugin-workflow-mailer/package.json | 2 +- .../plugin-workflow-manual/package.json | 2 +- .../plugin-workflow-parallel/package.json | 2 +- .../plugin-workflow-request/package.json | 2 +- .../plugin-workflow-sql/package.json | 2 +- .../plugin-workflow-test/package.json | 2 +- .../@nocobase/plugin-workflow/package.json | 4 +- packages/presets/nocobase/package.json | 116 +++++++++--------- 82 files changed, 186 insertions(+), 186 deletions(-) diff --git a/lerna.json b/lerna.json index ef2f78549e..fbd82f2374 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "1.2.34-alpha", + "version": "1.2.35-alpha", "npmClient": "yarn", "useWorkspaces": true, "npmClientArgs": [ diff --git a/packages/core/acl/package.json b/packages/core/acl/package.json index 274bc45d96..2c8db627cf 100644 --- a/packages/core/acl/package.json +++ b/packages/core/acl/package.json @@ -1,13 +1,13 @@ { "name": "@nocobase/acl", - "version": "1.2.34-alpha", + "version": "1.2.35-alpha", "description": "", "license": "AGPL-3.0", "main": "./lib/index.js", "types": "./lib/index.d.ts", "dependencies": { - "@nocobase/resourcer": "1.2.34-alpha", - "@nocobase/utils": "1.2.34-alpha", + "@nocobase/resourcer": "1.2.35-alpha", + "@nocobase/utils": "1.2.35-alpha", "minimatch": "^5.1.1" }, "repository": { diff --git a/packages/core/actions/package.json b/packages/core/actions/package.json index fa25807990..be90ccca5c 100644 --- a/packages/core/actions/package.json +++ b/packages/core/actions/package.json @@ -1,14 +1,14 @@ { "name": "@nocobase/actions", - "version": "1.2.34-alpha", + "version": "1.2.35-alpha", "description": "", "license": "AGPL-3.0", "main": "./lib/index.js", "types": "./lib/index.d.ts", "dependencies": { - "@nocobase/cache": "1.2.34-alpha", - "@nocobase/database": "1.2.34-alpha", - "@nocobase/resourcer": "1.2.34-alpha" + "@nocobase/cache": "1.2.35-alpha", + "@nocobase/database": "1.2.35-alpha", + "@nocobase/resourcer": "1.2.35-alpha" }, "repository": { "type": "git", diff --git a/packages/core/app/package.json b/packages/core/app/package.json index c570aafc50..32b1b4c9a0 100644 --- a/packages/core/app/package.json +++ b/packages/core/app/package.json @@ -1,17 +1,17 @@ { "name": "@nocobase/app", - "version": "1.2.34-alpha", + "version": "1.2.35-alpha", "description": "", "license": "AGPL-3.0", "main": "./lib/index.js", "types": "./lib/index.d.ts", "dependencies": { - "@nocobase/database": "1.2.34-alpha", - "@nocobase/preset-nocobase": "1.2.34-alpha", - "@nocobase/server": "1.2.34-alpha" + "@nocobase/database": "1.2.35-alpha", + "@nocobase/preset-nocobase": "1.2.35-alpha", + "@nocobase/server": "1.2.35-alpha" }, "devDependencies": { - "@nocobase/client": "1.2.34-alpha" + "@nocobase/client": "1.2.35-alpha" }, "repository": { "type": "git", diff --git a/packages/core/auth/package.json b/packages/core/auth/package.json index becb1f00be..53afd07e14 100644 --- a/packages/core/auth/package.json +++ b/packages/core/auth/package.json @@ -1,16 +1,16 @@ { "name": "@nocobase/auth", - "version": "1.2.34-alpha", + "version": "1.2.35-alpha", "description": "", "license": "AGPL-3.0", "main": "./lib/index.js", "types": "./lib/index.d.ts", "dependencies": { - "@nocobase/actions": "1.2.34-alpha", - "@nocobase/cache": "1.2.34-alpha", - "@nocobase/database": "1.2.34-alpha", - "@nocobase/resourcer": "1.2.34-alpha", - "@nocobase/utils": "1.2.34-alpha", + "@nocobase/actions": "1.2.35-alpha", + "@nocobase/cache": "1.2.35-alpha", + "@nocobase/database": "1.2.35-alpha", + "@nocobase/resourcer": "1.2.35-alpha", + "@nocobase/utils": "1.2.35-alpha", "@types/jsonwebtoken": "^8.5.8", "jsonwebtoken": "^8.5.1" }, diff --git a/packages/core/build/package.json b/packages/core/build/package.json index be3ba7f18b..4d3f474c7c 100644 --- a/packages/core/build/package.json +++ b/packages/core/build/package.json @@ -1,6 +1,6 @@ { "name": "@nocobase/build", - "version": "1.2.34-alpha", + "version": "1.2.35-alpha", "description": "Library build tool based on rollup.", "main": "lib/index.js", "types": "./lib/index.d.ts", diff --git a/packages/core/cache/package.json b/packages/core/cache/package.json index 04984edc3e..8d16e6eeb8 100644 --- a/packages/core/cache/package.json +++ b/packages/core/cache/package.json @@ -1,6 +1,6 @@ { "name": "@nocobase/cache", - "version": "1.2.34-alpha", + "version": "1.2.35-alpha", "description": "", "license": "AGPL-3.0", "main": "./lib/index.js", diff --git a/packages/core/cli/package.json b/packages/core/cli/package.json index 2d0847e527..648275e08f 100644 --- a/packages/core/cli/package.json +++ b/packages/core/cli/package.json @@ -1,6 +1,6 @@ { "name": "@nocobase/cli", - "version": "1.2.34-alpha", + "version": "1.2.35-alpha", "description": "", "license": "AGPL-3.0", "main": "./src/index.js", @@ -8,7 +8,7 @@ "nocobase": "./bin/index.js" }, "dependencies": { - "@nocobase/app": "1.2.34-alpha", + "@nocobase/app": "1.2.35-alpha", "@types/fs-extra": "^11.0.1", "@umijs/utils": "3.5.20", "chalk": "^4.1.1", @@ -25,7 +25,7 @@ "tsx": "^4.6.2" }, "devDependencies": { - "@nocobase/devtools": "1.2.34-alpha" + "@nocobase/devtools": "1.2.35-alpha" }, "repository": { "type": "git", diff --git a/packages/core/client/package.json b/packages/core/client/package.json index e5399e6193..eefdfad0eb 100644 --- a/packages/core/client/package.json +++ b/packages/core/client/package.json @@ -1,6 +1,6 @@ { "name": "@nocobase/client", - "version": "1.2.34-alpha", + "version": "1.2.35-alpha", "license": "AGPL-3.0", "main": "lib/index.js", "module": "es/index.mjs", @@ -26,9 +26,9 @@ "@formily/reactive-react": "^2.2.27", "@formily/shared": "^2.2.27", "@formily/validator": "^2.2.27", - "@nocobase/evaluators": "1.2.34-alpha", - "@nocobase/sdk": "1.2.34-alpha", - "@nocobase/utils": "1.2.34-alpha", + "@nocobase/evaluators": "1.2.35-alpha", + "@nocobase/sdk": "1.2.35-alpha", + "@nocobase/utils": "1.2.35-alpha", "ahooks": "^3.7.2", "antd": "^5.12.8", "antd-style": "3.4.5", diff --git a/packages/core/create-nocobase-app/package.json b/packages/core/create-nocobase-app/package.json index 277edeb3ea..998fa4488a 100755 --- a/packages/core/create-nocobase-app/package.json +++ b/packages/core/create-nocobase-app/package.json @@ -1,6 +1,6 @@ { "name": "create-nocobase-app", - "version": "1.2.34-alpha", + "version": "1.2.35-alpha", "main": "src/index.js", "license": "AGPL-3.0", "dependencies": { diff --git a/packages/core/data-source-manager/package.json b/packages/core/data-source-manager/package.json index 712fdc34a8..1f8d5dc0b5 100644 --- a/packages/core/data-source-manager/package.json +++ b/packages/core/data-source-manager/package.json @@ -1,16 +1,16 @@ { "name": "@nocobase/data-source-manager", - "version": "1.2.34-alpha", + "version": "1.2.35-alpha", "description": "", "license": "AGPL-3.0", "main": "./lib/index.js", "types": "./lib/index.d.ts", "dependencies": { - "@nocobase/actions": "1.2.34-alpha", - "@nocobase/cache": "1.2.34-alpha", - "@nocobase/database": "1.2.34-alpha", - "@nocobase/resourcer": "1.2.34-alpha", - "@nocobase/utils": "1.2.34-alpha", + "@nocobase/actions": "1.2.35-alpha", + "@nocobase/cache": "1.2.35-alpha", + "@nocobase/database": "1.2.35-alpha", + "@nocobase/resourcer": "1.2.35-alpha", + "@nocobase/utils": "1.2.35-alpha", "@types/jsonwebtoken": "^8.5.8", "jsonwebtoken": "^8.5.1" }, diff --git a/packages/core/database/package.json b/packages/core/database/package.json index cebb20babb..2f127f5bcb 100644 --- a/packages/core/database/package.json +++ b/packages/core/database/package.json @@ -1,13 +1,13 @@ { "name": "@nocobase/database", - "version": "1.2.34-alpha", + "version": "1.2.35-alpha", "description": "", "main": "./lib/index.js", "types": "./lib/index.d.ts", "license": "AGPL-3.0", "dependencies": { - "@nocobase/logger": "1.2.34-alpha", - "@nocobase/utils": "1.2.34-alpha", + "@nocobase/logger": "1.2.35-alpha", + "@nocobase/utils": "1.2.35-alpha", "async-mutex": "^0.3.2", "chalk": "^4.1.1", "cron-parser": "4.4.0", diff --git a/packages/core/devtools/package.json b/packages/core/devtools/package.json index 3c4ea95877..1060838f56 100644 --- a/packages/core/devtools/package.json +++ b/packages/core/devtools/package.json @@ -1,13 +1,13 @@ { "name": "@nocobase/devtools", - "version": "1.2.34-alpha", + "version": "1.2.35-alpha", "description": "", "license": "AGPL-3.0", "main": "./src/index.js", "dependencies": { - "@nocobase/build": "1.2.34-alpha", - "@nocobase/client": "1.2.34-alpha", - "@nocobase/test": "1.2.34-alpha", + "@nocobase/build": "1.2.35-alpha", + "@nocobase/client": "1.2.35-alpha", + "@nocobase/test": "1.2.35-alpha", "@types/koa": "^2.13.4", "@types/koa-bodyparser": "^4.3.4", "@types/lodash": "^4.14.177", diff --git a/packages/core/evaluators/package.json b/packages/core/evaluators/package.json index ddb4f80570..74292ef2fc 100644 --- a/packages/core/evaluators/package.json +++ b/packages/core/evaluators/package.json @@ -1,13 +1,13 @@ { "name": "@nocobase/evaluators", - "version": "1.2.34-alpha", + "version": "1.2.35-alpha", "description": "", "main": "./lib/index.js", "types": "./lib/index.d.ts", "license": "AGPL-3.0", "dependencies": { "@formulajs/formulajs": "4.2.0", - "@nocobase/utils": "1.2.34-alpha", + "@nocobase/utils": "1.2.35-alpha", "mathjs": "^10.6.0" }, "repository": { diff --git a/packages/core/logger/package.json b/packages/core/logger/package.json index a3be63e6c5..1988cccd8e 100644 --- a/packages/core/logger/package.json +++ b/packages/core/logger/package.json @@ -1,6 +1,6 @@ { "name": "@nocobase/logger", - "version": "1.2.34-alpha", + "version": "1.2.35-alpha", "description": "nocobase logging library", "license": "AGPL-3.0", "main": "./lib/index.js", diff --git a/packages/core/resourcer/package.json b/packages/core/resourcer/package.json index 4eb3a1ca3a..ad720e20d3 100644 --- a/packages/core/resourcer/package.json +++ b/packages/core/resourcer/package.json @@ -1,12 +1,12 @@ { "name": "@nocobase/resourcer", - "version": "1.2.34-alpha", + "version": "1.2.35-alpha", "description": "", "main": "./lib/index.js", "types": "./lib/index.d.ts", "license": "AGPL-3.0", "dependencies": { - "@nocobase/utils": "1.2.34-alpha", + "@nocobase/utils": "1.2.35-alpha", "deepmerge": "^4.2.2", "koa-compose": "^4.1.0", "lodash": "^4.17.21", diff --git a/packages/core/sdk/package.json b/packages/core/sdk/package.json index 523e1adf5c..479878cd0d 100644 --- a/packages/core/sdk/package.json +++ b/packages/core/sdk/package.json @@ -1,6 +1,6 @@ { "name": "@nocobase/sdk", - "version": "1.2.34-alpha", + "version": "1.2.35-alpha", "license": "AGPL-3.0", "main": "lib/index.js", "types": "lib/index.d.ts", diff --git a/packages/core/server/package.json b/packages/core/server/package.json index 959cb275aa..0d2d55caf7 100644 --- a/packages/core/server/package.json +++ b/packages/core/server/package.json @@ -1,6 +1,6 @@ { "name": "@nocobase/server", - "version": "1.2.34-alpha", + "version": "1.2.35-alpha", "main": "lib/index.js", "types": "./lib/index.d.ts", "license": "AGPL-3.0", @@ -10,18 +10,18 @@ "@koa/cors": "^3.1.0", "@koa/multer": "^3.0.2", "@koa/router": "^9.4.0", - "@nocobase/acl": "1.2.34-alpha", - "@nocobase/actions": "1.2.34-alpha", - "@nocobase/auth": "1.2.34-alpha", - "@nocobase/cache": "1.2.34-alpha", - "@nocobase/data-source-manager": "1.2.34-alpha", - "@nocobase/database": "1.2.34-alpha", - "@nocobase/evaluators": "1.2.34-alpha", - "@nocobase/logger": "1.2.34-alpha", - "@nocobase/resourcer": "1.2.34-alpha", - "@nocobase/sdk": "1.2.34-alpha", - "@nocobase/telemetry": "1.2.34-alpha", - "@nocobase/utils": "1.2.34-alpha", + "@nocobase/acl": "1.2.35-alpha", + "@nocobase/actions": "1.2.35-alpha", + "@nocobase/auth": "1.2.35-alpha", + "@nocobase/cache": "1.2.35-alpha", + "@nocobase/data-source-manager": "1.2.35-alpha", + "@nocobase/database": "1.2.35-alpha", + "@nocobase/evaluators": "1.2.35-alpha", + "@nocobase/logger": "1.2.35-alpha", + "@nocobase/resourcer": "1.2.35-alpha", + "@nocobase/sdk": "1.2.35-alpha", + "@nocobase/telemetry": "1.2.35-alpha", + "@nocobase/utils": "1.2.35-alpha", "@types/decompress": "4.2.4", "@types/ini": "^1.3.31", "@types/koa-send": "^4.1.3", diff --git a/packages/core/telemetry/package.json b/packages/core/telemetry/package.json index ff94206669..dca6bc610c 100644 --- a/packages/core/telemetry/package.json +++ b/packages/core/telemetry/package.json @@ -1,6 +1,6 @@ { "name": "@nocobase/telemetry", - "version": "1.2.34-alpha", + "version": "1.2.35-alpha", "description": "nocobase telemetry library", "license": "AGPL-3.0", "main": "./lib/index.js", @@ -11,7 +11,7 @@ "directory": "packages/telemetry" }, "dependencies": { - "@nocobase/utils": "1.2.34-alpha", + "@nocobase/utils": "1.2.35-alpha", "@opentelemetry/api": "^1.7.0", "@opentelemetry/instrumentation": "^0.46.0", "@opentelemetry/resources": "^1.19.0", diff --git a/packages/core/test/package.json b/packages/core/test/package.json index 9785835eb5..6d8cee71bf 100644 --- a/packages/core/test/package.json +++ b/packages/core/test/package.json @@ -1,6 +1,6 @@ { "name": "@nocobase/test", - "version": "1.2.34-alpha", + "version": "1.2.35-alpha", "main": "lib/index.js", "module": "./src/index.ts", "types": "./lib/index.d.ts", @@ -51,7 +51,7 @@ }, "dependencies": { "@faker-js/faker": "8.1.0", - "@nocobase/server": "1.2.34-alpha", + "@nocobase/server": "1.2.35-alpha", "@playwright/test": "^1.45.3", "@testing-library/jest-dom": "^6.4.2", "@testing-library/react": "^14.0.0", diff --git a/packages/core/utils/package.json b/packages/core/utils/package.json index 73674008c8..14291b9717 100644 --- a/packages/core/utils/package.json +++ b/packages/core/utils/package.json @@ -1,6 +1,6 @@ { "name": "@nocobase/utils", - "version": "1.2.34-alpha", + "version": "1.2.35-alpha", "main": "lib/index.js", "types": "./lib/index.d.ts", "license": "AGPL-3.0", diff --git a/packages/plugins/@nocobase/plugin-acl/package.json b/packages/plugins/@nocobase/plugin-acl/package.json index cb9e5c21e3..f7883adc3f 100644 --- a/packages/plugins/@nocobase/plugin-acl/package.json +++ b/packages/plugins/@nocobase/plugin-acl/package.json @@ -4,7 +4,7 @@ "displayName.zh-CN": "权限控制", "description": "Based on roles, resources, and actions, access control can precisely manage interface configuration permissions, data operation permissions, menu access permissions, and plugin permissions.", "description.zh-CN": "基于角色、资源和操作的权限控制,可以精确控制界面配置权限、数据操作权限、菜单访问权限、插件权限。", - "version": "1.2.34-alpha", + "version": "1.2.35-alpha", "license": "AGPL-3.0", "main": "./dist/server/index.js", "homepage": "https://docs.nocobase.com/handbook/acl", diff --git a/packages/plugins/@nocobase/plugin-action-bulk-edit/package.json b/packages/plugins/@nocobase/plugin-action-bulk-edit/package.json index a11395fe3a..f13032aff9 100644 --- a/packages/plugins/@nocobase/plugin-action-bulk-edit/package.json +++ b/packages/plugins/@nocobase/plugin-action-bulk-edit/package.json @@ -1,6 +1,6 @@ { "name": "@nocobase/plugin-action-bulk-edit", - "version": "1.2.34-alpha", + "version": "1.2.35-alpha", "main": "dist/server/index.js", "homepage": "https://docs.nocobase.com/handbook/action-bulk-edit", "homepage.zh-CN": "https://docs-cn.nocobase.com/handbook/action-bulk-edit", diff --git a/packages/plugins/@nocobase/plugin-action-bulk-update/package.json b/packages/plugins/@nocobase/plugin-action-bulk-update/package.json index 61bc904492..51f0406bac 100644 --- a/packages/plugins/@nocobase/plugin-action-bulk-update/package.json +++ b/packages/plugins/@nocobase/plugin-action-bulk-update/package.json @@ -1,6 +1,6 @@ { "name": "@nocobase/plugin-action-bulk-update", - "version": "1.2.34-alpha", + "version": "1.2.35-alpha", "main": "dist/server/index.js", "homepage": "https://docs.nocobase.com/handbook/action-bulk-update", "homepage.zh-CN": "https://docs-cn.nocobase.com/handbook/action-bulk-update", diff --git a/packages/plugins/@nocobase/plugin-action-custom-request/package.json b/packages/plugins/@nocobase/plugin-action-custom-request/package.json index 52fb427ee5..78615cbefd 100644 --- a/packages/plugins/@nocobase/plugin-action-custom-request/package.json +++ b/packages/plugins/@nocobase/plugin-action-custom-request/package.json @@ -1,6 +1,6 @@ { "name": "@nocobase/plugin-action-custom-request", - "version": "1.2.34-alpha", + "version": "1.2.35-alpha", "main": "dist/server/index.js", "homepage": "https://docs.nocobase.com/handbook/action-custom-request", "homepage.zh-CN": "https://docs-cn.nocobase.com/handbook/action-custom-request", diff --git a/packages/plugins/@nocobase/plugin-action-duplicate/package.json b/packages/plugins/@nocobase/plugin-action-duplicate/package.json index b70a81cd87..c5b8614b61 100644 --- a/packages/plugins/@nocobase/plugin-action-duplicate/package.json +++ b/packages/plugins/@nocobase/plugin-action-duplicate/package.json @@ -1,6 +1,6 @@ { "name": "@nocobase/plugin-action-duplicate", - "version": "1.2.34-alpha", + "version": "1.2.35-alpha", "main": "dist/server/index.js", "homepage": "https://docs.nocobase.com/handbook/action-duplicate", "homepage.zh-CN": "https://docs-cn.nocobase.com/handbook/action-duplicate", diff --git a/packages/plugins/@nocobase/plugin-action-export/package.json b/packages/plugins/@nocobase/plugin-action-export/package.json index 89ec76cea9..4bbde7b7cf 100644 --- a/packages/plugins/@nocobase/plugin-action-export/package.json +++ b/packages/plugins/@nocobase/plugin-action-export/package.json @@ -4,7 +4,7 @@ "displayName.zh-CN": "操作:导出记录", "description": "Export filtered records to excel, you can configure which fields to export.", "description.zh-CN": "导出筛选后的记录到 Excel 中,可以配置导出哪些字段。", - "version": "1.2.34-alpha", + "version": "1.2.35-alpha", "license": "AGPL-3.0", "main": "./dist/server/index.js", "homepage": "https://docs.nocobase.com/handbook/action-export", diff --git a/packages/plugins/@nocobase/plugin-action-import/package.json b/packages/plugins/@nocobase/plugin-action-import/package.json index 10f44f5a3b..de0cfbde1b 100644 --- a/packages/plugins/@nocobase/plugin-action-import/package.json +++ b/packages/plugins/@nocobase/plugin-action-import/package.json @@ -4,7 +4,7 @@ "displayName.zh-CN": "操作:导入记录", "description": "Import records using excel templates. You can configure which fields to import and templates will be generated automatically.", "description.zh-CN": "使用 Excel 模板导入数据,可以配置导入哪些字段,自动生成模板。", - "version": "1.2.34-alpha", + "version": "1.2.35-alpha", "license": "AGPL-3.0", "main": "./dist/server/index.js", "homepage": "https://docs.nocobase.com/handbook/action-import", diff --git a/packages/plugins/@nocobase/plugin-action-print/package.json b/packages/plugins/@nocobase/plugin-action-print/package.json index 4c8ba0afdb..4b0bb09719 100644 --- a/packages/plugins/@nocobase/plugin-action-print/package.json +++ b/packages/plugins/@nocobase/plugin-action-print/package.json @@ -1,6 +1,6 @@ { "name": "@nocobase/plugin-action-print", - "version": "1.2.34-alpha", + "version": "1.2.35-alpha", "main": "dist/server/index.js", "homepage": "https://docs.nocobase.com/handbook/action-print", "homepage.zh-CN": "https://docs-cn.nocobase.com/handbook/action-print", diff --git a/packages/plugins/@nocobase/plugin-api-doc/package.json b/packages/plugins/@nocobase/plugin-api-doc/package.json index 7452837659..27fd09104c 100644 --- a/packages/plugins/@nocobase/plugin-api-doc/package.json +++ b/packages/plugins/@nocobase/plugin-api-doc/package.json @@ -1,6 +1,6 @@ { "name": "@nocobase/plugin-api-doc", - "version": "1.2.34-alpha", + "version": "1.2.35-alpha", "displayName": "API documentation", "displayName.zh-CN": "API 文档", "description": "An OpenAPI documentation generator for NocoBase HTTP API.", diff --git a/packages/plugins/@nocobase/plugin-api-keys/package.json b/packages/plugins/@nocobase/plugin-api-keys/package.json index 7ee4426abe..65a8848a96 100644 --- a/packages/plugins/@nocobase/plugin-api-keys/package.json +++ b/packages/plugins/@nocobase/plugin-api-keys/package.json @@ -4,7 +4,7 @@ "displayName.zh-CN": "认证:API 密钥", "description": "Allows users to use API key to access application's HTTP API", "description.zh-CN": "允许用户使用 API 密钥访问应用的 HTTP API", - "version": "1.2.34-alpha", + "version": "1.2.35-alpha", "license": "AGPL-3.0", "main": "./dist/server/index.js", "homepage": "https://docs.nocobase.com/handbook/api-keys", diff --git a/packages/plugins/@nocobase/plugin-audit-logs/package.json b/packages/plugins/@nocobase/plugin-audit-logs/package.json index 1f65816d63..1ad1549274 100644 --- a/packages/plugins/@nocobase/plugin-audit-logs/package.json +++ b/packages/plugins/@nocobase/plugin-audit-logs/package.json @@ -1,6 +1,6 @@ { "name": "@nocobase/plugin-audit-logs", - "version": "1.2.34-alpha", + "version": "1.2.35-alpha", "displayName": "Audit logs (deprecated)", "displayName.zh-CN": "审计日志(废弃)", "description": "This plugin is deprecated. There will be a new audit log plugin in the future.", diff --git a/packages/plugins/@nocobase/plugin-auth-sms/package.json b/packages/plugins/@nocobase/plugin-auth-sms/package.json index 6d83594202..5e62248869 100644 --- a/packages/plugins/@nocobase/plugin-auth-sms/package.json +++ b/packages/plugins/@nocobase/plugin-auth-sms/package.json @@ -4,7 +4,7 @@ "displayName.zh-CN": "认证:短信", "description": "SMS authentication.", "description.zh-CN": "通过短信验证码认证身份。", - "version": "1.2.34-alpha", + "version": "1.2.35-alpha", "main": "./dist/server/index.js", "homepage": "https://docs.nocobase.com/handbook/auth-sms", "homepage.zh-CN": "https://docs-cn.nocobase.com/handbook/auth-sms", diff --git a/packages/plugins/@nocobase/plugin-auth/package.json b/packages/plugins/@nocobase/plugin-auth/package.json index e1bd0af06e..bd8f38c332 100644 --- a/packages/plugins/@nocobase/plugin-auth/package.json +++ b/packages/plugins/@nocobase/plugin-auth/package.json @@ -1,6 +1,6 @@ { "name": "@nocobase/plugin-auth", - "version": "1.2.34-alpha", + "version": "1.2.35-alpha", "main": "./dist/server/index.js", "homepage": "https://docs.nocobase.com/handbook/auth", "homepage.zh-CN": "https://docs-cn.nocobase.com/handbook/auth", diff --git a/packages/plugins/@nocobase/plugin-backup-restore/package.json b/packages/plugins/@nocobase/plugin-backup-restore/package.json index dbd49c4e65..24acfddbbe 100644 --- a/packages/plugins/@nocobase/plugin-backup-restore/package.json +++ b/packages/plugins/@nocobase/plugin-backup-restore/package.json @@ -4,7 +4,7 @@ "displayName.zh-CN": "应用的备份与还原", "description": "Backup and restore applications for scenarios such as application replication, migration, and upgrades.", "description.zh-CN": "备份和还原应用,可用于应用的复制、迁移、升级等场景。", - "version": "1.2.34-alpha", + "version": "1.2.35-alpha", "license": "AGPL-3.0", "main": "./dist/server/index.js", "homepage": "https://docs.nocobase.com/handbook/backup-restore", diff --git a/packages/plugins/@nocobase/plugin-block-iframe/package.json b/packages/plugins/@nocobase/plugin-block-iframe/package.json index 7db1e3f3b1..7e22efdc50 100644 --- a/packages/plugins/@nocobase/plugin-block-iframe/package.json +++ b/packages/plugins/@nocobase/plugin-block-iframe/package.json @@ -4,7 +4,7 @@ "displayName.zh-CN": "区块:iframe", "description": "Create an iframe block on the page to embed and display external web pages or content.", "description.zh-CN": "在页面上创建和管理iframe,用于嵌入和展示外部网页或内容。", - "version": "1.2.34-alpha", + "version": "1.2.35-alpha", "license": "AGPL-3.0", "main": "./dist/server/index.js", "homepage": "https://docs.nocobase.com/handbook/block-iframe", diff --git a/packages/plugins/@nocobase/plugin-block-workbench/package.json b/packages/plugins/@nocobase/plugin-block-workbench/package.json index ec3c3b1911..791039ed65 100644 --- a/packages/plugins/@nocobase/plugin-block-workbench/package.json +++ b/packages/plugins/@nocobase/plugin-block-workbench/package.json @@ -1,6 +1,6 @@ { "name": "@nocobase/plugin-block-workbench", - "version": "1.2.34-alpha", + "version": "1.2.35-alpha", "displayName": "Block: Workbench", "displayName.zh-CN": "区块:工作台", "description": "Add buttons for actions, links, etc. in the workbench block to quickly initiate actions and jump pages.", diff --git a/packages/plugins/@nocobase/plugin-calendar/package.json b/packages/plugins/@nocobase/plugin-calendar/package.json index 81a9c80cac..1def9da9d6 100644 --- a/packages/plugins/@nocobase/plugin-calendar/package.json +++ b/packages/plugins/@nocobase/plugin-calendar/package.json @@ -1,6 +1,6 @@ { "name": "@nocobase/plugin-calendar", - "version": "1.2.34-alpha", + "version": "1.2.35-alpha", "displayName": "Calendar", "displayName.zh-CN": "日历", "description": "Provides callendar collection template and block for managing date data, typically for date/time related information such as events, appointments, tasks, and so on.", diff --git a/packages/plugins/@nocobase/plugin-charts/package.json b/packages/plugins/@nocobase/plugin-charts/package.json index 8926cd80ee..22fc4a9ceb 100644 --- a/packages/plugins/@nocobase/plugin-charts/package.json +++ b/packages/plugins/@nocobase/plugin-charts/package.json @@ -4,7 +4,7 @@ "displayName.zh-CN": "图表(废弃)", "description": "The plugin has been deprecated, please use the data visualization plugin instead.", "description.zh-CN": "已废弃插件,请使用数据可视化插件代替。", - "version": "1.2.34-alpha", + "version": "1.2.35-alpha", "main": "./dist/server/index.js", "license": "AGPL-3.0", "devDependencies": { diff --git a/packages/plugins/@nocobase/plugin-client/package.json b/packages/plugins/@nocobase/plugin-client/package.json index 02ef0e2fe0..9419c8c9a6 100644 --- a/packages/plugins/@nocobase/plugin-client/package.json +++ b/packages/plugins/@nocobase/plugin-client/package.json @@ -4,7 +4,7 @@ "displayName.zh-CN": "WEB 客户端", "description": "Provides a client interface for the NocoBase server", "description.zh-CN": "为 NocoBase 服务端提供客户端界面", - "version": "1.2.34-alpha", + "version": "1.2.35-alpha", "main": "./dist/server/index.js", "license": "AGPL-3.0", "devDependencies": { diff --git a/packages/plugins/@nocobase/plugin-collection-sql/package.json b/packages/plugins/@nocobase/plugin-collection-sql/package.json index c8368828ea..254a17aff3 100644 --- a/packages/plugins/@nocobase/plugin-collection-sql/package.json +++ b/packages/plugins/@nocobase/plugin-collection-sql/package.json @@ -4,7 +4,7 @@ "displayName.zh-CN": "数据表: SQL", "description": "Provides SQL collection template", "description.zh-CN": "提供 SQL 数据表模板", - "version": "1.2.34-alpha", + "version": "1.2.35-alpha", "homepage": "https://docs-cn.nocobase.com/handbook/collection-sql", "homepage.zh-CN": "https://docs-cn.nocobase.com/handbook/collection-sql", "main": "dist/server/index.js", diff --git a/packages/plugins/@nocobase/plugin-data-source-main/package.json b/packages/plugins/@nocobase/plugin-data-source-main/package.json index b8d48b30a4..53d792f20d 100644 --- a/packages/plugins/@nocobase/plugin-data-source-main/package.json +++ b/packages/plugins/@nocobase/plugin-data-source-main/package.json @@ -4,7 +4,7 @@ "displayName.zh-CN": "数据源:主数据库", "description": "NocoBase main database, supports relational databases such as MySQL, PostgreSQL, SQLite and so on.", "description.zh-CN": "NocoBase 主数据库,支持 MySQL、PostgreSQL、SQLite 等关系型数据库。", - "version": "1.2.34-alpha", + "version": "1.2.35-alpha", "main": "./dist/server/index.js", "homepage": "https://docs.nocobase.com/handbook/data-source-main", "homepage.zh-CN": "https://docs-cn.nocobase.com/handbook/data-source-main", diff --git a/packages/plugins/@nocobase/plugin-data-source-manager/package.json b/packages/plugins/@nocobase/plugin-data-source-manager/package.json index 25ef0593d1..cf48734501 100644 --- a/packages/plugins/@nocobase/plugin-data-source-manager/package.json +++ b/packages/plugins/@nocobase/plugin-data-source-manager/package.json @@ -1,6 +1,6 @@ { "name": "@nocobase/plugin-data-source-manager", - "version": "1.2.34-alpha", + "version": "1.2.35-alpha", "main": "dist/server/index.js", "displayName": "Data source manager", "displayName.zh-CN": "数据源管理", diff --git a/packages/plugins/@nocobase/plugin-data-visualization/package.json b/packages/plugins/@nocobase/plugin-data-visualization/package.json index c0f586f4f3..1f009e2724 100644 --- a/packages/plugins/@nocobase/plugin-data-visualization/package.json +++ b/packages/plugins/@nocobase/plugin-data-visualization/package.json @@ -1,6 +1,6 @@ { "name": "@nocobase/plugin-data-visualization", - "version": "1.2.34-alpha", + "version": "1.2.35-alpha", "displayName": "Data visualization", "displayName.zh-CN": "数据可视化", "description": "Provides data visualization feature, including chart block and chart filter block, support line charts, area charts, bar charts and more than a dozen kinds of charts, you can also extend more chart types.", @@ -28,8 +28,8 @@ "@nocobase/actions": "1.x", "@nocobase/cache": "1.x", "@nocobase/client": "1.x", - "@nocobase/plugin-data-source-main": "1.x", "@nocobase/database": "1.x", + "@nocobase/plugin-data-source-main": "1.x", "@nocobase/server": "1.x", "@nocobase/test": "1.x", "@nocobase/utils": "1.x" diff --git a/packages/plugins/@nocobase/plugin-disable-pm-add/package.json b/packages/plugins/@nocobase/plugin-disable-pm-add/package.json index d5c0f25cb4..24c2207050 100644 --- a/packages/plugins/@nocobase/plugin-disable-pm-add/package.json +++ b/packages/plugins/@nocobase/plugin-disable-pm-add/package.json @@ -1,6 +1,6 @@ { "name": "@nocobase/plugin-disable-pm-add", - "version": "1.2.34-alpha", + "version": "1.2.35-alpha", "main": "./dist/server/index.js", "peerDependencies": { "@nocobase/client": "1.x", diff --git a/packages/plugins/@nocobase/plugin-error-handler/package.json b/packages/plugins/@nocobase/plugin-error-handler/package.json index a734a92ebc..3b3f321f0e 100644 --- a/packages/plugins/@nocobase/plugin-error-handler/package.json +++ b/packages/plugins/@nocobase/plugin-error-handler/package.json @@ -4,7 +4,7 @@ "displayName.zh-CN": "错误处理器", "description": "Handling application errors and exceptions.", "description.zh-CN": "处理应用程序中的错误和异常。", - "version": "1.2.34-alpha", + "version": "1.2.35-alpha", "license": "AGPL-3.0", "main": "./dist/server/index.js", "devDependencies": { diff --git a/packages/plugins/@nocobase/plugin-field-china-region/package.json b/packages/plugins/@nocobase/plugin-field-china-region/package.json index e3809b9b44..7761ee4787 100644 --- a/packages/plugins/@nocobase/plugin-field-china-region/package.json +++ b/packages/plugins/@nocobase/plugin-field-china-region/package.json @@ -1,6 +1,6 @@ { "name": "@nocobase/plugin-field-china-region", - "version": "1.2.34-alpha", + "version": "1.2.35-alpha", "displayName": "Administrative divisions of China", "displayName.zh-CN": "中国行政区划", "description": "Provides data and field type for administrative divisions of China.", diff --git a/packages/plugins/@nocobase/plugin-field-formula/package.json b/packages/plugins/@nocobase/plugin-field-formula/package.json index 3f83b882c8..c46a24834b 100644 --- a/packages/plugins/@nocobase/plugin-field-formula/package.json +++ b/packages/plugins/@nocobase/plugin-field-formula/package.json @@ -4,7 +4,7 @@ "displayName.zh-CN": "数据表字段:公式", "description": "Configure and store the results of calculations between multiple field values in the same record, supporting both Math.js and Excel formula functions.", "description.zh-CN": "可以配置并存储同一条记录的多字段值之间的计算结果,支持 Math.js 和 Excel formula functions 两种引擎", - "version": "1.2.34-alpha", + "version": "1.2.35-alpha", "license": "AGPL-3.0", "main": "./dist/server/index.js", "homepage": "https://docs.nocobase.com/handbook/field-formula", diff --git a/packages/plugins/@nocobase/plugin-field-markdown-vditor/package.json b/packages/plugins/@nocobase/plugin-field-markdown-vditor/package.json index 6861a82f97..79aa5ba3d6 100644 --- a/packages/plugins/@nocobase/plugin-field-markdown-vditor/package.json +++ b/packages/plugins/@nocobase/plugin-field-markdown-vditor/package.json @@ -4,7 +4,7 @@ "displayName.zh-CN": "数据表字段:Markdown(Vditor)", "description": "Used to store Markdown and render it using Vditor editor, supports common Markdown syntax such as list, code, quote, etc., and supports uploading images, recordings, etc.It also allows for instant rendering, where what you see is what you get.", "description.zh-CN": "用于存储 Markdown,并使用 Vditor 编辑器渲染,支持常见 Markdown 语法,如列表,代码,引用等,并支持上传图片,录音等。同时可以做到即时渲染,所见即所得。", - "version": "1.2.34-alpha", + "version": "1.2.35-alpha", "license": "AGPL-3.0", "main": "dist/server/index.js", "homepage": "https://docs.nocobase.com/handbook/field-markdown-vditor", diff --git a/packages/plugins/@nocobase/plugin-field-sequence/package.json b/packages/plugins/@nocobase/plugin-field-sequence/package.json index cb0a57695a..b3b94a1af8 100644 --- a/packages/plugins/@nocobase/plugin-field-sequence/package.json +++ b/packages/plugins/@nocobase/plugin-field-sequence/package.json @@ -4,7 +4,7 @@ "displayName.zh-CN": "数据表字段:自动编码", "description": "Automatically generate codes based on configured rules, supporting combinations of dates, numbers, and text.", "description.zh-CN": "根据配置的规则自动生成编码,支持日期、数字、文本的组合。", - "version": "1.2.34-alpha", + "version": "1.2.35-alpha", "license": "AGPL-3.0", "main": "./dist/server/index.js", "homepage": "https://docs.nocobase.com/handbook/field-sequence", diff --git a/packages/plugins/@nocobase/plugin-file-manager/package.json b/packages/plugins/@nocobase/plugin-file-manager/package.json index 656dda5916..d582678d78 100644 --- a/packages/plugins/@nocobase/plugin-file-manager/package.json +++ b/packages/plugins/@nocobase/plugin-file-manager/package.json @@ -1,6 +1,6 @@ { "name": "@nocobase/plugin-file-manager", - "version": "1.2.34-alpha", + "version": "1.2.35-alpha", "displayName": "File manager", "displayName.zh-CN": "文件管理器", "description": "Provides files storage services with files collection template and attachment field.", diff --git a/packages/plugins/@nocobase/plugin-gantt/package.json b/packages/plugins/@nocobase/plugin-gantt/package.json index 6646cb389f..930bfa8e4a 100644 --- a/packages/plugins/@nocobase/plugin-gantt/package.json +++ b/packages/plugins/@nocobase/plugin-gantt/package.json @@ -1,6 +1,6 @@ { "name": "@nocobase/plugin-gantt", - "version": "1.2.34-alpha", + "version": "1.2.35-alpha", "displayName": "Block: Gantt", "displayName.zh-CN": "区块:甘特图", "description": "Provides Gantt block.", diff --git a/packages/plugins/@nocobase/plugin-graph-collection-manager/package.json b/packages/plugins/@nocobase/plugin-graph-collection-manager/package.json index f8a1daed3b..7553c29e6f 100644 --- a/packages/plugins/@nocobase/plugin-graph-collection-manager/package.json +++ b/packages/plugins/@nocobase/plugin-graph-collection-manager/package.json @@ -4,7 +4,7 @@ "displayName.zh-CN": "可视化数据表管理", "description": "An ER diagram-like tool. Currently only the Master database is supported.", "description.zh-CN": "类似 ER 图的工具,目前只支持主数据库。", - "version": "1.2.34-alpha", + "version": "1.2.35-alpha", "license": "AGPL-3.0", "main": "./dist/server/index.js", "homepage": "https://docs.nocobase.com/handbook/graph-collection-manager", diff --git a/packages/plugins/@nocobase/plugin-kanban/package.json b/packages/plugins/@nocobase/plugin-kanban/package.json index 121eaf8f64..e5f47f4b04 100644 --- a/packages/plugins/@nocobase/plugin-kanban/package.json +++ b/packages/plugins/@nocobase/plugin-kanban/package.json @@ -1,6 +1,6 @@ { "name": "@nocobase/plugin-kanban", - "version": "1.2.34-alpha", + "version": "1.2.35-alpha", "main": "dist/server/index.js", "homepage": "https://docs.nocobase.com/handbook/block-kanban", "homepage.zh-CN": "https://docs-cn.nocobase.com/handbook/block-kanban", diff --git a/packages/plugins/@nocobase/plugin-localization/package.json b/packages/plugins/@nocobase/plugin-localization/package.json index ac1fc933b0..f31180f449 100644 --- a/packages/plugins/@nocobase/plugin-localization/package.json +++ b/packages/plugins/@nocobase/plugin-localization/package.json @@ -1,6 +1,6 @@ { "name": "@nocobase/plugin-localization", - "version": "1.2.34-alpha", + "version": "1.2.35-alpha", "main": "dist/server/index.js", "homepage": "https://docs.nocobase.com/handbook/localization-management", "homepage.zh-CN": "https://docs-cn.nocobase.com/handbook/localization-management", diff --git a/packages/plugins/@nocobase/plugin-logger/package.json b/packages/plugins/@nocobase/plugin-logger/package.json index bf605b31f5..bd2edd90c3 100644 --- a/packages/plugins/@nocobase/plugin-logger/package.json +++ b/packages/plugins/@nocobase/plugin-logger/package.json @@ -4,7 +4,7 @@ "displayName.zh-CN": "日志", "description": "Server-side logs, mainly including API request logs and system runtime logs, and allows to package and download log files.", "description.zh-CN": "服务端日志,主要包括接口请求日志和系统运行日志,并支持打包和下载日志文件。", - "version": "1.2.34-alpha", + "version": "1.2.35-alpha", "license": "AGPL-3.0", "main": "dist/server/index.js", "homepage": "https://docs.nocobase.com/handbook/logger", diff --git a/packages/plugins/@nocobase/plugin-map/package.json b/packages/plugins/@nocobase/plugin-map/package.json index 1ef5addc0f..d1b3bed3f3 100644 --- a/packages/plugins/@nocobase/plugin-map/package.json +++ b/packages/plugins/@nocobase/plugin-map/package.json @@ -2,7 +2,7 @@ "name": "@nocobase/plugin-map", "displayName": "Block: Map", "displayName.zh-CN": "区块:地图", - "version": "1.2.34-alpha", + "version": "1.2.35-alpha", "description": "Map block, support Gaode map and Google map, you can also extend more map types.", "description.zh-CN": "地图区块,支持高德地图和 Google 地图,你也可以扩展更多地图类型。", "license": "AGPL-3.0", diff --git a/packages/plugins/@nocobase/plugin-mobile-client/package.json b/packages/plugins/@nocobase/plugin-mobile-client/package.json index 7b504b8e3d..df3b0ebaa3 100644 --- a/packages/plugins/@nocobase/plugin-mobile-client/package.json +++ b/packages/plugins/@nocobase/plugin-mobile-client/package.json @@ -1,6 +1,6 @@ { "name": "@nocobase/plugin-mobile-client", - "version": "1.2.34-alpha", + "version": "1.2.35-alpha", "main": "./dist/server/index.js", "homepage": "https://docs.nocobase.com/handbook/mobile-client", "homepage.zh-CN": "https://docs-cn.nocobase.com/handbook/mobile-client", diff --git a/packages/plugins/@nocobase/plugin-mock-collections/package.json b/packages/plugins/@nocobase/plugin-mock-collections/package.json index 79fe255ed3..8608de8ed9 100644 --- a/packages/plugins/@nocobase/plugin-mock-collections/package.json +++ b/packages/plugins/@nocobase/plugin-mock-collections/package.json @@ -2,7 +2,7 @@ "name": "@nocobase/plugin-mock-collections", "displayName": "mock-collections", "description": "mock-collections", - "version": "1.2.34-alpha", + "version": "1.2.35-alpha", "main": "./dist/server/index.js", "license": "AGPL-3.0", "peerDependencies": { diff --git a/packages/plugins/@nocobase/plugin-multi-app-manager/package.json b/packages/plugins/@nocobase/plugin-multi-app-manager/package.json index 6b53a0024d..de52f237a2 100644 --- a/packages/plugins/@nocobase/plugin-multi-app-manager/package.json +++ b/packages/plugins/@nocobase/plugin-multi-app-manager/package.json @@ -4,7 +4,7 @@ "displayName.zh-CN": "多应用管理器", "description": "Dynamically create multiple apps without separate deployments.", "description.zh-CN": "无需单独部署即可动态创建多个应用。", - "version": "1.2.34-alpha", + "version": "1.2.35-alpha", "license": "AGPL-3.0", "main": "./dist/server/index.js", "homepage": "https://docs.nocobase.com/handbook/multi-app-manager", diff --git a/packages/plugins/@nocobase/plugin-multi-app-share-collection/package.json b/packages/plugins/@nocobase/plugin-multi-app-share-collection/package.json index cf31ed2cae..97be8eef9e 100644 --- a/packages/plugins/@nocobase/plugin-multi-app-share-collection/package.json +++ b/packages/plugins/@nocobase/plugin-multi-app-share-collection/package.json @@ -4,7 +4,7 @@ "displayName.zh-CN": "多应用数据表共享", "description": "", "description.zh-CN": "", - "version": "1.2.34-alpha", + "version": "1.2.35-alpha", "main": "./dist/server/index.js", "devDependencies": { "@formily/react": "2.x", diff --git a/packages/plugins/@nocobase/plugin-notifications/package.json b/packages/plugins/@nocobase/plugin-notifications/package.json index 35821b5179..2fc40a7d3f 100644 --- a/packages/plugins/@nocobase/plugin-notifications/package.json +++ b/packages/plugins/@nocobase/plugin-notifications/package.json @@ -1,6 +1,6 @@ { "name": "@nocobase/plugin-notifications", - "version": "1.2.34-alpha", + "version": "1.2.35-alpha", "description": "", "license": "AGPL-3.0", "main": "./dist/server/index.js", diff --git a/packages/plugins/@nocobase/plugin-sample-hello/package.json b/packages/plugins/@nocobase/plugin-sample-hello/package.json index 0835018b92..e206c58dbc 100644 --- a/packages/plugins/@nocobase/plugin-sample-hello/package.json +++ b/packages/plugins/@nocobase/plugin-sample-hello/package.json @@ -1,6 +1,6 @@ { "name": "@nocobase/plugin-sample-hello", - "version": "1.2.34-alpha", + "version": "1.2.35-alpha", "main": "./dist/server/index.js", "displayName": "Hello", "displayName.zh-CN": "Hello", diff --git a/packages/plugins/@nocobase/plugin-snapshot-field/package.json b/packages/plugins/@nocobase/plugin-snapshot-field/package.json index 5e565b00ad..53bbae01c3 100644 --- a/packages/plugins/@nocobase/plugin-snapshot-field/package.json +++ b/packages/plugins/@nocobase/plugin-snapshot-field/package.json @@ -4,7 +4,7 @@ "displayName.zh-CN": "数据表字段:关系快照", "description": "When adding a new record, create a snapshot for its relational record and save in the new record. The snapshot will not be updated when the relational record is updated.", "description.zh-CN": "在添加数据时,为它的关系数据创建快照,并保存在当前的数据中。关系数据更新时,快照不会更新。", - "version": "1.2.34-alpha", + "version": "1.2.35-alpha", "license": "AGPL-3.0", "main": "./dist/server/index.js", "homepage": "https://docs.nocobase.com/handbook/field-snapshot", diff --git a/packages/plugins/@nocobase/plugin-system-settings/package.json b/packages/plugins/@nocobase/plugin-system-settings/package.json index fd390ece14..152c957925 100644 --- a/packages/plugins/@nocobase/plugin-system-settings/package.json +++ b/packages/plugins/@nocobase/plugin-system-settings/package.json @@ -4,7 +4,7 @@ "displayName.zh-CN": "系统设置", "description": "Used to adjust the system title, logo, language, etc.", "description.zh-CN": "用于调整系统的标题、LOGO、语言等。", - "version": "1.2.34-alpha", + "version": "1.2.35-alpha", "license": "AGPL-3.0", "main": "./dist/server/index.js", "homepage": "https://docs.nocobase.com/handbook/system-settings", diff --git a/packages/plugins/@nocobase/plugin-theme-editor/package.json b/packages/plugins/@nocobase/plugin-theme-editor/package.json index d01debbff2..8459cd7376 100644 --- a/packages/plugins/@nocobase/plugin-theme-editor/package.json +++ b/packages/plugins/@nocobase/plugin-theme-editor/package.json @@ -1,6 +1,6 @@ { "name": "@nocobase/plugin-theme-editor", - "version": "1.2.34-alpha", + "version": "1.2.35-alpha", "main": "dist/server/index.js", "homepage": "https://docs.nocobase.com/handbook/theme-editor", "homepage.zh-CN": "https://docs-cn.nocobase.com/handbook/theme-editor", diff --git a/packages/plugins/@nocobase/plugin-ui-schema-storage/package.json b/packages/plugins/@nocobase/plugin-ui-schema-storage/package.json index 1d4c49c3b7..b9bec1d66b 100644 --- a/packages/plugins/@nocobase/plugin-ui-schema-storage/package.json +++ b/packages/plugins/@nocobase/plugin-ui-schema-storage/package.json @@ -4,7 +4,7 @@ "displayName.zh-CN": "UI schema 存储服务", "description": "Provides centralized UI schema storage service.", "description.zh-CN": "提供中心化的 UI schema 存储服务。", - "version": "1.2.34-alpha", + "version": "1.2.35-alpha", "license": "AGPL-3.0", "main": "./dist/server/index.js", "homepage": "https://docs.nocobase.com/handbook/ui-schema-storage", diff --git a/packages/plugins/@nocobase/plugin-users/package.json b/packages/plugins/@nocobase/plugin-users/package.json index d43f63c20e..e129c86fda 100644 --- a/packages/plugins/@nocobase/plugin-users/package.json +++ b/packages/plugins/@nocobase/plugin-users/package.json @@ -4,7 +4,7 @@ "displayName.zh-CN": "用户", "description": "Provides basic user model, as well as created by and updated by fields.", "description.zh-CN": "提供了基础的用户模型,以及创建人和最后更新人字段。", - "version": "1.2.34-alpha", + "version": "1.2.35-alpha", "license": "AGPL-3.0", "main": "./dist/server/index.js", "homepage": "https://docs.nocobase.com/handbook/users", diff --git a/packages/plugins/@nocobase/plugin-verification/package.json b/packages/plugins/@nocobase/plugin-verification/package.json index 43f795cd5d..aaf88349a5 100644 --- a/packages/plugins/@nocobase/plugin-verification/package.json +++ b/packages/plugins/@nocobase/plugin-verification/package.json @@ -4,7 +4,7 @@ "displayName.zh-CN": "验证码", "description": "verification setting.", "description.zh-CN": "验证码配置。", - "version": "1.2.34-alpha", + "version": "1.2.35-alpha", "license": "AGPL-3.0", "main": "./dist/server/index.js", "homepage": "https://docs.nocobase.com/handbook/verification", diff --git a/packages/plugins/@nocobase/plugin-workflow-action-trigger/package.json b/packages/plugins/@nocobase/plugin-workflow-action-trigger/package.json index 79885466af..6a2d86b9ae 100644 --- a/packages/plugins/@nocobase/plugin-workflow-action-trigger/package.json +++ b/packages/plugins/@nocobase/plugin-workflow-action-trigger/package.json @@ -4,7 +4,7 @@ "displayName.zh-CN": "工作流:操作后事件", "description": "Triggered after the completion of a request initiated through an action button or API, such as after adding, updating, deleting data, or \"submit to workflow\". Suitable for data processing, sending notifications, etc., after actions are completed.", "description.zh-CN": "通过操作按钮或 API 发起请求并在执行完成后触发,比如新增、更新、删除数据或者“提交至工作流”之后。适用于在操作完成后进行数据处理、发送通知等。", - "version": "1.2.34-alpha", + "version": "1.2.35-alpha", "license": "AGPL-3.0", "main": "./dist/server/index.js", "homepage": "https://docs.nocobase.com/plugins/workflow-action-trigger", diff --git a/packages/plugins/@nocobase/plugin-workflow-aggregate/package.json b/packages/plugins/@nocobase/plugin-workflow-aggregate/package.json index e2765c3335..542f6b64d7 100644 --- a/packages/plugins/@nocobase/plugin-workflow-aggregate/package.json +++ b/packages/plugins/@nocobase/plugin-workflow-aggregate/package.json @@ -4,7 +4,7 @@ "displayName.zh-CN": "工作流:聚合查询节点", "description": "Used to aggregate data against the database in workflow, such as: statistics, sum, average, etc.", "description.zh-CN": "可用于在工作流中对数据库进行聚合查询,如:统计数量、求和、平均值等。", - "version": "1.2.34-alpha", + "version": "1.2.35-alpha", "license": "AGPL-3.0", "main": "./dist/server/index.js", "homepage": "https://docs.nocobase.com/handbook/workflow-aggregate", diff --git a/packages/plugins/@nocobase/plugin-workflow-delay/package.json b/packages/plugins/@nocobase/plugin-workflow-delay/package.json index 14244d0b1d..4ec554467e 100644 --- a/packages/plugins/@nocobase/plugin-workflow-delay/package.json +++ b/packages/plugins/@nocobase/plugin-workflow-delay/package.json @@ -4,7 +4,7 @@ "displayName.zh-CN": "工作流:延时节点", "description": "Could be used in workflow parallel branch for waiting other branches.", "description.zh-CN": "可用于工作流并行分支中等待其他分支执行完成。", - "version": "1.2.34-alpha", + "version": "1.2.35-alpha", "license": "AGPL-3.0", "main": "./dist/server/index.js", "homepage": "https://docs.nocobase.com/handbook/workflow-delay", diff --git a/packages/plugins/@nocobase/plugin-workflow-dynamic-calculation/package.json b/packages/plugins/@nocobase/plugin-workflow-dynamic-calculation/package.json index 3cfd04e96a..ee3be97109 100644 --- a/packages/plugins/@nocobase/plugin-workflow-dynamic-calculation/package.json +++ b/packages/plugins/@nocobase/plugin-workflow-dynamic-calculation/package.json @@ -4,7 +4,7 @@ "displayName.zh-CN": "工作流:动态表达式计算节点", "description": "Useful plugin for doing dynamic calculation based on expression collection records in workflow.", "description.zh-CN": "用于在工作流中进行基于数据行的动态表达式计算。", - "version": "1.2.34-alpha", + "version": "1.2.35-alpha", "license": "AGPL-3.0", "main": "./dist/server/index.js", "homepage": "https://docs.nocobase.com/handbook/workflow-dynamic-calculation", diff --git a/packages/plugins/@nocobase/plugin-workflow-loop/package.json b/packages/plugins/@nocobase/plugin-workflow-loop/package.json index 8e6060b8fb..4641ebe69d 100644 --- a/packages/plugins/@nocobase/plugin-workflow-loop/package.json +++ b/packages/plugins/@nocobase/plugin-workflow-loop/package.json @@ -4,7 +4,7 @@ "displayName.zh-CN": "工作流:循环节点", "description": "Used to repeat the sub-process processing of each value in an array, and can also be used for fixed times of sub-process processing.", "description.zh-CN": "用于对一个数组中的每个值进行重复的子流程处理,也可用于固定次数的重复子流程处理。", - "version": "1.2.34-alpha", + "version": "1.2.35-alpha", "license": "AGPL-3.0", "main": "./dist/server/index.js", "homepage": "https://docs.nocobase.com/handbook/workflow-loop", diff --git a/packages/plugins/@nocobase/plugin-workflow-mailer/package.json b/packages/plugins/@nocobase/plugin-workflow-mailer/package.json index e42ad7c8e2..0a3931336a 100644 --- a/packages/plugins/@nocobase/plugin-workflow-mailer/package.json +++ b/packages/plugins/@nocobase/plugin-workflow-mailer/package.json @@ -4,7 +4,7 @@ "displayName.zh-CN": "工作流:邮件发送节点", "description": "Send email in workflow.", "description.zh-CN": "可用于在工作流中发送电子邮件。", - "version": "1.2.34-alpha", + "version": "1.2.35-alpha", "license": "AGPL-3.0", "main": "./dist/server/index.js", "homepage": "https://docs.nocobase.com/handbook/workflow-smtp-mailer", diff --git a/packages/plugins/@nocobase/plugin-workflow-manual/package.json b/packages/plugins/@nocobase/plugin-workflow-manual/package.json index 0a4dfc3592..f78fed03fc 100644 --- a/packages/plugins/@nocobase/plugin-workflow-manual/package.json +++ b/packages/plugins/@nocobase/plugin-workflow-manual/package.json @@ -4,7 +4,7 @@ "displayName.zh-CN": "工作流:人工处理节点", "description": "Could be used for workflows which some of decisions are made by users.", "description.zh-CN": "用于人工控制部分决策的流程。", - "version": "1.2.34-alpha", + "version": "1.2.35-alpha", "license": "AGPL-3.0", "main": "./dist/server/index.js", "homepage": "https://docs.nocobase.com/handbook/workflow-manual", diff --git a/packages/plugins/@nocobase/plugin-workflow-parallel/package.json b/packages/plugins/@nocobase/plugin-workflow-parallel/package.json index 9629b7896f..16e8706550 100644 --- a/packages/plugins/@nocobase/plugin-workflow-parallel/package.json +++ b/packages/plugins/@nocobase/plugin-workflow-parallel/package.json @@ -4,7 +4,7 @@ "displayName.zh-CN": "工作流:并行分支节点", "description": "Could be used for parallel execution of branch processes in the workflow.", "description.zh-CN": "用于在工作流中需要并行执行的分支流程。", - "version": "1.2.34-alpha", + "version": "1.2.35-alpha", "license": "AGPL-3.0", "main": "./dist/server/index.js", "homepage": "https://docs.nocobase.com/handbook/workflow-parallel", diff --git a/packages/plugins/@nocobase/plugin-workflow-request/package.json b/packages/plugins/@nocobase/plugin-workflow-request/package.json index bcdc490eee..a43e1ef177 100644 --- a/packages/plugins/@nocobase/plugin-workflow-request/package.json +++ b/packages/plugins/@nocobase/plugin-workflow-request/package.json @@ -4,7 +4,7 @@ "displayName.zh-CN": "工作流:HTTP 请求节点", "description": "Send HTTP requests to any HTTP service for data interaction in workflow.", "description.zh-CN": "可用于在工作流中向任意 HTTP 服务发送请求,进行数据交互。", - "version": "1.2.34-alpha", + "version": "1.2.35-alpha", "license": "AGPL-3.0", "main": "./dist/server/index.js", "homepage": "https://docs.nocobase.com/handbook/workflow-request", diff --git a/packages/plugins/@nocobase/plugin-workflow-sql/package.json b/packages/plugins/@nocobase/plugin-workflow-sql/package.json index 02dd14d902..0f431d60e1 100644 --- a/packages/plugins/@nocobase/plugin-workflow-sql/package.json +++ b/packages/plugins/@nocobase/plugin-workflow-sql/package.json @@ -4,7 +4,7 @@ "displayName.zh-CN": "工作流:SQL 节点", "description": "Execute SQL statements in workflow.", "description.zh-CN": "可用于在工作流中对数据库执行任意 SQL 语句。", - "version": "1.2.34-alpha", + "version": "1.2.35-alpha", "license": "AGPL-3.0", "main": "./dist/server/index.js", "homepage": "https://docs.nocobase.com/handbook/workflow-sql", diff --git a/packages/plugins/@nocobase/plugin-workflow-test/package.json b/packages/plugins/@nocobase/plugin-workflow-test/package.json index 48dcd89be3..63b69eb9bb 100644 --- a/packages/plugins/@nocobase/plugin-workflow-test/package.json +++ b/packages/plugins/@nocobase/plugin-workflow-test/package.json @@ -2,7 +2,7 @@ "name": "@nocobase/plugin-workflow-test", "displayName": "Workflow: test kit", "displayName.zh-CN": "工作流:测试工具包", - "version": "1.2.34-alpha", + "version": "1.2.35-alpha", "license": "AGPL-3.0", "main": "dist/server/index.js", "types": "./dist/server/index.d.ts", diff --git a/packages/plugins/@nocobase/plugin-workflow/package.json b/packages/plugins/@nocobase/plugin-workflow/package.json index 0fb63b6b2f..aa5725c96b 100644 --- a/packages/plugins/@nocobase/plugin-workflow/package.json +++ b/packages/plugins/@nocobase/plugin-workflow/package.json @@ -4,13 +4,13 @@ "displayName.zh-CN": "工作流", "description": "A powerful BPM tool that provides foundational support for business automation, with the capability to extend unlimited triggers and nodes.", "description.zh-CN": "一个强大的 BPM 工具,为业务自动化提供基础支持,并且可任意扩展更多的触发器和节点。", - "version": "1.2.34-alpha", + "version": "1.2.35-alpha", "license": "AGPL-3.0", "main": "./dist/server/index.js", "homepage": "https://docs.nocobase.com/handbook/workflow", "homepage.zh-CN": "https://docs-cn.nocobase.com/handbook/workflow", "dependencies": { - "@nocobase/plugin-workflow-test": "1.2.34-alpha" + "@nocobase/plugin-workflow-test": "1.2.35-alpha" }, "devDependencies": { "@ant-design/icons": "5.x", diff --git a/packages/presets/nocobase/package.json b/packages/presets/nocobase/package.json index a60faa99ae..bd6d472b50 100644 --- a/packages/presets/nocobase/package.json +++ b/packages/presets/nocobase/package.json @@ -1,67 +1,67 @@ { "name": "@nocobase/preset-nocobase", - "version": "1.2.34-alpha", + "version": "1.2.35-alpha", "license": "AGPL-3.0", "main": "./lib/server/index.js", "dependencies": { "@formily/json-schema": "2.x", - "@nocobase/plugin-acl": "1.2.34-alpha", - "@nocobase/plugin-action-bulk-edit": "1.2.34-alpha", - "@nocobase/plugin-action-bulk-update": "1.2.34-alpha", - "@nocobase/plugin-action-custom-request": "1.2.34-alpha", - "@nocobase/plugin-action-duplicate": "1.2.34-alpha", - "@nocobase/plugin-action-export": "1.2.34-alpha", - "@nocobase/plugin-action-import": "1.2.34-alpha", - "@nocobase/plugin-action-print": "1.2.34-alpha", - "@nocobase/plugin-api-doc": "1.2.34-alpha", - "@nocobase/plugin-api-keys": "1.2.34-alpha", - "@nocobase/plugin-audit-logs": "1.2.34-alpha", - "@nocobase/plugin-auth": "1.2.34-alpha", - "@nocobase/plugin-auth-sms": "1.2.34-alpha", - "@nocobase/plugin-backup-restore": "1.2.34-alpha", - "@nocobase/plugin-block-iframe": "1.2.34-alpha", - "@nocobase/plugin-block-workbench": "1.2.34-alpha", - "@nocobase/plugin-calendar": "1.2.34-alpha", - "@nocobase/plugin-charts": "1.2.34-alpha", - "@nocobase/plugin-client": "1.2.34-alpha", - "@nocobase/plugin-collection-sql": "1.2.34-alpha", - "@nocobase/plugin-data-source-main": "1.2.34-alpha", - "@nocobase/plugin-data-source-manager": "1.2.34-alpha", - "@nocobase/plugin-data-visualization": "1.2.34-alpha", - "@nocobase/plugin-error-handler": "1.2.34-alpha", - "@nocobase/plugin-field-china-region": "1.2.34-alpha", - "@nocobase/plugin-field-formula": "1.2.34-alpha", - "@nocobase/plugin-field-markdown-vditor": "1.2.34-alpha", - "@nocobase/plugin-field-sequence": "1.2.34-alpha", - "@nocobase/plugin-file-manager": "1.2.34-alpha", - "@nocobase/plugin-gantt": "1.2.34-alpha", - "@nocobase/plugin-graph-collection-manager": "1.2.34-alpha", - "@nocobase/plugin-kanban": "1.2.34-alpha", - "@nocobase/plugin-localization": "1.2.34-alpha", - "@nocobase/plugin-logger": "1.2.34-alpha", - "@nocobase/plugin-map": "1.2.34-alpha", - "@nocobase/plugin-mobile-client": "1.2.34-alpha", - "@nocobase/plugin-mock-collections": "1.2.34-alpha", - "@nocobase/plugin-multi-app-manager": "1.2.34-alpha", - "@nocobase/plugin-multi-app-share-collection": "1.2.34-alpha", - "@nocobase/plugin-snapshot-field": "1.2.34-alpha", - "@nocobase/plugin-system-settings": "1.2.34-alpha", - "@nocobase/plugin-theme-editor": "1.2.34-alpha", - "@nocobase/plugin-ui-schema-storage": "1.2.34-alpha", - "@nocobase/plugin-users": "1.2.34-alpha", - "@nocobase/plugin-verification": "1.2.34-alpha", - "@nocobase/plugin-workflow": "1.2.34-alpha", - "@nocobase/plugin-workflow-action-trigger": "1.2.34-alpha", - "@nocobase/plugin-workflow-aggregate": "1.2.34-alpha", - "@nocobase/plugin-workflow-delay": "1.2.34-alpha", - "@nocobase/plugin-workflow-dynamic-calculation": "1.2.34-alpha", - "@nocobase/plugin-workflow-loop": "1.2.34-alpha", - "@nocobase/plugin-workflow-mailer": "1.2.34-alpha", - "@nocobase/plugin-workflow-manual": "1.2.34-alpha", - "@nocobase/plugin-workflow-parallel": "1.2.34-alpha", - "@nocobase/plugin-workflow-request": "1.2.34-alpha", - "@nocobase/plugin-workflow-sql": "1.2.34-alpha", - "@nocobase/server": "1.2.34-alpha", + "@nocobase/plugin-acl": "1.2.35-alpha", + "@nocobase/plugin-action-bulk-edit": "1.2.35-alpha", + "@nocobase/plugin-action-bulk-update": "1.2.35-alpha", + "@nocobase/plugin-action-custom-request": "1.2.35-alpha", + "@nocobase/plugin-action-duplicate": "1.2.35-alpha", + "@nocobase/plugin-action-export": "1.2.35-alpha", + "@nocobase/plugin-action-import": "1.2.35-alpha", + "@nocobase/plugin-action-print": "1.2.35-alpha", + "@nocobase/plugin-api-doc": "1.2.35-alpha", + "@nocobase/plugin-api-keys": "1.2.35-alpha", + "@nocobase/plugin-audit-logs": "1.2.35-alpha", + "@nocobase/plugin-auth": "1.2.35-alpha", + "@nocobase/plugin-auth-sms": "1.2.35-alpha", + "@nocobase/plugin-backup-restore": "1.2.35-alpha", + "@nocobase/plugin-block-iframe": "1.2.35-alpha", + "@nocobase/plugin-block-workbench": "1.2.35-alpha", + "@nocobase/plugin-calendar": "1.2.35-alpha", + "@nocobase/plugin-charts": "1.2.35-alpha", + "@nocobase/plugin-client": "1.2.35-alpha", + "@nocobase/plugin-collection-sql": "1.2.35-alpha", + "@nocobase/plugin-data-source-main": "1.2.35-alpha", + "@nocobase/plugin-data-source-manager": "1.2.35-alpha", + "@nocobase/plugin-data-visualization": "1.2.35-alpha", + "@nocobase/plugin-error-handler": "1.2.35-alpha", + "@nocobase/plugin-field-china-region": "1.2.35-alpha", + "@nocobase/plugin-field-formula": "1.2.35-alpha", + "@nocobase/plugin-field-markdown-vditor": "1.2.35-alpha", + "@nocobase/plugin-field-sequence": "1.2.35-alpha", + "@nocobase/plugin-file-manager": "1.2.35-alpha", + "@nocobase/plugin-gantt": "1.2.35-alpha", + "@nocobase/plugin-graph-collection-manager": "1.2.35-alpha", + "@nocobase/plugin-kanban": "1.2.35-alpha", + "@nocobase/plugin-localization": "1.2.35-alpha", + "@nocobase/plugin-logger": "1.2.35-alpha", + "@nocobase/plugin-map": "1.2.35-alpha", + "@nocobase/plugin-mobile-client": "1.2.35-alpha", + "@nocobase/plugin-mock-collections": "1.2.35-alpha", + "@nocobase/plugin-multi-app-manager": "1.2.35-alpha", + "@nocobase/plugin-multi-app-share-collection": "1.2.35-alpha", + "@nocobase/plugin-snapshot-field": "1.2.35-alpha", + "@nocobase/plugin-system-settings": "1.2.35-alpha", + "@nocobase/plugin-theme-editor": "1.2.35-alpha", + "@nocobase/plugin-ui-schema-storage": "1.2.35-alpha", + "@nocobase/plugin-users": "1.2.35-alpha", + "@nocobase/plugin-verification": "1.2.35-alpha", + "@nocobase/plugin-workflow": "1.2.35-alpha", + "@nocobase/plugin-workflow-action-trigger": "1.2.35-alpha", + "@nocobase/plugin-workflow-aggregate": "1.2.35-alpha", + "@nocobase/plugin-workflow-delay": "1.2.35-alpha", + "@nocobase/plugin-workflow-dynamic-calculation": "1.2.35-alpha", + "@nocobase/plugin-workflow-loop": "1.2.35-alpha", + "@nocobase/plugin-workflow-mailer": "1.2.35-alpha", + "@nocobase/plugin-workflow-manual": "1.2.35-alpha", + "@nocobase/plugin-workflow-parallel": "1.2.35-alpha", + "@nocobase/plugin-workflow-request": "1.2.35-alpha", + "@nocobase/plugin-workflow-sql": "1.2.35-alpha", + "@nocobase/server": "1.2.35-alpha", "cronstrue": "^2.11.0" }, "repository": { From 84ca0eb29609d1575874e2392bbe319bad82bf7c Mon Sep 17 00:00:00 2001 From: GitHub Actions Bot Date: Fri, 16 Aug 2024 09:56:21 +0000 Subject: [PATCH 07/13] chore: update changelog --- CHANGELOG.md | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index de25d86c0a..c5cd19e823 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,40 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). +## [v1.2.35-alpha](https://github.com/nocobase/nocobase/compare/v1.2.34-alpha...v1.2.35-alpha) - 2024-08-16 + +### Merged + +- fix: the display of data source status [`#5069`](https://github.com/nocobase/nocobase/pull/5069) +- chore: upgrade mysql2 version [`#5070`](https://github.com/nocobase/nocobase/pull/5070) +- fix: filter form action bar stye improve [`#5054`](https://github.com/nocobase/nocobase/pull/5054) +- fix: quote table name in mysql query interface [`#5065`](https://github.com/nocobase/nocobase/pull/5065) +- fix: collection with non ID as the primary key will encounter an error when using gantt [`#5061`](https://github.com/nocobase/nocobase/pull/5061) +- fix: increase the upload file size limit of field-markdown-vditor [`#5063`](https://github.com/nocobase/nocobase/pull/5063) +- fix(data-vi): dependency typo [`#5060`](https://github.com/nocobase/nocobase/pull/5060) +- chore(deps): bump @babel/plugin-transform-modules-amd from 7.22.5 to 7.24.7 [`#5052`](https://github.com/nocobase/nocobase/pull/5052) +- chore(deps): bump xpipe from 1.0.5 to 1.0.7 [`#5050`](https://github.com/nocobase/nocobase/pull/5050) +- chore(deps): bump tsup from 7.2.0 to 8.2.4 [`#5046`](https://github.com/nocobase/nocobase/pull/5046) +- fix(inherit): correct title for inherited sub-collection association block [`#5048`](https://github.com/nocobase/nocobase/pull/5048) +- fix: load parent field in inherited collection [`#5044`](https://github.com/nocobase/nocobase/pull/5044) +- fix: disable edit and delete button for all records and own record in data scope configuration [`#5041`](https://github.com/nocobase/nocobase/pull/5041) +- fix(Collapse): fix issue with data scope settings being ineffective [`#4914`](https://github.com/nocobase/nocobase/pull/4914) +- fix(Table): should not error when open a popup by clicking a multi-level field [`#5038`](https://github.com/nocobase/nocobase/pull/5038) +- fix(linkageRules): fix an exception when the condition contains a association field [`#5037`](https://github.com/nocobase/nocobase/pull/5037) +- fix(client): missing sort parameter [`#5034`](https://github.com/nocobase/nocobase/pull/5034) +- fix(database): skip table doesn't exist [`#5023`](https://github.com/nocobase/nocobase/pull/5023) +- fix(variable): the chinaRegions field should not be a submenu [`#5030`](https://github.com/nocobase/nocobase/pull/5030) +- style: quick add button for association field in the form, compact theme style without adaptation [`#5024`](https://github.com/nocobase/nocobase/pull/5024) +- fix: correct foreign key value errors [`#5027`](https://github.com/nocobase/nocobase/pull/5027) +- fix: source field type filtering association fields in sql collection & view collection [`#5014`](https://github.com/nocobase/nocobase/pull/5014) +- fix: allowMultiple should not appear on read-only association fields [`#5017`](https://github.com/nocobase/nocobase/pull/5017) + +### Commits + +- chore(versions): 😊 publish v1.2.35-alpha [`39bc571`](https://github.com/nocobase/nocobase/commit/39bc5717881454cb1bf210673418e1be49f45614) +- chore: update changelog [`d37c71a`](https://github.com/nocobase/nocobase/commit/d37c71aaed459a1364a2b04bd478f529472a5ae0) +- Update LICENSE.txt [`28c2fff`](https://github.com/nocobase/nocobase/commit/28c2fff0e48ed135322839ae9f27d1740a351902) + ## [v1.2.34-alpha](https://github.com/nocobase/nocobase/compare/v1.2.33-alpha...v1.2.34-alpha) - 2024-08-08 ### Merged From 2c466db7bb1c1039edea63652327c61ebb3cd6f2 Mon Sep 17 00:00:00 2001 From: Katherine Date: Sat, 17 Aug 2024 17:29:56 +0800 Subject: [PATCH 08/13] fix: the selected data in the sub table is overwritten by default values (#5075) --- .../src/schema-component/antd/association-field/SubTable.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/core/client/src/schema-component/antd/association-field/SubTable.tsx b/packages/core/client/src/schema-component/antd/association-field/SubTable.tsx index 990723f68a..7648c6da63 100644 --- a/packages/core/client/src/schema-component/antd/association-field/SubTable.tsx +++ b/packages/core/client/src/schema-component/antd/association-field/SubTable.tsx @@ -154,6 +154,7 @@ export const SubTable: any = observer( onClick() { selectedRows.map((v) => field.value.push(v)); field.onInput(field.value); + field.initialValue = field.value; setSelectedRows([]); setVisible(false); }, From ea943b303b1c7c592be4c3a473d4a2535cba0a89 Mon Sep 17 00:00:00 2001 From: Katherine Date: Sat, 17 Aug 2024 17:33:34 +0800 Subject: [PATCH 09/13] fix: sorting of Table block data (#5071) --- .../data-blocks/table/hooks/useTableBlockProps.tsx | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/packages/core/client/src/modules/blocks/data-blocks/table/hooks/useTableBlockProps.tsx b/packages/core/client/src/modules/blocks/data-blocks/table/hooks/useTableBlockProps.tsx index 59c9af11ea..ccaf5453ce 100644 --- a/packages/core/client/src/modules/blocks/data-blocks/table/hooks/useTableBlockProps.tsx +++ b/packages/core/client/src/modules/blocks/data-blocks/table/hooks/useTableBlockProps.tsx @@ -78,13 +78,11 @@ export const useTableBlockProps = () => { ), onChange: useCallback( ({ current, pageSize }, filters, sorter) => { - const sort = !ctx.dragSort - ? sorter.order - ? sorter.order === `ascend` - ? [sorter.field] - : [`-${sorter.field}`] - : globalSort || ctx.dragSortBy - : ctx.dragSortBy; + const sort = sorter.order + ? sorter.order === `ascend` + ? [sorter.field] + : [`-${sorter.field}`] + : globalSort || ctx.dragSortBy; const currentPageSize = pageSize || fieldSchema.parent?.['x-decorator-props']?.['params']?.pageSize; const args = { ...params?.[0], page: current || 1, pageSize: currentPageSize }; if (sort) { @@ -92,7 +90,7 @@ export const useTableBlockProps = () => { } ctx.service.run(args); }, - [globalSort, params], + [globalSort, params, ctx.dragSort], ), onClickRow: useCallback( (record, setSelectedRow, selectedRow) => { From b6762ebcdb1e44969733b77f30a5bb62ef055d9e Mon Sep 17 00:00:00 2001 From: Zeke Zhang <958414905@qq.com> Date: Sat, 17 Aug 2024 17:38:52 +0800 Subject: [PATCH 10/13] fix(embed): fix the problem that switching tabs doesn't work (#5074) --- .../src/schema-component/antd/page/Page.tsx | 25 +++++++++- .../antd/page/__tests__/page.test.tsx | 49 +++++++++++++++++-- 2 files changed, 69 insertions(+), 5 deletions(-) diff --git a/packages/core/client/src/schema-component/antd/page/Page.tsx b/packages/core/client/src/schema-component/antd/page/Page.tsx index 28c93b84ee..77df149e1a 100644 --- a/packages/core/client/src/schema-component/antd/page/Page.tsx +++ b/packages/core/client/src/schema-component/antd/page/Page.tsx @@ -17,7 +17,7 @@ import classNames from 'classnames'; import React, { memo, useCallback, useContext, useEffect, useMemo, useState } from 'react'; import { ErrorBoundary } from 'react-error-boundary'; import { useTranslation } from 'react-i18next'; -import { Outlet, useOutletContext, useParams, useSearchParams } from 'react-router-dom'; +import { NavigateFunction, Outlet, useOutletContext, useParams, useSearchParams } from 'react-router-dom'; import { FormDialog } from '..'; import { useStyles as useAClStyles } from '../../../acl/style'; import { useRequest } from '../../../api-client'; @@ -112,7 +112,7 @@ export const Page = (props) => { }} onChange={(activeKey) => { setLoading(true); - navigate(`/admin/${pageUid}/tabs/${activeKey}`, { replace: true }); + navigateToTab(activeKey, navigate); setTimeout(() => { setLoading(false); }, 50); @@ -319,3 +319,24 @@ const PageContent = memo( }, ); PageContent.displayName = 'PageContent'; + +export function navigateToTab(activeKey: string, navigate: NavigateFunction, pathname = window.location.pathname) { + if (pathname.endsWith('/')) { + pathname = pathname.slice(0, -1); + } + + if (isTabPage(pathname)) { + navigate(`${pathname.replace(/\/tabs\/[^/]+$/, `/tabs/${activeKey}`)}`, { replace: true }); + } else { + navigate(`${pathname}/tabs/${activeKey}`, { replace: true }); + } +} + +export function isTabPage(pathname: string) { + if (pathname.endsWith('/')) { + pathname = pathname.slice(0, -1); + } + + const list = pathname.split('/'); + return list[list.length - 2] === 'tabs'; +} diff --git a/packages/core/client/src/schema-component/antd/page/__tests__/page.test.tsx b/packages/core/client/src/schema-component/antd/page/__tests__/page.test.tsx index 22a338ebaf..1eb0fb6070 100644 --- a/packages/core/client/src/schema-component/antd/page/__tests__/page.test.tsx +++ b/packages/core/client/src/schema-component/antd/page/__tests__/page.test.tsx @@ -7,11 +7,11 @@ * For more information, please refer to: https://www.nocobase.com/agreement. */ -import { render, screen, waitFor, renderAppOptions, userEvent } from '@nocobase/test/client'; +import { DocumentTitleProvider, Form, FormItem, Grid, IconPicker, Input } from '@nocobase/client'; +import { render, renderAppOptions, screen, userEvent, waitFor } from '@nocobase/test/client'; import React from 'react'; import App1 from '../demos/demo1'; -import { Page } from '../Page'; -import { DocumentTitleProvider, Form, FormItem, Grid, IconPicker, Input } from '@nocobase/client'; +import { isTabPage, navigateToTab, Page } from '../Page'; describe('Page', () => { it('should render correctly', async () => { @@ -159,3 +159,46 @@ describe('Page', () => { }); }); }); + +describe('utils', () => { + it('isTabPage', () => { + expect(isTabPage('/admin')).toBe(false); + expect(isTabPage('/admin/test/tabs/tabId')).toBe(true); + expect(isTabPage('/admin/test/tabs/tabId/')).toBe(true); + }); + + it('navigateToTab', () => { + const navigate1 = vi.fn(); + const navigate2 = vi.fn(); + const navigate3 = vi.fn(); + const navigate4 = vi.fn(); + const navigate5 = vi.fn(); + const navigate6 = vi.fn(); + const navigate7 = vi.fn(); + const navigate8 = vi.fn(); + + navigateToTab('tabId', navigate1, '/admin/test'); + expect(navigate1).toBeCalledWith('/admin/test/tabs/tabId', { replace: true }); + + navigateToTab('tabId', navigate2, '/admin/test/'); + expect(navigate2).toBeCalledWith('/admin/test/tabs/tabId', { replace: true }); + + navigateToTab('tabId', navigate3, '/admin/test/tabs/oldTabId'); + expect(navigate3).toBeCalledWith('/admin/test/tabs/tabId', { replace: true }); + + navigateToTab('tabId', navigate4, '/admin/test/tabs/oldTabId/'); + expect(navigate4).toBeCalledWith('/admin/test/tabs/tabId', { replace: true }); + + navigateToTab('tabId', navigate5, '/admin/test/tabs/tab1/pages/pageId/tabs/tab2'); + expect(navigate5).toBeCalledWith('/admin/test/tabs/tab1/pages/pageId/tabs/tabId', { replace: true }); + + navigateToTab('tabId', navigate6, '/admin/test/tabs/tab1/pages/pageId/tabs/tab2/'); + expect(navigate6).toBeCalledWith('/admin/test/tabs/tab1/pages/pageId/tabs/tabId', { replace: true }); + + navigateToTab('tabId', navigate7, '/admin/test/tabs/tab1/pages/pageId'); + expect(navigate7).toBeCalledWith('/admin/test/tabs/tab1/pages/pageId/tabs/tabId', { replace: true }); + + navigateToTab('tabId', navigate8, '/admin/test/tabs/tab1/pages/pageId/'); + expect(navigate8).toBeCalledWith('/admin/test/tabs/tab1/pages/pageId/tabs/tabId', { replace: true }); + }); +}); From b152b33c0633645d024bd18ffcc2a4dbaf441496 Mon Sep 17 00:00:00 2001 From: Katherine Date: Sat, 17 Aug 2024 17:48:44 +0800 Subject: [PATCH 11/13] refactor: markdown rendering engine (#5079) --- packages/core/client/src/locale/zh-CN.json | 2 +- .../blocks/other-blocks/markdown/markdownBlockSettings.ts | 8 ++++---- .../src/schema-settings/SchemaSettingsRenderEngine.tsx | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/core/client/src/locale/zh-CN.json b/packages/core/client/src/locale/zh-CN.json index 84c45b1c84..53b5c0fcb6 100644 --- a/packages/core/client/src/locale/zh-CN.json +++ b/packages/core/client/src/locale/zh-CN.json @@ -967,7 +967,7 @@ "Clear default value": "清除默认值", "Open in new window": "新窗口打开", "Sorry, the page you visited does not exist.": "抱歉,你访问的页面不存在。", - "Set Template Engine": "设置模板引擎", + "Template engine": "模板引擎", "Default value to current time":"设置字段默认值为当前时间", "Automatically update timestamp on update":"当记录更新时自动设置字段值为当前时间", "Client's time zone":"客户端时区" diff --git a/packages/core/client/src/modules/blocks/other-blocks/markdown/markdownBlockSettings.ts b/packages/core/client/src/modules/blocks/other-blocks/markdown/markdownBlockSettings.ts index dd49f15815..aecb5cd040 100644 --- a/packages/core/client/src/modules/blocks/other-blocks/markdown/markdownBlockSettings.ts +++ b/packages/core/client/src/modules/blocks/other-blocks/markdown/markdownBlockSettings.ts @@ -30,14 +30,14 @@ export const markdownBlockSettings = new SchemaSettings({ }; }, }, - { - name: 'setBlockTemplate', - Component: SchemaSettingsRenderEngine, - }, { name: 'setTheBlockHeight', Component: SchemaSettingsBlockHeightItem, }, + { + name: 'setBlockTemplate', + Component: SchemaSettingsRenderEngine, + }, { name: 'divider', type: 'divider', diff --git a/packages/core/client/src/schema-settings/SchemaSettingsRenderEngine.tsx b/packages/core/client/src/schema-settings/SchemaSettingsRenderEngine.tsx index b0611841bd..602f6c54ae 100644 --- a/packages/core/client/src/schema-settings/SchemaSettingsRenderEngine.tsx +++ b/packages/core/client/src/schema-settings/SchemaSettingsRenderEngine.tsx @@ -34,7 +34,7 @@ export function SchemaSettingsRenderEngine() { return ( { From e61e6d08425c9e27f7035eb6453b646f0e675aeb Mon Sep 17 00:00:00 2001 From: Zeke Zhang <958414905@qq.com> Date: Sat, 17 Aug 2024 22:38:59 +0800 Subject: [PATCH 12/13] fix(kanban): correct componentType to 'Kanban' (#5080) --- .../plugin-kanban/src/client/KanbanBlockInitializer.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/plugins/@nocobase/plugin-kanban/src/client/KanbanBlockInitializer.tsx b/packages/plugins/@nocobase/plugin-kanban/src/client/KanbanBlockInitializer.tsx index d7f959f30e..6cee96190c 100644 --- a/packages/plugins/@nocobase/plugin-kanban/src/client/KanbanBlockInitializer.tsx +++ b/packages/plugins/@nocobase/plugin-kanban/src/client/KanbanBlockInitializer.tsx @@ -130,7 +130,7 @@ export const KanbanBlockInitializer = ({ return ( } onCreateBlockSchema={async (options) => { if (createBlockSchema) { From 70d96c3e33943efc46917744512134d0493fb314 Mon Sep 17 00:00:00 2001 From: Zeke Zhang <958414905@qq.com> Date: Sun, 18 Aug 2024 08:38:52 +0800 Subject: [PATCH 13/13] fix: resolve tab switching issue (#5081) * refactor: convert parameters to destructured object * fix: resolve tab switching issue in multi-app pages * fix: fix ineffective tab switching within nested popups --- .../client/src/application/hooks/index.ts | 3 +- .../application/hooks/useRouterBasename.ts | 19 ++ .../client/src/block-provider/hooks/index.ts | 7 +- .../src/schema-component/antd/page/Page.tsx | 23 ++- .../schema-component/antd/page/PagePopups.tsx | 7 +- .../antd/page/__tests__/page.test.tsx | 168 +++++++++++++++++- 6 files changed, 208 insertions(+), 19 deletions(-) create mode 100644 packages/core/client/src/application/hooks/useRouterBasename.ts diff --git a/packages/core/client/src/application/hooks/index.ts b/packages/core/client/src/application/hooks/index.ts index 2f22a369a1..1a1ce63405 100644 --- a/packages/core/client/src/application/hooks/index.ts +++ b/packages/core/client/src/application/hooks/index.ts @@ -8,6 +8,7 @@ */ export * from './useApp'; +export * from './useAppSpin'; export * from './usePlugin'; export * from './useRouter'; -export * from './useAppSpin'; +export * from './useRouterBasename'; diff --git a/packages/core/client/src/application/hooks/useRouterBasename.ts b/packages/core/client/src/application/hooks/useRouterBasename.ts new file mode 100644 index 0000000000..9460f72b94 --- /dev/null +++ b/packages/core/client/src/application/hooks/useRouterBasename.ts @@ -0,0 +1,19 @@ +/** + * This file is part of the NocoBase (R) project. + * Copyright (c) 2020-2024 NocoBase Co., Ltd. + * Authors: NocoBase Team. + * + * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License. + * For more information, please refer to: https://www.nocobase.com/agreement. + */ + +import { useHref } from 'react-router-dom'; + +/** + * see: https://stackoverflow.com/questions/50449423/accessing-basename-of-browserouter + * @returns {string} basename + */ +export const useRouterBasename = () => { + const basenameOfCurrentRouter = useHref('/'); + return basenameOfCurrentRouter; +}; diff --git a/packages/core/client/src/block-provider/hooks/index.ts b/packages/core/client/src/block-provider/hooks/index.ts index dde16aa802..e66d10fcb0 100644 --- a/packages/core/client/src/block-provider/hooks/index.ts +++ b/packages/core/client/src/block-provider/hooks/index.ts @@ -20,7 +20,7 @@ import omit from 'lodash/omit'; import qs from 'qs'; import { ChangeEvent, useCallback, useContext, useEffect, useMemo } from 'react'; import { useTranslation } from 'react-i18next'; -import { NavigateFunction, useHref } from 'react-router-dom'; +import { NavigateFunction } from 'react-router-dom'; import { useReactToPrint } from 'react-to-print'; import { AssociationFilter, @@ -28,6 +28,7 @@ import { useCollectionRecord, useDataSourceHeaders, useFormActiveFields, + useRouterBasename, useTableBlockContext, } from '../..'; import { useAPIClient, useRequest } from '../../api-client'; @@ -1594,9 +1595,7 @@ export function useLinkActionProps(componentProps?: any) { const searchParams = componentPropsValue?.['params'] || []; const openInNewWindow = fieldSchema?.['x-component-props']?.['openInNewWindow']; const { parseURLAndParams } = useParseURLAndParams(); - - // see: https://stackoverflow.com/questions/50449423/accessing-basename-of-browserouter - const basenameOfCurrentRouter = useHref('/'); + const basenameOfCurrentRouter = useRouterBasename(); return { type: 'default', diff --git a/packages/core/client/src/schema-component/antd/page/Page.tsx b/packages/core/client/src/schema-component/antd/page/Page.tsx index 77df149e1a..0146258ff8 100644 --- a/packages/core/client/src/schema-component/antd/page/Page.tsx +++ b/packages/core/client/src/schema-component/antd/page/Page.tsx @@ -23,6 +23,7 @@ import { useStyles as useAClStyles } from '../../../acl/style'; import { useRequest } from '../../../api-client'; import { useNavigateNoUpdate } from '../../../application/CustomRouterContextProvider'; import { useAppSpin } from '../../../application/hooks/useAppSpin'; +import { useRouterBasename } from '../../../application/hooks/useRouterBasename'; import { useDocumentTitle } from '../../../document-title'; import { useGlobalTheme } from '../../../global-theme'; import { Icon } from '../../../icon'; @@ -47,6 +48,7 @@ export const Page = (props) => { const { theme } = useGlobalTheme(); const { getAriaLabel } = useGetAriaLabelOfSchemaInitializer(); const { tabUid, name: pageUid } = useParams(); + const basenameOfCurrentRouter = useRouterBasename(); // react18 tab 动画会卡顿,所以第一个 tab 时,动画禁用,后面的 tab 才启用 const [hasMounted, setHasMounted] = useState(false); @@ -112,7 +114,7 @@ export const Page = (props) => { }} onChange={(activeKey) => { setLoading(true); - navigateToTab(activeKey, navigate); + navigateToTab({ activeKey, navigate, basename: basenameOfCurrentRouter }); setTimeout(() => { setLoading(false); }, 50); @@ -320,11 +322,28 @@ const PageContent = memo( ); PageContent.displayName = 'PageContent'; -export function navigateToTab(activeKey: string, navigate: NavigateFunction, pathname = window.location.pathname) { +export function navigateToTab({ + activeKey, + navigate, + basename, + pathname = window.location.pathname, +}: { + activeKey: string; + navigate: NavigateFunction; + /** the router basename */ + basename: string; + pathname?: string; +}) { + pathname = pathname.replace(basename, ''); + if (pathname.endsWith('/')) { pathname = pathname.slice(0, -1); } + if (!pathname.startsWith('/')) { + pathname = `/${pathname}`; + } + if (isTabPage(pathname)) { navigate(`${pathname.replace(/\/tabs\/[^/]+$/, `/tabs/${activeKey}`)}`, { replace: true }); } else { diff --git a/packages/core/client/src/schema-component/antd/page/PagePopups.tsx b/packages/core/client/src/schema-component/antd/page/PagePopups.tsx index 0f850d0c39..c394dcba89 100644 --- a/packages/core/client/src/schema-component/antd/page/PagePopups.tsx +++ b/packages/core/client/src/schema-component/antd/page/PagePopups.tsx @@ -84,7 +84,8 @@ const PopupParamsProvider: FC> = (props) => { return {props.children}; }; -const PopupTabsPropsProvider: FC<{ params: PopupParams }> = ({ children, params }) => { +const PopupTabsPropsProvider: FC = ({ children }) => { + const { params } = useCurrentPopupContext(); const { changeTab } = usePagePopup(); const onChange = useCallback( (key: string) => { @@ -99,7 +100,7 @@ const PopupTabsPropsProvider: FC<{ params: PopupParams }> = ({ children, params } return ( - + {children} ); @@ -166,7 +167,7 @@ const PagePopupsItemProvider: FC<{ > {/* Pass the service of the block where the button is located down, to refresh the block's data when the popup is closed */} - +
{children}
diff --git a/packages/core/client/src/schema-component/antd/page/__tests__/page.test.tsx b/packages/core/client/src/schema-component/antd/page/__tests__/page.test.tsx index 1eb0fb6070..ee7d344dea 100644 --- a/packages/core/client/src/schema-component/antd/page/__tests__/page.test.tsx +++ b/packages/core/client/src/schema-component/antd/page/__tests__/page.test.tsx @@ -167,7 +167,7 @@ describe('utils', () => { expect(isTabPage('/admin/test/tabs/tabId/')).toBe(true); }); - it('navigateToTab', () => { + it('navigateToTab with basename "/"', () => { const navigate1 = vi.fn(); const navigate2 = vi.fn(); const navigate3 = vi.fn(); @@ -177,28 +177,178 @@ describe('utils', () => { const navigate7 = vi.fn(); const navigate8 = vi.fn(); - navigateToTab('tabId', navigate1, '/admin/test'); + navigateToTab({ activeKey: 'tabId', navigate: navigate1, pathname: '/admin/test', basename: '/' }); expect(navigate1).toBeCalledWith('/admin/test/tabs/tabId', { replace: true }); - navigateToTab('tabId', navigate2, '/admin/test/'); + navigateToTab({ activeKey: 'tabId', navigate: navigate2, pathname: '/admin/test/', basename: '/' }); expect(navigate2).toBeCalledWith('/admin/test/tabs/tabId', { replace: true }); - navigateToTab('tabId', navigate3, '/admin/test/tabs/oldTabId'); + navigateToTab({ activeKey: 'tabId', navigate: navigate3, pathname: '/admin/test/tabs/oldTabId', basename: '/' }); expect(navigate3).toBeCalledWith('/admin/test/tabs/tabId', { replace: true }); - navigateToTab('tabId', navigate4, '/admin/test/tabs/oldTabId/'); + navigateToTab({ activeKey: 'tabId', navigate: navigate4, pathname: '/admin/test/tabs/oldTabId/', basename: '/' }); expect(navigate4).toBeCalledWith('/admin/test/tabs/tabId', { replace: true }); - navigateToTab('tabId', navigate5, '/admin/test/tabs/tab1/pages/pageId/tabs/tab2'); + navigateToTab({ + activeKey: 'tabId', + navigate: navigate5, + pathname: '/admin/test/tabs/tab1/pages/pageId/tabs/tab2', + basename: '/', + }); expect(navigate5).toBeCalledWith('/admin/test/tabs/tab1/pages/pageId/tabs/tabId', { replace: true }); - navigateToTab('tabId', navigate6, '/admin/test/tabs/tab1/pages/pageId/tabs/tab2/'); + navigateToTab({ + activeKey: 'tabId', + navigate: navigate6, + pathname: '/admin/test/tabs/tab1/pages/pageId/tabs/tab2/', + basename: '/', + }); expect(navigate6).toBeCalledWith('/admin/test/tabs/tab1/pages/pageId/tabs/tabId', { replace: true }); - navigateToTab('tabId', navigate7, '/admin/test/tabs/tab1/pages/pageId'); + navigateToTab({ + activeKey: 'tabId', + navigate: navigate7, + pathname: '/admin/test/tabs/tab1/pages/pageId', + basename: '/', + }); expect(navigate7).toBeCalledWith('/admin/test/tabs/tab1/pages/pageId/tabs/tabId', { replace: true }); - navigateToTab('tabId', navigate8, '/admin/test/tabs/tab1/pages/pageId/'); + navigateToTab({ + activeKey: 'tabId', + navigate: navigate8, + pathname: '/admin/test/tabs/tab1/pages/pageId/', + basename: '/', + }); expect(navigate8).toBeCalledWith('/admin/test/tabs/tab1/pages/pageId/tabs/tabId', { replace: true }); }); + + it('navigateToTab with basename "/apps/appId"', () => { + const navigate1 = vi.fn(); + const navigate2 = vi.fn(); + const navigate3 = vi.fn(); + const navigate4 = vi.fn(); + const navigate5 = vi.fn(); + const navigate6 = vi.fn(); + const navigate7 = vi.fn(); + const navigate8 = vi.fn(); + + navigateToTab({ activeKey: 'tabId', navigate: navigate1, pathname: '/apps/appId/test', basename: '/apps/appId' }); + expect(navigate1).toBeCalledWith('/test/tabs/tabId', { replace: true }); + + navigateToTab({ activeKey: 'tabId', navigate: navigate2, pathname: '/apps/appId/test/', basename: '/apps/appId' }); + expect(navigate2).toBeCalledWith('/test/tabs/tabId', { replace: true }); + + navigateToTab({ + activeKey: 'tabId', + navigate: navigate3, + pathname: '/apps/appId/test/tabs/oldTabId', + basename: '/apps/appId', + }); + expect(navigate3).toBeCalledWith('/test/tabs/tabId', { replace: true }); + + navigateToTab({ + activeKey: 'tabId', + navigate: navigate4, + pathname: '/apps/appId/test/tabs/oldTabId/', + basename: '/apps/appId', + }); + expect(navigate4).toBeCalledWith('/test/tabs/tabId', { replace: true }); + + navigateToTab({ + activeKey: 'tabId', + navigate: navigate5, + pathname: '/apps/appId/test/tabs/tab1/pages/pageId/tabs/tab2', + basename: '/apps/appId', + }); + expect(navigate5).toBeCalledWith('/test/tabs/tab1/pages/pageId/tabs/tabId', { replace: true }); + + navigateToTab({ + activeKey: 'tabId', + navigate: navigate6, + pathname: '/apps/appId/test/tabs/tab1/pages/pageId/tabs/tab2/', + basename: '/apps/appId', + }); + expect(navigate6).toBeCalledWith('/test/tabs/tab1/pages/pageId/tabs/tabId', { replace: true }); + + navigateToTab({ + activeKey: 'tabId', + navigate: navigate7, + pathname: '/apps/appId/test/tabs/tab1/pages/pageId', + basename: '/apps/appId', + }); + expect(navigate7).toBeCalledWith('/test/tabs/tab1/pages/pageId/tabs/tabId', { replace: true }); + + navigateToTab({ + activeKey: 'tabId', + navigate: navigate8, + pathname: '/apps/appId/test/tabs/tab1/pages/pageId/', + basename: '/apps/appId', + }); + expect(navigate8).toBeCalledWith('/test/tabs/tab1/pages/pageId/tabs/tabId', { replace: true }); + }); + + it('navigateToTab with basename "/apps/appId/"', () => { + const navigate1 = vi.fn(); + const navigate2 = vi.fn(); + const navigate3 = vi.fn(); + const navigate4 = vi.fn(); + const navigate5 = vi.fn(); + const navigate6 = vi.fn(); + const navigate7 = vi.fn(); + const navigate8 = vi.fn(); + + navigateToTab({ activeKey: 'tabId', navigate: navigate1, pathname: '/apps/appId/test', basename: '/apps/appId/' }); + expect(navigate1).toBeCalledWith('/test/tabs/tabId', { replace: true }); + + navigateToTab({ activeKey: 'tabId', navigate: navigate2, pathname: '/apps/appId/test/', basename: '/apps/appId/' }); + expect(navigate2).toBeCalledWith('/test/tabs/tabId', { replace: true }); + + navigateToTab({ + activeKey: 'tabId', + navigate: navigate3, + pathname: '/apps/appId/test/tabs/oldTabId', + basename: '/apps/appId/', + }); + expect(navigate3).toBeCalledWith('/test/tabs/tabId', { replace: true }); + + navigateToTab({ + activeKey: 'tabId', + navigate: navigate4, + pathname: '/apps/appId/test/tabs/oldTabId/', + basename: '/apps/appId/', + }); + expect(navigate4).toBeCalledWith('/test/tabs/tabId', { replace: true }); + + navigateToTab({ + activeKey: 'tabId', + navigate: navigate5, + pathname: '/apps/appId/test/tabs/tab1/pages/pageId/tabs/tab2', + basename: '/apps/appId/', + }); + expect(navigate5).toBeCalledWith('/test/tabs/tab1/pages/pageId/tabs/tabId', { replace: true }); + + navigateToTab({ + activeKey: 'tabId', + navigate: navigate6, + pathname: '/apps/appId/test/tabs/tab1/pages/pageId/tabs/tab2/', + basename: '/apps/appId/', + }); + expect(navigate6).toBeCalledWith('/test/tabs/tab1/pages/pageId/tabs/tabId', { replace: true }); + + navigateToTab({ + activeKey: 'tabId', + navigate: navigate7, + pathname: '/apps/appId/test/tabs/tab1/pages/pageId', + basename: '/apps/appId/', + }); + expect(navigate7).toBeCalledWith('/test/tabs/tab1/pages/pageId/tabs/tabId', { replace: true }); + + navigateToTab({ + activeKey: 'tabId', + navigate: navigate8, + pathname: '/apps/appId/test/tabs/tab1/pages/pageId/', + basename: '/apps/appId/', + }); + expect(navigate8).toBeCalledWith('/test/tabs/tab1/pages/pageId/tabs/tabId', { replace: true }); + }); });