@pega/cosmos-react-condition-builder 4.0.0-dev.2.0 → 4.0.0-dev.21.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/ConditionBuilder/AtomicCondition.d.ts +9 -5
- package/lib/components/ConditionBuilder/AtomicCondition.d.ts.map +1 -1
- package/lib/components/ConditionBuilder/AtomicCondition.js +48 -13
- package/lib/components/ConditionBuilder/AtomicCondition.js.map +1 -1
- package/lib/components/ConditionBuilder/ConditionBuilder.d.ts.map +1 -1
- package/lib/components/ConditionBuilder/ConditionBuilder.js +85 -22
- package/lib/components/ConditionBuilder/ConditionBuilder.js.map +1 -1
- package/lib/components/ConditionBuilder/ConditionBuilder.styles.d.ts +2 -0
- package/lib/components/ConditionBuilder/ConditionBuilder.styles.d.ts.map +1 -1
- package/lib/components/ConditionBuilder/ConditionBuilder.styles.js +18 -3
- package/lib/components/ConditionBuilder/ConditionBuilder.styles.js.map +1 -1
- package/lib/components/ConditionBuilder/ConditionBuilder.types.d.ts +7 -5
- package/lib/components/ConditionBuilder/ConditionBuilder.types.d.ts.map +1 -1
- package/lib/components/ConditionBuilder/ConditionBuilder.types.js.map +1 -1
- package/lib/components/ConditionBuilder/FieldCondition.types.d.ts +1 -3
- package/lib/components/ConditionBuilder/FieldCondition.types.d.ts.map +1 -1
- package/lib/components/ConditionBuilder/FieldCondition.types.js.map +1 -1
- package/lib/components/ConditionBuilder/RhsControls/DateFunctionMenu.d.ts.map +1 -1
- package/lib/components/ConditionBuilder/RhsControls/DateFunctionMenu.js +18 -10
- package/lib/components/ConditionBuilder/RhsControls/DateFunctionMenu.js.map +1 -1
- package/lib/components/ConditionBuilder/RhsControls/FieldSelector.d.ts +5 -3
- package/lib/components/ConditionBuilder/RhsControls/FieldSelector.d.ts.map +1 -1
- package/lib/components/ConditionBuilder/RhsControls/FieldSelector.js +2 -2
- package/lib/components/ConditionBuilder/RhsControls/FieldSelector.js.map +1 -1
- package/lib/components/ConditionBuilder/RhsControls/NumericInput.d.ts.map +1 -1
- package/lib/components/ConditionBuilder/RhsControls/NumericInput.js +1 -1
- package/lib/components/ConditionBuilder/RhsControls/NumericInput.js.map +1 -1
- package/lib/components/ConditionBuilder/RhsControls/RelativeDateMenu.d.ts.map +1 -1
- package/lib/components/ConditionBuilder/RhsControls/RelativeDateMenu.js +21 -11
- package/lib/components/ConditionBuilder/RhsControls/RelativeDateMenu.js.map +1 -1
- package/lib/components/ConditionBuilder/RhsControls/RhsModeSwitch.js +2 -2
- package/lib/components/ConditionBuilder/RhsControls/RhsModeSwitch.js.map +1 -1
- package/lib/components/ConditionBuilder/RhsControls/TimePeriodInput.d.ts +0 -2
- package/lib/components/ConditionBuilder/RhsControls/TimePeriodInput.d.ts.map +1 -1
- package/lib/components/ConditionBuilder/RhsControls/TimePeriodInput.js +84 -68
- package/lib/components/ConditionBuilder/RhsControls/TimePeriodInput.js.map +1 -1
- package/lib/components/ConditionBuilder/RhsControls/TimePeriodMenu.d.ts.map +1 -1
- package/lib/components/ConditionBuilder/RhsControls/TimePeriodMenu.js +2 -1
- package/lib/components/ConditionBuilder/RhsControls/TimePeriodMenu.js.map +1 -1
- package/lib/components/ConditionBuilder/RhsControls/ValueSelector.d.ts +7 -3
- package/lib/components/ConditionBuilder/RhsControls/ValueSelector.d.ts.map +1 -1
- package/lib/components/ConditionBuilder/RhsControls/ValueSelector.js +71 -20
- package/lib/components/ConditionBuilder/RhsControls/ValueSelector.js.map +1 -1
- package/lib/components/ConditionBuilder/RhsControls/index.d.ts +5 -5
- package/lib/components/ConditionBuilder/RhsControls/index.d.ts.map +1 -1
- package/lib/components/ConditionBuilder/RhsControls/index.js +56 -16
- package/lib/components/ConditionBuilder/RhsControls/index.js.map +1 -1
- package/lib/components/ConditionBuilder/core/evaluator.d.ts.map +1 -1
- package/lib/components/ConditionBuilder/core/evaluator.js +15 -3
- package/lib/components/ConditionBuilder/core/evaluator.js.map +1 -1
- package/lib/components/ConditionBuilder/core/formatter.d.ts.map +1 -1
- package/lib/components/ConditionBuilder/core/formatter.js +22 -1
- package/lib/components/ConditionBuilder/core/formatter.js.map +1 -1
- package/lib/components/ConditionBuilder/core/rows-reducer.d.ts +1 -1
- package/lib/components/ConditionBuilder/core/rows-reducer.d.ts.map +1 -1
- package/lib/components/ConditionBuilder/core/transformer.d.ts.map +1 -1
- package/lib/components/ConditionBuilder/core/transformer.js +4 -2
- package/lib/components/ConditionBuilder/core/transformer.js.map +1 -1
- package/lib/components/ConditionBuilder/core/types.d.ts +17 -17
- package/lib/components/ConditionBuilder/core/types.d.ts.map +1 -1
- package/lib/components/ConditionBuilder/core/types.js.map +1 -1
- package/lib/components/ConditionBuilder/core/utils.d.ts +2 -6
- package/lib/components/ConditionBuilder/core/utils.d.ts.map +1 -1
- package/lib/components/ConditionBuilder/core/utils.js +4 -7
- package/lib/components/ConditionBuilder/core/utils.js.map +1 -1
- package/lib/components/ConditionBuilder/index.d.ts +3 -3
- package/lib/components/ConditionBuilder/index.d.ts.map +1 -1
- package/lib/components/ConditionBuilder/index.js.map +1 -1
- package/lib/components/ConditionInput/ConditionInput.d.ts.map +1 -1
- package/lib/components/ConditionInput/ConditionInput.js +145 -58
- package/lib/components/ConditionInput/ConditionInput.js.map +1 -1
- package/lib/components/ConditionInput/ConditionInput.styles.d.ts +2 -2
- package/lib/components/ConditionInput/ConditionInput.styles.d.ts.map +1 -1
- package/lib/components/ConditionInput/ConditionInput.styles.js +5 -5
- package/lib/components/ConditionInput/ConditionInput.styles.js.map +1 -1
- package/lib/components/ConditionInput/ConditionInput.types.d.ts +5 -2
- package/lib/components/ConditionInput/ConditionInput.types.d.ts.map +1 -1
- package/lib/components/ConditionInput/ConditionInput.types.js.map +1 -1
- package/lib/components/ConditionInput/index.d.ts +1 -1
- package/lib/components/ConditionInput/index.d.ts.map +1 -1
- package/lib/components/ConditionInput/index.js.map +1 -1
- package/lib/components/ConditionInput/utils.d.ts +7 -3
- package/lib/components/ConditionInput/utils.d.ts.map +1 -1
- package/lib/components/ConditionInput/utils.js +67 -2
- package/lib/components/ConditionInput/utils.js.map +1 -1
- package/lib/components/PromotedFilters/ConditionSelector.d.ts.map +1 -1
- package/lib/components/PromotedFilters/ConditionSelector.js +3 -31
- package/lib/components/PromotedFilters/ConditionSelector.js.map +1 -1
- package/lib/components/PromotedFilters/PromotedFilters.d.ts.map +1 -1
- package/lib/components/PromotedFilters/PromotedFilters.js +46 -12
- package/lib/components/PromotedFilters/PromotedFilters.js.map +1 -1
- package/lib/components/PromotedFilters/PromotedFilters.styles.d.ts.map +1 -1
- package/lib/components/PromotedFilters/PromotedFilters.styles.js +12 -0
- package/lib/components/PromotedFilters/PromotedFilters.styles.js.map +1 -1
- package/lib/components/PromotedFilters/PromotedFilters.types.d.ts +3 -1
- package/lib/components/PromotedFilters/PromotedFilters.types.d.ts.map +1 -1
- package/lib/components/PromotedFilters/PromotedFilters.types.js.map +1 -1
- package/lib/components/PromotedFilters/index.d.ts +1 -1
- package/lib/components/PromotedFilters/index.d.ts.map +1 -1
- package/lib/components/PromotedFilters/index.js.map +1 -1
- package/package.json +15 -16
- package/lib/components/ConditionBuilder/HelpButton.d.ts +0 -10
- package/lib/components/ConditionBuilder/HelpButton.d.ts.map +0 -1
- package/lib/components/ConditionBuilder/HelpButton.js +0 -11
- package/lib/components/ConditionBuilder/HelpButton.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formatter.js","sourceRoot":"","sources":["../../../../src/components/ConditionBuilder/core/formatter.ts"],"names":[],"mappings":"AAAA,6BAA6B;AAC7B,mEAAmE;AACnE,OAAO,EACL,cAAc,EACd,OAAO,EACP,WAAW,EACX,WAAW,EAEZ,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,iBAAiB,EAAE,MAAM,qDAAqD,CAAC;AAExF,OAAO,EAAE,UAAU,EAAE,MAAM,6DAA6D,CAAC;AAIzF,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;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;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,eAAe,CACrC,SAAoB,EACpB,MAAe,EACf,SAA+C,EAC/C,OAAgC;IAEhC,yDAAyD;IACzD,IAAI,IAAI,GAAG,mBAAmB,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;IAEtE,2EAA2E;IAC3E,IAAI,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE;QACpD,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;KAC1B;IAED,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["// cSpell:words LPAREN RPAREN\n// FIXME: TR (Several constructs in this file need to be localized)\nimport {\n formatDateTime,\n hasProp,\n isValidDate,\n parseToDate,\n TranslationPack\n} from '@pega/cosmos-react-core';\nimport { getFormattedValue } from '@pega/cosmos-react-core/lib/components/Number/utils';\nimport { TranslationFunction } from '@pega/cosmos-react-core/lib/i18n/translate';\nimport { getQuarter } from '@pega/cosmos-react-core/lib/components/DateTime/Input/utils';\n\nimport { Condition, LeafCondition, Field } from '../ConditionBuilder.types';\n\nimport { getItem } from './utils';\nimport { DatePart, FieldType, TimePeriod } from './types';\n\nconst LPAREN = '(';\nconst RPAREN = ')';\n\n/** Options object optionally passed to formatCondition method. */\ninterface ConditionFormatOptions {\n locale?: string;\n omitLhs?: boolean;\n}\n\nexport function formatRelativeDate(\n translate: TranslationFunction<TranslationPack>,\n timePeriod: TimePeriod,\n datePart: DatePart,\n interval?: number\n): string {\n const translationKey =\n timePeriod === 'CURRENT'\n ? `condition_builder_current_${datePart.toLowerCase().slice(0, -1)}`\n : `condition_builder_${timePeriod.toLowerCase()}_X_${datePart.toLowerCase()}`;\n return translate(translationKey as keyof TranslationPack, [interval ?? 0], {\n count: interval ?? 0\n });\n}\n\nfunction formatLiteralValue(\n type: FieldType,\n rhsValue: string | number,\n locale: string,\n translate: TranslationFunction<TranslationPack>\n): string {\n switch (type) {\n case 'TIME_ONLY':\n // For these cases, rhs.value is stored as # of milliseconds since day-start\n return (rhsValue || rhsValue === 0) && isValidDate(parseToDate(rhsValue))\n ? formatDateTime(parseToDate(rhsValue), {\n t: translate,\n locale,\n format: 'long',\n variant: 'time',\n timeZone: 'UTC'\n })\n : '';\n case 'DATE_ONLY':\n // For these cases, rhs.value is stored as # of milliseconds since day-start\n return (rhsValue || rhsValue === 0) && isValidDate(parseToDate(rhsValue))\n ? formatDateTime(parseToDate(rhsValue), {\n t: translate,\n locale,\n format: 'numeric',\n variant: 'date',\n timeZone: 'UTC'\n })\n : '';\n case 'DATE_TIME':\n // For these cases, rhs.value is stored as # of milliseconds since day-start\n return (rhsValue || rhsValue === 0) && isValidDate(parseToDate(rhsValue))\n ? formatDateTime(parseToDate(rhsValue), {\n t: translate,\n locale,\n format: 'numeric',\n variant: 'datetime',\n timeZone: 'UTC'\n })\n : '';\n case 'NUMBER':\n return getFormattedValue(rhsValue.toString(), locale, undefined, {\n useGrouping: true\n });\n break;\n default:\n return rhsValue.toString();\n }\n}\n\n/** Returns a user-friendly text representation of a given leaf condition */\nfunction formatLeafCondition(\n leaf: LeafCondition,\n fields: Field[],\n translate: TranslationFunction<TranslationPack>,\n { locale = 'en-US', omitLhs = false }: ConditionFormatOptions = {}\n): string {\n const { lhs, comparator, rhs } = leaf;\n\n // Determine texts for LHS and RHS\n const lhsField = getItem(fields, lhs.field) as Field; // Expecting valid inputs\n const lhsText = omitLhs ? '' : `${lhsField.primary} `;\n let rhsText = '';\n if (!hasProp(lhsField, 'type')) return '';\n if (rhs) {\n if (hasProp(rhs, 'field')) {\n // If RHS is another field\n const rhsField = getItem(fields, rhs.field) as Field; // Expecting valid inputs\n rhsText = rhsField.primary;\n } else if (hasProp(rhs, 'value')) {\n if (hasProp(rhs, 'dateFunction')) {\n // If RHS is a date function value\n switch (rhs.dateFunction) {\n case 'YEARS':\n rhsText = new Date(`${rhs.value}T00:00:00`).toLocaleString(locale, {\n year: 'numeric'\n });\n break;\n case 'QUARTERS': {\n const formattedYear = new Date(`${rhs.value}T00:00:00`).toLocaleString(locale, {\n year: 'numeric'\n });\n const quarterNumber = getQuarter(rhs.value);\n rhsText = `${translate(`date_quarter_q${quarterNumber}`, [formattedYear])}`;\n break;\n }\n case 'MONTHS':\n rhsText = new Date(`${rhs.value}T00:00:00`).toLocaleString(locale, {\n year: 'numeric',\n month: 'short'\n });\n break;\n case 'WEEKS':\n rhsText = `Week of ${new Date(`${rhs.value}T00:00:00`).toLocaleString(locale, {\n year: 'numeric',\n month: 'short',\n day: 'numeric'\n })}`;\n break;\n case 'DAYS':\n rhsText = new Date(`${rhs.value}T00:00:00`).toLocaleString(locale, {\n year: 'numeric',\n month: 'short',\n day: 'numeric'\n });\n break;\n case 'HOURS':\n rhsText = new Date(rhs.value).toLocaleString(locale, {\n year: 'numeric',\n month: 'short',\n day: 'numeric',\n hour: 'numeric',\n hour12: true\n });\n break;\n case 'MONTHS_OF_YEAR':\n rhsText = new Date(2021, (rhs.value as number) - 1, 1).toLocaleString(locale, {\n month: 'long'\n });\n break;\n case 'HOURS_OF_DAY':\n rhsText = `Hour ${rhs.value} of day`;\n break;\n case 'DAYS_OF_MONTH':\n rhsText = `Day ${rhs.value} of month`;\n break;\n case 'DAYS_OF_WEEK':\n // Choosing Feb-2021 as it starts on a Monday\n rhsText = new Date(2021, 1, rhs.value as number).toLocaleString(locale, {\n weekday: 'long'\n });\n break;\n default: // Not needed\n }\n } else {\n // If RHS is a single literal value\n rhsText = formatLiteralValue(lhsField.type, rhs.value, locale, translate);\n }\n } else if (hasProp(rhs, 'relativeDate')) {\n const {\n relativeDate: { timePeriod, interval, datePart }\n } = rhs;\n rhsText = formatRelativeDate(translate, timePeriod, datePart, interval);\n } else if (hasProp(rhs, 'parameterId')) {\n const parameterValue = lhsField.parameters?.find(item => item.id === rhs.parameterId);\n rhsText = parameterValue?.primary ?? '';\n } else if (hasProp(rhs, 'values')) {\n rhsText = rhs.values.join(', ');\n } else if (hasProp(rhs, 'start')) {\n const startValue = formatLiteralValue(lhsField.type, rhs.start, locale, translate);\n const endValue = formatLiteralValue(lhsField.type, rhs.end, locale, translate);\n\n rhsText = `${startValue} - ${endValue}`;\n }\n }\n\n switch (comparator) {\n case 'IS_NULL':\n return `${lhsText}is null`;\n case 'IS_NOT_NULL':\n return `${lhsText}is not null`;\n case 'IS_TRUE':\n return `${lhsText}is true`;\n case 'IS_FALSE':\n return `${lhsText}is false`;\n case 'EQ':\n return `${lhsText}is ${rhsText}`;\n case 'NEQ':\n return `${lhsText}isn't ${rhsText}`;\n case 'IN':\n return `${lhsText}is among ${rhsText}`;\n case 'NOT_IN':\n return `${lhsText}is not among ${rhsText}`;\n case 'GT':\n return `${lhsText}> ${rhsText}`;\n case 'GTE':\n return `${lhsText}>= ${rhsText}`;\n case 'LT':\n return `${lhsText}< ${rhsText}`;\n case 'LTE':\n return `${lhsText}<= ${rhsText}`;\n case 'BTW':\n return `${lhsText}is between ${rhsText}`;\n case 'NOT_BTW':\n return `${lhsText}is not between ${rhsText}`;\n case 'STARTS_WITH':\n return `${lhsText}starts with ${rhsText}`;\n case 'NOT_STARTS_WITH':\n return `${lhsText}doesn't start with ${rhsText}`;\n case 'ENDS_WITH':\n return `${lhsText}ends with ${rhsText}`;\n case 'NOT_ENDS_WITH':\n return `${lhsText}doesn't end with ${rhsText}`;\n case 'CONTAINS':\n return `${lhsText}contains ${rhsText}`;\n case 'NOT_CONTAINS':\n return `${lhsText}doesn't contain ${rhsText}`;\n default:\n return ''; // Not needed\n }\n}\n\n/** Returns a user-friendly text representation of the given node in a condition */\nfunction formatConditionNode(\n node: Condition,\n fields: Field[],\n translate: TranslationFunction<TranslationPack>,\n options?: ConditionFormatOptions\n): string {\n if (hasProp(node, 'AND')) {\n const childStrings = node.AND.map(n => formatConditionNode(n, fields, translate, options));\n return `(${childStrings.join(' AND ')})`;\n }\n\n if (hasProp(node, 'OR')) {\n const childStrings = node.OR.map(n => formatConditionNode(n, fields, translate, options));\n return `(${childStrings.join(' OR ')})`;\n }\n\n if (hasProp(node, 'NOT')) {\n const childString = formatConditionNode(node.NOT, fields, translate, options);\n if (childString.startsWith(LPAREN) && childString.endsWith(RPAREN)) {\n // Avoid double brackets when the child node is an AND/OR node\n return `NOT ${childString}`;\n }\n return `NOT (${childString})`;\n }\n\n return formatLeafCondition(node.condition, fields, translate, options); // If leaf-level is reached\n}\n\n/**\n * Returns a user-friendly text representation of a given complex condition\n * The input `fields` are used to look up display labels for the fields\n */\nexport default function formatCondition(\n condition: Condition,\n fields: Field[],\n translate: TranslationFunction<TranslationPack>,\n options?: ConditionFormatOptions\n): string {\n // Recursively format the tree, starting at the root node\n let text = formatConditionNode(condition, fields, translate, options);\n\n // If the root node is AND/OR, there will be extra parentheses. Remove them\n if (text.startsWith(LPAREN) && text.endsWith(RPAREN)) {\n text = text.slice(1, -1);\n }\n\n return text;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"formatter.js","sourceRoot":"","sources":["../../../../src/components/ConditionBuilder/core/formatter.ts"],"names":[],"mappings":"AAAA,6BAA6B;AAC7B,mEAAmE;AACnE,OAAO,EACL,cAAc,EACd,OAAO,EACP,WAAW,EACX,WAAW,EAEZ,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,iBAAiB,EAAE,MAAM,qDAAqD,CAAC;AAExF,OAAO,EAAE,UAAU,EAAE,MAAM,6DAA6D,CAAC;AAIzF,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAGlC,MAAM,MAAM,GAAG,GAAG,CAAC;AACnB,MAAM,MAAM,GAAG,GAAG,CAAC;AAQnB,MAAM,UAAU,kBAAkB,CAChC,SAA+C,EAC/C,UAAsB,EACtB,QAAkB,EAClB,QAAiB;IAEjB,MAAM,cAAc,GAClB,UAAU,KAAK,SAAS;QACtB,CAAC,CAAC,6BAA6B,QAAQ,CAAC,WAAW,EAAE,CAAC,KAAK,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,CAAC,CAAC;QAC9E,IAAI,WAAW,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,WAAW,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE;YAClE,8DAA8D;YAC9D,OAAO,OAAO,WAAW,EAAE,CAAC;SAC7B;QACD,OAAO,QAAQ,WAAW,GAAG,CAAC;KAC/B;IAED,OAAO,mBAAmB,CAAC,IAAI,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC,2BAA2B;AACrG,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,eAAe,CACrC,SAAoB,EACpB,MAAe,EACf,SAA+C,EAC/C,OAAgC;IAEhC,yDAAyD;IACzD,IAAI,IAAI,GAAG,mBAAmB,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;IAEtE,2EAA2E;IAC3E,IAAI,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE;QACpD,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;KAC1B;IAED,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["// cspell:words LPAREN RPAREN\n// FIXME: TR (Several constructs in this file need to be localized)\nimport {\n formatDateTime,\n hasProp,\n isValidDate,\n parseToDate,\n TranslationPack\n} from '@pega/cosmos-react-core';\nimport { getFormattedValue } from '@pega/cosmos-react-core/lib/components/Number/utils';\nimport { TranslationFunction } from '@pega/cosmos-react-core/lib/i18n/translate';\nimport { getQuarter } from '@pega/cosmos-react-core/lib/components/DateTime/Input/utils';\n\nimport { Condition, LeafCondition, Field } from '../ConditionBuilder.types';\n\nimport { getItem } from './utils';\nimport { DatePart, FieldType, TimePeriod } from './types';\n\nconst LPAREN = '(';\nconst RPAREN = ')';\n\n/** Options object optionally passed to formatCondition method. */\ninterface ConditionFormatOptions {\n locale?: string;\n omitLhs?: boolean;\n}\n\nexport function formatRelativeDate(\n translate: TranslationFunction<TranslationPack>,\n timePeriod: TimePeriod,\n datePart: DatePart,\n interval?: number\n): string {\n const translationKey =\n timePeriod === 'CURRENT'\n ? `condition_builder_current_${datePart.toLowerCase().slice(0, -1)}`\n : `condition_builder_${timePeriod.toLowerCase()}_X_${datePart.toLowerCase()}`;\n return translate(translationKey as keyof TranslationPack, [interval ?? 0], {\n count: interval ?? 0\n });\n}\n\nfunction formatLiteralValue(\n type: FieldType,\n rhsValue: string | number,\n locale: string,\n translate: TranslationFunction<TranslationPack>\n): string {\n switch (type) {\n case 'TIME_ONLY':\n // For these cases, rhs.value is stored as # of milliseconds since day-start\n return (rhsValue || rhsValue === 0) && isValidDate(parseToDate(rhsValue))\n ? formatDateTime(parseToDate(rhsValue), {\n t: translate,\n locale,\n format: 'long',\n variant: 'time',\n timeZone: 'UTC'\n })\n : '';\n case 'DATE_ONLY':\n // For these cases, rhs.value is stored as # of milliseconds since day-start\n return (rhsValue || rhsValue === 0) && isValidDate(parseToDate(rhsValue))\n ? formatDateTime(parseToDate(rhsValue), {\n t: translate,\n locale,\n format: 'numeric',\n variant: 'date',\n timeZone: 'UTC'\n })\n : '';\n case 'DATE_TIME':\n // For these cases, rhs.value is stored as # of milliseconds since day-start\n return (rhsValue || rhsValue === 0) && isValidDate(parseToDate(rhsValue))\n ? formatDateTime(parseToDate(rhsValue), {\n t: translate,\n locale,\n format: 'numeric',\n variant: 'datetime',\n timeZone: 'UTC'\n })\n : '';\n case 'NUMBER':\n return getFormattedValue(rhsValue.toString(), locale, undefined, {\n useGrouping: true\n });\n break;\n default:\n return rhsValue.toString();\n }\n}\n\n/** Returns a user-friendly text representation of a given leaf condition */\nfunction formatLeafCondition(\n leaf: LeafCondition,\n fields: Field[],\n translate: TranslationFunction<TranslationPack>,\n { locale = 'en-US', omitLhs = false }: ConditionFormatOptions = {}\n): string {\n const { lhs, comparator, rhs } = leaf;\n\n // Determine texts for LHS and RHS\n const lhsField = getItem(fields, lhs.field) as Field; // Expecting valid inputs\n const lhsText = omitLhs ? '' : `${lhsField.primary} `;\n let rhsText = '';\n if (!hasProp(lhsField, 'type')) return '';\n if (rhs) {\n if (hasProp(rhs, 'field')) {\n // If RHS is another field\n const rhsField = getItem(fields, rhs.field) as Field; // Expecting valid inputs\n rhsText = rhsField.primary;\n } else if (hasProp(rhs, 'value')) {\n if (hasProp(rhs, 'dateFunction')) {\n // If RHS is a date function value\n switch (rhs.dateFunction) {\n case 'YEARS':\n rhsText = new Date(`${rhs.value}T00:00:00`).toLocaleString(locale, {\n year: 'numeric'\n });\n break;\n case 'QUARTERS': {\n const formattedYear = new Date(`${rhs.value}T00:00:00`).toLocaleString(locale, {\n year: 'numeric'\n });\n const quarterNumber = getQuarter(rhs.value);\n rhsText = `${translate(`date_quarter_q${quarterNumber}`, [formattedYear])}`;\n break;\n }\n case 'MONTHS':\n rhsText = new Date(`${rhs.value}T00:00:00`).toLocaleString(locale, {\n year: 'numeric',\n month: 'short'\n });\n break;\n case 'WEEKS':\n rhsText = `Week of ${new Date(`${rhs.value}T00:00:00`).toLocaleString(locale, {\n year: 'numeric',\n month: 'short',\n day: 'numeric'\n })}`;\n break;\n case 'DAYS':\n rhsText = new Date(`${rhs.value}T00:00:00`).toLocaleString(locale, {\n year: 'numeric',\n month: 'short',\n day: 'numeric'\n });\n break;\n case 'HOURS':\n rhsText = new Date(rhs.value).toLocaleString(locale, {\n year: 'numeric',\n month: 'short',\n day: 'numeric',\n hour: 'numeric',\n hour12: true\n });\n break;\n case 'MINUTES':\n rhsText = new Date(rhs.value).toLocaleString(locale, {\n year: 'numeric',\n month: 'short',\n day: 'numeric',\n hour: 'numeric',\n hour12: true,\n minute: 'numeric'\n });\n break;\n case 'SECONDS':\n rhsText = new Date(rhs.value).toLocaleString(locale, {\n year: 'numeric',\n month: 'short',\n day: 'numeric',\n hour: 'numeric',\n hour12: true,\n minute: 'numeric',\n second: 'numeric'\n });\n break;\n case 'MONTHS_OF_YEAR':\n rhsText = new Date(2021, (rhs.value as number) - 1, 1).toLocaleString(locale, {\n month: 'long'\n });\n break;\n case 'HOURS_OF_DAY':\n rhsText = `Hour ${rhs.value} of day`;\n break;\n case 'DAYS_OF_MONTH':\n rhsText = `Day ${rhs.value} of month`;\n break;\n case 'DAYS_OF_WEEK':\n // Choosing Feb-2021 as it starts on a Monday\n rhsText = new Date(2021, 1, rhs.value as number).toLocaleString(locale, {\n weekday: 'long'\n });\n break;\n default: // Not needed\n }\n } else {\n // If RHS is a single literal value\n rhsText = formatLiteralValue(lhsField.type, rhs.value, locale, translate);\n }\n } else if (hasProp(rhs, 'relativeDate')) {\n const {\n relativeDate: { timePeriod, interval, datePart }\n } = rhs;\n rhsText = formatRelativeDate(translate, timePeriod, datePart, interval);\n } else if (hasProp(rhs, 'parameterId')) {\n const parameterValue = lhsField.parameters?.find(item => item.id === rhs.parameterId);\n rhsText = parameterValue?.primary ?? '';\n } else if (hasProp(rhs, 'values')) {\n rhsText = rhs.values.join(', ');\n } else if (hasProp(rhs, 'start')) {\n const startValue = formatLiteralValue(lhsField.type, rhs.start, locale, translate);\n const endValue = formatLiteralValue(lhsField.type, rhs.end, locale, translate);\n\n rhsText = `${startValue} - ${endValue}`;\n }\n }\n\n switch (comparator) {\n case 'IS_NULL':\n return `${lhsText}is null`;\n case 'IS_NOT_NULL':\n return `${lhsText}is not null`;\n case 'IS_TRUE':\n return `${lhsText}is true`;\n case 'IS_FALSE':\n return `${lhsText}is false`;\n case 'EQ':\n return `${lhsText}is ${rhsText}`;\n case 'NEQ':\n return `${lhsText}isn't ${rhsText}`;\n case 'IN':\n return `${lhsText}is among ${rhsText}`;\n case 'NOT_IN':\n return `${lhsText}is not among ${rhsText}`;\n case 'GT':\n return `${lhsText}> ${rhsText}`;\n case 'GTE':\n return `${lhsText}>= ${rhsText}`;\n case 'LT':\n return `${lhsText}< ${rhsText}`;\n case 'LTE':\n return `${lhsText}<= ${rhsText}`;\n case 'BTW':\n return `${lhsText}is between ${rhsText}`;\n case 'NOT_BTW':\n return `${lhsText}is not between ${rhsText}`;\n case 'STARTS_WITH':\n return `${lhsText}starts with ${rhsText}`;\n case 'NOT_STARTS_WITH':\n return `${lhsText}doesn't start with ${rhsText}`;\n case 'ENDS_WITH':\n return `${lhsText}ends with ${rhsText}`;\n case 'NOT_ENDS_WITH':\n return `${lhsText}doesn't end with ${rhsText}`;\n case 'CONTAINS':\n return `${lhsText}contains ${rhsText}`;\n case 'NOT_CONTAINS':\n return `${lhsText}doesn't contain ${rhsText}`;\n default:\n return ''; // Not needed\n }\n}\n\n/** Returns a user-friendly text representation of the given node in a condition */\nfunction formatConditionNode(\n node: Condition,\n fields: Field[],\n translate: TranslationFunction<TranslationPack>,\n options?: ConditionFormatOptions\n): string {\n if (hasProp(node, 'AND')) {\n const childStrings = node.AND.map(n => formatConditionNode(n, fields, translate, options));\n return `(${childStrings.join(' AND ')})`;\n }\n\n if (hasProp(node, 'OR')) {\n const childStrings = node.OR.map(n => formatConditionNode(n, fields, translate, options));\n return `(${childStrings.join(' OR ')})`;\n }\n\n if (hasProp(node, 'NOT')) {\n const childString = formatConditionNode(node.NOT, fields, translate, options);\n if (childString.startsWith(LPAREN) && childString.endsWith(RPAREN)) {\n // Avoid double brackets when the child node is an AND/OR node\n return `NOT ${childString}`;\n }\n return `NOT (${childString})`;\n }\n\n return formatLeafCondition(node.condition, fields, translate, options); // If leaf-level is reached\n}\n\n/**\n * Returns a user-friendly text representation of a given complex condition\n * The input `fields` are used to look up display labels for the fields\n */\nexport default function formatCondition(\n condition: Condition,\n fields: Field[],\n translate: TranslationFunction<TranslationPack>,\n options?: ConditionFormatOptions\n): string {\n // Recursively format the tree, starting at the root node\n let text = formatConditionNode(condition, fields, translate, options);\n\n // If the root node is AND/OR, there will be extra parentheses. Remove them\n if (text.startsWith(LPAREN) && text.endsWith(RPAREN)) {\n text = text.slice(1, -1);\n }\n\n return text;\n}\n"]}
|
|
@@ -21,7 +21,7 @@ interface RemoveAction {
|
|
|
21
21
|
removeAt: number;
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
|
-
|
|
24
|
+
type RowAction = InsertAction | UpdateAction | RemoveAction;
|
|
25
25
|
export default function rowsReducer(rows: ConditionRow[], action: RowAction): ConditionRow[];
|
|
26
26
|
export {};
|
|
27
27
|
//# sourceMappingURL=rows-reducer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rows-reducer.d.ts","sourceRoot":"","sources":["../../../../src/components/ConditionBuilder/core/rows-reducer.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAazD,eAAO,MAAM,UAAU,eAAe,CAAC;AACvC,eAAO,MAAM,UAAU,eAAe,CAAC;AACvC,eAAO,MAAM,UAAU,eAAe,CAAC;AAGvC,UAAU,YAAY;IACpB,IAAI,EAAE,YAAY,CAAC;IACnB,OAAO,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC;CAC/B;AACD,UAAU,YAAY;IACpB,IAAI,EAAE,YAAY,CAAC;IACnB,OAAO,EAAE;QACP,QAAQ,EAAE,MAAM,CAAC;QACjB,MAAM,EAAE,YAAY,CAAC;KACtB,CAAC;CACH;AACD,UAAU,YAAY;IACpB,IAAI,EAAE,YAAY,CAAC;IACnB,OAAO,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC;CAC/B;AACD,
|
|
1
|
+
{"version":3,"file":"rows-reducer.d.ts","sourceRoot":"","sources":["../../../../src/components/ConditionBuilder/core/rows-reducer.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAazD,eAAO,MAAM,UAAU,eAAe,CAAC;AACvC,eAAO,MAAM,UAAU,eAAe,CAAC;AACvC,eAAO,MAAM,UAAU,eAAe,CAAC;AAGvC,UAAU,YAAY;IACpB,IAAI,EAAE,YAAY,CAAC;IACnB,OAAO,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC;CAC/B;AACD,UAAU,YAAY;IACpB,IAAI,EAAE,YAAY,CAAC;IACnB,OAAO,EAAE;QACP,QAAQ,EAAE,MAAM,CAAC;QACjB,MAAM,EAAE,YAAY,CAAC;KACtB,CAAC;CACH;AACD,UAAU,YAAY;IACpB,IAAI,EAAE,YAAY,CAAC;IACnB,OAAO,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC;CAC/B;AACD,KAAK,SAAS,GAAG,YAAY,GAAG,YAAY,GAAG,YAAY,CAAC;AAG5D,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,IAAI,EAAE,YAAY,EAAE,EAAE,MAAM,EAAE,SAAS,GAAG,YAAY,EAAE,CAoC3F"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transformer.d.ts","sourceRoot":"","sources":["../../../../src/components/ConditionBuilder/core/transformer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"transformer.d.ts","sourceRoot":"","sources":["../../../../src/components/ConditionBuilder/core/transformer.ts"],"names":[],"mappings":"AAEA,OAAO,eAAe,CAAC;AAIvB,OAAO,EAAE,SAAS,EAAiB,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAkN5E;;GAEG;AACH,MAAM,CAAC,OAAO,UAAU,yBAAyB,CAC/C,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,KAAK,EAAE,EACf,eAAe,CAAC,EAAE,MAAM,GACvB,SAAS,CA0BX"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
//
|
|
1
|
+
// cspell:words DDTHH
|
|
2
2
|
import dayjs from 'dayjs';
|
|
3
3
|
import './extendDayJs';
|
|
4
4
|
import { hasProp } from '@pega/cosmos-react-core';
|
|
5
5
|
import { getItem } from './utils';
|
|
6
6
|
const dayjsDateParts = {
|
|
7
|
+
SECONDS: 'second',
|
|
7
8
|
MINUTES: 'minute',
|
|
8
9
|
HOURS: 'hour',
|
|
9
10
|
DAYS: 'day',
|
|
@@ -55,7 +56,8 @@ function getConditionForBetweenComparator(start, end, node) {
|
|
|
55
56
|
/** Construct a date-range filter based on the given date bounds and the comparator */
|
|
56
57
|
function getConditionFromRange(startDate, endDate, node, lhsFieldType) {
|
|
57
58
|
const formatDate = (d) => {
|
|
58
|
-
const
|
|
59
|
+
const timezoneOffset = new Date().getTimezoneOffset() * 60 * 1000;
|
|
60
|
+
const isoString = new Date(d.toDate().getTime() - timezoneOffset).toISOString().slice(0, -1);
|
|
59
61
|
return isoString.substring(0, isoString.indexOf(lhsFieldType === 'DATE_ONLY' ? 'T' : '.'));
|
|
60
62
|
};
|
|
61
63
|
switch (node.comparator) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transformer.js","sourceRoot":"","sources":["../../../../src/components/ConditionBuilder/core/transformer.ts"],"names":[],"mappings":"AAAA,qBAAqB;AAErB,OAAO,KAA2B,MAAM,OAAO,CAAC;AAChD,OAAO,eAAe,CAAC;AAEvB,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAIlD,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAGlC,MAAM,cAAc,GAAgC;IAClD,OAAO,EAAE,QAAQ;IACjB,KAAK,EAAE,MAAM;IACb,IAAI,EAAE,KAAK;IACX,KAAK,EAAE,MAAmB;IAC1B,QAAQ,EAAE,SAAS;IACnB,MAAM,EAAE,OAAO;IACf,KAAK,EAAE,MAAM;CACd,CAAC;AAEF,+EAA+E;AAC/E,SAAS,gCAAgC,CACvC,KAAsB,EACtB,GAAoB,EACpB,IAAmB;IAEnB,OAAO,IAAI,CAAC,UAAU,KAAK,KAAK;QAC9B,CAAC,CAAC;YACE,GAAG,EAAE;gBACH;oBACE,SAAS,EAAE;wBACT,GAAG,EAAE,IAAI,CAAC,GAAG;wBACb,UAAU,EAAE,KAAK;wBACjB,GAAG,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE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OAAO;YACL,GAAG,EAAE,yBAAyB,CAAC,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,eAAe,CAAC;SACvE,CAAC;KACH;IAED,OAAO,sBAAsB,CAAC,SAAS,CAAC,SAAS,EAAE,MAAM,EAAE,eAAe,CAAC,CAAC;AAC9E,CAAC","sourcesContent":["// cSpell:words DDTHH\n\nimport dayjs, { QUnitType, Dayjs } from 'dayjs';\nimport './extendDayJs';\n\nimport { hasProp } from '@pega/cosmos-react-core';\n\nimport { Condition, LeafCondition, Field } from '../ConditionBuilder.types';\n\nimport { getItem } from './utils';\nimport { DatePart, FieldType } from './types';\n\nconst dayjsDateParts: Record<DatePart, QUnitType> = {\n MINUTES: 'minute',\n HOURS: 'hour',\n DAYS: 'day',\n WEEKS: 'week' as QUnitType,\n QUARTERS: 'quarter',\n MONTHS: 'month',\n YEARS: 'year'\n};\n\n/** Construct Condition with two range comparators based on the given bounds */\nfunction getConditionForBetweenComparator(\n start: string | number,\n end: string | number,\n node: LeafCondition\n): Condition {\n return node.comparator === 'BTW'\n ? {\n AND: [\n {\n condition: {\n lhs: node.lhs,\n comparator: 'GTE',\n rhs: { value: start }\n }\n },\n {\n condition: {\n lhs: node.lhs,\n comparator: 'LTE',\n rhs: { value: end }\n }\n }\n ]\n }\n : {\n OR: [\n {\n condition: {\n lhs: node.lhs,\n comparator: 'LT',\n rhs: { value: start }\n }\n },\n {\n condition: {\n lhs: node.lhs,\n comparator: 'GT',\n rhs: { value: end }\n }\n }\n ]\n };\n}\n\n/** Construct a date-range filter based on the given date bounds and the comparator */\nfunction getConditionFromRange(\n startDate: Dayjs,\n endDate: Dayjs,\n node: LeafCondition,\n lhsFieldType: FieldType\n): Condition {\n const formatDate = (d: Dayjs) => {\n const isoString = d.toISOString();\n return isoString.substring(0, isoString.indexOf(lhsFieldType === 'DATE_ONLY' ? 'T' : '.'));\n };\n\n switch (node.comparator) {\n case 'EQ':\n return {\n AND: [\n {\n condition: {\n lhs: node.lhs,\n comparator: 'LTE',\n rhs: { value: formatDate(endDate) }\n }\n },\n {\n condition: {\n lhs: node.lhs,\n comparator: 'GTE',\n rhs: { value: formatDate(startDate) }\n }\n }\n ]\n };\n case 'NEQ':\n return {\n OR: [\n {\n condition: {\n lhs: node.lhs,\n comparator: 'GT',\n rhs: { value: formatDate(endDate) }\n }\n },\n {\n condition: {\n lhs: node.lhs,\n comparator: 'LT',\n rhs: { value: formatDate(startDate) }\n }\n }\n ]\n };\n case 'GT':\n return {\n condition: {\n lhs: node.lhs,\n comparator: 'GT',\n rhs: { value: formatDate(endDate) }\n }\n };\n case 'GTE':\n return {\n condition: {\n lhs: node.lhs,\n comparator: 'GTE',\n rhs: { value: formatDate(startDate) }\n }\n };\n case 'LT':\n return {\n condition: {\n lhs: node.lhs,\n comparator: 'LT',\n rhs: { value: formatDate(startDate) }\n }\n };\n case 'LTE':\n return {\n condition: {\n lhs: node.lhs,\n comparator: 'LTE',\n rhs: { value: formatDate(endDate) }\n }\n };\n case 'BTW':\n case 'NOT_BTW':\n return getConditionForBetweenComparator(formatDate(startDate), formatDate(endDate), node);\n default:\n return { condition: node };\n }\n}\n\nfunction transformLeafCondition(\n node: LeafCondition,\n fields: Field[],\n currentDateTime?: string\n): Condition {\n const field = getItem(fields, node.lhs.field);\n if (!field || !hasProp(field, 'type')) {\n return { condition: node }; // Safety check\n }\n\n // Transform Relative date filters into equivalent date range filters\n if (node.rhs && hasProp(node.rhs, 'relativeDate')) {\n const { timePeriod, interval, datePart } = node.rhs.relativeDate;\n const dayjsDatePart = dayjsDateParts[datePart];\n const now = dayjs(currentDateTime);\n\n let startDate = now;\n let endDate = now;\n if (timePeriod === 'CURRENT') {\n startDate = now.startOf(dayjsDatePart);\n endDate = now.endOf(dayjsDatePart);\n } else if (timePeriod === 'LAST' && interval && interval >= 1) {\n startDate = now.subtract(interval, dayjsDatePart);\n } else if (timePeriod === 'PREVIOUS' && interval && interval >= 1) {\n startDate = now.startOf(dayjsDatePart).subtract(interval, dayjsDatePart);\n endDate = now.subtract(1, dayjsDatePart).endOf(dayjsDatePart);\n } else if (timePeriod === 'NEXT' && interval && interval >= 1) {\n startDate = now.add(1, dayjsDatePart).startOf(dayjsDatePart);\n endDate = now.endOf(dayjsDatePart).add(interval, dayjsDatePart);\n }\n\n return getConditionFromRange(startDate, endDate, node, field.type);\n }\n\n // Transform WEEKS-filters into equivalent date-range filters\n // NOTE: This is a work-around until we make startOfDay customizable for Weeks\n if (node.rhs && hasProp(node.rhs, 'dateFunction') && node.rhs.dateFunction === 'WEEKS') {\n const startDate = dayjs(node.rhs.value); // Since we store it as YYYY-MM-DD, it's already the start of day\n const endDate = startDate.add(6, 'day').endOf('day'); // Last millisecond on the 7th day from startDate\n return getConditionFromRange(startDate, endDate, node, field.type);\n }\n\n // Transform double range comparators (BTW, NOT_BTW) into equivalent pair of single range comparators\n if (node.rhs && hasProp(node.rhs, 'start')) {\n if (field.type === 'NUMBER' || field.type === 'TIME_ONLY') {\n return getConditionForBetweenComparator(node.rhs.start, node.rhs.end, node);\n }\n\n const startDate = dayjs(node.rhs.start);\n const endDate = dayjs(node.rhs.end);\n return getConditionFromRange(startDate, endDate, node, field.type);\n }\n\n // For all other cases\n return { condition: node };\n}\n\n/** This function transforms Conditions with Relative Dates into Conditions with Date Ranges.\n * Do not use this function unless you need to convert Relative Dates into Date Ranges.\n */\nexport default function transformComplexCondition(\n condition: Condition,\n fields: Field[],\n currentDateTime?: string\n): Condition {\n if (hasProp(condition, 'AND')) {\n const childNodes: Condition[] = condition.AND.map(n =>\n transformComplexCondition(n, fields, currentDateTime)\n );\n return {\n AND: childNodes\n };\n }\n\n if (hasProp(condition, 'OR')) {\n const childNodes: Condition[] = condition.OR.map(n =>\n transformComplexCondition(n, fields, currentDateTime)\n );\n return {\n OR: childNodes\n };\n }\n\n if (hasProp(condition, 'NOT')) {\n return {\n NOT: transformComplexCondition(condition.NOT, fields, currentDateTime)\n };\n }\n\n return transformLeafCondition(condition.condition, fields, currentDateTime);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"transformer.js","sourceRoot":"","sources":["../../../../src/components/ConditionBuilder/core/transformer.ts"],"names":[],"mappings":"AAAA,qBAAqB;AACrB,OAAO,KAA2B,MAAM,OAAO,CAAC;AAChD,OAAO,eAAe,CAAC;AAEvB,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAIlD,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAGlC,MAAM,cAAc,GAAgC;IAClD,OAAO,EAAE,QAAQ;IACjB,OAAO,EAAE,QAAQ;IACjB,KAAK,EAAE,MAAM;IACb,IAAI,EAAE,KAAK;IACX,KAAK,EAAE,MAAmB;IAC1B,QAAQ,EAAE,SAAS;IACnB,MAAM,EAAE,OAAO;IACf,KAAK,EAAE,MAAM;CACd,CAAC;AAEF,+EAA+E;AAC/E,SAAS,gCAAgC,CACvC,KAAsB,EACtB,GAAoB,EACpB,IAAmB;IAEnB,OAAO,IAAI,CAAC,UAAU,KAAK,KAAK;QAC9B,CAAC,CAAC;YACE,GAAG,EAAE;gBACH;oBACE,SAAS,EAAE;wBACT,GAAG,EAAE,IAAI,CAAC,GAAG;wBACb,UAAU,EAAE,KAAK;wBACjB,GAAG,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE;qBACtB;iBACF;gBACD;oBACE,SAAS,EAAE;wBACT,GAAG,EAAE,IAAI,CAAC,GAAG;wBACb,UAAU,EAAE,KAAK;wBACjB,GAAG,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE;qBACpB;iBACF;aACF;SACF;QACH,CAAC,CAAC;YACE,EAAE,EAAE;gBACF;oBACE,SAAS,EAAE;wBACT,GAAG,EAAE,IAAI,CAAC,GAAG;wBACb,UAAU,EAAE,IAAI;wBAChB,GAAG,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE;qBACtB;iBACF;gBACD;oBACE,SAAS,EAAE;wBACT,GAAG,EAAE,IAAI,CAAC,GAAG;wBACb,UAAU,EAAE,IAAI;wB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ayjs, { QUnitType, Dayjs } from 'dayjs';\nimport './extendDayJs';\n\nimport { hasProp } from '@pega/cosmos-react-core';\n\nimport { Condition, LeafCondition, Field } from '../ConditionBuilder.types';\n\nimport { getItem } from './utils';\nimport { DatePart, FieldType } from './types';\n\nconst dayjsDateParts: Record<DatePart, QUnitType> = {\n SECONDS: 'second',\n MINUTES: 'minute',\n HOURS: 'hour',\n DAYS: 'day',\n WEEKS: 'week' as QUnitType,\n QUARTERS: 'quarter',\n MONTHS: 'month',\n YEARS: 'year'\n};\n\n/** Construct Condition with two range comparators based on the given bounds */\nfunction getConditionForBetweenComparator(\n start: string | number,\n end: string | number,\n node: LeafCondition\n): Condition {\n return node.comparator === 'BTW'\n ? {\n AND: [\n {\n condition: {\n lhs: node.lhs,\n comparator: 'GTE',\n rhs: { value: start }\n }\n },\n {\n condition: {\n lhs: node.lhs,\n comparator: 'LTE',\n rhs: { value: end }\n }\n }\n ]\n }\n : {\n OR: [\n {\n condition: {\n lhs: node.lhs,\n comparator: 'LT',\n rhs: { value: start }\n }\n },\n {\n condition: {\n lhs: node.lhs,\n comparator: 'GT',\n rhs: { value: end }\n }\n }\n ]\n };\n}\n\n/** Construct a date-range filter based on the given date bounds and the comparator */\nfunction getConditionFromRange(\n startDate: Dayjs,\n endDate: Dayjs,\n node: LeafCondition,\n lhsFieldType: FieldType\n): Condition {\n const formatDate = (d: Dayjs) => {\n const timezoneOffset = new Date().getTimezoneOffset() * 60 * 1000;\n const isoString = new Date(d.toDate().getTime() - timezoneOffset).toISOString().slice(0, -1);\n return isoString.substring(0, isoString.indexOf(lhsFieldType === 'DATE_ONLY' ? 'T' : '.'));\n };\n\n switch (node.comparator) {\n case 'EQ':\n return {\n AND: [\n {\n condition: {\n lhs: node.lhs,\n comparator: 'LTE',\n rhs: { value: formatDate(endDate) }\n }\n },\n {\n condition: {\n lhs: node.lhs,\n comparator: 'GTE',\n rhs: { value: formatDate(startDate) }\n }\n }\n ]\n };\n case 'NEQ':\n return {\n OR: [\n {\n condition: {\n lhs: node.lhs,\n comparator: 'GT',\n rhs: { value: formatDate(endDate) }\n }\n },\n {\n condition: {\n lhs: node.lhs,\n comparator: 'LT',\n rhs: { value: formatDate(startDate) }\n }\n }\n ]\n };\n case 'GT':\n return {\n condition: {\n lhs: node.lhs,\n comparator: 'GT',\n rhs: { value: formatDate(endDate) }\n }\n };\n case 'GTE':\n return {\n condition: {\n lhs: node.lhs,\n comparator: 'GTE',\n rhs: { value: formatDate(startDate) }\n }\n };\n case 'LT':\n return {\n condition: {\n lhs: node.lhs,\n comparator: 'LT',\n rhs: { value: formatDate(startDate) }\n }\n };\n case 'LTE':\n return {\n condition: {\n lhs: node.lhs,\n comparator: 'LTE',\n rhs: { value: formatDate(endDate) }\n }\n };\n case 'BTW':\n case 'NOT_BTW':\n return getConditionForBetweenComparator(formatDate(startDate), formatDate(endDate), node);\n default:\n return { condition: node };\n }\n}\n\nfunction transformLeafCondition(\n node: LeafCondition,\n fields: Field[],\n currentDateTime?: string\n): Condition {\n const field = getItem(fields, node.lhs.field);\n if (!field || !hasProp(field, 'type')) {\n return { condition: node }; // Safety check\n }\n\n // Transform Relative date filters into equivalent date range filters\n if (node.rhs && hasProp(node.rhs, 'relativeDate')) {\n const { timePeriod, interval, datePart } = node.rhs.relativeDate;\n const dayjsDatePart = dayjsDateParts[datePart];\n const now = dayjs(currentDateTime);\n\n let startDate = now;\n let endDate = now;\n if (timePeriod === 'CURRENT') {\n startDate = now.startOf(dayjsDatePart);\n endDate = now.endOf(dayjsDatePart);\n } else if (timePeriod === 'LAST' && interval && interval >= 1) {\n startDate = now.subtract(interval, dayjsDatePart);\n } else if (timePeriod === 'PREVIOUS' && interval && interval >= 1) {\n startDate = now.startOf(dayjsDatePart).subtract(interval, dayjsDatePart);\n endDate = now.subtract(1, dayjsDatePart).endOf(dayjsDatePart);\n } else if (timePeriod === 'NEXT' && interval && interval >= 1) {\n startDate = now.add(1, dayjsDatePart).startOf(dayjsDatePart);\n endDate = now.endOf(dayjsDatePart).add(interval, dayjsDatePart);\n }\n\n return getConditionFromRange(startDate, endDate, node, field.type);\n }\n\n // Transform WEEKS-filters into equivalent date-range filters\n // NOTE: This is a work-around until we make startOfDay customizable for Weeks\n if (node.rhs && hasProp(node.rhs, 'dateFunction') && node.rhs.dateFunction === 'WEEKS') {\n const startDate = dayjs(node.rhs.value); // Since we store it as YYYY-MM-DD, it's already the start of day\n const endDate = startDate.add(6, 'day').endOf('day'); // Last millisecond on the 7th day from startDate\n return getConditionFromRange(startDate, endDate, node, field.type);\n }\n\n // Transform double range comparators (BTW, NOT_BTW) into equivalent pair of single range comparators\n if (node.rhs && hasProp(node.rhs, 'start')) {\n if (field.type === 'NUMBER' || field.type === 'TIME_ONLY') {\n return getConditionForBetweenComparator(node.rhs.start, node.rhs.end, node);\n }\n\n const startDate = dayjs(node.rhs.start);\n const endDate = dayjs(node.rhs.end);\n return getConditionFromRange(startDate, endDate, node, field.type);\n }\n\n // For all other cases\n return { condition: node };\n}\n\n/** This function transforms Conditions with Relative Dates into Conditions with Date Ranges.\n * Do not use this function unless you need to convert Relative Dates into Date Ranges.\n */\nexport default function transformComplexCondition(\n condition: Condition,\n fields: Field[],\n currentDateTime?: string\n): Condition {\n if (hasProp(condition, 'AND')) {\n const childNodes: Condition[] = condition.AND.map(n =>\n transformComplexCondition(n, fields, currentDateTime)\n );\n return {\n AND: childNodes\n };\n }\n\n if (hasProp(condition, 'OR')) {\n const childNodes: Condition[] = condition.OR.map(n =>\n transformComplexCondition(n, fields, currentDateTime)\n );\n return {\n OR: childNodes\n };\n }\n\n if (hasProp(condition, 'NOT')) {\n return {\n NOT: transformComplexCondition(condition.NOT, fields, currentDateTime)\n };\n }\n\n return transformLeafCondition(condition.condition, fields, currentDateTime);\n}\n"]}
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
/** Supported field types */
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
export type FieldType = 'BOOLEAN' | 'TEXT' | 'NUMBER' | 'DATE_TIME' | 'DATE_ONLY' | 'TIME_ONLY';
|
|
3
|
+
type NullComparator = 'IS_NULL' | 'IS_NOT_NULL';
|
|
4
|
+
type EqualityComparator = 'EQ' | 'NEQ';
|
|
5
|
+
type RangeComparator = 'GT' | 'GTE' | 'LT' | 'LTE' | 'BTW' | 'NOT_BTW';
|
|
6
|
+
type TruenessComparator = 'IS_TRUE' | 'IS_FALSE';
|
|
7
|
+
type ListComparator = 'IN' | 'NOT_IN';
|
|
8
|
+
type TextMatchComparator = 'STARTS_WITH' | 'NOT_STARTS_WITH' | 'ENDS_WITH' | 'NOT_ENDS_WITH' | 'CONTAINS' | 'NOT_CONTAINS';
|
|
9
9
|
/** All supported Comparators */
|
|
10
|
-
export
|
|
10
|
+
export type Comparator = TruenessComparator | NullComparator | EqualityComparator | ListComparator | RangeComparator | TextMatchComparator;
|
|
11
11
|
/** Comparators supported for BOOLEAN fields */
|
|
12
|
-
|
|
12
|
+
type BooleanComparator = TruenessComparator | EqualityComparator | NullComparator;
|
|
13
13
|
/** Comparators supported for TEXT fields */
|
|
14
|
-
|
|
14
|
+
type TextComparator = EqualityComparator | ListComparator | TextMatchComparator | NullComparator;
|
|
15
15
|
/** Comparators supported for NUMBER fields */
|
|
16
|
-
|
|
16
|
+
type NumberComparator = EqualityComparator | ListComparator | RangeComparator | NullComparator;
|
|
17
17
|
/** Comparators supported for DATE_TIME/DATE_ONLY/TIME_ONLY fields */
|
|
18
|
-
|
|
18
|
+
type DateTimeComparator = EqualityComparator | RangeComparator | NullComparator;
|
|
19
19
|
/** Type definition to specify supported comparators by field-type */
|
|
20
|
-
export
|
|
20
|
+
export type ComparatorsByType = {
|
|
21
21
|
type: 'BOOLEAN';
|
|
22
22
|
comparators: BooleanComparator[];
|
|
23
23
|
} | {
|
|
@@ -36,12 +36,12 @@ export declare type ComparatorsByType = {
|
|
|
36
36
|
type: 'TIME_ONLY';
|
|
37
37
|
comparators: DateTimeComparator[];
|
|
38
38
|
};
|
|
39
|
-
export
|
|
39
|
+
export type RHSType = 'LITERAL' | 'FIELD' | 'DATE_FUNCTION' | 'RELATIVE_DATE' | 'PARAMETER';
|
|
40
40
|
/** Date function types supported on the RHS */
|
|
41
|
-
export
|
|
41
|
+
export type DateFunction = 'YEARS' | 'QUARTERS' | 'MONTHS' | 'WEEKS' | 'DAYS' | 'HOURS' | 'MINUTES' | 'SECONDS' | 'HOURS_OF_DAY' | 'MONTHS_OF_YEAR' | 'DAYS_OF_MONTH' | 'DAYS_OF_WEEK';
|
|
42
42
|
/** "Relative Date" Time Periods supported on the RHS */
|
|
43
|
-
export
|
|
43
|
+
export type TimePeriod = 'LAST' | 'PREVIOUS' | 'CURRENT' | 'NEXT';
|
|
44
44
|
/** "Relative Date" Date Parts supported on the RHS */
|
|
45
|
-
export
|
|
45
|
+
export type DatePart = 'SECONDS' | 'MINUTES' | 'HOURS' | 'DAYS' | 'WEEKS' | 'MONTHS' | 'QUARTERS' | 'YEARS';
|
|
46
46
|
export {};
|
|
47
47
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/ConditionBuilder/core/types.ts"],"names":[],"mappings":"AAAA,4BAA4B;AAC5B,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/ConditionBuilder/core/types.ts"],"names":[],"mappings":"AAAA,4BAA4B;AAC5B,MAAM,MAAM,SAAS,GAAG,SAAS,GAAG,MAAM,GAAG,QAAQ,GAAG,WAAW,GAAG,WAAW,GAAG,WAAW,CAAC;AAEhG,KAAK,cAAc,GAAG,SAAS,GAAG,aAAa,CAAC;AAChD,KAAK,kBAAkB,GAAG,IAAI,GAAG,KAAK,CAAC;AACvC,KAAK,eAAe,GAAG,IAAI,GAAG,KAAK,GAAG,IAAI,GAAG,KAAK,GAAG,KAAK,G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AM,OAAO,GAAG,SAAS,GAAG,OAAO,GAAG,eAAe,GAAG,eAAe,GAAG,WAAW,CAAC;AAE5F,+CAA+C;AAC/C,MAAM,MAAM,YAAY,GACpB,OAAO,GACP,UAAU,GACV,QAAQ,GACR,OAAO,GACP,MAAM,GACN,OAAO,GACP,SAAS,GACT,SAAS,GACT,cAAc,GACd,gBAAgB,GAChB,eAAe,GACf,cAAc,CAAC;AAEnB,wDAAwD;AACxD,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,UAAU,GAAG,SAAS,GAAG,MAAM,CAAC;AAElE,sDAAsD;AACtD,MAAM,MAAM,QAAQ,GAChB,SAAS,GACT,SAAS,GACT,OAAO,GACP,MAAM,GACN,OAAO,GACP,QAAQ,GACR,UAAU,GACV,OAAO,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/components/ConditionBuilder/core/types.ts"],"names":[],"mappings":"","sourcesContent":["/** Supported field types */\nexport type FieldType = 'BOOLEAN' | 'TEXT' | 'NUMBER' | 'DATE_TIME' | 'DATE_ONLY' | 'TIME_ONLY';\n\ntype NullComparator = 'IS_NULL' | 'IS_NOT_NULL';\ntype EqualityComparator = 'EQ' | 'NEQ';\ntype RangeComparator = 'GT' | 'GTE' | 'LT' | 'LTE' | 'BTW' | 'NOT_BTW';\ntype TruenessComparator = 'IS_TRUE' | 'IS_FALSE';\ntype ListComparator = 'IN' | 'NOT_IN';\ntype TextMatchComparator =\n | 'STARTS_WITH'\n | 'NOT_STARTS_WITH'\n | 'ENDS_WITH'\n | 'NOT_ENDS_WITH'\n | 'CONTAINS'\n | 'NOT_CONTAINS';\n\n/** All supported Comparators */\nexport type Comparator =\n | TruenessComparator\n | NullComparator\n | EqualityComparator\n | ListComparator\n | RangeComparator\n | TextMatchComparator;\n\n/** Comparators supported for BOOLEAN fields */\ntype BooleanComparator = TruenessComparator | EqualityComparator | NullComparator;\n\n/** Comparators supported for TEXT fields */\ntype TextComparator = EqualityComparator | ListComparator | TextMatchComparator | NullComparator;\n\n/** Comparators supported for NUMBER fields */\ntype NumberComparator = EqualityComparator | ListComparator | RangeComparator | NullComparator;\n\n/** Comparators supported for DATE_TIME/DATE_ONLY/TIME_ONLY fields */\ntype DateTimeComparator = EqualityComparator | RangeComparator | NullComparator;\n\n/** Type definition to specify supported comparators by field-type */\nexport type ComparatorsByType =\n | { type: 'BOOLEAN'; comparators: BooleanComparator[] }\n | { type: 'TEXT'; comparators: TextComparator[] }\n | { type: 'NUMBER'; comparators: NumberComparator[] }\n | { type: 'DATE_TIME'; comparators: DateTimeComparator[] }\n | { type: 'DATE_ONLY'; comparators: DateTimeComparator[] }\n | { type: 'TIME_ONLY'; comparators: DateTimeComparator[] };\n\nexport type RHSType = 'LITERAL' | 'FIELD' | 'DATE_FUNCTION' | 'RELATIVE_DATE' | 'PARAMETER';\n\n/** Date function types supported on the RHS */\nexport type DateFunction =\n | 'YEARS'\n | 'QUARTERS'\n | 'MONTHS'\n | 'WEEKS'\n | 'DAYS'\n | 'HOURS'\n | 'HOURS_OF_DAY'\n | 'MONTHS_OF_YEAR'\n | 'DAYS_OF_MONTH'\n | 'DAYS_OF_WEEK';\n\n/** \"Relative Date\" Time Periods supported on the RHS */\nexport type TimePeriod = 'LAST' | 'PREVIOUS' | 'CURRENT' | 'NEXT';\n\n/** \"Relative Date\" Date Parts supported on the RHS */\nexport type DatePart
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/components/ConditionBuilder/core/types.ts"],"names":[],"mappings":"","sourcesContent":["/** Supported field types */\nexport type FieldType = 'BOOLEAN' | 'TEXT' | 'NUMBER' | 'DATE_TIME' | 'DATE_ONLY' | 'TIME_ONLY';\n\ntype NullComparator = 'IS_NULL' | 'IS_NOT_NULL';\ntype EqualityComparator = 'EQ' | 'NEQ';\ntype RangeComparator = 'GT' | 'GTE' | 'LT' | 'LTE' | 'BTW' | 'NOT_BTW';\ntype TruenessComparator = 'IS_TRUE' | 'IS_FALSE';\ntype ListComparator = 'IN' | 'NOT_IN';\ntype TextMatchComparator =\n | 'STARTS_WITH'\n | 'NOT_STARTS_WITH'\n | 'ENDS_WITH'\n | 'NOT_ENDS_WITH'\n | 'CONTAINS'\n | 'NOT_CONTAINS';\n\n/** All supported Comparators */\nexport type Comparator =\n | TruenessComparator\n | NullComparator\n | EqualityComparator\n | ListComparator\n | RangeComparator\n | TextMatchComparator;\n\n/** Comparators supported for BOOLEAN fields */\ntype BooleanComparator = TruenessComparator | EqualityComparator | NullComparator;\n\n/** Comparators supported for TEXT fields */\ntype TextComparator = EqualityComparator | ListComparator | TextMatchComparator | NullComparator;\n\n/** Comparators supported for NUMBER fields */\ntype NumberComparator = EqualityComparator | ListComparator | RangeComparator | NullComparator;\n\n/** Comparators supported for DATE_TIME/DATE_ONLY/TIME_ONLY fields */\ntype DateTimeComparator = EqualityComparator | RangeComparator | NullComparator;\n\n/** Type definition to specify supported comparators by field-type */\nexport type ComparatorsByType =\n | { type: 'BOOLEAN'; comparators: BooleanComparator[] }\n | { type: 'TEXT'; comparators: TextComparator[] }\n | { type: 'NUMBER'; comparators: NumberComparator[] }\n | { type: 'DATE_TIME'; comparators: DateTimeComparator[] }\n | { type: 'DATE_ONLY'; comparators: DateTimeComparator[] }\n | { type: 'TIME_ONLY'; comparators: DateTimeComparator[] };\n\nexport type RHSType = 'LITERAL' | 'FIELD' | 'DATE_FUNCTION' | 'RELATIVE_DATE' | 'PARAMETER';\n\n/** Date function types supported on the RHS */\nexport type DateFunction =\n | 'YEARS'\n | 'QUARTERS'\n | 'MONTHS'\n | 'WEEKS'\n | 'DAYS'\n | 'HOURS'\n | 'MINUTES'\n | 'SECONDS'\n | 'HOURS_OF_DAY'\n | 'MONTHS_OF_YEAR'\n | 'DAYS_OF_MONTH'\n | 'DAYS_OF_WEEK';\n\n/** \"Relative Date\" Time Periods supported on the RHS */\nexport type TimePeriod = 'LAST' | 'PREVIOUS' | 'CURRENT' | 'NEXT';\n\n/** \"Relative Date\" Date Parts supported on the RHS */\nexport type DatePart =\n | 'SECONDS'\n | 'MINUTES'\n | 'HOURS'\n | 'DAYS'\n | 'WEEKS'\n | 'MONTHS'\n | 'QUARTERS'\n | 'YEARS';\n"]}
|
|
@@ -30,12 +30,8 @@ export declare function splitConditionTree(tree: Condition, labelPrefix?: string
|
|
|
30
30
|
export declare function isBasicModeApplicable(condition: Condition): boolean;
|
|
31
31
|
/** Returns a list of operators to show in the Basic mode, using a logicString as the input */
|
|
32
32
|
export declare function getBasicModeOperators(logic: string): ('AND' | 'OR')[];
|
|
33
|
-
/**
|
|
34
|
-
* Takes a list of operators from between the Basic mode rows and constructs a logic-string out of them
|
|
35
|
-
*/
|
|
33
|
+
/** Takes a list of operators from between the Basic mode rows and constructs a logic-string out of them */
|
|
36
34
|
export declare function getLogicFromBasicMode(operatorsList: ('AND' | 'OR')[]): string;
|
|
37
|
-
/**
|
|
38
|
-
* Takes a list of objects and id of the object to be found and recursively finds and returns the object
|
|
39
|
-
*/
|
|
35
|
+
/** Takes a list of objects and id of the object to be found and recursively finds and returns the object */
|
|
40
36
|
export declare function getItem(items: Field[], id: string): Field | undefined;
|
|
41
37
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/components/ConditionBuilder/core/utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/components/ConditionBuilder/core/utils.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAiQ1F,yDAAyD;AACzD,wBAAgB,gBAAgB,CAC9B,UAAU,EAAE,MAAM,EAClB,eAAe,EAAE;IAAE,CAAC,KAAK,EAAE,MAAM,GAAG,aAAa,CAAA;CAAE,EAAE,4CAA4C;AACjG,WAAW,GAAE,OAAe,EAC5B,kBAAkB,GAAE,OAAe,GAClC;IAAE,SAAS,EAAE,SAAS,CAAA;CAAE,GAAG;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAqB9C;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CA0D5D;AAkDD,uFAAuF;AACvF,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,SAAS,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,YAAY,EAAE,CAAA;CAAE,CAUjG;AAGD,mIAAmI;AACnI,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,SAAS,EACf,WAAW,GAAE,MAAW,GACvB;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE;QAAE,CAAC,KAAK,EAAE,MAAM,GAAG,aAAa,CAAA;KAAE,CAAA;CAAE,CAkBnE;AAED,qHAAqH;AACrH,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO,CAyBnE;AAED,8FAA8F;AAC9F,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,GAAG,CAAC,KAAK,GAAG,IAAI,CAAC,EAAE,CAMrE;AAED,2GAA2G;AAC3G,wBAAgB,qBAAqB,CAAC,aAAa,EAAE,CAAC,KAAK,GAAG,IAAI,CAAC,EAAE,GAAG,MAAM,CAG7E;AAED,4GAA4G;AAC5G,wBAAgB,OAAO,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,MAAM,GAAG,KAAK,GAAG,SAAS,CAiBrE"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//
|
|
1
|
+
// cspell:words LPAREN LPARENs RPAREN RPARENs
|
|
2
2
|
import { createUID, hasProp } from '@pega/cosmos-react-core';
|
|
3
3
|
const AND = 'AND';
|
|
4
4
|
const OR = 'OR';
|
|
@@ -415,6 +415,7 @@ export function isBasicModeApplicable(condition) {
|
|
|
415
415
|
return condition.AND.every(node => hasProp(node, 'condition'));
|
|
416
416
|
}
|
|
417
417
|
// NOT operator is not supported in Basic-mode
|
|
418
|
+
// eslint-disable-next-line sonarjs/prefer-single-boolean-return
|
|
418
419
|
if (hasProp(condition, 'NOT')) {
|
|
419
420
|
return false;
|
|
420
421
|
}
|
|
@@ -429,16 +430,12 @@ export function getBasicModeOperators(logic) {
|
|
|
429
430
|
}
|
|
430
431
|
return matches;
|
|
431
432
|
}
|
|
432
|
-
/**
|
|
433
|
-
* Takes a list of operators from between the Basic mode rows and constructs a logic-string out of them
|
|
434
|
-
*/
|
|
433
|
+
/** Takes a list of operators from between the Basic mode rows and constructs a logic-string out of them */
|
|
435
434
|
export function getLogicFromBasicMode(operatorsList) {
|
|
436
435
|
const logicString = operatorsList.reduce((logic, op, i) => `${logic} ${op} ${i + 2}`, '1');
|
|
437
436
|
return disambiguateLogic(logicString); // Disambiguating the logic string by placing parentheses at appropriate places
|
|
438
437
|
}
|
|
439
|
-
/**
|
|
440
|
-
* Takes a list of objects and id of the object to be found and recursively finds and returns the object
|
|
441
|
-
*/
|
|
438
|
+
/** Takes a list of objects and id of the object to be found and recursively finds and returns the object */
|
|
442
439
|
export function getItem(items, id) {
|
|
443
440
|
let found;
|
|
444
441
|
items.some(item => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/components/ConditionBuilder/core/utils.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAE7C,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAI7D,MAAM,GAAG,GAAG,KAAK,CAAC;AAClB,MAAM,EAAE,GAAG,IAAI,CAAC;AAChB,MAAM,GAAG,GAAG,KAAK,CAAC;AAClB,MAAM,MAAM,GAAG,GAAG,CAAC;AACnB,MAAM,MAAM,GAAG,GAAG,CAAC;AAEnB,MAAM,aAAa,GAA6B,EAAE,EAAE,EAAE,CAAC,EAAE,GAAG,E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;YACb,OAAO,IAAI,CAAC;SACb;QAED,IAAI,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,EAAE;YAC1B,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;YAChC,OAAO,CAAC,CAAC,KAAK,CAAC;SAChB;QAED,OAAO,KAAK,CAAC;IACf,CAAC,CAAC,CAAC;IAEH,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["// cSpell:words LPAREN LPARENs RPAREN RPARENs\n\nimport { createUID, hasProp } from '@pega/cosmos-react-core';\n\nimport { Condition, ConditionRow, LeafCondition, Field } from '../ConditionBuilder.types';\n\nconst AND = 'AND';\nconst OR = 'OR';\nconst NOT = 'NOT';\nconst LPAREN = '(';\nconst RPAREN = ')';\n\nconst precedenceMap: { [op: string]: number } = { OR: 1, AND: 2, NOT: 3 }; // Operator precedence. NOT has the highest precedence over the others\nconst operatorTokens = new Set([AND, OR, NOT]); // Valid logical operators\nconst validTokens = new Set([AND, OR, NOT, LPAREN, RPAREN]); // Other than these, integer tokens are valid\n\nconst isIntegerToken = (token: string): boolean => /^\\d+$/.test(token); // Checks if the input token is an integer\nconst isOperatorToken = (token: string): boolean => operatorTokens.has(token); // Checks if the input token is an operator\n\n/**\n * Tokenize the input expression.\n * Valid tokens are 'AND', 'OR', 'NOT', '(', ')' and any integer token.\n * Throws an error if an invalid token is found.\n */\nfunction tokenizeExpression(\n expression: string,\n disallowNOT: boolean = false\n): { tokens: string[] } | { error: string } {\n expression = expression.trim().toUpperCase(); // To simplify comparisons below; the tokens AND/OR/NOT are anyways expected to be in uppercase\n const words = expression.match(/[A-Z]+|[0-9]+|_|\\W/g); // Split contiguous alphabets and contiguous numbers into the same token. For all other characters, create a token for each character. Although `_` is not expected to be used, handling it just for completeness\n const tokens: string[] = []; // Final list of valid tokens\n const invalidWords: string[] = []; // Any invalid words are captured here\n\n // `words` will never be null because of the regex we used. Using `!` to indicate the same to TS\n words!.forEach(word => {\n // Ignore white-space characters\n if (word.trim().length > 0) {\n // If it's a token from the above Set or if it's an integer token\n if (isIntegerToken(word) || (validTokens.has(word) && !(word === NOT && disallowNOT))) {\n tokens.push(word);\n } else {\n invalidWords.push(word);\n }\n }\n });\n\n // Return an error if any invalid tokens are present\n if (invalidWords.length > 0) {\n return { error: `Unexpected words/characters: ${invalidWords.join(' ')}` }; // FIXME: TR\n }\n\n return { tokens };\n}\n\n/**\n * Captures any invalid/unexpected token patterns\n * NOTE: This does not expect any invalid tokens to be passed in the input\n * NOTE: This doesn't handle mismatched parentheses. That is handled separately in getPostfixFromInfix\n * Returns an error message about the first invalid sequence present in the input. Returns `null` if none found\n */\nfunction findInvalidPatterns(tokens: string[]): string | null {\n // These patterns are identified based on which token can precede/succeed which.\n // A table with all such permutations can be found in DOC-38200\n\n for (let i = 0; i < tokens.length; i += 1) {\n const NUMBER = 'NUMBER'; // To avoid repeating a string literal\n const token = tokens[i];\n const tokenType = isIntegerToken(token) ? NUMBER : token; // To simplify comparisons below\n\n // The expression can only start with NOT, LPAREN or NUMBER\n if (i === 0 && ![NOT, LPAREN, NUMBER].includes(tokenType)) {\n return `Unexpected \"${token}\" at the beginning.`; // FIXME: TR\n }\n\n // The expression can only end with RPAREN or NUMBER\n if (i === tokens.length - 1 && ![RPAREN, NUMBER].includes(tokenType)) {\n return `Unexpected \"${token}\" at the end.`; // FIXME: TR\n }\n\n // If there is a previous token, check if it is supposed to precede the current token\n if (i > 0) {\n const prevToken = tokens[i - 1];\n const prevTokenType = isIntegerToken(prevToken) ? NUMBER : prevToken; // To simplify comparisons below\n switch (tokenType) {\n // AND/OR/RPAREN can only be preceded by RPAREN or NUMBER\n case AND:\n case OR:\n case RPAREN:\n if (![RPAREN, NUMBER].includes(prevTokenType)) {\n return `Unexpected \"${token}\" after \"${prevToken}\"`; // FIXME: TR\n }\n break;\n\n // NOT/LPAREN/NUMBER can not be preceded by RPAREN or NUMBER\n case NOT:\n case LPAREN:\n case NUMBER:\n if ([RPAREN, NUMBER].includes(prevTokenType)) {\n return `Unexpected \"${token}\" after \"${prevToken}\"`; // FIXME: TR\n }\n break;\n default: // do nothing\n }\n }\n }\n\n // Return null if no invalid sequences\n return null;\n}\n\n/**\n * Converts an input array of Infix tokens into a Postfix array.\n * Uses the ShuntingYard algorithm.\n * NOTE: This does not expect any invalid tokens to be passed in the input\n */\nfunction getPostfixFromInfix(tokens: string[]): { postfixArr: string[] } | { error: string } {\n // Refer these for the ShuntingYard algorithm:\n // * https://brilliant.org/wiki/shunting-yard-algorithm/\n // * https://en.wikipedia.org/wiki/Shunting-yard_algorithm#The_algorithm_in_detail\n const postfixQueue: string[] = []; // Output queue\n const stack: string[] = []; // Operations stack\n\n // While there are tokens to be read\n for (let i = 0; i < tokens.length; i += 1) {\n const token = tokens[i];\n\n if (isIntegerToken(token)) {\n // If it's a number add it to queue\n postfixQueue.push(token);\n } else if (isOperatorToken(token)) {\n // If it's an operator\n // While there's an operator on the top of the stack with greater precedence (or equal precedence and the token is left-associative), pop operators from the stack onto the output queue\n if (token !== NOT) {\n // Unary operators should not cause any operators to be popped from the stack.\n // See http://wcipeg.com/wiki/Shunting_yard_algorithm#Unary_operators\n while (stack.length > 0) {\n const stackTop = stack[stack.length - 1];\n if (isOperatorToken(stackTop) && precedenceMap[stackTop] >= precedenceMap[token]) {\n postfixQueue.push(stack.pop()!);\n } else {\n break;\n }\n }\n }\n // Push the current operator onto the stack\n stack.push(token);\n } else if (token === LPAREN) {\n // If it's a left parenthesis, push it onto the stack\n stack.push(token);\n } else {\n // If it's a right parenthesis (RPAREN)\n // While there's not a left parenthesis at the top of the stack, pop operators from the stack onto the output queue\n while (stack.length > 0) {\n const stackTop = stack[stack.length - 1];\n if (stackTop === LPAREN) break;\n postfixQueue.push(stack.pop()!);\n }\n\n // Pop the left parenthesis from the stack and discard it\n if (stack.length > 0) {\n stack.pop();\n } else {\n // FIXME: TR\n return { error: 'Please fix mismatched parentheses.' }; // If no LPAREN found for the current RPAREN\n }\n }\n }\n\n // While there are operators on the stack, pop them to the queue\n while (stack.length > 0) {\n if (stack[stack.length - 1] === LPAREN) {\n // FIXME: TR\n return { error: 'Please fix mismatched parentheses.' }; // If there were excess LPARENs. (Excess RPARENs are already handled in the above loop. Also, RPARENs are never pushed to the stack)\n }\n postfixQueue.push(stack.pop()!);\n }\n\n return { postfixArr: postfixQueue };\n}\n\n/**\n * Converts an input array of Postfix tokens into a Condition tree.\n * NOTE: This expects a properly formed Postfix array as input\n */\nfunction getConditionFromPostfix(\n postfixArr: string[],\n conditionLookup: { [label: string]: LeafCondition },\n ignoreUnusedLabels: boolean\n): { condition: Condition } | { error: string } {\n // To learn more about the below algorithm, refer this: https://brilliant.org/wiki/shunting-yard-algorithm/#reverse-polish\n const operandsStack: Condition[] = [];\n const labelsWithNoRows: string[] = []; // Labels for which there is no corresponding op in conditionLookup\n const usedLabels: string[] = []; // A list of all labels used in the condition. This is used to warn about any unused operations\n postfixArr.forEach(token => {\n if (isIntegerToken(token)) {\n // If it's a numeric token (leaf condition), push it to the stack\n const conditionRow = conditionLookup[token]; // Identify the corresponding condition row\n operandsStack.push({ condition: conditionRow }); // Push it even if null so that the conversion goes on smoothly and identifies any other issues\n if (!conditionRow) {\n labelsWithNoRows.push(token); // Mark it as missing\n } else {\n usedLabels.push(token); // Mark it as used\n }\n } else if (token === NOT) {\n // If it's the NOT operator\n // Pop an operand, perform the operation and push the result back to the stack\n const operand = operandsStack.pop()!;\n operandsStack.push({ NOT: operand });\n } else {\n // If it's the AND/OR operator\n // Pop two operands, perform the operation and push the result back to the stack\n const operand2 = operandsStack.pop()!;\n const operand1 = operandsStack.pop()!;\n\n // If the inner operation is the same as the current one, consolidate them\n // e.g. `1 AND (2 AND 3)` should be consolidated as `1 AND 2 AND 3`\n // e.g. `1 OR (2 OR 3)` should be consolidated as `1 OR 2 OR 3`\n if (token === 'AND') {\n const operands = [\n ...(hasProp(operand1, 'AND') ? operand1.AND : [operand1]),\n ...(hasProp(operand2, 'AND') ? operand2.AND : [operand2])\n ];\n operandsStack.push({ AND: operands });\n } else {\n const operands = [\n ...(hasProp(operand1, 'OR') ? operand1.OR : [operand1]),\n ...(hasProp(operand2, 'OR') ? operand2.OR : [operand2])\n ];\n operandsStack.push({ OR: operands });\n }\n }\n });\n\n // If any labels are used for which there are no corresponding condition-rows\n if (labelsWithNoRows.length > 0) {\n if (labelsWithNoRows.length === 1) {\n return {\n error: `Condition ${labelsWithNoRows[0]} used in the logical string is not defined.` // FIXME: TR\n };\n }\n return {\n error: `Conditions ${labelsWithNoRows.join(', ')} used in the logical string are not defined.` // FIXME: TR\n };\n }\n\n // Warn if any of the condition rows are unused\n if (!ignoreUnusedLabels) {\n const unusedLabels = Object.keys(conditionLookup).filter(l => !usedLabels.includes(l));\n if (unusedLabels.length > 0) {\n if (unusedLabels.length === 1) {\n return { error: `Condition ${unusedLabels[0]} is not used in the logic expression.` }; // FIXME: TR\n }\n return {\n error: `Conditions ${unusedLabels.join(', ')} are not used in the logic expression.` // FIXME: TR\n };\n }\n }\n\n return { condition: operandsStack[0] };\n}\n\n/** Parses a logic-expression into a condition object. */\nexport function parseLogicString(\n expression: string,\n conditionLookup: { [label: string]: LeafCondition }, // To look up condition-rows from the labels\n disallowNOT: boolean = false,\n ignoreUnusedLabels: boolean = false\n): { condition: Condition } | { error: string } {\n // Handle empty expressions\n if (!expression.trim().length) return { error: 'Please provide a logic expression.' }; // FIXME: TR\n\n // Split the expression into individual tokens\n const tokeningResult = tokenizeExpression(expression, disallowNOT);\n if (hasProp(tokeningResult, 'error')) return tokeningResult;\n const { tokens } = tokeningResult;\n\n // Capture any invalid/unexpected token patterns\n // NOTE: This doesn't handle mismatched parentheses. That is handled below in getPostfixFromInfix\n const badPatternError = findInvalidPatterns(tokens);\n if (badPatternError !== null) return { error: badPatternError };\n\n // Convert the Infix tokens to a Postfix notation using the ShuntingYard algorithm\n const postfixResult = getPostfixFromInfix(tokens);\n if (hasProp(postfixResult, 'error')) return postfixResult;\n const { postfixArr } = postfixResult;\n\n // Convert the Postfix token to a Condition tree\n return getConditionFromPostfix(postfixArr, conditionLookup, ignoreUnusedLabels);\n}\n\n/**\n * Takes a valid logic string and formats it with parentheses at appropriate places to keep things unambiguous\n * For example, `1 AND 2 OR 3` is disambiguated as `(1 AND 2) OR 3`\n * NOTE: This expects only valid logic strings to be passed as an input\n */\nexport function disambiguateLogic(expression: string): string {\n // Split the expression into individual tokens\n const tokeningResult = tokenizeExpression(expression);\n const { tokens } = tokeningResult as { tokens: string[] }; // Only valid expressions are expected as inputs\n\n // Convert the Infix tokens to a Postfix notation using the ShuntingYard algorithm\n const postfixResult = getPostfixFromInfix(tokens);\n const { postfixArr } = postfixResult as { postfixArr: string[] };\n\n // Convert the postfix back to infix with parentheses at appropriate places\n // To learn more about the below algorithm, refer this: https://brilliant.org/wiki/shunting-yard-algorithm/#reverse-polish\n const operandsStack: string[] = [];\n postfixArr.forEach(token => {\n if (isIntegerToken(token)) {\n // If it's a numeric token (leaf condition), push it to the stack\n operandsStack.push(token);\n } else if (token === NOT) {\n // If it's the NOT operator\n // Pop an operand, perform the operation and push the result back to the stack\n const operand = operandsStack.pop()!;\n operandsStack.push(`NOT ${operand}`);\n } else {\n // If it's the AND/OR operator\n // Pop two operands, perform the operation and push the result back to the stack\n let operand2 = operandsStack.pop()!;\n let operand1 = operandsStack.pop()!;\n\n // If the inner operation is the same as the current one, consolidate them\n // e.g. `1 AND (2 AND 3)` should be consolidated as `1 AND 2 AND 3`\n // e.g. `1 OR (2 OR 3)` should be consolidated as `1 OR 2 OR 3`\n if (token === 'AND') {\n // Remove any wrapping parentheses if an operand contains just AND(s)\n if (operand1.startsWith(LPAREN) && !operand1.includes(OR) && !operand1.includes(NOT)) {\n operand1 = operand1.slice(1, -1);\n }\n if (operand2.startsWith(LPAREN) && !operand2.includes(OR) && !operand2.includes(NOT)) {\n operand2 = operand2.slice(1, -1);\n }\n operandsStack.push(`(${operand1} AND ${operand2})`);\n } else {\n // Remove any wrapping parentheses if an operand contains just OR(s)\n if (operand1.startsWith(LPAREN) && !operand1.includes(AND) && !operand1.includes(NOT)) {\n operand1 = operand1.slice(1, -1);\n }\n if (operand2.startsWith(LPAREN) && !operand2.includes(AND) && !operand2.includes(NOT)) {\n operand2 = operand2.slice(1, -1);\n }\n operandsStack.push(`(${operand1} OR ${operand2})`);\n }\n }\n });\n\n // If the root node is AND/OR, there will be extra parentheses. Remove them\n let outputLogic = operandsStack[0];\n if (outputLogic.startsWith(LPAREN) && outputLogic.endsWith(RPAREN)) {\n outputLogic = outputLogic.slice(1, -1);\n }\n return outputLogic;\n}\n\n/**\n * Recursively splits the input condition node into a logic-string and a list of condition-rows\n * NOTE: Returns an empty string and an empty array if the condition is malformed\n */\nfunction splitConditionNode(\n node: Condition,\n labelsSoFar: string[]\n): { logic: string; rows: ConditionRow[] } {\n // Using a try-catch block for safety against any malformed conditions\n try {\n let logic: string;\n const rows: ConditionRow[] = [];\n\n if (hasProp(node, 'AND')) {\n const childStrings: string[] = [];\n node.AND.forEach(n => {\n const splitResult = splitConditionNode(n, labelsSoFar); // Recursively get child rows and logic\n childStrings.push(splitResult.logic);\n rows.push(...splitResult.rows);\n });\n logic = `(${childStrings.join(' AND ')})`;\n } else if (hasProp(node, 'OR')) {\n const childStrings: string[] = [];\n node.OR.forEach(n => {\n const splitResult = splitConditionNode(n, labelsSoFar); // Recursively get child rows and logic\n childStrings.push(splitResult.logic);\n rows.push(...splitResult.rows);\n });\n logic = `(${childStrings.join(' OR ')})`;\n } else if (hasProp(node, 'NOT')) {\n const splitResult = splitConditionNode(node.NOT, labelsSoFar); // Recursively get child rows and logic\n logic = `NOT ${splitResult.logic}`;\n rows.push(...splitResult.rows);\n } else {\n // If leaf-level is reached\n const newLabel = `${labelsSoFar.length + 1}`; // Get a new label for the node\n labelsSoFar.push(newLabel); // Update for the next time\n logic = newLabel;\n rows.push({ ...node.condition, label: newLabel, id: createUID() });\n }\n\n return { logic, rows };\n } catch {\n return { logic: '', rows: [] }; // For safety against any malformed conditions\n }\n}\n\n// Splitter for internal consumption\n/** Splits the input condition tree into a logic-string and a list of condition-rows */\nexport function splitConditionForBuilder(tree: Condition): { logic: string; rows: ConditionRow[] } {\n // Recursively split the tree, starting at the root node\n const splitResult = splitConditionNode(tree, []);\n\n // If the root node is AND/OR, there will be extra parentheses. Remove them\n if (splitResult.logic.startsWith(LPAREN) && splitResult.logic.endsWith(RPAREN)) {\n splitResult.logic = splitResult.logic.slice(1, -1);\n }\n\n return splitResult;\n}\n\n// Splitter for public consumption\n/** Converts the input nested condition into a flat tree with the leaf-conditions and a logic string representing the input tree */\nexport function splitConditionTree(\n tree: Condition,\n labelPrefix: string = ''\n): { logic: string; conditions: { [label: string]: LeafCondition } } {\n // Split using the internal splitter\n const { logic, rows } = splitConditionForBuilder(tree);\n\n // Build a condition-lookup from the ConditionRow objects\n const conditionLookup: { [label: string]: LeafCondition } = {};\n rows.forEach(row => {\n const { id, label, ...leaf } = row; // Discard the excess properties set up by ConditionRow when extending LeafCondition interface\n conditionLookup[`${labelPrefix}${label}`] = leaf;\n });\n\n // Prepend labelPrefix to all numeric tokens in the logic\n let outputLogic = logic;\n if (labelPrefix !== '') {\n outputLogic = logic.replace(/\\d+/g, `${labelPrefix}$&`);\n }\n\n return { logic: outputLogic, conditions: conditionLookup };\n}\n\n/** Checks if the input Condition is simple enough to be displayed in the `Basic mode` without loss of information */\nexport function isBasicModeApplicable(condition: Condition): boolean {\n // If an OR condition is present at the outer level,\n // each child should either be a leaf condition or an AND with all leaf nodes inside\n if (hasProp(condition, 'OR')) {\n return condition.OR.every(node => {\n if (hasProp(node, 'condition')) {\n return true;\n }\n if (hasProp(node, 'AND')) {\n return node.AND.every(subNode => hasProp(subNode, 'condition'));\n }\n return false;\n });\n }\n // If an AND condition is present at the outer level, it can't have any nested levels\n if (hasProp(condition, 'AND')) {\n return condition.AND.every(node => hasProp(node, 'condition'));\n }\n // NOT operator is not supported in Basic-mode\n if (hasProp(condition, 'NOT')) {\n return false;\n }\n // If a single leaf condition is present at the outer level\n return true;\n}\n\n/** Returns a list of operators to show in the Basic mode, using a logicString as the input */\nexport function getBasicModeOperators(logic: string): ('AND' | 'OR')[] {\n const matches = logic.match(/(AND|OR)/g);\n if (matches === null) {\n return [];\n }\n return matches as ('AND' | 'OR')[];\n}\n\n/**\n * Takes a list of operators from between the Basic mode rows and constructs a logic-string out of them\n */\nexport function getLogicFromBasicMode(operatorsList: ('AND' | 'OR')[]): string {\n const logicString = operatorsList.reduce((logic, op, i) => `${logic} ${op} ${i + 2}`, '1');\n return disambiguateLogic(logicString); // Disambiguating the logic string by placing parentheses at appropriate places\n}\n\n/**\n * Takes a list of objects and id of the object to be found and recursively finds and returns the object\n */\nexport function getItem(items: Field[], id: string): Field | undefined {\n let found: Field | undefined;\n items.some(item => {\n if (item.id === id) {\n found = item;\n return true;\n }\n\n if (hasProp(item, 'items')) {\n found = getItem(item.items, id);\n return !!found;\n }\n\n return false;\n });\n\n return found;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/components/ConditionBuilder/core/utils.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAI7D,MAAM,GAAG,GAAG,KAAK,CAAC;AAClB,MAAM,EAAE,GAAG,IAAI,CAAC;AAChB,MAAM,GAAG,GAAG,KAAK,CAAC;AAClB,MAAM,MAAM,GAAG,GAAG,CAAC;AACnB,MAAM,MAAM,GAAG,GAAG,CAAC;AAEnB,MAAM,aAAa,GAA6B,EAAE,EAAE,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC,sEAAsE;AACjJ,MAAM,cAAc,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,0BAA0B;AAC1E,MAAM,WAAW,GAAG,IAAI,G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,CAAC;SAChB;QAED,OAAO,KAAK,CAAC;IACf,CAAC,CAAC,CAAC;IAEH,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["// cspell:words LPAREN LPARENs RPAREN RPARENs\nimport { createUID, hasProp } from '@pega/cosmos-react-core';\n\nimport { Condition, ConditionRow, LeafCondition, Field } from '../ConditionBuilder.types';\n\nconst AND = 'AND';\nconst OR = 'OR';\nconst NOT = 'NOT';\nconst LPAREN = '(';\nconst RPAREN = ')';\n\nconst precedenceMap: { [op: string]: number } = { OR: 1, AND: 2, NOT: 3 }; // Operator precedence. NOT has the highest precedence over the others\nconst operatorTokens = new Set([AND, OR, NOT]); // Valid logical operators\nconst validTokens = new Set([AND, OR, NOT, LPAREN, RPAREN]); // Other than these, integer tokens are valid\n\nconst isIntegerToken = (token: string): boolean => /^\\d+$/.test(token); // Checks if the input token is an integer\nconst isOperatorToken = (token: string): boolean => operatorTokens.has(token); // Checks if the input token is an operator\n\n/**\n * Tokenize the input expression.\n * Valid tokens are 'AND', 'OR', 'NOT', '(', ')' and any integer token.\n * Throws an error if an invalid token is found.\n */\nfunction tokenizeExpression(\n expression: string,\n disallowNOT: boolean = false\n): { tokens: string[] } | { error: string } {\n expression = expression.trim().toUpperCase(); // To simplify comparisons below; the tokens AND/OR/NOT are anyways expected to be in uppercase\n const words = expression.match(/[A-Z]+|[0-9]+|_|\\W/g); // Split contiguous alphabets and contiguous numbers into the same token. For all other characters, create a token for each character. Although `_` is not expected to be used, handling it just for completeness\n const tokens: string[] = []; // Final list of valid tokens\n const invalidWords: string[] = []; // Any invalid words are captured here\n\n // `words` will never be null because of the regex we used. Using `!` to indicate the same to TS\n words!.forEach(word => {\n // Ignore white-space characters\n if (word.trim().length > 0) {\n // If it's a token from the above Set or if it's an integer token\n if (isIntegerToken(word) || (validTokens.has(word) && !(word === NOT && disallowNOT))) {\n tokens.push(word);\n } else {\n invalidWords.push(word);\n }\n }\n });\n\n // Return an error if any invalid tokens are present\n if (invalidWords.length > 0) {\n return { error: `Unexpected words/characters: ${invalidWords.join(' ')}` }; // FIXME: TR\n }\n\n return { tokens };\n}\n\n/**\n * Captures any invalid/unexpected token patterns\n * NOTE: This does not expect any invalid tokens to be passed in the input\n * NOTE: This doesn't handle mismatched parentheses. That is handled separately in getPostfixFromInfix\n * Returns an error message about the first invalid sequence present in the input. Returns `null` if none found\n */\nfunction findInvalidPatterns(tokens: string[]): string | null {\n // These patterns are identified based on which token can precede/succeed which.\n // A table with all such permutations can be found in DOC-38200\n\n for (let i = 0; i < tokens.length; i += 1) {\n const NUMBER = 'NUMBER'; // To avoid repeating a string literal\n const token = tokens[i];\n const tokenType = isIntegerToken(token) ? NUMBER : token; // To simplify comparisons below\n\n // The expression can only start with NOT, LPAREN or NUMBER\n if (i === 0 && ![NOT, LPAREN, NUMBER].includes(tokenType)) {\n return `Unexpected \"${token}\" at the beginning.`; // FIXME: TR\n }\n\n // The expression can only end with RPAREN or NUMBER\n if (i === tokens.length - 1 && ![RPAREN, NUMBER].includes(tokenType)) {\n return `Unexpected \"${token}\" at the end.`; // FIXME: TR\n }\n\n // If there is a previous token, check if it is supposed to precede the current token\n if (i > 0) {\n const prevToken = tokens[i - 1];\n const prevTokenType = isIntegerToken(prevToken) ? NUMBER : prevToken; // To simplify comparisons below\n switch (tokenType) {\n // AND/OR/RPAREN can only be preceded by RPAREN or NUMBER\n case AND:\n case OR:\n case RPAREN:\n if (![RPAREN, NUMBER].includes(prevTokenType)) {\n return `Unexpected \"${token}\" after \"${prevToken}\"`; // FIXME: TR\n }\n break;\n\n // NOT/LPAREN/NUMBER can not be preceded by RPAREN or NUMBER\n case NOT:\n case LPAREN:\n case NUMBER:\n if ([RPAREN, NUMBER].includes(prevTokenType)) {\n return `Unexpected \"${token}\" after \"${prevToken}\"`; // FIXME: TR\n }\n break;\n default: // do nothing\n }\n }\n }\n\n // Return null if no invalid sequences\n return null;\n}\n\n/**\n * Converts an input array of Infix tokens into a Postfix array.\n * Uses the ShuntingYard algorithm.\n * NOTE: This does not expect any invalid tokens to be passed in the input\n */\nfunction getPostfixFromInfix(tokens: string[]): { postfixArr: string[] } | { error: string } {\n // Refer these for the ShuntingYard algorithm:\n // * https://brilliant.org/wiki/shunting-yard-algorithm/\n // * https://en.wikipedia.org/wiki/Shunting-yard_algorithm#The_algorithm_in_detail\n const postfixQueue: string[] = []; // Output queue\n const stack: string[] = []; // Operations stack\n\n // While there are tokens to be read\n for (let i = 0; i < tokens.length; i += 1) {\n const token = tokens[i];\n\n if (isIntegerToken(token)) {\n // If it's a number add it to queue\n postfixQueue.push(token);\n } else if (isOperatorToken(token)) {\n // If it's an operator\n // While there's an operator on the top of the stack with greater precedence (or equal precedence and the token is left-associative), pop operators from the stack onto the output queue\n if (token !== NOT) {\n // Unary operators should not cause any operators to be popped from the stack.\n // See http://wcipeg.com/wiki/Shunting_yard_algorithm#Unary_operators\n while (stack.length > 0) {\n const stackTop = stack[stack.length - 1];\n if (isOperatorToken(stackTop) && precedenceMap[stackTop] >= precedenceMap[token]) {\n postfixQueue.push(stack.pop()!);\n } else {\n break;\n }\n }\n }\n // Push the current operator onto the stack\n stack.push(token);\n } else if (token === LPAREN) {\n // If it's a left parenthesis, push it onto the stack\n stack.push(token);\n } else {\n // If it's a right parenthesis (RPAREN)\n // While there's not a left parenthesis at the top of the stack, pop operators from the stack onto the output queue\n while (stack.length > 0) {\n const stackTop = stack[stack.length - 1];\n if (stackTop === LPAREN) break;\n postfixQueue.push(stack.pop()!);\n }\n\n // Pop the left parenthesis from the stack and discard it\n if (stack.length > 0) {\n stack.pop();\n } else {\n // FIXME: TR\n return { error: 'Please fix mismatched parentheses.' }; // If no LPAREN found for the current RPAREN\n }\n }\n }\n\n // While there are operators on the stack, pop them to the queue\n while (stack.length > 0) {\n if (stack[stack.length - 1] === LPAREN) {\n // FIXME: TR\n return { error: 'Please fix mismatched parentheses.' }; // If there were excess LPARENs. (Excess RPARENs are already handled in the above loop. Also, RPARENs are never pushed to the stack)\n }\n postfixQueue.push(stack.pop()!);\n }\n\n return { postfixArr: postfixQueue };\n}\n\n/**\n * Converts an input array of Postfix tokens into a Condition tree.\n * NOTE: This expects a properly formed Postfix array as input\n */\nfunction getConditionFromPostfix(\n postfixArr: string[],\n conditionLookup: { [label: string]: LeafCondition },\n ignoreUnusedLabels: boolean\n): { condition: Condition } | { error: string } {\n // To learn more about the below algorithm, refer this: https://brilliant.org/wiki/shunting-yard-algorithm/#reverse-polish\n const operandsStack: Condition[] = [];\n const labelsWithNoRows: string[] = []; // Labels for which there is no corresponding op in conditionLookup\n const usedLabels: string[] = []; // A list of all labels used in the condition. This is used to warn about any unused operations\n postfixArr.forEach(token => {\n if (isIntegerToken(token)) {\n // If it's a numeric token (leaf condition), push it to the stack\n const conditionRow = conditionLookup[token]; // Identify the corresponding condition row\n operandsStack.push({ condition: conditionRow }); // Push it even if null so that the conversion goes on smoothly and identifies any other issues\n if (!conditionRow) {\n labelsWithNoRows.push(token); // Mark it as missing\n } else {\n usedLabels.push(token); // Mark it as used\n }\n } else if (token === NOT) {\n // If it's the NOT operator\n // Pop an operand, perform the operation and push the result back to the stack\n const operand = operandsStack.pop()!;\n operandsStack.push({ NOT: operand });\n } else {\n // If it's the AND/OR operator\n // Pop two operands, perform the operation and push the result back to the stack\n const operand2 = operandsStack.pop()!;\n const operand1 = operandsStack.pop()!;\n\n // If the inner operation is the same as the current one, consolidate them\n // e.g. `1 AND (2 AND 3)` should be consolidated as `1 AND 2 AND 3`\n // e.g. `1 OR (2 OR 3)` should be consolidated as `1 OR 2 OR 3`\n if (token === 'AND') {\n const operands = [\n ...(hasProp(operand1, 'AND') ? operand1.AND : [operand1]),\n ...(hasProp(operand2, 'AND') ? operand2.AND : [operand2])\n ];\n operandsStack.push({ AND: operands });\n } else {\n const operands = [\n ...(hasProp(operand1, 'OR') ? operand1.OR : [operand1]),\n ...(hasProp(operand2, 'OR') ? operand2.OR : [operand2])\n ];\n operandsStack.push({ OR: operands });\n }\n }\n });\n\n // If any labels are used for which there are no corresponding condition-rows\n if (labelsWithNoRows.length > 0) {\n if (labelsWithNoRows.length === 1) {\n return {\n error: `Condition ${labelsWithNoRows[0]} used in the logical string is not defined.` // FIXME: TR\n };\n }\n return {\n error: `Conditions ${labelsWithNoRows.join(', ')} used in the logical string are not defined.` // FIXME: TR\n };\n }\n\n // Warn if any of the condition rows are unused\n if (!ignoreUnusedLabels) {\n const unusedLabels = Object.keys(conditionLookup).filter(l => !usedLabels.includes(l));\n if (unusedLabels.length > 0) {\n if (unusedLabels.length === 1) {\n return { error: `Condition ${unusedLabels[0]} is not used in the logic expression.` }; // FIXME: TR\n }\n return {\n error: `Conditions ${unusedLabels.join(', ')} are not used in the logic expression.` // FIXME: TR\n };\n }\n }\n\n return { condition: operandsStack[0] };\n}\n\n/** Parses a logic-expression into a condition object. */\nexport function parseLogicString(\n expression: string,\n conditionLookup: { [label: string]: LeafCondition }, // To look up condition-rows from the labels\n disallowNOT: boolean = false,\n ignoreUnusedLabels: boolean = false\n): { condition: Condition } | { error: string } {\n // Handle empty expressions\n if (!expression.trim().length) return { error: 'Please provide a logic expression.' }; // FIXME: TR\n\n // Split the expression into individual tokens\n const tokeningResult = tokenizeExpression(expression, disallowNOT);\n if (hasProp(tokeningResult, 'error')) return tokeningResult;\n const { tokens } = tokeningResult;\n\n // Capture any invalid/unexpected token patterns\n // NOTE: This doesn't handle mismatched parentheses. That is handled below in getPostfixFromInfix\n const badPatternError = findInvalidPatterns(tokens);\n if (badPatternError !== null) return { error: badPatternError };\n\n // Convert the Infix tokens to a Postfix notation using the ShuntingYard algorithm\n const postfixResult = getPostfixFromInfix(tokens);\n if (hasProp(postfixResult, 'error')) return postfixResult;\n const { postfixArr } = postfixResult;\n\n // Convert the Postfix token to a Condition tree\n return getConditionFromPostfix(postfixArr, conditionLookup, ignoreUnusedLabels);\n}\n\n/**\n * Takes a valid logic string and formats it with parentheses at appropriate places to keep things unambiguous\n * For example, `1 AND 2 OR 3` is disambiguated as `(1 AND 2) OR 3`\n * NOTE: This expects only valid logic strings to be passed as an input\n */\nexport function disambiguateLogic(expression: string): string {\n // Split the expression into individual tokens\n const tokeningResult = tokenizeExpression(expression);\n const { tokens } = tokeningResult as { tokens: string[] }; // Only valid expressions are expected as inputs\n\n // Convert the Infix tokens to a Postfix notation using the ShuntingYard algorithm\n const postfixResult = getPostfixFromInfix(tokens);\n const { postfixArr } = postfixResult as { postfixArr: string[] };\n\n // Convert the postfix back to infix with parentheses at appropriate places\n // To learn more about the below algorithm, refer this: https://brilliant.org/wiki/shunting-yard-algorithm/#reverse-polish\n const operandsStack: string[] = [];\n postfixArr.forEach(token => {\n if (isIntegerToken(token)) {\n // If it's a numeric token (leaf condition), push it to the stack\n operandsStack.push(token);\n } else if (token === NOT) {\n // If it's the NOT operator\n // Pop an operand, perform the operation and push the result back to the stack\n const operand = operandsStack.pop()!;\n operandsStack.push(`NOT ${operand}`);\n } else {\n // If it's the AND/OR operator\n // Pop two operands, perform the operation and push the result back to the stack\n let operand2 = operandsStack.pop()!;\n let operand1 = operandsStack.pop()!;\n\n // If the inner operation is the same as the current one, consolidate them\n // e.g. `1 AND (2 AND 3)` should be consolidated as `1 AND 2 AND 3`\n // e.g. `1 OR (2 OR 3)` should be consolidated as `1 OR 2 OR 3`\n if (token === 'AND') {\n // Remove any wrapping parentheses if an operand contains just AND(s)\n if (operand1.startsWith(LPAREN) && !operand1.includes(OR) && !operand1.includes(NOT)) {\n operand1 = operand1.slice(1, -1);\n }\n if (operand2.startsWith(LPAREN) && !operand2.includes(OR) && !operand2.includes(NOT)) {\n operand2 = operand2.slice(1, -1);\n }\n operandsStack.push(`(${operand1} AND ${operand2})`);\n } else {\n // Remove any wrapping parentheses if an operand contains just OR(s)\n if (operand1.startsWith(LPAREN) && !operand1.includes(AND) && !operand1.includes(NOT)) {\n operand1 = operand1.slice(1, -1);\n }\n if (operand2.startsWith(LPAREN) && !operand2.includes(AND) && !operand2.includes(NOT)) {\n operand2 = operand2.slice(1, -1);\n }\n operandsStack.push(`(${operand1} OR ${operand2})`);\n }\n }\n });\n\n // If the root node is AND/OR, there will be extra parentheses. Remove them\n let outputLogic = operandsStack[0];\n if (outputLogic.startsWith(LPAREN) && outputLogic.endsWith(RPAREN)) {\n outputLogic = outputLogic.slice(1, -1);\n }\n return outputLogic;\n}\n\n/**\n * Recursively splits the input condition node into a logic-string and a list of condition-rows\n * NOTE: Returns an empty string and an empty array if the condition is malformed\n */\nfunction splitConditionNode(\n node: Condition,\n labelsSoFar: string[]\n): { logic: string; rows: ConditionRow[] } {\n // Using a try-catch block for safety against any malformed conditions\n try {\n let logic: string;\n const rows: ConditionRow[] = [];\n\n if (hasProp(node, 'AND')) {\n const childStrings: string[] = [];\n node.AND.forEach(n => {\n const splitResult = splitConditionNode(n, labelsSoFar); // Recursively get child rows and logic\n childStrings.push(splitResult.logic);\n rows.push(...splitResult.rows);\n });\n logic = `(${childStrings.join(' AND ')})`;\n } else if (hasProp(node, 'OR')) {\n const childStrings: string[] = [];\n node.OR.forEach(n => {\n const splitResult = splitConditionNode(n, labelsSoFar); // Recursively get child rows and logic\n childStrings.push(splitResult.logic);\n rows.push(...splitResult.rows);\n });\n logic = `(${childStrings.join(' OR ')})`;\n } else if (hasProp(node, 'NOT')) {\n const splitResult = splitConditionNode(node.NOT, labelsSoFar); // Recursively get child rows and logic\n logic = `NOT ${splitResult.logic}`;\n rows.push(...splitResult.rows);\n } else {\n // If leaf-level is reached\n const newLabel = `${labelsSoFar.length + 1}`; // Get a new label for the node\n labelsSoFar.push(newLabel); // Update for the next time\n logic = newLabel;\n rows.push({ ...node.condition, label: newLabel, id: createUID() });\n }\n\n return { logic, rows };\n } catch {\n return { logic: '', rows: [] }; // For safety against any malformed conditions\n }\n}\n\n// Splitter for internal consumption\n/** Splits the input condition tree into a logic-string and a list of condition-rows */\nexport function splitConditionForBuilder(tree: Condition): { logic: string; rows: ConditionRow[] } {\n // Recursively split the tree, starting at the root node\n const splitResult = splitConditionNode(tree, []);\n\n // If the root node is AND/OR, there will be extra parentheses. Remove them\n if (splitResult.logic.startsWith(LPAREN) && splitResult.logic.endsWith(RPAREN)) {\n splitResult.logic = splitResult.logic.slice(1, -1);\n }\n\n return splitResult;\n}\n\n// Splitter for public consumption\n/** Converts the input nested condition into a flat tree with the leaf-conditions and a logic string representing the input tree */\nexport function splitConditionTree(\n tree: Condition,\n labelPrefix: string = ''\n): { logic: string; conditions: { [label: string]: LeafCondition } } {\n // Split using the internal splitter\n const { logic, rows } = splitConditionForBuilder(tree);\n\n // Build a condition-lookup from the ConditionRow objects\n const conditionLookup: { [label: string]: LeafCondition } = {};\n rows.forEach(row => {\n const { id, label, ...leaf } = row; // Discard the excess properties set up by ConditionRow when extending LeafCondition interface\n conditionLookup[`${labelPrefix}${label}`] = leaf;\n });\n\n // Prepend labelPrefix to all numeric tokens in the logic\n let outputLogic = logic;\n if (labelPrefix !== '') {\n outputLogic = logic.replace(/\\d+/g, `${labelPrefix}$&`);\n }\n\n return { logic: outputLogic, conditions: conditionLookup };\n}\n\n/** Checks if the input Condition is simple enough to be displayed in the `Basic mode` without loss of information */\nexport function isBasicModeApplicable(condition: Condition): boolean {\n // If an OR condition is present at the outer level,\n // each child should either be a leaf condition or an AND with all leaf nodes inside\n if (hasProp(condition, 'OR')) {\n return condition.OR.every(node => {\n if (hasProp(node, 'condition')) {\n return true;\n }\n if (hasProp(node, 'AND')) {\n return node.AND.every(subNode => hasProp(subNode, 'condition'));\n }\n return false;\n });\n }\n // If an AND condition is present at the outer level, it can't have any nested levels\n if (hasProp(condition, 'AND')) {\n return condition.AND.every(node => hasProp(node, 'condition'));\n }\n // NOT operator is not supported in Basic-mode\n // eslint-disable-next-line sonarjs/prefer-single-boolean-return\n if (hasProp(condition, 'NOT')) {\n return false;\n }\n // If a single leaf condition is present at the outer level\n return true;\n}\n\n/** Returns a list of operators to show in the Basic mode, using a logicString as the input */\nexport function getBasicModeOperators(logic: string): ('AND' | 'OR')[] {\n const matches = logic.match(/(AND|OR)/g);\n if (matches === null) {\n return [];\n }\n return matches as ('AND' | 'OR')[];\n}\n\n/** Takes a list of operators from between the Basic mode rows and constructs a logic-string out of them */\nexport function getLogicFromBasicMode(operatorsList: ('AND' | 'OR')[]): string {\n const logicString = operatorsList.reduce((logic, op, i) => `${logic} ${op} ${i + 2}`, '1');\n return disambiguateLogic(logicString); // Disambiguating the logic string by placing parentheses at appropriate places\n}\n\n/** Takes a list of objects and id of the object to be found and recursively finds and returns the object */\nexport function getItem(items: Field[], id: string): Field | undefined {\n let found: Field | undefined;\n items.some(item => {\n if (item.id === id) {\n found = item;\n return true;\n }\n\n if (hasProp(item, 'items')) {\n found = getItem(item.items, id);\n return !!found;\n }\n\n return false;\n });\n\n return found;\n}\n"]}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
export { default } from './ConditionBuilder';
|
|
2
|
-
export { default as ConditionBuilderProps, Condition, DateFunctionsByType, Field, LeafCondition, ValueSelection } from './ConditionBuilder.types';
|
|
2
|
+
export type { default as ConditionBuilderProps, Condition, DateFunctionsByType, Field, LeafCondition, ValueSelection } from './ConditionBuilder.types';
|
|
3
3
|
export { default as FieldCondition } from './FieldCondition';
|
|
4
|
-
export { default as FieldConditionProps } from './FieldCondition.types';
|
|
4
|
+
export type { default as FieldConditionProps } from './FieldCondition.types';
|
|
5
5
|
export { default as evaluateCondition } from './core/evaluator';
|
|
6
6
|
export { default as formatCondition, formatRelativeDate } from './core/formatter';
|
|
7
7
|
export { default as transformComplexCondition } from './core/transformer';
|
|
8
|
-
export { ComparatorsByType, RHSType } from './core/types';
|
|
8
|
+
export type { ComparatorsByType, RHSType } from './core/types';
|
|
9
9
|
export { splitConditionTree, parseLogicString } from './core/utils';
|
|
10
10
|
export { default as AtomicCondition, getInitConditionForLhs, isValidCondition } from './AtomicCondition';
|
|
11
11
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/ConditionBuilder/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/ConditionBuilder/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,YAAY,EACV,OAAO,IAAI,qBAAqB,EAChC,SAAS,EACT,mBAAmB,EACnB,KAAK,EACL,aAAa,EACb,cAAc,EACf,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC7D,YAAY,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7E,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAChE,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAClF,OAAO,EAAE,OAAO,IAAI,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAC1E,YAAY,EAAE,iBAAiB,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC/D,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACpE,OAAO,EACL,OAAO,IAAI,eAAe,EAC1B,sBAAsB,EACtB,gBAAgB,EACjB,MAAM,mBAAmB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/ConditionBuilder/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAS7C,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAE7D,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAChE,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAClF,OAAO,EAAE,OAAO,IAAI,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAE1E,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACpE,OAAO,EACL,OAAO,IAAI,eAAe,EAC1B,sBAAsB,EACtB,gBAAgB,EACjB,MAAM,mBAAmB,CAAC","sourcesContent":["export { default } from './ConditionBuilder';\nexport {\n default as ConditionBuilderProps,\n Condition,\n DateFunctionsByType,\n Field,\n LeafCondition,\n ValueSelection\n} from './ConditionBuilder.types';\nexport { default as FieldCondition } from './FieldCondition';\nexport { default as FieldConditionProps } from './FieldCondition.types';\nexport { default as evaluateCondition } from './core/evaluator';\nexport { default as formatCondition, formatRelativeDate } from './core/formatter';\nexport { default as transformComplexCondition } from './core/transformer';\nexport { ComparatorsByType, RHSType } from './core/types';\nexport { splitConditionTree, parseLogicString } from './core/utils';\nexport {\n default as AtomicCondition,\n getInitConditionForLhs,\n isValidCondition\n} from './AtomicCondition';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/ConditionBuilder/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAS7C,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAE7D,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAChE,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAClF,OAAO,EAAE,OAAO,IAAI,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAE1E,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACpE,OAAO,EACL,OAAO,IAAI,eAAe,EAC1B,sBAAsB,EACtB,gBAAgB,EACjB,MAAM,mBAAmB,CAAC","sourcesContent":["export { default } from './ConditionBuilder';\nexport type {\n default as ConditionBuilderProps,\n Condition,\n DateFunctionsByType,\n Field,\n LeafCondition,\n ValueSelection\n} from './ConditionBuilder.types';\nexport { default as FieldCondition } from './FieldCondition';\nexport type { default as FieldConditionProps } from './FieldCondition.types';\nexport { default as evaluateCondition } from './core/evaluator';\nexport { default as formatCondition, formatRelativeDate } from './core/formatter';\nexport { default as transformComplexCondition } from './core/transformer';\nexport type { ComparatorsByType, RHSType } from './core/types';\nexport { splitConditionTree, parseLogicString } from './core/utils';\nexport {\n default as AtomicCondition,\n getInitConditionForLhs,\n isValidCondition\n} from './AtomicCondition';\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConditionInput.d.ts","sourceRoot":"","sources":["../../../src/components/ConditionInput/ConditionInput.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,iBAAiB,
|
|
1
|
+
{"version":3,"file":"ConditionInput.d.ts","sourceRoot":"","sources":["../../../src/components/ConditionInput/ConditionInput.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,iBAAiB,EAOlB,MAAM,OAAO,CAAC;AAEf,OAAO,EAGL,YAAY,EAab,MAAM,yBAAyB,CAAC;AAsBjC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AA+ClE,QAAA,MAAM,cAAc,EAAE,iBAAiB,CAAC,mBAAmB,GAAG,YAAY,CA4ezE,CAAC;AAEF,eAAe,cAAc,CAAC"}
|