@sonata-innovations/fiber-types 1.0.0
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.
- package/dist/calculation.d.ts +10 -0
- package/dist/calculation.d.ts.map +1 -0
- package/dist/calculation.js +4 -0
- package/dist/card-title-migration.d.ts +14 -0
- package/dist/card-title-migration.d.ts.map +1 -0
- package/dist/card-title-migration.js +23 -0
- package/dist/conditions.d.ts +19 -0
- package/dist/conditions.d.ts.map +1 -0
- package/dist/conditions.js +4 -0
- package/dist/config-migration.d.ts +7 -0
- package/dist/config-migration.d.ts.map +1 -0
- package/dist/config-migration.js +63 -0
- package/dist/flow-data.d.ts +39 -0
- package/dist/flow-data.d.ts.map +1 -0
- package/dist/flow-data.js +4 -0
- package/dist/flow.d.ts +60 -0
- package/dist/flow.d.ts.map +1 -0
- package/dist/flow.js +4 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/layout-migration.d.ts +13 -0
- package/dist/layout-migration.d.ts.map +1 -0
- package/dist/layout-migration.js +52 -0
- package/dist/migration.d.ts +8 -0
- package/dist/migration.d.ts.map +1 -0
- package/dist/migration.js +64 -0
- package/dist/money-migration.d.ts +7 -0
- package/dist/money-migration.d.ts.map +1 -0
- package/dist/money-migration.js +22 -0
- package/dist/normalize-options.d.ts +3 -0
- package/dist/normalize-options.d.ts.map +1 -0
- package/dist/normalize-options.js +29 -0
- package/dist/preset-template-data.d.ts +14 -0
- package/dist/preset-template-data.d.ts.map +1 -0
- package/dist/preset-template-data.js +5 -0
- package/dist/properties.d.ts +286 -0
- package/dist/properties.d.ts.map +1 -0
- package/dist/properties.js +4 -0
- package/dist/repeater-migration.d.ts +17 -0
- package/dist/repeater-migration.d.ts.map +1 -0
- package/dist/repeater-migration.js +29 -0
- package/dist/uuid-regeneration.d.ts +12 -0
- package/dist/uuid-regeneration.d.ts.map +1 -0
- package/dist/uuid-regeneration.js +39 -0
- package/dist/validation-migration.d.ts +14 -0
- package/dist/validation-migration.d.ts.map +1 -0
- package/dist/validation-migration.js +35 -0
- package/dist/validation.d.ts +10 -0
- package/dist/validation.d.ts.map +1 -0
- package/dist/validation.js +4 -0
- package/package.json +36 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type CalculationFormat = "number" | "currency" | "percentage";
|
|
2
|
+
export type FlowCalculation = {
|
|
3
|
+
uuid: string;
|
|
4
|
+
label: string;
|
|
5
|
+
formula: string;
|
|
6
|
+
format?: CalculationFormat;
|
|
7
|
+
decimalPlaces?: number;
|
|
8
|
+
currencySymbol?: string;
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=calculation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calculation.d.ts","sourceRoot":"","sources":["../src/calculation.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,iBAAiB,GAAG,QAAQ,GAAG,UAAU,GAAG,YAAY,CAAC;AAErE,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,iBAAiB,CAAC;IAC3B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
interface RawComponent {
|
|
2
|
+
uuid: string;
|
|
3
|
+
type: string;
|
|
4
|
+
properties: Record<string, any>;
|
|
5
|
+
components?: RawComponent[];
|
|
6
|
+
[key: string]: any;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Walks all components and renames `price` → `title` on each cardSelect
|
|
10
|
+
* option. Mutates the input array in place and returns it.
|
|
11
|
+
*/
|
|
12
|
+
export declare function migrateCardSelectTitle<T extends RawComponent>(components: T[]): T[];
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=card-title-migration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"card-title-migration.d.ts","sourceRoot":"","sources":["../src/card-title-migration.ts"],"names":[],"mappings":"AAIA,UAAU,YAAY;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAChC,UAAU,CAAC,EAAE,YAAY,EAAE,CAAC;IAC5B,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,CAAC,SAAS,YAAY,EAAE,UAAU,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE,CAgBnF"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/* ==========================================================================
|
|
2
|
+
Card title migration — renames option.price → option.title on cardSelect
|
|
3
|
+
========================================================================== */
|
|
4
|
+
/**
|
|
5
|
+
* Walks all components and renames `price` → `title` on each cardSelect
|
|
6
|
+
* option. Mutates the input array in place and returns it.
|
|
7
|
+
*/
|
|
8
|
+
export function migrateCardSelectTitle(components) {
|
|
9
|
+
for (const comp of components) {
|
|
10
|
+
if (comp.type === "cardSelect" && Array.isArray(comp.properties?.options)) {
|
|
11
|
+
for (const opt of comp.properties.options) {
|
|
12
|
+
if ("price" in opt && !("title" in opt)) {
|
|
13
|
+
opt.title = opt.price;
|
|
14
|
+
delete opt.price;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
if (comp.components) {
|
|
19
|
+
migrateCardSelectTitle(comp.components);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
return components;
|
|
23
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export type ConditionAction = "show" | "hide";
|
|
2
|
+
export type ConditionLogic = "and" | "or";
|
|
3
|
+
export type ConditionOperator = "equals" | "notEquals" | "contains" | "notContains" | "startsWith" | "endsWith" | "isEmpty" | "isNotEmpty" | "greaterThan" | "greaterThanOrEqual" | "lessThan" | "lessThanOrEqual" | "isOneOf" | "isNotOneOf" | "includesAny" | "includesAll" | "includesNone" | "isTrue" | "isFalse";
|
|
4
|
+
export type ConditionRuleSource = "component" | "context";
|
|
5
|
+
export type ConditionRule = {
|
|
6
|
+
source: string;
|
|
7
|
+
sourceType?: ConditionRuleSource;
|
|
8
|
+
operator: ConditionOperator;
|
|
9
|
+
value?: string | number | boolean | string[] | number[];
|
|
10
|
+
};
|
|
11
|
+
export type ConditionGroup = {
|
|
12
|
+
logic: ConditionLogic;
|
|
13
|
+
rules: ConditionRule[];
|
|
14
|
+
};
|
|
15
|
+
export type FlowConditionConfig = {
|
|
16
|
+
action: ConditionAction;
|
|
17
|
+
when: ConditionGroup;
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=conditions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conditions.d.ts","sourceRoot":"","sources":["../src/conditions.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,MAAM,CAAC;AAE9C,MAAM,MAAM,cAAc,GAAG,KAAK,GAAG,IAAI,CAAC;AAE1C,MAAM,MAAM,iBAAiB,GAEzB,QAAQ,GACR,WAAW,GAEX,UAAU,GACV,aAAa,GACb,YAAY,GACZ,UAAU,GAEV,SAAS,GACT,YAAY,GAEZ,aAAa,GACb,oBAAoB,GACpB,UAAU,GACV,iBAAiB,GAEjB,SAAS,GACT,YAAY,GAEZ,aAAa,GACb,aAAa,GACb,cAAc,GAEd,QAAQ,GACR,SAAS,CAAC;AAEd,MAAM,MAAM,mBAAmB,GAAG,WAAW,GAAG,SAAS,CAAC;AAE1D,MAAM,MAAM,aAAa,GAAG;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,mBAAmB,CAAC;IACjC,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC;CACzD,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,KAAK,EAAE,cAAc,CAAC;IACtB,KAAK,EAAE,aAAa,EAAE,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,MAAM,EAAE,eAAe,CAAC;IACxB,IAAI,EAAE,cAAc,CAAC;CACtB,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { FlowConfiguration } from "./flow";
|
|
2
|
+
/**
|
|
3
|
+
* Detects and migrates an old flat FlowConfiguration to the new nested shape.
|
|
4
|
+
* Passes through already-nested configs unchanged.
|
|
5
|
+
*/
|
|
6
|
+
export declare const migrateConfig: (config: any) => FlowConfiguration;
|
|
7
|
+
//# sourceMappingURL=config-migration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-migration.d.ts","sourceRoot":"","sources":["../src/config-migration.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAC;AAEhD;;;GAGG;AACH,eAAO,MAAM,aAAa,GAAI,QAAQ,GAAG,KAAG,iBAiE3C,CAAC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/* ==========================================================================
|
|
2
|
+
Config migration — old flat FlowConfiguration → new nested structure
|
|
3
|
+
========================================================================== */
|
|
4
|
+
/**
|
|
5
|
+
* Detects and migrates an old flat FlowConfiguration to the new nested shape.
|
|
6
|
+
* Passes through already-nested configs unchanged.
|
|
7
|
+
*/
|
|
8
|
+
export const migrateConfig = (config) => {
|
|
9
|
+
if (!config || typeof config !== "object")
|
|
10
|
+
return {};
|
|
11
|
+
// Detect old flat format by checking for any legacy top-level keys
|
|
12
|
+
const hasLegacyKeys = "themeColor" in config ||
|
|
13
|
+
"darkMode" in config ||
|
|
14
|
+
"style" in config ||
|
|
15
|
+
"transition" in config ||
|
|
16
|
+
"allowInvalidTransition" in config ||
|
|
17
|
+
"showTransitionButtons" in config ||
|
|
18
|
+
"controlsLayout" in config ||
|
|
19
|
+
"showStepper" in config;
|
|
20
|
+
if (!hasLegacyKeys) {
|
|
21
|
+
// Already in new format (or empty) — pass through
|
|
22
|
+
return config;
|
|
23
|
+
}
|
|
24
|
+
const result = {};
|
|
25
|
+
// Theme group
|
|
26
|
+
if (config.themeColor !== undefined ||
|
|
27
|
+
config.darkMode !== undefined ||
|
|
28
|
+
config.style !== undefined) {
|
|
29
|
+
result.theme = {};
|
|
30
|
+
if (config.themeColor !== undefined)
|
|
31
|
+
result.theme.color = config.themeColor;
|
|
32
|
+
if (config.darkMode !== undefined)
|
|
33
|
+
result.theme.darkMode = config.darkMode;
|
|
34
|
+
if (config.style !== undefined)
|
|
35
|
+
result.theme.style = config.style;
|
|
36
|
+
}
|
|
37
|
+
// Navigation group
|
|
38
|
+
if (config.transition !== undefined ||
|
|
39
|
+
config.allowInvalidTransition !== undefined) {
|
|
40
|
+
result.navigation = {};
|
|
41
|
+
if (config.transition !== undefined)
|
|
42
|
+
result.navigation.transition = config.transition;
|
|
43
|
+
if (config.allowInvalidTransition !== undefined)
|
|
44
|
+
result.navigation.allowInvalidTransition =
|
|
45
|
+
config.allowInvalidTransition;
|
|
46
|
+
}
|
|
47
|
+
// Controls group
|
|
48
|
+
if (config.showTransitionButtons !== undefined ||
|
|
49
|
+
config.controlsLayout !== undefined ||
|
|
50
|
+
config.showStepper !== undefined) {
|
|
51
|
+
result.controls = {};
|
|
52
|
+
if (config.showTransitionButtons !== undefined)
|
|
53
|
+
result.controls.show = config.showTransitionButtons;
|
|
54
|
+
if (config.controlsLayout !== undefined)
|
|
55
|
+
result.controls.layout = config.controlsLayout;
|
|
56
|
+
if (config.showStepper !== undefined)
|
|
57
|
+
result.controls.showStepper = config.showStepper;
|
|
58
|
+
}
|
|
59
|
+
// Standalone fields
|
|
60
|
+
if (config.summary !== undefined)
|
|
61
|
+
result.summary = config.summary;
|
|
62
|
+
return result;
|
|
63
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export type FileUploadBase64Data = {
|
|
2
|
+
mode?: "base64";
|
|
3
|
+
name: string;
|
|
4
|
+
type: string;
|
|
5
|
+
size: number;
|
|
6
|
+
lastModified: number;
|
|
7
|
+
lastModifiedData: string;
|
|
8
|
+
data: string;
|
|
9
|
+
};
|
|
10
|
+
export type FileUploadS3Data = {
|
|
11
|
+
mode: "s3";
|
|
12
|
+
fileId: string;
|
|
13
|
+
name: string;
|
|
14
|
+
type: string;
|
|
15
|
+
size: number;
|
|
16
|
+
};
|
|
17
|
+
export type FileUploadData = FileUploadBase64Data | FileUploadS3Data;
|
|
18
|
+
export type RangeValue = {
|
|
19
|
+
start: string;
|
|
20
|
+
end: string;
|
|
21
|
+
};
|
|
22
|
+
export type ComponentData = {
|
|
23
|
+
uuid: string;
|
|
24
|
+
label?: string;
|
|
25
|
+
type: string;
|
|
26
|
+
value: string | string[] | number | number[] | boolean | null | FileUploadData | RangeValue;
|
|
27
|
+
components?: ComponentData[][];
|
|
28
|
+
};
|
|
29
|
+
export type ScreenData = {
|
|
30
|
+
uuid: string;
|
|
31
|
+
label?: string;
|
|
32
|
+
components: ComponentData[];
|
|
33
|
+
};
|
|
34
|
+
export type FlowData = {
|
|
35
|
+
uuid: string;
|
|
36
|
+
metadata: Record<string, string>;
|
|
37
|
+
screens: ScreenData[];
|
|
38
|
+
};
|
|
39
|
+
//# sourceMappingURL=flow-data.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flow-data.d.ts","sourceRoot":"","sources":["../src/flow-data.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,oBAAoB,GAAG;IACjC,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;IACrB,gBAAgB,EAAE,MAAM,CAAC;IACzB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,IAAI,EAAE,IAAI,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,oBAAoB,GAAG,gBAAgB,CAAC;AAErE,MAAM,MAAM,UAAU,GAAG;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EACD,MAAM,GACN,MAAM,EAAE,GACR,MAAM,GACN,MAAM,EAAE,GACR,OAAO,GACP,IAAI,GACJ,cAAc,GACd,UAAU,CAAC;IACf,UAAU,CAAC,EAAE,aAAa,EAAE,EAAE,CAAC;CAChC,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,aAAa,EAAE,CAAC;CAC7B,CAAC;AAEF,MAAM,MAAM,QAAQ,GAAG;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,OAAO,EAAE,UAAU,EAAE,CAAC;CACvB,CAAC"}
|
package/dist/flow.d.ts
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { FlowConditionConfig } from "./conditions";
|
|
2
|
+
import type { FlowCalculation } from "./calculation";
|
|
3
|
+
export type ScreenTransitionType = "none" | "slide" | "fade" | "slideFade" | "rise" | "scaleFade";
|
|
4
|
+
export type FlowStyleType = "clean" | "outlined";
|
|
5
|
+
export type ControlsLayout = "default" | "stacked";
|
|
6
|
+
export type StepperStyle = "default" | "text";
|
|
7
|
+
export type FlowMetadata = Record<string, string> & {
|
|
8
|
+
name?: string;
|
|
9
|
+
description?: string;
|
|
10
|
+
};
|
|
11
|
+
export type ThemeConfig = {
|
|
12
|
+
color?: string;
|
|
13
|
+
darkMode?: boolean;
|
|
14
|
+
style?: FlowStyleType;
|
|
15
|
+
};
|
|
16
|
+
export type NavigationConfig = {
|
|
17
|
+
transition?: ScreenTransitionType;
|
|
18
|
+
allowInvalidTransition?: boolean;
|
|
19
|
+
};
|
|
20
|
+
export type ControlsConfig = {
|
|
21
|
+
show?: boolean;
|
|
22
|
+
layout?: ControlsLayout;
|
|
23
|
+
showStepper?: boolean;
|
|
24
|
+
stepperStyle?: StepperStyle;
|
|
25
|
+
};
|
|
26
|
+
export type FlowConfiguration = {
|
|
27
|
+
theme?: ThemeConfig;
|
|
28
|
+
navigation?: NavigationConfig;
|
|
29
|
+
controls?: ControlsConfig;
|
|
30
|
+
summary?: boolean;
|
|
31
|
+
};
|
|
32
|
+
export type Component = {
|
|
33
|
+
uuid: string;
|
|
34
|
+
type: string;
|
|
35
|
+
properties: ComponentProperties;
|
|
36
|
+
conditions?: FlowConditionConfig;
|
|
37
|
+
components?: Component[];
|
|
38
|
+
value?: any;
|
|
39
|
+
addedComponents?: Component[][];
|
|
40
|
+
valid?: boolean;
|
|
41
|
+
display?: Record<string, any>;
|
|
42
|
+
};
|
|
43
|
+
export type FlowScreen = {
|
|
44
|
+
uuid: string;
|
|
45
|
+
label?: string;
|
|
46
|
+
components: Component[];
|
|
47
|
+
conditions?: FlowConditionConfig | {};
|
|
48
|
+
nextButtonLabel?: string;
|
|
49
|
+
backButtonLabel?: string;
|
|
50
|
+
valid?: boolean;
|
|
51
|
+
};
|
|
52
|
+
export type Flow = {
|
|
53
|
+
uuid: string;
|
|
54
|
+
config?: FlowConfiguration;
|
|
55
|
+
metadata: FlowMetadata;
|
|
56
|
+
screens: FlowScreen[];
|
|
57
|
+
calculations?: FlowCalculation[];
|
|
58
|
+
};
|
|
59
|
+
export type ComponentProperties = Record<string, any>;
|
|
60
|
+
//# sourceMappingURL=flow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flow.d.ts","sourceRoot":"","sources":["../src/flow.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACxD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAErD,MAAM,MAAM,oBAAoB,GAC5B,MAAM,GACN,OAAO,GACP,MAAM,GACN,WAAW,GACX,MAAM,GACN,WAAW,CAAC;AAEhB,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,UAAU,CAAC;AAEjD,MAAM,MAAM,cAAc,GAAG,SAAS,GAAG,SAAS,CAAC;AAEnD,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,MAAM,CAAC;AAE9C,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG;IAClD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,aAAa,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,UAAU,CAAC,EAAE,oBAAoB,CAAC;IAClC,sBAAsB,CAAC,EAAE,OAAO,CAAC;CAClC,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB,WAAW,CAAC,EAA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EAAE,GAAG,CAAC,CAAC"}
|
package/dist/flow.js
ADDED
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type { Flow, FlowScreen, FlowConfiguration, ThemeConfig, NavigationConfig, ControlsConfig, FlowMetadata, Component, ComponentProperties, ScreenTransitionType, FlowStyleType, ControlsLayout, StepperStyle, } from "./flow";
|
|
2
|
+
export type { ConditionAction, ConditionLogic, ConditionOperator, ConditionRule, ConditionRuleSource, ConditionGroup, FlowConditionConfig, } from "./conditions";
|
|
3
|
+
export type { ValidationRuleType, ValidationRule, FlowValidationConfig, } from "./validation";
|
|
4
|
+
export { normalizeOptions } from "./normalize-options";
|
|
5
|
+
export type { FlowData, ScreenData, ComponentData, FileUploadData, FileUploadBase64Data, FileUploadS3Data, RangeValue, } from "./flow-data";
|
|
6
|
+
export { regenerateComponentUUIDs, regenerateFlowUUIDs, } from "./uuid-regeneration";
|
|
7
|
+
export type { PresetData, TemplateData } from "./preset-template-data";
|
|
8
|
+
export type { CalculationFormat, FlowCalculation, } from "./calculation";
|
|
9
|
+
export type { ComponentWidth, DateFormat, ComponentInputType, ComponentDisplayProperties, ComponentDividerProperties, ComponentInputProperties, OptionItem, ComponentOptionProperties, ComponentSliderProperties, ComponentSwitchProperties, ComponentRatingProperties, ComponentFileUploadProperties, ComponentGroupProperties, ComponentRepeaterProperties, ComponentDateProperties, ComponentTimeProperties, ComponentDateTimeProperties, ComponentDateRangeProperties, ComponentTimeRangeProperties, ComponentDateTimeRangeProperties, ComponentYesNoProperties, ComponentColorPickerProperties, CardSelectOption, ComponentCardSelectProperties, ComponentCalloutVariant, ComponentCalloutProperties, TableColumn, TableRow, ComponentTableProperties, SignatureMode, ComponentSignatureProperties, ComponentComputedProperties, } from "./properties";
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAA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AM,cAAc,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ComponentWidth } from "./properties";
|
|
2
|
+
/**
|
|
3
|
+
* Maps a percentage weight to the nearest named ComponentWidth.
|
|
4
|
+
*/
|
|
5
|
+
export declare const weightToWidth: (weight: number) => ComponentWidth;
|
|
6
|
+
/**
|
|
7
|
+
* Parses an old group layout string (e.g. "2: 50,50" or "1: 100; 2: 50,50")
|
|
8
|
+
* and returns an array of ComponentWidth values, one per child component.
|
|
9
|
+
*
|
|
10
|
+
* Returns null if the layout string is empty or unparseable.
|
|
11
|
+
*/
|
|
12
|
+
export declare const migrateLayout: (layout: string, childCount: number) => ComponentWidth[] | null;
|
|
13
|
+
//# sourceMappingURL=layout-migration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layout-migration.d.ts","sourceRoot":"","sources":["../src/layout-migration.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAEnD;;GAEG;AACH,eAAO,MAAM,aAAa,GAAI,QAAQ,MAAM,KAAG,cAO9C,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,aAAa,GACxB,QAAQ,MAAM,EACd,YAAY,MAAM,KACjB,cAAc,EAAE,GAAG,IA4BrB,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/* ==========================================================================
|
|
2
|
+
Layout migration — old group layout string → per-component widths
|
|
3
|
+
========================================================================== */
|
|
4
|
+
/**
|
|
5
|
+
* Maps a percentage weight to the nearest named ComponentWidth.
|
|
6
|
+
*/
|
|
7
|
+
export const weightToWidth = (weight) => {
|
|
8
|
+
if (weight >= 90)
|
|
9
|
+
return "full";
|
|
10
|
+
if (weight >= 62)
|
|
11
|
+
return "two-thirds";
|
|
12
|
+
if (weight >= 45)
|
|
13
|
+
return "half";
|
|
14
|
+
if (weight >= 30)
|
|
15
|
+
return "third";
|
|
16
|
+
if (weight >= 20)
|
|
17
|
+
return "quarter";
|
|
18
|
+
return "quarter";
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Parses an old group layout string (e.g. "2: 50,50" or "1: 100; 2: 50,50")
|
|
22
|
+
* and returns an array of ComponentWidth values, one per child component.
|
|
23
|
+
*
|
|
24
|
+
* Returns null if the layout string is empty or unparseable.
|
|
25
|
+
*/
|
|
26
|
+
export const migrateLayout = (layout, childCount) => {
|
|
27
|
+
if (!layout || !layout.trim())
|
|
28
|
+
return null;
|
|
29
|
+
try {
|
|
30
|
+
const rows = layout.split(/[;|]\s*/).filter((r) => r.trim().length > 0);
|
|
31
|
+
const widths = [];
|
|
32
|
+
for (const row of rows) {
|
|
33
|
+
const parts = row.split(/:\s*/);
|
|
34
|
+
if (parts.length < 2)
|
|
35
|
+
continue;
|
|
36
|
+
const weights = parts[1].split(",").map((w) => parseFloat(w.trim()));
|
|
37
|
+
for (const w of weights) {
|
|
38
|
+
if (!isNaN(w)) {
|
|
39
|
+
widths.push(weightToWidth(w));
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
// Pad or trim to match childCount
|
|
44
|
+
while (widths.length < childCount) {
|
|
45
|
+
widths.push("full");
|
|
46
|
+
}
|
|
47
|
+
return widths.slice(0, childCount);
|
|
48
|
+
}
|
|
49
|
+
catch {
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { FlowConditionConfig } from "./conditions";
|
|
2
|
+
import type { FlowConditions } from "./flow";
|
|
3
|
+
/**
|
|
4
|
+
* Converts a legacy FlowConditions object to the new FlowConditionConfig format.
|
|
5
|
+
* Returns null if the input is empty or invalid.
|
|
6
|
+
*/
|
|
7
|
+
export declare const migrateCondition: (old: FlowConditions | Record<string, never> | undefined) => FlowConditionConfig | null;
|
|
8
|
+
//# sourceMappingURL=migration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migration.d.ts","sourceRoot":"","sources":["../src/migration.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,mBAAmB,EAGpB,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AAoB7C;;;GAGG;AACH,eAAO,MAAM,gBAAgB,GAC3B,KAAK,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,GAAG,SAAS,KACtD,mBAAmB,GAAG,IA+CxB,CAAC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/* ==========================================================================
|
|
2
|
+
Condition migration — old FlowConditions → new FlowConditionConfig
|
|
3
|
+
========================================================================== */
|
|
4
|
+
const TEST_TO_OPERATOR = {
|
|
5
|
+
equals: "equals",
|
|
6
|
+
notEquals: "notEquals",
|
|
7
|
+
contains: "contains",
|
|
8
|
+
option: "isOneOf",
|
|
9
|
+
optionMulti: "includesAny",
|
|
10
|
+
atleast: "greaterThanOrEqual",
|
|
11
|
+
atmost: "lessThanOrEqual",
|
|
12
|
+
};
|
|
13
|
+
const SET_OPERATORS = new Set([
|
|
14
|
+
"isOneOf",
|
|
15
|
+
"isNotOneOf",
|
|
16
|
+
"includesAny",
|
|
17
|
+
"includesAll",
|
|
18
|
+
"includesNone",
|
|
19
|
+
]);
|
|
20
|
+
/**
|
|
21
|
+
* Converts a legacy FlowConditions object to the new FlowConditionConfig format.
|
|
22
|
+
* Returns null if the input is empty or invalid.
|
|
23
|
+
*/
|
|
24
|
+
export const migrateCondition = (old) => {
|
|
25
|
+
if (!old ||
|
|
26
|
+
!("action" in old) ||
|
|
27
|
+
!("condition" in old) ||
|
|
28
|
+
!("component" in old)) {
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
// Resolve source UUID
|
|
32
|
+
const source = typeof old.component === "string"
|
|
33
|
+
? old.component
|
|
34
|
+
: (old.component?.data?.uuid ?? "");
|
|
35
|
+
if (!source)
|
|
36
|
+
return null;
|
|
37
|
+
// Map test to operator
|
|
38
|
+
const operator = TEST_TO_OPERATOR[old.condition.test] ?? "equals";
|
|
39
|
+
// Convert value — set operators get arrays
|
|
40
|
+
let value;
|
|
41
|
+
const rawValue = old.condition.value;
|
|
42
|
+
if (SET_OPERATORS.has(operator)) {
|
|
43
|
+
if (Array.isArray(rawValue)) {
|
|
44
|
+
value = rawValue;
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
value = String(rawValue)
|
|
48
|
+
.split(",")
|
|
49
|
+
.map((v) => v.trim());
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
value = rawValue;
|
|
54
|
+
}
|
|
55
|
+
// Map action
|
|
56
|
+
const action = old.action === "hide" ? "hide" : "show";
|
|
57
|
+
return {
|
|
58
|
+
action,
|
|
59
|
+
when: {
|
|
60
|
+
logic: "and",
|
|
61
|
+
rules: [{ source, operator, value }],
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Component } from "./flow";
|
|
2
|
+
/**
|
|
3
|
+
* Migrates an `inputMoney` component to `inputNumber` with `decimalPlaces: 2`.
|
|
4
|
+
* Returns the migrated component, or `null` if the component is not `inputMoney`.
|
|
5
|
+
*/
|
|
6
|
+
export declare function migrateInputMoney(component: Component): Component | null;
|
|
7
|
+
//# sourceMappingURL=money-migration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"money-migration.d.ts","sourceRoot":"","sources":["../src/money-migration.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAExC;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,SAAS,GAAG,SAAS,GAAG,IAAI,CAaxE"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/* ==========================================================================
|
|
2
|
+
inputMoney → inputNumber migration
|
|
3
|
+
========================================================================== */
|
|
4
|
+
/**
|
|
5
|
+
* Migrates an `inputMoney` component to `inputNumber` with `decimalPlaces: 2`.
|
|
6
|
+
* Returns the migrated component, or `null` if the component is not `inputMoney`.
|
|
7
|
+
*/
|
|
8
|
+
export function migrateInputMoney(component) {
|
|
9
|
+
if (component.type !== "inputMoney")
|
|
10
|
+
return null;
|
|
11
|
+
const props = component.properties ?? {};
|
|
12
|
+
return {
|
|
13
|
+
...component,
|
|
14
|
+
type: "inputNumber",
|
|
15
|
+
properties: {
|
|
16
|
+
...props,
|
|
17
|
+
startAdornment: props.startAdornment ?? "$",
|
|
18
|
+
decimalPlaces: 2,
|
|
19
|
+
placeholder: props.placeholder || "0.00",
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normalize-options.d.ts","sourceRoot":"","sources":["../src/normalize-options.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAS/C,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,UAAU,EAAE,CAiBjE"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/* ==========================================================================
|
|
2
|
+
Normalize options — converts mixed string/object arrays to OptionItem[]
|
|
3
|
+
========================================================================== */
|
|
4
|
+
function toValue(label) {
|
|
5
|
+
return label
|
|
6
|
+
.toLowerCase()
|
|
7
|
+
.replace(/\s+/g, "-")
|
|
8
|
+
.replace(/[^a-z0-9-]/g, "");
|
|
9
|
+
}
|
|
10
|
+
export function normalizeOptions(options) {
|
|
11
|
+
return options.map((o) => {
|
|
12
|
+
if (typeof o === "string")
|
|
13
|
+
return { label: o, value: toValue(o) };
|
|
14
|
+
if (typeof o === "number")
|
|
15
|
+
return { label: String(o), value: o };
|
|
16
|
+
const item = o;
|
|
17
|
+
// Spread all source properties so extended types (CardSelectOption, etc.)
|
|
18
|
+
// retain their extra fields (description, title, badge, icon, features).
|
|
19
|
+
const result = {
|
|
20
|
+
...o,
|
|
21
|
+
label: item.label,
|
|
22
|
+
value: item.value,
|
|
23
|
+
};
|
|
24
|
+
if (item.metadata && typeof item.metadata === "object") {
|
|
25
|
+
result.metadata = item.metadata;
|
|
26
|
+
}
|
|
27
|
+
return result;
|
|
28
|
+
});
|
|
29
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Component, Flow } from "./flow";
|
|
2
|
+
export type PresetData = {
|
|
3
|
+
type: string;
|
|
4
|
+
label: string;
|
|
5
|
+
icon: string;
|
|
6
|
+
components: Component[];
|
|
7
|
+
};
|
|
8
|
+
export type TemplateData = {
|
|
9
|
+
type: string;
|
|
10
|
+
label: string;
|
|
11
|
+
icon: string;
|
|
12
|
+
flow: Flow;
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=preset-template-data.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preset-template-data.d.ts","sourceRoot":"","sources":["../src/preset-template-data.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAE9C,MAAM,MAAM,UAAU,GAAG;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,SAAS,EAAE,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,IAAI,CAAC;CACZ,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/* ==========================================================================
|
|
2
|
+
Pure-data preset/template types — serializable alternatives to factory-based
|
|
3
|
+
definitions. Used for server-side storage and data-based definitions.
|
|
4
|
+
========================================================================== */
|
|
5
|
+
export {};
|
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
import type { FlowValidationConfig } from "./validation";
|
|
2
|
+
import type { CalculationFormat } from "./calculation";
|
|
3
|
+
export type ComponentWidth = "full" | "half" | "third" | "two-thirds" | "quarter" | "three-quarters";
|
|
4
|
+
export type DateFormat = "MM/DD/YYYY" | "DD/MM/YYYY" | "YYYY-MM-DD";
|
|
5
|
+
export type ComponentDisplayProperties = {
|
|
6
|
+
value: string;
|
|
7
|
+
width?: ComponentWidth;
|
|
8
|
+
};
|
|
9
|
+
export type ComponentDividerProperties = {
|
|
10
|
+
value?: string;
|
|
11
|
+
textAlign?: "left" | "right" | "center";
|
|
12
|
+
width?: ComponentWidth;
|
|
13
|
+
};
|
|
14
|
+
export type ComponentInputProperties = {
|
|
15
|
+
label: string;
|
|
16
|
+
required?: boolean;
|
|
17
|
+
placeholder?: string;
|
|
18
|
+
detail?: string;
|
|
19
|
+
showLabel?: boolean;
|
|
20
|
+
helperText?: string;
|
|
21
|
+
regex?: string;
|
|
22
|
+
maxlength?: number;
|
|
23
|
+
startAdornment?: string;
|
|
24
|
+
decimalPlaces?: number;
|
|
25
|
+
inputType?: ComponentInputType;
|
|
26
|
+
readOnly?: boolean;
|
|
27
|
+
tooltip?: string;
|
|
28
|
+
autocomplete?: string;
|
|
29
|
+
showPasswordToggle?: boolean;
|
|
30
|
+
validation?: FlowValidationConfig;
|
|
31
|
+
width?: ComponentWidth;
|
|
32
|
+
};
|
|
33
|
+
export type OptionItem = {
|
|
34
|
+
label: string;
|
|
35
|
+
value: string | number;
|
|
36
|
+
metadata?: Record<string, string | number | boolean>;
|
|
37
|
+
};
|
|
38
|
+
export type ComponentOptionProperties = {
|
|
39
|
+
label: string;
|
|
40
|
+
required?: boolean;
|
|
41
|
+
detail?: string;
|
|
42
|
+
showLabel?: boolean;
|
|
43
|
+
helperText?: string;
|
|
44
|
+
options: OptionItem[];
|
|
45
|
+
readOnly?: boolean;
|
|
46
|
+
tooltip?: string;
|
|
47
|
+
validation?: FlowValidationConfig;
|
|
48
|
+
width?: ComponentWidth;
|
|
49
|
+
};
|
|
50
|
+
export type ComponentSliderProperties = {
|
|
51
|
+
label: string;
|
|
52
|
+
detail?: string;
|
|
53
|
+
showLabel?: boolean;
|
|
54
|
+
helperText?: string;
|
|
55
|
+
min?: number;
|
|
56
|
+
max?: number;
|
|
57
|
+
marks?: boolean;
|
|
58
|
+
steps?: number;
|
|
59
|
+
initValue?: number;
|
|
60
|
+
readOnly?: boolean;
|
|
61
|
+
required?: boolean;
|
|
62
|
+
tooltip?: string;
|
|
63
|
+
width?: ComponentWidth;
|
|
64
|
+
};
|
|
65
|
+
export type ComponentSwitchProperties = {
|
|
66
|
+
label: string;
|
|
67
|
+
detail?: string;
|
|
68
|
+
showLabel?: boolean;
|
|
69
|
+
helperText?: string;
|
|
70
|
+
tooltip?: string;
|
|
71
|
+
width?: ComponentWidth;
|
|
72
|
+
};
|
|
73
|
+
export type ComponentRatingProperties = {
|
|
74
|
+
label: string;
|
|
75
|
+
detail?: string;
|
|
76
|
+
showLabel?: boolean;
|
|
77
|
+
helperText?: string;
|
|
78
|
+
max: number;
|
|
79
|
+
precision: number;
|
|
80
|
+
icon?: string;
|
|
81
|
+
required?: boolean;
|
|
82
|
+
tooltip?: string;
|
|
83
|
+
validation?: FlowValidationConfig;
|
|
84
|
+
width?: ComponentWidth;
|
|
85
|
+
};
|
|
86
|
+
export type ComponentFileUploadProperties = {
|
|
87
|
+
label: string;
|
|
88
|
+
detail?: string;
|
|
89
|
+
showLabel?: boolean;
|
|
90
|
+
accept: string;
|
|
91
|
+
required?: boolean;
|
|
92
|
+
helperText?: string;
|
|
93
|
+
maxSize?: number;
|
|
94
|
+
tooltip?: string;
|
|
95
|
+
validation?: FlowValidationConfig;
|
|
96
|
+
width?: ComponentWidth;
|
|
97
|
+
};
|
|
98
|
+
export type ComponentGroupProperties = {
|
|
99
|
+
label?: string;
|
|
100
|
+
showLabel?: boolean;
|
|
101
|
+
collapsible?: boolean;
|
|
102
|
+
width?: ComponentWidth;
|
|
103
|
+
};
|
|
104
|
+
export type ComponentRepeaterProperties = {
|
|
105
|
+
label?: string;
|
|
106
|
+
showLabel?: boolean;
|
|
107
|
+
collapsible?: boolean;
|
|
108
|
+
minIterations?: number;
|
|
109
|
+
initialData?: Array<Record<string, any>>;
|
|
110
|
+
width?: ComponentWidth;
|
|
111
|
+
};
|
|
112
|
+
export type ComponentInputType = "text" | "email" | "tel" | "url" | "password";
|
|
113
|
+
export type ComponentDateProperties = {
|
|
114
|
+
label: string;
|
|
115
|
+
detail?: string;
|
|
116
|
+
showLabel?: boolean;
|
|
117
|
+
helperText?: string;
|
|
118
|
+
tooltip?: string;
|
|
119
|
+
placeholder?: string;
|
|
120
|
+
min?: string;
|
|
121
|
+
max?: string;
|
|
122
|
+
dateFormat?: DateFormat;
|
|
123
|
+
readOnly?: boolean;
|
|
124
|
+
validation?: FlowValidationConfig;
|
|
125
|
+
width?: ComponentWidth;
|
|
126
|
+
};
|
|
127
|
+
export type ComponentTimeProperties = {
|
|
128
|
+
label: string;
|
|
129
|
+
detail?: string;
|
|
130
|
+
showLabel?: boolean;
|
|
131
|
+
helperText?: string;
|
|
132
|
+
tooltip?: string;
|
|
133
|
+
placeholder?: string;
|
|
134
|
+
min?: string;
|
|
135
|
+
max?: string;
|
|
136
|
+
readOnly?: boolean;
|
|
137
|
+
step?: number;
|
|
138
|
+
validation?: FlowValidationConfig;
|
|
139
|
+
width?: ComponentWidth;
|
|
140
|
+
};
|
|
141
|
+
export type ComponentDateTimeProperties = {
|
|
142
|
+
label: string;
|
|
143
|
+
detail?: string;
|
|
144
|
+
showLabel?: boolean;
|
|
145
|
+
helperText?: string;
|
|
146
|
+
tooltip?: string;
|
|
147
|
+
placeholder?: string;
|
|
148
|
+
min?: string;
|
|
149
|
+
max?: string;
|
|
150
|
+
dateFormat?: DateFormat;
|
|
151
|
+
minTime?: string;
|
|
152
|
+
maxTime?: string;
|
|
153
|
+
readOnly?: boolean;
|
|
154
|
+
step?: number;
|
|
155
|
+
validation?: FlowValidationConfig;
|
|
156
|
+
width?: ComponentWidth;
|
|
157
|
+
};
|
|
158
|
+
export type ComponentDateRangeProperties = {
|
|
159
|
+
label: string;
|
|
160
|
+
detail?: string;
|
|
161
|
+
showLabel?: boolean;
|
|
162
|
+
helperText?: string;
|
|
163
|
+
tooltip?: string;
|
|
164
|
+
placeholderStart?: string;
|
|
165
|
+
placeholderEnd?: string;
|
|
166
|
+
min?: string;
|
|
167
|
+
max?: string;
|
|
168
|
+
dateFormat?: DateFormat;
|
|
169
|
+
validation?: FlowValidationConfig;
|
|
170
|
+
width?: ComponentWidth;
|
|
171
|
+
};
|
|
172
|
+
export type ComponentTimeRangeProperties = {
|
|
173
|
+
label: string;
|
|
174
|
+
detail?: string;
|
|
175
|
+
showLabel?: boolean;
|
|
176
|
+
helperText?: string;
|
|
177
|
+
tooltip?: string;
|
|
178
|
+
placeholderStart?: string;
|
|
179
|
+
placeholderEnd?: string;
|
|
180
|
+
min?: string;
|
|
181
|
+
max?: string;
|
|
182
|
+
step?: number;
|
|
183
|
+
validation?: FlowValidationConfig;
|
|
184
|
+
width?: ComponentWidth;
|
|
185
|
+
};
|
|
186
|
+
export type ComponentDateTimeRangeProperties = {
|
|
187
|
+
label: string;
|
|
188
|
+
detail?: string;
|
|
189
|
+
showLabel?: boolean;
|
|
190
|
+
helperText?: string;
|
|
191
|
+
tooltip?: string;
|
|
192
|
+
placeholderStart?: string;
|
|
193
|
+
placeholderEnd?: string;
|
|
194
|
+
min?: string;
|
|
195
|
+
max?: string;
|
|
196
|
+
dateFormat?: DateFormat;
|
|
197
|
+
minTime?: string;
|
|
198
|
+
maxTime?: string;
|
|
199
|
+
step?: number;
|
|
200
|
+
validation?: FlowValidationConfig;
|
|
201
|
+
width?: ComponentWidth;
|
|
202
|
+
};
|
|
203
|
+
export type ComponentYesNoProperties = {
|
|
204
|
+
label: string;
|
|
205
|
+
detail?: string;
|
|
206
|
+
showLabel?: boolean;
|
|
207
|
+
helperText?: string;
|
|
208
|
+
tooltip?: string;
|
|
209
|
+
labelYes?: string;
|
|
210
|
+
labelNo?: string;
|
|
211
|
+
validation?: FlowValidationConfig;
|
|
212
|
+
width?: ComponentWidth;
|
|
213
|
+
};
|
|
214
|
+
export type ComponentColorPickerProperties = {
|
|
215
|
+
label: string;
|
|
216
|
+
detail?: string;
|
|
217
|
+
showLabel?: boolean;
|
|
218
|
+
helperText?: string;
|
|
219
|
+
tooltip?: string;
|
|
220
|
+
swatches?: string[];
|
|
221
|
+
defaultValue?: string;
|
|
222
|
+
validation?: FlowValidationConfig;
|
|
223
|
+
width?: ComponentWidth;
|
|
224
|
+
};
|
|
225
|
+
export type CardSelectOption = {
|
|
226
|
+
label: string;
|
|
227
|
+
value: string;
|
|
228
|
+
description?: string;
|
|
229
|
+
title?: string;
|
|
230
|
+
features?: string[];
|
|
231
|
+
badge?: string;
|
|
232
|
+
metadata?: Record<string, string | number | boolean>;
|
|
233
|
+
};
|
|
234
|
+
export type ComponentCardSelectProperties = {
|
|
235
|
+
label: string;
|
|
236
|
+
showLabel?: boolean;
|
|
237
|
+
options: CardSelectOption[];
|
|
238
|
+
columns?: number;
|
|
239
|
+
validation?: FlowValidationConfig;
|
|
240
|
+
width?: ComponentWidth;
|
|
241
|
+
};
|
|
242
|
+
export type ComponentCalloutVariant = "info" | "success" | "warning" | "neutral";
|
|
243
|
+
export type ComponentCalloutProperties = {
|
|
244
|
+
value: string;
|
|
245
|
+
title?: string;
|
|
246
|
+
variant?: ComponentCalloutVariant;
|
|
247
|
+
icon?: string;
|
|
248
|
+
width?: ComponentWidth;
|
|
249
|
+
};
|
|
250
|
+
export type TableColumn = {
|
|
251
|
+
label: string;
|
|
252
|
+
};
|
|
253
|
+
export type TableRow = {
|
|
254
|
+
label: string;
|
|
255
|
+
values: string[];
|
|
256
|
+
};
|
|
257
|
+
export type ComponentTableProperties = {
|
|
258
|
+
label?: string;
|
|
259
|
+
columns: TableColumn[];
|
|
260
|
+
rows: TableRow[];
|
|
261
|
+
highlightColumn?: number;
|
|
262
|
+
width?: ComponentWidth;
|
|
263
|
+
};
|
|
264
|
+
export type SignatureMode = "draw" | "type" | "both";
|
|
265
|
+
export type ComponentSignatureProperties = {
|
|
266
|
+
label?: string;
|
|
267
|
+
showLabel?: boolean;
|
|
268
|
+
detail?: string;
|
|
269
|
+
helperText?: string;
|
|
270
|
+
mode?: SignatureMode;
|
|
271
|
+
required?: boolean;
|
|
272
|
+
tooltip?: string;
|
|
273
|
+
validation?: FlowValidationConfig;
|
|
274
|
+
width?: ComponentWidth;
|
|
275
|
+
};
|
|
276
|
+
export type ComponentComputedProperties = {
|
|
277
|
+
label: string;
|
|
278
|
+
formula: string;
|
|
279
|
+
format?: CalculationFormat;
|
|
280
|
+
decimalPlaces?: number;
|
|
281
|
+
currencySymbol?: string;
|
|
282
|
+
showLabel?: boolean;
|
|
283
|
+
detail?: string;
|
|
284
|
+
width?: ComponentWidth;
|
|
285
|
+
};
|
|
286
|
+
//# sourceMappingURL=properties.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"properties.d.ts","sourceRoot":"","sources":["../src/properties.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACzD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAEvD,MAAM,MAAM,cAAc,GACtB,MAAM,GACN,MAAM,GACN,OAAO,GACP,YAAY,GACZ,SAAS,GACT,gBAAgB,CAAC;AAErB,MAAM,MAAM,UAAU,GAAG,YAAY,GAAG,YAAY,GAAG,YAAY,CAAC;AAEpE,MAAM,MAAM,0BAA0B,GAAG;IACvC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,cAAc,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG;IACvC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,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AC;CACxB,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;AAErD,MAAM,MAAM,4BAA4B,GAAG;IACzC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,aAAa,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,oBAAoB,CAAC;IAClC,KAAK,CAAC,EAAE,cAAc,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,2BAA2B,GAAG;IACxC,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,iBAAiB,CAAC;IAC3B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,cAAc,CAAC;CACxB,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
interface RawComponent {
|
|
2
|
+
uuid: string;
|
|
3
|
+
type: string;
|
|
4
|
+
properties: Record<string, any>;
|
|
5
|
+
components?: RawComponent[];
|
|
6
|
+
[key: string]: any;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Walks all components in a flow and converts any `group` component with
|
|
10
|
+
* `repeatable: true` into `type: "repeater"`, stripping the `repeatable`
|
|
11
|
+
* property. Also strips `repeatable` from non-repeatable groups (cleanup).
|
|
12
|
+
*
|
|
13
|
+
* Mutates the input array in place and returns it.
|
|
14
|
+
*/
|
|
15
|
+
export declare function migrateRepeater<T extends RawComponent>(components: T[]): T[];
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=repeater-migration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repeater-migration.d.ts","sourceRoot":"","sources":["../src/repeater-migration.ts"],"names":[],"mappings":"AAIA,UAAU,YAAY;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAChC,UAAU,CAAC,EAAE,YAAY,EAAE,CAAC;IAC5B,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,CAAC,SAAS,YAAY,EAAE,UAAU,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE,CAkB5E"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/* ==========================================================================
|
|
2
|
+
Repeater migration — converts group with repeatable: true → repeater type
|
|
3
|
+
========================================================================== */
|
|
4
|
+
/**
|
|
5
|
+
* Walks all components in a flow and converts any `group` component with
|
|
6
|
+
* `repeatable: true` into `type: "repeater"`, stripping the `repeatable`
|
|
7
|
+
* property. Also strips `repeatable` from non-repeatable groups (cleanup).
|
|
8
|
+
*
|
|
9
|
+
* Mutates the input array in place and returns it.
|
|
10
|
+
*/
|
|
11
|
+
export function migrateRepeater(components) {
|
|
12
|
+
for (const comp of components) {
|
|
13
|
+
if (comp.type === "group" && comp.properties?.repeatable) {
|
|
14
|
+
comp.type = "repeater";
|
|
15
|
+
const { repeatable: _, ...rest } = comp.properties;
|
|
16
|
+
comp.properties = rest;
|
|
17
|
+
}
|
|
18
|
+
else if (comp.type === "group" && "repeatable" in (comp.properties ?? {})) {
|
|
19
|
+
// Clean up `repeatable: false` from groups
|
|
20
|
+
const { repeatable: _, ...rest } = comp.properties;
|
|
21
|
+
comp.properties = rest;
|
|
22
|
+
}
|
|
23
|
+
// Recurse into children (groups/repeaters inside groups/repeaters)
|
|
24
|
+
if (comp.components) {
|
|
25
|
+
migrateRepeater(comp.components);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return components;
|
|
29
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Component, Flow } from "./flow";
|
|
2
|
+
/**
|
|
3
|
+
* Deep-clones an array of components and replaces every `uuid`
|
|
4
|
+
* (including recursively within group `components`).
|
|
5
|
+
*/
|
|
6
|
+
export declare function regenerateComponentUUIDs(components: Component[]): Component[];
|
|
7
|
+
/**
|
|
8
|
+
* Deep-clones a flow and replaces the flow UUID, every screen UUID,
|
|
9
|
+
* and every component UUID (recursively).
|
|
10
|
+
*/
|
|
11
|
+
export declare function regenerateFlowUUIDs(flow: Flow): Flow;
|
|
12
|
+
//# sourceMappingURL=uuid-regeneration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"uuid-regeneration.d.ts","sourceRoot":"","sources":["../src/uuid-regeneration.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAE9C;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,UAAU,EAAE,SAAS,EAAE,GAAG,SAAS,EAAE,CAe7E;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,CAYpD"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/* ==========================================================================
|
|
2
|
+
UUID regeneration — deep-clone components/flows and replace all UUIDs.
|
|
3
|
+
Used when dropping stored presets/templates onto the stage.
|
|
4
|
+
========================================================================== */
|
|
5
|
+
/**
|
|
6
|
+
* Deep-clones an array of components and replaces every `uuid`
|
|
7
|
+
* (including recursively within group `components`).
|
|
8
|
+
*/
|
|
9
|
+
export function regenerateComponentUUIDs(components) {
|
|
10
|
+
return components.map((comp) => {
|
|
11
|
+
const cloned = {
|
|
12
|
+
...comp,
|
|
13
|
+
uuid: crypto.randomUUID(),
|
|
14
|
+
properties: structuredClone(comp.properties),
|
|
15
|
+
};
|
|
16
|
+
// Recurse into group children
|
|
17
|
+
if (comp.components) {
|
|
18
|
+
cloned.components = regenerateComponentUUIDs(comp.components);
|
|
19
|
+
}
|
|
20
|
+
return cloned;
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Deep-clones a flow and replaces the flow UUID, every screen UUID,
|
|
25
|
+
* and every component UUID (recursively).
|
|
26
|
+
*/
|
|
27
|
+
export function regenerateFlowUUIDs(flow) {
|
|
28
|
+
return {
|
|
29
|
+
...flow,
|
|
30
|
+
uuid: crypto.randomUUID(),
|
|
31
|
+
metadata: { ...flow.metadata },
|
|
32
|
+
config: flow.config ? { ...flow.config } : undefined,
|
|
33
|
+
screens: flow.screens.map((screen) => ({
|
|
34
|
+
...screen,
|
|
35
|
+
uuid: crypto.randomUUID(),
|
|
36
|
+
components: regenerateComponentUUIDs(screen.components),
|
|
37
|
+
})),
|
|
38
|
+
};
|
|
39
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { FlowValidationConfig } from "./validation";
|
|
2
|
+
/**
|
|
3
|
+
* Converts legacy flat validation properties (required, regex) into the new
|
|
4
|
+
* FlowValidationConfig format. Returns null if nothing to migrate.
|
|
5
|
+
*
|
|
6
|
+
* When a migration is performed, the result contains:
|
|
7
|
+
* - `validation`: the new FlowValidationConfig
|
|
8
|
+
* - `cleanedProperties`: the original properties with `required` and `regex` removed
|
|
9
|
+
*/
|
|
10
|
+
export declare const migrateValidation: (properties: Record<string, any>) => {
|
|
11
|
+
validation: FlowValidationConfig;
|
|
12
|
+
cleanedProperties: Record<string, any>;
|
|
13
|
+
} | null;
|
|
14
|
+
//# sourceMappingURL=validation-migration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation-migration.d.ts","sourceRoot":"","sources":["../src/validation-migration.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,oBAAoB,EAAkB,MAAM,cAAc,CAAC;AAEzE;;;;;;;GAOG;AACH,eAAO,MAAM,iBAAiB,GAC5B,YAAY,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAC9B;IACD,UAAU,EAAE,oBAAoB,CAAC;IACjC,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CACxC,GAAG,IA4BH,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/* ==========================================================================
|
|
2
|
+
Validation migration — old required/regex → new FlowValidationConfig
|
|
3
|
+
========================================================================== */
|
|
4
|
+
/**
|
|
5
|
+
* Converts legacy flat validation properties (required, regex) into the new
|
|
6
|
+
* FlowValidationConfig format. Returns null if nothing to migrate.
|
|
7
|
+
*
|
|
8
|
+
* When a migration is performed, the result contains:
|
|
9
|
+
* - `validation`: the new FlowValidationConfig
|
|
10
|
+
* - `cleanedProperties`: the original properties with `required` and `regex` removed
|
|
11
|
+
*/
|
|
12
|
+
export const migrateValidation = (properties) => {
|
|
13
|
+
const hasRequired = "required" in properties && properties.required === true;
|
|
14
|
+
const hasRegex = "regex" in properties &&
|
|
15
|
+
typeof properties.regex === "string" &&
|
|
16
|
+
properties.regex.length > 0;
|
|
17
|
+
// Already migrated or nothing to migrate
|
|
18
|
+
if (!hasRequired && !hasRegex)
|
|
19
|
+
return null;
|
|
20
|
+
if ("validation" in properties && properties.validation)
|
|
21
|
+
return null;
|
|
22
|
+
const rules = [];
|
|
23
|
+
if (hasRequired) {
|
|
24
|
+
rules.push({ type: "required" });
|
|
25
|
+
}
|
|
26
|
+
if (hasRegex) {
|
|
27
|
+
rules.push({ type: "pattern", params: { regex: properties.regex } });
|
|
28
|
+
}
|
|
29
|
+
// Strip old keys
|
|
30
|
+
const { required: _req, regex: _rgx, ...cleanedProperties } = properties;
|
|
31
|
+
return {
|
|
32
|
+
validation: { rules },
|
|
33
|
+
cleanedProperties,
|
|
34
|
+
};
|
|
35
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type ValidationRuleType = "required" | "email" | "phone" | "url" | "minLength" | "maxLength" | "exactLength" | "minValue" | "maxValue" | "pattern" | "minSelected" | "maxSelected" | "fileType" | "fileSize" | "contains" | "excludes" | "matchesField";
|
|
2
|
+
export type ValidationRule = {
|
|
3
|
+
type: ValidationRuleType;
|
|
4
|
+
params?: Record<string, any>;
|
|
5
|
+
message?: string;
|
|
6
|
+
};
|
|
7
|
+
export type FlowValidationConfig = {
|
|
8
|
+
rules: ValidationRule[];
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=validation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../src/validation.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,kBAAkB,GAC1B,UAAU,GACV,OAAO,GACP,OAAO,GACP,KAAK,GACL,WAAW,GACX,WAAW,GACX,aAAa,GACb,UAAU,GACV,UAAU,GACV,SAAS,GACT,aAAa,GACb,aAAa,GACb,UAAU,GACV,UAAU,GACV,UAAU,GACV,UAAU,GACV,cAAc,CAAC;AAEnB,MAAM,MAAM,cAAc,GAAG;IAC3B,IAAI,EAAE,kBAAkB,CAAC;IACzB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC7B,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,KAAK,EAAE,cAAc,EAAE,CAAC;CACzB,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@sonata-innovations/fiber-types",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "TypeScript type definitions for the Fiber form builder system",
|
|
5
|
+
"keywords": ["fiber", "form-builder", "types", "typescript", "flow-json"],
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/sonata-innovations/fiber.git",
|
|
10
|
+
"directory": "fiber-types"
|
|
11
|
+
},
|
|
12
|
+
"bugs": { "url": "https://github.com/sonata-innovations/fiber/issues" },
|
|
13
|
+
"homepage": "https://github.com/sonata-innovations/fiber",
|
|
14
|
+
"type": "module",
|
|
15
|
+
"main": "dist/index.js",
|
|
16
|
+
"types": "dist/index.d.ts",
|
|
17
|
+
"exports": {
|
|
18
|
+
".": {
|
|
19
|
+
"types": "./dist/index.d.ts",
|
|
20
|
+
"import": "./dist/index.js"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"files": [
|
|
24
|
+
"dist"
|
|
25
|
+
],
|
|
26
|
+
"sideEffects": false,
|
|
27
|
+
"scripts": {
|
|
28
|
+
"build": "tsc"
|
|
29
|
+
},
|
|
30
|
+
"publishConfig": {
|
|
31
|
+
"access": "public"
|
|
32
|
+
},
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"typescript": "^5.7.0"
|
|
35
|
+
}
|
|
36
|
+
}
|