@ojiepermana/angular 22.1.11 → 22.1.12
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 +32 -26
- package/chart/README.md +272 -0
- package/component/README.md +89 -0
- package/component/accordion/README.md +195 -0
- package/component/alert/README.md +184 -0
- package/component/alert-dialog/README.md +255 -0
- package/component/aspect-ratio/README.md +116 -0
- package/component/avatar/README.md +182 -0
- package/component/badge/README.md +143 -0
- package/component/breadcrumb/README.md +223 -0
- package/component/button/README.md +141 -0
- package/component/button-group/README.md +214 -0
- package/component/calendar/README.md +137 -0
- package/component/card/README.md +232 -0
- package/component/carousel/README.md +276 -0
- package/component/checkbox/README.md +153 -0
- package/component/collapsible/README.md +216 -0
- package/component/combobox/README.md +202 -0
- package/component/command/README.md +287 -0
- package/component/composer/README.md +241 -0
- package/component/context-menu/README.md +268 -0
- package/component/date-picker/README.md +202 -0
- package/component/dialog/README.md +276 -0
- package/component/drawer/README.md +147 -0
- package/component/dropdown-menu/README.md +336 -0
- package/component/editor/README.md +152 -0
- package/component/empty/README.md +193 -0
- package/component/form/README.md +216 -0
- package/component/hover-card/README.md +150 -0
- package/component/icon/README.md +25 -0
- package/component/input/README.md +160 -0
- package/component/input-group/README.md +245 -0
- package/component/input-otp/README.md +331 -0
- package/component/item/README.md +254 -0
- package/component/kanban/README.md +81 -0
- package/component/kbd/README.md +141 -0
- package/component/label/README.md +137 -0
- package/component/menubar/README.md +270 -0
- package/component/native-select/README.md +176 -0
- package/component/navigation-menu/README.md +165 -0
- package/component/pagination/README.md +151 -0
- package/component/pillbox/README.md +68 -0
- package/component/popover/README.md +54 -0
- package/component/progress/README.md +160 -0
- package/component/radio/README.md +212 -0
- package/component/resizable/README.md +178 -0
- package/component/scroll-area/README.md +150 -0
- package/component/select/README.md +228 -0
- package/component/separator/README.md +175 -0
- package/component/sheet/README.md +190 -0
- package/component/skeleton/README.md +158 -0
- package/component/slider/README.md +207 -0
- package/component/spinner/README.md +160 -0
- package/component/switch/README.md +170 -0
- package/component/table/README.md +292 -0
- package/component/tabs/README.md +220 -0
- package/component/textarea/README.md +169 -0
- package/component/timeline/README.md +94 -0
- package/component/toast/README.md +173 -0
- package/component/toggle/README.md +133 -0
- package/component/toggle-group/README.md +234 -0
- package/component/tooltip/README.md +230 -0
- package/fesm2022/ojiepermana-angular-chart-area.mjs +289 -3
- package/fesm2022/ojiepermana-angular-chart-bar.mjs +722 -3
- package/fesm2022/ojiepermana-angular-chart-core.mjs +1482 -3
- package/fesm2022/ojiepermana-angular-chart-line.mjs +294 -3
- package/fesm2022/ojiepermana-angular-chart-pie.mjs +291 -3
- package/fesm2022/ojiepermana-angular-chart-primitives.mjs +1301 -3
- package/fesm2022/ojiepermana-angular-chart-radar.mjs +421 -3
- package/fesm2022/ojiepermana-angular-chart-radial.mjs +295 -3
- package/fesm2022/ojiepermana-angular-chart-scatter.mjs +306 -3
- package/fesm2022/ojiepermana-angular-chart.mjs +12 -3
- package/fesm2022/ojiepermana-angular-component-accordion.mjs +267 -3
- package/fesm2022/ojiepermana-angular-component-alert-dialog.mjs +359 -3
- package/fesm2022/ojiepermana-angular-component-alert.mjs +101 -3
- package/fesm2022/ojiepermana-angular-component-aspect-ratio.mjs +31 -3
- package/fesm2022/ojiepermana-angular-component-avatar.mjs +139 -3
- package/fesm2022/ojiepermana-angular-component-badge.mjs +57 -3
- package/fesm2022/ojiepermana-angular-component-breadcrumb.mjs +192 -3
- package/fesm2022/ojiepermana-angular-component-button-group.mjs +95 -3
- package/fesm2022/ojiepermana-angular-component-button.mjs +73 -3
- package/fesm2022/ojiepermana-angular-component-calendar.mjs +718 -3
- package/fesm2022/ojiepermana-angular-component-card.mjs +167 -3
- package/fesm2022/ojiepermana-angular-component-carousel.mjs +326 -3
- package/fesm2022/ojiepermana-angular-component-checkbox.mjs +190 -3
- package/fesm2022/ojiepermana-angular-component-collapsible.mjs +117 -3
- package/fesm2022/ojiepermana-angular-component-combobox.mjs +327 -3
- package/fesm2022/ojiepermana-angular-component-command.mjs +351 -3
- package/fesm2022/ojiepermana-angular-component-composer.mjs +359 -3
- package/fesm2022/ojiepermana-angular-component-context-menu.mjs +158 -3
- package/fesm2022/ojiepermana-angular-component-date-picker.mjs +482 -3
- package/fesm2022/ojiepermana-angular-component-dialog.mjs +400 -3
- package/fesm2022/ojiepermana-angular-component-drawer.mjs +1 -3
- package/fesm2022/ojiepermana-angular-component-dropdown-menu.mjs +689 -3
- package/fesm2022/ojiepermana-angular-component-editor.mjs +511 -3
- package/fesm2022/ojiepermana-angular-component-empty.mjs +134 -3
- package/fesm2022/ojiepermana-angular-component-form.mjs +438 -3
- package/fesm2022/ojiepermana-angular-component-hover-card.mjs +273 -3
- package/fesm2022/ojiepermana-angular-component-icon.mjs +139 -3
- package/fesm2022/ojiepermana-angular-component-input-group.mjs +176 -3
- package/fesm2022/ojiepermana-angular-component-input-otp.mjs +550 -3
- package/fesm2022/ojiepermana-angular-component-input.mjs +52 -3
- package/fesm2022/ojiepermana-angular-component-item.mjs +264 -3
- package/fesm2022/ojiepermana-angular-component-kanban.mjs +310 -3
- package/fesm2022/ojiepermana-angular-component-kbd.mjs +48 -3
- package/fesm2022/ojiepermana-angular-component-label.mjs +27 -3
- package/fesm2022/ojiepermana-angular-component-menubar.mjs +327 -3
- package/fesm2022/ojiepermana-angular-component-native-select.mjs +62 -3
- package/fesm2022/ojiepermana-angular-component-navigation-menu.mjs +378 -3
- package/fesm2022/ojiepermana-angular-component-pagination.mjs +238 -3
- package/fesm2022/ojiepermana-angular-component-pillbox.mjs +999 -3
- package/fesm2022/ojiepermana-angular-component-popover.mjs +201 -3
- package/fesm2022/ojiepermana-angular-component-progress.mjs +57 -3
- package/fesm2022/ojiepermana-angular-component-radio.mjs +180 -3
- package/fesm2022/ojiepermana-angular-component-resizable.mjs +493 -3
- package/fesm2022/ojiepermana-angular-component-scroll-area.mjs +51 -3
- package/fesm2022/ojiepermana-angular-component-segmented-control.mjs +227 -3
- package/fesm2022/ojiepermana-angular-component-select.mjs +609 -3
- package/fesm2022/ojiepermana-angular-component-separator.mjs +31 -3
- package/fesm2022/ojiepermana-angular-component-sheet.mjs +407 -3
- package/fesm2022/ojiepermana-angular-component-skeleton.mjs +25 -3
- package/fesm2022/ojiepermana-angular-component-slider.mjs +456 -3
- package/fesm2022/ojiepermana-angular-component-spinner.mjs +56 -3
- package/fesm2022/ojiepermana-angular-component-switch.mjs +145 -3
- package/fesm2022/ojiepermana-angular-component-table.mjs +155 -3
- package/fesm2022/ojiepermana-angular-component-tabs.mjs +315 -3
- package/fesm2022/ojiepermana-angular-component-textarea.mjs +46 -3
- package/fesm2022/ojiepermana-angular-component-timeline.mjs +237 -3
- package/fesm2022/ojiepermana-angular-component-toast.mjs +241 -3
- package/fesm2022/ojiepermana-angular-component-toggle-group.mjs +290 -3
- package/fesm2022/ojiepermana-angular-component-toggle.mjs +76 -3
- package/fesm2022/ojiepermana-angular-component-tooltip.mjs +519 -3
- package/fesm2022/ojiepermana-angular-component-utils-core.mjs +310 -3
- package/fesm2022/ojiepermana-angular-component-utils-overlay.mjs +62 -3
- package/fesm2022/ojiepermana-angular-component-utils-scale.mjs +34 -3
- package/fesm2022/ojiepermana-angular-component-utils.mjs +3 -2
- package/fesm2022/ojiepermana-angular-component.mjs +4 -4
- package/fesm2022/ojiepermana-angular-navigation-core.mjs +21 -3
- package/fesm2022/ojiepermana-angular-navigation-icon.mjs +20 -3
- package/fesm2022/ojiepermana-angular-navigation-navigation-badge-count.component-CDBxQ8rk.mjs +91 -0
- package/fesm2022/ojiepermana-angular-navigation-navigation-dockbar-menu.component-DBQHdvGa.mjs +512 -0
- package/fesm2022/ojiepermana-angular-navigation-navigation-entry-grid.component-Cd-jh6tg.mjs +623 -0
- package/fesm2022/ojiepermana-angular-navigation-navigation-flyout-menu.component-BCGvhoYj.mjs +404 -0
- package/fesm2022/ojiepermana-angular-navigation-navigation-horizontal.component-Dk_03e-6.mjs +466 -0
- package/fesm2022/ojiepermana-angular-navigation-ojiepermana-angular-navigation-DNKU6viC.mjs +2642 -0
- package/fesm2022/ojiepermana-angular-navigation-service.mjs +725 -3
- package/fesm2022/ojiepermana-angular-navigation-types.mjs +65 -4
- package/fesm2022/ojiepermana-angular-navigation.mjs +4 -10
- package/fesm2022/ojiepermana-angular-sdk.mjs +204 -4
- package/fesm2022/ojiepermana-angular-theme-component-settings.mjs +1387 -3
- package/fesm2022/ojiepermana-angular-theme-layout-services.mjs +331 -3
- package/fesm2022/ojiepermana-angular-theme-layout-types.mjs +45 -4
- package/fesm2022/ojiepermana-angular-theme-layout-wrapper.mjs +1044 -3
- package/fesm2022/ojiepermana-angular-theme-layout.mjs +729 -3
- package/fesm2022/ojiepermana-angular-theme-page-core.mjs +381 -3
- package/fesm2022/ojiepermana-angular-theme-page-filter.mjs +267 -3
- package/fesm2022/ojiepermana-angular-theme-page-root.mjs +361 -3
- package/fesm2022/ojiepermana-angular-theme-page-side.mjs +198 -3
- package/fesm2022/ojiepermana-angular-theme-page-slots.mjs +110 -3
- package/fesm2022/ojiepermana-angular-theme-page.mjs +7 -2
- package/fesm2022/ojiepermana-angular-theme-shell-services.mjs +338 -3
- package/fesm2022/ojiepermana-angular-theme-shell-types.mjs +160 -4
- package/fesm2022/ojiepermana-angular-theme-shell.mjs +811 -3
- package/fesm2022/ojiepermana-angular-theme-styles.mjs +783 -3
- package/fesm2022/ojiepermana-angular-theme.mjs +4 -4
- package/fesm2022/ojiepermana-angular.mjs +6 -11
- package/navigation/README.md +374 -0
- package/package.json +81 -20
- package/sdk/README.md +212 -0
- package/sdk/schematics/collection.json +20 -0
- package/sdk/schematics/init/index.js +83 -0
- package/sdk/schematics/init/schema.json +19 -0
- package/sdk/schematics/ng-add/index.js +147 -0
- package/sdk/schematics/ng-add/schema.json +14 -0
- package/sdk/schematics/package.json +3 -0
- package/sdk/schematics/sdk/index.js +175 -0
- package/sdk/schematics/sdk/schema.json +19 -0
- package/sdk/sdk.config.example.json +24 -0
- package/sdk/src/config/loader.js +43 -0
- package/sdk/src/config/schema.js +59 -0
- package/sdk/src/emit/client.js +251 -0
- package/sdk/src/emit/metadata.js +310 -0
- package/sdk/src/emit/models.js +104 -0
- package/sdk/src/emit/navigation.js +56 -0
- package/sdk/src/emit/operations.js +118 -0
- package/sdk/src/emit/public-api.js +54 -0
- package/sdk/src/emit/services.js +110 -0
- package/sdk/src/engine.js +67 -0
- package/sdk/src/layout/per-domain.js +360 -0
- package/sdk/src/package.json +3 -0
- package/sdk/src/parser/bundle.js +25 -0
- package/sdk/src/parser/ir.js +429 -0
- package/sdk/src/parser/types.js +7 -0
- package/sdk/src/render/template.js +152 -0
- package/sdk/src/writer/index.js +286 -0
- package/theme/README.md +126 -0
- package/theme/component/settings/README.md +135 -0
- package/theme/layout/README.md +539 -0
- package/theme/page/README.md +453 -0
- package/theme/shell/README.md +340 -0
- package/theme/styles/README.md +178 -0
- package/theme/styles/css/base/components.css +553 -0
- package/theme/styles/css/base/index.css +14 -0
- package/theme/styles/css/base/package.css +9 -0
- package/theme/styles/css/base/prefers-dark.css +86 -0
- package/theme/styles/css/base/print.css +62 -0
- package/theme/styles/css/base/status.css +38 -0
- package/theme/styles/css/base/tailwind.css +165 -0
- package/theme/styles/css/base/theme.css +373 -0
- package/theme/styles/css/base/tokens.css +361 -0
- package/theme/styles/css/color/amber.css +72 -0
- package/theme/styles/css/color/blue.css +72 -0
- package/theme/styles/css/color/brand.css +38 -0
- package/theme/styles/css/color/cyan.css +72 -0
- package/theme/styles/css/color/emerald.css +72 -0
- package/theme/styles/css/color/fuchsia.css +72 -0
- package/theme/styles/css/color/green.css +72 -0
- package/theme/styles/css/color/index.css +19 -0
- package/theme/styles/css/color/indigo.css +72 -0
- package/theme/styles/css/color/lime.css +72 -0
- package/theme/styles/css/color/orange.css +72 -0
- package/theme/styles/css/color/pink.css +72 -0
- package/theme/styles/css/color/purple.css +72 -0
- package/theme/styles/css/color/red.css +72 -0
- package/theme/styles/css/color/rose.css +72 -0
- package/theme/styles/css/color/sky.css +72 -0
- package/theme/styles/css/color/teal.css +72 -0
- package/theme/styles/css/color/violet.css +72 -0
- package/theme/styles/css/color/yellow.css +72 -0
- package/theme/styles/css/index.css +18 -0
- package/theme/styles/css/neutral/gray.css +63 -0
- package/theme/styles/css/neutral/index.css +11 -0
- package/theme/styles/css/neutral/mauve.css +63 -0
- package/theme/styles/css/neutral/mist.css +63 -0
- package/theme/styles/css/neutral/neutral.css +63 -0
- package/theme/styles/css/neutral/olive.css +63 -0
- package/theme/styles/css/neutral/slate.css +63 -0
- package/theme/styles/css/neutral/stone.css +63 -0
- package/theme/styles/css/neutral/taupe.css +63 -0
- package/theme/styles/css/neutral/zinc.css +63 -0
- package/theme/styles/css/radius/index.css +30 -0
- package/theme/styles/css/space/index.css +20 -0
- package/types/ojiepermana-angular-chart-area.d.ts +76 -1
- package/types/ojiepermana-angular-chart-bar.d.ts +201 -1
- package/types/ojiepermana-angular-chart-core.d.ts +811 -1
- package/types/ojiepermana-angular-chart-line.d.ts +75 -1
- package/types/ojiepermana-angular-chart-pie.d.ts +131 -1
- package/types/ojiepermana-angular-chart-primitives.d.ts +291 -1
- package/types/ojiepermana-angular-chart-radar.d.ts +116 -1
- package/types/ojiepermana-angular-chart-radial.d.ts +116 -1
- package/types/ojiepermana-angular-chart-scatter.d.ts +125 -1
- package/types/ojiepermana-angular-chart.d.ts +2 -1
- package/types/ojiepermana-angular-component-accordion.d.ts +85 -1
- package/types/ojiepermana-angular-component-alert-dialog.d.ts +140 -1
- package/types/ojiepermana-angular-component-alert.d.ts +42 -1
- package/types/ojiepermana-angular-component-aspect-ratio.d.ts +12 -1
- package/types/ojiepermana-angular-component-avatar.d.ts +56 -1
- package/types/ojiepermana-angular-component-badge.d.ts +24 -1
- package/types/ojiepermana-angular-component-breadcrumb.d.ts +46 -1
- package/types/ojiepermana-angular-component-button-group.d.ts +26 -1
- package/types/ojiepermana-angular-component-button.d.ts +27 -1
- package/types/ojiepermana-angular-component-calendar.d.ts +111 -1
- package/types/ojiepermana-angular-component-card.d.ts +69 -1
- package/types/ojiepermana-angular-component-carousel.d.ts +86 -1
- package/types/ojiepermana-angular-component-checkbox.d.ts +42 -1
- package/types/ojiepermana-angular-component-collapsible.d.ts +42 -1
- package/types/ojiepermana-angular-component-combobox.d.ts +60 -1
- package/types/ojiepermana-angular-component-command.d.ts +130 -1
- package/types/ojiepermana-angular-component-composer.d.ts +90 -1
- package/types/ojiepermana-angular-component-context-menu.d.ts +54 -1
- package/types/ojiepermana-angular-component-date-picker.d.ts +109 -1
- package/types/ojiepermana-angular-component-dialog.d.ts +136 -1
- package/types/ojiepermana-angular-component-drawer.d.ts +1 -1
- package/types/ojiepermana-angular-component-dropdown-menu.d.ts +248 -1
- package/types/ojiepermana-angular-component-editor.d.ts +135 -1
- package/types/ojiepermana-angular-component-empty.d.ts +50 -1
- package/types/ojiepermana-angular-component-form.d.ts +159 -1
- package/types/ojiepermana-angular-component-hover-card.d.ts +75 -1
- package/types/ojiepermana-angular-component-icon.d.ts +89 -1
- package/types/ojiepermana-angular-component-input-group.d.ts +51 -1
- package/types/ojiepermana-angular-component-input-otp.d.ts +155 -1
- package/types/ojiepermana-angular-component-input.d.ts +21 -1
- package/types/ojiepermana-angular-component-item.d.ts +93 -1
- package/types/ojiepermana-angular-component-kanban.d.ts +70 -1
- package/types/ojiepermana-angular-component-kbd.d.ts +16 -1
- package/types/ojiepermana-angular-component-label.d.ts +11 -1
- package/types/ojiepermana-angular-component-menubar.d.ts +93 -1
- package/types/ojiepermana-angular-component-native-select.d.ts +26 -1
- package/types/ojiepermana-angular-component-navigation-menu.d.ts +104 -1
- package/types/ojiepermana-angular-component-pagination.d.ts +33 -1
- package/types/ojiepermana-angular-component-pillbox.d.ts +222 -1
- package/types/ojiepermana-angular-component-popover.d.ts +66 -1
- package/types/ojiepermana-angular-component-progress.d.ts +17 -1
- package/types/ojiepermana-angular-component-radio.d.ts +60 -1
- package/types/ojiepermana-angular-component-resizable.d.ts +117 -1
- package/types/ojiepermana-angular-component-scroll-area.d.ts +19 -1
- package/types/ojiepermana-angular-component-segmented-control.d.ts +58 -1
- package/types/ojiepermana-angular-component-select.d.ts +122 -1
- package/types/ojiepermana-angular-component-separator.d.ts +14 -1
- package/types/ojiepermana-angular-component-sheet.d.ts +130 -1
- package/types/ojiepermana-angular-component-skeleton.d.ts +10 -1
- package/types/ojiepermana-angular-component-slider.d.ts +83 -1
- package/types/ojiepermana-angular-component-spinner.d.ts +13 -1
- package/types/ojiepermana-angular-component-switch.d.ts +44 -1
- package/types/ojiepermana-angular-component-table.d.ts +57 -1
- package/types/ojiepermana-angular-component-tabs.d.ts +124 -1
- package/types/ojiepermana-angular-component-textarea.d.ts +17 -1
- package/types/ojiepermana-angular-component-timeline.d.ts +64 -1
- package/types/ojiepermana-angular-component-toast.d.ts +64 -1
- package/types/ojiepermana-angular-component-toggle-group.d.ts +90 -1
- package/types/ojiepermana-angular-component-toggle.d.ts +25 -1
- package/types/ojiepermana-angular-component-tooltip.d.ts +143 -1
- package/types/ojiepermana-angular-component-utils-core.d.ts +184 -1
- package/types/ojiepermana-angular-component-utils-overlay.d.ts +21 -1
- package/types/ojiepermana-angular-component-utils-scale.d.ts +19 -1
- package/types/ojiepermana-angular-component-utils.d.ts +2 -1
- package/types/ojiepermana-angular-component.d.ts +2 -1
- package/types/ojiepermana-angular-navigation-core.d.ts +59 -1
- package/types/ojiepermana-angular-navigation-icon.d.ts +12 -1
- package/types/ojiepermana-angular-navigation-service.d.ts +116 -1
- package/types/ojiepermana-angular-navigation-types.d.ts +144 -1
- package/types/ojiepermana-angular-navigation.d.ts +507 -1
- package/types/ojiepermana-angular-sdk.d.ts +89 -1
- package/types/ojiepermana-angular-theme-component-settings.d.ts +154 -1
- package/types/ojiepermana-angular-theme-layout-services.d.ts +147 -1
- package/types/ojiepermana-angular-theme-layout-types.d.ts +40 -1
- package/types/ojiepermana-angular-theme-layout-wrapper.d.ts +299 -1
- package/types/ojiepermana-angular-theme-layout.d.ts +129 -1
- package/types/ojiepermana-angular-theme-page-core.d.ts +157 -1
- package/types/ojiepermana-angular-theme-page-filter.d.ts +77 -1
- package/types/ojiepermana-angular-theme-page-root.d.ts +88 -1
- package/types/ojiepermana-angular-theme-page-side.d.ts +50 -1
- package/types/ojiepermana-angular-theme-page-slots.d.ts +40 -1
- package/types/ojiepermana-angular-theme-page.d.ts +5 -1
- package/types/ojiepermana-angular-theme-shell-services.d.ts +193 -1
- package/types/ojiepermana-angular-theme-shell-types.d.ts +105 -1
- package/types/ojiepermana-angular-theme-shell.d.ts +100 -1
- package/types/ojiepermana-angular-theme-styles.d.ts +319 -1
- package/types/ojiepermana-angular-theme.d.ts +2 -1
- package/types/ojiepermana-angular.d.ts +5 -5
|
@@ -1,7 +1,497 @@
|
|
|
1
|
-
|
|
1
|
+
import { DOCUMENT } from '@angular/common';
|
|
2
|
+
import * as i0 from '@angular/core';
|
|
3
|
+
import { Directive, inject, ElementRef, input, signal, computed, Component, booleanAttribute, contentChildren, effect, untracked, forwardRef } from '@angular/core';
|
|
4
|
+
import { injectUniqueId, cn } from '@ojiepermana/angular/component/utils/core';
|
|
2
5
|
|
|
3
|
-
|
|
6
|
+
function clampResizableValue(value, min, max) {
|
|
7
|
+
return Math.min(Math.max(value, min), max);
|
|
8
|
+
}
|
|
9
|
+
function parseResizablePercent(value) {
|
|
10
|
+
if (value == null || value === '')
|
|
11
|
+
return null;
|
|
12
|
+
if (typeof value === 'number')
|
|
13
|
+
return Number.isFinite(value) ? value : null;
|
|
14
|
+
const parsed = Number.parseFloat(value);
|
|
15
|
+
return Number.isFinite(parsed) ? parsed : null;
|
|
16
|
+
}
|
|
17
|
+
function roundResizablePercentage(value) {
|
|
18
|
+
return Math.round(value * 1000) / 1000;
|
|
19
|
+
}
|
|
20
|
+
function resolveInitialResizableSizes(preferred, minimums, maximums) {
|
|
21
|
+
const unresolvedIndexes = preferred.flatMap((value, index) => (value == null ? [index] : []));
|
|
22
|
+
const specifiedTotal = sum(preferred.flatMap((value) => (value == null ? [] : [value])));
|
|
23
|
+
let sizes;
|
|
24
|
+
if (preferred.every((value) => value == null)) {
|
|
25
|
+
const equalSize = 100 / preferred.length;
|
|
26
|
+
sizes = preferred.map(() => equalSize);
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
const share = unresolvedIndexes.length
|
|
30
|
+
? Math.max(100 - specifiedTotal, 0) / unresolvedIndexes.length
|
|
31
|
+
: 0;
|
|
32
|
+
sizes = preferred.map((value) => value ?? share);
|
|
33
|
+
}
|
|
34
|
+
sizes = sizes.map((size, index) => clampResizableValue(size, minimums[index], maximums[index]));
|
|
35
|
+
sizes = rebalanceSizes(sizes, minimums, maximums);
|
|
36
|
+
return sizes.map(roundResizablePercentage);
|
|
37
|
+
}
|
|
38
|
+
function toResizableAriaValue(value) {
|
|
39
|
+
return value == null ? null : String(Math.round(value));
|
|
40
|
+
}
|
|
41
|
+
function sum(values) {
|
|
42
|
+
return values.reduce((total, value) => total + value, 0);
|
|
43
|
+
}
|
|
44
|
+
function rebalanceSizes(sizes, minimums, maximums) {
|
|
45
|
+
const next = [...sizes];
|
|
46
|
+
for (let iteration = 0; iteration < next.length * 4; iteration += 1) {
|
|
47
|
+
const difference = roundResizablePercentage(100 - sum(next));
|
|
48
|
+
if (Math.abs(difference) <= 0.001)
|
|
49
|
+
return next;
|
|
50
|
+
const adjustableIndexes = next.flatMap((size, index) => {
|
|
51
|
+
const room = difference > 0 ? maximums[index] - size : size - minimums[index];
|
|
52
|
+
return room > 0.001 ? [index] : [];
|
|
53
|
+
});
|
|
54
|
+
if (!adjustableIndexes.length)
|
|
55
|
+
return next;
|
|
56
|
+
const perPanelDelta = difference / adjustableIndexes.length;
|
|
57
|
+
adjustableIndexes.forEach((index) => {
|
|
58
|
+
next[index] = clampResizableValue(next[index] + perPanelDelta, minimums[index], maximums[index]);
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
return next;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
class ResizableGroupContextBase {
|
|
65
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: ResizableGroupContextBase, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
66
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.4", type: ResizableGroupContextBase, isStandalone: true, ngImport: i0 });
|
|
67
|
+
}
|
|
68
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: ResizableGroupContextBase, decorators: [{
|
|
69
|
+
type: Directive
|
|
70
|
+
}] });
|
|
71
|
+
class ResizablePanelComponent {
|
|
72
|
+
ctx = inject(ResizableGroupContextBase);
|
|
73
|
+
host = inject((ElementRef));
|
|
74
|
+
defaultSize = input(null, /* @ts-ignore */
|
|
75
|
+
...(ngDevMode ? [{ debugName: "defaultSize" }] : /* istanbul ignore next */ []));
|
|
76
|
+
minSize = input('10%', /* @ts-ignore */
|
|
77
|
+
...(ngDevMode ? [{ debugName: "minSize" }] : /* istanbul ignore next */ []));
|
|
78
|
+
maxSize = input('90%', /* @ts-ignore */
|
|
79
|
+
...(ngDevMode ? [{ debugName: "maxSize" }] : /* istanbul ignore next */ []));
|
|
80
|
+
id = input(null, /* @ts-ignore */
|
|
81
|
+
...(ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []));
|
|
82
|
+
class = input('', /* @ts-ignore */
|
|
83
|
+
...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
84
|
+
generatedId = injectUniqueId('ResizablePanel');
|
|
85
|
+
currentSize = signal(null, /* @ts-ignore */
|
|
86
|
+
...(ngDevMode ? [{ debugName: "currentSize" }] : /* istanbul ignore next */ []));
|
|
87
|
+
resolvedId = computed(() => this.id() ?? this.generatedId, /* @ts-ignore */
|
|
88
|
+
...(ngDevMode ? [{ debugName: "resolvedId" }] : /* istanbul ignore next */ []));
|
|
89
|
+
classes = computed(() => cn('relative block min-h-0 min-w-0 overflow-hidden', this.ctx.groupOrientation() === 'horizontal' ? 'h-full' : 'w-full', this.class()), /* @ts-ignore */
|
|
90
|
+
...(ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []));
|
|
91
|
+
flexStyle = computed(() => {
|
|
92
|
+
const size = this.currentSize();
|
|
93
|
+
return size == null ? '1 1 0%' : `0 0 ${size}%`;
|
|
94
|
+
}, /* @ts-ignore */
|
|
95
|
+
...(ngDevMode ? [{ debugName: "flexStyle" }] : /* istanbul ignore next */ []));
|
|
96
|
+
panelId() {
|
|
97
|
+
return this.resolvedId();
|
|
98
|
+
}
|
|
99
|
+
preferredSizePercent() {
|
|
100
|
+
return parseResizablePercent(this.defaultSize());
|
|
101
|
+
}
|
|
102
|
+
minSizePercent() {
|
|
103
|
+
return clampResizableValue(parseResizablePercent(this.minSize()) ?? 10, 0, 100);
|
|
104
|
+
}
|
|
105
|
+
maxSizePercent() {
|
|
106
|
+
return clampResizableValue(parseResizablePercent(this.maxSize()) ?? 90, this.minSizePercent(), 100);
|
|
107
|
+
}
|
|
108
|
+
size() {
|
|
109
|
+
return this.currentSize() ?? 0;
|
|
110
|
+
}
|
|
111
|
+
setSize(size) {
|
|
112
|
+
this.currentSize.set(roundResizablePercentage(clampResizableValue(size, 0, 100)));
|
|
113
|
+
}
|
|
114
|
+
nativeElement() {
|
|
115
|
+
return this.host.nativeElement;
|
|
116
|
+
}
|
|
117
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: ResizablePanelComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
118
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.1.4", type: ResizablePanelComponent, isStandalone: true, selector: "ResizablePanel", inputs: { defaultSize: { classPropertyName: "defaultSize", publicName: "defaultSize", isSignal: true, isRequired: false, transformFunction: null }, minSize: { classPropertyName: "minSize", publicName: "minSize", isSignal: true, isRequired: false, transformFunction: null }, maxSize: { classPropertyName: "maxSize", publicName: "maxSize", isSignal: true, isRequired: false, transformFunction: null }, id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "classes()", "attr.id": "resolvedId()", "style.flex": "flexStyle()" } }, ngImport: i0, template: `<ng-content />`, isInline: true });
|
|
119
|
+
}
|
|
120
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: ResizablePanelComponent, decorators: [{
|
|
121
|
+
type: Component,
|
|
122
|
+
args: [{
|
|
123
|
+
selector: 'ResizablePanel',
|
|
124
|
+
host: {
|
|
125
|
+
'[class]': 'classes()',
|
|
126
|
+
'[attr.id]': 'resolvedId()',
|
|
127
|
+
'[style.flex]': 'flexStyle()',
|
|
128
|
+
},
|
|
129
|
+
template: `<ng-content />`,
|
|
130
|
+
}]
|
|
131
|
+
}], propDecorators: { defaultSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "defaultSize", required: false }] }], minSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "minSize", required: false }] }], maxSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxSize", required: false }] }], id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
132
|
+
class ResizableHandleComponent {
|
|
133
|
+
ctx = inject(ResizableGroupContextBase);
|
|
134
|
+
host = inject((ElementRef));
|
|
135
|
+
withHandle = input(false, { ...(ngDevMode ? { debugName: "withHandle" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
136
|
+
ariaLabel = input(null, { ...(ngDevMode ? { debugName: "ariaLabel" } : /* istanbul ignore next */ {}), alias: 'aria-label' });
|
|
137
|
+
class = input('', /* @ts-ignore */
|
|
138
|
+
...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
139
|
+
lastExpandedPrimarySize = signal(null, /* @ts-ignore */
|
|
140
|
+
...(ngDevMode ? [{ debugName: "lastExpandedPrimarySize" }] : /* istanbul ignore next */ []));
|
|
141
|
+
active = signal(false, /* @ts-ignore */
|
|
142
|
+
...(ngDevMode ? [{ debugName: "active" }] : /* istanbul ignore next */ []));
|
|
143
|
+
state = computed(() => this.ctx.pairState(this), /* @ts-ignore */
|
|
144
|
+
...(ngDevMode ? [{ debugName: "state" }] : /* istanbul ignore next */ []));
|
|
145
|
+
classes = computed(() => cn('group relative flex shrink-0 select-none items-center justify-center bg-transparent text-foreground transition-colors', 'touch-none focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background', this.ctx.groupOrientation() === 'horizontal'
|
|
146
|
+
? 'h-full w-2 cursor-col-resize before:absolute before:inset-y-0 before:left-1/2 before:w-px before:-translate-x-1/2 before:bg-border'
|
|
147
|
+
: 'h-2 w-full cursor-row-resize before:absolute before:inset-x-0 before:top-1/2 before:h-px before:-translate-y-1/2 before:bg-border', this.active() ? 'before:bg-foreground/60' : 'hover:before:bg-foreground/40', this.class()), /* @ts-ignore */
|
|
148
|
+
...(ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []));
|
|
149
|
+
/**
|
|
150
|
+
* Whether this handle sits between two panels it can actually resize.
|
|
151
|
+
*
|
|
152
|
+
* A handle with no adjacent pair -- a lone panel, or a handle at the edge of
|
|
153
|
+
* the group -- changes nothing, so it is decorative and gives up `separator`
|
|
154
|
+
* and its tab stop. A focusable `separator` owes `aria-valuenow`, and there is
|
|
155
|
+
* no honest value to give: inventing one would satisfy axe while telling a
|
|
156
|
+
* screen reader about a slider that does not exist. Dropping the role is the
|
|
157
|
+
* truthful half of that trade, and it also stops the handle from soaking up a
|
|
158
|
+
* Tab press that leads nowhere.
|
|
159
|
+
*/
|
|
160
|
+
resizable = computed(() => this.state() !== null, /* @ts-ignore */
|
|
161
|
+
...(ngDevMode ? [{ debugName: "resizable" }] : /* istanbul ignore next */ []));
|
|
162
|
+
separatorOrientation = computed(() => this.ctx.groupOrientation() === 'horizontal' ? 'vertical' : 'horizontal', /* @ts-ignore */
|
|
163
|
+
...(ngDevMode ? [{ debugName: "separatorOrientation" }] : /* istanbul ignore next */ []));
|
|
164
|
+
controls = computed(() => this.state()?.panelId ?? null, /* @ts-ignore */
|
|
165
|
+
...(ngDevMode ? [{ debugName: "controls" }] : /* istanbul ignore next */ []));
|
|
166
|
+
label = computed(() => this.ariaLabel() ?? 'Resize panel', /* @ts-ignore */
|
|
167
|
+
...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
168
|
+
valueNow = computed(() => toResizableAriaValue(this.state()?.valueNow), /* @ts-ignore */
|
|
169
|
+
...(ngDevMode ? [{ debugName: "valueNow" }] : /* istanbul ignore next */ []));
|
|
170
|
+
valueMin = computed(() => toResizableAriaValue(this.state()?.valueMin), /* @ts-ignore */
|
|
171
|
+
...(ngDevMode ? [{ debugName: "valueMin" }] : /* istanbul ignore next */ []));
|
|
172
|
+
valueMax = computed(() => toResizableAriaValue(this.state()?.valueMax), /* @ts-ignore */
|
|
173
|
+
...(ngDevMode ? [{ debugName: "valueMax" }] : /* istanbul ignore next */ []));
|
|
174
|
+
valueText = computed(() => {
|
|
175
|
+
const value = this.state()?.valueNow;
|
|
176
|
+
return value == null ? null : `${Math.round(value)}%`;
|
|
177
|
+
}, /* @ts-ignore */
|
|
178
|
+
...(ngDevMode ? [{ debugName: "valueText" }] : /* istanbul ignore next */ []));
|
|
179
|
+
onPointerDown(event) {
|
|
180
|
+
if (event.button !== 0) {
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
183
|
+
event.preventDefault();
|
|
184
|
+
this.host.nativeElement.focus();
|
|
185
|
+
this.ctx.beginPointerResize(this, event);
|
|
186
|
+
}
|
|
187
|
+
onKeydown(event) {
|
|
188
|
+
this.ctx.handleKeydown(this, event);
|
|
189
|
+
}
|
|
190
|
+
setActive(active) {
|
|
191
|
+
this.active.set(active);
|
|
192
|
+
}
|
|
193
|
+
rememberPrimarySize(size) {
|
|
194
|
+
this.lastExpandedPrimarySize.set(roundResizablePercentage(size));
|
|
195
|
+
}
|
|
196
|
+
rememberedPrimarySize() {
|
|
197
|
+
return this.lastExpandedPrimarySize();
|
|
198
|
+
}
|
|
199
|
+
nativeElement() {
|
|
200
|
+
return this.host.nativeElement;
|
|
201
|
+
}
|
|
202
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: ResizableHandleComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
203
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.4", type: ResizableHandleComponent, isStandalone: true, selector: "ResizableHandle", inputs: { withHandle: { classPropertyName: "withHandle", publicName: "withHandle", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null }, class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "keydown": "onKeydown($event)", "pointerdown": "onPointerDown($event)" }, properties: { "class": "classes()", "attr.role": "resizable() ? \"separator\" : null", "attr.tabindex": "resizable() ? 0 : null", "attr.data-active": "active() ? \"true\" : null", "attr.aria-controls": "controls()", "attr.aria-label": "resizable() ? label() : null", "attr.aria-orientation": "resizable() ? separatorOrientation() : null", "attr.aria-valuenow": "valueNow()", "attr.aria-valuemin": "valueMin()", "attr.aria-valuemax": "valueMax()", "attr.aria-valuetext": "valueText()" } }, ngImport: i0, template: `
|
|
204
|
+
@if (withHandle()) {
|
|
205
|
+
<span
|
|
206
|
+
aria-hidden="true"
|
|
207
|
+
class="pointer-events-none inline-flex items-center justify-center rounded-sm border border-border bg-background px-1 py-0.5 shadow-sm"
|
|
208
|
+
>
|
|
209
|
+
<svg class="h-3 w-3 text-muted-foreground" viewBox="0 0 24 24" fill="currentColor">
|
|
210
|
+
<circle cx="9" cy="8" r="1.25" />
|
|
211
|
+
<circle cx="15" cy="8" r="1.25" />
|
|
212
|
+
<circle cx="9" cy="12" r="1.25" />
|
|
213
|
+
<circle cx="15" cy="12" r="1.25" />
|
|
214
|
+
<circle cx="9" cy="16" r="1.25" />
|
|
215
|
+
<circle cx="15" cy="16" r="1.25" />
|
|
216
|
+
</svg>
|
|
217
|
+
</span>
|
|
218
|
+
}
|
|
219
|
+
`, isInline: true });
|
|
220
|
+
}
|
|
221
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: ResizableHandleComponent, decorators: [{
|
|
222
|
+
type: Component,
|
|
223
|
+
args: [{
|
|
224
|
+
selector: 'ResizableHandle',
|
|
225
|
+
host: {
|
|
226
|
+
'[class]': 'classes()',
|
|
227
|
+
'[attr.role]': 'resizable() ? "separator" : null',
|
|
228
|
+
'[attr.tabindex]': 'resizable() ? 0 : null',
|
|
229
|
+
'[attr.data-active]': 'active() ? "true" : null',
|
|
230
|
+
'[attr.aria-controls]': 'controls()',
|
|
231
|
+
'[attr.aria-label]': 'resizable() ? label() : null',
|
|
232
|
+
'[attr.aria-orientation]': 'resizable() ? separatorOrientation() : null',
|
|
233
|
+
'[attr.aria-valuenow]': 'valueNow()',
|
|
234
|
+
'[attr.aria-valuemin]': 'valueMin()',
|
|
235
|
+
'[attr.aria-valuemax]': 'valueMax()',
|
|
236
|
+
'[attr.aria-valuetext]': 'valueText()',
|
|
237
|
+
'(keydown)': 'onKeydown($event)',
|
|
238
|
+
'(pointerdown)': 'onPointerDown($event)',
|
|
239
|
+
},
|
|
240
|
+
template: `
|
|
241
|
+
@if (withHandle()) {
|
|
242
|
+
<span
|
|
243
|
+
aria-hidden="true"
|
|
244
|
+
class="pointer-events-none inline-flex items-center justify-center rounded-sm border border-border bg-background px-1 py-0.5 shadow-sm"
|
|
245
|
+
>
|
|
246
|
+
<svg class="h-3 w-3 text-muted-foreground" viewBox="0 0 24 24" fill="currentColor">
|
|
247
|
+
<circle cx="9" cy="8" r="1.25" />
|
|
248
|
+
<circle cx="15" cy="8" r="1.25" />
|
|
249
|
+
<circle cx="9" cy="12" r="1.25" />
|
|
250
|
+
<circle cx="15" cy="12" r="1.25" />
|
|
251
|
+
<circle cx="9" cy="16" r="1.25" />
|
|
252
|
+
<circle cx="15" cy="16" r="1.25" />
|
|
253
|
+
</svg>
|
|
254
|
+
</span>
|
|
255
|
+
}
|
|
256
|
+
`,
|
|
257
|
+
}]
|
|
258
|
+
}], propDecorators: { withHandle: [{ type: i0.Input, args: [{ isSignal: true, alias: "withHandle", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-label", required: false }] }], class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
259
|
+
class ResizablePanelGroupComponent extends ResizableGroupContextBase {
|
|
260
|
+
host = inject((ElementRef));
|
|
261
|
+
document = inject(DOCUMENT);
|
|
262
|
+
orientation = input('horizontal', /* @ts-ignore */
|
|
263
|
+
...(ngDevMode ? [{ debugName: "orientation" }] : /* istanbul ignore next */ []));
|
|
264
|
+
class = input('', /* @ts-ignore */
|
|
265
|
+
...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
266
|
+
panels = contentChildren(ResizablePanelComponent, /* @ts-ignore */
|
|
267
|
+
...(ngDevMode ? [{ debugName: "panels" }] : /* istanbul ignore next */ []));
|
|
268
|
+
handles = contentChildren(ResizableHandleComponent, /* @ts-ignore */
|
|
269
|
+
...(ngDevMode ? [{ debugName: "handles" }] : /* istanbul ignore next */ []));
|
|
270
|
+
pointerSession = null;
|
|
271
|
+
removePointerListeners = null;
|
|
272
|
+
classes = computed(() => cn('flex w-full min-h-0 min-w-0 items-stretch', this.orientation() === 'horizontal' ? 'flex-row' : 'flex-col', this.class()), /* @ts-ignore */
|
|
273
|
+
...(ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []));
|
|
274
|
+
syncLayout = effect(() => {
|
|
275
|
+
const panels = this.panels();
|
|
276
|
+
void this.handles();
|
|
277
|
+
if (!panels.length) {
|
|
278
|
+
return;
|
|
279
|
+
}
|
|
280
|
+
untracked(() => this.initializeLayout(panels));
|
|
281
|
+
}, /* @ts-ignore */
|
|
282
|
+
...(ngDevMode ? [{ debugName: "syncLayout" }] : /* istanbul ignore next */ []));
|
|
283
|
+
groupOrientation() {
|
|
284
|
+
return this.orientation();
|
|
285
|
+
}
|
|
286
|
+
panelDirection() {
|
|
287
|
+
const view = this.document.defaultView;
|
|
288
|
+
if (!view) {
|
|
289
|
+
return 'ltr';
|
|
290
|
+
}
|
|
291
|
+
return view.getComputedStyle(this.host.nativeElement).direction === 'rtl' ? 'rtl' : 'ltr';
|
|
292
|
+
}
|
|
293
|
+
pairState(handle) {
|
|
294
|
+
const pair = this.resolvePair(handle);
|
|
295
|
+
if (!pair) {
|
|
296
|
+
return null;
|
|
297
|
+
}
|
|
298
|
+
const bounds = this.boundsForPair(pair);
|
|
299
|
+
return {
|
|
300
|
+
panelId: pair.previous.panelId(),
|
|
301
|
+
valueNow: pair.previous.size(),
|
|
302
|
+
valueMin: bounds.min,
|
|
303
|
+
valueMax: bounds.max,
|
|
304
|
+
};
|
|
305
|
+
}
|
|
306
|
+
beginPointerResize(handle, event) {
|
|
307
|
+
const pair = this.resolvePair(handle);
|
|
308
|
+
if (!pair) {
|
|
309
|
+
return;
|
|
310
|
+
}
|
|
311
|
+
this.finishPointerResize();
|
|
312
|
+
handle.setActive(true);
|
|
313
|
+
this.pointerSession = {
|
|
314
|
+
handle,
|
|
315
|
+
pair,
|
|
316
|
+
startCoordinate: this.coordinateFromEvent(event),
|
|
317
|
+
previousSize: pair.previous.size(),
|
|
318
|
+
};
|
|
319
|
+
const move = (nextEvent) => {
|
|
320
|
+
const session = this.pointerSession;
|
|
321
|
+
if (!session) {
|
|
322
|
+
return;
|
|
323
|
+
}
|
|
324
|
+
const containerSize = this.containerSize();
|
|
325
|
+
if (containerSize <= 0) {
|
|
326
|
+
return;
|
|
327
|
+
}
|
|
328
|
+
const delta = this.coordinateFromEvent(nextEvent) - session.startCoordinate;
|
|
329
|
+
const directionFactor = this.orientation() === 'horizontal' && this.panelDirection() === 'rtl' ? -1 : 1;
|
|
330
|
+
const deltaPercent = (delta / containerSize) * 100 * directionFactor;
|
|
331
|
+
this.applyPrimarySize(session.pair, session.previousSize + deltaPercent);
|
|
332
|
+
};
|
|
333
|
+
const end = () => this.finishPointerResize();
|
|
334
|
+
this.document.addEventListener('pointermove', move);
|
|
335
|
+
this.document.addEventListener('pointerup', end);
|
|
336
|
+
this.document.addEventListener('pointercancel', end);
|
|
337
|
+
this.removePointerListeners = () => {
|
|
338
|
+
this.document.removeEventListener('pointermove', move);
|
|
339
|
+
this.document.removeEventListener('pointerup', end);
|
|
340
|
+
this.document.removeEventListener('pointercancel', end);
|
|
341
|
+
};
|
|
342
|
+
}
|
|
343
|
+
handleKeydown(handle, event) {
|
|
344
|
+
const pair = this.resolvePair(handle);
|
|
345
|
+
if (!pair) {
|
|
346
|
+
return;
|
|
347
|
+
}
|
|
348
|
+
const current = pair.previous.size();
|
|
349
|
+
const bounds = this.boundsForPair(pair);
|
|
350
|
+
const horizontalStep = this.panelDirection() === 'rtl' ? -10 : 10;
|
|
351
|
+
switch (event.key) {
|
|
352
|
+
case 'ArrowRight':
|
|
353
|
+
if (this.orientation() !== 'horizontal') {
|
|
354
|
+
return;
|
|
355
|
+
}
|
|
356
|
+
this.applyPrimarySize(pair, current + horizontalStep);
|
|
357
|
+
break;
|
|
358
|
+
case 'ArrowLeft':
|
|
359
|
+
if (this.orientation() !== 'horizontal') {
|
|
360
|
+
return;
|
|
361
|
+
}
|
|
362
|
+
this.applyPrimarySize(pair, current - horizontalStep);
|
|
363
|
+
break;
|
|
364
|
+
case 'ArrowDown':
|
|
365
|
+
if (this.orientation() !== 'vertical') {
|
|
366
|
+
return;
|
|
367
|
+
}
|
|
368
|
+
this.applyPrimarySize(pair, current + 10);
|
|
369
|
+
break;
|
|
370
|
+
case 'ArrowUp':
|
|
371
|
+
if (this.orientation() !== 'vertical') {
|
|
372
|
+
return;
|
|
373
|
+
}
|
|
374
|
+
this.applyPrimarySize(pair, current - 10);
|
|
375
|
+
break;
|
|
376
|
+
case 'Home':
|
|
377
|
+
this.applyPrimarySize(pair, bounds.min);
|
|
378
|
+
break;
|
|
379
|
+
case 'End':
|
|
380
|
+
this.applyPrimarySize(pair, bounds.max);
|
|
381
|
+
break;
|
|
382
|
+
case 'Enter': {
|
|
383
|
+
const remembered = handle.rememberedPrimarySize();
|
|
384
|
+
if (current > bounds.min + 0.5) {
|
|
385
|
+
handle.rememberPrimarySize(current);
|
|
386
|
+
this.applyPrimarySize(pair, bounds.min);
|
|
387
|
+
}
|
|
388
|
+
else if (remembered != null) {
|
|
389
|
+
this.applyPrimarySize(pair, remembered);
|
|
390
|
+
}
|
|
391
|
+
else {
|
|
392
|
+
this.applyPrimarySize(pair, (bounds.min + bounds.max) / 2);
|
|
393
|
+
}
|
|
394
|
+
break;
|
|
395
|
+
}
|
|
396
|
+
default:
|
|
397
|
+
return;
|
|
398
|
+
}
|
|
399
|
+
event.preventDefault();
|
|
400
|
+
}
|
|
401
|
+
ngOnDestroy() {
|
|
402
|
+
this.finishPointerResize();
|
|
403
|
+
}
|
|
404
|
+
finishPointerResize() {
|
|
405
|
+
this.pointerSession?.handle.setActive(false);
|
|
406
|
+
this.pointerSession = null;
|
|
407
|
+
this.removePointerListeners?.();
|
|
408
|
+
this.removePointerListeners = null;
|
|
409
|
+
}
|
|
410
|
+
initializeLayout(panels) {
|
|
411
|
+
const minimums = panels.map((panel) => panel.minSizePercent());
|
|
412
|
+
const maximums = panels.map((panel, index) => Math.max(minimums[index], panel.maxSizePercent()));
|
|
413
|
+
const preferred = panels.map((panel) => panel.preferredSizePercent());
|
|
414
|
+
const sizes = resolveInitialResizableSizes(preferred, minimums, maximums);
|
|
415
|
+
panels.forEach((panel, index) => panel.setSize(sizes[index]));
|
|
416
|
+
}
|
|
417
|
+
resolvePair(handle) {
|
|
418
|
+
const panels = new Map(this.panels().map((panel) => [panel.nativeElement(), panel]));
|
|
419
|
+
const children = Array.from(this.host.nativeElement.children);
|
|
420
|
+
const handleIndex = children.indexOf(handle.nativeElement());
|
|
421
|
+
if (handleIndex === -1) {
|
|
422
|
+
return null;
|
|
423
|
+
}
|
|
424
|
+
let previous = null;
|
|
425
|
+
let next = null;
|
|
426
|
+
for (let index = handleIndex - 1; index >= 0; index -= 1) {
|
|
427
|
+
previous = panels.get(children[index]) ?? null;
|
|
428
|
+
if (previous) {
|
|
429
|
+
break;
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
for (let index = handleIndex + 1; index < children.length; index += 1) {
|
|
433
|
+
next = panels.get(children[index]) ?? null;
|
|
434
|
+
if (next) {
|
|
435
|
+
break;
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
if (!previous || !next) {
|
|
439
|
+
return null;
|
|
440
|
+
}
|
|
441
|
+
return { previous, next };
|
|
442
|
+
}
|
|
443
|
+
boundsForPair(pair) {
|
|
444
|
+
const pairTotal = pair.previous.size() + pair.next.size();
|
|
445
|
+
const min = Math.max(pair.previous.minSizePercent(), pairTotal - pair.next.maxSizePercent());
|
|
446
|
+
const max = Math.min(pair.previous.maxSizePercent(), pairTotal - pair.next.minSizePercent());
|
|
447
|
+
if (min > max) {
|
|
448
|
+
return { min: pairTotal / 2, max: pairTotal / 2 };
|
|
449
|
+
}
|
|
450
|
+
return { min: roundResizablePercentage(min), max: roundResizablePercentage(max) };
|
|
451
|
+
}
|
|
452
|
+
applyPrimarySize(pair, nextPrimarySize) {
|
|
453
|
+
const pairTotal = pair.previous.size() + pair.next.size();
|
|
454
|
+
const bounds = this.boundsForPair(pair);
|
|
455
|
+
const primarySize = roundResizablePercentage(clampResizableValue(nextPrimarySize, bounds.min, bounds.max));
|
|
456
|
+
const secondarySize = roundResizablePercentage(pairTotal - primarySize);
|
|
457
|
+
pair.previous.setSize(primarySize);
|
|
458
|
+
pair.next.setSize(secondarySize);
|
|
459
|
+
}
|
|
460
|
+
containerSize() {
|
|
461
|
+
const rect = this.host.nativeElement.getBoundingClientRect();
|
|
462
|
+
return this.orientation() === 'horizontal' ? rect.width : rect.height;
|
|
463
|
+
}
|
|
464
|
+
coordinateFromEvent(event) {
|
|
465
|
+
return this.orientation() === 'horizontal' ? event.clientX : event.clientY;
|
|
466
|
+
}
|
|
467
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: ResizablePanelGroupComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
468
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.1.4", type: ResizablePanelGroupComponent, isStandalone: true, selector: "ResizablePanelGroup", inputs: { orientation: { classPropertyName: "orientation", publicName: "orientation", isSignal: true, isRequired: false, transformFunction: null }, class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "classes()", "attr.data-orientation": "orientation()" } }, providers: [
|
|
469
|
+
{
|
|
470
|
+
provide: ResizableGroupContextBase,
|
|
471
|
+
useExisting: forwardRef(() => ResizablePanelGroupComponent),
|
|
472
|
+
},
|
|
473
|
+
], queries: [{ propertyName: "panels", predicate: ResizablePanelComponent, isSignal: true }, { propertyName: "handles", predicate: ResizableHandleComponent, isSignal: true }], usesInheritance: true, ngImport: i0, template: `<ng-content />`, isInline: true });
|
|
474
|
+
}
|
|
475
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: ResizablePanelGroupComponent, decorators: [{
|
|
476
|
+
type: Component,
|
|
477
|
+
args: [{
|
|
478
|
+
selector: 'ResizablePanelGroup',
|
|
479
|
+
providers: [
|
|
480
|
+
{
|
|
481
|
+
provide: ResizableGroupContextBase,
|
|
482
|
+
useExisting: forwardRef(() => ResizablePanelGroupComponent),
|
|
483
|
+
},
|
|
484
|
+
],
|
|
485
|
+
host: {
|
|
486
|
+
'[class]': 'classes()',
|
|
487
|
+
'[attr.data-orientation]': 'orientation()',
|
|
488
|
+
},
|
|
489
|
+
template: `<ng-content />`,
|
|
490
|
+
}]
|
|
491
|
+
}], propDecorators: { orientation: [{ type: i0.Input, args: [{ isSignal: true, alias: "orientation", required: false }] }], class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], panels: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => ResizablePanelComponent), { isSignal: true }] }], handles: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => ResizableHandleComponent), { isSignal: true }] }] } });
|
|
4
492
|
|
|
5
493
|
/**
|
|
6
494
|
* Generated bundle index. Do not edit.
|
|
7
|
-
*/
|
|
495
|
+
*/
|
|
496
|
+
|
|
497
|
+
export { ResizableGroupContextBase, ResizableHandleComponent, ResizablePanelComponent, ResizablePanelGroupComponent, clampResizableValue, parseResizablePercent, resolveInitialResizableSizes, roundResizablePercentage, toResizableAriaValue };
|
|
@@ -1,7 +1,55 @@
|
|
|
1
|
-
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { input, numberAttribute, computed, Component } from '@angular/core';
|
|
3
|
+
import { cn } from '@ojiepermana/angular/component/utils/core';
|
|
2
4
|
|
|
3
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Lightweight scroll area using native scrollbars styled via CSS.
|
|
7
|
+
* Fully accessible — real scrolling, keyboard, wheel, momentum.
|
|
8
|
+
*/
|
|
9
|
+
class ScrollAreaComponent {
|
|
10
|
+
class = input('', /* @ts-ignore */
|
|
11
|
+
...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
12
|
+
viewportClass = input('', /* @ts-ignore */
|
|
13
|
+
...(ngDevMode ? [{ debugName: "viewportClass" }] : /* istanbul ignore next */ []));
|
|
14
|
+
viewportAriaLabel = input(null, /* @ts-ignore */
|
|
15
|
+
...(ngDevMode ? [{ debugName: "viewportAriaLabel" }] : /* istanbul ignore next */ []));
|
|
16
|
+
viewportTabIndex = input(0, { ...(ngDevMode ? { debugName: "viewportTabIndex" } : /* istanbul ignore next */ {}), transform: numberAttribute });
|
|
17
|
+
classes = computed(() => cn('relative overflow-hidden', this.class()), /* @ts-ignore */
|
|
18
|
+
...(ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []));
|
|
19
|
+
viewportRole = computed(() => (this.viewportAriaLabel() ? 'region' : null), /* @ts-ignore */
|
|
20
|
+
...(ngDevMode ? [{ debugName: "viewportRole" }] : /* istanbul ignore next */ []));
|
|
21
|
+
viewportClasses = computed(() => cn('scroll-area-viewport h-full w-full rounded-[inherit]', 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring', this.viewportClass()), /* @ts-ignore */
|
|
22
|
+
...(ngDevMode ? [{ debugName: "viewportClasses" }] : /* istanbul ignore next */ []));
|
|
23
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: ScrollAreaComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
24
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.1.4", type: ScrollAreaComponent, isStandalone: true, selector: "ScrollArea", inputs: { class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, viewportClass: { classPropertyName: "viewportClass", publicName: "viewportClass", isSignal: true, isRequired: false, transformFunction: null }, viewportAriaLabel: { classPropertyName: "viewportAriaLabel", publicName: "viewportAriaLabel", isSignal: true, isRequired: false, transformFunction: null }, viewportTabIndex: { classPropertyName: "viewportTabIndex", publicName: "viewportTabIndex", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "classes()" } }, ngImport: i0, template: `
|
|
25
|
+
<div
|
|
26
|
+
[class]="viewportClasses()"
|
|
27
|
+
[attr.aria-label]="viewportAriaLabel()"
|
|
28
|
+
[attr.role]="viewportRole()"
|
|
29
|
+
[attr.tabindex]="viewportTabIndex()"
|
|
30
|
+
>
|
|
31
|
+
<ng-content />
|
|
32
|
+
</div>
|
|
33
|
+
`, isInline: true, styles: [":host{display:block;overflow:hidden;position:relative}.scroll-area-viewport{overflow:auto;scrollbar-width:thin;scrollbar-color:var(--tw-scrollbar-thumb, hsl(var(--scrollbar-thumb))) var(--tw-scrollbar-track, hsl(var(--scrollbar-track)))}.scroll-area-viewport::-webkit-scrollbar{width:var(--scrollbar-size, .5rem);height:var(--scrollbar-size, .5rem)}.scroll-area-viewport::-webkit-scrollbar-track{background:var(--tw-scrollbar-track, hsl(var(--scrollbar-track)))}.scroll-area-viewport::-webkit-scrollbar-thumb{background:var(--tw-scrollbar-thumb, hsl(var(--scrollbar-thumb)));border:var(--border-width) solid transparent;background-clip:padding-box;border-radius:var(--scrollbar-radius, 9999px)}.scroll-area-viewport::-webkit-scrollbar-thumb:hover{background:var( --scrollbar-thumb-hover, var(--tw-scrollbar-thumb, hsl(var(--scrollbar-thumb-hover))) );background-clip:padding-box}@media(forced-colors:active){.scroll-area-viewport{scrollbar-width:auto;scrollbar-color:auto}.scroll-area-viewport::-webkit-scrollbar-thumb{background:CanvasText;border-color:transparent}}\n"] });
|
|
34
|
+
}
|
|
35
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: ScrollAreaComponent, decorators: [{
|
|
36
|
+
type: Component,
|
|
37
|
+
args: [{ selector: 'ScrollArea', host: {
|
|
38
|
+
'[class]': 'classes()',
|
|
39
|
+
}, template: `
|
|
40
|
+
<div
|
|
41
|
+
[class]="viewportClasses()"
|
|
42
|
+
[attr.aria-label]="viewportAriaLabel()"
|
|
43
|
+
[attr.role]="viewportRole()"
|
|
44
|
+
[attr.tabindex]="viewportTabIndex()"
|
|
45
|
+
>
|
|
46
|
+
<ng-content />
|
|
47
|
+
</div>
|
|
48
|
+
`, styles: [":host{display:block;overflow:hidden;position:relative}.scroll-area-viewport{overflow:auto;scrollbar-width:thin;scrollbar-color:var(--tw-scrollbar-thumb, hsl(var(--scrollbar-thumb))) var(--tw-scrollbar-track, hsl(var(--scrollbar-track)))}.scroll-area-viewport::-webkit-scrollbar{width:var(--scrollbar-size, .5rem);height:var(--scrollbar-size, .5rem)}.scroll-area-viewport::-webkit-scrollbar-track{background:var(--tw-scrollbar-track, hsl(var(--scrollbar-track)))}.scroll-area-viewport::-webkit-scrollbar-thumb{background:var(--tw-scrollbar-thumb, hsl(var(--scrollbar-thumb)));border:var(--border-width) solid transparent;background-clip:padding-box;border-radius:var(--scrollbar-radius, 9999px)}.scroll-area-viewport::-webkit-scrollbar-thumb:hover{background:var( --scrollbar-thumb-hover, var(--tw-scrollbar-thumb, hsl(var(--scrollbar-thumb-hover))) );background-clip:padding-box}@media(forced-colors:active){.scroll-area-viewport{scrollbar-width:auto;scrollbar-color:auto}.scroll-area-viewport::-webkit-scrollbar-thumb{background:CanvasText;border-color:transparent}}\n"] }]
|
|
49
|
+
}], propDecorators: { class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], viewportClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "viewportClass", required: false }] }], viewportAriaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "viewportAriaLabel", required: false }] }], viewportTabIndex: [{ type: i0.Input, args: [{ isSignal: true, alias: "viewportTabIndex", required: false }] }] } });
|
|
4
50
|
|
|
5
51
|
/**
|
|
6
52
|
* Generated bundle index. Do not edit.
|
|
7
|
-
*/
|
|
53
|
+
*/
|
|
54
|
+
|
|
55
|
+
export { ScrollAreaComponent };
|