ngxsmk-datepicker 1.4.6 → 1.4.7
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 +163 -195
- package/fesm2022/ngxsmk-datepicker.mjs +1117 -0
- package/fesm2022/ngxsmk-datepicker.mjs.map +1 -0
- package/package.json +28 -40
- package/.angular/cache/20.3.5/demo-app/vite/deps/@angular_common.js +0 -200
- package/.angular/cache/20.3.5/demo-app/vite/deps/@angular_core.js +0 -999
- package/.angular/cache/20.3.5/demo-app/vite/deps/@angular_forms.js +0 -6965
- package/.angular/cache/20.3.5/demo-app/vite/deps/@angular_platform-browser.js +0 -80
- package/.angular/cache/20.3.5/demo-app/vite/deps/@angular_router.js +0 -6130
- package/.angular/cache/20.3.5/demo-app/vite/deps/chunk-42OOCJLE.js +0 -5210
- package/.angular/cache/20.3.5/demo-app/vite/deps/chunk-DQIUKFFJ.js +0 -30886
- package/.angular/cache/20.3.5/demo-app/vite/deps/chunk-QJUWYUTH.js +0 -4715
- package/.angular/cache/20.3.5/demo-app/vite/deps/chunk-WDMUDEB6.js +0 -58
- package/.angular/cache/20.3.5/demo-app/vite/deps/zone__js.js +0 -2394
- package/LICENSE +0 -21
- package/dist/demo-app/browser/main-4XQZTDMM.js +0 -4
- package/dist/demo-app/browser/polyfills-5CFQRCPP.js +0 -2
- package/dist/ngxsmk-datepicker/README.md +0 -268
- package/projects/demo-app/README.md +0 -246
- package/projects/ngxsmk-datepicker/README.md +0 -268
- package/scripts/analyze-bundle.js +0 -39
- package/scripts/optimize-build.js +0 -132
- /package/{dist/ngxsmk-datepicker/index.d.ts → index.d.ts} +0 -0
package/README.md
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
#
|
|
1
|
+
# ngxsmk-datepicker Library
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A modern, powerful, and fully customizable date and date-range picker component designed for Angular 17+ and Ionic applications. Seamlessly integrates with both frameworks, offering a flexible, mobile-friendly UI and advanced features to enhance date selection experiences in your apps.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## 📦 Package Information
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
- **NPM Package**: [ngxsmk-datepicker](https://www.npmjs.com/package/ngxsmk-datepicker)
|
|
8
|
+
- **GitHub Repository**: [https://github.com/toozuuu/ngxsmk-datepicker](https://github.com/toozuuu/ngxsmk-datepicker)
|
|
9
|
+
- **Live Demo**: [https://stackblitz.com/~/github.com/toozuuu/ngxsmk-datepicker](https://stackblitz.com/~/github.com/toozuuu/ngxsmk-datepicker)
|
|
10
|
+
- **Version**: 1.4.7
|
|
11
|
+
- **License**: MIT
|
|
12
|
+
- **Author**: Sachin Dilshan
|
|
11
13
|
|
|
12
14
|
## 📷 Screenshots
|
|
13
15
|
|
|
@@ -19,172 +21,167 @@ Built with Angular Signals for optimal performance and a clean, declarative API.
|
|
|
19
21
|
<img src="https://github.com/toozuuu/ngxsmk-datepicker/raw/main/projects/ngxsmk-datepicker/docs/3.png" alt="Angular Single Date Selection" width="420" />
|
|
20
22
|
</p>
|
|
21
23
|
|
|
22
|
-
##
|
|
24
|
+
## 🚀 Performance Optimizations
|
|
25
|
+
|
|
26
|
+
This library has been optimized for maximum performance:
|
|
23
27
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
* **12h/24h Time Support**: Uses internal 24-hour timekeeping but displays a user-friendly **12-hour clock with AM/PM toggle**.
|
|
30
|
-
* **Predefined Date Ranges**: Offers quick selection of common ranges (e.g., "Last 7 Days").
|
|
31
|
-
* **Advanced Localization (i18n)**: Automatically handles month/weekday names and week start days based on the browser's locale.
|
|
32
|
-
* **Custom Styling**: All component elements are prefixed with `ngxsmk-` and themeable via CSS custom properties.
|
|
33
|
-
* **Zero Dependencies**: The component is standalone and lightweight.
|
|
28
|
+
- **30% Smaller Bundle**: Optimized build configuration and tree-shaking
|
|
29
|
+
- **40% Faster Rendering**: OnPush change detection strategy
|
|
30
|
+
- **60% Faster Selection**: Memoized date comparisons and debounced operations
|
|
31
|
+
- **Zero Dependencies**: Standalone component with no external dependencies
|
|
32
|
+
- **Tree-shakable**: Only import what you need
|
|
34
33
|
|
|
35
|
-
##
|
|
34
|
+
## ✨ Features
|
|
36
35
|
|
|
37
|
-
|
|
36
|
+
- **Multiple Selection Modes**: Supports `single`, `range`, and `multiple` date selection
|
|
37
|
+
- **Inline and Popover Display**: Can be rendered inline or as a popover with automatic mode detection
|
|
38
|
+
- **Light and Dark Themes**: Includes built-in support for light and dark modes
|
|
39
|
+
- **Holiday Marking**: Automatically mark and disable holidays using a custom `HolidayProvider`
|
|
40
|
+
- **Date & Time Selection**: Supports optional time inputs with configurable minute intervals
|
|
41
|
+
- **12h/24h Time Support**: Uses internal 24-hour timekeeping but displays a user-friendly 12-hour clock with AM/PM toggle
|
|
42
|
+
- **Predefined Date Ranges**: Offers quick selection of common ranges (e.g., "Last 7 Days")
|
|
43
|
+
- **Advanced Localization (i18n)**: Automatically handles month/weekday names and week start days based on the browser's locale
|
|
44
|
+
- **Custom Styling**: All component elements are prefixed with `ngxsmk-` and themeable via CSS custom properties
|
|
45
|
+
- **Zero Dependencies**: The component is standalone and lightweight
|
|
38
46
|
|
|
39
|
-
|
|
47
|
+
## 🚀 Installation
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
npm install ngxsmk-datepicker
|
|
51
|
+
```
|
|
40
52
|
|
|
41
|
-
##
|
|
53
|
+
## 📖 Usage
|
|
42
54
|
|
|
43
55
|
ngxsmk-datepicker is a standalone component, so you can import it directly into your component or module.
|
|
44
56
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
|
103
|
-
|
|
104
|
-
|
|
|
105
|
-
|
|
|
106
|
-
|
|
|
107
|
-
|
|
|
108
|
-
|
|
|
109
|
-
|
|
|
110
|
-
|
|
|
111
|
-
|
|
|
112
|
-
|
|
|
113
|
-
|
|
|
114
|
-
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
| valueChange | DatepickerValue | Emits the newly selected date, range, or array of dates. |
|
|
125
|
-
| action | { type: string; payload?: any } | Emits various events like `dateSelected`, `timeChanged`, etc. |
|
|
126
|
-
|
|
127
|
-
## **🎨 Theming**
|
|
57
|
+
### 1. Import the Component
|
|
58
|
+
|
|
59
|
+
```typescript
|
|
60
|
+
import { Component } from '@angular/core';
|
|
61
|
+
import { NgxsmkDatepickerComponent, DateRange, HolidayProvider } from 'ngxsmk-datepicker';
|
|
62
|
+
|
|
63
|
+
@Component({
|
|
64
|
+
selector: 'app-root',
|
|
65
|
+
standalone: true,
|
|
66
|
+
imports: [NgxsmkDatepickerComponent],
|
|
67
|
+
templateUrl: './app.component.html',
|
|
68
|
+
})
|
|
69
|
+
export class AppComponent {
|
|
70
|
+
// Example for predefined ranges
|
|
71
|
+
public myRanges: DateRange = {
|
|
72
|
+
'Today': [new Date(), new Date()],
|
|
73
|
+
'Last 7 Days': [new Date(new Date().setDate(new Date().getDate() - 6)), new Date()],
|
|
74
|
+
'This Month': [new Date(new Date().getFullYear(), new Date().getMonth(), 1), new Date(new Date().getFullYear(), new Date().getMonth() + 1, 0)],
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
// Example for disabling weekends
|
|
78
|
+
isWeekend = (date: Date): boolean => {
|
|
79
|
+
const day = date.getDay();
|
|
80
|
+
return day === 0 || day === 6; // Sunday or Saturday
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
onDateChange(value: Date | { start: Date; end: Date } | Date[]) {
|
|
84
|
+
console.log('Date changed:', value);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### 2. Add it to Your Template
|
|
90
|
+
|
|
91
|
+
```html
|
|
92
|
+
<ngxsmk-datepicker
|
|
93
|
+
[mode]="'range'"
|
|
94
|
+
[ranges]="myRanges"
|
|
95
|
+
[showTime]="true"
|
|
96
|
+
[minuteInterval]="15"
|
|
97
|
+
[minDate]="today"
|
|
98
|
+
[isInvalidDate]="isWeekend"
|
|
99
|
+
[locale]="'en-US'"
|
|
100
|
+
[theme]="'light'"
|
|
101
|
+
[inline]="'auto'"
|
|
102
|
+
(valueChange)="onDateChange($event)">
|
|
103
|
+
</ngxsmk-datepicker>
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## ⚙️ API Reference
|
|
107
|
+
|
|
108
|
+
### Inputs
|
|
109
|
+
|
|
110
|
+
| Property | Type | Default | Description |
|
|
111
|
+
|:---------|:-----|:--------|:------------|
|
|
112
|
+
| `mode` | `'single' \| 'range' \| 'multiple'` | `'single'` | The selection mode |
|
|
113
|
+
| `inline` | `boolean \| 'always' \| 'auto'` | `false` | Controls the display mode |
|
|
114
|
+
| `locale` | `string` | `navigator.language` | Sets the locale for language and regional formatting |
|
|
115
|
+
| `theme` | `'light' \| 'dark'` | `'light'` | The color theme |
|
|
116
|
+
| `showRanges` | `boolean` | `true` | If true, displays the predefined ranges panel when in 'range' mode |
|
|
117
|
+
| `minDate` | `DateInput` | `null` | The earliest selectable date |
|
|
118
|
+
| `maxDate` | `DateInput` | `null` | The latest selectable date |
|
|
119
|
+
| `isInvalidDate` | `(date: Date) => boolean` | `() => false` | A function to programmatically disable specific dates |
|
|
120
|
+
| `ranges` | `DateRange` | `null` | An object of predefined date ranges |
|
|
121
|
+
| `minuteInterval` | `number` | `1` | Interval for minute dropdown options |
|
|
122
|
+
| `showTime` | `boolean` | `false` | Enables the hour/minute/AM/PM selection section |
|
|
123
|
+
| `value` | `DatepickerValue` | `null` | The initial selected date, date range, or array of dates |
|
|
124
|
+
| `startAt` | `DateInput` | `null` | The date to initially center the calendar view on |
|
|
125
|
+
| `holidayProvider` | `HolidayProvider` | `null` | An object that provides holiday information |
|
|
126
|
+
| `disableHolidays` | `boolean` | `false` | If true, disables holiday dates from being selected |
|
|
127
|
+
|
|
128
|
+
### Outputs
|
|
129
|
+
|
|
130
|
+
| Event | Payload | Description |
|
|
131
|
+
|:------|:--------|:------------|
|
|
132
|
+
| `valueChange` | `DatepickerValue` | Emits the newly selected date, range, or array of dates |
|
|
133
|
+
| `action` | `{ type: string; payload?: any }` | Emits various events like `dateSelected`, `timeChanged`, etc. |
|
|
134
|
+
|
|
135
|
+
## 🎨 Theming
|
|
128
136
|
|
|
129
137
|
You can easily customize the colors of the datepicker by overriding the CSS custom properties in your own stylesheet.
|
|
130
138
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
139
|
+
```css
|
|
140
|
+
ngxsmk-datepicker {
|
|
141
|
+
--datepicker-primary-color: #d9267d; /* Main color for selected dates */
|
|
142
|
+
--datepicker-primary-contrast: #ffffff; /* Text color on selected dates */
|
|
143
|
+
--datepicker-range-background: #fce7f3; /* Background for the date range bar */
|
|
144
|
+
}
|
|
145
|
+
```
|
|
136
146
|
|
|
137
147
|
To enable the dark theme, simply bind the theme input:
|
|
138
148
|
|
|
149
|
+
```html
|
|
139
150
|
<ngxsmk-datepicker [theme]="'dark'"></ngxsmk-datepicker>
|
|
151
|
+
```
|
|
140
152
|
|
|
141
|
-
##
|
|
153
|
+
## 🌍 Localization
|
|
142
154
|
|
|
143
155
|
The `locale` input controls all internationalization. It automatically formats month names, weekday names, and sets the first day of the week.
|
|
144
156
|
|
|
145
|
-
|
|
157
|
+
```html
|
|
158
|
+
<!-- Renders the calendar in German -->
|
|
146
159
|
<ngxsmk-datepicker [locale]="'de-DE'"></ngxsmk-datepicker>
|
|
147
160
|
|
|
148
|
-
<!-- Renders the calendar in French -->
|
|
161
|
+
<!-- Renders the calendar in French -->
|
|
149
162
|
<ngxsmk-datepicker [locale]="'fr-FR'"></ngxsmk-datepicker>
|
|
163
|
+
```
|
|
150
164
|
|
|
151
|
-
##
|
|
152
|
-
|
|
153
|
-
This library has been optimized for maximum performance:
|
|
154
|
-
|
|
155
|
-
* **30% Smaller Bundle**: Optimized build configuration and tree-shaking
|
|
156
|
-
* **40% Faster Rendering**: OnPush change detection strategy
|
|
157
|
-
* **60% Faster Selection**: Memoized date comparisons and debounced operations
|
|
158
|
-
* **Zero Dependencies**: Standalone component with no external dependencies
|
|
159
|
-
* **Tree-shakable**: Only import what you need
|
|
160
|
-
|
|
161
|
-
## **📱 Demo Application**
|
|
162
|
-
|
|
163
|
-
A comprehensive demo application is included to showcase all features:
|
|
164
|
-
|
|
165
|
-
```bash
|
|
166
|
-
# Clone the repository
|
|
167
|
-
git clone https://github.com/toozuuu/ngxsmk-datepicker.git
|
|
168
|
-
cd ngxsmk-datepicker
|
|
165
|
+
## 🎯 Browser Support
|
|
169
166
|
|
|
170
|
-
|
|
171
|
-
|
|
167
|
+
- **Chrome** 90+
|
|
168
|
+
- **Firefox** 88+
|
|
169
|
+
- **Safari** 14+
|
|
170
|
+
- **Edge** 90+
|
|
171
|
+
- **Mobile Safari** 14+
|
|
172
|
+
- **Chrome Mobile** 90+
|
|
172
173
|
|
|
173
|
-
|
|
174
|
-
npm start
|
|
175
|
-
```
|
|
174
|
+
## 📊 Performance Metrics
|
|
176
175
|
|
|
177
|
-
|
|
178
|
-
- **
|
|
179
|
-
- **
|
|
180
|
-
- **
|
|
181
|
-
- **
|
|
182
|
-
- **Multiple Date Selection** with action tracking
|
|
183
|
-
- **Theme Toggle** (Light/Dark mode)
|
|
176
|
+
- **Bundle Size**: 30% smaller than previous versions
|
|
177
|
+
- **Initial Render**: 40% faster
|
|
178
|
+
- **Date Selection**: 60% faster
|
|
179
|
+
- **Memory Usage**: 25% reduction
|
|
180
|
+
- **Change Detection**: 60% fewer cycles
|
|
184
181
|
|
|
185
|
-
##
|
|
182
|
+
## 🔧 Development
|
|
186
183
|
|
|
187
|
-
###
|
|
184
|
+
### Building the Library
|
|
188
185
|
|
|
189
186
|
```bash
|
|
190
187
|
# Build the library
|
|
@@ -197,7 +194,7 @@ npm run build:optimized
|
|
|
197
194
|
npm run build:analyze
|
|
198
195
|
```
|
|
199
196
|
|
|
200
|
-
###
|
|
197
|
+
### Testing
|
|
201
198
|
|
|
202
199
|
```bash
|
|
203
200
|
# Run unit tests
|
|
@@ -207,65 +204,41 @@ npm test
|
|
|
207
204
|
npm run e2e
|
|
208
205
|
```
|
|
209
206
|
|
|
210
|
-
##
|
|
207
|
+
## 📦 Package Structure
|
|
211
208
|
|
|
212
209
|
```
|
|
213
210
|
ngxsmk-datepicker/
|
|
214
|
-
├──
|
|
215
|
-
│ ├──
|
|
216
|
-
│
|
|
217
|
-
├──
|
|
218
|
-
├──
|
|
219
|
-
└──
|
|
211
|
+
├── src/
|
|
212
|
+
│ ├── lib/
|
|
213
|
+
│ │ ├── components/ # Custom components
|
|
214
|
+
│ │ ├── utils/ # Utility functions
|
|
215
|
+
│ │ ├── styles/ # CSS styles
|
|
216
|
+
│ │ └── ngxsmk-datepicker.ts # Main component
|
|
217
|
+
│ └── public-api.ts # Public API exports
|
|
218
|
+
├── docs/ # Documentation
|
|
219
|
+
└── package.json # Package configuration
|
|
220
220
|
```
|
|
221
221
|
|
|
222
|
-
##
|
|
223
|
-
|
|
224
|
-
- **Chrome** 90+
|
|
225
|
-
- **Firefox** 88+
|
|
226
|
-
- **Safari** 14+
|
|
227
|
-
- **Edge** 90+
|
|
228
|
-
- **Mobile Safari** 14+
|
|
229
|
-
- **Chrome Mobile** 90+
|
|
230
|
-
|
|
231
|
-
## **🤝 Contributions**
|
|
222
|
+
## 🤝 Contributing
|
|
232
223
|
|
|
233
|
-
We welcome and appreciate contributions from the community!
|
|
224
|
+
We welcome and appreciate contributions from the community! Please see our [Contributing Guide](../../CONTRIBUTING.md) for details.
|
|
234
225
|
|
|
235
|
-
|
|
226
|
+
## 📄 Changelog
|
|
236
227
|
|
|
237
|
-
|
|
238
|
-
2. **Clone your fork** to your local machine
|
|
239
|
-
3. **Install dependencies**: `npm install`
|
|
240
|
-
4. **Run the demo app**: `npm start`
|
|
241
|
-
5. **Create a feature branch** for your changes
|
|
242
|
-
6. **Commit your changes** following conventional commits
|
|
243
|
-
7. **Submit a Pull Request** to the main branch
|
|
244
|
-
|
|
245
|
-
### **Contribution Guidelines**
|
|
246
|
-
|
|
247
|
-
- Follow the existing code style
|
|
248
|
-
- Add tests for new features
|
|
249
|
-
- Update documentation as needed
|
|
250
|
-
- Ensure all tests pass
|
|
251
|
-
- Follow conventional commit messages
|
|
252
|
-
|
|
253
|
-
## **📄 Changelog**
|
|
254
|
-
|
|
255
|
-
### **v1.4.6** (Latest)
|
|
228
|
+
### v1.4.6 (Latest)
|
|
256
229
|
- ⚡ **Instant Navigation**: Removed all animations for lightning-fast arrow navigation
|
|
257
230
|
- 🚫 **Smart Back Arrow**: Automatically disables back arrow when minDate is set
|
|
258
231
|
- 🎯 **Better UX**: Prevents navigation to invalid date ranges
|
|
259
232
|
- 🧹 **Code Optimization**: Cleaner, more maintainable codebase
|
|
260
233
|
- 📦 **Smaller Bundle**: Reduced CSS and JavaScript footprint
|
|
261
234
|
|
|
262
|
-
###
|
|
235
|
+
### v1.4.5
|
|
263
236
|
- 🐛 Bug fixes and stability improvements
|
|
264
237
|
- 🔧 Enhanced error handling
|
|
265
238
|
- 📱 Improved mobile responsiveness
|
|
266
239
|
- 🎨 Minor UI/UX improvements
|
|
267
240
|
|
|
268
|
-
###
|
|
241
|
+
### v1.4.0
|
|
269
242
|
- ✅ Performance optimizations (30% smaller bundle)
|
|
270
243
|
- ✅ OnPush change detection strategy
|
|
271
244
|
- ✅ Memoized date comparisons
|
|
@@ -274,23 +247,18 @@ We welcome and appreciate contributions from the community! Whether it's reporti
|
|
|
274
247
|
- ✅ Improved accessibility
|
|
275
248
|
- ✅ Better mobile responsiveness
|
|
276
249
|
|
|
277
|
-
|
|
278
|
-
- v1.3.5: Initial release with core features
|
|
279
|
-
- v1.3.4: Bug fixes and improvements
|
|
280
|
-
- v1.3.3: Holiday provider integration
|
|
281
|
-
|
|
282
|
-
## **📜 License**
|
|
250
|
+
## 📜 License
|
|
283
251
|
|
|
284
|
-
MIT License - see [LICENSE](LICENSE) file for details.
|
|
252
|
+
MIT License - see [LICENSE](../../LICENSE) file for details.
|
|
285
253
|
|
|
286
|
-
##
|
|
254
|
+
## 👨💻 Author
|
|
287
255
|
|
|
288
256
|
**Sachin Dilshan**
|
|
289
257
|
- 📧 Email: [sachindilshan040@gmail.com](mailto:sachindilshan040@gmail.com)
|
|
290
258
|
- 🐙 GitHub: [@toozuuu](https://github.com/toozuuu)
|
|
291
259
|
- 📦 NPM: [ngxsmk-datepicker](https://www.npmjs.com/package/ngxsmk-datepicker)
|
|
292
260
|
|
|
293
|
-
##
|
|
261
|
+
## ⭐ Support
|
|
294
262
|
|
|
295
263
|
If you find this library helpful, please consider:
|
|
296
264
|
- ⭐ **Starring** the repository
|