@erpsquad/common 1.7.2 → 1.7.3
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/CHANGELOG.md +0 -25
- package/README.md +934 -946
- package/dist/{article-cell-editor-JDI676YI-Bgq3iI1C.esm.js → article-cell-editor-JDI676YI-Dc_C73-P.esm.js} +2 -2
- package/dist/{article-cell-editor-JDI676YI-Bgq3iI1C.esm.js.map → article-cell-editor-JDI676YI-Dc_C73-P.esm.js.map} +1 -1
- package/dist/{article-cell-editor-JDI676YI-C7s2Yz0q.js → article-cell-editor-JDI676YI-DdLmEDri.js} +2 -2
- package/dist/{article-cell-editor-JDI676YI-C7s2Yz0q.js.map → article-cell-editor-JDI676YI-DdLmEDri.js.map} +1 -1
- package/dist/components/index.d.ts +9 -0
- package/dist/components/index.esm.js +91 -82
- package/dist/components/index.js +1 -1
- package/dist/{index-Ctq0WMb1.js → index-Ch4YhLU3.js} +168 -152
- package/dist/index-Ch4YhLU3.js.map +1 -0
- package/dist/{index-D-LS9re6.esm.js → index-Ck1uBa0H.esm.js} +1830 -833
- package/dist/index-Ck1uBa0H.esm.js.map +1 -0
- package/dist/index.esm.js +109 -100
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/{number-overlay-editor-FPDVTUA6-C0znNQy0.esm.js → number-overlay-editor-FPDVTUA6-CIQKpJh_.esm.js} +2 -2
- package/dist/{number-overlay-editor-FPDVTUA6-C0znNQy0.esm.js.map → number-overlay-editor-FPDVTUA6-CIQKpJh_.esm.js.map} +1 -1
- package/dist/{number-overlay-editor-FPDVTUA6-BUC63sqH.js → number-overlay-editor-FPDVTUA6-CJNQkl_m.js} +2 -2
- package/dist/{number-overlay-editor-FPDVTUA6-BUC63sqH.js.map → number-overlay-editor-FPDVTUA6-CJNQkl_m.js.map} +1 -1
- package/dist/style.css +3 -3
- package/package.json +293 -293
- package/src/styles/css/reset.css +1 -7
- package/src/styles/index.ts +8 -7
- package/src/styles/sass/main.scss +4 -7
- package/dist/index-Ctq0WMb1.js.map +0 -1
- package/dist/index-D-LS9re6.esm.js.map +0 -1
- package/src/styles/sass/_mui-overrides.scss +0 -177
|
@@ -13762,9 +13762,9 @@ function formatIsoTimeString(marker) {
|
|
|
13762
13762
|
}
|
|
13763
13763
|
function formatTimeZoneOffset(minutes, doIso = false) {
|
|
13764
13764
|
let sign2 = minutes < 0 ? "-" : "+";
|
|
13765
|
-
let
|
|
13766
|
-
let hours = Math.floor(
|
|
13767
|
-
let mins = Math.round(
|
|
13765
|
+
let abs2 = Math.abs(minutes);
|
|
13766
|
+
let hours = Math.floor(abs2 / 60);
|
|
13767
|
+
let mins = Math.round(abs2 % 60);
|
|
13768
13768
|
if (doIso) {
|
|
13769
13769
|
return `${sign2 + padStart(hours, 2)}:${padStart(mins, 2)}`;
|
|
13770
13770
|
}
|
|
@@ -14163,12 +14163,12 @@ function createFormatter(input) {
|
|
|
14163
14163
|
return null;
|
|
14164
14164
|
}
|
|
14165
14165
|
const BASE_OPTION_REFINERS = {
|
|
14166
|
-
navLinkDayClick: identity$
|
|
14167
|
-
navLinkWeekClick: identity$
|
|
14166
|
+
navLinkDayClick: identity$4,
|
|
14167
|
+
navLinkWeekClick: identity$4,
|
|
14168
14168
|
duration: createDuration,
|
|
14169
|
-
bootstrapFontAwesome: identity$
|
|
14170
|
-
buttonIcons: identity$
|
|
14171
|
-
customButtons: identity$
|
|
14169
|
+
bootstrapFontAwesome: identity$4,
|
|
14170
|
+
buttonIcons: identity$4,
|
|
14171
|
+
customButtons: identity$4,
|
|
14172
14172
|
defaultAllDayEventDuration: createDuration,
|
|
14173
14173
|
defaultTimedEventDuration: createDuration,
|
|
14174
14174
|
nextDayThreshold: createDuration,
|
|
@@ -14179,54 +14179,54 @@ const BASE_OPTION_REFINERS = {
|
|
|
14179
14179
|
dayPopoverFormat: createFormatter,
|
|
14180
14180
|
slotDuration: createDuration,
|
|
14181
14181
|
snapDuration: createDuration,
|
|
14182
|
-
headerToolbar: identity$
|
|
14183
|
-
footerToolbar: identity$
|
|
14182
|
+
headerToolbar: identity$4,
|
|
14183
|
+
footerToolbar: identity$4,
|
|
14184
14184
|
defaultRangeSeparator: String,
|
|
14185
14185
|
titleRangeSeparator: String,
|
|
14186
14186
|
forceEventDuration: Boolean,
|
|
14187
14187
|
dayHeaders: Boolean,
|
|
14188
14188
|
dayHeaderFormat: createFormatter,
|
|
14189
|
-
dayHeaderClassNames: identity$
|
|
14190
|
-
dayHeaderContent: identity$
|
|
14191
|
-
dayHeaderDidMount: identity$
|
|
14192
|
-
dayHeaderWillUnmount: identity$
|
|
14193
|
-
dayCellClassNames: identity$
|
|
14194
|
-
dayCellContent: identity$
|
|
14195
|
-
dayCellDidMount: identity$
|
|
14196
|
-
dayCellWillUnmount: identity$
|
|
14189
|
+
dayHeaderClassNames: identity$4,
|
|
14190
|
+
dayHeaderContent: identity$4,
|
|
14191
|
+
dayHeaderDidMount: identity$4,
|
|
14192
|
+
dayHeaderWillUnmount: identity$4,
|
|
14193
|
+
dayCellClassNames: identity$4,
|
|
14194
|
+
dayCellContent: identity$4,
|
|
14195
|
+
dayCellDidMount: identity$4,
|
|
14196
|
+
dayCellWillUnmount: identity$4,
|
|
14197
14197
|
initialView: String,
|
|
14198
14198
|
aspectRatio: Number,
|
|
14199
14199
|
weekends: Boolean,
|
|
14200
|
-
weekNumberCalculation: identity$
|
|
14200
|
+
weekNumberCalculation: identity$4,
|
|
14201
14201
|
weekNumbers: Boolean,
|
|
14202
|
-
weekNumberClassNames: identity$
|
|
14203
|
-
weekNumberContent: identity$
|
|
14204
|
-
weekNumberDidMount: identity$
|
|
14205
|
-
weekNumberWillUnmount: identity$
|
|
14202
|
+
weekNumberClassNames: identity$4,
|
|
14203
|
+
weekNumberContent: identity$4,
|
|
14204
|
+
weekNumberDidMount: identity$4,
|
|
14205
|
+
weekNumberWillUnmount: identity$4,
|
|
14206
14206
|
editable: Boolean,
|
|
14207
|
-
viewClassNames: identity$
|
|
14208
|
-
viewDidMount: identity$
|
|
14209
|
-
viewWillUnmount: identity$
|
|
14207
|
+
viewClassNames: identity$4,
|
|
14208
|
+
viewDidMount: identity$4,
|
|
14209
|
+
viewWillUnmount: identity$4,
|
|
14210
14210
|
nowIndicator: Boolean,
|
|
14211
|
-
nowIndicatorSnap: identity$
|
|
14212
|
-
nowIndicatorClassNames: identity$
|
|
14213
|
-
nowIndicatorContent: identity$
|
|
14214
|
-
nowIndicatorDidMount: identity$
|
|
14215
|
-
nowIndicatorWillUnmount: identity$
|
|
14211
|
+
nowIndicatorSnap: identity$4,
|
|
14212
|
+
nowIndicatorClassNames: identity$4,
|
|
14213
|
+
nowIndicatorContent: identity$4,
|
|
14214
|
+
nowIndicatorDidMount: identity$4,
|
|
14215
|
+
nowIndicatorWillUnmount: identity$4,
|
|
14216
14216
|
showNonCurrentDates: Boolean,
|
|
14217
14217
|
lazyFetching: Boolean,
|
|
14218
14218
|
startParam: String,
|
|
14219
14219
|
endParam: String,
|
|
14220
14220
|
timeZoneParam: String,
|
|
14221
14221
|
timeZone: String,
|
|
14222
|
-
locales: identity$
|
|
14223
|
-
locale: identity$
|
|
14222
|
+
locales: identity$4,
|
|
14223
|
+
locale: identity$4,
|
|
14224
14224
|
themeSystem: String,
|
|
14225
14225
|
dragRevertDuration: Number,
|
|
14226
14226
|
dragScroll: Boolean,
|
|
14227
14227
|
allDayMaintainDuration: Boolean,
|
|
14228
14228
|
unselectAuto: Boolean,
|
|
14229
|
-
dropAccept: identity$
|
|
14229
|
+
dropAccept: identity$4,
|
|
14230
14230
|
eventOrder: parseFieldSpecs,
|
|
14231
14231
|
eventOrderStrict: Boolean,
|
|
14232
14232
|
handleWindowResize: Boolean,
|
|
@@ -14234,8 +14234,8 @@ const BASE_OPTION_REFINERS = {
|
|
|
14234
14234
|
longPressDelay: Number,
|
|
14235
14235
|
eventDragMinDistance: Number,
|
|
14236
14236
|
expandRows: Boolean,
|
|
14237
|
-
height: identity$
|
|
14238
|
-
contentHeight: identity$
|
|
14237
|
+
height: identity$4,
|
|
14238
|
+
contentHeight: identity$4,
|
|
14239
14239
|
direction: String,
|
|
14240
14240
|
weekNumberFormat: createFormatter,
|
|
14241
14241
|
eventResizableFromStart: Boolean,
|
|
@@ -14244,59 +14244,59 @@ const BASE_OPTION_REFINERS = {
|
|
|
14244
14244
|
weekText: String,
|
|
14245
14245
|
weekTextLong: String,
|
|
14246
14246
|
progressiveEventRendering: Boolean,
|
|
14247
|
-
businessHours: identity$
|
|
14248
|
-
initialDate: identity$
|
|
14249
|
-
now: identity$
|
|
14250
|
-
eventDataTransform: identity$
|
|
14251
|
-
stickyHeaderDates: identity$
|
|
14252
|
-
stickyFooterScrollbar: identity$
|
|
14253
|
-
viewHeight: identity$
|
|
14247
|
+
businessHours: identity$4,
|
|
14248
|
+
initialDate: identity$4,
|
|
14249
|
+
now: identity$4,
|
|
14250
|
+
eventDataTransform: identity$4,
|
|
14251
|
+
stickyHeaderDates: identity$4,
|
|
14252
|
+
stickyFooterScrollbar: identity$4,
|
|
14253
|
+
viewHeight: identity$4,
|
|
14254
14254
|
defaultAllDay: Boolean,
|
|
14255
|
-
eventSourceFailure: identity$
|
|
14256
|
-
eventSourceSuccess: identity$
|
|
14255
|
+
eventSourceFailure: identity$4,
|
|
14256
|
+
eventSourceSuccess: identity$4,
|
|
14257
14257
|
eventDisplay: String,
|
|
14258
14258
|
eventStartEditable: Boolean,
|
|
14259
14259
|
eventDurationEditable: Boolean,
|
|
14260
|
-
eventOverlap: identity$
|
|
14261
|
-
eventConstraint: identity$
|
|
14262
|
-
eventAllow: identity$
|
|
14260
|
+
eventOverlap: identity$4,
|
|
14261
|
+
eventConstraint: identity$4,
|
|
14262
|
+
eventAllow: identity$4,
|
|
14263
14263
|
eventBackgroundColor: String,
|
|
14264
14264
|
eventBorderColor: String,
|
|
14265
14265
|
eventTextColor: String,
|
|
14266
14266
|
eventColor: String,
|
|
14267
|
-
eventClassNames: identity$
|
|
14268
|
-
eventContent: identity$
|
|
14269
|
-
eventDidMount: identity$
|
|
14270
|
-
eventWillUnmount: identity$
|
|
14271
|
-
selectConstraint: identity$
|
|
14272
|
-
selectOverlap: identity$
|
|
14273
|
-
selectAllow: identity$
|
|
14267
|
+
eventClassNames: identity$4,
|
|
14268
|
+
eventContent: identity$4,
|
|
14269
|
+
eventDidMount: identity$4,
|
|
14270
|
+
eventWillUnmount: identity$4,
|
|
14271
|
+
selectConstraint: identity$4,
|
|
14272
|
+
selectOverlap: identity$4,
|
|
14273
|
+
selectAllow: identity$4,
|
|
14274
14274
|
droppable: Boolean,
|
|
14275
14275
|
unselectCancel: String,
|
|
14276
|
-
slotLabelFormat: identity$
|
|
14277
|
-
slotLaneClassNames: identity$
|
|
14278
|
-
slotLaneContent: identity$
|
|
14279
|
-
slotLaneDidMount: identity$
|
|
14280
|
-
slotLaneWillUnmount: identity$
|
|
14281
|
-
slotLabelClassNames: identity$
|
|
14282
|
-
slotLabelContent: identity$
|
|
14283
|
-
slotLabelDidMount: identity$
|
|
14284
|
-
slotLabelWillUnmount: identity$
|
|
14285
|
-
dayMaxEvents: identity$
|
|
14286
|
-
dayMaxEventRows: identity$
|
|
14276
|
+
slotLabelFormat: identity$4,
|
|
14277
|
+
slotLaneClassNames: identity$4,
|
|
14278
|
+
slotLaneContent: identity$4,
|
|
14279
|
+
slotLaneDidMount: identity$4,
|
|
14280
|
+
slotLaneWillUnmount: identity$4,
|
|
14281
|
+
slotLabelClassNames: identity$4,
|
|
14282
|
+
slotLabelContent: identity$4,
|
|
14283
|
+
slotLabelDidMount: identity$4,
|
|
14284
|
+
slotLabelWillUnmount: identity$4,
|
|
14285
|
+
dayMaxEvents: identity$4,
|
|
14286
|
+
dayMaxEventRows: identity$4,
|
|
14287
14287
|
dayMinWidth: Number,
|
|
14288
14288
|
slotLabelInterval: createDuration,
|
|
14289
14289
|
allDayText: String,
|
|
14290
|
-
allDayClassNames: identity$
|
|
14291
|
-
allDayContent: identity$
|
|
14292
|
-
allDayDidMount: identity$
|
|
14293
|
-
allDayWillUnmount: identity$
|
|
14290
|
+
allDayClassNames: identity$4,
|
|
14291
|
+
allDayContent: identity$4,
|
|
14292
|
+
allDayDidMount: identity$4,
|
|
14293
|
+
allDayWillUnmount: identity$4,
|
|
14294
14294
|
slotMinWidth: Number,
|
|
14295
14295
|
navLinks: Boolean,
|
|
14296
14296
|
eventTimeFormat: createFormatter,
|
|
14297
14297
|
rerenderDelay: Number,
|
|
14298
|
-
moreLinkText: identity$
|
|
14299
|
-
moreLinkHint: identity$
|
|
14298
|
+
moreLinkText: identity$4,
|
|
14299
|
+
moreLinkHint: identity$4,
|
|
14300
14300
|
selectMinDistance: Number,
|
|
14301
14301
|
selectable: Boolean,
|
|
14302
14302
|
selectLongPressDelay: Number,
|
|
@@ -14307,34 +14307,34 @@ const BASE_OPTION_REFINERS = {
|
|
|
14307
14307
|
eventMinWidth: Number,
|
|
14308
14308
|
eventShortHeight: Number,
|
|
14309
14309
|
slotEventOverlap: Boolean,
|
|
14310
|
-
plugins: identity$
|
|
14310
|
+
plugins: identity$4,
|
|
14311
14311
|
firstDay: Number,
|
|
14312
14312
|
dayCount: Number,
|
|
14313
14313
|
dateAlignment: String,
|
|
14314
14314
|
dateIncrement: createDuration,
|
|
14315
|
-
hiddenDays: identity$
|
|
14315
|
+
hiddenDays: identity$4,
|
|
14316
14316
|
fixedWeekCount: Boolean,
|
|
14317
|
-
validRange: identity$
|
|
14318
|
-
visibleRange: identity$
|
|
14319
|
-
titleFormat: identity$
|
|
14317
|
+
validRange: identity$4,
|
|
14318
|
+
visibleRange: identity$4,
|
|
14319
|
+
titleFormat: identity$4,
|
|
14320
14320
|
eventInteractive: Boolean,
|
|
14321
14321
|
// only used by list-view, but languages define the value, so we need it in base options
|
|
14322
14322
|
noEventsText: String,
|
|
14323
|
-
viewHint: identity$
|
|
14324
|
-
navLinkHint: identity$
|
|
14323
|
+
viewHint: identity$4,
|
|
14324
|
+
navLinkHint: identity$4,
|
|
14325
14325
|
closeHint: String,
|
|
14326
14326
|
timeHint: String,
|
|
14327
14327
|
eventHint: String,
|
|
14328
|
-
moreLinkClick: identity$
|
|
14329
|
-
moreLinkClassNames: identity$
|
|
14330
|
-
moreLinkContent: identity$
|
|
14331
|
-
moreLinkDidMount: identity$
|
|
14332
|
-
moreLinkWillUnmount: identity$
|
|
14328
|
+
moreLinkClick: identity$4,
|
|
14329
|
+
moreLinkClassNames: identity$4,
|
|
14330
|
+
moreLinkContent: identity$4,
|
|
14331
|
+
moreLinkDidMount: identity$4,
|
|
14332
|
+
moreLinkWillUnmount: identity$4,
|
|
14333
14333
|
monthStartFormat: createFormatter,
|
|
14334
14334
|
// for connectors
|
|
14335
14335
|
// (can't be part of plugin system b/c must be provided at runtime)
|
|
14336
|
-
handleCustomRendering: identity$
|
|
14337
|
-
customRenderingMetaMap: identity$
|
|
14336
|
+
handleCustomRendering: identity$4,
|
|
14337
|
+
customRenderingMetaMap: identity$4,
|
|
14338
14338
|
customRenderingReplaces: Boolean
|
|
14339
14339
|
};
|
|
14340
14340
|
const BASE_OPTION_DEFAULTS = {
|
|
@@ -14392,35 +14392,35 @@ const BASE_OPTION_DEFAULTS = {
|
|
|
14392
14392
|
nowIndicatorSnap: "auto"
|
|
14393
14393
|
};
|
|
14394
14394
|
const CALENDAR_LISTENER_REFINERS = {
|
|
14395
|
-
datesSet: identity$
|
|
14396
|
-
eventsSet: identity$
|
|
14397
|
-
eventAdd: identity$
|
|
14398
|
-
eventChange: identity$
|
|
14399
|
-
eventRemove: identity$
|
|
14400
|
-
windowResize: identity$
|
|
14401
|
-
eventClick: identity$
|
|
14402
|
-
eventMouseEnter: identity$
|
|
14403
|
-
eventMouseLeave: identity$
|
|
14404
|
-
select: identity$
|
|
14405
|
-
unselect: identity$
|
|
14406
|
-
loading: identity$
|
|
14395
|
+
datesSet: identity$4,
|
|
14396
|
+
eventsSet: identity$4,
|
|
14397
|
+
eventAdd: identity$4,
|
|
14398
|
+
eventChange: identity$4,
|
|
14399
|
+
eventRemove: identity$4,
|
|
14400
|
+
windowResize: identity$4,
|
|
14401
|
+
eventClick: identity$4,
|
|
14402
|
+
eventMouseEnter: identity$4,
|
|
14403
|
+
eventMouseLeave: identity$4,
|
|
14404
|
+
select: identity$4,
|
|
14405
|
+
unselect: identity$4,
|
|
14406
|
+
loading: identity$4,
|
|
14407
14407
|
// internal
|
|
14408
|
-
_unmount: identity$
|
|
14409
|
-
_beforeprint: identity$
|
|
14410
|
-
_afterprint: identity$
|
|
14411
|
-
_noEventDrop: identity$
|
|
14412
|
-
_noEventResize: identity$
|
|
14413
|
-
_resize: identity$
|
|
14414
|
-
_scrollRequest: identity$
|
|
14408
|
+
_unmount: identity$4,
|
|
14409
|
+
_beforeprint: identity$4,
|
|
14410
|
+
_afterprint: identity$4,
|
|
14411
|
+
_noEventDrop: identity$4,
|
|
14412
|
+
_noEventResize: identity$4,
|
|
14413
|
+
_resize: identity$4,
|
|
14414
|
+
_scrollRequest: identity$4
|
|
14415
14415
|
};
|
|
14416
14416
|
const CALENDAR_OPTION_REFINERS = {
|
|
14417
|
-
buttonText: identity$
|
|
14418
|
-
buttonHints: identity$
|
|
14419
|
-
views: identity$
|
|
14420
|
-
plugins: identity$
|
|
14421
|
-
initialEvents: identity$
|
|
14422
|
-
events: identity$
|
|
14423
|
-
eventSources: identity$
|
|
14417
|
+
buttonText: identity$4,
|
|
14418
|
+
buttonHints: identity$4,
|
|
14419
|
+
views: identity$4,
|
|
14420
|
+
plugins: identity$4,
|
|
14421
|
+
initialEvents: identity$4,
|
|
14422
|
+
events: identity$4,
|
|
14423
|
+
eventSources: identity$4
|
|
14424
14424
|
};
|
|
14425
14425
|
const COMPLEX_OPTION_COMPARATORS = {
|
|
14426
14426
|
headerToolbar: isMaybeObjectsEqual,
|
|
@@ -14448,15 +14448,15 @@ function isMaybeArraysEqual(a2, b2) {
|
|
|
14448
14448
|
}
|
|
14449
14449
|
const VIEW_OPTION_REFINERS = {
|
|
14450
14450
|
type: String,
|
|
14451
|
-
component: identity$
|
|
14451
|
+
component: identity$4,
|
|
14452
14452
|
buttonText: String,
|
|
14453
14453
|
buttonTextKey: String,
|
|
14454
|
-
dateProfileGeneratorClass: identity$
|
|
14454
|
+
dateProfileGeneratorClass: identity$4,
|
|
14455
14455
|
usesMinMaxTime: Boolean,
|
|
14456
|
-
classNames: identity$
|
|
14457
|
-
content: identity$
|
|
14458
|
-
didMount: identity$
|
|
14459
|
-
willUnmount: identity$
|
|
14456
|
+
classNames: identity$4,
|
|
14457
|
+
content: identity$4,
|
|
14458
|
+
didMount: identity$4,
|
|
14459
|
+
willUnmount: identity$4
|
|
14460
14460
|
};
|
|
14461
14461
|
function mergeRawOptions(optionSets) {
|
|
14462
14462
|
return mergeProps(optionSets, COMPLEX_OPTION_COMPARATORS);
|
|
@@ -14476,7 +14476,7 @@ function refineProps(input, refiners) {
|
|
|
14476
14476
|
}
|
|
14477
14477
|
return { refined, extra };
|
|
14478
14478
|
}
|
|
14479
|
-
function identity$
|
|
14479
|
+
function identity$4(raw) {
|
|
14480
14480
|
return raw;
|
|
14481
14481
|
}
|
|
14482
14482
|
const { hasOwnProperty } = Object.prototype;
|
|
@@ -15872,12 +15872,12 @@ const EVENT_NON_DATE_REFINERS = {
|
|
|
15872
15872
|
interactive: Boolean
|
|
15873
15873
|
};
|
|
15874
15874
|
const EVENT_DATE_REFINERS = {
|
|
15875
|
-
start: identity$
|
|
15876
|
-
end: identity$
|
|
15877
|
-
date: identity$
|
|
15875
|
+
start: identity$4,
|
|
15876
|
+
end: identity$4,
|
|
15877
|
+
date: identity$4,
|
|
15878
15878
|
allDay: Boolean
|
|
15879
15879
|
};
|
|
15880
|
-
const EVENT_REFINERS$1 = Object.assign(Object.assign(Object.assign({}, EVENT_NON_DATE_REFINERS), EVENT_DATE_REFINERS), { extendedProps: identity$
|
|
15880
|
+
const EVENT_REFINERS$1 = Object.assign(Object.assign(Object.assign({}, EVENT_NON_DATE_REFINERS), EVENT_DATE_REFINERS), { extendedProps: identity$4 });
|
|
15881
15881
|
function parseEvent(raw, eventSource, context, allowOpenRange, refiners = buildEventRefiners(context), defIdMap, instanceIdMap) {
|
|
15882
15882
|
let { refined, extra } = refineEventDef(raw, context, refiners);
|
|
15883
15883
|
let defaultAllDay = computeIsDefaultAllDay(eventSource, context);
|
|
@@ -16082,9 +16082,9 @@ const EVENT_UI_REFINERS = {
|
|
|
16082
16082
|
editable: Boolean,
|
|
16083
16083
|
startEditable: Boolean,
|
|
16084
16084
|
durationEditable: Boolean,
|
|
16085
|
-
constraint: identity$
|
|
16086
|
-
overlap: identity$
|
|
16087
|
-
allow: identity$
|
|
16085
|
+
constraint: identity$4,
|
|
16086
|
+
overlap: identity$4,
|
|
16087
|
+
allow: identity$4,
|
|
16088
16088
|
className: parseClassNames,
|
|
16089
16089
|
classNames: parseClassNames,
|
|
16090
16090
|
color: String,
|
|
@@ -16142,11 +16142,11 @@ const EVENT_SOURCE_REFINERS = {
|
|
|
16142
16142
|
defaultAllDay: Boolean,
|
|
16143
16143
|
url: String,
|
|
16144
16144
|
format: String,
|
|
16145
|
-
events: identity$
|
|
16146
|
-
eventDataTransform: identity$
|
|
16145
|
+
events: identity$4,
|
|
16146
|
+
eventDataTransform: identity$4,
|
|
16147
16147
|
// for any network-related sources
|
|
16148
|
-
success: identity$
|
|
16149
|
-
failure: identity$
|
|
16148
|
+
success: identity$4,
|
|
16149
|
+
failure: identity$4
|
|
16150
16150
|
};
|
|
16151
16151
|
function parseEventSource(raw, context, refiners = buildEventSourceRefiners(context)) {
|
|
16152
16152
|
let rawObj;
|
|
@@ -17148,8 +17148,8 @@ function getSegAnchorAttrs(seg, context) {
|
|
|
17148
17148
|
return {};
|
|
17149
17149
|
}
|
|
17150
17150
|
const STANDARD_PROPS = {
|
|
17151
|
-
start: identity$
|
|
17152
|
-
end: identity$
|
|
17151
|
+
start: identity$4,
|
|
17152
|
+
end: identity$4,
|
|
17153
17153
|
allDay: Boolean
|
|
17154
17154
|
};
|
|
17155
17155
|
function parseDateSpan(raw, dateEnv, defaultDuration) {
|
|
@@ -20770,7 +20770,7 @@ const funcEventSourcePlugin = createPlugin({
|
|
|
20770
20770
|
});
|
|
20771
20771
|
const JSON_FEED_EVENT_SOURCE_REFINERS = {
|
|
20772
20772
|
method: String,
|
|
20773
|
-
extraParams: identity$
|
|
20773
|
+
extraParams: identity$4,
|
|
20774
20774
|
startParam: String,
|
|
20775
20775
|
endParam: String,
|
|
20776
20776
|
timeZoneParam: String
|
|
@@ -20836,12 +20836,12 @@ function buildRequestParams$1(meta, range2, context) {
|
|
|
20836
20836
|
return params;
|
|
20837
20837
|
}
|
|
20838
20838
|
const SIMPLE_RECURRING_REFINERS = {
|
|
20839
|
-
daysOfWeek: identity$
|
|
20839
|
+
daysOfWeek: identity$4,
|
|
20840
20840
|
startTime: createDuration,
|
|
20841
20841
|
endTime: createDuration,
|
|
20842
20842
|
duration: createDuration,
|
|
20843
|
-
startRecur: identity$
|
|
20844
|
-
endRecur: identity$
|
|
20843
|
+
startRecur: identity$4,
|
|
20844
|
+
endRecur: identity$4
|
|
20845
20845
|
};
|
|
20846
20846
|
let recurring = {
|
|
20847
20847
|
parse(refined, dateEnv) {
|
|
@@ -23327,10 +23327,10 @@ injectStyles(css_248z$3);
|
|
|
23327
23327
|
const OPTION_REFINERS$4 = {
|
|
23328
23328
|
listDayFormat: createFalsableFormatter,
|
|
23329
23329
|
listDaySideFormat: createFalsableFormatter,
|
|
23330
|
-
noEventsClassNames: identity$
|
|
23331
|
-
noEventsContent: identity$
|
|
23332
|
-
noEventsDidMount: identity$
|
|
23333
|
-
noEventsWillUnmount: identity$
|
|
23330
|
+
noEventsClassNames: identity$4,
|
|
23331
|
+
noEventsContent: identity$4,
|
|
23332
|
+
noEventsDidMount: identity$4,
|
|
23333
|
+
noEventsWillUnmount: identity$4
|
|
23334
23334
|
// noEventsText is defined in base options
|
|
23335
23335
|
};
|
|
23336
23336
|
function createFalsableFormatter(input) {
|
|
@@ -24022,12 +24022,12 @@ class FeaturefulElementDragging extends ElementDragging {
|
|
|
24022
24022
|
}
|
|
24023
24023
|
}
|
|
24024
24024
|
};
|
|
24025
|
-
let
|
|
24026
|
-
|
|
24027
|
-
|
|
24028
|
-
|
|
24025
|
+
let pointer2 = this.pointer = new PointerDragging(containerEl);
|
|
24026
|
+
pointer2.emitter.on("pointerdown", this.onPointerDown);
|
|
24027
|
+
pointer2.emitter.on("pointermove", this.onPointerMove);
|
|
24028
|
+
pointer2.emitter.on("pointerup", this.onPointerUp);
|
|
24029
24029
|
if (selector2) {
|
|
24030
|
-
|
|
24030
|
+
pointer2.selector = selector2;
|
|
24031
24031
|
}
|
|
24032
24032
|
this.mirror = new ElementMirror();
|
|
24033
24033
|
this.autoScroller = new AutoScroller();
|
|
@@ -24299,8 +24299,8 @@ class DateClicking extends Interaction {
|
|
|
24299
24299
|
};
|
|
24300
24300
|
this.handleDragEnd = (ev) => {
|
|
24301
24301
|
let { component } = this;
|
|
24302
|
-
let { pointer } = this.dragging;
|
|
24303
|
-
if (!
|
|
24302
|
+
let { pointer: pointer2 } = this.dragging;
|
|
24303
|
+
if (!pointer2.wasTouchScroll) {
|
|
24304
24304
|
let { initialHit, finalHit } = this.hitDragging;
|
|
24305
24305
|
if (initialHit && finalHit && isHitsEqual(initialHit, finalHit)) {
|
|
24306
24306
|
let { context } = component;
|
|
@@ -24922,19 +24922,19 @@ class UnselectAuto {
|
|
|
24922
24922
|
}
|
|
24923
24923
|
}
|
|
24924
24924
|
const OPTION_REFINERS$3 = {
|
|
24925
|
-
fixedMirrorParent: identity$
|
|
24925
|
+
fixedMirrorParent: identity$4
|
|
24926
24926
|
};
|
|
24927
24927
|
const LISTENER_REFINERS$1 = {
|
|
24928
|
-
dateClick: identity$
|
|
24929
|
-
eventDragStart: identity$
|
|
24930
|
-
eventDragStop: identity$
|
|
24931
|
-
eventDrop: identity$
|
|
24932
|
-
eventResizeStart: identity$
|
|
24933
|
-
eventResizeStop: identity$
|
|
24934
|
-
eventResize: identity$
|
|
24935
|
-
drop: identity$
|
|
24936
|
-
eventReceive: identity$
|
|
24937
|
-
eventLeave: identity$
|
|
24928
|
+
dateClick: identity$4,
|
|
24929
|
+
eventDragStart: identity$4,
|
|
24930
|
+
eventDragStop: identity$4,
|
|
24931
|
+
eventDrop: identity$4,
|
|
24932
|
+
eventResizeStart: identity$4,
|
|
24933
|
+
eventResizeStop: identity$4,
|
|
24934
|
+
eventResize: identity$4,
|
|
24935
|
+
drop: identity$4,
|
|
24936
|
+
eventReceive: identity$4,
|
|
24937
|
+
eventLeave: identity$4
|
|
24938
24938
|
};
|
|
24939
24939
|
config.dataAttrPrefix = "";
|
|
24940
24940
|
var index$6 = createPlugin({
|
|
@@ -26215,17 +26215,17 @@ const PRIVATE_ID_PREFIX = "_fc:";
|
|
|
26215
26215
|
const RESOURCE_REFINERS = {
|
|
26216
26216
|
id: String,
|
|
26217
26217
|
parentId: String,
|
|
26218
|
-
children: identity$
|
|
26218
|
+
children: identity$4,
|
|
26219
26219
|
title: String,
|
|
26220
|
-
businessHours: identity$
|
|
26221
|
-
extendedProps: identity$
|
|
26220
|
+
businessHours: identity$4,
|
|
26221
|
+
extendedProps: identity$4,
|
|
26222
26222
|
// event-ui
|
|
26223
26223
|
eventEditable: Boolean,
|
|
26224
26224
|
eventStartEditable: Boolean,
|
|
26225
26225
|
eventDurationEditable: Boolean,
|
|
26226
|
-
eventConstraint: identity$
|
|
26226
|
+
eventConstraint: identity$4,
|
|
26227
26227
|
eventOverlap: Boolean,
|
|
26228
|
-
eventAllow: identity$
|
|
26228
|
+
eventAllow: identity$4,
|
|
26229
26229
|
eventClassNames: parseClassNames,
|
|
26230
26230
|
eventBackgroundColor: String,
|
|
26231
26231
|
eventBorderColor: String,
|
|
@@ -27127,14 +27127,14 @@ function getResourceSourceDefs() {
|
|
|
27127
27127
|
const RESOURCE_SOURCE_REFINERS = {
|
|
27128
27128
|
id: String,
|
|
27129
27129
|
// for array. TODO: move to resource-array
|
|
27130
|
-
resources: identity$
|
|
27130
|
+
resources: identity$4,
|
|
27131
27131
|
// for json feed. TODO: move to resource-json-feed
|
|
27132
27132
|
url: String,
|
|
27133
27133
|
method: String,
|
|
27134
27134
|
startParam: String,
|
|
27135
27135
|
endParam: String,
|
|
27136
27136
|
timeZoneParam: String,
|
|
27137
|
-
extraParams: identity$
|
|
27137
|
+
extraParams: identity$4
|
|
27138
27138
|
};
|
|
27139
27139
|
function parseResourceSource(input) {
|
|
27140
27140
|
let inputObj;
|
|
@@ -27328,7 +27328,7 @@ function reduceResources(state, action, context) {
|
|
|
27328
27328
|
}
|
|
27329
27329
|
const EVENT_REFINERS = {
|
|
27330
27330
|
resourceId: String,
|
|
27331
|
-
resourceIds: identity$
|
|
27331
|
+
resourceIds: identity$4,
|
|
27332
27332
|
resourceEditable: Boolean
|
|
27333
27333
|
};
|
|
27334
27334
|
function generateEventDefResourceMembers(refined) {
|
|
@@ -27471,44 +27471,44 @@ function handleResources(newSourceInput, context) {
|
|
|
27471
27471
|
}
|
|
27472
27472
|
}
|
|
27473
27473
|
const OPTION_REFINERS = {
|
|
27474
|
-
initialResources: identity$
|
|
27475
|
-
resources: identity$
|
|
27474
|
+
initialResources: identity$4,
|
|
27475
|
+
resources: identity$4,
|
|
27476
27476
|
eventResourceEditable: Boolean,
|
|
27477
27477
|
refetchResourcesOnNavigate: Boolean,
|
|
27478
27478
|
resourceOrder: parseFieldSpecs,
|
|
27479
27479
|
filterResourcesWithEvents: Boolean,
|
|
27480
27480
|
resourceGroupField: String,
|
|
27481
|
-
resourceAreaWidth: identity$
|
|
27482
|
-
resourceAreaColumns: identity$
|
|
27481
|
+
resourceAreaWidth: identity$4,
|
|
27482
|
+
resourceAreaColumns: identity$4,
|
|
27483
27483
|
resourcesInitiallyExpanded: Boolean,
|
|
27484
27484
|
datesAboveResources: Boolean,
|
|
27485
27485
|
needsResourceData: Boolean,
|
|
27486
|
-
resourceAreaHeaderClassNames: identity$
|
|
27487
|
-
resourceAreaHeaderContent: identity$
|
|
27488
|
-
resourceAreaHeaderDidMount: identity$
|
|
27489
|
-
resourceAreaHeaderWillUnmount: identity$
|
|
27490
|
-
resourceGroupLabelClassNames: identity$
|
|
27491
|
-
resourceGroupLabelContent: identity$
|
|
27492
|
-
resourceGroupLabelDidMount: identity$
|
|
27493
|
-
resourceGroupLabelWillUnmount: identity$
|
|
27494
|
-
resourceLabelClassNames: identity$
|
|
27495
|
-
resourceLabelContent: identity$
|
|
27496
|
-
resourceLabelDidMount: identity$
|
|
27497
|
-
resourceLabelWillUnmount: identity$
|
|
27498
|
-
resourceLaneClassNames: identity$
|
|
27499
|
-
resourceLaneContent: identity$
|
|
27500
|
-
resourceLaneDidMount: identity$
|
|
27501
|
-
resourceLaneWillUnmount: identity$
|
|
27502
|
-
resourceGroupLaneClassNames: identity$
|
|
27503
|
-
resourceGroupLaneContent: identity$
|
|
27504
|
-
resourceGroupLaneDidMount: identity$
|
|
27505
|
-
resourceGroupLaneWillUnmount: identity$
|
|
27486
|
+
resourceAreaHeaderClassNames: identity$4,
|
|
27487
|
+
resourceAreaHeaderContent: identity$4,
|
|
27488
|
+
resourceAreaHeaderDidMount: identity$4,
|
|
27489
|
+
resourceAreaHeaderWillUnmount: identity$4,
|
|
27490
|
+
resourceGroupLabelClassNames: identity$4,
|
|
27491
|
+
resourceGroupLabelContent: identity$4,
|
|
27492
|
+
resourceGroupLabelDidMount: identity$4,
|
|
27493
|
+
resourceGroupLabelWillUnmount: identity$4,
|
|
27494
|
+
resourceLabelClassNames: identity$4,
|
|
27495
|
+
resourceLabelContent: identity$4,
|
|
27496
|
+
resourceLabelDidMount: identity$4,
|
|
27497
|
+
resourceLabelWillUnmount: identity$4,
|
|
27498
|
+
resourceLaneClassNames: identity$4,
|
|
27499
|
+
resourceLaneContent: identity$4,
|
|
27500
|
+
resourceLaneDidMount: identity$4,
|
|
27501
|
+
resourceLaneWillUnmount: identity$4,
|
|
27502
|
+
resourceGroupLaneClassNames: identity$4,
|
|
27503
|
+
resourceGroupLaneContent: identity$4,
|
|
27504
|
+
resourceGroupLaneDidMount: identity$4,
|
|
27505
|
+
resourceGroupLaneWillUnmount: identity$4
|
|
27506
27506
|
};
|
|
27507
27507
|
const LISTENER_REFINERS = {
|
|
27508
|
-
resourcesSet: identity$
|
|
27509
|
-
resourceAdd: identity$
|
|
27510
|
-
resourceChange: identity$
|
|
27511
|
-
resourceRemove: identity$
|
|
27508
|
+
resourcesSet: identity$4,
|
|
27509
|
+
resourceAdd: identity$4,
|
|
27510
|
+
resourceChange: identity$4,
|
|
27511
|
+
resourceRemove: identity$4
|
|
27512
27512
|
};
|
|
27513
27513
|
EventImpl.prototype.getResources = function() {
|
|
27514
27514
|
let { calendarApi } = this._context;
|
|
@@ -42985,9 +42985,9 @@ var DataGrid = (p2, forwardedRef) => {
|
|
|
42985
42985
|
), /* @__PURE__ */ React.createElement("canvas", { ref: overlayRef, style: overlayStyle }), stickyShadow);
|
|
42986
42986
|
};
|
|
42987
42987
|
var data_grid_default = React.memo(React.forwardRef(DataGrid));
|
|
42988
|
-
function offsetColumnSize(column, width,
|
|
42988
|
+
function offsetColumnSize(column, width, min2, max2) {
|
|
42989
42989
|
var _a;
|
|
42990
|
-
return clamp5(Math.round(width - ((_a = column.growOffset) != null ? _a : 0)), Math.ceil(
|
|
42990
|
+
return clamp5(Math.round(width - ((_a = column.growOffset) != null ? _a : 0)), Math.ceil(min2), Math.floor(max2));
|
|
42991
42991
|
}
|
|
42992
42992
|
var DataGridDnd = (p2) => {
|
|
42993
42993
|
var _a;
|
|
@@ -45615,7 +45615,7 @@ var newRowCellRenderer = {
|
|
|
45615
45615
|
onPaste: () => void 0
|
|
45616
45616
|
};
|
|
45617
45617
|
var NumberOverlayEditor = React.lazy(
|
|
45618
|
-
async () => await import("./number-overlay-editor-FPDVTUA6-
|
|
45618
|
+
async () => await import("./number-overlay-editor-FPDVTUA6-CIQKpJh_.esm.js")
|
|
45619
45619
|
);
|
|
45620
45620
|
var numberCellRenderer = {
|
|
45621
45621
|
getAccessibilityString: (c2) => {
|
|
@@ -49325,7 +49325,7 @@ var renderer5 = {
|
|
|
49325
49325
|
})
|
|
49326
49326
|
};
|
|
49327
49327
|
var dropdown_cell_default = renderer5;
|
|
49328
|
-
var ArticleCellEditor = React.lazy(async () => await import("./article-cell-editor-JDI676YI-
|
|
49328
|
+
var ArticleCellEditor = React.lazy(async () => await import("./article-cell-editor-JDI676YI-Dc_C73-P.esm.js"));
|
|
49329
49329
|
var renderer6 = {
|
|
49330
49330
|
kind: GridCellKind.Custom,
|
|
49331
49331
|
isMatch: (c2) => c2.data.kind === "article-cell",
|
|
@@ -49383,11 +49383,11 @@ var renderer7 = {
|
|
|
49383
49383
|
isMatch: (c2) => c2.data.kind === "range-cell",
|
|
49384
49384
|
draw: (args, cell) => {
|
|
49385
49385
|
const { ctx, theme, rect } = args;
|
|
49386
|
-
const { min, max: max2, value, label, measureLabel } = cell.data;
|
|
49386
|
+
const { min: min2, max: max2, value, label, measureLabel } = cell.data;
|
|
49387
49387
|
const x2 = rect.x + theme.cellHorizontalPadding;
|
|
49388
49388
|
const yMid = rect.y + rect.height / 2;
|
|
49389
|
-
const rangeSize = max2 -
|
|
49390
|
-
const fillRatio = (value -
|
|
49389
|
+
const rangeSize = max2 - min2;
|
|
49390
|
+
const fillRatio = (value - min2) / rangeSize;
|
|
49391
49391
|
ctx.save();
|
|
49392
49392
|
let labelWidth = 0;
|
|
49393
49393
|
if (label !== void 0) {
|
|
@@ -50366,21 +50366,7 @@ const generateMenuItems$1 = ({
|
|
|
50366
50366
|
const items = [];
|
|
50367
50367
|
if (!multiple) {
|
|
50368
50368
|
items.push(
|
|
50369
|
-
/* @__PURE__ */ jsx(
|
|
50370
|
-
MenuItem,
|
|
50371
|
-
{
|
|
50372
|
-
disabled: true,
|
|
50373
|
-
value: "",
|
|
50374
|
-
sx: {
|
|
50375
|
-
opacity: `0 !important`,
|
|
50376
|
-
height: `0 !important`,
|
|
50377
|
-
p: `0 !important`,
|
|
50378
|
-
m: `0 !important`
|
|
50379
|
-
},
|
|
50380
|
-
children: /* @__PURE__ */ jsx(Typography$1, { type: "s3", color: "theme.secondary.1000", children: /* @__PURE__ */ jsx("em", { children: t2(placeholder) }) })
|
|
50381
|
-
},
|
|
50382
|
-
"placeholder"
|
|
50383
|
-
)
|
|
50369
|
+
/* @__PURE__ */ jsx(MenuItem, { disabled: true, value: "", sx: { opacity: `0 !important`, height: `0 !important`, p: `0 !important`, m: `0 !important` }, children: /* @__PURE__ */ jsx(Typography$1, { type: "s3", color: "theme.secondary.1000", children: /* @__PURE__ */ jsx("em", { children: t2(placeholder) }) }) }, "placeholder")
|
|
50384
50370
|
);
|
|
50385
50371
|
}
|
|
50386
50372
|
const selectedValues = Array.isArray(values) && (values == null ? void 0 : values.length) > 0 ? values == null ? void 0 : values.filter((value) => value) : values;
|
|
@@ -50388,9 +50374,7 @@ const generateMenuItems$1 = ({
|
|
|
50388
50374
|
const childValues = childOptions.map((child) => child.value);
|
|
50389
50375
|
const valueArray = Array.isArray(selectedValues) ? selectedValues : [selectedValues];
|
|
50390
50376
|
const isParentSelected = valueArray.includes(parentValue);
|
|
50391
|
-
const updatedValues = isParentSelected ? valueArray.filter(
|
|
50392
|
-
(value) => value !== parentValue && !childValues.includes(value)
|
|
50393
|
-
) : [.../* @__PURE__ */ new Set([...valueArray, parentValue, ...childValues])];
|
|
50377
|
+
const updatedValues = isParentSelected ? valueArray.filter((value) => value !== parentValue && !childValues.includes(value)) : [.../* @__PURE__ */ new Set([...valueArray, parentValue, ...childValues])];
|
|
50394
50378
|
onChange(updatedValues);
|
|
50395
50379
|
handleChange == null ? void 0 : handleChange(updatedValues);
|
|
50396
50380
|
};
|
|
@@ -50417,9 +50401,7 @@ const generateMenuItems$1 = ({
|
|
|
50417
50401
|
multiple && with_checkboxes && /* @__PURE__ */ jsx(
|
|
50418
50402
|
Checkbox,
|
|
50419
50403
|
{
|
|
50420
|
-
checked: hasParent ? isAllOptionsSelected(option.value, option.options || []) : Boolean(
|
|
50421
|
-
Array.isArray(selectedValues) ? selectedValues.includes(option.value) : selectedValues == option.value
|
|
50422
|
-
),
|
|
50404
|
+
checked: hasParent ? isAllOptionsSelected(option.value, option.options || []) : Boolean(Array.isArray(selectedValues) ? selectedValues.includes(option.value) : selectedValues == option.value),
|
|
50423
50405
|
indeterminate: hasParent && isSomeOptionsSelected(option.options || []),
|
|
50424
50406
|
onChange: () => hasParent ? handleParentChange(option.value, option.options || []) : handleChange == null ? void 0 : handleChange(option.value)
|
|
50425
50407
|
}
|
|
@@ -50451,9 +50433,7 @@ const generateMenuItems$1 = ({
|
|
|
50451
50433
|
multiple && with_checkboxes && /* @__PURE__ */ jsx(
|
|
50452
50434
|
Checkbox,
|
|
50453
50435
|
{
|
|
50454
|
-
checked: Boolean(
|
|
50455
|
-
Array.isArray(values) && values.includes(opt.value)
|
|
50456
|
-
)
|
|
50436
|
+
checked: Boolean(Array.isArray(values) && values.includes(opt.value))
|
|
50457
50437
|
}
|
|
50458
50438
|
),
|
|
50459
50439
|
/* @__PURE__ */ jsx(
|
|
@@ -50477,13 +50457,7 @@ const generateMenuItems$1 = ({
|
|
|
50477
50457
|
if (field.enable_footer) {
|
|
50478
50458
|
items.push(
|
|
50479
50459
|
/* @__PURE__ */ jsxs(Box, { children: [
|
|
50480
|
-
/* @__PURE__ */ jsx(
|
|
50481
|
-
Divider,
|
|
50482
|
-
{
|
|
50483
|
-
flexItem: true,
|
|
50484
|
-
sx: { mt: "0.25rem !important", mb: "0.25rem !important" }
|
|
50485
|
-
}
|
|
50486
|
-
),
|
|
50460
|
+
/* @__PURE__ */ jsx(Divider, { flexItem: true, sx: { mt: "0.25rem !important", mb: "0.25rem !important" } }),
|
|
50487
50461
|
/* @__PURE__ */ jsxs(MenuItem, { sx: { gap: 1 }, onClick: onFooterClick, children: [
|
|
50488
50462
|
/* @__PURE__ */ jsx(Add, { fontSize: "small" }),
|
|
50489
50463
|
/* @__PURE__ */ jsxs(Typography$1, { type: "s4", color: "theme.secondary.1000", children: [
|
|
@@ -50523,529 +50497,454 @@ const SelectedItems$1 = ({ data, options }) => {
|
|
|
50523
50497
|
);
|
|
50524
50498
|
};
|
|
50525
50499
|
const Loading = () => /* @__PURE__ */ jsx(Typography$1, { fontStyle: "italic", color: "inherit", type: "s3", children: "Loading..." });
|
|
50526
|
-
const DynamicSearchSelect = React__default.memo(
|
|
50527
|
-
|
|
50528
|
-
|
|
50529
|
-
|
|
50530
|
-
|
|
50531
|
-
|
|
50532
|
-
|
|
50533
|
-
|
|
50534
|
-
|
|
50535
|
-
|
|
50536
|
-
|
|
50537
|
-
|
|
50538
|
-
|
|
50539
|
-
|
|
50540
|
-
|
|
50541
|
-
|
|
50542
|
-
|
|
50543
|
-
|
|
50544
|
-
|
|
50545
|
-
|
|
50546
|
-
|
|
50547
|
-
|
|
50548
|
-
|
|
50549
|
-
|
|
50550
|
-
|
|
50551
|
-
|
|
50552
|
-
|
|
50553
|
-
|
|
50554
|
-
|
|
50555
|
-
|
|
50556
|
-
|
|
50557
|
-
|
|
50558
|
-
|
|
50559
|
-
|
|
50560
|
-
|
|
50561
|
-
|
|
50562
|
-
|
|
50563
|
-
|
|
50564
|
-
|
|
50565
|
-
|
|
50566
|
-
|
|
50567
|
-
|
|
50568
|
-
|
|
50569
|
-
|
|
50570
|
-
|
|
50571
|
-
|
|
50572
|
-
|
|
50573
|
-
|
|
50574
|
-
|
|
50575
|
-
|
|
50576
|
-
|
|
50577
|
-
|
|
50578
|
-
|
|
50579
|
-
|
|
50580
|
-
|
|
50581
|
-
|
|
50582
|
-
|
|
50583
|
-
|
|
50584
|
-
|
|
50585
|
-
|
|
50586
|
-
|
|
50587
|
-
if (searchedOptions == null ? void 0 : searchedOptions.length) {
|
|
50588
|
-
acc.push({ ...opt, options: searchedOptions });
|
|
50589
|
-
}
|
|
50590
|
-
return acc;
|
|
50591
|
-
}, [])) || [] : ((_b = props.options) == null ? void 0 : _b.filter((opt) => {
|
|
50592
|
-
const label = React__default.isValidElement(opt.label) ? opt.searchLabel : String(opt.label);
|
|
50593
|
-
return label == null ? void 0 : label.toLowerCase().includes(lowercasedSearchTerm);
|
|
50594
|
-
})) || [];
|
|
50595
|
-
return sortBySelectedValues(filteredOptions2, value);
|
|
50596
|
-
},
|
|
50597
|
-
[props.options, hasParent]
|
|
50598
|
-
);
|
|
50599
|
-
const getUniqueOptions = useCallback((data) => {
|
|
50600
|
-
const uniqueOptions = [
|
|
50601
|
-
...new Map(data == null ? void 0 : data.map((item) => [item.value, item])).values()
|
|
50602
|
-
];
|
|
50603
|
-
return uniqueOptions;
|
|
50604
|
-
}, []);
|
|
50605
|
-
const sortBySelectedValues = useCallback(
|
|
50606
|
-
(arrayToSort, value) => {
|
|
50607
|
-
const selectedValues = Array.isArray(value) ? value : [value];
|
|
50608
|
-
const sortedValue = sortBy(arrayToSort, (item) => {
|
|
50609
|
-
const index2 = selectedValues.indexOf(item.id || item.value);
|
|
50610
|
-
return index2 == -1 ? Infinity : index2;
|
|
50611
|
-
});
|
|
50612
|
-
return sortedValue;
|
|
50613
|
-
},
|
|
50614
|
-
[]
|
|
50615
|
-
);
|
|
50616
|
-
const filteredOptions = useMemo(() => {
|
|
50617
|
-
if (isInternalOptions) {
|
|
50618
|
-
return searchOptionsLocally(searchQuery, watchedValue);
|
|
50500
|
+
const DynamicSearchSelect = React__default.memo((props) => {
|
|
50501
|
+
const watchedValue = useWatch({
|
|
50502
|
+
control: props.formControl,
|
|
50503
|
+
name: `${props.fieldArrayName}.${props.name}`
|
|
50504
|
+
});
|
|
50505
|
+
const formContext = useFormContext();
|
|
50506
|
+
const { setValue } = formContext || {};
|
|
50507
|
+
const { t: t2 } = useTranslation();
|
|
50508
|
+
const { isRtl } = useLanguage();
|
|
50509
|
+
const selectRef = useRef(null);
|
|
50510
|
+
const [options, setOptions] = useState([]);
|
|
50511
|
+
const [selectedValue, setSelectedValue] = useState(null);
|
|
50512
|
+
const [selectedOptions, setSelectedOptions] = useState([]);
|
|
50513
|
+
const [loading, setLoading] = useState(false);
|
|
50514
|
+
const [open, setOpen] = useState(false);
|
|
50515
|
+
const [isAlreadyLoaded, setIsAlreadyLoaded] = useState(false);
|
|
50516
|
+
const [prevFilter, setPrevFilter] = useState(null);
|
|
50517
|
+
const [initialLoading, setInitialLoading] = useState(false);
|
|
50518
|
+
const [searchQuery, setSearchQuery] = useState("");
|
|
50519
|
+
const [searchInitiate, setSearchInitiate] = useState(false);
|
|
50520
|
+
const [addConfig, setAddConfig] = useState(null);
|
|
50521
|
+
const [isModalOpen, setIsModalOpen] = useState(false);
|
|
50522
|
+
const [isAddLoading, setIsAddLoading] = useState(false);
|
|
50523
|
+
const [pagination, setPagination] = useState({
|
|
50524
|
+
page: 1,
|
|
50525
|
+
hasMore: true,
|
|
50526
|
+
isLoadingMore: false,
|
|
50527
|
+
total: 0
|
|
50528
|
+
});
|
|
50529
|
+
const {
|
|
50530
|
+
handleOptions,
|
|
50531
|
+
isInternal = false,
|
|
50532
|
+
disabledIds = [],
|
|
50533
|
+
getSelectedData,
|
|
50534
|
+
attributes = [],
|
|
50535
|
+
filterKey: filterKey2 = "id",
|
|
50536
|
+
customeFilter = {},
|
|
50537
|
+
refresh,
|
|
50538
|
+
handleChange,
|
|
50539
|
+
hasParent = false,
|
|
50540
|
+
sortOrder = "id:-1",
|
|
50541
|
+
apiType,
|
|
50542
|
+
addType
|
|
50543
|
+
} = props;
|
|
50544
|
+
const limit = 25;
|
|
50545
|
+
const isInternalOptions = useMemo(() => {
|
|
50546
|
+
return isInternal || !apiType;
|
|
50547
|
+
}, [isInternal, apiType]);
|
|
50548
|
+
const cf = useMemo(() => customeFilter, [JSON.stringify(customeFilter)]);
|
|
50549
|
+
const searchOptionsLocally = useCallback((searchTerm, value) => {
|
|
50550
|
+
var _a, _b;
|
|
50551
|
+
if (!searchTerm) return props.options || [];
|
|
50552
|
+
const lowercasedSearchTerm = searchTerm.toLowerCase();
|
|
50553
|
+
const filteredOptions2 = hasParent ? ((_a = props.options) == null ? void 0 : _a.reduce((acc, opt) => {
|
|
50554
|
+
var _a2;
|
|
50555
|
+
const searchedOptions = (_a2 = opt.options) == null ? void 0 : _a2.filter((item) => {
|
|
50556
|
+
const label = React__default.isValidElement(item.label) ? item.searchLabel : String(item.label);
|
|
50557
|
+
return label == null ? void 0 : label.toLowerCase().includes(lowercasedSearchTerm);
|
|
50558
|
+
});
|
|
50559
|
+
if (searchedOptions == null ? void 0 : searchedOptions.length) {
|
|
50560
|
+
acc.push({ ...opt, options: searchedOptions });
|
|
50619
50561
|
}
|
|
50620
|
-
return
|
|
50621
|
-
|
|
50622
|
-
|
|
50623
|
-
);
|
|
50624
|
-
}
|
|
50625
|
-
|
|
50626
|
-
|
|
50627
|
-
|
|
50628
|
-
|
|
50629
|
-
|
|
50630
|
-
|
|
50631
|
-
|
|
50632
|
-
|
|
50633
|
-
|
|
50634
|
-
]
|
|
50635
|
-
const
|
|
50636
|
-
|
|
50637
|
-
|
|
50638
|
-
|
|
50639
|
-
|
|
50640
|
-
|
|
50641
|
-
|
|
50642
|
-
|
|
50643
|
-
|
|
50644
|
-
|
|
50645
|
-
|
|
50646
|
-
|
|
50647
|
-
|
|
50648
|
-
|
|
50649
|
-
|
|
50650
|
-
|
|
50651
|
-
|
|
50652
|
-
|
|
50653
|
-
|
|
50654
|
-
|
|
50655
|
-
|
|
50656
|
-
|
|
50657
|
-
|
|
50658
|
-
|
|
50659
|
-
|
|
50660
|
-
|
|
50661
|
-
|
|
50662
|
-
|
|
50663
|
-
isLoadingMore: false
|
|
50664
|
-
}));
|
|
50665
|
-
}
|
|
50666
|
-
return data || [];
|
|
50667
|
-
} catch (error) {
|
|
50668
|
-
console.error("Error fetching options:", error);
|
|
50669
|
-
setPagination((prev) => ({ ...prev, isLoadingMore: false }));
|
|
50670
|
-
return [];
|
|
50671
|
-
} finally {
|
|
50672
|
-
setLoading(false);
|
|
50673
|
-
}
|
|
50674
|
-
},
|
|
50675
|
-
[apiType, options, attributes, sortOrder, limit, cf]
|
|
50676
|
-
);
|
|
50677
|
-
const handleScroll = useCallback(
|
|
50678
|
-
(event) => {
|
|
50679
|
-
const { scrollTop, scrollHeight, clientHeight } = event.currentTarget;
|
|
50680
|
-
const isBottom = scrollHeight - scrollTop <= clientHeight + 10;
|
|
50681
|
-
if (isBottom && pagination.hasMore && !pagination.isLoadingMore && !isInternalOptions) {
|
|
50682
|
-
const nextPage = pagination.page + 1;
|
|
50683
|
-
fetchOptions(searchQuery, cf, nextPage, true);
|
|
50684
|
-
}
|
|
50685
|
-
},
|
|
50686
|
-
[
|
|
50687
|
-
pagination.hasMore,
|
|
50688
|
-
pagination.isLoadingMore,
|
|
50689
|
-
pagination.page,
|
|
50690
|
-
isInternalOptions,
|
|
50691
|
-
searchQuery,
|
|
50692
|
-
cf,
|
|
50693
|
-
fetchOptions
|
|
50694
|
-
]
|
|
50695
|
-
);
|
|
50696
|
-
const updateOptions = useCallback(
|
|
50697
|
-
(newOptions, append2 = false) => {
|
|
50698
|
-
const oldOptions = append2 ? options : selectedOptions;
|
|
50699
|
-
const uniqueOptions = getUniqueOptions([...oldOptions, ...newOptions]);
|
|
50700
|
-
setOptions(uniqueOptions);
|
|
50701
|
-
},
|
|
50702
|
-
[options, selectedOptions, getUniqueOptions]
|
|
50703
|
-
);
|
|
50704
|
-
const handleSelectedValue = useCallback(
|
|
50705
|
-
async (updateOptions2) => {
|
|
50706
|
-
const filterValue = props.is_multiselect ? watchedValue : [watchedValue];
|
|
50707
|
-
const isInOptions = updateOptions2 == null ? void 0 : updateOptions2.filter(
|
|
50708
|
-
(item) => Array.isArray(filterValue) ? filterValue.includes(item.id || item.value) : (item[filterKey2] || item.value || item.id) == filterValue
|
|
50709
|
-
);
|
|
50710
|
-
if (Array.isArray(isInOptions) && isInOptions.length > 0) {
|
|
50711
|
-
getSelectedData == null ? void 0 : getSelectedData(
|
|
50712
|
-
props.is_multiselect ? isInOptions : isInOptions[0],
|
|
50713
|
-
props.name
|
|
50714
|
-
);
|
|
50715
|
-
return true;
|
|
50562
|
+
return acc;
|
|
50563
|
+
}, [])) || [] : ((_b = props.options) == null ? void 0 : _b.filter((opt) => {
|
|
50564
|
+
const label = React__default.isValidElement(opt.label) ? opt.searchLabel : String(opt.label);
|
|
50565
|
+
return label == null ? void 0 : label.toLowerCase().includes(lowercasedSearchTerm);
|
|
50566
|
+
})) || [];
|
|
50567
|
+
return sortBySelectedValues(filteredOptions2, value);
|
|
50568
|
+
}, [props.options, hasParent]);
|
|
50569
|
+
const getUniqueOptions = useCallback((data) => {
|
|
50570
|
+
const uniqueOptions = [
|
|
50571
|
+
...new Map(data == null ? void 0 : data.map((item) => [item.value, item])).values()
|
|
50572
|
+
];
|
|
50573
|
+
return uniqueOptions;
|
|
50574
|
+
}, []);
|
|
50575
|
+
const sortBySelectedValues = useCallback((arrayToSort, value) => {
|
|
50576
|
+
const selectedValues = Array.isArray(value) ? value : [value];
|
|
50577
|
+
const sortedValue = sortBy(arrayToSort, (item) => {
|
|
50578
|
+
const index2 = selectedValues.indexOf(item.id || item.value);
|
|
50579
|
+
return index2 == -1 ? Infinity : index2;
|
|
50580
|
+
});
|
|
50581
|
+
return sortedValue;
|
|
50582
|
+
}, []);
|
|
50583
|
+
const filteredOptions = useMemo(() => {
|
|
50584
|
+
if (isInternalOptions) {
|
|
50585
|
+
return searchOptionsLocally(searchQuery, watchedValue);
|
|
50586
|
+
}
|
|
50587
|
+
return sortBySelectedValues(getUniqueOptions([...options, ...selectedOptions]), watchedValue);
|
|
50588
|
+
}, [options, selectedOptions, isInternalOptions, props.options, watchedValue, searchQuery, searchOptionsLocally, sortBySelectedValues, getUniqueOptions]);
|
|
50589
|
+
const fetchOptions = useCallback(async (searchTerm = "", flt = cf, page = 1, append2 = false) => {
|
|
50590
|
+
if (!apiType) return [];
|
|
50591
|
+
setLoading(true);
|
|
50592
|
+
if (page > 1) {
|
|
50593
|
+
setPagination((prev) => ({ ...prev, isLoadingMore: true }));
|
|
50594
|
+
}
|
|
50595
|
+
try {
|
|
50596
|
+
const { data = [], pagination: pagination2 = {} } = await fetchApi({
|
|
50597
|
+
apiKey: apiType,
|
|
50598
|
+
filters: {
|
|
50599
|
+
limit,
|
|
50600
|
+
skip: (page - 1) * limit,
|
|
50601
|
+
search: searchTerm,
|
|
50602
|
+
filters: flt,
|
|
50603
|
+
select: attributes,
|
|
50604
|
+
order: sortOrder
|
|
50716
50605
|
}
|
|
50717
|
-
|
|
50718
|
-
|
|
50719
|
-
|
|
50720
|
-
|
|
50721
|
-
|
|
50722
|
-
|
|
50723
|
-
|
|
50724
|
-
|
|
50725
|
-
|
|
50726
|
-
|
|
50727
|
-
|
|
50728
|
-
|
|
50729
|
-
if (await handleSelectedValue(filteredOptions)) return;
|
|
50730
|
-
const condition = props.is_multiselect ? Array.isArray(watchedValue) && watchedValue.length > 0 : Boolean(watchedValue);
|
|
50731
|
-
if (condition) {
|
|
50732
|
-
setInitialLoading(true);
|
|
50733
|
-
await fetchOptions(
|
|
50734
|
-
"",
|
|
50735
|
-
{ ...cf, "&id.in": watchedValue },
|
|
50736
|
-
1,
|
|
50737
|
-
false
|
|
50738
|
-
);
|
|
50739
|
-
setInitialLoading(false);
|
|
50606
|
+
});
|
|
50607
|
+
if (data && Array.isArray(data)) {
|
|
50608
|
+
const newOptions = append2 ? [...options, ...data] : data;
|
|
50609
|
+
updateOptions(newOptions, append2);
|
|
50610
|
+
handleSelectedValue(data);
|
|
50611
|
+
setPagination((prev) => ({
|
|
50612
|
+
...prev,
|
|
50613
|
+
page,
|
|
50614
|
+
hasMore: (pagination2 == null ? void 0 : pagination2.totalCount) > page * limit,
|
|
50615
|
+
total: pagination2 == null ? void 0 : pagination2.totalCount,
|
|
50616
|
+
isLoadingMore: false
|
|
50617
|
+
}));
|
|
50740
50618
|
}
|
|
50741
|
-
|
|
50742
|
-
|
|
50743
|
-
|
|
50744
|
-
|
|
50745
|
-
|
|
50746
|
-
|
|
50747
|
-
|
|
50619
|
+
return data || [];
|
|
50620
|
+
} catch (error) {
|
|
50621
|
+
console.error("Error fetching options:", error);
|
|
50622
|
+
setPagination((prev) => ({ ...prev, isLoadingMore: false }));
|
|
50623
|
+
return [];
|
|
50624
|
+
} finally {
|
|
50625
|
+
setLoading(false);
|
|
50626
|
+
}
|
|
50627
|
+
}, [apiType, options, attributes, sortOrder, limit, cf]);
|
|
50628
|
+
const handleScroll = useCallback((event) => {
|
|
50629
|
+
const { scrollTop, scrollHeight, clientHeight } = event.currentTarget;
|
|
50630
|
+
const isBottom = scrollHeight - scrollTop <= clientHeight + 10;
|
|
50631
|
+
if (isBottom && pagination.hasMore && !pagination.isLoadingMore && !isInternalOptions) {
|
|
50632
|
+
const nextPage = pagination.page + 1;
|
|
50633
|
+
fetchOptions(searchQuery, cf, nextPage, true);
|
|
50634
|
+
}
|
|
50635
|
+
}, [pagination.hasMore, pagination.isLoadingMore, pagination.page, isInternalOptions, searchQuery, cf, fetchOptions]);
|
|
50636
|
+
const updateOptions = useCallback((newOptions, append2 = false) => {
|
|
50637
|
+
const oldOptions = append2 ? options : selectedOptions;
|
|
50638
|
+
const uniqueOptions = getUniqueOptions([...oldOptions, ...newOptions]);
|
|
50639
|
+
setOptions(uniqueOptions);
|
|
50640
|
+
}, [options, selectedOptions, getUniqueOptions]);
|
|
50641
|
+
const handleSelectedValue = useCallback(async (updateOptions2) => {
|
|
50642
|
+
const filterValue = props.is_multiselect ? watchedValue : [watchedValue];
|
|
50643
|
+
const isInOptions = updateOptions2 == null ? void 0 : updateOptions2.filter(
|
|
50644
|
+
(item) => Array.isArray(filterValue) ? filterValue.includes(item.id || item.value) : (item[filterKey2] || item.value || item.id) == filterValue
|
|
50645
|
+
);
|
|
50646
|
+
if (Array.isArray(isInOptions) && isInOptions.length > 0) {
|
|
50647
|
+
getSelectedData == null ? void 0 : getSelectedData(props.is_multiselect ? isInOptions : isInOptions[0], props.name);
|
|
50648
|
+
return true;
|
|
50649
|
+
}
|
|
50650
|
+
return false;
|
|
50651
|
+
}, [props.is_multiselect, props.name, watchedValue, filterKey2, getSelectedData]);
|
|
50652
|
+
const fetchIdOptions = useCallback(async () => {
|
|
50653
|
+
if (open) return;
|
|
50654
|
+
if (await handleSelectedValue(filteredOptions)) return;
|
|
50655
|
+
const condition = props.is_multiselect ? Array.isArray(watchedValue) && watchedValue.length > 0 : Boolean(watchedValue);
|
|
50656
|
+
if (condition) {
|
|
50657
|
+
setInitialLoading(true);
|
|
50658
|
+
await fetchOptions("", { ...cf, "&id.in": watchedValue }, 1, false);
|
|
50659
|
+
setInitialLoading(false);
|
|
50660
|
+
}
|
|
50661
|
+
}, [open, watchedValue, JSON.stringify(cf)]);
|
|
50662
|
+
const initialFetch = useCallback(async () => {
|
|
50663
|
+
const condition = JSON.stringify(cf) !== JSON.stringify(prevFilter);
|
|
50664
|
+
if (condition) {
|
|
50665
|
+
setPrevFilter(cf);
|
|
50666
|
+
setOptions([]);
|
|
50667
|
+
setIsAlreadyLoaded(false);
|
|
50668
|
+
setPagination({
|
|
50669
|
+
page: 1,
|
|
50670
|
+
hasMore: true,
|
|
50671
|
+
isLoadingMore: false,
|
|
50672
|
+
total: 0
|
|
50673
|
+
});
|
|
50674
|
+
}
|
|
50675
|
+
if (!isInternalOptions && !isAlreadyLoaded) {
|
|
50676
|
+
await fetchOptions(searchQuery, cf, 1, false);
|
|
50677
|
+
setIsAlreadyLoaded(true);
|
|
50678
|
+
}
|
|
50679
|
+
}, [cf, isInternalOptions, isAlreadyLoaded]);
|
|
50680
|
+
const debouncedSearch = useMemo(
|
|
50681
|
+
() => debounce$2(async (searchTerm) => {
|
|
50682
|
+
if (loading) return;
|
|
50683
|
+
if (!searchTerm && !isInternalOptions && searchInitiate) {
|
|
50748
50684
|
setPagination({
|
|
50749
50685
|
page: 1,
|
|
50750
50686
|
hasMore: true,
|
|
50751
50687
|
isLoadingMore: false,
|
|
50752
50688
|
total: 0
|
|
50753
50689
|
});
|
|
50690
|
+
await fetchOptions("", cf, 1, false);
|
|
50754
50691
|
}
|
|
50755
|
-
if (
|
|
50756
|
-
await fetchOptions(searchQuery, cf, 1, false);
|
|
50757
|
-
setIsAlreadyLoaded(true);
|
|
50758
|
-
}
|
|
50759
|
-
}, [cf, isInternalOptions, isAlreadyLoaded]);
|
|
50760
|
-
const debouncedSearch = useMemo(
|
|
50761
|
-
() => debounce$2(async (searchTerm) => {
|
|
50762
|
-
if (loading) return;
|
|
50763
|
-
if (!searchTerm && !isInternalOptions && searchInitiate) {
|
|
50764
|
-
setPagination({
|
|
50765
|
-
page: 1,
|
|
50766
|
-
hasMore: true,
|
|
50767
|
-
isLoadingMore: false,
|
|
50768
|
-
total: 0
|
|
50769
|
-
});
|
|
50770
|
-
await fetchOptions("", cf, 1, false);
|
|
50771
|
-
}
|
|
50772
|
-
if (searchTerm.length > 1 && !isInternalOptions) {
|
|
50773
|
-
setPagination({
|
|
50774
|
-
page: 1,
|
|
50775
|
-
hasMore: true,
|
|
50776
|
-
isLoadingMore: false,
|
|
50777
|
-
total: 0
|
|
50778
|
-
});
|
|
50779
|
-
await fetchOptions(searchTerm, cf, 1, false);
|
|
50780
|
-
}
|
|
50781
|
-
}, 700),
|
|
50782
|
-
//eslint-disable-next-line
|
|
50783
|
-
[isInternalOptions, searchInitiate, cf]
|
|
50784
|
-
);
|
|
50785
|
-
const resetValue = useCallback(
|
|
50786
|
-
(field) => {
|
|
50787
|
-
field.onChange(props.is_multiselect ? [] : null);
|
|
50788
|
-
if (getSelectedData) {
|
|
50789
|
-
getSelectedData(null, props.name);
|
|
50790
|
-
}
|
|
50791
|
-
},
|
|
50792
|
-
[props.is_multiselect, props.name, getSelectedData]
|
|
50793
|
-
);
|
|
50794
|
-
const handleClose = useCallback(() => {
|
|
50795
|
-
setOpen(false);
|
|
50796
|
-
if (searchQuery.length > 0) {
|
|
50797
|
-
setIsAlreadyLoaded(false);
|
|
50798
|
-
}
|
|
50799
|
-
setSearchInitiate(false);
|
|
50800
|
-
setSearchQuery("");
|
|
50801
|
-
}, [searchQuery]);
|
|
50802
|
-
const handleModalOpen = useCallback(() => {
|
|
50803
|
-
setIsModalOpen(true);
|
|
50804
|
-
}, []);
|
|
50805
|
-
const handleModalSave = useCallback(
|
|
50806
|
-
async (payload) => {
|
|
50807
|
-
if (!addConfig || !addConfig.api) {
|
|
50808
|
-
console.error("Add configuration is not properly set");
|
|
50809
|
-
return;
|
|
50810
|
-
}
|
|
50811
|
-
setIsAddLoading(true);
|
|
50812
|
-
try {
|
|
50813
|
-
const result = await addConfig.api(payload);
|
|
50814
|
-
console.log("result", result);
|
|
50815
|
-
setIsAddLoading(false);
|
|
50816
|
-
setIsModalOpen(false);
|
|
50817
|
-
if (!isInternalOptions) {
|
|
50818
|
-
setPagination({
|
|
50819
|
-
page: 1,
|
|
50820
|
-
hasMore: true,
|
|
50821
|
-
isLoadingMore: false,
|
|
50822
|
-
total: 0
|
|
50823
|
-
});
|
|
50824
|
-
setIsAlreadyLoaded(false);
|
|
50825
|
-
await fetchOptions("", cf, 1, false);
|
|
50826
|
-
}
|
|
50827
|
-
if (result && result.data) {
|
|
50828
|
-
const newValue = props.is_multiselect ? [...watchedValue || [], result.data.id] : result.data.id;
|
|
50829
|
-
if (setValue) {
|
|
50830
|
-
setValue(`${props.fieldArrayName}.${props.name}`, newValue);
|
|
50831
|
-
}
|
|
50832
|
-
}
|
|
50833
|
-
} catch (error) {
|
|
50834
|
-
console.log("error", error);
|
|
50835
|
-
setIsAddLoading(false);
|
|
50836
|
-
}
|
|
50837
|
-
},
|
|
50838
|
-
[
|
|
50839
|
-
addConfig,
|
|
50840
|
-
isInternalOptions,
|
|
50841
|
-
fetchOptions,
|
|
50842
|
-
cf,
|
|
50843
|
-
props.is_multiselect,
|
|
50844
|
-
props.fieldArrayName,
|
|
50845
|
-
props.name,
|
|
50846
|
-
watchedValue,
|
|
50847
|
-
setValue
|
|
50848
|
-
]
|
|
50849
|
-
);
|
|
50850
|
-
useEffect(() => {
|
|
50851
|
-
if (handleOptions) {
|
|
50852
|
-
handleOptions(selectedValue);
|
|
50853
|
-
}
|
|
50854
|
-
}, [handleOptions, selectedValue]);
|
|
50855
|
-
useEffect(() => {
|
|
50856
|
-
if (open) {
|
|
50857
|
-
initialFetch();
|
|
50858
|
-
}
|
|
50859
|
-
}, [open, initialFetch]);
|
|
50860
|
-
useEffect(() => {
|
|
50861
|
-
fetchIdOptions();
|
|
50862
|
-
}, [fetchIdOptions]);
|
|
50863
|
-
useEffect(() => {
|
|
50864
|
-
if (refresh) {
|
|
50692
|
+
if (searchTerm.length > 1 && !isInternalOptions) {
|
|
50865
50693
|
setPagination({
|
|
50866
50694
|
page: 1,
|
|
50867
50695
|
hasMore: true,
|
|
50868
50696
|
isLoadingMore: false,
|
|
50869
50697
|
total: 0
|
|
50870
50698
|
});
|
|
50871
|
-
fetchOptions(
|
|
50699
|
+
await fetchOptions(searchTerm, cf, 1, false);
|
|
50872
50700
|
}
|
|
50873
|
-
},
|
|
50874
|
-
|
|
50875
|
-
|
|
50876
|
-
|
|
50701
|
+
}, 700),
|
|
50702
|
+
//eslint-disable-next-line
|
|
50703
|
+
[isInternalOptions, searchInitiate, cf]
|
|
50704
|
+
);
|
|
50705
|
+
const resetValue = useCallback((field) => {
|
|
50706
|
+
field.onChange(props.is_multiselect ? [] : null);
|
|
50707
|
+
if (getSelectedData) {
|
|
50708
|
+
getSelectedData(null, props.name);
|
|
50709
|
+
}
|
|
50710
|
+
}, [props.is_multiselect, props.name, getSelectedData]);
|
|
50711
|
+
const handleClose = useCallback(() => {
|
|
50712
|
+
setOpen(false);
|
|
50713
|
+
if (searchQuery.length > 0) {
|
|
50714
|
+
setIsAlreadyLoaded(false);
|
|
50715
|
+
}
|
|
50716
|
+
setSearchInitiate(false);
|
|
50717
|
+
setSearchQuery("");
|
|
50718
|
+
}, [searchQuery]);
|
|
50719
|
+
const handleModalOpen = useCallback(() => {
|
|
50720
|
+
setIsModalOpen(true);
|
|
50721
|
+
}, []);
|
|
50722
|
+
const handleModalSave = useCallback(async (payload) => {
|
|
50723
|
+
if (!addConfig || !addConfig.api) {
|
|
50724
|
+
console.error("Add configuration is not properly set");
|
|
50725
|
+
return;
|
|
50726
|
+
}
|
|
50727
|
+
setIsAddLoading(true);
|
|
50728
|
+
try {
|
|
50729
|
+
const result = await addConfig.api(payload);
|
|
50730
|
+
console.log("result", result);
|
|
50731
|
+
setIsAddLoading(false);
|
|
50732
|
+
setIsModalOpen(false);
|
|
50733
|
+
if (!isInternalOptions) {
|
|
50734
|
+
setPagination({
|
|
50735
|
+
page: 1,
|
|
50736
|
+
hasMore: true,
|
|
50737
|
+
isLoadingMore: false,
|
|
50738
|
+
total: 0
|
|
50739
|
+
});
|
|
50740
|
+
setIsAlreadyLoaded(false);
|
|
50741
|
+
await fetchOptions("", cf, 1, false);
|
|
50877
50742
|
}
|
|
50878
|
-
|
|
50879
|
-
|
|
50880
|
-
|
|
50881
|
-
|
|
50882
|
-
|
|
50883
|
-
(item) => props.is_multiselect ? Array.isArray(watchedValue) && watchedValue.includes(item.id || item.value) : (item.id || item.value) == watchedValue
|
|
50884
|
-
);
|
|
50885
|
-
setSelectedOptions(selectedData || []);
|
|
50743
|
+
if (result && result.data) {
|
|
50744
|
+
const newValue = props.is_multiselect ? [...watchedValue || [], result.data.id] : result.data.id;
|
|
50745
|
+
if (setValue) {
|
|
50746
|
+
setValue(`${props.fieldArrayName}.${props.name}`, newValue);
|
|
50747
|
+
}
|
|
50886
50748
|
}
|
|
50887
|
-
}
|
|
50888
|
-
|
|
50889
|
-
|
|
50890
|
-
}
|
|
50891
|
-
|
|
50892
|
-
|
|
50893
|
-
|
|
50894
|
-
|
|
50895
|
-
|
|
50896
|
-
|
|
50897
|
-
|
|
50898
|
-
|
|
50899
|
-
|
|
50900
|
-
|
|
50901
|
-
|
|
50902
|
-
|
|
50903
|
-
|
|
50904
|
-
|
|
50905
|
-
|
|
50906
|
-
|
|
50907
|
-
|
|
50908
|
-
|
|
50909
|
-
|
|
50910
|
-
|
|
50911
|
-
|
|
50912
|
-
|
|
50913
|
-
|
|
50914
|
-
|
|
50915
|
-
|
|
50916
|
-
|
|
50917
|
-
|
|
50918
|
-
|
|
50919
|
-
|
|
50920
|
-
|
|
50921
|
-
|
|
50922
|
-
|
|
50923
|
-
|
|
50924
|
-
|
|
50925
|
-
|
|
50926
|
-
|
|
50927
|
-
|
|
50928
|
-
|
|
50929
|
-
|
|
50930
|
-
|
|
50931
|
-
|
|
50932
|
-
|
|
50933
|
-
|
|
50934
|
-
|
|
50935
|
-
|
|
50936
|
-
|
|
50937
|
-
|
|
50938
|
-
|
|
50939
|
-
|
|
50940
|
-
|
|
50941
|
-
|
|
50942
|
-
|
|
50943
|
-
|
|
50944
|
-
|
|
50945
|
-
|
|
50946
|
-
|
|
50947
|
-
|
|
50948
|
-
|
|
50949
|
-
|
|
50950
|
-
|
|
50951
|
-
|
|
50749
|
+
} catch (error) {
|
|
50750
|
+
console.log("error", error);
|
|
50751
|
+
setIsAddLoading(false);
|
|
50752
|
+
}
|
|
50753
|
+
}, [addConfig, isInternalOptions, fetchOptions, cf, props.is_multiselect, props.fieldArrayName, props.name, watchedValue, setValue]);
|
|
50754
|
+
useEffect(() => {
|
|
50755
|
+
if (handleOptions) {
|
|
50756
|
+
handleOptions(selectedValue);
|
|
50757
|
+
}
|
|
50758
|
+
}, [handleOptions, selectedValue]);
|
|
50759
|
+
useEffect(() => {
|
|
50760
|
+
if (open) {
|
|
50761
|
+
initialFetch();
|
|
50762
|
+
}
|
|
50763
|
+
}, [open, initialFetch]);
|
|
50764
|
+
useEffect(() => {
|
|
50765
|
+
fetchIdOptions();
|
|
50766
|
+
}, [fetchIdOptions]);
|
|
50767
|
+
useEffect(() => {
|
|
50768
|
+
if (refresh) {
|
|
50769
|
+
setPagination({
|
|
50770
|
+
page: 1,
|
|
50771
|
+
hasMore: true,
|
|
50772
|
+
isLoadingMore: false,
|
|
50773
|
+
total: 0
|
|
50774
|
+
});
|
|
50775
|
+
fetchOptions("", cf, 1, false);
|
|
50776
|
+
}
|
|
50777
|
+
}, [refresh, fetchOptions, cf]);
|
|
50778
|
+
useEffect(() => {
|
|
50779
|
+
if (open) {
|
|
50780
|
+
debouncedSearch(searchQuery);
|
|
50781
|
+
}
|
|
50782
|
+
return () => debouncedSearch.cancel();
|
|
50783
|
+
}, [searchQuery, open, debouncedSearch]);
|
|
50784
|
+
useEffect(() => {
|
|
50785
|
+
if (watchedValue && !open) {
|
|
50786
|
+
const selectedData = options == null ? void 0 : options.filter(
|
|
50787
|
+
(item) => props.is_multiselect ? Array.isArray(watchedValue) && watchedValue.includes(item.id || item.value) : (item.id || item.value) == watchedValue
|
|
50788
|
+
);
|
|
50789
|
+
setSelectedOptions(selectedData || []);
|
|
50790
|
+
}
|
|
50791
|
+
}, [watchedValue, options, props.is_multiselect, open]);
|
|
50792
|
+
const removeUndefined = useCallback((selectOptions) => {
|
|
50793
|
+
return Array.isArray(selectOptions) ? selectOptions.filter(Boolean) : [];
|
|
50794
|
+
}, []);
|
|
50795
|
+
useEffect(() => {
|
|
50796
|
+
const config2 = dynamicSelectAdd(addType);
|
|
50797
|
+
setAddConfig(config2);
|
|
50798
|
+
}, [addType]);
|
|
50799
|
+
return /* @__PURE__ */ jsx(
|
|
50800
|
+
Controller,
|
|
50801
|
+
{
|
|
50802
|
+
control: props.formControl,
|
|
50803
|
+
name: `${props.fieldArrayName}.${props.name}`,
|
|
50804
|
+
render: ({ field, fieldState }) => {
|
|
50805
|
+
var _a, _b, _c, _d, _e;
|
|
50806
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
50807
|
+
props.placeholder == "Select Currency" && setSelectedValue(field.value),
|
|
50808
|
+
/* @__PURE__ */ jsxs(
|
|
50809
|
+
Select$1,
|
|
50810
|
+
{
|
|
50811
|
+
...field,
|
|
50812
|
+
ref: selectRef,
|
|
50813
|
+
open,
|
|
50814
|
+
onOpen: () => setOpen(true),
|
|
50815
|
+
onClose: handleClose,
|
|
50816
|
+
fullWidth: true,
|
|
50817
|
+
dataPosition: props.position,
|
|
50818
|
+
dataName: `${props.fieldArrayName}.${props.name}`,
|
|
50819
|
+
placeholder: props.placeholder,
|
|
50820
|
+
label: props.label,
|
|
50821
|
+
defaultValue: props.defaultValue || (props.is_multiselect ? [] : ""),
|
|
50822
|
+
searchValue: searchQuery,
|
|
50823
|
+
required: props.formType == "builder" ? false : props.required,
|
|
50824
|
+
size: props.size || "small",
|
|
50825
|
+
multiple: props.is_multiselect || false,
|
|
50826
|
+
disabled: props.disabled,
|
|
50827
|
+
sx: props.is_multiselect && ((_a = field == null ? void 0 : field.value) == null ? void 0 : _a.length) ? { "& .MuiSelect-select": { padding: "5.5px !important" } } : {},
|
|
50828
|
+
variant: "outlined",
|
|
50829
|
+
value: initialLoading ? props.is_multiselect ? [] : "" : ((_b = field.value) == null ? void 0 : _b.id) || field.value || (props.is_multiselect ? [] : ""),
|
|
50830
|
+
className: props.is_multiselect && ((_c = removeUndefined(field.value)) == null ? void 0 : _c.length) ? "MultiSelect filter-select" : "",
|
|
50831
|
+
MenuProps: {
|
|
50832
|
+
PaperProps: {
|
|
50833
|
+
onScroll: handleScroll,
|
|
50834
|
+
style: { maxHeight: 300 }
|
|
50835
|
+
}
|
|
50836
|
+
},
|
|
50837
|
+
renderValue: (selected) => {
|
|
50838
|
+
if (Array.isArray(selected)) {
|
|
50839
|
+
return /* @__PURE__ */ jsx(
|
|
50840
|
+
ChipOrPlaceholder,
|
|
50841
|
+
{
|
|
50842
|
+
selectedLabel: props.selectedLabel,
|
|
50843
|
+
data: removeUndefined(selected),
|
|
50844
|
+
placeholder: loading || props.is_loading ? /* @__PURE__ */ jsx(Loading, {}) : `${t2("common.search")} ${props.label}`,
|
|
50845
|
+
onDelete: props.onChipRemove,
|
|
50846
|
+
disabled: props.disabled,
|
|
50847
|
+
chipProps: {
|
|
50848
|
+
sx: {
|
|
50849
|
+
background: "#ebf9f2",
|
|
50850
|
+
border: 0,
|
|
50851
|
+
// borderRadius: '15px',
|
|
50852
|
+
"& .MuiTypography-body1": {
|
|
50853
|
+
color: "#289b64",
|
|
50854
|
+
fontWeight: "500"
|
|
50952
50855
|
}
|
|
50953
50856
|
}
|
|
50954
50857
|
}
|
|
50955
|
-
);
|
|
50956
|
-
} else {
|
|
50957
|
-
const selectedOption = filteredOptions.find(
|
|
50958
|
-
(option) => {
|
|
50959
|
-
var _a2;
|
|
50960
|
-
return (((_a2 = option.value) == null ? void 0 : _a2.id) || option.value) == selected;
|
|
50961
|
-
}
|
|
50962
|
-
);
|
|
50963
|
-
return loading || props.is_loading ? /* @__PURE__ */ jsx(Loading, {}) : (selectedOption == null ? void 0 : selectedOption.label) || (typeof props.label == "string" ? `${t2("common.search")} ${props.label}` : props.placeholder);
|
|
50964
|
-
}
|
|
50965
|
-
},
|
|
50966
|
-
searchPlaceholder: `${t2("common.search")} ${props.label}`,
|
|
50967
|
-
handleSearch: (text) => {
|
|
50968
|
-
setSearchQuery(text);
|
|
50969
|
-
setSearchInitiate(true);
|
|
50970
|
-
},
|
|
50971
|
-
error: Boolean((_d = fieldState.error) == null ? void 0 : _d.message),
|
|
50972
|
-
helperText: ((_e = fieldState.error) == null ? void 0 : _e.message) || "",
|
|
50973
|
-
onBlur: field.onBlur,
|
|
50974
|
-
input: /* @__PURE__ */ jsx(
|
|
50975
|
-
OutlinedInput,
|
|
50976
|
-
{
|
|
50977
|
-
label: "",
|
|
50978
|
-
endAdornment: /* @__PURE__ */ jsx(InputAdornment, { position: "end", children: loading || props.is_loading ? /* @__PURE__ */ jsx(
|
|
50979
|
-
CircularProgress,
|
|
50980
|
-
{
|
|
50981
|
-
size: 20,
|
|
50982
|
-
sx: { mr: 3, color: "#4AC08C" }
|
|
50983
|
-
}
|
|
50984
|
-
) : !props.disabled && (props.is_multiselect ? Array.isArray(field.value) && field.value.length > 0 : Boolean(field.value)) && /* @__PURE__ */ jsx(
|
|
50985
|
-
IconButton,
|
|
50986
|
-
{
|
|
50987
|
-
"aria-label": "clear selection",
|
|
50988
|
-
onClick: () => resetValue(field),
|
|
50989
|
-
edge: "end",
|
|
50990
|
-
sx: isRtl ? { ml: 2.5 } : { mr: 1.5 },
|
|
50991
|
-
size: "small",
|
|
50992
|
-
children: /* @__PURE__ */ jsx(Close, { sx: { fontSize: "1rem" } })
|
|
50993
|
-
}
|
|
50994
|
-
) })
|
|
50995
|
-
}
|
|
50996
|
-
),
|
|
50997
|
-
children: [
|
|
50998
|
-
generateMenuItems$1({
|
|
50999
|
-
options: filteredOptions,
|
|
51000
|
-
multiple: Boolean(props.is_multiselect),
|
|
51001
|
-
placeholder: props.placeholder,
|
|
51002
|
-
values: field.value,
|
|
51003
|
-
with_checkboxes: true,
|
|
51004
|
-
field: props,
|
|
51005
|
-
disabledIds,
|
|
51006
|
-
onChange: field.onChange,
|
|
51007
|
-
handleChange,
|
|
51008
|
-
hasParent,
|
|
51009
|
-
t: t2,
|
|
51010
|
-
onFooterClick: () => {
|
|
51011
|
-
if (props == null ? void 0 : props.onFooterClick) {
|
|
51012
|
-
props == null ? void 0 : props.onFooterClick();
|
|
51013
|
-
} else {
|
|
51014
|
-
handleModalOpen();
|
|
51015
|
-
}
|
|
51016
50858
|
}
|
|
51017
|
-
|
|
51018
|
-
|
|
51019
|
-
|
|
50859
|
+
);
|
|
50860
|
+
} else {
|
|
50861
|
+
const selectedOption = filteredOptions.find(
|
|
50862
|
+
(option) => {
|
|
50863
|
+
var _a2;
|
|
50864
|
+
return (((_a2 = option.value) == null ? void 0 : _a2.id) || option.value) == selected;
|
|
50865
|
+
}
|
|
50866
|
+
);
|
|
50867
|
+
return loading || props.is_loading ? /* @__PURE__ */ jsx(Loading, {}) : (selectedOption == null ? void 0 : selectedOption.label) || (typeof props.label == "string" ? `${t2("common.search")} ${props.label}` : props.placeholder);
|
|
50868
|
+
}
|
|
50869
|
+
},
|
|
50870
|
+
searchPlaceholder: `${t2("common.search")} ${props.label}`,
|
|
50871
|
+
handleSearch: (text) => {
|
|
50872
|
+
setSearchQuery(text);
|
|
50873
|
+
setSearchInitiate(true);
|
|
50874
|
+
},
|
|
50875
|
+
error: Boolean((_d = fieldState.error) == null ? void 0 : _d.message),
|
|
50876
|
+
helperText: ((_e = fieldState.error) == null ? void 0 : _e.message) || "",
|
|
50877
|
+
onBlur: field.onBlur,
|
|
50878
|
+
input: /* @__PURE__ */ jsx(
|
|
50879
|
+
OutlinedInput,
|
|
50880
|
+
{
|
|
50881
|
+
label: "",
|
|
50882
|
+
endAdornment: /* @__PURE__ */ jsx(InputAdornment, { position: "end", children: loading || props.is_loading ? /* @__PURE__ */ jsx(
|
|
50883
|
+
CircularProgress,
|
|
51020
50884
|
{
|
|
51021
|
-
|
|
51022
|
-
|
|
51023
|
-
|
|
51024
|
-
|
|
51025
|
-
|
|
51026
|
-
|
|
50885
|
+
size: 20,
|
|
50886
|
+
sx: { mr: 3, color: "#4AC08C" }
|
|
50887
|
+
}
|
|
50888
|
+
) : !props.disabled && (props.is_multiselect ? Array.isArray(field.value) && field.value.length > 0 : Boolean(field.value)) && /* @__PURE__ */ jsx(
|
|
50889
|
+
IconButton,
|
|
50890
|
+
{
|
|
50891
|
+
"aria-label": "clear selection",
|
|
50892
|
+
onClick: () => resetValue(field),
|
|
50893
|
+
edge: "end",
|
|
50894
|
+
sx: isRtl ? { ml: 2.5 } : { mr: 1.5 },
|
|
50895
|
+
size: "small",
|
|
50896
|
+
children: /* @__PURE__ */ jsx(Close, { sx: { fontSize: "1rem" } })
|
|
51027
50897
|
}
|
|
51028
50898
|
) })
|
|
51029
|
-
|
|
51030
|
-
|
|
51031
|
-
|
|
51032
|
-
|
|
51033
|
-
|
|
51034
|
-
|
|
51035
|
-
|
|
51036
|
-
|
|
51037
|
-
|
|
51038
|
-
|
|
51039
|
-
|
|
51040
|
-
|
|
51041
|
-
|
|
51042
|
-
|
|
51043
|
-
|
|
51044
|
-
|
|
50899
|
+
}
|
|
50900
|
+
),
|
|
50901
|
+
children: [
|
|
50902
|
+
generateMenuItems$1({
|
|
50903
|
+
options: filteredOptions,
|
|
50904
|
+
multiple: Boolean(props.is_multiselect),
|
|
50905
|
+
placeholder: props.placeholder,
|
|
50906
|
+
values: field.value,
|
|
50907
|
+
with_checkboxes: true,
|
|
50908
|
+
field: props,
|
|
50909
|
+
disabledIds,
|
|
50910
|
+
onChange: field.onChange,
|
|
50911
|
+
handleChange,
|
|
50912
|
+
hasParent,
|
|
50913
|
+
t: t2,
|
|
50914
|
+
onFooterClick: () => {
|
|
50915
|
+
if (props == null ? void 0 : props.onFooterClick) {
|
|
50916
|
+
props == null ? void 0 : props.onFooterClick();
|
|
50917
|
+
} else {
|
|
50918
|
+
handleModalOpen();
|
|
50919
|
+
}
|
|
50920
|
+
}
|
|
50921
|
+
}),
|
|
50922
|
+
pagination.isLoadingMore && /* @__PURE__ */ jsx(MenuItem, { disabled: true, children: /* @__PURE__ */ jsx(Box, { sx: { display: "flex", justifyContent: "center", width: "100%" }, children: /* @__PURE__ */ jsx(CircularProgress, { size: 20 }) }) })
|
|
50923
|
+
]
|
|
50924
|
+
}
|
|
50925
|
+
),
|
|
50926
|
+
addConfig && addConfig.component && /* @__PURE__ */ jsx(Fragment, { children: React__default.createElement(addConfig.component, {
|
|
50927
|
+
isOpen: isModalOpen,
|
|
50928
|
+
setIsOpen: setIsModalOpen,
|
|
50929
|
+
isLoading: isAddLoading,
|
|
50930
|
+
onSave: handleModalSave,
|
|
50931
|
+
modalProps: {
|
|
50932
|
+
maxWidth: "md",
|
|
50933
|
+
fullWidth: true
|
|
50934
|
+
}
|
|
50935
|
+
}) }),
|
|
50936
|
+
props.is_multiselect && Array.isArray(field.value) && /* @__PURE__ */ jsx(
|
|
50937
|
+
SelectedItems$1,
|
|
50938
|
+
{
|
|
50939
|
+
data: field.value,
|
|
50940
|
+
options: filteredOptions
|
|
50941
|
+
}
|
|
50942
|
+
)
|
|
50943
|
+
] });
|
|
51045
50944
|
}
|
|
51046
|
-
|
|
51047
|
-
|
|
51048
|
-
);
|
|
50945
|
+
}
|
|
50946
|
+
);
|
|
50947
|
+
});
|
|
51049
50948
|
DynamicSearchSelect.propTypes = {
|
|
51050
50949
|
name: PropTypes.string.isRequired,
|
|
51051
50950
|
placeholder: PropTypes.string.isRequired,
|
|
@@ -52999,9 +52898,9 @@ const DynamicDate = React__default.memo((props) => {
|
|
|
52999
52898
|
[props.fieldArrayName, props.name]
|
|
53000
52899
|
);
|
|
53001
52900
|
const { minDate, maxDate } = useMemo(() => {
|
|
53002
|
-
const
|
|
52901
|
+
const min2 = dayjs(props.min_date || null).isValid() ? dayjs(props.min_date) : null;
|
|
53003
52902
|
const max2 = dayjs(props.max_date || null).isValid() ? dayjs(props.max_date) : null;
|
|
53004
|
-
return { minDate:
|
|
52903
|
+
return { minDate: min2, maxDate: max2 };
|
|
53005
52904
|
}, [props.min_date, props.max_date]);
|
|
53006
52905
|
const isRequired = useMemo(
|
|
53007
52906
|
() => props.formType === "builder" ? false : props.required,
|
|
@@ -55107,7 +55006,7 @@ const PageLoader = (props) => {
|
|
|
55107
55006
|
function ascending$1(a2, b2) {
|
|
55108
55007
|
return a2 == null || b2 == null ? NaN : a2 < b2 ? -1 : a2 > b2 ? 1 : a2 >= b2 ? 0 : NaN;
|
|
55109
55008
|
}
|
|
55110
|
-
function descending(a2, b2) {
|
|
55009
|
+
function descending$1(a2, b2) {
|
|
55111
55010
|
return a2 == null || b2 == null ? NaN : b2 < a2 ? -1 : b2 > a2 ? 1 : b2 >= a2 ? 0 : NaN;
|
|
55112
55011
|
}
|
|
55113
55012
|
function bisector(f2) {
|
|
@@ -55117,7 +55016,7 @@ function bisector(f2) {
|
|
|
55117
55016
|
compare2 = (d2, x2) => ascending$1(f2(d2), x2);
|
|
55118
55017
|
delta = (d2, x2) => f2(d2) - x2;
|
|
55119
55018
|
} else {
|
|
55120
|
-
compare1 = f2 === ascending$1 || f2 === descending ? f2 : zero$1;
|
|
55019
|
+
compare1 = f2 === ascending$1 || f2 === descending$1 ? f2 : zero$1;
|
|
55121
55020
|
compare2 = f2;
|
|
55122
55021
|
delta = f2;
|
|
55123
55022
|
}
|
|
@@ -55244,7 +55143,7 @@ function tickStep(start, stop, count) {
|
|
|
55244
55143
|
const reverse = stop < start, inc = reverse ? tickIncrement(stop, start, count) : tickIncrement(start, stop, count);
|
|
55245
55144
|
return (reverse ? -1 : 1) * (inc < 0 ? 1 / -inc : inc);
|
|
55246
55145
|
}
|
|
55247
|
-
function max(values, valueof) {
|
|
55146
|
+
function max$1(values, valueof) {
|
|
55248
55147
|
let max2;
|
|
55249
55148
|
if (valueof === void 0) {
|
|
55250
55149
|
for (const value of values) {
|
|
@@ -55262,6 +55161,24 @@ function max(values, valueof) {
|
|
|
55262
55161
|
}
|
|
55263
55162
|
return max2;
|
|
55264
55163
|
}
|
|
55164
|
+
function min$1(values, valueof) {
|
|
55165
|
+
let min2;
|
|
55166
|
+
if (valueof === void 0) {
|
|
55167
|
+
for (const value of values) {
|
|
55168
|
+
if (value != null && (min2 > value || min2 === void 0 && value >= value)) {
|
|
55169
|
+
min2 = value;
|
|
55170
|
+
}
|
|
55171
|
+
}
|
|
55172
|
+
} else {
|
|
55173
|
+
let index2 = -1;
|
|
55174
|
+
for (let value of values) {
|
|
55175
|
+
if ((value = valueof(value, ++index2, values)) != null && (min2 > value || min2 === void 0 && value >= value)) {
|
|
55176
|
+
min2 = value;
|
|
55177
|
+
}
|
|
55178
|
+
}
|
|
55179
|
+
}
|
|
55180
|
+
return min2;
|
|
55181
|
+
}
|
|
55265
55182
|
function range(start, stop, step) {
|
|
55266
55183
|
start = +start, stop = +stop, step = (n2 = arguments.length) < 2 ? (stop = start, start = 0, 1) : n2 < 3 ? 1 : +step;
|
|
55267
55184
|
var i2 = -1, n2 = Math.max(0, Math.ceil((stop - start) / step)) | 0, range2 = new Array(n2);
|
|
@@ -55270,10 +55187,10 @@ function range(start, stop, step) {
|
|
|
55270
55187
|
}
|
|
55271
55188
|
return range2;
|
|
55272
55189
|
}
|
|
55273
|
-
function identity$
|
|
55190
|
+
function identity$3(x2) {
|
|
55274
55191
|
return x2;
|
|
55275
55192
|
}
|
|
55276
|
-
var top = 1, right = 2, bottom = 3, left = 4, epsilon$
|
|
55193
|
+
var top = 1, right = 2, bottom = 3, left = 4, epsilon$2 = 1e-6;
|
|
55277
55194
|
function translateX(x2) {
|
|
55278
55195
|
return "translate(" + x2 + ",0)";
|
|
55279
55196
|
}
|
|
@@ -55294,7 +55211,7 @@ function entering() {
|
|
|
55294
55211
|
function axis(orient, scale) {
|
|
55295
55212
|
var tickArguments = [], tickValues = null, tickFormat2 = null, tickSizeInner = 6, tickSizeOuter = 6, tickPadding = 3, offset = typeof window !== "undefined" && window.devicePixelRatio > 1 ? 0 : 0.5, k2 = orient === top || orient === left ? -1 : 1, x2 = orient === left || orient === right ? "x" : "y", transform = orient === top || orient === bottom ? translateX : translateY;
|
|
55296
55213
|
function axis2(context) {
|
|
55297
|
-
var values = tickValues == null ? scale.ticks ? scale.ticks.apply(scale, tickArguments) : scale.domain() : tickValues, format2 = tickFormat2 == null ? scale.tickFormat ? scale.tickFormat.apply(scale, tickArguments) : identity$
|
|
55214
|
+
var values = tickValues == null ? scale.ticks ? scale.ticks.apply(scale, tickArguments) : scale.domain() : tickValues, format2 = tickFormat2 == null ? scale.tickFormat ? scale.tickFormat.apply(scale, tickArguments) : identity$3 : tickFormat2, spacing = Math.max(tickSizeInner, 0) + tickPadding, range2 = scale.range(), range0 = +range2[0] + offset, range1 = +range2[range2.length - 1] + offset, position = (scale.bandwidth ? center : number$1)(scale.copy(), offset), selection = context.selection ? context.selection() : context, path = selection.selectAll(".domain").data([null]), tick = selection.selectAll(".tick").data(values, scale).order(), tickExit = tick.exit(), tickEnter = tick.enter().append("g").attr("class", "tick"), line2 = tick.select("line"), text = tick.select("text");
|
|
55298
55215
|
path = path.merge(path.enter().insert("path", ".tick").attr("class", "domain").attr("stroke", "currentColor"));
|
|
55299
55216
|
tick = tick.merge(tickEnter);
|
|
55300
55217
|
line2 = line2.merge(tickEnter.append("line").attr("stroke", "currentColor").attr(x2 + "2", k2 * tickSizeInner));
|
|
@@ -55304,10 +55221,10 @@ function axis(orient, scale) {
|
|
|
55304
55221
|
tick = tick.transition(context);
|
|
55305
55222
|
line2 = line2.transition(context);
|
|
55306
55223
|
text = text.transition(context);
|
|
55307
|
-
tickExit = tickExit.transition(context).attr("opacity", epsilon$
|
|
55224
|
+
tickExit = tickExit.transition(context).attr("opacity", epsilon$2).attr("transform", function(d2) {
|
|
55308
55225
|
return isFinite(d2 = position(d2)) ? transform(d2 + offset) : this.getAttribute("transform");
|
|
55309
55226
|
});
|
|
55310
|
-
tickEnter.attr("opacity", epsilon$
|
|
55227
|
+
tickEnter.attr("opacity", epsilon$2).attr("transform", function(d2) {
|
|
55311
55228
|
var p2 = this.parentNode.__axis;
|
|
55312
55229
|
return transform((p2 && isFinite(p2 = p2(d2)) ? p2 : position(d2)) + offset);
|
|
55313
55230
|
});
|
|
@@ -55356,6 +55273,9 @@ function axis(orient, scale) {
|
|
|
55356
55273
|
};
|
|
55357
55274
|
return axis2;
|
|
55358
55275
|
}
|
|
55276
|
+
function axisTop(scale) {
|
|
55277
|
+
return axis(top, scale);
|
|
55278
|
+
}
|
|
55359
55279
|
function axisBottom(scale) {
|
|
55360
55280
|
return axis(bottom, scale);
|
|
55361
55281
|
}
|
|
@@ -56054,6 +55974,29 @@ Selection.prototype = {
|
|
|
56054
55974
|
function select(selector2) {
|
|
56055
55975
|
return typeof selector2 === "string" ? new Selection([[document.querySelector(selector2)]], [document.documentElement]) : new Selection([[selector2]], root);
|
|
56056
55976
|
}
|
|
55977
|
+
function sourceEvent(event) {
|
|
55978
|
+
let sourceEvent2;
|
|
55979
|
+
while (sourceEvent2 = event.sourceEvent) event = sourceEvent2;
|
|
55980
|
+
return event;
|
|
55981
|
+
}
|
|
55982
|
+
function pointer(event, node) {
|
|
55983
|
+
event = sourceEvent(event);
|
|
55984
|
+
if (node === void 0) node = event.currentTarget;
|
|
55985
|
+
if (node) {
|
|
55986
|
+
var svg = node.ownerSVGElement || node;
|
|
55987
|
+
if (svg.createSVGPoint) {
|
|
55988
|
+
var point2 = svg.createSVGPoint();
|
|
55989
|
+
point2.x = event.clientX, point2.y = event.clientY;
|
|
55990
|
+
point2 = point2.matrixTransform(node.getScreenCTM().inverse());
|
|
55991
|
+
return [point2.x, point2.y];
|
|
55992
|
+
}
|
|
55993
|
+
if (node.getBoundingClientRect) {
|
|
55994
|
+
var rect = node.getBoundingClientRect();
|
|
55995
|
+
return [event.clientX - rect.left - node.clientLeft, event.clientY - rect.top - node.clientTop];
|
|
55996
|
+
}
|
|
55997
|
+
}
|
|
55998
|
+
return [event.pageX, event.pageY];
|
|
55999
|
+
}
|
|
56057
56000
|
function define(constructor, factory, prototype) {
|
|
56058
56001
|
constructor.prototype = factory.prototype = prototype;
|
|
56059
56002
|
prototype.constructor = constructor;
|
|
@@ -56329,12 +56272,12 @@ function hslConvert(o2) {
|
|
|
56329
56272
|
if (!o2) return new Hsl();
|
|
56330
56273
|
if (o2 instanceof Hsl) return o2;
|
|
56331
56274
|
o2 = o2.rgb();
|
|
56332
|
-
var r2 = o2.r / 255, g2 = o2.g / 255, b2 = o2.b / 255,
|
|
56275
|
+
var r2 = o2.r / 255, g2 = o2.g / 255, b2 = o2.b / 255, min2 = Math.min(r2, g2, b2), max2 = Math.max(r2, g2, b2), h2 = NaN, s2 = max2 - min2, l2 = (max2 + min2) / 2;
|
|
56333
56276
|
if (s2) {
|
|
56334
56277
|
if (r2 === max2) h2 = (g2 - b2) / s2 + (g2 < b2) * 6;
|
|
56335
56278
|
else if (g2 === max2) h2 = (b2 - r2) / s2 + 2;
|
|
56336
56279
|
else h2 = (r2 - g2) / s2 + 4;
|
|
56337
|
-
s2 /= l2 < 0.5 ? max2 +
|
|
56280
|
+
s2 /= l2 < 0.5 ? max2 + min2 : 2 - max2 - min2;
|
|
56338
56281
|
h2 *= 60;
|
|
56339
56282
|
} else {
|
|
56340
56283
|
s2 = l2 > 0 && l2 < 1 ? 0 : h2;
|
|
@@ -56519,7 +56462,7 @@ function interpolateRound(a2, b2) {
|
|
|
56519
56462
|
return Math.round(a2 * (1 - t2) + b2 * t2);
|
|
56520
56463
|
};
|
|
56521
56464
|
}
|
|
56522
|
-
const pi = Math.PI, tau = 2 * pi, epsilon = 1e-6, tauEpsilon = tau - epsilon;
|
|
56465
|
+
const pi$1 = Math.PI, tau$1 = 2 * pi$1, epsilon$1 = 1e-6, tauEpsilon = tau$1 - epsilon$1;
|
|
56523
56466
|
function append(strings) {
|
|
56524
56467
|
this._ += strings[0];
|
|
56525
56468
|
for (let i2 = 1, n2 = strings.length; i2 < n2; ++i2) {
|
|
@@ -56569,12 +56512,12 @@ class Path {
|
|
|
56569
56512
|
let x0 = this._x1, y0 = this._y1, x21 = x2 - x1, y21 = y2 - y1, x01 = x0 - x1, y01 = y0 - y1, l01_2 = x01 * x01 + y01 * y01;
|
|
56570
56513
|
if (this._x1 === null) {
|
|
56571
56514
|
this._append`M${this._x1 = x1},${this._y1 = y1}`;
|
|
56572
|
-
} else if (!(l01_2 > epsilon)) ;
|
|
56573
|
-
else if (!(Math.abs(y01 * x21 - y21 * x01) > epsilon) || !r2) {
|
|
56515
|
+
} else if (!(l01_2 > epsilon$1)) ;
|
|
56516
|
+
else if (!(Math.abs(y01 * x21 - y21 * x01) > epsilon$1) || !r2) {
|
|
56574
56517
|
this._append`L${this._x1 = x1},${this._y1 = y1}`;
|
|
56575
56518
|
} else {
|
|
56576
|
-
let x20 = x2 - x0, y20 = y2 - y0, l21_2 = x21 * x21 + y21 * y21, l20_2 = x20 * x20 + y20 * y20, l21 = Math.sqrt(l21_2), l01 = Math.sqrt(l01_2), l2 = r2 * Math.tan((pi - Math.acos((l21_2 + l01_2 - l20_2) / (2 * l21 * l01))) / 2), t01 = l2 / l01, t21 = l2 / l21;
|
|
56577
|
-
if (Math.abs(t01 - 1) > epsilon) {
|
|
56519
|
+
let x20 = x2 - x0, y20 = y2 - y0, l21_2 = x21 * x21 + y21 * y21, l20_2 = x20 * x20 + y20 * y20, l21 = Math.sqrt(l21_2), l01 = Math.sqrt(l01_2), l2 = r2 * Math.tan((pi$1 - Math.acos((l21_2 + l01_2 - l20_2) / (2 * l21 * l01))) / 2), t01 = l2 / l01, t21 = l2 / l21;
|
|
56520
|
+
if (Math.abs(t01 - 1) > epsilon$1) {
|
|
56578
56521
|
this._append`L${x1 + t01 * x01},${y1 + t01 * y01}`;
|
|
56579
56522
|
}
|
|
56580
56523
|
this._append`A${r2},${r2},0,0,${+(y01 * x20 > x01 * y20)},${this._x1 = x1 + t21 * x21},${this._y1 = y1 + t21 * y21}`;
|
|
@@ -56586,15 +56529,15 @@ class Path {
|
|
|
56586
56529
|
let dx = r2 * Math.cos(a0), dy = r2 * Math.sin(a0), x0 = x2 + dx, y0 = y2 + dy, cw = 1 ^ ccw, da = ccw ? a0 - a1 : a1 - a0;
|
|
56587
56530
|
if (this._x1 === null) {
|
|
56588
56531
|
this._append`M${x0},${y0}`;
|
|
56589
|
-
} else if (Math.abs(this._x1 - x0) > epsilon || Math.abs(this._y1 - y0) > epsilon) {
|
|
56532
|
+
} else if (Math.abs(this._x1 - x0) > epsilon$1 || Math.abs(this._y1 - y0) > epsilon$1) {
|
|
56590
56533
|
this._append`L${x0},${y0}`;
|
|
56591
56534
|
}
|
|
56592
56535
|
if (!r2) return;
|
|
56593
|
-
if (da < 0) da = da % tau + tau;
|
|
56536
|
+
if (da < 0) da = da % tau$1 + tau$1;
|
|
56594
56537
|
if (da > tauEpsilon) {
|
|
56595
56538
|
this._append`A${r2},${r2},0,1,${cw},${x2 - dx},${y2 - dy}A${r2},${r2},0,1,${cw},${this._x1 = x0},${this._y1 = y0}`;
|
|
56596
|
-
} else if (da > epsilon) {
|
|
56597
|
-
this._append`A${r2},${r2},0,${+(da >= pi)},${cw},${this._x1 = x2 + r2 * Math.cos(a1)},${this._y1 = y2 + r2 * Math.sin(a1)}`;
|
|
56539
|
+
} else if (da > epsilon$1) {
|
|
56540
|
+
this._append`A${r2},${r2},0,${+(da >= pi$1)},${cw},${this._x1 = x2 + r2 * Math.cos(a1)},${this._y1 = y2 + r2 * Math.sin(a1)}`;
|
|
56598
56541
|
}
|
|
56599
56542
|
}
|
|
56600
56543
|
rect(x2, y2, w2, h2) {
|
|
@@ -56716,12 +56659,12 @@ var formatTypes = {
|
|
|
56716
56659
|
"X": (x2) => Math.round(x2).toString(16).toUpperCase(),
|
|
56717
56660
|
"x": (x2) => Math.round(x2).toString(16)
|
|
56718
56661
|
};
|
|
56719
|
-
function identity$
|
|
56662
|
+
function identity$2(x2) {
|
|
56720
56663
|
return x2;
|
|
56721
56664
|
}
|
|
56722
56665
|
var map = Array.prototype.map, prefixes = ["y", "z", "a", "f", "p", "n", "µ", "m", "", "k", "M", "G", "T", "P", "E", "Z", "Y"];
|
|
56723
56666
|
function formatLocale(locale2) {
|
|
56724
|
-
var group = locale2.grouping === void 0 || locale2.thousands === void 0 ? identity$
|
|
56667
|
+
var group = locale2.grouping === void 0 || locale2.thousands === void 0 ? identity$2 : formatGroup(map.call(locale2.grouping, Number), locale2.thousands + ""), currencyPrefix = locale2.currency === void 0 ? "" : locale2.currency[0] + "", currencySuffix = locale2.currency === void 0 ? "" : locale2.currency[1] + "", decimal = locale2.decimal === void 0 ? "." : locale2.decimal + "", numerals = locale2.numerals === void 0 ? identity$2 : formatNumerals(map.call(locale2.numerals, String)), percent = locale2.percent === void 0 ? "%" : locale2.percent + "", minus = locale2.minus === void 0 ? "−" : locale2.minus + "", nan = locale2.nan === void 0 ? "NaN" : locale2.nan + "";
|
|
56725
56668
|
function newFormat(specifier) {
|
|
56726
56669
|
specifier = formatSpecifier(specifier);
|
|
56727
56670
|
var fill = specifier.fill, align = specifier.align, sign2 = specifier.sign, symbol = specifier.symbol, zero2 = specifier.zero, width = specifier.width, comma = specifier.comma, precision = specifier.precision, trim = specifier.trim, type = specifier.type;
|
|
@@ -56931,7 +56874,7 @@ function number(x2) {
|
|
|
56931
56874
|
return +x2;
|
|
56932
56875
|
}
|
|
56933
56876
|
var unit = [0, 1];
|
|
56934
|
-
function identity(x2) {
|
|
56877
|
+
function identity$1(x2) {
|
|
56935
56878
|
return x2;
|
|
56936
56879
|
}
|
|
56937
56880
|
function normalize(a2, b2) {
|
|
@@ -56973,10 +56916,10 @@ function copy(source, target) {
|
|
|
56973
56916
|
return target.domain(source.domain()).range(source.range()).interpolate(source.interpolate()).clamp(source.clamp()).unknown(source.unknown());
|
|
56974
56917
|
}
|
|
56975
56918
|
function transformer() {
|
|
56976
|
-
var domain = unit, range2 = unit, interpolate$1 = interpolate, transform, untransform, unknown, clamp2 = identity, piecewise, output, input;
|
|
56919
|
+
var domain = unit, range2 = unit, interpolate$1 = interpolate, transform, untransform, unknown, clamp2 = identity$1, piecewise, output, input;
|
|
56977
56920
|
function rescale() {
|
|
56978
56921
|
var n2 = Math.min(domain.length, range2.length);
|
|
56979
|
-
if (clamp2 !== identity) clamp2 = clamper(domain[0], domain[n2 - 1]);
|
|
56922
|
+
if (clamp2 !== identity$1) clamp2 = clamper(domain[0], domain[n2 - 1]);
|
|
56980
56923
|
piecewise = n2 > 2 ? polymap : bimap;
|
|
56981
56924
|
output = input = null;
|
|
56982
56925
|
return scale;
|
|
@@ -56997,7 +56940,7 @@ function transformer() {
|
|
|
56997
56940
|
return range2 = Array.from(_2), interpolate$1 = interpolateRound, rescale();
|
|
56998
56941
|
};
|
|
56999
56942
|
scale.clamp = function(_2) {
|
|
57000
|
-
return arguments.length ? (clamp2 = _2 ? true : identity, rescale()) : clamp2 !== identity;
|
|
56943
|
+
return arguments.length ? (clamp2 = _2 ? true : identity$1, rescale()) : clamp2 !== identity$1;
|
|
57001
56944
|
};
|
|
57002
56945
|
scale.interpolate = function(_2) {
|
|
57003
56946
|
return arguments.length ? (interpolate$1 = _2, rescale()) : interpolate$1;
|
|
@@ -57011,7 +56954,7 @@ function transformer() {
|
|
|
57011
56954
|
};
|
|
57012
56955
|
}
|
|
57013
56956
|
function continuous() {
|
|
57014
|
-
return transformer()(identity, identity);
|
|
56957
|
+
return transformer()(identity$1, identity$1);
|
|
57015
56958
|
}
|
|
57016
56959
|
function tickFormat(start, stop, count, specifier) {
|
|
57017
56960
|
var step = tickStep(start, stop, count), precision;
|
|
@@ -57096,6 +57039,23 @@ function constant(x2) {
|
|
|
57096
57039
|
return x2;
|
|
57097
57040
|
};
|
|
57098
57041
|
}
|
|
57042
|
+
const abs = Math.abs;
|
|
57043
|
+
const atan2 = Math.atan2;
|
|
57044
|
+
const cos = Math.cos;
|
|
57045
|
+
const max = Math.max;
|
|
57046
|
+
const min = Math.min;
|
|
57047
|
+
const sin = Math.sin;
|
|
57048
|
+
const sqrt = Math.sqrt;
|
|
57049
|
+
const epsilon = 1e-12;
|
|
57050
|
+
const pi = Math.PI;
|
|
57051
|
+
const halfPi = pi / 2;
|
|
57052
|
+
const tau = 2 * pi;
|
|
57053
|
+
function acos(x2) {
|
|
57054
|
+
return x2 > 1 ? 0 : x2 < -1 ? pi : Math.acos(x2);
|
|
57055
|
+
}
|
|
57056
|
+
function asin(x2) {
|
|
57057
|
+
return x2 >= 1 ? halfPi : x2 <= -1 ? -halfPi : Math.asin(x2);
|
|
57058
|
+
}
|
|
57099
57059
|
function withPath(shape) {
|
|
57100
57060
|
let digits = 3;
|
|
57101
57061
|
shape.digits = function(_2) {
|
|
@@ -57111,6 +57071,133 @@ function withPath(shape) {
|
|
|
57111
57071
|
};
|
|
57112
57072
|
return () => new Path(digits);
|
|
57113
57073
|
}
|
|
57074
|
+
function arcInnerRadius(d2) {
|
|
57075
|
+
return d2.innerRadius;
|
|
57076
|
+
}
|
|
57077
|
+
function arcOuterRadius(d2) {
|
|
57078
|
+
return d2.outerRadius;
|
|
57079
|
+
}
|
|
57080
|
+
function arcStartAngle(d2) {
|
|
57081
|
+
return d2.startAngle;
|
|
57082
|
+
}
|
|
57083
|
+
function arcEndAngle(d2) {
|
|
57084
|
+
return d2.endAngle;
|
|
57085
|
+
}
|
|
57086
|
+
function arcPadAngle(d2) {
|
|
57087
|
+
return d2 && d2.padAngle;
|
|
57088
|
+
}
|
|
57089
|
+
function intersect(x0, y0, x1, y1, x2, y2, x3, y3) {
|
|
57090
|
+
var x10 = x1 - x0, y10 = y1 - y0, x32 = x3 - x2, y32 = y3 - y2, t2 = y32 * x10 - x32 * y10;
|
|
57091
|
+
if (t2 * t2 < epsilon) return;
|
|
57092
|
+
t2 = (x32 * (y0 - y2) - y32 * (x0 - x2)) / t2;
|
|
57093
|
+
return [x0 + t2 * x10, y0 + t2 * y10];
|
|
57094
|
+
}
|
|
57095
|
+
function cornerTangents(x0, y0, x1, y1, r1, rc, cw) {
|
|
57096
|
+
var x01 = x0 - x1, y01 = y0 - y1, lo = (cw ? rc : -rc) / sqrt(x01 * x01 + y01 * y01), ox = lo * y01, oy = -lo * x01, x11 = x0 + ox, y11 = y0 + oy, x10 = x1 + ox, y10 = y1 + oy, x00 = (x11 + x10) / 2, y00 = (y11 + y10) / 2, dx = x10 - x11, dy = y10 - y11, d2 = dx * dx + dy * dy, r2 = r1 - rc, D2 = x11 * y10 - x10 * y11, d3 = (dy < 0 ? -1 : 1) * sqrt(max(0, r2 * r2 * d2 - D2 * D2)), cx0 = (D2 * dy - dx * d3) / d2, cy0 = (-D2 * dx - dy * d3) / d2, cx1 = (D2 * dy + dx * d3) / d2, cy1 = (-D2 * dx + dy * d3) / d2, dx0 = cx0 - x00, dy0 = cy0 - y00, dx1 = cx1 - x00, dy1 = cy1 - y00;
|
|
57097
|
+
if (dx0 * dx0 + dy0 * dy0 > dx1 * dx1 + dy1 * dy1) cx0 = cx1, cy0 = cy1;
|
|
57098
|
+
return {
|
|
57099
|
+
cx: cx0,
|
|
57100
|
+
cy: cy0,
|
|
57101
|
+
x01: -ox,
|
|
57102
|
+
y01: -oy,
|
|
57103
|
+
x11: cx0 * (r1 / r2 - 1),
|
|
57104
|
+
y11: cy0 * (r1 / r2 - 1)
|
|
57105
|
+
};
|
|
57106
|
+
}
|
|
57107
|
+
function arc() {
|
|
57108
|
+
var innerRadius = arcInnerRadius, outerRadius = arcOuterRadius, cornerRadius = constant(0), padRadius = null, startAngle = arcStartAngle, endAngle = arcEndAngle, padAngle = arcPadAngle, context = null, path = withPath(arc2);
|
|
57109
|
+
function arc2() {
|
|
57110
|
+
var buffer, r2, r0 = +innerRadius.apply(this, arguments), r1 = +outerRadius.apply(this, arguments), a0 = startAngle.apply(this, arguments) - halfPi, a1 = endAngle.apply(this, arguments) - halfPi, da = abs(a1 - a0), cw = a1 > a0;
|
|
57111
|
+
if (!context) context = buffer = path();
|
|
57112
|
+
if (r1 < r0) r2 = r1, r1 = r0, r0 = r2;
|
|
57113
|
+
if (!(r1 > epsilon)) context.moveTo(0, 0);
|
|
57114
|
+
else if (da > tau - epsilon) {
|
|
57115
|
+
context.moveTo(r1 * cos(a0), r1 * sin(a0));
|
|
57116
|
+
context.arc(0, 0, r1, a0, a1, !cw);
|
|
57117
|
+
if (r0 > epsilon) {
|
|
57118
|
+
context.moveTo(r0 * cos(a1), r0 * sin(a1));
|
|
57119
|
+
context.arc(0, 0, r0, a1, a0, cw);
|
|
57120
|
+
}
|
|
57121
|
+
} else {
|
|
57122
|
+
var a01 = a0, a11 = a1, a00 = a0, a10 = a1, da0 = da, da1 = da, ap = padAngle.apply(this, arguments) / 2, rp = ap > epsilon && (padRadius ? +padRadius.apply(this, arguments) : sqrt(r0 * r0 + r1 * r1)), rc = min(abs(r1 - r0) / 2, +cornerRadius.apply(this, arguments)), rc0 = rc, rc1 = rc, t0, t1;
|
|
57123
|
+
if (rp > epsilon) {
|
|
57124
|
+
var p0 = asin(rp / r0 * sin(ap)), p1 = asin(rp / r1 * sin(ap));
|
|
57125
|
+
if ((da0 -= p0 * 2) > epsilon) p0 *= cw ? 1 : -1, a00 += p0, a10 -= p0;
|
|
57126
|
+
else da0 = 0, a00 = a10 = (a0 + a1) / 2;
|
|
57127
|
+
if ((da1 -= p1 * 2) > epsilon) p1 *= cw ? 1 : -1, a01 += p1, a11 -= p1;
|
|
57128
|
+
else da1 = 0, a01 = a11 = (a0 + a1) / 2;
|
|
57129
|
+
}
|
|
57130
|
+
var x01 = r1 * cos(a01), y01 = r1 * sin(a01), x10 = r0 * cos(a10), y10 = r0 * sin(a10);
|
|
57131
|
+
if (rc > epsilon) {
|
|
57132
|
+
var x11 = r1 * cos(a11), y11 = r1 * sin(a11), x00 = r0 * cos(a00), y00 = r0 * sin(a00), oc;
|
|
57133
|
+
if (da < pi) {
|
|
57134
|
+
if (oc = intersect(x01, y01, x00, y00, x11, y11, x10, y10)) {
|
|
57135
|
+
var ax = x01 - oc[0], ay = y01 - oc[1], bx = x11 - oc[0], by = y11 - oc[1], kc = 1 / sin(acos((ax * bx + ay * by) / (sqrt(ax * ax + ay * ay) * sqrt(bx * bx + by * by))) / 2), lc = sqrt(oc[0] * oc[0] + oc[1] * oc[1]);
|
|
57136
|
+
rc0 = min(rc, (r0 - lc) / (kc - 1));
|
|
57137
|
+
rc1 = min(rc, (r1 - lc) / (kc + 1));
|
|
57138
|
+
} else {
|
|
57139
|
+
rc0 = rc1 = 0;
|
|
57140
|
+
}
|
|
57141
|
+
}
|
|
57142
|
+
}
|
|
57143
|
+
if (!(da1 > epsilon)) context.moveTo(x01, y01);
|
|
57144
|
+
else if (rc1 > epsilon) {
|
|
57145
|
+
t0 = cornerTangents(x00, y00, x01, y01, r1, rc1, cw);
|
|
57146
|
+
t1 = cornerTangents(x11, y11, x10, y10, r1, rc1, cw);
|
|
57147
|
+
context.moveTo(t0.cx + t0.x01, t0.cy + t0.y01);
|
|
57148
|
+
if (rc1 < rc) context.arc(t0.cx, t0.cy, rc1, atan2(t0.y01, t0.x01), atan2(t1.y01, t1.x01), !cw);
|
|
57149
|
+
else {
|
|
57150
|
+
context.arc(t0.cx, t0.cy, rc1, atan2(t0.y01, t0.x01), atan2(t0.y11, t0.x11), !cw);
|
|
57151
|
+
context.arc(0, 0, r1, atan2(t0.cy + t0.y11, t0.cx + t0.x11), atan2(t1.cy + t1.y11, t1.cx + t1.x11), !cw);
|
|
57152
|
+
context.arc(t1.cx, t1.cy, rc1, atan2(t1.y11, t1.x11), atan2(t1.y01, t1.x01), !cw);
|
|
57153
|
+
}
|
|
57154
|
+
} else context.moveTo(x01, y01), context.arc(0, 0, r1, a01, a11, !cw);
|
|
57155
|
+
if (!(r0 > epsilon) || !(da0 > epsilon)) context.lineTo(x10, y10);
|
|
57156
|
+
else if (rc0 > epsilon) {
|
|
57157
|
+
t0 = cornerTangents(x10, y10, x11, y11, r0, -rc0, cw);
|
|
57158
|
+
t1 = cornerTangents(x01, y01, x00, y00, r0, -rc0, cw);
|
|
57159
|
+
context.lineTo(t0.cx + t0.x01, t0.cy + t0.y01);
|
|
57160
|
+
if (rc0 < rc) context.arc(t0.cx, t0.cy, rc0, atan2(t0.y01, t0.x01), atan2(t1.y01, t1.x01), !cw);
|
|
57161
|
+
else {
|
|
57162
|
+
context.arc(t0.cx, t0.cy, rc0, atan2(t0.y01, t0.x01), atan2(t0.y11, t0.x11), !cw);
|
|
57163
|
+
context.arc(0, 0, r0, atan2(t0.cy + t0.y11, t0.cx + t0.x11), atan2(t1.cy + t1.y11, t1.cx + t1.x11), cw);
|
|
57164
|
+
context.arc(t1.cx, t1.cy, rc0, atan2(t1.y11, t1.x11), atan2(t1.y01, t1.x01), !cw);
|
|
57165
|
+
}
|
|
57166
|
+
} else context.arc(0, 0, r0, a10, a00, cw);
|
|
57167
|
+
}
|
|
57168
|
+
context.closePath();
|
|
57169
|
+
if (buffer) return context = null, buffer + "" || null;
|
|
57170
|
+
}
|
|
57171
|
+
arc2.centroid = function() {
|
|
57172
|
+
var r2 = (+innerRadius.apply(this, arguments) + +outerRadius.apply(this, arguments)) / 2, a2 = (+startAngle.apply(this, arguments) + +endAngle.apply(this, arguments)) / 2 - pi / 2;
|
|
57173
|
+
return [cos(a2) * r2, sin(a2) * r2];
|
|
57174
|
+
};
|
|
57175
|
+
arc2.innerRadius = function(_2) {
|
|
57176
|
+
return arguments.length ? (innerRadius = typeof _2 === "function" ? _2 : constant(+_2), arc2) : innerRadius;
|
|
57177
|
+
};
|
|
57178
|
+
arc2.outerRadius = function(_2) {
|
|
57179
|
+
return arguments.length ? (outerRadius = typeof _2 === "function" ? _2 : constant(+_2), arc2) : outerRadius;
|
|
57180
|
+
};
|
|
57181
|
+
arc2.cornerRadius = function(_2) {
|
|
57182
|
+
return arguments.length ? (cornerRadius = typeof _2 === "function" ? _2 : constant(+_2), arc2) : cornerRadius;
|
|
57183
|
+
};
|
|
57184
|
+
arc2.padRadius = function(_2) {
|
|
57185
|
+
return arguments.length ? (padRadius = _2 == null ? null : typeof _2 === "function" ? _2 : constant(+_2), arc2) : padRadius;
|
|
57186
|
+
};
|
|
57187
|
+
arc2.startAngle = function(_2) {
|
|
57188
|
+
return arguments.length ? (startAngle = typeof _2 === "function" ? _2 : constant(+_2), arc2) : startAngle;
|
|
57189
|
+
};
|
|
57190
|
+
arc2.endAngle = function(_2) {
|
|
57191
|
+
return arguments.length ? (endAngle = typeof _2 === "function" ? _2 : constant(+_2), arc2) : endAngle;
|
|
57192
|
+
};
|
|
57193
|
+
arc2.padAngle = function(_2) {
|
|
57194
|
+
return arguments.length ? (padAngle = typeof _2 === "function" ? _2 : constant(+_2), arc2) : padAngle;
|
|
57195
|
+
};
|
|
57196
|
+
arc2.context = function(_2) {
|
|
57197
|
+
return arguments.length ? (context = _2 == null ? null : _2, arc2) : context;
|
|
57198
|
+
};
|
|
57199
|
+
return arc2;
|
|
57200
|
+
}
|
|
57114
57201
|
function array(x2) {
|
|
57115
57202
|
return typeof x2 === "object" && "length" in x2 ? x2 : Array.from(x2);
|
|
57116
57203
|
}
|
|
@@ -57260,6 +57347,59 @@ function area(x0, y0, y1) {
|
|
|
57260
57347
|
};
|
|
57261
57348
|
return area2;
|
|
57262
57349
|
}
|
|
57350
|
+
function descending(a2, b2) {
|
|
57351
|
+
return b2 < a2 ? -1 : b2 > a2 ? 1 : b2 >= a2 ? 0 : NaN;
|
|
57352
|
+
}
|
|
57353
|
+
function identity(d2) {
|
|
57354
|
+
return d2;
|
|
57355
|
+
}
|
|
57356
|
+
function pie() {
|
|
57357
|
+
var value = identity, sortValues = descending, sort = null, startAngle = constant(0), endAngle = constant(tau), padAngle = constant(0);
|
|
57358
|
+
function pie2(data) {
|
|
57359
|
+
var i2, n2 = (data = array(data)).length, j2, k2, sum = 0, index2 = new Array(n2), arcs = new Array(n2), a0 = +startAngle.apply(this, arguments), da = Math.min(tau, Math.max(-tau, endAngle.apply(this, arguments) - a0)), a1, p2 = Math.min(Math.abs(da) / n2, padAngle.apply(this, arguments)), pa = p2 * (da < 0 ? -1 : 1), v2;
|
|
57360
|
+
for (i2 = 0; i2 < n2; ++i2) {
|
|
57361
|
+
if ((v2 = arcs[index2[i2] = i2] = +value(data[i2], i2, data)) > 0) {
|
|
57362
|
+
sum += v2;
|
|
57363
|
+
}
|
|
57364
|
+
}
|
|
57365
|
+
if (sortValues != null) index2.sort(function(i3, j3) {
|
|
57366
|
+
return sortValues(arcs[i3], arcs[j3]);
|
|
57367
|
+
});
|
|
57368
|
+
else if (sort != null) index2.sort(function(i3, j3) {
|
|
57369
|
+
return sort(data[i3], data[j3]);
|
|
57370
|
+
});
|
|
57371
|
+
for (i2 = 0, k2 = sum ? (da - n2 * pa) / sum : 0; i2 < n2; ++i2, a0 = a1) {
|
|
57372
|
+
j2 = index2[i2], v2 = arcs[j2], a1 = a0 + (v2 > 0 ? v2 * k2 : 0) + pa, arcs[j2] = {
|
|
57373
|
+
data: data[j2],
|
|
57374
|
+
index: i2,
|
|
57375
|
+
value: v2,
|
|
57376
|
+
startAngle: a0,
|
|
57377
|
+
endAngle: a1,
|
|
57378
|
+
padAngle: p2
|
|
57379
|
+
};
|
|
57380
|
+
}
|
|
57381
|
+
return arcs;
|
|
57382
|
+
}
|
|
57383
|
+
pie2.value = function(_2) {
|
|
57384
|
+
return arguments.length ? (value = typeof _2 === "function" ? _2 : constant(+_2), pie2) : value;
|
|
57385
|
+
};
|
|
57386
|
+
pie2.sortValues = function(_2) {
|
|
57387
|
+
return arguments.length ? (sortValues = _2, sort = null, pie2) : sortValues;
|
|
57388
|
+
};
|
|
57389
|
+
pie2.sort = function(_2) {
|
|
57390
|
+
return arguments.length ? (sort = _2, sortValues = null, pie2) : sort;
|
|
57391
|
+
};
|
|
57392
|
+
pie2.startAngle = function(_2) {
|
|
57393
|
+
return arguments.length ? (startAngle = typeof _2 === "function" ? _2 : constant(+_2), pie2) : startAngle;
|
|
57394
|
+
};
|
|
57395
|
+
pie2.endAngle = function(_2) {
|
|
57396
|
+
return arguments.length ? (endAngle = typeof _2 === "function" ? _2 : constant(+_2), pie2) : endAngle;
|
|
57397
|
+
};
|
|
57398
|
+
pie2.padAngle = function(_2) {
|
|
57399
|
+
return arguments.length ? (padAngle = typeof _2 === "function" ? _2 : constant(+_2), pie2) : padAngle;
|
|
57400
|
+
};
|
|
57401
|
+
return pie2;
|
|
57402
|
+
}
|
|
57263
57403
|
function sign(x2) {
|
|
57264
57404
|
return x2 < 0 ? -1 : 1;
|
|
57265
57405
|
}
|
|
@@ -57332,7 +57472,7 @@ Object.create(MonotoneX.prototype).point = function(x2, y2) {
|
|
|
57332
57472
|
function monotoneX(context) {
|
|
57333
57473
|
return new MonotoneX(context);
|
|
57334
57474
|
}
|
|
57335
|
-
const formatNumber = (num, symbol, labelType) => {
|
|
57475
|
+
const formatNumber$6 = (num, symbol, labelType) => {
|
|
57336
57476
|
if (labelType === "inPercent") {
|
|
57337
57477
|
return `${format(".0%")(num / 100)}`;
|
|
57338
57478
|
} else if (labelType === "inValue") {
|
|
@@ -57340,17 +57480,17 @@ const formatNumber = (num, symbol, labelType) => {
|
|
|
57340
57480
|
}
|
|
57341
57481
|
return num.toString();
|
|
57342
57482
|
};
|
|
57343
|
-
const AreaLineChart = ({ data, height = 400, customLabelFormatter, yAxisLabelType = "inValue", currency, colors, customLegend }) => {
|
|
57483
|
+
const AreaLineChart$1 = ({ data, height = 400, customLabelFormatter, yAxisLabelType = "inValue", currency, colors, customLegend }) => {
|
|
57344
57484
|
const svgRef = useRef(null);
|
|
57345
57485
|
const wrapperRef = useRef(null);
|
|
57346
|
-
const [containerWidth,
|
|
57486
|
+
const [containerWidth, setContainerWidth2] = useState(0);
|
|
57347
57487
|
const [tooltipData, setTooltipData] = useState(null);
|
|
57348
57488
|
useEffect(() => {
|
|
57349
57489
|
const wrapper = wrapperRef.current;
|
|
57350
57490
|
const resizeObserver = new ResizeObserver((entries) => {
|
|
57351
57491
|
if (entries[0]) {
|
|
57352
57492
|
const newWidth = entries[0].contentRect.width;
|
|
57353
|
-
|
|
57493
|
+
setContainerWidth2(newWidth);
|
|
57354
57494
|
}
|
|
57355
57495
|
});
|
|
57356
57496
|
if (wrapper) {
|
|
@@ -57370,14 +57510,14 @@ const AreaLineChart = ({ data, height = 400, customLabelFormatter, yAxisLabelTyp
|
|
|
57370
57510
|
select(svgRef.current).selectAll("*").remove();
|
|
57371
57511
|
const svg = select(svgRef.current).attr("width", containerWidth).attr("height", height).append("g").attr("transform", `translate(${margin.left},${margin.top})`);
|
|
57372
57512
|
const x2 = point$1().domain(data[0].values.map((d2) => d2.month)).range([0, width]);
|
|
57373
|
-
const y2 = linear().domain([0, max(data, (dataset) => max(dataset.values, (d2) => d2.value))]).range([chartHeight, 0]);
|
|
57513
|
+
const y2 = linear().domain([0, max$1(data, (dataset) => max$1(dataset.values, (d2) => d2.value))]).range([chartHeight, 0]);
|
|
57374
57514
|
const numTicks = Math.floor(width / 80);
|
|
57375
57515
|
const xAxis = axisBottom(x2).ticks(numTicks);
|
|
57376
57516
|
const xAxisGroup = svg.append("g").attr("transform", `translate(0,${chartHeight})`).call(xAxis);
|
|
57377
57517
|
xAxisGroup.selectAll("text").attr("transform", "translate(0, 10)").attr("color", "#8E8E93").style("text-anchor", "middle");
|
|
57378
57518
|
const yAxis = svg.append("g");
|
|
57379
57519
|
yAxis.append("g").attr("color", "#8E8E93").attr("transform", `translate(-10,0)`).call(axisLeft(y2).tickSize(-width).tickFormat(
|
|
57380
|
-
(d2) => customLabelFormatter ? customLabelFormatter(d2) : formatNumber(d2, currency, yAxisLabelType)
|
|
57520
|
+
(d2) => customLabelFormatter ? customLabelFormatter(d2) : formatNumber$6(d2, currency, yAxisLabelType)
|
|
57381
57521
|
).tickSizeOuter(0)).selectAll("line").attr("stroke-dasharray", "3,3").attr("stroke", "#D3D3D4");
|
|
57382
57522
|
xAxisGroup.selectAll(".tick line").remove();
|
|
57383
57523
|
yAxis.select(".domain").attr("stroke", "none");
|
|
@@ -57425,6 +57565,391 @@ const AreaLineChart = ({ data, height = 400, customLabelFormatter, yAxisLabelTyp
|
|
|
57425
57565
|
}, children: /* @__PURE__ */ jsx("span", { style: { fontSize: "16px", weight: "500", color: "#ffff" }, children: tooltipData.content }) })
|
|
57426
57566
|
] });
|
|
57427
57567
|
};
|
|
57568
|
+
const formatNumber$5 = (num) => {
|
|
57569
|
+
if (num >= 1e9) return (num / 1e9).toFixed(1) + "B";
|
|
57570
|
+
if (num >= 1e6) return (num / 1e6).toFixed(1) + "M";
|
|
57571
|
+
if (num >= 1e3) return (num / 1e3).toFixed(1) + "K";
|
|
57572
|
+
return num;
|
|
57573
|
+
};
|
|
57574
|
+
const BarChart$1 = ({
|
|
57575
|
+
data,
|
|
57576
|
+
numOfLines = 5,
|
|
57577
|
+
width = 500,
|
|
57578
|
+
height = 300,
|
|
57579
|
+
line: line2 = false
|
|
57580
|
+
}) => {
|
|
57581
|
+
const svgRef = useRef(null);
|
|
57582
|
+
const maxValue = useMemo(() => {
|
|
57583
|
+
return Math.max(...data.map((d2) => d2.value));
|
|
57584
|
+
}, [data]);
|
|
57585
|
+
const yAxisMaxValue = useMemo(() => {
|
|
57586
|
+
return maxValue * 1.25;
|
|
57587
|
+
}, [maxValue]);
|
|
57588
|
+
const yAxisTicks = useMemo(() => {
|
|
57589
|
+
const ticks2 = [];
|
|
57590
|
+
const interval = yAxisMaxValue / numOfLines;
|
|
57591
|
+
for (let i2 = 0; i2 <= numOfLines; i2++) {
|
|
57592
|
+
ticks2.push(interval * i2);
|
|
57593
|
+
}
|
|
57594
|
+
return ticks2;
|
|
57595
|
+
}, [yAxisMaxValue, numOfLines]);
|
|
57596
|
+
useEffect(() => {
|
|
57597
|
+
if (!svgRef.current) return;
|
|
57598
|
+
const svg = select(svgRef.current);
|
|
57599
|
+
svg.selectAll("*").remove();
|
|
57600
|
+
const margin = { top: 20, right: 20, bottom: 70, left: 40 };
|
|
57601
|
+
const barWidth = width - margin.left - margin.right;
|
|
57602
|
+
const barHeight = height - margin.top - margin.bottom;
|
|
57603
|
+
const mousemove = (event, d2) => {
|
|
57604
|
+
var _a, _b;
|
|
57605
|
+
let xPosition = event.offsetX + margin.left - 25;
|
|
57606
|
+
const yPosition = event.offsetY + margin.top - 40;
|
|
57607
|
+
const tooltipWidth = (_b = (_a = tooltip.node()) == null ? void 0 : _a.getBoundingClientRect()) == null ? void 0 : _b.width;
|
|
57608
|
+
const rightOffset = tooltipWidth ? xPosition + tooltipWidth : xPosition;
|
|
57609
|
+
if (rightOffset > width) {
|
|
57610
|
+
xPosition = Math.floor(
|
|
57611
|
+
tooltipWidth ? xPosition - tooltipWidth - 20 : xPosition - 20
|
|
57612
|
+
);
|
|
57613
|
+
}
|
|
57614
|
+
const text = `${d2.label} - ${d2.value}`;
|
|
57615
|
+
tooltip.attr("x", xPosition).attr("y", yPosition).style("opacity", 9).style("height", text.length >= 16 ? 50 : 35);
|
|
57616
|
+
tooltipText.html(text);
|
|
57617
|
+
};
|
|
57618
|
+
const mouseleave = () => {
|
|
57619
|
+
tooltip.style("opacity", 0);
|
|
57620
|
+
};
|
|
57621
|
+
const x2 = band().domain(data.map((d2) => d2.label)).range([0, barWidth]).padding(0.1);
|
|
57622
|
+
const y2 = linear().domain([0, yAxisMaxValue]).range([barHeight, 0]);
|
|
57623
|
+
const chart = svg.append("g").attr("transform", `translate(${margin.left},${margin.top})`);
|
|
57624
|
+
if (line2) {
|
|
57625
|
+
yAxisTicks.slice(1).forEach((tick) => {
|
|
57626
|
+
chart.append("line").attr("class", "dotted-line").attr("x1", 0).attr("y1", y2(tick)).attr("x2", barWidth).attr("y2", y2(tick)).style("stroke", "gray").style("stroke-dasharray", "3,3").style("opacity", 1);
|
|
57627
|
+
});
|
|
57628
|
+
}
|
|
57629
|
+
chart.selectAll(".bar").data(data).enter().append("rect").attr("class", "bar").attr("x", (d2) => x2(d2.label)).attr("y", (d2) => y2(d2.value)).attr("width", x2.bandwidth()).attr("height", (d2) => barHeight - y2(d2.value)).style("fill", "#357AF6").style("opacity", "1").on("mousemove", mousemove).on("mouseleave", mouseleave);
|
|
57630
|
+
const xAxis = chart.append("g").attr("class", "x-axis").attr("transform", `translate(0, ${barHeight})`).call(axisBottom(x2));
|
|
57631
|
+
xAxis.selectAll(".tick line").remove();
|
|
57632
|
+
const yAxis = chart.append("g").attr("class", "y-axis").call(
|
|
57633
|
+
axisLeft(y2).tickValues(yAxisTicks).tickFormat((d2) => {
|
|
57634
|
+
return formatNumber$5(d2);
|
|
57635
|
+
}).tickSizeOuter(0)
|
|
57636
|
+
);
|
|
57637
|
+
yAxis.selectAll(".tick line").remove();
|
|
57638
|
+
const tooltip = svg.append("foreignObject").attr("class", "tooltip").attr("width", 120).attr("height", 20).style("opacity", 0).style("position", "absolute").style("background-color", "white").style("border", "none").style("box-shadow", "0rem 0rem 0.469rem 0rem rgba(0, 0, 0, 0.15)").style("border-radius", "0.313rem").style("padding", "0.625rem").style("font-size", "0.75rem");
|
|
57639
|
+
const tooltipText = tooltip.append("xhtml:div").style("font-size", "0.75rem").style("color", "black");
|
|
57640
|
+
}, [data, height, width, line2, yAxisMaxValue, yAxisTicks]);
|
|
57641
|
+
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx("svg", { ref: svgRef, width, height }) });
|
|
57642
|
+
};
|
|
57643
|
+
const formatNumber$4 = (num, symbol, labelType) => {
|
|
57644
|
+
if (labelType === "inPercent") {
|
|
57645
|
+
return `${format(".0%")(num / 100)}`;
|
|
57646
|
+
} else if (labelType === "inValue") {
|
|
57647
|
+
return `${symbol || ""} ${format(".2s")(num).replace("k", "K")}`;
|
|
57648
|
+
}
|
|
57649
|
+
return num.toString();
|
|
57650
|
+
};
|
|
57651
|
+
function wrapText(textSelection, width) {
|
|
57652
|
+
textSelection.each(function() {
|
|
57653
|
+
const text = select(this);
|
|
57654
|
+
const originalText = text.text();
|
|
57655
|
+
if (originalText.length <= 8) {
|
|
57656
|
+
return;
|
|
57657
|
+
}
|
|
57658
|
+
if (originalText.length > 12) {
|
|
57659
|
+
text.text(originalText.substring(0, 10) + "...");
|
|
57660
|
+
return;
|
|
57661
|
+
}
|
|
57662
|
+
const words = originalText.split(/\s+/).reverse();
|
|
57663
|
+
let word;
|
|
57664
|
+
let line2 = [];
|
|
57665
|
+
let lineNumber = 0;
|
|
57666
|
+
const lineHeight = 1.1;
|
|
57667
|
+
const y2 = text.attr("y");
|
|
57668
|
+
const dy = parseFloat(text.attr("dy")) || 0;
|
|
57669
|
+
let tspan = text.text(null).append("tspan").attr("x", 0).attr("y", y2).attr("dy", `${dy}em`);
|
|
57670
|
+
while (word = words.pop()) {
|
|
57671
|
+
line2.push(word);
|
|
57672
|
+
tspan.text(line2.join(" "));
|
|
57673
|
+
if (tspan.node() && tspan.node().getComputedTextLength() > width) {
|
|
57674
|
+
line2.pop();
|
|
57675
|
+
tspan.text(line2.join(" "));
|
|
57676
|
+
line2 = [word];
|
|
57677
|
+
tspan = text.append("tspan").attr("x", 0).attr("y", y2).attr("dy", `${++lineNumber * lineHeight + dy}em`).text(word);
|
|
57678
|
+
}
|
|
57679
|
+
}
|
|
57680
|
+
});
|
|
57681
|
+
}
|
|
57682
|
+
const BarChart = ({
|
|
57683
|
+
data,
|
|
57684
|
+
numOfLines = 5,
|
|
57685
|
+
initialWidth = 500,
|
|
57686
|
+
height = 400,
|
|
57687
|
+
line: line2 = false,
|
|
57688
|
+
yAxisLabelType = "inValue",
|
|
57689
|
+
currency,
|
|
57690
|
+
customLabelFormatter
|
|
57691
|
+
}) => {
|
|
57692
|
+
const svgRef = useRef(null);
|
|
57693
|
+
const wrapperRef = useRef(null);
|
|
57694
|
+
const [containerWidth, setContainerWidth2] = useState(initialWidth);
|
|
57695
|
+
const maxValue = useMemo(() => Math.max(...data.map((d2) => d2.value)), [data]);
|
|
57696
|
+
const yAxisMaxValue = useMemo(() => maxValue * 1.25, [maxValue]);
|
|
57697
|
+
const yAxisTicks = useMemo(() => {
|
|
57698
|
+
const ticks2 = [];
|
|
57699
|
+
const interval = yAxisMaxValue / numOfLines;
|
|
57700
|
+
for (let i2 = 0; i2 <= numOfLines; i2++) {
|
|
57701
|
+
ticks2.push(interval * i2);
|
|
57702
|
+
}
|
|
57703
|
+
return ticks2;
|
|
57704
|
+
}, [yAxisMaxValue, numOfLines]);
|
|
57705
|
+
const needsHorizontalScroll = data.length > 12;
|
|
57706
|
+
const minGroupWidth = 120;
|
|
57707
|
+
const calculatedChartWidth = needsHorizontalScroll ? Math.max(data.length * minGroupWidth, containerWidth) : containerWidth;
|
|
57708
|
+
useEffect(() => {
|
|
57709
|
+
const wrapper = wrapperRef.current;
|
|
57710
|
+
const resizeObserver = new ResizeObserver((entries) => {
|
|
57711
|
+
if (entries[0]) {
|
|
57712
|
+
const newWidth = entries[0].contentRect.width;
|
|
57713
|
+
setContainerWidth2(newWidth);
|
|
57714
|
+
}
|
|
57715
|
+
});
|
|
57716
|
+
if (wrapper) {
|
|
57717
|
+
resizeObserver.observe(wrapper);
|
|
57718
|
+
}
|
|
57719
|
+
return () => {
|
|
57720
|
+
if (wrapper) {
|
|
57721
|
+
resizeObserver.unobserve(wrapper);
|
|
57722
|
+
}
|
|
57723
|
+
};
|
|
57724
|
+
}, []);
|
|
57725
|
+
useEffect(() => {
|
|
57726
|
+
if (containerWidth === 0) return;
|
|
57727
|
+
const svg = select(svgRef.current);
|
|
57728
|
+
svg.selectAll("*").remove();
|
|
57729
|
+
const maxLabelWidth = 80;
|
|
57730
|
+
const dynamicLeftMargin = Math.max(60, maxLabelWidth + 30);
|
|
57731
|
+
const margin = { top: 20, right: 20, bottom: 25, left: dynamicLeftMargin };
|
|
57732
|
+
const barWidth = calculatedChartWidth - margin.left - margin.right;
|
|
57733
|
+
const barHeight = maxValue ? height - margin.top - margin.bottom : 0;
|
|
57734
|
+
const x2 = band().domain(data.map((d2) => d2.label)).range([0, barWidth]).padding(0.5);
|
|
57735
|
+
const y2 = linear().domain([0, yAxisMaxValue]).range([barHeight, 0]);
|
|
57736
|
+
const chart = svg.append("g").attr("transform", `translate(${margin.left},${maxValue ? margin.top : height - 50})`);
|
|
57737
|
+
if (line2) {
|
|
57738
|
+
yAxisTicks.slice(1).forEach((tick) => {
|
|
57739
|
+
chart.append("line").attr("class", "dotted-line").attr("x1", 0).attr("y1", y2(tick)).attr("x2", barWidth).attr("y2", y2(tick)).style("stroke", "#D3D3D4").style("stroke-dasharray", "3,3").style("opacity", 1);
|
|
57740
|
+
});
|
|
57741
|
+
}
|
|
57742
|
+
chart.selectAll(".bar").data(data).enter().append("rect").attr("rx", 5).attr("ry", 5).attr("class", "bar").attr("x", (d2) => x2(d2.label)).attr("y", (d2) => y2(d2.value)).attr("width", x2.bandwidth()).attr("height", (d2) => barHeight - y2(d2.value)).style("fill", (d2) => d2.color);
|
|
57743
|
+
const xAxis = chart.append("g").attr("class", "x-axis").attr("transform", `translate(0, ${barHeight})`).call(axisTop(x2).tickPadding(10)).call(axisBottom(x2).tickPadding(5));
|
|
57744
|
+
xAxis.selectAll(".tick line").remove();
|
|
57745
|
+
xAxis.selectAll(".tick text").call(wrapText, 80);
|
|
57746
|
+
const availableHeight = barHeight;
|
|
57747
|
+
const minTickSpacing = 30;
|
|
57748
|
+
const maxOptimalTicks = Math.floor(availableHeight / minTickSpacing);
|
|
57749
|
+
const optimalNumTicks = Math.min(numOfLines, maxOptimalTicks, 8);
|
|
57750
|
+
const optimalTicks = [];
|
|
57751
|
+
const optimalInterval = yAxisMaxValue / optimalNumTicks;
|
|
57752
|
+
for (let i2 = 0; i2 <= optimalNumTicks; i2++) {
|
|
57753
|
+
optimalTicks.push(optimalInterval * i2);
|
|
57754
|
+
}
|
|
57755
|
+
const yAxis = chart.append("g").attr("class", "y-axis").call(
|
|
57756
|
+
axisLeft(y2).tickValues(optimalTicks).tickFormat(
|
|
57757
|
+
(d2) => customLabelFormatter ? customLabelFormatter(d2) : formatNumber$4(d2, currency, yAxisLabelType)
|
|
57758
|
+
).tickSizeOuter(0).tickPadding(8)
|
|
57759
|
+
// Add padding between ticks and labels
|
|
57760
|
+
);
|
|
57761
|
+
yAxis.selectAll(".tick line").remove();
|
|
57762
|
+
yAxis.select(".domain").attr("stroke", "none");
|
|
57763
|
+
xAxis.select(".domain").attr("stroke", "none");
|
|
57764
|
+
yAxis.selectAll(".tick text").style("font-size", "11px").style("fill", "#666").style("font-family", "Inter, system-ui, Avenir, Helvetica, Arial, sans-serif").style("text-anchor", "end");
|
|
57765
|
+
}, [data, containerWidth, height, line2, yAxisMaxValue, yAxisTicks, currency, yAxisLabelType, customLabelFormatter, calculatedChartWidth]);
|
|
57766
|
+
return /* @__PURE__ */ jsx(
|
|
57767
|
+
"div",
|
|
57768
|
+
{
|
|
57769
|
+
ref: wrapperRef,
|
|
57770
|
+
style: {
|
|
57771
|
+
width: "100%",
|
|
57772
|
+
overflowX: needsHorizontalScroll ? "auto" : "hidden",
|
|
57773
|
+
overflowY: "hidden"
|
|
57774
|
+
},
|
|
57775
|
+
children: /* @__PURE__ */ jsx("svg", { ref: svgRef, width: calculatedChartWidth, height, viewBox: `0 0 ${calculatedChartWidth} ${height}` })
|
|
57776
|
+
}
|
|
57777
|
+
);
|
|
57778
|
+
};
|
|
57779
|
+
const BarLineChart = ({
|
|
57780
|
+
data,
|
|
57781
|
+
height = 400,
|
|
57782
|
+
margin = { top: 20, right: 30, bottom: 30, left: 50 },
|
|
57783
|
+
bars,
|
|
57784
|
+
lines,
|
|
57785
|
+
line: line$1 = true,
|
|
57786
|
+
showGrid = true,
|
|
57787
|
+
barColors,
|
|
57788
|
+
lineColors
|
|
57789
|
+
}) => {
|
|
57790
|
+
var _a;
|
|
57791
|
+
const svgRef = useRef(null);
|
|
57792
|
+
const wrapperRef = useRef(null);
|
|
57793
|
+
const scrollContainerRef = useRef(null);
|
|
57794
|
+
const [tooltip, setTooltip] = useState(null);
|
|
57795
|
+
const [containerWidth, setContainerWidth2] = useState(0);
|
|
57796
|
+
const formatNumber2 = (num) => format(".2s")(num).replace("k", "K");
|
|
57797
|
+
const needsHorizontalScroll = data.length > bars.length;
|
|
57798
|
+
const minBarWidth = 60;
|
|
57799
|
+
const calculatedChartWidth = needsHorizontalScroll ? Math.max(data.length * minBarWidth, containerWidth) : containerWidth;
|
|
57800
|
+
useEffect(() => {
|
|
57801
|
+
const wrapper = wrapperRef.current;
|
|
57802
|
+
const resizeObserver = new ResizeObserver((entries) => {
|
|
57803
|
+
if (entries[0]) {
|
|
57804
|
+
const newWidth = entries[0].contentRect.width;
|
|
57805
|
+
setContainerWidth2(newWidth);
|
|
57806
|
+
}
|
|
57807
|
+
});
|
|
57808
|
+
if (wrapper) {
|
|
57809
|
+
resizeObserver.observe(wrapper);
|
|
57810
|
+
}
|
|
57811
|
+
return () => {
|
|
57812
|
+
if (wrapper) {
|
|
57813
|
+
resizeObserver.unobserve(wrapper);
|
|
57814
|
+
}
|
|
57815
|
+
};
|
|
57816
|
+
}, []);
|
|
57817
|
+
useEffect(() => {
|
|
57818
|
+
if (containerWidth === 0) return;
|
|
57819
|
+
const yMax = max$1(data, (d2) => {
|
|
57820
|
+
return Math.max(
|
|
57821
|
+
...bars.map((bar) => d2[bar.field]),
|
|
57822
|
+
...lines.map((line2) => d2[line2.field])
|
|
57823
|
+
);
|
|
57824
|
+
}) ?? 0;
|
|
57825
|
+
const yMin = min$1(data, (d2) => {
|
|
57826
|
+
return Math.min(
|
|
57827
|
+
...bars.map((bar) => d2[bar.field]),
|
|
57828
|
+
...lines.map((line2) => d2[line2.field])
|
|
57829
|
+
);
|
|
57830
|
+
}) ?? 0;
|
|
57831
|
+
const svg = select(svgRef.current);
|
|
57832
|
+
const innerWidth = calculatedChartWidth - margin.left - margin.right;
|
|
57833
|
+
const innerHeight = yMax || yMin ? height - margin.top - margin.bottom : 0;
|
|
57834
|
+
const x2 = band().domain(data.map((d2) => d2.month)).range([0, innerWidth]).padding(0.3);
|
|
57835
|
+
const y2 = linear().domain([yMin, yMax]).nice().range([innerHeight, 0]);
|
|
57836
|
+
svg.selectAll("*").remove();
|
|
57837
|
+
const g2 = svg.append("g").attr("transform", `translate(${margin.left},${margin.top})`);
|
|
57838
|
+
const yAxis = g2.append("g").call(axisLeft(y2).tickFormat(formatNumber2)).call((g22) => g22.select(".domain").remove());
|
|
57839
|
+
yAxis.select(".domain").attr("stroke", "none");
|
|
57840
|
+
const xAxis = g2.append("g").attr("transform", `translate(0,${innerHeight})`).call(axisBottom(x2)).selectAll(".tick text").attr("text-anchor", "middle");
|
|
57841
|
+
xAxis.select(".domain").attr("stroke", "none");
|
|
57842
|
+
if (showGrid) {
|
|
57843
|
+
g2.selectAll(".grid-line").data(y2.ticks()).enter().append("line").attr("class", "grid-line").attr("x1", 0).attr("x2", innerWidth).attr("y1", (d2) => y2(d2)).attr("y2", (d2) => y2(d2)).style("stroke", "#ddd").style("stroke-dasharray", "8,8").style("stroke-width", 1);
|
|
57844
|
+
}
|
|
57845
|
+
if (line$1) {
|
|
57846
|
+
g2.selectAll(".grid-line-2").data(y2.ticks()).enter().append("line").attr("class", "grid-line-2").attr("x1", 0).attr("x2", innerWidth).attr("y1", (d2) => y2(d2)).attr("y2", (d2) => y2(d2)).style("stroke", "#ddd").style("stroke-dasharray", "8,8").style("stroke-width", 1);
|
|
57847
|
+
}
|
|
57848
|
+
bars.forEach((bar, i2) => {
|
|
57849
|
+
g2.selectAll(`.bar-${bar.field}`).data(data).enter().append("rect").attr("class", `bar bar-${bar.field}`).attr("x", (d2) => x2(d2.month) ?? 0).attr("y", (d2) => d2[bar.field] >= 0 ? y2(d2[bar.field]) : y2(0)).attr("rx", 5).attr("ry", 5).attr("width", x2.bandwidth() / bars.length).attr("height", (d2) => {
|
|
57850
|
+
return Math.abs(y2(d2[bar.field]) - y2(0));
|
|
57851
|
+
}).attr("fill", barColors[i2]).attr("transform", `translate(${i2 * x2.bandwidth() / bars.length}, 0)`).on("mouseover", function(event, d2) {
|
|
57852
|
+
var _a2;
|
|
57853
|
+
const [xPos, yPos] = pointer(event, svgRef.current);
|
|
57854
|
+
const scrollLeft = ((_a2 = scrollContainerRef.current) == null ? void 0 : _a2.scrollLeft) || 0;
|
|
57855
|
+
setTooltip({
|
|
57856
|
+
x: xPos + margin.left - scrollLeft,
|
|
57857
|
+
y: yPos + margin.top,
|
|
57858
|
+
content: d2
|
|
57859
|
+
});
|
|
57860
|
+
}).on("mouseout", () => setTooltip(null));
|
|
57861
|
+
});
|
|
57862
|
+
lines.forEach((line2, index2) => {
|
|
57863
|
+
const lineGenerator = line().x((d2) => (x2(d2.month) ?? 0) + x2.bandwidth() / 2).y((d2) => y2(d2[line2.field])).curve(monotoneX);
|
|
57864
|
+
g2.append("path").datum(data).attr("fill", "none").attr("stroke", lineColors[index2]).attr("stroke-width", 2).attr("d", lineGenerator).on("mouseover", function(event) {
|
|
57865
|
+
var _a2;
|
|
57866
|
+
const [xPos] = pointer(event, svgRef.current);
|
|
57867
|
+
const month = x2.domain().find((month2) => {
|
|
57868
|
+
const monthPosition = x2(month2) ?? 0;
|
|
57869
|
+
return xPos >= monthPosition && xPos <= monthPosition + x2.bandwidth();
|
|
57870
|
+
});
|
|
57871
|
+
if (month) {
|
|
57872
|
+
const closestDataPoint = data.find((d2) => d2.month === month);
|
|
57873
|
+
if (closestDataPoint) {
|
|
57874
|
+
const scrollLeft = ((_a2 = scrollContainerRef.current) == null ? void 0 : _a2.scrollLeft) || 0;
|
|
57875
|
+
setTooltip({
|
|
57876
|
+
x: xPos + margin.left - scrollLeft,
|
|
57877
|
+
y: y2(closestDataPoint[line2.field]) + margin.top,
|
|
57878
|
+
content: closestDataPoint
|
|
57879
|
+
});
|
|
57880
|
+
}
|
|
57881
|
+
}
|
|
57882
|
+
}).on("mouseout", () => setTooltip(null));
|
|
57883
|
+
});
|
|
57884
|
+
}, [data, containerWidth, calculatedChartWidth, line$1, height, margin, bars, lines, showGrid, barColors, lineColors]);
|
|
57885
|
+
return /* @__PURE__ */ jsx("div", { ref: wrapperRef, style: { width: "100%", height: "100%" }, children: /* @__PURE__ */ jsxs("div", { style: { position: "relative" }, children: [
|
|
57886
|
+
/* @__PURE__ */ jsx(
|
|
57887
|
+
"div",
|
|
57888
|
+
{
|
|
57889
|
+
ref: scrollContainerRef,
|
|
57890
|
+
style: {
|
|
57891
|
+
width: "100%",
|
|
57892
|
+
overflowX: needsHorizontalScroll ? "auto" : "hidden",
|
|
57893
|
+
overflowY: "hidden"
|
|
57894
|
+
},
|
|
57895
|
+
children: /* @__PURE__ */ jsx(
|
|
57896
|
+
"svg",
|
|
57897
|
+
{
|
|
57898
|
+
ref: svgRef,
|
|
57899
|
+
width: calculatedChartWidth,
|
|
57900
|
+
height,
|
|
57901
|
+
viewBox: `0 0 ${calculatedChartWidth} ${height}`,
|
|
57902
|
+
style: { display: "block" }
|
|
57903
|
+
}
|
|
57904
|
+
)
|
|
57905
|
+
}
|
|
57906
|
+
),
|
|
57907
|
+
tooltip && /* @__PURE__ */ jsx(
|
|
57908
|
+
"div",
|
|
57909
|
+
{
|
|
57910
|
+
style: {
|
|
57911
|
+
position: "absolute",
|
|
57912
|
+
left: tooltip.x,
|
|
57913
|
+
top: tooltip.y,
|
|
57914
|
+
pointerEvents: "none",
|
|
57915
|
+
backgroundColor: "white",
|
|
57916
|
+
zIndex: "99999",
|
|
57917
|
+
border: "none",
|
|
57918
|
+
padding: "5px",
|
|
57919
|
+
borderRadius: "3px",
|
|
57920
|
+
transform: "translate(-50%, -100%)"
|
|
57921
|
+
},
|
|
57922
|
+
children: /* @__PURE__ */ jsxs(Box, { children: [
|
|
57923
|
+
/* @__PURE__ */ jsx("div", { style: { background: "#F3F2F2", padding: "10px" }, children: /* @__PURE__ */ jsx(Typography$1, { type: "s4", style: { whiteSpace: "noWrap", width: "200px", color: "#232529" }, children: (_a = tooltip.content) == null ? void 0 : _a.month }) }),
|
|
57924
|
+
/* @__PURE__ */ jsxs(Box, { sx: { p: 1.5, display: "flex", flexDirection: "column", gap: 1.5 }, children: [
|
|
57925
|
+
bars.map((bar, index2) => /* @__PURE__ */ jsxs(Box, { sx: { display: "flex", gap: 1.5, alignItems: "center" }, children: [
|
|
57926
|
+
/* @__PURE__ */ jsx("div", { className: "circle", style: { backgroundColor: barColors[index2] } }),
|
|
57927
|
+
/* @__PURE__ */ jsxs(Typography$1, { type: "s5", color: "theme.secondary.900", children: [
|
|
57928
|
+
bar.label,
|
|
57929
|
+
": ",
|
|
57930
|
+
/* @__PURE__ */ jsxs("span", { style: { fontWeight: 600 }, children: [
|
|
57931
|
+
"$ ",
|
|
57932
|
+
tooltip.content[bar.field]
|
|
57933
|
+
] })
|
|
57934
|
+
] })
|
|
57935
|
+
] }, `bar-${index2}`)),
|
|
57936
|
+
lines.map((line2, index2) => /* @__PURE__ */ jsxs(Box, { sx: { display: "flex", gap: 1.5, alignItems: "center" }, children: [
|
|
57937
|
+
/* @__PURE__ */ jsx("div", { className: "circle", style: { backgroundColor: lineColors[index2] } }),
|
|
57938
|
+
/* @__PURE__ */ jsxs(Typography$1, { type: "s5", color: "theme.secondary.900", children: [
|
|
57939
|
+
line2.label,
|
|
57940
|
+
": ",
|
|
57941
|
+
/* @__PURE__ */ jsxs("span", { style: { fontWeight: 600 }, children: [
|
|
57942
|
+
"$ ",
|
|
57943
|
+
tooltip.content[line2.field]
|
|
57944
|
+
] })
|
|
57945
|
+
] })
|
|
57946
|
+
] }, `line-${index2}`))
|
|
57947
|
+
] })
|
|
57948
|
+
] })
|
|
57949
|
+
}
|
|
57950
|
+
)
|
|
57951
|
+
] }) });
|
|
57952
|
+
};
|
|
57428
57953
|
function ChartLegends({ legends, colors }) {
|
|
57429
57954
|
return /* @__PURE__ */ jsx(
|
|
57430
57955
|
Box,
|
|
@@ -57447,6 +57972,469 @@ function ChartLegends({ legends, colors }) {
|
|
|
57447
57972
|
}
|
|
57448
57973
|
);
|
|
57449
57974
|
}
|
|
57975
|
+
const defaultColors = [
|
|
57976
|
+
"#5BCE97",
|
|
57977
|
+
"#B3D8E2",
|
|
57978
|
+
"#F5F6F5",
|
|
57979
|
+
"#AE6B9E",
|
|
57980
|
+
"#CBD49A",
|
|
57981
|
+
"#EEE0B3"
|
|
57982
|
+
];
|
|
57983
|
+
const getSingleNumberFromString$1 = (str) => {
|
|
57984
|
+
if (typeof str === "number") {
|
|
57985
|
+
return str;
|
|
57986
|
+
}
|
|
57987
|
+
const match = (str == null ? void 0 : str.match(/\d.+/)) || null;
|
|
57988
|
+
return match ? Number(match[0]) : 0;
|
|
57989
|
+
};
|
|
57990
|
+
const DonutChart$1 = ({
|
|
57991
|
+
data,
|
|
57992
|
+
height = 140,
|
|
57993
|
+
width = 140,
|
|
57994
|
+
isUserDashbord,
|
|
57995
|
+
legend = true,
|
|
57996
|
+
direction: direction2 = "horizontal",
|
|
57997
|
+
totalUsers,
|
|
57998
|
+
total = isUserDashbord ? totalUsers : "2.4 GB",
|
|
57999
|
+
colors = defaultColors,
|
|
58000
|
+
titleProps = {},
|
|
58001
|
+
valueProps = {}
|
|
58002
|
+
}) => {
|
|
58003
|
+
const svgRef = useRef(null);
|
|
58004
|
+
useEffect(() => {
|
|
58005
|
+
if (!svgRef.current) return;
|
|
58006
|
+
const svg = select(svgRef.current);
|
|
58007
|
+
svg.selectAll("*").remove();
|
|
58008
|
+
const margin = 6;
|
|
58009
|
+
const outerRadius = Math.min(width, height) / 2 - margin;
|
|
58010
|
+
const innerRadius = Math.min(width, height) / 2 - margin * 2;
|
|
58011
|
+
const g2 = svg.append("g").attr("transform", `translate(${width / 2}, ${height / 2})`);
|
|
58012
|
+
const pie$1 = pie().value((d2) => getSingleNumberFromString$1(d2.value));
|
|
58013
|
+
const path = arc().outerRadius(outerRadius).innerRadius(innerRadius);
|
|
58014
|
+
const pies = g2.selectAll(".arc").data(pie$1(data)).enter().append("g").attr("class", "arc");
|
|
58015
|
+
pies.append("path").attr("d", path).attr("fill", (d2, i2) => {
|
|
58016
|
+
return colors[i2 % colors.length];
|
|
58017
|
+
});
|
|
58018
|
+
g2.append("text").attr("text-anchor", "middle").attr("font-size", "18px").attr("font-weight", "600").attr("alignment-baseline", `central`).html(total);
|
|
58019
|
+
}, [colors, data, height, total, width]);
|
|
58020
|
+
if (!legend) {
|
|
58021
|
+
return /* @__PURE__ */ jsx("svg", { ref: svgRef, width, height });
|
|
58022
|
+
}
|
|
58023
|
+
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs("div", { className: `donut-chart-container ${direction2}`, children: [
|
|
58024
|
+
/* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx("svg", { ref: svgRef, width, height }) }),
|
|
58025
|
+
/* @__PURE__ */ jsx("div", { className: "donut-chart-legend", children: data && data.map((d2, i2) => {
|
|
58026
|
+
return /* @__PURE__ */ jsxs(
|
|
58027
|
+
"div",
|
|
58028
|
+
{
|
|
58029
|
+
className: "legend",
|
|
58030
|
+
style: { borderLeft: `0.188rem solid ${colors[i2]}` },
|
|
58031
|
+
children: [
|
|
58032
|
+
/* @__PURE__ */ jsx("div", { className: "legend-title", children: /* @__PURE__ */ jsx(Typography$1, { type: "s5", color: "theme.secondary.800", ...titleProps, children: d2.label }) }),
|
|
58033
|
+
/* @__PURE__ */ jsx("div", { className: "legend-value", children: /* @__PURE__ */ jsx(
|
|
58034
|
+
Typography$1,
|
|
58035
|
+
{
|
|
58036
|
+
type: "s5",
|
|
58037
|
+
weight: "medium",
|
|
58038
|
+
color: "theme.secondary.1000",
|
|
58039
|
+
children: /* @__PURE__ */ jsx(Typography$1, { type: "s5", color: "theme.secondary.1000", weight: "bold", ...valueProps, children: d2.value })
|
|
58040
|
+
}
|
|
58041
|
+
) })
|
|
58042
|
+
]
|
|
58043
|
+
},
|
|
58044
|
+
d2.label
|
|
58045
|
+
);
|
|
58046
|
+
}) })
|
|
58047
|
+
] }) });
|
|
58048
|
+
};
|
|
58049
|
+
const formatNumber$3 = (num, defaultCurrencySymbol = "") => {
|
|
58050
|
+
if (num >= 1e6) {
|
|
58051
|
+
return `${defaultCurrencySymbol} ${(num / 1e6).toFixed(1)} M`;
|
|
58052
|
+
} else if (num >= 1e5) {
|
|
58053
|
+
return `${defaultCurrencySymbol} ${(num / 1e5).toFixed(1)} L`;
|
|
58054
|
+
} else if (num >= 1e3) {
|
|
58055
|
+
return `${(num / 1e3).toFixed(1)} K`;
|
|
58056
|
+
} else {
|
|
58057
|
+
return `${defaultCurrencySymbol} ${num.toFixed(2)}`;
|
|
58058
|
+
}
|
|
58059
|
+
};
|
|
58060
|
+
const getSingleNumberFromString = (str) => {
|
|
58061
|
+
if (typeof str === "number") {
|
|
58062
|
+
return str;
|
|
58063
|
+
}
|
|
58064
|
+
const match = (str == null ? void 0 : str.match(/\d.+/)) || null;
|
|
58065
|
+
return match ? Number(match[0]) : 0;
|
|
58066
|
+
};
|
|
58067
|
+
const DonutChart = ({
|
|
58068
|
+
data,
|
|
58069
|
+
height = 140,
|
|
58070
|
+
width = 140,
|
|
58071
|
+
legend = true,
|
|
58072
|
+
direction: direction2 = "vertical",
|
|
58073
|
+
total = "300",
|
|
58074
|
+
donutThickerValue,
|
|
58075
|
+
CustomLegends,
|
|
58076
|
+
title = ""
|
|
58077
|
+
}) => {
|
|
58078
|
+
var _a;
|
|
58079
|
+
const svgRef = useRef(null);
|
|
58080
|
+
const { user } = useAuth();
|
|
58081
|
+
const defaultCurrencySymbol = ((_a = user == null ? void 0 : user.currency_data) == null ? void 0 : _a.symbol) || "";
|
|
58082
|
+
useEffect(() => {
|
|
58083
|
+
if (!svgRef.current) return;
|
|
58084
|
+
const svg = select(svgRef.current);
|
|
58085
|
+
svg.selectAll("*").remove();
|
|
58086
|
+
const margin = 6;
|
|
58087
|
+
const outerRadius = Math.min(width, height) / 2 - margin;
|
|
58088
|
+
let innerRadius = Math.min(width, height) / 2 - margin * 2;
|
|
58089
|
+
if (donutThickerValue) {
|
|
58090
|
+
innerRadius = outerRadius - donutThickerValue;
|
|
58091
|
+
}
|
|
58092
|
+
const g2 = svg.append("g").attr("transform", `translate(${width / 2}, ${height / 2})`);
|
|
58093
|
+
const pie$1 = pie().value((d2) => getSingleNumberFromString(d2.value)).padAngle(0);
|
|
58094
|
+
const path = arc().outerRadius(outerRadius).innerRadius(innerRadius);
|
|
58095
|
+
const pies = g2.selectAll(".arc").data(pie$1(data)).enter().append("g").attr("class", "arc");
|
|
58096
|
+
pies.append("path").attr("d", path).attr("fill", (d2) => {
|
|
58097
|
+
var _a2;
|
|
58098
|
+
return (_a2 = d2 == null ? void 0 : d2.data) == null ? void 0 : _a2.color;
|
|
58099
|
+
}).attr("stroke", "none");
|
|
58100
|
+
g2.append("text").attr("text-anchor", "middle").attr("font-size", "18px").attr("font-weight", "600").attr("alignment-baseline", `central`).html(total);
|
|
58101
|
+
g2.append("text").attr("text-anchor", "middle").attr("maring-top", "20px").attr("font-size", "13px").attr("font-weight", "600").attr("dy", "2em").attr("color", "#7B7C7F").html(title);
|
|
58102
|
+
}, [data, height, total, width, defaultCurrencySymbol, donutThickerValue, CustomLegends, title]);
|
|
58103
|
+
if (!legend) {
|
|
58104
|
+
return /* @__PURE__ */ jsx("svg", { ref: svgRef, width, height });
|
|
58105
|
+
}
|
|
58106
|
+
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs("div", { className: `donut-chart-container ${direction2}`, children: [
|
|
58107
|
+
/* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx("svg", { ref: svgRef, width, height }) }),
|
|
58108
|
+
CustomLegends ? /* @__PURE__ */ jsx(CustomLegends, { data }) : /* @__PURE__ */ jsx("div", { className: "donut-legend", children: /* @__PURE__ */ jsx("div", { className: `donut-chart-legend ${direction2}`, children: data.map((d2) => /* @__PURE__ */ jsxs(
|
|
58109
|
+
"div",
|
|
58110
|
+
{
|
|
58111
|
+
className: "legend",
|
|
58112
|
+
style: { borderLeft: `0.188rem solid ${d2.color}` },
|
|
58113
|
+
children: [
|
|
58114
|
+
/* @__PURE__ */ jsx("div", { className: "legend-title", style: { color: `${d2.labelColor}` }, children: d2.label }),
|
|
58115
|
+
/* @__PURE__ */ jsx("div", { className: "legend-value", children: /* @__PURE__ */ jsx(
|
|
58116
|
+
Typography$1,
|
|
58117
|
+
{
|
|
58118
|
+
type: "s5",
|
|
58119
|
+
weight: "medium",
|
|
58120
|
+
color: d2.valueColor,
|
|
58121
|
+
style: {
|
|
58122
|
+
whiteSpace: "nowrap"
|
|
58123
|
+
},
|
|
58124
|
+
children: formatNumber$3(d2.value, defaultCurrencySymbol)
|
|
58125
|
+
}
|
|
58126
|
+
) })
|
|
58127
|
+
]
|
|
58128
|
+
},
|
|
58129
|
+
d2.label
|
|
58130
|
+
)) }) })
|
|
58131
|
+
] }) });
|
|
58132
|
+
};
|
|
58133
|
+
const formatNumber$2 = (num, symbol) => {
|
|
58134
|
+
return `${symbol} ${format(".2s")(num).replace("k", "K")}`;
|
|
58135
|
+
};
|
|
58136
|
+
const GroupedBarChart = ({
|
|
58137
|
+
chartData,
|
|
58138
|
+
height = 500,
|
|
58139
|
+
barWidth = 40,
|
|
58140
|
+
margin = { top: 40, right: 20, bottom: 40, left: 50 },
|
|
58141
|
+
line: line2 = false
|
|
58142
|
+
}) => {
|
|
58143
|
+
var _a;
|
|
58144
|
+
const svgRef = useRef(null);
|
|
58145
|
+
const wrapperRef = useRef(null);
|
|
58146
|
+
const scrollContainerRef = useRef(null);
|
|
58147
|
+
const [containerWidth, setContainerWidth2] = useState(0);
|
|
58148
|
+
const maxValue = useMemo(() => Math.max(...chartData.map((d2) => d2.data.map((v2) => v2.value)).flat()), [chartData]);
|
|
58149
|
+
const needsHorizontalScroll = chartData.length > 12;
|
|
58150
|
+
const minGroupWidth = 120;
|
|
58151
|
+
const calculatedChartWidth = needsHorizontalScroll ? Math.max(chartData.length * minGroupWidth, containerWidth) : containerWidth;
|
|
58152
|
+
const { user } = useAuth();
|
|
58153
|
+
const defaultCurrencySymbol = ((_a = user == null ? void 0 : user.currency_data) == null ? void 0 : _a.symbol) || "";
|
|
58154
|
+
useEffect(() => {
|
|
58155
|
+
const wrapper = wrapperRef.current;
|
|
58156
|
+
const resizeObserver = new ResizeObserver((entries) => {
|
|
58157
|
+
if (entries[0]) {
|
|
58158
|
+
const newWidth = entries[0].contentRect.width;
|
|
58159
|
+
setContainerWidth2(newWidth);
|
|
58160
|
+
}
|
|
58161
|
+
});
|
|
58162
|
+
if (wrapper) {
|
|
58163
|
+
resizeObserver.observe(wrapper);
|
|
58164
|
+
}
|
|
58165
|
+
return () => {
|
|
58166
|
+
if (wrapper) {
|
|
58167
|
+
resizeObserver.unobserve(wrapper);
|
|
58168
|
+
}
|
|
58169
|
+
};
|
|
58170
|
+
}, []);
|
|
58171
|
+
useEffect(() => {
|
|
58172
|
+
if (containerWidth === 0) return;
|
|
58173
|
+
const chartWidth = calculatedChartWidth - margin.left - margin.right;
|
|
58174
|
+
const chartHeight = maxValue ? height - margin.top - margin.bottom : 0;
|
|
58175
|
+
select(svgRef.current).selectAll("*").remove();
|
|
58176
|
+
const svg = select(svgRef.current).attr("height", height).append("g").attr("transform", `translate(${margin.left}, ${maxValue ? margin.top : height - 50})`);
|
|
58177
|
+
const x0 = band().domain(chartData.map((d2) => d2.month)).range([0, chartWidth]).padding(0.2);
|
|
58178
|
+
const x1 = band().domain(["Total Transaction", "Total Value", "Average Value"]).range([0, x0.bandwidth()]).padding(0.1);
|
|
58179
|
+
const y2 = linear().domain([0, max$1(chartData, (d2) => max$1(d2.data, (data) => data.value))]).nice().range([chartHeight, 0]);
|
|
58180
|
+
const xAxis = svg.append("g").attr("class", "x-axis").attr("transform", `translate(0, ${chartHeight})`).call(axisBottom(x0).tickPadding(20));
|
|
58181
|
+
const yAxis = svg.append("g").attr("class", "y-axis").call(axisLeft(y2).tickPadding(10).tickFormat((d2) => formatNumber$2(d2, defaultCurrencySymbol)));
|
|
58182
|
+
yAxis.select(".domain").attr("stroke", "none");
|
|
58183
|
+
xAxis.select(".domain").attr("stroke", "none");
|
|
58184
|
+
if (line2) {
|
|
58185
|
+
svg.selectAll(".grid-line").data(y2.ticks()).enter().append("line").attr("class", "grid-line").attr("x1", 0).attr("x2", chartWidth).attr("y1", (d2) => y2(d2)).attr("y2", (d2) => y2(d2)).style("stroke", "#ddd").style("stroke-dasharray", "3,3").style("stroke-width", 1);
|
|
58186
|
+
}
|
|
58187
|
+
const monthGroups = svg.selectAll(".month-group").data(chartData).enter().append("g").attr("class", "month-group").attr("transform", (d2) => `translate(${x0(d2.month)}, 0)`);
|
|
58188
|
+
monthGroups.selectAll("rect").data((d2) => d2.data).enter().append("rect").attr("x", (d2) => x1(d2.type) + (x1.bandwidth() - barWidth) / 2).attr("y", (d2) => y2(d2.value)).attr("width", barWidth).attr("height", (d2) => chartHeight - y2(d2.value)).attr("fill", (d2) => d2.color).attr("rx", 5).attr("ry", 5);
|
|
58189
|
+
}, [chartData, barWidth, height, calculatedChartWidth, containerWidth, line2, margin, defaultCurrencySymbol, maxValue]);
|
|
58190
|
+
return /* @__PURE__ */ jsx("div", { ref: wrapperRef, style: { width: "100%", height: "100%" }, children: /* @__PURE__ */ jsx("div", { style: { position: "relative" }, children: /* @__PURE__ */ jsx(
|
|
58191
|
+
"div",
|
|
58192
|
+
{
|
|
58193
|
+
ref: scrollContainerRef,
|
|
58194
|
+
style: {
|
|
58195
|
+
width: "100%",
|
|
58196
|
+
overflowX: needsHorizontalScroll ? "auto" : "hidden",
|
|
58197
|
+
overflowY: "hidden"
|
|
58198
|
+
},
|
|
58199
|
+
children: /* @__PURE__ */ jsx(
|
|
58200
|
+
"svg",
|
|
58201
|
+
{
|
|
58202
|
+
ref: svgRef,
|
|
58203
|
+
width: calculatedChartWidth,
|
|
58204
|
+
height,
|
|
58205
|
+
viewBox: `0 0 ${calculatedChartWidth} ${height}`,
|
|
58206
|
+
style: { display: "block" }
|
|
58207
|
+
}
|
|
58208
|
+
)
|
|
58209
|
+
}
|
|
58210
|
+
) }) });
|
|
58211
|
+
};
|
|
58212
|
+
const formatNumber$1 = (num) => {
|
|
58213
|
+
if (num >= 1e9) return (num / 1e9).toFixed(1) + "B";
|
|
58214
|
+
if (num >= 1e6) return (num / 1e6).toFixed(1) + "M";
|
|
58215
|
+
if (num >= 1e3) return (num / 1e3).toFixed(1) + "K";
|
|
58216
|
+
return num;
|
|
58217
|
+
};
|
|
58218
|
+
const LineChart = ({
|
|
58219
|
+
data,
|
|
58220
|
+
numOfLines = 5,
|
|
58221
|
+
width = 500,
|
|
58222
|
+
height = 300
|
|
58223
|
+
}) => {
|
|
58224
|
+
const svgRef = useRef(null);
|
|
58225
|
+
const wrapperRef = useRef(null);
|
|
58226
|
+
const maxValue = useMemo(() => {
|
|
58227
|
+
return Math.max(...data.map((d2) => d2.value));
|
|
58228
|
+
}, [data]);
|
|
58229
|
+
const yAxisMaxValue = useMemo(() => {
|
|
58230
|
+
return maxValue * 1.25;
|
|
58231
|
+
}, [maxValue]);
|
|
58232
|
+
const yAxisTicks = useMemo(() => {
|
|
58233
|
+
const ticks2 = [];
|
|
58234
|
+
const interval = yAxisMaxValue / numOfLines;
|
|
58235
|
+
for (let i2 = 0; i2 <= numOfLines; i2++) {
|
|
58236
|
+
ticks2.push(interval * i2);
|
|
58237
|
+
}
|
|
58238
|
+
return ticks2;
|
|
58239
|
+
}, [yAxisMaxValue, numOfLines]);
|
|
58240
|
+
const needsHorizontalScroll = data.length > 12;
|
|
58241
|
+
const minGroupWidth = 120;
|
|
58242
|
+
const calculatedChartWidth = needsHorizontalScroll ? Math.max(data.length * minGroupWidth, width) : width;
|
|
58243
|
+
useEffect(() => {
|
|
58244
|
+
const wrapper = wrapperRef.current;
|
|
58245
|
+
const resizeObserver = new ResizeObserver((entries) => {
|
|
58246
|
+
if (entries[0]) {
|
|
58247
|
+
const newWidth = entries[0].contentRect.width;
|
|
58248
|
+
setContainerWidth(newWidth);
|
|
58249
|
+
}
|
|
58250
|
+
});
|
|
58251
|
+
if (wrapper) {
|
|
58252
|
+
resizeObserver.observe(wrapper);
|
|
58253
|
+
}
|
|
58254
|
+
return () => {
|
|
58255
|
+
if (wrapper) {
|
|
58256
|
+
resizeObserver.unobserve(wrapper);
|
|
58257
|
+
}
|
|
58258
|
+
};
|
|
58259
|
+
}, []);
|
|
58260
|
+
useEffect(() => {
|
|
58261
|
+
const svg = select(svgRef.current);
|
|
58262
|
+
svg.selectAll("*").remove();
|
|
58263
|
+
const margin = { top: 20, right: 20, bottom: 70, left: 40 };
|
|
58264
|
+
const barWidth = calculatedChartWidth - margin.left - margin.right;
|
|
58265
|
+
const barHeight = height - margin.top - margin.bottom;
|
|
58266
|
+
const mousemove = (event, d2) => {
|
|
58267
|
+
const xPosition = event.offsetX + margin.left - 25;
|
|
58268
|
+
const yPosition = event.offsetY + margin.top - 40;
|
|
58269
|
+
const text = `${d2.label} - ${d2.value}`;
|
|
58270
|
+
tooltip.attr("x", xPosition).attr("y", yPosition).style("opacity", 9).style("height", text.length >= 16 ? 50 : 35);
|
|
58271
|
+
tooltipText.html(text);
|
|
58272
|
+
};
|
|
58273
|
+
const mouseleave = () => {
|
|
58274
|
+
tooltip.style("opacity", 0);
|
|
58275
|
+
};
|
|
58276
|
+
const x2 = band().domain(data.map((d2) => d2.label)).range([0, barWidth]).padding(0.1);
|
|
58277
|
+
const y2 = linear().domain([0, max$1(data, (d2) => d2.value)]).range([barHeight, 0]);
|
|
58278
|
+
const chart = svg.append("g").attr("transform", `translate(${margin.left},${margin.top})`);
|
|
58279
|
+
const line$1 = line().x((d2) => x2(d2.label) + x2.bandwidth() / 2).y((d2) => y2(d2.value));
|
|
58280
|
+
chart.append("path").datum(data).attr("class", "line").attr("d", line$1).style("fill", "none").style("stroke", "#357AF6").style("stroke-width", 2);
|
|
58281
|
+
chart.selectAll(".point").data(data).enter().append("circle").attr("class", "point").attr("cx", (d2) => x2(d2.label) + x2.bandwidth() / 2).attr("cy", (d2) => y2(d2.value)).attr("r", 4).style("fill", "#357AF6").on("mousemove", mousemove).on("mouseleave", mouseleave);
|
|
58282
|
+
yAxisTicks.slice(1).forEach((tick) => {
|
|
58283
|
+
chart.append("line").attr("class", "dotted-line").attr("x1", 0).attr("y1", y2(tick)).attr("x2", width).attr("y2", y2(tick)).style("stroke", "gray").style("stroke-dasharray", "3,3");
|
|
58284
|
+
});
|
|
58285
|
+
const xAxis = chart.append("g").attr("class", "x-axis").attr("transform", `translate(0, ${barHeight})`).call(axisBottom(x2));
|
|
58286
|
+
xAxis.selectAll(".tick line").remove();
|
|
58287
|
+
const yAxis = chart.append("g").attr("class", "y-axis").call(
|
|
58288
|
+
axisLeft(y2).tickValues(yAxisTicks).tickFormat((d2) => {
|
|
58289
|
+
return formatNumber$1(d2);
|
|
58290
|
+
}).tickSizeOuter(0),
|
|
58291
|
+
0
|
|
58292
|
+
);
|
|
58293
|
+
yAxis.selectAll(".domain").remove();
|
|
58294
|
+
yAxis.selectAll(".tick line").remove();
|
|
58295
|
+
const tooltip = svg.append("foreignObject").attr("class", "tooltip").attr("width", 120).attr("height", 20).style("opacity", 0).style("position", "absolute").style("background-color", "white").style("border", "none").style("box-shadow", "0rem 0rem 0.469rem 0rem rgba(0, 0, 0, 0.15)").style("border-radius", "0.313rem").style("padding", "0.625rem").style("font-size", "0.75rem");
|
|
58296
|
+
const tooltipText = tooltip.append("xhtml:div").style("font-size", "0.75rem").style("color", "black");
|
|
58297
|
+
}, [data, height, width, yAxisMaxValue, yAxisTicks, calculatedChartWidth]);
|
|
58298
|
+
return /* @__PURE__ */ jsx("div", { ref: wrapperRef, style: { width: "100%", height: "100%" }, children: /* @__PURE__ */ jsx(
|
|
58299
|
+
"svg",
|
|
58300
|
+
{
|
|
58301
|
+
ref: svgRef,
|
|
58302
|
+
width: calculatedChartWidth,
|
|
58303
|
+
height,
|
|
58304
|
+
viewBox: `0 0 ${calculatedChartWidth} ${height}`
|
|
58305
|
+
}
|
|
58306
|
+
) });
|
|
58307
|
+
};
|
|
58308
|
+
const AreaLineChart = ({
|
|
58309
|
+
data,
|
|
58310
|
+
width = "100%",
|
|
58311
|
+
// Default to responsive width
|
|
58312
|
+
height = 200,
|
|
58313
|
+
// Set a default numeric height
|
|
58314
|
+
lineColor = "#ADE7CB",
|
|
58315
|
+
lineFillColor = "#EBF9F2",
|
|
58316
|
+
...rest
|
|
58317
|
+
}) => {
|
|
58318
|
+
const svgRef = useRef(null);
|
|
58319
|
+
const containerRef = useRef(null);
|
|
58320
|
+
const [containerWidth, setContainerWidth2] = useState(0);
|
|
58321
|
+
useEffect(() => {
|
|
58322
|
+
const resizeObserver = new ResizeObserver(() => {
|
|
58323
|
+
if (containerRef.current) {
|
|
58324
|
+
setContainerWidth2(containerRef.current.clientWidth);
|
|
58325
|
+
}
|
|
58326
|
+
});
|
|
58327
|
+
if (containerRef.current) {
|
|
58328
|
+
resizeObserver.observe(containerRef.current);
|
|
58329
|
+
setContainerWidth2(containerRef.current.clientWidth);
|
|
58330
|
+
}
|
|
58331
|
+
return () => resizeObserver.disconnect();
|
|
58332
|
+
}, []);
|
|
58333
|
+
useEffect(() => {
|
|
58334
|
+
if (containerWidth === 0) return;
|
|
58335
|
+
const svg = select(svgRef.current);
|
|
58336
|
+
svg.selectAll("*").remove();
|
|
58337
|
+
const margin = { top: 5, left: 0, right: 0 };
|
|
58338
|
+
const chartWidth = containerWidth - margin.left - margin.right;
|
|
58339
|
+
const chartHeight = height;
|
|
58340
|
+
const x2 = linear().domain([0, data.length - 1]).range([0, chartWidth]);
|
|
58341
|
+
const y2 = linear().domain([0, max$1(data, (d2) => d2.value) || 1]).range([chartHeight, 0]);
|
|
58342
|
+
const line$1 = line().x((_2, i2) => x2(i2)).y((d2) => y2(d2.value));
|
|
58343
|
+
const area$1 = area().x((_2, i2) => x2(i2)).y0(chartHeight).y1((d2) => y2(d2.value));
|
|
58344
|
+
const chart = svg.append("g").attr("transform", `translate(${margin.left},${margin.top})`);
|
|
58345
|
+
chart.append("path").datum(data).attr("class", "line").attr("d", line$1).style("fill", "none").style("stroke", lineColor).style("stroke-width", 5);
|
|
58346
|
+
chart.append("path").datum(data).attr("class", "area").attr("d", area$1).style("fill", lineFillColor);
|
|
58347
|
+
chart.selectAll(".domain").remove();
|
|
58348
|
+
chart.selectAll(".tick line").remove();
|
|
58349
|
+
}, [data, height, lineColor, lineFillColor, containerWidth]);
|
|
58350
|
+
return /* @__PURE__ */ jsx("div", { ref: containerRef, style: { width, height }, children: /* @__PURE__ */ jsx("svg", { ref: svgRef, width: "100%", height: "100%", ...rest }) });
|
|
58351
|
+
};
|
|
58352
|
+
const formatNumber = (num, symbol, labelType) => {
|
|
58353
|
+
if (labelType === "inPercent") {
|
|
58354
|
+
return `${format(".0%")(num / 100)}`;
|
|
58355
|
+
} else if (labelType === "inValue") {
|
|
58356
|
+
return `${symbol || ""} ${format(".2s")(num).replace("k", "K")}`;
|
|
58357
|
+
}
|
|
58358
|
+
return num.toString();
|
|
58359
|
+
};
|
|
58360
|
+
const MultiLineChart = ({
|
|
58361
|
+
data,
|
|
58362
|
+
yAxisData,
|
|
58363
|
+
xAxisData,
|
|
58364
|
+
colors = ["steelblue", "orange", "green", "red"],
|
|
58365
|
+
// Default colors
|
|
58366
|
+
height = 400,
|
|
58367
|
+
margin = { top: 20, right: 50, bottom: 30, left: 50 },
|
|
58368
|
+
line: line$1 = false,
|
|
58369
|
+
yAxisLabelType = "inValue",
|
|
58370
|
+
currency,
|
|
58371
|
+
customLabelFormatter
|
|
58372
|
+
}) => {
|
|
58373
|
+
const svgRef = useRef(null);
|
|
58374
|
+
const wrapperRef = useRef(null);
|
|
58375
|
+
const [containerWidth, setContainerWidth2] = useState(0);
|
|
58376
|
+
useEffect(() => {
|
|
58377
|
+
}, [yAxisLabelType]);
|
|
58378
|
+
useEffect(() => {
|
|
58379
|
+
const wrapper = wrapperRef.current;
|
|
58380
|
+
const resizeObserver = new ResizeObserver((entries) => {
|
|
58381
|
+
if (entries[0]) {
|
|
58382
|
+
const newWidth = entries[0].contentRect.width;
|
|
58383
|
+
setContainerWidth2(newWidth);
|
|
58384
|
+
}
|
|
58385
|
+
});
|
|
58386
|
+
if (wrapper) {
|
|
58387
|
+
resizeObserver.observe(wrapper);
|
|
58388
|
+
}
|
|
58389
|
+
return () => {
|
|
58390
|
+
if (wrapper) {
|
|
58391
|
+
resizeObserver.unobserve(wrapper);
|
|
58392
|
+
}
|
|
58393
|
+
};
|
|
58394
|
+
}, []);
|
|
58395
|
+
useEffect(() => {
|
|
58396
|
+
if (containerWidth === 0) return;
|
|
58397
|
+
const svg = select(svgRef.current);
|
|
58398
|
+
svg.selectAll("*").remove();
|
|
58399
|
+
const innerWidth = containerWidth - margin.left - margin.right;
|
|
58400
|
+
const innerHeight = height - margin.top - margin.bottom;
|
|
58401
|
+
const x2 = linear().domain([0, xAxisData.length]).range([0, innerWidth]);
|
|
58402
|
+
const y2 = linear().domain([0, max$1(yAxisData)]).nice().range([innerHeight, 0]);
|
|
58403
|
+
const xAxis = svg.append("g").attr("class", "x-axis").attr("transform", `translate(${margin.left},${height - margin.bottom})`).call(
|
|
58404
|
+
axisBottom(x2).ticks(xAxisData.length - 1).tickFormat((d2, i2) => xAxisData[i2])
|
|
58405
|
+
);
|
|
58406
|
+
xAxis.selectAll("text").attr("transform", "translate(20, 10)").style("text-anchor", "middle");
|
|
58407
|
+
xAxis.select(".domain").attr("stroke", "none");
|
|
58408
|
+
const yAxis = svg.append("g").attr("class", "y-axis").attr("transform", `translate(${margin.left},${margin.top})`).call(axisLeft(y2).tickPadding(10).tickFormat(
|
|
58409
|
+
(d2) => customLabelFormatter ? customLabelFormatter(d2) : formatNumber(d2, currency, yAxisLabelType)
|
|
58410
|
+
).tickSizeOuter(0));
|
|
58411
|
+
if (line$1) {
|
|
58412
|
+
yAxis.selectAll(".grid-line").data(y2.ticks()).enter().append("line").attr("class", "grid-line").attr("x1", 0).attr("x2", innerWidth).attr("y1", (d2) => y2(d2)).attr("y2", (d2) => y2(d2)).style("stroke", "#ddd").style("stroke-dasharray", "6,3").style("stroke-width", 1);
|
|
58413
|
+
}
|
|
58414
|
+
xAxis.selectAll(".tick line").remove();
|
|
58415
|
+
yAxis.selectAll(".tick line").remove();
|
|
58416
|
+
yAxis.select(".domain").attr("stroke", "none");
|
|
58417
|
+
Object.keys(data).forEach((key, index2) => {
|
|
58418
|
+
var _a, _b, _c;
|
|
58419
|
+
if (key !== "months") {
|
|
58420
|
+
const chartLine = line().x((d2, i2) => x2(i2)).y((d2) => y2(d2)).curve(data[key].isSmooth ? monotoneX : curveLinear);
|
|
58421
|
+
svg.append("path").datum((_a = data[key]) == null ? void 0 : _a.data).attr("fill", "none").attr("stroke", colors[index2 % colors.length]).attr("stroke-width", 2).attr("transform", `translate(${margin.left},${margin.top})`).attr("d", chartLine).on("mouseover", function() {
|
|
58422
|
+
select(this).attr("stroke-width", 4);
|
|
58423
|
+
}).on("mouseout", function() {
|
|
58424
|
+
select(this).attr("stroke-width", 2);
|
|
58425
|
+
});
|
|
58426
|
+
if ((_b = data[key]) == null ? void 0 : _b.displayDot) {
|
|
58427
|
+
svg.selectAll(`.circle-${key}`).data((_c = data[key]) == null ? void 0 : _c.data).enter().append("circle").attr("class", `circle-${key}`).attr("cx", (d2, i2) => x2(i2) + margin.left).attr("cy", (d2) => y2(d2) + margin.top).attr("r", 4).attr("fill", colors[index2 % colors.length]).attr("stroke", "white").attr("stroke-width", 1.5).on("mouseover", function() {
|
|
58428
|
+
select(this).attr("r", 6);
|
|
58429
|
+
}).on("mouseout", function() {
|
|
58430
|
+
select(this).attr("r", 4);
|
|
58431
|
+
});
|
|
58432
|
+
}
|
|
58433
|
+
}
|
|
58434
|
+
});
|
|
58435
|
+
}, [data, yAxisData, xAxisData, height, containerWidth, colors, margin, line$1, yAxisLabelType, currency, customLabelFormatter]);
|
|
58436
|
+
return /* @__PURE__ */ jsx("div", { ref: wrapperRef, style: { width: "100%", height: "100%" }, children: /* @__PURE__ */ jsx("div", { style: { position: "relative" }, children: /* @__PURE__ */ jsx("svg", { ref: svgRef, width: "100%", height, viewBox: `0 0 ${containerWidth} ${height}` }) }) });
|
|
58437
|
+
};
|
|
57450
58438
|
const CustomGridCard = ({
|
|
57451
58439
|
title,
|
|
57452
58440
|
subTitle,
|
|
@@ -60825,7 +61813,7 @@ function ReportTable({
|
|
|
60825
61813
|
);
|
|
60826
61814
|
}
|
|
60827
61815
|
export {
|
|
60828
|
-
|
|
61816
|
+
BarLineChart as $,
|
|
60829
61817
|
Accordion as A,
|
|
60830
61818
|
BoardWrapper as B,
|
|
60831
61819
|
CalculationSummary as C,
|
|
@@ -60850,77 +61838,86 @@ export {
|
|
|
60850
61838
|
ToggleSwitch as V,
|
|
60851
61839
|
Upload as W,
|
|
60852
61840
|
UserDropdown as X,
|
|
60853
|
-
AreaLineChart as Y,
|
|
60854
|
-
|
|
60855
|
-
|
|
61841
|
+
AreaLineChart$1 as Y,
|
|
61842
|
+
BarChart$1 as Z,
|
|
61843
|
+
BarChart as _,
|
|
60856
61844
|
ActivityTag$1 as a,
|
|
60857
|
-
|
|
60858
|
-
|
|
60859
|
-
|
|
60860
|
-
|
|
60861
|
-
|
|
60862
|
-
|
|
60863
|
-
|
|
60864
|
-
|
|
60865
|
-
|
|
60866
|
-
|
|
60867
|
-
|
|
60868
|
-
|
|
60869
|
-
|
|
60870
|
-
|
|
60871
|
-
|
|
60872
|
-
|
|
60873
|
-
|
|
60874
|
-
|
|
60875
|
-
|
|
60876
|
-
|
|
60877
|
-
|
|
60878
|
-
|
|
60879
|
-
|
|
60880
|
-
|
|
60881
|
-
|
|
60882
|
-
|
|
60883
|
-
|
|
60884
|
-
|
|
60885
|
-
|
|
60886
|
-
|
|
60887
|
-
|
|
60888
|
-
|
|
60889
|
-
|
|
60890
|
-
|
|
60891
|
-
|
|
60892
|
-
|
|
60893
|
-
|
|
60894
|
-
|
|
60895
|
-
|
|
60896
|
-
|
|
60897
|
-
|
|
60898
|
-
|
|
60899
|
-
|
|
60900
|
-
|
|
60901
|
-
|
|
60902
|
-
|
|
60903
|
-
|
|
60904
|
-
|
|
60905
|
-
|
|
60906
|
-
|
|
60907
|
-
|
|
60908
|
-
|
|
60909
|
-
|
|
60910
|
-
|
|
60911
|
-
|
|
60912
|
-
|
|
60913
|
-
|
|
60914
|
-
|
|
60915
|
-
|
|
60916
|
-
|
|
60917
|
-
|
|
60918
|
-
|
|
60919
|
-
|
|
60920
|
-
|
|
61845
|
+
DynamicRadioButton as a$,
|
|
61846
|
+
ChartLegends as a0,
|
|
61847
|
+
DonutChart$1 as a1,
|
|
61848
|
+
DonutChart as a2,
|
|
61849
|
+
GroupedBarChart as a3,
|
|
61850
|
+
LineChart as a4,
|
|
61851
|
+
AreaLineChart as a5,
|
|
61852
|
+
MultiLineChart as a6,
|
|
61853
|
+
CustomGridCard as a7,
|
|
61854
|
+
GridCard as a8,
|
|
61855
|
+
GridWrapper as a9,
|
|
61856
|
+
SpeedDialAction as aA,
|
|
61857
|
+
SpeedDialIcon as aB,
|
|
61858
|
+
Step as aC,
|
|
61859
|
+
StepButton as aD,
|
|
61860
|
+
StepContent as aE,
|
|
61861
|
+
StepLabel as aF,
|
|
61862
|
+
Stepper as aG,
|
|
61863
|
+
SwipeableDrawer as aH,
|
|
61864
|
+
TablePagination as aI,
|
|
61865
|
+
useScrollTrigger as aJ,
|
|
61866
|
+
Zoom as aK,
|
|
61867
|
+
FormLoader as aL,
|
|
61868
|
+
PageLoader as aM,
|
|
61869
|
+
FormParser as aN,
|
|
61870
|
+
DynamicButton as aO,
|
|
61871
|
+
DynamicCheckBox as aP,
|
|
61872
|
+
DynamicDateRange as aQ,
|
|
61873
|
+
DynamicDateTime as aR,
|
|
61874
|
+
DynamicDate as aS,
|
|
61875
|
+
DynamicCurrency as aT,
|
|
61876
|
+
DynamicElementHOC as aU,
|
|
61877
|
+
DynamicInputSelect as aV,
|
|
61878
|
+
DynamicSearchSelect as aW,
|
|
61879
|
+
DynamicTagsInput as aX,
|
|
61880
|
+
DynamicInfo as aY,
|
|
61881
|
+
DynamicMedia as aZ,
|
|
61882
|
+
DynamicPhone as a_,
|
|
61883
|
+
ERPUIProvider as aa,
|
|
61884
|
+
useERPUI as ab,
|
|
61885
|
+
ReportTable as ac,
|
|
61886
|
+
AccordionActions as ad,
|
|
61887
|
+
AvatarGroup as ae,
|
|
61888
|
+
BottomNavigation as af,
|
|
61889
|
+
BottomNavigationAction as ag,
|
|
61890
|
+
Breadcrumbs as ah,
|
|
61891
|
+
Card as ai,
|
|
61892
|
+
CardActionArea as aj,
|
|
61893
|
+
CardActions as ak,
|
|
61894
|
+
CardContent as al,
|
|
61895
|
+
CardHeader as am,
|
|
61896
|
+
CardMedia as an,
|
|
61897
|
+
DialogContentText as ao,
|
|
61898
|
+
Fab as ap,
|
|
61899
|
+
Hidden as aq,
|
|
61900
|
+
ImageList as ar,
|
|
61901
|
+
ImageListItem as as,
|
|
61902
|
+
ImageListItemBar as at,
|
|
61903
|
+
MobileStepper as au,
|
|
61904
|
+
NativeSelect as av,
|
|
61905
|
+
NoSsr as aw,
|
|
61906
|
+
Rating as ax,
|
|
61907
|
+
ScopedCssBaseline as ay,
|
|
61908
|
+
SpeedDial as az,
|
|
60921
61909
|
ActivityTag as b,
|
|
60922
|
-
|
|
60923
|
-
|
|
61910
|
+
DynamicSectionHOC as b0,
|
|
61911
|
+
DynamicSelect as b1,
|
|
61912
|
+
DynamicTable as b2,
|
|
61913
|
+
DynamicTime as b3,
|
|
61914
|
+
DynamicToggleButton as b4,
|
|
61915
|
+
createLocationThunk as b5,
|
|
61916
|
+
dynamicSelectAdd as b6,
|
|
61917
|
+
DyanmicTextEditor as b7,
|
|
61918
|
+
LocationAddModal as b8,
|
|
61919
|
+
styled_default$1 as b9,
|
|
61920
|
+
styled_default as ba,
|
|
60924
61921
|
Alert as c,
|
|
60925
61922
|
ApprovalWrapper as d,
|
|
60926
61923
|
BreadCrumb as e,
|
|
@@ -60946,4 +61943,4 @@ export {
|
|
|
60946
61943
|
GeneralScheduleReport as y,
|
|
60947
61944
|
Snackbar as z
|
|
60948
61945
|
};
|
|
60949
|
-
//# sourceMappingURL=index-
|
|
61946
|
+
//# sourceMappingURL=index-Ck1uBa0H.esm.js.map
|