@citruslime/ui 2.0.0-beta.5 → 2.0.0-beta.9
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/.eslintrc.js +2 -0
- package/dist/citrus-lime-ui.es.js +3960 -0
- package/dist/citrus-lime-ui.umd.js +1 -0
- package/dist/src/components/accordion/cl-ui-accordion.vue.d.ts +47 -0
- package/dist/src/components/accordion/index.d.ts +2 -0
- package/dist/{@types/components/accordion/item.d.ts → src/components/accordion/types.d.ts} +0 -0
- package/dist/src/components/app/cl-ui-app.vue.d.ts +44 -0
- package/dist/src/components/app/index.d.ts +1 -0
- package/dist/src/components/button/cl-ui-button.vue.d.ts +40 -0
- package/dist/src/components/button/index.d.ts +2 -0
- package/dist/src/components/button/types.d.ts +4 -0
- package/dist/src/components/calendar/cl-ui-calendar.vue.d.ts +2 -0
- package/dist/src/components/calendar/index.d.ts +2 -0
- package/dist/src/components/calendar/types.d.ts +2 -0
- package/dist/src/components/calendar/utils.d.ts +23 -0
- package/dist/src/components/card/cl-ui-card.vue.d.ts +22 -0
- package/dist/src/components/card/index.d.ts +2 -0
- package/dist/src/components/card/types.d.ts +2 -0
- package/dist/src/components/combo-box/cl-ui-combo-box.vue.d.ts +506 -0
- package/dist/src/components/combo-box/index.d.ts +2 -0
- package/dist/src/components/combo-box/search-container/cl-ui-combo-box-search.vue.d.ts +230 -0
- package/dist/src/components/combo-box/search-container/header/cl-ui-combo-box-header.vue.d.ts +34 -0
- package/dist/src/components/combo-box/search-container/selectable/cl-ui-combo-box-selectable.vue.d.ts +68 -0
- package/dist/{@types/components/combo-box/item.d.ts → src/components/combo-box/types.d.ts} +0 -0
- package/dist/src/components/footer/index.d.ts +1 -0
- package/dist/src/components/grid/cell/cl-ui-grid-cell.vue.d.ts +65 -0
- package/dist/src/components/grid/cl-ui-grid.vue.d.ts +478 -0
- package/dist/src/components/grid/filter/cl-ui-grid-filter.vue.d.ts +64 -0
- package/dist/src/components/grid/footer/cl-ui-grid-footer.vue.d.ts +57 -0
- package/dist/src/components/grid/header/cl-ui-grid-header.vue.d.ts +175 -0
- package/dist/src/components/grid/index.d.ts +2 -0
- package/dist/src/components/grid/types.d.ts +92 -0
- package/dist/src/components/grid/view-manager/cl-ui-grid-view-manager.vue.d.ts +75 -0
- package/dist/src/components/header/index.d.ts +2 -0
- package/dist/src/components/header/menu/cl-ui-header-menu.vue.d.ts +16 -0
- package/dist/src/components/header/menu/index.d.ts +2 -0
- package/dist/src/components/header/menu/types.d.ts +5 -0
- package/dist/src/components/index.d.ts +16 -0
- package/dist/src/components/language-switcher/cl-ui-language-switcher.vue.d.ts +33 -0
- package/dist/src/components/language-switcher/index.d.ts +2 -0
- package/dist/{@types/language.d.ts → src/components/language-switcher/types.d.ts} +1 -1
- package/dist/src/components/loading-spinner/index.d.ts +1 -0
- package/dist/src/components/login/cl-ui-login.vue.d.ts +92 -0
- package/dist/src/components/login/index.d.ts +2 -0
- package/dist/{@types/components/login/authentication.d.ts → src/components/login/types.d.ts} +0 -0
- package/dist/src/components/modal/cl-ui-modal.vue.d.ts +107 -0
- package/dist/src/components/modal/index.d.ts +1 -0
- package/dist/src/components/modal/types.d.ts +2 -0
- package/dist/src/components/navigation/cl-ui-navigation.vue.d.ts +669 -0
- package/dist/src/components/navigation/index.d.ts +2 -0
- package/dist/{@types/components/navigation/index.d.ts → src/components/navigation/types.d.ts} +2 -2
- package/dist/src/components/notification/cl-ui-notification.vue.d.ts +31 -0
- package/dist/src/components/notification/index.d.ts +1 -0
- package/dist/src/components/notification/types.d.ts +9 -0
- package/dist/src/components/slider/cl-ui-slider.vue.d.ts +87 -0
- package/dist/src/components/slider/index.d.ts +1 -0
- package/dist/{composables → src/composables}/index.d.ts +0 -0
- package/dist/{composables → src/composables}/notification.d.ts +1 -1
- package/dist/src/main.d.ts +6 -0
- package/dist/{utils → src/utils}/copy.d.ts +1 -1
- package/dist/{utils → src/utils}/debouncer.d.ts +6 -1
- package/dist/src/utils/extensions/string/index.d.ts +2 -0
- package/dist/{utils/extensions/string-utilities.d.ts → src/utils/extensions/string/utils.d.ts} +0 -0
- package/dist/src/utils/filter-methods.d.ts +5 -0
- package/dist/src/utils/i18n/config.d.ts +33 -0
- package/dist/src/utils/i18n/defaults.d.ts +4 -0
- package/dist/src/utils/i18n/index.d.ts +3 -0
- package/dist/src/utils/i18n/types.d.ts +94 -0
- package/dist/{utils → src/utils}/id.d.ts +0 -0
- package/dist/{utils → src/utils}/index.d.ts +2 -0
- package/dist/{utils → src/utils}/name-of.d.ts +0 -0
- package/dist/{utils → src/utils}/sort.d.ts +0 -0
- package/dist/{utils → src/utils}/url-params.d.ts +0 -0
- package/dist/style.css +1 -1
- package/package.json +23 -12
- 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/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/components/index.d.ts +0 -17
- package/dist/main.d.ts +0 -8
- package/dist/ui.es.js +0 -1
- package/dist/ui.umd.js +0 -1
- 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/src/components/accordion/cl-ui-accordion.vue +0 -89
- package/src/components/app/cl-ui-app.vue +0 -29
- 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 -158
- package/src/components/grid/cl-ui-grid.vue +0 -482
- 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 -78
- 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 -55
- 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
|
@@ -0,0 +1,3960 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
var __restKey = (key) => typeof key === "symbol" ? key : key + "";
|
|
21
|
+
var __objRest = (source, exclude) => {
|
|
22
|
+
var target = {};
|
|
23
|
+
for (var prop in source)
|
|
24
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
25
|
+
target[prop] = source[prop];
|
|
26
|
+
if (source != null && __getOwnPropSymbols)
|
|
27
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
28
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
29
|
+
target[prop] = source[prop];
|
|
30
|
+
}
|
|
31
|
+
return target;
|
|
32
|
+
};
|
|
33
|
+
import { Icon } from "@iconify/vue";
|
|
34
|
+
import { defineComponent, ref, watch, resolveComponent, openBlock, createElementBlock, Fragment, renderList, createElementVNode, normalizeClass, withKeys, toDisplayString, withDirectives, renderSlot, vShow, createVNode, reactive, toRefs, nextTick, createBlock, Teleport, unref, mergeProps, computed, onMounted, onUnmounted, createCommentVNode, normalizeProps, guardReactiveProps, withModifiers, withCtx, createTextVNode, vModelText, isRef, watchEffect, normalizeStyle, createSlots, vModelDynamic, Transition, resolveDynamicComponent } from "vue";
|
|
35
|
+
import { createI18n, useI18n } from "vue-i18n";
|
|
36
|
+
import Flatpickr from "flatpickr";
|
|
37
|
+
const _hoisted_1$o = { class: "cl-border cl-border-grey-2" };
|
|
38
|
+
const _hoisted_2$k = ["tabindex", "onClick", "onKeyup"];
|
|
39
|
+
const _hoisted_3$f = { class: "cl-bg-white cl-border-b cl-border-grey-2 cl-p-6 cl-text-sm" };
|
|
40
|
+
const _sfc_main$o = /* @__PURE__ */ defineComponent({
|
|
41
|
+
props: {
|
|
42
|
+
items: null,
|
|
43
|
+
exclusive: { default: false },
|
|
44
|
+
openFirst: { default: false }
|
|
45
|
+
},
|
|
46
|
+
setup(__props) {
|
|
47
|
+
const props = __props;
|
|
48
|
+
const itemList = ref([]);
|
|
49
|
+
function initialiseItems() {
|
|
50
|
+
itemList.value = props.items.map((v) => {
|
|
51
|
+
return {
|
|
52
|
+
id: v.id,
|
|
53
|
+
title: v.title,
|
|
54
|
+
open: false
|
|
55
|
+
};
|
|
56
|
+
});
|
|
57
|
+
if (props.openFirst && itemList.value.length > 0) {
|
|
58
|
+
itemList.value[0].open = true;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
function toggleItem(item) {
|
|
62
|
+
if (!item.open) {
|
|
63
|
+
itemList.value.forEach((i) => {
|
|
64
|
+
if (props.exclusive) {
|
|
65
|
+
i.open = false;
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
item.open = !item.open;
|
|
70
|
+
}
|
|
71
|
+
watch(() => props.items, () => initialiseItems(), {
|
|
72
|
+
deep: true,
|
|
73
|
+
immediate: true
|
|
74
|
+
});
|
|
75
|
+
return (_ctx, _cache) => {
|
|
76
|
+
const _component_icon = resolveComponent("icon");
|
|
77
|
+
return openBlock(), createElementBlock("ul", _hoisted_1$o, [
|
|
78
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(itemList.value, (item, index) => {
|
|
79
|
+
return openBlock(), createElementBlock("li", {
|
|
80
|
+
key: index,
|
|
81
|
+
class: "relative"
|
|
82
|
+
}, [
|
|
83
|
+
createElementVNode("div", {
|
|
84
|
+
class: normalizeClass(["cl-bg-white cl-border cl-border-grey-2 cl-cursor-pointer cl-ease-in-out cl-font-semibold cl-p-4 cl-scale-100 cl-transform-gpu cl-transition-transform focus:cl-border-blue-light focus:cl-outline-none hover:cl-scale-101", {
|
|
85
|
+
"cl-border-b-2": item.open
|
|
86
|
+
}]),
|
|
87
|
+
tabindex: index + 1,
|
|
88
|
+
onClick: ($event) => toggleItem(item),
|
|
89
|
+
onKeyup: withKeys(($event) => toggleItem(item), ["enter"])
|
|
90
|
+
}, toDisplayString(item.title), 43, _hoisted_2$k),
|
|
91
|
+
withDirectives(createElementVNode("div", _hoisted_3$f, [
|
|
92
|
+
renderSlot(_ctx.$slots, item.id)
|
|
93
|
+
], 512), [
|
|
94
|
+
[vShow, item.open]
|
|
95
|
+
]),
|
|
96
|
+
createVNode(_component_icon, {
|
|
97
|
+
class: normalizeClass(["cl-absolute cl-cursor-pointer cl-right-4 cl-top-4 cl-transform cl-transition-transform", {
|
|
98
|
+
"cl-rotate-180": item.open,
|
|
99
|
+
"cl-rotate-0": !item.open
|
|
100
|
+
}]),
|
|
101
|
+
icon: "ph:caret-down",
|
|
102
|
+
onClick: ($event) => toggleItem(item)
|
|
103
|
+
}, null, 8, ["class", "onClick"])
|
|
104
|
+
]);
|
|
105
|
+
}), 128))
|
|
106
|
+
]);
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
function copy(value) {
|
|
111
|
+
return JSON.parse(JSON.stringify(value));
|
|
112
|
+
}
|
|
113
|
+
function useDebouncer(timeout = 500) {
|
|
114
|
+
const debouncerState = reactive({
|
|
115
|
+
debouncer: null,
|
|
116
|
+
timeout
|
|
117
|
+
});
|
|
118
|
+
function debounce(event, eventArgs) {
|
|
119
|
+
if (debouncerState.debouncer !== null) {
|
|
120
|
+
window.clearTimeout(debouncerState.debouncer);
|
|
121
|
+
}
|
|
122
|
+
debouncerState.debouncer = window.setTimeout(() => event(...eventArgs), debouncerState.timeout);
|
|
123
|
+
}
|
|
124
|
+
return __spreadProps(__spreadValues({}, toRefs(debouncerState)), {
|
|
125
|
+
debounce
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
function generateStringId() {
|
|
129
|
+
return Math.random().toString(36).slice(2, 8);
|
|
130
|
+
}
|
|
131
|
+
function nameOf(name) {
|
|
132
|
+
return name;
|
|
133
|
+
}
|
|
134
|
+
function compareByProperty(firstValue, secondValue, property) {
|
|
135
|
+
return firstValue[property] < secondValue[property] ? -1 : firstValue[property] > secondValue[property] ? 1 : 0;
|
|
136
|
+
}
|
|
137
|
+
function getParamsByName(stringToSearch, paramToFind) {
|
|
138
|
+
let valueToReturn = "";
|
|
139
|
+
const urlToSearch = decodeURIComponent(stringToSearch);
|
|
140
|
+
const regexS = "[\\?&]" + paramToFind + "=([^&#]*)";
|
|
141
|
+
const regex = new RegExp(regexS);
|
|
142
|
+
const results = regex.exec(urlToSearch);
|
|
143
|
+
if (results && results[1]) {
|
|
144
|
+
valueToReturn = decodeURIComponent(results[1].replace(/\+/g, " "));
|
|
145
|
+
}
|
|
146
|
+
return valueToReturn;
|
|
147
|
+
}
|
|
148
|
+
function levenshtein(firstString, secondString) {
|
|
149
|
+
if (firstString.length === 0) {
|
|
150
|
+
return secondString.length;
|
|
151
|
+
}
|
|
152
|
+
if (secondString.length === 0) {
|
|
153
|
+
return firstString.length;
|
|
154
|
+
}
|
|
155
|
+
if (firstString.length > secondString.length) {
|
|
156
|
+
const tmp = firstString;
|
|
157
|
+
firstString = secondString;
|
|
158
|
+
secondString = tmp;
|
|
159
|
+
}
|
|
160
|
+
const row = new Int8Array(firstString.length + 1);
|
|
161
|
+
for (let i = 0; i <= firstString.length; i++) {
|
|
162
|
+
row[i] = i;
|
|
163
|
+
}
|
|
164
|
+
let temp;
|
|
165
|
+
for (let i = 1; i <= secondString.length; i++) {
|
|
166
|
+
let prev = i;
|
|
167
|
+
const previousChar = secondString[i - 1];
|
|
168
|
+
for (let j = 1; j <= firstString.length; j++) {
|
|
169
|
+
if (previousChar === firstString[j - 1]) {
|
|
170
|
+
temp = row[j - 1];
|
|
171
|
+
} else {
|
|
172
|
+
const a = prev + 1;
|
|
173
|
+
const b = row[j] + 1;
|
|
174
|
+
const c = a - (a - b & b - a >> 7);
|
|
175
|
+
const d = row[j - 1] + 1;
|
|
176
|
+
temp = c - (c - d & d - c >> 7);
|
|
177
|
+
}
|
|
178
|
+
row[j - 1] = prev;
|
|
179
|
+
prev = temp;
|
|
180
|
+
}
|
|
181
|
+
row[firstString.length] = prev;
|
|
182
|
+
}
|
|
183
|
+
return row[firstString.length];
|
|
184
|
+
}
|
|
185
|
+
function camelCaseToArray(camelCase) {
|
|
186
|
+
return camelCase.split(/(?=[A-Z])/g);
|
|
187
|
+
}
|
|
188
|
+
function kebabCaseToArray(kebabCase) {
|
|
189
|
+
return kebabCase.split(/(?=-)/g).map((s) => s.replace(/-/g, ""));
|
|
190
|
+
}
|
|
191
|
+
function pascalCaseToArray(pascalCase) {
|
|
192
|
+
return camelCaseToArray(pascalCase);
|
|
193
|
+
}
|
|
194
|
+
function sentenceCaseToArray(sentenceCase) {
|
|
195
|
+
return sentenceCase.split(/ /g).map((s) => s.replace(/[^A-Za-z0-9]/g, ""));
|
|
196
|
+
}
|
|
197
|
+
function snakeCaseToArray(snakeCase) {
|
|
198
|
+
return snakeCase.split(/(?=_)/g).map((s) => s.replace(/_/g, ""));
|
|
199
|
+
}
|
|
200
|
+
function titleCaseToArray(titleCase) {
|
|
201
|
+
return sentenceCaseToArray(titleCase);
|
|
202
|
+
}
|
|
203
|
+
function arrayToCamelCase(array, locale) {
|
|
204
|
+
let result = "";
|
|
205
|
+
array.forEach((s, i) => {
|
|
206
|
+
result += i === 0 ? s.toLocaleLowerCase(locale) : s.toLocaleLowerCase(locale).firstCharToUpperCase(locale);
|
|
207
|
+
});
|
|
208
|
+
return result;
|
|
209
|
+
}
|
|
210
|
+
function arrayToKebabCase(array, lowerCase, locale) {
|
|
211
|
+
let result = "";
|
|
212
|
+
array.forEach((s) => {
|
|
213
|
+
result += `${lowerCase ? s.toLocaleLowerCase(locale) : s.toLocaleUpperCase(locale)}-`;
|
|
214
|
+
});
|
|
215
|
+
return result.trimEndChar("-");
|
|
216
|
+
}
|
|
217
|
+
function arrayToSentenceCase(array, locale) {
|
|
218
|
+
let result = "";
|
|
219
|
+
array.forEach((s, i) => {
|
|
220
|
+
result += `${i === 0 ? s.toLowerCase().firstCharToUpperCase(locale) : s.toLocaleLowerCase(locale)} `;
|
|
221
|
+
});
|
|
222
|
+
return result.trimEndChar(" ");
|
|
223
|
+
}
|
|
224
|
+
function arrayToTitleCase(array, locale) {
|
|
225
|
+
let result = "";
|
|
226
|
+
array.forEach((s) => {
|
|
227
|
+
result += `${s.toLocaleLowerCase(locale).firstCharToUpperCase(locale)} `;
|
|
228
|
+
});
|
|
229
|
+
return result.trimEndChar(" ");
|
|
230
|
+
}
|
|
231
|
+
String.prototype.similarity = function(comparisonString) {
|
|
232
|
+
let similarityToReturn = 0;
|
|
233
|
+
let longerString = this.toLowerCase();
|
|
234
|
+
let shorterString = comparisonString.toLowerCase();
|
|
235
|
+
if (longerString < shorterString) {
|
|
236
|
+
const temp = shorterString;
|
|
237
|
+
shorterString = longerString;
|
|
238
|
+
longerString = temp;
|
|
239
|
+
}
|
|
240
|
+
const longerLength = longerString.length;
|
|
241
|
+
if (longerLength === 0) {
|
|
242
|
+
similarityToReturn = 100;
|
|
243
|
+
} else {
|
|
244
|
+
similarityToReturn = Math.round((longerLength - levenshtein(longerString, shorterString)) / longerLength * 100);
|
|
245
|
+
}
|
|
246
|
+
return similarityToReturn;
|
|
247
|
+
};
|
|
248
|
+
String.prototype.trimChar = function(character) {
|
|
249
|
+
return this.trimStartChar(character).trimEndChar(character);
|
|
250
|
+
};
|
|
251
|
+
String.prototype.trimStartChar = function(character) {
|
|
252
|
+
return character !== "" && this.startsWith(character) ? this.slice(1) : this;
|
|
253
|
+
};
|
|
254
|
+
String.prototype.trimEndChar = function(character) {
|
|
255
|
+
return character !== "" && this.endsWith(character) ? this.slice(0, -1) : this;
|
|
256
|
+
};
|
|
257
|
+
String.prototype.trimToLength = function(length, addEllipsis = false) {
|
|
258
|
+
const trimLength = this.length < length ? this.length : length;
|
|
259
|
+
return addEllipsis && trimLength >= 4 && trimLength < this.length ? `${this.slice(0, Math.max(trimLength - 3, 1))}...` : this.slice(0, Math.max(trimLength, 1));
|
|
260
|
+
};
|
|
261
|
+
String.prototype.firstCharToUpperCase = function(locale) {
|
|
262
|
+
return `${this.charAt(0).toLocaleUpperCase(locale)}${this.slice(1)}`;
|
|
263
|
+
};
|
|
264
|
+
String.prototype.firstCharToLowerCase = function(locale) {
|
|
265
|
+
return `${this.charAt(0).toLocaleLowerCase(locale)}${this.slice(1)}`;
|
|
266
|
+
};
|
|
267
|
+
String.prototype.removeWhitespace = function() {
|
|
268
|
+
return this.replace(/\s/g, "");
|
|
269
|
+
};
|
|
270
|
+
String.prototype.removeNonAlphanumeric = function() {
|
|
271
|
+
return this.replace(/[^a-zA-Z0-9]/g, "");
|
|
272
|
+
};
|
|
273
|
+
String.prototype.removeNonAlphabetic = function() {
|
|
274
|
+
return this.replace(/[^a-zA-Z]/g, "");
|
|
275
|
+
};
|
|
276
|
+
String.prototype.removeNonNumeric = function() {
|
|
277
|
+
return this.replace(/[^0-9]/g, "");
|
|
278
|
+
};
|
|
279
|
+
String.prototype.replacePlaceholders = function(...args) {
|
|
280
|
+
let i = 0;
|
|
281
|
+
return this.replace(/{\d+}/g, () => typeof args[i] !== "undefined" ? args[i++] : "");
|
|
282
|
+
};
|
|
283
|
+
String.prototype.camelCaseToKebabCase = function(lowerCase = true, locale) {
|
|
284
|
+
return arrayToKebabCase(camelCaseToArray(this), lowerCase, locale);
|
|
285
|
+
};
|
|
286
|
+
String.prototype.camelCaseToPascalCase = function(locale) {
|
|
287
|
+
return this.firstCharToUpperCase(locale);
|
|
288
|
+
};
|
|
289
|
+
String.prototype.camelCaseToSentenceCase = function(locale) {
|
|
290
|
+
return arrayToSentenceCase(camelCaseToArray(this), locale);
|
|
291
|
+
};
|
|
292
|
+
String.prototype.camelCaseToSnakeCase = function(lowerCase = true, locale) {
|
|
293
|
+
return this.camelCaseToKebabCase().kebabCaseToSnakeCase(lowerCase, locale);
|
|
294
|
+
};
|
|
295
|
+
String.prototype.camelCaseToTitleCase = function(locale) {
|
|
296
|
+
return arrayToTitleCase(camelCaseToArray(this), locale);
|
|
297
|
+
};
|
|
298
|
+
String.prototype.kebabCaseToCamelCase = function(locale) {
|
|
299
|
+
return arrayToCamelCase(kebabCaseToArray(this), locale);
|
|
300
|
+
};
|
|
301
|
+
String.prototype.kebabCaseToPascalCase = function(locale) {
|
|
302
|
+
return this.kebabCaseToCamelCase().camelCaseToPascalCase(locale);
|
|
303
|
+
};
|
|
304
|
+
String.prototype.kebabCaseToSentenceCase = function(locale) {
|
|
305
|
+
return arrayToSentenceCase(kebabCaseToArray(this), locale);
|
|
306
|
+
};
|
|
307
|
+
String.prototype.kebabCaseToSnakeCase = function(lowerCase = true, locale) {
|
|
308
|
+
const result = this.replace(/-/g, "_");
|
|
309
|
+
return lowerCase ? result.toLocaleLowerCase(locale) : result.toLocaleUpperCase(locale);
|
|
310
|
+
};
|
|
311
|
+
String.prototype.kebabCaseToTitleCase = function(locale) {
|
|
312
|
+
return arrayToTitleCase(kebabCaseToArray(this), locale);
|
|
313
|
+
};
|
|
314
|
+
String.prototype.pascalCaseToCamelCase = function(locale) {
|
|
315
|
+
return arrayToCamelCase(pascalCaseToArray(this), locale);
|
|
316
|
+
};
|
|
317
|
+
String.prototype.pascalCaseToKebabCase = function(lowerCase = true, locale) {
|
|
318
|
+
return arrayToKebabCase(pascalCaseToArray(this), lowerCase, locale);
|
|
319
|
+
};
|
|
320
|
+
String.prototype.pascalCaseToSentenceCase = function(locale) {
|
|
321
|
+
return arrayToSentenceCase(pascalCaseToArray(this), locale);
|
|
322
|
+
};
|
|
323
|
+
String.prototype.pascalCaseToSnakeCase = function(lowerCase = true, locale) {
|
|
324
|
+
return this.pascalCaseToKebabCase().kebabCaseToSnakeCase(lowerCase, locale);
|
|
325
|
+
};
|
|
326
|
+
String.prototype.pascalCaseToTitleCase = function(locale) {
|
|
327
|
+
return arrayToTitleCase(pascalCaseToArray(this), locale);
|
|
328
|
+
};
|
|
329
|
+
String.prototype.sentenceCaseToCamelCase = function(locale) {
|
|
330
|
+
return arrayToCamelCase(sentenceCaseToArray(this), locale);
|
|
331
|
+
};
|
|
332
|
+
String.prototype.sentenceCaseToKebabCase = function(lowerCase = true, locale) {
|
|
333
|
+
return arrayToKebabCase(sentenceCaseToArray(this), lowerCase, locale);
|
|
334
|
+
};
|
|
335
|
+
String.prototype.sentenceCaseToPascalCase = function(locale) {
|
|
336
|
+
return this.sentenceCaseToCamelCase().camelCaseToPascalCase(locale);
|
|
337
|
+
};
|
|
338
|
+
String.prototype.sentenceCaseToSnakeCase = function(lowerCase = true, locale) {
|
|
339
|
+
return this.sentenceCaseToKebabCase().kebabCaseToSnakeCase(lowerCase, locale);
|
|
340
|
+
};
|
|
341
|
+
String.prototype.sentenceCaseToTitleCase = function(locale) {
|
|
342
|
+
return arrayToTitleCase(sentenceCaseToArray(this), locale);
|
|
343
|
+
};
|
|
344
|
+
String.prototype.snakeCaseToCamelCase = function(locale) {
|
|
345
|
+
return arrayToCamelCase(snakeCaseToArray(this), locale);
|
|
346
|
+
};
|
|
347
|
+
String.prototype.snakeCaseToKebabCase = function(lowerCase = true, locale) {
|
|
348
|
+
const result = this.replace(/_/g, "-");
|
|
349
|
+
return lowerCase ? result.toLocaleLowerCase(locale) : result.toLocaleUpperCase(locale);
|
|
350
|
+
};
|
|
351
|
+
String.prototype.snakeCaseToPascalCase = function(locale) {
|
|
352
|
+
return this.snakeCaseToCamelCase().camelCaseToPascalCase(locale);
|
|
353
|
+
};
|
|
354
|
+
String.prototype.snakeCaseToSentenceCase = function(locale) {
|
|
355
|
+
return arrayToSentenceCase(snakeCaseToArray(this), locale);
|
|
356
|
+
};
|
|
357
|
+
String.prototype.snakeCaseToTitleCase = function(locale) {
|
|
358
|
+
return arrayToTitleCase(snakeCaseToArray(this), locale);
|
|
359
|
+
};
|
|
360
|
+
String.prototype.titleCaseToCamelCase = function(locale) {
|
|
361
|
+
return arrayToCamelCase(titleCaseToArray(this), locale);
|
|
362
|
+
};
|
|
363
|
+
String.prototype.titleCaseToKebabCase = function(lowerCase = true, locale) {
|
|
364
|
+
return arrayToKebabCase(titleCaseToArray(this), lowerCase, locale);
|
|
365
|
+
};
|
|
366
|
+
String.prototype.titleCaseToPascalCase = function(locale) {
|
|
367
|
+
return this.titleCaseToCamelCase().camelCaseToPascalCase(locale);
|
|
368
|
+
};
|
|
369
|
+
String.prototype.titleCaseToSentenceCase = function(locale) {
|
|
370
|
+
return arrayToSentenceCase(titleCaseToArray(this), locale);
|
|
371
|
+
};
|
|
372
|
+
String.prototype.titleCaseToSnakeCase = function(lowerCase = true, locale) {
|
|
373
|
+
return this.titleCaseToKebabCase().kebabCaseToSnakeCase(lowerCase, locale);
|
|
374
|
+
};
|
|
375
|
+
const stringExtensionsEnabled = true;
|
|
376
|
+
var NumberFormat;
|
|
377
|
+
(function(NumberFormat2) {
|
|
378
|
+
NumberFormat2["CURRENCY"] = "currency";
|
|
379
|
+
NumberFormat2["PERCENTAGE"] = "percentage";
|
|
380
|
+
NumberFormat2["INTEGER"] = "integer";
|
|
381
|
+
NumberFormat2["DECIMAL"] = "decimal";
|
|
382
|
+
NumberFormat2["MULTIPLIER"] = "multiplier";
|
|
383
|
+
})(NumberFormat || (NumberFormat = {}));
|
|
384
|
+
var DateFormat;
|
|
385
|
+
(function(DateFormat2) {
|
|
386
|
+
DateFormat2["SHORT_DATE"] = "short-date";
|
|
387
|
+
DateFormat2["SHORT_DATETIME"] = "short-datetime";
|
|
388
|
+
DateFormat2["DATE"] = "date";
|
|
389
|
+
DateFormat2["DATETIME"] = "datetime";
|
|
390
|
+
DateFormat2["LONG_DATE"] = "long-date";
|
|
391
|
+
DateFormat2["LONG_DATETIME"] = "long-datetime";
|
|
392
|
+
})(DateFormat || (DateFormat = {}));
|
|
393
|
+
const messages = {
|
|
394
|
+
"en-GB": {
|
|
395
|
+
comboBox: {
|
|
396
|
+
emptyHintText: "Choose a {object}",
|
|
397
|
+
createTitle: "Create {object}",
|
|
398
|
+
createProperty: "Name",
|
|
399
|
+
create: "Create",
|
|
400
|
+
cancel: "Cancel",
|
|
401
|
+
createSuccessful: "Successfully created the {object} '{name}'",
|
|
402
|
+
createFailed: "Could not create '{name}' - {error}",
|
|
403
|
+
required: "Required",
|
|
404
|
+
searchHint: "Enter the {object} name",
|
|
405
|
+
errorMessage: "An error has occurred: {error}",
|
|
406
|
+
addPrompt: "Add '{value}' as new {object}",
|
|
407
|
+
noResults: "0 matching results for '{value}'"
|
|
408
|
+
},
|
|
409
|
+
grid: {
|
|
410
|
+
confirmFilters: "Confirm Filters",
|
|
411
|
+
noData: "No data to show.",
|
|
412
|
+
noDataFiltersPresent: "We noticed you have some filters present. Please update or clear your filters.",
|
|
413
|
+
field: "Field",
|
|
414
|
+
filter: "Filter",
|
|
415
|
+
sortBy: "Sort By",
|
|
416
|
+
gridTools: "Grid Tools",
|
|
417
|
+
clearFilters: "Clear Filters",
|
|
418
|
+
modifyFilters: "Modify Filters",
|
|
419
|
+
editData: "Edit Data",
|
|
420
|
+
finishEditing: "Finish Editing",
|
|
421
|
+
equal: "Equals",
|
|
422
|
+
notequal: "Does not equal",
|
|
423
|
+
contains: "Contains",
|
|
424
|
+
notcontains: "Does not contain",
|
|
425
|
+
startswith: "Starts with",
|
|
426
|
+
endswith: "Ends with",
|
|
427
|
+
lessthan: "Less than",
|
|
428
|
+
greaterthan: "Greater than",
|
|
429
|
+
equalorlessthan: "Less than or equal to",
|
|
430
|
+
equalorgreaterthan: "Greater than or equal to",
|
|
431
|
+
currentMethod: "Current filter method",
|
|
432
|
+
availableMethods: "Available filter methods",
|
|
433
|
+
true: "True",
|
|
434
|
+
false: "False",
|
|
435
|
+
selectDate: "Select date",
|
|
436
|
+
selectDateTime: "Select date & time",
|
|
437
|
+
page: "Page",
|
|
438
|
+
pageSize: "Page Size",
|
|
439
|
+
totalRecords: "Total Records",
|
|
440
|
+
jumpToPage: "Jump to Page",
|
|
441
|
+
manageView: "Manage View",
|
|
442
|
+
column: "Column",
|
|
443
|
+
visible: "Visible",
|
|
444
|
+
order: "Order",
|
|
445
|
+
hidden: "Hidden"
|
|
446
|
+
},
|
|
447
|
+
login: {
|
|
448
|
+
login: "Login",
|
|
449
|
+
email: "Email Address",
|
|
450
|
+
password: "Password",
|
|
451
|
+
validEmail: "Username is a valid email address.",
|
|
452
|
+
invalidEmail: "Username must be a valid email address."
|
|
453
|
+
},
|
|
454
|
+
slider: {
|
|
455
|
+
invalidProps: "The current combination of props is invalid. Please confirm the values provided are correct."
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
};
|
|
459
|
+
const numberFormats = {
|
|
460
|
+
"en-GB": {
|
|
461
|
+
[NumberFormat.PERCENTAGE]: {
|
|
462
|
+
style: "percent"
|
|
463
|
+
},
|
|
464
|
+
[NumberFormat.INTEGER]: {
|
|
465
|
+
maximumFractionDigits: 0
|
|
466
|
+
},
|
|
467
|
+
[NumberFormat.DECIMAL]: {
|
|
468
|
+
minimumFractionDigits: 1
|
|
469
|
+
},
|
|
470
|
+
[NumberFormat.CURRENCY]: {
|
|
471
|
+
style: "currency",
|
|
472
|
+
currency: "GBP",
|
|
473
|
+
currencyDisplay: "symbol"
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
};
|
|
477
|
+
const datetimeFormats = {
|
|
478
|
+
"en-GB": {
|
|
479
|
+
[DateFormat.SHORT_DATE]: {
|
|
480
|
+
day: "numeric",
|
|
481
|
+
month: "numeric",
|
|
482
|
+
year: "2-digit"
|
|
483
|
+
},
|
|
484
|
+
[DateFormat.SHORT_DATETIME]: {
|
|
485
|
+
day: "numeric",
|
|
486
|
+
month: "numeric",
|
|
487
|
+
year: "2-digit",
|
|
488
|
+
hour: "numeric",
|
|
489
|
+
minute: "numeric"
|
|
490
|
+
},
|
|
491
|
+
[DateFormat.DATE]: {
|
|
492
|
+
day: "numeric",
|
|
493
|
+
month: "numeric",
|
|
494
|
+
year: "numeric"
|
|
495
|
+
},
|
|
496
|
+
[DateFormat.DATETIME]: {
|
|
497
|
+
day: "numeric",
|
|
498
|
+
month: "numeric",
|
|
499
|
+
year: "numeric",
|
|
500
|
+
hour: "numeric",
|
|
501
|
+
minute: "numeric"
|
|
502
|
+
},
|
|
503
|
+
[DateFormat.LONG_DATE]: {
|
|
504
|
+
day: "numeric",
|
|
505
|
+
month: "long",
|
|
506
|
+
year: "numeric"
|
|
507
|
+
},
|
|
508
|
+
[DateFormat.LONG_DATETIME]: {
|
|
509
|
+
day: "numeric",
|
|
510
|
+
month: "long",
|
|
511
|
+
year: "numeric",
|
|
512
|
+
hour: "numeric",
|
|
513
|
+
minute: "numeric"
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
};
|
|
517
|
+
const i18n = createI18n({
|
|
518
|
+
locale: "en-GB",
|
|
519
|
+
fallbackLocale: "en-GB",
|
|
520
|
+
messages,
|
|
521
|
+
numberFormats,
|
|
522
|
+
datetimeFormats,
|
|
523
|
+
useScope: "global",
|
|
524
|
+
missingWarn: false,
|
|
525
|
+
fallbackWarn: false,
|
|
526
|
+
warnHtmlMessage: false
|
|
527
|
+
});
|
|
528
|
+
function setLocaleMessages(locale, messages2) {
|
|
529
|
+
i18n.global.mergeLocaleMessage(locale, messages2);
|
|
530
|
+
return nextTick();
|
|
531
|
+
}
|
|
532
|
+
function setLocaleNumberFormats(locale, numberFormats2) {
|
|
533
|
+
i18n.global.mergeNumberFormat(locale, numberFormats2);
|
|
534
|
+
return nextTick();
|
|
535
|
+
}
|
|
536
|
+
function setLocaleDateTimeFormats(locale, dateTimeFormats) {
|
|
537
|
+
i18n.global.mergeDateTimeFormat(locale, dateTimeFormats);
|
|
538
|
+
return nextTick();
|
|
539
|
+
}
|
|
540
|
+
function setCurrentLocale(locale) {
|
|
541
|
+
i18n.global.locale.value = locale;
|
|
542
|
+
return nextTick();
|
|
543
|
+
}
|
|
544
|
+
const notifications = ref([]);
|
|
545
|
+
function showNotification(notification) {
|
|
546
|
+
const newNotification = __spreadValues({
|
|
547
|
+
id: generateStringId()
|
|
548
|
+
}, notification);
|
|
549
|
+
notifications.value.push(newNotification);
|
|
550
|
+
setTimeout(() => removeNotification(newNotification), notification.duration);
|
|
551
|
+
}
|
|
552
|
+
function removeNotification(notification) {
|
|
553
|
+
notifications.value = notifications.value.filter((n) => n.id !== notification.id);
|
|
554
|
+
}
|
|
555
|
+
const _hoisted_1$n = ["onClick"];
|
|
556
|
+
const _hoisted_2$j = { class: "cl-flex-1 cl-overflow-ellipsis cl-select-none cl-w-64" };
|
|
557
|
+
const __default__$4 = {
|
|
558
|
+
inheritAttrs: false
|
|
559
|
+
};
|
|
560
|
+
function setup$4(__props) {
|
|
561
|
+
return (_ctx, _cache) => {
|
|
562
|
+
const _component_icon = resolveComponent("icon");
|
|
563
|
+
return openBlock(), createBlock(Teleport, { to: __props.container }, [
|
|
564
|
+
createElementVNode("div", {
|
|
565
|
+
class: normalizeClass(["cl-fixed cl-w-80 cl-z-40", {
|
|
566
|
+
"cl-top-5 cl-left-5": __props.position === "top-left",
|
|
567
|
+
"cl-top-5 cl-left-1/2": __props.position === "top-centre",
|
|
568
|
+
"cl-top-5 cl-right-5": __props.position === "top-right",
|
|
569
|
+
"cl-bottom-5 cl-left-5": __props.position === "bottom-left",
|
|
570
|
+
"cl-bottom-5 cl-left-1/2": __props.position === "bottom-centre",
|
|
571
|
+
"cl-bottom-5 cl-right-5": __props.position === "bottom-right"
|
|
572
|
+
}])
|
|
573
|
+
}, [
|
|
574
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(notifications), (notification, index) => {
|
|
575
|
+
return openBlock(), createElementBlock("div", mergeProps(_ctx.$attrs, {
|
|
576
|
+
key: index,
|
|
577
|
+
class: ["cl-break-words cl-cursor-pointer cl-flex cl-font-semibold cl-group cl-mb-2 cl-overflow-hidden cl-p-4 cl-rounded cl-shadow-lg cl-text-sm", {
|
|
578
|
+
"cl-bg-white": notification.colour === "default",
|
|
579
|
+
"cl-bg-primary-default": notification.colour === "primary",
|
|
580
|
+
"cl-bg-secondary-default": notification.colour === "secondary",
|
|
581
|
+
"cl-bg-danger-default": notification.colour === "danger",
|
|
582
|
+
"cl-bg-warning-default": notification.colour === "warning"
|
|
583
|
+
}],
|
|
584
|
+
onClick: ($event) => unref(removeNotification)(notification)
|
|
585
|
+
}), [
|
|
586
|
+
createElementVNode("span", _hoisted_2$j, toDisplayString(notification.message), 1),
|
|
587
|
+
createVNode(_component_icon, {
|
|
588
|
+
class: "cl-inline-block cl-opacity-0 group-hover:cl-opacity-100",
|
|
589
|
+
icon: "ph:x",
|
|
590
|
+
size: 16,
|
|
591
|
+
weight: "bold"
|
|
592
|
+
})
|
|
593
|
+
], 16, _hoisted_1$n);
|
|
594
|
+
}), 128))
|
|
595
|
+
], 2)
|
|
596
|
+
], 8, ["to"]);
|
|
597
|
+
};
|
|
598
|
+
}
|
|
599
|
+
const _sfc_main$n = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$4), {
|
|
600
|
+
props: {
|
|
601
|
+
container: { default: "body" },
|
|
602
|
+
position: { default: "top-right" }
|
|
603
|
+
},
|
|
604
|
+
setup: setup$4
|
|
605
|
+
}));
|
|
606
|
+
const _hoisted_1$m = { class: "cl-absolute cl-flex cl-flex-wrap cl-h-screen cl-max-h-screen cl-max-w-full cl-min-h-screen cl-min-w-full cl-w-full" };
|
|
607
|
+
const _sfc_main$m = /* @__PURE__ */ defineComponent({
|
|
608
|
+
props: {
|
|
609
|
+
removePadding: { default: false }
|
|
610
|
+
},
|
|
611
|
+
setup(__props) {
|
|
612
|
+
return (_ctx, _cache) => {
|
|
613
|
+
return openBlock(), createElementBlock(Fragment, null, [
|
|
614
|
+
createVNode(_sfc_main$n),
|
|
615
|
+
createElementVNode("div", _hoisted_1$m, [
|
|
616
|
+
renderSlot(_ctx.$slots, "header"),
|
|
617
|
+
createElementVNode("div", {
|
|
618
|
+
class: normalizeClass(["cl-content-start cl-flex cl-flex-nowrap cl-items-stretch cl-max-h-screen cl-relative cl-w-full", {
|
|
619
|
+
"cl-pt-20": _ctx.$slots.header
|
|
620
|
+
}])
|
|
621
|
+
}, [
|
|
622
|
+
renderSlot(_ctx.$slots, "navigation"),
|
|
623
|
+
createElementVNode("div", {
|
|
624
|
+
class: normalizeClass(["cl-flex-grow cl-max-h-full cl-overflow-x-hidden cl-overflow-y-auto cl-w-auto", {
|
|
625
|
+
"md:cl-p-8": !__props.removePadding
|
|
626
|
+
}])
|
|
627
|
+
}, [
|
|
628
|
+
renderSlot(_ctx.$slots, "default")
|
|
629
|
+
], 2)
|
|
630
|
+
], 2)
|
|
631
|
+
])
|
|
632
|
+
], 64);
|
|
633
|
+
};
|
|
634
|
+
}
|
|
635
|
+
});
|
|
636
|
+
var clUiLoadingSpinner_vue_vue_type_style_index_0_scoped_true_lang = "";
|
|
637
|
+
var _export_sfc = (sfc, props) => {
|
|
638
|
+
for (const [key, val] of props) {
|
|
639
|
+
sfc[key] = val;
|
|
640
|
+
}
|
|
641
|
+
return sfc;
|
|
642
|
+
};
|
|
643
|
+
const _sfc_main$l = {};
|
|
644
|
+
const _hoisted_1$l = { class: "loading-spinner" };
|
|
645
|
+
function _sfc_render$2(_ctx, _cache) {
|
|
646
|
+
return openBlock(), createElementBlock("div", _hoisted_1$l);
|
|
647
|
+
}
|
|
648
|
+
var ClUiLoadingSpinner = /* @__PURE__ */ _export_sfc(_sfc_main$l, [["render", _sfc_render$2], ["__scopeId", "data-v-60d7cfd0"]]);
|
|
649
|
+
const _hoisted_1$k = ["disabled"];
|
|
650
|
+
const __default__$3 = {
|
|
651
|
+
inheritAttrs: false
|
|
652
|
+
};
|
|
653
|
+
function setup$3(__props) {
|
|
654
|
+
return (_ctx, _cache) => {
|
|
655
|
+
return openBlock(), createElementBlock(Fragment, null, [
|
|
656
|
+
withDirectives(createVNode(ClUiLoadingSpinner, { class: "cl-absolute" }, null, 512), [
|
|
657
|
+
[vShow, __props.loading]
|
|
658
|
+
]),
|
|
659
|
+
withDirectives(createElementVNode("button", mergeProps(_ctx.$attrs, {
|
|
660
|
+
class: ["cl-align-middle cl-border cl-font-semibold cl-inline-block cl-overflow-visible cl-rounded cl-shadow cl-text-center focus:cl-outline-none", {
|
|
661
|
+
"cl-leading-8 cl-px-4 cl-text-sm": __props.size === "small",
|
|
662
|
+
"cl-leading-10 cl-px-8 cl-text-sm": __props.size === "medium",
|
|
663
|
+
"cl-leading-10 cl-px-10 cl-py-2": __props.size === "large",
|
|
664
|
+
"cl-bg-white cl-border-grey-0 hover:cl-border-grey-2 cl-text-secondary": __props.colour === "default",
|
|
665
|
+
"cl-border-primary-default cl-bg-primary-default cl-text-white hover:cl-bg-primary-light hover:cl-border-primary-light": __props.colour === "primary",
|
|
666
|
+
"cl-border-secondary-default cl-bg-secondary-default cl-text-white hover:cl-bg-secondary-light hover:cl-border-secondary-light": __props.colour === "secondary",
|
|
667
|
+
"cl-border-danger-default cl-bg-danger-default cl-text-white hover:cl-bg-danger-dark hover:cl-border-danger-dark": __props.colour === "danger",
|
|
668
|
+
"cl-border-link-default cl-bg-link-default cl-text-white hover:cl-bg-link-light hover:cl-border-link-light": __props.colour === "blue",
|
|
669
|
+
"!cl-border-grey-3 !cl-bg-grey-3 cl-text-grey-0 hover:!cl-bg-grey-3 hover:!cl-border-grey-3 cl-cursor-default": __props.disabled
|
|
670
|
+
}],
|
|
671
|
+
disabled: __props.disabled
|
|
672
|
+
}), [
|
|
673
|
+
renderSlot(_ctx.$slots, "default")
|
|
674
|
+
], 16, _hoisted_1$k), [
|
|
675
|
+
[vShow, !__props.loading]
|
|
676
|
+
])
|
|
677
|
+
], 64);
|
|
678
|
+
};
|
|
679
|
+
}
|
|
680
|
+
const _sfc_main$k = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$3), {
|
|
681
|
+
props: {
|
|
682
|
+
colour: { default: "default" },
|
|
683
|
+
size: { default: "medium" },
|
|
684
|
+
loading: { default: false },
|
|
685
|
+
disabled: { default: false }
|
|
686
|
+
},
|
|
687
|
+
setup: setup$3
|
|
688
|
+
}));
|
|
689
|
+
const buttonColours = [
|
|
690
|
+
"default",
|
|
691
|
+
"primary",
|
|
692
|
+
"secondary",
|
|
693
|
+
"danger",
|
|
694
|
+
"blue"
|
|
695
|
+
];
|
|
696
|
+
const buttonSizes = [
|
|
697
|
+
"small",
|
|
698
|
+
"medium",
|
|
699
|
+
"large"
|
|
700
|
+
];
|
|
701
|
+
var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
|
|
702
|
+
var de = { exports: {} };
|
|
703
|
+
(function(module, exports) {
|
|
704
|
+
(function(global2, factory) {
|
|
705
|
+
factory(exports);
|
|
706
|
+
})(commonjsGlobal, function(exports2) {
|
|
707
|
+
var fp = typeof window !== "undefined" && window.flatpickr !== void 0 ? window.flatpickr : {
|
|
708
|
+
l10ns: {}
|
|
709
|
+
};
|
|
710
|
+
var German = {
|
|
711
|
+
weekdays: {
|
|
712
|
+
shorthand: ["So", "Mo", "Di", "Mi", "Do", "Fr", "Sa"],
|
|
713
|
+
longhand: [
|
|
714
|
+
"Sonntag",
|
|
715
|
+
"Montag",
|
|
716
|
+
"Dienstag",
|
|
717
|
+
"Mittwoch",
|
|
718
|
+
"Donnerstag",
|
|
719
|
+
"Freitag",
|
|
720
|
+
"Samstag"
|
|
721
|
+
]
|
|
722
|
+
},
|
|
723
|
+
months: {
|
|
724
|
+
shorthand: [
|
|
725
|
+
"Jan",
|
|
726
|
+
"Feb",
|
|
727
|
+
"M\xE4r",
|
|
728
|
+
"Apr",
|
|
729
|
+
"Mai",
|
|
730
|
+
"Jun",
|
|
731
|
+
"Jul",
|
|
732
|
+
"Aug",
|
|
733
|
+
"Sep",
|
|
734
|
+
"Okt",
|
|
735
|
+
"Nov",
|
|
736
|
+
"Dez"
|
|
737
|
+
],
|
|
738
|
+
longhand: [
|
|
739
|
+
"Januar",
|
|
740
|
+
"Februar",
|
|
741
|
+
"M\xE4rz",
|
|
742
|
+
"April",
|
|
743
|
+
"Mai",
|
|
744
|
+
"Juni",
|
|
745
|
+
"Juli",
|
|
746
|
+
"August",
|
|
747
|
+
"September",
|
|
748
|
+
"Oktober",
|
|
749
|
+
"November",
|
|
750
|
+
"Dezember"
|
|
751
|
+
]
|
|
752
|
+
},
|
|
753
|
+
firstDayOfWeek: 1,
|
|
754
|
+
weekAbbreviation: "KW",
|
|
755
|
+
rangeSeparator: " bis ",
|
|
756
|
+
scrollTitle: "Zum \xC4ndern scrollen",
|
|
757
|
+
toggleTitle: "Zum Umschalten klicken",
|
|
758
|
+
time_24hr: true
|
|
759
|
+
};
|
|
760
|
+
fp.l10ns.de = German;
|
|
761
|
+
var de2 = fp.l10ns;
|
|
762
|
+
exports2.German = German;
|
|
763
|
+
exports2.default = de2;
|
|
764
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
765
|
+
});
|
|
766
|
+
})(de, de.exports);
|
|
767
|
+
var _default = { exports: {} };
|
|
768
|
+
(function(module, exports) {
|
|
769
|
+
(function(global2, factory) {
|
|
770
|
+
factory(exports);
|
|
771
|
+
})(commonjsGlobal, function(exports2) {
|
|
772
|
+
var english = {
|
|
773
|
+
weekdays: {
|
|
774
|
+
shorthand: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
|
|
775
|
+
longhand: [
|
|
776
|
+
"Sunday",
|
|
777
|
+
"Monday",
|
|
778
|
+
"Tuesday",
|
|
779
|
+
"Wednesday",
|
|
780
|
+
"Thursday",
|
|
781
|
+
"Friday",
|
|
782
|
+
"Saturday"
|
|
783
|
+
]
|
|
784
|
+
},
|
|
785
|
+
months: {
|
|
786
|
+
shorthand: [
|
|
787
|
+
"Jan",
|
|
788
|
+
"Feb",
|
|
789
|
+
"Mar",
|
|
790
|
+
"Apr",
|
|
791
|
+
"May",
|
|
792
|
+
"Jun",
|
|
793
|
+
"Jul",
|
|
794
|
+
"Aug",
|
|
795
|
+
"Sep",
|
|
796
|
+
"Oct",
|
|
797
|
+
"Nov",
|
|
798
|
+
"Dec"
|
|
799
|
+
],
|
|
800
|
+
longhand: [
|
|
801
|
+
"January",
|
|
802
|
+
"February",
|
|
803
|
+
"March",
|
|
804
|
+
"April",
|
|
805
|
+
"May",
|
|
806
|
+
"June",
|
|
807
|
+
"July",
|
|
808
|
+
"August",
|
|
809
|
+
"September",
|
|
810
|
+
"October",
|
|
811
|
+
"November",
|
|
812
|
+
"December"
|
|
813
|
+
]
|
|
814
|
+
},
|
|
815
|
+
daysInMonth: [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31],
|
|
816
|
+
firstDayOfWeek: 0,
|
|
817
|
+
ordinal: function(nth) {
|
|
818
|
+
var s = nth % 100;
|
|
819
|
+
if (s > 3 && s < 21)
|
|
820
|
+
return "th";
|
|
821
|
+
switch (s % 10) {
|
|
822
|
+
case 1:
|
|
823
|
+
return "st";
|
|
824
|
+
case 2:
|
|
825
|
+
return "nd";
|
|
826
|
+
case 3:
|
|
827
|
+
return "rd";
|
|
828
|
+
default:
|
|
829
|
+
return "th";
|
|
830
|
+
}
|
|
831
|
+
},
|
|
832
|
+
rangeSeparator: " to ",
|
|
833
|
+
weekAbbreviation: "Wk",
|
|
834
|
+
scrollTitle: "Scroll to increment",
|
|
835
|
+
toggleTitle: "Click to toggle",
|
|
836
|
+
amPM: ["AM", "PM"],
|
|
837
|
+
yearAriaLabel: "Year",
|
|
838
|
+
monthAriaLabel: "Month",
|
|
839
|
+
hourAriaLabel: "Hour",
|
|
840
|
+
minuteAriaLabel: "Minute",
|
|
841
|
+
time_24hr: false
|
|
842
|
+
};
|
|
843
|
+
exports2.default = english;
|
|
844
|
+
exports2.english = english;
|
|
845
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
846
|
+
});
|
|
847
|
+
})(_default, _default.exports);
|
|
848
|
+
var es = { exports: {} };
|
|
849
|
+
(function(module, exports) {
|
|
850
|
+
(function(global2, factory) {
|
|
851
|
+
factory(exports);
|
|
852
|
+
})(commonjsGlobal, function(exports2) {
|
|
853
|
+
var fp = typeof window !== "undefined" && window.flatpickr !== void 0 ? window.flatpickr : {
|
|
854
|
+
l10ns: {}
|
|
855
|
+
};
|
|
856
|
+
var Spanish = {
|
|
857
|
+
weekdays: {
|
|
858
|
+
shorthand: ["Dom", "Lun", "Mar", "Mi\xE9", "Jue", "Vie", "S\xE1b"],
|
|
859
|
+
longhand: [
|
|
860
|
+
"Domingo",
|
|
861
|
+
"Lunes",
|
|
862
|
+
"Martes",
|
|
863
|
+
"Mi\xE9rcoles",
|
|
864
|
+
"Jueves",
|
|
865
|
+
"Viernes",
|
|
866
|
+
"S\xE1bado"
|
|
867
|
+
]
|
|
868
|
+
},
|
|
869
|
+
months: {
|
|
870
|
+
shorthand: [
|
|
871
|
+
"Ene",
|
|
872
|
+
"Feb",
|
|
873
|
+
"Mar",
|
|
874
|
+
"Abr",
|
|
875
|
+
"May",
|
|
876
|
+
"Jun",
|
|
877
|
+
"Jul",
|
|
878
|
+
"Ago",
|
|
879
|
+
"Sep",
|
|
880
|
+
"Oct",
|
|
881
|
+
"Nov",
|
|
882
|
+
"Dic"
|
|
883
|
+
],
|
|
884
|
+
longhand: [
|
|
885
|
+
"Enero",
|
|
886
|
+
"Febrero",
|
|
887
|
+
"Marzo",
|
|
888
|
+
"Abril",
|
|
889
|
+
"Mayo",
|
|
890
|
+
"Junio",
|
|
891
|
+
"Julio",
|
|
892
|
+
"Agosto",
|
|
893
|
+
"Septiembre",
|
|
894
|
+
"Octubre",
|
|
895
|
+
"Noviembre",
|
|
896
|
+
"Diciembre"
|
|
897
|
+
]
|
|
898
|
+
},
|
|
899
|
+
ordinal: function() {
|
|
900
|
+
return "\xBA";
|
|
901
|
+
},
|
|
902
|
+
firstDayOfWeek: 1,
|
|
903
|
+
rangeSeparator: " a ",
|
|
904
|
+
time_24hr: true
|
|
905
|
+
};
|
|
906
|
+
fp.l10ns.es = Spanish;
|
|
907
|
+
var es2 = fp.l10ns;
|
|
908
|
+
exports2.Spanish = Spanish;
|
|
909
|
+
exports2.default = es2;
|
|
910
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
911
|
+
});
|
|
912
|
+
})(es, es.exports);
|
|
913
|
+
var fr = { exports: {} };
|
|
914
|
+
(function(module, exports) {
|
|
915
|
+
(function(global2, factory) {
|
|
916
|
+
factory(exports);
|
|
917
|
+
})(commonjsGlobal, function(exports2) {
|
|
918
|
+
var fp = typeof window !== "undefined" && window.flatpickr !== void 0 ? window.flatpickr : {
|
|
919
|
+
l10ns: {}
|
|
920
|
+
};
|
|
921
|
+
var French = {
|
|
922
|
+
firstDayOfWeek: 1,
|
|
923
|
+
weekdays: {
|
|
924
|
+
shorthand: ["dim", "lun", "mar", "mer", "jeu", "ven", "sam"],
|
|
925
|
+
longhand: [
|
|
926
|
+
"dimanche",
|
|
927
|
+
"lundi",
|
|
928
|
+
"mardi",
|
|
929
|
+
"mercredi",
|
|
930
|
+
"jeudi",
|
|
931
|
+
"vendredi",
|
|
932
|
+
"samedi"
|
|
933
|
+
]
|
|
934
|
+
},
|
|
935
|
+
months: {
|
|
936
|
+
shorthand: [
|
|
937
|
+
"janv",
|
|
938
|
+
"f\xE9vr",
|
|
939
|
+
"mars",
|
|
940
|
+
"avr",
|
|
941
|
+
"mai",
|
|
942
|
+
"juin",
|
|
943
|
+
"juil",
|
|
944
|
+
"ao\xFBt",
|
|
945
|
+
"sept",
|
|
946
|
+
"oct",
|
|
947
|
+
"nov",
|
|
948
|
+
"d\xE9c"
|
|
949
|
+
],
|
|
950
|
+
longhand: [
|
|
951
|
+
"janvier",
|
|
952
|
+
"f\xE9vrier",
|
|
953
|
+
"mars",
|
|
954
|
+
"avril",
|
|
955
|
+
"mai",
|
|
956
|
+
"juin",
|
|
957
|
+
"juillet",
|
|
958
|
+
"ao\xFBt",
|
|
959
|
+
"septembre",
|
|
960
|
+
"octobre",
|
|
961
|
+
"novembre",
|
|
962
|
+
"d\xE9cembre"
|
|
963
|
+
]
|
|
964
|
+
},
|
|
965
|
+
ordinal: function(nth) {
|
|
966
|
+
if (nth > 1)
|
|
967
|
+
return "";
|
|
968
|
+
return "er";
|
|
969
|
+
},
|
|
970
|
+
rangeSeparator: " au ",
|
|
971
|
+
weekAbbreviation: "Sem",
|
|
972
|
+
scrollTitle: "D\xE9filer pour augmenter la valeur",
|
|
973
|
+
toggleTitle: "Cliquer pour basculer",
|
|
974
|
+
time_24hr: true
|
|
975
|
+
};
|
|
976
|
+
fp.l10ns.fr = French;
|
|
977
|
+
var fr2 = fp.l10ns;
|
|
978
|
+
exports2.French = French;
|
|
979
|
+
exports2.default = fr2;
|
|
980
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
981
|
+
});
|
|
982
|
+
})(fr, fr.exports);
|
|
983
|
+
var it = { exports: {} };
|
|
984
|
+
(function(module, exports) {
|
|
985
|
+
(function(global2, factory) {
|
|
986
|
+
factory(exports);
|
|
987
|
+
})(commonjsGlobal, function(exports2) {
|
|
988
|
+
var fp = typeof window !== "undefined" && window.flatpickr !== void 0 ? window.flatpickr : {
|
|
989
|
+
l10ns: {}
|
|
990
|
+
};
|
|
991
|
+
var Italian = {
|
|
992
|
+
weekdays: {
|
|
993
|
+
shorthand: ["Dom", "Lun", "Mar", "Mer", "Gio", "Ven", "Sab"],
|
|
994
|
+
longhand: [
|
|
995
|
+
"Domenica",
|
|
996
|
+
"Luned\xEC",
|
|
997
|
+
"Marted\xEC",
|
|
998
|
+
"Mercoled\xEC",
|
|
999
|
+
"Gioved\xEC",
|
|
1000
|
+
"Venerd\xEC",
|
|
1001
|
+
"Sabato"
|
|
1002
|
+
]
|
|
1003
|
+
},
|
|
1004
|
+
months: {
|
|
1005
|
+
shorthand: [
|
|
1006
|
+
"Gen",
|
|
1007
|
+
"Feb",
|
|
1008
|
+
"Mar",
|
|
1009
|
+
"Apr",
|
|
1010
|
+
"Mag",
|
|
1011
|
+
"Giu",
|
|
1012
|
+
"Lug",
|
|
1013
|
+
"Ago",
|
|
1014
|
+
"Set",
|
|
1015
|
+
"Ott",
|
|
1016
|
+
"Nov",
|
|
1017
|
+
"Dic"
|
|
1018
|
+
],
|
|
1019
|
+
longhand: [
|
|
1020
|
+
"Gennaio",
|
|
1021
|
+
"Febbraio",
|
|
1022
|
+
"Marzo",
|
|
1023
|
+
"Aprile",
|
|
1024
|
+
"Maggio",
|
|
1025
|
+
"Giugno",
|
|
1026
|
+
"Luglio",
|
|
1027
|
+
"Agosto",
|
|
1028
|
+
"Settembre",
|
|
1029
|
+
"Ottobre",
|
|
1030
|
+
"Novembre",
|
|
1031
|
+
"Dicembre"
|
|
1032
|
+
]
|
|
1033
|
+
},
|
|
1034
|
+
firstDayOfWeek: 1,
|
|
1035
|
+
ordinal: function() {
|
|
1036
|
+
return "\xB0";
|
|
1037
|
+
},
|
|
1038
|
+
rangeSeparator: " al ",
|
|
1039
|
+
weekAbbreviation: "Se",
|
|
1040
|
+
scrollTitle: "Scrolla per aumentare",
|
|
1041
|
+
toggleTitle: "Clicca per cambiare",
|
|
1042
|
+
time_24hr: true
|
|
1043
|
+
};
|
|
1044
|
+
fp.l10ns.it = Italian;
|
|
1045
|
+
var it2 = fp.l10ns;
|
|
1046
|
+
exports2.Italian = Italian;
|
|
1047
|
+
exports2.default = it2;
|
|
1048
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
1049
|
+
});
|
|
1050
|
+
})(it, it.exports);
|
|
1051
|
+
var nl = { exports: {} };
|
|
1052
|
+
(function(module, exports) {
|
|
1053
|
+
(function(global2, factory) {
|
|
1054
|
+
factory(exports);
|
|
1055
|
+
})(commonjsGlobal, function(exports2) {
|
|
1056
|
+
var fp = typeof window !== "undefined" && window.flatpickr !== void 0 ? window.flatpickr : {
|
|
1057
|
+
l10ns: {}
|
|
1058
|
+
};
|
|
1059
|
+
var Dutch = {
|
|
1060
|
+
weekdays: {
|
|
1061
|
+
shorthand: ["zo", "ma", "di", "wo", "do", "vr", "za"],
|
|
1062
|
+
longhand: [
|
|
1063
|
+
"zondag",
|
|
1064
|
+
"maandag",
|
|
1065
|
+
"dinsdag",
|
|
1066
|
+
"woensdag",
|
|
1067
|
+
"donderdag",
|
|
1068
|
+
"vrijdag",
|
|
1069
|
+
"zaterdag"
|
|
1070
|
+
]
|
|
1071
|
+
},
|
|
1072
|
+
months: {
|
|
1073
|
+
shorthand: [
|
|
1074
|
+
"jan",
|
|
1075
|
+
"feb",
|
|
1076
|
+
"mrt",
|
|
1077
|
+
"apr",
|
|
1078
|
+
"mei",
|
|
1079
|
+
"jun",
|
|
1080
|
+
"jul",
|
|
1081
|
+
"aug",
|
|
1082
|
+
"sept",
|
|
1083
|
+
"okt",
|
|
1084
|
+
"nov",
|
|
1085
|
+
"dec"
|
|
1086
|
+
],
|
|
1087
|
+
longhand: [
|
|
1088
|
+
"januari",
|
|
1089
|
+
"februari",
|
|
1090
|
+
"maart",
|
|
1091
|
+
"april",
|
|
1092
|
+
"mei",
|
|
1093
|
+
"juni",
|
|
1094
|
+
"juli",
|
|
1095
|
+
"augustus",
|
|
1096
|
+
"september",
|
|
1097
|
+
"oktober",
|
|
1098
|
+
"november",
|
|
1099
|
+
"december"
|
|
1100
|
+
]
|
|
1101
|
+
},
|
|
1102
|
+
firstDayOfWeek: 1,
|
|
1103
|
+
weekAbbreviation: "wk",
|
|
1104
|
+
rangeSeparator: " t/m ",
|
|
1105
|
+
scrollTitle: "Scroll voor volgende / vorige",
|
|
1106
|
+
toggleTitle: "Klik om te wisselen",
|
|
1107
|
+
time_24hr: true,
|
|
1108
|
+
ordinal: function(nth) {
|
|
1109
|
+
if (nth === 1 || nth === 8 || nth >= 20)
|
|
1110
|
+
return "ste";
|
|
1111
|
+
return "de";
|
|
1112
|
+
}
|
|
1113
|
+
};
|
|
1114
|
+
fp.l10ns.nl = Dutch;
|
|
1115
|
+
var nl2 = fp.l10ns;
|
|
1116
|
+
exports2.Dutch = Dutch;
|
|
1117
|
+
exports2.default = nl2;
|
|
1118
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
1119
|
+
});
|
|
1120
|
+
})(nl, nl.exports);
|
|
1121
|
+
var FixedDate;
|
|
1122
|
+
(function(FixedDate2) {
|
|
1123
|
+
FixedDate2["YEAR"] = "1990";
|
|
1124
|
+
FixedDate2["MONTH"] = "01";
|
|
1125
|
+
FixedDate2["MONTH_SHORT"] = "1";
|
|
1126
|
+
FixedDate2["DAY"] = "02";
|
|
1127
|
+
FixedDate2["DAY_SHORT"] = "2";
|
|
1128
|
+
FixedDate2["HOUR"] = "12";
|
|
1129
|
+
FixedDate2["MINUTE"] = "05";
|
|
1130
|
+
FixedDate2["SUFFIX"] = "PM";
|
|
1131
|
+
})(FixedDate || (FixedDate = {}));
|
|
1132
|
+
function generateFixedDate() {
|
|
1133
|
+
return new Date(`${FixedDate.YEAR}-${FixedDate.MONTH}-${FixedDate.DAY}T${FixedDate.HOUR}:${FixedDate.MINUTE}`);
|
|
1134
|
+
}
|
|
1135
|
+
function replaceDateWithPlaceholders(date, hourPlaceholder, yearPlaceholder) {
|
|
1136
|
+
return date.replace(FixedDate.YEAR, yearPlaceholder).replace(FixedDate.HOUR, hourPlaceholder).replace(FixedDate.MONTH, "m").replace(FixedDate.MONTH_SHORT, "n").replace(FixedDate.DAY, "d").replace(FixedDate.DAY_SHORT, "j").replace(FixedDate.MINUTE, "i").replace(FixedDate.SUFFIX, "K").replace(",", "");
|
|
1137
|
+
}
|
|
1138
|
+
function getLocale(locale) {
|
|
1139
|
+
let result;
|
|
1140
|
+
switch (locale) {
|
|
1141
|
+
case "de-DE":
|
|
1142
|
+
result = de.exports.German;
|
|
1143
|
+
break;
|
|
1144
|
+
case "fr-FR":
|
|
1145
|
+
result = fr.exports.French;
|
|
1146
|
+
break;
|
|
1147
|
+
case "nl-NL":
|
|
1148
|
+
result = nl.exports.Dutch;
|
|
1149
|
+
break;
|
|
1150
|
+
case "it-IT":
|
|
1151
|
+
result = it.exports.Italian;
|
|
1152
|
+
break;
|
|
1153
|
+
case "es-ES":
|
|
1154
|
+
result = es.exports.Spanish;
|
|
1155
|
+
break;
|
|
1156
|
+
default:
|
|
1157
|
+
result = _default.exports.english;
|
|
1158
|
+
break;
|
|
1159
|
+
}
|
|
1160
|
+
return result;
|
|
1161
|
+
}
|
|
1162
|
+
var clUiCalendar_vue_vue_type_style_index_0_lang = "";
|
|
1163
|
+
const _hoisted_1$j = ["placeholder", "disabled"];
|
|
1164
|
+
const _hoisted_2$i = { class: "cl-absolute cl-bg-white cl-flex cl-right-2 cl-text-grey-4 cl-top-3" };
|
|
1165
|
+
const _sfc_main$j = /* @__PURE__ */ defineComponent({
|
|
1166
|
+
props: {
|
|
1167
|
+
date: { default: () => null },
|
|
1168
|
+
datePlaceholder: { default: "Select date." },
|
|
1169
|
+
dateTimePlaceholder: { default: "Select date & time." },
|
|
1170
|
+
type: { default: "datetime" },
|
|
1171
|
+
disabled: { default: false }
|
|
1172
|
+
},
|
|
1173
|
+
emits: {
|
|
1174
|
+
"update:date": null
|
|
1175
|
+
},
|
|
1176
|
+
setup(__props, { emit }) {
|
|
1177
|
+
const props = __props;
|
|
1178
|
+
const { d, getDateTimeFormat, locale } = useI18n();
|
|
1179
|
+
const flatpickrInstance = ref(null);
|
|
1180
|
+
const element = ref(null);
|
|
1181
|
+
const internalDate = computed(() => d(generateFixedDate(), props.type));
|
|
1182
|
+
const dateFormat = computed(() => getDateTimeFormat(locale.value)[props.type]);
|
|
1183
|
+
const format = computed(() => {
|
|
1184
|
+
var _a, _b;
|
|
1185
|
+
let hourPlaceholder = "H";
|
|
1186
|
+
let yearPlaceholder = "Y";
|
|
1187
|
+
if (((_a = dateFormat.value) == null ? void 0 : _a.hour12) === true) {
|
|
1188
|
+
hourPlaceholder = "h";
|
|
1189
|
+
}
|
|
1190
|
+
if (((_b = dateFormat.value) == null ? void 0 : _b.year) === "2-digit") {
|
|
1191
|
+
yearPlaceholder = "y";
|
|
1192
|
+
}
|
|
1193
|
+
return replaceDateWithPlaceholders(internalDate.value, hourPlaceholder, yearPlaceholder);
|
|
1194
|
+
});
|
|
1195
|
+
const options = computed(() => {
|
|
1196
|
+
var _a, _b;
|
|
1197
|
+
const config = __spreadProps(__spreadValues({}, Flatpickr.defaultConfig), {
|
|
1198
|
+
allowInput: true,
|
|
1199
|
+
dateFormat: format.value,
|
|
1200
|
+
disableMobile: true,
|
|
1201
|
+
enableTime: props.type === DateFormat.DATETIME,
|
|
1202
|
+
locale: getLocale(locale.value),
|
|
1203
|
+
minuteIncrement: 1,
|
|
1204
|
+
monthSelectorType: "static",
|
|
1205
|
+
time_24hr: typeof ((_a = dateFormat.value) == null ? void 0 : _a.hour12) === "undefined" || ((_b = dateFormat.value) == null ? void 0 : _b.hour12) === false
|
|
1206
|
+
});
|
|
1207
|
+
if (props.date !== null) {
|
|
1208
|
+
config.defaultDate = props.date;
|
|
1209
|
+
}
|
|
1210
|
+
return config;
|
|
1211
|
+
});
|
|
1212
|
+
function onChange(selectedDates, _date, _instance) {
|
|
1213
|
+
emit("update:date", selectedDates.length > 0 ? selectedDates[0] : null);
|
|
1214
|
+
}
|
|
1215
|
+
function clearValue() {
|
|
1216
|
+
emit("update:date", null);
|
|
1217
|
+
}
|
|
1218
|
+
function resetValue() {
|
|
1219
|
+
if (flatpickrInstance.value !== null) {
|
|
1220
|
+
const date = new Date();
|
|
1221
|
+
date.setHours(12, 0, 0, 0);
|
|
1222
|
+
emit("update:date", date);
|
|
1223
|
+
}
|
|
1224
|
+
}
|
|
1225
|
+
function createInstance() {
|
|
1226
|
+
if (flatpickrInstance.value === null && element.value !== null) {
|
|
1227
|
+
flatpickrInstance.value = Flatpickr(element.value, options.value);
|
|
1228
|
+
flatpickrInstance.value.config.onChange.push(onChange);
|
|
1229
|
+
}
|
|
1230
|
+
}
|
|
1231
|
+
function updateInstance() {
|
|
1232
|
+
if (flatpickrInstance.value !== null) {
|
|
1233
|
+
flatpickrInstance.value.set(options.value);
|
|
1234
|
+
flatpickrInstance.value.config.onChange.push(onChange);
|
|
1235
|
+
}
|
|
1236
|
+
}
|
|
1237
|
+
function updateInstanceValue(value) {
|
|
1238
|
+
if (flatpickrInstance.value !== null) {
|
|
1239
|
+
flatpickrInstance.value.setDate(value, true);
|
|
1240
|
+
}
|
|
1241
|
+
}
|
|
1242
|
+
function clearInstanceValue() {
|
|
1243
|
+
if (flatpickrInstance.value !== null) {
|
|
1244
|
+
flatpickrInstance.value.clear();
|
|
1245
|
+
}
|
|
1246
|
+
}
|
|
1247
|
+
function destroyInstance() {
|
|
1248
|
+
if (flatpickrInstance.value !== null) {
|
|
1249
|
+
flatpickrInstance.value.destroy();
|
|
1250
|
+
flatpickrInstance.value = null;
|
|
1251
|
+
}
|
|
1252
|
+
}
|
|
1253
|
+
watch(() => props.date, (newValue, oldValue) => {
|
|
1254
|
+
if (newValue !== null && oldValue !== null) {
|
|
1255
|
+
if (newValue.getTime() !== oldValue.getTime()) {
|
|
1256
|
+
updateInstanceValue(newValue);
|
|
1257
|
+
}
|
|
1258
|
+
} else if (newValue === null && oldValue !== null) {
|
|
1259
|
+
clearInstanceValue();
|
|
1260
|
+
}
|
|
1261
|
+
}, {
|
|
1262
|
+
deep: true
|
|
1263
|
+
});
|
|
1264
|
+
watch(() => options.value, updateInstance, {
|
|
1265
|
+
deep: true
|
|
1266
|
+
});
|
|
1267
|
+
watch(() => props.type, () => {
|
|
1268
|
+
destroyInstance();
|
|
1269
|
+
nextTick(() => createInstance());
|
|
1270
|
+
}, {
|
|
1271
|
+
immediate: false
|
|
1272
|
+
});
|
|
1273
|
+
onMounted(() => createInstance());
|
|
1274
|
+
onUnmounted(() => destroyInstance());
|
|
1275
|
+
return (_ctx, _cache) => {
|
|
1276
|
+
const _component_icon = resolveComponent("icon");
|
|
1277
|
+
return openBlock(), createElementBlock("div", mergeProps(_ctx.$attrs, { class: "cl-relative" }), [
|
|
1278
|
+
createElementVNode("input", mergeProps({
|
|
1279
|
+
ref: (_value, _refs) => {
|
|
1280
|
+
_refs["element"] = _value;
|
|
1281
|
+
element.value = _value;
|
|
1282
|
+
}
|
|
1283
|
+
}, _ctx.$attrs, {
|
|
1284
|
+
class: ["!cl-text-sm md:!cl-text-base", {
|
|
1285
|
+
"!cl-pr-12": __props.date !== null,
|
|
1286
|
+
"!cl-pr-8": __props.date === null
|
|
1287
|
+
}],
|
|
1288
|
+
type: "text",
|
|
1289
|
+
placeholder: __props.type === "date" ? __props.datePlaceholder : __props.dateTimePlaceholder,
|
|
1290
|
+
disabled: __props.disabled
|
|
1291
|
+
}), null, 16, _hoisted_1$j),
|
|
1292
|
+
withDirectives(createVNode(_component_icon, {
|
|
1293
|
+
class: "cl-absolute cl-bg-white cl-right-2 cl-text-grey-4 cl-top-3",
|
|
1294
|
+
icon: "ph:calendar",
|
|
1295
|
+
weight: "light",
|
|
1296
|
+
size: 18
|
|
1297
|
+
}, null, 512), [
|
|
1298
|
+
[vShow, __props.date === null || __props.disabled]
|
|
1299
|
+
]),
|
|
1300
|
+
withDirectives(createElementVNode("div", _hoisted_2$i, [
|
|
1301
|
+
createVNode(_component_icon, {
|
|
1302
|
+
class: "cl-cursor-pointer cl-mr-0.5 md:cl-mr-1",
|
|
1303
|
+
icon: "ph:arrow-counter-clockwise",
|
|
1304
|
+
size: 16,
|
|
1305
|
+
onClick: resetValue
|
|
1306
|
+
}),
|
|
1307
|
+
createVNode(_component_icon, {
|
|
1308
|
+
class: "cl-cursor-pointer",
|
|
1309
|
+
icon: "ph:x",
|
|
1310
|
+
size: 16,
|
|
1311
|
+
onClick: clearValue
|
|
1312
|
+
})
|
|
1313
|
+
], 512), [
|
|
1314
|
+
[vShow, __props.date !== null && !__props.disabled]
|
|
1315
|
+
])
|
|
1316
|
+
], 16);
|
|
1317
|
+
};
|
|
1318
|
+
}
|
|
1319
|
+
});
|
|
1320
|
+
const calendarTypes = [
|
|
1321
|
+
"date",
|
|
1322
|
+
"datetime"
|
|
1323
|
+
];
|
|
1324
|
+
const _hoisted_1$i = { key: 0 };
|
|
1325
|
+
const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
1326
|
+
props: {
|
|
1327
|
+
size: { default: "medium" },
|
|
1328
|
+
hover: { default: false }
|
|
1329
|
+
},
|
|
1330
|
+
setup(__props) {
|
|
1331
|
+
return (_ctx, _cache) => {
|
|
1332
|
+
return openBlock(), createElementBlock("div", {
|
|
1333
|
+
class: normalizeClass(["cl-border-grey-0 cl-overflow-hidden cl-relative cl-rounded-md cl-shadow-lg", {
|
|
1334
|
+
"cl-cursor-pointer hover:cl-shadow-xl hover:cl-border": __props.hover
|
|
1335
|
+
}])
|
|
1336
|
+
}, [
|
|
1337
|
+
_ctx.$slots.image ? (openBlock(), createElementBlock("div", _hoisted_1$i, [
|
|
1338
|
+
renderSlot(_ctx.$slots, "image")
|
|
1339
|
+
])) : createCommentVNode("", true),
|
|
1340
|
+
_ctx.$slots.title ? (openBlock(), createElementBlock("div", {
|
|
1341
|
+
key: 1,
|
|
1342
|
+
class: normalizeClass(["cl-border-grey-2 cl-font-normal", {
|
|
1343
|
+
"cl-p-2 cl-text-2xl cl-leading-8": __props.size === "small",
|
|
1344
|
+
"cl-p-4 cl-text-3xl cl-leading-9": __props.size === "medium",
|
|
1345
|
+
"cl-p-6 cl-text-4xl cl-leading-10": __props.size === "large",
|
|
1346
|
+
"cl-border-t": _ctx.$slots.image
|
|
1347
|
+
}])
|
|
1348
|
+
}, [
|
|
1349
|
+
renderSlot(_ctx.$slots, "title")
|
|
1350
|
+
], 2)) : createCommentVNode("", true),
|
|
1351
|
+
createElementVNode("div", {
|
|
1352
|
+
class: normalizeClass(["cl-border-grey-2", {
|
|
1353
|
+
"cl-p-2": __props.size === "small",
|
|
1354
|
+
"cl-p-4": __props.size === "medium",
|
|
1355
|
+
"cl-p-6": __props.size === "large",
|
|
1356
|
+
"cl-border-t": _ctx.$slots.image || _ctx.$slots.title
|
|
1357
|
+
}])
|
|
1358
|
+
}, [
|
|
1359
|
+
renderSlot(_ctx.$slots, "default")
|
|
1360
|
+
], 2),
|
|
1361
|
+
_ctx.$slots.footer ? (openBlock(), createElementBlock("div", {
|
|
1362
|
+
key: 2,
|
|
1363
|
+
class: normalizeClass(["cl-border-grey-2 cl-border-t", {
|
|
1364
|
+
"cl-p-2": __props.size === "small",
|
|
1365
|
+
"cl-p-4": __props.size === "medium",
|
|
1366
|
+
"cl-p-6": __props.size === "large"
|
|
1367
|
+
}])
|
|
1368
|
+
}, [
|
|
1369
|
+
renderSlot(_ctx.$slots, "footer")
|
|
1370
|
+
], 2)) : createCommentVNode("", true)
|
|
1371
|
+
], 2);
|
|
1372
|
+
};
|
|
1373
|
+
}
|
|
1374
|
+
});
|
|
1375
|
+
const cardSizes = [
|
|
1376
|
+
"small",
|
|
1377
|
+
"medium",
|
|
1378
|
+
"large"
|
|
1379
|
+
];
|
|
1380
|
+
const _hoisted_1$h = { class: "cl-align-items-center cl-bg-black cl-bg-opacity-40 cl-bottom-0 cl-fixed cl-flex cl-h-full cl-justify-center cl-left-0 cl-right-0 cl-top-0 cl-w-full cl-z-40" };
|
|
1381
|
+
const _hoisted_2$h = { class: "cl-border-b cl-border-grey-2 cl-font-semibold cl-h-11 cl-leading-10 cl-overflow-ellipsis cl-overflow-hidden cl-pl-2 cl-pr-8 cl-text-2xl cl-w-full cl-whitespace-nowrap" };
|
|
1382
|
+
const _hoisted_3$e = { class: "cl-p-2 cl-text-right cl-text-sm cl-w-full" };
|
|
1383
|
+
const __default__$2 = {
|
|
1384
|
+
inheritAttrs: false
|
|
1385
|
+
};
|
|
1386
|
+
function setup$2(__props, { emit }) {
|
|
1387
|
+
const props = __props;
|
|
1388
|
+
const visible = ref(false);
|
|
1389
|
+
const showConfirmButton = computed(() => props.confirmButton !== "");
|
|
1390
|
+
const showCancelButton = computed(() => props.cancelButton !== "");
|
|
1391
|
+
function getButtonText(buttonValue) {
|
|
1392
|
+
return typeof buttonValue === "string" ? buttonValue : "";
|
|
1393
|
+
}
|
|
1394
|
+
const confirmButtonText = computed(() => getButtonText(props.confirmButton));
|
|
1395
|
+
const cancelButtonText = computed(() => getButtonText(props.cancelButton));
|
|
1396
|
+
function toggleModal(show) {
|
|
1397
|
+
visible.value = typeof show !== "undefined" ? show : !visible.value;
|
|
1398
|
+
}
|
|
1399
|
+
function modalAction(action) {
|
|
1400
|
+
toggleModal(false);
|
|
1401
|
+
if (action) {
|
|
1402
|
+
emit("confirm", action);
|
|
1403
|
+
} else {
|
|
1404
|
+
emit("cancel", action);
|
|
1405
|
+
}
|
|
1406
|
+
}
|
|
1407
|
+
return (_ctx, _cache) => {
|
|
1408
|
+
const _component_icon = resolveComponent("icon");
|
|
1409
|
+
return openBlock(), createElementBlock(Fragment, null, [
|
|
1410
|
+
renderSlot(_ctx.$slots, "trigger", normalizeProps(guardReactiveProps({ toggleModal }))),
|
|
1411
|
+
(openBlock(), createBlock(Teleport, { to: "body" }, [
|
|
1412
|
+
withDirectives(createElementVNode("div", _hoisted_1$h, [
|
|
1413
|
+
createElementVNode("div", mergeProps(_ctx.$attrs, {
|
|
1414
|
+
class: ["cl-bg-white cl-flex cl-flex-wrap cl-mx-0 cl-my-auto cl-overflow-y-auto cl-relative cl-rounded cl-shadow-lg", {
|
|
1415
|
+
"lg:cl-w-2/12 cl-w-10/12": __props.size === "x-small",
|
|
1416
|
+
"cl-w-6/12": __props.size === "small",
|
|
1417
|
+
"cl-w-8/12": __props.size === "medium",
|
|
1418
|
+
"cl-w-10/12": __props.size === "large"
|
|
1419
|
+
}]
|
|
1420
|
+
}), [
|
|
1421
|
+
createElementVNode("div", {
|
|
1422
|
+
class: "cl-absolute cl-cursor-pointer cl-h-2 cl-leading-5 cl-right-3 cl-text-black cl-text-center cl-top-3 cl-w-5",
|
|
1423
|
+
onClick: _cache[0] || (_cache[0] = ($event) => modalAction(false))
|
|
1424
|
+
}, [
|
|
1425
|
+
createVNode(_component_icon, {
|
|
1426
|
+
icon: "ph:x",
|
|
1427
|
+
size: 20
|
|
1428
|
+
})
|
|
1429
|
+
]),
|
|
1430
|
+
createElementVNode("div", _hoisted_2$h, toDisplayString(__props.title), 1),
|
|
1431
|
+
createElementVNode("div", mergeProps({ class: "cl-overflow-y-auto cl-p-2 cl-w-full" }, { toggleModal }), [
|
|
1432
|
+
renderSlot(_ctx.$slots, "default")
|
|
1433
|
+
], 16),
|
|
1434
|
+
withDirectives(createElementVNode("div", _hoisted_3$e, [
|
|
1435
|
+
unref(showConfirmButton) ? (openBlock(), createBlock(_sfc_main$k, {
|
|
1436
|
+
key: 0,
|
|
1437
|
+
class: "cl-mr-2",
|
|
1438
|
+
colour: "primary",
|
|
1439
|
+
size: "small",
|
|
1440
|
+
disabled: __props.confirmEnabled === false,
|
|
1441
|
+
onClick: _cache[1] || (_cache[1] = withModifiers(($event) => modalAction(true), ["prevent"]))
|
|
1442
|
+
}, {
|
|
1443
|
+
default: withCtx(() => [
|
|
1444
|
+
createTextVNode(toDisplayString(unref(confirmButtonText)), 1)
|
|
1445
|
+
]),
|
|
1446
|
+
_: 1
|
|
1447
|
+
}, 8, ["disabled"])) : createCommentVNode("", true),
|
|
1448
|
+
unref(showCancelButton) ? (openBlock(), createBlock(_sfc_main$k, {
|
|
1449
|
+
key: 1,
|
|
1450
|
+
colour: "danger",
|
|
1451
|
+
size: "small",
|
|
1452
|
+
onClick: _cache[2] || (_cache[2] = withModifiers(($event) => modalAction(false), ["prevent"]))
|
|
1453
|
+
}, {
|
|
1454
|
+
default: withCtx(() => [
|
|
1455
|
+
createTextVNode(toDisplayString(unref(cancelButtonText)), 1)
|
|
1456
|
+
]),
|
|
1457
|
+
_: 1
|
|
1458
|
+
})) : createCommentVNode("", true)
|
|
1459
|
+
], 512), [
|
|
1460
|
+
[vShow, unref(showCancelButton) || unref(showConfirmButton)]
|
|
1461
|
+
])
|
|
1462
|
+
], 16)
|
|
1463
|
+
], 512), [
|
|
1464
|
+
[vShow, visible.value]
|
|
1465
|
+
])
|
|
1466
|
+
]))
|
|
1467
|
+
], 64);
|
|
1468
|
+
};
|
|
1469
|
+
}
|
|
1470
|
+
const _sfc_main$h = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$2), {
|
|
1471
|
+
props: {
|
|
1472
|
+
title: null,
|
|
1473
|
+
size: { default: "medium" },
|
|
1474
|
+
confirmButton: { default: "" },
|
|
1475
|
+
cancelButton: { default: "" },
|
|
1476
|
+
confirmEnabled: { default: true }
|
|
1477
|
+
},
|
|
1478
|
+
emits: {
|
|
1479
|
+
confirm: null,
|
|
1480
|
+
cancel: null
|
|
1481
|
+
},
|
|
1482
|
+
setup: setup$2
|
|
1483
|
+
}));
|
|
1484
|
+
const _hoisted_1$g = { class: "cl-bg-grey-2 cl-border-b cl-border-grey-2 cl-border-t cl-flex cl-p-1" };
|
|
1485
|
+
const _hoisted_2$g = {
|
|
1486
|
+
key: 0,
|
|
1487
|
+
class: "cl-w-1/2"
|
|
1488
|
+
};
|
|
1489
|
+
const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
1490
|
+
props: {
|
|
1491
|
+
showClearButton: { default: false },
|
|
1492
|
+
text: { default: "" },
|
|
1493
|
+
additionalText: { default: "" }
|
|
1494
|
+
},
|
|
1495
|
+
emits: {
|
|
1496
|
+
"clear-object": null
|
|
1497
|
+
},
|
|
1498
|
+
setup(__props) {
|
|
1499
|
+
return (_ctx, _cache) => {
|
|
1500
|
+
const _component_icon = resolveComponent("icon");
|
|
1501
|
+
return openBlock(), createElementBlock("div", _hoisted_1$g, [
|
|
1502
|
+
__props.additionalText !== "" ? (openBlock(), createElementBlock("div", _hoisted_2$g, toDisplayString(__props.additionalText), 1)) : createCommentVNode("", true),
|
|
1503
|
+
createElementVNode("div", {
|
|
1504
|
+
class: normalizeClass({
|
|
1505
|
+
"cl-w-1/2": __props.additionalText !== "",
|
|
1506
|
+
"cl-w-full": __props.additionalText === ""
|
|
1507
|
+
})
|
|
1508
|
+
}, toDisplayString(__props.text), 3),
|
|
1509
|
+
withDirectives(createElementVNode("div", {
|
|
1510
|
+
class: "cl-cursor-pointer cl-float-right",
|
|
1511
|
+
onMousedown: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("clear-object"))
|
|
1512
|
+
}, [
|
|
1513
|
+
createVNode(_component_icon, {
|
|
1514
|
+
class: "cl-mt-0.5 cl-rounded-full hover:cl-text-link-default",
|
|
1515
|
+
icon: "ph:x-circle"
|
|
1516
|
+
})
|
|
1517
|
+
], 544), [
|
|
1518
|
+
[vShow, __props.showClearButton]
|
|
1519
|
+
])
|
|
1520
|
+
]);
|
|
1521
|
+
};
|
|
1522
|
+
}
|
|
1523
|
+
});
|
|
1524
|
+
const _hoisted_1$f = {
|
|
1525
|
+
key: 0,
|
|
1526
|
+
class: "cl-w-1/2"
|
|
1527
|
+
};
|
|
1528
|
+
const _hoisted_2$f = { class: "cl-float-right cl-py-1.5" };
|
|
1529
|
+
const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
1530
|
+
props: {
|
|
1531
|
+
isCreateNewOption: { default: false },
|
|
1532
|
+
selectedIndex: { default: -1 },
|
|
1533
|
+
text: { default: "" },
|
|
1534
|
+
option: { default: () => null },
|
|
1535
|
+
index: null
|
|
1536
|
+
},
|
|
1537
|
+
emits: {
|
|
1538
|
+
"create-object": null,
|
|
1539
|
+
"select-object": null,
|
|
1540
|
+
"option-highlighted": null
|
|
1541
|
+
},
|
|
1542
|
+
setup(__props, { emit }) {
|
|
1543
|
+
const props = __props;
|
|
1544
|
+
const displayedText = computed(() => {
|
|
1545
|
+
var _a, _b;
|
|
1546
|
+
return (_b = (_a = props.option) == null ? void 0 : _a.name) != null ? _b : props.text;
|
|
1547
|
+
});
|
|
1548
|
+
const displayedParent = computed(() => {
|
|
1549
|
+
var _a, _b;
|
|
1550
|
+
return (_b = (_a = props.option) == null ? void 0 : _a.parentName) != null ? _b : "";
|
|
1551
|
+
});
|
|
1552
|
+
const isHighlighted = ref(false);
|
|
1553
|
+
function optionSelected() {
|
|
1554
|
+
var _a;
|
|
1555
|
+
if (props.isCreateNewOption === true) {
|
|
1556
|
+
emit("create-object");
|
|
1557
|
+
} else {
|
|
1558
|
+
emit("select-object", (_a = props.option) == null ? void 0 : _a.id);
|
|
1559
|
+
}
|
|
1560
|
+
}
|
|
1561
|
+
function onHover(hovered) {
|
|
1562
|
+
if (hovered === true) {
|
|
1563
|
+
isHighlighted.value = true;
|
|
1564
|
+
emit("option-highlighted", props.index);
|
|
1565
|
+
} else {
|
|
1566
|
+
if (props.index !== props.selectedIndex) {
|
|
1567
|
+
isHighlighted.value = false;
|
|
1568
|
+
}
|
|
1569
|
+
}
|
|
1570
|
+
}
|
|
1571
|
+
function updateHighlight() {
|
|
1572
|
+
if (props.selectedIndex === props.index) {
|
|
1573
|
+
isHighlighted.value = true;
|
|
1574
|
+
} else {
|
|
1575
|
+
isHighlighted.value = false;
|
|
1576
|
+
}
|
|
1577
|
+
}
|
|
1578
|
+
watch(() => props.selectedIndex, () => updateHighlight());
|
|
1579
|
+
return (_ctx, _cache) => {
|
|
1580
|
+
var _a, _b;
|
|
1581
|
+
const _component_icon = resolveComponent("icon");
|
|
1582
|
+
return openBlock(), createElementBlock("div", {
|
|
1583
|
+
class: normalizeClass(["cl-border-b cl-border-grey-0 cl-border-t cl-cursor-pointer cl-flex cl-p-1", {
|
|
1584
|
+
"cl-bg-grey-0": isHighlighted.value === false,
|
|
1585
|
+
"cl-bg-primary-default cl-text-white": isHighlighted.value
|
|
1586
|
+
}]),
|
|
1587
|
+
onMousedown: optionSelected,
|
|
1588
|
+
onMousemove: _cache[0] || (_cache[0] = ($event) => onHover(true)),
|
|
1589
|
+
onMouseleave: _cache[1] || (_cache[1] = ($event) => onHover(false))
|
|
1590
|
+
}, [
|
|
1591
|
+
__props.option !== null && ((_a = __props.option) == null ? void 0 : _a.parentId) !== 0 && ((_b = __props.option) == null ? void 0 : _b.parentId) !== void 0 ? (openBlock(), createElementBlock("div", _hoisted_1$f, toDisplayString(unref(displayedParent)), 1)) : createCommentVNode("", true),
|
|
1592
|
+
createElementVNode("div", {
|
|
1593
|
+
class: normalizeClass({
|
|
1594
|
+
"cl-w-1/2": unref(displayedParent) !== "",
|
|
1595
|
+
"cl-w-full": unref(displayedParent) === ""
|
|
1596
|
+
})
|
|
1597
|
+
}, toDisplayString(unref(displayedText)), 3),
|
|
1598
|
+
withDirectives(createElementVNode("div", _hoisted_2$f, [
|
|
1599
|
+
createVNode(_component_icon, {
|
|
1600
|
+
class: "cl-bg-primary-default cl-rounded-full cl-text-white",
|
|
1601
|
+
icon: "ph:plus-circle"
|
|
1602
|
+
})
|
|
1603
|
+
], 512), [
|
|
1604
|
+
[vShow, __props.isCreateNewOption]
|
|
1605
|
+
])
|
|
1606
|
+
], 34);
|
|
1607
|
+
};
|
|
1608
|
+
}
|
|
1609
|
+
});
|
|
1610
|
+
const _hoisted_1$e = ["onKeyup"];
|
|
1611
|
+
const _hoisted_2$e = { class: "cl-flex" };
|
|
1612
|
+
const _hoisted_3$d = ["placeholder"];
|
|
1613
|
+
const _hoisted_4$d = { key: 5 };
|
|
1614
|
+
const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
1615
|
+
props: {
|
|
1616
|
+
loading: { default: false },
|
|
1617
|
+
objectType: null,
|
|
1618
|
+
objectParentType: { default: "" },
|
|
1619
|
+
errorMessage: { default: "" },
|
|
1620
|
+
canCreateNewObject: { default: false },
|
|
1621
|
+
canClearSelectedObject: { default: true },
|
|
1622
|
+
currentObjectName: { default: "" },
|
|
1623
|
+
results: { default: () => [] },
|
|
1624
|
+
isVisible: { default: false }
|
|
1625
|
+
},
|
|
1626
|
+
emits: {
|
|
1627
|
+
"clear-object": null,
|
|
1628
|
+
"create-object": null,
|
|
1629
|
+
"select-object": null,
|
|
1630
|
+
search: null,
|
|
1631
|
+
"hide-dropdown": null
|
|
1632
|
+
},
|
|
1633
|
+
setup(__props, { emit }) {
|
|
1634
|
+
const props = __props;
|
|
1635
|
+
const { t } = useI18n();
|
|
1636
|
+
const searchText = ref("");
|
|
1637
|
+
const showAddNewOption = ref(false);
|
|
1638
|
+
const currentSelection = ref(-1);
|
|
1639
|
+
const firstIndexInResults = computed(() => showAddNewOption.value ? -1 : 0);
|
|
1640
|
+
const container = ref();
|
|
1641
|
+
const searchBox = ref();
|
|
1642
|
+
function search(keyboardEvent) {
|
|
1643
|
+
if (keyboardEvent === void 0 || (keyboardEvent == null ? void 0 : keyboardEvent.code.startsWith("Arrow")) === false && (keyboardEvent == null ? void 0 : keyboardEvent.code.startsWith("Control")) === false && (keyboardEvent == null ? void 0 : keyboardEvent.code.startsWith("Shift")) === false && (keyboardEvent == null ? void 0 : keyboardEvent.code.startsWith("Tab")) === false && (keyboardEvent == null ? void 0 : keyboardEvent.code) !== "Enter") {
|
|
1644
|
+
emit("search", searchText.value);
|
|
1645
|
+
currentSelection.value = -2;
|
|
1646
|
+
}
|
|
1647
|
+
}
|
|
1648
|
+
function selectObject(id) {
|
|
1649
|
+
emit("select-object", id);
|
|
1650
|
+
}
|
|
1651
|
+
function createObject() {
|
|
1652
|
+
emit("create-object", searchText.value);
|
|
1653
|
+
hideDropdown();
|
|
1654
|
+
}
|
|
1655
|
+
function hideDropdown() {
|
|
1656
|
+
emit("hide-dropdown");
|
|
1657
|
+
}
|
|
1658
|
+
function onKeyboardArrowDown(firstIndex) {
|
|
1659
|
+
if (currentSelection.value < props.results.length - 1) {
|
|
1660
|
+
if (currentSelection.value === -2 && searchText.value === "") {
|
|
1661
|
+
currentSelection.value++;
|
|
1662
|
+
}
|
|
1663
|
+
currentSelection.value++;
|
|
1664
|
+
} else {
|
|
1665
|
+
currentSelection.value = firstIndex;
|
|
1666
|
+
}
|
|
1667
|
+
scroll();
|
|
1668
|
+
}
|
|
1669
|
+
function onKeyboardArrowUp(firstIndex) {
|
|
1670
|
+
if (currentSelection.value > firstIndex) {
|
|
1671
|
+
currentSelection.value--;
|
|
1672
|
+
} else {
|
|
1673
|
+
currentSelection.value = props.results.length - 1;
|
|
1674
|
+
}
|
|
1675
|
+
scroll();
|
|
1676
|
+
}
|
|
1677
|
+
function onKeyboardEnter() {
|
|
1678
|
+
if (currentSelection.value >= 0 && props.results !== void 0) {
|
|
1679
|
+
selectObject(props.results[currentSelection.value].id);
|
|
1680
|
+
} else if (currentSelection.value === -1) {
|
|
1681
|
+
createObject();
|
|
1682
|
+
}
|
|
1683
|
+
}
|
|
1684
|
+
function onKeyboardShiftTab(keyboardEvent) {
|
|
1685
|
+
if (keyboardEvent.key === "Tab" && keyboardEvent.shiftKey === true) {
|
|
1686
|
+
const selectableElements = document.getElementsByTagName("input");
|
|
1687
|
+
let indexOfPreviouslySelectableItem = -1;
|
|
1688
|
+
for (let i = 0; i < selectableElements.length; i++) {
|
|
1689
|
+
if (selectableElements[i] === keyboardEvent.target) {
|
|
1690
|
+
indexOfPreviouslySelectableItem = i - 1;
|
|
1691
|
+
}
|
|
1692
|
+
}
|
|
1693
|
+
if (indexOfPreviouslySelectableItem >= 0) {
|
|
1694
|
+
selectableElements[indexOfPreviouslySelectableItem].focus();
|
|
1695
|
+
hideDropdown();
|
|
1696
|
+
}
|
|
1697
|
+
}
|
|
1698
|
+
}
|
|
1699
|
+
function scroll() {
|
|
1700
|
+
var _a;
|
|
1701
|
+
if (props.results && props.results.length > 1) {
|
|
1702
|
+
const heightOffset = 34;
|
|
1703
|
+
(_a = container.value) == null ? void 0 : _a.scrollTo(0, (currentSelection.value + 1) * heightOffset - heightOffset * 2);
|
|
1704
|
+
}
|
|
1705
|
+
}
|
|
1706
|
+
function updateAddNewOption() {
|
|
1707
|
+
let finalResultMatches = false;
|
|
1708
|
+
if (props.results !== null && props.results.length === 1) {
|
|
1709
|
+
finalResultMatches = searchText.value.toUpperCase().trim() === props.results[0].name.toUpperCase().trim();
|
|
1710
|
+
}
|
|
1711
|
+
showAddNewOption.value = props.canCreateNewObject === true && props.errorMessage === "" && searchText.value.trim() !== "" && finalResultMatches === false;
|
|
1712
|
+
}
|
|
1713
|
+
function updateSelectedObjectIndex(index) {
|
|
1714
|
+
currentSelection.value = index;
|
|
1715
|
+
}
|
|
1716
|
+
function onVisibilityChanged() {
|
|
1717
|
+
if (props.isVisible === true) {
|
|
1718
|
+
searchText.value = "";
|
|
1719
|
+
search();
|
|
1720
|
+
nextTick(() => {
|
|
1721
|
+
var _a;
|
|
1722
|
+
return (_a = searchBox.value) == null ? void 0 : _a.focus();
|
|
1723
|
+
});
|
|
1724
|
+
}
|
|
1725
|
+
}
|
|
1726
|
+
watch(() => props.results, () => updateAddNewOption());
|
|
1727
|
+
watch(() => props.errorMessage, () => updateAddNewOption());
|
|
1728
|
+
watch(() => props.isVisible, () => onVisibilityChanged());
|
|
1729
|
+
onMounted(() => {
|
|
1730
|
+
var _a;
|
|
1731
|
+
return (_a = container.value) == null ? void 0 : _a.addEventListener("keydown", onKeyboardShiftTab);
|
|
1732
|
+
});
|
|
1733
|
+
onUnmounted(() => {
|
|
1734
|
+
var _a;
|
|
1735
|
+
return (_a = container.value) == null ? void 0 : _a.removeEventListener("keydown", onKeyboardShiftTab);
|
|
1736
|
+
});
|
|
1737
|
+
return (_ctx, _cache) => {
|
|
1738
|
+
var _a;
|
|
1739
|
+
const _component_cl_ui_loading_spinner = resolveComponent("cl-ui-loading-spinner");
|
|
1740
|
+
return openBlock(), createElementBlock("div", {
|
|
1741
|
+
ref: (_value, _refs) => {
|
|
1742
|
+
_refs["container"] = _value;
|
|
1743
|
+
container.value = _value;
|
|
1744
|
+
},
|
|
1745
|
+
class: "cl-bg-white cl-border cl-border-collapse cl-border-grey-0 cl-h-52 cl-overflow-y-auto cl-p-2 cl-text-sm",
|
|
1746
|
+
onKeydown: [
|
|
1747
|
+
_cache[2] || (_cache[2] = withKeys(withModifiers(($event) => onKeyboardArrowUp(unref(firstIndexInResults)), ["prevent", "stop"]), ["up"])),
|
|
1748
|
+
_cache[3] || (_cache[3] = withKeys(withModifiers(($event) => onKeyboardArrowDown(unref(firstIndexInResults)), ["prevent", "stop"]), ["down"]))
|
|
1749
|
+
],
|
|
1750
|
+
onKeyup: withKeys(withModifiers(onKeyboardEnter, ["prevent", "stop"]), ["enter"])
|
|
1751
|
+
}, [
|
|
1752
|
+
createElementVNode("div", _hoisted_2$e, [
|
|
1753
|
+
withDirectives(createElementVNode("input", {
|
|
1754
|
+
ref: (_value, _refs) => {
|
|
1755
|
+
_refs["searchBox"] = _value;
|
|
1756
|
+
searchBox.value = _value;
|
|
1757
|
+
},
|
|
1758
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => searchText.value = $event),
|
|
1759
|
+
type: "text",
|
|
1760
|
+
placeholder: unref(t)("comboBox.searchHint", { object: __props.objectType }),
|
|
1761
|
+
onKeyup: search,
|
|
1762
|
+
onBlur: hideDropdown
|
|
1763
|
+
}, null, 40, _hoisted_3$d), [
|
|
1764
|
+
[vModelText, searchText.value]
|
|
1765
|
+
]),
|
|
1766
|
+
__props.loading ? (openBlock(), createBlock(_component_cl_ui_loading_spinner, {
|
|
1767
|
+
key: 0,
|
|
1768
|
+
class: "cl-absolute cl-ml-2 cl-mt-11"
|
|
1769
|
+
})) : createCommentVNode("", true)
|
|
1770
|
+
]),
|
|
1771
|
+
__props.currentObjectName !== "" ? (openBlock(), createBlock(_sfc_main$g, {
|
|
1772
|
+
key: 0,
|
|
1773
|
+
"show-clear-button": __props.canClearSelectedObject,
|
|
1774
|
+
text: __props.currentObjectName,
|
|
1775
|
+
onClearObject: _cache[1] || (_cache[1] = ($event) => _ctx.$emit("clear-object"))
|
|
1776
|
+
}, null, 8, ["show-clear-button", "text"])) : createCommentVNode("", true),
|
|
1777
|
+
__props.objectParentType !== "" && __props.results !== void 0 && __props.results.length > 0 && __props.errorMessage === "" ? (openBlock(), createBlock(_sfc_main$g, {
|
|
1778
|
+
key: 1,
|
|
1779
|
+
text: __props.objectType,
|
|
1780
|
+
"additional-text": __props.objectParentType
|
|
1781
|
+
}, null, 8, ["text", "additional-text"])) : createCommentVNode("", true),
|
|
1782
|
+
__props.results !== null && ((_a = __props.results) == null ? void 0 : _a.length) === 0 && searchText.value.trim() !== "" && __props.canCreateNewObject === false && __props.errorMessage === "" ? (openBlock(), createBlock(_sfc_main$g, {
|
|
1783
|
+
key: 2,
|
|
1784
|
+
text: unref(t)("comboBox.noResults", { object: __props.objectType })
|
|
1785
|
+
}, null, 8, ["text"])) : createCommentVNode("", true),
|
|
1786
|
+
__props.errorMessage !== "" ? (openBlock(), createBlock(_sfc_main$g, {
|
|
1787
|
+
key: 3,
|
|
1788
|
+
class: "!cl-bg-danger-light cl-text-danger-dark",
|
|
1789
|
+
text: unref(t)("comboBox.errorMessage", { error: __props.errorMessage })
|
|
1790
|
+
}, null, 8, ["text"])) : createCommentVNode("", true),
|
|
1791
|
+
showAddNewOption.value ? (openBlock(), createBlock(_sfc_main$f, {
|
|
1792
|
+
key: 4,
|
|
1793
|
+
"is-create-new-option": true,
|
|
1794
|
+
text: unref(t)("comboBox.addPrompt", { value: searchText.value, object: __props.objectType }),
|
|
1795
|
+
index: -1,
|
|
1796
|
+
"selected-index": currentSelection.value,
|
|
1797
|
+
onCreateObject: createObject,
|
|
1798
|
+
onOptionHighlighted: updateSelectedObjectIndex
|
|
1799
|
+
}, null, 8, ["text", "selected-index"])) : createCommentVNode("", true),
|
|
1800
|
+
__props.errorMessage === "" && __props.results !== null ? (openBlock(), createElementBlock("div", _hoisted_4$d, [
|
|
1801
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(__props.results, (result, index) => {
|
|
1802
|
+
return openBlock(), createBlock(_sfc_main$f, {
|
|
1803
|
+
key: index,
|
|
1804
|
+
option: result,
|
|
1805
|
+
index,
|
|
1806
|
+
"selected-index": currentSelection.value,
|
|
1807
|
+
onSelectObject: selectObject,
|
|
1808
|
+
onOptionHighlighted: updateSelectedObjectIndex
|
|
1809
|
+
}, null, 8, ["option", "index", "selected-index"]);
|
|
1810
|
+
}), 128))
|
|
1811
|
+
])) : createCommentVNode("", true)
|
|
1812
|
+
], 40, _hoisted_1$e);
|
|
1813
|
+
};
|
|
1814
|
+
}
|
|
1815
|
+
});
|
|
1816
|
+
const _hoisted_1$d = { class: "cl-flex" };
|
|
1817
|
+
const _hoisted_2$d = ["placeholder", "disabled"];
|
|
1818
|
+
const _hoisted_3$c = { class: "cl-relative cl-right-20 cl-top-0.5" };
|
|
1819
|
+
const _hoisted_4$c = { class: "cl-absolute cl-flex cl-float-right cl-font-semibold cl-mt-2 cl-text-danger-default cl-text-sm" };
|
|
1820
|
+
const _hoisted_5$b = { class: "cl-mt-3" };
|
|
1821
|
+
const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
1822
|
+
props: {
|
|
1823
|
+
loading: { default: false },
|
|
1824
|
+
disabled: { default: false },
|
|
1825
|
+
required: { default: false },
|
|
1826
|
+
objectType: null,
|
|
1827
|
+
objectParentType: { default: "" },
|
|
1828
|
+
canCreateNewObject: { default: false },
|
|
1829
|
+
canClearSelectedObject: { default: true },
|
|
1830
|
+
errorMessage: { default: "" },
|
|
1831
|
+
objectCreatedResponse: { default: () => null },
|
|
1832
|
+
parentObjectCreatedResponse: { default: () => null },
|
|
1833
|
+
results: { default: () => [] },
|
|
1834
|
+
parentResults: { default: () => [] },
|
|
1835
|
+
currentObject: null
|
|
1836
|
+
},
|
|
1837
|
+
emits: {
|
|
1838
|
+
search: null,
|
|
1839
|
+
"search-parent": null,
|
|
1840
|
+
"create-object": null,
|
|
1841
|
+
"create-parent-object": null,
|
|
1842
|
+
"update:current-object": null
|
|
1843
|
+
},
|
|
1844
|
+
setup(__props, { emit }) {
|
|
1845
|
+
const props = __props;
|
|
1846
|
+
const { t } = useI18n();
|
|
1847
|
+
const searchContainerVisible = ref(false);
|
|
1848
|
+
const selectedItem = computed({
|
|
1849
|
+
get: () => props.currentObject,
|
|
1850
|
+
set: (value) => emit("update:current-object", value)
|
|
1851
|
+
});
|
|
1852
|
+
const parentItem = ref(null);
|
|
1853
|
+
const currentText = computed(() => getDisplayName());
|
|
1854
|
+
const objectToCreateValue = ref("");
|
|
1855
|
+
const parentObjectToCreateValue = ref("");
|
|
1856
|
+
const createObjectRequest = ref();
|
|
1857
|
+
const objectToCreateValid = ref(true);
|
|
1858
|
+
function toggleDropdown(forcedState) {
|
|
1859
|
+
if (!props.disabled) {
|
|
1860
|
+
if (typeof forcedState !== "undefined") {
|
|
1861
|
+
searchContainerVisible.value = forcedState;
|
|
1862
|
+
} else {
|
|
1863
|
+
searchContainerVisible.value = !searchContainerVisible.value;
|
|
1864
|
+
}
|
|
1865
|
+
}
|
|
1866
|
+
}
|
|
1867
|
+
function search(searchTerm) {
|
|
1868
|
+
objectToCreateValue.value = searchTerm;
|
|
1869
|
+
emit("search", searchTerm);
|
|
1870
|
+
}
|
|
1871
|
+
function searchParent(searchTerm) {
|
|
1872
|
+
parentObjectToCreateValue.value = searchTerm;
|
|
1873
|
+
emit("search-parent", searchTerm);
|
|
1874
|
+
}
|
|
1875
|
+
function clearObject() {
|
|
1876
|
+
selectedItem.value = null;
|
|
1877
|
+
toggleDropdown(false);
|
|
1878
|
+
}
|
|
1879
|
+
function selectObject(id) {
|
|
1880
|
+
const item = getComboBoxItemById(id);
|
|
1881
|
+
selectedItem.value = item;
|
|
1882
|
+
toggleDropdown(false);
|
|
1883
|
+
}
|
|
1884
|
+
function getComboBoxItemById(id) {
|
|
1885
|
+
let currentItem = null;
|
|
1886
|
+
if (props.results !== null) {
|
|
1887
|
+
for (let i = 0; i < props.results.length; i++) {
|
|
1888
|
+
if (props.results[i].id === id) {
|
|
1889
|
+
currentItem = props.results[i];
|
|
1890
|
+
break;
|
|
1891
|
+
}
|
|
1892
|
+
}
|
|
1893
|
+
}
|
|
1894
|
+
return currentItem;
|
|
1895
|
+
}
|
|
1896
|
+
function createObject() {
|
|
1897
|
+
var _a, _b;
|
|
1898
|
+
createObjectRequest.value = {
|
|
1899
|
+
name: objectToCreateValue.value,
|
|
1900
|
+
parentId: (_b = (_a = parentItem.value) == null ? void 0 : _a.id) != null ? _b : 0
|
|
1901
|
+
};
|
|
1902
|
+
emit("create-object", createObjectRequest.value);
|
|
1903
|
+
}
|
|
1904
|
+
function createParentObject() {
|
|
1905
|
+
createObjectRequest.value = {
|
|
1906
|
+
name: parentObjectToCreateValue.value,
|
|
1907
|
+
parentId: 0
|
|
1908
|
+
};
|
|
1909
|
+
emit("create-parent-object", createObjectRequest.value);
|
|
1910
|
+
}
|
|
1911
|
+
function handleObjectCreateResponse() {
|
|
1912
|
+
var _a, _b;
|
|
1913
|
+
if ((_a = props.objectCreatedResponse) == null ? void 0 : _a.error) {
|
|
1914
|
+
showNotification({
|
|
1915
|
+
message: t("comboBox.noResults", { name: objectToCreateValue.value, error: props.objectCreatedResponse.error }),
|
|
1916
|
+
colour: "danger",
|
|
1917
|
+
duration: 1e4
|
|
1918
|
+
});
|
|
1919
|
+
} else if ((_b = props.objectCreatedResponse) == null ? void 0 : _b.id) {
|
|
1920
|
+
handleSuccessfulObjectCreation();
|
|
1921
|
+
}
|
|
1922
|
+
}
|
|
1923
|
+
function handleParentObjectCreateResponse() {
|
|
1924
|
+
var _a, _b;
|
|
1925
|
+
if ((_a = props.parentObjectCreatedResponse) == null ? void 0 : _a.id) {
|
|
1926
|
+
parentItem.value = {
|
|
1927
|
+
id: props.parentObjectCreatedResponse.id,
|
|
1928
|
+
name: (_b = props.parentObjectCreatedResponse.name) != null ? _b : ""
|
|
1929
|
+
};
|
|
1930
|
+
}
|
|
1931
|
+
}
|
|
1932
|
+
function handleSuccessfulObjectCreation() {
|
|
1933
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
1934
|
+
showNotification({
|
|
1935
|
+
message: t("comboBox.noResults", { object: props.objectType, name: (_b = (_a = props.objectCreatedResponse) == null ? void 0 : _a.name) != null ? _b : "" }),
|
|
1936
|
+
colour: "primary",
|
|
1937
|
+
duration: 1e4
|
|
1938
|
+
});
|
|
1939
|
+
let parentName = "";
|
|
1940
|
+
if (parentItem.value && parentItem.value.id === ((_c = props.objectCreatedResponse) == null ? void 0 : _c.parentId)) {
|
|
1941
|
+
parentName = parentItem.value.name;
|
|
1942
|
+
}
|
|
1943
|
+
selectedItem.value = {
|
|
1944
|
+
id: (_e = (_d = props.objectCreatedResponse) == null ? void 0 : _d.id) != null ? _e : 0,
|
|
1945
|
+
name: (_g = (_f = props.objectCreatedResponse) == null ? void 0 : _f.name) != null ? _g : "",
|
|
1946
|
+
parentId: (_i = (_h = props.objectCreatedResponse) == null ? void 0 : _h.parentId) != null ? _i : 0,
|
|
1947
|
+
parentName
|
|
1948
|
+
};
|
|
1949
|
+
}
|
|
1950
|
+
function getDisplayName() {
|
|
1951
|
+
let name = "";
|
|
1952
|
+
if (selectedItem.value) {
|
|
1953
|
+
if (selectedItem.value.parentName) {
|
|
1954
|
+
name = selectedItem.value.parentName + "; " + selectedItem.value.name;
|
|
1955
|
+
} else {
|
|
1956
|
+
name = selectedItem.value.name;
|
|
1957
|
+
}
|
|
1958
|
+
}
|
|
1959
|
+
return name;
|
|
1960
|
+
}
|
|
1961
|
+
function validateObjectToCreate() {
|
|
1962
|
+
let valid = true;
|
|
1963
|
+
if (objectToCreateValue.value === "") {
|
|
1964
|
+
valid = false;
|
|
1965
|
+
}
|
|
1966
|
+
if (props.objectParentType !== "" && parentItem.value === null) {
|
|
1967
|
+
valid = false;
|
|
1968
|
+
}
|
|
1969
|
+
objectToCreateValid.value = valid;
|
|
1970
|
+
}
|
|
1971
|
+
watch(() => props.objectCreatedResponse, () => handleObjectCreateResponse());
|
|
1972
|
+
watch(() => props.parentObjectCreatedResponse, () => handleParentObjectCreateResponse());
|
|
1973
|
+
watch(() => objectToCreateValue.value, () => validateObjectToCreate());
|
|
1974
|
+
watch(() => parentItem.value, () => validateObjectToCreate());
|
|
1975
|
+
return (_ctx, _cache) => {
|
|
1976
|
+
const _component_icon = resolveComponent("icon");
|
|
1977
|
+
const _component_cl_ui_combo_box = resolveComponent("cl-ui-combo-box", true);
|
|
1978
|
+
return openBlock(), createElementBlock("div", null, [
|
|
1979
|
+
createElementVNode("div", _hoisted_1$d, [
|
|
1980
|
+
withDirectives(createElementVNode("input", {
|
|
1981
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(currentText) ? currentText.value = $event : null),
|
|
1982
|
+
class: normalizeClass(["!cl-bg-transparent cl-z-10", {
|
|
1983
|
+
"cl-cursor-pointer": __props.disabled === false
|
|
1984
|
+
}]),
|
|
1985
|
+
type: "text",
|
|
1986
|
+
placeholder: unref(t)("comboBox.emptyHintText", { object: __props.objectType }),
|
|
1987
|
+
disabled: __props.disabled,
|
|
1988
|
+
onFocus: _cache[1] || (_cache[1] = ($event) => toggleDropdown(true))
|
|
1989
|
+
}, null, 42, _hoisted_2$d), [
|
|
1990
|
+
[vModelText, unref(currentText)]
|
|
1991
|
+
]),
|
|
1992
|
+
withDirectives(createElementVNode("div", _hoisted_3$c, [
|
|
1993
|
+
createElementVNode("div", _hoisted_4$c, [
|
|
1994
|
+
createTextVNode(toDisplayString(unref(t)("comboBox.required")) + " ", 1),
|
|
1995
|
+
createVNode(_component_icon, {
|
|
1996
|
+
class: "cl-ml-1 cl-mt-1",
|
|
1997
|
+
icon: "ph:warning"
|
|
1998
|
+
})
|
|
1999
|
+
])
|
|
2000
|
+
], 512), [
|
|
2001
|
+
[vShow, __props.required && __props.disabled === false && __props.currentObject === null]
|
|
2002
|
+
]),
|
|
2003
|
+
createElementVNode("div", {
|
|
2004
|
+
class: normalizeClass(["cl-border cl-border-grey-1 cl-float-right cl-px-1 cl-py-2.5 cl-text-grey-3 cl-w-min hover:cl-bg-primary-default hover:cl-text-white", {
|
|
2005
|
+
"cl-bg-off-white cl-cursor-default hover:cl-bg-off-white hover:cl-text-grey-3": __props.disabled,
|
|
2006
|
+
"cl-cursor-pointer": __props.disabled === false
|
|
2007
|
+
}]),
|
|
2008
|
+
onClick: _cache[2] || (_cache[2] = ($event) => toggleDropdown(true))
|
|
2009
|
+
}, [
|
|
2010
|
+
createVNode(_component_icon, {
|
|
2011
|
+
icon: "ph:caret-down",
|
|
2012
|
+
weight: "fill"
|
|
2013
|
+
})
|
|
2014
|
+
], 2)
|
|
2015
|
+
]),
|
|
2016
|
+
createVNode(_sfc_main$h, {
|
|
2017
|
+
size: "x-small",
|
|
2018
|
+
title: unref(t)("comboBox.createTitle", { object: __props.objectType }),
|
|
2019
|
+
"confirm-button": unref(t)("comboBox.create"),
|
|
2020
|
+
"cancel-button": unref(t)("comboBox.cancel"),
|
|
2021
|
+
"confirm-enabled": objectToCreateValid.value,
|
|
2022
|
+
onConfirm: createObject
|
|
2023
|
+
}, {
|
|
2024
|
+
trigger: withCtx(({ toggleModal }) => [
|
|
2025
|
+
withDirectives(createVNode(_sfc_main$e, {
|
|
2026
|
+
"can-create-new-object": __props.canCreateNewObject,
|
|
2027
|
+
"can-clear-selected-object": __props.canClearSelectedObject,
|
|
2028
|
+
loading: __props.loading,
|
|
2029
|
+
results: __props.results,
|
|
2030
|
+
"object-type": __props.objectType,
|
|
2031
|
+
"object-parent-type": __props.objectParentType,
|
|
2032
|
+
"error-message": __props.errorMessage,
|
|
2033
|
+
"current-object-name": unref(currentText),
|
|
2034
|
+
"is-visible": searchContainerVisible.value,
|
|
2035
|
+
onCreateObject: toggleModal,
|
|
2036
|
+
onSelectObject: selectObject,
|
|
2037
|
+
onClearObject: clearObject,
|
|
2038
|
+
onSearch: search,
|
|
2039
|
+
onHideDropdown: _cache[3] || (_cache[3] = ($event) => toggleDropdown(false))
|
|
2040
|
+
}, null, 8, ["can-create-new-object", "can-clear-selected-object", "loading", "results", "object-type", "object-parent-type", "error-message", "current-object-name", "is-visible", "onCreateObject"]), [
|
|
2041
|
+
[vShow, searchContainerVisible.value]
|
|
2042
|
+
])
|
|
2043
|
+
]),
|
|
2044
|
+
default: withCtx(() => [
|
|
2045
|
+
__props.objectParentType ? (openBlock(), createBlock(_component_cl_ui_combo_box, {
|
|
2046
|
+
key: 0,
|
|
2047
|
+
"current-object": parentItem.value,
|
|
2048
|
+
"onUpdate:current-object": _cache[4] || (_cache[4] = ($event) => parentItem.value = $event),
|
|
2049
|
+
class: "cl-mt-3",
|
|
2050
|
+
results: __props.parentResults,
|
|
2051
|
+
loading: __props.loading,
|
|
2052
|
+
"object-type": __props.objectParentType,
|
|
2053
|
+
"object-created-response": __props.parentObjectCreatedResponse,
|
|
2054
|
+
"can-create-new-object": __props.canCreateNewObject,
|
|
2055
|
+
"can-clear-selected-object": __props.canClearSelectedObject,
|
|
2056
|
+
"error-message": __props.errorMessage,
|
|
2057
|
+
onSearch: searchParent,
|
|
2058
|
+
onCreateObject: createParentObject
|
|
2059
|
+
}, null, 8, ["current-object", "results", "loading", "object-type", "object-created-response", "can-create-new-object", "can-clear-selected-object", "error-message"])) : createCommentVNode("", true),
|
|
2060
|
+
createElementVNode("label", _hoisted_5$b, toDisplayString(unref(t)("comboBox.createProperty")), 1),
|
|
2061
|
+
withDirectives(createElementVNode("input", {
|
|
2062
|
+
"onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => objectToCreateValue.value = $event),
|
|
2063
|
+
type: "text"
|
|
2064
|
+
}, null, 512), [
|
|
2065
|
+
[vModelText, objectToCreateValue.value]
|
|
2066
|
+
])
|
|
2067
|
+
]),
|
|
2068
|
+
_: 1
|
|
2069
|
+
}, 8, ["title", "confirm-button", "cancel-button", "confirm-enabled"])
|
|
2070
|
+
]);
|
|
2071
|
+
};
|
|
2072
|
+
}
|
|
2073
|
+
});
|
|
2074
|
+
function isComboBoxItem(objectToTest) {
|
|
2075
|
+
return typeof objectToTest.id === "number" && typeof objectToTest.name === "string";
|
|
2076
|
+
}
|
|
2077
|
+
function isComboBoxCreateRequest(objectToTest) {
|
|
2078
|
+
return typeof objectToTest.name === "string";
|
|
2079
|
+
}
|
|
2080
|
+
const _sfc_main$c = {};
|
|
2081
|
+
const _hoisted_1$c = { class: "cl-flex cl-flex-wrap cl-left-0 cl-w-full" };
|
|
2082
|
+
const _hoisted_2$c = {
|
|
2083
|
+
key: 0,
|
|
2084
|
+
class: "cl-w-full"
|
|
2085
|
+
};
|
|
2086
|
+
const _hoisted_3$b = {
|
|
2087
|
+
key: 1,
|
|
2088
|
+
class: "cl-leading-10 cl-text-sm cl-w-full"
|
|
2089
|
+
};
|
|
2090
|
+
const _hoisted_4$b = { class: "cl-float-left" };
|
|
2091
|
+
const _hoisted_5$a = { class: "cl-float-right" };
|
|
2092
|
+
function _sfc_render$1(_ctx, _cache) {
|
|
2093
|
+
return openBlock(), createElementBlock("div", _hoisted_1$c, [
|
|
2094
|
+
_ctx.$slots.default ? (openBlock(), createElementBlock("div", _hoisted_2$c, [
|
|
2095
|
+
renderSlot(_ctx.$slots, "default")
|
|
2096
|
+
])) : createCommentVNode("", true),
|
|
2097
|
+
_ctx.$slots.left || _ctx.$slots.right ? (openBlock(), createElementBlock("div", _hoisted_3$b, [
|
|
2098
|
+
createElementVNode("span", _hoisted_4$b, [
|
|
2099
|
+
renderSlot(_ctx.$slots, "left")
|
|
2100
|
+
]),
|
|
2101
|
+
createElementVNode("span", _hoisted_5$a, [
|
|
2102
|
+
renderSlot(_ctx.$slots, "right")
|
|
2103
|
+
])
|
|
2104
|
+
])) : createCommentVNode("", true)
|
|
2105
|
+
]);
|
|
2106
|
+
}
|
|
2107
|
+
var clUiFooter = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["render", _sfc_render$1]]);
|
|
2108
|
+
const _hoisted_1$b = { class: "cl-mr-2 lg:cl-hidden" };
|
|
2109
|
+
const _hoisted_2$b = { class: "cl-mr-2 lg:cl-hidden" };
|
|
2110
|
+
const _hoisted_3$a = ["checked"];
|
|
2111
|
+
const _hoisted_4$a = {
|
|
2112
|
+
key: 0,
|
|
2113
|
+
class: "cl-inline-block cl-whitespace-nowrap"
|
|
2114
|
+
};
|
|
2115
|
+
const _hoisted_5$9 = {
|
|
2116
|
+
key: 1,
|
|
2117
|
+
class: "cl-inline-block cl-whitespace-nowrap"
|
|
2118
|
+
};
|
|
2119
|
+
const __default__$1 = {
|
|
2120
|
+
inheritAttrs: false
|
|
2121
|
+
};
|
|
2122
|
+
function setup$1(__props, { emit }) {
|
|
2123
|
+
const props = __props;
|
|
2124
|
+
const { d, n } = useI18n();
|
|
2125
|
+
const currentRecord = ref(copy(props.record));
|
|
2126
|
+
const edited = computed(() => {
|
|
2127
|
+
var _a, _b;
|
|
2128
|
+
return currentRecord.value[(_a = props.column.field) != null ? _a : ""] !== props.record[(_b = props.column.field) != null ? _b : ""];
|
|
2129
|
+
});
|
|
2130
|
+
function getStringValue(record, key) {
|
|
2131
|
+
return record[key];
|
|
2132
|
+
}
|
|
2133
|
+
function getNumericValue(record, key) {
|
|
2134
|
+
return record[key];
|
|
2135
|
+
}
|
|
2136
|
+
function getBooleanValue(record, key) {
|
|
2137
|
+
return record[key];
|
|
2138
|
+
}
|
|
2139
|
+
function cellFocused() {
|
|
2140
|
+
emit("focus");
|
|
2141
|
+
}
|
|
2142
|
+
watchEffect(() => currentRecord.value = copy(props.record));
|
|
2143
|
+
watch(currentRecord, (newValue) => {
|
|
2144
|
+
var _a;
|
|
2145
|
+
const property = (_a = props.column.field) != null ? _a : "";
|
|
2146
|
+
if (property !== "") {
|
|
2147
|
+
if (newValue[property] !== props.record[property]) {
|
|
2148
|
+
emit("edit", newValue[property]);
|
|
2149
|
+
} else {
|
|
2150
|
+
emit("undo-edit");
|
|
2151
|
+
}
|
|
2152
|
+
}
|
|
2153
|
+
}, {
|
|
2154
|
+
deep: true
|
|
2155
|
+
});
|
|
2156
|
+
return (_ctx, _cache) => {
|
|
2157
|
+
return __props.editMode && __props.column.field && __props.column.editable ? (openBlock(), createElementBlock("td", mergeProps({ key: 0 }, _ctx.$attrs, {
|
|
2158
|
+
class: {
|
|
2159
|
+
"cl-bg-link-lighter": unref(edited)
|
|
2160
|
+
}
|
|
2161
|
+
}), [
|
|
2162
|
+
createElementVNode("strong", _hoisted_1$b, toDisplayString(__props.column.caption), 1),
|
|
2163
|
+
renderSlot(_ctx.$slots, `${__props.column.name}Edit`, normalizeProps(guardReactiveProps({
|
|
2164
|
+
cellFocused,
|
|
2165
|
+
column: __props.column,
|
|
2166
|
+
edited: unref(edited),
|
|
2167
|
+
record: currentRecord.value
|
|
2168
|
+
})))
|
|
2169
|
+
], 16)) : (openBlock(), createElementBlock("td", normalizeProps(mergeProps({ key: 1 }, _ctx.$attrs)), [
|
|
2170
|
+
createElementVNode("strong", _hoisted_2$b, toDisplayString(__props.column.caption), 1),
|
|
2171
|
+
__props.column.type === "slot" ? renderSlot(_ctx.$slots, __props.column.name, normalizeProps(mergeProps({ key: 0 }, { column: __props.column, record: __props.record }))) : __props.column.type === "boolean" && __props.column.field !== void 0 ? (openBlock(), createElementBlock("input", {
|
|
2172
|
+
key: 1,
|
|
2173
|
+
type: "checkbox",
|
|
2174
|
+
checked: getBooleanValue(__props.record, __props.column.field),
|
|
2175
|
+
disabled: ""
|
|
2176
|
+
}, null, 8, _hoisted_3$a)) : (__props.column.type === "date" || __props.column.type === "datetime") && __props.column.field !== void 0 ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
|
|
2177
|
+
__props.column.format !== void 0 ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
2178
|
+
createTextVNode(toDisplayString(unref(d)(new Date(getStringValue(__props.record, __props.column.field)), __props.column.format)), 1)
|
|
2179
|
+
], 64)) : __props.column.type === "date" ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
2180
|
+
createTextVNode(toDisplayString(unref(d)(new Date(getStringValue(__props.record, __props.column.field)), unref(DateFormat).DATE)), 1)
|
|
2181
|
+
], 64)) : (openBlock(), createElementBlock(Fragment, { key: 2 }, [
|
|
2182
|
+
createTextVNode(toDisplayString(unref(d)(new Date(getStringValue(__props.record, __props.column.field)), unref(DateFormat).DATETIME)), 1)
|
|
2183
|
+
], 64))
|
|
2184
|
+
], 64)) : __props.column.type === "number" && __props.column.field ? (openBlock(), createElementBlock(Fragment, { key: 3 }, [
|
|
2185
|
+
__props.column.format === unref(NumberFormat).MULTIPLIER ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
2186
|
+
createTextVNode(" \xD7" + toDisplayString(getNumericValue(__props.record, __props.column.field)), 1)
|
|
2187
|
+
], 64)) : __props.column.format !== void 0 ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
2188
|
+
createTextVNode(toDisplayString(unref(n)(getNumericValue(__props.record, __props.column.field), __props.column.format)), 1)
|
|
2189
|
+
], 64)) : (openBlock(), createElementBlock(Fragment, { key: 2 }, [
|
|
2190
|
+
createTextVNode(toDisplayString(getNumericValue(__props.record, __props.column.field)), 1)
|
|
2191
|
+
], 64))
|
|
2192
|
+
], 64)) : __props.column.field !== void 0 ? (openBlock(), createElementBlock(Fragment, { key: 4 }, [
|
|
2193
|
+
__props.column.maxLength !== void 0 ? (openBlock(), createElementBlock("span", _hoisted_4$a, toDisplayString(getStringValue(__props.record, __props.column.field).trimToLength(__props.column.maxLength, __props.column.format !== void 0 ? __props.column.format === "ellipsis" : false)), 1)) : (openBlock(), createElementBlock("span", _hoisted_5$9, toDisplayString(getStringValue(__props.record, __props.column.field)), 1))
|
|
2194
|
+
], 64)) : createCommentVNode("", true)
|
|
2195
|
+
], 16));
|
|
2196
|
+
};
|
|
2197
|
+
}
|
|
2198
|
+
const _sfc_main$b = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$1), {
|
|
2199
|
+
props: {
|
|
2200
|
+
column: null,
|
|
2201
|
+
record: null,
|
|
2202
|
+
editMode: { default: false }
|
|
2203
|
+
},
|
|
2204
|
+
emits: {
|
|
2205
|
+
edit: null,
|
|
2206
|
+
focus: null,
|
|
2207
|
+
"undo-edit": null
|
|
2208
|
+
},
|
|
2209
|
+
setup: setup$1
|
|
2210
|
+
}));
|
|
2211
|
+
const defaultFilterMethod = {
|
|
2212
|
+
method: "equal",
|
|
2213
|
+
icon: "=",
|
|
2214
|
+
description: "Equals",
|
|
2215
|
+
allowedTypes: [
|
|
2216
|
+
"number",
|
|
2217
|
+
"string",
|
|
2218
|
+
"boolean",
|
|
2219
|
+
"date"
|
|
2220
|
+
]
|
|
2221
|
+
};
|
|
2222
|
+
const defaultStringFilterMethod = {
|
|
2223
|
+
method: "contains",
|
|
2224
|
+
icon: "⊂",
|
|
2225
|
+
description: "Contains",
|
|
2226
|
+
allowedTypes: ["string"]
|
|
2227
|
+
};
|
|
2228
|
+
const defaultDateTimeFilterMethod = {
|
|
2229
|
+
method: "lessthan",
|
|
2230
|
+
icon: "<",
|
|
2231
|
+
description: "Less than",
|
|
2232
|
+
allowedTypes: [
|
|
2233
|
+
"number",
|
|
2234
|
+
"date",
|
|
2235
|
+
"datetime"
|
|
2236
|
+
]
|
|
2237
|
+
};
|
|
2238
|
+
const filterMethods = [
|
|
2239
|
+
defaultStringFilterMethod,
|
|
2240
|
+
{
|
|
2241
|
+
method: "notcontains",
|
|
2242
|
+
icon: "⊄",
|
|
2243
|
+
description: "Does not contain",
|
|
2244
|
+
allowedTypes: ["string"]
|
|
2245
|
+
},
|
|
2246
|
+
{
|
|
2247
|
+
method: "startswith",
|
|
2248
|
+
icon: "^",
|
|
2249
|
+
description: "Starts with",
|
|
2250
|
+
allowedTypes: ["string"]
|
|
2251
|
+
},
|
|
2252
|
+
{
|
|
2253
|
+
method: "endswith",
|
|
2254
|
+
icon: "$",
|
|
2255
|
+
description: "Ends with",
|
|
2256
|
+
allowedTypes: ["string"]
|
|
2257
|
+
},
|
|
2258
|
+
defaultFilterMethod,
|
|
2259
|
+
{
|
|
2260
|
+
method: "notequal",
|
|
2261
|
+
icon: "≠",
|
|
2262
|
+
description: "Does not equal",
|
|
2263
|
+
allowedTypes: [
|
|
2264
|
+
"number",
|
|
2265
|
+
"string",
|
|
2266
|
+
"boolean",
|
|
2267
|
+
"date"
|
|
2268
|
+
]
|
|
2269
|
+
},
|
|
2270
|
+
defaultDateTimeFilterMethod,
|
|
2271
|
+
{
|
|
2272
|
+
method: "greaterthan",
|
|
2273
|
+
icon: ">",
|
|
2274
|
+
description: "Greater than",
|
|
2275
|
+
allowedTypes: [
|
|
2276
|
+
"number",
|
|
2277
|
+
"date",
|
|
2278
|
+
"datetime"
|
|
2279
|
+
]
|
|
2280
|
+
},
|
|
2281
|
+
{
|
|
2282
|
+
method: "equalorlessthan",
|
|
2283
|
+
icon: "≤",
|
|
2284
|
+
description: "Less than or equal to",
|
|
2285
|
+
allowedTypes: [
|
|
2286
|
+
"number",
|
|
2287
|
+
"date",
|
|
2288
|
+
"datetime"
|
|
2289
|
+
]
|
|
2290
|
+
},
|
|
2291
|
+
{
|
|
2292
|
+
method: "equalorgreaterthan",
|
|
2293
|
+
icon: "≥",
|
|
2294
|
+
description: "Greater than or equal to",
|
|
2295
|
+
allowedTypes: [
|
|
2296
|
+
"number",
|
|
2297
|
+
"date",
|
|
2298
|
+
"datetime"
|
|
2299
|
+
]
|
|
2300
|
+
}
|
|
2301
|
+
];
|
|
2302
|
+
const gridColumnTypes = [
|
|
2303
|
+
"string",
|
|
2304
|
+
"boolean",
|
|
2305
|
+
"number",
|
|
2306
|
+
"date",
|
|
2307
|
+
"datetime",
|
|
2308
|
+
"slot"
|
|
2309
|
+
];
|
|
2310
|
+
function isGridColumn(objectToTest) {
|
|
2311
|
+
return typeof objectToTest.caption === "string" && typeof objectToTest.name === "string" && typeof objectToTest.type === "string";
|
|
2312
|
+
}
|
|
2313
|
+
function isGridColumnArray(arrayToTest) {
|
|
2314
|
+
let arrayIsValid = Array.isArray(arrayToTest);
|
|
2315
|
+
if (arrayIsValid) {
|
|
2316
|
+
for (const objectToTest of arrayToTest) {
|
|
2317
|
+
if (!isGridColumn(objectToTest)) {
|
|
2318
|
+
arrayIsValid = false;
|
|
2319
|
+
break;
|
|
2320
|
+
}
|
|
2321
|
+
}
|
|
2322
|
+
}
|
|
2323
|
+
return arrayIsValid;
|
|
2324
|
+
}
|
|
2325
|
+
const stringFormats = ["ellipsis"];
|
|
2326
|
+
var FilterOperation;
|
|
2327
|
+
(function(FilterOperation2) {
|
|
2328
|
+
FilterOperation2[FilterOperation2["CONTAINS"] = 0] = "CONTAINS";
|
|
2329
|
+
FilterOperation2[FilterOperation2["NOT_CONTAINS"] = 1] = "NOT_CONTAINS";
|
|
2330
|
+
FilterOperation2[FilterOperation2["EQUAL"] = 2] = "EQUAL";
|
|
2331
|
+
FilterOperation2[FilterOperation2["NOT_EQUAL"] = 3] = "NOT_EQUAL";
|
|
2332
|
+
FilterOperation2[FilterOperation2["STARTS_WITH"] = 4] = "STARTS_WITH";
|
|
2333
|
+
FilterOperation2[FilterOperation2["ENDS_WITH"] = 5] = "ENDS_WITH";
|
|
2334
|
+
FilterOperation2[FilterOperation2["GREATER_THAN"] = 6] = "GREATER_THAN";
|
|
2335
|
+
FilterOperation2[FilterOperation2["LESS_THAN"] = 7] = "LESS_THAN";
|
|
2336
|
+
FilterOperation2[FilterOperation2["EQUAL_OR_GREATER_THAN"] = 8] = "EQUAL_OR_GREATER_THAN";
|
|
2337
|
+
FilterOperation2[FilterOperation2["EQUAL_OR_LESS_THAN"] = 9] = "EQUAL_OR_LESS_THAN";
|
|
2338
|
+
})(FilterOperation || (FilterOperation = {}));
|
|
2339
|
+
const filterMethodTypes = [
|
|
2340
|
+
"equal",
|
|
2341
|
+
"notequal",
|
|
2342
|
+
"contains",
|
|
2343
|
+
"notcontains",
|
|
2344
|
+
"lessthan",
|
|
2345
|
+
"greaterthan",
|
|
2346
|
+
"startswith",
|
|
2347
|
+
"endswith",
|
|
2348
|
+
"equalorlessthan",
|
|
2349
|
+
"equalorgreaterthan"
|
|
2350
|
+
];
|
|
2351
|
+
function isFilterArgs(objectToTest) {
|
|
2352
|
+
return typeof objectToTest.filterOnColumn === "string" && typeof objectToTest.filterOperation === "number" && typeof objectToTest.filterValue === "string";
|
|
2353
|
+
}
|
|
2354
|
+
function isSortArgs(objectToTest) {
|
|
2355
|
+
return objectToTest === null || typeof objectToTest.sortByAscending === "boolean" && typeof objectToTest.sortOnColumn === "string";
|
|
2356
|
+
}
|
|
2357
|
+
function isFilterRequest(objectToTest) {
|
|
2358
|
+
let objectValid = typeof objectToTest.filters === "object" && Array.isArray(objectToTest.filters) && typeof objectToTest.pageNumber === "number" && typeof objectToTest.pageSize === "number" && typeof objectToTest.sort === "object" && isSortArgs(objectToTest.sort);
|
|
2359
|
+
if (objectValid) {
|
|
2360
|
+
for (const filterArgs of objectToTest.filters) {
|
|
2361
|
+
if (!isFilterArgs(filterArgs)) {
|
|
2362
|
+
objectValid = false;
|
|
2363
|
+
break;
|
|
2364
|
+
}
|
|
2365
|
+
}
|
|
2366
|
+
}
|
|
2367
|
+
return objectValid;
|
|
2368
|
+
}
|
|
2369
|
+
function isFilterResponse(objectToTest, resultValidator) {
|
|
2370
|
+
let objectValid = typeof objectToTest.results === "object" && Array.isArray(objectToTest.results) && typeof objectToTest.totalRecords === "number";
|
|
2371
|
+
if (objectValid) {
|
|
2372
|
+
for (const result of objectToTest.results) {
|
|
2373
|
+
if (!resultValidator(result)) {
|
|
2374
|
+
objectValid = false;
|
|
2375
|
+
break;
|
|
2376
|
+
}
|
|
2377
|
+
}
|
|
2378
|
+
}
|
|
2379
|
+
return objectValid;
|
|
2380
|
+
}
|
|
2381
|
+
const _hoisted_1$a = {
|
|
2382
|
+
key: 0,
|
|
2383
|
+
class: "cl-border-grey-2 cl-border-r cl-capitalize cl-group cl-inline cl-relative cl-w-auto"
|
|
2384
|
+
};
|
|
2385
|
+
const _hoisted_2$a = { class: "cl-bg-off-white cl-flex cl-h-full cl-items-center cl-justify-center cl-w-10" };
|
|
2386
|
+
const _hoisted_3$9 = { class: "cl-p-3" };
|
|
2387
|
+
const _hoisted_4$9 = { class: "cl-px-4 cl-py-1 cl-w-full" };
|
|
2388
|
+
const _hoisted_5$8 = ["innerHTML"];
|
|
2389
|
+
const _hoisted_6$7 = { class: "cl-p-3" };
|
|
2390
|
+
const _hoisted_7$6 = ["onClick"];
|
|
2391
|
+
const _hoisted_8$4 = ["innerHTML"];
|
|
2392
|
+
const _hoisted_9$4 = /* @__PURE__ */ createElementVNode("option", { value: void 0 }, null, -1);
|
|
2393
|
+
const _hoisted_10$4 = ["selected"];
|
|
2394
|
+
const _hoisted_11$4 = ["selected"];
|
|
2395
|
+
const _hoisted_12$4 = ["value"];
|
|
2396
|
+
const _hoisted_13$4 = ["value"];
|
|
2397
|
+
const _hoisted_14$3 = {
|
|
2398
|
+
key: 1,
|
|
2399
|
+
class: "cl-flex cl-w-full"
|
|
2400
|
+
};
|
|
2401
|
+
const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
2402
|
+
props: {
|
|
2403
|
+
request: null,
|
|
2404
|
+
column: null,
|
|
2405
|
+
firstHalf: { default: true }
|
|
2406
|
+
},
|
|
2407
|
+
emits: {
|
|
2408
|
+
"update:request": null
|
|
2409
|
+
},
|
|
2410
|
+
setup(__props, { emit }) {
|
|
2411
|
+
const props = __props;
|
|
2412
|
+
const { locale, t } = useI18n();
|
|
2413
|
+
const { debounce } = useDebouncer(750);
|
|
2414
|
+
const allowedFilterMethods = computed(() => {
|
|
2415
|
+
const methods = getAllowedMethods();
|
|
2416
|
+
methods.forEach((m) => {
|
|
2417
|
+
m.description = t(`grid.${m.method}`);
|
|
2418
|
+
});
|
|
2419
|
+
return methods;
|
|
2420
|
+
});
|
|
2421
|
+
const currentFilterMethod = computed(() => {
|
|
2422
|
+
var _a;
|
|
2423
|
+
let filterMethod = (_a = props.request.filters.find((f) => f.filterOnColumn === props.column.field)) == null ? void 0 : _a.filterMethod;
|
|
2424
|
+
if (typeof filterMethod === "undefined") {
|
|
2425
|
+
filterMethod = FilterOperation[getDefaultFilterOperation()];
|
|
2426
|
+
}
|
|
2427
|
+
return allowedFilterMethods.value.find((m) => {
|
|
2428
|
+
var _a2;
|
|
2429
|
+
return m.method.toLowerCase() === ((_a2 = filterMethod == null ? void 0 : filterMethod.removeNonAlphanumeric()) == null ? void 0 : _a2.toLowerCase());
|
|
2430
|
+
});
|
|
2431
|
+
});
|
|
2432
|
+
const currentFilter = computed(() => {
|
|
2433
|
+
var _a, _b;
|
|
2434
|
+
return (_b = (_a = props.request.filters.find((f) => f.filterOnColumn === props.column.field)) == null ? void 0 : _a.filterValue) != null ? _b : "";
|
|
2435
|
+
});
|
|
2436
|
+
const currentNumberFilter = computed(() => Number(currentFilter.value));
|
|
2437
|
+
const currentDateFilter = computed(() => currentFilter.value !== "" ? new Date(currentFilter.value) : null);
|
|
2438
|
+
const decimalSeparator = computed(() => Intl.NumberFormat(locale.value).format(1.1).replace(/[0-9]+/g, ""));
|
|
2439
|
+
function getDefaultFilterOperation() {
|
|
2440
|
+
return props.column.type === "string" || props.column.slotType === "string" ? FilterOperation.CONTAINS : props.column.type === "datetime" || props.column.slotType === "datetime" ? FilterOperation.LESS_THAN : FilterOperation.EQUAL;
|
|
2441
|
+
}
|
|
2442
|
+
function getAllowedMethods() {
|
|
2443
|
+
let result = [];
|
|
2444
|
+
if (props.column.type !== "slot") {
|
|
2445
|
+
result = filterMethods.filter((f) => f.allowedTypes.includes(props.column.type));
|
|
2446
|
+
} else if (typeof props.column.slotType !== "undefined" && typeof props.column.field !== "undefined") {
|
|
2447
|
+
result = filterMethods.filter((f) => f.allowedTypes.includes(props.column.slotType));
|
|
2448
|
+
}
|
|
2449
|
+
return result;
|
|
2450
|
+
}
|
|
2451
|
+
function setFilterMethod(filterMethod) {
|
|
2452
|
+
const filterRequest = copy(props.request);
|
|
2453
|
+
const index = filterRequest.filters.findIndex((f) => f.filterOnColumn === props.column.field);
|
|
2454
|
+
if (index >= 0) {
|
|
2455
|
+
filterRequest.filters[index].filterOperation = FilterOperation[filterMethod.toUpperCase()];
|
|
2456
|
+
filterRequest.filters[index].filterMethod = filterMethod.toUpperCase();
|
|
2457
|
+
} else if (typeof props.column.field !== "undefined") {
|
|
2458
|
+
filterRequest.filters.push({
|
|
2459
|
+
filterOnColumn: props.column.field,
|
|
2460
|
+
filterMethod: filterMethod.toUpperCase(),
|
|
2461
|
+
filterOperation: FilterOperation[filterMethod.toUpperCase()],
|
|
2462
|
+
filterValue: ""
|
|
2463
|
+
});
|
|
2464
|
+
}
|
|
2465
|
+
emit("update:request", filterRequest);
|
|
2466
|
+
}
|
|
2467
|
+
function setFilter(target, defaultValue) {
|
|
2468
|
+
var _a;
|
|
2469
|
+
const value = ((_a = target == null ? void 0 : target.value) != null ? _a : defaultValue).trim();
|
|
2470
|
+
const filterRequest = copy(props.request);
|
|
2471
|
+
const index = filterRequest.filters.findIndex((f) => f.filterOnColumn === props.column.field);
|
|
2472
|
+
let preventEmit = false;
|
|
2473
|
+
filterRequest.pageNumber = 1;
|
|
2474
|
+
if (index >= 0) {
|
|
2475
|
+
preventEmit = filterRequest.filters[index].filterValue === value;
|
|
2476
|
+
filterRequest.filters[index].filterValue = value;
|
|
2477
|
+
} else if (value !== "" && typeof props.column.field !== "undefined") {
|
|
2478
|
+
const defaultFilterOperation = getDefaultFilterOperation();
|
|
2479
|
+
filterRequest.filters.push({
|
|
2480
|
+
filterOnColumn: props.column.field,
|
|
2481
|
+
filterMethod: FilterOperation[defaultFilterOperation],
|
|
2482
|
+
filterOperation: defaultFilterOperation,
|
|
2483
|
+
filterValue: value
|
|
2484
|
+
});
|
|
2485
|
+
}
|
|
2486
|
+
if (preventEmit === false) {
|
|
2487
|
+
emit("update:request", filterRequest);
|
|
2488
|
+
}
|
|
2489
|
+
}
|
|
2490
|
+
function setNumberFilter(target) {
|
|
2491
|
+
var _a, _b;
|
|
2492
|
+
let inputValue = (_b = (_a = target == null ? void 0 : target.value) == null ? void 0 : _a.replace(new RegExp(`[^0-9\\${decimalSeparator.value}]`, "g"), "")) != null ? _b : "";
|
|
2493
|
+
let value = "";
|
|
2494
|
+
if (props.column.format === NumberFormat.INTEGER) {
|
|
2495
|
+
value = parseInt(inputValue);
|
|
2496
|
+
} else {
|
|
2497
|
+
inputValue = inputValue.replace(decimalSeparator.value, ".");
|
|
2498
|
+
value = parseFloat(inputValue);
|
|
2499
|
+
}
|
|
2500
|
+
if (typeof value === "number" && isNaN(value)) {
|
|
2501
|
+
value = "";
|
|
2502
|
+
}
|
|
2503
|
+
setFilter(null, value.toString());
|
|
2504
|
+
}
|
|
2505
|
+
function setDateFilter(value) {
|
|
2506
|
+
var _a;
|
|
2507
|
+
setFilter(null, (_a = value == null ? void 0 : value.toISOString()) != null ? _a : "");
|
|
2508
|
+
}
|
|
2509
|
+
return (_ctx, _cache) => {
|
|
2510
|
+
var _a, _b;
|
|
2511
|
+
const _component_icon = resolveComponent("icon");
|
|
2512
|
+
const _component_cl_ui_calendar = resolveComponent("cl-ui-calendar");
|
|
2513
|
+
return __props.column.filterable === void 0 || __props.column.filterable === true ? (openBlock(), createElementBlock("div", {
|
|
2514
|
+
key: 0,
|
|
2515
|
+
class: normalizeClass(["cl-border-grey-2 cl-flex cl-rounded cl-w-full", {
|
|
2516
|
+
"cl-border-b cl-p-5": __props.column.type === "slot" && (__props.column.slotType === void 0 || __props.column.field === void 0),
|
|
2517
|
+
"cl-border": __props.column.type !== "slot" || __props.column.slotType !== void 0 && __props.column.field !== void 0
|
|
2518
|
+
}])
|
|
2519
|
+
}, [
|
|
2520
|
+
__props.column.type !== "slot" || __props.column.slotType !== void 0 && __props.column.field !== void 0 ? (openBlock(), createElementBlock("div", _hoisted_1$a, [
|
|
2521
|
+
createElementVNode("div", _hoisted_2$a, [
|
|
2522
|
+
createVNode(_component_icon, {
|
|
2523
|
+
icon: "ph:sliders-horizontal",
|
|
2524
|
+
size: 20
|
|
2525
|
+
})
|
|
2526
|
+
]),
|
|
2527
|
+
createElementVNode("div", {
|
|
2528
|
+
class: normalizeClass(["cl-absolute cl-bg-white cl-flex-wrap cl-font-normal cl-h-0 cl-hidden cl-pb-2 cl-shadow-lg cl-text-left cl-text-sm cl-top-10 cl-z-10 group-hover:cl-flex group-hover:cl-h-auto group-hover:cl-w-52", {
|
|
2529
|
+
"cl-left-0": __props.firstHalf,
|
|
2530
|
+
"cl--left-44": !__props.firstHalf
|
|
2531
|
+
}])
|
|
2532
|
+
}, [
|
|
2533
|
+
createElementVNode("strong", _hoisted_3$9, toDisplayString(unref(t)("grid.currentMethod")), 1),
|
|
2534
|
+
createElementVNode("span", _hoisted_4$9, [
|
|
2535
|
+
createTextVNode(toDisplayString((_a = unref(currentFilterMethod)) == null ? void 0 : _a.description) + " ", 1),
|
|
2536
|
+
createElementVNode("span", {
|
|
2537
|
+
class: "cl-float-right",
|
|
2538
|
+
innerHTML: (_b = unref(currentFilterMethod)) == null ? void 0 : _b.icon
|
|
2539
|
+
}, null, 8, _hoisted_5$8)
|
|
2540
|
+
]),
|
|
2541
|
+
createElementVNode("strong", _hoisted_6$7, toDisplayString(unref(t)("grid.availableMethods")), 1),
|
|
2542
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(allowedFilterMethods), (filterMethod, index) => {
|
|
2543
|
+
return openBlock(), createElementBlock("span", {
|
|
2544
|
+
key: index,
|
|
2545
|
+
class: "cl-cursor-pointer cl-px-4 cl-py-1 cl-w-full hover:cl-bg-off-white",
|
|
2546
|
+
onClick: withModifiers(($event) => setFilterMethod(filterMethod.method), ["prevent"])
|
|
2547
|
+
}, [
|
|
2548
|
+
createTextVNode(toDisplayString(filterMethod.description) + " ", 1),
|
|
2549
|
+
createElementVNode("span", {
|
|
2550
|
+
class: "cl-float-right",
|
|
2551
|
+
innerHTML: filterMethod.icon
|
|
2552
|
+
}, null, 8, _hoisted_8$4)
|
|
2553
|
+
], 8, _hoisted_7$6);
|
|
2554
|
+
}), 128))
|
|
2555
|
+
], 2)
|
|
2556
|
+
])) : createCommentVNode("", true),
|
|
2557
|
+
__props.column.type === "boolean" || __props.column.slotType === "boolean" && typeof __props.column.field !== "undefined" ? (openBlock(), createElementBlock("select", {
|
|
2558
|
+
key: 1,
|
|
2559
|
+
class: "cl-border-none cl-w-full",
|
|
2560
|
+
onChange: _cache[0] || (_cache[0] = ($event) => setFilter($event.target))
|
|
2561
|
+
}, [
|
|
2562
|
+
_hoisted_9$4,
|
|
2563
|
+
createElementVNode("option", {
|
|
2564
|
+
value: "true",
|
|
2565
|
+
selected: unref(currentFilter) === "true"
|
|
2566
|
+
}, toDisplayString(unref(t)("grid.true")), 9, _hoisted_10$4),
|
|
2567
|
+
createElementVNode("option", {
|
|
2568
|
+
value: "false",
|
|
2569
|
+
selected: unref(currentFilter) === "false"
|
|
2570
|
+
}, toDisplayString(unref(t)("grid.false")), 9, _hoisted_11$4)
|
|
2571
|
+
], 32)) : __props.column.type === "date" || __props.column.type === "datetime" || (__props.column.slotType === "date" || __props.column.slotType === "datetime") && typeof __props.column.field !== "undefined" ? (openBlock(), createBlock(_component_cl_ui_calendar, {
|
|
2572
|
+
key: 2,
|
|
2573
|
+
date: unref(currentDateFilter),
|
|
2574
|
+
class: "cl-border-none cl-w-full",
|
|
2575
|
+
type: __props.column.type,
|
|
2576
|
+
"date-placeholder": unref(t)("grid.selectDate"),
|
|
2577
|
+
"date-time-placeholder": unref(t)("grid.selectDateTime"),
|
|
2578
|
+
"onUpdate:date": _cache[1] || (_cache[1] = ($event) => setDateFilter($event))
|
|
2579
|
+
}, null, 8, ["date", "type", "date-placeholder", "date-time-placeholder"])) : __props.column.type === "number" || __props.column.slotType === "number" && typeof __props.column.field !== "undefined" ? (openBlock(), createElementBlock("input", {
|
|
2580
|
+
key: 3,
|
|
2581
|
+
value: unref(currentFilter),
|
|
2582
|
+
class: "cl-border-none cl-w-full",
|
|
2583
|
+
type: "text",
|
|
2584
|
+
onKeyup: [
|
|
2585
|
+
_cache[2] || (_cache[2] = withKeys(($event) => setFilter(null, (unref(currentNumberFilter) + 1).toString()), ["arrow-up"])),
|
|
2586
|
+
_cache[3] || (_cache[3] = withKeys(($event) => setFilter(null, (unref(currentNumberFilter) - 1).toString()), ["arrow-down"]))
|
|
2587
|
+
],
|
|
2588
|
+
onInput: _cache[4] || (_cache[4] = ($event) => unref(debounce)(setNumberFilter, [$event.target]))
|
|
2589
|
+
}, null, 40, _hoisted_12$4)) : __props.column.type !== "slot" || __props.column.slotType === "string" && typeof __props.column.field !== "undefined" ? (openBlock(), createElementBlock("input", {
|
|
2590
|
+
key: 4,
|
|
2591
|
+
value: unref(currentFilter),
|
|
2592
|
+
class: "cl-border-none cl-w-full",
|
|
2593
|
+
type: "text",
|
|
2594
|
+
onInput: _cache[5] || (_cache[5] = ($event) => unref(debounce)(setFilter, [$event.target]))
|
|
2595
|
+
}, null, 40, _hoisted_13$4)) : createCommentVNode("", true)
|
|
2596
|
+
], 2)) : (openBlock(), createElementBlock("div", _hoisted_14$3, " \xA0 "));
|
|
2597
|
+
};
|
|
2598
|
+
}
|
|
2599
|
+
});
|
|
2600
|
+
const _hoisted_1$9 = {
|
|
2601
|
+
key: 0,
|
|
2602
|
+
class: "cl-flex cl-flex-wrap cl-justify-end cl-mt-4 cl-w-full"
|
|
2603
|
+
};
|
|
2604
|
+
const _hoisted_2$9 = { class: "cl-bg-off-white cl-border cl-border-grey-0 cl-flex cl-items-center cl-mb-2 cl-px-3 cl-py-2 cl-rounded cl-shadow-md cl-text-sm cl-w-full lg:cl-w-auto" };
|
|
2605
|
+
const _hoisted_3$8 = { class: "cl-text-grey-3 cl-w-max" };
|
|
2606
|
+
const _hoisted_4$8 = ["value"];
|
|
2607
|
+
const _hoisted_5$7 = { class: "cl-bg-off-white cl-border cl-border-grey-0 cl-flex cl-flex-wrap cl-items-center cl-mb-2 cl-px-3 cl-py-2 cl-rounded cl-shadow-md cl-text-sm cl-w-full lg:cl-ml-2 lg:cl-w-auto mb:cl-flex-nowrap" };
|
|
2608
|
+
const _hoisted_6$6 = { class: "cl-flex cl-flex-wrap cl-mb-2 cl-text-sm cl-w-full lg:cl-p-2 md:cl-mb-0 md:cl-w-auto" };
|
|
2609
|
+
const _hoisted_7$5 = { class: "cl-flex cl-flex-wrap cl-mb-2 cl-w-full lg:cl-mb-0 lg:cl-mr-2 lg:cl-w-auto" };
|
|
2610
|
+
const _hoisted_8$3 = { class: "cl-text-grey-3 cl-w-full lg:cl-mr-2 lg:cl-w-auto" };
|
|
2611
|
+
const _hoisted_9$3 = { class: "cl-flex cl-flex-wrap cl-text-sm mb:cl-flex-nowrap" };
|
|
2612
|
+
const _hoisted_10$3 = { class: "cl-pr-2" };
|
|
2613
|
+
const _hoisted_11$3 = ["onClick"];
|
|
2614
|
+
const _hoisted_12$3 = { class: "cl-flex cl-flex-wrap cl-mb-2 cl-text-sm cl-w-full lg:cl-p-2 md:cl-mb-0 md:cl-w-auto" };
|
|
2615
|
+
const _hoisted_13$3 = { class: "cl-mb-2 cl-text-grey-3 cl-w-full lg:cl-mb-0 lg:cl-mr-2 lg:cl-w-auto" };
|
|
2616
|
+
const _hoisted_14$2 = ["onClick"];
|
|
2617
|
+
const _hoisted_15$2 = { class: "cl-mb-2 cl-w-full lg:cl-p-2 md:cl-mb-0 md:cl-w-auto" };
|
|
2618
|
+
const _hoisted_16$1 = { class: "cl-block cl-mb-2 cl-text-grey-3 cl-w-full lg:cl-inline-block lg:cl-mb-0 lg:cl-mr-1 lg:cl-w-auto" };
|
|
2619
|
+
const _hoisted_17$1 = { class: "cl-block lg:cl-inline-block" };
|
|
2620
|
+
const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
2621
|
+
props: {
|
|
2622
|
+
request: null,
|
|
2623
|
+
data: { default: () => null }
|
|
2624
|
+
},
|
|
2625
|
+
emits: {
|
|
2626
|
+
"update:request": null
|
|
2627
|
+
},
|
|
2628
|
+
setup(__props, { emit }) {
|
|
2629
|
+
const props = __props;
|
|
2630
|
+
const pageSizes = [
|
|
2631
|
+
10,
|
|
2632
|
+
20,
|
|
2633
|
+
50,
|
|
2634
|
+
100,
|
|
2635
|
+
200
|
|
2636
|
+
];
|
|
2637
|
+
const { n, t } = useI18n();
|
|
2638
|
+
const { debounce } = useDebouncer();
|
|
2639
|
+
const totalPages = computed(() => props.data !== null ? Math.ceil(props.data.totalRecords / props.request.pageSize) : 1);
|
|
2640
|
+
const pageNumbers = computed(() => {
|
|
2641
|
+
const calculatedPageNumbers = Array.from(Array(totalPages.value + 1).keys());
|
|
2642
|
+
let results = [];
|
|
2643
|
+
calculatedPageNumbers.shift();
|
|
2644
|
+
if (calculatedPageNumbers.length) {
|
|
2645
|
+
const startPage = props.request.pageNumber === totalPages.value || props.request.pageNumber === totalPages.value - 1 ? totalPages.value - 3 : props.request.pageNumber - 1;
|
|
2646
|
+
const endPage = startPage + 3;
|
|
2647
|
+
results = calculatedPageNumbers.slice(startPage, endPage);
|
|
2648
|
+
}
|
|
2649
|
+
return results;
|
|
2650
|
+
});
|
|
2651
|
+
function setPage(pageNumber) {
|
|
2652
|
+
const filterRequest = copy(props.request);
|
|
2653
|
+
if (filterRequest.pageNumber !== pageNumber) {
|
|
2654
|
+
filterRequest.pageNumber = Math.max(Math.min(Math.trunc(pageNumber), totalPages.value), 1);
|
|
2655
|
+
emit("update:request", filterRequest);
|
|
2656
|
+
}
|
|
2657
|
+
}
|
|
2658
|
+
function setPageFromInput(target) {
|
|
2659
|
+
const pageNumber = parseInt(target == null ? void 0 : target.value) || 1;
|
|
2660
|
+
setPage(pageNumber);
|
|
2661
|
+
}
|
|
2662
|
+
function setPageSize(pageSize) {
|
|
2663
|
+
const filterRequest = copy(props.request);
|
|
2664
|
+
filterRequest.pageSize = pageSize;
|
|
2665
|
+
filterRequest.pageNumber = 1;
|
|
2666
|
+
emit("update:request", filterRequest);
|
|
2667
|
+
}
|
|
2668
|
+
return (_ctx, _cache) => {
|
|
2669
|
+
var _a;
|
|
2670
|
+
const _component_icon = resolveComponent("icon");
|
|
2671
|
+
return __props.data && ((_a = __props.data.results) == null ? void 0 : _a.length) && __props.request ? (openBlock(), createElementBlock("div", _hoisted_1$9, [
|
|
2672
|
+
createElementVNode("div", _hoisted_2$9, [
|
|
2673
|
+
createElementVNode("span", _hoisted_3$8, toDisplayString(unref(t)("grid.jumpToPage")), 1),
|
|
2674
|
+
createElementVNode("input", {
|
|
2675
|
+
class: "!cl-h-8 !cl-inline-block !cl-ml-2 !cl-text-sm !cl-w-max",
|
|
2676
|
+
value: __props.request.pageNumber,
|
|
2677
|
+
type: "number",
|
|
2678
|
+
onInput: _cache[0] || (_cache[0] = ($event) => unref(debounce)(setPageFromInput, [$event.target]))
|
|
2679
|
+
}, null, 40, _hoisted_4$8)
|
|
2680
|
+
]),
|
|
2681
|
+
createElementVNode("div", _hoisted_5$7, [
|
|
2682
|
+
createElementVNode("div", _hoisted_6$6, [
|
|
2683
|
+
createElementVNode("li", _hoisted_7$5, [
|
|
2684
|
+
createElementVNode("span", _hoisted_8$3, toDisplayString(unref(t)("grid.page")), 1)
|
|
2685
|
+
]),
|
|
2686
|
+
createElementVNode("ul", _hoisted_9$3, [
|
|
2687
|
+
createElementVNode("li", _hoisted_10$3, toDisplayString(unref(n)(__props.request.pageNumber, unref(NumberFormat).INTEGER)) + " / " + toDisplayString(unref(n)(unref(totalPages), unref(NumberFormat).INTEGER)), 1),
|
|
2688
|
+
withDirectives(createElementVNode("li", {
|
|
2689
|
+
class: "cl-cursor-pointer cl-mr-1 cl-mt-1 lg:cl-mr-2",
|
|
2690
|
+
onClick: _cache[1] || (_cache[1] = ($event) => setPage(1))
|
|
2691
|
+
}, [
|
|
2692
|
+
createVNode(_component_icon, {
|
|
2693
|
+
icon: "ph:caret-double-left",
|
|
2694
|
+
size: 14
|
|
2695
|
+
})
|
|
2696
|
+
], 512), [
|
|
2697
|
+
[vShow, __props.request.pageNumber > 1]
|
|
2698
|
+
]),
|
|
2699
|
+
withDirectives(createElementVNode("li", {
|
|
2700
|
+
class: "cl-cursor-pointer cl-mt-1 lg:cl-mr-2 mr-1",
|
|
2701
|
+
onClick: _cache[2] || (_cache[2] = ($event) => setPage(__props.request.pageNumber - 1))
|
|
2702
|
+
}, [
|
|
2703
|
+
createVNode(_component_icon, {
|
|
2704
|
+
icon: "ph:caret-left",
|
|
2705
|
+
size: 14
|
|
2706
|
+
})
|
|
2707
|
+
], 512), [
|
|
2708
|
+
[vShow, __props.request.pageNumber > 1]
|
|
2709
|
+
]),
|
|
2710
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(pageNumbers), (number, index) => {
|
|
2711
|
+
return openBlock(), createElementBlock("li", {
|
|
2712
|
+
key: index,
|
|
2713
|
+
class: normalizeClass(["cl-cursor-pointer cl-mr-1 lg:cl-mr-2", {
|
|
2714
|
+
"cl-text-black cl-font-bold": __props.request.pageNumber === number,
|
|
2715
|
+
"cl-text-grey-6": __props.request.pageNumber !== number
|
|
2716
|
+
}]),
|
|
2717
|
+
onClick: ($event) => setPage(number)
|
|
2718
|
+
}, toDisplayString(unref(n)(number, unref(NumberFormat).INTEGER)), 11, _hoisted_11$3);
|
|
2719
|
+
}), 128)),
|
|
2720
|
+
withDirectives(createElementVNode("li", {
|
|
2721
|
+
class: "cl-cursor-pointer cl-mr-1 cl-mt-1 lg:cl-mr-2",
|
|
2722
|
+
onClick: _cache[3] || (_cache[3] = ($event) => setPage(__props.request.pageNumber + 1))
|
|
2723
|
+
}, [
|
|
2724
|
+
createVNode(_component_icon, {
|
|
2725
|
+
icon: "ph:caret-right",
|
|
2726
|
+
size: 14
|
|
2727
|
+
})
|
|
2728
|
+
], 512), [
|
|
2729
|
+
[vShow, __props.request.pageNumber < unref(totalPages)]
|
|
2730
|
+
]),
|
|
2731
|
+
withDirectives(createElementVNode("li", {
|
|
2732
|
+
class: "cl-cursor-pointer cl-mr-1 cl-mt-1 lg:cl-mr-2",
|
|
2733
|
+
onClick: _cache[4] || (_cache[4] = ($event) => setPage(unref(totalPages)))
|
|
2734
|
+
}, [
|
|
2735
|
+
createVNode(_component_icon, {
|
|
2736
|
+
icon: "ph:caret-double-right",
|
|
2737
|
+
size: 14
|
|
2738
|
+
})
|
|
2739
|
+
], 512), [
|
|
2740
|
+
[vShow, __props.request.pageNumber < unref(totalPages)]
|
|
2741
|
+
])
|
|
2742
|
+
])
|
|
2743
|
+
]),
|
|
2744
|
+
createElementVNode("ul", _hoisted_12$3, [
|
|
2745
|
+
createElementVNode("li", _hoisted_13$3, toDisplayString(unref(t)("grid.pageSize")), 1),
|
|
2746
|
+
(openBlock(), createElementBlock(Fragment, null, renderList(pageSizes, (size, index) => {
|
|
2747
|
+
return createElementVNode("li", {
|
|
2748
|
+
key: index,
|
|
2749
|
+
class: normalizeClass(["cl-cursor-pointer cl-mr-1 lg:cl-mr-2", {
|
|
2750
|
+
"cl-text-black cl-font-bold": __props.request.pageSize === size,
|
|
2751
|
+
"cl-text-grey-6": __props.request.pageSize !== size
|
|
2752
|
+
}]),
|
|
2753
|
+
onClick: ($event) => setPageSize(size)
|
|
2754
|
+
}, toDisplayString(unref(n)(size, unref(NumberFormat).INTEGER)), 11, _hoisted_14$2);
|
|
2755
|
+
}), 64))
|
|
2756
|
+
]),
|
|
2757
|
+
createElementVNode("ul", _hoisted_15$2, [
|
|
2758
|
+
createElementVNode("li", _hoisted_16$1, toDisplayString(unref(t)("grid.totalRecords")), 1),
|
|
2759
|
+
createElementVNode("li", _hoisted_17$1, toDisplayString(unref(n)(__props.data.totalRecords, unref(NumberFormat).INTEGER)), 1)
|
|
2760
|
+
])
|
|
2761
|
+
])
|
|
2762
|
+
])) : createCommentVNode("", true);
|
|
2763
|
+
};
|
|
2764
|
+
}
|
|
2765
|
+
});
|
|
2766
|
+
const _hoisted_1$8 = { class: "cl-fixed cl-flex cl-h-full cl-right-0 cl-top-0 cl-w-full cl-z-40" };
|
|
2767
|
+
const _hoisted_2$8 = { class: "cl-bg-secondary-default cl-h-full cl-overflow-y-auto cl-px-10 cl-py-20 cl-relative cl-text-grey-2 cl-w-80" };
|
|
2768
|
+
const _hoisted_3$7 = { class: "cl-mb-4 cl-text-2xl cl-text-off-white" };
|
|
2769
|
+
const _hoisted_4$7 = { class: "cl-border-grey-3 cl-border-t cl-flex cl-flex-wrap cl-text-sm cl-w-full" };
|
|
2770
|
+
const _hoisted_5$6 = { class: "cl-border-b cl-border-grey-2 cl-flex cl-py-2 cl-text-sm cl-w-full" };
|
|
2771
|
+
const _hoisted_6$5 = { class: "cl-flex-1 cl-py-2" };
|
|
2772
|
+
const _hoisted_7$4 = { class: "cl-py-2 cl-w-1/4" };
|
|
2773
|
+
const _hoisted_8$2 = { class: "cl-py-2 cl-w-1/5" };
|
|
2774
|
+
const _hoisted_9$2 = { class: "cl-flex-1 cl-py-2" };
|
|
2775
|
+
const _hoisted_10$2 = { class: "cl-py-2 cl-w-1/4" };
|
|
2776
|
+
const _hoisted_11$2 = ["checked", "onClick"];
|
|
2777
|
+
const _hoisted_12$2 = { class: "cl-py-2 cl-text-off-white cl-w-1/5" };
|
|
2778
|
+
const _hoisted_13$2 = { key: 1 };
|
|
2779
|
+
const __default__ = {
|
|
2780
|
+
inheritAttrs: false
|
|
2781
|
+
};
|
|
2782
|
+
function setup(__props, { emit }) {
|
|
2783
|
+
const props = __props;
|
|
2784
|
+
const { t } = useI18n();
|
|
2785
|
+
const visible = ref(false);
|
|
2786
|
+
function moveColumn(columns, oldIndex, newIndex) {
|
|
2787
|
+
if (newIndex < columns.length && newIndex >= 0) {
|
|
2788
|
+
columns.splice(newIndex, 0, columns.splice(oldIndex, 1)[0]);
|
|
2789
|
+
}
|
|
2790
|
+
}
|
|
2791
|
+
function updateColumnVisibility(target, column) {
|
|
2792
|
+
var _a;
|
|
2793
|
+
const gridColumns = copy(props.columns);
|
|
2794
|
+
const checked = (_a = target == null ? void 0 : target.checked) != null ? _a : false;
|
|
2795
|
+
const targetColumnIndex = gridColumns.findIndex((c) => c.name === column.name);
|
|
2796
|
+
if (targetColumnIndex >= 0) {
|
|
2797
|
+
gridColumns[targetColumnIndex].visible = checked;
|
|
2798
|
+
}
|
|
2799
|
+
emit("update:columns", gridColumns);
|
|
2800
|
+
}
|
|
2801
|
+
function changeColumnOrder(columnIndex, direction) {
|
|
2802
|
+
const gridColumns = copy(props.columns);
|
|
2803
|
+
const newIndex = direction === "up" ? columnIndex + 1 : columnIndex - 1;
|
|
2804
|
+
moveColumn(gridColumns, columnIndex, newIndex);
|
|
2805
|
+
emit("update:columns", gridColumns);
|
|
2806
|
+
}
|
|
2807
|
+
return (_ctx, _cache) => {
|
|
2808
|
+
const _component_icon = resolveComponent("icon");
|
|
2809
|
+
return openBlock(), createElementBlock(Fragment, null, [
|
|
2810
|
+
createVNode(_sfc_main$k, mergeProps(_ctx.$attrs, {
|
|
2811
|
+
class: "cl-w-full",
|
|
2812
|
+
size: "small",
|
|
2813
|
+
onClick: _cache[0] || (_cache[0] = withModifiers(($event) => visible.value = true, ["prevent"]))
|
|
2814
|
+
}), {
|
|
2815
|
+
default: withCtx(() => [
|
|
2816
|
+
createTextVNode(toDisplayString(unref(t)("grid.manageView")), 1)
|
|
2817
|
+
]),
|
|
2818
|
+
_: 1
|
|
2819
|
+
}, 16),
|
|
2820
|
+
(openBlock(), createBlock(Teleport, { to: "body" }, [
|
|
2821
|
+
withDirectives(createElementVNode("div", _hoisted_1$8, [
|
|
2822
|
+
createElementVNode("div", {
|
|
2823
|
+
class: "cl-bg-black cl-cursor-pointer cl-flex-1 cl-h-full cl-opacity-40",
|
|
2824
|
+
onClick: _cache[1] || (_cache[1] = ($event) => visible.value = false)
|
|
2825
|
+
}),
|
|
2826
|
+
createElementVNode("div", _hoisted_2$8, [
|
|
2827
|
+
createVNode(_component_icon, {
|
|
2828
|
+
class: "cl-absolute cl-cursor-pointer cl-right-3 cl-text-off-white cl-top-3",
|
|
2829
|
+
icon: "ph:x",
|
|
2830
|
+
size: 16,
|
|
2831
|
+
onClick: _cache[2] || (_cache[2] = ($event) => visible.value = false)
|
|
2832
|
+
}),
|
|
2833
|
+
createElementVNode("h3", _hoisted_3$7, toDisplayString(unref(t)("grid.manageView")), 1),
|
|
2834
|
+
createElementVNode("ul", _hoisted_4$7, [
|
|
2835
|
+
createElementVNode("li", _hoisted_5$6, [
|
|
2836
|
+
createElementVNode("strong", _hoisted_6$5, toDisplayString(unref(t)("grid.column")), 1),
|
|
2837
|
+
createElementVNode("strong", _hoisted_7$4, toDisplayString(unref(t)("grid.visible")), 1),
|
|
2838
|
+
createElementVNode("strong", _hoisted_8$2, toDisplayString(unref(t)("grid.order")), 1)
|
|
2839
|
+
]),
|
|
2840
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(__props.columns, (column, index) => {
|
|
2841
|
+
return openBlock(), createElementBlock("li", {
|
|
2842
|
+
key: index,
|
|
2843
|
+
class: "cl-border-b cl-border-grey-2 cl-flex cl-py-2 cl-text-sm cl-w-full"
|
|
2844
|
+
}, [
|
|
2845
|
+
createElementVNode("div", _hoisted_9$2, toDisplayString(column.caption), 1),
|
|
2846
|
+
createElementVNode("div", _hoisted_10$2, [
|
|
2847
|
+
createElementVNode("input", {
|
|
2848
|
+
checked: column.visible === void 0 || column.visible === true,
|
|
2849
|
+
type: "checkbox",
|
|
2850
|
+
onClick: ($event) => updateColumnVisibility($event.target, column)
|
|
2851
|
+
}, null, 8, _hoisted_11$2)
|
|
2852
|
+
]),
|
|
2853
|
+
createElementVNode("div", _hoisted_12$2, [
|
|
2854
|
+
column.visible === void 0 || column.visible === true ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
2855
|
+
index !== 0 ? (openBlock(), createBlock(_component_icon, {
|
|
2856
|
+
key: 0,
|
|
2857
|
+
class: "cl-cursor-pointer cl-inline-block cl-mr-2",
|
|
2858
|
+
icon: "ph:arrow-left",
|
|
2859
|
+
onClick: ($event) => changeColumnOrder(index, "down")
|
|
2860
|
+
}, null, 8, ["onClick"])) : createCommentVNode("", true),
|
|
2861
|
+
index !== __props.columns.length - 1 ? (openBlock(), createBlock(_component_icon, {
|
|
2862
|
+
key: 1,
|
|
2863
|
+
class: "cl-cursor-pointer cl-inline-block",
|
|
2864
|
+
icon: "ph:arrow-right",
|
|
2865
|
+
onClick: ($event) => changeColumnOrder(index, "up")
|
|
2866
|
+
}, null, 8, ["onClick"])) : createCommentVNode("", true)
|
|
2867
|
+
], 64)) : (openBlock(), createElementBlock("em", _hoisted_13$2, toDisplayString(unref(t)("grid.hidden")), 1))
|
|
2868
|
+
])
|
|
2869
|
+
]);
|
|
2870
|
+
}), 128))
|
|
2871
|
+
])
|
|
2872
|
+
])
|
|
2873
|
+
], 512), [
|
|
2874
|
+
[vShow, visible.value]
|
|
2875
|
+
])
|
|
2876
|
+
]))
|
|
2877
|
+
], 64);
|
|
2878
|
+
};
|
|
2879
|
+
}
|
|
2880
|
+
const _sfc_main$8 = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__), {
|
|
2881
|
+
props: {
|
|
2882
|
+
columns: null
|
|
2883
|
+
},
|
|
2884
|
+
emits: {
|
|
2885
|
+
"update:columns": null
|
|
2886
|
+
},
|
|
2887
|
+
setup
|
|
2888
|
+
}));
|
|
2889
|
+
const _hoisted_1$7 = {
|
|
2890
|
+
key: 0,
|
|
2891
|
+
class: "cl-pb-2 cl-pr-2 cl-w-1/2 lg:cl-pb-0 lg:cl-w-auto"
|
|
2892
|
+
};
|
|
2893
|
+
const _hoisted_2$7 = { class: "cl-hidden cl-pr-2 lg:cl-inline-block" };
|
|
2894
|
+
const _hoisted_3$6 = { class: "cl-pb-2 cl-pr-2 cl-w-1/2 lg:cl-pb-0 lg:cl-pr-0 lg:cl-w-auto" };
|
|
2895
|
+
const _hoisted_4$6 = { class: "cl-pr-2 cl-w-1/2 lg:cl-hidden" };
|
|
2896
|
+
const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
2897
|
+
props: {
|
|
2898
|
+
columns: null,
|
|
2899
|
+
editMode: null,
|
|
2900
|
+
editEnabled: null,
|
|
2901
|
+
filterPanelOpen: { default: false }
|
|
2902
|
+
},
|
|
2903
|
+
emits: {
|
|
2904
|
+
"reset-filters": null,
|
|
2905
|
+
"update:columns": null,
|
|
2906
|
+
"update:edit-mode": null,
|
|
2907
|
+
"update:filter-panel-open": null
|
|
2908
|
+
},
|
|
2909
|
+
setup(__props, { emit }) {
|
|
2910
|
+
const props = __props;
|
|
2911
|
+
const { t } = useI18n();
|
|
2912
|
+
const currentColumns = computed({
|
|
2913
|
+
get: () => props.columns,
|
|
2914
|
+
set: (value) => emit("update:columns", value)
|
|
2915
|
+
});
|
|
2916
|
+
return (_ctx, _cache) => {
|
|
2917
|
+
return openBlock(), createElementBlock(Fragment, null, [
|
|
2918
|
+
__props.editEnabled ? (openBlock(), createElementBlock("span", _hoisted_1$7, [
|
|
2919
|
+
createVNode(_sfc_main$k, {
|
|
2920
|
+
class: "cl-w-full lg:cl-w-auto",
|
|
2921
|
+
size: "small",
|
|
2922
|
+
colour: "default",
|
|
2923
|
+
onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("update:edit-mode", !__props.editMode))
|
|
2924
|
+
}, {
|
|
2925
|
+
default: withCtx(() => [
|
|
2926
|
+
withDirectives(createElementVNode("span", null, toDisplayString(unref(t)("grid.editData")), 513), [
|
|
2927
|
+
[vShow, !__props.editMode]
|
|
2928
|
+
]),
|
|
2929
|
+
withDirectives(createElementVNode("span", null, toDisplayString(unref(t)("grid.finishEditing")), 513), [
|
|
2930
|
+
[vShow, __props.editMode]
|
|
2931
|
+
])
|
|
2932
|
+
]),
|
|
2933
|
+
_: 1
|
|
2934
|
+
})
|
|
2935
|
+
])) : createCommentVNode("", true),
|
|
2936
|
+
createElementVNode("span", _hoisted_2$7, [
|
|
2937
|
+
createVNode(_sfc_main$8, {
|
|
2938
|
+
columns: unref(currentColumns),
|
|
2939
|
+
"onUpdate:columns": _cache[1] || (_cache[1] = ($event) => isRef(currentColumns) ? currentColumns.value = $event : null)
|
|
2940
|
+
}, null, 8, ["columns"])
|
|
2941
|
+
]),
|
|
2942
|
+
createElementVNode("span", _hoisted_3$6, [
|
|
2943
|
+
createVNode(_sfc_main$k, {
|
|
2944
|
+
class: "cl-w-full lg:cl-w-auto",
|
|
2945
|
+
size: "small",
|
|
2946
|
+
onClick: _cache[2] || (_cache[2] = withModifiers(($event) => _ctx.$emit("reset-filters"), ["prevent"]))
|
|
2947
|
+
}, {
|
|
2948
|
+
default: withCtx(() => [
|
|
2949
|
+
createTextVNode(toDisplayString(unref(t)("grid.clearFilters")), 1)
|
|
2950
|
+
]),
|
|
2951
|
+
_: 1
|
|
2952
|
+
})
|
|
2953
|
+
]),
|
|
2954
|
+
createElementVNode("span", _hoisted_4$6, [
|
|
2955
|
+
createVNode(_sfc_main$k, {
|
|
2956
|
+
class: "w-full",
|
|
2957
|
+
colour: "blue",
|
|
2958
|
+
size: "small",
|
|
2959
|
+
onClick: _cache[3] || (_cache[3] = withModifiers(($event) => _ctx.$emit("update:filter-panel-open", true), ["prevent"]))
|
|
2960
|
+
}, {
|
|
2961
|
+
default: withCtx(() => [
|
|
2962
|
+
createTextVNode(toDisplayString(unref(t)("grid.modifyFilters")), 1)
|
|
2963
|
+
]),
|
|
2964
|
+
_: 1
|
|
2965
|
+
})
|
|
2966
|
+
])
|
|
2967
|
+
], 64);
|
|
2968
|
+
};
|
|
2969
|
+
}
|
|
2970
|
+
});
|
|
2971
|
+
var clUiGrid_vue_vue_type_style_index_0_scoped_true_lang = "";
|
|
2972
|
+
const _hoisted_1$6 = { class: "cl-hidden cl-mb-4 cl-w-full lg:cl-block lg:cl-text-right" };
|
|
2973
|
+
const _hoisted_2$6 = ["data-loading"];
|
|
2974
|
+
const _hoisted_3$5 = { class: "cl-absolute cl-bg-white cl-h-full cl-opacity-40 cl-w-full cl-z-20" };
|
|
2975
|
+
const _hoisted_4$5 = { class: "cl-bg-white cl-flex cl-flex-wrap cl-sticky cl-top-0 cl-w-full lg:cl-hidden" };
|
|
2976
|
+
const _hoisted_5$5 = { class: "cl-border-b cl-border-grey-2 cl-flex cl-flex-wrap cl-px-2 cl-py-4 cl-w-full" };
|
|
2977
|
+
const _hoisted_6$4 = { class: "cl-mb-4 cl-text-sm cl-w-full" };
|
|
2978
|
+
const _hoisted_7$3 = { class: "cl-flex cl-flex-wrap cl-w-full" };
|
|
2979
|
+
const _hoisted_8$1 = { class: "cl-absolute cl-bg-white cl-h-screen cl-overflow-x-auto cl-p-4 cl-text-sm cl-w-full cl-z-10" };
|
|
2980
|
+
const _hoisted_9$1 = { class: "cl-border-b cl-border-grey-3 cl-mb-2 cl-pb-2 cl-text-right cl-w-full" };
|
|
2981
|
+
const _hoisted_10$1 = { class: "grid grid-cols-3" };
|
|
2982
|
+
const _hoisted_11$1 = {
|
|
2983
|
+
key: 1,
|
|
2984
|
+
class: "cl-ml-2"
|
|
2985
|
+
};
|
|
2986
|
+
const _hoisted_12$1 = { class: "cl-overflow-auto cl-w-full" };
|
|
2987
|
+
const _hoisted_13$1 = { class: "cl-min-w-full cl-table-fixed" };
|
|
2988
|
+
const _hoisted_14$1 = { class: "cl-hidden lg:cl-table-column-group" };
|
|
2989
|
+
const _hoisted_15$1 = { class: "cl-hidden lg:cl-table-header-group" };
|
|
2990
|
+
const _hoisted_16 = ["onClick"];
|
|
2991
|
+
const _hoisted_17 = { key: 1 };
|
|
2992
|
+
const _hoisted_18 = { key: 0 };
|
|
2993
|
+
const _hoisted_19 = { key: 1 };
|
|
2994
|
+
const _hoisted_20 = ["colspan"];
|
|
2995
|
+
const _hoisted_21 = { class: "cl-my-10 cl-py-1 cl-text-center cl-text-sm cl-w-full" };
|
|
2996
|
+
const _hoisted_22 = {
|
|
2997
|
+
key: 0,
|
|
2998
|
+
class: "cl-w-full"
|
|
2999
|
+
};
|
|
3000
|
+
const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
3001
|
+
props: {
|
|
3002
|
+
columns: null,
|
|
3003
|
+
request: null,
|
|
3004
|
+
loading: null,
|
|
3005
|
+
data: { default: () => null }
|
|
3006
|
+
},
|
|
3007
|
+
emits: {
|
|
3008
|
+
"update:columns": null,
|
|
3009
|
+
"update:request": null,
|
|
3010
|
+
"data-request": null,
|
|
3011
|
+
"row-edit": null,
|
|
3012
|
+
"edit-start": null,
|
|
3013
|
+
"edit-end": null
|
|
3014
|
+
},
|
|
3015
|
+
setup(__props, { emit }) {
|
|
3016
|
+
const props = __props;
|
|
3017
|
+
const { t } = useI18n();
|
|
3018
|
+
const columnStyles = ref({});
|
|
3019
|
+
const editMode = ref(false);
|
|
3020
|
+
const editRow = ref({
|
|
3021
|
+
index: -1,
|
|
3022
|
+
record: {}
|
|
3023
|
+
});
|
|
3024
|
+
const filterPanelOpen = ref(false);
|
|
3025
|
+
const currentColumns = computed({
|
|
3026
|
+
get: () => props.columns,
|
|
3027
|
+
set: (value) => emit("update:columns", value)
|
|
3028
|
+
});
|
|
3029
|
+
const currentRequest = computed({
|
|
3030
|
+
get: () => props.request,
|
|
3031
|
+
set: (value) => emit("update:request", value)
|
|
3032
|
+
});
|
|
3033
|
+
const visibleColumns = computed(() => currentColumns.value.filter((e) => typeof e.visible === "undefined" || e.visible !== false));
|
|
3034
|
+
const editEnabled = computed(() => props.columns.find((c) => c.editable === true) !== void 0);
|
|
3035
|
+
function setColumnStyles() {
|
|
3036
|
+
const result = {};
|
|
3037
|
+
if (window.innerWidth >= 1024) {
|
|
3038
|
+
currentColumns.value.forEach((c) => {
|
|
3039
|
+
const value = c.width ? `${c.width}px` : "";
|
|
3040
|
+
result[`${c.name}`] = `width: ${value}; min-width: ${value};`;
|
|
3041
|
+
});
|
|
3042
|
+
}
|
|
3043
|
+
columnStyles.value = result;
|
|
3044
|
+
}
|
|
3045
|
+
function getStyleForColumn(name) {
|
|
3046
|
+
var _a;
|
|
3047
|
+
return (_a = columnStyles.value[name]) != null ? _a : "";
|
|
3048
|
+
}
|
|
3049
|
+
function setSort(field) {
|
|
3050
|
+
if (typeof field !== "undefined") {
|
|
3051
|
+
const filterRequest = copy(props.request);
|
|
3052
|
+
if (filterRequest.sort === null || filterRequest.sort.sortOnColumn !== field) {
|
|
3053
|
+
filterRequest.sort = {
|
|
3054
|
+
sortOnColumn: field,
|
|
3055
|
+
sortByAscending: true
|
|
3056
|
+
};
|
|
3057
|
+
} else if (filterRequest.sort.sortOnColumn === field && filterRequest.sort.sortByAscending === true) {
|
|
3058
|
+
filterRequest.sort.sortByAscending = false;
|
|
3059
|
+
} else {
|
|
3060
|
+
filterRequest.sort = null;
|
|
3061
|
+
}
|
|
3062
|
+
currentRequest.value = filterRequest;
|
|
3063
|
+
}
|
|
3064
|
+
}
|
|
3065
|
+
function resetFilters() {
|
|
3066
|
+
const request = copy(currentRequest.value);
|
|
3067
|
+
request.pageNumber = 1;
|
|
3068
|
+
request.filters = [];
|
|
3069
|
+
currentRequest.value = request;
|
|
3070
|
+
}
|
|
3071
|
+
function cellFocused(index) {
|
|
3072
|
+
if (editRow.value.index !== -1 && editRow.value.index !== index) {
|
|
3073
|
+
rowEdited();
|
|
3074
|
+
}
|
|
3075
|
+
editRow.value.index = index;
|
|
3076
|
+
}
|
|
3077
|
+
function cellChanged(value, field) {
|
|
3078
|
+
if (field !== void 0) {
|
|
3079
|
+
editRow.value.record[field] = value;
|
|
3080
|
+
}
|
|
3081
|
+
}
|
|
3082
|
+
function cellReverted(field) {
|
|
3083
|
+
if (field !== void 0) {
|
|
3084
|
+
const _a = editRow.value.record, { [field]: _ } = _a, remainder = __objRest(_a, [__restKey(field)]);
|
|
3085
|
+
editRow.value.record = __spreadValues({}, remainder);
|
|
3086
|
+
}
|
|
3087
|
+
}
|
|
3088
|
+
function rowEdited() {
|
|
3089
|
+
if (Object.keys(editRow.value.record).length !== 0) {
|
|
3090
|
+
emit("row-edit", copy(editRow.value));
|
|
3091
|
+
editRow.value.record = {};
|
|
3092
|
+
}
|
|
3093
|
+
}
|
|
3094
|
+
onMounted(() => {
|
|
3095
|
+
window.addEventListener("resize", setColumnStyles);
|
|
3096
|
+
setColumnStyles();
|
|
3097
|
+
});
|
|
3098
|
+
onUnmounted(() => window.removeEventListener("resize", setColumnStyles));
|
|
3099
|
+
watch(() => props.request, () => emit("data-request"), {
|
|
3100
|
+
deep: true,
|
|
3101
|
+
immediate: true
|
|
3102
|
+
});
|
|
3103
|
+
watch(() => editMode.value, () => {
|
|
3104
|
+
if (editMode.value) {
|
|
3105
|
+
emit("edit-start");
|
|
3106
|
+
} else {
|
|
3107
|
+
rowEdited();
|
|
3108
|
+
emit("edit-end");
|
|
3109
|
+
editRow.value.index = -1;
|
|
3110
|
+
}
|
|
3111
|
+
});
|
|
3112
|
+
return (_ctx, _cache) => {
|
|
3113
|
+
var _a, _b;
|
|
3114
|
+
const _component_icon = resolveComponent("icon");
|
|
3115
|
+
return openBlock(), createElementBlock(Fragment, null, [
|
|
3116
|
+
createElementVNode("div", _hoisted_1$6, [
|
|
3117
|
+
createVNode(_sfc_main$7, {
|
|
3118
|
+
columns: unref(currentColumns),
|
|
3119
|
+
"onUpdate:columns": _cache[0] || (_cache[0] = ($event) => isRef(currentColumns) ? currentColumns.value = $event : null),
|
|
3120
|
+
"edit-mode": editMode.value,
|
|
3121
|
+
"onUpdate:edit-mode": _cache[1] || (_cache[1] = ($event) => editMode.value = $event),
|
|
3122
|
+
"edit-enabled": unref(editEnabled),
|
|
3123
|
+
onResetFilters: resetFilters
|
|
3124
|
+
}, null, 8, ["columns", "edit-mode", "edit-enabled"])
|
|
3125
|
+
]),
|
|
3126
|
+
createElementVNode("div", {
|
|
3127
|
+
class: "cl-relative cl-w-full grid-wrapper",
|
|
3128
|
+
"data-loading": __props.loading
|
|
3129
|
+
}, [
|
|
3130
|
+
withDirectives(createElementVNode("div", _hoisted_3$5, null, 512), [
|
|
3131
|
+
[vShow, __props.loading]
|
|
3132
|
+
]),
|
|
3133
|
+
createElementVNode("div", _hoisted_4$5, [
|
|
3134
|
+
createElementVNode("div", _hoisted_5$5, [
|
|
3135
|
+
createElementVNode("strong", _hoisted_6$4, toDisplayString(unref(t)("grid.gridTools")), 1),
|
|
3136
|
+
createElementVNode("div", _hoisted_7$3, [
|
|
3137
|
+
createVNode(_sfc_main$7, {
|
|
3138
|
+
columns: unref(currentColumns),
|
|
3139
|
+
"onUpdate:columns": _cache[2] || (_cache[2] = ($event) => isRef(currentColumns) ? currentColumns.value = $event : null),
|
|
3140
|
+
"edit-mode": editMode.value,
|
|
3141
|
+
"onUpdate:edit-mode": _cache[3] || (_cache[3] = ($event) => editMode.value = $event),
|
|
3142
|
+
"filter-panel-open": filterPanelOpen.value,
|
|
3143
|
+
"onUpdate:filter-panel-open": _cache[4] || (_cache[4] = ($event) => filterPanelOpen.value = $event),
|
|
3144
|
+
"edit-enabled": unref(editEnabled),
|
|
3145
|
+
onResetFilters: resetFilters
|
|
3146
|
+
}, null, 8, ["columns", "edit-mode", "filter-panel-open", "edit-enabled"])
|
|
3147
|
+
])
|
|
3148
|
+
]),
|
|
3149
|
+
withDirectives(createElementVNode("div", _hoisted_8$1, [
|
|
3150
|
+
createElementVNode("div", _hoisted_9$1, [
|
|
3151
|
+
createVNode(_sfc_main$k, {
|
|
3152
|
+
colour: "blue",
|
|
3153
|
+
size: "small",
|
|
3154
|
+
onClick: _cache[5] || (_cache[5] = withModifiers(($event) => {
|
|
3155
|
+
filterPanelOpen.value = false;
|
|
3156
|
+
}, ["prevent"]))
|
|
3157
|
+
}, {
|
|
3158
|
+
default: withCtx(() => [
|
|
3159
|
+
createVNode(_component_icon, {
|
|
3160
|
+
class: "cl--mt-1 cl-inline-block",
|
|
3161
|
+
icon: "ph:x",
|
|
3162
|
+
size: 16
|
|
3163
|
+
}),
|
|
3164
|
+
createTextVNode(" " + toDisplayString(unref(t)("grid.confirmFilters")), 1)
|
|
3165
|
+
]),
|
|
3166
|
+
_: 1
|
|
3167
|
+
})
|
|
3168
|
+
]),
|
|
3169
|
+
createElementVNode("div", _hoisted_10$1, [
|
|
3170
|
+
createElementVNode("div", null, toDisplayString(unref(t)("grid.field")), 1),
|
|
3171
|
+
createElementVNode("div", null, toDisplayString(unref(t)("grid.filter")), 1),
|
|
3172
|
+
createElementVNode("div", null, toDisplayString(unref(t)("grid.sortBy")), 1)
|
|
3173
|
+
]),
|
|
3174
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(visibleColumns), (column, index) => {
|
|
3175
|
+
return openBlock(), createElementBlock("div", {
|
|
3176
|
+
key: index,
|
|
3177
|
+
class: "cl-mb-4 cl-w-full grid grid-cols-3"
|
|
3178
|
+
}, [
|
|
3179
|
+
createElementVNode("div", null, toDisplayString(column.caption), 1),
|
|
3180
|
+
createVNode(_sfc_main$a, {
|
|
3181
|
+
request: unref(currentRequest),
|
|
3182
|
+
"onUpdate:request": _cache[6] || (_cache[6] = ($event) => isRef(currentRequest) ? currentRequest.value = $event : null),
|
|
3183
|
+
column
|
|
3184
|
+
}, null, 8, ["request", "column"]),
|
|
3185
|
+
(column.type !== "slot" || column.slotType !== void 0 && column.field !== void 0) && (column.sortable === void 0 || column.sortable === true) ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
3186
|
+
unref(currentRequest).sort === null || unref(currentRequest).sort.sortOnColumn !== column.field ? (openBlock(), createBlock(_component_icon, {
|
|
3187
|
+
key: 0,
|
|
3188
|
+
class: "cl-cursor-pointer cl-ml-2",
|
|
3189
|
+
icon: "ph:minus",
|
|
3190
|
+
onClick: ($event) => setSort(column.field)
|
|
3191
|
+
}, null, 8, ["onClick"])) : unref(currentRequest).sort.sortByAscending === false ? (openBlock(), createBlock(_component_icon, {
|
|
3192
|
+
key: 1,
|
|
3193
|
+
class: "cl-cursor-pointer cl-ml-2",
|
|
3194
|
+
icon: "ph:caret-down",
|
|
3195
|
+
onClick: ($event) => setSort(column.field)
|
|
3196
|
+
}, null, 8, ["onClick"])) : (openBlock(), createBlock(_component_icon, {
|
|
3197
|
+
key: 2,
|
|
3198
|
+
class: "cl-cursor-pointer cl-ml-2",
|
|
3199
|
+
icon: "ph:caret-up",
|
|
3200
|
+
onClick: ($event) => setSort(column.field)
|
|
3201
|
+
}, null, 8, ["onClick"]))
|
|
3202
|
+
], 64)) : (openBlock(), createElementBlock("div", _hoisted_11$1, " \xA0 "))
|
|
3203
|
+
]);
|
|
3204
|
+
}), 128))
|
|
3205
|
+
], 512), [
|
|
3206
|
+
[vShow, filterPanelOpen.value]
|
|
3207
|
+
])
|
|
3208
|
+
]),
|
|
3209
|
+
createElementVNode("div", _hoisted_12$1, [
|
|
3210
|
+
createElementVNode("table", _hoisted_13$1, [
|
|
3211
|
+
createElementVNode("colgroup", _hoisted_14$1, [
|
|
3212
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(visibleColumns), (column, index) => {
|
|
3213
|
+
return openBlock(), createElementBlock("col", {
|
|
3214
|
+
key: index,
|
|
3215
|
+
style: normalizeStyle(getStyleForColumn(column.name)),
|
|
3216
|
+
span: 1
|
|
3217
|
+
}, null, 4);
|
|
3218
|
+
}), 128))
|
|
3219
|
+
]),
|
|
3220
|
+
createElementVNode("thead", _hoisted_15$1, [
|
|
3221
|
+
createElementVNode("tr", null, [
|
|
3222
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(visibleColumns), (column, index) => {
|
|
3223
|
+
var _a2;
|
|
3224
|
+
return openBlock(), createElementBlock("th", {
|
|
3225
|
+
key: index,
|
|
3226
|
+
class: "cl-border-b cl-border-grey-2 cl-font-semibold cl-p-1 cl-text-grey-3 cl-text-left cl-text-sm cl-uppercase",
|
|
3227
|
+
style: normalizeStyle(getStyleForColumn(column.name))
|
|
3228
|
+
}, [
|
|
3229
|
+
__props.data && ((_a2 = __props.data.results) == null ? void 0 : _a2.length) && (column.type !== "slot" || column.slotType !== void 0 && column.field !== void 0) && (column.sortable === void 0 || column.sortable === true) ? (openBlock(), createElementBlock("span", {
|
|
3230
|
+
key: 0,
|
|
3231
|
+
class: "cl-cursor-pointer",
|
|
3232
|
+
onClick: ($event) => setSort(column.field)
|
|
3233
|
+
}, [
|
|
3234
|
+
createTextVNode(toDisplayString(column.caption) + " ", 1),
|
|
3235
|
+
withDirectives(createVNode(_component_icon, {
|
|
3236
|
+
class: "cl--mt-1 cl-inline-block",
|
|
3237
|
+
icon: "ph:caret-up"
|
|
3238
|
+
}, null, 512), [
|
|
3239
|
+
[vShow, unref(currentRequest).sort !== null && unref(currentRequest).sort.sortOnColumn === column.field && unref(currentRequest).sort.sortByAscending === true]
|
|
3240
|
+
]),
|
|
3241
|
+
withDirectives(createVNode(_component_icon, {
|
|
3242
|
+
class: "cl--mt-1 cl-inline-block",
|
|
3243
|
+
icon: "ph:caret-down"
|
|
3244
|
+
}, null, 512), [
|
|
3245
|
+
[vShow, unref(currentRequest).sort !== null && unref(currentRequest).sort.sortOnColumn === column.field && unref(currentRequest).sort.sortByAscending === false]
|
|
3246
|
+
])
|
|
3247
|
+
], 8, _hoisted_16)) : (openBlock(), createElementBlock("span", _hoisted_17, toDisplayString(column.caption), 1))
|
|
3248
|
+
], 4);
|
|
3249
|
+
}), 128))
|
|
3250
|
+
]),
|
|
3251
|
+
__props.data && ((_a = __props.data.results) == null ? void 0 : _a.length) || unref(currentRequest).filters.length > 0 ? (openBlock(), createElementBlock("tr", _hoisted_18, [
|
|
3252
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(visibleColumns), (column, index) => {
|
|
3253
|
+
return openBlock(), createElementBlock("th", {
|
|
3254
|
+
key: index,
|
|
3255
|
+
class: "cl-p-1",
|
|
3256
|
+
style: normalizeStyle(getStyleForColumn(column.name))
|
|
3257
|
+
}, [
|
|
3258
|
+
createVNode(_sfc_main$a, {
|
|
3259
|
+
request: unref(currentRequest),
|
|
3260
|
+
"onUpdate:request": _cache[7] || (_cache[7] = ($event) => isRef(currentRequest) ? currentRequest.value = $event : null),
|
|
3261
|
+
column,
|
|
3262
|
+
"first-half": index <= unref(visibleColumns).length / 2
|
|
3263
|
+
}, null, 8, ["request", "column", "first-half"])
|
|
3264
|
+
], 4);
|
|
3265
|
+
}), 128))
|
|
3266
|
+
])) : createCommentVNode("", true)
|
|
3267
|
+
]),
|
|
3268
|
+
createElementVNode("tbody", null, [
|
|
3269
|
+
__props.data && ((_b = __props.data.results) == null ? void 0 : _b.length) ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(__props.data.results, (record, recordIndex) => {
|
|
3270
|
+
return openBlock(), createElementBlock("tr", {
|
|
3271
|
+
key: recordIndex,
|
|
3272
|
+
class: normalizeClass({
|
|
3273
|
+
"cl-bg-white": recordIndex % 2 !== 1,
|
|
3274
|
+
"cl-bg-off-white": recordIndex % 2 === 1
|
|
3275
|
+
})
|
|
3276
|
+
}, [
|
|
3277
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(visibleColumns), (column, columnIndex) => {
|
|
3278
|
+
return openBlock(), createBlock(_sfc_main$b, {
|
|
3279
|
+
key: columnIndex,
|
|
3280
|
+
class: "cl-align-top cl-p-2 cl-rounded cl-whitespace-nowrap",
|
|
3281
|
+
style: normalizeStyle(getStyleForColumn(column.name)),
|
|
3282
|
+
column,
|
|
3283
|
+
record,
|
|
3284
|
+
"edit-mode": editMode.value,
|
|
3285
|
+
onFocus: ($event) => cellFocused(recordIndex),
|
|
3286
|
+
onEdit: ($event) => {
|
|
3287
|
+
cellFocused(recordIndex);
|
|
3288
|
+
cellChanged($event, column.field);
|
|
3289
|
+
},
|
|
3290
|
+
onUndoEdit: ($event) => cellReverted(column.field)
|
|
3291
|
+
}, createSlots({ _: 2 }, [
|
|
3292
|
+
renderList(_ctx.$slots, (_, name) => {
|
|
3293
|
+
return {
|
|
3294
|
+
name,
|
|
3295
|
+
fn: withCtx((cellData) => [
|
|
3296
|
+
renderSlot(_ctx.$slots, name, normalizeProps(guardReactiveProps(cellData)), void 0, true)
|
|
3297
|
+
])
|
|
3298
|
+
};
|
|
3299
|
+
})
|
|
3300
|
+
]), 1032, ["style", "column", "record", "edit-mode", "onFocus", "onEdit", "onUndoEdit"]);
|
|
3301
|
+
}), 128))
|
|
3302
|
+
], 2);
|
|
3303
|
+
}), 128)) : (openBlock(), createElementBlock("tr", _hoisted_19, [
|
|
3304
|
+
createElementVNode("td", {
|
|
3305
|
+
colspan: unref(visibleColumns).length
|
|
3306
|
+
}, [
|
|
3307
|
+
createElementVNode("div", _hoisted_21, [
|
|
3308
|
+
createElementVNode("strong", null, toDisplayString(unref(t)("grid.noData")), 1),
|
|
3309
|
+
unref(currentRequest).filters.length > 0 ? (openBlock(), createElementBlock("div", _hoisted_22, [
|
|
3310
|
+
createTextVNode(toDisplayString(unref(t)("grid.noDataFiltersPresent")) + " ", 1),
|
|
3311
|
+
createVNode(_sfc_main$k, {
|
|
3312
|
+
size: "small",
|
|
3313
|
+
onClick: withModifiers(resetFilters, ["prevent"])
|
|
3314
|
+
}, {
|
|
3315
|
+
default: withCtx(() => [
|
|
3316
|
+
createTextVNode(toDisplayString(unref(t)("grid.clearFilters")), 1)
|
|
3317
|
+
]),
|
|
3318
|
+
_: 1
|
|
3319
|
+
}, 8, ["onClick"])
|
|
3320
|
+
])) : createCommentVNode("", true)
|
|
3321
|
+
])
|
|
3322
|
+
], 8, _hoisted_20)
|
|
3323
|
+
]))
|
|
3324
|
+
])
|
|
3325
|
+
])
|
|
3326
|
+
]),
|
|
3327
|
+
createVNode(_sfc_main$9, {
|
|
3328
|
+
request: unref(currentRequest),
|
|
3329
|
+
"onUpdate:request": _cache[8] || (_cache[8] = ($event) => isRef(currentRequest) ? currentRequest.value = $event : null),
|
|
3330
|
+
data: __props.data
|
|
3331
|
+
}, null, 8, ["request", "data"])
|
|
3332
|
+
], 8, _hoisted_2$6)
|
|
3333
|
+
], 64);
|
|
3334
|
+
};
|
|
3335
|
+
}
|
|
3336
|
+
});
|
|
3337
|
+
var clUiGrid = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__scopeId", "data-v-87374b4c"]]);
|
|
3338
|
+
const _sfc_main$5 = {};
|
|
3339
|
+
const _hoisted_1$5 = { class: "cl-absolute cl-bg-secondary-default cl-flex cl-h-20 cl-items-center cl-justify-between cl-left-0 cl-top-0 cl-w-full cl-z-40" };
|
|
3340
|
+
const _hoisted_2$5 = { class: "cl-flex cl-flex-nowrap" };
|
|
3341
|
+
function _sfc_render(_ctx, _cache) {
|
|
3342
|
+
return openBlock(), createElementBlock("header", _hoisted_1$5, [
|
|
3343
|
+
renderSlot(_ctx.$slots, "logo"),
|
|
3344
|
+
createElementVNode("div", _hoisted_2$5, [
|
|
3345
|
+
renderSlot(_ctx.$slots, "menu"),
|
|
3346
|
+
renderSlot(_ctx.$slots, "icon")
|
|
3347
|
+
])
|
|
3348
|
+
]);
|
|
3349
|
+
}
|
|
3350
|
+
var clUiHeader = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["render", _sfc_render]]);
|
|
3351
|
+
const _hoisted_1$4 = { class: "md:cl-relative" };
|
|
3352
|
+
const _hoisted_2$4 = { class: "cl-bg-blue-light cl-flex cl-items-center cl-select-none md:cl-min-w-[320px]" };
|
|
3353
|
+
const _hoisted_3$4 = ["src"];
|
|
3354
|
+
const _hoisted_4$4 = { class: "cl-cursor-default cl-flex-grow cl-hidden cl-my-4 cl-text-white md:cl-block" };
|
|
3355
|
+
const _hoisted_5$4 = {
|
|
3356
|
+
key: 0,
|
|
3357
|
+
class: "cl-cursor-default cl-overflow-ellipsis cl-whitespace-nowrap"
|
|
3358
|
+
};
|
|
3359
|
+
const _hoisted_6$3 = {
|
|
3360
|
+
key: 1,
|
|
3361
|
+
class: "cl-cursor-default cl-overflow-ellipsis cl-text-xs cl-whitespace-nowrap"
|
|
3362
|
+
};
|
|
3363
|
+
const _hoisted_7$2 = {
|
|
3364
|
+
key: 0,
|
|
3365
|
+
class: "cl-absolute cl-g-white cl-right-0 cl-shadow-2xl cl-top-20 cl-w-full cl-z-20"
|
|
3366
|
+
};
|
|
3367
|
+
const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
3368
|
+
props: {
|
|
3369
|
+
user: { default: () => null }
|
|
3370
|
+
},
|
|
3371
|
+
setup(__props) {
|
|
3372
|
+
const isOpen = ref(false);
|
|
3373
|
+
return (_ctx, _cache) => {
|
|
3374
|
+
const _component_icon = resolveComponent("icon");
|
|
3375
|
+
return openBlock(), createElementBlock("div", _hoisted_1$4, [
|
|
3376
|
+
createElementVNode("div", _hoisted_2$4, [
|
|
3377
|
+
__props.user ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
3378
|
+
__props.user.image ? (openBlock(), createElementBlock("img", {
|
|
3379
|
+
key: 0,
|
|
3380
|
+
src: __props.user.image,
|
|
3381
|
+
class: "cl-hidden cl-m-4 cl-max-h-12 cl-max-w-12 cl-ring-2 cl-ring-white cl-rounded-full md:cl-block"
|
|
3382
|
+
}, null, 8, _hoisted_3$4)) : (openBlock(), createBlock(_component_icon, {
|
|
3383
|
+
key: 1,
|
|
3384
|
+
class: "cl-hidden cl-m-4 cl-text-white md:cl-block",
|
|
3385
|
+
icon: "ph:user-circle",
|
|
3386
|
+
width: "48",
|
|
3387
|
+
height: "48"
|
|
3388
|
+
})),
|
|
3389
|
+
createElementVNode("div", _hoisted_4$4, [
|
|
3390
|
+
__props.user.username ? (openBlock(), createElementBlock("div", _hoisted_5$4, toDisplayString(__props.user.username), 1)) : createCommentVNode("", true),
|
|
3391
|
+
__props.user.group && __props.user.group ? (openBlock(), createElementBlock("div", _hoisted_6$3, toDisplayString(__props.user.group), 1)) : createCommentVNode("", true)
|
|
3392
|
+
]),
|
|
3393
|
+
createElementVNode("div", {
|
|
3394
|
+
class: "cl-bg-transparent cl-content-center cl-cursor-pointer cl-flex cl-h-20 cl-items-center cl-justify-center cl-justify-items-center cl-transition-colors cl-w-10 hover:cl-bg-opacity-10 hover:cl-bg-white md:cl-ml-4 md:cl-w-20",
|
|
3395
|
+
onClick: _cache[0] || (_cache[0] = ($event) => isOpen.value = !isOpen.value)
|
|
3396
|
+
}, [
|
|
3397
|
+
createVNode(_component_icon, {
|
|
3398
|
+
class: normalizeClass(["cl-text-white cl-transform cl-transition-transform", {
|
|
3399
|
+
"cl-rotate-180": isOpen.value
|
|
3400
|
+
}]),
|
|
3401
|
+
icon: "ph:caret-down"
|
|
3402
|
+
}, null, 8, ["class"])
|
|
3403
|
+
])
|
|
3404
|
+
], 64)) : createCommentVNode("", true)
|
|
3405
|
+
]),
|
|
3406
|
+
isOpen.value ? (openBlock(), createElementBlock("div", _hoisted_7$2, [
|
|
3407
|
+
renderSlot(_ctx.$slots, "default")
|
|
3408
|
+
])) : createCommentVNode("", true)
|
|
3409
|
+
]);
|
|
3410
|
+
};
|
|
3411
|
+
}
|
|
3412
|
+
});
|
|
3413
|
+
function isLanguageLocaleFormat(language) {
|
|
3414
|
+
const localeCodeFormatCorrect = /[a-z]{2}-[A-Z]{2}/gm.test(language.localeCode);
|
|
3415
|
+
return localeCodeFormatCorrect;
|
|
3416
|
+
}
|
|
3417
|
+
function isLanguageArray(arrayToTest) {
|
|
3418
|
+
let result = Array.isArray(arrayToTest);
|
|
3419
|
+
if (result) {
|
|
3420
|
+
for (const objectToTest of arrayToTest) {
|
|
3421
|
+
if (!isLanguage(objectToTest)) {
|
|
3422
|
+
result = false;
|
|
3423
|
+
break;
|
|
3424
|
+
}
|
|
3425
|
+
}
|
|
3426
|
+
}
|
|
3427
|
+
return result;
|
|
3428
|
+
}
|
|
3429
|
+
function isLanguage(objectToTest) {
|
|
3430
|
+
return typeof objectToTest.name === "string" && typeof objectToTest.nativeName === "string" && typeof objectToTest.localeCode === "string" && typeof objectToTest.icon === "string";
|
|
3431
|
+
}
|
|
3432
|
+
const _hoisted_1$3 = {
|
|
3433
|
+
key: 0,
|
|
3434
|
+
class: "cl-flex cl-relative cl-select-none cl-w-auto cl-z-30"
|
|
3435
|
+
};
|
|
3436
|
+
const _hoisted_2$3 = { class: "cl-font-semibold cl-hidden cl-mr-4 cl-text-xs lg:cl-inline-block" };
|
|
3437
|
+
const _hoisted_3$3 = { class: "cl-absolute cl-bg-white cl-border cl-border-grey-0 cl-overflow-hidden cl-right-0 cl-rounded cl-shadow-xl cl-text-black cl-top-6 cl-z-30" };
|
|
3438
|
+
const _hoisted_4$3 = ["data-localename", "data-localecode", "onClick"];
|
|
3439
|
+
const _hoisted_5$3 = { class: "cl-hidden cl-ml-2 cl-text-xs lg:cl-inline-flex" };
|
|
3440
|
+
const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
3441
|
+
props: {
|
|
3442
|
+
supportedLanguages: null,
|
|
3443
|
+
disabled: { default: false }
|
|
3444
|
+
},
|
|
3445
|
+
setup(__props) {
|
|
3446
|
+
const props = __props;
|
|
3447
|
+
const { locale } = useI18n();
|
|
3448
|
+
const localeToggleOpen = ref(false);
|
|
3449
|
+
const selectedLanguage = computed(() => {
|
|
3450
|
+
var _a;
|
|
3451
|
+
return (_a = props.supportedLanguages.find((l) => l.localeCode === locale.value)) != null ? _a : null;
|
|
3452
|
+
});
|
|
3453
|
+
const validLanguages = computed(() => props.supportedLanguages.filter((e) => isLanguageLocaleFormat(e)).sort((a, b) => a.nativeName > b.nativeName ? 1 : b.nativeName > a.nativeName ? -1 : 0));
|
|
3454
|
+
function toggleLocaleSwitcher() {
|
|
3455
|
+
if (!props.disabled) {
|
|
3456
|
+
localeToggleOpen.value = !localeToggleOpen.value;
|
|
3457
|
+
}
|
|
3458
|
+
}
|
|
3459
|
+
watch(() => props.disabled, (newValue) => {
|
|
3460
|
+
if (newValue) {
|
|
3461
|
+
localeToggleOpen.value = false;
|
|
3462
|
+
}
|
|
3463
|
+
});
|
|
3464
|
+
return (_ctx, _cache) => {
|
|
3465
|
+
const _component_icon = resolveComponent("icon");
|
|
3466
|
+
return unref(selectedLanguage) !== null && unref(isLanguageLocaleFormat)(unref(selectedLanguage)) ? (openBlock(), createElementBlock("div", _hoisted_1$3, [
|
|
3467
|
+
createElementVNode("div", {
|
|
3468
|
+
class: normalizeClass(["cl-flex cl-items-center", {
|
|
3469
|
+
"cl-cursor-pointer": !__props.disabled
|
|
3470
|
+
}]),
|
|
3471
|
+
onClick: toggleLocaleSwitcher
|
|
3472
|
+
}, [
|
|
3473
|
+
createVNode(_component_icon, {
|
|
3474
|
+
class: "cl-inline-block cl-mr-3",
|
|
3475
|
+
icon: unref(selectedLanguage).icon
|
|
3476
|
+
}, null, 8, ["icon"]),
|
|
3477
|
+
createElementVNode("span", _hoisted_2$3, toDisplayString(unref(selectedLanguage).nativeName), 1)
|
|
3478
|
+
], 2),
|
|
3479
|
+
withDirectives(createElementVNode("div", _hoisted_3$3, [
|
|
3480
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(validLanguages), (language, index) => {
|
|
3481
|
+
return openBlock(), createElementBlock("div", {
|
|
3482
|
+
key: index,
|
|
3483
|
+
class: "cl-border-b cl-border-grey-0 cl-content-center cl-cursor-pointer cl-flex cl-items-center cl-p-2 cl-text-center cl-transition-colors hover:cl-bg-grey-0 last-child:cl-border-b-0 last:cl-border-b-0",
|
|
3484
|
+
"data-localename": language.name,
|
|
3485
|
+
"data-localecode": language.localeCode,
|
|
3486
|
+
onClick: ($event) => {
|
|
3487
|
+
locale.value = language.localeCode;
|
|
3488
|
+
toggleLocaleSwitcher();
|
|
3489
|
+
}
|
|
3490
|
+
}, [
|
|
3491
|
+
createVNode(_component_icon, {
|
|
3492
|
+
class: "cl-inline-block cl-mr-3",
|
|
3493
|
+
icon: language.icon
|
|
3494
|
+
}, null, 8, ["icon"]),
|
|
3495
|
+
createElementVNode("span", _hoisted_5$3, toDisplayString(language.nativeName), 1)
|
|
3496
|
+
], 8, _hoisted_4$3);
|
|
3497
|
+
}), 128))
|
|
3498
|
+
], 512), [
|
|
3499
|
+
[vShow, localeToggleOpen.value]
|
|
3500
|
+
])
|
|
3501
|
+
])) : createCommentVNode("", true);
|
|
3502
|
+
};
|
|
3503
|
+
}
|
|
3504
|
+
});
|
|
3505
|
+
var clUiLogin_vue_vue_type_style_index_0_scoped_true_lang = "";
|
|
3506
|
+
const _hoisted_1$2 = { class: "cl-bg-secondary-default cl-flex cl-flex-wrap cl-opacity-95 cl-p-10 cl-pb-12 cl-w-full" };
|
|
3507
|
+
const _hoisted_2$2 = { class: "cl-pb-8 cl-w-full md:cl-flex-1 md:cl-pb-0" };
|
|
3508
|
+
const _hoisted_3$2 = { class: "cl-mt-2 cl-pb-2 cl-text-white cl-w-auto md:cl-pb-0 md:cl-pr-2" };
|
|
3509
|
+
const _hoisted_4$2 = { class: "cl-pb-2 cl-w-full md:cl-pb-0 md:cl-pr-2 md:cl-w-1/4" };
|
|
3510
|
+
const _hoisted_5$2 = { class: "cl-inline cl-relative cl-text-grey-4 cl-w-full" };
|
|
3511
|
+
const _hoisted_6$2 = ["data-valid", "placeholder"];
|
|
3512
|
+
const _hoisted_7$1 = { class: "cl-text-grey-3 cl-text-sm" };
|
|
3513
|
+
const _hoisted_8 = { class: "cl-flex cl-mt-2" };
|
|
3514
|
+
const _hoisted_9 = { class: "cl-align-middle cl-inline-block cl-ml-2" };
|
|
3515
|
+
const _hoisted_10 = { class: "cl-flex cl-mt-2" };
|
|
3516
|
+
const _hoisted_11 = { class: "cl-align-middle cl-inline-block cl-ml-2" };
|
|
3517
|
+
const _hoisted_12 = { class: "cl-pb-2 cl-w-full md:cl-pb-0 md:cl-pl-1 md:cl-pr-2 md:cl-w-1/4" };
|
|
3518
|
+
const _hoisted_13 = { class: "cl-inline cl-relative cl-text-grey-4 cl-w-full" };
|
|
3519
|
+
const _hoisted_14 = ["type", "data-valid", "placeholder"];
|
|
3520
|
+
const _hoisted_15 = { class: "cl-emphasis-danger cl-mt-4 cl-p-4 cl-text-sm cl-w-full" };
|
|
3521
|
+
const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
3522
|
+
props: {
|
|
3523
|
+
errors: { default: () => [] },
|
|
3524
|
+
backgroundImage: null,
|
|
3525
|
+
loading: { default: false }
|
|
3526
|
+
},
|
|
3527
|
+
emits: {
|
|
3528
|
+
login: null,
|
|
3529
|
+
"update:errors": null
|
|
3530
|
+
},
|
|
3531
|
+
setup(__props, { emit }) {
|
|
3532
|
+
const { t } = useI18n();
|
|
3533
|
+
const username = ref("");
|
|
3534
|
+
const password = ref("");
|
|
3535
|
+
const passwordFieldType = ref("password");
|
|
3536
|
+
const usernameValid = computed(() => /[a-zA-Z0-9.!#$%&’*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)/gi.test(username.value));
|
|
3537
|
+
function login() {
|
|
3538
|
+
const authentication = {
|
|
3539
|
+
username: username.value,
|
|
3540
|
+
password: password.value
|
|
3541
|
+
};
|
|
3542
|
+
emit("login", authentication);
|
|
3543
|
+
}
|
|
3544
|
+
function clearErrors() {
|
|
3545
|
+
emit("update:errors", []);
|
|
3546
|
+
}
|
|
3547
|
+
return (_ctx, _cache) => {
|
|
3548
|
+
var _a;
|
|
3549
|
+
const _component_icon = resolveComponent("icon");
|
|
3550
|
+
return openBlock(), createElementBlock("div", {
|
|
3551
|
+
class: "cl-bg-center cl-bg-cover cl-h-screen md:cl-bg-left-bottom",
|
|
3552
|
+
style: normalizeStyle({
|
|
3553
|
+
"background-image": `url('${__props.backgroundImage}')`
|
|
3554
|
+
})
|
|
3555
|
+
}, [
|
|
3556
|
+
createElementVNode("form", _hoisted_1$2, [
|
|
3557
|
+
createElementVNode("div", _hoisted_2$2, [
|
|
3558
|
+
renderSlot(_ctx.$slots, "logo", {}, void 0, true)
|
|
3559
|
+
]),
|
|
3560
|
+
createElementVNode("div", _hoisted_3$2, [
|
|
3561
|
+
renderSlot(_ctx.$slots, "language-switcher", {}, void 0, true)
|
|
3562
|
+
]),
|
|
3563
|
+
createElementVNode("div", _hoisted_4$2, [
|
|
3564
|
+
createElementVNode("div", _hoisted_5$2, [
|
|
3565
|
+
createVNode(_component_icon, {
|
|
3566
|
+
class: "cl-absolute cl-left-3 cl-top-2",
|
|
3567
|
+
icon: "ph:user",
|
|
3568
|
+
size: 18
|
|
3569
|
+
}),
|
|
3570
|
+
withDirectives(createElementVNode("input", {
|
|
3571
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => username.value = $event),
|
|
3572
|
+
class: "!cl-pb-1 !cl-pl-9 cl-w-full",
|
|
3573
|
+
type: "email",
|
|
3574
|
+
"data-valid": unref(usernameValid),
|
|
3575
|
+
placeholder: unref(t)("login.email"),
|
|
3576
|
+
autocomplete: "username",
|
|
3577
|
+
onInput: clearErrors
|
|
3578
|
+
}, null, 40, _hoisted_6$2), [
|
|
3579
|
+
[
|
|
3580
|
+
vModelText,
|
|
3581
|
+
username.value,
|
|
3582
|
+
void 0,
|
|
3583
|
+
{ trim: true }
|
|
3584
|
+
]
|
|
3585
|
+
])
|
|
3586
|
+
]),
|
|
3587
|
+
withDirectives(createElementVNode("div", _hoisted_7$1, [
|
|
3588
|
+
withDirectives(createElementVNode("div", _hoisted_8, [
|
|
3589
|
+
createVNode(_component_icon, {
|
|
3590
|
+
class: "cl-mt-1 cl-text-primary-default",
|
|
3591
|
+
icon: "ph:check",
|
|
3592
|
+
size: 16
|
|
3593
|
+
}),
|
|
3594
|
+
createElementVNode("em", _hoisted_9, toDisplayString(unref(t)("login.validEmail")), 1)
|
|
3595
|
+
], 512), [
|
|
3596
|
+
[vShow, unref(usernameValid)]
|
|
3597
|
+
]),
|
|
3598
|
+
withDirectives(createElementVNode("div", _hoisted_10, [
|
|
3599
|
+
createVNode(_component_icon, {
|
|
3600
|
+
class: "cl-mt-1 cl-text-danger-default",
|
|
3601
|
+
icon: "ph:x",
|
|
3602
|
+
size: 16
|
|
3603
|
+
}),
|
|
3604
|
+
createElementVNode("em", _hoisted_11, toDisplayString(unref(t)("login.invalidEmail")), 1)
|
|
3605
|
+
], 512), [
|
|
3606
|
+
[vShow, !unref(usernameValid)]
|
|
3607
|
+
])
|
|
3608
|
+
], 512), [
|
|
3609
|
+
[vShow, username.value !== ""]
|
|
3610
|
+
])
|
|
3611
|
+
]),
|
|
3612
|
+
createElementVNode("div", _hoisted_12, [
|
|
3613
|
+
createElementVNode("div", _hoisted_13, [
|
|
3614
|
+
createVNode(_component_icon, {
|
|
3615
|
+
class: "cl-absolute cl-left-3 cl-top-2",
|
|
3616
|
+
icon: "ph:lock",
|
|
3617
|
+
size: 18
|
|
3618
|
+
}),
|
|
3619
|
+
withDirectives(createVNode(_component_icon, {
|
|
3620
|
+
class: "cl-absolute cl-cursor-pointer cl-right-3 cl-top-2",
|
|
3621
|
+
icon: "ph:eye",
|
|
3622
|
+
size: 18,
|
|
3623
|
+
onClick: _cache[1] || (_cache[1] = ($event) => passwordFieldType.value = "text")
|
|
3624
|
+
}, null, 512), [
|
|
3625
|
+
[vShow, passwordFieldType.value === "password"]
|
|
3626
|
+
]),
|
|
3627
|
+
withDirectives(createVNode(_component_icon, {
|
|
3628
|
+
class: "cl-absolute cl-cursor-pointer cl-right-3 cl-top-2",
|
|
3629
|
+
icon: "ph:eye-slash",
|
|
3630
|
+
size: 18,
|
|
3631
|
+
onClick: _cache[2] || (_cache[2] = ($event) => passwordFieldType.value = "password")
|
|
3632
|
+
}, null, 512), [
|
|
3633
|
+
[vShow, passwordFieldType.value === "text"]
|
|
3634
|
+
]),
|
|
3635
|
+
withDirectives(createElementVNode("input", {
|
|
3636
|
+
"onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => password.value = $event),
|
|
3637
|
+
class: "!cl-pb-1 !cl-pl-9 !cl-pr-9 cl-w-full",
|
|
3638
|
+
type: passwordFieldType.value,
|
|
3639
|
+
"data-valid": password.value !== "",
|
|
3640
|
+
placeholder: unref(t)("login.password"),
|
|
3641
|
+
autocomplete: "current-password",
|
|
3642
|
+
onInput: clearErrors
|
|
3643
|
+
}, null, 40, _hoisted_14), [
|
|
3644
|
+
[vModelDynamic, password.value]
|
|
3645
|
+
])
|
|
3646
|
+
])
|
|
3647
|
+
]),
|
|
3648
|
+
createElementVNode("div", {
|
|
3649
|
+
class: normalizeClass(["cl-w-full md:cl-pl-1 md:cl-w-1/4", {
|
|
3650
|
+
"cl-mt-1": __props.loading
|
|
3651
|
+
}])
|
|
3652
|
+
}, [
|
|
3653
|
+
createVNode(_sfc_main$k, {
|
|
3654
|
+
class: "cl-w-full",
|
|
3655
|
+
colour: "blue",
|
|
3656
|
+
loading: __props.loading,
|
|
3657
|
+
disabled: !unref(usernameValid) || password.value === "",
|
|
3658
|
+
onClick: withModifiers(login, ["prevent"])
|
|
3659
|
+
}, {
|
|
3660
|
+
default: withCtx(() => [
|
|
3661
|
+
createTextVNode(toDisplayString(unref(t)("login.login")), 1)
|
|
3662
|
+
]),
|
|
3663
|
+
_: 1
|
|
3664
|
+
}, 8, ["loading", "disabled", "onClick"])
|
|
3665
|
+
], 2),
|
|
3666
|
+
withDirectives(createElementVNode("span", _hoisted_15, [
|
|
3667
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(__props.errors, (error, index) => {
|
|
3668
|
+
return openBlock(), createElementBlock("div", {
|
|
3669
|
+
key: index,
|
|
3670
|
+
class: "cl-font-semibold"
|
|
3671
|
+
}, toDisplayString(error), 1);
|
|
3672
|
+
}), 128))
|
|
3673
|
+
], 512), [
|
|
3674
|
+
[vShow, (_a = __props.errors) == null ? void 0 : _a.length]
|
|
3675
|
+
])
|
|
3676
|
+
])
|
|
3677
|
+
], 4);
|
|
3678
|
+
};
|
|
3679
|
+
}
|
|
3680
|
+
});
|
|
3681
|
+
var clUiLogin = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-a300f6dc"]]);
|
|
3682
|
+
var clUiNavigation_vue_vue_type_style_index_0_scoped_true_lang = "";
|
|
3683
|
+
const _hoisted_1$1 = { class: "cl-flex cl-flex-nowrap cl-h-full cl-max-h-full cl-min-h-full cl-min-w-20 cl-relative cl-self-start cl-w-auto" };
|
|
3684
|
+
const _hoisted_2$1 = {
|
|
3685
|
+
key: 0,
|
|
3686
|
+
id: "group-container",
|
|
3687
|
+
class: "cl-bg-blue-default cl-h-full cl-left-0 cl-max-h-full cl-min-h-full cl-min-w-20 cl-overflow-y-auto cl-self-start cl-sticky cl-w-20 cl-z-30"
|
|
3688
|
+
};
|
|
3689
|
+
const _hoisted_3$1 = ["onClick"];
|
|
3690
|
+
const _hoisted_4$1 = { class: "cl-font-bold cl-leading-8 cl-mb-8 cl-pr-8 cl-relative cl-w-full" };
|
|
3691
|
+
const _hoisted_5$1 = { class: "cl-select-none cl-text-blue-light cl-text-lg" };
|
|
3692
|
+
const _hoisted_6$1 = {
|
|
3693
|
+
key: 0,
|
|
3694
|
+
class: "cl-font-bold cl-mb-4 cl-select-none cl-w-full"
|
|
3695
|
+
};
|
|
3696
|
+
const _hoisted_7 = ["href", "alt", "title", "onClick"];
|
|
3697
|
+
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
3698
|
+
props: {
|
|
3699
|
+
groups: { default: () => [] }
|
|
3700
|
+
},
|
|
3701
|
+
emits: {
|
|
3702
|
+
"item-select": null
|
|
3703
|
+
},
|
|
3704
|
+
setup(__props) {
|
|
3705
|
+
const activeGroup = ref(null);
|
|
3706
|
+
const menuPinned = ref(false);
|
|
3707
|
+
function selectNavigationGroup(group) {
|
|
3708
|
+
var _a;
|
|
3709
|
+
activeGroup.value = ((_a = activeGroup.value) == null ? void 0 : _a.name) === group.name ? null : group;
|
|
3710
|
+
}
|
|
3711
|
+
function toggleMenuPinned() {
|
|
3712
|
+
menuPinned.value = !menuPinned.value;
|
|
3713
|
+
}
|
|
3714
|
+
return (_ctx, _cache) => {
|
|
3715
|
+
const _component_icon = resolveComponent("icon");
|
|
3716
|
+
return openBlock(), createElementBlock("div", _hoisted_1$1, [
|
|
3717
|
+
__props.groups ? (openBlock(), createElementBlock("div", _hoisted_2$1, [
|
|
3718
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(__props.groups, (group, index) => {
|
|
3719
|
+
var _a;
|
|
3720
|
+
return openBlock(), createElementBlock("div", {
|
|
3721
|
+
key: index,
|
|
3722
|
+
class: "cl-flex-grow cl-w-full"
|
|
3723
|
+
}, [
|
|
3724
|
+
createElementVNode("div", {
|
|
3725
|
+
class: normalizeClass(["cl-cursor-pointer cl-h-20 cl-transition-colors cl-w-20 hover:cl-bg-blue-light", { "cl-bg-blue-light": group.name === ((_a = activeGroup.value) == null ? void 0 : _a.name) }]),
|
|
3726
|
+
onClick: ($event) => {
|
|
3727
|
+
selectNavigationGroup(group);
|
|
3728
|
+
}
|
|
3729
|
+
}, [
|
|
3730
|
+
group.icon !== null ? (openBlock(), createBlock(_component_icon, {
|
|
3731
|
+
key: 0,
|
|
3732
|
+
class: "cl-block cl-h-20 cl-p-7 cl-w-20",
|
|
3733
|
+
icon: group.icon,
|
|
3734
|
+
color: "#FFFFFF"
|
|
3735
|
+
}, null, 8, ["icon"])) : createCommentVNode("", true)
|
|
3736
|
+
], 10, _hoisted_3$1)
|
|
3737
|
+
]);
|
|
3738
|
+
}), 128))
|
|
3739
|
+
])) : createCommentVNode("", true),
|
|
3740
|
+
createVNode(Transition, { name: "navslide" }, {
|
|
3741
|
+
default: withCtx(() => [
|
|
3742
|
+
activeGroup.value ? (openBlock(), createElementBlock("div", {
|
|
3743
|
+
key: 0,
|
|
3744
|
+
class: normalizeClass(["cl-bg-grey-0 cl-border-grey-2 cl-border-r cl-max-h-full cl-min-h-full cl-min-w-[260px] cl-p-8 cl-self-start cl-top-0 cl-transition-all cl-z-20", {
|
|
3745
|
+
"cl-relative": menuPinned.value,
|
|
3746
|
+
"cl-absolute cl-left-20": !menuPinned.value
|
|
3747
|
+
}])
|
|
3748
|
+
}, [
|
|
3749
|
+
createElementVNode("div", _hoisted_4$1, [
|
|
3750
|
+
createElementVNode("span", _hoisted_5$1, toDisplayString(activeGroup.value.caption), 1),
|
|
3751
|
+
createElementVNode("span", {
|
|
3752
|
+
class: "cl-absolute cl-cursor-pointer cl-h-8 cl-hidden cl-leading-8 cl-right-0 cl-text-center cl-top-0 cl-w-8 md:cl-inline-block",
|
|
3753
|
+
onClick: toggleMenuPinned
|
|
3754
|
+
}, [
|
|
3755
|
+
!menuPinned.value ? (openBlock(), createBlock(_component_icon, {
|
|
3756
|
+
key: 0,
|
|
3757
|
+
class: "cl-inline-block",
|
|
3758
|
+
icon: "ph:push-pin"
|
|
3759
|
+
})) : (openBlock(), createBlock(_component_icon, {
|
|
3760
|
+
key: 1,
|
|
3761
|
+
class: "cl-inline-block",
|
|
3762
|
+
icon: "ph:push-pin-slash"
|
|
3763
|
+
}))
|
|
3764
|
+
])
|
|
3765
|
+
]),
|
|
3766
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(activeGroup.value.sections, (section, sectionIndex) => {
|
|
3767
|
+
return openBlock(), createElementBlock("div", {
|
|
3768
|
+
key: sectionIndex,
|
|
3769
|
+
class: "cl-mb-8 cl-text-sm cl-w-full"
|
|
3770
|
+
}, [
|
|
3771
|
+
section.caption ? (openBlock(), createElementBlock("div", _hoisted_6$1, toDisplayString(section.caption), 1)) : createCommentVNode("", true),
|
|
3772
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(section.records, (record, recordIndex) => {
|
|
3773
|
+
return openBlock(), createElementBlock("span", {
|
|
3774
|
+
key: recordIndex,
|
|
3775
|
+
class: "cl-block cl-cursor-pointer cl-mb-2 cl-transition-colors hover:cl-text-blue-light"
|
|
3776
|
+
}, [
|
|
3777
|
+
record.component ? (openBlock(), createBlock(resolveDynamicComponent(record.component), {
|
|
3778
|
+
key: 0,
|
|
3779
|
+
to: record.link,
|
|
3780
|
+
onClick: ($event) => _ctx.$emit("item-select", record)
|
|
3781
|
+
}, {
|
|
3782
|
+
default: withCtx(() => [
|
|
3783
|
+
createTextVNode(toDisplayString(record.caption), 1)
|
|
3784
|
+
]),
|
|
3785
|
+
_: 2
|
|
3786
|
+
}, 1032, ["to", "onClick"])) : (openBlock(), createElementBlock("a", {
|
|
3787
|
+
key: 1,
|
|
3788
|
+
href: record.link,
|
|
3789
|
+
alt: `External link to: ${record.link}`,
|
|
3790
|
+
title: `External link to: ${record.link}`,
|
|
3791
|
+
target: "new",
|
|
3792
|
+
onClick: ($event) => _ctx.$emit("item-select", record)
|
|
3793
|
+
}, [
|
|
3794
|
+
createVNode(_component_icon, {
|
|
3795
|
+
class: "cl--mt-1 cl-inline-block",
|
|
3796
|
+
icon: "ph:arrow-square-out",
|
|
3797
|
+
alt: "External Link"
|
|
3798
|
+
}),
|
|
3799
|
+
createTextVNode(" " + toDisplayString(record.caption), 1)
|
|
3800
|
+
], 8, _hoisted_7))
|
|
3801
|
+
]);
|
|
3802
|
+
}), 128))
|
|
3803
|
+
]);
|
|
3804
|
+
}), 128))
|
|
3805
|
+
], 2)) : createCommentVNode("", true)
|
|
3806
|
+
]),
|
|
3807
|
+
_: 1
|
|
3808
|
+
})
|
|
3809
|
+
]);
|
|
3810
|
+
};
|
|
3811
|
+
}
|
|
3812
|
+
});
|
|
3813
|
+
var clUiNavigation = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-7f6778e2"]]);
|
|
3814
|
+
var clUiSlider_vue_vue_type_style_index_0_scoped_true_lang = "";
|
|
3815
|
+
const _hoisted_1 = ["value", "min", "max", "step", "disabled"];
|
|
3816
|
+
const _hoisted_2 = { class: "cl-flex cl-flex-1 cl-flex-wrap cl-items-center cl-mt-3 md:cl-mt-0" };
|
|
3817
|
+
const _hoisted_3 = { class: "cl-bg-grey-0 cl-leading-6 cl-ml-0 cl-px-3 cl-rounded-full cl-text-center cl-text-xs md:cl-ml-2" };
|
|
3818
|
+
const _hoisted_4 = ["min", "max", "step", "disabled"];
|
|
3819
|
+
const _hoisted_5 = { class: "cl-bg-grey-0 cl-leading-6 cl-ml-2 cl-px-3 cl-rounded-full cl-text-center cl-text-xs" };
|
|
3820
|
+
const _hoisted_6 = {
|
|
3821
|
+
key: 1,
|
|
3822
|
+
class: "emphasis-danger text-sm w-full"
|
|
3823
|
+
};
|
|
3824
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
3825
|
+
props: {
|
|
3826
|
+
value: null,
|
|
3827
|
+
min: null,
|
|
3828
|
+
max: null,
|
|
3829
|
+
step: { default: 1 },
|
|
3830
|
+
enforceStep: { default: false },
|
|
3831
|
+
disabled: { default: false }
|
|
3832
|
+
},
|
|
3833
|
+
emits: {
|
|
3834
|
+
"update:value": null
|
|
3835
|
+
},
|
|
3836
|
+
setup(__props, { emit }) {
|
|
3837
|
+
const props = __props;
|
|
3838
|
+
const { n, t } = useI18n();
|
|
3839
|
+
const { debounce } = useDebouncer();
|
|
3840
|
+
const currentValue = computed({
|
|
3841
|
+
get: () => props.value,
|
|
3842
|
+
set: (value) => emit("update:value", value)
|
|
3843
|
+
});
|
|
3844
|
+
const colour = computed(() => props.disabled ? "rgba(153, 153, 153, 0.8)" : "#9acd32");
|
|
3845
|
+
const percentage = computed(() => {
|
|
3846
|
+
let value = (currentValue.value - props.min) / (props.max - props.min) * 100;
|
|
3847
|
+
if (value < 35 && value > 0) {
|
|
3848
|
+
if (value < 20) {
|
|
3849
|
+
value += 0.5;
|
|
3850
|
+
} else {
|
|
3851
|
+
value += 0.25;
|
|
3852
|
+
}
|
|
3853
|
+
} else if (value > 65 && value < 100) {
|
|
3854
|
+
if (value > 80) {
|
|
3855
|
+
value -= 0.5;
|
|
3856
|
+
} else {
|
|
3857
|
+
value -= 0.25;
|
|
3858
|
+
}
|
|
3859
|
+
}
|
|
3860
|
+
return value;
|
|
3861
|
+
});
|
|
3862
|
+
const validProps = computed(() => props.min <= props.max && props.step > 0);
|
|
3863
|
+
function updateCurrentValue(target, forceUpdate) {
|
|
3864
|
+
var _a;
|
|
3865
|
+
const inputValue = (_a = target == null ? void 0 : target.value) != null ? _a : "";
|
|
3866
|
+
const value = Math.max(Math.min(parseFloat(inputValue) || props.min, props.max), props.min);
|
|
3867
|
+
currentValue.value = props.enforceStep ? Math.ceil(value / props.step) * props.step : value;
|
|
3868
|
+
nextTick(() => forceUpdate());
|
|
3869
|
+
}
|
|
3870
|
+
return (_ctx, _cache) => {
|
|
3871
|
+
return unref(validProps) ? (openBlock(), createElementBlock("div", mergeProps({ key: 0 }, _ctx.$attrs, { class: "cl-flex cl-flex-wrap cl-items-center" }), [
|
|
3872
|
+
createElementVNode("input", {
|
|
3873
|
+
class: "!cl-text-sm md:!cl-h-8 md:!cl-w-auto",
|
|
3874
|
+
type: "number",
|
|
3875
|
+
value: unref(currentValue),
|
|
3876
|
+
min: __props.min,
|
|
3877
|
+
max: __props.max,
|
|
3878
|
+
step: __props.step,
|
|
3879
|
+
disabled: __props.disabled,
|
|
3880
|
+
onInput: _cache[0] || (_cache[0] = ($event) => unref(debounce)(updateCurrentValue, [$event.target, _ctx.$forceUpdate]))
|
|
3881
|
+
}, null, 40, _hoisted_1),
|
|
3882
|
+
createElementVNode("div", _hoisted_2, [
|
|
3883
|
+
createElementVNode("span", _hoisted_3, toDisplayString(unref(n)(__props.min, Number.isInteger(__props.min) ? unref(NumberFormat).INTEGER : unref(NumberFormat).DECIMAL)), 1),
|
|
3884
|
+
withDirectives(createElementVNode("input", {
|
|
3885
|
+
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => isRef(currentValue) ? currentValue.value = $event : null),
|
|
3886
|
+
class: "cl-align-middle cl-appearance-none cl-bg-gradient-to-r cl-border cl-border-grey-2 cl-delay-500 cl-ease-in cl-flex-1 cl-h-5 cl-ml-2 cl-outline-none cl-rounded-full cl-transition-colors",
|
|
3887
|
+
style: normalizeStyle({
|
|
3888
|
+
background: `linear-gradient(to right, ${unref(colour)} 0%, ${unref(colour)} ${unref(percentage)}%, white ${unref(percentage)}%, white 100%)`
|
|
3889
|
+
}),
|
|
3890
|
+
type: "range",
|
|
3891
|
+
min: __props.min,
|
|
3892
|
+
max: __props.max,
|
|
3893
|
+
step: __props.step,
|
|
3894
|
+
disabled: __props.disabled
|
|
3895
|
+
}, null, 12, _hoisted_4), [
|
|
3896
|
+
[
|
|
3897
|
+
vModelText,
|
|
3898
|
+
unref(currentValue),
|
|
3899
|
+
void 0,
|
|
3900
|
+
{ number: true }
|
|
3901
|
+
]
|
|
3902
|
+
]),
|
|
3903
|
+
createElementVNode("span", _hoisted_5, toDisplayString(unref(n)(__props.max, Number.isInteger(__props.max) ? unref(NumberFormat).INTEGER : unref(NumberFormat).DECIMAL)), 1)
|
|
3904
|
+
])
|
|
3905
|
+
], 16)) : (openBlock(), createElementBlock("div", _hoisted_6, toDisplayString(unref(t)("slider.invalidProps")), 1));
|
|
3906
|
+
};
|
|
3907
|
+
}
|
|
3908
|
+
});
|
|
3909
|
+
var clUiSlider = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-b25cdc80"]]);
|
|
3910
|
+
var components = /* @__PURE__ */ Object.freeze({
|
|
3911
|
+
__proto__: null,
|
|
3912
|
+
[Symbol.toStringTag]: "Module",
|
|
3913
|
+
clUiAccordion: _sfc_main$o,
|
|
3914
|
+
clUiApp: _sfc_main$m,
|
|
3915
|
+
clUiButton: _sfc_main$k,
|
|
3916
|
+
buttonColours,
|
|
3917
|
+
buttonSizes,
|
|
3918
|
+
clUiCalendar: _sfc_main$j,
|
|
3919
|
+
calendarTypes,
|
|
3920
|
+
clUiCard: _sfc_main$i,
|
|
3921
|
+
cardSizes,
|
|
3922
|
+
clUiComboBox: _sfc_main$d,
|
|
3923
|
+
isComboBoxItem,
|
|
3924
|
+
isComboBoxCreateRequest,
|
|
3925
|
+
clUiFooter,
|
|
3926
|
+
clUiGrid,
|
|
3927
|
+
gridColumnTypes,
|
|
3928
|
+
isGridColumn,
|
|
3929
|
+
isGridColumnArray,
|
|
3930
|
+
stringFormats,
|
|
3931
|
+
get FilterOperation() {
|
|
3932
|
+
return FilterOperation;
|
|
3933
|
+
},
|
|
3934
|
+
filterMethodTypes,
|
|
3935
|
+
isFilterRequest,
|
|
3936
|
+
isFilterResponse,
|
|
3937
|
+
clUiHeader,
|
|
3938
|
+
clUiHeaderMenu: _sfc_main$4,
|
|
3939
|
+
clUiLanguageSwitcher: _sfc_main$3,
|
|
3940
|
+
isLanguageLocaleFormat,
|
|
3941
|
+
isLanguageArray,
|
|
3942
|
+
clUiLoadingSpinner: ClUiLoadingSpinner,
|
|
3943
|
+
clUiLogin,
|
|
3944
|
+
clUiModal: _sfc_main$h,
|
|
3945
|
+
clUiNavigation,
|
|
3946
|
+
clUiNotification: _sfc_main$n,
|
|
3947
|
+
clUiSlider
|
|
3948
|
+
});
|
|
3949
|
+
var main = "";
|
|
3950
|
+
const install = (app) => {
|
|
3951
|
+
app.use(i18n);
|
|
3952
|
+
app.component("Icon", Icon);
|
|
3953
|
+
Object.entries(components).forEach(([
|
|
3954
|
+
name,
|
|
3955
|
+
component
|
|
3956
|
+
]) => {
|
|
3957
|
+
app.component(name, component);
|
|
3958
|
+
});
|
|
3959
|
+
};
|
|
3960
|
+
export { DateFormat, FilterOperation, NumberFormat, buttonColours, buttonSizes, calendarTypes, cardSizes, _sfc_main$o as clUiAccordion, _sfc_main$m as clUiApp, _sfc_main$k as clUiButton, _sfc_main$j as clUiCalendar, _sfc_main$i as clUiCard, _sfc_main$d as clUiComboBox, clUiFooter, clUiGrid, clUiHeader, _sfc_main$4 as clUiHeaderMenu, _sfc_main$3 as clUiLanguageSwitcher, ClUiLoadingSpinner as clUiLoadingSpinner, clUiLogin, _sfc_main$h as clUiModal, clUiNavigation, _sfc_main$n as clUiNotification, clUiSlider, compareByProperty, copy, datetimeFormats, install as default, filterMethodTypes, generateStringId, getParamsByName, gridColumnTypes, i18n, isComboBoxCreateRequest, isComboBoxItem, isFilterRequest, isFilterResponse, isGridColumn, isGridColumnArray, isLanguageArray, isLanguageLocaleFormat, messages, nameOf, numberFormats, setCurrentLocale, setLocaleDateTimeFormats, setLocaleMessages, setLocaleNumberFormats, showNotification, stringExtensionsEnabled, stringFormats, useDebouncer };
|