@defra/forms-model 3.0.188 → 3.0.190
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/component-types.js +0 -2
- package/dist/module/components/component-types.js.map +1 -1
- package/dist/module/components/helpers.js +4 -1
- 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 +3 -3
- package/dist/module/conditions/condition-field.js.map +1 -1
- package/dist/module/conditions/condition-operators.js +15 -6
- package/dist/module/conditions/condition-operators.js.map +1 -1
- package/dist/module/conditions/types.js.map +1 -1
- package/dist/types/components/component-types.d.ts +0 -1
- package/dist/types/components/component-types.d.ts.map +1 -1
- package/dist/types/components/helpers.d.ts +3 -1
- 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 +1 -1
- package/dist/types/components/types.d.ts.map +1 -1
- package/dist/types/conditions/condition-field.d.ts +3 -3
- package/dist/types/conditions/condition-field.d.ts.map +1 -1
- package/dist/types/conditions/condition-operators.d.ts +30 -30
- package/dist/types/conditions/condition-operators.d.ts.map +1 -1
- package/dist/types/conditions/types.d.ts +2 -2
- package/dist/types/conditions/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/component-types.ts +0 -4
- package/src/components/helpers.ts +8 -1
- package/src/components/index.ts +1 -4
- package/src/components/types.ts +9 -11
- package/src/conditions/condition-field.ts +6 -20
- package/src/conditions/condition-operators.ts +27 -16
- package/src/conditions/types.ts +2 -2
@@ -1,5 +1,4 @@
|
|
1
1
|
import { ComponentSubType, ComponentType } from "./enums.js";
|
2
|
-
import { hasConditionSupport } from "./helpers.js";
|
3
2
|
export const ComponentTypes = [{
|
4
3
|
name: 'TextField',
|
5
4
|
type: ComponentType.TextField,
|
@@ -145,5 +144,4 @@ export const ComponentTypes = [{
|
|
145
144
|
schema: {},
|
146
145
|
list: ''
|
147
146
|
}];
|
148
|
-
export const ConditionalComponentTypes = ComponentTypes.filter(hasConditionSupport);
|
149
147
|
//# sourceMappingURL=component-types.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"component-types.js","names":["ComponentSubType","ComponentType","
|
1
|
+
{"version":3,"file":"component-types.js","names":["ComponentSubType","ComponentType","ComponentTypes","name","type","TextField","title","subType","Field","hint","options","schema","MultilineTextField","YesNoField","TimeField","DatePartsField","MonthYearField","SelectField","ListField","list","AutocompleteField","RadiosField","CheckboxesField","NumberField","UkAddressField","TelephoneNumberField","EmailAddressField","Html","Content","content","InsetText","Details","List"],"sources":["../../../src/components/component-types.ts"],"sourcesContent":["import { ComponentSubType, ComponentType } from '~/src/components/enums.js'\nimport { type ComponentDef } from '~/src/components/types.js'\n\nexport const ComponentTypes: ComponentDef[] = [\n {\n name: 'TextField',\n type: ComponentType.TextField,\n title: 'Text field',\n subType: ComponentSubType.Field,\n hint: '',\n options: {},\n schema: {}\n },\n {\n name: 'MultilineTextField',\n type: ComponentType.MultilineTextField,\n title: 'Multiline text field',\n subType: ComponentSubType.Field,\n hint: '',\n options: {},\n schema: {}\n },\n {\n name: 'YesNoField',\n type: ComponentType.YesNoField,\n title: 'Yes/No field',\n subType: ComponentSubType.Field,\n hint: '',\n options: {},\n schema: {}\n },\n {\n name: 'TimeField',\n type: ComponentType.TimeField,\n title: 'Time field',\n subType: ComponentSubType.Field,\n hint: '',\n options: {},\n schema: {}\n },\n {\n name: 'DatePartsField',\n type: ComponentType.DatePartsField,\n title: 'Date field',\n subType: ComponentSubType.Field,\n hint: '',\n options: {},\n schema: {}\n },\n {\n name: 'MonthYearField',\n type: ComponentType.MonthYearField,\n title: 'Month & year field',\n subType: ComponentSubType.Field,\n hint: '',\n options: {},\n schema: {}\n },\n {\n name: 'SelectField',\n type: ComponentType.SelectField,\n title: 'Select field',\n subType: ComponentSubType.ListField,\n options: {},\n schema: {},\n list: ''\n },\n {\n name: 'AutocompleteField',\n type: ComponentType.AutocompleteField,\n title: 'Autocomplete field',\n subType: ComponentSubType.ListField,\n options: {},\n schema: {},\n list: ''\n },\n {\n name: 'RadiosField',\n type: ComponentType.RadiosField,\n title: 'Radios field',\n subType: ComponentSubType.ListField,\n options: {},\n schema: {},\n list: ''\n },\n {\n name: 'CheckboxesField',\n type: ComponentType.CheckboxesField,\n title: 'Checkboxes field',\n subType: ComponentSubType.ListField,\n options: {},\n schema: {},\n list: ''\n },\n {\n name: 'NumberField',\n type: ComponentType.NumberField,\n title: 'Number field',\n subType: ComponentSubType.Field,\n hint: '',\n options: {},\n schema: {}\n },\n {\n name: 'UkAddressField',\n type: ComponentType.UkAddressField,\n title: 'UK address field',\n subType: ComponentSubType.Field,\n hint: '',\n options: {},\n schema: {}\n },\n {\n name: 'TelephoneNumberField',\n type: ComponentType.TelephoneNumberField,\n title: 'Telephone number field',\n subType: ComponentSubType.Field,\n hint: '',\n options: {},\n schema: {}\n },\n {\n name: 'EmailAddressField',\n type: ComponentType.EmailAddressField,\n title: 'Email address field',\n subType: ComponentSubType.Field,\n hint: '',\n options: {},\n schema: {}\n },\n {\n name: 'Html',\n type: ComponentType.Html,\n title: 'Html',\n subType: ComponentSubType.Content,\n content: '',\n options: {},\n schema: {}\n },\n {\n name: 'InsetText',\n type: ComponentType.InsetText,\n title: 'Inset text',\n subType: ComponentSubType.Content,\n content: '',\n options: {},\n schema: {}\n },\n {\n name: 'Details',\n type: ComponentType.Details,\n title: 'Details',\n subType: ComponentSubType.Content,\n content: '',\n options: {},\n schema: {}\n },\n {\n name: 'List',\n type: ComponentType.List,\n title: 'List',\n subType: ComponentSubType.Content,\n options: {},\n schema: {},\n list: ''\n }\n]\n"],"mappings":"AAAA,SAASA,gBAAgB,EAAEC,aAAa;AAGxC,OAAO,MAAMC,cAA8B,GAAG,CAC5C;EACEC,IAAI,EAAE,WAAW;EACjBC,IAAI,EAAEH,aAA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AAC8B,OAAO;EAC3BzB,KAAK,EAAE,SAAS;EAChBC,OAAO,EAAEP,gBAAgB,CAAC4B,OAAO;EACjCC,OAAO,EAAE,EAAE;EACXnB,OAAO,EAAE,CAAC,CAAC;EACXC,MAAM,EAAE,CAAC;AACX,CAAC,EACD;EACER,IAAI,EAAE,MAAM;EACZC,IAAI,EAAEH,aAAa,CAAC+B,IAAI;EACxB1B,KAAK,EAAE,MAAM;EACbC,OAAO,EAAEP,gBAAgB,CAAC4B,OAAO;EACjClB,OAAO,EAAE,CAAC,CAAC;EACXC,MAAM,EAAE,CAAC,CAAC;EACVQ,IAAI,EAAE;AACR,CAAC,CACF","ignoreList":[]}
|
@@ -3,8 +3,11 @@ import { ComponentType } from "./enums.js";
|
|
3
3
|
* Filter known components with support for conditions
|
4
4
|
*/
|
5
5
|
export function hasConditionSupport(component) {
|
6
|
+
return isConditionalType(component?.type);
|
7
|
+
}
|
8
|
+
export function isConditionalType(type) {
|
6
9
|
const allowedTypes = [ComponentType.CheckboxesField, ComponentType.DatePartsField, ComponentType.EmailAddressField, ComponentType.MultilineTextField, ComponentType.NumberField, ComponentType.TextField, ComponentType.TimeField, ComponentType.YesNoField];
|
7
|
-
return !!
|
10
|
+
return !!type && allowedTypes.includes(type);
|
8
11
|
}
|
9
12
|
|
10
13
|
/**
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"helpers.js","names":["ComponentType","hasConditionSupport","component","allowedTypes","CheckboxesField","DatePartsField","EmailAddressField","MultilineTextField","NumberField","TextField","TimeField","YesNoField","
|
1
|
+
{"version":3,"file":"helpers.js","names":["ComponentType","hasConditionSupport","component","isConditionalType","type","allowedTypes","CheckboxesField","DatePartsField","EmailAddressField","MultilineTextField","NumberField","TextField","TimeField","YesNoField","includes","hasContentField","Details","Html","InsetText","List","hasEditor","TelephoneNumberField","AutocompleteField","SelectField","RadiosField","hasInputField","MonthYearField","UkAddressField","hasListField","hasSelectionFields","hasTitle","deniedTypes"],"sources":["../../../src/components/helpers.ts"],"sourcesContent":["import { ComponentType } from '~/src/components/enums.js'\nimport {\n type InputFieldsComponentsDef,\n type ComponentDef,\n type ConditionalComponentsDef,\n type ConditionalComponentType,\n type ContentComponentsDef,\n type HtmlComponent,\n type InsetTextComponent,\n type ListComponentsDef,\n type SelectionComponentsDef,\n type EditorComponentsDef\n} from '~/src/components/types.js'\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.CheckboxesField,\n ComponentType.DatePartsField,\n ComponentType.EmailAddressField,\n ComponentType.MultilineTextField,\n ComponentType.NumberField,\n ComponentType.TextField,\n ComponentType.TimeField,\n ComponentType.YesNoField\n ]\n\n return !!type && allowedTypes.includes(type)\n}\n\n/**\n * Filter known components with content fields\n */\nexport function hasContentField(\n component?: Partial<ComponentDef>\n): component is ContentComponentsDef {\n const allowedTypes = [\n ComponentType.Details,\n ComponentType.Html,\n ComponentType.InsetText,\n ComponentType.List\n ]\n\n return !!component?.type && allowedTypes.includes(component.type)\n}\n\n/**\n * Filter known components with text editor\n */\nexport function hasEditor(\n component?: Partial<ComponentDef>\n): component is EditorComponentsDef {\n const allowedTypes = [\n ComponentType.TextField,\n ComponentType.EmailAddressField,\n ComponentType.TelephoneNumberField,\n ComponentType.MultilineTextField,\n ComponentType.NumberField,\n ComponentType.AutocompleteField,\n ComponentType.SelectField,\n ComponentType.RadiosField,\n ComponentType.CheckboxesField,\n ComponentType.List,\n ComponentType.Details,\n ComponentType.Html,\n ComponentType.InsetText,\n ComponentType.DatePartsField\n ]\n\n return !!component?.type && allowedTypes.includes(component.type)\n}\n\n/**\n * Filter known components with input fields\n */\nexport function hasInputField(\n component?: Partial<ComponentDef>\n): component is InputFieldsComponentsDef {\n const allowedTypes = [\n ComponentType.TextField,\n ComponentType.EmailAddressField,\n ComponentType.NumberField,\n ComponentType.MultilineTextField,\n ComponentType.TelephoneNumberField,\n ComponentType.YesNoField,\n ComponentType.MonthYearField,\n ComponentType.TimeField,\n ComponentType.UkAddressField\n ]\n\n return !!component?.type && allowedTypes.includes(component.type)\n}\n\n/**\n * Filter known components with lists\n */\nexport function hasListField(\n component?: Partial<ComponentDef>\n): component is ListComponentsDef {\n const allowedTypes = [\n ComponentType.AutocompleteField,\n ComponentType.List,\n ComponentType.RadiosField,\n ComponentType.SelectField,\n ComponentType.CheckboxesField\n ]\n\n return !!component?.type && allowedTypes.includes(component.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.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,SAASA,aAAa;AActB;AACA;AACA;AACA,OAAO,SAASC,mBAAmBA,CACjCC,SAAiC,EACM;EACvC,OAAOC,iBAAiB,CAACD,SAAS,EAAEE,IAAI,CAAC;AAC3C;AAEA,OAAO,SAASD,iBAAiBA,CAC/BC,IAAoB,EACc;EAClC,MAAMC,YAAY,GAAG,CACnBL,aAAa,CAACM,eAAe,EAC7BN,aAAa,CAACO,cAAc,EAC5BP,aAAa,CAACQ,iBAAiB,EAC/BR,aAAa,CAACS,kBAAkB,EAChCT,aAAa,CAACU,WAAW,EACzBV,aAAa,CAACW,SAAS,EACvBX,aAAa,CAACY,SAAS,EACvBZ,aAAa,CAACa,UAAU,CACzB;EAED,OAAO,CAAC,CAACT,IAAI,IAAIC,YAAY,CAACS,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SAAS,EACvBZ,aAAa,CAAC2B,cAAc,CAC7B;EAED,OAAO,CAAC,CAACzB,SAAS,EAAEE,IAAI,IAAIC,YAAY,CAACS,QAAQ,CAACZ,SAAS,CAACE,IAAI,CAAC;AACnE;;AAEA;AACA;AACA;AACA,OAAO,SAASwB,YAAYA,CAC1B1B,SAAiC,EACD;EAChC,MAAMG,YAAY,GAAG,CACnBL,aAAa,CAACsB,iBAAiB,EAC/BtB,aAAa,CAACmB,IAAI,EAClBnB,aAAa,CAACwB,WAAW,EACzBxB,aAAa,CAACuB,WAAW,EACzBvB,aAAa,CAACM,eAAe,CAC9B;EAED,OAAO,CAAC,CAACJ,SAAS,EAAEE,IAAI,IAAIC,YAAY,CAACS,QAAQ,CAACZ,SAAS,CAACE,IAAI,CAAC;AACnE;;AAEA;AACA;AACA;AACA,OAAO,SAASyB,kBAAkBA,CAChC3B,SAAiC,EACI;EACrC,MAAMG,YAAY,GAAG,CACnBL,aAAa,CAACM,eAAe,EAC7BN,aAAa,CAACwB,WAAW,EACzBxB,aAAa,CAACuB,WAAW,EACzBvB,aAAa,CAACa,UAAU,CACzB;EAED,OAAO,CAAC,CAACX,SAAS,EAAEE,IAAI,IAAIC,YAAY,CAACS,QAAQ,CAACZ,SAAS,CAACE,IAAI,CAAC;AACnE;;AAEA;AACA;AACA;AACA,OAAO,SAAS0B,QAAQA,CACtB5B,SAAiC,EACuC;EACxE,MAAM6B,WAAW,GAAG,CAAC/B,aAAa,CAACkB,SAAS,EAAElB,aAAa,CAACiB,IAAI,CAAC;EACjE,OAAO,CAAC,CAACf,SAAS,EAAEE,IAAI,IAAI,CAAC2B,WAAW,CAACjB,QAAQ,CAACZ,SAAS,CAACE,IAAI,CAAC;AACnE","ignoreList":[]}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
export { ComponentTypes
|
1
|
+
export { ComponentTypes } from "./component-types.js";
|
2
2
|
export { hasConditionSupport, hasContentField, hasEditor, hasInputField, hasListField, hasSelectionFields, hasTitle } from "./helpers.js";
|
3
3
|
export { ComponentType, ComponentSubType } from "./enums.js";
|
4
4
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","names":["ComponentTypes","
|
1
|
+
{"version":3,"file":"index.js","names":["ComponentTypes","hasConditionSupport","hasContentField","hasEditor","hasInputField","hasListField","hasSelectionFields","hasTitle","ComponentType","ComponentSubType"],"sources":["../../../src/components/index.ts"],"sourcesContent":["export { ComponentTypes } from '~/src/components/component-types.js'\nexport {\n hasConditionSupport,\n hasContentField,\n hasEditor,\n hasInputField,\n hasListField,\n hasSelectionFields,\n hasTitle\n} from '~/src/components/helpers.js'\n\nexport { ComponentType, ComponentSubType } from '~/src/components/enums.js'\n"],"mappings":"AAAA,SAASA,cAAc;AACvB,SACEC,mBAAmB,EACnBC,eAAe,EACfC,SAAS,EACTC,aAAa,EACbC,YAAY,EACZC,kBAAkB,EAClBC,QAAQ;AAGV,SAASC,aAAa,EAAEC,gBAAgB","ignoreList":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"types.js","names":[],"sources":["../../../src/components/types.ts"],"sourcesContent":["import {\n type ComponentSubType,\n type ComponentType\n} from '~/src/components/enums.js'\n\nexport type ConditionalComponentType
|
1
|
+
{"version":3,"file":"types.js","names":[],"sources":["../../../src/components/types.ts"],"sourcesContent":["import {\n type ComponentSubType,\n type ComponentType\n} from '~/src/components/enums.js'\n\nexport type ConditionalComponentType =\n | ComponentType.CheckboxesField\n | ComponentType.DatePartsField\n | ComponentType.EmailAddressField\n | ComponentType.MultilineTextField\n | ComponentType.NumberField\n | ComponentType.TextField\n | ComponentType.TimeField\n | ComponentType.YesNoField\n\nexport interface ContentOptions {\n condition?: string\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 subType?: ComponentSubType.Field\n name: string\n title: string\n hint?: string\n options: {\n hideTitle?: boolean\n required?: boolean\n optionalText?: boolean\n classes?: string\n allow?: string\n autocomplete?: string\n exposeToContext?: boolean\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 subType?: ComponentSubType.Field\n name: string\n title: string\n hint: string\n options: {\n prefix?: string\n suffix?: string\n exposeToContext?: boolean\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 subType?: ComponentSubType.Content | ComponentSubType.ListField\n name: string\n title: string\n options: {\n type?: string\n hideTitle?: boolean\n required?: boolean\n optionalText?: boolean\n classes?: string\n bold?: boolean\n exposeToContext?: boolean\n allowPrePopulation?: boolean\n }\n list: string\n schema: object\n}\n\ninterface ContentFieldBase {\n type: ComponentType.Details | ComponentType.Html | ComponentType.InsetText\n subType?: ComponentSubType.Content\n name: string\n title: string\n content: string\n options: ContentOptions\n schema?: object\n}\n\ninterface DateFieldBase {\n type:\n | ComponentType.DatePartsField\n | ComponentType.MonthYearField\n | ComponentType.TimeField\n subType?: ComponentSubType.Field\n name: string\n title: string\n hint: string\n options: {\n hideTitle?: boolean\n required?: boolean\n optionalText?: boolean\n maxDaysInFuture?: number\n maxDaysInPast?: number\n exposeToContext?: boolean\n }\n schema: object\n}\n\n// Text Fields\nexport interface TextFieldComponent extends TextFieldBase {\n type: ComponentType.TextField\n options: TextFieldBase['options'] & {\n customValidationMessage?: string\n }\n}\n\nexport interface EmailAddressFieldComponent extends TextFieldBase {\n type: ComponentType.EmailAddressField\n}\n\nexport interface NumberFieldComponent extends NumberFieldBase {\n type: ComponentType.NumberField\n}\n\nexport interface TelephoneNumberFieldComponent extends TextFieldBase {\n type: ComponentType.TelephoneNumberField\n options: TextFieldBase['options'] & {\n customValidationMessage?: string\n }\n}\n\nexport interface YesNoFieldComponent extends TextFieldBase {\n type: ComponentType.YesNoField\n}\n\nexport interface MultilineTextFieldComponent extends TextFieldBase {\n type: ComponentType.MultilineTextField\n options: TextFieldBase['options'] & {\n customValidationMessage?: string\n rows?: number\n maxWords?: number\n }\n schema: {\n max?: number\n min?: number\n }\n}\n\nexport interface UkAddressFieldComponent extends TextFieldBase {\n type: ComponentType.UkAddressField\n}\n\n// Date Fields\nexport interface DatePartsFieldFieldComponent extends DateFieldBase {\n type: ComponentType.DatePartsField\n}\n\nexport interface MonthYearFieldComponent extends DateFieldBase {\n type: ComponentType.MonthYearField\n}\n\nexport interface TimeFieldComponent extends DateFieldBase {\n type: ComponentType.TimeField\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 subType?: ComponentSubType.ListField\n}\n\nexport interface CheckboxesFieldComponent extends ListFieldBase {\n type: ComponentType.CheckboxesField\n subType?: ComponentSubType.ListField\n}\n\nexport interface RadiosFieldComponent extends ListFieldBase {\n type: ComponentType.RadiosField\n subType?: ComponentSubType.ListField\n}\n\nexport interface SelectFieldComponent extends ListFieldBase {\n type: ComponentType.SelectField\n subType?: ComponentSubType.ListField\n options: ListFieldBase['options'] & { autocomplete?: string }\n}\n\nexport type ComponentDef =\n | InsetTextComponent\n | AutocompleteFieldComponent\n | CheckboxesFieldComponent\n | DatePartsFieldFieldComponent\n | MonthYearFieldComponent\n | DetailsComponent\n | EmailAddressFieldComponent\n | HtmlComponent\n | ListComponent\n | MultilineTextFieldComponent\n | NumberFieldComponent\n | RadiosFieldComponent\n | SelectFieldComponent\n | TelephoneNumberFieldComponent\n | TextFieldComponent\n | TimeFieldComponent\n | UkAddressFieldComponent\n | YesNoFieldComponent\n\n// Components that render inputs\nexport type InputFieldsComponentsDef =\n | TextFieldComponent\n | EmailAddressFieldComponent\n | NumberFieldComponent\n | MultilineTextFieldComponent\n | TelephoneNumberFieldComponent\n | YesNoFieldComponent\n | MonthYearFieldComponent\n | TimeFieldComponent\n | UkAddressFieldComponent\n\n// Components that render content\nexport type ContentComponentsDef =\n | DetailsComponent\n | HtmlComponent\n | InsetTextComponent\n | ListComponent\n\n// Components with editors\nexport type EditorComponentsDef =\n | TextFieldComponent\n | EmailAddressFieldComponent\n | TelephoneNumberFieldComponent\n | MultilineTextFieldComponent\n | NumberFieldComponent\n | AutocompleteFieldComponent\n | SelectFieldComponent\n | RadiosFieldComponent\n | CheckboxesFieldComponent\n | ListComponent\n | DetailsComponent\n | HtmlComponent\n | InsetTextComponent\n | DatePartsFieldFieldComponent\n\n// Components that render lists\nexport type ListComponentsDef =\n | ListComponent\n | AutocompleteFieldComponent\n | CheckboxesFieldComponent\n | RadiosFieldComponent\n | SelectFieldComponent\n\n// Components that have selection fields\nexport type SelectionComponentsDef =\n | CheckboxesFieldComponent\n | RadiosFieldComponent\n | SelectFieldComponent\n | YesNoFieldComponent\n\n// Components that have custom condition operators\nexport type ConditionalComponentsDef =\n | CheckboxesFieldComponent\n | DatePartsFieldFieldComponent\n | EmailAddressFieldComponent\n | MultilineTextFieldComponent\n | NumberFieldComponent\n | TextFieldComponent\n | TimeFieldComponent\n | YesNoFieldComponent\n"],"mappings":"","ignoreList":[]}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import {
|
1
|
+
import { isConditionalType } from "../components/helpers.js";
|
2
2
|
export class ConditionField {
|
3
3
|
name;
|
4
4
|
type;
|
@@ -7,8 +7,8 @@ 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 (!
|
11
|
-
throw new Error("ConditionField param 'type' must
|
10
|
+
if (!isConditionalType(type)) {
|
11
|
+
throw new Error("ConditionField param 'type' must support conditions");
|
12
12
|
}
|
13
13
|
if (!display || typeof display !== 'string') {
|
14
14
|
throw new Error("ConditionField param 'display' must be a string");
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"condition-field.js","names":["
|
1
|
+
{"version":3,"file":"condition-field.js","names":["isConditionalType","ConditionField","name","type","display","constructor","Error","from","obj"],"sources":["../../../src/conditions/condition-field.ts"],"sourcesContent":["import { type ComponentType } from '~/src/components/enums.js'\nimport { isConditionalType } from '~/src/components/helpers.js'\n\nexport class ConditionField {\n name\n type\n display\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 static from(obj: { name: string; type: ComponentType; display: string }) {\n return new ConditionField(obj.name, obj.type, obj.display)\n }\n}\n"],"mappings":"AACA,SAASA,iBAAiB;AAE1B,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,CAACN,iBAAiB,CAACG,IAAI,CAAC,EAAE;MAC5B,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;EAEA,OAAOG,IAAIA,CAACC,GAA2D,EAAE;IACvE,OAAO,IAAIP,cAAc,CAACO,GAAG,CAACN,IAAI,EAAEM,GAAG,CAACL,IAAI,EAAEK,GAAG,CAACJ,OAAO,CAAC;EAC5D;AACF","ignoreList":[]}
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import { isConditionalType } from "../components/helpers.js";
|
1
2
|
import { ComponentType } from "../components/enums.js";
|
2
3
|
import { timeUnits, dateUnits, dateTimeUnits, ConditionValue, RelativeTimeValue } from "./condition-values.js";
|
3
4
|
import { DateDirections, Operator, OperatorName } from "./enums.js";
|
@@ -50,22 +51,30 @@ export const customOperators = {
|
|
50
51
|
[ComponentType.YesNoField]: defaultOperators
|
51
52
|
};
|
52
53
|
export function getOperatorNames(fieldType) {
|
53
|
-
|
54
|
+
const conditionals = getConditionals(fieldType);
|
55
|
+
if (!conditionals) {
|
56
|
+
return [];
|
57
|
+
}
|
58
|
+
return Object.keys(conditionals).sort();
|
54
59
|
}
|
55
60
|
export function getExpression(fieldType, fieldName, operator, value) {
|
56
|
-
|
61
|
+
const conditionals = getConditionals(fieldType);
|
62
|
+
if (!conditionals) {
|
63
|
+
return;
|
64
|
+
}
|
65
|
+
return conditionals[operator]?.expression({
|
57
66
|
type: fieldType,
|
58
67
|
name: fieldName
|
59
68
|
}, value);
|
60
69
|
}
|
61
70
|
export function getOperatorConfig(fieldType, operator) {
|
62
|
-
return getConditionals(fieldType)[operator];
|
71
|
+
return getConditionals(fieldType)?.[operator];
|
63
72
|
}
|
64
73
|
function getConditionals(fieldType) {
|
65
|
-
if (fieldType
|
66
|
-
return
|
74
|
+
if (!isConditionalType(fieldType)) {
|
75
|
+
return;
|
67
76
|
}
|
68
|
-
return defaultOperators;
|
77
|
+
return fieldType in customOperators ? customOperators[fieldType] : defaultOperators;
|
69
78
|
}
|
70
79
|
function inline(operator) {
|
71
80
|
return {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"condition-operators.js","names":["ComponentType","timeUnits","dateUnits","dateTimeUnits","ConditionValue","RelativeTimeValue","DateDirections","Operator","OperatorName","defaultOperators","Is","inline","IsNot","withDefaults","param","Object","assign","textFieldOperators","IsLongerThan","lengthIs","IsMoreThan","IsShorterThan","IsLessThan","HasLength","absoluteDateTimeOperators","absoluteDateTime","IsBefore","IsAfter","relativeTimeOperators","units","IsAtLeast","relativeTime","IsAtMost","customOperators","CheckboxesField","Contains","reverseInline","DoesNotContain","not","NumberField","TimeField","DatePartsField","TextField","MultilineTextField","EmailAddressField","YesNoField","getOperatorNames","fieldType","keys","getConditionals","sort","getExpression","fieldName","operator","value","expression","type","name","getOperatorConfig","field","formatValue","operatorDefinition","toExpression","absoluteDateOrTimeOperatorNames","relativeDateOrTimeOperatorNames","Error","pastOperator","futureOperator","isPast","direction","PAST"],"sources":["../../../src/conditions/condition-operators.ts"],"sourcesContent":["import { ComponentType } from '~/src/components/enums.js'\nimport {\n type ConditionalComponentType,\n type ComponentDef\n} from '~/src/components/types.js'\nimport {\n timeUnits,\n dateUnits,\n dateTimeUnits,\n ConditionValue,\n RelativeTimeValue\n} from '~/src/conditions/condition-values.js'\nimport {\n DateDirections,\n Operator,\n OperatorName\n} from '~/src/conditions/enums.js'\nimport {\n type Conditionals,\n type DateUnits,\n type OperatorDefinition,\n type TimeUnits\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>(param: T) {\n return Object.assign({}, param, defaultOperators)\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 absoluteDateTimeOperators = {\n [OperatorName.Is]: absoluteDateTime(Operator.Is),\n [OperatorName.IsNot]: absoluteDateTime(Operator.IsNot),\n [OperatorName.IsBefore]: absoluteDateTime(Operator.IsLessThan),\n [OperatorName.IsAfter]: absoluteDateTime(Operator.IsMoreThan)\n}\n\nconst relativeTimeOperators = (units: DateUnits | TimeUnits) => ({\n [OperatorName.IsAtLeast]: relativeTime(\n Operator.IsAtMost,\n Operator.IsAtLeast,\n units\n ),\n [OperatorName.IsAtMost]: relativeTime(\n Operator.IsAtLeast,\n Operator.IsAtMost,\n units\n ),\n [OperatorName.IsLessThan]: relativeTime(\n Operator.IsMoreThan,\n Operator.IsLessThan,\n units\n ),\n [OperatorName.IsMoreThan]: relativeTime(\n Operator.IsLessThan,\n Operator.IsMoreThan,\n units\n )\n})\n\nexport const customOperators = {\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.TimeField]: {\n ...absoluteDateTimeOperators,\n ...relativeTimeOperators(timeUnits)\n },\n [ComponentType.DatePartsField]: {\n ...absoluteDateTimeOperators,\n ...relativeTimeOperators(dateUnits)\n },\n [ComponentType.TextField]: withDefaults(textFieldOperators),\n [ComponentType.MultilineTextField]: withDefaults(textFieldOperators),\n [ComponentType.EmailAddressField]: withDefaults(textFieldOperators),\n [ComponentType.YesNoField]: defaultOperators\n} as const satisfies Record<ConditionalComponentType, Partial<Conditionals>>\n\nexport function getOperatorNames(fieldType: ConditionalComponentType) {\n return Object.keys(getConditionals(fieldType)).sort()\n}\n\nexport function getExpression(\n fieldType: ConditionalComponentType,\n fieldName: string,\n operator: OperatorName,\n value: ConditionValue | RelativeTimeValue\n) {\n return getConditionals(fieldType)[operator]?.expression(\n { type: fieldType, name: fieldName },\n value\n )\n}\n\nexport function getOperatorConfig(\n fieldType: ConditionalComponentType,\n operator: OperatorName\n) {\n return getConditionals(fieldType)[operator]\n}\n\nfunction getConditionals(\n fieldType: ConditionalComponentType\n): Partial<Conditionals> {\n if (fieldType in customOperators) {\n return customOperators[fieldType]\n }\n\n return 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: ConditionValue | RelativeTimeValue\n) {\n if (\n 'value' in value &&\n (field.type === ComponentType.YesNoField ||\n field.type === ComponentType.NumberField)\n ) {\n return value.value\n }\n\n return `'${value.toExpression()}'`\n}\n\nexport const absoluteDateOrTimeOperatorNames = Object.keys(\n absoluteDateTimeOperators\n)\n\nexport const relativeDateOrTimeOperatorNames = Object.keys(\n relativeTimeOperators(dateTimeUnits)\n)\n\nfunction absoluteDateTime(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 relativeTime(\n pastOperator: Operator,\n futureOperator: Operator,\n units: DateUnits | TimeUnits\n): OperatorDefinition {\n return {\n units,\n expression(field, value) {\n if (!(value instanceof RelativeTimeValue)) {\n throw new Error(\n \"Expression param 'value' must be RelativeTimeValue instance\"\n )\n }\n\n const isPast = value.direction === DateDirections.PAST\n return `${field.name} ${isPast ? pastOperator : futureOperator} ${value.toExpression()}`\n }\n }\n}\n"],"mappings":"AAAA,SAASA,aAAa;AAKtB,SACEC,SAAS,EACTC,SAAS,EACTC,aAAa,EACbC,cAAc,EACdC,iBAAiB;AAEnB,SACEC,cAAc,EACdC,QAAQ,EACRC,YAAY;AASd,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,KAAQ,EAAE;EACjC,OAAOC,MAAM,CAACC,MAAM,CAAC,CAAC,CAAC,EAAEF,KAAK,EAAEL,gBAAgB,CAAC;AACnD;AAEA,MAAMQ,kBAAkB,GAAG;EACzB,CAACT,YAAY,CAACU,YAAY,GAAGC,QAAQ,CAACZ,QAAQ,CAACa,UAAU,CAAC;EAC1D,CAACZ,YAAY,CAACa,aAAa,GAAGF,QAAQ,CAACZ,QAAQ,CAACe,UAAU,CAAC;EAC3D,CAACd,YAAY,CAACe,SAAS,GAAGJ,QAAQ,CAACZ,QAAQ,CAACG,EAAE;AAChD,CAAC;AAED,MAAMc,yBAAyB,GAAG;EAChC,CAAChB,YAAY,CAACE,EAAE,GAAGe,gBAAgB,CAAClB,QAAQ,CAACG,EAAE,CAAC;EAChD,CAACF,YAAY,CAACI,KAAK,GAAGa,gBAAgB,CAAClB,QAAQ,CAACK,KAAK,CAAC;EACtD,CAACJ,YAAY,CAACkB,QAAQ,GAAGD,gBAAgB,CAAClB,QAAQ,CAACe,UAAU,CAAC;EAC9D,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D,MAAM,CAACiC,IAAI,CACxDpB,qBAAqB,CAACzB,aAAa,CACrC,CAAC;AAED,SAASsB,gBAAgBA,CAAC4B,QAAkB,EAAsB;EAChE,OAAO;IACLE,UAAUA,CAACI,KAAK,EAAEL,KAAK,EAAE;MACvB,IAAI,EAAEA,KAAK,YAAYlD,cAAc,CAAC,EAAE;QACtC,MAAM,IAAI6D,KAAK,CACb,0DACF,CAAC;MACH;MAEA,OAAO,GAAGN,KAAK,CAACF,IAAI,IAAIJ,QAAQ,KAAKO,WAAW,CAACD,KAAK,EAAEL,KAAK,CAAC,GAAG;IACnE;EACF,CAAC;AACH;AAEA,SAASvB,YAAYA,CACnBmC,YAAsB,EACtBC,cAAwB,EACxBtC,KAA4B,EACR;EACpB,OAAO;IACLA,KAAK;IACL0B,UAAUA,CAACI,KAAK,EAAEL,KAAK,EAAE;MACvB,IAAI,EAAEA,KAAK,YAAYjD,iBAAiB,CAAC,EAAE;QACzC,MAAM,IAAI4D,KAAK,CACb,6DACF,CAAC;MACH;MAEA,MAAMG,MAAM,GAAGd,KAAK,CAACe,SAAS,KAAK/D,cAAc,CAACgE,IAAI;MACtD,OAAO,GAAGX,KAAK,CAACF,IAAI,IAAIW,MAAM,GAAGF,YAAY,GAAGC,cAAc,IAAIb,KAAK,CAACQ,YAAY,CAAC,CAAC,EAAE;IAC1F;EACF,CAAC;AACH","ignoreList":[]}
|
1
|
+
{"version":3,"file":"condition-operators.js","names":["isConditionalType","ComponentType","timeUnits","dateUnits","dateTimeUnits","ConditionValue","RelativeTimeValue","DateDirections","Operator","OperatorName","defaultOperators","Is","inline","IsNot","withDefaults","param","Object","assign","textFieldOperators","IsLongerThan","lengthIs","IsMoreThan","IsShorterThan","IsLessThan","HasLength","absoluteDateTimeOperators","absoluteDateTime","IsBefore","IsAfter","relativeTimeOperators","units","IsAtLeast","relativeTime","IsAtMost","customOperators","CheckboxesField","Contains","reverseInline","DoesNotContain","not","NumberField","TimeField","DatePartsField","TextField","MultilineTextField","EmailAddressField","YesNoField","getOperatorNames","fieldType","conditionals","getConditionals","keys","sort","getExpression","fieldName","operator","value","expression","type","name","getOperatorConfig","field","formatValue","operatorDefinition","toExpression","absoluteDateOrTimeOperatorNames","relativeDateOrTimeOperatorNames","Error","pastOperator","futureOperator","isPast","direction","PAST"],"sources":["../../../src/conditions/condition-operators.ts"],"sourcesContent":["import { isConditionalType } from '../components/helpers.js'\n\nimport { ComponentType } from '~/src/components/enums.js'\nimport { type ComponentDef } from '~/src/components/types.js'\nimport {\n timeUnits,\n dateUnits,\n dateTimeUnits,\n ConditionValue,\n RelativeTimeValue\n} from '~/src/conditions/condition-values.js'\nimport {\n DateDirections,\n Operator,\n OperatorName\n} from '~/src/conditions/enums.js'\nimport {\n type Conditionals,\n type DateUnits,\n type OperatorDefinition,\n type TimeUnits\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>(param: T) {\n return Object.assign({}, param, defaultOperators)\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 absoluteDateTimeOperators = {\n [OperatorName.Is]: absoluteDateTime(Operator.Is),\n [OperatorName.IsNot]: absoluteDateTime(Operator.IsNot),\n [OperatorName.IsBefore]: absoluteDateTime(Operator.IsLessThan),\n [OperatorName.IsAfter]: absoluteDateTime(Operator.IsMoreThan)\n}\n\nconst relativeTimeOperators = (units: DateUnits | TimeUnits) => ({\n [OperatorName.IsAtLeast]: relativeTime(\n Operator.IsAtMost,\n Operator.IsAtLeast,\n units\n ),\n [OperatorName.IsAtMost]: relativeTime(\n Operator.IsAtLeast,\n Operator.IsAtMost,\n units\n ),\n [OperatorName.IsLessThan]: relativeTime(\n Operator.IsMoreThan,\n Operator.IsLessThan,\n units\n ),\n [OperatorName.IsMoreThan]: relativeTime(\n Operator.IsLessThan,\n Operator.IsMoreThan,\n units\n )\n})\n\nexport const customOperators = {\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.TimeField]: {\n ...absoluteDateTimeOperators,\n ...relativeTimeOperators(timeUnits)\n },\n [ComponentType.DatePartsField]: {\n ...absoluteDateTimeOperators,\n ...relativeTimeOperators(dateUnits)\n },\n [ComponentType.TextField]: withDefaults(textFieldOperators),\n [ComponentType.MultilineTextField]: withDefaults(textFieldOperators),\n [ComponentType.EmailAddressField]: withDefaults(textFieldOperators),\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).sort()\n}\n\nexport function getExpression(\n fieldType: ComponentType,\n fieldName: string,\n operator: OperatorName,\n value: ConditionValue | RelativeTimeValue\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 (!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: ConditionValue | RelativeTimeValue\n) {\n if (\n 'value' in value &&\n (field.type === ComponentType.YesNoField ||\n field.type === ComponentType.NumberField)\n ) {\n return value.value\n }\n\n return `'${value.toExpression()}'`\n}\n\nexport const absoluteDateOrTimeOperatorNames = Object.keys(\n absoluteDateTimeOperators\n)\n\nexport const relativeDateOrTimeOperatorNames = Object.keys(\n relativeTimeOperators(dateTimeUnits)\n)\n\nfunction absoluteDateTime(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 relativeTime(\n pastOperator: Operator,\n futureOperator: Operator,\n units: DateUnits | TimeUnits\n): OperatorDefinition {\n return {\n units,\n expression(field, value) {\n if (!(value instanceof RelativeTimeValue)) {\n throw new Error(\n \"Expression param 'value' must be RelativeTimeValue instance\"\n )\n }\n\n const isPast = value.direction === DateDirections.PAST\n return `${field.name} ${isPast ? pastOperator : futureOperator} ${value.toExpression()}`\n }\n }\n}\n"],"mappings":"AAAA,SAASA,iBAAiB;AAE1B,SAASC,aAAa;AAEtB,SACEC,SAAS,EACTC,SAAS,EACTC,aAAa,EACbC,cAAc,EACdC,iBAAiB;AAEnB,SACEC,cAAc,EACdC,QAAQ,EACRC,YAAY;AASd,MAAMC,gBAAgB,GAAG;EACv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CAAC,EAAE;QACtC,MAAM,IAAI8D,KAAK,CACb,0DACF,CAAC;MACH;MAEA,OAAO,GAAGN,KAAK,CAACF,IAAI,IAAIJ,QAAQ,KAAKO,WAAW,CAACD,KAAK,EAAEL,KAAK,CAAC,GAAG;IACnE;EACF,CAAC;AACH;AAEA,SAASxB,YAAYA,CACnBoC,YAAsB,EACtBC,cAAwB,EACxBvC,KAA4B,EACR;EACpB,OAAO;IACLA,KAAK;IACL2B,UAAUA,CAACI,KAAK,EAAEL,KAAK,EAAE;MACvB,IAAI,EAAEA,KAAK,YAAYlD,iBAAiB,CAAC,EAAE;QACzC,MAAM,IAAI6D,KAAK,CACb,6DACF,CAAC;MACH;MAEA,MAAMG,MAAM,GAAGd,KAAK,CAACe,SAAS,KAAKhE,cAAc,CAACiE,IAAI;MACtD,OAAO,GAAGX,KAAK,CAACF,IAAI,IAAIW,MAAM,GAAGF,YAAY,GAAGC,cAAc,IAAIb,KAAK,CAACQ,YAAY,CAAC,CAAC,EAAE;IAC1F;EACF,CAAC;AACH","ignoreList":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"types.js","names":[],"sources":["../../../src/conditions/types.ts"],"sourcesContent":["import { type
|
1
|
+
{"version":3,"file":"types.js","names":[],"sources":["../../../src/conditions/types.ts"],"sourcesContent":["import { type ComponentDef } from '~/src/components/types.js'\nimport { type ConditionGroup } from '~/src/conditions/condition-group.js'\nimport { type ConditionRef } from '~/src/conditions/condition-ref.js'\nimport {\n type ConditionValue,\n type RelativeTimeValue\n} from '~/src/conditions/condition-values.js'\nimport { type Condition } from '~/src/conditions/condition.js'\nimport { type OperatorName } from '~/src/conditions/enums.js'\n\nexport type ConditionsArray = (Condition | ConditionGroup | ConditionRef)[]\n\nexport type DateTimeUnitValues =\n | 'years'\n | 'months'\n | 'days'\n | 'hours'\n | 'minutes'\n | 'seconds'\n\nexport interface DateUnits {\n YEARS: { display: 'year(s)'; value: 'years' }\n MONTHS: { display: 'month(s)'; value: 'months' }\n DAYS: { display: 'day(s)'; value: 'days' }\n}\n\nexport interface TimeUnits {\n HOURS: { display: 'hour(s)'; value: 'hours' }\n MINUTES: { display: 'minute(s)'; value: 'minutes' }\n SECONDS: { display: 'second(s)'; value: 'seconds' }\n}\n\nexport interface OperatorDefinition {\n units?: DateUnits | TimeUnits\n expression: (\n component: Pick<ComponentDef, 'type' | 'name'>,\n conditionValue: ConditionValue | RelativeTimeValue\n ) => string\n}\n\nexport type Conditionals = Record<OperatorName, OperatorDefinition>\n"],"mappings":"","ignoreList":[]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"component-types.d.ts","sourceRoot":"","sources":["../../../src/components/component-types.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"component-types.d.ts","sourceRoot":"","sources":["../../../src/components/component-types.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAE7D,eAAO,MAAM,cAAc,EAAE,YAAY,EAmKxC,CAAA"}
|
@@ -1,8 +1,10 @@
|
|
1
|
-
import {
|
1
|
+
import { ComponentType } from '../components/enums.js';
|
2
|
+
import { type InputFieldsComponentsDef, type ComponentDef, type ConditionalComponentsDef, type ConditionalComponentType, type ContentComponentsDef, type HtmlComponent, type InsetTextComponent, type ListComponentsDef, type SelectionComponentsDef, type EditorComponentsDef } from '../components/types.js';
|
2
3
|
/**
|
3
4
|
* Filter known components with support for conditions
|
4
5
|
*/
|
5
6
|
export declare function hasConditionSupport(component?: Partial<ComponentDef>): component is ConditionalComponentsDef;
|
7
|
+
export declare function isConditionalType(type?: ComponentType): type is ConditionalComponentType;
|
6
8
|
/**
|
7
9
|
* Filter known components with content fields
|
8
10
|
*/
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/components/helpers.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/components/helpers.ts"],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E"}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
export { ComponentTypes
|
1
|
+
export { ComponentTypes } from '../components/component-types.js';
|
2
2
|
export { hasConditionSupport, hasContentField, hasEditor, hasInputField, hasListField, hasSelectionFields, hasTitle } from '../components/helpers.js';
|
3
3
|
export { ComponentType, ComponentSubType } 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,
|
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,mBAAmB,EACnB,eAAe,EACf,SAAS,EACT,aAAa,EACb,YAAY,EACZ,kBAAkB,EAClB,QAAQ,EACT,MAAM,6BAA6B,CAAA;AAEpC,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAA"}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { type ComponentSubType, type ComponentType } from '../components/enums.js';
|
2
|
-
export type ConditionalComponentType =
|
2
|
+
export type ConditionalComponentType = ComponentType.CheckboxesField | ComponentType.DatePartsField | ComponentType.EmailAddressField | ComponentType.MultilineTextField | ComponentType.NumberField | ComponentType.TextField | ComponentType.TimeField | ComponentType.YesNoField;
|
3
3
|
export interface ContentOptions {
|
4
4
|
condition?: string;
|
5
5
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,aAAa,EACnB,MAAM,2BAA2B,CAAA;AAElC,MAAM,MAAM,wBAAwB,
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/types.ts"],"names":[],"mappings":"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,GAC3B,kBAAkB,GAClB,0BAA0B,GAC1B,6BAA6B,GAC7B,2BAA2B,GAC3B,oBAAoB,GACpB,0BAA0B,GAC1B,oBAAoB,GACpB,oBAAoB,GACpB,wBAAwB,GACxB,aAAa,GACb,gBAAgB,GAChB,aAAa,GACb,kBAAkB,GAClB,4BAA4B,CAAA;AAGhC,MAAM,MAAM,iBAAiB,GACzB,aAAa,GACb,0BAA0B,GAC1B,wBAAwB,GACxB,oBAAoB,GACpB,oBAAoB,CAAA;AAGxB,MAAM,MAAM,sBAAsB,GAC9B,wBAAwB,GACxB,oBAAoB,GACpB,oBAAoB,GACpB,mBAAmB,CAAA;AAGvB,MAAM,MAAM,wBAAwB,GAChC,wBAAwB,GACxB,4BAA4B,GAC5B,0BAA0B,GAC1B,2BAA2B,GAC3B,oBAAoB,GACpB,kBAAkB,GAClB,kBAAkB,GAClB,mBAAmB,CAAA"}
|
@@ -1,12 +1,12 @@
|
|
1
|
-
import { type
|
1
|
+
import { type ComponentType } from '../components/enums.js';
|
2
2
|
export declare class ConditionField {
|
3
3
|
name: any;
|
4
4
|
type: any;
|
5
5
|
display: any;
|
6
|
-
constructor(name?: string, type?:
|
6
|
+
constructor(name?: string, type?: ComponentType, display?: string);
|
7
7
|
static from(obj: {
|
8
8
|
name: string;
|
9
|
-
type:
|
9
|
+
type: ComponentType;
|
10
10
|
display: string;
|
11
11
|
}): ConditionField;
|
12
12
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"condition-field.d.ts","sourceRoot":"","sources":["../../../src/conditions/condition-field.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"condition-field.d.ts","sourceRoot":"","sources":["../../../src/conditions/condition-field.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAG9D,qBAAa,cAAc;IACzB,IAAI,MAAA;IACJ,IAAI,MAAA;IACJ,OAAO,MAAA;gBAEK,IAAI,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,aAAa,EAAE,OAAO,CAAC,EAAE,MAAM;IAkBjE,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,aAAa,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE;CAGxE"}
|
@@ -1,13 +1,13 @@
|
|
1
|
-
import {
|
1
|
+
import { ComponentType } from '../components/enums.js';
|
2
2
|
import { ConditionValue, RelativeTimeValue } from '../conditions/condition-values.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
|
-
|
7
|
-
|
8
|
-
|
6
|
+
CheckboxesField: {
|
7
|
+
contains: OperatorDefinition;
|
8
|
+
"does not contain": OperatorDefinition;
|
9
9
|
};
|
10
|
-
|
10
|
+
NumberField: {
|
11
11
|
"is at least": OperatorDefinition;
|
12
12
|
"is at most": OperatorDefinition;
|
13
13
|
"is less than": OperatorDefinition;
|
@@ -16,27 +16,27 @@ export declare const customOperators: {
|
|
16
16
|
is: OperatorDefinition;
|
17
17
|
"is not": OperatorDefinition;
|
18
18
|
};
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
19
|
+
TimeField: {
|
20
|
+
"is at least": OperatorDefinition;
|
21
|
+
"is at most": OperatorDefinition;
|
22
|
+
"is less than": OperatorDefinition;
|
23
|
+
"is more than": OperatorDefinition;
|
24
|
+
is: OperatorDefinition;
|
25
|
+
"is not": OperatorDefinition;
|
26
|
+
"is before": OperatorDefinition;
|
27
|
+
"is after": OperatorDefinition;
|
28
28
|
};
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
29
|
+
DatePartsField: {
|
30
|
+
"is at least": OperatorDefinition;
|
31
|
+
"is at most": OperatorDefinition;
|
32
|
+
"is less than": OperatorDefinition;
|
33
|
+
"is more than": OperatorDefinition;
|
34
|
+
is: OperatorDefinition;
|
35
|
+
"is not": OperatorDefinition;
|
36
|
+
"is before": OperatorDefinition;
|
37
|
+
"is after": OperatorDefinition;
|
38
38
|
};
|
39
|
-
|
39
|
+
TextField: {
|
40
40
|
"is longer than": OperatorDefinition;
|
41
41
|
"is shorter than": OperatorDefinition;
|
42
42
|
"has length": OperatorDefinition;
|
@@ -44,7 +44,7 @@ export declare const customOperators: {
|
|
44
44
|
is: OperatorDefinition;
|
45
45
|
"is not": OperatorDefinition;
|
46
46
|
};
|
47
|
-
|
47
|
+
MultilineTextField: {
|
48
48
|
"is longer than": OperatorDefinition;
|
49
49
|
"is shorter than": OperatorDefinition;
|
50
50
|
"has length": OperatorDefinition;
|
@@ -52,7 +52,7 @@ export declare const customOperators: {
|
|
52
52
|
is: OperatorDefinition;
|
53
53
|
"is not": OperatorDefinition;
|
54
54
|
};
|
55
|
-
|
55
|
+
EmailAddressField: {
|
56
56
|
"is longer than": OperatorDefinition;
|
57
57
|
"is shorter than": OperatorDefinition;
|
58
58
|
"has length": OperatorDefinition;
|
@@ -60,14 +60,14 @@ export declare const customOperators: {
|
|
60
60
|
is: OperatorDefinition;
|
61
61
|
"is not": OperatorDefinition;
|
62
62
|
};
|
63
|
-
|
63
|
+
YesNoField: {
|
64
64
|
is: OperatorDefinition;
|
65
65
|
"is not": OperatorDefinition;
|
66
66
|
};
|
67
67
|
};
|
68
|
-
export declare function getOperatorNames(fieldType:
|
69
|
-
export declare function getExpression(fieldType:
|
70
|
-
export declare function getOperatorConfig(fieldType:
|
68
|
+
export declare function getOperatorNames(fieldType: ComponentType): string[];
|
69
|
+
export declare function getExpression(fieldType: ComponentType, fieldName: string, operator: OperatorName, value: ConditionValue | RelativeTimeValue): string | undefined;
|
70
|
+
export declare function getOperatorConfig(fieldType: ComponentType, operator: OperatorName): OperatorDefinition | undefined;
|
71
71
|
export declare const absoluteDateOrTimeOperatorNames: string[];
|
72
72
|
export declare const relativeDateOrTimeOperatorNames: string[];
|
73
73
|
//# 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,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAEzD,OAAO,EAIL,cAAc,EACd,iBAAiB,EAClB,MAAM,sCAAsC,CAAA;AAC7C,OAAO,EAGL,YAAY,EACb,MAAM,2BAA2B,CAAA;AAClC,OAAO,EAGL,KAAK,kBAAkB,EAExB,MAAM,2BAA2B,CAAA;AA+ClC,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuB3B,CAAA;AAED,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,aAAa,YAOxD;AAED,wBAAgB,aAAa,CAC3B,SAAS,EAAE,aAAa,EACxB,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,YAAY,EACtB,KAAK,EAAE,cAAc,GAAG,iBAAiB,sBAW1C;AAED,wBAAgB,iBAAiB,CAC/B,SAAS,EAAE,aAAa,EACxB,QAAQ,EAAE,YAAY,kCAGvB;AA6DD,eAAO,MAAM,+BAA+B,UAE3C,CAAA;AAED,eAAO,MAAM,+BAA+B,UAE3C,CAAA"}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { type
|
1
|
+
import { type ComponentDef } from '../components/types.js';
|
2
2
|
import { type ConditionGroup } from '../conditions/condition-group.js';
|
3
3
|
import { type ConditionRef } from '../conditions/condition-ref.js';
|
4
4
|
import { type ConditionValue, type RelativeTimeValue } from '../conditions/condition-values.js';
|
@@ -36,7 +36,7 @@ export interface TimeUnits {
|
|
36
36
|
}
|
37
37
|
export interface OperatorDefinition {
|
38
38
|
units?: DateUnits | TimeUnits;
|
39
|
-
expression: (component: Pick<
|
39
|
+
expression: (component: Pick<ComponentDef, 'type' | 'name'>, conditionValue: ConditionValue | RelativeTimeValue) => string;
|
40
40
|
}
|
41
41
|
export type Conditionals = Record<OperatorName, OperatorDefinition>;
|
42
42
|
//# sourceMappingURL=types.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/conditions/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/conditions/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAC7D,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,qCAAqC,CAAA;AACzE,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,mCAAmC,CAAA;AACrE,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACvB,MAAM,sCAAsC,CAAA;AAC7C,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,+BAA+B,CAAA;AAC9D,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAE7D,MAAM,MAAM,eAAe,GAAG,CAAC,SAAS,GAAG,cAAc,GAAG,YAAY,CAAC,EAAE,CAAA;AAE3E,MAAM,MAAM,kBAAkB,GAC1B,OAAO,GACP,QAAQ,GACR,MAAM,GACN,OAAO,GACP,SAAS,GACT,SAAS,CAAA;AAEb,MAAM,WAAW,SAAS;IACxB,KAAK,EAAE;QAAE,OAAO,EAAE,SAAS,CAAC;QAAC,KAAK,EAAE,OAAO,CAAA;KAAE,CAAA;IAC7C,MAAM,EAAE;QAAE,OAAO,EAAE,UAAU,CAAC;QAAC,KAAK,EAAE,QAAQ,CAAA;KAAE,CAAA;IAChD,IAAI,EAAE;QAAE,OAAO,EAAE,QAAQ,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAA;CAC3C;AAED,MAAM,WAAW,SAAS;IACxB,KAAK,EAAE;QAAE,OAAO,EAAE,SAAS,CAAC;QAAC,KAAK,EAAE,OAAO,CAAA;KAAE,CAAA;IAC7C,OAAO,EAAE;QAAE,OAAO,EAAE,WAAW,CAAC;QAAC,KAAK,EAAE,SAAS,CAAA;KAAE,CAAA;IACnD,OAAO,EAAE;QAAE,OAAO,EAAE,WAAW,CAAC;QAAC,KAAK,EAAE,SAAS,CAAA;KAAE,CAAA;CACpD;AAED,MAAM,WAAW,kBAAkB;IACjC,KAAK,CAAC,EAAE,SAAS,GAAG,SAAS,CAAA;IAC7B,UAAU,EAAE,CACV,SAAS,EAAE,IAAI,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAAC,EAC9C,cAAc,EAAE,cAAc,GAAG,iBAAiB,KAC/C,MAAM,CAAA;CACZ;AAED,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,YAAY,EAAE,kBAAkB,CAAC,CAAA"}
|
package/package.json
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
import { ComponentSubType, ComponentType } from '~/src/components/enums.js'
|
2
|
-
import { hasConditionSupport } from '~/src/components/helpers.js'
|
3
2
|
import { type ComponentDef } from '~/src/components/types.js'
|
4
3
|
|
5
4
|
export const ComponentTypes: ComponentDef[] = [
|
@@ -166,6 +165,3 @@ export const ComponentTypes: ComponentDef[] = [
|
|
166
165
|
list: ''
|
167
166
|
}
|
168
167
|
]
|
169
|
-
|
170
|
-
export const ConditionalComponentTypes =
|
171
|
-
ComponentTypes.filter(hasConditionSupport)
|
@@ -3,6 +3,7 @@ import {
|
|
3
3
|
type InputFieldsComponentsDef,
|
4
4
|
type ComponentDef,
|
5
5
|
type ConditionalComponentsDef,
|
6
|
+
type ConditionalComponentType,
|
6
7
|
type ContentComponentsDef,
|
7
8
|
type HtmlComponent,
|
8
9
|
type InsetTextComponent,
|
@@ -17,6 +18,12 @@ import {
|
|
17
18
|
export function hasConditionSupport(
|
18
19
|
component?: Partial<ComponentDef>
|
19
20
|
): component is ConditionalComponentsDef {
|
21
|
+
return isConditionalType(component?.type)
|
22
|
+
}
|
23
|
+
|
24
|
+
export function isConditionalType(
|
25
|
+
type?: ComponentType
|
26
|
+
): type is ConditionalComponentType {
|
20
27
|
const allowedTypes = [
|
21
28
|
ComponentType.CheckboxesField,
|
22
29
|
ComponentType.DatePartsField,
|
@@ -28,7 +35,7 @@ export function hasConditionSupport(
|
|
28
35
|
ComponentType.YesNoField
|
29
36
|
]
|
30
37
|
|
31
|
-
return !!
|
38
|
+
return !!type && allowedTypes.includes(type)
|
32
39
|
}
|
33
40
|
|
34
41
|
/**
|
package/src/components/index.ts
CHANGED
package/src/components/types.ts
CHANGED
@@ -3,17 +3,15 @@ import {
|
|
3
3
|
type ComponentType
|
4
4
|
} from '~/src/components/enums.js'
|
5
5
|
|
6
|
-
export type ConditionalComponentType =
|
7
|
-
ComponentType
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
| typeof ComponentType.YesNoField
|
16
|
-
>
|
6
|
+
export type ConditionalComponentType =
|
7
|
+
| ComponentType.CheckboxesField
|
8
|
+
| ComponentType.DatePartsField
|
9
|
+
| ComponentType.EmailAddressField
|
10
|
+
| ComponentType.MultilineTextField
|
11
|
+
| ComponentType.NumberField
|
12
|
+
| ComponentType.TextField
|
13
|
+
| ComponentType.TimeField
|
14
|
+
| ComponentType.YesNoField
|
17
15
|
|
18
16
|
export interface ContentOptions {
|
19
17
|
condition?: string
|
@@ -1,28 +1,18 @@
|
|
1
|
-
import {
|
2
|
-
import {
|
1
|
+
import { type ComponentType } from '~/src/components/enums.js'
|
2
|
+
import { isConditionalType } from '~/src/components/helpers.js'
|
3
3
|
|
4
4
|
export class ConditionField {
|
5
5
|
name
|
6
6
|
type
|
7
7
|
display
|
8
8
|
|
9
|
-
constructor(
|
10
|
-
name?: string,
|
11
|
-
type?: ConditionalComponentType,
|
12
|
-
display?: string
|
13
|
-
) {
|
9
|
+
constructor(name?: string, type?: ComponentType, display?: string) {
|
14
10
|
if (!name || typeof name !== 'string') {
|
15
11
|
throw new Error("ConditionField param 'name' must be a string")
|
16
12
|
}
|
17
13
|
|
18
|
-
if (
|
19
|
-
|
20
|
-
(componentType) => componentType.type === type
|
21
|
-
)
|
22
|
-
) {
|
23
|
-
throw new Error(
|
24
|
-
"ConditionField param 'type' must be from enum ConditionalComponentTypes"
|
25
|
-
)
|
14
|
+
if (!isConditionalType(type)) {
|
15
|
+
throw new Error("ConditionField param 'type' must support conditions")
|
26
16
|
}
|
27
17
|
|
28
18
|
if (!display || typeof display !== 'string') {
|
@@ -34,11 +24,7 @@ export class ConditionField {
|
|
34
24
|
this.display = display
|
35
25
|
}
|
36
26
|
|
37
|
-
static from(obj: {
|
38
|
-
name: string
|
39
|
-
type: ConditionalComponentType
|
40
|
-
display: string
|
41
|
-
}) {
|
27
|
+
static from(obj: { name: string; type: ComponentType; display: string }) {
|
42
28
|
return new ConditionField(obj.name, obj.type, obj.display)
|
43
29
|
}
|
44
30
|
}
|
@@ -1,8 +1,7 @@
|
|
1
|
+
import { isConditionalType } from '../components/helpers.js'
|
2
|
+
|
1
3
|
import { ComponentType } from '~/src/components/enums.js'
|
2
|
-
import {
|
3
|
-
type ConditionalComponentType,
|
4
|
-
type ComponentDef
|
5
|
-
} from '~/src/components/types.js'
|
4
|
+
import { type ComponentDef } from '~/src/components/types.js'
|
6
5
|
import {
|
7
6
|
timeUnits,
|
8
7
|
dateUnits,
|
@@ -90,39 +89,51 @@ export const customOperators = {
|
|
90
89
|
[ComponentType.MultilineTextField]: withDefaults(textFieldOperators),
|
91
90
|
[ComponentType.EmailAddressField]: withDefaults(textFieldOperators),
|
92
91
|
[ComponentType.YesNoField]: defaultOperators
|
93
|
-
}
|
92
|
+
}
|
94
93
|
|
95
|
-
export function getOperatorNames(fieldType:
|
96
|
-
|
94
|
+
export function getOperatorNames(fieldType: ComponentType) {
|
95
|
+
const conditionals = getConditionals(fieldType)
|
96
|
+
if (!conditionals) {
|
97
|
+
return []
|
98
|
+
}
|
99
|
+
|
100
|
+
return Object.keys(conditionals).sort()
|
97
101
|
}
|
98
102
|
|
99
103
|
export function getExpression(
|
100
|
-
fieldType:
|
104
|
+
fieldType: ComponentType,
|
101
105
|
fieldName: string,
|
102
106
|
operator: OperatorName,
|
103
107
|
value: ConditionValue | RelativeTimeValue
|
104
108
|
) {
|
105
|
-
|
109
|
+
const conditionals = getConditionals(fieldType)
|
110
|
+
if (!conditionals) {
|
111
|
+
return
|
112
|
+
}
|
113
|
+
|
114
|
+
return conditionals[operator]?.expression(
|
106
115
|
{ type: fieldType, name: fieldName },
|
107
116
|
value
|
108
117
|
)
|
109
118
|
}
|
110
119
|
|
111
120
|
export function getOperatorConfig(
|
112
|
-
fieldType:
|
121
|
+
fieldType: ComponentType,
|
113
122
|
operator: OperatorName
|
114
123
|
) {
|
115
|
-
return getConditionals(fieldType)[operator]
|
124
|
+
return getConditionals(fieldType)?.[operator]
|
116
125
|
}
|
117
126
|
|
118
127
|
function getConditionals(
|
119
|
-
fieldType:
|
120
|
-
): Partial<Conditionals> {
|
121
|
-
if (fieldType
|
122
|
-
return
|
128
|
+
fieldType: ComponentType
|
129
|
+
): Partial<Conditionals> | undefined {
|
130
|
+
if (!isConditionalType(fieldType)) {
|
131
|
+
return
|
123
132
|
}
|
124
133
|
|
125
|
-
return
|
134
|
+
return fieldType in customOperators
|
135
|
+
? customOperators[fieldType]
|
136
|
+
: defaultOperators
|
126
137
|
}
|
127
138
|
|
128
139
|
function inline(operator: Operator): OperatorDefinition {
|
package/src/conditions/types.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { type
|
1
|
+
import { type ComponentDef } from '~/src/components/types.js'
|
2
2
|
import { type ConditionGroup } from '~/src/conditions/condition-group.js'
|
3
3
|
import { type ConditionRef } from '~/src/conditions/condition-ref.js'
|
4
4
|
import {
|
@@ -33,7 +33,7 @@ export interface TimeUnits {
|
|
33
33
|
export interface OperatorDefinition {
|
34
34
|
units?: DateUnits | TimeUnits
|
35
35
|
expression: (
|
36
|
-
component: Pick<
|
36
|
+
component: Pick<ComponentDef, 'type' | 'name'>,
|
37
37
|
conditionValue: ConditionValue | RelativeTimeValue
|
38
38
|
) => string
|
39
39
|
}
|