@tachybase/client 0.23.48 → 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 +6 -3
  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
@@ -168,80 +168,80 @@ const linkageAction = async (param)=>{
168
168
  return null;
169
169
  }
170
170
  };
171
- const afterSuccessSchema = {
172
- type: 'object',
173
- title: '{{t("After successful submission")}}',
174
- properties: {
175
- successMessage: {
176
- title: '{{t("Popup message")}}',
177
- 'x-decorator': 'FormItem',
178
- 'x-component': 'Input.TextArea',
179
- 'x-component-props': {}
180
- },
181
- popupClose: {
182
- title: '{{t("Popup close method")}}',
183
- enum: [
184
- {
185
- label: '{{t("Automatic close")}}',
186
- value: false
187
- },
188
- {
189
- label: '{{t("Manually close")}}',
190
- value: true
191
- }
192
- ],
193
- 'x-decorator': 'FormItem',
194
- 'x-component': 'Radio.Group',
195
- 'x-component-props': {}
196
- },
197
- manualClose: {
198
- title: '{{t("Message clear metchod")}}',
199
- enum: [
200
- {
201
- label: '{{t("Automatic close")}}',
202
- value: false
203
- },
204
- {
205
- label: '{{t("Manually close")}}',
206
- value: true
207
- }
208
- ],
209
- 'x-decorator': 'FormItem',
210
- 'x-component': 'Radio.Group',
211
- 'x-component-props': {}
212
- },
213
- redirecting: {
214
- title: '{{t("Then")}}',
215
- enum: [
216
- {
217
- label: '{{t("Stay on current page")}}',
218
- value: false
219
- },
220
- {
221
- label: '{{t("Redirect to")}}',
222
- value: true
223
- }
224
- ],
225
- 'x-decorator': 'FormItem',
226
- 'x-component': 'Radio.Group',
227
- 'x-component-props': {},
228
- 'x-reactions': {
229
- target: 'redirectTo',
230
- fulfill: {
231
- state: {
232
- visible: '{{!!$self.value}}'
171
+ const afterSuccessSchema = (t)=>({
172
+ type: 'object',
173
+ title: t('After successful submission'),
174
+ properties: {
175
+ successMessage: {
176
+ title: '{{t("Popup message")}}',
177
+ 'x-decorator': 'FormItem',
178
+ 'x-component': 'Input.TextArea',
179
+ 'x-component-props': {}
180
+ },
181
+ popupClose: {
182
+ title: '{{t("Popup close method")}}',
183
+ enum: [
184
+ {
185
+ label: '{{t("Automatic close")}}',
186
+ value: false
187
+ },
188
+ {
189
+ label: '{{t("Manually close")}}',
190
+ value: true
191
+ }
192
+ ],
193
+ 'x-decorator': 'FormItem',
194
+ 'x-component': 'Radio.Group',
195
+ 'x-component-props': {}
196
+ },
197
+ manualClose: {
198
+ title: '{{t("Message clear metchod")}}',
199
+ enum: [
200
+ {
201
+ label: '{{t("Automatic close")}}',
202
+ value: false
203
+ },
204
+ {
205
+ label: '{{t("Manually close")}}',
206
+ value: true
207
+ }
208
+ ],
209
+ 'x-decorator': 'FormItem',
210
+ 'x-component': 'Radio.Group',
211
+ 'x-component-props': {}
212
+ },
213
+ redirecting: {
214
+ title: '{{t("Then")}}',
215
+ enum: [
216
+ {
217
+ label: '{{t("Stay on current page")}}',
218
+ value: false
219
+ },
220
+ {
221
+ label: '{{t("Redirect to")}}',
222
+ value: true
223
+ }
224
+ ],
225
+ 'x-decorator': 'FormItem',
226
+ 'x-component': 'Radio.Group',
227
+ 'x-component-props': {},
228
+ 'x-reactions': {
229
+ target: 'redirectTo',
230
+ fulfill: {
231
+ state: {
232
+ visible: '{{!!$self.value}}'
233
+ }
233
234
  }
234
235
  }
236
+ },
237
+ redirectTo: {
238
+ title: '{{t("Link")}}',
239
+ 'x-decorator': 'FormItem',
240
+ 'x-component': 'Input',
241
+ 'x-component-props': {}
235
242
  }
236
- },
237
- redirectTo: {
238
- title: '{{t("Link")}}',
239
- 'x-decorator': 'FormItem',
240
- 'x-component': 'Input',
241
- 'x-component-props': {}
242
243
  }
243
- }
244
- };
244
+ });
245
245
  var __webpack_export_target__ = exports;
246
246
  for(var __webpack_i__ in __webpack_exports__)__webpack_export_target__[__webpack_i__] = __webpack_exports__[__webpack_i__];
247
247
  if (__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_target__, '__esModule', {
@@ -80,12 +80,17 @@ const InternalCheckbox = (0, schema_namespaceObject.connect)((props)=>{
80
80
  }), (0, schema_namespaceObject.mapReadPretty)(ReadPretty));
81
81
  const InternalRadioGroup = (0, schema_namespaceObject.connect)((props)=>{
82
82
  const { t } = (0, external_react_i18next_namespaceObject.useTranslation)();
83
+ const field = (0, schema_namespaceObject.useField)();
83
84
  return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.Radio.Group, {
84
85
  ...props,
86
+ onChange: (value)=>{
87
+ if ('null' !== value.target.value) props.onChange(value);
88
+ else field['value'] = void 0;
89
+ },
85
90
  options: [
86
91
  {
87
92
  label: t('?'),
88
- value: void 0
93
+ value: 'null'
89
94
  },
90
95
  {
91
96
  label: t('Yes'),
@@ -48,6 +48,7 @@ const schema_namespaceObject = require("@tachybase/schema");
48
48
  const icons_namespaceObject = require("@ant-design/icons");
49
49
  const pro_layout_namespaceObject = require("@ant-design/pro-layout");
50
50
  const external_antd_namespaceObject = require("antd");
51
+ const external_antd_style_namespaceObject = require("antd-style");
51
52
  const external_classnames_namespaceObject = require("classnames");
52
53
  var external_classnames_default = /*#__PURE__*/ __webpack_require__.n(external_classnames_namespaceObject);
53
54
  const external_react_error_boundary_namespaceObject = require("react-error-boundary");
@@ -69,35 +70,18 @@ const external_hooks_index_js_namespaceObject = require("../../hooks/index.js");
69
70
  const external_error_fallback_index_js_namespaceObject = require("../error-fallback/index.js");
70
71
  const external_FixedBlock_js_namespaceObject = require("./FixedBlock.js");
71
72
  var external_FixedBlock_js_default = /*#__PURE__*/ __webpack_require__.n(external_FixedBlock_js_namespaceObject);
73
+ const external_Page_style_js_namespaceObject = require("./Page.style.js");
74
+ const external_PageDesigner_js_namespaceObject = require("./PageDesigner.js");
72
75
  const external_PageTabDesigner_js_namespaceObject = require("./PageTabDesigner.js");
73
76
  const external_style_js_namespaceObject = require("./style.js");
74
77
  const Page = (props)=>{
75
- var _fieldSchema_xcomponentprops, _fieldSchema_xcomponentprops1, _fieldSchema_xcomponentprops2;
78
+ var _fieldSchema_xcomponentprops, _fieldSchema_xcomponentprops1;
76
79
  const { children, ...others } = props;
77
80
  const { t } = (0, external_react_i18next_namespaceObject.useTranslation)();
78
- const compile = (0, external_hooks_index_js_namespaceObject.useCompile)();
79
81
  const { title, setTitle } = (0, document_title_index_js_namespaceObject.useDocumentTitle)();
80
82
  const fieldSchema = (0, schema_namespaceObject.useFieldSchema)();
81
- const dn = (0, external_hooks_index_js_namespaceObject.useDesignable)();
82
- const { theme } = (0, theme_index_js_namespaceObject.useGlobalTheme)();
83
- const { getAriaLabel } = (0, useGetAriaLabelOfSchemaInitializer_js_namespaceObject.useGetAriaLabelOfSchemaInitializer)();
84
- const { hiddenScrollArea } = (0, useContextMenu_js_namespaceObject.useContextMenu)();
85
- const [hasMounted, setHasMounted] = (0, external_react_namespaceObject.useState)(false);
86
- (0, external_react_namespaceObject.useEffect)(()=>{
87
- setTimeout(()=>{
88
- setHasMounted(true);
89
- });
90
- }, []);
91
- (0, external_react_namespaceObject.useEffect)(()=>{
92
- if (!title) setTitle(t(fieldSchema.title));
93
- }, [
94
- fieldSchema.title,
95
- title
96
- ]);
97
83
  const disablePageHeader = null === (_fieldSchema_xcomponentprops = fieldSchema['x-component-props']) || void 0 === _fieldSchema_xcomponentprops ? void 0 : _fieldSchema_xcomponentprops.disablePageHeader;
98
84
  const enablePageTabs = null === (_fieldSchema_xcomponentprops1 = fieldSchema['x-component-props']) || void 0 === _fieldSchema_xcomponentprops1 ? void 0 : _fieldSchema_xcomponentprops1.enablePageTabs;
99
- const hidePageTitle = null === (_fieldSchema_xcomponentprops2 = fieldSchema['x-component-props']) || void 0 === _fieldSchema_xcomponentprops2 ? void 0 : _fieldSchema_xcomponentprops2.hidePageTitle;
100
- const options = (0, external_react_namespaceObject.useContext)(schema_namespaceObject.SchemaOptionsContext);
101
85
  const [searchParams, setSearchParams] = (0, external_react_router_dom_namespaceObject.useSearchParams)();
102
86
  const [loading, setLoading] = (0, external_react_namespaceObject.useState)(false);
103
87
  const activeKey = (0, external_react_namespaceObject.useMemo)(()=>searchParams.get('tab') || Object.keys(fieldSchema.properties || {}).shift(), [
@@ -105,144 +89,240 @@ const Page = (props)=>{
105
89
  searchParams
106
90
  ]);
107
91
  const [height, setHeight] = (0, external_react_namespaceObject.useState)(0);
108
- const { wrapSSR, hashId, componentCls } = (0, external_style_js_namespaceObject.useStyles)();
109
92
  const aclStyles = (0, style_js_namespaceObject.useStyles)();
110
- const handleErrors = (error)=>{
111
- var _window_Sentry, _window;
112
- null === (_window = window) || void 0 === _window || null === (_window_Sentry = _window.Sentry) || void 0 === _window_Sentry || _window_Sentry.captureException(error);
113
- console.error(error);
114
- };
115
- const pageHeaderTitle = hidePageTitle ? void 0 : fieldSchema.title || compile(title);
93
+ const { wrapSSR, hashId, componentCls } = (0, external_style_js_namespaceObject.getStyles)();
94
+ (0, external_react_namespaceObject.useEffect)(()=>{
95
+ if (!title) setTitle(t(fieldSchema.title));
96
+ }, [
97
+ fieldSchema.title,
98
+ title
99
+ ]);
116
100
  return wrapSSR(/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(FilterProvider_js_namespaceObject.FilterBlockProvider, {
117
101
  children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
118
102
  className: "".concat(componentCls, " ").concat(hashId, " ").concat(aclStyles.styles),
119
103
  children: [
120
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_PageTabDesigner_js_namespaceObject.PageDesigner, {
104
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_PageDesigner_js_namespaceObject.PageDesigner, {
121
105
  title: fieldSchema.title || title
122
106
  }),
123
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
124
- ref: (ref)=>{
125
- setHeight(Math.floor((null == ref ? void 0 : ref.getBoundingClientRect().height) || 0) + 1);
126
- },
127
- className: "tb-page-header-wrapper",
128
- children: !disablePageHeader && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(pro_layout_namespaceObject.PageHeader, {
129
- className: external_classnames_default()('pageHeaderCss', pageHeaderTitle || enablePageTabs ? '' : 'height0'),
130
- ghost: false,
131
- title: pageHeaderTitle || ' ',
132
- ...others,
133
- footer: enablePageTabs && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_common_index_js_namespaceObject.DndContext, {
134
- children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.Tabs, {
135
- size: 'small',
136
- animated: hasMounted,
137
- activeKey: activeKey,
138
- onTabClick: (activeKey)=>{
139
- setLoading(true);
140
- setSearchParams([
141
- [
142
- 'tab',
143
- activeKey
144
- ]
145
- ]);
146
- setTimeout(()=>{
147
- setLoading(false);
148
- }, 50);
149
- },
150
- tabBarExtraContent: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
151
- className: "tb-tabs-wrapper",
152
- children: [
153
- !hiddenScrollArea && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_index_js_namespaceObject.ScrollArea, {}),
154
- dn.designable && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.Button, {
155
- "aria-label": getAriaLabel('tabs'),
156
- icon: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(icons_namespaceObject.PlusOutlined, {}),
157
- className: 'addTabBtn',
158
- type: 'dashed',
159
- onClick: async ()=>{
160
- const values = await (0, external_index_js_namespaceObject.FormDialog)(t('Add tab'), ()=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_core_index_js_namespaceObject.SchemaComponentOptions, {
161
- scope: options.scope,
162
- components: {
163
- ...options.components
164
- },
165
- children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(components_namespaceObject.FormLayout, {
166
- layout: 'vertical',
167
- children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_core_index_js_namespaceObject.SchemaComponent, {
168
- schema: {
169
- properties: {
170
- title: {
171
- title: t('Tab name'),
172
- 'x-component': 'Input',
173
- 'x-decorator': 'FormItem',
174
- required: true
175
- },
176
- icon: {
177
- title: t('Icon'),
178
- 'x-component': 'IconPicker',
179
- 'x-decorator': 'FormItem'
180
- }
181
- }
182
- }
183
- })
184
- })
185
- }), theme).open({
186
- initialValues: {}
187
- });
188
- const { title, icon } = values;
189
- dn.insertBeforeEnd({
190
- type: 'void',
191
- title,
192
- 'x-icon': icon,
193
- 'x-component': 'Grid',
194
- 'x-initializer': 'page:addBlock',
195
- properties: {}
196
- });
197
- },
198
- children: t('Add tab')
199
- })
200
- ]
201
- }),
202
- items: fieldSchema.mapProperties((schema)=>({
203
- label: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(sortable_item_index_js_namespaceObject.SortableItem, {
204
- id: schema.name,
205
- schema: schema,
206
- className: external_classnames_default()('tb-action-link', 'designerCss', props.className),
207
- children: [
208
- schema['x-icon'] && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_icon_index_js_namespaceObject.Icon, {
209
- style: {
210
- marginRight: 8
211
- },
212
- type: schema['x-icon']
213
- }),
214
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
215
- children: schema.title || t('Unnamed')
216
- }),
217
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_PageTabDesigner_js_namespaceObject.PageTabDesigner, {
218
- schema: schema
219
- })
220
- ]
221
- }),
222
- key: schema.name
223
- }))
224
- })
225
- }),
226
- extra: !enablePageTabs && !hiddenScrollArea && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_index_js_namespaceObject.ScrollArea, {})
227
- })
107
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(PageHeader, {
108
+ disablePageHeader: disablePageHeader,
109
+ enablePageTabs: enablePageTabs,
110
+ activeKey: activeKey,
111
+ title: title,
112
+ fieldSchema: fieldSchema,
113
+ parentProps: others,
114
+ setHeight: setHeight,
115
+ setLoading: setLoading,
116
+ setSearchParams: setSearchParams
228
117
  }),
229
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
230
- className: "tb-page-wrapper",
231
- children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_react_error_boundary_namespaceObject.ErrorBoundary, {
232
- FallbackComponent: external_error_fallback_index_js_namespaceObject.ErrorFallback,
233
- onError: handleErrors,
234
- children: PageContent(loading, disablePageHeader, enablePageTabs, fieldSchema, activeKey, height, props)
235
- })
118
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(PageContentComponent, {
119
+ loading: loading,
120
+ disablePageHeader: disablePageHeader,
121
+ enablePageTabs: enablePageTabs,
122
+ fieldSchema: fieldSchema,
123
+ activeKey: activeKey,
124
+ height: height,
125
+ children: children
236
126
  })
237
127
  ]
238
128
  })
239
129
  }));
240
130
  };
241
- Page.displayName = 'Page';
242
- function PageContent(loading, disablePageHeader, enablePageTabs, fieldSchema, activeKey, height, props) {
131
+ const PageHeader = (props)=>{
132
+ var _fieldSchema_xcomponentprops;
133
+ const { disablePageHeader, enablePageTabs, setHeight, activeKey, setLoading, setSearchParams, fieldSchema, title, parentProps } = props;
134
+ const { theme } = (0, theme_index_js_namespaceObject.useGlobalTheme)();
135
+ const options = (0, external_react_namespaceObject.useContext)(schema_namespaceObject.SchemaOptionsContext);
136
+ const compile = (0, external_hooks_index_js_namespaceObject.useCompile)();
137
+ const { hiddenScrollArea } = (0, useContextMenu_js_namespaceObject.useContextMenu)();
138
+ const hidePageTitle = null === (_fieldSchema_xcomponentprops = fieldSchema['x-component-props']) || void 0 === _fieldSchema_xcomponentprops ? void 0 : _fieldSchema_xcomponentprops.hidePageTitle;
139
+ const pageHeaderTitle = hidePageTitle ? void 0 : fieldSchema.title || compile(title);
140
+ const items = fieldSchema.mapProperties((schema)=>({
141
+ key: schema.name,
142
+ label: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(TabItem, {
143
+ schema: schema
144
+ })
145
+ }));
146
+ return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
147
+ ref: (ref)=>{
148
+ setHeight(Math.floor((null == ref ? void 0 : ref.getBoundingClientRect().height) || 0) + 1);
149
+ },
150
+ className: "tb-page-header-wrapper",
151
+ children: !disablePageHeader && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(pro_layout_namespaceObject.PageHeader, {
152
+ className: external_classnames_default()('pageHeaderCss', pageHeaderTitle || enablePageTabs ? '' : 'height0'),
153
+ ghost: false,
154
+ title: pageHeaderTitle || ' ',
155
+ ...parentProps,
156
+ extra: !enablePageTabs && !hiddenScrollArea && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_index_js_namespaceObject.ScrollArea, {}),
157
+ footer: enablePageTabs && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(TabComponent, {
158
+ activeKey: activeKey,
159
+ setLoading: setLoading,
160
+ setSearchParams: setSearchParams,
161
+ hiddenScrollArea: hiddenScrollArea,
162
+ options: options,
163
+ theme: theme,
164
+ items: items
165
+ })
166
+ })
167
+ });
168
+ };
169
+ const TabComponent = (props)=>{
170
+ const { activeKey, setLoading, setSearchParams, hiddenScrollArea, options, theme, items } = props;
171
+ const { styles } = (0, external_Page_style_js_namespaceObject.useStyles)();
172
+ const [hasMounted, setHasMounted] = (0, external_react_namespaceObject.useState)(false);
173
+ const handleTabClick = (activeKey)=>{
174
+ setLoading(true);
175
+ setSearchParams([
176
+ [
177
+ 'tab',
178
+ activeKey
179
+ ]
180
+ ]);
181
+ setTimeout(()=>{
182
+ setLoading(false);
183
+ }, 50);
184
+ };
185
+ (0, external_react_namespaceObject.useEffect)(()=>{
186
+ setTimeout(()=>{
187
+ setHasMounted(true);
188
+ });
189
+ }, []);
190
+ return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_common_index_js_namespaceObject.DndContext, {
191
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.Tabs, {
192
+ className: styles.tabComponentClass,
193
+ type: "card",
194
+ size: 'small',
195
+ animated: hasMounted,
196
+ activeKey: activeKey,
197
+ items: items,
198
+ onTabClick: handleTabClick,
199
+ tabBarExtraContent: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(TabBarExtraContent, {
200
+ theme: theme,
201
+ hiddenScrollArea: hiddenScrollArea,
202
+ options: options
203
+ })
204
+ })
205
+ });
206
+ };
207
+ const TabItem = (props)=>{
208
+ const { schema } = props;
209
+ const { t } = (0, external_react_i18next_namespaceObject.useTranslation)();
210
+ const { styles } = (0, external_Page_style_js_namespaceObject.useStyles)();
211
+ return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(sortable_item_index_js_namespaceObject.SortableItem, {
212
+ id: schema.name,
213
+ schema: schema,
214
+ className: external_classnames_default()('tb-action-link', 'designerCss', props.className, styles.tabItemClass),
215
+ children: [
216
+ schema['x-icon'] && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_icon_index_js_namespaceObject.Icon, {
217
+ style: {
218
+ marginRight: 8
219
+ },
220
+ type: schema['x-icon']
221
+ }),
222
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
223
+ children: schema.title || t('Unnamed')
224
+ }),
225
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
226
+ className: "tab-designer-wrapper",
227
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_PageTabDesigner_js_namespaceObject.PageTabDesigner, {
228
+ schema: schema
229
+ })
230
+ })
231
+ ]
232
+ });
233
+ };
234
+ const TabBarExtraContent = (props)=>{
235
+ const { hiddenScrollArea, options, theme } = props;
236
+ const dn = (0, external_hooks_index_js_namespaceObject.useDesignable)();
237
+ const { t } = (0, external_react_i18next_namespaceObject.useTranslation)();
238
+ const { getAriaLabel } = (0, useGetAriaLabelOfSchemaInitializer_js_namespaceObject.useGetAriaLabelOfSchemaInitializer)();
239
+ const { styles } = (0, external_Page_style_js_namespaceObject.useStyles)();
240
+ const handleAddTab = async ()=>{
241
+ const values = await (0, external_index_js_namespaceObject.FormDialog)(t('Add tab'), ()=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(AddTabForm, {
242
+ options: options
243
+ }), theme).open({
244
+ initialValues: {}
245
+ });
246
+ const { title, icon } = values;
247
+ dn.insertBeforeEnd({
248
+ type: 'void',
249
+ title,
250
+ 'x-icon': icon,
251
+ 'x-component': 'Grid',
252
+ 'x-initializer': 'page:addBlock',
253
+ properties: {}
254
+ });
255
+ };
256
+ return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
257
+ className: (0, external_antd_style_namespaceObject.cx)(styles.tabWrapper, {
258
+ designable: dn.designable
259
+ }),
260
+ children: [
261
+ dn.designable && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.Button, {
262
+ className: "add-tab-btn",
263
+ type: "text",
264
+ "aria-label": getAriaLabel('tabs'),
265
+ icon: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(icons_namespaceObject.PlusOutlined, {}),
266
+ onClick: handleAddTab
267
+ }),
268
+ !hiddenScrollArea && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_index_js_namespaceObject.ScrollArea, {
269
+ className: "scroll-area-extra-content"
270
+ })
271
+ ]
272
+ });
273
+ };
274
+ const AddTabForm = (props)=>{
275
+ const { options } = props;
276
+ const { t } = (0, external_react_i18next_namespaceObject.useTranslation)();
277
+ return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_core_index_js_namespaceObject.SchemaComponentOptions, {
278
+ scope: options.scope,
279
+ components: {
280
+ ...options.components
281
+ },
282
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(components_namespaceObject.FormLayout, {
283
+ layout: 'vertical',
284
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_core_index_js_namespaceObject.SchemaComponent, {
285
+ schema: {
286
+ properties: {
287
+ title: {
288
+ title: t('Tab name'),
289
+ 'x-component': 'Input',
290
+ 'x-decorator': 'FormItem',
291
+ required: true
292
+ },
293
+ icon: {
294
+ title: t('Icon'),
295
+ 'x-component': 'IconPicker',
296
+ 'x-decorator': 'FormItem'
297
+ }
298
+ }
299
+ }
300
+ })
301
+ })
302
+ });
303
+ };
304
+ const PageContentComponent = (props)=>{
305
+ const handleErrors = (error)=>{
306
+ var _window_Sentry, _window;
307
+ null === (_window = window) || void 0 === _window || null === (_window_Sentry = _window.Sentry) || void 0 === _window_Sentry || _window_Sentry.captureException(error);
308
+ console.error(error);
309
+ };
310
+ return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
311
+ className: "tb-page-wrapper",
312
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_react_error_boundary_namespaceObject.ErrorBoundary, {
313
+ FallbackComponent: external_error_fallback_index_js_namespaceObject.ErrorFallback,
314
+ onError: handleErrors,
315
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(PageContent, {
316
+ ...props
317
+ })
318
+ })
319
+ });
320
+ };
321
+ const PageContent = (props)=>{
322
+ const { loading, disablePageHeader, enablePageTabs, fieldSchema, activeKey, height, children } = props;
243
323
  const { token } = (0, index_js_namespaceObject.useToken)();
244
324
  if (loading) return;
245
- return !disablePageHeader && enablePageTabs ? fieldSchema.mapProperties((schema)=>{
325
+ if (!disablePageHeader && enablePageTabs) return fieldSchema.mapProperties((schema)=>{
246
326
  if (schema.name !== activeKey) return null;
247
327
  return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_FixedBlock_js_default(), {
248
328
  height: "calc(".concat(height, "px + 46px + ").concat(token.marginLG, "px * 2)"),
@@ -254,14 +334,15 @@ function PageContent(loading, disablePageHeader, enablePageTabs, fieldSchema, ac
254
334
  })
255
335
  })
256
336
  }, schema.name);
257
- }) : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_FixedBlock_js_default(), {
337
+ });
338
+ return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_FixedBlock_js_default(), {
258
339
  height: "calc(".concat(height, "px + 46px + ").concat(token.marginLG, "px * 2)"),
259
340
  children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
260
341
  className: "pageWithFixedBlockCss tb-page-content",
261
- children: props.children
342
+ children: children
262
343
  })
263
344
  });
264
- }
345
+ };
265
346
  var __webpack_export_target__ = exports;
266
347
  for(var __webpack_i__ in __webpack_exports__)__webpack_export_target__[__webpack_i__] = __webpack_exports__[__webpack_i__];
267
348
  if (__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_target__, '__esModule', {