@pega/cosmos-react-build 9.0.0-build.3.3 → 9.0.0-build.4.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/lib/components/DynamicInput/DynamicInput.types.d.ts +11 -6
- package/lib/components/DynamicInput/DynamicInput.types.d.ts.map +1 -1
- package/lib/components/DynamicInput/DynamicInput.types.js.map +1 -1
- package/lib/components/DynamicInput/utils.d.ts.map +1 -1
- package/lib/components/DynamicInput/utils.js +3 -2
- package/lib/components/DynamicInput/utils.js.map +1 -1
- package/package.json +4 -4
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
import type { ComponentType, Ref } from 'react';
|
|
2
2
|
import type { FormFieldProps, InputProps, TextAreaProps, CurrencyInputProps, NumberInputProps, PhoneInputProps, DateTimeInputProps, DateInputProps, TimeInputProps, TestIdProp, OmitStrict, FormControlProps, DeferInfer } from '@pega/cosmos-react-core';
|
|
3
|
-
export type
|
|
3
|
+
export type ConstantSourceType = 'Constant';
|
|
4
|
+
export type RuleSourceType = 'Rule';
|
|
5
|
+
export type FieldReferenceSourceType = 'FieldReference';
|
|
6
|
+
export type ExpressionSourceType = 'Expression';
|
|
7
|
+
export type VariableSourceType = 'Variable';
|
|
8
|
+
export type Source = ConstantSourceType | RuleSourceType | FieldReferenceSourceType | ExpressionSourceType;
|
|
9
|
+
export type SourceConfig = {
|
|
10
|
+
type: Source;
|
|
11
|
+
selected?: boolean;
|
|
12
|
+
}[];
|
|
4
13
|
export type ConstantValueTypeMap = {
|
|
5
14
|
Text: InputProps['value'];
|
|
6
15
|
'Text (paragraph)': TextAreaProps['value'];
|
|
@@ -15,10 +24,6 @@ export type ConstantValueTypeMap = {
|
|
|
15
24
|
Time: TimeInputProps['value'];
|
|
16
25
|
};
|
|
17
26
|
export type ConstantFormat = keyof ConstantValueTypeMap;
|
|
18
|
-
export type SourceConfig = {
|
|
19
|
-
type: Source;
|
|
20
|
-
selected?: boolean;
|
|
21
|
-
};
|
|
22
27
|
export type FormControlPropsToOmit = Pick<FormControlProps, 'label' | 'labelHidden' | 'additionalInfo' | 'info' | 'required' | 'status' | 'readOnly' | 'disabled' | 'value' | 'defaultValue'>;
|
|
23
28
|
export type ConstantComponentProps<T> = OmitStrict<FormControlProps, keyof FormControlPropsToOmit> & {
|
|
24
29
|
format?: ConstantFormat;
|
|
@@ -47,7 +52,7 @@ export interface DynamicInputProps<T extends object = object, ConstantProps exte
|
|
|
47
52
|
/**
|
|
48
53
|
* Methods to source a value from.
|
|
49
54
|
*/
|
|
50
|
-
sources: SourceConfig
|
|
55
|
+
sources: SourceConfig;
|
|
51
56
|
/**
|
|
52
57
|
* Called when the source method changes.
|
|
53
58
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DynamicInput.types.d.ts","sourceRoot":"","sources":["../../../src/components/DynamicInput/DynamicInput.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAEhD,OAAO,KAAK,EACV,cAAc,EACd,UAAU,EACV,aAAa,EACb,kBAAkB,EAClB,gBAAgB,EAChB,eAAe,EACf,kBAAkB,EAClB,cAAc,EACd,cAAc,EACd,UAAU,EACV,UAAU,EACV,gBAAgB,EAChB,UAAU,EACX,MAAM,yBAAyB,CAAC;AAEjC,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"DynamicInput.types.d.ts","sourceRoot":"","sources":["../../../src/components/DynamicInput/DynamicInput.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAEhD,OAAO,KAAK,EACV,cAAc,EACd,UAAU,EACV,aAAa,EACb,kBAAkB,EAClB,gBAAgB,EAChB,eAAe,EACf,kBAAkB,EAClB,cAAc,EACd,cAAc,EACd,UAAU,EACV,UAAU,EACV,gBAAgB,EAChB,UAAU,EACX,MAAM,yBAAyB,CAAC;AAEjC,M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+1 @@
|
|
|
1
|
-
{"version":3,"file":"DynamicInput.types.js","sourceRoot":"","sources":["../../../src/components/DynamicInput/DynamicInput.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ComponentType, Ref } from 'react';\n\nimport type {\n FormFieldProps,\n InputProps,\n TextAreaProps,\n CurrencyInputProps,\n NumberInputProps,\n PhoneInputProps,\n DateTimeInputProps,\n DateInputProps,\n TimeInputProps,\n TestIdProp,\n OmitStrict,\n FormControlProps,\n DeferInfer\n} from '@pega/cosmos-react-core';\n\nexport type
|
|
1
|
+
{"version":3,"file":"DynamicInput.types.js","sourceRoot":"","sources":["../../../src/components/DynamicInput/DynamicInput.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ComponentType, Ref } from 'react';\n\nimport type {\n FormFieldProps,\n InputProps,\n TextAreaProps,\n CurrencyInputProps,\n NumberInputProps,\n PhoneInputProps,\n DateTimeInputProps,\n DateInputProps,\n TimeInputProps,\n TestIdProp,\n OmitStrict,\n FormControlProps,\n DeferInfer\n} from '@pega/cosmos-react-core';\n\nexport type ConstantSourceType = 'Constant';\nexport type RuleSourceType = 'Rule';\nexport type FieldReferenceSourceType = 'FieldReference';\nexport type ExpressionSourceType = 'Expression';\nexport type VariableSourceType = 'Variable';\n\n// Input type options\nexport type Source =\n | ConstantSourceType\n | RuleSourceType\n | FieldReferenceSourceType\n | ExpressionSourceType;\n\nexport type SourceConfig = { type: Source; selected?: boolean }[];\n\nexport type ConstantValueTypeMap = {\n Text: InputProps['value'];\n 'Text (paragraph)': TextAreaProps['value'];\n Boolean: boolean;\n Currency: CurrencyInputProps['value'];\n Percentage: NumberInputProps['value'];\n Integer: NumberInputProps['value'];\n Decimal: NumberInputProps['value'];\n Phone: PhoneInputProps['value'];\n DateTime: DateTimeInputProps['value'];\n Date: DateInputProps['value'];\n Time: TimeInputProps['value'];\n};\n\nexport type ConstantFormat = keyof ConstantValueTypeMap;\n\nexport type FormControlPropsToOmit = Pick<\n FormControlProps,\n | 'label'\n | 'labelHidden'\n | 'additionalInfo'\n | 'info'\n | 'required'\n | 'status'\n | 'readOnly'\n | 'disabled'\n | 'value'\n | 'defaultValue'\n>;\n\nexport type ConstantComponentProps<T> = OmitStrict<\n FormControlProps,\n keyof FormControlPropsToOmit\n> & {\n format?: ConstantFormat;\n} & T;\n\ntype ComponentConfig<P> = {\n component: ComponentType<P>;\n props: DeferInfer<P>;\n};\n\n// ## (DynamicInput) Top level props for the component.\nexport interface DynamicInputProps<\n T extends object = object,\n ConstantProps extends ConstantComponentProps<T> = ConstantComponentProps<T>,\n RuleProps extends object = object,\n FieldReferenceProps extends object = object,\n ExpressionProps extends object = object\n> extends TestIdProp,\n Pick<FormFieldProps, 'labelHidden' | 'required' | 'status' | 'id' | 'info'> {\n /**\n * The accessible and visual field label.\n * When used as an independent control label should represent the data field.\n * When used in combination with another LHS element the default \"Value\" may be sufficient.\n * @default \"Value\"\n */\n label?: string;\n\n /**\n * The form control displayed on the RHS\n */\n controls: {\n constant?: ComponentConfig<ConstantProps>;\n rule?: ComponentConfig<RuleProps>;\n fieldReference?: ComponentConfig<FieldReferenceProps>;\n expression?: ComponentConfig<ExpressionProps>;\n };\n\n /**\n * Methods to source a value from.\n */\n sources: SourceConfig;\n\n /**\n * Called when the source method changes.\n */\n onSourceChange: (source: Source) => void;\n\n /**\n * Ref to the component's root element.\n */\n ref?: Ref<HTMLDivElement>;\n\n /**\n * Hides source button.\n */\n hideSourceButton?: boolean;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/components/DynamicInput/utils.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/components/DynamicInput/utils.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAyBtF,eAAO,MAAM,aAAa,GAAI,oBAG3B;IACD,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,cAAc,CAAC;CACzB,KAAG,MAoBH,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAAI,SAAS,iBAAiB,CAAC,SAAS,CAAC,KAAG,MAAM,GAAG,SAIjF,CAAC"}
|
|
@@ -12,7 +12,8 @@ const iconMap = {
|
|
|
12
12
|
Time: 'clock',
|
|
13
13
|
Rule: 'rule-library',
|
|
14
14
|
FieldReference: 'field-cursor',
|
|
15
|
-
Advanced: 'function'
|
|
15
|
+
Advanced: 'function',
|
|
16
|
+
Expression: 'expression'
|
|
16
17
|
};
|
|
17
18
|
export const getSourceIcon = ({ source, format }) => {
|
|
18
19
|
let iconName;
|
|
@@ -26,7 +27,7 @@ export const getSourceIcon = ({ source, format }) => {
|
|
|
26
27
|
iconName = iconMap.FieldReference;
|
|
27
28
|
}
|
|
28
29
|
if (source === 'Expression') {
|
|
29
|
-
iconName = iconMap.
|
|
30
|
+
iconName = iconMap.Expression;
|
|
30
31
|
}
|
|
31
32
|
return iconName ?? iconMap.Text;
|
|
32
33
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/components/DynamicInput/utils.ts"],"names":[],"mappings":"AAIA,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/components/DynamicInput/utils.ts"],"names":[],"mappings":"AAIA,MAAM,OAAO,GAKT;IACF,IAAI,EAAE,sBAAsB;IAC5B,kBAAkB,EAAE,sBAAsB;IAC1C,OAAO,EAAE,mBAAmB;IAC5B,UAAU,EAAE,YAAY;IACxB,OAAO,EAAE,uBAAuB;IAChC,OAAO,EAAE,gBAAgB;IACzB,QAAQ,EAAE,UAAU;IACpB,KAAK,EAAE,YAAY;IACnB,QAAQ,EAAE,wBAAwB;IAClC,IAAI,EAAE,gBAAgB;IACtB,IAAI,EAAE,OAAO;IACb,IAAI,EAAE,cAAc;IACpB,cAAc,EAAE,cAAc;IAC9B,QAAQ,EAAE,UAAU;IACpB,UAAU,EAAE,YAAY;CACzB,CAAC;AAEF,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,EAC5B,MAAM,EACN,MAAM,EAIP,EAAU,EAAE;IACX,IAAI,QAAQ,CAAC;IAEb,IAAI,MAAM,KAAK,UAAU,EAAE,CAAC;QAC1B,QAAQ,GAAG,OAAO,CAAC,MAAM,IAAI,MAAM,CAAC,CAAC;IACvC,CAAC;IAED,IAAI,MAAM,KAAK,MAAM,EAAE,CAAC;QACtB,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;IAC1B,CAAC;IAED,IAAI,MAAM,KAAK,gBAAgB,EAAE,CAAC;QAChC,QAAQ,GAAG,OAAO,CAAC,cAAc,CAAC;IACpC,CAAC;IAED,IAAI,MAAM,KAAK,YAAY,EAAE,CAAC;QAC5B,QAAQ,GAAG,OAAO,CAAC,UAAU,CAAC;IAChC,CAAC;IAED,OAAO,QAAQ,IAAK,OAAO,CAAC,IAAe,CAAC;AAC9C,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,OAAqC,EAAsB,EAAE;IAC5F,IAAI,CAAC,OAAO,CAAC,MAAM;QAAE,OAAO;IAE5B,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,QAAQ,CAAC,EAAE,IAAI,IAAI,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AAC3E,CAAC,CAAC","sourcesContent":["import type { StreamlineIconName } from '@pega/cosmos-react-core';\n\nimport type { ConstantFormat, DynamicInputProps, Source } from './DynamicInput.types';\n\nconst iconMap: Partial<Record<ConstantFormat, StreamlineIconName>> & {\n Rule: 'rule-library';\n FieldReference: 'field-cursor';\n Advanced: 'function';\n Expression: 'expression';\n} = {\n Text: 'dataviz-string-field',\n 'Text (paragraph)': 'dataviz-string-field',\n Boolean: 'circle-mixed-left',\n Percentage: 'percentage',\n Integer: 'dataviz-numeric-field',\n Decimal: 'number-decimal',\n Currency: 'currency',\n Phone: 'phone-call',\n DateTime: 'dataviz-datetime-field',\n Date: 'calendar-range',\n Time: 'clock',\n Rule: 'rule-library',\n FieldReference: 'field-cursor',\n Advanced: 'function',\n Expression: 'expression'\n};\n\nexport const getSourceIcon = ({\n source,\n format\n}: {\n source: Source;\n format?: ConstantFormat;\n}): string => {\n let iconName;\n\n if (source === 'Constant') {\n iconName = iconMap[format ?? 'Text'];\n }\n\n if (source === 'Rule') {\n iconName = iconMap.Rule;\n }\n\n if (source === 'FieldReference') {\n iconName = iconMap.FieldReference;\n }\n\n if (source === 'Expression') {\n iconName = iconMap.Expression;\n }\n\n return iconName ?? (iconMap.Text as string);\n};\n\nexport const getCurrentSource = (sources: DynamicInputProps['sources']): Source | undefined => {\n if (!sources.length) return;\n\n return sources.find(({ selected }) => selected)?.type || sources[0].type;\n};\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pega/cosmos-react-build",
|
|
3
|
-
"version": "9.0.0-build.
|
|
3
|
+
"version": "9.0.0-build.4.0",
|
|
4
4
|
"license": "SEE LICENSE IN LICENSE",
|
|
5
5
|
"author": "Pegasystems",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
"build": "tsc -b tsconfig.build.json"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@pega/cosmos-react-core": "9.0.0-build.
|
|
18
|
-
"@pega/cosmos-react-dnd": "9.0.0-build.
|
|
19
|
-
"@pega/cosmos-react-rte": "9.0.0-build.
|
|
17
|
+
"@pega/cosmos-react-core": "9.0.0-build.4.0",
|
|
18
|
+
"@pega/cosmos-react-dnd": "9.0.0-build.4.0",
|
|
19
|
+
"@pega/cosmos-react-rte": "9.0.0-build.4.0",
|
|
20
20
|
"@types/codemirror": "^5.60.15",
|
|
21
21
|
"@types/dagre": "^0.7.46",
|
|
22
22
|
"@types/react": "^17.0.62 || ^18.3.3",
|