@tachybase/client 1.3.17 → 1.3.18

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 (111) hide show
  1. package/es/application/CustomRouterContextProvider.mjs +2 -1
  2. package/es/application/components/AppComponent.mjs +3 -1
  3. package/es/application/schema-initializer/hooks/index.d.ts +1 -1
  4. package/es/application/schema-initializer/hooks/index.mjs +2 -2
  5. package/es/block-provider/hooks/index.mjs +1 -1
  6. package/es/built-in/acl/Configuration/schemas/scopes.mjs +5 -4
  7. package/es/built-in/dynamic-page/DynamicPage.context.d.ts +0 -0
  8. package/es/built-in/dynamic-page/DynamicPage.context.mjs +0 -0
  9. package/es/built-in/dynamic-page/DynamicPage.mjs +33 -16
  10. package/es/built-in/dynamic-page/DynamicPage.style.d.ts +3 -0
  11. package/es/built-in/dynamic-page/DynamicPage.style.mjs +26 -0
  12. package/es/built-in/dynamic-page/PageNavBar.d.ts +3 -0
  13. package/es/built-in/dynamic-page/PageNavBar.mjs +47 -0
  14. package/es/built-in/dynamic-page/PageNavBar.style.d.ts +3 -0
  15. package/es/built-in/dynamic-page/PageNavBar.style.mjs +25 -0
  16. package/es/built-in/dynamic-page/utils.d.ts +2 -1
  17. package/es/built-in/dynamic-page/utils.mjs +3 -0
  18. package/es/built-in/locale/LocalePlugin.mjs +1 -1
  19. package/es/built-in/page-style/CustomAdminHeader.mjs +2 -2
  20. package/es/built-in/page-style/PageStyle.provider.d.ts +7 -2
  21. package/es/built-in/page-style/PageStyle.provider.mjs +8 -3
  22. package/es/built-in/page-style/TabContent.mjs +7 -5
  23. package/es/built-in/page-style/usePageStyle.d.ts +1 -1
  24. package/es/built-in/page-style/usePageStyle.mjs +1 -1
  25. package/es/built-in/page-style/useTabSettings.d.ts +4 -3
  26. package/es/built-in/page-style/useTabSettings.mjs +8 -7
  27. package/es/built-in/quick-access/PopupActionSchemaInitializerItem.mjs +2 -2
  28. package/es/modules/actions/add-child/CreateChildInitializer.mjs +2 -2
  29. package/es/modules/actions/add-new/CreateActionInitializer.mjs +2 -2
  30. package/es/modules/actions/add-record/CustomizeAddRecordActionInitializer.mjs +2 -2
  31. package/es/modules/actions/associate/AssociateActionInitializer.mjs +2 -1
  32. package/es/modules/actions/submit/createSubmitActionSettings.mjs +6 -3
  33. package/es/modules/actions/view-edit-popup/PopupActionInitializer.mjs +2 -2
  34. package/es/modules/actions/view-edit-popup/UpdateActionInitializer.mjs +2 -2
  35. package/es/modules/actions/view-edit-popup/ViewActionInitializer.mjs +2 -2
  36. package/es/modules/fields/component/DrawerSubTable/drawerSubTableComponentFieldSettings.mjs +2 -2
  37. package/es/modules/fields/component/Picker/recordPickerComponentFieldSettings.mjs +2 -2
  38. package/es/modules/fields/component/Select/selectComponentFieldSettings.mjs +2 -2
  39. package/es/schema-component/antd/action/Action.Container.mjs +26 -5
  40. package/es/schema-component/antd/action/Action.Designer.mjs +14 -3
  41. package/es/schema-component/antd/action/Action.Page.mjs +1 -1
  42. package/es/schema-component/antd/action/Action.mjs +56 -11
  43. package/es/schema-component/antd/action/context.d.ts +9 -1
  44. package/es/schema-component/antd/action/context.mjs +10 -1
  45. package/es/schema-component/antd/action/hooks.d.ts +2 -1
  46. package/es/schema-component/antd/action/hooks.mjs +2 -2
  47. package/es/schema-component/antd/association-field/FileManager.mjs +2 -2
  48. package/es/schema-component/antd/association-field/InternalDrawerSubTable.mjs +2 -2
  49. package/es/schema-component/antd/association-field/InternalPicker.mjs +2 -2
  50. package/es/schema-component/antd/association-field/InternalTag.mjs +2 -2
  51. package/es/schema-component/antd/association-field/InternalViewer.mjs +2 -2
  52. package/es/schema-component/antd/association-field/SubTable.mjs +2 -2
  53. package/es/schema-component/antd/form-item/FormItem.Settings.mjs +3 -2
  54. package/es/schema-component/antd/page/Page.mjs +27 -22
  55. package/es/schema-component/antd/record-picker/InputRecordPicker.mjs +2 -2
  56. package/es/schema-component/antd/record-picker/ReadPrettyRecordPicker.mjs +2 -2
  57. package/es/schema-initializer/items/SelectActionInitializer.mjs +2 -2
  58. package/es/schema-items/OpenModeSchemaItems.mjs +37 -16
  59. package/es/schema-templates/schemas/uiSchemaTemplates.mjs +1 -1
  60. package/es/user/ChangePassword.mjs +19 -4
  61. package/lib/application/CustomRouterContextProvider.js +2 -1
  62. package/lib/application/components/AppComponent.js +3 -1
  63. package/lib/application/schema-initializer/hooks/index.js +152 -193
  64. package/lib/block-provider/hooks/index.js +3 -3
  65. package/lib/built-in/acl/Configuration/schemas/scopes.js +4 -3
  66. package/lib/built-in/dynamic-page/DynamicPage.context.js +5 -0
  67. package/lib/built-in/dynamic-page/DynamicPage.js +31 -14
  68. package/lib/built-in/dynamic-page/DynamicPage.style.js +60 -0
  69. package/lib/built-in/dynamic-page/PageNavBar.js +81 -0
  70. package/lib/built-in/dynamic-page/PageNavBar.style.js +59 -0
  71. package/lib/built-in/dynamic-page/utils.js +3 -0
  72. package/lib/built-in/locale/LocalePlugin.js +1 -1
  73. package/lib/built-in/page-style/CustomAdminHeader.js +2 -2
  74. package/lib/built-in/page-style/PageStyle.provider.js +10 -2
  75. package/lib/built-in/page-style/TabContent.js +6 -4
  76. package/lib/built-in/page-style/usePageStyle.js +1 -1
  77. package/lib/built-in/page-style/useTabSettings.js +8 -7
  78. package/lib/built-in/quick-access/PopupActionSchemaInitializerItem.js +1 -1
  79. package/lib/locale/en_US.js +1 -0
  80. package/lib/modules/actions/add-child/CreateChildInitializer.js +2 -2
  81. package/lib/modules/actions/add-new/CreateActionInitializer.js +2 -2
  82. package/lib/modules/actions/add-record/CustomizeAddRecordActionInitializer.js +2 -2
  83. package/lib/modules/actions/associate/AssociateActionInitializer.js +2 -1
  84. package/lib/modules/actions/submit/createSubmitActionSettings.js +5 -2
  85. package/lib/modules/actions/view-edit-popup/PopupActionInitializer.js +2 -2
  86. package/lib/modules/actions/view-edit-popup/UpdateActionInitializer.js +2 -2
  87. package/lib/modules/actions/view-edit-popup/ViewActionInitializer.js +2 -2
  88. package/lib/modules/fields/component/DrawerSubTable/drawerSubTableComponentFieldSettings.js +1 -1
  89. package/lib/modules/fields/component/Picker/recordPickerComponentFieldSettings.js +1 -1
  90. package/lib/modules/fields/component/Select/selectComponentFieldSettings.js +1 -1
  91. package/lib/schema-component/antd/action/Action.Container.js +25 -4
  92. package/lib/schema-component/antd/action/Action.Designer.js +13 -2
  93. package/lib/schema-component/antd/action/Action.Page.js +1 -1
  94. package/lib/schema-component/antd/action/Action.js +55 -10
  95. package/lib/schema-component/antd/action/context.js +13 -1
  96. package/lib/schema-component/antd/action/hooks.js +1 -1
  97. package/lib/schema-component/antd/association-field/FileManager.js +1 -1
  98. package/lib/schema-component/antd/association-field/InternalDrawerSubTable.js +1 -1
  99. package/lib/schema-component/antd/association-field/InternalPicker.js +1 -1
  100. package/lib/schema-component/antd/association-field/InternalTag.js +1 -1
  101. package/lib/schema-component/antd/association-field/InternalViewer.js +1 -1
  102. package/lib/schema-component/antd/association-field/SubTable.js +1 -1
  103. package/lib/schema-component/antd/form-item/FormItem.Settings.js +3 -2
  104. package/lib/schema-component/antd/page/Page.js +26 -21
  105. package/lib/schema-component/antd/record-picker/InputRecordPicker.js +1 -1
  106. package/lib/schema-component/antd/record-picker/ReadPrettyRecordPicker.js +1 -1
  107. package/lib/schema-initializer/items/SelectActionInitializer.js +2 -2
  108. package/lib/schema-items/OpenModeSchemaItems.js +36 -15
  109. package/lib/schema-templates/schemas/uiSchemaTemplates.js +1 -1
  110. package/lib/user/ChangePassword.js +18 -3
  111. package/package.json +10 -11
@@ -10,7 +10,7 @@ import { cx } from "antd-style";
10
10
  import classnames from "classnames";
11
11
  import { ErrorBoundary } from "react-error-boundary";
12
12
  import { useTranslation } from "react-i18next";
13
- import { useMatch, useSearchParams } from "react-router-dom";
13
+ import { useLocation, useMatch, useNavigate } from "react-router-dom";
14
14
  import { FormDialog, ScrollArea } from "../index.mjs";
15
15
  import { useToken } from "../__builtins__/index.mjs";
16
16
  import { useStyles } from "../../../built-in/acl/style.mjs";
@@ -33,7 +33,7 @@ import { PageDesigner } from "./PageDesigner.mjs";
33
33
  import { PageTabDesigner } from "./PageTabDesigner.mjs";
34
34
  import { getStyles, useStyles as external_style_mjs_useStyles } from "./style.mjs";
35
35
  const Page = (props)=>{
36
- var _fieldSchema_xcomponentprops, _fieldSchema_xcomponentprops1, _fieldSchema_xcomponentprops2;
36
+ var _fieldSchema_xcomponentprops, _fieldSchema_xcomponentprops1, _fieldSchema_xcomponentprops2, _match_params;
37
37
  const { children, ...others } = props;
38
38
  const { t } = useTranslation();
39
39
  const { title, setTitle } = useDocumentTitle();
@@ -41,12 +41,26 @@ const Page = (props)=>{
41
41
  const disablePageHeader = null == (_fieldSchema_xcomponentprops = fieldSchema['x-component-props']) ? void 0 : _fieldSchema_xcomponentprops.disablePageHeader;
42
42
  const enablePageTabs = null == (_fieldSchema_xcomponentprops1 = fieldSchema['x-component-props']) ? void 0 : _fieldSchema_xcomponentprops1.enablePageTabs;
43
43
  const enableSharePage = null == (_fieldSchema_xcomponentprops2 = fieldSchema['x-component-props']) ? void 0 : _fieldSchema_xcomponentprops2.enableSharePage;
44
- const [searchParams, setSearchParams] = useSearchParams();
45
44
  const [loading, setLoading] = useState(false);
46
- const activeKey = useMemo(()=>searchParams.get('tab') || Object.keys(fieldSchema.properties || {}).shift(), [
47
- fieldSchema.properties,
48
- searchParams
45
+ const navigate = useNavigate();
46
+ const location = useLocation();
47
+ const match = useMatch('/:entry/:entryId/page-tab/:pageTabId/*');
48
+ const pageTabActiveKey = useMemo(()=>{
49
+ var _match_params;
50
+ return (null == match ? void 0 : null == (_match_params = match.params) ? void 0 : _match_params.pageTabId) || Object.keys(fieldSchema.properties || {}).shift();
51
+ }, [
52
+ null == match ? void 0 : null == (_match_params = match.params) ? void 0 : _match_params.pageTabId,
53
+ fieldSchema.properties
49
54
  ]);
55
+ const setPageTabUrl = (pageTabId)=>{
56
+ const currentPath = location.pathname;
57
+ const newPath = currentPath.replace(/\/page-tab\/[^/]*/, "/page-tab/".concat(pageTabId));
58
+ newPath.includes('/page-tab/') ? navigate(newPath, {
59
+ replace: true
60
+ }) : navigate("".concat(currentPath, "/page-tab/").concat(pageTabId), {
61
+ replace: true
62
+ });
63
+ };
50
64
  const [height, setHeight] = useState(0);
51
65
  const aclStyles = useStyles();
52
66
  const { wrapSSR, hashId, componentCls } = getStyles();
@@ -66,21 +80,21 @@ const Page = (props)=>{
66
80
  /*#__PURE__*/ jsx(Page_PageHeader, {
67
81
  disablePageHeader: disablePageHeader,
68
82
  enablePageTabs: enablePageTabs,
69
- activeKey: activeKey,
83
+ activeKey: pageTabActiveKey,
70
84
  title: title,
71
85
  fieldSchema: fieldSchema,
72
86
  parentProps: others,
73
87
  setHeight: setHeight,
74
88
  setLoading: setLoading,
75
89
  enableSharePage: enableSharePage,
76
- setSearchParams: setSearchParams
90
+ setPageTabUrl: setPageTabUrl
77
91
  }),
78
92
  /*#__PURE__*/ jsx(PageContentComponent, {
79
93
  loading: loading,
80
94
  disablePageHeader: disablePageHeader,
81
95
  enablePageTabs: enablePageTabs,
82
96
  fieldSchema: fieldSchema,
83
- activeKey: activeKey,
97
+ activeKey: pageTabActiveKey,
84
98
  height: height,
85
99
  children: children
86
100
  })
@@ -90,7 +104,7 @@ const Page = (props)=>{
90
104
  };
91
105
  const Page_PageHeader = (props)=>{
92
106
  var _fieldSchema_xcomponentprops;
93
- const { disablePageHeader, enablePageTabs, setHeight, activeKey, setLoading, setSearchParams, fieldSchema, title, parentProps, enableSharePage } = props;
107
+ const { disablePageHeader, enablePageTabs, setHeight, activeKey, setLoading, setPageTabUrl, fieldSchema, title, parentProps, enableSharePage } = props;
94
108
  const { theme } = useGlobalTheme();
95
109
  const options = useContext(SchemaOptionsContext);
96
110
  const compile = useCompile();
@@ -133,7 +147,7 @@ const Page_PageHeader = (props)=>{
133
147
  footer: enablePageTabs && /*#__PURE__*/ jsx(TabComponent, {
134
148
  activeKey: activeKey,
135
149
  setLoading: setLoading,
136
- setSearchParams: setSearchParams,
150
+ setPageTabUrl: setPageTabUrl,
137
151
  showScrollArea: showScrollArea,
138
152
  options: options,
139
153
  theme: theme,
@@ -219,7 +233,7 @@ const HeaderExtra = (param)=>{
219
233
  });
220
234
  };
221
235
  const TabComponent = (props)=>{
222
- const { activeKey, setLoading, setSearchParams, showScrollArea, options, theme, items } = props;
236
+ const { activeKey, setLoading, setPageTabUrl, showScrollArea, options, theme, items } = props;
223
237
  const { styles } = external_Page_style_mjs_useStyles();
224
238
  const [hasMounted, setHasMounted] = useState(false);
225
239
  const sensors = useSensors(useSensor(PointerSensor, {
@@ -228,16 +242,7 @@ const TabComponent = (props)=>{
228
242
  }
229
243
  }));
230
244
  const handleTabClick = (activeKey)=>{
231
- setLoading(true);
232
- setSearchParams([
233
- [
234
- 'tab',
235
- activeKey
236
- ]
237
- ]);
238
- setTimeout(()=>{
239
- setLoading(false);
240
- }, 50);
245
+ setPageTabUrl(activeKey);
241
246
  };
242
247
  useEffect(()=>{
243
248
  setTimeout(()=>{
@@ -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, useActionContext } from "../action/index.mjs";
10
+ import { ActionContextProvider, OpenMode, 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: "drawer",
224
+ openMode: OpenMode.DEFAULT,
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, useActionContext } from "../action/index.mjs";
10
+ import { ActionContextProvider, OpenMode, 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: 'drawer',
108
+ openMode: OpenMode.DEFAULT,
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 "react";
2
+ import { OpenMode } from "../../schema-component/index.mjs";
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: 'drawer'
12
+ openMode: OpenMode.DRAWER_MODE
13
13
  },
14
14
  properties: {
15
15
  drawer: {
@@ -1,10 +1,13 @@
1
1
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
- import "react";
2
+ import { useMemo } from "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 { useDesignable } from "../schema-component/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";
8
11
  import { SchemaSettingsSelectItem } from "../schema-settings/index.mjs";
9
12
  const SchemaInitializerOpenModeSchemaItems = (options)=>{
10
13
  var _fieldSchema_xcomponentprops, _fieldSchema_xcomponentprops1, _fieldSchema_xcomponentprops2;
@@ -13,7 +16,16 @@ const SchemaInitializerOpenModeSchemaItems = (options)=>{
13
16
  const field = useField();
14
17
  const { t } = useTranslation();
15
18
  const { dn } = useDesignable();
16
- const openModeValue = (null == fieldSchema ? void 0 : null == (_fieldSchema_xcomponentprops = fieldSchema['x-component-props']) ? void 0 : _fieldSchema_xcomponentprops['openMode']) || 'drawer';
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;
17
29
  var _fieldSchema_xcomponentprops_openSize;
18
30
  return /*#__PURE__*/ jsxs(Fragment, {
19
31
  children: [
@@ -22,11 +34,11 @@ const SchemaInitializerOpenModeSchemaItems = (options)=>{
22
34
  options: [
23
35
  {
24
36
  label: t('Drawer'),
25
- value: 'drawer'
37
+ value: OpenMode.DRAWER_MODE
26
38
  },
27
39
  {
28
40
  label: t('Dialog'),
29
- value: 'modal'
41
+ value: OpenMode.MODAL
30
42
  }
31
43
  ],
32
44
  value: openModeValue,
@@ -46,8 +58,8 @@ const SchemaInitializerOpenModeSchemaItems = (options)=>{
46
58
  }
47
59
  }) : null,
48
60
  openSize && [
49
- 'modal',
50
- 'drawer'
61
+ OpenMode.MODAL,
62
+ OpenMode.DRAWER_MODE
51
63
  ].includes(openModeValue) ? /*#__PURE__*/ jsx(SchemaInitializerItem, {
52
64
  children: /*#__PURE__*/ jsxs("div", {
53
65
  style: {
@@ -74,7 +86,7 @@ const SchemaInitializerOpenModeSchemaItems = (options)=>{
74
86
  value: 'large'
75
87
  }
76
88
  ],
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',
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',
78
90
  onChange: (value)=>{
79
91
  field.componentProps.openSize = value;
80
92
  const schema = {
@@ -106,7 +118,16 @@ const SchemaSettingOpenModeSchemaItems = (options)=>{
106
118
  const field = useField();
107
119
  const { t } = useTranslation();
108
120
  const { dn } = useDesignable();
109
- const openModeValue = (null == fieldSchema ? void 0 : null == (_fieldSchema_xcomponentprops = fieldSchema['x-component-props']) ? void 0 : _fieldSchema_xcomponentprops['openMode']) || 'drawer';
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;
110
131
  var _fieldSchema_xcomponentprops_openSize;
111
132
  return /*#__PURE__*/ jsxs(Fragment, {
112
133
  children: [
@@ -115,19 +136,19 @@ const SchemaSettingOpenModeSchemaItems = (options)=>{
115
136
  options: [
116
137
  {
117
138
  label: t('Drawer'),
118
- value: 'drawer'
139
+ value: OpenMode.DRAWER_MODE
119
140
  },
120
141
  {
121
142
  label: t('Dialog'),
122
- value: 'modal'
143
+ value: OpenMode.MODAL
123
144
  },
124
145
  {
125
146
  label: t('Sheet'),
126
- value: 'sheet'
147
+ value: OpenMode.SHEET
127
148
  },
128
149
  {
129
150
  label: t('Page'),
130
- value: 'page'
151
+ value: OpenMode.PAGE
131
152
  }
132
153
  ],
133
154
  value: openModeValue,
@@ -147,8 +168,8 @@ const SchemaSettingOpenModeSchemaItems = (options)=>{
147
168
  }
148
169
  }) : null,
149
170
  openSize && [
150
- 'modal',
151
- 'drawer'
171
+ OpenMode.MODAL,
172
+ OpenMode.DRAWER_MODE
152
173
  ].includes(openModeValue) ? /*#__PURE__*/ jsx(SchemaSettingsSelectItem, {
153
174
  title: t('Popup size'),
154
175
  options: [
@@ -165,7 +186,7 @@ const SchemaSettingOpenModeSchemaItems = (options)=>{
165
186
  value: 'large'
166
187
  }
167
188
  ],
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',
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',
169
190
  onChange: (value)=>{
170
191
  field.componentProps.openSize = value;
171
192
  const schema = {
@@ -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',
111
+ openMode: 'drawer-mode',
112
112
  icon: 'EditOutlined'
113
113
  },
114
114
  properties: {
@@ -2,7 +2,7 @@ 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 } from "../index.mjs";
5
+ import { ActionContextProvider, DropdownVisibleContext, SchemaComponent, useActionContext, useCurrentUserContext } from "../index.mjs";
6
6
  import { useAPIClient } from "../api-client/index.mjs";
7
7
  const useCloseAction = ()=>{
8
8
  const { setVisible } = useActionContext();
@@ -17,15 +17,24 @@ const useCloseAction = ()=>{
17
17
  };
18
18
  };
19
19
  const useSaveCurrentUserValues = ()=>{
20
+ var _currentUser_data_data, _currentUser_data;
20
21
  const { setVisible } = useActionContext();
21
22
  const form = useForm();
22
23
  const api = useAPIClient();
24
+ const currentUser = useCurrentUserContext();
25
+ 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;
23
26
  return {
24
27
  async run () {
25
28
  await form.submit();
26
29
  await api.resource('auth').changePassword({
27
30
  values: form.values
28
31
  });
32
+ if (hideOldPassword) currentUser.mutate({
33
+ data: {
34
+ ...currentUser.data.data,
35
+ password: ''
36
+ }
37
+ });
29
38
  await form.reset();
30
39
  setVisible(false);
31
40
  }
@@ -45,7 +54,8 @@ const schema = {
45
54
  title: '{{t("Old password")}}',
46
55
  required: true,
47
56
  'x-component': 'Password',
48
- 'x-decorator': 'FormItem'
57
+ 'x-decorator': 'FormItem',
58
+ 'x-hidden': '{{ hideOldPassword }}'
49
59
  },
50
60
  newPassword: {
51
61
  type: 'string',
@@ -119,9 +129,12 @@ const schema = {
119
129
  }
120
130
  };
121
131
  const useChangePassword = ()=>{
132
+ var _currentUser_data_data, _currentUser_data;
122
133
  const ctx = useContext(DropdownVisibleContext);
123
134
  const [visible, setVisible] = useState(false);
124
135
  const { t } = useTranslation();
136
+ 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;
125
138
  return useMemo(()=>({
126
139
  key: 'password',
127
140
  eventKey: 'ChangePassword',
@@ -142,7 +155,8 @@ const useChangePassword = ()=>{
142
155
  children: /*#__PURE__*/ jsx(SchemaComponent, {
143
156
  scope: {
144
157
  useCloseAction,
145
- useSaveCurrentUserValues
158
+ useSaveCurrentUserValues,
159
+ hideOldPassword
146
160
  },
147
161
  schema: schema
148
162
  })
@@ -151,7 +165,8 @@ const useChangePassword = ()=>{
151
165
  ]
152
166
  })
153
167
  }), [
154
- visible
168
+ visible,
169
+ hideOldPassword
155
170
  ]);
156
171
  };
157
172
  export { useChangePassword };
@@ -59,6 +59,7 @@ var external_react_default = /*#__PURE__*/ __webpack_require__.n(external_react_
59
59
  const external_lodash_namespaceObject = require("lodash");
60
60
  var external_lodash_default = /*#__PURE__*/ __webpack_require__.n(external_lodash_namespaceObject);
61
61
  const external_react_router_dom_namespaceObject = require("react-router-dom");
62
+ const index_js_namespaceObject = require("../schema-component/index.js");
62
63
  const NavigateNoUpdateContext = /*#__PURE__*/ external_react_default().createContext(null);
63
64
  NavigateNoUpdateContext.displayName = 'NavigateNoUpdateContext';
64
65
  const LocationNoUpdateContext = /*#__PURE__*/ external_react_default().createContext(null);
@@ -94,7 +95,7 @@ const IsSubPageClosedByPageMenuProvider = (param)=>{
94
95
  const [fieldSchema, setFieldSchema] = (0, external_react_namespaceObject.useState)(null);
95
96
  const isSubPageClosedByPageMenu = (0, external_react_namespaceObject.useCallback)(()=>{
96
97
  var _fieldSchema_xcomponentprops, _prevParamsRef_current_;
97
- const result = external_lodash_default().isEmpty(params['*']) && (null == fieldSchema ? void 0 : null == (_fieldSchema_xcomponentprops = fieldSchema['x-component-props']) ? void 0 : _fieldSchema_xcomponentprops.openMode) === 'page' && !!(null == (_prevParamsRef_current_ = prevParamsRef.current['*']) ? void 0 : _prevParamsRef_current_.includes(fieldSchema['x-uid']));
98
+ const result = external_lodash_default().isEmpty(params['*']) && (null == fieldSchema ? void 0 : null == (_fieldSchema_xcomponentprops = fieldSchema['x-component-props']) ? void 0 : _fieldSchema_xcomponentprops.openMode) === index_js_namespaceObject.OpenMode.PAGE && !!(null == (_prevParamsRef_current_ = prevParamsRef.current['*']) ? void 0 : _prevParamsRef_current_.includes(fieldSchema['x-uid']));
98
99
  prevParamsRef.current = params;
99
100
  return result;
100
101
  }, [
@@ -74,7 +74,9 @@ const AppComponent = (0, schema_namespaceObject.observer)((props)=>{
74
74
  app.renderComponent('AppMain')
75
75
  ]
76
76
  }),
77
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_click_to_react_component_namespaceObject.ClickToComponent, {})
77
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_click_to_react_component_namespaceObject.ClickToComponent, {
78
+ editor: process.env.REACT_APP_CLICK_TO_COMPONENT_EDITOR || 'vscode'
79
+ })
78
80
  ]
79
81
  });
80
82
  }, {