@defra/forms-model 3.0.2
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/LICENCE +8 -0
- package/README.md +22 -0
- package/dist/browser/components/component-types.d.ts +3 -0
- package/dist/browser/components/component-types.d.ts.map +1 -0
- package/dist/browser/components/component-types.js +220 -0
- package/dist/browser/components/component-types.js.map +1 -0
- package/dist/browser/components/conditional-component-types.d.ts +3 -0
- package/dist/browser/components/conditional-component-types.d.ts.map +1 -0
- package/dist/browser/components/conditional-component-types.js +28 -0
- package/dist/browser/components/conditional-component-types.js.map +1 -0
- package/dist/browser/components/index.d.ts +4 -0
- package/dist/browser/components/index.d.ts.map +1 -0
- package/dist/browser/components/index.js +45 -0
- package/dist/browser/components/index.js.map +1 -0
- package/dist/browser/components/types.d.ts +244 -0
- package/dist/browser/components/types.d.ts.map +1 -0
- package/dist/browser/components/types.js +56 -0
- package/dist/browser/components/types.js.map +1 -0
- package/dist/browser/conditions/condition-abstract.d.ts +16 -0
- package/dist/browser/conditions/condition-abstract.d.ts.map +1 -0
- package/dist/browser/conditions/condition-abstract.js +62 -0
- package/dist/browser/conditions/condition-abstract.js.map +1 -0
- package/dist/browser/conditions/condition-field.d.ts +13 -0
- package/dist/browser/conditions/condition-field.d.ts.map +1 -0
- package/dist/browser/conditions/condition-field.js +45 -0
- package/dist/browser/conditions/condition-field.js.map +1 -0
- package/dist/browser/conditions/condition-group-def.d.ts +10 -0
- package/dist/browser/conditions/condition-group-def.d.ts.map +1 -0
- package/dist/browser/conditions/condition-group-def.js +45 -0
- package/dist/browser/conditions/condition-group-def.js.map +1 -0
- package/dist/browser/conditions/condition-group.d.ts +15 -0
- package/dist/browser/conditions/condition-group.d.ts.map +1 -0
- package/dist/browser/conditions/condition-group.js +64 -0
- package/dist/browser/conditions/condition-group.js.map +1 -0
- package/dist/browser/conditions/condition-model.d.ts +41 -0
- package/dist/browser/conditions/condition-model.d.ts.map +1 -0
- package/dist/browser/conditions/condition-model.js +214 -0
- package/dist/browser/conditions/condition-model.js.map +1 -0
- package/dist/browser/conditions/condition-operators.d.ts +248 -0
- package/dist/browser/conditions/condition-operators.d.ts.map +1 -0
- package/dist/browser/conditions/condition-operators.js +132 -0
- package/dist/browser/conditions/condition-operators.js.map +1 -0
- package/dist/browser/conditions/condition-ref.d.ts +12 -0
- package/dist/browser/conditions/condition-ref.d.ts.map +1 -0
- package/dist/browser/conditions/condition-ref.js +51 -0
- package/dist/browser/conditions/condition-ref.js.map +1 -0
- package/dist/browser/conditions/condition-value-abstract.d.ts +8 -0
- package/dist/browser/conditions/condition-value-abstract.d.ts.map +1 -0
- package/dist/browser/conditions/condition-value-abstract.js +41 -0
- package/dist/browser/conditions/condition-value-abstract.js.map +1 -0
- package/dist/browser/conditions/condition-value-registration.d.ts +10 -0
- package/dist/browser/conditions/condition-value-registration.d.ts.map +1 -0
- package/dist/browser/conditions/condition-value-registration.js +37 -0
- package/dist/browser/conditions/condition-value-registration.js.map +1 -0
- package/dist/browser/conditions/condition-values.d.ts +38 -0
- package/dist/browser/conditions/condition-values.d.ts.map +1 -0
- package/dist/browser/conditions/condition-values.js +127 -0
- package/dist/browser/conditions/condition-values.js.map +1 -0
- package/dist/browser/conditions/condition.d.ts +15 -0
- package/dist/browser/conditions/condition.d.ts.map +1 -0
- package/dist/browser/conditions/condition.js +56 -0
- package/dist/browser/conditions/condition.js.map +1 -0
- package/dist/browser/conditions/helpers.d.ts +3 -0
- package/dist/browser/conditions/helpers.d.ts.map +1 -0
- package/dist/browser/conditions/helpers.js +26 -0
- package/dist/browser/conditions/helpers.js.map +1 -0
- package/dist/browser/conditions/index.d.ts +11 -0
- package/dist/browser/conditions/index.d.ts.map +1 -0
- package/dist/browser/conditions/index.js +144 -0
- package/dist/browser/conditions/index.js.map +1 -0
- package/dist/browser/conditions/inline-condition-model.d.ts +86 -0
- package/dist/browser/conditions/inline-condition-model.d.ts.map +1 -0
- package/dist/browser/conditions/inline-condition-model.js +418 -0
- package/dist/browser/conditions/inline-condition-model.js.map +1 -0
- package/dist/browser/conditions/inline-condition-operators.d.ts +175 -0
- package/dist/browser/conditions/inline-condition-operators.d.ts.map +1 -0
- package/dist/browser/conditions/inline-condition-operators.js +132 -0
- package/dist/browser/conditions/inline-condition-operators.js.map +1 -0
- package/dist/browser/conditions/inline-condition-values.d.ts +93 -0
- package/dist/browser/conditions/inline-condition-values.d.ts.map +1 -0
- package/dist/browser/conditions/inline-condition-values.js +159 -0
- package/dist/browser/conditions/inline-condition-values.js.map +1 -0
- package/dist/browser/conditions/types.d.ts +38 -0
- package/dist/browser/conditions/types.d.ts.map +1 -0
- package/dist/browser/conditions/types.js +24 -0
- package/dist/browser/conditions/types.js.map +1 -0
- package/dist/browser/data-model/conditions-wrapper.d.ts +19 -0
- package/dist/browser/data-model/conditions-wrapper.d.ts.map +1 -0
- package/dist/browser/data-model/conditions-wrapper.js +49 -0
- package/dist/browser/data-model/conditions-wrapper.js.map +1 -0
- package/dist/browser/data-model/index.d.ts +4 -0
- package/dist/browser/data-model/index.d.ts.map +1 -0
- package/dist/browser/data-model/index.js +66 -0
- package/dist/browser/data-model/index.js.map +1 -0
- package/dist/browser/data-model/input-wrapper.d.ts +16 -0
- package/dist/browser/data-model/input-wrapper.d.ts.map +1 -0
- package/dist/browser/data-model/input-wrapper.js +49 -0
- package/dist/browser/data-model/input-wrapper.js.map +1 -0
- package/dist/browser/data-model/types.d.ts +153 -0
- package/dist/browser/data-model/types.d.ts.map +1 -0
- package/dist/browser/data-model/types.js +34 -0
- package/dist/browser/data-model/types.js.map +1 -0
- package/dist/browser/form/form-configuration.d.ts +8 -0
- package/dist/browser/form/form-configuration.d.ts.map +1 -0
- package/dist/browser/form/form-configuration.js +38 -0
- package/dist/browser/form/form-configuration.js.map +1 -0
- package/dist/browser/form/index.d.ts +2 -0
- package/dist/browser/form/index.d.ts.map +1 -0
- package/dist/browser/form/index.js +24 -0
- package/dist/browser/form/index.js.map +1 -0
- package/dist/browser/index.d.ts +12 -0
- package/dist/browser/index.d.ts.map +1 -0
- package/dist/browser/index.js +138 -0
- package/dist/browser/index.js.map +1 -0
- package/dist/browser/migration/index.d.ts +2 -0
- package/dist/browser/migration/index.d.ts.map +1 -0
- package/dist/browser/migration/index.js +24 -0
- package/dist/browser/migration/index.js.map +1 -0
- package/dist/browser/migration/migration.0-2.d.ts +3 -0
- package/dist/browser/migration/migration.0-2.d.ts.map +1 -0
- package/dist/browser/migration/migration.0-2.js +65 -0
- package/dist/browser/migration/migration.0-2.js.map +1 -0
- package/dist/browser/migration/migration.1-2.d.ts +3 -0
- package/dist/browser/migration/migration.1-2.d.ts.map +1 -0
- package/dist/browser/migration/migration.1-2.js +108 -0
- package/dist/browser/migration/migration.1-2.js.map +1 -0
- package/dist/browser/migration/types.d.ts +2 -0
- package/dist/browser/migration/types.d.ts.map +1 -0
- package/dist/browser/migration/types.js +16 -0
- package/dist/browser/migration/types.js.map +1 -0
- package/dist/browser/migration/whichMigrations.d.ts +7 -0
- package/dist/browser/migration/whichMigrations.d.ts.map +1 -0
- package/dist/browser/migration/whichMigrations.js +38 -0
- package/dist/browser/migration/whichMigrations.js.map +1 -0
- package/dist/browser/schema/index.d.ts +2 -0
- package/dist/browser/schema/index.d.ts.map +1 -0
- package/dist/browser/schema/index.js +30 -0
- package/dist/browser/schema/index.js.map +1 -0
- package/dist/browser/schema/schema.d.ts +20 -0
- package/dist/browser/schema/schema.d.ts.map +1 -0
- package/dist/browser/schema/schema.js +255 -0
- package/dist/browser/schema/schema.js.map +1 -0
- package/dist/browser/utils/helpers.d.ts +9 -0
- package/dist/browser/utils/helpers.d.ts.map +1 -0
- package/dist/browser/utils/helpers.js +48 -0
- package/dist/browser/utils/helpers.js.map +1 -0
- package/dist/browser/utils/logger.d.ts +11 -0
- package/dist/browser/utils/logger.d.ts.map +1 -0
- package/dist/browser/utils/logger.js +46 -0
- package/dist/browser/utils/logger.js.map +1 -0
- package/dist/module/components/component-types.d.ts +3 -0
- package/dist/module/components/component-types.d.ts.map +1 -0
- package/dist/module/components/component-types.js +206 -0
- package/dist/module/components/component-types.js.map +1 -0
- package/dist/module/components/conditional-component-types.d.ts +3 -0
- package/dist/module/components/conditional-component-types.d.ts.map +1 -0
- package/dist/module/components/conditional-component-types.js +14 -0
- package/dist/module/components/conditional-component-types.js.map +1 -0
- package/dist/module/components/index.d.ts +4 -0
- package/dist/module/components/index.d.ts.map +1 -0
- package/dist/module/components/index.js +34 -0
- package/dist/module/components/index.js.map +1 -0
- package/dist/module/components/types.d.ts +244 -0
- package/dist/module/components/types.d.ts.map +1 -0
- package/dist/module/components/types.js +42 -0
- package/dist/module/components/types.js.map +1 -0
- package/dist/module/conditions/condition-abstract.d.ts +16 -0
- package/dist/module/conditions/condition-abstract.d.ts.map +1 -0
- package/dist/module/conditions/condition-abstract.js +45 -0
- package/dist/module/conditions/condition-abstract.js.map +1 -0
- package/dist/module/conditions/condition-field.d.ts +13 -0
- package/dist/module/conditions/condition-field.d.ts.map +1 -0
- package/dist/module/conditions/condition-field.js +26 -0
- package/dist/module/conditions/condition-field.js.map +1 -0
- package/dist/module/conditions/condition-group-def.d.ts +10 -0
- package/dist/module/conditions/condition-group-def.d.ts.map +1 -0
- package/dist/module/conditions/condition-group-def.js +26 -0
- package/dist/module/conditions/condition-group-def.js.map +1 -0
- package/dist/module/conditions/condition-group.d.ts +15 -0
- package/dist/module/conditions/condition-group.d.ts.map +1 -0
- package/dist/module/conditions/condition-group.js +47 -0
- package/dist/module/conditions/condition-group.js.map +1 -0
- package/dist/module/conditions/condition-model.d.ts +41 -0
- package/dist/module/conditions/condition-model.d.ts.map +1 -0
- package/dist/module/conditions/condition-model.js +199 -0
- package/dist/module/conditions/condition-model.js.map +1 -0
- package/dist/module/conditions/condition-operators.d.ts +248 -0
- package/dist/module/conditions/condition-operators.d.ts.map +1 -0
- package/dist/module/conditions/condition-operators.js +119 -0
- package/dist/module/conditions/condition-operators.js.map +1 -0
- package/dist/module/conditions/condition-ref.d.ts +12 -0
- package/dist/module/conditions/condition-ref.d.ts.map +1 -0
- package/dist/module/conditions/condition-ref.js +33 -0
- package/dist/module/conditions/condition-ref.js.map +1 -0
- package/dist/module/conditions/condition-value-abstract.d.ts +8 -0
- package/dist/module/conditions/condition-value-abstract.d.ts.map +1 -0
- package/dist/module/conditions/condition-value-abstract.js +24 -0
- package/dist/module/conditions/condition-value-abstract.js.map +1 -0
- package/dist/module/conditions/condition-value-registration.d.ts +10 -0
- package/dist/module/conditions/condition-value-registration.d.ts.map +1 -0
- package/dist/module/conditions/condition-value-registration.js +19 -0
- package/dist/module/conditions/condition-value-registration.js.map +1 -0
- package/dist/module/conditions/condition-values.d.ts +38 -0
- package/dist/module/conditions/condition-values.d.ts.map +1 -0
- package/dist/module/conditions/condition-values.js +106 -0
- package/dist/module/conditions/condition-values.js.map +1 -0
- package/dist/module/conditions/condition.d.ts +15 -0
- package/dist/module/conditions/condition.d.ts.map +1 -0
- package/dist/module/conditions/condition.js +40 -0
- package/dist/module/conditions/condition.js.map +1 -0
- package/dist/module/conditions/helpers.d.ts +3 -0
- package/dist/module/conditions/helpers.d.ts.map +1 -0
- package/dist/module/conditions/helpers.js +12 -0
- package/dist/module/conditions/helpers.js.map +1 -0
- package/dist/module/conditions/index.d.ts +11 -0
- package/dist/module/conditions/index.d.ts.map +1 -0
- package/dist/module/conditions/index.js +140 -0
- package/dist/module/conditions/index.js.map +1 -0
- package/dist/module/conditions/inline-condition-model.d.ts +86 -0
- package/dist/module/conditions/inline-condition-model.d.ts.map +1 -0
- package/dist/module/conditions/inline-condition-model.js +384 -0
- package/dist/module/conditions/inline-condition-model.js.map +1 -0
- package/dist/module/conditions/inline-condition-operators.d.ts +175 -0
- package/dist/module/conditions/inline-condition-operators.d.ts.map +1 -0
- package/dist/module/conditions/inline-condition-operators.js +119 -0
- package/dist/module/conditions/inline-condition-operators.js.map +1 -0
- package/dist/module/conditions/inline-condition-values.d.ts +93 -0
- package/dist/module/conditions/inline-condition-values.d.ts.map +1 -0
- package/dist/module/conditions/inline-condition-values.js +134 -0
- package/dist/module/conditions/inline-condition-values.js.map +1 -0
- package/dist/module/conditions/types.d.ts +38 -0
- package/dist/module/conditions/types.d.ts.map +1 -0
- package/dist/module/conditions/types.js +10 -0
- package/dist/module/conditions/types.js.map +1 -0
- package/dist/module/data-model/conditions-wrapper.d.ts +19 -0
- package/dist/module/data-model/conditions-wrapper.d.ts.map +1 -0
- package/dist/module/data-model/conditions-wrapper.js +30 -0
- package/dist/module/data-model/conditions-wrapper.js.map +1 -0
- package/dist/module/data-model/index.d.ts +4 -0
- package/dist/module/data-model/index.d.ts.map +1 -0
- package/dist/module/data-model/index.js +55 -0
- package/dist/module/data-model/index.js.map +1 -0
- package/dist/module/data-model/input-wrapper.d.ts +16 -0
- package/dist/module/data-model/input-wrapper.d.ts.map +1 -0
- package/dist/module/data-model/input-wrapper.js +25 -0
- package/dist/module/data-model/input-wrapper.js.map +1 -0
- package/dist/module/data-model/types.d.ts +153 -0
- package/dist/module/data-model/types.d.ts.map +1 -0
- package/dist/module/data-model/types.js +20 -0
- package/dist/module/data-model/types.js.map +1 -0
- package/dist/module/form/form-configuration.d.ts +8 -0
- package/dist/module/form/form-configuration.d.ts.map +1 -0
- package/dist/module/form/form-configuration.js +17 -0
- package/dist/module/form/form-configuration.js.map +1 -0
- package/dist/module/form/index.d.ts +2 -0
- package/dist/module/form/index.d.ts.map +1 -0
- package/dist/module/form/index.js +11 -0
- package/dist/module/form/index.js.map +1 -0
- package/dist/module/index.d.ts +12 -0
- package/dist/module/index.d.ts.map +1 -0
- package/dist/module/index.js +135 -0
- package/dist/module/index.js.map +1 -0
- package/dist/module/migration/index.d.ts +2 -0
- package/dist/module/migration/index.d.ts.map +1 -0
- package/dist/module/migration/index.js +11 -0
- package/dist/module/migration/index.js.map +1 -0
- package/dist/module/migration/migration.0-2.d.ts +3 -0
- package/dist/module/migration/migration.0-2.d.ts.map +1 -0
- package/dist/module/migration/migration.0-2.js +42 -0
- package/dist/module/migration/migration.0-2.js.map +1 -0
- package/dist/module/migration/migration.1-2.d.ts +3 -0
- package/dist/module/migration/migration.1-2.d.ts.map +1 -0
- package/dist/module/migration/migration.1-2.js +90 -0
- package/dist/module/migration/migration.1-2.js.map +1 -0
- package/dist/module/migration/types.d.ts +2 -0
- package/dist/module/migration/types.d.ts.map +1 -0
- package/dist/module/migration/types.js +1 -0
- package/dist/module/migration/types.js.map +1 -0
- package/dist/module/migration/whichMigrations.d.ts +7 -0
- package/dist/module/migration/whichMigrations.d.ts.map +1 -0
- package/dist/module/migration/whichMigrations.js +26 -0
- package/dist/module/migration/whichMigrations.js.map +1 -0
- package/dist/module/schema/index.d.ts +2 -0
- package/dist/module/schema/index.d.ts.map +1 -0
- package/dist/module/schema/index.js +17 -0
- package/dist/module/schema/index.js.map +1 -0
- package/dist/module/schema/schema.d.ts +20 -0
- package/dist/module/schema/schema.d.ts.map +1 -0
- package/dist/module/schema/schema.js +239 -0
- package/dist/module/schema/schema.js.map +1 -0
- package/dist/module/utils/helpers.d.ts +9 -0
- package/dist/module/utils/helpers.d.ts.map +1 -0
- package/dist/module/utils/helpers.js +35 -0
- package/dist/module/utils/helpers.js.map +1 -0
- package/dist/module/utils/logger.d.ts +11 -0
- package/dist/module/utils/logger.d.ts.map +1 -0
- package/dist/module/utils/logger.js +27 -0
- package/dist/module/utils/logger.js.map +1 -0
- package/package.json +35 -0
- package/src/components/component-types.ts +229 -0
- package/src/components/conditional-component-types.ts +14 -0
- package/src/components/index.ts +3 -0
- package/src/components/types.ts +362 -0
- package/src/conditions/condition-abstract.ts +59 -0
- package/src/conditions/condition-field.ts +29 -0
- package/src/conditions/condition-group-def.ts +29 -0
- package/src/conditions/condition-group.ts +61 -0
- package/src/conditions/condition-model.ts +314 -0
- package/src/conditions/condition-operators.ts +176 -0
- package/src/conditions/condition-ref.ts +47 -0
- package/src/conditions/condition-value-abstract.ts +31 -0
- package/src/conditions/condition-value-registration.ts +18 -0
- package/src/conditions/condition-values.ts +146 -0
- package/src/conditions/condition.ts +64 -0
- package/src/conditions/helpers.ts +7 -0
- package/src/conditions/index.ts +27 -0
- package/src/conditions/inline-condition-model.ts +550 -0
- package/src/conditions/inline-condition-operators.ts +166 -0
- package/src/conditions/inline-condition-values.ts +153 -0
- package/src/conditions/types.ts +30 -0
- package/src/data-model/conditions-wrapper.ts +42 -0
- package/src/data-model/index.ts +3 -0
- package/src/data-model/input-wrapper.ts +40 -0
- package/src/data-model/types.ts +179 -0
- package/src/form/form-configuration.ts +21 -0
- package/src/form/index.ts +1 -0
- package/src/index.ts +11 -0
- package/src/migration/index.ts +1 -0
- package/src/migration/migration.0-2.ts +29 -0
- package/src/migration/migration.1-2.ts +105 -0
- package/src/migration/types.ts +1 -0
- package/src/migration/whichMigrations.ts +23 -0
- package/src/schema/index.ts +1 -0
- package/src/schema/schema.ts +300 -0
- package/src/utils/helpers.ts +37 -0
- package/src/utils/logger.ts +29 -0
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"inline-condition-values.js","names":["conditionValueFactories","Registration","constructor","type","factory","_defineProperty","AbstractConditionValue","registration","new","target","TypeError","toPresentationString","toExpression","_exports","valueType","registerValueType","obj","ConditionValue","from","value","display","Error","clone","dateDirections","FUTURE","PAST","dateUnits","YEARS","MONTHS","DAYS","timeUnits","HOURS","MINUTES","SECONDS","dateTimeUnits","Object","assign","relativeTimeValueType","RelativeTimeValue","timePeriod","timeUnit","direction","timeOnly","values","map","it","includes","Number","valueFrom"],"sources":["../../../src/conditions/inline-condition-values.ts"],"sourcesContent":["const conditionValueFactories = {}\n\nclass Registration {\n type\n\n constructor(type, factory) {\n conditionValueFactories[type] = factory\n this.type = type\n }\n}\n\nexport class AbstractConditionValue {\n type\n\n constructor(registration) {\n if (new.target === AbstractConditionValue) {\n throw new TypeError('Cannot construct ConditionValue instances directly')\n }\n if (!(registration instanceof Registration)) {\n throw new TypeError(\n 'You must register your value type! Call registerValueType!'\n )\n }\n this.type = registration.type\n }\n\n toPresentationString() {}\n toExpression() {}\n}\n\nconst valueType = registerValueType('Value', (obj) => ConditionValue.from(obj))\nexport class ConditionValue extends AbstractConditionValue {\n value\n display\n\n constructor(value, display) {\n super(valueType)\n if (!value || typeof value !== 'string') {\n throw Error(`value ${value} is not valid`)\n }\n if (display && typeof display !== 'string') {\n throw Error(`display ${display} is not valid`)\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) {\n return new ConditionValue(obj.value, obj.display)\n }\n\n clone() {\n return ConditionValue.from(this)\n }\n}\n\nexport const dateDirections = {\n FUTURE: 'in the future',\n PAST: 'in the past'\n}\n\nexport const dateUnits = {\n YEARS: { display: 'year(s)', value: 'years' },\n MONTHS: { display: 'month(s)', value: 'months' },\n DAYS: { display: 'day(s)', value: 'days' }\n}\nexport const timeUnits = {\n HOURS: { display: 'hour(s)', value: 'hours' },\n MINUTES: { display: 'minute(s)', value: 'minutes' },\n SECONDS: { display: 'second(s)', value: 'seconds' }\n}\nexport const dateTimeUnits = Object.assign({}, dateUnits, timeUnits)\n\nexport const relativeTimeValueType = registerValueType('RelativeTime', (obj) =>\n RelativeTimeValue.from(obj)\n)\nexport class RelativeTimeValue extends AbstractConditionValue {\n timePeriod\n timeUnit\n direction\n timeOnly\n\n constructor(timePeriod, timeUnit, direction, timeOnly = false) {\n super(relativeTimeValueType)\n if (typeof timePeriod !== 'string') {\n throw Error(`time period ${timePeriod} is not valid`)\n }\n if (\n !Object.values(dateTimeUnits)\n .map((it) => it.value)\n .includes(timeUnit)\n ) {\n throw Error(`time unit ${timeUnit} is not valid`)\n }\n if (!Object.values(dateDirections).includes(direction)) {\n throw Error(`direction ${direction} is not valid`)\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() {\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\n/**\n * All value types should call this, and should be located in this file.\n * Furthermore the types should be registered without the classes needing to be instantiated.\n *\n * Otherwise we can't guarantee they've been registered for deserialization before\n * valueFrom is called\n */\nfunction registerValueType(type, factory) {\n return new Registration(type, factory)\n}\n\nexport function valueFrom(obj) {\n return conditionValueFactories[obj.type](obj)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;EAAA,MAAMA,uBAAuB,GAAG,CAAC,CAAC;EAElC,MAAMC,YAAY,CAAC;IAGjBC,WAAWA,CAACC,IAAI,EAAEC,OAAO,EAAE;MAAAC,eAAA;MACzBL,uBAAuB,CAACG,IAAI,CAAC,GAAGC,OAAO;MACvC,IAAI,CAACD,IAAI,GAAGA,IAAI;IAClB;EACF;EAEO,MAAMG,sBAAsB,CAAC;IAGlCJ,WAAWA,CAACK,YAAY,EAAE;MAAAF,eAAA;MACxB,IAAIG,GAAG,CAACC,MAAM,KAAKH,sBAAsB,EAAE;QACzC,MAAM,IAAII,SAAS,CAAC,oDAAoD,CAAC;MAC3E;MACA,IAAI,EAAEH,YAAY,YAAYN,YAAY,CAAC,EAAE;QAC3C,MAAM,IAAIS,SAAS,CACjB,4DACF,CAAC;MACH;MACA,IAAI,CAACP,IAAI,GAAGI,YAAY,CAACJ,IAAI;IAC/B;IAEAQ,oBAAoBA,CAAA,EAAG,CAAC;IACxBC,YAAYA,CAAA,EAAG,CAAC;EAClB;EAACC,QAAA,CAAAP,sBAAA,GAAAA,sBAAA;EAED,MAAMQ,SAAS,GAAGC,iBAAiB,CAAC,OAAO,EAAGC,GAAG,IAAKC,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CAACb,IAAI,CAAC,CAACa,GAAG,CAAC;EAC/C;AAAC"}
|
@@ -0,0 +1,38 @@
|
|
1
|
+
import { Condition } from './condition';
|
2
|
+
import { ConditionRef } from './condition-ref';
|
3
|
+
import { ConditionGroup } from './condition-group';
|
4
|
+
export type ConditionsArray = (Condition | ConditionGroup | ConditionRef)[];
|
5
|
+
export declare enum Coordinator {
|
6
|
+
AND = "and",
|
7
|
+
OR = "or"
|
8
|
+
}
|
9
|
+
export type DateTimeUnitValues = 'years' | 'months' | 'days' | 'hours' | 'minutes' | 'seconds';
|
10
|
+
export type DateUnits = {
|
11
|
+
YEARS: {
|
12
|
+
display: 'year(s)';
|
13
|
+
value: 'years';
|
14
|
+
};
|
15
|
+
MONTHS: {
|
16
|
+
display: 'month(s)';
|
17
|
+
value: 'months';
|
18
|
+
};
|
19
|
+
DAYS: {
|
20
|
+
display: 'day(s)';
|
21
|
+
value: 'days';
|
22
|
+
};
|
23
|
+
};
|
24
|
+
export type TimeUnits = {
|
25
|
+
HOURS: {
|
26
|
+
display: 'hour(s)';
|
27
|
+
value: 'hours';
|
28
|
+
};
|
29
|
+
MINUTES: {
|
30
|
+
display: 'minute(s)';
|
31
|
+
value: 'minutes';
|
32
|
+
};
|
33
|
+
SECONDS: {
|
34
|
+
display: 'second(s)';
|
35
|
+
value: 'seconds';
|
36
|
+
};
|
37
|
+
};
|
38
|
+
//# sourceMappingURL=types.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/conditions/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAElD,MAAM,MAAM,eAAe,GAAG,CAAC,SAAS,GAAG,cAAc,GAAG,YAAY,CAAC,EAAE,CAAA;AAE3E,oBAAY,WAAW;IACrB,GAAG,QAAQ;IACX,EAAE,OAAO;CACV;AAED,MAAM,MAAM,kBAAkB,GAC1B,OAAO,GACP,QAAQ,GACR,MAAM,GACN,OAAO,GACP,SAAS,GACT,SAAS,CAAA;AAEb,MAAM,MAAM,SAAS,GAAG;IACtB,KAAK,EAAE;QAAE,OAAO,EAAE,SAAS,CAAC;QAAC,KAAK,EAAE,OAAO,CAAA;KAAE,CAAA;IAC7C,MAAM,EAAE;QAAE,OAAO,EAAE,UAAU,CAAC;QAAC,KAAK,EAAE,QAAQ,CAAA;KAAE,CAAA;IAChD,IAAI,EAAE;QAAE,OAAO,EAAE,QAAQ,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAA;CAC3C,CAAA;AAED,MAAM,MAAM,SAAS,GAAG;IACtB,KAAK,EAAE;QAAE,OAAO,EAAE,SAAS,CAAC;QAAC,KAAK,EAAE,OAAO,CAAA;KAAE,CAAA;IAC7C,OAAO,EAAE;QAAE,OAAO,EAAE,WAAW,CAAC;QAAC,KAAK,EAAE,SAAS,CAAA;KAAE,CAAA;IACnD,OAAO,EAAE;QAAE,OAAO,EAAE,WAAW,CAAC;QAAC,KAAK,EAAE,SAAS,CAAA;KAAE,CAAA;CACpD,CAAA"}
|
@@ -0,0 +1,24 @@
|
|
1
|
+
(function (global, factory) {
|
2
|
+
if (typeof define === "function" && define.amd) {
|
3
|
+
define(["exports"], factory);
|
4
|
+
} else if (typeof exports !== "undefined") {
|
5
|
+
factory(exports);
|
6
|
+
} else {
|
7
|
+
var mod = {
|
8
|
+
exports: {}
|
9
|
+
};
|
10
|
+
factory(mod.exports);
|
11
|
+
global.types = mod.exports;
|
12
|
+
}
|
13
|
+
})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) {
|
14
|
+
"use strict";
|
15
|
+
|
16
|
+
_exports.__esModule = true;
|
17
|
+
_exports.Coordinator = void 0;
|
18
|
+
let Coordinator = _exports.Coordinator = /*#__PURE__*/function (Coordinator) {
|
19
|
+
Coordinator["AND"] = "and";
|
20
|
+
Coordinator["OR"] = "or";
|
21
|
+
return Coordinator;
|
22
|
+
}({});
|
23
|
+
});
|
24
|
+
//# sourceMappingURL=types.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"types.js","names":["Coordinator","_exports"],"sources":["../../../src/conditions/types.ts"],"sourcesContent":["import { Condition } from './condition'\nimport { ConditionRef } from './condition-ref'\nimport { ConditionGroup } from './condition-group'\n\nexport type ConditionsArray = (Condition | ConditionGroup | ConditionRef)[]\n\nexport enum Coordinator {\n AND = 'and',\n OR = 'or'\n}\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":";;;;;;;;;;;;;;;;;MAMYA,WAAW,GAAAC,QAAA,CAAAD,WAAA,0BAAXA,WAAW;IAAXA,WAAW;IAAXA,WAAW;IAAA,OAAXA,WAAW;EAAA;AAAA"}
|
@@ -0,0 +1,19 @@
|
|
1
|
+
import { Condition } from '../conditions/condition';
|
2
|
+
export type ConditionWrapperValue = string | {
|
3
|
+
name: string;
|
4
|
+
conditions: Condition[];
|
5
|
+
};
|
6
|
+
export type ConditionRawData = {
|
7
|
+
name: string;
|
8
|
+
displayName: string;
|
9
|
+
value: ConditionWrapperValue;
|
10
|
+
};
|
11
|
+
export declare class ConditionsWrapper {
|
12
|
+
name: string;
|
13
|
+
displayName: string;
|
14
|
+
value: ConditionWrapperValue;
|
15
|
+
constructor(rawData: ConditionRawData);
|
16
|
+
get expression(): string;
|
17
|
+
clone(): ConditionsWrapper;
|
18
|
+
}
|
19
|
+
//# sourceMappingURL=conditions-wrapper.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"conditions-wrapper.d.ts","sourceRoot":"","sources":["../../../src/data-model/conditions-wrapper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AAGnD,MAAM,MAAM,qBAAqB,GAC7B,MAAM,GACN;IACE,IAAI,EAAE,MAAM,CAAA;IACZ,UAAU,EAAE,SAAS,EAAE,CAAA;CACxB,CAAA;AAEL,MAAM,MAAM,gBAAgB,GAAG;IAC7B,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,MAAM,CAAA;IACnB,KAAK,EAAE,qBAAqB,CAAA;CAC7B,CAAA;AAED,qBAAa,iBAAiB;IAC5B,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,MAAM,CAAA;IACnB,KAAK,EAAE,qBAAqB,CAAA;gBAEhB,OAAO,EAAE,gBAAgB;IAOrC,IAAI,UAAU,WAQb;IAED,KAAK,IAAI,iBAAiB;CAG3B"}
|
@@ -0,0 +1,49 @@
|
|
1
|
+
(function (global, factory) {
|
2
|
+
if (typeof define === "function" && define.amd) {
|
3
|
+
define(["exports", "../conditions/condition-model"], factory);
|
4
|
+
} else if (typeof exports !== "undefined") {
|
5
|
+
factory(exports, require("../conditions/condition-model"));
|
6
|
+
} else {
|
7
|
+
var mod = {
|
8
|
+
exports: {}
|
9
|
+
};
|
10
|
+
factory(mod.exports, global.conditionModel);
|
11
|
+
global.conditionsWrapper = mod.exports;
|
12
|
+
}
|
13
|
+
})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _conditionModel) {
|
14
|
+
"use strict";
|
15
|
+
|
16
|
+
_exports.__esModule = true;
|
17
|
+
_exports.ConditionsWrapper = void 0;
|
18
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
19
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
|
20
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
21
|
+
class ConditionsWrapper {
|
22
|
+
constructor(rawData) {
|
23
|
+
_defineProperty(this, "name", void 0);
|
24
|
+
_defineProperty(this, "displayName", void 0);
|
25
|
+
_defineProperty(this, "value", void 0);
|
26
|
+
const {
|
27
|
+
name,
|
28
|
+
displayName,
|
29
|
+
value
|
30
|
+
} = rawData;
|
31
|
+
this.displayName = displayName || name;
|
32
|
+
this.value = value;
|
33
|
+
this.name = name;
|
34
|
+
}
|
35
|
+
get expression() {
|
36
|
+
if (typeof this.value === 'string') {
|
37
|
+
// Previously conditions were defined as strings, e.g: "section.age < 18"
|
38
|
+
// keep this so application can support legacy forms exports.
|
39
|
+
return this.value;
|
40
|
+
}
|
41
|
+
return _conditionModel.ConditionsModel.from(this.value).toExpression();
|
42
|
+
}
|
43
|
+
clone() {
|
44
|
+
return new ConditionsWrapper(this);
|
45
|
+
}
|
46
|
+
}
|
47
|
+
_exports.ConditionsWrapper = ConditionsWrapper;
|
48
|
+
});
|
49
|
+
//# sourceMappingURL=conditions-wrapper.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"conditions-wrapper.js","names":["ConditionsWrapper","constructor","rawData","_defineProperty","name","displayName","value","expression","ConditionsModel","from","toExpression","clone","_exports"],"sources":["../../../src/data-model/conditions-wrapper.ts"],"sourcesContent":["import { Condition } from '../conditions/condition'\nimport { ConditionsModel } from '../conditions/condition-model'\n\nexport type ConditionWrapperValue =\n | string\n | {\n name: string\n conditions: Condition[]\n }\n\nexport type ConditionRawData = {\n name: string\n displayName: string\n value: ConditionWrapperValue\n}\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":";;;;;;;;;;;;;;;;;;;;EAgBO,MAAMA,iBAAiB,CAAC;IAK7BC,WAAWA,CAACC,OAAyB,EAAE;MAAAC,eAAA;MAAAA,eAAA;MAAAA,eAAA;MACrC,MAAM;QAAEC,IAAI;QAAEC,WAAW;QAAEC;MAAM,CAAC,GAAGJ,OAAO;MAC5C,IAAI,CAACG,WAAW,GAAGA,WAAW,IAAID,IAAI;MACtC,IAAI,CAACE,KAAK,GAAGA,KAAK;MAClB,IAAI,CAACF,IAAI,GAAGA,IAAI;IAClB;IAEA,IAAIG,UAAUA,CAAA,EAAG;MACf,IAAI,OAAO,IAAI,CAACD,KAAK,KAAK,QAAQ,EAAE;QAClC;QACA;QACA,OAAO,IAAI,CAACA,KAAK;MACnB;MAEA,OAAOE,+BAAe,CAACC,IAAI,CAAC,IAAI,CAACH,KAAK,CAAC,CAACI,YAAY,CAAC,CAAC;IACxD;IAEAC,KAAKA,CAAA,EAAsB;MACzB,OAAO,IAAIX,iBAAiB,CAAC,IAAI,CAAC;IACpC;EACF;EAACY,QAAA,CAAAZ,iBAAA,GAAAA,iBAAA;AAAA"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/data-model/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAC9C,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AAC1E,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA"}
|
@@ -0,0 +1,66 @@
|
|
1
|
+
(function (global, factory) {
|
2
|
+
if (typeof define === "function" && define.amd) {
|
3
|
+
define(["exports", "./input-wrapper", "./conditions-wrapper", "./types"], factory);
|
4
|
+
} else if (typeof exports !== "undefined") {
|
5
|
+
factory(exports, require("./input-wrapper"), require("./conditions-wrapper"), require("./types"));
|
6
|
+
} else {
|
7
|
+
var mod = {
|
8
|
+
exports: {}
|
9
|
+
};
|
10
|
+
factory(mod.exports, global.inputWrapper, global.conditionsWrapper, global.types);
|
11
|
+
global.index = mod.exports;
|
12
|
+
}
|
13
|
+
})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _inputWrapper, _conditionsWrapper, _types) {
|
14
|
+
"use strict";
|
15
|
+
|
16
|
+
_exports.__esModule = true;
|
17
|
+
Object.defineProperty(_exports, "ConditionRawData", {
|
18
|
+
enumerable: true,
|
19
|
+
get: function () {
|
20
|
+
return _conditionsWrapper.ConditionRawData;
|
21
|
+
}
|
22
|
+
});
|
23
|
+
Object.defineProperty(_exports, "ConditionsWrapper", {
|
24
|
+
enumerable: true,
|
25
|
+
get: function () {
|
26
|
+
return _conditionsWrapper.ConditionsWrapper;
|
27
|
+
}
|
28
|
+
});
|
29
|
+
Object.defineProperty(_exports, "ConfirmationPage", {
|
30
|
+
enumerable: true,
|
31
|
+
get: function () {
|
32
|
+
return _types.ConfirmationPage;
|
33
|
+
}
|
34
|
+
});
|
35
|
+
Object.defineProperty(_exports, "InputWrapper", {
|
36
|
+
enumerable: true,
|
37
|
+
get: function () {
|
38
|
+
return _inputWrapper.InputWrapper;
|
39
|
+
}
|
40
|
+
});
|
41
|
+
Object.defineProperty(_exports, "Item", {
|
42
|
+
enumerable: true,
|
43
|
+
get: function () {
|
44
|
+
return _types.Item;
|
45
|
+
}
|
46
|
+
});
|
47
|
+
Object.defineProperty(_exports, "List", {
|
48
|
+
enumerable: true,
|
49
|
+
get: function () {
|
50
|
+
return _types.List;
|
51
|
+
}
|
52
|
+
});
|
53
|
+
Object.defineProperty(_exports, "Page", {
|
54
|
+
enumerable: true,
|
55
|
+
get: function () {
|
56
|
+
return _types.Page;
|
57
|
+
}
|
58
|
+
});
|
59
|
+
Object.defineProperty(_exports, "Section", {
|
60
|
+
enumerable: true,
|
61
|
+
get: function () {
|
62
|
+
return _types.Section;
|
63
|
+
}
|
64
|
+
});
|
65
|
+
});
|
66
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/data-model/index.ts"],"sourcesContent":["export { InputWrapper } from './input-wrapper'\nexport { ConditionsWrapper, ConditionRawData } from './conditions-wrapper'\nexport { Page, Item, Section, List, ConfirmationPage } from './types'\n"],"mappings":""}
|
@@ -0,0 +1,16 @@
|
|
1
|
+
import { ComponentDef } from '../components/types';
|
2
|
+
import { Page } from './types';
|
3
|
+
export declare class InputWrapper {
|
4
|
+
#private;
|
5
|
+
name: string | undefined;
|
6
|
+
title: string | undefined;
|
7
|
+
type: string | undefined;
|
8
|
+
propertyPath: string | undefined;
|
9
|
+
page: Page;
|
10
|
+
constructor(rawData: ComponentDef, page: Page, options: {
|
11
|
+
ignoreSection?: boolean;
|
12
|
+
parentItemName?: string;
|
13
|
+
});
|
14
|
+
get displayName(): string | undefined;
|
15
|
+
}
|
16
|
+
//# sourceMappingURL=input-wrapper.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"input-wrapper.d.ts","sourceRoot":"","sources":["../../../src/data-model/input-wrapper.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAE9B,qBAAa,YAAY;;IACvB,IAAI,EAAE,MAAM,GAAG,SAAS,CAAY;IACpC,KAAK,EAAE,MAAM,GAAG,SAAS,CAAY;IACrC,IAAI,EAAE,MAAM,GAAG,SAAS,CAAY;IACpC,YAAY,EAAE,MAAM,GAAG,SAAS,CAAA;IAEhC,IAAI,EAAE,IAAI,CAAA;gBAGR,OAAO,EAAE,YAAY,EACrB,IAAI,EAAE,IAAI,EACV,OAAO,EAAE;QAAE,aAAa,CAAC,EAAE,OAAO,CAAC;QAAC,cAAc,CAAC,EAAE,MAAM,CAAA;KAAE;IAe/D,IAAI,WAAW,IAAI,MAAM,GAAG,SAAS,CAQpC;CACF"}
|
@@ -0,0 +1,49 @@
|
|
1
|
+
(function (global, factory) {
|
2
|
+
if (typeof define === "function" && define.amd) {
|
3
|
+
define(["exports", "../utils/helpers"], factory);
|
4
|
+
} else if (typeof exports !== "undefined") {
|
5
|
+
factory(exports, require("../utils/helpers"));
|
6
|
+
} else {
|
7
|
+
var mod = {
|
8
|
+
exports: {}
|
9
|
+
};
|
10
|
+
factory(mod.exports, global.helpers);
|
11
|
+
global.inputWrapper = mod.exports;
|
12
|
+
}
|
13
|
+
})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _helpers) {
|
14
|
+
"use strict";
|
15
|
+
|
16
|
+
_exports.__esModule = true;
|
17
|
+
_exports.InputWrapper = void 0;
|
18
|
+
function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
|
19
|
+
function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
|
20
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
21
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
|
22
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
23
|
+
function _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }
|
24
|
+
function _classPrivateFieldSet(s, a, r) { return s.set(_assertClassBrand(s, a), r), r; }
|
25
|
+
function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); }
|
26
|
+
var _parentItemName = /*#__PURE__*/new WeakMap();
|
27
|
+
class InputWrapper {
|
28
|
+
constructor(rawData, page, options) {
|
29
|
+
_defineProperty(this, "name", undefined);
|
30
|
+
_defineProperty(this, "title", undefined);
|
31
|
+
_defineProperty(this, "type", undefined);
|
32
|
+
_defineProperty(this, "propertyPath", void 0);
|
33
|
+
_classPrivateFieldInitSpec(this, _parentItemName, void 0);
|
34
|
+
_defineProperty(this, "page", void 0);
|
35
|
+
Object.assign(this, rawData);
|
36
|
+
const myPage = (0, _helpers.clone)(page);
|
37
|
+
delete myPage.components;
|
38
|
+
this.page = myPage;
|
39
|
+
this.propertyPath = !options.ignoreSection && page.section ? `${page.section}.${this.name}` : this.name;
|
40
|
+
_classPrivateFieldSet(_parentItemName, this, options.parentItemName);
|
41
|
+
}
|
42
|
+
get displayName() {
|
43
|
+
const titleWithContext = _classPrivateFieldGet(_parentItemName, this) ? `${this.title} under ${_classPrivateFieldGet(_parentItemName, this)}` : this.title;
|
44
|
+
return this.page.section ? `${titleWithContext} in ${this.page.section}` : titleWithContext;
|
45
|
+
}
|
46
|
+
}
|
47
|
+
_exports.InputWrapper = InputWrapper;
|
48
|
+
});
|
49
|
+
//# sourceMappingURL=input-wrapper.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"input-wrapper.js","names":["InputWrapper","constructor","rawData","page","options","_defineProperty","undefined","_classPrivateFieldInitSpec","_parentItemName","Object","assign","myPage","clone","components","propertyPath","ignoreSection","section","name","_classPrivateFieldSet","parentItemName","displayName","titleWithContext","_classPrivateFieldGet","title","_exports"],"sources":["../../../src/data-model/input-wrapper.ts"],"sourcesContent":["import { clone } from '../utils/helpers'\nimport { ComponentDef } from '../components/types'\nimport { Page } from './types'\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":";;;;;;;;;;;;;;;;;;;;;;;;;;EAIO,MAAMA,YAAY,CAAC;IAQxBC,WAAWA,CACTC,OAAqB,EACrBC,IAAU,EACVC,OAA6D,EAC7D;MAAAC,eAAA,eAXyBC,SAAS;MAAAD,eAAA,gBACRC,SAAS;MAAAD,eAAA,eACVC,SAAS;MAAAD,eAAA;MAAAE,0BAAA,OAAAC,eAAA;MAAAH,eAAA;MAUlCI,MAAM,CAACC,MAAM,CAAC,IAAI,EAAER,OAAO,CAAC;MAC5B,MAAMS,MAAM,GAAG,IAAAC,cAAK,EAACT,IAAI,CAAC;MAE1B,OAAOQ,MAAM,CAACE,UAAU;MAExB,IAAI,CAACV,IAAI,GAAGQ,MAAM;MAClB,IAAI,CAACG,YAAY,GACf,CAACV,OAAO,CAACW,aAAa,IAAIZ,IAAI,CAACa,OAAO,GACjC,GAAEb,IAAI,CAACa,OAAQ,IAAG,IAAI,CAACC,IAAK,EAAC,GAC9B,IAAI,CAACA,IAAI;MACfC,qBAAA,CAAAV,eAAA,MAAI,EAAmBJ,OAAO,CAACe,cAAc;IAC/C;IAEA,IAAIC,WAAWA,CAAA,EAAuB;MACpC,MAAMC,gBAAgB,GAAGC,qBAAA,CAAAd,eAAA,MAAI,IACxB,GAAE,IAAI,CAACe,KAAM,UAAOD,qBAAA,CAAAd,eAAA,EAAE,IAAI,CAAiB,EAAC,GAC7C,IAAI,CAACe,KAAK;MAEd,OAAO,IAAI,CAACpB,IAAI,CAACa,OAAO,GACnB,GAAEK,gBAAiB,OAAM,IAAI,CAAClB,IAAI,CAACa,OAAQ,EAAC,GAC7CK,gBAAgB;IACtB;EACF;EAACG,QAAA,CAAAxB,YAAA,GAAAA,YAAA;AAAA"}
|
@@ -0,0 +1,153 @@
|
|
1
|
+
import { ConditionRawData } from '.';
|
2
|
+
import { ComponentDef } from '../components/types';
|
3
|
+
type Toggleable<T> = boolean | T;
|
4
|
+
export interface Next {
|
5
|
+
path: string;
|
6
|
+
condition?: string;
|
7
|
+
}
|
8
|
+
export type Link = Next;
|
9
|
+
export interface Page {
|
10
|
+
title: string;
|
11
|
+
path: string;
|
12
|
+
controller: string;
|
13
|
+
components?: ComponentDef[];
|
14
|
+
section: string;
|
15
|
+
next?: {
|
16
|
+
path: string;
|
17
|
+
condition?: string;
|
18
|
+
}[];
|
19
|
+
}
|
20
|
+
export interface RepeatingFieldPage extends Page {
|
21
|
+
controller: 'RepeatingFieldPageController';
|
22
|
+
options: {
|
23
|
+
summaryDisplayMode?: {
|
24
|
+
samePage?: boolean;
|
25
|
+
separatePage?: boolean;
|
26
|
+
hideRowTitles?: boolean;
|
27
|
+
};
|
28
|
+
customText?: {
|
29
|
+
separatePageTitle?: string;
|
30
|
+
};
|
31
|
+
};
|
32
|
+
}
|
33
|
+
export interface Section {
|
34
|
+
name: string;
|
35
|
+
title: string;
|
36
|
+
hideTitle: boolean;
|
37
|
+
}
|
38
|
+
export interface Item {
|
39
|
+
text: string;
|
40
|
+
value: string | number | boolean;
|
41
|
+
description?: string;
|
42
|
+
condition?: string;
|
43
|
+
}
|
44
|
+
export interface List {
|
45
|
+
name: string;
|
46
|
+
title: string;
|
47
|
+
type: 'string' | 'number' | 'boolean';
|
48
|
+
items: Item[];
|
49
|
+
}
|
50
|
+
export interface Feedback {
|
51
|
+
feedbackForm?: boolean;
|
52
|
+
url?: string;
|
53
|
+
emailAddress?: string;
|
54
|
+
}
|
55
|
+
export type PhaseBanner = {
|
56
|
+
phase?: 'alpha' | 'beta';
|
57
|
+
feedbackUrl?: string;
|
58
|
+
};
|
59
|
+
export type MultipleApiKeys = {
|
60
|
+
test?: string;
|
61
|
+
production?: string;
|
62
|
+
};
|
63
|
+
export declare enum OutputType {
|
64
|
+
Email = "email",
|
65
|
+
Notify = "notify",
|
66
|
+
Webhook = "webhook"
|
67
|
+
}
|
68
|
+
export type EmailOutputConfiguration = {
|
69
|
+
emailAddress: string;
|
70
|
+
};
|
71
|
+
export type NotifyOutputConfiguration = {
|
72
|
+
apiKey: string;
|
73
|
+
templateId: string;
|
74
|
+
emailField: string;
|
75
|
+
personalisation: string[];
|
76
|
+
personalisationFieldCustomisation?: {
|
77
|
+
[personalisationName: string]: string[];
|
78
|
+
};
|
79
|
+
addReferencesToPersonalisation?: boolean;
|
80
|
+
emailReplyToIdConfiguration?: {
|
81
|
+
emailReplyToId: string;
|
82
|
+
condition?: string | undefined;
|
83
|
+
}[];
|
84
|
+
};
|
85
|
+
export type WebhookOutputConfiguration = {
|
86
|
+
url: string;
|
87
|
+
};
|
88
|
+
export type OutputConfiguration = EmailOutputConfiguration | NotifyOutputConfiguration | WebhookOutputConfiguration;
|
89
|
+
export type Output = {
|
90
|
+
name: string;
|
91
|
+
title: string;
|
92
|
+
type: OutputType;
|
93
|
+
outputConfiguration: OutputConfiguration;
|
94
|
+
};
|
95
|
+
export type ConfirmationPage = {
|
96
|
+
customText: {
|
97
|
+
title: string;
|
98
|
+
paymentSkipped: Toggleable<string>;
|
99
|
+
nextSteps: Toggleable<string>;
|
100
|
+
};
|
101
|
+
components: ComponentDef[];
|
102
|
+
};
|
103
|
+
export type PaymentSkippedWarningPage = {
|
104
|
+
customText: {
|
105
|
+
title: string;
|
106
|
+
caption: string;
|
107
|
+
body: string;
|
108
|
+
};
|
109
|
+
};
|
110
|
+
export type SpecialPages = {
|
111
|
+
confirmationPage?: ConfirmationPage;
|
112
|
+
paymentSkippedWarningPage?: PaymentSkippedWarningPage;
|
113
|
+
};
|
114
|
+
export declare function isMultipleApiKey(payApiKey: string | MultipleApiKeys | undefined): payApiKey is MultipleApiKeys;
|
115
|
+
export type Fee = {
|
116
|
+
description: string;
|
117
|
+
amount: number;
|
118
|
+
multiplier?: string;
|
119
|
+
condition?: string;
|
120
|
+
prefix?: string;
|
121
|
+
};
|
122
|
+
export type FeeOptions = {
|
123
|
+
paymentReferenceFormat?: string;
|
124
|
+
payReturnUrl?: string;
|
125
|
+
allowSubmissionWithoutPayment: boolean;
|
126
|
+
maxAttempts: number;
|
127
|
+
customPayErrorMessage?: string;
|
128
|
+
showPaymentSkippedWarningPage: boolean;
|
129
|
+
};
|
130
|
+
/**
|
131
|
+
* `FormDefinition` is a typescript representation of `Schema`
|
132
|
+
*/
|
133
|
+
export type FormDefinition = {
|
134
|
+
pages: Array<Page | RepeatingFieldPage>;
|
135
|
+
conditions: ConditionRawData[];
|
136
|
+
lists: List[];
|
137
|
+
sections: Section[];
|
138
|
+
startPage?: Page['path'] | undefined;
|
139
|
+
name?: string | undefined;
|
140
|
+
feedback?: Feedback;
|
141
|
+
phaseBanner?: PhaseBanner;
|
142
|
+
fees: Fee[];
|
143
|
+
skipSummary?: boolean | undefined;
|
144
|
+
outputs: Output[];
|
145
|
+
declaration?: string | undefined;
|
146
|
+
metadata?: Record<string, any>;
|
147
|
+
payApiKey?: string | MultipleApiKeys | undefined;
|
148
|
+
specialPages?: SpecialPages;
|
149
|
+
paymentReferenceFormat?: string;
|
150
|
+
feeOptions: FeeOptions;
|
151
|
+
};
|
152
|
+
export {};
|
153
|
+
//# sourceMappingURL=types.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/data-model/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,GAAG,CAAA;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAElD,KAAK,UAAU,CAAC,CAAC,IAAI,OAAO,GAAG,CAAC,CAAA;AAEhC,MAAM,WAAW,IAAI;IACnB,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AACD,MAAM,MAAM,IAAI,GAAG,IAAI,CAAA;AAEvB,MAAM,WAAW,IAAI;IACnB,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,CAAC,EAAE,YAAY,EAAE,CAAA;IAC3B,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,EAAE,CAAA;CAC9C;AAED,MAAM,WAAW,kBAAmB,SAAQ,IAAI;IAC9C,UAAU,EAAE,8BAA8B,CAAA;IAC1C,OAAO,EAAE;QACP,kBAAkB,CAAC,EAAE;YACnB,QAAQ,CAAC,EAAE,OAAO,CAAA;YAClB,YAAY,CAAC,EAAE,OAAO,CAAA;YACtB,aAAa,CAAC,EAAE,OAAO,CAAA;SACxB,CAAA;QACD,UAAU,CAAC,EAAE;YACX,iBAAiB,CAAC,EAAE,MAAM,CAAA;SAC3B,CAAA;KACF,CAAA;CACF;AAED,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,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(typeof exports !== "undefined") {
|
5
|
+
factory(exports);
|
6
|
+
} else {
|
7
|
+
var mod = {
|
8
|
+
exports: {}
|
9
|
+
};
|
10
|
+
factory(mod.exports);
|
11
|
+
global.types = mod.exports;
|
12
|
+
}
|
13
|
+
})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) {
|
14
|
+
"use strict";
|
15
|
+
|
16
|
+
_exports.__esModule = true;
|
17
|
+
_exports.OutputType = void 0;
|
18
|
+
_exports.isMultipleApiKey = isMultipleApiKey;
|
19
|
+
let OutputType = _exports.OutputType = /*#__PURE__*/function (OutputType) {
|
20
|
+
OutputType["Email"] = "email";
|
21
|
+
OutputType["Notify"] = "notify";
|
22
|
+
OutputType["Webhook"] = "webhook";
|
23
|
+
return OutputType;
|
24
|
+
}({});
|
25
|
+
function isMultipleApiKey(payApiKey) {
|
26
|
+
const obj = payApiKey;
|
27
|
+
return obj.test !== undefined || obj.production !== undefined;
|
28
|
+
}
|
29
|
+
|
30
|
+
/**
|
31
|
+
* `FormDefinition` is a typescript representation of `Schema`
|
32
|
+
*/
|
33
|
+
});
|
34
|
+
//# sourceMappingURL=types.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"types.js","names":["OutputType","_exports","isMultipleApiKey","payApiKey","obj","test","undefined","production"],"sources":["../../../src/data-model/types.ts"],"sourcesContent":["import { ConditionRawData } from '.'\nimport { ComponentDef } from '../components/types'\n\ntype Toggleable<T> = boolean | T\n\nexport interface Next {\n path: string\n condition?: string\n}\nexport type Link = Next\n\nexport interface Page {\n title: string\n path: string\n controller: string\n components?: ComponentDef[]\n section: string // the section ID\n next?: { path: string; condition?: string }[]\n}\n\nexport interface RepeatingFieldPage extends Page {\n controller: 'RepeatingFieldPageController'\n options: {\n summaryDisplayMode?: {\n samePage?: boolean\n separatePage?: boolean\n hideRowTitles?: boolean\n }\n customText?: {\n separatePageTitle?: string\n }\n }\n}\n\nexport interface Section {\n name: string\n title: string\n hideTitle: boolean\n}\n\nexport interface Item {\n text: string\n value: string | number | boolean\n description?: string\n condition?: string\n}\n\nexport interface List {\n name: string\n title: string\n type: 'string' | 'number' | 'boolean'\n items: Item[]\n}\n\nexport interface Feedback {\n feedbackForm?: boolean\n url?: string\n emailAddress?: string\n}\n\nexport type PhaseBanner = {\n phase?: 'alpha' | 'beta'\n feedbackUrl?: string\n}\n\nexport type MultipleApiKeys = {\n test?: string\n production?: string\n}\n\nexport enum OutputType {\n Email = 'email',\n Notify = 'notify',\n Webhook = 'webhook'\n}\n\nexport type EmailOutputConfiguration = {\n emailAddress: string\n}\n\nexport type NotifyOutputConfiguration = {\n apiKey: string\n templateId: string\n emailField: string\n personalisation: string[]\n personalisationFieldCustomisation?: {\n [personalisationName: string]: string[]\n }\n addReferencesToPersonalisation?: boolean\n emailReplyToIdConfiguration?: {\n emailReplyToId: string\n condition?: string | undefined\n }[]\n}\n\nexport type WebhookOutputConfiguration = {\n url: string\n}\n\nexport type OutputConfiguration =\n | EmailOutputConfiguration\n | NotifyOutputConfiguration\n | WebhookOutputConfiguration\n\nexport type Output = {\n name: string\n title: string\n type: OutputType\n outputConfiguration: OutputConfiguration\n}\n\nexport type ConfirmationPage = {\n customText: {\n title: string\n paymentSkipped: Toggleable<string>\n nextSteps: Toggleable<string>\n }\n components: ComponentDef[]\n}\n\nexport type PaymentSkippedWarningPage = {\n customText: {\n title: string\n caption: string\n body: string\n }\n}\n\nexport type SpecialPages = {\n confirmationPage?: ConfirmationPage\n paymentSkippedWarningPage?: PaymentSkippedWarningPage\n}\n\nexport function isMultipleApiKey(\n payApiKey: string | MultipleApiKeys | undefined\n): payApiKey is MultipleApiKeys {\n const obj = payApiKey as MultipleApiKeys\n return obj.test !== undefined || obj.production !== undefined\n}\n\nexport type Fee = {\n description: string\n amount: number\n multiplier?: string\n condition?: string\n prefix?: string\n}\n\nexport type FeeOptions = {\n paymentReferenceFormat?: string\n payReturnUrl?: string\n allowSubmissionWithoutPayment: boolean\n maxAttempts: number\n customPayErrorMessage?: string\n showPaymentSkippedWarningPage: boolean\n}\n\n/**\n * `FormDefinition` is a typescript representation of `Schema`\n */\nexport type FormDefinition = {\n pages: Array<Page | RepeatingFieldPage>\n conditions: ConditionRawData[]\n lists: List[]\n sections: Section[]\n startPage?: Page['path'] | undefined\n name?: string | undefined\n feedback?: Feedback\n phaseBanner?: PhaseBanner\n fees: Fee[]\n skipSummary?: boolean | undefined\n outputs: Output[]\n declaration?: string | undefined\n metadata?: Record<string, any>\n payApiKey?: string | MultipleApiKeys | undefined\n specialPages?: SpecialPages\n paymentReferenceFormat?: string\n feeOptions: FeeOptions\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;MAsEYA,UAAU,GAAAC,QAAA,CAAAD,UAAA,0BAAVA,UAAU;IAAVA,UAAU;IAAVA,UAAU;IAAVA,UAAU;IAAA,OAAVA,UAAU;EAAA;EA+Df,SAASE,gBAAgBA,CAC9BC,SAA+C,EACjB;IAC9B,MAAMC,GAAG,GAAGD,SAA4B;IACxC,OAAOC,GAAG,CAACC,IAAI,KAAKC,SAAS,IAAIF,GAAG,CAACG,UAAU,KAAKD,SAAS;EAC/D;;EAmBA;AACA;AACA;AAFA"}
|
@@ -0,0 +1,8 @@
|
|
1
|
+
export declare class FormConfiguration {
|
2
|
+
Key: string;
|
3
|
+
DisplayName: string;
|
4
|
+
LastModified: string | undefined;
|
5
|
+
feedbackForm: boolean | undefined;
|
6
|
+
constructor(Key: string, DisplayName?: string, LastModified?: string, feedbackForm?: boolean);
|
7
|
+
}
|
8
|
+
//# sourceMappingURL=form-configuration.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"form-configuration.d.ts","sourceRoot":"","sources":["../../../src/form/form-configuration.ts"],"names":[],"mappings":"AAAA,qBAAa,iBAAiB;IAC5B,GAAG,EAAE,MAAM,CAAA;IACX,WAAW,EAAE,MAAM,CAAA;IACnB,YAAY,EAAE,MAAM,GAAG,SAAS,CAAA;IAChC,YAAY,EAAE,OAAO,GAAG,SAAS,CAAA;gBAG/B,GAAG,EAAE,MAAM,EACX,WAAW,CAAC,EAAE,MAAM,EACpB,YAAY,CAAC,EAAE,MAAM,EACrB,YAAY,CAAC,EAAE,OAAO;CAUzB"}
|
@@ -0,0 +1,38 @@
|
|
1
|
+
(function (global, factory) {
|
2
|
+
if (typeof define === "function" && define.amd) {
|
3
|
+
define(["exports"], factory);
|
4
|
+
} else if (typeof exports !== "undefined") {
|
5
|
+
factory(exports);
|
6
|
+
} else {
|
7
|
+
var mod = {
|
8
|
+
exports: {}
|
9
|
+
};
|
10
|
+
factory(mod.exports);
|
11
|
+
global.formConfiguration = mod.exports;
|
12
|
+
}
|
13
|
+
})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) {
|
14
|
+
"use strict";
|
15
|
+
|
16
|
+
_exports.__esModule = true;
|
17
|
+
_exports.FormConfiguration = void 0;
|
18
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
19
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
|
20
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
21
|
+
class FormConfiguration {
|
22
|
+
constructor(Key, DisplayName, LastModified, feedbackForm) {
|
23
|
+
_defineProperty(this, "Key", void 0);
|
24
|
+
_defineProperty(this, "DisplayName", void 0);
|
25
|
+
_defineProperty(this, "LastModified", void 0);
|
26
|
+
_defineProperty(this, "feedbackForm", void 0);
|
27
|
+
if (!Key) {
|
28
|
+
throw Error('Form configuration must have a key');
|
29
|
+
}
|
30
|
+
this.Key = Key;
|
31
|
+
this.DisplayName = DisplayName || Key;
|
32
|
+
this.LastModified = LastModified;
|
33
|
+
this.feedbackForm = feedbackForm || false;
|
34
|
+
}
|
35
|
+
}
|
36
|
+
_exports.FormConfiguration = FormConfiguration;
|
37
|
+
});
|
38
|
+
//# sourceMappingURL=form-configuration.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"form-configuration.js","names":["FormConfiguration","constructor","Key","DisplayName","LastModified","feedbackForm","_defineProperty","Error","_exports"],"sources":["../../../src/form/form-configuration.ts"],"sourcesContent":["export class FormConfiguration {\n Key: string\n DisplayName: string\n LastModified: string | undefined\n feedbackForm: boolean | undefined\n\n constructor(\n Key: string,\n DisplayName?: string,\n LastModified?: string,\n feedbackForm?: boolean\n ) {\n if (!Key) {\n throw Error('Form configuration must have a key')\n }\n this.Key = Key\n this.DisplayName = DisplayName || Key\n this.LastModified = LastModified\n this.feedbackForm = feedbackForm || false\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;EAAO,MAAMA,iBAAiB,CAAC;IAM7BC,WAAWA,CACTC,GAAW,EACXC,WAAoB,EACpBC,YAAqB,EACrBC,YAAsB,EACtB;MAAAC,eAAA;MAAAA,eAAA;MAAAA,eAAA;MAAAA,eAAA;MACA,IAAI,CAACJ,GAAG,EAAE;QACR,MAAMK,KAAK,CAAC,oCAAoC,CAAC;MACnD;MACA,IAAI,CAACL,GAAG,GAAGA,GAAG;MACd,IAAI,CAACC,WAAW,GAAGA,WAAW,IAAID,GAAG;MACrC,IAAI,CAACE,YAAY,GAAGA,YAAY;MAChC,IAAI,CAACC,YAAY,GAAGA,YAAY,IAAI,KAAK;IAC3C;EACF;EAACG,QAAA,CAAAR,iBAAA,GAAAA,iBAAA;AAAA"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/form/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA"}
|
@@ -0,0 +1,24 @@
|
|
1
|
+
(function (global, factory) {
|
2
|
+
if (typeof define === "function" && define.amd) {
|
3
|
+
define(["exports", "./form-configuration"], factory);
|
4
|
+
} else if (typeof exports !== "undefined") {
|
5
|
+
factory(exports, require("./form-configuration"));
|
6
|
+
} else {
|
7
|
+
var mod = {
|
8
|
+
exports: {}
|
9
|
+
};
|
10
|
+
factory(mod.exports, global.formConfiguration);
|
11
|
+
global.index = mod.exports;
|
12
|
+
}
|
13
|
+
})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports, _formConfiguration) {
|
14
|
+
"use strict";
|
15
|
+
|
16
|
+
_exports.__esModule = true;
|
17
|
+
Object.defineProperty(_exports, "FormConfiguration", {
|
18
|
+
enumerable: true,
|
19
|
+
get: function () {
|
20
|
+
return _formConfiguration.FormConfiguration;
|
21
|
+
}
|
22
|
+
});
|
23
|
+
});
|
24
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/form/index.ts"],"sourcesContent":["export { FormConfiguration } from './form-configuration'\n"],"mappings":""}
|