@citruslime/ui 4.1.0-beta.8 → 4.1.0-beta.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -414,7 +414,7 @@ const _sfc_main$19 = /* @__PURE__ */ defineComponent({
414
414
  ])) : _ctx.errors || _ctx.$slots.helpText ? (openBlock(), createElementBlock("div", _hoisted_7$9, [
415
415
  createElementVNode("span", _hoisted_8$8, [
416
416
  renderSlot(_ctx.$slots, "helpText", {}, () => [
417
- _cache[0] || (_cache[0] = createTextVNode(" "))
417
+ _cache[0] || (_cache[0] = createTextVNode(" ", -1))
418
418
  ])
419
419
  ])
420
420
  ])) : createCommentVNode("", true)
@@ -448,9 +448,8 @@ const _sfc_main$18 = /* @__PURE__ */ defineComponent({
448
448
  const inputRef = ref();
449
449
  const { focused } = useFocusWithin(inputRef);
450
450
  watch(focused, () => {
451
- var _a;
452
451
  if (focused.value && props.selectOnFocus) {
453
- (_a = inputRef.value) == null ? void 0 : _a.select();
452
+ inputRef.value?.select();
454
453
  }
455
454
  });
456
455
  onKeyDown(true, (e) => emit("keySinglePress", e.key), {
@@ -458,18 +457,9 @@ const _sfc_main$18 = /* @__PURE__ */ defineComponent({
458
457
  dedupe: true
459
458
  });
460
459
  __expose({
461
- focus: () => {
462
- var _a;
463
- return (_a = inputRef.value) == null ? void 0 : _a.focus();
464
- },
465
- blur: () => {
466
- var _a;
467
- return (_a = inputRef.value) == null ? void 0 : _a.blur();
468
- },
469
- select: () => {
470
- var _a;
471
- return (_a = inputRef.value) == null ? void 0 : _a.select();
472
- }
460
+ focus: () => inputRef.value?.focus(),
461
+ blur: () => inputRef.value?.blur(),
462
+ select: () => inputRef.value?.select()
473
463
  });
474
464
  return (_ctx, _cache) => {
475
465
  return openBlock(), createBlock(_sfc_main$19, {
@@ -545,21 +535,29 @@ function useFocusTrap(target, options = {}) {
545
535
  (els) => {
546
536
  if (!els.length)
547
537
  return;
548
- trap = createFocusTrap(els, {
549
- ...focusTrapOptions,
550
- onActivate() {
551
- hasFocus.value = true;
552
- if (options.onActivate)
553
- options.onActivate();
554
- },
555
- onDeactivate() {
556
- hasFocus.value = false;
557
- if (options.onDeactivate)
558
- options.onDeactivate();
538
+ if (!trap) {
539
+ trap = createFocusTrap(els, {
540
+ ...focusTrapOptions,
541
+ onActivate() {
542
+ hasFocus.value = true;
543
+ if (options.onActivate)
544
+ options.onActivate();
545
+ },
546
+ onDeactivate() {
547
+ hasFocus.value = false;
548
+ if (options.onDeactivate)
549
+ options.onDeactivate();
550
+ }
551
+ });
552
+ if (immediate)
553
+ activate();
554
+ } else {
555
+ const isActive = trap == null ? void 0 : trap.active;
556
+ trap == null ? void 0 : trap.updateContainerElements(els);
557
+ if (!isActive && immediate) {
558
+ activate();
559
559
  }
560
- });
561
- if (immediate)
562
- activate();
560
+ }
563
561
  },
564
562
  { flush: "post" }
565
563
  );
@@ -747,21 +745,14 @@ const _sfc_main$15 = /* @__PURE__ */ defineComponent({
747
745
  setup(__props, { emit: __emit }) {
748
746
  const props = __props;
749
747
  const emit = __emit;
750
- const displayedText = computed(() => {
751
- var _a;
752
- return ((_a = props.option) == null ? void 0 : _a.name) ?? props.text;
753
- });
754
- const displayedParent = computed(() => {
755
- var _a;
756
- return ((_a = props.option) == null ? void 0 : _a.parentName) ?? "";
757
- });
748
+ const displayedText = computed(() => props.option?.name ?? props.text);
749
+ const displayedParent = computed(() => props.option?.parentName ?? "");
758
750
  const isHighlighted = ref(false);
759
751
  function optionSelected() {
760
- var _a;
761
752
  if (props.isCreateNewOption === true) {
762
753
  emit("create-object");
763
754
  } else {
764
- emit("select-object", (_a = props.option) == null ? void 0 : _a.id);
755
+ emit("select-object", props.option?.id);
765
756
  }
766
757
  }
767
758
  function onHover(hovered) {
@@ -783,7 +774,6 @@ const _sfc_main$15 = /* @__PURE__ */ defineComponent({
783
774
  }
784
775
  watch(() => props.selectedIndex, () => updateHighlight());
785
776
  return (_ctx, _cache) => {
786
- var _a, _b;
787
777
  return openBlock(), createElementBlock("div", {
788
778
  class: normalizeClass(["cl:cursor-pointer cl:duration-75 cl:flex cl:p-1 cl:text-left cl:transition-colors", {
789
779
  "cl:bg-white": isHighlighted.value === false,
@@ -794,7 +784,7 @@ const _sfc_main$15 = /* @__PURE__ */ defineComponent({
794
784
  onMousemove: _cache[0] || (_cache[0] = ($event) => onHover(true)),
795
785
  onMouseleave: _cache[1] || (_cache[1] = ($event) => onHover(false))
796
786
  }, [
797
- _ctx.option !== null && ((_a = _ctx.option) == null ? void 0 : _a.parentId) !== 0 && ((_b = _ctx.option) == null ? void 0 : _b.parentId) !== void 0 ? (openBlock(), createElementBlock("div", _hoisted_1$T, toDisplayString(displayedParent.value), 1)) : createCommentVNode("", true),
787
+ _ctx.option !== null && _ctx.option?.parentId !== 0 && _ctx.option?.parentId !== void 0 ? (openBlock(), createElementBlock("div", _hoisted_1$T, toDisplayString(displayedParent.value), 1)) : createCommentVNode("", true),
798
788
  createElementVNode("div", {
799
789
  class: normalizeClass({
800
790
  "cl:w-1/2": displayedParent.value !== "",
@@ -903,10 +893,9 @@ const _sfc_main$14 = /* @__PURE__ */ defineComponent({
903
893
  }
904
894
  }
905
895
  function scroll() {
906
- var _a;
907
896
  if (props.results && props.results.length > 1) {
908
897
  const heightOffset = 34;
909
- (_a = container.value) == null ? void 0 : _a.scrollTo(0, (currentSelection.value + 1) * heightOffset - heightOffset * 2);
898
+ container.value?.scrollTo(0, (currentSelection.value + 1) * heightOffset - heightOffset * 2);
910
899
  }
911
900
  }
912
901
  function updateAddNewOption() {
@@ -923,25 +912,15 @@ const _sfc_main$14 = /* @__PURE__ */ defineComponent({
923
912
  if (props.isVisible === true) {
924
913
  searchText.value = "";
925
914
  search();
926
- nextTick(() => {
927
- var _a, _b;
928
- return (_b = (_a = container.value) == null ? void 0 : _a.querySelector("input")) == null ? void 0 : _b.focus();
929
- });
915
+ nextTick(() => container.value?.querySelector("input")?.focus());
930
916
  }
931
917
  }
932
918
  watch(() => props.results, () => updateAddNewOption());
933
919
  watch(() => props.errorMessage, () => updateAddNewOption());
934
920
  watch(() => props.isVisible, () => onVisibilityChanged());
935
- onMounted(() => {
936
- var _a;
937
- return (_a = container.value) == null ? void 0 : _a.addEventListener("keydown", onKeyboardShiftTab);
938
- });
939
- onUnmounted(() => {
940
- var _a;
941
- return (_a = container.value) == null ? void 0 : _a.removeEventListener("keydown", onKeyboardShiftTab);
942
- });
921
+ onMounted(() => container.value?.addEventListener("keydown", onKeyboardShiftTab));
922
+ onUnmounted(() => container.value?.removeEventListener("keydown", onKeyboardShiftTab));
943
923
  return (_ctx, _cache) => {
944
- var _a;
945
924
  return _ctx.isVisible ? (openBlock(), createElementBlock("div", {
946
925
  key: 0,
947
926
  ref_key: "container",
@@ -970,9 +949,9 @@ const _sfc_main$14 = /* @__PURE__ */ defineComponent({
970
949
  onKeyup: search,
971
950
  onBlur: hideDropdown
972
951
  }, {
973
- default: withCtx(() => _cache[4] || (_cache[4] = [
952
+ default: withCtx(() => [..._cache[4] || (_cache[4] = [
974
953
  createElementVNode("span", null, null, -1)
975
- ])),
954
+ ])]),
976
955
  _: 1
977
956
  }, 8, ["id", "modelValue", "placeholder"])
978
957
  ])
@@ -989,7 +968,7 @@ const _sfc_main$14 = /* @__PURE__ */ defineComponent({
989
968
  "additional-text": _ctx.objectParentType,
990
969
  class: "cl:bg-grey-2 cl:mt-1"
991
970
  }, null, 8, ["text", "additional-text"])) : createCommentVNode("", true),
992
- _ctx.results !== null && ((_a = _ctx.results) == null ? void 0 : _a.length) === 0 && searchText.value.trim() !== "" && _ctx.canCreateNewObject === false && _ctx.errorMessage === "" ? (openBlock(), createBlock(_sfc_main$16, {
971
+ _ctx.results !== null && _ctx.results?.length === 0 && searchText.value.trim() !== "" && _ctx.canCreateNewObject === false && _ctx.errorMessage === "" ? (openBlock(), createBlock(_sfc_main$16, {
993
972
  key: 3,
994
973
  text: unref(t2)("comboBox.noResults", { value: searchText.value })
995
974
  }, null, 8, ["text"])) : createCommentVNode("", true),
@@ -1079,8 +1058,7 @@ const _sfc_main$13 = /* @__PURE__ */ defineComponent({
1079
1058
  const objectToCreateValid = ref(true);
1080
1059
  const comboBoxBottomOfView = ref(false);
1081
1060
  function toggleDropdown(forcedState) {
1082
- var _a;
1083
- const comboPosition = ((_a = outsideRef.value) == null ? void 0 : _a.getBoundingClientRect().top) || 0;
1061
+ const comboPosition = outsideRef.value?.getBoundingClientRect().top || 0;
1084
1062
  comboBoxBottomOfView.value = window.innerHeight - comboPosition < 280;
1085
1063
  if (!props.disabled) {
1086
1064
  if (typeof forcedState !== "undefined") {
@@ -1103,12 +1081,11 @@ const _sfc_main$13 = /* @__PURE__ */ defineComponent({
1103
1081
  toggleDropdown(false);
1104
1082
  }
1105
1083
  function selectObject(id2) {
1106
- var _a;
1107
1084
  const item = getComboBoxItemById(id2 ?? 0);
1108
1085
  selectedItem.value = item;
1109
1086
  toggleDropdown(false);
1110
1087
  if (!props.openDropDownOnFocus) {
1111
- (_a = inputRef.value) == null ? void 0 : _a.focus();
1088
+ inputRef.value?.focus();
1112
1089
  }
1113
1090
  }
1114
1091
  function getComboBoxItemById(id2) {
@@ -1124,10 +1101,9 @@ const _sfc_main$13 = /* @__PURE__ */ defineComponent({
1124
1101
  return currentItem;
1125
1102
  }
1126
1103
  function createObject() {
1127
- var _a;
1128
1104
  createObjectRequest.value = {
1129
1105
  name: objectToCreateValue.value,
1130
- parentId: ((_a = parentItem.value) == null ? void 0 : _a.id) ?? 0
1106
+ parentId: parentItem.value?.id ?? 0
1131
1107
  };
1132
1108
  emit("create-object", createObjectRequest.value);
1133
1109
  }
@@ -1139,8 +1115,7 @@ const _sfc_main$13 = /* @__PURE__ */ defineComponent({
1139
1115
  emit("create-parent-object", createObjectRequest.value);
1140
1116
  }
1141
1117
  function handleObjectCreateResponse() {
1142
- var _a, _b;
1143
- if ((_a = props.objectCreatedResponse) == null ? void 0 : _a.error) {
1118
+ if (props.objectCreatedResponse?.error) {
1144
1119
  showNotification({
1145
1120
  message: t2("comboBox.createFailed", {
1146
1121
  name: objectToCreateValue.value,
@@ -1149,13 +1124,12 @@ const _sfc_main$13 = /* @__PURE__ */ defineComponent({
1149
1124
  colour: "danger",
1150
1125
  duration: 1e4
1151
1126
  });
1152
- } else if ((_b = props.objectCreatedResponse) == null ? void 0 : _b.id) {
1127
+ } else if (props.objectCreatedResponse?.id) {
1153
1128
  handleSuccessfulObjectCreation();
1154
1129
  }
1155
1130
  }
1156
1131
  function handleParentObjectCreateResponse() {
1157
- var _a;
1158
- if ((_a = props.parentObjectCreatedResponse) == null ? void 0 : _a.id) {
1132
+ if (props.parentObjectCreatedResponse?.id) {
1159
1133
  parentItem.value = {
1160
1134
  id: props.parentObjectCreatedResponse.id,
1161
1135
  name: props.parentObjectCreatedResponse.name ?? ""
@@ -1163,23 +1137,22 @@ const _sfc_main$13 = /* @__PURE__ */ defineComponent({
1163
1137
  }
1164
1138
  }
1165
1139
  function handleSuccessfulObjectCreation() {
1166
- var _a, _b, _c, _d, _e;
1167
1140
  showNotification({
1168
1141
  message: t2("comboBox.createSuccessful", {
1169
1142
  object: props.objectType,
1170
- name: ((_a = props.objectCreatedResponse) == null ? void 0 : _a.name) ?? ""
1143
+ name: props.objectCreatedResponse?.name ?? ""
1171
1144
  }),
1172
1145
  colour: "primary",
1173
1146
  duration: 1e4
1174
1147
  });
1175
1148
  let parentName = "";
1176
- if (parentItem.value && parentItem.value.id === ((_b = props.objectCreatedResponse) == null ? void 0 : _b.parentId)) {
1149
+ if (parentItem.value && parentItem.value.id === props.objectCreatedResponse?.parentId) {
1177
1150
  parentName = parentItem.value.name;
1178
1151
  }
1179
1152
  selectedItem.value = {
1180
- id: ((_c = props.objectCreatedResponse) == null ? void 0 : _c.id) ?? 0,
1181
- name: ((_d = props.objectCreatedResponse) == null ? void 0 : _d.name) ?? "",
1182
- parentId: ((_e = props.objectCreatedResponse) == null ? void 0 : _e.parentId) ?? 0,
1153
+ id: props.objectCreatedResponse?.id ?? 0,
1154
+ name: props.objectCreatedResponse?.name ?? "",
1155
+ parentId: props.objectCreatedResponse?.parentId ?? 0,
1183
1156
  parentName
1184
1157
  };
1185
1158
  }
@@ -1216,10 +1189,9 @@ const _sfc_main$13 = /* @__PURE__ */ defineComponent({
1216
1189
  });
1217
1190
  const inputRef = ref();
1218
1191
  function handleEscapeKeyPress() {
1219
- var _a;
1220
1192
  toggleDropdown(false);
1221
1193
  if (!props.openDropDownOnFocus) {
1222
- (_a = inputRef.value) == null ? void 0 : _a.focus();
1194
+ inputRef.value?.focus();
1223
1195
  }
1224
1196
  }
1225
1197
  function focusInternal() {
@@ -1229,10 +1201,7 @@ const _sfc_main$13 = /* @__PURE__ */ defineComponent({
1229
1201
  emit("focus");
1230
1202
  }
1231
1203
  __expose({
1232
- focus: () => {
1233
- var _a;
1234
- return (_a = inputRef.value) == null ? void 0 : _a.focus();
1235
- }
1204
+ focus: () => inputRef.value?.focus()
1236
1205
  });
1237
1206
  return (_ctx, _cache) => {
1238
1207
  const _component_cl_ui_combo_box = resolveComponent("cl-ui-combo-box", true);
@@ -1258,9 +1227,9 @@ const _sfc_main$13 = /* @__PURE__ */ defineComponent({
1258
1227
  onFocus: focusInternal,
1259
1228
  onKeydown: _cache[2] || (_cache[2] = withKeys(($event) => toggleDropdown(true), ["enter"]))
1260
1229
  }, {
1261
- default: withCtx(() => _cache[8] || (_cache[8] = [
1230
+ default: withCtx(() => [..._cache[8] || (_cache[8] = [
1262
1231
  createElementVNode("span", null, null, -1)
1263
- ])),
1232
+ ])]),
1264
1233
  _: 1
1265
1234
  }, 8, ["id", "modelValue", "class", "placeholder", "disabled"])
1266
1235
  ]),
@@ -1455,17 +1424,14 @@ const _sfc_main$$ = /* @__PURE__ */ defineComponent({
1455
1424
  setup(__props) {
1456
1425
  return (_ctx, _cache) => {
1457
1426
  return openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.rows, (row) => {
1458
- return openBlock(), createElementBlock("div", mergeProps({
1459
- key: row,
1460
- ref_for: true
1461
- }, _ctx.$attrs, { class: "cl:flex cl:gap-1 cl:items-start" }), [
1427
+ return openBlock(), createElementBlock("div", mergeProps({ key: row }, { ref_for: true }, _ctx.$attrs, { class: "cl:flex cl:gap-1 cl:items-start" }), [
1462
1428
  (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.words, (word) => {
1463
1429
  return openBlock(), createElementBlock("span", {
1464
1430
  key: word,
1465
1431
  class: "cl:rounded-full cl:w-16 skeleton-loader-background"
1466
1432
  }, [
1467
1433
  renderSlot(_ctx.$slots, "default", {}, () => [
1468
- _cache[0] || (_cache[0] = createTextVNode("   "))
1434
+ _cache[0] || (_cache[0] = createTextVNode("   ", -1))
1469
1435
  ])
1470
1436
  ]);
1471
1437
  }), 128))
@@ -1647,14 +1613,8 @@ const _sfc_main$Z = /* @__PURE__ */ defineComponent({
1647
1613
  const emit = __emit;
1648
1614
  const inputRef = ref();
1649
1615
  __expose({
1650
- focus: () => {
1651
- var _a;
1652
- return (_a = inputRef.value) == null ? void 0 : _a.focus();
1653
- },
1654
- blur: () => {
1655
- var _a;
1656
- return (_a = inputRef.value) == null ? void 0 : _a.blur();
1657
- }
1616
+ focus: () => inputRef.value?.focus(),
1617
+ blur: () => inputRef.value?.blur()
1658
1618
  });
1659
1619
  return (_ctx, _cache) => {
1660
1620
  return openBlock(), createBlock(_sfc_main$19, {
@@ -2071,11 +2031,10 @@ function getPartsForValue(intlFormat, value, ...types) {
2071
2031
  return intlFormat.formatToParts(value).filter((part) => types.includes(part.type)).map((part) => part.value);
2072
2032
  }
2073
2033
  function callNumberFormatterImpl(value, options) {
2074
- var _a;
2075
2034
  if (isNaN(value)) {
2076
2035
  return "";
2077
2036
  } else {
2078
- return ((_a = newNumberFormatImpl(options)) == null ? void 0 : _a.format(value)) ?? null;
2037
+ return newNumberFormatImpl(options)?.format(value) ?? null;
2079
2038
  }
2080
2039
  }
2081
2040
  function newNumberFormatImpl(options) {
@@ -2087,9 +2046,9 @@ function newNumberFormatImpl(options) {
2087
2046
  }
2088
2047
  }
2089
2048
  function buildFormatOptions(format, options) {
2090
- const normalisedLocale = toValue(options == null ? void 0 : options.locale) || unref(locale);
2049
+ const normalisedLocale = toValue(options?.locale) || unref(locale);
2091
2050
  const i18nFormat = getNumberFormat(normalisedLocale);
2092
- const additionalOptions = copy(toValue(options == null ? void 0 : options.additionalOptions) ?? {});
2051
+ const additionalOptions = copy(toValue(options?.additionalOptions) ?? {});
2093
2052
  let style = "decimal";
2094
2053
  switch (format) {
2095
2054
  case NumberFormat.PERCENTAGE:
@@ -2143,7 +2102,7 @@ function CitrusLimeUI() {
2143
2102
  }
2144
2103
  const { t } = i18n.global;
2145
2104
  function validateMinValue(minimumValue, typeOfValue, valueName, actualValue, timeZone) {
2146
- return new Promise((resolve) => {
2105
+ return new Promise(((resolve) => {
2147
2106
  let validatedState = {
2148
2107
  valid: false,
2149
2108
  message: ""
@@ -2159,7 +2118,7 @@ function validateMinValue(minimumValue, typeOfValue, valueName, actualValue, tim
2159
2118
  case "tel":
2160
2119
  case "text":
2161
2120
  case "url":
2162
- isValid = ((actualValue == null ? void 0 : actualValue.length) ?? 0) >= (Number(minimumValue) || 0);
2121
+ isValid = (actualValue?.length ?? 0) >= (Number(minimumValue) || 0);
2163
2122
  validatedState = getValidatedInputState(isValid, t("input.greaterOrEqualToCharacters", {
2164
2123
  label: valueName,
2165
2124
  min: minimumValue.toString()
@@ -2218,10 +2177,10 @@ function validateMinValue(minimumValue, typeOfValue, valueName, actualValue, tim
2218
2177
  }
2219
2178
  }
2220
2179
  resolve(validatedState);
2221
- });
2180
+ }));
2222
2181
  }
2223
2182
  function validateMaxValue(maximumValue, typeOfValue, valueName, actualValue, timeZone) {
2224
- return new Promise((resolve) => {
2183
+ return new Promise(((resolve) => {
2225
2184
  let validatedState = {
2226
2185
  valid: false,
2227
2186
  message: ""
@@ -2237,7 +2196,7 @@ function validateMaxValue(maximumValue, typeOfValue, valueName, actualValue, tim
2237
2196
  case "tel":
2238
2197
  case "text":
2239
2198
  case "url":
2240
- isValid = ((actualValue == null ? void 0 : actualValue.length) ?? 0) <= (Number(maximumValue) || 0);
2199
+ isValid = (actualValue?.length ?? 0) <= (Number(maximumValue) || 0);
2241
2200
  validatedState = getValidatedInputState(isValid, t("input.lessOrEqualToCharacters", {
2242
2201
  label: valueName,
2243
2202
  max: maximumValue.toString()
@@ -2293,22 +2252,22 @@ function validateMaxValue(maximumValue, typeOfValue, valueName, actualValue, tim
2293
2252
  }
2294
2253
  }
2295
2254
  resolve(validatedState);
2296
- });
2255
+ }));
2297
2256
  }
2298
2257
  function validateRequired(valueName, value) {
2299
- return new Promise((resolve) => {
2258
+ return new Promise(((resolve) => {
2300
2259
  const isValid = value !== void 0 && value !== null && value !== "" && value.toString().trim() !== "";
2301
2260
  const validatedState = getValidatedInputState(isValid, t("input.valueIsRequired", { label: valueName }));
2302
2261
  resolve(validatedState);
2303
- });
2262
+ }));
2304
2263
  }
2305
2264
  function validateEmail(valueName, value) {
2306
- return new Promise((resolve) => {
2265
+ return new Promise(((resolve) => {
2307
2266
  const regex = /[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?\.)+[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?/;
2308
2267
  const isValid = value === "" || regex.exec(value) !== null;
2309
2268
  const validatedState = getValidatedInputState(isValid, t("input.valueNotValidEmail", { label: valueName }));
2310
2269
  resolve(validatedState);
2311
- });
2270
+ }));
2312
2271
  }
2313
2272
  function getValidatedInputState(validationCheck, message) {
2314
2273
  const validation = {
@@ -2351,11 +2310,11 @@ const _sfc_main$Y = /* @__PURE__ */ defineComponent({
2351
2310
  let date;
2352
2311
  if (props.timeZone) {
2353
2312
  date = DateTime.fromISO(value, {
2354
- locale: (dateFormatLocaleOverride == null ? void 0 : dateFormatLocaleOverride.value) ?? locale2.value
2313
+ locale: dateFormatLocaleOverride?.value ?? locale2.value
2355
2314
  }).setZone(props.timeZone);
2356
2315
  } else {
2357
2316
  date = DateTime.fromISO(value, {
2358
- locale: (dateFormatLocaleOverride == null ? void 0 : dateFormatLocaleOverride.value) ?? locale2.value,
2317
+ locale: dateFormatLocaleOverride?.value ?? locale2.value,
2359
2318
  zone: "UTC"
2360
2319
  });
2361
2320
  }
@@ -2419,7 +2378,6 @@ const _sfc_main$Y = /* @__PURE__ */ defineComponent({
2419
2378
  }
2420
2379
  }
2421
2380
  return (_ctx, _cache) => {
2422
- var _a;
2423
2381
  return _ctx.column.type === "slot" ? renderSlot(_ctx.$slots, _ctx.column.name, {
2424
2382
  key: 0,
2425
2383
  formattedStringContent: formatString()
@@ -2436,7 +2394,7 @@ const _sfc_main$Y = /* @__PURE__ */ defineComponent({
2436
2394
  ], 64)) : (openBlock(), createElementBlock(Fragment, { key: 2 }, [
2437
2395
  createTextVNode(toDisplayString(formatDate(_ctx.data[_ctx.column.field], unref(DateFormat).DATETIME)), 1)
2438
2396
  ], 64))
2439
- ], 64)) : _ctx.column.type === "list" && _ctx.column.field !== void 0 && _ctx.column.listEntries !== void 0 ? (openBlock(), createElementBlock("span", _hoisted_1$L, toDisplayString(unref(t2)(((_a = _ctx.column.listEntries.find((entry) => entry.value === _ctx.data[_ctx.column.field])) == null ? void 0 : _a.translationKey) ?? "")), 1)) : _ctx.column.type === "number" && _ctx.column.field !== void 0 ? (openBlock(), createElementBlock("span", _hoisted_2$A, toDisplayString(formatNumberToString(_ctx.data[_ctx.column.field], unref(locale2))), 1)) : _ctx.column.field !== void 0 ? (openBlock(), createElementBlock("span", _hoisted_3$n, [
2397
+ ], 64)) : _ctx.column.type === "list" && _ctx.column.field !== void 0 && _ctx.column.listEntries !== void 0 ? (openBlock(), createElementBlock("span", _hoisted_1$L, toDisplayString(unref(t2)(_ctx.column.listEntries.find((entry) => entry.value === _ctx.data[_ctx.column.field])?.translationKey ?? "")), 1)) : _ctx.column.type === "number" && _ctx.column.field !== void 0 ? (openBlock(), createElementBlock("span", _hoisted_2$A, toDisplayString(formatNumberToString(_ctx.data[_ctx.column.field], unref(locale2))), 1)) : _ctx.column.field !== void 0 ? (openBlock(), createElementBlock("span", _hoisted_3$n, [
2440
2398
  createElementVNode("span", {
2441
2399
  title: showUntruncatedStringValue.value ? _ctx.data[_ctx.column.field] : void 0,
2442
2400
  innerHTML: formatString()
@@ -2463,13 +2421,10 @@ const _sfc_main$X = /* @__PURE__ */ defineComponent({
2463
2421
  const { t: t2 } = useI18n();
2464
2422
  const currentRecord = ref(copy(props.data));
2465
2423
  const edited = computed(() => props.column.field !== void 0 && currentRecord.value[props.column.field] !== props.data[props.column.field]);
2466
- const listEntries = computed(() => {
2467
- var _a;
2468
- return ((_a = props.column.listEntries) == null ? void 0 : _a.map((entry, id) => ({
2469
- id,
2470
- name: t2(entry.translationKey)
2471
- }))) ?? [];
2472
- });
2424
+ const listEntries = computed(() => props.column.listEntries?.map((entry, id) => ({
2425
+ id,
2426
+ name: t2(entry.translationKey)
2427
+ })) ?? []);
2473
2428
  watchEffect(() => currentRecord.value = copy(props.data));
2474
2429
  watch(currentRecord, (newValue) => {
2475
2430
  const property = props.column.field ?? "";
@@ -2679,22 +2634,19 @@ const _sfc_main$V = /* @__PURE__ */ defineComponent({
2679
2634
  }
2680
2635
  }
2681
2636
  const clickCounters = ref({});
2682
- watch(() => props.data, () => {
2683
- var _a, _b;
2684
- return clickCounters.value = Object.fromEntries(((_b = (_a = props.data) == null ? void 0 : _a.results) == null ? void 0 : _b.map((_, i) => [
2685
- [i],
2686
- {
2687
- count: 0,
2688
- target: null,
2689
- reset: useTimeoutFn(() => {
2690
- if (clickCounters.value[i]) {
2691
- clickCounters.value[i].count = 0;
2692
- clickCounters.value[i].target = null;
2693
- }
2694
- }, 400, { immediate: false })
2695
- }
2696
- ])) ?? []);
2697
- }, {
2637
+ watch(() => props.data, () => clickCounters.value = Object.fromEntries(props.data?.results?.map((_, i) => [
2638
+ [i],
2639
+ {
2640
+ count: 0,
2641
+ target: null,
2642
+ reset: useTimeoutFn(() => {
2643
+ if (clickCounters.value[i]) {
2644
+ clickCounters.value[i].count = 0;
2645
+ clickCounters.value[i].target = null;
2646
+ }
2647
+ }, 400, { immediate: false })
2648
+ }
2649
+ ]) ?? []), {
2698
2650
  deep: true,
2699
2651
  immediate: true
2700
2652
  });
@@ -2716,10 +2668,9 @@ const _sfc_main$V = /* @__PURE__ */ defineComponent({
2716
2668
  }
2717
2669
  }
2718
2670
  function handleRowSelect(rowIndex, row, event) {
2719
- var _a;
2720
2671
  const { target } = event;
2721
2672
  if (target && target instanceof HTMLElement) {
2722
- const rowspan = (_a = target.closest("td")) == null ? void 0 : _a.getAttribute("rowspan");
2673
+ const rowspan = target.closest("td")?.getAttribute("rowspan");
2723
2674
  if (rowspan && parseInt(rowspan) > 1) {
2724
2675
  return;
2725
2676
  }
@@ -2734,15 +2685,13 @@ const _sfc_main$V = /* @__PURE__ */ defineComponent({
2734
2685
  selectedRowIndex.value = void 0;
2735
2686
  }
2736
2687
  function displayBorderForEndOfGroup(data, index2) {
2737
- var _a;
2738
- const grouping = (_a = props.options) == null ? void 0 : _a.groupByField;
2688
+ const grouping = props.options?.groupByField;
2739
2689
  const currentRow = data.results[index2];
2740
2690
  const nextRow = data.results[index2 + 1];
2741
2691
  return !!grouping && index2 < data.results.length - 1 && currentRow[grouping] !== nextRow[grouping];
2742
2692
  }
2743
2693
  function getGroupGridAreaSpan(data, index2) {
2744
- var _a;
2745
- const grouping = (_a = props.options) == null ? void 0 : _a.groupByField;
2694
+ const grouping = props.options?.groupByField;
2746
2695
  if (grouping) {
2747
2696
  const previousRow = data.results[index2 - 1];
2748
2697
  const currentRow = data.results[index2];
@@ -2763,13 +2712,11 @@ const _sfc_main$V = /* @__PURE__ */ defineComponent({
2763
2712
  watch(() => props.options.rowSelectionEnabled, clearSelectedRow);
2764
2713
  watch(() => props.request, clearSelectedRow);
2765
2714
  watch(selectedRowIndex, () => {
2766
- var _a;
2767
- if (selectedRowIndex.value !== void 0 && ((_a = props.data) == null ? void 0 : _a.results[selectedRowIndex.value])) {
2715
+ if (selectedRowIndex.value !== void 0 && props.data?.results[selectedRowIndex.value]) {
2768
2716
  emit("row-select", props.data.results[selectedRowIndex.value]);
2769
2717
  }
2770
2718
  });
2771
2719
  return (_ctx, _cache) => {
2772
- var _a;
2773
2720
  return openBlock(), createElementBlock("tbody", null, [
2774
2721
  _ctx.initialLoad ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(_ctx.request.pageSize, (row) => {
2775
2722
  return openBlock(), createElementBlock("tr", { key: row }, [
@@ -2784,9 +2731,8 @@ const _sfc_main$V = /* @__PURE__ */ defineComponent({
2784
2731
  }, "   ", 10, _hoisted_1$K)
2785
2732
  ]);
2786
2733
  }), 128)) : createCommentVNode("", true),
2787
- _ctx.data && ((_a = _ctx.data.results) == null ? void 0 : _a.length) && !_ctx.initialLoad ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
2734
+ _ctx.data && _ctx.data.results?.length && !_ctx.initialLoad ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
2788
2735
  (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.data.results, (row, index2) => {
2789
- var _a2;
2790
2736
  return openBlock(), createBlock(_sfc_main$W, {
2791
2737
  key: index2,
2792
2738
  data: row,
@@ -2804,7 +2750,7 @@ const _sfc_main$V = /* @__PURE__ */ defineComponent({
2804
2750
  "cl:border-b-2 cl:border-solid cl:border-primary-dark": displayBorderForEndOfGroup(_ctx.data, index2)
2805
2751
  }]),
2806
2752
  "row-index": index2,
2807
- "group-by": ((_a2 = _ctx.options) == null ? void 0 : _a2.groupByField) ?? "",
2753
+ "group-by": _ctx.options?.groupByField ?? "",
2808
2754
  "group-grid-area-span": getGroupGridAreaSpan(_ctx.data, index2),
2809
2755
  onClick: ($event) => {
2810
2756
  _ctx.editMode ? () => {
@@ -2914,8 +2860,7 @@ const _sfc_main$U = /* @__PURE__ */ defineComponent({
2914
2860
  stagingValueChanged.value = false;
2915
2861
  if (selectInputValueTriggered.value || props.selectOnFocus || modelValue.value === 0) {
2916
2862
  setTimeout(() => {
2917
- var _a, _b;
2918
- (_b = inputRef.value) == null ? void 0 : _b.setSelectionRange(0, ((_a = stagingValue.value) == null ? void 0 : _a.length) ?? 0);
2863
+ inputRef.value?.setSelectionRange(0, stagingValue.value?.length ?? 0);
2919
2864
  });
2920
2865
  }
2921
2866
  selectInputValueTriggered.value = false;
@@ -3003,19 +2948,12 @@ const _sfc_main$U = /* @__PURE__ */ defineComponent({
3003
2948
  }
3004
2949
  const selectInputValueTriggered = ref(false);
3005
2950
  function selectInputValue() {
3006
- var _a;
3007
2951
  selectInputValueTriggered.value = true;
3008
- (_a = inputRef.value) == null ? void 0 : _a.focus();
2952
+ inputRef.value?.focus();
3009
2953
  }
3010
2954
  __expose({
3011
- focus: () => {
3012
- var _a;
3013
- return (_a = inputRef.value) == null ? void 0 : _a.focus();
3014
- },
3015
- blur: () => {
3016
- var _a;
3017
- return (_a = inputRef.value) == null ? void 0 : _a.blur();
3018
- },
2955
+ focus: () => inputRef.value?.focus(),
2956
+ blur: () => inputRef.value?.blur(),
3019
2957
  select: () => selectInputValue()
3020
2958
  });
3021
2959
  return (_ctx, _cache) => {
@@ -3143,10 +3081,7 @@ const _sfc_main$T = /* @__PURE__ */ defineComponent({
3143
3081
  const props = __props;
3144
3082
  const emit = __emit;
3145
3083
  const { t: t2 } = useI18n();
3146
- const totalPages = computed(() => {
3147
- var _a;
3148
- return props.data !== null ? Math.ceil((((_a = props.data) == null ? void 0 : _a.totalRecords) ?? 0) / props.request.pageSize) : 1;
3149
- });
3084
+ const totalPages = computed(() => props.data !== null ? Math.ceil((props.data?.totalRecords ?? 0) / props.request.pageSize) : 1);
3150
3085
  const pageNumbers = computed(() => {
3151
3086
  const calculatedPageNumbers = Array.from(Array(totalPages.value + 1).keys());
3152
3087
  let results = [];
@@ -3161,7 +3096,7 @@ const _sfc_main$T = /* @__PURE__ */ defineComponent({
3161
3096
  function setPage(pageNumber) {
3162
3097
  if (props.showUnsavedChangesWarning === false || window.confirm(t2("grid.unsavedChangesWarningMessage"))) {
3163
3098
  const filterRequest = copy(props.request);
3164
- pageNumber ?? (pageNumber = 1);
3099
+ pageNumber ??= 1;
3165
3100
  if (filterRequest.pageNumber !== pageNumber) {
3166
3101
  filterRequest.pageNumber = Math.max(Math.min(Math.trunc(pageNumber), totalPages.value), 1);
3167
3102
  emit("update:request", filterRequest);
@@ -3185,7 +3120,6 @@ const _sfc_main$T = /* @__PURE__ */ defineComponent({
3185
3120
  }
3186
3121
  }
3187
3122
  return (_ctx, _cache) => {
3188
- var _a, _b, _c;
3189
3123
  return _ctx.initialLoad ? (openBlock(), createElementBlock("div", _hoisted_1$I, [
3190
3124
  createElementVNode("div", _hoisted_2$x, [
3191
3125
  createVNode(unref(_sfc_main$$), { words: 3 }),
@@ -3197,7 +3131,7 @@ const _sfc_main$T = /* @__PURE__ */ defineComponent({
3197
3131
  createElementVNode("div", _hoisted_3$k, [
3198
3132
  createVNode(unref(clUiSkeletonInput), { class: "cl:w-64" })
3199
3133
  ])
3200
- ])) : _ctx.loading || ((_b = (_a = _ctx.data) == null ? void 0 : _a.results) == null ? void 0 : _b.length) && _ctx.request ? (openBlock(), createElementBlock("div", {
3134
+ ])) : _ctx.loading || _ctx.data?.results?.length && _ctx.request ? (openBlock(), createElementBlock("div", {
3201
3135
  key: 1,
3202
3136
  class: normalizeClass(["cl:flex cl:flex-wrap cl:lg:gap-2", {
3203
3137
  "cl:opacity-40": _ctx.loading
@@ -3213,7 +3147,7 @@ const _sfc_main$T = /* @__PURE__ */ defineComponent({
3213
3147
  ]),
3214
3148
  createElementVNode("div", _hoisted_10$3, [
3215
3149
  createElementVNode("span", _hoisted_11$3, toDisplayString(unref(t2)("grid.totalRecords")), 1),
3216
- createElementVNode("span", null, toDisplayString(unref(formatNumberAsInteger)(((_c = _ctx.data) == null ? void 0 : _c.totalRecords) ?? 0)), 1)
3150
+ createElementVNode("span", null, toDisplayString(unref(formatNumberAsInteger)(_ctx.data?.totalRecords ?? 0)), 1)
3217
3151
  ]),
3218
3152
  _ctx.options.hidePageSizeOptions === false ? (openBlock(), createElementBlock("div", _hoisted_12$1, [
3219
3153
  createElementVNode("span", _hoisted_13$1, toDisplayString(unref(t2)("grid.pageSize")), 1),
@@ -3311,9 +3245,9 @@ const _sfc_main$T = /* @__PURE__ */ defineComponent({
3311
3245
  autocomplete: "off",
3312
3246
  "onUpdate:modelValue": setPage
3313
3247
  }, {
3314
- default: withCtx(() => _cache[4] || (_cache[4] = [
3248
+ default: withCtx(() => [..._cache[4] || (_cache[4] = [
3315
3249
  createElementVNode("span", null, null, -1)
3316
- ])),
3250
+ ])]),
3317
3251
  _: 1
3318
3252
  }, 8, ["model-value", "max", "disabled"])
3319
3253
  ])
@@ -3420,7 +3354,7 @@ function convertDateToIsoString(dateToConvert, forcedTimeOfDay, includeOffset, s
3420
3354
  }
3421
3355
  let returnValue = returnValueDate.toISO({ includeOffset });
3422
3356
  if (selectedTimeZone === null) {
3423
- returnValue = (returnValue == null ? void 0 : returnValue.replace("Z", "")) ?? null;
3357
+ returnValue = returnValue?.replace("Z", "") ?? null;
3424
3358
  }
3425
3359
  return returnValue;
3426
3360
  }
@@ -3586,12 +3520,11 @@ const _sfc_main$S = /* @__PURE__ */ defineComponent({
3586
3520
  return (_ctx, _cache) => {
3587
3521
  return openBlock(), createElementBlock("div", _hoisted_1$H, [
3588
3522
  (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.dates, (date, index2) => {
3589
- var _a, _b;
3590
3523
  return openBlock(), createElementBlock("button", {
3591
3524
  key: index2,
3592
3525
  class: normalizeClass(["cl:border cl:cursor-pointer cl:py-1 cl:rounded-md cl:text-center", {
3593
- "cl:bg-primary-lighter/30 cl:border-primary-default cl:font-bold cl:hover:border-primary-darker": ((_a = _ctx.selectedQuickDate) == null ? void 0 : _a.name) === date.name,
3594
- "cl:border-grey-2 cl:hover:border-grey-3 cl:hover:opacity-95 cl:opacity-60": ((_b = _ctx.selectedQuickDate) == null ? void 0 : _b.name) !== date.name
3526
+ "cl:bg-primary-lighter/30 cl:border-primary-default cl:font-bold cl:hover:border-primary-darker": _ctx.selectedQuickDate?.name === date.name,
3527
+ "cl:border-grey-2 cl:hover:border-grey-3 cl:hover:opacity-95 cl:opacity-60": _ctx.selectedQuickDate?.name !== date.name
3595
3528
  }]),
3596
3529
  onClick: ($event) => emit("quick-date-selected", date)
3597
3530
  }, [
@@ -3831,14 +3764,8 @@ const _sfc_main$Q = /* @__PURE__ */ defineComponent({
3831
3764
  }
3832
3765
  }
3833
3766
  __expose({
3834
- focus: () => {
3835
- var _a;
3836
- return (_a = inputRef.value) == null ? void 0 : _a.focus();
3837
- },
3838
- blur: () => {
3839
- var _a;
3840
- return (_a = inputRef.value) == null ? void 0 : _a.blur();
3841
- }
3767
+ focus: () => inputRef.value?.focus(),
3768
+ blur: () => inputRef.value?.blur()
3842
3769
  });
3843
3770
  return (_ctx, _cache) => {
3844
3771
  return openBlock(), createBlock(_sfc_main$19, {
@@ -3925,19 +3852,12 @@ const _sfc_main$P = /* @__PURE__ */ defineComponent({
3925
3852
  const showRegularInput = ref(false);
3926
3853
  const displayValue = useThrottle(value, 50);
3927
3854
  function setValueAndFocus(newValue) {
3928
- var _a;
3929
3855
  value.value = newValue;
3930
- (_a = sliderRef.value) == null ? void 0 : _a.focus();
3856
+ sliderRef.value?.focus();
3931
3857
  }
3932
3858
  __expose({
3933
- focus: () => {
3934
- var _a, _b;
3935
- return ((_a = sliderRef.value) == null ? void 0 : _a.focus()) || ((_b = inputRef.value) == null ? void 0 : _b.focus());
3936
- },
3937
- blur: () => {
3938
- var _a, _b;
3939
- return ((_a = sliderRef.value) == null ? void 0 : _a.blur()) || ((_b = inputRef.value) == null ? void 0 : _b.blur());
3940
- }
3859
+ focus: () => sliderRef.value?.focus() || inputRef.value?.focus(),
3860
+ blur: () => sliderRef.value?.blur() || inputRef.value?.blur()
3941
3861
  });
3942
3862
  return (_ctx, _cache) => {
3943
3863
  const _component_icon = resolveComponent("icon");
@@ -4140,8 +4060,7 @@ const _sfc_main$N = /* @__PURE__ */ defineComponent({
4140
4060
  const props = __props;
4141
4061
  const element = ref(null);
4142
4062
  function focus() {
4143
- var _a;
4144
- (_a = element.value) == null ? void 0 : _a.focus();
4063
+ element.value?.focus();
4145
4064
  }
4146
4065
  const { t: t2 } = useI18n();
4147
4066
  const currentPlaceholder = computed(() => {
@@ -4319,8 +4238,7 @@ const _sfc_main$M = /* @__PURE__ */ defineComponent({
4319
4238
  });
4320
4239
  __expose({
4321
4240
  focus() {
4322
- var _a;
4323
- (_a = input.value) == null ? void 0 : _a.focus();
4241
+ input.value?.focus();
4324
4242
  }
4325
4243
  });
4326
4244
  return (_ctx, _cache) => {
@@ -4742,7 +4660,7 @@ const _sfc_main$J = /* @__PURE__ */ defineComponent({
4742
4660
  if (isSelectItem(item)) {
4743
4661
  return item.name;
4744
4662
  }
4745
- return item == null ? void 0 : item.toString();
4663
+ return item?.toString();
4746
4664
  }
4747
4665
  });
4748
4666
  const searchTerm = ref("");
@@ -4804,22 +4722,20 @@ const _sfc_main$J = /* @__PURE__ */ defineComponent({
4804
4722
  }
4805
4723
  }
4806
4724
  function moveHighlightToStart(event) {
4807
- var _a;
4808
4725
  if (props.readonly === false && (selectModalVisible.value || props.useListView)) {
4809
4726
  event.stopPropagation();
4810
4727
  highlightIndex.value = 0;
4811
- (_a = selectModalRef.value) == null ? void 0 : _a.scrollTo({
4728
+ selectModalRef.value?.scrollTo({
4812
4729
  top: 0,
4813
4730
  behavior: "instant"
4814
4731
  });
4815
4732
  }
4816
4733
  }
4817
4734
  function moveHighlightToEnd(event) {
4818
- var _a;
4819
4735
  if (props.readonly === false && (selectModalVisible.value || props.useListView)) {
4820
4736
  event.stopPropagation();
4821
4737
  highlightIndex.value = displayList.value.length - 1;
4822
- (_a = selectModalRef.value) == null ? void 0 : _a.scrollTo({
4738
+ selectModalRef.value?.scrollTo({
4823
4739
  top: selectModalRef.value.scrollHeight,
4824
4740
  behavior: "instant"
4825
4741
  });
@@ -4853,8 +4769,7 @@ const _sfc_main$J = /* @__PURE__ */ defineComponent({
4853
4769
  return !!value && typeof value === "object" && "name" in value && typeof value.name === "string" && "id" in value && typeof value.id === "number";
4854
4770
  }
4855
4771
  function scrollToHighlight() {
4856
- var _a;
4857
- const highlightedElement = (_a = selectModalRef.value) == null ? void 0 : _a.children.item(highlightIndex.value);
4772
+ const highlightedElement = selectModalRef.value?.children.item(highlightIndex.value);
4858
4773
  if (selectModalRef.value && highlightedElement) {
4859
4774
  selectModalRef.value.scrollTo({
4860
4775
  top: highlightedElement.offsetTop - 16,
@@ -4908,12 +4823,11 @@ const _sfc_main$J = /* @__PURE__ */ defineComponent({
4908
4823
  }));
4909
4824
  let ignoreFocus = false;
4910
4825
  function focus() {
4911
- var _a;
4912
4826
  if (!ignoreFocus && props.openDropDownOnFocus) {
4913
4827
  toggleSelectModalState(true);
4914
4828
  }
4915
4829
  ignoreFocus = false;
4916
- (_a = inputElement.value) == null ? void 0 : _a.focus();
4830
+ inputElement.value?.focus();
4917
4831
  }
4918
4832
  function disableKeyboardEventForSearching(fn) {
4919
4833
  return (...args) => {
@@ -5272,15 +5186,11 @@ const _sfc_main$H = /* @__PURE__ */ defineComponent({
5272
5186
  return methods;
5273
5187
  });
5274
5188
  const currentFilterMethod = computed(() => {
5275
- var _a;
5276
- let filterMethod = (_a = props.filter) == null ? void 0 : _a.filterMethod;
5189
+ let filterMethod = props.filter?.filterMethod;
5277
5190
  if (typeof filterMethod === "undefined") {
5278
5191
  filterMethod = FilterOperation[props.defaultOperation].replace("_", "").toLowerCase();
5279
5192
  }
5280
- return allowedFilterMethods.value.find((m) => {
5281
- var _a2;
5282
- return m.method.toLowerCase() === ((_a2 = filterMethod == null ? void 0 : filterMethod.removeNonAlphanumeric()) == null ? void 0 : _a2.toLowerCase());
5283
- });
5193
+ return allowedFilterMethods.value.find((m) => m.method.toLowerCase() === filterMethod?.removeNonAlphanumeric()?.toLowerCase());
5284
5194
  });
5285
5195
  function setFilterMethod(filterMethod) {
5286
5196
  let filterOutput;
@@ -5327,11 +5237,10 @@ const _sfc_main$H = /* @__PURE__ */ defineComponent({
5327
5237
  }, [
5328
5238
  createElementVNode("strong", _hoisted_2$p, toDisplayString(unref(t2)("grid.availableMethods")), 1),
5329
5239
  (openBlock(true), createElementBlock(Fragment, null, renderList(allowedFilterMethods.value, (filterMethod, index2) => {
5330
- var _a;
5331
5240
  return openBlock(), createElementBlock("span", {
5332
5241
  key: index2,
5333
5242
  class: normalizeClass(["cl:cursor-pointer cl:hover:bg-grey-0 cl:px-4 cl:py-1 cl:transition-colors cl:w-full", {
5334
- "cl:bg-primary-default cl:opacity-80": filterMethod.method === ((_a = currentFilterMethod.value) == null ? void 0 : _a.method)
5243
+ "cl:bg-primary-default cl:opacity-80": filterMethod.method === currentFilterMethod.value?.method
5335
5244
  }]),
5336
5245
  onClick: withModifiers(($event) => setFilterMethod(filterMethod.method), ["prevent"])
5337
5246
  }, [
@@ -5414,26 +5323,22 @@ const _sfc_main$G = /* @__PURE__ */ defineComponent({
5414
5323
  const isStringColumn = computed(() => props.column.type === "string" || props.column.type === "slot" && props.column.slotType === "string");
5415
5324
  const numericFormat = computed(() => props.column.format === NumberFormat.INTEGER ? NumberFormat.DECIMAL : props.column.format ?? NumberFormat.DECIMAL);
5416
5325
  const booleanValueAsSelectItem = computed(() => booleanListEntries.value.find((x) => x.value === currentFilterValue.value.toString()) ?? null);
5417
- const listEntriesAsSelectItems = computed(() => {
5418
- var _a;
5419
- return [
5420
- props.column.listMode === "multi" ? defaultSelectAllListValue.value : defaultEmptyListValue,
5421
- ...((_a = props.column.listEntries) == null ? void 0 : _a.map((x, i) => ({
5422
- id: i,
5423
- name: t2(x.translationKey),
5424
- value: x.value.toString()
5425
- }))) ?? []
5426
- ];
5427
- });
5326
+ const listEntriesAsSelectItems = computed(() => [
5327
+ props.column.listMode === "multi" ? defaultSelectAllListValue.value : defaultEmptyListValue,
5328
+ ...props.column.listEntries?.map((x, i) => ({
5329
+ id: i,
5330
+ name: t2(x.translationKey),
5331
+ value: x.value.toString()
5332
+ })) ?? []
5333
+ ]);
5428
5334
  const currentFilterValueAsSelectItems = computed(() => {
5429
- var _a, _b;
5430
5335
  if (props.column.listMode !== "multi") {
5431
5336
  const item = listEntriesAsSelectItems.value.find((x) => x.value === currentFilterValue.value && x.id === selectedListEntryId.value) ?? listEntriesAsSelectItems.value.find((x) => x.value === currentFilterValue.value) ?? null;
5432
5337
  return item ? item : null;
5433
5338
  } else {
5434
- const filters = (_a = props.filter) == null ? void 0 : _a.filter((f) => f.filterOperation === FilterOperation.OR_EQUAL).map((f) => f.filterValue);
5435
- const filteredListEntries = listEntriesAsSelectItems.value.filter((x) => filters == null ? void 0 : filters.includes(x.value));
5436
- if (filteredListEntries.length === ((_b = props.column.listEntries) == null ? void 0 : _b.length)) {
5339
+ const filters = props.filter?.filter((f) => f.filterOperation === FilterOperation.OR_EQUAL).map((f) => f.filterValue);
5340
+ const filteredListEntries = listEntriesAsSelectItems.value.filter((x) => filters?.includes(x.value));
5341
+ if (filteredListEntries.length === props.column.listEntries?.length) {
5437
5342
  filteredListEntries.push(defaultSelectAllListValue.value);
5438
5343
  }
5439
5344
  return filteredListEntries;
@@ -5449,22 +5354,21 @@ const _sfc_main$G = /* @__PURE__ */ defineComponent({
5449
5354
  return;
5450
5355
  }
5451
5356
  if (isNumericListColumn.value) {
5452
- setNumberFilter(null, value == null ? void 0 : value.value);
5357
+ setNumberFilter(null, value?.value);
5453
5358
  } else {
5454
- setFilter(null, value == null ? void 0 : value.value);
5359
+ setFilter(null, value?.value);
5455
5360
  }
5456
5361
  }
5457
5362
  const immediateRequestOverride = ref(false);
5458
5363
  const performImmediateRequest = computed(() => immediateRequestOverride.value || isStringColumn.value === false);
5459
5364
  const internalFilter = computed({
5460
5365
  get() {
5461
- var _a, _b, _c, _d, _e, _f, _g;
5462
- let result = (_a = currentFilters.value) == null ? void 0 : _a[0];
5366
+ let result = currentFilters.value?.[0];
5463
5367
  if (result) {
5464
5368
  if (isDateColumn.value) {
5465
- if ((((_b = props.filter) == null ? void 0 : _b.length) ?? 0) > 1) {
5466
- const startFilter = (_c = currentFilters.value) == null ? void 0 : _c.find((f) => f.filterOperation === FilterOperation.EQUAL_OR_GREATER_THAN);
5467
- const endFilter = (_d = currentFilters.value) == null ? void 0 : _d.find((f) => f.filterOperation === FilterOperation.LESS_THAN);
5369
+ if ((props.filter?.length ?? 0) > 1) {
5370
+ const startFilter = currentFilters.value?.find((f) => f.filterOperation === FilterOperation.EQUAL_OR_GREATER_THAN);
5371
+ const endFilter = currentFilters.value?.find((f) => f.filterOperation === FilterOperation.LESS_THAN);
5468
5372
  if (startFilter && endFilter) {
5469
5373
  result = {
5470
5374
  filterOnColumn: props.column.field,
@@ -5489,9 +5393,9 @@ const _sfc_main$G = /* @__PURE__ */ defineComponent({
5489
5393
  filterValue: date.plus({ milliseconds: 1 }).toISO() ?? ""
5490
5394
  };
5491
5395
  }
5492
- } else if (isDateRangeColumn.value && (((_e = props.filter) == null ? void 0 : _e.length) ?? 0) > 1) {
5493
- const startFilter = (_f = currentFilters.value) == null ? void 0 : _f.find((f) => f.filterOperation === FilterOperation.EQUAL_OR_GREATER_THAN);
5494
- const endFilter = (_g = currentFilters.value) == null ? void 0 : _g.find((f) => f.filterOperation === FilterOperation.EQUAL_OR_LESS_THAN);
5396
+ } else if (isDateRangeColumn.value && (props.filter?.length ?? 0) > 1) {
5397
+ const startFilter = currentFilters.value?.find((f) => f.filterOperation === FilterOperation.EQUAL_OR_GREATER_THAN);
5398
+ const endFilter = currentFilters.value?.find((f) => f.filterOperation === FilterOperation.EQUAL_OR_LESS_THAN);
5495
5399
  if (startFilter && endFilter) {
5496
5400
  result = {
5497
5401
  filterOnColumn: props.column.field,
@@ -5511,9 +5415,9 @@ const _sfc_main$G = /* @__PURE__ */ defineComponent({
5511
5415
  let filters = null;
5512
5416
  if (isDateColumn.value) {
5513
5417
  const dateFilter = value;
5514
- const equalsFilter = (dateFilter == null ? void 0 : dateFilter.filterMethod) && checkDateFilter(dateFilter.filterMethod, dateFilter.filterValue, "equal");
5515
- const lessThanOrEqualFilter = (dateFilter == null ? void 0 : dateFilter.filterMethod) && checkDateFilter(dateFilter.filterMethod, dateFilter.filterValue, "equalorlessthan");
5516
- const greaterThanFilter = (dateFilter == null ? void 0 : dateFilter.filterMethod) && checkDateFilter(dateFilter.filterMethod, dateFilter.filterValue, "greaterthan");
5418
+ const equalsFilter = dateFilter?.filterMethod && checkDateFilter(dateFilter.filterMethod, dateFilter.filterValue, "equal");
5419
+ const lessThanOrEqualFilter = dateFilter?.filterMethod && checkDateFilter(dateFilter.filterMethod, dateFilter.filterValue, "equalorlessthan");
5420
+ const greaterThanFilter = dateFilter?.filterMethod && checkDateFilter(dateFilter.filterMethod, dateFilter.filterValue, "greaterthan");
5517
5421
  if (equalsFilter) {
5518
5422
  let date = DateTime.fromISO(dateFilter.filterValue, {
5519
5423
  zone: props.timeZone ?? "UTC"
@@ -5563,7 +5467,7 @@ const _sfc_main$G = /* @__PURE__ */ defineComponent({
5563
5467
  }
5564
5468
  ];
5565
5469
  }
5566
- } else if (isDateRangeColumn.value && (value == null ? void 0 : value.filterValue)) {
5470
+ } else if (isDateRangeColumn.value && value?.filterValue) {
5567
5471
  const dateRange = value.filterValue;
5568
5472
  const startDate = DateTime.fromISO(dateRange.start, {
5569
5473
  zone: props.timeZone ?? "UTC"
@@ -5599,7 +5503,7 @@ const _sfc_main$G = /* @__PURE__ */ defineComponent({
5599
5503
  }
5600
5504
  }
5601
5505
  }
5602
- if ((value == null ? void 0 : value.filterValue) === "" || performImmediateRequest.value) {
5506
+ if (value?.filterValue === "" || performImmediateRequest.value) {
5603
5507
  updateFilterDebounced(false);
5604
5508
  currentFilters.value = filters;
5605
5509
  immediateRequestOverride.value = false;
@@ -5624,10 +5528,7 @@ const _sfc_main$G = /* @__PURE__ */ defineComponent({
5624
5528
  const isEqualFilter = operation === expectedOperation;
5625
5529
  return isValidValue && isEqualFilter && isDateColumn.value;
5626
5530
  }
5627
- const currentFilterValue = computed(() => {
5628
- var _a;
5629
- return ((_a = internalFilter.value) == null ? void 0 : _a.filterValue) ?? "";
5630
- });
5531
+ const currentFilterValue = computed(() => internalFilter.value?.filterValue ?? "");
5631
5532
  const currentDateFilterValue = computed(() => currentFilterValue.value === "" ? null : currentFilterValue.value);
5632
5533
  const currentDateRangeFilterValue = computed(() => currentFilterValue.value === "" ? null : currentFilterValue.value);
5633
5534
  const filterable = computed(() => isFilterable(props.column));
@@ -5650,10 +5551,9 @@ const _sfc_main$G = /* @__PURE__ */ defineComponent({
5650
5551
  }
5651
5552
  }
5652
5553
  function setFilter(target, defaultValue) {
5653
- var _a;
5654
5554
  let filterOutput;
5655
5555
  let nextValue = defaultValue;
5656
- const previousValue = ((_a = internalFilter.value) == null ? void 0 : _a.filterValue.toString()) ?? "";
5556
+ const previousValue = internalFilter.value?.filterValue.toString() ?? "";
5657
5557
  const hasNextValue = !!nextValue.trim();
5658
5558
  const hasPreviousValue = !!previousValue.trim();
5659
5559
  if (hasNextValue === false && hasPreviousValue) {
@@ -5691,11 +5591,10 @@ const _sfc_main$G = /* @__PURE__ */ defineComponent({
5691
5591
  setFilter(null, isNaN(inputValue) ? "" : inputValue.toString());
5692
5592
  }
5693
5593
  function setDateRangeFilter(value) {
5694
- var _a;
5695
5594
  let filterOutput;
5696
5595
  let preventEmit = false;
5697
5596
  if (internalFilter.value) {
5698
- preventEmit = ((_a = internalFilter.value) == null ? void 0 : _a.filterValue) === value;
5597
+ preventEmit = internalFilter.value?.filterValue === value;
5699
5598
  filterOutput = copy(internalFilter.value);
5700
5599
  filterOutput.filterValue = value ?? "";
5701
5600
  } else if (value !== null && typeof props.column.field !== "undefined") {
@@ -5738,8 +5637,7 @@ const _sfc_main$G = /* @__PURE__ */ defineComponent({
5738
5637
  });
5739
5638
  const gridId = inject("cl-ui-grid-id") ?? "cl-ui-grid-filter";
5740
5639
  watch(() => props.filter, () => {
5741
- var _a;
5742
- if (((_a = props.filter) == null ? void 0 : _a.length) === 0) {
5640
+ if (props.filter?.length === 0) {
5743
5641
  selectedListEntryId.value = defaultEmptyListValue.id;
5744
5642
  }
5745
5643
  });
@@ -5758,7 +5656,7 @@ const _sfc_main$G = /* @__PURE__ */ defineComponent({
5758
5656
  class: "cl:bg-white cl:font-normal cl:min-h-0! cl:rounded-lg!",
5759
5657
  "model-value": booleanValueAsSelectItem.value,
5760
5658
  inert: _ctx.loading,
5761
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => setFilter(null, ($event == null ? void 0 : $event.value) ?? ""))
5659
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => setFilter(null, $event?.value ?? ""))
5762
5660
  }, {
5763
5661
  default: withCtx(({ select, option: option2, index: index2, highlightIndex, isSelected }) => [
5764
5662
  createVNode(_sfc_main$I, {
@@ -5812,9 +5710,9 @@ const _sfc_main$G = /* @__PURE__ */ defineComponent({
5812
5710
  "allow-empty": true,
5813
5711
  "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => $event !== null ? setNumberFilter(null, $event) : setFilter(null, ""))
5814
5712
  }, {
5815
- default: withCtx(() => _cache[9] || (_cache[9] = [
5713
+ default: withCtx(() => [..._cache[9] || (_cache[9] = [
5816
5714
  createElementVNode("span", null, null, -1)
5817
- ])),
5715
+ ])]),
5818
5716
  _: 1
5819
5717
  }, 8, ["id", "model-value", "format", "precision", "readonly"])
5820
5718
  ])) : _ctx.column.type === "string" || _ctx.column.type === "slot" && _ctx.column.slotType === "string" ? (openBlock(), createElementBlock("div", _hoisted_4$d, [
@@ -5829,9 +5727,9 @@ const _sfc_main$G = /* @__PURE__ */ defineComponent({
5829
5727
  readonly: _ctx.loading,
5830
5728
  onKeySinglePress: handleKeySinglePress
5831
5729
  }, {
5832
- default: withCtx(() => _cache[10] || (_cache[10] = [
5730
+ default: withCtx(() => [..._cache[10] || (_cache[10] = [
5833
5731
  createElementVNode("span", null, null, -1)
5834
- ])),
5732
+ ])]),
5835
5733
  _: 1
5836
5734
  }, 8, ["id", "modelValue", "readonly"])
5837
5735
  ])) : isListColumn.value ? (openBlock(), createBlock(_sfc_main$J, {
@@ -5975,8 +5873,7 @@ const _sfc_main$E = /* @__PURE__ */ defineComponent({
5975
5873
  }));
5976
5874
  });
5977
5875
  function isActiveSort(column, isAscending) {
5978
- var _a, _b;
5979
- return ((_a = currentRequest.value.sort) == null ? void 0 : _a.sortOnColumn) === column.field && ((_b = currentRequest.value.sort) == null ? void 0 : _b.sortByAscending) === isAscending;
5876
+ return currentRequest.value.sort?.sortOnColumn === column.field && currentRequest.value.sort?.sortByAscending === isAscending;
5980
5877
  }
5981
5878
  function setSort(field) {
5982
5879
  if (typeof field !== "undefined") {
@@ -6052,12 +5949,12 @@ const _sfc_main$E = /* @__PURE__ */ defineComponent({
6052
5949
  currentHandle = handle;
6053
5950
  const rect = currentHandle.getBoundingClientRect();
6054
5951
  const table = currentHandle.closest("table");
6055
- const tableRect = table == null ? void 0 : table.getBoundingClientRect();
5952
+ const tableRect = table?.getBoundingClientRect();
6056
5953
  const th = currentHandle.closest("th");
6057
- const thRect = th == null ? void 0 : th.getBoundingClientRect();
6058
- initialWidth = (thRect == null ? void 0 : thRect.width) ?? 0;
5954
+ const thRect = th?.getBoundingClientRect();
5955
+ initialWidth = thRect?.width ?? 0;
6059
5956
  rightResizeBarPosition.value = index2 === visibleColumns.value.length - 1 ? rect.right : rect.right - 5;
6060
- leftResizeBarPosition.value = (thRect == null ? void 0 : thRect.left) ?? 0;
5957
+ leftResizeBarPosition.value = thRect?.left ?? 0;
6061
5958
  if (tableRect) {
6062
5959
  resizeBarTop.value = tableRect.top;
6063
5960
  resizeBarHeight.value = tableRect.height;
@@ -6304,10 +6201,7 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
6304
6201
  const { t: t2 } = useI18n();
6305
6202
  const gridSearchInputRef = ref();
6306
6203
  __expose({
6307
- focusMegaSearch: () => {
6308
- var _a;
6309
- return (_a = gridSearchInputRef.value) == null ? void 0 : _a.focus();
6310
- }
6204
+ focusMegaSearch: () => gridSearchInputRef.value?.focus()
6311
6205
  });
6312
6206
  return (_ctx, _cache) => {
6313
6207
  const _component_icon = resolveComponent("icon");
@@ -6328,9 +6222,9 @@ const _sfc_main$D = /* @__PURE__ */ defineComponent({
6328
6222
  placeholder: _ctx.columns.length > 4 ? unref(t2)("grid.search") : unref(t2)("grid.searchSpecific", { columns: _ctx.columns.map((c) => unref(t2)(c.caption)).join(", ") }),
6329
6223
  onKeypress: _cache[2] || (_cache[2] = withKeys(($event) => performSearch(searchValue.value), ["enter"]))
6330
6224
  }, {
6331
- default: withCtx(() => _cache[4] || (_cache[4] = [
6225
+ default: withCtx(() => [..._cache[4] || (_cache[4] = [
6332
6226
  createElementVNode("span", null, null, -1)
6333
- ])),
6227
+ ])]),
6334
6228
  _: 1
6335
6229
  }, 8, ["modelValue", "readonly", "placeholder"])
6336
6230
  ]),
@@ -7045,7 +6939,7 @@ function _dispatchEvent(info) {
7045
6939
  }, info));
7046
6940
  }
7047
6941
  var dragEl, parentEl, ghostEl, rootEl, nextEl, lastDownEl, cloneEl, cloneHidden, oldIndex, newIndex, oldDraggableIndex, newDraggableIndex, activeGroup, putSortable, awaitingDragStarted = false, ignoreNextClick = false, sortables = [], tapEvt, touchEvt, lastDx, lastDy, tapDistanceLeft, tapDistanceTop, moved, lastTarget, lastDirection, pastFirstInvertThresh = false, isCircumstantialInvert = false, targetMoveDistance, ghostRelativeParent, ghostRelativeParentInitialScroll = [], _silent = false, savedInputChecked = [];
7048
- var documentExists = typeof document !== "undefined", PositionGhostAbsolutely = IOS, CSSFloatProperty = Edge || IE11OrLess ? "cssFloat" : "float", supportDraggable = documentExists && !ChromeForAndroid && !IOS && "draggable" in document.createElement("div"), supportCssPointerEvents = function() {
6942
+ var documentExists = typeof document !== "undefined", PositionGhostAbsolutely = IOS, CSSFloatProperty = Edge || IE11OrLess ? "cssFloat" : "float", supportDraggable = documentExists && !ChromeForAndroid && !IOS && "draggable" in document.createElement("div"), supportCssPointerEvents = (function() {
7049
6943
  if (!documentExists) return;
7050
6944
  if (IE11OrLess) {
7051
6945
  return false;
@@ -7053,7 +6947,7 @@ var documentExists = typeof document !== "undefined", PositionGhostAbsolutely =
7053
6947
  var el = document.createElement("x");
7054
6948
  el.style.cssText = "pointer-events:auto";
7055
6949
  return el.style.pointerEvents === "auto";
7056
- }(), _detectDirection = function _detectDirection2(el, options) {
6950
+ })(), _detectDirection = function _detectDirection2(el, options) {
7057
6951
  var elCSS = css(el), elWidth = parseInt(elCSS.width) - parseInt(elCSS.paddingLeft) - parseInt(elCSS.paddingRight) - parseInt(elCSS.borderLeftWidth) - parseInt(elCSS.borderRightWidth), child1 = getChild(el, 0, options), child2 = getChild(el, 1, options), firstChildCSS = child1 && css(child1), secondChildCSS = child2 && css(child2), firstChildWidth = firstChildCSS && parseInt(firstChildCSS.marginLeft) + parseInt(firstChildCSS.marginRight) + getRect(child1).width, secondChildWidth = secondChildCSS && parseInt(secondChildCSS.marginLeft) + parseInt(secondChildCSS.marginRight) + getRect(child2).width;
7058
6952
  if (elCSS.display === "flex") {
7059
6953
  return elCSS.flexDirection === "column" || elCSS.flexDirection === "column-reverse" ? "vertical" : "horizontal";
@@ -8727,7 +8621,6 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
8727
8621
  }),
8728
8622
  emits: /* @__PURE__ */ mergeModels(["update:columns", "update:request", "data-request", "row-edit", "row-edit-cancelled", "edit-start", "edit-end", "row-select", "view-manager-visible", "clear-filters-clicked"], ["update:selectedRowIndex"]),
8729
8623
  setup(__props, { expose: __expose, emit: __emit }) {
8730
- var _a;
8731
8624
  const props = __props;
8732
8625
  const selectedRowIndex = useModel(__props, "selectedRowIndex");
8733
8626
  const emit = __emit;
@@ -8776,9 +8669,8 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
8776
8669
  return width;
8777
8670
  }
8778
8671
  function setColumnStyles() {
8779
- var _a2;
8780
8672
  const result = {};
8781
- if (window.innerWidth >= 1024 || ((_a2 = props.options) == null ? void 0 : _a2.hideGridMobileView)) {
8673
+ if (window.innerWidth >= 1024 || props.options?.hideGridMobileView) {
8782
8674
  currentColumns.value.forEach((c) => {
8783
8675
  const value = c.customWidth ? `${c.customWidth}px` : c.width ? `${c.width}px` : "";
8784
8676
  result[`${c.name}`] = `width: ${value}; min-width: ${value};`;
@@ -8807,12 +8699,11 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
8807
8699
  emit("clear-filters-clicked");
8808
8700
  }
8809
8701
  function resetGrouping() {
8810
- var _a2;
8811
8702
  if (gridOptions.value.groupByField) {
8812
8703
  currentRequest.value = {
8813
8704
  ...currentRequest.value,
8814
8705
  sort: {
8815
- sortByAscending: ((_a2 = props.request.sort) == null ? void 0 : _a2.sortByAscending) ?? false,
8706
+ sortByAscending: props.request.sort?.sortByAscending ?? false,
8816
8707
  sortOnColumn: gridOptions.value.groupByField
8817
8708
  }
8818
8709
  };
@@ -8863,7 +8754,7 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
8863
8754
  };
8864
8755
  }
8865
8756
  });
8866
- const searchValue = ref(((_a = props.request.filters.find((f) => f.filterMethod === "andcontains" || f.filterOperation === FilterOperation.AND_CONTAINS)) == null ? void 0 : _a.filterValue) ?? "");
8757
+ const searchValue = ref(props.request.filters.find((f) => f.filterMethod === "andcontains" || f.filterOperation === FilterOperation.AND_CONTAINS)?.filterValue ?? "");
8867
8758
  const searchableColumns = computed(() => props.columns.filter((c) => (c.type === "string" || c.type === "slot" && c.slotType === "string") && c.searchable));
8868
8759
  watch(() => props.loading, () => {
8869
8760
  isInitialLoad.value = false;
@@ -8878,8 +8769,7 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
8878
8769
  watch(() => props.data, () => {
8879
8770
  setPageNumberIfPageNumberExceedsAvailablePages();
8880
8771
  function setPageNumberIfPageNumberExceedsAvailablePages() {
8881
- var _a2;
8882
- if (((_a2 = props.data) == null ? void 0 : _a2.results.length) === 0 && currentRequest.value.pageNumber > 1) {
8772
+ if (props.data?.results.length === 0 && currentRequest.value.pageNumber > 1) {
8883
8773
  currentRequest.value.pageNumber = props.data.totalRecords > 0 ? Math.ceil(props.data.totalRecords / currentRequest.value.pageSize) : 1;
8884
8774
  }
8885
8775
  }
@@ -8892,10 +8782,7 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
8892
8782
  watch(() => props.columns, setColumnStyles, { deep: true });
8893
8783
  const gridSearchRef = ref();
8894
8784
  __expose({
8895
- focusMegaSearch: () => {
8896
- var _a2;
8897
- return (_a2 = gridSearchRef.value) == null ? void 0 : _a2.focusMegaSearch();
8898
- }
8785
+ focusMegaSearch: () => gridSearchRef.value?.focusMegaSearch()
8899
8786
  });
8900
8787
  return (_ctx, _cache) => {
8901
8788
  return openBlock(), createElementBlock("div", _hoisted_1$u, [
@@ -9191,8 +9078,7 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
9191
9078
  const request = useModel(__props, "request");
9192
9079
  const { t: t2 } = useI18n();
9193
9080
  function isActiveSort(column, isAscending) {
9194
- var _a, _b;
9195
- return ((_a = request.value.sort) == null ? void 0 : _a.sortOnColumn) === column.field && ((_b = request.value.sort) == null ? void 0 : _b.sortByAscending) === isAscending;
9081
+ return request.value.sort?.sortOnColumn === column.field && request.value.sort?.sortByAscending === isAscending;
9196
9082
  }
9197
9083
  function setSort(field) {
9198
9084
  if (typeof field !== "undefined") {
@@ -9348,13 +9234,12 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
9348
9234
  const isSmallGrid = computed(() => props.options.smallGridText ?? false);
9349
9235
  const isAlternatingRows = computed(() => props.options.alternatingRows ?? false);
9350
9236
  return (_ctx, _cache) => {
9351
- var _a;
9352
9237
  return openBlock(), createElementBlock("div", _hoisted_1$q, [
9353
9238
  _ctx.initialLoad && _ctx.pageSize > 0 ? (openBlock(), createBlock(_sfc_main$y, {
9354
9239
  key: 0,
9355
9240
  "page-size": _ctx.pageSize,
9356
9241
  "column-count": _ctx.columns.length
9357
- }, null, 8, ["page-size", "column-count"])) : (((_a = _ctx.data) == null ? void 0 : _a.results.length) ?? 0) < 1 && _ctx.initialLoad === false ? (openBlock(), createElementBlock("div", {
9242
+ }, null, 8, ["page-size", "column-count"])) : (_ctx.data?.results.length ?? 0) < 1 && _ctx.initialLoad === false ? (openBlock(), createElementBlock("div", {
9358
9243
  key: 1,
9359
9244
  class: normalizeClass(["cl:col-[1_/_-1] cl:text-center cl:w-full", [
9360
9245
  isSmallGrid.value ? "cl:p-1" : "cl:p-2"
@@ -9421,11 +9306,11 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
9421
9306
  let date;
9422
9307
  if (props.timeZone) {
9423
9308
  date = DateTime.fromISO(value, {
9424
- locale: (dateFormatLocaleOverride == null ? void 0 : dateFormatLocaleOverride.value) ?? locale2.value
9309
+ locale: dateFormatLocaleOverride?.value ?? locale2.value
9425
9310
  }).setZone(props.timeZone);
9426
9311
  } else {
9427
9312
  date = DateTime.fromISO(value, {
9428
- locale: (dateFormatLocaleOverride == null ? void 0 : dateFormatLocaleOverride.value) ?? locale2.value,
9313
+ locale: dateFormatLocaleOverride?.value ?? locale2.value,
9429
9314
  zone: "UTC"
9430
9315
  });
9431
9316
  }
@@ -9486,7 +9371,6 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
9486
9371
  }
9487
9372
  }
9488
9373
  return (_ctx, _cache) => {
9489
- var _a;
9490
9374
  return openBlock(), createElementBlock("div", mergeProps({
9491
9375
  class: [
9492
9376
  _ctx.isSmallGrid ? "cl:px-1 cl:py-1.5 cl:text-xs" : "cl:p-2 cl:text-sm"
@@ -9513,7 +9397,7 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
9513
9397
  key: 3,
9514
9398
  id: unref(id),
9515
9399
  class: "cl:inline-block cl:whitespace-nowrap"
9516
- }, toDisplayString(unref(t2)(((_a = _ctx.column.listEntries.find((entry) => entry.value === _ctx.data[_ctx.column.field])) == null ? void 0 : _a.translationKey) ?? "")), 9, _hoisted_2$h)) : _ctx.column.type === "number" && _ctx.column.field !== void 0 ? (openBlock(), createElementBlock("span", {
9400
+ }, toDisplayString(unref(t2)(_ctx.column.listEntries.find((entry) => entry.value === _ctx.data[_ctx.column.field])?.translationKey ?? "")), 9, _hoisted_2$h)) : _ctx.column.type === "number" && _ctx.column.field !== void 0 ? (openBlock(), createElementBlock("span", {
9517
9401
  key: 4,
9518
9402
  id: unref(id),
9519
9403
  class: "cl:inline-block cl:whitespace-nowrap"
@@ -9530,13 +9414,13 @@ const _sfc_main$v = /* @__PURE__ */ defineComponent({
9530
9414
  const _sfc_main$u = {};
9531
9415
  const _hoisted_1$o = { class: "cl:border cl:border-off-white cl:border-t cl:flex cl:justify-between cl:p-2" };
9532
9416
  function _sfc_render$2(_ctx, _cache) {
9533
- return openBlock(), createElementBlock("div", _hoisted_1$o, _cache[0] || (_cache[0] = [
9417
+ return openBlock(), createElementBlock("div", _hoisted_1$o, [..._cache[0] || (_cache[0] = [
9534
9418
  createElementVNode("div", { class: "cl:flex cl:gap-2 cl:w-full" }, [
9535
9419
  createElementVNode("p", { class: "cl:animate-pulse cl:basis-3/12 cl:bg-grey-1 cl:leading-none cl:rounded-full" }, "   "),
9536
9420
  createElementVNode("p", { class: "cl:animate-pulse cl:basis-1/12 cl:bg-grey-1 cl:leading-none cl:rounded-full" }, "   ")
9537
9421
  ], -1),
9538
9422
  createElementVNode("p", { class: "cl:animate-pulse cl:basis-1/12 cl:bg-grey-1 cl:leading-none cl:rounded-full" }, "   ", -1)
9539
- ]));
9423
+ ])]);
9540
9424
  }
9541
9425
  const clUiGridLiteFooterSkeleton = /* @__PURE__ */ _export_sfc(_sfc_main$u, [["render", _sfc_render$2]]);
9542
9426
  const _hoisted_1$n = { class: "cl:flex cl:gap-4" };
@@ -9569,10 +9453,7 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
9569
9453
  const props = __props;
9570
9454
  const request = useModel(__props, "request");
9571
9455
  const { t: t2 } = useI18n();
9572
- const totalPages = computed(() => {
9573
- var _a;
9574
- return props.data !== null ? Math.ceil((((_a = props.data) == null ? void 0 : _a.totalRecords) ?? 0) / request.value.pageSize) : 1;
9575
- });
9456
+ const totalPages = computed(() => props.data !== null ? Math.ceil((props.data?.totalRecords ?? 0) / request.value.pageSize) : 1);
9576
9457
  const pageNumbers = computed(() => {
9577
9458
  const calculatedPageNumbers = Array.from(Array(totalPages.value + 1).keys());
9578
9459
  let results = [];
@@ -9586,7 +9467,7 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
9586
9467
  });
9587
9468
  function setPage(pageNumber) {
9588
9469
  const filterRequest = copy(request.value);
9589
- pageNumber ?? (pageNumber = 1);
9470
+ pageNumber ??= 1;
9590
9471
  if (filterRequest.pageNumber !== pageNumber) {
9591
9472
  filterRequest.pageNumber = Math.max(Math.min(Math.trunc(pageNumber), totalPages.value), 1);
9592
9473
  request.value = filterRequest;
@@ -9599,10 +9480,7 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
9599
9480
  50
9600
9481
  ];
9601
9482
  const availablePageSizes = computed(() => {
9602
- return pageSizes.filter((size) => {
9603
- var _a;
9604
- return size <= (((_a = props.data) == null ? void 0 : _a.totalRecords) ?? 0);
9605
- });
9483
+ return pageSizes.filter((size) => size <= (props.data?.totalRecords ?? 0));
9606
9484
  });
9607
9485
  function setPageSize(pageSize) {
9608
9486
  const filterRequest = copy(request.value);
@@ -9611,9 +9489,8 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
9611
9489
  request.value = filterRequest;
9612
9490
  }
9613
9491
  return (_ctx, _cache) => {
9614
- var _a;
9615
9492
  const _component_icon = resolveComponent("icon");
9616
- return _ctx.initialLoad ? (openBlock(), createBlock(clUiGridLiteFooterSkeleton, { key: 0 })) : ((_a = _ctx.data) == null ? void 0 : _a.results.length) && request.value && totalPages.value > 1 ? (openBlock(), createElementBlock("div", {
9493
+ return _ctx.initialLoad ? (openBlock(), createBlock(clUiGridLiteFooterSkeleton, { key: 0 })) : _ctx.data?.results.length && request.value && totalPages.value > 1 ? (openBlock(), createElementBlock("div", {
9617
9494
  key: 1,
9618
9495
  class: normalizeClass(["cl:border-off-white cl:border-t cl:flex cl:flex-wrap cl:gap-y-2 cl:justify-between cl:p-2 cl:text-grey-4", [
9619
9496
  _ctx.options.smallGridText ? "cl:px-1 cl:py-1.5 cl:text-xs" : "cl:p-2 cl:text-sm"
@@ -9912,8 +9789,7 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
9912
9789
  const showQuickDates = useMediaQuery("(min-height: 800px)");
9913
9790
  __expose({
9914
9791
  focus() {
9915
- var _a;
9916
- (_a = input.value) == null ? void 0 : _a.focus();
9792
+ input.value?.focus();
9917
9793
  }
9918
9794
  });
9919
9795
  return (_ctx, _cache) => {
@@ -10103,12 +9979,10 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
10103
9979
  );
10104
9980
  __expose({
10105
9981
  focus() {
10106
- var _a;
10107
- (_a = inputRef.value) == null ? void 0 : _a.focus();
9982
+ inputRef.value?.focus();
10108
9983
  },
10109
9984
  blur() {
10110
- var _a;
10111
- (_a = inputRef.value) == null ? void 0 : _a.blur();
9985
+ inputRef.value?.blur();
10112
9986
  }
10113
9987
  });
10114
9988
  return (_ctx, _cache) => {
@@ -10190,8 +10064,7 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
10190
10064
  const showNumericInput = ref(false);
10191
10065
  __expose({
10192
10066
  focus() {
10193
- var _a;
10194
- (_a = sliderRef.value) == null ? void 0 : _a.focus();
10067
+ sliderRef.value?.focus();
10195
10068
  }
10196
10069
  });
10197
10070
  return (_ctx, _cache) => {
@@ -10220,9 +10093,9 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
10220
10093
  disabled: _ctx.disabled,
10221
10094
  placeholder: _ctx.placeholder
10222
10095
  }, {
10223
- default: withCtx(() => _cache[5] || (_cache[5] = [
10096
+ default: withCtx(() => [..._cache[5] || (_cache[5] = [
10224
10097
  createElementVNode("span", null, null, -1)
10225
- ])),
10098
+ ])]),
10226
10099
  _: 1
10227
10100
  }, 8, ["modelValue", "format", "precision", "min", "max", "step", "disabled", "placeholder"])) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
10228
10101
  withDirectives(createElementVNode("input", {
@@ -10408,9 +10281,8 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
10408
10281
  const focused = ref(false);
10409
10282
  const lostFocus = ref(false);
10410
10283
  const showRequiredAsterisk = computed(() => {
10411
- var _a;
10412
10284
  let showAsterisk = props.isRequired;
10413
- if (lostFocus.value && ((_a = currentValue.value) == null ? void 0 : _a.toString().trim()) === "" && props.requiredText.trim() !== "") {
10285
+ if (lostFocus.value && currentValue.value?.toString().trim() === "" && props.requiredText.trim() !== "") {
10414
10286
  showAsterisk = false;
10415
10287
  }
10416
10288
  return !props.hideRequiredAsterisk && showAsterisk;
@@ -10434,10 +10306,9 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
10434
10306
  const displayValidationMessage = ref(true);
10435
10307
  const internalErrors = ref([]);
10436
10308
  const errors = computed(() => {
10437
- var _a, _b;
10438
10309
  return [
10439
- ...((_a = internalErrors.value) == null ? void 0 : _a.filter((e) => ((e == null ? void 0 : e.length) ?? 0) > 0)) ?? [],
10440
- ...((_b = props.externalErrors) == null ? void 0 : _b.filter((e) => ((e == null ? void 0 : e.length) ?? 0) > 0)) ?? []
10310
+ ...internalErrors.value?.filter((e) => (e?.length ?? 0) > 0) ?? [],
10311
+ ...props.externalErrors?.filter((e) => (e?.length ?? 0) > 0) ?? []
10441
10312
  ].join("\n");
10442
10313
  });
10443
10314
  const currencyInputOptions = computed(() => {
@@ -10598,19 +10469,17 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
10598
10469
  );
10599
10470
  __expose({
10600
10471
  focus() {
10601
- var _a, _b;
10602
10472
  if (props.inputType === "currency") {
10603
- (_a = currencyInputRef == null ? void 0 : currencyInputRef.value) == null ? void 0 : _a.focus();
10473
+ currencyInputRef?.value?.focus();
10604
10474
  } else {
10605
- (_b = inputElement.value) == null ? void 0 : _b.focus();
10475
+ inputElement.value?.focus();
10606
10476
  }
10607
10477
  },
10608
10478
  blur() {
10609
- var _a, _b;
10610
10479
  if (props.inputType === "currency") {
10611
- (_a = currencyInputRef == null ? void 0 : currencyInputRef.value) == null ? void 0 : _a.blur();
10480
+ currencyInputRef?.value?.blur();
10612
10481
  } else {
10613
- (_b = inputElement.value) == null ? void 0 : _b.blur();
10482
+ inputElement.value?.blur();
10614
10483
  }
10615
10484
  }
10616
10485
  });
@@ -10999,9 +10868,9 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
10999
10868
  placeholder: unref(t2)("login.email"),
11000
10869
  autocomplete: "username"
11001
10870
  }, {
11002
- default: withCtx(() => _cache[4] || (_cache[4] = [
10871
+ default: withCtx(() => [..._cache[4] || (_cache[4] = [
11003
10872
  createElementVNode("span", null, null, -1)
11004
- ])),
10873
+ ])]),
11005
10874
  _: 1
11006
10875
  }, 8, ["modelValue", "class", "errors", "placeholder"]),
11007
10876
  usernameValid.value ? (openBlock(), createElementBlock("div", _hoisted_9, toDisplayString(unref(t2)("login.validEmail")), 1)) : createCommentVNode("", true)
@@ -11042,9 +10911,9 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
11042
10911
  placeholder: unref(t2)("login.password"),
11043
10912
  autocomplete: "current-password"
11044
10913
  }, {
11045
- default: withCtx(() => _cache[5] || (_cache[5] = [
10914
+ default: withCtx(() => [..._cache[5] || (_cache[5] = [
11046
10915
  createElementVNode("span", null, null, -1)
11047
- ])),
10916
+ ])]),
11048
10917
  _: 1
11049
10918
  }, 8, ["modelValue", "class", "type", "placeholder"])
11050
10919
  ])
@@ -11065,22 +10934,19 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
11065
10934
  ])
11066
10935
  ], 2),
11067
10936
  createVNode(Transition, { name: "cl:grow-down" }, {
11068
- default: withCtx(() => {
11069
- var _a;
11070
- return [
11071
- withDirectives(createElementVNode("span", _hoisted_13, [
11072
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.errors, (error, index2) => {
11073
- return openBlock(), createElementBlock("div", {
11074
- id: "cl-ui-login-errors",
11075
- key: index2,
11076
- class: "cl:font-semibold"
11077
- }, toDisplayString(error), 1);
11078
- }), 128))
11079
- ], 512), [
11080
- [vShow, (_a = _ctx.errors) == null ? void 0 : _a.length]
11081
- ])
11082
- ];
11083
- }),
10937
+ default: withCtx(() => [
10938
+ withDirectives(createElementVNode("span", _hoisted_13, [
10939
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.errors, (error, index2) => {
10940
+ return openBlock(), createElementBlock("div", {
10941
+ id: "cl-ui-login-errors",
10942
+ key: index2,
10943
+ class: "cl:font-semibold"
10944
+ }, toDisplayString(error), 1);
10945
+ }), 128))
10946
+ ], 512), [
10947
+ [vShow, _ctx.errors?.length]
10948
+ ])
10949
+ ]),
11084
10950
  _: 1
11085
10951
  })
11086
10952
  ])
@@ -11139,7 +11005,7 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
11139
11005
  }
11140
11006
  });
11141
11007
  }
11142
- emit("open-state", !!(group == null ? void 0 : group.open), groupID);
11008
+ emit("open-state", !!group?.open, groupID);
11143
11009
  }
11144
11010
  const size = useWindowSize();
11145
11011
  watch(
@@ -11497,9 +11363,8 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
11497
11363
  }
11498
11364
  });
11499
11365
  function handleDrop(payload) {
11500
- var _a;
11501
11366
  if (props.disabled === false) {
11502
- const filesUploaded = [...(_a = payload == null ? void 0 : payload.dataTransfer) == null ? void 0 : _a.files];
11367
+ const filesUploaded = [...payload?.dataTransfer?.files];
11503
11368
  validateAndEmitFiles(filesUploaded);
11504
11369
  }
11505
11370
  }
@@ -11660,9 +11525,8 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
11660
11525
  }
11661
11526
  }
11662
11527
  const canDeselect = computed(() => {
11663
- var _a;
11664
11528
  if (Array.isArray(currentSelection.value)) {
11665
- return props.required === false || (((_a = currentSelection.value) == null ? void 0 : _a.length) ?? 0) > 1;
11529
+ return props.required === false || (currentSelection.value?.length ?? 0) > 1;
11666
11530
  } else {
11667
11531
  return !props.required;
11668
11532
  }
@@ -12083,14 +11947,13 @@ function concatenatePath(...fragments) {
12083
11947
  return fragments.map((f) => f.replace(/ /g, "_")).join(" ");
12084
11948
  }
12085
11949
  function findNodeByPath(rootNodes, path) {
12086
- var _a;
12087
11950
  const pathFragments = path.split(" ");
12088
11951
  let currentNode = void 0;
12089
11952
  for (const fragment of pathFragments) {
12090
11953
  if (!currentNode) {
12091
11954
  currentNode = rootNodes.find((node) => node.id === fragment);
12092
11955
  } else {
12093
- currentNode = (_a = currentNode.children) == null ? void 0 : _a.find((node) => node.id === fragment);
11956
+ currentNode = currentNode.children?.find((node) => node.id === fragment);
12094
11957
  }
12095
11958
  if (!currentNode) {
12096
11959
  break;
@@ -12125,7 +11988,6 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
12125
11988
  }),
12126
11989
  emits: /* @__PURE__ */ mergeModels(["recalculate-tree-path", "set-child-node-height"], ["update:selectedPath"]),
12127
11990
  setup(__props, { emit: __emit }) {
12128
- var _a;
12129
11991
  const props = __props;
12130
11992
  const selectedPath = useModel(__props, "selectedPath");
12131
11993
  const emit = __emit;
@@ -12137,7 +11999,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
12137
11999
  const childSubtreeDivs = ref([]);
12138
12000
  const childSubtreeHeights = computed(() => childSubtreeDivs.value.map((el) => useElementSize(el)));
12139
12001
  const childSubtreeBoundingBoxes = computed(() => childSubtreeDivs.value.map((el) => useElementBounding(el)));
12140
- const childNodeContentHeights = ref(new Array(((_a = props.rootNode.children) == null ? void 0 : _a.length) ?? 0).fill(0));
12002
+ const childNodeContentHeights = ref(new Array(props.rootNode.children?.length ?? 0).fill(0));
12141
12003
  const treePathBranchesAt = ref([]);
12142
12004
  function recalculateTreePathBranches() {
12143
12005
  nodeContentBoundingBox.update();