@dative-gpi/foundation-shared-components 1.0.35 → 1.0.37-report-v1
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/components/FSBreadcrumbs.vue +21 -12
- package/components/FSButton.vue +10 -10
- package/components/FSCalendar.vue +52 -14
- package/components/FSCalendarTwin.vue +96 -40
- package/components/FSCard.vue +28 -7
- package/components/FSCardPlaceholder.vue +8 -5
- package/components/FSChip.vue +12 -2
- package/components/FSClickable.vue +12 -13
- package/components/FSClock.vue +16 -7
- package/components/FSColorIcon.vue +23 -5
- package/components/FSDialog.vue +2 -1
- package/components/FSDialogContent.vue +12 -11
- package/components/FSDialogForm.vue +22 -2
- package/components/FSDialogFormBody.vue +47 -28
- package/components/FSDialogMenu.vue +17 -8
- package/components/FSDialogMultiFormBody.vue +77 -54
- package/components/FSDialogRemove.vue +8 -8
- package/components/FSDialogSubmit.vue +17 -8
- package/components/FSEditImage.vue +1 -1
- package/components/FSEditImageUI.vue +20 -10
- package/components/FSFadeOut.vue +53 -21
- package/components/FSForm.vue +10 -8
- package/components/FSGrid.vue +1 -1
- package/components/FSIcon.vue +2 -1
- package/components/FSIconCard.vue +47 -7
- package/components/FSImage.vue +12 -4
- package/components/FSImageUI.vue +8 -15
- package/components/FSInstantPicker.vue +266 -0
- package/components/FSLink.vue +25 -9
- package/components/FSLoader.vue +28 -11
- package/components/FSOptionGroup.vue +51 -3
- package/components/FSPlayButtons.vue +72 -0
- package/components/FSProgressBar.vue +94 -0
- package/components/FSRouterLink.vue +42 -0
- package/components/FSSlideGroup.vue +19 -5
- package/components/FSSpan.vue +17 -7
- package/components/FSSwitch.vue +57 -27
- package/components/FSTab.vue +15 -13
- package/components/FSTabs.vue +32 -7
- package/components/FSTag.vue +14 -3
- package/components/FSTagGroup.vue +1 -1
- package/components/FSText.vue +11 -7
- package/components/FSWindow.vue +128 -4
- package/components/FSWrapGroup.vue +13 -1
- package/components/agenda/FSAgenda.vue +223 -0
- package/components/agenda/FSAgendaDialogCalendar.vue +76 -0
- package/components/agenda/FSAgendaHeader.vue +215 -0
- package/components/agenda/FSAgendaHorizontalEvent.vue +174 -0
- package/components/agenda/FSAgendaHorizontalTimeLineMarker.vue +46 -0
- package/components/agenda/FSAgendaHoursCol.vue +103 -0
- package/components/agenda/FSAgendaHoursRow.vue +164 -0
- package/components/agenda/FSAgendaVerticalEvent.vue +160 -0
- package/components/agenda/FSAgendaVerticalTimeLineMarker.vue +46 -0
- package/components/agenda/FSDayAgenda.vue +199 -0
- package/components/agenda/FSMonthAgenda.vue +252 -0
- package/components/agenda/FSSelectAgendaMode.vue +54 -0
- package/components/agenda/FSWeekAgenda.vue +323 -0
- package/components/autocompletes/FSAutoCompleteAddress.vue +22 -20
- package/components/autocompletes/FSAutocompleteLanguage.vue +7 -1
- package/components/autocompletes/FSAutocompleteTimeZone.vue +7 -1
- package/components/buttons/FSButtonAdd.vue +1 -1
- package/components/buttons/FSButtonAddLabel.vue +1 -1
- package/components/buttons/FSButtonCancel.vue +1 -1
- package/components/buttons/FSButtonCancelLabel.vue +1 -1
- package/components/buttons/FSButtonCopy.vue +1 -1
- package/components/buttons/FSButtonCopyLabel.vue +1 -1
- package/components/buttons/FSButtonDragIcon.vue +27 -0
- package/components/buttons/FSButtonDuplicate.vue +1 -1
- package/components/buttons/FSButtonDuplicateLabel.vue +1 -1
- package/components/buttons/FSButtonEdit.vue +1 -1
- package/components/buttons/FSButtonEditLabel.vue +1 -1
- package/components/buttons/FSButtonFile.vue +1 -1
- package/components/buttons/FSButtonFileLabel.vue +1 -1
- package/components/buttons/FSButtonNext.vue +1 -1
- package/components/buttons/FSButtonNextLabel.vue +1 -1
- package/components/buttons/FSButtonPrevious.vue +1 -1
- package/components/buttons/FSButtonPreviousLabel.vue +1 -1
- package/components/buttons/FSButtonRedo.vue +1 -1
- package/components/buttons/FSButtonRedoLabel.vue +1 -1
- package/components/buttons/FSButtonRemove.vue +1 -1
- package/components/buttons/FSButtonRemoveLabel.vue +1 -1
- package/components/buttons/FSButtonSave.vue +1 -1
- package/components/buttons/FSButtonSaveLabel.vue +1 -1
- package/components/buttons/FSButtonSearch.vue +1 -1
- package/components/buttons/FSButtonSearchLabel.vue +1 -1
- package/components/buttons/FSButtonUndo.vue +1 -1
- package/components/buttons/FSButtonUndoLabel.vue +1 -1
- package/components/buttons/FSButtonUpdate.vue +1 -1
- package/components/buttons/FSButtonUpdateLabel.vue +1 -1
- package/components/buttons/FSButtonValidate.vue +1 -1
- package/components/buttons/FSButtonValidateLabel.vue +1 -1
- package/components/calendar/FSSimpleCalendar.vue +145 -0
- package/components/calendar/FSSimpleCalendarHeader.vue +60 -0
- package/components/calendar/FSSimpleMonthSelector.vue +138 -0
- package/components/deviceOrganisations/FSConnectivity.vue +11 -1
- package/components/deviceOrganisations/FSConnectivityCard.vue +19 -47
- package/components/deviceOrganisations/FSStatus.vue +11 -1
- package/components/deviceOrganisations/FSStatusCard.vue +35 -61
- package/components/deviceOrganisations/FSStatusesCarousel.vue +1 -0
- package/components/deviceOrganisations/FSStatusesRow.vue +9 -3
- package/components/deviceOrganisations/FSWorstAlert.vue +30 -37
- package/components/deviceOrganisations/FSWorstAlertCard.vue +36 -85
- package/components/fields/FSAutocompleteField.vue +445 -463
- package/components/fields/FSAutocompleteTag.vue +1 -1
- package/components/fields/FSBaseField.vue +44 -27
- package/components/fields/FSColorField.vue +42 -39
- package/components/fields/FSCommentField.vue +105 -0
- package/components/fields/FSDateField.vue +3 -2
- package/components/fields/FSDateRangeField.vue +3 -2
- package/components/fields/FSDateTimeField.vue +4 -3
- package/components/fields/FSDateTimeRangeField.vue +8 -6
- package/components/fields/FSEntityFieldUI.vue +271 -0
- package/components/fields/FSGradientField.vue +27 -33
- package/components/fields/FSIconField.vue +0 -1
- package/components/fields/FSMagicConfigField.vue +10 -3
- package/components/fields/FSMagicField.vue +9 -4
- package/components/fields/FSNumberField.vue +6 -1
- package/components/fields/FSRichTextField.vue +102 -52
- package/components/fields/FSSearchField.vue +9 -115
- package/components/fields/FSSelectField.vue +477 -252
- package/components/fields/FSTagField.vue +1 -1
- package/components/fields/FSTermField.vue +42 -17
- package/components/fields/FSTextArea.vue +26 -7
- package/components/fields/FSTextField.vue +8 -3
- package/components/fields/FSTimeRangeField.vue +304 -0
- package/components/fields/FSTimeStepField.vue +3 -3
- package/components/fields/FSTranslateField.vue +4 -3
- package/components/fields/FSTranslateRichTextField.vue +32 -12
- package/components/fields/FSTranslateTextArea.vue +233 -0
- package/components/fields/periodicField/FSPeriodicDailyField.vue +2 -2
- package/components/fields/periodicField/FSPeriodicField.vue +8 -8
- package/components/fields/periodicField/FSPeriodicMonthlyField.vue +8 -8
- package/components/fields/periodicField/FSPeriodicWeeklyField.vue +23 -13
- package/components/fields/periodicField/FSPeriodicYearlyField.vue +6 -6
- package/components/lists/FSDataTableUI.vue +173 -103
- package/components/lists/FSDraggable.vue +2 -2
- package/components/lists/FSFilterButton.vue +7 -11
- package/components/lists/FSHeaderButton.vue +4 -4
- package/components/lists/FSHiddenButton.vue +3 -5
- package/components/lists/FSLoadDataTable.vue +10 -7
- package/components/lists/FSSimpleList.vue +234 -0
- package/components/lists/FSSimpleListItem.vue +132 -0
- package/components/map/FSMap.vue +83 -33
- package/components/map/FSMapFeatureGroup.vue +2 -2
- package/components/map/FSMapLayerButton.vue +3 -3
- package/components/map/FSMapMarker.vue +11 -7
- package/components/map/FSMapMarkerClusterGroup.vue +8 -3
- package/components/map/FSMapOverlay.vue +37 -20
- package/components/map/FSMapPolygon.vue +5 -5
- package/components/map/FSMapTileLayer.vue +2 -2
- package/components/map/keys.ts +3 -3
- package/components/selects/FSSelectAutoRefresh.vue +9 -9
- package/components/selects/FSSelectDashboardVariableType.vue +5 -4
- package/components/selects/FSSelectDateSetting.vue +3 -2
- package/components/selects/FSSelectDays.vue +9 -9
- package/components/selects/FSSelectListMode.vue +51 -0
- package/components/selects/FSSelectMonths.vue +14 -14
- package/components/selects/chartSelectors/FSAggregationSelector.vue +52 -0
- package/components/selects/chartSelectors/FSAxisTypeSelector.vue +49 -0
- package/components/selects/chartSelectors/FSDisplayAsSelector.vue +53 -0
- package/components/selects/chartSelectors/FSFilterTypeSelector.vue +54 -0
- package/components/selects/chartSelectors/FSHeatmapRuleSelector.vue +54 -0
- package/components/selects/chartSelectors/FSOperationOnSelector.vue +53 -0
- package/components/selects/chartSelectors/FSPlanningTypeSelector.vue +53 -0
- package/components/selects/chartSelectors/FSPlotPerSelector.vue +52 -0
- package/components/selects/chartSelectors/FSSelectEntityType.vue +59 -0
- package/components/selects/chartSelectors/FSSerieTypeSelector.vue +53 -0
- package/components/tiles/FSAlertTileUI.vue +90 -0
- package/components/tiles/FSChartTileUI.vue +111 -0
- package/components/tiles/FSCommentTileUI.vue +174 -0
- package/components/tiles/FSDeviceOrganisationTileUI.vue +6 -0
- package/components/tiles/FSGroupTileUI.vue +2 -2
- package/components/tiles/FSLoadTile.vue +2 -0
- package/components/tiles/FSLocationTileUI.vue +192 -0
- package/components/tiles/FSModelTileUI.vue +18 -0
- package/components/tiles/FSSimpleTileUI.vue +9 -4
- package/components/tiles/FSTile.vue +93 -74
- package/components/tiles/FSUserOrganisationTileUI.vue +1 -1
- package/components/toggleSets/FSToggleSetPosition.vue +2 -2
- package/components/views/FSBaseView.vue +64 -0
- package/components/views/FSEntityView.vue +12 -140
- package/components/views/FSSimpleView.vue +29 -0
- package/components/views/desktop/FSBaseDefaultDesktopView.vue +135 -0
- package/components/views/desktop/FSBaseDesktopView.vue +53 -0
- package/components/views/desktop/FSBaseEntityDesktopView.vue +209 -0
- package/components/views/mobile/FSBaseDefaultMobileView.vue +133 -0
- package/components/views/mobile/FSBaseEntityMobileView.vue +199 -0
- package/components/views/mobile/FSBaseMobileView.vue +53 -0
- package/composables/useBreakpoints.ts +39 -3
- package/composables/useColors.ts +3 -2
- package/composables/useMagicFieldProvider.ts +1 -0
- package/composables/useSlots.ts +2 -1
- package/models/agenda.ts +9 -0
- package/models/deviceAlerts.ts +1 -1
- package/models/deviceConnectivities.ts +1 -1
- package/models/index.ts +1 -0
- package/models/magicFields.ts +1 -0
- package/models/map.ts +2 -2
- package/models/rules.ts +8 -5
- package/models/tables.ts +5 -2
- package/models/variableNode.ts +8 -5
- package/package.json +5 -5
- package/styles/components/fs_agenda.scss +36 -0
- package/styles/components/fs_agenda_event.scss +41 -0
- package/styles/components/fs_agenda_hours_col.scss +4 -0
- package/styles/components/fs_agenda_hours_row.scss +5 -0
- package/styles/components/fs_agenda_time_line_marker.scss +19 -0
- package/styles/components/fs_autocomplete_field.scss +0 -13
- package/styles/components/fs_breadcrumbs.scss +18 -36
- package/styles/components/fs_button.scss +7 -5
- package/styles/components/fs_chip.scss +8 -6
- package/styles/components/fs_clickable.scss +18 -23
- package/styles/components/fs_clock.scss +0 -10
- package/styles/components/fs_color_field.scss +1 -4
- package/styles/components/fs_data_iterator_item.scss +12 -10
- package/styles/components/fs_data_table.scss +6 -9
- package/styles/components/fs_dialog.scss +7 -17
- package/styles/components/fs_dialog_menu.scss +4 -2
- package/styles/components/fs_edit_image.scss +8 -0
- package/styles/components/fs_fade_out.scss +10 -2
- package/styles/components/fs_filter_button.scss +1 -6
- package/styles/components/fs_gradient_field.scss +11 -11
- package/styles/components/fs_hidden_button.scss +2 -7
- package/styles/components/fs_image_card.scss +6 -4
- package/styles/components/fs_magic_config_field.scss +1 -2
- package/styles/components/fs_map.scss +11 -7
- package/styles/components/fs_meta_field.scss +3 -5
- package/styles/components/fs_option_group.scss +15 -5
- package/styles/components/fs_password_field.scss +4 -2
- package/styles/components/fs_progress_bar.scss +14 -0
- package/styles/components/fs_radio.scss +0 -11
- package/styles/components/fs_rich_text_field.scss +1 -9
- package/styles/components/fs_select_date_settings.scss +3 -0
- package/styles/components/fs_select_field.scss +4 -13
- package/styles/components/fs_slide_group.scss +7 -0
- package/styles/components/fs_span.scss +13 -4
- package/styles/components/fs_switch.scss +1 -0
- package/styles/components/fs_tabs.scss +19 -33
- package/styles/components/fs_tag.scss +8 -22
- package/styles/components/fs_text_area.scss +13 -17
- package/styles/components/fs_tile.scss +21 -15
- package/styles/components/fs_window.scss +7 -0
- package/styles/components/fs_wrap_group.scss +7 -0
- package/styles/components/index.scss +6 -4
- package/styles/globals/index.scss +1 -5
- package/styles/globals/overrides.scss +28 -61
- package/styles/globals/scrollbars.scss +10 -0
- package/styles/globals/text_fonts.scss +18 -66
- package/tools/alertsTools.ts +69 -0
- package/tools/chartsTools.ts +427 -0
- package/tools/index.ts +4 -0
- package/tools/reportsTools.ts +38 -0
- package/tools/timeRangeTools.ts +125 -0
- package/utils/filter.ts +18 -0
- package/utils/index.ts +2 -0
- package/utils/leafletMarkers.ts +4 -4
- package/utils/operations.ts +69 -0
- package/utils/sort.ts +2 -2
- package/utils/statuses.ts +1 -1
- package/utils/time.ts +17 -17
- package/components/fields/FSTimeSlotField.vue +0 -250
- package/components/views/FSEntityHeader.vue +0 -350
- package/components/views/FSListHeader.vue +0 -83
- package/components/views/FSListView.vue +0 -83
- package/components/views/FSSkeletonView.vue +0 -100
- package/styles/components/fs_icon_field.scss +0 -12
- package/styles/components/fs_tag_field.scss +0 -8
- package/styles/components/fs_time_field.scss +0 -12
- package/styles/components/fs_timeslot_field.scss +0 -12
- package/styles/globals/breakpoints.scss +0 -20
- package/styles/globals/fixes.scss +0 -5
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
const MinusOperator = "-";
|
|
2
|
+
|
|
3
|
+
// Matches one of the three operators (+, *, /) or the - operator if it is preceded by something that is not another operator
|
|
4
|
+
const operatorsRegex = new RegExp(/[\+\*\/]|(?<=.)(?<![-\+\*\/])[-]/gm);
|
|
5
|
+
|
|
6
|
+
// Matches a nested block of parenthesis
|
|
7
|
+
const parenthesisRegex = new RegExp(/\([^)(]+\)/gm);
|
|
8
|
+
|
|
9
|
+
// Match a positive decimal number
|
|
10
|
+
const decimalRegex = new RegExp(/^\d+(.\d+)?$/gm);
|
|
11
|
+
|
|
12
|
+
const validateBlock = (block: string, operands: string[] = [], variables: string[] = []) => {
|
|
13
|
+
// Remove parenthesis from the block
|
|
14
|
+
block = block.replaceAll("(", "").replaceAll(")", "");
|
|
15
|
+
|
|
16
|
+
// Split block on operators (Leave negative signs)
|
|
17
|
+
const components = block.split(operatorsRegex);
|
|
18
|
+
|
|
19
|
+
// Check if each bit is a valid operand
|
|
20
|
+
for (let i = 0; i < components.length; i++) {
|
|
21
|
+
// Remove negative sign
|
|
22
|
+
if (components[i].startsWith(MinusOperator)) {
|
|
23
|
+
components[i] = components[i].substring(1);
|
|
24
|
+
}
|
|
25
|
+
if (!operands.includes(components[i]) && !variables.includes(components[i]) && !components[i].match(decimalRegex)) {
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return true;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export const validateOperation = (rawOperation: string, operands: string[] = [], variables: string[] = []) => {
|
|
33
|
+
// Remove spaces
|
|
34
|
+
let operation = rawOperation.replaceAll(" ", "");
|
|
35
|
+
|
|
36
|
+
// Check parenthesis
|
|
37
|
+
const parenthesis: number[] = [];
|
|
38
|
+
|
|
39
|
+
for (let i = 0; i < operation.length; i++) {
|
|
40
|
+
if (operation[i] == '(') {
|
|
41
|
+
parenthesis.push(i);
|
|
42
|
+
}
|
|
43
|
+
else if (operation[i] == ')') {
|
|
44
|
+
if (parenthesis.length > 0) {
|
|
45
|
+
if (i == parenthesis.pop()! + 1) {
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
if (parenthesis.length > 0) {
|
|
55
|
+
return false;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// Check each block between parenthesis
|
|
59
|
+
let match = operation.match(parenthesisRegex);
|
|
60
|
+
|
|
61
|
+
while (match?.[0]) {
|
|
62
|
+
if (!validateBlock(match[0], operands, variables)) {
|
|
63
|
+
return false;
|
|
64
|
+
}
|
|
65
|
+
operation = operation.replace(match[0], "1");
|
|
66
|
+
match = operation.match(parenthesisRegex);
|
|
67
|
+
}
|
|
68
|
+
return validateBlock(operation, operands, variables);
|
|
69
|
+
}
|
package/utils/sort.ts
CHANGED
package/utils/statuses.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useTranslations as useTranslationsProvider } from "@dative-gpi/bones-ui/composables";
|
|
2
|
-
import { ConnectivityStatus } from "@dative-gpi/foundation-shared-domain/
|
|
2
|
+
import { ConnectivityStatus } from "@dative-gpi/foundation-shared-domain/enums";
|
|
3
3
|
|
|
4
4
|
const { $tr } = useTranslationsProvider();
|
|
5
5
|
|
package/utils/time.ts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { useTranslations as useTranslationsProvider } from "@dative-gpi/bones-ui/composables";
|
|
2
2
|
|
|
3
|
-
import { TimeUnit } from "@dative-gpi/foundation-shared-domain/
|
|
3
|
+
import { TimeUnit } from "@dative-gpi/foundation-shared-domain/enums"
|
|
4
4
|
|
|
5
5
|
const { $tr } = useTranslationsProvider();
|
|
6
6
|
|
|
7
7
|
export const timeSteps = [
|
|
8
|
-
{ id: TimeUnit.Second,
|
|
9
|
-
{ id: TimeUnit.Minute,
|
|
10
|
-
{ id: TimeUnit.Hour,
|
|
11
|
-
{ id: TimeUnit.Day,
|
|
12
|
-
{ id: TimeUnit.Week,
|
|
13
|
-
{ id: TimeUnit.Month,
|
|
14
|
-
{ id: TimeUnit.Year,
|
|
15
|
-
]
|
|
8
|
+
{ id: TimeUnit.Second, get label() { return $tr("ui.common.second", "Second") }, get plural() { return $tr("ui.common.seconds", "Seconds") } },
|
|
9
|
+
{ id: TimeUnit.Minute, get label() { return $tr("ui.common.minute", "Minute") }, get plural() { return $tr("ui.common.minutes", "Minutes") } },
|
|
10
|
+
{ id: TimeUnit.Hour, get label() { return $tr("ui.common.hour", "Hour") }, get plural() { return $tr("ui.common.hours", "Hours") } },
|
|
11
|
+
{ id: TimeUnit.Day, get label() { return $tr("ui.common.day", "Day") }, get plural() { return $tr("ui.common.days", "Days") } },
|
|
12
|
+
{ id: TimeUnit.Week, get label() { return $tr("ui.common.week", "Week") }, get plural() { return $tr("ui.common.weeks", "Weeks") } },
|
|
13
|
+
{ id: TimeUnit.Month, get label() { return $tr("ui.common.month", "Month") }, get plural() { return $tr("ui.common.months", "Months") } },
|
|
14
|
+
{ id: TimeUnit.Year, get label() { return $tr("ui.common.year", "Year") }, get plural() { return $tr("ui.common.years", "Years") } },
|
|
15
|
+
];
|
|
16
16
|
|
|
17
17
|
export const timeStepToString = (value: { value: number, unit: TimeUnit } | null): string => {
|
|
18
18
|
if (!value) {
|
|
@@ -25,15 +25,15 @@ export const timeStepToString = (value: { value: number, unit: TimeUnit } | null
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
return `${value.value} ${value.value === 1 ? unit.label.toLowerCase() : unit.plural.toLowerCase()}`;
|
|
28
|
-
}
|
|
28
|
+
};
|
|
29
29
|
|
|
30
30
|
// TODO : remove everything below this line
|
|
31
|
-
export const timeScale
|
|
32
|
-
{ id: 1, label
|
|
33
|
-
{ id: 60, label
|
|
34
|
-
{ id: 3600, label
|
|
35
|
-
{ id: 86400, label
|
|
36
|
-
{ id: 604800, label
|
|
31
|
+
export const timeScale = [
|
|
32
|
+
{ id: 1, get label() { return $tr("ui.common.second", "Second") }, get plural() { return $tr("ui.common.seconds", "Seconds") } },
|
|
33
|
+
{ id: 60, get label() { return $tr("ui.common.minute", "Minute") }, get plural() { return $tr("ui.common.minutes", "Minutes") } },
|
|
34
|
+
{ id: 3600, get label() { return $tr("ui.common.hour", "Hour") }, get plural() { return $tr("ui.common.hours", "Hours") } },
|
|
35
|
+
{ id: 86400, get label() { return $tr("ui.common.day", "Day") }, get plural() { return $tr("ui.common.days", "Days") } },
|
|
36
|
+
{ id: 604800, get label() { return $tr("ui.common.week", "Week") }, get plural() { return $tr("ui.common.weeks", "Weeks") } },
|
|
37
37
|
];
|
|
38
38
|
|
|
39
39
|
export const getTimeScaleIndex = (value: number): number => {
|
|
@@ -52,4 +52,4 @@ export const getTimeBestString = (value: number): string => {
|
|
|
52
52
|
const unit = getTimeScaleIndex(value);
|
|
53
53
|
const figure = value / timeScale[unit].id;
|
|
54
54
|
return `${figure} ${figure === 1 ? timeScale[unit].label.toLowerCase() : timeScale[unit].plural.toLowerCase()}`;
|
|
55
|
-
}
|
|
55
|
+
};
|
|
@@ -1,250 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<FSBaseField
|
|
3
|
-
:description="$props.description"
|
|
4
|
-
:hideHeader="$props.hideHeader"
|
|
5
|
-
:required="$props.required"
|
|
6
|
-
:editable="$props.editable"
|
|
7
|
-
:label="$props.label"
|
|
8
|
-
:messages="messages"
|
|
9
|
-
>
|
|
10
|
-
<FSRow>
|
|
11
|
-
<FSRow
|
|
12
|
-
:wrap="false"
|
|
13
|
-
>
|
|
14
|
-
<FSSelectField
|
|
15
|
-
:validationValue="$props.modelValue"
|
|
16
|
-
:editable="$props.editable"
|
|
17
|
-
:validateOn="validateOn"
|
|
18
|
-
:rules="$props.rules"
|
|
19
|
-
:items="daysObject"
|
|
20
|
-
:hideHeader="true"
|
|
21
|
-
:clearable="false"
|
|
22
|
-
:style="style"
|
|
23
|
-
:modelValue="dayStart"
|
|
24
|
-
@update:modelValue="onChangeDayStart"
|
|
25
|
-
/>
|
|
26
|
-
<FSClock
|
|
27
|
-
class="fs-time-slot-field-number"
|
|
28
|
-
:editable="$props.editable"
|
|
29
|
-
:color="ColorEnum.Light"
|
|
30
|
-
:slider="false"
|
|
31
|
-
:style="style"
|
|
32
|
-
:modelValue="$props.modelValue[0][1]"
|
|
33
|
-
@update:modelValue="onChangeHourStart"
|
|
34
|
-
/>
|
|
35
|
-
</FSRow>
|
|
36
|
-
<FSRow
|
|
37
|
-
:wrap="false"
|
|
38
|
-
>
|
|
39
|
-
<FSSelectField
|
|
40
|
-
class="fs-time-slot-field-select"
|
|
41
|
-
:editable="$props.editable"
|
|
42
|
-
:items="daysObject"
|
|
43
|
-
:hideHeader="true"
|
|
44
|
-
:clearable="false"
|
|
45
|
-
:style="style"
|
|
46
|
-
:modelValue="dayEnd"
|
|
47
|
-
@update:modelValue="onChangeDayEnd"
|
|
48
|
-
/>
|
|
49
|
-
<FSClock
|
|
50
|
-
class="fs-time-slot-field-number"
|
|
51
|
-
:editable="$props.editable"
|
|
52
|
-
:color="ColorEnum.Light"
|
|
53
|
-
:slider="false"
|
|
54
|
-
:style="style"
|
|
55
|
-
:modelValue="$props.modelValue[1][1]"
|
|
56
|
-
@update:modelValue="onChangeHourEnd"
|
|
57
|
-
/>
|
|
58
|
-
</FSRow>
|
|
59
|
-
</FSRow>
|
|
60
|
-
</FSBaseField>
|
|
61
|
-
</template>
|
|
62
|
-
|
|
63
|
-
<script lang="ts">
|
|
64
|
-
import { computed, defineComponent, type PropType, type StyleValue } from "vue";
|
|
65
|
-
|
|
66
|
-
import { useColors, useRules } from "@dative-gpi/foundation-shared-components/composables";
|
|
67
|
-
import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
|
|
68
|
-
import { Days } from "@dative-gpi/foundation-shared-domain/models";
|
|
69
|
-
|
|
70
|
-
import FSSelectField from "./FSSelectField.vue";
|
|
71
|
-
import FSBaseField from "./FSBaseField.vue";
|
|
72
|
-
import FSClock from "../FSClock.vue";
|
|
73
|
-
import FSRow from "../FSRow.vue";
|
|
74
|
-
|
|
75
|
-
export default defineComponent({
|
|
76
|
-
name: "FSTimeSlotField",
|
|
77
|
-
components: {
|
|
78
|
-
FSSelectField,
|
|
79
|
-
FSBaseField,
|
|
80
|
-
FSClock,
|
|
81
|
-
FSRow
|
|
82
|
-
},
|
|
83
|
-
props: {
|
|
84
|
-
label: {
|
|
85
|
-
type: String as PropType<string | null>,
|
|
86
|
-
required: false,
|
|
87
|
-
default: null
|
|
88
|
-
},
|
|
89
|
-
description: {
|
|
90
|
-
type: String as PropType<string | null>,
|
|
91
|
-
required: false,
|
|
92
|
-
default: null
|
|
93
|
-
},
|
|
94
|
-
modelValue: {
|
|
95
|
-
type: Array as PropType<number[][] | null>,
|
|
96
|
-
required: true,
|
|
97
|
-
default: null
|
|
98
|
-
},
|
|
99
|
-
hideHeader: {
|
|
100
|
-
type: Boolean,
|
|
101
|
-
required: false,
|
|
102
|
-
default: false
|
|
103
|
-
},
|
|
104
|
-
required: {
|
|
105
|
-
type: Boolean,
|
|
106
|
-
required: false,
|
|
107
|
-
default: false
|
|
108
|
-
},
|
|
109
|
-
rules: {
|
|
110
|
-
type: Array as PropType<any[]>,
|
|
111
|
-
required: false,
|
|
112
|
-
default: () => []
|
|
113
|
-
},
|
|
114
|
-
messages: {
|
|
115
|
-
type: Array as PropType<string[]>,
|
|
116
|
-
required: false,
|
|
117
|
-
default: null
|
|
118
|
-
},
|
|
119
|
-
editable: {
|
|
120
|
-
type: Boolean,
|
|
121
|
-
required: false,
|
|
122
|
-
default: true
|
|
123
|
-
}
|
|
124
|
-
},
|
|
125
|
-
emits: ["update:modelValue"],
|
|
126
|
-
setup(props, { emit }) {
|
|
127
|
-
const { validateOn, getMessages } = useRules();
|
|
128
|
-
const { getColors } = useColors();
|
|
129
|
-
|
|
130
|
-
const errors = getColors(ColorEnum.Error);
|
|
131
|
-
const lights = getColors(ColorEnum.Light);
|
|
132
|
-
const darks = getColors(ColorEnum.Dark);
|
|
133
|
-
|
|
134
|
-
const daysObject: { id: number; label: string }[] = Object.keys(Days).reduce((acc, key) => {
|
|
135
|
-
if (isNaN(Number(key))) {
|
|
136
|
-
acc.push({
|
|
137
|
-
id: Days[key],
|
|
138
|
-
label: key
|
|
139
|
-
});
|
|
140
|
-
}
|
|
141
|
-
return acc;
|
|
142
|
-
}, [] as { id: number, label: string }[]);
|
|
143
|
-
|
|
144
|
-
const style = computed((): StyleValue => {
|
|
145
|
-
if (!props.editable) {
|
|
146
|
-
return {
|
|
147
|
-
"--fs-time-slot-field-cursor" : "default",
|
|
148
|
-
"--fs-time-slot-field-border-color" : lights.base,
|
|
149
|
-
"--fs-time-slot-field-color" : lights.dark,
|
|
150
|
-
"--fs-time-slot-field-active-border-color": lights.base
|
|
151
|
-
};
|
|
152
|
-
}
|
|
153
|
-
return {
|
|
154
|
-
"--fs-time-slot-field-cursor" : "text",
|
|
155
|
-
"--fs-time-slot-field-border-color" : lights.dark,
|
|
156
|
-
"--fs-time-slot-field-color" : darks.base,
|
|
157
|
-
"--fs-time-slot-field-active-border-color": darks.dark,
|
|
158
|
-
"--fs-time-slot-field-error-color" : errors.base,
|
|
159
|
-
"--fs-time-slot-field-error-border-color" : errors.base
|
|
160
|
-
};
|
|
161
|
-
});
|
|
162
|
-
|
|
163
|
-
const dayStart = computed((): number => {
|
|
164
|
-
if (props.modelValue) {
|
|
165
|
-
return props.modelValue[1][0] === 7 ? 7 : props.modelValue[0][0];
|
|
166
|
-
}
|
|
167
|
-
return 0;
|
|
168
|
-
});
|
|
169
|
-
|
|
170
|
-
const dayEnd = computed((): number => {
|
|
171
|
-
if (props.modelValue) {
|
|
172
|
-
return props.modelValue[0][0] === 7 ? 7 : props.modelValue[1][0];
|
|
173
|
-
}
|
|
174
|
-
return 0;
|
|
175
|
-
});
|
|
176
|
-
|
|
177
|
-
const messages = computed((): string[] => props.messages ?? getMessages(props.modelValue, props.rules));
|
|
178
|
-
|
|
179
|
-
const onChangeDayStart = (value: number) => {
|
|
180
|
-
if (value === 7) {
|
|
181
|
-
if (props.modelValue) {
|
|
182
|
-
emit("update:modelValue", [[7, props.modelValue[0][1]], [7, props.modelValue[1][1]]]);
|
|
183
|
-
return;
|
|
184
|
-
}
|
|
185
|
-
emit("update:modelValue", [[7, 0], [7, 0]]);
|
|
186
|
-
return;
|
|
187
|
-
}
|
|
188
|
-
if (props.modelValue) {
|
|
189
|
-
if (props.modelValue[1][0] === 7) {
|
|
190
|
-
emit("update:modelValue", [[value, props.modelValue[0][1]], [value, props.modelValue[1][1]]]);
|
|
191
|
-
return;
|
|
192
|
-
}
|
|
193
|
-
emit("update:modelValue", [[value, props.modelValue[0][1]], props.modelValue[1]]);
|
|
194
|
-
return;
|
|
195
|
-
}
|
|
196
|
-
emit("update:modelValue", [[value, 0], [value, 0]]);
|
|
197
|
-
};
|
|
198
|
-
|
|
199
|
-
const onChangeHourStart = (value: number) => {
|
|
200
|
-
if (props.modelValue) {
|
|
201
|
-
emit("update:modelValue", [[props.modelValue[0][0], value], props.modelValue[1]]);
|
|
202
|
-
return;
|
|
203
|
-
}
|
|
204
|
-
emit("update:modelValue", [[0, value], [0, 0]]);
|
|
205
|
-
};
|
|
206
|
-
|
|
207
|
-
const onChangeDayEnd = (value: number) => {
|
|
208
|
-
if (value === 7) {
|
|
209
|
-
if (props.modelValue) {
|
|
210
|
-
emit("update:modelValue", [[7, props.modelValue[0][1]], [7, props.modelValue[1][1]]]);
|
|
211
|
-
return;
|
|
212
|
-
}
|
|
213
|
-
emit("update:modelValue", [[7, 0], [7, 0]]);
|
|
214
|
-
return;
|
|
215
|
-
}
|
|
216
|
-
if (props.modelValue) {
|
|
217
|
-
if (props.modelValue[0][0] === 7) {
|
|
218
|
-
emit("update:modelValue", [[value, props.modelValue[0][1]], [value, props.modelValue[1][1]]]);
|
|
219
|
-
return;
|
|
220
|
-
}
|
|
221
|
-
emit("update:modelValue", [props.modelValue[0], [value, props.modelValue[1][1]]]);
|
|
222
|
-
return;
|
|
223
|
-
}
|
|
224
|
-
emit("update:modelValue", [[value, 0], [value, 0]]);
|
|
225
|
-
};
|
|
226
|
-
|
|
227
|
-
const onChangeHourEnd = (value: number) => {
|
|
228
|
-
if (props.modelValue) {
|
|
229
|
-
emit("update:modelValue", [props.modelValue[0], [props.modelValue[1][0], value]]);
|
|
230
|
-
return;
|
|
231
|
-
}
|
|
232
|
-
emit("update:modelValue", [[0, 0], [0, value]]);
|
|
233
|
-
};
|
|
234
|
-
|
|
235
|
-
return {
|
|
236
|
-
daysObject,
|
|
237
|
-
validateOn,
|
|
238
|
-
ColorEnum,
|
|
239
|
-
dayStart,
|
|
240
|
-
messages,
|
|
241
|
-
dayEnd,
|
|
242
|
-
style,
|
|
243
|
-
onChangeHourStart,
|
|
244
|
-
onChangeDayStart,
|
|
245
|
-
onChangeHourEnd,
|
|
246
|
-
onChangeDayEnd
|
|
247
|
-
};
|
|
248
|
-
}
|
|
249
|
-
});
|
|
250
|
-
</script>
|