ninegrid2 6.432.0 → 6.433.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.
@@ -87,6 +87,66 @@ class aiMessage extends HTMLElement
87
87
  });
88
88
  }
89
89
 
90
+ initialize2 = (info, data) => {
91
+ this.#data = data;
92
+
93
+ setTimeout(() => {
94
+ this.#init2();
95
+ });
96
+ }
97
+
98
+ #init2 = () => {
99
+
100
+ const rowCount = Number(this.getAttribute("row-count"));
101
+ if (rowCount < 1) {
102
+ this.shadowRoot.querySelector(".grid").style.display = "none";
103
+ this.shadowRoot.querySelector(".chat-menu").style.display = "none";
104
+ return;
105
+ }
106
+
107
+ let colgroup = "";
108
+ let thead = "";
109
+ let tbody = "";
110
+ for (let o of info) {
111
+ colgroup += `<col background-color="#888"/>`;
112
+ thead += `<th>${o.desc}</th>`;
113
+ tbody += `<td data-bind="${o.name}"></td>`;
114
+ }
115
+
116
+ const html = `
117
+ <nine-grid class="ai" display-row-count="${rowCount > 5 ? 5 : rowCount}" show-title-bar="false" show-menu-icon="false" show-status-bar="false" select-type="row" auto-fit-col="true" show-title-bar="true" show-menu-icon="true" show-status-bar="true" enable-fixed-col="true" row-resizable="false" col-movable="true">
118
+ <table>
119
+ <caption>Sheet1</caption>
120
+ <colgroup>
121
+ <col background-color="#888"/>
122
+ ${colgroup}
123
+ </colgroup>
124
+ <thead>
125
+ <tr>
126
+ <th>No.</th>
127
+ ${thead}
128
+ </tr>
129
+ </thead>
130
+ <tbody>
131
+ <tr>
132
+ <th><ng-row-indicator/></th>
133
+ ${tbody}
134
+ </tr>
135
+ </tbody>
136
+ </table>
137
+ </nine-grid>
138
+ `;
139
+
140
+ this.shadowRoot.querySelector(".grid").innerHTML = html;
141
+
142
+ setTimeout(() => {
143
+ const grd = this.shadowRoot.querySelector("nine-grid");
144
+ grd.data.source = this.#data;
145
+
146
+ //this.scrollIntoView({ behavior: "smooth", block: "end" });
147
+ });
148
+ };
149
+
90
150
  #init = () => {
91
151
 
92
152
  const rowCount = Number(this.getAttribute("row-count"));
@@ -272,6 +332,47 @@ class aiChat extends HTMLElement
272
332
  el.scrollIntoView({ behavior: "smooth", block: "end" });
273
333
  }, 200);
274
334
  };
335
+
336
+ add2 = (sender, message, info, data) => {
337
+ const target = this.shadowRoot.querySelector(".chat-body");
338
+
339
+ //console.log(data);
340
+
341
+ let el;
342
+ switch (sender) {
343
+ case "me":
344
+ el = document.createElement("nx-ai-my-message");
345
+ el.setAttribute("message", message);
346
+ target.appendChild(el);
347
+ break;
348
+
349
+ case "ing":
350
+ el = document.createElement("nx-ai-ing-message");
351
+ //el.setAttribute("message", message);
352
+ target.appendChild(el);
353
+ break;
354
+
355
+ case "ai":
356
+ this.shadowRoot.querySelectorAll("nx-ai-ing-message").forEach(el => {
357
+ el.remove();
358
+ });
359
+
360
+ el = document.createElement("nx-ai-message");
361
+ el.setAttribute("message", message);
362
+ el.setAttribute("row-count", data ? data.length : 0);
363
+ //el.data = data;
364
+ el.initialize(data);
365
+ target.appendChild(el);
366
+ break;
367
+
368
+ default:
369
+ break;
370
+ }
371
+
372
+ setTimeout(() => {
373
+ el.scrollIntoView({ behavior: "smooth", block: "end" });
374
+ }, 200);
375
+ };
275
376
  }
276
377
 
277
378
  customElements.define("nx-ai-message", aiMessage);
@@ -27503,6 +27503,66 @@ class aiMessage extends HTMLElement
27503
27503
  });
27504
27504
  }
27505
27505
 
27506
+ initialize2 = (info, data) => {
27507
+ this.#data = data;
27508
+
27509
+ setTimeout(() => {
27510
+ this.#init2();
27511
+ });
27512
+ }
27513
+
27514
+ #init2 = () => {
27515
+
27516
+ const rowCount = Number(this.getAttribute("row-count"));
27517
+ if (rowCount < 1) {
27518
+ this.shadowRoot.querySelector(".grid").style.display = "none";
27519
+ this.shadowRoot.querySelector(".chat-menu").style.display = "none";
27520
+ return;
27521
+ }
27522
+
27523
+ let colgroup = "";
27524
+ let thead = "";
27525
+ let tbody = "";
27526
+ for (let o of info) {
27527
+ colgroup += `<col background-color="#888"/>`;
27528
+ thead += `<th>${o.desc}</th>`;
27529
+ tbody += `<td data-bind="${o.name}"></td>`;
27530
+ }
27531
+
27532
+ const html = `
27533
+ <nine-grid class="ai" display-row-count="${rowCount > 5 ? 5 : rowCount}" show-title-bar="false" show-menu-icon="false" show-status-bar="false" select-type="row" auto-fit-col="true" show-title-bar="true" show-menu-icon="true" show-status-bar="true" enable-fixed-col="true" row-resizable="false" col-movable="true">
27534
+ <table>
27535
+ <caption>Sheet1</caption>
27536
+ <colgroup>
27537
+ <col background-color="#888"/>
27538
+ ${colgroup}
27539
+ </colgroup>
27540
+ <thead>
27541
+ <tr>
27542
+ <th>No.</th>
27543
+ ${thead}
27544
+ </tr>
27545
+ </thead>
27546
+ <tbody>
27547
+ <tr>
27548
+ <th><ng-row-indicator/></th>
27549
+ ${tbody}
27550
+ </tr>
27551
+ </tbody>
27552
+ </table>
27553
+ </nine-grid>
27554
+ `;
27555
+
27556
+ this.shadowRoot.querySelector(".grid").innerHTML = html;
27557
+
27558
+ setTimeout(() => {
27559
+ const grd = this.shadowRoot.querySelector("nine-grid");
27560
+ grd.data.source = this.#data;
27561
+
27562
+ //this.scrollIntoView({ behavior: "smooth", block: "end" });
27563
+ });
27564
+ };
27565
+
27506
27566
  #init = () => {
27507
27567
 
27508
27568
  const rowCount = Number(this.getAttribute("row-count"));
@@ -27685,6 +27745,44 @@ class aiChat extends HTMLElement
27685
27745
  el.scrollIntoView({ behavior: "smooth", block: "end" });
27686
27746
  }, 200);
27687
27747
  };
27748
+
27749
+ add2 = (sender, message, info, data) => {
27750
+ const target = this.shadowRoot.querySelector(".chat-body");
27751
+
27752
+ //console.log(data);
27753
+
27754
+ let el;
27755
+ switch (sender) {
27756
+ case "me":
27757
+ el = document.createElement("nx-ai-my-message");
27758
+ el.setAttribute("message", message);
27759
+ target.appendChild(el);
27760
+ break;
27761
+
27762
+ case "ing":
27763
+ el = document.createElement("nx-ai-ing-message");
27764
+ //el.setAttribute("message", message);
27765
+ target.appendChild(el);
27766
+ break;
27767
+
27768
+ case "ai":
27769
+ this.shadowRoot.querySelectorAll("nx-ai-ing-message").forEach(el => {
27770
+ el.remove();
27771
+ });
27772
+
27773
+ el = document.createElement("nx-ai-message");
27774
+ el.setAttribute("message", message);
27775
+ el.setAttribute("row-count", data ? data.length : 0);
27776
+ //el.data = data;
27777
+ el.initialize(data);
27778
+ target.appendChild(el);
27779
+ break;
27780
+ }
27781
+
27782
+ setTimeout(() => {
27783
+ el.scrollIntoView({ behavior: "smooth", block: "end" });
27784
+ }, 200);
27785
+ };
27688
27786
  }
27689
27787
 
27690
27788
  customElements.define("nx-ai-message", aiMessage);
@@ -27501,6 +27501,66 @@ class aiMessage extends HTMLElement
27501
27501
  });
27502
27502
  }
27503
27503
 
27504
+ initialize2 = (info, data) => {
27505
+ this.#data = data;
27506
+
27507
+ setTimeout(() => {
27508
+ this.#init2();
27509
+ });
27510
+ }
27511
+
27512
+ #init2 = () => {
27513
+
27514
+ const rowCount = Number(this.getAttribute("row-count"));
27515
+ if (rowCount < 1) {
27516
+ this.shadowRoot.querySelector(".grid").style.display = "none";
27517
+ this.shadowRoot.querySelector(".chat-menu").style.display = "none";
27518
+ return;
27519
+ }
27520
+
27521
+ let colgroup = "";
27522
+ let thead = "";
27523
+ let tbody = "";
27524
+ for (let o of info) {
27525
+ colgroup += `<col background-color="#888"/>`;
27526
+ thead += `<th>${o.desc}</th>`;
27527
+ tbody += `<td data-bind="${o.name}"></td>`;
27528
+ }
27529
+
27530
+ const html = `
27531
+ <nine-grid class="ai" display-row-count="${rowCount > 5 ? 5 : rowCount}" show-title-bar="false" show-menu-icon="false" show-status-bar="false" select-type="row" auto-fit-col="true" show-title-bar="true" show-menu-icon="true" show-status-bar="true" enable-fixed-col="true" row-resizable="false" col-movable="true">
27532
+ <table>
27533
+ <caption>Sheet1</caption>
27534
+ <colgroup>
27535
+ <col background-color="#888"/>
27536
+ ${colgroup}
27537
+ </colgroup>
27538
+ <thead>
27539
+ <tr>
27540
+ <th>No.</th>
27541
+ ${thead}
27542
+ </tr>
27543
+ </thead>
27544
+ <tbody>
27545
+ <tr>
27546
+ <th><ng-row-indicator/></th>
27547
+ ${tbody}
27548
+ </tr>
27549
+ </tbody>
27550
+ </table>
27551
+ </nine-grid>
27552
+ `;
27553
+
27554
+ this.shadowRoot.querySelector(".grid").innerHTML = html;
27555
+
27556
+ setTimeout(() => {
27557
+ const grd = this.shadowRoot.querySelector("nine-grid");
27558
+ grd.data.source = this.#data;
27559
+
27560
+ //this.scrollIntoView({ behavior: "smooth", block: "end" });
27561
+ });
27562
+ };
27563
+
27504
27564
  #init = () => {
27505
27565
 
27506
27566
  const rowCount = Number(this.getAttribute("row-count"));
@@ -27683,6 +27743,44 @@ class aiChat extends HTMLElement
27683
27743
  el.scrollIntoView({ behavior: "smooth", block: "end" });
27684
27744
  }, 200);
27685
27745
  };
27746
+
27747
+ add2 = (sender, message, info, data) => {
27748
+ const target = this.shadowRoot.querySelector(".chat-body");
27749
+
27750
+ //console.log(data);
27751
+
27752
+ let el;
27753
+ switch (sender) {
27754
+ case "me":
27755
+ el = document.createElement("nx-ai-my-message");
27756
+ el.setAttribute("message", message);
27757
+ target.appendChild(el);
27758
+ break;
27759
+
27760
+ case "ing":
27761
+ el = document.createElement("nx-ai-ing-message");
27762
+ //el.setAttribute("message", message);
27763
+ target.appendChild(el);
27764
+ break;
27765
+
27766
+ case "ai":
27767
+ this.shadowRoot.querySelectorAll("nx-ai-ing-message").forEach(el => {
27768
+ el.remove();
27769
+ });
27770
+
27771
+ el = document.createElement("nx-ai-message");
27772
+ el.setAttribute("message", message);
27773
+ el.setAttribute("row-count", data ? data.length : 0);
27774
+ //el.data = data;
27775
+ el.initialize(data);
27776
+ target.appendChild(el);
27777
+ break;
27778
+ }
27779
+
27780
+ setTimeout(() => {
27781
+ el.scrollIntoView({ behavior: "smooth", block: "end" });
27782
+ }, 200);
27783
+ };
27686
27784
  }
27687
27785
 
27688
27786
  customElements.define("nx-ai-message", aiMessage);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ninegrid2",
3
3
  "type": "module",
4
- "version": "6.432.0",
4
+ "version": "6.433.0",
5
5
  "main": "dist/index.js",
6
6
  "exports": {
7
7
  "import": "./dist/index.js",
@@ -87,6 +87,66 @@ class aiMessage extends HTMLElement
87
87
  });
88
88
  }
89
89
 
90
+ initialize2 = (info, data) => {
91
+ this.#data = data;
92
+
93
+ setTimeout(() => {
94
+ this.#init2();
95
+ });
96
+ }
97
+
98
+ #init2 = () => {
99
+
100
+ const rowCount = Number(this.getAttribute("row-count"));
101
+ if (rowCount < 1) {
102
+ this.shadowRoot.querySelector(".grid").style.display = "none";
103
+ this.shadowRoot.querySelector(".chat-menu").style.display = "none";
104
+ return;
105
+ }
106
+
107
+ let colgroup = "";
108
+ let thead = "";
109
+ let tbody = "";
110
+ for (let o of info) {
111
+ colgroup += `<col background-color="#888"/>`;
112
+ thead += `<th>${o.desc}</th>`;
113
+ tbody += `<td data-bind="${o.name}"></td>`;
114
+ }
115
+
116
+ const html = `
117
+ <nine-grid class="ai" display-row-count="${rowCount > 5 ? 5 : rowCount}" show-title-bar="false" show-menu-icon="false" show-status-bar="false" select-type="row" auto-fit-col="true" show-title-bar="true" show-menu-icon="true" show-status-bar="true" enable-fixed-col="true" row-resizable="false" col-movable="true">
118
+ <table>
119
+ <caption>Sheet1</caption>
120
+ <colgroup>
121
+ <col background-color="#888"/>
122
+ ${colgroup}
123
+ </colgroup>
124
+ <thead>
125
+ <tr>
126
+ <th>No.</th>
127
+ ${thead}
128
+ </tr>
129
+ </thead>
130
+ <tbody>
131
+ <tr>
132
+ <th><ng-row-indicator/></th>
133
+ ${tbody}
134
+ </tr>
135
+ </tbody>
136
+ </table>
137
+ </nine-grid>
138
+ `;
139
+
140
+ this.shadowRoot.querySelector(".grid").innerHTML = html;
141
+
142
+ setTimeout(() => {
143
+ const grd = this.shadowRoot.querySelector("nine-grid");
144
+ grd.data.source = this.#data;
145
+
146
+ //this.scrollIntoView({ behavior: "smooth", block: "end" });
147
+ });
148
+ };
149
+
90
150
  #init = () => {
91
151
 
92
152
  const rowCount = Number(this.getAttribute("row-count"));
@@ -272,6 +332,47 @@ class aiChat extends HTMLElement
272
332
  el.scrollIntoView({ behavior: "smooth", block: "end" });
273
333
  }, 200);
274
334
  };
335
+
336
+ add2 = (sender, message, info, data) => {
337
+ const target = this.shadowRoot.querySelector(".chat-body");
338
+
339
+ //console.log(data);
340
+
341
+ let el;
342
+ switch (sender) {
343
+ case "me":
344
+ el = document.createElement("nx-ai-my-message");
345
+ el.setAttribute("message", message);
346
+ target.appendChild(el);
347
+ break;
348
+
349
+ case "ing":
350
+ el = document.createElement("nx-ai-ing-message");
351
+ //el.setAttribute("message", message);
352
+ target.appendChild(el);
353
+ break;
354
+
355
+ case "ai":
356
+ this.shadowRoot.querySelectorAll("nx-ai-ing-message").forEach(el => {
357
+ el.remove();
358
+ });
359
+
360
+ el = document.createElement("nx-ai-message");
361
+ el.setAttribute("message", message);
362
+ el.setAttribute("row-count", data ? data.length : 0);
363
+ //el.data = data;
364
+ el.initialize(data);
365
+ target.appendChild(el);
366
+ break;
367
+
368
+ default:
369
+ break;
370
+ }
371
+
372
+ setTimeout(() => {
373
+ el.scrollIntoView({ behavior: "smooth", block: "end" });
374
+ }, 200);
375
+ };
275
376
  }
276
377
 
277
378
  customElements.define("nx-ai-message", aiMessage);