@tachybase/client 0.23.47 → 0.23.58

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 (101) hide show
  1. package/es/application/Application.d.ts +3 -0
  2. package/es/application/Application.mjs +8 -0
  3. package/es/application/hooks/index.d.ts +1 -0
  4. package/es/application/hooks/index.mjs +1 -0
  5. package/es/application/hooks/useGlobalVariable.d.ts +1 -0
  6. package/es/application/hooks/useGlobalVariable.mjs +18 -0
  7. package/es/application/schema-settings/hooks/index.d.ts +1 -1
  8. package/es/application/schema-settings/hooks/index.mjs +6 -8
  9. package/es/block-provider/hooks/index.mjs +4 -1
  10. package/es/built-in/index.mjs +3 -0
  11. package/es/built-in/locale/LocalePlugin.mjs +5 -1
  12. package/es/built-in/system-settings/SystemSettingsProvider.d.ts +2 -3
  13. package/es/built-in/system-settings/SystemSettingsProvider.mjs +4 -3
  14. package/es/built-in/system-settings/SystemSettingsShortcut.mjs +11 -8
  15. package/es/collection-manager/Configuration/AddCollectionAction.mjs +12 -2
  16. package/es/collection-manager/Configuration/ImportXlsx/ImportXlsxMetaAction.d.ts +2 -0
  17. package/es/collection-manager/Configuration/ImportXlsx/ImportXlsxMetaAction.mjs +255 -0
  18. package/es/collection-manager/Configuration/ImportXlsx/XlsxCollectionSchema.d.ts +89 -0
  19. package/es/collection-manager/Configuration/ImportXlsx/XlsxCollectionSchema.mjs +96 -0
  20. package/es/collection-manager/Configuration/ImportXlsx/XlsxEditFieldAction.d.ts +3 -0
  21. package/es/collection-manager/Configuration/ImportXlsx/XlsxEditFieldAction.mjs +47 -0
  22. package/es/collection-manager/Configuration/ImportXlsx/setUpdateXlsxCollectionField.d.ts +3 -0
  23. package/es/collection-manager/Configuration/ImportXlsx/setUpdateXlsxCollectionField.mjs +44 -0
  24. package/es/collection-manager/Configuration/ImportXlsx/xlsxFieldsConfigure.d.ts +1 -0
  25. package/es/collection-manager/Configuration/ImportXlsx/xlsxFieldsConfigure.mjs +380 -0
  26. package/es/collection-manager/Configuration/ImportXlsx/xlsxFormValueContextProvider.d.ts +8 -0
  27. package/es/collection-manager/Configuration/ImportXlsx/xlsxFormValueContextProvider.mjs +4 -0
  28. package/es/collection-manager/Configuration/ImportXlsx/xlsxImportAction.d.ts +1 -0
  29. package/es/collection-manager/Configuration/ImportXlsx/xlsxImportAction.mjs +187 -0
  30. package/es/collection-manager/Configuration/ImportXlsx/xlsxPreviewTable.d.ts +1 -0
  31. package/es/collection-manager/Configuration/ImportXlsx/xlsxPreviewTable.mjs +30 -0
  32. package/es/collection-manager/collectionPlugin.mjs +3 -1
  33. package/es/collection-manager/templates/import.mjs +1 -1
  34. package/es/collection-manager/templates/xlsx.d.ts +11 -0
  35. package/es/collection-manager/templates/xlsx.mjs +19 -0
  36. package/es/modules/blocks/data-blocks/table/hooks/useTableBlockProps.mjs +4 -2
  37. package/es/modules/fields/component/Radio/radioComponentFieldSettings.mjs +0 -4
  38. package/es/schema-component/antd/action/Action.Designer.mjs +5 -2
  39. package/es/schema-component/antd/action/Action.Modal.mjs +20 -31
  40. package/es/schema-component/antd/action/Action.Modal.style.d.ts +4 -0
  41. package/es/schema-component/antd/action/Action.Modal.style.mjs +35 -0
  42. package/es/schema-component/antd/action/utils.d.ts +1 -1
  43. package/es/schema-component/antd/action/utils.mjs +70 -70
  44. package/es/schema-component/antd/checkbox/Checkbox.mjs +6 -1
  45. package/es/schema-component/antd/page/Page.d.ts +1 -5
  46. package/es/schema-component/antd/page/Page.mjs +227 -146
  47. package/es/schema-component/antd/page/Page.style.d.ts +5 -0
  48. package/es/schema-component/antd/page/Page.style.mjs +45 -0
  49. package/es/schema-component/antd/page/PageDesigner.d.ts +3 -0
  50. package/es/schema-component/antd/page/PageDesigner.mjs +28 -0
  51. package/es/schema-component/antd/page/PageTabDesigner.d.ts +0 -3
  52. package/es/schema-component/antd/page/PageTabDesigner.mjs +3 -50
  53. package/es/schema-component/antd/page/style.d.ts +1 -1
  54. package/es/schema-component/antd/page/style.mjs +3 -13
  55. package/es/schema-component/antd/password/Password.d.ts +1 -1
  56. package/es/schema-component/antd/scroll-area/ScrollArea.d.ts +1 -1
  57. package/es/schema-component/antd/scroll-area/ScrollArea.mjs +2 -1
  58. package/es/schema-component/antd/variable/TextArea.mjs +1 -1
  59. package/es/schema-component/antd/variable/TextAreaWithGlobalScope.d.ts +13 -0
  60. package/es/schema-component/antd/variable/TextAreaWithGlobalScope.mjs +59 -0
  61. package/es/schema-component/antd/variable/index.d.ts +1 -0
  62. package/es/schema-component/antd/variable/index.mjs +3 -0
  63. package/lib/application/Application.js +8 -0
  64. package/lib/application/hooks/index.js +9 -0
  65. package/lib/application/hooks/useGlobalVariable.js +52 -0
  66. package/lib/application/schema-settings/hooks/index.js +6 -8
  67. package/lib/block-provider/hooks/index.js +4 -1
  68. package/lib/built-in/index.js +3 -0
  69. package/lib/built-in/locale/LocalePlugin.js +5 -1
  70. package/lib/built-in/system-settings/SystemSettingsProvider.js +4 -3
  71. package/lib/built-in/system-settings/SystemSettingsShortcut.js +11 -8
  72. package/lib/collection-manager/Configuration/AddCollectionAction.js +12 -2
  73. package/lib/collection-manager/Configuration/ImportXlsx/ImportXlsxMetaAction.js +304 -0
  74. package/lib/collection-manager/Configuration/ImportXlsx/XlsxCollectionSchema.js +130 -0
  75. package/lib/collection-manager/Configuration/ImportXlsx/XlsxEditFieldAction.js +81 -0
  76. package/lib/collection-manager/Configuration/ImportXlsx/setUpdateXlsxCollectionField.js +78 -0
  77. package/lib/collection-manager/Configuration/ImportXlsx/xlsxFieldsConfigure.js +414 -0
  78. package/lib/collection-manager/Configuration/ImportXlsx/xlsxFormValueContextProvider.js +53 -0
  79. package/lib/collection-manager/Configuration/ImportXlsx/xlsxImportAction.js +235 -0
  80. package/lib/collection-manager/Configuration/ImportXlsx/xlsxPreviewTable.js +64 -0
  81. package/lib/collection-manager/collectionPlugin.js +3 -1
  82. package/lib/collection-manager/templates/import.js +1 -1
  83. package/lib/collection-manager/templates/xlsx.js +53 -0
  84. package/lib/locale/zh-CN.js +4 -1
  85. package/lib/modules/blocks/data-blocks/table/hooks/useTableBlockProps.js +4 -2
  86. package/lib/modules/fields/component/Radio/radioComponentFieldSettings.js +0 -4
  87. package/lib/schema-component/antd/action/Action.Designer.js +5 -2
  88. package/lib/schema-component/antd/action/Action.Modal.js +20 -31
  89. package/lib/schema-component/antd/action/Action.Modal.style.js +69 -0
  90. package/lib/schema-component/antd/action/utils.js +70 -70
  91. package/lib/schema-component/antd/checkbox/Checkbox.js +6 -1
  92. package/lib/schema-component/antd/page/Page.js +227 -146
  93. package/lib/schema-component/antd/page/Page.style.js +79 -0
  94. package/lib/schema-component/antd/page/PageDesigner.js +62 -0
  95. package/lib/schema-component/antd/page/PageTabDesigner.js +2 -50
  96. package/lib/schema-component/antd/page/style.js +3 -13
  97. package/lib/schema-component/antd/scroll-area/ScrollArea.js +2 -1
  98. package/lib/schema-component/antd/variable/TextArea.js +1 -1
  99. package/lib/schema-component/antd/variable/TextAreaWithGlobalScope.js +94 -0
  100. package/lib/schema-component/antd/variable/index.js +13 -1
  101. package/package.json +7 -7
@@ -136,78 +136,78 @@ const linkageAction = async (param)=>{
136
136
  return null;
137
137
  }
138
138
  };
139
- const afterSuccessSchema = {
140
- type: 'object',
141
- title: '{{t("After successful submission")}}',
142
- properties: {
143
- successMessage: {
144
- title: '{{t("Popup message")}}',
145
- 'x-decorator': 'FormItem',
146
- 'x-component': 'Input.TextArea',
147
- 'x-component-props': {}
148
- },
149
- popupClose: {
150
- title: '{{t("Popup close method")}}',
151
- enum: [
152
- {
153
- label: '{{t("Automatic close")}}',
154
- value: false
155
- },
156
- {
157
- label: '{{t("Manually close")}}',
158
- value: true
159
- }
160
- ],
161
- 'x-decorator': 'FormItem',
162
- 'x-component': 'Radio.Group',
163
- 'x-component-props': {}
164
- },
165
- manualClose: {
166
- title: '{{t("Message clear metchod")}}',
167
- enum: [
168
- {
169
- label: '{{t("Automatic close")}}',
170
- value: false
171
- },
172
- {
173
- label: '{{t("Manually close")}}',
174
- value: true
175
- }
176
- ],
177
- 'x-decorator': 'FormItem',
178
- 'x-component': 'Radio.Group',
179
- 'x-component-props': {}
180
- },
181
- redirecting: {
182
- title: '{{t("Then")}}',
183
- enum: [
184
- {
185
- label: '{{t("Stay on current page")}}',
186
- value: false
187
- },
188
- {
189
- label: '{{t("Redirect to")}}',
190
- value: true
191
- }
192
- ],
193
- 'x-decorator': 'FormItem',
194
- 'x-component': 'Radio.Group',
195
- 'x-component-props': {},
196
- 'x-reactions': {
197
- target: 'redirectTo',
198
- fulfill: {
199
- state: {
200
- visible: '{{!!$self.value}}'
139
+ const afterSuccessSchema = (t)=>({
140
+ type: 'object',
141
+ title: t('After successful submission'),
142
+ properties: {
143
+ successMessage: {
144
+ title: '{{t("Popup message")}}',
145
+ 'x-decorator': 'FormItem',
146
+ 'x-component': 'Input.TextArea',
147
+ 'x-component-props': {}
148
+ },
149
+ popupClose: {
150
+ title: '{{t("Popup close method")}}',
151
+ enum: [
152
+ {
153
+ label: '{{t("Automatic close")}}',
154
+ value: false
155
+ },
156
+ {
157
+ label: '{{t("Manually close")}}',
158
+ value: true
159
+ }
160
+ ],
161
+ 'x-decorator': 'FormItem',
162
+ 'x-component': 'Radio.Group',
163
+ 'x-component-props': {}
164
+ },
165
+ manualClose: {
166
+ title: '{{t("Message clear metchod")}}',
167
+ enum: [
168
+ {
169
+ label: '{{t("Automatic close")}}',
170
+ value: false
171
+ },
172
+ {
173
+ label: '{{t("Manually close")}}',
174
+ value: true
175
+ }
176
+ ],
177
+ 'x-decorator': 'FormItem',
178
+ 'x-component': 'Radio.Group',
179
+ 'x-component-props': {}
180
+ },
181
+ redirecting: {
182
+ title: '{{t("Then")}}',
183
+ enum: [
184
+ {
185
+ label: '{{t("Stay on current page")}}',
186
+ value: false
187
+ },
188
+ {
189
+ label: '{{t("Redirect to")}}',
190
+ value: true
191
+ }
192
+ ],
193
+ 'x-decorator': 'FormItem',
194
+ 'x-component': 'Radio.Group',
195
+ 'x-component-props': {},
196
+ 'x-reactions': {
197
+ target: 'redirectTo',
198
+ fulfill: {
199
+ state: {
200
+ visible: '{{!!$self.value}}'
201
+ }
201
202
  }
202
203
  }
204
+ },
205
+ redirectTo: {
206
+ title: '{{t("Link")}}',
207
+ 'x-decorator': 'FormItem',
208
+ 'x-component': 'Input',
209
+ 'x-component-props': {}
203
210
  }
204
- },
205
- redirectTo: {
206
- title: '{{t("Link")}}',
207
- 'x-decorator': 'FormItem',
208
- 'x-component': 'Input',
209
- 'x-component-props': {}
210
211
  }
211
- }
212
- };
212
+ });
213
213
  export { afterSuccessSchema, linkageAction, requestSettingsSchema };
@@ -33,12 +33,17 @@ const InternalCheckbox = (0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema__.conne
33
33
  }), (0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema__.mapReadPretty)(ReadPretty));
34
34
  const InternalRadioGroup = (0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema__.connect)((props)=>{
35
35
  const { t } = (0, __WEBPACK_EXTERNAL_MODULE_react_i18next__.useTranslation)();
36
+ const field = (0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema__.useField)();
36
37
  return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE_antd__.Radio.Group, {
37
38
  ...props,
39
+ onChange: (value)=>{
40
+ if ('null' !== value.target.value) props.onChange(value);
41
+ else field['value'] = void 0;
42
+ },
38
43
  options: [
39
44
  {
40
45
  label: t('?'),
41
- value: void 0
46
+ value: 'null'
42
47
  },
43
48
  {
44
49
  label: t('Yes'),
@@ -1,5 +1 @@
1
- import React from 'react';
2
- export declare const Page: {
3
- (props: any): React.JSX.Element;
4
- displayName: string;
5
- };
1
+ export declare const Page: (props: any) => import("react").JSX.Element;
@@ -5,6 +5,7 @@ import * as __WEBPACK_EXTERNAL_MODULE__tachybase_schema__ from "@tachybase/schem
5
5
  import * as __WEBPACK_EXTERNAL_MODULE__ant_design_icons__ from "@ant-design/icons";
6
6
  import * as __WEBPACK_EXTERNAL_MODULE__ant_design_pro_layout__ from "@ant-design/pro-layout";
7
7
  import * as __WEBPACK_EXTERNAL_MODULE_antd__ from "antd";
8
+ import * as __WEBPACK_EXTERNAL_MODULE_antd_style__ from "antd-style";
8
9
  import * as __WEBPACK_EXTERNAL_MODULE_classnames__ from "classnames";
9
10
  import * as __WEBPACK_EXTERNAL_MODULE_react_error_boundary__ from "react-error-boundary";
10
11
  import * as __WEBPACK_EXTERNAL_MODULE_react_i18next__ from "react-i18next";
@@ -24,35 +25,18 @@ import * as __WEBPACK_EXTERNAL_MODULE__core_index_mjs__ from "../../core/index.m
24
25
  import * as __WEBPACK_EXTERNAL_MODULE__hooks_index_mjs__ from "../../hooks/index.mjs";
25
26
  import * as __WEBPACK_EXTERNAL_MODULE__error_fallback_index_mjs__ from "../error-fallback/index.mjs";
26
27
  import * as __WEBPACK_EXTERNAL_MODULE__FixedBlock_mjs__ from "./FixedBlock.mjs";
28
+ import * as __WEBPACK_EXTERNAL_MODULE__Page_style_mjs__ from "./Page.style.mjs";
29
+ import * as __WEBPACK_EXTERNAL_MODULE__PageDesigner_mjs__ from "./PageDesigner.mjs";
27
30
  import * as __WEBPACK_EXTERNAL_MODULE__PageTabDesigner_mjs__ from "./PageTabDesigner.mjs";
28
31
  import * as __WEBPACK_EXTERNAL_MODULE__style_mjs__ from "./style.mjs";
29
32
  const Page = (props)=>{
30
- var _fieldSchema_xcomponentprops, _fieldSchema_xcomponentprops1, _fieldSchema_xcomponentprops2;
33
+ var _fieldSchema_xcomponentprops, _fieldSchema_xcomponentprops1;
31
34
  const { children, ...others } = props;
32
35
  const { t } = (0, __WEBPACK_EXTERNAL_MODULE_react_i18next__.useTranslation)();
33
- const compile = (0, __WEBPACK_EXTERNAL_MODULE__hooks_index_mjs__.useCompile)();
34
36
  const { title, setTitle } = (0, __WEBPACK_EXTERNAL_MODULE__built_in_document_title_index_mjs__.useDocumentTitle)();
35
37
  const fieldSchema = (0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema__.useFieldSchema)();
36
- const dn = (0, __WEBPACK_EXTERNAL_MODULE__hooks_index_mjs__.useDesignable)();
37
- const { theme } = (0, __WEBPACK_EXTERNAL_MODULE__style_theme_index_mjs__.useGlobalTheme)();
38
- const { getAriaLabel } = (0, __WEBPACK_EXTERNAL_MODULE__schema_initializer_hooks_useGetAriaLabelOfSchemaInitializer_mjs__.useGetAriaLabelOfSchemaInitializer)();
39
- const { hiddenScrollArea } = (0, __WEBPACK_EXTERNAL_MODULE__built_in_context_menu_useContextMenu_mjs__.useContextMenu)();
40
- const [hasMounted, setHasMounted] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)(false);
41
- (0, __WEBPACK_EXTERNAL_MODULE_react__.useEffect)(()=>{
42
- setTimeout(()=>{
43
- setHasMounted(true);
44
- });
45
- }, []);
46
- (0, __WEBPACK_EXTERNAL_MODULE_react__.useEffect)(()=>{
47
- if (!title) setTitle(t(fieldSchema.title));
48
- }, [
49
- fieldSchema.title,
50
- title
51
- ]);
52
38
  const disablePageHeader = null === (_fieldSchema_xcomponentprops = fieldSchema['x-component-props']) || void 0 === _fieldSchema_xcomponentprops ? void 0 : _fieldSchema_xcomponentprops.disablePageHeader;
53
39
  const enablePageTabs = null === (_fieldSchema_xcomponentprops1 = fieldSchema['x-component-props']) || void 0 === _fieldSchema_xcomponentprops1 ? void 0 : _fieldSchema_xcomponentprops1.enablePageTabs;
54
- const hidePageTitle = null === (_fieldSchema_xcomponentprops2 = fieldSchema['x-component-props']) || void 0 === _fieldSchema_xcomponentprops2 ? void 0 : _fieldSchema_xcomponentprops2.hidePageTitle;
55
- const options = (0, __WEBPACK_EXTERNAL_MODULE_react__.useContext)(__WEBPACK_EXTERNAL_MODULE__tachybase_schema__.SchemaOptionsContext);
56
40
  const [searchParams, setSearchParams] = (0, __WEBPACK_EXTERNAL_MODULE_react_router_dom__.useSearchParams)();
57
41
  const [loading, setLoading] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)(false);
58
42
  const activeKey = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>searchParams.get('tab') || Object.keys(fieldSchema.properties || {}).shift(), [
@@ -60,144 +44,240 @@ const Page = (props)=>{
60
44
  searchParams
61
45
  ]);
62
46
  const [height, setHeight] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)(0);
63
- const { wrapSSR, hashId, componentCls } = (0, __WEBPACK_EXTERNAL_MODULE__style_mjs__.useStyles)();
64
47
  const aclStyles = (0, __WEBPACK_EXTERNAL_MODULE__built_in_acl_style_mjs__.useStyles)();
65
- const handleErrors = (error)=>{
66
- var _window_Sentry, _window;
67
- null === (_window = window) || void 0 === _window || null === (_window_Sentry = _window.Sentry) || void 0 === _window_Sentry || _window_Sentry.captureException(error);
68
- console.error(error);
69
- };
70
- const pageHeaderTitle = hidePageTitle ? void 0 : fieldSchema.title || compile(title);
48
+ const { wrapSSR, hashId, componentCls } = (0, __WEBPACK_EXTERNAL_MODULE__style_mjs__.getStyles)();
49
+ (0, __WEBPACK_EXTERNAL_MODULE_react__.useEffect)(()=>{
50
+ if (!title) setTitle(t(fieldSchema.title));
51
+ }, [
52
+ fieldSchema.title,
53
+ title
54
+ ]);
71
55
  return wrapSSR(/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__filter_provider_FilterProvider_mjs__.FilterBlockProvider, {
72
56
  children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsxs)("div", {
73
57
  className: "".concat(componentCls, " ").concat(hashId, " ").concat(aclStyles.styles),
74
58
  children: [
75
- /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__PageTabDesigner_mjs__.PageDesigner, {
59
+ /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__PageDesigner_mjs__.PageDesigner, {
76
60
  title: fieldSchema.title || title
77
61
  }),
78
- /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)("div", {
79
- ref: (ref)=>{
80
- setHeight(Math.floor((null == ref ? void 0 : ref.getBoundingClientRect().height) || 0) + 1);
81
- },
82
- className: "tb-page-header-wrapper",
83
- children: !disablePageHeader && /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__ant_design_pro_layout__.PageHeader, {
84
- className: (0, __WEBPACK_EXTERNAL_MODULE_classnames__["default"])('pageHeaderCss', pageHeaderTitle || enablePageTabs ? '' : 'height0'),
85
- ghost: false,
86
- title: pageHeaderTitle || ' ',
87
- ...others,
88
- footer: enablePageTabs && /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__common_index_mjs__.DndContext, {
89
- children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE_antd__.Tabs, {
90
- size: 'small',
91
- animated: hasMounted,
92
- activeKey: activeKey,
93
- onTabClick: (activeKey)=>{
94
- setLoading(true);
95
- setSearchParams([
96
- [
97
- 'tab',
98
- activeKey
99
- ]
100
- ]);
101
- setTimeout(()=>{
102
- setLoading(false);
103
- }, 50);
104
- },
105
- tabBarExtraContent: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsxs)("div", {
106
- className: "tb-tabs-wrapper",
107
- children: [
108
- !hiddenScrollArea && /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__index_mjs__.ScrollArea, {}),
109
- dn.designable && /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE_antd__.Button, {
110
- "aria-label": getAriaLabel('tabs'),
111
- icon: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__ant_design_icons__.PlusOutlined, {}),
112
- className: 'addTabBtn',
113
- type: 'dashed',
114
- onClick: async ()=>{
115
- const values = await (0, __WEBPACK_EXTERNAL_MODULE__index_mjs__.FormDialog)(t('Add tab'), ()=>/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__core_index_mjs__.SchemaComponentOptions, {
116
- scope: options.scope,
117
- components: {
118
- ...options.components
119
- },
120
- children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__tachybase_components__.FormLayout, {
121
- layout: 'vertical',
122
- children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__core_index_mjs__.SchemaComponent, {
123
- schema: {
124
- properties: {
125
- title: {
126
- title: t('Tab name'),
127
- 'x-component': 'Input',
128
- 'x-decorator': 'FormItem',
129
- required: true
130
- },
131
- icon: {
132
- title: t('Icon'),
133
- 'x-component': 'IconPicker',
134
- 'x-decorator': 'FormItem'
135
- }
136
- }
137
- }
138
- })
139
- })
140
- }), theme).open({
141
- initialValues: {}
142
- });
143
- const { title, icon } = values;
144
- dn.insertBeforeEnd({
145
- type: 'void',
146
- title,
147
- 'x-icon': icon,
148
- 'x-component': 'Grid',
149
- 'x-initializer': 'page:addBlock',
150
- properties: {}
151
- });
152
- },
153
- children: t('Add tab')
154
- })
155
- ]
156
- }),
157
- items: fieldSchema.mapProperties((schema)=>({
158
- label: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsxs)(__WEBPACK_EXTERNAL_MODULE__common_sortable_item_index_mjs__.SortableItem, {
159
- id: schema.name,
160
- schema: schema,
161
- className: (0, __WEBPACK_EXTERNAL_MODULE_classnames__["default"])('tb-action-link', 'designerCss', props.className),
162
- children: [
163
- schema['x-icon'] && /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__icon_index_mjs__.Icon, {
164
- style: {
165
- marginRight: 8
166
- },
167
- type: schema['x-icon']
168
- }),
169
- /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)("span", {
170
- children: schema.title || t('Unnamed')
171
- }),
172
- /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__PageTabDesigner_mjs__.PageTabDesigner, {
173
- schema: schema
174
- })
175
- ]
176
- }),
177
- key: schema.name
178
- }))
179
- })
180
- }),
181
- extra: !enablePageTabs && !hiddenScrollArea && /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__index_mjs__.ScrollArea, {})
182
- })
62
+ /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(PageHeader, {
63
+ disablePageHeader: disablePageHeader,
64
+ enablePageTabs: enablePageTabs,
65
+ activeKey: activeKey,
66
+ title: title,
67
+ fieldSchema: fieldSchema,
68
+ parentProps: others,
69
+ setHeight: setHeight,
70
+ setLoading: setLoading,
71
+ setSearchParams: setSearchParams
183
72
  }),
184
- /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)("div", {
185
- className: "tb-page-wrapper",
186
- children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE_react_error_boundary__.ErrorBoundary, {
187
- FallbackComponent: __WEBPACK_EXTERNAL_MODULE__error_fallback_index_mjs__.ErrorFallback,
188
- onError: handleErrors,
189
- children: PageContent(loading, disablePageHeader, enablePageTabs, fieldSchema, activeKey, height, props)
190
- })
73
+ /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(PageContentComponent, {
74
+ loading: loading,
75
+ disablePageHeader: disablePageHeader,
76
+ enablePageTabs: enablePageTabs,
77
+ fieldSchema: fieldSchema,
78
+ activeKey: activeKey,
79
+ height: height,
80
+ children: children
191
81
  })
192
82
  ]
193
83
  })
194
84
  }));
195
85
  };
196
- Page.displayName = 'Page';
197
- function PageContent(loading, disablePageHeader, enablePageTabs, fieldSchema, activeKey, height, props) {
86
+ const PageHeader = (props)=>{
87
+ var _fieldSchema_xcomponentprops;
88
+ const { disablePageHeader, enablePageTabs, setHeight, activeKey, setLoading, setSearchParams, fieldSchema, title, parentProps } = props;
89
+ const { theme } = (0, __WEBPACK_EXTERNAL_MODULE__style_theme_index_mjs__.useGlobalTheme)();
90
+ const options = (0, __WEBPACK_EXTERNAL_MODULE_react__.useContext)(__WEBPACK_EXTERNAL_MODULE__tachybase_schema__.SchemaOptionsContext);
91
+ const compile = (0, __WEBPACK_EXTERNAL_MODULE__hooks_index_mjs__.useCompile)();
92
+ const { hiddenScrollArea } = (0, __WEBPACK_EXTERNAL_MODULE__built_in_context_menu_useContextMenu_mjs__.useContextMenu)();
93
+ const hidePageTitle = null === (_fieldSchema_xcomponentprops = fieldSchema['x-component-props']) || void 0 === _fieldSchema_xcomponentprops ? void 0 : _fieldSchema_xcomponentprops.hidePageTitle;
94
+ const pageHeaderTitle = hidePageTitle ? void 0 : fieldSchema.title || compile(title);
95
+ const items = fieldSchema.mapProperties((schema)=>({
96
+ key: schema.name,
97
+ label: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(TabItem, {
98
+ schema: schema
99
+ })
100
+ }));
101
+ return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)("div", {
102
+ ref: (ref)=>{
103
+ setHeight(Math.floor((null == ref ? void 0 : ref.getBoundingClientRect().height) || 0) + 1);
104
+ },
105
+ className: "tb-page-header-wrapper",
106
+ children: !disablePageHeader && /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__ant_design_pro_layout__.PageHeader, {
107
+ className: (0, __WEBPACK_EXTERNAL_MODULE_classnames__["default"])('pageHeaderCss', pageHeaderTitle || enablePageTabs ? '' : 'height0'),
108
+ ghost: false,
109
+ title: pageHeaderTitle || ' ',
110
+ ...parentProps,
111
+ extra: !enablePageTabs && !hiddenScrollArea && /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__index_mjs__.ScrollArea, {}),
112
+ footer: enablePageTabs && /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(TabComponent, {
113
+ activeKey: activeKey,
114
+ setLoading: setLoading,
115
+ setSearchParams: setSearchParams,
116
+ hiddenScrollArea: hiddenScrollArea,
117
+ options: options,
118
+ theme: theme,
119
+ items: items
120
+ })
121
+ })
122
+ });
123
+ };
124
+ const TabComponent = (props)=>{
125
+ const { activeKey, setLoading, setSearchParams, hiddenScrollArea, options, theme, items } = props;
126
+ const { styles } = (0, __WEBPACK_EXTERNAL_MODULE__Page_style_mjs__.useStyles)();
127
+ const [hasMounted, setHasMounted] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)(false);
128
+ const handleTabClick = (activeKey)=>{
129
+ setLoading(true);
130
+ setSearchParams([
131
+ [
132
+ 'tab',
133
+ activeKey
134
+ ]
135
+ ]);
136
+ setTimeout(()=>{
137
+ setLoading(false);
138
+ }, 50);
139
+ };
140
+ (0, __WEBPACK_EXTERNAL_MODULE_react__.useEffect)(()=>{
141
+ setTimeout(()=>{
142
+ setHasMounted(true);
143
+ });
144
+ }, []);
145
+ return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__common_index_mjs__.DndContext, {
146
+ children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE_antd__.Tabs, {
147
+ className: styles.tabComponentClass,
148
+ type: "card",
149
+ size: 'small',
150
+ animated: hasMounted,
151
+ activeKey: activeKey,
152
+ items: items,
153
+ onTabClick: handleTabClick,
154
+ tabBarExtraContent: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(TabBarExtraContent, {
155
+ theme: theme,
156
+ hiddenScrollArea: hiddenScrollArea,
157
+ options: options
158
+ })
159
+ })
160
+ });
161
+ };
162
+ const TabItem = (props)=>{
163
+ const { schema } = props;
164
+ const { t } = (0, __WEBPACK_EXTERNAL_MODULE_react_i18next__.useTranslation)();
165
+ const { styles } = (0, __WEBPACK_EXTERNAL_MODULE__Page_style_mjs__.useStyles)();
166
+ return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsxs)(__WEBPACK_EXTERNAL_MODULE__common_sortable_item_index_mjs__.SortableItem, {
167
+ id: schema.name,
168
+ schema: schema,
169
+ className: (0, __WEBPACK_EXTERNAL_MODULE_classnames__["default"])('tb-action-link', 'designerCss', props.className, styles.tabItemClass),
170
+ children: [
171
+ schema['x-icon'] && /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__icon_index_mjs__.Icon, {
172
+ style: {
173
+ marginRight: 8
174
+ },
175
+ type: schema['x-icon']
176
+ }),
177
+ /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)("span", {
178
+ children: schema.title || t('Unnamed')
179
+ }),
180
+ /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)("div", {
181
+ className: "tab-designer-wrapper",
182
+ children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__PageTabDesigner_mjs__.PageTabDesigner, {
183
+ schema: schema
184
+ })
185
+ })
186
+ ]
187
+ });
188
+ };
189
+ const TabBarExtraContent = (props)=>{
190
+ const { hiddenScrollArea, options, theme } = props;
191
+ const dn = (0, __WEBPACK_EXTERNAL_MODULE__hooks_index_mjs__.useDesignable)();
192
+ const { t } = (0, __WEBPACK_EXTERNAL_MODULE_react_i18next__.useTranslation)();
193
+ const { getAriaLabel } = (0, __WEBPACK_EXTERNAL_MODULE__schema_initializer_hooks_useGetAriaLabelOfSchemaInitializer_mjs__.useGetAriaLabelOfSchemaInitializer)();
194
+ const { styles } = (0, __WEBPACK_EXTERNAL_MODULE__Page_style_mjs__.useStyles)();
195
+ const handleAddTab = async ()=>{
196
+ const values = await (0, __WEBPACK_EXTERNAL_MODULE__index_mjs__.FormDialog)(t('Add tab'), ()=>/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(AddTabForm, {
197
+ options: options
198
+ }), theme).open({
199
+ initialValues: {}
200
+ });
201
+ const { title, icon } = values;
202
+ dn.insertBeforeEnd({
203
+ type: 'void',
204
+ title,
205
+ 'x-icon': icon,
206
+ 'x-component': 'Grid',
207
+ 'x-initializer': 'page:addBlock',
208
+ properties: {}
209
+ });
210
+ };
211
+ return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsxs)("div", {
212
+ className: (0, __WEBPACK_EXTERNAL_MODULE_antd_style__.cx)(styles.tabWrapper, {
213
+ designable: dn.designable
214
+ }),
215
+ children: [
216
+ dn.designable && /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE_antd__.Button, {
217
+ className: "add-tab-btn",
218
+ type: "text",
219
+ "aria-label": getAriaLabel('tabs'),
220
+ icon: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__ant_design_icons__.PlusOutlined, {}),
221
+ onClick: handleAddTab
222
+ }),
223
+ !hiddenScrollArea && /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__index_mjs__.ScrollArea, {
224
+ className: "scroll-area-extra-content"
225
+ })
226
+ ]
227
+ });
228
+ };
229
+ const AddTabForm = (props)=>{
230
+ const { options } = props;
231
+ const { t } = (0, __WEBPACK_EXTERNAL_MODULE_react_i18next__.useTranslation)();
232
+ return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__core_index_mjs__.SchemaComponentOptions, {
233
+ scope: options.scope,
234
+ components: {
235
+ ...options.components
236
+ },
237
+ children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__tachybase_components__.FormLayout, {
238
+ layout: 'vertical',
239
+ children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__core_index_mjs__.SchemaComponent, {
240
+ schema: {
241
+ properties: {
242
+ title: {
243
+ title: t('Tab name'),
244
+ 'x-component': 'Input',
245
+ 'x-decorator': 'FormItem',
246
+ required: true
247
+ },
248
+ icon: {
249
+ title: t('Icon'),
250
+ 'x-component': 'IconPicker',
251
+ 'x-decorator': 'FormItem'
252
+ }
253
+ }
254
+ }
255
+ })
256
+ })
257
+ });
258
+ };
259
+ const PageContentComponent = (props)=>{
260
+ const handleErrors = (error)=>{
261
+ var _window_Sentry, _window;
262
+ null === (_window = window) || void 0 === _window || null === (_window_Sentry = _window.Sentry) || void 0 === _window_Sentry || _window_Sentry.captureException(error);
263
+ console.error(error);
264
+ };
265
+ return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)("div", {
266
+ className: "tb-page-wrapper",
267
+ children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE_react_error_boundary__.ErrorBoundary, {
268
+ FallbackComponent: __WEBPACK_EXTERNAL_MODULE__error_fallback_index_mjs__.ErrorFallback,
269
+ onError: handleErrors,
270
+ children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(PageContent, {
271
+ ...props
272
+ })
273
+ })
274
+ });
275
+ };
276
+ const PageContent = (props)=>{
277
+ const { loading, disablePageHeader, enablePageTabs, fieldSchema, activeKey, height, children } = props;
198
278
  const { token } = (0, __WEBPACK_EXTERNAL_MODULE__builtins_index_mjs__.useToken)();
199
279
  if (loading) return;
200
- return !disablePageHeader && enablePageTabs ? fieldSchema.mapProperties((schema)=>{
280
+ if (!disablePageHeader && enablePageTabs) return fieldSchema.mapProperties((schema)=>{
201
281
  if (schema.name !== activeKey) return null;
202
282
  return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__FixedBlock_mjs__["default"], {
203
283
  height: "calc(".concat(height, "px + 46px + ").concat(token.marginLG, "px * 2)"),
@@ -209,12 +289,13 @@ function PageContent(loading, disablePageHeader, enablePageTabs, fieldSchema, ac
209
289
  })
210
290
  })
211
291
  }, schema.name);
212
- }) : /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__FixedBlock_mjs__["default"], {
292
+ });
293
+ return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__FixedBlock_mjs__["default"], {
213
294
  height: "calc(".concat(height, "px + 46px + ").concat(token.marginLG, "px * 2)"),
214
295
  children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)("div", {
215
296
  className: "pageWithFixedBlockCss tb-page-content",
216
- children: props.children
297
+ children: children
217
298
  })
218
299
  });
219
- }
300
+ };
220
301
  export { Page };
@@ -0,0 +1,5 @@
1
+ export declare const useStyles: (props?: unknown) => import("antd-style").ReturnStyles<{
2
+ tabComponentClass: import("antd-style").SerializedStyles;
3
+ tabWrapper: import("antd-style").SerializedStyles;
4
+ tabItemClass: import("antd-style").SerializedStyles;
5
+ }>;