@citizenplane/pimp 9.5.11 → 9.5.13
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/dist/pimp.es.js +3876 -3869
- package/dist/pimp.umd.js +18 -18
- package/package.json +1 -1
- package/src/components/CpCalendar.vue +19 -24
- package/src/components/CpCheckbox.vue +7 -9
- package/src/components/CpDate.vue +13 -13
- package/src/components/CpDatepicker.vue +18 -18
- package/src/components/CpInput.vue +10 -10
- package/src/components/CpRadio.vue +8 -8
- package/src/components/CpSelect.vue +9 -13
- package/src/components/CpSwitch.vue +8 -10
- package/src/components/CpTable.vue +13 -14
- package/src/components/CpTextarea.vue +6 -6
- package/src/components/CpToaster.vue +6 -12
- package/src/components/icons/IconWindowExpand.vue +17 -0
- package/src/constants/CpCustomIcons.ts +2 -0
- package/src/helpers/index.ts +0 -4
- package/src/libs/CoreDatepicker.vue +11 -11
package/package.json
CHANGED
|
@@ -2,32 +2,32 @@
|
|
|
2
2
|
<div class="cpCalendar">
|
|
3
3
|
<cp-input
|
|
4
4
|
:id="triggerElementId"
|
|
5
|
-
|
|
6
|
-
:model-value="humanDateFormat(dateOne, dateTwo)"
|
|
7
|
-
placeholder="Select a date"
|
|
8
|
-
:is-invalid="isError"
|
|
9
|
-
:error-message="errorMessage"
|
|
5
|
+
class="cpCalendar__input"
|
|
10
6
|
:disabled="isDisabled"
|
|
7
|
+
:error-message="errorMessage"
|
|
8
|
+
:is-invalid="isError"
|
|
11
9
|
:label="label"
|
|
12
|
-
|
|
10
|
+
:model-value="humanDateFormat(dateOne, dateTwo)"
|
|
11
|
+
placeholder="Select a date"
|
|
12
|
+
type="text"
|
|
13
13
|
/>
|
|
14
14
|
<core-datepicker
|
|
15
|
-
|
|
16
|
-
:
|
|
17
|
-
:customized-dates="[{ cssClass: 'recurency', dates: datesToStringArray(recurenceDates) }]"
|
|
18
|
-
:trigger-element-id="triggerElementId"
|
|
19
|
-
:mode="mode"
|
|
15
|
+
class="cpCalendar__datepicker"
|
|
16
|
+
:class="dynamicClasses"
|
|
20
17
|
:close-after-select="closeAfterSelect"
|
|
21
18
|
:close-calendar="triggerCalendar"
|
|
19
|
+
:customized-dates="[{ cssClass: 'recurency', dates: datesToStringArray(recurenceDates) }]"
|
|
20
|
+
:date-one="dateOne"
|
|
21
|
+
:date-two="dateTwo"
|
|
22
22
|
:inline="isInline"
|
|
23
23
|
:locale="locale"
|
|
24
|
-
|
|
25
|
-
:
|
|
24
|
+
:mode="mode"
|
|
25
|
+
:trigger-element-id="triggerElementId"
|
|
26
|
+
@closed="() => (isDisabled = false)"
|
|
26
27
|
@date-one-selected="onDateSelected('dateOne', $event)"
|
|
27
28
|
@date-two-selected="onDateSelected('dateTwo', $event)"
|
|
28
29
|
@is-inline="onIsInline"
|
|
29
30
|
@opened="() => (isDisabled = true)"
|
|
30
|
-
@closed="() => (isDisabled = false)"
|
|
31
31
|
>
|
|
32
32
|
<div v-if="!isInline" class="footer-container">
|
|
33
33
|
<transition-group name="fade">
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
@click="toggleDay(value)"
|
|
43
43
|
>
|
|
44
44
|
<div class="checkbox">
|
|
45
|
-
<transition
|
|
45
|
+
<transition mode="out-in" name="fade">
|
|
46
46
|
<div v-if="!selected" class="checkbox--border" />
|
|
47
47
|
<cp-icon v-else type="check" />
|
|
48
48
|
</transition>
|
|
@@ -64,16 +64,11 @@
|
|
|
64
64
|
</div>
|
|
65
65
|
</div>
|
|
66
66
|
<div key="action" class="asd__recurency--action">
|
|
67
|
-
<cp-button
|
|
68
|
-
class="asd__button-switch"
|
|
69
|
-
size="mini"
|
|
70
|
-
@click.stop="isDaysDisplayed ? removeRecurency() : addRecurency()"
|
|
71
|
-
>
|
|
67
|
+
<cp-button class="asd__button-switch" @click.stop="isDaysDisplayed ? removeRecurency() : addRecurency()">
|
|
72
68
|
{{ isDaysDisplayed ? 'Remove recurency' : 'Add recurency' }}
|
|
73
69
|
</cp-button>
|
|
74
70
|
<cp-button
|
|
75
71
|
class="asd__button-done"
|
|
76
|
-
size="mini"
|
|
77
72
|
:disabled="(isDaysDisplayed && !recurenceDates.length) || !dateOne"
|
|
78
73
|
@click.stop="done"
|
|
79
74
|
>
|
|
@@ -88,13 +83,13 @@
|
|
|
88
83
|
|
|
89
84
|
<script setup lang="ts">
|
|
90
85
|
import { DateTime, Info, Interval } from 'luxon'
|
|
91
|
-
import { ref, computed, watch } from 'vue'
|
|
86
|
+
import { ref, computed, watch, useId } from 'vue'
|
|
92
87
|
|
|
93
88
|
import CpButton from '@/components/CpButton.vue'
|
|
94
89
|
import CpIcon from '@/components/CpIcon.vue'
|
|
95
90
|
import CpInput from '@/components/CpInput.vue'
|
|
96
91
|
|
|
97
|
-
import {
|
|
92
|
+
import { formatDates } from '@/helpers'
|
|
98
93
|
import CoreDatepicker from '@/libs/CoreDatepicker.vue'
|
|
99
94
|
|
|
100
95
|
interface DayOption {
|
|
@@ -118,7 +113,7 @@ interface Emits {
|
|
|
118
113
|
}
|
|
119
114
|
|
|
120
115
|
const props = withDefaults(defineProps<Props>(), {
|
|
121
|
-
triggerElementId: () => `calendar-trigger-${
|
|
116
|
+
triggerElementId: () => `calendar-trigger-${useId()}`,
|
|
122
117
|
closeAfterSelect: false,
|
|
123
118
|
label: '',
|
|
124
119
|
isError: false,
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<label
|
|
2
|
+
<label class="cpCheckbox" :class="computedClasses" :for="checkboxUniqueId">
|
|
3
3
|
<div class="cpCheckbox__wrapper">
|
|
4
4
|
<input
|
|
5
5
|
:id="checkboxUniqueId"
|
|
6
6
|
v-model="isChecked"
|
|
7
|
-
:
|
|
7
|
+
:autofocus="autofocus"
|
|
8
8
|
:disabled="isDisabled"
|
|
9
|
-
type="checkbox"
|
|
10
9
|
:name="groupName"
|
|
11
|
-
|
|
10
|
+
type="checkbox"
|
|
11
|
+
:value="checkboxValue"
|
|
12
12
|
@change="onChange(checkboxValue)"
|
|
13
13
|
/>
|
|
14
14
|
<cp-icon type="check" />
|
|
@@ -27,10 +27,10 @@
|
|
|
27
27
|
</template>
|
|
28
28
|
|
|
29
29
|
<script setup lang="ts">
|
|
30
|
-
import { computed, ref,
|
|
30
|
+
import { computed, ref, useSlots, useId } from 'vue'
|
|
31
31
|
|
|
32
32
|
import { ToggleColors } from '@/constants'
|
|
33
|
-
import { capitalizeFirstLetter
|
|
33
|
+
import { capitalizeFirstLetter } from '@/helpers'
|
|
34
34
|
|
|
35
35
|
interface Props {
|
|
36
36
|
autofocus?: boolean
|
|
@@ -62,7 +62,7 @@ const props = withDefaults(defineProps<Props>(), {
|
|
|
62
62
|
const emit = defineEmits(['update:modelValue'])
|
|
63
63
|
|
|
64
64
|
const checkedProxy = ref(false)
|
|
65
|
-
const checkboxUniqueId =
|
|
65
|
+
const checkboxUniqueId = useId()
|
|
66
66
|
|
|
67
67
|
const isChecked = computed({
|
|
68
68
|
get() {
|
|
@@ -98,8 +98,6 @@ const labelComputedClasses = computed(() => {
|
|
|
98
98
|
return { 'cpCheckbox__label--isCapitalized': props.capitalizeLabel }
|
|
99
99
|
})
|
|
100
100
|
|
|
101
|
-
onMounted(() => (checkboxUniqueId.value = randomString()))
|
|
102
|
-
|
|
103
101
|
const onChange = (value: string | number) => {
|
|
104
102
|
if (Array.isArray(props.modelValue)) {
|
|
105
103
|
const currentValues = [...props.modelValue]
|
|
@@ -7,23 +7,23 @@
|
|
|
7
7
|
<input
|
|
8
8
|
v-model="day"
|
|
9
9
|
v-maska
|
|
10
|
-
|
|
11
|
-
:placeholder="dayInputPlaceholder"
|
|
10
|
+
:autocomplete="autocompleteFields.day"
|
|
12
11
|
class="cpDate__day"
|
|
12
|
+
data-maska="##"
|
|
13
|
+
:disabled="disabled"
|
|
13
14
|
inputmode="numeric"
|
|
14
15
|
maxlength="2"
|
|
16
|
+
:placeholder="dayInputPlaceholder"
|
|
15
17
|
:required="required"
|
|
16
|
-
:disabled="disabled"
|
|
17
|
-
:autocomplete="autocompleteFields.day"
|
|
18
18
|
/>
|
|
19
19
|
<div class="cpDate__divider" />
|
|
20
20
|
<div class="cpDate__month" :class="selectDynamicClass">
|
|
21
21
|
<select
|
|
22
22
|
:id="cpDateId"
|
|
23
23
|
v-model="month"
|
|
24
|
-
:required="required"
|
|
25
|
-
:disabled="disabled"
|
|
26
24
|
:autocomplete="autocompleteFields.month"
|
|
25
|
+
:disabled="disabled"
|
|
26
|
+
:required="required"
|
|
27
27
|
>
|
|
28
28
|
<option value>{{ monthInputPlaceholder }}</option>
|
|
29
29
|
<option v-for="(monthItem, index) in months" :key="index" :value="monthItem.value">
|
|
@@ -35,14 +35,14 @@
|
|
|
35
35
|
<input
|
|
36
36
|
v-model="year"
|
|
37
37
|
v-maska
|
|
38
|
-
|
|
39
|
-
:placeholder="yearInputPlaceholder"
|
|
38
|
+
:autocomplete="autocompleteFields.year"
|
|
40
39
|
class="cpDate__year"
|
|
40
|
+
data-maska="####"
|
|
41
|
+
:disabled="disabled"
|
|
41
42
|
inputmode="numeric"
|
|
42
43
|
maxlength="4"
|
|
43
|
-
:
|
|
44
|
+
:placeholder="yearInputPlaceholder"
|
|
44
45
|
:required="required"
|
|
45
|
-
:autocomplete="autocompleteFields.year"
|
|
46
46
|
/>
|
|
47
47
|
</div>
|
|
48
48
|
<transition-expand>
|
|
@@ -53,12 +53,12 @@
|
|
|
53
53
|
|
|
54
54
|
<script setup lang="ts">
|
|
55
55
|
import { Info, DateTime } from 'luxon'
|
|
56
|
-
import { ref, computed, watch } from 'vue'
|
|
56
|
+
import { ref, computed, watch, useId } from 'vue'
|
|
57
57
|
|
|
58
58
|
import BaseInputLabel from '@/components/BaseInputLabel.vue'
|
|
59
59
|
|
|
60
60
|
import { HUMAN_MAX_AGE } from '@/constants'
|
|
61
|
-
import {
|
|
61
|
+
import { capitalizeFirstLetter } from '@/helpers'
|
|
62
62
|
|
|
63
63
|
interface Emits {
|
|
64
64
|
(e: 'update:modelValue', value: string): void
|
|
@@ -116,7 +116,7 @@ const year = ref(initDateToken('year'))
|
|
|
116
116
|
|
|
117
117
|
const capitalizedLabel = computed(() => capitalizeFirstLetter(props.label))
|
|
118
118
|
|
|
119
|
-
const cpDateId =
|
|
119
|
+
const cpDateId = useId()
|
|
120
120
|
|
|
121
121
|
const minYear = computed(() => isoMinDate.value.year)
|
|
122
122
|
|
|
@@ -3,43 +3,43 @@
|
|
|
3
3
|
<cp-input
|
|
4
4
|
v-show="!isInline"
|
|
5
5
|
:id="datePickerReferenceId"
|
|
6
|
-
|
|
7
|
-
type="text"
|
|
8
|
-
:placeholder="placeholder"
|
|
9
|
-
:is-invalid="isError"
|
|
10
|
-
:error-message="errorMessage"
|
|
6
|
+
class="cpDatepicker__input"
|
|
11
7
|
:disabled="isDisabled"
|
|
8
|
+
:error-message="errorMessage"
|
|
9
|
+
:is-invalid="isError"
|
|
12
10
|
:label="label"
|
|
13
|
-
|
|
11
|
+
:model-value="inputComputedValue"
|
|
12
|
+
:placeholder="placeholder"
|
|
13
|
+
type="text"
|
|
14
14
|
/>
|
|
15
15
|
<core-datepicker
|
|
16
|
+
class="cpDatepicker__datepicker"
|
|
17
|
+
:class="{ 'cpDatepicker__datepicker--isInline': isInline }"
|
|
18
|
+
:close-after-select="closeAfterSelect"
|
|
16
19
|
:date-one="dateOne"
|
|
17
20
|
:date-two="dateTwo"
|
|
18
|
-
:trigger-element-id="datePickerReferenceId"
|
|
19
|
-
:close-after-select="closeAfterSelect"
|
|
20
|
-
:mode="mode"
|
|
21
21
|
:inline="isInline"
|
|
22
|
-
:months-to-show="numberOfMonths"
|
|
23
|
-
:min-date="computedMinDate"
|
|
24
|
-
:max-date="maxDate"
|
|
25
22
|
:locale="locale"
|
|
26
|
-
|
|
27
|
-
:
|
|
23
|
+
:max-date="maxDate"
|
|
24
|
+
:min-date="computedMinDate"
|
|
25
|
+
:mode="mode"
|
|
26
|
+
:months-to-show="numberOfMonths"
|
|
27
|
+
:trigger-element-id="datePickerReferenceId"
|
|
28
|
+
@closed="() => (isDisabled = false)"
|
|
28
29
|
@date-one-selected="onDateOneSelected"
|
|
29
30
|
@date-two-selected="onDateTwoSelected"
|
|
30
31
|
@opened="() => (isDisabled = true)"
|
|
31
|
-
@closed="() => (isDisabled = false)"
|
|
32
32
|
/>
|
|
33
33
|
</div>
|
|
34
34
|
</template>
|
|
35
35
|
|
|
36
36
|
<script setup lang="ts">
|
|
37
37
|
import { DateTime } from 'luxon'
|
|
38
|
-
import { ref, computed, watch } from 'vue'
|
|
38
|
+
import { ref, computed, watch, useId } from 'vue'
|
|
39
39
|
|
|
40
40
|
import CpInput from '@/components/CpInput.vue'
|
|
41
41
|
|
|
42
|
-
import {
|
|
42
|
+
import { formatDates } from '@/helpers'
|
|
43
43
|
import CoreDatepicker from '@/libs/CoreDatepicker.vue'
|
|
44
44
|
|
|
45
45
|
type DatepickerMode = 'range' | 'single'
|
|
@@ -93,7 +93,7 @@ const humanFormat = 'EEE DD'
|
|
|
93
93
|
const dateOne = ref(props.initDateOne || '')
|
|
94
94
|
const dateTwo = ref(props.mode === 'range' ? props.initDateTwo : '')
|
|
95
95
|
const isDisabled = ref(false)
|
|
96
|
-
const datePickerReferenceId = ref(props.triggerElementId ||
|
|
96
|
+
const datePickerReferenceId = ref(props.triggerElementId || useId())
|
|
97
97
|
|
|
98
98
|
const inputComputedValue = computed(() => {
|
|
99
99
|
if (props.inputValue) return props.inputValue
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div
|
|
2
|
+
<div :aria-disabled="isDisabled" class="cpInput" :class="dynamicClasses" @click="focusOnInput">
|
|
3
3
|
<base-input-label
|
|
4
4
|
v-if="label"
|
|
5
5
|
v-bind-once="{ for: inputIdentifier }"
|
|
6
6
|
:is-invalid="isInputInvalid"
|
|
7
|
-
:tooltip="tooltip"
|
|
8
7
|
:required="isRequired"
|
|
8
|
+
:tooltip="tooltip"
|
|
9
9
|
>
|
|
10
10
|
{{ capitalizedLabel }}
|
|
11
11
|
</base-input-label>
|
|
12
12
|
<div
|
|
13
13
|
ref="cpInputContainer"
|
|
14
|
-
:class="{ 'cpInput__container--hasBeforeIcon': hasBeforeIcon }"
|
|
15
14
|
class="cpInput__container"
|
|
15
|
+
:class="{ 'cpInput__container--hasBeforeIcon': hasBeforeIcon }"
|
|
16
16
|
>
|
|
17
17
|
<div v-if="hasBeforeIcon" class="cpInput__icon cpInput__icon--isBefore">
|
|
18
18
|
<cp-icon v-if="isSearch" type="search" />
|
|
@@ -22,18 +22,18 @@
|
|
|
22
22
|
v-model="inputModel"
|
|
23
23
|
v-bind-once="{ id: inputIdentifier }"
|
|
24
24
|
v-maska
|
|
25
|
-
:data-maska="mask"
|
|
26
25
|
v-bind="restAttributes"
|
|
27
|
-
:disabled="isDisabled"
|
|
28
|
-
:aria-invalid="isInputInvalid"
|
|
29
26
|
:aria-describedby="inputDescribedByAttribute"
|
|
27
|
+
:aria-invalid="isInputInvalid"
|
|
30
28
|
class="cpInput__inner"
|
|
29
|
+
:data-maska="mask"
|
|
30
|
+
:disabled="isDisabled"
|
|
31
31
|
/>
|
|
32
32
|
<div v-if="hasAfterIcon" class="cpInput__icon cpInput__icon--isAfter">
|
|
33
33
|
<slot v-if="displayAfterIcon" name="trailing-icon" />
|
|
34
34
|
<transition name="fade">
|
|
35
|
-
<button v-if="isClearButtonVisible"
|
|
36
|
-
<cp-icon
|
|
35
|
+
<button v-if="isClearButtonVisible" class="cpInput__clear" type="button" @click="clearInputValue">
|
|
36
|
+
<cp-icon class="cpInput__clearIcon" type="x" />
|
|
37
37
|
</button>
|
|
38
38
|
</transition>
|
|
39
39
|
</div>
|
|
@@ -55,7 +55,7 @@ import { ref, useAttrs, useSlots, computed, nextTick, onMounted, useId } from 'v
|
|
|
55
55
|
import BaseInputLabel from '@/components/BaseInputLabel.vue'
|
|
56
56
|
|
|
57
57
|
import { Sizes } from '@/constants'
|
|
58
|
-
import {
|
|
58
|
+
import { capitalizeFirstLetter } from '@/helpers'
|
|
59
59
|
|
|
60
60
|
interface Emits {
|
|
61
61
|
(e: 'update:modelValue', value: string | number | boolean): void
|
|
@@ -99,7 +99,7 @@ const attrs = useAttrs()
|
|
|
99
99
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
100
100
|
const { ['class']: value, id, ...restAttributes } = attrs
|
|
101
101
|
|
|
102
|
-
const inputIdentifier = ref(id ||
|
|
102
|
+
const inputIdentifier = ref(id || useId())
|
|
103
103
|
|
|
104
104
|
const helpMessageId = useId()
|
|
105
105
|
const errorMessageId = useId()
|
|
@@ -3,18 +3,18 @@
|
|
|
3
3
|
<label
|
|
4
4
|
v-for="({ label, value, description, additionalData, disabled }, index) in options"
|
|
5
5
|
:key="getRadioId(index)"
|
|
6
|
-
:class="computedClasses({ value, disabled })"
|
|
7
6
|
class="cpRadio"
|
|
7
|
+
:class="computedClasses({ value, disabled })"
|
|
8
8
|
:for="getRadioId(index)"
|
|
9
9
|
>
|
|
10
10
|
<input
|
|
11
11
|
:id="getRadioId(index)"
|
|
12
|
+
:autofocus="autofocus"
|
|
12
13
|
:checked="isActive(value)"
|
|
13
|
-
:value="value"
|
|
14
14
|
:disabled="disabled"
|
|
15
|
-
type="radio"
|
|
16
|
-
:autofocus="autofocus"
|
|
17
15
|
:name="groupName"
|
|
16
|
+
type="radio"
|
|
17
|
+
:value="value"
|
|
18
18
|
@input="onChange(value)"
|
|
19
19
|
/>
|
|
20
20
|
<span class="cpRadio__content">
|
|
@@ -29,10 +29,10 @@
|
|
|
29
29
|
</template>
|
|
30
30
|
|
|
31
31
|
<script setup lang="ts">
|
|
32
|
-
import {
|
|
32
|
+
import { useId } from 'vue'
|
|
33
33
|
|
|
34
34
|
import { ToggleColors } from '@/constants'
|
|
35
|
-
import { capitalizeFirstLetter
|
|
35
|
+
import { capitalizeFirstLetter } from '@/helpers'
|
|
36
36
|
|
|
37
37
|
interface RadioOption {
|
|
38
38
|
additionalData?: string
|
|
@@ -62,11 +62,11 @@ const props = withDefaults(defineProps<Props>(), {
|
|
|
62
62
|
|
|
63
63
|
const emit = defineEmits<Emits>()
|
|
64
64
|
|
|
65
|
-
const radioUniqueId =
|
|
65
|
+
const radioUniqueId = useId()
|
|
66
66
|
|
|
67
67
|
const onChange = (value: string): void => emit('update:modelValue', value)
|
|
68
68
|
|
|
69
|
-
const getRadioId = (index: number): string => `${radioUniqueId
|
|
69
|
+
const getRadioId = (index: number): string => `${radioUniqueId}${index}`
|
|
70
70
|
|
|
71
71
|
const isActive = (value: string): boolean => value === props.modelValue
|
|
72
72
|
|
|
@@ -2,23 +2,23 @@
|
|
|
2
2
|
<div class="cpSelect" :class="dynamicClasses">
|
|
3
3
|
<base-input-label
|
|
4
4
|
v-if="label"
|
|
5
|
+
class="cpSelect__label"
|
|
5
6
|
:for="selectReferenceId"
|
|
6
|
-
:tooltip="tooltip"
|
|
7
7
|
:is-invalid="isInvalid"
|
|
8
8
|
:required="required"
|
|
9
|
-
|
|
9
|
+
:tooltip="tooltip"
|
|
10
10
|
>
|
|
11
11
|
{{ capitalizedLabel }}
|
|
12
12
|
</base-input-label>
|
|
13
13
|
<div class="cpSelect__container">
|
|
14
14
|
<select
|
|
15
15
|
:id="selectReferenceId"
|
|
16
|
-
:value="modelValue"
|
|
17
|
-
:disabled="disabled"
|
|
18
|
-
:required="required"
|
|
19
16
|
:autocomplete="autocomplete"
|
|
20
|
-
:name="name"
|
|
21
17
|
class="cpSelect__inner"
|
|
18
|
+
:disabled="disabled"
|
|
19
|
+
:name="name"
|
|
20
|
+
:required="required"
|
|
21
|
+
:value="modelValue"
|
|
22
22
|
@input="handleChange"
|
|
23
23
|
>
|
|
24
24
|
<option :disabled="hideDefaultValue" value="">{{ defaultValue }}</option>
|
|
@@ -37,13 +37,13 @@
|
|
|
37
37
|
</template>
|
|
38
38
|
|
|
39
39
|
<script setup lang="ts">
|
|
40
|
-
import {
|
|
40
|
+
import { computed, useId } from 'vue'
|
|
41
41
|
|
|
42
42
|
import BaseInputLabel from '@/components/BaseInputLabel.vue'
|
|
43
43
|
import TransitionExpand from '@/components/TransitionExpand.vue'
|
|
44
44
|
|
|
45
45
|
import { Sizes } from '@/constants'
|
|
46
|
-
import {
|
|
46
|
+
import { capitalizeFirstLetter } from '@/helpers'
|
|
47
47
|
|
|
48
48
|
interface Emits {
|
|
49
49
|
(e: 'update:modelValue', value: string): void
|
|
@@ -89,7 +89,7 @@ const props = withDefaults(defineProps<Props>(), {
|
|
|
89
89
|
|
|
90
90
|
const emit = defineEmits<Emits>()
|
|
91
91
|
|
|
92
|
-
const selectReferenceId =
|
|
92
|
+
const selectReferenceId = useId()
|
|
93
93
|
|
|
94
94
|
const helpMessageId = useId()
|
|
95
95
|
const errorMessageId = useId()
|
|
@@ -115,10 +115,6 @@ const handleChange = (e: Event): void => {
|
|
|
115
115
|
const target = e.target as HTMLSelectElement
|
|
116
116
|
emit('update:modelValue', target.value)
|
|
117
117
|
}
|
|
118
|
-
|
|
119
|
-
onMounted(() => {
|
|
120
|
-
selectReferenceId.value = randomString()
|
|
121
|
-
})
|
|
122
118
|
</script>
|
|
123
119
|
|
|
124
120
|
<style lang="scss">
|
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
<span class="cpSwitch__switch">
|
|
4
4
|
<input
|
|
5
5
|
:id="switchUniqueId"
|
|
6
|
-
:
|
|
6
|
+
:autofocus="autofocus"
|
|
7
7
|
:checked="modelValue"
|
|
8
|
-
:
|
|
9
|
-
type="checkbox"
|
|
8
|
+
:disabled="disabled"
|
|
10
9
|
:name="groupName"
|
|
11
|
-
|
|
10
|
+
type="checkbox"
|
|
11
|
+
:value="modelValue"
|
|
12
12
|
@change="handleClick(modelValue)"
|
|
13
13
|
/>
|
|
14
14
|
<span class="cpSwitch__knobContainer">
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
<span v-if="label" class="cpSwitch__label">{{ label }}</span>
|
|
21
21
|
<span v-if="isRequired" class="u-asterisk">*</span>
|
|
22
22
|
<cp-tooltip v-if="tooltip" :content="tooltip">
|
|
23
|
-
<cp-icon
|
|
23
|
+
<cp-icon class="cpSwitch__tooltip" size="16" type="tooltip" />
|
|
24
24
|
</cp-tooltip>
|
|
25
25
|
</div>
|
|
26
26
|
<span v-if="helper" class="cpSwitch__helper">{{ helper }}</span>
|
|
@@ -29,12 +29,12 @@
|
|
|
29
29
|
</template>
|
|
30
30
|
|
|
31
31
|
<script setup lang="ts">
|
|
32
|
-
import {
|
|
32
|
+
import { computed, useId } from 'vue'
|
|
33
33
|
|
|
34
34
|
import CpTooltip from '@/components/CpTooltip.vue'
|
|
35
35
|
|
|
36
36
|
import { ToggleColors } from '@/constants'
|
|
37
|
-
import { capitalizeFirstLetter
|
|
37
|
+
import { capitalizeFirstLetter } from '@/helpers'
|
|
38
38
|
|
|
39
39
|
interface Props {
|
|
40
40
|
autofocus?: boolean
|
|
@@ -68,9 +68,7 @@ const props = withDefaults(defineProps<Props>(), {
|
|
|
68
68
|
|
|
69
69
|
const emit = defineEmits<Emits>()
|
|
70
70
|
|
|
71
|
-
const switchUniqueId =
|
|
72
|
-
|
|
73
|
-
switchUniqueId.value = randomString()
|
|
71
|
+
const switchUniqueId = useId()
|
|
74
72
|
|
|
75
73
|
const capitalizedColor = computed(() => {
|
|
76
74
|
return capitalizeFirstLetter(props.color)
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
<div class="cpTable" :class="mainClasses">
|
|
3
3
|
<div
|
|
4
4
|
ref="cpTableContainer"
|
|
5
|
-
role="region"
|
|
6
5
|
:aria-labelledby="uniqueId"
|
|
7
|
-
tabindex="0"
|
|
8
6
|
class="cpTable__container"
|
|
9
7
|
:class="containerClasses"
|
|
8
|
+
role="region"
|
|
9
|
+
tabindex="0"
|
|
10
10
|
>
|
|
11
11
|
<table class="cpTable__table">
|
|
12
12
|
<caption v-if="caption" :id="uniqueId" class="cpTable__caption">
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
class="cpTable__column"
|
|
23
23
|
:style="getColumnStyle(column)"
|
|
24
24
|
>
|
|
25
|
-
<slot
|
|
25
|
+
<slot :column="column" name="column">
|
|
26
26
|
{{ column.name }}
|
|
27
27
|
</slot>
|
|
28
28
|
</th>
|
|
@@ -46,10 +46,10 @@
|
|
|
46
46
|
:key="`${cellKey}_${rowIndex}`"
|
|
47
47
|
class="cpTable__cell"
|
|
48
48
|
:class="getCellClasses(cellKey)"
|
|
49
|
-
:style="getCellStyle(cellKey, cellIndex)"
|
|
50
49
|
:colspan="getColspan(cellKey)"
|
|
50
|
+
:style="getCellStyle(cellKey, cellIndex)"
|
|
51
51
|
>
|
|
52
|
-
<slot :
|
|
52
|
+
<slot :cell="cellValue" :name="cellKey">
|
|
53
53
|
<span v-if="isFullWidthRow(rowData)">{{ cellValue }}</span>
|
|
54
54
|
<template v-else>{{ cellValue }}</template>
|
|
55
55
|
</slot>
|
|
@@ -61,21 +61,21 @@
|
|
|
61
61
|
v-for="option in quickOptions"
|
|
62
62
|
:key="option.id"
|
|
63
63
|
v-tooltip="getQuickOptionTooltip(option)"
|
|
64
|
-
type="button"
|
|
65
64
|
class="cpTable__action"
|
|
66
65
|
:class="getQuickOptionClasses(option)"
|
|
67
66
|
:disabled="option.isDisabled"
|
|
67
|
+
type="button"
|
|
68
68
|
@click.stop="($event) => option.action(getRowPayload(rowIndex), $event)"
|
|
69
69
|
>
|
|
70
|
-
<cp-icon :type="option.icon"
|
|
70
|
+
<cp-icon size="16" :type="option.icon" />
|
|
71
71
|
</button>
|
|
72
72
|
|
|
73
73
|
<button
|
|
74
|
-
type="button"
|
|
75
74
|
class="cpTable__action cpTable__action--isDefault"
|
|
75
|
+
type="button"
|
|
76
76
|
@click.stop="handleContextMenu({ rowData, rowIndex }, $event)"
|
|
77
77
|
>
|
|
78
|
-
<cp-icon type="more-vertical"
|
|
78
|
+
<cp-icon size="16" type="more-vertical" />
|
|
79
79
|
</button>
|
|
80
80
|
</slot>
|
|
81
81
|
</div>
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
</tr>
|
|
85
85
|
</tbody>
|
|
86
86
|
</table>
|
|
87
|
-
<cp-table-empty-state v-if="hasNoResult"
|
|
87
|
+
<cp-table-empty-state v-if="hasNoResult" class="cpTable__emptyState" :placeholder="noResultPlaceholder" />
|
|
88
88
|
</div>
|
|
89
89
|
<div v-if="hasPagination" class="cpTable__footer">
|
|
90
90
|
<div class="footer__details">
|
|
@@ -98,7 +98,7 @@
|
|
|
98
98
|
</template>
|
|
99
99
|
<template v-else> No results </template>
|
|
100
100
|
</slot>
|
|
101
|
-
<template v-else> Loading <cp-loader
|
|
101
|
+
<template v-else> Loading <cp-loader class="cpTable__loader--isSmall" :color="LoaderColor" /> </template>
|
|
102
102
|
</p>
|
|
103
103
|
</div>
|
|
104
104
|
<div class="footer__pagination">
|
|
@@ -117,7 +117,7 @@
|
|
|
117
117
|
</template>
|
|
118
118
|
|
|
119
119
|
<script setup lang="ts">
|
|
120
|
-
import { ref, computed } from 'vue'
|
|
120
|
+
import { ref, computed, useId } from 'vue'
|
|
121
121
|
|
|
122
122
|
import CpContextualMenu from '@/components/CpContextualMenu.vue'
|
|
123
123
|
import CpTableEmptyState from '@/components/CpTableEmptyState.vue'
|
|
@@ -125,7 +125,6 @@ import CpTableEmptyState from '@/components/CpTableEmptyState.vue'
|
|
|
125
125
|
import { camelize, decamelize } from '@/helpers/string'
|
|
126
126
|
|
|
127
127
|
import { PAGINATION_FORMATS, RESERVED_KEYS, VISIBLE_ROWS_MAX } from '@/constants'
|
|
128
|
-
import { randomString } from '@/helpers'
|
|
129
128
|
|
|
130
129
|
interface Emits {
|
|
131
130
|
(e: 'onRowClick', data: Record<string, unknown>): void
|
|
@@ -199,7 +198,7 @@ const emit = defineEmits<Emits>()
|
|
|
199
198
|
|
|
200
199
|
const LoaderColor = '#5341F9'
|
|
201
200
|
|
|
202
|
-
const uniqueId =
|
|
201
|
+
const uniqueId = useId()
|
|
203
202
|
const pageNumber = ref(0)
|
|
204
203
|
const cpTableContainer = ref<HTMLElement | null>(null)
|
|
205
204
|
const contextualMenu = ref<InstanceType<typeof CpContextualMenu>>()
|