@tachybase/client 1.0.6 → 1.0.25

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 (120) hide show
  1. package/es/application/Application.d.ts +2 -0
  2. package/es/application/Application.mjs +15 -0
  3. package/es/application/NoticesManager.d.ts +12 -3
  4. package/es/application/NoticesManager.mjs +27 -3
  5. package/es/application/TrackingManager.d.ts +13 -0
  6. package/es/application/TrackingManager.mjs +30 -0
  7. package/es/application/components/SharePage.d.ts +4 -0
  8. package/es/application/components/SharePage.mjs +113 -0
  9. package/es/application/components/ShareSchemaComponent.d.ts +1 -0
  10. package/es/application/components/ShareSchemaComponent.mjs +10 -0
  11. package/es/application/components/index.d.ts +2 -0
  12. package/es/application/components/index.mjs +2 -0
  13. package/es/built-in/admin-layout/index.d.ts +1 -0
  14. package/es/built-in/admin-layout/index.mjs +1 -0
  15. package/es/built-in/pm/PluginManager.mjs +45 -45
  16. package/es/collection-manager/interfaces/__tests__/json.mjs +2 -2
  17. package/es/collection-manager/interfaces/email.d.ts +0 -1
  18. package/es/collection-manager/interfaces/input.d.ts +0 -2
  19. package/es/collection-manager/interfaces/integer.d.ts +12 -2
  20. package/es/collection-manager/interfaces/integer.mjs +13 -1
  21. package/es/collection-manager/interfaces/number.d.ts +16 -1
  22. package/es/collection-manager/interfaces/number.mjs +22 -1
  23. package/es/collection-manager/interfaces/password.d.ts +0 -1
  24. package/es/collection-manager/interfaces/percent.d.ts +12 -1
  25. package/es/collection-manager/interfaces/percent.mjs +12 -0
  26. package/es/collection-manager/interfaces/phone.d.ts +0 -1
  27. package/es/collection-manager/interfaces/properties/index.d.ts +0 -2
  28. package/es/collection-manager/interfaces/properties/index.mjs +0 -2
  29. package/es/data-source/collection-fields-to-initializer-items/CollectionFieldsToFormInitializerItems.d.ts +3 -0
  30. package/es/data-source/collection-fields-to-initializer-items/CollectionFieldsToFormInitializerItems.mjs +67 -0
  31. package/es/data-source/collection-fields-to-initializer-items/CollectionFieldsToInitializerItems.d.ts +3 -0
  32. package/es/data-source/collection-fields-to-initializer-items/CollectionFieldsToInitializerItems.mjs +37 -0
  33. package/es/data-source/collection-fields-to-initializer-items/index.d.ts +1 -0
  34. package/es/data-source/collection-fields-to-initializer-items/index.mjs +1 -0
  35. package/es/data-source/collection-fields-to-initializer-items/items/AssociationCollectionFields.d.ts +3 -0
  36. package/es/data-source/collection-fields-to-initializer-items/items/AssociationCollectionFields.mjs +59 -0
  37. package/es/data-source/collection-fields-to-initializer-items/items/ParentCollectionFields.d.ts +3 -0
  38. package/es/data-source/collection-fields-to-initializer-items/items/ParentCollectionFields.mjs +34 -0
  39. package/es/data-source/collection-fields-to-initializer-items/items/SelfFields.d.ts +3 -0
  40. package/es/data-source/collection-fields-to-initializer-items/items/SelfFields.mjs +14 -0
  41. package/es/data-source/collection-fields-to-initializer-items/items/index.d.ts +3 -0
  42. package/es/data-source/collection-fields-to-initializer-items/items/index.mjs +7 -0
  43. package/es/data-source/collection-fields-to-initializer-items/utils/getInitializerItemsByFields.d.ts +5 -0
  44. package/es/data-source/collection-fields-to-initializer-items/utils/getInitializerItemsByFields.mjs +91 -0
  45. package/es/data-source/collection-fields-to-initializer-items/utils/index.d.ts +3 -0
  46. package/es/data-source/collection-fields-to-initializer-items/utils/index.mjs +3 -0
  47. package/es/data-source/collection-fields-to-initializer-items/utils/type.d.ts +108 -0
  48. package/es/data-source/collection-fields-to-initializer-items/utils/type.mjs +0 -0
  49. package/es/data-source/collection-fields-to-initializer-items/utils/useCollectionFieldContext.d.ts +21 -0
  50. package/es/data-source/collection-fields-to-initializer-items/utils/useCollectionFieldContext.mjs +31 -0
  51. package/es/data-source/index.d.ts +1 -0
  52. package/es/data-source/index.mjs +1 -0
  53. package/es/modules/blocks/data-blocks/form/fieldSettingsFormItem.mjs +0 -8
  54. package/es/modules/blocks/data-blocks/form/hooks/useEditFormBlockDecoratorProps.d.ts +1 -3
  55. package/es/modules/blocks/data-blocks/form/hooks/useEditFormBlockDecoratorProps.mjs +4 -1
  56. package/es/modules/fields/component/InputNumber/inputNumberComponentFieldSettings.mjs +91 -0
  57. package/es/schema-component/antd/index.d.ts +2 -0
  58. package/es/schema-component/antd/index.mjs +2 -0
  59. package/es/schema-component/antd/page/Page.Settings.mjs +33 -0
  60. package/es/schema-component/antd/page/Page.mjs +113 -18
  61. package/es/schema-component/antd/page/hooks/index.d.ts +1 -0
  62. package/es/schema-component/antd/page/hooks/index.mjs +1 -0
  63. package/es/schema-component/antd/page/hooks/useShareActions.d.ts +7 -0
  64. package/es/schema-component/antd/page/hooks/useShareActions.mjs +245 -0
  65. package/es/schema-component/antd/page/index.d.ts +1 -0
  66. package/es/schema-component/antd/page/index.mjs +1 -0
  67. package/es/schema-component/antd/page/style.d.ts +5 -0
  68. package/es/schema-component/antd/page/style.mjs +59 -2
  69. package/es/schema-component/antd/slider/index.d.ts +1 -0
  70. package/es/schema-component/antd/slider/index.mjs +1 -0
  71. package/es/schema-component/antd/slider/slider.d.ts +3 -0
  72. package/es/schema-component/antd/slider/slider.mjs +11 -0
  73. package/es/schema-component/antd/tracking-link/index.d.ts +10 -0
  74. package/es/schema-component/antd/tracking-link/index.mjs +25 -0
  75. package/es/schema-initializer/utils.d.ts +1 -0
  76. package/es/schema-initializer/utils.mjs +1 -1
  77. package/lib/application/Application.js +15 -0
  78. package/lib/application/NoticesManager.js +27 -3
  79. package/lib/application/TrackingManager.js +66 -0
  80. package/lib/application/components/SharePage.js +150 -0
  81. package/lib/application/components/ShareSchemaComponent.js +44 -0
  82. package/lib/application/components/index.js +18 -0
  83. package/lib/application/schema-initializer/hooks/index.js +2 -2
  84. package/lib/block-provider/hooks/index.js +2 -2
  85. package/lib/built-in/admin-layout/index.js +9 -0
  86. package/lib/built-in/pm/PluginManager.js +45 -45
  87. package/lib/collection-manager/interfaces/__tests__/json.js +4 -4
  88. package/lib/collection-manager/interfaces/integer.js +13 -1
  89. package/lib/collection-manager/interfaces/number.js +22 -1
  90. package/lib/collection-manager/interfaces/percent.js +12 -0
  91. package/lib/collection-manager/interfaces/properties/index.js +0 -2
  92. package/lib/data-source/collection-fields-to-initializer-items/CollectionFieldsToFormInitializerItems.js +102 -0
  93. package/lib/data-source/collection-fields-to-initializer-items/CollectionFieldsToInitializerItems.js +71 -0
  94. package/lib/data-source/collection-fields-to-initializer-items/index.js +65 -0
  95. package/lib/data-source/collection-fields-to-initializer-items/items/AssociationCollectionFields.js +93 -0
  96. package/lib/data-source/collection-fields-to-initializer-items/items/ParentCollectionFields.js +68 -0
  97. package/lib/data-source/collection-fields-to-initializer-items/items/SelfFields.js +48 -0
  98. package/lib/data-source/collection-fields-to-initializer-items/items/index.js +40 -0
  99. package/lib/data-source/collection-fields-to-initializer-items/utils/getInitializerItemsByFields.js +127 -0
  100. package/lib/data-source/collection-fields-to-initializer-items/utils/index.js +83 -0
  101. package/lib/data-source/collection-fields-to-initializer-items/utils/type.js +19 -0
  102. package/lib/data-source/collection-fields-to-initializer-items/utils/useCollectionFieldContext.js +65 -0
  103. package/lib/data-source/index.js +12 -3
  104. package/lib/locale/en_US.js +3 -0
  105. package/lib/locale/zh-CN.js +21 -0
  106. package/lib/modules/blocks/data-blocks/form/fieldSettingsFormItem.js +0 -8
  107. package/lib/modules/blocks/data-blocks/form/hooks/useEditFormBlockDecoratorProps.js +4 -1
  108. package/lib/modules/fields/component/InputNumber/inputNumberComponentFieldSettings.js +91 -0
  109. package/lib/schema-component/antd/index.js +161 -133
  110. package/lib/schema-component/antd/page/Page.Settings.js +33 -0
  111. package/lib/schema-component/antd/page/Page.js +113 -18
  112. package/lib/schema-component/antd/page/hooks/index.js +65 -0
  113. package/lib/schema-component/antd/page/hooks/useShareActions.js +293 -0
  114. package/lib/schema-component/antd/page/index.js +9 -0
  115. package/lib/schema-component/antd/page/style.js +60 -2
  116. package/lib/schema-component/antd/slider/index.js +65 -0
  117. package/lib/schema-component/antd/slider/slider.js +46 -0
  118. package/lib/schema-component/antd/tracking-link/index.js +59 -0
  119. package/lib/schema-initializer/utils.js +2 -1
  120. package/package.json +8 -7
@@ -214,10 +214,6 @@ const fieldSettingsFormItem = new __WEBPACK_EXTERNAL_MODULE__application_schema_
214
214
  },
215
215
  {
216
216
  name: 'setDefaultValue',
217
- useVisible () {
218
- const { isAllowToSetDefaultValue } = (0, __WEBPACK_EXTERNAL_MODULE__schema_settings_index_mjs__.useIsAllowToSetDefaultValue)();
219
- return isAllowToSetDefaultValue();
220
- },
221
217
  Component: __WEBPACK_EXTERNAL_MODULE__schema_settings_index_mjs__.SchemaSettingsDefaultValue
222
218
  },
223
219
  {
@@ -479,10 +475,6 @@ const fieldSettingsFormItem = new __WEBPACK_EXTERNAL_MODULE__application_schema_
479
475
  },
480
476
  {
481
477
  ...__WEBPACK_EXTERNAL_MODULE__data_source_index_mjs__.fieldComponentSettingsItem
482
- },
483
- {
484
- name: 'editDefaultValue',
485
- Component: __WEBPACK_EXTERNAL_MODULE__schema_settings_index_mjs__.SchemaSettingsDefaultValue
486
478
  }
487
479
  ];
488
480
  }
@@ -1,6 +1,4 @@
1
1
  export declare function useEditFormBlockDecoratorProps(props: any): {
2
- params: {
3
- filterByTk: any;
4
- };
2
+ params: any;
5
3
  parentRecord: any;
6
4
  };
@@ -5,7 +5,10 @@ function useEditFormBlockDecoratorProps(props) {
5
5
  let parentRecord;
6
6
  if (props.association) parentRecord = (0, __WEBPACK_EXTERNAL_MODULE__details_single_hooks_useDetailsDecoratorProps_mjs__.useDetailsParentRecord)(props.association);
7
7
  return {
8
- params,
8
+ params: {
9
+ ...params,
10
+ ...props.params
11
+ },
9
12
  parentRecord
10
13
  };
11
14
  }
@@ -1,11 +1,102 @@
1
1
  import * as __WEBPACK_EXTERNAL_MODULE__tachybase_schema__ from "@tachybase/schema";
2
+ import * as __WEBPACK_EXTERNAL_MODULE_antd__ from "antd";
3
+ import * as __WEBPACK_EXTERNAL_MODULE_react_i18next__ from "react-i18next";
2
4
  import * as __WEBPACK_EXTERNAL_MODULE__application_schema_settings_SchemaSettings_mjs__ from "../../../../application/schema-settings/SchemaSettings.mjs";
5
+ import * as __WEBPACK_EXTERNAL_MODULE__schema_component_index_mjs__ from "../../../../schema-component/index.mjs";
3
6
  import * as __WEBPACK_EXTERNAL_MODULE__schema_component_antd_form_item_FormItem_Settings_mjs__ from "../../../../schema-component/antd/form-item/FormItem.Settings.mjs";
4
7
  import * as __WEBPACK_EXTERNAL_MODULE__schema_component_antd_table_v2_Table_Column_Decorator_mjs__ from "../../../../schema-component/antd/table-v2/Table.Column.Decorator.mjs";
5
8
  import * as __WEBPACK_EXTERNAL_MODULE__schema_settings_SchemaSettingsNumberFormat_mjs__ from "../../../../schema-settings/SchemaSettingsNumberFormat.mjs";
6
9
  const inputNumberComponentFieldSettings = new __WEBPACK_EXTERNAL_MODULE__application_schema_settings_SchemaSettings_mjs__.SchemaSettings({
7
10
  name: 'fieldSettings:component:InputNumber',
8
11
  items: [
12
+ {
13
+ name: 'setSliderMAXNumber',
14
+ type: 'modal',
15
+ useVisible () {
16
+ var _fieldSchema_xcomponentprops;
17
+ const fieldSchema = (0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema__.useFieldSchema)();
18
+ return 'Slider' === fieldSchema['x-component'] || (null === (_fieldSchema_xcomponentprops = fieldSchema['x-component-props']) || void 0 === _fieldSchema_xcomponentprops ? void 0 : _fieldSchema_xcomponentprops.component) === 'Slider';
19
+ },
20
+ useComponentProps () {
21
+ var _fieldSchema_xcomponentprops, _fieldSchema_xcomponentprops1;
22
+ const { t } = (0, __WEBPACK_EXTERNAL_MODULE_react_i18next__.useTranslation)();
23
+ const field = (0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema__.useField)();
24
+ const fieldSchema = (0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema__.useFieldSchema)();
25
+ const { dn } = (0, __WEBPACK_EXTERNAL_MODULE__schema_component_index_mjs__.useDesignable)();
26
+ return {
27
+ title: t('MAX'),
28
+ value: null === (_fieldSchema_xcomponentprops = fieldSchema['x-component-props']) || void 0 === _fieldSchema_xcomponentprops ? void 0 : _fieldSchema_xcomponentprops.max,
29
+ schema: {
30
+ type: 'object',
31
+ title: t('Edit Slider Max'),
32
+ properties: {
33
+ maxNumber: {
34
+ default: (null === (_fieldSchema_xcomponentprops1 = fieldSchema['x-component-props']) || void 0 === _fieldSchema_xcomponentprops1 ? void 0 : _fieldSchema_xcomponentprops1.max) || 100,
35
+ 'x-decorator': 'FormItem',
36
+ 'x-component': 'Input',
37
+ 'x-component-props': {}
38
+ }
39
+ }
40
+ },
41
+ onSubmit (number) {
42
+ if (Number(number.maxNumber) > (field.componentProps['min'] || 0)) {
43
+ fieldSchema['x-component-props']['max'] = Number(number.maxNumber);
44
+ field.componentProps['max'] = Number(number.maxNumber);
45
+ dn.emit('patch', {
46
+ schema: {
47
+ 'x-uid': fieldSchema['x-uid'],
48
+ 'x-component-props': fieldSchema['x-component-props']
49
+ }
50
+ });
51
+ } else __WEBPACK_EXTERNAL_MODULE_antd__.message.warning(t('Cannot be less than or equal to the minimum value'));
52
+ }
53
+ };
54
+ }
55
+ },
56
+ {
57
+ name: 'setSliderMinNumber',
58
+ type: 'modal',
59
+ useVisible () {
60
+ var _fieldSchema_xcomponentprops;
61
+ const fieldSchema = (0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema__.useFieldSchema)();
62
+ return 'Slider' === fieldSchema['x-component'] || (null === (_fieldSchema_xcomponentprops = fieldSchema['x-component-props']) || void 0 === _fieldSchema_xcomponentprops ? void 0 : _fieldSchema_xcomponentprops.component) === 'Slider';
63
+ },
64
+ useComponentProps () {
65
+ var _fieldSchema_xcomponentprops, _fieldSchema_xcomponentprops1;
66
+ const { t } = (0, __WEBPACK_EXTERNAL_MODULE_react_i18next__.useTranslation)();
67
+ const field = (0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema__.useField)();
68
+ const fieldSchema = (0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema__.useFieldSchema)();
69
+ const { dn } = (0, __WEBPACK_EXTERNAL_MODULE__schema_component_index_mjs__.useDesignable)();
70
+ return {
71
+ title: t('MIN'),
72
+ value: null === (_fieldSchema_xcomponentprops = fieldSchema['x-component-props']) || void 0 === _fieldSchema_xcomponentprops ? void 0 : _fieldSchema_xcomponentprops.min,
73
+ schema: {
74
+ type: 'object',
75
+ title: t('Edit Slider Min'),
76
+ properties: {
77
+ minNumber: {
78
+ default: (null === (_fieldSchema_xcomponentprops1 = fieldSchema['x-component-props']) || void 0 === _fieldSchema_xcomponentprops1 ? void 0 : _fieldSchema_xcomponentprops1.min) || 0,
79
+ 'x-decorator': 'FormItem',
80
+ 'x-component': 'Input',
81
+ 'x-component-props': {}
82
+ }
83
+ }
84
+ },
85
+ onSubmit (number) {
86
+ if (Number(number.minNumber) < (field.componentProps['max'] || 0)) {
87
+ fieldSchema['x-component-props']['min'] = Number(number.minNumber);
88
+ field.componentProps['min'] = Number(number.minNumber);
89
+ dn.emit('patch', {
90
+ schema: {
91
+ 'x-uid': fieldSchema['x-uid'],
92
+ 'x-component-props': fieldSchema['x-component-props']
93
+ }
94
+ });
95
+ } else __WEBPACK_EXTERNAL_MODULE_antd__.message.warning(t('Cannot be greater than or equal to the maximum value'));
96
+ }
97
+ };
98
+ }
99
+ },
9
100
  {
10
101
  name: 'displayFormat',
11
102
  Component: __WEBPACK_EXTERNAL_MODULE__schema_settings_SchemaSettingsNumberFormat_mjs__.SchemaSettingsNumberFormat,
@@ -15,6 +15,7 @@ export * from './collection-select';
15
15
  export * from './color-picker';
16
16
  export * from './color-select';
17
17
  export * from './cron';
18
+ export * from './slider';
18
19
  export * from './custom-cascader';
19
20
  export * from './date-picker';
20
21
  export * from './details';
@@ -58,5 +59,6 @@ export * from './unixTimestamp';
58
59
  export * from './upload';
59
60
  export * from './variable';
60
61
  export * from './media-card';
62
+ export * from './tracking-link';
61
63
  export { PageHeader } from '@ant-design/pro-layout';
62
64
  export { CodeMirror } from '@tachybase/components';
@@ -17,6 +17,7 @@ export * from "./collection-select/index.mjs";
17
17
  export * from "./color-picker/index.mjs";
18
18
  export * from "./color-select/index.mjs";
19
19
  export * from "./cron/index.mjs";
20
+ export * from "./slider/index.mjs";
20
21
  export * from "./custom-cascader/index.mjs";
21
22
  export * from "./date-picker/index.mjs";
22
23
  export * from "./details/index.mjs";
@@ -60,6 +61,7 @@ export * from "./unixTimestamp/index.mjs";
60
61
  export * from "./upload/index.mjs";
61
62
  export * from "./variable/index.mjs";
62
63
  export * from "./media-card/index.mjs";
64
+ export * from "./tracking-link/index.mjs";
63
65
  var __webpack_exports__CodeMirror = __WEBPACK_EXTERNAL_MODULE__tachybase_components__.CodeMirror;
64
66
  var __webpack_exports__PageHeader = __WEBPACK_EXTERNAL_MODULE__ant_design_pro_layout__.PageHeader;
65
67
  var __webpack_exports__genStyleHook = __WEBPACK_EXTERNAL_MODULE__builtins_index_mjs__.genStyleHook;
@@ -1,5 +1,6 @@
1
1
  import * as __WEBPACK_EXTERNAL_MODULE__tachybase_schema__ from "@tachybase/schema";
2
2
  import * as __WEBPACK_EXTERNAL_MODULE_react_i18next__ from "react-i18next";
3
+ import * as __WEBPACK_EXTERNAL_MODULE_react_router__ from "react-router";
3
4
  import * as __WEBPACK_EXTERNAL_MODULE__index_mjs__ from "../../index.mjs";
4
5
  import * as __WEBPACK_EXTERNAL_MODULE__application_schema_settings_index_mjs__ from "../../../application/schema-settings/index.mjs";
5
6
  import * as __WEBPACK_EXTERNAL_MODULE__application_schema_toolbar_index_mjs__ from "../../../application/schema-toolbar/index.mjs";
@@ -36,6 +37,38 @@ const pageSettings = new __WEBPACK_EXTERNAL_MODULE__application_schema_settings_
36
37
  };
37
38
  }
38
39
  },
40
+ {
41
+ name: 'enablesharePage',
42
+ type: 'switch',
43
+ useVisible () {
44
+ const isShare = (0, __WEBPACK_EXTERNAL_MODULE_react_router__.useMatch)('/share/:name');
45
+ return !isShare;
46
+ },
47
+ useComponentProps () {
48
+ var _fieldSchema_xcomponentprops;
49
+ const { dn } = (0, __WEBPACK_EXTERNAL_MODULE__index_mjs__.useDesignable)();
50
+ const { t } = (0, __WEBPACK_EXTERNAL_MODULE_react_i18next__.useTranslation)();
51
+ const fieldSchema = (0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema__.useFieldSchema)();
52
+ const { title } = (0, __WEBPACK_EXTERNAL_MODULE__application_schema_toolbar_index_mjs__.useSchemaToolbar)();
53
+ return {
54
+ title: t('Enable Share page'),
55
+ checked: null === (_fieldSchema_xcomponentprops = fieldSchema['x-component-props']) || void 0 === _fieldSchema_xcomponentprops ? void 0 : _fieldSchema_xcomponentprops.enableSharePage,
56
+ onChange (v) {
57
+ fieldSchema['x-component-props'] = fieldSchema['x-component-props'] || {};
58
+ fieldSchema['x-component-props']['enableSharePage'] = v;
59
+ if (!fieldSchema.title) fieldSchema.title = title;
60
+ dn.emit('patch', {
61
+ schema: {
62
+ ['x-uid']: fieldSchema['x-uid'],
63
+ ['x-component-props']: fieldSchema['x-component-props'],
64
+ title: fieldSchema.title
65
+ }
66
+ });
67
+ dn.refresh();
68
+ }
69
+ };
70
+ }
71
+ },
39
72
  {
40
73
  name: 'divider',
41
74
  type: 'divider',
@@ -27,18 +27,20 @@ import * as __WEBPACK_EXTERNAL_MODULE__core_index_mjs__ from "../../core/index.m
27
27
  import * as __WEBPACK_EXTERNAL_MODULE__hooks_index_mjs__ from "../../hooks/index.mjs";
28
28
  import * as __WEBPACK_EXTERNAL_MODULE__error_fallback_index_mjs__ from "../error-fallback/index.mjs";
29
29
  import * as __WEBPACK_EXTERNAL_MODULE__FixedBlock_mjs__ from "./FixedBlock.mjs";
30
+ import * as __WEBPACK_EXTERNAL_MODULE__hooks_useShareActions_mjs__ from "./hooks/useShareActions.mjs";
30
31
  import * as __WEBPACK_EXTERNAL_MODULE__Page_style_mjs__ from "./Page.style.mjs";
31
32
  import * as __WEBPACK_EXTERNAL_MODULE__PageDesigner_mjs__ from "./PageDesigner.mjs";
32
33
  import * as __WEBPACK_EXTERNAL_MODULE__PageTabDesigner_mjs__ from "./PageTabDesigner.mjs";
33
34
  import * as __WEBPACK_EXTERNAL_MODULE__style_mjs__ from "./style.mjs";
34
35
  const Page = (props)=>{
35
- var _fieldSchema_xcomponentprops, _fieldSchema_xcomponentprops1;
36
+ var _fieldSchema_xcomponentprops, _fieldSchema_xcomponentprops1, _fieldSchema_xcomponentprops2;
36
37
  const { children, ...others } = props;
37
38
  const { t } = (0, __WEBPACK_EXTERNAL_MODULE_react_i18next__.useTranslation)();
38
39
  const { title, setTitle } = (0, __WEBPACK_EXTERNAL_MODULE__built_in_document_title_index_mjs__.useDocumentTitle)();
39
40
  const fieldSchema = (0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema__.useFieldSchema)();
40
41
  const disablePageHeader = null === (_fieldSchema_xcomponentprops = fieldSchema['x-component-props']) || void 0 === _fieldSchema_xcomponentprops ? void 0 : _fieldSchema_xcomponentprops.disablePageHeader;
41
42
  const enablePageTabs = null === (_fieldSchema_xcomponentprops1 = fieldSchema['x-component-props']) || void 0 === _fieldSchema_xcomponentprops1 ? void 0 : _fieldSchema_xcomponentprops1.enablePageTabs;
43
+ const enableSharePage = null === (_fieldSchema_xcomponentprops2 = fieldSchema['x-component-props']) || void 0 === _fieldSchema_xcomponentprops2 ? void 0 : _fieldSchema_xcomponentprops2.enableSharePage;
42
44
  const [searchParams, setSearchParams] = (0, __WEBPACK_EXTERNAL_MODULE_react_router_dom__.useSearchParams)();
43
45
  const [loading, setLoading] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)(false);
44
46
  const activeKey = (0, __WEBPACK_EXTERNAL_MODULE_react__.useMemo)(()=>searchParams.get('tab') || Object.keys(fieldSchema.properties || {}).shift(), [
@@ -70,6 +72,7 @@ const Page = (props)=>{
70
72
  parentProps: others,
71
73
  setHeight: setHeight,
72
74
  setLoading: setLoading,
75
+ enableSharePage: enableSharePage,
73
76
  setSearchParams: setSearchParams
74
77
  }),
75
78
  /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(PageContentComponent, {
@@ -87,40 +90,132 @@ const Page = (props)=>{
87
90
  };
88
91
  const PageHeader = (props)=>{
89
92
  var _fieldSchema_xcomponentprops;
90
- const { disablePageHeader, enablePageTabs, setHeight, activeKey, setLoading, setSearchParams, fieldSchema, title, parentProps } = props;
93
+ const { disablePageHeader, enablePageTabs, setHeight, activeKey, setLoading, setSearchParams, fieldSchema, title, parentProps, enableSharePage } = props;
91
94
  const { theme } = (0, __WEBPACK_EXTERNAL_MODULE__style_theme_index_mjs__.useGlobalTheme)();
92
95
  const options = (0, __WEBPACK_EXTERNAL_MODULE_react__.useContext)(__WEBPACK_EXTERNAL_MODULE__tachybase_schema__.SchemaOptionsContext);
93
96
  const compile = (0, __WEBPACK_EXTERNAL_MODULE__hooks_index_mjs__.useCompile)();
97
+ const [open, setOpen] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)(false);
98
+ const [imageOpen, setImageOpen] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)(false);
94
99
  const { showScrollArea } = (0, __WEBPACK_EXTERNAL_MODULE__built_in_context_menu_useContextMenu_mjs__.useContextMenu)();
95
100
  const hidePageTitle = null === (_fieldSchema_xcomponentprops = fieldSchema['x-component-props']) || void 0 === _fieldSchema_xcomponentprops ? void 0 : _fieldSchema_xcomponentprops.hidePageTitle;
96
101
  const pageHeaderTitle = hidePageTitle ? void 0 : fieldSchema.title || compile(title);
102
+ const isShare = (0, __WEBPACK_EXTERNAL_MODULE_react_router_dom__.useMatch)('/share/:name');
97
103
  const items = fieldSchema.mapProperties((schema)=>({
98
104
  key: schema.name,
99
105
  label: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(TabItem, {
100
106
  schema: schema
101
107
  })
102
108
  }));
103
- return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)("div", {
109
+ const { t } = (0, __WEBPACK_EXTERNAL_MODULE_react_i18next__.useTranslation)();
110
+ const { styles } = (0, __WEBPACK_EXTERNAL_MODULE__style_mjs__.useStyles)();
111
+ const { copyLink, imageAction } = (0, __WEBPACK_EXTERNAL_MODULE__hooks_useShareActions_mjs__.useShareActions)({
112
+ title: pageHeaderTitle,
113
+ uid: ''
114
+ });
115
+ return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsxs)("div", {
104
116
  ref: (ref)=>{
105
117
  setHeight(Math.floor((null == ref ? void 0 : ref.getBoundingClientRect().height) || 0) + 1);
106
118
  },
107
119
  className: "tb-page-header-wrapper",
108
- children: !disablePageHeader && /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__ant_design_pro_layout__.PageHeader, {
109
- className: (0, __WEBPACK_EXTERNAL_MODULE_classnames__["default"])('pageHeaderCss', pageHeaderTitle || enablePageTabs ? '' : 'height0'),
110
- ghost: false,
111
- title: pageHeaderTitle || ' ',
112
- ...parentProps,
113
- extra: !enablePageTabs && showScrollArea && /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__index_mjs__.ScrollArea, {}),
114
- footer: enablePageTabs && /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(TabComponent, {
115
- activeKey: activeKey,
116
- setLoading: setLoading,
117
- setSearchParams: setSearchParams,
118
- showScrollArea: showScrollArea,
119
- options: options,
120
- theme: theme,
121
- items: items
120
+ children: [
121
+ !disablePageHeader && /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__ant_design_pro_layout__.PageHeader, {
122
+ className: (0, __WEBPACK_EXTERNAL_MODULE_classnames__["default"])('pageHeaderCss', pageHeaderTitle || enableSharePage ? '' : 'height0'),
123
+ ghost: false,
124
+ title: pageHeaderTitle || ' ',
125
+ ...parentProps,
126
+ extra: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(HeaderExtra, {
127
+ enablePageTabs: enablePageTabs,
128
+ showScrollArea: showScrollArea,
129
+ isShare: isShare,
130
+ setOpen: setOpen,
131
+ enableSharePage: enableSharePage
132
+ }),
133
+ footer: enablePageTabs && /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(TabComponent, {
134
+ activeKey: activeKey,
135
+ setLoading: setLoading,
136
+ setSearchParams: setSearchParams,
137
+ showScrollArea: showScrollArea,
138
+ options: options,
139
+ theme: theme,
140
+ items: items
141
+ })
142
+ }),
143
+ disablePageHeader && enableSharePage && !isShare && /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)("div", {
144
+ className: "tb-page-header-button",
145
+ children: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE_antd__.Button, {
146
+ icon: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__ant_design_icons__.ShareAltOutlined, {}),
147
+ onClick: ()=>{
148
+ setOpen(true);
149
+ },
150
+ children: t('Share')
151
+ })
152
+ }),
153
+ /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsxs)(__WEBPACK_EXTERNAL_MODULE_antd__.Modal, {
154
+ open: open,
155
+ className: styles.firstmodal,
156
+ title: t('Share'),
157
+ footer: null,
158
+ width: 500,
159
+ onCancel: ()=>{
160
+ setOpen(false);
161
+ },
162
+ children: [
163
+ /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsxs)("div", {
164
+ className: styles.secondmodal,
165
+ children: [
166
+ /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsxs)("div", {
167
+ className: "tb-header-modal-list",
168
+ onClick: copyLink,
169
+ children: [
170
+ /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__icon_index_mjs__.Icon, {
171
+ type: "PaperClipOutlined"
172
+ }),
173
+ t('Copy link')
174
+ ]
175
+ }),
176
+ /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsxs)("div", {
177
+ className: "tb-header-modal-list",
178
+ onClick: ()=>{
179
+ setImageOpen(true);
180
+ },
181
+ children: [
182
+ /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__icon_index_mjs__.Icon, {
183
+ type: "QrcodeOutlined"
184
+ }),
185
+ t('Generate QR code')
186
+ ]
187
+ })
188
+ ]
189
+ }),
190
+ /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE_antd__.Modal, {
191
+ className: styles.imageModal,
192
+ open: imageOpen,
193
+ footer: null,
194
+ onCancel: ()=>{
195
+ setImageOpen(false);
196
+ },
197
+ children: imageAction()
198
+ })
199
+ ]
122
200
  })
123
- })
201
+ ]
202
+ });
203
+ };
204
+ const HeaderExtra = (param)=>{
205
+ let { enablePageTabs, showScrollArea, isShare, setOpen, enableSharePage } = param;
206
+ return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsxs)(__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.Fragment, {
207
+ children: [
208
+ !isShare && /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE_antd__.Button, {
209
+ icon: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__ant_design_icons__.ShareAltOutlined, {}),
210
+ onClick: ()=>{
211
+ setOpen(true);
212
+ },
213
+ style: {
214
+ visibility: "".concat(enableSharePage ? 'visible' : 'hidden')
215
+ }
216
+ }),
217
+ !enablePageTabs && showScrollArea && /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE__index_mjs__.ScrollArea, {})
218
+ ]
124
219
  });
125
220
  };
126
221
  const TabComponent = (props)=>{
@@ -0,0 +1 @@
1
+ export * from './useShareActions';
@@ -0,0 +1 @@
1
+ export * from "./useShareActions.mjs";
@@ -0,0 +1,7 @@
1
+ export declare const useShareActions: ({ title, uid }: {
2
+ title: any;
3
+ uid: any;
4
+ }) => {
5
+ copyLink: () => void;
6
+ imageAction: () => import("react/jsx-runtime").JSX.Element;
7
+ };