Skip to content

Commit 9935cc1

Browse files
committed
fix: use types instead of shapes
1 parent 21644f5 commit 9935cc1

File tree

2 files changed

+20
-17
lines changed

2 files changed

+20
-17
lines changed

packages/ketchup/src/assets/input-panel.js

+8-8
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ const data = {
3737
NAM: {
3838
value: 'Francesco',
3939
obj: {
40-
t: 'CN',
41-
p: 'COL',
40+
t: '',
41+
p: '',
4242
k: '',
4343
},
4444
editable: true,
@@ -59,13 +59,13 @@ const data = {
5959
COL: {
6060
value: '#8E1F2F',
6161
obj: {
62-
t: '',
63-
p: '',
62+
t: 'J1',
63+
p: 'COL',
6464
k: '',
6565
},
6666
editable: true,
6767
mandatory: true,
68-
shape: 'CLP',
68+
// shape: 'CLP',
6969
},
7070
NAT: {
7171
value: 'It',
@@ -102,13 +102,13 @@ const data = {
102102
CAM: {
103103
value: 'on',
104104
obj: {
105-
t: '',
106-
p: '',
105+
t: 'V2',
106+
p: 'SI/NO',
107107
k: '',
108108
},
109109
editable: true,
110110
mandatory: true,
111-
shape: 'CHK',
111+
// shape: 'CHK',
112112
},
113113
},
114114
},

packages/ketchup/src/components/kup-input-panel/kup-input-panel.tsx

+12-9
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,13 @@ import { FButton } from '../../f-components/f-button/f-button';
2626
import { KupLanguageGeneric } from '../../managers/kup-language/kup-language-declarations';
2727
import {
2828
FCellProps,
29-
FCellShapes,
29+
FCellTypes,
3030
} from '../../f-components/f-cell/f-cell-declarations';
3131
import { FTextFieldMDC } from '../../f-components/f-text-field/f-text-field-mdc';
3232
import { FCell } from '../../f-components/f-cell/f-cell';
33+
import { KupDom } from '../../managers/kup-manager/kup-manager-declarations';
3334

35+
const dom: KupDom = document.documentElement as KupDom;
3436
@Component({
3537
tag: 'kup-input-panel',
3638
styleUrl: 'kup-input-panel.scss',
@@ -187,16 +189,17 @@ export class KupInputPanel {
187189
const options = cell.options;
188190
const fieldLabel = col.title;
189191
const currentValue = cell.value;
190-
191-
const dataAdapterMap = new Map<FCellShapes, DataAdapterFn>([
192-
[FCellShapes.AUTOCOMPLETE, this.#CMBandACPAdapter],
193-
[FCellShapes.CHECKBOX, this.#CHKAdapter],
194-
[FCellShapes.COLOR_PICKER, this.#CLPAdapter],
195-
[FCellShapes.COMBOBOX, this.#CMBandACPAdapter],
196-
[FCellShapes.TEXT_FIELD, this.#ITXAdapter],
192+
const cellType = dom.ketchup.data.cell.getType(cell, cell.shape);
193+
194+
const dataAdapterMap = new Map<FCellTypes, DataAdapterFn>([
195+
[FCellTypes.AUTOCOMPLETE, this.#CMBandACPAdapter],
196+
[FCellTypes.CHECKBOX, this.#CHKAdapter],
197+
[FCellTypes.COLOR_PICKER, this.#CLPAdapter],
198+
[FCellTypes.COMBOBOX, this.#CMBandACPAdapter],
199+
[FCellTypes.STRING, this.#ITXAdapter],
197200
]);
198201

199-
const adapter = dataAdapterMap.get(cell.shape);
202+
const adapter = dataAdapterMap.get(cellType);
200203

201204
return adapter ? adapter(options, fieldLabel, currentValue) : null;
202205
}

0 commit comments

Comments
 (0)