@tachybase/client 1.0.18 → 1.1.0
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.
- package/es/application/Application.d.ts +2 -0
- package/es/application/Application.mjs +15 -0
- package/es/application/TrackingManager.d.ts +13 -0
- package/es/application/TrackingManager.mjs +30 -0
- package/es/application/components/SharePage.d.ts +4 -0
- package/es/application/components/SharePage.mjs +113 -0
- package/es/application/components/ShareSchemaComponent.d.ts +1 -0
- package/es/application/components/ShareSchemaComponent.mjs +10 -0
- package/es/application/components/index.d.ts +2 -0
- package/es/application/components/index.mjs +2 -0
- package/es/built-in/admin-layout/index.d.ts +1 -0
- package/es/built-in/admin-layout/index.mjs +1 -0
- package/es/collection-manager/interfaces/__tests__/json.mjs +2 -2
- package/es/collection-manager/interfaces/integer.d.ts +12 -0
- package/es/collection-manager/interfaces/integer.mjs +13 -1
- package/es/collection-manager/interfaces/number.d.ts +16 -0
- package/es/collection-manager/interfaces/number.mjs +22 -1
- package/es/collection-manager/interfaces/percent.d.ts +12 -0
- package/es/collection-manager/interfaces/percent.mjs +12 -0
- package/es/data-source/collection-fields-to-initializer-items/CollectionFieldsToFormInitializerItems.d.ts +3 -0
- package/es/data-source/collection-fields-to-initializer-items/CollectionFieldsToFormInitializerItems.mjs +67 -0
- package/es/data-source/collection-fields-to-initializer-items/CollectionFieldsToInitializerItems.d.ts +3 -0
- package/es/data-source/collection-fields-to-initializer-items/CollectionFieldsToInitializerItems.mjs +37 -0
- package/es/data-source/collection-fields-to-initializer-items/index.d.ts +1 -0
- package/es/data-source/collection-fields-to-initializer-items/index.mjs +1 -0
- package/es/data-source/collection-fields-to-initializer-items/items/AssociationCollectionFields.d.ts +3 -0
- package/es/data-source/collection-fields-to-initializer-items/items/AssociationCollectionFields.mjs +59 -0
- package/es/data-source/collection-fields-to-initializer-items/items/ParentCollectionFields.d.ts +3 -0
- package/es/data-source/collection-fields-to-initializer-items/items/ParentCollectionFields.mjs +34 -0
- package/es/data-source/collection-fields-to-initializer-items/items/SelfFields.d.ts +3 -0
- package/es/data-source/collection-fields-to-initializer-items/items/SelfFields.mjs +14 -0
- package/es/data-source/collection-fields-to-initializer-items/items/index.d.ts +3 -0
- package/es/data-source/collection-fields-to-initializer-items/items/index.mjs +7 -0
- package/es/data-source/collection-fields-to-initializer-items/utils/getInitializerItemsByFields.d.ts +5 -0
- package/es/data-source/collection-fields-to-initializer-items/utils/getInitializerItemsByFields.mjs +91 -0
- package/es/data-source/collection-fields-to-initializer-items/utils/index.d.ts +3 -0
- package/es/data-source/collection-fields-to-initializer-items/utils/index.mjs +3 -0
- package/es/data-source/collection-fields-to-initializer-items/utils/type.d.ts +108 -0
- package/es/data-source/collection-fields-to-initializer-items/utils/type.mjs +0 -0
- package/es/data-source/collection-fields-to-initializer-items/utils/useCollectionFieldContext.d.ts +21 -0
- package/es/data-source/collection-fields-to-initializer-items/utils/useCollectionFieldContext.mjs +31 -0
- package/es/data-source/index.d.ts +1 -0
- package/es/data-source/index.mjs +1 -0
- package/es/modules/blocks/data-blocks/form/fieldSettingsFormItem.mjs +0 -8
- package/es/modules/blocks/data-blocks/form/hooks/useEditFormBlockDecoratorProps.d.ts +1 -3
- package/es/modules/blocks/data-blocks/form/hooks/useEditFormBlockDecoratorProps.mjs +4 -1
- package/es/modules/fields/component/InputNumber/inputNumberComponentFieldSettings.mjs +91 -0
- package/es/schema-component/antd/index.d.ts +2 -0
- package/es/schema-component/antd/index.mjs +2 -0
- package/es/schema-component/antd/page/Page.Settings.mjs +33 -0
- package/es/schema-component/antd/page/Page.mjs +113 -18
- package/es/schema-component/antd/page/hooks/index.d.ts +1 -0
- package/es/schema-component/antd/page/hooks/index.mjs +1 -0
- package/es/schema-component/antd/page/hooks/useShareActions.d.ts +7 -0
- package/es/schema-component/antd/page/hooks/useShareActions.mjs +245 -0
- package/es/schema-component/antd/page/index.d.ts +1 -0
- package/es/schema-component/antd/page/index.mjs +1 -0
- package/es/schema-component/antd/page/style.d.ts +5 -0
- package/es/schema-component/antd/page/style.mjs +59 -2
- package/es/schema-component/antd/slider/index.d.ts +1 -0
- package/es/schema-component/antd/slider/index.mjs +1 -0
- package/es/schema-component/antd/slider/slider.d.ts +3 -0
- package/es/schema-component/antd/slider/slider.mjs +11 -0
- package/es/schema-component/antd/tracking-link/index.d.ts +10 -0
- package/es/schema-component/antd/tracking-link/index.mjs +25 -0
- package/es/schema-initializer/utils.d.ts +1 -0
- package/es/schema-initializer/utils.mjs +1 -1
- package/lib/application/Application.js +15 -0
- package/lib/application/TrackingManager.js +66 -0
- package/lib/application/components/SharePage.js +150 -0
- package/lib/application/components/ShareSchemaComponent.js +44 -0
- package/lib/application/components/index.js +18 -0
- package/lib/block-provider/hooks/index.js +2 -2
- package/lib/built-in/admin-layout/index.js +9 -0
- package/lib/collection-manager/interfaces/__tests__/json.js +4 -4
- package/lib/collection-manager/interfaces/integer.js +13 -1
- package/lib/collection-manager/interfaces/number.js +22 -1
- package/lib/collection-manager/interfaces/percent.js +12 -0
- package/lib/data-source/collection-fields-to-initializer-items/CollectionFieldsToFormInitializerItems.js +102 -0
- package/lib/data-source/collection-fields-to-initializer-items/CollectionFieldsToInitializerItems.js +71 -0
- package/lib/data-source/collection-fields-to-initializer-items/index.js +65 -0
- package/lib/data-source/collection-fields-to-initializer-items/items/AssociationCollectionFields.js +93 -0
- package/lib/data-source/collection-fields-to-initializer-items/items/ParentCollectionFields.js +68 -0
- package/lib/data-source/collection-fields-to-initializer-items/items/SelfFields.js +48 -0
- package/lib/data-source/collection-fields-to-initializer-items/items/index.js +40 -0
- package/lib/data-source/collection-fields-to-initializer-items/utils/getInitializerItemsByFields.js +127 -0
- package/lib/data-source/collection-fields-to-initializer-items/utils/index.js +83 -0
- package/lib/data-source/collection-fields-to-initializer-items/utils/type.js +19 -0
- package/lib/data-source/collection-fields-to-initializer-items/utils/useCollectionFieldContext.js +65 -0
- package/lib/data-source/index.js +12 -3
- package/lib/locale/zh-CN.js +18 -0
- package/lib/modules/blocks/data-blocks/form/fieldSettingsFormItem.js +0 -8
- package/lib/modules/blocks/data-blocks/form/hooks/useEditFormBlockDecoratorProps.js +4 -1
- package/lib/modules/fields/component/InputNumber/inputNumberComponentFieldSettings.js +91 -0
- package/lib/schema-component/antd/index.js +161 -133
- package/lib/schema-component/antd/page/Page.Settings.js +33 -0
- package/lib/schema-component/antd/page/Page.js +113 -18
- package/lib/schema-component/antd/page/hooks/index.js +65 -0
- package/lib/schema-component/antd/page/hooks/useShareActions.js +293 -0
- package/lib/schema-component/antd/page/index.js +9 -0
- package/lib/schema-component/antd/page/style.js +60 -2
- package/lib/schema-component/antd/slider/index.js +65 -0
- package/lib/schema-component/antd/slider/slider.js +46 -0
- package/lib/schema-component/antd/tracking-link/index.js +59 -0
- package/lib/schema-initializer/utils.js +2 -1
- package/package.json +8 -7
|
@@ -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
|
-
|
|
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:
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
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,245 @@
|
|
|
1
|
+
import * as __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__ from "react/jsx-runtime";
|
|
2
|
+
import * as __WEBPACK_EXTERNAL_MODULE_react__ from "react";
|
|
3
|
+
import * as __WEBPACK_EXTERNAL_MODULE__tachybase_schema__ from "@tachybase/schema";
|
|
4
|
+
import * as __WEBPACK_EXTERNAL_MODULE_antd__ from "antd";
|
|
5
|
+
import * as __WEBPACK_EXTERNAL_MODULE_qrcode__ from "qrcode";
|
|
6
|
+
import * as __WEBPACK_EXTERNAL_MODULE_react_i18next__ from "react-i18next";
|
|
7
|
+
import * as __WEBPACK_EXTERNAL_MODULE_react_router__ from "react-router";
|
|
8
|
+
import * as __WEBPACK_EXTERNAL_MODULE__block_provider_index_mjs__ from "../../../../block-provider/index.mjs";
|
|
9
|
+
import * as __WEBPACK_EXTERNAL_MODULE__index_mjs__ from "../../../index.mjs";
|
|
10
|
+
import * as __WEBPACK_EXTERNAL_MODULE__schema_settings_index_mjs__ from "../../../../schema-settings/index.mjs";
|
|
11
|
+
const useShareActions = (param)=>{
|
|
12
|
+
let { title, uid } = param;
|
|
13
|
+
var _currentRoute_params;
|
|
14
|
+
const fieldSchema = (0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema__.useFieldSchema)();
|
|
15
|
+
const isAdmin = (0, __WEBPACK_EXTERNAL_MODULE_react_router__.useMatch)('/admin/:name');
|
|
16
|
+
const isShare = (0, __WEBPACK_EXTERNAL_MODULE_react_router__.useMatch)('/share/:name');
|
|
17
|
+
const isMobile = (0, __WEBPACK_EXTERNAL_MODULE_react_router__.useMatch)('/mobile/:name');
|
|
18
|
+
const isMobilePage = (0, __WEBPACK_EXTERNAL_MODULE__block_provider_index_mjs__.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 ? void 0 : _currentRoute_params.name, uid || fieldSchema['x-uid']).replace(window.location.search || '', '');
|
|
22
|
+
const { t } = (0, __WEBPACK_EXTERNAL_MODULE_react_i18next__.useTranslation)();
|
|
23
|
+
const [qrLink, setQrLink] = (0, __WEBPACK_EXTERNAL_MODULE_react__.useState)();
|
|
24
|
+
const compile = (0, __WEBPACK_EXTERNAL_MODULE__index_mjs__.useCompile)();
|
|
25
|
+
__WEBPACK_EXTERNAL_MODULE_qrcode__["default"].toDataURL(link, {
|
|
26
|
+
width: 170
|
|
27
|
+
}, (err, url)=>{
|
|
28
|
+
if (err) {
|
|
29
|
+
console.error(err);
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
if (!qrLink) setQrLink(url);
|
|
33
|
+
});
|
|
34
|
+
const copyLink = ()=>{
|
|
35
|
+
navigator.clipboard.writeText(link).then((res)=>{
|
|
36
|
+
__WEBPACK_EXTERNAL_MODULE_antd__.message.open({
|
|
37
|
+
type: 'success',
|
|
38
|
+
content: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsxs)(__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.Fragment, {
|
|
39
|
+
children: [
|
|
40
|
+
t('Replicated'),
|
|
41
|
+
/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)("span", {
|
|
42
|
+
style: {
|
|
43
|
+
color: '#3279FE'
|
|
44
|
+
},
|
|
45
|
+
children: compile(title || '')
|
|
46
|
+
}),
|
|
47
|
+
t('page link')
|
|
48
|
+
]
|
|
49
|
+
})
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
};
|
|
53
|
+
const imageAction = ()=>/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(ImageModal, {
|
|
54
|
+
link: qrLink,
|
|
55
|
+
title: title
|
|
56
|
+
});
|
|
57
|
+
return {
|
|
58
|
+
copyLink,
|
|
59
|
+
imageAction
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
const ImageModal = (props)=>{
|
|
63
|
+
const { link, title } = props;
|
|
64
|
+
const canvasRef = (0, __WEBPACK_EXTERNAL_MODULE_react__.useRef)(null);
|
|
65
|
+
const { t } = (0, __WEBPACK_EXTERNAL_MODULE_react_i18next__.useTranslation)();
|
|
66
|
+
const { currentUserCtx } = (0, __WEBPACK_EXTERNAL_MODULE__schema_settings_index_mjs__.useCurrentUserVariable)();
|
|
67
|
+
const compile = (0, __WEBPACK_EXTERNAL_MODULE__index_mjs__.useCompile)();
|
|
68
|
+
(0, __WEBPACK_EXTERNAL_MODULE_react__.useEffect)(()=>{
|
|
69
|
+
canvasContent(canvasRef, link, currentUserCtx, t);
|
|
70
|
+
}, []);
|
|
71
|
+
const saveImage = ()=>{
|
|
72
|
+
const canvas = canvasRef.current;
|
|
73
|
+
if (canvas) {
|
|
74
|
+
const imageData = canvas.toDataURL('image/png');
|
|
75
|
+
const link = document.createElement('a');
|
|
76
|
+
link.href = imageData;
|
|
77
|
+
link.download = 'Tachybase-Share.png';
|
|
78
|
+
link.click();
|
|
79
|
+
__WEBPACK_EXTERNAL_MODULE_antd__.message.open({
|
|
80
|
+
type: 'success',
|
|
81
|
+
content: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsxs)(__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.Fragment, {
|
|
82
|
+
children: [
|
|
83
|
+
t('Saved'),
|
|
84
|
+
/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)("span", {
|
|
85
|
+
style: {
|
|
86
|
+
color: '#3279FE'
|
|
87
|
+
},
|
|
88
|
+
children: compile(title || '')
|
|
89
|
+
}),
|
|
90
|
+
t('QR code')
|
|
91
|
+
]
|
|
92
|
+
})
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
const copyImage = ()=>{
|
|
97
|
+
const canvas = canvasRef.current;
|
|
98
|
+
if (canvas && navigator.clipboard) canvas.toBlob(async (blob)=>{
|
|
99
|
+
if (!blob) return;
|
|
100
|
+
try {
|
|
101
|
+
const item = new ClipboardItem({
|
|
102
|
+
'image/png': blob
|
|
103
|
+
});
|
|
104
|
+
await navigator.clipboard.write([
|
|
105
|
+
item
|
|
106
|
+
]);
|
|
107
|
+
__WEBPACK_EXTERNAL_MODULE_antd__.message.open({
|
|
108
|
+
type: 'success',
|
|
109
|
+
content: /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsxs)(__WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.Fragment, {
|
|
110
|
+
children: [
|
|
111
|
+
t('Replicated'),
|
|
112
|
+
/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)("span", {
|
|
113
|
+
style: {
|
|
114
|
+
color: '#3279FE'
|
|
115
|
+
},
|
|
116
|
+
children: compile(title || '')
|
|
117
|
+
}),
|
|
118
|
+
t('QR code')
|
|
119
|
+
]
|
|
120
|
+
})
|
|
121
|
+
});
|
|
122
|
+
} catch (err) {
|
|
123
|
+
__WEBPACK_EXTERNAL_MODULE_antd__.message.error(t('Copy failed, please try again'));
|
|
124
|
+
}
|
|
125
|
+
}, 'image/png');
|
|
126
|
+
};
|
|
127
|
+
return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsxs)("div", {
|
|
128
|
+
style: {
|
|
129
|
+
marginTop: '23px',
|
|
130
|
+
display: 'flex',
|
|
131
|
+
flexDirection: 'column',
|
|
132
|
+
justifyContent: 'center',
|
|
133
|
+
alignItems: 'center'
|
|
134
|
+
},
|
|
135
|
+
children: [
|
|
136
|
+
/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)("canvas", {
|
|
137
|
+
ref: canvasRef,
|
|
138
|
+
width: 240,
|
|
139
|
+
height: 260,
|
|
140
|
+
style: {
|
|
141
|
+
width: '240px',
|
|
142
|
+
height: '260px',
|
|
143
|
+
pointerEvents: 'none'
|
|
144
|
+
}
|
|
145
|
+
}),
|
|
146
|
+
/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsxs)("div", {
|
|
147
|
+
style: {
|
|
148
|
+
width: '100%',
|
|
149
|
+
display: 'flex',
|
|
150
|
+
justifyContent: 'space-between',
|
|
151
|
+
marginTop: '10px',
|
|
152
|
+
gap: '15px'
|
|
153
|
+
},
|
|
154
|
+
children: [
|
|
155
|
+
/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE_antd__.Button, {
|
|
156
|
+
onClick: saveImage,
|
|
157
|
+
style: {
|
|
158
|
+
flex: 1
|
|
159
|
+
},
|
|
160
|
+
children: t('Save Picture')
|
|
161
|
+
}),
|
|
162
|
+
/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE_antd__.Button, {
|
|
163
|
+
onClick: copyImage,
|
|
164
|
+
style: {
|
|
165
|
+
flex: 1
|
|
166
|
+
},
|
|
167
|
+
children: t('Copy QR code')
|
|
168
|
+
})
|
|
169
|
+
]
|
|
170
|
+
})
|
|
171
|
+
]
|
|
172
|
+
});
|
|
173
|
+
};
|
|
174
|
+
const canvasContent = (canvasRef, link, currentUserCtx, t)=>{
|
|
175
|
+
const canvas = canvasRef.current;
|
|
176
|
+
const ctx = canvas.getContext('2d');
|
|
177
|
+
const dpr = window.devicePixelRatio;
|
|
178
|
+
const { width, height } = canvas;
|
|
179
|
+
canvas.width = Math.round(width * dpr);
|
|
180
|
+
canvas.height = Math.round(height * dpr);
|
|
181
|
+
canvas.style.width = width + 'px';
|
|
182
|
+
canvas.style.height = height + 'px';
|
|
183
|
+
ctx.scale(dpr, dpr);
|
|
184
|
+
ctx.filter = 'blur(20px)';
|
|
185
|
+
const backgroundGradient = ctx.createLinearGradient(0, 0, canvas.width, canvas.height);
|
|
186
|
+
backgroundGradient.addColorStop(0, 'rgba(255, 255, 255, 1)');
|
|
187
|
+
backgroundGradient.addColorStop(1, 'rgba(234, 238, 246, 0.80)');
|
|
188
|
+
ctx.fillStyle = backgroundGradient;
|
|
189
|
+
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
|
190
|
+
const drawGlow = (x, y)=>{
|
|
191
|
+
const radius = 100;
|
|
192
|
+
const gradient = ctx.createRadialGradient(x, y, 0, x, y, radius);
|
|
193
|
+
gradient.addColorStop(0, 'rgba(255, 255, 255, 1)');
|
|
194
|
+
gradient.addColorStop(1, 'rgba(217, 238, 255, 0.216)');
|
|
195
|
+
ctx.fillStyle = gradient;
|
|
196
|
+
ctx.beginPath();
|
|
197
|
+
ctx.arc(x, y, radius, 0, 2 * Math.PI);
|
|
198
|
+
ctx.fill();
|
|
199
|
+
};
|
|
200
|
+
drawGlow(60, 30);
|
|
201
|
+
drawGlow(190, 280);
|
|
202
|
+
ctx.filter = 'none';
|
|
203
|
+
ctx.fillStyle = '#AAAAAA';
|
|
204
|
+
ctx.font = '13px Arial';
|
|
205
|
+
ctx.textAlign = 'center';
|
|
206
|
+
ctx.fillText("".concat(currentUserCtx.nickname), canvas.width / 4, 30);
|
|
207
|
+
const img = new Image();
|
|
208
|
+
img.src = link;
|
|
209
|
+
img.onload = ()=>{
|
|
210
|
+
const imgWidth = img.width;
|
|
211
|
+
const imgHeight = img.height;
|
|
212
|
+
const x = (canvas.width - imgWidth) / 8;
|
|
213
|
+
const y = 40;
|
|
214
|
+
const borderWidth = 3;
|
|
215
|
+
const borderRadius = 20;
|
|
216
|
+
ctx.beginPath();
|
|
217
|
+
ctx.moveTo(x + borderRadius, y);
|
|
218
|
+
ctx.arcTo(x + imgWidth, y, x + imgWidth, y + imgHeight, borderRadius);
|
|
219
|
+
ctx.arcTo(x + imgWidth, y + imgHeight, x, y + imgHeight, borderRadius);
|
|
220
|
+
ctx.arcTo(x, y + imgHeight, x, y, borderRadius);
|
|
221
|
+
ctx.arcTo(x, y, x + imgWidth, y, borderRadius);
|
|
222
|
+
ctx.closePath();
|
|
223
|
+
ctx.clip();
|
|
224
|
+
ctx.drawImage(img, x + borderWidth, y + borderWidth, imgWidth - 2 * borderWidth, imgHeight - 2 * borderWidth);
|
|
225
|
+
ctx.lineWidth = borderWidth;
|
|
226
|
+
ctx.strokeStyle = '#000';
|
|
227
|
+
ctx.beginPath();
|
|
228
|
+
ctx.moveTo(x + borderRadius, y);
|
|
229
|
+
ctx.arcTo(x + imgWidth, y, x + imgWidth, y + imgHeight, borderRadius);
|
|
230
|
+
ctx.arcTo(x + imgWidth, y + imgHeight, x, y + imgHeight, borderRadius);
|
|
231
|
+
ctx.arcTo(x, y + imgHeight, x, y, borderRadius);
|
|
232
|
+
ctx.arcTo(x, y, x + imgWidth, y, borderRadius);
|
|
233
|
+
ctx.closePath();
|
|
234
|
+
ctx.stroke();
|
|
235
|
+
};
|
|
236
|
+
ctx.fillStyle = '#AAAAAA';
|
|
237
|
+
ctx.font = '13px Arial';
|
|
238
|
+
ctx.textAlign = 'center';
|
|
239
|
+
ctx.fillText(t('Scan the code to view the sharing'), canvas.width / 4, 230);
|
|
240
|
+
ctx.fillStyle = 'rgba(50, 121, 254, 1)';
|
|
241
|
+
ctx.font = '14px Arial';
|
|
242
|
+
ctx.textAlign = 'center';
|
|
243
|
+
ctx.fillText('灵矶(Tachybase)', canvas.width / 4, 250);
|
|
244
|
+
};
|
|
245
|
+
export { useShareActions };
|
|
@@ -1 +1,6 @@
|
|
|
1
1
|
export declare const getStyles: (props?: any) => import("./../__builtins__").UseComponentStyleResult;
|
|
2
|
+
export declare const useStyles: (props?: unknown) => import("antd-style").ReturnStyles<{
|
|
3
|
+
firstmodal: import("antd-style").SerializedStyles;
|
|
4
|
+
secondmodal: import("antd-style").SerializedStyles;
|
|
5
|
+
imageModal: import("antd-style").SerializedStyles;
|
|
6
|
+
}>;
|
|
@@ -1,4 +1,40 @@
|
|
|
1
|
+
import * as __WEBPACK_EXTERNAL_MODULE_antd_style__ from "antd-style";
|
|
1
2
|
import * as __WEBPACK_EXTERNAL_MODULE__builtins_index_mjs__ from "../__builtins__/index.mjs";
|
|
3
|
+
function _tagged_template_literal(strings, raw) {
|
|
4
|
+
if (!raw) raw = strings.slice(0);
|
|
5
|
+
return Object.freeze(Object.defineProperties(strings, {
|
|
6
|
+
raw: {
|
|
7
|
+
value: Object.freeze(raw)
|
|
8
|
+
}
|
|
9
|
+
}));
|
|
10
|
+
}
|
|
11
|
+
function _templateObject() {
|
|
12
|
+
const data = _tagged_template_literal([
|
|
13
|
+
"\n .ant-modal-content {\n position: relative;\n overflow: hidden;\n border-radius: 16px;\n &::before,\n &::after {\n content: '';\n position: absolute;\n width: 300px;\n height: 300px;\n background: radial-gradient(circle, rgba(0, 149, 255, 0.11) 0%, transparent 70%);\n z-index: 0;\n pointer-events: none;\n }\n\n &::before {\n top: -165px;\n left: -10px;\n }\n\n &::after {\n bottom: -160px;\n right: -150px;\n }\n .ant-modal-header {\n text-align: center;\n margin-bottom: 20px;\n margin-top: 15px;\n .ant-modal-title {\n font-size: x-large;\n font-weight: 400;\n }\n }\n .ant-modal-body {\n justify-items: center;\n }\n }\n "
|
|
14
|
+
]);
|
|
15
|
+
_templateObject = function() {
|
|
16
|
+
return data;
|
|
17
|
+
};
|
|
18
|
+
return data;
|
|
19
|
+
}
|
|
20
|
+
function _templateObject1() {
|
|
21
|
+
const data = _tagged_template_literal([
|
|
22
|
+
"\n display: flex;\n justify-content: center;\n align-items: center;\n width: 100%;\n margin-top: 20px;\n margin-bottom: 40px;\n position: relative;\n gap: 20%;\n padding-left: 10%;\n padding-right: 10%;\n .tb-header-modal-list {\n width: 50%;\n gap: 10px;\n display: flex;\n flex-direction: column;\n justify-content: center;\n text-align: center;\n border: 1px solid transparent;\n border-color: rgba(203, 227, 254, 0.62);\n box-shadow: none;\n border-radius: 12px;\n padding: 16px;\n transition:\n box-shadow 0.2s ease,\n transform 0.2s ease;\n z-index: 1;\n position: relative;\n &:hover {\n border-color: rgba(0, 120, 255, 0.3);\n box-shadow: 0 4px 16px rgba(0, 120, 255, 0.15);\n }\n &:active {\n box-shadow: none;\n transform: translateY(2px);\n }\n .anticon {\n width: 100%;\n display: flex;\n justify-content: center;\n svg {\n width: 30px;\n height: 30px;\n }\n }\n .tb-header-modal-list-text {\n text-align: center;\n }\n }\n "
|
|
23
|
+
]);
|
|
24
|
+
_templateObject1 = function() {
|
|
25
|
+
return data;
|
|
26
|
+
};
|
|
27
|
+
return data;
|
|
28
|
+
}
|
|
29
|
+
function _templateObject2() {
|
|
30
|
+
const data = _tagged_template_literal([
|
|
31
|
+
"\n display: flex;\n justify-content: center;\n .ant-modal-content {\n width: 280px;\n height: 360px;\n }\n "
|
|
32
|
+
]);
|
|
33
|
+
_templateObject2 = function() {
|
|
34
|
+
return data;
|
|
35
|
+
};
|
|
36
|
+
return data;
|
|
37
|
+
}
|
|
2
38
|
const getStyles = (0, __WEBPACK_EXTERNAL_MODULE__builtins_index_mjs__.genStyleHook)('tb-page', (token)=>{
|
|
3
39
|
const { componentCls } = token;
|
|
4
40
|
return {
|
|
@@ -46,7 +82,14 @@ const getStyles = (0, __WEBPACK_EXTERNAL_MODULE__builtins_index_mjs__.genStyleHo
|
|
|
46
82
|
}
|
|
47
83
|
},
|
|
48
84
|
'.tb-page-header-wrapper': {
|
|
49
|
-
zIndex: 10
|
|
85
|
+
zIndex: 10,
|
|
86
|
+
'.ant-page-header-heading': {
|
|
87
|
+
justifyContent: 'start',
|
|
88
|
+
'.ant-btn': {
|
|
89
|
+
border: 'none',
|
|
90
|
+
boxShadow: 'none'
|
|
91
|
+
}
|
|
92
|
+
}
|
|
50
93
|
},
|
|
51
94
|
'.pageHeaderCss': {
|
|
52
95
|
backgroundColor: token.colorBgContainer,
|
|
@@ -126,8 +169,22 @@ const getStyles = (0, __WEBPACK_EXTERNAL_MODULE__builtins_index_mjs__.genStyleHo
|
|
|
126
169
|
paddingBottom: 0,
|
|
127
170
|
overflowX: 'hidden',
|
|
128
171
|
overflowY: 'scroll'
|
|
172
|
+
},
|
|
173
|
+
'.tb-page-header-button': {
|
|
174
|
+
flex: 1,
|
|
175
|
+
paddingTop: token.paddingMD,
|
|
176
|
+
paddingLeft: token.paddingMD,
|
|
177
|
+
border: 'none'
|
|
129
178
|
}
|
|
130
179
|
}
|
|
131
180
|
};
|
|
132
181
|
});
|
|
133
|
-
|
|
182
|
+
const useStyles = (0, __WEBPACK_EXTERNAL_MODULE_antd_style__.createStyles)((param)=>{
|
|
183
|
+
let { css, token } = param;
|
|
184
|
+
return {
|
|
185
|
+
firstmodal: css(_templateObject()),
|
|
186
|
+
secondmodal: css(_templateObject1()),
|
|
187
|
+
imageModal: css(_templateObject2())
|
|
188
|
+
};
|
|
189
|
+
});
|
|
190
|
+
export { getStyles, useStyles };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './slider';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./slider.mjs";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__ from "react/jsx-runtime";
|
|
2
|
+
import * as __WEBPACK_EXTERNAL_MODULE__tachybase_schema__ from "@tachybase/schema";
|
|
3
|
+
import * as __WEBPACK_EXTERNAL_MODULE_antd__ from "antd";
|
|
4
|
+
import * as __WEBPACK_EXTERNAL_MODULE__input_number_ReadPretty_mjs__ from "../input-number/ReadPretty.mjs";
|
|
5
|
+
const Slider = (0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema__.connect)((props)=>/*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)(__WEBPACK_EXTERNAL_MODULE_antd__.Slider, {
|
|
6
|
+
...props
|
|
7
|
+
}), (0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema__.mapProps)((props)=>({
|
|
8
|
+
...props
|
|
9
|
+
})), (0, __WEBPACK_EXTERNAL_MODULE__tachybase_schema__.mapReadPretty)(__WEBPACK_EXTERNAL_MODULE__input_number_ReadPretty_mjs__.ReadPretty));
|
|
10
|
+
const slider_rslib_entry_ = Slider;
|
|
11
|
+
export { Slider, slider_rslib_entry_ as default };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
type TrackedLinkProps = {
|
|
3
|
+
href: string;
|
|
4
|
+
trackingKey?: string;
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
target?: React.HTMLAttributeAnchorTarget;
|
|
7
|
+
rel?: string;
|
|
8
|
+
};
|
|
9
|
+
export declare const TrackingLink: React.FC<TrackedLinkProps>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import * as __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__ from "react/jsx-runtime";
|
|
2
|
+
import "react";
|
|
3
|
+
import * as __WEBPACK_EXTERNAL_MODULE__application_index_mjs__ from "../../../application/index.mjs";
|
|
4
|
+
import * as __WEBPACK_EXTERNAL_MODULE__user_index_mjs__ from "../../../user/index.mjs";
|
|
5
|
+
const TrackingLink = (param)=>{
|
|
6
|
+
let { href, trackingKey = 'link', children, target = '_blank', rel = 'noreferrer' } = param;
|
|
7
|
+
var _currentUserContext_data;
|
|
8
|
+
const app = (0, __WEBPACK_EXTERNAL_MODULE__application_index_mjs__.useApp)();
|
|
9
|
+
const currentUserContext = (0, __WEBPACK_EXTERNAL_MODULE__user_index_mjs__.useCurrentUserContext)();
|
|
10
|
+
const currentUser = null == currentUserContext ? void 0 : null === (_currentUserContext_data = currentUserContext.data) || void 0 === _currentUserContext_data ? void 0 : _currentUserContext_data.data;
|
|
11
|
+
const handleClick = ()=>{
|
|
12
|
+
app.trackingManager.logEvent('click', trackingKey, {
|
|
13
|
+
href,
|
|
14
|
+
UserId: null == currentUser ? void 0 : currentUser.id
|
|
15
|
+
});
|
|
16
|
+
};
|
|
17
|
+
return /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_react_jsx_runtime__.jsx)("a", {
|
|
18
|
+
href: href,
|
|
19
|
+
target: target,
|
|
20
|
+
rel: rel,
|
|
21
|
+
onClick: handleClick,
|
|
22
|
+
children: children
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
export { TrackingLink };
|
|
@@ -91,6 +91,7 @@ export declare const useFilterInheritsFormItemInitializerFields: (options?: any)
|
|
|
91
91
|
[x: string]: SchemaInitializerItemType[];
|
|
92
92
|
}[];
|
|
93
93
|
export declare const useCustomFormItemInitializerFields: (options?: any) => SchemaInitializerItemType[];
|
|
94
|
+
export declare const findSchema: (schema: Schema, key: string, action: string) => any;
|
|
94
95
|
export declare const useCurrentSchema: (action: string, key: string, find?: (schema: Schema, key: string, action: string) => any, rm?: (schema: any, cb: any) => any) => {
|
|
95
96
|
schema: any;
|
|
96
97
|
exists: boolean;
|
|
@@ -1377,4 +1377,4 @@ function useAssociationFields(param) {
|
|
|
1377
1377
|
t
|
|
1378
1378
|
]);
|
|
1379
1379
|
}
|
|
1380
|
-
export { createDetailsBlockSchema, createFormBlockSchema, createReadPrettyFormBlockSchema, createTableBlockSchema, findTableColumn, gridRowColWrap, itemsMerge, removeGridFormItem, removeTableColumn, useAssociatedFormItemInitializerFields, useAssociatedTableColumnInitializerFields, useCollectionDataSourceItems, useCurrentSchema, useCustomFormItemInitializerFields, useFilterAssociatedFormItemInitializerFields, useFilterFormItemInitializerFields, useFilterInheritsFormItemInitializerFields, useFormItemInitializerFields, useInheritsFormItemInitializerFields, useInheritsTableColumnInitializerFields, useRecordCollectionDataSourceItems, useRemoveGridFormItem, useTableColumnInitializerFields };
|
|
1380
|
+
export { createDetailsBlockSchema, createFormBlockSchema, createReadPrettyFormBlockSchema, createTableBlockSchema, findSchema, findTableColumn, gridRowColWrap, itemsMerge, removeGridFormItem, removeTableColumn, useAssociatedFormItemInitializerFields, useAssociatedTableColumnInitializerFields, useCollectionDataSourceItems, useCurrentSchema, useCustomFormItemInitializerFields, useFilterAssociatedFormItemInitializerFields, useFilterFormItemInitializerFields, useFilterInheritsFormItemInitializerFields, useFormItemInitializerFields, useInheritsFormItemInitializerFields, useInheritsTableColumnInitializerFields, useRecordCollectionDataSourceItems, useRemoveGridFormItem, useTableColumnInitializerFields };
|