Skip to content

Commit

Permalink
Merge pull request #2546 from apuliasoft/LS25000976
Browse files Browse the repository at this point in the history
LS25000976: Posizionamento label AML
  • Loading branch information
pasere-smeup authored Mar 3, 2025
2 parents cd54f17 + 51ef3e2 commit cebafff
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 8 deletions.
10 changes: 10 additions & 0 deletions packages/ketchup/src/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1216,6 +1216,11 @@ export namespace Components {
* @returns List of props as object, each key will be a prop.
*/
"getProps": (descriptions?: boolean) => Promise<GenericObject>;
/**
* When set,will be shown a label on the chips
* @default null
*/
"label": string;
/**
* This method is used to trigger a new render of the component.
*/
Expand Down Expand Up @@ -7186,6 +7191,11 @@ declare namespace LocalJSX {
* @default false
*/
"enableInput"?: boolean;
/**
* When set,will be shown a label on the chips
* @default null
*/
"label"?: string;
/**
* Triggered when a chip loses focus.
*/
Expand Down
4 changes: 1 addition & 3 deletions packages/ketchup/src/components/kup-chip/kup-chip.scss
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,4 @@
* @prop --kup-chip-text-color-rgb: Sets text color RGB values of the component (used for shaders).
*/

:host {
display: block;
}
@import url('./styles/kup-chip-main.scss');
10 changes: 10 additions & 0 deletions packages/ketchup/src/components/kup-chip/kup-chip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,11 @@ export class KupChip {
*/
@Prop() displayMode: ItemsDisplayMode = ItemsDisplayMode.DESCRIPTION;

/**
* When set,will be shown a label on the chips
* @default null
*/
@Prop() label: string = null;
/*-------------------------------------------------*/
/* I n t e r n a l V a r i a b l e s */
/*-------------------------------------------------*/
Expand Down Expand Up @@ -452,6 +457,11 @@ export class KupChip {
)}
</style>
<div id={componentWrapperId}>
{this.label ? (
<div class="mdc-text-field__label-container">
<label>{this.label}</label>
</div>
) : null}
{this.data?.length > 0 ? <FChip {...props} /> : null}
<slot name="field"></slot>
</div>
Expand Down
1 change: 1 addition & 0 deletions packages/ketchup/src/components/kup-chip/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
| `data` | -- | List of elements. | `KupChipNode[]` | `[]` |
| `displayMode` | `display-mode` | When enabled, the chip's text will display both the id and description. | `ItemsDisplayMode.CODE \| ItemsDisplayMode.CODE_AND_DESC \| ItemsDisplayMode.CODE_AND_DESC_ALIAS \| ItemsDisplayMode.DESCRIPTION \| ItemsDisplayMode.DESC_AND_CODE` | `ItemsDisplayMode.DESCRIPTION` |
| `enableInput` | `enable-input` | When enabled, it's possible to add items to the chip's dataset through an input slot (kup-autocomplete, kup-combobox, kup-text-field). | `boolean` | `false` |
| `label` | `label` | When set,will be shown a label on the chips | `string` | `null` |
| `sizing` | `sizing` | Sets the size of the chip | `FChipSize.MEDIUM \| FChipSize.SMALL` | `FChipSize.SMALL` |
| `styling` | `styling` | Sets the style of the chip | `FChipStyling.OUTLINED \| FChipStyling.RAISED` | `FChipStyling.RAISED` |
| `type` | `type` | The type of chip. Available types: input, filter, choice or empty for default. | `FChipType.CHOICE \| FChipType.FILTER \| FChipType.INPUT \| FChipType.STANDARD` | `FChipType.STANDARD` |
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
:host {
display: block;
}

.mdc-text-field__label-container {
padding-bottom: 4px;
}
Original file line number Diff line number Diff line change
Expand Up @@ -1388,7 +1388,6 @@ export class KupInputPanel {
currentValue: string
) {
const configCMandACP = CMBandACPAdapter(currentValue, fieldLabel, []);

if (rawOptions) {
configCMandACP.data['kup-list'].data =
this.#optionsTreeComboAdapter(rawOptions, currentValue);
Expand Down Expand Up @@ -1785,7 +1784,6 @@ export class KupInputPanel {
cell.shape === FCellShapes.MULTI_AUTOCOMPLETE
? cell.slotData.data['kup-list']
: cell.data?.data?.['kup-list'];

if (kupListData) {
kupListData.data = filteredRows?.length
? this.#optionsTreeComboAdapter(
Expand Down
12 changes: 9 additions & 3 deletions packages/ketchup/src/f-components/f-cell/f-cell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -783,13 +783,14 @@ function setEditableCell(
);
case FCellTypes.FILE_UPLOAD:
return <kup-file-upload {...cell.data} />;
case FCellTypes.MULTI_AUTOCOMPLETE:
case FCellTypes.MULTI_AUTOCOMPLETE: {
return (
<kup-chip
displayMode={
cell.data.displayMode ?? ItemsDisplayMode.DESCRIPTION
}
{...cell.data}
label={cell.slotData?.label ?? ''}
type={FChipType.INPUT}
enableInput={true}
onKup-chip-change={(
Expand Down Expand Up @@ -818,13 +819,18 @@ function setEditableCell(
FCellEvents.ICON_CLICK
)
}
showDropDownIcon={false}
{...cell.slotData}
data={cell.slotData?.data}
initialValue={cell.slotData?.initialValue}
showDropDownIcon={cell.slotData?.showDropDownIcon}
style={cell.slotData?.style}
disabled={cell.slotData?.disabled}
id={cell.slotData?.id}
error={cell.data.error}
showMarker={cell.tooltip ?? false}
></kup-autocomplete>
</kup-chip>
);
}
case FCellTypes.MULTI_COMBOBOX:
return (
<kup-chip
Expand Down

0 comments on commit cebafff

Please sign in to comment.