ide-assi 0.328.0 → 0.329.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.
@@ -194116,10 +194116,329 @@ class IdeAssi extends HTMLElement
194116
194116
 
194117
194117
  //this.shadowRoot.querySelector('ide-diff-popup').remove();
194118
194118
 
194119
- const a = this.shadowRoot.appendChild(document.createElement('ide-diff-popup'));
194120
- console.log(a);
194119
+ this.shadowRoot.appendChild(document.createElement('ide-diff-popup'));
194120
+
194121
194121
  //setTimeout(() => {
194122
- this.shadowRoot.querySelector("ide-diff-popup").popup("aaa", "bbb");
194122
+ const src1 = `
194123
+ import React, { useRef, useEffect } from "react";
194124
+ import { api, ai } from "ide-assi";
194125
+ import ninegrid from "ninegrid2";
194126
+
194127
+ const DocManager = () => {
194128
+ const tabRef = useRef(null);
194129
+ const gridRef = useRef(null);
194130
+
194131
+ const selectList = async (params) => {
194132
+ if (!gridRef.current) return;
194133
+ gridRef.current.classList.add("loading");
194134
+ api.post(\`/api/tmpl-a/doc-manager/selectList\`, params).then((res) => {
194135
+ gridRef.current.data.source = res.list;
194136
+ });
194137
+ };
194138
+
194139
+ const handleNaturalLanguageSearch = async () => {
194140
+ const searchTextElement = ninegrid.querySelector("#searchText", tabRef.current);
194141
+ const searchText = searchTextElement ? searchTextElement.value : "";
194142
+
194143
+ if (!gridRef.current) return;
194144
+ gridRef.current.classList.add("loading");
194145
+
194146
+ let params = {};
194147
+ if (searchText) {
194148
+ params = {
194149
+ _whereClause: await ai.generateWhereCause(
194150
+ "tmpla/DocManagerMapper.xml",
194151
+ "selectList",
194152
+ searchText,
194153
+ import.meta.env.VITE_GEMINI_API_KEY
194154
+ ),
194155
+ };
194156
+ }
194157
+ selectList(params);
194158
+ };
194159
+
194160
+ const handleClassicSearch = () => {
194161
+ const form2Element = ninegrid.querySelector(".form2", tabRef.current);
194162
+ const params = form2Element ? form2Element.getData() : {};
194163
+ selectList(params);
194164
+ };
194165
+
194166
+ useEffect(() => {
194167
+ selectList({});
194168
+
194169
+ const searchTextElement = ninegrid.querySelector("#searchText", tabRef.current);
194170
+ const searchButton = ninegrid.querySelector(".search", tabRef.current);
194171
+
194172
+ const handleKeyDown = (e) => {
194173
+ if (e.key === "Enter" && !e.isComposing) {
194174
+ handleNaturalLanguageSearch();
194175
+ }
194176
+ };
194177
+
194178
+ const handleClick = () => {
194179
+ handleClassicSearch();
194180
+ };
194181
+
194182
+ if (searchTextElement) {
194183
+ searchTextElement.addEventListener("keydown", handleKeyDown);
194184
+ }
194185
+ if (searchButton) {
194186
+ searchButton.addEventListener("click", handleClick);
194187
+ }
194188
+
194189
+ return () => {
194190
+ if (searchTextElement) {
194191
+ searchTextElement.removeEventListener("keydown", handleKeyDown);
194192
+ }
194193
+ if (searchButton) {
194194
+ searchButton.removeEventListener("click", handleClick);
194195
+ }
194196
+ };
194197
+ }, []);
194198
+
194199
+ return (
194200
+ <div className="wrapper">
194201
+ <nx-collapse target="nx-tab" className="search-collapse"></nx-collapse>
194202
+ <div className="list-wrapper">
194203
+ <nx-tab theme="theme-3" ref={tabRef}>
194204
+ <nx-tab-page caption="자연어 검색">
194205
+ <nx-form className="form1">
194206
+ <input
194207
+ type="text"
194208
+ id="searchText"
194209
+ name="searchText"
194210
+ placeholder="자연어 검색어를 입력하세요 (ex: 작성자가 홍길동인 데이타를 찾아줘)"
194211
+ />
194212
+ </nx-form>
194213
+ </nx-tab-page>
194214
+ <nx-tab-page caption="클래식 검색">
194215
+ <nx-form className="form2">
194216
+ <label>문서명: <input type="text" name="docNm" /></label>
194217
+ <label>매출액:
194218
+ <input type="number" name="minAmt" placeholder="최소" /> ~
194219
+ <input type="number" name="maxAmt" placeholder="최대" />
194220
+ </label>
194221
+ </nx-form>
194222
+ <button className="search">검색</button>
194223
+ </nx-tab-page>
194224
+ </nx-tab>
194225
+
194226
+ <div className="grid-wrapper">
194227
+ <nine-grid
194228
+ ref={gridRef}
194229
+ caption="문서관리"
194230
+ select-type="row"
194231
+ show-title-bar="true"
194232
+ show-menu-icon="true"
194233
+ show-status-bar="true"
194234
+ enable-fixed-col="true"
194235
+ row-resizable="false"
194236
+ col-movable="true"
194237
+ >
194238
+ <table>
194239
+ <colgroup>
194240
+ <col width="50" fixed="left" background-color="gray" />
194241
+ <col width="100" />
194242
+ <col width="100" />
194243
+ <col width="200" />
194244
+ <col width="120" />
194245
+ <col width="100" />
194246
+ <col width="150" />
194247
+ <col width="150" />
194248
+ </colgroup>
194249
+ <thead>
194250
+ <tr>
194251
+ <th>No.</th>
194252
+ <th>최종수정자</th>
194253
+ <th>문서ID</th>
194254
+ <th>문서명</th>
194255
+ <th>매출액</th>
194256
+ <th>최초등록자</th>
194257
+ <th>최초등록일</th>
194258
+ <th>최종수정일</th>
194259
+ </tr>
194260
+ </thead>
194261
+ <tbody>
194262
+ <tr>
194263
+ <th><ng-row-indicator /></th>
194264
+ <td data-bind="updateUser" text-align="center"></td>
194265
+ <td data-bind="docId" text-align="center"></td>
194266
+ <td data-bind="docNm" text-align="left"></td>
194267
+ <td
194268
+ data-bind="amt"
194269
+ data-expr="data.amt.toLocaleString()"
194270
+ text-align="right"
194271
+ show-icon="true"
194272
+ icon-type="sphere"
194273
+ icon-color="data.amt >= 2000 ? 'red' : 'gray'"
194274
+ ></td>
194275
+ <td data-bind="insertUser" text-align="center"></td>
194276
+ <td data-bind="insertDt" text-align="center"></td>
194277
+ <td data-bind="updateDt" text-align="center"></td>
194278
+ </tr>
194279
+ </tbody>
194280
+ </table>
194281
+ </nine-grid>
194282
+ </div>
194283
+ </div>
194284
+ </div>
194285
+ );
194286
+ };
194287
+
194288
+ export default DocManager;
194289
+ `;
194290
+
194291
+ const src2 = `
194292
+ import React, { useRef, useEffect } from 'react';
194293
+ import { api, ai } from "ide-assi";
194294
+ import ninegrid from "ninegrid2";
194295
+
194296
+ const DocManager = () => {
194297
+ const tabRef = useRef(null);
194298
+ const gridRef = useRef(null);
194299
+
194300
+ const toCamelCase = (s) => {
194301
+ return s.toLowerCase().replace(/_([a-z])/g, (g) => g[1].toUpperCase());
194302
+ };
194303
+
194304
+ const tableDefinitions = JSON.parse(\`{"list":[{"columns":[{"COLUMN_NAME":"doc_id","COLUMN_ID":1,"COLUMN_COMMENT":"문서ID"},{"COLUMN_NAME":"doc_nm","COLUMN_ID":2,"COLUMN_COMMENT":"문서명"},{"COLUMN_NAME":"amt","COLUMN_ID":3,"COLUMN_COMMENT":"매출액"},{"COLUMN_NAME":"insert_user","COLUMN_ID":4,"COLUMN_COMMENT":"최초등록자"},{"COLUMN_NAME":"insert_dt","COLUMN_ID":5,"COLUMN_COMMENT":"최초등록일"},{"COLUMN_NAME":"update_user","COLUMN_ID":6,"COLUMN_COMMENT":"최종수정자"},{"COLUMN_NAME":"update_dt","COLUMN_ID":7,"COLUMN_COMMENT":"최종수정일"}],"table":"t_doc"},{"columns":[{"COLUMN_NAME":"file_id","COLUMN_ID":1,"COLUMN_COMMENT":""},{"COLUMN_NAME":"doc_id","COLUMN_ID":2,"COLUMN_COMMENT":""},{"COLUMN_NAME":"download_cnt","COLUMN_ID":3,"COLUMN_COMMENT":""},{"COLUMN_NAME":"file_nm","COLUMN_ID":4,"COLUMN_COMMENT":""},{"COLUMN_NAME":"file_size","COLUMN_ID":5,"COLUMN_COMMENT":""},{"COLUMN_NAME":"file_contents","COLUMN_ID":6,"COLUMN_COMMENT":""},{"COLUMN_NAME":"insert_user","COLUMN_ID":7,"COLUMN_COMMENT":""},{"COLUMN_NAME":"insert_dt","COLUMN_ID":8,"COLUMN_COMMENT":""}],"table":"t_doc_file"},{"columns":[{"COLUMN_NAME":"file_id","COLUMN_ID":1,"COLUMN_COMMENT":""},{"COLUMN_NAME":"page","COLUMN_ID":2,"COLUMN_COMMENT":""},{"COLUMN_NAME":"text","COLUMN_ID":3,"COLUMN_COMMENT":""},{"COLUMN_NAME":"image","COLUMN_ID":4,"COLUMN_COMMENT":""},{"COLUMN_NAME":"vector_text","COLUMN_ID":5,"COLUMN_COMMENT":""},{"COLUMN_NAME":"vector_image","COLUMN_ID":6,"COLUMN_COMMENT":""}],"table":"t_doc_file_page"}]}\`);
194305
+ const mainTableColumns = tableDefinitions.list[0].columns;
194306
+
194307
+ const selectList = async (formData = {}) => {
194308
+ if (!gridRef.current) return;
194309
+
194310
+ gridRef.current.classList.add("loading");
194311
+ /**
194312
+ const form1Data = ninegrid.querySelector(".form1", tabRef.current).getData();
194313
+ const form2Data = ninegrid.querySelector(".form2", tabRef.current).getData();
194314
+ const formData = { ...form1Data, ...form2Data };
194315
+
194316
+ const formData1 = {
194317
+ "_whereClause": await getWhere(),
194318
+ }
194319
+ console.log(formData1);
194320
+ */
194321
+
194322
+ console.log(formData);
194323
+
194324
+ api.post(\`/api/tmpl-a/doc-manager/selectList\`, formData).then((res) => {
194325
+ gridRef.current.data.source = res.list;
194326
+ });
194327
+ };
194328
+
194329
+ const getWhere = async () => {
194330
+ return await ai.generateWhereCause("tmpla/DocManagerMapper.xml", "selectList", ninegrid.querySelector("#searchText", tabRef.current).value, import.meta.env.VITE_GEMINI_API_KEY);
194331
+ };
194332
+
194333
+ useEffect(() => {
194334
+ selectList();
194335
+
194336
+ const searchTextInput = ninegrid.querySelector("#searchText", tabRef.current);
194337
+ const searchButton = ninegrid.querySelector(".search", tabRef.current);
194338
+
194339
+ const handleSearchTextKeydown = (e) => {
194340
+ if (e.key === 'Enter' && !e.isComposing) {
194341
+
194342
+ //getWhere();
194343
+ getWhere().then(res => {
194344
+ selectList({"_whereClause":res});
194345
+ });
194346
+ }
194347
+ };
194348
+
194349
+ const handleSearchButtonClick = () => {
194350
+ selectList(ninegrid.querySelector(".form2", tabRef.current).getData());
194351
+ };
194352
+
194353
+ if (searchTextInput) {
194354
+ searchTextInput.addEventListener('keydown', handleSearchTextKeydown);
194355
+ }
194356
+ if (searchButton) {
194357
+ searchButton.addEventListener('click', handleSearchButtonClick);
194358
+ }
194359
+
194360
+ return () => {
194361
+ if (searchTextInput) {
194362
+ searchTextInput.removeEventListener('keydown', handleSearchTextKeydown);
194363
+ }
194364
+ if (searchButton) {
194365
+ searchButton.removeEventListener('click', handleSearchButtonClick);
194366
+ }
194367
+ };
194368
+ }, []);
194369
+
194370
+ return (
194371
+ <div className="wrapper">
194372
+ <nx-collapse target="nx-tab" className="search-collapse"></nx-collapse>
194373
+ <div className="list-wrapper">
194374
+ <nx-tab theme="theme-3" ref={tabRef}>
194375
+ <nx-tab-page caption="자연어 검색">
194376
+ <nx-form className="form1">
194377
+ <input type="text" id="searchText" name="searchText"
194378
+ placeholder="자연어 검색어를 입력하세요 (ex: 작성자가 홍길동인 데이타를 찾아줘)"/>
194379
+ </nx-form>
194380
+ </nx-tab-page>
194381
+ <nx-tab-page caption="클래식 검색">
194382
+ <nx-form className="form2">
194383
+ <label>문서ID: <input type="text" name="docId"/></label>
194384
+ <label>문서명: <input type="text" name="docNm"/></label>
194385
+ <label>매출액: <input type="number" name="amt"/></label>
194386
+ <label>최초등록자: <input type="text" name="insertUser"/></label>
194387
+ <label>최초등록일: <input type="text" name="insertDt"/></label>
194388
+ <label>최종수정자: <input type="text" name="updateUser"/></label>
194389
+ <label>최종수정일: <input type="text" name="updateDt"/></label>
194390
+ </nx-form>
194391
+ <button className="search">검색</button>
194392
+ </nx-tab-page>
194393
+ </nx-tab>
194394
+
194395
+ <div className="grid-wrapper">
194396
+ <nine-grid
194397
+ ref={gridRef}
194398
+ caption="문서관리"
194399
+ select-type="row"
194400
+ show-title-bar="true"
194401
+ show-menu-icon="true"
194402
+ show-status-bar="true"
194403
+ enable-fixed-col="true"
194404
+ row-resizable="false"
194405
+ col-movable="true"
194406
+ >
194407
+ <table>
194408
+ <colgroup>
194409
+ <col width="50" fixed="left" background-color="gray"/>
194410
+ {mainTableColumns.map((col) => (
194411
+ <col key={col.COLUMN_ID} width="150"/>
194412
+ ))}
194413
+ </colgroup>
194414
+ <thead>
194415
+ <tr>
194416
+ <th>No.</th>
194417
+ {mainTableColumns.map((col) => (
194418
+ <th key={col.COLUMN_ID}>{col.COLUMN_COMMENT || col.COLUMN_NAME}</th>
194419
+ ))}
194420
+ </tr>
194421
+ </thead>
194422
+ <tbody>
194423
+ <tr>
194424
+ <th><ng-row-indicator/></th>
194425
+ {mainTableColumns.map((col) => (
194426
+ <td key={col.COLUMN_ID} data-bind={toCamelCase(col.COLUMN_NAME)}></td>
194427
+ ))}
194428
+ </tr>
194429
+ </tbody>
194430
+ </table>
194431
+ </nine-grid>
194432
+ </div>
194433
+ </div>
194434
+ </div>
194435
+ );
194436
+ };
194437
+
194438
+ export default DocManager;
194439
+ `;
194440
+
194441
+ this.shadowRoot.querySelector("ide-diff-popup").popup(src1, src2);
194123
194442
 
194124
194443
  return;
194125
194444
  }
@@ -194112,10 +194112,329 @@ class IdeAssi extends HTMLElement
194112
194112
 
194113
194113
  //this.shadowRoot.querySelector('ide-diff-popup').remove();
194114
194114
 
194115
- const a = this.shadowRoot.appendChild(document.createElement('ide-diff-popup'));
194116
- console.log(a);
194115
+ this.shadowRoot.appendChild(document.createElement('ide-diff-popup'));
194116
+
194117
194117
  //setTimeout(() => {
194118
- this.shadowRoot.querySelector("ide-diff-popup").popup("aaa", "bbb");
194118
+ const src1 = `
194119
+ import React, { useRef, useEffect } from "react";
194120
+ import { api, ai } from "ide-assi";
194121
+ import ninegrid from "ninegrid2";
194122
+
194123
+ const DocManager = () => {
194124
+ const tabRef = useRef(null);
194125
+ const gridRef = useRef(null);
194126
+
194127
+ const selectList = async (params) => {
194128
+ if (!gridRef.current) return;
194129
+ gridRef.current.classList.add("loading");
194130
+ api.post(\`/api/tmpl-a/doc-manager/selectList\`, params).then((res) => {
194131
+ gridRef.current.data.source = res.list;
194132
+ });
194133
+ };
194134
+
194135
+ const handleNaturalLanguageSearch = async () => {
194136
+ const searchTextElement = ninegrid.querySelector("#searchText", tabRef.current);
194137
+ const searchText = searchTextElement ? searchTextElement.value : "";
194138
+
194139
+ if (!gridRef.current) return;
194140
+ gridRef.current.classList.add("loading");
194141
+
194142
+ let params = {};
194143
+ if (searchText) {
194144
+ params = {
194145
+ _whereClause: await ai.generateWhereCause(
194146
+ "tmpla/DocManagerMapper.xml",
194147
+ "selectList",
194148
+ searchText,
194149
+ import.meta.env.VITE_GEMINI_API_KEY
194150
+ ),
194151
+ };
194152
+ }
194153
+ selectList(params);
194154
+ };
194155
+
194156
+ const handleClassicSearch = () => {
194157
+ const form2Element = ninegrid.querySelector(".form2", tabRef.current);
194158
+ const params = form2Element ? form2Element.getData() : {};
194159
+ selectList(params);
194160
+ };
194161
+
194162
+ useEffect(() => {
194163
+ selectList({});
194164
+
194165
+ const searchTextElement = ninegrid.querySelector("#searchText", tabRef.current);
194166
+ const searchButton = ninegrid.querySelector(".search", tabRef.current);
194167
+
194168
+ const handleKeyDown = (e) => {
194169
+ if (e.key === "Enter" && !e.isComposing) {
194170
+ handleNaturalLanguageSearch();
194171
+ }
194172
+ };
194173
+
194174
+ const handleClick = () => {
194175
+ handleClassicSearch();
194176
+ };
194177
+
194178
+ if (searchTextElement) {
194179
+ searchTextElement.addEventListener("keydown", handleKeyDown);
194180
+ }
194181
+ if (searchButton) {
194182
+ searchButton.addEventListener("click", handleClick);
194183
+ }
194184
+
194185
+ return () => {
194186
+ if (searchTextElement) {
194187
+ searchTextElement.removeEventListener("keydown", handleKeyDown);
194188
+ }
194189
+ if (searchButton) {
194190
+ searchButton.removeEventListener("click", handleClick);
194191
+ }
194192
+ };
194193
+ }, []);
194194
+
194195
+ return (
194196
+ <div className="wrapper">
194197
+ <nx-collapse target="nx-tab" className="search-collapse"></nx-collapse>
194198
+ <div className="list-wrapper">
194199
+ <nx-tab theme="theme-3" ref={tabRef}>
194200
+ <nx-tab-page caption="자연어 검색">
194201
+ <nx-form className="form1">
194202
+ <input
194203
+ type="text"
194204
+ id="searchText"
194205
+ name="searchText"
194206
+ placeholder="자연어 검색어를 입력하세요 (ex: 작성자가 홍길동인 데이타를 찾아줘)"
194207
+ />
194208
+ </nx-form>
194209
+ </nx-tab-page>
194210
+ <nx-tab-page caption="클래식 검색">
194211
+ <nx-form className="form2">
194212
+ <label>문서명: <input type="text" name="docNm" /></label>
194213
+ <label>매출액:
194214
+ <input type="number" name="minAmt" placeholder="최소" /> ~
194215
+ <input type="number" name="maxAmt" placeholder="최대" />
194216
+ </label>
194217
+ </nx-form>
194218
+ <button className="search">검색</button>
194219
+ </nx-tab-page>
194220
+ </nx-tab>
194221
+
194222
+ <div className="grid-wrapper">
194223
+ <nine-grid
194224
+ ref={gridRef}
194225
+ caption="문서관리"
194226
+ select-type="row"
194227
+ show-title-bar="true"
194228
+ show-menu-icon="true"
194229
+ show-status-bar="true"
194230
+ enable-fixed-col="true"
194231
+ row-resizable="false"
194232
+ col-movable="true"
194233
+ >
194234
+ <table>
194235
+ <colgroup>
194236
+ <col width="50" fixed="left" background-color="gray" />
194237
+ <col width="100" />
194238
+ <col width="100" />
194239
+ <col width="200" />
194240
+ <col width="120" />
194241
+ <col width="100" />
194242
+ <col width="150" />
194243
+ <col width="150" />
194244
+ </colgroup>
194245
+ <thead>
194246
+ <tr>
194247
+ <th>No.</th>
194248
+ <th>최종수정자</th>
194249
+ <th>문서ID</th>
194250
+ <th>문서명</th>
194251
+ <th>매출액</th>
194252
+ <th>최초등록자</th>
194253
+ <th>최초등록일</th>
194254
+ <th>최종수정일</th>
194255
+ </tr>
194256
+ </thead>
194257
+ <tbody>
194258
+ <tr>
194259
+ <th><ng-row-indicator /></th>
194260
+ <td data-bind="updateUser" text-align="center"></td>
194261
+ <td data-bind="docId" text-align="center"></td>
194262
+ <td data-bind="docNm" text-align="left"></td>
194263
+ <td
194264
+ data-bind="amt"
194265
+ data-expr="data.amt.toLocaleString()"
194266
+ text-align="right"
194267
+ show-icon="true"
194268
+ icon-type="sphere"
194269
+ icon-color="data.amt >= 2000 ? 'red' : 'gray'"
194270
+ ></td>
194271
+ <td data-bind="insertUser" text-align="center"></td>
194272
+ <td data-bind="insertDt" text-align="center"></td>
194273
+ <td data-bind="updateDt" text-align="center"></td>
194274
+ </tr>
194275
+ </tbody>
194276
+ </table>
194277
+ </nine-grid>
194278
+ </div>
194279
+ </div>
194280
+ </div>
194281
+ );
194282
+ };
194283
+
194284
+ export default DocManager;
194285
+ `;
194286
+
194287
+ const src2 = `
194288
+ import React, { useRef, useEffect } from 'react';
194289
+ import { api, ai } from "ide-assi";
194290
+ import ninegrid from "ninegrid2";
194291
+
194292
+ const DocManager = () => {
194293
+ const tabRef = useRef(null);
194294
+ const gridRef = useRef(null);
194295
+
194296
+ const toCamelCase = (s) => {
194297
+ return s.toLowerCase().replace(/_([a-z])/g, (g) => g[1].toUpperCase());
194298
+ };
194299
+
194300
+ const tableDefinitions = JSON.parse(\`{"list":[{"columns":[{"COLUMN_NAME":"doc_id","COLUMN_ID":1,"COLUMN_COMMENT":"문서ID"},{"COLUMN_NAME":"doc_nm","COLUMN_ID":2,"COLUMN_COMMENT":"문서명"},{"COLUMN_NAME":"amt","COLUMN_ID":3,"COLUMN_COMMENT":"매출액"},{"COLUMN_NAME":"insert_user","COLUMN_ID":4,"COLUMN_COMMENT":"최초등록자"},{"COLUMN_NAME":"insert_dt","COLUMN_ID":5,"COLUMN_COMMENT":"최초등록일"},{"COLUMN_NAME":"update_user","COLUMN_ID":6,"COLUMN_COMMENT":"최종수정자"},{"COLUMN_NAME":"update_dt","COLUMN_ID":7,"COLUMN_COMMENT":"최종수정일"}],"table":"t_doc"},{"columns":[{"COLUMN_NAME":"file_id","COLUMN_ID":1,"COLUMN_COMMENT":""},{"COLUMN_NAME":"doc_id","COLUMN_ID":2,"COLUMN_COMMENT":""},{"COLUMN_NAME":"download_cnt","COLUMN_ID":3,"COLUMN_COMMENT":""},{"COLUMN_NAME":"file_nm","COLUMN_ID":4,"COLUMN_COMMENT":""},{"COLUMN_NAME":"file_size","COLUMN_ID":5,"COLUMN_COMMENT":""},{"COLUMN_NAME":"file_contents","COLUMN_ID":6,"COLUMN_COMMENT":""},{"COLUMN_NAME":"insert_user","COLUMN_ID":7,"COLUMN_COMMENT":""},{"COLUMN_NAME":"insert_dt","COLUMN_ID":8,"COLUMN_COMMENT":""}],"table":"t_doc_file"},{"columns":[{"COLUMN_NAME":"file_id","COLUMN_ID":1,"COLUMN_COMMENT":""},{"COLUMN_NAME":"page","COLUMN_ID":2,"COLUMN_COMMENT":""},{"COLUMN_NAME":"text","COLUMN_ID":3,"COLUMN_COMMENT":""},{"COLUMN_NAME":"image","COLUMN_ID":4,"COLUMN_COMMENT":""},{"COLUMN_NAME":"vector_text","COLUMN_ID":5,"COLUMN_COMMENT":""},{"COLUMN_NAME":"vector_image","COLUMN_ID":6,"COLUMN_COMMENT":""}],"table":"t_doc_file_page"}]}\`);
194301
+ const mainTableColumns = tableDefinitions.list[0].columns;
194302
+
194303
+ const selectList = async (formData = {}) => {
194304
+ if (!gridRef.current) return;
194305
+
194306
+ gridRef.current.classList.add("loading");
194307
+ /**
194308
+ const form1Data = ninegrid.querySelector(".form1", tabRef.current).getData();
194309
+ const form2Data = ninegrid.querySelector(".form2", tabRef.current).getData();
194310
+ const formData = { ...form1Data, ...form2Data };
194311
+
194312
+ const formData1 = {
194313
+ "_whereClause": await getWhere(),
194314
+ }
194315
+ console.log(formData1);
194316
+ */
194317
+
194318
+ console.log(formData);
194319
+
194320
+ api.post(\`/api/tmpl-a/doc-manager/selectList\`, formData).then((res) => {
194321
+ gridRef.current.data.source = res.list;
194322
+ });
194323
+ };
194324
+
194325
+ const getWhere = async () => {
194326
+ return await ai.generateWhereCause("tmpla/DocManagerMapper.xml", "selectList", ninegrid.querySelector("#searchText", tabRef.current).value, import.meta.env.VITE_GEMINI_API_KEY);
194327
+ };
194328
+
194329
+ useEffect(() => {
194330
+ selectList();
194331
+
194332
+ const searchTextInput = ninegrid.querySelector("#searchText", tabRef.current);
194333
+ const searchButton = ninegrid.querySelector(".search", tabRef.current);
194334
+
194335
+ const handleSearchTextKeydown = (e) => {
194336
+ if (e.key === 'Enter' && !e.isComposing) {
194337
+
194338
+ //getWhere();
194339
+ getWhere().then(res => {
194340
+ selectList({"_whereClause":res});
194341
+ });
194342
+ }
194343
+ };
194344
+
194345
+ const handleSearchButtonClick = () => {
194346
+ selectList(ninegrid.querySelector(".form2", tabRef.current).getData());
194347
+ };
194348
+
194349
+ if (searchTextInput) {
194350
+ searchTextInput.addEventListener('keydown', handleSearchTextKeydown);
194351
+ }
194352
+ if (searchButton) {
194353
+ searchButton.addEventListener('click', handleSearchButtonClick);
194354
+ }
194355
+
194356
+ return () => {
194357
+ if (searchTextInput) {
194358
+ searchTextInput.removeEventListener('keydown', handleSearchTextKeydown);
194359
+ }
194360
+ if (searchButton) {
194361
+ searchButton.removeEventListener('click', handleSearchButtonClick);
194362
+ }
194363
+ };
194364
+ }, []);
194365
+
194366
+ return (
194367
+ <div className="wrapper">
194368
+ <nx-collapse target="nx-tab" className="search-collapse"></nx-collapse>
194369
+ <div className="list-wrapper">
194370
+ <nx-tab theme="theme-3" ref={tabRef}>
194371
+ <nx-tab-page caption="자연어 검색">
194372
+ <nx-form className="form1">
194373
+ <input type="text" id="searchText" name="searchText"
194374
+ placeholder="자연어 검색어를 입력하세요 (ex: 작성자가 홍길동인 데이타를 찾아줘)"/>
194375
+ </nx-form>
194376
+ </nx-tab-page>
194377
+ <nx-tab-page caption="클래식 검색">
194378
+ <nx-form className="form2">
194379
+ <label>문서ID: <input type="text" name="docId"/></label>
194380
+ <label>문서명: <input type="text" name="docNm"/></label>
194381
+ <label>매출액: <input type="number" name="amt"/></label>
194382
+ <label>최초등록자: <input type="text" name="insertUser"/></label>
194383
+ <label>최초등록일: <input type="text" name="insertDt"/></label>
194384
+ <label>최종수정자: <input type="text" name="updateUser"/></label>
194385
+ <label>최종수정일: <input type="text" name="updateDt"/></label>
194386
+ </nx-form>
194387
+ <button className="search">검색</button>
194388
+ </nx-tab-page>
194389
+ </nx-tab>
194390
+
194391
+ <div className="grid-wrapper">
194392
+ <nine-grid
194393
+ ref={gridRef}
194394
+ caption="문서관리"
194395
+ select-type="row"
194396
+ show-title-bar="true"
194397
+ show-menu-icon="true"
194398
+ show-status-bar="true"
194399
+ enable-fixed-col="true"
194400
+ row-resizable="false"
194401
+ col-movable="true"
194402
+ >
194403
+ <table>
194404
+ <colgroup>
194405
+ <col width="50" fixed="left" background-color="gray"/>
194406
+ {mainTableColumns.map((col) => (
194407
+ <col key={col.COLUMN_ID} width="150"/>
194408
+ ))}
194409
+ </colgroup>
194410
+ <thead>
194411
+ <tr>
194412
+ <th>No.</th>
194413
+ {mainTableColumns.map((col) => (
194414
+ <th key={col.COLUMN_ID}>{col.COLUMN_COMMENT || col.COLUMN_NAME}</th>
194415
+ ))}
194416
+ </tr>
194417
+ </thead>
194418
+ <tbody>
194419
+ <tr>
194420
+ <th><ng-row-indicator/></th>
194421
+ {mainTableColumns.map((col) => (
194422
+ <td key={col.COLUMN_ID} data-bind={toCamelCase(col.COLUMN_NAME)}></td>
194423
+ ))}
194424
+ </tr>
194425
+ </tbody>
194426
+ </table>
194427
+ </nine-grid>
194428
+ </div>
194429
+ </div>
194430
+ </div>
194431
+ );
194432
+ };
194433
+
194434
+ export default DocManager;
194435
+ `;
194436
+
194437
+ this.shadowRoot.querySelector("ide-diff-popup").popup(src1, src2);
194119
194438
 
194120
194439
  return;
194121
194440
  }
@@ -120,10 +120,329 @@ export class IdeAssi extends HTMLElement
120
120
 
121
121
  //this.shadowRoot.querySelector('ide-diff-popup').remove();
122
122
 
123
- const a = this.shadowRoot.appendChild(document.createElement('ide-diff-popup'));
124
- console.log(a);
123
+ this.shadowRoot.appendChild(document.createElement('ide-diff-popup'));
124
+
125
125
  //setTimeout(() => {
126
- this.shadowRoot.querySelector("ide-diff-popup").popup("aaa", "bbb");
126
+ const src1 = `
127
+ import React, { useRef, useEffect } from "react";
128
+ import { api, ai } from "ide-assi";
129
+ import ninegrid from "ninegrid2";
130
+
131
+ const DocManager = () => {
132
+ const tabRef = useRef(null);
133
+ const gridRef = useRef(null);
134
+
135
+ const selectList = async (params) => {
136
+ if (!gridRef.current) return;
137
+ gridRef.current.classList.add("loading");
138
+ api.post(\`/api/tmpl-a/doc-manager/selectList\`, params).then((res) => {
139
+ gridRef.current.data.source = res.list;
140
+ });
141
+ };
142
+
143
+ const handleNaturalLanguageSearch = async () => {
144
+ const searchTextElement = ninegrid.querySelector("#searchText", tabRef.current);
145
+ const searchText = searchTextElement ? searchTextElement.value : "";
146
+
147
+ if (!gridRef.current) return;
148
+ gridRef.current.classList.add("loading");
149
+
150
+ let params = {};
151
+ if (searchText) {
152
+ params = {
153
+ _whereClause: await ai.generateWhereCause(
154
+ "tmpla/DocManagerMapper.xml",
155
+ "selectList",
156
+ searchText,
157
+ import.meta.env.VITE_GEMINI_API_KEY
158
+ ),
159
+ };
160
+ }
161
+ selectList(params);
162
+ };
163
+
164
+ const handleClassicSearch = () => {
165
+ const form2Element = ninegrid.querySelector(".form2", tabRef.current);
166
+ const params = form2Element ? form2Element.getData() : {};
167
+ selectList(params);
168
+ };
169
+
170
+ useEffect(() => {
171
+ selectList({});
172
+
173
+ const searchTextElement = ninegrid.querySelector("#searchText", tabRef.current);
174
+ const searchButton = ninegrid.querySelector(".search", tabRef.current);
175
+
176
+ const handleKeyDown = (e) => {
177
+ if (e.key === "Enter" && !e.isComposing) {
178
+ handleNaturalLanguageSearch();
179
+ }
180
+ };
181
+
182
+ const handleClick = () => {
183
+ handleClassicSearch();
184
+ };
185
+
186
+ if (searchTextElement) {
187
+ searchTextElement.addEventListener("keydown", handleKeyDown);
188
+ }
189
+ if (searchButton) {
190
+ searchButton.addEventListener("click", handleClick);
191
+ }
192
+
193
+ return () => {
194
+ if (searchTextElement) {
195
+ searchTextElement.removeEventListener("keydown", handleKeyDown);
196
+ }
197
+ if (searchButton) {
198
+ searchButton.removeEventListener("click", handleClick);
199
+ }
200
+ };
201
+ }, []);
202
+
203
+ return (
204
+ <div className="wrapper">
205
+ <nx-collapse target="nx-tab" className="search-collapse"></nx-collapse>
206
+ <div className="list-wrapper">
207
+ <nx-tab theme="theme-3" ref={tabRef}>
208
+ <nx-tab-page caption="자연어 검색">
209
+ <nx-form className="form1">
210
+ <input
211
+ type="text"
212
+ id="searchText"
213
+ name="searchText"
214
+ placeholder="자연어 검색어를 입력하세요 (ex: 작성자가 홍길동인 데이타를 찾아줘)"
215
+ />
216
+ </nx-form>
217
+ </nx-tab-page>
218
+ <nx-tab-page caption="클래식 검색">
219
+ <nx-form className="form2">
220
+ <label>문서명: <input type="text" name="docNm" /></label>
221
+ <label>매출액:
222
+ <input type="number" name="minAmt" placeholder="최소" /> ~
223
+ <input type="number" name="maxAmt" placeholder="최대" />
224
+ </label>
225
+ </nx-form>
226
+ <button className="search">검색</button>
227
+ </nx-tab-page>
228
+ </nx-tab>
229
+
230
+ <div className="grid-wrapper">
231
+ <nine-grid
232
+ ref={gridRef}
233
+ caption="문서관리"
234
+ select-type="row"
235
+ show-title-bar="true"
236
+ show-menu-icon="true"
237
+ show-status-bar="true"
238
+ enable-fixed-col="true"
239
+ row-resizable="false"
240
+ col-movable="true"
241
+ >
242
+ <table>
243
+ <colgroup>
244
+ <col width="50" fixed="left" background-color="gray" />
245
+ <col width="100" />
246
+ <col width="100" />
247
+ <col width="200" />
248
+ <col width="120" />
249
+ <col width="100" />
250
+ <col width="150" />
251
+ <col width="150" />
252
+ </colgroup>
253
+ <thead>
254
+ <tr>
255
+ <th>No.</th>
256
+ <th>최종수정자</th>
257
+ <th>문서ID</th>
258
+ <th>문서명</th>
259
+ <th>매출액</th>
260
+ <th>최초등록자</th>
261
+ <th>최초등록일</th>
262
+ <th>최종수정일</th>
263
+ </tr>
264
+ </thead>
265
+ <tbody>
266
+ <tr>
267
+ <th><ng-row-indicator /></th>
268
+ <td data-bind="updateUser" text-align="center"></td>
269
+ <td data-bind="docId" text-align="center"></td>
270
+ <td data-bind="docNm" text-align="left"></td>
271
+ <td
272
+ data-bind="amt"
273
+ data-expr="data.amt.toLocaleString()"
274
+ text-align="right"
275
+ show-icon="true"
276
+ icon-type="sphere"
277
+ icon-color="data.amt >= 2000 ? 'red' : 'gray'"
278
+ ></td>
279
+ <td data-bind="insertUser" text-align="center"></td>
280
+ <td data-bind="insertDt" text-align="center"></td>
281
+ <td data-bind="updateDt" text-align="center"></td>
282
+ </tr>
283
+ </tbody>
284
+ </table>
285
+ </nine-grid>
286
+ </div>
287
+ </div>
288
+ </div>
289
+ );
290
+ };
291
+
292
+ export default DocManager;
293
+ `;
294
+
295
+ const src2 = `
296
+ import React, { useRef, useEffect } from 'react';
297
+ import { api, ai } from "ide-assi";
298
+ import ninegrid from "ninegrid2";
299
+
300
+ const DocManager = () => {
301
+ const tabRef = useRef(null);
302
+ const gridRef = useRef(null);
303
+
304
+ const toCamelCase = (s) => {
305
+ return s.toLowerCase().replace(/_([a-z])/g, (g) => g[1].toUpperCase());
306
+ };
307
+
308
+ const tableDefinitions = JSON.parse(\`{"list":[{"columns":[{"COLUMN_NAME":"doc_id","COLUMN_ID":1,"COLUMN_COMMENT":"문서ID"},{"COLUMN_NAME":"doc_nm","COLUMN_ID":2,"COLUMN_COMMENT":"문서명"},{"COLUMN_NAME":"amt","COLUMN_ID":3,"COLUMN_COMMENT":"매출액"},{"COLUMN_NAME":"insert_user","COLUMN_ID":4,"COLUMN_COMMENT":"최초등록자"},{"COLUMN_NAME":"insert_dt","COLUMN_ID":5,"COLUMN_COMMENT":"최초등록일"},{"COLUMN_NAME":"update_user","COLUMN_ID":6,"COLUMN_COMMENT":"최종수정자"},{"COLUMN_NAME":"update_dt","COLUMN_ID":7,"COLUMN_COMMENT":"최종수정일"}],"table":"t_doc"},{"columns":[{"COLUMN_NAME":"file_id","COLUMN_ID":1,"COLUMN_COMMENT":""},{"COLUMN_NAME":"doc_id","COLUMN_ID":2,"COLUMN_COMMENT":""},{"COLUMN_NAME":"download_cnt","COLUMN_ID":3,"COLUMN_COMMENT":""},{"COLUMN_NAME":"file_nm","COLUMN_ID":4,"COLUMN_COMMENT":""},{"COLUMN_NAME":"file_size","COLUMN_ID":5,"COLUMN_COMMENT":""},{"COLUMN_NAME":"file_contents","COLUMN_ID":6,"COLUMN_COMMENT":""},{"COLUMN_NAME":"insert_user","COLUMN_ID":7,"COLUMN_COMMENT":""},{"COLUMN_NAME":"insert_dt","COLUMN_ID":8,"COLUMN_COMMENT":""}],"table":"t_doc_file"},{"columns":[{"COLUMN_NAME":"file_id","COLUMN_ID":1,"COLUMN_COMMENT":""},{"COLUMN_NAME":"page","COLUMN_ID":2,"COLUMN_COMMENT":""},{"COLUMN_NAME":"text","COLUMN_ID":3,"COLUMN_COMMENT":""},{"COLUMN_NAME":"image","COLUMN_ID":4,"COLUMN_COMMENT":""},{"COLUMN_NAME":"vector_text","COLUMN_ID":5,"COLUMN_COMMENT":""},{"COLUMN_NAME":"vector_image","COLUMN_ID":6,"COLUMN_COMMENT":""}],"table":"t_doc_file_page"}]}\`);
309
+ const mainTableColumns = tableDefinitions.list[0].columns;
310
+
311
+ const selectList = async (formData = {}) => {
312
+ if (!gridRef.current) return;
313
+
314
+ gridRef.current.classList.add("loading");
315
+ /**
316
+ const form1Data = ninegrid.querySelector(".form1", tabRef.current).getData();
317
+ const form2Data = ninegrid.querySelector(".form2", tabRef.current).getData();
318
+ const formData = { ...form1Data, ...form2Data };
319
+
320
+ const formData1 = {
321
+ "_whereClause": await getWhere(),
322
+ }
323
+ console.log(formData1);
324
+ */
325
+
326
+ console.log(formData);
327
+
328
+ api.post(\`/api/tmpl-a/doc-manager/selectList\`, formData).then((res) => {
329
+ gridRef.current.data.source = res.list;
330
+ });
331
+ };
332
+
333
+ const getWhere = async () => {
334
+ return await ai.generateWhereCause("tmpla/DocManagerMapper.xml", "selectList", ninegrid.querySelector("#searchText", tabRef.current).value, import.meta.env.VITE_GEMINI_API_KEY);
335
+ };
336
+
337
+ useEffect(() => {
338
+ selectList();
339
+
340
+ const searchTextInput = ninegrid.querySelector("#searchText", tabRef.current);
341
+ const searchButton = ninegrid.querySelector(".search", tabRef.current);
342
+
343
+ const handleSearchTextKeydown = (e) => {
344
+ if (e.key === 'Enter' && !e.isComposing) {
345
+
346
+ //getWhere();
347
+ getWhere().then(res => {
348
+ selectList({"_whereClause":res});
349
+ });
350
+ }
351
+ };
352
+
353
+ const handleSearchButtonClick = () => {
354
+ selectList(ninegrid.querySelector(".form2", tabRef.current).getData());
355
+ };
356
+
357
+ if (searchTextInput) {
358
+ searchTextInput.addEventListener('keydown', handleSearchTextKeydown);
359
+ }
360
+ if (searchButton) {
361
+ searchButton.addEventListener('click', handleSearchButtonClick);
362
+ }
363
+
364
+ return () => {
365
+ if (searchTextInput) {
366
+ searchTextInput.removeEventListener('keydown', handleSearchTextKeydown);
367
+ }
368
+ if (searchButton) {
369
+ searchButton.removeEventListener('click', handleSearchButtonClick);
370
+ }
371
+ };
372
+ }, []);
373
+
374
+ return (
375
+ <div className="wrapper">
376
+ <nx-collapse target="nx-tab" className="search-collapse"></nx-collapse>
377
+ <div className="list-wrapper">
378
+ <nx-tab theme="theme-3" ref={tabRef}>
379
+ <nx-tab-page caption="자연어 검색">
380
+ <nx-form className="form1">
381
+ <input type="text" id="searchText" name="searchText"
382
+ placeholder="자연어 검색어를 입력하세요 (ex: 작성자가 홍길동인 데이타를 찾아줘)"/>
383
+ </nx-form>
384
+ </nx-tab-page>
385
+ <nx-tab-page caption="클래식 검색">
386
+ <nx-form className="form2">
387
+ <label>문서ID: <input type="text" name="docId"/></label>
388
+ <label>문서명: <input type="text" name="docNm"/></label>
389
+ <label>매출액: <input type="number" name="amt"/></label>
390
+ <label>최초등록자: <input type="text" name="insertUser"/></label>
391
+ <label>최초등록일: <input type="text" name="insertDt"/></label>
392
+ <label>최종수정자: <input type="text" name="updateUser"/></label>
393
+ <label>최종수정일: <input type="text" name="updateDt"/></label>
394
+ </nx-form>
395
+ <button className="search">검색</button>
396
+ </nx-tab-page>
397
+ </nx-tab>
398
+
399
+ <div className="grid-wrapper">
400
+ <nine-grid
401
+ ref={gridRef}
402
+ caption="문서관리"
403
+ select-type="row"
404
+ show-title-bar="true"
405
+ show-menu-icon="true"
406
+ show-status-bar="true"
407
+ enable-fixed-col="true"
408
+ row-resizable="false"
409
+ col-movable="true"
410
+ >
411
+ <table>
412
+ <colgroup>
413
+ <col width="50" fixed="left" background-color="gray"/>
414
+ {mainTableColumns.map((col) => (
415
+ <col key={col.COLUMN_ID} width="150"/>
416
+ ))}
417
+ </colgroup>
418
+ <thead>
419
+ <tr>
420
+ <th>No.</th>
421
+ {mainTableColumns.map((col) => (
422
+ <th key={col.COLUMN_ID}>{col.COLUMN_COMMENT || col.COLUMN_NAME}</th>
423
+ ))}
424
+ </tr>
425
+ </thead>
426
+ <tbody>
427
+ <tr>
428
+ <th><ng-row-indicator/></th>
429
+ {mainTableColumns.map((col) => (
430
+ <td key={col.COLUMN_ID} data-bind={toCamelCase(col.COLUMN_NAME)}></td>
431
+ ))}
432
+ </tr>
433
+ </tbody>
434
+ </table>
435
+ </nine-grid>
436
+ </div>
437
+ </div>
438
+ </div>
439
+ );
440
+ };
441
+
442
+ export default DocManager;
443
+ `;
444
+
445
+ this.shadowRoot.querySelector("ide-diff-popup").popup(src1, src2);
127
446
 
128
447
  return;
129
448
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ide-assi",
3
3
  "type": "module",
4
- "version": "0.328.0",
4
+ "version": "0.329.0",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "exports": {
@@ -120,10 +120,329 @@ export class IdeAssi extends HTMLElement
120
120
 
121
121
  //this.shadowRoot.querySelector('ide-diff-popup').remove();
122
122
 
123
- const a = this.shadowRoot.appendChild(document.createElement('ide-diff-popup'));
124
- console.log(a);
123
+ this.shadowRoot.appendChild(document.createElement('ide-diff-popup'));
124
+
125
125
  //setTimeout(() => {
126
- this.shadowRoot.querySelector("ide-diff-popup").popup("aaa", "bbb");
126
+ const src1 = `
127
+ import React, { useRef, useEffect } from "react";
128
+ import { api, ai } from "ide-assi";
129
+ import ninegrid from "ninegrid2";
130
+
131
+ const DocManager = () => {
132
+ const tabRef = useRef(null);
133
+ const gridRef = useRef(null);
134
+
135
+ const selectList = async (params) => {
136
+ if (!gridRef.current) return;
137
+ gridRef.current.classList.add("loading");
138
+ api.post(\`/api/tmpl-a/doc-manager/selectList\`, params).then((res) => {
139
+ gridRef.current.data.source = res.list;
140
+ });
141
+ };
142
+
143
+ const handleNaturalLanguageSearch = async () => {
144
+ const searchTextElement = ninegrid.querySelector("#searchText", tabRef.current);
145
+ const searchText = searchTextElement ? searchTextElement.value : "";
146
+
147
+ if (!gridRef.current) return;
148
+ gridRef.current.classList.add("loading");
149
+
150
+ let params = {};
151
+ if (searchText) {
152
+ params = {
153
+ _whereClause: await ai.generateWhereCause(
154
+ "tmpla/DocManagerMapper.xml",
155
+ "selectList",
156
+ searchText,
157
+ import.meta.env.VITE_GEMINI_API_KEY
158
+ ),
159
+ };
160
+ }
161
+ selectList(params);
162
+ };
163
+
164
+ const handleClassicSearch = () => {
165
+ const form2Element = ninegrid.querySelector(".form2", tabRef.current);
166
+ const params = form2Element ? form2Element.getData() : {};
167
+ selectList(params);
168
+ };
169
+
170
+ useEffect(() => {
171
+ selectList({});
172
+
173
+ const searchTextElement = ninegrid.querySelector("#searchText", tabRef.current);
174
+ const searchButton = ninegrid.querySelector(".search", tabRef.current);
175
+
176
+ const handleKeyDown = (e) => {
177
+ if (e.key === "Enter" && !e.isComposing) {
178
+ handleNaturalLanguageSearch();
179
+ }
180
+ };
181
+
182
+ const handleClick = () => {
183
+ handleClassicSearch();
184
+ };
185
+
186
+ if (searchTextElement) {
187
+ searchTextElement.addEventListener("keydown", handleKeyDown);
188
+ }
189
+ if (searchButton) {
190
+ searchButton.addEventListener("click", handleClick);
191
+ }
192
+
193
+ return () => {
194
+ if (searchTextElement) {
195
+ searchTextElement.removeEventListener("keydown", handleKeyDown);
196
+ }
197
+ if (searchButton) {
198
+ searchButton.removeEventListener("click", handleClick);
199
+ }
200
+ };
201
+ }, []);
202
+
203
+ return (
204
+ <div className="wrapper">
205
+ <nx-collapse target="nx-tab" className="search-collapse"></nx-collapse>
206
+ <div className="list-wrapper">
207
+ <nx-tab theme="theme-3" ref={tabRef}>
208
+ <nx-tab-page caption="자연어 검색">
209
+ <nx-form className="form1">
210
+ <input
211
+ type="text"
212
+ id="searchText"
213
+ name="searchText"
214
+ placeholder="자연어 검색어를 입력하세요 (ex: 작성자가 홍길동인 데이타를 찾아줘)"
215
+ />
216
+ </nx-form>
217
+ </nx-tab-page>
218
+ <nx-tab-page caption="클래식 검색">
219
+ <nx-form className="form2">
220
+ <label>문서명: <input type="text" name="docNm" /></label>
221
+ <label>매출액:
222
+ <input type="number" name="minAmt" placeholder="최소" /> ~
223
+ <input type="number" name="maxAmt" placeholder="최대" />
224
+ </label>
225
+ </nx-form>
226
+ <button className="search">검색</button>
227
+ </nx-tab-page>
228
+ </nx-tab>
229
+
230
+ <div className="grid-wrapper">
231
+ <nine-grid
232
+ ref={gridRef}
233
+ caption="문서관리"
234
+ select-type="row"
235
+ show-title-bar="true"
236
+ show-menu-icon="true"
237
+ show-status-bar="true"
238
+ enable-fixed-col="true"
239
+ row-resizable="false"
240
+ col-movable="true"
241
+ >
242
+ <table>
243
+ <colgroup>
244
+ <col width="50" fixed="left" background-color="gray" />
245
+ <col width="100" />
246
+ <col width="100" />
247
+ <col width="200" />
248
+ <col width="120" />
249
+ <col width="100" />
250
+ <col width="150" />
251
+ <col width="150" />
252
+ </colgroup>
253
+ <thead>
254
+ <tr>
255
+ <th>No.</th>
256
+ <th>최종수정자</th>
257
+ <th>문서ID</th>
258
+ <th>문서명</th>
259
+ <th>매출액</th>
260
+ <th>최초등록자</th>
261
+ <th>최초등록일</th>
262
+ <th>최종수정일</th>
263
+ </tr>
264
+ </thead>
265
+ <tbody>
266
+ <tr>
267
+ <th><ng-row-indicator /></th>
268
+ <td data-bind="updateUser" text-align="center"></td>
269
+ <td data-bind="docId" text-align="center"></td>
270
+ <td data-bind="docNm" text-align="left"></td>
271
+ <td
272
+ data-bind="amt"
273
+ data-expr="data.amt.toLocaleString()"
274
+ text-align="right"
275
+ show-icon="true"
276
+ icon-type="sphere"
277
+ icon-color="data.amt >= 2000 ? 'red' : 'gray'"
278
+ ></td>
279
+ <td data-bind="insertUser" text-align="center"></td>
280
+ <td data-bind="insertDt" text-align="center"></td>
281
+ <td data-bind="updateDt" text-align="center"></td>
282
+ </tr>
283
+ </tbody>
284
+ </table>
285
+ </nine-grid>
286
+ </div>
287
+ </div>
288
+ </div>
289
+ );
290
+ };
291
+
292
+ export default DocManager;
293
+ `;
294
+
295
+ const src2 = `
296
+ import React, { useRef, useEffect } from 'react';
297
+ import { api, ai } from "ide-assi";
298
+ import ninegrid from "ninegrid2";
299
+
300
+ const DocManager = () => {
301
+ const tabRef = useRef(null);
302
+ const gridRef = useRef(null);
303
+
304
+ const toCamelCase = (s) => {
305
+ return s.toLowerCase().replace(/_([a-z])/g, (g) => g[1].toUpperCase());
306
+ };
307
+
308
+ const tableDefinitions = JSON.parse(\`{"list":[{"columns":[{"COLUMN_NAME":"doc_id","COLUMN_ID":1,"COLUMN_COMMENT":"문서ID"},{"COLUMN_NAME":"doc_nm","COLUMN_ID":2,"COLUMN_COMMENT":"문서명"},{"COLUMN_NAME":"amt","COLUMN_ID":3,"COLUMN_COMMENT":"매출액"},{"COLUMN_NAME":"insert_user","COLUMN_ID":4,"COLUMN_COMMENT":"최초등록자"},{"COLUMN_NAME":"insert_dt","COLUMN_ID":5,"COLUMN_COMMENT":"최초등록일"},{"COLUMN_NAME":"update_user","COLUMN_ID":6,"COLUMN_COMMENT":"최종수정자"},{"COLUMN_NAME":"update_dt","COLUMN_ID":7,"COLUMN_COMMENT":"최종수정일"}],"table":"t_doc"},{"columns":[{"COLUMN_NAME":"file_id","COLUMN_ID":1,"COLUMN_COMMENT":""},{"COLUMN_NAME":"doc_id","COLUMN_ID":2,"COLUMN_COMMENT":""},{"COLUMN_NAME":"download_cnt","COLUMN_ID":3,"COLUMN_COMMENT":""},{"COLUMN_NAME":"file_nm","COLUMN_ID":4,"COLUMN_COMMENT":""},{"COLUMN_NAME":"file_size","COLUMN_ID":5,"COLUMN_COMMENT":""},{"COLUMN_NAME":"file_contents","COLUMN_ID":6,"COLUMN_COMMENT":""},{"COLUMN_NAME":"insert_user","COLUMN_ID":7,"COLUMN_COMMENT":""},{"COLUMN_NAME":"insert_dt","COLUMN_ID":8,"COLUMN_COMMENT":""}],"table":"t_doc_file"},{"columns":[{"COLUMN_NAME":"file_id","COLUMN_ID":1,"COLUMN_COMMENT":""},{"COLUMN_NAME":"page","COLUMN_ID":2,"COLUMN_COMMENT":""},{"COLUMN_NAME":"text","COLUMN_ID":3,"COLUMN_COMMENT":""},{"COLUMN_NAME":"image","COLUMN_ID":4,"COLUMN_COMMENT":""},{"COLUMN_NAME":"vector_text","COLUMN_ID":5,"COLUMN_COMMENT":""},{"COLUMN_NAME":"vector_image","COLUMN_ID":6,"COLUMN_COMMENT":""}],"table":"t_doc_file_page"}]}\`);
309
+ const mainTableColumns = tableDefinitions.list[0].columns;
310
+
311
+ const selectList = async (formData = {}) => {
312
+ if (!gridRef.current) return;
313
+
314
+ gridRef.current.classList.add("loading");
315
+ /**
316
+ const form1Data = ninegrid.querySelector(".form1", tabRef.current).getData();
317
+ const form2Data = ninegrid.querySelector(".form2", tabRef.current).getData();
318
+ const formData = { ...form1Data, ...form2Data };
319
+
320
+ const formData1 = {
321
+ "_whereClause": await getWhere(),
322
+ }
323
+ console.log(formData1);
324
+ */
325
+
326
+ console.log(formData);
327
+
328
+ api.post(\`/api/tmpl-a/doc-manager/selectList\`, formData).then((res) => {
329
+ gridRef.current.data.source = res.list;
330
+ });
331
+ };
332
+
333
+ const getWhere = async () => {
334
+ return await ai.generateWhereCause("tmpla/DocManagerMapper.xml", "selectList", ninegrid.querySelector("#searchText", tabRef.current).value, import.meta.env.VITE_GEMINI_API_KEY);
335
+ };
336
+
337
+ useEffect(() => {
338
+ selectList();
339
+
340
+ const searchTextInput = ninegrid.querySelector("#searchText", tabRef.current);
341
+ const searchButton = ninegrid.querySelector(".search", tabRef.current);
342
+
343
+ const handleSearchTextKeydown = (e) => {
344
+ if (e.key === 'Enter' && !e.isComposing) {
345
+
346
+ //getWhere();
347
+ getWhere().then(res => {
348
+ selectList({"_whereClause":res});
349
+ });
350
+ }
351
+ };
352
+
353
+ const handleSearchButtonClick = () => {
354
+ selectList(ninegrid.querySelector(".form2", tabRef.current).getData());
355
+ };
356
+
357
+ if (searchTextInput) {
358
+ searchTextInput.addEventListener('keydown', handleSearchTextKeydown);
359
+ }
360
+ if (searchButton) {
361
+ searchButton.addEventListener('click', handleSearchButtonClick);
362
+ }
363
+
364
+ return () => {
365
+ if (searchTextInput) {
366
+ searchTextInput.removeEventListener('keydown', handleSearchTextKeydown);
367
+ }
368
+ if (searchButton) {
369
+ searchButton.removeEventListener('click', handleSearchButtonClick);
370
+ }
371
+ };
372
+ }, []);
373
+
374
+ return (
375
+ <div className="wrapper">
376
+ <nx-collapse target="nx-tab" className="search-collapse"></nx-collapse>
377
+ <div className="list-wrapper">
378
+ <nx-tab theme="theme-3" ref={tabRef}>
379
+ <nx-tab-page caption="자연어 검색">
380
+ <nx-form className="form1">
381
+ <input type="text" id="searchText" name="searchText"
382
+ placeholder="자연어 검색어를 입력하세요 (ex: 작성자가 홍길동인 데이타를 찾아줘)"/>
383
+ </nx-form>
384
+ </nx-tab-page>
385
+ <nx-tab-page caption="클래식 검색">
386
+ <nx-form className="form2">
387
+ <label>문서ID: <input type="text" name="docId"/></label>
388
+ <label>문서명: <input type="text" name="docNm"/></label>
389
+ <label>매출액: <input type="number" name="amt"/></label>
390
+ <label>최초등록자: <input type="text" name="insertUser"/></label>
391
+ <label>최초등록일: <input type="text" name="insertDt"/></label>
392
+ <label>최종수정자: <input type="text" name="updateUser"/></label>
393
+ <label>최종수정일: <input type="text" name="updateDt"/></label>
394
+ </nx-form>
395
+ <button className="search">검색</button>
396
+ </nx-tab-page>
397
+ </nx-tab>
398
+
399
+ <div className="grid-wrapper">
400
+ <nine-grid
401
+ ref={gridRef}
402
+ caption="문서관리"
403
+ select-type="row"
404
+ show-title-bar="true"
405
+ show-menu-icon="true"
406
+ show-status-bar="true"
407
+ enable-fixed-col="true"
408
+ row-resizable="false"
409
+ col-movable="true"
410
+ >
411
+ <table>
412
+ <colgroup>
413
+ <col width="50" fixed="left" background-color="gray"/>
414
+ {mainTableColumns.map((col) => (
415
+ <col key={col.COLUMN_ID} width="150"/>
416
+ ))}
417
+ </colgroup>
418
+ <thead>
419
+ <tr>
420
+ <th>No.</th>
421
+ {mainTableColumns.map((col) => (
422
+ <th key={col.COLUMN_ID}>{col.COLUMN_COMMENT || col.COLUMN_NAME}</th>
423
+ ))}
424
+ </tr>
425
+ </thead>
426
+ <tbody>
427
+ <tr>
428
+ <th><ng-row-indicator/></th>
429
+ {mainTableColumns.map((col) => (
430
+ <td key={col.COLUMN_ID} data-bind={toCamelCase(col.COLUMN_NAME)}></td>
431
+ ))}
432
+ </tr>
433
+ </tbody>
434
+ </table>
435
+ </nine-grid>
436
+ </div>
437
+ </div>
438
+ </div>
439
+ );
440
+ };
441
+
442
+ export default DocManager;
443
+ `;
444
+
445
+ this.shadowRoot.querySelector("ide-diff-popup").popup(src1, src2);
127
446
 
128
447
  return;
129
448