cmat 0.0.78 → 0.0.79
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/fesm2022/cmat-components-adapter.mjs +9 -46
- package/fesm2022/cmat-components-adapter.mjs.map +1 -1
- package/fesm2022/cmat-components-breadcrumb.mjs +104 -205
- package/fesm2022/cmat-components-breadcrumb.mjs.map +1 -1
- package/fesm2022/cmat-components-card.mjs +4 -8
- package/fesm2022/cmat-components-card.mjs.map +1 -1
- package/fesm2022/cmat-components-carousel.mjs +12 -12
- package/fesm2022/cmat-components-cascade.mjs +14 -20
- package/fesm2022/cmat-components-cascade.mjs.map +1 -1
- package/fesm2022/cmat-components-chip-input.mjs +21 -21
- package/fesm2022/cmat-components-chip-input.mjs.map +1 -1
- package/fesm2022/cmat-components-code-editor.mjs +4 -22
- package/fesm2022/cmat-components-code-editor.mjs.map +1 -1
- package/fesm2022/cmat-components-custom-formly.mjs +153 -220
- package/fesm2022/cmat-components-custom-formly.mjs.map +1 -1
- package/fesm2022/cmat-components-date-range.mjs +5 -177
- package/fesm2022/cmat-components-date-range.mjs.map +1 -1
- package/fesm2022/cmat-components-date-time-display.mjs +3 -15
- package/fesm2022/cmat-components-date-time-display.mjs.map +1 -1
- package/fesm2022/cmat-components-drawer.mjs +6 -96
- package/fesm2022/cmat-components-drawer.mjs.map +1 -1
- package/fesm2022/cmat-components-empty-state.mjs +4 -25
- package/fesm2022/cmat-components-empty-state.mjs.map +1 -1
- package/fesm2022/cmat-components-file-preview.mjs +3 -21
- package/fesm2022/cmat-components-file-preview.mjs.map +1 -1
- package/fesm2022/cmat-components-filter-toolbar.mjs +7 -50
- package/fesm2022/cmat-components-filter-toolbar.mjs.map +1 -1
- package/fesm2022/cmat-components-form-actions.mjs +3 -9
- package/fesm2022/cmat-components-form-actions.mjs.map +1 -1
- package/fesm2022/cmat-components-fullscreen.mjs +4 -4
- package/fesm2022/cmat-components-fullscreen.mjs.map +1 -1
- package/fesm2022/cmat-components-highlight.mjs +6 -31
- package/fesm2022/cmat-components-highlight.mjs.map +1 -1
- package/fesm2022/cmat-components-image-viewer.mjs +3 -12
- package/fesm2022/cmat-components-image-viewer.mjs.map +1 -1
- package/fesm2022/cmat-components-inline-loading.mjs +3 -12
- package/fesm2022/cmat-components-inline-loading.mjs.map +1 -1
- package/fesm2022/cmat-components-json-editor.mjs +10 -13
- package/fesm2022/cmat-components-json-editor.mjs.map +1 -1
- package/fesm2022/cmat-components-knob-input.mjs +18 -12
- package/fesm2022/cmat-components-knob-input.mjs.map +1 -1
- package/fesm2022/cmat-components-masonry.mjs +3 -9
- package/fesm2022/cmat-components-masonry.mjs.map +1 -1
- package/fesm2022/cmat-components-material-color-picker.mjs +3 -23
- package/fesm2022/cmat-components-material-color-picker.mjs.map +1 -1
- package/fesm2022/cmat-components-material-datetimepicker.mjs +49 -397
- package/fesm2022/cmat-components-material-datetimepicker.mjs.map +1 -1
- package/fesm2022/cmat-components-navigation.mjs +183 -725
- package/fesm2022/cmat-components-navigation.mjs.map +1 -1
- package/fesm2022/cmat-components-opt-input.mjs +7 -10
- package/fesm2022/cmat-components-opt-input.mjs.map +1 -1
- package/fesm2022/cmat-components-org-chart.mjs +11 -11
- package/fesm2022/cmat-components-org-chart.mjs.map +1 -1
- package/fesm2022/cmat-components-page-header.mjs +8 -19
- package/fesm2022/cmat-components-page-header.mjs.map +1 -1
- package/fesm2022/cmat-components-pagination.mjs +96 -93
- package/fesm2022/cmat-components-pagination.mjs.map +1 -1
- package/fesm2022/cmat-components-password-strength.mjs +10 -11
- package/fesm2022/cmat-components-password-strength.mjs.map +1 -1
- package/fesm2022/cmat-components-popover.mjs +15 -149
- package/fesm2022/cmat-components-popover.mjs.map +1 -1
- package/fesm2022/cmat-components-progress-bar.mjs +9 -16
- package/fesm2022/cmat-components-progress-bar.mjs.map +1 -1
- package/fesm2022/cmat-components-qrcode.mjs +5 -11
- package/fesm2022/cmat-components-qrcode.mjs.map +1 -1
- package/fesm2022/cmat-components-rating.mjs +3 -3
- package/fesm2022/cmat-components-rich-text-editor.mjs +4 -25
- package/fesm2022/cmat-components-rich-text-editor.mjs.map +1 -1
- package/fesm2022/cmat-components-select-search.mjs +46 -72
- package/fesm2022/cmat-components-select-search.mjs.map +1 -1
- package/fesm2022/cmat-components-select-table.mjs +193 -150
- package/fesm2022/cmat-components-select-table.mjs.map +1 -1
- package/fesm2022/cmat-components-select-tree.mjs +124 -78
- package/fesm2022/cmat-components-select-tree.mjs.map +1 -1
- package/fesm2022/cmat-components-skeleton.mjs +4 -22
- package/fesm2022/cmat-components-skeleton.mjs.map +1 -1
- package/fesm2022/cmat-components-speed-dial.mjs +9 -11
- package/fesm2022/cmat-components-speed-dial.mjs.map +1 -1
- package/fesm2022/cmat-components-status-tag.mjs +3 -18
- package/fesm2022/cmat-components-status-tag.mjs.map +1 -1
- package/fesm2022/cmat-components-table-toolbar.mjs +3 -15
- package/fesm2022/cmat-components-table-toolbar.mjs.map +1 -1
- package/fesm2022/cmat-components-timeline.mjs +18 -21
- package/fesm2022/cmat-components-timeline.mjs.map +1 -1
- package/fesm2022/cmat-components-toast.mjs +16 -14
- package/fesm2022/cmat-components-toast.mjs.map +1 -1
- package/fesm2022/cmat-components-transfer-picker.mjs +103 -80
- package/fesm2022/cmat-components-transfer-picker.mjs.map +1 -1
- package/fesm2022/cmat-components-treetable.mjs +6 -6
- package/fesm2022/cmat-components-upload.mjs +21 -36
- package/fesm2022/cmat-components-upload.mjs.map +1 -1
- package/fesm2022/cmat-components-x6-angular-shape.mjs +0 -1
- package/fesm2022/cmat-components-x6-angular-shape.mjs.map +1 -1
- package/fesm2022/cmat-directives-animate-on-scroll.mjs +6 -27
- package/fesm2022/cmat-directives-animate-on-scroll.mjs.map +1 -1
- package/fesm2022/cmat-directives-arrow-cursor.mjs +7 -9
- package/fesm2022/cmat-directives-arrow-cursor.mjs.map +1 -1
- package/fesm2022/cmat-directives-autofocus.mjs +3 -3
- package/fesm2022/cmat-directives-data-exporter.mjs +24 -33
- package/fesm2022/cmat-directives-data-exporter.mjs.map +1 -1
- package/fesm2022/cmat-directives-debounce.mjs +14 -17
- package/fesm2022/cmat-directives-debounce.mjs.map +1 -1
- package/fesm2022/cmat-directives-digit-only.mjs +6 -23
- package/fesm2022/cmat-directives-digit-only.mjs.map +1 -1
- package/fesm2022/cmat-directives-equal-validator.mjs +3 -3
- package/fesm2022/cmat-directives-seamless-auto-scroll.mjs +4 -11
- package/fesm2022/cmat-directives-seamless-auto-scroll.mjs.map +1 -1
- package/fesm2022/cmat-lib-mock-api.mjs +6 -43
- package/fesm2022/cmat-lib-mock-api.mjs.map +1 -1
- package/fesm2022/cmat-pipes-bytes.mjs +3 -3
- package/fesm2022/cmat-pipes-date-format.mjs +3 -3
- package/fesm2022/cmat-pipes-find-by-key.mjs +3 -5
- package/fesm2022/cmat-pipes-find-by-key.mjs.map +1 -1
- package/fesm2022/cmat-pipes-group-by.mjs +3 -3
- package/fesm2022/cmat-pipes-keys.mjs +3 -3
- package/fesm2022/cmat-pipes-secure.mjs +8 -12
- package/fesm2022/cmat-pipes-secure.mjs.map +1 -1
- package/fesm2022/cmat-pipes-uppercase.mjs +3 -3
- package/fesm2022/cmat-services-alert.mjs +3 -3
- package/fesm2022/cmat-services-config.mjs +50 -26
- package/fesm2022/cmat-services-config.mjs.map +1 -1
- package/fesm2022/cmat-services-confirmation.mjs +9 -11
- package/fesm2022/cmat-services-confirmation.mjs.map +1 -1
- package/fesm2022/cmat-services-data.mjs +56 -101
- package/fesm2022/cmat-services-data.mjs.map +1 -1
- package/fesm2022/cmat-services-export-as.mjs +4 -32
- package/fesm2022/cmat-services-export-as.mjs.map +1 -1
- package/fesm2022/cmat-services-loading.mjs +49 -40
- package/fesm2022/cmat-services-loading.mjs.map +1 -1
- package/fesm2022/cmat-services-local-storage.mjs +3 -3
- package/fesm2022/cmat-services-media-watcher.mjs +19 -25
- package/fesm2022/cmat-services-media-watcher.mjs.map +1 -1
- package/fesm2022/cmat-services-platform.mjs +3 -10
- package/fesm2022/cmat-services-platform.mjs.map +1 -1
- package/fesm2022/cmat-services-splash-screen.mjs +8 -13
- package/fesm2022/cmat-services-splash-screen.mjs.map +1 -1
- package/fesm2022/cmat-services-title.mjs +8 -12
- package/fesm2022/cmat-services-title.mjs.map +1 -1
- package/fesm2022/cmat-services-translation.mjs +3 -3
- package/fesm2022/cmat-services-utils.mjs +5 -27
- package/fesm2022/cmat-services-utils.mjs.map +1 -1
- package/fesm2022/cmat-validators.mjs +0 -8
- package/fesm2022/cmat-validators.mjs.map +1 -1
- package/fesm2022/cmat.mjs +3159 -3441
- package/fesm2022/cmat.mjs.map +1 -1
- package/package.json +1 -1
- package/tailwind/plugins/helpers.js +1 -10
- package/tailwind/plugins/scrollbar/index.js +0 -1
- package/tailwind/plugins/scrollbar/typedefs.js +1 -7
- package/tailwind/plugins/scrollbar/utilities.js +9 -58
- package/tailwind/plugins/scrollbar/variants.js +2 -17
- package/tailwind/plugins/theming.js +1 -57
- package/tailwind/utils/generate-contrasts.js +1 -12
- package/tailwind/utils/generate-palette.js +1 -32
- package/types/cmat-components-adapter.d.ts +0 -25
- package/types/cmat-components-breadcrumb.d.ts +25 -175
- package/types/cmat-components-carousel.d.ts +0 -18
- package/types/cmat-components-cascade.d.ts +1 -1
- package/types/cmat-components-chip-input.d.ts +4 -3
- package/types/cmat-components-code-editor.d.ts +0 -18
- package/types/cmat-components-custom-formly.d.ts +22 -28
- package/types/cmat-components-date-range.d.ts +0 -71
- package/types/cmat-components-date-time-display.d.ts +0 -15
- package/types/cmat-components-drawer.d.ts +0 -42
- package/types/cmat-components-empty-state.d.ts +0 -21
- package/types/cmat-components-file-preview.d.ts +0 -18
- package/types/cmat-components-filter-toolbar.d.ts +3 -43
- package/types/cmat-components-form-actions.d.ts +0 -6
- package/types/cmat-components-image-viewer.d.ts +0 -12
- package/types/cmat-components-inline-loading.d.ts +0 -9
- package/types/cmat-components-knob-input.d.ts +1 -1
- package/types/cmat-components-material-datetimepicker.d.ts +0 -263
- package/types/cmat-components-navigation.d.ts +24 -164
- package/types/cmat-components-opt-input.d.ts +1 -1
- package/types/cmat-components-page-header.d.ts +2 -16
- package/types/cmat-components-pagination.d.ts +22 -24
- package/types/cmat-components-popover.d.ts +1 -109
- package/types/cmat-components-progress-bar.d.ts +3 -4
- package/types/cmat-components-rich-text-editor.d.ts +0 -21
- package/types/cmat-components-select-search.d.ts +3 -19
- package/types/cmat-components-select-table.d.ts +17 -4
- package/types/cmat-components-select-tree.d.ts +20 -19
- package/types/cmat-components-skeleton.d.ts +0 -18
- package/types/cmat-components-status-tag.d.ts +0 -15
- package/types/cmat-components-table-toolbar.d.ts +0 -12
- package/types/cmat-components-timeline.d.ts +3 -4
- package/types/cmat-components-toast.d.ts +1 -0
- package/types/cmat-components-transfer-picker.d.ts +23 -27
- package/types/cmat-components-upload.d.ts +7 -10
- package/types/cmat-components-x6-angular-shape.d.ts +0 -1
- package/types/cmat-directives-arrow-cursor.d.ts +1 -1
- package/types/cmat-directives-debounce.d.ts +3 -4
- package/types/cmat-pipes-secure.d.ts +3 -4
- package/types/cmat-services-config.d.ts +35 -13
- package/types/cmat-services-data.d.ts +13 -12
- package/types/cmat-services-export-as.d.ts +0 -22
- package/types/cmat-services-loading.d.ts +15 -10
- package/types/cmat-services-media-watcher.d.ts +10 -13
- package/types/cmat-services-splash-screen.d.ts +2 -4
- package/types/cmat-services-title.d.ts +3 -5
- package/types/cmat.d.ts +655 -1308
|
@@ -16,7 +16,6 @@ import * as i5 from '@angular/material/input';
|
|
|
16
16
|
import { MatInputModule } from '@angular/material/input';
|
|
17
17
|
import dayjs from 'dayjs';
|
|
18
18
|
import isBetween from 'dayjs/plugin/isBetween';
|
|
19
|
-
import { Subject } from 'rxjs';
|
|
20
19
|
|
|
21
20
|
class CmatDateRangeComponent {
|
|
22
21
|
constructor() {
|
|
@@ -36,7 +35,6 @@ class CmatDateRangeComponent {
|
|
|
36
35
|
end: null
|
|
37
36
|
};
|
|
38
37
|
this._timeRegExp = new RegExp('^(0[0-9]|1[0-9]|2[0-4]|[0-9]):([0-5][0-9])(A|(?:AM)|P|(?:PM))?$', 'i');
|
|
39
|
-
this._unsubscribeAll = new Subject();
|
|
40
38
|
dayjs.extend(isBetween);
|
|
41
39
|
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
42
40
|
this._onChange = () => { };
|
|
@@ -56,41 +54,30 @@ class CmatDateRangeComponent {
|
|
|
56
54
|
return this._dateFormat;
|
|
57
55
|
}
|
|
58
56
|
set dateFormat(value) {
|
|
59
|
-
// Return if the values are the same
|
|
60
57
|
if (this._dateFormat === value) {
|
|
61
58
|
return;
|
|
62
59
|
}
|
|
63
|
-
// Store the value
|
|
64
60
|
this._dateFormat = value;
|
|
65
61
|
}
|
|
66
|
-
/**
|
|
67
|
-
* Setter & getter for timeFormat input */
|
|
68
62
|
// eslint-disable-next-line @typescript-eslint/member-ordering
|
|
69
63
|
get timeFormat() {
|
|
70
64
|
return this._timeFormat;
|
|
71
65
|
}
|
|
72
66
|
set timeFormat(value) {
|
|
73
|
-
// Return if the values are the same
|
|
74
67
|
if (this._timeFormat === value) {
|
|
75
68
|
return;
|
|
76
69
|
}
|
|
77
|
-
// Set format based on the time format input
|
|
78
70
|
this._timeFormat = value === '12' ? 'hh:mmA' : 'HH:mm';
|
|
79
71
|
}
|
|
80
|
-
/**
|
|
81
|
-
* Setter & getter for timeRange input */
|
|
82
72
|
// eslint-disable-next-line @typescript-eslint/member-ordering
|
|
83
73
|
get timeRange() {
|
|
84
74
|
return this._timeRange;
|
|
85
75
|
}
|
|
86
76
|
set timeRange(value) {
|
|
87
|
-
// Return if the values are the same
|
|
88
77
|
if (this._timeRange === value) {
|
|
89
78
|
return;
|
|
90
79
|
}
|
|
91
|
-
// Store the value
|
|
92
80
|
this._timeRange = value;
|
|
93
|
-
// If the time range turned off...
|
|
94
81
|
if (!value && this._range?.start && this._range?.end) {
|
|
95
82
|
this.range = {
|
|
96
83
|
start: this._range.start.clone().startOf('day'),
|
|
@@ -98,15 +85,11 @@ class CmatDateRangeComponent {
|
|
|
98
85
|
};
|
|
99
86
|
}
|
|
100
87
|
}
|
|
101
|
-
/**
|
|
102
|
-
* Setter & getter for range input */
|
|
103
88
|
// eslint-disable-next-line @typescript-eslint/member-ordering
|
|
104
89
|
get range() {
|
|
105
90
|
if (this._range.start && this._range.end) {
|
|
106
|
-
// Clone the range start and end
|
|
107
91
|
const start = this._range?.start.clone();
|
|
108
92
|
const end = this._range?.end.clone();
|
|
109
|
-
// Build and return the range object
|
|
110
93
|
return {
|
|
111
94
|
startDate: start ? start.clone().format(this.dateFormat) : null,
|
|
112
95
|
startTime: this.timeRange && start ? start.clone().format(this.timeFormat) : null,
|
|
@@ -124,145 +107,81 @@ class CmatDateRangeComponent {
|
|
|
124
107
|
};
|
|
125
108
|
return;
|
|
126
109
|
}
|
|
127
|
-
// Check if we are setting an individual date or both of them
|
|
128
110
|
const whichDate = value.whichDate ?? null;
|
|
129
|
-
// Get the start and end dates as moment
|
|
130
111
|
const start = dayjs(value.start);
|
|
131
112
|
const end = dayjs(value.end);
|
|
132
|
-
// If we are only setting the start date...
|
|
133
113
|
if (whichDate === 'start') {
|
|
134
|
-
// Set the start date
|
|
135
114
|
this._range.start = start.clone();
|
|
136
|
-
// If the selected start date is after the end date...
|
|
137
115
|
if (this._range.end && this._range.start.isAfter(this._range.end)) {
|
|
138
|
-
// Set the end date to the start date but keep the end date's time
|
|
139
116
|
const endDate = start.clone().hour(this._range.end.hour()).minute(this._range.end.minute()).second(this._range.end.second());
|
|
140
|
-
// Test this new end date to see if it's ahead of the start date
|
|
141
117
|
if (this._range.start.isBefore(endDate)) {
|
|
142
|
-
// If it's, set the new end date
|
|
143
118
|
this._range.end = endDate;
|
|
144
119
|
}
|
|
145
120
|
else {
|
|
146
|
-
// Otherwise, set the end date same as the start date
|
|
147
121
|
this._range.end = start.clone();
|
|
148
122
|
}
|
|
149
123
|
}
|
|
150
124
|
}
|
|
151
|
-
// If we are only setting the end date...
|
|
152
125
|
if (whichDate === 'end') {
|
|
153
|
-
// Set the end date
|
|
154
126
|
this._range.end = end.clone();
|
|
155
|
-
// If the selected end date is before the start date...
|
|
156
127
|
if (this._range.start?.isAfter(this._range.end)) {
|
|
157
|
-
// Set the start date to the end date but keep the start date's time
|
|
158
128
|
const startDate = end.clone().hour(this._range.start.hour()).minute(this._range.start.minute()).second(this._range.start.second());
|
|
159
|
-
// Test this new end date to see if it's ahead of the start date
|
|
160
129
|
if (this._range.end.isAfter(startDate)) {
|
|
161
|
-
// If it's, set the new start date
|
|
162
130
|
this._range.start = startDate;
|
|
163
131
|
}
|
|
164
132
|
else {
|
|
165
|
-
// Otherwise, set the start date same as the end date
|
|
166
133
|
this._range.start = end.clone();
|
|
167
134
|
}
|
|
168
135
|
}
|
|
169
136
|
}
|
|
170
|
-
// If we are setting both dates...
|
|
171
137
|
if (!whichDate) {
|
|
172
|
-
// Set the start date
|
|
173
138
|
this._range.start = start.clone();
|
|
174
|
-
// If the start date is before the end date, set the end date as normal.
|
|
175
|
-
// If the start date is after the end date, set the end date same as the start date.
|
|
176
139
|
this._range.end = start.isBefore(end) ? end.clone() : start.clone();
|
|
177
140
|
}
|
|
178
141
|
if (this._range.start && this._range.end) {
|
|
179
|
-
// Prepare another range object that holds the ISO formatted range dates
|
|
180
142
|
const range = {
|
|
181
143
|
start: this._range.start.clone().toISOString(),
|
|
182
144
|
end: this._range.end.clone().toISOString()
|
|
183
145
|
};
|
|
184
|
-
// Emit the range changed event with the range
|
|
185
146
|
this.rangeChanged.emit(range);
|
|
186
|
-
// Update the model with the range if the change was not a programmatic change
|
|
187
|
-
// Because programmatic changes trigger writeValue which triggers onChange and onTouched
|
|
188
|
-
// internally causing them to trigger twice which breaks the form's pristine and touched
|
|
189
|
-
// statuses.
|
|
190
147
|
if (!this._programmaticChange) {
|
|
191
148
|
this._onTouched(range);
|
|
192
149
|
this._onChange(range);
|
|
193
150
|
}
|
|
194
|
-
// Set the active dates
|
|
195
151
|
this.activeDates = {
|
|
196
152
|
month1: this._range.start.clone(),
|
|
197
153
|
month2: this._range.start.clone().add(1, 'month')
|
|
198
154
|
};
|
|
199
|
-
// Set the time form controls
|
|
200
155
|
this.startTimeFormControl.setValue(this._range.start.clone().format(this._timeFormat).toString());
|
|
201
156
|
this.endTimeFormControl.setValue(this._range.end.clone().format(this._timeFormat).toString());
|
|
202
157
|
}
|
|
203
|
-
// Run ngAfterContentInit on month views to trigger
|
|
204
|
-
// re-render on month views if they are available
|
|
205
158
|
if (this._matMonthView1 && this._matMonthView2) {
|
|
206
159
|
this._matMonthView1.ngAfterContentInit();
|
|
207
160
|
this._matMonthView2.ngAfterContentInit();
|
|
208
161
|
}
|
|
209
|
-
// Reset the programmatic change status
|
|
210
162
|
this._programmaticChange = false;
|
|
211
163
|
}
|
|
212
|
-
// -----------------------------------------------------------------------------------------------------
|
|
213
|
-
// @ Control Value Accessor
|
|
214
|
-
// -----------------------------------------------------------------------------------------------------
|
|
215
|
-
/**
|
|
216
|
-
* Update the form model on change
|
|
217
|
-
*
|
|
218
|
-
* @param fn
|
|
219
|
-
*/
|
|
220
164
|
registerOnChange(fn) {
|
|
221
165
|
this._onChange = fn;
|
|
222
166
|
}
|
|
223
|
-
/**
|
|
224
|
-
* Update the form model on blur
|
|
225
|
-
*
|
|
226
|
-
* @param fn
|
|
227
|
-
*/
|
|
228
167
|
registerOnTouched(fn) {
|
|
229
168
|
this._onTouched = fn;
|
|
230
169
|
}
|
|
231
|
-
/**
|
|
232
|
-
* Write to view from model when the form model changes programmatically
|
|
233
|
-
*
|
|
234
|
-
* @param range
|
|
235
|
-
*/
|
|
236
170
|
writeValue(range) {
|
|
237
|
-
// Set this change as a programmatic one
|
|
238
171
|
this._programmaticChange = true;
|
|
239
|
-
// Set the range
|
|
240
172
|
this.range = range;
|
|
241
173
|
this._changeDetectorRef.markForCheck();
|
|
242
174
|
}
|
|
243
175
|
ngOnInit() {
|
|
244
|
-
// Initialize the component
|
|
245
176
|
this._init();
|
|
246
177
|
}
|
|
247
|
-
/**
|
|
248
|
-
* On destroy
|
|
249
|
-
*/
|
|
250
178
|
ngOnDestroy() {
|
|
251
|
-
this._unsubscribeAll.next(void 0);
|
|
252
|
-
this._unsubscribeAll.complete();
|
|
253
179
|
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
254
180
|
this.writeValue = () => { };
|
|
255
181
|
}
|
|
256
|
-
// -----------------------------------------------------------------------------------------------------
|
|
257
|
-
// @ Public methods
|
|
258
|
-
// -----------------------------------------------------------------------------------------------------
|
|
259
|
-
/**
|
|
260
|
-
* Open the picker panel
|
|
261
|
-
*/
|
|
262
182
|
openPickerPanel() {
|
|
263
183
|
if (this.readonly)
|
|
264
184
|
return;
|
|
265
|
-
// Create the overlay
|
|
266
185
|
const overlayRef = this._overlay.create({
|
|
267
186
|
panelClass: 'cmat-date-range-panel',
|
|
268
187
|
backdropClass: '',
|
|
@@ -287,141 +206,87 @@ class CmatDateRangeComponent {
|
|
|
287
206
|
}
|
|
288
207
|
])
|
|
289
208
|
});
|
|
290
|
-
// Create a portal from the template
|
|
291
209
|
const templatePortal = new TemplatePortal(this._pickerPanel, this._viewContainerRef);
|
|
292
|
-
// On backdrop click
|
|
293
210
|
overlayRef.backdropClick().subscribe(() => {
|
|
294
|
-
// If template portal exists and attached...
|
|
295
211
|
if (templatePortal?.isAttached) {
|
|
296
|
-
// Detach it
|
|
297
212
|
templatePortal.detach();
|
|
298
213
|
}
|
|
299
|
-
// If overlay exists and attached...
|
|
300
214
|
if (overlayRef?.hasAttached()) {
|
|
301
|
-
// Detach it
|
|
302
215
|
overlayRef.detach();
|
|
303
216
|
overlayRef.dispose();
|
|
304
217
|
}
|
|
305
218
|
});
|
|
306
|
-
// Attach the portal to the overlay
|
|
307
219
|
overlayRef.attach(templatePortal);
|
|
308
220
|
}
|
|
309
|
-
/**
|
|
310
|
-
* Get month label
|
|
311
|
-
*
|
|
312
|
-
* @param month
|
|
313
|
-
*/
|
|
314
221
|
getMonthLabel(month) {
|
|
315
222
|
if (month === 1) {
|
|
316
223
|
return this.activeDates.month1?.clone().format('YYYY MMMM');
|
|
317
224
|
}
|
|
318
225
|
return this.activeDates.month2?.clone().format('YYYY MMMM');
|
|
319
226
|
}
|
|
320
|
-
/**
|
|
321
|
-
* Date class function to add/remove class names to calendar days
|
|
322
|
-
*/
|
|
323
227
|
dateClass() {
|
|
324
228
|
return (date) => {
|
|
325
229
|
const start = this._range.start ?? dayjs();
|
|
326
230
|
const end = this._range.end ?? dayjs().add(1, 'day').endOf('day');
|
|
327
|
-
// If the date is both start and end date...
|
|
328
231
|
if (date.isSame(start, 'day') && date.isSame(end, 'day')) {
|
|
329
232
|
return ['cmat-date-range', 'cmat-date-range-start', 'cmat-date-range-end'];
|
|
330
233
|
}
|
|
331
|
-
// If the date is the start date...
|
|
332
234
|
if (date.isSame(start, 'day')) {
|
|
333
235
|
return ['cmat-date-range', 'cmat-date-range-start'];
|
|
334
236
|
}
|
|
335
|
-
// If the date is the end date...
|
|
336
237
|
if (date.isSame(end, 'day')) {
|
|
337
238
|
return ['cmat-date-range', 'cmat-date-range-end'];
|
|
338
239
|
}
|
|
339
|
-
// If the date is in between start and end dates...
|
|
340
240
|
if (date.isBetween(start, end, 'day')) {
|
|
341
241
|
return ['cmat-date-range', 'cmat-date-range-mid'];
|
|
342
242
|
}
|
|
343
243
|
return void 0;
|
|
344
244
|
};
|
|
345
245
|
}
|
|
346
|
-
/**
|
|
347
|
-
* Date filter to enable/disable calendar days
|
|
348
|
-
*/
|
|
349
246
|
dateFilter() {
|
|
350
|
-
// If we are selecting the end date, disable all the dates that comes before the start date
|
|
351
247
|
return (date) => !(this.setWhichDate === 'end' && date.isBefore(this._range.start, 'day'));
|
|
352
248
|
}
|
|
353
|
-
/**
|
|
354
|
-
* On selected date change
|
|
355
|
-
*
|
|
356
|
-
* @param date
|
|
357
|
-
*/
|
|
358
249
|
onSelectedDateChange(date) {
|
|
359
250
|
const newRange = {
|
|
360
251
|
start: dayjs().toISOString(),
|
|
361
252
|
end: dayjs().toISOString(),
|
|
362
253
|
whichDate: ''
|
|
363
254
|
};
|
|
364
|
-
// Replace either the start or the end date with the new one
|
|
365
|
-
// depending on which date we are setting
|
|
366
255
|
if (this.setWhichDate === 'start') {
|
|
367
256
|
newRange.start = dayjs(newRange.start).year(date.year()).month(date.month()).date(date.date()).toISOString();
|
|
368
257
|
}
|
|
369
258
|
else {
|
|
370
259
|
newRange.end = dayjs(newRange.end).year(date.year()).month(date.month()).date(date.date()).toISOString();
|
|
371
260
|
}
|
|
372
|
-
// Append the which date to the new range object
|
|
373
261
|
newRange.whichDate = this.setWhichDate;
|
|
374
|
-
// Switch which date to set on the next run
|
|
375
262
|
this.setWhichDate = this.setWhichDate === 'start' ? 'end' : 'start';
|
|
376
|
-
// Set the range
|
|
377
263
|
this.range = newRange;
|
|
378
264
|
this._changeDetectorRef.markForCheck();
|
|
379
265
|
}
|
|
380
|
-
/**
|
|
381
|
-
* Go to previous month on both views
|
|
382
|
-
*/
|
|
383
266
|
prev() {
|
|
384
267
|
this.activeDates.month1 = dayjs(this.activeDates.month1).subtract(1, 'month');
|
|
385
268
|
this.activeDates.month2 = dayjs(this.activeDates.month2).subtract(1, 'month');
|
|
386
269
|
}
|
|
387
|
-
/**
|
|
388
|
-
* Go to next month on both views
|
|
389
|
-
*/
|
|
390
270
|
next() {
|
|
391
271
|
this.activeDates.month1 = dayjs(this.activeDates.month1).add(1, 'month');
|
|
392
272
|
this.activeDates.month2 = dayjs(this.activeDates.month2).add(1, 'month');
|
|
393
273
|
}
|
|
394
|
-
/**
|
|
395
|
-
* Update the start time
|
|
396
|
-
*
|
|
397
|
-
* @param event
|
|
398
|
-
*/
|
|
399
274
|
updateStartTime(event) {
|
|
400
|
-
// Parse the time
|
|
401
275
|
const parsedTime = this._parseTime(event.target.value);
|
|
402
|
-
// Go back to the previous value if the form control is not valid
|
|
403
276
|
if (this.startTimeFormControl.invalid) {
|
|
404
277
|
if (this._range.start) {
|
|
405
|
-
// Override the time
|
|
406
278
|
const time = this._range.start.clone().format(this._timeFormat);
|
|
407
|
-
// Set the time
|
|
408
279
|
this.startTimeFormControl.setValue(time);
|
|
409
280
|
}
|
|
410
|
-
// Do not update the range
|
|
411
281
|
return;
|
|
412
282
|
}
|
|
413
283
|
if (this._range.start && this._range.end) {
|
|
414
|
-
// Append the new time to the start date
|
|
415
284
|
const startDate = this._range.start.clone().hour(parsedTime.hour()).minute(parsedTime.minute());
|
|
416
|
-
// If the new start date is after the current end date,
|
|
417
|
-
// use the end date's time and set the start date again
|
|
418
285
|
if (startDate.isAfter(this._range.end)) {
|
|
419
286
|
const endDateHours = this._range.end.hour();
|
|
420
287
|
const endDateMinutes = this._range.end.minute();
|
|
421
|
-
// Set the start date
|
|
422
288
|
startDate.hour(endDateHours).minute(endDateMinutes);
|
|
423
289
|
}
|
|
424
|
-
// If everything is okay, set the new date
|
|
425
290
|
this.range = {
|
|
426
291
|
start: startDate.toISOString(),
|
|
427
292
|
end: this._range.end.clone().toISOString(),
|
|
@@ -430,37 +295,22 @@ class CmatDateRangeComponent {
|
|
|
430
295
|
this._changeDetectorRef.markForCheck();
|
|
431
296
|
}
|
|
432
297
|
}
|
|
433
|
-
/**
|
|
434
|
-
* Update the end time
|
|
435
|
-
*
|
|
436
|
-
* @param event
|
|
437
|
-
*/
|
|
438
298
|
updateEndTime(event) {
|
|
439
|
-
// Parse the time
|
|
440
299
|
const parsedTime = this._parseTime(event.target.value);
|
|
441
|
-
// Go back to the previous value if the form control is not valid
|
|
442
300
|
if (this.endTimeFormControl.invalid) {
|
|
443
301
|
if (this._range.end) {
|
|
444
|
-
// Override the time
|
|
445
302
|
const time = this._range.end.clone().format(this._timeFormat);
|
|
446
|
-
// Set the time
|
|
447
303
|
this.endTimeFormControl.setValue(time);
|
|
448
304
|
}
|
|
449
|
-
// Do not update the range
|
|
450
305
|
return;
|
|
451
306
|
}
|
|
452
307
|
if (this._range.start && this._range.end) {
|
|
453
|
-
// Append the new time to the end date
|
|
454
308
|
const endDate = this._range.end.clone().hour(parsedTime.hour()).minute(parsedTime.minute());
|
|
455
|
-
// If the new end date is before the current start date,
|
|
456
|
-
// use the start date's time and set the end date again
|
|
457
309
|
if (endDate.isBefore(this._range.start)) {
|
|
458
310
|
const startDateHours = this._range.start.hour();
|
|
459
311
|
const startDateMinutes = this._range.start.minute();
|
|
460
|
-
// Set the end date
|
|
461
312
|
endDate.hour(startDateHours).minute(startDateMinutes);
|
|
462
313
|
}
|
|
463
|
-
// If everything is okay, set the new date
|
|
464
314
|
this.range = {
|
|
465
315
|
start: this._range.start.clone().toISOString(),
|
|
466
316
|
end: endDate.toISOString(),
|
|
@@ -469,19 +319,9 @@ class CmatDateRangeComponent {
|
|
|
469
319
|
this._changeDetectorRef.markForCheck();
|
|
470
320
|
}
|
|
471
321
|
}
|
|
472
|
-
// -----------------------------------------------------------------------------------------------------
|
|
473
|
-
// @ Private methods
|
|
474
|
-
// -----------------------------------------------------------------------------------------------------
|
|
475
|
-
/**
|
|
476
|
-
* Initialize
|
|
477
|
-
*
|
|
478
|
-
* @private
|
|
479
|
-
*/
|
|
480
322
|
_init() {
|
|
481
|
-
// Start and end time form controls
|
|
482
323
|
this.startTimeFormControl = new FormControl('', [Validators.pattern(this._timeRegExp)]);
|
|
483
324
|
this.endTimeFormControl = new FormControl('', [Validators.pattern(this._timeRegExp)]);
|
|
484
|
-
// Set the default range
|
|
485
325
|
this._programmaticChange = true;
|
|
486
326
|
if (this.initData) {
|
|
487
327
|
this.range = {
|
|
@@ -492,40 +332,28 @@ class CmatDateRangeComponent {
|
|
|
492
332
|
else {
|
|
493
333
|
this.range = {};
|
|
494
334
|
}
|
|
495
|
-
// Set the default time range
|
|
496
335
|
this._programmaticChange = true;
|
|
497
336
|
this.timeRange = this.timeRange ?? true;
|
|
498
337
|
this._changeDetectorRef.markForCheck();
|
|
499
338
|
}
|
|
500
|
-
/**
|
|
501
|
-
* Parse the time from the inputs
|
|
502
|
-
*
|
|
503
|
-
* @param value
|
|
504
|
-
* @private
|
|
505
|
-
*/
|
|
506
339
|
_parseTime(value) {
|
|
507
|
-
// Parse the time using the time regexp
|
|
508
340
|
const timeArr = value.split(this._timeRegExp).filter(part => part !== '');
|
|
509
|
-
// Get the meridiem
|
|
510
341
|
const meridiem = timeArr[2] || null;
|
|
511
|
-
// If meridiem exists...
|
|
512
342
|
if (meridiem) {
|
|
513
|
-
// Create a moment using 12-hours format and return it
|
|
514
343
|
return dayjs(value, 'hh:mmA').second(0);
|
|
515
344
|
}
|
|
516
|
-
// If meridiem doesn't exist, create a moment using 24-hours format and return in
|
|
517
345
|
return dayjs(value, 'HH:mm').second(0);
|
|
518
346
|
}
|
|
519
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.
|
|
520
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.
|
|
347
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: CmatDateRangeComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
348
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.8", type: CmatDateRangeComponent, isStandalone: true, selector: "cmat-date-range", inputs: { controlClass: "controlClass", initData: "initData", readonly: "readonly", dateFormat: "dateFormat", timeFormat: "timeFormat", timeRange: "timeRange", range: "range" }, outputs: { rangeChanged: "rangeChanged" }, providers: [
|
|
521
349
|
{
|
|
522
350
|
provide: NG_VALUE_ACCESSOR,
|
|
523
351
|
useExisting: forwardRef(() => CmatDateRangeComponent),
|
|
524
352
|
multi: true
|
|
525
353
|
}
|
|
526
|
-
], viewQueries: [{ propertyName: "_matMonthView1", first: true, predicate: ["matMonthView1"], descendants: true }, { propertyName: "_matMonthView2", first: true, predicate: ["matMonthView2"], descendants: true }, { propertyName: "_pickerPanelOrigin", first: true, predicate: ["pickerPanelOrigin"], descendants: true, read: ElementRef }, { propertyName: "_pickerPanel", first: true, predicate: ["pickerPanel"], descendants: true }], exportAs: ["cmatDateRange"], ngImport: i0, template: "<div #pickerPanelOrigin role=\"presentation\" class=\"range\" (click)=\"openPickerPanel()\">\r\n\r\n <div class=\"start\" [ngClass]=\"controlClass\">\r\n <div class=\"date\">{{range?.startDate}}</div>\r\n @if (range?.startTime) {\r\n <div class=\"time\">{{range?.startTime}}</div>\r\n }\r\n </div>\r\n\r\n <div class=\"separator\">-</div>\r\n\r\n <div class=\"end\" [ngClass]=\"controlClass\">\r\n <div class=\"date\">{{range?.endDate}}</div>\r\n @if (range?.endTime) {\r\n <div class=\"time\">{{range?.endTime}}</div>\r\n }\r\n </div>\r\n\r\n</div>\r\n\r\n<ng-template #pickerPanel>\r\n\r\n <!-- Start -->\r\n <div class=\"start\">\r\n\r\n <div class=\"month\">\r\n <div class=\"month-header\">\r\n <button type=\"button\" class=\"previous-button\" matIconButton tabindex=\"1\" (click)=\"prev()\">\r\n <mat-icon [svgIcon]=\"'heroicons_outline:chevron-left'\"></mat-icon>\r\n </button>\r\n <div class=\"month-label\">{{getMonthLabel(1)}}</div>\r\n </div>\r\n <mat-month-view #matMonthView1 [dateFilter]=\"dateFilter()\" [dateClass]=\"dateClass()\"\r\n [(activeDate)]=\"activeDates.month1\" (click)=\"$event.stopImmediatePropagation()\"\r\n (selectedChange)=\"onSelectedDateChange($event)\">\r\n </mat-month-view>\r\n </div>\r\n\r\n @if (timeRange) {\r\n <mat-form-field class=\"time start-time\">\r\n <input matInput tabindex=\"3\" [autocomplete]=\"'off'\" [formControl]=\"startTimeFormControl\"\r\n (blur)=\"updateStartTime($event)\">\r\n <mat-label>\u5F00\u59CB\u65F6\u95F4</mat-label>\r\n </mat-form-field>\r\n }\r\n\r\n </div>\r\n\r\n <!-- End -->\r\n <div class=\"end\">\r\n\r\n <div class=\"month\">\r\n <div class=\"month-header\">\r\n <div class=\"month-label\">{{getMonthLabel(2)}}</div>\r\n <button type=\"button\" class=\"next-button\" matIconButton tabindex=\"2\" (click)=\"next()\">\r\n <mat-icon [svgIcon]=\"'heroicons_outline:chevron-right'\"></mat-icon>\r\n </button>\r\n </div>\r\n <mat-month-view #matMonthView2 [dateFilter]=\"dateFilter()\" [dateClass]=\"dateClass()\"\r\n [(activeDate)]=\"activeDates.month2\" (click)=\"$event.stopImmediatePropagation()\"\r\n (selectedChange)=\"onSelectedDateChange($event)\">\r\n </mat-month-view>\r\n </div>\r\n\r\n @if (timeRange) {\r\n <mat-form-field class=\"time end-time\">\r\n <input matInput tabindex=\"4\" [formControl]=\"endTimeFormControl\" (blur)=\"updateEndTime($event)\">\r\n <mat-label>\u7ED3\u675F\u65F6\u95F4</mat-label>\r\n </mat-form-field>\r\n }\r\n\r\n </div>\r\n\r\n </ng-template>", styles: ["cmat-date-range{display:flex}cmat-date-range .range{display:flex;width:100%;align-items:center;height:48px;min-height:48px;max-height:48px;cursor:pointer}cmat-date-range .range .start,cmat-date-range .range .end{display:flex;align-items:center;height:100%;padding:0 16px;border-radius:6px;border-width:1px;line-height:1}cmat-date-range .range .date{white-space:nowrap}cmat-date-range .range .date+.time{margin-left:8px}cmat-date-range .range .time{white-space:nowrap}cmat-date-range .separator{margin:0 8px;width:6px}.cmat-date-range-panel{border-radius:4px;padding:24px}.cmat-date-range-panel .start,.cmat-date-range-panel .end{display:flex;flex-direction:column}.cmat-date-range-panel .start .month,.cmat-date-range-panel .end .month{max-width:196px;min-width:196px;width:196px}.cmat-date-range-panel .start .month .month-header,.cmat-date-range-panel .end .month .month-header{position:relative;display:flex;align-items:center;justify-content:center;height:32px;margin-bottom:16px}.cmat-date-range-panel .start .month .month-header .previous-button,.cmat-date-range-panel .start .month .month-header .next-button,.cmat-date-range-panel .end .month .month-header .previous-button,.cmat-date-range-panel .end .month .month-header .next-button{position:absolute;width:24px!important;height:24px!important;min-height:24px!important;max-height:24px!important;line-height:24px!important}.cmat-date-range-panel .start .month .month-header .previous-button,.cmat-date-range-panel .end .month .month-header .previous-button{left:0}.cmat-date-range-panel .start .month .month-header .next-button,.cmat-date-range-panel .end .month .month-header .next-button{right:0}.cmat-date-range-panel .start .month .month-header .month-label,.cmat-date-range-panel .end .month .month-header .month-label{font-weight:500}.cmat-date-range-panel .start .month mat-month-view,.cmat-date-range-panel .end .month mat-month-view{display:flex;min-height:188px}.cmat-date-range-panel .start .month mat-month-view .mat-calendar-table,.cmat-date-range-panel .end .month mat-month-view .mat-calendar-table{width:100%;border-collapse:collapse}.cmat-date-range-panel .start .month mat-month-view .mat-calendar-table tbody tr[aria-hidden=true],.cmat-date-range-panel .end .month mat-month-view .mat-calendar-table tbody tr[aria-hidden=true]{display:none!important}.cmat-date-range-panel .start .month mat-month-view .mat-calendar-table tbody tr:first-child td:first-child[aria-hidden=true],.cmat-date-range-panel .end .month mat-month-view .mat-calendar-table tbody tr:first-child td:first-child[aria-hidden=true]{visibility:hidden;pointer-events:none;opacity:0}.cmat-date-range-panel .start .month mat-month-view .mat-calendar-table tbody tr td .mat-calendar-body-cell-content,.cmat-date-range-panel .end .month mat-month-view .mat-calendar-table tbody tr td .mat-calendar-body-cell-content{background-color:transparent!important}.cmat-date-range-panel .start .month mat-month-view .mat-calendar-table tbody .mat-calendar-body-today,.cmat-date-range-panel .end .month mat-month-view .mat-calendar-table tbody .mat-calendar-body-today{border:none!important}.cmat-date-range-panel .start .month mat-month-view .mat-calendar-table tbody .mat-calendar-body-cell,.cmat-date-range-panel .end .month mat-month-view .mat-calendar-table tbody .mat-calendar-body-cell{width:28px!important;height:28px!important;padding:2px!important}.cmat-date-range-panel .start .month mat-month-view .mat-calendar-table tbody .mat-calendar-body-cell.cmat-date-range:before,.cmat-date-range-panel .end .month mat-month-view .mat-calendar-table tbody .mat-calendar-body-cell.cmat-date-range:before{content:\"\";position:absolute;inset:2px 0}.cmat-date-range-panel .start .month mat-month-view .mat-calendar-table tbody .mat-calendar-body-cell.cmat-date-range.cmat-date-range-start:before,.cmat-date-range-panel .end .month mat-month-view .mat-calendar-table tbody .mat-calendar-body-cell.cmat-date-range.cmat-date-range-start:before{border-radius:999px 0 0 999px}.cmat-date-range-panel .start .month mat-month-view .mat-calendar-table tbody .mat-calendar-body-cell.cmat-date-range.cmat-date-range-start.cmat-date-range-end:before,.cmat-date-range-panel .end .month mat-month-view .mat-calendar-table tbody .mat-calendar-body-cell.cmat-date-range.cmat-date-range-start.cmat-date-range-end:before{right:2px;border-radius:999px}.cmat-date-range-panel .start .month mat-month-view .mat-calendar-table tbody .mat-calendar-body-cell.cmat-date-range.cmat-date-range-end:before,.cmat-date-range-panel .end .month mat-month-view .mat-calendar-table tbody .mat-calendar-body-cell.cmat-date-range.cmat-date-range-end:before{border-radius:0 999px 999px 0}.cmat-date-range-panel .start .month mat-month-view .mat-calendar-table tbody .mat-calendar-body-cell .mat-calendar-body-cell-content,.cmat-date-range-panel .end .month mat-month-view .mat-calendar-table tbody .mat-calendar-body-cell .mat-calendar-body-cell-content{position:relative;top:0;left:0;width:24px;height:24px;font-size:12px}.cmat-date-range-panel .time{width:100%;max-width:196px}.cmat-date-range-panel .start{align-items:flex-start;margin-right:20px}.cmat-date-range-panel .start .month .month-label{margin-left:8px}.cmat-date-range-panel .end{align-items:flex-end;margin-left:20px}.cmat-date-range-panel .end .month .month-label{margin-right:8px}\n"], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i2.MatIconButton, selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]", exportAs: ["matButton", "matAnchor"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i4.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i4.MatLabel, selector: "mat-label" }, { kind: "component", type: MatMonthView, selector: "mat-month-view", inputs: ["activeDate", "selected", "minDate", "maxDate", "dateFilter", "dateClass", "comparisonStart", "comparisonEnd", "startDateAccessibleName", "endDateAccessibleName", "activeDrag"], outputs: ["selectedChange", "_userSelection", "dragStarted", "dragEnded", "activeDateChange"], exportAs: ["matMonthView"] }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i5.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
354
|
+
], viewQueries: [{ propertyName: "_matMonthView1", first: true, predicate: ["matMonthView1"], descendants: true }, { propertyName: "_matMonthView2", first: true, predicate: ["matMonthView2"], descendants: true }, { propertyName: "_pickerPanelOrigin", first: true, predicate: ["pickerPanelOrigin"], descendants: true, read: ElementRef }, { propertyName: "_pickerPanel", first: true, predicate: ["pickerPanel"], descendants: true }], exportAs: ["cmatDateRange"], ngImport: i0, template: "<div #pickerPanelOrigin role=\"presentation\" class=\"range\" (click)=\"openPickerPanel()\">\r\n\r\n <div class=\"start\" [ngClass]=\"controlClass\">\r\n <div class=\"date\">{{range?.startDate}}</div>\r\n @if (range?.startTime) {\r\n <div class=\"time\">{{range?.startTime}}</div>\r\n }\r\n </div>\r\n\r\n <div class=\"separator\">-</div>\r\n\r\n <div class=\"end\" [ngClass]=\"controlClass\">\r\n <div class=\"date\">{{range?.endDate}}</div>\r\n @if (range?.endTime) {\r\n <div class=\"time\">{{range?.endTime}}</div>\r\n }\r\n </div>\r\n\r\n</div>\r\n\r\n<ng-template #pickerPanel>\r\n\r\n \r\n <div class=\"start\">\r\n\r\n <div class=\"month\">\r\n <div class=\"month-header\">\r\n <button type=\"button\" class=\"previous-button\" matIconButton tabindex=\"1\" (click)=\"prev()\">\r\n <mat-icon [svgIcon]=\"'heroicons_outline:chevron-left'\"></mat-icon>\r\n </button>\r\n <div class=\"month-label\">{{getMonthLabel(1)}}</div>\r\n </div>\r\n <mat-month-view #matMonthView1 [dateFilter]=\"dateFilter()\" [dateClass]=\"dateClass()\"\r\n [(activeDate)]=\"activeDates.month1\" (click)=\"$event.stopImmediatePropagation()\"\r\n (selectedChange)=\"onSelectedDateChange($event)\">\r\n </mat-month-view>\r\n </div>\r\n\r\n @if (timeRange) {\r\n <mat-form-field class=\"time start-time\">\r\n <input matInput tabindex=\"3\" [autocomplete]=\"'off'\" [formControl]=\"startTimeFormControl\"\r\n (blur)=\"updateStartTime($event)\">\r\n <mat-label>\u5F00\u59CB\u65F6\u95F4</mat-label>\r\n </mat-form-field>\r\n }\r\n\r\n </div>\r\n\r\n \r\n <div class=\"end\">\r\n\r\n <div class=\"month\">\r\n <div class=\"month-header\">\r\n <div class=\"month-label\">{{getMonthLabel(2)}}</div>\r\n <button type=\"button\" class=\"next-button\" matIconButton tabindex=\"2\" (click)=\"next()\">\r\n <mat-icon [svgIcon]=\"'heroicons_outline:chevron-right'\"></mat-icon>\r\n </button>\r\n </div>\r\n <mat-month-view #matMonthView2 [dateFilter]=\"dateFilter()\" [dateClass]=\"dateClass()\"\r\n [(activeDate)]=\"activeDates.month2\" (click)=\"$event.stopImmediatePropagation()\"\r\n (selectedChange)=\"onSelectedDateChange($event)\">\r\n </mat-month-view>\r\n </div>\r\n\r\n @if (timeRange) {\r\n <mat-form-field class=\"time end-time\">\r\n <input matInput tabindex=\"4\" [formControl]=\"endTimeFormControl\" (blur)=\"updateEndTime($event)\">\r\n <mat-label>\u7ED3\u675F\u65F6\u95F4</mat-label>\r\n </mat-form-field>\r\n }\r\n\r\n </div>\r\n\r\n </ng-template>\r\n", styles: ["cmat-date-range{display:flex}cmat-date-range .range{display:flex;width:100%;align-items:center;height:48px;min-height:48px;max-height:48px;cursor:pointer}cmat-date-range .range .start,cmat-date-range .range .end{display:flex;align-items:center;height:100%;padding:0 16px;border-radius:6px;border-width:1px;line-height:1}cmat-date-range .range .date{white-space:nowrap}cmat-date-range .range .date+.time{margin-left:8px}cmat-date-range .range .time{white-space:nowrap}cmat-date-range .separator{margin:0 8px;width:6px}.cmat-date-range-panel{border-radius:4px;padding:24px}.cmat-date-range-panel .start,.cmat-date-range-panel .end{display:flex;flex-direction:column}.cmat-date-range-panel .start .month,.cmat-date-range-panel .end .month{max-width:196px;min-width:196px;width:196px}.cmat-date-range-panel .start .month .month-header,.cmat-date-range-panel .end .month .month-header{position:relative;display:flex;align-items:center;justify-content:center;height:32px;margin-bottom:16px}.cmat-date-range-panel .start .month .month-header .previous-button,.cmat-date-range-panel .start .month .month-header .next-button,.cmat-date-range-panel .end .month .month-header .previous-button,.cmat-date-range-panel .end .month .month-header .next-button{position:absolute;width:24px!important;height:24px!important;min-height:24px!important;max-height:24px!important;line-height:24px!important}.cmat-date-range-panel .start .month .month-header .previous-button,.cmat-date-range-panel .end .month .month-header .previous-button{left:0}.cmat-date-range-panel .start .month .month-header .next-button,.cmat-date-range-panel .end .month .month-header .next-button{right:0}.cmat-date-range-panel .start .month .month-header .month-label,.cmat-date-range-panel .end .month .month-header .month-label{font-weight:500}.cmat-date-range-panel .start .month mat-month-view,.cmat-date-range-panel .end .month mat-month-view{display:flex;min-height:188px}.cmat-date-range-panel .start .month mat-month-view .mat-calendar-table,.cmat-date-range-panel .end .month mat-month-view .mat-calendar-table{width:100%;border-collapse:collapse}.cmat-date-range-panel .start .month mat-month-view .mat-calendar-table tbody tr[aria-hidden=true],.cmat-date-range-panel .end .month mat-month-view .mat-calendar-table tbody tr[aria-hidden=true]{display:none!important}.cmat-date-range-panel .start .month mat-month-view .mat-calendar-table tbody tr:first-child td:first-child[aria-hidden=true],.cmat-date-range-panel .end .month mat-month-view .mat-calendar-table tbody tr:first-child td:first-child[aria-hidden=true]{visibility:hidden;pointer-events:none;opacity:0}.cmat-date-range-panel .start .month mat-month-view .mat-calendar-table tbody tr td .mat-calendar-body-cell-content,.cmat-date-range-panel .end .month mat-month-view .mat-calendar-table tbody tr td .mat-calendar-body-cell-content{background-color:transparent!important}.cmat-date-range-panel .start .month mat-month-view .mat-calendar-table tbody .mat-calendar-body-today,.cmat-date-range-panel .end .month mat-month-view .mat-calendar-table tbody .mat-calendar-body-today{border:none!important}.cmat-date-range-panel .start .month mat-month-view .mat-calendar-table tbody .mat-calendar-body-cell,.cmat-date-range-panel .end .month mat-month-view .mat-calendar-table tbody .mat-calendar-body-cell{width:28px!important;height:28px!important;padding:2px!important}.cmat-date-range-panel .start .month mat-month-view .mat-calendar-table tbody .mat-calendar-body-cell.cmat-date-range:before,.cmat-date-range-panel .end .month mat-month-view .mat-calendar-table tbody .mat-calendar-body-cell.cmat-date-range:before{content:\"\";position:absolute;inset:2px 0}.cmat-date-range-panel .start .month mat-month-view .mat-calendar-table tbody .mat-calendar-body-cell.cmat-date-range.cmat-date-range-start:before,.cmat-date-range-panel .end .month mat-month-view .mat-calendar-table tbody .mat-calendar-body-cell.cmat-date-range.cmat-date-range-start:before{border-radius:999px 0 0 999px}.cmat-date-range-panel .start .month mat-month-view .mat-calendar-table tbody .mat-calendar-body-cell.cmat-date-range.cmat-date-range-start.cmat-date-range-end:before,.cmat-date-range-panel .end .month mat-month-view .mat-calendar-table tbody .mat-calendar-body-cell.cmat-date-range.cmat-date-range-start.cmat-date-range-end:before{right:2px;border-radius:999px}.cmat-date-range-panel .start .month mat-month-view .mat-calendar-table tbody .mat-calendar-body-cell.cmat-date-range.cmat-date-range-end:before,.cmat-date-range-panel .end .month mat-month-view .mat-calendar-table tbody .mat-calendar-body-cell.cmat-date-range.cmat-date-range-end:before{border-radius:0 999px 999px 0}.cmat-date-range-panel .start .month mat-month-view .mat-calendar-table tbody .mat-calendar-body-cell .mat-calendar-body-cell-content,.cmat-date-range-panel .end .month mat-month-view .mat-calendar-table tbody .mat-calendar-body-cell .mat-calendar-body-cell-content{position:relative;top:0;left:0;width:24px;height:24px;font-size:12px}.cmat-date-range-panel .time{width:100%;max-width:196px}.cmat-date-range-panel .start{align-items:flex-start;margin-right:20px}.cmat-date-range-panel .start .month .month-label{margin-left:8px}.cmat-date-range-panel .end{align-items:flex-end;margin-left:20px}.cmat-date-range-panel .end .month .month-label{margin-right:8px}\n"], dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i2.MatIconButton, selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]", exportAs: ["matButton", "matAnchor"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i4.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i4.MatLabel, selector: "mat-label" }, { kind: "component", type: MatMonthView, selector: "mat-month-view", inputs: ["activeDate", "selected", "minDate", "maxDate", "dateFilter", "dateClass", "comparisonStart", "comparisonEnd", "startDateAccessibleName", "endDateAccessibleName", "activeDrag"], outputs: ["selectedChange", "_userSelection", "dragStarted", "dragEnded", "activeDateChange"], exportAs: ["matMonthView"] }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i5.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None }); }
|
|
527
355
|
}
|
|
528
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.
|
|
356
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.8", ngImport: i0, type: CmatDateRangeComponent, decorators: [{
|
|
529
357
|
type: Component,
|
|
530
358
|
args: [{ selector: 'cmat-date-range', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, exportAs: 'cmatDateRange', providers: [
|
|
531
359
|
{
|
|
@@ -535,7 +363,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.7", ngImpor
|
|
|
535
363
|
}
|
|
536
364
|
], imports: [FormsModule, ReactiveFormsModule, MatButtonModule, MatIconModule,
|
|
537
365
|
MatFormFieldModule, MatMonthView,
|
|
538
|
-
MatInputModule, NgClass], template: "<div #pickerPanelOrigin role=\"presentation\" class=\"range\" (click)=\"openPickerPanel()\">\r\n\r\n <div class=\"start\" [ngClass]=\"controlClass\">\r\n <div class=\"date\">{{range?.startDate}}</div>\r\n @if (range?.startTime) {\r\n <div class=\"time\">{{range?.startTime}}</div>\r\n }\r\n </div>\r\n\r\n <div class=\"separator\">-</div>\r\n\r\n <div class=\"end\" [ngClass]=\"controlClass\">\r\n <div class=\"date\">{{range?.endDate}}</div>\r\n @if (range?.endTime) {\r\n <div class=\"time\">{{range?.endTime}}</div>\r\n }\r\n </div>\r\n\r\n</div>\r\n\r\n<ng-template #pickerPanel>\r\n\r\n
|
|
366
|
+
MatInputModule, NgClass], template: "<div #pickerPanelOrigin role=\"presentation\" class=\"range\" (click)=\"openPickerPanel()\">\r\n\r\n <div class=\"start\" [ngClass]=\"controlClass\">\r\n <div class=\"date\">{{range?.startDate}}</div>\r\n @if (range?.startTime) {\r\n <div class=\"time\">{{range?.startTime}}</div>\r\n }\r\n </div>\r\n\r\n <div class=\"separator\">-</div>\r\n\r\n <div class=\"end\" [ngClass]=\"controlClass\">\r\n <div class=\"date\">{{range?.endDate}}</div>\r\n @if (range?.endTime) {\r\n <div class=\"time\">{{range?.endTime}}</div>\r\n }\r\n </div>\r\n\r\n</div>\r\n\r\n<ng-template #pickerPanel>\r\n\r\n \r\n <div class=\"start\">\r\n\r\n <div class=\"month\">\r\n <div class=\"month-header\">\r\n <button type=\"button\" class=\"previous-button\" matIconButton tabindex=\"1\" (click)=\"prev()\">\r\n <mat-icon [svgIcon]=\"'heroicons_outline:chevron-left'\"></mat-icon>\r\n </button>\r\n <div class=\"month-label\">{{getMonthLabel(1)}}</div>\r\n </div>\r\n <mat-month-view #matMonthView1 [dateFilter]=\"dateFilter()\" [dateClass]=\"dateClass()\"\r\n [(activeDate)]=\"activeDates.month1\" (click)=\"$event.stopImmediatePropagation()\"\r\n (selectedChange)=\"onSelectedDateChange($event)\">\r\n </mat-month-view>\r\n </div>\r\n\r\n @if (timeRange) {\r\n <mat-form-field class=\"time start-time\">\r\n <input matInput tabindex=\"3\" [autocomplete]=\"'off'\" [formControl]=\"startTimeFormControl\"\r\n (blur)=\"updateStartTime($event)\">\r\n <mat-label>\u5F00\u59CB\u65F6\u95F4</mat-label>\r\n </mat-form-field>\r\n }\r\n\r\n </div>\r\n\r\n \r\n <div class=\"end\">\r\n\r\n <div class=\"month\">\r\n <div class=\"month-header\">\r\n <div class=\"month-label\">{{getMonthLabel(2)}}</div>\r\n <button type=\"button\" class=\"next-button\" matIconButton tabindex=\"2\" (click)=\"next()\">\r\n <mat-icon [svgIcon]=\"'heroicons_outline:chevron-right'\"></mat-icon>\r\n </button>\r\n </div>\r\n <mat-month-view #matMonthView2 [dateFilter]=\"dateFilter()\" [dateClass]=\"dateClass()\"\r\n [(activeDate)]=\"activeDates.month2\" (click)=\"$event.stopImmediatePropagation()\"\r\n (selectedChange)=\"onSelectedDateChange($event)\">\r\n </mat-month-view>\r\n </div>\r\n\r\n @if (timeRange) {\r\n <mat-form-field class=\"time end-time\">\r\n <input matInput tabindex=\"4\" [formControl]=\"endTimeFormControl\" (blur)=\"updateEndTime($event)\">\r\n <mat-label>\u7ED3\u675F\u65F6\u95F4</mat-label>\r\n </mat-form-field>\r\n }\r\n\r\n </div>\r\n\r\n </ng-template>\r\n", styles: ["cmat-date-range{display:flex}cmat-date-range .range{display:flex;width:100%;align-items:center;height:48px;min-height:48px;max-height:48px;cursor:pointer}cmat-date-range .range .start,cmat-date-range .range .end{display:flex;align-items:center;height:100%;padding:0 16px;border-radius:6px;border-width:1px;line-height:1}cmat-date-range .range .date{white-space:nowrap}cmat-date-range .range .date+.time{margin-left:8px}cmat-date-range .range .time{white-space:nowrap}cmat-date-range .separator{margin:0 8px;width:6px}.cmat-date-range-panel{border-radius:4px;padding:24px}.cmat-date-range-panel .start,.cmat-date-range-panel .end{display:flex;flex-direction:column}.cmat-date-range-panel .start .month,.cmat-date-range-panel .end .month{max-width:196px;min-width:196px;width:196px}.cmat-date-range-panel .start .month .month-header,.cmat-date-range-panel .end .month .month-header{position:relative;display:flex;align-items:center;justify-content:center;height:32px;margin-bottom:16px}.cmat-date-range-panel .start .month .month-header .previous-button,.cmat-date-range-panel .start .month .month-header .next-button,.cmat-date-range-panel .end .month .month-header .previous-button,.cmat-date-range-panel .end .month .month-header .next-button{position:absolute;width:24px!important;height:24px!important;min-height:24px!important;max-height:24px!important;line-height:24px!important}.cmat-date-range-panel .start .month .month-header .previous-button,.cmat-date-range-panel .end .month .month-header .previous-button{left:0}.cmat-date-range-panel .start .month .month-header .next-button,.cmat-date-range-panel .end .month .month-header .next-button{right:0}.cmat-date-range-panel .start .month .month-header .month-label,.cmat-date-range-panel .end .month .month-header .month-label{font-weight:500}.cmat-date-range-panel .start .month mat-month-view,.cmat-date-range-panel .end .month mat-month-view{display:flex;min-height:188px}.cmat-date-range-panel .start .month mat-month-view .mat-calendar-table,.cmat-date-range-panel .end .month mat-month-view .mat-calendar-table{width:100%;border-collapse:collapse}.cmat-date-range-panel .start .month mat-month-view .mat-calendar-table tbody tr[aria-hidden=true],.cmat-date-range-panel .end .month mat-month-view .mat-calendar-table tbody tr[aria-hidden=true]{display:none!important}.cmat-date-range-panel .start .month mat-month-view .mat-calendar-table tbody tr:first-child td:first-child[aria-hidden=true],.cmat-date-range-panel .end .month mat-month-view .mat-calendar-table tbody tr:first-child td:first-child[aria-hidden=true]{visibility:hidden;pointer-events:none;opacity:0}.cmat-date-range-panel .start .month mat-month-view .mat-calendar-table tbody tr td .mat-calendar-body-cell-content,.cmat-date-range-panel .end .month mat-month-view .mat-calendar-table tbody tr td .mat-calendar-body-cell-content{background-color:transparent!important}.cmat-date-range-panel .start .month mat-month-view .mat-calendar-table tbody .mat-calendar-body-today,.cmat-date-range-panel .end .month mat-month-view .mat-calendar-table tbody .mat-calendar-body-today{border:none!important}.cmat-date-range-panel .start .month mat-month-view .mat-calendar-table tbody .mat-calendar-body-cell,.cmat-date-range-panel .end .month mat-month-view .mat-calendar-table tbody .mat-calendar-body-cell{width:28px!important;height:28px!important;padding:2px!important}.cmat-date-range-panel .start .month mat-month-view .mat-calendar-table tbody .mat-calendar-body-cell.cmat-date-range:before,.cmat-date-range-panel .end .month mat-month-view .mat-calendar-table tbody .mat-calendar-body-cell.cmat-date-range:before{content:\"\";position:absolute;inset:2px 0}.cmat-date-range-panel .start .month mat-month-view .mat-calendar-table tbody .mat-calendar-body-cell.cmat-date-range.cmat-date-range-start:before,.cmat-date-range-panel .end .month mat-month-view .mat-calendar-table tbody .mat-calendar-body-cell.cmat-date-range.cmat-date-range-start:before{border-radius:999px 0 0 999px}.cmat-date-range-panel .start .month mat-month-view .mat-calendar-table tbody .mat-calendar-body-cell.cmat-date-range.cmat-date-range-start.cmat-date-range-end:before,.cmat-date-range-panel .end .month mat-month-view .mat-calendar-table tbody .mat-calendar-body-cell.cmat-date-range.cmat-date-range-start.cmat-date-range-end:before{right:2px;border-radius:999px}.cmat-date-range-panel .start .month mat-month-view .mat-calendar-table tbody .mat-calendar-body-cell.cmat-date-range.cmat-date-range-end:before,.cmat-date-range-panel .end .month mat-month-view .mat-calendar-table tbody .mat-calendar-body-cell.cmat-date-range.cmat-date-range-end:before{border-radius:0 999px 999px 0}.cmat-date-range-panel .start .month mat-month-view .mat-calendar-table tbody .mat-calendar-body-cell .mat-calendar-body-cell-content,.cmat-date-range-panel .end .month mat-month-view .mat-calendar-table tbody .mat-calendar-body-cell .mat-calendar-body-cell-content{position:relative;top:0;left:0;width:24px;height:24px;font-size:12px}.cmat-date-range-panel .time{width:100%;max-width:196px}.cmat-date-range-panel .start{align-items:flex-start;margin-right:20px}.cmat-date-range-panel .start .month .month-label{margin-left:8px}.cmat-date-range-panel .end{align-items:flex-end;margin-left:20px}.cmat-date-range-panel .end .month .month-label{margin-right:8px}\n"] }]
|
|
539
367
|
}], ctorParameters: () => [], propDecorators: { controlClass: [{
|
|
540
368
|
type: Input
|
|
541
369
|
}], initData: [{
|