@tachybase/plugin-action-share 1.3.24 → 1.4.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/dist/client/collection/sharePageConfig.d.ts +220 -0
- package/dist/client/component/ShareButton.d.ts +2 -0
- package/dist/client/component/ShareConfigFrom.d.ts +2 -0
- package/dist/client/component/VerifyModal.d.ts +1 -0
- package/dist/client/component/style.d.ts +13 -0
- package/dist/client/hook/useShareActions.d.ts +3 -6
- package/dist/client/hook/useShareVisible.d.ts +1 -0
- package/dist/client/index.js +229 -81
- package/dist/client/mobile/component/style.d.ts +1 -2
- package/dist/client/provider/shareModelProvider.d.ts +24 -0
- package/dist/client/provider/sharePageProvider.d.ts +7 -0
- package/dist/externalVersion.js +4 -3
- package/dist/locale/zh-CN.json +16 -0
- package/dist/server/actions/share.d.ts +2 -0
- package/dist/server/actions/share.js +39 -0
- package/dist/server/collections/rolesShareUiSchemas.d.ts +2 -0
- package/dist/server/collections/rolesShareUiSchemas.js +27 -0
- package/dist/server/collections/sharePage.d.ts +2 -0
- package/dist/server/collections/sharePage.js +44 -0
- package/dist/server/collections/sharePageConfig.d.ts +2 -0
- package/dist/server/collections/sharePageConfig.js +68 -0
- package/dist/server/middlewares/share-acl-action.d.ts +1 -0
- package/dist/server/middlewares/share-acl-action.js +67 -0
- package/dist/server/plugin.js +18 -1
- package/package.json +8 -7
package/dist/client/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(U,m){typeof exports=="object"&&typeof module!="undefined"?m(exports,require("@tachybase/client"),require("react-router"),require("react/jsx-runtime"),require("react"),require("@tachybase/schema"),require("@ant-design/icons"),require("antd"),require("dayjs"),require("antd-style"),require("@emotion/css"),require("react-router-dom")):typeof define=="function"&&define.amd?define(["exports","@tachybase/client","react-router","react/jsx-runtime","react","@tachybase/schema","@ant-design/icons","antd","dayjs","antd-style","@emotion/css","react-router-dom"],m):(U=typeof globalThis!="undefined"?globalThis:U||self,m(U["@tachybase/plugin-action-share"]={},U["@tachybase/client"],U["react-router"],U.jsxRuntime,U.react,U["@tachybase/schema"],U["@ant-design/icons"],U.antd,U.dayjs,U["antd-style"],U["@emotion/css"],U["react-router-dom"]))})(this,function(U,m,q,c,D,W,K,B,_,z,Bt,At){"use strict";var vn=Object.defineProperty,Pn=Object.defineProperties;var En=Object.getOwnPropertyDescriptors;var Et=Object.getOwnPropertySymbols;var Tn=Object.prototype.hasOwnProperty,Bn=Object.prototype.propertyIsEnumerable;var Tt=(U,m,q)=>m in U?vn(U,m,{enumerable:!0,configurable:!0,writable:!0,value:q}):U[m]=q,F=(U,m)=>{for(var q in m||(m={}))Tn.call(m,q)&&Tt(U,q,m[q]);if(Et)for(var q of Et(m))Bn.call(m,q)&&Tt(U,q,m[q]);return U},V=(U,m)=>Pn(U,En(m));var ne=(U,m,q)=>new Promise((c,D)=>{var W=_=>{try{B(q.next(_))}catch(z){D(z)}},K=_=>{try{B(q.throw(_))}catch(z){D(z)}},B=_=>_.done?c(_.value):Promise.resolve(_.value).then(W,K);B((q=q.apply(U,m)).next())});const kt=z.createStyles(({css:n,token:r})=>({layout:n`
|
|
2
2
|
display: flex;
|
|
3
3
|
flex-direction: column;
|
|
4
4
|
height: 100vh;
|
|
@@ -7,21 +7,21 @@
|
|
|
7
7
|
.ant-menu.ant-menu-dark .ant-menu-item-selected,
|
|
8
8
|
.ant-menu-submenu-popup.ant-menu-dark .ant-menu-item-selected,
|
|
9
9
|
.ant-menu-submenu-horizontal.ant-menu-submenu-selected {
|
|
10
|
-
background-color: ${
|
|
11
|
-
color: ${
|
|
10
|
+
background-color: ${r.colorBgHeaderMenuActive} !important;
|
|
11
|
+
color: ${r.colorTextHeaderMenuActive} !important;
|
|
12
12
|
}
|
|
13
13
|
.ant-menu-submenu-horizontal.ant-menu-submenu-selected > .ant-menu-submenu-title {
|
|
14
|
-
color: ${
|
|
14
|
+
color: ${r.colorTextHeaderMenuActive} !important;
|
|
15
15
|
}
|
|
16
16
|
.ant-menu-dark.ant-menu-horizontal > .ant-menu-item:hover {
|
|
17
|
-
background-color: ${
|
|
18
|
-
color: ${
|
|
17
|
+
background-color: ${r.colorBgHeaderMenuHover} !important;
|
|
18
|
+
color: ${r.colorTextHeaderMenuHover} !important;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
height: var(--tb-header-height);
|
|
22
22
|
line-height: var(--tb-header-height);
|
|
23
23
|
padding: 0;
|
|
24
|
-
background-color: ${
|
|
24
|
+
background-color: ${r.colorBgHeader} !important;
|
|
25
25
|
|
|
26
26
|
.ant-menu {
|
|
27
27
|
background-color: transparent;
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
|
|
30
30
|
.ant-menu-item,
|
|
31
31
|
.ant-menu-submenu-horizontal {
|
|
32
|
-
color: ${
|
|
32
|
+
color: ${r.colorTextHeaderMenu} !important;
|
|
33
33
|
}
|
|
34
34
|
`,headerA:n`
|
|
35
35
|
position: relative;
|
|
@@ -102,11 +102,11 @@
|
|
|
102
102
|
z-index: 0;
|
|
103
103
|
padding: 0px 50px;
|
|
104
104
|
}
|
|
105
|
-
`})),
|
|
105
|
+
`})),re=z.createStyles(({css:n,token:r})=>({firstmodal:n`
|
|
106
106
|
.ant-modal-content {
|
|
107
107
|
position: relative;
|
|
108
108
|
overflow: hidden;
|
|
109
|
-
border-radius:
|
|
109
|
+
border-radius: ${r.borderRadius};
|
|
110
110
|
&::before,
|
|
111
111
|
&::after {
|
|
112
112
|
content: '';
|
|
@@ -127,17 +127,52 @@
|
|
|
127
127
|
bottom: -160px;
|
|
128
128
|
right: -150px;
|
|
129
129
|
}
|
|
130
|
-
.ant-modal-header {
|
|
131
|
-
text-align: center;
|
|
132
|
-
margin-bottom: 20px;
|
|
133
|
-
margin-top: 15px;
|
|
134
|
-
.ant-modal-title {
|
|
135
|
-
font-size: x-large;
|
|
136
|
-
font-weight: 400;
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
130
|
.ant-modal-body {
|
|
140
131
|
justify-items: center;
|
|
132
|
+
.modal-title {
|
|
133
|
+
width: 100%;
|
|
134
|
+
position: relative;
|
|
135
|
+
.title {
|
|
136
|
+
flex: 1;
|
|
137
|
+
text-align: center;
|
|
138
|
+
font-size: x-large;
|
|
139
|
+
font-weight: 400;
|
|
140
|
+
|
|
141
|
+
.history-title {
|
|
142
|
+
font-weight: normal;
|
|
143
|
+
text-align: left;
|
|
144
|
+
font-size: 1rem;
|
|
145
|
+
display: flex;
|
|
146
|
+
padding: 0 20px;
|
|
147
|
+
margin-bottom: 5px;
|
|
148
|
+
margin-top: 15px;
|
|
149
|
+
.anticon {
|
|
150
|
+
padding: 0 5px 0 5px;
|
|
151
|
+
&:hover {
|
|
152
|
+
background-color: #ebebeb;
|
|
153
|
+
cursor: pointer;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
.share-title {
|
|
158
|
+
margin-bottom: 20px;
|
|
159
|
+
margin-top: 15px;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
.modalIcon {
|
|
163
|
+
position: absolute;
|
|
164
|
+
top: -20px;
|
|
165
|
+
right: 0;
|
|
166
|
+
.anticon {
|
|
167
|
+
font-size: 18px;
|
|
168
|
+
padding: 8px;
|
|
169
|
+
&:hover {
|
|
170
|
+
background-color: #ebebeb;
|
|
171
|
+
cursor: pointer;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
141
176
|
}
|
|
142
177
|
}
|
|
143
178
|
`,secondmodal:n`
|
|
@@ -196,14 +231,121 @@
|
|
|
196
231
|
width: 280px;
|
|
197
232
|
height: 360px;
|
|
198
233
|
}
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
234
|
+
`,historyModal:n`
|
|
235
|
+
.ant-modal-content {
|
|
236
|
+
padding-left: 0;
|
|
237
|
+
padding-right: 0;
|
|
238
|
+
&::before,
|
|
239
|
+
&::after {
|
|
240
|
+
background: none;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
`})),De=z.createStyles(({css:n,token:r})=>({form:n`
|
|
244
|
+
margin: 0;
|
|
245
|
+
.ant-picker {
|
|
246
|
+
width: 100%;
|
|
247
|
+
}
|
|
248
|
+
.setPassWord {
|
|
249
|
+
width: 100%;
|
|
250
|
+
}
|
|
251
|
+
.password {
|
|
252
|
+
display: flex;
|
|
253
|
+
.ant-btn {
|
|
254
|
+
border: none;
|
|
255
|
+
color: #2196f4;
|
|
256
|
+
box-shadow: none;
|
|
257
|
+
background-color: rgb(0 0 0 / 0%);
|
|
258
|
+
}
|
|
259
|
+
.pw-cancel {
|
|
260
|
+
color: #c1c1c1;
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
`,collapse:n`
|
|
264
|
+
width: 100%;
|
|
265
|
+
background-color: rgb(0 0 0 / 0%);
|
|
266
|
+
.ant-collapse-header-text {
|
|
267
|
+
text-align: right;
|
|
268
|
+
}
|
|
269
|
+
.submit {
|
|
270
|
+
width: 100%;
|
|
271
|
+
}
|
|
272
|
+
`,datePickFooter:n`
|
|
273
|
+
display: flex;
|
|
274
|
+
justify-content: space-between;
|
|
275
|
+
align-items: center;
|
|
276
|
+
`})),It=z.createStyles(({css:n,token:r})=>({modal:n`
|
|
277
|
+
.ant-modal-content {
|
|
278
|
+
position: relative;
|
|
279
|
+
overflow: hidden;
|
|
280
|
+
border-radius: ${(r==null?void 0:r.borderRadius)||"0px"};
|
|
281
|
+
&::before,
|
|
282
|
+
&::after {
|
|
283
|
+
content: '';
|
|
284
|
+
position: absolute;
|
|
285
|
+
width: 300px;
|
|
286
|
+
height: 300px;
|
|
287
|
+
background: radial-gradient(circle, rgba(0, 149, 255, 0.11) 0%, transparent 70%);
|
|
288
|
+
z-index: 0;
|
|
289
|
+
pointer-events: none;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
&::before {
|
|
293
|
+
top: -165px;
|
|
294
|
+
left: -10px;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
&::after {
|
|
298
|
+
bottom: -160px;
|
|
299
|
+
right: -150px;
|
|
300
|
+
}
|
|
301
|
+
.ant-modal-body {
|
|
302
|
+
color: #747474;
|
|
303
|
+
padding: 30px 0 10px 0;
|
|
304
|
+
.ant-input {
|
|
305
|
+
border-radius: ${(r==null?void 0:r.borderRadius)||"0px"};
|
|
306
|
+
}
|
|
307
|
+
.error {
|
|
308
|
+
color: red;
|
|
309
|
+
margin-top: 5px;
|
|
310
|
+
.anticon {
|
|
311
|
+
margin-right: 5px;
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
.shareTime {
|
|
315
|
+
margin-top: 30px;
|
|
316
|
+
text-align: right;
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
`})),Ue=z.createStyles(({css:n,token:r})=>({collapse:n`
|
|
321
|
+
width: 100%;
|
|
322
|
+
max-height: 70vh;
|
|
323
|
+
overflow-y: scroll;
|
|
324
|
+
padding: 20px;
|
|
325
|
+
.ant-collapse {
|
|
326
|
+
border-radius: ${(r==null?void 0:r.borderRadius)||"0px"};
|
|
327
|
+
.ant-collapse-header {
|
|
328
|
+
display: flex;
|
|
329
|
+
justify-content: space-between;
|
|
330
|
+
flex-wrap: wrap;
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
`,collapseExtra:n`
|
|
334
|
+
.anticon {
|
|
335
|
+
padding: 5px;
|
|
336
|
+
&:hover {
|
|
337
|
+
background-color: #ebebeb;
|
|
338
|
+
cursor: pointer;
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
`}));function Mt(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Q={},oe,qe;function Nt(){return qe||(qe=1,oe=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}),oe}var ae={},j={},Fe;function J(){if(Fe)return j;Fe=1;let n;const r=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];return j.getSymbolSize=function(o){if(!o)throw new Error('"version" cannot be null or undefined');if(o<1||o>40)throw new Error('"version" should be in range from 1 to 40');return o*4+17},j.getSymbolTotalCodewords=function(o){return r[o]},j.getBCHDigit=function(a){let o=0;for(;a!==0;)o++,a>>>=1;return o},j.setToSJISFunction=function(o){if(typeof o!="function")throw new Error('"toSJISFunc" is not a valid function.');n=o},j.isKanjiModeEnabled=function(){return typeof n!="undefined"},j.toSJIS=function(o){return n(o)},j}var ie={},Ve;function se(){return Ve||(Ve=1,function(n){n.L={bit:1},n.M={bit:0},n.Q={bit:3},n.H={bit:2};function r(a){if(typeof a!="string")throw new Error("Param is not a string");switch(a.toLowerCase()){case"l":case"low":return n.L;case"m":case"medium":return n.M;case"q":case"quartile":return n.Q;case"h":case"high":return n.H;default:throw new Error("Unknown EC Level: "+a)}}n.isValid=function(o){return o&&typeof o.bit!="undefined"&&o.bit>=0&&o.bit<4},n.from=function(o,e){if(n.isValid(o))return o;try{return r(o)}catch(t){return e}}}(ie)),ie}var le,_e;function Lt(){if(_e)return le;_e=1;function n(){this.buffer=[],this.length=0}return n.prototype={get:function(r){const a=Math.floor(r/8);return(this.buffer[a]>>>7-r%8&1)===1},put:function(r,a){for(let o=0;o<a;o++)this.putBit((r>>>a-o-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(r){const a=Math.floor(this.length/8);this.buffer.length<=a&&this.buffer.push(0),r&&(this.buffer[a]|=128>>>this.length%8),this.length++}},le=n,le}var ce,ze;function Dt(){if(ze)return ce;ze=1;function n(r){if(!r||r<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=r,this.data=new Uint8Array(r*r),this.reservedBit=new Uint8Array(r*r)}return n.prototype.set=function(r,a,o,e){const t=r*this.size+a;this.data[t]=o,e&&(this.reservedBit[t]=!0)},n.prototype.get=function(r,a){return this.data[r*this.size+a]},n.prototype.xor=function(r,a,o){this.data[r*this.size+a]^=o},n.prototype.isReserved=function(r,a){return this.reservedBit[r*this.size+a]},ce=n,ce}var ue={},Oe;function Ut(){return Oe||(Oe=1,function(n){const r=J().getSymbolSize;n.getRowColCoords=function(o){if(o===1)return[];const e=Math.floor(o/7)+2,t=r(o),i=t===145?26:Math.ceil((t-13)/(2*e-2))*2,l=[t-7];for(let s=1;s<e-1;s++)l[s]=l[s-1]-i;return l.push(6),l.reverse()},n.getPositions=function(o){const e=[],t=n.getRowColCoords(o),i=t.length;for(let l=0;l<i;l++)for(let s=0;s<i;s++)l===0&&s===0||l===0&&s===i-1||l===i-1&&s===0||e.push([t[l],t[s]]);return e}}(ue)),ue}var de={},$e;function qt(){if($e)return de;$e=1;const n=J().getSymbolSize,r=7;return de.getPositions=function(o){const e=n(o);return[[0,0],[e-r,0],[0,e-r]]},de}var he={},He;function Ft(){return He||(He=1,function(n){n.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};const r={N1:3,N2:3,N3:40,N4:10};n.isValid=function(e){return e!=null&&e!==""&&!isNaN(e)&&e>=0&&e<=7},n.from=function(e){return n.isValid(e)?parseInt(e,10):void 0},n.getPenaltyN1=function(e){const t=e.size;let i=0,l=0,s=0,d=null,p=null;for(let y=0;y<t;y++){l=s=0,d=p=null;for(let h=0;h<t;h++){let u=e.get(y,h);u===d?l++:(l>=5&&(i+=r.N1+(l-5)),d=u,l=1),u=e.get(h,y),u===p?s++:(s>=5&&(i+=r.N1+(s-5)),p=u,s=1)}l>=5&&(i+=r.N1+(l-5)),s>=5&&(i+=r.N1+(s-5))}return i},n.getPenaltyN2=function(e){const t=e.size;let i=0;for(let l=0;l<t-1;l++)for(let s=0;s<t-1;s++){const d=e.get(l,s)+e.get(l,s+1)+e.get(l+1,s)+e.get(l+1,s+1);(d===4||d===0)&&i++}return i*r.N2},n.getPenaltyN3=function(e){const t=e.size;let i=0,l=0,s=0;for(let d=0;d<t;d++){l=s=0;for(let p=0;p<t;p++)l=l<<1&2047|e.get(d,p),p>=10&&(l===1488||l===93)&&i++,s=s<<1&2047|e.get(p,d),p>=10&&(s===1488||s===93)&&i++}return i*r.N3},n.getPenaltyN4=function(e){let t=0;const i=e.data.length;for(let s=0;s<i;s++)t+=e.data[s];return Math.abs(Math.ceil(t*100/i/5)-10)*r.N4};function a(o,e,t){switch(o){case n.Patterns.PATTERN000:return(e+t)%2===0;case n.Patterns.PATTERN001:return e%2===0;case n.Patterns.PATTERN010:return t%3===0;case n.Patterns.PATTERN011:return(e+t)%3===0;case n.Patterns.PATTERN100:return(Math.floor(e/2)+Math.floor(t/3))%2===0;case n.Patterns.PATTERN101:return e*t%2+e*t%3===0;case n.Patterns.PATTERN110:return(e*t%2+e*t%3)%2===0;case n.Patterns.PATTERN111:return(e*t%3+(e+t)%2)%2===0;default:throw new Error("bad maskPattern:"+o)}}n.applyMask=function(e,t){const i=t.size;for(let l=0;l<i;l++)for(let s=0;s<i;s++)t.isReserved(s,l)||t.xor(s,l,a(e,s,l))},n.getBestMask=function(e,t){const i=Object.keys(n.Patterns).length;let l=0,s=1/0;for(let d=0;d<i;d++){t(d),n.applyMask(d,e);const p=n.getPenaltyN1(e)+n.getPenaltyN2(e)+n.getPenaltyN3(e)+n.getPenaltyN4(e);n.applyMask(d,e),p<s&&(s=p,l=d)}return l}}(he)),he}var ee={},je;function Ye(){if(je)return ee;je=1;const n=se(),r=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],a=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];return ee.getBlocksCount=function(e,t){switch(t){case n.L:return r[(e-1)*4+0];case n.M:return r[(e-1)*4+1];case n.Q:return r[(e-1)*4+2];case n.H:return r[(e-1)*4+3];default:return}},ee.getTotalCodewordsCount=function(e,t){switch(t){case n.L:return a[(e-1)*4+0];case n.M:return a[(e-1)*4+1];case n.Q:return a[(e-1)*4+2];case n.H:return a[(e-1)*4+3];default:return}},ee}var fe={},Z={},Ke;function Vt(){if(Ke)return Z;Ke=1;const n=new Uint8Array(512),r=new Uint8Array(256);return function(){let o=1;for(let e=0;e<255;e++)n[e]=o,r[o]=e,o<<=1,o&256&&(o^=285);for(let e=255;e<512;e++)n[e]=n[e-255]}(),Z.log=function(o){if(o<1)throw new Error("log("+o+")");return r[o]},Z.exp=function(o){return n[o]},Z.mul=function(o,e){return o===0||e===0?0:n[r[o]+r[e]]},Z}var Je;function _t(){return Je||(Je=1,function(n){const r=Vt();n.mul=function(o,e){const t=new Uint8Array(o.length+e.length-1);for(let i=0;i<o.length;i++)for(let l=0;l<e.length;l++)t[i+l]^=r.mul(o[i],e[l]);return t},n.mod=function(o,e){let t=new Uint8Array(o);for(;t.length-e.length>=0;){const i=t[0];for(let s=0;s<e.length;s++)t[s]^=r.mul(e[s],i);let l=0;for(;l<t.length&&t[l]===0;)l++;t=t.slice(l)}return t},n.generateECPolynomial=function(o){let e=new Uint8Array([1]);for(let t=0;t<o;t++)e=n.mul(e,new Uint8Array([1,r.exp(t)]));return e}}(fe)),fe}var ge,Ge;function zt(){if(Ge)return ge;Ge=1;const n=_t();function r(a){this.genPoly=void 0,this.degree=a,this.degree&&this.initialize(this.degree)}return r.prototype.initialize=function(o){this.degree=o,this.genPoly=n.generateECPolynomial(this.degree)},r.prototype.encode=function(o){if(!this.genPoly)throw new Error("Encoder not initialized");const e=new Uint8Array(o.length+this.degree);e.set(o);const t=n.mod(e,this.genPoly),i=this.degree-t.length;if(i>0){const l=new Uint8Array(this.degree);return l.set(t,i),l}return t},ge=r,ge}var pe={},me={},ye={},Qe;function Re(){return Qe||(Qe=1,ye.isValid=function(r){return!isNaN(r)&&r>=1&&r<=40}),ye}var O={},We;function Ze(){if(We)return O;We=1;const n="[0-9]+",r="[A-Z $%*+\\-./:]+";let a="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";a=a.replace(/u/g,"\\u");const o="(?:(?![A-Z0-9 $%*+\\-./:]|"+a+`)(?:.|[\r
|
|
342
|
+
]))+`;O.KANJI=new RegExp(a,"g"),O.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),O.BYTE=new RegExp(o,"g"),O.NUMERIC=new RegExp(n,"g"),O.ALPHANUMERIC=new RegExp(r,"g");const e=new RegExp("^"+a+"$"),t=new RegExp("^"+n+"$"),i=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");return O.testKanji=function(s){return e.test(s)},O.testNumeric=function(s){return t.test(s)},O.testAlphanumeric=function(s){return i.test(s)},O}var Xe;function G(){return Xe||(Xe=1,function(n){const r=Re(),a=Ze();n.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},n.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},n.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},n.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},n.MIXED={bit:-1},n.getCharCountIndicator=function(t,i){if(!t.ccBits)throw new Error("Invalid mode: "+t);if(!r.isValid(i))throw new Error("Invalid version: "+i);return i>=1&&i<10?t.ccBits[0]:i<27?t.ccBits[1]:t.ccBits[2]},n.getBestModeForData=function(t){return a.testNumeric(t)?n.NUMERIC:a.testAlphanumeric(t)?n.ALPHANUMERIC:a.testKanji(t)?n.KANJI:n.BYTE},n.toString=function(t){if(t&&t.id)return t.id;throw new Error("Invalid mode")},n.isValid=function(t){return t&&t.bit&&t.ccBits};function o(e){if(typeof e!="string")throw new Error("Param is not a string");switch(e.toLowerCase()){case"numeric":return n.NUMERIC;case"alphanumeric":return n.ALPHANUMERIC;case"kanji":return n.KANJI;case"byte":return n.BYTE;default:throw new Error("Unknown mode: "+e)}}n.from=function(t,i){if(n.isValid(t))return t;try{return o(t)}catch(l){return i}}}(me)),me}var et;function Ot(){return et||(et=1,function(n){const r=J(),a=Ye(),o=se(),e=G(),t=Re(),i=7973,l=r.getBCHDigit(i);function s(h,u,f){for(let g=1;g<=40;g++)if(u<=n.getCapacity(g,f,h))return g}function d(h,u){return e.getCharCountIndicator(h,u)+4}function p(h,u){let f=0;return h.forEach(function(g){const I=d(g.mode,u);f+=I+g.getBitsLength()}),f}function y(h,u){for(let f=1;f<=40;f++)if(p(h,f)<=n.getCapacity(f,u,e.MIXED))return f}n.from=function(u,f){return t.isValid(u)?parseInt(u,10):f},n.getCapacity=function(u,f,g){if(!t.isValid(u))throw new Error("Invalid QR Code version");typeof g=="undefined"&&(g=e.BYTE);const I=r.getSymbolTotalCodewords(u),x=a.getTotalCodewordsCount(u,f),M=(I-x)*8;if(g===e.MIXED)return M;const b=M-d(g,u);switch(g){case e.NUMERIC:return Math.floor(b/10*3);case e.ALPHANUMERIC:return Math.floor(b/11*2);case e.KANJI:return Math.floor(b/13);case e.BYTE:default:return Math.floor(b/8)}},n.getBestVersionForData=function(u,f){let g;const I=o.from(f,o.M);if(Array.isArray(u)){if(u.length>1)return y(u,I);if(u.length===0)return 1;g=u[0]}else g=u;return s(g.mode,g.getLength(),I)},n.getEncodedBits=function(u){if(!t.isValid(u)||u<7)throw new Error("Invalid QR Code version");let f=u<<12;for(;r.getBCHDigit(f)-l>=0;)f^=i<<r.getBCHDigit(f)-l;return u<<12|f}}(pe)),pe}var be={},tt;function $t(){if(tt)return be;tt=1;const n=J(),r=1335,a=21522,o=n.getBCHDigit(r);return be.getEncodedBits=function(t,i){const l=t.bit<<3|i;let s=l<<10;for(;n.getBCHDigit(s)-o>=0;)s^=r<<n.getBCHDigit(s)-o;return(l<<10|s)^a},be}var we={},Ce,nt;function Ht(){if(nt)return Ce;nt=1;const n=G();function r(a){this.mode=n.NUMERIC,this.data=a.toString()}return r.getBitsLength=function(o){return 10*Math.floor(o/3)+(o%3?o%3*3+1:0)},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(o){let e,t,i;for(e=0;e+3<=this.data.length;e+=3)t=this.data.substr(e,3),i=parseInt(t,10),o.put(i,10);const l=this.data.length-e;l>0&&(t=this.data.substr(e),i=parseInt(t,10),o.put(i,l*3+1))},Ce=r,Ce}var xe,rt;function jt(){if(rt)return xe;rt=1;const n=G(),r=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function a(o){this.mode=n.ALPHANUMERIC,this.data=o}return a.getBitsLength=function(e){return 11*Math.floor(e/2)+6*(e%2)},a.prototype.getLength=function(){return this.data.length},a.prototype.getBitsLength=function(){return a.getBitsLength(this.data.length)},a.prototype.write=function(e){let t;for(t=0;t+2<=this.data.length;t+=2){let i=r.indexOf(this.data[t])*45;i+=r.indexOf(this.data[t+1]),e.put(i,11)}this.data.length%2&&e.put(r.indexOf(this.data[t]),6)},xe=a,xe}var Se,ot;function Yt(){if(ot)return Se;ot=1;const n=G();function r(a){this.mode=n.BYTE,typeof a=="string"?this.data=new TextEncoder().encode(a):this.data=new Uint8Array(a)}return r.getBitsLength=function(o){return o*8},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(a){for(let o=0,e=this.data.length;o<e;o++)a.put(this.data[o],8)},Se=r,Se}var ve,at;function Kt(){if(at)return ve;at=1;const n=G(),r=J();function a(o){this.mode=n.KANJI,this.data=o}return a.getBitsLength=function(e){return e*13},a.prototype.getLength=function(){return this.data.length},a.prototype.getBitsLength=function(){return a.getBitsLength(this.data.length)},a.prototype.write=function(o){let e;for(e=0;e<this.data.length;e++){let t=r.toSJIS(this.data[e]);if(t>=33088&&t<=40956)t-=33088;else if(t>=57408&&t<=60351)t-=49472;else throw new Error("Invalid SJIS character: "+this.data[e]+`
|
|
343
|
+
Make sure your charset is UTF-8`);t=(t>>>8&255)*192+(t&255),o.put(t,13)}},ve=a,ve}var Pe={exports:{}},it;function Jt(){return it||(it=1,function(n){var r={single_source_shortest_paths:function(a,o,e){var t={},i={};i[o]=0;var l=r.PriorityQueue.make();l.push(o,0);for(var s,d,p,y,h,u,f,g,I;!l.empty();){s=l.pop(),d=s.value,y=s.cost,h=a[d]||{};for(p in h)h.hasOwnProperty(p)&&(u=h[p],f=y+u,g=i[p],I=typeof i[p]=="undefined",(I||g>f)&&(i[p]=f,l.push(p,f),t[p]=d))}if(typeof e!="undefined"&&typeof i[e]=="undefined"){var x=["Could not find a path from ",o," to ",e,"."].join("");throw new Error(x)}return t},extract_shortest_path_from_predecessor_list:function(a,o){for(var e=[],t=o;t;)e.push(t),a[t],t=a[t];return e.reverse(),e},find_path:function(a,o,e){var t=r.single_source_shortest_paths(a,o,e);return r.extract_shortest_path_from_predecessor_list(t,e)},PriorityQueue:{make:function(a){var o=r.PriorityQueue,e={},t;a=a||{};for(t in o)o.hasOwnProperty(t)&&(e[t]=o[t]);return e.queue=[],e.sorter=a.sorter||o.default_sorter,e},default_sorter:function(a,o){return a.cost-o.cost},push:function(a,o){var e={value:a,cost:o};this.queue.push(e),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};n.exports=r}(Pe)),Pe.exports}var st;function Gt(){return st||(st=1,function(n){const r=G(),a=Ht(),o=jt(),e=Yt(),t=Kt(),i=Ze(),l=J(),s=Jt();function d(x){return unescape(encodeURIComponent(x)).length}function p(x,M,b){const C=[];let L;for(;(L=x.exec(b))!==null;)C.push({data:L[0],index:L.index,mode:M,length:L[0].length});return C}function y(x){const M=p(i.NUMERIC,r.NUMERIC,x),b=p(i.ALPHANUMERIC,r.ALPHANUMERIC,x);let C,L;return l.isKanjiModeEnabled()?(C=p(i.BYTE,r.BYTE,x),L=p(i.KANJI,r.KANJI,x)):(C=p(i.BYTE_KANJI,r.BYTE,x),L=[]),M.concat(b,C,L).sort(function(v,P){return v.index-P.index}).map(function(v){return{data:v.data,mode:v.mode,length:v.length}})}function h(x,M){switch(M){case r.NUMERIC:return a.getBitsLength(x);case r.ALPHANUMERIC:return o.getBitsLength(x);case r.KANJI:return t.getBitsLength(x);case r.BYTE:return e.getBitsLength(x)}}function u(x){return x.reduce(function(M,b){const C=M.length-1>=0?M[M.length-1]:null;return C&&C.mode===b.mode?(M[M.length-1].data+=b.data,M):(M.push(b),M)},[])}function f(x){const M=[];for(let b=0;b<x.length;b++){const C=x[b];switch(C.mode){case r.NUMERIC:M.push([C,{data:C.data,mode:r.ALPHANUMERIC,length:C.length},{data:C.data,mode:r.BYTE,length:C.length}]);break;case r.ALPHANUMERIC:M.push([C,{data:C.data,mode:r.BYTE,length:C.length}]);break;case r.KANJI:M.push([C,{data:C.data,mode:r.BYTE,length:d(C.data)}]);break;case r.BYTE:M.push([{data:C.data,mode:r.BYTE,length:d(C.data)}])}}return M}function g(x,M){const b={},C={start:{}};let L=["start"];for(let w=0;w<x.length;w++){const v=x[w],P=[];for(let S=0;S<v.length;S++){const k=v[S],T=""+w+S;P.push(T),b[T]={node:k,lastCount:0},C[T]={};for(let A=0;A<L.length;A++){const E=L[A];b[E]&&b[E].node.mode===k.mode?(C[E][T]=h(b[E].lastCount+k.length,k.mode)-h(b[E].lastCount,k.mode),b[E].lastCount+=k.length):(b[E]&&(b[E].lastCount=k.length),C[E][T]=h(k.length,k.mode)+4+r.getCharCountIndicator(k.mode,M))}}L=P}for(let w=0;w<L.length;w++)C[L[w]].end=0;return{map:C,table:b}}function I(x,M){let b;const C=r.getBestModeForData(x);if(b=r.from(M,C),b!==r.BYTE&&b.bit<C.bit)throw new Error('"'+x+'" cannot be encoded with mode '+r.toString(b)+`.
|
|
344
|
+
Suggested mode is: `+r.toString(C));switch(b===r.KANJI&&!l.isKanjiModeEnabled()&&(b=r.BYTE),b){case r.NUMERIC:return new a(x);case r.ALPHANUMERIC:return new o(x);case r.KANJI:return new t(x);case r.BYTE:return new e(x)}}n.fromArray=function(M){return M.reduce(function(b,C){return typeof C=="string"?b.push(I(C,null)):C.data&&b.push(I(C.data,C.mode)),b},[])},n.fromString=function(M,b){const C=y(M,l.isKanjiModeEnabled()),L=f(C),w=g(L,b),v=s.find_path(w.map,"start","end"),P=[];for(let S=1;S<v.length-1;S++)P.push(w.table[v[S]].node);return n.fromArray(u(P))},n.rawSplit=function(M){return n.fromArray(y(M,l.isKanjiModeEnabled()))}}(we)),we}var lt;function Qt(){if(lt)return ae;lt=1;const n=J(),r=se(),a=Lt(),o=Dt(),e=Ut(),t=qt(),i=Ft(),l=Ye(),s=zt(),d=Ot(),p=$t(),y=G(),h=Gt();function u(w,v){const P=w.size,S=t.getPositions(v);for(let k=0;k<S.length;k++){const T=S[k][0],A=S[k][1];for(let E=-1;E<=7;E++)if(!(T+E<=-1||P<=T+E))for(let N=-1;N<=7;N++)A+N<=-1||P<=A+N||(E>=0&&E<=6&&(N===0||N===6)||N>=0&&N<=6&&(E===0||E===6)||E>=2&&E<=4&&N>=2&&N<=4?w.set(T+E,A+N,!0,!0):w.set(T+E,A+N,!1,!0))}}function f(w){const v=w.size;for(let P=8;P<v-8;P++){const S=P%2===0;w.set(P,6,S,!0),w.set(6,P,S,!0)}}function g(w,v){const P=e.getPositions(v);for(let S=0;S<P.length;S++){const k=P[S][0],T=P[S][1];for(let A=-2;A<=2;A++)for(let E=-2;E<=2;E++)A===-2||A===2||E===-2||E===2||A===0&&E===0?w.set(k+A,T+E,!0,!0):w.set(k+A,T+E,!1,!0)}}function I(w,v){const P=w.size,S=d.getEncodedBits(v);let k,T,A;for(let E=0;E<18;E++)k=Math.floor(E/3),T=E%3+P-8-3,A=(S>>E&1)===1,w.set(k,T,A,!0),w.set(T,k,A,!0)}function x(w,v,P){const S=w.size,k=p.getEncodedBits(v,P);let T,A;for(T=0;T<15;T++)A=(k>>T&1)===1,T<6?w.set(T,8,A,!0):T<8?w.set(T+1,8,A,!0):w.set(S-15+T,8,A,!0),T<8?w.set(8,S-T-1,A,!0):T<9?w.set(8,15-T-1+1,A,!0):w.set(8,15-T-1,A,!0);w.set(S-8,8,1,!0)}function M(w,v){const P=w.size;let S=-1,k=P-1,T=7,A=0;for(let E=P-1;E>0;E-=2)for(E===6&&E--;;){for(let N=0;N<2;N++)if(!w.isReserved(k,E-N)){let Y=!1;A<v.length&&(Y=(v[A]>>>T&1)===1),w.set(k,E-N,Y),T--,T===-1&&(A++,T=7)}if(k+=S,k<0||P<=k){k-=S,S=-S;break}}}function b(w,v,P){const S=new a;P.forEach(function(N){S.put(N.mode.bit,4),S.put(N.getLength(),y.getCharCountIndicator(N.mode,w)),N.write(S)});const k=n.getSymbolTotalCodewords(w),T=l.getTotalCodewordsCount(w,v),A=(k-T)*8;for(S.getLengthInBits()+4<=A&&S.put(0,4);S.getLengthInBits()%8!==0;)S.putBit(0);const E=(A-S.getLengthInBits())/8;for(let N=0;N<E;N++)S.put(N%2?17:236,8);return C(S,w,v)}function C(w,v,P){const S=n.getSymbolTotalCodewords(v),k=l.getTotalCodewordsCount(v,P),T=S-k,A=l.getBlocksCount(v,P),E=S%A,N=A-E,Y=Math.floor(S/A),X=Math.floor(T/A),Cn=X+1,St=Y-X,xn=new s(St);let Ie=0;const te=new Array(A),vt=new Array(A);let Me=0;const Sn=new Uint8Array(w.buffer);for(let R=0;R<A;R++){const Le=R<N?X:Cn;te[R]=Sn.slice(Ie,Ie+Le),vt[R]=xn.encode(te[R]),Ie+=Le,Me=Math.max(Me,Le)}const Ne=new Uint8Array(S);let Pt=0,$,H;for($=0;$<Me;$++)for(H=0;H<A;H++)$<te[H].length&&(Ne[Pt++]=te[H][$]);for($=0;$<St;$++)for(H=0;H<A;H++)Ne[Pt++]=vt[H][$];return Ne}function L(w,v,P,S){let k;if(Array.isArray(w))k=h.fromArray(w);else if(typeof w=="string"){let Y=v;if(!Y){const X=h.rawSplit(w);Y=d.getBestVersionForData(X,P)}k=h.fromString(w,Y||40)}else throw new Error("Invalid data");const T=d.getBestVersionForData(k,P);if(!T)throw new Error("The amount of data is too big to be stored in a QR Code");if(!v)v=T;else if(v<T)throw new Error(`
|
|
203
345
|
The chosen QR Code version cannot contain this amount of data.
|
|
204
|
-
Minimum version required to store current data is: `+
|
|
205
|
-
`);const A=
|
|
206
|
-
`;return typeof s=="function"&&s(null,I),I},Be}var lt;function zt(){if(lt)return J;lt=1;const n=bt(),o=Rt(),i=Ft(),r=_t();function t(e,a,s,l,c){const h=[].slice.call(arguments,1),p=h.length,d=typeof h[p-1]=="function";if(!d&&!n())throw new Error("Callback required as last argument");if(d){if(p<2)throw new Error("Too few arguments provided");p===2?(c=s,s=a,a=l=void 0):p===3&&(a.getContext&&typeof c=="undefined"?(c=l,l=void 0):(c=l,l=s,s=a,a=void 0))}else{if(p<1)throw new Error("Too few arguments provided");return p===1?(s=a,a=l=void 0):p===2&&!a.getContext&&(l=s,s=a,a=void 0),new Promise(function(u,g){try{const m=o.create(s,l);u(e(m,a,l))}catch(m){g(m)}})}try{const u=o.create(s,l);c(null,e(u,a,l))}catch(u){c(u)}}return J.create=o.create,J.toCanvas=t.bind(null,i.render),J.toDataURL=t.bind(null,i.renderToDataURL),J.toString=t.bind(null,function(e,a,s){return r.render(e,s)}),J}var Ht=zt();const Ot=Ct(Ht),ct=({title:n,uid:o})=>{var I;const i=Q.useFieldSchema(),r=L.useMatch("/admin/:name"),t=L.useMatch("/share/:name"),e=L.useMatch("/mobile/:name"),a=b.useIsMobile(),s=r||t||e,c=(a?window.location.href.replace("/mobile","/share"):window.location.href.replace("/admin","/share")).replace((I=s==null?void 0:s.params)==null?void 0:I.name,o||i["x-uid"]).replace(window.location.search||"",""),{t:h}=b.useTranslation(),[p,d]=U.useState(),u=b.useCompile();return Ot.toDataURL(c,{width:170},(w,N)=>{if(w){console.error(w);return}p||d(N)}),{copyLink:()=>{navigator.clipboard.writeText(c).then(w=>{q.message.open({type:"success",content:f.jsxs(f.Fragment,{children:[h("Replicated"),f.jsx("span",{style:{color:"#3279FE"},children:u(n||"")}),h("page link")]})})})},imageAction:()=>f.jsx(jt,{link:p,title:n})}},jt=n=>{const{link:o,title:i}=n,r=U.useRef(null),{t}=b.useTranslation(),{currentUserCtx:e}=b.useCurrentUserVariable(),a=b.useCompile();U.useEffect(()=>{Vt(r,o,e,t)},[]);const s=()=>{const c=r.current;if(c){const h=c.toDataURL("image/png"),p=document.createElement("a");p.href=h,p.download="Tachybase-Share.png",p.click(),q.message.open({type:"success",content:f.jsxs(f.Fragment,{children:[t("Saved"),f.jsx("span",{style:{color:"#3279FE"},children:a(i||"")}),t("QR code")]})})}},l=()=>{const c=r.current;c&&navigator.clipboard&&c.toBlob(h=>ee(null,null,function*(){if(h)try{const p=new ClipboardItem({"image/png":h});yield navigator.clipboard.write([p]),q.message.open({type:"success",content:f.jsxs(f.Fragment,{children:[t("Replicated"),f.jsx("span",{style:{color:"#3279FE"},children:a(i||"")}),t("QR code")]})})}catch(p){q.message.error(t("Copy failed, please try again"))}}),"image/png")};return f.jsxs("div",{style:{marginTop:"23px",display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center"},children:[f.jsx("canvas",{ref:r,width:240,height:260,style:{width:"240px",height:"260px",pointerEvents:"none"}}),f.jsxs("div",{style:{width:"100%",display:"flex",justifyContent:"space-between",marginTop:"10px"},children:[f.jsx(q.Button,{onClick:s,style:{width:"49%"},children:t("Save Picture")}),f.jsx(q.Button,{onClick:l,style:{width:"49%"},children:t("Copy QR code")})]})]})},Vt=(n,o,i,r)=>{const t=n.current,e=t.getContext("2d"),a=window.devicePixelRatio,{width:s,height:l}=t;t.width=Math.round(s*a),t.height=Math.round(l*a),t.style.width=s+"px",t.style.height=l+"px",e.scale(a,a),e.filter="blur(20px)";const c=e.createLinearGradient(0,0,t.width,t.height);c.addColorStop(0,"rgba(255, 255, 255, 1)"),c.addColorStop(1,"rgba(234, 238, 246, 0.80)"),e.fillStyle=c,e.fillRect(0,0,t.width,t.height);const h=(d,u)=>{const m=e.createRadialGradient(d,u,0,d,u,100);m.addColorStop(0,"rgba(255, 255, 255, 1)"),m.addColorStop(1,"rgba(217, 238, 255, 0.216)"),e.fillStyle=m,e.beginPath(),e.arc(d,u,100,0,Math.PI*2),e.fill()};h(60,30),h(190,280),e.filter="none",e.fillStyle="#AAAAAA",e.font="13px Arial",e.textAlign="center",e.fillText(`${i.nickname}`,t.width/4,30);const p=new Image;p.src=o,p.onload=()=>{const d=p.width,u=p.height,g=(t.width-d)/8,m=40,I=3,w=20;e.beginPath(),e.moveTo(g+w,m),e.arcTo(g+d,m,g+d,m+u,w),e.arcTo(g+d,m+u,g,m+u,w),e.arcTo(g,m+u,g,m,w),e.arcTo(g,m,g+d,m,w),e.closePath(),e.clip(),e.drawImage(p,g+I,m+I,d-2*I,u-2*I),e.lineWidth=I,e.strokeStyle="#000",e.beginPath(),e.moveTo(g+w,m),e.arcTo(g+d,m,g+d,m+u,w),e.arcTo(g+d,m+u,g,m+u,w),e.arcTo(g,m+u,g,m,w),e.arcTo(g,m,g+d,m,w),e.closePath(),e.stroke()},e.fillStyle="#AAAAAA",e.font="13px Arial",e.textAlign="center",e.fillText(r("Scan the code to view the sharing"),t.width/4,230),e.fillStyle="rgba(50, 121, 254, 1)",e.font="14px Arial",e.textAlign="center",e.fillText("灵矶(Tachybase)",t.width/4,250)},Kt=Q.connect(n=>{var T;const o=b.usePageExtendComponentContext(),{disablePageHeader:i,fieldSchema:r={},title:t="",enableSharePage:e,isExtra:a}=o,s=L.useMatch("/share/:name"),l=(T=r==null?void 0:r["x-component-props"])==null?void 0:T.hidePageTitle,[c,h]=U.useState(!1),[p,d]=U.useState(!1),u=b.useCompile(),{t:g}=b.useTranslation(),m=l?void 0:r.title||u(t),{styles:I}=yt(),{copyLink:w,imageAction:N}=ct({title:m,uid:r["x-uid"]});return f.jsxs(f.Fragment,{children:[!s&&a&&f.jsx(q.Button,{icon:f.jsx(K.ShareAltOutlined,{}),onClick:()=>{h(!0)},style:{visibility:`${e?"visible":"hidden"}`}}),!a&&i&&e&&!s&&f.jsx("div",{className:"tb-page-header-button",children:f.jsx(q.Button,{icon:f.jsx(K.ShareAltOutlined,{}),onClick:()=>{h(!0)},children:g("Share")})}),f.jsxs(q.Modal,{open:c,className:I.firstmodal,title:g("Share"),footer:null,width:500,onCancel:()=>{h(!1)},children:[f.jsxs("div",{className:I.secondmodal,children:[f.jsxs("div",{className:"tb-header-modal-list",onClick:w,children:[f.jsx(b.Icon,{type:"PaperClipOutlined"}),g("Copy link")]}),f.jsxs("div",{className:"tb-header-modal-list",onClick:()=>{d(!0)},children:[f.jsx(b.Icon,{type:"QrcodeOutlined"}),g("Generate QR code")]})]}),f.jsx(q.Modal,{className:I.imageModal,open:p,footer:null,onCancel:()=>{d(!1)},children:N()})]})]})});function Jt(){const n=new URL(window.location.href),o=b.useAPIClient(),i=n.searchParams.get("token");return i&&o.auth.setToken(i),o.auth.getToken()}const Yt=()=>{var t,e,a,s,l;const{styles:n}=wt(),o=b.useApp(),i=b.useSystemSettings(),r=U.useRef();return f.jsx(q.Layout,{style:{height:"100%"},children:f.jsxs(q.Layout.Content,{className:$.css`
|
|
346
|
+
Minimum version required to store current data is: `+T+`.
|
|
347
|
+
`);const A=b(v,P,k),E=n.getSymbolSize(v),N=new o(E);return u(N,v),f(N),g(N,v),x(N,P,0),v>=7&&I(N,v),M(N,A),isNaN(S)&&(S=i.getBestMask(N,x.bind(null,N,P))),i.applyMask(S,N),x(N,P,S),{modules:N,version:v,errorCorrectionLevel:P,maskPattern:S,segments:k}}return ae.create=function(v,P){if(typeof v=="undefined"||v==="")throw new Error("No input text");let S=r.M,k,T;return typeof P!="undefined"&&(S=r.from(P.errorCorrectionLevel,r.M),k=d.from(P.version),T=i.from(P.maskPattern),P.toSJISFunc&&n.setToSJISFunction(P.toSJISFunc)),L(v,k,S,T)},ae}var Ee={},Te={},ct;function ut(){return ct||(ct=1,function(n){function r(a){if(typeof a=="number"&&(a=a.toString()),typeof a!="string")throw new Error("Color should be defined as hex string");let o=a.slice().replace("#","").split("");if(o.length<3||o.length===5||o.length>8)throw new Error("Invalid hex color: "+a);(o.length===3||o.length===4)&&(o=Array.prototype.concat.apply([],o.map(function(t){return[t,t]}))),o.length===6&&o.push("F","F");const e=parseInt(o.join(""),16);return{r:e>>24&255,g:e>>16&255,b:e>>8&255,a:e&255,hex:"#"+o.slice(0,6).join("")}}n.getOptions=function(o){o||(o={}),o.color||(o.color={});const e=typeof o.margin=="undefined"||o.margin===null||o.margin<0?4:o.margin,t=o.width&&o.width>=21?o.width:void 0,i=o.scale||4;return{width:t,scale:t?4:i,margin:e,color:{dark:r(o.color.dark||"#000000ff"),light:r(o.color.light||"#ffffffff")},type:o.type,rendererOpts:o.rendererOpts||{}}},n.getScale=function(o,e){return e.width&&e.width>=o+e.margin*2?e.width/(o+e.margin*2):e.scale},n.getImageWidth=function(o,e){const t=n.getScale(o,e);return Math.floor((o+e.margin*2)*t)},n.qrToImageData=function(o,e,t){const i=e.modules.size,l=e.modules.data,s=n.getScale(i,t),d=Math.floor((i+t.margin*2)*s),p=t.margin*s,y=[t.color.light,t.color.dark];for(let h=0;h<d;h++)for(let u=0;u<d;u++){let f=(h*d+u)*4,g=t.color.light;if(h>=p&&u>=p&&h<d-p&&u<d-p){const I=Math.floor((h-p)/s),x=Math.floor((u-p)/s);g=y[l[I*i+x]?1:0]}o[f++]=g.r,o[f++]=g.g,o[f++]=g.b,o[f]=g.a}}}(Te)),Te}var dt;function Rt(){return dt||(dt=1,function(n){const r=ut();function a(e,t,i){e.clearRect(0,0,t.width,t.height),t.style||(t.style={}),t.height=i,t.width=i,t.style.height=i+"px",t.style.width=i+"px"}function o(){try{return document.createElement("canvas")}catch(e){throw new Error("You need to specify a canvas element")}}n.render=function(t,i,l){let s=l,d=i;typeof s=="undefined"&&(!i||!i.getContext)&&(s=i,i=void 0),i||(d=o()),s=r.getOptions(s);const p=r.getImageWidth(t.modules.size,s),y=d.getContext("2d"),h=y.createImageData(p,p);return r.qrToImageData(h.data,t,s),a(y,d,p),y.putImageData(h,0,0),d},n.renderToDataURL=function(t,i,l){let s=l;typeof s=="undefined"&&(!i||!i.getContext)&&(s=i,i=void 0),s||(s={});const d=n.render(t,i,s),p=s.type||"image/png",y=s.rendererOpts||{};return d.toDataURL(p,y.quality)}}(Ee)),Ee}var Be={},ht;function Wt(){if(ht)return Be;ht=1;const n=ut();function r(e,t){const i=e.a/255,l=t+'="'+e.hex+'"';return i<1?l+" "+t+'-opacity="'+i.toFixed(2).slice(1)+'"':l}function a(e,t,i){let l=e+t;return typeof i!="undefined"&&(l+=" "+i),l}function o(e,t,i){let l="",s=0,d=!1,p=0;for(let y=0;y<e.length;y++){const h=Math.floor(y%t),u=Math.floor(y/t);!h&&!d&&(d=!0),e[y]?(p++,y>0&&h>0&&e[y-1]||(l+=d?a("M",h+i,.5+u+i):a("m",s,0),s=0,d=!1),h+1<t&&e[y+1]||(l+=a("h",p),p=0)):s++}return l}return Be.render=function(t,i,l){const s=n.getOptions(i),d=t.modules.size,p=t.modules.data,y=d+s.margin*2,h=s.color.light.a?"<path "+r(s.color.light,"fill")+' d="M0 0h'+y+"v"+y+'H0z"/>':"",u="<path "+r(s.color.dark,"stroke")+' d="'+o(p,d,s.margin)+'"/>',f='viewBox="0 0 '+y+" "+y+'"',I='<svg xmlns="http://www.w3.org/2000/svg" '+(s.width?'width="'+s.width+'" height="'+s.width+'" ':"")+f+' shape-rendering="crispEdges">'+h+u+`</svg>
|
|
348
|
+
`;return typeof l=="function"&&l(null,I),I},Be}var ft;function Zt(){if(ft)return Q;ft=1;const n=Nt(),r=Qt(),a=Rt(),o=Wt();function e(t,i,l,s,d){const p=[].slice.call(arguments,1),y=p.length,h=typeof p[y-1]=="function";if(!h&&!n())throw new Error("Callback required as last argument");if(h){if(y<2)throw new Error("Too few arguments provided");y===2?(d=l,l=i,i=s=void 0):y===3&&(i.getContext&&typeof d=="undefined"?(d=s,s=void 0):(d=s,s=l,l=i,i=void 0))}else{if(y<1)throw new Error("Too few arguments provided");return y===1?(l=i,i=s=void 0):y===2&&!i.getContext&&(s=l,l=i,i=void 0),new Promise(function(u,f){try{const g=r.create(l,s);u(t(g,i,s))}catch(g){f(g)}})}try{const u=r.create(l,s);d(null,t(u,i,s))}catch(u){d(u)}}return Q.create=r.create,Q.toCanvas=e.bind(null,a.render),Q.toDataURL=e.bind(null,a.renderToDataURL),Q.toString=e.bind(null,function(t,i,l){return o.render(t,l)}),Q}var Xt=Zt();const en=Mt(Xt),Ae=D.createContext({shareValue:{linkStatus:!0,password:null,permanent:!1,shareTime:null,permission:"view",generateLink:null,createdBy:null,updatedBy:null,tabs:[]},setShareValue:n=>{}}),ke=()=>D.useContext(Ae),gt=n=>{var b;const{title:r,uid:a}=n,o=W.useFieldSchema(),e=q.useMatch("/admin/:name"),t=q.useMatch("/share/:name"),i=q.useMatch("/mobile/:name"),l=m.useIsMobile(),s=e||t||i,d=l?window.location.href.replace("/mobile","/share"):window.location.href.replace("/admin","/share"),{t:p}=m.useTranslation(),{shareValue:y}=ke(),h=m.useCompile(),u=m.useAPIClient(),[f,g]=D.useState(""),I=d.replace((b=s==null?void 0:s.params)==null?void 0:b.name,a||o["x-uid"]).replace(window.location.search||"","");return D.useEffect(()=>{g("")},[y]),{copyLink:C=>{const L=typeof C=="string"?C:f;L?pt(L,r,h,p):u.resource("sharePageConfig").create({values:V(F({},y),{generateLink:I})}).then(w=>{const v=I+"/"+(w==null?void 0:w.data.data.id);g(v),pt(v,r,h,p)})},imageAction:C=>{const L=typeof C=="string"?C:f;return c.jsx(tn,{link:I,title:r,shareLink:L,setShareLink:g})}}},tn=n=>{const{link:r,title:a,shareLink:o,setShareLink:e}=n,t=D.useRef(null),{t:i}=m.useTranslation(),{currentUserCtx:l}=m.useCurrentUserVariable(),s=m.useCompile(),{shareValue:d}=ke(),p=m.useAPIClient();D.useEffect(()=>{o?en.toDataURL(o,{width:170},(u,f)=>{if(u){console.error(u);return}f&&nn(t,f,l,i)}):p.resource("sharePageConfig").create({values:V(F({},d),{generateLink:r})}).then(u=>{e(r+"/"+(u==null?void 0:u.data.data.id))})},[o]);const y=()=>{const u=t.current;if(u){const f=u.toDataURL("image/png"),g=document.createElement("a");g.href=f,g.download="Tachybase-Share.png",g.click(),B.message.open({type:"success",content:c.jsxs(c.Fragment,{children:[i("Saved"),c.jsx("span",{style:{color:"#3279FE"},children:s(a||"")}),i("QR code")]})})}},h=()=>{const u=t.current;u&&navigator.clipboard&&u.toBlob(f=>ne(null,null,function*(){if(f)try{const g=new ClipboardItem({"image/png":f});yield navigator.clipboard.write([g]),B.message.open({type:"success",content:c.jsxs(c.Fragment,{children:[i("Replicated"),c.jsx("span",{style:{color:"#3279FE"},children:s(a||"")}),i("QR code")]})})}catch(g){B.message.error(i("Copy failed, please try again"))}}),"image/png")};return c.jsxs("div",{style:{marginTop:"23px",display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center"},children:[c.jsx("canvas",{ref:t,width:240,height:260,style:{width:"240px",height:"260px",pointerEvents:"none"}}),c.jsxs("div",{style:{width:"100%",display:"flex",justifyContent:"space-between",marginTop:"10px"},children:[c.jsx(B.Button,{onClick:y,style:{width:"49%"},children:i("Save Picture")}),c.jsx(B.Button,{onClick:h,style:{width:"49%"},children:i("Copy QR code")})]})]})},nn=(n,r,a,o)=>{const e=n.current,t=e.getContext("2d"),i=window.devicePixelRatio,{width:l,height:s}=e;e.width=Math.round(l*i),e.height=Math.round(s*i),e.style.width=l+"px",e.style.height=s+"px",t.scale(i,i),t.filter="blur(20px)";const d=t.createLinearGradient(0,0,e.width,e.height);d.addColorStop(0,"rgba(255, 255, 255, 1)"),d.addColorStop(1,"rgba(234, 238, 246, 0.80)"),t.fillStyle=d,t.fillRect(0,0,e.width,e.height);const p=(h,u)=>{const g=t.createRadialGradient(h,u,0,h,u,100);g.addColorStop(0,"rgba(255, 255, 255, 1)"),g.addColorStop(1,"rgba(217, 238, 255, 0.216)"),t.fillStyle=g,t.beginPath(),t.arc(h,u,100,0,Math.PI*2),t.fill()};p(60,30),p(190,280),t.filter="none",t.fillStyle="#AAAAAA",t.font="13px Arial",t.textAlign="center",t.fillText(`${a.nickname}`,e.width/4,30);const y=new Image;y.src=r,y.onload=()=>{const h=y.width,u=y.height,f=(e.width-h)/8,g=40,I=3,x=20;t.beginPath(),t.moveTo(f+x,g),t.arcTo(f+h,g,f+h,g+u,x),t.arcTo(f+h,g+u,f,g+u,x),t.arcTo(f,g+u,f,g,x),t.arcTo(f,g,f+h,g,x),t.closePath(),t.clip(),t.drawImage(y,f+I,g+I,h-2*I,u-2*I),t.lineWidth=I,t.strokeStyle="#000",t.beginPath(),t.moveTo(f+x,g),t.arcTo(f+h,g,f+h,g+u,x),t.arcTo(f+h,g+u,f,g+u,x),t.arcTo(f,g+u,f,g,x),t.arcTo(f,g,f+h,g,x),t.closePath(),t.stroke()},t.fillStyle="#AAAAAA",t.font="13px Arial",t.textAlign="center",t.fillText(o("Scan the code to view the sharing"),e.width/4,230),t.fillStyle="rgba(50, 121, 254, 1)",t.font="14px Arial",t.textAlign="center",t.fillText("灵矶(Tachybase)",e.width/4,250)},pt=(n,r,a,o)=>{navigator.clipboard.writeText(n).then(e=>{B.message.open({type:"success",content:c.jsxs(c.Fragment,{children:[o("Replicated"),c.jsx("span",{style:{color:"#3279FE"},children:a(r||"")}),o("page link")]})})})},rn={title:"sharePageConfig",name:"sharePageConfig",fields:[{name:"createdAt",interface:"createdAt",type:"date",field:"createdAt",uiSchema:{type:"datetime",title:'{{t("Created at")}}',"x-component":"DatePicker","x-component-props":{},"x-read-pretty":!0}},{name:"createdBy",interface:"createdBy",type:"belongsTo",target:"users",foreignKey:"createdById",uiSchema:{type:"object",title:'{{t("Created by")}}',"x-component":"AssociationField","x-component-props":{fieldNames:{value:"id",label:"nickname"}},"x-read-pretty":!0}},{type:"date",field:"updatedAt",name:"updatedAt",interface:"updatedAt",uiSchema:{type:"string",title:'{{t("Last updated at")}}',"x-component":"DatePicker","x-component-props":{},"x-read-pretty":!0}},{type:"belongsTo",target:"users",foreignKey:"updatedById",name:"updatedBy",interface:"updatedBy",uiSchema:{type:"object",title:'{{t("Last updated by")}}',"x-component":"AssociationField","x-component-props":{fieldNames:{value:"id",label:"nickname"}},"x-read-pretty":!0}},{type:"bigInt",name:"id",primaryKey:!0,autoIncrement:!0,interface:"id",uiSchema:{type:"number",title:'{{t("ID")}}',"x-component":"InputNumber","x-read-pretty":!0}},{interface:"checkbox",name:"linkStatus",type:"boolean",uiSchema:{title:"linkStatus",type:"boolean","x-component":"Checkbox","x-component-props":{shouUnchecked:!0}}},{type:"password",name:"password",interface:"password",hidden:!0,uiSchema:{type:"string",title:'{{t("Password")}}',"x-component":"Password"}},{interface:"checkbox",name:"permanent",type:"boolean",uiSchema:{title:"permanent",type:"boolean","x-component":"Checkbox","x-component-props":{shouUnchecked:!1}}},{interface:"datetime",name:"shareTime",type:"date",uiSchema:{title:'{{t("ShareTime")}}',type:"string","x-component":"DatePicker","x-component-props":{dateFormat:"YYYY-MM-DD",gmt:!1,showTime:!1}}},{interface:"radioGroup",name:"permission",type:"string",uiSchema:{title:'{{t("Permission")}}',tye:"string","x-component":"Radio.Group",enum:[{value:"edit",label:'{{t("Editable")}}',color:"gold"},{value:"view",label:'{{t("View Only")}}',color:"green"}]}},{interface:"url",name:"generateLink",type:"text",uiSchema:{title:"generateLink",tye:"string","x-component":"Input.URL"}},{interface:"input",type:"jsonb",name:"tabs",uiSchema:{type:"object",title:"tabs","x-component":"Json","x-component-props":{style:{height:"100px"}}}}]},mt=D.createContext({aclRoleShareMenuUiSchemas:[]}),on=n=>{var e;const r=m.useAPIClient(),a=q.useMatch("/share/:name/:id"),{data:o}=m.useRequest({resource:"roles",action:"get",params:{filter:{name:r.auth.role},appends:["menuShareUiSchemas"],paginate:!1}},{ready:!!r.auth.role&&!a,refreshDeps:[r.auth.role]});return c.jsx(mt.Provider,{value:{aclRoleShareMenuUiSchemas:((e=o==null?void 0:o.data)==null?void 0:e.menuShareUiSchemas)||[]},children:c.jsx(m.ExtendCollectionsProvider,{collections:[rn],children:n.children})})},an=()=>D.useContext(mt),yt=()=>{const{aclRoleShareMenuUiSchemas:n}=an(),r=q.useParams();return(n==null?void 0:n.filter(o=>o["x-uid"]===r.name)).length>0},bt=n=>{const{shareValue:r,setShareValue:a,allTabs:o}=n,{t:e}=m.useTranslation(),[t,i]=D.useState({visible:!1,value:r.password}),l=m.useACLRoleContext(),{styles:s}=De(),[d,p]=D.useState({setPw:!0,edit:!1}),[y,h]=D.useState(!1),[u,f]=D.useState(o),g=m.useAPIClient();D.useEffect(()=>{r.password||(i({visible:!1,value:r.password}),p({setPw:!r.password,edit:!1}))},[r]);const I=()=>{if(r.shareTime&&_().isAfter(r.shareTime)){B.message.warning(e("Please reset the link time limit"));return}g.resource("sharePageConfig").update({filterByTk:r.id,values:r}).then(C=>{h(!1),B.message.success(e("Saved successfully"))})},x=b=>{const C=r.tabs?r.tabs.findIndex(L=>L.value===b.value):-1;if(b.value==="all")C>=0?a(V(F({},r),{tabs:[]})):a(V(F({},r),{tabs:[...u]}));else if(C>=0){const L=r.tabs.filter(w=>w.value!=="all"&&w.value!==b.value);a(V(F({},r),{tabs:L}))}else a(V(F({},r),{tabs:[...r.tabs||[],b.data]}));h(!0)},M=b=>{if(b&&!u&&r.generateLink){const C=r.generateLink.split("/").pop();g.request({url:`/uiSchemas:getProperties/${C}`}).then(L=>{var P,S,k,T;const w=((S=(P=L==null?void 0:L.data)==null?void 0:P.data)==null?void 0:S.bodyProperties)||((T=(k=L==null?void 0:L.data)==null?void 0:k.data)==null?void 0:T.properties),v=Object.entries(w||{}).map(([A,E],N)=>({label:E.title||`${e("Tab")}${N+1}`,value:E["x-uid"],xUid:E["x-uid"],schemaName:A,title:E.title}));v.length>1&&v.unshift({label:e("Select all"),value:"all",xUid:"",schemaName:"",title:""}),f(v)})}};return c.jsxs(B.Form,{layout:"vertical",className:s.form,children:[c.jsx(B.Form.Item,{label:`${e("Sharing permission")}:`,children:c.jsx(B.Radio.Group,{onChange:b=>{h(!0),a(V(F({},r),{permission:b.target.value}))},value:r.permission,options:[{value:"edit",label:e("Editable"),disabled:!l.strategy.actions.includes("update")},{value:"view",label:e("View only")}]})}),c.jsx(B.Form.Item,{label:`${e("Select tab")}:`,children:c.jsx(B.Select,{mode:"multiple",maxTagCount:"responsive",options:u,value:r.tabs,optionRender:b=>{var C;return c.jsxs("div",{onClick:()=>{x(b)},children:[c.jsx(B.Checkbox,{checked:((C=r==null?void 0:r.tabs)==null?void 0:C.find(L=>L.value===b.value))||!1,style:{paddingRight:"5px"},onChange:()=>{x(b)}}),b.label]})},tagRender:b=>b.value==="all"?null:c.jsx(B.Tag,{children:b.label}),onDropdownVisibleChange:M})}),c.jsx(B.Form.Item,{label:`${e("Link timeliness")}:`,children:c.jsx(B.DatePicker,{showToday:!1,value:r.shareTime?_(r.shareTime):null,onChange:b=>{h(!0),a(V(F({},r),{shareTime:b}))},minDate:_(),renderExtraFooter:()=>c.jsxs("div",{className:s.datePickFooter,children:[e("Permanently valid"),c.jsx(B.Button,{type:"primary",onClick:()=>{h(!0),a(V(F({},r),{shareTime:null}))},children:e("Confirm")})]})})}),c.jsxs(B.Form.Item,{label:`${e("Set access password")}:`,children:[d.setPw&&c.jsx(B.Button,{className:"setPassWord",onClick:()=>p(V(F({},d),{setPw:!1})),children:e("Set access password")}),!d.setPw&&c.jsxs("div",{className:"password",children:[c.jsx(B.Input.Password,{visibilityToggle:{visible:t.visible,onVisibleChange:()=>{i(V(F({},t),{visible:!t.visible}))}},disabled:d.edit,onChange:b=>{i(V(F({},t),{value:b.target.value}))},value:t.value}),!d.edit&&c.jsx(B.Button,{className:"pw-cancel",onClick:()=>{h(!0),p(V(F({},d),{setPw:!0})),a(V(F({},r),{password:null}))},children:e("Cancel")}),!d.edit&&c.jsx(B.Button,{className:"pw-submit",onClick:()=>{h(!0),p({setPw:!1,edit:!0}),a(V(F({},r),{password:t.value}))},children:e("Submit")}),d.edit&&c.jsx(B.Button,{className:"pw-edit",onClick:()=>{p({setPw:!1,edit:!1})},children:e("Edit")})]})]}),r.id&&y&&c.jsx(B.Form.Item,{className:"submit",children:c.jsx(B.Button,{type:"primary",onClick:I,block:!0,children:e("Save")})})]})},sn=n=>{const{styles:r}=De(),{t:a}=m.useTranslation();return c.jsx(B.Collapse,{items:[{key:"1",label:`${a("Expand Settings")}`,children:c.jsx(bt,F({},n))}],bordered:!1,className:r.collapse,expandIconPosition:"end"})},ln=W.connect(n=>{const r=m.usePageExtendComponentContext(),{disablePageHeader:a,enableSharePage:o,isExtra:e}=r,t=q.useMatch("/share/:name"),[i,l]=D.useState(!1),{t:s}=m.useTranslation(),{styles:d}=re(),p=yt(),y=!t&&e,{currentUserCtx:h}=m.useCurrentUserVariable(),u=!e&&a&&o&&!t,f=m.usePageExtendComponentContext(),{fieldSchema:g}=f,I=D.useMemo(()=>{const w=Object.entries(g.properties||{}).map(([v,P],S)=>({label:P.title||`${s("Tab")}${S+1}`,value:P["x-uid"],xUid:P["x-uid"],schemaName:v,title:P.title}));return w.length>1&&w.unshift({label:s("Select all"),value:"all",xUid:"",schemaName:"",title:""}),w},[g]),x={linkStatus:!0,password:null,permanent:!1,shareTime:null,permission:"view",generateLink:null,createdBy:h,updatedBy:h,tabs:I},[M,b]=D.useState(x),[C,L]=D.useState(!1);return p&&c.jsxs(c.Fragment,{children:[y&&c.jsx(B.Button,{icon:c.jsx(K.ShareAltOutlined,{}),onClick:()=>{l(!0)},style:{visibility:`${o?"visible":"hidden"}`}}),u&&c.jsx("div",{className:"tb-page-header-button",children:c.jsx(B.Button,{icon:c.jsx(K.ShareAltOutlined,{}),onClick:()=>{l(!0)},children:s("Share")})}),c.jsxs(B.Modal,{open:i,className:`${d.firstmodal} ${C?d.historyModal:""}`,footer:null,width:500,closable:!1,children:[c.jsxs("div",{className:"modal-title",children:[c.jsx("div",{className:"title",children:C?c.jsxs("div",{className:"history-title",children:[c.jsx(m.Icon,{type:"LeftOutlined",onClick:()=>{L(!1)}}),c.jsxs("div",{children:[" ",s("Historical records")]})]}):c.jsx("div",{className:"share-title",children:s("Share")})}),c.jsxs("div",{className:"modalIcon",children:[!C&&c.jsx(m.Icon,{type:"clockCircleOutlined",onClick:()=>{L(!0)}}),c.jsx(m.Icon,{type:"closeOutlined",onClick:()=>{l(!1),b(x)}})]})]}),c.jsx(Ae.Provider,{value:{shareValue:M,setShareValue:b},children:C?c.jsx(Ct,{}):c.jsx(wt,{allTabs:I})})]})]})}),wt=n=>{var I;const{allTabs:r}=n,{styles:a}=re(),o=m.useCompile(),{t:e}=m.useTranslation(),{shareValue:t,setShareValue:i}=ke(),l=m.usePageExtendComponentContext(),{fieldSchema:s={},title:d=""}=l,y=((I=s==null?void 0:s["x-component-props"])==null?void 0:I.hidePageTitle)?void 0:s.title||o(d),{copyLink:h,imageAction:u}=gt({title:y,uid:s["x-uid"]}),[f,g]=D.useState(!1);return c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:`${a.secondmodal} secondmodal`,children:[c.jsxs("div",{className:"tb-header-modal-list",onClick:h,children:[c.jsx(m.Icon,{type:"PaperClipOutlined"}),e("Copy link")]}),c.jsxs("div",{className:"tb-header-modal-list",onClick:()=>{g(!0)},children:[c.jsx(m.Icon,{type:"QrcodeOutlined"}),e("Generate QR code")]})]}),c.jsx(sn,{shareValue:t,setShareValue:i,allTabs:r}),c.jsx(B.Modal,{className:a.imageModal,open:f,footer:null,onCancel:()=>{g(!1)},children:u?u():null})]})},Ct=n=>{const{style:r}=n,[a,o]=D.useState([]),{currentUserCtx:e}=m.useCurrentUserVariable(),{styles:t}=Ue(),{t:i}=m.useTranslation(),{run:l}=m.useRequest({resource:"sharePageConfig",action:"list",params:{filter:{createdById:e.id},sort:["-createdAt"]}},{manual:!0,onSuccess(s){var p;const d=(p=s==null?void 0:s.data)==null?void 0:p.map(y=>({key:y.id,label:_(y.createdAt).format("YYYY-MM-DD")+i("Add"),children:c.jsx(cn,{item:y}),extra:c.jsx(un,{item:y,run:l})}));o(d)}});return D.useEffect(()=>{e&&l()},[e]),c.jsx("div",{className:`${t.collapse} ${r}`,children:c.jsx(B.Collapse,{items:a,collapsible:"icon"})})},cn=({item:n})=>{const[r,a]=D.useState(n);return c.jsx(bt,{shareValue:r,setShareValue:a})},un=({item:n,run:r})=>{const{styles:a}=Ue(),o=m.useAPIClient(),[e,t]=D.useState(!1),i=o.resource("sharePageConfig"),{copyLink:l,imageAction:s}=gt({}),{styles:d}=re(),{t:p}=m.useTranslation(),[y,h]=D.useState(n.linkStatus),u=(f,g)=>{switch(f){case"del":i.destroy({filterByTk:n.id}).then(I=>{r(),B.message.success(p("The deletion was successful."))});break;case"qr":t(!0);break;case"link":l(`${n.generateLink}/${n.id}`);break;case"status":i.update({filterByTk:n.id,values:V(F({},n),{linkStatus:g})});break}};return c.jsxs("div",{className:`${a.collapseExtra} collapseExtra`,children:[c.jsx(m.Icon,{type:"deleteOutlined",onClick:()=>{u("del")}}),c.jsx(m.Icon,{type:"qrcodeOutlined",onClick:()=>{u("qr")}}),c.jsx(m.Icon,{type:"linkOutlined",onClick:()=>{u("link")}}),c.jsx(B.Switch,{size:"small",checked:y,onClick:f=>{h(f),u("status",f)}}),e&&c.jsx(B.Modal,{className:d.imageModal,open:e,footer:null,onCancel:()=>{t(!1)},children:s?s(`${n.generateLink}/${n.id}`):null})]})},dn=n=>{const{setIsVerify:r,data:a,modalVisible:o,setModalVisible:e}=n,{t}=m.useTranslation(),{shareTime:i,createdBy:l,linkStatus:s}=(a==null?void 0:a.data)||{},{styles:d}=It(),{id:p}=q.useParams(),[y,h]=D.useState(!0),u=i?_(i).format("YYYY-MM-DD"):t("Permanently valid"),[f,g]=D.useState(""),[I,x]=D.useState(!1),{run:M}=m.useRequest({resource:"sharePageConfig",action:"verifyIn",method:"post",params:{values:{password:f,id:p}}},{manual:!0,onSuccess(w){w.data.valid?(r(!0),e(!1),sessionStorage.setItem("sharePassword",a.data.password),sessionStorage.setItem("sharePassword-id",a.data.id)):x(!0)}}),{pathname:b,search:C}=q.useLocation(),L=q.useNavigate();return D.useEffect(()=>{y&&i&&_().isAfter(i)?(h(!1),B.message.warning(t("The link has expired. If you need to retrieve it again, please contact the relevant personnel"))):!(a!=null&&a.data)&&y?(h(!1),B.message.warning(t("The link does not exist. Please confirm if the link is correct or contact the relevant personnel"))):!s&&y&&(h(!1),B.message.warning(t("This link is currently not open. If you have any questions, please contact the relevant personnel")))},[]),y&&c.jsx(B.Modal,{open:o,title:`${t("From")}(${l==null?void 0:l.nickname})${t("Sharing")}`,onCancel:()=>{e(!1);const w=`?redirent=${b}${C}`;L(`/signin${w}`)},className:d.modal,onOk:()=>{M()},children:c.jsxs("div",{children:[c.jsxs("div",{children:[t("Please enter the sharing password"),c.jsx(B.Input,{onChange:w=>{g(w.target.value),I&&x(!1)}}),c.jsxs("div",{className:"error",style:{visibility:I?"visible":"hidden"},children:[c.jsx(K.ExclamationCircleFilled,{}),t("Password error, please re-enter")]})]}),c.jsxs("div",{className:"shareTime",children:[t("Link timeliness"),":",u]})]})})};function hn(){const n=new URL(window.location.href),r=m.useAPIClient(),a=n.searchParams.get("token");return a&&r.auth.setToken(a),r.auth.getToken()}const fn=()=>{var e,t,i,l,s;const{styles:n}=kt(),r=m.useApp(),a=m.useSystemSettings(),o=D.useRef();return c.jsx(B.Layout,{style:{height:"100%"},children:c.jsxs(B.Layout.Content,{className:Bt.css`
|
|
207
349
|
display: flex;
|
|
208
350
|
flex-direction: column;
|
|
209
351
|
position: relative;
|
|
@@ -219,7 +361,7 @@ Minimum version required to store current data is: `+E+`.
|
|
|
219
361
|
z-index: 0;
|
|
220
362
|
padding: 0px 50px;
|
|
221
363
|
}
|
|
222
|
-
`,children:[
|
|
364
|
+
`,children:[c.jsx(B.Layout.Header,{className:n.header,children:c.jsxs("div",{className:n.headerA,children:[c.jsxs("div",{className:n.headerB,children:[c.jsxs("div",{className:n.titleContainer,onClick:()=>{location.href=r.adminUrl},children:[c.jsx("img",{className:n.logo,src:(i=(t=(e=a==null?void 0:a.data)==null?void 0:e.data)==null?void 0:t.logo)==null?void 0:i.url}),c.jsx("h1",{className:n.title,children:(s=(l=a==null?void 0:a.data)==null?void 0:l.data)==null?void 0:s.title})]}),c.jsx(m.MenuEditor,{sideMenuRef:o}),c.jsx("div",{className:n.headerTabs,children:c.jsx(m.AdminTabs,{})})]}),c.jsxs("div",{className:n.right,children:[c.jsx(m.PinnedPluginList,{belongToFilter:"pinnedmenu"}),c.jsx(m.CurrentUser,{})]})]})}),c.jsx("div",{style:{padding:"0px 5px"},children:c.jsx(At.Outlet,{})})]})})},gn=()=>{var p,y,h,u,f;hn();const{id:n}=q.useParams(),r=location.href,a=r.substring(0,r.lastIndexOf("/")),{data:o}=m.useRequest({resource:"sharePageConfig",action:"get",params:{filter:{id:n,generateLink:a},appends:["createdBy"]}}),[e,t]=D.useState(!1),[i,l]=D.useState(!0),s=sessionStorage.getItem("sharePassword"),d=sessionStorage.getItem("sharePassword-id");return(s&&d===n&&((p=o==null?void 0:o.data)!=null&&p.linkStatus)&&!e&&!_().isAfter((y=o==null?void 0:o.data)==null?void 0:y.shareTime)||(h=o==null?void 0:o.data)!=null&&h.linkStatus&&!((u=o==null?void 0:o.data)!=null&&u.password)&&!e&&!_().isAfter((f=o==null?void 0:o.data)==null?void 0:f.shareTime))&&t(!0),c.jsx(m.AdminProvider,{children:e?c.jsx(fn,{}):c.jsx(dn,{data:o,isVerify:e,setIsVerify:t,modalVisible:i,setModalVisible:l})})};function pn(){const n=q.useParams();return c.jsx(m.RemoteSchemaComponent,{uid:n.name})}const mn=()=>{var e;const{dn:n}=m.useDesignable(),{t:r}=m.useTranslation(),a=W.useFieldSchema(),{title:o}=m.useSchemaToolbar();return{title:r("Enable Share page"),checked:(e=a["x-component-props"])==null?void 0:e.enableSharePage,onChange(t){a["x-component-props"]=a["x-component-props"]||{},a["x-component-props"].enableSharePage=t,a["x-extend-components"]=V(F({},a["x-extend-components"]),{ShareButton:{name:"ShareButton",component:"ShareButton"}}),a.title||(a.title=o),n.emit("patch",{schema:{"x-uid":a["x-uid"],"x-component-props":a["x-component-props"],"x-extend-components":a["x-extend-components"],title:a.title}}),n.refresh()}}},yn=({fieldSchema:n})=>{var e;const{t:r}=m.useTranslation(),{title:a}=m.useSchemaToolbar(),{dn:o}=m.useDesignable();return c.jsx(m.SchemaSettingsSwitchItem,{checked:(e=n["x-component-props"])==null?void 0:e.enableSharePage,title:r("Enable Share page"),onChange:t=>ne(null,null,function*(){n["x-component-props"]=n["x-component-props"]||{},n["x-component-props"].enableSharePage=t,n["x-extend-components"]=V(F({},n["x-extend-components"]),{sharePage:{name:"sharePage",component:"MShareModal"}}),n.title||(n.title=a),o.emit("patch",{schema:{"x-uid":n["x-uid"],"x-component-props":n["x-component-props"],"x-extend-components":n["x-extend-components"],title:n.title}}),o.refresh()})})},bn=z.createStyles(({css:n,token:r})=>({firstmodal:n`
|
|
223
365
|
.ant-modal-content {
|
|
224
366
|
position: relative;
|
|
225
367
|
overflow: hidden;
|
|
@@ -254,64 +396,70 @@ Minimum version required to store current data is: `+E+`.
|
|
|
254
396
|
font-weight: 400;
|
|
255
397
|
}
|
|
256
398
|
}
|
|
257
|
-
.ant-modal-body {
|
|
258
|
-
justify-items: center;
|
|
259
|
-
}
|
|
260
399
|
}
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
justify-content: center;
|
|
264
|
-
align-items: center;
|
|
265
|
-
width: 100%;
|
|
266
|
-
margin-top: 20px;
|
|
267
|
-
margin-bottom: 40px;
|
|
268
|
-
position: relative;
|
|
269
|
-
gap: 15%;
|
|
270
|
-
padding-left: 8%;
|
|
271
|
-
padding-right: 8%;
|
|
272
|
-
.tb-header-modal-list {
|
|
273
|
-
width: 50%;
|
|
274
|
-
gap: 10px;
|
|
275
|
-
display: flex;
|
|
276
|
-
flex-direction: column;
|
|
277
|
-
justify-content: center;
|
|
278
|
-
text-align: center;
|
|
279
|
-
border: 1px solid transparent;
|
|
280
|
-
border-color: rgba(203, 227, 254, 0.62);
|
|
281
|
-
box-shadow: none;
|
|
282
|
-
border-radius: 12px;
|
|
283
|
-
padding: 16px;
|
|
284
|
-
transition:
|
|
285
|
-
box-shadow 0.2s ease,
|
|
286
|
-
transform 0.2s ease;
|
|
287
|
-
z-index: 1;
|
|
288
|
-
position: relative;
|
|
289
|
-
&:hover {
|
|
290
|
-
border-color: rgba(0, 120, 255, 0.3);
|
|
291
|
-
box-shadow: 0 4px 16px rgba(0, 120, 255, 0.15);
|
|
292
|
-
}
|
|
293
|
-
&:active {
|
|
294
|
-
box-shadow: none;
|
|
295
|
-
transform: translateY(2px);
|
|
296
|
-
}
|
|
297
|
-
.anticon {
|
|
400
|
+
.ant-modal-body {
|
|
401
|
+
.modal-title {
|
|
298
402
|
width: 100%;
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
403
|
+
position: relative;
|
|
404
|
+
.title {
|
|
405
|
+
flex: 1;
|
|
406
|
+
text-align: center;
|
|
407
|
+
font-size: large;
|
|
408
|
+
font-weight: 400;
|
|
409
|
+
.history-title {
|
|
410
|
+
font-weight: normal;
|
|
411
|
+
text-align: left;
|
|
412
|
+
font-size: 1rem;
|
|
413
|
+
display: flex;
|
|
414
|
+
padding: 0 20px;
|
|
415
|
+
margin-bottom: 5px;
|
|
416
|
+
margin-top: 15px;
|
|
417
|
+
.anticon {
|
|
418
|
+
padding: 0 5px 0 5px;
|
|
419
|
+
&:hover {
|
|
420
|
+
background-color: #ebebeb;
|
|
421
|
+
cursor: pointer;
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
.share-title {
|
|
426
|
+
margin: 20px 0;
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
.modalIcon {
|
|
430
|
+
position: absolute;
|
|
431
|
+
top: -15px;
|
|
432
|
+
right: 7px;
|
|
433
|
+
.anticon {
|
|
434
|
+
font-size: 18px;
|
|
435
|
+
padding: 8px;
|
|
436
|
+
&:hover {
|
|
437
|
+
background-color: #ebebeb;
|
|
438
|
+
cursor: pointer;
|
|
439
|
+
}
|
|
440
|
+
}
|
|
304
441
|
}
|
|
305
442
|
}
|
|
306
|
-
.
|
|
307
|
-
|
|
443
|
+
.secondmodal {
|
|
444
|
+
display: flex;
|
|
445
|
+
justify-content: center;
|
|
446
|
+
align-items: center;
|
|
447
|
+
width: 100%;
|
|
448
|
+
margin-top: 20px;
|
|
449
|
+
margin-bottom: 40px;
|
|
450
|
+
position: relative;
|
|
451
|
+
gap: 15%;
|
|
452
|
+
padding-left: 8%;
|
|
453
|
+
padding-right: 8%;
|
|
308
454
|
}
|
|
309
455
|
}
|
|
310
|
-
`,
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
456
|
+
`,collapse:n`
|
|
457
|
+
.ant-collapse-extra {
|
|
458
|
+
width: 100%;
|
|
459
|
+
.collapseExtra {
|
|
460
|
+
width: 100%;
|
|
461
|
+
display: flex;
|
|
462
|
+
justify-content: space-between;
|
|
463
|
+
}
|
|
316
464
|
}
|
|
317
|
-
`})),
|
|
465
|
+
`})),wn=()=>{const{fieldSchema:n,isHeaderEnabled:r,enabledSharePage:a}=m.usePageExtendComponentContext();n==null||n["x-uid"];const{styles:o}=bn(),{t:e}=m.useTranslation(),{currentUserCtx:t}=m.useCurrentUserVariable(),[i,l]=D.useState(!1),s=m.useCompile(),d=D.useMemo(()=>{var I,x;const g=Object.entries(((x=(I=n.properties)==null?void 0:I.tabs)==null?void 0:x.properties)||n.properties||{}).map(([M,b],C)=>({label:s(b.title)||`${e("Tab")}${C+1}`,value:b["x-uid"],xUid:b["x-uid"],schemaName:M,title:b.title}));return g.length>1&&g.unshift({label:e("Select all"),value:"all",xUid:"",schemaName:"",title:""}),g},[n]),p={linkStatus:!0,password:null,permanent:!1,shareTime:null,permission:"view",generateLink:null,createdBy:t,updatedBy:t,tabs:d},[y,h]=D.useState(p),[u,f]=D.useState(!1);return c.jsxs(c.Fragment,{children:[r&&a&&c.jsx(B.Button,{icon:c.jsx(K.ShareAltOutlined,{}),onClick:()=>{l(!0)}}),!r&&a&&c.jsx("div",{style:{display:"flex",justifyContent:"end",backgroundColor:"#ffffff",paddingRight:"20px"},children:c.jsx(B.Button,{icon:c.jsx(K.ShareAltOutlined,{}),style:{border:"none"},onClick:()=>{l(!0)}})}),c.jsxs(B.Modal,{open:i,className:o.firstmodal,footer:null,width:300,closable:!1,children:[c.jsxs("div",{className:"modal-title",children:[c.jsx("div",{className:"title",children:u?c.jsxs("div",{className:"history-title",children:[c.jsx(m.Icon,{type:"LeftOutlined",onClick:()=>{f(!1)}}),c.jsxs("div",{children:[" ",e("Historical records")]})]}):c.jsx("div",{className:"share-title",children:e("Share")})}),c.jsxs("div",{className:"modalIcon",children:[!u&&c.jsx(m.Icon,{type:"clockCircleOutlined",onClick:()=>{f(!0)}}),c.jsx(m.Icon,{type:"closeOutlined",onClick:()=>{l(!1),h(p)}})]})]}),c.jsx(Ae.Provider,{value:{shareValue:y,setShareValue:h},children:u?c.jsx(Ct,{style:o.collapse}):c.jsx(wt,{allTabs:d})})]})]})};class xt extends m.Plugin{load(){return ne(this,null,function*(){this.app.addProvider(on),this.app.addComponents({ShareButton:ln,MEnableSharePage:yn,MShareModal:wn}),this.router.add("share",{path:"/share",Component:gn}),this.router.add("share.page",{path:"/share/:name/:id",Component:pn}),this.schemaSettingsManager.addItem("MPage:Dropdown","Menablesharepage",{type:"item",useVisible(){return!q.useMatch("/share/:name/:id")},Component:"MEnableSharePage"}),this.schemaSettingsManager.addItem("PageSettings","enablesharepage",{type:"switch",useVisible(){const r=q.useMatch("/share/:name/:id"),a=yt();return!r&&a},useComponentProps:mn})})}}U.PluginShareClient=xt,U.default=xt,Object.defineProperties(U,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export declare const useModalStyles: (props?: unknown) => import("antd-style").ReturnStyles<{
|
|
2
2
|
firstmodal: import("antd-style").SerializedStyles;
|
|
3
|
-
|
|
4
|
-
imageModal: import("antd-style").SerializedStyles;
|
|
3
|
+
collapse: import("antd-style").SerializedStyles;
|
|
5
4
|
}>;
|