@sap/ux-ui5-tooling 1.20.4 → 1.22.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/CHANGELOG.md +60 -0
- package/dist/adp-tooling/templates/cf/_gitignore +6 -0
- package/dist/adp-tooling/templates/cf/approuter/package.json +13 -0
- package/dist/adp-tooling/templates/cf/approuter/xs-app.json +15 -0
- package/dist/adp-tooling/templates/cf/i18n/i18n.properties +3 -0
- package/dist/adp-tooling/templates/cf/package.json +35 -0
- package/dist/adp-tooling/templates/cf/ui5.yaml +5 -0
- package/dist/adp-tooling/templates/cf/xs-security.json +7 -0
- package/dist/adp-tooling/templates/changes/annotation.xml +18 -0
- package/dist/adp-tooling/templates/project/gitignore.tmpl +5 -0
- package/dist/adp-tooling/templates/project/package.json +31 -0
- package/dist/adp-tooling/templates/project/ui5.yaml +6 -0
- package/dist/adp-tooling/templates/project/webapp/i18n/i18n.properties +6 -0
- package/dist/adp-tooling/templates/project/webapp/manifest.appdescr_variant +10 -0
- package/dist/adp-tooling/templates/rta/common/analytical-custom-column.xml +25 -0
- package/dist/adp-tooling/templates/rta/common/custom-action.xml +8 -0
- package/dist/adp-tooling/templates/rta/common/grid-tree-custom-column.xml +22 -0
- package/dist/adp-tooling/templates/rta/common/header-field.xml +13 -0
- package/dist/adp-tooling/templates/rta/common/op-custom-section.xml +20 -0
- package/dist/adp-tooling/templates/rta/common/v4-table-action.xml +8 -0
- package/dist/adp-tooling/templates/rta/controller.ejs +80 -0
- package/dist/adp-tooling/templates/rta/fragment.xml +7 -0
- package/dist/adp-tooling/templates/rta/ts-controller.ejs +18 -0
- package/dist/adp-tooling/templates/rta/v2/m-table-custom-column-cell.xml +7 -0
- package/dist/adp-tooling/templates/rta/v2/m-table-custom-column.xml +18 -0
- package/dist/adp-tooling/templates/rta/v4/custom-section.xml +12 -0
- package/dist/adp-tooling/templates/rta/v4/mdc-custom-column-config.xml +6 -0
- package/dist/adp-tooling/templates/rta/v4/mdc-custom-column.xml +11 -0
- package/dist/adp-tooling/templates/typescript/tsconfig.json +19 -0
- package/dist/cli/index.js +17761 -11603
- package/dist/control-property-editor/app.css +2 -0
- package/dist/control-property-editor/app.js +175 -0
- package/dist/livereload-js/livereload.js +3795 -0
- package/dist/middlewares/fiori-tools-appreload.js +44007 -41669
- package/dist/middlewares/fiori-tools-preview.js +66889 -4176
- package/dist/middlewares/fiori-tools-proxy.js +38049 -5767
- package/dist/middlewares/fiori-tools-servestatic.js +32893 -347
- package/dist/preview-middleware/dist/client/adp/add-fragment.js +48 -0
- package/dist/preview-middleware/dist/client/adp/add-fragment.ts +51 -0
- package/dist/preview-middleware/dist/client/adp/api-handler.js +165 -0
- package/dist/preview-middleware/dist/client/adp/api-handler.ts +191 -0
- package/dist/preview-middleware/dist/client/adp/command-executor.js +100 -0
- package/dist/preview-middleware/dist/client/adp/command-executor.ts +105 -0
- package/dist/preview-middleware/dist/client/adp/control-utils.js +46 -0
- package/dist/preview-middleware/dist/client/adp/control-utils.ts +48 -0
- package/dist/preview-middleware/dist/client/adp/controllers/AddActionFragment.controller.js +198 -0
- package/dist/preview-middleware/dist/client/adp/controllers/AddActionFragment.controller.ts +232 -0
- package/dist/preview-middleware/dist/client/adp/controllers/AddCustomFragment.controller.js +223 -0
- package/dist/preview-middleware/dist/client/adp/controllers/AddCustomFragment.controller.ts +257 -0
- package/dist/preview-middleware/dist/client/adp/controllers/AddFragment.controller.js +195 -0
- package/dist/preview-middleware/dist/client/adp/controllers/AddFragment.controller.ts +264 -0
- package/dist/preview-middleware/dist/client/adp/controllers/AddSubpage.controller.js +146 -0
- package/dist/preview-middleware/dist/client/adp/controllers/AddSubpage.controller.ts +209 -0
- package/dist/preview-middleware/dist/client/adp/controllers/AddTableColumnFragments.controller.js +232 -0
- package/dist/preview-middleware/dist/client/adp/controllers/AddTableColumnFragments.controller.ts +306 -0
- package/dist/preview-middleware/dist/client/adp/controllers/BaseDialog.controller.js +187 -0
- package/dist/preview-middleware/dist/client/adp/controllers/BaseDialog.controller.ts +254 -0
- package/dist/preview-middleware/dist/client/adp/controllers/ControllerExtension.controller.js +330 -0
- package/dist/preview-middleware/dist/client/adp/controllers/ControllerExtension.controller.ts +408 -0
- package/dist/preview-middleware/dist/client/adp/controllers/ExtensionPoint.controller.js +160 -0
- package/dist/preview-middleware/dist/client/adp/controllers/ExtensionPoint.controller.ts +195 -0
- package/dist/preview-middleware/dist/client/adp/controllers/FileExistsDialog.controller.js +68 -0
- package/dist/preview-middleware/dist/client/adp/controllers/FileExistsDialog.controller.ts +86 -0
- package/dist/preview-middleware/dist/client/adp/controllers/types.js +2 -0
- package/dist/preview-middleware/dist/client/adp/controllers/types.ts +10 -0
- package/dist/preview-middleware/dist/client/adp/dialog-factory.js +151 -0
- package/dist/preview-middleware/dist/client/adp/dialog-factory.ts +210 -0
- package/dist/preview-middleware/dist/client/adp/extend-controller.js +48 -0
- package/dist/preview-middleware/dist/client/adp/extend-controller.ts +49 -0
- package/dist/preview-middleware/dist/client/adp/extension-point.js +83 -0
- package/dist/preview-middleware/dist/client/adp/extension-point.ts +116 -0
- package/dist/preview-middleware/dist/client/adp/init-dialogs.js +142 -0
- package/dist/preview-middleware/dist/client/adp/init-dialogs.ts +178 -0
- package/dist/preview-middleware/dist/client/adp/init.js +111 -0
- package/dist/preview-middleware/dist/client/adp/init.ts +92 -0
- package/dist/preview-middleware/dist/client/adp/ovp-window-functions.js +130 -0
- package/dist/preview-middleware/dist/client/adp/ovp-window-functions.ts +171 -0
- package/dist/preview-middleware/dist/client/adp/quick-actions/add-new-subpage-quick-action-base.js +97 -0
- package/dist/preview-middleware/dist/client/adp/quick-actions/add-new-subpage-quick-action-base.ts +140 -0
- package/dist/preview-middleware/dist/client/adp/quick-actions/common/add-controller-to-page.js +74 -0
- package/dist/preview-middleware/dist/client/adp/quick-actions/common/add-controller-to-page.ts +92 -0
- package/dist/preview-middleware/dist/client/adp/quick-actions/common/add-new-annotation-file.js +171 -0
- package/dist/preview-middleware/dist/client/adp/quick-actions/common/add-new-annotation-file.ts +174 -0
- package/dist/preview-middleware/dist/client/adp/quick-actions/common/create-page-action.js +56 -0
- package/dist/preview-middleware/dist/client/adp/quick-actions/common/create-page-action.ts +56 -0
- package/dist/preview-middleware/dist/client/adp/quick-actions/common/op-add-custom-section.js +41 -0
- package/dist/preview-middleware/dist/client/adp/quick-actions/common/op-add-custom-section.ts +51 -0
- package/dist/preview-middleware/dist/client/adp/quick-actions/common/op-add-header-field.js +69 -0
- package/dist/preview-middleware/dist/client/adp/quick-actions/common/op-add-header-field.ts +81 -0
- package/dist/preview-middleware/dist/client/adp/quick-actions/common/utils.js +20 -0
- package/dist/preview-middleware/dist/client/adp/quick-actions/common/utils.ts +7 -0
- package/dist/preview-middleware/dist/client/adp/quick-actions/control-types.js +25 -0
- package/dist/preview-middleware/dist/client/adp/quick-actions/control-types.ts +7 -0
- package/dist/preview-middleware/dist/client/adp/quick-actions/dialog-enablement-validator.js +26 -0
- package/dist/preview-middleware/dist/client/adp/quick-actions/dialog-enablement-validator.ts +18 -0
- package/dist/preview-middleware/dist/client/adp/quick-actions/enablement-validator.js +2 -0
- package/dist/preview-middleware/dist/client/adp/quick-actions/enablement-validator.ts +19 -0
- package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v2/add-new-subpage.js +82 -0
- package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v2/add-new-subpage.ts +87 -0
- package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v2/change-table-actions.js +69 -0
- package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v2/change-table-actions.ts +71 -0
- package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v2/change-table-columns.js +103 -0
- package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v2/change-table-columns.ts +105 -0
- package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v2/create-table-action.js +111 -0
- package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v2/create-table-action.ts +110 -0
- package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v2/create-table-custom-column.js +108 -0
- package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v2/create-table-custom-column.ts +141 -0
- package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v2/lr-enable-semantic-date-range-filter-bar.js +80 -0
- package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v2/lr-enable-semantic-date-range-filter-bar.ts +93 -0
- package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v2/lr-enable-table-filtering.js +79 -0
- package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v2/lr-enable-table-filtering.ts +102 -0
- package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v2/lr-enable-variant-management.js +71 -0
- package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v2/lr-enable-variant-management.ts +98 -0
- package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v2/lr-toggle-clear-filter-bar.js +61 -0
- package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v2/lr-toggle-clear-filter-bar.ts +77 -0
- package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v2/op-enable-empty-row-mode.js +95 -0
- package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v2/op-enable-empty-row-mode.ts +102 -0
- package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v2/op-enable-variant-management.js +86 -0
- package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v2/op-enable-variant-management.ts +116 -0
- package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v2/registry.js +79 -0
- package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v2/registry.ts +121 -0
- package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v2/utils.js +138 -0
- package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v2/utils.ts +134 -0
- package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v4/add-new-subpage.js +140 -0
- package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v4/add-new-subpage.ts +181 -0
- package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v4/change-table-actions.js +81 -0
- package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v4/change-table-actions.ts +81 -0
- package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v4/change-table-columns.js +90 -0
- package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v4/change-table-columns.ts +97 -0
- package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v4/create-page-action.js +81 -0
- package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v4/create-page-action.ts +98 -0
- package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v4/create-table-action-config-change.js +129 -0
- package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v4/create-table-action-config-change.ts +149 -0
- package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v4/create-table-custom-column-config-change.js +142 -0
- package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v4/create-table-custom-column-config-change.ts +178 -0
- package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v4/enable-variant-management.js +83 -0
- package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v4/enable-variant-management.ts +96 -0
- package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v4/lr-enable-semantic-date-range-filter-bar.js +58 -0
- package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v4/lr-enable-semantic-date-range-filter-bar.ts +70 -0
- package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v4/lr-enable-table-filtering.js +86 -0
- package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v4/lr-enable-table-filtering.ts +96 -0
- package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v4/lr-toggle-clear-filter-bar.js +55 -0
- package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v4/lr-toggle-clear-filter-bar.ts +61 -0
- package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v4/op-add-custom-section.js +73 -0
- package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v4/op-add-custom-section.ts +91 -0
- package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v4/op-enable-empty-row-mode.js +91 -0
- package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v4/op-enable-empty-row-mode.ts +88 -0
- package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v4/registry.js +62 -0
- package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v4/registry.ts +86 -0
- package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v4/utils.js +158 -0
- package/dist/preview-middleware/dist/client/adp/quick-actions/fe-v4/utils.ts +175 -0
- package/dist/preview-middleware/dist/client/adp/quick-actions/load.js +46 -0
- package/dist/preview-middleware/dist/client/adp/quick-actions/load.ts +23 -0
- package/dist/preview-middleware/dist/client/adp/quick-actions/quick-action-base.js +64 -0
- package/dist/preview-middleware/dist/client/adp/quick-actions/quick-action-base.ts +71 -0
- package/dist/preview-middleware/dist/client/adp/quick-actions/simple-quick-action-base.js +44 -0
- package/dist/preview-middleware/dist/client/adp/quick-actions/simple-quick-action-base.ts +51 -0
- package/dist/preview-middleware/dist/client/adp/quick-actions/supported-ui5versions.md +40 -0
- package/dist/preview-middleware/dist/client/adp/quick-actions/table-quick-action-base.js +372 -0
- package/dist/preview-middleware/dist/client/adp/quick-actions/table-quick-action-base.ts +433 -0
- package/dist/preview-middleware/dist/client/adp/sync-views-utils.js +123 -0
- package/dist/preview-middleware/dist/client/adp/sync-views-utils.ts +90 -0
- package/dist/preview-middleware/dist/client/adp/ui/AddAction.fragment.xml +49 -0
- package/dist/preview-middleware/dist/client/adp/ui/AddCustomFragment.fragment.xml +48 -0
- package/dist/preview-middleware/dist/client/adp/ui/AddFragment.fragment.xml +83 -0
- package/dist/preview-middleware/dist/client/adp/ui/AddSubpage.fragment.xml +73 -0
- package/dist/preview-middleware/dist/client/adp/ui/AddTableColumnFragments.fragment.xml +63 -0
- package/dist/preview-middleware/dist/client/adp/ui/ControllerExtension.fragment.xml +63 -0
- package/dist/preview-middleware/dist/client/adp/ui/ExtensionPoint.fragment.xml +61 -0
- package/dist/preview-middleware/dist/client/adp/ui/FileExistsDialog.fragment.xml +43 -0
- package/dist/preview-middleware/dist/client/adp/utils.js +199 -0
- package/dist/preview-middleware/dist/client/adp/utils.ts +200 -0
- package/dist/preview-middleware/dist/client/cpe/additional-change-info/add-xml-additional-info.js +85 -0
- package/dist/preview-middleware/dist/client/cpe/additional-change-info/add-xml-additional-info.ts +107 -0
- package/dist/preview-middleware/dist/client/cpe/changes/flex-change.js +66 -0
- package/dist/preview-middleware/dist/client/cpe/changes/flex-change.ts +66 -0
- package/dist/preview-middleware/dist/client/cpe/changes/generic-change.js +321 -0
- package/dist/preview-middleware/dist/client/cpe/changes/generic-change.ts +462 -0
- package/dist/preview-middleware/dist/client/cpe/changes/index.js +12 -0
- package/dist/preview-middleware/dist/client/cpe/changes/index.ts +1 -0
- package/dist/preview-middleware/dist/client/cpe/changes/service.js +527 -0
- package/dist/preview-middleware/dist/client/cpe/changes/service.ts +595 -0
- package/dist/preview-middleware/dist/client/cpe/changes/validator.js +41 -0
- package/dist/preview-middleware/dist/client/cpe/changes/validator.ts +35 -0
- package/dist/preview-middleware/dist/client/cpe/communication-service.js +44 -0
- package/dist/preview-middleware/dist/client/cpe/communication-service.ts +41 -0
- package/dist/preview-middleware/dist/client/cpe/connector-service.js +88 -0
- package/dist/preview-middleware/dist/client/cpe/connector-service.ts +74 -0
- package/dist/preview-middleware/dist/client/cpe/context-menu-service.js +90 -0
- package/dist/preview-middleware/dist/client/cpe/context-menu-service.ts +77 -0
- package/dist/preview-middleware/dist/client/cpe/control-data.js +366 -0
- package/dist/preview-middleware/dist/client/cpe/control-data.ts +400 -0
- package/dist/preview-middleware/dist/client/cpe/documentation.js +191 -0
- package/dist/preview-middleware/dist/client/cpe/documentation.ts +187 -0
- package/dist/preview-middleware/dist/client/cpe/feature-service.js +39 -0
- package/dist/preview-middleware/dist/client/cpe/feature-service.ts +25 -0
- package/dist/preview-middleware/dist/client/cpe/init.js +92 -0
- package/dist/preview-middleware/dist/client/cpe/init.ts +114 -0
- package/dist/preview-middleware/dist/client/cpe/logger.js +32 -0
- package/dist/preview-middleware/dist/client/cpe/logger.ts +24 -0
- package/dist/preview-middleware/dist/client/cpe/odata-health/odata-health-checker.js +136 -0
- package/dist/preview-middleware/dist/client/cpe/odata-health/odata-health-checker.ts +160 -0
- package/dist/preview-middleware/dist/client/cpe/odata-health/odata-health-status.js +63 -0
- package/dist/preview-middleware/dist/client/cpe/odata-health/odata-health-status.ts +52 -0
- package/dist/preview-middleware/dist/client/cpe/outline/editable.js +38 -0
- package/dist/preview-middleware/dist/client/cpe/outline/editable.ts +30 -0
- package/dist/preview-middleware/dist/client/cpe/outline/nodes.js +212 -0
- package/dist/preview-middleware/dist/client/cpe/outline/nodes.ts +236 -0
- package/dist/preview-middleware/dist/client/cpe/outline/service.js +62 -0
- package/dist/preview-middleware/dist/client/cpe/outline/service.ts +66 -0
- package/dist/preview-middleware/dist/client/cpe/quick-actions/quick-action-service.js +161 -0
- package/dist/preview-middleware/dist/client/cpe/quick-actions/quick-action-service.ts +184 -0
- package/dist/preview-middleware/dist/client/cpe/quick-actions/registry.js +145 -0
- package/dist/preview-middleware/dist/client/cpe/quick-actions/registry.ts +157 -0
- package/dist/preview-middleware/dist/client/cpe/quick-actions/utils.js +94 -0
- package/dist/preview-middleware/dist/client/cpe/quick-actions/utils.ts +113 -0
- package/dist/preview-middleware/dist/client/cpe/rta-service.js +94 -0
- package/dist/preview-middleware/dist/client/cpe/rta-service.ts +86 -0
- package/dist/preview-middleware/dist/client/cpe/selection.js +249 -0
- package/dist/preview-middleware/dist/client/cpe/selection.ts +267 -0
- package/dist/preview-middleware/dist/client/cpe/ui5-utils.js +35 -0
- package/dist/preview-middleware/dist/client/cpe/ui5-utils.ts +28 -0
- package/dist/preview-middleware/dist/client/cpe/utils.js +113 -0
- package/dist/preview-middleware/dist/client/cpe/utils.ts +162 -0
- package/dist/preview-middleware/dist/client/flp/WorkspaceConnector.js +97 -0
- package/dist/preview-middleware/dist/client/flp/WorkspaceConnector.ts +101 -0
- package/dist/preview-middleware/dist/client/flp/common.js +30 -0
- package/dist/preview-middleware/dist/client/flp/common.ts +28 -0
- package/dist/preview-middleware/dist/client/flp/enableFakeConnector.js +92 -0
- package/dist/preview-middleware/dist/client/flp/enableFakeConnector.ts +113 -0
- package/dist/preview-middleware/dist/client/flp/homepage/Component.js +16 -0
- package/dist/preview-middleware/dist/client/flp/homepage/Component.ts +10 -0
- package/dist/preview-middleware/dist/client/flp/homepage/controller/MyHome.controller.js +54 -0
- package/dist/preview-middleware/dist/client/flp/homepage/controller/MyHome.controller.ts +41 -0
- package/dist/preview-middleware/dist/client/flp/homepage/css/style.css +3 -0
- package/dist/preview-middleware/dist/client/flp/homepage/manifest.json +41 -0
- package/dist/preview-middleware/dist/client/flp/homepage/view/MyHome.view.xml +18 -0
- package/dist/preview-middleware/dist/client/flp/init.js +418 -0
- package/dist/preview-middleware/dist/client/flp/init.ts +448 -0
- package/dist/preview-middleware/dist/client/flp/initCdm.js +117 -0
- package/dist/preview-middleware/dist/client/flp/initCdm.ts +111 -0
- package/dist/preview-middleware/dist/client/flp/initConnectors.js +31 -0
- package/dist/preview-middleware/dist/client/flp/initConnectors.ts +20 -0
- package/dist/preview-middleware/dist/client/flp/initRta.js +180 -0
- package/dist/preview-middleware/dist/client/flp/initRta.ts +194 -0
- package/dist/preview-middleware/dist/client/i18n.js +56 -0
- package/dist/preview-middleware/dist/client/i18n.ts +49 -0
- package/dist/preview-middleware/dist/client/manifest.json +8 -0
- package/dist/preview-middleware/dist/client/messagebundle.properties +143 -0
- package/dist/preview-middleware/dist/client/thirdparty/@sap-ux-private/control-property-editor-common.js +486 -0
- package/dist/preview-middleware/dist/client/utils/additional-change-info.js +69 -0
- package/dist/preview-middleware/dist/client/utils/additional-change-info.ts +73 -0
- package/dist/preview-middleware/dist/client/utils/application.js +34 -0
- package/dist/preview-middleware/dist/client/utils/application.ts +27 -0
- package/dist/preview-middleware/dist/client/utils/core.js +144 -0
- package/dist/preview-middleware/dist/client/utils/core.ts +145 -0
- package/dist/preview-middleware/dist/client/utils/error.js +28 -0
- package/dist/preview-middleware/dist/client/utils/error.ts +18 -0
- package/dist/preview-middleware/dist/client/utils/fe-v2.js +58 -0
- package/dist/preview-middleware/dist/client/utils/fe-v2.ts +61 -0
- package/dist/preview-middleware/dist/client/utils/fe-v4.js +168 -0
- package/dist/preview-middleware/dist/client/utils/fe-v4.ts +186 -0
- package/dist/preview-middleware/dist/client/utils/info-center-message.js +60 -0
- package/dist/preview-middleware/dist/client/utils/info-center-message.ts +60 -0
- package/dist/preview-middleware/dist/client/utils/version.js +126 -0
- package/dist/preview-middleware/dist/client/utils/version.ts +138 -0
- package/dist/preview-middleware/templates/flp/cdm.base.json +47 -0
- package/dist/preview-middleware/templates/flp/cdm.ejs +72 -0
- package/dist/preview-middleware/templates/flp/editor.ejs +28 -0
- package/dist/preview-middleware/templates/flp/sandbox.ejs +88 -0
- package/dist/preview-middleware/templates/flp/sandbox2.ejs +86 -0
- package/dist/preview-middleware/templates/test/qunit.ejs +26 -0
- package/dist/preview-middleware/templates/test/qunit.js +29 -0
- package/dist/preview-middleware/templates/test/testsuite.qunit.ejs +10 -0
- package/dist/preview-middleware/templates/test/testsuite.qunit.js +8 -0
- package/dist/tasks/cf-deploy/index.js +3916 -3521
- package/dist/tasks/deploy/index.js +17204 -11133
- package/package.json +36 -39
- package/prebuilds/keyring.darwin-arm64.node +0 -0
- package/prebuilds/keyring.darwin-x64.node +0 -0
- package/prebuilds/keyring.linux-arm-gnueabihf.node +0 -0
- package/prebuilds/keyring.linux-arm64-gnu.node +0 -0
- package/prebuilds/keyring.linux-arm64-musl.node +0 -0
- package/prebuilds/keyring.linux-ia32-gnu.node +0 -0
- package/prebuilds/keyring.linux-x64-gnu.node +0 -0
- package/prebuilds/keyring.linux-x64-musl.node +0 -0
- package/prebuilds/keyring.win32-arm64-msvc.node +0 -0
- package/prebuilds/keyring.win32-ia32-msvc.node +0 -0
- package/prebuilds/keyring.win32-x64-msvc.node +0 -0
|
@@ -0,0 +1,400 @@
|
|
|
1
|
+
import type { Control, ControlProperty } from '@sap-ux-private/control-property-editor-common';
|
|
2
|
+
import {
|
|
3
|
+
BOOLEAN_VALUE_TYPE,
|
|
4
|
+
CHECKBOX_EDITOR_TYPE,
|
|
5
|
+
DROPDOWN_EDITOR_TYPE,
|
|
6
|
+
FLOAT_VALUE_TYPE,
|
|
7
|
+
INPUT_EDITOR_TYPE,
|
|
8
|
+
INTEGER_VALUE_TYPE,
|
|
9
|
+
PropertyType,
|
|
10
|
+
STRING_VALUE_TYPE,
|
|
11
|
+
convertCamelCaseToPascalCase
|
|
12
|
+
} from '@sap-ux-private/control-property-editor-common';
|
|
13
|
+
|
|
14
|
+
import Utils from 'sap/ui/fl/Utils';
|
|
15
|
+
import type ManagedObject from 'sap/ui/base/ManagedObject';
|
|
16
|
+
import type ElementOverlay from 'sap/ui/dt/ElementOverlay';
|
|
17
|
+
import type { MergedSetting, ManagedObjectMetadataProperties } from './utils';
|
|
18
|
+
import { getManifestProperties } from './utils';
|
|
19
|
+
import type { UI5ControlProperty } from './types';
|
|
20
|
+
import DataType from 'sap/ui/base/DataType';
|
|
21
|
+
import { getV4PageType } from '../utils/fe-v4';
|
|
22
|
+
import type { ChangeService } from './changes';
|
|
23
|
+
import type { TemplateType } from 'sap/ui/dt/DesignTimeMetadata';
|
|
24
|
+
|
|
25
|
+
type AnalyzedType = Pick<UI5ControlProperty, 'isArray' | 'primitiveType' | 'ui5Type' | 'enumValues'>;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* A property is disabled if it is an array or the type is 'any'
|
|
29
|
+
* - since we currently don't have a good editor for it Otherwise, it is enabled.
|
|
30
|
+
*
|
|
31
|
+
* @param analyzedType - analyzed property type
|
|
32
|
+
* @returns boolean
|
|
33
|
+
*/
|
|
34
|
+
function isPropertyEnabled(analyzedType: AnalyzedType): boolean {
|
|
35
|
+
return !(analyzedType.isArray || analyzedType.primitiveType === 'any');
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Return if a control is enabled or not.
|
|
40
|
+
*
|
|
41
|
+
* @param analyzedType - analyzed property type
|
|
42
|
+
* @param hasStableId - given control has stable id.
|
|
43
|
+
* @param ignore - property that is ignored during design time
|
|
44
|
+
* @param controlOverlay - element overlay
|
|
45
|
+
* @returns boolean
|
|
46
|
+
*/
|
|
47
|
+
function isControlEnabled(
|
|
48
|
+
analyzedType: AnalyzedType,
|
|
49
|
+
hasStableId: boolean,
|
|
50
|
+
ignore: boolean,
|
|
51
|
+
controlOverlay?: ElementOverlay
|
|
52
|
+
): boolean {
|
|
53
|
+
return (controlOverlay?.isSelectable() ?? false) && isPropertyEnabled(analyzedType) && hasStableId && !ignore;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Match 'src' or any string starting or ending with 'icon' (case insensitive;).
|
|
58
|
+
*
|
|
59
|
+
* @param name icon name
|
|
60
|
+
* @returns boolean
|
|
61
|
+
*/
|
|
62
|
+
function testIconPattern(name: string): boolean {
|
|
63
|
+
// replace `/src|.*icon$|^icon.*/i`.test(property.name);
|
|
64
|
+
// match 'src' or any string starting or ending with 'icon' (case insensitive;)
|
|
65
|
+
const nameLc = (name || '').toLowerCase();
|
|
66
|
+
return nameLc.indexOf('src') >= 0 || nameLc.startsWith('icon') || nameLc.endsWith('icon');
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Analyze property type string | boolean | enum.
|
|
71
|
+
*
|
|
72
|
+
* @param property control property
|
|
73
|
+
* @returns AnalyzedType|undefined
|
|
74
|
+
*/
|
|
75
|
+
function analyzePropertyType(property: ManagedObjectMetadataProperties): AnalyzedType | undefined {
|
|
76
|
+
const analyzedType: AnalyzedType = {
|
|
77
|
+
primitiveType: 'any',
|
|
78
|
+
ui5Type: null,
|
|
79
|
+
enumValues: undefined,
|
|
80
|
+
isArray: false
|
|
81
|
+
};
|
|
82
|
+
const propertyType = property?.getType();
|
|
83
|
+
const typeName = propertyType?.getName();
|
|
84
|
+
|
|
85
|
+
if (!property || !propertyType || !typeName) {
|
|
86
|
+
return undefined;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// Check if array and determine property type (or component type)
|
|
90
|
+
if (typeName.indexOf('[]') > 0) {
|
|
91
|
+
analyzedType.primitiveType = typeName.substring(0, typeName.indexOf('[]'));
|
|
92
|
+
analyzedType.isArray = true;
|
|
93
|
+
}
|
|
94
|
+
// Return if object or void type
|
|
95
|
+
else if (['object', 'void', 'any'].includes(typeName)) {
|
|
96
|
+
analyzedType.primitiveType = typeName;
|
|
97
|
+
}
|
|
98
|
+
// Type of control property is an elementary simple type
|
|
99
|
+
else if (['boolean', 'string', 'int', 'float'].includes(typeName)) {
|
|
100
|
+
analyzedType.primitiveType = typeName;
|
|
101
|
+
}
|
|
102
|
+
// Control type is a sap.ui.base.DataType or an enumeration type
|
|
103
|
+
else {
|
|
104
|
+
// Determine type from iFrame
|
|
105
|
+
const propertyDataType = DataType.getType(typeName);
|
|
106
|
+
|
|
107
|
+
// type which is not a DataType such as Control is not supported
|
|
108
|
+
if (propertyDataType && !(propertyDataType instanceof DataType)) {
|
|
109
|
+
return analyzedType;
|
|
110
|
+
}
|
|
111
|
+
// enum values are created differently and use DataType as prototype, which only has stubs for instance functions -> getName returns undefined
|
|
112
|
+
// array and base types also return undefined, but we have already handled those above
|
|
113
|
+
// https://github.com/SAP/openui5/blob/203ce22763a76e28b7a422f6c635a42480f733f1/src/sap.ui.core/src/sap/ui/base/DataType.js#L430
|
|
114
|
+
|
|
115
|
+
const name = (Object.getPrototypeOf(propertyDataType) as DataType).getName();
|
|
116
|
+
if (!name) {
|
|
117
|
+
analyzedType.primitiveType = 'enum';
|
|
118
|
+
} else {
|
|
119
|
+
analyzedType.primitiveType = name;
|
|
120
|
+
}
|
|
121
|
+
analyzedType.ui5Type = typeName;
|
|
122
|
+
|
|
123
|
+
// Determine base type for SAP types
|
|
124
|
+
if (analyzedType.primitiveType === 'enum' && typeof propertyDataType?.getEnumValues === 'function') {
|
|
125
|
+
analyzedType.enumValues = propertyDataType.getEnumValues();
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
return analyzedType;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
function analyzeManifestProperty(property: MergedSetting): AnalyzedType | undefined {
|
|
133
|
+
const analyzedType: AnalyzedType = {
|
|
134
|
+
primitiveType: 'any',
|
|
135
|
+
ui5Type: null,
|
|
136
|
+
enumValues: undefined,
|
|
137
|
+
isArray: false
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
const propertyType = property.type;
|
|
141
|
+
|
|
142
|
+
if (!propertyType) {
|
|
143
|
+
return undefined;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
if (['boolean', 'string', 'int', 'float'].includes(propertyType)) {
|
|
147
|
+
analyzedType.primitiveType = propertyType;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
if (property.enums) {
|
|
151
|
+
analyzedType.primitiveType = 'enum';
|
|
152
|
+
analyzedType.enumValues = property.enums.reduce<Record<string, string>>((acc, item) => {
|
|
153
|
+
acc[item.id] = item.name;
|
|
154
|
+
return acc;
|
|
155
|
+
}, {});
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
return analyzedType;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* If rawValue is anything except an object like {} or a function, return it as-is,
|
|
163
|
+
* If it is an object, stringify it.
|
|
164
|
+
* If it is a function, return empty string.
|
|
165
|
+
*
|
|
166
|
+
* @param rawValue property value
|
|
167
|
+
* @returns string
|
|
168
|
+
*/
|
|
169
|
+
function normalizeObjectPropertyValue(rawValue: unknown): unknown {
|
|
170
|
+
if (typeof rawValue === 'object' && rawValue instanceof Object && !Array.isArray(rawValue)) {
|
|
171
|
+
try {
|
|
172
|
+
return JSON.stringify(rawValue);
|
|
173
|
+
} catch (e) {
|
|
174
|
+
if (e instanceof Error && e.message.toLowerCase().includes('converting circular structure to json')) {
|
|
175
|
+
// some objects can be circular, e.g.:
|
|
176
|
+
// var obj = {
|
|
177
|
+
// key1: value,
|
|
178
|
+
// key2: obj
|
|
179
|
+
// }
|
|
180
|
+
// and JSON.stringify can't handle that so we reach here.
|
|
181
|
+
// however, postMessage can't handle that either, and throws:
|
|
182
|
+
// "Failed to execute 'postMessage' on 'Window': An object could not be cloned".
|
|
183
|
+
// so we need to check whether this is the failure and if so, don't return the rawValue,
|
|
184
|
+
// but some default string to act as the property value.
|
|
185
|
+
return '<Circular JSON cannot be displayed>';
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
return rawValue;
|
|
189
|
+
}
|
|
190
|
+
} else if (typeof rawValue === 'function') {
|
|
191
|
+
return '';
|
|
192
|
+
} else {
|
|
193
|
+
return rawValue;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
interface NewControlData {
|
|
198
|
+
id: string;
|
|
199
|
+
name: string;
|
|
200
|
+
newValue: unknown;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* Build control data.
|
|
205
|
+
*
|
|
206
|
+
* @param control - ui5 control
|
|
207
|
+
* @param changeService - Changeservice for change stack event handling.
|
|
208
|
+
* @param controlOverlay - element overlay
|
|
209
|
+
* @param includeDocumentation - include documentation flag
|
|
210
|
+
* @returns Promise<Control>
|
|
211
|
+
*/
|
|
212
|
+
export function buildControlData(
|
|
213
|
+
control: ManagedObject,
|
|
214
|
+
changeService: ChangeService,
|
|
215
|
+
controlOverlay?: ElementOverlay
|
|
216
|
+
): Control {
|
|
217
|
+
const controlMetadata = control.getMetadata();
|
|
218
|
+
const selectedControlName = controlMetadata.getName();
|
|
219
|
+
const hasStableId = Utils.checkControlId(control);
|
|
220
|
+
const overlayData = controlOverlay?.getDesignTimeMetadata().getData();
|
|
221
|
+
|
|
222
|
+
const controlProperties = controlOverlay ? overlayData?.properties : undefined;
|
|
223
|
+
const manifestProperties = getManifestProperties(control, changeService, controlOverlay);
|
|
224
|
+
// Add the control's properties/manifest properties
|
|
225
|
+
const allProperties = {
|
|
226
|
+
...(controlMetadata.getAllProperties() as unknown as {
|
|
227
|
+
[name: string]: ManagedObjectMetadataProperties;
|
|
228
|
+
}),
|
|
229
|
+
...manifestProperties
|
|
230
|
+
};
|
|
231
|
+
let propertyType;
|
|
232
|
+
const propertyNames = Object.keys(allProperties);
|
|
233
|
+
const properties: ControlProperty[] = [];
|
|
234
|
+
for (const propertyName of propertyNames) {
|
|
235
|
+
const property = allProperties[propertyName];
|
|
236
|
+
let analyzedType;
|
|
237
|
+
let isEnabled = false;
|
|
238
|
+
let value: unknown;
|
|
239
|
+
if (property && 'configuration' in property) {
|
|
240
|
+
propertyType = PropertyType.Configuration;
|
|
241
|
+
analyzedType = analyzeManifestProperty(property);
|
|
242
|
+
if (
|
|
243
|
+
!analyzedType ||
|
|
244
|
+
(property?.restrictedTo?.length &&
|
|
245
|
+
!property?.restrictedTo?.includes(getV4PageType(control) as TemplateType))
|
|
246
|
+
) {
|
|
247
|
+
continue;
|
|
248
|
+
}
|
|
249
|
+
isEnabled = true;
|
|
250
|
+
value = property.value;
|
|
251
|
+
} else {
|
|
252
|
+
propertyType = PropertyType.ControlProperty;
|
|
253
|
+
// the default behavior is that the property is enabled
|
|
254
|
+
// meaning it's not ignored during design time
|
|
255
|
+
analyzedType = analyzePropertyType(property);
|
|
256
|
+
if (!analyzedType) {
|
|
257
|
+
continue;
|
|
258
|
+
}
|
|
259
|
+
let ignore = false;
|
|
260
|
+
if (controlProperties?.[property.name]) {
|
|
261
|
+
// check whether the property should be ignored in design time or not
|
|
262
|
+
// if it's 'undefined' then it's not considered when building isEnabled because it's 'true'
|
|
263
|
+
ignore = controlProperties[property.name].ignore;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
//updating i18n text for the control if bindingInfo has bindingString
|
|
267
|
+
const controlNewData: NewControlData = {
|
|
268
|
+
id: control.getId(),
|
|
269
|
+
name: property.name,
|
|
270
|
+
newValue: control.getProperty(property.name)
|
|
271
|
+
};
|
|
272
|
+
const bindingInfo: { bindingString?: string } = control.getBindingInfo(controlNewData.name) as {
|
|
273
|
+
bindingString?: string;
|
|
274
|
+
};
|
|
275
|
+
if (bindingInfo?.bindingString !== undefined) {
|
|
276
|
+
controlNewData.newValue = bindingInfo.bindingString;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
// A property is enabled if:
|
|
280
|
+
// 1. The property supports changes
|
|
281
|
+
// 2. The control has stable ID
|
|
282
|
+
// 3. It is not configured to be ignored in design time
|
|
283
|
+
// 4. And control overlay is selectable
|
|
284
|
+
isEnabled = isControlEnabled(analyzedType, hasStableId, ignore, controlOverlay);
|
|
285
|
+
|
|
286
|
+
value = normalizeObjectPropertyValue(controlNewData.newValue);
|
|
287
|
+
}
|
|
288
|
+
const isIcon =
|
|
289
|
+
testIconPattern(property.name) &&
|
|
290
|
+
selectedControlName !== 'sap.m.Image' &&
|
|
291
|
+
analyzedType.ui5Type === 'sap.ui.core.URI';
|
|
292
|
+
const ui5Type = analyzedType.ui5Type || undefined;
|
|
293
|
+
const readableName = convertCamelCaseToPascalCase(property.name);
|
|
294
|
+
let docu:
|
|
295
|
+
| {
|
|
296
|
+
defaultValue: string;
|
|
297
|
+
description: string;
|
|
298
|
+
propertyName: string;
|
|
299
|
+
type?: string;
|
|
300
|
+
propertyType?: string;
|
|
301
|
+
}
|
|
302
|
+
| undefined;
|
|
303
|
+
if ('configuration' in property) {
|
|
304
|
+
const defValue = ['undefined', 'null'].includes(String(property.defaultValue))
|
|
305
|
+
? '-'
|
|
306
|
+
: String(property.defaultValue);
|
|
307
|
+
docu = {
|
|
308
|
+
description: property.description,
|
|
309
|
+
propertyName: property.id,
|
|
310
|
+
type: property.type,
|
|
311
|
+
defaultValue: defValue || '-'
|
|
312
|
+
};
|
|
313
|
+
}
|
|
314
|
+
switch (analyzedType.primitiveType) {
|
|
315
|
+
case 'enum': {
|
|
316
|
+
const values = analyzedType.enumValues ?? {};
|
|
317
|
+
const options: { key: string; text: string }[] = Object.keys(values).map((key) => ({
|
|
318
|
+
key,
|
|
319
|
+
text: values[key]
|
|
320
|
+
}));
|
|
321
|
+
properties.push({
|
|
322
|
+
type: STRING_VALUE_TYPE,
|
|
323
|
+
editor: DROPDOWN_EDITOR_TYPE,
|
|
324
|
+
propertyType,
|
|
325
|
+
name: property.name,
|
|
326
|
+
readableName,
|
|
327
|
+
value: value as string,
|
|
328
|
+
isEnabled,
|
|
329
|
+
ui5Type,
|
|
330
|
+
options,
|
|
331
|
+
...(docu && { documentation: docu })
|
|
332
|
+
});
|
|
333
|
+
break;
|
|
334
|
+
}
|
|
335
|
+
case 'string': {
|
|
336
|
+
properties.push({
|
|
337
|
+
type: STRING_VALUE_TYPE,
|
|
338
|
+
editor: INPUT_EDITOR_TYPE,
|
|
339
|
+
propertyType,
|
|
340
|
+
name: property.name,
|
|
341
|
+
readableName,
|
|
342
|
+
value: value as string,
|
|
343
|
+
isEnabled,
|
|
344
|
+
isIcon,
|
|
345
|
+
ui5Type,
|
|
346
|
+
...(docu && { documentation: docu })
|
|
347
|
+
});
|
|
348
|
+
break;
|
|
349
|
+
}
|
|
350
|
+
case 'int': {
|
|
351
|
+
properties.push({
|
|
352
|
+
type: INTEGER_VALUE_TYPE,
|
|
353
|
+
editor: INPUT_EDITOR_TYPE,
|
|
354
|
+
propertyType,
|
|
355
|
+
name: property.name,
|
|
356
|
+
readableName,
|
|
357
|
+
value: value as number,
|
|
358
|
+
isEnabled,
|
|
359
|
+
ui5Type,
|
|
360
|
+
...(docu && { documentation: docu })
|
|
361
|
+
});
|
|
362
|
+
break;
|
|
363
|
+
}
|
|
364
|
+
case 'float': {
|
|
365
|
+
properties.push({
|
|
366
|
+
type: FLOAT_VALUE_TYPE,
|
|
367
|
+
editor: INPUT_EDITOR_TYPE,
|
|
368
|
+
propertyType,
|
|
369
|
+
name: property.name,
|
|
370
|
+
readableName,
|
|
371
|
+
value: value as number,
|
|
372
|
+
isEnabled,
|
|
373
|
+
ui5Type,
|
|
374
|
+
...(docu && { documentation: docu })
|
|
375
|
+
});
|
|
376
|
+
break;
|
|
377
|
+
}
|
|
378
|
+
case 'boolean': {
|
|
379
|
+
properties.push({
|
|
380
|
+
type: BOOLEAN_VALUE_TYPE,
|
|
381
|
+
editor: CHECKBOX_EDITOR_TYPE,
|
|
382
|
+
propertyType,
|
|
383
|
+
name: property.name,
|
|
384
|
+
readableName,
|
|
385
|
+
value: value as boolean,
|
|
386
|
+
isEnabled,
|
|
387
|
+
ui5Type,
|
|
388
|
+
...(docu && { documentation: docu })
|
|
389
|
+
});
|
|
390
|
+
break;
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
return {
|
|
395
|
+
id: control.getId(), //the id of the underlying control/aggregation
|
|
396
|
+
type: selectedControlName, //the name of the ui5 class of the control/aggregation
|
|
397
|
+
properties: [...properties].sort((a, b) => (a.name > b.name ? 1 : -1)),
|
|
398
|
+
name: selectedControlName
|
|
399
|
+
};
|
|
400
|
+
}
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
sap.ui.define(["./utils", "sap/base/Log", "open/ux/preview/client/thirdparty/@sap-ux-private/control-property-editor-common", "../utils/info-center-message", "../utils/error"], function (___utils, Log, ___sap_ux_private_control_property_editor_common, ___utils_info_center_message, ___utils_error) {
|
|
4
|
+
"use strict";
|
|
5
|
+
|
|
6
|
+
const getLibrary = ___utils["getLibrary"];
|
|
7
|
+
const MessageBarType = ___sap_ux_private_control_property_editor_common["MessageBarType"];
|
|
8
|
+
const sendInfoCenterMessage = ___utils_info_center_message["sendInfoCenterMessage"];
|
|
9
|
+
const FetchError = ___utils_error["FetchError"];
|
|
10
|
+
/**
|
|
11
|
+
* Get ui5 metadata of given library name.
|
|
12
|
+
*
|
|
13
|
+
* @param libName library name for eg: sap.m
|
|
14
|
+
* @returns Promise<SchemaForApiJsonFiles>
|
|
15
|
+
*/
|
|
16
|
+
async function getUi5ApiDtMetadata(libName) {
|
|
17
|
+
const libUrl = '/test-resources/' + libName.split('.').join('/') + '/designtime/api.json';
|
|
18
|
+
const response = await fetch(libUrl);
|
|
19
|
+
if (!response.ok) {
|
|
20
|
+
throw new FetchError(response);
|
|
21
|
+
}
|
|
22
|
+
return response.json();
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* load ui5 controls design time metadata api.json for following libraries
|
|
27
|
+
* sap.m, sap.ui.comp, sap.f, sap.ui.core
|
|
28
|
+
* loading libraries(more in file size) in parallel during initialization.
|
|
29
|
+
* Others (less in file size) are loaded dynamically in getControlMetadata method
|
|
30
|
+
*/
|
|
31
|
+
const ui5ApiDtMetadata = new Map();
|
|
32
|
+
function loadDefaultLibraries() {
|
|
33
|
+
const allData = Promise.all([getUi5ApiDtMetadata('sap.m'), getUi5ApiDtMetadata('sap.ui.comp'), getUi5ApiDtMetadata('sap.ui.core'), getUi5ApiDtMetadata('sap.f')]);
|
|
34
|
+
allData.then(res => {
|
|
35
|
+
res.forEach(api => {
|
|
36
|
+
if (api.library) {
|
|
37
|
+
ui5ApiDtMetadata.set(api.library, api);
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
}).catch(reason => {
|
|
41
|
+
Log.error('Loading Library Failed: ' + reason);
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Format html text.
|
|
47
|
+
*
|
|
48
|
+
* @param sHtml - html string
|
|
49
|
+
* @returns string
|
|
50
|
+
*/
|
|
51
|
+
function formatHtmlText(sHtml) {
|
|
52
|
+
// replaced "sHtml.replace(new RegExp('<[^>]*>', 'g')" due to regex runtime vulnerability
|
|
53
|
+
const parts = (sHtml || '').split('<');
|
|
54
|
+
let result = '';
|
|
55
|
+
for (const part of parts) {
|
|
56
|
+
if (!result) {
|
|
57
|
+
result = part;
|
|
58
|
+
} else {
|
|
59
|
+
const indexClosingBracket = part.indexOf('>');
|
|
60
|
+
result += indexClosingBracket >= 0 ? part.substring(indexClosingBracket + 1) : `<${part}`;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return result;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Method to parse ui5 control metadata.
|
|
68
|
+
*
|
|
69
|
+
* @param controlLibMetadata control library metadata
|
|
70
|
+
* @param controlName name of the control
|
|
71
|
+
* @returns ControlMetadata
|
|
72
|
+
*/
|
|
73
|
+
function parseControlMetaModel(controlLibMetadata, controlName) {
|
|
74
|
+
const controlInfo = {
|
|
75
|
+
baseType: '',
|
|
76
|
+
doc: '',
|
|
77
|
+
properties: {}
|
|
78
|
+
};
|
|
79
|
+
const selectedControlMetadata = (controlLibMetadata.symbols ?? []).find(control => control.name === controlName);
|
|
80
|
+
if (selectedControlMetadata) {
|
|
81
|
+
// base type info of control is available on property 'extends'
|
|
82
|
+
controlInfo.baseType = selectedControlMetadata.extends;
|
|
83
|
+
controlInfo.doc = selectedControlMetadata.description ?? '';
|
|
84
|
+
const properties = selectedControlMetadata['ui5-metadata'].properties;
|
|
85
|
+
if (properties) {
|
|
86
|
+
properties.forEach(prop => {
|
|
87
|
+
prop.description = formatHtmlText(prop.description || '');
|
|
88
|
+
prop.propertyName = prop.name;
|
|
89
|
+
prop.propertyType = prop.type;
|
|
90
|
+
if (prop.defaultValue === null || prop.defaultValue === '') {
|
|
91
|
+
prop.defaultValue = '-';
|
|
92
|
+
}
|
|
93
|
+
controlInfo.properties[prop.name] = {
|
|
94
|
+
...prop
|
|
95
|
+
};
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
return controlInfo;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Get control metadata for a given control.
|
|
104
|
+
*
|
|
105
|
+
* @param controlName name of the control
|
|
106
|
+
* @param contLibName library name of the control
|
|
107
|
+
* @returns Promise<ControlMetadata | undefined>
|
|
108
|
+
*/
|
|
109
|
+
async function getControlMetadata(controlName, contLibName) {
|
|
110
|
+
let result;
|
|
111
|
+
let controlLibMetadata = ui5ApiDtMetadata.get(contLibName);
|
|
112
|
+
if (controlLibMetadata) {
|
|
113
|
+
result = parseControlMetaModel(controlLibMetadata, controlName);
|
|
114
|
+
} else {
|
|
115
|
+
controlLibMetadata = await getUi5ApiDtMetadata(contLibName);
|
|
116
|
+
ui5ApiDtMetadata.set(contLibName, controlLibMetadata);
|
|
117
|
+
result = parseControlMetaModel(controlLibMetadata, controlName);
|
|
118
|
+
}
|
|
119
|
+
return result;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Get Control Property Documentation for a give control name and control library.
|
|
124
|
+
*
|
|
125
|
+
* @param controlName name of the control
|
|
126
|
+
* @param contLibName library name of the control
|
|
127
|
+
* @returns Promise<Properties | undefined>
|
|
128
|
+
*/
|
|
129
|
+
async function getControlPropertyDocumentation(controlName, contLibName) {
|
|
130
|
+
const doc = await getControlMetadata(controlName, contLibName);
|
|
131
|
+
if (doc) {
|
|
132
|
+
const baseControlType = doc.baseType;
|
|
133
|
+
if (baseControlType) {
|
|
134
|
+
const baseContLibName = await getLibrary(baseControlType);
|
|
135
|
+
if (baseContLibName) {
|
|
136
|
+
const baseControlProps = await getControlPropertyDocumentation(baseControlType, baseContLibName);
|
|
137
|
+
return {
|
|
138
|
+
...baseControlProps,
|
|
139
|
+
...doc.properties
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
return {
|
|
144
|
+
...doc.properties
|
|
145
|
+
};
|
|
146
|
+
} else {
|
|
147
|
+
return undefined;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Get documentation of a given control of a ui5 library.
|
|
153
|
+
*
|
|
154
|
+
* @param controlName name of the control.
|
|
155
|
+
* @param contLibName library name of the control
|
|
156
|
+
* @returns Promise<Properties | undefined>
|
|
157
|
+
*/
|
|
158
|
+
async function getDocumentation(controlName, contLibName) {
|
|
159
|
+
let doc;
|
|
160
|
+
try {
|
|
161
|
+
doc = await getControlPropertyDocumentation(controlName, contLibName);
|
|
162
|
+
} catch (error) {
|
|
163
|
+
Log.error(`Error in getting documentation for ${contLibName}`);
|
|
164
|
+
// For some UI5 components we do not have an api.json provided instead 404, not found,
|
|
165
|
+
// response is retuned from the server. For such components we do not want to
|
|
166
|
+
// flood the info center with errors.
|
|
167
|
+
if (error instanceof FetchError && error.status === 404) {
|
|
168
|
+
return undefined;
|
|
169
|
+
}
|
|
170
|
+
await sendInfoCenterMessage({
|
|
171
|
+
title: {
|
|
172
|
+
key: 'DOCUMENTATION_ERROR_TITLE'
|
|
173
|
+
},
|
|
174
|
+
description: {
|
|
175
|
+
key: 'DOCUMENTATION_ERROR_DESCRIPTION',
|
|
176
|
+
params: [contLibName]
|
|
177
|
+
},
|
|
178
|
+
type: MessageBarType.error
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
return doc;
|
|
182
|
+
}
|
|
183
|
+
var __exports = {
|
|
184
|
+
__esModule: true
|
|
185
|
+
};
|
|
186
|
+
__exports.getUi5ApiDtMetadata = getUi5ApiDtMetadata;
|
|
187
|
+
__exports.loadDefaultLibraries = loadDefaultLibraries;
|
|
188
|
+
__exports.getDocumentation = getDocumentation;
|
|
189
|
+
return __exports;
|
|
190
|
+
});
|
|
191
|
+
//# sourceMappingURL=documentation.js.map
|