@defra/forms-model 3.0.261 → 3.0.262
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/module/components/helpers.js +13 -10
- package/dist/module/components/helpers.js.map +1 -1
- package/dist/module/components/index.js +1 -1
- package/dist/module/components/index.js.map +1 -1
- package/dist/module/components/types.js.map +1 -1
- package/dist/module/conditions/condition-field.js +2 -2
- package/dist/module/conditions/condition-field.js.map +1 -1
- package/dist/module/conditions/condition-operators.js +4 -5
- package/dist/module/conditions/condition-operators.js.map +1 -1
- package/dist/types/components/helpers.d.ts +6 -5
- package/dist/types/components/helpers.d.ts.map +1 -1
- package/dist/types/components/index.d.ts +1 -1
- package/dist/types/components/index.d.ts.map +1 -1
- package/dist/types/components/types.d.ts +11 -8
- package/dist/types/components/types.d.ts.map +1 -1
- package/dist/types/conditions/condition-operators.d.ts +11 -4
- package/dist/types/conditions/condition-operators.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/helpers.ts +23 -27
- package/src/components/index.ts +1 -1
- package/src/components/types.ts +21 -57
- package/src/conditions/condition-field.ts +2 -2
- package/src/conditions/condition-operators.ts +11 -13
| @@ -19,24 +19,27 @@ export function hasConditionSupport(component) { | |
| 19 19 | 
             
              return isConditionalType(component?.type);
         | 
| 20 20 | 
             
            }
         | 
| 21 21 | 
             
            export function isConditionalType(type) {
         | 
| 22 | 
            -
              const allowedTypes = [ComponentType.RadiosField, ComponentType.CheckboxesField, ComponentType.DatePartsField, ComponentType.EmailAddressField, ComponentType.MultilineTextField, ComponentType.NumberField, ComponentType.SelectField, ComponentType.TextField, ComponentType.YesNoField];
         | 
| 22 | 
            +
              const allowedTypes = [ComponentType.AutocompleteField, ComponentType.RadiosField, ComponentType.CheckboxesField, ComponentType.DatePartsField, ComponentType.EmailAddressField, ComponentType.MultilineTextField, ComponentType.TelephoneNumberField, ComponentType.NumberField, ComponentType.SelectField, ComponentType.TextField, ComponentType.YesNoField, ComponentType.Html, ComponentType.Details];
         | 
| 23 23 | 
             
              return !!type && allowedTypes.includes(type);
         | 
| 24 24 | 
             
            }
         | 
| 25 25 |  | 
| 26 26 | 
             
            /**
         | 
| 27 | 
            -
             * Filter known components with content  | 
| 27 | 
            +
             * Filter known components with content (textarea or list)
         | 
| 28 28 | 
             
             */
         | 
| 29 | 
            -
            export function  | 
| 30 | 
            -
               | 
| 31 | 
            -
              return !!component?.type && allowedTypes.includes(component.type);
         | 
| 29 | 
            +
            export function hasContent(component) {
         | 
| 30 | 
            +
              return isContentType(component?.type);
         | 
| 32 31 | 
             
            }
         | 
| 33 32 |  | 
| 34 33 | 
             
            /**
         | 
| 35 | 
            -
             * Filter known components with  | 
| 34 | 
            +
             * Filter known components with content textarea
         | 
| 36 35 | 
             
             */
         | 
| 37 | 
            -
            export function  | 
| 38 | 
            -
              const  | 
| 39 | 
            -
              return  | 
| 36 | 
            +
            export function hasContentField(component) {
         | 
| 37 | 
            +
              const deniedTypes = [ComponentType.List];
         | 
| 38 | 
            +
              return hasContent(component) && !deniedTypes.includes(component.type);
         | 
| 39 | 
            +
            }
         | 
| 40 | 
            +
            export function isContentType(type) {
         | 
| 41 | 
            +
              const allowedTypes = [ComponentType.Details, ComponentType.Html, ComponentType.InsetText, ComponentType.List];
         | 
| 42 | 
            +
              return !!type && allowedTypes.includes(type);
         | 
| 40 43 | 
             
            }
         | 
| 41 44 |  | 
| 42 45 | 
             
            /**
         | 
| @@ -54,7 +57,7 @@ export function isListType(type) { | |
| 54 57 | 
             
             * Filter known components with selection fields
         | 
| 55 58 | 
             
             */
         | 
| 56 59 | 
             
            export function hasSelectionFields(component) {
         | 
| 57 | 
            -
              const allowedTypes = [ComponentType.CheckboxesField, ComponentType.RadiosField, ComponentType.SelectField, ComponentType.YesNoField];
         | 
| 60 | 
            +
              const allowedTypes = [ComponentType.AutocompleteField, ComponentType.CheckboxesField, ComponentType.RadiosField, ComponentType.SelectField, ComponentType.YesNoField];
         | 
| 58 61 | 
             
              return !!component?.type && allowedTypes.includes(component.type);
         | 
| 59 62 | 
             
            }
         | 
| 60 63 |  | 
| @@ -1 +1 @@ | |
| 1 | 
            -
            {"version":3,"file":"helpers.js","names":["ComponentTypes","ComponentType","getComponentDefaults","component","type","find","hasConditionSupport","isConditionalType","allowedTypes","RadiosField","CheckboxesField","DatePartsField","EmailAddressField","MultilineTextField","NumberField","SelectField","TextField","YesNoField"," | 
| 1 | 
            +
            {"version":3,"file":"helpers.js","names":["ComponentTypes","ComponentType","getComponentDefaults","component","type","find","hasConditionSupport","isConditionalType","allowedTypes","AutocompleteField","RadiosField","CheckboxesField","DatePartsField","EmailAddressField","MultilineTextField","TelephoneNumberField","NumberField","SelectField","TextField","YesNoField","Html","Details","includes","hasContent","isContentType","hasContentField","deniedTypes","List","InsetText","hasListField","isListType","hasSelectionFields","hasTitle"],"sources":["../../../src/components/helpers.ts"],"sourcesContent":["import { ComponentTypes } from '~/src/components/component-types.js'\nimport { ComponentType } from '~/src/components/enums.js'\nimport {\n  type ComponentDef,\n  type ConditionalComponentsDef,\n  type ConditionalComponentType,\n  type ContentComponentsDef,\n  type HtmlComponent,\n  type InsetTextComponent,\n  type ListComponent,\n  type ListComponentsDef,\n  type SelectionComponentsDef\n} from '~/src/components/types.js'\n\n/**\n * Return component defaults by type\n */\nexport function getComponentDefaults(component?: Partial<ComponentDef>) {\n  if (!component?.type) {\n    return\n  }\n\n  return ComponentTypes.find(({ type }) => type === component.type)\n}\n\n/**\n * Filter known components with support for conditions\n */\nexport function hasConditionSupport(\n  component?: Partial<ComponentDef>\n): component is ConditionalComponentsDef {\n  return isConditionalType(component?.type)\n}\n\nexport function isConditionalType(\n  type?: ComponentType\n): type is ConditionalComponentType {\n  const allowedTypes = [\n    ComponentType.AutocompleteField,\n    ComponentType.RadiosField,\n    ComponentType.CheckboxesField,\n    ComponentType.DatePartsField,\n    ComponentType.EmailAddressField,\n    ComponentType.MultilineTextField,\n    ComponentType.TelephoneNumberField,\n    ComponentType.NumberField,\n    ComponentType.SelectField,\n    ComponentType.TextField,\n    ComponentType.YesNoField,\n    ComponentType.Html,\n    ComponentType.Details\n  ]\n\n  return !!type && allowedTypes.includes(type)\n}\n\n/**\n * Filter known components with content (textarea or list)\n */\nexport function hasContent(\n  component?: Partial<ComponentDef>\n): component is ContentComponentsDef {\n  return isContentType(component?.type)\n}\n\n/**\n * Filter known components with content textarea\n */\nexport function hasContentField(\n  component?: Partial<ComponentDef>\n): component is Exclude<ContentComponentsDef, ListComponent> {\n  const deniedTypes = [ComponentType.List]\n  return hasContent(component) && !deniedTypes.includes(component.type)\n}\n\nexport function isContentType(\n  type?: ComponentType\n): type is ContentComponentsDef['type'] {\n  const allowedTypes = [\n    ComponentType.Details,\n    ComponentType.Html,\n    ComponentType.InsetText,\n    ComponentType.List\n  ]\n\n  return !!type && allowedTypes.includes(type)\n}\n\n/**\n * Filter known components with lists\n */\nexport function hasListField(\n  component?: Partial<ComponentDef>\n): component is ListComponentsDef {\n  return isListType(component?.type)\n}\n\nexport function isListType(\n  type?: ComponentType\n): type is ListComponentsDef['type'] {\n  const allowedTypes = [\n    ComponentType.AutocompleteField,\n    ComponentType.List,\n    ComponentType.RadiosField,\n    ComponentType.SelectField,\n    ComponentType.CheckboxesField\n  ]\n\n  return !!type && allowedTypes.includes(type)\n}\n\n/**\n * Filter known components with selection fields\n */\nexport function hasSelectionFields(\n  component?: Partial<ComponentDef>\n): component is SelectionComponentsDef {\n  const allowedTypes = [\n    ComponentType.AutocompleteField,\n    ComponentType.CheckboxesField,\n    ComponentType.RadiosField,\n    ComponentType.SelectField,\n    ComponentType.YesNoField\n  ]\n\n  return !!component?.type && allowedTypes.includes(component.type)\n}\n\n/**\n * Filter known components with titles\n */\nexport function hasTitle(\n  component?: Partial<ComponentDef>\n): component is Exclude<ComponentDef, InsetTextComponent | HtmlComponent> {\n  const deniedTypes = [ComponentType.InsetText, ComponentType.Html]\n  return !!component?.type && !deniedTypes.includes(component.type)\n}\n"],"mappings":"AAAA,SA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CAACjB,SAAS,EAAEC,IAAI,IAAI,CAACsB,WAAW,CAACJ,QAAQ,CAACnB,SAAS,CAACC,IAAI,CAAC;AACnE","ignoreList":[]}
         | 
| @@ -1,4 +1,4 @@ | |
| 1 1 | 
             
            export { ComponentTypes } from "./component-types.js";
         | 
| 2 | 
            -
            export { getComponentDefaults, hasConditionSupport,  | 
| 2 | 
            +
            export { getComponentDefaults, hasConditionSupport, hasContent, hasContentField, hasListField, hasSelectionFields, hasTitle, isConditionalType, isListType } from "./helpers.js";
         | 
| 3 3 | 
             
            export { ComponentType } from "./enums.js";
         | 
| 4 4 | 
             
            //# sourceMappingURL=index.js.map
         | 
| @@ -1 +1 @@ | |
| 1 | 
            -
            {"version":3,"file":"index.js","names":["ComponentTypes","getComponentDefaults","hasConditionSupport"," | 
| 1 | 
            +
            {"version":3,"file":"index.js","names":["ComponentTypes","getComponentDefaults","hasConditionSupport","hasContent","hasContentField","hasListField","hasSelectionFields","hasTitle","isConditionalType","isListType","ComponentType"],"sources":["../../../src/components/index.ts"],"sourcesContent":["export { ComponentTypes } from '~/src/components/component-types.js'\nexport {\n  getComponentDefaults,\n  hasConditionSupport,\n  hasContent,\n  hasContentField,\n  hasListField,\n  hasSelectionFields,\n  hasTitle,\n  isConditionalType,\n  isListType\n} from '~/src/components/helpers.js'\n\nexport { ComponentType } from '~/src/components/enums.js'\n"],"mappings":"AAAA,SAASA,cAAc;AACvB,SACEC,oBAAoB,EACpBC,mBAAmB,EACnBC,UAAU,EACVC,eAAe,EACfC,YAAY,EACZC,kBAAkB,EAClBC,QAAQ,EACRC,iBAAiB,EACjBC,UAAU;AAGZ,SAASC,aAAa","ignoreList":[]}
         | 
| @@ -1 +1 @@ | |
| 1 | 
            -
            {"version":3,"file":"types.js","names":[],"sources":["../../../src/components/types.ts"],"sourcesContent":["import { type ComponentType } from '~/src/components/enums.js'\n\nexport type ConditionalComponentType  | 
| 1 | 
            +
            {"version":3,"file":"types.js","names":[],"sources":["../../../src/components/types.ts"],"sourcesContent":["import { type ComponentType } from '~/src/components/enums.js'\n\nexport type ConditionalComponentType = Exclude<\n  ConditionalComponentsDef['type'],\n  ContentComponentsDef\n>\n\n/**\n * Types for Components JSON structure which are expected by engine and turned into actual form input/content/lists\n */\ninterface TextFieldBase {\n  type:\n    | ComponentType.EmailAddressField\n    | ComponentType.MultilineTextField\n    | ComponentType.NumberField\n    | ComponentType.TelephoneNumberField\n    | ComponentType.TextField\n    | ComponentType.UkAddressField\n    | ComponentType.YesNoField\n  name: string\n  title: string\n  hint?: string\n  options: {\n    required?: boolean\n    optionalText?: boolean\n    classes?: string\n    allow?: string\n    autocomplete?: string\n  }\n  schema: {\n    max?: number\n    min?: number\n    length?: number\n    regex?: string\n    error?: unknown\n  }\n}\n\ninterface NumberFieldBase {\n  type: ComponentType\n  name: string\n  title: string\n  hint?: string\n  options: {\n    required?: boolean\n    optionalText?: boolean\n    classes?: string\n    prefix?: string\n    suffix?: string\n  }\n  schema: {\n    min?: number\n    max?: number\n    precision?: number\n  }\n}\n\ninterface ListFieldBase {\n  type:\n    | ComponentType.AutocompleteField\n    | ComponentType.CheckboxesField\n    | ComponentType.List\n    | ComponentType.RadiosField\n    | ComponentType.SelectField\n  name: string\n  title: string\n  hint?: string\n  options: {\n    type?: string\n    required?: boolean\n    optionalText?: boolean\n    classes?: string\n    bold?: boolean\n  }\n  list: string\n  schema: object\n}\n\ninterface ContentFieldBase {\n  type: ComponentType.Details | ComponentType.Html | ComponentType.InsetText\n  name: string\n  title: string\n  content: string\n  options: {\n    condition?: string\n  }\n  schema: object\n}\n\ninterface DateFieldBase {\n  type: ComponentType.DatePartsField | ComponentType.MonthYearField\n  name: string\n  title: string\n  hint?: string\n  options: {\n    required?: boolean\n    optionalText?: boolean\n    maxDaysInPast?: number\n    maxDaysInFuture?: number\n  }\n  schema: object\n}\n\n// Text Fields\nexport interface TextFieldComponent extends TextFieldBase {\n  type: ComponentType.TextField\n  options: TextFieldBase['options'] & {\n    condition?: string\n    customValidationMessage?: string\n  }\n}\n\nexport interface EmailAddressFieldComponent extends TextFieldBase {\n  type: ComponentType.EmailAddressField\n  options: TextFieldBase['options'] & {\n    condition?: string\n    customValidationMessage?: string\n  }\n}\n\nexport interface NumberFieldComponent extends NumberFieldBase {\n  type: ComponentType.NumberField\n  options: NumberFieldBase['options'] & {\n    condition?: string\n    customValidationMessage?: string\n  }\n}\n\nexport interface TelephoneNumberFieldComponent extends TextFieldBase {\n  type: ComponentType.TelephoneNumberField\n  options: TextFieldBase['options'] & {\n    condition?: string\n    customValidationMessage?: string\n  }\n}\n\nexport interface YesNoFieldComponent extends TextFieldBase {\n  type: ComponentType.YesNoField\n  options: TextFieldBase['options'] & {\n    condition?: string\n  }\n}\n\nexport interface MultilineTextFieldComponent extends TextFieldBase {\n  type: ComponentType.MultilineTextField\n  options: TextFieldBase['options'] & {\n    condition?: string\n    customValidationMessage?: string\n    rows?: number\n    maxWords?: number\n  }\n  schema: {\n    max?: number\n    min?: number\n    length?: number\n    regex?: string\n  }\n}\n\nexport interface UkAddressFieldComponent extends TextFieldBase {\n  type: ComponentType.UkAddressField\n  options: TextFieldBase['options'] & {\n    hideTitle?: boolean\n  }\n}\n\n// Date Fields\nexport interface DatePartsFieldFieldComponent extends DateFieldBase {\n  type: ComponentType.DatePartsField\n  options: DateFieldBase['options'] & {\n    condition?: string\n  }\n}\n\nexport interface MonthYearFieldComponent extends DateFieldBase {\n  type: ComponentType.MonthYearField\n  options: DateFieldBase['options'] & {\n    customValidationMessage?: string\n  }\n}\n\n// Content Fields\nexport interface DetailsComponent extends ContentFieldBase {\n  type: ComponentType.Details\n}\n\nexport interface HtmlComponent extends ContentFieldBase {\n  type: ComponentType.Html\n}\n\nexport interface InsetTextComponent extends ContentFieldBase {\n  type: ComponentType.InsetText\n}\n\n// List Fields\nexport interface ListComponent extends ListFieldBase {\n  type: ComponentType.List\n}\n\nexport interface AutocompleteFieldComponent extends ListFieldBase {\n  type: ComponentType.AutocompleteField\n  options: ListFieldBase['options'] & {\n    condition?: string\n  }\n}\n\nexport interface CheckboxesFieldComponent extends ListFieldBase {\n  type: ComponentType.CheckboxesField\n  options: ListFieldBase['options'] & {\n    condition?: string\n  }\n}\n\nexport interface RadiosFieldComponent extends ListFieldBase {\n  type: ComponentType.RadiosField\n  options: ListFieldBase['options'] & {\n    condition?: string\n  }\n}\n\nexport interface SelectFieldComponent extends ListFieldBase {\n  type: ComponentType.SelectField\n  options: ListFieldBase['options'] & {\n    autocomplete?: string\n    condition?: string\n  }\n}\n\nexport type ComponentDef =\n  | InputFieldsComponentsDef\n  | SelectionComponentsDef\n  | ContentComponentsDef\n\n// Components that render inputs\nexport type InputFieldsComponentsDef =\n  | TextFieldComponent\n  | EmailAddressFieldComponent\n  | NumberFieldComponent\n  | MultilineTextFieldComponent\n  | TelephoneNumberFieldComponent\n  | MonthYearFieldComponent\n  | DatePartsFieldFieldComponent\n  | UkAddressFieldComponent\n\n// Components that render content\nexport type ContentComponentsDef =\n  | DetailsComponent\n  | HtmlComponent\n  | InsetTextComponent\n  | ListComponent\n\n// Components that render lists\nexport type ListComponentsDef =\n  | Exclude<SelectionComponentsDef, YesNoFieldComponent>\n  | ListComponent\n\n// Components that have selection fields\nexport type SelectionComponentsDef =\n  | AutocompleteFieldComponent\n  | CheckboxesFieldComponent\n  | RadiosFieldComponent\n  | SelectFieldComponent\n  | YesNoFieldComponent\n\n// Components that have condition support\nexport type ConditionalComponentsDef = Exclude<\n  ComponentDef,\n  | InsetTextComponent\n  | ListComponent\n  | MonthYearFieldComponent\n  | UkAddressFieldComponent\n>\n"],"mappings":"","ignoreList":[]}
         | 
| @@ -1,4 +1,4 @@ | |
| 1 | 
            -
            import { isConditionalType } from "../components/helpers.js";
         | 
| 1 | 
            +
            import { isConditionalType, isContentType } from "../components/helpers.js";
         | 
| 2 2 | 
             
            export class ConditionField {
         | 
| 3 3 | 
             
              name;
         | 
| 4 4 | 
             
              type;
         | 
| @@ -7,7 +7,7 @@ export class ConditionField { | |
| 7 7 | 
             
                if (!name || typeof name !== 'string') {
         | 
| 8 8 | 
             
                  throw new Error("ConditionField param 'name' must be a string");
         | 
| 9 9 | 
             
                }
         | 
| 10 | 
            -
                if (!isConditionalType(type)) {
         | 
| 10 | 
            +
                if (!isConditionalType(type) || isContentType(type)) {
         | 
| 11 11 | 
             
                  throw new Error("ConditionField param 'type' must support conditions");
         | 
| 12 12 | 
             
                }
         | 
| 13 13 | 
             
                if (!display || typeof display !== 'string') {
         | 
| @@ -1 +1 @@ | |
| 1 | 
            -
            {"version":3,"file":"condition-field.js","names":["isConditionalType","ConditionField","name","type","display","constructor","Error","clone","from","toJSON","structuredClone","obj"],"sources":["../../../src/conditions/condition-field.ts"],"sourcesContent":["import { type ComponentType } from '~/src/components/enums.js'\nimport { isConditionalType } from '~/src/components/helpers.js'\nimport { type ConditionalComponentType } from '~/src/components/types.js'\nimport { type ConditionFieldData } from '~/src/conditions/types.js'\n\nexport class ConditionField {\n  name: string\n  type: ConditionalComponentType\n  display: string\n\n  constructor(name?: string, type?: ComponentType, display?: string) {\n    if (!name || typeof name !== 'string') {\n      throw new Error(\"ConditionField param 'name' must be a string\")\n    }\n\n    if (!isConditionalType(type)) {\n      throw new Error(\"ConditionField param 'type' must support conditions\")\n    }\n\n    if (!display || typeof display !== 'string') {\n      throw new Error(\"ConditionField param 'display' must be a string\")\n    }\n\n    this.name = name\n    this.type = type\n    this.display = display\n  }\n\n  clone(): ConditionField {\n    return ConditionField.from(this)\n  }\n\n  toJSON(): ConditionFieldData {\n    return structuredClone(this.clone())\n  }\n\n  static from(obj: ConditionField | ConditionFieldData) {\n    return new ConditionField(obj.name, obj.type, obj.display)\n  }\n}\n"],"mappings":"AACA,SAASA,iBAAiB; | 
| 1 | 
            +
            {"version":3,"file":"condition-field.js","names":["isConditionalType","isContentType","ConditionField","name","type","display","constructor","Error","clone","from","toJSON","structuredClone","obj"],"sources":["../../../src/conditions/condition-field.ts"],"sourcesContent":["import { type ComponentType } from '~/src/components/enums.js'\nimport { isConditionalType, isContentType } from '~/src/components/helpers.js'\nimport { type ConditionalComponentType } from '~/src/components/types.js'\nimport { type ConditionFieldData } from '~/src/conditions/types.js'\n\nexport class ConditionField {\n  name: string\n  type: ConditionalComponentType\n  display: string\n\n  constructor(name?: string, type?: ComponentType, display?: string) {\n    if (!name || typeof name !== 'string') {\n      throw new Error(\"ConditionField param 'name' must be a string\")\n    }\n\n    if (!isConditionalType(type) || isContentType(type)) {\n      throw new Error(\"ConditionField param 'type' must support conditions\")\n    }\n\n    if (!display || typeof display !== 'string') {\n      throw new Error(\"ConditionField param 'display' must be a string\")\n    }\n\n    this.name = name\n    this.type = type\n    this.display = display\n  }\n\n  clone(): ConditionField {\n    return ConditionField.from(this)\n  }\n\n  toJSON(): ConditionFieldData {\n    return structuredClone(this.clone())\n  }\n\n  static from(obj: ConditionField | ConditionFieldData) {\n    return new ConditionField(obj.name, obj.type, obj.display)\n  }\n}\n"],"mappings":"AACA,SAASA,iBAAiB,EAAEC,aAAa;AAIzC,OAAO,MAAMC,cAAc,CAAC;EAC1BC,IAAI;EACJC,IAAI;EACJC,OAAO;EAEPC,WAAWA,CAACH,IAAa,EAAEC,IAAoB,EAAEC,OAAgB,EAAE;IACjE,IAAI,CAACF,IAAI,IAAI,OAAOA,IAAI,KAAK,QAAQ,EAAE;MACrC,MAAM,IAAII,KAAK,CAAC,8CAA8C,CAAC;IACjE;IAEA,IAAI,CAACP,iBAAiB,CAACI,IAAI,CAAC,IAAIH,aAAa,CAACG,IAAI,CAAC,EAAE;MACnD,MAAM,IAAIG,KAAK,CAAC,qDAAqD,CAAC;IACxE;IAEA,IAAI,CAACF,OAAO,IAAI,OAAOA,OAAO,KAAK,QAAQ,EAAE;MAC3C,MAAM,IAAIE,KAAK,CAAC,iDAAiD,CAAC;IACpE;IAEA,IAAI,CAACJ,IAAI,GAAGA,IAAI;IAChB,IAAI,CAACC,IAAI,GAAGA,IAAI;IAChB,IAAI,CAACC,OAAO,GAAGA,OAAO;EACxB;EAEAG,KAAKA,CAAA,EAAmB;IACtB,OAAON,cAAc,CAACO,IAAI,CAAC,IAAI,CAAC;EAClC;EAEAC,MAAMA,CAAA,EAAuB;IAC3B,OAAOC,eAAe,CAAC,IAAI,CAACH,KAAK,CAAC,CAAC,CAAC;EACtC;EAEA,OAAOC,IAAIA,CAACG,GAAwC,EAAE;IACpD,OAAO,IAAIV,cAAc,CAACU,GAAG,CAACT,IAAI,EAAES,GAAG,CAACR,IAAI,EAAEQ,GAAG,CAACP,OAAO,CAAC;EAC5D;AACF","ignoreList":[]}
         | 
| @@ -1,5 +1,5 @@ | |
| 1 1 | 
             
            import { ComponentType } from "../components/enums.js";
         | 
| 2 | 
            -
            import { isConditionalType } from "../components/helpers.js";
         | 
| 2 | 
            +
            import { isConditionalType, isContentType } from "../components/helpers.js";
         | 
| 3 3 | 
             
            import { ConditionValue, RelativeDateValue } from "./condition-values.js";
         | 
| 4 4 | 
             
            import { ConditionType, DateDirections, Operator, OperatorName } from "./enums.js";
         | 
| 5 5 | 
             
            const defaultOperators = {
         | 
| @@ -30,6 +30,7 @@ const relativeDateOperators = { | |
| 30 30 | 
             
              [OperatorName.IsMoreThan]: relativeDate(Operator.IsLessThan, Operator.IsMoreThan)
         | 
| 31 31 | 
             
            };
         | 
| 32 32 | 
             
            export const customOperators = {
         | 
| 33 | 
            +
              [ComponentType.AutocompleteField]: defaultOperators,
         | 
| 33 34 | 
             
              [ComponentType.RadiosField]: defaultOperators,
         | 
| 34 35 | 
             
              [ComponentType.CheckboxesField]: {
         | 
| 35 36 | 
             
                [OperatorName.Contains]: reverseInline(Operator.Contains),
         | 
| @@ -48,6 +49,7 @@ export const customOperators = { | |
| 48 49 | 
             
              [ComponentType.TextField]: withDefaults(textFieldOperators),
         | 
| 49 50 | 
             
              [ComponentType.MultilineTextField]: withDefaults(textFieldOperators),
         | 
| 50 51 | 
             
              [ComponentType.EmailAddressField]: withDefaults(textFieldOperators),
         | 
| 52 | 
            +
              [ComponentType.TelephoneNumberField]: defaultOperators,
         | 
| 51 53 | 
             
              [ComponentType.SelectField]: defaultOperators,
         | 
| 52 54 | 
             
              [ComponentType.YesNoField]: defaultOperators
         | 
| 53 55 | 
             
            };
         | 
| @@ -68,11 +70,8 @@ export function getExpression(fieldType, fieldName, operator, value) { | |
| 68 70 | 
             
                name: fieldName
         | 
| 69 71 | 
             
              }, value);
         | 
| 70 72 | 
             
            }
         | 
| 71 | 
            -
            export function getOperatorConfig(fieldType, operator) {
         | 
| 72 | 
            -
              return getConditionals(fieldType)?.[operator];
         | 
| 73 | 
            -
            }
         | 
| 74 73 | 
             
            function getConditionals(fieldType) {
         | 
| 75 | 
            -
              if (!fieldType || !isConditionalType(fieldType)) {
         | 
| 74 | 
            +
              if (!fieldType || !isConditionalType(fieldType) || isContentType(fieldType)) {
         | 
| 76 75 | 
             
                return;
         | 
| 77 76 | 
             
              }
         | 
| 78 77 | 
             
              return fieldType in customOperators ? customOperators[fieldType] : defaultOperators;
         | 
| @@ -1 +1 @@ | |
| 1 | 
            -
            {"version":3,"file":"condition-operators.js","names":["ComponentType","isConditionalType","ConditionValue","RelativeDateValue","ConditionType","DateDirections","Operator","OperatorName","defaultOperators","Is","inline","IsNot","withDefaults","operators","textFieldOperators","IsLongerThan","lengthIs","IsMoreThan","IsShorterThan","IsLessThan","HasLength","absoluteDateOperators","absoluteDate","IsBefore","IsAfter","relativeDateOperators","IsAtLeast","relativeDate","IsAtMost","customOperators","RadiosField","CheckboxesField","Contains","reverseInline","DoesNotContain","not","NumberField","DatePartsField","TextField","MultilineTextField","EmailAddressField","SelectField","YesNoField","getOperatorNames","fieldType","conditionals","getConditionals","Object","keys","getExpression","fieldName","operator","value","expression","type","name","getOperatorConfig","field","formatValue","operatorDefinition","RelativeDate","toExpression","absoluteDateOperatorNames","relativeDateOperatorNames","Error","pastOperator","futureOperator","isPast","direction","PAST"],"sources":["../../../src/conditions/condition-operators.ts"],"sourcesContent":["import { ComponentType } from '~/src/components/enums.js'\nimport { isConditionalType } from '~/src/components/helpers.js'\nimport { type ComponentDef } from '~/src/components/types.js'\nimport {\n  ConditionValue,\n  RelativeDateValue\n} from '~/src/conditions/condition-values.js'\nimport { type Condition } from '~/src/conditions/condition.js'\nimport {\n  ConditionType,\n  DateDirections,\n  Operator,\n  OperatorName\n} from '~/src/conditions/enums.js'\nimport {\n  type Conditionals,\n  type OperatorDefinition\n} from '~/src/conditions/types.js'\n\nconst defaultOperators = {\n  [OperatorName.Is]: inline(Operator.Is),\n  [OperatorName.IsNot]: inline(Operator.IsNot)\n}\n\nfunction withDefaults<T>(operators: T) {\n  return { ...defaultOperators, ...operators }\n}\n\nconst textFieldOperators = {\n  [OperatorName.IsLongerThan]: lengthIs(Operator.IsMoreThan),\n  [OperatorName.IsShorterThan]: lengthIs(Operator.IsLessThan),\n  [OperatorName.HasLength]: lengthIs(Operator.Is)\n}\n\nconst absoluteDateOperators = {\n  [OperatorName.Is]: absoluteDate(Operator.Is),\n  [OperatorName.IsNot]: absoluteDate(Operator.IsNot),\n  [OperatorName.IsBefore]: absoluteDate(Operator.IsLessThan),\n  [OperatorName.IsAfter]: absoluteDate(Operator.IsMoreThan)\n}\n\nconst relativeDateOperators = {\n  [OperatorName.IsAtLeast]: relativeDate(Operator.IsAtMost, Operator.IsAtLeast),\n  [OperatorName.IsAtMost]: relativeDate(Operator.IsAtLeast, Operator.IsAtMost),\n  [OperatorName.IsLessThan]: relativeDate(\n    Operator.IsMoreThan,\n    Operator.IsLessThan\n  ),\n  [OperatorName.IsMoreThan]: relativeDate(\n    Operator.IsLessThan,\n    Operator.IsMoreThan\n  )\n}\n\nexport const customOperators = {\n  [ComponentType.RadiosField]: defaultOperators,\n  [ComponentType.CheckboxesField]: {\n    [OperatorName.Contains]: reverseInline(Operator.Contains),\n    [OperatorName.DoesNotContain]: not(reverseInline(Operator.Contains))\n  },\n  [ComponentType.NumberField]: withDefaults({\n    [OperatorName.IsAtLeast]: inline(Operator.IsAtLeast),\n    [OperatorName.IsAtMost]: inline(Operator.IsAtMost),\n    [OperatorName.IsLessThan]: inline(Operator.IsLessThan),\n    [OperatorName.IsMoreThan]: inline(Operator.IsMoreThan)\n  }),\n  [ComponentType.DatePartsField]: {\n    ...absoluteDateOperators,\n    ...relativeDateOperators\n  },\n  [ComponentType.TextField]: withDefaults(textFieldOperators),\n  [ComponentType.MultilineTextField]: withDefaults(textFieldOperators),\n  [ComponentType.EmailAddressField]: withDefaults(textFieldOperators),\n  [ComponentType.SelectField]: defaultOperators,\n  [ComponentType.YesNoField]: defaultOperators\n}\n\nexport function getOperatorNames(fieldType?: ComponentType) {\n  const conditionals = getConditionals(fieldType)\n  if (!conditionals) {\n    return []\n  }\n\n  return Object.keys(conditionals) as OperatorName[]\n}\n\nexport function getExpression(\n  fieldType: ComponentType,\n  fieldName: string,\n  operator: OperatorName,\n  value: Condition['value']\n) {\n  const conditionals = getConditionals(fieldType)\n  if (!conditionals) {\n    return\n  }\n\n  return conditionals[operator]?.expression(\n    { type: fieldType, name: fieldName },\n    value\n  )\n}\n\nexport function getOperatorConfig(\n  fieldType: ComponentType,\n  operator: OperatorName\n) {\n  return getConditionals(fieldType)?.[operator]\n}\n\nfunction getConditionals(\n  fieldType?: ComponentType\n): Partial<Conditionals> | undefined {\n  if (!fieldType || !isConditionalType(fieldType)) {\n    return\n  }\n\n  return fieldType in customOperators\n    ? customOperators[fieldType]\n    : defaultOperators\n}\n\nfunction inline(operator: Operator): OperatorDefinition {\n  return {\n    expression(field, value) {\n      return `${field.name} ${operator} ${formatValue(field, value)}`\n    }\n  }\n}\n\nfunction lengthIs(operator: Operator): OperatorDefinition {\n  return {\n    expression(field, value) {\n      return `length(${field.name}) ${operator} ${formatValue(field, value)}`\n    }\n  }\n}\n\nfunction reverseInline(operator: Operator.Contains): OperatorDefinition {\n  return {\n    expression(field, value) {\n      return `${formatValue(field, value)} ${operator} ${field.name}`\n    }\n  }\n}\n\nfunction not(operatorDefinition: OperatorDefinition): OperatorDefinition {\n  return {\n    expression(field, value) {\n      return `not (${operatorDefinition.expression(field, value)})`\n    }\n  }\n}\n\nfunction formatValue(\n  field: Pick<ComponentDef, 'type'>,\n  value: Condition['value']\n) {\n  if (\n    (field.type === ComponentType.DatePartsField &&\n      value.type === ConditionType.RelativeDate) ||\n    field.type === ComponentType.NumberField ||\n    field.type === ComponentType.YesNoField\n  ) {\n    return value.toExpression()\n  }\n\n  return `'${value.toExpression()}'`\n}\n\nexport const absoluteDateOperatorNames = Object.keys(\n  absoluteDateOperators\n) as OperatorName[]\n\nexport const relativeDateOperatorNames = Object.keys(\n  relativeDateOperators\n) as OperatorName[]\n\nfunction absoluteDate(operator: Operator): OperatorDefinition {\n  return {\n    expression(field, value) {\n      if (!(value instanceof ConditionValue)) {\n        throw new Error(\n          \"Expression param 'value' must be ConditionValue instance\"\n        )\n      }\n\n      return `${field.name} ${operator} ${formatValue(field, value)}`\n    }\n  }\n}\n\nfunction relativeDate(\n  pastOperator: Operator,\n  futureOperator: Operator\n): OperatorDefinition {\n  return {\n    expression(field, value) {\n      if (!(value instanceof RelativeDateValue)) {\n        throw new Error(\n          \"Expression param 'value' must be RelativeDateValue instance\"\n        )\n      }\n\n      const isPast = value.direction === DateDirections.PAST\n      return `${field.name} ${isPast ? pastOperator : futureOperator} ${formatValue(field, value)}`\n    }\n  }\n}\n"],"mappings":"AAAA,SAASA,aAAa;AACtB,SAASC,iBAAiB;AAE1B,SACEC,cAAc,EACdC,iBAAiB;AAGnB,SACEC,aAAa,EACbC,cAAc,EACdC,QAAQ,EACRC,YAAY;AAOd,MAAMC,gBAAgB,GAAG;EACvB,CAACD,YAAY,CAACE,EAAE,GAAGC,MAAM,CAACJ,QAAQ,CAACG,EAAE,CAAC;EACtC,CAACF,YAAY,CAACI,KAAK,GAAGD,MAAM,CAACJ,QAAQ,CAACK,KAAK;AAC7C,CAAC;AAED,SAASC,YAAYA,CAAIC,SAAY,EAAE;EACrC,OAAO;IAAE,GAAGL,gBAAgB;IAAE,GAAGK;EAAU,CAA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YjD,iBAAiB,CAAC,EAAE;QACzC,MAAM,IAAI6D,KAAK,CACb,6DACF,CAAC;MACH;MAEA,MAAMG,MAAM,GAAGf,KAAK,CAACgB,SAAS,KAAK/D,cAAc,CAACgE,IAAI;MACtD,OAAO,GAAGZ,KAAK,CAACF,IAAI,IAAIY,MAAM,GAAGF,YAAY,GAAGC,cAAc,IAAIR,WAAW,CAACD,KAAK,EAAEL,KAAK,CAAC,EAAE;IAC/F;EACF,CAAC;AACH","ignoreList":[]}
         | 
| 1 | 
            +
            {"version":3,"file":"condition-operators.js","names":["ComponentType","isConditionalType","isContentType","ConditionValue","RelativeDateValue","ConditionType","DateDirections","Operator","OperatorName","defaultOperators","Is","inline","IsNot","withDefaults","operators","textFieldOperators","IsLongerThan","lengthIs","IsMoreThan","IsShorterThan","IsLessThan","HasLength","absoluteDateOperators","absoluteDate","IsBefore","IsAfter","relativeDateOperators","IsAtLeast","relativeDate","IsAtMost","customOperators","AutocompleteField","RadiosField","CheckboxesField","Contains","reverseInline","DoesNotContain","not","NumberField","DatePartsField","TextField","MultilineTextField","EmailAddressField","TelephoneNumberField","SelectField","YesNoField","getOperatorNames","fieldType","conditionals","getConditionals","Object","keys","getExpression","fieldName","operator","value","expression","type","name","field","formatValue","operatorDefinition","RelativeDate","toExpression","absoluteDateOperatorNames","relativeDateOperatorNames","Error","pastOperator","futureOperator","isPast","direction","PAST"],"sources":["../../../src/conditions/condition-operators.ts"],"sourcesContent":["import { ComponentType } from '~/src/components/enums.js'\nimport { isConditionalType, isContentType } from '~/src/components/helpers.js'\nimport {\n  type ComponentDef,\n  type ConditionalComponentType\n} from '~/src/components/types.js'\nimport {\n  ConditionValue,\n  RelativeDateValue\n} from '~/src/conditions/condition-values.js'\nimport { type Condition } from '~/src/conditions/condition.js'\nimport {\n  ConditionType,\n  DateDirections,\n  Operator,\n  OperatorName\n} from '~/src/conditions/enums.js'\nimport {\n  type Conditionals,\n  type OperatorDefinition\n} from '~/src/conditions/types.js'\n\nconst defaultOperators = {\n  [OperatorName.Is]: inline(Operator.Is),\n  [OperatorName.IsNot]: inline(Operator.IsNot)\n}\n\nfunction withDefaults<T>(operators: T) {\n  return { ...defaultOperators, ...operators }\n}\n\nconst textFieldOperators = {\n  [OperatorName.IsLongerThan]: lengthIs(Operator.IsMoreThan),\n  [OperatorName.IsShorterThan]: lengthIs(Operator.IsLessThan),\n  [OperatorName.HasLength]: lengthIs(Operator.Is)\n}\n\nconst absoluteDateOperators = {\n  [OperatorName.Is]: absoluteDate(Operator.Is),\n  [OperatorName.IsNot]: absoluteDate(Operator.IsNot),\n  [OperatorName.IsBefore]: absoluteDate(Operator.IsLessThan),\n  [OperatorName.IsAfter]: absoluteDate(Operator.IsMoreThan)\n}\n\nconst relativeDateOperators = {\n  [OperatorName.IsAtLeast]: relativeDate(Operator.IsAtMost, Operator.IsAtLeast),\n  [OperatorName.IsAtMost]: relativeDate(Operator.IsAtLeast, Operator.IsAtMost),\n  [OperatorName.IsLessThan]: relativeDate(\n    Operator.IsMoreThan,\n    Operator.IsLessThan\n  ),\n  [OperatorName.IsMoreThan]: relativeDate(\n    Operator.IsLessThan,\n    Operator.IsMoreThan\n  )\n}\n\nexport const customOperators = {\n  [ComponentType.AutocompleteField]: defaultOperators,\n  [ComponentType.RadiosField]: defaultOperators,\n  [ComponentType.CheckboxesField]: {\n    [OperatorName.Contains]: reverseInline(Operator.Contains),\n    [OperatorName.DoesNotContain]: not(reverseInline(Operator.Contains))\n  },\n  [ComponentType.NumberField]: withDefaults({\n    [OperatorName.IsAtLeast]: inline(Operator.IsAtLeast),\n    [OperatorName.IsAtMost]: inline(Operator.IsAtMost),\n    [OperatorName.IsLessThan]: inline(Operator.IsLessThan),\n    [OperatorName.IsMoreThan]: inline(Operator.IsMoreThan)\n  }),\n  [ComponentType.DatePartsField]: {\n    ...absoluteDateOperators,\n    ...relativeDateOperators\n  },\n  [ComponentType.TextField]: withDefaults(textFieldOperators),\n  [ComponentType.MultilineTextField]: withDefaults(textFieldOperators),\n  [ComponentType.EmailAddressField]: withDefaults(textFieldOperators),\n  [ComponentType.TelephoneNumberField]: defaultOperators,\n  [ComponentType.SelectField]: defaultOperators,\n  [ComponentType.YesNoField]: defaultOperators\n}\n\nexport function getOperatorNames(fieldType?: ConditionalComponentType) {\n  const conditionals = getConditionals(fieldType)\n  if (!conditionals) {\n    return []\n  }\n\n  return Object.keys(conditionals) as OperatorName[]\n}\n\nexport function getExpression(\n  fieldType: ConditionalComponentType,\n  fieldName: string,\n  operator: OperatorName,\n  value: Condition['value']\n) {\n  const conditionals = getConditionals(fieldType)\n  if (!conditionals) {\n    return\n  }\n\n  return conditionals[operator]?.expression(\n    { type: fieldType, name: fieldName },\n    value\n  )\n}\n\nfunction getConditionals(\n  fieldType?: ConditionalComponentType\n): Partial<Conditionals> | undefined {\n  if (!fieldType || !isConditionalType(fieldType) || isContentType(fieldType)) {\n    return\n  }\n\n  return fieldType in customOperators\n    ? customOperators[fieldType]\n    : defaultOperators\n}\n\nfunction inline(operator: Operator): OperatorDefinition {\n  return {\n    expression(field, value) {\n      return `${field.name} ${operator} ${formatValue(field, value)}`\n    }\n  }\n}\n\nfunction lengthIs(operator: Operator): OperatorDefinition {\n  return {\n    expression(field, value) {\n      return `length(${field.name}) ${operator} ${formatValue(field, value)}`\n    }\n  }\n}\n\nfunction reverseInline(operator: Operator.Contains): OperatorDefinition {\n  return {\n    expression(field, value) {\n      return `${formatValue(field, value)} ${operator} ${field.name}`\n    }\n  }\n}\n\nfunction not(operatorDefinition: OperatorDefinition): OperatorDefinition {\n  return {\n    expression(field, value) {\n      return `not (${operatorDefinition.expression(field, value)})`\n    }\n  }\n}\n\nfunction formatValue(\n  field: Pick<ComponentDef, 'type'>,\n  value: Condition['value']\n) {\n  if (\n    (field.type === ComponentType.DatePartsField &&\n      value.type === ConditionType.RelativeDate) ||\n    field.type === ComponentType.NumberField ||\n    field.type === ComponentType.YesNoField\n  ) {\n    return value.toExpression()\n  }\n\n  return `'${value.toExpression()}'`\n}\n\nexport const absoluteDateOperatorNames = Object.keys(\n  absoluteDateOperators\n) as OperatorName[]\n\nexport const relativeDateOperatorNames = Object.keys(\n  relativeDateOperators\n) as OperatorName[]\n\nfunction absoluteDate(operator: Operator): OperatorDefinition {\n  return {\n    expression(field, value) {\n      if (!(value instanceof ConditionValue)) {\n        throw new Error(\n          \"Expression param 'value' must be ConditionValue instance\"\n        )\n      }\n\n      return `${field.name} ${operator} ${formatValue(field, value)}`\n    }\n  }\n}\n\nfunction relativeDate(\n  pastOperator: Operator,\n  futureOperator: Operator\n): OperatorDefinition {\n  return {\n    expression(field, value) {\n      if (!(value instanceof RelativeDateValue)) {\n        throw new Error(\n          \"Expression param 'value' must be RelativeDateValue instance\"\n        )\n      }\n\n      const isPast = value.direction === DateDirections.PAST\n      return `${field.name} ${isPast ? pastOperator : futureOperator} ${formatValue(field, value)}`\n    }\n  }\n}\n"],"mappings":"AAAA,SAASA,aAAa;AACtB,SAASC,iBAAiB,EAAEC,aAAa;AAKzC,SACEC,cAAc,EACdC,iBAAiB;AAGnB,SACEC,aAAa,EACbC,cAAc,EACdC,QAAQ,EACRC,YAAY;AAOd,MAAMC,gBAAgB,GAAG;EACvB,CAACD,YAAY,CAACE,EAAE,GAAGC,MAAM,CAACJ,QAAQ,CAACG,EAAE,CAAC;EACtC,CAACF,YAAY,CAACI,KAAK,GAAGD,MAAM,CAACJ,QAAQ,CAACK,KAAK;AAC7C,CAAC;AAED,SAASC,YAAYA,CAAIC,SAAY,EAAE;EACrC,OAAO;IAAE,GAAGL,gBAAgB;IAAE,GAAGK;EAAU,CAAC;AAC9C;AAEA,MAAMC,kBAAkB,GAAG;EACzB,CAACP,YAAY,CAACQ,YAAY,GAAGC,QAAQ,CAACV,QAAQ,CAACW,UAAU,CAAC;EAC1D,CAACV,YAAY,CAACW,aAAa,GAAGF,QAAQ,CAACV,QAAQ,CAACa,UAAU,CAAC;EAC3D,CAACZ,YAAY,CAACa,SAAS,GAAGJ,QAAQ,CAACV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GAAGC,cAAc,IAAIR,WAAW,CAACD,KAAK,EAAEJ,KAAK,CAAC,EAAE;IAC/F;EACF,CAAC;AACH","ignoreList":[]}
         | 
| @@ -1,5 +1,5 @@ | |
| 1 1 | 
             
            import { ComponentType } from '../components/enums.js';
         | 
| 2 | 
            -
            import { type ComponentDef, type ConditionalComponentsDef, type ConditionalComponentType, type ContentComponentsDef, type HtmlComponent, type InsetTextComponent, type  | 
| 2 | 
            +
            import { type ComponentDef, type ConditionalComponentsDef, type ConditionalComponentType, type ContentComponentsDef, type HtmlComponent, type InsetTextComponent, type ListComponent, type ListComponentsDef, type SelectionComponentsDef } from '../components/types.js';
         | 
| 3 3 | 
             
            /**
         | 
| 4 4 | 
             
             * Return component defaults by type
         | 
| 5 5 | 
             
             */
         | 
| @@ -10,13 +10,14 @@ export declare function getComponentDefaults(component?: Partial<ComponentDef>): | |
| 10 10 | 
             
            export declare function hasConditionSupport(component?: Partial<ComponentDef>): component is ConditionalComponentsDef;
         | 
| 11 11 | 
             
            export declare function isConditionalType(type?: ComponentType): type is ConditionalComponentType;
         | 
| 12 12 | 
             
            /**
         | 
| 13 | 
            -
             * Filter known components with content  | 
| 13 | 
            +
             * Filter known components with content (textarea or list)
         | 
| 14 14 | 
             
             */
         | 
| 15 | 
            -
            export declare function  | 
| 15 | 
            +
            export declare function hasContent(component?: Partial<ComponentDef>): component is ContentComponentsDef;
         | 
| 16 16 | 
             
            /**
         | 
| 17 | 
            -
             * Filter known components with  | 
| 17 | 
            +
             * Filter known components with content textarea
         | 
| 18 18 | 
             
             */
         | 
| 19 | 
            -
            export declare function  | 
| 19 | 
            +
            export declare function hasContentField(component?: Partial<ComponentDef>): component is Exclude<ContentComponentsDef, ListComponent>;
         | 
| 20 | 
            +
            export declare function isContentType(type?: ComponentType): type is ContentComponentsDef['type'];
         | 
| 20 21 | 
             
            /**
         | 
| 21 22 | 
             
             * Filter known components with lists
         | 
| 22 23 | 
             
             */
         | 
| @@ -1 +1 @@ | |
| 1 | 
            -
            {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/components/helpers.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AACzD,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,wBAAwB,EAC7B,KAAK,wBAAwB,EAC7B,KAAK,oBAAoB,EACzB,KAAK,aAAa,EAClB,KAAK,kBAAkB,EACvB,KAAK, | 
| 1 | 
            +
            {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/components/helpers.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AACzD,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,wBAAwB,EAC7B,KAAK,wBAAwB,EAC7B,KAAK,oBAAoB,EACzB,KAAK,aAAa,EAClB,KAAK,kBAAkB,EACvB,KAAK,aAAa,EAClB,KAAK,iBAAiB,EACtB,KAAK,sBAAsB,EAC5B,MAAM,2BAA2B,CAAA;AAElC;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,4BAMrE;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CACjC,SAAS,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,GAChC,SAAS,IAAI,wBAAwB,CAEvC;AAED,wBAAgB,iBAAiB,CAC/B,IAAI,CAAC,EAAE,aAAa,GACnB,IAAI,IAAI,wBAAwB,CAkBlC;AAED;;GAEG;AACH,wBAAgB,UAAU,CACxB,SAAS,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,GAChC,SAAS,IAAI,oBAAoB,CAEnC;AAED;;GAEG;AACH,wBAAgB,eAAe,CAC7B,SAAS,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,GAChC,SAAS,IAAI,OAAO,CAAC,oBAAoB,EAAE,aAAa,CAAC,CAG3D;AAED,wBAAgB,aAAa,CAC3B,IAAI,CAAC,EAAE,aAAa,GACnB,IAAI,IAAI,oBAAoB,CAAC,MAAM,CAAC,CAStC;AAED;;GAEG;AACH,wBAAgB,YAAY,CAC1B,SAAS,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,GAChC,SAAS,IAAI,iBAAiB,CAEhC;AAED,wBAAgB,UAAU,CACxB,IAAI,CAAC,EAAE,aAAa,GACnB,IAAI,IAAI,iBAAiB,CAAC,MAAM,CAAC,CAUnC;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAChC,SAAS,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,GAChC,SAAS,IAAI,sBAAsB,CAUrC;AAED;;GAEG;AACH,wBAAgB,QAAQ,CACtB,SAAS,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,GAChC,SAAS,IAAI,OAAO,CAAC,YAAY,EAAE,kBAAkB,GAAG,aAAa,CAAC,CAGxE"}
         | 
| @@ -1,4 +1,4 @@ | |
| 1 1 | 
             
            export { ComponentTypes } from '../components/component-types.js';
         | 
| 2 | 
            -
            export { getComponentDefaults, hasConditionSupport,  | 
| 2 | 
            +
            export { getComponentDefaults, hasConditionSupport, hasContent, hasContentField, hasListField, hasSelectionFields, hasTitle, isConditionalType, isListType } from '../components/helpers.js';
         | 
| 3 3 | 
             
            export { ComponentType } from '../components/enums.js';
         | 
| 4 4 | 
             
            //# sourceMappingURL=index.d.ts.map
         | 
| @@ -1 +1 @@ | |
| 1 | 
            -
            {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAA;AACpE,OAAO,EACL,oBAAoB,EACpB,mBAAmB,EACnB,eAAe,EACf, | 
| 1 | 
            +
            {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAA;AACpE,OAAO,EACL,oBAAoB,EACpB,mBAAmB,EACnB,UAAU,EACV,eAAe,EACf,YAAY,EACZ,kBAAkB,EAClB,QAAQ,EACR,iBAAiB,EACjB,UAAU,EACX,MAAM,6BAA6B,CAAA;AAEpC,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA"}
         | 
| @@ -1,5 +1,5 @@ | |
| 1 1 | 
             
            import { type ComponentType } from '../components/enums.js';
         | 
| 2 | 
            -
            export type ConditionalComponentType =  | 
| 2 | 
            +
            export type ConditionalComponentType = Exclude<ConditionalComponentsDef['type'], ContentComponentsDef>;
         | 
| 3 3 | 
             
            /**
         | 
| 4 4 | 
             
             * Types for Components JSON structure which are expected by engine and turned into actual form input/content/lists
         | 
| 5 5 | 
             
             */
         | 
| @@ -103,6 +103,7 @@ export interface NumberFieldComponent extends NumberFieldBase { | |
| 103 103 | 
             
            export interface TelephoneNumberFieldComponent extends TextFieldBase {
         | 
| 104 104 | 
             
                type: ComponentType.TelephoneNumberField;
         | 
| 105 105 | 
             
                options: TextFieldBase['options'] & {
         | 
| 106 | 
            +
                    condition?: string;
         | 
| 106 107 | 
             
                    customValidationMessage?: string;
         | 
| 107 108 | 
             
                };
         | 
| 108 109 | 
             
            }
         | 
| @@ -159,6 +160,9 @@ export interface ListComponent extends ListFieldBase { | |
| 159 160 | 
             
            }
         | 
| 160 161 | 
             
            export interface AutocompleteFieldComponent extends ListFieldBase {
         | 
| 161 162 | 
             
                type: ComponentType.AutocompleteField;
         | 
| 163 | 
            +
                options: ListFieldBase['options'] & {
         | 
| 164 | 
            +
                    condition?: string;
         | 
| 165 | 
            +
                };
         | 
| 162 166 | 
             
            }
         | 
| 163 167 | 
             
            export interface CheckboxesFieldComponent extends ListFieldBase {
         | 
| 164 168 | 
             
                type: ComponentType.CheckboxesField;
         | 
| @@ -179,12 +183,11 @@ export interface SelectFieldComponent extends ListFieldBase { | |
| 179 183 | 
             
                    condition?: string;
         | 
| 180 184 | 
             
                };
         | 
| 181 185 | 
             
            }
         | 
| 182 | 
            -
            export type ComponentDef =  | 
| 183 | 
            -
            export type InputFieldsComponentsDef = TextFieldComponent | EmailAddressFieldComponent | NumberFieldComponent | MultilineTextFieldComponent | TelephoneNumberFieldComponent |  | 
| 184 | 
            -
            export type ContentComponentsDef = DetailsComponent | HtmlComponent | InsetTextComponent;
         | 
| 185 | 
            -
            export type  | 
| 186 | 
            -
            export type  | 
| 187 | 
            -
            export type  | 
| 188 | 
            -
            export type ConditionalComponentsDef = CheckboxesFieldComponent | DatePartsFieldFieldComponent | EmailAddressFieldComponent | MultilineTextFieldComponent | NumberFieldComponent | TextFieldComponent | YesNoFieldComponent;
         | 
| 186 | 
            +
            export type ComponentDef = InputFieldsComponentsDef | SelectionComponentsDef | ContentComponentsDef;
         | 
| 187 | 
            +
            export type InputFieldsComponentsDef = TextFieldComponent | EmailAddressFieldComponent | NumberFieldComponent | MultilineTextFieldComponent | TelephoneNumberFieldComponent | MonthYearFieldComponent | DatePartsFieldFieldComponent | UkAddressFieldComponent;
         | 
| 188 | 
            +
            export type ContentComponentsDef = DetailsComponent | HtmlComponent | InsetTextComponent | ListComponent;
         | 
| 189 | 
            +
            export type ListComponentsDef = Exclude<SelectionComponentsDef, YesNoFieldComponent> | ListComponent;
         | 
| 190 | 
            +
            export type SelectionComponentsDef = AutocompleteFieldComponent | CheckboxesFieldComponent | RadiosFieldComponent | SelectFieldComponent | YesNoFieldComponent;
         | 
| 191 | 
            +
            export type ConditionalComponentsDef = Exclude<ComponentDef, InsetTextComponent | ListComponent | MonthYearFieldComponent | UkAddressFieldComponent>;
         | 
| 189 192 | 
             
            export {};
         | 
| 190 193 | 
             
            //# sourceMappingURL=types.d.ts.map
         | 
| @@ -1 +1 @@ | |
| 1 | 
            -
            {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAE9D,MAAM,MAAM,wBAAwB, | 
| 1 | 
            +
            {"version":3,"file":"types.d.ts","sour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AA;AAGjB,MAAM,MAAM,iBAAiB,GACzB,OAAO,CAAC,sBAAsB,EAAE,mBAAmB,CAAC,GACpD,aAAa,CAAA;AAGjB,MAAM,MAAM,sBAAsB,GAC9B,0BAA0B,GAC1B,wBAAwB,GACxB,oBAAoB,GACpB,oBAAoB,GACpB,mBAAmB,CAAA;AAGvB,MAAM,MAAM,wBAAwB,GAAG,OAAO,CAC5C,YAAY,EACV,kBAAkB,GAClB,aAAa,GACb,uBAAuB,GACvB,uBAAuB,CAC1B,CAAA"}
         | 
| @@ -1,8 +1,12 @@ | |
| 1 | 
            -
            import {  | 
| 1 | 
            +
            import { type ConditionalComponentType } from '../components/types.js';
         | 
| 2 2 | 
             
            import { type Condition } from '../conditions/condition.js';
         | 
| 3 3 | 
             
            import { OperatorName } from '../conditions/enums.js';
         | 
| 4 4 | 
             
            import { type OperatorDefinition } from '../conditions/types.js';
         | 
| 5 5 | 
             
            export declare const customOperators: {
         | 
| 6 | 
            +
                AutocompleteField: {
         | 
| 7 | 
            +
                    is: OperatorDefinition;
         | 
| 8 | 
            +
                    "is not": OperatorDefinition;
         | 
| 9 | 
            +
                };
         | 
| 6 10 | 
             
                RadiosField: {
         | 
| 7 11 | 
             
                    is: OperatorDefinition;
         | 
| 8 12 | 
             
                    "is not": OperatorDefinition;
         | 
| @@ -54,6 +58,10 @@ export declare const customOperators: { | |
| 54 58 | 
             
                    "is shorter than": OperatorDefinition;
         | 
| 55 59 | 
             
                    "has length": OperatorDefinition;
         | 
| 56 60 | 
             
                };
         | 
| 61 | 
            +
                TelephoneNumberField: {
         | 
| 62 | 
            +
                    is: OperatorDefinition;
         | 
| 63 | 
            +
                    "is not": OperatorDefinition;
         | 
| 64 | 
            +
                };
         | 
| 57 65 | 
             
                SelectField: {
         | 
| 58 66 | 
             
                    is: OperatorDefinition;
         | 
| 59 67 | 
             
                    "is not": OperatorDefinition;
         | 
| @@ -63,9 +71,8 @@ export declare const customOperators: { | |
| 63 71 | 
             
                    "is not": OperatorDefinition;
         | 
| 64 72 | 
             
                };
         | 
| 65 73 | 
             
            };
         | 
| 66 | 
            -
            export declare function getOperatorNames(fieldType?:  | 
| 67 | 
            -
            export declare function getExpression(fieldType:  | 
| 68 | 
            -
            export declare function getOperatorConfig(fieldType: ComponentType, operator: OperatorName): OperatorDefinition | undefined;
         | 
| 74 | 
            +
            export declare function getOperatorNames(fieldType?: ConditionalComponentType): OperatorName[];
         | 
| 75 | 
            +
            export declare function getExpression(fieldType: ConditionalComponentType, fieldName: string, operator: OperatorName, value: Condition['value']): string | undefined;
         | 
| 69 76 | 
             
            export declare const absoluteDateOperatorNames: OperatorName[];
         | 
| 70 77 | 
             
            export declare const relativeDateOperatorNames: OperatorName[];
         | 
| 71 78 | 
             
            //# sourceMappingURL=condition-operators.d.ts.map
         | 
| @@ -1 +1 @@ | |
| 1 | 
            -
            {"version":3,"file":"condition-operators.d.ts","sourceRoot":"","sources":["../../../src/conditions/condition-operators.ts"],"names":[],"mappings":" | 
| 1 | 
            +
            {"version":3,"file":"condition-operators.d.ts","sourceRoot":"","sources":["../../../src/conditions/condition-operators.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,wBAAwB,EAC9B,MAAM,2BAA2B,CAAA;AAKlC,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,+BAA+B,CAAA;AAC9D,OAAO,EAIL,YAAY,EACb,MAAM,2BAA2B,CAAA;AAClC,OAAO,EAEL,KAAK,kBAAkB,EACxB,MAAM,2BAA2B,CAAA;AAqClC,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuB3B,CAAA;AAED,wBAAgB,gBAAgB,CAAC,SAAS,CAAC,EAAE,wBAAwB,kBAOpE;AAED,wBAAgB,aAAa,CAC3B,SAAS,EAAE,wBAAwB,EACnC,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,YAAY,EACtB,KAAK,EAAE,SAAS,CAAC,OAAO,CAAC,sBAW1B;AA8DD,eAAO,MAAM,yBAAyB,EAEjC,YAAY,EAAE,CAAA;AAEnB,eAAO,MAAM,yBAAyB,EAEjC,YAAY,EAAE,CAAA"}
         | 
    
        package/package.json
    CHANGED
    
    
| @@ -7,9 +7,9 @@ import { | |
| 7 7 | 
             
              type ContentComponentsDef,
         | 
| 8 8 | 
             
              type HtmlComponent,
         | 
| 9 9 | 
             
              type InsetTextComponent,
         | 
| 10 | 
            +
              type ListComponent,
         | 
| 10 11 | 
             
              type ListComponentsDef,
         | 
| 11 | 
            -
              type SelectionComponentsDef | 
| 12 | 
            -
              type EditorComponentsDef
         | 
| 12 | 
            +
              type SelectionComponentsDef
         | 
| 13 13 | 
             
            } from '~/src/components/types.js'
         | 
| 14 14 |  | 
| 15 15 | 
             
            /**
         | 
| @@ -36,59 +36,54 @@ export function isConditionalType( | |
| 36 36 | 
             
              type?: ComponentType
         | 
| 37 37 | 
             
            ): type is ConditionalComponentType {
         | 
| 38 38 | 
             
              const allowedTypes = [
         | 
| 39 | 
            +
                ComponentType.AutocompleteField,
         | 
| 39 40 | 
             
                ComponentType.RadiosField,
         | 
| 40 41 | 
             
                ComponentType.CheckboxesField,
         | 
| 41 42 | 
             
                ComponentType.DatePartsField,
         | 
| 42 43 | 
             
                ComponentType.EmailAddressField,
         | 
| 43 44 | 
             
                ComponentType.MultilineTextField,
         | 
| 45 | 
            +
                ComponentType.TelephoneNumberField,
         | 
| 44 46 | 
             
                ComponentType.NumberField,
         | 
| 45 47 | 
             
                ComponentType.SelectField,
         | 
| 46 48 | 
             
                ComponentType.TextField,
         | 
| 47 | 
            -
                ComponentType.YesNoField
         | 
| 49 | 
            +
                ComponentType.YesNoField,
         | 
| 50 | 
            +
                ComponentType.Html,
         | 
| 51 | 
            +
                ComponentType.Details
         | 
| 48 52 | 
             
              ]
         | 
| 49 53 |  | 
| 50 54 | 
             
              return !!type && allowedTypes.includes(type)
         | 
| 51 55 | 
             
            }
         | 
| 52 56 |  | 
| 53 57 | 
             
            /**
         | 
| 54 | 
            -
             * Filter known components with content  | 
| 58 | 
            +
             * Filter known components with content (textarea or list)
         | 
| 55 59 | 
             
             */
         | 
| 56 | 
            -
            export function  | 
| 60 | 
            +
            export function hasContent(
         | 
| 57 61 | 
             
              component?: Partial<ComponentDef>
         | 
| 58 62 | 
             
            ): component is ContentComponentsDef {
         | 
| 59 | 
            -
               | 
| 60 | 
            -
                ComponentType.Details,
         | 
| 61 | 
            -
                ComponentType.Html,
         | 
| 62 | 
            -
                ComponentType.InsetText
         | 
| 63 | 
            -
              ]
         | 
| 64 | 
            -
             | 
| 65 | 
            -
              return !!component?.type && allowedTypes.includes(component.type)
         | 
| 63 | 
            +
              return isContentType(component?.type)
         | 
| 66 64 | 
             
            }
         | 
| 67 65 |  | 
| 68 66 | 
             
            /**
         | 
| 69 | 
            -
             * Filter known components with  | 
| 67 | 
            +
             * Filter known components with content textarea
         | 
| 70 68 | 
             
             */
         | 
| 71 | 
            -
            export function  | 
| 69 | 
            +
            export function hasContentField(
         | 
| 72 70 | 
             
              component?: Partial<ComponentDef>
         | 
| 73 | 
            -
            ): component is  | 
| 71 | 
            +
            ): component is Exclude<ContentComponentsDef, ListComponent> {
         | 
| 72 | 
            +
              const deniedTypes = [ComponentType.List]
         | 
| 73 | 
            +
              return hasContent(component) && !deniedTypes.includes(component.type)
         | 
| 74 | 
            +
            }
         | 
| 75 | 
            +
             | 
| 76 | 
            +
            export function isContentType(
         | 
| 77 | 
            +
              type?: ComponentType
         | 
| 78 | 
            +
            ): type is ContentComponentsDef['type'] {
         | 
| 74 79 | 
             
              const allowedTypes = [
         | 
| 75 | 
            -
                ComponentType.TextField,
         | 
| 76 | 
            -
                ComponentType.EmailAddressField,
         | 
| 77 | 
            -
                ComponentType.TelephoneNumberField,
         | 
| 78 | 
            -
                ComponentType.MultilineTextField,
         | 
| 79 | 
            -
                ComponentType.NumberField,
         | 
| 80 | 
            -
                ComponentType.AutocompleteField,
         | 
| 81 | 
            -
                ComponentType.SelectField,
         | 
| 82 | 
            -
                ComponentType.RadiosField,
         | 
| 83 | 
            -
                ComponentType.CheckboxesField,
         | 
| 84 | 
            -
                ComponentType.List,
         | 
| 85 80 | 
             
                ComponentType.Details,
         | 
| 86 81 | 
             
                ComponentType.Html,
         | 
| 87 82 | 
             
                ComponentType.InsetText,
         | 
| 88 | 
            -
                ComponentType. | 
| 83 | 
            +
                ComponentType.List
         | 
| 89 84 | 
             
              ]
         | 
| 90 85 |  | 
| 91 | 
            -
              return !! | 
| 86 | 
            +
              return !!type && allowedTypes.includes(type)
         | 
| 92 87 | 
             
            }
         | 
| 93 88 |  | 
| 94 89 | 
             
            /**
         | 
| @@ -121,6 +116,7 @@ export function hasSelectionFields( | |
| 121 116 | 
             
              component?: Partial<ComponentDef>
         | 
| 122 117 | 
             
            ): component is SelectionComponentsDef {
         | 
| 123 118 | 
             
              const allowedTypes = [
         | 
| 119 | 
            +
                ComponentType.AutocompleteField,
         | 
| 124 120 | 
             
                ComponentType.CheckboxesField,
         | 
| 125 121 | 
             
                ComponentType.RadiosField,
         | 
| 126 122 | 
             
                ComponentType.SelectField,
         | 
    
        package/src/components/index.ts
    CHANGED
    
    
    
        package/src/components/types.ts
    CHANGED
    
    | @@ -1,15 +1,9 @@ | |
| 1 1 | 
             
            import { type ComponentType } from '~/src/components/enums.js'
         | 
| 2 2 |  | 
| 3 | 
            -
            export type ConditionalComponentType =
         | 
| 4 | 
            -
               | 
| 5 | 
            -
               | 
| 6 | 
            -
             | 
| 7 | 
            -
              | ComponentType.EmailAddressField
         | 
| 8 | 
            -
              | ComponentType.MultilineTextField
         | 
| 9 | 
            -
              | ComponentType.NumberField
         | 
| 10 | 
            -
              | ComponentType.SelectField
         | 
| 11 | 
            -
              | ComponentType.TextField
         | 
| 12 | 
            -
              | ComponentType.YesNoField
         | 
| 3 | 
            +
            export type ConditionalComponentType = Exclude<
         | 
| 4 | 
            +
              ConditionalComponentsDef['type'],
         | 
| 5 | 
            +
              ContentComponentsDef
         | 
| 6 | 
            +
            >
         | 
| 13 7 |  | 
| 14 8 | 
             
            /**
         | 
| 15 9 | 
             
             * Types for Components JSON structure which are expected by engine and turned into actual form input/content/lists
         | 
| @@ -135,6 +129,7 @@ export interface NumberFieldComponent extends NumberFieldBase { | |
| 135 129 | 
             
            export interface TelephoneNumberFieldComponent extends TextFieldBase {
         | 
| 136 130 | 
             
              type: ComponentType.TelephoneNumberField
         | 
| 137 131 | 
             
              options: TextFieldBase['options'] & {
         | 
| 132 | 
            +
                condition?: string
         | 
| 138 133 | 
             
                customValidationMessage?: string
         | 
| 139 134 | 
             
              }
         | 
| 140 135 | 
             
            }
         | 
| @@ -204,6 +199,9 @@ export interface ListComponent extends ListFieldBase { | |
| 204 199 |  | 
| 205 200 | 
             
            export interface AutocompleteFieldComponent extends ListFieldBase {
         | 
| 206 201 | 
             
              type: ComponentType.AutocompleteField
         | 
| 202 | 
            +
              options: ListFieldBase['options'] & {
         | 
| 203 | 
            +
                condition?: string
         | 
| 204 | 
            +
              }
         | 
| 207 205 | 
             
            }
         | 
| 208 206 |  | 
| 209 207 | 
             
            export interface CheckboxesFieldComponent extends ListFieldBase {
         | 
| @@ -229,23 +227,9 @@ export interface SelectFieldComponent extends ListFieldBase { | |
| 229 227 | 
             
            }
         | 
| 230 228 |  | 
| 231 229 | 
             
            export type ComponentDef =
         | 
| 232 | 
            -
              |  | 
| 233 | 
            -
              |  | 
| 234 | 
            -
              |  | 
| 235 | 
            -
              | DatePartsFieldFieldComponent
         | 
| 236 | 
            -
              | MonthYearFieldComponent
         | 
| 237 | 
            -
              | DetailsComponent
         | 
| 238 | 
            -
              | EmailAddressFieldComponent
         | 
| 239 | 
            -
              | HtmlComponent
         | 
| 240 | 
            -
              | ListComponent
         | 
| 241 | 
            -
              | MultilineTextFieldComponent
         | 
| 242 | 
            -
              | NumberFieldComponent
         | 
| 243 | 
            -
              | RadiosFieldComponent
         | 
| 244 | 
            -
              | SelectFieldComponent
         | 
| 245 | 
            -
              | TelephoneNumberFieldComponent
         | 
| 246 | 
            -
              | TextFieldComponent
         | 
| 247 | 
            -
              | UkAddressFieldComponent
         | 
| 248 | 
            -
              | YesNoFieldComponent
         | 
| 230 | 
            +
              | InputFieldsComponentsDef
         | 
| 231 | 
            +
              | SelectionComponentsDef
         | 
| 232 | 
            +
              | ContentComponentsDef
         | 
| 249 233 |  | 
| 250 234 | 
             
            // Components that render inputs
         | 
| 251 235 | 
             
            export type InputFieldsComponentsDef =
         | 
| @@ -254,7 +238,6 @@ export type InputFieldsComponentsDef = | |
| 254 238 | 
             
              | NumberFieldComponent
         | 
| 255 239 | 
             
              | MultilineTextFieldComponent
         | 
| 256 240 | 
             
              | TelephoneNumberFieldComponent
         | 
| 257 | 
            -
              | YesNoFieldComponent
         | 
| 258 241 | 
             
              | MonthYearFieldComponent
         | 
| 259 242 | 
             
              | DatePartsFieldFieldComponent
         | 
| 260 243 | 
             
              | UkAddressFieldComponent
         | 
| @@ -264,45 +247,26 @@ export type ContentComponentsDef = | |
| 264 247 | 
             
              | DetailsComponent
         | 
| 265 248 | 
             
              | HtmlComponent
         | 
| 266 249 | 
             
              | InsetTextComponent
         | 
| 267 | 
            -
             | 
| 268 | 
            -
            // Components with editors
         | 
| 269 | 
            -
            export type EditorComponentsDef =
         | 
| 270 | 
            -
              | TextFieldComponent
         | 
| 271 | 
            -
              | EmailAddressFieldComponent
         | 
| 272 | 
            -
              | TelephoneNumberFieldComponent
         | 
| 273 | 
            -
              | MultilineTextFieldComponent
         | 
| 274 | 
            -
              | NumberFieldComponent
         | 
| 275 | 
            -
              | AutocompleteFieldComponent
         | 
| 276 | 
            -
              | SelectFieldComponent
         | 
| 277 | 
            -
              | RadiosFieldComponent
         | 
| 278 | 
            -
              | CheckboxesFieldComponent
         | 
| 279 250 | 
             
              | ListComponent
         | 
| 280 | 
            -
              | DetailsComponent
         | 
| 281 | 
            -
              | HtmlComponent
         | 
| 282 | 
            -
              | InsetTextComponent
         | 
| 283 | 
            -
              | DatePartsFieldFieldComponent
         | 
| 284 251 |  | 
| 285 252 | 
             
            // Components that render lists
         | 
| 286 253 | 
             
            export type ListComponentsDef =
         | 
| 254 | 
            +
              | Exclude<SelectionComponentsDef, YesNoFieldComponent>
         | 
| 287 255 | 
             
              | ListComponent
         | 
| 288 | 
            -
              | AutocompleteFieldComponent
         | 
| 289 | 
            -
              | CheckboxesFieldComponent
         | 
| 290 | 
            -
              | RadiosFieldComponent
         | 
| 291 | 
            -
              | SelectFieldComponent
         | 
| 292 256 |  | 
| 293 257 | 
             
            // Components that have selection fields
         | 
| 294 258 | 
             
            export type SelectionComponentsDef =
         | 
| 259 | 
            +
              | AutocompleteFieldComponent
         | 
| 295 260 | 
             
              | CheckboxesFieldComponent
         | 
| 296 261 | 
             
              | RadiosFieldComponent
         | 
| 297 262 | 
             
              | SelectFieldComponent
         | 
| 298 263 | 
             
              | YesNoFieldComponent
         | 
| 299 264 |  | 
| 300 | 
            -
            // Components that have  | 
| 301 | 
            -
            export type ConditionalComponentsDef =
         | 
| 302 | 
            -
               | 
| 303 | 
            -
              |  | 
| 304 | 
            -
              |  | 
| 305 | 
            -
              |  | 
| 306 | 
            -
              |  | 
| 307 | 
            -
             | 
| 308 | 
            -
              | YesNoFieldComponent
         | 
| 265 | 
            +
            // Components that have condition support
         | 
| 266 | 
            +
            export type ConditionalComponentsDef = Exclude<
         | 
| 267 | 
            +
              ComponentDef,
         | 
| 268 | 
            +
              | InsetTextComponent
         | 
| 269 | 
            +
              | ListComponent
         | 
| 270 | 
            +
              | MonthYearFieldComponent
         | 
| 271 | 
            +
              | UkAddressFieldComponent
         | 
| 272 | 
            +
            >
         | 
| @@ -1,5 +1,5 @@ | |
| 1 1 | 
             
            import { type ComponentType } from '~/src/components/enums.js'
         | 
| 2 | 
            -
            import { isConditionalType } from '~/src/components/helpers.js'
         | 
| 2 | 
            +
            import { isConditionalType, isContentType } from '~/src/components/helpers.js'
         | 
| 3 3 | 
             
            import { type ConditionalComponentType } from '~/src/components/types.js'
         | 
| 4 4 | 
             
            import { type ConditionFieldData } from '~/src/conditions/types.js'
         | 
| 5 5 |  | 
| @@ -13,7 +13,7 @@ export class ConditionField { | |
| 13 13 | 
             
                  throw new Error("ConditionField param 'name' must be a string")
         | 
| 14 14 | 
             
                }
         | 
| 15 15 |  | 
| 16 | 
            -
                if (!isConditionalType(type)) {
         | 
| 16 | 
            +
                if (!isConditionalType(type) || isContentType(type)) {
         | 
| 17 17 | 
             
                  throw new Error("ConditionField param 'type' must support conditions")
         | 
| 18 18 | 
             
                }
         | 
| 19 19 |  | 
| @@ -1,6 +1,9 @@ | |
| 1 1 | 
             
            import { ComponentType } from '~/src/components/enums.js'
         | 
| 2 | 
            -
            import { isConditionalType } from '~/src/components/helpers.js'
         | 
| 3 | 
            -
            import { | 
| 2 | 
            +
            import { isConditionalType, isContentType } from '~/src/components/helpers.js'
         | 
| 3 | 
            +
            import {
         | 
| 4 | 
            +
              type ComponentDef,
         | 
| 5 | 
            +
              type ConditionalComponentType
         | 
| 6 | 
            +
            } from '~/src/components/types.js'
         | 
| 4 7 | 
             
            import {
         | 
| 5 8 | 
             
              ConditionValue,
         | 
| 6 9 | 
             
              RelativeDateValue
         | 
| @@ -53,6 +56,7 @@ const relativeDateOperators = { | |
| 53 56 | 
             
            }
         | 
| 54 57 |  | 
| 55 58 | 
             
            export const customOperators = {
         | 
| 59 | 
            +
              [ComponentType.AutocompleteField]: defaultOperators,
         | 
| 56 60 | 
             
              [ComponentType.RadiosField]: defaultOperators,
         | 
| 57 61 | 
             
              [ComponentType.CheckboxesField]: {
         | 
| 58 62 | 
             
                [OperatorName.Contains]: reverseInline(Operator.Contains),
         | 
| @@ -71,11 +75,12 @@ export const customOperators = { | |
| 71 75 | 
             
              [ComponentType.TextField]: withDefaults(textFieldOperators),
         | 
| 72 76 | 
             
              [ComponentType.MultilineTextField]: withDefaults(textFieldOperators),
         | 
| 73 77 | 
             
              [ComponentType.EmailAddressField]: withDefaults(textFieldOperators),
         | 
| 78 | 
            +
              [ComponentType.TelephoneNumberField]: defaultOperators,
         | 
| 74 79 | 
             
              [ComponentType.SelectField]: defaultOperators,
         | 
| 75 80 | 
             
              [ComponentType.YesNoField]: defaultOperators
         | 
| 76 81 | 
             
            }
         | 
| 77 82 |  | 
| 78 | 
            -
            export function getOperatorNames(fieldType?:  | 
| 83 | 
            +
            export function getOperatorNames(fieldType?: ConditionalComponentType) {
         | 
| 79 84 | 
             
              const conditionals = getConditionals(fieldType)
         | 
| 80 85 | 
             
              if (!conditionals) {
         | 
| 81 86 | 
             
                return []
         | 
| @@ -85,7 +90,7 @@ export function getOperatorNames(fieldType?: ComponentType) { | |
| 85 90 | 
             
            }
         | 
| 86 91 |  | 
| 87 92 | 
             
            export function getExpression(
         | 
| 88 | 
            -
              fieldType:  | 
| 93 | 
            +
              fieldType: ConditionalComponentType,
         | 
| 89 94 | 
             
              fieldName: string,
         | 
| 90 95 | 
             
              operator: OperatorName,
         | 
| 91 96 | 
             
              value: Condition['value']
         | 
| @@ -101,17 +106,10 @@ export function getExpression( | |
| 101 106 | 
             
              )
         | 
| 102 107 | 
             
            }
         | 
| 103 108 |  | 
| 104 | 
            -
            export function getOperatorConfig(
         | 
| 105 | 
            -
              fieldType: ComponentType,
         | 
| 106 | 
            -
              operator: OperatorName
         | 
| 107 | 
            -
            ) {
         | 
| 108 | 
            -
              return getConditionals(fieldType)?.[operator]
         | 
| 109 | 
            -
            }
         | 
| 110 | 
            -
             | 
| 111 109 | 
             
            function getConditionals(
         | 
| 112 | 
            -
              fieldType?:  | 
| 110 | 
            +
              fieldType?: ConditionalComponentType
         | 
| 113 111 | 
             
            ): Partial<Conditionals> | undefined {
         | 
| 114 | 
            -
              if (!fieldType || !isConditionalType(fieldType)) {
         | 
| 112 | 
            +
              if (!fieldType || !isConditionalType(fieldType) || isContentType(fieldType)) {
         | 
| 115 113 | 
             
                return
         | 
| 116 114 | 
             
              }
         | 
| 117 115 |  |