@citruslime/ui 2.0.0-beta.13 → 2.0.0-beta.17

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.
@@ -31,7 +31,7 @@ var __objRest = (source, exclude) => {
31
31
  return target;
32
32
  };
33
33
  import { Icon } from "@iconify/vue";
34
- import { defineComponent, ref, openBlock, createElementBlock, renderSlot, normalizeProps, guardReactiveProps, resolveComponent, Fragment, createElementVNode, normalizeClass, createVNode, Transition, withCtx, withDirectives, vShow, reactive, toRefs, nextTick, createBlock, Teleport, renderList, unref, mergeProps, toDisplayString, computed, watch, onMounted, onUnmounted, createCommentVNode, withKeys, withModifiers, vModelText, isRef, createTextVNode, watchEffect, normalizeStyle, createSlots, vModelDynamic } from "vue";
34
+ import { defineComponent, ref, openBlock, createElementBlock, renderSlot, normalizeProps, guardReactiveProps, resolveComponent, Fragment, createElementVNode, normalizeClass, createVNode, Transition, withCtx, withDirectives, vShow, reactive, toRefs, nextTick, createBlock, Teleport, renderList, unref, mergeProps, toDisplayString, createCommentVNode, computed, watch, onMounted, onUnmounted, isRef, normalizeStyle, vModelText, withModifiers, vModelDynamic, withKeys, createTextVNode, watchEffect, createSlots } from "vue";
35
35
  import { createI18n, useI18n } from "vue-i18n";
36
36
  import Flatpickr from "flatpickr";
37
37
  const _hoisted_1$u = { class: "cl-overflow-hidden" };
@@ -76,7 +76,7 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
76
76
  const _hoisted_1$t = { class: "cl-absolute cl-left-5 cl-top-5" };
77
77
  const _hoisted_2$n = { class: "cl-font-semibold cl-ml-10 cl-p-4 cl-select-none cl-text-grey-5" };
78
78
  const _hoisted_3$h = { class: "cl-overflow-hidden" };
79
- const _hoisted_4$e = { class: "cl-ml-10 cl-p-4" };
79
+ const _hoisted_4$d = { class: "cl-ml-10 cl-p-4" };
80
80
  const _sfc_main$u = /* @__PURE__ */ defineComponent({
81
81
  props: {
82
82
  open: { type: Boolean },
@@ -118,7 +118,7 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
118
118
  createElementVNode("div", _hoisted_3$h, [
119
119
  createVNode(Transition, { name: "grow-down" }, {
120
120
  default: withCtx(() => [
121
- withDirectives(createElementVNode("div", _hoisted_4$e, [
121
+ withDirectives(createElementVNode("div", _hoisted_4$d, [
122
122
  renderSlot(_ctx.$slots, "default")
123
123
  ], 512), [
124
124
  [vShow, __props.open]
@@ -183,236 +183,6 @@ function getParamsByName(stringToSearch, paramToFind) {
183
183
  }
184
184
  return valueToReturn;
185
185
  }
186
- function levenshtein(firstString, secondString) {
187
- if (firstString.length === 0) {
188
- return secondString.length;
189
- }
190
- if (secondString.length === 0) {
191
- return firstString.length;
192
- }
193
- if (firstString.length > secondString.length) {
194
- const tmp = firstString;
195
- firstString = secondString;
196
- secondString = tmp;
197
- }
198
- const row = new Int8Array(firstString.length + 1);
199
- for (let i = 0; i <= firstString.length; i++) {
200
- row[i] = i;
201
- }
202
- let temp;
203
- for (let i = 1; i <= secondString.length; i++) {
204
- let prev = i;
205
- const previousChar = secondString[i - 1];
206
- for (let j = 1; j <= firstString.length; j++) {
207
- if (previousChar === firstString[j - 1]) {
208
- temp = row[j - 1];
209
- } else {
210
- const a = prev + 1;
211
- const b = row[j] + 1;
212
- const c = a - (a - b & b - a >> 7);
213
- const d = row[j - 1] + 1;
214
- temp = c - (c - d & d - c >> 7);
215
- }
216
- row[j - 1] = prev;
217
- prev = temp;
218
- }
219
- row[firstString.length] = prev;
220
- }
221
- return row[firstString.length];
222
- }
223
- function camelCaseToArray(camelCase) {
224
- return camelCase.split(/(?=[A-Z])/g);
225
- }
226
- function kebabCaseToArray(kebabCase) {
227
- return kebabCase.split(/(?=-)/g).map((s) => s.replace(/-/g, ""));
228
- }
229
- function pascalCaseToArray(pascalCase) {
230
- return camelCaseToArray(pascalCase);
231
- }
232
- function sentenceCaseToArray(sentenceCase) {
233
- return sentenceCase.split(/ /g).map((s) => s.replace(/[^A-Za-z0-9]/g, ""));
234
- }
235
- function snakeCaseToArray(snakeCase) {
236
- return snakeCase.split(/(?=_)/g).map((s) => s.replace(/_/g, ""));
237
- }
238
- function titleCaseToArray(titleCase) {
239
- return sentenceCaseToArray(titleCase);
240
- }
241
- function arrayToCamelCase(array, locale) {
242
- let result = "";
243
- array.forEach((s, i) => {
244
- result += i === 0 ? s.toLocaleLowerCase(locale) : s.toLocaleLowerCase(locale).firstCharToUpperCase(locale);
245
- });
246
- return result;
247
- }
248
- function arrayToKebabCase(array, lowerCase, locale) {
249
- let result = "";
250
- array.forEach((s) => {
251
- result += `${lowerCase ? s.toLocaleLowerCase(locale) : s.toLocaleUpperCase(locale)}-`;
252
- });
253
- return result.trimEndChar("-");
254
- }
255
- function arrayToSentenceCase(array, locale) {
256
- let result = "";
257
- array.forEach((s, i) => {
258
- result += `${i === 0 ? s.toLowerCase().firstCharToUpperCase(locale) : s.toLocaleLowerCase(locale)} `;
259
- });
260
- return result.trimEndChar(" ");
261
- }
262
- function arrayToTitleCase(array, locale) {
263
- let result = "";
264
- array.forEach((s) => {
265
- result += `${s.toLocaleLowerCase(locale).firstCharToUpperCase(locale)} `;
266
- });
267
- return result.trimEndChar(" ");
268
- }
269
- String.prototype.similarity = function(comparisonString) {
270
- let similarityToReturn = 0;
271
- let longerString = this.toLowerCase();
272
- let shorterString = comparisonString.toLowerCase();
273
- if (longerString < shorterString) {
274
- const temp = shorterString;
275
- shorterString = longerString;
276
- longerString = temp;
277
- }
278
- const longerLength = longerString.length;
279
- if (longerLength === 0) {
280
- similarityToReturn = 100;
281
- } else {
282
- similarityToReturn = Math.round((longerLength - levenshtein(longerString, shorterString)) / longerLength * 100);
283
- }
284
- return similarityToReturn;
285
- };
286
- String.prototype.trimChar = function(character) {
287
- return this.trimStartChar(character).trimEndChar(character);
288
- };
289
- String.prototype.trimStartChar = function(character) {
290
- return character !== "" && this.startsWith(character) ? this.slice(1) : this;
291
- };
292
- String.prototype.trimEndChar = function(character) {
293
- return character !== "" && this.endsWith(character) ? this.slice(0, -1) : this;
294
- };
295
- String.prototype.trimToLength = function(length, addEllipsis = false) {
296
- const trimLength = this.length < length ? this.length : length;
297
- return addEllipsis && trimLength >= 4 && trimLength < this.length ? `${this.slice(0, Math.max(trimLength - 3, 1))}...` : this.slice(0, Math.max(trimLength, 1));
298
- };
299
- String.prototype.firstCharToUpperCase = function(locale) {
300
- return `${this.charAt(0).toLocaleUpperCase(locale)}${this.slice(1)}`;
301
- };
302
- String.prototype.firstCharToLowerCase = function(locale) {
303
- return `${this.charAt(0).toLocaleLowerCase(locale)}${this.slice(1)}`;
304
- };
305
- String.prototype.removeWhitespace = function() {
306
- return this.replace(/\s/g, "");
307
- };
308
- String.prototype.removeNonAlphanumeric = function() {
309
- return this.replace(/[^a-zA-Z0-9]/g, "");
310
- };
311
- String.prototype.removeNonAlphabetic = function() {
312
- return this.replace(/[^a-zA-Z]/g, "");
313
- };
314
- String.prototype.removeNonNumeric = function() {
315
- return this.replace(/[^0-9]/g, "");
316
- };
317
- String.prototype.replacePlaceholders = function(...args) {
318
- let i = 0;
319
- return this.replace(/{\d+}/g, () => typeof args[i] !== "undefined" ? args[i++] : "");
320
- };
321
- String.prototype.camelCaseToKebabCase = function(lowerCase = true, locale) {
322
- return arrayToKebabCase(camelCaseToArray(this), lowerCase, locale);
323
- };
324
- String.prototype.camelCaseToPascalCase = function(locale) {
325
- return this.firstCharToUpperCase(locale);
326
- };
327
- String.prototype.camelCaseToSentenceCase = function(locale) {
328
- return arrayToSentenceCase(camelCaseToArray(this), locale);
329
- };
330
- String.prototype.camelCaseToSnakeCase = function(lowerCase = true, locale) {
331
- return this.camelCaseToKebabCase().kebabCaseToSnakeCase(lowerCase, locale);
332
- };
333
- String.prototype.camelCaseToTitleCase = function(locale) {
334
- return arrayToTitleCase(camelCaseToArray(this), locale);
335
- };
336
- String.prototype.kebabCaseToCamelCase = function(locale) {
337
- return arrayToCamelCase(kebabCaseToArray(this), locale);
338
- };
339
- String.prototype.kebabCaseToPascalCase = function(locale) {
340
- return this.kebabCaseToCamelCase().camelCaseToPascalCase(locale);
341
- };
342
- String.prototype.kebabCaseToSentenceCase = function(locale) {
343
- return arrayToSentenceCase(kebabCaseToArray(this), locale);
344
- };
345
- String.prototype.kebabCaseToSnakeCase = function(lowerCase = true, locale) {
346
- const result = this.replace(/-/g, "_");
347
- return lowerCase ? result.toLocaleLowerCase(locale) : result.toLocaleUpperCase(locale);
348
- };
349
- String.prototype.kebabCaseToTitleCase = function(locale) {
350
- return arrayToTitleCase(kebabCaseToArray(this), locale);
351
- };
352
- String.prototype.pascalCaseToCamelCase = function(locale) {
353
- return arrayToCamelCase(pascalCaseToArray(this), locale);
354
- };
355
- String.prototype.pascalCaseToKebabCase = function(lowerCase = true, locale) {
356
- return arrayToKebabCase(pascalCaseToArray(this), lowerCase, locale);
357
- };
358
- String.prototype.pascalCaseToSentenceCase = function(locale) {
359
- return arrayToSentenceCase(pascalCaseToArray(this), locale);
360
- };
361
- String.prototype.pascalCaseToSnakeCase = function(lowerCase = true, locale) {
362
- return this.pascalCaseToKebabCase().kebabCaseToSnakeCase(lowerCase, locale);
363
- };
364
- String.prototype.pascalCaseToTitleCase = function(locale) {
365
- return arrayToTitleCase(pascalCaseToArray(this), locale);
366
- };
367
- String.prototype.sentenceCaseToCamelCase = function(locale) {
368
- return arrayToCamelCase(sentenceCaseToArray(this), locale);
369
- };
370
- String.prototype.sentenceCaseToKebabCase = function(lowerCase = true, locale) {
371
- return arrayToKebabCase(sentenceCaseToArray(this), lowerCase, locale);
372
- };
373
- String.prototype.sentenceCaseToPascalCase = function(locale) {
374
- return this.sentenceCaseToCamelCase().camelCaseToPascalCase(locale);
375
- };
376
- String.prototype.sentenceCaseToSnakeCase = function(lowerCase = true, locale) {
377
- return this.sentenceCaseToKebabCase().kebabCaseToSnakeCase(lowerCase, locale);
378
- };
379
- String.prototype.sentenceCaseToTitleCase = function(locale) {
380
- return arrayToTitleCase(sentenceCaseToArray(this), locale);
381
- };
382
- String.prototype.snakeCaseToCamelCase = function(locale) {
383
- return arrayToCamelCase(snakeCaseToArray(this), locale);
384
- };
385
- String.prototype.snakeCaseToKebabCase = function(lowerCase = true, locale) {
386
- const result = this.replace(/_/g, "-");
387
- return lowerCase ? result.toLocaleLowerCase(locale) : result.toLocaleUpperCase(locale);
388
- };
389
- String.prototype.snakeCaseToPascalCase = function(locale) {
390
- return this.snakeCaseToCamelCase().camelCaseToPascalCase(locale);
391
- };
392
- String.prototype.snakeCaseToSentenceCase = function(locale) {
393
- return arrayToSentenceCase(snakeCaseToArray(this), locale);
394
- };
395
- String.prototype.snakeCaseToTitleCase = function(locale) {
396
- return arrayToTitleCase(snakeCaseToArray(this), locale);
397
- };
398
- String.prototype.titleCaseToCamelCase = function(locale) {
399
- return arrayToCamelCase(titleCaseToArray(this), locale);
400
- };
401
- String.prototype.titleCaseToKebabCase = function(lowerCase = true, locale) {
402
- return arrayToKebabCase(titleCaseToArray(this), lowerCase, locale);
403
- };
404
- String.prototype.titleCaseToPascalCase = function(locale) {
405
- return this.titleCaseToCamelCase().camelCaseToPascalCase(locale);
406
- };
407
- String.prototype.titleCaseToSentenceCase = function(locale) {
408
- return arrayToSentenceCase(titleCaseToArray(this), locale);
409
- };
410
- String.prototype.titleCaseToSnakeCase = function(lowerCase = true, locale) {
411
- return this.titleCaseToKebabCase().kebabCaseToSnakeCase(lowerCase, locale);
412
- };
413
- String.prototype.toDateFromTime = function() {
414
- return new Date(`${new Date().toISOString().substr(0, 11)}${this}`);
415
- };
416
186
  var NumberFormat;
417
187
  (function(NumberFormat2) {
418
188
  NumberFormat2["CURRENCY"] = "currency";
@@ -502,8 +272,7 @@ const messages = {
502
272
  login: "Login",
503
273
  email: "Email Address",
504
274
  password: "Password",
505
- validEmail: "Username is a valid email address.",
506
- invalidEmail: "Username must be a valid email address."
275
+ validEmail: "Username is a valid email address."
507
276
  },
508
277
  slider: {
509
278
  invalidProps: "The current combination of props is invalid. Please confirm the values provided are correct."
@@ -877,32 +646,88 @@ const buttonSizes = [
877
646
  "medium",
878
647
  "large"
879
648
  ];
880
- var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
881
- var de = { exports: {} };
882
- (function(module, exports) {
883
- (function(global2, factory) {
884
- factory(exports);
885
- })(commonjsGlobal, function(exports2) {
886
- var fp = typeof window !== "undefined" && window.flatpickr !== void 0 ? window.flatpickr : {
887
- l10ns: {}
888
- };
889
- var German = {
890
- weekdays: {
891
- shorthand: ["So", "Mo", "Di", "Mi", "Do", "Fr", "Sa"],
892
- longhand: [
893
- "Sonntag",
894
- "Montag",
895
- "Dienstag",
896
- "Mittwoch",
897
- "Donnerstag",
898
- "Freitag",
899
- "Samstag"
900
- ]
901
- },
902
- months: {
903
- shorthand: [
904
- "Jan",
905
- "Feb",
649
+ const _hoisted_1$n = { key: 0 };
650
+ const _sfc_main$o = /* @__PURE__ */ defineComponent({
651
+ props: {
652
+ size: { default: "medium" },
653
+ hover: { type: Boolean, default: false }
654
+ },
655
+ setup(__props) {
656
+ return (_ctx, _cache) => {
657
+ return openBlock(), createElementBlock("div", {
658
+ class: normalizeClass(["cl-border cl-border-transparent cl-overflow-hidden cl-relative cl-rounded-md cl-shadow-lg cl-transition-all", {
659
+ "cl-cursor-pointer hover:cl-shadow-xl hover:cl-border-grey-0": __props.hover
660
+ }])
661
+ }, [
662
+ _ctx.$slots.image ? (openBlock(), createElementBlock("div", _hoisted_1$n, [
663
+ renderSlot(_ctx.$slots, "image")
664
+ ])) : createCommentVNode("", true),
665
+ _ctx.$slots.title ? (openBlock(), createElementBlock("div", {
666
+ key: 1,
667
+ class: normalizeClass(["cl-border-grey-2 cl-font-normal", {
668
+ "cl-p-2 cl-text-2xl cl-leading-8": __props.size === "small",
669
+ "cl-p-4 cl-text-3xl cl-leading-9": __props.size === "medium",
670
+ "cl-p-6 cl-text-4xl cl-leading-10": __props.size === "large",
671
+ "cl-border-t": _ctx.$slots.image
672
+ }])
673
+ }, [
674
+ renderSlot(_ctx.$slots, "title")
675
+ ], 2)) : createCommentVNode("", true),
676
+ createElementVNode("div", {
677
+ class: normalizeClass(["cl-border-grey-2", {
678
+ "cl-p-2": __props.size === "small",
679
+ "cl-p-4": __props.size === "medium",
680
+ "cl-p-6": __props.size === "large",
681
+ "cl-border-t": _ctx.$slots.image || _ctx.$slots.title
682
+ }])
683
+ }, [
684
+ renderSlot(_ctx.$slots, "default")
685
+ ], 2),
686
+ _ctx.$slots.footer ? (openBlock(), createElementBlock("div", {
687
+ key: 2,
688
+ class: normalizeClass(["cl-border-grey-2 cl-border-t", {
689
+ "cl-p-2": __props.size === "small",
690
+ "cl-p-4": __props.size === "medium",
691
+ "cl-p-6": __props.size === "large"
692
+ }])
693
+ }, [
694
+ renderSlot(_ctx.$slots, "footer")
695
+ ], 2)) : createCommentVNode("", true)
696
+ ], 2);
697
+ };
698
+ }
699
+ });
700
+ const cardSizes = [
701
+ "small",
702
+ "medium",
703
+ "large"
704
+ ];
705
+ var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
706
+ var de = { exports: {} };
707
+ (function(module, exports) {
708
+ (function(global2, factory) {
709
+ factory(exports);
710
+ })(commonjsGlobal, function(exports2) {
711
+ var fp = typeof window !== "undefined" && window.flatpickr !== void 0 ? window.flatpickr : {
712
+ l10ns: {}
713
+ };
714
+ var German = {
715
+ weekdays: {
716
+ shorthand: ["So", "Mo", "Di", "Mi", "Do", "Fr", "Sa"],
717
+ longhand: [
718
+ "Sonntag",
719
+ "Montag",
720
+ "Dienstag",
721
+ "Mittwoch",
722
+ "Donnerstag",
723
+ "Freitag",
724
+ "Samstag"
725
+ ]
726
+ },
727
+ months: {
728
+ shorthand: [
729
+ "Jan",
730
+ "Feb",
906
731
  "M\xE4r",
907
732
  "Apr",
908
733
  "Mai",
@@ -1312,7 +1137,7 @@ function generateFixedDate() {
1312
1137
  return new Date(`${FixedDate.YEAR}-${FixedDate.MONTH}-${FixedDate.DAY}T${FixedDate.HOUR}:${FixedDate.MINUTE}`);
1313
1138
  }
1314
1139
  function replaceDateWithPlaceholders(date, hourPlaceholder, yearPlaceholder) {
1315
- return date.replace(FixedDate.YEAR, yearPlaceholder).replace(FixedDate.HOUR, hourPlaceholder).replace(FixedDate.MONTH, "m").replace(FixedDate.MONTH_SHORT, "n").replace(FixedDate.DAY, "d").replace(FixedDate.DAY_SHORT, "j").replace(FixedDate.MINUTE, "i").replace(FixedDate.SUFFIX, "K").replace(",", "");
1140
+ return date.replace(FixedDate.YEAR, yearPlaceholder).replace(FixedDate.HOUR, hourPlaceholder).replace(FixedDate.MONTH, "m").replace(FixedDate.MONTH_SHORT, "n").replace(FixedDate.DAY, "d").replace(FixedDate.DAY_SHORT, "j").replace(FixedDate.MINUTE, "i").replace(FixedDate.SUFFIX, "K");
1316
1141
  }
1317
1142
  function getLocale(locale) {
1318
1143
  let result;
@@ -1366,9 +1191,9 @@ function getFormattedTimeForMinMax(date) {
1366
1191
  return formatted;
1367
1192
  }
1368
1193
  var clUiCalendar_vue_vue_type_style_index_0_lang = "";
1369
- const _hoisted_1$n = ["placeholder", "disabled"];
1370
- const _hoisted_2$l = { class: "cl-absolute cl-bg-white cl-flex cl-right-2 cl-text-grey-4 cl-top-3" };
1371
- const _sfc_main$o = /* @__PURE__ */ defineComponent({
1194
+ const _hoisted_1$m = ["placeholder", "disabled"];
1195
+ const _hoisted_2$l = { class: "cl-absolute cl-bg-white cl-flex cl-right-2 cl-text-grey-4 cl-top-3.5" };
1196
+ const _sfc_main$n = /* @__PURE__ */ defineComponent({
1372
1197
  props: {
1373
1198
  date: { default: () => null },
1374
1199
  datePlaceholder: { default: "Select date." },
@@ -1552,16 +1377,13 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
1552
1377
  element.value = _value;
1553
1378
  }
1554
1379
  }, _ctx.$attrs, {
1555
- class: ["!cl-text-sm", {
1556
- "!cl-pr-12": __props.date !== null,
1557
- "!cl-pr-8": __props.date === null
1558
- }],
1380
+ 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 }],
1559
1381
  type: "text",
1560
1382
  placeholder: unref(placeholder),
1561
1383
  disabled: __props.disabled
1562
- }), null, 16, _hoisted_1$n),
1384
+ }), null, 16, _hoisted_1$m),
1563
1385
  withDirectives(createVNode(_component_icon, {
1564
- class: normalizeClass(["cl-absolute cl-bg-white cl-right-2 cl-text-grey-4 cl-top-3", {
1386
+ class: normalizeClass(["cl-absolute cl-bg-white cl-right-2 cl-text-grey-4 cl-top-3.5", {
1565
1387
  "!cl-bg-off-white": __props.disabled
1566
1388
  }]),
1567
1389
  icon: "ph:calendar",
@@ -1571,7 +1393,7 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
1571
1393
  [vShow, (__props.date === null || __props.disabled) && __props.type !== "time"]
1572
1394
  ]),
1573
1395
  withDirectives(createVNode(_component_icon, {
1574
- class: normalizeClass(["cl-absolute cl-bg-white cl-right-2 cl-text-grey-4 cl-top-3", {
1396
+ class: normalizeClass(["cl-absolute cl-bg-white cl-right-2 cl-text-grey-4 cl-top-3.5", {
1575
1397
  "!cl-bg-off-white": __props.disabled
1576
1398
  }]),
1577
1399
  icon: "ph-clock",
@@ -1605,579 +1427,1026 @@ const calendarTypes = [
1605
1427
  "datetime",
1606
1428
  "time"
1607
1429
  ];
1608
- const _hoisted_1$m = { key: 0 };
1609
- const _sfc_main$n = /* @__PURE__ */ defineComponent({
1430
+ var clUiSlider_vue_vue_type_style_index_0_scoped_true_lang = "";
1431
+ const _hoisted_1$l = { class: "cl-flex cl-flex-wrap cl-items-center" };
1432
+ 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" };
1433
+ 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" };
1434
+ const _hoisted_4$c = {
1435
+ key: 0,
1436
+ class: "cl-w-full"
1437
+ };
1438
+ const _hoisted_5$9 = ["min", "max", "step", "disabled"];
1439
+ 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" };
1440
+ const _hoisted_7$7 = {
1441
+ key: 1,
1442
+ class: "emphasis-danger text-sm w-full"
1443
+ };
1444
+ const _sfc_main$m = /* @__PURE__ */ defineComponent({
1610
1445
  props: {
1611
- size: { default: "medium" },
1612
- hover: { type: Boolean, default: false }
1446
+ value: null,
1447
+ min: null,
1448
+ max: null,
1449
+ step: { default: 1 },
1450
+ enforceStep: { type: Boolean, default: false },
1451
+ disabled: { type: Boolean, default: false },
1452
+ showNumericInput: { type: Boolean, default: true }
1613
1453
  },
1614
- setup(__props) {
1454
+ emits: {
1455
+ "update:value": null
1456
+ },
1457
+ setup(__props, { emit }) {
1458
+ const props = __props;
1459
+ const { n, t: t2 } = useI18n();
1460
+ const { debounce } = useDebouncer();
1461
+ const numericInputValue = ref(props.value);
1462
+ const currentValue = computed({
1463
+ get: () => props.value,
1464
+ set: (value) => emit("update:value", value)
1465
+ });
1466
+ const colour = computed(() => props.disabled ? "rgba(153, 153, 153, 0.8)" : "#9acd32");
1467
+ const percentage = computed(() => {
1468
+ let value = (currentValue.value - props.min) / (props.max - props.min) * 100;
1469
+ if (value < 35 && value > 0) {
1470
+ if (value < 20) {
1471
+ value += 0.5;
1472
+ } else {
1473
+ value += 0.25;
1474
+ }
1475
+ } else if (value > 65 && value < 100) {
1476
+ if (value > 80) {
1477
+ value -= 0.5;
1478
+ } else {
1479
+ value -= 0.25;
1480
+ }
1481
+ }
1482
+ return value;
1483
+ });
1484
+ const validProps = computed(() => props.min <= props.max && props.step > 0);
1485
+ function updateCurrentValue(target, forceUpdate) {
1486
+ var _a;
1487
+ const inputValue = (_a = target == null ? void 0 : target.value) != null ? _a : "";
1488
+ const value = Math.max(Math.min(parseFloat(inputValue) || props.min, props.max), props.min);
1489
+ currentValue.value = props.enforceStep ? Math.ceil(value / props.step) * props.step : value;
1490
+ nextTick(() => forceUpdate());
1491
+ }
1492
+ watch(() => props.value, () => numericInputValue.value = props.value);
1615
1493
  return (_ctx, _cache) => {
1616
- return openBlock(), createElementBlock("div", {
1617
- class: normalizeClass(["cl-border cl-border-transparent cl-overflow-hidden cl-relative cl-rounded-md cl-shadow-lg cl-transition-all", {
1618
- "cl-cursor-pointer hover:cl-shadow-xl hover:cl-border-grey-0": __props.hover
1619
- }])
1620
- }, [
1621
- _ctx.$slots.image ? (openBlock(), createElementBlock("div", _hoisted_1$m, [
1622
- renderSlot(_ctx.$slots, "image")
1623
- ])) : createCommentVNode("", true),
1624
- _ctx.$slots.title ? (openBlock(), createElementBlock("div", {
1625
- key: 1,
1626
- class: normalizeClass(["cl-border-grey-2 cl-font-normal", {
1627
- "cl-p-2 cl-text-2xl cl-leading-8": __props.size === "small",
1628
- "cl-p-4 cl-text-3xl cl-leading-9": __props.size === "medium",
1629
- "cl-p-6 cl-text-4xl cl-leading-10": __props.size === "large",
1630
- "cl-border-t": _ctx.$slots.image
1631
- }])
1632
- }, [
1633
- renderSlot(_ctx.$slots, "title")
1634
- ], 2)) : createCommentVNode("", true),
1635
- createElementVNode("div", {
1636
- class: normalizeClass(["cl-border-grey-2", {
1637
- "cl-p-2": __props.size === "small",
1638
- "cl-p-4": __props.size === "medium",
1639
- "cl-p-6": __props.size === "large",
1640
- "cl-border-t": _ctx.$slots.image || _ctx.$slots.title
1641
- }])
1642
- }, [
1643
- renderSlot(_ctx.$slots, "default")
1644
- ], 2),
1645
- _ctx.$slots.footer ? (openBlock(), createElementBlock("div", {
1646
- key: 2,
1647
- class: normalizeClass(["cl-border-grey-2 cl-border-t", {
1648
- "cl-p-2": __props.size === "small",
1649
- "cl-p-4": __props.size === "medium",
1650
- "cl-p-6": __props.size === "large"
1651
- }])
1652
- }, [
1653
- renderSlot(_ctx.$slots, "footer")
1654
- ], 2)) : createCommentVNode("", true)
1655
- ], 2);
1494
+ const _component_cl_ui_input = resolveComponent("cl-ui-input");
1495
+ return unref(validProps) ? (openBlock(), createElementBlock("div", normalizeProps(mergeProps({ key: 0 }, _ctx.$attrs)), [
1496
+ withDirectives(createElementVNode("div", { class: "cl-bg-transparent cl-relative cl-text-center cl-text-sm" }, toDisplayString(unref(currentValue)), 513), [
1497
+ [vShow, !__props.showNumericInput]
1498
+ ]),
1499
+ createElementVNode("div", _hoisted_1$l, [
1500
+ withDirectives(createVNode(_component_cl_ui_input, {
1501
+ modelValue: numericInputValue.value,
1502
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => numericInputValue.value = $event),
1503
+ class: "!cl-text-sm md:!cl-w-auto",
1504
+ "input-type": "number",
1505
+ min: __props.min,
1506
+ max: __props.max,
1507
+ step: __props.step,
1508
+ disabled: __props.disabled,
1509
+ onInput: _cache[1] || (_cache[1] = ($event) => unref(debounce)(updateCurrentValue, [$event.target, _ctx.$forceUpdate]))
1510
+ }, null, 8, ["modelValue", "min", "max", "step", "disabled"]), [
1511
+ [vShow, __props.showNumericInput]
1512
+ ]),
1513
+ createElementVNode("div", _hoisted_2$k, [
1514
+ createElementVNode("span", _hoisted_3$g, toDisplayString(unref(n)(__props.min, Number.isInteger(__props.min) ? unref(NumberFormat).INTEGER : unref(NumberFormat).DECIMAL)), 1),
1515
+ typeof unref(currentValue) === "number" ? (openBlock(), createElementBlock("div", _hoisted_4$c, [
1516
+ withDirectives(createElementVNode("input", {
1517
+ "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => isRef(currentValue) ? currentValue.value = $event : null),
1518
+ 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",
1519
+ style: normalizeStyle({
1520
+ background: `linear-gradient(to right, ${unref(colour)} 0%, ${unref(colour)} ${unref(percentage)}%, white ${unref(percentage)}%, white 100%)`
1521
+ }),
1522
+ type: "range",
1523
+ min: __props.min,
1524
+ max: __props.max,
1525
+ step: __props.step,
1526
+ disabled: __props.disabled
1527
+ }, null, 12, _hoisted_5$9), [
1528
+ [
1529
+ vModelText,
1530
+ unref(currentValue),
1531
+ void 0,
1532
+ { number: true }
1533
+ ]
1534
+ ])
1535
+ ])) : createCommentVNode("", true),
1536
+ createElementVNode("span", _hoisted_6$7, toDisplayString(unref(n)(__props.max, Number.isInteger(__props.max) ? unref(NumberFormat).INTEGER : unref(NumberFormat).DECIMAL)), 1)
1537
+ ])
1538
+ ])
1539
+ ], 16)) : (openBlock(), createElementBlock("div", _hoisted_7$7, toDisplayString(unref(t2)("slider.invalidProps")), 1));
1656
1540
  };
1657
1541
  }
1658
1542
  });
1659
- const cardSizes = [
1660
- "small",
1661
- "medium",
1662
- "large"
1663
- ];
1664
- 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" };
1665
- const _hoisted_2$k = ["onKeypress"];
1666
- const _hoisted_3$g = { class: "cl-overflow-y-auto cl-p-2 cl-w-full" };
1667
- const __default__$2 = {
1668
- inheritAttrs: false
1669
- };
1670
- function setup$2(__props) {
1671
- const props = __props;
1672
- const visible = ref(false);
1673
- function open() {
1674
- visible.value = true;
1675
- document.addEventListener("keydown", closeOnKeyPress);
1676
- }
1677
- function close() {
1678
- if (!props.preventClose) {
1679
- visible.value = false;
1680
- document.removeEventListener("keydown", closeOnKeyPress);
1681
- }
1543
+ var clUiSlider = /* @__PURE__ */ _export_sfc(_sfc_main$m, [["__scopeId", "data-v-31c5214e"]]);
1544
+ function isInputText(type) {
1545
+ let isText = false;
1546
+ switch (type) {
1547
+ case "email":
1548
+ case "password":
1549
+ case "search":
1550
+ case "tel":
1551
+ case "text":
1552
+ case "url":
1553
+ isText = true;
1554
+ break;
1555
+ default:
1556
+ isText = false;
1557
+ break;
1682
1558
  }
1683
- function closeOnKeyPress(event) {
1684
- if (event.key === "Escape") {
1685
- close();
1686
- }
1559
+ return isText;
1560
+ }
1561
+ function isInputCalendarSupportedDate(type) {
1562
+ let isSupported = false;
1563
+ switch (type) {
1564
+ case "date":
1565
+ case "datetime":
1566
+ case "time":
1567
+ isSupported = true;
1568
+ break;
1569
+ default:
1570
+ isSupported = false;
1571
+ break;
1687
1572
  }
1688
- return (_ctx, _cache) => {
1689
- const _component_icon = resolveComponent("icon");
1690
- return openBlock(), createElementBlock(Fragment, null, [
1691
- renderSlot(_ctx.$slots, "trigger", normalizeProps(guardReactiveProps({ open }))),
1692
- (openBlock(), createBlock(Teleport, { to: "body" }, [
1693
- createVNode(Transition, { name: "fade" }, {
1694
- default: withCtx(() => [
1695
- withDirectives(createElementVNode("div", _hoisted_1$l, [
1696
- createElementVNode("div", mergeProps(_ctx.$attrs, {
1697
- 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", {
1698
- "lg:cl-w-2/12 cl-w-10/12": __props.size === "x-small",
1699
- "cl-w-6/12": __props.size === "small",
1700
- "cl-w-8/12": __props.size === "medium",
1701
- "cl-w-10/12": __props.size === "large"
1702
- }]
1703
- }), [
1704
- withDirectives(createElementVNode("div", {
1705
- class: normalizeClass(["cl-absolute cl-cursor-pointer cl-right-4 cl-top-4 cl-transition-colors cl-w-3", {
1706
- "cl-text-white hover:cl-text-off-white": __props.headerColour === "secondary" || __props.headerColour === "primary",
1707
- "cl-text-black hover:cl-text-grey-7": __props.headerColour === "white"
1708
- }]),
1709
- tabindex: 0,
1710
- onKeypress: withKeys(close, ["enter"]),
1711
- onClick: close
1712
- }, [
1713
- createVNode(_component_icon, { icon: "ph:x" })
1714
- ], 42, _hoisted_2$k), [
1715
- [vShow, !__props.preventClose]
1716
- ]),
1717
- createElementVNode("div", {
1718
- 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", {
1719
- "cl-border-b cl-border-grey-2": __props.headerColour === "white",
1720
- "cl-bg-secondary-default cl-text-white": __props.headerColour === "secondary",
1721
- "cl-bg-primary-default cl-text-white": __props.headerColour === "primary"
1722
- }])
1723
- }, [
1724
- renderSlot(_ctx.$slots, "title", normalizeProps(guardReactiveProps({ close })))
1725
- ], 2),
1726
- createElementVNode("div", _hoisted_3$g, [
1727
- renderSlot(_ctx.$slots, "default")
1728
- ]),
1729
- renderSlot(_ctx.$slots, "footer", normalizeProps(guardReactiveProps({ close })))
1730
- ], 16)
1731
- ], 512), [
1732
- [vShow, visible.value]
1733
- ])
1734
- ]),
1735
- _: 3
1736
- })
1737
- ]))
1738
- ], 64);
1739
- };
1573
+ return isSupported;
1740
1574
  }
1741
- const _sfc_main$m = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$2), {
1742
- props: {
1743
- headerColour: { default: "white" },
1744
- preventClose: { type: Boolean, default: false },
1745
- size: { default: "medium" }
1746
- },
1747
- setup: setup$2
1748
- }));
1749
- const _hoisted_1$k = { class: "cl-bg-grey-2 cl-border-b cl-border-grey-2 cl-border-t cl-flex cl-p-1" };
1750
- const _hoisted_2$j = {
1575
+ function isInputButton(type) {
1576
+ return type === "button" || type === "submit" || type === "reset";
1577
+ }
1578
+ function getInputTypeAsCalendarType(type) {
1579
+ let calendarType;
1580
+ switch (type) {
1581
+ case "datetime":
1582
+ calendarType = calendarTypes[1];
1583
+ break;
1584
+ case "time":
1585
+ calendarType = calendarTypes[2];
1586
+ break;
1587
+ case "date":
1588
+ default:
1589
+ calendarType = calendarTypes[0];
1590
+ break;
1591
+ }
1592
+ return calendarType;
1593
+ }
1594
+ var clUiInput_vue_vue_type_style_index_0_scoped_true_lang = "";
1595
+ const _hoisted_1$k = { class: "cl-align-top cl-border-none cl-inline-block cl-mb-4 cl-mr-4 cl-text-left" };
1596
+ const _hoisted_2$j = { class: "cl-flex cl-justify-between" };
1597
+ const _hoisted_3$f = { class: "cl-w-full" };
1598
+ const _hoisted_4$b = {
1751
1599
  key: 0,
1752
- class: "cl-w-1/2"
1600
+ class: "cl-block cl-left-auto cl-relative cl-text-danger-default"
1753
1601
  };
1754
- const _sfc_main$l = /* @__PURE__ */ defineComponent({
1755
- props: {
1756
- showClearButton: { type: Boolean, default: false },
1757
- text: { default: "" },
1758
- additionalText: { default: "" }
1759
- },
1760
- emits: {
1761
- "clear-object": null
1762
- },
1763
- setup(__props) {
1764
- return (_ctx, _cache) => {
1765
- const _component_icon = resolveComponent("icon");
1766
- return openBlock(), createElementBlock("div", _hoisted_1$k, [
1767
- __props.additionalText !== "" ? (openBlock(), createElementBlock("div", _hoisted_2$j, toDisplayString(__props.additionalText), 1)) : createCommentVNode("", true),
1768
- createElementVNode("div", {
1769
- class: normalizeClass({
1770
- "cl-w-1/2": __props.additionalText !== "",
1771
- "cl-w-full": __props.additionalText === ""
1772
- })
1773
- }, toDisplayString(__props.text), 3),
1774
- withDirectives(createElementVNode("div", {
1775
- class: "cl-cursor-pointer cl-float-right",
1776
- onMousedown: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("clear-object"))
1777
- }, [
1778
- createVNode(_component_icon, {
1779
- class: "cl-mt-0.5 cl-rounded-full cl-transition-colors hover:cl-text-link-default",
1780
- icon: "ph:x-circle"
1781
- })
1782
- ], 544), [
1783
- [vShow, __props.showClearButton]
1784
- ])
1785
- ]);
1786
- };
1787
- }
1788
- });
1789
- const _hoisted_1$j = {
1602
+ const _hoisted_5$8 = {
1603
+ key: 1,
1604
+ 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"
1605
+ };
1606
+ const _hoisted_6$6 = ["type", "disabled", "min", "max", "minlength", "maxlength", "step", "placeholder", "accept", "name", "autocomplete", "onBlur", "onMousewheel"];
1607
+ const _hoisted_7$6 = { class: "cl-relative" };
1608
+ const _hoisted_8$5 = {
1609
+ key: 2,
1610
+ class: "cl-h-[5.78rem] cl-pb-2 md:cl-h-20"
1611
+ };
1612
+ const _hoisted_9$5 = {
1790
1613
  key: 0,
1791
- class: "cl-w-1/2"
1614
+ 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"
1615
+ };
1616
+ const _hoisted_10$5 = {
1617
+ key: 1,
1618
+ 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"
1792
1619
  };
1793
- const _hoisted_2$i = { class: "cl-float-right cl-py-1.5" };
1794
- const _sfc_main$k = /* @__PURE__ */ defineComponent({
1620
+ const _sfc_main$l = /* @__PURE__ */ defineComponent({
1795
1621
  props: {
1796
- isCreateNewOption: { type: Boolean, default: false },
1797
- selectedIndex: { default: -1 },
1798
- text: { default: "" },
1799
- option: { default: () => null },
1800
- index: null
1622
+ inputType: { default: "text" },
1623
+ modelValue: { type: [String, Number, Boolean, Date, null], default: void 0 },
1624
+ label: { default: "" },
1625
+ isRequired: { type: Boolean, default: false },
1626
+ customValidationFunction: { type: Function, default: void 0 },
1627
+ onInputFunction: { type: Function, default: void 0 },
1628
+ min: { default: -1e11 },
1629
+ max: { default: 1e11 },
1630
+ step: { default: 1 },
1631
+ validateImmediately: { type: Boolean, default: false },
1632
+ externalErrors: { default: () => [] },
1633
+ disabled: { type: Boolean, default: false },
1634
+ requiredText: { default: "" },
1635
+ placeholderText: { default: "" },
1636
+ fileExtensions: { default: "" },
1637
+ group: { default: "" },
1638
+ showLabel: { type: Boolean, default: true },
1639
+ showArrows: { type: Boolean, default: true },
1640
+ autocomplete: { default: "off" },
1641
+ highlightWhenValid: { type: Boolean, default: false },
1642
+ messageWhenValid: { default: "" },
1643
+ inputSpecificClasses: { default: "" }
1801
1644
  },
1802
1645
  emits: {
1803
- "create-object": null,
1804
- "select-object": null,
1805
- "option-highlighted": null
1646
+ "update:modelValue": null,
1647
+ click: null,
1648
+ focus: null,
1649
+ input: null,
1650
+ validated: null
1806
1651
  },
1807
1652
  setup(__props, { emit }) {
1808
1653
  const props = __props;
1809
- const displayedText = computed(() => {
1810
- var _a, _b;
1811
- return (_b = (_a = props.option) == null ? void 0 : _a.name) != null ? _b : props.text;
1654
+ const inputElement = ref(null);
1655
+ const focused = ref(false);
1656
+ const lostFocus = ref(false);
1657
+ const showRequiredAsterisk = computed(getShowAsteriskOrRequired);
1658
+ const placeholder = computed(() => props.placeholderText.trim() !== "" ? props.placeholderText : props.label);
1659
+ const dateFlaggedAsOutOfRange = ref(false);
1660
+ const { t: t2 } = useI18n();
1661
+ const currentValue = computed({
1662
+ get: () => props.modelValue,
1663
+ set: (value) => onValueChanged(value)
1812
1664
  });
1813
- const displayedParent = computed(() => {
1814
- var _a, _b;
1815
- return (_b = (_a = props.option) == null ? void 0 : _a.parentName) != null ? _b : "";
1665
+ const currentDateValue = computed({
1666
+ get: () => props.modelValue,
1667
+ set: (value) => updateDateValue(value)
1816
1668
  });
1817
- const isHighlighted = ref(false);
1818
- function optionSelected() {
1819
- var _a;
1820
- if (props.isCreateNewOption === true) {
1821
- emit("create-object");
1822
- } else {
1823
- emit("select-object", (_a = props.option) == null ? void 0 : _a.id);
1669
+ const minAsString = computed(() => typeof props.min === "number" ? props.min.toString() : props.min);
1670
+ const maxAsString = computed(() => typeof props.max === "number" ? props.max.toString() : props.max);
1671
+ const minAsNumber = computed(() => typeof props.min === "number" ? props.min : parseFloat(props.min));
1672
+ const maxAsNumber = computed(() => typeof props.max === "number" ? props.max : parseFloat(props.max));
1673
+ const validMessage = computed(() => props.messageWhenValid.trim() !== "" ? props.messageWhenValid : "");
1674
+ const isValid = ref(true);
1675
+ const internalErrors = ref([]);
1676
+ const errors = computed(() => {
1677
+ var _a, _b, _c, _d;
1678
+ return [
1679
+ ...(_b = (_a = internalErrors.value) == null ? void 0 : _a.filter((e) => {
1680
+ var _a2;
1681
+ return ((_a2 = e == null ? void 0 : e.length) != null ? _a2 : 0) > 0;
1682
+ })) != null ? _b : [],
1683
+ ...(_d = (_c = props.externalErrors) == null ? void 0 : _c.filter((e) => {
1684
+ var _a2;
1685
+ return ((_a2 = e == null ? void 0 : e.length) != null ? _a2 : 0) > 0;
1686
+ })) != null ? _d : []
1687
+ ].join("\n");
1688
+ });
1689
+ function updateDateValue(value) {
1690
+ updateAndValidateValue(value);
1691
+ dateFlaggedAsOutOfRange.value = false;
1692
+ }
1693
+ function onValueChanged(value) {
1694
+ if (props.onInputFunction !== void 0) {
1695
+ value = props.onInputFunction(value);
1824
1696
  }
1697
+ updateAndValidateValue(value);
1825
1698
  }
1826
- function onHover(hovered) {
1827
- if (hovered === true) {
1828
- isHighlighted.value = true;
1829
- emit("option-highlighted", props.index);
1830
- } else {
1831
- if (props.index !== props.selectedIndex) {
1832
- isHighlighted.value = false;
1699
+ function updateAndValidateValue(value) {
1700
+ const defaultSuccess = {
1701
+ message: "",
1702
+ valid: true
1703
+ };
1704
+ const validationPromises = [props.customValidationFunction === null || props.customValidationFunction === void 0 ? new Promise((resolve) => {
1705
+ resolve(defaultSuccess);
1706
+ }) : new Promise((resolve) => {
1707
+ resolve(props.customValidationFunction(props.label, value));
1708
+ })];
1709
+ if (typeof value === "string" || typeof value === "number" || value instanceof Date) {
1710
+ validationPromises.push(validateMinValue(props.min, props.inputType, props.label, value));
1711
+ validationPromises.push(validateMaxValue(props.max, props.inputType, props.label, value));
1712
+ }
1713
+ if (props.isRequired) {
1714
+ validationPromises.push(validateRequired(props.label, value));
1715
+ }
1716
+ if (props.inputType === "email" && typeof value === "string") {
1717
+ validationPromises.push(validateEmail(props.label, value));
1718
+ }
1719
+ Promise.all(validationPromises).then((internalValidationResults) => {
1720
+ const messages2 = [...internalValidationResults.map((e) => e.message)];
1721
+ let invalid = internalValidationResults.some((e) => e.valid === false) || props.externalErrors.length > 0;
1722
+ if (dateFlaggedAsOutOfRange.value) {
1723
+ messages2.push(t2("input.dateOutOfRange"));
1724
+ invalid = true;
1725
+ }
1726
+ if (invalid) {
1727
+ internalErrors.value = messages2;
1728
+ emit("validated", false, value);
1729
+ } else {
1730
+ internalErrors.value = [];
1731
+ emit("validated", true, value);
1732
+ }
1733
+ isValid.value = !invalid;
1734
+ emit("update:modelValue", value);
1735
+ });
1736
+ }
1737
+ function getStyle() {
1738
+ let style = "";
1739
+ if (props.inputType === "color" && currentValue.value) {
1740
+ if (props.disabled) {
1741
+ style = `background: #999999`;
1742
+ } else {
1743
+ style = `background: ${currentValue.value};`;
1833
1744
  }
1834
1745
  }
1746
+ return style;
1835
1747
  }
1836
- function updateHighlight() {
1837
- if (props.selectedIndex === props.index) {
1838
- isHighlighted.value = true;
1839
- } else {
1840
- isHighlighted.value = false;
1748
+ function emitClickIfButton(event) {
1749
+ if (isInputButton(props.inputType)) {
1750
+ event.preventDefault();
1751
+ emit("click", event);
1752
+ } else if (props.inputType === "checkbox") {
1753
+ emit("click", event);
1841
1754
  }
1842
1755
  }
1843
- watch(() => props.selectedIndex, () => updateHighlight());
1844
- return (_ctx, _cache) => {
1845
- var _a, _b;
1846
- const _component_icon = resolveComponent("icon");
1847
- return openBlock(), createElementBlock("div", {
1848
- 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", {
1849
- "cl-bg-grey-0": isHighlighted.value === false,
1850
- "cl-bg-primary-default cl-text-white": isHighlighted.value
1851
- }]),
1852
- onMousedown: optionSelected,
1853
- onMousemove: _cache[0] || (_cache[0] = ($event) => onHover(true)),
1854
- onMouseleave: _cache[1] || (_cache[1] = ($event) => onHover(false))
1855
- }, [
1856
- __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),
1857
- createElementVNode("div", {
1858
- class: normalizeClass({
1859
- "cl-w-1/2": unref(displayedParent) !== "",
1860
- "cl-w-full": unref(displayedParent) === ""
1861
- })
1862
- }, toDisplayString(unref(displayedText)), 3),
1863
- withDirectives(createElementVNode("div", _hoisted_2$i, [
1864
- createVNode(_component_icon, {
1865
- class: "cl-bg-primary-default cl-rounded-full cl-text-white",
1866
- icon: "ph:plus-circle"
1867
- })
1868
- ], 512), [
1869
- [vShow, __props.isCreateNewOption]
1870
- ])
1871
- ], 34);
1872
- };
1873
- }
1874
- });
1875
- const _hoisted_1$i = ["onKeyup"];
1876
- const _hoisted_2$h = { class: "cl-flex" };
1877
- const _hoisted_3$f = ["placeholder"];
1878
- const _hoisted_4$d = { key: 5 };
1879
- const _sfc_main$j = /* @__PURE__ */ defineComponent({
1880
- props: {
1881
- loading: { type: Boolean, default: false },
1882
- objectType: null,
1883
- objectParentType: { default: "" },
1884
- errorMessage: { default: "" },
1885
- canCreateNewObject: { type: Boolean, default: false },
1886
- canClearSelectedObject: { type: Boolean, default: true },
1887
- currentObjectName: { default: "" },
1888
- results: { default: () => [] },
1889
- isVisible: { type: Boolean, default: false }
1890
- },
1891
- emits: {
1892
- "clear-object": null,
1893
- "create-object": null,
1894
- "select-object": null,
1895
- search: null,
1896
- "hide-dropdown": null
1897
- },
1898
- setup(__props, { emit }) {
1899
- const props = __props;
1900
- const { t: t2 } = useI18n();
1901
- const searchText = ref("");
1902
- const showAddNewOption = ref(false);
1903
- const currentSelection = ref(-1);
1904
- const firstIndexInResults = computed(() => showAddNewOption.value ? -1 : 0);
1905
- const container = ref();
1906
- const searchBox = ref();
1907
- function search(keyboardEvent) {
1908
- 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") {
1909
- emit("search", searchText.value);
1910
- currentSelection.value = -2;
1756
+ function incrementNumericValue() {
1757
+ if (inputElement.value) {
1758
+ inputElement.value.stepUp();
1759
+ inputElement.value.focus();
1760
+ onValueChanged(inputElement.value.valueAsNumber);
1761
+ const inputEvent = {
1762
+ target: inputElement.value
1763
+ };
1764
+ emit("input", inputEvent);
1911
1765
  }
1912
1766
  }
1913
- function selectObject(id) {
1914
- emit("select-object", id);
1915
- }
1916
- function createObject() {
1917
- emit("create-object", searchText.value);
1918
- hideDropdown();
1919
- }
1920
- function hideDropdown() {
1921
- emit("hide-dropdown");
1922
- }
1923
- function onKeyboardArrowDown(firstIndex) {
1924
- if (currentSelection.value < props.results.length - 1) {
1925
- if (currentSelection.value === -2 && searchText.value === "") {
1926
- currentSelection.value++;
1927
- }
1928
- currentSelection.value++;
1929
- } else {
1930
- currentSelection.value = firstIndex;
1767
+ function decrementNumericValue() {
1768
+ if (inputElement.value) {
1769
+ inputElement.value.stepDown();
1770
+ inputElement.value.focus();
1771
+ onValueChanged(inputElement.value.valueAsNumber);
1772
+ const inputEvent = {
1773
+ target: inputElement.value
1774
+ };
1775
+ emit("input", inputEvent);
1931
1776
  }
1932
- scroll();
1933
1777
  }
1934
- function onKeyboardArrowUp(firstIndex) {
1935
- if (currentSelection.value > firstIndex) {
1936
- currentSelection.value--;
1937
- } else {
1938
- currentSelection.value = props.results.length - 1;
1939
- }
1940
- scroll();
1778
+ function toggleFocus(focus) {
1779
+ focused.value = focus;
1941
1780
  }
1942
- function onKeyboardEnter() {
1943
- if (currentSelection.value >= 0 && props.results !== void 0) {
1944
- selectObject(props.results[currentSelection.value].id);
1945
- } else if (currentSelection.value === -1) {
1946
- createObject();
1947
- }
1781
+ function onLostFocus() {
1782
+ lostFocus.value = true;
1783
+ toggleFocus(false);
1948
1784
  }
1949
- function onKeyboardShiftTab(keyboardEvent) {
1950
- if (keyboardEvent.key === "Tab" && keyboardEvent.shiftKey === true) {
1951
- const selectableElements = document.getElementsByTagName("input");
1952
- let indexOfPreviouslySelectableItem = -1;
1953
- for (let i = 0; i < selectableElements.length; i++) {
1954
- if (selectableElements[i] === keyboardEvent.target) {
1955
- indexOfPreviouslySelectableItem = i - 1;
1956
- }
1957
- }
1958
- if (indexOfPreviouslySelectableItem >= 0) {
1959
- selectableElements[indexOfPreviouslySelectableItem].focus();
1960
- hideDropdown();
1961
- }
1962
- }
1785
+ function onMouseWheel(wheelEvent) {
1786
+ wheelEvent.target.blur();
1963
1787
  }
1964
- function scroll() {
1788
+ function getShowAsteriskOrRequired() {
1965
1789
  var _a;
1966
- if (props.results && props.results.length > 1) {
1967
- const heightOffset = 34;
1968
- (_a = container.value) == null ? void 0 : _a.scrollTo(0, (currentSelection.value + 1) * heightOffset - heightOffset * 2);
1969
- }
1970
- }
1971
- function updateAddNewOption() {
1972
- let finalResultMatches = false;
1973
- if (props.results !== null && props.results.length === 1) {
1974
- finalResultMatches = searchText.value.toUpperCase().trim() === props.results[0].name.toUpperCase().trim();
1790
+ let asterisk = true;
1791
+ const currentState = showRequiredAsterisk.value;
1792
+ if (focused.value) {
1793
+ asterisk = currentState;
1794
+ } else if (lostFocus.value && ((_a = currentValue.value) == null ? void 0 : _a.toString().trim()) === "") {
1795
+ asterisk = false;
1975
1796
  }
1976
- showAddNewOption.value = props.canCreateNewObject === true && props.errorMessage === "" && searchText.value.trim() !== "" && finalResultMatches === false;
1977
- }
1978
- function updateSelectedObjectIndex(index) {
1979
- currentSelection.value = index;
1797
+ return asterisk;
1980
1798
  }
1981
- function onVisibilityChanged() {
1982
- if (props.isVisible === true) {
1983
- searchText.value = "";
1984
- search();
1985
- nextTick(() => {
1986
- var _a;
1987
- return (_a = searchBox.value) == null ? void 0 : _a.focus();
1988
- });
1989
- }
1799
+ function onDateOutOfRange() {
1800
+ dateFlaggedAsOutOfRange.value = true;
1990
1801
  }
1991
- watch(() => props.results, () => updateAddNewOption());
1992
- watch(() => props.errorMessage, () => updateAddNewOption());
1993
- watch(() => props.isVisible, () => onVisibilityChanged());
1994
1802
  onMounted(() => {
1995
- var _a;
1996
- return (_a = container.value) == null ? void 0 : _a.addEventListener("keydown", onKeyboardShiftTab);
1997
- });
1998
- onUnmounted(() => {
1999
- var _a;
2000
- return (_a = container.value) == null ? void 0 : _a.removeEventListener("keydown", onKeyboardShiftTab);
1803
+ if (props.validateImmediately) {
1804
+ onValueChanged(props.modelValue);
1805
+ }
2001
1806
  });
1807
+ watch(() => props.isRequired, () => onValueChanged(props.modelValue));
1808
+ watch(() => props.externalErrors, () => updateAndValidateValue(currentValue.value));
2002
1809
  return (_ctx, _cache) => {
2003
- var _a;
2004
- const _component_cl_ui_loading_spinner = resolveComponent("cl-ui-loading-spinner");
2005
- return openBlock(), createElementBlock("div", {
2006
- ref: (_value, _refs) => {
2007
- _refs["container"] = _value;
2008
- container.value = _value;
2009
- },
2010
- class: "cl-bg-white cl-border cl-border-collapse cl-border-grey-0 cl-h-52 cl-overflow-y-auto cl-p-2 cl-text-sm",
2011
- onKeydown: [
2012
- _cache[2] || (_cache[2] = withKeys(withModifiers(($event) => onKeyboardArrowUp(unref(firstIndexInResults)), ["prevent", "stop"]), ["up"])),
2013
- _cache[3] || (_cache[3] = withKeys(withModifiers(($event) => onKeyboardArrowDown(unref(firstIndexInResults)), ["prevent", "stop"]), ["down"]))
2014
- ],
2015
- onKeyup: withKeys(withModifiers(onKeyboardEnter, ["prevent", "stop"]), ["enter"])
2016
- }, [
2017
- createElementVNode("div", _hoisted_2$h, [
2018
- withDirectives(createElementVNode("input", {
1810
+ const _component_icon = resolveComponent("icon");
1811
+ return openBlock(), createElementBlock("div", _hoisted_1$k, [
1812
+ createElementVNode("div", {
1813
+ onMouseenter: _cache[10] || (_cache[10] = ($event) => toggleFocus(true)),
1814
+ onMouseleave: _cache[11] || (_cache[11] = ($event) => toggleFocus(false))
1815
+ }, [
1816
+ createElementVNode("div", _hoisted_2$j, [
1817
+ createElementVNode("div", _hoisted_3$f, [
1818
+ 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), [
1819
+ [vShow, __props.showLabel && __props.label !== ""]
1820
+ ])
1821
+ ]),
1822
+ __props.isRequired && unref(showRequiredAsterisk) ? (openBlock(), createElementBlock("label", _hoisted_4$b, " * ")) : createCommentVNode("", true),
1823
+ __props.isRequired && !unref(showRequiredAsterisk) ? (openBlock(), createElementBlock("label", _hoisted_5$8, toDisplayString(__props.requiredText), 1)) : createCommentVNode("", true)
1824
+ ]),
1825
+ __props.inputType !== "range" && !unref(isInputCalendarSupportedDate)(__props.inputType) ? withDirectives((openBlock(), createElementBlock("input", mergeProps({
1826
+ key: 0,
2019
1827
  ref: (_value, _refs) => {
2020
- _refs["searchBox"] = _value;
2021
- searchBox.value = _value;
1828
+ _refs["inputElement"] = _value;
1829
+ inputElement.value = _value;
2022
1830
  },
2023
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => searchText.value = $event),
2024
- type: "text",
2025
- placeholder: unref(t2)("comboBox.searchHint", { object: __props.objectType }),
2026
- onKeyup: search,
2027
- onBlur: hideDropdown
2028
- }, null, 40, _hoisted_3$f), [
2029
- [vModelText, searchText.value]
1831
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(currentValue) ? currentValue.value = $event : null)
1832
+ }, _ctx.$attrs, {
1833
+ class: ["cl-block cl-border cl-duration-300 cl-h-full cl-mb-1 cl-transition cl-w-full focus:cl-outline-none", {
1834
+ "hover:!cl-border-grey-3": __props.disabled === false && !unref(isInputButton)(__props.inputType),
1835
+ "!cl-cursor-default": __props.disabled,
1836
+ "!cl-border-danger-default": !isValid.value,
1837
+ "!cl-border-primary-default": isValid.value && __props.highlightWhenValid,
1838
+ "cl-border-grey-0 focus:cl-border-blue-light": isValid.value && !unref(isInputButton)(__props.inputType),
1839
+ "!cl-p-2": __props.inputType === "checkbox" || __props.inputType === "radio",
1840
+ "cl-p-3 cl-rounded-lg": !unref(isInputButton)(__props.inputType),
1841
+ [`${__props.inputSpecificClasses}`]: __props.inputSpecificClasses !== ""
1842
+ }],
1843
+ style: getStyle(),
1844
+ type: __props.inputType,
1845
+ disabled: __props.disabled,
1846
+ min: __props.min,
1847
+ max: __props.max,
1848
+ minlength: unref(isInputText)(__props.inputType) ? __props.min : 0,
1849
+ maxlength: unref(isInputText)(__props.inputType) ? __props.max : 0,
1850
+ step: __props.step,
1851
+ placeholder: unref(placeholder),
1852
+ accept: __props.fileExtensions,
1853
+ name: __props.group,
1854
+ autocomplete: __props.autocomplete,
1855
+ onClick: _cache[1] || (_cache[1] = ($event) => emitClickIfButton($event)),
1856
+ onFocus: _cache[2] || (_cache[2] = ($event) => emit("focus")),
1857
+ onBlur: withModifiers(onLostFocus, ["self"]),
1858
+ onMousewheel: withModifiers(onMouseWheel, ["prevent"]),
1859
+ onInput: _cache[3] || (_cache[3] = ($event) => emit("input", $event))
1860
+ }), null, 16, _hoisted_6$6)), [
1861
+ [vModelDynamic, unref(currentValue)]
1862
+ ]) : createCommentVNode("", true),
1863
+ unref(isInputCalendarSupportedDate)(__props.inputType) ? (openBlock(), createBlock(unref(_sfc_main$n), mergeProps({ key: 1 }, _ctx.$attrs, {
1864
+ ref: (_value, _refs) => {
1865
+ _refs["inputElement"] = _value;
1866
+ inputElement.value = _value;
1867
+ },
1868
+ date: unref(currentDateValue),
1869
+ "onUpdate:date": _cache[4] || (_cache[4] = ($event) => isRef(currentDateValue) ? currentDateValue.value = $event : null),
1870
+ 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", {
1871
+ "hover:cl-border-grey-3": !__props.disabled,
1872
+ "!cl-border-danger-default": !isValid.value,
1873
+ "!cl-border-primary-default": isValid.value && __props.highlightWhenValid
1874
+ }],
1875
+ disabled: __props.disabled,
1876
+ type: unref(getInputTypeAsCalendarType)(__props.inputType),
1877
+ min: unref(minAsString),
1878
+ max: unref(maxAsString),
1879
+ onBlur: withModifiers(onLostFocus, ["self"]),
1880
+ onValueOutOfRange: onDateOutOfRange,
1881
+ onFocus: _cache[5] || (_cache[5] = ($event) => emit("focus"))
1882
+ }), null, 16, ["date", "class", "disabled", "type", "min", "max", "onBlur"])) : createCommentVNode("", true),
1883
+ createElementVNode("div", _hoisted_7$6, [
1884
+ __props.inputType === "number" && !__props.disabled && __props.showArrows ? (openBlock(), createElementBlock("div", {
1885
+ key: 0,
1886
+ class: normalizeClass(["cl-absolute cl-duration-300 cl-right-1 cl-transition", {
1887
+ "cl-opacity-0": !focused.value
1888
+ }]),
1889
+ style: { "bottom": "1.625rem" }
1890
+ }, [
1891
+ createVNode(_component_icon, {
1892
+ icon: "ph:caret-up-bold",
1893
+ class: "cl-bg-link-default cl-rounded-md cl-text-sm cl-text-white hover:cl-bg-link-light hover:cl-cursor-pointer",
1894
+ onClick: incrementNumericValue,
1895
+ onMousedown: _cache[6] || (_cache[6] = withModifiers(() => {
1896
+ }, ["prevent"]))
1897
+ })
1898
+ ], 2)) : createCommentVNode("", true),
1899
+ __props.inputType === "number" && !__props.disabled && __props.showArrows ? (openBlock(), createElementBlock("div", {
1900
+ key: 1,
1901
+ class: normalizeClass(["cl-absolute cl-bottom-2 cl-duration-300 cl-right-1 cl-transition", {
1902
+ "cl-opacity-0": !focused.value
1903
+ }])
1904
+ }, [
1905
+ createVNode(_component_icon, {
1906
+ icon: "ph:caret-down-bold",
1907
+ class: "cl-bg-link-default cl-rounded-md cl-text-sm cl-text-white hover:cl-bg-link-light hover:cl-cursor-pointer",
1908
+ onClick: decrementNumericValue,
1909
+ onMousedown: _cache[7] || (_cache[7] = withModifiers(() => {
1910
+ }, ["prevent"]))
1911
+ })
1912
+ ], 2)) : createCommentVNode("", true)
2030
1913
  ]),
2031
- withDirectives(createVNode(_component_cl_ui_loading_spinner, { class: "cl-absolute cl-ml-2 cl-mt-11" }, null, 512), [
2032
- [vShow, __props.loading]
2033
- ])
2034
- ]),
2035
- __props.currentObjectName !== "" ? (openBlock(), createBlock(_sfc_main$l, {
2036
- key: 0,
2037
- "show-clear-button": __props.canClearSelectedObject,
2038
- text: __props.currentObjectName,
2039
- onClearObject: _cache[1] || (_cache[1] = ($event) => _ctx.$emit("clear-object"))
2040
- }, null, 8, ["show-clear-button", "text"])) : createCommentVNode("", true),
2041
- __props.objectParentType !== "" && __props.results !== void 0 && __props.results.length > 0 && __props.errorMessage === "" ? (openBlock(), createBlock(_sfc_main$l, {
2042
- key: 1,
2043
- text: __props.objectType,
2044
- "additional-text": __props.objectParentType
2045
- }, null, 8, ["text", "additional-text"])) : createCommentVNode("", true),
2046
- __props.results !== null && ((_a = __props.results) == null ? void 0 : _a.length) === 0 && searchText.value.trim() !== "" && __props.canCreateNewObject === false && __props.errorMessage === "" ? (openBlock(), createBlock(_sfc_main$l, {
2047
- key: 2,
2048
- text: unref(t2)("comboBox.noResults", { object: __props.objectType })
2049
- }, null, 8, ["text"])) : createCommentVNode("", true),
2050
- __props.errorMessage !== "" ? (openBlock(), createBlock(_sfc_main$l, {
2051
- key: 3,
2052
- class: "!cl-bg-danger-light cl-text-danger-dark",
2053
- text: unref(t2)("comboBox.errorMessage", { error: __props.errorMessage })
2054
- }, null, 8, ["text"])) : createCommentVNode("", true),
2055
- showAddNewOption.value ? (openBlock(), createBlock(_sfc_main$k, {
2056
- key: 4,
2057
- "is-create-new-option": true,
2058
- text: unref(t2)("comboBox.addPrompt", { value: searchText.value, object: __props.objectType }),
2059
- index: -1,
2060
- "selected-index": currentSelection.value,
2061
- onCreateObject: createObject,
2062
- onOptionHighlighted: updateSelectedObjectIndex
2063
- }, null, 8, ["text", "selected-index"])) : createCommentVNode("", true),
2064
- __props.errorMessage === "" && __props.results !== null ? (openBlock(), createElementBlock("div", _hoisted_4$d, [
2065
- (openBlock(true), createElementBlock(Fragment, null, renderList(__props.results, (result, index) => {
2066
- return openBlock(), createBlock(_sfc_main$k, {
2067
- key: index,
2068
- option: result,
2069
- index,
2070
- "selected-index": currentSelection.value,
2071
- onSelectObject: selectObject,
2072
- onOptionHighlighted: updateSelectedObjectIndex
2073
- }, null, 8, ["option", "index", "selected-index"]);
2074
- }), 128))
2075
- ])) : createCommentVNode("", true)
2076
- ], 40, _hoisted_1$i);
1914
+ __props.inputType === "range" && typeof unref(currentValue) === "number" ? (openBlock(), createElementBlock("div", _hoisted_8$5, [
1915
+ createVNode(unref(clUiSlider), {
1916
+ ref: (_value, _refs) => {
1917
+ _refs["inputElement"] = _value;
1918
+ inputElement.value = _value;
1919
+ },
1920
+ value: unref(currentValue),
1921
+ "onUpdate:value": _cache[8] || (_cache[8] = ($event) => isRef(currentValue) ? currentValue.value = $event : null),
1922
+ min: unref(minAsNumber),
1923
+ max: unref(maxAsNumber),
1924
+ step: __props.step,
1925
+ disabled: __props.disabled,
1926
+ "show-numeric-input": false,
1927
+ onBlur: withModifiers(onLostFocus, ["self"]),
1928
+ onFocus: _cache[9] || (_cache[9] = ($event) => emit("focus"))
1929
+ }, null, 8, ["value", "min", "max", "step", "disabled", "onBlur"])
1930
+ ])) : createCommentVNode("", true)
1931
+ ], 32),
1932
+ isValid.value && unref(validMessage) ? (openBlock(), createElementBlock("div", _hoisted_9$5, toDisplayString(unref(validMessage)), 1)) : createCommentVNode("", true),
1933
+ !isValid.value && unref(errors).length > 0 ? (openBlock(), createElementBlock("div", _hoisted_10$5, toDisplayString(unref(errors)), 1)) : createCommentVNode("", true)
1934
+ ]);
1935
+ };
1936
+ }
1937
+ });
1938
+ var ClUiInput = /* @__PURE__ */ _export_sfc(_sfc_main$l, [["__scopeId", "data-v-3848d1cc"]]);
1939
+ const _hoisted_1$j = { 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" };
1940
+ const _hoisted_2$i = ["onKeypress"];
1941
+ const _hoisted_3$e = { class: "cl-overflow-y-auto cl-p-2 cl-w-full" };
1942
+ const __default__$2 = {
1943
+ inheritAttrs: false
1944
+ };
1945
+ function setup$2(__props) {
1946
+ const props = __props;
1947
+ const visible = ref(false);
1948
+ function open() {
1949
+ visible.value = true;
1950
+ document.addEventListener("keydown", closeOnKeyPress);
1951
+ }
1952
+ function close() {
1953
+ if (!props.preventClose) {
1954
+ visible.value = false;
1955
+ document.removeEventListener("keydown", closeOnKeyPress);
1956
+ }
1957
+ }
1958
+ function closeOnKeyPress(event) {
1959
+ if (event.key === "Escape") {
1960
+ close();
1961
+ }
1962
+ }
1963
+ return (_ctx, _cache) => {
1964
+ const _component_icon = resolveComponent("icon");
1965
+ return openBlock(), createElementBlock(Fragment, null, [
1966
+ renderSlot(_ctx.$slots, "trigger", normalizeProps(guardReactiveProps({ open }))),
1967
+ (openBlock(), createBlock(Teleport, { to: "body" }, [
1968
+ createVNode(Transition, { name: "fade" }, {
1969
+ default: withCtx(() => [
1970
+ withDirectives(createElementVNode("div", _hoisted_1$j, [
1971
+ createElementVNode("div", mergeProps(_ctx.$attrs, {
1972
+ 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", {
1973
+ "lg:cl-w-2/12 cl-w-10/12": __props.size === "x-small",
1974
+ "cl-w-6/12": __props.size === "small",
1975
+ "cl-w-8/12": __props.size === "medium",
1976
+ "cl-w-10/12": __props.size === "large"
1977
+ }]
1978
+ }), [
1979
+ withDirectives(createElementVNode("div", {
1980
+ class: normalizeClass(["cl-absolute cl-cursor-pointer cl-right-4 cl-top-4 cl-transition-colors cl-w-3", {
1981
+ "cl-text-white hover:cl-text-off-white": __props.headerColour === "secondary" || __props.headerColour === "primary",
1982
+ "cl-text-black hover:cl-text-grey-7": __props.headerColour === "white"
1983
+ }]),
1984
+ tabindex: 0,
1985
+ onKeypress: withKeys(close, ["enter"]),
1986
+ onClick: close
1987
+ }, [
1988
+ createVNode(_component_icon, { icon: "ph:x" })
1989
+ ], 42, _hoisted_2$i), [
1990
+ [vShow, !__props.preventClose]
1991
+ ]),
1992
+ createElementVNode("div", {
1993
+ 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", {
1994
+ "cl-border-b cl-border-grey-2": __props.headerColour === "white",
1995
+ "cl-bg-secondary-default cl-text-white": __props.headerColour === "secondary",
1996
+ "cl-bg-primary-default cl-text-white": __props.headerColour === "primary"
1997
+ }])
1998
+ }, [
1999
+ renderSlot(_ctx.$slots, "title", normalizeProps(guardReactiveProps({ close })))
2000
+ ], 2),
2001
+ createElementVNode("div", _hoisted_3$e, [
2002
+ renderSlot(_ctx.$slots, "default")
2003
+ ]),
2004
+ renderSlot(_ctx.$slots, "footer", normalizeProps(guardReactiveProps({ close })))
2005
+ ], 16)
2006
+ ], 512), [
2007
+ [vShow, visible.value]
2008
+ ])
2009
+ ]),
2010
+ _: 3
2011
+ })
2012
+ ]))
2013
+ ], 64);
2014
+ };
2015
+ }
2016
+ const _sfc_main$k = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$2), {
2017
+ props: {
2018
+ headerColour: { default: "white" },
2019
+ preventClose: { type: Boolean, default: false },
2020
+ size: { default: "medium" }
2021
+ },
2022
+ setup: setup$2
2023
+ }));
2024
+ const _hoisted_1$i = { class: "cl-bg-grey-2 cl-border-b cl-border-grey-2 cl-border-t cl-flex cl-p-1" };
2025
+ const _hoisted_2$h = {
2026
+ key: 0,
2027
+ class: "cl-w-1/2"
2028
+ };
2029
+ const _sfc_main$j = /* @__PURE__ */ defineComponent({
2030
+ props: {
2031
+ showClearButton: { type: Boolean, default: false },
2032
+ text: { default: "" },
2033
+ additionalText: { default: "" }
2034
+ },
2035
+ emits: {
2036
+ "clear-object": null
2037
+ },
2038
+ setup(__props) {
2039
+ return (_ctx, _cache) => {
2040
+ const _component_icon = resolveComponent("icon");
2041
+ return openBlock(), createElementBlock("div", _hoisted_1$i, [
2042
+ __props.additionalText !== "" ? (openBlock(), createElementBlock("div", _hoisted_2$h, toDisplayString(__props.additionalText), 1)) : createCommentVNode("", true),
2043
+ createElementVNode("div", {
2044
+ class: normalizeClass({
2045
+ "cl-w-1/2": __props.additionalText !== "",
2046
+ "cl-w-full": __props.additionalText === ""
2047
+ })
2048
+ }, toDisplayString(__props.text), 3),
2049
+ withDirectives(createElementVNode("div", {
2050
+ class: "cl-cursor-pointer cl-float-right",
2051
+ onMousedown: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("clear-object"))
2052
+ }, [
2053
+ createVNode(_component_icon, {
2054
+ class: "cl-mt-0.5 cl-rounded-full cl-transition-colors hover:cl-text-link-default",
2055
+ icon: "ph:x-circle"
2056
+ })
2057
+ ], 544), [
2058
+ [vShow, __props.showClearButton]
2059
+ ])
2060
+ ]);
2077
2061
  };
2078
2062
  }
2079
2063
  });
2080
- const _hoisted_1$h = { class: "cl-flex" };
2081
- const _hoisted_2$g = ["placeholder", "disabled"];
2082
- const _hoisted_3$e = { class: "cl-relative cl-right-20 cl-top-0.5" };
2083
- const _hoisted_4$c = { class: "cl-absolute cl-flex cl-float-right cl-font-semibold cl-mt-2 cl-text-danger-default cl-text-sm" };
2084
- const _hoisted_5$a = { class: "cl-mt-3" };
2085
- const _hoisted_6$8 = { class: "cl-p-2 cl-text-right cl-w-full" };
2064
+ const _hoisted_1$h = {
2065
+ key: 0,
2066
+ class: "cl-w-1/2"
2067
+ };
2068
+ const _hoisted_2$g = { class: "cl-float-right cl-py-1.5" };
2086
2069
  const _sfc_main$i = /* @__PURE__ */ defineComponent({
2087
2070
  props: {
2088
- loading: { type: Boolean, default: false },
2089
- disabled: { type: Boolean, default: false },
2090
- required: { type: Boolean, default: false },
2091
- objectType: null,
2092
- objectParentType: { default: "" },
2093
- canCreateNewObject: { type: Boolean, default: false },
2094
- canClearSelectedObject: { type: Boolean, default: true },
2095
- errorMessage: { default: "" },
2096
- objectCreatedResponse: { default: () => null },
2097
- parentObjectCreatedResponse: { default: () => null },
2098
- results: { default: () => [] },
2099
- parentResults: { default: () => [] },
2100
- currentObject: null
2071
+ isCreateNewOption: { type: Boolean, default: false },
2072
+ selectedIndex: { default: -1 },
2073
+ text: { default: "" },
2074
+ option: { default: () => null },
2075
+ index: null
2101
2076
  },
2102
2077
  emits: {
2103
- search: null,
2104
- "search-parent": null,
2105
2078
  "create-object": null,
2106
- "create-parent-object": null,
2107
- "update:current-object": null
2079
+ "select-object": null,
2080
+ "option-highlighted": null
2108
2081
  },
2109
2082
  setup(__props, { emit }) {
2110
2083
  const props = __props;
2111
- const { t: t2 } = useI18n();
2112
- const searchContainerVisible = ref(false);
2113
- const selectedItem = computed({
2114
- get: () => props.currentObject,
2115
- set: (value) => emit("update:current-object", value)
2084
+ const displayedText = computed(() => {
2085
+ var _a, _b;
2086
+ return (_b = (_a = props.option) == null ? void 0 : _a.name) != null ? _b : props.text;
2116
2087
  });
2117
- const parentItem = ref(null);
2118
- const currentText = computed(() => getDisplayName());
2119
- const objectToCreateValue = ref("");
2120
- const parentObjectToCreateValue = ref("");
2121
- const createObjectRequest = ref();
2122
- const objectToCreateValid = ref(true);
2123
- function toggleDropdown(forcedState) {
2124
- if (!props.disabled) {
2125
- if (typeof forcedState !== "undefined") {
2126
- searchContainerVisible.value = forcedState;
2127
- } else {
2128
- searchContainerVisible.value = !searchContainerVisible.value;
2129
- }
2088
+ const displayedParent = computed(() => {
2089
+ var _a, _b;
2090
+ return (_b = (_a = props.option) == null ? void 0 : _a.parentName) != null ? _b : "";
2091
+ });
2092
+ const isHighlighted = ref(false);
2093
+ function optionSelected() {
2094
+ var _a;
2095
+ if (props.isCreateNewOption === true) {
2096
+ emit("create-object");
2097
+ } else {
2098
+ emit("select-object", (_a = props.option) == null ? void 0 : _a.id);
2130
2099
  }
2131
2100
  }
2132
- function search(searchTerm) {
2133
- objectToCreateValue.value = searchTerm;
2134
- emit("search", searchTerm);
2135
- }
2136
- function searchParent(searchTerm) {
2137
- parentObjectToCreateValue.value = searchTerm;
2138
- emit("search-parent", searchTerm);
2139
- }
2140
- function clearObject() {
2141
- selectedItem.value = null;
2142
- toggleDropdown(false);
2143
- }
2144
- function selectObject(id) {
2145
- const item = getComboBoxItemById(id);
2146
- selectedItem.value = item;
2147
- toggleDropdown(false);
2148
- }
2149
- function getComboBoxItemById(id) {
2150
- let currentItem = null;
2151
- if (props.results !== null) {
2152
- for (let i = 0; i < props.results.length; i++) {
2153
- if (props.results[i].id === id) {
2154
- currentItem = props.results[i];
2155
- break;
2156
- }
2101
+ function onHover(hovered) {
2102
+ if (hovered === true) {
2103
+ isHighlighted.value = true;
2104
+ emit("option-highlighted", props.index);
2105
+ } else {
2106
+ if (props.index !== props.selectedIndex) {
2107
+ isHighlighted.value = false;
2157
2108
  }
2158
2109
  }
2159
- return currentItem;
2160
- }
2161
- function createObject() {
2162
- var _a, _b;
2163
- createObjectRequest.value = {
2164
- name: objectToCreateValue.value,
2165
- parentId: (_b = (_a = parentItem.value) == null ? void 0 : _a.id) != null ? _b : 0
2166
- };
2167
- emit("create-object", createObjectRequest.value);
2168
2110
  }
2169
- function createParentObject() {
2170
- createObjectRequest.value = {
2171
- name: parentObjectToCreateValue.value,
2172
- parentId: 0
2173
- };
2174
- emit("create-parent-object", createObjectRequest.value);
2111
+ function updateHighlight() {
2112
+ if (props.selectedIndex === props.index) {
2113
+ isHighlighted.value = true;
2114
+ } else {
2115
+ isHighlighted.value = false;
2116
+ }
2175
2117
  }
2176
- function handleObjectCreateResponse() {
2118
+ watch(() => props.selectedIndex, () => updateHighlight());
2119
+ return (_ctx, _cache) => {
2120
+ var _a, _b;
2121
+ const _component_icon = resolveComponent("icon");
2122
+ return openBlock(), createElementBlock("div", {
2123
+ 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", {
2124
+ "cl-bg-grey-0": isHighlighted.value === false,
2125
+ "cl-bg-primary-default cl-text-white": isHighlighted.value
2126
+ }]),
2127
+ onMousedown: optionSelected,
2128
+ onMousemove: _cache[0] || (_cache[0] = ($event) => onHover(true)),
2129
+ onMouseleave: _cache[1] || (_cache[1] = ($event) => onHover(false))
2130
+ }, [
2131
+ __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$h, toDisplayString(unref(displayedParent)), 1)) : createCommentVNode("", true),
2132
+ createElementVNode("div", {
2133
+ class: normalizeClass({
2134
+ "cl-w-1/2": unref(displayedParent) !== "",
2135
+ "cl-w-full": unref(displayedParent) === ""
2136
+ })
2137
+ }, toDisplayString(unref(displayedText)), 3),
2138
+ withDirectives(createElementVNode("div", _hoisted_2$g, [
2139
+ createVNode(_component_icon, {
2140
+ class: "cl-bg-primary-default cl-rounded-full cl-text-white",
2141
+ icon: "ph:plus-circle"
2142
+ })
2143
+ ], 512), [
2144
+ [vShow, __props.isCreateNewOption]
2145
+ ])
2146
+ ], 34);
2147
+ };
2148
+ }
2149
+ });
2150
+ const _hoisted_1$g = ["onKeyup"];
2151
+ const _hoisted_2$f = { class: "cl-flex" };
2152
+ const _hoisted_3$d = { key: 5 };
2153
+ const _sfc_main$h = /* @__PURE__ */ defineComponent({
2154
+ props: {
2155
+ loading: { type: Boolean, default: false },
2156
+ objectType: null,
2157
+ objectParentType: { default: "" },
2158
+ errorMessage: { default: "" },
2159
+ canCreateNewObject: { type: Boolean, default: false },
2160
+ canClearSelectedObject: { type: Boolean, default: true },
2161
+ currentObjectName: { default: "" },
2162
+ results: { default: () => [] },
2163
+ isVisible: { type: Boolean, default: false }
2164
+ },
2165
+ emits: {
2166
+ "clear-object": null,
2167
+ "create-object": null,
2168
+ "select-object": null,
2169
+ search: null,
2170
+ "hide-dropdown": null
2171
+ },
2172
+ setup(__props, { emit }) {
2173
+ const props = __props;
2174
+ const { t: t2 } = useI18n();
2175
+ const searchText = ref("");
2176
+ const showAddNewOption = ref(false);
2177
+ const currentSelection = ref(-1);
2178
+ const firstIndexInResults = computed(() => showAddNewOption.value ? -1 : 0);
2179
+ const container = ref();
2180
+ function search(keyboardEvent) {
2181
+ 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") {
2182
+ emit("search", searchText.value);
2183
+ currentSelection.value = -2;
2184
+ }
2185
+ }
2186
+ function selectObject(id) {
2187
+ emit("select-object", id);
2188
+ }
2189
+ function createObject() {
2190
+ emit("create-object", searchText.value);
2191
+ hideDropdown();
2192
+ }
2193
+ function hideDropdown() {
2194
+ emit("hide-dropdown");
2195
+ }
2196
+ function onKeyboardArrowDown(firstIndex) {
2197
+ if (currentSelection.value < props.results.length - 1) {
2198
+ if (currentSelection.value === -2 && searchText.value === "") {
2199
+ currentSelection.value++;
2200
+ }
2201
+ currentSelection.value++;
2202
+ } else {
2203
+ currentSelection.value = firstIndex;
2204
+ }
2205
+ scroll();
2206
+ }
2207
+ function onKeyboardArrowUp(firstIndex) {
2208
+ if (currentSelection.value > firstIndex) {
2209
+ currentSelection.value--;
2210
+ } else {
2211
+ currentSelection.value = props.results.length - 1;
2212
+ }
2213
+ scroll();
2214
+ }
2215
+ function onKeyboardEnter() {
2216
+ if (currentSelection.value >= 0 && props.results !== void 0) {
2217
+ selectObject(props.results[currentSelection.value].id);
2218
+ } else if (currentSelection.value === -1) {
2219
+ createObject();
2220
+ }
2221
+ }
2222
+ function onKeyboardShiftTab(keyboardEvent) {
2223
+ if (keyboardEvent.key === "Tab" && keyboardEvent.shiftKey === true) {
2224
+ const selectableElements = document.getElementsByTagName("input");
2225
+ let indexOfPreviouslySelectableItem = -1;
2226
+ for (let i = 0; i < selectableElements.length; i++) {
2227
+ if (selectableElements[i] === keyboardEvent.target) {
2228
+ indexOfPreviouslySelectableItem = i - 1;
2229
+ }
2230
+ }
2231
+ if (indexOfPreviouslySelectableItem >= 0) {
2232
+ selectableElements[indexOfPreviouslySelectableItem].focus();
2233
+ hideDropdown();
2234
+ }
2235
+ }
2236
+ }
2237
+ function scroll() {
2238
+ var _a;
2239
+ if (props.results && props.results.length > 1) {
2240
+ const heightOffset = 34;
2241
+ (_a = container.value) == null ? void 0 : _a.scrollTo(0, (currentSelection.value + 1) * heightOffset - heightOffset * 2);
2242
+ }
2243
+ }
2244
+ function updateAddNewOption() {
2245
+ let finalResultMatches = false;
2246
+ if (props.results !== null && props.results.length === 1) {
2247
+ finalResultMatches = searchText.value.toUpperCase().trim() === props.results[0].name.toUpperCase().trim();
2248
+ }
2249
+ showAddNewOption.value = props.canCreateNewObject === true && props.errorMessage === "" && searchText.value.trim() !== "" && finalResultMatches === false;
2250
+ }
2251
+ function updateSelectedObjectIndex(index) {
2252
+ currentSelection.value = index;
2253
+ }
2254
+ function onVisibilityChanged() {
2255
+ if (props.isVisible === true) {
2256
+ searchText.value = "";
2257
+ search();
2258
+ nextTick(() => {
2259
+ var _a, _b;
2260
+ return (_b = (_a = container.value) == null ? void 0 : _a.querySelector("input")) == null ? void 0 : _b.focus();
2261
+ });
2262
+ }
2263
+ }
2264
+ watch(() => props.results, () => updateAddNewOption());
2265
+ watch(() => props.errorMessage, () => updateAddNewOption());
2266
+ watch(() => props.isVisible, () => onVisibilityChanged());
2267
+ onMounted(() => {
2268
+ var _a;
2269
+ return (_a = container.value) == null ? void 0 : _a.addEventListener("keydown", onKeyboardShiftTab);
2270
+ });
2271
+ onUnmounted(() => {
2272
+ var _a;
2273
+ return (_a = container.value) == null ? void 0 : _a.removeEventListener("keydown", onKeyboardShiftTab);
2274
+ });
2275
+ return (_ctx, _cache) => {
2276
+ var _a;
2277
+ const _component_cl_ui_loading_spinner = resolveComponent("cl-ui-loading-spinner");
2278
+ return openBlock(), createElementBlock("div", {
2279
+ ref: (_value, _refs) => {
2280
+ _refs["container"] = _value;
2281
+ container.value = _value;
2282
+ },
2283
+ 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",
2284
+ onKeydown: [
2285
+ _cache[2] || (_cache[2] = withKeys(withModifiers(($event) => onKeyboardArrowUp(unref(firstIndexInResults)), ["prevent", "stop"]), ["up"])),
2286
+ _cache[3] || (_cache[3] = withKeys(withModifiers(($event) => onKeyboardArrowDown(unref(firstIndexInResults)), ["prevent", "stop"]), ["down"]))
2287
+ ],
2288
+ onKeyup: withKeys(withModifiers(onKeyboardEnter, ["prevent", "stop"]), ["enter"])
2289
+ }, [
2290
+ createElementVNode("div", _hoisted_2$f, [
2291
+ createVNode(ClUiInput, {
2292
+ modelValue: searchText.value,
2293
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => searchText.value = $event),
2294
+ class: "!cl-mr-0 cl-mb-1 cl-w-full",
2295
+ "input-type": "text",
2296
+ "placeholder-text": unref(t2)("comboBox.searchHint", { object: __props.objectType }),
2297
+ onKeyup: search,
2298
+ onBlur: hideDropdown
2299
+ }, null, 8, ["modelValue", "placeholder-text"]),
2300
+ withDirectives(createVNode(_component_cl_ui_loading_spinner, { class: "cl-absolute cl-ml-2 cl-mt-11" }, null, 512), [
2301
+ [vShow, __props.loading]
2302
+ ])
2303
+ ]),
2304
+ __props.currentObjectName !== "" ? (openBlock(), createBlock(_sfc_main$j, {
2305
+ key: 0,
2306
+ "show-clear-button": __props.canClearSelectedObject,
2307
+ text: __props.currentObjectName,
2308
+ onClearObject: _cache[1] || (_cache[1] = ($event) => _ctx.$emit("clear-object"))
2309
+ }, null, 8, ["show-clear-button", "text"])) : createCommentVNode("", true),
2310
+ __props.objectParentType !== "" && __props.results !== void 0 && __props.results.length > 0 && __props.errorMessage === "" ? (openBlock(), createBlock(_sfc_main$j, {
2311
+ key: 1,
2312
+ text: __props.objectType,
2313
+ "additional-text": __props.objectParentType
2314
+ }, null, 8, ["text", "additional-text"])) : createCommentVNode("", true),
2315
+ __props.results !== null && ((_a = __props.results) == null ? void 0 : _a.length) === 0 && searchText.value.trim() !== "" && __props.canCreateNewObject === false && __props.errorMessage === "" ? (openBlock(), createBlock(_sfc_main$j, {
2316
+ key: 2,
2317
+ text: unref(t2)("comboBox.noResults", { value: searchText.value })
2318
+ }, null, 8, ["text"])) : createCommentVNode("", true),
2319
+ __props.errorMessage !== "" ? (openBlock(), createBlock(_sfc_main$j, {
2320
+ key: 3,
2321
+ class: "!cl-bg-danger-light cl-border-danger-light cl-rounded cl-text-danger-dark",
2322
+ text: unref(t2)("comboBox.errorMessage", { error: __props.errorMessage })
2323
+ }, null, 8, ["text"])) : createCommentVNode("", true),
2324
+ showAddNewOption.value ? (openBlock(), createBlock(_sfc_main$i, {
2325
+ key: 4,
2326
+ "is-create-new-option": true,
2327
+ text: unref(t2)("comboBox.addPrompt", { value: searchText.value, object: __props.objectType }),
2328
+ index: -1,
2329
+ "selected-index": currentSelection.value,
2330
+ onCreateObject: createObject,
2331
+ onOptionHighlighted: updateSelectedObjectIndex
2332
+ }, null, 8, ["text", "selected-index"])) : createCommentVNode("", true),
2333
+ __props.errorMessage === "" && __props.results !== null ? (openBlock(), createElementBlock("div", _hoisted_3$d, [
2334
+ (openBlock(true), createElementBlock(Fragment, null, renderList(__props.results, (result, index) => {
2335
+ return openBlock(), createBlock(_sfc_main$i, {
2336
+ key: index,
2337
+ option: result,
2338
+ index,
2339
+ "selected-index": currentSelection.value,
2340
+ onSelectObject: selectObject,
2341
+ onOptionHighlighted: updateSelectedObjectIndex
2342
+ }, null, 8, ["option", "index", "selected-index"]);
2343
+ }), 128))
2344
+ ])) : createCommentVNode("", true)
2345
+ ], 40, _hoisted_1$g);
2346
+ };
2347
+ }
2348
+ });
2349
+ const _hoisted_1$f = { class: "cl-flex" };
2350
+ const _hoisted_2$e = { class: "cl-relative cl-right-20 cl-top-0.5" };
2351
+ 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" };
2352
+ const _hoisted_4$a = { class: "cl-ml-4 cl-w-11/12" };
2353
+ const _hoisted_5$7 = { class: "cl-p-2 cl-text-right cl-w-full" };
2354
+ const _sfc_main$g = /* @__PURE__ */ defineComponent({
2355
+ props: {
2356
+ loading: { type: Boolean, default: false },
2357
+ disabled: { type: Boolean, default: false },
2358
+ required: { type: Boolean, default: false },
2359
+ objectType: null,
2360
+ objectParentType: { default: "" },
2361
+ canCreateNewObject: { type: Boolean, default: false },
2362
+ canClearSelectedObject: { type: Boolean, default: true },
2363
+ errorMessage: { default: "" },
2364
+ objectCreatedResponse: { default: () => null },
2365
+ parentObjectCreatedResponse: { default: () => null },
2366
+ results: { default: () => [] },
2367
+ parentResults: { default: () => [] },
2368
+ currentObject: null
2369
+ },
2370
+ emits: {
2371
+ focus: null,
2372
+ search: null,
2373
+ "search-parent": null,
2374
+ "create-object": null,
2375
+ "create-parent-object": null,
2376
+ "update:current-object": null
2377
+ },
2378
+ setup(__props, { emit }) {
2379
+ const props = __props;
2380
+ const { t: t2 } = useI18n();
2381
+ const searchContainerVisible = ref(false);
2382
+ const selectedItem = computed({
2383
+ get: () => props.currentObject,
2384
+ set: (value) => emit("update:current-object", value)
2385
+ });
2386
+ const parentItem = ref(null);
2387
+ const currentText = computed(() => getDisplayName());
2388
+ const objectToCreateValue = ref("");
2389
+ const parentObjectToCreateValue = ref("");
2390
+ const createObjectRequest = ref();
2391
+ const objectToCreateValid = ref(true);
2392
+ function toggleDropdown(forcedState) {
2393
+ if (!props.disabled) {
2394
+ if (typeof forcedState !== "undefined") {
2395
+ searchContainerVisible.value = forcedState;
2396
+ } else {
2397
+ searchContainerVisible.value = !searchContainerVisible.value;
2398
+ }
2399
+ }
2400
+ }
2401
+ function search(searchTerm) {
2402
+ objectToCreateValue.value = searchTerm;
2403
+ emit("search", searchTerm);
2404
+ }
2405
+ function searchParent(searchTerm) {
2406
+ parentObjectToCreateValue.value = searchTerm;
2407
+ emit("search-parent", searchTerm);
2408
+ }
2409
+ function clearObject() {
2410
+ selectedItem.value = null;
2411
+ toggleDropdown(false);
2412
+ }
2413
+ function selectObject(id) {
2414
+ const item = getComboBoxItemById(id);
2415
+ selectedItem.value = item;
2416
+ toggleDropdown(false);
2417
+ }
2418
+ function getComboBoxItemById(id) {
2419
+ let currentItem = null;
2420
+ if (props.results !== null) {
2421
+ for (let i = 0; i < props.results.length; i++) {
2422
+ if (props.results[i].id === id) {
2423
+ currentItem = props.results[i];
2424
+ break;
2425
+ }
2426
+ }
2427
+ }
2428
+ return currentItem;
2429
+ }
2430
+ function createObject() {
2431
+ var _a, _b;
2432
+ createObjectRequest.value = {
2433
+ name: objectToCreateValue.value,
2434
+ parentId: (_b = (_a = parentItem.value) == null ? void 0 : _a.id) != null ? _b : 0
2435
+ };
2436
+ emit("create-object", createObjectRequest.value);
2437
+ }
2438
+ function createParentObject() {
2439
+ createObjectRequest.value = {
2440
+ name: parentObjectToCreateValue.value,
2441
+ parentId: 0
2442
+ };
2443
+ emit("create-parent-object", createObjectRequest.value);
2444
+ }
2445
+ function handleObjectCreateResponse() {
2177
2446
  var _a, _b;
2178
2447
  if ((_a = props.objectCreatedResponse) == null ? void 0 : _a.error) {
2179
2448
  showNotification({
2180
- message: t2("comboBox.noResults", { name: objectToCreateValue.value, error: props.objectCreatedResponse.error }),
2449
+ message: t2("comboBox.createFailed", { name: objectToCreateValue.value, error: props.objectCreatedResponse.error }),
2181
2450
  colour: "danger",
2182
2451
  duration: 1e4
2183
2452
  });
@@ -2197,7 +2466,7 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
2197
2466
  function handleSuccessfulObjectCreation() {
2198
2467
  var _a, _b, _c, _d, _e, _f, _g, _h, _i;
2199
2468
  showNotification({
2200
- message: t2("comboBox.noResults", { object: props.objectType, name: (_b = (_a = props.objectCreatedResponse) == null ? void 0 : _a.name) != null ? _b : "" }),
2469
+ message: t2("comboBox.createSuccessful", { object: props.objectType, name: (_b = (_a = props.objectCreatedResponse) == null ? void 0 : _a.name) != null ? _b : "" }),
2201
2470
  colour: "primary",
2202
2471
  duration: 1e4
2203
2472
  });
@@ -2241,21 +2510,22 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
2241
2510
  const _component_icon = resolveComponent("icon");
2242
2511
  const _component_cl_ui_combo_box = resolveComponent("cl-ui-combo-box", true);
2243
2512
  return openBlock(), createElementBlock("div", null, [
2244
- createElementVNode("div", _hoisted_1$h, [
2245
- withDirectives(createElementVNode("input", {
2513
+ createElementVNode("div", _hoisted_1$f, [
2514
+ createVNode(ClUiInput, {
2515
+ modelValue: unref(currentText),
2246
2516
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(currentText) ? currentText.value = $event : null),
2247
- class: normalizeClass(["!cl-bg-transparent cl-z-10", {
2517
+ class: normalizeClass(["!cl-bg-transparent !cl-mr-0 cl-mb-0 cl-rounded-r-none cl-w-full cl-z-10", {
2248
2518
  "cl-cursor-pointer": __props.disabled === false
2249
2519
  }]),
2250
- type: "text",
2251
- placeholder: unref(t2)("comboBox.emptyHintText", { object: __props.objectType }),
2252
- disabled: __props.disabled,
2253
- onFocus: _cache[1] || (_cache[1] = ($event) => toggleDropdown(true))
2254
- }, null, 42, _hoisted_2$g), [
2255
- [vModelText, unref(currentText)]
2256
- ]),
2257
- withDirectives(createElementVNode("div", _hoisted_3$e, [
2258
- createElementVNode("div", _hoisted_4$c, [
2520
+ "input-type": "text",
2521
+ "placeholder-text": unref(t2)("comboBox.emptyHintText", { object: __props.objectType }),
2522
+ onFocus: _cache[1] || (_cache[1] = ($event) => {
2523
+ toggleDropdown(true);
2524
+ _ctx.$emit("focus");
2525
+ })
2526
+ }, null, 8, ["modelValue", "class", "placeholder-text"]),
2527
+ withDirectives(createElementVNode("div", _hoisted_2$e, [
2528
+ createElementVNode("div", _hoisted_3$c, [
2259
2529
  createTextVNode(toDisplayString(unref(t2)("comboBox.required")) + " ", 1),
2260
2530
  createVNode(_component_icon, {
2261
2531
  class: "cl-ml-1 cl-mt-1",
@@ -2266,7 +2536,7 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
2266
2536
  [vShow, __props.required && __props.disabled === false && __props.currentObject === null]
2267
2537
  ]),
2268
2538
  createElementVNode("div", {
2269
- class: normalizeClass(["cl-border cl-border-grey-1 cl-float-right cl-px-1 cl-py-2.5 cl-text-grey-3 cl-transition-colors cl-w-min hover:cl-bg-primary-default hover:cl-text-white", {
2539
+ 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", {
2270
2540
  "cl-bg-off-white cl-cursor-default hover:cl-bg-off-white hover:cl-text-grey-3": __props.disabled,
2271
2541
  "cl-cursor-pointer": __props.disabled === false
2272
2542
  }]),
@@ -2278,12 +2548,12 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
2278
2548
  })
2279
2549
  ], 2)
2280
2550
  ]),
2281
- createVNode(_sfc_main$m, { size: "x-small" }, {
2551
+ createVNode(_sfc_main$k, { size: "x-small" }, {
2282
2552
  title: withCtx(() => [
2283
2553
  createTextVNode(toDisplayString(unref(t2)("comboBox.createTitle", { object: __props.objectType })), 1)
2284
2554
  ]),
2285
2555
  trigger: withCtx(({ open }) => [
2286
- withDirectives(createVNode(_sfc_main$j, {
2556
+ withDirectives(createVNode(_sfc_main$h, {
2287
2557
  "can-create-new-object": __props.canCreateNewObject,
2288
2558
  "can-clear-selected-object": __props.canClearSelectedObject,
2289
2559
  loading: __props.loading,
@@ -2303,7 +2573,7 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
2303
2573
  ])
2304
2574
  ]),
2305
2575
  footer: withCtx(({ close }) => [
2306
- createElementVNode("div", _hoisted_6$8, [
2576
+ createElementVNode("div", _hoisted_5$7, [
2307
2577
  createVNode(_sfc_main$p, {
2308
2578
  class: "cl-mr-4",
2309
2579
  colour: "primary",
@@ -2332,28 +2602,29 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
2332
2602
  ])
2333
2603
  ]),
2334
2604
  default: withCtx(() => [
2335
- __props.objectParentType ? (openBlock(), createBlock(_component_cl_ui_combo_box, {
2336
- key: 0,
2337
- "current-object": parentItem.value,
2338
- "onUpdate:current-object": _cache[4] || (_cache[4] = ($event) => parentItem.value = $event),
2339
- class: "cl-mt-3",
2340
- results: __props.parentResults,
2341
- loading: __props.loading,
2342
- "object-type": __props.objectParentType,
2343
- "object-created-response": __props.parentObjectCreatedResponse,
2344
- "can-create-new-object": __props.canCreateNewObject,
2345
- "can-clear-selected-object": __props.canClearSelectedObject,
2346
- "error-message": __props.errorMessage,
2347
- onSearch: searchParent,
2348
- onCreateObject: createParentObject
2349
- }, null, 8, ["current-object", "results", "loading", "object-type", "object-created-response", "can-create-new-object", "can-clear-selected-object", "error-message"])) : createCommentVNode("", true),
2350
- createElementVNode("label", _hoisted_5$a, toDisplayString(unref(t2)("comboBox.createProperty")), 1),
2351
- withDirectives(createElementVNode("input", {
2352
- "onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => objectToCreateValue.value = $event),
2353
- class: "cl-mb-2",
2354
- type: "text"
2355
- }, null, 512), [
2356
- [vModelText, objectToCreateValue.value]
2605
+ createElementVNode("div", _hoisted_4$a, [
2606
+ __props.objectParentType ? (openBlock(), createBlock(_component_cl_ui_combo_box, {
2607
+ key: 0,
2608
+ "current-object": parentItem.value,
2609
+ "onUpdate:current-object": _cache[4] || (_cache[4] = ($event) => parentItem.value = $event),
2610
+ class: "cl-mt-3",
2611
+ results: __props.parentResults,
2612
+ loading: __props.loading,
2613
+ "object-type": __props.objectParentType,
2614
+ "object-created-response": __props.parentObjectCreatedResponse,
2615
+ "can-create-new-object": __props.canCreateNewObject,
2616
+ "can-clear-selected-object": __props.canClearSelectedObject,
2617
+ "error-message": __props.errorMessage,
2618
+ onSearch: searchParent,
2619
+ onCreateObject: createParentObject
2620
+ }, null, 8, ["current-object", "results", "loading", "object-type", "object-created-response", "can-create-new-object", "can-clear-selected-object", "error-message"])) : createCommentVNode("", true),
2621
+ createVNode(ClUiInput, {
2622
+ modelValue: objectToCreateValue.value,
2623
+ "onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => objectToCreateValue.value = $event),
2624
+ label: unref(t2)("comboBox.createProperty"),
2625
+ class: "cl-mb-2 cl-pt-2 cl-w-full",
2626
+ "input-type": "text"
2627
+ }, null, 8, ["modelValue", "label"])
2357
2628
  ])
2358
2629
  ]),
2359
2630
  _: 1
@@ -2368,42 +2639,41 @@ function isComboBoxItem(objectToTest) {
2368
2639
  function isComboBoxCreateRequest(objectToTest) {
2369
2640
  return typeof objectToTest.name === "string";
2370
2641
  }
2371
- const _sfc_main$h = {};
2372
- const _hoisted_1$g = { class: "cl-flex cl-flex-wrap cl-left-0 cl-mt-4 cl-w-full" };
2373
- const _hoisted_2$f = {
2642
+ const _sfc_main$f = {};
2643
+ const _hoisted_1$e = { class: "cl-flex cl-flex-wrap cl-left-0 cl-mt-4 cl-w-full" };
2644
+ const _hoisted_2$d = {
2374
2645
  key: 0,
2375
2646
  class: "cl-w-full"
2376
2647
  };
2377
- const _hoisted_3$d = {
2648
+ const _hoisted_3$b = {
2378
2649
  key: 1,
2379
2650
  class: "cl-leading-10 cl-text-sm cl-w-full"
2380
2651
  };
2381
- const _hoisted_4$b = { class: "cl-float-left" };
2382
- const _hoisted_5$9 = { class: "cl-float-right" };
2652
+ const _hoisted_4$9 = { class: "cl-float-left" };
2653
+ const _hoisted_5$6 = { class: "cl-float-right" };
2383
2654
  function _sfc_render$3(_ctx, _cache) {
2384
- return openBlock(), createElementBlock("div", _hoisted_1$g, [
2385
- _ctx.$slots.default ? (openBlock(), createElementBlock("div", _hoisted_2$f, [
2655
+ return openBlock(), createElementBlock("div", _hoisted_1$e, [
2656
+ _ctx.$slots.default ? (openBlock(), createElementBlock("div", _hoisted_2$d, [
2386
2657
  renderSlot(_ctx.$slots, "default")
2387
2658
  ])) : createCommentVNode("", true),
2388
- _ctx.$slots.left || _ctx.$slots.right ? (openBlock(), createElementBlock("div", _hoisted_3$d, [
2389
- createElementVNode("span", _hoisted_4$b, [
2659
+ _ctx.$slots.left || _ctx.$slots.right ? (openBlock(), createElementBlock("div", _hoisted_3$b, [
2660
+ createElementVNode("span", _hoisted_4$9, [
2390
2661
  renderSlot(_ctx.$slots, "left")
2391
2662
  ]),
2392
- createElementVNode("span", _hoisted_5$9, [
2663
+ createElementVNode("span", _hoisted_5$6, [
2393
2664
  renderSlot(_ctx.$slots, "right")
2394
2665
  ])
2395
2666
  ])) : createCommentVNode("", true)
2396
2667
  ]);
2397
2668
  }
2398
- var clUiFooter = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["render", _sfc_render$3]]);
2399
- const _hoisted_1$f = { class: "cl-mr-2 lg:cl-hidden" };
2400
- const _hoisted_2$e = { class: "cl-mr-2 lg:cl-hidden" };
2401
- const _hoisted_3$c = ["checked"];
2402
- const _hoisted_4$a = {
2669
+ var clUiFooter = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["render", _sfc_render$3]]);
2670
+ const _hoisted_1$d = { class: "cl-mr-2 lg:cl-hidden" };
2671
+ const _hoisted_2$c = { class: "cl-mr-2 lg:cl-hidden" };
2672
+ const _hoisted_3$a = {
2403
2673
  key: 0,
2404
2674
  class: "cl-inline-block cl-whitespace-nowrap"
2405
2675
  };
2406
- const _hoisted_5$8 = {
2676
+ const _hoisted_4$8 = {
2407
2677
  key: 1,
2408
2678
  class: "cl-inline-block cl-whitespace-nowrap"
2409
2679
  };
@@ -2450,7 +2720,7 @@ function setup$1(__props, { emit }) {
2450
2720
  "cl-bg-link-lighter": unref(edited)
2451
2721
  }]
2452
2722
  }), [
2453
- createElementVNode("strong", _hoisted_1$f, toDisplayString(__props.column.caption), 1),
2723
+ createElementVNode("strong", _hoisted_1$d, toDisplayString(__props.column.caption), 1),
2454
2724
  renderSlot(_ctx.$slots, `${__props.column.name}Edit`, normalizeProps(guardReactiveProps({
2455
2725
  cellFocused,
2456
2726
  column: __props.column,
@@ -2458,13 +2728,13 @@ function setup$1(__props, { emit }) {
2458
2728
  record: currentRecord.value
2459
2729
  })))
2460
2730
  ], 16)) : (openBlock(), createElementBlock("td", normalizeProps(mergeProps({ key: 1 }, _ctx.$attrs)), [
2461
- createElementVNode("strong", _hoisted_2$e, toDisplayString(__props.column.caption), 1),
2462
- __props.column.type === "slot" ? renderSlot(_ctx.$slots, __props.column.name, normalizeProps(mergeProps({ key: 0 }, { column: __props.column, record: __props.record }))) : __props.column.type === "boolean" && __props.column.field !== void 0 ? (openBlock(), createElementBlock("input", {
2731
+ createElementVNode("strong", _hoisted_2$c, toDisplayString(__props.column.caption), 1),
2732
+ __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, {
2463
2733
  key: 1,
2464
- type: "checkbox",
2465
- checked: getBooleanValue(__props.record, __props.column.field),
2466
- disabled: ""
2467
- }, null, 8, _hoisted_3$c)) : (__props.column.type === "date" || __props.column.type === "datetime") && __props.column.field !== void 0 ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
2734
+ "input-type": "checkbox",
2735
+ "model-value": getBooleanValue(__props.record, __props.column.field),
2736
+ disabled: true
2737
+ }, null, 8, ["model-value"])) : (__props.column.type === "date" || __props.column.type === "datetime") && __props.column.field !== void 0 ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
2468
2738
  __props.column.format !== void 0 ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
2469
2739
  createTextVNode(toDisplayString(unref(d)(new Date(getStringValue(__props.record, __props.column.field)), __props.column.format)), 1)
2470
2740
  ], 64)) : __props.column.type === "date" ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
@@ -2481,12 +2751,12 @@ function setup$1(__props, { emit }) {
2481
2751
  createTextVNode(toDisplayString(getNumericValue(__props.record, __props.column.field)), 1)
2482
2752
  ], 64))
2483
2753
  ], 64)) : __props.column.field !== void 0 ? (openBlock(), createElementBlock(Fragment, { key: 4 }, [
2484
- __props.column.maxLength !== void 0 ? (openBlock(), createElementBlock("span", _hoisted_4$a, toDisplayString(getStringValue(__props.record, __props.column.field).trimToLength(__props.column.maxLength, __props.column.format !== void 0 ? __props.column.format === "ellipsis" : false)), 1)) : (openBlock(), createElementBlock("span", _hoisted_5$8, toDisplayString(getStringValue(__props.record, __props.column.field)), 1))
2754
+ __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))
2485
2755
  ], 64)) : createCommentVNode("", true)
2486
2756
  ], 16));
2487
2757
  };
2488
2758
  }
2489
- const _sfc_main$g = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$1), {
2759
+ const _sfc_main$e = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__$1), {
2490
2760
  props: {
2491
2761
  column: null,
2492
2762
  record: null,
@@ -2669,27 +2939,25 @@ function isFilterResponse(objectToTest, resultValidator) {
2669
2939
  }
2670
2940
  return objectValid;
2671
2941
  }
2672
- const _hoisted_1$e = {
2942
+ const _hoisted_1$c = {
2673
2943
  key: 0,
2674
2944
  class: "cl-border-grey-2 cl-border-r cl-capitalize cl-group cl-inline cl-relative cl-w-auto"
2675
2945
  };
2676
- const _hoisted_2$d = { class: "cl-bg-off-white cl-flex cl-h-full cl-items-center cl-justify-center cl-w-10" };
2677
- const _hoisted_3$b = { class: "cl-p-3" };
2678
- const _hoisted_4$9 = { class: "cl-px-4 cl-py-1 cl-w-full" };
2679
- const _hoisted_5$7 = ["innerHTML"];
2680
- const _hoisted_6$7 = { class: "cl-p-3" };
2681
- const _hoisted_7$7 = ["onClick"];
2682
- const _hoisted_8$6 = ["innerHTML"];
2946
+ const _hoisted_2$b = { class: "cl-bg-off-white cl-flex cl-h-full cl-items-center cl-justify-center cl-w-10" };
2947
+ const _hoisted_3$9 = { class: "cl-p-3" };
2948
+ const _hoisted_4$7 = { class: "cl-px-4 cl-py-1 cl-w-full" };
2949
+ const _hoisted_5$5 = ["innerHTML"];
2950
+ const _hoisted_6$5 = { class: "cl-p-3" };
2951
+ const _hoisted_7$5 = ["onClick"];
2952
+ const _hoisted_8$4 = ["innerHTML"];
2683
2953
  const _hoisted_9$4 = /* @__PURE__ */ createElementVNode("option", { value: void 0 }, null, -1);
2684
2954
  const _hoisted_10$4 = ["selected"];
2685
- const _hoisted_11$4 = ["selected"];
2686
- const _hoisted_12$4 = ["value"];
2687
- const _hoisted_13$4 = ["value"];
2688
- const _hoisted_14$3 = {
2955
+ const _hoisted_11$3 = ["selected"];
2956
+ const _hoisted_12$3 = {
2689
2957
  key: 1,
2690
2958
  class: "cl-flex cl-w-full"
2691
2959
  };
2692
- const _sfc_main$f = /* @__PURE__ */ defineComponent({
2960
+ const _sfc_main$d = /* @__PURE__ */ defineComponent({
2693
2961
  props: {
2694
2962
  request: null,
2695
2963
  column: null,
@@ -2724,9 +2992,18 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
2724
2992
  var _a, _b;
2725
2993
  return (_b = (_a = props.request.filters.find((f) => f.filterOnColumn === props.column.field)) == null ? void 0 : _a.filterValue) != null ? _b : "";
2726
2994
  });
2727
- const currentNumberFilter = computed(() => Number(currentFilter.value));
2728
2995
  const currentDateFilter = computed(() => currentFilter.value !== "" ? new Date(currentFilter.value) : null);
2996
+ const filterInput = ref(currentFilter.value);
2729
2997
  const decimalSeparator = computed(() => Intl.NumberFormat(locale.value).format(1.1).replace(/[0-9]+/g, ""));
2998
+ const columnInputType = computed(() => {
2999
+ let inputType = "text";
3000
+ if (props.column.slotType === "date" || props.column.type === "date") {
3001
+ inputType = "date";
3002
+ } else if (props.column.slotType === "datetime" || props.column.type === "datetime") {
3003
+ inputType = "datetime";
3004
+ }
3005
+ return inputType;
3006
+ });
2730
3007
  function getDefaultFilterOperation() {
2731
3008
  return props.column.type === "string" || props.column.slotType === "string" ? FilterOperation.CONTAINS : props.column.type === "datetime" || props.column.slotType === "datetime" ? FilterOperation.LESS_THAN : FilterOperation.EQUAL;
2732
3009
  }
@@ -2800,7 +3077,6 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
2800
3077
  return (_ctx, _cache) => {
2801
3078
  var _a, _b;
2802
3079
  const _component_icon = resolveComponent("icon");
2803
- const _component_cl_ui_calendar = resolveComponent("cl-ui-calendar");
2804
3080
  return __props.column.filterable === void 0 || __props.column.filterable === true ? (openBlock(), createElementBlock("div", {
2805
3081
  key: 0,
2806
3082
  class: normalizeClass(["cl-border-grey-2 cl-flex cl-rounded cl-w-full", {
@@ -2808,8 +3084,8 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
2808
3084
  "cl-border": __props.column.type !== "slot" || __props.column.slotType !== void 0 && __props.column.field !== void 0
2809
3085
  }])
2810
3086
  }, [
2811
- __props.column.type !== "slot" || __props.column.slotType !== void 0 && __props.column.field !== void 0 ? (openBlock(), createElementBlock("div", _hoisted_1$e, [
2812
- createElementVNode("div", _hoisted_2$d, [
3087
+ __props.column.type !== "slot" || __props.column.slotType !== void 0 && __props.column.field !== void 0 ? (openBlock(), createElementBlock("div", _hoisted_1$c, [
3088
+ createElementVNode("div", _hoisted_2$b, [
2813
3089
  createVNode(_component_icon, {
2814
3090
  icon: "ph:sliders-horizontal",
2815
3091
  size: 20
@@ -2821,15 +3097,15 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
2821
3097
  "cl--left-44": !__props.firstHalf
2822
3098
  }])
2823
3099
  }, [
2824
- createElementVNode("strong", _hoisted_3$b, toDisplayString(unref(t2)("grid.currentMethod")), 1),
2825
- createElementVNode("span", _hoisted_4$9, [
3100
+ createElementVNode("strong", _hoisted_3$9, toDisplayString(unref(t2)("grid.currentMethod")), 1),
3101
+ createElementVNode("span", _hoisted_4$7, [
2826
3102
  createTextVNode(toDisplayString((_a = unref(currentFilterMethod)) == null ? void 0 : _a.description) + " ", 1),
2827
3103
  createElementVNode("span", {
2828
3104
  class: "cl-float-right",
2829
3105
  innerHTML: (_b = unref(currentFilterMethod)) == null ? void 0 : _b.icon
2830
- }, null, 8, _hoisted_5$7)
3106
+ }, null, 8, _hoisted_5$5)
2831
3107
  ]),
2832
- createElementVNode("strong", _hoisted_6$7, toDisplayString(unref(t2)("grid.availableMethods")), 1),
3108
+ createElementVNode("strong", _hoisted_6$5, toDisplayString(unref(t2)("grid.availableMethods")), 1),
2833
3109
  (openBlock(true), createElementBlock(Fragment, null, renderList(unref(allowedFilterMethods), (filterMethod, index) => {
2834
3110
  return openBlock(), createElementBlock("span", {
2835
3111
  key: index,
@@ -2840,8 +3116,8 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
2840
3116
  createElementVNode("span", {
2841
3117
  class: "cl-float-right",
2842
3118
  innerHTML: filterMethod.icon
2843
- }, null, 8, _hoisted_8$6)
2844
- ], 8, _hoisted_7$7);
3119
+ }, null, 8, _hoisted_8$4)
3120
+ ], 8, _hoisted_7$5);
2845
3121
  }), 128))
2846
3122
  ], 2)
2847
3123
  ])) : createCommentVNode("", true),
@@ -2858,57 +3134,57 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
2858
3134
  createElementVNode("option", {
2859
3135
  value: "false",
2860
3136
  selected: unref(currentFilter) === "false"
2861
- }, toDisplayString(unref(t2)("grid.false")), 9, _hoisted_11$4)
2862
- ], 32)) : __props.column.type === "date" || __props.column.type === "datetime" || (__props.column.slotType === "date" || __props.column.slotType === "datetime") && typeof __props.column.field !== "undefined" ? (openBlock(), createBlock(_component_cl_ui_calendar, {
3137
+ }, toDisplayString(unref(t2)("grid.false")), 9, _hoisted_11$3)
3138
+ ], 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, {
2863
3139
  key: 2,
2864
- date: unref(currentDateFilter),
2865
- class: "cl-border-none cl-w-full",
2866
- type: __props.column.type,
2867
- "date-placeholder": unref(t2)("grid.selectDate"),
2868
- "date-time-placeholder": unref(t2)("grid.selectDateTime"),
2869
- "onUpdate:date": _cache[1] || (_cache[1] = ($event) => setDateFilter($event))
2870
- }, null, 8, ["date", "type", "date-placeholder", "date-time-placeholder"])) : __props.column.type === "number" || __props.column.slotType === "number" && typeof __props.column.field !== "undefined" ? (openBlock(), createElementBlock("input", {
3140
+ "model-value": unref(currentDateFilter),
3141
+ class: "!cl-border-none !cl-mb-0 !cl-mr-0 cl-w-full",
3142
+ min: "1900-01-01",
3143
+ max: "2999-12-31T23:59",
3144
+ label: __props.column.name,
3145
+ "show-label": false,
3146
+ "input-type": unref(columnInputType),
3147
+ "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => setDateFilter($event))
3148
+ }, null, 8, ["model-value", "label", "input-type"])) : __props.column.type === "number" || __props.column.slotType === "number" && typeof __props.column.field !== "undefined" ? (openBlock(), createBlock(ClUiInput, {
2871
3149
  key: 3,
2872
- value: unref(currentFilter),
2873
- class: "cl-border-none cl-w-full",
2874
- type: "text",
2875
- onKeyup: [
2876
- _cache[2] || (_cache[2] = withKeys(($event) => setFilter(null, (unref(currentNumberFilter) + 1).toString()), ["arrow-up"])),
2877
- _cache[3] || (_cache[3] = withKeys(($event) => setFilter(null, (unref(currentNumberFilter) - 1).toString()), ["arrow-down"]))
2878
- ],
2879
- onInput: _cache[4] || (_cache[4] = ($event) => unref(debounce)(setNumberFilter, [$event.target]))
2880
- }, null, 40, _hoisted_12$4)) : __props.column.type !== "slot" || __props.column.slotType === "string" && typeof __props.column.field !== "undefined" ? (openBlock(), createElementBlock("input", {
3150
+ modelValue: filterInput.value,
3151
+ "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => filterInput.value = $event),
3152
+ class: "cl-border-none cl-mb-0 cl-w-full",
3153
+ "input-type": "number",
3154
+ "show-arrows": false,
3155
+ onInput: _cache[3] || (_cache[3] = ($event) => unref(debounce)(setNumberFilter, [$event.target]))
3156
+ }, null, 8, ["modelValue"])) : __props.column.type !== "slot" || __props.column.slotType === "string" && typeof __props.column.field !== "undefined" ? (openBlock(), createBlock(ClUiInput, {
2881
3157
  key: 4,
2882
- value: unref(currentFilter),
2883
- class: "cl-border-none cl-w-full",
2884
- type: "text",
3158
+ modelValue: filterInput.value,
3159
+ "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => filterInput.value = $event),
3160
+ class: "cl-border-none cl-mb-0 cl-w-full",
3161
+ "input-type": "text",
2885
3162
  onInput: _cache[5] || (_cache[5] = ($event) => unref(debounce)(setFilter, [$event.target]))
2886
- }, null, 40, _hoisted_13$4)) : createCommentVNode("", true)
2887
- ], 2)) : (openBlock(), createElementBlock("div", _hoisted_14$3, " \xA0 "));
3163
+ }, null, 8, ["modelValue"])) : createCommentVNode("", true)
3164
+ ], 2)) : (openBlock(), createElementBlock("div", _hoisted_12$3, " \xA0 "));
2888
3165
  };
2889
3166
  }
2890
3167
  });
2891
- const _hoisted_1$d = {
3168
+ const _hoisted_1$b = {
2892
3169
  key: 0,
2893
3170
  class: "cl-flex cl-flex-wrap cl-justify-end cl-mt-4 cl-w-full"
2894
3171
  };
2895
- const _hoisted_2$c = { class: "cl-bg-off-white cl-border cl-border-grey-0 cl-flex cl-items-center cl-mb-2 cl-px-3 cl-py-2 cl-rounded cl-shadow-md cl-text-sm cl-w-full lg:cl-w-auto" };
2896
- const _hoisted_3$a = { class: "cl-text-grey-3 cl-w-max" };
2897
- const _hoisted_4$8 = ["value"];
2898
- const _hoisted_5$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" };
2899
- const _hoisted_6$6 = { class: "cl-flex cl-flex-wrap cl-mb-2 cl-text-sm cl-w-full lg:cl-p-2 md:cl-mb-0 md:cl-w-auto" };
2900
- const _hoisted_7$6 = { class: "cl-flex cl-flex-wrap cl-mb-2 cl-w-full lg:cl-mb-0 lg:cl-mr-2 lg:cl-w-auto" };
2901
- const _hoisted_8$5 = { class: "cl-text-grey-3 cl-w-full lg:cl-mr-2 lg:cl-w-auto" };
2902
- const _hoisted_9$3 = { class: "cl-flex cl-flex-wrap cl-text-sm mb:cl-flex-nowrap" };
2903
- const _hoisted_10$3 = { class: "cl-pr-2" };
2904
- const _hoisted_11$3 = ["onClick"];
2905
- const _hoisted_12$3 = { class: "cl-flex cl-flex-wrap cl-mb-2 cl-text-sm cl-w-full lg:cl-p-2 md:cl-mb-0 md:cl-w-auto" };
2906
- const _hoisted_13$3 = { class: "cl-mb-2 cl-text-grey-3 cl-w-full lg:cl-mb-0 lg:cl-mr-2 lg:cl-w-auto" };
2907
- const _hoisted_14$2 = ["onClick"];
2908
- const _hoisted_15$2 = { class: "cl-mb-2 cl-w-full lg:cl-p-2 md:cl-mb-0 md:cl-w-auto" };
2909
- const _hoisted_16$2 = { 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" };
2910
- const _hoisted_17$2 = { class: "cl-block lg:cl-inline-block" };
2911
- const _sfc_main$e = /* @__PURE__ */ defineComponent({
3172
+ 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" };
3173
+ const _hoisted_3$8 = { class: "cl-text-grey-3 cl-w-max" };
3174
+ 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" };
3175
+ 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" };
3176
+ 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" };
3177
+ const _hoisted_7$4 = { class: "cl-text-grey-3 cl-w-full lg:cl-mr-2 lg:cl-w-auto" };
3178
+ const _hoisted_8$3 = { class: "cl-flex cl-flex-wrap cl-text-sm mb:cl-flex-nowrap" };
3179
+ const _hoisted_9$3 = { class: "cl-pr-2" };
3180
+ const _hoisted_10$3 = ["onClick"];
3181
+ 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" };
3182
+ 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" };
3183
+ const _hoisted_13$1 = ["onClick"];
3184
+ const _hoisted_14$1 = { class: "cl-mb-2 cl-w-full lg:cl-p-2 md:cl-mb-0 md:cl-w-auto" };
3185
+ 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" };
3186
+ const _hoisted_16$1 = { class: "cl-block lg:cl-inline-block" };
3187
+ const _sfc_main$c = /* @__PURE__ */ defineComponent({
2912
3188
  props: {
2913
3189
  request: null,
2914
3190
  data: { default: () => null }
@@ -2927,6 +3203,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
2927
3203
  ];
2928
3204
  const { n, t: t2 } = useI18n();
2929
3205
  const { debounce } = useDebouncer();
3206
+ const currentPage = ref(props.request.pageNumber);
2930
3207
  const totalPages = computed(() => props.data !== null ? Math.ceil(props.data.totalRecords / props.request.pageSize) : 1);
2931
3208
  const pageNumbers = computed(() => {
2932
3209
  const calculatedPageNumbers = Array.from(Array(totalPages.value + 1).keys());
@@ -2956,29 +3233,35 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
2956
3233
  filterRequest.pageNumber = 1;
2957
3234
  emit("update:request", filterRequest);
2958
3235
  }
3236
+ watch(() => props.request.pageNumber, () => currentPage.value = props.request.pageNumber);
2959
3237
  return (_ctx, _cache) => {
2960
3238
  var _a;
2961
3239
  const _component_icon = resolveComponent("icon");
2962
- return __props.data && ((_a = __props.data.results) == null ? void 0 : _a.length) && __props.request ? (openBlock(), createElementBlock("div", _hoisted_1$d, [
2963
- createElementVNode("div", _hoisted_2$c, [
2964
- createElementVNode("span", _hoisted_3$a, toDisplayString(unref(t2)("grid.jumpToPage")), 1),
2965
- createElementVNode("input", {
2966
- class: "!cl-h-8 !cl-inline-block !cl-ml-2 !cl-text-sm !cl-w-max",
2967
- value: __props.request.pageNumber,
2968
- type: "number",
2969
- onInput: _cache[0] || (_cache[0] = ($event) => unref(debounce)(setPageFromInput, [$event.target]))
2970
- }, null, 40, _hoisted_4$8)
3240
+ return __props.data && ((_a = __props.data.results) == null ? void 0 : _a.length) && __props.request ? (openBlock(), createElementBlock("div", _hoisted_1$b, [
3241
+ createElementVNode("div", _hoisted_2$a, [
3242
+ createElementVNode("span", _hoisted_3$8, toDisplayString(unref(t2)("grid.jumpToPage")), 1),
3243
+ createVNode(ClUiInput, {
3244
+ modelValue: currentPage.value,
3245
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => currentPage.value = $event),
3246
+ class: "!cl-inline-block !cl-ml-2 !cl-mt-2 !cl-text-sm !cl-w-max",
3247
+ "input-type": "number",
3248
+ label: "Page",
3249
+ "show-label": false,
3250
+ min: "1",
3251
+ max: unref(totalPages),
3252
+ onInput: _cache[1] || (_cache[1] = ($event) => unref(debounce)(setPageFromInput, [$event.target]))
3253
+ }, null, 8, ["modelValue", "max"])
2971
3254
  ]),
2972
- createElementVNode("div", _hoisted_5$6, [
2973
- createElementVNode("div", _hoisted_6$6, [
2974
- createElementVNode("li", _hoisted_7$6, [
2975
- createElementVNode("span", _hoisted_8$5, toDisplayString(unref(t2)("grid.page")), 1)
3255
+ createElementVNode("div", _hoisted_4$6, [
3256
+ createElementVNode("div", _hoisted_5$4, [
3257
+ createElementVNode("li", _hoisted_6$4, [
3258
+ createElementVNode("span", _hoisted_7$4, toDisplayString(unref(t2)("grid.page")), 1)
2976
3259
  ]),
2977
- createElementVNode("ul", _hoisted_9$3, [
2978
- createElementVNode("li", _hoisted_10$3, toDisplayString(unref(n)(__props.request.pageNumber, unref(NumberFormat).INTEGER)) + " / " + toDisplayString(unref(n)(unref(totalPages), unref(NumberFormat).INTEGER)), 1),
3260
+ createElementVNode("ul", _hoisted_8$3, [
3261
+ createElementVNode("li", _hoisted_9$3, toDisplayString(unref(n)(__props.request.pageNumber, unref(NumberFormat).INTEGER)) + " / " + toDisplayString(unref(n)(unref(totalPages), unref(NumberFormat).INTEGER)), 1),
2979
3262
  withDirectives(createElementVNode("li", {
2980
3263
  class: "cl-cursor-pointer cl-mr-1 cl-mt-1 lg:cl-mr-2",
2981
- onClick: _cache[1] || (_cache[1] = ($event) => setPage(1))
3264
+ onClick: _cache[2] || (_cache[2] = ($event) => setPage(1))
2982
3265
  }, [
2983
3266
  createVNode(_component_icon, {
2984
3267
  icon: "ph:caret-double-left",
@@ -2989,7 +3272,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
2989
3272
  ]),
2990
3273
  withDirectives(createElementVNode("li", {
2991
3274
  class: "cl-cursor-pointer cl-mt-1 lg:cl-mr-2 mr-1",
2992
- onClick: _cache[2] || (_cache[2] = ($event) => setPage(__props.request.pageNumber - 1))
3275
+ onClick: _cache[3] || (_cache[3] = ($event) => setPage(__props.request.pageNumber - 1))
2993
3276
  }, [
2994
3277
  createVNode(_component_icon, {
2995
3278
  icon: "ph:caret-left",
@@ -3006,11 +3289,11 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
3006
3289
  "cl-text-grey-6": __props.request.pageNumber !== number
3007
3290
  }]),
3008
3291
  onClick: ($event) => setPage(number)
3009
- }, toDisplayString(unref(n)(number, unref(NumberFormat).INTEGER)), 11, _hoisted_11$3);
3292
+ }, toDisplayString(unref(n)(number, unref(NumberFormat).INTEGER)), 11, _hoisted_10$3);
3010
3293
  }), 128)),
3011
3294
  withDirectives(createElementVNode("li", {
3012
3295
  class: "cl-cursor-pointer cl-mr-1 cl-mt-1 lg:cl-mr-2",
3013
- onClick: _cache[3] || (_cache[3] = ($event) => setPage(__props.request.pageNumber + 1))
3296
+ onClick: _cache[4] || (_cache[4] = ($event) => setPage(__props.request.pageNumber + 1))
3014
3297
  }, [
3015
3298
  createVNode(_component_icon, {
3016
3299
  icon: "ph:caret-right",
@@ -3021,7 +3304,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
3021
3304
  ]),
3022
3305
  withDirectives(createElementVNode("li", {
3023
3306
  class: "cl-cursor-pointer cl-mr-1 cl-mt-1 lg:cl-mr-2",
3024
- onClick: _cache[4] || (_cache[4] = ($event) => setPage(unref(totalPages)))
3307
+ onClick: _cache[5] || (_cache[5] = ($event) => setPage(unref(totalPages)))
3025
3308
  }, [
3026
3309
  createVNode(_component_icon, {
3027
3310
  icon: "ph:caret-double-right",
@@ -3032,8 +3315,8 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
3032
3315
  ])
3033
3316
  ])
3034
3317
  ]),
3035
- createElementVNode("ul", _hoisted_12$3, [
3036
- createElementVNode("li", _hoisted_13$3, toDisplayString(unref(t2)("grid.pageSize")), 1),
3318
+ createElementVNode("ul", _hoisted_11$2, [
3319
+ createElementVNode("li", _hoisted_12$2, toDisplayString(unref(t2)("grid.pageSize")), 1),
3037
3320
  (openBlock(), createElementBlock(Fragment, null, renderList(pageSizes, (size, index) => {
3038
3321
  return createElementVNode("li", {
3039
3322
  key: index,
@@ -3042,31 +3325,30 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
3042
3325
  "cl-text-grey-6": __props.request.pageSize !== size
3043
3326
  }]),
3044
3327
  onClick: ($event) => setPageSize(size)
3045
- }, toDisplayString(unref(n)(size, unref(NumberFormat).INTEGER)), 11, _hoisted_14$2);
3328
+ }, toDisplayString(unref(n)(size, unref(NumberFormat).INTEGER)), 11, _hoisted_13$1);
3046
3329
  }), 64))
3047
3330
  ]),
3048
- createElementVNode("ul", _hoisted_15$2, [
3049
- createElementVNode("li", _hoisted_16$2, toDisplayString(unref(t2)("grid.totalRecords")), 1),
3050
- createElementVNode("li", _hoisted_17$2, toDisplayString(unref(n)(__props.data.totalRecords, unref(NumberFormat).INTEGER)), 1)
3331
+ createElementVNode("ul", _hoisted_14$1, [
3332
+ createElementVNode("li", _hoisted_15$1, toDisplayString(unref(t2)("grid.totalRecords")), 1),
3333
+ createElementVNode("li", _hoisted_16$1, toDisplayString(unref(n)(__props.data.totalRecords, unref(NumberFormat).INTEGER)), 1)
3051
3334
  ])
3052
3335
  ])
3053
3336
  ])) : createCommentVNode("", true);
3054
3337
  };
3055
3338
  }
3056
3339
  });
3057
- 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-40" };
3058
- const _hoisted_2$b = { 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" };
3059
- const _hoisted_3$9 = { class: "cl-mb-4 cl-text-2xl cl-text-off-white" };
3060
- const _hoisted_4$7 = { class: "cl-border-grey-3 cl-border-t cl-flex cl-flex-wrap cl-text-sm cl-w-full" };
3061
- const _hoisted_5$5 = { class: "cl-border-b cl-border-grey-2 cl-flex cl-py-2 cl-text-sm cl-w-full" };
3062
- const _hoisted_6$5 = { class: "cl-flex-1 cl-py-2" };
3063
- const _hoisted_7$5 = { class: "cl-py-2 cl-w-1/4" };
3064
- const _hoisted_8$4 = { class: "cl-py-2 cl-w-1/5" };
3340
+ const _hoisted_1$a = { class: "cl-fixed cl-flex cl-h-full cl-justify-end cl-right-0 cl-shadow-lg cl-top-0 cl-z-40" };
3341
+ 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" };
3342
+ const _hoisted_3$7 = { class: "cl-mb-4 cl-text-2xl cl-text-off-white" };
3343
+ const _hoisted_4$5 = { class: "cl-border-grey-3 cl-border-t cl-flex cl-flex-wrap cl-text-sm cl-w-full" };
3344
+ const _hoisted_5$3 = { class: "cl-border-b cl-border-grey-2 cl-flex cl-py-2 cl-text-sm cl-w-full" };
3345
+ const _hoisted_6$3 = { class: "cl-flex-1 cl-py-2" };
3346
+ const _hoisted_7$3 = { class: "cl-py-2 cl-w-1/4" };
3347
+ const _hoisted_8$2 = { class: "cl-py-2 cl-w-1/5" };
3065
3348
  const _hoisted_9$2 = { class: "cl-flex-1 cl-py-2" };
3066
3349
  const _hoisted_10$2 = { class: "cl-py-2 cl-w-1/4" };
3067
- const _hoisted_11$2 = ["checked", "onClick"];
3068
- const _hoisted_12$2 = { class: "cl-py-2 cl-text-off-white cl-w-1/5" };
3069
- const _hoisted_13$2 = { key: 1 };
3350
+ const _hoisted_11$1 = { class: "cl-py-2 cl-text-off-white cl-w-1/5" };
3351
+ const _hoisted_12$1 = { key: 1 };
3070
3352
  const __default__ = {
3071
3353
  inheritAttrs: false
3072
3354
  };
@@ -3111,20 +3393,20 @@ function setup(__props, { emit }) {
3111
3393
  (openBlock(), createBlock(Teleport, { to: "body" }, [
3112
3394
  createVNode(Transition, { name: "slide-left" }, {
3113
3395
  default: withCtx(() => [
3114
- withDirectives(createElementVNode("div", _hoisted_1$c, [
3115
- createElementVNode("div", _hoisted_2$b, [
3396
+ withDirectives(createElementVNode("div", _hoisted_1$a, [
3397
+ createElementVNode("div", _hoisted_2$9, [
3116
3398
  createVNode(_component_icon, {
3117
3399
  class: "cl-absolute cl-cursor-pointer cl-right-3 cl-text-off-white cl-top-3",
3118
3400
  icon: "ph:x",
3119
3401
  size: 16,
3120
3402
  onClick: _cache[1] || (_cache[1] = ($event) => visible.value = false)
3121
3403
  }),
3122
- createElementVNode("h3", _hoisted_3$9, toDisplayString(unref(t2)("grid.manageView")), 1),
3123
- createElementVNode("ul", _hoisted_4$7, [
3124
- createElementVNode("li", _hoisted_5$5, [
3125
- createElementVNode("strong", _hoisted_6$5, toDisplayString(unref(t2)("grid.column")), 1),
3126
- createElementVNode("strong", _hoisted_7$5, toDisplayString(unref(t2)("grid.visible")), 1),
3127
- createElementVNode("strong", _hoisted_8$4, toDisplayString(unref(t2)("grid.order")), 1)
3404
+ createElementVNode("h3", _hoisted_3$7, toDisplayString(unref(t2)("grid.manageView")), 1),
3405
+ createElementVNode("ul", _hoisted_4$5, [
3406
+ createElementVNode("li", _hoisted_5$3, [
3407
+ createElementVNode("strong", _hoisted_6$3, toDisplayString(unref(t2)("grid.column")), 1),
3408
+ createElementVNode("strong", _hoisted_7$3, toDisplayString(unref(t2)("grid.visible")), 1),
3409
+ createElementVNode("strong", _hoisted_8$2, toDisplayString(unref(t2)("grid.order")), 1)
3128
3410
  ]),
3129
3411
  (openBlock(true), createElementBlock(Fragment, null, renderList(__props.columns, (column, index) => {
3130
3412
  return openBlock(), createElementBlock("li", {
@@ -3133,13 +3415,13 @@ function setup(__props, { emit }) {
3133
3415
  }, [
3134
3416
  createElementVNode("div", _hoisted_9$2, toDisplayString(column.caption), 1),
3135
3417
  createElementVNode("div", _hoisted_10$2, [
3136
- createElementVNode("input", {
3137
- checked: column.visible === void 0 || column.visible === true,
3138
- type: "checkbox",
3418
+ createVNode(ClUiInput, {
3419
+ "model-value": column.visible === void 0 || column.visible === true,
3420
+ "input-type": "checkbox",
3139
3421
  onClick: ($event) => updateColumnVisibility($event.target, column)
3140
- }, null, 8, _hoisted_11$2)
3422
+ }, null, 8, ["model-value", "onClick"])
3141
3423
  ]),
3142
- createElementVNode("div", _hoisted_12$2, [
3424
+ createElementVNode("div", _hoisted_11$1, [
3143
3425
  column.visible === void 0 || column.visible === true ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
3144
3426
  index !== 0 ? (openBlock(), createBlock(_component_icon, {
3145
3427
  key: 0,
@@ -3153,7 +3435,7 @@ function setup(__props, { emit }) {
3153
3435
  icon: "ph:arrow-right",
3154
3436
  onClick: ($event) => changeColumnOrder(index, "up")
3155
3437
  }, null, 8, ["onClick"])) : createCommentVNode("", true)
3156
- ], 64)) : (openBlock(), createElementBlock("em", _hoisted_13$2, toDisplayString(unref(t2)("grid.hidden")), 1))
3438
+ ], 64)) : (openBlock(), createElementBlock("em", _hoisted_12$1, toDisplayString(unref(t2)("grid.hidden")), 1))
3157
3439
  ])
3158
3440
  ]);
3159
3441
  }), 128))
@@ -3169,7 +3451,7 @@ function setup(__props, { emit }) {
3169
3451
  ], 64);
3170
3452
  };
3171
3453
  }
3172
- const _sfc_main$d = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__), {
3454
+ const _sfc_main$b = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, __default__), {
3173
3455
  props: {
3174
3456
  columns: null
3175
3457
  },
@@ -3178,14 +3460,14 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues
3178
3460
  },
3179
3461
  setup
3180
3462
  }));
3181
- const _hoisted_1$b = {
3463
+ const _hoisted_1$9 = {
3182
3464
  key: 0,
3183
3465
  class: "cl-pb-2 cl-pr-2 cl-w-1/2 lg:cl-pb-0 lg:cl-w-auto"
3184
3466
  };
3185
- const _hoisted_2$a = { class: "cl-hidden cl-pr-2 lg:cl-inline-block" };
3186
- const _hoisted_3$8 = { class: "cl-pb-2 cl-pr-2 cl-w-1/2 lg:cl-pb-0 lg:cl-pr-0 lg:cl-w-auto" };
3187
- const _hoisted_4$6 = { class: "cl-pr-2 cl-w-full lg:cl-hidden md:cl-w-1/2" };
3188
- const _sfc_main$c = /* @__PURE__ */ defineComponent({
3467
+ const _hoisted_2$8 = { class: "cl-hidden cl-pr-2 lg:cl-inline-block" };
3468
+ 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" };
3469
+ const _hoisted_4$4 = { class: "cl-pr-2 cl-w-full lg:cl-hidden md:cl-w-1/2" };
3470
+ const _sfc_main$a = /* @__PURE__ */ defineComponent({
3189
3471
  props: {
3190
3472
  columns: null,
3191
3473
  editMode: { type: Boolean },
@@ -3207,7 +3489,7 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
3207
3489
  });
3208
3490
  return (_ctx, _cache) => {
3209
3491
  return openBlock(), createElementBlock(Fragment, null, [
3210
- __props.editEnabled ? (openBlock(), createElementBlock("span", _hoisted_1$b, [
3492
+ __props.editEnabled ? (openBlock(), createElementBlock("span", _hoisted_1$9, [
3211
3493
  createVNode(_sfc_main$p, {
3212
3494
  class: "cl-w-full lg:cl-w-auto",
3213
3495
  size: "small",
@@ -3224,13 +3506,13 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
3224
3506
  _: 1
3225
3507
  })
3226
3508
  ])) : createCommentVNode("", true),
3227
- createElementVNode("span", _hoisted_2$a, [
3228
- createVNode(_sfc_main$d, {
3509
+ createElementVNode("span", _hoisted_2$8, [
3510
+ createVNode(_sfc_main$b, {
3229
3511
  columns: unref(currentColumns),
3230
3512
  "onUpdate:columns": _cache[1] || (_cache[1] = ($event) => isRef(currentColumns) ? currentColumns.value = $event : null)
3231
3513
  }, null, 8, ["columns"])
3232
3514
  ]),
3233
- createElementVNode("span", _hoisted_3$8, [
3515
+ createElementVNode("span", _hoisted_3$6, [
3234
3516
  createVNode(_sfc_main$p, {
3235
3517
  class: "cl-w-full lg:cl-w-auto",
3236
3518
  size: "small",
@@ -3242,7 +3524,7 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
3242
3524
  _: 1
3243
3525
  })
3244
3526
  ]),
3245
- createElementVNode("span", _hoisted_4$6, [
3527
+ createElementVNode("span", _hoisted_4$4, [
3246
3528
  createVNode(_sfc_main$p, {
3247
3529
  class: "cl-w-full",
3248
3530
  colour: "blue",
@@ -3260,26 +3542,26 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
3260
3542
  }
3261
3543
  });
3262
3544
  var clUiGrid_vue_vue_type_style_index_0_scoped_true_lang = "";
3263
- const _hoisted_1$a = { class: "cl-hidden cl-mb-4 cl-w-full lg:cl-block lg:cl-text-right" };
3264
- const _hoisted_2$9 = ["data-loading"];
3265
- const _hoisted_3$7 = { class: "cl-absolute cl-bg-white cl-h-full cl-opacity-40 cl-w-full cl-z-20" };
3266
- const _hoisted_4$5 = { class: "cl-bg-white cl-flex cl-flex-wrap cl-sticky cl-top-0 cl-w-full lg:cl-hidden" };
3267
- const _hoisted_5$4 = { class: "cl-border-b cl-border-grey-2 cl-flex cl-flex-wrap cl-px-2 cl-py-4 cl-w-full" };
3268
- const _hoisted_6$4 = { class: "cl-mb-4 cl-text-sm cl-w-full" };
3269
- const _hoisted_7$4 = { class: "cl-flex cl-flex-wrap cl-w-full" };
3270
- const _hoisted_8$3 = { class: "cl-absolute cl-bg-white cl-h-screen cl-overflow-x-auto cl-p-4 cl-text-sm cl-w-full cl-z-10" };
3545
+ const _hoisted_1$8 = { class: "cl-hidden cl-mb-4 cl-w-full lg:cl-block lg:cl-text-right" };
3546
+ const _hoisted_2$7 = ["data-loading"];
3547
+ const _hoisted_3$5 = { class: "cl-absolute cl-bg-white cl-h-full cl-opacity-40 cl-w-full cl-z-20" };
3548
+ const _hoisted_4$3 = { class: "cl-bg-white cl-flex cl-flex-wrap cl-sticky cl-top-0 cl-w-full lg:cl-hidden" };
3549
+ 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" };
3550
+ const _hoisted_6$2 = { class: "cl-mb-4 cl-text-sm cl-w-full" };
3551
+ const _hoisted_7$2 = { class: "cl-flex cl-flex-wrap cl-w-full" };
3552
+ 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" };
3271
3553
  const _hoisted_9$1 = { class: "cl-border-b cl-border-grey-2 cl-mb-2 cl-pb-2 cl-text-right cl-w-full" };
3272
3554
  const _hoisted_10$1 = { class: "cl-grid cl-grid-cols-3" };
3273
- const _hoisted_11$1 = {
3555
+ const _hoisted_11 = {
3274
3556
  key: 1,
3275
3557
  class: "cl-ml-2"
3276
3558
  };
3277
- const _hoisted_12$1 = { class: "cl-overflow-auto cl-w-full" };
3278
- const _hoisted_13$1 = { class: "cl-min-w-full cl-table-fixed" };
3279
- const _hoisted_14$1 = { class: "cl-hidden lg:cl-table-column-group" };
3280
- const _hoisted_15$1 = { class: "cl-hidden lg:cl-table-header-group" };
3281
- const _hoisted_16$1 = ["onClick"];
3282
- const _hoisted_17$1 = { key: 1 };
3559
+ const _hoisted_12 = { class: "cl-overflow-auto cl-w-full" };
3560
+ const _hoisted_13 = { class: "cl-min-w-full cl-table-fixed" };
3561
+ const _hoisted_14 = { class: "cl-hidden lg:cl-table-column-group" };
3562
+ const _hoisted_15 = { class: "cl-hidden lg:cl-table-header-group" };
3563
+ const _hoisted_16 = ["onClick"];
3564
+ const _hoisted_17 = { key: 1 };
3283
3565
  const _hoisted_18 = { key: 0 };
3284
3566
  const _hoisted_19 = { key: 1 };
3285
3567
  const _hoisted_20 = ["colspan"];
@@ -3288,7 +3570,7 @@ const _hoisted_22 = {
3288
3570
  key: 0,
3289
3571
  class: "cl-w-full"
3290
3572
  };
3291
- const _sfc_main$b = /* @__PURE__ */ defineComponent({
3573
+ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
3292
3574
  props: {
3293
3575
  columns: null,
3294
3576
  request: null,
@@ -3404,8 +3686,8 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
3404
3686
  var _a, _b;
3405
3687
  const _component_icon = resolveComponent("icon");
3406
3688
  return openBlock(), createElementBlock(Fragment, null, [
3407
- createElementVNode("div", _hoisted_1$a, [
3408
- createVNode(_sfc_main$c, {
3689
+ createElementVNode("div", _hoisted_1$8, [
3690
+ createVNode(_sfc_main$a, {
3409
3691
  columns: unref(currentColumns),
3410
3692
  "onUpdate:columns": _cache[0] || (_cache[0] = ($event) => isRef(currentColumns) ? currentColumns.value = $event : null),
3411
3693
  "edit-mode": editMode.value,
@@ -3420,17 +3702,17 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
3420
3702
  }, [
3421
3703
  createVNode(Transition, { name: "fade" }, {
3422
3704
  default: withCtx(() => [
3423
- withDirectives(createElementVNode("div", _hoisted_3$7, null, 512), [
3705
+ withDirectives(createElementVNode("div", _hoisted_3$5, null, 512), [
3424
3706
  [vShow, __props.loading]
3425
3707
  ])
3426
3708
  ]),
3427
3709
  _: 1
3428
3710
  }),
3429
- createElementVNode("div", _hoisted_4$5, [
3430
- createElementVNode("div", _hoisted_5$4, [
3431
- createElementVNode("strong", _hoisted_6$4, toDisplayString(unref(t2)("grid.gridTools")), 1),
3432
- createElementVNode("div", _hoisted_7$4, [
3433
- createVNode(_sfc_main$c, {
3711
+ createElementVNode("div", _hoisted_4$3, [
3712
+ createElementVNode("div", _hoisted_5$2, [
3713
+ createElementVNode("strong", _hoisted_6$2, toDisplayString(unref(t2)("grid.gridTools")), 1),
3714
+ createElementVNode("div", _hoisted_7$2, [
3715
+ createVNode(_sfc_main$a, {
3434
3716
  columns: unref(currentColumns),
3435
3717
  "onUpdate:columns": _cache[2] || (_cache[2] = ($event) => isRef(currentColumns) ? currentColumns.value = $event : null),
3436
3718
  "edit-mode": editMode.value,
@@ -3444,7 +3726,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
3444
3726
  ]),
3445
3727
  createVNode(Transition, { name: "grow-down" }, {
3446
3728
  default: withCtx(() => [
3447
- withDirectives(createElementVNode("div", _hoisted_8$3, [
3729
+ withDirectives(createElementVNode("div", _hoisted_8$1, [
3448
3730
  createElementVNode("div", _hoisted_9$1, [
3449
3731
  createVNode(_component_icon, {
3450
3732
  class: "cl--mt-1 cl-inline-block cl-text-grey-5",
@@ -3466,7 +3748,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
3466
3748
  class: "cl-grid cl-grid-cols-3 cl-mb-4 cl-w-full"
3467
3749
  }, [
3468
3750
  createElementVNode("div", null, toDisplayString(column.caption), 1),
3469
- createVNode(_sfc_main$f, {
3751
+ createVNode(_sfc_main$d, {
3470
3752
  request: unref(currentRequest),
3471
3753
  "onUpdate:request": _cache[6] || (_cache[6] = ($event) => isRef(currentRequest) ? currentRequest.value = $event : null),
3472
3754
  column
@@ -3488,7 +3770,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
3488
3770
  icon: "ph:caret-up",
3489
3771
  onClick: ($event) => setSort(column.field)
3490
3772
  }, null, 8, ["onClick"]))
3491
- ], 64)) : (openBlock(), createElementBlock("div", _hoisted_11$1, " \xA0 "))
3773
+ ], 64)) : (openBlock(), createElementBlock("div", _hoisted_11, " \xA0 "))
3492
3774
  ]);
3493
3775
  }), 128))
3494
3776
  ], 512), [
@@ -3498,9 +3780,9 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
3498
3780
  _: 1
3499
3781
  })
3500
3782
  ]),
3501
- createElementVNode("div", _hoisted_12$1, [
3502
- createElementVNode("table", _hoisted_13$1, [
3503
- createElementVNode("colgroup", _hoisted_14$1, [
3783
+ createElementVNode("div", _hoisted_12, [
3784
+ createElementVNode("table", _hoisted_13, [
3785
+ createElementVNode("colgroup", _hoisted_14, [
3504
3786
  (openBlock(true), createElementBlock(Fragment, null, renderList(unref(visibleColumns), (column, index) => {
3505
3787
  return openBlock(), createElementBlock("col", {
3506
3788
  key: index,
@@ -3509,7 +3791,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
3509
3791
  }, null, 4);
3510
3792
  }), 128))
3511
3793
  ]),
3512
- createElementVNode("thead", _hoisted_15$1, [
3794
+ createElementVNode("thead", _hoisted_15, [
3513
3795
  createElementVNode("tr", null, [
3514
3796
  (openBlock(true), createElementBlock(Fragment, null, renderList(unref(visibleColumns), (column, index) => {
3515
3797
  var _a2;
@@ -3536,7 +3818,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
3536
3818
  }, null, 512), [
3537
3819
  [vShow, unref(currentRequest).sort !== null && unref(currentRequest).sort.sortOnColumn === column.field && unref(currentRequest).sort.sortByAscending === false]
3538
3820
  ])
3539
- ], 8, _hoisted_16$1)) : (openBlock(), createElementBlock("span", _hoisted_17$1, toDisplayString(column.caption), 1))
3821
+ ], 8, _hoisted_16)) : (openBlock(), createElementBlock("span", _hoisted_17, toDisplayString(column.caption), 1))
3540
3822
  ], 4);
3541
3823
  }), 128))
3542
3824
  ]),
@@ -3547,7 +3829,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
3547
3829
  class: "cl-p-1",
3548
3830
  style: normalizeStyle(getStyleForColumn(column.name))
3549
3831
  }, [
3550
- createVNode(_sfc_main$f, {
3832
+ createVNode(_sfc_main$d, {
3551
3833
  request: unref(currentRequest),
3552
3834
  "onUpdate:request": _cache[7] || (_cache[7] = ($event) => isRef(currentRequest) ? currentRequest.value = $event : null),
3553
3835
  column,
@@ -3567,7 +3849,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
3567
3849
  })
3568
3850
  }, [
3569
3851
  (openBlock(true), createElementBlock(Fragment, null, renderList(unref(visibleColumns), (column, columnIndex) => {
3570
- return openBlock(), createBlock(_sfc_main$g, {
3852
+ return openBlock(), createBlock(_sfc_main$e, {
3571
3853
  key: columnIndex,
3572
3854
  class: "cl-align-top cl-p-2 cl-rounded cl-whitespace-nowrap",
3573
3855
  style: normalizeStyle(getStyleForColumn(column.name)),
@@ -3616,559 +3898,96 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
3616
3898
  ])
3617
3899
  ])
3618
3900
  ]),
3619
- createVNode(_sfc_main$e, {
3620
- request: unref(currentRequest),
3621
- "onUpdate:request": _cache[8] || (_cache[8] = ($event) => isRef(currentRequest) ? currentRequest.value = $event : null),
3622
- data: __props.data
3623
- }, null, 8, ["request", "data"])
3624
- ], 8, _hoisted_2$9)
3625
- ], 64);
3626
- };
3627
- }
3628
- });
3629
- var clUiGrid = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["__scopeId", "data-v-435e22be"]]);
3630
- const _sfc_main$a = {};
3631
- 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" };
3632
- const _hoisted_2$8 = { class: "cl-flex cl-flex-nowrap" };
3633
- function _sfc_render$2(_ctx, _cache) {
3634
- return openBlock(), createElementBlock("header", _hoisted_1$9, [
3635
- renderSlot(_ctx.$slots, "logo"),
3636
- createElementVNode("div", _hoisted_2$8, [
3637
- renderSlot(_ctx.$slots, "menu"),
3638
- renderSlot(_ctx.$slots, "icon")
3639
- ])
3640
- ]);
3641
- }
3642
- var clUiHeader = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["render", _sfc_render$2]]);
3643
- const _hoisted_1$8 = { class: "md:cl-relative" };
3644
- const _hoisted_2$7 = { class: "cl-bg-blue-light cl-flex cl-items-center cl-select-none md:cl-min-w-[320px]" };
3645
- const _hoisted_3$6 = ["src"];
3646
- const _hoisted_4$4 = { class: "cl-cursor-default cl-flex-grow cl-hidden cl-my-4 cl-text-white md:cl-block" };
3647
- const _hoisted_5$3 = {
3648
- key: 0,
3649
- class: "cl-cursor-default cl-overflow-ellipsis cl-whitespace-nowrap"
3650
- };
3651
- const _hoisted_6$3 = {
3652
- key: 1,
3653
- class: "cl-cursor-default cl-overflow-ellipsis cl-text-xs cl-whitespace-nowrap"
3654
- };
3655
- const _hoisted_7$3 = { class: "cl-absolute cl-bg-white cl-right-0 cl-shadow-2xl cl-top-20 cl-w-full cl-z-20" };
3656
- const _sfc_main$9 = /* @__PURE__ */ defineComponent({
3657
- props: {
3658
- username: { default: "" },
3659
- group: { default: "" },
3660
- image: { default: "" }
3661
- },
3662
- setup(__props) {
3663
- const isOpen = ref(false);
3664
- return (_ctx, _cache) => {
3665
- const _component_icon = resolveComponent("icon");
3666
- return openBlock(), createElementBlock("div", _hoisted_1$8, [
3667
- createElementVNode("div", _hoisted_2$7, [
3668
- __props.image ? (openBlock(), createElementBlock("img", {
3669
- key: 0,
3670
- src: __props.image,
3671
- 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"
3672
- }, null, 8, _hoisted_3$6)) : (openBlock(), createBlock(_component_icon, {
3673
- key: 1,
3674
- class: "cl-hidden cl-m-4 cl-text-white md:cl-block",
3675
- icon: "ph:user-circle",
3676
- width: "48",
3677
- height: "48"
3678
- })),
3679
- createElementVNode("div", _hoisted_4$4, [
3680
- __props.username ? (openBlock(), createElementBlock("div", _hoisted_5$3, toDisplayString(__props.username), 1)) : createCommentVNode("", true),
3681
- __props.group ? (openBlock(), createElementBlock("div", _hoisted_6$3, toDisplayString(__props.group), 1)) : createCommentVNode("", true)
3682
- ]),
3683
- createElementVNode("div", {
3684
- 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",
3685
- onClick: _cache[0] || (_cache[0] = ($event) => isOpen.value = !isOpen.value)
3686
- }, [
3687
- createVNode(_component_icon, {
3688
- class: normalizeClass(["cl-text-white cl-transform-gpu cl-transition-transform", {
3689
- "cl-rotate-180": isOpen.value
3690
- }]),
3691
- icon: "ph:caret-down"
3692
- }, null, 8, ["class"])
3693
- ])
3694
- ]),
3695
- createVNode(Transition, { name: "fade" }, {
3696
- default: withCtx(() => [
3697
- withDirectives(createElementVNode("div", _hoisted_7$3, [
3698
- renderSlot(_ctx.$slots, "default")
3699
- ], 512), [
3700
- [vShow, isOpen.value]
3701
- ])
3702
- ]),
3703
- _: 3
3704
- })
3705
- ]);
3706
- };
3707
- }
3708
- });
3709
- var clUiSlider_vue_vue_type_style_index_0_scoped_true_lang = "";
3710
- const _hoisted_1$7 = { class: "cl-flex cl-flex-wrap cl-items-center" };
3711
- const _hoisted_2$6 = ["value", "min", "max", "step", "disabled"];
3712
- const _hoisted_3$5 = { class: "cl-flex cl-flex-1 cl-flex-wrap cl-items-center cl-mb-2 cl-mt-3 cl-relative md:cl-mt-0" };
3713
- const _hoisted_4$3 = { 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" };
3714
- const _hoisted_5$2 = { key: 0 };
3715
- const _hoisted_6$2 = ["min", "max", "step", "disabled"];
3716
- const _hoisted_7$2 = { 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" };
3717
- const _hoisted_8$2 = {
3718
- key: 1,
3719
- class: "emphasis-danger text-sm w-full"
3720
- };
3721
- const _sfc_main$8 = /* @__PURE__ */ defineComponent({
3722
- props: {
3723
- value: null,
3724
- min: null,
3725
- max: null,
3726
- step: { default: 1 },
3727
- enforceStep: { type: Boolean, default: false },
3728
- disabled: { type: Boolean, default: false },
3729
- showNumericInput: { type: Boolean, default: true }
3730
- },
3731
- emits: {
3732
- "update:value": null
3733
- },
3734
- setup(__props, { emit }) {
3735
- const props = __props;
3736
- const { n, t: t2 } = useI18n();
3737
- const { debounce } = useDebouncer();
3738
- const currentValue = computed({
3739
- get: () => props.value,
3740
- set: (value) => emit("update:value", value)
3741
- });
3742
- const colour = computed(() => props.disabled ? "rgba(153, 153, 153, 0.8)" : "#9acd32");
3743
- const percentage = computed(() => {
3744
- let value = (currentValue.value - props.min) / (props.max - props.min) * 100;
3745
- if (value < 35 && value > 0) {
3746
- if (value < 20) {
3747
- value += 0.5;
3748
- } else {
3749
- value += 0.25;
3750
- }
3751
- } else if (value > 65 && value < 100) {
3752
- if (value > 80) {
3753
- value -= 0.5;
3754
- } else {
3755
- value -= 0.25;
3756
- }
3757
- }
3758
- return value;
3759
- });
3760
- const validProps = computed(() => props.min <= props.max && props.step > 0);
3761
- function updateCurrentValue(target, forceUpdate) {
3762
- var _a;
3763
- const inputValue = (_a = target == null ? void 0 : target.value) != null ? _a : "";
3764
- const value = Math.max(Math.min(parseFloat(inputValue) || props.min, props.max), props.min);
3765
- currentValue.value = props.enforceStep ? Math.ceil(value / props.step) * props.step : value;
3766
- nextTick(() => forceUpdate());
3767
- }
3768
- return (_ctx, _cache) => {
3769
- return unref(validProps) ? (openBlock(), createElementBlock("div", normalizeProps(mergeProps({ key: 0 }, _ctx.$attrs)), [
3770
- withDirectives(createElementVNode("div", { class: "cl-bg-transparent cl-relative cl-text-center cl-text-sm" }, toDisplayString(unref(currentValue)), 513), [
3771
- [vShow, !__props.showNumericInput]
3772
- ]),
3773
- createElementVNode("div", _hoisted_1$7, [
3774
- withDirectives(createElementVNode("input", {
3775
- class: "!cl-text-sm md:!cl-h-8 md:!cl-w-auto",
3776
- type: "number",
3777
- value: unref(currentValue),
3778
- min: __props.min,
3779
- max: __props.max,
3780
- step: __props.step,
3781
- disabled: __props.disabled,
3782
- onInput: _cache[0] || (_cache[0] = ($event) => unref(debounce)(updateCurrentValue, [$event.target, _ctx.$forceUpdate]))
3783
- }, null, 40, _hoisted_2$6), [
3784
- [vShow, __props.showNumericInput]
3785
- ]),
3786
- createElementVNode("div", _hoisted_3$5, [
3787
- createElementVNode("span", _hoisted_4$3, toDisplayString(unref(n)(__props.min, Number.isInteger(__props.min) ? unref(NumberFormat).INTEGER : unref(NumberFormat).DECIMAL)), 1),
3788
- typeof unref(currentValue) === "number" ? (openBlock(), createElementBlock("div", _hoisted_5$2, [
3789
- withDirectives(createElementVNode("input", {
3790
- "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => isRef(currentValue) ? currentValue.value = $event : null),
3791
- 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",
3792
- style: normalizeStyle({
3793
- background: `linear-gradient(to right, ${unref(colour)} 0%, ${unref(colour)} ${unref(percentage)}%, white ${unref(percentage)}%, white 100%)`
3794
- }),
3795
- type: "range",
3796
- min: __props.min,
3797
- max: __props.max,
3798
- step: __props.step,
3799
- disabled: __props.disabled
3800
- }, null, 12, _hoisted_6$2), [
3801
- [
3802
- vModelText,
3803
- unref(currentValue),
3804
- void 0,
3805
- { number: true }
3806
- ]
3807
- ])
3808
- ])) : createCommentVNode("", true),
3809
- createElementVNode("span", _hoisted_7$2, toDisplayString(unref(n)(__props.max, Number.isInteger(__props.max) ? unref(NumberFormat).INTEGER : unref(NumberFormat).DECIMAL)), 1)
3810
- ])
3811
- ])
3812
- ], 16)) : (openBlock(), createElementBlock("div", _hoisted_8$2, toDisplayString(unref(t2)("slider.invalidProps")), 1));
3813
- };
3814
- }
3815
- });
3816
- var clUiSlider = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["__scopeId", "data-v-3cc89ae4"]]);
3817
- function isInputText(type) {
3818
- let isText = false;
3819
- switch (type) {
3820
- case "email":
3821
- case "password":
3822
- case "search":
3823
- case "tel":
3824
- case "text":
3825
- case "url":
3826
- isText = true;
3827
- break;
3828
- default:
3829
- isText = false;
3830
- break;
3831
- }
3832
- return isText;
3833
- }
3834
- function isInputCalendarSupportedDate(type) {
3835
- let isSupported = false;
3836
- switch (type) {
3837
- case "date":
3838
- case "datetime":
3839
- case "time":
3840
- isSupported = true;
3841
- break;
3842
- default:
3843
- isSupported = false;
3844
- break;
3845
- }
3846
- return isSupported;
3847
- }
3848
- function isInputButton(type) {
3849
- return type === "button" || type === "submit" || type === "reset";
3850
- }
3851
- function getInputTypeAsCalendarType(type) {
3852
- let calendarType;
3853
- switch (type) {
3854
- case "datetime":
3855
- calendarType = calendarTypes[1];
3856
- break;
3857
- case "time":
3858
- calendarType = calendarTypes[2];
3859
- break;
3860
- case "date":
3861
- default:
3862
- calendarType = calendarTypes[0];
3863
- break;
3901
+ createVNode(_sfc_main$c, {
3902
+ request: unref(currentRequest),
3903
+ "onUpdate:request": _cache[8] || (_cache[8] = ($event) => isRef(currentRequest) ? currentRequest.value = $event : null),
3904
+ data: __props.data
3905
+ }, null, 8, ["request", "data"])
3906
+ ], 8, _hoisted_2$7)
3907
+ ], 64);
3908
+ };
3864
3909
  }
3865
- return calendarType;
3910
+ });
3911
+ var clUiGrid = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["__scopeId", "data-v-4e7c7908"]]);
3912
+ const _sfc_main$8 = {};
3913
+ const _hoisted_1$7 = { 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" };
3914
+ const _hoisted_2$6 = { class: "cl-flex cl-flex-nowrap" };
3915
+ function _sfc_render$2(_ctx, _cache) {
3916
+ return openBlock(), createElementBlock("header", _hoisted_1$7, [
3917
+ renderSlot(_ctx.$slots, "logo"),
3918
+ createElementVNode("div", _hoisted_2$6, [
3919
+ renderSlot(_ctx.$slots, "menu"),
3920
+ renderSlot(_ctx.$slots, "icon")
3921
+ ])
3922
+ ]);
3866
3923
  }
3867
- var clUiInput_vue_vue_type_style_index_0_scoped_true_lang = "";
3868
- const _hoisted_1$6 = { class: "cl-align-top cl-inline-block cl-mb-4 cl-mr-4 cl-text-left" };
3869
- const _hoisted_2$5 = { class: "cl-flex cl-justify-between" };
3870
- const _hoisted_3$4 = { class: "cl-text-gray-400 cl-text-xs cl-tracking-widest cl-uppercase cl-w:70%" };
3871
- const _hoisted_4$2 = {
3924
+ var clUiHeader = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["render", _sfc_render$2]]);
3925
+ const _hoisted_1$6 = { class: "md:cl-relative" };
3926
+ const _hoisted_2$5 = { class: "cl-bg-blue-light cl-flex cl-items-center cl-select-none md:cl-min-w-[320px]" };
3927
+ const _hoisted_3$4 = ["src"];
3928
+ const _hoisted_4$2 = { class: "cl-cursor-default cl-flex-grow cl-hidden cl-my-4 cl-text-white md:cl-block" };
3929
+ const _hoisted_5$1 = {
3872
3930
  key: 0,
3873
- class: "cl-left-auto cl-relative cl-text-danger-default"
3931
+ class: "cl-cursor-default cl-overflow-ellipsis cl-whitespace-nowrap"
3874
3932
  };
3875
- const _hoisted_5$1 = {
3933
+ const _hoisted_6$1 = {
3876
3934
  key: 1,
3877
- class: "cl-bg-danger-light cl-block cl-max-h-6 cl-ml-2 cl-px-2 cl-rounded-md cl-text-center cl-text-danger-default cl-text-xs cl-uppercase"
3878
- };
3879
- const _hoisted_6$1 = ["type", "disabled", "min", "max", "minlength", "maxlength", "step", "placeholder", "accept", "name", "onBlur"];
3880
- const _hoisted_7$1 = {
3881
- key: 4,
3882
- class: "cl-pb-2"
3883
- };
3884
- const _hoisted_8$1 = {
3885
- key: 0,
3886
- 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"
3935
+ class: "cl-cursor-default cl-overflow-ellipsis cl-text-xs cl-whitespace-nowrap"
3887
3936
  };
3937
+ 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" };
3888
3938
  const _sfc_main$7 = /* @__PURE__ */ defineComponent({
3889
3939
  props: {
3890
- inputType: { default: "text" },
3891
- modelValue: { type: [String, Number, Boolean, Date], default: void 0 },
3892
- label: { default: "" },
3893
- isRequired: { type: Boolean, default: false },
3894
- customValidationFunction: { type: Function, default: void 0 },
3895
- onInputFunction: { type: Function, default: void 0 },
3896
- min: { default: 0 },
3897
- max: { default: 512 },
3898
- step: { default: 1 },
3899
- validateImmediately: { type: Boolean, default: false },
3900
- externalErrors: { default: () => [] },
3901
- disabled: { type: Boolean, default: false },
3902
- requiredText: { default: "" },
3903
- placeholderText: { default: "" },
3904
- fileExtensions: { default: "" },
3905
- group: { default: "" }
3906
- },
3907
- emits: {
3908
- "update:modelValue": null,
3909
- click: null,
3910
- validated: null
3940
+ username: { default: "" },
3941
+ group: { default: "" },
3942
+ image: { default: "" }
3911
3943
  },
3912
- setup(__props, { emit }) {
3913
- const props = __props;
3914
- const inputElement = ref(null);
3915
- const focused = ref(false);
3916
- const lostFocus = ref(false);
3917
- const showRequiredAsterisk = computed(getShowAsteriskOrRequired);
3918
- const dateFlaggedAsOutOfRange = ref(false);
3919
- const { t: t2 } = useI18n();
3920
- const currentValue = computed({
3921
- get: () => props.modelValue,
3922
- set: (value) => onValueChanged(value)
3923
- });
3924
- const currentDateValue = computed({
3925
- get: () => props.modelValue,
3926
- set: (value) => updateDateValue(value)
3927
- });
3928
- const minAsString = computed(() => typeof props.min === "number" ? props.min.toString() : props.min);
3929
- const maxAsString = computed(() => typeof props.max === "number" ? props.max.toString() : props.max);
3930
- const minAsNumber = computed(() => typeof props.min === "number" ? props.min : parseFloat(props.min));
3931
- const maxAsNumber = computed(() => typeof props.max === "number" ? props.max : parseFloat(props.max));
3932
- const internalErrors = ref([]);
3933
- const errors = computed(() => {
3934
- var _a, _b, _c, _d;
3935
- return [
3936
- ...(_b = (_a = internalErrors.value) == null ? void 0 : _a.filter((e) => {
3937
- var _a2;
3938
- return ((_a2 = e == null ? void 0 : e.length) != null ? _a2 : 0) > 0;
3939
- })) != null ? _b : [],
3940
- ...(_d = (_c = props.externalErrors) == null ? void 0 : _c.filter((e) => {
3941
- var _a2;
3942
- return ((_a2 = e == null ? void 0 : e.length) != null ? _a2 : 0) > 0;
3943
- })) != null ? _d : []
3944
- ].join("\n");
3945
- });
3946
- function updateDateValue(value) {
3947
- updateAndValidateValue(value);
3948
- dateFlaggedAsOutOfRange.value = false;
3949
- }
3950
- function onValueChanged(value) {
3951
- if (props.onInputFunction !== void 0) {
3952
- value = props.onInputFunction(value);
3953
- }
3954
- updateAndValidateValue(value);
3955
- }
3956
- function updateAndValidateValue(value) {
3957
- const defaultSuccess = {
3958
- message: "",
3959
- valid: true
3960
- };
3961
- const customValidationSuccess = props.customValidationFunction === null || props.customValidationFunction === void 0 ? defaultSuccess : props.customValidationFunction(props.label, value);
3962
- const validationPromises = [props.customValidationFunction === null || props.customValidationFunction === void 0 ? new Promise((resolve) => {
3963
- resolve(defaultSuccess);
3964
- }) : new Promise((resolve) => {
3965
- resolve(props.customValidationFunction(props.label, value));
3966
- })];
3967
- if (typeof value === "string" || typeof value === "number" || value instanceof Date) {
3968
- validationPromises.push(validateMinValue(props.min, props.inputType, props.label, value));
3969
- validationPromises.push(validateMaxValue(props.max, props.inputType, props.label, value));
3970
- }
3971
- if (props.isRequired) {
3972
- validationPromises.push(validateRequired(props.label, value));
3973
- }
3974
- if (props.inputType === "email" && typeof value === "string") {
3975
- validationPromises.push(validateEmail(props.label, value));
3976
- }
3977
- Promise.all(validationPromises).then((internalValidationResults) => {
3978
- const messages2 = [...internalValidationResults.map((e) => e.message)];
3979
- let invalid = internalValidationResults.some((e) => e.valid === false) || !customValidationSuccess.valid;
3980
- if (dateFlaggedAsOutOfRange.value) {
3981
- messages2.push(t2("input.dateOutOfRange"));
3982
- invalid = true;
3983
- }
3984
- if (invalid) {
3985
- internalErrors.value = messages2;
3986
- emit("validated", false);
3987
- } else {
3988
- internalErrors.value = [];
3989
- emit("validated", true);
3990
- }
3991
- emit("update:modelValue", value);
3992
- });
3993
- }
3994
- function getStyle() {
3995
- let style = "";
3996
- if (props.inputType === "color" && currentValue.value) {
3997
- if (props.disabled) {
3998
- style = `background: #999999`;
3999
- } else {
4000
- style = `background: ${currentValue.value};`;
4001
- }
4002
- }
4003
- return style;
4004
- }
4005
- function emitClickIfButton(event) {
4006
- if (isInputButton(props.inputType)) {
4007
- event.preventDefault();
4008
- emit("click");
4009
- }
4010
- }
4011
- function incrementNumericValue() {
4012
- if (inputElement.value) {
4013
- inputElement.value.stepUp();
4014
- inputElement.value.focus();
4015
- onValueChanged(inputElement.value.valueAsNumber);
4016
- }
4017
- }
4018
- function decrementNumericValue() {
4019
- if (inputElement.value) {
4020
- inputElement.value.stepDown();
4021
- inputElement.value.focus();
4022
- onValueChanged(inputElement.value.valueAsNumber);
4023
- }
4024
- }
4025
- function toggleFocus(focus) {
4026
- focused.value = focus;
4027
- }
4028
- function onLostFocus() {
4029
- lostFocus.value = true;
4030
- toggleFocus(false);
4031
- }
4032
- function onMouseWheel(wheelEvent) {
4033
- wheelEvent.target.blur();
4034
- }
4035
- function getShowAsteriskOrRequired() {
4036
- var _a;
4037
- let asterisk = true;
4038
- const currentState = showRequiredAsterisk.value;
4039
- if (focused.value) {
4040
- asterisk = currentState;
4041
- } else if (lostFocus.value && ((_a = currentValue.value) == null ? void 0 : _a.toString().trim()) === "") {
4042
- asterisk = false;
4043
- }
4044
- return asterisk;
4045
- }
4046
- function onDateOutOfRange() {
4047
- dateFlaggedAsOutOfRange.value = true;
4048
- }
4049
- onMounted(() => {
4050
- if (props.validateImmediately) {
4051
- onValueChanged(props.modelValue);
4052
- }
4053
- });
4054
- watch(() => props.isRequired, () => onValueChanged(props.modelValue));
3944
+ setup(__props) {
3945
+ const isOpen = ref(false);
4055
3946
  return (_ctx, _cache) => {
4056
3947
  const _component_icon = resolveComponent("icon");
4057
3948
  return openBlock(), createElementBlock("div", _hoisted_1$6, [
4058
- createElementVNode("div", {
4059
- class: "cl-relative",
4060
- onMouseenter: _cache[7] || (_cache[7] = ($event) => toggleFocus(true)),
4061
- onMouseleave: _cache[8] || (_cache[8] = ($event) => toggleFocus(false))
4062
- }, [
4063
- createElementVNode("div", _hoisted_2$5, [
4064
- createElementVNode("label", _hoisted_3$4, toDisplayString(__props.label), 1),
4065
- __props.isRequired && unref(showRequiredAsterisk) ? (openBlock(), createElementBlock("label", _hoisted_4$2, " * ")) : createCommentVNode("", true),
4066
- __props.isRequired && !unref(showRequiredAsterisk) ? (openBlock(), createElementBlock("label", _hoisted_5$1, toDisplayString(__props.requiredText), 1)) : createCommentVNode("", true)
4067
- ]),
4068
- __props.inputType !== "range" && !unref(isInputCalendarSupportedDate)(__props.inputType) ? withDirectives((openBlock(), createElementBlock("input", {
3949
+ createElementVNode("div", _hoisted_2$5, [
3950
+ __props.image ? (openBlock(), createElementBlock("img", {
4069
3951
  key: 0,
4070
- ref: (_value, _refs) => {
4071
- _refs["inputElement"] = _value;
4072
- inputElement.value = _value;
4073
- },
4074
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(currentValue) ? currentValue.value = $event : null),
4075
- class: normalizeClass(["cl-block cl-border cl-duration-300 cl-h-fit cl-mb-1 cl-transition cl-w-full focus:cl-outline-none", {
4076
- "hover:!cl-border-grey-3": __props.disabled === false && !unref(isInputButton)(__props.inputType),
4077
- "!cl-cursor-default": __props.disabled,
4078
- "!cl-border-danger-default": unref(errors).length > 0,
4079
- "cl-border-grey-0 focus:cl-border-blue-light": unref(errors).length === 0 && !unref(isInputButton)(__props.inputType),
4080
- "!cl-p-2": __props.inputType === "checkbox" || __props.inputType === "radio",
4081
- "cl-p-3 cl-rounded-lg": !unref(isInputButton)(__props.inputType)
4082
- }]),
4083
- style: normalizeStyle(getStyle()),
4084
- type: __props.inputType,
4085
- disabled: __props.disabled,
4086
- min: __props.min,
4087
- max: __props.max,
4088
- minlength: unref(isInputText)(__props.inputType) ? __props.min : 0,
4089
- maxlength: unref(isInputText)(__props.inputType) ? __props.max : 0,
4090
- step: __props.step,
4091
- placeholder: __props.placeholderText,
4092
- accept: __props.fileExtensions,
4093
- name: __props.group,
4094
- onClick: _cache[1] || (_cache[1] = ($event) => emitClickIfButton($event)),
4095
- onFocus: _cache[2] || (_cache[2] = ($event) => toggleFocus(true)),
4096
- onBlur: withModifiers(onLostFocus, ["self"]),
4097
- onMousewheel: onMouseWheel
4098
- }, null, 46, _hoisted_6$1)), [
4099
- [vModelDynamic, unref(currentValue)]
4100
- ]) : createCommentVNode("", true),
4101
- unref(isInputCalendarSupportedDate)(__props.inputType) ? (openBlock(), createBlock(unref(_sfc_main$o), {
3952
+ src: __props.image,
3953
+ 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"
3954
+ }, null, 8, _hoisted_3$4)) : (openBlock(), createBlock(_component_icon, {
4102
3955
  key: 1,
4103
- ref: (_value, _refs) => {
4104
- _refs["inputElement"] = _value;
4105
- inputElement.value = _value;
4106
- },
4107
- date: unref(currentDateValue),
4108
- "onUpdate:date": _cache[3] || (_cache[3] = ($event) => isRef(currentDateValue) ? currentDateValue.value = $event : null),
4109
- class: normalizeClass(["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", {
4110
- "hover:cl-border-grey-3": !__props.disabled,
4111
- "!cl-border-danger-default": unref(errors).length > 0
4112
- }]),
4113
- disabled: __props.disabled,
4114
- type: unref(getInputTypeAsCalendarType)(__props.inputType),
4115
- min: unref(minAsString),
4116
- max: unref(maxAsString),
4117
- onBlur: withModifiers(onLostFocus, ["self"]),
4118
- onValueOutOfRange: onDateOutOfRange
4119
- }, null, 8, ["date", "class", "disabled", "type", "min", "max", "onBlur"])) : createCommentVNode("", true),
4120
- __props.inputType === "number" && !__props.disabled ? (openBlock(), createElementBlock("div", {
4121
- key: 2,
4122
- class: normalizeClass(["cl-absolute cl-duration-300 cl-right-1 cl-transition", {
4123
- "cl-opacity-0": !focused.value
4124
- }]),
4125
- style: { "bottom": "1.625rem" }
4126
- }, [
4127
- createVNode(_component_icon, {
4128
- icon: "ph:caret-up-bold",
4129
- class: "cl-bg-link-default cl-rounded-md cl-text-sm cl-text-white hover:cl-bg-link-light hover:cl-cursor-pointer",
4130
- onClick: incrementNumericValue,
4131
- onMousedown: _cache[4] || (_cache[4] = withModifiers(() => {
4132
- }, ["prevent"]))
4133
- })
4134
- ], 2)) : createCommentVNode("", true),
4135
- __props.inputType === "number" && !__props.disabled ? (openBlock(), createElementBlock("div", {
4136
- key: 3,
4137
- class: normalizeClass(["cl-absolute cl-bottom-2 cl-duration-300 cl-right-1 cl-transition", {
4138
- "cl-opacity-0": !focused.value
4139
- }])
3956
+ class: "cl-hidden cl-m-4 cl-text-white md:cl-block",
3957
+ icon: "ph:user-circle",
3958
+ width: "48",
3959
+ height: "48"
3960
+ })),
3961
+ createElementVNode("div", _hoisted_4$2, [
3962
+ __props.username ? (openBlock(), createElementBlock("div", _hoisted_5$1, toDisplayString(__props.username), 1)) : createCommentVNode("", true),
3963
+ __props.group ? (openBlock(), createElementBlock("div", _hoisted_6$1, toDisplayString(__props.group), 1)) : createCommentVNode("", true)
3964
+ ]),
3965
+ createElementVNode("div", {
3966
+ 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",
3967
+ onClick: _cache[0] || (_cache[0] = ($event) => isOpen.value = !isOpen.value)
4140
3968
  }, [
4141
3969
  createVNode(_component_icon, {
4142
- icon: "ph:caret-down-bold",
4143
- class: "cl-bg-link-default cl-rounded-md cl-text-sm cl-text-white hover:cl-bg-link-light hover:cl-cursor-pointer",
4144
- onClick: decrementNumericValue,
4145
- onMousedown: _cache[5] || (_cache[5] = withModifiers(() => {
4146
- }, ["prevent"]))
4147
- })
4148
- ], 2)) : createCommentVNode("", true),
4149
- __props.inputType === "range" && typeof unref(currentValue) === "number" ? (openBlock(), createElementBlock("div", _hoisted_7$1, [
4150
- createVNode(unref(clUiSlider), {
4151
- ref: (_value, _refs) => {
4152
- _refs["inputElement"] = _value;
4153
- inputElement.value = _value;
4154
- },
4155
- value: unref(currentValue),
4156
- "onUpdate:value": _cache[6] || (_cache[6] = ($event) => isRef(currentValue) ? currentValue.value = $event : null),
4157
- min: unref(minAsNumber),
4158
- max: unref(maxAsNumber),
4159
- step: __props.step,
4160
- disabled: __props.disabled,
4161
- "show-numeric-input": false,
4162
- onBlur: withModifiers(onLostFocus, ["self"])
4163
- }, null, 8, ["value", "min", "max", "step", "disabled", "onBlur"])
4164
- ])) : createCommentVNode("", true)
4165
- ], 32),
4166
- unref(errors).length > 0 ? (openBlock(), createElementBlock("div", _hoisted_8$1, toDisplayString(unref(errors)), 1)) : createCommentVNode("", true)
3970
+ class: normalizeClass(["cl-text-white cl-transform-gpu cl-transition-transform", {
3971
+ "cl-rotate-180": isOpen.value
3972
+ }]),
3973
+ icon: "ph:caret-down"
3974
+ }, null, 8, ["class"])
3975
+ ])
3976
+ ]),
3977
+ createVNode(Transition, { name: "fade" }, {
3978
+ default: withCtx(() => [
3979
+ withDirectives(createElementVNode("div", _hoisted_7$1, [
3980
+ renderSlot(_ctx.$slots, "default")
3981
+ ], 512), [
3982
+ [vShow, isOpen.value]
3983
+ ])
3984
+ ]),
3985
+ _: 3
3986
+ })
4167
3987
  ]);
4168
3988
  };
4169
3989
  }
4170
3990
  });
4171
- var clUiInput = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["__scopeId", "data-v-966ee6cc"]]);
4172
3991
  const inputTypes = [
4173
3992
  "button",
4174
3993
  "checkbox",
@@ -4280,7 +4099,6 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
4280
4099
  };
4281
4100
  }
4282
4101
  });
4283
- var clUiLogin_vue_vue_type_style_index_0_scoped_true_lang = "";
4284
4102
  const _hoisted_1$4 = { class: "cl-relative" };
4285
4103
  const _hoisted_2$3 = { class: "cl-h-screen cl-z-0" };
4286
4104
  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" };
@@ -4291,16 +4109,9 @@ const _hoisted_5 = {
4291
4109
  };
4292
4110
  const _hoisted_6 = { class: "cl-col-span-3" };
4293
4111
  const _hoisted_7 = { class: "cl-inline cl-relative cl-text-grey-4" };
4294
- const _hoisted_8 = ["data-valid", "placeholder"];
4295
- const _hoisted_9 = { class: "cl-text-grey-3 cl-text-sm" };
4296
- const _hoisted_10 = { class: "cl-flex cl-mt-2" };
4297
- const _hoisted_11 = { class: "cl-align-middle cl-inline-block cl-ml-2" };
4298
- const _hoisted_12 = { class: "cl-flex cl-mt-2" };
4299
- const _hoisted_13 = { class: "cl-align-middle cl-inline-block cl-ml-2" };
4300
- const _hoisted_14 = { class: "cl-col-span-3" };
4301
- const _hoisted_15 = { class: "cl-inline cl-relative cl-text-grey-4" };
4302
- const _hoisted_16 = ["type", "data-valid", "placeholder"];
4303
- const _hoisted_17 = { class: "cl-col-span-10 cl-emphasis-danger cl-mt-10 cl-p-3 cl-rounded-md cl-text-sm md:cl-mt-3" };
4112
+ const _hoisted_8 = { class: "cl-col-span-3" };
4113
+ const _hoisted_9 = { class: "cl-inline cl-relative cl-text-grey-4" };
4114
+ 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" };
4304
4115
  const _sfc_main$5 = /* @__PURE__ */ defineComponent({
4305
4116
  props: {
4306
4117
  errors: { default: () => [] },
@@ -4315,7 +4126,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
4315
4126
  const username = ref("");
4316
4127
  const password = ref("");
4317
4128
  const passwordFieldType = ref("password");
4318
- const usernameValid = computed(() => /[a-zA-Z0-9.!#$%&’*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)/gi.test(username.value));
4129
+ const usernameValid = ref();
4319
4130
  function login() {
4320
4131
  const authentication = {
4321
4132
  username: username.value,
@@ -4326,18 +4137,31 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
4326
4137
  function clearErrors() {
4327
4138
  emit("update:errors", []);
4328
4139
  }
4140
+ function emptyIsInvalidValidation(_, value) {
4141
+ const state = {
4142
+ valid: true,
4143
+ message: ""
4144
+ };
4145
+ if (typeof value === "string" && value.trim() === "") {
4146
+ state.valid = false;
4147
+ }
4148
+ return state;
4149
+ }
4150
+ function onUsernameValidated(valid, _) {
4151
+ usernameValid.value = valid;
4152
+ }
4329
4153
  return (_ctx, _cache) => {
4330
4154
  const _component_icon = resolveComponent("icon");
4331
4155
  return openBlock(), createElementBlock("div", _hoisted_1$4, [
4332
4156
  createElementVNode("div", _hoisted_2$3, [
4333
- renderSlot(_ctx.$slots, "background", {}, void 0, true)
4157
+ renderSlot(_ctx.$slots, "background")
4334
4158
  ]),
4335
4159
  createElementVNode("form", _hoisted_3$2, [
4336
4160
  createElementVNode("div", _hoisted_4, [
4337
- renderSlot(_ctx.$slots, "logo", {}, void 0, true)
4161
+ renderSlot(_ctx.$slots, "logo")
4338
4162
  ]),
4339
4163
  _ctx.$slots["language-switcher"] ? (openBlock(), createElementBlock("div", _hoisted_5, [
4340
- renderSlot(_ctx.$slots, "language-switcher", {}, void 0, true)
4164
+ renderSlot(_ctx.$slots, "language-switcher")
4341
4165
  ])) : createCommentVNode("", true),
4342
4166
  createElementVNode("div", {
4343
4167
  class: normalizeClass(["cl-gap-y-4 cl-grid cl-grid-cols-1 lg:cl-gap-x-2 lg:cl-grid-cols-8", {
@@ -4348,66 +4172,39 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
4348
4172
  createElementVNode("div", _hoisted_6, [
4349
4173
  createElementVNode("div", _hoisted_7, [
4350
4174
  createVNode(_component_icon, {
4351
- class: "cl-absolute cl-left-3 cl-top-2",
4175
+ class: "cl-absolute cl-left-3 cl-top-2.5",
4352
4176
  icon: "ph:user",
4353
4177
  size: 18
4354
4178
  }),
4355
- withDirectives(createElementVNode("input", {
4179
+ createVNode(ClUiInput, {
4180
+ modelValue: username.value,
4356
4181
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => username.value = $event),
4357
- class: "!cl-pb-1 !cl-pl-9",
4358
- type: "email",
4359
- "data-valid": unref(usernameValid),
4360
- placeholder: unref(t2)("login.email"),
4182
+ modelModifiers: { trim: true },
4183
+ class: "!cl-border-2 !cl-mb-1 cl-w-full",
4184
+ "input-type": "email",
4185
+ "highlight-when-valid": true,
4186
+ label: "Username",
4187
+ "show-label": false,
4188
+ "placeholder-text": unref(t2)("login.email"),
4361
4189
  autocomplete: "username",
4362
- onInput: clearErrors
4363
- }, null, 40, _hoisted_8), [
4364
- [
4365
- vModelText,
4366
- username.value,
4367
- void 0,
4368
- { trim: true }
4369
- ]
4370
- ])
4371
- ]),
4372
- createVNode(Transition, { name: "fade" }, {
4373
- default: withCtx(() => [
4374
- withDirectives(createElementVNode("div", _hoisted_9, [
4375
- withDirectives(createElementVNode("div", _hoisted_10, [
4376
- createVNode(_component_icon, {
4377
- class: "cl-mt-1 cl-text-primary-default",
4378
- icon: "ph:check",
4379
- size: 16
4380
- }),
4381
- createElementVNode("em", _hoisted_11, toDisplayString(unref(t2)("login.validEmail")), 1)
4382
- ], 512), [
4383
- [vShow, unref(usernameValid)]
4384
- ]),
4385
- withDirectives(createElementVNode("div", _hoisted_12, [
4386
- createVNode(_component_icon, {
4387
- class: "cl-mt-1 cl-text-danger-default",
4388
- icon: "ph:x",
4389
- size: 16
4390
- }),
4391
- createElementVNode("em", _hoisted_13, toDisplayString(unref(t2)("login.invalidEmail")), 1)
4392
- ], 512), [
4393
- [vShow, !unref(usernameValid)]
4394
- ])
4395
- ], 512), [
4396
- [vShow, username.value !== ""]
4397
- ])
4398
- ]),
4399
- _: 1
4400
- })
4190
+ "validate-immediately": true,
4191
+ "custom-validation-function": emptyIsInvalidValidation,
4192
+ "input-specific-classes": "!cl-pl-9",
4193
+ "message-when-valid": unref(t2)("login.validEmail"),
4194
+ onInput: clearErrors,
4195
+ onValidated: onUsernameValidated
4196
+ }, null, 8, ["modelValue", "placeholder-text", "message-when-valid"])
4197
+ ])
4401
4198
  ]),
4402
- createElementVNode("div", _hoisted_14, [
4403
- createElementVNode("div", _hoisted_15, [
4199
+ createElementVNode("div", _hoisted_8, [
4200
+ createElementVNode("div", _hoisted_9, [
4404
4201
  createVNode(_component_icon, {
4405
- class: "cl-absolute cl-left-3 cl-top-2",
4202
+ class: "cl-absolute cl-left-3 cl-top-2.5",
4406
4203
  icon: "ph:lock",
4407
4204
  size: 18
4408
4205
  }),
4409
4206
  withDirectives(createVNode(_component_icon, {
4410
- class: "cl-absolute cl-cursor-pointer cl-right-3 cl-top-2",
4207
+ class: "cl-absolute cl-cursor-pointer cl-right-6 cl-top-2.5",
4411
4208
  icon: "ph:eye",
4412
4209
  size: 18,
4413
4210
  onClick: _cache[1] || (_cache[1] = ($event) => passwordFieldType.value = "text")
@@ -4415,24 +4212,26 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
4415
4212
  [vShow, passwordFieldType.value === "password"]
4416
4213
  ]),
4417
4214
  withDirectives(createVNode(_component_icon, {
4418
- class: "cl-absolute cl-cursor-pointer cl-right-3 cl-top-2",
4215
+ class: "cl-absolute cl-cursor-pointer cl-right-6 cl-top-2.5",
4419
4216
  icon: "ph:eye-slash",
4420
4217
  size: 18,
4421
4218
  onClick: _cache[2] || (_cache[2] = ($event) => passwordFieldType.value = "password")
4422
4219
  }, null, 512), [
4423
4220
  [vShow, passwordFieldType.value === "text"]
4424
4221
  ]),
4425
- withDirectives(createElementVNode("input", {
4222
+ createVNode(ClUiInput, {
4223
+ modelValue: password.value,
4426
4224
  "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => password.value = $event),
4427
- class: "!cl-pb-1 !cl-pl-9 !cl-pr-9",
4428
- type: passwordFieldType.value,
4429
- "data-valid": password.value !== "",
4430
- placeholder: unref(t2)("login.password"),
4225
+ class: "!cl-border-2 cl-w-full",
4226
+ "input-type": passwordFieldType.value,
4227
+ "highlight-when-valid": true,
4228
+ "placeholder-text": unref(t2)("login.password"),
4431
4229
  autocomplete: "current-password",
4230
+ "validate-immediately": true,
4231
+ "input-specific-classes": "!cl-pl-9 !cl-pr-9",
4232
+ "custom-validation-function": emptyIsInvalidValidation,
4432
4233
  onInput: clearErrors
4433
- }, null, 40, _hoisted_16), [
4434
- [vModelDynamic, password.value]
4435
- ])
4234
+ }, null, 8, ["modelValue", "input-type", "placeholder-text"])
4436
4235
  ])
4437
4236
  ]),
4438
4237
  createElementVNode("div", {
@@ -4441,10 +4240,10 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
4441
4240
  }])
4442
4241
  }, [
4443
4242
  createVNode(_sfc_main$p, {
4444
- class: "cl-w-full",
4243
+ class: "!cl-leading-9 cl-w-full",
4445
4244
  colour: "blue",
4446
4245
  loading: __props.loading,
4447
- disabled: !unref(usernameValid) || password.value === "",
4246
+ disabled: !usernameValid.value || password.value === "",
4448
4247
  onClick: withModifiers(login, ["prevent"])
4449
4248
  }, {
4450
4249
  default: withCtx(() => [
@@ -4458,7 +4257,7 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
4458
4257
  default: withCtx(() => {
4459
4258
  var _a;
4460
4259
  return [
4461
- withDirectives(createElementVNode("span", _hoisted_17, [
4260
+ withDirectives(createElementVNode("span", _hoisted_10, [
4462
4261
  (openBlock(true), createElementBlock(Fragment, null, renderList(__props.errors, (error, index) => {
4463
4262
  return openBlock(), createElementBlock("div", {
4464
4263
  key: index,
@@ -4477,7 +4276,6 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
4477
4276
  };
4478
4277
  }
4479
4278
  });
4480
- var clUiLogin = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__scopeId", "data-v-2e5cd708"]]);
4481
4279
  const modalSizes = [
4482
4280
  "x-small",
4483
4281
  "small",
@@ -4645,11 +4443,9 @@ var components = /* @__PURE__ */ Object.freeze({
4645
4443
  clUiButton: _sfc_main$p,
4646
4444
  buttonColours,
4647
4445
  buttonSizes,
4648
- clUiCalendar: _sfc_main$o,
4649
- calendarTypes,
4650
- clUiCard: _sfc_main$n,
4446
+ clUiCard: _sfc_main$o,
4651
4447
  cardSizes,
4652
- clUiComboBox: _sfc_main$i,
4448
+ clUiComboBox: _sfc_main$g,
4653
4449
  isComboBoxItem,
4654
4450
  isComboBoxCreateRequest,
4655
4451
  clUiFooter,
@@ -4665,15 +4461,15 @@ var components = /* @__PURE__ */ Object.freeze({
4665
4461
  isFilterRequest,
4666
4462
  isFilterResponse,
4667
4463
  clUiHeader,
4668
- clUiHeaderMenu: _sfc_main$9,
4669
- clUiInput,
4464
+ clUiHeaderMenu: _sfc_main$7,
4465
+ clUiInput: ClUiInput,
4670
4466
  inputTypes,
4671
4467
  clUiLanguageSwitcher: _sfc_main$6,
4672
4468
  isLanguageLocaleFormat,
4673
4469
  isLanguageArray,
4674
4470
  clUiLoadingSpinner: ClUiLoadingSpinner,
4675
- clUiLogin,
4676
- clUiModal: _sfc_main$m,
4471
+ clUiLogin: _sfc_main$5,
4472
+ clUiModal: _sfc_main$k,
4677
4473
  modalSizes,
4678
4474
  modalColours,
4679
4475
  clUiNavigation,
@@ -4681,9 +4477,238 @@ var components = /* @__PURE__ */ Object.freeze({
4681
4477
  clUiNavigationGroup: _sfc_main$2,
4682
4478
  clUiNavigationSection,
4683
4479
  clUiNavigationItem,
4684
- clUiNotification: _sfc_main$s,
4685
- clUiSlider
4480
+ clUiNotification: _sfc_main$s
4686
4481
  });
4482
+ function levenshtein(firstString, secondString) {
4483
+ if (firstString.length === 0) {
4484
+ return secondString.length;
4485
+ }
4486
+ if (secondString.length === 0) {
4487
+ return firstString.length;
4488
+ }
4489
+ if (firstString.length > secondString.length) {
4490
+ const tmp = firstString;
4491
+ firstString = secondString;
4492
+ secondString = tmp;
4493
+ }
4494
+ const row = new Int8Array(firstString.length + 1);
4495
+ for (let i = 0; i <= firstString.length; i++) {
4496
+ row[i] = i;
4497
+ }
4498
+ let temp;
4499
+ for (let i = 1; i <= secondString.length; i++) {
4500
+ let prev = i;
4501
+ const previousChar = secondString[i - 1];
4502
+ for (let j = 1; j <= firstString.length; j++) {
4503
+ if (previousChar === firstString[j - 1]) {
4504
+ temp = row[j - 1];
4505
+ } else {
4506
+ const a = prev + 1;
4507
+ const b = row[j] + 1;
4508
+ const c = a - (a - b & b - a >> 7);
4509
+ const d = row[j - 1] + 1;
4510
+ temp = c - (c - d & d - c >> 7);
4511
+ }
4512
+ row[j - 1] = prev;
4513
+ prev = temp;
4514
+ }
4515
+ row[firstString.length] = prev;
4516
+ }
4517
+ return row[firstString.length];
4518
+ }
4519
+ function camelCaseToArray(camelCase) {
4520
+ return camelCase.split(/(?=[A-Z])/g);
4521
+ }
4522
+ function kebabCaseToArray(kebabCase) {
4523
+ return kebabCase.split(/(?=-)/g).map((s) => s.replace(/-/g, ""));
4524
+ }
4525
+ function pascalCaseToArray(pascalCase) {
4526
+ return camelCaseToArray(pascalCase);
4527
+ }
4528
+ function sentenceCaseToArray(sentenceCase) {
4529
+ return sentenceCase.split(/ /g).map((s) => s.replace(/[^A-Za-z0-9]/g, ""));
4530
+ }
4531
+ function snakeCaseToArray(snakeCase) {
4532
+ return snakeCase.split(/(?=_)/g).map((s) => s.replace(/_/g, ""));
4533
+ }
4534
+ function titleCaseToArray(titleCase) {
4535
+ return sentenceCaseToArray(titleCase);
4536
+ }
4537
+ function arrayToCamelCase(array, locale) {
4538
+ let result = "";
4539
+ array.forEach((s, i) => {
4540
+ result += i === 0 ? s.toLocaleLowerCase(locale) : s.toLocaleLowerCase(locale).firstCharToUpperCase(locale);
4541
+ });
4542
+ return result;
4543
+ }
4544
+ function arrayToKebabCase(array, lowerCase, locale) {
4545
+ let result = "";
4546
+ array.forEach((s) => {
4547
+ result += `${lowerCase ? s.toLocaleLowerCase(locale) : s.toLocaleUpperCase(locale)}-`;
4548
+ });
4549
+ return result.trimEndChar("-");
4550
+ }
4551
+ function arrayToSentenceCase(array, locale) {
4552
+ let result = "";
4553
+ array.forEach((s, i) => {
4554
+ result += `${i === 0 ? s.toLowerCase().firstCharToUpperCase(locale) : s.toLocaleLowerCase(locale)} `;
4555
+ });
4556
+ return result.trimEndChar(" ");
4557
+ }
4558
+ function arrayToTitleCase(array, locale) {
4559
+ let result = "";
4560
+ array.forEach((s) => {
4561
+ result += `${s.toLocaleLowerCase(locale).firstCharToUpperCase(locale)} `;
4562
+ });
4563
+ return result.trimEndChar(" ");
4564
+ }
4565
+ String.prototype.similarity = function(comparisonString) {
4566
+ let similarityToReturn = 0;
4567
+ let longerString = this.toLowerCase();
4568
+ let shorterString = comparisonString.toLowerCase();
4569
+ if (longerString < shorterString) {
4570
+ const temp = shorterString;
4571
+ shorterString = longerString;
4572
+ longerString = temp;
4573
+ }
4574
+ const longerLength = longerString.length;
4575
+ if (longerLength === 0) {
4576
+ similarityToReturn = 100;
4577
+ } else {
4578
+ similarityToReturn = Math.round((longerLength - levenshtein(longerString, shorterString)) / longerLength * 100);
4579
+ }
4580
+ return similarityToReturn;
4581
+ };
4582
+ String.prototype.trimChar = function(character) {
4583
+ return this.trimStartChar(character).trimEndChar(character);
4584
+ };
4585
+ String.prototype.trimStartChar = function(character) {
4586
+ return character !== "" && this.startsWith(character) ? this.slice(1) : this;
4587
+ };
4588
+ String.prototype.trimEndChar = function(character) {
4589
+ return character !== "" && this.endsWith(character) ? this.slice(0, -1) : this;
4590
+ };
4591
+ String.prototype.trimToLength = function(length, addEllipsis = false) {
4592
+ const trimLength = this.length < length ? this.length : length;
4593
+ return addEllipsis && trimLength >= 4 && trimLength < this.length ? `${this.slice(0, Math.max(trimLength - 3, 1))}...` : this.slice(0, Math.max(trimLength, 1));
4594
+ };
4595
+ String.prototype.firstCharToUpperCase = function(locale) {
4596
+ return `${this.charAt(0).toLocaleUpperCase(locale)}${this.slice(1)}`;
4597
+ };
4598
+ String.prototype.firstCharToLowerCase = function(locale) {
4599
+ return `${this.charAt(0).toLocaleLowerCase(locale)}${this.slice(1)}`;
4600
+ };
4601
+ String.prototype.removeWhitespace = function() {
4602
+ return this.replace(/\s/g, "");
4603
+ };
4604
+ String.prototype.removeNonAlphanumeric = function() {
4605
+ return this.replace(/[^a-zA-Z0-9]/g, "");
4606
+ };
4607
+ String.prototype.removeNonAlphabetic = function() {
4608
+ return this.replace(/[^a-zA-Z]/g, "");
4609
+ };
4610
+ String.prototype.removeNonNumeric = function() {
4611
+ return this.replace(/[^0-9]/g, "");
4612
+ };
4613
+ String.prototype.replacePlaceholders = function(...args) {
4614
+ let i = 0;
4615
+ return this.replace(/{\d+}/g, () => typeof args[i] !== "undefined" ? args[i++] : "");
4616
+ };
4617
+ String.prototype.camelCaseToKebabCase = function(lowerCase = true, locale) {
4618
+ return arrayToKebabCase(camelCaseToArray(this), lowerCase, locale);
4619
+ };
4620
+ String.prototype.camelCaseToPascalCase = function(locale) {
4621
+ return this.firstCharToUpperCase(locale);
4622
+ };
4623
+ String.prototype.camelCaseToSentenceCase = function(locale) {
4624
+ return arrayToSentenceCase(camelCaseToArray(this), locale);
4625
+ };
4626
+ String.prototype.camelCaseToSnakeCase = function(lowerCase = true, locale) {
4627
+ return this.camelCaseToKebabCase().kebabCaseToSnakeCase(lowerCase, locale);
4628
+ };
4629
+ String.prototype.camelCaseToTitleCase = function(locale) {
4630
+ return arrayToTitleCase(camelCaseToArray(this), locale);
4631
+ };
4632
+ String.prototype.kebabCaseToCamelCase = function(locale) {
4633
+ return arrayToCamelCase(kebabCaseToArray(this), locale);
4634
+ };
4635
+ String.prototype.kebabCaseToPascalCase = function(locale) {
4636
+ return this.kebabCaseToCamelCase().camelCaseToPascalCase(locale);
4637
+ };
4638
+ String.prototype.kebabCaseToSentenceCase = function(locale) {
4639
+ return arrayToSentenceCase(kebabCaseToArray(this), locale);
4640
+ };
4641
+ String.prototype.kebabCaseToSnakeCase = function(lowerCase = true, locale) {
4642
+ const result = this.replace(/-/g, "_");
4643
+ return lowerCase ? result.toLocaleLowerCase(locale) : result.toLocaleUpperCase(locale);
4644
+ };
4645
+ String.prototype.kebabCaseToTitleCase = function(locale) {
4646
+ return arrayToTitleCase(kebabCaseToArray(this), locale);
4647
+ };
4648
+ String.prototype.pascalCaseToCamelCase = function(locale) {
4649
+ return arrayToCamelCase(pascalCaseToArray(this), locale);
4650
+ };
4651
+ String.prototype.pascalCaseToKebabCase = function(lowerCase = true, locale) {
4652
+ return arrayToKebabCase(pascalCaseToArray(this), lowerCase, locale);
4653
+ };
4654
+ String.prototype.pascalCaseToSentenceCase = function(locale) {
4655
+ return arrayToSentenceCase(pascalCaseToArray(this), locale);
4656
+ };
4657
+ String.prototype.pascalCaseToSnakeCase = function(lowerCase = true, locale) {
4658
+ return this.pascalCaseToKebabCase().kebabCaseToSnakeCase(lowerCase, locale);
4659
+ };
4660
+ String.prototype.pascalCaseToTitleCase = function(locale) {
4661
+ return arrayToTitleCase(pascalCaseToArray(this), locale);
4662
+ };
4663
+ String.prototype.sentenceCaseToCamelCase = function(locale) {
4664
+ return arrayToCamelCase(sentenceCaseToArray(this), locale);
4665
+ };
4666
+ String.prototype.sentenceCaseToKebabCase = function(lowerCase = true, locale) {
4667
+ return arrayToKebabCase(sentenceCaseToArray(this), lowerCase, locale);
4668
+ };
4669
+ String.prototype.sentenceCaseToPascalCase = function(locale) {
4670
+ return this.sentenceCaseToCamelCase().camelCaseToPascalCase(locale);
4671
+ };
4672
+ String.prototype.sentenceCaseToSnakeCase = function(lowerCase = true, locale) {
4673
+ return this.sentenceCaseToKebabCase().kebabCaseToSnakeCase(lowerCase, locale);
4674
+ };
4675
+ String.prototype.sentenceCaseToTitleCase = function(locale) {
4676
+ return arrayToTitleCase(sentenceCaseToArray(this), locale);
4677
+ };
4678
+ String.prototype.snakeCaseToCamelCase = function(locale) {
4679
+ return arrayToCamelCase(snakeCaseToArray(this), locale);
4680
+ };
4681
+ String.prototype.snakeCaseToKebabCase = function(lowerCase = true, locale) {
4682
+ const result = this.replace(/_/g, "-");
4683
+ return lowerCase ? result.toLocaleLowerCase(locale) : result.toLocaleUpperCase(locale);
4684
+ };
4685
+ String.prototype.snakeCaseToPascalCase = function(locale) {
4686
+ return this.snakeCaseToCamelCase().camelCaseToPascalCase(locale);
4687
+ };
4688
+ String.prototype.snakeCaseToSentenceCase = function(locale) {
4689
+ return arrayToSentenceCase(snakeCaseToArray(this), locale);
4690
+ };
4691
+ String.prototype.snakeCaseToTitleCase = function(locale) {
4692
+ return arrayToTitleCase(snakeCaseToArray(this), locale);
4693
+ };
4694
+ String.prototype.titleCaseToCamelCase = function(locale) {
4695
+ return arrayToCamelCase(titleCaseToArray(this), locale);
4696
+ };
4697
+ String.prototype.titleCaseToKebabCase = function(lowerCase = true, locale) {
4698
+ return arrayToKebabCase(titleCaseToArray(this), lowerCase, locale);
4699
+ };
4700
+ String.prototype.titleCaseToPascalCase = function(locale) {
4701
+ return this.titleCaseToCamelCase().camelCaseToPascalCase(locale);
4702
+ };
4703
+ String.prototype.titleCaseToSentenceCase = function(locale) {
4704
+ return arrayToSentenceCase(titleCaseToArray(this), locale);
4705
+ };
4706
+ String.prototype.titleCaseToSnakeCase = function(lowerCase = true, locale) {
4707
+ return this.titleCaseToKebabCase().kebabCaseToSnakeCase(lowerCase, locale);
4708
+ };
4709
+ String.prototype.toDateFromTime = function() {
4710
+ return new Date(`${new Date().toISOString().substr(0, 11)}${this}`);
4711
+ };
4687
4712
  Date.prototype.toLocaleMonthString = function(locale) {
4688
4713
  return i18n.global.d(this, DateFormat.MONTH_YEAR, locale != null ? locale : i18n.global.locale.value);
4689
4714
  };
@@ -4704,4 +4729,4 @@ const install = (app) => {
4704
4729
  app.component(name, component);
4705
4730
  });
4706
4731
  };
4707
- export { DateFormat, FilterOperation, NumberFormat, buttonColours, buttonSizes, calendarTypes, cardSizes, _sfc_main$v as clUiAccordion, clUiAccordionHeader, _sfc_main$u as clUiAccordionItem, _sfc_main$r as clUiApp, _sfc_main$p as clUiButton, _sfc_main$o as clUiCalendar, _sfc_main$n as clUiCard, _sfc_main$i as clUiComboBox, clUiFooter, clUiGrid, clUiHeader, _sfc_main$9 as clUiHeaderMenu, clUiInput, _sfc_main$6 as clUiLanguageSwitcher, ClUiLoadingSpinner as clUiLoadingSpinner, clUiLogin, _sfc_main$m as clUiModal, clUiNavigation, _sfc_main$2 as clUiNavigationGroup, _sfc_main$3 as clUiNavigationIcon, clUiNavigationItem, clUiNavigationSection, _sfc_main$s as clUiNotification, clUiSlider, compareByProperty, copy, datetimeFormats, install as default, filterMethodTypes, generateStringId, getParamsByName, gridColumnTypes, i18n, inputTypes, isComboBoxCreateRequest, isComboBoxItem, isFilterRequest, isFilterResponse, isGridColumn, isGridColumnArray, isLanguageArray, isLanguageLocaleFormat, messages, modalColours, modalSizes, nameOf, numberFormats, setCurrentLocale, setLocaleDateTimeFormats, setLocaleMessages, setLocaleNumberFormats, showNotification, stringFormats, useDebouncer, validateEmail, validateMaxValue, validateMinValue };
4732
+ export { DateFormat, FilterOperation, NumberFormat, buttonColours, buttonSizes, cardSizes, _sfc_main$v as clUiAccordion, clUiAccordionHeader, _sfc_main$u as clUiAccordionItem, _sfc_main$r as clUiApp, _sfc_main$p as clUiButton, _sfc_main$o as clUiCard, _sfc_main$g as clUiComboBox, clUiFooter, clUiGrid, clUiHeader, _sfc_main$7 as clUiHeaderMenu, ClUiInput as clUiInput, _sfc_main$6 as clUiLanguageSwitcher, ClUiLoadingSpinner as clUiLoadingSpinner, _sfc_main$5 as clUiLogin, _sfc_main$k as clUiModal, clUiNavigation, _sfc_main$2 as clUiNavigationGroup, _sfc_main$3 as clUiNavigationIcon, clUiNavigationItem, clUiNavigationSection, _sfc_main$s as clUiNotification, compareByProperty, copy, datetimeFormats, install as default, filterMethodTypes, generateStringId, getParamsByName, gridColumnTypes, i18n, inputTypes, isComboBoxCreateRequest, isComboBoxItem, isFilterRequest, isFilterResponse, isGridColumn, isGridColumnArray, isLanguageArray, isLanguageLocaleFormat, messages, modalColours, modalSizes, nameOf, numberFormats, setCurrentLocale, setLocaleDateTimeFormats, setLocaleMessages, setLocaleNumberFormats, showNotification, stringFormats, useDebouncer, validateEmail, validateMaxValue, validateMinValue };