@next-bricks/ai-portal 0.40.0 → 0.40.1
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/bricks.json +35 -35
- package/dist/chunks/{8176.2a3975e1.js → 8176.0dd744df.js} +2 -2
- package/dist/chunks/{8176.2a3975e1.js.map → 8176.0dd744df.js.map} +1 -1
- package/dist/chunks/chat-box.6ae456b3.js +2 -0
- package/dist/chunks/chat-box.6ae456b3.js.map +1 -0
- package/dist/chunks/{chat-input.2bd1c748.js → chat-input.11a041ff.js} +3 -3
- package/dist/chunks/{chat-input.2bd1c748.js.map → chat-input.11a041ff.js.map} +1 -1
- package/dist/chunks/{main.1b2393f2.js → main.41cfca3c.js} +2 -2
- package/dist/chunks/{main.1b2393f2.js.map → main.41cfca3c.js.map} +1 -1
- package/dist/examples.json +13 -13
- package/dist/{index.890818f5.js → index.624ef877.js} +2 -2
- package/dist/{index.890818f5.js.map → index.624ef877.js.map} +1 -1
- package/dist/manifest.json +266 -266
- package/dist/types.json +190 -190
- package/package.json +2 -2
- package/dist/chunks/chat-box.37df7bc1.js +0 -2
- package/dist/chunks/chat-box.37df7bc1.js.map +0 -1
- /package/dist/chunks/{chat-input.2bd1c748.js.LICENSE.txt → chat-input.11a041ff.js.LICENSE.txt} +0 -0
package/dist/types.json
CHANGED
|
@@ -1,113 +1,4 @@
|
|
|
1
1
|
{
|
|
2
|
-
"ai-portal.home-container": {
|
|
3
|
-
"properties": [],
|
|
4
|
-
"events": [],
|
|
5
|
-
"methods": []
|
|
6
|
-
},
|
|
7
|
-
"ai-portal.stat-with-mini-chart": {
|
|
8
|
-
"properties": [
|
|
9
|
-
{
|
|
10
|
-
"name": "label",
|
|
11
|
-
"annotation": {
|
|
12
|
-
"type": "keyword",
|
|
13
|
-
"value": "string"
|
|
14
|
-
}
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
"name": "value",
|
|
18
|
-
"annotation": {
|
|
19
|
-
"type": "keyword",
|
|
20
|
-
"value": "string"
|
|
21
|
-
}
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
"name": "size",
|
|
25
|
-
"annotation": {
|
|
26
|
-
"type": "union",
|
|
27
|
-
"types": [
|
|
28
|
-
{
|
|
29
|
-
"type": "jsLiteral",
|
|
30
|
-
"value": "medium"
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
"type": "jsLiteral",
|
|
34
|
-
"value": "small"
|
|
35
|
-
}
|
|
36
|
-
]
|
|
37
|
-
}
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
"name": "lineColor",
|
|
41
|
-
"annotation": {
|
|
42
|
-
"type": "keyword",
|
|
43
|
-
"value": "string"
|
|
44
|
-
}
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
"name": "showArea",
|
|
48
|
-
"annotation": {
|
|
49
|
-
"type": "keyword",
|
|
50
|
-
"value": "boolean"
|
|
51
|
-
}
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
"name": "min",
|
|
55
|
-
"annotation": {
|
|
56
|
-
"type": "keyword",
|
|
57
|
-
"value": "number"
|
|
58
|
-
}
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
"name": "max",
|
|
62
|
-
"annotation": {
|
|
63
|
-
"type": "keyword",
|
|
64
|
-
"value": "number"
|
|
65
|
-
}
|
|
66
|
-
},
|
|
67
|
-
{
|
|
68
|
-
"name": "xField",
|
|
69
|
-
"annotation": {
|
|
70
|
-
"type": "keyword",
|
|
71
|
-
"value": "string"
|
|
72
|
-
}
|
|
73
|
-
},
|
|
74
|
-
{
|
|
75
|
-
"name": "yField",
|
|
76
|
-
"annotation": {
|
|
77
|
-
"type": "keyword",
|
|
78
|
-
"value": "string"
|
|
79
|
-
}
|
|
80
|
-
},
|
|
81
|
-
{
|
|
82
|
-
"name": "data",
|
|
83
|
-
"annotation": {
|
|
84
|
-
"type": "array",
|
|
85
|
-
"elementType": {
|
|
86
|
-
"type": "reference",
|
|
87
|
-
"typeName": {
|
|
88
|
-
"type": "identifier",
|
|
89
|
-
"name": "Record"
|
|
90
|
-
},
|
|
91
|
-
"typeParameters": {
|
|
92
|
-
"type": "typeParameterInstantiation",
|
|
93
|
-
"params": [
|
|
94
|
-
{
|
|
95
|
-
"type": "keyword",
|
|
96
|
-
"value": "string"
|
|
97
|
-
},
|
|
98
|
-
{
|
|
99
|
-
"type": "keyword",
|
|
100
|
-
"value": "number"
|
|
101
|
-
}
|
|
102
|
-
]
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
],
|
|
108
|
-
"events": [],
|
|
109
|
-
"methods": []
|
|
110
|
-
},
|
|
111
2
|
"ai-portal.icon-button": {
|
|
112
3
|
"properties": [
|
|
113
4
|
{
|
|
@@ -179,6 +70,92 @@
|
|
|
179
70
|
}
|
|
180
71
|
]
|
|
181
72
|
},
|
|
73
|
+
"ai-portal.home-container": {
|
|
74
|
+
"properties": [],
|
|
75
|
+
"events": [],
|
|
76
|
+
"methods": []
|
|
77
|
+
},
|
|
78
|
+
"ai-portal.page-container": {
|
|
79
|
+
"properties": [
|
|
80
|
+
{
|
|
81
|
+
"name": "pageTitle",
|
|
82
|
+
"annotation": {
|
|
83
|
+
"type": "keyword",
|
|
84
|
+
"value": "string"
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
"name": "breadcrumbs",
|
|
89
|
+
"annotation": {
|
|
90
|
+
"type": "array",
|
|
91
|
+
"elementType": {
|
|
92
|
+
"type": "reference",
|
|
93
|
+
"typeName": {
|
|
94
|
+
"type": "identifier",
|
|
95
|
+
"name": "Breadcrumb"
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
"name": "size",
|
|
102
|
+
"annotation": {
|
|
103
|
+
"type": "union",
|
|
104
|
+
"types": [
|
|
105
|
+
{
|
|
106
|
+
"type": "jsLiteral",
|
|
107
|
+
"value": "medium"
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
"type": "jsLiteral",
|
|
111
|
+
"value": "small"
|
|
112
|
+
}
|
|
113
|
+
]
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
"name": "textContent",
|
|
118
|
+
"annotation": {
|
|
119
|
+
"type": "keyword",
|
|
120
|
+
"value": "string"
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
],
|
|
124
|
+
"events": [],
|
|
125
|
+
"methods": [],
|
|
126
|
+
"types": [
|
|
127
|
+
{
|
|
128
|
+
"type": "interface",
|
|
129
|
+
"name": "Breadcrumb",
|
|
130
|
+
"body": [
|
|
131
|
+
{
|
|
132
|
+
"type": "propertySignature",
|
|
133
|
+
"key": {
|
|
134
|
+
"type": "identifier",
|
|
135
|
+
"name": "text"
|
|
136
|
+
},
|
|
137
|
+
"annotation": {
|
|
138
|
+
"type": "keyword",
|
|
139
|
+
"value": "string"
|
|
140
|
+
},
|
|
141
|
+
"computed": false
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
"type": "propertySignature",
|
|
145
|
+
"key": {
|
|
146
|
+
"type": "identifier",
|
|
147
|
+
"name": "url"
|
|
148
|
+
},
|
|
149
|
+
"annotation": {
|
|
150
|
+
"type": "keyword",
|
|
151
|
+
"value": "string"
|
|
152
|
+
},
|
|
153
|
+
"computed": false
|
|
154
|
+
}
|
|
155
|
+
]
|
|
156
|
+
}
|
|
157
|
+
]
|
|
158
|
+
},
|
|
182
159
|
"ai-portal.entity-sdk-get": {
|
|
183
160
|
"type": "provider",
|
|
184
161
|
"params": [
|
|
@@ -384,87 +361,6 @@
|
|
|
384
361
|
}
|
|
385
362
|
}
|
|
386
363
|
},
|
|
387
|
-
"ai-portal.page-container": {
|
|
388
|
-
"properties": [
|
|
389
|
-
{
|
|
390
|
-
"name": "pageTitle",
|
|
391
|
-
"annotation": {
|
|
392
|
-
"type": "keyword",
|
|
393
|
-
"value": "string"
|
|
394
|
-
}
|
|
395
|
-
},
|
|
396
|
-
{
|
|
397
|
-
"name": "breadcrumbs",
|
|
398
|
-
"annotation": {
|
|
399
|
-
"type": "array",
|
|
400
|
-
"elementType": {
|
|
401
|
-
"type": "reference",
|
|
402
|
-
"typeName": {
|
|
403
|
-
"type": "identifier",
|
|
404
|
-
"name": "Breadcrumb"
|
|
405
|
-
}
|
|
406
|
-
}
|
|
407
|
-
}
|
|
408
|
-
},
|
|
409
|
-
{
|
|
410
|
-
"name": "size",
|
|
411
|
-
"annotation": {
|
|
412
|
-
"type": "union",
|
|
413
|
-
"types": [
|
|
414
|
-
{
|
|
415
|
-
"type": "jsLiteral",
|
|
416
|
-
"value": "medium"
|
|
417
|
-
},
|
|
418
|
-
{
|
|
419
|
-
"type": "jsLiteral",
|
|
420
|
-
"value": "small"
|
|
421
|
-
}
|
|
422
|
-
]
|
|
423
|
-
}
|
|
424
|
-
},
|
|
425
|
-
{
|
|
426
|
-
"name": "textContent",
|
|
427
|
-
"annotation": {
|
|
428
|
-
"type": "keyword",
|
|
429
|
-
"value": "string"
|
|
430
|
-
}
|
|
431
|
-
}
|
|
432
|
-
],
|
|
433
|
-
"events": [],
|
|
434
|
-
"methods": [],
|
|
435
|
-
"types": [
|
|
436
|
-
{
|
|
437
|
-
"type": "interface",
|
|
438
|
-
"name": "Breadcrumb",
|
|
439
|
-
"body": [
|
|
440
|
-
{
|
|
441
|
-
"type": "propertySignature",
|
|
442
|
-
"key": {
|
|
443
|
-
"type": "identifier",
|
|
444
|
-
"name": "text"
|
|
445
|
-
},
|
|
446
|
-
"annotation": {
|
|
447
|
-
"type": "keyword",
|
|
448
|
-
"value": "string"
|
|
449
|
-
},
|
|
450
|
-
"computed": false
|
|
451
|
-
},
|
|
452
|
-
{
|
|
453
|
-
"type": "propertySignature",
|
|
454
|
-
"key": {
|
|
455
|
-
"type": "identifier",
|
|
456
|
-
"name": "url"
|
|
457
|
-
},
|
|
458
|
-
"annotation": {
|
|
459
|
-
"type": "keyword",
|
|
460
|
-
"value": "string"
|
|
461
|
-
},
|
|
462
|
-
"computed": false
|
|
463
|
-
}
|
|
464
|
-
]
|
|
465
|
-
}
|
|
466
|
-
]
|
|
467
|
-
},
|
|
468
364
|
"ai-portal.tab-list": {
|
|
469
365
|
"properties": [
|
|
470
366
|
{
|
|
@@ -536,6 +432,110 @@
|
|
|
536
432
|
}
|
|
537
433
|
]
|
|
538
434
|
},
|
|
435
|
+
"ai-portal.stat-with-mini-chart": {
|
|
436
|
+
"properties": [
|
|
437
|
+
{
|
|
438
|
+
"name": "label",
|
|
439
|
+
"annotation": {
|
|
440
|
+
"type": "keyword",
|
|
441
|
+
"value": "string"
|
|
442
|
+
}
|
|
443
|
+
},
|
|
444
|
+
{
|
|
445
|
+
"name": "value",
|
|
446
|
+
"annotation": {
|
|
447
|
+
"type": "keyword",
|
|
448
|
+
"value": "string"
|
|
449
|
+
}
|
|
450
|
+
},
|
|
451
|
+
{
|
|
452
|
+
"name": "size",
|
|
453
|
+
"annotation": {
|
|
454
|
+
"type": "union",
|
|
455
|
+
"types": [
|
|
456
|
+
{
|
|
457
|
+
"type": "jsLiteral",
|
|
458
|
+
"value": "medium"
|
|
459
|
+
},
|
|
460
|
+
{
|
|
461
|
+
"type": "jsLiteral",
|
|
462
|
+
"value": "small"
|
|
463
|
+
}
|
|
464
|
+
]
|
|
465
|
+
}
|
|
466
|
+
},
|
|
467
|
+
{
|
|
468
|
+
"name": "lineColor",
|
|
469
|
+
"annotation": {
|
|
470
|
+
"type": "keyword",
|
|
471
|
+
"value": "string"
|
|
472
|
+
}
|
|
473
|
+
},
|
|
474
|
+
{
|
|
475
|
+
"name": "showArea",
|
|
476
|
+
"annotation": {
|
|
477
|
+
"type": "keyword",
|
|
478
|
+
"value": "boolean"
|
|
479
|
+
}
|
|
480
|
+
},
|
|
481
|
+
{
|
|
482
|
+
"name": "min",
|
|
483
|
+
"annotation": {
|
|
484
|
+
"type": "keyword",
|
|
485
|
+
"value": "number"
|
|
486
|
+
}
|
|
487
|
+
},
|
|
488
|
+
{
|
|
489
|
+
"name": "max",
|
|
490
|
+
"annotation": {
|
|
491
|
+
"type": "keyword",
|
|
492
|
+
"value": "number"
|
|
493
|
+
}
|
|
494
|
+
},
|
|
495
|
+
{
|
|
496
|
+
"name": "xField",
|
|
497
|
+
"annotation": {
|
|
498
|
+
"type": "keyword",
|
|
499
|
+
"value": "string"
|
|
500
|
+
}
|
|
501
|
+
},
|
|
502
|
+
{
|
|
503
|
+
"name": "yField",
|
|
504
|
+
"annotation": {
|
|
505
|
+
"type": "keyword",
|
|
506
|
+
"value": "string"
|
|
507
|
+
}
|
|
508
|
+
},
|
|
509
|
+
{
|
|
510
|
+
"name": "data",
|
|
511
|
+
"annotation": {
|
|
512
|
+
"type": "array",
|
|
513
|
+
"elementType": {
|
|
514
|
+
"type": "reference",
|
|
515
|
+
"typeName": {
|
|
516
|
+
"type": "identifier",
|
|
517
|
+
"name": "Record"
|
|
518
|
+
},
|
|
519
|
+
"typeParameters": {
|
|
520
|
+
"type": "typeParameterInstantiation",
|
|
521
|
+
"params": [
|
|
522
|
+
{
|
|
523
|
+
"type": "keyword",
|
|
524
|
+
"value": "string"
|
|
525
|
+
},
|
|
526
|
+
{
|
|
527
|
+
"type": "keyword",
|
|
528
|
+
"value": "number"
|
|
529
|
+
}
|
|
530
|
+
]
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
],
|
|
536
|
+
"events": [],
|
|
537
|
+
"methods": []
|
|
538
|
+
},
|
|
539
539
|
"ai-portal.project-knowledges": {
|
|
540
540
|
"properties": [
|
|
541
541
|
{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@next-bricks/ai-portal",
|
|
3
|
-
"version": "0.40.
|
|
3
|
+
"version": "0.40.1",
|
|
4
4
|
"homepage": "https://github.com/easyops-cn/next-advanced-bricks/tree/master/bricks/ai-portal",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -48,5 +48,5 @@
|
|
|
48
48
|
"@next-bricks/presentational": "*",
|
|
49
49
|
"@next-bricks/vs": "*"
|
|
50
50
|
},
|
|
51
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "0e7f234ee24672c2d11decb86d68d408fbf45b4a"
|
|
52
52
|
}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";(globalThis.webpackChunk_next_bricks_ai_portal=globalThis.webpackChunk_next_bricks_ai_portal||[]).push([[6573],{433:(e,t,n)=>{n.d(t,{I:()=>s,K:()=>a,NS:()=>l,t:()=>u});var o=n(87117);let a=function(e){return e.ASK_ANY_THING="ASK_ANYTHING",e.COMMON_TASKS="COMMON_TASKS",e}({});const i={[a.ASK_ANY_THING]:"Ask anything",[a.COMMON_TASKS]:"Common tasks"},r={[a.ASK_ANY_THING]:"询问任何问题",[a.COMMON_TASKS]:"常用任务"},l="bricks/ai-portal/chat-box",s={en:i,zh:r},u=o.i18n.getFixedT(null,l)},20062:e=>{e.exports=function(e,t){return t||(t={}),e?(e=String(e.__esModule?e.default:e),/^['"].*['"]$/.test(e)&&(e=e.slice(1,-1)),t.hash&&(e+=t.hash),/["'() \t\n]|(%20)/.test(e)||t.needQuotes?'"'.concat(e.replace(/"/g,'\\"').replace(/\n/g,"\\n"),'"'):e):e}},24586:(e,t,n)=>{n.d(t,{A:()=>a});var o=n(11369);function a(e,t,n){return(t=(0,o.A)(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}},47008:(e,t,n)=>{n.d(t,{A:()=>p});var o=n(36758),a=n.n(o),i=n(40935),r=n.n(i),l=n(20062),s=n.n(l),u=new URL(n(47336),n.b),c=r()(a()),d=s()(u);c.push([e.id,`:host{display:block}:host([hidden]){display:none}*{box-sizing:border-box}.root{color:#262626;background:url(${d}) no-repeat center bottom;background-size:100% 104px;padding:12px 12px 29px}.container{position:relative;background:#ffffff;box-shadow:0px 2px 4px 0px rgba(38,45,65,0.1);border-radius:16px;border:1px solid #dadfe8}.container:has(textarea:focus){border-color:#b7c3d8}textarea{display:block;width:100%;padding:10px 16px 50px;color:var(--antd-input-color);border-radius:16px;-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);border:1px solid rgba(255,255,255,0.5);font-size:14px;line-height:22px;height:120px}textarea::placeholder{color:rgba(0,0,0,0.4)}.btn-send:focus,\ntextarea:focus{outline:none}.actions-bar{position:absolute;bottom:12px;left:14px;right:14px;display:flex;align-items:flex-end;justify-content:space-between}.btn-send{width:28px;height:28px;display:flex;align-items:center;justify-content:center;background:var(--elevo-color-brand);border:none;border-radius:8px;color:#fff;flex-shrink:0}.btn-send[disabled]{background:rgba(0,0,0,0.15)}.btn-send:not([disabled]){cursor:pointer}.btn-send:not([disabled]):hover{background:#5166ff}.btn-send:not([disabled]):active{background:#1e33cc}`,""]);const p=c.toString()},47336:(e,t,n)=>{e.exports=n.p+"images/25c20165.png"},67707:(e,t,n)=>{n.r(t),n.d(t,{ChatBox:()=>F,ChatBoxComponent:()=>V,LegacyChatBoxComponent:()=>D});var o,a=n(74635),i=n(70918),r=n(24586),l=n(26902),s=n(5536),u=n(86121),c=n(70829),d=n(62740),p=n(18769),h=n.n(p),b=n(7921),f=n(11280),m=n(71451),g=(n(65168),n(87117)),x=n(433),v=n(47008);let S,w,A,k,y,C,z,R,_,N,E,M;(0,g.initializeI18n)(x.NS,x.I);const K=(0,f.wrapBrick)("eo-icon"),{defineElement:T,property:B,event:H,method:I}=(0,b.createDecorators)(),V=(0,p.forwardRef)(D);let F;var O=new WeakMap,P=new WeakMap,W=new WeakMap,Y=new WeakMap,G=new WeakSet,$=new WeakMap;class j extends f.ReactNextElement{constructor(){super(...arguments),(0,a.A)(this,G),(0,r.A)(this,"ref",(S(this),(0,p.createRef)())),(0,i.A)(this,O,A(this)),(0,i.A)(this,P,(k(this),y(this))),(0,i.A)(this,W,(C(this),z(this))),(0,i.A)(this,Y,(R(this),_(this))),(0,i.A)(this,$,(M(this),e=>{(0,s.A)(G,this,N).emit(e)}))}get disabled(){return(0,c.A)(O,this)}set disabled(e){(0,u.A)(O,this,e)}get placeholder(){return(0,c.A)(P,this)}set placeholder(e){(0,u.A)(P,this,e)}get autoFocus(){return(0,c.A)(W,this)}set autoFocus(e){(0,u.A)(W,this,e)}setValue(e){var t;null===(t=this.ref.current)||void 0===t||t.setValue(e)}getValue(){var e;return null===(e=this.ref.current)||void 0===e?void 0:e.getValue()}render(){return h().createElement(V,{disabled:this.disabled,placeholder:this.placeholder,autoFocus:this.autoFocus,onSubmit:(0,c.A)($,this),ref:this.ref})}}function D(e,t){let{disabled:n,placeholder:o,autoFocus:a,onSubmit:i}=e;const r=(0,p.useRef)(null),l=(0,p.useRef)(null),[s,u]=(0,p.useState)(""),c=(0,p.useRef)("");(0,p.useImperativeHandle)(t,(()=>({setValue:e=>{c.current=e,u(e)},getValue:()=>c.current})));const d=(0,p.useCallback)((e=>{e.currentTarget.value&&i(e.currentTarget.value)}),[i]),b=(0,p.useCallback)((e=>{c.current=e.target.value,u(e.target.value)}),[]),f=(0,p.useCallback)((()=>{i(c.current)}),[i]);return(0,p.useEffect)((()=>{a&&Promise.resolve().then((()=>{var e;null===(e=l.current)||void 0===e||e.focus()}))}),[]),h().createElement("div",{className:"root"},h().createElement("div",{className:"container",ref:r},h().createElement(m.e,{containerRef:r,ref:l,value:s,minRows:58/22,paddingSize:60,autoResize:!0,disabled:n,placeholder:null!=o?o:(0,x.t)(x.K.ASK_ANY_THING),submitWhen:"enter-without-shift",onSubmit:d,onChange:b}),h().createElement("div",{className:"actions-bar"},h().createElement("div",null,h().createElement("slot",{name:"actions"})),h().createElement("button",{className:"btn-send",disabled:!s,onClick:f},h().createElement(K,{lib:"fa",prefix:"fas",icon:"arrow-up"})))))}o=j,({e:[A,k,y,C,z,R,_,N,E,M,S],c:[F,w]}=(0,d.A)(o,[T("ai-portal.chat-box",{styleTexts:[v.A]})],[[B({type:Boolean}),1,"disabled"],[B(),1,"placeholder"],[B({type:Boolean}),1,"autoFocus"],[H({type:"message.submit"}),1,"messageSubmit",e=>(0,c.A)(Y,e),(e,t)=>(0,u.A)(Y,e,t)],[I(),2,"setValue"],[I(),2,"getValue"]],0,(e=>$.has((0,l.A)(e))),f.ReactNextElement)),w()},71451:(e,t,n)=>{n.d(t,{e:()=>c});var o=n(89575),a=n(18769),i=n(59435),r=n(99126);const l=["letter-spacing","line-height","padding-top","padding-bottom","font-family","font-weight","font-size","font-variant","text-rendering","text-transform","width","text-indent","padding-left","padding-right","border-width","box-sizing","word-break","white-space"];let s;const u=/Mac|iPod|iPhone|iPad/.test(navigator.platform)?"metaKey":"ctrlKey",c=a.forwardRef(d);function d(e,t){let{autoResize:n,minRows:c,maxRows:d,borderSize:p,paddingSize:h,containerRef:b,value:f,style:m,submitWhen:g,onChange:x,onSubmit:v,onKeyDown:S,onCompositionStart:w,onCompositionEnd:A,...k}=e;const y=null==n||n,[C,z]=(0,a.useState)(null!=f?f:""),R=(0,a.useRef)(null),[_,N]=(0,a.useState)(null);(0,a.useImperativeHandle)(t,(()=>({focus:()=>{const e=R.current;if(e){var t;const n=null===(t=e.value)||void 0===t?void 0:t.length;e.focus(),n&&e.setSelectionRange(n,n)}}})),[]);const E=(0,a.useCallback)((()=>{const e=R.current;if(e&&y){const t=function(e,t){const{minRows:n=null,maxRows:o=null,borderSize:a=2,paddingSize:i=8}=null!=t?t:{};s||(s=document.createElement("textarea"),s.setAttribute("tab-index","-1"),s.setAttribute("aria-hidden","true"),document.body.appendChild(s));const r=window.getComputedStyle(e),u=l.map((e=>`${e}:${r.getPropertyValue(e)}`)).join(";");let c,d,p;s.setAttribute("style",`${u};\n min-height: 0!important;\n max-height: none!important;\n height: 0!important;\n visibility: hidden!important;\n overflow: hidden!important;\n position: absolute!important;\n z-index: -1000!important;\n top: 0!important;\n right: 0!important;\n pointer-events: none!important;\n`),s.value=e.value||e.placeholder||"";let h=s.scrollHeight+a;if(null!==n||null!==o){const e=parseFloat(window.getComputedStyle(s).getPropertyValue("line-height"));null!==n&&(c=e*n+i+a,h=Math.max(c,h)),null!==o&&(d=e*o+i+a,h<=d&&(p="hidden"),h=Math.min(d,h))}const b={height:h,overflowY:p,resize:"none"};return c&&(b.minHeight=c),d&&(b.maxHeight=d),b}(e,{minRows:c,maxRows:d,borderSize:p,paddingSize:h});(0,i.flushSync)((()=>{N(t)}))}}),[y,d,c,p,h]);(0,a.useEffect)((()=>{z(null!=f?f:"")}),[f]),(0,a.useEffect)((()=>{E()}),[E,C]);const M=(0,a.useRef)(!1),K=(0,a.useCallback)((e=>{M.current=!0,null==w||w(e)}),[w]),T=(0,a.useCallback)((e=>{M.current=!1,null==A||A(e)}),[A]),B=(0,a.useCallback)((e=>{M.current||("Enter"===e.key&&("enter-without-shift"===g?!e.shiftKey:"enter-with-mod"===g&&e[u])&&(e.preventDefault(),e.stopPropagation(),null==v||v(e)),null==S||S(e))}),[S,v,g]);return(0,a.useEffect)((()=>{const e=null==b?void 0:b.current;if(!e||!y)return;let t;const n=new r.A((n=>{for(const o of n)if(o.target===e){const e=o.contentBoxSize?o.contentBoxSize[0]?o.contentBoxSize[0].inlineSize:o.contentBoxSize.inlineSize:o.contentRect.width;if(void 0!==e&&e!==t){const n=!t;t=e,n||requestAnimationFrame(E)}}}));return n.observe(e),()=>{n.disconnect()}}),[y,b,E]),a.createElement("textarea",(0,o.A)({},k,{ref:R,value:C,style:{...m,..._},onChange:e=>{z(e.target.value),null==x||x(e)},onCompositionStart:K,onCompositionEnd:T,onKeyDown:B}))}}}]);
|
|
2
|
-
//# sourceMappingURL=chat-box.37df7bc1.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"chunks/chat-box.37df7bc1.js","mappings":"oMAEO,IAAKA,EAAC,SAADA,GAAC,OAADA,EAAC,6BAADA,EAAC,4BAADA,CAAC,MAKb,MAAMC,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AE,GAEhB,CAAC+C,EAAWzD,EAAU0B,IAuCxB,OAnCAX,EAAAA,EAAAA,YAAU,KACR,MAAMuF,EAAYpG,aAAY,EAAZA,EAAcP,QAChC,IAAK2G,IAAc7E,EACjB,OAEF,IAAI8E,EACJ,MAAMC,EAAW,IAAIC,EAAAA,GAAgBC,IACnC,IAAK,MAAMC,KAASD,EAClB,GAAIC,EAAM9F,SAAWyF,EAAW,CAE9B,MAAMM,EAAoBD,EAAME,eAC5BF,EAAME,eAAe,GACnBF,EAAME,eAAe,GAAGC,WACvBH,EAAME,eACJC,WACLH,EAAMI,YAAYC,MACtB,QACwBC,IAAtBL,GACAA,IAAsBL,EACtB,CACA,MAAMW,GAAaX,EACnBA,EAAqBK,EAChBM,GACHC,sBAAsB/C,EAE1B,CACF,CACF,IAGF,OADAoC,EAASY,QAAQd,GACV,KACLE,EAASa,YAAY,CACtB,GACA,CAAC5F,EAAYvB,EAAckE,IAG5BrE,EAAAA,cAAA,YAAAuH,EAAAA,EAAAA,GAAA,GACM1D,EAAK,CACTlE,IAAKU,EACLvE,MAAOA,EACP2H,MAAO,IACFA,KACAK,GAELlC,SApGFjB,IAEAlB,EAASkB,EAAEG,OAAOhF,OAClB8F,SAAAA,EAAWjB,EAAE,EAkGXgD,mBAAoBsC,EACpBrC,iBAAkBsC,EAClBxC,UAAWyC,IAGjB,C","sources":["webpack:///./src/chat-box/i18n.ts","webpack:///../../node_modules/css-loader/dist/runtime/getUrl.js","webpack:///../../node_modules/@babel/runtime/helpers/esm/defineProperty.js","webpack:///./src/chat-box/styles.shadow.css","webpack:///./src/chat-box/index.tsx","webpack:///../../../src/utils/calculateAutoSizeStyle.ts","webpack:///../../src/TextareaAutoResize.tsx"],"sourcesContent":["import { i18n } from \"@next-core/i18n\";\n\nexport enum K {\n ASK_ANY_THING = \"ASK_ANYTHING\",\n COMMON_TASKS = \"COMMON_TASKS\",\n}\n\nconst en: Locale = {\n [K.ASK_ANY_THING]: \"Ask anything\",\n [K.COMMON_TASKS]: \"Common tasks\",\n};\n\nconst zh: Locale = {\n [K.ASK_ANY_THING]: \"询问任何问题\",\n [K.COMMON_TASKS]: \"常用任务\",\n};\n\nexport const NS = \"bricks/ai-portal/chat-box\";\n\nexport const locales = { en, zh };\n\nexport const t = i18n.getFixedT(null, NS);\n\ntype Locale = { [k in K]: string } & {\n [k in K as `${k}_plural`]?: string;\n};\n","\"use strict\";\n\nmodule.exports = function (url, options) {\n if (!options) {\n options = {};\n }\n if (!url) {\n return url;\n }\n url = String(url.__esModule ? url.default : url);\n\n // If url is already wrapped in quotes, remove them\n if (/^['\"].*['\"]$/.test(url)) {\n url = url.slice(1, -1);\n }\n if (options.hash) {\n url += options.hash;\n }\n\n // Should url be wrapped?\n // See https://drafts.csswg.org/css-values-3/#urls\n if (/[\"'() \\t\\n]|(%20)/.test(url) || options.needQuotes) {\n return \"\\\"\".concat(url.replace(/\"/g, '\\\\\"').replace(/\\n/g, \"\\\\n\"), \"\\\"\");\n }\n return url;\n};","import toPropertyKey from \"./toPropertyKey.js\";\nexport default function _defineProperty(obj, key, value) {\n key = toPropertyKey(key);\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n return obj;\n}","// Imports\nimport ___CSS_LOADER_API_NO_SOURCEMAP_IMPORT___ from \"../../../../node_modules/css-loader/dist/runtime/noSourceMaps.js\";\nimport ___CSS_LOADER_API_IMPORT___ from \"../../../../node_modules/css-loader/dist/runtime/api.js\";\nimport ___CSS_LOADER_GET_URL_IMPORT___ from \"../../../../node_modules/css-loader/dist/runtime/getUrl.js\";\nvar ___CSS_LOADER_URL_IMPORT_0___ = new URL(\"./images/bg.png\", import.meta.url);\nvar ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(___CSS_LOADER_API_NO_SOURCEMAP_IMPORT___);\nvar ___CSS_LOADER_URL_REPLACEMENT_0___ = ___CSS_LOADER_GET_URL_IMPORT___(___CSS_LOADER_URL_IMPORT_0___);\n// Module\n___CSS_LOADER_EXPORT___.push([module.id, `:host{display:block}:host([hidden]){display:none}*{box-sizing:border-box}.root{color:#262626;background:url(${___CSS_LOADER_URL_REPLACEMENT_0___}) no-repeat center bottom;background-size:100% 104px;padding:12px 12px 29px}.container{position:relative;background:#ffffff;box-shadow:0px 2px 4px 0px rgba(38,45,65,0.1);border-radius:16px;border:1px solid #dadfe8}.container:has(textarea:focus){border-color:#b7c3d8}textarea{display:block;width:100%;padding:10px 16px 50px;color:var(--antd-input-color);border-radius:16px;-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);border:1px solid rgba(255,255,255,0.5);font-size:14px;line-height:22px;height:120px}textarea::placeholder{color:rgba(0,0,0,0.4)}.btn-send:focus,\ntextarea:focus{outline:none}.actions-bar{position:absolute;bottom:12px;left:14px;right:14px;display:flex;align-items:flex-end;justify-content:space-between}.btn-send{width:28px;height:28px;display:flex;align-items:center;justify-content:center;background:var(--elevo-color-brand);border:none;border-radius:8px;color:#fff;flex-shrink:0}.btn-send[disabled]{background:rgba(0,0,0,0.15)}.btn-send:not([disabled]){cursor:pointer}.btn-send:not([disabled]):hover{background:#5166ff}.btn-send:not([disabled]):active{background:#1e33cc}`, \"\"]);\n// Exports\nexport default ___CSS_LOADER_EXPORT___.toString();\n","import React, {\n forwardRef,\n useCallback,\n useEffect,\n useRef,\n useState,\n useImperativeHandle,\n createRef,\n} from \"react\";\nimport { createDecorators, type EventEmitter } from \"@next-core/element\";\nimport { ReactNextElement, wrapBrick } from \"@next-core/react-element\";\nimport {\n TextareaAutoResize,\n type TextareaAutoResizeRef,\n} from \"@next-shared/form\";\nimport \"@next-core/theme\";\nimport { initializeI18n } from \"@next-core/i18n\";\nimport type {\n GeneralIcon,\n GeneralIconProps,\n} from \"@next-bricks/icons/general-icon\";\nimport { K, NS, locales, t } from \"./i18n.js\";\nimport styleText from \"./styles.shadow.css\";\n\ninitializeI18n(NS, locales);\n\nconst WrappedIcon = wrapBrick<GeneralIcon, GeneralIconProps>(\"eo-icon\");\n\nconst { defineElement, property, event, method } = createDecorators();\n\nexport const ChatBoxComponent = forwardRef(LegacyChatBoxComponent);\n\nexport interface ChatBoxProps {\n disabled?: boolean;\n placeholder?: string;\n autoFocus?: boolean;\n}\n\nexport interface ChatBoxRef {\n setValue: (value: string) => void;\n getValue: () => string;\n}\n\n/**\n * 构件 `ai-portal.chat-box`\n */\nexport\n@defineElement(\"ai-portal.chat-box\", {\n styleTexts: [styleText],\n})\nclass ChatBox extends ReactNextElement implements ChatBoxProps {\n ref = createRef<ChatBoxRef>();\n\n @property({ type: Boolean })\n accessor disabled: boolean | undefined;\n\n @property()\n accessor placeholder: string | undefined;\n\n @property({ type: Boolean })\n accessor autoFocus: boolean | undefined;\n\n @event({ type: \"message.submit\" })\n accessor #messageSubmit!: EventEmitter<string>;\n\n #handleMessageSubmit = (value: string) => {\n this.#messageSubmit.emit(value);\n };\n\n @method()\n setValue(value: string) {\n this.ref.current?.setValue(value);\n }\n\n @method()\n getValue() {\n return this.ref.current?.getValue();\n }\n\n render() {\n return (\n <ChatBoxComponent\n disabled={this.disabled}\n placeholder={this.placeholder}\n autoFocus={this.autoFocus}\n onSubmit={this.#handleMessageSubmit}\n ref={this.ref}\n />\n );\n }\n}\n\nexport interface ChatBoxComponentProps extends ChatBoxProps {\n // Define react event handlers here.\n onSubmit: (value: string) => void;\n ref?: React.Ref<ChatBoxRef>;\n}\n\nexport function LegacyChatBoxComponent(\n { disabled, placeholder, autoFocus, onSubmit }: ChatBoxComponentProps,\n ref: React.Ref<ChatBoxRef>\n) {\n const containerRef = useRef<HTMLDivElement>(null);\n const textareaRef = useRef<TextareaAutoResizeRef>(null);\n const [value, setValue] = useState(\"\");\n const valueRef = useRef(\"\");\n\n useImperativeHandle(ref, () => ({\n setValue: (value: string) => {\n valueRef.current = value;\n setValue(value);\n },\n getValue: () => {\n return valueRef.current;\n },\n }));\n\n const handleSubmit = useCallback(\n (e: React.FormEvent<HTMLTextAreaElement>) => {\n if (e.currentTarget.value) {\n onSubmit(e.currentTarget.value);\n }\n },\n [onSubmit]\n );\n\n const handleChange = useCallback(\n (e: React.ChangeEvent<HTMLTextAreaElement>) => {\n valueRef.current = e.target.value;\n setValue(e.target.value);\n },\n []\n );\n\n const handleSubmitClick = useCallback(() => {\n onSubmit(valueRef.current);\n }, [onSubmit]);\n\n useEffect(\n () => {\n if (autoFocus) {\n Promise.resolve().then(() => {\n textareaRef.current?.focus();\n });\n }\n },\n // One-time focus\n // eslint-disable-next-line react-hooks/exhaustive-deps\n []\n );\n\n return (\n <div className=\"root\">\n <div className=\"container\" ref={containerRef}>\n <TextareaAutoResize\n containerRef={containerRef}\n ref={textareaRef}\n value={value}\n minRows={58 / 22}\n paddingSize={60}\n autoResize\n disabled={disabled}\n placeholder={placeholder ?? t(K.ASK_ANY_THING)}\n submitWhen=\"enter-without-shift\"\n onSubmit={handleSubmit}\n onChange={handleChange}\n />\n <div className=\"actions-bar\">\n <div>\n <slot name=\"actions\"></slot>\n </div>\n <button\n className=\"btn-send\"\n disabled={!value}\n onClick={handleSubmitClick}\n >\n <WrappedIcon lib=\"fa\" prefix=\"fas\" icon=\"arrow-up\" />\n </button>\n </div>\n </div>\n </div>\n );\n}\n","// istanbul ignore file\nimport type React from \"react\";\n\nconst HIDDEN_TEXTAREA_STYLE = `\n min-height: 0!important;\n max-height: none!important;\n height: 0!important;\n visibility: hidden!important;\n overflow: hidden!important;\n position: absolute!important;\n z-index: -1000!important;\n top: 0!important;\n right: 0!important;\n pointer-events: none!important;\n`;\n\nconst SIZING_STYLE = [\n \"letter-spacing\",\n \"line-height\",\n \"padding-top\",\n \"padding-bottom\",\n \"font-family\",\n \"font-weight\",\n \"font-size\",\n \"font-variant\",\n \"text-rendering\",\n \"text-transform\",\n \"width\",\n \"text-indent\",\n \"padding-left\",\n \"padding-right\",\n \"border-width\",\n \"box-sizing\",\n \"word-break\",\n \"white-space\",\n];\n\nlet hiddenTextarea: HTMLTextAreaElement | undefined;\n\nexport interface AutoSizeOptions {\n minRows?: number | null;\n maxRows?: number | null;\n borderSize?: number;\n paddingSize?: number;\n}\n\n/**\n * 计算 textarea 高度\n * https://github.com/react-component/textarea/blob/1c0026fbe30e5f7dff1fca695b2cf262246381ca/src/calculateNodeHeight.tsx\n */\nexport default function calculateAutoSizeStyle(\n uiTextNode: HTMLTextAreaElement,\n options?: AutoSizeOptions\n): React.CSSProperties {\n const {\n minRows = null,\n maxRows = null,\n borderSize = 2,\n paddingSize = 8,\n } = options ?? {};\n\n if (!hiddenTextarea) {\n hiddenTextarea = document.createElement(\"textarea\");\n hiddenTextarea.setAttribute(\"tab-index\", \"-1\");\n hiddenTextarea.setAttribute(\"aria-hidden\", \"true\");\n document.body.appendChild(hiddenTextarea);\n }\n\n const uiTextNodeStyle = window.getComputedStyle(uiTextNode);\n const sizingStyle = SIZING_STYLE.map(\n (name) => `${name}:${uiTextNodeStyle.getPropertyValue(name)}`\n ).join(\";\");\n\n // equal style\n hiddenTextarea.setAttribute(\n \"style\",\n `${sizingStyle};${HIDDEN_TEXTAREA_STYLE}`\n );\n hiddenTextarea.value = uiTextNode.value || uiTextNode.placeholder || \"\";\n\n let minHeight: number | undefined;\n let maxHeight: number | undefined;\n let overflowY: React.CSSProperties[\"overflowY\"];\n\n let height = hiddenTextarea.scrollHeight + borderSize;\n\n if (minRows !== null || maxRows !== null) {\n const singleRowHeight =\n process.env.NODE_ENV === \"test\"\n ? 22\n : parseFloat(\n window\n .getComputedStyle(hiddenTextarea)\n .getPropertyValue(\"line-height\")\n );\n if (minRows !== null) {\n minHeight = singleRowHeight * minRows + paddingSize + borderSize;\n height = Math.max(minHeight, height);\n }\n if (maxRows !== null) {\n maxHeight = singleRowHeight * maxRows + paddingSize + borderSize;\n if (height <= maxHeight) {\n overflowY = \"hidden\";\n }\n height = Math.min(maxHeight, height);\n }\n }\n\n const style: React.CSSProperties = {\n height,\n overflowY,\n resize: \"none\",\n };\n\n if (minHeight) {\n style.minHeight = minHeight;\n }\n if (maxHeight) {\n style.maxHeight = maxHeight;\n }\n\n return style;\n}\n","import React, {\n useCallback,\n useEffect,\n useImperativeHandle,\n useRef,\n useState,\n} from \"react\";\nimport { flushSync } from \"react-dom\";\nimport ResizeObserver from \"resize-observer-polyfill\";\nimport calculateAutoSizeStyle from \"./utils/calculateAutoSizeStyle.js\";\n\n// istanbul ignore next\nconst modKey = /Mac|iPod|iPhone|iPad/.test(navigator.platform)\n ? \"metaKey\"\n : \"ctrlKey\";\n\nexport interface TextareaAutoResizeProps\n extends React.DetailedHTMLProps<\n React.TextareaHTMLAttributes<HTMLTextAreaElement>,\n HTMLTextAreaElement\n > {\n /** @default true */\n autoResize?: boolean;\n minRows?: number | null;\n maxRows?: number | null;\n /** @default 2 */\n borderSize?: number;\n /** @default 8 */\n paddingSize?: number;\n containerRef?: React.RefObject<HTMLElement>;\n submitWhen?: \"enter-without-shift\" | \"enter-with-mod\";\n}\n\nexport interface TextareaAutoResizeRef {\n focus(): void;\n}\n\nexport const TextareaAutoResize = React.forwardRef<\n TextareaAutoResizeRef,\n TextareaAutoResizeProps\n>(LegacyTextareaAutoResize);\n\nfunction LegacyTextareaAutoResize(\n {\n autoResize: _autoResize,\n minRows,\n maxRows,\n borderSize,\n paddingSize,\n containerRef,\n value: propValue,\n style,\n submitWhen,\n onChange,\n onSubmit,\n onKeyDown,\n onCompositionStart,\n onCompositionEnd,\n ...props\n }: TextareaAutoResizeProps,\n ref: React.ForwardedRef<TextareaAutoResizeRef>\n): React.JSX.Element {\n const autoResize = _autoResize ?? true;\n const [value, setValue] = useState(propValue ?? \"\");\n const textareaRef = useRef<HTMLTextAreaElement>(null);\n const [autoStyle, setAutoStyle] = useState<React.CSSProperties | null>(null);\n\n useImperativeHandle(\n ref,\n () => ({\n focus: () => {\n const textarea = textareaRef.current;\n // istanbul ignore else: defensive check\n if (textarea) {\n const valueLength = textarea.value?.length;\n textarea.focus();\n valueLength && textarea.setSelectionRange(valueLength, valueLength);\n }\n },\n }),\n []\n );\n\n const doAutoResize = useCallback(() => {\n const textarea = textareaRef.current;\n if (textarea && autoResize) {\n const style = calculateAutoSizeStyle(textarea, {\n minRows,\n maxRows,\n borderSize,\n paddingSize,\n });\n // istanbul ignore next\n if (process.env.NODE_ENV === \"test\") {\n setAutoStyle(style);\n } else {\n flushSync(() => {\n setAutoStyle(style);\n });\n }\n }\n }, [autoResize, maxRows, minRows, borderSize, paddingSize]);\n\n const handleInputChange = (\n e: React.ChangeEvent<HTMLTextAreaElement>\n ): void => {\n setValue(e.target.value);\n onChange?.(e);\n };\n\n useEffect(() => {\n setValue(propValue ?? \"\");\n }, [propValue]);\n\n useEffect(() => {\n doAutoResize();\n }, [doAutoResize, value]);\n\n const compositionRef = useRef(false);\n\n const handleCompositionStart = useCallback(\n (e: React.CompositionEvent<HTMLTextAreaElement>) => {\n compositionRef.current = true;\n onCompositionStart?.(e);\n },\n [onCompositionStart]\n );\n\n const handleCompositionEnd = useCallback(\n (e: React.CompositionEvent<HTMLTextAreaElement>) => {\n compositionRef.current = false;\n onCompositionEnd?.(e);\n },\n [onCompositionEnd]\n );\n\n const handleKeyDown = useCallback(\n (e: React.KeyboardEvent<HTMLTextAreaElement>) => {\n if (compositionRef.current) {\n // Ignore key events during composition\n return;\n }\n\n if (\n e.key === \"Enter\" &&\n (submitWhen === \"enter-without-shift\"\n ? !e.shiftKey\n : submitWhen === \"enter-with-mod\" && e[modKey])\n ) {\n e.preventDefault();\n e.stopPropagation();\n onSubmit?.(e);\n }\n\n onKeyDown?.(e);\n },\n [onKeyDown, onSubmit, submitWhen]\n );\n\n // istanbul ignore next\n useEffect(() => {\n const container = containerRef?.current;\n if (!container || !autoResize) {\n return;\n }\n let previousInlineSize: number | undefined;\n const observer = new ResizeObserver((entries) => {\n for (const entry of entries) {\n if (entry.target === container) {\n // istanbul ignore next: compatibility\n const currentInlineSize = entry.contentBoxSize\n ? entry.contentBoxSize[0]\n ? entry.contentBoxSize[0].inlineSize\n : (entry.contentBoxSize as unknown as ResizeObserverSize)\n .inlineSize\n : entry.contentRect.width;\n if (\n currentInlineSize !== undefined &&\n currentInlineSize !== previousInlineSize\n ) {\n const isInitial = !previousInlineSize;\n previousInlineSize = currentInlineSize;\n if (!isInitial) {\n requestAnimationFrame(doAutoResize);\n }\n }\n }\n }\n });\n observer.observe(container);\n return () => {\n observer.disconnect();\n };\n }, [autoResize, containerRef, doAutoResize]);\n\n return (\n <textarea\n {...props}\n ref={textareaRef}\n value={value}\n style={{\n ...style,\n ...autoStyle,\n }}\n onChange={handleInputChange}\n onCompositionStart={handleCompositionStart}\n onCompositionEnd={handleCompositionEnd}\n onKeyDown={handleKeyDown}\n />\n );\n}\n"],"names":["K","en","ASK_ANY_THING","COMMON_TASKS","zh","NS","locales","t","i18n","getFixedT","module","exports","url","options","String","__esModule","default","test","slice","hash","needQuotes","concat","replace","_defineProperty","obj","key","value","Object","defineProperty","enumerable","configurable","writable","___CSS_LOADER_URL_IMPORT_0___","URL","___CSS_LOADER_EXPORT___","___CSS_LOADER_URL_REPLACEMENT_0___","push","id","toString","initializeI18n","WrappedIcon","wrapBrick","defineElement","property","event","method","createDecorators","ChatBoxComponent","forwardRef","LegacyChatBoxComponent","_ChatBox","_A","WeakMap","_B","_C","_D","_ChatBox_brand","WeakSet","_handleMessageSubmit","ChatBox","ReactNextElement","constructor","arguments","_classPrivateMethodInitSpec","_initProto","createRef","_classPrivateFieldInitSpec","_init_disabled","_init_extra_disabled","_init_placeholder","_init_extra_placeholder","_init_autoFocus","_init_extra_autoFocus","_init_messageSubmit","_init_extra_messageSubmit","_classPrivateGetter","this","_get_messageSubmit","emit","disabled","_classPrivateFieldGet","v","_classPrivateFieldSet","placeholder","autoFocus","setValue","_this$ref$current","ref","current","getValue","_this$ref$current2","render","React","onSubmit","_ref","containerRef","useRef","textareaRef","useState","valueRef","useImperativeHandle","handleSubmit","useCallback","e","currentTarget","handleChange","target","handleSubmitClick","useEffect","Promise","resolve","then","_textareaRef$current","focus","className","TextareaAutoResize","minRows","paddingSize","autoResize","submitWhen","onChange","name","onClick","lib","prefix","icon","_ChatBox2","_set_messageSubmit","c","_initClass","_applyDecs","styleTexts","styleText","type","Boolean","o","_","has","_checkInRHS","SIZING_STYLE","hiddenTextarea","modKey","navigator","platform","LegacyTextareaAutoResize","_autoResize","maxRows","borderSize","propValue","style","onKeyDown","onCompositionStart","onCompositionEnd","props","autoStyle","setAutoStyle","textarea","_textarea$value","valueLength","length","setSelectionRange","doAutoResize","uiTextNode","document","createElement","setAttribute","body","appendChild","uiTextNodeStyle","window","getComputedStyle","sizingStyle","map","getPropertyValue","join","minHeight","maxHeight","overflowY","height","scrollHeight","singleRowHeight","parseFloat","Math","max","min","resize","calculateAutoSizeStyle","flushSync","compositionRef","handleCompositionStart","handleCompositionEnd","handleKeyDown","shiftKey","preventDefault","stopPropagation","container","previousInlineSize","observer","ResizeObserver","entries","entry","currentInlineSize","contentBoxSize","inlineSize","contentRect","width","undefined","isInitial","requestAnimationFrame","observe","disconnect","_extends"],"sourceRoot":""}
|
/package/dist/chunks/{chat-input.2bd1c748.js.LICENSE.txt → chat-input.11a041ff.js.LICENSE.txt}
RENAMED
|
File without changes
|