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.
@@ -351,12 +351,13 @@ export class IdeDiff extends HTMLElement {
351
351
  // 먼저 데코레이션 효과를 계산하여 가져옵니다.
352
352
  const { asisEffect, tobeEffect } = this.#applyDiffDecorations(src1, src2);
353
353
 
354
+ console.log(asisEffect, tobeEffect);
354
355
  // asis 에디터의 텍스트 변경 및 데코레이션 효과를 단일 트랜잭션으로 디스패치합니다.
355
356
  this.#asisEditorView.dispatch({
356
357
  changes: { from: 0, to: this.#asisEditorView.state.doc.length, insert: src1 },
357
358
  effects: [
358
359
  this.#languageCompartment.reconfigure(langExtension),
359
- //asisEffect // 계산된 데코레이션 효과를 포함
360
+ asisEffect // 계산된 데코레이션 효과를 포함
360
361
  ]
361
362
  });
362
363
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ide-assi",
3
3
  "type": "module",
4
- "version": "0.354.0",
4
+ "version": "0.356.0",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "exports": {
@@ -124,7 +124,7 @@ export class IdeAssi extends HTMLElement
124
124
 
125
125
  //setTimeout(() => {
126
126
  const src1 = `
127
- import React, { useRef, useEffect } from "react";
127
+ import React, { useRef, useEffect } from "react";
128
128
  import { api, ai } from "ide-assi";
129
129
  import ninegrid from "ninegrid2";
130
130
 
@@ -162,6 +162,9 @@ const DocManager = () => {
162
162
  };
163
163
 
164
164
  const handleClassicSearch = () => {
165
+ if (!gridRef.current) return;
166
+ gridRef.current.classList.add("loading");
167
+
165
168
  const form2Element = ninegrid.querySelector(".form2", tabRef.current);
166
169
  const params = form2Element ? form2Element.getData() : {};
167
170
  selectList(params);
@@ -293,7 +296,7 @@ export default DocManager;
293
296
  `;
294
297
 
295
298
  const src2 = `
296
- import React, { useRef, useEffect } from 'react';
299
+ import React, { useRef, useEffect } from "react";
297
300
  import { api, ai } from "ide-assi";
298
301
  import ninegrid from "ninegrid2";
299
302
 
@@ -301,72 +304,73 @@ const DocManager = () => {
301
304
  const tabRef = useRef(null);
302
305
  const gridRef = useRef(null);
303
306
 
304
- const toCamelCase = (s) => {
305
- return s.toLowerCase().replace(/_([a-z])/g, (g) => g[1].toUpperCase());
307
+ const selectList = async (params) => {
308
+ if (!gridRef.current) return;
309
+ gridRef.current.classList.add("loading");
310
+ api.post(\`/api/tmpl-a/doc-manager/selectList\`, params).then((res) => {
311
+ gridRef.current.data.source = res.list;
312
+ });
306
313
  };
307
314
 
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;
315
+ const handleNaturalLanguageSearch = async () => {
316
+ const searchTextElement = ninegrid.querySelector("#searchText", tabRef.current);
317
+ const searchText = searchTextElement ? searchTextElement.value : "";
310
318
 
311
- const selectList = async (formData = {}) => {
312
319
  if (!gridRef.current) return;
313
-
314
320
  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
321
 
320
- const formData1 = {
321
- "_whereClause": await getWhere(),
322
+ let params = {};
323
+ if (searchText) {
324
+ params = {
325
+ _whereClause: await ai.generateWhereCause(
326
+ "tmpla/DocManagerMapper.xml",
327
+ "selectList",
328
+ searchText,
329
+ import.meta.env.VITE_GEMINI_API_KEY
330
+ ),
331
+ };
322
332
  }
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
- });
333
+ selectList(params);
331
334
  };
332
335
 
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);
336
+ const handleClassicSearch = () => {
337
+ if (!gridRef.current) return;
338
+ gridRef.current.classList.add("loading");
339
+
340
+ const form2Element = ninegrid.querySelector(".form2", tabRef.current);
341
+ const params = form2Element ? form2Element.getData() : {};
342
+ selectList(params);
335
343
  };
336
344
 
337
345
  useEffect(() => {
338
- selectList();
346
+ selectList({});
339
347
 
340
- const searchTextInput = ninegrid.querySelector("#searchText", tabRef.current);
348
+ const searchTextElement = ninegrid.querySelector("#searchText", tabRef.current);
341
349
  const searchButton = ninegrid.querySelector(".search", tabRef.current);
342
350
 
343
- const handleSearchTextKeydown = (e) => {
344
- if (e.key === 'Enter' && !e.isComposing) {
345
-
346
- //getWhere();
347
- getWhere().then(res => {
348
- selectList({"_whereClause":res});
349
- });
351
+ const handleKeyDown = (e) => {
352
+ if (e.key === "Enter" && !e.isComposing) {
353
+ handleNaturalLanguageSearch();
350
354
  }
351
355
  };
352
356
 
353
- const handleSearchButtonClick = () => {
354
- selectList(ninegrid.querySelector(".form2", tabRef.current).getData());
357
+ const handleClick = () => {
358
+ handleClassicSearch();
355
359
  };
356
360
 
357
- if (searchTextInput) {
358
- searchTextInput.addEventListener('keydown', handleSearchTextKeydown);
361
+ if (searchTextElement) {
362
+ searchTextElement.addEventListener("keydown", handleKeyDown);
359
363
  }
360
364
  if (searchButton) {
361
- searchButton.addEventListener('click', handleSearchButtonClick);
365
+ searchButton.addEventListener("click", handleClick);
362
366
  }
363
367
 
364
368
  return () => {
365
- if (searchTextInput) {
366
- searchTextInput.removeEventListener('keydown', handleSearchTextKeydown);
369
+ if (searchTextElement) {
370
+ searchTextElement.removeEventListener("keydown", handleKeyDown);
367
371
  }
368
372
  if (searchButton) {
369
- searchButton.removeEventListener('click', handleSearchButtonClick);
373
+ searchButton.removeEventListener("click", handleClick);
370
374
  }
371
375
  };
372
376
  }, []);
@@ -378,19 +382,21 @@ const DocManager = () => {
378
382
  <nx-tab theme="theme-3" ref={tabRef}>
379
383
  <nx-tab-page caption="자연어 검색">
380
384
  <nx-form className="form1">
381
- <input type="text" id="searchText" name="searchText"
382
- placeholder="자연어 검색어를 입력하세요 (ex: 작성자가 홍길동인 데이타를 찾아줘)"/>
385
+ <input
386
+ type="text"
387
+ id="searchText"
388
+ name="searchText"
389
+ placeholder="자연어 검색어를 입력하세요 (ex: 작성자가 홍길동인 데이타를 찾아줘)"
390
+ />
383
391
  </nx-form>
384
392
  </nx-tab-page>
385
393
  <nx-tab-page caption="클래식 검색">
386
394
  <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>
395
+ <label>문서명: <input type="text" name="docNm" /></label>
396
+ <label>매출액:
397
+ <input type="number" name="minAmt" placeholder="최소" /> ~
398
+ <input type="number" name="maxAmt" placeholder="최대" />
399
+ </label>
394
400
  </nx-form>
395
401
  <button className="search">검색</button>
396
402
  </nx-tab-page>
@@ -398,37 +404,56 @@ const DocManager = () => {
398
404
 
399
405
  <div className="grid-wrapper">
400
406
  <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
- >
407
+ ref={gridRef}
408
+ caption="매출 문서 관리"
409
+ select-type="row"
410
+ show-title-bar="true"
411
+ show-menu-icon="true"
412
+ show-status-bar="true"
413
+ enable-fixed-col="true"
414
+ row-resizable="false"
415
+ col-movable="true"
416
+ >
411
417
  <table>
412
418
  <colgroup>
413
- <col width="50" fixed="left" background-color="gray"/>
414
- {mainTableColumns.map((col) => (
415
- <col key={col.COLUMN_ID} width="150"/>
416
- ))}
419
+ <col width="50" fixed="left" background-color="gray" />
420
+ <col width="100" />
421
+ <col width="120" />
422
+ <col width="100" />
423
+ <col width="200" />
424
+ <col width="100" />
425
+ <col width="150" />
426
+ <col width="150" />
417
427
  </colgroup>
418
428
  <thead>
419
429
  <tr>
420
430
  <th>No.</th>
421
- {mainTableColumns.map((col) => (
422
- <th key={col.COLUMN_ID}>{col.COLUMN_COMMENT || col.COLUMN_NAME}</th>
423
- ))}
431
+ <th>문서ID</th>
432
+ <th>매출액</th>
433
+ <th>최종수정자</th>
434
+ <th>문서명</th>
435
+ <th>최초등록자</th>
436
+ <th>최초등록일</th>
437
+ <th>최종수정일</th>
424
438
  </tr>
425
439
  </thead>
426
440
  <tbody>
427
441
  <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
- ))}
442
+ <th><ng-row-indicator /></th>
443
+ <td data-bind="docId" text-align="center"></td>
444
+ <td
445
+ data-bind="amt"
446
+ data-expr="data.amt.toLocaleString()"
447
+ text-align="right"
448
+ show-icon="true"
449
+ icon-type="sphere"
450
+ icon-color="data.amt >= 2000 ? 'red' : 'gray'"
451
+ ></td>
452
+ <td data-bind="updateUser" text-align="center"></td>
453
+ <td data-bind="docNm" text-align="left"></td>
454
+ <td data-bind="insertUser" text-align="center"></td>
455
+ <td data-bind="insertDt" text-align="center"></td>
456
+ <td data-bind="updateDt" text-align="center"></td>
432
457
  </tr>
433
458
  </tbody>
434
459
  </table>
@@ -442,9 +467,9 @@ const DocManager = () => {
442
467
  export default DocManager;
443
468
  `;
444
469
 
445
- //this.shadowRoot.querySelector("ide-diff-popup").popup(src1, src2);
470
+ this.shadowRoot.querySelector("ide-diff-popup").popup(src1, src2);
446
471
 
447
- //return;
472
+ return;
448
473
 
449
474
  const apply = {
450
475
  mybatis: this.shadowRoot.querySelector("#mybatis").checked,
@@ -351,12 +351,13 @@ export class IdeDiff extends HTMLElement {
351
351
  // 먼저 데코레이션 효과를 계산하여 가져옵니다.
352
352
  const { asisEffect, tobeEffect } = this.#applyDiffDecorations(src1, src2);
353
353
 
354
+ console.log(asisEffect, tobeEffect);
354
355
  // asis 에디터의 텍스트 변경 및 데코레이션 효과를 단일 트랜잭션으로 디스패치합니다.
355
356
  this.#asisEditorView.dispatch({
356
357
  changes: { from: 0, to: this.#asisEditorView.state.doc.length, insert: src1 },
357
358
  effects: [
358
359
  this.#languageCompartment.reconfigure(langExtension),
359
- //asisEffect // 계산된 데코레이션 효과를 포함
360
+ asisEffect // 계산된 데코레이션 효과를 포함
360
361
  ]
361
362
  });
362
363