ngwr 16.1.0 → 16.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/badge/styles/_tag.scss +73 -1
- package/calendar/styles/_index.scss +22 -0
- package/cascader/styles/_rules.scss +7 -0
- package/color-picker/styles/_index.scss +21 -0
- package/date-picker/styles/_index.scss +108 -1
- package/dropdown/styles/_index.scss +40 -10
- package/fesm2022/ngwr-affix.mjs +3 -3
- package/fesm2022/ngwr-alert-testing.mjs +70 -0
- package/fesm2022/ngwr-alert-testing.mjs.map +1 -0
- package/fesm2022/ngwr-alert.mjs +3 -3
- package/fesm2022/ngwr-anchor.mjs +17 -6
- package/fesm2022/ngwr-anchor.mjs.map +1 -1
- package/fesm2022/ngwr-animations-aurora.mjs +3 -3
- package/fesm2022/ngwr-animations-blur-reveal.mjs +3 -3
- package/fesm2022/ngwr-animations-click-sparks.mjs +3 -3
- package/fesm2022/ngwr-animations-confetti.mjs +3 -3
- package/fesm2022/ngwr-animations-decode.mjs +3 -3
- package/fesm2022/ngwr-animations-destruct.mjs +3 -3
- package/fesm2022/ngwr-animations-dot-grid.mjs +3 -3
- package/fesm2022/ngwr-animations-falling-letters.mjs +3 -3
- package/fesm2022/ngwr-animations-flow-lines.mjs +3 -3
- package/fesm2022/ngwr-animations-fluid-cursor.mjs +3 -3
- package/fesm2022/ngwr-animations-glitch.mjs +3 -3
- package/fesm2022/ngwr-animations-glow-border.mjs +3 -3
- package/fesm2022/ngwr-animations-gradient-flow.mjs +3 -3
- package/fesm2022/ngwr-animations-marquee.mjs +3 -3
- package/fesm2022/ngwr-animations-orbit.mjs +3 -3
- package/fesm2022/ngwr-animations-reveal.mjs +3 -3
- package/fesm2022/ngwr-animations-ripple-grid.mjs +3 -3
- package/fesm2022/ngwr-animations-rotate-reveal.mjs +3 -3
- package/fesm2022/ngwr-animations-shimmer.mjs +3 -3
- package/fesm2022/ngwr-animations-spotlight.mjs +3 -3
- package/fesm2022/ngwr-animations-thread-lines.mjs +3 -3
- package/fesm2022/ngwr-animations-tilt.mjs +3 -3
- package/fesm2022/ngwr-animations-typewriter.mjs +3 -3
- package/fesm2022/ngwr-avatar.mjs +3 -3
- package/fesm2022/ngwr-back-top.mjs +3 -3
- package/fesm2022/ngwr-badge.mjs +129 -11
- package/fesm2022/ngwr-badge.mjs.map +1 -1
- package/fesm2022/ngwr-breadcrumbs-testing.mjs +83 -0
- package/fesm2022/ngwr-breadcrumbs-testing.mjs.map +1 -0
- package/fesm2022/ngwr-breadcrumbs.mjs +8 -8
- package/fesm2022/ngwr-breadcrumbs.mjs.map +1 -1
- package/fesm2022/ngwr-burger-testing.mjs +45 -0
- package/fesm2022/ngwr-burger-testing.mjs.map +1 -0
- package/fesm2022/ngwr-burger.mjs +3 -3
- package/fesm2022/ngwr-button.mjs +6 -6
- package/fesm2022/ngwr-calendar-testing.mjs +18 -0
- package/fesm2022/ngwr-calendar-testing.mjs.map +1 -1
- package/fesm2022/ngwr-calendar.mjs +500 -73
- package/fesm2022/ngwr-calendar.mjs.map +1 -1
- package/fesm2022/ngwr-card.mjs +9 -9
- package/fesm2022/ngwr-carousel.mjs +6 -6
- package/fesm2022/ngwr-cascader.mjs +37 -16
- package/fesm2022/ngwr-cascader.mjs.map +1 -1
- package/fesm2022/ngwr-charts-bar-chart.mjs +5 -4
- package/fesm2022/ngwr-charts-bar-chart.mjs.map +1 -1
- package/fesm2022/ngwr-charts-boxplot-chart.mjs +3 -3
- package/fesm2022/ngwr-charts-bullet-chart.mjs +3 -3
- package/fesm2022/ngwr-charts-calendar-heatmap.mjs +3 -3
- package/fesm2022/ngwr-charts-candlestick-chart.mjs +3 -3
- package/fesm2022/ngwr-charts-chart-legend.mjs +26 -11
- package/fesm2022/ngwr-charts-chart-legend.mjs.map +1 -1
- package/fesm2022/ngwr-charts-core.mjs +3 -3
- package/fesm2022/ngwr-charts-donut-chart.mjs +5 -4
- package/fesm2022/ngwr-charts-donut-chart.mjs.map +1 -1
- package/fesm2022/ngwr-charts-funnel-chart.mjs +3 -3
- package/fesm2022/ngwr-charts-gauge.mjs +3 -3
- package/fesm2022/ngwr-charts-heatmap-chart.mjs +3 -3
- package/fesm2022/ngwr-charts-line-chart-testing.mjs +3 -2
- package/fesm2022/ngwr-charts-line-chart-testing.mjs.map +1 -1
- package/fesm2022/ngwr-charts-line-chart.mjs +17 -7
- package/fesm2022/ngwr-charts-line-chart.mjs.map +1 -1
- package/fesm2022/ngwr-charts-meter-group.mjs +5 -4
- package/fesm2022/ngwr-charts-meter-group.mjs.map +1 -1
- package/fesm2022/ngwr-charts-radar-chart.mjs +5 -4
- package/fesm2022/ngwr-charts-radar-chart.mjs.map +1 -1
- package/fesm2022/ngwr-charts-scatter-chart.mjs +5 -4
- package/fesm2022/ngwr-charts-scatter-chart.mjs.map +1 -1
- package/fesm2022/ngwr-charts-sparkline.mjs +3 -3
- package/fesm2022/ngwr-charts-treemap-chart.mjs +3 -3
- package/fesm2022/ngwr-charts-waterfall-chart.mjs +3 -3
- package/fesm2022/ngwr-checkbox.mjs +6 -6
- package/fesm2022/ngwr-clipboard.mjs +3 -3
- package/fesm2022/ngwr-collapse.mjs +9 -9
- package/fesm2022/ngwr-color-picker-testing.mjs +11 -1
- package/fesm2022/ngwr-color-picker-testing.mjs.map +1 -1
- package/fesm2022/ngwr-color-picker.mjs +153 -37
- package/fesm2022/ngwr-color-picker.mjs.map +1 -1
- package/fesm2022/ngwr-command-palette.mjs +3 -3
- package/fesm2022/ngwr-comment.mjs +10 -6
- package/fesm2022/ngwr-comment.mjs.map +1 -1
- package/fesm2022/ngwr-compare-testing.mjs +84 -0
- package/fesm2022/ngwr-compare-testing.mjs.map +1 -0
- package/fesm2022/ngwr-compare.mjs +3 -3
- package/fesm2022/ngwr-context-menu.mjs +12 -12
- package/fesm2022/ngwr-cookie.mjs +3 -3
- package/fesm2022/ngwr-copy-value.mjs +3 -3
- package/fesm2022/ngwr-counter.mjs +6 -6
- package/fesm2022/ngwr-date-picker-testing.mjs +48 -4
- package/fesm2022/ngwr-date-picker-testing.mjs.map +1 -1
- package/fesm2022/ngwr-date-picker.mjs +492 -75
- package/fesm2022/ngwr-date-picker.mjs.map +1 -1
- package/fesm2022/ngwr-date-stamp-testing.mjs.map +1 -1
- package/fesm2022/ngwr-date-stamp.mjs +76 -12
- package/fesm2022/ngwr-date-stamp.mjs.map +1 -1
- package/fesm2022/ngwr-date.mjs +144 -12
- package/fesm2022/ngwr-date.mjs.map +1 -1
- package/fesm2022/ngwr-density.mjs +6 -6
- package/fesm2022/ngwr-descriptions.mjs +6 -6
- package/fesm2022/ngwr-dialog.mjs +18 -18
- package/fesm2022/ngwr-directives.mjs +15 -15
- package/fesm2022/ngwr-divider.mjs +3 -3
- package/fesm2022/ngwr-drawer.mjs +51 -29
- package/fesm2022/ngwr-drawer.mjs.map +1 -1
- package/fesm2022/ngwr-dropdown-testing.mjs +48 -5
- package/fesm2022/ngwr-dropdown-testing.mjs.map +1 -1
- package/fesm2022/ngwr-dropdown.mjs +407 -116
- package/fesm2022/ngwr-dropdown.mjs.map +1 -1
- package/fesm2022/ngwr-editor.mjs +4 -3
- package/fesm2022/ngwr-editor.mjs.map +1 -1
- package/fesm2022/ngwr-empty.mjs +3 -3
- package/fesm2022/ngwr-event-calendar.mjs +186 -33
- package/fesm2022/ngwr-event-calendar.mjs.map +1 -1
- package/fesm2022/ngwr-file-upload-testing.mjs +34 -2
- package/fesm2022/ngwr-file-upload-testing.mjs.map +1 -1
- package/fesm2022/ngwr-file-upload.mjs +274 -15
- package/fesm2022/ngwr-file-upload.mjs.map +1 -1
- package/fesm2022/ngwr-form.mjs +9 -9
- package/fesm2022/ngwr-form.mjs.map +1 -1
- package/fesm2022/ngwr-graph-testing.mjs +3 -0
- package/fesm2022/ngwr-graph-testing.mjs.map +1 -1
- package/fesm2022/ngwr-graph.mjs +102 -42
- package/fesm2022/ngwr-graph.mjs.map +1 -1
- package/fesm2022/ngwr-hotkey.mjs +6 -6
- package/fesm2022/ngwr-i18n-ar.mjs +26 -6
- package/fesm2022/ngwr-i18n-ar.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-cs.mjs +26 -6
- package/fesm2022/ngwr-i18n-cs.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-de.mjs +26 -6
- package/fesm2022/ngwr-i18n-de.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-en.mjs +26 -6
- package/fesm2022/ngwr-i18n-en.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-es.mjs +26 -6
- package/fesm2022/ngwr-i18n-es.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-fr.mjs +26 -6
- package/fesm2022/ngwr-i18n-fr.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-he.mjs +26 -6
- package/fesm2022/ngwr-i18n-he.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-hi.mjs +26 -6
- package/fesm2022/ngwr-i18n-hi.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-id.mjs +26 -6
- package/fesm2022/ngwr-i18n-id.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-it.mjs +26 -6
- package/fesm2022/ngwr-i18n-it.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-ja.mjs +26 -6
- package/fesm2022/ngwr-i18n-ja.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-ko.mjs +26 -6
- package/fesm2022/ngwr-i18n-ko.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-nl.mjs +26 -6
- package/fesm2022/ngwr-i18n-nl.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-pl.mjs +26 -6
- package/fesm2022/ngwr-i18n-pl.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-pt.mjs +26 -6
- package/fesm2022/ngwr-i18n-pt.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-ru.mjs +26 -6
- package/fesm2022/ngwr-i18n-ru.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-sv.mjs +26 -6
- package/fesm2022/ngwr-i18n-sv.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-tr.mjs +26 -6
- package/fesm2022/ngwr-i18n-tr.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-uk.mjs +26 -6
- package/fesm2022/ngwr-i18n-uk.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-vi.mjs +26 -6
- package/fesm2022/ngwr-i18n-vi.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-zh-tw.mjs +26 -6
- package/fesm2022/ngwr-i18n-zh-tw.mjs.map +1 -1
- package/fesm2022/ngwr-i18n-zh.mjs +26 -6
- package/fesm2022/ngwr-i18n-zh.mjs.map +1 -1
- package/fesm2022/ngwr-i18n.mjs +9 -9
- package/fesm2022/ngwr-icon.mjs +6 -6
- package/fesm2022/ngwr-image-cropper.mjs +3 -3
- package/fesm2022/ngwr-input-number-testing.mjs +11 -0
- package/fesm2022/ngwr-input-number-testing.mjs.map +1 -1
- package/fesm2022/ngwr-input-number.mjs +68 -7
- package/fesm2022/ngwr-input-number.mjs.map +1 -1
- package/fesm2022/ngwr-input-otp.mjs +23 -3
- package/fesm2022/ngwr-input-otp.mjs.map +1 -1
- package/fesm2022/ngwr-input-testing.mjs +24 -1
- package/fesm2022/ngwr-input-testing.mjs.map +1 -1
- package/fesm2022/ngwr-input.mjs +152 -36
- package/fesm2022/ngwr-input.mjs.map +1 -1
- package/fesm2022/ngwr-keyboard.mjs +3 -3
- package/fesm2022/ngwr-knob.mjs +3 -3
- package/fesm2022/ngwr-layout.mjs +15 -15
- package/fesm2022/ngwr-lightbox-testing.mjs +26 -0
- package/fesm2022/ngwr-lightbox-testing.mjs.map +1 -1
- package/fesm2022/ngwr-lightbox.mjs +249 -13
- package/fesm2022/ngwr-lightbox.mjs.map +1 -1
- package/fesm2022/ngwr-list.mjs +8 -8
- package/fesm2022/ngwr-list.mjs.map +1 -1
- package/fesm2022/ngwr-load-state.mjs +15 -15
- package/fesm2022/ngwr-loading-bar.mjs +6 -6
- package/fesm2022/ngwr-mention.mjs +6 -6
- package/fesm2022/ngwr-meta.mjs +6 -6
- package/fesm2022/ngwr-overlay.mjs +175 -13
- package/fesm2022/ngwr-overlay.mjs.map +1 -1
- package/fesm2022/ngwr-page-header.mjs +3 -3
- package/fesm2022/ngwr-pagination.mjs +5 -3
- package/fesm2022/ngwr-pagination.mjs.map +1 -1
- package/fesm2022/ngwr-pipes.mjs +57 -33
- package/fesm2022/ngwr-pipes.mjs.map +1 -1
- package/fesm2022/ngwr-platform.mjs +9 -9
- package/fesm2022/ngwr-popconfirm-testing.mjs +5 -2
- package/fesm2022/ngwr-popconfirm-testing.mjs.map +1 -1
- package/fesm2022/ngwr-popconfirm.mjs +44 -63
- package/fesm2022/ngwr-popconfirm.mjs.map +1 -1
- package/fesm2022/ngwr-popover-testing.mjs +7 -1
- package/fesm2022/ngwr-popover-testing.mjs.map +1 -1
- package/fesm2022/ngwr-popover.mjs +58 -156
- package/fesm2022/ngwr-popover.mjs.map +1 -1
- package/fesm2022/ngwr-progress.mjs +50 -9
- package/fesm2022/ngwr-progress.mjs.map +1 -1
- package/fesm2022/ngwr-pull-to-refresh-testing.mjs +57 -0
- package/fesm2022/ngwr-pull-to-refresh-testing.mjs.map +1 -0
- package/fesm2022/ngwr-pull-to-refresh.mjs +3 -3
- package/fesm2022/ngwr-qr.mjs +3 -3
- package/fesm2022/ngwr-radio.mjs +6 -6
- package/fesm2022/ngwr-rating.mjs +3 -3
- package/fesm2022/ngwr-resizable-testing.mjs +113 -0
- package/fesm2022/ngwr-resizable-testing.mjs.map +1 -0
- package/fesm2022/ngwr-resizable.mjs +3 -3
- package/fesm2022/ngwr-result.mjs +12 -12
- package/fesm2022/ngwr-schema-form-testing.mjs +336 -0
- package/fesm2022/ngwr-schema-form-testing.mjs.map +1 -0
- package/fesm2022/ngwr-schema-form.mjs +418 -19
- package/fesm2022/ngwr-schema-form.mjs.map +1 -1
- package/fesm2022/ngwr-scroll.mjs +3 -3
- package/fesm2022/ngwr-segmented.mjs +3 -3
- package/fesm2022/ngwr-select-testing.mjs +19 -0
- package/fesm2022/ngwr-select-testing.mjs.map +1 -1
- package/fesm2022/ngwr-select.mjs +263 -83
- package/fesm2022/ngwr-select.mjs.map +1 -1
- package/fesm2022/ngwr-sidebar-testing.mjs +176 -0
- package/fesm2022/ngwr-sidebar-testing.mjs.map +1 -0
- package/fesm2022/ngwr-sidebar.mjs +3 -3
- package/fesm2022/ngwr-skeleton.mjs +3 -3
- package/fesm2022/ngwr-slider-testing.mjs +23 -0
- package/fesm2022/ngwr-slider-testing.mjs.map +1 -1
- package/fesm2022/ngwr-slider.mjs +108 -14
- package/fesm2022/ngwr-slider.mjs.map +1 -1
- package/fesm2022/ngwr-sortable-list-testing.mjs +103 -0
- package/fesm2022/ngwr-sortable-list-testing.mjs.map +1 -0
- package/fesm2022/ngwr-sortable-list.mjs +284 -63
- package/fesm2022/ngwr-sortable-list.mjs.map +1 -1
- package/fesm2022/ngwr-speed-dial.mjs +3 -3
- package/fesm2022/ngwr-spinner.mjs +3 -3
- package/fesm2022/ngwr-splitter.mjs +3 -3
- package/fesm2022/ngwr-statistic.mjs +9 -9
- package/fesm2022/ngwr-stepper.mjs +42 -11
- package/fesm2022/ngwr-stepper.mjs.map +1 -1
- package/fesm2022/ngwr-storage.mjs +3 -3
- package/fesm2022/ngwr-switch.mjs +3 -3
- package/fesm2022/ngwr-table-testing.mjs +88 -2
- package/fesm2022/ngwr-table-testing.mjs.map +1 -1
- package/fesm2022/ngwr-table.mjs +891 -74
- package/fesm2022/ngwr-table.mjs.map +1 -1
- package/fesm2022/ngwr-tabs-router.mjs +3 -3
- package/fesm2022/ngwr-tabs-testing.mjs +1 -1
- package/fesm2022/ngwr-tabs-testing.mjs.map +1 -1
- package/fesm2022/ngwr-tabs.mjs +15 -10
- package/fesm2022/ngwr-tabs.mjs.map +1 -1
- package/fesm2022/ngwr-textarea-testing.mjs +11 -0
- package/fesm2022/ngwr-textarea-testing.mjs.map +1 -1
- package/fesm2022/ngwr-textarea.mjs +128 -16
- package/fesm2022/ngwr-textarea.mjs.map +1 -1
- package/fesm2022/ngwr-theme.mjs +3 -3
- package/fesm2022/ngwr-timeline.mjs +6 -6
- package/fesm2022/ngwr-toast.mjs +40 -19
- package/fesm2022/ngwr-toast.mjs.map +1 -1
- package/fesm2022/ngwr-toolbar.mjs +3 -3
- package/fesm2022/ngwr-tour.mjs +6 -6
- package/fesm2022/ngwr-transfer-testing.mjs +6 -0
- package/fesm2022/ngwr-transfer-testing.mjs.map +1 -1
- package/fesm2022/ngwr-transfer.mjs +24 -5
- package/fesm2022/ngwr-transfer.mjs.map +1 -1
- package/fesm2022/ngwr-tree-testing.mjs +62 -2
- package/fesm2022/ngwr-tree-testing.mjs.map +1 -1
- package/fesm2022/ngwr-tree.mjs +966 -78
- package/fesm2022/ngwr-tree.mjs.map +1 -1
- package/fesm2022/ngwr-typography.mjs +3 -3
- package/fesm2022/ngwr-utils-router.mjs +3 -3
- package/fesm2022/ngwr-utils.mjs +34 -1
- package/fesm2022/ngwr-utils.mjs.map +1 -1
- package/fesm2022/ngwr-version.mjs +1 -1
- package/fesm2022/ngwr-version.mjs.map +1 -1
- package/fesm2022/ngwr-virtual-scroll.mjs +3 -3
- package/fesm2022/ngwr-window.mjs +33 -22
- package/fesm2022/ngwr-window.mjs.map +1 -1
- package/file-upload/styles/_index.scss +156 -0
- package/i18n/ar.json +28 -6
- package/i18n/cs.json +28 -6
- package/i18n/de.json +28 -6
- package/i18n/en.json +28 -6
- package/i18n/es.json +28 -6
- package/i18n/fr.json +28 -6
- package/i18n/he.json +28 -6
- package/i18n/hi.json +28 -6
- package/i18n/id.json +28 -6
- package/i18n/it.json +28 -6
- package/i18n/ja.json +28 -6
- package/i18n/ko.json +28 -6
- package/i18n/nl.json +28 -6
- package/i18n/pl.json +28 -6
- package/i18n/pt.json +28 -6
- package/i18n/ru.json +28 -6
- package/i18n/sv.json +28 -6
- package/i18n/tr.json +28 -6
- package/i18n/uk.json +28 -6
- package/i18n/vi.json +28 -6
- package/i18n/zh-TW.json +28 -6
- package/i18n/zh.json +28 -6
- package/input/styles/_index.scss +68 -1
- package/input-otp/styles/_index.scss +14 -0
- package/lightbox/styles/_rules.scss +96 -0
- package/llms-full.txt +61 -25
- package/llms.txt +12 -0
- package/overlay/styles/_arrow.scss +4 -4
- package/package.json +37 -1
- package/popconfirm/styles/_index.scss +3 -11
- package/progress/styles/_index.scss +32 -0
- package/schema-form/styles/_index.scss +78 -0
- package/schematics/use/rule.js +2 -0
- package/schematics/use/symbol-map.json +5 -0
- package/select/styles/_index.scss +114 -22
- package/skills/ngwr/SKILL.md +1 -1
- package/skills/ngwr/references/catalog.md +11 -2
- package/slider/styles/_index.scss +128 -0
- package/sortable-list/styles/_rules.scss +23 -1
- package/table/styles/_index.scss +167 -3
- package/textarea/styles/_index.scss +80 -0
- package/theme/styles/_focus.scss +5 -0
- package/theme/styles/_motion.scss +5 -0
- package/transfer/styles/_index.scss +84 -0
- package/tree/styles/_index.scss +138 -5
- package/types/ngwr-alert-testing.d.ts +88 -0
- package/types/ngwr-badge.d.ts +72 -2
- package/types/ngwr-breadcrumbs-testing.d.ts +92 -0
- package/types/ngwr-burger-testing.d.ts +51 -0
- package/types/ngwr-calendar-testing.d.ts +18 -6
- package/types/ngwr-calendar.d.ts +272 -22
- package/types/ngwr-cascader.d.ts +10 -1
- package/types/ngwr-charts-chart-legend.d.ts +9 -4
- package/types/ngwr-charts-line-chart-testing.d.ts +4 -1
- package/types/ngwr-charts-line-chart.d.ts +7 -4
- package/types/ngwr-color-picker-testing.d.ts +15 -4
- package/types/ngwr-color-picker.d.ts +76 -6
- package/types/ngwr-compare-testing.d.ts +72 -0
- package/types/ngwr-date-picker-testing.d.ts +40 -8
- package/types/ngwr-date-picker.d.ts +178 -10
- package/types/ngwr-date-stamp-testing.d.ts +1 -1
- package/types/ngwr-date-stamp.d.ts +53 -7
- package/types/ngwr-date.d.ts +188 -15
- package/types/ngwr-drawer.d.ts +9 -0
- package/types/ngwr-dropdown-testing.d.ts +73 -5
- package/types/ngwr-dropdown.d.ts +124 -6
- package/types/ngwr-event-calendar.d.ts +66 -8
- package/types/ngwr-file-upload-testing.d.ts +31 -2
- package/types/ngwr-file-upload.d.ts +148 -1
- package/types/ngwr-form.d.ts +47 -3
- package/types/ngwr-graph-testing.d.ts +8 -3
- package/types/ngwr-graph.d.ts +147 -7
- package/types/ngwr-input-number-testing.d.ts +10 -0
- package/types/ngwr-input-number.d.ts +30 -1
- package/types/ngwr-input-otp.d.ts +10 -0
- package/types/ngwr-input-testing.d.ts +30 -0
- package/types/ngwr-input.d.ts +54 -3
- package/types/ngwr-lightbox-testing.d.ts +27 -0
- package/types/ngwr-lightbox.d.ts +71 -6
- package/types/ngwr-overlay.d.ts +84 -5
- package/types/ngwr-pipes.d.ts +34 -13
- package/types/ngwr-popconfirm-testing.d.ts +12 -3
- package/types/ngwr-popconfirm.d.ts +28 -3
- package/types/ngwr-popover-testing.d.ts +19 -2
- package/types/ngwr-popover.d.ts +22 -2
- package/types/ngwr-progress.d.ts +29 -1
- package/types/ngwr-pull-to-refresh-testing.d.ts +83 -0
- package/types/ngwr-resizable-testing.d.ts +116 -0
- package/types/ngwr-schema-form-testing.d.ts +260 -0
- package/types/ngwr-schema-form.d.ts +76 -6
- package/types/ngwr-select-testing.d.ts +20 -0
- package/types/ngwr-select.d.ts +112 -11
- package/types/ngwr-sidebar-testing.d.ts +176 -0
- package/types/ngwr-slider-testing.d.ts +10 -1
- package/types/ngwr-slider.d.ts +109 -3
- package/types/ngwr-sortable-list-testing.d.ts +79 -0
- package/types/ngwr-sortable-list.d.ts +119 -10
- package/types/ngwr-stepper.d.ts +20 -11
- package/types/ngwr-table-testing.d.ts +70 -6
- package/types/ngwr-table.d.ts +480 -50
- package/types/ngwr-tabs-testing.d.ts +14 -17
- package/types/ngwr-tabs.d.ts +6 -0
- package/types/ngwr-textarea-testing.d.ts +10 -0
- package/types/ngwr-textarea.d.ts +48 -2
- package/types/ngwr-toast.d.ts +8 -1
- package/types/ngwr-transfer-testing.d.ts +3 -0
- package/types/ngwr-transfer.d.ts +24 -1
- package/types/ngwr-tree-testing.d.ts +65 -1
- package/types/ngwr-tree.d.ts +333 -12
- package/types/ngwr-utils.d.ts +28 -0
- package/types/ngwr-version.d.ts +1 -1
- package/types/ngwr-window.d.ts +7 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngwr-date-stamp-testing.mjs","names":[],"sources":["../../../projects/lib/date-stamp/testing/wr-date-stamp-harness.ts"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { ComponentHarness, HarnessPredicate } from '@angular/cdk/testing';\n\nimport type { WrDateStampHarnessFilters } from './types';\n\n/**\n * Test harness for one `<wr-date-stamp>`: a date over a time.\n *\n * It answers from what the component renders: the two lines as text and the\n * `datetime` attribute of the `<time>` around them. The lines are written in\n * the locale and the time zone of the test's own providers, so a spec that\n * must not depend on either asserts {@link getDateTime}, which is the instant.\n *\n * @example\n * ```ts\n * const loader = TestbedHarnessEnvironment.loader(fixture);\n * const created = await loader.getHarness(WrDateStampHarness);\n *\n * expect(await created.getDateTime()).toBe('2026-11-12T08:45:00.000Z');\n * expect(await created.getTime()).toBe('13:45');\n * ```\n *\n * @see https://ngwr.dev/guides/testing\n */\nexport class WrDateStampHarness extends ComponentHarness {\n static hostSelector = 'wr-date-stamp';\n\n /** Build a predicate that narrows the query — pass to `getHarness` / `getAllHarnesses`. */\n static with(options: WrDateStampHarnessFilters = {}): HarnessPredicate<WrDateStampHarness> {\n return new HarnessPredicate(WrDateStampHarness, options)\n .addOption('date', options.date, (harness, date) => HarnessPredicate.stringMatches(harness.getDate(), date))\n .addOption('empty', options.empty, async (harness, empty) => (await harness.isEmpty()) === empty);\n }\n\n private readonly time = this.locatorForOptional('time.wr-date-stamp__value');\n\n /** The first line, or `null` when the stamp is empty. */\n async getDate(): Promise<string | null> {\n return (await (await this.locatorForOptional('.wr-date-stamp__date')())?.text()) ?? null;\n }\n\n /** The second line, or `null` when the stamp is empty or shows a date-only value. */\n async getTime(): Promise<string | null> {\n return (await (await this.locatorForOptional('.wr-date-stamp__time')())?.text()) ?? null;\n }\n\n /**\n * The `datetime` attribute: the instant in ISO 8601 (UTC), or `yyyy-MM-dd` for a\n * date-only value. `null` when the stamp is empty.\n */\n async getDateTime(): Promise<string | null> {\n return (await (await this.time())?.getAttribute('datetime')) ?? null;\n }\n\n /** Whether the value is empty: no `<time>`, the placeholder in its place. */\n async isEmpty(): Promise<boolean> {\n return (await this.time()) === null;\n }\n\n /** The placeholder an empty value shows (`emptyLabel`). Throws when there is a value. */\n async getEmptyText(): Promise<string> {\n const empty = await this.locatorForOptional('.wr-date-stamp__empty')();\n if (!empty) {\n throw new Error(\n 'WrDateStampHarness.getEmptyText(): the component shows a date, so it renders no placeholder. ' +\n 'Ask getDate() instead.'\n );\n }\n return empty.text();\n }\n}\n"],"mappings":";;;;;;;AA8BA,IAAa,qBAAb,MAAa,2BAA2B,iBAAgB;CACtD,OAAO,eAAe;CAGtB,OAAO,KAAK,UAAqC,CAAA,GAAE;EACjD,OAAO,IAAI,iBAAiB,oBAAoB,OAAO,CAAC,CACrD,UAAU,QAAQ,QAAQ,OAAO,SAAS,SAAS,iBAAiB,cAAc,QAAQ,QAAO,GAAI,IAAI,CAAC,CAAC,CAC3G,UAAU,SAAS,QAAQ,OAAO,OAAO,SAAS,UAAW,MAAM,QAAQ,QAAO,MAAQ,KAAK;CACpG;CAEiB,OAAO,KAAK,mBAAmB,2BAA2B;CAG3E,MAAM,UAAO;EACX,OAAQ,OAAO,MAAM,KAAK,mBAAmB,sBAAsB,CAAC,CAAA,EAAA,EAAK,KAAI,KAAO;CACtF;CAGA,MAAM,UAAO;EACX,OAAQ,OAAO,MAAM,KAAK,mBAAmB,sBAAsB,CAAC,CAAA,EAAA,EAAK,KAAI,KAAO;CACtF;CAMA,MAAM,cAAW;EACf,OAAQ,OAAO,MAAM,KAAK,KAAI,EAAA,EAAK,aAAa,UAAU,KAAM;CAClE;CAGA,MAAM,UAAO;EACX,OAAQ,MAAM,KAAK,KAAI,MAAQ;CACjC;CAGA,MAAM,eAAY;EAChB,MAAM,QAAQ,MAAM,KAAK,mBAAmB,uBAAuB,CAAC,CAAA;EACpE,IAAI,CAAC,OACH,MAAM,IAAI,MACR,qHAC0B;EAG9B,OAAO,MAAM,KAAI;CACnB"}
|
|
1
|
+
{"version":3,"file":"ngwr-date-stamp-testing.mjs","names":[],"sources":["../../../projects/lib/date-stamp/testing/wr-date-stamp-harness.ts"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { ComponentHarness, HarnessPredicate } from '@angular/cdk/testing';\n\nimport type { WrDateStampHarnessFilters } from './types';\n\n/**\n * Test harness for one `<wr-date-stamp>`: a date over a time.\n *\n * It answers from what the component renders: the two lines as text and the\n * `datetime` attribute of the `<time>` around them. The lines are written in\n * the locale and the time zone of the test's own providers, so a spec that\n * must not depend on either asserts {@link getDateTime}, which is the instant.\n *\n * @example\n * ```ts\n * const loader = TestbedHarnessEnvironment.loader(fixture);\n * const created = await loader.getHarness(WrDateStampHarness);\n *\n * expect(await created.getDateTime()).toBe('2026-11-12T08:45:00.000Z');\n * expect(await created.getTime()).toBe('13:45');\n * ```\n *\n * @see https://ngwr.dev/guides/testing\n */\nexport class WrDateStampHarness extends ComponentHarness {\n static hostSelector = 'wr-date-stamp';\n\n /** Build a predicate that narrows the query — pass to `getHarness` / `getAllHarnesses`. */\n static with(options: WrDateStampHarnessFilters = {}): HarnessPredicate<WrDateStampHarness> {\n return new HarnessPredicate(WrDateStampHarness, options)\n .addOption('date', options.date, (harness, date) => HarnessPredicate.stringMatches(harness.getDate(), date))\n .addOption('empty', options.empty, async (harness, empty) => (await harness.isEmpty()) === empty);\n }\n\n private readonly time = this.locatorForOptional('time.wr-date-stamp__value');\n\n /** The first line, or `null` when the stamp is empty or `todayTimeOnly` shows a value from today. */\n async getDate(): Promise<string | null> {\n return (await (await this.locatorForOptional('.wr-date-stamp__date')())?.text()) ?? null;\n }\n\n /** The second line, or `null` when the stamp is empty or shows a date-only value. */\n async getTime(): Promise<string | null> {\n return (await (await this.locatorForOptional('.wr-date-stamp__time')())?.text()) ?? null;\n }\n\n /**\n * The `datetime` attribute: the instant in ISO 8601 (UTC), or `yyyy-MM-dd` for a\n * date-only value. `null` when the stamp is empty.\n */\n async getDateTime(): Promise<string | null> {\n return (await (await this.time())?.getAttribute('datetime')) ?? null;\n }\n\n /** Whether the value is empty: no `<time>`, the placeholder in its place. */\n async isEmpty(): Promise<boolean> {\n return (await this.time()) === null;\n }\n\n /** The placeholder an empty value shows (`emptyLabel`). Throws when there is a value. */\n async getEmptyText(): Promise<string> {\n const empty = await this.locatorForOptional('.wr-date-stamp__empty')();\n if (!empty) {\n throw new Error(\n 'WrDateStampHarness.getEmptyText(): the component shows a date, so it renders no placeholder. ' +\n 'Ask getDate() instead.'\n );\n }\n return empty.text();\n }\n}\n"],"mappings":";;;;;;;AA8BA,IAAa,qBAAb,MAAa,2BAA2B,iBAAgB;CACtD,OAAO,eAAe;CAGtB,OAAO,KAAK,UAAqC,CAAA,GAAE;EACjD,OAAO,IAAI,iBAAiB,oBAAoB,OAAO,CAAC,CACrD,UAAU,QAAQ,QAAQ,OAAO,SAAS,SAAS,iBAAiB,cAAc,QAAQ,QAAO,GAAI,IAAI,CAAC,CAAC,CAC3G,UAAU,SAAS,QAAQ,OAAO,OAAO,SAAS,UAAW,MAAM,QAAQ,QAAO,MAAQ,KAAK;CACpG;CAEiB,OAAO,KAAK,mBAAmB,2BAA2B;CAG3E,MAAM,UAAO;EACX,OAAQ,OAAO,MAAM,KAAK,mBAAmB,sBAAsB,CAAC,CAAA,EAAA,EAAK,KAAI,KAAO;CACtF;CAGA,MAAM,UAAO;EACX,OAAQ,OAAO,MAAM,KAAK,mBAAmB,sBAAsB,CAAC,CAAA,EAAA,EAAK,KAAI,KAAO;CACtF;CAMA,MAAM,cAAW;EACf,OAAQ,OAAO,MAAM,KAAK,KAAI,EAAA,EAAK,aAAa,UAAU,KAAM;CAClE;CAGA,MAAM,UAAO;EACX,OAAQ,MAAM,KAAK,KAAI,MAAQ;CACjC;CAGA,MAAM,eAAY;EAChB,MAAM,QAAQ,MAAM,KAAK,mBAAmB,uBAAuB,CAAC,CAAA;EACpE,IAAI,CAAC,OACH,MAAM,IAAI,MACR,qHAC0B;EAG9B,OAAO,MAAM,KAAI;CACnB"}
|
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
import * as i0 from "@angular/core";
|
|
2
|
-
import { Component, ViewEncapsulation, computed, inject, input } from "@angular/core";
|
|
2
|
+
import { Component, ViewEncapsulation, booleanAttribute, computed, inject, input } from "@angular/core";
|
|
3
3
|
import { wrCheckStyles } from "ngwr/utils";
|
|
4
4
|
import { useI18nText } from "ngwr/i18n";
|
|
5
|
-
import { WrDateAdapter, wrIsDateOnly, wrParseDate } from "ngwr/date";
|
|
5
|
+
import { WR_DATE_STAMP_DEFAULTS, WrDateAdapter, wrIsDateOnly, wrIsNamedFormat, wrParseDate } from "ngwr/date";
|
|
6
6
|
/**
|
|
7
7
|
* @license
|
|
8
8
|
*
|
|
9
9
|
* Use of this source code is governed by an MIT-style license that can be
|
|
10
10
|
* found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE
|
|
11
11
|
*/
|
|
12
|
+
function withSeconds(format) {
|
|
13
|
+
if (wrIsNamedFormat(format)) return /^(?:time|shortDateTime)(?:12h|24h)?$/.test(format) ? `${format}Seconds` : format;
|
|
14
|
+
return format.includes("ss") ? format : format.replace("mm", "mm:ss");
|
|
15
|
+
}
|
|
12
16
|
function pad(n, width = 2) {
|
|
13
17
|
return String(n).padStart(width, "0");
|
|
14
18
|
}
|
|
@@ -16,15 +20,29 @@ var WrDateStamp = class WrDateStamp {
|
|
|
16
20
|
constructor() {
|
|
17
21
|
if (typeof ngDevMode === "undefined" || ngDevMode) wrCheckStyles("date-stamp");
|
|
18
22
|
}
|
|
23
|
+
defaults = inject(WR_DATE_STAMP_DEFAULTS);
|
|
19
24
|
value = input(null, ...ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []);
|
|
20
|
-
dateFormat = input("mediumDate", ...ngDevMode ? [{ debugName: "dateFormat" }] : /* istanbul ignore next */ []);
|
|
21
|
-
timeFormat = input("time", ...ngDevMode ? [{ debugName: "timeFormat" }] : /* istanbul ignore next */ []);
|
|
25
|
+
dateFormat = input(this.defaults.dateFormat ?? "mediumDate", ...ngDevMode ? [{ debugName: "dateFormat" }] : /* istanbul ignore next */ []);
|
|
26
|
+
timeFormat = input(this.defaults.timeFormat ?? "time", ...ngDevMode ? [{ debugName: "timeFormat" }] : /* istanbul ignore next */ []);
|
|
27
|
+
seconds = input(this.defaults.seconds ?? false, {
|
|
28
|
+
...ngDevMode ? { debugName: "seconds" } : /* istanbul ignore next */ {},
|
|
29
|
+
transform: booleanAttribute
|
|
30
|
+
});
|
|
31
|
+
todayTimeOnly = input(this.defaults.todayTimeOnly ?? false, {
|
|
32
|
+
...ngDevMode ? { debugName: "todayTimeOnly" } : /* istanbul ignore next */ {},
|
|
33
|
+
transform: booleanAttribute
|
|
34
|
+
});
|
|
35
|
+
epochUnit = input(null, ...ngDevMode ? [{ debugName: "epochUnit" }] : /* istanbul ignore next */ []);
|
|
22
36
|
emptyLabel = input(null, ...ngDevMode ? [{ debugName: "emptyLabel" }] : /* istanbul ignore next */ []);
|
|
23
37
|
resolvedEmptyLabel = useI18nText(this.emptyLabel, "copyValue.empty", "-");
|
|
24
38
|
adapter = inject(WrDateAdapter);
|
|
25
39
|
parts = computed(() => {
|
|
26
40
|
const value = this.value();
|
|
27
|
-
const
|
|
41
|
+
const epochUnit = this.epochUnit();
|
|
42
|
+
const date = wrParseDate(value, {
|
|
43
|
+
...this.adapter.parseOptions(),
|
|
44
|
+
...epochUnit ? { epochUnit } : {}
|
|
45
|
+
});
|
|
28
46
|
if (date === null) return null;
|
|
29
47
|
if (wrIsDateOnly(value)) return {
|
|
30
48
|
iso: `${pad(date.getFullYear(), 4)}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}`,
|
|
@@ -32,15 +50,16 @@ var WrDateStamp = class WrDateStamp {
|
|
|
32
50
|
time: null
|
|
33
51
|
};
|
|
34
52
|
const zoned = this.adapter.zoned();
|
|
53
|
+
const timeFormat = this.timeFormat();
|
|
35
54
|
return {
|
|
36
55
|
iso: date.toISOString(),
|
|
37
|
-
date: zoned.format(date, this.dateFormat()),
|
|
38
|
-
time: zoned.format(date, this.
|
|
56
|
+
date: this.todayTimeOnly() && zoned.isSameDay(date, zoned.today()) ? null : zoned.format(date, this.dateFormat()),
|
|
57
|
+
time: zoned.format(date, this.seconds() ? withSeconds(timeFormat) : timeFormat)
|
|
39
58
|
};
|
|
40
59
|
}, ...ngDevMode ? [{ debugName: "parts" }] : /* istanbul ignore next */ []);
|
|
41
60
|
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
42
61
|
minVersion: "12.0.0",
|
|
43
|
-
version: "22.2.
|
|
62
|
+
version: "22.2.6",
|
|
44
63
|
ngImport: i0,
|
|
45
64
|
type: WrDateStamp,
|
|
46
65
|
deps: [],
|
|
@@ -48,7 +67,7 @@ var WrDateStamp = class WrDateStamp {
|
|
|
48
67
|
});
|
|
49
68
|
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
50
69
|
minVersion: "17.0.0",
|
|
51
|
-
version: "22.2.
|
|
70
|
+
version: "22.2.6",
|
|
52
71
|
type: WrDateStamp,
|
|
53
72
|
isStandalone: true,
|
|
54
73
|
selector: "wr-date-stamp",
|
|
@@ -74,6 +93,27 @@ var WrDateStamp = class WrDateStamp {
|
|
|
74
93
|
isRequired: false,
|
|
75
94
|
transformFunction: null
|
|
76
95
|
},
|
|
96
|
+
seconds: {
|
|
97
|
+
classPropertyName: "seconds",
|
|
98
|
+
publicName: "seconds",
|
|
99
|
+
isSignal: true,
|
|
100
|
+
isRequired: false,
|
|
101
|
+
transformFunction: null
|
|
102
|
+
},
|
|
103
|
+
todayTimeOnly: {
|
|
104
|
+
classPropertyName: "todayTimeOnly",
|
|
105
|
+
publicName: "todayTimeOnly",
|
|
106
|
+
isSignal: true,
|
|
107
|
+
isRequired: false,
|
|
108
|
+
transformFunction: null
|
|
109
|
+
},
|
|
110
|
+
epochUnit: {
|
|
111
|
+
classPropertyName: "epochUnit",
|
|
112
|
+
publicName: "epochUnit",
|
|
113
|
+
isSignal: true,
|
|
114
|
+
isRequired: false,
|
|
115
|
+
transformFunction: null
|
|
116
|
+
},
|
|
77
117
|
emptyLabel: {
|
|
78
118
|
classPropertyName: "emptyLabel",
|
|
79
119
|
publicName: "emptyLabel",
|
|
@@ -87,13 +127,13 @@ var WrDateStamp = class WrDateStamp {
|
|
|
87
127
|
classAttribute: "wr-date-stamp"
|
|
88
128
|
},
|
|
89
129
|
ngImport: i0,
|
|
90
|
-
template: "@if (parts(); as stamp) {\n <time class=\"wr-date-stamp__value\" [attr.datetime]=\"stamp.iso\">\n <span class=\"wr-date-stamp__date\">{{ stamp.date }}</span>\n @if (stamp.time !== null) {\n <span class=\"wr-date-stamp__time\">{{ stamp.time }}</span>\n }\n </time>\n} @else {\n <span class=\"wr-date-stamp__empty\">{{ resolvedEmptyLabel() }}</span>\n}\n",
|
|
130
|
+
template: "@if (parts(); as stamp) {\n <time class=\"wr-date-stamp__value\" [attr.datetime]=\"stamp.iso\">\n @if (stamp.date !== null) {\n <span class=\"wr-date-stamp__date\">{{ stamp.date }}</span>\n }\n @if (stamp.time !== null) {\n <span class=\"wr-date-stamp__time\">{{ stamp.time }}</span>\n }\n </time>\n} @else {\n <span class=\"wr-date-stamp__empty\">{{ resolvedEmptyLabel() }}</span>\n}\n",
|
|
91
131
|
encapsulation: i0.ViewEncapsulation.None
|
|
92
132
|
});
|
|
93
133
|
};
|
|
94
134
|
i0.ɵɵngDeclareClassMetadata({
|
|
95
135
|
minVersion: "12.0.0",
|
|
96
|
-
version: "22.2.
|
|
136
|
+
version: "22.2.6",
|
|
97
137
|
ngImport: i0,
|
|
98
138
|
type: WrDateStamp,
|
|
99
139
|
decorators: [{
|
|
@@ -105,7 +145,7 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
105
145
|
class: "wr-date-stamp",
|
|
106
146
|
"[class.wr-date-stamp--empty]": "parts() === null"
|
|
107
147
|
},
|
|
108
|
-
template: "@if (parts(); as stamp) {\n <time class=\"wr-date-stamp__value\" [attr.datetime]=\"stamp.iso\">\n <span class=\"wr-date-stamp__date\">{{ stamp.date }}</span>\n @if (stamp.time !== null) {\n <span class=\"wr-date-stamp__time\">{{ stamp.time }}</span>\n }\n </time>\n} @else {\n <span class=\"wr-date-stamp__empty\">{{ resolvedEmptyLabel() }}</span>\n}\n"
|
|
148
|
+
template: "@if (parts(); as stamp) {\n <time class=\"wr-date-stamp__value\" [attr.datetime]=\"stamp.iso\">\n @if (stamp.date !== null) {\n <span class=\"wr-date-stamp__date\">{{ stamp.date }}</span>\n }\n @if (stamp.time !== null) {\n <span class=\"wr-date-stamp__time\">{{ stamp.time }}</span>\n }\n </time>\n} @else {\n <span class=\"wr-date-stamp__empty\">{{ resolvedEmptyLabel() }}</span>\n}\n"
|
|
109
149
|
}]
|
|
110
150
|
}],
|
|
111
151
|
ctorParameters: () => [],
|
|
@@ -134,6 +174,30 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
134
174
|
required: false
|
|
135
175
|
}]
|
|
136
176
|
}],
|
|
177
|
+
seconds: [{
|
|
178
|
+
type: i0.Input,
|
|
179
|
+
args: [{
|
|
180
|
+
isSignal: true,
|
|
181
|
+
alias: "seconds",
|
|
182
|
+
required: false
|
|
183
|
+
}]
|
|
184
|
+
}],
|
|
185
|
+
todayTimeOnly: [{
|
|
186
|
+
type: i0.Input,
|
|
187
|
+
args: [{
|
|
188
|
+
isSignal: true,
|
|
189
|
+
alias: "todayTimeOnly",
|
|
190
|
+
required: false
|
|
191
|
+
}]
|
|
192
|
+
}],
|
|
193
|
+
epochUnit: [{
|
|
194
|
+
type: i0.Input,
|
|
195
|
+
args: [{
|
|
196
|
+
isSignal: true,
|
|
197
|
+
alias: "epochUnit",
|
|
198
|
+
required: false
|
|
199
|
+
}]
|
|
200
|
+
}],
|
|
137
201
|
emptyLabel: [{
|
|
138
202
|
type: i0.Input,
|
|
139
203
|
args: [{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ngwr-date-stamp.mjs","names":[],"sources":["../../../projects/lib/date-stamp/date-stamp.ts","../../../projects/lib/date-stamp/date-stamp.html"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { Component, ViewEncapsulation, computed, inject, input } from '@angular/core';\n\nimport {
|
|
1
|
+
{"version":3,"file":"ngwr-date-stamp.mjs","names":[],"sources":["../../../projects/lib/date-stamp/date-stamp.ts","../../../projects/lib/date-stamp/date-stamp.html"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { Component, ViewEncapsulation, booleanAttribute, computed, inject, input } from '@angular/core';\n\nimport {\n type WrDateFormat,\n type WrEpochUnit,\n WR_DATE_STAMP_DEFAULTS,\n WrDateAdapter,\n wrIsDateOnly,\n wrIsNamedFormat,\n wrParseDate,\n} from 'ngwr/date';\nimport { useI18nText } from 'ngwr/i18n';\nimport { wrCheckStyles } from 'ngwr/utils';\n\ninterface Stamp {\n readonly iso: string;\n readonly date: string | null;\n readonly time: string | null;\n}\n\n/** The format with seconds: the `Seconds` twin of a named key, `ss` after the minutes of a token string. */\nfunction withSeconds(format: string): string {\n if (wrIsNamedFormat(format)) return /^(?:time|shortDateTime)(?:12h|24h)?$/.test(format) ? `${format}Seconds` : format;\n return format.includes('ss') ? format : format.replace('mm', 'mm:ss');\n}\n\nfunction pad(n: number, width = 2): string {\n return String(n).padStart(width, '0');\n}\n\n/**\n * A moment in two lines, for a table cell: the date over the time.\n *\n * Both lines are written by the date adapter, so they are in the interface\n * language and, for an instant, on the wall clock of\n * `withDates({ timeZone })`, and they follow both at runtime. The value is read\n * as `wrDate` reads it: a `Date`, an epoch number or a string, under the\n * `epochUnit` and `zonelessIn` of `withDates()`. A date-only string\n * (`'2026-11-12'`) is a day, so it shows the date line alone and does not\n * shift with the zone.\n *\n * `withDates({ stamp })` sets the formats, `todayTimeOnly` and `seconds` for\n * every stamp of the app; an input set here wins.\n *\n * The lines sit in one `<time>` whose `datetime` is the instant in ISO 8601,\n * or the day for a date-only string. `null`, `undefined`, `''` and a value\n * that is not a date are empty: the component shows `emptyLabel`.\n *\n * @example\n * ```html\n * <wr-date-stamp [value]=\"row.createdAt\" />\n * <wr-date-stamp [value]=\"row.createdAt\" dateFormat=\"d MMM yyyy\" timeFormat=\"time24hSeconds\" />\n * <wr-date-stamp [value]=\"message.sentAt\" todayTimeOnly seconds />\n * ```\n *\n * @see https://ngwr.dev/reference/components/date-stamp\n */\n@Component({\n selector: 'wr-date-stamp',\n templateUrl: './date-stamp.html',\n encapsulation: ViewEncapsulation.None,\n host: { class: 'wr-date-stamp', '[class.wr-date-stamp--empty]': 'parts() === null' },\n})\nexport class WrDateStamp {\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('date-stamp');\n }\n\n private readonly defaults = inject(WR_DATE_STAMP_DEFAULTS);\n\n /**\n * The moment shown: a `Date`, an epoch number, or a string `wrParseDate`\n * reads. `null`, `undefined`, `''` and a value that is not a date are empty.\n *\n * @default null\n */\n readonly value = input<Date | string | number | null | undefined>(null);\n\n /**\n * Format of the first line: a named key or a token string (`'d MMM yyyy'`).\n * `withDates({ stamp })` changes the default.\n *\n * @default 'mediumDate'\n */\n readonly dateFormat = input<WrDateFormat | (string & {})>(this.defaults.dateFormat ?? 'mediumDate');\n\n /**\n * Format of the second line: a named key (`'time24hSeconds'`) or a token\n * string (`'HH:mm'`). `withDates({ stamp })` changes the default.\n *\n * @default 'time'\n */\n readonly timeFormat = input<WrDateFormat | (string & {})>(this.defaults.timeFormat ?? 'time');\n\n /**\n * Write the seconds in the time line: `'time'` is read as `'timeSeconds'`\n * and `'HH:mm'` as `'HH:mm:ss'`. A format that already has them is left\n * alone. `withDates({ stamp })` changes the default.\n *\n * @default false\n */\n readonly seconds = input(this.defaults.seconds ?? false, { transform: booleanAttribute });\n\n /**\n * Show the time alone for a value from today. Today is the day in the\n * display zone, read when the stamp renders: one left on screen past\n * midnight keeps its single line. A date-only value keeps its date.\n * `withDates({ stamp })` changes the default.\n *\n * @default false\n */\n readonly todayTimeOnly = input(this.defaults.todayTimeOnly ?? false, { transform: booleanAttribute });\n\n /**\n * What a number in `value` counts since the epoch: `'ms'`, `'us'`, `'s'` or\n * `'auto'`, by size. `null` follows `withDates({ epochUnit })`.\n *\n * @default null\n */\n readonly epochUnit = input<WrEpochUnit | null>(null);\n\n /** What stands in for an empty value. Falls back to `copyValue.empty`, then `'-'`. */\n readonly emptyLabel = input<string | null>(null);\n\n // The key `wr-copy-value` reads: one placeholder for an empty cell, whatever fills the cell.\n protected readonly resolvedEmptyLabel = useI18nText(this.emptyLabel, 'copyValue.empty', '-');\n\n private readonly adapter = inject<WrDateAdapter<Date>>(WrDateAdapter);\n\n protected readonly parts = computed<Stamp | null>(() => {\n const value = this.value();\n const epochUnit = this.epochUnit();\n const date = wrParseDate(value, { ...this.adapter.parseOptions(), ...(epochUnit ? { epochUnit } : {}) });\n if (date === null) return null;\n\n if (wrIsDateOnly(value)) {\n return {\n iso: `${pad(date.getFullYear(), 4)}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}`,\n date: this.adapter.format(date, this.dateFormat()),\n time: null,\n };\n }\n\n const zoned = this.adapter.zoned();\n const timeFormat = this.timeFormat();\n return {\n iso: date.toISOString(),\n date: this.todayTimeOnly() && zoned.isSameDay(date, zoned.today()) ? null : zoned.format(date, this.dateFormat()),\n time: zoned.format(date, this.seconds() ? withSeconds(timeFormat) : timeFormat),\n };\n });\n}\n","@if (parts(); as stamp) {\n <time class=\"wr-date-stamp__value\" [attr.datetime]=\"stamp.iso\">\n @if (stamp.date !== null) {\n <span class=\"wr-date-stamp__date\">{{ stamp.date }}</span>\n }\n @if (stamp.time !== null) {\n <span class=\"wr-date-stamp__time\">{{ stamp.time }}</span>\n }\n </time>\n} @else {\n <span class=\"wr-date-stamp__empty\">{{ resolvedEmptyLabel() }}</span>\n}\n"],"mappings":"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"}
|
package/fesm2022/ngwr-date.mjs
CHANGED
|
@@ -27,6 +27,29 @@ const WR_DATE_TIME_ZONE = new InjectionToken("WR_DATE_TIME_ZONE", {
|
|
|
27
27
|
* Use of this source code is governed by an MIT-style license that can be
|
|
28
28
|
* found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE
|
|
29
29
|
*/
|
|
30
|
+
const WR_DATE_INPUT = new InjectionToken("WR_DATE_INPUT", {
|
|
31
|
+
providedIn: "root",
|
|
32
|
+
factory: () => ({
|
|
33
|
+
epochUnit: "ms",
|
|
34
|
+
zonelessIn: "browser"
|
|
35
|
+
})
|
|
36
|
+
});
|
|
37
|
+
/**
|
|
38
|
+
* @license
|
|
39
|
+
*
|
|
40
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
41
|
+
* found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE
|
|
42
|
+
*/
|
|
43
|
+
const WR_DATE_STAMP_DEFAULTS = new InjectionToken("WR_DATE_STAMP_DEFAULTS", {
|
|
44
|
+
providedIn: "root",
|
|
45
|
+
factory: () => ({})
|
|
46
|
+
});
|
|
47
|
+
/**
|
|
48
|
+
* @license
|
|
49
|
+
*
|
|
50
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
51
|
+
* found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE
|
|
52
|
+
*/
|
|
30
53
|
const WR_DATE_LOCALE_PINNED = new InjectionToken("WR_DATE_LOCALE_PINNED", {
|
|
31
54
|
providedIn: "root",
|
|
32
55
|
factory: () => false
|
|
@@ -61,6 +84,7 @@ function wrDateLocale() {
|
|
|
61
84
|
*/
|
|
62
85
|
const OFFSET = /^([+-])(\d{2})(?::?(\d{2}))?$/;
|
|
63
86
|
const MINUTE = 6e4;
|
|
87
|
+
const MAX_TIME = 864e13;
|
|
64
88
|
const resolved = /* @__PURE__ */ new Map();
|
|
65
89
|
function wrUtcTime(year, month, day, hours = 0, minutes = 0, seconds = 0, millis = 0) {
|
|
66
90
|
const date = /* @__PURE__ */ new Date(0);
|
|
@@ -108,6 +132,7 @@ function wrResolveZone(value) {
|
|
|
108
132
|
function wrZoneWallTime(time, zone) {
|
|
109
133
|
if (!zone) return time - new Date(time).getTimezoneOffset() * MINUTE;
|
|
110
134
|
if (zone.kind === "offset") return time + zone.minutes * MINUTE;
|
|
135
|
+
if (!(Math.abs(time) <= MAX_TIME)) return NaN;
|
|
111
136
|
const read = {};
|
|
112
137
|
for (const part of zone.fields.formatToParts(time)) read[part.type] = Number(part.value);
|
|
113
138
|
const millis = (time % 1e3 + 1e3) % 1e3;
|
|
@@ -123,7 +148,8 @@ function wrZoneInstant(wall, zone) {
|
|
|
123
148
|
}
|
|
124
149
|
if (zone.kind === "offset") return wall - zone.minutes * MINUTE;
|
|
125
150
|
const first = wall - (wrZoneWallTime(wall, zone) - wall);
|
|
126
|
-
|
|
151
|
+
const second = wall - (wrZoneWallTime(first, zone) - first);
|
|
152
|
+
return wrZoneWallTime(second, zone) === wall ? second : Math.max(first, second);
|
|
127
153
|
}
|
|
128
154
|
/**
|
|
129
155
|
* @license
|
|
@@ -275,7 +301,7 @@ const INTL_OPTIONS = {
|
|
|
275
301
|
}
|
|
276
302
|
};
|
|
277
303
|
const NAMED_KEYS = new Set(Object.keys(INTL_OPTIONS));
|
|
278
|
-
const PART_RE = /'((?:[^']|'')*)'|yyyy|yy|MMMM|MMM|MM|M|dd|d|HH|H|hh|h|mm|ss|a/g;
|
|
304
|
+
const PART_RE = /'((?:[^']|'')*)'|yyyy|yy|y|MMMM|MMM|MM|M|dd|d|HH|H|hh|h|mm|ss|a/g;
|
|
279
305
|
function unquote(quoted) {
|
|
280
306
|
return quoted === "" ? "'" : quoted.replaceAll("''", "'");
|
|
281
307
|
}
|
|
@@ -289,6 +315,7 @@ function tokenToRegex(token, digits) {
|
|
|
289
315
|
switch (token) {
|
|
290
316
|
case "yyyy": return `(${digits}{4})`;
|
|
291
317
|
case "yy": return `(${digits}{2})`;
|
|
318
|
+
case "y": return `(${digits}{1,6})`;
|
|
292
319
|
case "MM":
|
|
293
320
|
case "dd":
|
|
294
321
|
case "HH":
|
|
@@ -313,9 +340,12 @@ var WrDateAdapter = class WrDateAdapter {
|
|
|
313
340
|
displayKey() {
|
|
314
341
|
return "";
|
|
315
342
|
}
|
|
343
|
+
parseOptions() {
|
|
344
|
+
return {};
|
|
345
|
+
}
|
|
316
346
|
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
317
347
|
minVersion: "12.0.0",
|
|
318
|
-
version: "22.2.
|
|
348
|
+
version: "22.2.6",
|
|
319
349
|
ngImport: i0,
|
|
320
350
|
type: WrDateAdapter,
|
|
321
351
|
deps: [],
|
|
@@ -323,7 +353,7 @@ var WrDateAdapter = class WrDateAdapter {
|
|
|
323
353
|
});
|
|
324
354
|
static ɵprov = i0.ɵɵngDeclareInjectable({
|
|
325
355
|
minVersion: "12.0.0",
|
|
326
|
-
version: "22.2.
|
|
356
|
+
version: "22.2.6",
|
|
327
357
|
ngImport: i0,
|
|
328
358
|
type: WrDateAdapter,
|
|
329
359
|
providedIn: "root",
|
|
@@ -332,7 +362,7 @@ var WrDateAdapter = class WrDateAdapter {
|
|
|
332
362
|
};
|
|
333
363
|
i0.ɵɵngDeclareClassMetadata({
|
|
334
364
|
minVersion: "12.0.0",
|
|
335
|
-
version: "22.2.
|
|
365
|
+
version: "22.2.6",
|
|
336
366
|
ngImport: i0,
|
|
337
367
|
type: WrDateAdapter,
|
|
338
368
|
decorators: [{
|
|
@@ -377,6 +407,13 @@ var WrNativeDateAdapter = class WrNativeDateAdapter extends WrDateAdapter {
|
|
|
377
407
|
displayKey() {
|
|
378
408
|
return `${this.locale}|${this.zonal ? this.zone()?.id ?? "" : ""}`;
|
|
379
409
|
}
|
|
410
|
+
input = inject(WR_DATE_INPUT);
|
|
411
|
+
parseOptions() {
|
|
412
|
+
return {
|
|
413
|
+
...this.input,
|
|
414
|
+
timeZone: this.zoneSource?.() ?? null
|
|
415
|
+
};
|
|
416
|
+
}
|
|
380
417
|
zone() {
|
|
381
418
|
return wrResolveZone(this.zoneSource?.());
|
|
382
419
|
}
|
|
@@ -627,6 +664,7 @@ var WrNativeDateAdapter = class WrNativeDateAdapter extends WrDateAdapter {
|
|
|
627
664
|
switch (token) {
|
|
628
665
|
case "yyyy": return pad(year, 4);
|
|
629
666
|
case "yy": return pad(year % 100, 2);
|
|
667
|
+
case "y": return String(year);
|
|
630
668
|
case "MMMM": return monthNames[month] ?? "";
|
|
631
669
|
case "MMM": return monthShort[month] ?? "";
|
|
632
670
|
case "MM": return pad(month + 1);
|
|
@@ -669,6 +707,7 @@ var WrNativeDateAdapter = class WrNativeDateAdapter extends WrDateAdapter {
|
|
|
669
707
|
const n = digitsToNumber(raw, numerals);
|
|
670
708
|
switch (token) {
|
|
671
709
|
case "yyyy":
|
|
710
|
+
case "y":
|
|
672
711
|
parts.year = n;
|
|
673
712
|
break;
|
|
674
713
|
case "yy":
|
|
@@ -888,7 +927,7 @@ var WrNativeDateAdapter = class WrNativeDateAdapter extends WrDateAdapter {
|
|
|
888
927
|
}
|
|
889
928
|
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
890
929
|
minVersion: "12.0.0",
|
|
891
|
-
version: "22.2.
|
|
930
|
+
version: "22.2.6",
|
|
892
931
|
ngImport: i0,
|
|
893
932
|
type: WrNativeDateAdapter,
|
|
894
933
|
deps: [],
|
|
@@ -896,14 +935,14 @@ var WrNativeDateAdapter = class WrNativeDateAdapter extends WrDateAdapter {
|
|
|
896
935
|
});
|
|
897
936
|
static ɵprov = i0.ɵɵngDeclareService({
|
|
898
937
|
minVersion: "22.0.0",
|
|
899
|
-
version: "22.2.
|
|
938
|
+
version: "22.2.6",
|
|
900
939
|
ngImport: i0,
|
|
901
940
|
type: WrNativeDateAdapter
|
|
902
941
|
});
|
|
903
942
|
};
|
|
904
943
|
i0.ɵɵngDeclareClassMetadata({
|
|
905
944
|
minVersion: "12.0.0",
|
|
906
|
-
version: "22.2.
|
|
945
|
+
version: "22.2.6",
|
|
907
946
|
ngImport: i0,
|
|
908
947
|
type: WrNativeDateAdapter,
|
|
909
948
|
decorators: [{ type: Service }]
|
|
@@ -932,10 +971,31 @@ function wrToLocalDate(value) {
|
|
|
932
971
|
* Use of this source code is governed by an MIT-style license that can be
|
|
933
972
|
* found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE
|
|
934
973
|
*/
|
|
974
|
+
const ZONELESS = /^(\d{4})-(\d{2})-(\d{2})[T ](\d{2}):(\d{2})(?::(\d{2})(?:\.(\d+))?)?$/i;
|
|
975
|
+
const SECONDS_BELOW = 1e10;
|
|
976
|
+
const MILLISECONDS_BELOW = 0x9184e72a000;
|
|
977
|
+
function fromNumber(value, unit) {
|
|
978
|
+
const size = Math.abs(value);
|
|
979
|
+
const resolved = unit !== "auto" ? unit : size < SECONDS_BELOW ? "s" : size < MILLISECONDS_BELOW ? "ms" : "us";
|
|
980
|
+
return new Date(resolved === "s" ? value * 1e3 : resolved === "us" ? value / 1e3 : value);
|
|
981
|
+
}
|
|
982
|
+
function fromWallClock(match, options) {
|
|
983
|
+
const [year, month, day, hours, minutes, seconds] = match.slice(1, 7).map((part) => Number(part ?? 0));
|
|
984
|
+
const millis = Number((match[7] ?? "").slice(0, 3).padEnd(3, "0"));
|
|
985
|
+
const wall = wrUtcTime(year, month - 1, day, hours, minutes, seconds, millis);
|
|
986
|
+
const read = new Date(wall);
|
|
987
|
+
if (read.getUTCMonth() !== month - 1 || read.getUTCDate() !== day || read.getUTCHours() !== hours) return null;
|
|
988
|
+
if (read.getUTCMinutes() !== minutes || read.getUTCSeconds() !== seconds) return null;
|
|
989
|
+
return new Date(options.zonelessIn === "utc" ? wall : wrZoneInstant(wall, wrResolveZone(options.timeZone)));
|
|
990
|
+
}
|
|
935
991
|
const SPACE_SEPARATED = /^(\d{4}-\d{2}-\d{2}) (\d{2}:\d{2})(?::(\d{2})(?:\.(\d+))?)?(?:(Z)|([+-]\d{2})(?::?(\d{2}))?)?$/i;
|
|
936
|
-
function fromString(value) {
|
|
992
|
+
function fromString(value, options) {
|
|
937
993
|
const text = String(value).trim();
|
|
938
994
|
if (text === "") return null;
|
|
995
|
+
if (options.zonelessIn === "display" || options.zonelessIn === "utc") {
|
|
996
|
+
const zoneless = ZONELESS.exec(text);
|
|
997
|
+
if (zoneless !== null) return fromWallClock(zoneless, options);
|
|
998
|
+
}
|
|
939
999
|
const match = SPACE_SEPARATED.exec(text);
|
|
940
1000
|
if (match === null) return wrToLocalDate(text);
|
|
941
1001
|
const [, day, time, seconds = "00", fraction, utc, hours, minutes = "00"] = match;
|
|
@@ -943,9 +1003,9 @@ function fromString(value) {
|
|
|
943
1003
|
const zone = utc !== void 0 ? "Z" : hours === void 0 ? "" : `${hours}:${minutes}`;
|
|
944
1004
|
return /* @__PURE__ */ new Date(`${day}T${time}:${seconds}${millis}${zone}`);
|
|
945
1005
|
}
|
|
946
|
-
function wrParseDate(value) {
|
|
1006
|
+
function wrParseDate(value, options = {}) {
|
|
947
1007
|
if (value === null || value === void 0) return null;
|
|
948
|
-
const date = value instanceof Date ? value : typeof value === "number" ?
|
|
1008
|
+
const date = value instanceof Date ? value : typeof value === "number" ? fromNumber(value, options.epochUnit ?? "ms") : fromString(value, options);
|
|
949
1009
|
return date === null || Number.isNaN(date.getTime()) ? null : date;
|
|
950
1010
|
}
|
|
951
1011
|
/**
|
|
@@ -954,6 +1014,54 @@ function wrParseDate(value) {
|
|
|
954
1014
|
* Use of this source code is governed by an MIT-style license that can be
|
|
955
1015
|
* found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE
|
|
956
1016
|
*/
|
|
1017
|
+
function lastOfMonth(adapter, first) {
|
|
1018
|
+
return adapter.createDate(adapter.getYear(first), adapter.getMonth(first), adapter.getDaysInMonth(first));
|
|
1019
|
+
}
|
|
1020
|
+
function wrPeriodStart(adapter, date, period) {
|
|
1021
|
+
const year = adapter.getYear(date);
|
|
1022
|
+
const month = adapter.getMonth(date);
|
|
1023
|
+
switch (period) {
|
|
1024
|
+
case "week": {
|
|
1025
|
+
const offset = (adapter.getDayOfWeek(date) - adapter.getFirstDayOfWeek() + 7) % 7;
|
|
1026
|
+
return adapter.addDays(adapter.createDate(year, month, adapter.getDate(date)), -offset);
|
|
1027
|
+
}
|
|
1028
|
+
case "month": return adapter.createDate(year, month, 1);
|
|
1029
|
+
case "quarter": return adapter.createDate(year, month - month % 3, 1);
|
|
1030
|
+
case "year": return adapter.createDate(year, 0, 1);
|
|
1031
|
+
}
|
|
1032
|
+
}
|
|
1033
|
+
function wrPeriodEnd(adapter, date, period) {
|
|
1034
|
+
const start = wrPeriodStart(adapter, date, period);
|
|
1035
|
+
switch (period) {
|
|
1036
|
+
case "week": return adapter.addDays(start, 6);
|
|
1037
|
+
case "month": return lastOfMonth(adapter, start);
|
|
1038
|
+
case "quarter": return lastOfMonth(adapter, adapter.addMonths(start, 2));
|
|
1039
|
+
case "year": return adapter.createDate(adapter.getYear(start), 11, 31);
|
|
1040
|
+
}
|
|
1041
|
+
}
|
|
1042
|
+
function wrWeekOfYear(adapter, date) {
|
|
1043
|
+
const middle = adapter.addDays(wrPeriodStart(adapter, date, "week"), 3);
|
|
1044
|
+
const year = adapter.getYear(middle);
|
|
1045
|
+
let dayOfYear = adapter.getDate(middle);
|
|
1046
|
+
for (let month = 0; month < adapter.getMonth(middle); month++) dayOfYear += adapter.getDaysInMonth(adapter.createDate(year, month, 1));
|
|
1047
|
+
return {
|
|
1048
|
+
week: Math.floor((dayOfYear - 1) / 7) + 1,
|
|
1049
|
+
year
|
|
1050
|
+
};
|
|
1051
|
+
}
|
|
1052
|
+
function wrWeekStart(adapter, year, week) {
|
|
1053
|
+
if (!Number.isInteger(week) || week < 1 || week > 53) return null;
|
|
1054
|
+
const first = wrPeriodStart(adapter, adapter.createDate(year, 0, 4), "week");
|
|
1055
|
+
const start = adapter.addDays(first, (week - 1) * 7);
|
|
1056
|
+
const found = wrWeekOfYear(adapter, start);
|
|
1057
|
+
return found.week === week && found.year === year ? start : null;
|
|
1058
|
+
}
|
|
1059
|
+
/**
|
|
1060
|
+
* @license
|
|
1061
|
+
*
|
|
1062
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
1063
|
+
* found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE
|
|
1064
|
+
*/
|
|
957
1065
|
function withDates(options = {}) {
|
|
958
1066
|
const providers = [{
|
|
959
1067
|
provide: WrDateAdapter,
|
|
@@ -975,8 +1083,32 @@ function withDates(options = {}) {
|
|
|
975
1083
|
return () => runInInjectionContext(injector, timeZone);
|
|
976
1084
|
}
|
|
977
1085
|
});
|
|
1086
|
+
const { epochUnit, zonelessIn, stamp } = options;
|
|
1087
|
+
if (epochUnit || zonelessIn) providers.push({
|
|
1088
|
+
provide: WR_DATE_INPUT,
|
|
1089
|
+
useFactory: () => {
|
|
1090
|
+
const above = inject(WR_DATE_INPUT, {
|
|
1091
|
+
skipSelf: true,
|
|
1092
|
+
optional: true
|
|
1093
|
+
});
|
|
1094
|
+
return {
|
|
1095
|
+
epochUnit: epochUnit ?? above?.epochUnit ?? "ms",
|
|
1096
|
+
zonelessIn: zonelessIn ?? above?.zonelessIn ?? "browser"
|
|
1097
|
+
};
|
|
1098
|
+
}
|
|
1099
|
+
});
|
|
1100
|
+
if (stamp) providers.push({
|
|
1101
|
+
provide: WR_DATE_STAMP_DEFAULTS,
|
|
1102
|
+
useFactory: () => ({
|
|
1103
|
+
...inject(WR_DATE_STAMP_DEFAULTS, {
|
|
1104
|
+
skipSelf: true,
|
|
1105
|
+
optional: true
|
|
1106
|
+
}),
|
|
1107
|
+
...stamp
|
|
1108
|
+
})
|
|
1109
|
+
});
|
|
978
1110
|
return wrFeature("dates", providers);
|
|
979
1111
|
}
|
|
980
|
-
export { WR_DATE_LOCALE, WR_DATE_TIME_ZONE, WrDateAdapter, WrNativeDateAdapter, withDates, wrDateLocale, wrIsDateOnly, wrIsNamedFormat, wrParseDate, wrToLocalDate };
|
|
1112
|
+
export { WR_DATE_INPUT, WR_DATE_LOCALE, WR_DATE_STAMP_DEFAULTS, WR_DATE_TIME_ZONE, WrDateAdapter, WrNativeDateAdapter, withDates, wrDateLocale, wrIsDateOnly, wrIsNamedFormat, wrParseDate, wrPeriodEnd, wrPeriodStart, wrToLocalDate, wrWeekOfYear, wrWeekStart };
|
|
981
1113
|
|
|
982
1114
|
//# sourceMappingURL=ngwr-date.mjs.map
|