@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
@@ -1,46 +1,25 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
+ import "react";
2
3
  import { RecursionField, observer, useField, useFieldSchema } from "@tachybase/schema";
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";
4
+ import { useActionContext } from "./index.mjs";
7
5
  import { ActionDrawer } from "./Action.Drawer.mjs";
8
6
  import { ActionModal } from "./Action.Modal.mjs";
9
7
  import { ActionPage } from "./Action.Page.mjs";
10
8
  import { ActionSheet } from "./Action.Sheet.mjs";
11
9
  const ActionContainer = observer((props)=>{
12
10
  const { openMode } = useActionContext();
13
- const isMobile = useIsMobile();
14
- const pageStyle = usePageStyle();
15
- if (openMode === OpenMode.DRAWER_MODE) return /*#__PURE__*/ jsx(ActionDrawer, {
11
+ if ('drawer' === openMode) return /*#__PURE__*/ jsx(ActionDrawer, {
16
12
  footerNodeName: 'Action.Container.Footer',
17
13
  ...props
18
14
  });
19
- if (openMode === OpenMode.MODAL) return /*#__PURE__*/ jsx(ActionModal, {
15
+ if ('modal' === openMode) return /*#__PURE__*/ jsx(ActionModal, {
20
16
  footerNodeName: 'Action.Container.Footer',
21
17
  ...props
22
18
  });
23
- if (openMode === OpenMode.SHEET) return /*#__PURE__*/ jsx(ActionSheet, {
19
+ if ('sheet' === openMode) return /*#__PURE__*/ jsx(ActionSheet, {
24
20
  footerNodeName: 'Action.Container.Footer',
25
21
  ...props
26
22
  });
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
- }
44
23
  return /*#__PURE__*/ jsx(ActionPage, {
45
24
  footerNodeName: 'Action.Container.Footer',
46
25
  ...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 { OpenMode, RemoteSelect, useCompile, useDesignable } from "../../index.mjs";
7
+ import { 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 || openMode === OpenMode.PAGE) && component.includes('Form') || !component.includes('Form')) delete schema.properties.popupClose;
209
+ if ((!openMode || 'page' === openMode) && 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,18 +594,7 @@ const SetFilterScope = (props)=>{
594
594
  }
595
595
  }
596
596
  }
597
- }), [
598
- fieldSchema,
599
- gridSchema,
600
- t,
601
- type,
602
- collectionName,
603
- form,
604
- variables,
605
- localVariables,
606
- record,
607
- formBlockType
608
- ]);
597
+ }), []);
609
598
  const { getTemplateById } = useSchemaTemplateManager();
610
599
  const { dn } = useDesignable();
611
600
  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 field = useField();
40
39
  const schema = useFieldSchema();
40
+ const field = useField();
41
41
  const footerSchema = schema.reduceProperties((buf, s)=>{
42
42
  if (s['x-component'] === footerNodeName) return s;
43
43
  return buf;
@@ -10,11 +10,8 @@ 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";
14
13
  import { useACLActionParamsContext } from "../../../built-in/acl/index.mjs";
15
14
  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";
18
15
  import { useCollection, useCollectionRecordData } from "../../../data-source/index.mjs";
19
16
  import { Icon } from "../../../icon/index.mjs";
20
17
  import { RecordProvider } from "../../../record-provider/index.mjs";
@@ -30,7 +27,7 @@ import { ActionLink } from "./Action.Link.mjs";
30
27
  import { ActionModal } from "./Action.Modal.mjs";
31
28
  import { ActionPage } from "./Action.Page.mjs";
32
29
  import Action_style from "./Action.style.mjs";
33
- import { ActionContextProvider, OpenMode } from "./context.mjs";
30
+ import { ActionContextProvider } from "./context.mjs";
34
31
  import { useA } from "./hooks.mjs";
35
32
  import { useGetAriaLabelOfAction } from "./hooks/useGetAriaLabelOfAction.mjs";
36
33
  import { linkageAction } from "./utils.mjs";
@@ -57,9 +54,7 @@ const Action = withDynamicSchemaProps(observer((props)=>{
57
54
  const openMode = null == fieldSchema ? void 0 : null == (_fieldSchema_xcomponentprops = fieldSchema['x-component-props']) ? void 0 : _fieldSchema_xcomponentprops['openMode'];
58
55
  const openSize = null == fieldSchema ? void 0 : null == (_fieldSchema_xcomponentprops1 = fieldSchema['x-component-props']) ? void 0 : _fieldSchema_xcomponentprops1['openSize'];
59
56
  const disabled = form.disabled || field.disabled || (null == (_field_data = field.data) ? void 0 : _field_data.disabled) || propsDisabled;
60
- const linkageRules = useMemo(()=>(null == fieldSchema ? void 0 : fieldSchema['x-linkage-rules']) || [], [
61
- fieldSchema
62
- ]);
57
+ const linkageRules = (null == fieldSchema ? void 0 : fieldSchema['x-linkage-rules']) || [];
63
58
  const { designable } = useDesignable();
64
59
  const tarComponent = useComponent(component) || component;
65
60
  const { modal } = App.useApp();
@@ -72,23 +67,6 @@ const Action = withDynamicSchemaProps(observer((props)=>{
72
67
  const { getAriaLabel } = useGetAriaLabelOfAction(title);
73
68
  let actionTitle = title || compile(fieldSchema.title);
74
69
  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
- ]);
92
70
  useEffect(()=>{
93
71
  field.stateOfLinkageRules = {};
94
72
  linkageRules.filter((k)=>!k.disabled).forEach((v)=>{
@@ -110,30 +88,6 @@ const Action = withDynamicSchemaProps(observer((props)=>{
110
88
  record,
111
89
  variables
112
90
  ]);
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
- ]);
137
91
  const handleButtonClick = useCallback((e)=>{
138
92
  if (isPortalInBody(e.target)) return;
139
93
  e.preventDefault();
@@ -141,8 +95,14 @@ const Action = withDynamicSchemaProps(observer((props)=>{
141
95
  if (!disabled && aclCtx) {
142
96
  const onOk = ()=>{
143
97
  null == onClick || onClick(e);
144
- if (isPageMode) openPage();
145
- else openModal();
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);
146
106
  run();
147
107
  };
148
108
  if (null == confirm ? void 0 : confirm.content) modal.confirm({
@@ -161,12 +121,7 @@ const Action = withDynamicSchemaProps(observer((props)=>{
161
121
  disabled,
162
122
  modal,
163
123
  onClick,
164
- run,
165
- isPageMode,
166
- openPage,
167
- openModal,
168
- actionTitle,
169
- t
124
+ run
170
125
  ]);
171
126
  const buttonStyle = useMemo(()=>{
172
127
  var _field_data;
@@ -7,19 +7,11 @@ 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
- }
18
10
  export interface ActionContextProps {
19
11
  button?: any;
20
12
  visible?: boolean;
21
13
  setVisible?: (v: boolean) => void;
22
- openMode?: OpenMode;
14
+ openMode?: 'drawer' | 'modal' | 'page' | 'sheet';
23
15
  snapshot?: boolean;
24
16
  openSize?: OpenSize;
25
17
  containerRefKey?: string;
@@ -14,13 +14,4 @@ const ActionContextProvider = (props)=>{
14
14
  children: props.children
15
15
  });
16
16
  };
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 };
17
+ export { ActionContext, ActionContextProvider };
@@ -1,4 +1,3 @@
1
- import { OpenMode } from './context';
2
1
  export declare const useA: () => {
3
2
  run(): Promise<void>;
4
3
  };
@@ -6,7 +5,7 @@ export declare const useActionContext: () => {
6
5
  setVisible(visible: boolean, confirm?: boolean): void;
7
6
  button?: any;
8
7
  visible?: boolean;
9
- openMode?: OpenMode;
8
+ openMode?: "drawer" | "modal" | "page" | "sheet";
10
9
  snapshot?: boolean;
11
10
  openSize?: import("./context").OpenSize;
12
11
  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, OpenMode } from "./context.mjs";
6
+ import { ActionContext } 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) !== OpenMode.PAGE) if (visible) {
18
+ if ((null == ctx ? void 0 : ctx.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, OpenMode } from "../action/index.mjs";
9
+ import { ActionContextProvider } 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: OpenMode.DEFAULT,
152
+ openMode: 'drawer',
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, OpenMode } from "../action/context.mjs";
9
+ import { ActionContext, ActionContextProvider } 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: OpenMode.DEFAULT
62
+ openMode: 'drawer'
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, OpenMode } from "../action/index.mjs";
10
+ import { ActionContextProvider } 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: OpenMode.DEFAULT,
193
+ openMode: 'drawer',
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, 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 { 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: OpenMode.DEFAULT,
110
+ openMode: 'drawer',
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, OpenMode, useActionContext } from "../action/index.mjs";
12
+ import { ActionContextProvider, 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: OpenMode.DEFAULT,
124
+ openMode: 'drawer',
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, OpenMode } from "../action/index.mjs";
17
+ import { ActionContextProvider } 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: OpenMode.DEFAULT,
242
+ openMode: 'drawer',
243
243
  visible: visibleSelector,
244
244
  setVisible: setVisibleSelector
245
245
  },
@@ -18,7 +18,7 @@ const colors = {
18
18
  purple: '{{t("Purple")}}',
19
19
  default: '{{t("Default")}}'
20
20
  };
21
- const ColorSelect = connect((props)=>{
21
+ const ColorSelect_ColorSelect = connect((props)=>{
22
22
  const compile = useCompile();
23
23
  return /*#__PURE__*/ jsx(Select, {
24
24
  ...props,
@@ -44,5 +44,5 @@ const ColorSelect = connect((props)=>{
44
44
  children: compile(colors[value] || colors.default)
45
45
  });
46
46
  }));
47
- const color_select_ColorSelect = ColorSelect;
48
- export { ColorSelect, color_select_ColorSelect as default };
47
+ const ColorSelect = ColorSelect_ColorSelect;
48
+ export { ColorSelect_ColorSelect as ColorSelect, ColorSelect as default };
@@ -35,3 +35,16 @@ export declare const getDateRanges: () => {
35
35
  last90Days: () => dayjs.Dayjs[];
36
36
  next90Days: () => dayjs.Dayjs[];
37
37
  };
38
+ export declare const getDateExact: () => {
39
+ nowUtc: () => string;
40
+ nowLocal: () => string;
41
+ todayUtc: () => string;
42
+ todayLocal: () => string;
43
+ todayDate: () => string;
44
+ yesterdayUtc: () => string;
45
+ yesterdayLocal: () => string;
46
+ yesterdayDate: () => string;
47
+ tomorrowUtc: () => string;
48
+ tomorrowLocal: () => string;
49
+ tomorrowDate: () => string;
50
+ };
@@ -176,4 +176,17 @@ const getDateRanges = ()=>({
176
176
  getEnd(90, 'days')
177
177
  ]
178
178
  });
179
- export { getDateRanges, mapDatePicker, mapRangePicker, moment2str };
179
+ const getDateExact = ()=>({
180
+ nowUtc: ()=>dayjs().toISOString(),
181
+ nowLocal: ()=>dayjs().format('YYYY-MM-DD HH:mm:ss'),
182
+ todayUtc: ()=>dayjs().startOf('day').utc().toISOString(),
183
+ todayLocal: ()=>dayjs().startOf('day').format('YYYY-MM-DD HH:mm:ss'),
184
+ todayDate: ()=>dayjs().format('YYYY-MM-DD'),
185
+ yesterdayUtc: ()=>dayjs().subtract(1, 'day').startOf('day').utc().toISOString(),
186
+ yesterdayLocal: ()=>dayjs().subtract(1, 'day').startOf('day').format('YYYY-MM-DD HH:mm:ss'),
187
+ yesterdayDate: ()=>dayjs().subtract(1, 'day').format('YYYY-MM-DD'),
188
+ tomorrowUtc: ()=>dayjs().add(1, 'day').startOf('day').utc().toISOString(),
189
+ tomorrowLocal: ()=>dayjs().add(1, 'day').startOf('day').format('YYYY-MM-DD HH:mm:ss'),
190
+ tomorrowDate: ()=>dayjs().add(1, 'day').format('YYYY-MM-DD')
191
+ });
192
+ export { getDateExact, getDateRanges, mapDatePicker, mapRangePicker, moment2str };
@@ -23,7 +23,6 @@ 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";
27
26
  import { isSubMode } from "../association-field/util.mjs";
28
27
  import { removeNullCondition } from "../filter/index.mjs";
29
28
  import { getTempFieldState } from "../form-v2/utils.mjs";
@@ -733,7 +732,7 @@ const formItemSettings = new SchemaSettings({
733
732
  'x-component': 'Action',
734
733
  'x-decorator': 'ACLActionProvider',
735
734
  'x-component-props': {
736
- openMode: OpenMode.DRAWER_MODE,
735
+ openMode: 'drawer',
737
736
  type: 'default',
738
737
  component: 'CreateRecordAction'
739
738
  }
@@ -804,7 +803,7 @@ const formItemSettings = new SchemaSettings({
804
803
  'x-component': 'Action',
805
804
  'x-decorator': 'ACLActionProvider',
806
805
  'x-component-props': {
807
- openMode: OpenMode.DRAWER_MODE,
806
+ openMode: 'drawer',
808
807
  type: 'default',
809
808
  component: 'CreateRecordAction'
810
809
  }
@@ -8,7 +8,7 @@ import { ReadPretty } from "../input/index.mjs";
8
8
  import { MarkdownVoid } from "./Markdown.Void.mjs";
9
9
  import { useStyles } from "./style.mjs";
10
10
  import { convertToText, useParseMarkdown } from "./util.mjs";
11
- const Markdown = connect(Input.TextArea, mapProps((props, field)=>({
11
+ const Markdown_Markdown = connect(Input.TextArea, mapProps((props, field)=>({
12
12
  autoSize: {
13
13
  maxRows: 10,
14
14
  minRows: 3
@@ -41,6 +41,6 @@ const MarkdownReadPretty = (props)=>{
41
41
  value: value
42
42
  }));
43
43
  };
44
- Markdown.Void = MarkdownVoid;
45
- const markdown_Markdown = Markdown;
46
- export { Markdown, MarkdownReadPretty, markdown_Markdown as default };
44
+ Markdown_Markdown.Void = MarkdownVoid;
45
+ const Markdown = Markdown_Markdown;
46
+ export { Markdown_Markdown as Markdown, MarkdownReadPretty, Markdown as default };
@@ -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 { useLocation, useMatch, useNavigate } from "react-router-dom";
13
+ import { useMatch, useSearchParams } 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, _match_params;
36
+ var _fieldSchema_xcomponentprops, _fieldSchema_xcomponentprops1, _fieldSchema_xcomponentprops2;
37
37
  const { children, ...others } = props;
38
38
  const { t } = useTranslation();
39
39
  const { title, setTitle } = useDocumentTitle();
@@ -41,26 +41,12 @@ 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();
44
45
  const [loading, setLoading] = useState(false);
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
46
+ const activeKey = useMemo(()=>searchParams.get('tab') || Object.keys(fieldSchema.properties || {}).shift(), [
47
+ fieldSchema.properties,
48
+ searchParams
54
49
  ]);
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
- };
64
50
  const [height, setHeight] = useState(0);
65
51
  const aclStyles = useStyles();
66
52
  const { wrapSSR, hashId, componentCls } = getStyles();
@@ -80,21 +66,21 @@ const Page = (props)=>{
80
66
  /*#__PURE__*/ jsx(Page_PageHeader, {
81
67
  disablePageHeader: disablePageHeader,
82
68
  enablePageTabs: enablePageTabs,
83
- activeKey: pageTabActiveKey,
69
+ activeKey: activeKey,
84
70
  title: title,
85
71
  fieldSchema: fieldSchema,
86
72
  parentProps: others,
87
73
  setHeight: setHeight,
88
74
  setLoading: setLoading,
89
75
  enableSharePage: enableSharePage,
90
- setPageTabUrl: setPageTabUrl
76
+ setSearchParams: setSearchParams
91
77
  }),
92
78
  /*#__PURE__*/ jsx(PageContentComponent, {
93
79
  loading: loading,
94
80
  disablePageHeader: disablePageHeader,
95
81
  enablePageTabs: enablePageTabs,
96
82
  fieldSchema: fieldSchema,
97
- activeKey: pageTabActiveKey,
83
+ activeKey: activeKey,
98
84
  height: height,
99
85
  children: children
100
86
  })
@@ -104,7 +90,7 @@ const Page = (props)=>{
104
90
  };
105
91
  const Page_PageHeader = (props)=>{
106
92
  var _fieldSchema_xcomponentprops;
107
- const { disablePageHeader, enablePageTabs, setHeight, activeKey, setLoading, setPageTabUrl, fieldSchema, title, parentProps, enableSharePage } = props;
93
+ const { disablePageHeader, enablePageTabs, setHeight, activeKey, setLoading, setSearchParams, fieldSchema, title, parentProps, enableSharePage } = props;
108
94
  const { theme } = useGlobalTheme();
109
95
  const options = useContext(SchemaOptionsContext);
110
96
  const compile = useCompile();
@@ -147,7 +133,7 @@ const Page_PageHeader = (props)=>{
147
133
  footer: enablePageTabs && /*#__PURE__*/ jsx(TabComponent, {
148
134
  activeKey: activeKey,
149
135
  setLoading: setLoading,
150
- setPageTabUrl: setPageTabUrl,
136
+ setSearchParams: setSearchParams,
151
137
  showScrollArea: showScrollArea,
152
138
  options: options,
153
139
  theme: theme,
@@ -233,7 +219,7 @@ const HeaderExtra = (param)=>{
233
219
  });
234
220
  };
235
221
  const TabComponent = (props)=>{
236
- const { activeKey, setLoading, setPageTabUrl, showScrollArea, options, theme, items } = props;
222
+ const { activeKey, setLoading, setSearchParams, showScrollArea, options, theme, items } = props;
237
223
  const { styles } = external_Page_style_mjs_useStyles();
238
224
  const [hasMounted, setHasMounted] = useState(false);
239
225
  const sensors = useSensors(useSensor(PointerSensor, {
@@ -242,7 +228,16 @@ const TabComponent = (props)=>{
242
228
  }
243
229
  }));
244
230
  const handleTabClick = (activeKey)=>{
245
- setPageTabUrl(activeKey);
231
+ setLoading(true);
232
+ setSearchParams([
233
+ [
234
+ 'tab',
235
+ activeKey
236
+ ]
237
+ ]);
238
+ setTimeout(()=>{
239
+ setLoading(false);
240
+ }, 50);
246
241
  };
247
242
  useEffect(()=>{
248
243
  setTimeout(()=>{
@@ -1 +1 @@
1
- export declare const getStrength: (val: any) => 0 | 20 | 100 | 40 | 60 | 80;
1
+ export declare const getStrength: (val: any) => 0 | 20 | 100 | 60 | 40 | 80;