@sme.up/ketchup 11.0.0-SNAPSHOT-20241017090851 → 11.0.0-SNAPSHOT-20241017130107
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/kup-cell.cjs.entry.js +43 -3
- package/dist/cjs/kup-cell.cjs.entry.js.map +1 -1
- package/dist/collection/f-components/f-cell-options.tsx/f-cell-options.js +42 -4
- package/dist/collection/f-components/f-cell-options.tsx/f-cell-options.js.map +1 -1
- package/dist/components/kup-cell.js +44 -4
- package/dist/components/kup-cell.js.map +1 -1
- package/dist/esm/kup-cell.entry.js +44 -4
- package/dist/esm/kup-cell.entry.js.map +1 -1
- package/dist/ketchup/ketchup.esm.js +1 -1
- package/dist/ketchup/p-f0f42ad4.entry.js +2 -0
- package/dist/ketchup/p-f0f42ad4.entry.js.map +1 -0
- package/package.json +1 -1
- package/dist/ketchup/p-deea2b0f.entry.js +0 -2
- package/dist/ketchup/p-deea2b0f.entry.js.map +0 -1
|
@@ -98,9 +98,47 @@ const optionsAdapterMap = new Map([
|
|
|
98
98
|
const FCellOptions = (props) => {
|
|
99
99
|
const mappedCell = props.cell
|
|
100
100
|
? Object.assign(Object.assign({}, props.cell), { data: setProps(props.cell, props.column), slotData: slotData(props.cell, props.column), isEditable: true }) : null;
|
|
101
|
-
const mappedProps = Object.assign(Object.assign({}, props), { editable: true, cell: mappedCell });
|
|
101
|
+
const mappedProps = Object.assign(Object.assign({}, props), { editable: true, cell: mappedCell, column: generateColumn(mappedCell.data), row: generateRow(mappedCell.data) });
|
|
102
|
+
if (props.cell.shape === kupManager.FCellShapes.TEXT_FIELD) {
|
|
103
|
+
mappedProps.cell.value = mappedProps.cell.data.value;
|
|
104
|
+
}
|
|
105
|
+
const label = getLabelComponent(mappedProps.cell, mappedProps.column.title);
|
|
106
|
+
if (label) {
|
|
107
|
+
return (index.h("div", { class: { 'input-panel__label_container': true } },
|
|
108
|
+
label,
|
|
109
|
+
index.h(fCell.FCell, Object.assign({}, mappedProps))));
|
|
110
|
+
}
|
|
111
|
+
console.log('props', mappedProps);
|
|
102
112
|
return index.h(fCell.FCell, Object.assign({}, mappedProps));
|
|
103
113
|
};
|
|
114
|
+
const getLabelComponent = (cell, label) => {
|
|
115
|
+
if (!label) {
|
|
116
|
+
return null;
|
|
117
|
+
}
|
|
118
|
+
const cellType = dom.ketchup.data.cell.getType(cell, cell.shape);
|
|
119
|
+
if (cellType === kupManager.FCellTypes.RADIO) {
|
|
120
|
+
return index.h("span", null, label);
|
|
121
|
+
}
|
|
122
|
+
return null;
|
|
123
|
+
};
|
|
124
|
+
const generateColumn = (data) => {
|
|
125
|
+
const colname = data && data.obj && data.obj.t
|
|
126
|
+
? data.obj.t + ';' + data.obj.p
|
|
127
|
+
: 'KUPCELL';
|
|
128
|
+
const coltitle = data && data.obj && data.obj.t
|
|
129
|
+
? data.obj.t + ';' + data.obj.p
|
|
130
|
+
: 'genericEmptyObject';
|
|
131
|
+
return {
|
|
132
|
+
name: colname,
|
|
133
|
+
title: coltitle,
|
|
134
|
+
};
|
|
135
|
+
};
|
|
136
|
+
const generateRow = (data) => {
|
|
137
|
+
const col = generateColumn(data);
|
|
138
|
+
const row = { cells: {} };
|
|
139
|
+
row.cells[col.name] = data.cell;
|
|
140
|
+
return row;
|
|
141
|
+
};
|
|
104
142
|
const slotData = (cell, col) => {
|
|
105
143
|
const cellType = dom.ketchup.data.cell.getType(cell, cell.shape);
|
|
106
144
|
if (!cell.isEditable) {
|
|
@@ -161,9 +199,11 @@ const mapData = (cell, col) => {
|
|
|
161
199
|
const MainRADAdapter = (options, _fieldLabel, currentValue) => {
|
|
162
200
|
return kupManager.RADAdapter(currentValue, options);
|
|
163
201
|
};
|
|
164
|
-
const MainITXAdapter = (options, _fieldLabel, _currentValue) => {
|
|
202
|
+
const MainITXAdapter = (options, _fieldLabel, _currentValue, _cell) => {
|
|
165
203
|
if (options === null || options === void 0 ? void 0 : options[0]) {
|
|
166
|
-
return {
|
|
204
|
+
return {
|
|
205
|
+
value: options[0].label,
|
|
206
|
+
};
|
|
167
207
|
}
|
|
168
208
|
};
|
|
169
209
|
const MainBTNAdapter = (_options, _fieldLabel, _currentValue, cell) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"kup-cell.entry.cjs.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;;;;;;;;;;;;;ACexB,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;YACpC,EAAE,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;YACf,KAAK,EAAE,KAAK,CAAC,KAAK;YAClB,QAAQ,EAAE,YAAY,KAAK,KAAK,CAAC,GAAG,CAAC,CAAC;YACtC,QAAQ,EAAE,CAAA,MAAA,KAAK,CAAC,QAAQ,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AG,EAAE,IAAI,CAAC,WAAW,EAAE;SAC1B,CAAC;QACF,QACIZ,QAACa,UAAI,uDACDb,sEACK,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,WAAW,CAC9B,IAAI,CAAC,WAA2B,CACnC,CACG,EACRA,kEAAK,EAAE,EAAEU,mCAAkB,IACvBV,QAAC,YAAY,qEAAK,KAAK,EAAiB,CACtC,CACH,EACT;KACL;IAED,oBAAoB;QAChB,IAAI,CAAC,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","h","FCell","FCellTypes","CMBandACPAdapter","RADAdapter","kupManagerInstance","FCellPadding","getProps","forceUpdate","setProps","componentWrapperId","KupDragEffect","KupLanguageGeneric","Host"],"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 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} 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 };\n\n return <FCell {...mappedProps}></FCell>;\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) => {\n if (options?.[0]) {\n return { label: options[0].label };\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.entry.cjs.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,CAA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9B,SAAS,EAAE,IAAI;YACf,GAAG,EAAE,IAAI,CAAC,WAAW,EAAE;SAC1B,CAAC;QACF,QACIZ,QAACa,UAAI,uDACDb,sEACK,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,WAAW,CAC9B,IAAI,CAAC,WAA2B,CACnC,CACG,EACRA,kEAAK,EAAE,EAAEU,mCAAkB,IACvBV,QAAC,YAAY,qEAAK,KAAK,EAAiB,CACtC,CACH,EACT;KACL;IAED,oBAAoB;QAChB,IAAI,CAAC,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","FCellShapes","h","FCell","FCellTypes","CMBandACPAdapter","RADAdapter","kupManagerInstance","FCellPadding","getProps","forceUpdate","setProps","componentWrapperId","KupDragEffect","KupLanguageGeneric","Host"],"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}
|
|
@@ -12,7 +12,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
12
12
|
};
|
|
13
13
|
import { h } from "@stencil/core";
|
|
14
14
|
import { CMBandACPAdapter, RADAdapter } from "../../utils/cell-utils";
|
|
15
|
-
import { FCellTypes, } from "../f-cell/f-cell-declarations";
|
|
15
|
+
import { FCellShapes, FCellTypes, } from "../f-cell/f-cell-declarations";
|
|
16
16
|
import { FCell } from "../f-cell/f-cell";
|
|
17
17
|
const dom = document.documentElement;
|
|
18
18
|
const treeOptionsNodeAdapter = (options, currentValue) => {
|
|
@@ -75,9 +75,45 @@ const optionsAdapterMap = new Map([
|
|
|
75
75
|
export const FCellOptions = (props) => {
|
|
76
76
|
const mappedCell = props.cell
|
|
77
77
|
? Object.assign(Object.assign({}, props.cell), { data: setProps(props.cell, props.column), slotData: slotData(props.cell, props.column), isEditable: true }) : null;
|
|
78
|
-
const mappedProps = Object.assign(Object.assign({}, props), { editable: true, cell: mappedCell });
|
|
78
|
+
const mappedProps = Object.assign(Object.assign({}, props), { editable: true, cell: mappedCell, column: generateColumn(mappedCell.data), row: generateRow(mappedCell.data) });
|
|
79
|
+
if (props.cell.shape === FCellShapes.TEXT_FIELD) {
|
|
80
|
+
mappedProps.cell.value = mappedProps.cell.data.value;
|
|
81
|
+
}
|
|
82
|
+
const label = getLabelComponent(mappedProps.cell, mappedProps.column.title);
|
|
83
|
+
if (label) {
|
|
84
|
+
return (h("div", { class: { 'input-panel__label_container': true } }, label, h(FCell, Object.assign({}, mappedProps))));
|
|
85
|
+
}
|
|
86
|
+
console.log('props', mappedProps);
|
|
79
87
|
return h(FCell, Object.assign({}, mappedProps));
|
|
80
88
|
};
|
|
89
|
+
const getLabelComponent = (cell, label) => {
|
|
90
|
+
if (!label) {
|
|
91
|
+
return null;
|
|
92
|
+
}
|
|
93
|
+
const cellType = dom.ketchup.data.cell.getType(cell, cell.shape);
|
|
94
|
+
if (cellType === FCellTypes.RADIO) {
|
|
95
|
+
return h("span", null, label);
|
|
96
|
+
}
|
|
97
|
+
return null;
|
|
98
|
+
};
|
|
99
|
+
const generateColumn = (data) => {
|
|
100
|
+
const colname = data && data.obj && data.obj.t
|
|
101
|
+
? data.obj.t + ';' + data.obj.p
|
|
102
|
+
: 'KUPCELL';
|
|
103
|
+
const coltitle = data && data.obj && data.obj.t
|
|
104
|
+
? data.obj.t + ';' + data.obj.p
|
|
105
|
+
: 'genericEmptyObject';
|
|
106
|
+
return {
|
|
107
|
+
name: colname,
|
|
108
|
+
title: coltitle,
|
|
109
|
+
};
|
|
110
|
+
};
|
|
111
|
+
const generateRow = (data) => {
|
|
112
|
+
const col = generateColumn(data);
|
|
113
|
+
const row = { cells: {} };
|
|
114
|
+
row.cells[col.name] = data.cell;
|
|
115
|
+
return row;
|
|
116
|
+
};
|
|
81
117
|
const slotData = (cell, col) => {
|
|
82
118
|
const cellType = dom.ketchup.data.cell.getType(cell, cell.shape);
|
|
83
119
|
if (!cell.isEditable) {
|
|
@@ -138,9 +174,11 @@ const mapData = (cell, col) => {
|
|
|
138
174
|
const MainRADAdapter = (options, _fieldLabel, currentValue) => {
|
|
139
175
|
return RADAdapter(currentValue, options);
|
|
140
176
|
};
|
|
141
|
-
const MainITXAdapter = (options, _fieldLabel, _currentValue) => {
|
|
177
|
+
const MainITXAdapter = (options, _fieldLabel, _currentValue, _cell) => {
|
|
142
178
|
if (options === null || options === void 0 ? void 0 : options[0]) {
|
|
143
|
-
return {
|
|
179
|
+
return {
|
|
180
|
+
value: options[0].label,
|
|
181
|
+
};
|
|
144
182
|
}
|
|
145
183
|
};
|
|
146
184
|
const MainBTNAdapter = (_options, _fieldLabel, _currentValue, cell) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"f-cell-options.js","sourceRoot":"","sources":["../../../src/f-components/f-cell-options.tsx/f-cell-options.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,EAAuB,CAAC,EAAS,MAAM,eAAe,CAAC;AAG9D,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACtE,OAAO,EAGH,UAAU,GACb,MAAM,+BAA+B,CAAC;AASvC,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAEzC,MAAM,GAAG,GAAW,QAAQ,CAAC,eAAyB,CAAC;AAEvD,MAAM,sBAAsB,GAAG,CAC3B,OAAY,EACZ,YAAoB,EACL,EAAE;IACjB,OAAO,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;;QAAC,OAAA,CAAC;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;gBAC5B,CAAC,CAAC,sBAAsB,CAAC,KAAK,EAAE,YAAY,CAAC;gBAC7C,CAAC,CAAC,EAAE;SACX,CAAC,CAAA;KAAA,CAAC,CAAC;AACR,CAAC,CAAC;AAEF,MAAM,8BAA8B,GAAG,CACnC,OAAY,EACZ,YAAoB,EACL,EAAE;IAC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M,CAAC,KAAK;aACtB,CAAC,CAAC;YACL,CAAC,CAAC,EAAE;KACX,CAAC;AACN,CAAC,CAAC;AAEF,MAAM,oBAAoB,GAAG,CACzB,UAAyB,EACzB,UAAkB,EAClB,YAAoB,EACtB,EAAE;IACA,MAAM,cAAc,GAAG,gBAAgB,CAAC,YAAY,EAAE,UAAU,EAAE,EAAE,CAAC,CAAC;IAEtE,cAAc,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,IAAI,GAAG,uBAAuB,CAC1D,UAAU,EACV,YAAY,CACf,CAAC;IACF,OAAO,cAAc,CAAC;AAC1B,CAAC,CAAC","sourcesContent":["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 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} 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 };\n\n return <FCell {...mappedProps}></FCell>;\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) => {\n if (options?.[0]) {\n return { label: options[0].label };\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"]}
|
|
1
|
+
{"version":3,"file":"f-cell-options.js","sourceRoot":"","sources":["../../../src/f-components/f-cell-options.tsx/f-cell-options.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,EAAuB,CAAC,EAAS,MAAM,eAAe,CAAC;AAG9D,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACtE,OAAO,EAGH,WAAW,EACX,UAAU,GACb,MAAM,+BAA+B,CAAC;AAUvC,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAEzC,MAAM,GAAG,GAAW,QAAQ,CAAC,eAAyB,CAAC;AAEvD,MAAM,sBAAsB,GAAG,CAC3B,OAAY,EACZ,YAAoB,EACL,EAAE;IACjB,OAAO,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;;QAAC,OAAA,CAAC;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;gBAC5B,CAAC,CAAC,sBAAsB,CAAC,KAAK,EAAE,YAAY,CAAC;gBAC7C,CAAC,CAAC,EAAE;SACX,CAAC,CAAA;KAAA,CAAC,CAAC;AACR,CAAC,CAAC;AAEF,MAAM,8BAA8B,GAAG,CACnC,OAAY,EACZ,YAAoB,EACL,EAAE;IACjB,OAAO,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;;QAAC,OAAA,CAA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,CAAC,CAAC;AAEF,MAAM,cAAc,GAAG,CACnB,OAAsB,EACtB,WAAmB,EACnB,aAAqB,EACrB,KAAyB,EAC3B,EAAE;IACA,IAAI,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAG,CAAC,CAAC,EAAE,CAAC;QACf,OAAO;YACH,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,KAAK;SAC1B,CAAC;IACN,CAAC;AACL,CAAC,CAAC;AAEF,MAAM,cAAc,GAAG,CACnB,QAAuB,EACvB,WAAmB,EACnB,aAAqB,EACrB,IAAwB,EAC1B,EAAE;;IACA,OAAO;QACH,IAAI,EAAE,CAAA,MAAA,IAAI,CAAC,OAAO,0CAAE,MAAM;YACtB,CAAC,CAAC,MAAA,IAAI,CAAC,OAAO,0CAAE,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;gBAC3B,IAAI,EAAE,MAAM,CAAC,IAAI;gBACjB,KAAK,EAAE,MAAM,CAAC,KAAK;aACtB,CAAC,CAAC;YACL,CAAC,CAAC,EAAE;KACX,CAAC;AACN,CAAC,CAAC;AAEF,MAAM,oBAAoB,GAAG,CACzB,UAAyB,EACzB,UAAkB,EAClB,YAAoB,EACtB,EAAE;IACA,MAAM,cAAc,GAAG,gBAAgB,CAAC,YAAY,EAAE,UAAU,EAAE,EAAE,CAAC,CAAC;IAEtE,cAAc,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,IAAI,GAAG,uBAAuB,CAC1D,UAAU,EACV,YAAY,CACf,CAAC;IACF,OAAO,cAAc,CAAC;AAC1B,CAAC,CAAC","sourcesContent":["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"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { h, proxyCustomElement, HTMLElement, forceUpdate, Host } from '@stencil/core/internal/client';
|
|
2
|
-
import { F as FCellTypes, 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';
|
|
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
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';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -86,9 +86,47 @@ const optionsAdapterMap = new Map([
|
|
|
86
86
|
const FCellOptions = (props) => {
|
|
87
87
|
const mappedCell = props.cell
|
|
88
88
|
? Object.assign(Object.assign({}, props.cell), { data: setProps(props.cell, props.column), slotData: slotData(props.cell, props.column), isEditable: true }) : null;
|
|
89
|
-
const mappedProps = Object.assign(Object.assign({}, props), { editable: true, cell: mappedCell });
|
|
89
|
+
const mappedProps = Object.assign(Object.assign({}, props), { editable: true, cell: mappedCell, column: generateColumn(mappedCell.data), row: generateRow(mappedCell.data) });
|
|
90
|
+
if (props.cell.shape === FCellShapes.TEXT_FIELD) {
|
|
91
|
+
mappedProps.cell.value = mappedProps.cell.data.value;
|
|
92
|
+
}
|
|
93
|
+
const label = getLabelComponent(mappedProps.cell, mappedProps.column.title);
|
|
94
|
+
if (label) {
|
|
95
|
+
return (h("div", { class: { 'input-panel__label_container': true } },
|
|
96
|
+
label,
|
|
97
|
+
h(FCell, Object.assign({}, mappedProps))));
|
|
98
|
+
}
|
|
99
|
+
console.log('props', mappedProps);
|
|
90
100
|
return h(FCell, Object.assign({}, mappedProps));
|
|
91
101
|
};
|
|
102
|
+
const getLabelComponent = (cell, label) => {
|
|
103
|
+
if (!label) {
|
|
104
|
+
return null;
|
|
105
|
+
}
|
|
106
|
+
const cellType = dom.ketchup.data.cell.getType(cell, cell.shape);
|
|
107
|
+
if (cellType === FCellTypes.RADIO) {
|
|
108
|
+
return h("span", null, label);
|
|
109
|
+
}
|
|
110
|
+
return null;
|
|
111
|
+
};
|
|
112
|
+
const generateColumn = (data) => {
|
|
113
|
+
const colname = data && data.obj && data.obj.t
|
|
114
|
+
? data.obj.t + ';' + data.obj.p
|
|
115
|
+
: 'KUPCELL';
|
|
116
|
+
const coltitle = data && data.obj && data.obj.t
|
|
117
|
+
? data.obj.t + ';' + data.obj.p
|
|
118
|
+
: 'genericEmptyObject';
|
|
119
|
+
return {
|
|
120
|
+
name: colname,
|
|
121
|
+
title: coltitle,
|
|
122
|
+
};
|
|
123
|
+
};
|
|
124
|
+
const generateRow = (data) => {
|
|
125
|
+
const col = generateColumn(data);
|
|
126
|
+
const row = { cells: {} };
|
|
127
|
+
row.cells[col.name] = data.cell;
|
|
128
|
+
return row;
|
|
129
|
+
};
|
|
92
130
|
const slotData = (cell, col) => {
|
|
93
131
|
const cellType = dom.ketchup.data.cell.getType(cell, cell.shape);
|
|
94
132
|
if (!cell.isEditable) {
|
|
@@ -149,9 +187,11 @@ const mapData = (cell, col) => {
|
|
|
149
187
|
const MainRADAdapter = (options, _fieldLabel, currentValue) => {
|
|
150
188
|
return RADAdapter(currentValue, options);
|
|
151
189
|
};
|
|
152
|
-
const MainITXAdapter = (options, _fieldLabel, _currentValue) => {
|
|
190
|
+
const MainITXAdapter = (options, _fieldLabel, _currentValue, _cell) => {
|
|
153
191
|
if (options === null || options === void 0 ? void 0 : options[0]) {
|
|
154
|
-
return {
|
|
192
|
+
return {
|
|
193
|
+
value: options[0].label,
|
|
194
|
+
};
|
|
155
195
|
}
|
|
156
196
|
};
|
|
157
197
|
const MainBTNAdapter = (_options, _fieldLabel, _currentValue, cell) => {
|
|
@@ -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;;;;;;;;;;;;;ACexB,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,MAA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EAAE,KAAK,CAAC,CAAC;KAChD;IAED,kBAAkB;QACd,IAAI,CAAC,sBAAsB,EAAE,CAAC;QAC9B,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;KAC/C;IAED,MAAM;QACF,MAAM,KAAK,GAAsB;YAC7B,IAAI,EAAE,IAAI,CAAC,IAA0B;YACrC,MAAM,EAAE,IAAI,CAAC,cAAc,EAAE;YAC7B,SAAS,EAAE,IAAI;YACf,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,QAAQ,EAAE,IAAI,CAAC,IAAI,CAAC,UAAU;YAC9B,SAAS,EAAE,IAAI;YACf,GAAG,EAAE,IAAI,CAAC,WAAW,EAAE;SAC1B,CAAC;QACF,QACI,EAAC,IAAI,uDACD,gEACK,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,WAAW,CAC9B,IAAI,CAAC,WAA2B,CACnC,CACG,EACR,4DAAK,EAAE,EAAE,kBAAkB,IACvB,EAAC,YAAY,qEAAK,KAAK,EAAiB,CACtC,CACH,EACT;KACL;IAED,oBAAoB;QAChB,IAAI,CAAC,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 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} 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 };\n\n return <FCell {...mappedProps}></FCell>;\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) => {\n if (options?.[0]) {\n return { label: options[0].label };\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":";;;;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,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;YACpC,EAAE,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;YACf,KAAK,EAAE,KAAK,CAAC,KAAK;YAClB,QAAQ,EAAE,YAAY,KAAK,KAAK,CAAC,GAAG,CAAC,CAAC;YACtC,QAAQ,EAAE,CAAA,MAAA,KAAK,CAAC,QAAQ,0CAAE,MAAM;kBAC1B,8BAA8B,C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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}
|