@vritti/quantum-ui 0.6.4 → 0.6.6
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/dist/Badge2.js +2 -0
- package/dist/Badge2.js.map +1 -1
- package/dist/ChartFrame.js +1 -1
- package/dist/ChartFrame.js.map +1 -1
- package/dist/CurrencyFieldFilter.js +53 -27
- package/dist/CurrencyFieldFilter.js.map +1 -1
- package/dist/CurrencySelector.js.map +1 -1
- package/dist/DateRangePicker.js +1 -1
- package/dist/DateTimePicker.js +1 -1
- package/dist/DropdownMenu.js +64 -33
- package/dist/DropdownMenu.js.map +1 -1
- package/dist/ISOCountrySelect.js.map +1 -1
- package/dist/LocaleSelector.js.map +1 -1
- package/dist/Progress.js +31 -4
- package/dist/Progress.js.map +1 -1
- package/dist/QuantityField.js +190 -0
- package/dist/QuantityField.js.map +1 -0
- package/dist/SegmentedProgressKey.js +65 -0
- package/dist/SegmentedProgressKey.js.map +1 -0
- package/dist/Select.js +47 -13
- package/dist/Select.js.map +1 -1
- package/dist/SelectFilter.js +19 -3
- package/dist/SelectFilter.js.map +1 -1
- package/dist/Sidebar.js +1 -1
- package/dist/SingleSelect.js +24 -6
- package/dist/SingleSelect.js.map +1 -1
- package/dist/Spinner.js +1 -7
- package/dist/Spinner.js.map +1 -1
- package/dist/Spinner2.js +10 -0
- package/dist/Spinner2.js.map +1 -0
- package/dist/StepProgressIndicator.js +49 -28
- package/dist/StepProgressIndicator.js.map +1 -1
- package/dist/SwitchFilter.js +80 -0
- package/dist/SwitchFilter.js.map +1 -0
- package/dist/TimezoneSelector.js.map +1 -1
- package/dist/ValueFilter.js +2 -2
- package/dist/ValueFilter.js.map +1 -1
- package/dist/assets/quantum-ui.css +260 -4
- package/dist/calendar2.js +1 -1
- package/dist/components/DataTable.js +1 -1
- package/dist/components/DateFilter.js +1 -1
- package/dist/components/FormattedDate.js +1 -1
- package/dist/components/QuantityField.js +2 -0
- package/dist/components/QuantityField.js.map +1 -0
- package/dist/components/SegmentedProgress.js +2 -0
- package/dist/components/SegmentedProgress.js.map +1 -0
- package/dist/components/Select.js.map +1 -1
- package/dist/components/Switch.js +1 -0
- package/dist/components/Switch.js.map +1 -1
- package/dist/contextAnchor.js +3 -2
- package/dist/contextAnchor.js.map +1 -1
- package/dist/dropdown-menu.js +1 -1
- package/dist/index.js +5 -2
- package/dist/index.js.map +1 -1
- package/dist/index14.js +1139 -20
- package/dist/index14.js.map +1 -1
- package/dist/index15.js +20 -1139
- package/dist/index15.js.map +1 -1
- package/dist/index34.js +2 -2
- package/dist/index6.js +90 -382
- package/dist/index6.js.map +1 -1
- package/dist/index7.js +382 -90
- package/dist/index7.js.map +1 -1
- package/dist/lib/components/Chart/ChartFrame.d.ts.map +1 -1
- package/dist/lib/components/CurrencyField/CurrencyFieldFilter.d.ts +2 -0
- package/dist/lib/components/CurrencyField/CurrencyFieldFilter.d.ts.map +1 -1
- package/dist/lib/components/DataTable/DataTable.d.ts.map +1 -1
- package/dist/lib/components/DataTable/DataTableSkeleton.d.ts +11 -0
- package/dist/lib/components/DataTable/DataTableSkeleton.d.ts.map +1 -0
- package/dist/lib/components/DataTable/components/DataTableSelectionBar.d.ts.map +1 -1
- package/dist/lib/components/DataTable/index.d.ts +3 -0
- package/dist/lib/components/DataTable/index.d.ts.map +1 -1
- package/dist/lib/components/DataTable/modes.d.ts +9 -0
- package/dist/lib/components/DataTable/modes.d.ts.map +1 -0
- package/dist/lib/components/DataTable/types.d.ts +3 -1
- package/dist/lib/components/DataTable/types.d.ts.map +1 -1
- package/dist/lib/components/DropdownMenu/DropdownMenu.d.ts.map +1 -1
- package/dist/lib/components/DropdownMenu/types.d.ts +1 -0
- package/dist/lib/components/DropdownMenu/types.d.ts.map +1 -1
- package/dist/lib/components/Progress/Progress.d.ts +3 -1
- package/dist/lib/components/Progress/Progress.d.ts.map +1 -1
- package/dist/lib/components/QuantityField/QuantityField.d.ts +22 -0
- package/dist/lib/components/QuantityField/QuantityField.d.ts.map +1 -0
- package/dist/lib/components/QuantityField/index.d.ts +3 -0
- package/dist/lib/components/QuantityField/index.d.ts.map +1 -0
- package/dist/lib/components/QuantityField/quantity.d.ts +13 -0
- package/dist/lib/components/QuantityField/quantity.d.ts.map +1 -0
- package/dist/lib/components/SegmentedProgress/SegmentedProgress.d.ts +16 -0
- package/dist/lib/components/SegmentedProgress/SegmentedProgress.d.ts.map +1 -0
- package/dist/lib/components/SegmentedProgress/SegmentedProgressKey.d.ts +14 -0
- package/dist/lib/components/SegmentedProgress/SegmentedProgressKey.d.ts.map +1 -0
- package/dist/lib/components/SegmentedProgress/index.d.ts +5 -0
- package/dist/lib/components/SegmentedProgress/index.d.ts.map +1 -0
- package/dist/lib/components/SegmentedProgress/steps.d.ts +2 -0
- package/dist/lib/components/SegmentedProgress/steps.d.ts.map +1 -0
- package/dist/lib/components/Select/Select.d.ts +11 -3
- package/dist/lib/components/Select/Select.d.ts.map +1 -1
- package/dist/lib/components/Select/components/MultiSelect/MultiSelect.d.ts.map +1 -1
- package/dist/lib/components/Select/components/MultiSelect/MultiSelectFilter.d.ts.map +1 -1
- package/dist/lib/components/Select/components/SingleSelect/SingleSelect.d.ts +11 -3
- package/dist/lib/components/Select/components/SingleSelect/SingleSelect.d.ts.map +1 -1
- package/dist/lib/components/Select/components/SingleSelect/SingleSelectFilter.d.ts.map +1 -1
- package/dist/lib/components/Select/contextAnchor.d.ts +3 -0
- package/dist/lib/components/Select/contextAnchor.d.ts.map +1 -1
- package/dist/lib/components/Select/hooks/useSelect.d.ts.map +1 -1
- package/dist/lib/components/Select/index.d.ts +1 -1
- package/dist/lib/components/Select/index.d.ts.map +1 -1
- package/dist/lib/components/StepProgressIndicator/StepProgressIndicator.d.ts +4 -1
- package/dist/lib/components/StepProgressIndicator/StepProgressIndicator.d.ts.map +1 -1
- package/dist/lib/components/Switch/SwitchFilter.d.ts +21 -0
- package/dist/lib/components/Switch/SwitchFilter.d.ts.map +1 -0
- package/dist/lib/components/Switch/index.d.ts +2 -0
- package/dist/lib/components/Switch/index.d.ts.map +1 -1
- package/dist/lib/components/ValueFilter/ValueFilter.d.ts +6 -1
- package/dist/lib/components/ValueFilter/ValueFilter.d.ts.map +1 -1
- package/dist/lib/components/index.d.ts +2 -0
- package/dist/lib/components/index.d.ts.map +1 -1
- package/dist/lib/hooks/useFormatters.d.ts +5 -1
- package/dist/lib/hooks/useFormatters.d.ts.map +1 -1
- package/dist/lib/selects/currency/CurrencySelector.d.ts +3 -4
- package/dist/lib/selects/currency/CurrencySelector.d.ts.map +1 -1
- package/dist/lib/selects/iso-country/ISOCountrySelect.d.ts +1 -1
- package/dist/lib/selects/iso-country/ISOCountrySelect.d.ts.map +1 -1
- package/dist/lib/selects/locale/LocaleSelector.d.ts +2 -1
- package/dist/lib/selects/locale/LocaleSelector.d.ts.map +1 -1
- package/dist/lib/selects/timezone/TimezoneSelector.d.ts +2 -1
- package/dist/lib/selects/timezone/TimezoneSelector.d.ts.map +1 -1
- package/dist/lib/utils/format.d.ts +18 -0
- package/dist/lib/utils/format.d.ts.map +1 -1
- package/dist/lib/utils/lodash.d.ts +1 -1
- package/dist/lib/utils/lodash.d.ts.map +1 -1
- package/dist/select2.js +1 -1
- package/dist/separator2.js +1 -1
- package/dist/shadcn/shadcnBadge/Badge.d.ts +1 -1
- package/dist/shadcn/shadcnBadge/Badge.d.ts.map +1 -1
- package/dist/shadcn/shadcnMultiSelect/multi-select.d.ts +2 -1
- package/dist/shadcn/shadcnMultiSelect/multi-select.d.ts.map +1 -1
- package/dist/shadcn/shadcnProgress/Progress.d.ts +4 -1
- package/dist/shadcn/shadcnProgress/Progress.d.ts.map +1 -1
- package/dist/shadcn/shadcnSingleSelect/single-select.d.ts +2 -1
- package/dist/shadcn/shadcnSingleSelect/single-select.d.ts.map +1 -1
- package/dist/timezone.js +2 -2
- package/dist/useContextState.js +1 -1
- package/dist/useDataTable.js +255 -213
- package/dist/useDataTable.js.map +1 -1
- package/dist/useFormatters.js +3 -1
- package/dist/useFormatters.js.map +1 -1
- package/dist/useWorkspaceCurrency.js +1 -1
- package/dist/utils/axios.js +1 -1
- package/dist/utils/currency.js +1 -1
- package/dist/utils/format.js +37 -3
- package/dist/utils/format.js.map +1 -1
- package/dist/utils/lodash.js +3 -1
- package/dist/utils/lodash.js.map +1 -1
- package/dist/utils/timezone.js +2 -2
- package/package.json +9 -1
package/dist/index6.js
CHANGED
|
@@ -1,394 +1,102 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
*
|
|
15
|
-
* - "short": e.g. "EDT" or "GMT+8".
|
|
16
|
-
* - "long": e.g. "Eastern Daylight Time".
|
|
17
|
-
* - "shortGeneric": e.g. "ET" or "Singapore Time".
|
|
18
|
-
* - "longGeneric": e.g. "Eastern Time" or "Singapore Standard Time".
|
|
19
|
-
*
|
|
20
|
-
* These options correspond to TR35 tokens `z..zzz`, `zzzz`, `v`, and `vvvv` respectively: https://www.unicode.org/reports/tr35/tr35-dates.html#dfst-zone
|
|
21
|
-
*
|
|
22
|
-
* @param timeZone - Time zone name (IANA or UTC offset)
|
|
23
|
-
* @param date - Date object to get the time zone name for
|
|
24
|
-
* @param format - Optional format of the time zone name. Defaults to "long". Can be "short", "long", "shortGeneric", or "longGeneric".
|
|
25
|
-
*
|
|
26
|
-
* @returns Time zone name (e.g. "Singapore Standard Time")
|
|
27
|
-
*/
|
|
28
|
-
function tzName(timeZone, date, format = "long") {
|
|
29
|
-
return new Intl.DateTimeFormat("en-US", {
|
|
30
|
-
// Enforces engine to render the time. Without the option JavaScriptCore omits it.
|
|
31
|
-
hour: "numeric",
|
|
32
|
-
timeZone: timeZone,
|
|
33
|
-
timeZoneName: format
|
|
34
|
-
}).format(date).split(/\s/g) // Format.JS uses non-breaking spaces
|
|
35
|
-
.slice(2) // Skip the hour and AM/PM parts
|
|
36
|
-
.join(" ");
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
const offsetFormatCache = {};
|
|
40
|
-
const offsetCache = {};
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* The function extracts UTC offset in minutes from the given date in specified
|
|
44
|
-
* time zone.
|
|
45
|
-
*
|
|
46
|
-
* Unlike `Date.prototype.getTimezoneOffset`, this function returns the value
|
|
47
|
-
* mirrored to the sign of the offset in the time zone. For Asia/Singapore
|
|
48
|
-
* (UTC+8), `tzOffset` returns 480, while `getTimezoneOffset` returns -480.
|
|
49
|
-
*
|
|
50
|
-
* @param timeZone - Time zone name (IANA or UTC offset)
|
|
51
|
-
* @param date - Date to check the offset for
|
|
52
|
-
*
|
|
53
|
-
* @returns UTC offset in minutes
|
|
54
|
-
*/
|
|
55
|
-
function tzOffset(timeZone, date) {
|
|
56
|
-
try {
|
|
57
|
-
const format = offsetFormatCache[timeZone] ||= new Intl.DateTimeFormat("en-US", {
|
|
58
|
-
timeZone,
|
|
59
|
-
timeZoneName: "longOffset"
|
|
60
|
-
}).format;
|
|
61
|
-
const offsetStr = format(date).split("GMT")[1];
|
|
62
|
-
if (offsetStr in offsetCache) return offsetCache[offsetStr];
|
|
63
|
-
return calcOffset(offsetStr, offsetStr.split(":"));
|
|
64
|
-
} catch {
|
|
65
|
-
// Fallback to manual parsing if the runtime doesn't support ±HH:MM/±HHMM/±HH
|
|
66
|
-
// See: https://github.com/nodejs/node/issues/53419
|
|
67
|
-
if (timeZone in offsetCache) return offsetCache[timeZone];
|
|
68
|
-
const captures = timeZone?.match(offsetRe);
|
|
69
|
-
if (captures) return calcOffset(timeZone, captures.slice(1));
|
|
70
|
-
return NaN;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
const offsetRe = /([+-]\d\d):?(\d\d)?/;
|
|
74
|
-
function calcOffset(cacheStr, values) {
|
|
75
|
-
const hours = +(values[0] || 0);
|
|
76
|
-
const minutes = +(values[1] || 0);
|
|
77
|
-
// Convert seconds to minutes by dividing by 60 to keep the function return in minutes.
|
|
78
|
-
const seconds = +(values[2] || 0) / 60;
|
|
79
|
-
return offsetCache[cacheStr] = hours * 60 + minutes > 0 ? hours * 60 + minutes + seconds : hours * 60 - minutes - seconds;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
class TZDateMini extends Date {
|
|
83
|
-
//#region static
|
|
84
|
-
|
|
85
|
-
constructor(...args) {
|
|
86
|
-
super();
|
|
87
|
-
if (args.length > 1 && typeof args[args.length - 1] === "string") {
|
|
88
|
-
this.timeZone = args.pop();
|
|
1
|
+
const defaultConfig = {
|
|
2
|
+
csrf: {
|
|
3
|
+
endpoint: "csrf/token",
|
|
4
|
+
enabled: true,
|
|
5
|
+
headerName: "x-csrf-token"
|
|
6
|
+
},
|
|
7
|
+
axios: {
|
|
8
|
+
baseURL: "/api",
|
|
9
|
+
timeout: 3e4,
|
|
10
|
+
withCredentials: true,
|
|
11
|
+
headers: {
|
|
12
|
+
"Content-Type": "application/json",
|
|
13
|
+
Accept: "application/json"
|
|
89
14
|
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
15
|
+
},
|
|
16
|
+
auth: {
|
|
17
|
+
tokenHeaderName: "Authorization",
|
|
18
|
+
tokenPrefix: "Bearer",
|
|
19
|
+
tokenEndpoint: "auth/access-token",
|
|
20
|
+
refreshEndpoint: "auth/refresh-tokens",
|
|
21
|
+
sessionRecoveryEnabled: true
|
|
22
|
+
},
|
|
23
|
+
timeZone: {
|
|
24
|
+
resolveTimeZone: void 0
|
|
25
|
+
},
|
|
26
|
+
currency: {
|
|
27
|
+
resolveCurrency: void 0
|
|
28
|
+
},
|
|
29
|
+
sse: {
|
|
30
|
+
onRequest: void 0
|
|
31
|
+
},
|
|
32
|
+
views: {
|
|
33
|
+
viewsEndpoint: "table-views",
|
|
34
|
+
statesEndpoint: "table-states",
|
|
35
|
+
contextStatesEndpoint: "context-states"
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
const GLOBAL_CONFIG_KEY = "__QUANTUM_UI_CONFIG__";
|
|
39
|
+
function getGlobalConfig() {
|
|
40
|
+
if (typeof window !== "undefined") {
|
|
41
|
+
const globalWindow = window;
|
|
42
|
+
if (!globalWindow[GLOBAL_CONFIG_KEY]) {
|
|
43
|
+
globalWindow[GLOBAL_CONFIG_KEY] = { ...defaultConfig };
|
|
107
44
|
}
|
|
45
|
+
return globalWindow[GLOBAL_CONFIG_KEY] ?? { ...defaultConfig };
|
|
108
46
|
}
|
|
109
|
-
|
|
110
|
-
return args.length ? new TZDateMini(...args, tz) : new TZDateMini(Date.now(), tz);
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
//#endregion
|
|
114
|
-
|
|
115
|
-
//#region time zone
|
|
116
|
-
|
|
117
|
-
withTimeZone(timeZone) {
|
|
118
|
-
return new TZDateMini(+this, timeZone);
|
|
119
|
-
}
|
|
120
|
-
getTimezoneOffset() {
|
|
121
|
-
const offset = -tzOffset(this.timeZone, this);
|
|
122
|
-
// Remove the seconds offset
|
|
123
|
-
// use Math.floor for negative GMT timezones and Math.ceil for positive GMT timezones.
|
|
124
|
-
return offset > 0 ? Math.floor(offset) : Math.ceil(offset);
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
//#endregion
|
|
128
|
-
|
|
129
|
-
//#region time
|
|
130
|
-
|
|
131
|
-
setTime(time) {
|
|
132
|
-
Date.prototype.setTime.apply(this, arguments);
|
|
133
|
-
syncToInternal(this);
|
|
134
|
-
return +this;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
//#endregion
|
|
138
|
-
|
|
139
|
-
//#region date-fns integration
|
|
140
|
-
|
|
141
|
-
[Symbol.for("constructDateFrom")](date) {
|
|
142
|
-
return new TZDateMini(+new Date(date), this.timeZone);
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
//#endregion
|
|
47
|
+
return { ...defaultConfig };
|
|
146
48
|
}
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
Object.getOwnPropertyNames(Date.prototype).forEach(method => {
|
|
151
|
-
if (!re.test(method)) return;
|
|
152
|
-
const utcMethod = method.replace(re, "$1UTC");
|
|
153
|
-
// Filter out methods without UTC counterparts
|
|
154
|
-
if (!TZDateMini.prototype[utcMethod]) return;
|
|
155
|
-
if (method.startsWith("get")) {
|
|
156
|
-
// Delegate to internal date's UTC method
|
|
157
|
-
TZDateMini.prototype[method] = function () {
|
|
158
|
-
return this.internal[utcMethod]();
|
|
159
|
-
};
|
|
160
|
-
} else {
|
|
161
|
-
// Assign regular setter
|
|
162
|
-
TZDateMini.prototype[method] = function () {
|
|
163
|
-
Date.prototype[utcMethod].apply(this.internal, arguments);
|
|
164
|
-
syncFromInternal(this);
|
|
165
|
-
return +this;
|
|
166
|
-
};
|
|
167
|
-
|
|
168
|
-
// Assign UTC setter
|
|
169
|
-
TZDateMini.prototype[utcMethod] = function () {
|
|
170
|
-
Date.prototype[utcMethod].apply(this, arguments);
|
|
171
|
-
syncToInternal(this);
|
|
172
|
-
return +this;
|
|
173
|
-
};
|
|
49
|
+
function setGlobalConfig(config) {
|
|
50
|
+
if (typeof window !== "undefined") {
|
|
51
|
+
window[GLOBAL_CONFIG_KEY] = config;
|
|
174
52
|
}
|
|
175
|
-
});
|
|
176
|
-
|
|
177
|
-
/**
|
|
178
|
-
* Function syncs time to internal date, applying the time zone offset.
|
|
179
|
-
*
|
|
180
|
-
* @param {Date} date - Date to sync
|
|
181
|
-
*/
|
|
182
|
-
function syncToInternal(date) {
|
|
183
|
-
date.internal.setTime(+date);
|
|
184
|
-
date.internal.setUTCSeconds(date.internal.getUTCSeconds() - Math.round(-tzOffset(date.timeZone, date) * 60));
|
|
185
53
|
}
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
* Function syncs the internal date UTC values to the date. It allows to get
|
|
189
|
-
* accurate timestamp value.
|
|
190
|
-
*
|
|
191
|
-
* @param {Date} date - The date to sync
|
|
192
|
-
*/
|
|
193
|
-
function syncFromInternal(date) {
|
|
194
|
-
// First we transpose the internal values
|
|
195
|
-
Date.prototype.setFullYear.call(date, date.internal.getUTCFullYear(), date.internal.getUTCMonth(), date.internal.getUTCDate());
|
|
196
|
-
Date.prototype.setHours.call(date, date.internal.getUTCHours(), date.internal.getUTCMinutes(), date.internal.getUTCSeconds(), date.internal.getUTCMilliseconds());
|
|
197
|
-
|
|
198
|
-
// Now we have to adjust the date to the system time zone
|
|
199
|
-
adjustToSystemTZ(date);
|
|
54
|
+
function defineConfig(config) {
|
|
55
|
+
return config;
|
|
200
56
|
}
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
// However we want to adjust only if that's the DST hour the change happenes,
|
|
235
|
-
// not the hour where DST moves to.
|
|
236
|
-
|
|
237
|
-
// We calculate the previous hour to see if the time zone offset has changed
|
|
238
|
-
// and we have landed on the DST hour.
|
|
239
|
-
const prevHour = new Date(+date);
|
|
240
|
-
// We use UTC methods here as we don't want to land on the same hour again
|
|
241
|
-
// in case of DST.
|
|
242
|
-
prevHour.setUTCHours(prevHour.getUTCHours() - 1);
|
|
243
|
-
|
|
244
|
-
// Calculate if we are on the system DST hour.
|
|
245
|
-
const systemOffset = -new Date(+date).getTimezoneOffset();
|
|
246
|
-
const prevHourSystemOffset = -new Date(+prevHour).getTimezoneOffset();
|
|
247
|
-
const systemDSTChange = systemOffset - prevHourSystemOffset;
|
|
248
|
-
// Detect the DST shift. System DST change will occur both on
|
|
249
|
-
const dstShift = Date.prototype.getHours.apply(date) !== date.internal.getUTCHours();
|
|
250
|
-
|
|
251
|
-
// Move the internal date when we are on the system DST hour.
|
|
252
|
-
if (systemDSTChange && dstShift) date.internal.setUTCMinutes(date.internal.getUTCMinutes() + systemDSTChange);
|
|
253
|
-
|
|
254
|
-
//#endregion
|
|
255
|
-
|
|
256
|
-
//#region System diff adjustment
|
|
257
|
-
|
|
258
|
-
// Now we need to adjust the date, since we just applied internal values.
|
|
259
|
-
// We need to calculate the difference between the system and date time zones
|
|
260
|
-
// and apply it to the date.
|
|
261
|
-
|
|
262
|
-
const offsetDiff = systemOffset - offset;
|
|
263
|
-
if (offsetDiff) Date.prototype.setUTCMinutes.call(date, Date.prototype.getUTCMinutes.call(date) + offsetDiff);
|
|
264
|
-
|
|
265
|
-
//#endregion
|
|
266
|
-
|
|
267
|
-
//#region Seconds System diff adjustment
|
|
268
|
-
|
|
269
|
-
const systemDate = new Date(+date);
|
|
270
|
-
// Set the UTC seconds to 0 to isolate the timezone offset in seconds.
|
|
271
|
-
systemDate.setUTCSeconds(0);
|
|
272
|
-
// For negative systemOffset, invert the seconds.
|
|
273
|
-
const systemSecondsOffset = systemOffset > 0 ? systemDate.getSeconds() : (systemDate.getSeconds() - 60) % 60;
|
|
274
|
-
|
|
275
|
-
// Calculate the seconds offset based on the timezone offset.
|
|
276
|
-
const secondsOffset = Math.round(-(tzOffset(date.timeZone, date) * 60)) % 60;
|
|
277
|
-
if (secondsOffset || systemSecondsOffset) {
|
|
278
|
-
date.internal.setUTCSeconds(date.internal.getUTCSeconds() + secondsOffset);
|
|
279
|
-
Date.prototype.setUTCSeconds.call(date, Date.prototype.getUTCSeconds.call(date) + secondsOffset + systemSecondsOffset);
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
//#endregion
|
|
283
|
-
|
|
284
|
-
//#region Post-adjustment DST fix
|
|
285
|
-
|
|
286
|
-
const postBaseOffset = tzOffset(date.timeZone, date);
|
|
287
|
-
// Remove the seconds offset
|
|
288
|
-
// use Math.floor for negative GMT timezones and Math.ceil for positive GMT timezones.
|
|
289
|
-
const postOffset = postBaseOffset > 0 ? Math.floor(postBaseOffset) : Math.ceil(postBaseOffset);
|
|
290
|
-
const postSystemOffset = -new Date(+date).getTimezoneOffset();
|
|
291
|
-
const postOffsetDiff = postSystemOffset - postOffset;
|
|
292
|
-
const offsetChanged = postOffset !== offset;
|
|
293
|
-
const postDiff = postOffsetDiff - offsetDiff;
|
|
294
|
-
if (offsetChanged && postDiff) {
|
|
295
|
-
Date.prototype.setUTCMinutes.call(date, Date.prototype.getUTCMinutes.call(date) + postDiff);
|
|
296
|
-
|
|
297
|
-
// Now we need to check if got offset change during the post-adjustment.
|
|
298
|
-
// If so, we also need both dates to reflect that.
|
|
299
|
-
|
|
300
|
-
const newBaseOffset = tzOffset(date.timeZone, date);
|
|
301
|
-
// Remove the seconds offset
|
|
302
|
-
// use Math.floor for negative GMT timezones and Math.ceil for positive GMT timezones.
|
|
303
|
-
const newOffset = newBaseOffset > 0 ? Math.floor(newBaseOffset) : Math.ceil(newBaseOffset);
|
|
304
|
-
const offsetChange = postOffset - newOffset;
|
|
305
|
-
if (offsetChange) {
|
|
306
|
-
date.internal.setUTCMinutes(date.internal.getUTCMinutes() + offsetChange);
|
|
307
|
-
Date.prototype.setUTCMinutes.call(date, Date.prototype.getUTCMinutes.call(date) + offsetChange);
|
|
57
|
+
function configureQuantumUI(userConfig) {
|
|
58
|
+
const newConfig = {
|
|
59
|
+
csrf: {
|
|
60
|
+
...defaultConfig.csrf,
|
|
61
|
+
...userConfig.csrf || {}
|
|
62
|
+
},
|
|
63
|
+
axios: {
|
|
64
|
+
...defaultConfig.axios,
|
|
65
|
+
...userConfig.axios || {},
|
|
66
|
+
headers: {
|
|
67
|
+
...defaultConfig.axios.headers,
|
|
68
|
+
...userConfig.axios?.headers || {}
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
auth: {
|
|
72
|
+
...defaultConfig.auth,
|
|
73
|
+
...userConfig.auth || {}
|
|
74
|
+
},
|
|
75
|
+
timeZone: {
|
|
76
|
+
...defaultConfig.timeZone,
|
|
77
|
+
...userConfig.timeZone || {}
|
|
78
|
+
},
|
|
79
|
+
currency: {
|
|
80
|
+
...defaultConfig.currency,
|
|
81
|
+
...userConfig.currency || {}
|
|
82
|
+
},
|
|
83
|
+
sse: {
|
|
84
|
+
...defaultConfig.sse,
|
|
85
|
+
...userConfig.sse || {}
|
|
86
|
+
},
|
|
87
|
+
views: {
|
|
88
|
+
...defaultConfig.views,
|
|
89
|
+
...userConfig.views || {}
|
|
308
90
|
}
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
//#endregion
|
|
91
|
+
};
|
|
92
|
+
setGlobalConfig(newConfig);
|
|
312
93
|
}
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
return args.length ? new TZDate(...args, tz) : new TZDate(Date.now(), tz);
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
//#endregion
|
|
322
|
-
|
|
323
|
-
//#region representation
|
|
324
|
-
|
|
325
|
-
toISOString() {
|
|
326
|
-
const [sign, hours, minutes] = this.tzComponents();
|
|
327
|
-
const tz = `${sign}${hours}:${minutes}`;
|
|
328
|
-
return this.internal.toISOString().slice(0, -1) + tz;
|
|
329
|
-
}
|
|
330
|
-
toString() {
|
|
331
|
-
// "Tue Aug 13 2024 07:50:19 GMT+0800 (Singapore Standard Time)";
|
|
332
|
-
return `${this.toDateString()} ${this.toTimeString()}`;
|
|
333
|
-
}
|
|
334
|
-
toDateString() {
|
|
335
|
-
// toUTCString returns RFC 7231 ("Mon, 12 Aug 2024 23:36:08 GMT")
|
|
336
|
-
const [day, date, month, year] = this.internal.toUTCString().split(" ");
|
|
337
|
-
// "Tue Aug 13 2024"
|
|
338
|
-
return `${day?.slice(0, -1) /* Remove "," */} ${month} ${date} ${year}`;
|
|
339
|
-
}
|
|
340
|
-
toTimeString() {
|
|
341
|
-
// toUTCString returns RFC 7231 ("Mon, 12 Aug 2024 23:36:08 GMT")
|
|
342
|
-
const time = this.internal.toUTCString().split(" ")[4];
|
|
343
|
-
const [sign, hours, minutes] = this.tzComponents();
|
|
344
|
-
// "07:42:23 GMT+0800 (Singapore Standard Time)"
|
|
345
|
-
return `${time} GMT${sign}${hours}${minutes} (${tzName(this.timeZone, this)})`;
|
|
346
|
-
}
|
|
347
|
-
toLocaleString(locales, options) {
|
|
348
|
-
return Date.prototype.toLocaleString.call(this, locales, {
|
|
349
|
-
...options,
|
|
350
|
-
timeZone: options?.timeZone || this.timeZone
|
|
351
|
-
});
|
|
352
|
-
}
|
|
353
|
-
toLocaleDateString(locales, options) {
|
|
354
|
-
return Date.prototype.toLocaleDateString.call(this, locales, {
|
|
355
|
-
...options,
|
|
356
|
-
timeZone: options?.timeZone || this.timeZone
|
|
357
|
-
});
|
|
358
|
-
}
|
|
359
|
-
toLocaleTimeString(locales, options) {
|
|
360
|
-
return Date.prototype.toLocaleTimeString.call(this, locales, {
|
|
361
|
-
...options,
|
|
362
|
-
timeZone: options?.timeZone || this.timeZone
|
|
363
|
-
});
|
|
364
|
-
}
|
|
365
|
-
|
|
366
|
-
//#endregion
|
|
367
|
-
|
|
368
|
-
//#region private
|
|
369
|
-
|
|
370
|
-
tzComponents() {
|
|
371
|
-
const offset = this.getTimezoneOffset();
|
|
372
|
-
const sign = offset > 0 ? "-" : "+";
|
|
373
|
-
const hours = String(Math.floor(Math.abs(offset) / 60)).padStart(2, "0");
|
|
374
|
-
const minutes = String(Math.abs(offset) % 60).padStart(2, "0");
|
|
375
|
-
return [sign, hours, minutes];
|
|
376
|
-
}
|
|
377
|
-
|
|
378
|
-
//#endregion
|
|
379
|
-
|
|
380
|
-
withTimeZone(timeZone) {
|
|
381
|
-
return new TZDate(+this, timeZone);
|
|
382
|
-
}
|
|
383
|
-
|
|
384
|
-
//#region date-fns integration
|
|
385
|
-
|
|
386
|
-
[Symbol.for("constructDateFrom")](date) {
|
|
387
|
-
return new TZDate(+new Date(date), this.timeZone);
|
|
388
|
-
}
|
|
389
|
-
|
|
390
|
-
//#endregion
|
|
94
|
+
function getConfig() {
|
|
95
|
+
return getGlobalConfig();
|
|
96
|
+
}
|
|
97
|
+
function resetConfig() {
|
|
98
|
+
setGlobalConfig({ ...defaultConfig });
|
|
391
99
|
}
|
|
392
100
|
|
|
393
|
-
export {
|
|
101
|
+
export { configureQuantumUI as c, defineConfig as d, getConfig as g, resetConfig as r };
|
|
394
102
|
//# sourceMappingURL=index6.js.map
|
package/dist/index6.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index6.js","sources":["../node_modules/.pnpm/@date-fns+tz@1.4.1/node_modules/@date-fns/tz/tzName/index.js","../node_modules/.pnpm/@date-fns+tz@1.4.1/node_modules/@date-fns/tz/tzOffset/index.js","../node_modules/.pnpm/@date-fns+tz@1.4.1/node_modules/@date-fns/tz/date/mini.js","../node_modules/.pnpm/@date-fns+tz@1.4.1/node_modules/@date-fns/tz/date/index.js"],"sourcesContent":["/**\n * Time zone name format.\n */\n\n/**\n * The function returns the time zone name for the given date in the specified\n * time zone.\n *\n * It uses the `Intl.DateTimeFormat` API and by default outputs the time zone\n * name in a long format, e.g. \"Pacific Standard Time\" or\n * \"Singapore Standard Time\".\n *\n * It is possible to specify the format as the third argument using one of the following options\n *\n * - \"short\": e.g. \"EDT\" or \"GMT+8\".\n * - \"long\": e.g. \"Eastern Daylight Time\".\n * - \"shortGeneric\": e.g. \"ET\" or \"Singapore Time\".\n * - \"longGeneric\": e.g. \"Eastern Time\" or \"Singapore Standard Time\".\n *\n * These options correspond to TR35 tokens `z..zzz`, `zzzz`, `v`, and `vvvv` respectively: https://www.unicode.org/reports/tr35/tr35-dates.html#dfst-zone\n *\n * @param timeZone - Time zone name (IANA or UTC offset)\n * @param date - Date object to get the time zone name for\n * @param format - Optional format of the time zone name. Defaults to \"long\". Can be \"short\", \"long\", \"shortGeneric\", or \"longGeneric\".\n *\n * @returns Time zone name (e.g. \"Singapore Standard Time\")\n */\nexport function tzName(timeZone, date, format = \"long\") {\n return new Intl.DateTimeFormat(\"en-US\", {\n // Enforces engine to render the time. Without the option JavaScriptCore omits it.\n hour: \"numeric\",\n timeZone: timeZone,\n timeZoneName: format\n }).format(date).split(/\\s/g) // Format.JS uses non-breaking spaces\n .slice(2) // Skip the hour and AM/PM parts\n .join(\" \");\n}","const offsetFormatCache = {};\nconst offsetCache = {};\n\n/**\n * The function extracts UTC offset in minutes from the given date in specified\n * time zone.\n *\n * Unlike `Date.prototype.getTimezoneOffset`, this function returns the value\n * mirrored to the sign of the offset in the time zone. For Asia/Singapore\n * (UTC+8), `tzOffset` returns 480, while `getTimezoneOffset` returns -480.\n *\n * @param timeZone - Time zone name (IANA or UTC offset)\n * @param date - Date to check the offset for\n *\n * @returns UTC offset in minutes\n */\nexport function tzOffset(timeZone, date) {\n try {\n const format = offsetFormatCache[timeZone] ||= new Intl.DateTimeFormat(\"en-US\", {\n timeZone,\n timeZoneName: \"longOffset\"\n }).format;\n const offsetStr = format(date).split(\"GMT\")[1];\n if (offsetStr in offsetCache) return offsetCache[offsetStr];\n return calcOffset(offsetStr, offsetStr.split(\":\"));\n } catch {\n // Fallback to manual parsing if the runtime doesn't support ±HH:MM/±HHMM/±HH\n // See: https://github.com/nodejs/node/issues/53419\n if (timeZone in offsetCache) return offsetCache[timeZone];\n const captures = timeZone?.match(offsetRe);\n if (captures) return calcOffset(timeZone, captures.slice(1));\n return NaN;\n }\n}\nconst offsetRe = /([+-]\\d\\d):?(\\d\\d)?/;\nfunction calcOffset(cacheStr, values) {\n const hours = +(values[0] || 0);\n const minutes = +(values[1] || 0);\n // Convert seconds to minutes by dividing by 60 to keep the function return in minutes.\n const seconds = +(values[2] || 0) / 60;\n return offsetCache[cacheStr] = hours * 60 + minutes > 0 ? hours * 60 + minutes + seconds : hours * 60 - minutes - seconds;\n}","import { tzOffset } from \"../tzOffset/index.js\";\nexport class TZDateMini extends Date {\n //#region static\n\n constructor(...args) {\n super();\n if (args.length > 1 && typeof args[args.length - 1] === \"string\") {\n this.timeZone = args.pop();\n }\n this.internal = new Date();\n if (isNaN(tzOffset(this.timeZone, this))) {\n this.setTime(NaN);\n } else {\n if (!args.length) {\n this.setTime(Date.now());\n } else if (typeof args[0] === \"number\" && (args.length === 1 || args.length === 2 && typeof args[1] !== \"number\")) {\n this.setTime(args[0]);\n } else if (typeof args[0] === \"string\") {\n this.setTime(+new Date(args[0]));\n } else if (args[0] instanceof Date) {\n this.setTime(+args[0]);\n } else {\n this.setTime(+new Date(...args));\n adjustToSystemTZ(this, NaN);\n syncToInternal(this);\n }\n }\n }\n static tz(tz, ...args) {\n return args.length ? new TZDateMini(...args, tz) : new TZDateMini(Date.now(), tz);\n }\n\n //#endregion\n\n //#region time zone\n\n withTimeZone(timeZone) {\n return new TZDateMini(+this, timeZone);\n }\n getTimezoneOffset() {\n const offset = -tzOffset(this.timeZone, this);\n // Remove the seconds offset\n // use Math.floor for negative GMT timezones and Math.ceil for positive GMT timezones.\n return offset > 0 ? Math.floor(offset) : Math.ceil(offset);\n }\n\n //#endregion\n\n //#region time\n\n setTime(time) {\n Date.prototype.setTime.apply(this, arguments);\n syncToInternal(this);\n return +this;\n }\n\n //#endregion\n\n //#region date-fns integration\n\n [Symbol.for(\"constructDateFrom\")](date) {\n return new TZDateMini(+new Date(date), this.timeZone);\n }\n\n //#endregion\n}\n\n// Assign getters and setters\nconst re = /^(get|set)(?!UTC)/;\nObject.getOwnPropertyNames(Date.prototype).forEach(method => {\n if (!re.test(method)) return;\n const utcMethod = method.replace(re, \"$1UTC\");\n // Filter out methods without UTC counterparts\n if (!TZDateMini.prototype[utcMethod]) return;\n if (method.startsWith(\"get\")) {\n // Delegate to internal date's UTC method\n TZDateMini.prototype[method] = function () {\n return this.internal[utcMethod]();\n };\n } else {\n // Assign regular setter\n TZDateMini.prototype[method] = function () {\n Date.prototype[utcMethod].apply(this.internal, arguments);\n syncFromInternal(this);\n return +this;\n };\n\n // Assign UTC setter\n TZDateMini.prototype[utcMethod] = function () {\n Date.prototype[utcMethod].apply(this, arguments);\n syncToInternal(this);\n return +this;\n };\n }\n});\n\n/**\n * Function syncs time to internal date, applying the time zone offset.\n *\n * @param {Date} date - Date to sync\n */\nfunction syncToInternal(date) {\n date.internal.setTime(+date);\n date.internal.setUTCSeconds(date.internal.getUTCSeconds() - Math.round(-tzOffset(date.timeZone, date) * 60));\n}\n\n/**\n * Function syncs the internal date UTC values to the date. It allows to get\n * accurate timestamp value.\n *\n * @param {Date} date - The date to sync\n */\nfunction syncFromInternal(date) {\n // First we transpose the internal values\n Date.prototype.setFullYear.call(date, date.internal.getUTCFullYear(), date.internal.getUTCMonth(), date.internal.getUTCDate());\n Date.prototype.setHours.call(date, date.internal.getUTCHours(), date.internal.getUTCMinutes(), date.internal.getUTCSeconds(), date.internal.getUTCMilliseconds());\n\n // Now we have to adjust the date to the system time zone\n adjustToSystemTZ(date);\n}\n\n/**\n * Function adjusts the date to the system time zone. It uses the time zone\n * differences to calculate the offset and adjust the date.\n *\n * @param {Date} date - Date to adjust\n */\nfunction adjustToSystemTZ(date) {\n // Save the time zone offset before all the adjustments\n const baseOffset = tzOffset(date.timeZone, date);\n // Remove the seconds offset\n // use Math.floor for negative GMT timezones and Math.ceil for positive GMT timezones.\n const offset = baseOffset > 0 ? Math.floor(baseOffset) : Math.ceil(baseOffset);\n //#region System DST adjustment\n\n // The biggest problem with using the system time zone is that when we create\n // a date from internal values stored in UTC, the system time zone might end\n // up on the DST hour:\n //\n // $ TZ=America/New_York node\n // > new Date(2020, 2, 8, 1).toString()\n // 'Sun Mar 08 2020 01:00:00 GMT-0500 (Eastern Standard Time)'\n // > new Date(2020, 2, 8, 2).toString()\n // 'Sun Mar 08 2020 03:00:00 GMT-0400 (Eastern Daylight Time)'\n // > new Date(2020, 2, 8, 3).toString()\n // 'Sun Mar 08 2020 03:00:00 GMT-0400 (Eastern Daylight Time)'\n // > new Date(2020, 2, 8, 4).toString()\n // 'Sun Mar 08 2020 04:00:00 GMT-0400 (Eastern Daylight Time)'\n //\n // Here we get the same hour for both 2 and 3, because the system time zone\n // has DST beginning at 8 March 2020, 2 a.m. and jumps to 3 a.m. So we have\n // to adjust the internal date to reflect that.\n //\n // However we want to adjust only if that's the DST hour the change happenes,\n // not the hour where DST moves to.\n\n // We calculate the previous hour to see if the time zone offset has changed\n // and we have landed on the DST hour.\n const prevHour = new Date(+date);\n // We use UTC methods here as we don't want to land on the same hour again\n // in case of DST.\n prevHour.setUTCHours(prevHour.getUTCHours() - 1);\n\n // Calculate if we are on the system DST hour.\n const systemOffset = -new Date(+date).getTimezoneOffset();\n const prevHourSystemOffset = -new Date(+prevHour).getTimezoneOffset();\n const systemDSTChange = systemOffset - prevHourSystemOffset;\n // Detect the DST shift. System DST change will occur both on\n const dstShift = Date.prototype.getHours.apply(date) !== date.internal.getUTCHours();\n\n // Move the internal date when we are on the system DST hour.\n if (systemDSTChange && dstShift) date.internal.setUTCMinutes(date.internal.getUTCMinutes() + systemDSTChange);\n\n //#endregion\n\n //#region System diff adjustment\n\n // Now we need to adjust the date, since we just applied internal values.\n // We need to calculate the difference between the system and date time zones\n // and apply it to the date.\n\n const offsetDiff = systemOffset - offset;\n if (offsetDiff) Date.prototype.setUTCMinutes.call(date, Date.prototype.getUTCMinutes.call(date) + offsetDiff);\n\n //#endregion\n\n //#region Seconds System diff adjustment\n\n const systemDate = new Date(+date);\n // Set the UTC seconds to 0 to isolate the timezone offset in seconds.\n systemDate.setUTCSeconds(0);\n // For negative systemOffset, invert the seconds.\n const systemSecondsOffset = systemOffset > 0 ? systemDate.getSeconds() : (systemDate.getSeconds() - 60) % 60;\n\n // Calculate the seconds offset based on the timezone offset.\n const secondsOffset = Math.round(-(tzOffset(date.timeZone, date) * 60)) % 60;\n if (secondsOffset || systemSecondsOffset) {\n date.internal.setUTCSeconds(date.internal.getUTCSeconds() + secondsOffset);\n Date.prototype.setUTCSeconds.call(date, Date.prototype.getUTCSeconds.call(date) + secondsOffset + systemSecondsOffset);\n }\n\n //#endregion\n\n //#region Post-adjustment DST fix\n\n const postBaseOffset = tzOffset(date.timeZone, date);\n // Remove the seconds offset\n // use Math.floor for negative GMT timezones and Math.ceil for positive GMT timezones.\n const postOffset = postBaseOffset > 0 ? Math.floor(postBaseOffset) : Math.ceil(postBaseOffset);\n const postSystemOffset = -new Date(+date).getTimezoneOffset();\n const postOffsetDiff = postSystemOffset - postOffset;\n const offsetChanged = postOffset !== offset;\n const postDiff = postOffsetDiff - offsetDiff;\n if (offsetChanged && postDiff) {\n Date.prototype.setUTCMinutes.call(date, Date.prototype.getUTCMinutes.call(date) + postDiff);\n\n // Now we need to check if got offset change during the post-adjustment.\n // If so, we also need both dates to reflect that.\n\n const newBaseOffset = tzOffset(date.timeZone, date);\n // Remove the seconds offset\n // use Math.floor for negative GMT timezones and Math.ceil for positive GMT timezones.\n const newOffset = newBaseOffset > 0 ? Math.floor(newBaseOffset) : Math.ceil(newBaseOffset);\n const offsetChange = postOffset - newOffset;\n if (offsetChange) {\n date.internal.setUTCMinutes(date.internal.getUTCMinutes() + offsetChange);\n Date.prototype.setUTCMinutes.call(date, Date.prototype.getUTCMinutes.call(date) + offsetChange);\n }\n }\n\n //#endregion\n}","import { tzName } from \"../tzName/index.js\";\nimport { TZDateMini } from \"./mini.js\";\nexport class TZDate extends TZDateMini {\n //#region static\n\n static tz(tz, ...args) {\n return args.length ? new TZDate(...args, tz) : new TZDate(Date.now(), tz);\n }\n\n //#endregion\n\n //#region representation\n\n toISOString() {\n const [sign, hours, minutes] = this.tzComponents();\n const tz = `${sign}${hours}:${minutes}`;\n return this.internal.toISOString().slice(0, -1) + tz;\n }\n toString() {\n // \"Tue Aug 13 2024 07:50:19 GMT+0800 (Singapore Standard Time)\";\n return `${this.toDateString()} ${this.toTimeString()}`;\n }\n toDateString() {\n // toUTCString returns RFC 7231 (\"Mon, 12 Aug 2024 23:36:08 GMT\")\n const [day, date, month, year] = this.internal.toUTCString().split(\" \");\n // \"Tue Aug 13 2024\"\n return `${day?.slice(0, -1) /* Remove \",\" */} ${month} ${date} ${year}`;\n }\n toTimeString() {\n // toUTCString returns RFC 7231 (\"Mon, 12 Aug 2024 23:36:08 GMT\")\n const time = this.internal.toUTCString().split(\" \")[4];\n const [sign, hours, minutes] = this.tzComponents();\n // \"07:42:23 GMT+0800 (Singapore Standard Time)\"\n return `${time} GMT${sign}${hours}${minutes} (${tzName(this.timeZone, this)})`;\n }\n toLocaleString(locales, options) {\n return Date.prototype.toLocaleString.call(this, locales, {\n ...options,\n timeZone: options?.timeZone || this.timeZone\n });\n }\n toLocaleDateString(locales, options) {\n return Date.prototype.toLocaleDateString.call(this, locales, {\n ...options,\n timeZone: options?.timeZone || this.timeZone\n });\n }\n toLocaleTimeString(locales, options) {\n return Date.prototype.toLocaleTimeString.call(this, locales, {\n ...options,\n timeZone: options?.timeZone || this.timeZone\n });\n }\n\n //#endregion\n\n //#region private\n\n tzComponents() {\n const offset = this.getTimezoneOffset();\n const sign = offset > 0 ? \"-\" : \"+\";\n const hours = String(Math.floor(Math.abs(offset) / 60)).padStart(2, \"0\");\n const minutes = String(Math.abs(offset) % 60).padStart(2, \"0\");\n return [sign, hours, minutes];\n }\n\n //#endregion\n\n withTimeZone(timeZone) {\n return new TZDate(+this, timeZone);\n }\n\n //#region date-fns integration\n\n [Symbol.for(\"constructDateFrom\")](date) {\n return new TZDate(+new Date(date), this.timeZone);\n }\n\n //#endregion\n}"],"names":[],"mappings":"AAAA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA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,iBAAiB,EAAE;AAC3C,IAAI,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,GAAG,GAAG,GAAG,GAAG;AACvC,IAAI,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC;AAC5E,IAAI,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC;AAClE,IAAI,OAAO,CAAC,IAAI,EAAE,KAAK,EAAE,OAAO,CAAC;AACjC,EAAE;;AAEF;;AAEA,EAAE,YAAY,CAAC,QAAQ,EAAE;AACzB,IAAI,OAAO,IAAI,MAAM,CAAC,CAAC,IAAI,EAAE,QAAQ,CAAC;AACtC,EAAE;;AAEF;;AAEA,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC,CAAC,IAAI,EAAE;AAC1C,IAAI,OAAO,IAAI,MAAM,CAAC,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC;AACrD,EAAE;;AAEF;AACA;;;;","x_google_ignoreList":[0,1,2,3]}
|
|
1
|
+
{"version":3,"file":"index6.js","sources":["../lib/config/index.ts"],"sourcesContent":["export interface CsrfConfig {\n endpoint: string;\n\n enabled: boolean;\n\n headerName: string;\n}\n\nexport interface AxiosConfig {\n baseURL: string;\n\n timeout: number;\n\n withCredentials: boolean;\n\n headers?: Record<string, string>;\n\n onRequest?: (config: import('axios').InternalAxiosRequestConfig) => void | Promise<void>;\n}\n\nexport interface AuthConfig {\n tokenHeaderName: string;\n\n tokenPrefix: string;\n\n tokenEndpoint: string;\n\n refreshEndpoint: string;\n\n sessionRecoveryEnabled: boolean;\n}\n\nexport interface ViewsConfig {\n viewsEndpoint: string;\n\n statesEndpoint: string;\n\n contextStatesEndpoint: string;\n}\n\nexport interface TimeZoneConfig {\n resolveTimeZone?: () => string | null | undefined;\n}\n\nexport interface CurrencyConfig {\n // The host's currency for the active workspace, or for one site when `siteId` is given\n resolveCurrency?: (siteId?: string | null) => string | null | undefined;\n}\n\nexport interface SseConfig {\n // Rewrites an SSE URL before the EventSource opens — the counterpart to axios.onRequest. EventSource\n // cannot set request headers, so whatever an HTTP call carries in a header (workspace/tenant context)\n // has to ride the query string here instead. Returns the URL to connect to.\n onRequest?: (url: string) => string;\n}\n\nexport interface QuantumUIConfig {\n csrf?: Partial<CsrfConfig>;\n\n axios?: Partial<AxiosConfig>;\n\n auth?: Partial<AuthConfig>;\n\n timeZone?: TimeZoneConfig;\n\n currency?: CurrencyConfig;\n\n sse?: SseConfig;\n\n views: ViewsConfig;\n}\n\nconst defaultConfig: {\n csrf: CsrfConfig;\n axios: AxiosConfig;\n auth: AuthConfig;\n views: Required<ViewsConfig>;\n timeZone: TimeZoneConfig;\n currency: CurrencyConfig;\n sse: SseConfig;\n} = {\n csrf: {\n endpoint: 'csrf/token',\n enabled: true,\n headerName: 'x-csrf-token',\n },\n axios: {\n baseURL: '/api',\n timeout: 30000,\n withCredentials: true,\n headers: {\n 'Content-Type': 'application/json',\n Accept: 'application/json',\n },\n },\n auth: {\n tokenHeaderName: 'Authorization',\n tokenPrefix: 'Bearer',\n tokenEndpoint: 'auth/access-token',\n refreshEndpoint: 'auth/refresh-tokens',\n sessionRecoveryEnabled: true,\n },\n timeZone: {\n resolveTimeZone: undefined,\n },\n currency: {\n resolveCurrency: undefined,\n },\n sse: {\n onRequest: undefined,\n },\n views: {\n viewsEndpoint: 'table-views',\n statesEndpoint: 'table-states',\n contextStatesEndpoint: 'context-states',\n },\n};\n\nconst GLOBAL_CONFIG_KEY = '__QUANTUM_UI_CONFIG__';\n\ntype GlobalWindow = Window & typeof globalThis & { [GLOBAL_CONFIG_KEY]?: typeof defaultConfig };\n\n// Get the current config from global storage or initialize with defaults\nfunction getGlobalConfig(): typeof defaultConfig {\n if (typeof window !== 'undefined') {\n const globalWindow = window as GlobalWindow;\n if (!globalWindow[GLOBAL_CONFIG_KEY]) {\n globalWindow[GLOBAL_CONFIG_KEY] = { ...defaultConfig };\n }\n return globalWindow[GLOBAL_CONFIG_KEY] ?? { ...defaultConfig };\n }\n return { ...defaultConfig };\n}\n\n// Set the global config\nfunction setGlobalConfig(config: typeof defaultConfig): void {\n if (typeof window !== 'undefined') {\n (window as GlobalWindow)[GLOBAL_CONFIG_KEY] = config;\n }\n}\n\n// Helper function to define configuration with type safety.\nexport function defineConfig(config: QuantumUIConfig): QuantumUIConfig {\n return config;\n}\n\n// Configure quantum-ui with user settings; call once in the application entry point.\nexport function configureQuantumUI(userConfig: QuantumUIConfig): void {\n const newConfig = {\n csrf: {\n ...defaultConfig.csrf,\n ...(userConfig.csrf || {}),\n },\n axios: {\n ...defaultConfig.axios,\n ...(userConfig.axios || {}),\n headers: {\n ...defaultConfig.axios.headers,\n ...(userConfig.axios?.headers || {}),\n },\n },\n auth: {\n ...defaultConfig.auth,\n ...(userConfig.auth || {}),\n },\n timeZone: {\n ...defaultConfig.timeZone,\n ...(userConfig.timeZone || {}),\n },\n currency: {\n ...defaultConfig.currency,\n ...(userConfig.currency || {}),\n },\n sse: {\n ...defaultConfig.sse,\n ...(userConfig.sse || {}),\n },\n views: {\n ...defaultConfig.views,\n ...(userConfig.views || {}),\n },\n };\n setGlobalConfig(newConfig);\n}\n\n// Get the current configuration.\nexport function getConfig(): typeof defaultConfig {\n return getGlobalConfig();\n}\n\n// Reset configuration to defaults; mainly useful for testing.\nexport function resetConfig(): void {\n setGlobalConfig({ ...defaultConfig });\n}\n"],"names":[],"mappings":"AAwEA,MAAM,aAAA,GAQF;AAAA,EACF,IAAA,EAAM;AAAA,IACJ,QAAA,EAAU,YAAA;AAAA,IACV,OAAA,EAAS,IAAA;AAAA,IACT,UAAA,EAAY;AAAA,GACd;AAA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