@tachybase/client 1.3.18 → 1.3.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/application/CustomRouterContextProvider.mjs +1 -2
- package/es/application/components/AppComponent.mjs +1 -3
- package/es/block-provider/hooks/index.mjs +1 -1
- package/es/built-in/acl/Configuration/schemas/scopes.mjs +4 -5
- package/es/built-in/dynamic-page/DynamicPage.mjs +16 -33
- package/es/built-in/dynamic-page/utils.d.ts +1 -2
- package/es/built-in/dynamic-page/utils.mjs +0 -3
- package/es/built-in/page-style/CustomAdminHeader.mjs +2 -2
- package/es/built-in/page-style/PageStyle.provider.d.ts +2 -7
- package/es/built-in/page-style/PageStyle.provider.mjs +3 -8
- package/es/built-in/page-style/TabContent.mjs +5 -7
- package/es/built-in/page-style/usePageStyle.d.ts +1 -1
- package/es/built-in/page-style/usePageStyle.mjs +1 -1
- package/es/built-in/page-style/useTabSettings.d.ts +3 -4
- package/es/built-in/page-style/useTabSettings.mjs +7 -8
- package/es/built-in/quick-access/PopupActionSchemaInitializerItem.mjs +2 -2
- package/es/collection-manager/Configuration/components/Summary.mjs +3 -3
- package/es/flag-provider/FlagProvider.d.ts +1 -0
- package/es/flag-provider/hooks/useFlag.mjs +1 -1
- package/es/modules/actions/add-child/CreateChildInitializer.mjs +2 -2
- package/es/modules/actions/add-new/CreateActionInitializer.mjs +2 -2
- package/es/modules/actions/add-record/CustomizeAddRecordActionInitializer.mjs +2 -2
- package/es/modules/actions/associate/AssociateActionInitializer.mjs +1 -2
- package/es/modules/actions/submit/createSubmitActionSettings.mjs +3 -6
- package/es/modules/actions/view-edit-popup/PopupActionInitializer.mjs +2 -2
- package/es/modules/actions/view-edit-popup/UpdateActionInitializer.mjs +2 -2
- package/es/modules/actions/view-edit-popup/ViewActionInitializer.mjs +2 -2
- package/es/modules/fields/component/DrawerSubTable/drawerSubTableComponentFieldSettings.mjs +2 -2
- package/es/modules/fields/component/Picker/recordPickerComponentFieldSettings.mjs +2 -2
- package/es/modules/fields/component/Select/selectComponentFieldSettings.mjs +2 -2
- package/es/schema-component/antd/action/Action.Container.mjs +5 -26
- package/es/schema-component/antd/action/Action.Designer.mjs +3 -14
- package/es/schema-component/antd/action/Action.Page.mjs +1 -1
- package/es/schema-component/antd/action/Action.mjs +11 -56
- package/es/schema-component/antd/action/context.d.ts +1 -9
- package/es/schema-component/antd/action/context.mjs +1 -10
- package/es/schema-component/antd/action/hooks.d.ts +1 -2
- package/es/schema-component/antd/action/hooks.mjs +2 -2
- package/es/schema-component/antd/association-field/FileManager.mjs +2 -2
- package/es/schema-component/antd/association-field/InternalDrawerSubTable.mjs +2 -2
- package/es/schema-component/antd/association-field/InternalPicker.mjs +2 -2
- package/es/schema-component/antd/association-field/InternalTag.mjs +2 -2
- package/es/schema-component/antd/association-field/InternalViewer.mjs +2 -2
- package/es/schema-component/antd/association-field/SubTable.mjs +2 -2
- package/es/schema-component/antd/color-select/ColorSelect.mjs +3 -3
- package/es/schema-component/antd/date-picker/util.d.ts +13 -0
- package/es/schema-component/antd/date-picker/util.mjs +14 -1
- package/es/schema-component/antd/form-item/FormItem.Settings.mjs +2 -3
- package/es/schema-component/antd/markdown/Markdown.mjs +4 -4
- package/es/schema-component/antd/page/Page.mjs +22 -27
- package/es/schema-component/antd/password/utils.d.ts +1 -1
- package/es/schema-component/antd/record-picker/InputRecordPicker.mjs +2 -2
- package/es/schema-component/antd/record-picker/ReadPrettyRecordPicker.mjs +2 -2
- package/es/schema-initializer/items/SelectActionInitializer.mjs +2 -2
- package/es/schema-items/OpenModeSchemaItems.mjs +16 -37
- package/es/schema-settings/SchemaSettingsDefaultValue.mjs +3 -2
- package/es/schema-settings/VariableInput/hooks/index.d.ts +1 -0
- package/es/schema-settings/VariableInput/hooks/index.mjs +1 -0
- package/es/schema-settings/VariableInput/hooks/useExactDateVariable.d.ts +93 -0
- package/es/schema-settings/VariableInput/hooks/useExactDateVariable.mjs +75 -0
- package/es/schema-settings/VariableInput/hooks/useVariableOptions.mjs +11 -1
- package/es/schema-templates/schemas/uiSchemaTemplates.mjs +1 -1
- package/es/user/ChangePassword.mjs +109 -6
- package/es/user/index.d.ts +1 -0
- package/es/user/index.mjs +2 -0
- package/es/variables/hooks/useBuiltinVariables.mjs +8 -2
- package/lib/application/CustomRouterContextProvider.js +1 -2
- package/lib/application/components/AppComponent.js +1 -3
- package/lib/block-provider/hooks/index.js +7 -7
- package/lib/built-in/acl/Configuration/MenuItemsProvider.js +2 -2
- package/lib/built-in/acl/Configuration/schemas/scopes.js +3 -4
- package/lib/built-in/attachment-preview/previewers/file-sheet.js +2 -2
- package/lib/built-in/dynamic-page/DynamicPage.js +14 -31
- package/lib/built-in/dynamic-page/utils.js +0 -3
- package/lib/built-in/page-style/CustomAdminHeader.js +2 -2
- package/lib/built-in/page-style/PageStyle.provider.js +2 -10
- package/lib/built-in/page-style/TabContent.js +4 -6
- package/lib/built-in/page-style/usePageStyle.js +1 -1
- package/lib/built-in/page-style/useTabSettings.js +7 -8
- package/lib/built-in/pm/index.js +1 -1
- package/lib/built-in/quick-access/PopupActionSchemaInitializerItem.js +1 -1
- package/lib/collection-manager/Configuration/components/Summary.js +3 -3
- package/lib/collection-manager/index.js +17 -17
- package/lib/flag-provider/hooks/useFlag.js +1 -1
- package/lib/icon/Icon.js +2 -2
- package/lib/locale/en_US.js +0 -1
- package/lib/locale/zh-CN.js +5 -0
- package/lib/modules/actions/add-child/CreateChildInitializer.js +2 -2
- package/lib/modules/actions/add-new/CreateActionInitializer.js +2 -2
- package/lib/modules/actions/add-record/CustomizeAddRecordActionInitializer.js +2 -2
- package/lib/modules/actions/associate/AssociateActionInitializer.js +1 -2
- package/lib/modules/actions/submit/createSubmitActionSettings.js +2 -5
- package/lib/modules/actions/view-edit-popup/PopupActionInitializer.js +2 -2
- package/lib/modules/actions/view-edit-popup/UpdateActionInitializer.js +2 -2
- package/lib/modules/actions/view-edit-popup/ViewActionInitializer.js +2 -2
- package/lib/modules/fields/component/DrawerSubTable/drawerSubTableComponentFieldSettings.js +1 -1
- package/lib/modules/fields/component/Picker/recordPickerComponentFieldSettings.js +1 -1
- package/lib/modules/fields/component/Select/selectComponentFieldSettings.js +1 -1
- package/lib/schema-component/antd/action/Action.Container.js +6 -27
- package/lib/schema-component/antd/action/Action.Designer.js +2 -13
- package/lib/schema-component/antd/action/Action.Modal.js +2 -2
- package/lib/schema-component/antd/action/Action.Page.js +1 -1
- package/lib/schema-component/antd/action/Action.Sheet.js +2 -2
- package/lib/schema-component/antd/action/Action.js +10 -55
- package/lib/schema-component/antd/action/context.js +1 -13
- package/lib/schema-component/antd/action/hooks.js +1 -1
- package/lib/schema-component/antd/association-field/FileManager.js +1 -1
- package/lib/schema-component/antd/association-field/InternalDrawerSubTable.js +1 -1
- package/lib/schema-component/antd/association-field/InternalPicker.js +1 -1
- package/lib/schema-component/antd/association-field/InternalTag.js +1 -1
- package/lib/schema-component/antd/association-field/InternalViewer.js +1 -1
- package/lib/schema-component/antd/association-field/SubTable.js +1 -1
- package/lib/schema-component/antd/color-select/ColorSelect.js +4 -4
- package/lib/schema-component/antd/date-picker/util.js +16 -0
- package/lib/schema-component/antd/form-item/FormItem.Settings.js +2 -3
- package/lib/schema-component/antd/form-tab/index.js +2 -2
- package/lib/schema-component/antd/form-v2/index.js +2 -2
- package/lib/schema-component/antd/markdown/Markdown.js +5 -5
- package/lib/schema-component/antd/page/Page.js +21 -26
- package/lib/schema-component/antd/record-picker/InputRecordPicker.js +1 -1
- package/lib/schema-component/antd/record-picker/ReadPrettyRecordPicker.js +1 -1
- package/lib/schema-component/antd/scroll-area/ScrollArea.js +2 -2
- package/lib/schema-component/antd/table-v2/index.js +3 -3
- package/lib/schema-component/antd/upload/shared.js +4 -4
- package/lib/schema-initializer/items/SelectActionInitializer.js +2 -2
- package/lib/schema-items/OpenModeSchemaItems.js +15 -36
- package/lib/schema-settings/SchemaSettingsDefaultValue.js +3 -2
- package/lib/schema-settings/VariableInput/hooks/index.js +9 -0
- package/lib/schema-settings/VariableInput/hooks/useExactDateVariable.js +112 -0
- package/lib/schema-settings/VariableInput/hooks/useVariableOptions.js +11 -1
- package/lib/schema-templates/schemas/uiSchemaTemplates.js +1 -1
- package/lib/user/ChangePassword.js +118 -5
- package/lib/user/index.js +24 -4
- package/lib/variables/VariablesProvider.js +2 -2
- package/lib/variables/hooks/useBuiltinVariables.js +7 -1
- package/package.json +10 -10
- package/es/built-in/dynamic-page/DynamicPage.context.d.ts +0 -0
- package/es/built-in/dynamic-page/DynamicPage.context.mjs +0 -0
- package/es/built-in/dynamic-page/DynamicPage.style.d.ts +0 -3
- package/es/built-in/dynamic-page/DynamicPage.style.mjs +0 -26
- package/es/built-in/dynamic-page/PageNavBar.d.ts +0 -3
- package/es/built-in/dynamic-page/PageNavBar.mjs +0 -47
- package/es/built-in/dynamic-page/PageNavBar.style.d.ts +0 -3
- package/es/built-in/dynamic-page/PageNavBar.style.mjs +0 -25
- package/lib/built-in/dynamic-page/DynamicPage.context.js +0 -5
- package/lib/built-in/dynamic-page/DynamicPage.style.js +0 -60
- package/lib/built-in/dynamic-page/PageNavBar.js +0 -81
- package/lib/built-in/dynamic-page/PageNavBar.style.js +0 -59
|
@@ -7,7 +7,7 @@ import { TableSelectorParamsProvider, useTableSelectorProps } from "../../../blo
|
|
|
7
7
|
import { CollectionProvider_deprecated, useCollection_deprecated } from "../../../collection-manager/index.mjs";
|
|
8
8
|
import { FormProvider, SchemaComponentOptions } from "../../core/index.mjs";
|
|
9
9
|
import { useCompile } from "../../hooks/index.mjs";
|
|
10
|
-
import { ActionContextProvider,
|
|
10
|
+
import { ActionContextProvider, useActionContext } from "../action/index.mjs";
|
|
11
11
|
import { FileSelector } from "../preview/index.mjs";
|
|
12
12
|
import { useFieldNames } from "./useFieldNames.mjs";
|
|
13
13
|
import { getLabelFormatValue, useLabelUiSchema } from "./util.mjs";
|
|
@@ -221,7 +221,7 @@ const Drawer = (param)=>{
|
|
|
221
221
|
allowNull: true,
|
|
222
222
|
name: null == collectionField ? void 0 : collectionField.target,
|
|
223
223
|
children: /*#__PURE__*/ jsx(ActionContextProvider, {
|
|
224
|
-
openMode:
|
|
224
|
+
openMode: "drawer",
|
|
225
225
|
visible: visible,
|
|
226
226
|
setVisible: setVisible,
|
|
227
227
|
children: /*#__PURE__*/ jsx(FormProvider, {
|
|
@@ -7,7 +7,7 @@ import { CollectionProvider_deprecated, useCollectionManager_deprecated, useColl
|
|
|
7
7
|
import { RecordProvider, useRecord } from "../../../record-provider/index.mjs";
|
|
8
8
|
import { FormProvider } from "../../core/index.mjs";
|
|
9
9
|
import { useCompile } from "../../hooks/index.mjs";
|
|
10
|
-
import { ActionContextProvider,
|
|
10
|
+
import { ActionContextProvider, useActionContext } from "../action/index.mjs";
|
|
11
11
|
import { EllipsisWithTooltip } from "../input/EllipsisWithTooltip.mjs";
|
|
12
12
|
import { Preview } from "../preview/index.mjs";
|
|
13
13
|
import { isShowFilePicker } from "./InputRecordPicker.mjs";
|
|
@@ -105,7 +105,7 @@ const ReadPrettyRecordPicker = observer((props)=>{
|
|
|
105
105
|
value: {
|
|
106
106
|
visible,
|
|
107
107
|
setVisible,
|
|
108
|
-
openMode:
|
|
108
|
+
openMode: 'drawer',
|
|
109
109
|
snapshot: 'snapshot' === collectionField.interface
|
|
110
110
|
},
|
|
111
111
|
children: renderRecordProvider()
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
2
|
+
import "react";
|
|
3
3
|
import { ActionInitializer } from "./ActionInitializer.mjs";
|
|
4
4
|
const SelectActionInitializer = (props)=>{
|
|
5
5
|
const schema = {
|
|
@@ -9,7 +9,7 @@ const SelectActionInitializer = (props)=>{
|
|
|
9
9
|
'x-designer': 'Action.Designer',
|
|
10
10
|
'x-component': 'Action',
|
|
11
11
|
'x-component-props': {
|
|
12
|
-
openMode:
|
|
12
|
+
openMode: 'drawer'
|
|
13
13
|
},
|
|
14
14
|
properties: {
|
|
15
15
|
drawer: {
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
2
|
+
import "react";
|
|
3
3
|
import { useField, useFieldSchema } from "@tachybase/schema";
|
|
4
4
|
import { Select } from "antd";
|
|
5
5
|
import { useTranslation } from "react-i18next";
|
|
6
6
|
import { SchemaInitializerItem, SchemaInitializerSelect } from "../application/index.mjs";
|
|
7
|
-
import {
|
|
8
|
-
import { PageStyle } from "../built-in/page-style/PageStyle.provider.mjs";
|
|
9
|
-
import { usePageStyle } from "../built-in/page-style/usePageStyle.mjs";
|
|
10
|
-
import { OpenMode, useDesignable } from "../schema-component/index.mjs";
|
|
7
|
+
import { useDesignable } from "../schema-component/index.mjs";
|
|
11
8
|
import { SchemaSettingsSelectItem } from "../schema-settings/index.mjs";
|
|
12
9
|
const SchemaInitializerOpenModeSchemaItems = (options)=>{
|
|
13
10
|
var _fieldSchema_xcomponentprops, _fieldSchema_xcomponentprops1, _fieldSchema_xcomponentprops2;
|
|
@@ -16,16 +13,7 @@ const SchemaInitializerOpenModeSchemaItems = (options)=>{
|
|
|
16
13
|
const field = useField();
|
|
17
14
|
const { t } = useTranslation();
|
|
18
15
|
const { dn } = useDesignable();
|
|
19
|
-
const
|
|
20
|
-
const pageStyle = usePageStyle();
|
|
21
|
-
const defaultOpenMode = useMemo(()=>{
|
|
22
|
-
if (isMobile || pageStyle === PageStyle.TAB_STYLE) return OpenMode.PAGE;
|
|
23
|
-
return OpenMode.DRAWER_MODE;
|
|
24
|
-
}, [
|
|
25
|
-
isMobile,
|
|
26
|
-
pageStyle
|
|
27
|
-
]);
|
|
28
|
-
const openModeValue = (null == fieldSchema ? void 0 : null == (_fieldSchema_xcomponentprops = fieldSchema['x-component-props']) ? void 0 : _fieldSchema_xcomponentprops['openMode']) || defaultOpenMode;
|
|
16
|
+
const openModeValue = (null == fieldSchema ? void 0 : null == (_fieldSchema_xcomponentprops = fieldSchema['x-component-props']) ? void 0 : _fieldSchema_xcomponentprops['openMode']) || 'drawer';
|
|
29
17
|
var _fieldSchema_xcomponentprops_openSize;
|
|
30
18
|
return /*#__PURE__*/ jsxs(Fragment, {
|
|
31
19
|
children: [
|
|
@@ -34,11 +22,11 @@ const SchemaInitializerOpenModeSchemaItems = (options)=>{
|
|
|
34
22
|
options: [
|
|
35
23
|
{
|
|
36
24
|
label: t('Drawer'),
|
|
37
|
-
value:
|
|
25
|
+
value: 'drawer'
|
|
38
26
|
},
|
|
39
27
|
{
|
|
40
28
|
label: t('Dialog'),
|
|
41
|
-
value:
|
|
29
|
+
value: 'modal'
|
|
42
30
|
}
|
|
43
31
|
],
|
|
44
32
|
value: openModeValue,
|
|
@@ -58,8 +46,8 @@ const SchemaInitializerOpenModeSchemaItems = (options)=>{
|
|
|
58
46
|
}
|
|
59
47
|
}) : null,
|
|
60
48
|
openSize && [
|
|
61
|
-
|
|
62
|
-
|
|
49
|
+
'modal',
|
|
50
|
+
'drawer'
|
|
63
51
|
].includes(openModeValue) ? /*#__PURE__*/ jsx(SchemaInitializerItem, {
|
|
64
52
|
children: /*#__PURE__*/ jsxs("div", {
|
|
65
53
|
style: {
|
|
@@ -86,7 +74,7 @@ const SchemaInitializerOpenModeSchemaItems = (options)=>{
|
|
|
86
74
|
value: 'large'
|
|
87
75
|
}
|
|
88
76
|
],
|
|
89
|
-
value: null != (_fieldSchema_xcomponentprops_openSize = null == fieldSchema ? void 0 : null == (_fieldSchema_xcomponentprops1 = fieldSchema['x-component-props']) ? void 0 : _fieldSchema_xcomponentprops1['openSize']) ? _fieldSchema_xcomponentprops_openSize : (null == fieldSchema ? void 0 : null == (_fieldSchema_xcomponentprops2 = fieldSchema['x-component-props']) ? void 0 : _fieldSchema_xcomponentprops2['openMode'])
|
|
77
|
+
value: null != (_fieldSchema_xcomponentprops_openSize = null == fieldSchema ? void 0 : null == (_fieldSchema_xcomponentprops1 = fieldSchema['x-component-props']) ? void 0 : _fieldSchema_xcomponentprops1['openSize']) ? _fieldSchema_xcomponentprops_openSize : (null == fieldSchema ? void 0 : null == (_fieldSchema_xcomponentprops2 = fieldSchema['x-component-props']) ? void 0 : _fieldSchema_xcomponentprops2['openMode']) == 'modal' ? 'large' : 'middle',
|
|
90
78
|
onChange: (value)=>{
|
|
91
79
|
field.componentProps.openSize = value;
|
|
92
80
|
const schema = {
|
|
@@ -118,16 +106,7 @@ const SchemaSettingOpenModeSchemaItems = (options)=>{
|
|
|
118
106
|
const field = useField();
|
|
119
107
|
const { t } = useTranslation();
|
|
120
108
|
const { dn } = useDesignable();
|
|
121
|
-
const
|
|
122
|
-
const isMobile = useIsMobile();
|
|
123
|
-
const defaultOpenMode = useMemo(()=>{
|
|
124
|
-
if (isMobile || pageStyle === PageStyle.TAB_STYLE) return OpenMode.PAGE;
|
|
125
|
-
return OpenMode.DRAWER_MODE;
|
|
126
|
-
}, [
|
|
127
|
-
isMobile,
|
|
128
|
-
pageStyle
|
|
129
|
-
]);
|
|
130
|
-
const openModeValue = (null == fieldSchema ? void 0 : null == (_fieldSchema_xcomponentprops = fieldSchema['x-component-props']) ? void 0 : _fieldSchema_xcomponentprops['openMode']) || defaultOpenMode;
|
|
109
|
+
const openModeValue = (null == fieldSchema ? void 0 : null == (_fieldSchema_xcomponentprops = fieldSchema['x-component-props']) ? void 0 : _fieldSchema_xcomponentprops['openMode']) || 'drawer';
|
|
131
110
|
var _fieldSchema_xcomponentprops_openSize;
|
|
132
111
|
return /*#__PURE__*/ jsxs(Fragment, {
|
|
133
112
|
children: [
|
|
@@ -136,19 +115,19 @@ const SchemaSettingOpenModeSchemaItems = (options)=>{
|
|
|
136
115
|
options: [
|
|
137
116
|
{
|
|
138
117
|
label: t('Drawer'),
|
|
139
|
-
value:
|
|
118
|
+
value: 'drawer'
|
|
140
119
|
},
|
|
141
120
|
{
|
|
142
121
|
label: t('Dialog'),
|
|
143
|
-
value:
|
|
122
|
+
value: 'modal'
|
|
144
123
|
},
|
|
145
124
|
{
|
|
146
125
|
label: t('Sheet'),
|
|
147
|
-
value:
|
|
126
|
+
value: 'sheet'
|
|
148
127
|
},
|
|
149
128
|
{
|
|
150
129
|
label: t('Page'),
|
|
151
|
-
value:
|
|
130
|
+
value: 'page'
|
|
152
131
|
}
|
|
153
132
|
],
|
|
154
133
|
value: openModeValue,
|
|
@@ -168,8 +147,8 @@ const SchemaSettingOpenModeSchemaItems = (options)=>{
|
|
|
168
147
|
}
|
|
169
148
|
}) : null,
|
|
170
149
|
openSize && [
|
|
171
|
-
|
|
172
|
-
|
|
150
|
+
'modal',
|
|
151
|
+
'drawer'
|
|
173
152
|
].includes(openModeValue) ? /*#__PURE__*/ jsx(SchemaSettingsSelectItem, {
|
|
174
153
|
title: t('Popup size'),
|
|
175
154
|
options: [
|
|
@@ -186,7 +165,7 @@ const SchemaSettingOpenModeSchemaItems = (options)=>{
|
|
|
186
165
|
value: 'large'
|
|
187
166
|
}
|
|
188
167
|
],
|
|
189
|
-
value: null != (_fieldSchema_xcomponentprops_openSize = null == fieldSchema ? void 0 : null == (_fieldSchema_xcomponentprops1 = fieldSchema['x-component-props']) ? void 0 : _fieldSchema_xcomponentprops1['openSize']) ? _fieldSchema_xcomponentprops_openSize : (null == fieldSchema ? void 0 : null == (_fieldSchema_xcomponentprops2 = fieldSchema['x-component-props']) ? void 0 : _fieldSchema_xcomponentprops2['openMode'])
|
|
168
|
+
value: null != (_fieldSchema_xcomponentprops_openSize = null == fieldSchema ? void 0 : null == (_fieldSchema_xcomponentprops1 = fieldSchema['x-component-props']) ? void 0 : _fieldSchema_xcomponentprops1['openSize']) ? _fieldSchema_xcomponentprops_openSize : (null == fieldSchema ? void 0 : null == (_fieldSchema_xcomponentprops2 = fieldSchema['x-component-props']) ? void 0 : _fieldSchema_xcomponentprops2['openMode']) == 'modal' ? 'large' : 'middle',
|
|
190
169
|
onChange: (value)=>{
|
|
191
170
|
field.componentProps.openSize = value;
|
|
192
171
|
const schema = {
|
|
@@ -88,6 +88,7 @@ const SchemaSettingsDefaultValue = function(props) {
|
|
|
88
88
|
isInSubForm: isInSubForm,
|
|
89
89
|
isInSubTable: isInSubTable,
|
|
90
90
|
isInSetDefaultValueDialog: true,
|
|
91
|
+
collectionField: collectionField,
|
|
91
92
|
children: /*#__PURE__*/ jsx(VariableInput, {
|
|
92
93
|
...props
|
|
93
94
|
})
|
|
@@ -104,7 +105,7 @@ const SchemaSettingsDefaultValue = function(props) {
|
|
|
104
105
|
'x-decorator': 'FormItem',
|
|
105
106
|
'x-component': 'VariableInput',
|
|
106
107
|
'x-component-props': {
|
|
107
|
-
...
|
|
108
|
+
...null == fieldSchema ? void 0 : fieldSchema['x-component-props'],
|
|
108
109
|
collectionField,
|
|
109
110
|
contextCollectionName: isAllowContextVariable && tableCtx.collection,
|
|
110
111
|
schema: null == collectionField ? void 0 : collectionField.uiSchema,
|
|
@@ -133,7 +134,7 @@ const SchemaSettingsDefaultValue = function(props) {
|
|
|
133
134
|
s.type = 'void';
|
|
134
135
|
}
|
|
135
136
|
const schema = {
|
|
136
|
-
...s
|
|
137
|
+
...s,
|
|
137
138
|
'x-decorator': 'FormItem',
|
|
138
139
|
'x-component-props': {
|
|
139
140
|
...s['x-component-props'],
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { Schema } from '@tachybase/schema';
|
|
2
|
+
interface Props {
|
|
3
|
+
operator?: {
|
|
4
|
+
value: string;
|
|
5
|
+
};
|
|
6
|
+
schema?: any;
|
|
7
|
+
/**
|
|
8
|
+
* 不需要禁用选项,一般会在表达式中使用
|
|
9
|
+
*/
|
|
10
|
+
noDisabled?: boolean;
|
|
11
|
+
/** 消费变量值的字段 */
|
|
12
|
+
targetFieldSchema?: Schema;
|
|
13
|
+
dateOnly?: boolean;
|
|
14
|
+
utc?: boolean;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* 变量:`日期变量`的上下文
|
|
18
|
+
* @returns
|
|
19
|
+
*/
|
|
20
|
+
export declare const useExactDateVariableContext: () => {
|
|
21
|
+
exactDateTimeCtx: {
|
|
22
|
+
nowUtc: () => string;
|
|
23
|
+
nowLocal: () => string;
|
|
24
|
+
todayUtc: () => string;
|
|
25
|
+
todayLocal: () => string;
|
|
26
|
+
todayDate: () => string;
|
|
27
|
+
yesterdayUtc: () => string;
|
|
28
|
+
yesterdayLocal: () => string;
|
|
29
|
+
yesterdayDate: () => string;
|
|
30
|
+
tomorrowUtc: () => string;
|
|
31
|
+
tomorrowLocal: () => string;
|
|
32
|
+
tomorrowDate: () => string;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* 变量:`日期时刻变量`,主要用于赋值的场景
|
|
37
|
+
* @param param0
|
|
38
|
+
* @returns
|
|
39
|
+
*/
|
|
40
|
+
export declare const useExactDateVariable: ({ schema, targetFieldSchema }?: Props) => {
|
|
41
|
+
exactDateTimeSettings: {
|
|
42
|
+
label: string;
|
|
43
|
+
value: string;
|
|
44
|
+
key: string;
|
|
45
|
+
children: {
|
|
46
|
+
key: string;
|
|
47
|
+
value: string;
|
|
48
|
+
label: string;
|
|
49
|
+
operators: ({
|
|
50
|
+
label: string;
|
|
51
|
+
value: string;
|
|
52
|
+
selected: boolean;
|
|
53
|
+
schema?: undefined;
|
|
54
|
+
noValue?: undefined;
|
|
55
|
+
} | {
|
|
56
|
+
label: string;
|
|
57
|
+
value: string;
|
|
58
|
+
selected?: undefined;
|
|
59
|
+
schema?: undefined;
|
|
60
|
+
noValue?: undefined;
|
|
61
|
+
} | {
|
|
62
|
+
label: string;
|
|
63
|
+
value: string;
|
|
64
|
+
schema: {
|
|
65
|
+
'x-component': string;
|
|
66
|
+
};
|
|
67
|
+
selected?: undefined;
|
|
68
|
+
noValue?: undefined;
|
|
69
|
+
} | {
|
|
70
|
+
label: string;
|
|
71
|
+
value: string;
|
|
72
|
+
noValue: boolean;
|
|
73
|
+
selected?: undefined;
|
|
74
|
+
schema?: undefined;
|
|
75
|
+
})[];
|
|
76
|
+
}[];
|
|
77
|
+
};
|
|
78
|
+
exactDateTimeCtx: {
|
|
79
|
+
nowUtc: () => string;
|
|
80
|
+
nowLocal: () => string;
|
|
81
|
+
todayUtc: () => string;
|
|
82
|
+
todayLocal: () => string;
|
|
83
|
+
todayDate: () => string;
|
|
84
|
+
yesterdayUtc: () => string;
|
|
85
|
+
yesterdayLocal: () => string;
|
|
86
|
+
yesterdayDate: () => string;
|
|
87
|
+
tomorrowUtc: () => string;
|
|
88
|
+
tomorrowLocal: () => string;
|
|
89
|
+
tomorrowDate: () => string;
|
|
90
|
+
};
|
|
91
|
+
shouldDisplayExactDate: boolean;
|
|
92
|
+
};
|
|
93
|
+
export {};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { useMemo } from "react";
|
|
2
|
+
import { useTranslation } from "react-i18next";
|
|
3
|
+
import { datetime } from "../../../collection-manager/interfaces/properties/operators.mjs";
|
|
4
|
+
import { useFlag } from "../../../flag-provider/index.mjs";
|
|
5
|
+
import { getDateExact } from "../../../schema-component/antd/date-picker/util.mjs";
|
|
6
|
+
const useExactDateVariableContext = ()=>{
|
|
7
|
+
const exactDateTimeCtx = useMemo(()=>getDateExact(), []);
|
|
8
|
+
return {
|
|
9
|
+
exactDateTimeCtx
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
const useExactDateVariable = function() {
|
|
13
|
+
let { schema, targetFieldSchema } = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
|
|
14
|
+
var _collectionField_uiSchema;
|
|
15
|
+
const { collectionField } = useFlag();
|
|
16
|
+
const { dateOnly, utc, accuracy, picker } = (null == collectionField ? void 0 : null == (_collectionField_uiSchema = collectionField.uiSchema) ? void 0 : _collectionField_uiSchema['x-component-props']) || {};
|
|
17
|
+
const { t } = useTranslation();
|
|
18
|
+
const exactDateTimeSettings = useMemo(()=>{
|
|
19
|
+
const getDateKeys = (key)=>{
|
|
20
|
+
if (!picker) {
|
|
21
|
+
if ('now' === key) return 'nowLocal';
|
|
22
|
+
if ('today' === key) return 'todayDate';
|
|
23
|
+
if ('yesterday' === key) return 'yesterdayDate';
|
|
24
|
+
if ('tomorrow' === key) return 'tomorrowDate';
|
|
25
|
+
}
|
|
26
|
+
if (dateOnly) {
|
|
27
|
+
if ('now' === key) return null;
|
|
28
|
+
return "".concat(key, "Date");
|
|
29
|
+
}
|
|
30
|
+
return "".concat(key).concat(utc || accuracy ? 'Utc' : 'Local');
|
|
31
|
+
};
|
|
32
|
+
const dateOptions = [
|
|
33
|
+
{
|
|
34
|
+
key: 'now',
|
|
35
|
+
value: getDateKeys('now'),
|
|
36
|
+
label: t('Now'),
|
|
37
|
+
operators: datetime
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
key: 'today',
|
|
41
|
+
value: getDateKeys('today'),
|
|
42
|
+
label: t('Today'),
|
|
43
|
+
operators: datetime
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
key: 'yesterday',
|
|
47
|
+
value: getDateKeys('yesterday'),
|
|
48
|
+
label: t('Yesterday'),
|
|
49
|
+
operators: datetime
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
key: 'tomorrow',
|
|
53
|
+
value: getDateKeys('tomorrow'),
|
|
54
|
+
label: t('Tomorrow'),
|
|
55
|
+
operators: datetime
|
|
56
|
+
}
|
|
57
|
+
].filter((v)=>v.value);
|
|
58
|
+
return {
|
|
59
|
+
label: t('Date variables'),
|
|
60
|
+
value: '$nExactDate',
|
|
61
|
+
key: '$nExactDate',
|
|
62
|
+
children: dateOptions
|
|
63
|
+
};
|
|
64
|
+
}, [
|
|
65
|
+
null == schema ? void 0 : schema['x-component'],
|
|
66
|
+
targetFieldSchema
|
|
67
|
+
]);
|
|
68
|
+
const { exactDateTimeCtx } = useExactDateVariableContext();
|
|
69
|
+
return {
|
|
70
|
+
exactDateTimeSettings,
|
|
71
|
+
exactDateTimeCtx,
|
|
72
|
+
shouldDisplayExactDate: !!collectionField
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
export { useExactDateVariable, useExactDateVariableContext };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { useMemo } from "react";
|
|
2
2
|
import { useBlockCollection } from "./useBlockCollection.mjs";
|
|
3
3
|
import { useDatetimeVariable } from "./useDateVariable.mjs";
|
|
4
|
+
import { useExactDateVariable } from "./useExactDateVariable.mjs";
|
|
4
5
|
import { useFilterVariable } from "./useFilterVariable.mjs";
|
|
5
6
|
import { useCurrentFormVariable } from "./useFormVariable.mjs";
|
|
6
7
|
import { useCurrentObjectVariable } from "./useIterationVariable.mjs";
|
|
@@ -32,6 +33,12 @@ const useVariableOptions = (param)=>{
|
|
|
32
33
|
schema: uiSchema,
|
|
33
34
|
noDisabled
|
|
34
35
|
});
|
|
36
|
+
const { exactDateTimeSettings, shouldDisplayExactDate } = useExactDateVariable({
|
|
37
|
+
operator,
|
|
38
|
+
schema: uiSchema,
|
|
39
|
+
noDisabled: true,
|
|
40
|
+
targetFieldSchema
|
|
41
|
+
});
|
|
35
42
|
const { currentFormSettings, shouldDisplayCurrentForm } = useCurrentFormVariable({
|
|
36
43
|
schema: uiSchema,
|
|
37
44
|
collectionField,
|
|
@@ -74,7 +81,8 @@ const useVariableOptions = (param)=>{
|
|
|
74
81
|
return useMemo(()=>[
|
|
75
82
|
currentUserSettings,
|
|
76
83
|
currentRoleSettings,
|
|
77
|
-
datetimeSettings,
|
|
84
|
+
!shouldDisplayExactDate && datetimeSettings,
|
|
85
|
+
shouldDisplayExactDate && exactDateTimeSettings,
|
|
78
86
|
shouldDisplayCurrentForm && currentFormSettings,
|
|
79
87
|
shouldDisplayCurrentObject && currentObjectSettings,
|
|
80
88
|
shouldDisplayCurrentRecord && currentRecordSettings,
|
|
@@ -85,6 +93,8 @@ const useVariableOptions = (param)=>{
|
|
|
85
93
|
currentUserSettings,
|
|
86
94
|
currentRoleSettings,
|
|
87
95
|
datetimeSettings,
|
|
96
|
+
exactDateTimeSettings,
|
|
97
|
+
shouldDisplayExactDate,
|
|
88
98
|
shouldDisplayCurrentForm,
|
|
89
99
|
currentFormSettings,
|
|
90
100
|
shouldDisplayCurrentObject,
|
|
@@ -2,8 +2,9 @@ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { useContext, useMemo, useState } from "react";
|
|
3
3
|
import { uid, useForm } from "@tachybase/schema";
|
|
4
4
|
import { useTranslation } from "react-i18next";
|
|
5
|
-
import { ActionContextProvider, DropdownVisibleContext, SchemaComponent, useActionContext, useCurrentUserContext } from "../index.mjs";
|
|
5
|
+
import { ActionContextProvider, DropdownVisibleContext, SchemaComponent, useActionContext, useApp, useCurrentUserContext } from "../index.mjs";
|
|
6
6
|
import { useAPIClient } from "../api-client/index.mjs";
|
|
7
|
+
import VerificationCode from "./VerificationCode.mjs";
|
|
7
8
|
const useCloseAction = ()=>{
|
|
8
9
|
const { setVisible } = useActionContext();
|
|
9
10
|
const form = useForm();
|
|
@@ -49,13 +50,101 @@ const schema = {
|
|
|
49
50
|
type: 'void',
|
|
50
51
|
title: '{{t("Change password")}}',
|
|
51
52
|
properties: {
|
|
53
|
+
verifyMethod: {
|
|
54
|
+
type: 'string',
|
|
55
|
+
required: true,
|
|
56
|
+
title: '{{t("Verify method")}}',
|
|
57
|
+
enum: [
|
|
58
|
+
{
|
|
59
|
+
label: '{{t("Use old password")}}',
|
|
60
|
+
value: 'password'
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
label: '{{t("Use verification code")}}',
|
|
64
|
+
value: 'code'
|
|
65
|
+
}
|
|
66
|
+
],
|
|
67
|
+
'x-component': 'Radio.Group',
|
|
68
|
+
'x-decorator': 'FormItem',
|
|
69
|
+
'x-reactions': [
|
|
70
|
+
{
|
|
71
|
+
dependencies: [
|
|
72
|
+
'.phoneExist',
|
|
73
|
+
'.oldPasswordExist'
|
|
74
|
+
],
|
|
75
|
+
fulfill: {
|
|
76
|
+
state: {
|
|
77
|
+
hidden: '{{ !($deps[0] && $deps[1] && smsVerifyEnabled) }}',
|
|
78
|
+
value: '{{ undefined }}'
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
]
|
|
83
|
+
},
|
|
84
|
+
phoneExist: {
|
|
85
|
+
type: 'boolean',
|
|
86
|
+
default: '{{ !!phoneNumber }}',
|
|
87
|
+
'x-hidden': true
|
|
88
|
+
},
|
|
89
|
+
phone: {
|
|
90
|
+
type: 'string',
|
|
91
|
+
title: '{{t("Phone")}}',
|
|
92
|
+
default: '{{ phoneNumber }}',
|
|
93
|
+
'x-component': 'Input',
|
|
94
|
+
'x-validator': 'phone',
|
|
95
|
+
'x-decorator': 'FormItem',
|
|
96
|
+
'x-hidden': true
|
|
97
|
+
},
|
|
98
|
+
code: {
|
|
99
|
+
type: 'string',
|
|
100
|
+
title: '{{t("Verification code")}}',
|
|
101
|
+
description: "{{codeDescription}}",
|
|
102
|
+
'x-component': 'VerificationCode',
|
|
103
|
+
'x-component-props': {
|
|
104
|
+
actionType: 'auth:changePassword',
|
|
105
|
+
targetFieldName: 'phone'
|
|
106
|
+
},
|
|
107
|
+
required: true,
|
|
108
|
+
'x-decorator': 'FormItem',
|
|
109
|
+
'x-reactions': [
|
|
110
|
+
{
|
|
111
|
+
dependencies: [
|
|
112
|
+
'.verifyMethod',
|
|
113
|
+
'.phoneExist',
|
|
114
|
+
'.phone'
|
|
115
|
+
],
|
|
116
|
+
fulfill: {
|
|
117
|
+
state: {
|
|
118
|
+
hidden: "{{ \n !$deps[1] || \n !smsVerifyEnabled ||\n ($deps[0] !== 'code' && $deps[0] !== undefined) // \u6709 verifyMethod \u4F46\u672A\u9009 code\n }}"
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
]
|
|
123
|
+
},
|
|
124
|
+
oldPasswordExist: {
|
|
125
|
+
type: 'boolean',
|
|
126
|
+
default: '{{ oldPassword }}',
|
|
127
|
+
'x-hidden': true
|
|
128
|
+
},
|
|
52
129
|
oldPassword: {
|
|
53
130
|
type: 'string',
|
|
54
131
|
title: '{{t("Old password")}}',
|
|
55
132
|
required: true,
|
|
56
133
|
'x-component': 'Password',
|
|
57
134
|
'x-decorator': 'FormItem',
|
|
58
|
-
'x-
|
|
135
|
+
'x-reactions': [
|
|
136
|
+
{
|
|
137
|
+
dependencies: [
|
|
138
|
+
'.verifyMethod',
|
|
139
|
+
'.oldPasswordExist'
|
|
140
|
+
],
|
|
141
|
+
fulfill: {
|
|
142
|
+
state: {
|
|
143
|
+
hidden: "{{ \n !$deps[1] || \n (smsVerifyEnabled && $deps[0] !== 'password' && $deps[0] !== undefined)\n }}"
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
]
|
|
59
148
|
},
|
|
60
149
|
newPassword: {
|
|
61
150
|
type: 'string',
|
|
@@ -129,12 +218,20 @@ const schema = {
|
|
|
129
218
|
}
|
|
130
219
|
};
|
|
131
220
|
const useChangePassword = ()=>{
|
|
132
|
-
var _currentUser_data_data, _currentUser_data;
|
|
221
|
+
var _currentUser_data_data, _currentUser_data, _currentUser_data_data1, _currentUser_data1;
|
|
133
222
|
const ctx = useContext(DropdownVisibleContext);
|
|
134
223
|
const [visible, setVisible] = useState(false);
|
|
135
224
|
const { t } = useTranslation();
|
|
225
|
+
const pm = useApp().pluginManager;
|
|
226
|
+
const otp = pm.get('@tachybase/plugin-otp');
|
|
227
|
+
const sms = pm.get('@tachybase/plugin-auth-sms');
|
|
228
|
+
const smsVerifyEnabled = !!otp && !!sms;
|
|
136
229
|
const currentUser = useCurrentUserContext();
|
|
137
|
-
const
|
|
230
|
+
const oldPassword = (null == currentUser ? void 0 : null == (_currentUser_data = currentUser.data) ? void 0 : null == (_currentUser_data_data = _currentUser_data.data) ? void 0 : _currentUser_data_data.password) !== null;
|
|
231
|
+
const phoneNumber = null == currentUser ? void 0 : null == (_currentUser_data1 = currentUser.data) ? void 0 : null == (_currentUser_data_data1 = _currentUser_data1.data) ? void 0 : _currentUser_data_data1.phone;
|
|
232
|
+
const codeDescription = phoneNumber ? t('Send verification code to phone: {{phoneNumber}}', {
|
|
233
|
+
phoneNumber
|
|
234
|
+
}) : t('Please fill in your mobile phone number in your personal information first');
|
|
138
235
|
return useMemo(()=>({
|
|
139
236
|
key: 'password',
|
|
140
237
|
eventKey: 'ChangePassword',
|
|
@@ -156,7 +253,13 @@ const useChangePassword = ()=>{
|
|
|
156
253
|
scope: {
|
|
157
254
|
useCloseAction,
|
|
158
255
|
useSaveCurrentUserValues,
|
|
159
|
-
|
|
256
|
+
oldPassword,
|
|
257
|
+
codeDescription,
|
|
258
|
+
phoneNumber,
|
|
259
|
+
smsVerifyEnabled
|
|
260
|
+
},
|
|
261
|
+
components: {
|
|
262
|
+
VerificationCode: VerificationCode
|
|
160
263
|
},
|
|
161
264
|
schema: schema
|
|
162
265
|
})
|
|
@@ -166,7 +269,7 @@ const useChangePassword = ()=>{
|
|
|
166
269
|
})
|
|
167
270
|
}), [
|
|
168
271
|
visible,
|
|
169
|
-
|
|
272
|
+
oldPassword
|
|
170
273
|
]);
|
|
171
274
|
};
|
|
172
275
|
export { useChangePassword };
|
package/es/user/index.d.ts
CHANGED
package/es/user/index.mjs
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { useMemo } from "react";
|
|
2
2
|
import { dayjs } from "@tachybase/utils/client";
|
|
3
|
-
import { useCurrentUserVariable, useDatetimeVariable } from "../../schema-settings/index.mjs";
|
|
3
|
+
import { useCurrentUserVariable, useDatetimeVariable, useExactDateVariable } from "../../schema-settings/index.mjs";
|
|
4
4
|
import { useCurrentRoleVariable } from "../../schema-settings/VariableInput/hooks/useRoleVariable.mjs";
|
|
5
5
|
const useBuiltInVariables = ()=>{
|
|
6
6
|
const { currentUserCtx } = useCurrentUserVariable();
|
|
7
7
|
const { currentRoleCtx } = useCurrentRoleVariable();
|
|
8
8
|
const { datetimeCtx } = useDatetimeVariable();
|
|
9
|
+
const { exactDateTimeCtx } = useExactDateVariable();
|
|
9
10
|
const builtinVariables = useMemo(()=>[
|
|
10
11
|
{
|
|
11
12
|
name: '$user',
|
|
@@ -30,6 +31,10 @@ const useBuiltInVariables = ()=>{
|
|
|
30
31
|
name: '$date',
|
|
31
32
|
ctx: datetimeCtx
|
|
32
33
|
},
|
|
34
|
+
{
|
|
35
|
+
name: '$nExactDate',
|
|
36
|
+
ctx: exactDateTimeCtx
|
|
37
|
+
},
|
|
33
38
|
{
|
|
34
39
|
name: '$system',
|
|
35
40
|
ctx: {
|
|
@@ -41,7 +46,8 @@ const useBuiltInVariables = ()=>{
|
|
|
41
46
|
ctx: ()=>dayjs().toISOString()
|
|
42
47
|
}
|
|
43
48
|
], [
|
|
44
|
-
currentUserCtx
|
|
49
|
+
currentUserCtx,
|
|
50
|
+
exactDateTimeCtx
|
|
45
51
|
]);
|
|
46
52
|
return {
|
|
47
53
|
builtinVariables
|