@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.
Files changed (148) hide show
  1. package/es/application/CustomRouterContextProvider.mjs +1 -2
  2. package/es/application/components/AppComponent.mjs +1 -3
  3. package/es/block-provider/hooks/index.mjs +1 -1
  4. package/es/built-in/acl/Configuration/schemas/scopes.mjs +4 -5
  5. package/es/built-in/dynamic-page/DynamicPage.mjs +16 -33
  6. package/es/built-in/dynamic-page/utils.d.ts +1 -2
  7. package/es/built-in/dynamic-page/utils.mjs +0 -3
  8. package/es/built-in/page-style/CustomAdminHeader.mjs +2 -2
  9. package/es/built-in/page-style/PageStyle.provider.d.ts +2 -7
  10. package/es/built-in/page-style/PageStyle.provider.mjs +3 -8
  11. package/es/built-in/page-style/TabContent.mjs +5 -7
  12. package/es/built-in/page-style/usePageStyle.d.ts +1 -1
  13. package/es/built-in/page-style/usePageStyle.mjs +1 -1
  14. package/es/built-in/page-style/useTabSettings.d.ts +3 -4
  15. package/es/built-in/page-style/useTabSettings.mjs +7 -8
  16. package/es/built-in/quick-access/PopupActionSchemaInitializerItem.mjs +2 -2
  17. package/es/collection-manager/Configuration/components/Summary.mjs +3 -3
  18. package/es/flag-provider/FlagProvider.d.ts +1 -0
  19. package/es/flag-provider/hooks/useFlag.mjs +1 -1
  20. package/es/modules/actions/add-child/CreateChildInitializer.mjs +2 -2
  21. package/es/modules/actions/add-new/CreateActionInitializer.mjs +2 -2
  22. package/es/modules/actions/add-record/CustomizeAddRecordActionInitializer.mjs +2 -2
  23. package/es/modules/actions/associate/AssociateActionInitializer.mjs +1 -2
  24. package/es/modules/actions/submit/createSubmitActionSettings.mjs +3 -6
  25. package/es/modules/actions/view-edit-popup/PopupActionInitializer.mjs +2 -2
  26. package/es/modules/actions/view-edit-popup/UpdateActionInitializer.mjs +2 -2
  27. package/es/modules/actions/view-edit-popup/ViewActionInitializer.mjs +2 -2
  28. package/es/modules/fields/component/DrawerSubTable/drawerSubTableComponentFieldSettings.mjs +2 -2
  29. package/es/modules/fields/component/Picker/recordPickerComponentFieldSettings.mjs +2 -2
  30. package/es/modules/fields/component/Select/selectComponentFieldSettings.mjs +2 -2
  31. package/es/schema-component/antd/action/Action.Container.mjs +5 -26
  32. package/es/schema-component/antd/action/Action.Designer.mjs +3 -14
  33. package/es/schema-component/antd/action/Action.Page.mjs +1 -1
  34. package/es/schema-component/antd/action/Action.mjs +11 -56
  35. package/es/schema-component/antd/action/context.d.ts +1 -9
  36. package/es/schema-component/antd/action/context.mjs +1 -10
  37. package/es/schema-component/antd/action/hooks.d.ts +1 -2
  38. package/es/schema-component/antd/action/hooks.mjs +2 -2
  39. package/es/schema-component/antd/association-field/FileManager.mjs +2 -2
  40. package/es/schema-component/antd/association-field/InternalDrawerSubTable.mjs +2 -2
  41. package/es/schema-component/antd/association-field/InternalPicker.mjs +2 -2
  42. package/es/schema-component/antd/association-field/InternalTag.mjs +2 -2
  43. package/es/schema-component/antd/association-field/InternalViewer.mjs +2 -2
  44. package/es/schema-component/antd/association-field/SubTable.mjs +2 -2
  45. package/es/schema-component/antd/color-select/ColorSelect.mjs +3 -3
  46. package/es/schema-component/antd/date-picker/util.d.ts +13 -0
  47. package/es/schema-component/antd/date-picker/util.mjs +14 -1
  48. package/es/schema-component/antd/form-item/FormItem.Settings.mjs +2 -3
  49. package/es/schema-component/antd/markdown/Markdown.mjs +4 -4
  50. package/es/schema-component/antd/page/Page.mjs +22 -27
  51. package/es/schema-component/antd/password/utils.d.ts +1 -1
  52. package/es/schema-component/antd/record-picker/InputRecordPicker.mjs +2 -2
  53. package/es/schema-component/antd/record-picker/ReadPrettyRecordPicker.mjs +2 -2
  54. package/es/schema-initializer/items/SelectActionInitializer.mjs +2 -2
  55. package/es/schema-items/OpenModeSchemaItems.mjs +16 -37
  56. package/es/schema-settings/SchemaSettingsDefaultValue.mjs +3 -2
  57. package/es/schema-settings/VariableInput/hooks/index.d.ts +1 -0
  58. package/es/schema-settings/VariableInput/hooks/index.mjs +1 -0
  59. package/es/schema-settings/VariableInput/hooks/useExactDateVariable.d.ts +93 -0
  60. package/es/schema-settings/VariableInput/hooks/useExactDateVariable.mjs +75 -0
  61. package/es/schema-settings/VariableInput/hooks/useVariableOptions.mjs +11 -1
  62. package/es/schema-templates/schemas/uiSchemaTemplates.mjs +1 -1
  63. package/es/user/ChangePassword.mjs +109 -6
  64. package/es/user/index.d.ts +1 -0
  65. package/es/user/index.mjs +2 -0
  66. package/es/variables/hooks/useBuiltinVariables.mjs +8 -2
  67. package/lib/application/CustomRouterContextProvider.js +1 -2
  68. package/lib/application/components/AppComponent.js +1 -3
  69. package/lib/block-provider/hooks/index.js +7 -7
  70. package/lib/built-in/acl/Configuration/MenuItemsProvider.js +2 -2
  71. package/lib/built-in/acl/Configuration/schemas/scopes.js +3 -4
  72. package/lib/built-in/attachment-preview/previewers/file-sheet.js +2 -2
  73. package/lib/built-in/dynamic-page/DynamicPage.js +14 -31
  74. package/lib/built-in/dynamic-page/utils.js +0 -3
  75. package/lib/built-in/page-style/CustomAdminHeader.js +2 -2
  76. package/lib/built-in/page-style/PageStyle.provider.js +2 -10
  77. package/lib/built-in/page-style/TabContent.js +4 -6
  78. package/lib/built-in/page-style/usePageStyle.js +1 -1
  79. package/lib/built-in/page-style/useTabSettings.js +7 -8
  80. package/lib/built-in/pm/index.js +1 -1
  81. package/lib/built-in/quick-access/PopupActionSchemaInitializerItem.js +1 -1
  82. package/lib/collection-manager/Configuration/components/Summary.js +3 -3
  83. package/lib/collection-manager/index.js +17 -17
  84. package/lib/flag-provider/hooks/useFlag.js +1 -1
  85. package/lib/icon/Icon.js +2 -2
  86. package/lib/locale/en_US.js +0 -1
  87. package/lib/locale/zh-CN.js +5 -0
  88. package/lib/modules/actions/add-child/CreateChildInitializer.js +2 -2
  89. package/lib/modules/actions/add-new/CreateActionInitializer.js +2 -2
  90. package/lib/modules/actions/add-record/CustomizeAddRecordActionInitializer.js +2 -2
  91. package/lib/modules/actions/associate/AssociateActionInitializer.js +1 -2
  92. package/lib/modules/actions/submit/createSubmitActionSettings.js +2 -5
  93. package/lib/modules/actions/view-edit-popup/PopupActionInitializer.js +2 -2
  94. package/lib/modules/actions/view-edit-popup/UpdateActionInitializer.js +2 -2
  95. package/lib/modules/actions/view-edit-popup/ViewActionInitializer.js +2 -2
  96. package/lib/modules/fields/component/DrawerSubTable/drawerSubTableComponentFieldSettings.js +1 -1
  97. package/lib/modules/fields/component/Picker/recordPickerComponentFieldSettings.js +1 -1
  98. package/lib/modules/fields/component/Select/selectComponentFieldSettings.js +1 -1
  99. package/lib/schema-component/antd/action/Action.Container.js +6 -27
  100. package/lib/schema-component/antd/action/Action.Designer.js +2 -13
  101. package/lib/schema-component/antd/action/Action.Modal.js +2 -2
  102. package/lib/schema-component/antd/action/Action.Page.js +1 -1
  103. package/lib/schema-component/antd/action/Action.Sheet.js +2 -2
  104. package/lib/schema-component/antd/action/Action.js +10 -55
  105. package/lib/schema-component/antd/action/context.js +1 -13
  106. package/lib/schema-component/antd/action/hooks.js +1 -1
  107. package/lib/schema-component/antd/association-field/FileManager.js +1 -1
  108. package/lib/schema-component/antd/association-field/InternalDrawerSubTable.js +1 -1
  109. package/lib/schema-component/antd/association-field/InternalPicker.js +1 -1
  110. package/lib/schema-component/antd/association-field/InternalTag.js +1 -1
  111. package/lib/schema-component/antd/association-field/InternalViewer.js +1 -1
  112. package/lib/schema-component/antd/association-field/SubTable.js +1 -1
  113. package/lib/schema-component/antd/color-select/ColorSelect.js +4 -4
  114. package/lib/schema-component/antd/date-picker/util.js +16 -0
  115. package/lib/schema-component/antd/form-item/FormItem.Settings.js +2 -3
  116. package/lib/schema-component/antd/form-tab/index.js +2 -2
  117. package/lib/schema-component/antd/form-v2/index.js +2 -2
  118. package/lib/schema-component/antd/markdown/Markdown.js +5 -5
  119. package/lib/schema-component/antd/page/Page.js +21 -26
  120. package/lib/schema-component/antd/record-picker/InputRecordPicker.js +1 -1
  121. package/lib/schema-component/antd/record-picker/ReadPrettyRecordPicker.js +1 -1
  122. package/lib/schema-component/antd/scroll-area/ScrollArea.js +2 -2
  123. package/lib/schema-component/antd/table-v2/index.js +3 -3
  124. package/lib/schema-component/antd/upload/shared.js +4 -4
  125. package/lib/schema-initializer/items/SelectActionInitializer.js +2 -2
  126. package/lib/schema-items/OpenModeSchemaItems.js +15 -36
  127. package/lib/schema-settings/SchemaSettingsDefaultValue.js +3 -2
  128. package/lib/schema-settings/VariableInput/hooks/index.js +9 -0
  129. package/lib/schema-settings/VariableInput/hooks/useExactDateVariable.js +112 -0
  130. package/lib/schema-settings/VariableInput/hooks/useVariableOptions.js +11 -1
  131. package/lib/schema-templates/schemas/uiSchemaTemplates.js +1 -1
  132. package/lib/user/ChangePassword.js +118 -5
  133. package/lib/user/index.js +24 -4
  134. package/lib/variables/VariablesProvider.js +2 -2
  135. package/lib/variables/hooks/useBuiltinVariables.js +7 -1
  136. package/package.json +10 -10
  137. package/es/built-in/dynamic-page/DynamicPage.context.d.ts +0 -0
  138. package/es/built-in/dynamic-page/DynamicPage.context.mjs +0 -0
  139. package/es/built-in/dynamic-page/DynamicPage.style.d.ts +0 -3
  140. package/es/built-in/dynamic-page/DynamicPage.style.mjs +0 -26
  141. package/es/built-in/dynamic-page/PageNavBar.d.ts +0 -3
  142. package/es/built-in/dynamic-page/PageNavBar.mjs +0 -47
  143. package/es/built-in/dynamic-page/PageNavBar.style.d.ts +0 -3
  144. package/es/built-in/dynamic-page/PageNavBar.style.mjs +0 -25
  145. package/lib/built-in/dynamic-page/DynamicPage.context.js +0 -5
  146. package/lib/built-in/dynamic-page/DynamicPage.style.js +0 -60
  147. package/lib/built-in/dynamic-page/PageNavBar.js +0 -81
  148. 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, OpenMode, useActionContext } from "../action/index.mjs";
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: OpenMode.DEFAULT,
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, OpenMode, useActionContext } from "../action/index.mjs";
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: OpenMode.DEFAULT,
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 { OpenMode } from "../../schema-component/index.mjs";
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: OpenMode.DRAWER_MODE
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 { useMemo } from "react";
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 { useIsMobile } from "../block-provider/index.mjs";
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 isMobile = useIsMobile();
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: OpenMode.DRAWER_MODE
25
+ value: 'drawer'
38
26
  },
39
27
  {
40
28
  label: t('Dialog'),
41
- value: OpenMode.MODAL
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
- OpenMode.MODAL,
62
- OpenMode.DRAWER_MODE
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']) === OpenMode.MODAL ? 'large' : 'middle',
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 pageStyle = usePageStyle();
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: OpenMode.DRAWER_MODE
118
+ value: 'drawer'
140
119
  },
141
120
  {
142
121
  label: t('Dialog'),
143
- value: OpenMode.MODAL
122
+ value: 'modal'
144
123
  },
145
124
  {
146
125
  label: t('Sheet'),
147
- value: OpenMode.SHEET
126
+ value: 'sheet'
148
127
  },
149
128
  {
150
129
  label: t('Page'),
151
- value: OpenMode.PAGE
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
- OpenMode.MODAL,
172
- OpenMode.DRAWER_MODE
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']) === OpenMode.MODAL ? 'large' : 'middle',
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
- ...(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,
@@ -108,7 +108,7 @@ const uiSchemaTemplatesSchema = {
108
108
  'x-action': 'update',
109
109
  'x-component': 'Action.Link',
110
110
  'x-component-props': {
111
- openMode: 'drawer-mode',
111
+ openMode: 'drawer',
112
112
  icon: 'EditOutlined'
113
113
  },
114
114
  properties: {
@@ -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