@sme.up/ketchup 9.3.0 → 9.5.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.
Files changed (122) hide show
  1. package/dist/cjs/{f-button-4caf541a.js → f-button-033ed6d4.js} +1 -1
  2. package/dist/cjs/{f-cell-979c26ea.js → f-cell-ef276797.js} +5 -5
  3. package/dist/cjs/{f-chip-8957940b.js → f-chip-d4e26a2b.js} +2 -2
  4. package/dist/cjs/{f-image-e16fe10d.js → f-image-33be7baf.js} +1 -1
  5. package/dist/cjs/{f-paginator-utils-f2dd0322.js → f-paginator-utils-5a18cc19.js} +2 -2
  6. package/dist/cjs/{f-text-field-2fac8078.js → f-text-field-f03e97f8.js} +1 -1
  7. package/dist/cjs/index.cjs.js +1 -1
  8. package/dist/cjs/ketchup.cjs.js +1 -1
  9. package/dist/cjs/kup-accordion.cjs.entry.js +2 -2
  10. package/dist/cjs/kup-autocomplete_27.cjs.entry.js +18 -9
  11. package/dist/cjs/kup-box.cjs.entry.js +9 -9
  12. package/dist/cjs/kup-calendar.cjs.entry.js +4 -4
  13. package/dist/cjs/kup-card-list.cjs.entry.js +1 -1
  14. package/dist/cjs/kup-cell.cjs.entry.js +6 -6
  15. package/dist/cjs/kup-dashboard.cjs.entry.js +4 -4
  16. package/dist/cjs/kup-drawer.cjs.entry.js +1 -1
  17. package/dist/cjs/kup-echart.cjs.entry.js +1 -1
  18. package/dist/cjs/kup-family-tree.cjs.entry.js +3 -3
  19. package/dist/cjs/kup-grid.cjs.entry.js +1 -1
  20. package/dist/cjs/kup-iframe.cjs.entry.js +1 -1
  21. package/dist/cjs/kup-image-list.cjs.entry.js +6 -6
  22. package/dist/cjs/kup-lazy.cjs.entry.js +1 -1
  23. package/dist/cjs/kup-magic-box.cjs.entry.js +2 -2
  24. package/dist/cjs/{kup-manager-c63f4fb9.js → kup-manager-f90f1b6d.js} +125 -0
  25. package/dist/cjs/kup-nav-bar.cjs.entry.js +1 -1
  26. package/dist/cjs/kup-numeric-picker.cjs.entry.js +2 -2
  27. package/dist/cjs/kup-openai-interface.cjs.entry.js +146 -0
  28. package/dist/cjs/kup-photo-frame.cjs.entry.js +1 -1
  29. package/dist/cjs/kup-planner.cjs.entry.js +2 -2
  30. package/dist/cjs/kup-probe.cjs.entry.js +1 -1
  31. package/dist/cjs/kup-qlik.cjs.entry.js +1 -1
  32. package/dist/cjs/kup-snackbar.cjs.entry.js +3 -3
  33. package/dist/cjs/loader.cjs.js +1 -1
  34. package/dist/collection/collection-manifest.json +1 -0
  35. package/dist/collection/components/kup-box/kup-box.js +3 -3
  36. package/dist/collection/components/kup-data-table/kup-data-table.js +11 -2
  37. package/dist/collection/components/kup-image/assets/svg/open-ai.svg +1 -0
  38. package/dist/collection/components/kup-openai-interface/kup-openai-interface-declarations.js +11 -0
  39. package/dist/collection/components/kup-openai-interface/kup-openai-interface.css +64 -0
  40. package/dist/collection/components/kup-openai-interface/kup-openai-interface.js +340 -0
  41. package/dist/collection/managers/kup-manager/kup-manager.js +124 -0
  42. package/dist/components/kup-autocomplete2.js +11 -2
  43. package/dist/components/kup-box2.js +3 -3
  44. package/dist/components/kup-dashboard.js +1 -1
  45. package/dist/components/kup-magic-box.js +1 -1
  46. package/dist/components/kup-manager.js +125 -1
  47. package/dist/components/kup-openai-interface.d.ts +11 -0
  48. package/dist/components/kup-openai-interface.js +301 -0
  49. package/dist/esm/{f-button-5ccc2e50.js → f-button-ccde4447.js} +1 -1
  50. package/dist/esm/{f-cell-6f4290b2.js → f-cell-2ad41d52.js} +5 -5
  51. package/dist/esm/{f-chip-465aa432.js → f-chip-3df1c255.js} +2 -2
  52. package/dist/esm/{f-image-c5063342.js → f-image-5434b351.js} +1 -1
  53. package/dist/esm/{f-paginator-utils-6903534b.js → f-paginator-utils-b90cdd2b.js} +2 -2
  54. package/dist/esm/{f-text-field-28b2b26d.js → f-text-field-f0b81f8b.js} +1 -1
  55. package/dist/esm/index.js +1 -1
  56. package/dist/esm/ketchup.js +1 -1
  57. package/dist/esm/kup-accordion.entry.js +2 -2
  58. package/dist/esm/kup-autocomplete_27.entry.js +18 -9
  59. package/dist/esm/kup-box.entry.js +9 -9
  60. package/dist/esm/kup-calendar.entry.js +4 -4
  61. package/dist/esm/kup-card-list.entry.js +1 -1
  62. package/dist/esm/kup-cell.entry.js +6 -6
  63. package/dist/esm/kup-dashboard.entry.js +4 -4
  64. package/dist/esm/kup-drawer.entry.js +1 -1
  65. package/dist/esm/kup-echart.entry.js +1 -1
  66. package/dist/esm/kup-family-tree.entry.js +3 -3
  67. package/dist/esm/kup-grid.entry.js +1 -1
  68. package/dist/esm/kup-iframe.entry.js +1 -1
  69. package/dist/esm/kup-image-list.entry.js +6 -6
  70. package/dist/esm/kup-lazy.entry.js +1 -1
  71. package/dist/esm/kup-magic-box.entry.js +2 -2
  72. package/dist/esm/{kup-manager-bfea4e6f.js → kup-manager-e33d8d8c.js} +125 -1
  73. package/dist/esm/kup-nav-bar.entry.js +1 -1
  74. package/dist/esm/kup-numeric-picker.entry.js +2 -2
  75. package/dist/esm/kup-openai-interface.entry.js +142 -0
  76. package/dist/esm/kup-photo-frame.entry.js +1 -1
  77. package/dist/esm/kup-planner.entry.js +2 -2
  78. package/dist/esm/kup-probe.entry.js +1 -1
  79. package/dist/esm/kup-qlik.entry.js +1 -1
  80. package/dist/esm/kup-snackbar.entry.js +3 -3
  81. package/dist/esm/loader.js +1 -1
  82. package/dist/ketchup/assets/svg/open-ai.svg +1 -0
  83. package/dist/ketchup/index.esm.js +1 -1
  84. package/dist/ketchup/ketchup.esm.js +1 -1
  85. package/dist/ketchup/{p-f2df4ce9.entry.js → p-01aaf3e4.entry.js} +1 -1
  86. package/dist/ketchup/{p-ce9ef2d5.js → p-11e7be94.js} +1 -1
  87. package/dist/ketchup/{p-903d1b10.entry.js → p-190d0bc5.entry.js} +1 -1
  88. package/dist/ketchup/{p-95272714.entry.js → p-1a594e06.entry.js} +1 -1
  89. package/dist/ketchup/{p-7c5a1357.entry.js → p-1dbfcab5.entry.js} +1 -1
  90. package/dist/ketchup/{p-85279516.entry.js → p-23e4caa1.entry.js} +2 -2
  91. package/dist/ketchup/p-2681d3a2.entry.js +1 -0
  92. package/dist/ketchup/p-269a1dfe.entry.js +1 -0
  93. package/dist/ketchup/{p-829d7060.entry.js → p-2940b559.entry.js} +1 -1
  94. package/dist/ketchup/{p-4bc3b3a6.js → p-39ba3355.js} +1 -1
  95. package/dist/ketchup/{p-eae42bff.entry.js → p-4725191c.entry.js} +1 -1
  96. package/dist/ketchup/{p-097500fe.js → p-4afe8662.js} +1 -1
  97. package/dist/ketchup/{p-8591ac0b.entry.js → p-58798e2d.entry.js} +1 -1
  98. package/dist/ketchup/{p-e46470a6.entry.js → p-5b3d8636.entry.js} +1 -1
  99. package/dist/ketchup/{p-0f91d4de.entry.js → p-5fa089cd.entry.js} +1 -1
  100. package/dist/ketchup/{p-db93bc06.entry.js → p-645d881d.entry.js} +1 -1
  101. package/dist/ketchup/{p-d7b8295a.entry.js → p-6a8fcb02.entry.js} +1 -1
  102. package/dist/ketchup/{p-20aa95ae.entry.js → p-6f108540.entry.js} +1 -1
  103. package/dist/ketchup/{p-8ecdd076.entry.js → p-788da2d9.entry.js} +1 -1
  104. package/dist/ketchup/{p-69287f4a.entry.js → p-7e5d8532.entry.js} +1 -1
  105. package/dist/ketchup/{p-ee6305f5.js → p-95b31ede.js} +1 -1
  106. package/dist/ketchup/{p-4c1ec006.js → p-9df95b9f.js} +1 -1
  107. package/dist/ketchup/{p-7a72c4fa.entry.js → p-a5229d3d.entry.js} +1 -1
  108. package/dist/ketchup/{p-0cb5e9ae.entry.js → p-b104afb6.entry.js} +1 -1
  109. package/dist/ketchup/{p-8e180c01.entry.js → p-b857aab2.entry.js} +1 -1
  110. package/dist/ketchup/{p-1872c92e.entry.js → p-c0c65349.entry.js} +1 -1
  111. package/dist/ketchup/{p-f1efab38.entry.js → p-ddd25869.entry.js} +1 -1
  112. package/dist/ketchup/p-eea1ee1b.js +1 -0
  113. package/dist/ketchup/{p-21c640a5.js → p-f0e4e190.js} +1 -1
  114. package/dist/ketchup/{p-51f9b230.entry.js → p-f81d7218.entry.js} +1 -1
  115. package/dist/types/components/kup-openai-interface/kup-openai-interface-declarations.d.ts +10 -0
  116. package/dist/types/components/kup-openai-interface/kup-openai-interface.d.ts +59 -0
  117. package/dist/types/components.d.ts +86 -0
  118. package/dist/types/managers/kup-manager/kup-manager-declarations.d.ts +15 -0
  119. package/dist/types/managers/kup-manager/kup-manager.d.ts +17 -1
  120. package/package.json +1 -1
  121. package/dist/ketchup/p-612b46da.entry.js +0 -1
  122. package/dist/ketchup/p-84be8f0b.js +0 -1
@@ -0,0 +1,340 @@
1
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
2
+ if (kind === "a" && !f)
3
+ throw new TypeError("Private accessor was defined without a getter");
4
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
5
+ throw new TypeError("Cannot read private member from an object whose class did not declare it");
6
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
7
+ };
8
+ var _KupOpenAiInterface_instances, _KupOpenAiInterface_openAiInteract, _KupOpenAiInterface_dataTableData;
9
+ import { forceUpdate, h, Host, } from "@stencil/core";
10
+ import { kupManagerInstance } from "../../managers/kup-manager/kup-manager";
11
+ import { getProps, setProps } from "../../utils/utils";
12
+ import { componentWrapperId } from "../../variables/GenericVariables";
13
+ import { KupOpenAiInterfaceProps } from "./kup-openai-interface-declarations";
14
+ import { FImage } from "../../f-components/f-image/f-image";
15
+ export class KupOpenAiInterface {
16
+ constructor() {
17
+ _KupOpenAiInterface_instances.add(this);
18
+ /*-------------------------------------------------*/
19
+ /* I n t e r n a l V a r i a b l e s */
20
+ /*-------------------------------------------------*/
21
+ this.dragHandler = null;
22
+ this.kupManager = kupManagerInstance();
23
+ this.textArea = null;
24
+ this.dataTable = null;
25
+ this.button = null;
26
+ this.messages = [];
27
+ this.customStyle = '';
28
+ this.data = null;
29
+ this.dialogTitle = 'Open AI integration';
30
+ this.label = 'Insert natural language request...';
31
+ }
32
+ /*-------------------------------------------------*/
33
+ /* P u b l i c M e t h o d s */
34
+ /*-------------------------------------------------*/
35
+ /**
36
+ * Used to retrieve component's props values.
37
+ * @param {boolean} descriptions - When provided and true, the result will be the list of props with their description.
38
+ * @returns {Promise<GenericObject>} List of props as object, each key will be a prop.
39
+ */
40
+ async getProps(descriptions) {
41
+ return getProps(this, KupOpenAiInterfaceProps, descriptions);
42
+ }
43
+ /**
44
+ * This method is used to trigger a new render of the component.
45
+ */
46
+ async refresh() {
47
+ forceUpdate(this);
48
+ }
49
+ /**
50
+ * Sets the props to the component.
51
+ * @param {GenericObject} props - Object containing props that will be set to the component.
52
+ */
53
+ async setProps(props) {
54
+ setProps(this, KupOpenAiInterfaceProps, props);
55
+ }
56
+ /*-------------------------------------------------*/
57
+ /* L i f e c y c l e H o o k s */
58
+ /*-------------------------------------------------*/
59
+ componentWillLoad() {
60
+ this.kupManager.debug.logLoad(this, false);
61
+ this.kupManager.language.register(this);
62
+ this.kupManager.theme.register(this);
63
+ }
64
+ componentDidLoad() {
65
+ this.dragHandler =
66
+ this.rootElement.shadowRoot.querySelector('#drag-handle');
67
+ this.kupManager.interact.dialogify(this.rootElement, this.dragHandler);
68
+ this.kupReady.emit({
69
+ comp: this,
70
+ id: this.rootElement.id,
71
+ });
72
+ this.kupManager.debug.logLoad(this, true);
73
+ }
74
+ componentWillRender() {
75
+ this.kupManager.debug.logRender(this, false);
76
+ }
77
+ componentDidRender() {
78
+ this.kupManager.debug.logRender(this, true);
79
+ }
80
+ render() {
81
+ const dataTableProps = {};
82
+ dataTableProps.data = __classPrivateFieldGet(this, _KupOpenAiInterface_instances, "m", _KupOpenAiInterface_dataTableData).call(this);
83
+ const textAreaProps = {};
84
+ textAreaProps.textArea = true;
85
+ textAreaProps.label = this.label;
86
+ const buttonProps = {};
87
+ buttonProps.label = 'Confirm';
88
+ buttonProps.icon = 'check';
89
+ buttonProps.showSpinner = false;
90
+ return (h(Host, null, h("style", null, this.kupManager.theme.setKupStyle(this.rootElement)), h("div", { id: componentWrapperId }, h("div", { class: "openai-interface-wrapper" }, h("div", { class: "actions", id: "drag-handle" }, h("div", { class: "header" }, this.dialogTitle ? (h("div", { class: "header__title" }, this.dialogTitle)) : null, h(FImage, { onClick: () => this.kupManager.hideOpenAI(), sizeX: "1.25em", sizeY: "1.25em", resource: "clear", wrapperClass: "header__close" })), h("kup-text-field", Object.assign({}, textAreaProps, { ref: (el) => (this.textArea = el) })), h("kup-button", Object.assign({}, buttonProps, { ref: (el) => (this.button = el), "onKup-button-click": () => __classPrivateFieldGet(this, _KupOpenAiInterface_instances, "m", _KupOpenAiInterface_openAiInteract).call(this) })), h("kup-data-table", Object.assign({}, dataTableProps, { ref: (el) => (this.dataTable = el) })))))));
91
+ }
92
+ disconnectedCallback() {
93
+ this.kupManager.language.unregister(this);
94
+ this.kupManager.theme.unregister(this);
95
+ }
96
+ static get is() { return "kup-openai-interface"; }
97
+ static get encapsulation() { return "shadow"; }
98
+ static get originalStyleUrls() {
99
+ return {
100
+ "$": ["kup-openai-interface.scss"]
101
+ };
102
+ }
103
+ static get styleUrls() {
104
+ return {
105
+ "$": ["kup-openai-interface.css"]
106
+ };
107
+ }
108
+ static get properties() {
109
+ return {
110
+ "customStyle": {
111
+ "type": "string",
112
+ "mutable": false,
113
+ "complexType": {
114
+ "original": "string",
115
+ "resolved": "string",
116
+ "references": {}
117
+ },
118
+ "required": false,
119
+ "optional": false,
120
+ "docs": {
121
+ "tags": [{
122
+ "name": "default",
123
+ "text": "\"\""
124
+ }, {
125
+ "name": "see",
126
+ "text": "https://ketchup.smeup.com/ketchup-showcase/#/customization"
127
+ }],
128
+ "text": "Custom style of the component."
129
+ },
130
+ "attribute": "custom-style",
131
+ "reflect": false,
132
+ "defaultValue": "''"
133
+ },
134
+ "data": {
135
+ "type": "unknown",
136
+ "mutable": true,
137
+ "complexType": {
138
+ "original": "KupDataDataset",
139
+ "resolved": "KupDataDataset",
140
+ "references": {
141
+ "KupDataDataset": {
142
+ "location": "import",
143
+ "path": "../../managers/kup-data/kup-data-declarations",
144
+ "id": "src/managers/kup-data/kup-data-declarations.ts::KupDataDataset"
145
+ }
146
+ }
147
+ },
148
+ "required": false,
149
+ "optional": false,
150
+ "docs": {
151
+ "tags": [{
152
+ "name": "default",
153
+ "text": "null"
154
+ }],
155
+ "text": "Sets the data that will be used for OpenAI comunication."
156
+ },
157
+ "defaultValue": "null"
158
+ },
159
+ "dialogTitle": {
160
+ "type": "string",
161
+ "mutable": false,
162
+ "complexType": {
163
+ "original": "string",
164
+ "resolved": "string",
165
+ "references": {}
166
+ },
167
+ "required": false,
168
+ "optional": false,
169
+ "docs": {
170
+ "tags": [{
171
+ "name": "default",
172
+ "text": "\"Open AI integration\""
173
+ }],
174
+ "text": "Sets the dialog title"
175
+ },
176
+ "attribute": "dialog-title",
177
+ "reflect": false,
178
+ "defaultValue": "'Open AI integration'"
179
+ },
180
+ "label": {
181
+ "type": "string",
182
+ "mutable": false,
183
+ "complexType": {
184
+ "original": "string",
185
+ "resolved": "string",
186
+ "references": {}
187
+ },
188
+ "required": false,
189
+ "optional": false,
190
+ "docs": {
191
+ "tags": [{
192
+ "name": "default",
193
+ "text": "\"Insert natural language request...\""
194
+ }],
195
+ "text": "Sets the text area label"
196
+ },
197
+ "attribute": "label",
198
+ "reflect": false,
199
+ "defaultValue": "'Insert natural language request...'"
200
+ }
201
+ };
202
+ }
203
+ static get events() {
204
+ return [{
205
+ "method": "kupReady",
206
+ "name": "kup-openai-interface-ready",
207
+ "bubbles": true,
208
+ "cancelable": false,
209
+ "composed": true,
210
+ "docs": {
211
+ "tags": [],
212
+ "text": ""
213
+ },
214
+ "complexType": {
215
+ "original": "KupEventPayload",
216
+ "resolved": "KupEventPayload",
217
+ "references": {
218
+ "KupEventPayload": {
219
+ "location": "import",
220
+ "path": "../../types/GenericTypes",
221
+ "id": "src/types/GenericTypes.ts::KupEventPayload"
222
+ }
223
+ }
224
+ }
225
+ }];
226
+ }
227
+ static get methods() {
228
+ return {
229
+ "getProps": {
230
+ "complexType": {
231
+ "signature": "(descriptions?: boolean) => Promise<GenericObject>",
232
+ "parameters": [{
233
+ "tags": [{
234
+ "name": "param",
235
+ "text": "descriptions - When provided and true, the result will be the list of props with their description."
236
+ }],
237
+ "text": "- When provided and true, the result will be the list of props with their description."
238
+ }],
239
+ "references": {
240
+ "Promise": {
241
+ "location": "global",
242
+ "id": "global::Promise"
243
+ },
244
+ "GenericObject": {
245
+ "location": "import",
246
+ "path": "../../types/GenericTypes",
247
+ "id": "src/types/GenericTypes.ts::GenericObject"
248
+ }
249
+ },
250
+ "return": "Promise<GenericObject>"
251
+ },
252
+ "docs": {
253
+ "text": "Used to retrieve component's props values.",
254
+ "tags": [{
255
+ "name": "param",
256
+ "text": "descriptions - When provided and true, the result will be the list of props with their description."
257
+ }, {
258
+ "name": "returns",
259
+ "text": "List of props as object, each key will be a prop."
260
+ }]
261
+ }
262
+ },
263
+ "refresh": {
264
+ "complexType": {
265
+ "signature": "() => Promise<void>",
266
+ "parameters": [],
267
+ "references": {
268
+ "Promise": {
269
+ "location": "global",
270
+ "id": "global::Promise"
271
+ }
272
+ },
273
+ "return": "Promise<void>"
274
+ },
275
+ "docs": {
276
+ "text": "This method is used to trigger a new render of the component.",
277
+ "tags": []
278
+ }
279
+ },
280
+ "setProps": {
281
+ "complexType": {
282
+ "signature": "(props: GenericObject) => Promise<void>",
283
+ "parameters": [{
284
+ "tags": [{
285
+ "name": "param",
286
+ "text": "props - Object containing props that will be set to the component."
287
+ }],
288
+ "text": "- Object containing props that will be set to the component."
289
+ }],
290
+ "references": {
291
+ "Promise": {
292
+ "location": "global",
293
+ "id": "global::Promise"
294
+ },
295
+ "GenericObject": {
296
+ "location": "import",
297
+ "path": "../../types/GenericTypes",
298
+ "id": "src/types/GenericTypes.ts::GenericObject"
299
+ }
300
+ },
301
+ "return": "Promise<void>"
302
+ },
303
+ "docs": {
304
+ "text": "Sets the props to the component.",
305
+ "tags": [{
306
+ "name": "param",
307
+ "text": "props - Object containing props that will be set to the component."
308
+ }]
309
+ }
310
+ }
311
+ };
312
+ }
313
+ static get elementRef() { return "rootElement"; }
314
+ }
315
+ _KupOpenAiInterface_instances = new WeakSet(), _KupOpenAiInterface_openAiInteract =
316
+ /*-------------------------------------------------*/
317
+ /* P r i v a t e M e t h o d s */
318
+ /*-------------------------------------------------*/
319
+ async function _KupOpenAiInterface_openAiInteract() {
320
+ this.button.showSpinner = true;
321
+ this.messages = await this.kupManager.interactOpenAI(await this.textArea.getValue());
322
+ this.dataTable.data = __classPrivateFieldGet(this, _KupOpenAiInterface_instances, "m", _KupOpenAiInterface_dataTableData).call(this);
323
+ this.button.showSpinner = false;
324
+ }, _KupOpenAiInterface_dataTableData = function _KupOpenAiInterface_dataTableData() {
325
+ const data = {};
326
+ data.columns = [{ name: 'mess', title: 'Message' }];
327
+ data.rows = [];
328
+ if (this.messages) {
329
+ for (let i = 0; i < this.messages.length; i++) {
330
+ const mess = this.messages[i];
331
+ if (mess) {
332
+ data.rows.push({
333
+ unselectable: true,
334
+ cells: { mess: { value: mess } },
335
+ });
336
+ }
337
+ }
338
+ }
339
+ return data;
340
+ };
@@ -29,6 +29,8 @@ export class KupManager {
29
29
  */
30
30
  constructor(overrides) {
31
31
  let datesLocale = null, debugActive = null, debugAutoprint = null, debugLogLimit = null, dialogRestrictContainer = null, dialogZIndex = null, languageList = null, languageName = null, objectsList = null, scrollOnHoverDelay = null, scrollOnHoverStep = null, themeList = null, themeName = null, tooltipDelay = null, tooltipFCellCallbacks = null;
32
+ /** POI VIA */
33
+ this.openAIInterface = { url: 'https://kokosstaging.smeup.com' };
32
34
  if (overrides) {
33
35
  const assetsPath = overrides.assetsPath;
34
36
  const dates = overrides.dates;
@@ -39,6 +41,7 @@ export class KupManager {
39
41
  const scrollOnHover = overrides.scrollOnHover;
40
42
  const theme = overrides.theme;
41
43
  const tooltip = overrides.tooltip;
44
+ const openAIUrl = overrides.openAIUrl;
42
45
  if (assetsPath) {
43
46
  setAssetPath(assetsPath);
44
47
  }
@@ -81,6 +84,9 @@ export class KupManager {
81
84
  ? tooltip.fCellCallbacks
82
85
  : null;
83
86
  }
87
+ if (openAIUrl) {
88
+ this.openAIInterface = { url: openAIUrl };
89
+ }
84
90
  }
85
91
  this.data = new KupData();
86
92
  this.dates = new KupDates(datesLocale);
@@ -89,6 +95,7 @@ export class KupManager {
89
95
  this.interact = new KupInteract(dialogZIndex, dialogRestrictContainer);
90
96
  this.language = new KupLanguage(languageList, languageName);
91
97
  this.magicBox = null;
98
+ this.openAI = null;
92
99
  this.math = new KupMath();
93
100
  this.overrides = overrides ? overrides : null;
94
101
  this.objects = new KupObjects(objectsList);
@@ -201,6 +208,123 @@ export class KupManager {
201
208
  this.hideMagicBox();
202
209
  }
203
210
  }
211
+ /**
212
+ * Creates OpenAI component interface.
213
+ */
214
+ async showOpenAI(data) {
215
+ if (!this.openAIInterface || !this.openAIInterface.url) {
216
+ return;
217
+ }
218
+ if (this.openAI) {
219
+ return;
220
+ }
221
+ const response = await fetch(this.openAIInterface.url + '/api/init', {
222
+ method: 'POST',
223
+ headers: {
224
+ 'Content-Type': 'application/json',
225
+ },
226
+ body: JSON.stringify({ data: data }),
227
+ });
228
+ console.log('kup-manager.showOpenAI() response', response);
229
+ if (response) {
230
+ if (response.status != 200) {
231
+ this.debug.logMessage(this, await response.text(), KupDebugCategory.ERROR);
232
+ return;
233
+ }
234
+ const responseJson = await response.json();
235
+ this.openAIInterface.sessionInfo = {
236
+ fileId: responseJson.fileId,
237
+ threadId: responseJson.threadId,
238
+ };
239
+ }
240
+ this.openAI = document.createElement('kup-openai-interface');
241
+ this.openAI.id = 'kup-openai-interface';
242
+ this.openAI.style.position = 'fixed';
243
+ this.openAI.style.left = 'calc(50% - 250px)';
244
+ this.openAI.style.top = 'calc(50% - 85px)';
245
+ this.openAI.data = data;
246
+ document.body.appendChild(this.openAI);
247
+ }
248
+ /**
249
+ * Removes OpenAI component interface.
250
+ */
251
+ async hideOpenAI() {
252
+ if (!this.openAI) {
253
+ return;
254
+ }
255
+ this.openAI.remove();
256
+ this.openAI = null;
257
+ if (!this.openAIInterface || !this.openAIInterface.url) {
258
+ return;
259
+ }
260
+ if (!this.openAIInterface.sessionInfo) {
261
+ return;
262
+ }
263
+ const response = await fetch(this.openAIInterface.url + '/api/finalize', {
264
+ method: 'POST',
265
+ headers: {
266
+ 'Content-Type': 'application/json',
267
+ },
268
+ body: JSON.stringify({
269
+ fileId: this.openAIInterface.sessionInfo.fileId,
270
+ threadId: this.openAIInterface.sessionInfo.threadId,
271
+ }),
272
+ });
273
+ console.log('kup-manager.hideOpenAI() response', response);
274
+ if (response) {
275
+ if (response.status != 200) {
276
+ this.debug.logMessage(this, await response.text(), KupDebugCategory.ERROR);
277
+ return;
278
+ }
279
+ this.openAIInterface.sessionInfo = null;
280
+ }
281
+ }
282
+ /**
283
+ * Creates or removes OpenAI component interface depending on its existence.
284
+ */
285
+ toggleOpenAI(data) {
286
+ if (!this.openAI) {
287
+ this.showOpenAI(data);
288
+ }
289
+ else {
290
+ this.hideOpenAI();
291
+ }
292
+ }
293
+ async interactOpenAI(question) {
294
+ if (!this.openAI) {
295
+ return;
296
+ }
297
+ if (!this.openAIInterface || !this.openAIInterface.url) {
298
+ return;
299
+ }
300
+ if (!this.openAIInterface.sessionInfo) {
301
+ return;
302
+ }
303
+ const responseArray = [];
304
+ const response = await fetch(this.openAIInterface.url + '/api/chat', {
305
+ method: 'POST',
306
+ headers: {
307
+ 'Content-Type': 'application/json',
308
+ },
309
+ body: JSON.stringify({
310
+ fileId: this.openAIInterface.sessionInfo.fileId,
311
+ threadId: this.openAIInterface.sessionInfo.threadId,
312
+ question: question,
313
+ }),
314
+ });
315
+ console.log('kup-manager.interactOpenAI() response', response);
316
+ if (response) {
317
+ if (response.status != 200) {
318
+ this.debug.logMessage(this, await response.text(), KupDebugCategory.ERROR);
319
+ return;
320
+ }
321
+ const responseJson = await response.json();
322
+ if (responseJson && responseJson.messages) {
323
+ responseArray.push(...responseJson.messages);
324
+ }
325
+ }
326
+ return responseArray;
327
+ }
204
328
  /**
205
329
  * Sets both locale and language library-wide.
206
330
  * @param {KupDatesLocales} locale - The supported locale.
@@ -21560,11 +21560,20 @@ const KupDataTable = /*@__PURE__*/ proxyCustomElement(class KupDataTable extends
21560
21560
  }
21561
21561
  return (h("kup-card", { customStyle: "::slotted(kup-switch) { width: max-content !important; } ::slotted(*) { margin: auto !important; } ::slotted(.customize-element) { margin: auto !important; padding: 0 1em 1em 1em !important; width: max-content !important; } ::slotted(.customize-element):nth-child(1) { padding-top: 1em !important; }", isMenu: true, layoutFamily: KupCardFamily.FREE, ref: (el) => {
21562
21562
  __classPrivateFieldSet$2(this, _KupDataTable_customizeTopPanelRef, el, "f");
21563
- }, sizeX: "360px", sizeY: "300px" }, density, grid, fontsize, transpose, h("kup-switch", { class: "customize-element", checked: this.dragEnabled, label: __classPrivateFieldGet$3(this, _KupDataTable_kupManager, "f").language.translate(KupLanguageGeneric.DRAG_AND_DROP), leadingLabel: true, "onkup-switch-change": () => (this.dragEnabled = !this.dragEnabled) }), h("kup-switch", { class: "customize-element", checked: this.editableData, label: __classPrivateFieldGet$3(this, _KupDataTable_kupManager, "f").language.translate(KupLanguageGeneric.EDITABLE), leadingLabel: true, "onkup-switch-change": () => (this.editableData = !this.editableData) }), h("kup-button", { title: __classPrivateFieldGet$3(this, _KupDataTable_kupManager, "f").language.translate(KupLanguageGeneric.TOGGLE) +
21563
+ }, sizeX: "360px", sizeY: "300px" }, density, grid, fontsize, transpose, h("kup-switch", { class: "customize-element", checked: this.dragEnabled, label: __classPrivateFieldGet$3(this, _KupDataTable_kupManager, "f").language.translate(KupLanguageGeneric.DRAG_AND_DROP), leadingLabel: true, "onkup-switch-change": () => (this.dragEnabled = !this.dragEnabled) }), h("kup-switch", { class: "customize-element", checked: this.editableData, label: __classPrivateFieldGet$3(this, _KupDataTable_kupManager, "f").language.translate(KupLanguageGeneric.EDITABLE), leadingLabel: true, "onkup-switch-change": () => (this.editableData = !this.editableData) }), h("div", { style: {
21564
+ display: 'grid',
21565
+ 'grid-template-columns': 'repeat(2, auto)',
21566
+ width: 'max-content',
21567
+ } }, h("kup-button", { title: __classPrivateFieldGet$3(this, _KupDataTable_kupManager, "f").language.translate(KupLanguageGeneric.TOGGLE) +
21564
21568
  ' Magic Box ' +
21565
21569
  '(' +
21566
21570
  __classPrivateFieldGet$3(this, _KupDataTable_kupManager, "f").language.translate(KupLanguageGeneric.EXPERIMENTAL_FEAT) +
21567
- ')', icon: "auto-fix", "onkup-button-click": () => __classPrivateFieldGet$3(this, _KupDataTable_kupManager, "f").toggleMagicBox() }), totalsMatrix));
21571
+ ')', icon: "auto-fix", "onkup-button-click": () => __classPrivateFieldGet$3(this, _KupDataTable_kupManager, "f").toggleMagicBox() }), __classPrivateFieldGet$3(this, _KupDataTable_kupManager, "f").openAIInterface &&
21572
+ __classPrivateFieldGet$3(this, _KupDataTable_kupManager, "f").openAIInterface.url ? (h("kup-button", { title: __classPrivateFieldGet$3(this, _KupDataTable_kupManager, "f").language.translate(KupLanguageGeneric.TOGGLE) +
21573
+ ' Open AI ' +
21574
+ '(' +
21575
+ __classPrivateFieldGet$3(this, _KupDataTable_kupManager, "f").language.translate(KupLanguageGeneric.EXPERIMENTAL_FEAT) +
21576
+ ')', icon: "open-ai", "onkup-button-click": () => __classPrivateFieldGet$3(this, _KupDataTable_kupManager, "f").toggleOpenAI(this.data) })) : null), totalsMatrix));
21568
21577
  }
21569
21578
  render() {
21570
21579
  __classPrivateFieldSet$2(this, _KupDataTable_thRefs, [], "f");
@@ -1,5 +1,5 @@
1
1
  import { proxyCustomElement, HTMLElement, createEvent, forceUpdate, h, Host } from '@stencil/core/internal/client';
2
- import { k as kupManagerInstance, _ as identify, g as getProps, s as setProps, z as getColumnByName, c as KupLanguageGeneric, b as KupThemeIconValues, P as KupDebugCategory, X as KupPointerEventTypes, a4 as KupDragEffect, a5 as kupDraggableCellAttr, a6 as KupDropEventTypes, Q as KupLanguageSearch, S as SortMode } from './kup-manager.js';
2
+ import { k as kupManagerInstance, _ as identify, g as getProps, s as setProps, z as getColumnByName, c as KupLanguageGeneric, b as KupThemeIconValues, P as KupDebugCategory, X as KupPointerEventTypes, a4 as KupDragEffect, ah as kupDraggableAttr, a6 as KupDropEventTypes, Q as KupLanguageSearch, S as SortMode } from './kup-manager.js';
3
3
  import { D as filterRows, E as paginateRows, G as sortRows, H as pageChange, I as rowsPerPageChange, F as FImage, J as FCell, L as FChip, N as FTextFieldMDC, O as FPaginator, P as FPaginatorMode, c as componentWrapperId, d as defineCustomElement$1, a as defineCustomElement$2, b as defineCustomElement$3, e as defineCustomElement$4, f as defineCustomElement$5, g as defineCustomElement$6, h as defineCustomElement$7, i as defineCustomElement$8, j as defineCustomElement$9, k as defineCustomElement$a, l as defineCustomElement$b, m as defineCustomElement$c, n as defineCustomElement$d, o as defineCustomElement$e, p as defineCustomElement$f, q as defineCustomElement$g, r as defineCustomElement$h, s as defineCustomElement$i, t as defineCustomElement$j, u as defineCustomElement$k, v as defineCustomElement$l, w as defineCustomElement$m, x as defineCustomElement$n, y as defineCustomElement$o, z as defineCustomElement$p, A as defineCustomElement$q, B as defineCustomElement$r } from './kup-autocomplete2.js';
4
4
 
5
5
  /**
@@ -1091,7 +1091,7 @@ const KupBox = /*@__PURE__*/ proxyCustomElement(class KupBox extends HTMLElement
1091
1091
  if (!this.interactableDrop.includes(this.sectionRef)) {
1092
1092
  this.interactableDrop.push(this.sectionRef);
1093
1093
  this.kupManager.interact.dropzone(this.sectionRef, {
1094
- accept: `[${kupDraggableCellAttr}]`,
1094
+ accept: `[${kupDraggableAttr}]`,
1095
1095
  }, {
1096
1096
  dispatcher: this.rootElement,
1097
1097
  type: KupDropEventTypes.BOX,
@@ -1102,7 +1102,7 @@ const KupBox = /*@__PURE__*/ proxyCustomElement(class KupBox extends HTMLElement
1102
1102
  if (row && !this.interactableDrop.includes(row)) {
1103
1103
  this.interactableDrop.push(row);
1104
1104
  this.kupManager.interact.dropzone(row, {
1105
- accept: `[${kupDraggableCellAttr}]`,
1105
+ accept: `[${kupDraggableAttr}]`,
1106
1106
  }, {
1107
1107
  callback: dataCb,
1108
1108
  dispatcher: this.rootElement,
@@ -1,6 +1,6 @@
1
1
  import { proxyCustomElement, HTMLElement, createEvent, forceUpdate, h, Host } from '@stencil/core/internal/client';
2
2
  import { S as FButton, _ as FTextField, $ as FCheckbox, N as FTextFieldMDC, c as componentWrapperId, d as defineCustomElement$2, a as defineCustomElement$3, b as defineCustomElement$4, e as defineCustomElement$5, f as defineCustomElement$6, g as defineCustomElement$7, h as defineCustomElement$8, i as defineCustomElement$9, j as defineCustomElement$a, k as defineCustomElement$b, l as defineCustomElement$c, m as defineCustomElement$d, n as defineCustomElement$e, o as defineCustomElement$f, p as defineCustomElement$g, q as defineCustomElement$h, r as defineCustomElement$i, s as defineCustomElement$j, t as defineCustomElement$k, u as defineCustomElement$l, v as defineCustomElement$m, w as defineCustomElement$n, x as defineCustomElement$o, y as defineCustomElement$p, z as defineCustomElement$q, A as defineCustomElement$r, B as defineCustomElement$s } from './kup-autocomplete2.js';
3
- import { k as kupManagerInstance, g as getProps, s as setProps, ah as KupLanguageDashboard, c as KupLanguageGeneric, a4 as KupDragEffect, P as KupDebugCategory } from './kup-manager.js';
3
+ import { k as kupManagerInstance, g as getProps, s as setProps, ai as KupLanguageDashboard, c as KupLanguageGeneric, a4 as KupDragEffect, P as KupDebugCategory } from './kup-manager.js';
4
4
 
5
5
  /**
6
6
  * Props of the kup-dashboard component.
@@ -1,5 +1,5 @@
1
1
  import { proxyCustomElement, HTMLElement, forceUpdate, h, Host } from '@stencil/core/internal/client';
2
- import { k as kupManagerInstance, g as getProps, s as setProps, c as KupLanguageGeneric, P as KupDebugCategory, ai as kupDropEvent, a2 as kupDraggableColumnAttr, aj as kupDraggableRowAttr, a6 as KupDropEventTypes, a as KupThemeColorValues } from './kup-manager.js';
2
+ import { k as kupManagerInstance, g as getProps, s as setProps, c as KupLanguageGeneric, P as KupDebugCategory, aj as kupDropEvent, a2 as kupDraggableColumnAttr, ak as kupDraggableRowAttr, a6 as KupDropEventTypes, a as KupThemeColorValues } from './kup-manager.js';
3
3
  import { F as FImage, c as componentWrapperId, a4 as FButtonStyling, d as defineCustomElement$2, a as defineCustomElement$3, b as defineCustomElement$4, e as defineCustomElement$5, f as defineCustomElement$6, g as defineCustomElement$7, h as defineCustomElement$8, i as defineCustomElement$9, j as defineCustomElement$a, k as defineCustomElement$b, l as defineCustomElement$c, m as defineCustomElement$d, n as defineCustomElement$e, o as defineCustomElement$g, p as defineCustomElement$h, q as defineCustomElement$i, r as defineCustomElement$j, s as defineCustomElement$k, t as defineCustomElement$l, u as defineCustomElement$m, v as defineCustomElement$n, w as defineCustomElement$o, x as defineCustomElement$p, y as defineCustomElement$q, z as defineCustomElement$r, A as defineCustomElement$t, B as defineCustomElement$u } from './kup-autocomplete2.js';
4
4
  import { d as defineCustomElement$s } from './kup-box2.js';
5
5
  import { d as defineCustomElement$f } from './kup-echart2.js';