@iyulab/chat-components 0.4.0 → 0.5.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/CHANGELOG.md +124 -21
- package/README.md +133 -16
- package/dist/_virtual/_@oxc-project_runtime@0.122.0/helpers/decorate.js +9 -0
- package/dist/_virtual/_@oxc-project_runtime@0.122.0/helpers/decorateMetadata.js +6 -0
- package/dist/_virtual/_glob-assets_raw/intent-prompt.md.1907474e.js +4 -0
- package/dist/_virtual/_glob-assets_raw/view-prompt.md.e0dbcffe.js +4 -0
- package/dist/components/blocks/UCodeBlock.d.ts +24 -2
- package/dist/components/blocks/UCodeBlock.js +65 -2
- package/dist/components/blocks/UCodeBlock.styles.js +4 -4
- package/dist/components/blocks/UFileBlock.d.ts +33 -0
- package/dist/components/blocks/UFileBlock.js +154 -0
- package/dist/components/blocks/{UFilesBlock.styles.js → UFileBlock.styles.js} +12 -90
- package/dist/components/blocks/UJsonBlock.d.ts +44 -2
- package/dist/components/blocks/UJsonBlock.js +128 -3
- package/dist/components/blocks/UJsonBlock.styles.js +4 -4
- package/dist/components/blocks/UMarkedBlock.d.ts +44 -2
- package/dist/components/blocks/UMarkedBlock.js +154 -4
- package/dist/components/blocks/UMarkedBlock.styles.js +4 -4
- package/dist/components/blocks/URefBlock.d.ts +16 -2
- package/dist/components/blocks/URefBlock.js +58 -3
- package/dist/components/blocks/URefBlock.styles.js +4 -4
- package/dist/components/blocks/UTableBlock.d.ts +47 -2
- package/dist/components/blocks/UTableBlock.js +197 -4
- package/dist/components/blocks/UTableBlock.styles.js +4 -5
- package/dist/components/blocks/UTextBlock.d.ts +36 -2
- package/dist/components/blocks/UTextBlock.js +94 -4
- package/dist/components/blocks/UTextBlock.styles.js +4 -4
- package/dist/components/blocks/UThinkBlock.d.ts +30 -2
- package/dist/components/blocks/UThinkBlock.js +86 -4
- package/dist/components/blocks/UThinkBlock.styles.js +4 -4
- package/dist/components/blocks/UToolBlock.d.ts +19 -2
- package/dist/components/blocks/UToolBlock.js +68 -3
- package/dist/components/blocks/UToolBlock.styles.js +4 -4
- package/dist/components/buttons/UAttachButton.d.ts +21 -2
- package/dist/components/buttons/UAttachButton.js +61 -3
- package/dist/components/buttons/UAttachButton.styles.js +4 -4
- package/dist/components/buttons/UCopyButton.d.ts +19 -2
- package/dist/components/buttons/UCopyButton.js +57 -3
- package/dist/components/buttons/UCopyButton.styles.js +4 -4
- package/dist/components/buttons/UVoteButton.d.ts +14 -3
- package/dist/components/buttons/UVoteButton.js +62 -3
- package/dist/components/buttons/UVoteButton.styles.js +4 -4
- package/dist/components/{actions/UQuestionAction.component.d.ts → intents/UQuestionIntent.d.ts} +6 -2
- package/dist/components/intents/UQuestionIntent.js +41 -0
- package/dist/components/{actions/UQuestionAction.styles.js → intents/UQuestionIntent.styles.js} +4 -6
- package/dist/components/message/UMessage.d.ts +18 -2
- package/dist/components/message/UMessage.js +47 -2
- package/dist/components/message/UMessage.styles.js +4 -4
- package/dist/components/prompt/UPrompt.d.ts +32 -2
- package/dist/components/prompt/UPrompt.js +118 -2
- package/dist/components/prompt/UPrompt.styles.js +15 -5
- package/dist/components/references/URefCard.d.ts +30 -2
- package/dist/components/references/URefCard.js +97 -2
- package/dist/components/references/URefCard.styles.js +4 -4
- package/dist/components/references/URefCardGroup.d.ts +25 -2
- package/dist/components/references/URefCardGroup.js +69 -4
- package/dist/components/references/URefCardGroup.styles.js +4 -4
- package/dist/components/references/URefTag.d.ts +12 -2
- package/dist/components/references/URefTag.js +37 -2
- package/dist/components/references/URefTag.styles.js +4 -4
- package/dist/components/{widgets/UChartWidget.component.d.ts → views/UChartView.d.ts} +7 -4
- package/dist/components/views/UChartView.js +167 -0
- package/dist/components/{widgets/UChartWidget.styles.js → views/UChartView.styles.js} +4 -4
- package/dist/components/{widgets/UImagesWidget.component.d.ts → views/UImagesView.d.ts} +7 -4
- package/dist/components/views/UImagesView.js +144 -0
- package/dist/components/{widgets/UImagesWidget.styles.js → views/UImagesView.styles.js} +6 -5
- package/dist/components/{widgets/UMapWidget.component.d.ts → views/UMapView.d.ts} +7 -3
- package/dist/components/views/UMapView.js +45 -0
- package/dist/components/{widgets/UMapWidget.styles.js → views/UMapView.styles.js} +4 -4
- package/dist/components/{widgets/UVideoWidget.component.d.ts → views/UVideoView.d.ts} +7 -3
- package/dist/components/views/UVideoView.js +81 -0
- package/dist/components/{widgets/UVideoWidget.styles.js → views/UVideoView.styles.js} +4 -4
- package/dist/components/{widgets/UWidget.component.d.ts → views/UView.d.ts} +8 -5
- package/dist/components/views/UView.js +113 -0
- package/dist/components/{widgets/UWidget.styles.js → views/UView.styles.js} +4 -4
- package/dist/events/AttachEvent.d.ts +9 -0
- package/dist/events/ChoiceEvent.d.ts +9 -0
- package/dist/events/SendEvent.d.ts +7 -0
- package/dist/events/StopEvent.d.ts +7 -0
- package/dist/index.d.ts +13 -16
- package/dist/index.js +28 -56
- package/dist/react/UAttachButton.d.ts +11 -0
- package/dist/react/UAttachButton.js +12 -0
- package/dist/react/UChartView.d.ts +9 -0
- package/dist/react/UChartView.js +10 -0
- package/dist/react/UCodeBlock.d.ts +9 -0
- package/dist/react/UCodeBlock.js +10 -0
- package/dist/react/UCopyButton.d.ts +9 -0
- package/dist/react/UCopyButton.js +10 -0
- package/dist/react/UFileBlock.d.ts +11 -0
- package/dist/react/UFileBlock.js +12 -0
- package/dist/react/UImagesView.d.ts +9 -0
- package/dist/react/UImagesView.js +10 -0
- package/dist/react/UJsonBlock.d.ts +9 -0
- package/dist/react/UJsonBlock.js +10 -0
- package/dist/react/UMapView.d.ts +9 -0
- package/dist/react/UMapView.js +10 -0
- package/dist/react/UMarkedBlock.d.ts +9 -0
- package/dist/react/UMarkedBlock.js +10 -0
- package/dist/react/UMessage.d.ts +9 -0
- package/dist/react/UMessage.js +10 -0
- package/dist/react/UPrompt.d.ts +13 -0
- package/dist/react/UPrompt.js +13 -0
- package/dist/react/UQuestionIntent.d.ts +11 -0
- package/dist/react/UQuestionIntent.js +12 -0
- package/dist/react/URefBlock.d.ts +9 -0
- package/dist/react/URefBlock.js +10 -0
- package/dist/react/URefCard.d.ts +9 -0
- package/dist/react/URefCard.js +10 -0
- package/dist/react/URefCardGroup.d.ts +9 -0
- package/dist/react/URefCardGroup.js +10 -0
- package/dist/react/URefTag.d.ts +9 -0
- package/dist/react/URefTag.js +10 -0
- package/dist/react/UTableBlock.d.ts +9 -0
- package/dist/react/UTableBlock.js +10 -0
- package/dist/react/UTextBlock.d.ts +9 -0
- package/dist/react/UTextBlock.js +10 -0
- package/dist/react/UThinkBlock.d.ts +9 -0
- package/dist/react/UThinkBlock.js +10 -0
- package/dist/react/UToolBlock.d.ts +9 -0
- package/dist/react/UToolBlock.js +10 -0
- package/dist/react/UVideoView.d.ts +9 -0
- package/dist/react/UVideoView.js +10 -0
- package/dist/react/UView.d.ts +9 -0
- package/dist/react/UView.js +10 -0
- package/dist/react/UVoteButton.d.ts +9 -0
- package/dist/react/UVoteButton.js +10 -0
- package/dist/react/index.d.ts +23 -0
- package/dist/react/index.js +23 -0
- package/dist/types/BlockItem.d.ts +21 -32
- package/dist/types/Intents.d.ts +26 -0
- package/dist/types/Intents.js +30 -0
- package/dist/types/{Widgets.d.ts → Views.d.ts} +8 -8
- package/dist/types/Views.js +150 -0
- package/dist/utilities/IntentPromptBuilder.d.ts +40 -0
- package/dist/utilities/IntentPromptBuilder.js +95 -0
- package/dist/utilities/ViewPromptBuilder.d.ts +28 -0
- package/dist/utilities/ViewPromptBuilder.js +76 -0
- package/dist/utilities/dom-agent/DOMAgent.d.ts +74 -0
- package/dist/utilities/dom-agent/DOMController.d.ts +78 -0
- package/dist/utilities/dom-agent/DOMPromptBuilder.d.ts +54 -0
- package/dist/utilities/dom-agent/DOMScanner.d.ts +83 -0
- package/dist/utilities/dom-agent/index.d.ts +9 -0
- package/dist/utilities/dom-agent/types.d.ts +209 -0
- package/package.json +32 -16
- package/dist/assets/action-prompt.md.js +0 -3
- package/dist/assets/widget-prompt.md.js +0 -3
- package/dist/components/actions/UQuestionAction.component.js +0 -58
- package/dist/components/actions/UQuestionAction.d.ts +0 -7
- package/dist/components/actions/UQuestionAction.js +0 -5
- package/dist/components/blocks/UCodeBlock.component.d.ts +0 -25
- package/dist/components/blocks/UCodeBlock.component.js +0 -88
- package/dist/components/blocks/UFilesBlock.component.d.ts +0 -22
- package/dist/components/blocks/UFilesBlock.component.js +0 -192
- package/dist/components/blocks/UFilesBlock.d.ts +0 -7
- package/dist/components/blocks/UFilesBlock.js +0 -5
- package/dist/components/blocks/UJsonBlock.component.d.ts +0 -45
- package/dist/components/blocks/UJsonBlock.component.js +0 -140
- package/dist/components/blocks/UMarkedBlock.component.d.ts +0 -40
- package/dist/components/blocks/UMarkedBlock.component.js +0 -159
- package/dist/components/blocks/URefBlock.component.d.ts +0 -17
- package/dist/components/blocks/URefBlock.component.js +0 -73
- package/dist/components/blocks/UTableBlock.component.d.ts +0 -49
- package/dist/components/blocks/UTableBlock.component.js +0 -228
- package/dist/components/blocks/UTextBlock.component.d.ts +0 -37
- package/dist/components/blocks/UTextBlock.component.js +0 -123
- package/dist/components/blocks/UThinkBlock.component.d.ts +0 -23
- package/dist/components/blocks/UThinkBlock.component.js +0 -90
- package/dist/components/blocks/UToolBlock.component.d.ts +0 -20
- package/dist/components/blocks/UToolBlock.component.js +0 -80
- package/dist/components/buttons/UAttachButton.component.d.ts +0 -22
- package/dist/components/buttons/UAttachButton.component.js +0 -89
- package/dist/components/buttons/UCopyButton.component.d.ts +0 -20
- package/dist/components/buttons/UCopyButton.component.js +0 -81
- package/dist/components/buttons/UReportButton.component.d.ts +0 -9
- package/dist/components/buttons/UReportButton.component.js +0 -36
- package/dist/components/buttons/UReportButton.d.ts +0 -7
- package/dist/components/buttons/UReportButton.js +0 -5
- package/dist/components/buttons/UReportButton.styles.js +0 -14
- package/dist/components/buttons/URetryButton.component.d.ts +0 -11
- package/dist/components/buttons/URetryButton.component.js +0 -53
- package/dist/components/buttons/URetryButton.d.ts +0 -7
- package/dist/components/buttons/URetryButton.js +0 -5
- package/dist/components/buttons/URetryButton.styles.js +0 -26
- package/dist/components/buttons/UShareButton.component.d.ts +0 -9
- package/dist/components/buttons/UShareButton.component.js +0 -36
- package/dist/components/buttons/UShareButton.d.ts +0 -7
- package/dist/components/buttons/UShareButton.js +0 -5
- package/dist/components/buttons/UShareButton.styles.js +0 -14
- package/dist/components/buttons/UVoteButton.component.d.ts +0 -15
- package/dist/components/buttons/UVoteButton.component.js +0 -73
- package/dist/components/message/UMessage.component.d.ts +0 -19
- package/dist/components/message/UMessage.component.js +0 -56
- package/dist/components/prompt/UPrompt.component.d.ts +0 -25
- package/dist/components/prompt/UPrompt.component.js +0 -113
- package/dist/components/references/URefCard.component.d.ts +0 -27
- package/dist/components/references/URefCard.component.js +0 -109
- package/dist/components/references/URefCardGroup.component.d.ts +0 -26
- package/dist/components/references/URefCardGroup.component.js +0 -88
- package/dist/components/references/URefTag.component.d.ts +0 -13
- package/dist/components/references/URefTag.component.js +0 -54
- package/dist/components/widgets/UChartWidget.component.js +0 -180
- package/dist/components/widgets/UChartWidget.d.ts +0 -7
- package/dist/components/widgets/UChartWidget.js +0 -5
- package/dist/components/widgets/UImagesWidget.component.js +0 -164
- package/dist/components/widgets/UImagesWidget.d.ts +0 -7
- package/dist/components/widgets/UImagesWidget.js +0 -5
- package/dist/components/widgets/UMapWidget.component.js +0 -65
- package/dist/components/widgets/UMapWidget.d.ts +0 -7
- package/dist/components/widgets/UMapWidget.js +0 -5
- package/dist/components/widgets/UMapWidget.styles.d.ts +0 -1
- package/dist/components/widgets/UVideoWidget.component.js +0 -106
- package/dist/components/widgets/UVideoWidget.d.ts +0 -7
- package/dist/components/widgets/UVideoWidget.js +0 -5
- package/dist/components/widgets/UVideoWidget.styles.d.ts +0 -1
- package/dist/components/widgets/UWidget.component.js +0 -140
- package/dist/components/widgets/UWidget.d.ts +0 -7
- package/dist/components/widgets/UWidget.js +0 -5
- package/dist/components/widgets/UWidget.styles.d.ts +0 -1
- package/dist/events/UCancelEvent.d.ts +0 -6
- package/dist/events/USubmitEvent.d.ts +0 -6
- package/dist/types/Actions.d.ts +0 -24
- package/dist/types/Actions.js +0 -34
- package/dist/types/Widgets.js +0 -115
- package/dist/utilities/ActionPromptBuilder.d.ts +0 -40
- package/dist/utilities/ActionPromptBuilder.js +0 -93
- package/dist/utilities/WidgetPromptBuilder.d.ts +0 -28
- package/dist/utilities/WidgetPromptBuilder.js +0 -87
- package/dist/utilities/converters.d.ts +0 -9
- package/dist/utilities/converters.js +0 -19
- /package/dist/components/{actions/UQuestionAction.styles.d.ts → blocks/UFileBlock.styles.d.ts} +0 -0
- /package/dist/components/{blocks/UFilesBlock.styles.d.ts → intents/UQuestionIntent.styles.d.ts} +0 -0
- /package/dist/components/{buttons/UReportButton.styles.d.ts → views/UChartView.styles.d.ts} +0 -0
- /package/dist/components/{buttons/URetryButton.styles.d.ts → views/UImagesView.styles.d.ts} +0 -0
- /package/dist/components/{buttons/UShareButton.styles.d.ts → views/UMapView.styles.d.ts} +0 -0
- /package/dist/components/{widgets/UChartWidget.styles.d.ts → views/UVideoView.styles.d.ts} +0 -0
- /package/dist/components/{widgets/UImagesWidget.styles.d.ts → views/UView.styles.d.ts} +0 -0
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { UElement } from '@iyulab/components/dist/components/UElement.js';
|
|
2
|
-
import { UJsonElement } from '@iyulab/components/dist/components/UJsonElement.js';
|
|
3
|
-
/** 테이블 셀 데이터 타입 */
|
|
4
|
-
export interface TableCell {
|
|
5
|
-
/** 셀에 표시할 텍스트 내용 */
|
|
6
|
-
text: string;
|
|
7
|
-
/** 셀 내용의 정렬 방식. 기본값은 "left" */
|
|
8
|
-
align: "left" | "center" | "right" | null;
|
|
9
|
-
}
|
|
10
|
-
/** 테이블 정렬 상태 */
|
|
11
|
-
export interface SortState {
|
|
12
|
-
/** 현재 정렬 기준이 되는 컬럼 인덱스. -1이면 정렬 안 된 상태 */
|
|
13
|
-
index: number;
|
|
14
|
-
/** 정렬 방향. "asc"는 오름차순, "desc"는 내림차순 */
|
|
15
|
-
dir: "asc" | "desc";
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* 마크다운 테이블 데이터를 렌더링하는 컴포넌트입니다.
|
|
19
|
-
* 컬럼 정렬, CSV 다운로드 기능을 지원합니다.
|
|
20
|
-
* light DOM 내 `<script type="application/json">` 에서 데이터를 자동으로 읽어냅니다.
|
|
21
|
-
*/
|
|
22
|
-
export declare class UTableBlock extends UJsonElement {
|
|
23
|
-
static styles: (import('lit').CSSResult | import('lit').CSSResultGroup[])[];
|
|
24
|
-
static dependencies: Record<string, typeof UElement>;
|
|
25
|
-
/** 테이블 헤더 목록. 각 헤더는 { text, align } 형식입니다. */
|
|
26
|
-
headers: TableCell[];
|
|
27
|
-
/** 테이블 행 목록. 각 행은 셀 배열입니다. */
|
|
28
|
-
rows: TableCell[][];
|
|
29
|
-
private loading;
|
|
30
|
-
private sort;
|
|
31
|
-
private search;
|
|
32
|
-
private searchCache;
|
|
33
|
-
private searchTimer;
|
|
34
|
-
render(): import('lit-html').TemplateResult<1>;
|
|
35
|
-
/**
|
|
36
|
-
* 하이라이트 렌더링: search 기준으로 매칭되는 부분을 <mark>로 감쌉니다.
|
|
37
|
-
* 내부적으로 안전하게 escape한 뒤 매칭을 위해 RegExp를 사용합니다.
|
|
38
|
-
*/
|
|
39
|
-
private renderHighlightedText;
|
|
40
|
-
/**
|
|
41
|
-
* 현재 검색어와 정렬 상태에 따라 필터링 및 정렬된 행 목록을 반환합니다.
|
|
42
|
-
*/
|
|
43
|
-
private getFilteredSortedRows;
|
|
44
|
-
private handleSearchInput;
|
|
45
|
-
private handleSortColumn;
|
|
46
|
-
private handleDownloadCSV;
|
|
47
|
-
private handleDownloadXLS;
|
|
48
|
-
private triggerDownload;
|
|
49
|
-
}
|
|
@@ -1,228 +0,0 @@
|
|
|
1
|
-
import { html } from 'lit';
|
|
2
|
-
import { property, state } from 'lit/decorators.js';
|
|
3
|
-
import { repeat } from 'lit/directives/repeat.js';
|
|
4
|
-
import { UJsonElement } from '@iyulab/components/dist/components/UJsonElement.js';
|
|
5
|
-
import { UIcon } from '@iyulab/components/dist/components/icon/UIcon.component.js';
|
|
6
|
-
import { UInput } from '@iyulab/components/dist/components/input/UInput.component.js';
|
|
7
|
-
import { UButton } from '@iyulab/components/dist/components/button/UButton.component.js';
|
|
8
|
-
import { USkeleton } from '@iyulab/components/dist/components/skeleton/USkeleton.component.js';
|
|
9
|
-
import { styles } from './UTableBlock.styles.js';
|
|
10
|
-
|
|
11
|
-
var __defProp = Object.defineProperty;
|
|
12
|
-
var __decorateClass = (decorators, target, key, kind) => {
|
|
13
|
-
var result = void 0 ;
|
|
14
|
-
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
15
|
-
if (decorator = decorators[i])
|
|
16
|
-
result = (decorator(target, key, result) ) || result;
|
|
17
|
-
if (result) __defProp(target, key, result);
|
|
18
|
-
return result;
|
|
19
|
-
};
|
|
20
|
-
class UTableBlock extends UJsonElement {
|
|
21
|
-
constructor() {
|
|
22
|
-
super(...arguments);
|
|
23
|
-
this.headers = [];
|
|
24
|
-
this.rows = [];
|
|
25
|
-
this.loading = false;
|
|
26
|
-
this.sort = { index: -1, dir: "asc" };
|
|
27
|
-
this.search = "";
|
|
28
|
-
this.searchCache = "";
|
|
29
|
-
this.searchTimer = null;
|
|
30
|
-
}
|
|
31
|
-
static {
|
|
32
|
-
this.styles = [super.styles, styles];
|
|
33
|
-
}
|
|
34
|
-
static {
|
|
35
|
-
this.dependencies = {
|
|
36
|
-
"u-icon": UIcon,
|
|
37
|
-
"u-input": UInput,
|
|
38
|
-
"u-button": UButton,
|
|
39
|
-
"u-skeleton": USkeleton
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
render() {
|
|
43
|
-
const rows = this.getFilteredSortedRows();
|
|
44
|
-
return html`
|
|
45
|
-
<div class="toolbar">
|
|
46
|
-
<div class="toolbar-left">
|
|
47
|
-
<u-input
|
|
48
|
-
class="toolbar-search"
|
|
49
|
-
type="search"
|
|
50
|
-
placeholder="Search..."
|
|
51
|
-
.value=${this.search}
|
|
52
|
-
@input=${this.handleSearchInput}
|
|
53
|
-
>
|
|
54
|
-
<u-icon slot="prefix" lib="internal" name="search"></u-icon>
|
|
55
|
-
</u-input>
|
|
56
|
-
<span class="toolbar-count">
|
|
57
|
-
${rows.length} / ${this.rows.length} Rows
|
|
58
|
-
</span>
|
|
59
|
-
</div>
|
|
60
|
-
<div class="toolbar-right">
|
|
61
|
-
<u-button @click=${this.handleDownloadXLS} title="Excel Download">
|
|
62
|
-
XLS
|
|
63
|
-
<u-icon slot="suffix" lib="internal" name="download"></u-icon>
|
|
64
|
-
</u-button>
|
|
65
|
-
<u-button @click=${this.handleDownloadCSV} title="CSV Download">
|
|
66
|
-
CSV
|
|
67
|
-
<u-icon slot="suffix" lib="internal" name="download"></u-icon>
|
|
68
|
-
</u-button>
|
|
69
|
-
</div>
|
|
70
|
-
</div>
|
|
71
|
-
<div class="table-wrapper" scrollable>
|
|
72
|
-
<table>
|
|
73
|
-
<thead ?hidden=${!this.headers.length}>
|
|
74
|
-
<tr>
|
|
75
|
-
${repeat(this.headers, (_, i) => i, (h, i) => {
|
|
76
|
-
const isActive = this.sort.index === i;
|
|
77
|
-
return html`
|
|
78
|
-
<th
|
|
79
|
-
?active=${isActive}
|
|
80
|
-
align=${h.align ?? "left"}
|
|
81
|
-
@click=${() => this.handleSortColumn(i)}
|
|
82
|
-
>
|
|
83
|
-
${h.text}
|
|
84
|
-
<u-icon
|
|
85
|
-
class="sort-icon"
|
|
86
|
-
lib="internal"
|
|
87
|
-
name=${isActive ? this.sort.dir === "asc" ? "sort-alpha-up" : "sort-alpha-down" : "arrow-down-up"}
|
|
88
|
-
></u-icon>
|
|
89
|
-
</th>
|
|
90
|
-
`;
|
|
91
|
-
})}
|
|
92
|
-
</tr>
|
|
93
|
-
</thead>
|
|
94
|
-
<tbody>
|
|
95
|
-
${this.loading ? html`
|
|
96
|
-
<tr>
|
|
97
|
-
<td colspan=${this.headers.length || 1}>
|
|
98
|
-
<u-skeleton width="80%" height="1.2em"></u-skeleton>
|
|
99
|
-
<u-skeleton width="60%" height="1.2em"></u-skeleton>
|
|
100
|
-
<u-skeleton width="70%" height="1.2em"></u-skeleton>
|
|
101
|
-
<u-skeleton width="50%" height="1.2em"></u-skeleton>
|
|
102
|
-
</td>
|
|
103
|
-
</tr>
|
|
104
|
-
` : repeat(rows, (_, i) => i, (row) => html`
|
|
105
|
-
<tr>
|
|
106
|
-
${repeat(row, (_, j) => j, (cell) => html`
|
|
107
|
-
<td align=${cell.align ?? "left"}>
|
|
108
|
-
${this.renderHighlightedText(cell.text)}
|
|
109
|
-
</td>
|
|
110
|
-
`)}
|
|
111
|
-
</tr>
|
|
112
|
-
`)}
|
|
113
|
-
</tbody>
|
|
114
|
-
</table>
|
|
115
|
-
</div>
|
|
116
|
-
`;
|
|
117
|
-
}
|
|
118
|
-
/**
|
|
119
|
-
* 하이라이트 렌더링: search 기준으로 매칭되는 부분을 <mark>로 감쌉니다.
|
|
120
|
-
* 내부적으로 안전하게 escape한 뒤 매칭을 위해 RegExp를 사용합니다.
|
|
121
|
-
*/
|
|
122
|
-
renderHighlightedText(text) {
|
|
123
|
-
const q = this.search.trim();
|
|
124
|
-
if (!q) return text;
|
|
125
|
-
const escaped = q.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
126
|
-
const re = new RegExp(`(${escaped})`, "gi");
|
|
127
|
-
const parts = String(text).split(re);
|
|
128
|
-
if (parts.length === 1) return text;
|
|
129
|
-
return html`${parts.map(
|
|
130
|
-
(p, idx) => idx % 2 === 1 ? html`<mark>${p}</mark>` : p
|
|
131
|
-
)}`;
|
|
132
|
-
}
|
|
133
|
-
/**
|
|
134
|
-
* 현재 검색어와 정렬 상태에 따라 필터링 및 정렬된 행 목록을 반환합니다.
|
|
135
|
-
*/
|
|
136
|
-
getFilteredSortedRows() {
|
|
137
|
-
let rows = this.rows;
|
|
138
|
-
const q = this.search.trim();
|
|
139
|
-
if (q) {
|
|
140
|
-
const qLower = q.toLowerCase();
|
|
141
|
-
rows = rows.filter((row) => row.some((cell) => cell.text.toLowerCase().includes(qLower)));
|
|
142
|
-
}
|
|
143
|
-
const { index, dir } = this.sort;
|
|
144
|
-
if (index < 0) return rows;
|
|
145
|
-
return [...rows].sort((a, b) => {
|
|
146
|
-
const av = a[index]?.text ?? "";
|
|
147
|
-
const bv = b[index]?.text ?? "";
|
|
148
|
-
const an = Number(av);
|
|
149
|
-
const bn = Number(bv);
|
|
150
|
-
const cmp = !isNaN(an) && !isNaN(bn) ? an - bn : av.localeCompare(bv, void 0, { sensitivity: "base" });
|
|
151
|
-
return dir === "asc" ? cmp : -cmp;
|
|
152
|
-
});
|
|
153
|
-
}
|
|
154
|
-
/* 250ms 디바운스되어 검색어가 업데이트되는 핸들러. */
|
|
155
|
-
handleSearchInput(e) {
|
|
156
|
-
const input = e.target;
|
|
157
|
-
this.searchCache = input.value;
|
|
158
|
-
if (this.searchTimer !== null) window.clearTimeout(this.searchTimer);
|
|
159
|
-
this.loading = true;
|
|
160
|
-
this.searchTimer = window.setTimeout(() => {
|
|
161
|
-
this.search = this.searchCache;
|
|
162
|
-
this.loading = false;
|
|
163
|
-
this.searchTimer = null;
|
|
164
|
-
}, 250);
|
|
165
|
-
}
|
|
166
|
-
/* 컬럼 헤더 클릭 시 정렬 상태를 토글하는 핸들러 */
|
|
167
|
-
handleSortColumn(index) {
|
|
168
|
-
if (this.sort.index === index) {
|
|
169
|
-
this.sort = { ...this.sort, dir: this.sort.dir === "asc" ? "desc" : "asc" };
|
|
170
|
-
} else {
|
|
171
|
-
this.sort = { index, dir: "asc" };
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
/* CSV 다운로드 핸들러 */
|
|
175
|
-
handleDownloadCSV() {
|
|
176
|
-
const escCsv = (v) => v.includes(",") || v.includes('"') || v.includes("\n") ? `"${v.replace(/"/g, '""')}"` : v;
|
|
177
|
-
const lines = [
|
|
178
|
-
this.headers.map((h) => escCsv(h.text)).join(","),
|
|
179
|
-
...this.rows.map((row) => row.map((cell) => escCsv(cell.text)).join(","))
|
|
180
|
-
];
|
|
181
|
-
const blob = new Blob([lines.join("\n")], { type: "text/csv;charset=utf-8;" });
|
|
182
|
-
this.triggerDownload("table.csv", blob);
|
|
183
|
-
}
|
|
184
|
-
/* XLS 다운로드 핸들러 */
|
|
185
|
-
handleDownloadXLS() {
|
|
186
|
-
const escXml = (v) => v.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
187
|
-
const cell = (v) => `<Cell><Data ss:Type="String">${escXml(v)}</Data></Cell>`;
|
|
188
|
-
const row = (cells) => `<Row>${cells.map(cell).join("")}</Row>`;
|
|
189
|
-
const xml = [
|
|
190
|
-
`<?xml version="1.0" encoding="UTF-8"?>`,
|
|
191
|
-
`<?mso-application progid="Excel.Sheet"?>`,
|
|
192
|
-
`<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"`,
|
|
193
|
-
` xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet">`,
|
|
194
|
-
`<Worksheet ss:Name="Sheet1"><Table>`,
|
|
195
|
-
row(this.headers.map((h) => h.text)),
|
|
196
|
-
...this.rows.map((r) => row(r.map((c) => c.text))),
|
|
197
|
-
`</Table></Worksheet></Workbook>`
|
|
198
|
-
].join("\n");
|
|
199
|
-
const blob = new Blob([xml], { type: "application/vnd.ms-excel;charset=utf-8;" });
|
|
200
|
-
this.triggerDownload("table.xls", blob);
|
|
201
|
-
}
|
|
202
|
-
/* 파일 다운로드 트리거 */
|
|
203
|
-
triggerDownload(filename, blob) {
|
|
204
|
-
const url = URL.createObjectURL(blob);
|
|
205
|
-
const a = document.createElement("a");
|
|
206
|
-
a.href = url;
|
|
207
|
-
a.download = filename;
|
|
208
|
-
a.click();
|
|
209
|
-
URL.revokeObjectURL(url);
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
__decorateClass([
|
|
213
|
-
property({ type: Array })
|
|
214
|
-
], UTableBlock.prototype, "headers");
|
|
215
|
-
__decorateClass([
|
|
216
|
-
property({ type: Array })
|
|
217
|
-
], UTableBlock.prototype, "rows");
|
|
218
|
-
__decorateClass([
|
|
219
|
-
state()
|
|
220
|
-
], UTableBlock.prototype, "loading");
|
|
221
|
-
__decorateClass([
|
|
222
|
-
state()
|
|
223
|
-
], UTableBlock.prototype, "sort");
|
|
224
|
-
__decorateClass([
|
|
225
|
-
state()
|
|
226
|
-
], UTableBlock.prototype, "search");
|
|
227
|
-
|
|
228
|
-
export { UTableBlock };
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { PropertyValues } from 'lit';
|
|
2
|
-
import { UElement } from '@iyulab/components/dist/components/UElement.js';
|
|
3
|
-
/**
|
|
4
|
-
* 텍스트를 표시하거나 편집할 수 있는 블록 컴포넌트입니다.
|
|
5
|
-
*/
|
|
6
|
-
export declare class UTextBlock extends UElement {
|
|
7
|
-
static styles: import('lit').CSSResultGroup[];
|
|
8
|
-
static dependencies: Record<string, typeof UElement>;
|
|
9
|
-
textareaEl: HTMLTextAreaElement;
|
|
10
|
-
preEl: HTMLPreElement;
|
|
11
|
-
/** 편집 가능 여부 */
|
|
12
|
-
editable: boolean;
|
|
13
|
-
/** 스펠체크 여부 */
|
|
14
|
-
spellcheck: boolean;
|
|
15
|
-
/** 플레이스홀더 텍스트 */
|
|
16
|
-
placeholder?: string;
|
|
17
|
-
/** 최소 행 수, 기본값은 1 */
|
|
18
|
-
minRows: number;
|
|
19
|
-
/** 최대 행 수 */
|
|
20
|
-
maxRows?: number;
|
|
21
|
-
/** 텍스트 블록의 내용 */
|
|
22
|
-
value?: string;
|
|
23
|
-
protected updated(changedProperties: PropertyValues): void;
|
|
24
|
-
render(): import('lit-html').TemplateResult<1>;
|
|
25
|
-
/**
|
|
26
|
-
* textarea에 포커스를 줍니다.
|
|
27
|
-
*/
|
|
28
|
-
focus(options?: FocusOptions): void;
|
|
29
|
-
/**
|
|
30
|
-
* 텍스트 입력시 value를 업데이트하고 이벤트를 재전파합니다.
|
|
31
|
-
*/
|
|
32
|
-
private updateValueFrom;
|
|
33
|
-
/**
|
|
34
|
-
* pre 엘리먼트에 주입될 값을 정규화합니다.
|
|
35
|
-
*/
|
|
36
|
-
private normalizeValue;
|
|
37
|
-
}
|
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
import { html } from 'lit';
|
|
2
|
-
import { query, property } from 'lit/decorators.js';
|
|
3
|
-
import { UElement } from '@iyulab/components/dist/components/UElement.js';
|
|
4
|
-
import { styles } from './UTextBlock.styles.js';
|
|
5
|
-
|
|
6
|
-
var __defProp = Object.defineProperty;
|
|
7
|
-
var __decorateClass = (decorators, target, key, kind) => {
|
|
8
|
-
var result = void 0 ;
|
|
9
|
-
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
10
|
-
if (decorator = decorators[i])
|
|
11
|
-
result = (decorator(target, key, result) ) || result;
|
|
12
|
-
if (result) __defProp(target, key, result);
|
|
13
|
-
return result;
|
|
14
|
-
};
|
|
15
|
-
class UTextBlock extends UElement {
|
|
16
|
-
constructor() {
|
|
17
|
-
super(...arguments);
|
|
18
|
-
this.editable = false;
|
|
19
|
-
this.spellcheck = false;
|
|
20
|
-
this.minRows = 1;
|
|
21
|
-
/**
|
|
22
|
-
* 텍스트 입력시 value를 업데이트하고 이벤트를 재전파합니다.
|
|
23
|
-
*/
|
|
24
|
-
this.updateValueFrom = (event) => {
|
|
25
|
-
event.stopPropagation();
|
|
26
|
-
this.value = this.textareaEl.value;
|
|
27
|
-
this.dispatchEvent(new InputEvent("input", {
|
|
28
|
-
bubbles: true,
|
|
29
|
-
composed: true,
|
|
30
|
-
cancelable: true,
|
|
31
|
-
data: this.value,
|
|
32
|
-
inputType: event.inputType,
|
|
33
|
-
isComposing: event.isComposing,
|
|
34
|
-
dataTransfer: event.dataTransfer,
|
|
35
|
-
detail: event.detail,
|
|
36
|
-
targetRanges: event.getTargetRanges(),
|
|
37
|
-
view: event.view
|
|
38
|
-
}));
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
static {
|
|
42
|
-
this.styles = [super.styles, styles];
|
|
43
|
-
}
|
|
44
|
-
static {
|
|
45
|
-
this.dependencies = {};
|
|
46
|
-
}
|
|
47
|
-
updated(changedProperties) {
|
|
48
|
-
super.updated(changedProperties);
|
|
49
|
-
if (changedProperties.has("minRows") && this.minRows > 0) {
|
|
50
|
-
const lineHeight = parseFloat(getComputedStyle(this.preEl).lineHeight);
|
|
51
|
-
this.preEl.style.minHeight = `${this.minRows * lineHeight}px`;
|
|
52
|
-
}
|
|
53
|
-
if (changedProperties.has("maxRows") && this.maxRows && this.maxRows > 0 && this.maxRows > this.minRows) {
|
|
54
|
-
const lineHeight = parseFloat(getComputedStyle(this.preEl).lineHeight);
|
|
55
|
-
this.preEl.style.maxHeight = `${this.maxRows * lineHeight}px`;
|
|
56
|
-
}
|
|
57
|
-
if (changedProperties.has("editable") && this.editable) {
|
|
58
|
-
requestAnimationFrame(() => {
|
|
59
|
-
this.textareaEl.focus();
|
|
60
|
-
this.textareaEl.setSelectionRange(this.value?.length || 0, this.value?.length || 0);
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
render() {
|
|
65
|
-
return html`
|
|
66
|
-
<div class="container">
|
|
67
|
-
<textarea
|
|
68
|
-
name="message"
|
|
69
|
-
placeholder=${this.placeholder || ""}
|
|
70
|
-
spellcheck=${this.spellcheck}
|
|
71
|
-
.readOnly=${!this.editable}
|
|
72
|
-
.value=${this.value || ""}
|
|
73
|
-
@input=${this.updateValueFrom}
|
|
74
|
-
></textarea>
|
|
75
|
-
<pre
|
|
76
|
-
.textContent=${this.normalizeValue(this.value)}
|
|
77
|
-
></pre>
|
|
78
|
-
</div>
|
|
79
|
-
`;
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* textarea에 포커스를 줍니다.
|
|
83
|
-
*/
|
|
84
|
-
focus(options) {
|
|
85
|
-
this.textareaEl.focus(options);
|
|
86
|
-
}
|
|
87
|
-
/**
|
|
88
|
-
* pre 엘리먼트에 주입될 값을 정규화합니다.
|
|
89
|
-
*/
|
|
90
|
-
normalizeValue(value) {
|
|
91
|
-
if (!value) return "";
|
|
92
|
-
if (value.endsWith("\n")) {
|
|
93
|
-
return value + "";
|
|
94
|
-
}
|
|
95
|
-
return value;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
__decorateClass([
|
|
99
|
-
query("textarea")
|
|
100
|
-
], UTextBlock.prototype, "textareaEl");
|
|
101
|
-
__decorateClass([
|
|
102
|
-
query("pre")
|
|
103
|
-
], UTextBlock.prototype, "preEl");
|
|
104
|
-
__decorateClass([
|
|
105
|
-
property({ type: Boolean, reflect: true })
|
|
106
|
-
], UTextBlock.prototype, "editable");
|
|
107
|
-
__decorateClass([
|
|
108
|
-
property({ type: Boolean })
|
|
109
|
-
], UTextBlock.prototype, "spellcheck");
|
|
110
|
-
__decorateClass([
|
|
111
|
-
property({ type: String })
|
|
112
|
-
], UTextBlock.prototype, "placeholder");
|
|
113
|
-
__decorateClass([
|
|
114
|
-
property({ type: Number })
|
|
115
|
-
], UTextBlock.prototype, "minRows");
|
|
116
|
-
__decorateClass([
|
|
117
|
-
property({ type: Number })
|
|
118
|
-
], UTextBlock.prototype, "maxRows");
|
|
119
|
-
__decorateClass([
|
|
120
|
-
property({ type: String })
|
|
121
|
-
], UTextBlock.prototype, "value");
|
|
122
|
-
|
|
123
|
-
export { UTextBlock };
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { PropertyValues } from 'lit';
|
|
2
|
-
import { UElement } from '@iyulab/components/dist/components/UElement.js';
|
|
3
|
-
/**
|
|
4
|
-
* 추론 내용을 표시하는 블록입니다.
|
|
5
|
-
* 로딩 중일 때는 "Thinking..." 메시지를 표시하고, 내용 펼치기/접기 기능을 제공합니다.
|
|
6
|
-
*/
|
|
7
|
-
export declare class UThinkBlock extends UElement {
|
|
8
|
-
static styles: import('lit').CSSResultGroup[];
|
|
9
|
-
static dependencies: Record<string, typeof UElement>;
|
|
10
|
-
bodyEl: HTMLDivElement;
|
|
11
|
-
/** 컨텐츠가 로딩 중인지 여부 */
|
|
12
|
-
loading: boolean;
|
|
13
|
-
/** 컨텐츠가 접혀있는지 여부 */
|
|
14
|
-
collapsed: boolean;
|
|
15
|
-
/** 추론 컨텐츠의 내용 */
|
|
16
|
-
value?: string;
|
|
17
|
-
protected updated(changedProperties: PropertyValues): void;
|
|
18
|
-
render(): import('lit-html').TemplateResult<1>;
|
|
19
|
-
/**
|
|
20
|
-
* 컨텐츠가 로딩 중일 때, 스크롤을 맨 아래로 이동
|
|
21
|
-
*/
|
|
22
|
-
private scrollToBottom;
|
|
23
|
-
}
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import { html } from 'lit';
|
|
2
|
-
import { query, property } from 'lit/decorators.js';
|
|
3
|
-
import { UElement } from '@iyulab/components/dist/components/UElement.js';
|
|
4
|
-
import { UIcon } from '@iyulab/components/dist/components/icon/UIcon.component.js';
|
|
5
|
-
import { UMarkedBlock } from './UMarkedBlock.component.js';
|
|
6
|
-
import { styles } from './UThinkBlock.styles.js';
|
|
7
|
-
|
|
8
|
-
var __defProp = Object.defineProperty;
|
|
9
|
-
var __decorateClass = (decorators, target, key, kind) => {
|
|
10
|
-
var result = void 0 ;
|
|
11
|
-
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
12
|
-
if (decorator = decorators[i])
|
|
13
|
-
result = (decorator(target, key, result) ) || result;
|
|
14
|
-
if (result) __defProp(target, key, result);
|
|
15
|
-
return result;
|
|
16
|
-
};
|
|
17
|
-
class UThinkBlock extends UElement {
|
|
18
|
-
constructor() {
|
|
19
|
-
super(...arguments);
|
|
20
|
-
this.loading = false;
|
|
21
|
-
this.collapsed = true;
|
|
22
|
-
/**
|
|
23
|
-
* 컨텐츠가 로딩 중일 때, 스크롤을 맨 아래로 이동
|
|
24
|
-
*/
|
|
25
|
-
this.scrollToBottom = () => {
|
|
26
|
-
if (!this.bodyEl) return;
|
|
27
|
-
requestAnimationFrame(() => {
|
|
28
|
-
this.bodyEl.scrollTo({
|
|
29
|
-
top: this.bodyEl.scrollHeight,
|
|
30
|
-
behavior: "smooth"
|
|
31
|
-
});
|
|
32
|
-
});
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
static {
|
|
36
|
-
this.styles = [super.styles, styles];
|
|
37
|
-
}
|
|
38
|
-
static {
|
|
39
|
-
this.dependencies = {
|
|
40
|
-
"u-icon": UIcon,
|
|
41
|
-
"u-marked-block": UMarkedBlock
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
updated(changedProperties) {
|
|
45
|
-
super.updated(changedProperties);
|
|
46
|
-
if (changedProperties.has("value") && this.value) {
|
|
47
|
-
this.scrollToBottom();
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
render() {
|
|
51
|
-
return html`
|
|
52
|
-
<div class="header" part="header"
|
|
53
|
-
@click=${() => this.collapsed = !this.collapsed}>
|
|
54
|
-
<u-icon class="prefix-icon"
|
|
55
|
-
?loading=${this.loading}
|
|
56
|
-
lib="internal"
|
|
57
|
-
name="lightbulb-fill"
|
|
58
|
-
></u-icon>
|
|
59
|
-
<span class="title">
|
|
60
|
-
${this.loading ? "Thinking..." : "Thought"}
|
|
61
|
-
</span>
|
|
62
|
-
<u-icon class="suffix-icon"
|
|
63
|
-
lib="internal"
|
|
64
|
-
name=${this.collapsed ? "plus-lg" : "dash-lg"}
|
|
65
|
-
></u-icon>
|
|
66
|
-
</div>
|
|
67
|
-
|
|
68
|
-
<div class="body" part="body" scrollable
|
|
69
|
-
?hidden=${this.collapsed}>
|
|
70
|
-
<u-marked-block
|
|
71
|
-
.value=${this.value}
|
|
72
|
-
></u-marked-block>
|
|
73
|
-
</div>
|
|
74
|
-
`;
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
__decorateClass([
|
|
78
|
-
query(".body")
|
|
79
|
-
], UThinkBlock.prototype, "bodyEl");
|
|
80
|
-
__decorateClass([
|
|
81
|
-
property({ type: Boolean, reflect: true })
|
|
82
|
-
], UThinkBlock.prototype, "loading");
|
|
83
|
-
__decorateClass([
|
|
84
|
-
property({ type: Boolean, reflect: true })
|
|
85
|
-
], UThinkBlock.prototype, "collapsed");
|
|
86
|
-
__decorateClass([
|
|
87
|
-
property({ type: String })
|
|
88
|
-
], UThinkBlock.prototype, "value");
|
|
89
|
-
|
|
90
|
-
export { UThinkBlock };
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { UElement } from '@iyulab/components/dist/components/UElement.js';
|
|
2
|
-
import { JsonNode } from '../../types/JsonNode.js';
|
|
3
|
-
/**
|
|
4
|
-
* 툴 사용 블록 컴포넌트입니다.
|
|
5
|
-
*/
|
|
6
|
-
export declare class UToolBlock extends UElement {
|
|
7
|
-
static styles: import('lit').CSSResultGroup[];
|
|
8
|
-
static dependencies: Record<string, typeof UElement>;
|
|
9
|
-
/** 로딩 상태 */
|
|
10
|
-
loading: boolean;
|
|
11
|
-
/** 블록 접힘 여부 */
|
|
12
|
-
collapsed: boolean;
|
|
13
|
-
/** 헤딩 텍스트 */
|
|
14
|
-
heading?: string;
|
|
15
|
-
/** 입력 데이터 (JSON Object) */
|
|
16
|
-
input?: JsonNode;
|
|
17
|
-
/** 출력 데이터 (JSON Object) */
|
|
18
|
-
output?: JsonNode;
|
|
19
|
-
render(): import('lit-html').TemplateResult<1>;
|
|
20
|
-
}
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import { html } from 'lit';
|
|
2
|
-
import { property } from 'lit/decorators.js';
|
|
3
|
-
import { UElement } from '@iyulab/components/dist/components/UElement.js';
|
|
4
|
-
import { UIcon } from '@iyulab/components/dist/components/icon/UIcon.component.js';
|
|
5
|
-
import { USpinner } from '@iyulab/components/dist/components/spinner/USpinner.component.js';
|
|
6
|
-
import { UJsonBlock } from './UJsonBlock.component.js';
|
|
7
|
-
import { jsonAttrConverter } from '../../utilities/converters.js';
|
|
8
|
-
import { styles } from './UToolBlock.styles.js';
|
|
9
|
-
|
|
10
|
-
var __defProp = Object.defineProperty;
|
|
11
|
-
var __decorateClass = (decorators, target, key, kind) => {
|
|
12
|
-
var result = void 0 ;
|
|
13
|
-
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
14
|
-
if (decorator = decorators[i])
|
|
15
|
-
result = (decorator(target, key, result) ) || result;
|
|
16
|
-
if (result) __defProp(target, key, result);
|
|
17
|
-
return result;
|
|
18
|
-
};
|
|
19
|
-
class UToolBlock extends UElement {
|
|
20
|
-
constructor() {
|
|
21
|
-
super(...arguments);
|
|
22
|
-
this.loading = false;
|
|
23
|
-
this.collapsed = true;
|
|
24
|
-
}
|
|
25
|
-
static {
|
|
26
|
-
this.styles = [super.styles, styles];
|
|
27
|
-
}
|
|
28
|
-
static {
|
|
29
|
-
this.dependencies = {
|
|
30
|
-
"u-icon": UIcon,
|
|
31
|
-
"u-spinner": USpinner,
|
|
32
|
-
"u-json-block": UJsonBlock
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
render() {
|
|
36
|
-
return html`
|
|
37
|
-
<div class="header" @click=${() => this.collapsed = !this.collapsed}>
|
|
38
|
-
${this.loading ? html`<u-spinner></u-spinner>` : html`<u-icon lib="internal" name="tools"></u-icon>`}
|
|
39
|
-
<div class="title">
|
|
40
|
-
${this.heading || "Tool Usage"}
|
|
41
|
-
</div>
|
|
42
|
-
<u-icon
|
|
43
|
-
lib="internal"
|
|
44
|
-
name=${this.collapsed ? "plus-lg" : "dash-lg"}
|
|
45
|
-
></u-icon>
|
|
46
|
-
</div>
|
|
47
|
-
|
|
48
|
-
<div class="body" part="body" scrollable ?hidden=${this.collapsed}>
|
|
49
|
-
<div class="input-view" ?hidden=${!this.input}>
|
|
50
|
-
<u-json-block
|
|
51
|
-
.value=${this.input || {}}
|
|
52
|
-
></u-json-block>
|
|
53
|
-
</div>
|
|
54
|
-
<div class="output-view" ?hidden=${!this.output}>
|
|
55
|
-
<u-icon lib="internal" name="chevron-down"></u-icon>
|
|
56
|
-
<u-json-block
|
|
57
|
-
.value=${this.output || {}}
|
|
58
|
-
></u-json-block>
|
|
59
|
-
</div>
|
|
60
|
-
</div>
|
|
61
|
-
`;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
__decorateClass([
|
|
65
|
-
property({ type: Boolean, reflect: true })
|
|
66
|
-
], UToolBlock.prototype, "loading");
|
|
67
|
-
__decorateClass([
|
|
68
|
-
property({ type: Boolean, reflect: true })
|
|
69
|
-
], UToolBlock.prototype, "collapsed");
|
|
70
|
-
__decorateClass([
|
|
71
|
-
property({ type: String })
|
|
72
|
-
], UToolBlock.prototype, "heading");
|
|
73
|
-
__decorateClass([
|
|
74
|
-
property({ type: Object, converter: jsonAttrConverter })
|
|
75
|
-
], UToolBlock.prototype, "input");
|
|
76
|
-
__decorateClass([
|
|
77
|
-
property({ type: Object, converter: jsonAttrConverter })
|
|
78
|
-
], UToolBlock.prototype, "output");
|
|
79
|
-
|
|
80
|
-
export { UToolBlock };
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { UElement } from '@iyulab/components/dist/components/UElement.js';
|
|
2
|
-
/**
|
|
3
|
-
* 파일 첨부 버튼 컴포넌트입니다.
|
|
4
|
-
*/
|
|
5
|
-
export declare class UAttachButton extends UElement {
|
|
6
|
-
static styles: import('lit').CSSResultGroup[];
|
|
7
|
-
static dependencies: Record<string, typeof UElement>;
|
|
8
|
-
input?: HTMLInputElement;
|
|
9
|
-
/** 첨부 파일 유형 제한, 컴마로 구분된 MIME 타입 문자열 (예: "image/*,application/pdf") */
|
|
10
|
-
accept?: string;
|
|
11
|
-
/** 다중 파일 선택 가능 여부 */
|
|
12
|
-
multiple: boolean;
|
|
13
|
-
render(): import('lit-html').TemplateResult<1>;
|
|
14
|
-
/**
|
|
15
|
-
* 버튼 클릭 핸들러
|
|
16
|
-
*/
|
|
17
|
-
private handleButtonClick;
|
|
18
|
-
/**
|
|
19
|
-
* 파일 선택 이벤트 핸들러
|
|
20
|
-
*/
|
|
21
|
-
private handleInputChange;
|
|
22
|
-
}
|