Skip to content

Commit

Permalink
Merge pull request #1845 from apuliasoft/inputpanel
Browse files Browse the repository at this point in the history
  • Loading branch information
lucafoscili authored Apr 3, 2024
2 parents 3c4c54d + a4c5e88 commit 58dadce
Show file tree
Hide file tree
Showing 6 changed files with 284 additions and 89 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,14 @@ export default {
default: 'null',
try: 'field',
},
{
prop: 'handleEventsCallbacks',
description: 'Sets the callbacks functions on ketchup events.',
type: 'InputPanelEventsCallback',
isArray: true,
default: '[]',
try: 'json',
},
],
};
},
Expand Down Expand Up @@ -117,12 +125,30 @@ function createComp() {
NAT: {
value: '',
options: [
'Italy',
'Spain',
'Germany',
'France',
'Portugal',
'England',
{
id: 'ITA',
label: 'Italy',
},
{
id: 'SPA',
label: 'Spain',
},
{
id: 'GER',
label: 'Germany',
},
{
id: 'FRA',
label: 'France',
},
{
id: 'POR',
label: 'Portugal',
},
{
id: 'ENG',
label: 'England',
},
],
obj: {
t: '',
Expand All @@ -143,24 +169,78 @@ function createComp() {
editable: true,
mandatory: true,
options: [
'Rome',
'Florence',
'Venice',
'Madrid',
'Barcelona',
'Seville',
'Berlin',
'Munich',
'Hamburg',
'Paris',
'Marseille',
'Lyon',
'Lisbon',
'Porto',
'Faro',
'London',
'Manchester',
'Liverpool',
{
id: 'ROM',
label: 'Rome',
},
{
id: 'FLO',
label: 'Florence',
},
{
id: 'VEN',
label: 'Venice',
},
{
id: 'MAD',
label: 'Madrid',
},
{
id: 'BAR',
label: 'Barcelona',
},
{
id: 'SEV',
label: 'Seville',
},
{
id: 'BER',
label: 'Berlin',
},
{
id: 'MUN',
label: 'Munich',
},
{
id: 'HAM',
label: 'Hamburg',
},
{
id: 'PAR',
label: 'Paris',
},
{
id: 'MAR',
label: 'Marseille',
},
{
id: 'LYO',
label: 'Lyon',
},
{
id: 'LIS',
label: 'Lisbon',
},
{
id: 'POR',
label: 'Porto',
},
{
id: 'FAR',
label: 'Faro',
},
{
id: 'LON',
label: 'London',
},
{
id: 'MAN',
label: 'Manchester',
},
{
id: 'LIV',
label: 'Liverpool',
},
],
shape: 'ACP',
},
Expand Down
141 changes: 115 additions & 26 deletions packages/ketchup/src/assets/input-panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,30 @@ let data = {
NAT: {
value: '',
options: [
'Italy',
'Spain',
'Germany',
'France',
'Portugal',
'England',
{
id: 'ITA',
label: 'Italy',
},
{
id: 'SPA',
label: 'Spain',
},
{
id: 'GER',
label: 'Germany',
},
{
id: 'FRA',
label: 'France',
},
{
id: 'POR',
label: 'Portugal',
},
{
id: 'ENG',
label: 'England',
},
],
obj: {
t: '',
Expand All @@ -85,24 +103,78 @@ let data = {
editable: true,
mandatory: true,
options: [
'Rome',
'Florence',
'Venice',
'Madrid',
'Barcelona',
'Seville',
'Berlin',
'Munich',
'Hamburg',
'Paris',
'Marseille',
'Lyon',
'Lisbon',
'Porto',
'Faro',
'London',
'Manchester',
'Liverpool',
{
id: 'ROM',
label: 'Rome',
},
{
id: 'FLO',
label: 'Florence',
},
{
id: 'VEN',
label: 'Venice',
},
{
id: 'MAD',
label: 'Madrid',
},
{
id: 'BAR',
label: 'Barcelona',
},
{
id: 'SEV',
label: 'Seville',
},
{
id: 'BER',
label: 'Berlin',
},
{
id: 'MUN',
label: 'Munich',
},
{
id: 'HAM',
label: 'Hamburg',
},
{
id: 'PAR',
label: 'Paris',
},
{
id: 'MAR',
label: 'Marseille',
},
{
id: 'LYO',
label: 'Lyon',
},
{
id: 'LIS',
label: 'Lisbon',
},
{
id: 'POR',
label: 'Porto',
},
{
id: 'FAR',
label: 'Faro',
},
{
id: 'LON',
label: 'London',
},
{
id: 'MAN',
label: 'Manchester',
},
{
id: 'LIV',
label: 'Liverpool',
},
],
shape: 'ACP',
},
Expand All @@ -113,8 +185,25 @@ let data = {
shape: 'CHK',
},
RAD: {
value: '1',
options: ['1', '2', '3', '4'],
value: '3',
options: [
{
id: '1',
label: 'One',
},
{
id: '2',
label: 'Two',
},
{
id: '3',
label: 'Three',
},
{
id: '4',
label: 'Four',
},
],
editable: true,
mandatory: true,
shape: 'RAD',
Expand Down
20 changes: 10 additions & 10 deletions packages/ketchup/src/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2593,6 +2593,11 @@ export namespace Components {
* @returns List of props as object, each key will be a prop.
*/
"getProps": (descriptions?: boolean) => Promise<GenericObject>;
/**
* Sets the callbacks functions on ketchup events
* @default []
*/
"handleEventsCallbacks": InputPanelEventsCallback[];
/**
* Creates a hidden submit button in order to submit the form with enter.
* @default false
Expand All @@ -2612,11 +2617,6 @@ export namespace Components {
* @default null
*/
"submitCb": (e: SubmitEvent) => unknown;
/**
* Sets the callback function on value change event
* @default null
*/
"valueChangeCb": InputPanelEventsCallback[];
}
interface KupLazy {
/**
Expand Down Expand Up @@ -7396,6 +7396,11 @@ declare namespace LocalJSX {
* @default null
*/
"data"?: KupInputPanelData;
/**
* Sets the callbacks functions on ketchup events
* @default []
*/
"handleEventsCallbacks"?: InputPanelEventsCallback[];
/**
* Creates a hidden submit button in order to submit the form with enter.
* @default false
Expand All @@ -7410,11 +7415,6 @@ declare namespace LocalJSX {
* @default null
*/
"submitCb"?: (e: SubmitEvent) => unknown;
/**
* Sets the callback function on value change event
* @default null
*/
"valueChangeCb"?: InputPanelEventsCallback[];
}
interface KupLazy {
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,17 @@ export interface KupInputPanelRowCells {
}

export interface KupInputPanelCell extends KupDataCell {
// TODO tipizzare dopo validazione da SMEUP
options?: string[];
options?: KupInputPanelCellOptions[];
editable?: boolean;
mandatory?: boolean;
fun?: string;
}

export interface KupInputPanelCellOptions {
id: string;
label: string;
}

export interface KupInputPanelLayout {
horizontal?: boolean;
sections?: KupInputPanelLayoutSection[];
Expand Down Expand Up @@ -58,7 +62,7 @@ export interface KupInputPanelLayoutField {
}

export type DataAdapterFn = (
options: string[],
options: KupInputPanelCellOptions[],
fieldLabel: string,
currentValue: string
) => Object;
Expand Down
Loading

0 comments on commit 58dadce

Please sign in to comment.