@tachybase/client 1.3.20 → 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 (91) 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/collectionPlugin.mjs +36 -0
  10. package/es/collection-manager/interfaces/url.d.ts +4 -0
  11. package/es/collection-manager/interfaces/url.mjs +10 -1
  12. package/es/collection-manager/templates/sql.d.ts +3 -3
  13. package/es/collection-manager/templates/view.d.ts +3 -3
  14. package/es/data-source/collection-field-interface/CollectionFieldInterface.mjs +1 -15
  15. package/es/modules/blocks/data-blocks/form/fieldSettingsFormItem.mjs +1 -4
  16. package/es/modules/blocks/data-blocks/table/hooks/useTableBlockProps.mjs +14 -2
  17. package/es/modules/blocks/data-blocks/table/tableColumnSettings.mjs +1 -3
  18. package/es/modules/blocks/filter-blocks/collapse/filterCollapseItemFieldSettings.mjs +0 -4
  19. package/es/modules/blocks/filter-blocks/form/filterFormItemFieldSettings.mjs +0 -4
  20. package/es/modules/fields/component/CustomTitle/customTitleComponentFieldSettings.mjs +95 -5
  21. package/es/modules/fields/component/InputPreview/inputPreviewComponentFieldSettings.d.ts +2 -0
  22. package/es/modules/fields/component/InputPreview/inputPreviewComponentFieldSettings.mjs +99 -0
  23. package/es/modules/fields/component/MultipleSelect/multipleSelectComponentFieldSettings.d.ts +2 -0
  24. package/es/modules/fields/component/MultipleSelect/multipleSelectComponentFieldSettings.mjs +64 -0
  25. package/es/modules/fields/component/Radio/radioComponentFieldSettings.mjs +15 -2
  26. package/es/modules/fields/component/Select/selectComponentFieldSettings.mjs +26 -7
  27. package/es/schema-component/antd/association-field/InternalViewer.mjs +4 -58
  28. package/es/schema-component/antd/association-field/hooks.d.ts +4 -0
  29. package/es/schema-component/antd/association-field/hooks.mjs +52 -1
  30. package/es/schema-component/antd/input/Input.mjs +2 -1
  31. package/es/schema-component/antd/input/ReadPretty.d.ts +1 -0
  32. package/es/schema-component/antd/input/ReadPretty.mjs +29 -1
  33. package/es/schema-component/antd/page/Page.Settings.mjs +0 -33
  34. package/es/schema-component/antd/page/Page.mjs +46 -95
  35. package/es/schema-component/antd/page/hooks/index.d.ts +1 -1
  36. package/es/schema-component/antd/page/hooks/index.mjs +1 -1
  37. package/es/schema-component/antd/page/index.d.ts +1 -0
  38. package/es/schema-component/antd/page/index.mjs +1 -0
  39. package/es/schema-component/antd/page/pageExtendComponentProvider.d.ts +3 -0
  40. package/es/schema-component/antd/page/pageExtendComponentProvider.mjs +9 -0
  41. package/es/schema-component/antd/page/style.d.ts +0 -5
  42. package/es/schema-component/antd/page/style.mjs +1 -45
  43. package/es/schema-component/antd/select/FormulaSelect.mjs +16 -4
  44. package/es/schema-component/antd/select/ReadPretty.mjs +16 -3
  45. package/es/schema-component/antd/select/Select.mjs +6 -1
  46. package/es/schema-component/hooks/useFieldModeOptions.mjs +13 -10
  47. package/es/schema-settings/EditFormulaTitleField.mjs +19 -1
  48. package/es/schema-settings/SchemaSettingsPlugin.mjs +4 -0
  49. package/lib/application/Application.js +0 -8
  50. package/lib/application/components/index.js +0 -18
  51. package/lib/block-provider/hooks/index.js +1 -1
  52. package/lib/built-in/index.js +30 -4
  53. package/lib/collection-manager/collectionPlugin.js +36 -0
  54. package/lib/collection-manager/interfaces/url.js +10 -1
  55. package/lib/data-source/collection-field-interface/CollectionFieldInterface.js +1 -15
  56. package/lib/locale/zh-CN.js +1 -0
  57. package/lib/modules/blocks/data-blocks/form/fieldSettingsFormItem.js +0 -3
  58. package/lib/modules/blocks/data-blocks/table/hooks/useTableBlockProps.js +14 -2
  59. package/lib/modules/blocks/data-blocks/table/tableColumnSettings.js +1 -3
  60. package/lib/modules/blocks/filter-blocks/collapse/filterCollapseItemFieldSettings.js +0 -4
  61. package/lib/modules/blocks/filter-blocks/form/filterFormItemFieldSettings.js +0 -4
  62. package/lib/modules/fields/component/CustomTitle/customTitleComponentFieldSettings.js +93 -3
  63. package/lib/modules/fields/component/InputPreview/inputPreviewComponentFieldSettings.js +133 -0
  64. package/lib/modules/fields/component/MultipleSelect/multipleSelectComponentFieldSettings.js +98 -0
  65. package/lib/modules/fields/component/Radio/radioComponentFieldSettings.js +16 -3
  66. package/lib/modules/fields/component/Select/selectComponentFieldSettings.js +23 -4
  67. package/lib/schema-component/antd/association-field/InternalViewer.js +1 -55
  68. package/lib/schema-component/antd/association-field/hooks.js +54 -0
  69. package/lib/schema-component/antd/input/Input.js +2 -1
  70. package/lib/schema-component/antd/input/ReadPretty.js +28 -0
  71. package/lib/schema-component/antd/page/Page.Settings.js +0 -33
  72. package/lib/schema-component/antd/page/Page.js +41 -90
  73. package/lib/schema-component/antd/page/hooks/index.js +5 -5
  74. package/lib/schema-component/antd/page/index.js +9 -0
  75. package/lib/{application/components/ShareSchemaComponent.js → schema-component/antd/page/pageExtendComponentProvider.js} +15 -10
  76. package/lib/schema-component/antd/page/style.js +2 -49
  77. package/lib/schema-component/antd/select/FormulaSelect.js +16 -4
  78. package/lib/schema-component/antd/select/ReadPretty.js +15 -2
  79. package/lib/schema-component/antd/select/Select.js +6 -1
  80. package/lib/schema-component/hooks/useFieldModeOptions.js +13 -10
  81. package/lib/schema-settings/EditFormulaTitleField.js +19 -1
  82. package/lib/schema-settings/SchemaSettingsPlugin.js +4 -0
  83. package/package.json +7 -7
  84. package/es/application/components/SharePage.d.ts +0 -4
  85. package/es/application/components/SharePage.mjs +0 -113
  86. package/es/application/components/ShareSchemaComponent.d.ts +0 -1
  87. package/es/application/components/ShareSchemaComponent.mjs +0 -10
  88. package/es/schema-component/antd/page/hooks/useShareActions.d.ts +0 -7
  89. package/es/schema-component/antd/page/hooks/useShareActions.mjs +0 -242
  90. package/lib/application/components/SharePage.js +0 -156
  91. package/lib/schema-component/antd/page/hooks/useShareActions.js +0 -286
@@ -1,286 +0,0 @@
1
- "use strict";
2
- var __webpack_require__ = {};
3
- (()=>{
4
- __webpack_require__.n = (module)=>{
5
- var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
6
- __webpack_require__.d(getter, {
7
- a: getter
8
- });
9
- return getter;
10
- };
11
- })();
12
- (()=>{
13
- __webpack_require__.d = (exports1, definition)=>{
14
- for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
15
- enumerable: true,
16
- get: definition[key]
17
- });
18
- };
19
- })();
20
- (()=>{
21
- __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
22
- })();
23
- (()=>{
24
- __webpack_require__.r = (exports1)=>{
25
- if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
26
- value: 'Module'
27
- });
28
- Object.defineProperty(exports1, '__esModule', {
29
- value: true
30
- });
31
- };
32
- })();
33
- var __webpack_exports__ = {};
34
- __webpack_require__.r(__webpack_exports__);
35
- __webpack_require__.d(__webpack_exports__, {
36
- useShareActions: ()=>useShareActions
37
- });
38
- const jsx_runtime_namespaceObject = require("react/jsx-runtime");
39
- const external_react_namespaceObject = require("react");
40
- const schema_namespaceObject = require("@tachybase/schema");
41
- const external_antd_namespaceObject = require("antd");
42
- const external_qrcode_namespaceObject = require("qrcode");
43
- var external_qrcode_default = /*#__PURE__*/ __webpack_require__.n(external_qrcode_namespaceObject);
44
- const external_react_i18next_namespaceObject = require("react-i18next");
45
- const external_react_router_namespaceObject = require("react-router");
46
- const index_js_namespaceObject = require("../../../../block-provider/index.js");
47
- const external_index_js_namespaceObject = require("../../../index.js");
48
- const external_schema_settings_index_js_namespaceObject = require("../../../../schema-settings/index.js");
49
- const useShareActions = (param)=>{
50
- let { title, uid } = param;
51
- var _currentRoute_params;
52
- const fieldSchema = (0, schema_namespaceObject.useFieldSchema)();
53
- const isAdmin = (0, external_react_router_namespaceObject.useMatch)('/admin/:name');
54
- const isShare = (0, external_react_router_namespaceObject.useMatch)('/share/:name');
55
- const isMobile = (0, external_react_router_namespaceObject.useMatch)('/mobile/:name');
56
- const isMobilePage = (0, index_js_namespaceObject.useIsMobile)();
57
- const currentRoute = isAdmin || isShare || isMobile;
58
- const replaceLink = isMobilePage ? window.location.href.replace('/mobile', '/share') : window.location.href.replace('/admin', '/share');
59
- 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 || '', '');
60
- const { t } = (0, external_react_i18next_namespaceObject.useTranslation)();
61
- const [qrLink, setQrLink] = (0, external_react_namespaceObject.useState)();
62
- const compile = (0, external_index_js_namespaceObject.useCompile)();
63
- external_qrcode_default().toDataURL(link, {
64
- width: 170
65
- }, (err, url)=>{
66
- if (err) return void console.error(err);
67
- if (!qrLink) setQrLink(url);
68
- });
69
- const copyLink = ()=>{
70
- navigator.clipboard.writeText(link).then((res)=>{
71
- external_antd_namespaceObject.message.open({
72
- type: 'success',
73
- content: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(jsx_runtime_namespaceObject.Fragment, {
74
- children: [
75
- t('Replicated'),
76
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
77
- style: {
78
- color: '#3279FE'
79
- },
80
- children: compile(title || '')
81
- }),
82
- t('page link')
83
- ]
84
- })
85
- });
86
- });
87
- };
88
- const imageAction = ()=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(ImageModal, {
89
- link: qrLink,
90
- title: title
91
- });
92
- return {
93
- copyLink,
94
- imageAction
95
- };
96
- };
97
- const ImageModal = (props)=>{
98
- const { link, title } = props;
99
- const canvasRef = (0, external_react_namespaceObject.useRef)(null);
100
- const { t } = (0, external_react_i18next_namespaceObject.useTranslation)();
101
- const { currentUserCtx } = (0, external_schema_settings_index_js_namespaceObject.useCurrentUserVariable)();
102
- const compile = (0, external_index_js_namespaceObject.useCompile)();
103
- (0, external_react_namespaceObject.useEffect)(()=>{
104
- canvasContent(canvasRef, link, currentUserCtx, t);
105
- }, []);
106
- const saveImage = ()=>{
107
- const canvas = canvasRef.current;
108
- if (canvas) {
109
- const imageData = canvas.toDataURL('image/png');
110
- const link = document.createElement('a');
111
- link.href = imageData;
112
- link.download = 'Tachybase-Share.png';
113
- link.click();
114
- external_antd_namespaceObject.message.open({
115
- type: 'success',
116
- content: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(jsx_runtime_namespaceObject.Fragment, {
117
- children: [
118
- t('Saved'),
119
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
120
- style: {
121
- color: '#3279FE'
122
- },
123
- children: compile(title || '')
124
- }),
125
- t('QR code')
126
- ]
127
- })
128
- });
129
- }
130
- };
131
- const copyImage = ()=>{
132
- const canvas = canvasRef.current;
133
- if (canvas && navigator.clipboard) canvas.toBlob(async (blob)=>{
134
- if (!blob) return;
135
- try {
136
- const item = new ClipboardItem({
137
- 'image/png': blob
138
- });
139
- await navigator.clipboard.write([
140
- item
141
- ]);
142
- external_antd_namespaceObject.message.open({
143
- type: 'success',
144
- content: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(jsx_runtime_namespaceObject.Fragment, {
145
- children: [
146
- t('Replicated'),
147
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
148
- style: {
149
- color: '#3279FE'
150
- },
151
- children: compile(title || '')
152
- }),
153
- t('QR code')
154
- ]
155
- })
156
- });
157
- } catch (err) {
158
- external_antd_namespaceObject.message.error(t('Copy failed, please try again'));
159
- }
160
- }, 'image/png');
161
- };
162
- return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
163
- style: {
164
- marginTop: '23px',
165
- display: 'flex',
166
- flexDirection: 'column',
167
- justifyContent: 'center',
168
- alignItems: 'center'
169
- },
170
- children: [
171
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("canvas", {
172
- ref: canvasRef,
173
- width: 240,
174
- height: 260,
175
- style: {
176
- width: '240px',
177
- height: '260px',
178
- pointerEvents: 'none'
179
- }
180
- }),
181
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
182
- style: {
183
- width: '100%',
184
- display: 'flex',
185
- justifyContent: 'space-between',
186
- marginTop: '10px',
187
- gap: '15px'
188
- },
189
- children: [
190
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.Button, {
191
- onClick: saveImage,
192
- style: {
193
- flex: 1
194
- },
195
- children: t('Save Picture')
196
- }),
197
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.Button, {
198
- onClick: copyImage,
199
- style: {
200
- flex: 1
201
- },
202
- children: t('Copy QR code')
203
- })
204
- ]
205
- })
206
- ]
207
- });
208
- };
209
- const canvasContent = (canvasRef, link, currentUserCtx, t)=>{
210
- const canvas = canvasRef.current;
211
- const ctx = canvas.getContext('2d');
212
- const dpr = window.devicePixelRatio;
213
- const { width, height } = canvas;
214
- canvas.width = Math.round(width * dpr);
215
- canvas.height = Math.round(height * dpr);
216
- canvas.style.width = width + 'px';
217
- canvas.style.height = height + 'px';
218
- ctx.scale(dpr, dpr);
219
- ctx.filter = 'blur(20px)';
220
- const backgroundGradient = ctx.createLinearGradient(0, 0, canvas.width, canvas.height);
221
- backgroundGradient.addColorStop(0, 'rgba(255, 255, 255, 1)');
222
- backgroundGradient.addColorStop(1, 'rgba(234, 238, 246, 0.80)');
223
- ctx.fillStyle = backgroundGradient;
224
- ctx.fillRect(0, 0, canvas.width, canvas.height);
225
- const drawGlow = (x, y)=>{
226
- const radius = 100;
227
- const gradient = ctx.createRadialGradient(x, y, 0, x, y, radius);
228
- gradient.addColorStop(0, 'rgba(255, 255, 255, 1)');
229
- gradient.addColorStop(1, 'rgba(217, 238, 255, 0.216)');
230
- ctx.fillStyle = gradient;
231
- ctx.beginPath();
232
- ctx.arc(x, y, radius, 0, 2 * Math.PI);
233
- ctx.fill();
234
- };
235
- drawGlow(60, 30);
236
- drawGlow(190, 280);
237
- ctx.filter = 'none';
238
- ctx.fillStyle = '#AAAAAA';
239
- ctx.font = '13px Arial';
240
- ctx.textAlign = 'center';
241
- ctx.fillText("".concat(currentUserCtx.nickname), canvas.width / 4, 30);
242
- const img = new Image();
243
- img.src = link;
244
- img.onload = ()=>{
245
- const imgWidth = img.width;
246
- const imgHeight = img.height;
247
- const x = (canvas.width - imgWidth) / 8;
248
- const y = 40;
249
- const borderWidth = 3;
250
- const borderRadius = 20;
251
- ctx.beginPath();
252
- ctx.moveTo(x + borderRadius, y);
253
- ctx.arcTo(x + imgWidth, y, x + imgWidth, y + imgHeight, borderRadius);
254
- ctx.arcTo(x + imgWidth, y + imgHeight, x, y + imgHeight, borderRadius);
255
- ctx.arcTo(x, y + imgHeight, x, y, borderRadius);
256
- ctx.arcTo(x, y, x + imgWidth, y, borderRadius);
257
- ctx.closePath();
258
- ctx.clip();
259
- ctx.drawImage(img, x + borderWidth, y + borderWidth, imgWidth - 2 * borderWidth, imgHeight - 2 * borderWidth);
260
- ctx.lineWidth = borderWidth;
261
- ctx.strokeStyle = '#000';
262
- ctx.beginPath();
263
- ctx.moveTo(x + borderRadius, y);
264
- ctx.arcTo(x + imgWidth, y, x + imgWidth, y + imgHeight, borderRadius);
265
- ctx.arcTo(x + imgWidth, y + imgHeight, x, y + imgHeight, borderRadius);
266
- ctx.arcTo(x, y + imgHeight, x, y, borderRadius);
267
- ctx.arcTo(x, y, x + imgWidth, y, borderRadius);
268
- ctx.closePath();
269
- ctx.stroke();
270
- };
271
- ctx.fillStyle = '#AAAAAA';
272
- ctx.font = '13px Arial';
273
- ctx.textAlign = 'center';
274
- ctx.fillText(t('Scan the code to view the sharing'), canvas.width / 4, 230);
275
- ctx.fillStyle = 'rgba(50, 121, 254, 1)';
276
- ctx.font = '14px Arial';
277
- ctx.textAlign = 'center';
278
- ctx.fillText("\u7075\u77F6(Tachybase)", canvas.width / 4, 250);
279
- };
280
- exports.useShareActions = __webpack_exports__.useShareActions;
281
- for(var __webpack_i__ in __webpack_exports__)if (-1 === [
282
- "useShareActions"
283
- ].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
284
- Object.defineProperty(exports, '__esModule', {
285
- value: true
286
- });