utility-types#$PropertyType TypeScript Examples

The following examples show how to use utility-types#$PropertyType. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: actions.ts    From orangehrm-os-mobile with GNU General Public License v3.0 6 votes vote down vote up
pickMultipleDayPartialOption = (
  partialOption: $PropertyType<
    PickMultipleDayPartialOptionAction,
    'partialOption'
  >,
): PickMultipleDayPartialOptionAction => ({
  type: PICK_MULTIPLE_DAY_PARTIAL_OPTION,
  partialOption,
})
Example #2
Source File: drawer.ts    From orangehrm-os-mobile with GNU General Public License v3.0 6 votes vote down vote up
getDrawerItems = (
  drawerNavigationState: DrawerNavigationState,
  drawerDescriptors: DrawerDescriptorMap,
  enabledModules?: EnabledModules,
) => {
  const items: DrawerItem[] = [];
  const subheaders: {[key: string]: undefined} = {};
  if (enabledModules !== undefined) {
    drawerNavigationState.routes.forEach((route) => {
      const moduleName = SUBHEADER_MODULE_MAP[
        route.params?.subheader
      ] as keyof $PropertyType<EnabledModules, 'modules'>;
      if (enabledModules.modules[moduleName]) {
        const item: DrawerItem = {
          name: route.name,
          key: route.key,
          label: drawerDescriptors[route.key].options.drawerLabel,
          subheader: undefined,
          subheaderIcon: undefined,
        };
        if (!subheaders.hasOwnProperty(route.params.subheader)) {
          item.subheader = route.params.subheader;
          item.subheaderIcon = SUBHEADER_ICONS[route.params.subheader];
          subheaders[route.params.subheader] = undefined;
        }

        items.push(item);
      }
    });
  }
  return items;
}
Example #3
Source File: actions.ts    From orangehrm-os-mobile with GNU General Public License v3.0 6 votes vote down vote up
fetchSubordinateLeaveEntitlementsFinished = (
  payload?: $PropertyType<
    FetchSubordinateLeaveEntitlementFinishedAction,
    'payload'
  >,
  error: boolean = false,
): FetchSubordinateLeaveEntitlementFinishedAction => ({
  type: FETCH_SUBORDINATE_LEAVE_ENTITLEMENT_FINISHED,
  payload,
  error,
})
Example #4
Source File: actions.ts    From orangehrm-os-mobile with GNU General Public License v3.0 6 votes vote down vote up
pickAssignLeaveMultipleDayPartialOption = (
  partialOption: $PropertyType<
    PickMultipleDayPartialOptionAction,
    'partialOption'
  >,
): PickMultipleDayPartialOptionAction => ({
  type: PICK_MULTIPLE_DAY_PARTIAL_OPTION,
  partialOption,
})
Example #5
Source File: actions.ts    From orangehrm-os-mobile with GNU General Public License v3.0 6 votes vote down vote up
pickApplyLeaveMultipleDayPartialOption = (
  partialOption: $PropertyType<
    PickMultipleDayPartialOptionAction,
    'partialOption'
  >,
): PickMultipleDayPartialOptionAction => ({
  type: PICK_MULTIPLE_DAY_PARTIAL_OPTION,
  partialOption,
})
Example #6
Source File: actions.ts    From orangehrm-os-mobile with GNU General Public License v3.0 5 votes vote down vote up
fetchMyLeaveDetailsFinished = (
  payload?: $PropertyType<FetchMyLeaveRequestDetailsFinishedAction, 'payload'>,
  error: boolean = false,
): FetchMyLeaveRequestDetailsFinishedAction => ({
  type: FETCH_MY_LEAVE_DETAILS_FINISHED,
  payload,
  error,
})
Example #7
Source File: actions.ts    From orangehrm-os-mobile with GNU General Public License v3.0 5 votes vote down vote up
setCommonLeaveScreensState = (
  state: $PropertyType<SetCommonLeaveScreensStateAction, 'state'>,
): SetCommonLeaveScreensStateAction => ({
  type: SET_COMMON_LEAVE_SCREENS_STATE,
  state,
})
Example #8
Source File: actions.ts    From orangehrm-os-mobile with GNU General Public License v3.0 5 votes vote down vote up
setPickedState = (
  key: Exclude<$PropertyType<SetPickedStateAction, 'key'>, undefined>,
  state: boolean = false,
): SetPickedStateAction => ({
  type: SET_PICKED_STATE,
  key,
  state,
})
Example #9
Source File: actions.ts    From orangehrm-os-mobile with GNU General Public License v3.0 5 votes vote down vote up
fetchHolidaysFinished = (
  holidays: $PropertyType<FetchHolidaysFinishedAction, 'holidays'>,
): FetchHolidaysFinishedAction => ({
  type: FETCH_HOLIDAYS_FINISHED,
  holidays,
})
Example #10
Source File: actions.ts    From orangehrm-os-mobile with GNU General Public License v3.0 5 votes vote down vote up
fetchWorkWeekFinished = (
  workWeek: $PropertyType<FetchWorkWeekFinishedAction, 'workWeek'>,
): FetchWorkWeekFinishedAction => ({
  type: FETCH_WORK_WEEK_FINISHED,
  workWeek,
})
Example #11
Source File: actions.ts    From orangehrm-os-mobile with GNU General Public License v3.0 5 votes vote down vote up
fetchLeaveListFinished = (
  payload?: $PropertyType<FetchLeaveListFinishedAction, 'payload'>,
  error: boolean = false,
): FetchLeaveListFinishedAction => ({
  type: FETCH_LEAVE_LIST_FINISHED,
  payload,
  error,
})
Example #12
Source File: actions.ts    From orangehrm-os-mobile with GNU General Public License v3.0 5 votes vote down vote up
fetchEmployeeLeaveRequestFinished = (
  payload?: $PropertyType<FetchEmployeeLeaveRequestFinishedAction, 'payload'>,
  error: boolean = false,
): FetchEmployeeLeaveRequestFinishedAction => ({
  type: FETCH_EMPLOYEE_LEAVE_REQUEST_FINISHED,
  payload,
  error,
})
Example #13
Source File: actions.ts    From orangehrm-os-mobile with GNU General Public License v3.0 5 votes vote down vote up
changeEmployeeLeaveRequestStatus = (
  leaveRequestId: string,
  action: $PropertyType<ChangeEmployeeLeaveRequestStatusAction, 'action'>,
): ChangeEmployeeLeaveRequestStatusAction => ({
  type: CHANGE_EMPLOYEE_LEAVE_REQUEST_STATUS,
  leaveRequestId,
  action,
})
Example #14
Source File: actions.ts    From orangehrm-os-mobile with GNU General Public License v3.0 5 votes vote down vote up
changeMyLeaveRequestStatus = (
  leaveRequestId: string,
  action: $PropertyType<ChangeMyLeaveRequestStatusAction, 'action'>,
): ChangeMyLeaveRequestStatusAction => ({
  type: CHANGE_MY_LEAVE_REQUEST_STATUS,
  leaveRequestId,
  action,
})
Example #15
Source File: actions.ts    From orangehrm-os-mobile with GNU General Public License v3.0 5 votes vote down vote up
fetchLeaveTypesFinished = (
  leaveTypes: $PropertyType<FetchLeaveTypesFinishedAction, 'leaveTypes'>,
): FetchLeaveTypesFinishedAction => ({
  type: FETCH_LEAVE_TYPES_FINISHED,
  leaveTypes,
})
Example #16
Source File: actions.ts    From orangehrm-os-mobile with GNU General Public License v3.0 5 votes vote down vote up
fetchAttendanceRecordsFinished = (
  payload?: $PropertyType<FetchAttendanceRecordsFinishedAction, 'payload'>,
  error: boolean = false,
): FetchAttendanceRecordsFinishedAction => ({
  type: FETCH_ATTENDANCE_RECORDS_FINISHED,
  payload,
  error,
})
Example #17
Source File: actions.ts    From orangehrm-os-mobile with GNU General Public License v3.0 5 votes vote down vote up
fetchLeaveRecords = (
  payload: $PropertyType<FetchLeaveRecordsAction, 'payload'>,
): FetchLeaveRecordsAction => ({
  type: FETCH_LEAVE_RECORDS,
  payload,
})
Example #18
Source File: actions.ts    From orangehrm-os-mobile with GNU General Public License v3.0 5 votes vote down vote up
fetchAttendanceGraphRecords = (
  payload: $PropertyType<FetchAttendanceGraphRecordsAction, 'payload'>,
): FetchAttendanceGraphRecordsAction => ({
  type: FETCH_ATTENDANCE_GRAPH_RECORDS,
  payload,
})
Example #19
Source File: actions.ts    From orangehrm-os-mobile with GNU General Public License v3.0 5 votes vote down vote up
fetchHolidays = (
  payload: $PropertyType<FetchHolidaysAction, 'payload'>,
): FetchHolidaysAction => ({
  type: FETCH_HOLIDAYS,
  payload,
})
Example #20
Source File: actions.ts    From orangehrm-os-mobile with GNU General Public License v3.0 5 votes vote down vote up
fetchEmployeeAttendanceList = (
  payload: $PropertyType<FetchEmployeeAttendanceListAction, 'payload'>,
): FetchEmployeeAttendanceListAction => ({
  type: FETCH_EMPLOYEE_ATTENDANCE_LIST,
  payload,
})
Example #21
Source File: actions.ts    From orangehrm-os-mobile with GNU General Public License v3.0 5 votes vote down vote up
fetchSubordinatesFinished = (
  payload?: $PropertyType<FetchSubordinatesFinishedAction, 'payload'>,
  error: boolean = false,
): FetchSubordinatesFinishedAction => ({
  type: FETCH_SUBORDINATES_FINISHED,
  payload,
  error,
})
Example #22
Source File: actions.ts    From orangehrm-os-mobile with GNU General Public License v3.0 5 votes vote down vote up
pickSubordinate = (
  subordinate?: $PropertyType<PickSubordinateAction, 'subordinate'>,
): PickSubordinateAction => ({
  type: PICK_SUBORDINATE,
  subordinate,
})
Example #23
Source File: actions.ts    From orangehrm-os-mobile with GNU General Public License v3.0 5 votes vote down vote up
savePunchInRequest = (
  payload: $PropertyType<PunchInRequestAction, 'payload'>,
): PunchInRequestAction => ({
  type: PUNCH_IN_REQUEST,
  payload,
})
Example #24
Source File: actions.ts    From orangehrm-os-mobile with GNU General Public License v3.0 5 votes vote down vote up
savePunchOutRequest = (
  payload: $PropertyType<PunchOutRequestAction, 'payload'>,
): PunchOutRequestAction => ({
  type: PUNCH_OUT_REQUEST,
  payload,
})
Example #25
Source File: Globals.tsx    From orangehrm-os-mobile with GNU General Public License v3.0 5 votes vote down vote up
Globals = () => {
  const [toastShow, setToastShow] = useState(false);
  const {loader, snackMessage, closeSnackMessage} = useGlobals();
  const theme = useTheme();
  useEffect(() => {
    if (!toastShow) {
      if (snackMessage.open) {
        setTimeout(() => {
          closeSnackMessage();
          setToastShow(false);
        }, 5000);
        setToastShow(true);
      }
    }
  }, [toastShow, snackMessage, closeSnackMessage]);
  return (
    <>
      <Overlay modalProps={{visible: loader.open}}>{loader.content}</Overlay>
      <SnackDialog
        isVisible={snackMessage.open}
        closeSnackMessage={closeSnackMessage}
        viewProps={{
          style: snackMessage.type
            ? {backgroundColor: theme.palette[snackMessage.type]}
            : undefined,
        }}>
        <TouchableOpacity
          activeOpacity={0.7}
          onPress={() => {
            closeSnackMessage();
            setToastShow(false);
          }}>
          <View style={[styles.snackView, {padding: theme.spacing * 4}]}>
            {snackMessage.type ? (
              <View style={styles.iconView}>
                <Icon
                  name={ICON_MAP[snackMessage.type].name}
                  type={
                    ICON_MAP[snackMessage.type].type as $PropertyType<
                      IconProps,
                      'type'
                    >
                  }
                  style={{color: theme.typography.lightColor}}
                />
              </View>
            ) : null}
            <View
              style={{
                paddingLeft: theme.spacing * 3,
                paddingRight: theme.spacing * 5,
                paddingTop: theme.spacing * 0.5,
              }}>
              <Text
                style={{
                  color: theme.typography.lightColor,
                }}>
                {snackMessage.message}
              </Text>
            </View>
          </View>
        </TouchableOpacity>
      </SnackDialog>
    </>
  );
}
Example #26
Source File: actions.ts    From orangehrm-os-mobile with GNU General Public License v3.0 5 votes vote down vote up
myInfoFailed = (
  state: $PropertyType<MyInfoFailedAction, 'state'>,
  error?: $PropertyType<MyInfoFailedAction, 'error'>,
): MyInfoFailedAction => ({
  type: MY_INFO_FAILED,
  state,
  error,
})
Example #27
Source File: selectors.ts    From orangehrm-os-mobile with GNU General Public License v3.0 5 votes vote down vote up
selectMyInfoFailed = createSelector<
  RootState,
  AuthState,
  $PropertyType<AuthState, 'myInfoFailed'>
>([selectAuth], (auth) => auth.myInfoFailed)
Example #28
Source File: selectors.ts    From orangehrm-os-mobile with GNU General Public License v3.0 5 votes vote down vote up
selectMyInfoError = createSelector<
  RootState,
  AuthState,
  $PropertyType<AuthState, 'myInfoError'>
>([selectAuth], (auth) => auth.myInfoError)
Example #29
Source File: actions.ts    From orangehrm-os-mobile with GNU General Public License v3.0 5 votes vote down vote up
fetchConfigHelp = (
  payload: $PropertyType<FetchHelpConfigAction, 'payload'>,
): FetchHelpConfigAction => ({
  type: FETCH_HELP_CONFIG,
  payload,
})