@tachybase/client 1.3.16 → 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 (112) 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/locale/index.js +5 -5
  81. package/lib/modules/actions/add-child/CreateChildInitializer.js +2 -2
  82. package/lib/modules/actions/add-new/CreateActionInitializer.js +2 -2
  83. package/lib/modules/actions/add-record/CustomizeAddRecordActionInitializer.js +2 -2
  84. package/lib/modules/actions/associate/AssociateActionInitializer.js +2 -1
  85. package/lib/modules/actions/submit/createSubmitActionSettings.js +5 -2
  86. package/lib/modules/actions/view-edit-popup/PopupActionInitializer.js +2 -2
  87. package/lib/modules/actions/view-edit-popup/UpdateActionInitializer.js +2 -2
  88. package/lib/modules/actions/view-edit-popup/ViewActionInitializer.js +2 -2
  89. package/lib/modules/fields/component/DrawerSubTable/drawerSubTableComponentFieldSettings.js +1 -1
  90. package/lib/modules/fields/component/Picker/recordPickerComponentFieldSettings.js +1 -1
  91. package/lib/modules/fields/component/Select/selectComponentFieldSettings.js +1 -1
  92. package/lib/schema-component/antd/action/Action.Container.js +25 -4
  93. package/lib/schema-component/antd/action/Action.Designer.js +13 -2
  94. package/lib/schema-component/antd/action/Action.Page.js +1 -1
  95. package/lib/schema-component/antd/action/Action.js +55 -10
  96. package/lib/schema-component/antd/action/context.js +13 -1
  97. package/lib/schema-component/antd/action/hooks.js +1 -1
  98. package/lib/schema-component/antd/association-field/FileManager.js +1 -1
  99. package/lib/schema-component/antd/association-field/InternalDrawerSubTable.js +1 -1
  100. package/lib/schema-component/antd/association-field/InternalPicker.js +1 -1
  101. package/lib/schema-component/antd/association-field/InternalTag.js +1 -1
  102. package/lib/schema-component/antd/association-field/InternalViewer.js +1 -1
  103. package/lib/schema-component/antd/association-field/SubTable.js +1 -1
  104. package/lib/schema-component/antd/form-item/FormItem.Settings.js +3 -2
  105. package/lib/schema-component/antd/page/Page.js +26 -21
  106. package/lib/schema-component/antd/record-picker/InputRecordPicker.js +1 -1
  107. package/lib/schema-component/antd/record-picker/ReadPrettyRecordPicker.js +1 -1
  108. package/lib/schema-initializer/items/SelectActionInitializer.js +2 -2
  109. package/lib/schema-items/OpenModeSchemaItems.js +36 -15
  110. package/lib/schema-templates/schemas/uiSchemaTemplates.js +1 -1
  111. package/lib/user/ChangePassword.js +18 -3
  112. package/package.json +11 -12
@@ -1,6 +1,6 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
- import "react";
3
2
  import { useSchemaInitializerItem } from "../../../application/index.mjs";
3
+ import { OpenMode } from "../../../schema-component/index.mjs";
4
4
  import { BlockInitializer } from "../../../schema-initializer/items/index.mjs";
5
5
  const PopupActionInitializer = (props)=>{
6
6
  const schema = {
@@ -11,7 +11,7 @@ const PopupActionInitializer = (props)=>{
11
11
  'x-settings': 'actionSettings:popup',
12
12
  'x-component': (null == props ? void 0 : props['x-component']) || 'Action.Link',
13
13
  'x-component-props': {
14
- openMode: 'drawer'
14
+ openMode: OpenMode.DRAWER_MODE
15
15
  },
16
16
  properties: {
17
17
  drawer: {
@@ -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 "../../../schema-initializer/items/ActionInitializer.mjs";
4
4
  const UpdateActionInitializer = (props)=>{
5
5
  const schema = {
@@ -10,7 +10,7 @@ const UpdateActionInitializer = (props)=>{
10
10
  'x-settings': 'actionSettings:edit',
11
11
  'x-component': 'Action',
12
12
  'x-component-props': {
13
- openMode: 'drawer',
13
+ openMode: OpenMode.DRAWER_MODE,
14
14
  icon: 'EditOutlined'
15
15
  },
16
16
  properties: {
@@ -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 "../../../schema-initializer/items/ActionInitializer.mjs";
4
4
  const ViewActionInitializer = (props)=>{
5
5
  const schema = {
@@ -10,7 +10,7 @@ const ViewActionInitializer = (props)=>{
10
10
  'x-settings': 'actionSettings:view',
11
11
  'x-component': 'Action',
12
12
  'x-component-props': {
13
- openMode: 'drawer'
13
+ openMode: OpenMode.DRAWER_MODE
14
14
  },
15
15
  properties: {
16
16
  drawer: {
@@ -3,7 +3,7 @@ import { useTranslation } from "react-i18next";
3
3
  import { SchemaSettings } from "../../../../application/schema-settings/SchemaSettings.mjs";
4
4
  import { useFieldComponentName } from "../../../../common/useFieldComponentName.mjs";
5
5
  import { useCollectionField } from "../../../../data-source/index.mjs";
6
- import { useDesignable, useFieldModeOptions, useIsAddNewForm } from "../../../../schema-component/index.mjs";
6
+ import { OpenMode, useDesignable, useFieldModeOptions, useIsAddNewForm } from "../../../../schema-component/index.mjs";
7
7
  import { isSubMode } from "../../../../schema-component/antd/association-field/util.mjs";
8
8
  import { useIsFieldReadPretty } from "../../../../schema-component/antd/form-item/FormItem.Settings.mjs";
9
9
  import { useColumnSchema } from "../../../../schema-component/antd/table-v2/Table.Column.Decorator.mjs";
@@ -126,7 +126,7 @@ const drawerSubTableComponentFieldSettings = new SchemaSettings({
126
126
  value: 'large'
127
127
  }
128
128
  ],
129
- value: null != (_fieldSchema_xcomponentprops_openSize = null == fieldSchema ? void 0 : null == (_fieldSchema_xcomponentprops = fieldSchema['x-component-props']) ? void 0 : _fieldSchema_xcomponentprops['openSize']) ? _fieldSchema_xcomponentprops_openSize : (null == fieldSchema ? void 0 : null == (_fieldSchema_xcomponentprops1 = fieldSchema['x-component-props']) ? void 0 : _fieldSchema_xcomponentprops1['openMode']) == 'modal' ? 'large' : 'middle',
129
+ value: null != (_fieldSchema_xcomponentprops_openSize = null == fieldSchema ? void 0 : null == (_fieldSchema_xcomponentprops = fieldSchema['x-component-props']) ? void 0 : _fieldSchema_xcomponentprops['openSize']) ? _fieldSchema_xcomponentprops_openSize : (null == fieldSchema ? void 0 : null == (_fieldSchema_xcomponentprops1 = fieldSchema['x-component-props']) ? void 0 : _fieldSchema_xcomponentprops1['openMode']) === OpenMode.MODAL ? 'large' : 'middle',
130
130
  onChange: (value)=>{
131
131
  field.componentProps.openSize = value;
132
132
  fieldSchema['x-component-props'] = {
@@ -3,7 +3,7 @@ import { useTranslation } from "react-i18next";
3
3
  import { SchemaSettings } from "../../../../application/schema-settings/SchemaSettings.mjs";
4
4
  import { useFieldComponentName } from "../../../../common/useFieldComponentName.mjs";
5
5
  import { useCollectionField } from "../../../../data-source/index.mjs";
6
- import { useDesignable, useFieldModeOptions, useIsAddNewForm } from "../../../../schema-component/index.mjs";
6
+ import { OpenMode, useDesignable, useFieldModeOptions, useIsAddNewForm } from "../../../../schema-component/index.mjs";
7
7
  import { isSubMode } from "../../../../schema-component/antd/association-field/util.mjs";
8
8
  import { useIsFieldReadPretty, useTitleFieldOptions } from "../../../../schema-component/antd/form-item/FormItem.Settings.mjs";
9
9
  import { useColumnSchema } from "../../../../schema-component/antd/table-v2/Table.Column.Decorator.mjs";
@@ -165,7 +165,7 @@ const recordPickerComponentFieldSettings = new SchemaSettings({
165
165
  value: 'large'
166
166
  }
167
167
  ],
168
- value: null != (_fieldSchema_xcomponentprops_openSize = null == fieldSchema ? void 0 : null == (_fieldSchema_xcomponentprops = fieldSchema['x-component-props']) ? void 0 : _fieldSchema_xcomponentprops['openSize']) ? _fieldSchema_xcomponentprops_openSize : (null == fieldSchema ? void 0 : null == (_fieldSchema_xcomponentprops1 = fieldSchema['x-component-props']) ? void 0 : _fieldSchema_xcomponentprops1['openMode']) == 'modal' ? 'large' : 'middle',
168
+ value: null != (_fieldSchema_xcomponentprops_openSize = null == fieldSchema ? void 0 : null == (_fieldSchema_xcomponentprops = fieldSchema['x-component-props']) ? void 0 : _fieldSchema_xcomponentprops['openSize']) ? _fieldSchema_xcomponentprops_openSize : (null == fieldSchema ? void 0 : null == (_fieldSchema_xcomponentprops1 = fieldSchema['x-component-props']) ? void 0 : _fieldSchema_xcomponentprops1['openMode']) === OpenMode.MODAL ? 'large' : 'middle',
169
169
  onChange: (value)=>{
170
170
  field.componentProps.openSize = value;
171
171
  fieldSchema['x-component-props'] = {
@@ -9,7 +9,7 @@ import { useCollectionManager_deprecated, useCollection_deprecated } from "../..
9
9
  import { useFieldComponentName } from "../../../../common/useFieldComponentName.mjs";
10
10
  import { useCollectionField } from "../../../../data-source/index.mjs";
11
11
  import { useRecord } from "../../../../record-provider/index.mjs";
12
- import { removeNullCondition, useDesignable, useFieldModeOptions, useIsAddNewForm } from "../../../../schema-component/index.mjs";
12
+ import { OpenMode, removeNullCondition, useDesignable, useFieldModeOptions, useIsAddNewForm } from "../../../../schema-component/index.mjs";
13
13
  import { isSubMode } from "../../../../schema-component/antd/association-field/util.mjs";
14
14
  import { useIsAssociationField, useIsFieldReadPretty, useIsMuiltipleAble, useIsSelectFieldMode, useTitleFieldOptions } from "../../../../schema-component/antd/form-item/FormItem.Settings.mjs";
15
15
  import { useColumnSchema } from "../../../../schema-component/antd/table-v2/Table.Column.Decorator.mjs";
@@ -192,7 +192,7 @@ const quickCreate = {
192
192
  'x-component': 'Action',
193
193
  'x-decorator': 'ACLActionProvider',
194
194
  'x-component-props': {
195
- openMode: 'drawer',
195
+ openMode: OpenMode.DRAWER_MODE,
196
196
  type: 'default',
197
197
  component: 'CreateRecordAction'
198
198
  }
@@ -1,25 +1,46 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
- import "react";
3
2
  import { RecursionField, observer, useField, useFieldSchema } from "@tachybase/schema";
4
- import { useActionContext } from "./index.mjs";
3
+ import { OpenMode, useActionContext } from "./index.mjs";
4
+ import { useIsMobile } from "../../../block-provider/index.mjs";
5
+ import { PageStyle } from "../../../built-in/page-style/PageStyle.provider.mjs";
6
+ import { usePageStyle } from "../../../built-in/page-style/usePageStyle.mjs";
5
7
  import { ActionDrawer } from "./Action.Drawer.mjs";
6
8
  import { ActionModal } from "./Action.Modal.mjs";
7
9
  import { ActionPage } from "./Action.Page.mjs";
8
10
  import { ActionSheet } from "./Action.Sheet.mjs";
9
11
  const ActionContainer = observer((props)=>{
10
12
  const { openMode } = useActionContext();
11
- if ('drawer' === openMode) return /*#__PURE__*/ jsx(ActionDrawer, {
13
+ const isMobile = useIsMobile();
14
+ const pageStyle = usePageStyle();
15
+ if (openMode === OpenMode.DRAWER_MODE) return /*#__PURE__*/ jsx(ActionDrawer, {
12
16
  footerNodeName: 'Action.Container.Footer',
13
17
  ...props
14
18
  });
15
- if ('modal' === openMode) return /*#__PURE__*/ jsx(ActionModal, {
19
+ if (openMode === OpenMode.MODAL) return /*#__PURE__*/ jsx(ActionModal, {
16
20
  footerNodeName: 'Action.Container.Footer',
17
21
  ...props
18
22
  });
19
- if ('sheet' === openMode) return /*#__PURE__*/ jsx(ActionSheet, {
23
+ if (openMode === OpenMode.SHEET) return /*#__PURE__*/ jsx(ActionSheet, {
20
24
  footerNodeName: 'Action.Container.Footer',
21
25
  ...props
22
26
  });
27
+ if (openMode === OpenMode.PAGE) return /*#__PURE__*/ jsx(ActionPage, {
28
+ footerNodeName: 'Action.Container.Footer',
29
+ ...props
30
+ });
31
+ if (!openMode || [
32
+ OpenMode.DEFAULT,
33
+ OpenMode.DRAWER
34
+ ].includes(openMode)) {
35
+ if (isMobile || pageStyle === PageStyle.TAB_STYLE) return /*#__PURE__*/ jsx(ActionPage, {
36
+ footerNodeName: 'Action.Container.Footer',
37
+ ...props
38
+ });
39
+ return /*#__PURE__*/ jsx(ActionDrawer, {
40
+ footerNodeName: 'Action.Container.Footer',
41
+ ...props
42
+ });
43
+ }
23
44
  return /*#__PURE__*/ jsx(ActionPage, {
24
45
  footerNodeName: 'Action.Container.Footer',
25
46
  ...props
@@ -4,7 +4,7 @@ import { ArrayTable } from "@tachybase/components";
4
4
  import { isValid, onFieldValueChange, uid as schema_uid, useField, useFieldSchema, useForm, useFormEffects } from "@tachybase/schema";
5
5
  import { Alert, Flex, Tag } from "antd";
6
6
  import { useTranslation } from "react-i18next";
7
- import { RemoteSelect, useCompile, useDesignable } from "../../index.mjs";
7
+ import { OpenMode, RemoteSelect, useCompile, useDesignable } from "../../index.mjs";
8
8
  import { useApp } from "../../../application/index.mjs";
9
9
  import { withDynamicSchemaProps } from "../../../application/hoc/withDynamicSchemaProps.mjs";
10
10
  import { usePlugin } from "../../../application/hooks/index.mjs";
@@ -206,7 +206,7 @@ function AfterSuccess() {
206
206
  const schema = {
207
207
  ...afterSuccessSchema(t)
208
208
  };
209
- if ((!openMode || 'page' === openMode) && component.includes('Form') || !component.includes('Form')) delete schema.properties.popupClose;
209
+ if ((!openMode || openMode === OpenMode.PAGE) && component.includes('Form') || !component.includes('Form')) delete schema.properties.popupClose;
210
210
  return /*#__PURE__*/ jsx(SchemaSettingsModalItem, {
211
211
  title: t('After successful submission'),
212
212
  initialValues: null == fieldSchema ? void 0 : null == (_fieldSchema_xactionsettings = fieldSchema['x-action-settings']) ? void 0 : _fieldSchema_xactionsettings['onSuccess'],
@@ -594,7 +594,18 @@ const SetFilterScope = (props)=>{
594
594
  }
595
595
  }
596
596
  }
597
- }), []);
597
+ }), [
598
+ fieldSchema,
599
+ gridSchema,
600
+ t,
601
+ type,
602
+ collectionName,
603
+ form,
604
+ variables,
605
+ localVariables,
606
+ record,
607
+ formBlockType
608
+ ]);
598
609
  const { getTemplateById } = useSchemaTemplateManager();
599
610
  const { dn } = useDesignable();
600
611
  const onSubmit = useCallback((v)=>{
@@ -36,8 +36,8 @@ const ActionPage = observer((props)=>{
36
36
  const { containerRefKey, visible, setVisible } = useActionContext();
37
37
  const containerRef = useScope(containerRefKey);
38
38
  const { styles } = useStyles();
39
- const schema = useFieldSchema();
40
39
  const field = useField();
40
+ const schema = useFieldSchema();
41
41
  const footerSchema = schema.reduceProperties((buf, s)=>{
42
42
  if (s['x-component'] === footerNodeName) return s;
43
43
  return buf;
@@ -10,8 +10,11 @@ import { useNavigate } from "react-router-dom";
10
10
  import { StablePopover, useActionContext, useDesignable } from "../../index.mjs";
11
11
  import { useApp } from "../../../application/index.mjs";
12
12
  import { withDynamicSchemaProps } from "../../../application/hoc/withDynamicSchemaProps.mjs";
13
+ import { useIsMobile } from "../../../block-provider/index.mjs";
13
14
  import { useACLActionParamsContext } from "../../../built-in/acl/index.mjs";
14
15
  import { PathHandler } from "../../../built-in/dynamic-page/utils.mjs";
16
+ import { PageStyle } from "../../../built-in/page-style/PageStyle.provider.mjs";
17
+ import { usePageStyle } from "../../../built-in/page-style/usePageStyle.mjs";
15
18
  import { useCollection, useCollectionRecordData } from "../../../data-source/index.mjs";
16
19
  import { Icon } from "../../../icon/index.mjs";
17
20
  import { RecordProvider } from "../../../record-provider/index.mjs";
@@ -27,7 +30,7 @@ import { ActionLink } from "./Action.Link.mjs";
27
30
  import { ActionModal } from "./Action.Modal.mjs";
28
31
  import { ActionPage } from "./Action.Page.mjs";
29
32
  import Action_style from "./Action.style.mjs";
30
- import { ActionContextProvider } from "./context.mjs";
33
+ import { ActionContextProvider, OpenMode } from "./context.mjs";
31
34
  import { useA } from "./hooks.mjs";
32
35
  import { useGetAriaLabelOfAction } from "./hooks/useGetAriaLabelOfAction.mjs";
33
36
  import { linkageAction } from "./utils.mjs";
@@ -54,7 +57,9 @@ const Action = withDynamicSchemaProps(observer((props)=>{
54
57
  const openMode = null == fieldSchema ? void 0 : null == (_fieldSchema_xcomponentprops = fieldSchema['x-component-props']) ? void 0 : _fieldSchema_xcomponentprops['openMode'];
55
58
  const openSize = null == fieldSchema ? void 0 : null == (_fieldSchema_xcomponentprops1 = fieldSchema['x-component-props']) ? void 0 : _fieldSchema_xcomponentprops1['openSize'];
56
59
  const disabled = form.disabled || field.disabled || (null == (_field_data = field.data) ? void 0 : _field_data.disabled) || propsDisabled;
57
- const linkageRules = (null == fieldSchema ? void 0 : fieldSchema['x-linkage-rules']) || [];
60
+ const linkageRules = useMemo(()=>(null == fieldSchema ? void 0 : fieldSchema['x-linkage-rules']) || [], [
61
+ fieldSchema
62
+ ]);
58
63
  const { designable } = useDesignable();
59
64
  const tarComponent = useComponent(component) || component;
60
65
  const { modal } = App.useApp();
@@ -67,6 +72,23 @@ const Action = withDynamicSchemaProps(observer((props)=>{
67
72
  const { getAriaLabel } = useGetAriaLabelOfAction(title);
68
73
  let actionTitle = title || compile(fieldSchema.title);
69
74
  actionTitle = lodash.isString(actionTitle) ? t(actionTitle) : actionTitle;
75
+ const collectionKey = null == collection ? void 0 : collection.getPrimaryKey();
76
+ const pageStyle = usePageStyle();
77
+ const isMobile = useIsMobile();
78
+ const isPageMode = useMemo(()=>{
79
+ if (null == pageMode ? void 0 : pageMode.enable) return true;
80
+ if (openMode === OpenMode.PAGE) return true;
81
+ if (!openMode || [
82
+ OpenMode.DEFAULT,
83
+ OpenMode.DRAWER
84
+ ].includes(openMode)) return isMobile || pageStyle === PageStyle.TAB_STYLE;
85
+ return false;
86
+ }, [
87
+ null == pageMode ? void 0 : pageMode.enable,
88
+ openMode,
89
+ isMobile,
90
+ pageStyle
91
+ ]);
70
92
  useEffect(()=>{
71
93
  field.stateOfLinkageRules = {};
72
94
  linkageRules.filter((k)=>!k.disabled).forEach((v)=>{
@@ -88,6 +110,30 @@ const Action = withDynamicSchemaProps(observer((props)=>{
88
110
  record,
89
111
  variables
90
112
  ]);
113
+ const openModal = useCallback(()=>{
114
+ setVisible(true);
115
+ }, []);
116
+ const openPage = useCallback(()=>{
117
+ const containerSchema = fieldSchema.reduceProperties((buf, s)=>'Action.Container' === s['x-component'] ? s : buf);
118
+ const target = PathHandler.getInstance().toWildcardPath({
119
+ collection: collection.name,
120
+ filterByTk: record[collectionKey]
121
+ });
122
+ const findMPageSchema = (schema)=>{
123
+ if (!schema) return;
124
+ if ('MPage' === schema['x-component']) return schema['x-uid'];
125
+ return findMPageSchema(null == schema ? void 0 : schema.parent);
126
+ };
127
+ const MPageUID = findMPageSchema(fieldSchema);
128
+ const finalPath = isMobile ? "./".concat(MPageUID, "/sub/").concat(containerSchema['x-uid'], "/").concat(target) : "./sub/".concat(containerSchema['x-uid'], "/").concat(target);
129
+ navigate(finalPath);
130
+ }, [
131
+ fieldSchema,
132
+ record,
133
+ collectionKey,
134
+ null == collection ? void 0 : collection.name,
135
+ navigate
136
+ ]);
91
137
  const handleButtonClick = useCallback((e)=>{
92
138
  if (isPortalInBody(e.target)) return;
93
139
  e.preventDefault();
@@ -95,14 +141,8 @@ const Action = withDynamicSchemaProps(observer((props)=>{
95
141
  if (!disabled && aclCtx) {
96
142
  const onOk = ()=>{
97
143
  null == onClick || onClick(e);
98
- const containerSchema = fieldSchema.reduceProperties((buf, s)=>'Action.Container' === s['x-component'] ? s : buf);
99
- if ((null == pageMode ? void 0 : pageMode.enable) && containerSchema) {
100
- const target = PathHandler.getInstance().toWildcardPath({
101
- collection: collection.name,
102
- filterByTk: record[collection.getPrimaryKey()]
103
- });
104
- navigate('../' + containerSchema['x-uid'] + '/' + target);
105
- } else setVisible(true);
144
+ if (isPageMode) openPage();
145
+ else openModal();
106
146
  run();
107
147
  };
108
148
  if (null == confirm ? void 0 : confirm.content) modal.confirm({
@@ -121,7 +161,12 @@ const Action = withDynamicSchemaProps(observer((props)=>{
121
161
  disabled,
122
162
  modal,
123
163
  onClick,
124
- run
164
+ run,
165
+ isPageMode,
166
+ openPage,
167
+ openModal,
168
+ actionTitle,
169
+ t
125
170
  ]);
126
171
  const buttonStyle = useMemo(()=>{
127
172
  var _field_data;
@@ -7,11 +7,19 @@ export declare const ActionContextProvider: (props: ActionContextProps & {
7
7
  children: any;
8
8
  }) => import("react/jsx-runtime").JSX.Element;
9
9
  export type OpenSize = 'small' | 'middle' | 'large';
10
+ export declare enum OpenMode {
11
+ DEFAULT = "default",
12
+ DRAWER = "drawer",
13
+ MODAL = "modal",
14
+ PAGE = "page",
15
+ SHEET = "sheet",
16
+ DRAWER_MODE = "drawer-mode"
17
+ }
10
18
  export interface ActionContextProps {
11
19
  button?: any;
12
20
  visible?: boolean;
13
21
  setVisible?: (v: boolean) => void;
14
- openMode?: 'drawer' | 'modal' | 'page' | 'sheet';
22
+ openMode?: OpenMode;
15
23
  snapshot?: boolean;
16
24
  openSize?: OpenSize;
17
25
  containerRefKey?: string;
@@ -14,4 +14,13 @@ const ActionContextProvider = (props)=>{
14
14
  children: props.children
15
15
  });
16
16
  };
17
- export { ActionContext, ActionContextProvider };
17
+ var context_OpenMode = /*#__PURE__*/ function(OpenMode) {
18
+ OpenMode["DEFAULT"] = "default";
19
+ OpenMode["DRAWER"] = "drawer";
20
+ OpenMode["MODAL"] = "modal";
21
+ OpenMode["PAGE"] = "page";
22
+ OpenMode["SHEET"] = "sheet";
23
+ OpenMode["DRAWER_MODE"] = "drawer-mode";
24
+ return OpenMode;
25
+ }({});
26
+ export { ActionContext, ActionContextProvider, context_OpenMode as OpenMode };
@@ -1,3 +1,4 @@
1
+ import { OpenMode } from './context';
1
2
  export declare const useA: () => {
2
3
  run(): Promise<void>;
3
4
  };
@@ -5,7 +6,7 @@ export declare const useActionContext: () => {
5
6
  setVisible(visible: boolean, confirm?: boolean): void;
6
7
  button?: any;
7
8
  visible?: boolean;
8
- openMode?: "drawer" | "modal" | "page" | "sheet";
9
+ openMode?: OpenMode;
9
10
  snapshot?: boolean;
10
11
  openSize?: import("./context").OpenSize;
11
12
  containerRefKey?: string;
@@ -3,7 +3,7 @@ import { useFieldSchema, useForm } from "@tachybase/schema";
3
3
  import { App } from "antd";
4
4
  import { useTranslation } from "react-i18next";
5
5
  import { useIsDetailBlock } from "../../../block-provider/FormBlockProvider.mjs";
6
- import { ActionContext } from "./context.mjs";
6
+ import { ActionContext, OpenMode } from "./context.mjs";
7
7
  const useA = ()=>({
8
8
  async run () {}
9
9
  });
@@ -15,7 +15,7 @@ const useActionContext = ()=>{
15
15
  ...ctx,
16
16
  setVisible (visible) {
17
17
  let confirm = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : false;
18
- if ((null == ctx ? void 0 : ctx.openMode) !== 'page') if (visible) {
18
+ if ((null == ctx ? void 0 : ctx.openMode) !== OpenMode.PAGE) if (visible) {
19
19
  var _ctx_setVisible1;
20
20
  null == ctx || null == (_ctx_setVisible1 = ctx.setVisible) || _ctx_setVisible1.call(ctx, visible);
21
21
  } else if (confirm && ctx.formValueChanged) modal.confirm({
@@ -6,7 +6,7 @@ import { FormProvider, RecordPickerContext, RecordPickerProvider, SchemaComponen
6
6
  import { TableSelectorParamsProvider, useTableSelectorProps } from "../../../block-provider/TableSelectorProvider.mjs";
7
7
  import { CollectionProvider_deprecated, useCollectionManager_deprecated, useCollection_deprecated } from "../../../collection-manager/index.mjs";
8
8
  import { useCompile } from "../../hooks/index.mjs";
9
- import { ActionContextProvider } from "../action/index.mjs";
9
+ import { ActionContextProvider, OpenMode } from "../action/index.mjs";
10
10
  import { EllipsisWithTooltip } from "../input/index.mjs";
11
11
  import { FileSelector, Preview } from "../preview/index.mjs";
12
12
  import { useFieldNames, useInsertSchema } from "./hooks.mjs";
@@ -149,7 +149,7 @@ const InternalFileManager = (props)=>{
149
149
  }),
150
150
  /*#__PURE__*/ jsx(ActionContextProvider, {
151
151
  value: {
152
- openMode: 'drawer',
152
+ openMode: OpenMode.DEFAULT,
153
153
  visible: visibleSelector,
154
154
  setVisible: setVisibleSelector,
155
155
  modalProps: {
@@ -6,7 +6,7 @@ import { Button, Drawer } from "antd";
6
6
  import { useTranslation } from "react-i18next";
7
7
  import { useCollectionManager } from "../../../data-source/index.mjs";
8
8
  import { FlagProvider } from "../../../flag-provider/index.mjs";
9
- import { ActionContext, ActionContextProvider } from "../action/context.mjs";
9
+ import { ActionContext, ActionContextProvider, OpenMode } from "../action/context.mjs";
10
10
  import { SubFormProvider, useAssociationFieldContext } from "./hooks.mjs";
11
11
  import { InternalSubTable } from "./InternalSubTable.mjs";
12
12
  import { ReadPrettyInternalViewer } from "./InternalViewer.mjs";
@@ -59,7 +59,7 @@ const InternaDrawerSubTable = observer((props)=>{
59
59
  ...ctx,
60
60
  visible,
61
61
  setVisible,
62
- openMode: 'drawer'
62
+ openMode: OpenMode.DEFAULT
63
63
  },
64
64
  children: /*#__PURE__*/ jsx(Drawer, {
65
65
  title: t(null == options ? void 0 : null == (_options_uiSchema = options.uiSchema) ? void 0 : _options_uiSchema.rawTitle),
@@ -7,7 +7,7 @@ import { FormProvider, RecordPickerContext, RecordPickerProvider, SchemaComponen
7
7
  import { CollectionProvider_deprecated, RecordProvider, useCollectionRecordData, useFormBlockContext } from "../../../index.mjs";
8
8
  import { TableSelectorParamsProvider, useTableSelectorProps } from "../../../block-provider/TableSelectorProvider.mjs";
9
9
  import { useCompile } from "../../hooks/index.mjs";
10
- import { ActionContextProvider } from "../action/index.mjs";
10
+ import { ActionContextProvider, OpenMode } from "../action/index.mjs";
11
11
  import { useAssociationFieldContext, useFieldNames, useInsertSchema } from "./hooks.mjs";
12
12
  import schema from "./schema.mjs";
13
13
  import { flatData, getLabelFormatValue, useLabelUiSchema } from "./util.mjs";
@@ -190,7 +190,7 @@ const InternalPicker = observer((props)=>{
190
190
  /*#__PURE__*/ jsx(ActionContextProvider, {
191
191
  value: {
192
192
  openSize: (null == (_fieldSchema_xcomponentprops = fieldSchema['x-component-props']) ? void 0 : _fieldSchema_xcomponentprops['openSize']) || openSize,
193
- openMode: 'drawer',
193
+ openMode: OpenMode.DEFAULT,
194
194
  visible: visibleSelector,
195
195
  setVisible: setVisibleSelector
196
196
  },
@@ -7,7 +7,7 @@ import { CollectionProvider_deprecated, useCollectionManager_deprecated } from "
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 { useAssociationFieldContext, useFieldNames, useInsertSchema } from "./hooks.mjs";
13
13
  import { transformNestedData } from "./InternalCascadeSelect.mjs";
@@ -107,7 +107,7 @@ const ReadPrettyInternalTag = observer((props)=>{
107
107
  value: {
108
108
  visible,
109
109
  setVisible,
110
- openMode: 'drawer',
110
+ openMode: OpenMode.DEFAULT,
111
111
  snapshot: (null == collectionField ? void 0 : collectionField.interface) === 'snapshot'
112
112
  },
113
113
  children: renderRecordProvider()
@@ -9,7 +9,7 @@ import { DeclareVariable } from "../../../modules/variable/DeclareVariable.mjs";
9
9
  import { RecordProvider, useRecord } from "../../../record-provider/index.mjs";
10
10
  import { FormProvider } from "../../core/index.mjs";
11
11
  import { useCompile } from "../../hooks/index.mjs";
12
- import { ActionContextProvider, useActionContext } from "../action/index.mjs";
12
+ import { ActionContextProvider, OpenMode, useActionContext } from "../action/index.mjs";
13
13
  import { EllipsisWithTooltip } from "../input/EllipsisWithTooltip.mjs";
14
14
  import { useAssociationFieldContext, useFieldNames, useInsertSchema } from "./hooks.mjs";
15
15
  import { transformNestedData } from "./InternalCascadeSelect.mjs";
@@ -121,7 +121,7 @@ const ReadPrettyInternalViewer = observer((props)=>{
121
121
  value: {
122
122
  visible,
123
123
  setVisible,
124
- openMode: 'drawer',
124
+ openMode: OpenMode.DEFAULT,
125
125
  snapshot: (null == collectionField ? void 0 : collectionField.interface) === 'snapshot',
126
126
  fieldSchema: fieldSchema
127
127
  },
@@ -14,7 +14,7 @@ import { CollectionRecordProvider, useCollectionRecord } from "../../../data-sou
14
14
  import { markRecordAsNew } from "../../../data-source/collection-record/isNewRecord.mjs";
15
15
  import { FlagProvider } from "../../../flag-provider/index.mjs";
16
16
  import { useCompile } from "../../hooks/index.mjs";
17
- import { ActionContextProvider } from "../action/index.mjs";
17
+ import { ActionContextProvider, OpenMode } from "../action/index.mjs";
18
18
  import { Table } from "../table-v2/Table.mjs";
19
19
  import { useAssociationFieldContext, useFieldNames } from "./hooks.mjs";
20
20
  import { useTableSelectorProps } from "./InternalPicker.mjs";
@@ -239,7 +239,7 @@ const SubTable = observer((props)=>{
239
239
  /*#__PURE__*/ jsx(ActionContextProvider, {
240
240
  value: {
241
241
  openSize,
242
- openMode: 'drawer',
242
+ openMode: OpenMode.DEFAULT,
243
243
  visible: visibleSelector,
244
244
  setVisible: setVisibleSelector
245
245
  },
@@ -23,6 +23,7 @@ import { SchemaSettingsSortingRule } from "../../../schema-settings/SchemaSettin
23
23
  import { VariableInput, getShouldChange } from "../../../schema-settings/VariableInput/VariableInput.mjs";
24
24
  import { useLocalVariables, useVariables } from "../../../variables/index.mjs";
25
25
  import { useCompile, useDesignable, useFieldModeOptions } from "../../hooks/index.mjs";
26
+ import { OpenMode } from "../action/index.mjs";
26
27
  import { isSubMode } from "../association-field/util.mjs";
27
28
  import { removeNullCondition } from "../filter/index.mjs";
28
29
  import { getTempFieldState } from "../form-v2/utils.mjs";
@@ -732,7 +733,7 @@ const formItemSettings = new SchemaSettings({
732
733
  'x-component': 'Action',
733
734
  'x-decorator': 'ACLActionProvider',
734
735
  'x-component-props': {
735
- openMode: 'drawer',
736
+ openMode: OpenMode.DRAWER_MODE,
736
737
  type: 'default',
737
738
  component: 'CreateRecordAction'
738
739
  }
@@ -803,7 +804,7 @@ const formItemSettings = new SchemaSettings({
803
804
  'x-component': 'Action',
804
805
  'x-decorator': 'ACLActionProvider',
805
806
  'x-component-props': {
806
- openMode: 'drawer',
807
+ openMode: OpenMode.DRAWER_MODE,
807
808
  type: 'default',
808
809
  component: 'CreateRecordAction'
809
810
  }