@icure/form 1.1.0 → 1.1.14
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/components/common/field-with-options.d.ts +9 -0
- package/components/common/field-with-options.js +50 -0
- package/components/common/field-with-options.js.map +1 -0
- package/components/common/field.d.ts +46 -0
- package/components/common/field.js +107 -0
- package/components/common/field.js.map +1 -0
- package/components/common/index.d.ts +1 -0
- package/components/{iqr-form-loader → common}/index.js +1 -3
- package/components/common/index.js.map +1 -0
- package/components/{iqr-text-field → common}/styles/paths.d.ts +3 -0
- package/components/{iqr-text-field → common}/styles/paths.js +28 -5
- package/components/common/styles/paths.js.map +1 -0
- package/components/common/utils.d.ts +8 -0
- package/components/common/utils.js +42 -0
- package/components/common/utils.js.map +1 -0
- package/components/icure-button-group/index.d.ts +12 -0
- package/components/icure-button-group/index.js +1140 -0
- package/components/icure-button-group/index.js.map +1 -0
- package/components/icure-date-picker/index.d.ts +16 -0
- package/components/icure-date-picker/index.js +1140 -0
- package/components/icure-date-picker/index.js.map +1 -0
- package/components/icure-dropdown-field/index.d.ts +16 -0
- package/components/icure-dropdown-field/index.js +1153 -0
- package/components/icure-dropdown-field/index.js.map +1 -0
- package/components/icure-form/fields/button-group/checkbox.d.ts +6 -0
- package/components/icure-form/fields/button-group/checkbox.js +61 -0
- package/components/icure-form/fields/button-group/checkbox.js.map +1 -0
- package/components/icure-form/fields/button-group/index.d.ts +2 -0
- package/components/icure-form/fields/button-group/index.js +19 -0
- package/components/icure-form/fields/button-group/index.js.map +1 -0
- package/components/icure-form/fields/button-group/radio-button.d.ts +6 -0
- package/components/icure-form/fields/button-group/radio-button.js +61 -0
- package/components/icure-form/fields/button-group/radio-button.js.map +1 -0
- package/components/icure-form/fields/date-picker/date-picker.d.ts +4 -0
- package/components/icure-form/fields/date-picker/date-picker.js +29 -0
- package/components/icure-form/fields/date-picker/date-picker.js.map +1 -0
- package/components/icure-form/fields/date-picker/date-time-picker.d.ts +4 -0
- package/components/icure-form/fields/date-picker/date-time-picker.js +29 -0
- package/components/icure-form/fields/date-picker/date-time-picker.js.map +1 -0
- package/components/icure-form/fields/date-picker/index.d.ts +3 -0
- package/components/icure-form/fields/date-picker/index.js +20 -0
- package/components/icure-form/fields/date-picker/index.js.map +1 -0
- package/components/icure-form/fields/date-picker/time-picker.d.ts +4 -0
- package/components/icure-form/fields/date-picker/time-picker.js +29 -0
- package/components/icure-form/fields/date-picker/time-picker.js.map +1 -0
- package/components/icure-form/fields/dropdown/dropdown-field.d.ts +11 -0
- package/components/icure-form/fields/dropdown/dropdown-field.js +65 -0
- package/components/icure-form/fields/dropdown/dropdown-field.js.map +1 -0
- package/components/icure-form/fields/dropdown/index.d.ts +1 -0
- package/components/icure-form/fields/dropdown/index.js +18 -0
- package/components/icure-form/fields/dropdown/index.js.map +1 -0
- package/components/icure-form/fields/index.d.ts +9 -0
- package/components/icure-form/fields/index.js +26 -0
- package/components/icure-form/fields/index.js.map +1 -0
- package/components/icure-form/fields/items-list-field/index.d.ts +1 -0
- package/components/icure-form/fields/items-list-field/index.js +18 -0
- package/components/icure-form/fields/items-list-field/index.js.map +1 -0
- package/components/icure-form/fields/items-list-field/items-list-field.d.ts +6 -0
- package/components/icure-form/fields/items-list-field/items-list-field.js +49 -0
- package/components/icure-form/fields/items-list-field/items-list-field.js.map +1 -0
- package/components/icure-form/fields/label/index.d.ts +1 -0
- package/components/icure-form/fields/label/index.js +18 -0
- package/components/icure-form/fields/label/index.js.map +1 -0
- package/components/{iqr-form/fields/multipleChoice.d.ts → icure-form/fields/label/label.d.ts} +5 -4
- package/components/{iqr-form/fields/multipleChoice.js → icure-form/fields/label/label.js} +18 -15
- package/components/icure-form/fields/label/label.js.map +1 -0
- package/components/icure-form/fields/measure-field/index.d.ts +1 -0
- package/components/icure-form/fields/measure-field/index.js +18 -0
- package/components/icure-form/fields/measure-field/index.js.map +1 -0
- package/components/icure-form/fields/measure-field/measure-field.d.ts +4 -0
- package/components/icure-form/fields/measure-field/measure-field.js +31 -0
- package/components/icure-form/fields/measure-field/measure-field.js.map +1 -0
- package/components/icure-form/fields/number-field/index.d.ts +1 -0
- package/components/icure-form/fields/number-field/index.js +18 -0
- package/components/icure-form/fields/number-field/index.js.map +1 -0
- package/components/icure-form/fields/number-field/number-field.d.ts +4 -0
- package/components/icure-form/fields/number-field/number-field.js +29 -0
- package/components/icure-form/fields/number-field/number-field.js.map +1 -0
- package/components/icure-form/fields/text-field/index.d.ts +1 -0
- package/components/icure-form/fields/text-field/index.js +18 -0
- package/components/icure-form/fields/text-field/index.js.map +1 -0
- package/components/icure-form/fields/text-field/text-field.d.ts +28 -0
- package/components/icure-form/fields/text-field/text-field.js +123 -0
- package/components/icure-form/fields/text-field/text-field.js.map +1 -0
- package/components/icure-form/fields/token-field/index.d.ts +1 -0
- package/components/icure-form/fields/token-field/index.js +18 -0
- package/components/icure-form/fields/token-field/index.js.map +1 -0
- package/components/icure-form/fields/token-field/token-field.d.ts +6 -0
- package/components/{iqr-form/fields/datePicker.js → icure-form/fields/token-field/token-field.js} +26 -34
- package/components/icure-form/fields/token-field/token-field.js.map +1 -0
- package/components/icure-form/fields/utils/index.d.ts +11 -0
- package/components/icure-form/fields/utils/index.js +48 -0
- package/components/icure-form/fields/utils/index.js.map +1 -0
- package/components/icure-form/index.d.ts +23 -0
- package/components/icure-form/index.js +1127 -0
- package/components/icure-form/index.js.map +1 -0
- package/components/icure-form/renderer/form/form-selection-button.d.ts +9 -0
- package/components/icure-form/renderer/form/form-selection-button.js +108 -0
- package/components/icure-form/renderer/form/form-selection-button.js.map +1 -0
- package/components/icure-form/renderer/form/form.d.ts +3 -0
- package/components/icure-form/renderer/form/form.js +399 -0
- package/components/icure-form/renderer/form/form.js.map +1 -0
- package/components/icure-form/renderer/index.d.ts +11 -0
- package/components/icure-form/renderer/index.js.map +1 -0
- package/components/icure-label/index.d.ts +8 -0
- package/components/icure-label/index.js +1072 -0
- package/components/icure-label/index.js.map +1 -0
- package/components/icure-text-field/index.d.ts +69 -0
- package/components/icure-text-field/index.js +1739 -0
- package/components/icure-text-field/index.js.map +1 -0
- package/components/icure-text-field/plugin/caret-fix-plugin.js.map +1 -0
- package/components/{iqr-text-field → icure-text-field}/plugin/has-content-class-plugin.d.ts +1 -1
- package/components/icure-text-field/plugin/has-content-class-plugin.js.map +1 -0
- package/components/icure-text-field/plugin/mask-plugin.js.map +1 -0
- package/components/icure-text-field/plugin/regexp-plugin.js.map +1 -0
- package/components/icure-text-field/prosemirror-commands.js.map +1 -0
- package/components/{iqr-text-field → icure-text-field}/prosemirror-utils.d.ts +1 -1
- package/components/icure-text-field/prosemirror-utils.js.map +1 -0
- package/components/icure-text-field/schema/common-marks.js.map +1 -0
- package/components/{iqr-text-field → icure-text-field}/schema/date-time-schema.d.ts +3 -3
- package/components/icure-text-field/schema/date-time-schema.js.map +1 -0
- package/components/{iqr-text-field → icure-text-field}/schema/decimal-schema.d.ts +1 -1
- package/components/icure-text-field/schema/decimal-schema.js.map +1 -0
- package/components/icure-text-field/schema/index.d.ts +6 -0
- package/components/{iqr-text-field → icure-text-field}/schema/index.js +6 -3
- package/components/icure-text-field/schema/index.js.map +1 -0
- package/components/icure-text-field/schema/items-list-schema.d.ts +3 -0
- package/components/icure-text-field/schema/items-list-schema.js +28 -0
- package/components/icure-text-field/schema/items-list-schema.js.map +1 -0
- package/components/icure-text-field/schema/items-list.d.ts +3 -0
- package/components/icure-text-field/schema/items-list.js +31 -0
- package/components/icure-text-field/schema/items-list.js.map +1 -0
- package/components/{iqr-text-field → icure-text-field}/schema/markdown-schema.d.ts +3 -3
- package/components/icure-text-field/schema/markdown-schema.js.map +1 -0
- package/components/icure-text-field/schema/measure-schema.d.ts +7 -0
- package/components/icure-text-field/schema/measure-schema.js +81 -0
- package/components/icure-text-field/schema/measure-schema.js.map +1 -0
- package/components/{iqr-text-field → icure-text-field}/schema/token-schema.d.ts +1 -1
- package/components/{iqr-text-field → icure-text-field}/schema/token-schema.js +3 -6
- package/components/icure-text-field/schema/token-schema.js.map +1 -0
- package/components/icure-text-field/schema/utils.js.map +1 -0
- package/components/icure-text-field/selection-companion.js.map +1 -0
- package/components/{iqr-text-field → icure-text-field}/suggestion-palette.d.ts +1 -6
- package/components/icure-text-field/suggestion-palette.js.map +1 -0
- package/components/index.d.ts +5 -2
- package/components/index.js +5 -2
- package/components/index.js.map +1 -1
- package/components/model/index.d.ts +782 -0
- package/components/model/index.js +632 -0
- package/components/model/index.js.map +1 -0
- package/components/themes/default/index.d.ts +1 -0
- package/components/themes/default/index.js +28 -0
- package/components/themes/default/index.js.map +1 -0
- package/components/themes/ehr-lite/index.d.ts +1 -0
- package/components/themes/ehr-lite/index.js +321 -0
- package/components/themes/ehr-lite/index.js.map +1 -0
- package/components/themes/kendo/index.d.ts +1 -0
- package/components/themes/kendo/index.js +285 -0
- package/components/themes/kendo/index.js.map +1 -0
- package/conversion/ckmeans-grouping.d.ts +4 -0
- package/conversion/ckmeans-grouping.js +53 -0
- package/conversion/ckmeans-grouping.js.map +1 -0
- package/conversion/ckmeans.d.ts +44 -0
- package/conversion/ckmeans.js +287 -0
- package/conversion/ckmeans.js.map +1 -0
- package/conversion/icure-convert.d.ts +3 -0
- package/conversion/icure-convert.js +165 -0
- package/conversion/icure-convert.js.map +1 -0
- package/generic/index.d.ts +1 -0
- package/generic/index.js +18 -0
- package/generic/index.js.map +1 -0
- package/generic/model.d.ts +39 -0
- package/{components/iqr-form-loader/models.js → generic/model.js} +1 -1
- package/generic/model.js.map +1 -0
- package/icure/form-values-container.d.ts +83 -0
- package/icure/form-values-container.js +445 -0
- package/icure/form-values-container.js.map +1 -0
- package/icure/index.d.ts +2 -0
- package/icure/index.js +19 -0
- package/icure/index.js.map +1 -0
- package/icure/model.d.ts +10 -0
- package/icure/model.js +3 -0
- package/icure/model.js.map +1 -0
- package/package.json +21 -16
- package/utils/code-utils.d.ts +18 -0
- package/utils/code-utils.js +36 -0
- package/utils/code-utils.js.map +1 -0
- package/utils/fields-values-provider.d.ts +18 -0
- package/utils/fields-values-provider.js +50 -0
- package/utils/fields-values-provider.js.map +1 -0
- package/utils/form-value-container.d.ts +3 -0
- package/utils/form-value-container.js +45 -0
- package/utils/form-value-container.js.map +1 -0
- package/utils/icure-utils.d.ts +8 -11
- package/utils/icure-utils.js +47 -48
- package/utils/icure-utils.js.map +1 -1
- package/utils/interpreter.d.ts +4 -0
- package/utils/interpreter.js +52 -0
- package/utils/interpreter.js.map +1 -0
- package/utils/languages.d.ts +3 -1
- package/utils/languages.js +4 -4
- package/utils/languages.js.map +1 -1
- package/utils/markdown.d.ts +8 -0
- package/utils/markdown.js +58 -0
- package/utils/markdown.js.map +1 -0
- package/utils/primitive.d.ts +7 -0
- package/utils/primitive.js +123 -0
- package/utils/primitive.js.map +1 -0
- package/components/iqr-form/fields/datePicker.d.ts +0 -10
- package/components/iqr-form/fields/datePicker.js.map +0 -1
- package/components/iqr-form/fields/dateTimePicker.d.ts +0 -10
- package/components/iqr-form/fields/dateTimePicker.js +0 -49
- package/components/iqr-form/fields/dateTimePicker.js.map +0 -1
- package/components/iqr-form/fields/measureField.d.ts +0 -8
- package/components/iqr-form/fields/measureField.js +0 -44
- package/components/iqr-form/fields/measureField.js.map +0 -1
- package/components/iqr-form/fields/multipleChoice.js.map +0 -1
- package/components/iqr-form/fields/numberField.d.ts +0 -8
- package/components/iqr-form/fields/numberField.js +0 -44
- package/components/iqr-form/fields/numberField.js.map +0 -1
- package/components/iqr-form/fields/textfield.d.ts +0 -1
- package/components/iqr-form/fields/textfield.js +0 -143
- package/components/iqr-form/fields/textfield.js.map +0 -1
- package/components/iqr-form/fields/timePicker.d.ts +0 -10
- package/components/iqr-form/fields/timePicker.js +0 -49
- package/components/iqr-form/fields/timePicker.js.map +0 -1
- package/components/iqr-form/index.d.ts +0 -7
- package/components/iqr-form/index.js +0 -147
- package/components/iqr-form/index.js.map +0 -1
- package/components/iqr-form/legacy/Content.d.ts +0 -28
- package/components/iqr-form/legacy/Content.js +0 -30
- package/components/iqr-form/legacy/Content.js.map +0 -1
- package/components/iqr-form/legacy/Data.d.ts +0 -14
- package/components/iqr-form/legacy/Data.js +0 -21
- package/components/iqr-form/legacy/Data.js.map +0 -1
- package/components/iqr-form/legacy/Editor.d.ts +0 -34
- package/components/iqr-form/legacy/Editor.js +0 -19
- package/components/iqr-form/legacy/Editor.js.map +0 -1
- package/components/iqr-form/legacy/FormColumn.d.ts +0 -18
- package/components/iqr-form/legacy/FormColumn.js +0 -10
- package/components/iqr-form/legacy/FormColumn.js.map +0 -1
- package/components/iqr-form/legacy/FormDataOption.d.ts +0 -16
- package/components/iqr-form/legacy/FormDataOption.js +0 -21
- package/components/iqr-form/legacy/FormDataOption.js.map +0 -1
- package/components/iqr-form/legacy/FormLayout.d.ts +0 -25
- package/components/iqr-form/legacy/FormLayout.js +0 -10
- package/components/iqr-form/legacy/FormLayout.js.map +0 -1
- package/components/iqr-form/legacy/FormLayoutData.d.ts +0 -42
- package/components/iqr-form/legacy/FormLayoutData.js +0 -10
- package/components/iqr-form/legacy/FormLayoutData.js.map +0 -1
- package/components/iqr-form/legacy/FormPlanning.d.ts +0 -22
- package/components/iqr-form/legacy/FormPlanning.js +0 -21
- package/components/iqr-form/legacy/FormPlanning.js.map +0 -1
- package/components/iqr-form/legacy/FormSection.d.ts +0 -19
- package/components/iqr-form/legacy/FormSection.js +0 -10
- package/components/iqr-form/legacy/FormSection.js.map +0 -1
- package/components/iqr-form/legacy/Formula.d.ts +0 -27
- package/components/iqr-form/legacy/Formula.js +0 -32
- package/components/iqr-form/legacy/Formula.js.map +0 -1
- package/components/iqr-form/legacy/GuiCode.d.ts +0 -16
- package/components/iqr-form/legacy/GuiCode.js +0 -21
- package/components/iqr-form/legacy/GuiCode.js.map +0 -1
- package/components/iqr-form/legacy/GuiCodeType.d.ts +0 -15
- package/components/iqr-form/legacy/GuiCodeType.js +0 -21
- package/components/iqr-form/legacy/GuiCodeType.js.map +0 -1
- package/components/iqr-form/legacy/Suggest.d.ts +0 -19
- package/components/iqr-form/legacy/Suggest.js +0 -21
- package/components/iqr-form/legacy/Suggest.js.map +0 -1
- package/components/iqr-form/legacy/Tag.d.ts +0 -16
- package/components/iqr-form/legacy/Tag.js +0 -21
- package/components/iqr-form/legacy/Tag.js.map +0 -1
- package/components/iqr-form/model/index.d.ts +0 -96
- package/components/iqr-form/model/index.js +0 -120
- package/components/iqr-form/model/index.js.map +0 -1
- package/components/iqr-form/renderer/cards.d.ts +0 -2
- package/components/iqr-form/renderer/cards.js +0 -55
- package/components/iqr-form/renderer/cards.js.map +0 -1
- package/components/iqr-form/renderer/form.d.ts +0 -2
- package/components/iqr-form/renderer/form.js +0 -93
- package/components/iqr-form/renderer/form.js.map +0 -1
- package/components/iqr-form/renderer/index.d.ts +0 -6
- package/components/iqr-form/renderer/index.js.map +0 -1
- package/components/iqr-form/utils.d.ts +0 -5
- package/components/iqr-form/utils.js +0 -91
- package/components/iqr-form/utils.js.map +0 -1
- package/components/iqr-form-loader/fieldsValuesProviders.d.ts +0 -13
- package/components/iqr-form-loader/fieldsValuesProviders.js +0 -49
- package/components/iqr-form-loader/fieldsValuesProviders.js.map +0 -1
- package/components/iqr-form-loader/formValuesContainer.d.ts +0 -33
- package/components/iqr-form-loader/formValuesContainer.js +0 -111
- package/components/iqr-form-loader/formValuesContainer.js.map +0 -1
- package/components/iqr-form-loader/index.d.ts +0 -3
- package/components/iqr-form-loader/index.js.map +0 -1
- package/components/iqr-form-loader/models.d.ts +0 -14
- package/components/iqr-form-loader/models.js.map +0 -1
- package/components/iqr-text-field/index.d.ts +0 -26
- package/components/iqr-text-field/index.js +0 -1242
- package/components/iqr-text-field/index.js.map +0 -1
- package/components/iqr-text-field/plugin/caret-fix-plugin.js.map +0 -1
- package/components/iqr-text-field/plugin/has-content-class-plugin.js.map +0 -1
- package/components/iqr-text-field/plugin/mask-plugin.js.map +0 -1
- package/components/iqr-text-field/plugin/regexp-plugin.js.map +0 -1
- package/components/iqr-text-field/prosemirror-commands.js.map +0 -1
- package/components/iqr-text-field/prosemirror-utils.js.map +0 -1
- package/components/iqr-text-field/schema/common-marks.js.map +0 -1
- package/components/iqr-text-field/schema/date-time-schema.js.map +0 -1
- package/components/iqr-text-field/schema/decimal-schema.js.map +0 -1
- package/components/iqr-text-field/schema/index.d.ts +0 -11
- package/components/iqr-text-field/schema/index.js.map +0 -1
- package/components/iqr-text-field/schema/markdown-schema.js.map +0 -1
- package/components/iqr-text-field/schema/measure-schema.d.ts +0 -3
- package/components/iqr-text-field/schema/measure-schema.js +0 -36
- package/components/iqr-text-field/schema/measure-schema.js.map +0 -1
- package/components/iqr-text-field/schema/token-schema.js.map +0 -1
- package/components/iqr-text-field/schema/utils.js.map +0 -1
- package/components/iqr-text-field/selection-companion.js.map +0 -1
- package/components/iqr-text-field/styles/paths.js.map +0 -1
- package/components/iqr-text-field/suggestion-palette.js.map +0 -1
- /package/components/{iqr-form → icure-form}/renderer/index.js +0 -0
- /package/components/{iqr-text-field → icure-text-field}/plugin/caret-fix-plugin.d.ts +0 -0
- /package/components/{iqr-text-field → icure-text-field}/plugin/caret-fix-plugin.js +0 -0
- /package/components/{iqr-text-field → icure-text-field}/plugin/has-content-class-plugin.js +0 -0
- /package/components/{iqr-text-field → icure-text-field}/plugin/mask-plugin.d.ts +0 -0
- /package/components/{iqr-text-field → icure-text-field}/plugin/mask-plugin.js +0 -0
- /package/components/{iqr-text-field → icure-text-field}/plugin/regexp-plugin.d.ts +0 -0
- /package/components/{iqr-text-field → icure-text-field}/plugin/regexp-plugin.js +0 -0
- /package/components/{iqr-text-field → icure-text-field}/prosemirror-commands.d.ts +0 -0
- /package/components/{iqr-text-field → icure-text-field}/prosemirror-commands.js +0 -0
- /package/components/{iqr-text-field → icure-text-field}/prosemirror-utils.js +0 -0
- /package/components/{iqr-text-field → icure-text-field}/schema/common-marks.d.ts +0 -0
- /package/components/{iqr-text-field → icure-text-field}/schema/common-marks.js +0 -0
- /package/components/{iqr-text-field → icure-text-field}/schema/date-time-schema.js +0 -0
- /package/components/{iqr-text-field → icure-text-field}/schema/decimal-schema.js +0 -0
- /package/components/{iqr-text-field → icure-text-field}/schema/markdown-schema.js +0 -0
- /package/components/{iqr-text-field → icure-text-field}/schema/utils.d.ts +0 -0
- /package/components/{iqr-text-field → icure-text-field}/schema/utils.js +0 -0
- /package/components/{iqr-text-field → icure-text-field}/selection-companion.d.ts +0 -0
- /package/components/{iqr-text-field → icure-text-field}/selection-companion.js +0 -0
- /package/components/{iqr-text-field → icure-text-field}/suggestion-palette.js +0 -0
|
@@ -0,0 +1,632 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.StateToUpdate = exports.State = exports.Trigger = exports.Launcher = exports.Action = exports.Form = exports.TranslationTable = exports.Codification = exports.Section = exports.Subform = exports.Group = exports.ActionButton = exports.Label = exports.CheckBox = exports.RadioButton = exports.DropdownField = exports.DateTimePicker = exports.TimePicker = exports.DatePicker = exports.ItemsListField = exports.TokenField = exports.NumberField = exports.MeasureField = exports.TextField = exports.Field = exports.pteq = void 0;
|
|
4
|
+
const pteq = (a, b) => {
|
|
5
|
+
if (a === b) {
|
|
6
|
+
return true;
|
|
7
|
+
}
|
|
8
|
+
if (a === undefined || b === undefined) {
|
|
9
|
+
return false;
|
|
10
|
+
}
|
|
11
|
+
if ((a === null || a === void 0 ? void 0 : a.type) !== (b === null || b === void 0 ? void 0 : b.type)) {
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
if (a.value === b.value && (a.type !== 'measure' || b.type !== 'measure' || a.unit === b.unit)) {
|
|
15
|
+
return true;
|
|
16
|
+
}
|
|
17
|
+
if (a.type === 'compound' && b.type === 'compound') {
|
|
18
|
+
return Object.keys(a.value).every((k) => (0, exports.pteq)(a.value[k], b.value[k]));
|
|
19
|
+
}
|
|
20
|
+
return false;
|
|
21
|
+
};
|
|
22
|
+
exports.pteq = pteq;
|
|
23
|
+
//todo: create abstract class for all fields + delete useless properties
|
|
24
|
+
class Field {
|
|
25
|
+
label() {
|
|
26
|
+
return this.field;
|
|
27
|
+
}
|
|
28
|
+
constructor(type, label, { shortLabel, grows, span, rowSpan, schema, tags, codifications, readonly, options, labels, value, unit, multiline, computedProperties, now, translate, width, styleOptions, }) {
|
|
29
|
+
this.clazz = 'field';
|
|
30
|
+
this.field = label;
|
|
31
|
+
this.type = type;
|
|
32
|
+
this.shortLabel = shortLabel;
|
|
33
|
+
this.grows = grows === undefined ? true : grows;
|
|
34
|
+
this.span = span;
|
|
35
|
+
this.rowSpan = rowSpan;
|
|
36
|
+
this.schema = schema;
|
|
37
|
+
this.tags = tags;
|
|
38
|
+
this.codifications = codifications;
|
|
39
|
+
this.readonly = readonly || false;
|
|
40
|
+
this.options = options;
|
|
41
|
+
this.labels = labels;
|
|
42
|
+
this.value = value;
|
|
43
|
+
this.unit = unit;
|
|
44
|
+
this.multiline = multiline || false;
|
|
45
|
+
this.computedProperties = computedProperties;
|
|
46
|
+
this.now = now;
|
|
47
|
+
this.translate = translate !== null && translate !== void 0 ? translate : true;
|
|
48
|
+
this.width = width;
|
|
49
|
+
this.styleOptions = styleOptions;
|
|
50
|
+
}
|
|
51
|
+
static parse(json) {
|
|
52
|
+
var _a, _b, _c;
|
|
53
|
+
return ((_c = (_b = (_a = {
|
|
54
|
+
'text-field': () => new TextField(json.field, Object.assign({}, json)),
|
|
55
|
+
'measure-field': () => new MeasureField(json.field, Object.assign({}, json)),
|
|
56
|
+
'token-field': () => new TokenField(json.field, Object.assign({}, json)),
|
|
57
|
+
'items-list-field': () => new ItemsListField(json.field, Object.assign({}, json)),
|
|
58
|
+
'number-field': () => new NumberField(json.field, Object.assign({}, json)),
|
|
59
|
+
'date-picker': () => new DatePicker(json.field, Object.assign({}, json)),
|
|
60
|
+
'time-picker': () => new TimePicker(json.field, Object.assign({}, json)),
|
|
61
|
+
'date-time-picker': () => new DateTimePicker(json.field, Object.assign({}, json)),
|
|
62
|
+
dropdown: () => new DropdownField(json.field, Object.assign({}, json)),
|
|
63
|
+
'radio-button': () => new RadioButton(json.field, Object.assign({}, json)),
|
|
64
|
+
checkbox: () => new CheckBox(json.field, Object.assign({}, json)),
|
|
65
|
+
label: () => new Label(json.field, Object.assign({}, json)),
|
|
66
|
+
})[json.type]) === null || _b === void 0 ? void 0 : _b.call(_a)) !== null && _c !== void 0 ? _c : new TextField(json.field, Object.assign({}, json)));
|
|
67
|
+
}
|
|
68
|
+
toJson() {
|
|
69
|
+
var _a;
|
|
70
|
+
return {
|
|
71
|
+
field: this.field,
|
|
72
|
+
type: this.type,
|
|
73
|
+
shortLabel: this.shortLabel,
|
|
74
|
+
grows: this.grows,
|
|
75
|
+
span: this.span,
|
|
76
|
+
schema: (_a = this.schema) === null || _a === void 0 ? void 0 : _a.toString(),
|
|
77
|
+
tags: this.tags,
|
|
78
|
+
codifications: this.codifications,
|
|
79
|
+
options: this.options,
|
|
80
|
+
labels: this.labels,
|
|
81
|
+
value: this.value,
|
|
82
|
+
unit: this.unit,
|
|
83
|
+
multiline: this.multiline,
|
|
84
|
+
computedProperties: this.computedProperties,
|
|
85
|
+
now: this.now,
|
|
86
|
+
translate: this.translate,
|
|
87
|
+
sortOptions: this.sortOptions,
|
|
88
|
+
width: this.width,
|
|
89
|
+
styleOptions: this.styleOptions,
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
exports.Field = Field;
|
|
94
|
+
class TextField extends Field {
|
|
95
|
+
constructor(label, { shortLabel, grows, span, rowSpan, schema, tags, codifications, readonly, options, labels, value, unit, multiline, computedProperties, translate, width, styleOptions, }) {
|
|
96
|
+
super('text-field', label, {
|
|
97
|
+
shortLabel,
|
|
98
|
+
grows,
|
|
99
|
+
span,
|
|
100
|
+
rowSpan,
|
|
101
|
+
schema: schema || 'styled-text-with-codes',
|
|
102
|
+
tags,
|
|
103
|
+
codifications,
|
|
104
|
+
readonly,
|
|
105
|
+
options,
|
|
106
|
+
labels,
|
|
107
|
+
value,
|
|
108
|
+
unit,
|
|
109
|
+
multiline: multiline,
|
|
110
|
+
computedProperties,
|
|
111
|
+
translate,
|
|
112
|
+
width,
|
|
113
|
+
styleOptions,
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
copy(properties) {
|
|
117
|
+
return new TextField(this.field, Object.assign(Object.assign({}, this), properties));
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
exports.TextField = TextField;
|
|
121
|
+
class MeasureField extends Field {
|
|
122
|
+
constructor(label, { shortLabel, grows, span, rowSpan, tags, codifications, readonly, options, labels, value, unit, computedProperties, translate, width, styleOptions, }) {
|
|
123
|
+
super('measure-field', label, {
|
|
124
|
+
shortLabel,
|
|
125
|
+
grows,
|
|
126
|
+
span,
|
|
127
|
+
rowSpan,
|
|
128
|
+
tags,
|
|
129
|
+
codifications,
|
|
130
|
+
readonly,
|
|
131
|
+
options,
|
|
132
|
+
labels,
|
|
133
|
+
value,
|
|
134
|
+
unit,
|
|
135
|
+
computedProperties,
|
|
136
|
+
translate,
|
|
137
|
+
width,
|
|
138
|
+
styleOptions,
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
copy(properties) {
|
|
142
|
+
return new MeasureField(this.field, Object.assign(Object.assign({}, this), properties));
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
exports.MeasureField = MeasureField;
|
|
146
|
+
class NumberField extends Field {
|
|
147
|
+
constructor(label, { shortLabel, grows, span, rowSpan, tags, codifications, readonly, options, labels, value, unit, computedProperties, translate, width, styleOptions, }) {
|
|
148
|
+
super('number-field', label, {
|
|
149
|
+
shortLabel,
|
|
150
|
+
grows,
|
|
151
|
+
span,
|
|
152
|
+
rowSpan,
|
|
153
|
+
tags,
|
|
154
|
+
codifications,
|
|
155
|
+
readonly,
|
|
156
|
+
options,
|
|
157
|
+
labels,
|
|
158
|
+
value,
|
|
159
|
+
unit,
|
|
160
|
+
computedProperties,
|
|
161
|
+
translate,
|
|
162
|
+
width,
|
|
163
|
+
styleOptions,
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
copy(properties) {
|
|
167
|
+
return new NumberField(this.field, Object.assign(Object.assign({}, this), properties));
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
exports.NumberField = NumberField;
|
|
171
|
+
class TokenField extends Field {
|
|
172
|
+
constructor(label, { shortLabel, grows, span, rowSpan, tags, codifications, readonly, options, labels, value, unit, computedProperties, translate, width, styleOptions, }) {
|
|
173
|
+
super('token-field', label, {
|
|
174
|
+
shortLabel,
|
|
175
|
+
grows,
|
|
176
|
+
span,
|
|
177
|
+
rowSpan,
|
|
178
|
+
tags,
|
|
179
|
+
codifications,
|
|
180
|
+
readonly,
|
|
181
|
+
options,
|
|
182
|
+
labels,
|
|
183
|
+
value,
|
|
184
|
+
unit,
|
|
185
|
+
computedProperties,
|
|
186
|
+
translate,
|
|
187
|
+
width,
|
|
188
|
+
styleOptions,
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
copy(properties) {
|
|
192
|
+
return new TokenField(this.field, Object.assign(Object.assign({}, this), properties));
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
exports.TokenField = TokenField;
|
|
196
|
+
class ItemsListField extends Field {
|
|
197
|
+
constructor(label, { shortLabel, grows, span, rowSpan, tags, codifications, readonly, options, labels, value, unit, computedProperties, translate, width, styleOptions, }) {
|
|
198
|
+
super('items-list-field', label, {
|
|
199
|
+
shortLabel,
|
|
200
|
+
grows,
|
|
201
|
+
span,
|
|
202
|
+
rowSpan,
|
|
203
|
+
tags,
|
|
204
|
+
codifications,
|
|
205
|
+
readonly,
|
|
206
|
+
options,
|
|
207
|
+
labels,
|
|
208
|
+
value,
|
|
209
|
+
unit,
|
|
210
|
+
computedProperties,
|
|
211
|
+
translate,
|
|
212
|
+
width,
|
|
213
|
+
styleOptions,
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
copy(properties) {
|
|
217
|
+
return new ItemsListField(this.field, Object.assign(Object.assign({}, this), properties));
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
exports.ItemsListField = ItemsListField;
|
|
221
|
+
class DatePicker extends Field {
|
|
222
|
+
constructor(label, { shortLabel, grows, span, rowSpan, tags, codifications, readonly, options, labels, value, unit, computedProperties, now, translate, width, styleOptions, }) {
|
|
223
|
+
super('date-picker', label, {
|
|
224
|
+
shortLabel,
|
|
225
|
+
grows,
|
|
226
|
+
span,
|
|
227
|
+
rowSpan,
|
|
228
|
+
tags,
|
|
229
|
+
codifications,
|
|
230
|
+
readonly,
|
|
231
|
+
options,
|
|
232
|
+
labels,
|
|
233
|
+
value,
|
|
234
|
+
unit,
|
|
235
|
+
computedProperties,
|
|
236
|
+
now,
|
|
237
|
+
translate,
|
|
238
|
+
width,
|
|
239
|
+
styleOptions,
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
copy(properties) {
|
|
243
|
+
return new DatePicker(this.field, Object.assign(Object.assign({}, this), properties));
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
exports.DatePicker = DatePicker;
|
|
247
|
+
class TimePicker extends Field {
|
|
248
|
+
constructor(label, { shortLabel, grows, span, rowSpan, tags, codifications, readonly, options, labels, value, unit, computedProperties, now, translate, width, styleOptions, }) {
|
|
249
|
+
super('time-picker', label, {
|
|
250
|
+
shortLabel,
|
|
251
|
+
grows,
|
|
252
|
+
span,
|
|
253
|
+
rowSpan,
|
|
254
|
+
tags,
|
|
255
|
+
codifications,
|
|
256
|
+
readonly,
|
|
257
|
+
options,
|
|
258
|
+
labels,
|
|
259
|
+
value,
|
|
260
|
+
unit,
|
|
261
|
+
computedProperties,
|
|
262
|
+
now,
|
|
263
|
+
translate,
|
|
264
|
+
width,
|
|
265
|
+
styleOptions,
|
|
266
|
+
});
|
|
267
|
+
}
|
|
268
|
+
copy(properties) {
|
|
269
|
+
return new TimePicker(this.field, Object.assign(Object.assign({}, this), properties));
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
exports.TimePicker = TimePicker;
|
|
273
|
+
class DateTimePicker extends Field {
|
|
274
|
+
constructor(label, { shortLabel, grows, span, rowSpan, tags, codifications, readonly, options, labels, value, unit, computedProperties, now, translate, width, styleOptions, }) {
|
|
275
|
+
super('date-time-picker', label, {
|
|
276
|
+
shortLabel,
|
|
277
|
+
grows,
|
|
278
|
+
span,
|
|
279
|
+
rowSpan,
|
|
280
|
+
tags,
|
|
281
|
+
codifications,
|
|
282
|
+
readonly,
|
|
283
|
+
options,
|
|
284
|
+
labels,
|
|
285
|
+
value,
|
|
286
|
+
unit,
|
|
287
|
+
computedProperties,
|
|
288
|
+
now,
|
|
289
|
+
translate,
|
|
290
|
+
width,
|
|
291
|
+
styleOptions,
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
copy(properties) {
|
|
295
|
+
return new DateTimePicker(this.field, Object.assign(Object.assign({}, this), properties));
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
exports.DateTimePicker = DateTimePicker;
|
|
299
|
+
class DropdownField extends Field {
|
|
300
|
+
constructor(label, options) {
|
|
301
|
+
var _a;
|
|
302
|
+
super('dropdown-field', label, {
|
|
303
|
+
shortLabel: options.shortLabel,
|
|
304
|
+
grows: options.grows,
|
|
305
|
+
span: options.span,
|
|
306
|
+
tags: options.tags,
|
|
307
|
+
codifications: options.codifications,
|
|
308
|
+
options: options.options,
|
|
309
|
+
labels: options.labels,
|
|
310
|
+
value: options.value,
|
|
311
|
+
computedProperties: options.computedProperties,
|
|
312
|
+
translate: options.translate,
|
|
313
|
+
width: options.width,
|
|
314
|
+
styleOptions: options.styleOptions,
|
|
315
|
+
});
|
|
316
|
+
this.sortOptions = (_a = options.sortOptions) !== null && _a !== void 0 ? _a : undefined;
|
|
317
|
+
}
|
|
318
|
+
copy(properties) {
|
|
319
|
+
return new DropdownField(this.field, Object.assign(Object.assign({}, this), properties));
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
exports.DropdownField = DropdownField;
|
|
323
|
+
class RadioButton extends Field {
|
|
324
|
+
constructor(label, { shortLabel, grows, span, rowSpan, tags, codifications, readonly, options, value, computedProperties, translate, sortOptions, width, styleOptions, }) {
|
|
325
|
+
super('radio-button', label, {
|
|
326
|
+
shortLabel,
|
|
327
|
+
grows,
|
|
328
|
+
span,
|
|
329
|
+
rowSpan,
|
|
330
|
+
tags,
|
|
331
|
+
codifications,
|
|
332
|
+
readonly,
|
|
333
|
+
options,
|
|
334
|
+
value,
|
|
335
|
+
computedProperties,
|
|
336
|
+
translate,
|
|
337
|
+
width,
|
|
338
|
+
styleOptions,
|
|
339
|
+
});
|
|
340
|
+
this.sortOptions = sortOptions !== null && sortOptions !== void 0 ? sortOptions : undefined;
|
|
341
|
+
}
|
|
342
|
+
copy(properties) {
|
|
343
|
+
return new RadioButton(this.field, Object.assign(Object.assign({}, this), properties));
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
exports.RadioButton = RadioButton;
|
|
347
|
+
class CheckBox extends Field {
|
|
348
|
+
constructor(label, { shortLabel, grows, span, rowSpan, tags, codifications, readonly, options, value, computedProperties, translate, sortOptions, width, styleOptions, }) {
|
|
349
|
+
super('checkbox', label, {
|
|
350
|
+
shortLabel,
|
|
351
|
+
grows,
|
|
352
|
+
span,
|
|
353
|
+
rowSpan,
|
|
354
|
+
tags,
|
|
355
|
+
codifications,
|
|
356
|
+
readonly,
|
|
357
|
+
options,
|
|
358
|
+
value,
|
|
359
|
+
computedProperties,
|
|
360
|
+
translate,
|
|
361
|
+
width,
|
|
362
|
+
styleOptions,
|
|
363
|
+
});
|
|
364
|
+
this.sortOptions = sortOptions !== null && sortOptions !== void 0 ? sortOptions : undefined;
|
|
365
|
+
}
|
|
366
|
+
copy(properties) {
|
|
367
|
+
return new CheckBox(this.field, Object.assign(Object.assign({}, this), properties));
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
exports.CheckBox = CheckBox;
|
|
371
|
+
class Label extends Field {
|
|
372
|
+
constructor(label, { shortLabel, grows, span }) {
|
|
373
|
+
super('label', label, { shortLabel, grows, span });
|
|
374
|
+
}
|
|
375
|
+
copy(properties) {
|
|
376
|
+
return new Label(this.field, Object.assign(Object.assign({}, this), properties));
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
exports.Label = Label;
|
|
380
|
+
class ActionButton extends Field {
|
|
381
|
+
constructor(label, { shortLabel, grows, span }) {
|
|
382
|
+
super('action', label, { shortLabel, grows, span });
|
|
383
|
+
}
|
|
384
|
+
copy(properties) {
|
|
385
|
+
return new ActionButton(this.field, Object.assign(Object.assign({}, this), properties));
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
exports.ActionButton = ActionButton;
|
|
389
|
+
class Group {
|
|
390
|
+
constructor(title, fields, { span, rowSpan, borderless, translate, computedProperties, width, styleOptions, }) {
|
|
391
|
+
this.clazz = 'group';
|
|
392
|
+
this.group = title;
|
|
393
|
+
this.fields = fields;
|
|
394
|
+
this.borderless = borderless !== null && borderless !== void 0 ? borderless : false;
|
|
395
|
+
this.translate = translate !== null && translate !== void 0 ? translate : true;
|
|
396
|
+
this.fields = fields;
|
|
397
|
+
this.span = span;
|
|
398
|
+
this.rowSpan = rowSpan;
|
|
399
|
+
this.computedProperties = computedProperties;
|
|
400
|
+
this.width = width;
|
|
401
|
+
this.styleOptions = styleOptions;
|
|
402
|
+
}
|
|
403
|
+
copy(properties) {
|
|
404
|
+
var _a;
|
|
405
|
+
return new Group(this.group, (_a = this.fields) !== null && _a !== void 0 ? _a : [], Object.assign(Object.assign({}, this), properties));
|
|
406
|
+
}
|
|
407
|
+
static parse({ borderless, span, computedProperties, fields, group, translate, width, }) {
|
|
408
|
+
return new Group(group, (fields || []).map((s) => s['group'] ? Group.parse(s) : s['subForm'] ? Subform.parse(s) : Field.parse(s)), {
|
|
409
|
+
span: span,
|
|
410
|
+
borderless: borderless,
|
|
411
|
+
translate: translate,
|
|
412
|
+
computedProperties: computedProperties,
|
|
413
|
+
width: width,
|
|
414
|
+
});
|
|
415
|
+
}
|
|
416
|
+
toJson() {
|
|
417
|
+
var _a;
|
|
418
|
+
return {
|
|
419
|
+
group: this.group,
|
|
420
|
+
computedProperties: this.computedProperties,
|
|
421
|
+
fields: (_a = this.fields) === null || _a === void 0 ? void 0 : _a.map((f) => f.toJson()),
|
|
422
|
+
borderless: this.borderless,
|
|
423
|
+
translatable: this.translate,
|
|
424
|
+
span: this.span,
|
|
425
|
+
width: this.width,
|
|
426
|
+
};
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
exports.Group = Group;
|
|
430
|
+
class Subform {
|
|
431
|
+
constructor(title, forms, { shortLabel, span, rowSpan, computedProperties, width, styleOptions, }) {
|
|
432
|
+
this.clazz = 'subform';
|
|
433
|
+
this.id = title;
|
|
434
|
+
this.shortLabel = shortLabel;
|
|
435
|
+
this.forms = forms;
|
|
436
|
+
this.span = span;
|
|
437
|
+
this.rowSpan = rowSpan;
|
|
438
|
+
this.computedProperties = computedProperties;
|
|
439
|
+
this.width = width;
|
|
440
|
+
this.styleOptions = styleOptions;
|
|
441
|
+
}
|
|
442
|
+
copy(properties) {
|
|
443
|
+
return new Subform(this.id, this.forms, Object.assign(Object.assign({}, this), properties));
|
|
444
|
+
}
|
|
445
|
+
static parse(json) {
|
|
446
|
+
return new Subform(json.subform, json.forms, {
|
|
447
|
+
shortLabel: json.shortLabel,
|
|
448
|
+
span: json.span,
|
|
449
|
+
computedProperties: json.computedProperties,
|
|
450
|
+
width: json.width,
|
|
451
|
+
styleOptions: json.styleOptions,
|
|
452
|
+
});
|
|
453
|
+
}
|
|
454
|
+
toJson() {
|
|
455
|
+
return {
|
|
456
|
+
subform: this.id,
|
|
457
|
+
shortLabel: this.shortLabel,
|
|
458
|
+
forms: this.forms,
|
|
459
|
+
span: this.span,
|
|
460
|
+
computedProperties: this.computedProperties,
|
|
461
|
+
width: this.width,
|
|
462
|
+
styleOptions: this.styleOptions,
|
|
463
|
+
};
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
exports.Subform = Subform;
|
|
467
|
+
class Section {
|
|
468
|
+
constructor(title, fields, description, keywords) {
|
|
469
|
+
this.section = title;
|
|
470
|
+
this.fields = fields;
|
|
471
|
+
this.description = description;
|
|
472
|
+
this.keywords = keywords;
|
|
473
|
+
}
|
|
474
|
+
static parse(json) {
|
|
475
|
+
var _a, _b, _c;
|
|
476
|
+
return new Section(json.section, ((_c = (_b = (_a = json.fields) !== null && _a !== void 0 ? _a : json.groups) !== null && _b !== void 0 ? _b : json.sections) !== null && _c !== void 0 ? _c : []).map((s) => s['group'] ? Group.parse(s) : s['subForm'] ? Subform.parse(s) : Field.parse(s)), json.description, json.keywords);
|
|
477
|
+
}
|
|
478
|
+
toJson() {
|
|
479
|
+
return {
|
|
480
|
+
section: this.section,
|
|
481
|
+
fields: this.fields.map((f) => f.toJson()),
|
|
482
|
+
description: this.description,
|
|
483
|
+
keywords: this.keywords,
|
|
484
|
+
};
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
exports.Section = Section;
|
|
488
|
+
class Codification {
|
|
489
|
+
constructor(type, codes) {
|
|
490
|
+
this.type = type;
|
|
491
|
+
this.codes = codes;
|
|
492
|
+
}
|
|
493
|
+
static parse(json) {
|
|
494
|
+
return new Codification(json.type, json.codes);
|
|
495
|
+
}
|
|
496
|
+
toJson() {
|
|
497
|
+
return {
|
|
498
|
+
type: this.type,
|
|
499
|
+
codes: this.codes,
|
|
500
|
+
};
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
exports.Codification = Codification;
|
|
504
|
+
class TranslationTable {
|
|
505
|
+
constructor(language, translations) {
|
|
506
|
+
this.language = language;
|
|
507
|
+
this.translations = translations;
|
|
508
|
+
}
|
|
509
|
+
static parse(json) {
|
|
510
|
+
return new TranslationTable(json.language, json.translations);
|
|
511
|
+
}
|
|
512
|
+
toJson() {
|
|
513
|
+
return {
|
|
514
|
+
language: this.language,
|
|
515
|
+
translations: this.translations,
|
|
516
|
+
};
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
exports.TranslationTable = TranslationTable;
|
|
520
|
+
class Form {
|
|
521
|
+
constructor(title, sections, id, description, keywords, codifications, translations) {
|
|
522
|
+
this.form = title;
|
|
523
|
+
this.description = description;
|
|
524
|
+
this.id = id;
|
|
525
|
+
this.keywords = keywords;
|
|
526
|
+
this.sections = sections;
|
|
527
|
+
this.codifications = codifications;
|
|
528
|
+
this.translations = translations;
|
|
529
|
+
}
|
|
530
|
+
static parse(json) {
|
|
531
|
+
var _a, _b;
|
|
532
|
+
return new Form(json.form, (json.sections || []).map((s) => Section.parse(s)), json.id, json.description, json.keywords, (_a = json.codifications) === null || _a === void 0 ? void 0 : _a.map((c) => Codification.parse(c)), (_b = json.translations) === null || _b === void 0 ? void 0 : _b.map((t) => TranslationTable.parse(t)));
|
|
533
|
+
}
|
|
534
|
+
toJson() {
|
|
535
|
+
return {
|
|
536
|
+
form: this.form,
|
|
537
|
+
sections: this.sections.map((s) => s.toJson()),
|
|
538
|
+
description: this.description,
|
|
539
|
+
keywords: this.keywords,
|
|
540
|
+
};
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
exports.Form = Form;
|
|
544
|
+
/**
|
|
545
|
+
* Action part.
|
|
546
|
+
* An action is an expression that can be triggered by a launcher and that can change the state of the form.
|
|
547
|
+
* Launchers are defined by a trigger and a name. Launchers are events that will trigger the action.
|
|
548
|
+
* Expression is evaluated by an Interpreter (get from the frontend). The expression can change the state of the form or launch another action on the frontend.
|
|
549
|
+
* States are the states that can be changed by the action. States are defined by a name and a state to update.
|
|
550
|
+
* There is 3 types of Action:
|
|
551
|
+
* - Formulas: the expression is a formula that will change the value of a field.
|
|
552
|
+
* Example: OnChange of field A and B, expresion is A + B and state is value of field C.
|
|
553
|
+
* - ExternalAction: the expression is a call to an external action.
|
|
554
|
+
* Example: OnClick of button A, expression is open dialog B and state is value of field C (that will be returned by the dialog).
|
|
555
|
+
* - ExternalEvent: the launcher is an external event.
|
|
556
|
+
* Example: Frontend send an event, expression is value of the event and state is value of field A.
|
|
557
|
+
*/
|
|
558
|
+
class Action {
|
|
559
|
+
constructor(launchers, expression, states) {
|
|
560
|
+
this.launchers = launchers;
|
|
561
|
+
this.expression = expression;
|
|
562
|
+
this.states = states;
|
|
563
|
+
}
|
|
564
|
+
static parse(json) {
|
|
565
|
+
return new Action((json.launchers || []).map((l) => Launcher.parse(l)), json.expression, (json.states || []).map((s) => State.parse(s)));
|
|
566
|
+
}
|
|
567
|
+
toJson() {
|
|
568
|
+
return {
|
|
569
|
+
launchers: this.launchers.map((l) => l.toJson()),
|
|
570
|
+
expression: this.expression,
|
|
571
|
+
states: this.states.map((s) => s.toJson()),
|
|
572
|
+
};
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
exports.Action = Action;
|
|
576
|
+
class Launcher {
|
|
577
|
+
constructor(name, triggerer, shouldPassValue) {
|
|
578
|
+
this.name = name;
|
|
579
|
+
this.triggerer = triggerer;
|
|
580
|
+
this.shouldPassValue = shouldPassValue;
|
|
581
|
+
}
|
|
582
|
+
static parse(json) {
|
|
583
|
+
return new Launcher(json.name, json.triggerer, json.shouldPassValue);
|
|
584
|
+
}
|
|
585
|
+
toJson() {
|
|
586
|
+
return {
|
|
587
|
+
name: this.name,
|
|
588
|
+
triggerer: this.triggerer.toString(),
|
|
589
|
+
shouldPassValue: this.shouldPassValue,
|
|
590
|
+
};
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
exports.Launcher = Launcher;
|
|
594
|
+
var Trigger;
|
|
595
|
+
(function (Trigger) {
|
|
596
|
+
Trigger["INIT"] = "INIT";
|
|
597
|
+
Trigger["CHANGE"] = "CHANGE";
|
|
598
|
+
Trigger["SORT"] = "SORT";
|
|
599
|
+
Trigger["CLICK"] = "CLICK";
|
|
600
|
+
Trigger["VISIBLE"] = "VISIBLE";
|
|
601
|
+
Trigger["ERROR"] = "ERROR";
|
|
602
|
+
Trigger["VALID"] = "VALID";
|
|
603
|
+
Trigger["EVENT"] = "EVENT";
|
|
604
|
+
})(Trigger = exports.Trigger || (exports.Trigger = {}));
|
|
605
|
+
class State {
|
|
606
|
+
constructor(name, stateToUpdate, canLaunchLauncher) {
|
|
607
|
+
this.name = name;
|
|
608
|
+
this.stateToUpdate = stateToUpdate;
|
|
609
|
+
this.canLaunchLauncher = canLaunchLauncher;
|
|
610
|
+
}
|
|
611
|
+
static parse(json) {
|
|
612
|
+
return new State(json.name, json.stateToUpdate, json.canLaunchLauncher);
|
|
613
|
+
}
|
|
614
|
+
toJson() {
|
|
615
|
+
return {
|
|
616
|
+
name: this.name,
|
|
617
|
+
stateToUpdate: this.stateToUpdate.toString(),
|
|
618
|
+
canLaunchLauncher: this.canLaunchLauncher,
|
|
619
|
+
};
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
exports.State = State;
|
|
623
|
+
var StateToUpdate;
|
|
624
|
+
(function (StateToUpdate) {
|
|
625
|
+
StateToUpdate["VALUE"] = "VALUE";
|
|
626
|
+
StateToUpdate["VISIBLE"] = "VISIBLE";
|
|
627
|
+
StateToUpdate["OPTIONS"] = "OPTIONS";
|
|
628
|
+
StateToUpdate["READONLY"] = "READONLY";
|
|
629
|
+
StateToUpdate["CLAZZ"] = "CLAZZ";
|
|
630
|
+
StateToUpdate["REQUIRED"] = "REQUIRED";
|
|
631
|
+
})(StateToUpdate = exports.StateToUpdate || (exports.StateToUpdate = {}));
|
|
632
|
+
//# sourceMappingURL=index.js.map
|