Skip to content

Commit

Permalink
add select disable option to the oxd lists
Browse files Browse the repository at this point in the history
  • Loading branch information
shachiniM committed Nov 22, 2024
1 parent 2954cba commit 1217ef9
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 4 deletions.
19 changes: 18 additions & 1 deletion components/src/core/components/CardTable/Cell/Checkbox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
v-model="checkState"
:value="item"
:disabled="isDisabled"
:disabled-tooltip="disabledTooltip"
:tooltip-position="tooltipPosition"
@click="onClickCheckbox(item, $event)"
/>
</template>
Expand All @@ -18,6 +20,7 @@ import emitter from '../../../../utils/emitter';
import {defineComponent, inject, computed, onBeforeUnmount} from 'vue';
import Skeleton from '@orangehrm/oxd/core/components/Skeleton/Skeleton.vue';
import CheckboxInput from '@orangehrm/oxd/core/components/Input/CheckboxInput.vue';
import {TOP} from '@orangehrm/oxd/core/components/Input/types';
export default defineComponent({
name: 'oxd-table-cell-checkbox',
Expand Down Expand Up @@ -59,7 +62,19 @@ export default defineComponent({
tableProps?.disabled === undefined
? false
: Boolean(tableProps?.disabled);
return isTableDisabled ? isTableDisabled : isRowDisabled;
const isSelectDisabled = Boolean(props.rowItem?.isSelectDisabled);
return isTableDisabled || isRowDisabled || isSelectDisabled;
});
const tooltipPosition = computed(() => {
return props.rowItem?.selectDisabledTooltipPosition
? props.rowItem?.selectDisabledTooltipPosition
: TOP;
});
const disabledTooltip = computed(() => {
return props.rowItem?.isSelectDisabled
? props.rowItem?.selectDisabledTooltip ?? null
: null;
});
const isSelectable = computed(() => {
Expand Down Expand Up @@ -92,6 +107,8 @@ export default defineComponent({
checkState,
isDisabled,
isSelectable,
tooltipPosition,
disabledTooltip,
};
},
methods: {
Expand Down
27 changes: 25 additions & 2 deletions components/src/core/components/Input/CheckboxInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,13 @@
v-bind="$attrs"
v-model="checked"
/>
<span :class="classes" :style="style" class="oxd-checkbox-input">
<span
:class="classes"
:style="style"
class="oxd-checkbox-input"
:tooltip="disabledTooltip"
:flow="tooltipPosition"
>
<oxd-icon
class="oxd-checkbox-input-icon"
:name="checkIcon"
Expand Down Expand Up @@ -65,7 +71,13 @@

<script lang="ts">
import {defineComponent} from 'vue';
import {Position, LABEL_POSITIONS, RIGHT} from './types';
import {
Position,
LABEL_POSITIONS,
RIGHT,
TOP,
TOOLTIP_POSITIONS,
} from './types';
import Icon from '@orangehrm/oxd/core/components/Icon/Icon.vue';
export interface State {
Expand Down Expand Up @@ -147,6 +159,17 @@ export default defineComponent({
type: Boolean,
default: false,
},
disabledTooltip: {
type: String,
default: null,
},
tooltipPosition: {
type: String,
default: TOP,
validator: (value: Position) => {
return TOOLTIP_POSITIONS.indexOf(value) !== 1;
},
},
},
emits: ['update:modelValue', 'blur', 'focus', 'change'],
Expand Down
1 change: 1 addition & 0 deletions components/src/core/components/Input/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export const RIGHT = 'right';
export const TOP = 'top';
export const BOTTOM = 'bottom';
export const LABEL_POSITIONS = [LEFT, RIGHT];
export const TOOLTIP_POSITIONS = [TOP, BOTTOM, LEFT, RIGHT];
export const DROPDOWN_POSITIONS = [TOP, BOTTOM, LEFT, RIGHT];
export type Position = typeof LEFT | typeof RIGHT | typeof TOP | typeof BOTTOM;

Expand Down
4 changes: 3 additions & 1 deletion storybook/stories/core/components/List/list-data.json
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,9 @@
"compareSlot": true
},
"vacancy": null,
"vacancyId": null
"vacancyId": null,
"isSelectDisabled" : true,
"selectDisabledTooltip": "Cannot delete candidates in progress."
},
{
"profilePic": "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAMCAgICAgMCAgIDAwMDBAYEBAQEBAgGBgUGCQgKCgkICQkKDA8MCgsOCwkJDRENDg8QEBEQCgwSExIQEw8QEBD/2wBDAQMDAwQDBAgEBAgQCwkLEBAQEBAQEBA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