ide-assi 0.354.0 → 0.356.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.
@@ -201852,54 +201852,354 @@ class IdeAssi extends HTMLElement
201852
201852
 
201853
201853
  this.shadowRoot.appendChild(document.createElement('ide-diff-popup'));
201854
201854
 
201855
- //this.shadowRoot.querySelector("ide-diff-popup").popup(src1, src2);
201855
+ //setTimeout(() => {
201856
+ const src1 = `
201857
+ import React, { useRef, useEffect } from "react";
201858
+ import { api, ai } from "ide-assi";
201859
+ import ninegrid from "ninegrid2";
201860
+
201861
+ const DocManager = () => {
201862
+ const tabRef = useRef(null);
201863
+ const gridRef = useRef(null);
201864
+
201865
+ const selectList = async (params) => {
201866
+ if (!gridRef.current) return;
201867
+ gridRef.current.classList.add("loading");
201868
+ api.post(\`/api/tmpl-a/doc-manager/selectList\`, params).then((res) => {
201869
+ gridRef.current.data.source = res.list;
201870
+ });
201871
+ };
201856
201872
 
201857
- //return;
201873
+ const handleNaturalLanguageSearch = async () => {
201874
+ const searchTextElement = ninegrid.querySelector("#searchText", tabRef.current);
201875
+ const searchText = searchTextElement ? searchTextElement.value : "";
201876
+
201877
+ if (!gridRef.current) return;
201878
+ gridRef.current.classList.add("loading");
201879
+
201880
+ let params = {};
201881
+ if (searchText) {
201882
+ params = {
201883
+ _whereClause: await ai.generateWhereCause(
201884
+ "tmpla/DocManagerMapper.xml",
201885
+ "selectList",
201886
+ searchText,
201887
+ import.meta.env.VITE_GEMINI_API_KEY
201888
+ ),
201889
+ };
201890
+ }
201891
+ selectList(params);
201892
+ };
201858
201893
 
201859
- const apply = {
201860
- mybatis: this.shadowRoot.querySelector("#mybatis").checked,
201861
- service: this.shadowRoot.querySelector("#service").checked,
201862
- controller: this.shadowRoot.querySelector("#controller").checked,
201863
- javascript: this.shadowRoot.querySelector("#javascript").checked,
201864
- };
201894
+ const handleClassicSearch = () => {
201895
+ if (!gridRef.current) return;
201896
+ gridRef.current.classList.add("loading");
201865
201897
 
201866
- if (!apply.mybatis && !apply.service && !apply.controller && !apply.javascript) return;
201898
+ const form2Element = ninegrid.querySelector(".form2", tabRef.current);
201899
+ const params = form2Element ? form2Element.getData() : {};
201900
+ selectList(params);
201901
+ };
201867
201902
 
201868
- const userPrompt = e.target.value.trim();
201869
- if (!userPrompt) return;
201903
+ useEffect(() => {
201904
+ selectList({});
201870
201905
 
201871
- if (this.#ing) return;
201872
- this.#ing = true;
201906
+ const searchTextElement = ninegrid.querySelector("#searchText", tabRef.current);
201907
+ const searchButton = ninegrid.querySelector(".search", tabRef.current);
201873
201908
 
201874
- /**
201875
- * 옵션저장
201876
- */
201877
- this.#saveLocalSettings(apply);
201909
+ const handleKeyDown = (e) => {
201910
+ if (e.key === "Enter" && !e.isComposing) {
201911
+ handleNaturalLanguageSearch();
201912
+ }
201913
+ };
201878
201914
 
201915
+ const handleClick = () => {
201916
+ handleClassicSearch();
201917
+ };
201879
201918
 
201919
+ if (searchTextElement) {
201920
+ searchTextElement.addEventListener("keydown", handleKeyDown);
201921
+ }
201922
+ if (searchButton) {
201923
+ searchButton.addEventListener("click", handleClick);
201924
+ }
201880
201925
 
201881
- /**
201882
- * setTimeout 없으면, 맥에서 한글 잔상이 남음
201883
- * setTimeout 내에서 e.target이 nx-ai-container가 된다.
201884
- */
201885
- setTimeout(() => {
201886
- this.shadowRoot.querySelector("textarea").value = "";
201887
- });
201926
+ return () => {
201927
+ if (searchTextElement) {
201928
+ searchTextElement.removeEventListener("keydown", handleKeyDown);
201929
+ }
201930
+ if (searchButton) {
201931
+ searchButton.removeEventListener("click", handleClick);
201932
+ }
201933
+ };
201934
+ }, []);
201888
201935
 
201889
- const elAiChat = this.shadowRoot.querySelector("nx-ai-chat");
201936
+ return (
201937
+ <div className="wrapper">
201938
+ <nx-collapse target="nx-tab" className="search-collapse"></nx-collapse>
201939
+ <div className="list-wrapper">
201940
+ <nx-tab theme="theme-3" ref={tabRef}>
201941
+ <nx-tab-page caption="자연어 검색">
201942
+ <nx-form className="form1">
201943
+ <input
201944
+ type="text"
201945
+ id="searchText"
201946
+ name="searchText"
201947
+ placeholder="자연어 검색어를 입력하세요 (ex: 작성자가 홍길동인 데이타를 찾아줘)"
201948
+ />
201949
+ </nx-form>
201950
+ </nx-tab-page>
201951
+ <nx-tab-page caption="클래식 검색">
201952
+ <nx-form className="form2">
201953
+ <label>문서명: <input type="text" name="docNm" /></label>
201954
+ <label>매출액:
201955
+ <input type="number" name="minAmt" placeholder="최소" /> ~
201956
+ <input type="number" name="maxAmt" placeholder="최대" />
201957
+ </label>
201958
+ </nx-form>
201959
+ <button className="search">검색</button>
201960
+ </nx-tab-page>
201961
+ </nx-tab>
201962
+
201963
+ <div className="grid-wrapper">
201964
+ <nine-grid
201965
+ ref={gridRef}
201966
+ caption="문서관리"
201967
+ select-type="row"
201968
+ show-title-bar="true"
201969
+ show-menu-icon="true"
201970
+ show-status-bar="true"
201971
+ enable-fixed-col="true"
201972
+ row-resizable="false"
201973
+ col-movable="true"
201974
+ >
201975
+ <table>
201976
+ <colgroup>
201977
+ <col width="50" fixed="left" background-color="gray" />
201978
+ <col width="100" />
201979
+ <col width="100" />
201980
+ <col width="200" />
201981
+ <col width="120" />
201982
+ <col width="100" />
201983
+ <col width="150" />
201984
+ <col width="150" />
201985
+ </colgroup>
201986
+ <thead>
201987
+ <tr>
201988
+ <th>No.</th>
201989
+ <th>최종수정자</th>
201990
+ <th>문서ID</th>
201991
+ <th>문서명</th>
201992
+ <th>매출액</th>
201993
+ <th>최초등록자</th>
201994
+ <th>최초등록일</th>
201995
+ <th>최종수정일</th>
201996
+ </tr>
201997
+ </thead>
201998
+ <tbody>
201999
+ <tr>
202000
+ <th><ng-row-indicator /></th>
202001
+ <td data-bind="updateUser" text-align="center"></td>
202002
+ <td data-bind="docId" text-align="center"></td>
202003
+ <td data-bind="docNm" text-align="left"></td>
202004
+ <td
202005
+ data-bind="amt"
202006
+ data-expr="data.amt.toLocaleString()"
202007
+ text-align="right"
202008
+ show-icon="true"
202009
+ icon-type="sphere"
202010
+ icon-color="data.amt >= 2000 ? 'red' : 'gray'"
202011
+ ></td>
202012
+ <td data-bind="insertUser" text-align="center"></td>
202013
+ <td data-bind="insertDt" text-align="center"></td>
202014
+ <td data-bind="updateDt" text-align="center"></td>
202015
+ </tr>
202016
+ </tbody>
202017
+ </table>
202018
+ </nine-grid>
202019
+ </div>
202020
+ </div>
202021
+ </div>
202022
+ );
202023
+ };
201890
202024
 
201891
- elAiChat.add("me", userPrompt);
201892
- elAiChat.add("ing", "...");
202025
+ export default DocManager;
202026
+ `;
201893
202027
 
201894
- try {
201895
- const r = await this.#ai.generateSourceClient(userPrompt, apply);
201896
- elAiChat.add("ai", r);
201897
- } catch (error) {
201898
- console.error(error);
201899
- elAiChat.add("ai", String(error).replace("Error:", ""));
201900
- }
202028
+ const src2 = `
202029
+ import React, { useRef, useEffect } from "react";
202030
+ import { api, ai } from "ide-assi";
202031
+ import ninegrid from "ninegrid2";
201901
202032
 
201902
- this.#ing = false;
202033
+ const DocManager = () => {
202034
+ const tabRef = useRef(null);
202035
+ const gridRef = useRef(null);
202036
+
202037
+ const selectList = async (params) => {
202038
+ if (!gridRef.current) return;
202039
+ gridRef.current.classList.add("loading");
202040
+ api.post(\`/api/tmpl-a/doc-manager/selectList\`, params).then((res) => {
202041
+ gridRef.current.data.source = res.list;
202042
+ });
202043
+ };
202044
+
202045
+ const handleNaturalLanguageSearch = async () => {
202046
+ const searchTextElement = ninegrid.querySelector("#searchText", tabRef.current);
202047
+ const searchText = searchTextElement ? searchTextElement.value : "";
202048
+
202049
+ if (!gridRef.current) return;
202050
+ gridRef.current.classList.add("loading");
202051
+
202052
+ let params = {};
202053
+ if (searchText) {
202054
+ params = {
202055
+ _whereClause: await ai.generateWhereCause(
202056
+ "tmpla/DocManagerMapper.xml",
202057
+ "selectList",
202058
+ searchText,
202059
+ import.meta.env.VITE_GEMINI_API_KEY
202060
+ ),
202061
+ };
202062
+ }
202063
+ selectList(params);
202064
+ };
202065
+
202066
+ const handleClassicSearch = () => {
202067
+ if (!gridRef.current) return;
202068
+ gridRef.current.classList.add("loading");
202069
+
202070
+ const form2Element = ninegrid.querySelector(".form2", tabRef.current);
202071
+ const params = form2Element ? form2Element.getData() : {};
202072
+ selectList(params);
202073
+ };
202074
+
202075
+ useEffect(() => {
202076
+ selectList({});
202077
+
202078
+ const searchTextElement = ninegrid.querySelector("#searchText", tabRef.current);
202079
+ const searchButton = ninegrid.querySelector(".search", tabRef.current);
202080
+
202081
+ const handleKeyDown = (e) => {
202082
+ if (e.key === "Enter" && !e.isComposing) {
202083
+ handleNaturalLanguageSearch();
202084
+ }
202085
+ };
202086
+
202087
+ const handleClick = () => {
202088
+ handleClassicSearch();
202089
+ };
202090
+
202091
+ if (searchTextElement) {
202092
+ searchTextElement.addEventListener("keydown", handleKeyDown);
202093
+ }
202094
+ if (searchButton) {
202095
+ searchButton.addEventListener("click", handleClick);
202096
+ }
202097
+
202098
+ return () => {
202099
+ if (searchTextElement) {
202100
+ searchTextElement.removeEventListener("keydown", handleKeyDown);
202101
+ }
202102
+ if (searchButton) {
202103
+ searchButton.removeEventListener("click", handleClick);
202104
+ }
202105
+ };
202106
+ }, []);
202107
+
202108
+ return (
202109
+ <div className="wrapper">
202110
+ <nx-collapse target="nx-tab" className="search-collapse"></nx-collapse>
202111
+ <div className="list-wrapper">
202112
+ <nx-tab theme="theme-3" ref={tabRef}>
202113
+ <nx-tab-page caption="자연어 검색">
202114
+ <nx-form className="form1">
202115
+ <input
202116
+ type="text"
202117
+ id="searchText"
202118
+ name="searchText"
202119
+ placeholder="자연어 검색어를 입력하세요 (ex: 작성자가 홍길동인 데이타를 찾아줘)"
202120
+ />
202121
+ </nx-form>
202122
+ </nx-tab-page>
202123
+ <nx-tab-page caption="클래식 검색">
202124
+ <nx-form className="form2">
202125
+ <label>문서명: <input type="text" name="docNm" /></label>
202126
+ <label>매출액:
202127
+ <input type="number" name="minAmt" placeholder="최소" /> ~
202128
+ <input type="number" name="maxAmt" placeholder="최대" />
202129
+ </label>
202130
+ </nx-form>
202131
+ <button className="search">검색</button>
202132
+ </nx-tab-page>
202133
+ </nx-tab>
202134
+
202135
+ <div className="grid-wrapper">
202136
+ <nine-grid
202137
+ ref={gridRef}
202138
+ caption="매출 문서 관리"
202139
+ select-type="row"
202140
+ show-title-bar="true"
202141
+ show-menu-icon="true"
202142
+ show-status-bar="true"
202143
+ enable-fixed-col="true"
202144
+ row-resizable="false"
202145
+ col-movable="true"
202146
+ >
202147
+ <table>
202148
+ <colgroup>
202149
+ <col width="50" fixed="left" background-color="gray" />
202150
+ <col width="100" />
202151
+ <col width="120" />
202152
+ <col width="100" />
202153
+ <col width="200" />
202154
+ <col width="100" />
202155
+ <col width="150" />
202156
+ <col width="150" />
202157
+ </colgroup>
202158
+ <thead>
202159
+ <tr>
202160
+ <th>No.</th>
202161
+ <th>문서ID</th>
202162
+ <th>매출액</th>
202163
+ <th>최종수정자</th>
202164
+ <th>문서명</th>
202165
+ <th>최초등록자</th>
202166
+ <th>최초등록일</th>
202167
+ <th>최종수정일</th>
202168
+ </tr>
202169
+ </thead>
202170
+ <tbody>
202171
+ <tr>
202172
+ <th><ng-row-indicator /></th>
202173
+ <td data-bind="docId" text-align="center"></td>
202174
+ <td
202175
+ data-bind="amt"
202176
+ data-expr="data.amt.toLocaleString()"
202177
+ text-align="right"
202178
+ show-icon="true"
202179
+ icon-type="sphere"
202180
+ icon-color="data.amt >= 2000 ? 'red' : 'gray'"
202181
+ ></td>
202182
+ <td data-bind="updateUser" text-align="center"></td>
202183
+ <td data-bind="docNm" text-align="left"></td>
202184
+ <td data-bind="insertUser" text-align="center"></td>
202185
+ <td data-bind="insertDt" text-align="center"></td>
202186
+ <td data-bind="updateDt" text-align="center"></td>
202187
+ </tr>
202188
+ </tbody>
202189
+ </table>
202190
+ </nine-grid>
202191
+ </div>
202192
+ </div>
202193
+ </div>
202194
+ );
202195
+ };
202196
+
202197
+ export default DocManager;
202198
+ `;
202199
+
202200
+ this.shadowRoot.querySelector("ide-diff-popup").popup(src1, src2);
202201
+
202202
+ return;
201903
202203
  }
201904
202204
 
201905
202205
  #toggleCollapseHandler = () => {
@@ -234802,12 +235102,13 @@ class IdeDiff extends HTMLElement {
234802
235102
  // 먼저 데코레이션 효과를 계산하여 가져옵니다.
234803
235103
  const { asisEffect, tobeEffect } = this.#applyDiffDecorations(src1, src2);
234804
235104
 
235105
+ console.log(asisEffect, tobeEffect);
234805
235106
  // asis 에디터의 텍스트 변경 및 데코레이션 효과를 단일 트랜잭션으로 디스패치합니다.
234806
235107
  this.#asisEditorView.dispatch({
234807
235108
  changes: { from: 0, to: this.#asisEditorView.state.doc.length, insert: src1 },
234808
235109
  effects: [
234809
235110
  this.#languageCompartment.reconfigure(langExtension),
234810
- //asisEffect // 계산된 데코레이션 효과를 포함
235111
+ asisEffect // 계산된 데코레이션 효과를 포함
234811
235112
  ]
234812
235113
  });
234813
235114