cedar-embeddable-editor 0.9.0
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/.browserslistrc +18 -0
- package/.editorconfig +16 -0
- package/README.md +302 -0
- package/angular.json +153 -0
- package/cedar-embeddable-editor-0.9.0.tgz +0 -0
- package/e2e/protractor.conf.js +36 -0
- package/e2e/src/app.e2e-spec.ts +23 -0
- package/e2e/src/app.po.ts +11 -0
- package/e2e/tsconfig.json +14 -0
- package/karma.conf.js +32 -0
- package/license.txt +26 -0
- package/package.json +61 -0
- package/src/app/app.component.dev.ts +74 -0
- package/src/app/app.component.html +5 -0
- package/src/app/app.component.prod.ts +76 -0
- package/src/app/app.component.scss +1 -0
- package/src/app/app.module.dev.ts +58 -0
- package/src/app/app.module.prod.ts +56 -0
- package/src/app/modules/input-types/components/cedar-foo-bar/cedar-foo-bar.component.html +0 -0
- package/src/app/modules/input-types/components/cedar-foo-bar/cedar-foo-bar.component.scss +0 -0
- package/src/app/modules/input-types/components/cedar-foo-bar/cedar-foo-bar.component.spec.ts +24 -0
- package/src/app/modules/input-types/components/cedar-foo-bar/cedar-foo-bar.component.ts +39 -0
- package/src/app/modules/input-types/components/cedar-input-attribute-value/cedar-input-attribute-value.component.html +25 -0
- package/src/app/modules/input-types/components/cedar-input-attribute-value/cedar-input-attribute-value.component.scss +0 -0
- package/src/app/modules/input-types/components/cedar-input-attribute-value/cedar-input-attribute-value.component.spec.ts +25 -0
- package/src/app/modules/input-types/components/cedar-input-attribute-value/cedar-input-attribute-value.component.ts +91 -0
- package/src/app/modules/input-types/components/cedar-input-checkbox/cedar-input-checkbox.component.html +8 -0
- package/src/app/modules/input-types/components/cedar-input-checkbox/cedar-input-checkbox.component.scss +0 -0
- package/src/app/modules/input-types/components/cedar-input-checkbox/cedar-input-checkbox.component.spec.ts +25 -0
- package/src/app/modules/input-types/components/cedar-input-checkbox/cedar-input-checkbox.component.ts +104 -0
- package/src/app/modules/input-types/components/cedar-input-controlled/cedar-input-controlled.component.html +22 -0
- package/src/app/modules/input-types/components/cedar-input-controlled/cedar-input-controlled.component.scss +0 -0
- package/src/app/modules/input-types/components/cedar-input-controlled/cedar-input-controlled.component.spec.ts +24 -0
- package/src/app/modules/input-types/components/cedar-input-controlled/cedar-input-controlled.component.ts +135 -0
- package/src/app/modules/input-types/components/cedar-input-datetime/cedar-input-datetime.component.html +44 -0
- package/src/app/modules/input-types/components/cedar-input-datetime/cedar-input-datetime.component.scss +0 -0
- package/src/app/modules/input-types/components/cedar-input-datetime/cedar-input-datetime.component.spec.ts +25 -0
- package/src/app/modules/input-types/components/cedar-input-datetime/cedar-input-datetime.component.ts +451 -0
- package/src/app/modules/input-types/components/cedar-input-email/cedar-input-email.component.html +16 -0
- package/src/app/modules/input-types/components/cedar-input-email/cedar-input-email.component.scss +0 -0
- package/src/app/modules/input-types/components/cedar-input-email/cedar-input-email.component.spec.ts +25 -0
- package/src/app/modules/input-types/components/cedar-input-email/cedar-input-email.component.ts +91 -0
- package/src/app/modules/input-types/components/cedar-input-link/cedar-input-link.component.html +16 -0
- package/src/app/modules/input-types/components/cedar-input-link/cedar-input-link.component.scss +0 -0
- package/src/app/modules/input-types/components/cedar-input-link/cedar-input-link.component.spec.ts +25 -0
- package/src/app/modules/input-types/components/cedar-input-link/cedar-input-link.component.ts +92 -0
- package/src/app/modules/input-types/components/cedar-input-multiple-choice/cedar-input-multiple-choice.component.html +18 -0
- package/src/app/modules/input-types/components/cedar-input-multiple-choice/cedar-input-multiple-choice.component.scss +5 -0
- package/src/app/modules/input-types/components/cedar-input-multiple-choice/cedar-input-multiple-choice.component.spec.ts +25 -0
- package/src/app/modules/input-types/components/cedar-input-multiple-choice/cedar-input-multiple-choice.component.ts +78 -0
- package/src/app/modules/input-types/components/cedar-input-numeric/cedar-input-numeric.component.html +15 -0
- package/src/app/modules/input-types/components/cedar-input-numeric/cedar-input-numeric.component.scss +0 -0
- package/src/app/modules/input-types/components/cedar-input-numeric/cedar-input-numeric.component.spec.ts +25 -0
- package/src/app/modules/input-types/components/cedar-input-numeric/cedar-input-numeric.component.ts +169 -0
- package/src/app/modules/input-types/components/cedar-input-phone/cedar-input-phone.component.html +15 -0
- package/src/app/modules/input-types/components/cedar-input-phone/cedar-input-phone.component.scss +0 -0
- package/src/app/modules/input-types/components/cedar-input-phone/cedar-input-phone.component.spec.ts +25 -0
- package/src/app/modules/input-types/components/cedar-input-phone/cedar-input-phone.component.ts +94 -0
- package/src/app/modules/input-types/components/cedar-input-select/cedar-input-select.component.html +19 -0
- package/src/app/modules/input-types/components/cedar-input-select/cedar-input-select.component.scss +0 -0
- package/src/app/modules/input-types/components/cedar-input-select/cedar-input-select.component.spec.ts +25 -0
- package/src/app/modules/input-types/components/cedar-input-select/cedar-input-select.component.ts +108 -0
- package/src/app/modules/input-types/components/cedar-input-text/cedar-input-text.component.html +25 -0
- package/src/app/modules/input-types/components/cedar-input-text/cedar-input-text.component.scss +0 -0
- package/src/app/modules/input-types/components/cedar-input-text/cedar-input-text.component.spec.ts +25 -0
- package/src/app/modules/input-types/components/cedar-input-text/cedar-input-text.component.ts +125 -0
- package/src/app/modules/input-types/components/cedar-static-image/cedar-static-image.component.html +8 -0
- package/src/app/modules/input-types/components/cedar-static-image/cedar-static-image.component.scss +0 -0
- package/src/app/modules/input-types/components/cedar-static-image/cedar-static-image.component.spec.ts +24 -0
- package/src/app/modules/input-types/components/cedar-static-image/cedar-static-image.component.ts +40 -0
- package/src/app/modules/input-types/components/cedar-static-page-break/cedar-static-page-break.component.html +20 -0
- package/src/app/modules/input-types/components/cedar-static-page-break/cedar-static-page-break.component.scss +24 -0
- package/src/app/modules/input-types/components/cedar-static-page-break/cedar-static-page-break.component.spec.ts +25 -0
- package/src/app/modules/input-types/components/cedar-static-page-break/cedar-static-page-break.component.ts +36 -0
- package/src/app/modules/input-types/components/cedar-static-rich-text/cedar-static-rich-text.component.html +2 -0
- package/src/app/modules/input-types/components/cedar-static-rich-text/cedar-static-rich-text.component.scss +0 -0
- package/src/app/modules/input-types/components/cedar-static-rich-text/cedar-static-rich-text.component.spec.ts +25 -0
- package/src/app/modules/input-types/components/cedar-static-rich-text/cedar-static-rich-text.component.ts +35 -0
- package/src/app/modules/input-types/components/cedar-static-section-break/cedar-static-section-break.component.html +8 -0
- package/src/app/modules/input-types/components/cedar-static-section-break/cedar-static-section-break.component.scss +0 -0
- package/src/app/modules/input-types/components/cedar-static-section-break/cedar-static-section-break.component.spec.ts +24 -0
- package/src/app/modules/input-types/components/cedar-static-section-break/cedar-static-section-break.component.ts +39 -0
- package/src/app/modules/input-types/components/cedar-static-youtube/cedar-static-youtube.component.html +6 -0
- package/src/app/modules/input-types/components/cedar-static-youtube/cedar-static-youtube.component.scss +0 -0
- package/src/app/modules/input-types/components/cedar-static-youtube/cedar-static-youtube.component.spec.ts +24 -0
- package/src/app/modules/input-types/components/cedar-static-youtube/cedar-static-youtube.component.ts +42 -0
- package/src/app/modules/input-types/input-types.module.ts +139 -0
- package/src/app/modules/shared/components/cedar-component-header/cedar-component-header.component.html +13 -0
- package/src/app/modules/shared/components/cedar-component-header/cedar-component-header.component.scss +12 -0
- package/src/app/modules/shared/components/cedar-component-header/cedar-component-header.component.spec.ts +25 -0
- package/src/app/modules/shared/components/cedar-component-header/cedar-component-header.component.ts +42 -0
- package/src/app/modules/shared/components/cedar-component-renderer/cedar-component-renderer.component.html +117 -0
- package/src/app/modules/shared/components/cedar-component-renderer/cedar-component-renderer.component.scss +5 -0
- package/src/app/modules/shared/components/cedar-component-renderer/cedar-component-renderer.component.spec.ts +25 -0
- package/src/app/modules/shared/components/cedar-component-renderer/cedar-component-renderer.component.ts +101 -0
- package/src/app/modules/shared/components/cedar-data-saver/cedar-data-saver.component.html +22 -0
- package/src/app/modules/shared/components/cedar-data-saver/cedar-data-saver.component.scss +23 -0
- package/src/app/modules/shared/components/cedar-data-saver/cedar-data-saver.component.spec.ts +24 -0
- package/src/app/modules/shared/components/cedar-data-saver/cedar-data-saver.component.ts +139 -0
- package/src/app/modules/shared/components/cedar-embeddable-metadata-editor/cedar-embeddable-metadata-editor.component.html +56 -0
- package/src/app/modules/shared/components/cedar-embeddable-metadata-editor/cedar-embeddable-metadata-editor.component.scss +13 -0
- package/src/app/modules/shared/components/cedar-embeddable-metadata-editor/cedar-embeddable-metadata-editor.component.spec.ts +25 -0
- package/src/app/modules/shared/components/cedar-embeddable-metadata-editor/cedar-embeddable-metadata-editor.component.ts +184 -0
- package/src/app/modules/shared/components/cedar-embeddable-metadata-editor-wrapper/cedar-embeddable-metadata-editor-wrapper.component.html +15 -0
- package/src/app/modules/shared/components/cedar-embeddable-metadata-editor-wrapper/cedar-embeddable-metadata-editor-wrapper.component.scss +2 -0
- package/src/app/modules/shared/components/cedar-embeddable-metadata-editor-wrapper/cedar-embeddable-metadata-editor-wrapper.component.spec.ts +25 -0
- package/src/app/modules/shared/components/cedar-embeddable-metadata-editor-wrapper/cedar-embeddable-metadata-editor-wrapper.component.ts +240 -0
- package/src/app/modules/shared/components/cedar-multi-pager/cedar-multi-pager.component.html +35 -0
- package/src/app/modules/shared/components/cedar-multi-pager/cedar-multi-pager.component.scss +41 -0
- package/src/app/modules/shared/components/cedar-multi-pager/cedar-multi-pager.component.spec.ts +25 -0
- package/src/app/modules/shared/components/cedar-multi-pager/cedar-multi-pager.component.ts +282 -0
- package/src/app/modules/shared/components/date-picker/date-picker.component.html +46 -0
- package/src/app/modules/shared/components/date-picker/date-picker.component.scss +7 -0
- package/src/app/modules/shared/components/date-picker/date-picker.component.spec.ts +25 -0
- package/src/app/modules/shared/components/date-picker/date-picker.component.ts +100 -0
- package/src/app/modules/shared/components/file-uploader/bytes/bytes.pipe.spec.ts +33 -0
- package/src/app/modules/shared/components/file-uploader/bytes/bytes.pipe.ts +16 -0
- package/src/app/modules/shared/components/file-uploader/file-upload-input-for/file-upload-input-for.directive.spec.ts +54 -0
- package/src/app/modules/shared/components/file-uploader/file-upload-input-for/file-upload-input-for.directive.ts +67 -0
- package/src/app/modules/shared/components/file-uploader/file-uploader.component.html +26 -0
- package/src/app/modules/shared/components/file-uploader/file-uploader.component.scss +55 -0
- package/src/app/modules/shared/components/file-uploader/file-uploader.component.spec.ts +25 -0
- package/src/app/modules/shared/components/file-uploader/file-uploader.component.ts +67 -0
- package/src/app/modules/shared/components/file-uploader/mat-file-upload/mat-file-upload.component.html +42 -0
- package/src/app/modules/shared/components/file-uploader/mat-file-upload/mat-file-upload.component.scss +31 -0
- package/src/app/modules/shared/components/file-uploader/mat-file-upload/mat-file-upload.component.spec.ts +177 -0
- package/src/app/modules/shared/components/file-uploader/mat-file-upload/mat-file-upload.component.ts +145 -0
- package/src/app/modules/shared/components/file-uploader/mat-file-upload/mat-file-upload.service.ts +21 -0
- package/src/app/modules/shared/components/file-uploader/mat-file-upload-queue/mat-file-upload-queue.component.html +1 -0
- package/src/app/modules/shared/components/file-uploader/mat-file-upload-queue/mat-file-upload-queue.component.scss +0 -0
- package/src/app/modules/shared/components/file-uploader/mat-file-upload-queue/mat-file-upload-queue.component.spec.ts +59 -0
- package/src/app/modules/shared/components/file-uploader/mat-file-upload-queue/mat-file-upload-queue.component.ts +139 -0
- package/src/app/modules/shared/components/file-uploader/mat-file-upload-queue/mat-file-upload-queue.service.spec.ts +33 -0
- package/src/app/modules/shared/components/file-uploader/mat-file-upload-queue/mat-file-upload-queue.service.ts +17 -0
- package/src/app/modules/shared/components/file-uploader/mat-file-upload.module.ts +35 -0
- package/src/app/modules/shared/components/file-uploader/mat-file-upload.type.ts +24 -0
- package/src/app/modules/shared/components/preferences-menu/preferences-menu.component.html +18 -0
- package/src/app/modules/shared/components/preferences-menu/preferences-menu.component.scss +0 -0
- package/src/app/modules/shared/components/preferences-menu/preferences-menu.component.spec.ts +23 -0
- package/src/app/modules/shared/components/preferences-menu/preferences-menu.component.ts +10 -0
- package/src/app/modules/shared/components/sample-templates/sample-template-select/sample-template-select.component.html +16 -0
- package/src/app/modules/shared/components/sample-templates/sample-template-select/sample-template-select.component.scss +0 -0
- package/src/app/modules/shared/components/sample-templates/sample-template-select/sample-template-select.component.spec.ts +25 -0
- package/src/app/modules/shared/components/sample-templates/sample-template-select/sample-template-select.component.ts +89 -0
- package/src/app/modules/shared/components/sample-templates/sample-templates.component.html +19 -0
- package/src/app/modules/shared/components/sample-templates/sample-templates.component.scss +0 -0
- package/src/app/modules/shared/components/sample-templates/sample-templates.component.spec.ts +25 -0
- package/src/app/modules/shared/components/sample-templates/sample-templates.component.ts +66 -0
- package/src/app/modules/shared/components/sample-templates/sample-templates.service.ts +175 -0
- package/src/app/modules/shared/components/source-panels/source-panels.component.html +98 -0
- package/src/app/modules/shared/components/source-panels/source-panels.component.scss +0 -0
- package/src/app/modules/shared/components/source-panels/source-panels.component.spec.ts +25 -0
- package/src/app/modules/shared/components/source-panels/source-panels.component.ts +36 -0
- package/src/app/modules/shared/components/static-footer/static-footer.component.html +17 -0
- package/src/app/modules/shared/components/static-footer/static-footer.component.scss +110 -0
- package/src/app/modules/shared/components/static-footer/static-footer.component.spec.ts +25 -0
- package/src/app/modules/shared/components/static-footer/static-footer.component.ts +16 -0
- package/src/app/modules/shared/components/static-header/static-header.component.html +10 -0
- package/src/app/modules/shared/components/static-header/static-header.component.scss +13 -0
- package/src/app/modules/shared/components/static-header/static-header.component.spec.ts +25 -0
- package/src/app/modules/shared/components/static-header/static-header.component.ts +21 -0
- package/src/app/modules/shared/components/timezone-picker/timezone-picker.component.html +16 -0
- package/src/app/modules/shared/components/timezone-picker/timezone-picker.component.scss +0 -0
- package/src/app/modules/shared/components/timezone-picker/timezone-picker.component.spec.ts +25 -0
- package/src/app/modules/shared/components/timezone-picker/timezone-picker.component.ts +251 -0
- package/src/app/modules/shared/factory/template-representation.factory.ts +323 -0
- package/src/app/modules/shared/handler/component-type.handler.ts +51 -0
- package/src/app/modules/shared/handler/data-object-builder.handler.ts +159 -0
- package/src/app/modules/shared/handler/data-object-data-value.handler.ts +270 -0
- package/src/app/modules/shared/handler/data-object-structure.handler.ts +145 -0
- package/src/app/modules/shared/handler/multi-instance-object.handler.ts +317 -0
- package/src/app/modules/shared/models/cedar-input-template.model.ts +3 -0
- package/src/app/modules/shared/models/cedar-model.model.ts +48 -0
- package/src/app/modules/shared/models/component/cedar-component.model.ts +16 -0
- package/src/app/modules/shared/models/component/component-representation.model.ts +30 -0
- package/src/app/modules/shared/models/component/element-component.model.ts +11 -0
- package/src/app/modules/shared/models/component/field-component.model.ts +23 -0
- package/src/app/modules/shared/models/component/multi-component.model.ts +10 -0
- package/src/app/modules/shared/models/component/null-component.model.ts +20 -0
- package/src/app/modules/shared/models/component/single-component.model.ts +6 -0
- package/src/app/modules/shared/models/element/abstract-element-component.model.ts +26 -0
- package/src/app/modules/shared/models/element/multi-element-component.model.ts +19 -0
- package/src/app/modules/shared/models/element/single-element-component.model.ts +16 -0
- package/src/app/modules/shared/models/enum/data-object-building-mode.model.ts +6 -0
- package/src/app/modules/shared/models/field/abstract-field-component.model.ts +28 -0
- package/src/app/modules/shared/models/field/multi-field-component.model.ts +21 -0
- package/src/app/modules/shared/models/field/single-field-component.model.ts +18 -0
- package/src/app/modules/shared/models/info/basic-info.model.ts +8 -0
- package/src/app/modules/shared/models/info/choice-info.model.ts +9 -0
- package/src/app/modules/shared/models/info/choice-option.model.ts +6 -0
- package/src/app/modules/shared/models/info/content-info.model.ts +5 -0
- package/src/app/modules/shared/models/info/controlled-info.model.ts +8 -0
- package/src/app/modules/shared/models/info/current-multi-info.model.ts +7 -0
- package/src/app/modules/shared/models/info/label-info.model.ts +7 -0
- package/src/app/modules/shared/models/info/multi-info.model.ts +10 -0
- package/src/app/modules/shared/models/info/multi-instance-info.model.ts +20 -0
- package/src/app/modules/shared/models/info/multi-instance-object-info.model.ts +30 -0
- package/src/app/modules/shared/models/info/number-info.model.ts +9 -0
- package/src/app/modules/shared/models/info/value-info.model.ts +9 -0
- package/src/app/modules/shared/models/input-type.model.ts +21 -0
- package/src/app/modules/shared/models/instance-extract-data.model.ts +3 -0
- package/src/app/modules/shared/models/instance-full-data.model.ts +5 -0
- package/src/app/modules/shared/models/javascript-types.model.ts +7 -0
- package/src/app/modules/shared/models/json-schema.model.ts +39 -0
- package/src/app/modules/shared/models/numbers.model.ts +10 -0
- package/src/app/modules/shared/models/rest/integrated-search/integrated-search-request-parameter-object.ts +8 -0
- package/src/app/modules/shared/models/rest/integrated-search/integrated-search-request-value-constraints.ts +8 -0
- package/src/app/modules/shared/models/rest/integrated-search/integrated-search-request.ts +9 -0
- package/src/app/modules/shared/models/rest/integrated-search/integrated-search-response-item.ts +10 -0
- package/src/app/modules/shared/models/rest/integrated-search/integrated-search-response.ts +13 -0
- package/src/app/modules/shared/models/static/static-field-component.model.ts +24 -0
- package/src/app/modules/shared/models/template/cedar-template.model.ts +24 -0
- package/src/app/modules/shared/models/template/empty-template.model.ts +5 -0
- package/src/app/modules/shared/models/template/null-template.model.ts +23 -0
- package/src/app/modules/shared/models/template/template-component.model.ts +12 -0
- package/src/app/modules/shared/models/temporal.model.ts +13 -0
- package/src/app/modules/shared/models/ui/cedar-ui-component.model.ts +17 -0
- package/src/app/modules/shared/models/xsd.model.ts +11 -0
- package/src/app/modules/shared/pipe/keep-html.pipe.ts +13 -0
- package/src/app/modules/shared/pipe/rdf.pipe.ts +10 -0
- package/src/app/modules/shared/service/active-component-registry.service.ts +134 -0
- package/src/app/modules/shared/service/component-data.service.ts +25 -0
- package/src/app/modules/shared/service/controlled-field-data.service.ts +37 -0
- package/src/app/modules/shared/service/date-time/custom-date-adapter.ts +19 -0
- package/src/app/modules/shared/service/date-time/date-time.service.ts +30 -0
- package/src/app/modules/shared/service/local-settings.service.ts +22 -0
- package/src/app/modules/shared/service/message-handler.service.ts +35 -0
- package/src/app/modules/shared/service/page-break-paginator.service.ts +78 -0
- package/src/app/modules/shared/shared.module.ts +97 -0
- package/src/app/modules/shared/util/data-context.ts +42 -0
- package/src/app/modules/shared/util/data-object-util.ts +102 -0
- package/src/app/modules/shared/util/handler-context.ts +81 -0
- package/src/app/modules/shared/util/template-object-util.ts +21 -0
- package/src/assets/.gitkeep +0 -0
- package/src/assets/fonts/MaterialIcons-Regular.eot +0 -0
- package/src/assets/fonts/MaterialIcons-Regular.ttf +0 -0
- package/src/assets/fonts/MaterialIcons-Regular.woff +0 -0
- package/src/assets/fonts/MaterialIcons-Regular.woff2 +0 -0
- package/src/assets/i18n-cee/en.json +86 -0
- package/src/assets/i18n-cee/hu.json +86 -0
- package/src/assets/images/bmir-logo.png +0 -0
- package/src/assets/images/cedar-logo-80x80.png +0 -0
- package/src/environments/environment.prod.ts +5 -0
- package/src/environments/environment.ts +18 -0
- package/src/favicon.ico +0 -0
- package/src/index.html +16 -0
- package/src/main.ts +28 -0
- package/src/polyfills.ts +65 -0
- package/src/styles-own.scss +352 -0
- package/src/styles.scss +116 -0
- package/src/test.ts +25 -0
- package/tsconfig.app.json +16 -0
- package/tsconfig.base.json +20 -0
- package/tsconfig.json +20 -0
- package/tsconfig.spec.json +18 -0
- package/tslint.json +152 -0
|
@@ -0,0 +1,317 @@
|
|
|
1
|
+
import {TemplateComponent} from '../models/template/template-component.model';
|
|
2
|
+
import {ElementComponent} from '../models/component/element-component.model';
|
|
3
|
+
import {MultiComponent} from '../models/component/multi-component.model';
|
|
4
|
+
import {Injectable} from '@angular/core';
|
|
5
|
+
import {MultiFieldComponent} from '../models/field/multi-field-component.model';
|
|
6
|
+
import {SingleFieldComponent} from '../models/field/single-field-component.model';
|
|
7
|
+
import {MultiElementComponent} from '../models/element/multi-element-component.model';
|
|
8
|
+
import {SingleElementComponent} from '../models/element/single-element-component.model';
|
|
9
|
+
import {CedarComponent} from '../models/component/cedar-component.model';
|
|
10
|
+
import {CedarTemplate} from '../models/template/cedar-template.model';
|
|
11
|
+
import * as _ from 'lodash-es';
|
|
12
|
+
import {MultiInstanceInfo} from '../models/info/multi-instance-info.model';
|
|
13
|
+
import {MultiInstanceObjectInfo} from '../models/info/multi-instance-object-info.model';
|
|
14
|
+
import {InstanceExtractData} from '../models/instance-extract-data.model';
|
|
15
|
+
import {JavascriptTypes} from '../models/javascript-types.model';
|
|
16
|
+
import {JsonSchema} from '../models/json-schema.model';
|
|
17
|
+
|
|
18
|
+
@Injectable({
|
|
19
|
+
providedIn: 'root',
|
|
20
|
+
})
|
|
21
|
+
export class MultiInstanceObjectHandler {
|
|
22
|
+
|
|
23
|
+
public multiInstanceObject: MultiInstanceInfo;
|
|
24
|
+
private templateRepresentation: TemplateComponent;
|
|
25
|
+
private indexRegEx = new RegExp(/@#index\[(\d+)\]#@/);
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
private static getNodeByPath(obj, arrPath: string[]): object {
|
|
29
|
+
let val: object;
|
|
30
|
+
|
|
31
|
+
for (let i = 0; i < arrPath.length; i++) {
|
|
32
|
+
if (val) {
|
|
33
|
+
val = val[arrPath[i]];
|
|
34
|
+
} else {
|
|
35
|
+
val = obj[arrPath[i]];
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return val;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
private static getMultiInstanceInfoNodeByPath(obj, arrPath: string[]): MultiInstanceInfo {
|
|
42
|
+
return MultiInstanceObjectHandler.getNodeByPath(obj, arrPath) as MultiInstanceInfo;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
private static getMultiInstanceObjectInfoNodeByPath(obj, arrPath: string[]): MultiInstanceObjectInfo {
|
|
46
|
+
return MultiInstanceObjectHandler.getNodeByPath(obj, arrPath) as MultiInstanceObjectInfo;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
buildNewOrFromMetadata(templateRepresentation: TemplateComponent,
|
|
50
|
+
instanceExtractData: InstanceExtractData = null): MultiInstanceInfo {
|
|
51
|
+
this.templateRepresentation = templateRepresentation;
|
|
52
|
+
this.multiInstanceObject = new MultiInstanceInfo();
|
|
53
|
+
this.buildRecursively(templateRepresentation, this.multiInstanceObject);
|
|
54
|
+
|
|
55
|
+
if (instanceExtractData) {
|
|
56
|
+
this.updateFromInstanceExtractData(instanceExtractData, [], this.multiInstanceObject);
|
|
57
|
+
}
|
|
58
|
+
return this.multiInstanceObject;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
private updateFromInstanceExtractData(instanceExtractDataIn: InstanceExtractData,
|
|
62
|
+
parentPath: string[], multiInstanceObject: MultiInstanceInfo): void {
|
|
63
|
+
const instanceExtractData = JSON.parse(JSON.stringify(instanceExtractDataIn));
|
|
64
|
+
// this.deleteAttributeValueFields(instanceExtractData);
|
|
65
|
+
|
|
66
|
+
for(const key in instanceExtractData) {
|
|
67
|
+
const myPath: string[] = parentPath.slice();
|
|
68
|
+
myPath.push(key);
|
|
69
|
+
|
|
70
|
+
// multi-page element or mutli-page field
|
|
71
|
+
if (Array.isArray(instanceExtractData[key]) && instanceExtractData[key].length > 0) {
|
|
72
|
+
this.setSingleMultiInstance(myPath.slice(), instanceExtractData[key].length, multiInstanceObject);
|
|
73
|
+
|
|
74
|
+
// field component with values or attribute-value field
|
|
75
|
+
const isField =
|
|
76
|
+
// field component with values (text or controlled)
|
|
77
|
+
(typeof instanceExtractData[key][0] === JavascriptTypes.object &&
|
|
78
|
+
(instanceExtractData[key][0].hasOwnProperty(JsonSchema.atValue) ||
|
|
79
|
+
instanceExtractData[key][0].hasOwnProperty(JsonSchema.atId))) ||
|
|
80
|
+
// attribute-value field
|
|
81
|
+
(typeof instanceExtractData[key][0] === JavascriptTypes.string && instanceExtractData[key].length > 0);
|
|
82
|
+
|
|
83
|
+
// not a field, so it is a multi-page element component
|
|
84
|
+
if (!isField) {
|
|
85
|
+
for (let i = 0; i < instanceExtractData[key].length; i++) {
|
|
86
|
+
if (i > 0) {
|
|
87
|
+
myPath.pop();
|
|
88
|
+
}
|
|
89
|
+
myPath.push(this.indexRegEx.source.replace('(\\d+)', i.toString()).replace(/\\/g, ''));
|
|
90
|
+
this.updateFromInstanceExtractData(instanceExtractData[key][i], myPath, multiInstanceObject);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
// it's an object, can be a single-page element or a single-page field
|
|
94
|
+
} else if (typeof instanceExtractData[key] === JavascriptTypes.object && Object.keys(instanceExtractData[key]).length > 0) {
|
|
95
|
+
// single-page field (it's never paginated, so not required for pagination,
|
|
96
|
+
// but still need to have an entry for it in multiInstanceObject)
|
|
97
|
+
if (instanceExtractData[key].hasOwnProperty(JsonSchema.atValue) || instanceExtractData[key].hasOwnProperty(JsonSchema.atId)) {
|
|
98
|
+
this.setSingleMultiInstance(myPath, 1, multiInstanceObject);
|
|
99
|
+
} else {
|
|
100
|
+
// single-page element component
|
|
101
|
+
// push a dummy 0 array element for a consistent multi-paging logic
|
|
102
|
+
// multi-page structure does not differentiate between single- and multi-page components
|
|
103
|
+
myPath.push(this.indexRegEx.source.replace('(\\d+)', '0').replace(/\\/g, ''));
|
|
104
|
+
this.updateFromInstanceExtractData(instanceExtractData[key], myPath, multiInstanceObject);
|
|
105
|
+
}
|
|
106
|
+
} else {
|
|
107
|
+
// empty fields
|
|
108
|
+
// need to record the component in multiInstanceObject even if it's empty
|
|
109
|
+
this.setSingleMultiInstance(myPath, 0, multiInstanceObject);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
private setSingleMultiInstance(path: string[], count: number,
|
|
115
|
+
multiInstanceObject: MultiInstanceInfo): void {
|
|
116
|
+
const pathCopy = [];
|
|
117
|
+
|
|
118
|
+
for (let i = 0; i < path.length; i++) {
|
|
119
|
+
pathCopy.push(path[i]);
|
|
120
|
+
const match = path[i].match(this.indexRegEx);
|
|
121
|
+
|
|
122
|
+
if (match && match.length > 1) {
|
|
123
|
+
pathCopy.pop();
|
|
124
|
+
const pathParent = pathCopy.slice();
|
|
125
|
+
pathCopy.push('children');
|
|
126
|
+
pathCopy.push(match[1]);
|
|
127
|
+
|
|
128
|
+
const childObj = MultiInstanceObjectHandler.getMultiInstanceInfoNodeByPath(multiInstanceObject, pathCopy);
|
|
129
|
+
const componentName = path[i + 1];
|
|
130
|
+
|
|
131
|
+
// childObj is an object of type MultiInstanceInfo of structure
|
|
132
|
+
// {strKey1 => MultiInstanceObjectInfo, strKey2 => MultiInstanceObjectInfo}
|
|
133
|
+
if (childObj) {
|
|
134
|
+
const arrayElemPath = pathCopy.slice();
|
|
135
|
+
arrayElemPath.push(componentName);
|
|
136
|
+
const arrayElem = MultiInstanceObjectHandler.getMultiInstanceObjectInfoNodeByPath(multiInstanceObject, arrayElemPath);
|
|
137
|
+
|
|
138
|
+
// the child object (element of the array) does exist
|
|
139
|
+
// but the element inside it does not, creating base
|
|
140
|
+
if (!arrayElem) {
|
|
141
|
+
const childElem = new MultiInstanceObjectInfo();
|
|
142
|
+
childElem.componentName = componentName;
|
|
143
|
+
childObj.addChild(childElem);
|
|
144
|
+
}
|
|
145
|
+
} else {
|
|
146
|
+
// the entire child object (element of the array) does not exist
|
|
147
|
+
// need to create the object and its first base element
|
|
148
|
+
const parentObj = MultiInstanceObjectHandler.getMultiInstanceObjectInfoNodeByPath(multiInstanceObject, pathParent);
|
|
149
|
+
const child = new MultiInstanceInfo();
|
|
150
|
+
parentObj.addChild(child);
|
|
151
|
+
const childElem = new MultiInstanceObjectInfo();
|
|
152
|
+
childElem.componentName = componentName;
|
|
153
|
+
child.addChild(childElem);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
const targetObj = MultiInstanceObjectHandler.getMultiInstanceObjectInfoNodeByPath(multiInstanceObject, pathCopy);
|
|
158
|
+
if (targetObj) {
|
|
159
|
+
targetObj.componentName = path[path.length - 1];
|
|
160
|
+
targetObj.currentCount = count;
|
|
161
|
+
targetObj.currentIndex = (count > 0) ? 0 : -1;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
private deleteAttributeValueFields(instanceExtractData: InstanceExtractData): void {
|
|
166
|
+
for (const key in instanceExtractData) {
|
|
167
|
+
if (Array.isArray(instanceExtractData[key]) && instanceExtractData[key].length > 0) {
|
|
168
|
+
if (typeof instanceExtractData[key][0] === JavascriptTypes.string) {
|
|
169
|
+
for (let i = 0; i < instanceExtractData[key].length; i++) {
|
|
170
|
+
delete instanceExtractData[instanceExtractData[key][i]];
|
|
171
|
+
}
|
|
172
|
+
} else {
|
|
173
|
+
if (!instanceExtractData[key][0].hasOwnProperty(JsonSchema.atValue) &&
|
|
174
|
+
!instanceExtractData[key][0].hasOwnProperty(JsonSchema.atId)) {
|
|
175
|
+
for (let i = 0; i < instanceExtractData[key].length; i++) {
|
|
176
|
+
this.deleteAttributeValueFields(instanceExtractData[key][i]);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
} else {
|
|
181
|
+
if (!instanceExtractData[key].hasOwnProperty(JsonSchema.atValue) &&
|
|
182
|
+
!instanceExtractData[key].hasOwnProperty(JsonSchema.atId)) {
|
|
183
|
+
this.deleteAttributeValueFields(instanceExtractData[key]);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
private buildRecursively(cedarComponent: CedarComponent, multiInstanceObject: MultiInstanceInfo): void {
|
|
190
|
+
if (!(cedarComponent instanceof MultiElementComponent || cedarComponent instanceof SingleElementComponent
|
|
191
|
+
|| cedarComponent instanceof CedarTemplate)) {
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
const elementComponent = cedarComponent as ElementComponent;
|
|
195
|
+
for (const child of elementComponent.children) {
|
|
196
|
+
const name = child.name;
|
|
197
|
+
const multiInfo = new MultiInstanceObjectInfo();
|
|
198
|
+
multiInfo.componentName = name;
|
|
199
|
+
multiInstanceObject.addChild(multiInfo);
|
|
200
|
+
let count = 0;
|
|
201
|
+
let currentIndex = -1;
|
|
202
|
+
if (child instanceof MultiFieldComponent) {
|
|
203
|
+
count = (child as MultiComponent).multiInfo.minItems;
|
|
204
|
+
currentIndex = count > 0 ? 0 : -1;
|
|
205
|
+
delete multiInfo.children;
|
|
206
|
+
} else if (child instanceof SingleFieldComponent) {
|
|
207
|
+
count = 1;
|
|
208
|
+
currentIndex = -1;
|
|
209
|
+
delete multiInfo.children;
|
|
210
|
+
} else if (child instanceof MultiElementComponent) {
|
|
211
|
+
count = (child as MultiComponent).multiInfo.minItems;
|
|
212
|
+
currentIndex = count > 0 ? 0 : -1;
|
|
213
|
+
for (let i = 0; i < count; i++) {
|
|
214
|
+
const mc = new MultiInstanceInfo();
|
|
215
|
+
this.buildRecursively(child, mc);
|
|
216
|
+
multiInfo.addChild(mc);
|
|
217
|
+
}
|
|
218
|
+
} else if (child instanceof SingleElementComponent) {
|
|
219
|
+
count = 1;
|
|
220
|
+
currentIndex = -1;
|
|
221
|
+
const mc = new MultiInstanceInfo();
|
|
222
|
+
this.buildRecursively(child, mc);
|
|
223
|
+
multiInfo.addChild(mc);
|
|
224
|
+
}
|
|
225
|
+
multiInfo.currentCount = count;
|
|
226
|
+
multiInfo.currentIndex = currentIndex;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
setCurrentIndex(component: MultiComponent, currentIdx: number): void {
|
|
231
|
+
const multiInstanceInfo: MultiInstanceObjectInfo = this.getDataPathNode(component.path);
|
|
232
|
+
multiInstanceInfo.currentIndex = currentIdx;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
multiInstanceItemAdd(component: MultiComponent): void {
|
|
236
|
+
const multiInstanceInfo: MultiInstanceObjectInfo = this.getDataPathNode(component.path);
|
|
237
|
+
|
|
238
|
+
if (component instanceof MultiElementComponent) {
|
|
239
|
+
const newMultiInstanceObject: MultiInstanceInfo = new MultiInstanceInfo();
|
|
240
|
+
this.buildRecursively(component, newMultiInstanceObject);
|
|
241
|
+
multiInstanceInfo.children.splice(multiInstanceInfo.currentIndex + 1, 0, newMultiInstanceObject as never);
|
|
242
|
+
}
|
|
243
|
+
multiInstanceInfo.currentIndex++;
|
|
244
|
+
multiInstanceInfo.currentCount++;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
multiInstanceItemCopy(component: MultiComponent): void {
|
|
248
|
+
const multiInstanceInfo = this.getDataPathNode(component.path);
|
|
249
|
+
|
|
250
|
+
if (component instanceof MultiElementComponent) {
|
|
251
|
+
const currentIdx = multiInstanceInfo.currentIndex;
|
|
252
|
+
const sourceItem = multiInstanceInfo.children[currentIdx];
|
|
253
|
+
const cloneItem = _.cloneDeep(sourceItem as any);
|
|
254
|
+
multiInstanceInfo.children.splice(currentIdx + 1, 0, cloneItem as never);
|
|
255
|
+
}
|
|
256
|
+
multiInstanceInfo.currentIndex++;
|
|
257
|
+
multiInstanceInfo.currentCount++;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
multiInstanceItemDelete(component: MultiComponent): void {
|
|
261
|
+
const multiInstanceInfo = this.getDataPathNode(component.path);
|
|
262
|
+
|
|
263
|
+
if (component instanceof MultiElementComponent) {
|
|
264
|
+
const currentIdx = multiInstanceInfo.currentIndex;
|
|
265
|
+
multiInstanceInfo.children.splice(currentIdx, 1);
|
|
266
|
+
}
|
|
267
|
+
multiInstanceInfo.currentCount--;
|
|
268
|
+
if (multiInstanceInfo.currentIndex > multiInstanceInfo.currentCount - 1) {
|
|
269
|
+
multiInstanceInfo.currentIndex = multiInstanceInfo.currentCount - 1;
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
getMultiInstanceInfoForComponent(component: MultiComponent): MultiInstanceObjectInfo {
|
|
274
|
+
return this.getDataPathNode(component.path);
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
public getDataPathNode(path: string[]): MultiInstanceObjectInfo {
|
|
278
|
+
return this.getDataPathNodeRecursively(this.multiInstanceObject, this.templateRepresentation, path);
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
private getDataPathNodeRecursively(multiInstanceObject: MultiInstanceInfo, component: CedarComponent,
|
|
282
|
+
path: string[]): MultiInstanceObjectInfo {
|
|
283
|
+
if (!multiInstanceObject) {
|
|
284
|
+
return null;
|
|
285
|
+
}
|
|
286
|
+
const firstPath = path[0];
|
|
287
|
+
const remainingPath = path.slice(1);
|
|
288
|
+
let childComponent: CedarComponent = null;
|
|
289
|
+
let childMultiInfo: MultiInstanceObjectInfo = null;
|
|
290
|
+
if (component instanceof SingleElementComponent) {
|
|
291
|
+
childComponent = (component as SingleElementComponent).getChildByName(firstPath);
|
|
292
|
+
childMultiInfo = multiInstanceObject.getChildByName(firstPath);
|
|
293
|
+
} else if (component instanceof CedarTemplate) {
|
|
294
|
+
childComponent = (component as CedarTemplate).getChildByName(firstPath);
|
|
295
|
+
childMultiInfo = multiInstanceObject.getChildByName(firstPath);
|
|
296
|
+
} else if (component instanceof MultiElementComponent) {
|
|
297
|
+
childComponent = (component as MultiElementComponent).getChildByName(firstPath);
|
|
298
|
+
childMultiInfo = multiInstanceObject.getChildByName(firstPath);
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
if (remainingPath.length === 0) {
|
|
302
|
+
return childMultiInfo;
|
|
303
|
+
} else {
|
|
304
|
+
let goIdx = 0;
|
|
305
|
+
if (childMultiInfo.currentIndex > 0) {
|
|
306
|
+
goIdx = childMultiInfo.currentIndex;
|
|
307
|
+
}
|
|
308
|
+
return this.getDataPathNodeRecursively(childMultiInfo.children[goIdx], childComponent, remainingPath);
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
hasMultiInstances(multiComponent: MultiComponent): boolean {
|
|
313
|
+
const multiInstanceObjectInfo: MultiInstanceObjectInfo = this.getMultiInstanceInfoForComponent(multiComponent);
|
|
314
|
+
return multiInstanceObjectInfo.currentCount > 0;
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
export class CedarModel {
|
|
2
|
+
|
|
3
|
+
static ui = '_ui';
|
|
4
|
+
static order = 'order';
|
|
5
|
+
static inputType = 'inputType';
|
|
6
|
+
static type = 'type';
|
|
7
|
+
static items = 'items';
|
|
8
|
+
static valueConstraints = '_valueConstraints';
|
|
9
|
+
static requiredValue = 'requiredValue';
|
|
10
|
+
static defaultValue = 'defaultValue';
|
|
11
|
+
static minItems = 'minItems';
|
|
12
|
+
static maxItems = 'maxItems';
|
|
13
|
+
static minLength = 'minLength';
|
|
14
|
+
static maxLength = 'maxLength';
|
|
15
|
+
static numberType = 'numberType';
|
|
16
|
+
static temporalType = 'temporalType';
|
|
17
|
+
static temporalGranularity = 'temporalGranularity';
|
|
18
|
+
static timezoneEnabled = 'timezoneEnabled';
|
|
19
|
+
static inputTimeFormat = 'inputTimeFormat';
|
|
20
|
+
static unitOfMeasure = 'unitOfMeasure';
|
|
21
|
+
static minValue = 'minValue';
|
|
22
|
+
static maxValue = 'maxValue';
|
|
23
|
+
static decimalPlace = 'decimalPlace';
|
|
24
|
+
static content = '_content';
|
|
25
|
+
|
|
26
|
+
static ontologies = 'ontologies';
|
|
27
|
+
static valueSets = 'valueSets';
|
|
28
|
+
static classes = 'classes';
|
|
29
|
+
static branches = 'branches';
|
|
30
|
+
|
|
31
|
+
static multipleChoice = 'multipleChoice';
|
|
32
|
+
static literals = 'literals';
|
|
33
|
+
static label = 'label';
|
|
34
|
+
static selectedByDefault = 'selectedByDefault';
|
|
35
|
+
|
|
36
|
+
static skosPrefLabel = 'skos:prefLabel';
|
|
37
|
+
static propertyDescriptions = 'propertyDescriptions';
|
|
38
|
+
static propertyLabels = 'propertyLabels';
|
|
39
|
+
|
|
40
|
+
static format = 'format';
|
|
41
|
+
static enum = 'enum';
|
|
42
|
+
|
|
43
|
+
static baseTemplateURL = 'https://schema.metadatacenter.org';
|
|
44
|
+
static templateFieldType = CedarModel.baseTemplateURL + '/core/TemplateField';
|
|
45
|
+
static templateElementType = CedarModel.baseTemplateURL + '/core/TemplateElement';
|
|
46
|
+
static templateStaticFieldType = CedarModel.baseTemplateURL + '/core/StaticTemplateField';
|
|
47
|
+
|
|
48
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import {LabelInfo} from '../info/label-info.model';
|
|
2
|
+
import {StaticFieldComponent} from '../static/static-field-component.model';
|
|
3
|
+
|
|
4
|
+
export interface CedarComponent {
|
|
5
|
+
|
|
6
|
+
className: string;
|
|
7
|
+
name: string;
|
|
8
|
+
path: string[];
|
|
9
|
+
linkedStaticFieldComponent: StaticFieldComponent;
|
|
10
|
+
|
|
11
|
+
labelInfo: LabelInfo;
|
|
12
|
+
|
|
13
|
+
isMulti(): boolean;
|
|
14
|
+
isMultiPage(): boolean;
|
|
15
|
+
|
|
16
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import {CedarComponent} from './cedar-component.model';
|
|
2
|
+
|
|
3
|
+
export interface ComponentRepresentation extends CedarComponent {
|
|
4
|
+
|
|
5
|
+
className: string;
|
|
6
|
+
children: CedarComponent[];
|
|
7
|
+
|
|
8
|
+
// Generic
|
|
9
|
+
inputType: string;
|
|
10
|
+
name: string;
|
|
11
|
+
requiredValue: boolean;
|
|
12
|
+
|
|
13
|
+
source: object;
|
|
14
|
+
|
|
15
|
+
// Value
|
|
16
|
+
defaultValue: string;
|
|
17
|
+
minLength: number;
|
|
18
|
+
maxLength: number;
|
|
19
|
+
|
|
20
|
+
// Numeric
|
|
21
|
+
numberType: string;
|
|
22
|
+
unitOfMeasure: string;
|
|
23
|
+
minValue: number;
|
|
24
|
+
maxValue: number;
|
|
25
|
+
decimalPlace: number;
|
|
26
|
+
|
|
27
|
+
// Multiple
|
|
28
|
+
readonly multiple: boolean;
|
|
29
|
+
|
|
30
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import {CedarComponent} from './cedar-component.model';
|
|
2
|
+
import {LabelInfo} from '../info/label-info.model';
|
|
3
|
+
|
|
4
|
+
export interface ElementComponent extends CedarComponent {
|
|
5
|
+
|
|
6
|
+
children: CedarComponent[];
|
|
7
|
+
labelInfo: LabelInfo;
|
|
8
|
+
|
|
9
|
+
getChildByName(childName: string): CedarComponent;
|
|
10
|
+
|
|
11
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import {CedarComponent} from './cedar-component.model';
|
|
2
|
+
import {BasicInfo} from '../info/basic-info.model';
|
|
3
|
+
import {ValueInfo} from '../info/value-info.model';
|
|
4
|
+
import {NumberInfo} from '../info/number-info.model';
|
|
5
|
+
import {ChoiceInfo} from '../info/choice-info.model';
|
|
6
|
+
import {LabelInfo} from '../info/label-info.model';
|
|
7
|
+
import {ControlledInfo} from '../info/controlled-info.model';
|
|
8
|
+
import {MultiInfo} from '../info/multi-info.model';
|
|
9
|
+
|
|
10
|
+
export interface FieldComponent extends CedarComponent {
|
|
11
|
+
|
|
12
|
+
basicInfo: BasicInfo;
|
|
13
|
+
valueInfo: ValueInfo;
|
|
14
|
+
numberInfo: NumberInfo;
|
|
15
|
+
choiceInfo: ChoiceInfo;
|
|
16
|
+
labelInfo: LabelInfo;
|
|
17
|
+
controlledInfo: ControlledInfo;
|
|
18
|
+
multiInfo: MultiInfo;
|
|
19
|
+
|
|
20
|
+
isMulti(): boolean;
|
|
21
|
+
isMultiPage(): boolean;
|
|
22
|
+
|
|
23
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import {CedarComponent} from './cedar-component.model';
|
|
2
|
+
import {LabelInfo} from '../info/label-info.model';
|
|
3
|
+
import {StaticFieldComponent} from '../static/static-field-component.model';
|
|
4
|
+
|
|
5
|
+
export class NullComponent implements CedarComponent {
|
|
6
|
+
|
|
7
|
+
className = 'NullComponent';
|
|
8
|
+
labelInfo: LabelInfo;
|
|
9
|
+
name: string;
|
|
10
|
+
path: string[];
|
|
11
|
+
linkedStaticFieldComponent: StaticFieldComponent;
|
|
12
|
+
|
|
13
|
+
isMulti(): boolean {
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
isMultiPage(): boolean {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import {CedarComponent} from '../component/cedar-component.model';
|
|
2
|
+
import {ElementComponent} from '../component/element-component.model';
|
|
3
|
+
import {LabelInfo} from '../info/label-info.model';
|
|
4
|
+
import {StaticFieldComponent} from '../static/static-field-component.model';
|
|
5
|
+
|
|
6
|
+
export abstract class AbstractElementComponent implements ElementComponent {
|
|
7
|
+
|
|
8
|
+
className = 'AbstractElementComponent';
|
|
9
|
+
name: string;
|
|
10
|
+
path: string[];
|
|
11
|
+
children: CedarComponent[] = [];
|
|
12
|
+
labelInfo: LabelInfo = new LabelInfo();
|
|
13
|
+
linkedStaticFieldComponent: StaticFieldComponent = null;
|
|
14
|
+
|
|
15
|
+
getChildByName(childName: string): CedarComponent {
|
|
16
|
+
for (const child of this.children) {
|
|
17
|
+
if (child.name === childName) {
|
|
18
|
+
return child;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
abstract isMulti(): boolean;
|
|
25
|
+
abstract isMultiPage(): boolean;
|
|
26
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import {MultiInfo} from '../info/multi-info.model';
|
|
2
|
+
import {ElementComponent} from '../component/element-component.model';
|
|
3
|
+
import {MultiComponent} from '../component/multi-component.model';
|
|
4
|
+
import {AbstractElementComponent} from './abstract-element-component.model';
|
|
5
|
+
|
|
6
|
+
export class MultiElementComponent extends AbstractElementComponent implements ElementComponent, MultiComponent {
|
|
7
|
+
|
|
8
|
+
className = 'MultiElementComponent';
|
|
9
|
+
multiInfo: MultiInfo = new MultiInfo();
|
|
10
|
+
|
|
11
|
+
isMulti(): boolean {
|
|
12
|
+
return true;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
isMultiPage(): boolean {
|
|
16
|
+
return true;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import {ElementComponent} from '../component/element-component.model';
|
|
2
|
+
import {SingleComponent} from '../component/single-component.model';
|
|
3
|
+
import {AbstractElementComponent} from './abstract-element-component.model';
|
|
4
|
+
|
|
5
|
+
export class SingleElementComponent extends AbstractElementComponent implements SingleComponent, ElementComponent {
|
|
6
|
+
|
|
7
|
+
className = 'SingleElementComponent';
|
|
8
|
+
|
|
9
|
+
isMulti(): boolean {
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
isMultiPage(): boolean {
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import {FieldComponent} from '../component/field-component.model';
|
|
2
|
+
import {BasicInfo} from '../info/basic-info.model';
|
|
3
|
+
import {ValueInfo} from '../info/value-info.model';
|
|
4
|
+
import {NumberInfo} from '../info/number-info.model';
|
|
5
|
+
import {ChoiceInfo} from '../info/choice-info.model';
|
|
6
|
+
import {LabelInfo} from '../info/label-info.model';
|
|
7
|
+
import {StaticFieldComponent} from '../static/static-field-component.model';
|
|
8
|
+
import {ControlledInfo} from '../info/controlled-info.model';
|
|
9
|
+
import {MultiInfo} from '../info/multi-info.model';
|
|
10
|
+
|
|
11
|
+
export abstract class AbstractFieldComponent implements FieldComponent {
|
|
12
|
+
|
|
13
|
+
className = 'AbstractFieldComponent';
|
|
14
|
+
name: string;
|
|
15
|
+
path: string[];
|
|
16
|
+
basicInfo: BasicInfo = new BasicInfo();
|
|
17
|
+
valueInfo: ValueInfo = new ValueInfo();
|
|
18
|
+
numberInfo: NumberInfo = new NumberInfo();
|
|
19
|
+
choiceInfo: ChoiceInfo = new ChoiceInfo();
|
|
20
|
+
labelInfo: LabelInfo = new LabelInfo();
|
|
21
|
+
linkedStaticFieldComponent: StaticFieldComponent = null;
|
|
22
|
+
controlledInfo: ControlledInfo = new ControlledInfo();
|
|
23
|
+
multiInfo: MultiInfo = new MultiInfo();
|
|
24
|
+
|
|
25
|
+
abstract isMulti(): boolean;
|
|
26
|
+
abstract isMultiPage(): boolean;
|
|
27
|
+
|
|
28
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import {FieldComponent} from '../component/field-component.model';
|
|
2
|
+
import {MultiComponent} from '../component/multi-component.model';
|
|
3
|
+
import {MultiInfo} from '../info/multi-info.model';
|
|
4
|
+
import {AbstractFieldComponent} from './abstract-field-component.model';
|
|
5
|
+
import {InputType} from '../input-type.model';
|
|
6
|
+
|
|
7
|
+
export class MultiFieldComponent extends AbstractFieldComponent implements MultiComponent, FieldComponent {
|
|
8
|
+
|
|
9
|
+
className = 'MultiFieldComponent';
|
|
10
|
+
multiInfo: MultiInfo = new MultiInfo();
|
|
11
|
+
|
|
12
|
+
isMulti(): boolean {
|
|
13
|
+
return true;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
isMultiPage(): boolean {
|
|
17
|
+
const inputType = this.basicInfo.inputType;
|
|
18
|
+
return !(inputType === InputType.checkbox || inputType === InputType.list);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import {FieldComponent} from '../component/field-component.model';
|
|
2
|
+
import {SingleComponent} from '../component/single-component.model';
|
|
3
|
+
import {AbstractFieldComponent} from './abstract-field-component.model';
|
|
4
|
+
import {InputType} from '../input-type.model';
|
|
5
|
+
|
|
6
|
+
export class SingleFieldComponent extends AbstractFieldComponent implements SingleComponent, FieldComponent {
|
|
7
|
+
|
|
8
|
+
className = 'SingleFieldComponent';
|
|
9
|
+
|
|
10
|
+
isMulti(): boolean {
|
|
11
|
+
return false;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
isMultiPage(): boolean {
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
}
|