@citruslime/ui 2.0.0-beta.2 → 2.0.0-beta.23
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/README.md +5 -4
- package/dist/citrus-lime-ui.es.js +4616 -0
- package/dist/citrus-lime-ui.umd.js +2 -0
- package/dist/components/accordion/cl-ui-accordion.vue.d.ts +26 -0
- package/dist/components/accordion/index.d.ts +4 -0
- package/dist/components/accordion/item/cl-ui-accordion-item.vue.d.ts +35 -0
- package/dist/{@types/components/accordion/item.d.ts → components/accordion/types.d.ts} +0 -0
- package/dist/components/app/cl-ui-app.vue.d.ts +51 -0
- package/dist/components/app/index.d.ts +1 -0
- package/dist/components/button/cl-ui-button.vue.d.ts +51 -0
- package/dist/components/button/index.d.ts +2 -0
- package/dist/components/button/types.d.ts +4 -0
- package/dist/components/calendar/cl-ui-calendar.vue.d.ts +2 -0
- package/dist/components/calendar/index.d.ts +2 -0
- package/dist/components/calendar/types.d.ts +2 -0
- package/dist/components/calendar/utils.d.ts +38 -0
- package/dist/components/card/cl-ui-card.vue.d.ts +27 -0
- package/dist/components/card/index.d.ts +2 -0
- package/dist/components/card/types.d.ts +2 -0
- package/dist/components/combo-box/cl-ui-combo-box.vue.d.ts +583 -0
- package/dist/components/combo-box/index.d.ts +2 -0
- package/dist/components/combo-box/search-container/cl-ui-combo-box-search.vue.d.ts +276 -0
- package/dist/components/combo-box/search-container/header/cl-ui-combo-box-header.vue.d.ts +42 -0
- package/dist/components/combo-box/search-container/selectable/cl-ui-combo-box-selectable.vue.d.ts +81 -0
- package/dist/{@types/components/combo-box/item.d.ts → components/combo-box/types.d.ts} +0 -0
- package/dist/components/footer/index.d.ts +1 -0
- package/dist/components/grid/cell/cl-ui-grid-cell.vue.d.ts +72 -0
- package/dist/components/grid/cl-ui-grid.vue.d.ts +550 -0
- package/dist/components/grid/filter/cl-ui-grid-filter.vue.d.ts +72 -0
- package/dist/components/grid/filter/filter-methods.d.ts +5 -0
- package/dist/components/grid/footer/cl-ui-grid-footer.vue.d.ts +63 -0
- package/dist/components/grid/header/cl-ui-grid-header.vue.d.ts +207 -0
- package/dist/components/grid/index.d.ts +2 -0
- package/dist/components/grid/types.d.ts +92 -0
- package/dist/components/grid/view-manager/cl-ui-grid-view-manager.vue.d.ts +88 -0
- package/dist/components/header/index.d.ts +2 -0
- package/dist/components/header/menu/cl-ui-header-menu.vue.d.ts +40 -0
- package/dist/components/header/menu/index.d.ts +1 -0
- package/dist/components/index.d.ts +16 -17
- package/dist/components/input/cl-ui-input.vue.d.ts +2 -0
- package/dist/components/input/index.d.ts +2 -0
- package/dist/components/input/types.d.ts +6 -0
- package/dist/components/input/utils.d.ts +44 -0
- package/dist/components/language-switcher/cl-ui-language-switcher.vue.d.ts +37 -0
- package/dist/components/language-switcher/index.d.ts +2 -0
- package/dist/{@types/language.d.ts → components/language-switcher/types.d.ts} +0 -1
- package/dist/components/loading-spinner/index.d.ts +1 -0
- package/dist/components/login/cl-ui-login.vue.d.ts +106 -0
- package/dist/components/login/index.d.ts +2 -0
- package/dist/{@types/components/login/authentication.d.ts → components/login/types.d.ts} +0 -0
- package/dist/components/modal/cl-ui-modal.vue.d.ts +49 -0
- package/dist/components/modal/index.d.ts +2 -0
- package/dist/components/modal/types.d.ts +4 -0
- package/dist/components/navigation/cl-ui-navigation.vue.d.ts +11 -0
- package/dist/components/navigation/group/cl-ui-navigation-group.vue.d.ts +12 -0
- package/dist/components/navigation/icon/cl-ui-navigation-icon.vue.d.ts +20 -0
- package/dist/components/navigation/index.d.ts +5 -0
- package/dist/components/notification/cl-ui-notification.vue.d.ts +36 -0
- package/dist/components/notification/index.d.ts +1 -0
- package/dist/components/notification/types.d.ts +9 -0
- package/dist/components/slider/cl-ui-slider.vue.d.ts +114 -0
- package/dist/components/slider/index.d.ts +1 -0
- package/dist/components/tab/cl-ui-tab.vue.d.ts +52 -0
- package/dist/components/tab/header/cl-ui-tab-header.vue.d.ts +60 -0
- package/dist/components/tab/index.d.ts +4 -0
- package/dist/components/tab/types.d.ts +4 -0
- package/dist/composables/notification.d.ts +1 -1
- package/dist/main.d.ts +2 -4
- package/dist/style.css +1 -1
- package/dist/utils/i18n/config.d.ts +33 -0
- package/dist/utils/i18n/defaults.d.ts +4 -0
- package/dist/utils/i18n/index.d.ts +3 -0
- package/dist/utils/i18n/types.d.ts +97 -0
- package/dist/utils/index.d.ts +2 -6
- package/dist/utils/validation.d.ts +37 -0
- package/package.json +27 -14
- package/dist/.eslintrc.js +0 -453
- package/dist/.stylelintrc.js +0 -119
- package/dist/@types/appUser.d.ts +0 -11
- package/dist/@types/components/accordion/index.d.ts +0 -1
- package/dist/@types/components/combo-box/index.d.ts +0 -2
- package/dist/@types/components/combo-box/localisations.d.ts +0 -19
- package/dist/@types/components/grid/column.d.ts +0 -46
- package/dist/@types/components/grid/index.d.ts +0 -4
- package/dist/@types/components/grid/localisations.d.ts +0 -47
- package/dist/@types/components/grid/request.d.ts +0 -49
- package/dist/@types/components/grid/update.d.ts +0 -4
- package/dist/@types/components/header/index.d.ts +0 -1
- package/dist/@types/components/header/localisations.d.ts +0 -8
- package/dist/@types/components/login/index.d.ts +0 -2
- package/dist/@types/components/login/localisations.d.ts +0 -7
- package/dist/@types/components/navigation/index.d.ts +0 -18
- package/dist/@types/components/notification/index.d.ts +0 -1
- package/dist/@types/components/notification/item.d.ts +0 -7
- package/dist/@types/components/slider/index.d.ts +0 -1
- package/dist/@types/components/slider/localisations.d.ts +0 -3
- package/dist/@types/date-format.d.ts +0 -8
- package/dist/@types/debouncer.d.ts +0 -6
- package/dist/@types/index.d.ts +0 -16
- package/dist/@types/locale.d.ts +0 -10
- package/dist/@types/number-format.d.ts +0 -7
- package/dist/@types/string-format.d.ts +0 -3
- package/dist/@types/string.d.ts +0 -47
- package/dist/theme.js +0 -120
- package/dist/ui.es.js +0 -1
- package/dist/ui.umd.js +0 -1
- package/dist/utils/copy.d.ts +0 -8
- package/dist/utils/debouncer.d.ts +0 -8
- package/dist/utils/extensions/string-utilities.d.ts +0 -83
- package/dist/utils/extensions/string.d.ts +0 -1
- package/dist/utils/i18n/datetime-formats.d.ts +0 -3
- package/dist/utils/i18n/number-formats.d.ts +0 -3
- package/dist/utils/id.d.ts +0 -6
- package/dist/utils/name-of.d.ts +0 -7
- package/dist/utils/sort.d.ts +0 -9
- package/dist/utils/url-params.d.ts +0 -8
- package/src/components/accordion/cl-ui-accordion.vue +0 -89
- package/src/components/app/cl-ui-app.vue +0 -26
- package/src/components/button/cl-ui-button.vue +0 -48
- package/src/components/calendar/cl-ui-calendar.vue +0 -277
- package/src/components/card/cl-ui-card.vue +0 -70
- package/src/components/combo-box/cl-ui-combo-box.vue +0 -357
- package/src/components/combo-box/search-container/cl-ui-combo-box-search.vue +0 -279
- package/src/components/combo-box/search-container/header/cl-ui-combo-box-header.vue +0 -36
- package/src/components/combo-box/search-container/selectable/cl-ui-combo-box-selectable.vue +0 -99
- package/src/components/footer/cl-ui-footer.vue +0 -31
- package/src/components/grid/cell/cl-ui-grid-cell.vue +0 -153
- package/src/components/grid/cl-ui-grid.vue +0 -477
- package/src/components/grid/filter/cl-ui-grid-filter.vue +0 -270
- package/src/components/grid/footer/cl-ui-grid-footer.vue +0 -186
- package/src/components/grid/header/cl-ui-grid-header.vue +0 -76
- package/src/components/grid/view-manager/cl-ui-grid-view-manager.vue +0 -145
- package/src/components/header/cl-ui-header.vue +0 -11
- package/src/components/header-helper/cl-ui-header-helper.vue +0 -50
- package/src/components/language-switcher/cl-ui-language-switcher.vue +0 -82
- package/src/components/loading-spinner/cl-ui-loading-spinner.vue +0 -16
- package/src/components/login/cl-ui-login.vue +0 -183
- package/src/components/modal/cl-ui-modal.vue +0 -120
- package/src/components/navigation/cl-ui-navigation.vue +0 -124
- package/src/components/notification/cl-ui-notification.vue +0 -55
- package/src/components/slider/cl-ui-slider.vue +0 -145
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import { computed, ref, watch } from 'vue';
|
|
3
|
-
|
|
4
|
-
import { ComboBoxItem } from '../../../../@types';
|
|
5
|
-
|
|
6
|
-
const props = withDefaults(defineProps<{
|
|
7
|
-
isCreateNewOption?: boolean;
|
|
8
|
-
selectedIndex?: number;
|
|
9
|
-
text?: string;
|
|
10
|
-
option?: ComboBoxItem | null;
|
|
11
|
-
index: number;
|
|
12
|
-
}>(), {
|
|
13
|
-
isCreateNewOption: false,
|
|
14
|
-
selectedIndex: -1,
|
|
15
|
-
text: '',
|
|
16
|
-
option: () => null
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
const emit = defineEmits({
|
|
20
|
-
'create-object': null,
|
|
21
|
-
'select-object': null,
|
|
22
|
-
'option-highlighted': null
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
const displayedText = computed<string>(() => props.option?.name ?? props.text);
|
|
26
|
-
const displayedParent = computed<string>(() => props.option?.parentName ?? '');
|
|
27
|
-
const isHighlighted = ref<boolean>(false);
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Event when the option is selected - triggers to either select
|
|
31
|
-
* the highlight object, or prompt to create a new one.
|
|
32
|
-
*/
|
|
33
|
-
function optionSelected () : void {
|
|
34
|
-
if (props.isCreateNewOption === true) {
|
|
35
|
-
emit('create-object');
|
|
36
|
-
}
|
|
37
|
-
else {
|
|
38
|
-
emit('select-object', props.option?.id);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Event when the mouse hovers over the component.
|
|
44
|
-
*
|
|
45
|
-
* @param {boolean} hovered - Whether the mouse has hovered over or out of the component.
|
|
46
|
-
*/
|
|
47
|
-
function onHover (hovered: boolean) : void {
|
|
48
|
-
if (hovered === true) {
|
|
49
|
-
isHighlighted.value = true;
|
|
50
|
-
emit('option-highlighted', props.index);
|
|
51
|
-
}
|
|
52
|
-
else {
|
|
53
|
-
if (props.index !== props.selectedIndex) {
|
|
54
|
-
isHighlighted.value = false;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* Update the highlight on the component.
|
|
61
|
-
*/
|
|
62
|
-
function updateHighlight () : void {
|
|
63
|
-
if (props.selectedIndex === props.index) {
|
|
64
|
-
isHighlighted.value = true;
|
|
65
|
-
}
|
|
66
|
-
else {
|
|
67
|
-
isHighlighted.value = false;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
watch(() => props.selectedIndex, () => updateHighlight());
|
|
72
|
-
</script>
|
|
73
|
-
|
|
74
|
-
<template>
|
|
75
|
-
<div class="border-b border-grey-0 border-t cursor-pointer flex p-1"
|
|
76
|
-
:class="{
|
|
77
|
-
'bg-grey-0': isHighlighted === false,
|
|
78
|
-
'bg-primary-default text-white': isHighlighted
|
|
79
|
-
}"
|
|
80
|
-
@mousedown="optionSelected"
|
|
81
|
-
@mousemove="onHover(true)"
|
|
82
|
-
@mouseleave="onHover(false)">
|
|
83
|
-
<div v-if="option !== null && option.parentId !== 0 && option.parentId !== undefined"
|
|
84
|
-
class="w-1/2">
|
|
85
|
-
{{ displayedParent }}
|
|
86
|
-
</div>
|
|
87
|
-
<div :class="{
|
|
88
|
-
'w-1/2': displayedParent !== '',
|
|
89
|
-
'w-full': displayedParent === ''
|
|
90
|
-
}">
|
|
91
|
-
{{ displayedText }}
|
|
92
|
-
</div>
|
|
93
|
-
<div v-show="isCreateNewOption"
|
|
94
|
-
class="float-right py-1.5">
|
|
95
|
-
<icon class="bg-primary-default rounded-full text-white"
|
|
96
|
-
icon="ph:plus-circle" />
|
|
97
|
-
</div>
|
|
98
|
-
</div>
|
|
99
|
-
</template>
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
withDefaults(defineProps<{
|
|
3
|
-
leftText?: string;
|
|
4
|
-
rightText?: string;
|
|
5
|
-
}>(), {
|
|
6
|
-
leftText: '',
|
|
7
|
-
rightText: ''
|
|
8
|
-
});
|
|
9
|
-
</script>
|
|
10
|
-
|
|
11
|
-
<template>
|
|
12
|
-
<div class="flex flex-wrap left-0 w-full">
|
|
13
|
-
<div v-if="$slots.default"
|
|
14
|
-
class="w-full">
|
|
15
|
-
<slot></slot>
|
|
16
|
-
</div>
|
|
17
|
-
|
|
18
|
-
<div v-show="leftText !== '' || rightText !== ''"
|
|
19
|
-
class="leading-10 text-sm w-full">
|
|
20
|
-
<strong v-show="leftText !== ''"
|
|
21
|
-
class="float-left">
|
|
22
|
-
{{ leftText }}
|
|
23
|
-
</strong>
|
|
24
|
-
|
|
25
|
-
<strong v-show="rightText !== ''"
|
|
26
|
-
class="float-right">
|
|
27
|
-
{{ rightText }}
|
|
28
|
-
</strong>
|
|
29
|
-
</div>
|
|
30
|
-
</div>
|
|
31
|
-
</template>
|
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
export default {
|
|
3
|
-
inheritAttrs: false
|
|
4
|
-
};
|
|
5
|
-
</script>
|
|
6
|
-
|
|
7
|
-
<script setup lang="ts">
|
|
8
|
-
import { ref, watch, watchEffect } from 'vue';
|
|
9
|
-
import { useI18n } from 'vue-i18n';
|
|
10
|
-
|
|
11
|
-
import { DateFormat, GridColumn, GridColumnType, NumberFormat, StringFormat } from '../../../@types';
|
|
12
|
-
import { copy } from '../../../utils';
|
|
13
|
-
|
|
14
|
-
const props = withDefaults(defineProps<{
|
|
15
|
-
currentLocale?: string;
|
|
16
|
-
column: GridColumn;
|
|
17
|
-
record: Record<string, unknown>;
|
|
18
|
-
editMode?: boolean;
|
|
19
|
-
}>(), {
|
|
20
|
-
currentLocale: 'en-GB',
|
|
21
|
-
editMode: false
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
const emit = defineEmits({
|
|
25
|
-
edit: null,
|
|
26
|
-
focus: null,
|
|
27
|
-
'undo-edit': null
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
const { d, n } = useI18n();
|
|
31
|
-
|
|
32
|
-
const currentRecord = ref<Record<string, unknown>>(copy(props.record));
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Retrieve a string value, from the provided record.
|
|
36
|
-
*
|
|
37
|
-
* @param record The record to get the value from.
|
|
38
|
-
* @param key The property to get the value of.
|
|
39
|
-
* @returns The record value, as a string.
|
|
40
|
-
*/
|
|
41
|
-
function getStringValue (record: Record<string, unknown>, key: string): string {
|
|
42
|
-
return record[key] as string;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Retrieve a numeric value, from the provided record.
|
|
47
|
-
*
|
|
48
|
-
* @param record The record to get the value from.
|
|
49
|
-
* @param key The property to get the value of.
|
|
50
|
-
* @returns The record value, as a number.
|
|
51
|
-
*/
|
|
52
|
-
function getNumericValue (record: Record<string, unknown>, key: string): number {
|
|
53
|
-
return record[key] as number;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* Retrieve a boolean value, from the provided record.
|
|
58
|
-
*
|
|
59
|
-
* @param record The record to get the value from.
|
|
60
|
-
* @param key The property to get the value of.
|
|
61
|
-
* @returns The record value, as a boolean.
|
|
62
|
-
*/
|
|
63
|
-
function getBooleanValue (record: Record<string, unknown>, key: string): boolean {
|
|
64
|
-
return record[key] as boolean;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* Emits an event to indicate that the cell was focused.
|
|
69
|
-
*/
|
|
70
|
-
function cellFocused (): void {
|
|
71
|
-
emit('focus');
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
watchEffect(() => currentRecord.value = copy(props.record));
|
|
75
|
-
|
|
76
|
-
watch(currentRecord, (newValue) => {
|
|
77
|
-
const property: string = props.column.field ?? '';
|
|
78
|
-
|
|
79
|
-
if (property !== '') {
|
|
80
|
-
if (newValue[property] !== props.record[property]) {
|
|
81
|
-
emit('edit', newValue[property]);
|
|
82
|
-
}
|
|
83
|
-
else {
|
|
84
|
-
emit('undo-edit');
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
}, {
|
|
88
|
-
deep: true
|
|
89
|
-
});
|
|
90
|
-
</script>
|
|
91
|
-
|
|
92
|
-
<template>
|
|
93
|
-
<td v-if="editMode && column.field && column.editable"
|
|
94
|
-
v-bind="$attrs">
|
|
95
|
-
<strong class="lg:hidden mr-2">
|
|
96
|
-
{{ column.caption }}
|
|
97
|
-
</strong>
|
|
98
|
-
|
|
99
|
-
<slot :name="`${column.name}Edit`"
|
|
100
|
-
v-bind="{ cellFocused, column, record: currentRecord }"></slot>
|
|
101
|
-
</td>
|
|
102
|
-
<td v-else
|
|
103
|
-
v-bind="$attrs">
|
|
104
|
-
<strong class="lg:hidden mr-2">
|
|
105
|
-
{{ column.caption }}
|
|
106
|
-
</strong>
|
|
107
|
-
|
|
108
|
-
<!-- Slot contents -->
|
|
109
|
-
<slot v-if="column.type === GridColumnType.SLOT"
|
|
110
|
-
:name="column.name"
|
|
111
|
-
v-bind="{ column, record }"></slot>
|
|
112
|
-
<!-- Booleans -->
|
|
113
|
-
<input v-else-if="column.type === GridColumnType.BOOLEAN && column.field !== undefined"
|
|
114
|
-
type="checkbox"
|
|
115
|
-
:checked="getBooleanValue(record, column.field)"
|
|
116
|
-
disabled>
|
|
117
|
-
<!-- Dates and datetimes -->
|
|
118
|
-
<template v-else-if="(column.type === GridColumnType.DATE || column.type === GridColumnType.DATETIME) && column.field !== undefined">
|
|
119
|
-
<template v-if="column.format !== undefined">
|
|
120
|
-
{{ d(new Date(getStringValue(record, column.field)), column.format, currentLocale) }}
|
|
121
|
-
</template>
|
|
122
|
-
<template v-else-if="column.type === GridColumnType.DATE">
|
|
123
|
-
{{ d(new Date(getStringValue(record, column.field)), DateFormat.DATE, currentLocale) }}
|
|
124
|
-
</template>
|
|
125
|
-
<template v-else>
|
|
126
|
-
{{ d(new Date(getStringValue(record, column.field)), DateFormat.DATETIME, currentLocale) }}
|
|
127
|
-
</template>
|
|
128
|
-
</template>
|
|
129
|
-
<!-- Numbers -->
|
|
130
|
-
<template v-else-if="column.type === GridColumnType.NUMBER && column.field">
|
|
131
|
-
<template v-if="column.format === NumberFormat.MULTIPLIER">
|
|
132
|
-
×{{ getNumericValue(record, column.field) }}
|
|
133
|
-
</template>
|
|
134
|
-
<template v-else-if="column.format !== undefined">
|
|
135
|
-
{{ n(getNumericValue(record, column.field), column.format, currentLocale) }}
|
|
136
|
-
</template>
|
|
137
|
-
<template v-else>
|
|
138
|
-
{{ getNumericValue(record, column.field) }}
|
|
139
|
-
</template>
|
|
140
|
-
</template>
|
|
141
|
-
<!-- Strings -->
|
|
142
|
-
<template v-else-if="column.field !== undefined">
|
|
143
|
-
<span v-if="column.maxLength !== undefined"
|
|
144
|
-
class="inline-block whitespace-nowrap">
|
|
145
|
-
{{ getStringValue(record, column.field).trimToLength(column.maxLength, column.format !== undefined ? column.format === StringFormat.ELLIPSIS : false) }}
|
|
146
|
-
</span>
|
|
147
|
-
<span v-else
|
|
148
|
-
class="inline-block whitespace-nowrap">
|
|
149
|
-
{{ getStringValue(record, column.field) }}
|
|
150
|
-
</span>
|
|
151
|
-
</template>
|
|
152
|
-
</td>
|
|
153
|
-
</template>
|