@sme.up/ketchup 11.0.0-SNAPSHOT-20241018133752 → 11.0.0-SNAPSHOT-20241021084132
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.
- package/dist/cjs/ketchup.cjs.js +1 -1
- package/dist/cjs/kup-cell.cjs.entry.js +48 -19
- package/dist/cjs/kup-cell.cjs.entry.js.map +1 -1
- package/dist/cjs/kup-input-panel.cjs.entry.js +23 -14
- package/dist/cjs/kup-input-panel.cjs.entry.js.map +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/kup-cell/kup-cell-declarations.js +7 -0
- package/dist/collection/components/kup-cell/kup-cell-declarations.js.map +1 -1
- package/dist/collection/components/kup-cell/kup-cell.js +107 -18
- package/dist/collection/components/kup-cell/kup-cell.js.map +1 -1
- package/dist/collection/components/kup-input-panel/kup-input-panel.js +23 -14
- package/dist/collection/components/kup-input-panel/kup-input-panel.js.map +1 -1
- package/dist/collection/f-components/f-cell-options.tsx/f-cell-options.js +0 -1
- package/dist/collection/f-components/f-cell-options.tsx/f-cell-options.js.map +1 -1
- package/dist/components/kup-cell.js +51 -20
- package/dist/components/kup-cell.js.map +1 -1
- package/dist/components/kup-input-panel.js +23 -14
- package/dist/components/kup-input-panel.js.map +1 -1
- package/dist/esm/ketchup.js +1 -1
- package/dist/esm/kup-cell.entry.js +49 -20
- package/dist/esm/kup-cell.entry.js.map +1 -1
- package/dist/esm/kup-input-panel.entry.js +23 -14
- package/dist/esm/kup-input-panel.entry.js.map +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/ketchup/ketchup.esm.js +1 -1
- package/dist/ketchup/ketchup.esm.js.map +1 -1
- package/dist/ketchup/p-3cf9525e.entry.js +2 -0
- package/dist/ketchup/p-3cf9525e.entry.js.map +1 -0
- package/dist/ketchup/p-3d0fe1a3.entry.js +2 -0
- package/dist/ketchup/p-3d0fe1a3.entry.js.map +1 -0
- package/dist/types/components/kup-cell/kup-cell-declarations.d.ts +11 -0
- package/dist/types/components/kup-cell/kup-cell.d.ts +11 -2
- package/dist/types/components.d.ts +34 -0
- package/package.json +1 -1
- package/dist/ketchup/p-8aa58b0f.entry.js +0 -2
- package/dist/ketchup/p-8aa58b0f.entry.js.map +0 -1
- package/dist/ketchup/p-f0f42ad4.entry.js +0 -2
- package/dist/ketchup/p-f0f42ad4.entry.js.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { h, proxyCustomElement, HTMLElement, forceUpdate, Host } from '@stencil/core/internal/client';
|
|
1
|
+
import { h, proxyCustomElement, HTMLElement, createEvent, forceUpdate, Host } from '@stencil/core/internal/client';
|
|
2
2
|
import { F as FCellTypes, i as FCellShapes, M as CMBandACPAdapter, R as RADAdapter, k as kupManagerInstance, q as FCellPadding, g as getProps, s as setProps$1, aa as KupDragEffect, d as KupLanguageGeneric } from './kup-manager.js';
|
|
3
|
-
import { J as FCell, 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 { J as FCell, c as componentWrapperId, R as FButton, 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';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Props of the kup-cell component.
|
|
@@ -13,6 +13,13 @@ var KupCellProps;
|
|
|
13
13
|
KupCellProps["density"] = "The density of the cell, defaults at 'dense' and can be also set to 'wide' or 'medium'.";
|
|
14
14
|
KupCellProps["dragEnabled"] = "When set to true, the component is draggable.";
|
|
15
15
|
})(KupCellProps || (KupCellProps = {}));
|
|
16
|
+
var KupCellSubmitButtonPosition;
|
|
17
|
+
(function (KupCellSubmitButtonPosition) {
|
|
18
|
+
KupCellSubmitButtonPosition["top"] = "column-reverse";
|
|
19
|
+
KupCellSubmitButtonPosition["bottom"] = "column";
|
|
20
|
+
KupCellSubmitButtonPosition["left"] = "row-reverse";
|
|
21
|
+
KupCellSubmitButtonPosition["right"] = "row";
|
|
22
|
+
})(KupCellSubmitButtonPosition || (KupCellSubmitButtonPosition = {}));
|
|
16
23
|
|
|
17
24
|
var __rest = (undefined && undefined.__rest) || function (s, e) {
|
|
18
25
|
var t = {};
|
|
@@ -96,7 +103,6 @@ const FCellOptions = (props) => {
|
|
|
96
103
|
label,
|
|
97
104
|
h(FCell, Object.assign({}, mappedProps))));
|
|
98
105
|
}
|
|
99
|
-
console.log('props', mappedProps);
|
|
100
106
|
return h(FCell, Object.assign({}, mappedProps));
|
|
101
107
|
};
|
|
102
108
|
const getLabelComponent = (cell, label) => {
|
|
@@ -214,26 +220,34 @@ const MainCMBandACPAdapter = (rawOptions, fieldLabel, currentValue) => {
|
|
|
214
220
|
const kupCellCss = ".kup-body-compact-01{font-family:var(--kup-font-family);font-size:var(--kup-body-compact-01-font-size, 14px);line-height:18px;font-weight:400;letter-spacing:0.16px}.kup-body-01{font-family:var(--kup-font-family);font-size:var(--kup-body-01-font-size, 14px);line-height:20px;font-weight:400;letter-spacing:0.16px}.kup-code-01{font-family:var(--kup-font-family-monospace);font-size:12px;line-height:16px;font-weight:400;letter-spacing:0.32px}.kup-label-01{font-family:var(--kup-font-family);font-size:12px;line-height:16px;font-weight:400;letter-spacing:0.32px}.kup-caption-02{font-family:var(--kup-font-family);font-size:12px;line-height:15px;font-weight:500;letter-spacing:1px}.kup-caption-01{font-family:var(--kup-font-family);font-size:10px;line-height:13px;font-weight:400;letter-spacing:1px}.kup-small-label-01{font-family:var(--kup-font-family);font-size:6px;line-height:9px;font-weight:400;letter-spacing:1px}.kup-heading-compact-01{font-family:var(--kup-font-family);font-size:14px;line-height:18px;font-weight:600;letter-spacing:0.16px}.kup-heading-01{font-family:var(--kup-font-family);font-size:14px;line-height:20px;font-weight:600;letter-spacing:0.16px}.kup-heading-02{font-family:var(--kup-font-family);font-size:16px;line-height:24px;font-weight:500;letter-spacing:0}.kup-heading-03{font-family:var(--kup-font-family);font-size:20px;line-height:28px;font-weight:400;letter-spacing:0}.kup-heading-04{font-family:var(--kup-font-family);font-size:28px;line-height:36px;font-weight:400;letter-spacing:0}.kup-heading-05{font-family:var(--kup-font-family);font-size:32px;line-height:40px;font-weight:300;letter-spacing:0}.kup-heading-06{font-family:var(--kup-font-family);font-size:42px;line-height:50px;font-weight:300;letter-spacing:0}.kup-heading-07{font-family:var(--kup-font-family);font-size:54px;line-height:64px;font-weight:300;letter-spacing:0}.kup-heading-08{font-family:var(--kup-font-family);font-size:54px;line-height:64px;font-weight:600;letter-spacing:0}:host{display:block;height:100%;width:100%}#kup-component{height:100%;width:100%}";
|
|
215
221
|
const KupCellStyle0 = kupCellCss;
|
|
216
222
|
|
|
223
|
+
var __classPrivateFieldGet = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
224
|
+
if (kind === "a" && !f)
|
|
225
|
+
throw new TypeError("Private accessor was defined without a getter");
|
|
226
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
|
227
|
+
throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
228
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
229
|
+
};
|
|
230
|
+
var _KupCell_kupManager;
|
|
217
231
|
const KupCell$1 = /*@__PURE__*/ proxyCustomElement(class KupCell extends HTMLElement {
|
|
218
232
|
constructor() {
|
|
219
233
|
super();
|
|
220
234
|
this.__registerHost();
|
|
221
235
|
this.__attachShadow();
|
|
236
|
+
this.kupCellSubmitClick = createEvent(this, "kup-cell-submit-click", 6);
|
|
222
237
|
/*-------------------------------------------------*/
|
|
223
238
|
/* I n t e r n a l V a r i a b l e s */
|
|
224
239
|
/*-------------------------------------------------*/
|
|
225
240
|
/**
|
|
226
241
|
* Instance of the KupManager class.
|
|
227
242
|
*/
|
|
228
|
-
this
|
|
243
|
+
_KupCell_kupManager.set(this, kupManagerInstance());
|
|
229
244
|
this.customStyle = '';
|
|
230
245
|
this.data = null;
|
|
231
246
|
this.density = FCellPadding.NONE;
|
|
232
247
|
this.dragEnabled = false;
|
|
248
|
+
this.showSubmit = false;
|
|
249
|
+
this.submitPosition = KupCellSubmitButtonPosition.right;
|
|
233
250
|
}
|
|
234
|
-
/*-------------------------------------------------*/
|
|
235
|
-
/* P u b l i c M e t h o d s */
|
|
236
|
-
/*-------------------------------------------------*/
|
|
237
251
|
/**
|
|
238
252
|
* Adds the given CSS classes to the cell's data.
|
|
239
253
|
* @param {string[]} classes - Array of CSS classes.
|
|
@@ -305,7 +319,7 @@ const KupCell$1 = /*@__PURE__*/ proxyCustomElement(class KupCell extends HTMLEle
|
|
|
305
319
|
row: this.generateRow(),
|
|
306
320
|
};
|
|
307
321
|
};
|
|
308
|
-
this.
|
|
322
|
+
__classPrivateFieldGet(this, _KupCell_kupManager, "f").interact.draggable(this.rootElement.shadowRoot.querySelector('#' + componentWrapperId), {
|
|
309
323
|
cursorChecker() {
|
|
310
324
|
return null;
|
|
311
325
|
},
|
|
@@ -320,7 +334,7 @@ const KupCell$1 = /*@__PURE__*/ proxyCustomElement(class KupCell extends HTMLEle
|
|
|
320
334
|
: 'KUPCELL';
|
|
321
335
|
const coltitle = this.data && this.data.obj && this.data.obj.t
|
|
322
336
|
? this.data.obj.t + ';' + this.data.obj.p
|
|
323
|
-
: this.
|
|
337
|
+
: __classPrivateFieldGet(this, _KupCell_kupManager, "f").language.translate(KupLanguageGeneric.EMPTY_OBJECT);
|
|
324
338
|
return {
|
|
325
339
|
name: colname,
|
|
326
340
|
title: coltitle,
|
|
@@ -332,24 +346,32 @@ const KupCell$1 = /*@__PURE__*/ proxyCustomElement(class KupCell extends HTMLEle
|
|
|
332
346
|
row.cells[col.name] = this.data;
|
|
333
347
|
return row;
|
|
334
348
|
}
|
|
349
|
+
submitClick(e) {
|
|
350
|
+
e.stopPropagation();
|
|
351
|
+
this.kupCellSubmitClick.emit({
|
|
352
|
+
comp: this,
|
|
353
|
+
id: this.rootElement.id,
|
|
354
|
+
cell: this.data,
|
|
355
|
+
});
|
|
356
|
+
}
|
|
335
357
|
/*-------------------------------------------------*/
|
|
336
358
|
/* L i f e c y c l e H o o k s */
|
|
337
359
|
/*-------------------------------------------------*/
|
|
338
360
|
componentWillLoad() {
|
|
339
|
-
this.
|
|
340
|
-
this.
|
|
341
|
-
this.
|
|
342
|
-
this.
|
|
361
|
+
__classPrivateFieldGet(this, _KupCell_kupManager, "f").dates.register(this);
|
|
362
|
+
__classPrivateFieldGet(this, _KupCell_kupManager, "f").debug.logLoad(this, false);
|
|
363
|
+
__classPrivateFieldGet(this, _KupCell_kupManager, "f").language.register(this);
|
|
364
|
+
__classPrivateFieldGet(this, _KupCell_kupManager, "f").theme.register(this);
|
|
343
365
|
}
|
|
344
366
|
componentDidLoad() {
|
|
345
|
-
this.
|
|
367
|
+
__classPrivateFieldGet(this, _KupCell_kupManager, "f").debug.logLoad(this, true);
|
|
346
368
|
}
|
|
347
369
|
componentWillRender() {
|
|
348
|
-
this.
|
|
370
|
+
__classPrivateFieldGet(this, _KupCell_kupManager, "f").debug.logRender(this, false);
|
|
349
371
|
}
|
|
350
372
|
componentDidRender() {
|
|
351
373
|
this.didRenderInteractables();
|
|
352
|
-
this.
|
|
374
|
+
__classPrivateFieldGet(this, _KupCell_kupManager, "f").debug.logRender(this, true);
|
|
353
375
|
}
|
|
354
376
|
render() {
|
|
355
377
|
const props = {
|
|
@@ -361,12 +383,18 @@ const KupCell$1 = /*@__PURE__*/ proxyCustomElement(class KupCell extends HTMLEle
|
|
|
361
383
|
renderKup: true,
|
|
362
384
|
row: this.generateRow(),
|
|
363
385
|
};
|
|
364
|
-
|
|
386
|
+
const sectionStyle = {
|
|
387
|
+
display: this.showSubmit ? 'flex' : 'block',
|
|
388
|
+
'flex-direction': this.showSubmit ? this.submitPosition : '',
|
|
389
|
+
};
|
|
390
|
+
return (h(Host, { key: 'cfbe1a2040680c7d317a64520325535769b38ece' }, h("style", { key: '93565e556d212451287d6fd107e2e9fc00300ad2' }, __classPrivateFieldGet(this, _KupCell_kupManager, "f").theme.setKupStyle(this.rootElement)), h("div", { key: 'e5d1552de2bceb74ee42c6f1cb50818a0eff6a81', id: componentWrapperId, style: sectionStyle }, h(FCellOptions, Object.assign({ key: 'd0113366ce9634824d34512a61e5c642c1427f0a' }, props)), this.showSubmit ? (h(FButton, { buttonType: "submit", label: __classPrivateFieldGet(this, _KupCell_kupManager, "f").language.translate(KupLanguageGeneric.CONFIRM), wrapperClass: "form__submit", onClick: (e) => {
|
|
391
|
+
this.submitClick(e);
|
|
392
|
+
} })) : null)));
|
|
365
393
|
}
|
|
366
394
|
disconnectedCallback() {
|
|
367
|
-
this.
|
|
368
|
-
this.
|
|
369
|
-
this.
|
|
395
|
+
__classPrivateFieldGet(this, _KupCell_kupManager, "f").dates.unregister(this);
|
|
396
|
+
__classPrivateFieldGet(this, _KupCell_kupManager, "f").language.unregister(this);
|
|
397
|
+
__classPrivateFieldGet(this, _KupCell_kupManager, "f").theme.unregister(this);
|
|
370
398
|
}
|
|
371
399
|
get rootElement() { return this; }
|
|
372
400
|
static get style() { return KupCellStyle0; }
|
|
@@ -375,12 +403,15 @@ const KupCell$1 = /*@__PURE__*/ proxyCustomElement(class KupCell extends HTMLEle
|
|
|
375
403
|
"data": [16],
|
|
376
404
|
"density": [1],
|
|
377
405
|
"dragEnabled": [4, "drag-enabled"],
|
|
406
|
+
"showSubmit": [4, "show-submit"],
|
|
407
|
+
"submitPosition": [1, "submit-position"],
|
|
378
408
|
"addCssClasses": [64],
|
|
379
409
|
"getProps": [64],
|
|
380
410
|
"refresh": [64],
|
|
381
411
|
"removeCssClasses": [64],
|
|
382
412
|
"setProps": [64]
|
|
383
413
|
}]);
|
|
414
|
+
_KupCell_kupManager = new WeakMap();
|
|
384
415
|
function defineCustomElement$1() {
|
|
385
416
|
if (typeof customElements === "undefined") {
|
|
386
417
|
return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"kup-cell.js","mappings":";;;;AAAA;;;;AAIA,IAAY,YAKX;AALD,WAAY,YAAY;IACpB,8DAA8C,CAAA;IAC9C,8CAA8B,CAAA;IAC9B,mHAAmG,CAAA;IACnG,6EAA6D,CAAA;AACjE,CAAC,EALW,YAAY,KAAZ,YAAY;;;;;;;;;;;;;ACiBxB,MAAM,GAAG,GAAW,QAAQ,CAAC,eAAyB,CAAC;AAEvD,MAAM,sBAAsB,GAAG,CAC3B,OAAY,EACZ,YAAoB;IAEpB,OAAO,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,KAAK;;QAAK,QAAC;YACpC,EAAE,EAAE,KAAK,CAAC,OAAO,CAAC,MAAM;YACxB,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,KAAK;YAC1B,QAAQ,EAAE,YAAY,KAAK,KAAK,CAAC,OAAO,CAAC,MAAM;YAC/C,QAAQ,EAAE,CAAA,MAAA,KAAK,CAAC,QAAQ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,UAAU,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;QACvC,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;QAC1C,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;KAC1C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["this","KupCell","setProps"],"sources":["src/components/kup-cell/kup-cell-declarations.ts","src/f-components/f-cell-options.tsx/f-cell-options.tsx","src/components/kup-cell/kup-cell.scss?tag=kup-cell&encapsulation=shadow","src/components/kup-cell/kup-cell.tsx"],"sourcesContent":["/**\n * Props of the kup-cell component.\n * Used to export every prop in an object.\n */\nexport enum KupCellProps {\n customStyle = 'Custom style of the component.',\n data = 'The data of the cell.',\n density = \"The density of the cell, defaults at 'dense' and can be also set to 'wide' or 'medium'.\",\n dragEnabled = 'When set to true, the component is draggable.',\n}\n","import { FunctionalComponent, h, VNode } from '@stencil/core';\nimport { KupDom } from '../../managers/kup-manager/kup-manager-declarations';\nimport { GenericObject, KupDataColumn } from '../../components';\nimport { CMBandACPAdapter, RADAdapter } from '../../utils/cell-utils';\nimport {\n FCellOptionsProps,\n FCellProps,\n FCellShapes,\n FCellTypes,\n} from '../f-cell/f-cell-declarations';\nimport {\n DataAdapterFn,\n KupInputPanelCell,\n} from '../../components/kup-input-panel/kup-input-panel-declarations';\nimport {\n KupDataCell,\n KupDataCellOptions,\n KupDataRow,\n} from '../../managers/kup-data/kup-data-declarations';\nimport { FCell } from '../f-cell/f-cell';\n\nconst dom: KupDom = document.documentElement as KupDom;\n\nconst treeOptionsNodeAdapter = (\n options: any,\n currentValue: string\n): GenericObject[] => {\n return options.children.map((child) => ({\n id: child.content.codice,\n value: child.content.testo,\n selected: currentValue === child.content.codice,\n children: child.children?.length\n ? treeOptionsNodeAdapter(child, currentValue)\n : [],\n }));\n};\n\nconst dataTreeOptionsChildrenAdapter = (\n options: any,\n currentValue: string\n): GenericObject[] => {\n return options.children.map((child) => ({\n id: child.obj.k,\n value: child.value,\n selected: currentValue === child.obj.k,\n children: child.children?.length\n ? dataTreeOptionsChildrenAdapter(child, currentValue)\n : [],\n }));\n};\n\nconst tableOptionsAdapter = (\n options: any,\n currentValue: string\n): GenericObject[] => {\n return options.rows.map((row) => {\n const cells = row.fields || row.cells;\n const [id, value] = Object.keys(cells);\n\n return {\n id: cells[id].value,\n value: cells[value]?.value || cells[id].value,\n selected: currentValue === cells[id].value,\n };\n });\n};\n\nconst optionsTreeComboAdapter = (options: any, currentValue: string) => {\n const adapter = optionsAdapterMap.get(options.type);\n\n if (adapter) {\n return adapter(options, currentValue);\n } else {\n return options.map((option) => ({\n value: option.label,\n id: option.id,\n selected: currentValue === option.id,\n }));\n }\n};\n\nconst optionsAdapterMap = new Map<\n string,\n (options: any, currentValue: string) => GenericObject[]\n>([\n ['SmeupTreeNode', treeOptionsNodeAdapter.bind(this)],\n ['SmeupDataTree', dataTreeOptionsChildrenAdapter.bind(this)],\n ['SmeupTable', tableOptionsAdapter.bind(this)],\n ['SmeupDataTable', tableOptionsAdapter.bind(this)],\n]);\n\nexport const FCellOptions: FunctionalComponent<FCellOptionsProps> = (\n props: FCellOptionsProps\n) => {\n const mappedCell = props.cell\n ? {\n ...props.cell,\n data: setProps(props.cell, props.column),\n slotData: slotData(props.cell, props.column),\n isEditable: true,\n }\n : null;\n\n const mappedProps: FCellProps = {\n ...props,\n editable: true,\n cell: mappedCell as KupDataCell,\n column: generateColumn(mappedCell.data),\n row: generateRow(mappedCell.data),\n };\n\n if (props.cell.shape === FCellShapes.TEXT_FIELD) {\n mappedProps.cell.value = mappedProps.cell.data.value;\n }\n\n const label = getLabelComponent(mappedProps.cell, mappedProps.column.title);\n\n if (label) {\n return (\n <div class={{ 'input-panel__label_container': true }}>\n {label}\n <FCell {...mappedProps} />\n </div>\n );\n }\n console.log('props', mappedProps);\n return <FCell {...mappedProps}></FCell>;\n};\n\nconst getLabelComponent = (cell: KupDataCell, label: string) => {\n if (!label) {\n return null;\n }\n\n const cellType = dom.ketchup.data.cell.getType(cell, cell.shape);\n\n if (cellType === FCellTypes.RADIO) {\n return <span>{label}</span>;\n }\n\n return null;\n};\n\nconst generateColumn = (data: GenericObject): KupDataColumn => {\n const colname: string =\n data && data.obj && data.obj.t\n ? data.obj.t + ';' + data.obj.p\n : 'KUPCELL';\n const coltitle: string =\n data && data.obj && data.obj.t\n ? data.obj.t + ';' + data.obj.p\n : 'genericEmptyObject';\n return {\n name: colname,\n title: coltitle,\n };\n};\n\nconst generateRow = (data: GenericObject): KupDataRow => {\n const col: KupDataColumn = generateColumn(data);\n const row: KupDataRow = { cells: {} };\n row.cells[col.name] = data.cell;\n return row;\n};\n\nconst slotData = (cell: KupDataCellOptions, col: KupDataColumn) => {\n const cellType = dom.ketchup.data.cell.getType(cell, cell.shape);\n\n if (!cell.isEditable) {\n return null;\n }\n\n if (\n cellType === FCellTypes.MULTI_AUTOCOMPLETE ||\n cellType === FCellTypes.MULTI_COMBOBOX\n ) {\n return {\n ...CMBandACPAdapter(\n null,\n col.title,\n cell.options\n // cell,\n // col.name\n ),\n showDropDownIcon: true,\n class: '',\n style: { width: '100%' },\n disabled: !cell.isEditable,\n id: col.name,\n };\n }\n\n return null;\n};\n\nconst setProps = (cell: KupDataCellOptions, column: KupDataColumn) => {\n const defaultProps = {\n ...mapData(cell, column),\n disabled: !cell.isEditable,\n id: column.name,\n };\n\n const cellType = dom.ketchup.data.cell.getType(cell, cell.shape);\n const { data, ...noDataProps } = cell.data || {};\n return cellType !== FCellTypes.MULTI_AUTOCOMPLETE &&\n cellType !== FCellTypes.MULTI_COMBOBOX\n ? deepObjectsMerge(defaultProps, {\n ...cell.data,\n })\n : // Add and ovverride defaultProps of Chip host component except data\n {\n ...defaultProps,\n ...noDataProps,\n };\n};\n\nconst deepObjectsMerge = (target: GenericObject, source: GenericObject) => {\n for (const key in source) {\n if (\n source[key] instanceof Object &&\n !Array.isArray(source[key]) &&\n key in target\n ) {\n target[key] = deepObjectsMerge(target[key], source[key]);\n } else {\n target[key] = source[key];\n }\n }\n return target;\n};\n\nconst mapData = (cell: KupDataCellOptions, col: KupDataColumn) => {\n if (!cell) {\n return null;\n }\n\n const options = cell.options;\n const fieldLabel = col.title;\n const currentValue = cell.value;\n const cellType = dom.ketchup.data.cell.getType(cell, cell.shape);\n const dataAdapterMap = new Map<FCellTypes, DataAdapterFn>([\n [FCellTypes.BUTTON_LIST, MainBTNAdapter.bind(this)],\n [FCellTypes.STRING, MainITXAdapter.bind(this)],\n [FCellTypes.RADIO, MainRADAdapter.bind(this)],\n [FCellTypes.AUTOCOMPLETE, MainCMBandACPAdapter.bind(this)],\n [FCellTypes.COMBOBOX, MainCMBandACPAdapter.bind(this)],\n ]);\n\n const adapter = dataAdapterMap.get(cellType);\n\n return adapter\n ? adapter(options, fieldLabel, currentValue, cell, col.name)\n : null;\n};\n\nconst MainRADAdapter = (\n options: GenericObject,\n _fieldLabel: string,\n currentValue: string\n) => {\n return RADAdapter(currentValue, options);\n};\n\nconst MainITXAdapter = (\n options: GenericObject,\n _fieldLabel: string,\n _currentValue: string,\n _cell: KupDataCellOptions\n) => {\n if (options?.[0]) {\n return {\n value: options[0].label,\n };\n }\n};\n\nconst MainBTNAdapter = (\n _options: GenericObject,\n _fieldLabel: string,\n _currentValue: string,\n cell: KupDataCellOptions\n) => {\n return {\n data: cell.options?.length\n ? cell.options?.map((option) => ({\n icon: option.icon,\n value: option.value,\n }))\n : [],\n };\n};\n\nconst MainCMBandACPAdapter = (\n rawOptions: GenericObject,\n fieldLabel: string,\n currentValue: string\n) => {\n const configCMandACP = CMBandACPAdapter(currentValue, fieldLabel, []);\n\n configCMandACP.data['kup-list'].data = optionsTreeComboAdapter(\n rawOptions,\n currentValue\n );\n return configCMandACP;\n};\n","/**\n* @prop --kup-cell-background: Sets the background of the cell.\n* @prop --kup-cell-font-family: Sets the font family of the cell.\n* @prop --kup-cell-font-family-monospace: Sets the monospace font family of the cell (for numbers).\n* @prop --kup-cell-font-size: Sets the font size of the cell.\n* @prop --kup-cell-text-color: Sets the text color of the cell.\n*\n* NOTE: These variables are defined in the \"kup-theme.css\" file, because they must work even without the kup component (it's a functional component)\n*\n*/\n\n:host {\n display: block;\n height: 100%;\n width: 100%;\n}\n\n#kup-component {\n height: 100%;\n width: 100%;\n}\n","import {\n Component,\n Element,\n forceUpdate,\n h,\n Host,\n Method,\n Prop,\n} from '@stencil/core';\nimport {\n KupManager,\n kupManagerInstance,\n} from '../../managers/kup-manager/kup-manager';\nimport { GenericObject, KupComponent } from '../../types/GenericTypes';\nimport { getProps, setProps } from '../../utils/utils';\nimport { componentWrapperId } from '../../variables/GenericVariables';\nimport { KupCellProps } from './kup-cell-declarations';\nimport { FCell } from '../../f-components/f-cell/f-cell';\nimport {\n FCellOptionsProps,\n FCellPadding,\n FCellProps,\n} from '../../f-components/f-cell/f-cell-declarations';\nimport {\n KupDragDataTransferCallback,\n KupDragEffect,\n} from '../../managers/kup-interact/kup-interact-declarations';\nimport { KupLanguageGeneric } from '../../managers/kup-language/kup-language-declarations';\nimport {\n KupDataCell,\n KupDataCellOptions,\n KupDataColumn,\n KupDataRow,\n} from '../../managers/kup-data/kup-data-declarations';\nimport { FCellOptions } from '../../f-components/f-cell-options.tsx/f-cell-options';\n\n@Component({\n tag: 'kup-cell',\n styleUrl: 'kup-cell.scss',\n shadow: true,\n})\nexport class KupCell {\n /**\n * References the root HTML element of the component (<kup-text-field>).\n */\n @Element() rootElement: HTMLElement;\n\n /*-------------------------------------------------*/\n /* P r o p s */\n /*-------------------------------------------------*/\n\n /**\n * Custom style of the component.\n * @default \"\"\n * @see https://smeup.github.io/ketchup/#/customization\n */\n @Prop() customStyle: string = '';\n /**\n * The data of the cell.\n * @default false\n */\n @Prop() data: KupDataCell = null;\n /**\n * The density of the cell, defaults at 'dense' and can be also set to 'wide' or 'medium'.\n */\n @Prop() density: FCellPadding = FCellPadding.NONE;\n /**\n * When set to true, the component is draggable.\n * @default false\n */\n @Prop() dragEnabled: boolean = false;\n\n /*-------------------------------------------------*/\n /* I n t e r n a l V a r i a b l e s */\n /*-------------------------------------------------*/\n\n /**\n * Instance of the KupManager class.\n */\n private kupManager: KupManager = kupManagerInstance();\n\n /*-------------------------------------------------*/\n /* P u b l i c M e t h o d s */\n /*-------------------------------------------------*/\n\n /**\n * Adds the given CSS classes to the cell's data.\n * @param {string[]} classes - Array of CSS classes.\n */\n @Method()\n async addCssClasses(classes?: string[]): Promise<void> {\n if (!this.data.cssClass) {\n this.data.cssClass = '';\n }\n if (classes) {\n for (let index = 0; index < classes.length; index++) {\n const cssClass = classes[index];\n if (this.data.cssClass.indexOf(cssClass) < 0) {\n this.data.cssClass += ` ${cssClass}`;\n }\n }\n }\n this.refresh();\n }\n /**\n * Used to retrieve component's props values.\n * @param {boolean} descriptions - When provided and true, the result will be the list of props with their description.\n * @returns {Promise<GenericObject>} List of props as object, each key will be a prop.\n */\n @Method()\n async getProps(descriptions?: boolean): Promise<GenericObject> {\n return getProps(this, KupCellProps, descriptions);\n }\n /**\n * This method is used to trigger a new render of the component.\n */\n @Method()\n async refresh(): Promise<void> {\n forceUpdate(this);\n }\n /**\n * Removes the given CSS classes from the cell's data.\n * @param {string[]} classes - Array of CSS classes.\n */\n @Method()\n async removeCssClasses(classes?: string[]): Promise<void> {\n if (!this.data.cssClass) {\n return;\n }\n if (classes) {\n for (let index = 0; index < classes.length; index++) {\n const cssClass = classes[index];\n if (this.data.cssClass.indexOf(cssClass) > 0) {\n this.data.cssClass = this.data.cssClass.replace(\n new RegExp(cssClass, 'g'),\n ''\n );\n }\n }\n }\n this.refresh();\n }\n /**\n * Sets the props to the component.\n * @param {GenericObject} props - Object containing props that will be set to the component.\n */\n @Method()\n async setProps(props: GenericObject): Promise<void> {\n setProps(this, KupCellProps, props);\n }\n\n /*-------------------------------------------------*/\n /* P r i v a t e M e t h o d s */\n /*-------------------------------------------------*/\n\n private didRenderInteractables() {\n if (this.dragEnabled) {\n const dataCb: KupDragDataTransferCallback = () => {\n return {\n cell: this.data,\n column: this.generateColumn(),\n id: this.rootElement.id,\n multiple: false,\n row: this.generateRow(),\n };\n };\n\n this.kupManager.interact.draggable(\n this.rootElement.shadowRoot.querySelector(\n '#' + componentWrapperId\n ),\n {\n cursorChecker() {\n return null;\n },\n },\n {\n callback: dataCb,\n },\n KupDragEffect.BADGE\n );\n }\n }\n\n private generateColumn(): KupDataColumn {\n const colname: string =\n this.data && this.data.obj && this.data.obj.t\n ? this.data.obj.t + ';' + this.data.obj.p\n : 'KUPCELL';\n const coltitle: string =\n this.data && this.data.obj && this.data.obj.t\n ? this.data.obj.t + ';' + this.data.obj.p\n : this.kupManager.language.translate(\n KupLanguageGeneric.EMPTY_OBJECT\n );\n return {\n name: colname,\n title: coltitle,\n };\n }\n\n private generateRow(): KupDataRow {\n const col: KupDataColumn = this.generateColumn();\n const row: KupDataRow = { cells: {} };\n row.cells[col.name] = this.data;\n return row;\n }\n\n /*-------------------------------------------------*/\n /* L i f e c y c l e H o o k s */\n /*-------------------------------------------------*/\n\n componentWillLoad() {\n this.kupManager.dates.register(this);\n this.kupManager.debug.logLoad(this, false);\n this.kupManager.language.register(this);\n this.kupManager.theme.register(this);\n }\n\n componentDidLoad() {\n this.kupManager.debug.logLoad(this, true);\n }\n\n componentWillRender() {\n this.kupManager.debug.logRender(this, false);\n }\n\n componentDidRender() {\n this.didRenderInteractables();\n this.kupManager.debug.logRender(this, true);\n }\n\n render() {\n const props: FCellOptionsProps = {\n cell: this.data as KupDataCellOptions,\n column: this.generateColumn(),\n component: this,\n density: this.density,\n editable: this.data.isEditable,\n renderKup: true,\n row: this.generateRow(),\n };\n return (\n <Host>\n <style>\n {this.kupManager.theme.setKupStyle(\n this.rootElement as KupComponent\n )}\n </style>\n <div id={componentWrapperId}>\n <FCellOptions {...props}></FCellOptions>\n </div>\n </Host>\n );\n }\n\n disconnectedCallback() {\n this.kupManager.dates.unregister(this);\n this.kupManager.language.unregister(this);\n this.kupManager.theme.unregister(this);\n }\n}\n"],"version":3}
|
|
1
|
+
{"file":"kup-cell.js","mappings":";;;;AAGA;;;;AAIA,IAAY,YAKX;AALD,WAAY,YAAY;IACpB,8DAA8C,CAAA;IAC9C,8CAA8B,CAAA;IAC9B,mHAAmG,CAAA;IACnG,6EAA6D,CAAA;AACjE,CAAC,EALW,YAAY,KAAZ,YAAY,QAKvB;AAED,IAAY,2BAKX;AALD,WAAY,2BAA2B;IACnC,qDAAsB,CAAA;IACtB,gDAAiB,CAAA;IACjB,mDAAoB,CAAA;IACpB,4CAAa,CAAA;AACjB,CAAC,EALW,2BAA2B,KAA3B,2BAA2B;;;;;;;;;;;;;ACOvC,MAAM,GAAG,GAAW,QAAQ,CAAC,eAAyB,CAAC;AAEvD,MAAM,sBAAsB,GAAG,CAC3B,OAAY,EACZ,YAAoB;IAEpB,OAAO,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,KAAK;;QAAK,QAAC;YACpC,EAAE,EAAE,KAAK,CAAC,OAAO,CAAC,MAAM;YACxB,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,KAAK;YAC1B,QAAQ,EAAE,YAAY,KAAK,KAAK,CAAC,OAAO,CAAC,MAAM;YAC/C,QAAQ,EAAE,CAAA,MAAA,KAAK,CAAC,QAAQ,0CAAE,MAAM;kBAC1B,sBAAsB,CAAC,KAAK,EAAE,YAAY,CAAC;kBAC3C,EAAE;SACX,EAAC;KAAA,CAAC,CAAC;AACR,CAAC,CAAC;AAEF,MAAM,8BAA8B,GAAG,CACnC,OAAY,EACZ,YAAoB;IAEpB,OAAO,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,KAAK;;QAAK,QAAC;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CAAC,WAAW,CAC/B,IAAI,CAAC,WAA2B,CACnC,CACG,EACR,4DAAK,EAAE,EAAE,kBAAkB,EAAE,KAAK,EAAE,YAAY,IAC5C,EAAC,YAAY,qEAAK,KAAK,EAAiB,EACvC,IAAI,CAAC,UAAU,IACZ,EAAC,OAAO,IACJ,UAAU,EAAC,QAAQ,EACnB,KAAK,EAAE,uBAAA,IAAI,2BAAY,CAAC,QAAQ,CAAC,SAAS,CACtC,kBAAkB,CAAC,OAAO,CAC7B,EACD,YAAY,EAAC,cAAc,EAC3B,OAAO,EAAE,CAAC,CAAC;gBACP,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;aACvB,GACM,IACX,IAAI,CACN,CACH,EACT;KACL;IAED,oBAAoB;QAChB,uBAAA,IAAI,2BAAY,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;QACxC,uBAAA,IAAI,2BAAY,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;QAC3C,uBAAA,IAAI,2BAAY,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;KAC3C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["this","KupCell","setProps"],"sources":["src/components/kup-cell/kup-cell-declarations.ts","src/f-components/f-cell-options.tsx/f-cell-options.tsx","src/components/kup-cell/kup-cell.scss?tag=kup-cell&encapsulation=shadow","src/components/kup-cell/kup-cell.tsx"],"sourcesContent":["import { KupDataCell, KupEventPayload } from '../../components';\nimport { KupDataCellOptions } from '../../managers/kup-data/kup-data-declarations';\n\n/**\n * Props of the kup-cell component.\n * Used to export every prop in an object.\n */\nexport enum KupCellProps {\n customStyle = 'Custom style of the component.',\n data = 'The data of the cell.',\n density = \"The density of the cell, defaults at 'dense' and can be also set to 'wide' or 'medium'.\",\n dragEnabled = 'When set to true, the component is draggable.',\n}\n\nexport enum KupCellSubmitButtonPosition {\n top = 'column-reverse',\n bottom = 'column',\n left = 'row-reverse',\n right = 'row',\n}\n\nexport interface KupCellSubmitClickEventPayload extends KupEventPayload {\n cell: KupDataCellOptions;\n}\n","import { FunctionalComponent, h, VNode } from '@stencil/core';\nimport { KupDom } from '../../managers/kup-manager/kup-manager-declarations';\nimport { GenericObject, KupDataColumn } from '../../components';\nimport { CMBandACPAdapter, RADAdapter } from '../../utils/cell-utils';\nimport {\n FCellOptionsProps,\n FCellProps,\n FCellShapes,\n FCellTypes,\n} from '../f-cell/f-cell-declarations';\nimport {\n DataAdapterFn,\n KupInputPanelCell,\n} from '../../components/kup-input-panel/kup-input-panel-declarations';\nimport {\n KupDataCell,\n KupDataCellOptions,\n KupDataRow,\n} from '../../managers/kup-data/kup-data-declarations';\nimport { FCell } from '../f-cell/f-cell';\n\nconst dom: KupDom = document.documentElement as KupDom;\n\nconst treeOptionsNodeAdapter = (\n options: any,\n currentValue: string\n): GenericObject[] => {\n return options.children.map((child) => ({\n id: child.content.codice,\n value: child.content.testo,\n selected: currentValue === child.content.codice,\n children: child.children?.length\n ? treeOptionsNodeAdapter(child, currentValue)\n : [],\n }));\n};\n\nconst dataTreeOptionsChildrenAdapter = (\n options: any,\n currentValue: string\n): GenericObject[] => {\n return options.children.map((child) => ({\n id: child.obj.k,\n value: child.value,\n selected: currentValue === child.obj.k,\n children: child.children?.length\n ? dataTreeOptionsChildrenAdapter(child, currentValue)\n : [],\n }));\n};\n\nconst tableOptionsAdapter = (\n options: any,\n currentValue: string\n): GenericObject[] => {\n return options.rows.map((row) => {\n const cells = row.fields || row.cells;\n const [id, value] = Object.keys(cells);\n\n return {\n id: cells[id].value,\n value: cells[value]?.value || cells[id].value,\n selected: currentValue === cells[id].value,\n };\n });\n};\n\nconst optionsTreeComboAdapter = (options: any, currentValue: string) => {\n const adapter = optionsAdapterMap.get(options.type);\n\n if (adapter) {\n return adapter(options, currentValue);\n } else {\n return options.map((option) => ({\n value: option.label,\n id: option.id,\n selected: currentValue === option.id,\n }));\n }\n};\n\nconst optionsAdapterMap = new Map<\n string,\n (options: any, currentValue: string) => GenericObject[]\n>([\n ['SmeupTreeNode', treeOptionsNodeAdapter.bind(this)],\n ['SmeupDataTree', dataTreeOptionsChildrenAdapter.bind(this)],\n ['SmeupTable', tableOptionsAdapter.bind(this)],\n ['SmeupDataTable', tableOptionsAdapter.bind(this)],\n]);\n\nexport const FCellOptions: FunctionalComponent<FCellOptionsProps> = (\n props: FCellOptionsProps\n) => {\n const mappedCell = props.cell\n ? {\n ...props.cell,\n data: setProps(props.cell, props.column),\n slotData: slotData(props.cell, props.column),\n isEditable: true,\n }\n : null;\n\n const mappedProps: FCellProps = {\n ...props,\n editable: true,\n cell: mappedCell as KupDataCell,\n column: generateColumn(mappedCell.data),\n row: generateRow(mappedCell.data),\n };\n\n if (props.cell.shape === FCellShapes.TEXT_FIELD) {\n mappedProps.cell.value = mappedProps.cell.data.value;\n }\n\n const label = getLabelComponent(mappedProps.cell, mappedProps.column.title);\n\n if (label) {\n return (\n <div class={{ 'input-panel__label_container': true }}>\n {label}\n <FCell {...mappedProps} />\n </div>\n );\n }\n return <FCell {...mappedProps}></FCell>;\n};\n\nconst getLabelComponent = (cell: KupDataCell, label: string) => {\n if (!label) {\n return null;\n }\n\n const cellType = dom.ketchup.data.cell.getType(cell, cell.shape);\n\n if (cellType === FCellTypes.RADIO) {\n return <span>{label}</span>;\n }\n\n return null;\n};\n\nconst generateColumn = (data: GenericObject): KupDataColumn => {\n const colname: string =\n data && data.obj && data.obj.t\n ? data.obj.t + ';' + data.obj.p\n : 'KUPCELL';\n const coltitle: string =\n data && data.obj && data.obj.t\n ? data.obj.t + ';' + data.obj.p\n : 'genericEmptyObject';\n return {\n name: colname,\n title: coltitle,\n };\n};\n\nconst generateRow = (data: GenericObject): KupDataRow => {\n const col: KupDataColumn = generateColumn(data);\n const row: KupDataRow = { cells: {} };\n row.cells[col.name] = data.cell;\n return row;\n};\n\nconst slotData = (cell: KupDataCellOptions, col: KupDataColumn) => {\n const cellType = dom.ketchup.data.cell.getType(cell, cell.shape);\n\n if (!cell.isEditable) {\n return null;\n }\n\n if (\n cellType === FCellTypes.MULTI_AUTOCOMPLETE ||\n cellType === FCellTypes.MULTI_COMBOBOX\n ) {\n return {\n ...CMBandACPAdapter(\n null,\n col.title,\n cell.options\n // cell,\n // col.name\n ),\n showDropDownIcon: true,\n class: '',\n style: { width: '100%' },\n disabled: !cell.isEditable,\n id: col.name,\n };\n }\n\n return null;\n};\n\nconst setProps = (cell: KupDataCellOptions, column: KupDataColumn) => {\n const defaultProps = {\n ...mapData(cell, column),\n disabled: !cell.isEditable,\n id: column.name,\n };\n\n const cellType = dom.ketchup.data.cell.getType(cell, cell.shape);\n const { data, ...noDataProps } = cell.data || {};\n return cellType !== FCellTypes.MULTI_AUTOCOMPLETE &&\n cellType !== FCellTypes.MULTI_COMBOBOX\n ? deepObjectsMerge(defaultProps, {\n ...cell.data,\n })\n : // Add and ovverride defaultProps of Chip host component except data\n {\n ...defaultProps,\n ...noDataProps,\n };\n};\n\nconst deepObjectsMerge = (target: GenericObject, source: GenericObject) => {\n for (const key in source) {\n if (\n source[key] instanceof Object &&\n !Array.isArray(source[key]) &&\n key in target\n ) {\n target[key] = deepObjectsMerge(target[key], source[key]);\n } else {\n target[key] = source[key];\n }\n }\n return target;\n};\n\nconst mapData = (cell: KupDataCellOptions, col: KupDataColumn) => {\n if (!cell) {\n return null;\n }\n\n const options = cell.options;\n const fieldLabel = col.title;\n const currentValue = cell.value;\n const cellType = dom.ketchup.data.cell.getType(cell, cell.shape);\n const dataAdapterMap = new Map<FCellTypes, DataAdapterFn>([\n [FCellTypes.BUTTON_LIST, MainBTNAdapter.bind(this)],\n [FCellTypes.STRING, MainITXAdapter.bind(this)],\n [FCellTypes.RADIO, MainRADAdapter.bind(this)],\n [FCellTypes.AUTOCOMPLETE, MainCMBandACPAdapter.bind(this)],\n [FCellTypes.COMBOBOX, MainCMBandACPAdapter.bind(this)],\n ]);\n\n const adapter = dataAdapterMap.get(cellType);\n\n return adapter\n ? adapter(options, fieldLabel, currentValue, cell, col.name)\n : null;\n};\n\nconst MainRADAdapter = (\n options: GenericObject,\n _fieldLabel: string,\n currentValue: string\n) => {\n return RADAdapter(currentValue, options);\n};\n\nconst MainITXAdapter = (\n options: GenericObject,\n _fieldLabel: string,\n _currentValue: string,\n _cell: KupDataCellOptions\n) => {\n if (options?.[0]) {\n return {\n value: options[0].label,\n };\n }\n};\n\nconst MainBTNAdapter = (\n _options: GenericObject,\n _fieldLabel: string,\n _currentValue: string,\n cell: KupDataCellOptions\n) => {\n return {\n data: cell.options?.length\n ? cell.options?.map((option) => ({\n icon: option.icon,\n value: option.value,\n }))\n : [],\n };\n};\n\nconst MainCMBandACPAdapter = (\n rawOptions: GenericObject,\n fieldLabel: string,\n currentValue: string\n) => {\n const configCMandACP = CMBandACPAdapter(currentValue, fieldLabel, []);\n\n configCMandACP.data['kup-list'].data = optionsTreeComboAdapter(\n rawOptions,\n currentValue\n );\n return configCMandACP;\n};\n","/**\n* @prop --kup-cell-background: Sets the background of the cell.\n* @prop --kup-cell-font-family: Sets the font family of the cell.\n* @prop --kup-cell-font-family-monospace: Sets the monospace font family of the cell (for numbers).\n* @prop --kup-cell-font-size: Sets the font size of the cell.\n* @prop --kup-cell-text-color: Sets the text color of the cell.\n*\n* NOTE: These variables are defined in the \"kup-theme.css\" file, because they must work even without the kup component (it's a functional component)\n*\n*/\n\n:host {\n display: block;\n height: 100%;\n width: 100%;\n}\n\n#kup-component {\n height: 100%;\n width: 100%;\n}\n","import {\n Component,\n Element,\n forceUpdate,\n h,\n Host,\n Event,\n EventEmitter,\n Method,\n Prop,\n} from '@stencil/core';\nimport {\n KupManager,\n kupManagerInstance,\n} from '../../managers/kup-manager/kup-manager';\nimport { GenericObject, KupComponent } from '../../types/GenericTypes';\nimport { getProps, setProps } from '../../utils/utils';\nimport { componentWrapperId } from '../../variables/GenericVariables';\nimport {\n KupCellProps,\n KupCellSubmitButtonPosition,\n KupCellSubmitClickEventPayload,\n} from './kup-cell-declarations';\nimport { FCell } from '../../f-components/f-cell/f-cell';\nimport {\n FCellOptionsProps,\n FCellPadding,\n FCellProps,\n} from '../../f-components/f-cell/f-cell-declarations';\nimport {\n KupDragDataTransferCallback,\n KupDragEffect,\n} from '../../managers/kup-interact/kup-interact-declarations';\nimport { KupLanguageGeneric } from '../../managers/kup-language/kup-language-declarations';\nimport {\n KupDataCell,\n KupDataCellOptions,\n KupDataColumn,\n KupDataRow,\n} from '../../managers/kup-data/kup-data-declarations';\nimport { FCellOptions } from '../../f-components/f-cell-options.tsx/f-cell-options';\nimport { FButton } from '../../f-components/f-button/f-button';\n\n@Component({\n tag: 'kup-cell',\n styleUrl: 'kup-cell.scss',\n shadow: true,\n})\nexport class KupCell {\n /**\n * References the root HTML element of the component (<kup-text-field>).\n */\n @Element() rootElement: HTMLElement;\n\n /*-------------------------------------------------*/\n /* P r o p s */\n /*-------------------------------------------------*/\n\n /**\n * Custom style of the component.\n * @default \"\"\n * @see https://smeup.github.io/ketchup/#/customization\n */\n @Prop() customStyle: string = '';\n /**\n * The data of the cell.\n * @default false\n */\n @Prop() data: KupDataCell = null;\n /**\n * The density of the cell, defaults at 'dense' and can be also set to 'wide' or 'medium'.\n */\n @Prop() density: FCellPadding = FCellPadding.NONE;\n /**\n * When set to true, the component is draggable.\n * @default false\n */\n @Prop() dragEnabled: boolean = false;\n\n /**\n * Show submit button\n */\n @Prop() showSubmit: boolean = false;\n\n /**\n * Submit button position, default is right\n */\n @Prop() submitPosition: KupCellSubmitButtonPosition =\n KupCellSubmitButtonPosition.right;\n\n /*-------------------------------------------------*/\n /* I n t e r n a l V a r i a b l e s */\n /*-------------------------------------------------*/\n\n /**\n * Instance of the KupManager class.\n */\n #kupManager: KupManager = kupManagerInstance();\n\n /*-------------------------------------------------*/\n /* P u b l i c M e t h o d s */\n /*-------------------------------------------------*/\n\n @Event({\n eventName: 'kup-cell-submit-click',\n composed: true,\n cancelable: false,\n bubbles: true,\n })\n kupCellSubmitClick: EventEmitter<KupCellSubmitClickEventPayload>;\n\n /**\n * Adds the given CSS classes to the cell's data.\n * @param {string[]} classes - Array of CSS classes.\n */\n @Method()\n async addCssClasses(classes?: string[]): Promise<void> {\n if (!this.data.cssClass) {\n this.data.cssClass = '';\n }\n if (classes) {\n for (let index = 0; index < classes.length; index++) {\n const cssClass = classes[index];\n if (this.data.cssClass.indexOf(cssClass) < 0) {\n this.data.cssClass += ` ${cssClass}`;\n }\n }\n }\n this.refresh();\n }\n /**\n * Used to retrieve component's props values.\n * @param {boolean} descriptions - When provided and true, the result will be the list of props with their description.\n * @returns {Promise<GenericObject>} List of props as object, each key will be a prop.\n */\n @Method()\n async getProps(descriptions?: boolean): Promise<GenericObject> {\n return getProps(this, KupCellProps, descriptions);\n }\n /**\n * This method is used to trigger a new render of the component.\n */\n @Method()\n async refresh(): Promise<void> {\n forceUpdate(this);\n }\n /**\n * Removes the given CSS classes from the cell's data.\n * @param {string[]} classes - Array of CSS classes.\n */\n @Method()\n async removeCssClasses(classes?: string[]): Promise<void> {\n if (!this.data.cssClass) {\n return;\n }\n if (classes) {\n for (let index = 0; index < classes.length; index++) {\n const cssClass = classes[index];\n if (this.data.cssClass.indexOf(cssClass) > 0) {\n this.data.cssClass = this.data.cssClass.replace(\n new RegExp(cssClass, 'g'),\n ''\n );\n }\n }\n }\n this.refresh();\n }\n /**\n * Sets the props to the component.\n * @param {GenericObject} props - Object containing props that will be set to the component.\n */\n @Method()\n async setProps(props: GenericObject): Promise<void> {\n setProps(this, KupCellProps, props);\n }\n\n /*-------------------------------------------------*/\n /* P r i v a t e M e t h o d s */\n /*-------------------------------------------------*/\n\n private didRenderInteractables() {\n if (this.dragEnabled) {\n const dataCb: KupDragDataTransferCallback = () => {\n return {\n cell: this.data,\n column: this.generateColumn(),\n id: this.rootElement.id,\n multiple: false,\n row: this.generateRow(),\n };\n };\n\n this.#kupManager.interact.draggable(\n this.rootElement.shadowRoot.querySelector(\n '#' + componentWrapperId\n ),\n {\n cursorChecker() {\n return null;\n },\n },\n {\n callback: dataCb,\n },\n KupDragEffect.BADGE\n );\n }\n }\n\n private generateColumn(): KupDataColumn {\n const colname: string =\n this.data && this.data.obj && this.data.obj.t\n ? this.data.obj.t + ';' + this.data.obj.p\n : 'KUPCELL';\n const coltitle: string =\n this.data && this.data.obj && this.data.obj.t\n ? this.data.obj.t + ';' + this.data.obj.p\n : this.#kupManager.language.translate(\n KupLanguageGeneric.EMPTY_OBJECT\n );\n return {\n name: colname,\n title: coltitle,\n };\n }\n\n private generateRow(): KupDataRow {\n const col: KupDataColumn = this.generateColumn();\n const row: KupDataRow = { cells: {} };\n row.cells[col.name] = this.data;\n return row;\n }\n\n private submitClick(e: MouseEvent): void {\n e.stopPropagation();\n this.kupCellSubmitClick.emit({\n comp: this,\n id: this.rootElement.id,\n cell: this.data as KupDataCellOptions,\n });\n }\n\n /*-------------------------------------------------*/\n /* L i f e c y c l e H o o k s */\n /*-------------------------------------------------*/\n\n componentWillLoad() {\n this.#kupManager.dates.register(this);\n this.#kupManager.debug.logLoad(this, false);\n this.#kupManager.language.register(this);\n this.#kupManager.theme.register(this);\n }\n\n componentDidLoad() {\n this.#kupManager.debug.logLoad(this, true);\n }\n\n componentWillRender() {\n this.#kupManager.debug.logRender(this, false);\n }\n\n componentDidRender() {\n this.didRenderInteractables();\n this.#kupManager.debug.logRender(this, true);\n }\n\n render() {\n const props: FCellOptionsProps = {\n cell: this.data as KupDataCellOptions,\n column: this.generateColumn(),\n component: this,\n density: this.density,\n editable: this.data.isEditable,\n renderKup: true,\n row: this.generateRow(),\n };\n\n const sectionStyle = {\n display: this.showSubmit ? 'flex' : 'block',\n 'flex-direction': this.showSubmit ? this.submitPosition : '',\n };\n return (\n <Host>\n <style>\n {this.#kupManager.theme.setKupStyle(\n this.rootElement as KupComponent\n )}\n </style>\n <div id={componentWrapperId} style={sectionStyle}>\n <FCellOptions {...props}></FCellOptions>\n {this.showSubmit ? (\n <FButton\n buttonType=\"submit\"\n label={this.#kupManager.language.translate(\n KupLanguageGeneric.CONFIRM\n )}\n wrapperClass=\"form__submit\"\n onClick={(e) => {\n this.submitClick(e);\n }}\n ></FButton>\n ) : null}\n </div>\n </Host>\n );\n }\n\n disconnectedCallback() {\n this.#kupManager.dates.unregister(this);\n this.#kupManager.language.unregister(this);\n this.#kupManager.theme.unregister(this);\n }\n}\n"],"version":3}
|
|
@@ -220,7 +220,7 @@ const KupInputPanel$1 = /*@__PURE__*/ proxyCustomElement(class KupInputPanel ext
|
|
|
220
220
|
h("p", null, __classPrivateFieldGet(this, _KupInputPanel_kupManager, "f").language.translate(KupLanguageGeneric.EMPTY_DATA)),
|
|
221
221
|
]
|
|
222
222
|
: this.inputPanelCells.map((inputPanelCell) => __classPrivateFieldGet(this, _KupInputPanel_instances, "m", _KupInputPanel_renderRow).call(this, inputPanelCell));
|
|
223
|
-
return (h(Host, { key: '
|
|
223
|
+
return (h(Host, { key: 'e279ee4ddb7992e85ea2df227a0be95841266d86' }, h("style", { key: '040a87394483713e00e075dec2569616c4615290' }, __classPrivateFieldGet(this, _KupInputPanel_kupManager, "f").theme.setKupStyle(this.rootElement)), h("div", { key: '2a4a7b2df96c89e2bba82e838165f8235a2efd56', id: componentWrapperId }, inputPanelContent)));
|
|
224
224
|
}
|
|
225
225
|
disconnectedCallback() {
|
|
226
226
|
__classPrivateFieldGet(this, _KupInputPanel_kupManager, "f").language.unregister(this);
|
|
@@ -336,26 +336,35 @@ _KupInputPanel_kupManager = new WeakMap(), _KupInputPanel_optionsAdapterMap = ne
|
|
|
336
336
|
}, _KupInputPanel_renderAbsoluteLayout = function _KupInputPanel_renderAbsoluteLayout(inputPanelCell, layout) {
|
|
337
337
|
return layout.sections.map((section) => __classPrivateFieldGet(this, _KupInputPanel_instances, "m", _KupInputPanel_renderAbsoluteSection).call(this, inputPanelCell, section));
|
|
338
338
|
}, _KupInputPanel_renderSection = function _KupInputPanel_renderSection(cells, section, customLabelRender = false, styleObj = {}) {
|
|
339
|
-
var _a, _b
|
|
339
|
+
var _a, _b;
|
|
340
|
+
const classObj = {
|
|
341
|
+
'input-panel__section': !section.horizontal,
|
|
342
|
+
'input-panel__horizontal-section': section.horizontal,
|
|
343
|
+
};
|
|
344
|
+
styleObj.gap = +section.gap > 0 ? `${section.gap}rem` : '1rem';
|
|
340
345
|
let content = [];
|
|
341
346
|
if ((_a = section.sections) === null || _a === void 0 ? void 0 : _a.length) {
|
|
342
347
|
content = section.sections.map((innerSection) => __classPrivateFieldGet(this, _KupInputPanel_instances, "m", _KupInputPanel_renderSection).call(this, cells, innerSection));
|
|
348
|
+
const hasDim = section.sections.some((sec) => sec.dim);
|
|
349
|
+
if (!section.gridCols && section.horizontal) {
|
|
350
|
+
styleObj.gridTemplateColumns = hasDim
|
|
351
|
+
? section.sections.map((sec) => sec.dim || 'auto').join(' ')
|
|
352
|
+
: `repeat(${section.sections.length}, 1fr)`;
|
|
353
|
+
}
|
|
354
|
+
if (!section.gridRows && !section.horizontal) {
|
|
355
|
+
styleObj.gridTemplateRows = hasDim
|
|
356
|
+
? section.sections.map((sec) => sec.dim || 'auto').join(' ')
|
|
357
|
+
: `repeat(${section.sections.length}, 1fr)`;
|
|
358
|
+
}
|
|
343
359
|
}
|
|
344
360
|
else if ((_b = section.content) === null || _b === void 0 ? void 0 : _b.length) {
|
|
345
361
|
content = section.content.map((field) => __classPrivateFieldGet(this, _KupInputPanel_instances, "m", _KupInputPanel_renderField).call(this, cells, field));
|
|
362
|
+
styleObj.gridTemplateColumns =
|
|
363
|
+
+section.gridCols > 0 ? `repeat(${section.gridCols}, 1fr)` : '';
|
|
364
|
+
styleObj.gridTemplateRows =
|
|
365
|
+
+section.gridRows > 0 ? `repeat(${section.gridRows}, 1fr)` : '';
|
|
346
366
|
}
|
|
347
|
-
const
|
|
348
|
-
'input-panel__section': !section.horizontal,
|
|
349
|
-
'input-panel__horizontal-section': section.horizontal,
|
|
350
|
-
};
|
|
351
|
-
if ((_d = (_c = cells.row) === null || _c === void 0 ? void 0 : _c.layout) === null || _d === void 0 ? void 0 : _d.horizontal) {
|
|
352
|
-
styleObj.maxWidth = section.dim;
|
|
353
|
-
}
|
|
354
|
-
else {
|
|
355
|
-
styleObj.maxHeight = section.dim;
|
|
356
|
-
}
|
|
357
|
-
const sectionStyle = Object.assign(Object.assign({}, styleObj), { gap: +section.gap > 0 ? `${section.gap}rem` : '', 'grid-template-columns': +section.gridCols > 0 ? `repeat(${section.gridCols}, 1fr)` : '', 'grid-template-rows': +section.gridRows > 0 ? `repeat(${section.gridRows}, 1fr)` : '' });
|
|
358
|
-
const sectionContent = (h("div", { class: classObj, style: sectionStyle }, content));
|
|
367
|
+
const sectionContent = (h("div", { class: classObj, style: styleObj }, content));
|
|
359
368
|
return section.title && !customLabelRender ? (h("div", { class: { 'input-panel__section_label_container': true } }, h("h3", null, section.title), sectionContent)) : (sectionContent);
|
|
360
369
|
}, _KupInputPanel_renderAbsoluteSection = function _KupInputPanel_renderAbsoluteSection(cells, section) {
|
|
361
370
|
var _a, _b;
|