@zealicsolutions/web-ui 1.0.140-beta.109 → 1.0.140-beta.110
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/cjs/containers/ReplicatorContainer/ReplicatorContainer.d.ts +24 -1
- package/dist/cjs/containers/ReplicatorContainer/index.d.ts +1 -0
- package/dist/cjs/containers/ReplicatorContainer/types.d.ts +63 -0
- package/dist/cjs/contexts/ContainerRuntimeContext/types.d.ts +2 -0
- package/dist/cjs/index.js +14 -6
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/containers/Container.js +16 -8
- package/dist/esm/containers/Container.js.map +1 -1
- package/dist/esm/containers/ReplicatorContainer/ReplicatorContainer.d.ts +24 -1
- package/dist/esm/containers/ReplicatorContainer/ReplicatorContainer.js +1 -1
- package/dist/esm/containers/ReplicatorContainer/ReplicatorContainer.js.map +1 -1
- package/dist/esm/containers/ReplicatorContainer/index.d.ts +1 -0
- package/dist/esm/containers/ReplicatorContainer/types.d.ts +63 -0
- package/dist/esm/contexts/ContainerRuntimeContext/ContainerRuntimeContext.js +1 -1
- package/dist/esm/contexts/ContainerRuntimeContext/ContainerRuntimeContext.js.map +1 -1
- package/dist/esm/contexts/ContainerRuntimeContext/types.d.ts +2 -0
- package/dist/esm/molecules/BaseMolecule.js +1 -1
- package/dist/esm/molecules/BaseMolecule.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,14 +1,37 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { DmfId, PathSegment } from '../../contexts/ContainerRuntimeContext/types';
|
|
3
|
+
import { StyleVariantConfig, VariantContainerConfig, VariantContainerProperties } from './types';
|
|
4
|
+
/**
|
|
5
|
+
* Resolve the active variant from scoped data using the variant field configuration.
|
|
6
|
+
*
|
|
7
|
+
* @param styleVariantConfig - The variant configuration from container properties
|
|
8
|
+
* @param scopedData - The current item's data keyed by DMF ID
|
|
9
|
+
* @returns The variant key (enum value) or null if not resolvable
|
|
10
|
+
*/
|
|
11
|
+
export declare const resolveActiveVariant: (styleVariantConfig: StyleVariantConfig | undefined, scopedData: Record<string, unknown> | undefined) => string | null;
|
|
12
|
+
/**
|
|
13
|
+
* Get container styles for the active variant and presentation mode.
|
|
14
|
+
*
|
|
15
|
+
* @param config - The container's config object
|
|
16
|
+
* @param activeVariant - The resolved variant key (or null)
|
|
17
|
+
* @param presentation - 'wide' or 'compact'
|
|
18
|
+
* @returns The styles to apply (containerStyle object)
|
|
19
|
+
*/
|
|
20
|
+
export declare const getVariantContainerStyles: (config: VariantContainerConfig | undefined, activeVariant: string | null, presentation: 'wide' | 'compact') => Record<string, unknown>;
|
|
3
21
|
export type ReplicatorContainerProps = {
|
|
4
22
|
replicatorFieldId?: DmfId;
|
|
5
23
|
nestedPathSegments?: PathSegment[];
|
|
6
24
|
children?: React.ReactNode;
|
|
25
|
+
/** Container properties including styleVariantConfig */
|
|
26
|
+
properties?: VariantContainerProperties;
|
|
27
|
+
/** Container config including variant-specific styles */
|
|
28
|
+
config?: VariantContainerConfig;
|
|
7
29
|
/**
|
|
8
30
|
* Optional render function used by the parent Container to replicate the full
|
|
9
31
|
* container wrapper (styles, configuration handlers, etc.) for each iteration.
|
|
10
32
|
* When not provided, children are rendered directly.
|
|
33
|
+
* Now receives activeVariant as additional parameter.
|
|
11
34
|
*/
|
|
12
|
-
renderWrapper?: (iterationIndex: number | undefined, children: React.ReactNode) => React.ReactNode;
|
|
35
|
+
renderWrapper?: (iterationIndex: number | undefined, children: React.ReactNode, activeVariant: string | null) => React.ReactNode;
|
|
13
36
|
};
|
|
14
37
|
export declare const ReplicatorContainer: React.NamedExoticComponent<React.PropsWithChildren<ReplicatorContainerProps>>;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Style Variants Types for ReplicatorContainer
|
|
3
|
+
*
|
|
4
|
+
* These types support the Conditional Style Variants feature that allows
|
|
5
|
+
* replicator containers to display visually distinct cards based on
|
|
6
|
+
* backend-provided enumerated field values.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Configuration for style variants on a replicator container.
|
|
10
|
+
* Stored in container's `properties.styleVariantConfig`.
|
|
11
|
+
*/
|
|
12
|
+
export type StyleVariantConfig = {
|
|
13
|
+
/** Whether style variants are enabled for this container */
|
|
14
|
+
enabled: boolean;
|
|
15
|
+
/** DMF ID of the enum field that determines which variant to apply */
|
|
16
|
+
variantFieldId: string;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Extended container properties including variant configuration.
|
|
20
|
+
*/
|
|
21
|
+
export type VariantContainerProperties = {
|
|
22
|
+
styleVariantConfig?: StyleVariantConfig;
|
|
23
|
+
[key: string]: unknown;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Extended container config structure supporting variant-specific styles.
|
|
27
|
+
* Pattern: config.{variant}.{presentation} for container styles
|
|
28
|
+
*
|
|
29
|
+
* Example:
|
|
30
|
+
* {
|
|
31
|
+
* wide: { containerStyle: { backgroundColor: '#FFFFFF' } },
|
|
32
|
+
* compact: { containerStyle: { backgroundColor: '#F0F0F0' } },
|
|
33
|
+
* green: {
|
|
34
|
+
* wide: { containerStyle: { backgroundColor: '#E8F5E9' } },
|
|
35
|
+
* compact: { containerStyle: { backgroundColor: '#E8F5E9' } }
|
|
36
|
+
* }
|
|
37
|
+
* }
|
|
38
|
+
*/
|
|
39
|
+
export type VariantContainerConfig = {
|
|
40
|
+
wide?: Record<string, unknown>;
|
|
41
|
+
compact?: Record<string, unknown>;
|
|
42
|
+
props?: Record<string, unknown>;
|
|
43
|
+
[variantKey: string]: {
|
|
44
|
+
wide?: Record<string, unknown>;
|
|
45
|
+
compact?: Record<string, unknown>;
|
|
46
|
+
} | Record<string, unknown> | undefined;
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* Extended molecule config structure supporting variant-specific styles.
|
|
50
|
+
* Pattern: config.{variant}.props for molecule styles
|
|
51
|
+
*
|
|
52
|
+
* Example:
|
|
53
|
+
* {
|
|
54
|
+
* props: { color: '#000000', fontWeight: 400 },
|
|
55
|
+
* green: { props: { color: '#2E7D32', fontWeight: 600 } }
|
|
56
|
+
* }
|
|
57
|
+
*/
|
|
58
|
+
export type VariantMoleculeConfig = {
|
|
59
|
+
props?: Record<string, unknown>;
|
|
60
|
+
[variantKey: string]: {
|
|
61
|
+
props?: Record<string, unknown>;
|
|
62
|
+
} | Record<string, unknown> | undefined;
|
|
63
|
+
};
|
|
@@ -9,6 +9,8 @@ export type ContainerRuntimeContextValue = {
|
|
|
9
9
|
itemIndex?: number;
|
|
10
10
|
itemDataByDmfId?: Record<string, unknown>;
|
|
11
11
|
rawItemDataByDmfId?: Record<string, unknown>;
|
|
12
|
+
/** Current variant key for this container scope (null if no variant active) */
|
|
13
|
+
activeVariant?: string | null;
|
|
12
14
|
};
|
|
13
15
|
export type ContainerRuntimeContextProviderProps = {
|
|
14
16
|
value: ContainerRuntimeContextValue;
|