@micromerce/formbuilder-react 1.0.996 → 1.0.1004

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.
@@ -0,0 +1,17 @@
1
+ import React from "react";
2
+ import type { controlProps } from "../../../types/controlProps";
3
+ import type { IPersonNameAnchor } from "./personNameAnchors";
4
+ interface IProps {
5
+ anchor: IPersonNameAnchor;
6
+ controlProps?: controlProps;
7
+ }
8
+ /**
9
+ * The anchor form of the person-name type in the form: the gathered top-level fields in the same
10
+ * layout as the group form. Every part renders through QueryControl as the top-level field it is —
11
+ * its own id, required, visibility and value — so nothing about the stored entry changes.
12
+ *
13
+ * The block's label is `custom-attributes.label` of the anchor (a solution translates it through its
14
+ * config), else "Name" — never the anchor's own displayName ("Last name"), the block is the whole name.
15
+ */
16
+ declare const PersonNameBlock: ({ anchor, controlProps }: IProps) => React.JSX.Element;
17
+ export default PersonNameBlock;
@@ -0,0 +1,25 @@
1
+ import React from "react";
2
+ import type { controlProps } from "../../../types/controlProps";
3
+ import { GroupFormControl } from "../../../types";
4
+ export interface IProps {
5
+ id: string;
6
+ control: GroupFormControl;
7
+ objectPathId?: string;
8
+ groupIsRequired?: boolean;
9
+ isInRequiredGroup?: boolean;
10
+ isInGroup?: boolean;
11
+ controlProps?: controlProps;
12
+ tooltip?: string;
13
+ helper?: string;
14
+ }
15
+ /**
16
+ * A person's name as one field (`custom-attributes.type: "personName"`): salutation, title and
17
+ * suffix in a short row, the names below in the field's `nameOrder`. The children keep the idents
18
+ * module-customers uses (salutation, title, firstname, lastname) plus the optional middlename and
19
+ * suffix; the salutation's options come from the solution, so it translates them.
20
+ *
21
+ * Required works like a plain group: a child's own `required` applies once the group is required
22
+ * or any child holds a value — title, middle name and suffix stay optional.
23
+ */
24
+ declare const PersonNameGroup: ({ id, control, objectPathId, groupIsRequired, isInRequiredGroup, isInGroup, controlProps, tooltip, helper, }: IProps) => React.JSX.Element;
25
+ export default PersonNameGroup;
@@ -0,0 +1 @@
1
+ export { default } from "./PersonNameGroup";
@@ -0,0 +1,25 @@
1
+ import type { FormControls } from "../../../types";
2
+ /**
3
+ * The anchor form of the person-name type (COP-4580): `custom-attributes.type: "personName"` on a
4
+ * plain control — usually `lastname` — gathers its sibling fields into one block, while each stays
5
+ * a top-level field of its own (the stored entry keeps its flat keys, so sort fields, searches,
6
+ * scripts and syncs that read `lastname` are untouched). The group form of the type is
7
+ * PersonNameGroup.
8
+ *
9
+ * `custom-attributes.fields` maps a role to another ident ({ "firstname": "firstName" }); without
10
+ * it every role is its own ident.
11
+ */
12
+ export declare const PERSON_NAME_ROLES: readonly ["salutation", "title", "firstname", "middlename", "lastname", "suffix"];
13
+ export type PersonNameRole = (typeof PERSON_NAME_ROLES)[number];
14
+ export interface IPersonNameAnchor {
15
+ anchorKey: string;
16
+ /** role → ident, only roles whose field exists among the siblings */
17
+ fields: Partial<Record<PersonNameRole, string>>;
18
+ }
19
+ export interface IPersonNameAnchorPlan {
20
+ /** The block renders at the first of its fields in declared order. */
21
+ blockAt: Map<string, IPersonNameAnchor>;
22
+ /** Every other field of a block renders nothing at its own position. */
23
+ gathered: Set<string>;
24
+ }
25
+ export declare const planPersonNameAnchors: (controls: FormControls | undefined) => IPersonNameAnchorPlan;
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Where each field of the person-name type (`custom-attributes.type: "personName"`) sits. Kept out
3
+ * of the component so it can be tested without rendering anything; the detail view of
4
+ * service-entity follows the same order when it shows the name.
5
+ *
6
+ * Six columns, so a row can hold two or three equal cells:
7
+ * 1. salutation, title, suffix — short, two columns each
8
+ * 2. the names, in the field's `nameOrder`: given first ("Anna Maria Weber") or family first for
9
+ * Japanese, Chinese, Korean or Hungarian names ("Yamada Taro"); the middle name always follows
10
+ * the given name. The names share the row equally, so a missing middle name leaves no hole.
11
+ * Any field a solution adds gets a full row of its own, in declared order, below.
12
+ */
13
+ export declare const PERSON_NAME_CONTROLS: readonly ["salutation", "title", "suffix", "firstname", "middlename", "lastname"];
14
+ export type NameOrder = "givenFirst" | "familyFirst";
15
+ /** An unknown or missing `nameOrder` is the given name first. */
16
+ export declare const resolveNameOrder: (value: unknown) => NameOrder;
17
+ /** The rows as grid-template-areas strings, only for declared fields. */
18
+ export declare const buildPersonNameRows: (declared: string[], nameOrder: NameOrder) => string[];
19
+ export declare const toGridTemplateAreas: (rows: string[]) => string;
20
+ /** The order the fields are rendered in — the reading and tab order matches the visual one. */
21
+ export declare const renderOrder: (declared: string[], nameOrder: NameOrder) => string[];