@tachybase/client 1.3.19 → 1.3.21

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 (135) hide show
  1. package/es/application/Application.mjs +1 -9
  2. package/es/application/components/index.d.ts +0 -2
  3. package/es/application/components/index.mjs +0 -2
  4. package/es/application/schema-initializer/context/index.d.ts +1 -1
  5. package/es/application/utils/globalDeps.mjs +1 -1
  6. package/es/block-provider/hooks/index.mjs +1 -1
  7. package/es/built-in/index.d.ts +2 -1
  8. package/es/built-in/index.mjs +3 -2
  9. package/es/collection-manager/Configuration/components/Summary.mjs +3 -3
  10. package/es/collection-manager/collectionPlugin.mjs +36 -0
  11. package/es/collection-manager/interfaces/url.d.ts +4 -0
  12. package/es/collection-manager/interfaces/url.mjs +10 -1
  13. package/es/collection-manager/templates/sql.d.ts +3 -3
  14. package/es/collection-manager/templates/view.d.ts +3 -3
  15. package/es/data-source/collection-field-interface/CollectionFieldInterface.mjs +1 -15
  16. package/es/flag-provider/FlagProvider.d.ts +1 -0
  17. package/es/flag-provider/hooks/useFlag.mjs +1 -1
  18. package/es/modules/blocks/data-blocks/form/fieldSettingsFormItem.mjs +1 -4
  19. package/es/modules/blocks/data-blocks/table/hooks/useTableBlockProps.mjs +14 -2
  20. package/es/modules/blocks/data-blocks/table/tableColumnSettings.mjs +1 -3
  21. package/es/modules/blocks/filter-blocks/collapse/filterCollapseItemFieldSettings.mjs +0 -4
  22. package/es/modules/blocks/filter-blocks/form/filterFormItemFieldSettings.mjs +0 -4
  23. package/es/modules/fields/component/CustomTitle/customTitleComponentFieldSettings.mjs +95 -5
  24. package/es/modules/fields/component/InputPreview/inputPreviewComponentFieldSettings.d.ts +2 -0
  25. package/es/modules/fields/component/InputPreview/inputPreviewComponentFieldSettings.mjs +99 -0
  26. package/es/modules/fields/component/MultipleSelect/multipleSelectComponentFieldSettings.d.ts +2 -0
  27. package/es/modules/fields/component/MultipleSelect/multipleSelectComponentFieldSettings.mjs +64 -0
  28. package/es/modules/fields/component/Radio/radioComponentFieldSettings.mjs +15 -2
  29. package/es/modules/fields/component/Select/selectComponentFieldSettings.mjs +26 -7
  30. package/es/schema-component/antd/association-field/InternalViewer.mjs +4 -58
  31. package/es/schema-component/antd/association-field/hooks.d.ts +4 -0
  32. package/es/schema-component/antd/association-field/hooks.mjs +52 -1
  33. package/es/schema-component/antd/color-select/ColorSelect.mjs +3 -3
  34. package/es/schema-component/antd/date-picker/util.d.ts +13 -0
  35. package/es/schema-component/antd/date-picker/util.mjs +14 -1
  36. package/es/schema-component/antd/input/Input.mjs +2 -1
  37. package/es/schema-component/antd/input/ReadPretty.d.ts +1 -0
  38. package/es/schema-component/antd/input/ReadPretty.mjs +29 -1
  39. package/es/schema-component/antd/markdown/Markdown.mjs +4 -4
  40. package/es/schema-component/antd/page/Page.Settings.mjs +0 -33
  41. package/es/schema-component/antd/page/Page.mjs +46 -95
  42. package/es/schema-component/antd/page/hooks/index.d.ts +1 -1
  43. package/es/schema-component/antd/page/hooks/index.mjs +1 -1
  44. package/es/schema-component/antd/page/index.d.ts +1 -0
  45. package/es/schema-component/antd/page/index.mjs +1 -0
  46. package/es/schema-component/antd/page/pageExtendComponentProvider.d.ts +3 -0
  47. package/es/schema-component/antd/page/pageExtendComponentProvider.mjs +9 -0
  48. package/es/schema-component/antd/page/style.d.ts +0 -5
  49. package/es/schema-component/antd/page/style.mjs +1 -45
  50. package/es/schema-component/antd/password/utils.d.ts +1 -1
  51. package/es/schema-component/antd/select/FormulaSelect.mjs +16 -4
  52. package/es/schema-component/antd/select/ReadPretty.mjs +16 -3
  53. package/es/schema-component/antd/select/Select.mjs +6 -1
  54. package/es/schema-component/hooks/useFieldModeOptions.mjs +13 -10
  55. package/es/schema-settings/EditFormulaTitleField.mjs +19 -1
  56. package/es/schema-settings/SchemaSettingsDefaultValue.mjs +3 -2
  57. package/es/schema-settings/SchemaSettingsPlugin.mjs +4 -0
  58. package/es/schema-settings/VariableInput/hooks/index.d.ts +1 -0
  59. package/es/schema-settings/VariableInput/hooks/index.mjs +1 -0
  60. package/es/schema-settings/VariableInput/hooks/useExactDateVariable.d.ts +93 -0
  61. package/es/schema-settings/VariableInput/hooks/useExactDateVariable.mjs +75 -0
  62. package/es/schema-settings/VariableInput/hooks/useVariableOptions.mjs +11 -1
  63. package/es/user/ChangePassword.mjs +109 -6
  64. package/es/user/index.d.ts +1 -0
  65. package/es/user/index.mjs +2 -0
  66. package/es/variables/hooks/useBuiltinVariables.mjs +8 -2
  67. package/lib/application/Application.js +0 -8
  68. package/lib/application/components/index.js +0 -18
  69. package/lib/block-provider/hooks/index.js +5 -5
  70. package/lib/built-in/acl/Configuration/MenuItemsProvider.js +2 -2
  71. package/lib/built-in/attachment-preview/previewers/file-sheet.js +2 -2
  72. package/lib/built-in/index.js +30 -4
  73. package/lib/built-in/pm/index.js +1 -1
  74. package/lib/collection-manager/Configuration/components/Summary.js +3 -3
  75. package/lib/collection-manager/collectionPlugin.js +36 -0
  76. package/lib/collection-manager/index.js +17 -17
  77. package/lib/collection-manager/interfaces/url.js +10 -1
  78. package/lib/data-source/collection-field-interface/CollectionFieldInterface.js +1 -15
  79. package/lib/flag-provider/hooks/useFlag.js +1 -1
  80. package/lib/icon/Icon.js +2 -2
  81. package/lib/locale/zh-CN.js +6 -0
  82. package/lib/modules/blocks/data-blocks/form/fieldSettingsFormItem.js +0 -3
  83. package/lib/modules/blocks/data-blocks/table/hooks/useTableBlockProps.js +14 -2
  84. package/lib/modules/blocks/data-blocks/table/tableColumnSettings.js +1 -3
  85. package/lib/modules/blocks/filter-blocks/collapse/filterCollapseItemFieldSettings.js +0 -4
  86. package/lib/modules/blocks/filter-blocks/form/filterFormItemFieldSettings.js +0 -4
  87. package/lib/modules/fields/component/CustomTitle/customTitleComponentFieldSettings.js +93 -3
  88. package/lib/modules/fields/component/InputPreview/inputPreviewComponentFieldSettings.js +133 -0
  89. package/lib/modules/fields/component/MultipleSelect/multipleSelectComponentFieldSettings.js +98 -0
  90. package/lib/modules/fields/component/Radio/radioComponentFieldSettings.js +16 -3
  91. package/lib/modules/fields/component/Select/selectComponentFieldSettings.js +23 -4
  92. package/lib/schema-component/antd/action/Action.Container.js +2 -2
  93. package/lib/schema-component/antd/action/Action.Modal.js +2 -2
  94. package/lib/schema-component/antd/action/Action.Sheet.js +2 -2
  95. package/lib/schema-component/antd/association-field/InternalViewer.js +1 -55
  96. package/lib/schema-component/antd/association-field/hooks.js +54 -0
  97. package/lib/schema-component/antd/color-select/ColorSelect.js +4 -4
  98. package/lib/schema-component/antd/date-picker/util.js +16 -0
  99. package/lib/schema-component/antd/form-tab/index.js +2 -2
  100. package/lib/schema-component/antd/form-v2/index.js +2 -2
  101. package/lib/schema-component/antd/input/Input.js +2 -1
  102. package/lib/schema-component/antd/input/ReadPretty.js +28 -0
  103. package/lib/schema-component/antd/markdown/Markdown.js +5 -5
  104. package/lib/schema-component/antd/page/Page.Settings.js +0 -33
  105. package/lib/schema-component/antd/page/Page.js +41 -90
  106. package/lib/schema-component/antd/page/hooks/index.js +5 -5
  107. package/lib/schema-component/antd/page/index.js +9 -0
  108. package/lib/{application/components/ShareSchemaComponent.js → schema-component/antd/page/pageExtendComponentProvider.js} +15 -10
  109. package/lib/schema-component/antd/page/style.js +2 -49
  110. package/lib/schema-component/antd/scroll-area/ScrollArea.js +2 -2
  111. package/lib/schema-component/antd/select/FormulaSelect.js +16 -4
  112. package/lib/schema-component/antd/select/ReadPretty.js +15 -2
  113. package/lib/schema-component/antd/select/Select.js +6 -1
  114. package/lib/schema-component/antd/table-v2/index.js +3 -3
  115. package/lib/schema-component/antd/upload/shared.js +4 -4
  116. package/lib/schema-component/hooks/useFieldModeOptions.js +13 -10
  117. package/lib/schema-settings/EditFormulaTitleField.js +19 -1
  118. package/lib/schema-settings/SchemaSettingsDefaultValue.js +3 -2
  119. package/lib/schema-settings/SchemaSettingsPlugin.js +4 -0
  120. package/lib/schema-settings/VariableInput/hooks/index.js +9 -0
  121. package/lib/schema-settings/VariableInput/hooks/useExactDateVariable.js +112 -0
  122. package/lib/schema-settings/VariableInput/hooks/useVariableOptions.js +11 -1
  123. package/lib/user/ChangePassword.js +118 -5
  124. package/lib/user/index.js +24 -4
  125. package/lib/variables/VariablesProvider.js +2 -2
  126. package/lib/variables/hooks/useBuiltinVariables.js +7 -1
  127. package/package.json +10 -10
  128. package/es/application/components/SharePage.d.ts +0 -4
  129. package/es/application/components/SharePage.mjs +0 -113
  130. package/es/application/components/ShareSchemaComponent.d.ts +0 -1
  131. package/es/application/components/ShareSchemaComponent.mjs +0 -10
  132. package/es/schema-component/antd/page/hooks/useShareActions.d.ts +0 -7
  133. package/es/schema-component/antd/page/hooks/useShareActions.mjs +0 -242
  134. package/lib/application/components/SharePage.js +0 -156
  135. package/lib/schema-component/antd/page/hooks/useShareActions.js +0 -286
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tachybase/client",
3
- "version": "1.3.19",
3
+ "version": "1.3.21",
4
4
  "license": "Apache-2.0",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.mjs",
@@ -59,26 +59,26 @@
59
59
  "react-quill": "^2.0.0",
60
60
  "react-router": "6.28.1",
61
61
  "react-router-dom": "6.28.1",
62
- "react-svg": "^16.2.0",
62
+ "react-svg": "^16.3.0",
63
63
  "react-to-print": "^2.15.1",
64
64
  "react-transition-group": "^4.4.5",
65
65
  "react-zoom-pan-pinch": "^3.6.1",
66
66
  "sanitize-html": "2.17.0",
67
67
  "use-deep-compare-effect": "^1.8.1",
68
68
  "xlsx": "0.18.5",
69
- "@tachybase/requirejs": "1.3.19",
70
- "@tachybase/components": "1.3.19",
71
- "@tachybase/schema": "1.3.19",
72
- "@tachybase/evaluators": "1.3.19",
73
- "@tachybase/sdk": "1.3.19",
74
- "@tachybase/utils": "1.3.19"
69
+ "@tachybase/components": "1.3.21",
70
+ "@tachybase/evaluators": "1.3.21",
71
+ "@tachybase/requirejs": "1.3.21",
72
+ "@tachybase/schema": "1.3.21",
73
+ "@tachybase/sdk": "1.3.21",
74
+ "@tachybase/utils": "1.3.21"
75
75
  },
76
76
  "devDependencies": {
77
77
  "@testing-library/react": "^16.2.0",
78
78
  "@types/flat": "^5.0.5",
79
- "@types/lodash": "^4.17.13",
79
+ "@types/lodash": "^4.17.20",
80
80
  "@types/markdown-it": "12.2.3",
81
- "@types/react-big-calendar": "^1.16.0"
81
+ "@types/react-big-calendar": "^1.16.2"
82
82
  },
83
83
  "peerDependencies": {
84
84
  "react": ">=18.0.0",
@@ -1,4 +0,0 @@
1
- export declare function useShareToken(): string;
2
- export declare const ShareLayout: () => import("react/jsx-runtime").JSX.Element;
3
- export declare const SharePage: () => import("react/jsx-runtime").JSX.Element;
4
- export declare function NotAuthorityResult(): import("react/jsx-runtime").JSX.Element;
@@ -1,113 +0,0 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
2
- import { useRef } from "react";
3
- import { css } from "@emotion/css";
4
- import { Layout } from "antd";
5
- import { Navigate, useLocation } from "react-router";
6
- import { Outlet } from "react-router-dom";
7
- import { useAPIClient } from "../../api-client/index.mjs";
8
- import { AdminProvider, AdminTabs, MenuEditor, useStyles } from "../../built-in/admin-layout/index.mjs";
9
- import { PinnedPluginList } from "../../built-in/pinned-list/index.mjs";
10
- import { useSystemSettings } from "../../built-in/system-settings/index.mjs";
11
- import { CurrentUser } from "../../user/index.mjs";
12
- import { useApp } from "../hooks/index.mjs";
13
- function _tagged_template_literal(strings, raw) {
14
- if (!raw) raw = strings.slice(0);
15
- return Object.freeze(Object.defineProperties(strings, {
16
- raw: {
17
- value: Object.freeze(raw)
18
- }
19
- }));
20
- }
21
- function _templateObject() {
22
- const data = _tagged_template_literal([
23
- "\n display: flex;\n flex-direction: column;\n position: relative;\n overflow-y: auto;\n > div {\n position: relative;\n }\n .ant-layout-footer {\n position: absolute;\n bottom: 0;\n text-align: center;\n width: 100%;\n z-index: 0;\n padding: 0px 50px;\n }\n "
24
- ]);
25
- _templateObject = function() {
26
- return data;
27
- };
28
- return data;
29
- }
30
- function useShareToken() {
31
- const url = new URL(window.location.href);
32
- const api = useAPIClient();
33
- const token = url.searchParams.get('token');
34
- return token && api.auth.setToken(token), api.auth.getToken();
35
- }
36
- const ShareLayout = ()=>{
37
- var _result_data_data_logo, _result_data_data, _result_data, _result_data_data1, _result_data1;
38
- const { styles } = useStyles();
39
- const app = useApp();
40
- const result = useSystemSettings();
41
- const sideMenuRef = useRef();
42
- return /*#__PURE__*/ jsx(Layout, {
43
- style: {
44
- height: '100%'
45
- },
46
- children: /*#__PURE__*/ jsxs(Layout.Content, {
47
- className: css(_templateObject()),
48
- children: [
49
- /*#__PURE__*/ jsx(Layout.Header, {
50
- className: styles.header,
51
- children: /*#__PURE__*/ jsxs("div", {
52
- className: styles.headerA,
53
- children: [
54
- /*#__PURE__*/ jsxs("div", {
55
- className: styles.headerB,
56
- children: [
57
- /*#__PURE__*/ jsxs("div", {
58
- className: styles.titleContainer,
59
- onClick: ()=>{
60
- location.href = app.adminUrl;
61
- },
62
- children: [
63
- /*#__PURE__*/ jsx("img", {
64
- className: styles.logo,
65
- src: null == result ? void 0 : null == (_result_data = result.data) ? void 0 : null == (_result_data_data = _result_data.data) ? void 0 : null == (_result_data_data_logo = _result_data_data.logo) ? void 0 : _result_data_data_logo.url
66
- }),
67
- /*#__PURE__*/ jsx("h1", {
68
- className: styles.title,
69
- children: null == result ? void 0 : null == (_result_data1 = result.data) ? void 0 : null == (_result_data_data1 = _result_data1.data) ? void 0 : _result_data_data1.title
70
- })
71
- ]
72
- }),
73
- /*#__PURE__*/ jsx(MenuEditor, {
74
- sideMenuRef: sideMenuRef
75
- }),
76
- /*#__PURE__*/ jsx("div", {
77
- className: styles.headerTabs,
78
- children: /*#__PURE__*/ jsx(AdminTabs, {})
79
- })
80
- ]
81
- }),
82
- /*#__PURE__*/ jsxs("div", {
83
- className: styles.right,
84
- children: [
85
- /*#__PURE__*/ jsx(PinnedPluginList, {
86
- belongToFilter: "pinnedmenu"
87
- }),
88
- /*#__PURE__*/ jsx(CurrentUser, {})
89
- ]
90
- })
91
- ]
92
- })
93
- }),
94
- /*#__PURE__*/ jsx(Outlet, {})
95
- ]
96
- })
97
- });
98
- };
99
- const SharePage = ()=>{
100
- const shareToken = useShareToken();
101
- return shareToken ? /*#__PURE__*/ jsx(AdminProvider, {
102
- children: /*#__PURE__*/ jsx(ShareLayout, {})
103
- }) : /*#__PURE__*/ jsx(NotAuthorityResult, {});
104
- };
105
- function NotAuthorityResult() {
106
- const { pathname, search } = useLocation();
107
- const redirect = "?redirect=".concat(pathname).concat(search);
108
- return /*#__PURE__*/ jsx(Navigate, {
109
- replace: true,
110
- to: "/signin".concat(redirect)
111
- });
112
- }
113
- export { NotAuthorityResult, ShareLayout, SharePage, useShareToken };
@@ -1 +0,0 @@
1
- export declare function ShareSchemaComponent(): import("react/jsx-runtime").JSX.Element;
@@ -1,10 +0,0 @@
1
- import { jsx } from "react/jsx-runtime";
2
- import { useParams } from "react-router";
3
- import { RemoteSchemaComponent } from "../../schema-component/index.mjs";
4
- function ShareSchemaComponent() {
5
- const params = useParams();
6
- return /*#__PURE__*/ jsx(RemoteSchemaComponent, {
7
- uid: params.name
8
- });
9
- }
10
- export { ShareSchemaComponent };
@@ -1,7 +0,0 @@
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
- };
@@ -1,242 +0,0 @@
1
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
- import { useEffect, useRef, useState } from "react";
3
- import { useFieldSchema } from "@tachybase/schema";
4
- import { Button, message } from "antd";
5
- import qrcode from "qrcode";
6
- import { useTranslation } from "react-i18next";
7
- import { useMatch } from "react-router";
8
- import { useIsMobile } from "../../../../block-provider/index.mjs";
9
- import { useCompile } from "../../../index.mjs";
10
- import { useCurrentUserVariable } from "../../../../schema-settings/index.mjs";
11
- const useShareActions = (param)=>{
12
- let { title, uid } = param;
13
- var _currentRoute_params;
14
- const fieldSchema = useFieldSchema();
15
- const isAdmin = useMatch('/admin/:name');
16
- const isShare = useMatch('/share/:name');
17
- const isMobile = useMatch('/mobile/:name');
18
- const isMobilePage = useIsMobile();
19
- const currentRoute = isAdmin || isShare || isMobile;
20
- const replaceLink = isMobilePage ? window.location.href.replace('/mobile', '/share') : window.location.href.replace('/admin', '/share');
21
- const link = replaceLink.replace(null == currentRoute ? void 0 : null == (_currentRoute_params = currentRoute.params) ? void 0 : _currentRoute_params.name, uid || fieldSchema['x-uid']).replace(window.location.search || '', '');
22
- const { t } = useTranslation();
23
- const [qrLink, setQrLink] = useState();
24
- const compile = useCompile();
25
- qrcode.toDataURL(link, {
26
- width: 170
27
- }, (err, url)=>{
28
- if (err) return void console.error(err);
29
- if (!qrLink) setQrLink(url);
30
- });
31
- const copyLink = ()=>{
32
- navigator.clipboard.writeText(link).then((res)=>{
33
- message.open({
34
- type: 'success',
35
- content: /*#__PURE__*/ jsxs(Fragment, {
36
- children: [
37
- t('Replicated'),
38
- /*#__PURE__*/ jsx("span", {
39
- style: {
40
- color: '#3279FE'
41
- },
42
- children: compile(title || '')
43
- }),
44
- t('page link')
45
- ]
46
- })
47
- });
48
- });
49
- };
50
- const imageAction = ()=>/*#__PURE__*/ jsx(ImageModal, {
51
- link: qrLink,
52
- title: title
53
- });
54
- return {
55
- copyLink,
56
- imageAction
57
- };
58
- };
59
- const ImageModal = (props)=>{
60
- const { link, title } = props;
61
- const canvasRef = useRef(null);
62
- const { t } = useTranslation();
63
- const { currentUserCtx } = useCurrentUserVariable();
64
- const compile = useCompile();
65
- useEffect(()=>{
66
- canvasContent(canvasRef, link, currentUserCtx, t);
67
- }, []);
68
- const saveImage = ()=>{
69
- const canvas = canvasRef.current;
70
- if (canvas) {
71
- const imageData = canvas.toDataURL('image/png');
72
- const link = document.createElement('a');
73
- link.href = imageData;
74
- link.download = 'Tachybase-Share.png';
75
- link.click();
76
- message.open({
77
- type: 'success',
78
- content: /*#__PURE__*/ jsxs(Fragment, {
79
- children: [
80
- t('Saved'),
81
- /*#__PURE__*/ jsx("span", {
82
- style: {
83
- color: '#3279FE'
84
- },
85
- children: compile(title || '')
86
- }),
87
- t('QR code')
88
- ]
89
- })
90
- });
91
- }
92
- };
93
- const copyImage = ()=>{
94
- const canvas = canvasRef.current;
95
- if (canvas && navigator.clipboard) canvas.toBlob(async (blob)=>{
96
- if (!blob) return;
97
- try {
98
- const item = new ClipboardItem({
99
- 'image/png': blob
100
- });
101
- await navigator.clipboard.write([
102
- item
103
- ]);
104
- message.open({
105
- type: 'success',
106
- content: /*#__PURE__*/ jsxs(Fragment, {
107
- children: [
108
- t('Replicated'),
109
- /*#__PURE__*/ jsx("span", {
110
- style: {
111
- color: '#3279FE'
112
- },
113
- children: compile(title || '')
114
- }),
115
- t('QR code')
116
- ]
117
- })
118
- });
119
- } catch (err) {
120
- message.error(t('Copy failed, please try again'));
121
- }
122
- }, 'image/png');
123
- };
124
- return /*#__PURE__*/ jsxs("div", {
125
- style: {
126
- marginTop: '23px',
127
- display: 'flex',
128
- flexDirection: 'column',
129
- justifyContent: 'center',
130
- alignItems: 'center'
131
- },
132
- children: [
133
- /*#__PURE__*/ jsx("canvas", {
134
- ref: canvasRef,
135
- width: 240,
136
- height: 260,
137
- style: {
138
- width: '240px',
139
- height: '260px',
140
- pointerEvents: 'none'
141
- }
142
- }),
143
- /*#__PURE__*/ jsxs("div", {
144
- style: {
145
- width: '100%',
146
- display: 'flex',
147
- justifyContent: 'space-between',
148
- marginTop: '10px',
149
- gap: '15px'
150
- },
151
- children: [
152
- /*#__PURE__*/ jsx(Button, {
153
- onClick: saveImage,
154
- style: {
155
- flex: 1
156
- },
157
- children: t('Save Picture')
158
- }),
159
- /*#__PURE__*/ jsx(Button, {
160
- onClick: copyImage,
161
- style: {
162
- flex: 1
163
- },
164
- children: t('Copy QR code')
165
- })
166
- ]
167
- })
168
- ]
169
- });
170
- };
171
- const canvasContent = (canvasRef, link, currentUserCtx, t)=>{
172
- const canvas = canvasRef.current;
173
- const ctx = canvas.getContext('2d');
174
- const dpr = window.devicePixelRatio;
175
- const { width, height } = canvas;
176
- canvas.width = Math.round(width * dpr);
177
- canvas.height = Math.round(height * dpr);
178
- canvas.style.width = width + 'px';
179
- canvas.style.height = height + 'px';
180
- ctx.scale(dpr, dpr);
181
- ctx.filter = 'blur(20px)';
182
- const backgroundGradient = ctx.createLinearGradient(0, 0, canvas.width, canvas.height);
183
- backgroundGradient.addColorStop(0, 'rgba(255, 255, 255, 1)');
184
- backgroundGradient.addColorStop(1, 'rgba(234, 238, 246, 0.80)');
185
- ctx.fillStyle = backgroundGradient;
186
- ctx.fillRect(0, 0, canvas.width, canvas.height);
187
- const drawGlow = (x, y)=>{
188
- const radius = 100;
189
- const gradient = ctx.createRadialGradient(x, y, 0, x, y, radius);
190
- gradient.addColorStop(0, 'rgba(255, 255, 255, 1)');
191
- gradient.addColorStop(1, 'rgba(217, 238, 255, 0.216)');
192
- ctx.fillStyle = gradient;
193
- ctx.beginPath();
194
- ctx.arc(x, y, radius, 0, 2 * Math.PI);
195
- ctx.fill();
196
- };
197
- drawGlow(60, 30);
198
- drawGlow(190, 280);
199
- ctx.filter = 'none';
200
- ctx.fillStyle = '#AAAAAA';
201
- ctx.font = '13px Arial';
202
- ctx.textAlign = 'center';
203
- ctx.fillText("".concat(currentUserCtx.nickname), canvas.width / 4, 30);
204
- const img = new Image();
205
- img.src = link;
206
- img.onload = ()=>{
207
- const imgWidth = img.width;
208
- const imgHeight = img.height;
209
- const x = (canvas.width - imgWidth) / 8;
210
- const y = 40;
211
- const borderWidth = 3;
212
- const borderRadius = 20;
213
- ctx.beginPath();
214
- ctx.moveTo(x + borderRadius, y);
215
- ctx.arcTo(x + imgWidth, y, x + imgWidth, y + imgHeight, borderRadius);
216
- ctx.arcTo(x + imgWidth, y + imgHeight, x, y + imgHeight, borderRadius);
217
- ctx.arcTo(x, y + imgHeight, x, y, borderRadius);
218
- ctx.arcTo(x, y, x + imgWidth, y, borderRadius);
219
- ctx.closePath();
220
- ctx.clip();
221
- ctx.drawImage(img, x + borderWidth, y + borderWidth, imgWidth - 2 * borderWidth, imgHeight - 2 * borderWidth);
222
- ctx.lineWidth = borderWidth;
223
- ctx.strokeStyle = '#000';
224
- ctx.beginPath();
225
- ctx.moveTo(x + borderRadius, y);
226
- ctx.arcTo(x + imgWidth, y, x + imgWidth, y + imgHeight, borderRadius);
227
- ctx.arcTo(x + imgWidth, y + imgHeight, x, y + imgHeight, borderRadius);
228
- ctx.arcTo(x, y + imgHeight, x, y, borderRadius);
229
- ctx.arcTo(x, y, x + imgWidth, y, borderRadius);
230
- ctx.closePath();
231
- ctx.stroke();
232
- };
233
- ctx.fillStyle = '#AAAAAA';
234
- ctx.font = '13px Arial';
235
- ctx.textAlign = 'center';
236
- ctx.fillText(t('Scan the code to view the sharing'), canvas.width / 4, 230);
237
- ctx.fillStyle = 'rgba(50, 121, 254, 1)';
238
- ctx.font = '14px Arial';
239
- ctx.textAlign = 'center';
240
- ctx.fillText("\u7075\u77F6(Tachybase)", canvas.width / 4, 250);
241
- };
242
- export { useShareActions };
@@ -1,156 +0,0 @@
1
- "use strict";
2
- var __webpack_require__ = {};
3
- (()=>{
4
- __webpack_require__.d = (exports1, definition)=>{
5
- for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
6
- enumerable: true,
7
- get: definition[key]
8
- });
9
- };
10
- })();
11
- (()=>{
12
- __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
13
- })();
14
- (()=>{
15
- __webpack_require__.r = (exports1)=>{
16
- if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
17
- value: 'Module'
18
- });
19
- Object.defineProperty(exports1, '__esModule', {
20
- value: true
21
- });
22
- };
23
- })();
24
- var __webpack_exports__ = {};
25
- __webpack_require__.r(__webpack_exports__);
26
- __webpack_require__.d(__webpack_exports__, {
27
- ShareLayout: ()=>ShareLayout,
28
- useShareToken: ()=>useShareToken,
29
- SharePage: ()=>SharePage,
30
- NotAuthorityResult: ()=>NotAuthorityResult
31
- });
32
- const jsx_runtime_namespaceObject = require("react/jsx-runtime");
33
- const external_react_namespaceObject = require("react");
34
- const css_namespaceObject = require("@emotion/css");
35
- const external_antd_namespaceObject = require("antd");
36
- const external_react_router_namespaceObject = require("react-router");
37
- const external_react_router_dom_namespaceObject = require("react-router-dom");
38
- const index_js_namespaceObject = require("../../api-client/index.js");
39
- const admin_layout_index_js_namespaceObject = require("../../built-in/admin-layout/index.js");
40
- const pinned_list_index_js_namespaceObject = require("../../built-in/pinned-list/index.js");
41
- const system_settings_index_js_namespaceObject = require("../../built-in/system-settings/index.js");
42
- const external_user_index_js_namespaceObject = require("../../user/index.js");
43
- const external_hooks_index_js_namespaceObject = require("../hooks/index.js");
44
- function _tagged_template_literal(strings, raw) {
45
- if (!raw) raw = strings.slice(0);
46
- return Object.freeze(Object.defineProperties(strings, {
47
- raw: {
48
- value: Object.freeze(raw)
49
- }
50
- }));
51
- }
52
- function _templateObject() {
53
- const data = _tagged_template_literal([
54
- "\n display: flex;\n flex-direction: column;\n position: relative;\n overflow-y: auto;\n > div {\n position: relative;\n }\n .ant-layout-footer {\n position: absolute;\n bottom: 0;\n text-align: center;\n width: 100%;\n z-index: 0;\n padding: 0px 50px;\n }\n "
55
- ]);
56
- _templateObject = function() {
57
- return data;
58
- };
59
- return data;
60
- }
61
- function useShareToken() {
62
- const url = new URL(window.location.href);
63
- const api = (0, index_js_namespaceObject.useAPIClient)();
64
- const token = url.searchParams.get('token');
65
- return token && api.auth.setToken(token), api.auth.getToken();
66
- }
67
- const ShareLayout = ()=>{
68
- var _result_data_data_logo, _result_data_data, _result_data, _result_data_data1, _result_data1;
69
- const { styles } = (0, admin_layout_index_js_namespaceObject.useStyles)();
70
- const app = (0, external_hooks_index_js_namespaceObject.useApp)();
71
- const result = (0, system_settings_index_js_namespaceObject.useSystemSettings)();
72
- const sideMenuRef = (0, external_react_namespaceObject.useRef)();
73
- return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.Layout, {
74
- style: {
75
- height: '100%'
76
- },
77
- children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_antd_namespaceObject.Layout.Content, {
78
- className: (0, css_namespaceObject.css)(_templateObject()),
79
- children: [
80
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.Layout.Header, {
81
- className: styles.header,
82
- children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
83
- className: styles.headerA,
84
- children: [
85
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
86
- className: styles.headerB,
87
- children: [
88
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
89
- className: styles.titleContainer,
90
- onClick: ()=>{
91
- location.href = app.adminUrl;
92
- },
93
- children: [
94
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("img", {
95
- className: styles.logo,
96
- src: null == result ? void 0 : null == (_result_data = result.data) ? void 0 : null == (_result_data_data = _result_data.data) ? void 0 : null == (_result_data_data_logo = _result_data_data.logo) ? void 0 : _result_data_data_logo.url
97
- }),
98
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("h1", {
99
- className: styles.title,
100
- children: null == result ? void 0 : null == (_result_data1 = result.data) ? void 0 : null == (_result_data_data1 = _result_data1.data) ? void 0 : _result_data_data1.title
101
- })
102
- ]
103
- }),
104
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(admin_layout_index_js_namespaceObject.MenuEditor, {
105
- sideMenuRef: sideMenuRef
106
- }),
107
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
108
- className: styles.headerTabs,
109
- children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(admin_layout_index_js_namespaceObject.AdminTabs, {})
110
- })
111
- ]
112
- }),
113
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
114
- className: styles.right,
115
- children: [
116
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(pinned_list_index_js_namespaceObject.PinnedPluginList, {
117
- belongToFilter: "pinnedmenu"
118
- }),
119
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_user_index_js_namespaceObject.CurrentUser, {})
120
- ]
121
- })
122
- ]
123
- })
124
- }),
125
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_react_router_dom_namespaceObject.Outlet, {})
126
- ]
127
- })
128
- });
129
- };
130
- const SharePage = ()=>{
131
- const shareToken = useShareToken();
132
- return shareToken ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(admin_layout_index_js_namespaceObject.AdminProvider, {
133
- children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(ShareLayout, {})
134
- }) : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(NotAuthorityResult, {});
135
- };
136
- function NotAuthorityResult() {
137
- const { pathname, search } = (0, external_react_router_namespaceObject.useLocation)();
138
- const redirect = "?redirect=".concat(pathname).concat(search);
139
- return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_react_router_namespaceObject.Navigate, {
140
- replace: true,
141
- to: "/signin".concat(redirect)
142
- });
143
- }
144
- exports.NotAuthorityResult = __webpack_exports__.NotAuthorityResult;
145
- exports.ShareLayout = __webpack_exports__.ShareLayout;
146
- exports.SharePage = __webpack_exports__.SharePage;
147
- exports.useShareToken = __webpack_exports__.useShareToken;
148
- for(var __webpack_i__ in __webpack_exports__)if (-1 === [
149
- "NotAuthorityResult",
150
- "ShareLayout",
151
- "SharePage",
152
- "useShareToken"
153
- ].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
154
- Object.defineProperty(exports, '__esModule', {
155
- value: true
156
- });