@trackunit/react-form-components 0.0.177 → 0.0.179
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/index.cjs.js +0 -54
- package/index.esm.js +1 -54
- package/package.json +2 -2
- package/src/components/Schedule/ScheduleParser.d.ts +0 -14
package/index.cjs.js
CHANGED
|
@@ -14940,59 +14940,6 @@ const serializeSchedule = (weekSchedule) => {
|
|
|
14940
14940
|
})
|
|
14941
14941
|
.join(",");
|
|
14942
14942
|
};
|
|
14943
|
-
/**
|
|
14944
|
-
*
|
|
14945
|
-
* @param weekDays week days for when movement must be detected
|
|
14946
|
-
* @param timeStart start time (hour:minute)
|
|
14947
|
-
* @param timeEnd end time (hour:minute)
|
|
14948
|
-
* @returns {DaySchedule[] | undefined} conversion of schedule for when movement must be detected to when movement must not be detected (working hours)
|
|
14949
|
-
*/
|
|
14950
|
-
const workTimeAlarmConversion = (weekDays, timeStart, timeEnd) => {
|
|
14951
|
-
var _a;
|
|
14952
|
-
const startAtMidnight = (timeStart === null || timeStart === void 0 ? void 0 : timeStart.hour) === 0 && (timeStart === null || timeStart === void 0 ? void 0 : timeStart.minute) === 0;
|
|
14953
|
-
const endAtMidnight = (timeEnd === null || timeEnd === void 0 ? void 0 : timeEnd.hour) === 0 && (timeEnd === null || timeEnd === void 0 ? void 0 : timeEnd.minute) === 0;
|
|
14954
|
-
const wholeWeek = [1, 2, 3, 4, 5, 6, 7];
|
|
14955
|
-
const weekdayIndex = {
|
|
14956
|
-
monday: 1,
|
|
14957
|
-
tuesday: 2,
|
|
14958
|
-
wednesday: 3,
|
|
14959
|
-
thursday: 4,
|
|
14960
|
-
friday: 5,
|
|
14961
|
-
saturday: 6,
|
|
14962
|
-
sunday: 7,
|
|
14963
|
-
};
|
|
14964
|
-
const activeAlarmDays = weekDays === null || weekDays === void 0 ? void 0 : weekDays.map(day => weekdayIndex[day === null || day === void 0 ? void 0 : day.toLowerCase()]);
|
|
14965
|
-
if (startAtMidnight && endAtMidnight) {
|
|
14966
|
-
const result = (_a = wholeWeek === null || wholeWeek === void 0 ? void 0 : wholeWeek.filter(day => activeAlarmDays === null || activeAlarmDays === void 0 ? void 0 : activeAlarmDays.includes(day))) === null || _a === void 0 ? void 0 : _a.map(day => {
|
|
14967
|
-
return {
|
|
14968
|
-
day,
|
|
14969
|
-
range: {
|
|
14970
|
-
timeFrom: "",
|
|
14971
|
-
timeTo: "",
|
|
14972
|
-
},
|
|
14973
|
-
isAllDay: true,
|
|
14974
|
-
};
|
|
14975
|
-
});
|
|
14976
|
-
return result;
|
|
14977
|
-
}
|
|
14978
|
-
else if (startAtMidnight || endAtMidnight) {
|
|
14979
|
-
const result = wholeWeek === null || wholeWeek === void 0 ? void 0 : wholeWeek.map(day => {
|
|
14980
|
-
const allDay = !(activeAlarmDays === null || activeAlarmDays === void 0 ? void 0 : activeAlarmDays.includes(day));
|
|
14981
|
-
return {
|
|
14982
|
-
day,
|
|
14983
|
-
range: {
|
|
14984
|
-
timeFrom: allDay ? "" : `${timeEnd === null || timeEnd === void 0 ? void 0 : timeEnd.hour}:${timeEnd === null || timeEnd === void 0 ? void 0 : timeEnd.minute}`,
|
|
14985
|
-
timeTo: allDay ? "" : `${timeStart === null || timeStart === void 0 ? void 0 : timeStart.hour}:${timeStart === null || timeStart === void 0 ? void 0 : timeStart.minute}`,
|
|
14986
|
-
},
|
|
14987
|
-
isAllDay: allDay,
|
|
14988
|
-
};
|
|
14989
|
-
});
|
|
14990
|
-
return result;
|
|
14991
|
-
}
|
|
14992
|
-
else {
|
|
14993
|
-
return undefined;
|
|
14994
|
-
}
|
|
14995
|
-
};
|
|
14996
14943
|
|
|
14997
14944
|
/**
|
|
14998
14945
|
* A thin wrapper around the `BaseInput` component for text input fields.
|
|
@@ -15331,4 +15278,3 @@ exports.useCustomComponents = useCustomComponents;
|
|
|
15331
15278
|
exports.usePhoneInput = usePhoneInput;
|
|
15332
15279
|
exports.validatePhoneNumber = validatePhoneNumber;
|
|
15333
15280
|
exports.weekDay = weekDay;
|
|
15334
|
-
exports.workTimeAlarmConversion = workTimeAlarmConversion;
|
package/index.esm.js
CHANGED
|
@@ -14914,59 +14914,6 @@ const serializeSchedule = (weekSchedule) => {
|
|
|
14914
14914
|
})
|
|
14915
14915
|
.join(",");
|
|
14916
14916
|
};
|
|
14917
|
-
/**
|
|
14918
|
-
*
|
|
14919
|
-
* @param weekDays week days for when movement must be detected
|
|
14920
|
-
* @param timeStart start time (hour:minute)
|
|
14921
|
-
* @param timeEnd end time (hour:minute)
|
|
14922
|
-
* @returns {DaySchedule[] | undefined} conversion of schedule for when movement must be detected to when movement must not be detected (working hours)
|
|
14923
|
-
*/
|
|
14924
|
-
const workTimeAlarmConversion = (weekDays, timeStart, timeEnd) => {
|
|
14925
|
-
var _a;
|
|
14926
|
-
const startAtMidnight = (timeStart === null || timeStart === void 0 ? void 0 : timeStart.hour) === 0 && (timeStart === null || timeStart === void 0 ? void 0 : timeStart.minute) === 0;
|
|
14927
|
-
const endAtMidnight = (timeEnd === null || timeEnd === void 0 ? void 0 : timeEnd.hour) === 0 && (timeEnd === null || timeEnd === void 0 ? void 0 : timeEnd.minute) === 0;
|
|
14928
|
-
const wholeWeek = [1, 2, 3, 4, 5, 6, 7];
|
|
14929
|
-
const weekdayIndex = {
|
|
14930
|
-
monday: 1,
|
|
14931
|
-
tuesday: 2,
|
|
14932
|
-
wednesday: 3,
|
|
14933
|
-
thursday: 4,
|
|
14934
|
-
friday: 5,
|
|
14935
|
-
saturday: 6,
|
|
14936
|
-
sunday: 7,
|
|
14937
|
-
};
|
|
14938
|
-
const activeAlarmDays = weekDays === null || weekDays === void 0 ? void 0 : weekDays.map(day => weekdayIndex[day === null || day === void 0 ? void 0 : day.toLowerCase()]);
|
|
14939
|
-
if (startAtMidnight && endAtMidnight) {
|
|
14940
|
-
const result = (_a = wholeWeek === null || wholeWeek === void 0 ? void 0 : wholeWeek.filter(day => activeAlarmDays === null || activeAlarmDays === void 0 ? void 0 : activeAlarmDays.includes(day))) === null || _a === void 0 ? void 0 : _a.map(day => {
|
|
14941
|
-
return {
|
|
14942
|
-
day,
|
|
14943
|
-
range: {
|
|
14944
|
-
timeFrom: "",
|
|
14945
|
-
timeTo: "",
|
|
14946
|
-
},
|
|
14947
|
-
isAllDay: true,
|
|
14948
|
-
};
|
|
14949
|
-
});
|
|
14950
|
-
return result;
|
|
14951
|
-
}
|
|
14952
|
-
else if (startAtMidnight || endAtMidnight) {
|
|
14953
|
-
const result = wholeWeek === null || wholeWeek === void 0 ? void 0 : wholeWeek.map(day => {
|
|
14954
|
-
const allDay = !(activeAlarmDays === null || activeAlarmDays === void 0 ? void 0 : activeAlarmDays.includes(day));
|
|
14955
|
-
return {
|
|
14956
|
-
day,
|
|
14957
|
-
range: {
|
|
14958
|
-
timeFrom: allDay ? "" : `${timeEnd === null || timeEnd === void 0 ? void 0 : timeEnd.hour}:${timeEnd === null || timeEnd === void 0 ? void 0 : timeEnd.minute}`,
|
|
14959
|
-
timeTo: allDay ? "" : `${timeStart === null || timeStart === void 0 ? void 0 : timeStart.hour}:${timeStart === null || timeStart === void 0 ? void 0 : timeStart.minute}`,
|
|
14960
|
-
},
|
|
14961
|
-
isAllDay: allDay,
|
|
14962
|
-
};
|
|
14963
|
-
});
|
|
14964
|
-
return result;
|
|
14965
|
-
}
|
|
14966
|
-
else {
|
|
14967
|
-
return undefined;
|
|
14968
|
-
}
|
|
14969
|
-
};
|
|
14970
14917
|
|
|
14971
14918
|
/**
|
|
14972
14919
|
* A thin wrapper around the `BaseInput` component for text input fields.
|
|
@@ -15242,4 +15189,4 @@ const UploadField = forwardRef((_a, ref) => {
|
|
|
15242
15189
|
*/
|
|
15243
15190
|
setupLibraryTranslations();
|
|
15244
15191
|
|
|
15245
|
-
export { ActionButton, BaseInput, Checkbox, CreatableSelect, DateField, DateInput, DropZone, EmailField, EmailInput, FormGroup, Label, MultiSelectMenuItem, NumberField, NumberInput, OptionCard, PhoneField, PhoneInput, RadioGroup, RadioItem, Schedule, ScheduleVariant, Search, Select, SingleSelectMenuItem, TextArea, TextAreaField, TextField, TextInput, TimeRange, TimeRangeField, Toggle, UploadField, UploadInput, StateManagedSelect$1 as ValueType, checkIfPhoneNumberHasPlus, cvaInput, cvaInputAddon, cvaInputAddonAfter, cvaInputAddonBefore, cvaInputBase, cvaInputBaseDisabled, cvaInputBaseInvalid, cvaInputField, cvaInputPrefix, cvaInputSuffix, cvaSelect, cvaSelectCounter, cvaSelectDynamicTagContainer, cvaSelectIcon, cvaSelectMenu, cvaSelectMenuList, cvaSelectPrefix, cvaSelectXIcon, getOrderedOptions, getPhoneNumberWithPlus, isInvalidCountryCode, isInvalidPhoneNumber, isMultiValue, parseSchedule, serializeSchedule, useCustomComponents, usePhoneInput, validatePhoneNumber, weekDay
|
|
15192
|
+
export { ActionButton, BaseInput, Checkbox, CreatableSelect, DateField, DateInput, DropZone, EmailField, EmailInput, FormGroup, Label, MultiSelectMenuItem, NumberField, NumberInput, OptionCard, PhoneField, PhoneInput, RadioGroup, RadioItem, Schedule, ScheduleVariant, Search, Select, SingleSelectMenuItem, TextArea, TextAreaField, TextField, TextInput, TimeRange, TimeRangeField, Toggle, UploadField, UploadInput, StateManagedSelect$1 as ValueType, checkIfPhoneNumberHasPlus, cvaInput, cvaInputAddon, cvaInputAddonAfter, cvaInputAddonBefore, cvaInputBase, cvaInputBaseDisabled, cvaInputBaseInvalid, cvaInputField, cvaInputPrefix, cvaInputSuffix, cvaSelect, cvaSelectCounter, cvaSelectDynamicTagContainer, cvaSelectIcon, cvaSelectMenu, cvaSelectMenuList, cvaSelectPrefix, cvaSelectXIcon, getOrderedOptions, getPhoneNumberWithPlus, isInvalidCountryCode, isInvalidPhoneNumber, isMultiValue, parseSchedule, serializeSchedule, useCustomComponents, usePhoneInput, validatePhoneNumber, weekDay };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trackunit/react-form-components",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.179",
|
|
4
4
|
"repository": "https://github.com/Trackunit/manager",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"engines": {
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"dependencies": {
|
|
10
10
|
"@trackunit/css-class-variance-utilities": "0.0.14",
|
|
11
11
|
"@trackunit/i18n-library-translation": "0.0.87",
|
|
12
|
-
"@trackunit/react-components": "0.1.
|
|
12
|
+
"@trackunit/react-components": "0.1.181",
|
|
13
13
|
"@trackunit/shared-utils": "0.0.12",
|
|
14
14
|
"@trackunit/ui-icons": "0.0.78",
|
|
15
15
|
"date-fns": "2.29.3",
|
|
@@ -37,17 +37,3 @@ export declare const parseSchedule: (scheduleString: string) => WeekSchedule;
|
|
|
37
37
|
* @returns {string} Schedule string
|
|
38
38
|
*/
|
|
39
39
|
export declare const serializeSchedule: (weekSchedule: WeekSchedule) => string;
|
|
40
|
-
/**
|
|
41
|
-
*
|
|
42
|
-
* @param weekDays week days for when movement must be detected
|
|
43
|
-
* @param timeStart start time (hour:minute)
|
|
44
|
-
* @param timeEnd end time (hour:minute)
|
|
45
|
-
* @returns {DaySchedule[] | undefined} conversion of schedule for when movement must be detected to when movement must not be detected (working hours)
|
|
46
|
-
*/
|
|
47
|
-
export declare const workTimeAlarmConversion: (weekDays: ("MONDAY" | "TUESDAY" | "WEDNESDAY" | "THURSDAY" | "FRIDAY" | "SATURDAY" | "SUNDAY")[] | undefined, timeStart: {
|
|
48
|
-
hour: number;
|
|
49
|
-
minute: number;
|
|
50
|
-
} | undefined, timeEnd: {
|
|
51
|
-
hour: number;
|
|
52
|
-
minute: number;
|
|
53
|
-
} | undefined) => DaySchedule[] | undefined;
|