@covalent/core 4.0.0 → 4.1.0-develop.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -4
- package/breadcrumbs/README.md +21 -17
- package/breadcrumbs/breadcrumb/breadcrumb.component.d.ts +6 -1
- package/breadcrumbs/breadcrumbs.component.d.ts +4 -0
- package/breadcrumbs/breadcrumbs.module.d.ts +8 -0
- package/breadcrumbs/covalent-core-breadcrumbs.d.ts +2 -1
- package/breadcrumbs/package.json +6 -7
- package/breadcrumbs/{public-api.d.ts → public_api.d.ts} +0 -0
- package/common/README.md +3 -0
- package/common/_common-theme.scss +3 -1
- package/common/behaviors/disable-ripple.mixin.d.ts +1 -1
- package/common/behaviors/disabled.mixin.d.ts +1 -1
- package/common/common.module.d.ts +15 -0
- package/common/covalent-core-common.d.ts +2 -3
- package/common/directives/fullscreen/fullscreen.directive.d.ts +3 -0
- package/common/forms/auto-trim/auto-trim.directive.d.ts +3 -0
- package/common/package.json +6 -7
- package/common/pipes/bytes/bytes.pipe.d.ts +3 -0
- package/common/pipes/decimal-bytes/decimal-bytes.pipe.d.ts +3 -0
- package/common/pipes/digits/digits.pipe.d.ts +3 -0
- package/common/pipes/time-ago/time-ago.pipe.d.ts +3 -0
- package/common/pipes/time-difference/time-difference.pipe.d.ts +3 -0
- package/common/pipes/time-until/time-until.pipe.d.ts +3 -0
- package/common/pipes/truncate/truncate.pipe.d.ts +4 -1
- package/common/{public-api.d.ts → public_api.d.ts} +0 -0
- package/common/services/icon.service.d.ts +3 -0
- package/common/services/router-path.service.d.ts +3 -0
- package/common/styles/font/README.md +4 -2
- package/covalent-core.d.ts +2 -1
- package/dialogs/README.md +38 -30
- package/dialogs/_dialog-theme.scss +1 -0
- package/dialogs/alert-dialog/alert-dialog.component.d.ts +6 -3
- package/dialogs/confirm-dialog/confirm-dialog.component.d.ts +5 -2
- package/dialogs/covalent-core-dialogs.d.ts +2 -2
- package/dialogs/dialog.component.d.ts +9 -0
- package/dialogs/dialogs.module.d.ts +17 -0
- package/dialogs/package.json +6 -7
- package/dialogs/prompt-dialog/prompt-dialog.component.d.ts +6 -3
- package/dialogs/{public-api.d.ts → public_api.d.ts} +1 -0
- package/dialogs/services/dialog.service.d.ts +3 -0
- package/dialogs/src/README.md +223 -0
- package/dialogs/window-dialog/window-dialog.component.d.ts +8 -5
- package/dynamic-menu/README.md +6 -6
- package/dynamic-menu/covalent-core-dynamic-menu.d.ts +2 -2
- package/dynamic-menu/dynamic-menu-item/dynamic-menu-item.component.d.ts +4 -1
- package/dynamic-menu/dynamic-menu-item/dynamic-menu-link/dynamic-menu-link.component.d.ts +4 -1
- package/dynamic-menu/dynamic-menu.component.d.ts +4 -22
- package/dynamic-menu/dynamic-menu.menu.d.ts +22 -0
- package/dynamic-menu/dynamic-menu.module.d.ts +13 -0
- package/dynamic-menu/package.json +6 -7
- package/dynamic-menu/public_api.d.ts +2 -0
- package/esm2020/breadcrumbs/breadcrumb/breadcrumb.component.mjs +92 -0
- package/esm2020/breadcrumbs/breadcrumbs.component.mjs +134 -0
- package/esm2020/breadcrumbs/breadcrumbs.module.mjs +20 -0
- package/esm2020/breadcrumbs/covalent-core-breadcrumbs.mjs +5 -0
- package/esm2020/breadcrumbs/public_api.mjs +4 -0
- package/esm2020/common/animations/bounce/bounce.animation.mjs +70 -0
- package/esm2020/common/animations/collapse/collapse.animation.mjs +51 -0
- package/esm2020/common/animations/common/interfaces.mjs +2 -0
- package/esm2020/common/animations/fade/fadeInOut.animation.mjs +37 -0
- package/esm2020/common/animations/flash/flash.animation.mjs +34 -0
- package/esm2020/common/animations/headshake/headshake.animation.mjs +47 -0
- package/esm2020/common/animations/jello/jello.animation.mjs +59 -0
- package/esm2020/common/animations/pulse/pulse.animation.mjs +32 -0
- package/esm2020/common/animations/rotate/rotate.animation.mjs +30 -0
- package/esm2020/common/behaviors/control-value-accesor.mixin.mjs +41 -0
- package/esm2020/common/behaviors/disable-ripple.mixin.mjs +24 -0
- package/esm2020/common/behaviors/disabled.mixin.mjs +24 -0
- package/esm2020/common/common.module.mjs +63 -0
- package/esm2020/common/covalent-core-common.mjs +5 -0
- package/esm2020/common/directives/fullscreen/fullscreen.directive.mjs +85 -0
- package/esm2020/common/forms/auto-trim/auto-trim.directive.mjs +36 -0
- package/esm2020/common/forms/validators/validators.mjs +29 -0
- package/esm2020/common/functions/clipboard.mjs +23 -0
- package/esm2020/common/functions/convert.mjs +84 -0
- package/esm2020/common/functions/download.mjs +75 -0
- package/esm2020/common/functions/file.mjs +16 -0
- package/esm2020/common/pipes/bytes/bytes.pipe.mjs +42 -0
- package/esm2020/common/pipes/decimal-bytes/decimal-bytes.pipe.mjs +42 -0
- package/esm2020/common/pipes/digits/digits.pipe.mjs +39 -0
- package/esm2020/common/pipes/time-ago/time-ago.pipe.mjs +72 -0
- package/esm2020/common/pipes/time-difference/time-difference.pipe.mjs +51 -0
- package/esm2020/common/pipes/time-until/time-until.pipe.mjs +72 -0
- package/esm2020/common/pipes/truncate/truncate.pipe.mjs +27 -0
- package/esm2020/common/public_api.mjs +39 -0
- package/esm2020/common/services/icon.service.mjs +1089 -0
- package/esm2020/common/services/router-path.service.mjs +29 -0
- package/esm2020/covalent-core.mjs +5 -0
- package/esm2020/dialogs/alert-dialog/alert-dialog.component.mjs +23 -0
- package/esm2020/dialogs/confirm-dialog/confirm-dialog.component.mjs +28 -0
- package/esm2020/dialogs/covalent-core-dialogs.mjs +5 -0
- package/esm2020/dialogs/dialog.component.mjs +56 -0
- package/esm2020/dialogs/dialogs.module.mjs +89 -0
- package/esm2020/dialogs/prompt-dialog/prompt-dialog.component.mjs +46 -0
- package/esm2020/dialogs/public_api.mjs +9 -0
- package/esm2020/dialogs/resizable-draggable-dialog/resizable-draggable-dialog.mjs +216 -0
- package/esm2020/dialogs/services/dialog.service.mjs +171 -0
- package/esm2020/dialogs/window-dialog/window-dialog.component.mjs +38 -0
- package/esm2020/dynamic-menu/covalent-core-dynamic-menu.mjs +5 -0
- package/esm2020/dynamic-menu/dynamic-menu-item/dynamic-menu-item.component.mjs +30 -0
- package/esm2020/dynamic-menu/dynamic-menu-item/dynamic-menu-link/dynamic-menu-link.component.mjs +24 -0
- package/esm2020/dynamic-menu/dynamic-menu.component.mjs +28 -0
- package/esm2020/dynamic-menu/dynamic-menu.menu.mjs +2 -0
- package/esm2020/dynamic-menu/dynamic-menu.module.mjs +57 -0
- package/esm2020/dynamic-menu/public_api.mjs +6 -0
- package/esm2020/file/covalent-core-file.mjs +5 -0
- package/esm2020/file/directives/file-drop.directive.mjs +147 -0
- package/esm2020/file/directives/file-select.directive.mjs +77 -0
- package/esm2020/file/file-input/file-input.component.mjs +110 -0
- package/esm2020/file/file-upload/file-upload.component.mjs +174 -0
- package/esm2020/file/file.module.mjs +58 -0
- package/esm2020/file/public_api.mjs +7 -0
- package/esm2020/file/services/file.service.mjs +64 -0
- package/esm2020/json-formatter/collapse.animation.mjs +51 -0
- package/esm2020/json-formatter/covalent-core-json-formatter.mjs +5 -0
- package/esm2020/json-formatter/json-formatter.component.mjs +217 -0
- package/esm2020/json-formatter/json-formatter.module.mjs +20 -0
- package/esm2020/json-formatter/public_api.mjs +3 -0
- package/esm2020/layout/covalent-core-layout.mjs +5 -0
- package/esm2020/layout/layout-card-over/layout-card-over.component.mjs +40 -0
- package/esm2020/layout/layout-footer/layout-footer.component.mjs +33 -0
- package/esm2020/layout/layout-manage-list/layout-manage-list.component.mjs +93 -0
- package/esm2020/layout/layout-manage-list/layout-manage-list.directives.mjs +84 -0
- package/esm2020/layout/layout-nav/layout-nav.component.mjs +50 -0
- package/esm2020/layout/layout-nav-list/layout-nav-list.component.mjs +128 -0
- package/esm2020/layout/layout-nav-list/layout-nav-list.directives.mjs +84 -0
- package/esm2020/layout/layout-toggle.class.mjs +92 -0
- package/esm2020/layout/layout.component.mjs +92 -0
- package/esm2020/layout/layout.directives.mjs +85 -0
- package/esm2020/layout/layout.module.mjs +117 -0
- package/esm2020/layout/navigation-drawer/navigation-drawer.component.mjs +161 -0
- package/esm2020/layout/public_api.mjs +13 -0
- package/esm2020/menu/covalent-core-menu.mjs +5 -0
- package/esm2020/menu/menu.component.mjs +12 -0
- package/esm2020/menu/menu.module.mjs +21 -0
- package/esm2020/menu/public_api.mjs +3 -0
- package/esm2020/message/collapse.animation.mjs +51 -0
- package/esm2020/message/covalent-core-message.mjs +5 -0
- package/esm2020/message/message.component.mjs +203 -0
- package/esm2020/message/message.module.mjs +25 -0
- package/esm2020/message/public_api.mjs +3 -0
- package/esm2020/public_api.mjs +2 -0
- package/esm2020/search/covalent-core-search.mjs +5 -0
- package/esm2020/search/public_api.mjs +4 -0
- package/esm2020/search/search-box/search-box.component.mjs +194 -0
- package/esm2020/search/search-input/search-input.component.mjs +203 -0
- package/esm2020/search/search.module.mjs +39 -0
- package/esm2020/side-sheet/covalent-core-side-sheet.mjs +5 -0
- package/esm2020/side-sheet/public_api.mjs +6 -0
- package/esm2020/side-sheet/side-sheet-container.mjs +274 -0
- package/esm2020/side-sheet/side-sheet-ref.mjs +21 -0
- package/esm2020/side-sheet/side-sheet.animation.mjs +12 -0
- package/esm2020/side-sheet/side-sheet.config.mjs +4 -0
- package/esm2020/side-sheet/side-sheet.content-directives.mjs +201 -0
- package/esm2020/side-sheet/side-sheet.mjs +221 -0
- package/esm2020/side-sheet/side-sheet.module.mjs +45 -0
- package/esm2020/user-profile/covalent-core-user-profile.mjs +5 -0
- package/esm2020/user-profile/public_api.mjs +4 -0
- package/esm2020/user-profile/user-profile-menu/user-profile-menu.component.mjs +24 -0
- package/esm2020/user-profile/user-profile.component.mjs +19 -0
- package/esm2020/user-profile/user-profile.module.mjs +44 -0
- package/fesm2015/covalent-core-breadcrumbs.mjs +246 -0
- package/fesm2015/covalent-core-breadcrumbs.mjs.map +1 -0
- package/fesm2015/covalent-core-common.mjs +2281 -0
- package/fesm2015/covalent-core-common.mjs.map +1 -0
- package/fesm2015/covalent-core-dialogs.mjs +639 -0
- package/fesm2015/covalent-core-dialogs.mjs.map +1 -0
- package/fesm2015/covalent-core-dynamic-menu.mjs +128 -0
- package/fesm2015/covalent-core-dynamic-menu.mjs.map +1 -0
- package/fesm2015/covalent-core-file.mjs +613 -0
- package/fesm2015/covalent-core-file.mjs.map +1 -0
- package/fesm2015/covalent-core-json-formatter.mjs +298 -0
- package/fesm2015/covalent-core-json-formatter.mjs.map +1 -0
- package/fesm2015/covalent-core-layout.mjs +1024 -0
- package/fesm2015/covalent-core-layout.mjs.map +1 -0
- package/fesm2015/covalent-core-menu.mjs +37 -0
- package/fesm2015/covalent-core-menu.mjs.map +1 -0
- package/fesm2015/covalent-core-message.mjs +284 -0
- package/fesm2015/covalent-core-message.mjs.map +1 -0
- package/fesm2015/covalent-core-search.mjs +428 -0
- package/fesm2015/covalent-core-search.mjs.map +1 -0
- package/fesm2015/covalent-core-side-sheet.mjs +762 -0
- package/fesm2015/covalent-core-side-sheet.mjs.map +1 -0
- package/fesm2015/covalent-core-user-profile.mjs +86 -0
- package/fesm2015/covalent-core-user-profile.mjs.map +1 -0
- package/fesm2015/covalent-core.mjs +4 -0
- package/fesm2015/covalent-core.mjs.map +1 -0
- package/fesm2020/covalent-core-breadcrumbs.mjs +246 -0
- package/fesm2020/covalent-core-breadcrumbs.mjs.map +1 -0
- package/{fesm2015/covalent-core-common.js → fesm2020/covalent-core-common.mjs} +317 -813
- package/fesm2020/covalent-core-common.mjs.map +1 -0
- package/fesm2020/covalent-core-dialogs.mjs +634 -0
- package/fesm2020/covalent-core-dialogs.mjs.map +1 -0
- package/fesm2020/covalent-core-dynamic-menu.mjs +128 -0
- package/fesm2020/covalent-core-dynamic-menu.mjs.map +1 -0
- package/fesm2020/covalent-core-file.mjs +607 -0
- package/fesm2020/covalent-core-file.mjs.map +1 -0
- package/fesm2020/covalent-core-json-formatter.mjs +290 -0
- package/fesm2020/covalent-core-json-formatter.mjs.map +1 -0
- package/fesm2020/covalent-core-layout.mjs +1000 -0
- package/fesm2020/covalent-core-layout.mjs.map +1 -0
- package/fesm2020/covalent-core-menu.mjs +37 -0
- package/fesm2020/covalent-core-menu.mjs.map +1 -0
- package/fesm2020/covalent-core-message.mjs +282 -0
- package/fesm2020/covalent-core-message.mjs.map +1 -0
- package/fesm2020/covalent-core-search.mjs +425 -0
- package/fesm2020/covalent-core-search.mjs.map +1 -0
- package/fesm2020/covalent-core-side-sheet.mjs +757 -0
- package/fesm2020/covalent-core-side-sheet.mjs.map +1 -0
- package/fesm2020/covalent-core-user-profile.mjs +86 -0
- package/fesm2020/covalent-core-user-profile.mjs.map +1 -0
- package/fesm2020/covalent-core.mjs +4 -0
- package/fesm2020/covalent-core.mjs.map +1 -0
- package/file/_file-theme.scss +3 -1
- package/file/covalent-core-file.d.ts +2 -1
- package/file/directives/file-drop.directive.d.ts +8 -6
- package/file/directives/file-select.directive.d.ts +5 -2
- package/file/file-input/file-input.component.d.ts +10 -5
- package/file/file-upload/file-upload.component.d.ts +18 -8
- package/file/file.module.d.ts +13 -0
- package/file/package.json +6 -7
- package/file/{public-api.d.ts → public_api.d.ts} +0 -0
- package/file/services/file.service.d.ts +3 -0
- package/file/{file-input → src/file-input}/README.md +46 -37
- package/file/{file-upload → src/file-upload}/README.md +36 -27
- package/json-formatter/README.md +8 -8
- package/json-formatter/_json-formatter-theme.scss +10 -0
- package/json-formatter/collapse.animation.d.ts +24 -0
- package/json-formatter/covalent-core-json-formatter.d.ts +2 -1
- package/json-formatter/json-formatter.component.d.ts +7 -4
- package/json-formatter/json-formatter.module.d.ts +8 -0
- package/json-formatter/package.json +6 -7
- package/json-formatter/{public-api.d.ts → public_api.d.ts} +0 -0
- package/layout/README.md +48 -50
- package/layout/_layout-theme.scss +12 -0
- package/layout/covalent-core-layout.d.ts +2 -1
- package/layout/layout-card-over/layout-card-over.component.d.ts +6 -3
- package/layout/layout-footer/layout-footer.component.d.ts +6 -3
- package/layout/layout-manage-list/layout-manage-list.component.d.ts +7 -4
- package/layout/layout-manage-list/layout-manage-list.directives.d.ts +9 -2
- package/layout/layout-nav/layout-nav.component.d.ts +8 -5
- package/layout/layout-nav-list/layout-nav-list.component.d.ts +12 -9
- package/layout/layout-nav-list/layout-nav-list.directives.d.ts +9 -2
- package/layout/layout-toggle.class.d.ts +4 -1
- package/layout/layout.component.d.ts +7 -4
- package/layout/layout.directives.d.ts +9 -2
- package/layout/layout.module.d.ts +23 -0
- package/layout/navigation-drawer/navigation-drawer.component.d.ts +17 -10
- package/layout/package.json +6 -7
- package/layout/{public-api.d.ts → public_api.d.ts} +0 -0
- package/layout/{layout-card-over → src/layout-card-over}/README.md +19 -17
- package/layout/{layout-manage-list → src/layout-manage-list}/README.md +24 -28
- package/layout/src/layout-nav/README.md +50 -0
- package/layout/{layout-nav-list → src/layout-nav-list}/README.md +44 -40
- package/menu/covalent-core-menu.d.ts +2 -1
- package/menu/menu.component.d.ts +3 -0
- package/menu/menu.module.d.ts +8 -0
- package/menu/package.json +6 -7
- package/menu/{public-api.d.ts → public_api.d.ts} +0 -0
- package/message/README.md +26 -18
- package/message/_message-theme.scss +3 -0
- package/message/collapse.animation.d.ts +24 -0
- package/message/covalent-core-message.d.ts +2 -1
- package/message/message.component.d.ts +9 -4
- package/message/message.module.d.ts +7 -0
- package/message/package.json +6 -7
- package/message/{public-api.d.ts → public_api.d.ts} +0 -0
- package/package.json +129 -37
- package/{index.d.ts → public_api.d.ts} +0 -0
- package/search/README.md +74 -73
- package/search/covalent-core-search.d.ts +2 -1
- package/search/package.json +6 -7
- package/search/{public-api.d.ts → public_api.d.ts} +0 -0
- package/search/search-box/search-box.component.d.ts +12 -5
- package/search/search-input/search-input.component.d.ts +12 -5
- package/search/search.module.d.ts +11 -0
- package/search/src/search-box/README.md +73 -0
- package/search/src/search-input/README.md +74 -0
- package/side-sheet/README.md +3 -5
- package/side-sheet/{side-sheet.theme.scss → _side-sheet.theme.scss} +0 -0
- package/side-sheet/covalent-core-side-sheet.d.ts +2 -3
- package/side-sheet/package.json +6 -7
- package/side-sheet/{public-api.d.ts → public_api.d.ts} +0 -0
- package/side-sheet/side-sheet-container.d.ts +21 -5
- package/side-sheet/side-sheet.content-directives.d.ts +23 -6
- package/side-sheet/side-sheet.d.ts +7 -2
- package/side-sheet/side-sheet.module.d.ts +9 -0
- package/user-profile/README.md +5 -5
- package/user-profile/covalent-core-user-profile.d.ts +2 -1
- package/user-profile/package.json +6 -7
- package/user-profile/user-profile-menu/user-profile-menu.component.d.ts +5 -2
- package/user-profile/user-profile.component.d.ts +5 -2
- package/user-profile/user-profile.module.d.ts +12 -0
- package/breadcrumbs/breadcrumb/breadcrumb.component.scss +0 -22
- package/breadcrumbs/breadcrumbs.component.scss +0 -7
- package/breadcrumbs/covalent-core-breadcrumbs.metadata.json +0 -1
- package/breadcrumbs/index.d.ts +0 -1
- package/bundles/covalent-core-breadcrumbs.umd.js +0 -490
- package/bundles/covalent-core-breadcrumbs.umd.js.map +0 -1
- package/bundles/covalent-core-breadcrumbs.umd.min.js +0 -2
- package/bundles/covalent-core-breadcrumbs.umd.min.js.map +0 -1
- package/bundles/covalent-core-common.umd.js +0 -3188
- package/bundles/covalent-core-common.umd.js.map +0 -1
- package/bundles/covalent-core-common.umd.min.js +0 -17
- package/bundles/covalent-core-common.umd.min.js.map +0 -1
- package/bundles/covalent-core-dialogs.umd.js +0 -1318
- package/bundles/covalent-core-dialogs.umd.js.map +0 -1
- package/bundles/covalent-core-dialogs.umd.min.js +0 -2
- package/bundles/covalent-core-dialogs.umd.min.js.map +0 -1
- package/bundles/covalent-core-dynamic-menu.umd.js +0 -215
- package/bundles/covalent-core-dynamic-menu.umd.js.map +0 -1
- package/bundles/covalent-core-dynamic-menu.umd.min.js +0 -2
- package/bundles/covalent-core-dynamic-menu.umd.min.js.map +0 -1
- package/bundles/covalent-core-file.umd.js +0 -1211
- package/bundles/covalent-core-file.umd.js.map +0 -1
- package/bundles/covalent-core-file.umd.min.js +0 -17
- package/bundles/covalent-core-file.umd.min.js.map +0 -1
- package/bundles/covalent-core-json-formatter.umd.js +0 -408
- package/bundles/covalent-core-json-formatter.umd.js.map +0 -1
- package/bundles/covalent-core-json-formatter.umd.min.js +0 -2
- package/bundles/covalent-core-json-formatter.umd.min.js.map +0 -1
- package/bundles/covalent-core-layout.umd.js +0 -2084
- package/bundles/covalent-core-layout.umd.js.map +0 -1
- package/bundles/covalent-core-layout.umd.min.js +0 -17
- package/bundles/covalent-core-layout.umd.min.js.map +0 -1
- package/bundles/covalent-core-menu.umd.js +0 -69
- package/bundles/covalent-core-menu.umd.js.map +0 -1
- package/bundles/covalent-core-menu.umd.min.js +0 -2
- package/bundles/covalent-core-menu.umd.min.js.map +0 -1
- package/bundles/covalent-core-message.umd.js +0 -375
- package/bundles/covalent-core-message.umd.js.map +0 -1
- package/bundles/covalent-core-message.umd.min.js +0 -2
- package/bundles/covalent-core-message.umd.min.js.map +0 -1
- package/bundles/covalent-core-search.umd.js +0 -877
- package/bundles/covalent-core-search.umd.js.map +0 -1
- package/bundles/covalent-core-search.umd.min.js +0 -16
- package/bundles/covalent-core-search.umd.min.js.map +0 -1
- package/bundles/covalent-core-side-sheet.umd.js +0 -1458
- package/bundles/covalent-core-side-sheet.umd.js.map +0 -1
- package/bundles/covalent-core-side-sheet.umd.min.js +0 -16
- package/bundles/covalent-core-side-sheet.umd.min.js.map +0 -1
- package/bundles/covalent-core-user-profile.umd.js +0 -116
- package/bundles/covalent-core-user-profile.umd.js.map +0 -1
- package/bundles/covalent-core-user-profile.umd.min.js +0 -2
- package/bundles/covalent-core-user-profile.umd.min.js.map +0 -1
- package/bundles/covalent-core.umd.js +0 -9
- package/bundles/covalent-core.umd.js.map +0 -1
- package/bundles/covalent-core.umd.min.js +0 -2
- package/bundles/covalent-core.umd.min.js.map +0 -1
- package/common/covalent-core-common.metadata.json +0 -1
- package/common/index.d.ts +0 -1
- package/common/material-icons.css +0 -98
- package/common/material-icons.css.map +0 -1
- package/common/material-icons.scss +0 -3
- package/common/platform.css +0 -15424
- package/common/platform.css.map +0 -1
- package/common/platform.scss +0 -7
- package/common/styles/_elevation.scss +0 -280
- package/common/styles/_layout.scss +0 -603
- package/common/styles/_palette-dark.scss +0 -326
- package/common/styles/_palette-light.scss +0 -637
- package/common/styles/_rtl.scss +0 -28
- package/common/styles/_styles.scss +0 -10
- package/common/styles/_theme-functions.scss +0 -25
- package/common/styles/_typography-functions.scss +0 -35
- package/common/styles/_variables.scss +0 -98
- package/common/styles/colors/_colors-dark.scss +0 -1072
- package/common/styles/colors/_colors-light.scss +0 -2487
- package/common/styles/colors/_colors.scss +0 -7
- package/common/styles/core/_button.scss +0 -59
- package/common/styles/core/_card.scss +0 -164
- package/common/styles/core/_content.scss +0 -42
- package/common/styles/core/_core.scss +0 -23
- package/common/styles/core/_divider.scss +0 -15
- package/common/styles/core/_icons.scss +0 -20
- package/common/styles/core/_list.scss +0 -8
- package/common/styles/core/_sidenav.scss +0 -20
- package/common/styles/core/_structure.scss +0 -128
- package/common/styles/core/_toolbar.scss +0 -46
- package/common/styles/core/_whiteframe.scss +0 -130
- package/common/styles/font/MaterialIcons-Regular-v48.woff2 +0 -0
- package/common/styles/font/_font.scss +0 -93
- package/common/styles/utilities/_general.scss +0 -51
- package/common/styles/utilities/_pad.scss +0 -36
- package/common/styles/utilities/_pull.scss +0 -36
- package/common/styles/utilities/_push.scss +0 -36
- package/common/styles/utilities/_size.scss +0 -24
- package/common/styles/utilities/_text.scss +0 -84
- package/common/styles/utilities/_utilities.scss +0 -15
- package/covalent-core.metadata.json +0 -1
- package/dialogs/alert-dialog/alert-dialog.component.scss +0 -3
- package/dialogs/confirm-dialog/confirm-dialog.component.scss +0 -3
- package/dialogs/covalent-core-dialogs.metadata.json +0 -1
- package/dialogs/dialog.component.scss +0 -44
- package/dialogs/index.d.ts +0 -1
- package/dialogs/prompt-dialog/prompt-dialog.component.scss +0 -15
- package/dialogs/window-dialog/window-dialog.component.scss +0 -31
- package/dynamic-menu/covalent-core-dynamic-menu.metadata.json +0 -1
- package/dynamic-menu/dynamic-menu-item/dynamic-menu-item.component.scss +0 -6
- package/dynamic-menu/dynamic-menu-item/dynamic-menu-link/dynamic-menu-link.component.scss +0 -11
- package/dynamic-menu/dynamic-menu.component.scss +0 -0
- package/dynamic-menu/index.d.ts +0 -1
- package/esm2015/breadcrumbs/breadcrumb/breadcrumb.component.js +0 -171
- package/esm2015/breadcrumbs/breadcrumbs.component.js +0 -241
- package/esm2015/breadcrumbs/breadcrumbs.module.js +0 -20
- package/esm2015/breadcrumbs/covalent-core-breadcrumbs.js +0 -10
- package/esm2015/breadcrumbs/index.js +0 -7
- package/esm2015/breadcrumbs/public-api.js +0 -9
- package/esm2015/common/animations/bounce/bounce.animation.js +0 -76
- package/esm2015/common/animations/collapse/collapse.animation.js +0 -67
- package/esm2015/common/animations/common/interfaces.js +0 -18
- package/esm2015/common/animations/fade/fadeInOut.animation.js +0 -53
- package/esm2015/common/animations/flash/flash.animation.js +0 -40
- package/esm2015/common/animations/headshake/headshake.animation.js +0 -41
- package/esm2015/common/animations/jello/jello.animation.js +0 -44
- package/esm2015/common/animations/pulse/pulse.animation.js +0 -38
- package/esm2015/common/animations/rotate/rotate.animation.js +0 -41
- package/esm2015/common/behaviors/control-value-accesor.mixin.js +0 -107
- package/esm2015/common/behaviors/disable-ripple.mixin.js +0 -63
- package/esm2015/common/behaviors/disabled.mixin.js +0 -63
- package/esm2015/common/common.module.js +0 -54
- package/esm2015/common/covalent-core-common.js +0 -12
- package/esm2015/common/directives/fullscreen/fullscreen.directive.js +0 -180
- package/esm2015/common/forms/auto-trim/auto-trim.directive.js +0 -46
- package/esm2015/common/forms/validators/validators.js +0 -58
- package/esm2015/common/functions/clipboard.js +0 -30
- package/esm2015/common/functions/convert.js +0 -103
- package/esm2015/common/functions/download.js +0 -88
- package/esm2015/common/functions/file.js +0 -29
- package/esm2015/common/index.js +0 -7
- package/esm2015/common/pipes/bytes/bytes.pipe.js +0 -41
- package/esm2015/common/pipes/decimal-bytes/decimal-bytes.pipe.js +0 -41
- package/esm2015/common/pipes/digits/digits.pipe.js +0 -65
- package/esm2015/common/pipes/time-ago/time-ago.pipe.js +0 -81
- package/esm2015/common/pipes/time-difference/time-difference.pipe.js +0 -66
- package/esm2015/common/pipes/time-until/time-until.pipe.js +0 -81
- package/esm2015/common/pipes/truncate/truncate.pipe.js +0 -34
- package/esm2015/common/public-api.js +0 -44
- package/esm2015/common/services/icon.service.js +0 -1109
- package/esm2015/common/services/router-path.service.js +0 -60
- package/esm2015/covalent-core.js +0 -10
- package/esm2015/dialogs/alert-dialog/alert-dialog.component.js +0 -47
- package/esm2015/dialogs/confirm-dialog/confirm-dialog.component.js +0 -59
- package/esm2015/dialogs/covalent-core-dialogs.js +0 -11
- package/esm2015/dialogs/dialog.component.js +0 -58
- package/esm2015/dialogs/dialogs.module.js +0 -57
- package/esm2015/dialogs/index.js +0 -7
- package/esm2015/dialogs/prompt-dialog/prompt-dialog.component.js +0 -83
- package/esm2015/dialogs/public-api.js +0 -13
- package/esm2015/dialogs/resizable-draggable-dialog/resizable-draggable-dialog.js +0 -325
- package/esm2015/dialogs/services/dialog.service.js +0 -316
- package/esm2015/dialogs/window-dialog/window-dialog.component.js +0 -56
- package/esm2015/dynamic-menu/covalent-core-dynamic-menu.js +0 -11
- package/esm2015/dynamic-menu/dynamic-menu-item/dynamic-menu-item.component.js +0 -40
- package/esm2015/dynamic-menu/dynamic-menu-item/dynamic-menu-link/dynamic-menu-link.component.js +0 -35
- package/esm2015/dynamic-menu/dynamic-menu.component.js +0 -89
- package/esm2015/dynamic-menu/dynamic-menu.module.js +0 -26
- package/esm2015/dynamic-menu/index.js +0 -7
- package/esm2015/dynamic-menu/public_api.js +0 -9
- package/esm2015/file/covalent-core-file.js +0 -10
- package/esm2015/file/directives/file-drop.directive.js +0 -191
- package/esm2015/file/directives/file-select.directive.js +0 -98
- package/esm2015/file/file-input/file-input.component.js +0 -186
- package/esm2015/file/file-upload/file-upload.component.js +0 -237
- package/esm2015/file/file.module.js +0 -35
- package/esm2015/file/index.js +0 -7
- package/esm2015/file/public-api.js +0 -12
- package/esm2015/file/services/file.service.js +0 -109
- package/esm2015/index.js +0 -7
- package/esm2015/json-formatter/covalent-core-json-formatter.js +0 -10
- package/esm2015/json-formatter/index.js +0 -7
- package/esm2015/json-formatter/json-formatter.component.js +0 -338
- package/esm2015/json-formatter/json-formatter.module.js +0 -20
- package/esm2015/json-formatter/public-api.js +0 -8
- package/esm2015/layout/covalent-core-layout.js +0 -10
- package/esm2015/layout/index.js +0 -7
- package/esm2015/layout/layout-card-over/layout-card-over.component.js +0 -71
- package/esm2015/layout/layout-footer/layout-footer.component.js +0 -71
- package/esm2015/layout/layout-manage-list/layout-manage-list.component.js +0 -145
- package/esm2015/layout/layout-manage-list/layout-manage-list.directives.js +0 -132
- package/esm2015/layout/layout-nav/layout-nav.component.js +0 -100
- package/esm2015/layout/layout-nav-list/layout-nav-list.component.js +0 -220
- package/esm2015/layout/layout-nav-list/layout-nav-list.directives.js +0 -132
- package/esm2015/layout/layout-toggle.class.js +0 -188
- package/esm2015/layout/layout.component.js +0 -145
- package/esm2015/layout/layout.directives.js +0 -129
- package/esm2015/layout/layout.module.js +0 -64
- package/esm2015/layout/navigation-drawer/navigation-drawer.component.js +0 -280
- package/esm2015/layout/public-api.js +0 -18
- package/esm2015/menu/covalent-core-menu.js +0 -10
- package/esm2015/menu/index.js +0 -7
- package/esm2015/menu/menu.component.js +0 -16
- package/esm2015/menu/menu.module.js +0 -22
- package/esm2015/menu/public-api.js +0 -8
- package/esm2015/message/covalent-core-message.js +0 -10
- package/esm2015/message/index.js +0 -7
- package/esm2015/message/message.component.js +0 -307
- package/esm2015/message/message.module.js +0 -21
- package/esm2015/message/public-api.js +0 -8
- package/esm2015/search/covalent-core-search.js +0 -10
- package/esm2015/search/index.js +0 -7
- package/esm2015/search/public-api.js +0 -9
- package/esm2015/search/search-box/search-box.component.js +0 -270
- package/esm2015/search/search-input/search-input.component.js +0 -260
- package/esm2015/search/search.module.js +0 -23
- package/esm2015/side-sheet/covalent-core-side-sheet.js +0 -12
- package/esm2015/side-sheet/index.js +0 -7
- package/esm2015/side-sheet/public-api.js +0 -11
- package/esm2015/side-sheet/side-sheet-container.js +0 -402
- package/esm2015/side-sheet/side-sheet-ref.js +0 -50
- package/esm2015/side-sheet/side-sheet.animation.js +0 -20
- package/esm2015/side-sheet/side-sheet.config.js +0 -12
- package/esm2015/side-sheet/side-sheet.content-directives.js +0 -255
- package/esm2015/side-sheet/side-sheet.js +0 -360
- package/esm2015/side-sheet/side-sheet.module.js +0 -36
- package/esm2015/user-profile/covalent-core-user-profile.js +0 -10
- package/esm2015/user-profile/index.js +0 -7
- package/esm2015/user-profile/public_api.js +0 -9
- package/esm2015/user-profile/user-profile-menu/user-profile-menu.component.js +0 -35
- package/esm2015/user-profile/user-profile.component.js +0 -26
- package/esm2015/user-profile/user-profile.module.js +0 -25
- package/fesm2015/covalent-core-breadcrumbs.js +0 -448
- package/fesm2015/covalent-core-breadcrumbs.js.map +0 -1
- package/fesm2015/covalent-core-common.js.map +0 -1
- package/fesm2015/covalent-core-dialogs.js +0 -1001
- package/fesm2015/covalent-core-dialogs.js.map +0 -1
- package/fesm2015/covalent-core-dynamic-menu.js +0 -204
- package/fesm2015/covalent-core-dynamic-menu.js.map +0 -1
- package/fesm2015/covalent-core-file.js +0 -855
- package/fesm2015/covalent-core-file.js.map +0 -1
- package/fesm2015/covalent-core-json-formatter.js +0 -377
- package/fesm2015/covalent-core-json-formatter.js.map +0 -1
- package/fesm2015/covalent-core-layout.js +0 -1663
- package/fesm2015/covalent-core-layout.js.map +0 -1
- package/fesm2015/covalent-core-menu.js +0 -57
- package/fesm2015/covalent-core-menu.js.map +0 -1
- package/fesm2015/covalent-core-message.js +0 -347
- package/fesm2015/covalent-core-message.js.map +0 -1
- package/fesm2015/covalent-core-search.js +0 -564
- package/fesm2015/covalent-core-search.js.map +0 -1
- package/fesm2015/covalent-core-side-sheet.js +0 -1134
- package/fesm2015/covalent-core-side-sheet.js.map +0 -1
- package/fesm2015/covalent-core-user-profile.js +0 -103
- package/fesm2015/covalent-core-user-profile.js.map +0 -1
- package/fesm2015/covalent-core.js +0 -12
- package/fesm2015/covalent-core.js.map +0 -1
- package/file/covalent-core-file.metadata.json +0 -1
- package/file/file-input/file-input.component.scss +0 -20
- package/file/file-upload/file-upload.component.scss +0 -30
- package/file/index.d.ts +0 -1
- package/json-formatter/covalent-core-json-formatter.metadata.json +0 -1
- package/json-formatter/index.d.ts +0 -1
- package/json-formatter/json-formatter.component.scss +0 -61
- package/layout/covalent-core-layout.metadata.json +0 -1
- package/layout/index.d.ts +0 -1
- package/layout/layout-card-over/layout-card-over.component.scss +0 -42
- package/layout/layout-footer/layout-footer.component.scss +0 -4
- package/layout/layout-manage-list/layout-manage-list.component.scss +0 -78
- package/layout/layout-nav/README.md +0 -46
- package/layout/layout-nav/layout-nav.component.scss +0 -50
- package/layout/layout-nav-list/layout-nav-list.component.scss +0 -110
- package/layout/layout.component.scss +0 -20
- package/layout/navigation-drawer/navigation-drawer.component.scss +0 -73
- package/menu/covalent-core-menu.metadata.json +0 -1
- package/menu/index.d.ts +0 -1
- package/menu/menu.component.scss +0 -43
- package/message/covalent-core-message.metadata.json +0 -1
- package/message/index.d.ts +0 -1
- package/message/message.component.scss +0 -29
- package/schematics/README.md +0 -66
- package/schematics/collection.json +0 -11
- package/schematics/components.js +0 -111
- package/schematics/components.js.map +0 -1
- package/schematics/migration.json +0 -10
- package/schematics/ng-add/files/theme.scss +0 -64
- package/schematics/ng-add/index.js +0 -58
- package/schematics/ng-add/index.js.map +0 -1
- package/schematics/ng-add/schema.js +0 -3
- package/schematics/ng-add/schema.js.map +0 -1
- package/schematics/ng-add/schema.json +0 -81
- package/schematics/ng-update/index.js +0 -52
- package/schematics/ng-update/index.js.map +0 -1
- package/schematics/ng-update/target-version.js +0 -8
- package/schematics/ng-update/target-version.js.map +0 -1
- package/schematics/version-names.js +0 -6
- package/schematics/version-names.js.map +0 -1
- package/search/covalent-core-search.metadata.json +0 -1
- package/search/index.d.ts +0 -1
- package/search/search-box/README.md +0 -62
- package/search/search-box/search-box.component.scss +0 -32
- package/search/search-input/README.md +0 -65
- package/search/search-input/search-input.component.scss +0 -63
- package/side-sheet/covalent-core-side-sheet.metadata.json +0 -1
- package/side-sheet/index.d.ts +0 -1
- package/side-sheet/side-sheet.scss +0 -69
- package/theming/prebuilt/blue-grey-deep-orange.css +0 -2434
- package/theming/prebuilt/blue-grey-deep-orange.css.map +0 -1
- package/theming/prebuilt/blue-grey-deep-orange.scss +0 -13
- package/theming/prebuilt/blue-orange.css +0 -2434
- package/theming/prebuilt/blue-orange.css.map +0 -1
- package/theming/prebuilt/blue-orange.scss +0 -13
- package/theming/prebuilt/indigo-pink.css +0 -2434
- package/theming/prebuilt/indigo-pink.css.map +0 -1
- package/theming/prebuilt/indigo-pink.scss +0 -13
- package/theming/prebuilt/orange-light-blue.css +0 -2434
- package/theming/prebuilt/orange-light-blue.css.map +0 -1
- package/theming/prebuilt/orange-light-blue.scss +0 -13
- package/theming/prebuilt/teal-orange.css +0 -2434
- package/theming/prebuilt/teal-orange.css.map +0 -1
- package/theming/prebuilt/teal-orange.scss +0 -13
- package/user-profile/covalent-core-user-profile.metadata.json +0 -1
- package/user-profile/index.d.ts +0 -1
- package/user-profile/user-profile-menu/user-profile-menu.component.scss +0 -38
@@ -1,408 +0,0 @@
|
|
1
|
-
(function (global, factory) {
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('@angular/material/tooltip'), require('@angular/material/icon'), require('@angular/cdk/bidi'), require('@covalent/core/common')) :
|
3
|
-
typeof define === 'function' && define.amd ? define('@covalent/core/json-formatter', ['exports', '@angular/core', '@angular/common', '@angular/material/tooltip', '@angular/material/icon', '@angular/cdk/bidi', '@covalent/core/common'], factory) :
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.covalent = global.covalent || {}, global.covalent.core = global.covalent.core || {}, global.covalent.core['json-formatter'] = {}), global.ng.core, global.ng.common, global.ng.material.tooltip, global.ng.material.icon, global.ng.cdk.bidi, global.covalent.core.common));
|
5
|
-
}(this, (function (exports, core, common$1, tooltip, icon, bidi, common) { 'use strict';
|
6
|
-
|
7
|
-
/**
|
8
|
-
* @fileoverview added by tsickle
|
9
|
-
* Generated from: json-formatter.component.ts
|
10
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
11
|
-
*/
|
12
|
-
var TdJsonFormatterComponent = /** @class */ (function () {
|
13
|
-
/**
|
14
|
-
* @param {?} _changeDetectorRef
|
15
|
-
* @param {?} _dir
|
16
|
-
*/
|
17
|
-
function TdJsonFormatterComponent(_changeDetectorRef, _dir) {
|
18
|
-
this._changeDetectorRef = _changeDetectorRef;
|
19
|
-
this._dir = _dir;
|
20
|
-
this._open = false;
|
21
|
-
this._levelsOpen = 0;
|
22
|
-
}
|
23
|
-
Object.defineProperty(TdJsonFormatterComponent.prototype, "levelsOpen", {
|
24
|
-
/**
|
25
|
-
* @return {?}
|
26
|
-
*/
|
27
|
-
get: function () {
|
28
|
-
return this._levelsOpen;
|
29
|
-
},
|
30
|
-
/**
|
31
|
-
* levelsOpen?: number
|
32
|
-
* Levels opened by default when JS object is formatted and rendered.
|
33
|
-
* @param {?} levelsOpen
|
34
|
-
* @return {?}
|
35
|
-
*/
|
36
|
-
set: function (levelsOpen) {
|
37
|
-
if (!Number.isInteger(levelsOpen)) {
|
38
|
-
throw new Error('[levelsOpen] needs to be an integer.');
|
39
|
-
}
|
40
|
-
this._levelsOpen = levelsOpen;
|
41
|
-
this._open = levelsOpen > 0;
|
42
|
-
},
|
43
|
-
enumerable: false,
|
44
|
-
configurable: true
|
45
|
-
});
|
46
|
-
Object.defineProperty(TdJsonFormatterComponent.prototype, "open", {
|
47
|
-
/**
|
48
|
-
* @return {?}
|
49
|
-
*/
|
50
|
-
get: function () {
|
51
|
-
return this._open;
|
52
|
-
},
|
53
|
-
enumerable: false,
|
54
|
-
configurable: true
|
55
|
-
});
|
56
|
-
Object.defineProperty(TdJsonFormatterComponent.prototype, "key", {
|
57
|
-
/**
|
58
|
-
* @return {?}
|
59
|
-
*/
|
60
|
-
get: function () {
|
61
|
-
/** @type {?} */
|
62
|
-
var elipsis = this._key && this._key.length > TdJsonFormatterComponent.KEY_MAX_LENGTH ? '…' : '';
|
63
|
-
return this._key ? this._key.substring(0, TdJsonFormatterComponent.KEY_MAX_LENGTH) + elipsis : this._key;
|
64
|
-
},
|
65
|
-
/**
|
66
|
-
* key?: string
|
67
|
-
* Tag to be displayed next to formatted object.
|
68
|
-
* @param {?} key
|
69
|
-
* @return {?}
|
70
|
-
*/
|
71
|
-
set: function (key) {
|
72
|
-
this._key = key;
|
73
|
-
},
|
74
|
-
enumerable: false,
|
75
|
-
configurable: true
|
76
|
-
});
|
77
|
-
Object.defineProperty(TdJsonFormatterComponent.prototype, "data", {
|
78
|
-
/**
|
79
|
-
* @return {?}
|
80
|
-
*/
|
81
|
-
get: function () {
|
82
|
-
return this._data;
|
83
|
-
},
|
84
|
-
/**
|
85
|
-
* data: any
|
86
|
-
* JS object to be formatted.
|
87
|
-
* @param {?} data
|
88
|
-
* @return {?}
|
89
|
-
*/
|
90
|
-
set: function (data) {
|
91
|
-
this._data = data;
|
92
|
-
this.parseChildren();
|
93
|
-
},
|
94
|
-
enumerable: false,
|
95
|
-
configurable: true
|
96
|
-
});
|
97
|
-
Object.defineProperty(TdJsonFormatterComponent.prototype, "children", {
|
98
|
-
/**
|
99
|
-
* @return {?}
|
100
|
-
*/
|
101
|
-
get: function () {
|
102
|
-
return this._children;
|
103
|
-
},
|
104
|
-
enumerable: false,
|
105
|
-
configurable: true
|
106
|
-
});
|
107
|
-
Object.defineProperty(TdJsonFormatterComponent.prototype, "isRTL", {
|
108
|
-
/**
|
109
|
-
* @return {?}
|
110
|
-
*/
|
111
|
-
get: function () {
|
112
|
-
if (this._dir) {
|
113
|
-
return this._dir.dir === 'rtl';
|
114
|
-
}
|
115
|
-
return false;
|
116
|
-
},
|
117
|
-
enumerable: false,
|
118
|
-
configurable: true
|
119
|
-
});
|
120
|
-
/**
|
121
|
-
* Refreshes json-formatter and rerenders [data]
|
122
|
-
* @return {?}
|
123
|
-
*/
|
124
|
-
TdJsonFormatterComponent.prototype.refresh = function () {
|
125
|
-
this._changeDetectorRef.markForCheck();
|
126
|
-
};
|
127
|
-
/**
|
128
|
-
* Toggles collapse/expanded state of component.
|
129
|
-
* @return {?}
|
130
|
-
*/
|
131
|
-
TdJsonFormatterComponent.prototype.toggle = function () {
|
132
|
-
this._open = !this._open;
|
133
|
-
};
|
134
|
-
/**
|
135
|
-
* @return {?}
|
136
|
-
*/
|
137
|
-
TdJsonFormatterComponent.prototype.isObject = function () {
|
138
|
-
return this.getType(this._data) === 'object';
|
139
|
-
};
|
140
|
-
/**
|
141
|
-
* @return {?}
|
142
|
-
*/
|
143
|
-
TdJsonFormatterComponent.prototype.isArray = function () {
|
144
|
-
return Array.isArray(this._data);
|
145
|
-
};
|
146
|
-
/**
|
147
|
-
* @return {?}
|
148
|
-
*/
|
149
|
-
TdJsonFormatterComponent.prototype.hasChildren = function () {
|
150
|
-
return this._children && this._children.length > 0;
|
151
|
-
};
|
152
|
-
/**
|
153
|
-
* Gets parsed value depending on value type.
|
154
|
-
* @param {?} value
|
155
|
-
* @return {?}
|
156
|
-
*/
|
157
|
-
TdJsonFormatterComponent.prototype.getValue = function (value) {
|
158
|
-
/** @type {?} */
|
159
|
-
var type = this.getType(value);
|
160
|
-
if (type === 'undefined' || type === 'null') {
|
161
|
-
return type;
|
162
|
-
}
|
163
|
-
else if (type === 'date') {
|
164
|
-
value = new Date(value).toString();
|
165
|
-
}
|
166
|
-
else if (type === 'string') {
|
167
|
-
value = '"' + value + '"';
|
168
|
-
}
|
169
|
-
else if (type === 'function') {
|
170
|
-
// Remove content of the function
|
171
|
-
return (value
|
172
|
-
.toString()
|
173
|
-
.replace(/[\r\n]/g, '')
|
174
|
-
.replace(/\{.*\}/, '') + '{…}');
|
175
|
-
}
|
176
|
-
else if (Array.isArray(value)) {
|
177
|
-
return this.getObjectName() + ' [' + value.length + ']';
|
178
|
-
}
|
179
|
-
return value;
|
180
|
-
};
|
181
|
-
/**
|
182
|
-
* Gets type of object.
|
183
|
-
* returns 'null' if object is null and 'date' if value is object and can be parsed to a date.
|
184
|
-
* @param {?} object
|
185
|
-
* @return {?}
|
186
|
-
*/
|
187
|
-
TdJsonFormatterComponent.prototype.getType = function (object) {
|
188
|
-
if (typeof object === 'object') {
|
189
|
-
if (!object) {
|
190
|
-
return 'null';
|
191
|
-
}
|
192
|
-
if (Array.isArray(object)) {
|
193
|
-
return 'object';
|
194
|
-
}
|
195
|
-
/** @type {?} */
|
196
|
-
var date = new Date(object);
|
197
|
-
if (Object.prototype.toString.call(date) === '[object Date]' && !Number.isNaN(date.getTime())) {
|
198
|
-
return 'date';
|
199
|
-
}
|
200
|
-
}
|
201
|
-
return typeof object;
|
202
|
-
};
|
203
|
-
/**
|
204
|
-
* Generates string representation depending if its an object or function.
|
205
|
-
* see: http://stackoverflow.com/a/332429
|
206
|
-
* @return {?}
|
207
|
-
*/
|
208
|
-
TdJsonFormatterComponent.prototype.getObjectName = function () {
|
209
|
-
/** @type {?} */
|
210
|
-
var object = this._data;
|
211
|
-
if (this.isObject() && !object.constructor) {
|
212
|
-
return 'Object';
|
213
|
-
}
|
214
|
-
/** @type {?} */
|
215
|
-
var funcNameRegex = /function (.{1,})\(/;
|
216
|
-
/** @type {?} */
|
217
|
-
var results = funcNameRegex.exec(object.constructor.toString());
|
218
|
-
if (results && results.length > 1) {
|
219
|
-
return results[1];
|
220
|
-
}
|
221
|
-
else {
|
222
|
-
return '';
|
223
|
-
}
|
224
|
-
};
|
225
|
-
/**
|
226
|
-
* Creates preview of nodes children to render in tooltip depending if its an array or an object.
|
227
|
-
* @return {?}
|
228
|
-
*/
|
229
|
-
TdJsonFormatterComponent.prototype.getPreview = function () {
|
230
|
-
var _this = this;
|
231
|
-
/** @type {?} */
|
232
|
-
var previewData;
|
233
|
-
/** @type {?} */
|
234
|
-
var startChar = '{ ';
|
235
|
-
/** @type {?} */
|
236
|
-
var endChar = ' }';
|
237
|
-
if (this.isArray()) {
|
238
|
-
/** @type {?} */
|
239
|
-
var previewArray = this._data.slice(0, TdJsonFormatterComponent.PREVIEW_LIMIT);
|
240
|
-
previewData = previewArray.map(( /**
|
241
|
-
* @param {?} obj
|
242
|
-
* @return {?}
|
243
|
-
*/function (obj) {
|
244
|
-
return _this.getValue(obj);
|
245
|
-
}));
|
246
|
-
startChar = '[';
|
247
|
-
endChar = ']';
|
248
|
-
}
|
249
|
-
else {
|
250
|
-
/** @type {?} */
|
251
|
-
var previewKeys = this._children.slice(0, TdJsonFormatterComponent.PREVIEW_LIMIT);
|
252
|
-
previewData = previewKeys.map(( /**
|
253
|
-
* @param {?} key
|
254
|
-
* @return {?}
|
255
|
-
*/function (key) {
|
256
|
-
return key + ': ' + _this.getValue(_this._data[key]);
|
257
|
-
}));
|
258
|
-
}
|
259
|
-
/** @type {?} */
|
260
|
-
var previewString = previewData.join(', ');
|
261
|
-
/** @type {?} */
|
262
|
-
var ellipsis = previewData.length >= TdJsonFormatterComponent.PREVIEW_LIMIT ||
|
263
|
-
previewString.length > TdJsonFormatterComponent.PREVIEW_STRING_MAX_LENGTH
|
264
|
-
? '…'
|
265
|
-
: '';
|
266
|
-
return (startChar + previewString.substring(0, TdJsonFormatterComponent.PREVIEW_STRING_MAX_LENGTH) + ellipsis + endChar);
|
267
|
-
};
|
268
|
-
/**
|
269
|
-
* @private
|
270
|
-
* @return {?}
|
271
|
-
*/
|
272
|
-
TdJsonFormatterComponent.prototype.parseChildren = function () {
|
273
|
-
if (this.isObject()) {
|
274
|
-
this._children = Object.keys(this._data);
|
275
|
-
}
|
276
|
-
};
|
277
|
-
return TdJsonFormatterComponent;
|
278
|
-
}());
|
279
|
-
/**
|
280
|
-
* Max length for property names. Any names bigger than this get trunctated.
|
281
|
-
*/
|
282
|
-
TdJsonFormatterComponent.KEY_MAX_LENGTH = 30;
|
283
|
-
/**
|
284
|
-
* Max length for preview string. Any names bigger than this get trunctated.
|
285
|
-
*/
|
286
|
-
TdJsonFormatterComponent.PREVIEW_STRING_MAX_LENGTH = 80;
|
287
|
-
/**
|
288
|
-
* Max tooltip preview elements.
|
289
|
-
*/
|
290
|
-
TdJsonFormatterComponent.PREVIEW_LIMIT = 5;
|
291
|
-
TdJsonFormatterComponent.decorators = [
|
292
|
-
{ type: core.Component, args: [{
|
293
|
-
changeDetection: core.ChangeDetectionStrategy.OnPush,
|
294
|
-
selector: 'td-json-formatter',
|
295
|
-
template: "<div class=\"td-json-formatter-wrapper\">\n <a\n class=\"td-key\"\n [class.td-key-node]=\"hasChildren()\"\n [class.td-key-leaf]=\"!hasChildren()\"\n [tabIndex]=\"isObject() ? 0 : -1\"\n (keydown.enter)=\"toggle()\"\n (click)=\"toggle()\"\n >\n <mat-icon class=\"td-node-icon\" *ngIf=\"hasChildren()\">\n {{ open ? 'keyboard_arrow_down' : isRTL ? 'keyboard_arrow_left' : 'keyboard_arrow_right' }}\n </mat-icon>\n <span *ngIf=\"key\" class=\"key\">{{ key }}:</span>\n <span class=\"value\">\n <span [class.td-empty]=\"!hasChildren()\" *ngIf=\"isObject()\" [matTooltip]=\"getPreview()\" matTooltipPosition=\"after\">\n <span class=\"td-object-name\">{{ getObjectName() }}</span>\n <span class=\"td-array-length\" *ngIf=\"isArray()\">[{{ data.length }}]</span>\n </span>\n <span *ngIf=\"!isObject()\" [class]=\"getType(data)\">{{ getValue(data) }}</span>\n </span>\n </a>\n <div class=\"td-object-children\" [@tdCollapse]=\"!(hasChildren() && open)\">\n <ng-template let-key ngFor [ngForOf]=\"children\">\n <td-json-formatter [key]=\"key\" [data]=\"data[key]\" [levelsOpen]=\"levelsOpen - 1\"></td-json-formatter>\n </ng-template>\n </div>\n</div>\n",
|
296
|
-
animations: [common.tdCollapseAnimation],
|
297
|
-
styles: [":host{display:block}.td-json-formatter-wrapper{padding-bottom:2px;padding-top:2px}.td-json-formatter-wrapper .td-key{-ms-flex-align:start;-ms-flex-direction:row;-ms-flex-line-pack:center;-ms-flex-pack:start;align-content:center;align-items:flex-start;box-sizing:border-box;display:-ms-flexbox;display:flex;flex-direction:row;justify-content:flex-start;max-width:100%}.td-json-formatter-wrapper .td-key.td-key-node:hover{cursor:pointer}.td-json-formatter-wrapper .td-object-children.ng-animating{overflow:hidden}.td-json-formatter-wrapper .td-object-children .td-key,.td-json-formatter-wrapper .td-object-children .td-object-children{padding-left:24px}::ng-deep [dir=rtl] .td-json-formatter-wrapper .td-object-children .td-key,::ng-deep [dir=rtl] .td-json-formatter-wrapper .td-object-children .td-object-children{padding-left:0;padding-right:24px}.td-json-formatter-wrapper .td-object-children .td-key.td-key-leaf,.td-json-formatter-wrapper .td-object-children .td-object-children.td-key-leaf{padding-left:48px}::ng-deep [dir=rtl] .td-json-formatter-wrapper .td-object-children .td-key.td-key-leaf,::ng-deep [dir=rtl] .td-json-formatter-wrapper .td-object-children .td-object-children.td-key-leaf{padding-left:0;padding-right:48px}.td-json-formatter-wrapper .value{margin-left:5px}::ng-deep [dir=rtl] .td-json-formatter-wrapper .value{padding-left:0;padding-right:5px}.td-json-formatter-wrapper .value .td-empty{opacity:.5;text-decoration:line-through}.td-json-formatter-wrapper .value .date,.td-json-formatter-wrapper .value .string{word-break:break-word}"]
|
298
|
-
}] }
|
299
|
-
];
|
300
|
-
/** @nocollapse */
|
301
|
-
TdJsonFormatterComponent.ctorParameters = function () { return [
|
302
|
-
{ type: core.ChangeDetectorRef },
|
303
|
-
{ type: bidi.Dir, decorators: [{ type: core.Optional }] }
|
304
|
-
]; };
|
305
|
-
TdJsonFormatterComponent.propDecorators = {
|
306
|
-
levelsOpen: [{ type: core.Input, args: ['levelsOpen',] }],
|
307
|
-
key: [{ type: core.Input, args: ['key',] }],
|
308
|
-
data: [{ type: core.Input, args: ['data',] }]
|
309
|
-
};
|
310
|
-
if (false) {
|
311
|
-
/**
|
312
|
-
* Max length for property names. Any names bigger than this get trunctated.
|
313
|
-
* @type {?}
|
314
|
-
* @private
|
315
|
-
*/
|
316
|
-
TdJsonFormatterComponent.KEY_MAX_LENGTH;
|
317
|
-
/**
|
318
|
-
* Max length for preview string. Any names bigger than this get trunctated.
|
319
|
-
* @type {?}
|
320
|
-
* @private
|
321
|
-
*/
|
322
|
-
TdJsonFormatterComponent.PREVIEW_STRING_MAX_LENGTH;
|
323
|
-
/**
|
324
|
-
* Max tooltip preview elements.
|
325
|
-
* @type {?}
|
326
|
-
* @private
|
327
|
-
*/
|
328
|
-
TdJsonFormatterComponent.PREVIEW_LIMIT;
|
329
|
-
/**
|
330
|
-
* @type {?}
|
331
|
-
* @private
|
332
|
-
*/
|
333
|
-
TdJsonFormatterComponent.prototype._key;
|
334
|
-
/**
|
335
|
-
* @type {?}
|
336
|
-
* @private
|
337
|
-
*/
|
338
|
-
TdJsonFormatterComponent.prototype._data;
|
339
|
-
/**
|
340
|
-
* @type {?}
|
341
|
-
* @private
|
342
|
-
*/
|
343
|
-
TdJsonFormatterComponent.prototype._children;
|
344
|
-
/**
|
345
|
-
* @type {?}
|
346
|
-
* @private
|
347
|
-
*/
|
348
|
-
TdJsonFormatterComponent.prototype._open;
|
349
|
-
/**
|
350
|
-
* @type {?}
|
351
|
-
* @private
|
352
|
-
*/
|
353
|
-
TdJsonFormatterComponent.prototype._levelsOpen;
|
354
|
-
/**
|
355
|
-
* @type {?}
|
356
|
-
* @private
|
357
|
-
*/
|
358
|
-
TdJsonFormatterComponent.prototype._changeDetectorRef;
|
359
|
-
/**
|
360
|
-
* @type {?}
|
361
|
-
* @private
|
362
|
-
*/
|
363
|
-
TdJsonFormatterComponent.prototype._dir;
|
364
|
-
}
|
365
|
-
|
366
|
-
/**
|
367
|
-
* @fileoverview added by tsickle
|
368
|
-
* Generated from: json-formatter.module.ts
|
369
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
370
|
-
*/
|
371
|
-
var CovalentJsonFormatterModule = /** @class */ (function () {
|
372
|
-
function CovalentJsonFormatterModule() {
|
373
|
-
}
|
374
|
-
return CovalentJsonFormatterModule;
|
375
|
-
}());
|
376
|
-
CovalentJsonFormatterModule.decorators = [
|
377
|
-
{ type: core.NgModule, args: [{
|
378
|
-
imports: [common$1.CommonModule, tooltip.MatTooltipModule, icon.MatIconModule],
|
379
|
-
declarations: [TdJsonFormatterComponent],
|
380
|
-
exports: [TdJsonFormatterComponent],
|
381
|
-
},] }
|
382
|
-
];
|
383
|
-
|
384
|
-
/**
|
385
|
-
* @fileoverview added by tsickle
|
386
|
-
* Generated from: public-api.ts
|
387
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
388
|
-
*/
|
389
|
-
|
390
|
-
/**
|
391
|
-
* @fileoverview added by tsickle
|
392
|
-
* Generated from: index.ts
|
393
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
394
|
-
*/
|
395
|
-
|
396
|
-
/**
|
397
|
-
* @fileoverview added by tsickle
|
398
|
-
* Generated from: covalent-core-json-formatter.ts
|
399
|
-
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
400
|
-
*/
|
401
|
-
|
402
|
-
exports.CovalentJsonFormatterModule = CovalentJsonFormatterModule;
|
403
|
-
exports.TdJsonFormatterComponent = TdJsonFormatterComponent;
|
404
|
-
|
405
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
406
|
-
|
407
|
-
})));
|
408
|
-
//# sourceMappingURL=covalent-core-json-formatter.umd.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"covalent-core-json-formatter.umd.js","sources":["../../../../src/platform/core/json-formatter/json-formatter.component.ts","../../../../src/platform/core/json-formatter/json-formatter.module.ts"],"sourcesContent":["import { Component, Input, ChangeDetectionStrategy, ChangeDetectorRef, Optional } from '@angular/core';\nimport { Dir } from '@angular/cdk/bidi';\nimport { tdCollapseAnimation } from '@covalent/core/common';\n\n@Component({\n changeDetection: ChangeDetectionStrategy.OnPush,\n selector: 'td-json-formatter',\n styleUrls: ['./json-formatter.component.scss'],\n templateUrl: './json-formatter.component.html',\n animations: [tdCollapseAnimation],\n})\nexport class TdJsonFormatterComponent {\n /**\n * Max length for property names. Any names bigger than this get trunctated.\n */\n private static KEY_MAX_LENGTH: number = 30;\n\n /**\n * Max length for preview string. Any names bigger than this get trunctated.\n */\n private static PREVIEW_STRING_MAX_LENGTH: number = 80;\n\n /**\n * Max tooltip preview elements.\n */\n private static PREVIEW_LIMIT: number = 5;\n\n private _key: string;\n private _data: any;\n private _children: string[];\n private _open: boolean = false;\n private _levelsOpen: number = 0;\n\n /**\n * levelsOpen?: number\n * Levels opened by default when JS object is formatted and rendered.\n */\n @Input('levelsOpen')\n set levelsOpen(levelsOpen: number) {\n if (!Number.isInteger(levelsOpen)) {\n throw new Error('[levelsOpen] needs to be an integer.');\n }\n this._levelsOpen = levelsOpen;\n this._open = levelsOpen > 0;\n }\n get levelsOpen(): number {\n return this._levelsOpen;\n }\n\n get open(): boolean {\n return this._open;\n }\n\n /**\n * key?: string\n * Tag to be displayed next to formatted object.\n */\n @Input('key')\n set key(key: string) {\n this._key = key;\n }\n get key(): string {\n const elipsis: string = this._key && this._key.length > TdJsonFormatterComponent.KEY_MAX_LENGTH ? '…' : '';\n return this._key ? this._key.substring(0, TdJsonFormatterComponent.KEY_MAX_LENGTH) + elipsis : this._key;\n }\n\n /**\n * data: any\n * JS object to be formatted.\n */\n @Input('data')\n set data(data: any) {\n this._data = data;\n this.parseChildren();\n }\n get data(): any {\n return this._data;\n }\n\n get children(): string[] {\n return this._children;\n }\n\n get isRTL(): boolean {\n if (this._dir) {\n return this._dir.dir === 'rtl';\n }\n return false;\n }\n\n constructor(private _changeDetectorRef: ChangeDetectorRef, @Optional() private _dir: Dir) {}\n\n /**\n * Refreshes json-formatter and rerenders [data]\n */\n refresh(): void {\n this._changeDetectorRef.markForCheck();\n }\n\n /**\n * Toggles collapse/expanded state of component.\n */\n toggle(): void {\n this._open = !this._open;\n }\n\n isObject(): boolean {\n return this.getType(this._data) === 'object';\n }\n\n isArray(): boolean {\n return Array.isArray(this._data);\n }\n\n hasChildren(): boolean {\n return this._children && this._children.length > 0;\n }\n\n /**\n * Gets parsed value depending on value type.\n */\n getValue(value: any): string {\n const type: string = this.getType(value);\n if (type === 'undefined' || type === 'null') {\n return type;\n } else if (type === 'date') {\n value = new Date(value).toString();\n } else if (type === 'string') {\n value = '\"' + value + '\"';\n } else if (type === 'function') {\n // Remove content of the function\n return (\n value\n .toString()\n .replace(/[\\r\\n]/g, '')\n .replace(/\\{.*\\}/, '') + '{…}'\n );\n } else if (Array.isArray(value)) {\n return this.getObjectName() + ' [' + value.length + ']';\n }\n return value;\n }\n\n /**\n * Gets type of object.\n * returns 'null' if object is null and 'date' if value is object and can be parsed to a date.\n */\n getType(object: any): string {\n if (typeof object === 'object') {\n if (!object) {\n return 'null';\n }\n if (Array.isArray(object)) {\n return 'object';\n }\n const date: Date = new Date(object);\n if (Object.prototype.toString.call(date) === '[object Date]' && !Number.isNaN(date.getTime())) {\n return 'date';\n }\n }\n return typeof object;\n }\n\n /**\n * Generates string representation depending if its an object or function.\n * see: http://stackoverflow.com/a/332429\n */\n getObjectName(): string {\n const object: any = this._data;\n if (this.isObject() && !object.constructor) {\n return 'Object';\n }\n const funcNameRegex: RegExp = /function (.{1,})\\(/;\n const results: RegExpExecArray = funcNameRegex.exec(object.constructor.toString());\n if (results && results.length > 1) {\n return results[1];\n } else {\n return '';\n }\n }\n\n /**\n * Creates preview of nodes children to render in tooltip depending if its an array or an object.\n */\n getPreview(): string {\n let previewData: string[];\n let startChar: string = '{ ';\n let endChar: string = ' }';\n if (this.isArray()) {\n const previewArray: any[] = this._data.slice(0, TdJsonFormatterComponent.PREVIEW_LIMIT);\n previewData = previewArray.map((obj: any) => {\n return this.getValue(obj);\n });\n startChar = '[';\n endChar = ']';\n } else {\n const previewKeys: string[] = this._children.slice(0, TdJsonFormatterComponent.PREVIEW_LIMIT);\n previewData = previewKeys.map((key: string) => {\n return key + ': ' + this.getValue(this._data[key]);\n });\n }\n const previewString: string = previewData.join(', ');\n const ellipsis: string =\n previewData.length >= TdJsonFormatterComponent.PREVIEW_LIMIT ||\n previewString.length > TdJsonFormatterComponent.PREVIEW_STRING_MAX_LENGTH\n ? '…'\n : '';\n return (\n startChar + previewString.substring(0, TdJsonFormatterComponent.PREVIEW_STRING_MAX_LENGTH) + ellipsis + endChar\n );\n }\n\n private parseChildren(): void {\n if (this.isObject()) {\n this._children = Object.keys(this._data);\n }\n }\n}\n","import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\n\nimport { MatTooltipModule } from '@angular/material/tooltip';\nimport { MatIconModule } from '@angular/material/icon';\n\nimport { TdJsonFormatterComponent } from './json-formatter.component';\n\n@NgModule({\n imports: [CommonModule, MatTooltipModule, MatIconModule],\n declarations: [TdJsonFormatterComponent],\n exports: [TdJsonFormatterComponent],\n})\nexport class CovalentJsonFormatterModule {}\n"],"names":["Component","ChangeDetectionStrategy","tdCollapseAnimation","ChangeDetectorRef","Dir","Optional","Input","NgModule","CommonModule","MatTooltipModule","MatIconModule"],"mappings":";;;;;;;;;;;;;;;;QA0FE,kCAAoB,kBAAqC,EAAsB,IAAS;YAApE,uBAAkB,GAAlB,kBAAkB,CAAmB;YAAsB,SAAI,GAAJ,IAAI,CAAK;YA5DhF,UAAK,GAAY,KAAK,CAAC;YACvB,gBAAW,GAAW,CAAC,CAAC;SA2D4D;QArD5F,sBACI,gDAAU;;;;iBAOd;gBACE,OAAO,IAAI,CAAC,WAAW,CAAC;aACzB;;;;;;;iBAVD,UACe,U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AG,uBAyFkDC,aAAQ;;;6BArDnEC,UAAK,SAAC,YAAY;sBAoBlBA,UAAK,SAAC,KAAK;uBAaXA,UAAK,SAAC,MAAM;;;;;;;;QAvDb,wCAA2C;;;;;;QAK3C,mDAAsD;;;;;;QAKtD,uCAAyC;;;;;QAEzC,wCAAqB;;;;;QACrB,yCAAmB;;;;;QACnB,6CAA4B;;;;;QAC5B,yCAA+B;;;;;QAC/B,+CAAgC;;;;;QA2DpB,sDAA6C;;;;;QAAE,wCAA6B;;;;;;;;;QC7E1F;;;;;gBALCC,aAAQ,SAAC;oBACR,OAAO,EAAE,CAACC,qBAAY,EAAEC,wBAAgB,EAAEC,kBAAa,CAAC;oBACxD,YAAY,EAAE,CAAC,wBAAwB,CAAC;oBACxC,OAAO,EAAE,CAAC,wBAAwB,CAAC;iBACpC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
@@ -1,2 +0,0 @@
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("@angular/common"),require("@angular/material/tooltip"),require("@angular/material/icon"),require("@angular/cdk/bidi"),require("@covalent/core/common")):"function"==typeof define&&define.amd?define("@covalent/core/json-formatter",["exports","@angular/core","@angular/common","@angular/material/tooltip","@angular/material/icon","@angular/cdk/bidi","@covalent/core/common"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).covalent=e.covalent||{},e.covalent.core=e.covalent.core||{},e.covalent.core["json-formatter"]={}),e.ng.core,e.ng.common,e.ng.material.tooltip,e.ng.material.icon,e.ng.cdk.bidi,e.covalent.core.common)}(this,(function(e,t,r,n,o,a,i){"use strict";var d=function(){function e(e,t){this._changeDetectorRef=e,this._dir=t,this._open=!1,this._levelsOpen=0}return Object.defineProperty(e.prototype,"levelsOpen",{get:function(){return this._levelsOpen},set:function(e){if(!Number.isInteger(e))throw new Error("[levelsOpen] needs to be an integer.");this._levelsOpen=e,this._open=e>0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"open",{get:function(){return this._open},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"key",{get:function(){var t=this._key&&this._key.length>e.KEY_MAX_LENGTH?"…":"";return this._key?this._key.substring(0,e.KEY_MAX_LENGTH)+t:this._key},set:function(e){this._key=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"data",{get:function(){return this._data},set:function(e){this._data=e,this.parseChildren()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"children",{get:function(){return this._children},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isRTL",{get:function(){return!!this._dir&&"rtl"===this._dir.dir},enumerable:!1,configurable:!0}),e.prototype.refresh=function(){this._changeDetectorRef.markForCheck()},e.prototype.toggle=function(){this._open=!this._open},e.prototype.isObject=function(){return"object"===this.getType(this._data)},e.prototype.isArray=function(){return Array.isArray(this._data)},e.prototype.hasChildren=function(){return this._children&&this._children.length>0},e.prototype.getValue=function(e){var t=this.getType(e);if("undefined"===t||"null"===t)return t;if("date"===t)e=new Date(e).toString();else if("string"===t)e='"'+e+'"';else{if("function"===t)return e.toString().replace(/[\r\n]/g,"").replace(/\{.*\}/,"")+"{…}";if(Array.isArray(e))return this.getObjectName()+" ["+e.length+"]"}return e},e.prototype.getType=function(e){if("object"==typeof e){if(!e)return"null";if(Array.isArray(e))return"object";var t=new Date(e);if("[object Date]"===Object.prototype.toString.call(t)&&!Number.isNaN(t.getTime()))return"date"}return typeof e},e.prototype.getObjectName=function(){var e=this._data;if(this.isObject()&&!e.constructor)return"Object";var t=/function (.{1,})\(/.exec(e.constructor.toString());return t&&t.length>1?t[1]:""},e.prototype.getPreview=function(){var t,r=this,n="{ ",o=" }";this.isArray()?(t=this._data.slice(0,e.PREVIEW_LIMIT).map((function(e){return r.getValue(e)})),n="[",o="]"):t=this._children.slice(0,e.PREVIEW_LIMIT).map((function(e){return e+": "+r.getValue(r._data[e])}));var a=t.join(", "),i=t.length>=e.PREVIEW_LIMIT||a.length>e.PREVIEW_STRING_MAX_LENGTH?"…":"";return n+a.substring(0,e.PREVIEW_STRING_MAX_LENGTH)+i+o},e.prototype.parseChildren=function(){this.isObject()&&(this._children=Object.keys(this._data))},e}();d.KEY_MAX_LENGTH=30,d.PREVIEW_STRING_MAX_LENGTH=80,d.PREVIEW_LIMIT=5,d.decorators=[{type:t.Component,args:[{changeDetection:t.ChangeDetectionStrategy.OnPush,selector:"td-json-formatter",template:'<div class="td-json-formatter-wrapper">\n <a\n class="td-key"\n [class.td-key-node]="hasChildren()"\n [class.td-key-leaf]="!hasChildren()"\n [tabIndex]="isObject() ? 0 : -1"\n (keydown.enter)="toggle()"\n (click)="toggle()"\n >\n <mat-icon class="td-node-icon" *ngIf="hasChildren()">\n {{ open ? \'keyboard_arrow_down\' : isRTL ? \'keyboard_arrow_left\' : \'keyboard_arrow_right\' }}\n </mat-icon>\n <span *ngIf="key" class="key">{{ key }}:</span>\n <span class="value">\n <span [class.td-empty]="!hasChildren()" *ngIf="isObject()" [matTooltip]="getPreview()" matTooltipPosition="after">\n <span class="td-object-name">{{ getObjectName() }}</span>\n <span class="td-array-length" *ngIf="isArray()">[{{ data.length }}]</span>\n </span>\n <span *ngIf="!isObject()" [class]="getType(data)">{{ getValue(data) }}</span>\n </span>\n </a>\n <div class="td-object-children" [@tdCollapse]="!(hasChildren() && open)">\n <ng-template let-key ngFor [ngForOf]="children">\n <td-json-formatter [key]="key" [data]="data[key]" [levelsOpen]="levelsOpen - 1"></td-json-formatter>\n </ng-template>\n </div>\n</div>\n',animations:[i.tdCollapseAnimation],styles:[":host{display:block}.td-json-formatter-wrapper{padding-bottom:2px;padding-top:2px}.td-json-formatter-wrapper .td-key{-ms-flex-align:start;-ms-flex-direction:row;-ms-flex-line-pack:center;-ms-flex-pack:start;align-content:center;align-items:flex-start;box-sizing:border-box;display:-ms-flexbox;display:flex;flex-direction:row;justify-content:flex-start;max-width:100%}.td-json-formatter-wrapper .td-key.td-key-node:hover{cursor:pointer}.td-json-formatter-wrapper .td-object-children.ng-animating{overflow:hidden}.td-json-formatter-wrapper .td-object-children .td-key,.td-json-formatter-wrapper .td-object-children .td-object-children{padding-left:24px}::ng-deep [dir=rtl] .td-json-formatter-wrapper .td-object-children .td-key,::ng-deep [dir=rtl] .td-json-formatter-wrapper .td-object-children .td-object-children{padding-left:0;padding-right:24px}.td-json-formatter-wrapper .td-object-children .td-key.td-key-leaf,.td-json-formatter-wrapper .td-object-children .td-object-children.td-key-leaf{padding-left:48px}::ng-deep [dir=rtl] .td-json-formatter-wrapper .td-object-children .td-key.td-key-leaf,::ng-deep [dir=rtl] .td-json-formatter-wrapper .td-object-children .td-object-children.td-key-leaf{padding-left:0;padding-right:48px}.td-json-formatter-wrapper .value{margin-left:5px}::ng-deep [dir=rtl] .td-json-formatter-wrapper .value{padding-left:0;padding-right:5px}.td-json-formatter-wrapper .value .td-empty{opacity:.5;text-decoration:line-through}.td-json-formatter-wrapper .value .date,.td-json-formatter-wrapper .value .string{word-break:break-word}"]}]}],d.ctorParameters=function(){return[{type:t.ChangeDetectorRef},{type:a.Dir,decorators:[{type:t.Optional}]}]},d.propDecorators={levelsOpen:[{type:t.Input,args:["levelsOpen"]}],key:[{type:t.Input,args:["key"]}],data:[{type:t.Input,args:["data"]}]};var l=function(){};l.decorators=[{type:t.NgModule,args:[{imports:[r.CommonModule,n.MatTooltipModule,o.MatIconModule],declarations:[d],exports:[d]}]}],e.CovalentJsonFormatterModule=l,e.TdJsonFormatterComponent=d,Object.defineProperty(e,"__esModule",{value:!0})}));
|
2
|
-
//# sourceMappingURL=covalent-core-json-formatter.umd.min.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"sources":["../../../../src/platform/core/json-formatter/json-formatter.component.ts","../../../../src/platform/core/json-formatter/json-formatter.module.ts"],"names":["TdJsonFormatterComponent","_changeDetectorRef","_dir","this","_open","_levelsOpen","Object","defineProperty","prototype","levelsOpen","Number","isInteger","Error","elipsis","_key","length","KEY_MAX_LENGTH","substring","key","_data","data","parseChildren","_children","dir","refresh","markForCheck","toggle","isObject","getType","isArray","Array","hasChildren","getValue","value","type","Date","toString","replace","getObjectName","object","date","call","isNaN","getTime","constructor","results","exec","getPreview","previewData","_this","startChar","endChar","slice","PREVIEW_LIMIT","map","obj","previewString","join","ellipsis","PREVIEW_STRING_MAX_LENGTH","keys","Component","args","changeDetection","ChangeDetectionStrategy","OnPush","selector","template","animations","tdCollapseAnimation","ChangeDetectorRef","Dir","decorators","Optional","Input","NgModule","imports","CommonModule","MatTooltipModule","MatIconModule","declarations","exports"],"mappings":"oyBA0FE,SAAAA,EAAoBC,EAA2DC,GAA3DC,KAAAF,mBAAAA,EAA2DE,KAAAD,KAAAA,EA5DvEC,KAAAC,OAAiB,EACjBD,KAAAE,YAAsB,SAM9BC,OAAAC,eACIP,EAAAQ,UAAA,aAAU,KAOd,WACE,OAAOL,KAAKE,iBATd,SACeI,GACb,IAAKC,OAAOC,UAAUF,GACpB,MAAM,IAAIG,MAAM,wCAElBT,KAAKE,YAAcI,EACnBN,KAAKC,MAAQK,EAAa,mCAM5BH,OAAAC,eAAIP,EAAAQ,UAAA,OAAI,KAAR,WACE,OAAOL,KAAKC,uCAOdE,OAAAC,eACIP,EAAAQ,UAAA,MAAG,KAGP,eACQK,EAAkBV,KAAKW,MAAQX,KAAKW,KAAKC,OAASf,EAAyBgB,eAAiB,IAAM,GACxG,OAAOb,KAAKW,KAAOX,KAAKW,KAAKG,UAAU,EAAGjB,EAAyBgB,gBAAkBH,EAAUV,KAAKW,UANtG,SACQI,GACNf,KAAKW,KAAOI,mCAWdZ,OAAAC,eACIP,EAAAQ,UAAA,OAAI,KAIR,WACE,OAAOL,KAAKgB,WANd,SACSC,GACPjB,KAAKgB,MAAQC,EACbjB,KAAKkB,iDAMPf,OAAAC,eAAIP,EAAAQ,UAAA,WAAQ,KAAZ,WACE,OAAOL,KAAKmB,2CAGdhB,OAAAC,eAAIP,EAAAQ,UAAA,QAAK,KAAT,WACE,QAAIL,KAAKD,MACkB,QAAl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, ChangeDetectorRef, Optional } from '@angular/core';\nimport { Dir } from '@angular/cdk/bidi';\nimport { tdCollapseAnimation } from '@covalent/core/common';\n\n@Component({\n changeDetection: ChangeDetectionStrategy.OnPush,\n selector: 'td-json-formatter',\n styleUrls: ['./json-formatter.component.scss'],\n templateUrl: './json-formatter.component.html',\n animations: [tdCollapseAnimation],\n})\nexport class TdJsonFormatterComponent {\n /**\n * Max length for property names. Any names bigger than this get trunctated.\n */\n private static KEY_MAX_LENGTH: number = 30;\n\n /**\n * Max length for preview string. Any names bigger than this get trunctated.\n */\n private static PREVIEW_STRING_MAX_LENGTH: number = 80;\n\n /**\n * Max tooltip preview elements.\n */\n private static PREVIEW_LIMIT: number = 5;\n\n private _key: string;\n private _data: any;\n private _children: string[];\n private _open: boolean = false;\n private _levelsOpen: number = 0;\n\n /**\n * levelsOpen?: number\n * Levels opened by default when JS object is formatted and rendered.\n */\n @Input('levelsOpen')\n set levelsOpen(levelsOpen: number) {\n if (!Number.isInteger(levelsOpen)) {\n throw new Error('[levelsOpen] needs to be an integer.');\n }\n this._levelsOpen = levelsOpen;\n this._open = levelsOpen > 0;\n }\n get levelsOpen(): number {\n return this._levelsOpen;\n }\n\n get open(): boolean {\n return this._open;\n }\n\n /**\n * key?: string\n * Tag to be displayed next to formatted object.\n */\n @Input('key')\n set key(key: string) {\n this._key = key;\n }\n get key(): string {\n const elipsis: string = this._key && this._key.length > TdJsonFormatterComponent.KEY_MAX_LENGTH ? '…' : '';\n return this._key ? this._key.substring(0, TdJsonFormatterComponent.KEY_MAX_LENGTH) + elipsis : this._key;\n }\n\n /**\n * data: any\n * JS object to be formatted.\n */\n @Input('data')\n set data(data: any) {\n this._data = data;\n this.parseChildren();\n }\n get data(): any {\n return this._data;\n }\n\n get children(): string[] {\n return this._children;\n }\n\n get isRTL(): boolean {\n if (this._dir) {\n return this._dir.dir === 'rtl';\n }\n return false;\n }\n\n constructor(private _changeDetectorRef: ChangeDetectorRef, @Optional() private _dir: Dir) {}\n\n /**\n * Refreshes json-formatter and rerenders [data]\n */\n refresh(): void {\n this._changeDetectorRef.markForCheck();\n }\n\n /**\n * Toggles collapse/expanded state of component.\n */\n toggle(): void {\n this._open = !this._open;\n }\n\n isObject(): boolean {\n return this.getType(this._data) === 'object';\n }\n\n isArray(): boolean {\n return Array.isArray(this._data);\n }\n\n hasChildren(): boolean {\n return this._children && this._children.length > 0;\n }\n\n /**\n * Gets parsed value depending on value type.\n */\n getValue(value: any): string {\n const type: string = this.getType(value);\n if (type === 'undefined' || type === 'null') {\n return type;\n } else if (type === 'date') {\n value = new Date(value).toString();\n } else if (type === 'string') {\n value = '\"' + value + '\"';\n } else if (type === 'function') {\n // Remove content of the function\n return (\n value\n .toString()\n .replace(/[\\r\\n]/g, '')\n .replace(/\\{.*\\}/, '') + '{…}'\n );\n } else if (Array.isArray(value)) {\n return this.getObjectName() + ' [' + value.length + ']';\n }\n return value;\n }\n\n /**\n * Gets type of object.\n * returns 'null' if object is null and 'date' if value is object and can be parsed to a date.\n */\n getType(object: any): string {\n if (typeof object === 'object') {\n if (!object) {\n return 'null';\n }\n if (Array.isArray(object)) {\n return 'object';\n }\n const date: Date = new Date(object);\n if (Object.prototype.toString.call(date) === '[object Date]' && !Number.isNaN(date.getTime())) {\n return 'date';\n }\n }\n return typeof object;\n }\n\n /**\n * Generates string representation depending if its an object or function.\n * see: http://stackoverflow.com/a/332429\n */\n getObjectName(): string {\n const object: any = this._data;\n if (this.isObject() && !object.constructor) {\n return 'Object';\n }\n const funcNameRegex: RegExp = /function (.{1,})\\(/;\n const results: RegExpExecArray = funcNameRegex.exec(object.constructor.toString());\n if (results && results.length > 1) {\n return results[1];\n } else {\n return '';\n }\n }\n\n /**\n * Creates preview of nodes children to render in tooltip depending if its an array or an object.\n */\n getPreview(): string {\n let previewData: string[];\n let startChar: string = '{ ';\n let endChar: string = ' }';\n if (this.isArray()) {\n const previewArray: any[] = this._data.slice(0, TdJsonFormatterComponent.PREVIEW_LIMIT);\n previewData = previewArray.map((obj: any) => {\n return this.getValue(obj);\n });\n startChar = '[';\n endChar = ']';\n } else {\n const previewKeys: string[] = this._children.slice(0, TdJsonFormatterComponent.PREVIEW_LIMIT);\n previewData = previewKeys.map((key: string) => {\n return key + ': ' + this.getValue(this._data[key]);\n });\n }\n const previewString: string = previewData.join(', ');\n const ellipsis: string =\n previewData.length >= TdJsonFormatterComponent.PREVIEW_LIMIT ||\n previewString.length > TdJsonFormatterComponent.PREVIEW_STRING_MAX_LENGTH\n ? '…'\n : '';\n return (\n startChar + previewString.substring(0, TdJsonFormatterComponent.PREVIEW_STRING_MAX_LENGTH) + ellipsis + endChar\n );\n }\n\n private parseChildren(): void {\n if (this.isObject()) {\n this._children = Object.keys(this._data);\n }\n }\n}\n","import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\n\nimport { MatTooltipModule } from '@angular/material/tooltip';\nimport { MatIconModule } from '@angular/material/icon';\n\nimport { TdJsonFormatterComponent } from './json-formatter.component';\n\n@NgModule({\n imports: [CommonModule, MatTooltipModule, MatIconModule],\n declarations: [TdJsonFormatterComponent],\n exports: [TdJsonFormatterComponent],\n})\nexport class CovalentJsonFormatterModule {}\n"]}
|