@lark-apaas/coding-template-nestjs-react-fullstack 0.1.60-alpha.20261105142153 → 0.1.60-beta.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.
Files changed (33) hide show
  1. package/package.json +1 -1
  2. package/template/client/src/components/business-ui/README.md +0 -2
  3. package/template/package-lock.json +30 -546
  4. package/template/package.json +3 -14
  5. package/template/scripts/build.sh +39 -22
  6. package/template/scripts/prune-smart.js +20 -1
  7. package/template/client/src/components/business-ui/comments/README.md +0 -101
  8. package/template/client/src/components/business-ui/comments/comments.tsx +0 -670
  9. package/template/client/src/components/business-ui/comments/contracts.ts +0 -256
  10. package/template/client/src/components/business-ui/comments/index.ts +0 -20
  11. package/template/client/src/components/business-ui/comments/use-comments.ts +0 -492
  12. package/template/client/src/components/business-ui/record-comments/README.md +0 -141
  13. package/template/client/src/components/business-ui/record-comments/app-source.ts +0 -93
  14. package/template/client/src/components/business-ui/record-comments/assets/reaction-sprite.png +0 -0
  15. package/template/client/src/components/business-ui/record-comments/comment-panel.contract.ts +0 -240
  16. package/template/client/src/components/business-ui/record-comments/comment-panel.tsx +0 -231
  17. package/template/client/src/components/business-ui/record-comments/extensions.ts +0 -130
  18. package/template/client/src/components/business-ui/record-comments/index.ts +0 -9
  19. package/template/client/src/components/business-ui/record-comments/internal/composer.tsx +0 -531
  20. package/template/client/src/components/business-ui/record-comments/internal/content.tsx +0 -213
  21. package/template/client/src/components/business-ui/record-comments/internal/discussion.tsx +0 -523
  22. package/template/client/src/components/business-ui/record-comments/internal/editor.tsx +0 -681
  23. package/template/client/src/components/business-ui/record-comments/internal/icons.tsx +0 -148
  24. package/template/client/src/components/business-ui/record-comments/internal/images.tsx +0 -155
  25. package/template/client/src/components/business-ui/record-comments/internal/mentions.tsx +0 -163
  26. package/template/client/src/components/business-ui/record-comments/internal/model.ts +0 -581
  27. package/template/client/src/components/business-ui/record-comments/internal/mutations.ts +0 -198
  28. package/template/client/src/components/business-ui/record-comments/internal/reaction-catalog.ts +0 -196
  29. package/template/client/src/components/business-ui/record-comments/internal/reactions.tsx +0 -683
  30. package/template/client/src/components/business-ui/record-comments/internal/styles.css +0 -1109
  31. package/template/client/src/components/business-ui/record-comments/internal/suggestions.tsx +0 -456
  32. package/template/client/src/components/business-ui/record-comments/internal/view-types.ts +0 -91
  33. package/template/client/src/components/business-ui/record-comments/types.ts +0 -121
@@ -1,213 +0,0 @@
1
- import type { CommentMentionClickHandler, CommentApiContent, CommentPart, CommentValue } from '../types';
2
- import { useMentionContext, useMentionEntity, useResolveComment } from './mentions';
3
- import { mentionLabel, normalizeValue, safeUrl, USER_MENTION_CLASS, INPUT_USER_MENTION_CLASS, COMMENT_THEME_CLASS, userMentionLabelClass, atUserLabel, DOCUMENT_MENTION_CLASS, DOCUMENT_MENTION_UNREADABLE_CLASS, fromApiContent } from './model';
4
- import { cn } from '@/lib/utils';
5
- import * as React from 'react';
6
- import { DocumentIcon } from './icons';
7
-
8
- function Mention({
9
- part,
10
- onMentionClick,
11
- mentionVariant,
12
- trailing,
13
- }: {
14
- part: Extract<CommentPart, { type: 'mention' }>;
15
- onMentionClick?: CommentMentionClickHandler;
16
- mentionVariant?: 'text' | 'pill';
17
- trailing?: React.ReactNode;
18
- }) {
19
- const { strict, store, currentUserID, highlightUserIDs } =
20
- useMentionContext();
21
- const result = useMentionEntity(part.ref);
22
- const label = mentionLabel(part.ref, part.label, result, strict);
23
- if (part.ref.kind === 'document') {
24
- const resolved = result?.status === 'resolved' ? result : undefined;
25
- const documentHref = safeUrl(
26
- resolved?.href || (!strict ? part.href : undefined),
27
- );
28
- const metadata =
29
- resolved?.document || (!strict ? part.document : undefined);
30
- const title = resolved
31
- ? resolved.label
32
- : result?.status === 'forbidden' ||
33
- result?.status === 'not-found' ||
34
- strict
35
- ? label
36
- : part.label;
37
- const body = (
38
- <>
39
- {title ? (
40
- <DocumentIcon refValue={part.ref} metadata={metadata} />
41
- ) : null}
42
- <span>{title || documentHref || '文档'}</span>
43
- </>
44
- );
45
- if (documentHref)
46
- return (
47
- <a
48
- className={
49
- result?.status === 'forbidden' || resolved?.readable === false
50
- ? DOCUMENT_MENTION_UNREADABLE_CLASS
51
- : DOCUMENT_MENTION_CLASS
52
- }
53
- href={documentHref}
54
- target="_blank"
55
- rel="noopener noreferrer"
56
- data-doclink="true"
57
- data-doclink-token={part.ref.id}
58
- data-doclink-type={part.ref.resourceType}
59
- onClick={(event) => event.stopPropagation()}
60
- onMouseDown={(event) => event.preventDefault()}
61
- >
62
- {body}
63
- </a>
64
- );
65
- if (result?.status === 'error')
66
- return (
67
- <button
68
- type="button"
69
- className={DOCUMENT_MENTION_CLASS}
70
- title="信息加载失败,点击重试"
71
- onClick={() => store.ensure([part.ref], true)}
72
- >
73
- {body}
74
- </button>
75
- );
76
- return <span className={DOCUMENT_MENTION_CLASS}>{body}</span>;
77
- }
78
- const userLabelClass = userMentionLabelClass(
79
- part.ref.id === currentUserID || Boolean(highlightUserIDs?.includes(part.ref.id)),
80
- result?.status === 'forbidden',
81
- );
82
- const body = (
83
- <span
84
- className={userLabelClass}
85
- >
86
- {atUserLabel(label)}
87
- </span>
88
- );
89
- const className =
90
- mentionVariant === 'pill' ? INPUT_USER_MENTION_CLASS : USER_MENTION_CLASS;
91
- if (
92
- onMentionClick &&
93
- result?.status !== 'forbidden' &&
94
- result?.status !== 'not-found'
95
- )
96
- return (
97
- <button
98
- type="button"
99
- className={className}
100
- onClick={(event) => onMentionClick(part.ref, event.currentTarget)}
101
- >
102
- {body}
103
- </button>
104
- );
105
- if (result?.status === 'error')
106
- return (
107
- <button
108
- type="button"
109
- className={className}
110
- title="信息加载失败,点击重试"
111
- onClick={() => store.ensure([part.ref], true)}
112
- >
113
- {body}
114
- </button>
115
- );
116
- return <span className={className}>{body}</span>;
117
- }
118
-
119
- export type CommentContentProps = {
120
- className?: string;
121
- onMentionClick?: CommentMentionClickHandler;
122
- mentionVariant?: 'text' | 'pill';
123
- trailing?: React.ReactNode;
124
- } & (
125
- | { value: CommentValue; content?: never }
126
- | { content: readonly CommentApiContent[]; value?: never }
127
- );
128
-
129
- /** Pass API content with userID only; metadata is fetched internally in batches. */
130
- export function CommentContent(props: CommentContentProps) {
131
- const { className, onMentionClick, mentionVariant = 'text', trailing } = props;
132
- let normalized: CommentValue;
133
- try {
134
- normalized = props.value
135
- ? normalizeValue(props.value)
136
- : fromApiContent(props.content!);
137
- } catch {
138
- return (
139
- <p role="alert" className="text-sm text-destructive">
140
- 评论内容格式无效,无法展示
141
- </p>
142
- );
143
- }
144
- return React.createElement(ResolvedContent, {
145
- value: normalized,
146
- className,
147
- onMentionClick,
148
- mentionVariant,
149
- trailing,
150
- });
151
- }
152
-
153
- function ResolvedContent({
154
- value: normalized,
155
- className,
156
- onMentionClick,
157
- mentionVariant,
158
- trailing,
159
- }: {
160
- value: CommentValue;
161
- className?: string;
162
- onMentionClick?: CommentMentionClickHandler;
163
- mentionVariant?: 'text' | 'pill';
164
- trailing?: React.ReactNode;
165
- }) {
166
- useResolveComment(normalized);
167
- return (
168
- <div
169
- className={cn(
170
- COMMENT_THEME_CLASS,
171
- 'text-foreground text-sm leading-[22px]',
172
- className,
173
- )}
174
- >
175
- <div className="whitespace-pre-wrap break-words">
176
- {normalized.content.map((part, index) =>
177
- part.type === 'text' ? (
178
- part.text
179
- ) : part.type === 'break' ? (
180
- <br key={index} />
181
- ) : part.type === 'link' ? (
182
- <a
183
- key={index}
184
- href={safeUrl(part.url)}
185
- target="_blank"
186
- rel="noopener noreferrer"
187
- className="break-words text-primary no-underline hover:underline"
188
- onClick={(event) => event.stopPropagation()}
189
- >
190
- {part.url}
191
- </a>
192
- ) : part.type === 'unresolved-mention' ? (
193
- <span
194
- key={index}
195
- className="text-subtle-foreground"
196
- title="原评论缺少被提及对象的信息"
197
- >
198
- 引用信息缺失
199
- </span>
200
- ) : (
201
- <Mention
202
- key={index}
203
- part={part}
204
- onMentionClick={onMentionClick}
205
- mentionVariant={mentionVariant}
206
- />
207
- ),
208
- )}
209
- {trailing}
210
- </div>
211
- </div>
212
- );
213
- }