Skip to content

Commit

Permalink
Merge pull request smeup#2353 from smeup/fix-numbers
Browse files Browse the repository at this point in the history
f-text-field: props.integers are all digits allowed (not just integer part)
  • Loading branch information
pasere-smeup authored Jan 3, 2025
2 parents 22a2ea0 + 7d0c025 commit c2ec8e2
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 13 deletions.
4 changes: 2 additions & 2 deletions packages/ketchup/src/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2840,7 +2840,7 @@ export namespace Components {
*/
"rows": number;
/**
* An array of integers containing the path to a selected child.\
* An array of integers containing the path to a selected child.
*/
"selectedNode": TreeNodePath;
/**
Expand Down Expand Up @@ -8428,7 +8428,7 @@ declare namespace LocalJSX {
*/
"rows"?: number;
/**
* An array of integers containing the path to a selected child.\
* An array of integers containing the path to a selected child.
*/
"selectedNode"?: TreeNodePath;
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ export class KupImageList {
@Prop() rows: number = null;

/**
* An array of integers containing the path to a selected child.\
* An array of integers containing the path to a selected child.
*/
@Prop() selectedNode: TreeNodePath = [];
@Prop() stateId: string = '';
Expand Down
2 changes: 1 addition & 1 deletion packages/ketchup/src/components/kup-image-list/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
| `data` | -- | Actual data of the component. | `KupImageListDataNode[]` | `[]` |
| `ripple` | `ripple` | When enabled displays Material's ripple effect on clicked items. | `boolean` | `false` |
| `rows` | `rows` | Number of rows to display in the grid layout. | `number` | `null` |
| `selectedNode` | -- | An array of integers containing the path to a selected child.\ | `number[]` | `[]` |
| `selectedNode` | -- | An array of integers containing the path to a selected child. | `number[]` | `[]` |
| `showFullDescription` | `show-full-description` | When enabled images descriptions will be fully shown. | `boolean` | `false` |
| `stateId` | `state-id` | | `string` | `''` |
| `store` | -- | | `KupStore` | `undefined` |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1681,7 +1681,11 @@ export class KupInputPanel {
) ?? []
: [];
} else {
console.warn('"kup-list" not found');
this.#kupManager.debug.logMessage(
this,
'getAutocompleteEventCallback() - "kup-list" not found in cell.data.data',
KupDebugCategory.WARNING
);
}
detail.comp.refresh();
});
Expand Down
1 change: 1 addition & 0 deletions packages/ketchup/src/f-components/f-cell/f-cell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -912,6 +912,7 @@ function setEditableCell(
}
decimals={props.column.decimals}
integers={props.column.integers}
group={props.column.group}
value={value}
onChange={onChange}
onInput={onInput}
Expand Down
22 changes: 14 additions & 8 deletions packages/ketchup/src/f-components/f-text-field/f-text-field.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,8 @@ function setContent(props: FTextFieldProps): HTMLDivElement {
const options: NumericFieldFormatOptions = {
allowNegative: props.allowNegative ?? true,
decimal: props.decimals,
group: props.group,
integer: props.integers,
group: props.group ?? true,
integer: (props.integers ?? 0) - (props.decimals ?? 0),
};
value = formatValue(value, options, false);
}
Expand Down Expand Up @@ -253,8 +253,10 @@ function setContent(props: FTextFieldProps): HTMLDivElement {
const options: NumericFieldFormatOptions = {
allowNegative: props.allowNegative ?? true,
decimal: props.decimals,
group: props.group,
integer: props.integers,
group: props.group ?? true,
integer:
(props.integers ?? 0) -
(props.decimals ?? 0),
};
(e.target as HTMLInputElement).value =
formatValue(
Expand All @@ -272,8 +274,10 @@ function setContent(props: FTextFieldProps): HTMLDivElement {
const options: NumericFieldFormatOptions = {
allowNegative: props.allowNegative ?? true,
decimal: props.decimals,
group: props.group,
integer: props.integers,
group: props.group ?? true,
integer:
(props.integers ?? 0) -
(props.decimals ?? 0),
};
if (
props.min !== undefined &&
Expand Down Expand Up @@ -358,8 +362,10 @@ function setContent(props: FTextFieldProps): HTMLDivElement {
const options: NumericFieldFormatOptions = {
allowNegative: props.allowNegative ?? true,
decimal: props.decimals,
group: props.group,
integer: props.integers,
group: props.group ?? true,
integer:
(props.integers ?? 0) -
(props.decimals ?? 0),
};
let component = e.target as HTMLInputElement;
let value = component.value;
Expand Down

0 comments on commit c2ec8e2

Please sign in to comment.