@citruslime/ui 4.1.0-beta.3 → 4.1.0-beta.4
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.
|
@@ -4717,7 +4717,8 @@ const _sfc_main$J = /* @__PURE__ */ defineComponent({
|
|
|
4717
4717
|
isGridFilter: { type: Boolean, default: false },
|
|
4718
4718
|
openDropDownOnFocus: { type: Boolean, default: true },
|
|
4719
4719
|
allowFiltering: { type: Boolean, default: false },
|
|
4720
|
-
useListView: { type: Boolean, default: (props) => Array.isArray(props.modelValue) }
|
|
4720
|
+
useListView: { type: Boolean, default: (props) => Array.isArray(props.modelValue) },
|
|
4721
|
+
readonly: { type: Boolean, default: false }
|
|
4721
4722
|
},
|
|
4722
4723
|
emits: ["update:model-value"],
|
|
4723
4724
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
@@ -4779,30 +4780,32 @@ const _sfc_main$J = /* @__PURE__ */ defineComponent({
|
|
|
4779
4780
|
setSearchTerm("");
|
|
4780
4781
|
}
|
|
4781
4782
|
function select(value) {
|
|
4782
|
-
if (
|
|
4783
|
-
|
|
4784
|
-
|
|
4785
|
-
if (
|
|
4786
|
-
|
|
4783
|
+
if (props.readonly === false && value !== null && value !== void 0) {
|
|
4784
|
+
if (Array.isArray(selectResult.value)) {
|
|
4785
|
+
const isInArray = selectResult.value.indexOf(value);
|
|
4786
|
+
if (isInArray > -1) {
|
|
4787
|
+
if (selectResult.value.length > 1 || props.canClear) {
|
|
4788
|
+
selectResult.value = selectResult.value.toSpliced(isInArray, 1);
|
|
4789
|
+
}
|
|
4790
|
+
} else {
|
|
4791
|
+
selectResult.value = [
|
|
4792
|
+
...selectResult.value,
|
|
4793
|
+
value
|
|
4794
|
+
];
|
|
4787
4795
|
}
|
|
4788
4796
|
} else {
|
|
4789
|
-
selectResult.value
|
|
4790
|
-
|
|
4791
|
-
|
|
4792
|
-
|
|
4793
|
-
|
|
4794
|
-
|
|
4795
|
-
if (props.canClear && selectResult.value === value) {
|
|
4796
|
-
selectResult.value = null;
|
|
4797
|
-
} else {
|
|
4798
|
-
selectResult.value = value;
|
|
4797
|
+
if (props.canClear && selectResult.value === value) {
|
|
4798
|
+
selectResult.value = null;
|
|
4799
|
+
} else {
|
|
4800
|
+
selectResult.value = value;
|
|
4801
|
+
}
|
|
4802
|
+
toggleSelectModalState();
|
|
4799
4803
|
}
|
|
4800
|
-
toggleSelectModalState();
|
|
4801
4804
|
}
|
|
4802
4805
|
}
|
|
4803
4806
|
function moveHighlightToStart(event) {
|
|
4804
4807
|
var _a;
|
|
4805
|
-
if (selectModalVisible.value || props.useListView) {
|
|
4808
|
+
if (props.readonly === false && (selectModalVisible.value || props.useListView)) {
|
|
4806
4809
|
event.stopPropagation();
|
|
4807
4810
|
highlightIndex.value = 0;
|
|
4808
4811
|
(_a = selectModalRef.value) == null ? void 0 : _a.scrollTo({
|
|
@@ -4813,7 +4816,7 @@ const _sfc_main$J = /* @__PURE__ */ defineComponent({
|
|
|
4813
4816
|
}
|
|
4814
4817
|
function moveHighlightToEnd(event) {
|
|
4815
4818
|
var _a;
|
|
4816
|
-
if (selectModalVisible.value || props.useListView) {
|
|
4819
|
+
if (props.readonly === false && (selectModalVisible.value || props.useListView)) {
|
|
4817
4820
|
event.stopPropagation();
|
|
4818
4821
|
highlightIndex.value = displayList.value.length - 1;
|
|
4819
4822
|
(_a = selectModalRef.value) == null ? void 0 : _a.scrollTo({
|
|
@@ -4823,7 +4826,7 @@ const _sfc_main$J = /* @__PURE__ */ defineComponent({
|
|
|
4823
4826
|
}
|
|
4824
4827
|
}
|
|
4825
4828
|
function moveHighlightBackwards(event) {
|
|
4826
|
-
if (selectModalVisible.value || props.useListView) {
|
|
4829
|
+
if (props.readonly === false && (selectModalVisible.value || props.useListView)) {
|
|
4827
4830
|
event.stopPropagation();
|
|
4828
4831
|
if (highlightIndex.value === -1) {
|
|
4829
4832
|
moveHighlightToStart(event);
|
|
@@ -4836,7 +4839,7 @@ const _sfc_main$J = /* @__PURE__ */ defineComponent({
|
|
|
4836
4839
|
}
|
|
4837
4840
|
}
|
|
4838
4841
|
function moveHighlightForwards(event) {
|
|
4839
|
-
if (selectModalVisible.value || props.useListView) {
|
|
4842
|
+
if (props.readonly === false && (selectModalVisible.value || props.useListView)) {
|
|
4840
4843
|
event.stopPropagation();
|
|
4841
4844
|
if (highlightIndex.value < displayList.value.length - 1) {
|
|
4842
4845
|
highlightIndex.value++;
|
|
@@ -4861,7 +4864,7 @@ const _sfc_main$J = /* @__PURE__ */ defineComponent({
|
|
|
4861
4864
|
}
|
|
4862
4865
|
function handleEnterPress(event) {
|
|
4863
4866
|
if (selectModalVisible.value) {
|
|
4864
|
-
select(displayList.value[highlightIndex.value]);
|
|
4867
|
+
select(displayList.value[highlightIndex.value] ?? null);
|
|
4865
4868
|
setSearchTerm("");
|
|
4866
4869
|
event.target.focus();
|
|
4867
4870
|
} else {
|
|
@@ -4929,6 +4932,10 @@ const _sfc_main$J = /* @__PURE__ */ defineComponent({
|
|
|
4929
4932
|
function ignoreFocusEvent() {
|
|
4930
4933
|
ignoreFocus = true;
|
|
4931
4934
|
}
|
|
4935
|
+
function handleMouseClick(option2) {
|
|
4936
|
+
select(option2);
|
|
4937
|
+
highlightIndex.value = -1;
|
|
4938
|
+
}
|
|
4932
4939
|
__expose({
|
|
4933
4940
|
focus
|
|
4934
4941
|
});
|
|
@@ -4983,7 +4990,7 @@ const _sfc_main$J = /* @__PURE__ */ defineComponent({
|
|
|
4983
4990
|
withKeys(withModifiers(moveHighlightForwards, ["prevent"]), ["down"]),
|
|
4984
4991
|
withKeys(withModifiers(moveHighlightToStart, ["prevent"]), ["home"]),
|
|
4985
4992
|
withKeys(withModifiers(moveHighlightToEnd, ["prevent"]), ["end"]),
|
|
4986
|
-
_cache[4] || (_cache[4] = withKeys(
|
|
4993
|
+
_cache[4] || (_cache[4] = withKeys(($event) => disableKeyboardEventForSearching(handleEnterPress), ["space"])),
|
|
4987
4994
|
withKeys(withModifiers(handleEnterPress, ["stop", "prevent"]), ["enter"])
|
|
4988
4995
|
],
|
|
4989
4996
|
onInput: _cache[0] || (_cache[0] = ($event) => setSearchTerm($event.target.value)),
|
|
@@ -5014,7 +5021,8 @@ const _sfc_main$J = /* @__PURE__ */ defineComponent({
|
|
|
5014
5021
|
"cl:absolute cl:border-t-0 cl:left-0 cl:rounded-t-none cl:top-8 cl:min-h-20 cl:max-h-56 cl:text-sm": !_ctx.isGridFilter && props.useListView === false,
|
|
5015
5022
|
"cl:max-h-28": props.useListView,
|
|
5016
5023
|
"cl:overflow-y-auto": _ctx.disabled === false,
|
|
5017
|
-
"cl:overflow-hidden": _ctx.disabled
|
|
5024
|
+
"cl:overflow-hidden": _ctx.disabled,
|
|
5025
|
+
"cl:text-grey-3": _ctx.readonly
|
|
5018
5026
|
}],
|
|
5019
5027
|
inert: _ctx.disabled,
|
|
5020
5028
|
onBlur: _cache[6] || (_cache[6] = ($event) => toggleSelectModalState(false)),
|
|
@@ -5034,20 +5042,21 @@ const _sfc_main$J = /* @__PURE__ */ defineComponent({
|
|
|
5034
5042
|
}), [
|
|
5035
5043
|
(openBlock(true), createElementBlock(Fragment, null, renderList(displayList.value, (option2, index2) => {
|
|
5036
5044
|
return openBlock(), createElementBlock("div", { key: index2 }, [
|
|
5037
|
-
renderSlot(_ctx.$slots, "default", mergeProps({ ref_for: true }, { option: option2, index: index2, select, highlightIndex: highlightIndex.value, isSelected }), () => [
|
|
5045
|
+
renderSlot(_ctx.$slots, "default", mergeProps({ ref_for: true }, { option: option2, index: index2, select: handleMouseClick, highlightIndex: highlightIndex.value, isSelected }), () => [
|
|
5038
5046
|
(openBlock(), createBlock(_component_cl_ui_select_option, {
|
|
5039
5047
|
id: unref(id) + "-option-" + (isSelectItem(option2) ? option2.id : index2),
|
|
5040
5048
|
key: index2,
|
|
5041
5049
|
disabled: _ctx.disabled,
|
|
5042
5050
|
"is-highlighted": highlightIndex.value === index2,
|
|
5043
5051
|
"is-selected": isSelected(option2),
|
|
5044
|
-
|
|
5052
|
+
readonly: _ctx.readonly,
|
|
5053
|
+
onSelect: ($event) => handleMouseClick(option2)
|
|
5045
5054
|
}, {
|
|
5046
5055
|
default: withCtx(() => [
|
|
5047
5056
|
createTextVNode(toDisplayString(isSelectItem(option2) ? option2.name : option2), 1)
|
|
5048
5057
|
]),
|
|
5049
5058
|
_: 2
|
|
5050
|
-
}, 1032, ["id", "disabled", "is-highlighted", "is-selected", "onSelect"]))
|
|
5059
|
+
}, 1032, ["id", "disabled", "is-highlighted", "is-selected", "readonly", "onSelect"]))
|
|
5051
5060
|
])
|
|
5052
5061
|
]);
|
|
5053
5062
|
}), 128))
|
|
@@ -5073,20 +5082,23 @@ const _sfc_main$I = /* @__PURE__ */ defineComponent({
|
|
|
5073
5082
|
props: {
|
|
5074
5083
|
isSelected: { type: Boolean, default: false },
|
|
5075
5084
|
isHighlighted: { type: Boolean, default: false },
|
|
5076
|
-
disabled: { type: Boolean, default: false }
|
|
5085
|
+
disabled: { type: Boolean, default: false },
|
|
5086
|
+
readonly: { type: Boolean, default: false }
|
|
5077
5087
|
},
|
|
5078
5088
|
emits: ["select"],
|
|
5079
5089
|
setup(__props, { emit: __emit }) {
|
|
5080
5090
|
const emit = __emit;
|
|
5081
5091
|
return (_ctx, _cache) => {
|
|
5082
5092
|
return openBlock(), createElementBlock("div", {
|
|
5083
|
-
class: normalizeClass(["cl:px-2 cl:py-0.5", _ctx.disabled ? "cl:bg-grey-1 cl:border-grey-2 cl:placeholder-grey-3" :
|
|
5084
|
-
"cl:
|
|
5093
|
+
class: normalizeClass(["cl:px-2 cl:py-0.5", _ctx.disabled ? "cl:bg-grey-1 cl:border-grey-2 cl:placeholder-grey-3" : {
|
|
5094
|
+
"cl:cursor-pointer": _ctx.readonly === false,
|
|
5095
|
+
"cl:bg-primary-lighter": _ctx.isSelected && _ctx.isHighlighted === false,
|
|
5096
|
+
"cl:hover:bg-primary-default": _ctx.readonly === false && _ctx.isSelected && _ctx.isHighlighted === false,
|
|
5085
5097
|
"cl:bg-primary-default": _ctx.isSelected && _ctx.isHighlighted,
|
|
5086
|
-
"cl:hover:bg-link-lighter": _ctx.isSelected === false && _ctx.isHighlighted === false,
|
|
5098
|
+
"cl:hover:bg-link-lighter": _ctx.readonly === false && _ctx.isSelected === false && _ctx.isHighlighted === false,
|
|
5087
5099
|
"cl:bg-link-lighter": _ctx.isSelected === false && _ctx.isHighlighted
|
|
5088
|
-
}]
|
|
5089
|
-
onClick: _cache[0] || (_cache[0] = ($event) => _ctx.disabled ? null : emit("select"))
|
|
5100
|
+
}]),
|
|
5101
|
+
onClick: _cache[0] || (_cache[0] = ($event) => _ctx.readonly || _ctx.disabled ? null : emit("select"))
|
|
5090
5102
|
}, [
|
|
5091
5103
|
renderSlot(_ctx.$slots, "default")
|
|
5092
5104
|
], 2);
|
|
@@ -5833,7 +5845,7 @@ const _sfc_main$G = /* @__PURE__ */ defineComponent({
|
|
|
5833
5845
|
placeholder: selectAllCurrentlyHighlighted.value ? unref(t2)("grid.allEntriesSelected") : void 0,
|
|
5834
5846
|
class: "cl:bg-white cl:font-normal! cl:max-h-52! cl:min-h-0! cl:placeholder:text-xs cl:rounded-lg! cl:text-xs",
|
|
5835
5847
|
"is-grid-filter": true,
|
|
5836
|
-
|
|
5848
|
+
readonly: _ctx.loading,
|
|
5837
5849
|
"onUpdate:modelValue": _cache[6] || (_cache[6] = ($event) => updateListColumnSelectItems($event))
|
|
5838
5850
|
}, {
|
|
5839
5851
|
default: withCtx(({ select, option: option2, index: index2, highlightIndex, isSelected }) => [
|
|
@@ -5853,7 +5865,7 @@ const _sfc_main$G = /* @__PURE__ */ defineComponent({
|
|
|
5853
5865
|
}, 1032, ["is-highlighted", "is-selected", "class", "onSelect"])
|
|
5854
5866
|
]),
|
|
5855
5867
|
_: 1
|
|
5856
|
-
}, 8, ["id", "list", "model-value", "can-clear", "placeholder", "
|
|
5868
|
+
}, 8, ["id", "list", "model-value", "can-clear", "placeholder", "readonly"])) : createCommentVNode("", true),
|
|
5857
5869
|
!isDateRangeColumn.value ? (openBlock(), createBlock(_sfc_main$H, {
|
|
5858
5870
|
key: 6,
|
|
5859
5871
|
filter: currentFilter.value,
|
|
@@ -5868,7 +5880,7 @@ const _sfc_main$G = /* @__PURE__ */ defineComponent({
|
|
|
5868
5880
|
};
|
|
5869
5881
|
}
|
|
5870
5882
|
});
|
|
5871
|
-
const clUiGridFilterInput = /* @__PURE__ */ _export_sfc(_sfc_main$G, [["__scopeId", "data-v-
|
|
5883
|
+
const clUiGridFilterInput = /* @__PURE__ */ _export_sfc(_sfc_main$G, [["__scopeId", "data-v-316a739a"]]);
|
|
5872
5884
|
const _hoisted_1$y = { key: 1 };
|
|
5873
5885
|
const _sfc_main$F = /* @__PURE__ */ defineComponent({
|
|
5874
5886
|
__name: "cl-ui-grid-filter",
|
|
@@ -8777,11 +8789,11 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
|
|
|
8777
8789
|
function getStyleForColumn(name) {
|
|
8778
8790
|
return columnStyles.value[name] ?? "";
|
|
8779
8791
|
}
|
|
8780
|
-
|
|
8792
|
+
const shouldSetBlankColumn = computed(() => {
|
|
8781
8793
|
const columnWithNoWidthSet = visibleColumns.value.every((x) => x.width !== void 0 || x.customWidth !== void 0);
|
|
8782
8794
|
const columnWidthDoesNotExceedGridWidth = visibleColumns.value.reduce((acc, x) => acc + (x.customWidth ?? x.width ?? 0), 0) < getGridWidth();
|
|
8783
8795
|
return columnWithNoWidthSet && columnWidthDoesNotExceedGridWidth;
|
|
8784
|
-
}
|
|
8796
|
+
});
|
|
8785
8797
|
const currentRequest = computed({
|
|
8786
8798
|
get: () => props.request,
|
|
8787
8799
|
set: (value) => emit("update:request", value)
|
|
@@ -8883,6 +8895,7 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
|
|
|
8883
8895
|
setColumnStyles();
|
|
8884
8896
|
}
|
|
8885
8897
|
watch(() => props.options.groupByField, resetGrouping, { immediate: true });
|
|
8898
|
+
watch(() => props.columns, setColumnStyles, { deep: true });
|
|
8886
8899
|
const gridSearchRef = ref();
|
|
8887
8900
|
__expose({
|
|
8888
8901
|
focusMegaSearch: () => {
|
|
@@ -8964,7 +8977,7 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
|
|
|
8964
8977
|
span: 1
|
|
8965
8978
|
}, null, 4);
|
|
8966
8979
|
}), 128)),
|
|
8967
|
-
shouldSetBlankColumn
|
|
8980
|
+
shouldSetBlankColumn.value ? (openBlock(), createElementBlock("col", _hoisted_4$a)) : createCommentVNode("", true)
|
|
8968
8981
|
], 2),
|
|
8969
8982
|
createVNode(_sfc_main$E, {
|
|
8970
8983
|
request: headerRequest.value,
|