ninegrid2 6.431.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);
@@ -14865,24 +14865,24 @@ class ngColumns
14865
14865
  return this.#owner.activeTmpl.querySelectorAll("[data-bind]").length;
14866
14866
  }
14867
14867
 
14868
- #element2Info = (el) => {
14869
- if (!el) return null;
14868
+ info = (v) => {
14870
14869
 
14871
- const ths = this.#owner.body.querySelectorAll(`thead [data-col="${el.dataset.col}"]`);
14870
+ const element2Info = (el) => {
14872
14871
 
14873
- return {
14874
- "name": el.dataset.bind,
14875
- "type": (el.dataset.type || "string").toLocaleLowerCase(),
14876
- "desc": ths.length > 0 ? ths[ths.length - 1].getAttribute("title") : null,
14877
- };
14878
- };
14872
+ if (!el) return null;
14879
14873
 
14880
- info = (v) => {
14881
- return this.#element2Info(this.#owner.activeTmpl.querySelector(`[data-bind="${v}"]`));
14882
- }
14874
+ const ths = this.#owner.body.querySelectorAll(`thead [data-col="${el.dataset.col}"]`);
14883
14875
 
14884
- infos = () => {
14885
- return Array.from(this.#owner.activeTmpl.querySelectorAll("[data-bind]")).map(el => this.#element2Info(el));
14876
+ return {
14877
+ "name": el.dataset.bind,
14878
+ "type": (el.dataset.type || "string").toLocaleLowerCase(),
14879
+ "desc": ths.length > 0 ? ths[ths.length - 1].getAttribute("title") : null,
14880
+ };
14881
+ };
14882
+
14883
+ return v ?
14884
+ element2Info(this.#owner.activeTmpl.querySelector(`[data-bind="${v}"]`)) :
14885
+ Array.from(this.#owner.activeTmpl.querySelectorAll("[data-bind]")).map(el => element2Info(el));
14886
14886
  }
14887
14887
 
14888
14888
 
@@ -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);
@@ -14863,24 +14863,24 @@ class ngColumns
14863
14863
  return this.#owner.activeTmpl.querySelectorAll("[data-bind]").length;
14864
14864
  }
14865
14865
 
14866
- #element2Info = (el) => {
14867
- if (!el) return null;
14866
+ info = (v) => {
14868
14867
 
14869
- const ths = this.#owner.body.querySelectorAll(`thead [data-col="${el.dataset.col}"]`);
14868
+ const element2Info = (el) => {
14870
14869
 
14871
- return {
14872
- "name": el.dataset.bind,
14873
- "type": (el.dataset.type || "string").toLocaleLowerCase(),
14874
- "desc": ths.length > 0 ? ths[ths.length - 1].getAttribute("title") : null,
14875
- };
14876
- };
14870
+ if (!el) return null;
14877
14871
 
14878
- info = (v) => {
14879
- return this.#element2Info(this.#owner.activeTmpl.querySelector(`[data-bind="${v}"]`));
14880
- }
14872
+ const ths = this.#owner.body.querySelectorAll(`thead [data-col="${el.dataset.col}"]`);
14881
14873
 
14882
- infos = () => {
14883
- return Array.from(this.#owner.activeTmpl.querySelectorAll("[data-bind]")).map(el => this.#element2Info(el));
14874
+ return {
14875
+ "name": el.dataset.bind,
14876
+ "type": (el.dataset.type || "string").toLocaleLowerCase(),
14877
+ "desc": ths.length > 0 ? ths[ths.length - 1].getAttribute("title") : null,
14878
+ };
14879
+ };
14880
+
14881
+ return v ?
14882
+ element2Info(this.#owner.activeTmpl.querySelector(`[data-bind="${v}"]`)) :
14883
+ Array.from(this.#owner.activeTmpl.querySelectorAll("[data-bind]")).map(el => element2Info(el));
14884
14884
  }
14885
14885
 
14886
14886
 
@@ -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);
@@ -12,24 +12,24 @@ export class ngColumns
12
12
  return this.#owner.activeTmpl.querySelectorAll("[data-bind]").length;
13
13
  }
14
14
 
15
- #element2Info = (el) => {
16
- if (!el) return null;
15
+ info = (v) => {
17
16
 
18
- const ths = this.#owner.body.querySelectorAll(`thead [data-col="${el.dataset.col}"]`);
17
+ const element2Info = (el) => {
19
18
 
20
- return {
21
- "name": el.dataset.bind,
22
- "type": (el.dataset.type || "string").toLocaleLowerCase(),
23
- "desc": ths.length > 0 ? ths[ths.length - 1].getAttribute("title") : null,
24
- };
25
- };
19
+ if (!el) return null;
26
20
 
27
- info = (v) => {
28
- return this.#element2Info(this.#owner.activeTmpl.querySelector(`[data-bind="${v}"]`));
29
- }
21
+ const ths = this.#owner.body.querySelectorAll(`thead [data-col="${el.dataset.col}"]`);
22
+
23
+ return {
24
+ "name": el.dataset.bind,
25
+ "type": (el.dataset.type || "string").toLocaleLowerCase(),
26
+ "desc": ths.length > 0 ? ths[ths.length - 1].getAttribute("title") : null,
27
+ };
28
+ }
30
29
 
31
- infos = () => {
32
- return Array.from(this.#owner.activeTmpl.querySelectorAll("[data-bind]")).map(el => this.#element2Info(el));
30
+ return v ?
31
+ element2Info(this.#owner.activeTmpl.querySelector(`[data-bind="${v}"]`)) :
32
+ Array.from(this.#owner.activeTmpl.querySelectorAll("[data-bind]")).map(el => element2Info(el));
33
33
  }
34
34
 
35
35
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ninegrid2",
3
3
  "type": "module",
4
- "version": "6.431.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);
@@ -12,24 +12,24 @@ export class ngColumns
12
12
  return this.#owner.activeTmpl.querySelectorAll("[data-bind]").length;
13
13
  }
14
14
 
15
- #element2Info = (el) => {
16
- if (!el) return null;
15
+ info = (v) => {
17
16
 
18
- const ths = this.#owner.body.querySelectorAll(`thead [data-col="${el.dataset.col}"]`);
17
+ const element2Info = (el) => {
19
18
 
20
- return {
21
- "name": el.dataset.bind,
22
- "type": (el.dataset.type || "string").toLocaleLowerCase(),
23
- "desc": ths.length > 0 ? ths[ths.length - 1].getAttribute("title") : null,
24
- };
25
- };
19
+ if (!el) return null;
26
20
 
27
- info = (v) => {
28
- return this.#element2Info(this.#owner.activeTmpl.querySelector(`[data-bind="${v}"]`));
29
- }
21
+ const ths = this.#owner.body.querySelectorAll(`thead [data-col="${el.dataset.col}"]`);
22
+
23
+ return {
24
+ "name": el.dataset.bind,
25
+ "type": (el.dataset.type || "string").toLocaleLowerCase(),
26
+ "desc": ths.length > 0 ? ths[ths.length - 1].getAttribute("title") : null,
27
+ };
28
+ }
30
29
 
31
- infos = () => {
32
- return Array.from(this.#owner.activeTmpl.querySelectorAll("[data-bind]")).map(el => this.#element2Info(el));
30
+ return v ?
31
+ element2Info(this.#owner.activeTmpl.querySelector(`[data-bind="${v}"]`)) :
32
+ Array.from(this.#owner.activeTmpl.querySelectorAll("[data-bind]")).map(el => element2Info(el));
33
33
  }
34
34
 
35
35