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