@defra/forms-model 3.0.8 → 3.0.10
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/components/types.js +2 -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 +2 -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/types.js +2 -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 +4 -4
- 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":"condition-model.js","names":["_conditionField","require","_conditionGroupDef","_condition2","_conditionRef","_conditionGroup","_conditionValues","_enums","_helpers","ConditionsModel","groupedConditions","userGroupedConditions","conditionName","undefined","constructor","_conditionsObject","clone","toReturn","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","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","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":";;;;AAAA,IAAAA,eAAA,GAAAC,OAAA;AACA,IAAAC,kBAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,aAAA,GAAAH,OAAA;AACA,IAAAI,eAAA,GAAAJ,OAAA;AACA,IAAAK,gBAAA,GAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,QAAA,GAAAP,OAAA;AAUO,MAAMQ,eAAe,CAAC;EAC3B,CAACC,iBAAiB,GAAoB,EAAE;EACxC,CAACC,qBAAqB,GAAoB,EAAE;EAC5C,CAACC,aAAa,GAAuB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AAEK,SAAS,IAC9C8D,aAAa,CAAC9D,SAAS,CACzB,CACF,CAAC;EACH;EAEA,IAAI,eAAe,IAAIJ,EAAE,EAAE;IACzB,OAAO,IAAIoE,0BAAY,CACrBpE,EAAE,CAACP,aAAa,EAChBO,EAAE,CAACqE,oBAAoB,EACvBrE,EAAE,CAACsE,WACL,CAAC;EACH;EAEA,OAAO,IAAIC,qBAAS,CAClBC,8BAAc,CAACR,IAAI,CAAChE,EAAE,CAACyE,KAAK,CAAC,EAC7BzE,EAAE,CAAC0E,QAAQ,EACX,IAAAC,mCAAkB,EAAC3E,EAAE,CAAC4E,KAAK,CAAC,EAC5B5E,EAAE,CAACsE,WACL,CAAC;AACH,CAAC"}
|
1
|
+
{"version":3,"file":"condition-model.js","names":["_conditionField","require","_conditionGroupDef","_condition2","_conditionRef","_conditionGroup","_conditionValues","_enums","_helpers","ConditionsModel","groupedConditions","userGroupedConditions","conditionName","undefined","constructor","_conditionsObject","clone","toReturn","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","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","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":";;;;AAAA,IAAAA,eAAA,GAAAC,OAAA;AACA,IAAAC,kBAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,aAAA,GAAAH,OAAA;AACA,IAAAI,eAAA,GAAAJ,OAAA;AACA,IAAAK,gBAAA,GAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,QAAA,GAAAP,OAAA;AAUO,MAAMQ,eAAe,CAAC;EAC3B,CAACC,iBAAiB,GAAoB,EAAE;EACxC,CAACC,qBAAqB,GAAoB,EAAE;EAC5C,CAACC,aAAa,GAAuBC,SAAS;EAE9CC,WAAWA,CAACC,iBAAsC,EAAE,CAAC;EAErDC,KAAKA,CAAA,EAAG;IACN,MAAMC,QAAQ,GAAG,IAAIR,eAAe,CAAC,CAAC;IACtCQ,QAAQ,CAAC,CAACP,iBAAiB,GAAG,IAAI,CAAC,CAACA,iBAAiB,CAACQ,GAAG,CAAEC,EAAE,IAC3DA,EAAE,CAACH,KAAK,CAAC,CACX,CAAC;IACDC,QAAQ,CAAC,CAACN,q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yE,KAAK,CAAC,EAC7BzE,EAAE,CAAC0E,QAAQ,EACX,IAAAC,mCAAkB,EAAC3E,EAAE,CAAC4E,KAAK,CAAC,EAC5B5E,EAAE,CAACsE,WACL,CAAC;AACH,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"condition-operators.js","names":["_conditionValues","require","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":["_conditionValues","require","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":";;;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7D,OAAOO,KAAK;EACd;EACA,OAAQ,IAAGA,KAAM,GAAE;AACrB;AAEO,MAAMQ,+BAA+B,GAAAjC,OAAA,CAAAiC,+BAAA,GAAG3C,MAAM,CAAC6B,IAAI,CACxDzB,yBACF,CAAC;AACM,MAAMwC,+BAA+B,GAAAlC,OAAA,CAAAkC,+BAAA,GAAG5C,MAAM,CAAC6B,IAAI,CACxDvB,qBAAqB,CAACgB,8BAAa,CACrC,CAAC;AAED,SAASjB,gBAAgBA,CAAC6B,QAAkB,EAAE;EAC5C,OAAO;IACLE,UAAU,EAAEA,CAACI,KAAmB,EAAEL,KAAK,KAAK;MAC1C,IAAIA,KAAK,YAAYU,+BAAc,EAAE;QACnC,OAAQ,GAAEL,KAAK,CAACF,IAAK,IAAGJ,QAAS,KAAIC,KAAK,CAACW,YAAY,CAAC,CAAE,GAAE;MAC9D;MACA,MAAMC,KAAK,CAAC,gCAAgC,CAAC;IAC/C;EACF,CAAC;AACH;AAEA,SAASvC,YAAYA,CAACwC,YAAY,EAAEC,cAAc,EAAE1C,KAAK,EAAE;EACzD,OAAO;IACLA,KAAK;IACL6B,UAAU,EAAEA,CAACI,KAAmB,EAAEL,KAAK,KAAK;MAC1C,IAAIA,KAAK,YAAYe,kCAAiB,EAAE;QACtC,MAAMhB,QAAQ,GACZC,KAAK,CAACgB,SAAS,KAAKC,+BAAc,CAACC,IAAI,GACnCL,YAAY,GACZC,cAAc;QACpB,OAAQ,GAAET,KAAK,CAACF,IAAK,IAAGJ,QAAS,IAAGC,KAAK,CAACW,YAAY,CAAC,CAAE,EAAC;MAC5D;MACA,MAAMC,KAAK,CAAC,sCAAsC,CAAC;IACrD;EACF,CAAC;AACH"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"condition-ref.js","names":["_conditionAbstract","require","ConditionRef","ConditionAbstract","constructor","conditionName","conditionDisplayName","coordinator","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":["_conditionAbstract","require","ConditionRef","ConditionAbstract","constructor","conditionName","conditionDisplayName","coordinator","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":";;;;AAAA,IAAAA,kBAAA,GAAAC,OAAA;AAGO,MAAMC,YAAY,SAASC,oCAAiB,CAAC;EAIlDC,WAAWA,CACTC,aAAqB,EACrBC,oBAA4B,EAC5BC,WAAoC,EACpC;IACA,KAAK,CAACA,WAAW,CAAC;IAElB,IAAI,OAAOF,aAAa,KAAK,QAAQ,EAAE;MACrC,MAAMG,KAAK,CAAE,kBAAiBH,aAAc,eAAc,CAAC;IAC7D;IAEA,IAAI,OAAOC,oBAAoB,KAAK,QAAQ,EAAE;MAC5C,MAAME,KAAK,CAAE,0BAAyBF,oBAAqB,eAAc,CAAC;IAC5E;IAEA,IAAI,CAACD,aAAa,GAAGA,aAAa;IAClC,IAAI,CAACC,oBAAoB,GAAGA,oBAAoB;EAClD;EAEAG,gBAAgBA,CAAA,EAAG;IACjB,IAAI,CAACC,iBAAiB,CAAC,CAAC;IACxB,OAAO,IAAI;EACb;EAEAC,eAAeA,CAAA,EAAG;IAChB,OAAQ,IAAG,IAAI,CAACL,oBAAqB,GAAE;EACzC;EAEAM,mBAAmBA,CAAA,EAAG;IACpB,OAAO,IAAI,CAACP,aAAa;EAC3B;EAEAQ,KAAKA,CAAA,EAAG;IACN,OAAO,IAAIX,YAAY,CACrB,IAAI,CAACG,aAAa,EAClB,IAAI,CAACC,oBAAoB,EACzB,IAAI,CAACC,WACP,CAAC;EACH;AACF;AAACO,OAAA,CAAAZ,YAAA,GAAAA,YAAA"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"condition-value-abstract.js","names":["_conditionValueRegistration","require","ConditionValueAbstract","constructor","registration","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":["_conditionValueRegistration","require","ConditionValueAbstract","constructor","registration","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":";;;;AAAA,IAAAA,2BAAA,GAAAC,OAAA;AAEO,MAAMC,sBAAsB,CAAC;EAGlCC,WAAWA,CAACC,YAA0B,EAAE;IACtC,IAAIC,GAAG,CAACC,MAAM,KAAKJ,sBAAsB,EAAE;MACzC,MAAM,IAAIK,SAAS,CAAC,oDAAoD,CAAC;IAC3E;IAEA,IAAI,EAAEH,YAAY,YAAYI,wCAAY,CAAC,EAAE;MAC3C,MAAM,IAAID,SAAS,CACjB,4DACF,CAAC;IACH;IAEA,IAAI,CAACE,IAAI,GAAGL,YAAY,CAACK,IAAI;EAC/B;EAEAC,oBAAoBA,CAAA,EAAG;IACrB,MAAM,IAAIC,KAAK,CACb,8EACF,CAAC;EACH;EAEAC,YAAYA,CAAA,EAAG;IACb,MAAM,IAAID,KAAK,CACb,sEACF,CAAC;EACH;AACF;AAACE,OAAA,CAAAX,sBAAA,GAAAA,sBAAA"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"condition-values.js","names":["_conditionValueAbstract","require","_conditionValueRegistration","ConditionValue","ConditionValueAbstract","constructor","value","display","valueType","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":["_conditionValueAbstract","require","_conditionValueRegistration","ConditionValue","ConditionValueAbstract","constructor","value","display","valueType","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":";;;;;;AAAA,IAAAA,uBAAA,GAAAC,OAAA;AACA,IAAAC,2BAAA,GAAAD,OAAA;AAOO,MAAME,cAAc,SAASC,8CAAsB,CAAC;EAIzDC,WAAWA,CAACC,KAAa,EAAEC,OAAgB,EAAE;IAC3C,KAAK,CAACC,SAAS,CAAC;IAEhB,IAAI,CAACF,KAAK,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE;MACvC,MAAMG,KAAK,CAAE,SAAQH,KAAM,eAAc,CAAC;IAC5C;IAEA,IAAIC,OAAO,IAAI,OAAOA,OAAO,KAAK,QAAQ,EAAE;MAC1C,MAAME,KAAK,CAAE,WAAUF,OAAQ,eAAc,CAAC;IAChD;IAEA,IAAI,CAACD,KAAK,GAAGA,KAAK;IAClB,IAAI,CAACC,OAAO,GAAGA,OAAO,IAAID,KAAK;EACjC;EAEAI,oBAAoBA,C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W,MAAK,IAAI,CAACC,QAAS,IAAG,GACrD,qBAAoBD,UAAW,MAAK,IAAI,CAACC,QAAS,IAAG;EAC5D;EAEA,OAAOpB,IAAIA,CAACC,GAAG,EAAE;IACf,OAAO,IAAIiB,iBAAiB,CAC1BjB,GAAG,CAACkB,UAAU,EACdlB,GAAG,CAACmB,QAAQ,EACZnB,GAAG,CAACoB,SAAS,EACbpB,GAAG,CAACqB,QACN,CAAC;EACH;EAEApB,KAAKA,CAAA,EAAG;IACN,OAAOgB,iBAAiB,CAAClB,IAAI,CAAC,IAAI,CAAC;EACrC;AACF;AAACG,OAAA,CAAAe,iBAAA,GAAAA,iBAAA;AAEM,MAAMK,qBAAqB,GAAApB,OAAA,CAAAoB,qBAAA,GAAGnB,wCAAY,CAACC,QAAQ,CACxD,cAAc,EACbJ,GAAG,IAAwBiB,iBAAiB,CAAClB,IAAI,CAACC,GAAG,CACxD,CAAC;AASM,SAAS6B,kBAAkBA,CAAC7B,GAAuB,EAAE;EAC1D,OAAOG,wCAAY,CAAC0B,kBAAkB,CAAC7B,GAAG,CAAC;AAC7C"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"condition.js","names":["_conditionField","require","_conditionAbstract","_conditionOperators","_conditionValueAbstract","Condition","ConditionAbstract","constructor","field","operator","value","coordinator","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":["_conditionField","require","_conditionAbstract","_conditionOperators","_conditionValueAbstract","Condition","ConditionAbstract","constructor","field","operator","value","coordinator","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":";;;;AAAA,IAAAA,eAAA,GAAAC,OAAA;AACA,IAAAC,kBAAA,GAAAD,OAAA;AACA,IAAAE,mBAAA,GAAAF,OAAA;AAKA,IAAAG,uBAAA,GAAAH,OAAA;AAGO,MAAMI,SAAS,SAASC,oCAAiB,CAAC;EAK/CC,WAAWA,CACTC,KAAqB,EACrBC,QAAgB,EAChBC,KAAyC,EACzCC,WAAyB,EACzB;IACA,KAAK,CAACA,WAAW,CAAC;IAElB,IAAI,EAAEH,KAAK,YAAYI,8BAAc,CAAC,EAAE;MACtC,MAAMC,KAAK,CAAE,SAAQL,KAAM,uCAAsC,CAAC;IACpE;IACA,IAAI,OAAOC,QAAQ,KAAK,QAAQ,EAAE;MAChC,MAAMI,KAAK,CAAE,YAAWJ,QAAS,0BAAyB,CAAC;IAC7D;IACA,IAAI,EAAEC,KAAK,YAAYI,8CAAsB,CAAC,EAAE;MAC9C,MAAMD,KAAK,CAAE,SAAQH,KAAM,4BAA2B,CAAC;IACzD;IAEA,IAAI,CAACF,KAAK,GAAGA,KAAK;IAClB,IAAI,CAACC,QAAQ,GAAGA,QAAQ;IACxB,IAAI,CAACC,KAAK,GAAGA,KAAK;EACpB;EAEAK,gBAAgBA,CAAA,EAAG;IACjB,IAAI,CAACC,iBAAiB,CAAC,CAAC;IACxB,OAAO,IAAI;EACb;EAEAC,eAAeA,CAAA,EAAG;IAChB,OAAQ,IAAG,IAAI,CAACT,KAAK,CAACU,OAAQ,KAC5B,IAAI,CAACT,QACN,KAAI,IAAI,CAACC,KAAK,CAACS,oBAAoB,CAAC,CAAE,GAAE;EAC3C;EAEAC,mBAAmBA,CAAA,EAAG;IACpB,OAAO,IAAAC,iCAAa,EAClB,IAAI,CAACb,KAAK,CAACc,IAAI,EACf,IAAI,CAACd,KAAK,CAACe,IAAI,EACf,IAAI,CAACd,QAAQ,EACb,IAAI,CAACC,KACP,CAAC;EACH;EAEAc,KAAKA,CAAA,EAAG;IACN,OAAO,IAAInB,SAAS,CAClBO,8BAAc,CAACa,IAAI,CAAC,IAAI,CAACjB,KAAK,CAAC,EAC/B,IAAI,CAACC,QAAQ,EACb,IAAI,CAACC,KAAK,CAACc,KAAK,CAAC,CAAC,EAClB,IAAI,CAACb,WACP,CAAC;EACH;AACF;AAACe,OAAA,CAAArB,SAAA,GAAAA,SAAA"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","names":["_conditionOperators","require","_conditionValues","_conditionField","_condition","_conditionRef","_conditionGroup","_conditionModel","_conditionGroupDef","_helpers","_enums"],"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":["_conditionOperators","require","_conditionValues","_conditionField","_condition","_conditionRef","_conditionGroup","_conditionModel","_conditionGroupDef","_helpers","_enums"],"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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,mBAAA,GAAAC,OAAA;AAQA,IAAAC,gBAAA,GAAAD,OAAA;AAUA,IAAAE,eAAA,GAAAF,OAAA;AACA,IAAAG,UAAA,GAAAH,OAAA;AACA,IAAAI,aAAA,GAAAJ,OAAA;AACA,IAAAK,eAAA,GAAAL,OAAA;AACA,IAAAM,eAAA,GAAAN,OAAA;AACA,IAAAO,kBAAA,GAAAP,OAAA;AACA,IAAAQ,QAAA,GAAAR,OAAA;AAEA,IAAAS,MAAA,GAAAT,OAAA"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"inline-condition-model.js","names":["_componentTypes","require","_inlineConditionOperators","_inlineConditionValues","coordinators","exports","AND","OR","ConditionsModel","groupedConditions","userGroupedConditions","conditionName","constructor","clone","toReturn","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","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","ConditionRef","conditionDisplayName","coordinator","Condition","Field","field","operator","valueFrom","value","first","last","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":";;;;;;AAAA,IAAAA,eAAA,GAAAC,OAAA;AACA,IAAAC,yBAAA,GAAAD,OAAA;AACA,IAAAE,sBAAA,GAAAF,OA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,aAAa;EAC3B;EAEAE,KAAKA,CAAA,EAAG;IACN,OAAO,IAAIoE,YAAY,CACrB,IAAI,CAACtE,aAAa,EAClB,IAAI,CAACuE,oBAAoB,EACzB,IAAI,CAACC,WACP,CAAC;EACH;AACF;AAAC9E,OAAA,CAAA4E,YAAA,GAAAA,YAAA"}
|
1
|
+
{"version":3,"file":"inline-condition-model.js","names":["_componentTypes","require","_inlineConditionOperators","_inlineConditionValues","coordinators","exports","AND","OR","ConditionsModel","groupedConditions","userGroupedConditions","conditionName","constructor","clone","toReturn","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","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","ConditionRef","conditionDisplayName","coordinator","Condition","Field","field","operator","valueFrom","value","first","last","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.conditionName,\n this.conditionDisplayName,\n this.coordinator\n )\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,eAAA,GAAAC,OAAA;AACA,IAAAC,yBAAA,GAAAD,OAAA;AACA,IAAAE,sBAAA,GAAAF,OAAA;AAKO,MAAMG,YAAY,GAAAC,OAAA,CAAAD,YAAA,GAAG;EAC1BE,GAAG,EAAE,KAAK;EACVC,EAAE,EAAE;AACN,CAAC;AAEM,MAAMC,eAAe,CAAC;EAC3B,CAACC,iBAAiB;EAClB,CAACC,qBAAqB;EACtB,CAACC,aAAa;EAEdC,WAAWA,CAAA,EAAG;IACZ,IAAI,CAAC,CAACH,iBAAiB,GAAG,EAAE;IAC5B,IAAI,CAAC,CAACC,qBAAqB,GAAG,EAAE;EAClC;EAEAG,KAAKA,CAAA,EAAG;IACN,MAAMC,QAAQ,GAAG,IAAIN,eAAe,CAAC,CAAC;IACtCM,QAAQ,CAAC,CAACL,iBAAiB,GAAG,IAAI,CAAC,CAACA,iBAAiB,CAACM,GAAG,CAAEC,EAAE,IAC3DA,EAAE,CAACH,KAAK,CAAC,CACX,CAAC;IACDC,QAAQ,CAAC,CAACJ,qBAAqB,GAAG,IAAI,CAAC,CAACA,qBAAqB,CAACK,GAAG,CAAEC,EAAE,IACnEA,EAAE,CAACH,KAAK,CAAC,CACX,CAAC;IACDC,QAAQ,CAAC,CAACH,aAAa,GAAG,IAAI,CAAC,CAACA,aAAa;IAC7C,OAAOG,QAAQ;EACjB;EAEAG,KAAKA,CAAA,EAAG;IACN,IAAI,CAAC,CAACP,qBAAqB,GAAG,EAAE;IAChC,IAAI,CAAC,CAACD,iBAAiB,GAAG,EAAE;IAC5B,IAAI,CAAC,CAACE,aAAa,GAAGO,SAAS;IAC/B,O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ACA,IAAI,CAACvE,aAAa,GAAGA,aAAa;IAClC,IAAI,CAACuE,oBAAoB,GAAGA,oBAAoB;EAClD;EAEA9C,gBAAgBA,CAAA,EAAG;IACjB,IAAI,CAACoE,iBAAiB,CAAC,CAAC;IACxB,OAAO,IAAI;EACb;EAEAT,eAAeA,CAAA,EAAG;IAChB,OAAQ,IAAG,IAAI,CAACb,oBAAqB,GAAE;EACzC;EAEAc,mBAAmBA,CAAA,EAAG;IACpB,OAAO,IAAI,CAACrF,aAAa;EAC3B;EAEAE,KAAKA,CAAA,EAAG;IACN,OAAO,IAAIoE,YAAY,CACrB,IAAI,CAACtE,aAAa,EAClB,IAAI,CAACuE,oBAAoB,EACzB,IAAI,CAACC,WACP,CAAC;EACH;AACF;AAAC9E,OAAA,CAAA4E,YAAA,GAAAA,YAAA"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"inline-condition-operators.js","names":["_inlineConditionValues","require","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/inline-condition-operators.ts"],"sourcesContent":["import {\n ConditionValue,\n dateDirections,\n dateTimeUnits,\n dateUnits,\n RelativeTimeValue,\n timeUnits\n} from '
|
1
|
+
{"version":3,"file":"inline-condition-operators.js","names":["_inlineConditionValues","require","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/inline-condition-operators.ts"],"sourcesContent":["import {\n ConditionValue,\n dateDirections,\n dateTimeUnits,\n dateUnits,\n RelativeTimeValue,\n timeUnits\n} from '~/src/conditions/inline-condition-values'\n\nconst defaultOperators = {\n is: inline('=='),\n 'is not': inline('!=')\n}\n\nfunction withDefaults(param) {\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(fieldType, fieldName, operator, value) {\n return getConditionals(fieldType)[operator].expression(\n { type: fieldType, name: fieldName },\n value\n )\n}\n\nexport function getOperatorConfig(fieldType, operator) {\n return getConditionals(fieldType)[operator]\n}\n\nfunction getConditionals(fieldType) {\n return customOperators[fieldType] || defaultOperators\n}\n\nfunction inline(operator) {\n return {\n expression: (field, value) =>\n `${field.name} ${operator} ${formatValue(field.type, value.value)}`\n }\n}\n\nfunction lengthIs(operator) {\n return {\n expression: (field, value) =>\n `length(${field.name}) ${operator} ${value.value}`\n }\n}\n\nfunction reverseInline(operator) {\n return {\n expression: (field, value) =>\n `${formatValue(field.type, value.value)} ${operator} ${field.name}`\n }\n}\n\nfunction not(operatorDefinition) {\n return {\n expression: (field, value) =>\n `not (${operatorDefinition.expression(field, value)})`\n }\n}\n\nfunction formatValue(fieldType, 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) {\n return {\n expression: (field, 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, 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":";;;;;;;;AAAA,IAAAA,sBAAA,GAAAC,OAAA;AASA,MAAMC,gBAAgB,GAAG;EACvBC,EAAE,EAAEC,MAAM,CAAC,IAAI,CAAC;EAChB,QAAQ,EAAEA,MAAM,CAAC,IAAI;AACvB,CAAC;AAED,SAASC,YAAYA,CAACC,KAAK,EAAE;EAC3B,OAAOC,MAAM,CAACC,MAAM,CAAC,CAAC,CAAC,EAAEF,KAAK,EAAEJ,gBAAgB,CAAC;AACnD;AAEA,MAAMO,4BAA4B,GAAG;EACnC,gBAAgB,EAAEC,QAAQ,CAAC,GAAG,CAAC;EAC/B,iBAAiB,EAAEA,QAAQ,CAAC,GAAG,CAAC;EAChC,YAAY,EAAEA,QAAQ,CAAC,IAAI;AAC7B,CAAC;AAED,MAAMC,yBAAyB,GAAG;EAChCR,EAAE,EAAES,gBAAgB,CAAC,IAAI,CAAC;EAC1B,QAAQ,EAAEA,gBAAgB,CAAC,IAAI,CAAC;EAChC,WAAW,EAAEA,gBAAgB,CAAC,GAAG,CAAC;EAClC,UAAU,EAAEA,gBAAgB,CAAC,GAAG;AAClC,CAAC;AAED,MAAMC,qBAAqB,GAAIC,KAAK,KAAM;EACxC,aAAa,EAAEC,YAAY,CAAC,IAAI,EAAE,IAAI,EAAED,KAAK,CAAC;EAC9C,YAAY,EAAEC,YAAY,CAAC,IAAI,EAAE,IAAI,EAAED,KAAK,CAAC;EAC7C,cAAc,EAAEC,YAAY,CAAC,GAAG,EAAE,GAAG,EAAED,KAAK,CAAC;EAC7C,cAAc,EAAEC,YAAY,CAAC,GAAG,EAAE,GAAG,EAAED,KAAK;AAC9C,CAAC,CAAC;AAEK,MAAME,eAAe,GAAAC,OAAA,CAAAD,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 @@
|
|
1
|
-
"use strict";
|
1
|
+
"use strict";
|
2
|
+
//# sourceMappingURL=types.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"types.js","names":[],"sources":["../../../src/conditions/types.ts"],"sourcesContent":["import { Condition } from '
|
1
|
+
{"version":3,"file":"types.js","names":[],"sources":["../../../src/conditions/types.ts"],"sourcesContent":["import { type Condition } from '~/src/conditions/condition'\nimport { type ConditionRef } from '~/src/conditions/condition-ref'\nimport { type ConditionGroup } from '~/src/conditions/condition-group'\n\nexport type ConditionsArray = (Condition | ConditionGroup | ConditionRef)[]\n\nexport type DateTimeUnitValues =\n | 'years'\n | 'months'\n | 'days'\n | 'hours'\n | 'minutes'\n | 'seconds'\n\nexport type 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 type TimeUnits = {\n HOURS: { display: 'hour(s)'; value: 'hours' }\n MINUTES: { display: 'minute(s)'; value: 'minutes' }\n SECONDS: { display: 'second(s)'; value: 'seconds' }\n}\n"],"mappings":""}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"conditions-wrapper.js","names":["_conditionModel","require","ConditionsWrapper","constructor","rawData","name","displayName","value","expression","ConditionsModel","from","toExpression","clone","exports"],"sources":["../../../src/data-model/conditions-wrapper.ts"],"sourcesContent":["import {
|
1
|
+
{"version":3,"file":"conditions-wrapper.js","names":["_conditionModel","require","ConditionsWrapper","constructor","rawData","name","displayName","value","expression","ConditionsModel","from","toExpression","clone","exports"],"sources":["../../../src/data-model/conditions-wrapper.ts"],"sourcesContent":["import { ConditionsModel } from '~/src/conditions/condition-model'\nimport {\n type ConditionRawData,\n type ConditionWrapperValue\n} from '~/src/data-model/types'\n\nexport class ConditionsWrapper {\n name: string\n displayName: string\n value: ConditionWrapperValue\n\n constructor(rawData: ConditionRawData) {\n const { name, displayName, value } = rawData\n this.displayName = displayName || name\n this.value = value\n this.name = name\n }\n\n get expression() {\n if (typeof this.value === 'string') {\n // Previously conditions were defined as strings, e.g: \"section.age < 18\"\n // keep this so application can support legacy forms exports.\n return this.value\n }\n\n return ConditionsModel.from(this.value).toExpression()\n }\n\n clone(): ConditionsWrapper {\n return new ConditionsWrapper(this)\n }\n}\n"],"mappings":";;;;AAAA,IAAAA,eAAA,GAAAC,OAAA;AAMO,MAAMC,iBAAiB,CAAC;EAK7BC,WAAWA,CAACC,OAAyB,EAAE;IACrC,MAAM;MAAEC,IAAI;MAAEC,WAAW;MAAEC;IAAM,CAAC,GAAGH,OAAO;IAC5C,IAAI,CAACE,WAAW,GAAGA,WAAW,IAAID,IAAI;IACtC,IAAI,CAACE,KAAK,GAAGA,KAAK;IAClB,IAAI,CAACF,IAAI,GAAGA,IAAI;EAClB;EAEA,IAAIG,UAAUA,CAAA,EAAG;IACf,IAAI,OAAO,IAAI,CAACD,KAAK,KAAK,QAAQ,EAAE;MAClC;MACA;MACA,OAAO,IAAI,CAACA,KAAK;IACnB;IAEA,OAAOE,+BAAe,CAACC,IAAI,CAAC,IAAI,CAACH,KAAK,CAAC,CAACI,YAAY,CAAC,CAAC;EACxD;EAEAC,KAAKA,CAAA,EAAsB;IACzB,OAAO,IAAIV,iBAAiB,CAAC,IAAI,CAAC;EACpC;AACF;AAACW,OAAA,CAAAX,iBAAA,GAAAA,iBAAA"}
|
@@ -1,62 +1,25 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
exports.__esModule = true;
|
4
|
-
Object.defineProperty(exports, "ConditionRawData", {
|
5
|
-
enumerable: true,
|
6
|
-
get: function () {
|
7
|
-
return _conditionsWrapper.ConditionRawData;
|
8
|
-
}
|
9
|
-
});
|
10
4
|
Object.defineProperty(exports, "ConditionsWrapper", {
|
11
5
|
enumerable: true,
|
12
6
|
get: function () {
|
13
7
|
return _conditionsWrapper.ConditionsWrapper;
|
14
8
|
}
|
15
9
|
});
|
16
|
-
Object.defineProperty(exports, "ConfirmationPage", {
|
17
|
-
enumerable: true,
|
18
|
-
get: function () {
|
19
|
-
return _types.ConfirmationPage;
|
20
|
-
}
|
21
|
-
});
|
22
10
|
Object.defineProperty(exports, "InputWrapper", {
|
23
11
|
enumerable: true,
|
24
12
|
get: function () {
|
25
13
|
return _inputWrapper.InputWrapper;
|
26
14
|
}
|
27
15
|
});
|
28
|
-
Object.defineProperty(exports, "Item", {
|
29
|
-
enumerable: true,
|
30
|
-
get: function () {
|
31
|
-
return _types.Item;
|
32
|
-
}
|
33
|
-
});
|
34
|
-
Object.defineProperty(exports, "List", {
|
35
|
-
enumerable: true,
|
36
|
-
get: function () {
|
37
|
-
return _types.List;
|
38
|
-
}
|
39
|
-
});
|
40
16
|
Object.defineProperty(exports, "OutputType", {
|
41
17
|
enumerable: true,
|
42
18
|
get: function () {
|
43
19
|
return _enums.OutputType;
|
44
20
|
}
|
45
21
|
});
|
46
|
-
Object.defineProperty(exports, "Page", {
|
47
|
-
enumerable: true,
|
48
|
-
get: function () {
|
49
|
-
return _types.Page;
|
50
|
-
}
|
51
|
-
});
|
52
|
-
Object.defineProperty(exports, "Section", {
|
53
|
-
enumerable: true,
|
54
|
-
get: function () {
|
55
|
-
return _types.Section;
|
56
|
-
}
|
57
|
-
});
|
58
22
|
var _inputWrapper = require("./input-wrapper");
|
59
23
|
var _conditionsWrapper = require("./conditions-wrapper");
|
60
|
-
var _types = require("./types");
|
61
24
|
var _enums = require("./enums");
|
62
25
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","names":["_inputWrapper","require","_conditionsWrapper","
|
1
|
+
{"version":3,"file":"index.js","names":["_inputWrapper","require","_conditionsWrapper","_enums"],"sources":["../../../src/data-model/index.ts"],"sourcesContent":["export { InputWrapper } from '~/src/data-model/input-wrapper'\nexport { ConditionsWrapper } from '~/src/data-model/conditions-wrapper'\nexport { OutputType } from '~/src/data-model/enums'\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,aAAA,GAAAC,OAAA;AACA,IAAAC,kBAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"input-wrapper.js","names":["_helpers","require","InputWrapper","name","undefined","title","type","parentItemName","constructor","rawData","page","options","Object","assign","myPage","clone","components","propertyPath","ignoreSection","section","displayName","titleWithContext","exports"],"sources":["../../../src/data-model/input-wrapper.ts"],"sourcesContent":["import {
|
1
|
+
{"version":3,"file":"input-wrapper.js","names":["_helpers","require","InputWrapper","name","undefined","title","type","parentItemName","constructor","rawData","page","options","Object","assign","myPage","clone","components","propertyPath","ignoreSection","section","displayName","titleWithContext","exports"],"sources":["../../../src/data-model/input-wrapper.ts"],"sourcesContent":["import { type ComponentDef } from '~/src/components/types'\nimport { type Page } from '~/src/data-model/types'\nimport { clone } from '~/src/utils/helpers'\n\nexport class InputWrapper {\n name: string | undefined = undefined\n title: string | undefined = undefined\n type: string | undefined = undefined\n propertyPath: string | undefined\n #parentItemName: string | undefined\n page: Page\n\n constructor(\n rawData: ComponentDef,\n page: Page,\n options: { ignoreSection?: boolean; parentItemName?: string }\n ) {\n Object.assign(this, rawData)\n const myPage = clone(page)\n\n delete myPage.components\n\n this.page = myPage\n this.propertyPath =\n !options.ignoreSection && page.section\n ? `${page.section}.${this.name}`\n : this.name\n this.#parentItemName = options.parentItemName\n }\n\n get displayName(): string | undefined {\n const titleWithContext = this.#parentItemName\n ? `${this.title} under ${this.#parentItemName}`\n : this.title\n\n return this.page.section\n ? `${titleWithContext} in ${this.page.section}`\n : titleWithContext\n }\n}\n"],"mappings":";;;;AAEA,IAAAA,QAAA,GAAAC,OAAA;AAEO,MAAMC,YAAY,CAAC;EACxBC,IAAI,GAAuBC,SAAS;EACpCC,KAAK,GAAuBD,SAAS;EACrCE,IAAI,GAAuBF,SAAS;EAEpC,CAACG,cAAc;EAGfC,WAAWA,CACTC,OAAqB,EACrBC,IAAU,EACVC,OAA6D,EAC7D;IACAC,MAAM,CAACC,MAAM,CAAC,IAAI,EAAEJ,OAAO,CAAC;IAC5B,MAAMK,MAAM,GAAG,IAAAC,cAAK,EAACL,IAAI,CAAC;IAE1B,OAAOI,MAAM,CAACE,UAAU;IAExB,IAAI,CAACN,IAAI,GAAGI,MAAM;IAClB,IAAI,CAACG,YAAY,GACf,CAACN,OAAO,CAACO,aAAa,IAAIR,IAAI,CAACS,OAAO,GACjC,GAAET,IAAI,CAACS,OAAQ,IAAG,IAAI,CAAChB,IAAK,EAAC,GAC9B,IAAI,CAACA,IAAI;IACf,IAAI,CAAC,CAACI,cAAc,GAAGI,OAAO,CAACJ,cAAc;EAC/C;EAEA,IAAIa,WAAWA,CAAA,EAAuB;IACpC,MAAMC,gBAAgB,GAAG,IAAI,CAAC,CAACd,cAAc,GACxC,GAAE,IAAI,CAACF,KAAM,UAAS,IAAI,CAAC,CAACE,cAAe,EAAC,GAC7C,IAAI,CAACF,KAAK;IAEd,OAAO,IAAI,CAACK,IAAI,CAACS,OAAO,GACnB,GAAEE,gBAAiB,OAAM,IAAI,CAACX,IAAI,CAACS,OAAQ,EAAC,GAC7CE,gBAAgB;EACtB;AACF;AAACC,OAAA,CAAApB,YAAA,GAAAA,YAAA"}
|