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