ide-assi 0.383.0 → 0.384.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.
@@ -234842,9 +234842,350 @@ class IdeDiff extends HTMLElement {
234842
234842
 
234843
234843
  requestAnimationFrame(() => {
234844
234844
  this.#initCodeMirror();
234845
- const srcA = 'asdfa asdfadf asdfa asdfadf';
234846
- const srcB = '111 asdfadf asdfa asdfadf';
234847
- this.initialize(srcA, srcB, 'javascript');
234845
+ const src1 = `
234846
+ import React, { useRef, useEffect } from "react" adfa;
234847
+ import { api, ai } from "ide-assi";
234848
+ import ninegrid from "ninegrid2";
234849
+
234850
+ const DocManager = () => {
234851
+ const tabRef = useRef(null);
234852
+ const gridRef = useRef(null);
234853
+
234854
+ const selectList = async (params) => {
234855
+ if (!gridRef.current) return;
234856
+ gridRef.current.classList.add("loading");
234857
+ api.post(\`/api/tmpl-a/doc-manager/selectList\`, params).then((res) => {
234858
+ gridRef.current.data.source = res.list;
234859
+ });
234860
+ };
234861
+
234862
+ const handleNaturalLanguageSearch = async () => {
234863
+ const searchTextElement = ninegrid.querySelector("#searchText", tabRef.current);
234864
+ const searchText = searchTextElement ? searchTextElement.value : "";
234865
+
234866
+ if (!gridRef.current) return;
234867
+ gridRef.current.classList.add("loading");
234868
+
234869
+ let params = {};
234870
+ if (searchText) {
234871
+ params = {
234872
+ _whereClause: await ai.generateWhereCause(
234873
+ "tmpla/DocManagerMapper.xml",
234874
+ "selectList",
234875
+ searchText,
234876
+ import.meta.env.VITE_GEMINI_API_KEY
234877
+ ),
234878
+ };
234879
+ }
234880
+ selectList(params);
234881
+ };
234882
+
234883
+ const handleClassicSearch = () => {
234884
+ if (!gridRef.current) return;
234885
+ gridRef.current.classList.add("loading");
234886
+
234887
+ const form2Element = ninegrid.querySelector(".form2", tabRef.current);
234888
+ const params = form2Element ? form2Element.getData() : {};
234889
+ selectList(params);
234890
+ };
234891
+
234892
+ useEffect(() => {
234893
+ selectList({});
234894
+
234895
+ const searchTextElement = ninegrid.querySelector("#searchText", tabRef.current);
234896
+ const searchButton = ninegrid.querySelector(".search", tabRef.current);
234897
+
234898
+ const handleKeyDown = (e) => {
234899
+ if (e.key === "Enter" && !e.isComposing) {
234900
+ handleNaturalLanguageSearch();
234901
+ }
234902
+ };
234903
+
234904
+ const handleClick = () => {
234905
+ handleClassicSearch();
234906
+ };
234907
+
234908
+ if (searchTextElement) {
234909
+ searchTextElement.addEventListener("keydown", handleKeyDown);
234910
+ }
234911
+ if (searchButton) {
234912
+ searchButton.addEventListener("click", handleClick);
234913
+ }
234914
+
234915
+ return () => {
234916
+ if (searchTextElement) {
234917
+ searchTextElement.removeEventListener("keydown", handleKeyDown);
234918
+ }
234919
+ if (searchButton) {
234920
+ searchButton.removeEventListener("click", handleClick);
234921
+ }
234922
+ };
234923
+ }, []);
234924
+
234925
+ return (
234926
+ <div className="wrapper">
234927
+ <nx-collapse target="nx-tab" className="search-collapse"></nx-collapse>
234928
+ <div className="list-wrapper">
234929
+ <nx-tab theme="theme-3" ref={tabRef}>
234930
+ <nx-tab-page caption="자연어 검색">
234931
+ <nx-form className="form1">
234932
+ <input
234933
+ type="text"
234934
+ id="searchText"
234935
+ name="searchText"
234936
+ placeholder="자연어 검색어를 입력하세요 (ex: 작성자가 홍길동인 데이타를 찾아줘)"
234937
+ />
234938
+ </nx-form>
234939
+ </nx-tab-page>
234940
+ <nx-tab-page caption="클래식 검색">
234941
+ <nx-form className="form2">
234942
+ <label>문서명: <input type="text" name="docNm" /></label>
234943
+ <label>매출액:
234944
+ <input type="number" name="minAmt" placeholder="최소" /> ~
234945
+ <input type="number" name="maxAmt" placeholder="최대" />
234946
+ </label>
234947
+ </nx-form>
234948
+ <button className="search">검색</button>
234949
+ </nx-tab-page>
234950
+ </nx-tab>
234951
+
234952
+ <div className="grid-wrapper">
234953
+ <nine-grid
234954
+ ref={gridRef}
234955
+ caption="문서관리"
234956
+ select-type="row"
234957
+ show-title-bar="true"
234958
+ show-menu-icon="true"
234959
+ show-status-bar="true"
234960
+ enable-fixed-col="true"
234961
+ row-resizable="false"
234962
+ col-movable="true"
234963
+ >
234964
+ <table>
234965
+ <colgroup>
234966
+ <col width="50" fixed="left" background-color="gray" />
234967
+ <col width="100" />
234968
+ <col width="100" />
234969
+ <col width="200" />
234970
+ <col width="120" />
234971
+ <col width="100" />
234972
+ <col width="150" />
234973
+ <col width="150" />
234974
+ </colgroup>
234975
+ <thead>
234976
+ <tr>
234977
+ <th>No.</th>
234978
+ <th>최종수정자</th>
234979
+ <th>문서ID</th>
234980
+ <th>문서명</th>
234981
+ <th>매출액</th>
234982
+ <th>최초등록자</th>
234983
+ <th>최초등록일</th>
234984
+ <th>최종수정일</th>
234985
+ </tr>
234986
+ </thead>
234987
+ <tbody>
234988
+ <tr>
234989
+ <th><ng-row-indicator /></th>
234990
+ <td data-bind="updateUser" text-align="center"></td>
234991
+ <td data-bind="docId" text-align="center"></td>
234992
+ <td data-bind="docNm" text-align="left"></td>
234993
+ <td
234994
+ data-bind="amt"
234995
+ data-expr="data.amt.toLocaleString()"
234996
+ text-align="right"
234997
+ show-icon="true"
234998
+ icon-type="sphere"
234999
+ icon-color="data.amt >= 2000 ? 'red' : 'gray'"
235000
+ ></td>
235001
+ <td data-bind="insertUser" text-align="center"></td>
235002
+ <td data-bind="insertDt" text-align="center"></td>
235003
+ <td data-bind="updateDt" text-align="center"></td>
235004
+ </tr>
235005
+ </tbody>
235006
+ </table>
235007
+ </nine-grid>
235008
+ </div>
235009
+ </div>
235010
+ </div>
235011
+ );
235012
+ };
235013
+
235014
+ export default DocManager;
235015
+ `;
235016
+
235017
+ const src2 = `
235018
+ import React, { useRef, useEffect } from "react";
235019
+ import { api, ai } from "ide-assi";
235020
+ import ninegrid from "ninegrid2";
235021
+
235022
+ const DocManager = () => {
235023
+ const tabRef = useRef(null);
235024
+ const gridRef = useRef(null);
235025
+
235026
+ const selectList = async (params) => {
235027
+ if (!gridRef.current) return;
235028
+ gridRef.current.classList.add("loading");
235029
+ api.post(\`/api/tmpl-a/doc-manager/selectList\`, params).then((res) => {
235030
+ gridRef.current.data.source = res.list;
235031
+ });
235032
+ };
235033
+
235034
+ const handleNaturalLanguageSearch = async () => {
235035
+ const searchTextElement = ninegrid.querySelector("#searchText", tabRef.current);
235036
+ const searchText = searchTextElement ? searchTextElement.value : "";
235037
+
235038
+ if (!gridRef.current) return;
235039
+ gridRef.current.classList.add("loading");
235040
+
235041
+ let params = {};
235042
+ if (searchText) {
235043
+ params = {
235044
+ _whereClause: await ai.generateWhereCause(
235045
+ "tmpla/DocManagerMapper.xml",
235046
+ "selectList",
235047
+ searchText,
235048
+ import.meta.env.VITE_GEMINI_API_KEY
235049
+ ),
235050
+ };
235051
+ }
235052
+ selectList(params);
235053
+ };
235054
+
235055
+ const handleClassicSearch = () => {
235056
+ if (!gridRef.current) return;
235057
+ gridRef.current.classList.add("loading");
235058
+
235059
+ const form2Element = ninegrid.querySelector(".form2", tabRef.current);
235060
+ const params = form2Element ? form2Element.getData() : {};
235061
+ selectList(params);
235062
+ };
235063
+
235064
+ useEffect(() => {
235065
+ selectList({});
235066
+
235067
+ const searchTextElement = ninegrid.querySelector("#searchText", tabRef.current);
235068
+ const searchButton = ninegrid.querySelector(".search", tabRef.current);
235069
+
235070
+ const handleKeyDown = (e) => {
235071
+ if (e.key === "Enter" && !e.isComposing) {
235072
+ handleNaturalLanguageSearch();
235073
+ }
235074
+ };
235075
+
235076
+ const handleClick = () => {
235077
+ handleClassicSearch();
235078
+ };
235079
+
235080
+ if (searchTextElement) {
235081
+ searchTextElement.addEventListener("keydown", handleKeyDown);
235082
+ }
235083
+ if (searchButton) {
235084
+ searchButton.addEventListener("click", handleClick);
235085
+ }
235086
+
235087
+ return () => {
235088
+ if (searchTextElement) {
235089
+ searchTextElement.removeEventListener("keydown", handleKeyDown);
235090
+ }
235091
+ if (searchButton) {
235092
+ searchButton.removeEventListener("click", handleClick);
235093
+ }
235094
+ };
235095
+ }, []);
235096
+
235097
+ return (
235098
+ <div className="wrapper">
235099
+ <nx-collapse target="nx-tab" className="search-collapse"></nx-collapse>
235100
+ <div className="list-wrapper">
235101
+ <nx-tab theme="theme-3" ref={tabRef}>
235102
+ <nx-tab-page caption="자연어 검색">
235103
+ <nx-form className="form1">
235104
+ <input
235105
+ type="text"
235106
+ id="searchText"
235107
+ name="searchText"
235108
+ placeholder="자연어 검색어를 입력하세요 (ex: 작성자가 홍길동인 데이타를 찾아줘)"
235109
+ />
235110
+ </nx-form>
235111
+ </nx-tab-page>
235112
+ <nx-tab-page caption="클래식 검색">
235113
+ <nx-form className="form2">
235114
+ <label>문서명: <input type="text" name="docNm" /></label>
235115
+ <label>매출액:
235116
+ <input type="number" name="minAmt" placeholder="최소" /> ~
235117
+ <input type="number" name="maxAmt" placeholder="최대" />
235118
+ </label>
235119
+ </nx-form>
235120
+ <button className="search">검색</button>
235121
+ </nx-tab-page>
235122
+ </nx-tab>
235123
+
235124
+ <div className="grid-wrapper">
235125
+ <nine-grid
235126
+ ref={gridRef}
235127
+ caption="매출 문서 관리"
235128
+ select-type="row"
235129
+ show-title-bar="true"
235130
+ show-menu-icon="true"
235131
+ show-status-bar="true"
235132
+ enable-fixed-col="true"
235133
+ row-resizable="false"
235134
+ col-movable="true"
235135
+ >
235136
+ <table>
235137
+ <colgroup>
235138
+ <col width="50" fixed="left" background-color="gray" />
235139
+ <col width="100" />
235140
+ <col width="120" />
235141
+ <col width="100" />
235142
+ <col width="200" />
235143
+ <col width="100" />
235144
+ <col width="150" />
235145
+ <col width="150" />
235146
+ </colgroup>
235147
+ <thead>
235148
+ <tr>
235149
+ <th>No.</th>
235150
+ <th>문서ID</th>
235151
+ <th>매출액</th>
235152
+ <th>최종수정자</th>
235153
+ <th>문서명</th>
235154
+ <th>최초등록자</th>
235155
+ <th>최초등록일</th>
235156
+ <th>최종수정일</th>
235157
+ </tr>
235158
+ </thead>
235159
+ <tbody>
235160
+ <tr>
235161
+ <th><ng-row-indicator /></th>
235162
+ <td data-bind="docId" text-align="center"></td>
235163
+ <td
235164
+ data-bind="amt"
235165
+ data-expr="data.amt.toLocaleString()"
235166
+ text-align="right"
235167
+ show-icon="true"
235168
+ icon-type="sphere"
235169
+ icon-color="data.amt >= 2000 ? 'red' : 'gray'"
235170
+ ></td>
235171
+ <td data-bind="updateUser" text-align="center"></td>
235172
+ <td data-bind="docNm" text-align="left"></td>
235173
+ <td data-bind="insertUser" text-align="center"></td>
235174
+ <td data-bind="insertDt" text-align="center"></td>
235175
+ <td data-bind="updateDt" text-align="center"></td>
235176
+ </tr>
235177
+ </tbody>
235178
+ </table>
235179
+ </nine-grid>
235180
+ </div>
235181
+ </div>
235182
+ </div>
235183
+ );
235184
+ };
235185
+
235186
+ export default DocManager;
235187
+ `;
235188
+ this.initialize(src1, src2, 'javascript');
234848
235189
  });
234849
235190
  }
234850
235191