@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,373 @@
1
+ /**
2
+ * bizd.daterange.DatePeriodPickerEngine — the logic behind bizd.daterange.DatePeriodPicker.
3
+ *
4
+ * Turns any sap.m.Input into the date-period field (read-only field + two-panel popup:
5
+ * quick presets left, range calendar right, Clear / Cancel / Apply) and optionally
6
+ * fills an HBox with quick chips. Most pages should use the control instead:
7
+ *
8
+ * <dr:DatePeriodPicker id="datePicker"/>
9
+ *
10
+ * Direct use (only when a tag does not fit, e.g. an Input you create in code):
11
+ *
12
+ * sap.ui.require(["bizd/daterange/DatePeriodPickerEngine"], function (Engine) {
13
+ * var oEngine = Engine.create({ input: oInput, chips: oHBox, change: fnChange });
14
+ * oEngine.getRange(); // { from: "2026-11-01", to: "2026-11-30" }
15
+ * });
16
+ *
17
+ * Options: input (required), chips, presets, chipPresets, placeholder,
18
+ * displayFormat (field text, default "MM/dd/yyyy"; `pattern` is the older name),
19
+ * valueFormat (getRange() output, default "yyyy-MM-dd"),
20
+ * value ({ preset } or { from, to }), change(fn)
21
+ * Methods: getValue, getRange, getISORange, isEmpty, setPreset, setRange, clear, open, destroy
22
+ */
23
+ sap.ui.define([
24
+ "sap/ui/base/Object",
25
+ "sap/ui/core/Lib",
26
+ "sap/ui/model/json/JSONModel",
27
+ "sap/ui/core/format/DateFormat",
28
+ "sap/m/DynamicDateRange",
29
+ "sap/m/Popover",
30
+ "sap/m/HBox",
31
+ "sap/m/VBox",
32
+ "sap/m/Text",
33
+ "sap/m/List",
34
+ "sap/m/StandardListItem",
35
+ "sap/m/Toolbar",
36
+ "sap/m/ToolbarSpacer",
37
+ "sap/m/Button",
38
+ "sap/m/ToggleButton",
39
+ "sap/ui/core/Icon",
40
+ "sap/ui/unified/Calendar",
41
+ "sap/ui/unified/DateRange"
42
+ ], function (BaseObject, Lib, JSONModel, DateFormat, DynamicDateRange, Popover, HBox, VBox, Text,
43
+ List, StandardListItem, Toolbar, ToolbarSpacer, Button, ToggleButton, Icon, Calendar, DateRange) {
44
+ "use strict";
45
+
46
+ // Keys are DynamicDateRange operators, so DynamicDateRange.toDates() resolves them.
47
+ var PRESET_KEYS = [
48
+ "TODAY", "YESTERDAY",
49
+ "THISWEEK", "LASTWEEK",
50
+ "THISMONTH", "LASTMONTH",
51
+ "THISQUARTER", "LASTQUARTER",
52
+ "THISYEAR", "LASTYEAR"
53
+ ];
54
+ var DEFAULT_CHIPS = ["TODAY", "THISWEEK", "THISMONTH", "LASTMONTH", "THISYEAR"];
55
+ var MODEL = "dpp";
56
+
57
+ var oBundle;
58
+ function text(sKey, aArgs) {
59
+ oBundle = oBundle || Lib.getResourceBundleFor("bizd.daterange");
60
+ return oBundle.getText(sKey, aArgs);
61
+ }
62
+ function presetText(sKey) {
63
+ return PRESET_KEYS.indexOf(sKey) !== -1 ? text("DPP_" + sKey) : "";
64
+ }
65
+
66
+ var oISOFormat = DateFormat.getDateInstance({ pattern: "yyyy-MM-dd" });
67
+
68
+ // Strip the time part (and unwrap UniversalDate)
69
+ function dayOnly(d) {
70
+ if (d && typeof d.getJSDate === "function") d = d.getJSDate();
71
+ return d ? new Date(d.getFullYear(), d.getMonth(), d.getDate()) : null;
72
+ }
73
+
74
+ var Engine = BaseObject.extend("bizd.daterange.DatePeriodPickerEngine", {
75
+
76
+ constructor: function (mOptions) {
77
+ BaseObject.call(this);
78
+ if (!mOptions || !mOptions.input) {
79
+ throw new Error("bizd.daterange.DatePeriodPickerEngine: 'input' (sap.m.Input) is required");
80
+ }
81
+ this._oInput = mOptions.input;
82
+ this._oChips = mOptions.chips || null;
83
+ this._fnChange = mOptions.change || null;
84
+ // displayFormat: what the field shows. valueFormat: what getRange() returns.
85
+ this._oFormat = DateFormat.getDateInstance({
86
+ pattern: mOptions.displayFormat || mOptions.pattern || "MM/dd/yyyy"
87
+ });
88
+ this._oValueFormat = DateFormat.getDateInstance({
89
+ pattern: mOptions.valueFormat || "yyyy-MM-dd"
90
+ });
91
+
92
+ var aPresetKeys = mOptions.presets || PRESET_KEYS;
93
+ this._aChipKeys = mOptions.chipPresets || DEFAULT_CHIPS;
94
+ this._oValue = { preset: "", from: null, to: null, text: "" };
95
+
96
+ this._oModel = new JSONModel({
97
+ presets: PRESET_KEYS
98
+ .filter(function (k) { return aPresetKeys.indexOf(k) !== -1; })
99
+ .map(function (k) { return { key: k, text: presetText(k) }; }),
100
+ draft: { preset: "", from: null, to: null, text: "" }
101
+ });
102
+
103
+ this._setupInput(mOptions.placeholder);
104
+ this._buildChips();
105
+
106
+ if (mOptions.value) {
107
+ if (mOptions.value.preset) {
108
+ this.setPreset(mOptions.value.preset, true);
109
+ } else {
110
+ this.setRange(mOptions.value.from, mOptions.value.to, true);
111
+ }
112
+ }
113
+ },
114
+
115
+ // ── Public API ────────────────────────────────────────────────────────
116
+ getValue: function () {
117
+ return Object.assign({}, this._oValue);
118
+ },
119
+
120
+ // Formatted with valueFormat (default "yyyy-MM-dd")
121
+ getRange: function () {
122
+ var v = this._oValue, f = this._oValueFormat;
123
+ return { from: v.from ? f.format(v.from) : "", to: v.to ? f.format(v.to) : "" };
124
+ },
125
+
126
+ getISORange: function () {
127
+ var v = this._oValue;
128
+ return { from: v.from ? oISOFormat.format(v.from) : "", to: v.to ? oISOFormat.format(v.to) : "" };
129
+ },
130
+
131
+ isEmpty: function () {
132
+ return !this._oValue.from;
133
+ },
134
+
135
+ setPreset: function (sPreset, bSilent) {
136
+ var oDates = Engine.resolvePreset(sPreset);
137
+ this._commit(sPreset, oDates.from, oDates.to, bSilent);
138
+ },
139
+
140
+ setRange: function (oFrom, oTo, bSilent) {
141
+ this._commit("", dayOnly(oFrom), dayOnly(oTo), bSilent);
142
+ },
143
+
144
+ clear: function (bSilent) {
145
+ this._commit("", null, null, bSilent);
146
+ },
147
+
148
+ open: function () {
149
+ var oPopover = this._getPopover();
150
+ var v = this._oValue;
151
+ this._setDraft(v.preset, v.from, v.to);
152
+ this._syncPopover();
153
+ oPopover.openBy(this._oInput);
154
+ },
155
+
156
+ destroy: function () {
157
+ if (this._oPopover) { this._oPopover.destroy(); this._oPopover = null; }
158
+ if (this._oChips && !this._oChips.isDestroyed()) { this._oChips.destroyItems(); }
159
+ if (this._oInput && !this._oInput.isDestroyed()) {
160
+ this._oInput.detachValueHelpRequest(this.open, this);
161
+ }
162
+ this._oModel.destroy();
163
+ BaseObject.prototype.destroy.apply(this, arguments);
164
+ },
165
+
166
+ // ── Field + chips ─────────────────────────────────────────────────────
167
+ _setupInput: function (sPlaceholder) {
168
+ var oInput = this._oInput;
169
+ oInput.setShowValueHelp(true);
170
+ oInput.setValueHelpOnly(true);
171
+ oInput.setValueHelpIconSrc("sap-icon://calendar");
172
+ if (sPlaceholder || !oInput.getPlaceholder()) {
173
+ oInput.setPlaceholder(sPlaceholder || text("DPP_PLACEHOLDER"));
174
+ }
175
+ oInput.setValue("");
176
+ oInput.attachValueHelpRequest(this.open, this);
177
+ },
178
+
179
+ _buildChips: function () {
180
+ if (!this._oChips) return;
181
+ var that = this;
182
+ this._oChips.addStyleClass("bizDateChips");
183
+ if (this._oChips.setWrap) this._oChips.setWrap("Wrap");
184
+ this._oChips.destroyItems();
185
+ this._aChipKeys.forEach(function (sKey) {
186
+ that._oChips.addItem(new ToggleButton({
187
+ text: presetText(sKey) || sKey,
188
+ press: function () {
189
+ // Pressing the active chip again clears the date
190
+ if (that._oValue.preset === sKey) {
191
+ that.clear();
192
+ } else {
193
+ that.setPreset(sKey);
194
+ }
195
+ }
196
+ }).data("preset", sKey));
197
+ });
198
+ },
199
+
200
+ _refreshChips: function () {
201
+ if (!this._oChips) return;
202
+ var sPreset = this._oValue.preset;
203
+ this._oChips.getItems().forEach(function (oChip) {
204
+ oChip.setPressed(oChip.data("preset") === sPreset);
205
+ });
206
+ },
207
+
208
+ // Store a value, update the field and chips, notify
209
+ _commit: function (sPreset, oFrom, oTo, bSilent) {
210
+ oFrom = oFrom || null;
211
+ oTo = oFrom ? (oTo || oFrom) : null;
212
+ this._oValue = { preset: sPreset || "", from: oFrom, to: oTo, text: this._text(sPreset, oFrom, oTo) };
213
+ this._oInput.setValue(this._oValue.text);
214
+ this._refreshChips();
215
+ if (!bSilent && this._fnChange) {
216
+ this._fnChange(this.getValue());
217
+ }
218
+ },
219
+
220
+ // ── Formatting ────────────────────────────────────────────────────────
221
+ _fmt: function (d) {
222
+ return d ? this._oFormat.format(d) : "";
223
+ },
224
+
225
+ // "This Month (11/01/2026 – 11/30/2026)", "11/03/2026 – 11/09/2026" or "11/05/2026"
226
+ _text: function (sPreset, oFrom, oTo) {
227
+ if (!oFrom) return "";
228
+ var sRange = this._fmt(oFrom);
229
+ if (oTo && oTo.getTime() !== oFrom.getTime()) sRange += " – " + this._fmt(oTo);
230
+ var sName = presetText(sPreset);
231
+ return sName ? sName + " (" + sRange + ")" : sRange;
232
+ },
233
+
234
+ // ── Popup ─────────────────────────────────────────────────────────────
235
+ _getPopover: function () {
236
+ if (this._oPopover) return this._oPopover;
237
+ var that = this;
238
+
239
+ this._oList = new List({
240
+ mode: "SingleSelectMaster",
241
+ showSeparators: "None",
242
+ includeItemInSelection: true,
243
+ selectionChange: this._onPresetSelect.bind(this),
244
+ items: {
245
+ path: MODEL + ">/presets",
246
+ template: new StandardListItem({ title: "{" + MODEL + ">text}" })
247
+ }
248
+ }).addStyleClass("bizDpPresetList");
249
+
250
+ this._oCalendar = new Calendar({
251
+ intervalSelection: true,
252
+ showWeekNumbers: false,
253
+ select: this._onCalendarSelect.bind(this)
254
+ });
255
+
256
+ this._oPopover = new Popover({
257
+ showHeader: false,
258
+ placement: "Bottom",
259
+ contentWidth: "auto",
260
+ initialFocus: this._oCalendar,
261
+ content: [
262
+ new HBox({ renderType: "Bare", items: [
263
+ new VBox({ renderType: "Bare", items: [
264
+ new Text({ text: text("DPP_QUICK_SELECT") }).addStyleClass("bizDpPresetsTitle"),
265
+ this._oList
266
+ ]}).addStyleClass("bizDpPresets"),
267
+ new VBox({ renderType: "Bare", items: [
268
+ this._oCalendar,
269
+ new Text({ text: text("DPP_HINT") }).addStyleClass("bizDpHint")
270
+ ]}).addStyleClass("bizDpCalendarPane")
271
+ ]}).addStyleClass("bizDpBody")
272
+ ],
273
+ footer: new Toolbar({ content: [
274
+ new Icon({ src: "sap-icon://appointment-2" }).addStyleClass("bizDpSummaryIcon"),
275
+ new Text({
276
+ text: {
277
+ path: MODEL + ">/draft/text",
278
+ formatter: function (s) { return s || text("DPP_NO_DATE"); }
279
+ }
280
+ }).addStyleClass("bizDpSummary"),
281
+ new ToolbarSpacer(),
282
+ new Button({ text: text("DPP_CLEAR"), type: "Transparent", press: function () {
283
+ that.clear();
284
+ that._oPopover.close();
285
+ }}),
286
+ new Button({ text: text("DPP_CANCEL"), type: "Transparent", press: function () {
287
+ that._oPopover.close();
288
+ }}),
289
+ new Button({ text: text("DPP_APPLY"), type: "Emphasized",
290
+ enabled: "{= !!${" + MODEL + ">/draft/from} }",
291
+ press: function () {
292
+ var d = that._oModel.getProperty("/draft");
293
+ that._commit(d.preset, d.from, d.to || d.from);
294
+ that._oPopover.close();
295
+ }
296
+ })
297
+ ]}).addStyleClass("bizDpFooter")
298
+ }).addStyleClass("bizDpPopover");
299
+
300
+ this._oPopover.setModel(this._oModel, MODEL);
301
+ // Destroyed together with the input's view
302
+ this._oInput.addDependent(this._oPopover);
303
+ return this._oPopover;
304
+ },
305
+
306
+ _setDraft: function (sPreset, oFrom, oTo) {
307
+ var bOpenEnd = oFrom && !oTo; // start picked, end not yet
308
+ this._oModel.setProperty("/draft", {
309
+ preset: sPreset || "",
310
+ from: oFrom || null,
311
+ to: oTo || null,
312
+ text: bOpenEnd ? text("DPP_PICK_END", [this._fmt(oFrom)]) : this._text(sPreset, oFrom, oTo)
313
+ });
314
+ },
315
+
316
+ // Mirror the draft in the preset list and the calendar
317
+ _syncPopover: function () {
318
+ var oDraft = this._oModel.getProperty("/draft");
319
+ var oList = this._oList;
320
+
321
+ oList.removeSelections(true);
322
+ oList.getItems().forEach(function (oItem) {
323
+ if (oItem.getBindingContext(MODEL).getProperty("key") === oDraft.preset) {
324
+ oList.setSelectedItem(oItem, true);
325
+ }
326
+ });
327
+
328
+ var oCal = this._oCalendar;
329
+ oCal.removeAllSelectedDates();
330
+ if (oDraft.from) {
331
+ oCal.addSelectedDate(new DateRange({ startDate: oDraft.from, endDate: oDraft.to || undefined }));
332
+ }
333
+ // Show the month with today if it is inside the range, else the start month
334
+ var oToday = dayOnly(new Date());
335
+ var bTodayIn = oDraft.from && oToday >= oDraft.from && oToday <= (oDraft.to || oDraft.from);
336
+ oCal.focusDate(!oDraft.from || bTodayIn ? oToday : oDraft.from);
337
+ },
338
+
339
+ _onPresetSelect: function (oEvent) {
340
+ var sPreset = oEvent.getParameter("listItem").getBindingContext(MODEL).getProperty("key");
341
+ var oDates = Engine.resolvePreset(sPreset);
342
+ this._setDraft(sPreset, oDates.from, oDates.to);
343
+ this._syncPopover();
344
+ },
345
+
346
+ _onCalendarSelect: function () {
347
+ var oRange = this._oCalendar.getSelectedDates()[0];
348
+ this._setDraft("", oRange ? dayOnly(oRange.getStartDate()) : null,
349
+ oRange ? dayOnly(oRange.getEndDate()) : null); // custom → no preset
350
+ this._oList.removeSelections(true);
351
+ }
352
+ });
353
+
354
+ // ── Static helpers ────────────────────────────────────────────────────────
355
+
356
+ /** Create an engine (same as `new Engine(mOptions)`). */
357
+ Engine.create = function (mOptions) {
358
+ return new Engine(mOptions);
359
+ };
360
+
361
+ /** First and last day of a preset key, e.g. "THISMONTH" → { from: Date, to: Date } */
362
+ Engine.resolvePreset = function (sPreset) {
363
+ var aDates = DynamicDateRange.toDates({ operator: sPreset, values: [] }) || [];
364
+ var oFrom = dayOnly(aDates[0]);
365
+ var oTo = dayOnly(aDates[aDates.length - 1]) || oFrom;
366
+ return { from: oFrom, to: oTo };
367
+ };
368
+
369
+ /** Preset keys in display order. */
370
+ Engine.PRESET_KEYS = PRESET_KEYS.slice();
371
+
372
+ return Engine;
373
+ });
@@ -0,0 +1,42 @@
1
+ /**
2
+ * bizd.daterange — SAPUI5 date / period picker library (github.com/vanna96/bizd-daterange).
3
+ *
4
+ * Load it from the CDN by mapping the namespace in the app's UI5 bootstrap:
5
+ *
6
+ * data-sap-ui-resourceroots='{"bizd.daterange": "https://cdn.jsdelivr.net/gh/vanna96/bizd-daterange@1.0.0/dist/resources/bizd/daterange"}'
7
+ *
8
+ * then use it in any view with only the XML namespace:
9
+ *
10
+ * <mvc:View ... xmlns:dr="bizd.daterange">
11
+ * <dr:DatePeriodPicker id="datePicker"/>
12
+ *
13
+ * Each control requires "./library", so the first control used on a page initialises
14
+ * the library and loads its theme CSS and texts. See README.md.
15
+ */
16
+ sap.ui.define([
17
+ "sap/ui/core/Lib",
18
+ "sap/ui/core/library",
19
+ "sap/m/library",
20
+ "sap/ui/unified/library"
21
+ ], function (Lib) {
22
+ "use strict";
23
+
24
+ /**
25
+ * @namespace
26
+ * @alias bizd.daterange
27
+ */
28
+ var thisLib = Lib.init({
29
+ apiVersion: 2,
30
+ name: "bizd.daterange",
31
+ version: "${version}",
32
+ dependencies: ["sap.ui.core", "sap.m", "sap.ui.unified"],
33
+ types: [],
34
+ interfaces: [],
35
+ controls: [
36
+ "bizd.daterange.DatePeriodPicker"
37
+ ],
38
+ elements: []
39
+ });
40
+
41
+ return thisLib;
42
+ });
@@ -0,0 +1,23 @@
1
+ # bizd.daterange — texts (English, default)
2
+
3
+ # DatePeriodPicker: preset names
4
+ DPP_TODAY=Today
5
+ DPP_YESTERDAY=Yesterday
6
+ DPP_THISWEEK=This Week
7
+ DPP_LASTWEEK=Last Week
8
+ DPP_THISMONTH=This Month
9
+ DPP_LASTMONTH=Last Month
10
+ DPP_THISQUARTER=This Quarter
11
+ DPP_LASTQUARTER=Last Quarter
12
+ DPP_THISYEAR=This Year
13
+ DPP_LASTYEAR=Last Year
14
+
15
+ # DatePeriodPicker: field and popup
16
+ DPP_PLACEHOLDER=Any date — pick a period or a date
17
+ DPP_QUICK_SELECT=Quick select
18
+ DPP_HINT=Click a start date, then an end date. For a single day, click it once and Apply.
19
+ DPP_NO_DATE=No date selected — all dates
20
+ DPP_PICK_END={0} – pick an end date (or Apply for one day)
21
+ DPP_CLEAR=Clear
22
+ DPP_CANCEL=Cancel
23
+ DPP_APPLY=Apply
@@ -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/ui5.yaml ADDED
@@ -0,0 +1,12 @@
1
+ specVersion: "3.0"
2
+ metadata:
3
+ name: bizd.daterange
4
+ type: library
5
+ framework:
6
+ name: SAPUI5
7
+ version: "1.124.0"
8
+ libraries:
9
+ - name: sap.ui.core
10
+ - name: sap.m
11
+ - name: sap.ui.unified
12
+ - name: themelib_sap_horizon