@tachybase/client 1.3.19 → 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.
Files changed (47) hide show
  1. package/es/collection-manager/Configuration/components/Summary.mjs +3 -3
  2. package/es/flag-provider/FlagProvider.d.ts +1 -0
  3. package/es/flag-provider/hooks/useFlag.mjs +1 -1
  4. package/es/schema-component/antd/color-select/ColorSelect.mjs +3 -3
  5. package/es/schema-component/antd/date-picker/util.d.ts +13 -0
  6. package/es/schema-component/antd/date-picker/util.mjs +14 -1
  7. package/es/schema-component/antd/markdown/Markdown.mjs +4 -4
  8. package/es/schema-component/antd/password/utils.d.ts +1 -1
  9. package/es/schema-settings/SchemaSettingsDefaultValue.mjs +3 -2
  10. package/es/schema-settings/VariableInput/hooks/index.d.ts +1 -0
  11. package/es/schema-settings/VariableInput/hooks/index.mjs +1 -0
  12. package/es/schema-settings/VariableInput/hooks/useExactDateVariable.d.ts +93 -0
  13. package/es/schema-settings/VariableInput/hooks/useExactDateVariable.mjs +75 -0
  14. package/es/schema-settings/VariableInput/hooks/useVariableOptions.mjs +11 -1
  15. package/es/user/ChangePassword.mjs +109 -6
  16. package/es/user/index.d.ts +1 -0
  17. package/es/user/index.mjs +2 -0
  18. package/es/variables/hooks/useBuiltinVariables.mjs +8 -2
  19. package/lib/block-provider/hooks/index.js +4 -4
  20. package/lib/built-in/acl/Configuration/MenuItemsProvider.js +2 -2
  21. package/lib/built-in/attachment-preview/previewers/file-sheet.js +2 -2
  22. package/lib/built-in/pm/index.js +1 -1
  23. package/lib/collection-manager/Configuration/components/Summary.js +3 -3
  24. package/lib/collection-manager/index.js +17 -17
  25. package/lib/flag-provider/hooks/useFlag.js +1 -1
  26. package/lib/icon/Icon.js +2 -2
  27. package/lib/locale/zh-CN.js +5 -0
  28. package/lib/schema-component/antd/action/Action.Container.js +2 -2
  29. package/lib/schema-component/antd/action/Action.Modal.js +2 -2
  30. package/lib/schema-component/antd/action/Action.Sheet.js +2 -2
  31. package/lib/schema-component/antd/color-select/ColorSelect.js +4 -4
  32. package/lib/schema-component/antd/date-picker/util.js +16 -0
  33. package/lib/schema-component/antd/form-tab/index.js +2 -2
  34. package/lib/schema-component/antd/form-v2/index.js +2 -2
  35. package/lib/schema-component/antd/markdown/Markdown.js +5 -5
  36. package/lib/schema-component/antd/scroll-area/ScrollArea.js +2 -2
  37. package/lib/schema-component/antd/table-v2/index.js +3 -3
  38. package/lib/schema-component/antd/upload/shared.js +4 -4
  39. package/lib/schema-settings/SchemaSettingsDefaultValue.js +3 -2
  40. package/lib/schema-settings/VariableInput/hooks/index.js +9 -0
  41. package/lib/schema-settings/VariableInput/hooks/useExactDateVariable.js +112 -0
  42. package/lib/schema-settings/VariableInput/hooks/useVariableOptions.js +11 -1
  43. package/lib/user/ChangePassword.js +118 -5
  44. package/lib/user/index.js +24 -4
  45. package/lib/variables/VariablesProvider.js +2 -2
  46. package/lib/variables/hooks/useBuiltinVariables.js +7 -1
  47. package/package.json +10 -10
@@ -4,7 +4,7 @@ import { observer } from "@tachybase/schema";
4
4
  import { Tag } from "antd";
5
5
  import { useAntdToken } from "antd-style";
6
6
  import { useCompile } from "../../../schema-component/index.mjs";
7
- const Summary = observer((props)=>{
7
+ const Summary_Summary = observer((props)=>{
8
8
  const { schema, label } = props;
9
9
  const compile = useCompile();
10
10
  const token = useAntdToken();
@@ -57,5 +57,5 @@ const Summary = observer((props)=>{
57
57
  }, {
58
58
  displayName: 'Summary'
59
59
  });
60
- const components_Summary = Summary;
61
- export { components_Summary as default };
60
+ const Summary = Summary_Summary;
61
+ export { Summary as default };
@@ -21,6 +21,7 @@ export interface FlagProviderProps {
21
21
  */
22
22
  isInSubForm?: boolean;
23
23
  children: any;
24
+ collectionField?: any;
24
25
  }
25
26
  export declare const FlagContext: React.Context<Omit<FlagProviderProps, "children">>;
26
27
  export declare const FlagProvider: (props: FlagProviderProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,4 +1,4 @@
1
1
  import { useContext } from "react";
2
2
  import { FlagContext } from "../FlagProvider.mjs";
3
- const useFlag = ()=>useContext(FlagContext);
3
+ const useFlag = ()=>useContext(FlagContext) || {};
4
4
  export { useFlag };
@@ -18,7 +18,7 @@ const colors = {
18
18
  purple: '{{t("Purple")}}',
19
19
  default: '{{t("Default")}}'
20
20
  };
21
- const ColorSelect = connect((props)=>{
21
+ const ColorSelect_ColorSelect = connect((props)=>{
22
22
  const compile = useCompile();
23
23
  return /*#__PURE__*/ jsx(Select, {
24
24
  ...props,
@@ -44,5 +44,5 @@ const ColorSelect = connect((props)=>{
44
44
  children: compile(colors[value] || colors.default)
45
45
  });
46
46
  }));
47
- const color_select_ColorSelect = ColorSelect;
48
- export { ColorSelect, color_select_ColorSelect as default };
47
+ const ColorSelect = ColorSelect_ColorSelect;
48
+ export { ColorSelect_ColorSelect as ColorSelect, ColorSelect as default };
@@ -35,3 +35,16 @@ export declare const getDateRanges: () => {
35
35
  last90Days: () => dayjs.Dayjs[];
36
36
  next90Days: () => dayjs.Dayjs[];
37
37
  };
38
+ export declare const getDateExact: () => {
39
+ nowUtc: () => string;
40
+ nowLocal: () => string;
41
+ todayUtc: () => string;
42
+ todayLocal: () => string;
43
+ todayDate: () => string;
44
+ yesterdayUtc: () => string;
45
+ yesterdayLocal: () => string;
46
+ yesterdayDate: () => string;
47
+ tomorrowUtc: () => string;
48
+ tomorrowLocal: () => string;
49
+ tomorrowDate: () => string;
50
+ };
@@ -176,4 +176,17 @@ const getDateRanges = ()=>({
176
176
  getEnd(90, 'days')
177
177
  ]
178
178
  });
179
- export { getDateRanges, mapDatePicker, mapRangePicker, moment2str };
179
+ const getDateExact = ()=>({
180
+ nowUtc: ()=>dayjs().toISOString(),
181
+ nowLocal: ()=>dayjs().format('YYYY-MM-DD HH:mm:ss'),
182
+ todayUtc: ()=>dayjs().startOf('day').utc().toISOString(),
183
+ todayLocal: ()=>dayjs().startOf('day').format('YYYY-MM-DD HH:mm:ss'),
184
+ todayDate: ()=>dayjs().format('YYYY-MM-DD'),
185
+ yesterdayUtc: ()=>dayjs().subtract(1, 'day').startOf('day').utc().toISOString(),
186
+ yesterdayLocal: ()=>dayjs().subtract(1, 'day').startOf('day').format('YYYY-MM-DD HH:mm:ss'),
187
+ yesterdayDate: ()=>dayjs().subtract(1, 'day').format('YYYY-MM-DD'),
188
+ tomorrowUtc: ()=>dayjs().add(1, 'day').startOf('day').utc().toISOString(),
189
+ tomorrowLocal: ()=>dayjs().add(1, 'day').startOf('day').format('YYYY-MM-DD HH:mm:ss'),
190
+ tomorrowDate: ()=>dayjs().add(1, 'day').format('YYYY-MM-DD')
191
+ });
192
+ export { getDateExact, getDateRanges, mapDatePicker, mapRangePicker, moment2str };
@@ -8,7 +8,7 @@ import { ReadPretty } from "../input/index.mjs";
8
8
  import { MarkdownVoid } from "./Markdown.Void.mjs";
9
9
  import { useStyles } from "./style.mjs";
10
10
  import { convertToText, useParseMarkdown } from "./util.mjs";
11
- const Markdown = connect(Input.TextArea, mapProps((props, field)=>({
11
+ const Markdown_Markdown = connect(Input.TextArea, mapProps((props, field)=>({
12
12
  autoSize: {
13
13
  maxRows: 10,
14
14
  minRows: 3
@@ -41,6 +41,6 @@ const MarkdownReadPretty = (props)=>{
41
41
  value: value
42
42
  }));
43
43
  };
44
- Markdown.Void = MarkdownVoid;
45
- const markdown_Markdown = Markdown;
46
- export { Markdown, MarkdownReadPretty, markdown_Markdown as default };
44
+ Markdown_Markdown.Void = MarkdownVoid;
45
+ const Markdown = Markdown_Markdown;
46
+ export { Markdown_Markdown as Markdown, MarkdownReadPretty, Markdown as default };
@@ -1 +1 @@
1
- export declare const getStrength: (val: any) => 0 | 20 | 100 | 40 | 60 | 80;
1
+ export declare const getStrength: (val: any) => 0 | 20 | 100 | 60 | 40 | 80;
@@ -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
- ...(null == fieldSchema ? void 0 : fieldSchema['x-component-props']) || {},
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'],
@@ -1,3 +1,4 @@
1
1
  export * from './useBaseVariable';
2
2
  export * from './useDateVariable';
3
3
  export * from './useUserVariable';
4
+ export * from './useExactDateVariable';
@@ -1,3 +1,4 @@
1
1
  export * from "./useBaseVariable.mjs";
2
2
  export * from "./useDateVariable.mjs";
3
3
  export * from "./useUserVariable.mjs";
4
+ export * from "./useExactDateVariable.mjs";
@@ -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-hidden': '{{ hideOldPassword }}'
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 hideOldPassword = (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;
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
- hideOldPassword
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
- hideOldPassword
272
+ oldPassword
170
273
  ]);
171
274
  };
172
275
  export { useChangePassword };
@@ -1,3 +1,4 @@
1
1
  export * from './CurrentUser';
2
2
  export * from './CurrentUserProvider';
3
3
  export * from './CurrentUserSettingsMenuProvider';
4
+ export { default as VerificationCode } from './VerificationCode';
package/es/user/index.mjs CHANGED
@@ -1,3 +1,5 @@
1
+ import VerificationCode from "./VerificationCode.mjs";
1
2
  export * from "./CurrentUser.mjs";
2
3
  export * from "./CurrentUserProvider.mjs";
3
4
  export * from "./CurrentUserSettingsMenuProvider.mjs";
5
+ export { VerificationCode };
@@ -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
@@ -214,6 +214,7 @@ var __webpack_exports__ = {};
214
214
  "useInsertSchema",
215
215
  "getAssociationPath",
216
216
  "useAssociationNames",
217
+ "default",
217
218
  "getBeforeWorkflows",
218
219
  "useCustomizeRequestActionProps",
219
220
  "getFormValues",
@@ -225,7 +226,6 @@ var __webpack_exports__ = {};
225
226
  "useAssociationCreateActionProps",
226
227
  "useRefreshActionProps",
227
228
  "useUpdateActionProps",
228
- "default",
229
229
  "useResetBlockActionProps",
230
230
  "useDestroyActionProps",
231
231
  "useOptionalFieldList",
@@ -250,6 +250,7 @@ var __webpack_exports__ = {};
250
250
  "useInsertSchema",
251
251
  "getAssociationPath",
252
252
  "useAssociationNames",
253
+ "default",
253
254
  "getBeforeWorkflows",
254
255
  "useCustomizeRequestActionProps",
255
256
  "getFormValues",
@@ -261,7 +262,6 @@ var __webpack_exports__ = {};
261
262
  "useAssociationCreateActionProps",
262
263
  "useRefreshActionProps",
263
264
  "useUpdateActionProps",
264
- "default",
265
265
  "useResetBlockActionProps",
266
266
  "useDestroyActionProps",
267
267
  "useOptionalFieldList",
@@ -286,6 +286,7 @@ var __webpack_exports__ = {};
286
286
  "useInsertSchema",
287
287
  "getAssociationPath",
288
288
  "useAssociationNames",
289
+ "default",
289
290
  "getBeforeWorkflows",
290
291
  "useCustomizeRequestActionProps",
291
292
  "getFormValues",
@@ -297,7 +298,6 @@ var __webpack_exports__ = {};
297
298
  "useAssociationCreateActionProps",
298
299
  "useRefreshActionProps",
299
300
  "useUpdateActionProps",
300
- "default",
301
301
  "useResetBlockActionProps",
302
302
  "useDestroyActionProps",
303
303
  "useOptionalFieldList",
@@ -322,6 +322,7 @@ var __webpack_exports__ = {};
322
322
  "useInsertSchema",
323
323
  "getAssociationPath",
324
324
  "useAssociationNames",
325
+ "default",
325
326
  "getBeforeWorkflows",
326
327
  "useCustomizeRequestActionProps",
327
328
  "getFormValues",
@@ -333,7 +334,6 @@ var __webpack_exports__ = {};
333
334
  "useAssociationCreateActionProps",
334
335
  "useRefreshActionProps",
335
336
  "useUpdateActionProps",
336
- "default",
337
337
  "useResetBlockActionProps",
338
338
  "useDestroyActionProps",
339
339
  "useOptionalFieldList",
@@ -25,8 +25,8 @@ var __webpack_exports__ = {};
25
25
  __webpack_require__.r(__webpack_exports__);
26
26
  __webpack_require__.d(__webpack_exports__, {
27
27
  MenuItemsProvider: ()=>MenuItemsProvider,
28
- toItems: ()=>toItems,
29
- useMenuItems: ()=>useMenuItems
28
+ useMenuItems: ()=>useMenuItems,
29
+ toItems: ()=>toItems
30
30
  });
31
31
  const jsx_runtime_namespaceObject = require("react/jsx-runtime");
32
32
  const external_react_namespaceObject = require("react");
@@ -33,9 +33,9 @@ var __webpack_require__ = {};
33
33
  var __webpack_exports__ = {};
34
34
  __webpack_require__.r(__webpack_exports__);
35
35
  __webpack_require__.d(__webpack_exports__, {
36
- fileXLS: ()=>fileXLS,
37
36
  fileXLSX: ()=>fileXLSX,
38
- fileCSV: ()=>fileCSV
37
+ fileCSV: ()=>fileCSV,
38
+ fileXLS: ()=>fileXLS
39
39
  });
40
40
  const jsx_runtime_namespaceObject = require("react/jsx-runtime");
41
41
  const external_react_namespaceObject = require("react");