@defra/forms-model 3.0.8 → 3.0.9
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/browser/components/component-types.js.map +1 -1
- package/dist/browser/components/conditional-component-types.js.map +1 -1
- package/dist/browser/components/index.js.map +1 -1
- package/dist/browser/conditions/condition-abstract.js.map +1 -1
- package/dist/browser/conditions/condition-field.js.map +1 -1
- package/dist/browser/conditions/condition-group-def.js.map +1 -1
- package/dist/browser/conditions/condition-group.js.map +1 -1
- package/dist/browser/conditions/condition-model.js.map +1 -1
- package/dist/browser/conditions/condition-operators.js.map +1 -1
- package/dist/browser/conditions/condition-ref.js.map +1 -1
- package/dist/browser/conditions/condition-value-abstract.js.map +1 -1
- package/dist/browser/conditions/condition-values.js.map +1 -1
- package/dist/browser/conditions/condition.js.map +1 -1
- package/dist/browser/conditions/index.js.map +1 -1
- package/dist/browser/conditions/inline-condition-model.js.map +1 -1
- package/dist/browser/conditions/inline-condition-operators.js.map +1 -1
- package/dist/browser/conditions/types.js.map +1 -1
- package/dist/browser/data-model/conditions-wrapper.js.map +1 -1
- package/dist/browser/data-model/index.js +4 -40
- package/dist/browser/data-model/index.js.map +1 -1
- package/dist/browser/data-model/input-wrapper.js.map +1 -1
- package/dist/browser/data-model/types.js.map +1 -1
- package/dist/browser/form/index.js.map +1 -1
- package/dist/browser/index.js +45 -70
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/migration/index.js.map +1 -1
- package/dist/browser/migration/migration.0-2.js.map +1 -1
- package/dist/browser/migration/migration.1-2.js.map +1 -1
- package/dist/browser/migration/whichMigrations.js.map +1 -1
- package/dist/browser/schema/index.js.map +1 -1
- package/dist/module/components/component-types.js.map +1 -1
- package/dist/module/components/conditional-component-types.js.map +1 -1
- package/dist/module/components/index.js.map +1 -1
- package/dist/module/conditions/condition-abstract.js.map +1 -1
- package/dist/module/conditions/condition-field.js.map +1 -1
- package/dist/module/conditions/condition-group-def.js.map +1 -1
- package/dist/module/conditions/condition-group.js.map +1 -1
- package/dist/module/conditions/condition-model.js.map +1 -1
- package/dist/module/conditions/condition-operators.js.map +1 -1
- package/dist/module/conditions/condition-ref.js.map +1 -1
- package/dist/module/conditions/condition-value-abstract.js.map +1 -1
- package/dist/module/conditions/condition-values.js.map +1 -1
- package/dist/module/conditions/condition.js.map +1 -1
- package/dist/module/conditions/index.js.map +1 -1
- package/dist/module/conditions/inline-condition-model.js.map +1 -1
- package/dist/module/conditions/inline-condition-operators.js.map +1 -1
- package/dist/module/conditions/types.js.map +1 -1
- package/dist/module/data-model/conditions-wrapper.js.map +1 -1
- package/dist/module/data-model/index.js +0 -37
- package/dist/module/data-model/index.js.map +1 -1
- package/dist/module/data-model/input-wrapper.js.map +1 -1
- package/dist/module/data-model/types.js.map +1 -1
- package/dist/module/form/index.js.map +1 -1
- package/dist/module/index.js +50 -75
- package/dist/module/index.js.map +1 -1
- package/dist/module/migration/index.js.map +1 -1
- package/dist/module/migration/migration.0-2.js.map +1 -1
- package/dist/module/migration/migration.1-2.js.map +1 -1
- package/dist/module/migration/whichMigrations.js.map +1 -1
- package/dist/module/schema/index.js.map +1 -1
- package/dist/types/components/component-types.d.ts +1 -1
- package/dist/types/components/component-types.d.ts.map +1 -1
- package/dist/types/components/conditional-component-types.d.ts +1 -1
- package/dist/types/components/conditional-component-types.d.ts.map +1 -1
- package/dist/types/components/index.d.ts +3 -4
- package/dist/types/components/index.d.ts.map +1 -1
- package/dist/types/conditions/condition-abstract.d.ts +1 -1
- package/dist/types/conditions/condition-abstract.d.ts.map +1 -1
- package/dist/types/conditions/condition-field.d.ts +1 -1
- package/dist/types/conditions/condition-field.d.ts.map +1 -1
- package/dist/types/conditions/condition-group-def.d.ts +1 -1
- package/dist/types/conditions/condition-group-def.d.ts.map +1 -1
- package/dist/types/conditions/condition-group.d.ts +2 -2
- package/dist/types/conditions/condition-group.d.ts.map +1 -1
- package/dist/types/conditions/condition-model.d.ts +5 -5
- package/dist/types/conditions/condition-model.d.ts.map +1 -1
- package/dist/types/conditions/condition-operators.d.ts +2 -2
- package/dist/types/conditions/condition-operators.d.ts.map +1 -1
- package/dist/types/conditions/condition-ref.d.ts +2 -2
- package/dist/types/conditions/condition-ref.d.ts.map +1 -1
- package/dist/types/conditions/condition-value-abstract.d.ts +1 -1
- package/dist/types/conditions/condition-value-abstract.d.ts.map +1 -1
- package/dist/types/conditions/condition-values.d.ts +3 -3
- package/dist/types/conditions/condition-values.d.ts.map +1 -1
- package/dist/types/conditions/condition.d.ts +4 -4
- package/dist/types/conditions/condition.d.ts.map +1 -1
- package/dist/types/conditions/index.d.ts +10 -10
- package/dist/types/conditions/index.d.ts.map +1 -1
- package/dist/types/conditions/inline-condition-model.d.ts.map +1 -1
- package/dist/types/conditions/types.d.ts +3 -3
- package/dist/types/conditions/types.d.ts.map +1 -1
- package/dist/types/data-model/conditions-wrapper.d.ts +1 -10
- package/dist/types/data-model/conditions-wrapper.d.ts.map +1 -1
- package/dist/types/data-model/index.d.ts +3 -4
- package/dist/types/data-model/index.d.ts.map +1 -1
- package/dist/types/data-model/input-wrapper.d.ts +2 -2
- package/dist/types/data-model/input-wrapper.d.ts.map +1 -1
- package/dist/types/data-model/types.d.ts +12 -3
- package/dist/types/data-model/types.d.ts.map +1 -1
- package/dist/types/form/index.d.ts +1 -1
- package/dist/types/form/index.d.ts.map +1 -1
- package/dist/types/index.d.ts +6 -5
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/migration/index.d.ts +1 -1
- package/dist/types/migration/index.d.ts.map +1 -1
- package/dist/types/migration/migration.0-2.d.ts +1 -1
- package/dist/types/migration/migration.0-2.d.ts.map +1 -1
- package/dist/types/migration/migration.1-2.d.ts +1 -1
- package/dist/types/migration/migration.1-2.d.ts.map +1 -1
- package/dist/types/migration/whichMigrations.d.ts +1 -1
- package/dist/types/migration/whichMigrations.d.ts.map +1 -1
- package/dist/types/schema/index.d.ts +1 -1
- package/dist/types/schema/index.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/components/component-types.ts +1 -1
- package/src/components/conditional-component-types.ts +1 -1
- package/src/components/index.ts +3 -4
- package/src/conditions/condition-abstract.ts +1 -1
- package/src/conditions/condition-field.ts +2 -1
- package/src/conditions/condition-group-def.ts +1 -1
- package/src/conditions/condition-group.ts +3 -3
- package/src/conditions/condition-model.ts +9 -9
- package/src/conditions/condition-operators.ts +3 -4
- package/src/conditions/condition-ref.ts +2 -2
- package/src/conditions/condition-value-abstract.ts +1 -1
- package/src/conditions/condition-values.ts +7 -3
- package/src/conditions/condition.ts +9 -6
- package/src/conditions/index.ts +10 -10
- package/src/conditions/inline-condition-model.ts +6 -3
- package/src/conditions/inline-condition-operators.ts +1 -1
- package/src/conditions/types.ts +3 -3
- package/src/data-model/conditions-wrapper.ts +5 -15
- package/src/data-model/index.ts +3 -4
- package/src/data-model/input-wrapper.ts +3 -3
- package/src/data-model/types.ts +16 -3
- package/src/form/index.ts +1 -1
- package/src/index.ts +11 -14
- package/src/migration/index.ts +1 -1
- package/src/migration/migration.0-2.ts +1 -1
- package/src/migration/migration.1-2.ts +2 -2
- package/src/migration/whichMigrations.ts +3 -3
- package/src/schema/index.ts +1 -1
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"component-types.js","names":["ComponentTypes","_exports","name","type","title","subType","hint","options","schema","list","content"],"sources":["../../../src/components/component-types.ts"],"sourcesContent":["import { ComponentDef } from '
|
1
|
+
{"version":3,"file":"component-types.js","names":["ComponentTypes","_exports","name","type","title","subType","hint","options","schema","list","content"],"sources":["../../../src/components/component-types.ts"],"sourcesContent":["import { type ComponentDef } from '~/src/components/types'\n\nexport const ComponentTypes: ComponentDef[] = [\n {\n name: 'TextField',\n type: 'TextField',\n title: 'Text field',\n subType: 'field',\n hint: '',\n options: {},\n schema: {}\n },\n {\n name: 'MultilineTextField',\n type: 'MultilineTextField',\n title: 'Multiline text field',\n subType: 'field',\n hint: '',\n options: {},\n schema: {}\n },\n {\n name: 'YesNoField',\n type: 'YesNoField',\n title: 'Yes/No field',\n subType: 'field',\n hint: '',\n options: {},\n schema: {}\n },\n {\n name: 'DateField',\n type: 'DateField',\n title: 'Date field',\n subType: 'field',\n hint: '',\n options: {},\n schema: {}\n },\n {\n name: 'TimeField',\n type: 'TimeField',\n title: 'Time field',\n subType: 'field',\n hint: '',\n options: {},\n schema: {}\n },\n {\n name: 'DateTimeField',\n type: 'DateTimeField',\n title: 'Date time field',\n subType: 'field',\n hint: '',\n options: {},\n schema: {}\n },\n {\n name: 'DatePartsField',\n type: 'DatePartsField',\n title: 'Date parts field',\n subType: 'field',\n hint: '',\n options: {},\n schema: {}\n },\n {\n name: 'DateTimePartsField',\n type: 'DateTimePartsField',\n title: 'Date time parts field',\n subType: 'field',\n hint: '',\n options: {},\n schema: {}\n },\n {\n name: 'MonthYearField',\n type: 'MonthYearField',\n title: 'Month year field',\n subType: 'field',\n hint: '',\n options: {},\n schema: {}\n },\n {\n name: 'SelectField',\n type: 'SelectField',\n title: 'Select field',\n subType: 'listField',\n options: {},\n schema: {},\n list: ''\n },\n {\n name: 'AutocompleteField',\n type: 'AutocompleteField',\n title: 'Autocomplete field',\n subType: 'listField',\n options: {},\n schema: {},\n list: ''\n },\n {\n name: 'RadiosField',\n type: 'RadiosField',\n title: 'Radios field',\n subType: 'listField',\n options: {},\n schema: {},\n list: ''\n },\n {\n name: 'CheckboxesField',\n type: 'CheckboxesField',\n title: 'Checkboxes field',\n subType: 'listField',\n options: {},\n schema: {},\n list: ''\n },\n {\n name: 'NumberField',\n type: 'NumberField',\n title: 'Number field',\n subType: 'field',\n hint: '',\n options: {},\n schema: {}\n },\n {\n name: 'UkAddressField',\n type: 'UkAddressField',\n title: 'UK address field',\n subType: 'field',\n hint: '',\n options: {},\n schema: {}\n },\n {\n name: 'TelephoneNumberField',\n type: 'TelephoneNumberField',\n title: 'Telephone number field',\n subType: 'field',\n hint: '',\n options: {},\n schema: {}\n },\n {\n name: 'EmailAddressField',\n type: 'EmailAddressField',\n title: 'Email address field',\n subType: 'field',\n hint: '',\n options: {},\n schema: {}\n },\n {\n name: 'FileUploadField',\n type: 'FileUploadField',\n title: 'File upload field',\n subType: 'field',\n hint: '',\n options: {},\n schema: {}\n },\n {\n name: 'Para',\n type: 'Para',\n title: 'Paragraph',\n subType: 'content',\n content: '',\n options: {},\n schema: {}\n },\n {\n name: 'Html',\n type: 'Html',\n title: 'Html',\n subType: 'content',\n content: '',\n options: {},\n schema: {}\n },\n {\n name: 'InsetText',\n type: 'InsetText',\n title: 'Inset text',\n subType: 'content',\n content: '',\n options: {},\n schema: {}\n },\n {\n name: 'Details',\n type: 'Details',\n title: 'Details',\n subType: 'content',\n content: '',\n options: {},\n schema: {}\n },\n {\n name: 'FlashCard',\n type: 'FlashCard',\n title: 'Flash card',\n subType: 'content',\n options: {},\n schema: {},\n list: ''\n },\n {\n name: 'List',\n type: 'List',\n title: 'List',\n subType: 'content',\n options: {},\n schema: {},\n list: ''\n },\n {\n name: 'WebsiteField',\n type: 'WebsiteField',\n title: 'Website field',\n subType: 'field',\n hint: '',\n options: {},\n schema: {}\n }\n]\n"],"mappings":";;;;;;;;;;;;;;;;;EAEO,MAAMA,cAA8B,GAAAC,QAAA,CAAAD,cAAA,GAAG,CAC5C;IACEE,IAAI,EAAE,WAAW;IACjBC,IAAI,EAAE,WAAW;IACjBC,KAAK,EAAE,YAAY;IACnBC,OAAO,EAAE,OAAO;IAChBC,IAAI,EAAE,EAAE;IACRC,OAAO,EAAE,CAAC,CAAC;IACXC,MAAM,EAAE,CAAC;EACX,CAAC,EACD;IACEN,IAAI,EAAE,oBAAoB;IAC1BC,IAAI,EAAE,oBAAoB;IAC1BC,KAAK,EAAE,sBAAsB;IAC7BC,OAAO,EAAE,OAAO;IAChBC,IAAI,EAAE,EAAE;IACRC,OAAO,EAAE,CAAC,CAAC;IACXC,MAAM,EAAE,CAAC;EACX,CAAC,EACD;IACEN,IAAI,EAAE,YAAY;IAClBC,IAAI,EAAE,YAAY;IAClBC,KAAK,E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EACX,CAAC,EACD;IACEN,IAAI,EAAE,SAAS;IACfC,IAAI,EAAE,SAAS;IACfC,KAAK,EAAE,SAAS;IAChBC,OAAO,EAAE,SAAS;IAClBK,OAAO,EAAE,EAAE;IACXH,OAAO,EAAE,CAAC,CAAC;IACXC,MAAM,EAAE,CAAC;EACX,CAAC,EACD;IACEN,IAAI,EAAE,WAAW;IACjBC,IAAI,EAAE,WAAW;IACjBC,KAAK,EAAE,YAAY;IACnBC,OAAO,EAAE,SAAS;IAClBE,OAAO,EAAE,CAAC,CAAC;IACXC,MAAM,EAAE,CAAC,CAAC;IACVC,IAAI,EAAE;EACR,CAAC,EACD;IACEP,IAAI,EAAE,MAAM;IACZC,IAAI,EAAE,MAAM;IACZC,KAAK,EAAE,MAAM;IACbC,OAAO,EAAE,SAAS;IAClBE,OAAO,EAAE,CAAC,CAAC;IACXC,MAAM,EAAE,CAAC,CAAC;IACVC,IAAI,EAAE;EACR,CAAC,EACD;IACEP,IAAI,EAAE,cAAc;IACpBC,IAAI,EAAE,cAAc;IACpBC,KAAK,EAAE,eAAe;IACtBC,OAAO,EAAE,OAAO;IAChBC,IAAI,EAAE,EAAE;IACRC,OAAO,EAAE,CAAC,CAAC;IACXC,MAAM,EAAE,CAAC;EACX,CAAC,CACF;AAAA"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"conditional-component-types.js","names":["ConditionalComponentTypes","_exports","name","title","subType"],"sources":["../../../src/components/conditional-component-types.ts"],"sourcesContent":["import { ConditionalComponent } from '
|
1
|
+
{"version":3,"file":"conditional-component-types.js","names":["ConditionalComponentTypes","_exports","name","title","subType"],"sources":["../../../src/components/conditional-component-types.ts"],"sourcesContent":["import { type ConditionalComponent } from '~/src/components/types'\n\nexport const ConditionalComponentTypes: ConditionalComponent[] = [\n {\n name: 'TextField',\n title: 'Text field',\n subType: 'field'\n },\n {\n name: 'NumberField',\n title: 'Number field',\n subType: 'field'\n }\n]\n"],"mappings":";;;;;;;;;;;;;;;;;EAEO,MAAMA,yBAAiD,GAAAC,QAAA,CAAAD,yBAAA,GAAG,CAC/D;IACEE,IAAI,EAAE,WAAW;IACjBC,KAAK,EAAE,YAAY;IACnBC,OAAO,EAAE;EACX,CAAC,EACD;IACEF,IAAI,EAAE,aAAa;IACnBC,KAAK,EAAE,cAAc;IACrBC,OAAO,EAAE;EACX,CAAC,CACF;AAAA"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../src/components/index.ts"],"sourcesContent":["export { ComponentTypes } from '
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/components/index.ts"],"sourcesContent":["export { ComponentTypes } from '~/src/components/component-types'\nexport { ConditionalComponentTypes } from '~/src/components/conditional-component-types'\nexport { ComponentTypeEnum } from '~/src/components/enums'\n"],"mappings":""}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"condition-abstract.js","names":["ConditionAbstract","constructor","coordinator","_defineProperty","Object","values","Coordinator","includes","Error","coordinatorString","getCoordinator","setCoordinator","isGroup","getGroupedConditions","_asFirstCondition","asFirstCondition","clone","conditionString","conditionExpression","_exports"],"sources":["../../../src/conditions/condition-abstract.ts"],"sourcesContent":["import { Coordinator } from '
|
1
|
+
{"version":3,"file":"condition-abstract.js","names":["ConditionAbstract","constructor","coordinator","_defineProperty","Object","values","Coordinator","includes","Error","coordinatorString","getCoordinator","setCoordinator","isGroup","getGroupedConditions","_asFirstCondition","asFirstCondition","clone","conditionString","conditionExpression","_exports"],"sources":["../../../src/conditions/condition-abstract.ts"],"sourcesContent":["import { Coordinator } from '~/src/conditions/enums'\n\nexport class ConditionAbstract {\n coordinator: Coordinator | undefined\n\n constructor(coordinator: Coordinator | undefined) {\n if (coordinator && !Object.values(Coordinator).includes(coordinator)) {\n throw Error(`coordinator ${coordinator} is not a valid coordinator`)\n }\n\n this.coordinator = coordinator\n }\n\n coordinatorString() {\n return this.coordinator ? `${this.coordinator} ` : ''\n }\n\n getCoordinator() {\n return this.coordinator\n }\n\n setCoordinator(coordinator: Coordinator | undefined) {\n this.coordinator = coordinator\n }\n\n isGroup() {\n return false\n }\n\n getGroupedConditions() {\n return [this]\n }\n\n _asFirstCondition() {\n delete this.coordinator\n }\n\n asFirstCondition() {\n throw Error(\n 'Unsupported Operation. Method asFirstCondition have not been implemented'\n )\n }\n\n clone() {\n throw Error('Unsupported Operation. Method clone have not been implemented')\n }\n\n conditionString() {\n throw Error(\n 'Unsupported Operation. Method conditionString have not been implemented'\n )\n }\n\n conditionExpression() {\n throw Error(\n 'Unsupported Operation. Method conditionExpression have not been implemented'\n )\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;EAEO,MAAMA,iBAAiB,CAAC;IAG7BC,WAAWA,CAACC,WAAoC,EAAE;MAAAC,eAAA;MAChD,IAAID,WAAW,IAAI,CAACE,MAAM,CAACC,MAAM,CAACC,kBAAW,CAAC,CAACC,QAAQ,CAACL,WAAW,CAAC,EAAE;QACpE,MAAMM,KAAK,CAAE,eAAcN,WAAY,6BAA4B,CAAC;MACtE;MAEA,IAAI,CAACA,WAAW,GAAGA,WAAW;IAChC;IAEAO,iBAAiBA,CAAA,EAAG;MAClB,OAAO,IAAI,CAACP,WAAW,GAAI,GAAE,IAAI,CAACA,WAAY,GAAE,GAAG,EAAE;IACvD;IAEAQ,cAAcA,CAAA,EAAG;MACf,OAAO,IAAI,CAACR,WAAW;IACzB;IAEAS,cAAcA,CAACT,WAAoC,EAAE;MACnD,IAAI,CAACA,WAAW,GAAGA,WAAW;IAChC;IAEAU,OAAOA,CAAA,EAAG;MACR,OAAO,KAAK;IACd;IAEAC,oBAAoBA,CAAA,EAAG;MACrB,OAAO,CAAC,IAAI,CAAC;IACf;IAEAC,iBAAiBA,CAAA,EAAG;MAClB,OAAO,IAAI,CAACZ,WAAW;IACzB;IAEAa,gBAAgBA,CAAA,EAAG;MACjB,MAAMP,KAAK,CACT,0EACF,CAAC;IACH;IAEAQ,KAAKA,CAAA,EAAG;MACN,MAAMR,KAAK,CAAC,+DAA+D,CAAC;IAC9E;IAEAS,eAAeA,CAAA,EAAG;MAChB,MAAMT,KAAK,CACT,yEACF,CAAC;IACH;IAEAU,mBAAmBA,CAAA,EAAG;MACpB,MAAMV,KAAK,CACT,6EACF,CAAC;IACH;EACF;EAACW,QAAA,CAAAnB,iBAAA,GAAAA,iBAAA;AAAA"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"condition-field.js","names":["ConditionField","constructor","name","type","display","_defineProperty","Error","ComponentTypes","find","componentType","from","obj","_exports"],"sources":["../../../src/conditions/condition-field.ts"],"sourcesContent":["import { ComponentTypes
|
1
|
+
{"version":3,"file":"condition-field.js","names":["ConditionField","constructor","name","type","display","_defineProperty","Error","ComponentTypes","find","componentType","from","obj","_exports"],"sources":["../../../src/conditions/condition-field.ts"],"sourcesContent":["import { ComponentTypes } from '~/src/components'\nimport { type ComponentType } from '~/src/components/types'\n\nexport class ConditionField {\n name: string\n type: ComponentType\n display: string\n\n constructor(name: string, type: ComponentType, display: string) {\n if (!name || typeof name !== 'string') {\n throw Error(`name ${name} is not valid`)\n }\n\n if (!ComponentTypes.find((componentType) => componentType.type === type)) {\n throw Error(`type ${type} is not valid`)\n }\n\n if (!display || typeof display !== 'string') {\n throw Error(`display ${display} is not valid`)\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":";;;;;;;;;;;;;;;;;;;;EAGO,MAAMA,cAAc,CAAC;IAK1BC,WAAWA,CAACC,IAAY,EAAEC,IAAmB,EAAEC,OAAe,EAAE;MAAAC,eAAA;MAAAA,eAAA;MAAAA,eAAA;MAC9D,IAAI,CAACH,IAAI,IAAI,OAAOA,IAAI,KAAK,QAAQ,EAAE;QACrC,MAAMI,KAAK,CAAE,QAAOJ,IAAK,eAAc,CAAC;MAC1C;MAEA,IAAI,CAACK,0BAAc,CAACC,IAAI,CAAEC,aAAa,IAAKA,aAAa,CAACN,IAAI,KAAKA,IAAI,CAAC,EAAE;QACxE,MAAMG,KAAK,CAAE,QAAOH,IAAK,eAAc,CAAC;MAC1C;MAEA,IAAI,CAACC,OAAO,IAAI,OAAOA,OAAO,KAAK,QAAQ,EAAE;QAC3C,MAAME,KAAK,CAAE,WAAUF,OAAQ,eAAc,CAAC;MAChD;MAEA,IAAI,CAACF,IAAI,GAAGA,IAAI;MAChB,IAAI,CAACC,IAAI,GAAGA,IAAI;MAChB,IAAI,CAACC,OAAO,GAAGA,OAAO;IACxB;IAEA,OAAOM,IAAIA,CAACC,GAA2D,EAAE;MACvE,OAAO,IAAIX,cAAc,CAACW,GAAG,CAACT,IAAI,EAAES,GAAG,CAACR,IAAI,EAAEQ,GAAG,CAACP,OAAO,CAAC;IAC5D;EACF;EAACQ,QAAA,CAAAZ,cAAA,GAAAA,cAAA;AAAA"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"condition-group-def.js","names":["ConditionGroupDef","constructor","first","last","_defineProperty","Error","contains","index","startsWith","applyTo","conditions","splice","_exports"],"sources":["../../../src/conditions/condition-group-def.ts"],"sourcesContent":["import { ConditionsArray } from '
|
1
|
+
{"version":3,"file":"condition-group-def.js","names":["ConditionGroupDef","constructor","first","last","_defineProperty","Error","contains","index","startsWith","applyTo","conditions","splice","_exports"],"sources":["../../../src/conditions/condition-group-def.ts"],"sourcesContent":["import { type ConditionsArray } from '~/src/conditions/types'\n\nexport class ConditionGroupDef {\n first: number\n last: number\n\n constructor(first: number, last: number) {\n if (typeof first !== 'number' || typeof last !== 'number') {\n throw Error(`Cannot construct a group from ${first} and ${last}`)\n } else if (first >= last) {\n throw Error(`Last (${last}) must be greater than first (${first})`)\n }\n\n this.first = first\n this.last = last\n }\n\n contains(index: number) {\n return this.first <= index && this.last >= index\n }\n\n startsWith(index: number) {\n return this.first === index\n }\n\n applyTo(conditions: ConditionsArray) {\n return [...conditions].splice(this.first, this.last - this.first + 1)\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;EAEO,MAAMA,iBAAiB,CAAC;IAI7BC,WAAWA,CAACC,KAAa,EAAEC,IAAY,EAAE;MAAAC,eAAA;MAAAA,eAAA;MACvC,IAAI,OAAOF,KAAK,KAAK,QAAQ,IAAI,OAAOC,IAAI,KAAK,QAAQ,EAAE;QACzD,MAAME,KAAK,CAAE,iCAAgCH,KAAM,QAAOC,IAAK,EAAC,CAAC;MACnE,CAAC,MAAM,IAAID,KAAK,IAAIC,IAAI,EAAE;QACxB,MAAME,KAAK,CAAE,SAAQF,IAAK,iCAAgCD,KAAM,GAAE,CAAC;MACrE;MAEA,IAAI,CAACA,KAAK,GAAGA,KAAK;MAClB,IAAI,CAACC,IAAI,GAAGA,IAAI;IAClB;IAEAG,QAAQA,CAACC,KAAa,EAAE;MACtB,OAAO,IAAI,CAACL,KAAK,IAAIK,KAAK,IAAI,IAAI,CAACJ,IAAI,IAAII,KAAK;IAClD;IAEAC,UAAUA,CAACD,KAAa,EAAE;MACxB,OAAO,IAAI,CAACL,KAAK,KAAKK,KAAK;IAC7B;IAEAE,OAAOA,CAACC,UAA2B,EAAE;MACnC,OAAO,CAAC,GAAGA,UAAU,CAAC,CAACC,MAAM,CAAC,IAAI,CAACT,KAAK,EAAE,IAAI,CAACC,IAAI,GAAG,IAAI,CAACD,KAAK,GAAG,CAAC,CAAC;IACvE;EACF;EAACU,QAAA,CAAAZ,iBAAA,GAAAA,iBAAA;AAAA"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"condition-group.js","names":["ConditionGroup","constructor","conditions","_defineProperty","Array","isArray","length","Error","coordinatorString","conditionString","copy","splice","map","condition","toPresentationString","join","conditionExpression","toExpression","asFirstCondition","getCoordinator","setCoordinator","coordinator","isGroup","getGroupedConditions","clone","_exports"],"sources":["../../../src/conditions/condition-group.ts"],"sourcesContent":["import { Coordinator } from '
|
1
|
+
{"version":3,"file":"condition-group.js","names":["ConditionGroup","constructor","conditions","_defineProperty","Array","isArray","length","Error","coordinatorString","conditionString","copy","splice","map","condition","toPresentationString","join","conditionExpression","toExpression","asFirstCondition","getCoordinator","setCoordinator","coordinator","isGroup","getGroupedConditions","clone","_exports"],"sources":["../../../src/conditions/condition-group.ts"],"sourcesContent":["import { Coordinator } from '~/src/conditions/enums'\nimport { toPresentationString, toExpression } from '~/src/conditions/helpers'\nimport { type ConditionsArray } from '~/src/conditions/types'\n\nexport class ConditionGroup {\n conditions: ConditionsArray\n\n constructor(conditions: ConditionsArray = []) {\n if (!Array.isArray(conditions) || conditions.length < 2) {\n throw Error('Cannot construct a condition group from a single condition')\n }\n\n this.conditions = conditions\n }\n\n coordinatorString() {\n return this.conditions[0].coordinatorString()\n }\n\n conditionString() {\n const copy = [...this.conditions]\n copy.splice(0, 1)\n return `(${this.conditions[0].conditionString()} ${copy\n .map((condition) => toPresentationString(condition))\n .join(' ')})`\n }\n\n conditionExpression() {\n const copy = [...this.conditions]\n copy.splice(0, 1)\n return `(${this.conditions[0].conditionExpression()} ${copy\n .map((condition) => toExpression(condition))\n .join(' ')})`\n }\n\n asFirstCondition() {\n this.conditions[0].asFirstCondition()\n return this\n }\n\n getCoordinator() {\n return this.conditions[0].getCoordinator()\n }\n\n setCoordinator(coordinator: Coordinator | undefined) {\n this.conditions[0].setCoordinator(coordinator)\n }\n\n isGroup() {\n return true\n }\n\n getGroupedConditions() {\n return this.conditions.map((condition) => condition.clone())\n }\n\n clone() {\n return new ConditionGroup(\n this.conditions.map((condition) => condition.clone())\n )\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;EAIO,MAAMA,cAAc,CAAC;IAG1BC,WAAWA,CAACC,UAA2B,GAAG,EAAE,EAAE;MAAAC,eAAA;MAC5C,IAAI,CAACC,KAAK,CAACC,OAAO,CAACH,UAAU,CAAC,IAAIA,UAAU,CAACI,MAAM,GAAG,CAAC,EAAE;QACvD,MAAMC,KAAK,CAAC,4DAA4D,CAAC;MAC3E;MAEA,IAAI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AAO,IAAI;IACb;IAEAC,oBAAoBA,CAAA,EAAG;MACrB,OAAO,IAAI,CAACrB,UAAU,CAACU,GAAG,CAAEC,SAAS,IAAKA,SAAS,CAACW,KAAK,CAAC,CAAC,CAAC;IAC9D;IAEAA,KAAKA,CAAA,EAAG;MACN,OAAO,IAAIxB,cAAc,CACvB,IAAI,CAACE,UAAU,CAACU,GAAG,CAAEC,SAAS,IAAKA,SAAS,CAACW,KAAK,CAAC,CAAC,CACtD,CAAC;IACH;EACF;EAACC,QAAA,CAAAzB,cAAA,GAAAA,cAAA;AAAA"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"condition-model.js","names":["ConditionsModel","constructor","_conditionsObject","_classPrivateFieldInitSpec","_groupedConditions","_userGroupedConditions","_conditionName","undefined","clone","toReturn","_classPrivateFieldSet","_classPrivateFieldGet","map","it","clear","name","add","condition","coordinatorExpected","length","getCoordinator","Error","push","_applyGroups","replace","index","splice","remove","indexes","filter","_condition","includes","asFirstCondition","addGroups","groupDefs","_group","splitGroup","_ungroup","moveEarlier","switchCoordinators","moveLater","setCoordinator","asPerUserGroupings","hasConditions","lastIndex","toPresentationString","join","toExpression","userGroupedConditions","correctedUserGroups","ConditionGroup","conditions","_autoGroupDefs","reduce","groups","groupDef","find","contains","startsWith","groupConditions","applyTo","splitIndex","isGroup","copy","getGroupedConditions","orPositions","forEach","Coordinator","OR","hasOr","hasAnd","AND","start","position","ConditionGroupDef","thisIsTheLastOr","thereAreMoreConditions","toJSON","from","obj","conditionFrom","_exports","ConditionRef","conditionName","conditionDisplayName","coordinator","Condition","ConditionField","field","operator","conditionValueFrom","value"],"sources":["../../../src/conditions/condition-model.ts"],"sourcesContent":["import { ConditionField } from './condition-field'\nimport { ConditionGroupDef } from './condition-group-def'\nimport { Condition } from './condition'\nimport { ConditionRef } from './condition-ref'\nimport { ConditionGroup } from './condition-group'\nimport { conditionValueFrom } from './condition-values'\nimport { Coordinator } from './enums'\nimport { toPresentationString, toExpression } from './helpers'\nimport { ConditionsArray } from './types'\n\ntype ConditionRawObject =\n | ConditionsModel\n | {\n name: string\n conditions: Condition[]\n }\n\nexport class ConditionsModel {\n #groupedConditions: ConditionsArray = []\n #userGroupedConditions: ConditionsArray = []\n #conditionName: string | undefined = undefined\n\n constructor(_conditionsObject?: ConditionRawObject) {}\n\n clone() {\n const toReturn = new ConditionsModel()\n toReturn.#groupedConditions = this.#groupedConditions.map((it) =>\n it.clone()\n )\n toReturn.#userGroupedConditions = this.#userGroupedConditions.map((it) =>\n it.clone()\n )\n toReturn.#conditionName = this.#conditionName\n return toReturn\n }\n\n clear() {\n this.#userGroupedConditions = []\n this.#groupedConditions = []\n this.#conditionName = undefined\n return this\n }\n\n set name(name) {\n this.#conditionName = name\n }\n\n get name() {\n return this.#conditionName\n }\n\n add(condition: Condition) {\n const coordinatorExpected = this.#userGroupedConditions.length !== 0\n\n if (condition.getCoordinator() && !coordinatorExpected) {\n throw Error('No coordinator allowed on the first condition')\n } else if (!condition.getCoordinator() && coordinatorExpected) {\n throw Error('Coordinator must be present on subsequent conditions')\n }\n\n this.#userGroupedConditions.push(condition)\n this.#groupedConditions = this._applyGroups(this.#userGroupedConditions)\n\n return this\n }\n\n replace(index: number, condition: Condition) {\n const coordinatorExpected = index !== 0\n\n if (condition.getCoordinator() && !coordinatorExpected) {\n throw Error('No coordinator allowed on the first condition')\n } else if (!condition.getCoordinator() && coordinatorExpected) {\n throw Error('Coordinator must be present on subsequent conditions')\n } else if (index >= this.#userGroupedConditions.length) {\n throw Error(\n `Cannot replace condition ${index} as no such condition exists`\n )\n }\n\n this.#userGroupedConditions.splice(index, 1, condition)\n this.#groupedConditions = this._applyGroups(this.#userGroupedConditions)\n\n return this\n }\n\n remove(indexes: number[]) {\n this.#userGroupedConditions = this.#userGroupedConditions\n .filter((_condition, index) => !indexes.includes(index))\n .map((condition, index) =>\n index === 0 ? condition.asFirstCondition() : condition\n )\n\n this.#groupedConditions = this._applyGroups(this.#userGroupedConditions)\n return this\n }\n\n addGroups(groupDefs: ConditionGroupDef[]) {\n this.#userGroupedConditions = this._group(\n this.#userGroupedConditions,\n groupDefs\n )\n this.#groupedConditions = this._applyGroups(this.#userGroupedConditions)\n return this\n }\n\n splitGroup(index: number) {\n this.#userGroupedConditions = this._ungroup(\n this.#userGroupedConditions,\n index\n )\n this.#groupedConditions = this._applyGroups(this.#userGroupedConditions)\n return this\n }\n\n moveEarlier(index: number) {\n if (index > 0 && index < this.#userGroupedConditions.length) {\n this.#userGroupedConditions.splice(\n index - 1,\n 0,\n this.#userGroupedConditions.splice(index, 1)[0]\n )\n if (index === 1) {\n this.switchCoordinators()\n }\n this.#groupedConditions = this._applyGroups(this.#userGroupedConditions)\n }\n return this\n }\n\n moveLater(index: number) {\n if (index >= 0 && index < this.#userGroupedConditions.length - 1) {\n this.#userGroupedConditions.splice(\n index + 1,\n 0,\n this.#userGroupedConditions.splice(index, 1)[0]\n )\n if (index === 0) {\n this.switchCoordinators()\n }\n this.#groupedConditions = this._applyGroups(this.#userGroupedConditions)\n }\n return this\n }\n\n switchCoordinators() {\n this.#userGroupedConditions[1].setCoordinator(\n this.#userGroupedConditions[0].getCoordinator()\n )\n this.#userGroupedConditions[0].setCoordinator(undefined)\n }\n\n get asPerUserGroupings() {\n return [...this.#userGroupedConditions]\n }\n\n get hasConditions() {\n return this.#userGroupedConditions.length > 0\n }\n\n get lastIndex() {\n return this.#userGroupedConditions.length - 1\n }\n\n toPresentationString() {\n return this.#groupedConditions\n .map((condition) => toPresentationString(condition))\n .join(' ')\n }\n\n toExpression() {\n return this.#groupedConditions\n .map((condition) => toExpression(condition))\n .join(' ')\n }\n\n _applyGroups(\n userGroupedConditions: (Condition | ConditionGroup | ConditionRef)[]\n ) {\n const correctedUserGroups = userGroupedConditions.map((condition) =>\n condition instanceof ConditionGroup && condition.conditions.length > 2\n ? new ConditionGroup(\n this._group(\n condition.conditions,\n this._autoGroupDefs(condition.conditions)\n )\n )\n : condition\n )\n\n return this._group(\n correctedUserGroups,\n this._autoGroupDefs(correctedUserGroups)\n )\n }\n\n _group(conditions: ConditionsArray, groupDefs: ConditionGroupDef[]) {\n return conditions.reduce((groups, condition, index, conditions) => {\n const groupDef = groupDefs.find((groupDef) => groupDef.contains(index))\n\n if (groupDef) {\n if (groupDef.startsWith(index)) {\n const groupConditions = groupDef.applyTo(conditions)\n groups.push(new ConditionGroup(groupConditions))\n }\n } else {\n groups.push(condition)\n }\n\n return groups\n }, [] as ConditionsArray)\n }\n\n _ungroup(conditions: ConditionsArray, splitIndex: number) {\n if (conditions[splitIndex].isGroup()) {\n const copy = [...conditions]\n copy.splice(\n splitIndex,\n 1,\n ...conditions[splitIndex].getGroupedConditions()\n )\n return copy\n }\n return conditions\n }\n\n _autoGroupDefs(conditions: ConditionsArray) {\n const orPositions: number[] = []\n\n conditions.forEach((condition, index) => {\n if (condition.getCoordinator() === Coordinator.OR) {\n orPositions.push(index)\n }\n })\n\n const hasOr = orPositions.length > 0\n const hasAnd = !!conditions.find(\n (condition) => condition.getCoordinator() === Coordinator.AND\n )\n\n if (hasAnd && hasOr) {\n let start = 0\n const groupDefs: ConditionGroupDef[] = []\n orPositions.forEach((position, index) => {\n if (start < position - 1) {\n groupDefs.push(new ConditionGroupDef(start, position - 1))\n }\n const thisIsTheLastOr = orPositions.length === index + 1\n const thereAreMoreConditions = conditions.length - 1 > position\n if (thisIsTheLastOr && thereAreMoreConditions) {\n groupDefs.push(new ConditionGroupDef(position, conditions.length - 1))\n }\n start = position\n })\n return groupDefs\n }\n\n return []\n }\n\n toJSON() {\n const name = this.#conditionName\n const conditions = this.#userGroupedConditions\n return {\n name,\n conditions: conditions.map((it) => it.clone())\n }\n }\n\n // TODO:- why is this not a constructor?\n static from(obj: ConditionRawObject | ConditionsModel) {\n if (obj instanceof ConditionsModel) {\n return obj\n }\n const toReturn = new ConditionsModel()\n toReturn.#conditionName = obj.name\n toReturn.#userGroupedConditions = obj.conditions.map((condition) =>\n conditionFrom(condition)\n )\n toReturn.#groupedConditions = toReturn._applyGroups(\n toReturn.#userGroupedConditions\n )\n return toReturn\n }\n}\n\ninterface ConditionFrom {\n (\n it: Condition | ConditionRef | ConditionGroup\n ): Condition | ConditionRef | ConditionGroup\n}\n\nconst conditionFrom: ConditionFrom = function (it) {\n if ('conditions' in it) {\n return new ConditionGroup(\n (it as ConditionGroup).conditions.map((condition) =>\n conditionFrom(condition)\n )\n )\n }\n\n if ('conditionName' in it) {\n return new ConditionRef(\n it.conditionName,\n it.conditionDisplayName,\n it.coordinator\n )\n }\n\n return new Condition(\n ConditionField.from(it.field),\n it.operator,\n conditionValueFrom(it.value),\n it.coordinator\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;EAiBO,MAAMA,eAAe,CAAC;IAK3BC,WAAWA,CAACC,iBAAsC,EAAE;MAAAC,0BAAA,OAAAC,kBAAA,EAJd,EAAE;MAAAD,0BAAA,OAAAE,sBAAA,EACE,EAAE;MAAAF,0BAAA,OAAAG,cAAA,EACPC,SAAS;IAEO;IAErDC,KAAKA,CAAA,EAAG;MACN,MAAMC,QAAQ,GAAG,IAAIT,eAAe,CAAC,CAAC;MACtCU,qBAAA,CAAAN,kBAAA,EAAAK,QAAQ,EAAsBE,qBAAA,CAAAP,kBAAA,MAAI,EAAoBQ,GAAG,CAAEC,EAAE,IAC3DA,EAAE,CAACL,KAAK,CAAC,CACX,CAAC;MACDE,qBAAA,CAAAL,sBAAA,EAAAI,QAAQ,EAA0BE,qBAAA,CAAAN,sBAAA,MAAI,EAAwBO,GAAG,CAAEC,EAAE,IACnEA,EAAE,CAACL,KAAK,CAAC,CACX,CAAC;MACDE,qBAAA,CAAAJ,cAAA,EAAAG,QAAQ,EAAAE,qBAAA,CAAAL,cAAA,EAAkB,IAAI;MAC9B,OAAOG,QAAQ;IACjB;IAEAK,KAAKA,CAAA,EAAG;MACNJ,qBAAA,CAAAL,sBAAA,MAAI,EAA0B,EAAE;MAChCK,qBAAA,CAAAN,kBAAA,MAAI,EAA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ACT,IAAI,CAACjE,EAAE,CAAC2E,KAAK,CAAC,EAC7B3E,EAAE,CAAC4E,QAAQ,EACX,IAAAC,mCAAkB,EAAC7E,EAAE,CAAC8E,KAAK,CAAC,EAC5B9E,EAAE,CAACwE,WACL,CAAC;EACH,CAAC;AAAA"}
|
1
|
+
{"version":3,"file":"condition-model.js","names":["ConditionsModel","constructor","_conditionsObject","_classPrivateFieldInitSpec","_groupedConditions","_userGroupedConditions","_conditionName","undefined","clone","toReturn","_classPrivateFieldSet","_classPrivateFieldGet","map","it","clear","name","add","condition","coordinatorExpected","length","getCoordinator","Error","push","_applyGroups","replace","index","splice","remove","indexes","filter","_condition","includes","asFirstCondition","addGroups","groupDefs","_group","splitGroup","_ungroup","moveEarlier","switchCoordinators","moveLater","setCoordinator","asPerUserGroupings","hasConditions","lastIndex","toPresentationString","join","toExpression","userGroupedConditions","correctedUserGroups","ConditionGroup","conditions","_autoGroupDefs","reduce","groups","groupDef","find","contains","startsWith","groupConditions","applyTo","splitIndex","isGroup","copy","getGroupedConditions","orPositions","forEach","Coordinator","OR","hasOr","hasAnd","AND","start","position","ConditionGroupDef","thisIsTheLastOr","thereAreMoreConditions","toJSON","from","obj","conditionFrom","_exports","ConditionRef","conditionName","conditionDisplayName","coordinator","Condition","ConditionField","field","operator","conditionValueFrom","value"],"sources":["../../../src/conditions/condition-model.ts"],"sourcesContent":["import { ConditionField } from '~/src/conditions/condition-field'\nimport { ConditionGroupDef } from '~/src/conditions/condition-group-def'\nimport { Condition } from '~/src/conditions/condition'\nimport { ConditionRef } from '~/src/conditions/condition-ref'\nimport { ConditionGroup } from '~/src/conditions/condition-group'\nimport { conditionValueFrom } from '~/src/conditions/condition-values'\nimport { Coordinator } from '~/src/conditions/enums'\nimport { toPresentationString, toExpression } from '~/src/conditions/helpers'\nimport { type ConditionsArray } from '~/src/conditions/types'\n\ntype ConditionRawObject =\n | ConditionsModel\n | {\n name: string\n conditions: Condition[]\n }\n\nexport class ConditionsModel {\n #groupedConditions: ConditionsArray = []\n #userGroupedConditions: ConditionsArray = []\n #conditionName: string | undefined = undefined\n\n constructor(_conditionsObject?: ConditionRawObject) {}\n\n clone() {\n const toReturn = new ConditionsModel()\n toReturn.#groupedConditions = this.#groupedConditions.map((it) =>\n it.clone()\n )\n toReturn.#userGroupedConditions = this.#userGroupedConditions.map((it) =>\n it.clone()\n )\n toReturn.#conditionName = this.#conditionName\n return toReturn\n }\n\n clear() {\n this.#userGroupedConditions = []\n this.#groupedConditions = []\n this.#conditionName = undefined\n return this\n }\n\n set name(name) {\n this.#conditionName = name\n }\n\n get name() {\n return this.#conditionName\n }\n\n add(condition: Condition) {\n const coordinatorExpected = this.#userGroupedConditions.length !== 0\n\n if (condition.getCoordinator() && !coordinatorExpected) {\n throw Error('No coordinator allowed on the first condition')\n } else if (!condition.getCoordinator() && coordinatorExpected) {\n throw Error('Coordinator must be present on subsequent conditions')\n }\n\n this.#userGroupedConditions.push(condition)\n this.#groupedConditions = this._applyGroups(this.#userGroupedConditions)\n\n return this\n }\n\n replace(index: number, condition: Condition) {\n const coordinatorExpected = index !== 0\n\n if (condition.getCoordinator() && !coordinatorExpected) {\n throw Error('No coordinator allowed on the first condition')\n } else if (!condition.getCoordinator() && coordinatorExpected) {\n throw Error('Coordinator must be present on subsequent conditions')\n } else if (index >= this.#userGroupedConditions.length) {\n throw Error(\n `Cannot replace condition ${index} as no such condition exists`\n )\n }\n\n this.#userGroupedConditions.splice(index, 1, condition)\n this.#groupedConditions = this._applyGroups(this.#userGroupedConditions)\n\n return this\n }\n\n remove(indexes: number[]) {\n this.#userGroupedConditions = this.#userGroupedConditions\n .filter((_condition, index) => !indexes.includes(index))\n .map((condition, index) =>\n index === 0 ? condition.asFirstCondition() : condition\n )\n\n this.#groupedConditions = this._applyGroups(this.#userGroupedConditions)\n return this\n }\n\n addGroups(groupDefs: ConditionGroupDef[]) {\n this.#userGroupedConditions = this._group(\n this.#userGroupedConditions,\n groupDefs\n )\n this.#groupedConditions = this._applyGroups(this.#userGroupedConditions)\n return this\n }\n\n splitGroup(index: number) {\n this.#userGroupedConditions = this._ungroup(\n this.#userGroupedConditions,\n index\n )\n this.#groupedConditions = this._applyGroups(this.#userGroupedConditions)\n return this\n }\n\n moveEarlier(index: number) {\n if (index > 0 && index < this.#userGroupedConditions.length) {\n this.#userGroupedConditions.splice(\n index - 1,\n 0,\n this.#userGroupedConditions.splice(index, 1)[0]\n )\n if (index === 1) {\n this.switchCoordinators()\n }\n this.#groupedConditions = this._applyGroups(this.#userGroupedConditions)\n }\n return this\n }\n\n moveLater(index: number) {\n if (index >= 0 && index < this.#userGroupedConditions.length - 1) {\n this.#userGroupedConditions.splice(\n index + 1,\n 0,\n this.#userGroupedConditions.splice(index, 1)[0]\n )\n if (index === 0) {\n this.switchCoordinators()\n }\n this.#groupedConditions = this._applyGroups(this.#userGroupedConditions)\n }\n return this\n }\n\n switchCoordinators() {\n this.#userGroupedConditions[1].setCoordinator(\n this.#userGroupedConditions[0].getCoordinator()\n )\n this.#userGroupedConditions[0].setCoordinator(undefined)\n }\n\n get asPerUserGroupings() {\n return [...this.#userGroupedConditions]\n }\n\n get hasConditions() {\n return this.#userGroupedConditions.length > 0\n }\n\n get lastIndex() {\n return this.#userGroupedConditions.length - 1\n }\n\n toPresentationString() {\n return this.#groupedConditions\n .map((condition) => toPresentationString(condition))\n .join(' ')\n }\n\n toExpression() {\n return this.#groupedConditions\n .map((condition) => toExpression(condition))\n .join(' ')\n }\n\n _applyGroups(\n userGroupedConditions: (Condition | ConditionGroup | ConditionRef)[]\n ) {\n const correctedUserGroups = userGroupedConditions.map((condition) =>\n condition instanceof ConditionGroup && condition.conditions.length > 2\n ? new ConditionGroup(\n this._group(\n condition.conditions,\n this._autoGroupDefs(condition.conditions)\n )\n )\n : condition\n )\n\n return this._group(\n correctedUserGroups,\n this._autoGroupDefs(correctedUserGroups)\n )\n }\n\n _group(conditions: ConditionsArray, groupDefs: ConditionGroupDef[]) {\n return conditions.reduce((groups, condition, index, conditions) => {\n const groupDef = groupDefs.find((groupDef) => groupDef.contains(index))\n\n if (groupDef) {\n if (groupDef.startsWith(index)) {\n const groupConditions = groupDef.applyTo(conditions)\n groups.push(new ConditionGroup(groupConditions))\n }\n } else {\n groups.push(condition)\n }\n\n return groups\n }, [] as ConditionsArray)\n }\n\n _ungroup(conditions: ConditionsArray, splitIndex: number) {\n if (conditions[splitIndex].isGroup()) {\n const copy = [...conditions]\n copy.splice(\n splitIndex,\n 1,\n ...conditions[splitIndex].getGroupedConditions()\n )\n return copy\n }\n return conditions\n }\n\n _autoGroupDefs(conditions: ConditionsArray) {\n const orPositions: number[] = []\n\n conditions.forEach((condition, index) => {\n if (condition.getCoordinator() === Coordinator.OR) {\n orPositions.push(index)\n }\n })\n\n const hasOr = orPositions.length > 0\n const hasAnd = !!conditions.find(\n (condition) => condition.getCoordinator() === Coordinator.AND\n )\n\n if (hasAnd && hasOr) {\n let start = 0\n const groupDefs: ConditionGroupDef[] = []\n orPositions.forEach((position, index) => {\n if (start < position - 1) {\n groupDefs.push(new ConditionGroupDef(start, position - 1))\n }\n const thisIsTheLastOr = orPositions.length === index + 1\n const thereAreMoreConditions = conditions.length - 1 > position\n if (thisIsTheLastOr && thereAreMoreConditions) {\n groupDefs.push(new ConditionGroupDef(position, conditions.length - 1))\n }\n start = position\n })\n return groupDefs\n }\n\n return []\n }\n\n toJSON() {\n const name = this.#conditionName\n const conditions = this.#userGroupedConditions\n return {\n name,\n conditions: conditions.map((it) => it.clone())\n }\n }\n\n // TODO:- why is this not a constructor?\n static from(obj: ConditionRawObject | ConditionsModel) {\n if (obj instanceof ConditionsModel) {\n return obj\n }\n const toReturn = new ConditionsModel()\n toReturn.#conditionName = obj.name\n toReturn.#userGroupedConditions = obj.conditions.map((condition) =>\n conditionFrom(condition)\n )\n toReturn.#groupedConditions = toReturn._applyGroups(\n toReturn.#userGroupedConditions\n )\n return toReturn\n }\n}\n\ninterface ConditionFrom {\n (\n it: Condition | ConditionRef | ConditionGroup\n ): Condition | ConditionRef | ConditionGroup\n}\n\nconst conditionFrom: ConditionFrom = function (it) {\n if ('conditions' in it) {\n return new ConditionGroup(\n (it as ConditionGroup).conditions.map((condition) =>\n conditionFrom(condition)\n )\n )\n }\n\n if ('conditionName' in it) {\n return new ConditionRef(\n it.conditionName,\n it.conditionDisplayName,\n it.coordinator\n )\n }\n\n return new Condition(\n ConditionField.from(it.field),\n it.operator,\n conditionValueFrom(it.value),\n it.coordinator\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;EAiBO,MAAMA,eAAe,CAAC;IAK3BC,WAAWA,CAACC,iBAAsC,EAAE;MAAAC,0BAAA,OAAAC,kBAAA,EAJd,EAAE;MAAAD,0BAAA,OAAAE,sBAAA,EACE,EAAE;MAAAF,0BAAA,OAAAG,cAAA,EACPC,SAAS;IAEO;IAErDC,KAAKA,CAAA,EAAG;MACN,MAAMC,QAAQ,GAAG,IAAIT,eAAe,CAAC,CAAC;MACtCU,qBAAA,CAAAN,kBAAA,EAAAK,QAAQ,EAAsBE,qBAAA,CAAAP,kBAAA,MAAI,EAAoBQ,GAAG,CAAEC,EAAE,IAC3DA,EAAE,CAACL,KAAK,CAAC,CACX,CAAC;MACDE,qBAAA,CAAAL,sBAAA,EAAAI,QAAQ,EAA0BE,qBAAA,CAAAN,sBAAA,MAAI,EAAwBO,GAAG,CAAEC,EAAE,IACnEA,EAAE,CAACL,KAAK,CAAC,CACX,CAAC;MACDE,qBAAA,CAAAJ,cAAA,EAAAG,QAAQ,EAAAE,qBAAA,CAAAL,cAAA,EAAkB,IAAI;MAC9B,OAAOG,QAAQ;IACjB;IAEAK,KAAKA,CAAA,EAAG;MACNJ,qBAAA,CAAAL,sBAAA,MAAI,EAA0B,EAAE;MAChCK,qBAAA,CAAAN,kBAAA,MAAI,EAAsB,EAAE;MAC5BM,qBAAA,CAAAJ,cAAA,MAAI,EAAkBC,SAAS;MAC/B,OAAO,IAAI;IACb;IAEA,IAAIQ,IAAIA,CA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,CAAC8E,KAAK,CAAC,EAC5B9E,EAAE,CAACwE,WACL,CAAC;EACH,CAAC;AAAA"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"condition-operators.js","names":["defaultOperators","is","inline","withDefaults","param","Object","assign","textBasedFieldCustomisations","lengthIs","absoluteDateTimeOperators","absoluteDateTime","relativeTimeOperators","units","relativeTime","customOperators","_exports","CheckboxesField","contains","reverseInline","not","NumberField","DateField","dateUnits","TimeField","timeUnits","DatePartsField","DateTimeField","dateTimeUnits","DateTimePartsField","TextField","MultilineTextField","EmailAddressField","getOperatorNames","fieldType","keys","getConditionals","sort","getExpression","fieldName","operator","value","expression","type","name","getOperatorConfig","field","formatValue","operatorDefinition","absoluteDateOrTimeOperatorNames","relativeDateOrTimeOperatorNames","ConditionValue","toExpression","Error","pastOperator","futureOperator","RelativeTimeValue","direction","DateDirections","PAST"],"sources":["../../../src/conditions/condition-operators.ts"],"sourcesContent":["import { ComponentType, ComponentDef } from '
|
1
|
+
{"version":3,"file":"condition-operators.js","names":["defaultOperators","is","inline","withDefaults","param","Object","assign","textBasedFieldCustomisations","lengthIs","absoluteDateTimeOperators","absoluteDateTime","relativeTimeOperators","units","relativeTime","customOperators","_exports","CheckboxesField","contains","reverseInline","not","NumberField","DateField","dateUnits","TimeField","timeUnits","DatePartsField","DateTimeField","dateTimeUnits","DateTimePartsField","TextField","MultilineTextField","EmailAddressField","getOperatorNames","fieldType","keys","getConditionals","sort","getExpression","fieldName","operator","value","expression","type","name","getOperatorConfig","field","formatValue","operatorDefinition","absoluteDateOrTimeOperatorNames","relativeDateOrTimeOperatorNames","ConditionValue","toExpression","Error","pastOperator","futureOperator","RelativeTimeValue","direction","DateDirections","PAST"],"sources":["../../../src/conditions/condition-operators.ts"],"sourcesContent":["import { type ComponentType, type ComponentDef } from '~/src/components/types'\nimport { ConditionValueAbstract } from '~/src/conditions/condition-value-abstract'\nimport {\n timeUnits,\n dateUnits,\n dateTimeUnits,\n ConditionValue,\n DateDirections,\n RelativeTimeValue\n} from '~/src/conditions/condition-values'\n\ntype Operator = '==' | '!=' | '>=' | '<=' | '<' | '>'\n\nconst defaultOperators = {\n is: inline('=='),\n 'is not': inline('!=')\n}\n\nfunction withDefaults<T>(param: T) {\n return Object.assign({}, param, defaultOperators)\n}\n\nconst textBasedFieldCustomisations = {\n 'is longer than': lengthIs('>'),\n 'is shorter than': lengthIs('<'),\n 'has length': lengthIs('==')\n}\n\nconst absoluteDateTimeOperators = {\n is: absoluteDateTime('=='),\n 'is not': absoluteDateTime('!='),\n 'is before': absoluteDateTime('<'),\n 'is after': absoluteDateTime('>')\n}\n\nconst relativeTimeOperators = (units) => ({\n 'is at least': relativeTime('<=', '>=', units),\n 'is at most': relativeTime('>=', '<=', units),\n 'is less than': relativeTime('>', '<', units),\n 'is more than': relativeTime('<', '>', units)\n})\n\nexport const customOperators = {\n CheckboxesField: {\n contains: reverseInline('in'),\n 'does not contain': not(reverseInline('in'))\n },\n NumberField: withDefaults({\n 'is at least': inline('>='),\n 'is at most': inline('<='),\n 'is less than': inline('<'),\n 'is more than': inline('>')\n }),\n DateField: Object.assign(\n {},\n absoluteDateTimeOperators,\n relativeTimeOperators(dateUnits)\n ),\n TimeField: Object.assign(\n {},\n absoluteDateTimeOperators,\n relativeTimeOperators(timeUnits)\n ),\n DatePartsField: Object.assign(\n {},\n absoluteDateTimeOperators,\n relativeTimeOperators(dateUnits)\n ),\n DateTimeField: Object.assign(\n {},\n absoluteDateTimeOperators,\n relativeTimeOperators(dateTimeUnits)\n ),\n DateTimePartsField: Object.assign(\n {},\n absoluteDateTimeOperators,\n relativeTimeOperators(dateTimeUnits)\n ),\n TextField: withDefaults(textBasedFieldCustomisations),\n MultilineTextField: withDefaults(textBasedFieldCustomisations),\n EmailAddressField: withDefaults(textBasedFieldCustomisations)\n}\n\nexport function getOperatorNames(fieldType) {\n return Object.keys(getConditionals(fieldType)).sort()\n}\n\nexport function getExpression(\n fieldType: ComponentType,\n fieldName: string,\n operator: string,\n value: ConditionValueAbstract\n) {\n return getConditionals(fieldType)[operator].expression(\n { type: fieldType, name: fieldName },\n value\n )\n}\n\nexport function getOperatorConfig(fieldType: ComponentType, operator) {\n return getConditionals(fieldType)[operator]\n}\n\nfunction getConditionals(fieldType: ComponentType) {\n return customOperators[fieldType] || defaultOperators\n}\n\nfunction inline(operator: Operator) {\n return {\n expression: (field: ComponentDef, value) =>\n `${field.name} ${operator} ${formatValue(field.type, value.value)}`\n }\n}\n\nfunction lengthIs(operator: Operator) {\n return {\n expression: (field: ComponentDef, value) =>\n `length(${field.name}) ${operator} ${value.value}`\n }\n}\n\nfunction reverseInline(operator: 'in') {\n return {\n expression: (field: ComponentDef, value) =>\n `${formatValue(field.type, value.value)} ${operator} ${field.name}`\n }\n}\n\nfunction not(operatorDefinition) {\n return {\n expression: (field: ComponentDef, value) =>\n `not (${operatorDefinition.expression(field, value)})`\n }\n}\n\nfunction formatValue(fieldType: ComponentType, value) {\n if (fieldType === 'NumberField' || fieldType === 'YesNoField') {\n return value\n }\n return `'${value}'`\n}\n\nexport const absoluteDateOrTimeOperatorNames = Object.keys(\n absoluteDateTimeOperators\n)\nexport const relativeDateOrTimeOperatorNames = Object.keys(\n relativeTimeOperators(dateTimeUnits)\n)\n\nfunction absoluteDateTime(operator: Operator) {\n return {\n expression: (field: ComponentDef, value) => {\n if (value instanceof ConditionValue) {\n return `${field.name} ${operator} '${value.toExpression()}'`\n }\n throw Error('only Value types are supported')\n }\n }\n}\n\nfunction relativeTime(pastOperator, futureOperator, units) {\n return {\n units,\n expression: (field: ComponentDef, value) => {\n if (value instanceof RelativeTimeValue) {\n const operator =\n value.direction === DateDirections.PAST\n ? pastOperator\n : futureOperator\n return `${field.name} ${operator} ${value.toExpression()}`\n }\n throw Error('time shift requires a TimeShiftValue')\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;EAaA,MAAMA,gBAAgB,GAAG;IACvBC,EAAE,EAAEC,MAAM,CAAC,IAAI,CAAC;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GAAG3C,MAAM,CAAC6B,IAAI,CACxDzB,yBACF,CAAC;EACM,MAAMwC,+BAA+B,GAAAlC,QAAA,CAAAkC,+BAAA,GAAG5C,MAAM,CAAC6B,IAAI,CACxDvB,qBAAqB,CAACgB,8BAAa,CACrC,CAAC;EAED,SAASjB,gBAAgBA,CAAC6B,QAAkB,EAAE;IAC5C,OAAO;MACLE,UAAU,EAAEA,CAACI,KAAmB,EAAEL,KAAK,KAAK;QAC1C,IAAIA,KAAK,YAAYU,+BAAc,EAAE;UACnC,OAAQ,GAAEL,KAAK,CAACF,IAAK,IAAGJ,QAAS,KAAIC,KAAK,CAACW,YAAY,CAAC,CAAE,GAAE;QAC9D;QACA,MAAMC,KAAK,CAAC,gCAAgC,CAAC;MAC/C;IACF,CAAC;EACH;EAEA,SAASvC,YAAYA,CAACwC,YAAY,EAAEC,cAAc,EAAE1C,KAAK,EAAE;IACzD,OAAO;MACLA,KAAK;MACL6B,UAAU,EAAEA,CAACI,KAAmB,EAAEL,KAAK,KAAK;QAC1C,IAAIA,KAAK,YAAYe,kCAAiB,EAAE;UACtC,MAAMhB,QAAQ,GACZC,KAAK,CAACgB,SAAS,KAAKC,+BAAc,CAACC,IAAI,GACnCL,YAAY,GACZC,cAAc;UACpB,OAAQ,GAAET,KAAK,CAACF,IAAK,IAAGJ,QAAS,IAAGC,KAAK,CAACW,YAAY,CAAC,CAAE,EAAC;QAC5D;QACA,MAAMC,KAAK,CAAC,sCAAsC,CAAC;MACrD;IACF,CAAC;EACH;AAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"condition-ref.js","names":["ConditionRef","ConditionAbstract","constructor","conditionName","conditionDisplayName","coordinator","_defineProperty","Error","asFirstCondition","_asFirstCondition","conditionString","conditionExpression","clone","_exports"],"sources":["../../../src/conditions/condition-ref.ts"],"sourcesContent":["import { ConditionAbstract } from '
|
1
|
+
{"version":3,"file":"condition-ref.js","names":["ConditionRef","ConditionAbstract","constructor","conditionName","conditionDisplayName","coordinator","_defineProperty","Error","asFirstCondition","_asFirstCondition","conditionString","conditionExpression","clone","_exports"],"sources":["../../../src/conditions/condition-ref.ts"],"sourcesContent":["import { ConditionAbstract } from '~/src/conditions/condition-abstract'\nimport { Coordinator } from '~/src/conditions/enums'\n\nexport class ConditionRef extends ConditionAbstract {\n conditionName: string\n conditionDisplayName: string\n\n constructor(\n conditionName: string,\n conditionDisplayName: string,\n coordinator: Coordinator | undefined\n ) {\n super(coordinator)\n\n if (typeof conditionName !== 'string') {\n throw Error(`condition name ${conditionName} is not valid`)\n }\n\n if (typeof conditionDisplayName !== 'string') {\n throw Error(`condition display name ${conditionDisplayName} is not valid`)\n }\n\n this.conditionName = conditionName\n this.conditionDisplayName = conditionDisplayName\n }\n\n asFirstCondition() {\n this._asFirstCondition()\n return this\n }\n\n conditionString() {\n return `'${this.conditionDisplayName}'`\n }\n\n conditionExpression() {\n return this.conditionName\n }\n\n clone() {\n return new ConditionRef(\n this.conditionName,\n this.conditionDisplayName,\n this.coordinator\n )\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;EAGO,MAAMA,YAAY,SAASC,oCAAiB,CAAC;IAIlDC,WAAWA,CACTC,aAAqB,EACrBC,oBAA4B,EAC5BC,WAAoC,EACpC;MACA,KAAK,CAACA,WAAW,CAAC;MAAAC,eAAA;MAAAA,eAAA;MAElB,IAAI,OAAOH,aAAa,KAAK,QAAQ,EAAE;QACrC,MAAMI,KAAK,CAAE,kBAAiBJ,aAAc,eAAc,CAAC;MAC7D;MAEA,IAAI,OAAOC,oBAAoB,KAAK,QAAQ,EAAE;QAC5C,MAAMG,KAAK,CAAE,0BAAyBH,oBAAqB,eAAc,CAAC;MAC5E;MAEA,IAAI,CAACD,aAAa,GAAGA,aAAa;MAClC,IAAI,CAACC,oBAAoB,GAAGA,oBAAoB;IAClD;IAEAI,gBAAgBA,CAAA,EAAG;MACjB,IAAI,CAACC,iBAAiB,CAAC,CAAC;MACxB,OAAO,IAAI;IACb;IAEAC,eAAeA,CAAA,EAAG;MAChB,OAAQ,IAAG,IAAI,CAACN,oBAAqB,GAAE;IACzC;IAEAO,mBAAmBA,CAAA,EAAG;MACpB,OAAO,IAAI,CAACR,aAAa;IAC3B;IAEAS,KAAKA,CAAA,EAAG;MACN,OAAO,IAAIZ,YAAY,CACrB,IAAI,CAACG,aAAa,EAClB,IAAI,CAACC,oBAAoB,EACzB,IAAI,CAACC,WACP,CAAC;IACH;EACF;EAACQ,QAAA,CAAAb,YAAA,GAAAA,YAAA;AAAA"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"condition-value-abstract.js","names":["ConditionValueAbstract","constructor","registration","_defineProperty","new","target","TypeError","Registration","type","toPresentationString","Error","toExpression","_exports"],"sources":["../../../src/conditions/condition-value-abstract.ts"],"sourcesContent":["import { Registration } from '
|
1
|
+
{"version":3,"file":"condition-value-abstract.js","names":["ConditionValueAbstract","constructor","registration","_defineProperty","new","target","TypeError","Registration","type","toPresentationString","Error","toExpression","_exports"],"sources":["../../../src/conditions/condition-value-abstract.ts"],"sourcesContent":["import { Registration } from '~/src/conditions/condition-value-registration'\n\nexport class ConditionValueAbstract {\n type: string\n\n constructor(registration: Registration) {\n if (new.target === ConditionValueAbstract) {\n throw new TypeError('Cannot construct ConditionValue instances directly')\n }\n\n if (!(registration instanceof Registration)) {\n throw new TypeError(\n 'You must register your value type! Call registerValueType!'\n )\n }\n\n this.type = registration.type\n }\n\n toPresentationString() {\n throw new Error(\n 'Unsupported Operation. Method toPresentationString have not been implemented'\n )\n }\n\n toExpression() {\n throw new Error(\n 'Unsupported Operation. Method toExpression have not been implemented'\n )\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;EAEO,MAAMA,sBAAsB,CAAC;IAGlCC,WAAWA,CAACC,YAA0B,EAAE;MAAAC,eAAA;MACtC,IAAIC,GAAG,CAACC,MAAM,KAAKL,sBAAsB,EAAE;QACzC,MAAM,IAAIM,SAAS,CAAC,oDAAoD,CAAC;MAC3E;MAEA,IAAI,EAAEJ,YAAY,YAAYK,wCAAY,CAAC,EAAE;QAC3C,MAAM,IAAID,SAAS,CACjB,4DACF,CAAC;MACH;MAEA,IAAI,CAACE,IAAI,GAAGN,YAAY,CAACM,IAAI;IAC/B;IAEAC,oBAAoBA,CAAA,EAAG;MACrB,MAAM,IAAIC,KAAK,CACb,8EACF,CAAC;IACH;IAEAC,YAAYA,CAAA,EAAG;MACb,MAAM,IAAID,KAAK,CACb,sEACF,CAAC;IACH;EACF;EAACE,QAAA,CAAAZ,sBAAA,GAAAA,sBAAA;AAAA"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"condition-values.js","names":["ConditionValue","ConditionValueAbstract","constructor","value","display","valueType","_defineProperty","Error","toPresentationString","toExpression","from","obj","clone","_exports","Registration","register","DateDirections","dateUnits","YEARS","MONTHS","DAYS","timeUnits","HOURS","MINUTES","SECONDS","dateTimeUnits","Object","assign","RelativeTimeValue","timePeriod","timeUnit","direction","timeOnly","relativeTimeValueType","values","map","unit","includes","PAST","Number","conditionValueFrom"],"sources":["../../../src/conditions/condition-values.ts"],"sourcesContent":["import { ConditionValueAbstract } from '
|
1
|
+
{"version":3,"file":"condition-values.js","names":["ConditionValue","ConditionValueAbstract","constructor","value","display","valueType","_defineProperty","Error","toPresentationString","toExpression","from","obj","clone","_exports","Registration","register","DateDirections","dateUnits","YEARS","MONTHS","DAYS","timeUnits","HOURS","MINUTES","SECONDS","dateTimeUnits","Object","assign","RelativeTimeValue","timePeriod","timeUnit","direction","timeOnly","relativeTimeValueType","values","map","unit","includes","PAST","Number","conditionValueFrom"],"sources":["../../../src/conditions/condition-values.ts"],"sourcesContent":["import { ConditionValueAbstract } from '~/src/conditions/condition-value-abstract'\nimport { Registration } from '~/src/conditions/condition-value-registration'\nimport {\n type DateTimeUnitValues,\n type DateUnits,\n type TimeUnits\n} from '~/src/conditions/types'\n\nexport class ConditionValue extends ConditionValueAbstract {\n value: string\n display: string\n\n constructor(value: string, display?: string) {\n super(valueType)\n\n if (!value || typeof value !== 'string') {\n throw Error(`value ${value} is not valid`)\n }\n\n if (display && typeof display !== 'string') {\n throw Error(`display ${display} is not valid`)\n }\n\n this.value = value\n this.display = display || value\n }\n\n toPresentationString() {\n return this.display\n }\n\n toExpression() {\n return this.value\n }\n\n static from(obj: { value: string; display?: string }) {\n return new ConditionValue(obj.value, obj.display)\n }\n\n clone() {\n return ConditionValue.from(this)\n }\n}\n\nconst valueType = Registration.register('Value', (obj) =>\n ConditionValue.from(obj)\n)\n\nexport enum DateDirections {\n FUTURE = 'in the future',\n PAST = 'in the past'\n}\n\nexport const dateUnits: 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 const timeUnits: 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 const dateTimeUnits: DateUnits & TimeUnits = Object.assign(\n {},\n dateUnits,\n timeUnits\n)\n\nexport class RelativeTimeValue extends ConditionValueAbstract {\n timePeriod: string\n timeUnit: DateTimeUnitValues\n direction: DateDirections\n timeOnly: boolean\n\n constructor(\n timePeriod: string,\n timeUnit: DateTimeUnitValues,\n direction: DateDirections,\n timeOnly = false\n ) {\n super(relativeTimeValueType)\n\n if (typeof timePeriod !== 'string') {\n throw Error(`time period ${timePeriod} is not valid`)\n }\n\n if (\n !Object.values(dateTimeUnits)\n .map((unit) => unit.value)\n .includes(timeUnit)\n ) {\n throw Error(`time unit ${timeUnit} is not valid`)\n }\n\n if (!Object.values(DateDirections).includes(direction)) {\n throw Error(`direction ${direction} is not valid`)\n }\n\n this.timePeriod = timePeriod\n this.timeUnit = timeUnit\n this.direction = direction\n this.timeOnly = timeOnly\n }\n\n toPresentationString() {\n return `${this.timePeriod} ${this.timeUnit} ${this.direction}`\n }\n\n toExpression(): string {\n const timePeriod =\n this.direction === DateDirections.PAST\n ? 0 - Number(this.timePeriod)\n : this.timePeriod\n return this.timeOnly\n ? `timeForComparison(${timePeriod}, '${this.timeUnit}')`\n : `dateForComparison(${timePeriod}, '${this.timeUnit}')`\n }\n\n static from(obj) {\n return new RelativeTimeValue(\n obj.timePeriod,\n obj.timeUnit,\n obj.direction,\n obj.timeOnly\n )\n }\n\n clone() {\n return RelativeTimeValue.from(this)\n }\n}\n\nexport const relativeTimeValueType = Registration.register(\n 'RelativeTime',\n (obj): RelativeTimeValue => RelativeTimeValue.from(obj)\n)\n\ntype ConditionValueFrom =\n | Pick<ConditionValue, 'type' | 'value' | 'display'>\n | Pick<\n RelativeTimeValue,\n 'type' | 'timePeriod' | 'timeUnit' | 'direction' | 'timeOnly'\n >\n\nexport function conditionValueFrom(obj: ConditionValueFrom) {\n return Registration.conditionValueFrom(obj)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;EAQO,MAAMA,cAAc,SAASC,8CAAsB,CAAC;IAIzDC,WAAWA,CAACC,KAAa,EAAEC,OAAgB,EAAE;MAC3C,KAAK,CAACC,SAAS,CAAC;MAAAC,eAAA;MAAAA,eAAA;MAEhB,IAAI,CAACH,KAAK,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE;QACvC,MAAMI,KAAK,CAAE,SAAQJ,KAAM,eAAc,CAAC;MAC5C;MAEA,IAAIC,OAAO,IAAI,OAAOA,OAAO,KAAK,QAAQ,EAAE;QAC1C,MAAMG,KAAK,CAAE,WAAUH,OAAQ,eAAc,CAAC;MAChD;MAEA,IAAI,CAACD,KAAK,GAAGA,KAAK;MAClB,IAAI,CAACC,OAAO,GAAGA,OAAO,IAAID,KAAK;IACjC;IAEAK,oBAAoBA,CAAA,EAAG;MACrB,OAAO,IAAI,CAACJ,OAAO;IACrB;IAEAK,YAAYA,CAAA,EAAG;MACb,OAAO,IAAI,CAACN,KAAK;IACnB;IAEA,OAAOO,IAAIA,CAACC,GAAwC,EAAE;MACpD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,OAAOpB,IAAIA,CAACC,GAAG,EAAE;MACf,OAAO,IAAIiB,iBAAiB,CAC1BjB,GAAG,CAACkB,UAAU,EACdlB,GAAG,CAACmB,QAAQ,EACZnB,GAAG,CAACoB,SAAS,EACbpB,GAAG,CAACqB,QACN,CAAC;IACH;IAEApB,KAAKA,CAAA,EAAG;MACN,OAAOgB,iBAAiB,CAAClB,IAAI,CAAC,IAAI,CAAC;IACrC;EACF;EAACG,QAAA,CAAAe,iBAAA,GAAAA,iBAAA;EAEM,MAAMK,qBAAqB,GAAApB,QAAA,CAAAoB,qBAAA,GAAGnB,wCAAY,CAACC,QAAQ,CACxD,cAAc,EACbJ,GAAG,IAAwBiB,iBAAiB,CAAClB,IAAI,CAACC,GAAG,CACxD,CAAC;EASM,SAAS6B,kBAAkBA,CAAC7B,GAAuB,EAAE;IAC1D,OAAOG,wCAAY,CAAC0B,kBAAkB,CAAC7B,GAAG,CAAC;EAC7C;AAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"condition.js","names":["Condition","ConditionAbstract","constructor","field","operator","value","coordinator","_defineProperty","ConditionField","Error","ConditionValueAbstract","asFirstCondition","_asFirstCondition","conditionString","display","toPresentationString","conditionExpression","getExpression","type","name","clone","from","_exports"],"sources":["../../../src/conditions/condition.ts"],"sourcesContent":["import { ConditionField } from '
|
1
|
+
{"version":3,"file":"condition.js","names":["Condition","ConditionAbstract","constructor","field","operator","value","coordinator","_defineProperty","ConditionField","Error","ConditionValueAbstract","asFirstCondition","_asFirstCondition","conditionString","display","toPresentationString","conditionExpression","getExpression","type","name","clone","from","_exports"],"sources":["../../../src/conditions/condition.ts"],"sourcesContent":["import { ConditionField } from '~/src/conditions/condition-field'\nimport { ConditionAbstract } from '~/src/conditions/condition-abstract'\nimport { getExpression } from '~/src/conditions/condition-operators'\nimport {\n ConditionValue,\n RelativeTimeValue\n} from '~/src/conditions/condition-values'\nimport { ConditionValueAbstract } from '~/src/conditions/condition-value-abstract'\nimport { Coordinator } from '~/src/conditions/enums'\n\nexport class Condition extends ConditionAbstract {\n field: ConditionField\n operator: string\n value: ConditionValue | RelativeTimeValue\n\n constructor(\n field: ConditionField,\n operator: string,\n value: ConditionValue | RelativeTimeValue,\n coordinator?: Coordinator\n ) {\n super(coordinator)\n\n if (!(field instanceof ConditionField)) {\n throw Error(`field ${field} is not a valid ConditionField object`)\n }\n if (typeof operator !== 'string') {\n throw Error(`operator ${operator} is not a valid operator`)\n }\n if (!(value instanceof ConditionValueAbstract)) {\n throw Error(`value ${value} is not a valid value type`)\n }\n\n this.field = field\n this.operator = operator\n this.value = value\n }\n\n asFirstCondition() {\n this._asFirstCondition()\n return this\n }\n\n conditionString() {\n return `'${this.field.display}' ${\n this.operator\n } '${this.value.toPresentationString()}'`\n }\n\n conditionExpression() {\n return getExpression(\n this.field.type,\n this.field.name,\n this.operator,\n this.value\n )\n }\n\n clone() {\n return new Condition(\n ConditionField.from(this.field),\n this.operator,\n this.value.clone(),\n this.coordinator\n )\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;EAUO,MAAMA,SAAS,SAASC,oCAAiB,CAAC;IAK/CC,WAAWA,CACTC,KAAqB,EACrBC,QAAgB,EAChBC,KAAyC,EACzCC,WAAyB,EACzB;MACA,KAAK,CAACA,WAAW,CAAC;MAAAC,eAAA;MAAAA,eAAA;MAAAA,eAAA;MAElB,IAAI,EAAEJ,KAAK,YAAYK,8BAAc,CAAC,EAAE;QACtC,MAAMC,KAAK,CAAE,SAAQN,KAAM,uCAAsC,CAAC;MACpE;MACA,IAAI,OAAOC,QAAQ,KAAK,QAAQ,EAAE;QAChC,MAAMK,KAAK,CAAE,YAAWL,QAAS,0BAAyB,CAAC;MAC7D;MACA,IAAI,EAAEC,KAAK,YAAYK,8CAAsB,CAAC,EAAE;QAC9C,MAAMD,KAAK,CAAE,SAAQJ,KAAM,4BAA2B,CAAC;MACzD;MAEA,IAAI,CAACF,KAAK,GAAGA,KAAK;MAClB,IAAI,CAACC,QAAQ,GAAGA,QAAQ;MACxB,IAAI,CAACC,KAAK,GAAGA,KAAK;IACpB;IAEAM,gBAAgBA,CAAA,EAAG;MACjB,IAAI,CAACC,iBAAiB,CAAC,CAAC;MACxB,OAAO,IAAI;IACb;IAEAC,eAAeA,CAAA,EAAG;MAChB,OAAQ,IAAG,IAAI,CAACV,KAAK,CAACW,OAAQ,KAC5B,IAAI,CAACV,QACN,KAAI,IAAI,CAACC,KAAK,CAACU,oBAAoB,CAAC,CAAE,GAAE;IAC3C;IAEAC,mBAAmBA,CAAA,EAAG;MACpB,OAAO,IAAAC,iCAAa,EAClB,IAAI,CAACd,KAAK,CAACe,IAAI,EACf,IAAI,CAACf,KAAK,CAACgB,IAAI,EACf,IAAI,CAACf,QAAQ,EACb,IAAI,CAACC,KACP,CAAC;IACH;IAEAe,KAAKA,CAAA,EAAG;MACN,OAAO,IAAIpB,SAAS,CAClBQ,8BAAc,CAACa,IAAI,CAAC,IAAI,CAAClB,KAAK,CAAC,EAC/B,IAAI,CAACC,QAAQ,EACb,IAAI,CAACC,KAAK,CAACe,KAAK,CAAC,CAAC,EAClB,IAAI,CAACd,WACP,CAAC;IACH;EACF;EAACgB,QAAA,CAAAtB,SAAA,GAAAA,SAAA;AAAA"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../src/conditions/index.ts"],"sourcesContent":["export {\n getExpression,\n getOperatorConfig,\n getOperatorNames,\n absoluteDateOrTimeOperatorNames,\n relativeDateOrTimeOperatorNames\n} from '
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/conditions/index.ts"],"sourcesContent":["export {\n getExpression,\n getOperatorConfig,\n getOperatorNames,\n absoluteDateOrTimeOperatorNames,\n relativeDateOrTimeOperatorNames\n} from '~/src/conditions/condition-operators'\n\nexport {\n timeUnits,\n dateUnits,\n dateTimeUnits,\n ConditionValue,\n DateDirections,\n RelativeTimeValue,\n conditionValueFrom\n} from '~/src/conditions/condition-values'\n\nexport { ConditionField } from '~/src/conditions/condition-field'\nexport { Condition } from '~/src/conditions/condition'\nexport { ConditionRef } from '~/src/conditions/condition-ref'\nexport { ConditionGroup } from '~/src/conditions/condition-group'\nexport { ConditionsModel } from '~/src/conditions/condition-model'\nexport { ConditionGroupDef } from '~/src/conditions/condition-group-def'\nexport { toExpression, toPresentationString } from '~/src/conditions/helpers'\n\nexport { Coordinator } from '~/src/conditions/enums'\n"],"mappings":""}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"inline-condition-model.js","names":["coordinators","_exports","AND","OR","_groupedConditions","WeakMap","_userGroupedConditions","_conditionName","ConditionsModel","constructor","_classPrivateFieldInitSpec","_classPrivateFieldSet","clone","toReturn","_classPrivateFieldGet","map","it","clear","undefined","name","add","condition","coordinatorExpected","length","getCoordinator","Error","push","_applyGroups","replace","index","splice","remove","indexes","filter","_condition","includes","asFirstCondition","addGroups","groupDefs","_group","splitGroup","_ungroup","moveEarlier","switchCoordinators","moveLater","setCoordinator","asPerUserGroupings","hasConditions","lastIndex","toPresentationString","join","toExpression","userGroupedConditions","correctedUserGroups","ConditionGroup","conditions","_autoGroupDefs","reduce","groups","groupDef","find","contains","startsWith","groupConditions","applyTo","splitIndex","isGroup","copy","getGroupedConditions","orPositions","forEach","hasAnd","hasOr","start","position","GroupDef","thisIsTheLastOr","thereAreMoreConditions","toJSON","from","obj","conditionFrom","conditionName","ConditionRef","conditionDisplayName","coordinator","Condition","Field","field","operator","valueFrom","value","first","last","_defineProperty","Array","isArray","coordinatorString","conditionString","conditionExpression","type","display","ComponentTypes","componentType","AbstractCondition","Object","values","_asFirstCondition","AbstractConditionValue","getExpression"],"sources":["../../../src/conditions/inline-condition-model.ts"],"sourcesContent":["import { ComponentTypes } from '../components/component-types'\nimport { getExpression } from './inline-condition-operators'\nimport { AbstractConditionValue, valueFrom } from './inline-condition-values'\n\nexport const coordinators = {\n AND: 'and',\n OR: 'or'\n}\n\nexport class ConditionsModel {\n #groupedConditions\n #userGroupedConditions\n #conditionName\n\n constructor() {\n this.#groupedConditions = []\n this.#userGroupedConditions = []\n }\n\n clone() {\n const toReturn = new ConditionsModel()\n toReturn.#groupedConditions = this.#groupedConditions.map((it) =>\n it.clone()\n )\n toReturn.#userGroupedConditions = this.#userGroupedConditions.map((it) =>\n it.clone()\n )\n toReturn.#conditionName = this.#conditionName\n return toReturn\n }\n\n clear() {\n this.#userGroupedConditions = []\n this.#groupedConditions = []\n this.#conditionName = undefined\n return this\n }\n\n set name(name) {\n this.#conditionName = name\n }\n\n get name() {\n return this.#conditionName\n }\n\n add(condition) {\n const coordinatorExpected = this.#userGroupedConditions.length !== 0\n if (condition.getCoordinator() && !coordinatorExpected) {\n throw Error('No coordinator allowed on the first condition')\n } else if (!condition.getCoordinator() && coordinatorExpected) {\n throw Error('Coordinator must be present on subsequent conditions')\n }\n this.#userGroupedConditions.push(condition)\n this.#groupedConditions = this._applyGroups(this.#userGroupedConditions)\n return this\n }\n\n replace(index, condition) {\n const coordinatorExpected = index !== 0\n if (condition.getCoordinator() && !coordinatorExpected) {\n throw Error('No coordinator allowed on the first condition')\n } else if (!condition.getCoordinator() && coordinatorExpected) {\n throw Error('Coordinator must be present on subsequent conditions')\n } else if (index >= this.#userGroupedConditions.length) {\n throw Error(\n `Cannot replace condition ${index} as no such condition exists`\n )\n }\n this.#userGroupedConditions.splice(index, 1, condition)\n this.#groupedConditions = this._applyGroups(this.#userGroupedConditions)\n return this\n }\n\n remove(indexes) {\n this.#userGroupedConditions = this.#userGroupedConditions\n .filter((_condition, index) => !indexes.includes(index))\n .map((condition, index) =>\n index === 0 ? condition.asFirstCondition() : condition\n )\n\n this.#groupedConditions = this._applyGroups(this.#userGroupedConditions)\n return this\n }\n\n addGroups(groupDefs) {\n this.#userGroupedConditions = this._group(\n this.#userGroupedConditions,\n groupDefs\n )\n this.#groupedConditions = this._applyGroups(this.#userGroupedConditions)\n return this\n }\n\n splitGroup(index) {\n this.#userGroupedConditions = this._ungroup(\n this.#userGroupedConditions,\n index\n )\n this.#groupedConditions = this._applyGroups(this.#userGroupedConditions)\n return this\n }\n\n moveEarlier(index) {\n if (index > 0 && index < this.#userGroupedConditions.length) {\n this.#userGroupedConditions.splice(\n index - 1,\n 0,\n this.#userGroupedConditions.splice(index, 1)[0]\n )\n if (index === 1) {\n this.switchCoordinators()\n }\n this.#groupedConditions = this._applyGroups(this.#userGroupedConditions)\n }\n return this\n }\n\n moveLater(index) {\n if (index >= 0 && index < this.#userGroupedConditions.length - 1) {\n this.#userGroupedConditions.splice(\n index + 1,\n 0,\n this.#userGroupedConditions.splice(index, 1)[0]\n )\n if (index === 0) {\n this.switchCoordinators()\n }\n this.#groupedConditions = this._applyGroups(this.#userGroupedConditions)\n }\n return this\n }\n\n switchCoordinators() {\n this.#userGroupedConditions[1].setCoordinator(\n this.#userGroupedConditions[0].getCoordinator()\n )\n this.#userGroupedConditions[0].setCoordinator(undefined)\n }\n\n get asPerUserGroupings() {\n return [...this.#userGroupedConditions]\n }\n\n get hasConditions() {\n return this.#userGroupedConditions.length > 0\n }\n\n get lastIndex() {\n return this.#userGroupedConditions.length - 1\n }\n\n toPresentationString() {\n return this.#groupedConditions\n .map((condition) => toPresentationString(condition))\n .join(' ')\n }\n\n toExpression() {\n return this.#groupedConditions\n .map((condition) => toExpression(condition))\n .join(' ')\n }\n\n _applyGroups(userGroupedConditions) {\n const correctedUserGroups = userGroupedConditions.map((condition) =>\n condition instanceof ConditionGroup && condition.conditions.length > 2\n ? new ConditionGroup(\n this._group(\n condition.conditions,\n this._autoGroupDefs(condition.conditions)\n )\n )\n : condition\n )\n return this._group(\n correctedUserGroups,\n this._autoGroupDefs(correctedUserGroups)\n )\n }\n\n _group(conditions, groupDefs) {\n return conditions.reduce((groups, condition, index, conditions) => {\n const groupDef = groupDefs.find((groupDef) => groupDef.contains(index))\n if (groupDef) {\n if (groupDef.startsWith(index)) {\n const groupConditions = groupDef.applyTo(conditions)\n groups.push(new ConditionGroup(groupConditions))\n }\n } else {\n groups.push(condition)\n }\n return groups\n }, [])\n }\n\n _ungroup(conditions, splitIndex) {\n if (conditions[splitIndex].isGroup()) {\n const copy = [...conditions]\n copy.splice(\n splitIndex,\n 1,\n ...conditions[splitIndex].getGroupedConditions()\n )\n return copy\n }\n return conditions\n }\n\n _autoGroupDefs(conditions) {\n const orPositions: number[] = []\n conditions.forEach((condition, index) => {\n if (condition.getCoordinator() === coordinators.OR) {\n orPositions.push(index)\n }\n })\n const hasAnd = !!conditions.find(\n (condition) => condition.getCoordinator() === coordinators.AND\n )\n const hasOr = orPositions.length > 0\n if (hasAnd && hasOr) {\n let start = 0\n const groupDefs: GroupDef[] = []\n orPositions.forEach((position, index) => {\n if (start < position - 1) {\n groupDefs.push(new GroupDef(start, position - 1))\n }\n const thisIsTheLastOr = orPositions.length === index + 1\n const thereAreMoreConditions = conditions.length - 1 > position\n if (thisIsTheLastOr && thereAreMoreConditions) {\n groupDefs.push(new GroupDef(position, conditions.length - 1))\n }\n start = position\n })\n return groupDefs\n }\n return []\n }\n\n toJSON() {\n const name = this.#conditionName\n const conditions = this.#userGroupedConditions\n return {\n name,\n conditions: conditions.map((it) => it.clone())\n }\n }\n\n static from(obj) {\n if (obj instanceof ConditionsModel) {\n return obj\n }\n const toReturn = new ConditionsModel()\n toReturn.#conditionName = obj.name\n toReturn.#userGroupedConditions = obj.conditions.map((it) =>\n conditionFrom(it)\n )\n toReturn.#groupedConditions = toReturn._applyGroups(\n toReturn.#userGroupedConditions\n )\n return toReturn\n }\n}\n\nfunction conditionFrom(it) {\n if (it.conditions) {\n return new ConditionGroup(\n it.conditions.map((condition) => conditionFrom(condition))\n )\n }\n if (it.conditionName) {\n return new ConditionRef(\n it.conditionName,\n it.conditionDisplayName,\n it.coordinator\n )\n }\n return new Condition(\n Field.from(it.field),\n it.operator,\n valueFrom(it.value),\n it.coordinator\n )\n}\n\nexport class GroupDef {\n first\n last\n\n constructor(first, last) {\n if (typeof first !== 'number' || typeof last !== 'number') {\n throw Error(`Cannot construct a group from ${first} and ${last}`)\n } else if (first >= last) {\n throw Error(`Last (${last}) must be greater than first (${first})`)\n }\n this.first = first\n this.last = last\n }\n\n contains(index) {\n return this.first <= index && this.last >= index\n }\n\n startsWith(index) {\n return this.first === index\n }\n\n applyTo(conditions) {\n return [...conditions].splice(this.first, this.last - this.first + 1)\n }\n}\n\nclass ConditionGroup {\n conditions\n\n constructor(conditions) {\n if (!Array.isArray(conditions) || conditions.length < 2) {\n throw Error('Cannot construct a condition group from a single condition')\n }\n this.conditions = conditions\n }\n\n coordinatorString() {\n return this.conditions[0].coordinatorString()\n }\n\n conditionString() {\n const copy = [...this.conditions]\n copy.splice(0, 1)\n return `(${this.conditions[0].conditionString()} ${copy\n .map((condition) => toPresentationString(condition))\n .join(' ')})`\n }\n\n conditionExpression() {\n const copy = [...this.conditions]\n copy.splice(0, 1)\n return `(${this.conditions[0].conditionExpression()} ${copy\n .map((condition) => toExpression(condition))\n .join(' ')})`\n }\n\n asFirstCondition() {\n this.conditions[0].asFirstCondition()\n return this\n }\n\n getCoordinator() {\n return this.conditions[0].getCoordinator()\n }\n\n setCoordinator(coordinator) {\n this.conditions[0].setCoordinator(coordinator)\n }\n\n isGroup() {\n return true\n }\n\n getGroupedConditions() {\n return this.conditions.map((condition) => condition.clone())\n }\n\n clone() {\n return new ConditionGroup(\n this.conditions.map((condition) => condition.clone())\n )\n }\n}\n\nexport function toPresentationString(condition) {\n return `${condition.coordinatorString()}${condition.conditionString()}`\n}\n\nexport function toExpression(condition) {\n return `${condition.coordinatorString()}${condition.conditionExpression()}`\n}\n\nexport class Field {\n name\n type\n display\n\n constructor(name, type, display) {\n if (!name || typeof name !== 'string') {\n throw Error(`name ${name} is not valid`)\n }\n if (!ComponentTypes.find((componentType) => componentType.name === type)) {\n throw Error(`type ${type} is not valid`)\n }\n if (!display || typeof display !== 'string') {\n throw Error(`display ${display} is not valid`)\n }\n this.name = name\n this.type = type\n this.display = display\n }\n\n static from(obj) {\n return new Field(obj.name, obj.type, obj.display)\n }\n}\n\nclass AbstractCondition {\n coordinator\n\n constructor(coordinator) {\n if (coordinator && !Object.values(coordinators).includes(coordinator)) {\n throw Error(`coordinator ${coordinator} is not a valid coordinator`)\n }\n this.coordinator = coordinator\n }\n\n coordinatorString() {\n return this.coordinator ? `${this.coordinator} ` : ''\n }\n\n getCoordinator() {\n return this.coordinator\n }\n\n setCoordinator(coordinator) {\n this.coordinator = coordinator\n }\n\n isGroup() {\n return false\n }\n\n getGroupedConditions() {\n return [this]\n }\n\n _asFirstCondition() {\n delete this.coordinator\n }\n\n asFirstCondition() {\n throw Error(\n 'Implement on the subclass (Why do we have to have this method here at all?!)'\n )\n }\n\n clone() {\n throw Error(\n 'Implement on the subclass (Why do we have to have this method here at all?!)'\n )\n }\n\n conditionString() {\n throw Error(\n 'Implement on the subclass (Why do we have to have this method here at all?!)'\n )\n }\n\n conditionExpression() {\n throw Error(\n 'Implement on the subclass (Why do we have to have this method here at all?!)'\n )\n }\n}\n\nexport class Condition extends AbstractCondition {\n field\n operator\n value\n\n constructor(field, operator, value, coordinator) {\n super(coordinator)\n if (!(field instanceof Field)) {\n throw Error(`field ${field} is not a valid Field object`)\n }\n if (typeof operator !== 'string') {\n throw Error(`operator ${operator} is not a valid operator`)\n }\n if (!(value instanceof AbstractConditionValue)) {\n throw Error(`value ${value} is not a valid value type`)\n }\n this.field = field\n this.operator = operator\n this.value = value\n }\n\n asFirstCondition() {\n this._asFirstCondition()\n return this\n }\n\n conditionString() {\n return `'${this.field.display}' ${\n this.operator\n } '${this.value.toPresentationString()}'`\n }\n\n conditionExpression() {\n return getExpression(\n this.field.type,\n this.field.name,\n this.operator,\n this.value\n )\n }\n\n clone() {\n return new Condition(\n Field.from(this.field),\n this.operator,\n this.value.clone(),\n this.coordinator\n )\n }\n}\n\nexport class ConditionRef extends AbstractCondition {\n conditionName\n conditionDisplayName\n\n constructor(conditionName, conditionDisplayName, coordinator) {\n super(coordinator)\n if (typeof conditionName !== 'string') {\n throw Error(`condition name ${conditionName} is not valid`)\n }\n if (typeof conditionDisplayName !== 'string') {\n throw Error(`condition display name ${conditionDisplayName} is not valid`)\n }\n this.conditionName = conditionName\n this.conditionDisplayName = conditionDisplayName\n }\n\n asFirstCondition() {\n this._asFirstCondition()\n return this\n }\n\n conditionString() {\n return `'${this.conditionDisplayName}'`\n }\n\n conditionExpression() {\n return this.conditionName\n }\n\n clone() {\n return new ConditionRef(\n this.conditionName,\n this.conditionDisplayName,\n this.coordinator\n )\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;EAIO,MAAMA,YAAY,GAAAC,QAAA,CAAAD,YAAA,GAAG;IAC1BE,GAAG,EAAE,KAAK;IACVC,EAAE,EAAE;EACN,CAAC;EAAA,IAAAC,kBAAA,oBAAAC,OAAA;EAAA,IAAAC,sBAAA,oBAAAD,OAAA;EAAA,IAAAE,cAAA,oBAAAF,OAAA;EAEM,MAAMG,eAAe,CAAC;IAK3BC,WAAWA,CAAA,EAAG;MAAAC,0BAAA,OAAAN,kBAAA;MAAAM,0BAAA,OAAAJ,sBAAA;MAAAI,0BAAA,OAAAH,cAAA;MACZI,qBAAA,CAAAP,kBAAA,MAAI,EAAsB,EAAE;MAC5BO,qBAAA,CAAAL,sBAAA,MAAI,EAA0B,EAAE;IAClC;IAEAM,KAAKA,CAAA,EAAG;MACN,MAAMC,QAAQ,GAAG,IAAIL,eAAe,CAAC,CAAC;MACtCG,qBAAA,CAAAP,kBAAA,EAAAS,QAAQ,EAAsBC,qBAAA,CAAAV,kBAAA,MAAI,EAAoBW,GAAG,CAAEC,EAAE,IAC3DA,EAAE,CAACJ,KAAK,CAAC,CACX,CAAC;MACDD,qBAAA,CAAAL,sBAAA,EAAAO,QAAQ,EAA0BC,qBAAA,CAAAR,sBAAA,MAAI,EAAwBS,GAAG,CAAEC,EAAE,IACnEA,EAAE,CAACJ,KAAK,CAAC,CACX,CAAC;MACDD,qBAAA,CAAAJ,cAAA,EAAAM,QAAQ,EAAAC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
1
|
+
{"version":3,"file":"inline-condition-model.js","names":["coordinators","_exports","AND","OR","_groupedConditions","WeakMap","_userGroupedConditions","_conditionName","ConditionsModel","constructor","_classPrivateFieldInitSpec","_classPrivateFieldSet","clone","toReturn","_classPrivateFieldGet","map","it","clear","undefined","name","add","condition","coordinatorExpected","length","getCoordinator","Error","push","_applyGroups","replace","index","splice","remove","indexes","filter","_condition","includes","asFirstCondition","addGroups","groupDefs","_group","splitGroup","_ungroup","moveEarlier","switchCoordinators","moveLater","setCoordinator","asPerUserGroupings","hasConditions","lastIndex","toPresentationString","join","toExpression","userGroupedConditions","correctedUserGroups","ConditionGroup","conditions","_autoGroupDefs","reduce","groups","groupDef","find","contains","startsWith","groupConditions","applyTo","splitIndex","isGroup","copy","getGroupedConditions","orPositions","forEach","hasAnd","hasOr","start","position","GroupDef","thisIsTheLastOr","thereAreMoreConditions","toJSON","from","obj","conditionFrom","conditionName","ConditionRef","conditionDisplayName","coordinator","Condition","Field","field","operator","valueFrom","value","first","last","_defineProperty","Array","isArray","coordinatorString","conditionString","conditionExpression","type","display","ComponentTypes","componentType","AbstractCondition","Object","values","_asFirstCondition","AbstractConditionValue","getExpression"],"sources":["../../../src/conditions/inline-condition-model.ts"],"sourcesContent":["import { ComponentTypes } from '~/src/components/component-types'\nimport { getExpression } from '~/src/conditions/inline-condition-operators'\nimport {\n AbstractConditionValue,\n valueFrom\n} from '~/src/conditions/inline-condition-values'\n\nexport const coordinators = {\n AND: 'and',\n OR: 'or'\n}\n\nexport class ConditionsModel {\n #groupedConditions\n #userGroupedConditions\n #conditionName\n\n constructor() {\n this.#groupedConditions = []\n this.#userGroupedConditions = []\n }\n\n clone() {\n const toReturn = new ConditionsModel()\n toReturn.#groupedConditions = this.#groupedConditions.map((it) =>\n it.clone()\n )\n toReturn.#userGroupedConditions = this.#userGroupedConditions.map((it) =>\n it.clone()\n )\n toReturn.#conditionName = this.#conditionName\n return toReturn\n }\n\n clear() {\n this.#userGroupedConditions = []\n this.#groupedConditions = []\n this.#conditionName = undefined\n return this\n }\n\n set name(name) {\n this.#conditionName = name\n }\n\n get name() {\n return this.#conditionName\n }\n\n add(condition) {\n const coordinatorExpected = this.#userGroupedConditions.length !== 0\n if (condition.getCoordinator() && !coordinatorExpected) {\n throw Error('No coordinator allowed on the first condition')\n } else if (!condition.getCoordinator() && coordinatorExpected) {\n throw Error('Coordinator must be present on subsequent conditions')\n }\n this.#userGroupedConditions.push(condition)\n this.#groupedConditions = this._applyGroups(this.#userGroupedConditions)\n return this\n }\n\n replace(index, condition) {\n const coordinatorExpected = index !== 0\n if (condition.getCoordinator() && !coordinatorExpected) {\n throw Error('No coordinator allowed on the first condition')\n } else if (!condition.getCoordinator() && coordinatorExpected) {\n throw Error('Coordinator must be present on subsequent conditions')\n } else if (index >= this.#userGroupedConditions.length) {\n throw Error(\n `Cannot replace condition ${index} as no such condition exists`\n )\n }\n this.#userGroupedConditions.splice(index, 1, condition)\n this.#groupedConditions = this._applyGroups(this.#userGroupedConditions)\n return this\n }\n\n remove(indexes) {\n this.#userGroupedConditions = this.#userGroupedConditions\n .filter((_condition, index) => !indexes.includes(index))\n .map((condition, index) =>\n index === 0 ? condition.asFirstCondition() : condition\n )\n\n this.#groupedConditions = this._applyGroups(this.#userGroupedConditions)\n return this\n }\n\n addGroups(groupDefs) {\n this.#userGroupedConditions = this._group(\n this.#userGroupedConditions,\n groupDefs\n )\n this.#groupedConditions = this._applyGroups(this.#userGroupedConditions)\n return this\n }\n\n splitGroup(index) {\n this.#userGroupedConditions = this._ungroup(\n this.#userGroupedConditions,\n index\n )\n this.#groupedConditions = this._applyGroups(this.#userGroupedConditions)\n return this\n }\n\n moveEarlier(index) {\n if (index > 0 && index < this.#userGroupedConditions.length) {\n this.#userGroupedConditions.splice(\n index - 1,\n 0,\n this.#userGroupedConditions.splice(index, 1)[0]\n )\n if (index === 1) {\n this.switchCoordinators()\n }\n this.#groupedConditions = this._applyGroups(this.#userGroupedConditions)\n }\n return this\n }\n\n moveLater(index) {\n if (index >= 0 && index < this.#userGroupedConditions.length - 1) {\n this.#userGroupedConditions.splice(\n index + 1,\n 0,\n this.#userGroupedConditions.splice(index, 1)[0]\n )\n if (index === 0) {\n this.switchCoordinators()\n }\n this.#groupedConditions = this._applyGroups(this.#userGroupedConditions)\n }\n return this\n }\n\n switchCoordinators() {\n this.#userGroupedConditions[1].setCoordinator(\n this.#userGroupedConditions[0].getCoordinator()\n )\n this.#userGroupedConditions[0].setCoordinator(undefined)\n }\n\n get asPerUserGroupings() {\n return [...this.#userGroupedConditions]\n }\n\n get hasConditions() {\n return this.#userGroupedConditions.length > 0\n }\n\n get lastIndex() {\n return this.#userGroupedConditions.length - 1\n }\n\n toPresentationString() {\n return this.#groupedConditions\n .map((condition) => toPresentationString(condition))\n .join(' ')\n }\n\n toExpression() {\n return this.#groupedConditions\n .map((condition) => toExpression(condition))\n .join(' ')\n }\n\n _applyGroups(userGroupedConditions) {\n const correctedUserGroups = userGroupedConditions.map((condition) =>\n condition instanceof ConditionGroup && condition.conditions.length > 2\n ? new ConditionGroup(\n this._group(\n condition.conditions,\n this._autoGroupDefs(condition.conditions)\n )\n )\n : condition\n )\n return this._group(\n correctedUserGroups,\n this._autoGroupDefs(correctedUserGroups)\n )\n }\n\n _group(conditions, groupDefs) {\n return conditions.reduce((groups, condition, index, conditions) => {\n const groupDef = groupDefs.find((groupDef) => groupDef.contains(index))\n if (groupDef) {\n if (groupDef.startsWith(index)) {\n const groupConditions = groupDef.applyTo(conditions)\n groups.push(new ConditionGroup(groupConditions))\n }\n } else {\n groups.push(condition)\n }\n return groups\n }, [])\n }\n\n _ungroup(conditions, splitIndex) {\n if (conditions[splitIndex].isGroup()) {\n const copy = [...conditions]\n copy.splice(\n splitIndex,\n 1,\n ...conditions[splitIndex].getGroupedConditions()\n )\n return copy\n }\n return conditions\n }\n\n _autoGroupDefs(conditions) {\n const orPositions: number[] = []\n conditions.forEach((condition, index) => {\n if (condition.getCoordinator() === coordinators.OR) {\n orPositions.push(index)\n }\n })\n const hasAnd = !!conditions.find(\n (condition) => condition.getCoordinator() === coordinators.AND\n )\n const hasOr = orPositions.length > 0\n if (hasAnd && hasOr) {\n let start = 0\n const groupDefs: GroupDef[] = []\n orPositions.forEach((position, index) => {\n if (start < position - 1) {\n groupDefs.push(new GroupDef(start, position - 1))\n }\n const thisIsTheLastOr = orPositions.length === index + 1\n const thereAreMoreConditions = conditions.length - 1 > position\n if (thisIsTheLastOr && thereAreMoreConditions) {\n groupDefs.push(new GroupDef(position, conditions.length - 1))\n }\n start = position\n })\n return groupDefs\n }\n return []\n }\n\n toJSON() {\n const name = this.#conditionName\n const conditions = this.#userGroupedConditions\n return {\n name,\n conditions: conditions.map((it) => it.clone())\n }\n }\n\n static from(obj) {\n if (obj instanceof ConditionsModel) {\n return obj\n }\n const toReturn = new ConditionsModel()\n toReturn.#conditionName = obj.name\n toReturn.#userGroupedConditions = obj.conditions.map((it) =>\n conditionFrom(it)\n )\n toReturn.#groupedConditions = toReturn._applyGroups(\n toReturn.#userGroupedConditions\n )\n return toReturn\n }\n}\n\nfunction conditionFrom(it) {\n if (it.conditions) {\n return new ConditionGroup(\n it.conditions.map((condition) => conditionFrom(condition))\n )\n }\n if (it.conditionName) {\n return new ConditionRef(\n it.conditionName,\n it.conditionDisplayName,\n it.coordinator\n )\n }\n return new Condition(\n Field.from(it.field),\n it.operator,\n valueFrom(it.value),\n it.coordinator\n )\n}\n\nexport class GroupDef {\n first\n last\n\n constructor(first, last) {\n if (typeof first !== 'number' || typeof last !== 'number') {\n throw Error(`Cannot construct a group from ${first} and ${last}`)\n } else if (first >= last) {\n throw Error(`Last (${last}) must be greater than first (${first})`)\n }\n this.first = first\n this.last = last\n }\n\n contains(index) {\n return this.first <= index && this.last >= index\n }\n\n startsWith(index) {\n return this.first === index\n }\n\n applyTo(conditions) {\n return [...conditions].splice(this.first, this.last - this.first + 1)\n }\n}\n\nclass ConditionGroup {\n conditions\n\n constructor(conditions) {\n if (!Array.isArray(conditions) || conditions.length < 2) {\n throw Error('Cannot construct a condition group from a single condition')\n }\n this.conditions = conditions\n }\n\n coordinatorString() {\n return this.conditions[0].coordinatorString()\n }\n\n conditionString() {\n const copy = [...this.conditions]\n copy.splice(0, 1)\n return `(${this.conditions[0].conditionString()} ${copy\n .map((condition) => toPresentationString(condition))\n .join(' ')})`\n }\n\n conditionExpression() {\n const copy = [...this.conditions]\n copy.splice(0, 1)\n return `(${this.conditions[0].conditionExpression()} ${copy\n .map((condition) => toExpression(condition))\n .join(' ')})`\n }\n\n asFirstCondition() {\n this.conditions[0].asFirstCondition()\n return this\n }\n\n getCoordinator() {\n return this.conditions[0].getCoordinator()\n }\n\n setCoordinator(coordinator) {\n this.conditions[0].setCoordinator(coordinator)\n }\n\n isGroup() {\n return true\n }\n\n getGroupedConditions() {\n return this.conditions.map((condition) => condition.clone())\n }\n\n clone() {\n return new ConditionGroup(\n this.conditions.map((condition) => condition.clone())\n )\n }\n}\n\nexport function toPresentationString(condition) {\n return `${condition.coordinatorString()}${condition.conditionString()}`\n}\n\nexport function toExpression(condition) {\n return `${condition.coordinatorString()}${condition.conditionExpression()}`\n}\n\nexport class Field {\n name\n type\n display\n\n constructor(name, type, display) {\n if (!name || typeof name !== 'string') {\n throw Error(`name ${name} is not valid`)\n }\n if (!ComponentTypes.find((componentType) => componentType.name === type)) {\n throw Error(`type ${type} is not valid`)\n }\n if (!display || typeof display !== 'string') {\n throw Error(`display ${display} is not valid`)\n }\n this.name = name\n this.type = type\n this.display = display\n }\n\n static from(obj) {\n return new Field(obj.name, obj.type, obj.display)\n }\n}\n\nclass AbstractCondition {\n coordinator\n\n constructor(coordinator) {\n if (coordinator && !Object.values(coordinators).includes(coordinator)) {\n throw Error(`coordinator ${coordinator} is not a valid coordinator`)\n }\n this.coordinator = coordinator\n }\n\n coordinatorString() {\n return this.coordinator ? `${this.coordinator} ` : ''\n }\n\n getCoordinator() {\n return this.coordinator\n }\n\n setCoordinator(coordinator) {\n this.coordinator = coordinator\n }\n\n isGroup() {\n return false\n }\n\n getGroupedConditions() {\n return [this]\n }\n\n _asFirstCondition() {\n delete this.coordinator\n }\n\n asFirstCondition() {\n throw Error(\n 'Implement on the subclass (Why do we have to have this method here at all?!)'\n )\n }\n\n clone() {\n throw Error(\n 'Implement on the subclass (Why do we have to have this method here at all?!)'\n )\n }\n\n conditionString() {\n throw Error(\n 'Implement on the subclass (Why do we have to have this method here at all?!)'\n )\n }\n\n conditionExpression() {\n throw Error(\n 'Implement on the subclass (Why do we have to have this method here at all?!)'\n )\n }\n}\n\nexport class Condition extends AbstractCondition {\n field\n operator\n value\n\n constructor(field, operator, value, coordinator) {\n super(coordinator)\n if (!(field instanceof Field)) {\n throw Error(`field ${field} is not a valid Field object`)\n }\n if (typeof operator !== 'string') {\n throw Error(`operator ${operator} is not a valid operator`)\n }\n if (!(value instanceof AbstractConditionValue)) {\n throw Error(`value ${value} is not a valid value type`)\n }\n this.field = field\n this.operator = operator\n this.value = value\n }\n\n asFirstCondition() {\n this._asFirstCondition()\n return this\n }\n\n conditionString() {\n return `'${this.field.display}' ${\n this.operator\n } '${this.value.toPresentationString()}'`\n }\n\n conditionExpression() {\n return getExpression(\n this.field.type,\n this.field.name,\n this.operator,\n this.value\n )\n }\n\n clone() {\n return new Condition(\n Field.from(this.field),\n this.operator,\n this.value.clone(),\n this.coordinator\n )\n }\n}\n\nexport class ConditionRef extends AbstractCondition {\n conditionName\n conditionDisplayName\n\n constructor(conditionName, conditionDisplayName, coordinator) {\n super(coordinator)\n if (typeof conditionName !== 'string') {\n throw Error(`condition name ${conditionName} is not valid`)\n }\n if (typeof conditionDisplayName !== 'string') {\n throw Error(`condition display name ${conditionDisplayName} is not valid`)\n }\n this.conditionName = conditionName\n this.conditionDisplayName = conditionDisplayName\n }\n\n asFirstCondition() {\n this._asFirstCondition()\n return this\n }\n\n conditionString() {\n return `'${this.conditionDisplayName}'`\n }\n\n conditionExpression() {\n return this.conditionName\n }\n\n clone() {\n return new ConditionRef(\n this.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