@bizd/daterange 0.0.0-stage → 1.1.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.
Files changed (27) hide show
  1. package/README.md +176 -2
  2. package/dist/resources/bizd/daterange/.library +28 -0
  3. package/dist/resources/bizd/daterange/DatePeriodPicker-dbg.js +195 -0
  4. package/dist/resources/bizd/daterange/DatePeriodPicker.js +2 -0
  5. package/dist/resources/bizd/daterange/DatePeriodPicker.js.map +1 -0
  6. package/dist/resources/bizd/daterange/DatePeriodPickerEngine-dbg.js +373 -0
  7. package/dist/resources/bizd/daterange/DatePeriodPickerEngine.js +2 -0
  8. package/dist/resources/bizd/daterange/DatePeriodPickerEngine.js.map +1 -0
  9. package/dist/resources/bizd/daterange/library-dbg.js +42 -0
  10. package/dist/resources/bizd/daterange/library-preload.js +8 -0
  11. package/dist/resources/bizd/daterange/library-preload.js.map +1 -0
  12. package/dist/resources/bizd/daterange/library.js +2 -0
  13. package/dist/resources/bizd/daterange/library.js.map +1 -0
  14. package/dist/resources/bizd/daterange/manifest.json +61 -0
  15. package/dist/resources/bizd/daterange/messagebundle.properties +23 -0
  16. package/dist/resources/bizd/daterange/themes/sap_horizon/library-RTL.css +3 -0
  17. package/dist/resources/bizd/daterange/themes/sap_horizon/library-parameters.json +1 -0
  18. package/dist/resources/bizd/daterange/themes/sap_horizon/library.css +3 -0
  19. package/dist/resources/bizd/daterange/themes/sap_horizon/library.source.less +238 -0
  20. package/package.json +33 -4
  21. package/src/bizd/daterange/.library +28 -0
  22. package/src/bizd/daterange/DatePeriodPicker.js +195 -0
  23. package/src/bizd/daterange/DatePeriodPickerEngine.js +373 -0
  24. package/src/bizd/daterange/library.js +42 -0
  25. package/src/bizd/daterange/messagebundle.properties +23 -0
  26. package/src/bizd/daterange/themes/sap_horizon/library.source.less +238 -0
  27. package/ui5.yaml +12 -0
@@ -0,0 +1,3 @@
1
+ .bizDateChips{gap:0.375rem;margin-top:0.375rem}.bizDateChips .sapMBtn{height:auto;padding:0}.bizDateChips .sapMBtnInner{height:1.625rem;min-width:0;padding:0 0.625rem;border-radius:1rem;border:1px solid #c9d4e1;background:#ffffff;color:#32465a;font-size:0.75rem;font-weight:600}.bizDateChips .sapMBtnInner .sapMBtnContent{line-height:1.5rem}.bizDateChips .sapMBtn:hover .sapMBtnInner{background:#eef4fb;border-color:#8fb3db}.bizDateChips .sapMToggleBtnPressed.sapMBtnInner,.bizDateChips .sapMToggleBtnPressed.sapMBtnInner:hover{background:#0064d9;border-color:#0064d9;color:#ffffff}.bizDateChips .sapMToggleBtnPressed .sapMBtnContent{color:#ffffff}.bizDpPopover .sapMPopoverCont{border-radius:0.75rem}.bizDpBody{display:flex;align-items:stretch}.bizDpPresets{display:flex;flex-direction:column;width:11rem;padding:0.75rem 0.5rem;border-left:1px solid #e3e9f0;background:#f7f9fc;box-sizing:border-box}.bizDpPresetsTitle.sapMText{padding:0 0.625rem 0.5rem;color:#6a7b8f;font-size:0.6875rem;font-weight:700;letter-spacing:0.06em;text-transform:uppercase}.bizDpPresetList.sapMList,.bizDpPresetList .sapMListUl,.bizDpPresetList .sapMLIB{background:transparent}.bizDpPresetList .sapMLIB{height:2rem;min-height:2rem;margin-bottom:0.125rem;padding:0 0.625rem;border:none;border-radius:0.375rem}.bizDpPresetList .sapMSLITitleOnly{font-size:0.8125rem;color:#223548}.bizDpPresetList .sapMLIB:hover{background:#e8f0fa}.bizDpPresetList .sapMLIB.sapMLIBSelected,.bizDpPresetList .sapMLIB.sapMLIBSelected:hover{background:#0064d9;box-shadow:none}.bizDpPresetList .sapMLIBSelected .sapMSLITitleOnly{color:#ffffff;font-weight:600}.bizDpPresetList .sapMLIB:focus::before,.bizDpPresetList .sapMLIB:focus-visible::before{border-radius:0.375rem}.bizDpCalendarPane{display:flex;flex-direction:column;padding:0.5rem 0.75rem 0.5rem}.bizDpCalendarPane .sapUiCal{background:transparent}.bizDpHint.sapMText{max-width:19rem;padding:0.25rem 0.5rem 0.25rem;color:#6a7b8f;font-size:0.75rem}.bizDpFooter.sapMTB{height:3rem;padding:0 0.75rem;border-top:1px solid #e3e9f0;background:#ffffff}.bizDpSummaryIcon{color:#0064d9;font-size:1rem}.bizDpSummary.sapMText{color:#182737;font-size:0.8125rem;font-weight:600}@media (max-width:599px){.bizDpBody{flex-direction:column}.bizDpPresets{width:100%;border-left:none;border-bottom:1px solid #e3e9f0}.bizDpPresetList .sapMListUl{display:grid;grid-template-columns:1fr 1fr;column-gap:0.25rem}.bizDpCalendarPane{align-items:center}.bizDpFooter .sapMText.bizDpSummary{white-space:normal;font-size:0.75rem}}.bizDpCalendarPane .sapUiCalItem.sapUiCalItemSel{box-shadow:none}.bizDpCalendarPane .sapUiCalItem.sapUiCalItemSelBetween{background:#e8f0fa;border-color:#e8f0fa;border-radius:0}.bizDpCalendarPane .sapUiCalItem.sapUiCalItemSelBetween .sapUiCalItemText{color:#0b3d68}.bizDpCalendarPane .sapUiCalItem.sapUiCalItemSelStart,.bizDpCalendarPane .sapUiCalItem.sapUiCalItemSelEnd{background:#e8f0fa;border-color:#e8f0fa}.bizDpCalendarPane .sapUiCalItem.sapUiCalItemSelStart{border-radius:0 0.5rem 0.5rem 0}.bizDpCalendarPane .sapUiCalItem.sapUiCalItemSelEnd{border-radius:0.5rem 0 0 0.5rem}.bizDpCalendarPane .sapUiCalItem.sapUiCalItemSelStart.sapUiCalItemSelEnd,.bizDpCalendarPane .sapUiCalItem.sapUiCalItemSel:not(.sapUiCalItemSelStart):not(.sapUiCalItemSelEnd):not(.sapUiCalItemSelBetween){border-radius:0.5rem}.bizDpCalendarPane .sapUiCalItem.sapUiCalItemSelStart .sapUiCalItemText,.bizDpCalendarPane .sapUiCalItem.sapUiCalItemSelEnd .sapUiCalItemText,.bizDpCalendarPane .sapUiCalItem.sapUiCalItemSel:not(.sapUiCalItemSelBetween) .sapUiCalItemText{background:#0064d9;color:#ffffff;font-weight:700}.bizDpCalendarPane .sapUiCalItem.sapUiCalItemSel .sapUiCalItemText::before{border-color:transparent !important}.bizDpCalendarPane .sapUiCalItem.sapUiCalItemSel:not(.sapUiCalItemSelBetween) .sapUiCalItemText,.bizDpCalendarPane .sapUiCalItem.sapUiCalItemSel:not(.sapUiCalItemSelBetween):hover .sapUiCalItemText{background:#0064d9 !important;color:#ffffff !important}.bizDatePeriodPicker{display:block;box-sizing:border-box}
2
+ /* Inline theming parameters */
3
+ #sap-ui-theme-bizd\.daterange{background-image:url('data:text/plain;utf-8,%7B%7D')}
@@ -0,0 +1,3 @@
1
+ .bizDateChips{gap:0.375rem;margin-top:0.375rem}.bizDateChips .sapMBtn{height:auto;padding:0}.bizDateChips .sapMBtnInner{height:1.625rem;min-width:0;padding:0 0.625rem;border-radius:1rem;border:1px solid #c9d4e1;background:#ffffff;color:#32465a;font-size:0.75rem;font-weight:600}.bizDateChips .sapMBtnInner .sapMBtnContent{line-height:1.5rem}.bizDateChips .sapMBtn:hover .sapMBtnInner{background:#eef4fb;border-color:#8fb3db}.bizDateChips .sapMToggleBtnPressed.sapMBtnInner,.bizDateChips .sapMToggleBtnPressed.sapMBtnInner:hover{background:#0064d9;border-color:#0064d9;color:#ffffff}.bizDateChips .sapMToggleBtnPressed .sapMBtnContent{color:#ffffff}.bizDpPopover .sapMPopoverCont{border-radius:0.75rem}.bizDpBody{display:flex;align-items:stretch}.bizDpPresets{display:flex;flex-direction:column;width:11rem;padding:0.75rem 0.5rem;border-right:1px solid #e3e9f0;background:#f7f9fc;box-sizing:border-box}.bizDpPresetsTitle.sapMText{padding:0 0.625rem 0.5rem;color:#6a7b8f;font-size:0.6875rem;font-weight:700;letter-spacing:0.06em;text-transform:uppercase}.bizDpPresetList.sapMList,.bizDpPresetList .sapMListUl,.bizDpPresetList .sapMLIB{background:transparent}.bizDpPresetList .sapMLIB{height:2rem;min-height:2rem;margin-bottom:0.125rem;padding:0 0.625rem;border:none;border-radius:0.375rem}.bizDpPresetList .sapMSLITitleOnly{font-size:0.8125rem;color:#223548}.bizDpPresetList .sapMLIB:hover{background:#e8f0fa}.bizDpPresetList .sapMLIB.sapMLIBSelected,.bizDpPresetList .sapMLIB.sapMLIBSelected:hover{background:#0064d9;box-shadow:none}.bizDpPresetList .sapMLIBSelected .sapMSLITitleOnly{color:#ffffff;font-weight:600}.bizDpPresetList .sapMLIB:focus::before,.bizDpPresetList .sapMLIB:focus-visible::before{border-radius:0.375rem}.bizDpCalendarPane{display:flex;flex-direction:column;padding:0.5rem 0.75rem 0.5rem}.bizDpCalendarPane .sapUiCal{background:transparent}.bizDpHint.sapMText{max-width:19rem;padding:0.25rem 0.5rem 0.25rem;color:#6a7b8f;font-size:0.75rem}.bizDpFooter.sapMTB{height:3rem;padding:0 0.75rem;border-top:1px solid #e3e9f0;background:#ffffff}.bizDpSummaryIcon{color:#0064d9;font-size:1rem}.bizDpSummary.sapMText{color:#182737;font-size:0.8125rem;font-weight:600}@media (max-width:599px){.bizDpBody{flex-direction:column}.bizDpPresets{width:100%;border-right:none;border-bottom:1px solid #e3e9f0}.bizDpPresetList .sapMListUl{display:grid;grid-template-columns:1fr 1fr;column-gap:0.25rem}.bizDpCalendarPane{align-items:center}.bizDpFooter .sapMText.bizDpSummary{white-space:normal;font-size:0.75rem}}.bizDpCalendarPane .sapUiCalItem.sapUiCalItemSel{box-shadow:none}.bizDpCalendarPane .sapUiCalItem.sapUiCalItemSelBetween{background:#e8f0fa;border-color:#e8f0fa;border-radius:0}.bizDpCalendarPane .sapUiCalItem.sapUiCalItemSelBetween .sapUiCalItemText{color:#0b3d68}.bizDpCalendarPane .sapUiCalItem.sapUiCalItemSelStart,.bizDpCalendarPane .sapUiCalItem.sapUiCalItemSelEnd{background:#e8f0fa;border-color:#e8f0fa}.bizDpCalendarPane .sapUiCalItem.sapUiCalItemSelStart{border-radius:0.5rem 0 0 0.5rem}.bizDpCalendarPane .sapUiCalItem.sapUiCalItemSelEnd{border-radius:0 0.5rem 0.5rem 0}.bizDpCalendarPane .sapUiCalItem.sapUiCalItemSelStart.sapUiCalItemSelEnd,.bizDpCalendarPane .sapUiCalItem.sapUiCalItemSel:not(.sapUiCalItemSelStart):not(.sapUiCalItemSelEnd):not(.sapUiCalItemSelBetween){border-radius:0.5rem}.bizDpCalendarPane .sapUiCalItem.sapUiCalItemSelStart .sapUiCalItemText,.bizDpCalendarPane .sapUiCalItem.sapUiCalItemSelEnd .sapUiCalItemText,.bizDpCalendarPane .sapUiCalItem.sapUiCalItemSel:not(.sapUiCalItemSelBetween) .sapUiCalItemText{background:#0064d9;color:#ffffff;font-weight:700}.bizDpCalendarPane .sapUiCalItem.sapUiCalItemSel .sapUiCalItemText::before{border-color:transparent !important}.bizDpCalendarPane .sapUiCalItem.sapUiCalItemSel:not(.sapUiCalItemSelBetween) .sapUiCalItemText,.bizDpCalendarPane .sapUiCalItem.sapUiCalItemSel:not(.sapUiCalItemSelBetween):hover .sapUiCalItemText{background:#0064d9 !important;color:#ffffff !important}.bizDatePeriodPicker{display:block;box-sizing:border-box}
2
+ /* Inline theming parameters */
3
+ #sap-ui-theme-bizd\.daterange{background-image:url('data:text/plain;utf-8,%7B%7D')}
@@ -0,0 +1,238 @@
1
+ /* bizd.daterange — theme sap_horizon. Compiled to library.css by `npm run build`; loaded automatically with the library. */
2
+
3
+ /* ── DatePeriodPicker ── */
4
+ /* Quick period chips under the Date field */
5
+ .bizDateChips {
6
+ gap: 0.375rem;
7
+ margin-top: 0.375rem;
8
+ }
9
+
10
+ .bizDateChips .sapMBtn {
11
+ height: auto;
12
+ padding: 0;
13
+ }
14
+
15
+ .bizDateChips .sapMBtnInner {
16
+ height: 1.625rem;
17
+ min-width: 0;
18
+ padding: 0 0.625rem;
19
+ border-radius: 1rem;
20
+ border: 1px solid #c9d4e1;
21
+ background: #ffffff;
22
+ color: #32465a;
23
+ font-size: 0.75rem;
24
+ font-weight: 600;
25
+ }
26
+
27
+ .bizDateChips .sapMBtnInner .sapMBtnContent {
28
+ line-height: 1.5rem;
29
+ }
30
+
31
+ .bizDateChips .sapMBtn:hover .sapMBtnInner {
32
+ background: #eef4fb;
33
+ border-color: #8fb3db;
34
+ }
35
+
36
+ .bizDateChips .sapMToggleBtnPressed.sapMBtnInner,
37
+ .bizDateChips .sapMToggleBtnPressed.sapMBtnInner:hover {
38
+ background: #0064d9;
39
+ border-color: #0064d9;
40
+ color: #ffffff;
41
+ }
42
+
43
+ .bizDateChips .sapMToggleBtnPressed .sapMBtnContent {
44
+ color: #ffffff;
45
+ }
46
+
47
+ /* ── Date period picker popup (presets + calendar) ── */
48
+ .bizDpPopover .sapMPopoverCont {
49
+ border-radius: 0.75rem;
50
+ }
51
+
52
+ .bizDpBody {
53
+ display: flex;
54
+ align-items: stretch;
55
+ }
56
+
57
+ .bizDpPresets {
58
+ display: flex;
59
+ flex-direction: column;
60
+ width: 11rem;
61
+ padding: 0.75rem 0.5rem;
62
+ border-right: 1px solid #e3e9f0;
63
+ background: #f7f9fc;
64
+ box-sizing: border-box;
65
+ }
66
+
67
+ .bizDpPresetsTitle.sapMText {
68
+ padding: 0 0.625rem 0.5rem;
69
+ color: #6a7b8f;
70
+ font-size: 0.6875rem;
71
+ font-weight: 700;
72
+ letter-spacing: 0.06em;
73
+ text-transform: uppercase;
74
+ }
75
+
76
+ .bizDpPresetList.sapMList,
77
+ .bizDpPresetList .sapMListUl,
78
+ .bizDpPresetList .sapMLIB {
79
+ background: transparent;
80
+ }
81
+
82
+ .bizDpPresetList .sapMLIB {
83
+ height: 2rem;
84
+ min-height: 2rem;
85
+ margin-bottom: 0.125rem;
86
+ padding: 0 0.625rem;
87
+ border: none;
88
+ border-radius: 0.375rem;
89
+ }
90
+
91
+ .bizDpPresetList .sapMSLITitleOnly {
92
+ font-size: 0.8125rem;
93
+ color: #223548;
94
+ }
95
+
96
+ .bizDpPresetList .sapMLIB:hover {
97
+ background: #e8f0fa;
98
+ }
99
+
100
+ .bizDpPresetList .sapMLIB.sapMLIBSelected,
101
+ .bizDpPresetList .sapMLIB.sapMLIBSelected:hover {
102
+ background: #0064d9;
103
+ box-shadow: none;
104
+ }
105
+
106
+ .bizDpPresetList .sapMLIBSelected .sapMSLITitleOnly {
107
+ color: #ffffff;
108
+ font-weight: 600;
109
+ }
110
+
111
+ /* Hide the list's focus ring offset so the pill shape stays clean */
112
+ .bizDpPresetList .sapMLIB:focus::before,
113
+ .bizDpPresetList .sapMLIB:focus-visible::before {
114
+ border-radius: 0.375rem;
115
+ }
116
+
117
+ .bizDpCalendarPane {
118
+ display: flex;
119
+ flex-direction: column;
120
+ padding: 0.5rem 0.75rem 0.5rem;
121
+ }
122
+
123
+ .bizDpCalendarPane .sapUiCal {
124
+ background: transparent;
125
+ }
126
+
127
+ .bizDpHint.sapMText {
128
+ max-width: 19rem;
129
+ padding: 0.25rem 0.5rem 0.25rem;
130
+ color: #6a7b8f;
131
+ font-size: 0.75rem;
132
+ }
133
+
134
+ .bizDpFooter.sapMTB {
135
+ height: 3rem;
136
+ padding: 0 0.75rem;
137
+ border-top: 1px solid #e3e9f0;
138
+ background: #ffffff;
139
+ }
140
+
141
+ .bizDpSummaryIcon {
142
+ color: #0064d9;
143
+ font-size: 1rem;
144
+ }
145
+
146
+ .bizDpSummary.sapMText {
147
+ color: #182737;
148
+ font-size: 0.8125rem;
149
+ font-weight: 600;
150
+ }
151
+
152
+ /* Phone / narrow: stack presets above the calendar, presets as a wrapping grid */
153
+ @media (max-width: 599px) {
154
+ .bizDpBody {
155
+ flex-direction: column;
156
+ }
157
+
158
+ .bizDpPresets {
159
+ width: 100%;
160
+ border-right: none;
161
+ border-bottom: 1px solid #e3e9f0;
162
+ }
163
+
164
+ .bizDpPresetList .sapMListUl {
165
+ display: grid;
166
+ grid-template-columns: 1fr 1fr;
167
+ column-gap: 0.25rem;
168
+ }
169
+
170
+ .bizDpCalendarPane {
171
+ align-items: center;
172
+ }
173
+
174
+ .bizDpFooter .sapMText.bizDpSummary {
175
+ white-space: normal;
176
+ font-size: 0.75rem;
177
+ }
178
+ }
179
+
180
+ /* Range in the picker calendar: one soft band, solid start / end days */
181
+ .bizDpCalendarPane .sapUiCalItem.sapUiCalItemSel {
182
+ box-shadow: none;
183
+ }
184
+
185
+ .bizDpCalendarPane .sapUiCalItem.sapUiCalItemSelBetween {
186
+ background: #e8f0fa;
187
+ border-color: #e8f0fa;
188
+ border-radius: 0;
189
+ }
190
+
191
+ .bizDpCalendarPane .sapUiCalItem.sapUiCalItemSelBetween .sapUiCalItemText {
192
+ color: #0b3d68;
193
+ }
194
+
195
+ .bizDpCalendarPane .sapUiCalItem.sapUiCalItemSelStart,
196
+ .bizDpCalendarPane .sapUiCalItem.sapUiCalItemSelEnd {
197
+ background: #e8f0fa;
198
+ border-color: #e8f0fa;
199
+ }
200
+
201
+ .bizDpCalendarPane .sapUiCalItem.sapUiCalItemSelStart {
202
+ border-radius: 0.5rem 0 0 0.5rem;
203
+ }
204
+
205
+ .bizDpCalendarPane .sapUiCalItem.sapUiCalItemSelEnd {
206
+ border-radius: 0 0.5rem 0.5rem 0;
207
+ }
208
+
209
+ .bizDpCalendarPane .sapUiCalItem.sapUiCalItemSelStart.sapUiCalItemSelEnd,
210
+ .bizDpCalendarPane .sapUiCalItem.sapUiCalItemSel:not(.sapUiCalItemSelStart):not(.sapUiCalItemSelEnd):not(.sapUiCalItemSelBetween) {
211
+ border-radius: 0.5rem;
212
+ }
213
+
214
+ .bizDpCalendarPane .sapUiCalItem.sapUiCalItemSelStart .sapUiCalItemText,
215
+ .bizDpCalendarPane .sapUiCalItem.sapUiCalItemSelEnd .sapUiCalItemText,
216
+ .bizDpCalendarPane .sapUiCalItem.sapUiCalItemSel:not(.sapUiCalItemSelBetween) .sapUiCalItemText {
217
+ background: #0064d9;
218
+ color: #ffffff;
219
+ font-weight: 700;
220
+ }
221
+
222
+ /* Horizon draws a blue outline on each selected day; drop it inside the band */
223
+ .bizDpCalendarPane .sapUiCalItem.sapUiCalItemSel .sapUiCalItemText::before {
224
+ border-color: transparent !important;
225
+ }
226
+
227
+ /* Keep the number readable on the solid start / end day (theme hover/focus recolours it) */
228
+ .bizDpCalendarPane .sapUiCalItem.sapUiCalItemSel:not(.sapUiCalItemSelBetween) .sapUiCalItemText,
229
+ .bizDpCalendarPane .sapUiCalItem.sapUiCalItemSel:not(.sapUiCalItemSelBetween):hover .sapUiCalItemText {
230
+ background: #0064d9 !important;
231
+ color: #ffffff !important;
232
+ }
233
+
234
+ /* Control wrapper */
235
+ .bizDatePeriodPicker {
236
+ display: block;
237
+ box-sizing: border-box;
238
+ }
package/package.json CHANGED
@@ -1,6 +1,35 @@
1
1
  {
2
2
  "name": "@bizd/daterange",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "1.1.0",
4
+ "description": "SAPUI5 date / period picker (bizd.daterange.DatePeriodPicker): presets + range calendar in one field. Install from npm or load from jsDelivr.",
5
+ "license": "UNLICENSED",
6
+ "keywords": [
7
+ "ui5",
8
+ "sapui5",
9
+ "openui5",
10
+ "ui5-library",
11
+ "date-range-picker",
12
+ "date-period"
13
+ ],
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "git+https://github.com/vanna96/bizd-daterange.git"
17
+ },
18
+ "files": [
19
+ "dist/resources/",
20
+ "src/",
21
+ "ui5.yaml",
22
+ "README.md"
23
+ ],
24
+ "scripts": {
25
+ "start": "ui5 serve -o test-resources/bizd/daterange/DatePeriodPicker.html",
26
+ "build": "ui5 build --clean-dest --dest dist",
27
+ "sync:app": "node scripts/sync-app.js ../Biz-Service-App/webapp"
28
+ },
29
+ "publishConfig": {
30
+ "access": "public"
31
+ },
32
+ "devDependencies": {
33
+ "@ui5/cli": "^3.11.13"
34
+ }
35
+ }
@@ -0,0 +1,28 @@
1
+ <?xml version="1.0" encoding="UTF-8" ?>
2
+ <library xmlns="http://www.sap.com/sap.ui.library.xsd">
3
+
4
+ <name>bizd.daterange</name>
5
+ <vendor>Bizdimension Co., Ltd.</vendor>
6
+ <version>${version}</version>
7
+
8
+ <documentation>SAPUI5 date / period picker (DatePeriodPicker)</documentation>
9
+
10
+ <dependencies>
11
+ <dependency>
12
+ <libraryName>sap.ui.core</libraryName>
13
+ </dependency>
14
+ <dependency>
15
+ <libraryName>sap.m</libraryName>
16
+ </dependency>
17
+ <dependency>
18
+ <libraryName>sap.ui.unified</libraryName>
19
+ </dependency>
20
+ </dependencies>
21
+
22
+ <appData>
23
+ <manifest xmlns="http://www.sap.com/ui5/buildext/manifest">
24
+ <i18n>messagebundle.properties</i18n>
25
+ </manifest>
26
+ </appData>
27
+
28
+ </library>
@@ -0,0 +1,195 @@
1
+ /**
2
+ * bizd.daterange.DatePeriodPicker — date / period filter as one XML tag.
3
+ *
4
+ * A read-only field that opens a two-panel popup: quick presets (Today, This Week,
5
+ * This Month, ... Last Year) on the left, a range calendar on the right, and
6
+ * Clear / Cancel / Apply in the footer. Optional quick chips under the field.
7
+ *
8
+ * ── Usage ────────────────────────────────────────────────────────────────
9
+ * <mvc:View ... xmlns:dr="bizd.daterange">
10
+ * <m:Label text="Date" labelFor="datePicker"/>
11
+ * <dr:DatePeriodPicker id="datePicker"/>
12
+ *
13
+ * var oPicker = this.byId("datePicker");
14
+ * oPicker.getRange(); // { from: "2026-11-01", to: "2026-11-30" } in valueFormat ("" when empty)
15
+ * oPicker.getISORange(); // { from: "2026-11-01", to: "2026-11-30" }
16
+ * oPicker.isEmpty(); // true → no date filter
17
+ * oPicker.clear(); oPicker.setPreset("LASTMONTH"); oPicker.setRange(oFrom, oTo); oPicker.open();
18
+ *
19
+ * <dr:DatePeriodPicker change=".onDateChange"/>
20
+ * onDateChange: function (oEvent) {
21
+ * oEvent.getParameter("from"); oEvent.getParameter("to"); // Date | null
22
+ * oEvent.getParameter("preset"); oEvent.getParameter("text");
23
+ * }
24
+ *
25
+ * ── Properties ───────────────────────────────────────────────────────────
26
+ * width CSSSize default "100%"
27
+ * initialPreset string preset applied on creation, e.g. "THISMONTH" (no change event)
28
+ * presets string[] presets offered in the popup, default all (DatePeriodPicker.PRESET_KEYS)
29
+ * displayFormat string format shown in the field, default "MM/dd/yyyy"
30
+ * valueFormat string format returned by getRange(), default "yyyy-MM-dd"
31
+ * e.g. displayFormat="dd, MMM yyyy" valueFormat="MM/dd/yyyy"
32
+ * pattern string older name for displayFormat (still works)
33
+ * placeholder string default "Any date — pick a period or a date"
34
+ * showChips boolean default false — quick chips under the field
35
+ * chipPresets string[] chips shown when showChips="true"
36
+ *
37
+ * In XML, string[] properties take a comma list: presets="TODAY,THISWEEK,THISMONTH"
38
+ * Full guide: README.md of the @bizd/daterange package
39
+ */
40
+ sap.ui.define([
41
+ "./library",
42
+ "sap/ui/core/Control",
43
+ "sap/ui/core/Lib",
44
+ "sap/m/Input",
45
+ "sap/m/HBox",
46
+ "./DatePeriodPickerEngine"
47
+ ], function (library, Control, Lib, Input, HBox, Engine) {
48
+ "use strict";
49
+
50
+ var DatePeriodPicker = Control.extend("bizd.daterange.DatePeriodPicker", {
51
+ metadata: {
52
+ library: "bizd.daterange",
53
+ properties: {
54
+ width: { type: "sap.ui.core.CSSSize", defaultValue: "100%" },
55
+ initialPreset: { type: "string", defaultValue: "" },
56
+ presets: { type: "string[]", defaultValue: null },
57
+ displayFormat: { type: "string", defaultValue: "" },
58
+ valueFormat: { type: "string", defaultValue: "yyyy-MM-dd" },
59
+ pattern: { type: "string", defaultValue: "MM/dd/yyyy" },
60
+ placeholder: { type: "string", defaultValue: "" },
61
+ showChips: { type: "boolean", defaultValue: false },
62
+ chipPresets: { type: "string[]", defaultValue: null }
63
+ },
64
+ aggregations: {
65
+ _input: { type: "sap.m.Input", multiple: false, visibility: "hidden" },
66
+ _chips: { type: "sap.m.HBox", multiple: false, visibility: "hidden" }
67
+ },
68
+ events: {
69
+ /** Fired after every date change (Apply, Clear, chip, setPreset / setRange / clear). */
70
+ change: {
71
+ parameters: {
72
+ preset: { type: "string" },
73
+ from: { type: "object" },
74
+ to: { type: "object" },
75
+ text: { type: "string" }
76
+ }
77
+ }
78
+ }
79
+ },
80
+
81
+ renderer: {
82
+ apiVersion: 2,
83
+ render: function (oRm, oControl) {
84
+ oRm.openStart("div", oControl);
85
+ oRm.class("bizDatePeriodPicker");
86
+ oRm.style("width", oControl.getWidth());
87
+ oRm.openEnd();
88
+ oRm.renderControl(oControl.getAggregation("_input"));
89
+ if (oControl.getShowChips()) {
90
+ oRm.renderControl(oControl.getAggregation("_chips"));
91
+ }
92
+ oRm.close("div");
93
+ }
94
+ },
95
+
96
+ init: function () {
97
+ this.setAggregation("_input", new Input(this.getId() + "-input", { width: "100%" }));
98
+ this.setAggregation("_chips", new HBox(this.getId() + "-chips"));
99
+ },
100
+
101
+ // Set up the field before the first render (settings from XML are applied by now)
102
+ onBeforeRendering: function () {
103
+ this._getEngine();
104
+ },
105
+
106
+ exit: function () {
107
+ if (this._oEngine) {
108
+ this._oEngine.destroy();
109
+ this._oEngine = null;
110
+ }
111
+ },
112
+
113
+ // A <Label labelFor="..."> on this control points at the inner field
114
+ getIdForLabel: function () {
115
+ return this.getAggregation("_input").getIdForLabel();
116
+ },
117
+
118
+ // ── Public API ────────────────────────────────────────────────────────
119
+ /** @returns {{preset: string, from: Date|null, to: Date|null, text: string}} */
120
+ getValue: function () { return this._getEngine().getValue(); },
121
+ /** @returns {{from: string, to: string}} formatted with valueFormat (default "yyyy-MM-dd"), "" when empty */
122
+ getRange: function () { return this._getEngine().getRange(); },
123
+ /** @returns {{from: string, to: string}} as "yyyy-MM-dd", "" when empty */
124
+ getISORange: function () { return this._getEngine().getISORange(); },
125
+ /** @returns {boolean} true when no date is chosen */
126
+ isEmpty: function () { return this._getEngine().isEmpty(); },
127
+ setPreset: function (sPreset) { this._getEngine().setPreset(sPreset); return this; },
128
+ setRange: function (oFrom, oTo) { this._getEngine().setRange(oFrom, oTo); return this; },
129
+ clear: function () { this._getEngine().clear(); return this; },
130
+ open: function () { this._getEngine().open(); return this; },
131
+
132
+ // ── Settings that shape the popup / chips: rebuild, keep the current date ──
133
+ setPresets: function (a) { return this._setAndRebuild("presets", a); },
134
+ setPattern: function (s) { return this._setAndRebuild("pattern", s); },
135
+ setDisplayFormat: function (s) { return this._setAndRebuild("displayFormat", s); },
136
+ setValueFormat: function (s) { return this._setAndRebuild("valueFormat", s); },
137
+ setShowChips: function (b) { return this._setAndRebuild("showChips", !!b); },
138
+ setChipPresets: function (a) { return this._setAndRebuild("chipPresets", a); },
139
+ setPlaceholder: function (s) {
140
+ this.setProperty("placeholder", s, true);
141
+ this.getAggregation("_input").setPlaceholder(
142
+ s || Lib.getResourceBundleFor("bizd.daterange").getText("DPP_PLACEHOLDER"));
143
+ return this;
144
+ },
145
+ setInitialPreset: function (s) {
146
+ this.setProperty("initialPreset", s, true);
147
+ if (this._oEngine && s && this._oEngine.isEmpty()) {
148
+ this._oEngine.setPreset(s, true);
149
+ }
150
+ return this;
151
+ },
152
+
153
+ _setAndRebuild: function (sName, vValue) {
154
+ // showChips changes the DOM → re-render; the others only rebuild the popup
155
+ this.setProperty(sName, vValue, sName !== "showChips");
156
+ if (this._oEngine) {
157
+ var oValue = this._oEngine.getValue();
158
+ this._oEngine.destroy();
159
+ this._oEngine = null;
160
+ this._getEngine(oValue.from ? oValue : null);
161
+ }
162
+ return this;
163
+ },
164
+
165
+ _getEngine: function (oKeepValue) {
166
+ if (this._oEngine) return this._oEngine;
167
+
168
+ var oInitial = oKeepValue
169
+ ? (oKeepValue.preset ? { preset: oKeepValue.preset } : { from: oKeepValue.from, to: oKeepValue.to })
170
+ : (this.getInitialPreset() ? { preset: this.getInitialPreset() } : null);
171
+
172
+ this._oEngine = Engine.create({
173
+ input: this.getAggregation("_input"),
174
+ chips: this.getShowChips() ? this.getAggregation("_chips") : null,
175
+ presets: this.getPresets() || undefined,
176
+ chipPresets: this.getChipPresets() || undefined,
177
+ pattern: this.getPattern(),
178
+ displayFormat: this.getDisplayFormat() || undefined,
179
+ valueFormat: this.getValueFormat() || undefined,
180
+ placeholder: this.getPlaceholder() || undefined,
181
+ value: oInitial,
182
+ change: function (oValue) { this.fireChange(oValue); }.bind(this)
183
+ });
184
+ return this._oEngine;
185
+ }
186
+ });
187
+
188
+ /** First and last day of a preset, e.g. DatePeriodPicker.resolvePreset("THISMONTH") → { from, to } */
189
+ DatePeriodPicker.resolvePreset = Engine.resolvePreset;
190
+
191
+ /** All preset keys: TODAY, YESTERDAY, THISWEEK, LASTWEEK, THISMONTH, LASTMONTH, THISQUARTER, LASTQUARTER, THISYEAR, LASTYEAR */
192
+ DatePeriodPicker.PRESET_KEYS = Engine.PRESET_KEYS;
193
+
194
+ return DatePeriodPicker;
195
+ });