@dative-gpi/foundation-shared-components 0.0.12 → 0.0.14
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/FSButton.vue +1 -1
- package/components/FSCalendarTwin.vue +2 -0
- package/components/FSCheckbox.vue +3 -3
- package/components/FSClock.vue +47 -40
- package/components/FSCol.vue +2 -2
- package/components/FSDivider.vue +46 -7
- package/components/FSForm.vue +52 -0
- package/components/FSImage.vue +41 -32
- package/components/FSLabel.vue +105 -0
- package/components/FSPagination.vue +25 -9
- package/components/FSPermissions.vue +0 -0
- package/components/FSRadio.vue +3 -3
- package/components/FSSlideGroup.vue +10 -11
- package/components/FSSubmitDialog.vue +1 -1
- package/components/FSSwitch.vue +3 -3
- package/components/FSText.vue +1 -1
- package/components/FSWrapGroup.vue +10 -11
- package/components/{FSAutocompleteField.vue → fields/FSAutocompleteField.vue} +26 -19
- package/components/fields/FSColorField.vue +205 -0
- package/components/{FSDateField.vue → fields/FSDateField.vue} +15 -50
- package/components/{FSDateRangeField.vue → fields/FSDateRangeField.vue} +17 -67
- package/components/{FSDateTimeField.vue → fields/FSDateTimeField.vue} +17 -52
- package/components/{FSDateTimeRangeField.vue → fields/FSDateTimeRangeField.vue} +45 -81
- package/components/{FSIconField.vue → fields/FSIconField.vue} +16 -55
- package/components/{FSNumberField.vue → fields/FSNumberField.vue} +17 -27
- package/components/{FSPasswordField.vue → fields/FSPasswordField.vue} +5 -29
- package/components/{FSRichTextField.vue → fields/FSRichTextField.vue} +13 -11
- package/components/{FSSearchField.vue → fields/FSSearchField.vue} +1 -1
- package/components/{FSSelectField.vue → fields/FSSelectField.vue} +17 -21
- package/components/{FSTagField.vue → fields/FSTagField.vue} +18 -53
- package/components/{FSTextArea.vue → fields/FSTextArea.vue} +26 -26
- package/components/{FSTextField.vue → fields/FSTextField.vue} +18 -18
- package/components/fields/FSTimeField.vue +202 -0
- package/components/fields/FSTimeSlotField.vue +269 -0
- package/components/lists/FSDataTableUI.vue +10 -12
- package/components/lists/FSFilterButton.vue +1 -1
- package/components/tiles/FSDeviceOrganisationTileUI.vue +4 -9
- package/components/tiles/FSGroupTileUI.vue +4 -9
- package/composables/index.ts +1 -0
- package/composables/useBreakpoints.ts +7 -5
- package/composables/useRules.ts +72 -0
- package/elements/FSFormElement.ts +17 -0
- package/icons/flags/France.vue +9 -0
- package/icons/flags/Germany.vue +7 -0
- package/icons/flags/GreatBritain.vue +9 -0
- package/icons/flags/Italy.vue +9 -0
- package/icons/flags/Portugal.vue +59 -0
- package/icons/flags/Spain.vue +546 -0
- package/icons/flags/UnitedStates.vue +12 -0
- package/icons/sets.ts +17 -0
- package/models/rules.ts +8 -0
- package/package.json +4 -4
- package/styles/components/fs_autocomplete_field.scss +3 -60
- package/styles/components/fs_clock.scss +4 -0
- package/styles/components/fs_color_field.scss +21 -0
- package/styles/components/fs_data_table.scss +7 -2
- package/styles/components/fs_divider.scss +5 -0
- package/styles/components/fs_image.scss +12 -1
- package/styles/components/fs_label.scss +86 -0
- package/styles/components/fs_pagination.scss +3 -3
- package/styles/components/fs_rich_text_field.scss +1 -1
- package/styles/components/fs_select_field.scss +3 -4
- package/styles/components/fs_switch.scss +4 -4
- package/styles/components/fs_text_area.scss +2 -0
- package/styles/components/fs_text_field.scss +1 -0
- package/styles/components/fs_time_field.scss +16 -0
- package/styles/components/fs_timeslot_field.scss +12 -0
- package/styles/components/index.scss +4 -0
- package/styles/globals/overrides.scss +8 -6
- package/styles/globals/text_fonts.scss +18 -0
- package/utils/color.ts +7 -0
- package/utils/css.ts +2 -1
- package/utils/icons.ts +88 -2
- package/utils/index.ts +3 -1
- package/utils/time.ts +29 -0
- package/components/FSHeaderButton.vue +0 -17
- package/components/lists/FSDataIteratorGroup.vue +0 -7
package/utils/time.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { useTranslations as useTranslationsProvider } from "@dative-gpi/bones-ui/composables";
|
|
2
|
+
|
|
3
|
+
const { $tr } = useTranslationsProvider();
|
|
4
|
+
|
|
5
|
+
export const timeScale: any[] = [
|
|
6
|
+
{ id: 1, label: $tr("ui.time-field.second.singular", "Second"), plural: $tr("ui.time-field.second.plural", "Seconds") },
|
|
7
|
+
{ id: 60, label: $tr("ui.time-field.minute.singular", "Minute"), plural: $tr("ui.time-field.minute.plural", "Minutes") },
|
|
8
|
+
{ id: 3600, label: $tr("ui.time-field.hour.singular", "Hour"), plural: $tr("ui.time-field.hour.plural", "Hours") },
|
|
9
|
+
{ id: 86400, label: $tr("ui.time-field.day.singular", "Day"), plural: $tr("ui.time-field.day.plural", "Days") },
|
|
10
|
+
{ id: 604800, label: $tr("ui.time-field.week.singular", "Week"), plural: $tr("ui.time-field.week.plural", "Weeks") },
|
|
11
|
+
];
|
|
12
|
+
|
|
13
|
+
export const getTimeScaleIndex = (value: number): number => {
|
|
14
|
+
if (!value) {
|
|
15
|
+
return 0;
|
|
16
|
+
}
|
|
17
|
+
for (let i = timeScale.length - 1; i >= 0; i--) {
|
|
18
|
+
if (value % timeScale[i].id === 0) {
|
|
19
|
+
return i;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
return 0;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export const getTimeBestString = (value: number): string => {
|
|
26
|
+
const unit = getTimeScaleIndex(value);
|
|
27
|
+
const figure = value / timeScale[unit].id;
|
|
28
|
+
return `${figure} ${figure === 1 ? timeScale[unit].label.toLowerCase() : timeScale[unit].plural.toLowerCaser()}`;
|
|
29
|
+
}
|