@fkui/vue-labs 6.18.0 → 6.18.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.cjs.js +477 -458
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/cjs/vue-labs.css +4 -3
- package/dist/esm/index.esm.js +479 -460
- package/dist/esm/index.esm.js.map +1 -1
- package/dist/esm/vue-labs.css +4 -3
- package/dist/types/cypress.d.ts +1 -1
- package/dist/types/index.d.ts +9 -8
- package/package.json +6 -6
package/dist/cjs/index.cjs.js
CHANGED
|
@@ -3,8 +3,8 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
3
3
|
const logic = require("@fkui/logic");
|
|
4
4
|
const vue = require("vue");
|
|
5
5
|
const vue$1 = require("@fkui/vue");
|
|
6
|
-
const HOURS_MINUTES_REGEXP = /^(?<hours
|
|
7
|
-
const HOURS_MINUTES_WITHOUT_COLON_REGEXP = /^(?<hours
|
|
6
|
+
const HOURS_MINUTES_REGEXP = /^(?<hours>\d+)?(:(?<minutes>[0-5]\d))?$/;
|
|
7
|
+
const HOURS_MINUTES_WITHOUT_COLON_REGEXP = /^(?<hours>\d{2})(?<minutes>[0-5]\d)$/;
|
|
8
8
|
var es_iterator_forEach = {};
|
|
9
9
|
var globalThis_1;
|
|
10
10
|
var hasRequiredGlobalThis;
|
|
@@ -2471,7 +2471,7 @@ function getCellTarget(tableElement, rowIndex, cellIndex) {
|
|
|
2471
2471
|
return tableElement.rows[rowIndex].cells[cellIndex];
|
|
2472
2472
|
}
|
|
2473
2473
|
function isTd(element) {
|
|
2474
|
-
return element
|
|
2474
|
+
return element?.cellIndex !== void 0;
|
|
2475
2475
|
}
|
|
2476
2476
|
function getTr(td) {
|
|
2477
2477
|
return td.parentElement;
|
|
@@ -2787,357 +2787,9 @@ const _sfc_main$9 = /* @__PURE__ */ vue.defineComponent({
|
|
|
2787
2787
|
};
|
|
2788
2788
|
}
|
|
2789
2789
|
});
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
|
|
2793
|
-
}
|
|
2794
|
-
if (key) {
|
|
2795
|
-
return (row) => {
|
|
2796
|
-
return coerce(row[key]);
|
|
2797
|
-
};
|
|
2798
|
-
}
|
|
2799
|
-
return () => defaultValue;
|
|
2800
|
-
}
|
|
2801
|
-
function getUpdateFn(fn, key) {
|
|
2802
|
-
if (fn) {
|
|
2803
|
-
return fn;
|
|
2804
|
-
}
|
|
2805
|
-
if (key) {
|
|
2806
|
-
return (row, value) => {
|
|
2807
|
-
row[key] = value;
|
|
2808
|
-
};
|
|
2809
|
-
}
|
|
2810
|
-
return () => void 0;
|
|
2811
|
-
}
|
|
2812
|
-
function normalizeTableColumn(column) {
|
|
2813
|
-
var _column$validation;
|
|
2814
|
-
if ("render" in column) {
|
|
2815
|
-
return {
|
|
2816
|
-
type: void 0,
|
|
2817
|
-
header: column.header,
|
|
2818
|
-
render: column.render
|
|
2819
|
-
};
|
|
2820
|
-
}
|
|
2821
|
-
switch (column.type) {
|
|
2822
|
-
case "checkbox":
|
|
2823
|
-
return {
|
|
2824
|
-
type: "checkbox",
|
|
2825
|
-
header: column.header,
|
|
2826
|
-
value: getValueFn(column.value, column.key, Boolean, false),
|
|
2827
|
-
update: getUpdateFn(column.update, column.key),
|
|
2828
|
-
editable: typeof column.editable === "function" ? column.editable : () => {
|
|
2829
|
-
var _column$editable;
|
|
2830
|
-
return Boolean((_column$editable = column.editable) !== null && _column$editable !== void 0 ? _column$editable : false);
|
|
2831
|
-
},
|
|
2832
|
-
sortable: column.key
|
|
2833
|
-
};
|
|
2834
|
-
case "radio":
|
|
2835
|
-
return {
|
|
2836
|
-
type: "radio",
|
|
2837
|
-
header: column.header,
|
|
2838
|
-
value: getValueFn(column.value, column.key, Boolean, false),
|
|
2839
|
-
update: getUpdateFn(column.update, column.key),
|
|
2840
|
-
sortable: column.key
|
|
2841
|
-
};
|
|
2842
|
-
case "text":
|
|
2843
|
-
return {
|
|
2844
|
-
type: "text",
|
|
2845
|
-
header: column.header,
|
|
2846
|
-
value: getValueFn(column.value, column.key, String, ""),
|
|
2847
|
-
update: getUpdateFn(column.update, column.key),
|
|
2848
|
-
editable: typeof column.editable === "function" ? column.editable : () => {
|
|
2849
|
-
var _column$editable2;
|
|
2850
|
-
return Boolean((_column$editable2 = column.editable) !== null && _column$editable2 !== void 0 ? _column$editable2 : false);
|
|
2851
|
-
},
|
|
2852
|
-
validation: (_column$validation = column.validation) !== null && _column$validation !== void 0 ? _column$validation : {},
|
|
2853
|
-
sortable: column.key
|
|
2854
|
-
};
|
|
2855
|
-
case "anchor":
|
|
2856
|
-
return {
|
|
2857
|
-
type: "anchor",
|
|
2858
|
-
header: column.header,
|
|
2859
|
-
value: column.value,
|
|
2860
|
-
href: column.href,
|
|
2861
|
-
enabled: typeof column.enabled === "function" ? column.enabled : () => {
|
|
2862
|
-
var _column$enabled;
|
|
2863
|
-
return Boolean((_column$enabled = column.enabled) !== null && _column$enabled !== void 0 ? _column$enabled : true);
|
|
2864
|
-
},
|
|
2865
|
-
sortable: column.key
|
|
2866
|
-
};
|
|
2867
|
-
case "button":
|
|
2868
|
-
return {
|
|
2869
|
-
type: "button",
|
|
2870
|
-
header: column.header,
|
|
2871
|
-
value: column.value,
|
|
2872
|
-
onClick: column.onClick,
|
|
2873
|
-
enabled: typeof column.enabled === "function" ? column.enabled : () => {
|
|
2874
|
-
var _column$enabled2;
|
|
2875
|
-
return Boolean((_column$enabled2 = column.enabled) !== null && _column$enabled2 !== void 0 ? _column$enabled2 : true);
|
|
2876
|
-
},
|
|
2877
|
-
icon: column.icon,
|
|
2878
|
-
sortable: column.key
|
|
2879
|
-
};
|
|
2880
|
-
case "select":
|
|
2881
|
-
return {
|
|
2882
|
-
type: "select",
|
|
2883
|
-
header: column.header,
|
|
2884
|
-
value: getValueFn(column.value, column.key, String, ""),
|
|
2885
|
-
update: getUpdateFn(column.update, column.key),
|
|
2886
|
-
editable: typeof column.editable === "function" ? column.editable : () => {
|
|
2887
|
-
var _column$editable3;
|
|
2888
|
-
return Boolean((_column$editable3 = column.editable) !== null && _column$editable3 !== void 0 ? _column$editable3 : false);
|
|
2889
|
-
},
|
|
2890
|
-
options: column.options,
|
|
2891
|
-
sortable: column.key
|
|
2892
|
-
};
|
|
2893
|
-
case void 0:
|
|
2894
|
-
return {
|
|
2895
|
-
type: void 0,
|
|
2896
|
-
header: column.header,
|
|
2897
|
-
value: getValueFn(column.value, column.key, String, ""),
|
|
2898
|
-
sortable: column.key
|
|
2899
|
-
};
|
|
2900
|
-
}
|
|
2901
|
-
}
|
|
2902
|
-
function defineTableColumns(columns) {
|
|
2903
|
-
return columns;
|
|
2904
|
-
}
|
|
2905
|
-
function normalizeTableColumns(columns) {
|
|
2906
|
-
return columns.map(normalizeTableColumn);
|
|
2907
|
-
}
|
|
2908
|
-
const stopEditKey = Symbol();
|
|
2909
|
-
function useStartStopEdit() {
|
|
2910
|
-
const stopEdit2 = vue.inject(stopEditKey, () => Promise.resolve());
|
|
2911
|
-
return {
|
|
2912
|
-
stopEdit: stopEdit2
|
|
2913
|
-
};
|
|
2914
|
-
}
|
|
2915
|
-
const _hoisted_1$7 = {
|
|
2916
|
-
class: "table-ng__editable"
|
|
2917
|
-
};
|
|
2918
|
-
const _hoisted_2$3 = {
|
|
2919
|
-
class: "table-ng__editable__text"
|
|
2920
|
-
};
|
|
2921
|
-
const _hoisted_3$1 = ["aria-controls"];
|
|
2922
|
-
const _sfc_main$8 = /* @__PURE__ */ vue.defineComponent({
|
|
2923
|
-
__name: "ITableSelect",
|
|
2924
|
-
props: {
|
|
2925
|
-
row: {},
|
|
2926
|
-
column: {}
|
|
2927
|
-
},
|
|
2928
|
-
setup(__props) {
|
|
2929
|
-
const editing = vue.ref(false);
|
|
2930
|
-
const editRef = vue.useTemplateRef("edit");
|
|
2931
|
-
const {
|
|
2932
|
-
stopEdit: stopEdit2
|
|
2933
|
-
} = useStartStopEdit();
|
|
2934
|
-
const viewValue = vue.ref(__props.column.value(__props.row));
|
|
2935
|
-
const tdRef = vue.useTemplateRef("td");
|
|
2936
|
-
function onActivateCell(e) {
|
|
2937
|
-
logic.assertRef(tdRef);
|
|
2938
|
-
tdRef.value.tabIndex = 0;
|
|
2939
|
-
if (e.detail.focus) {
|
|
2940
|
-
tdRef.value.focus();
|
|
2941
|
-
}
|
|
2942
|
-
}
|
|
2943
|
-
async function onCellKeyDown(e) {
|
|
2944
|
-
if (e.code === "Enter" || e.code === "NumpadEnter") {
|
|
2945
|
-
startEditing(e);
|
|
2946
|
-
}
|
|
2947
|
-
}
|
|
2948
|
-
async function onCellClick(e) {
|
|
2949
|
-
if (editing.value) {
|
|
2950
|
-
return;
|
|
2951
|
-
}
|
|
2952
|
-
startEditing(e);
|
|
2953
|
-
}
|
|
2954
|
-
async function startEditing(e) {
|
|
2955
|
-
logic.assertRef(editRef);
|
|
2956
|
-
e.preventDefault();
|
|
2957
|
-
editing.value = true;
|
|
2958
|
-
await vue.nextTick();
|
|
2959
|
-
editRef.value.tabIndex = 0;
|
|
2960
|
-
editRef.value.focus();
|
|
2961
|
-
openSelected("first");
|
|
2962
|
-
}
|
|
2963
|
-
async function onDropdownSelect(value) {
|
|
2964
|
-
logic.assertRef(editRef);
|
|
2965
|
-
logic.assertSet(stopEdit2);
|
|
2966
|
-
close();
|
|
2967
|
-
submit();
|
|
2968
|
-
viewValue.value = value;
|
|
2969
|
-
stopEdit2(editRef.value, "enter");
|
|
2970
|
-
}
|
|
2971
|
-
function onDropdownClose() {
|
|
2972
|
-
logic.assertRef(editRef);
|
|
2973
|
-
logic.assertSet(stopEdit2);
|
|
2974
|
-
stopEdit2(editRef.value, "escape");
|
|
2975
|
-
}
|
|
2976
|
-
const dropdownId = logic.ElementIdService.generateElementId();
|
|
2977
|
-
const dropdownIsOpen = vue.ref(false);
|
|
2978
|
-
const activeOptionId = logic.ElementIdService.generateElementId();
|
|
2979
|
-
const activeOption = vue.ref(null);
|
|
2980
|
-
vue.watchEffect(async () => {
|
|
2981
|
-
if (!editRef.value) {
|
|
2982
|
-
return;
|
|
2983
|
-
}
|
|
2984
|
-
if (activeOption.value) {
|
|
2985
|
-
editRef.value.setAttribute("aria-activedescendant", activeOptionId);
|
|
2986
|
-
} else {
|
|
2987
|
-
editRef.value.removeAttribute("aria-activedescendant");
|
|
2988
|
-
}
|
|
2989
|
-
});
|
|
2990
|
-
async function openSelected(fallback = null) {
|
|
2991
|
-
dropdownIsOpen.value = true;
|
|
2992
|
-
await vue.nextTick();
|
|
2993
|
-
if (viewValue.value) {
|
|
2994
|
-
activeOption.value = viewValue.value;
|
|
2995
|
-
} else if (fallback === "first") {
|
|
2996
|
-
activeOption.value = __props.column.options[0];
|
|
2997
|
-
} else if (fallback === "last") {
|
|
2998
|
-
activeOption.value = __props.column.options[__props.column.options.length - 1];
|
|
2999
|
-
} else {
|
|
3000
|
-
activeOption.value = null;
|
|
3001
|
-
}
|
|
3002
|
-
editRef.value?.focus();
|
|
3003
|
-
}
|
|
3004
|
-
function close() {
|
|
3005
|
-
dropdownIsOpen.value = false;
|
|
3006
|
-
activeOption.value = null;
|
|
3007
|
-
}
|
|
3008
|
-
function setNextOption() {
|
|
3009
|
-
if (activeOption.value) {
|
|
3010
|
-
const index = __props.column.options.indexOf(activeOption.value);
|
|
3011
|
-
if (index === __props.column.options.length - 1) {
|
|
3012
|
-
activeOption.value = __props.column.options[0];
|
|
3013
|
-
} else {
|
|
3014
|
-
activeOption.value = __props.column.options[index + 1];
|
|
3015
|
-
}
|
|
3016
|
-
} else {
|
|
3017
|
-
activeOption.value = __props.column.options[0];
|
|
3018
|
-
}
|
|
3019
|
-
}
|
|
3020
|
-
function setPreviousOption() {
|
|
3021
|
-
if (activeOption.value) {
|
|
3022
|
-
const index = __props.column.options.indexOf(activeOption.value);
|
|
3023
|
-
if (index === 0) {
|
|
3024
|
-
activeOption.value = __props.column.options[__props.column.options.length - 1];
|
|
3025
|
-
} else {
|
|
3026
|
-
activeOption.value = __props.column.options[index - 1];
|
|
3027
|
-
}
|
|
3028
|
-
} else {
|
|
3029
|
-
activeOption.value = __props.column.options[__props.column.options.length - 1];
|
|
3030
|
-
}
|
|
3031
|
-
}
|
|
3032
|
-
async function onEditKeyDown(e) {
|
|
3033
|
-
logic.assertRef(editRef);
|
|
3034
|
-
logic.assertSet(stopEdit2);
|
|
3035
|
-
switch (e.code) {
|
|
3036
|
-
case "Escape":
|
|
3037
|
-
e.preventDefault();
|
|
3038
|
-
cancel();
|
|
3039
|
-
stopEdit2(editRef.value, "escape");
|
|
3040
|
-
break;
|
|
3041
|
-
case "Enter":
|
|
3042
|
-
case "NumpadEnter":
|
|
3043
|
-
e.preventDefault();
|
|
3044
|
-
submit();
|
|
3045
|
-
if (activeOption.value) {
|
|
3046
|
-
viewValue.value = activeOption.value;
|
|
3047
|
-
}
|
|
3048
|
-
close();
|
|
3049
|
-
stopEdit2(editRef.value, "enter");
|
|
3050
|
-
break;
|
|
3051
|
-
case "Tab":
|
|
3052
|
-
e.preventDefault();
|
|
3053
|
-
cancel();
|
|
3054
|
-
stopEdit2(editRef.value, e.shiftKey ? "shift-tab" : "tab");
|
|
3055
|
-
break;
|
|
3056
|
-
case "ArrowDown":
|
|
3057
|
-
e.preventDefault();
|
|
3058
|
-
if (dropdownIsOpen.value) {
|
|
3059
|
-
setNextOption();
|
|
3060
|
-
} else {
|
|
3061
|
-
openSelected("first");
|
|
3062
|
-
}
|
|
3063
|
-
break;
|
|
3064
|
-
case "ArrowUp":
|
|
3065
|
-
e.preventDefault();
|
|
3066
|
-
if (dropdownIsOpen.value) {
|
|
3067
|
-
setPreviousOption();
|
|
3068
|
-
} else {
|
|
3069
|
-
openSelected("last");
|
|
3070
|
-
}
|
|
3071
|
-
break;
|
|
3072
|
-
}
|
|
3073
|
-
}
|
|
3074
|
-
async function onEditBlur() {
|
|
3075
|
-
if (editing.value) {
|
|
3076
|
-
logic.assertSet(stopEdit2);
|
|
3077
|
-
logic.assertRef(editRef);
|
|
3078
|
-
dropdownIsOpen.value = false;
|
|
3079
|
-
editing.value = false;
|
|
3080
|
-
await vue.nextTick();
|
|
3081
|
-
stopEdit2(editRef.value, "blur");
|
|
3082
|
-
}
|
|
3083
|
-
}
|
|
3084
|
-
async function submit() {
|
|
3085
|
-
editing.value = false;
|
|
3086
|
-
await vue.nextTick();
|
|
3087
|
-
}
|
|
3088
|
-
function cancel() {
|
|
3089
|
-
logic.assertSet(stopEdit2);
|
|
3090
|
-
logic.assertRef(editRef);
|
|
3091
|
-
stopEdit2(editRef.value, "escape");
|
|
3092
|
-
}
|
|
3093
|
-
return (_ctx, _cache) => {
|
|
3094
|
-
return _ctx.column.editable(_ctx.row) ? (vue.openBlock(), vue.createElementBlock("td", {
|
|
3095
|
-
key: 0,
|
|
3096
|
-
ref: "td",
|
|
3097
|
-
class: "table-ng__cell table-ng__cell--select",
|
|
3098
|
-
tabindex: "-1",
|
|
3099
|
-
onKeydown: onCellKeyDown,
|
|
3100
|
-
onClick: vue.withModifiers(onCellClick, ["stop"]),
|
|
3101
|
-
onTableActivateCell: onActivateCell
|
|
3102
|
-
}, [vue.withDirectives(vue.createElementVNode("div", _hoisted_1$7, [vue.createElementVNode("span", _hoisted_2$3, vue.toDisplayString(viewValue.value), 1), _cache[2] || (_cache[2] = vue.createTextVNode()), vue.createVNode(vue.unref(vue$1.FIcon), {
|
|
3103
|
-
name: "pen",
|
|
3104
|
-
class: "table-ng__editable__icon"
|
|
3105
|
-
})], 512), [[vue.vShow, !editing.value]]), _cache[3] || (_cache[3] = vue.createTextVNode()), vue.withDirectives(vue.createElementVNode("div", {
|
|
3106
|
-
ref: "edit",
|
|
3107
|
-
role: "combobox",
|
|
3108
|
-
tabindex: "-1",
|
|
3109
|
-
"aria-expanded": "",
|
|
3110
|
-
"aria-controls": vue.unref(dropdownId),
|
|
3111
|
-
"aria-autocomplete": "list",
|
|
3112
|
-
class: "table-ng__editable",
|
|
3113
|
-
onClick: _cache[0] || (_cache[0] = vue.withModifiers(() => {
|
|
3114
|
-
}, ["stop"])),
|
|
3115
|
-
onDblclick: _cache[1] || (_cache[1] = vue.withModifiers(() => {
|
|
3116
|
-
}, ["prevent"])),
|
|
3117
|
-
onKeydown: vue.withModifiers(onEditKeyDown, ["stop"]),
|
|
3118
|
-
onFocusout: onEditBlur
|
|
3119
|
-
}, vue.toDisplayString(viewValue.value), 41, _hoisted_3$1), [[vue.vShow, editing.value]]), _cache[4] || (_cache[4] = vue.createTextVNode()), vue.withDirectives(vue.createVNode(vue.unref(vue$1.IComboboxDropdown), {
|
|
3120
|
-
id: "dropdownId",
|
|
3121
|
-
"is-open": dropdownIsOpen.value,
|
|
3122
|
-
options: _ctx.column.options,
|
|
3123
|
-
"active-option": activeOption.value,
|
|
3124
|
-
"active-option-id": vue.unref(activeOptionId),
|
|
3125
|
-
"input-node": editRef.value,
|
|
3126
|
-
onSelect: onDropdownSelect,
|
|
3127
|
-
onClose: onDropdownClose
|
|
3128
|
-
}, null, 8, ["is-open", "options", "active-option", "active-option-id", "input-node"]), [[vue.vShow, editing.value]])], 544)) : (vue.openBlock(), vue.createElementBlock("td", {
|
|
3129
|
-
key: 1,
|
|
3130
|
-
ref: "td",
|
|
3131
|
-
tabindex: "-1",
|
|
3132
|
-
class: "table-ng__cell table-ng__cell--static",
|
|
3133
|
-
onTableActivateCell: onActivateCell
|
|
3134
|
-
}, vue.toDisplayString(_ctx.column.value(_ctx.row)), 545));
|
|
3135
|
-
};
|
|
3136
|
-
}
|
|
3137
|
-
});
|
|
3138
|
-
const _hoisted_1$6 = ["checked", "aria-label"];
|
|
3139
|
-
const _hoisted_2$2 = ["checked", "aria-label"];
|
|
3140
|
-
const _sfc_main$7 = /* @__PURE__ */ vue.defineComponent({
|
|
2790
|
+
const _hoisted_1$7 = ["checked", "aria-label"];
|
|
2791
|
+
const _hoisted_2$3 = ["checked", "aria-label"];
|
|
2792
|
+
const _sfc_main$8 = /* @__PURE__ */ vue.defineComponent({
|
|
3141
2793
|
__name: "ITableCheckbox",
|
|
3142
2794
|
props: {
|
|
3143
2795
|
column: {},
|
|
@@ -3168,7 +2820,7 @@ const _sfc_main$7 = /* @__PURE__ */ vue.defineComponent({
|
|
|
3168
2820
|
"aria-label": _ctx.column.header,
|
|
3169
2821
|
tabindex: "-1",
|
|
3170
2822
|
onChange
|
|
3171
|
-
}, null, 40, _hoisted_1$
|
|
2823
|
+
}, null, 40, _hoisted_1$7)], 32)) : (vue.openBlock(), vue.createElementBlock("td", {
|
|
3172
2824
|
key: 1,
|
|
3173
2825
|
ref: "target",
|
|
3174
2826
|
tabindex: "-1",
|
|
@@ -3179,12 +2831,12 @@ const _sfc_main$7 = /* @__PURE__ */ vue.defineComponent({
|
|
|
3179
2831
|
type: "checkbox",
|
|
3180
2832
|
"aria-label": _ctx.column.header,
|
|
3181
2833
|
disabled: ""
|
|
3182
|
-
}, null, 8, _hoisted_2$
|
|
2834
|
+
}, null, 8, _hoisted_2$3)], 544));
|
|
3183
2835
|
};
|
|
3184
2836
|
}
|
|
3185
2837
|
});
|
|
3186
|
-
const _hoisted_1$
|
|
3187
|
-
const _sfc_main$
|
|
2838
|
+
const _hoisted_1$6 = ["checked", "aria-label"];
|
|
2839
|
+
const _sfc_main$7 = /* @__PURE__ */ vue.defineComponent({
|
|
3188
2840
|
__name: "ITableRadio",
|
|
3189
2841
|
props: {
|
|
3190
2842
|
column: {},
|
|
@@ -3214,12 +2866,12 @@ const _sfc_main$6 = /* @__PURE__ */ vue.defineComponent({
|
|
|
3214
2866
|
"aria-label": _ctx.column.header,
|
|
3215
2867
|
tabindex: "-1",
|
|
3216
2868
|
onChange
|
|
3217
|
-
}, null, 40, _hoisted_1$
|
|
2869
|
+
}, null, 40, _hoisted_1$6)], 32);
|
|
3218
2870
|
};
|
|
3219
2871
|
}
|
|
3220
2872
|
});
|
|
3221
|
-
const _hoisted_1$
|
|
3222
|
-
const _sfc_main$
|
|
2873
|
+
const _hoisted_1$5 = ["href"];
|
|
2874
|
+
const _sfc_main$6 = /* @__PURE__ */ vue.defineComponent({
|
|
3223
2875
|
__name: "ITableAnchor",
|
|
3224
2876
|
props: {
|
|
3225
2877
|
column: {},
|
|
@@ -3248,7 +2900,7 @@ const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
|
|
|
3248
2900
|
target: "_blank",
|
|
3249
2901
|
href: _ctx.column.href,
|
|
3250
2902
|
tabindex: "-1"
|
|
3251
|
-
}, vue.toDisplayString(_ctx.column.value(_ctx.row)), 9, _hoisted_1$
|
|
2903
|
+
}, vue.toDisplayString(_ctx.column.value(_ctx.row)), 9, _hoisted_1$5)], 32)) : (vue.openBlock(), vue.createElementBlock("td", {
|
|
3252
2904
|
key: 1,
|
|
3253
2905
|
ref: "target",
|
|
3254
2906
|
tabindex: "-1",
|
|
@@ -3258,10 +2910,10 @@ const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
|
|
|
3258
2910
|
};
|
|
3259
2911
|
}
|
|
3260
2912
|
});
|
|
3261
|
-
const _hoisted_1$
|
|
2913
|
+
const _hoisted_1$4 = {
|
|
3262
2914
|
class: "sr-only"
|
|
3263
2915
|
};
|
|
3264
|
-
const _sfc_main$
|
|
2916
|
+
const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
|
|
3265
2917
|
__name: "ITableButton",
|
|
3266
2918
|
props: {
|
|
3267
2919
|
column: {},
|
|
@@ -3302,7 +2954,7 @@ const _sfc_main$4 = /* @__PURE__ */ vue.defineComponent({
|
|
|
3302
2954
|
}, [_ctx.column.icon ? (vue.openBlock(), vue.createBlock(vue.unref(vue$1.FIcon), {
|
|
3303
2955
|
key: 0,
|
|
3304
2956
|
name: _ctx.column.icon
|
|
3305
|
-
}, null, 8, ["name"])) : vue.createCommentVNode("", true), _cache[0] || (_cache[0] = vue.createTextVNode()), vue.createElementVNode("span", _hoisted_1$
|
|
2957
|
+
}, null, 8, ["name"])) : vue.createCommentVNode("", true), _cache[0] || (_cache[0] = vue.createTextVNode()), vue.createElementVNode("span", _hoisted_1$4, vue.toDisplayString(_ctx.column.value(_ctx.row)), 1)], 512)], 32)) : (vue.openBlock(), vue.createElementBlock("td", {
|
|
3306
2958
|
key: 1,
|
|
3307
2959
|
ref: "td",
|
|
3308
2960
|
tabindex: "-1",
|
|
@@ -3312,13 +2964,20 @@ const _sfc_main$4 = /* @__PURE__ */ vue.defineComponent({
|
|
|
3312
2964
|
};
|
|
3313
2965
|
}
|
|
3314
2966
|
});
|
|
2967
|
+
const stopEditKey = Symbol();
|
|
2968
|
+
function useStartStopEdit() {
|
|
2969
|
+
const stopEdit2 = vue.inject(stopEditKey, () => Promise.resolve());
|
|
2970
|
+
return {
|
|
2971
|
+
stopEdit: stopEdit2
|
|
2972
|
+
};
|
|
2973
|
+
}
|
|
3315
2974
|
function isAlphanumeric(e) {
|
|
3316
2975
|
return e.key.length === 1 && !e.ctrlKey && !e.metaKey;
|
|
3317
2976
|
}
|
|
3318
|
-
const _hoisted_1$
|
|
2977
|
+
const _hoisted_1$3 = {
|
|
3319
2978
|
class: "table-ng__editable"
|
|
3320
2979
|
};
|
|
3321
|
-
const _sfc_main$
|
|
2980
|
+
const _sfc_main$4 = /* @__PURE__ */ vue.defineComponent({
|
|
3322
2981
|
__name: "ITableText",
|
|
3323
2982
|
props: {
|
|
3324
2983
|
row: {},
|
|
@@ -3432,66 +3091,289 @@ const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
|
|
|
3432
3091
|
});
|
|
3433
3092
|
}
|
|
3434
3093
|
}
|
|
3435
|
-
function onKeydown(event) {
|
|
3436
|
-
const editing = document.activeElement === inputElement.value;
|
|
3437
|
-
if (editing) {
|
|
3438
|
-
onEditingKeydown(event);
|
|
3439
|
-
} else {
|
|
3440
|
-
onViewingKeydown(event);
|
|
3094
|
+
function onKeydown(event) {
|
|
3095
|
+
const editing = document.activeElement === inputElement.value;
|
|
3096
|
+
if (editing) {
|
|
3097
|
+
onEditingKeydown(event);
|
|
3098
|
+
} else {
|
|
3099
|
+
onViewingKeydown(event);
|
|
3100
|
+
}
|
|
3101
|
+
}
|
|
3102
|
+
function onBlur() {
|
|
3103
|
+
logic.assertRef(tdElement);
|
|
3104
|
+
tdElement.value.style.removeProperty("width");
|
|
3105
|
+
const isDirty = model.value !== "";
|
|
3106
|
+
if (isDirty) {
|
|
3107
|
+
const oldValue = __props.column.value(__props.row);
|
|
3108
|
+
const newValue = model.value;
|
|
3109
|
+
__props.column.update(__props.row, newValue, oldValue);
|
|
3110
|
+
}
|
|
3111
|
+
}
|
|
3112
|
+
function onValidity(event) {
|
|
3113
|
+
const {
|
|
3114
|
+
isValid,
|
|
3115
|
+
validationMessage,
|
|
3116
|
+
validityMode
|
|
3117
|
+
} = event.detail;
|
|
3118
|
+
validity.value = {
|
|
3119
|
+
isValid,
|
|
3120
|
+
validationMessage,
|
|
3121
|
+
validityMode
|
|
3122
|
+
};
|
|
3123
|
+
}
|
|
3124
|
+
return (_ctx, _cache) => {
|
|
3125
|
+
return _ctx.column.editable(_ctx.row) ? (vue.openBlock(), vue.createElementBlock("td", {
|
|
3126
|
+
key: 0,
|
|
3127
|
+
ref: "td",
|
|
3128
|
+
tabindex: "-1",
|
|
3129
|
+
class: vue.normalizeClass(wrapperClasses.value),
|
|
3130
|
+
onClick: vue.withModifiers(onClickCell, ["stop"]),
|
|
3131
|
+
onKeydown,
|
|
3132
|
+
onTableActivateCell: onActivateCell
|
|
3133
|
+
}, [vue.createElementVNode("div", _hoisted_1$3, [vue.createElementVNode("span", {
|
|
3134
|
+
ref: "view",
|
|
3135
|
+
class: "table-ng__editable__text"
|
|
3136
|
+
}, vue.toDisplayString(_ctx.column.value(_ctx.row)), 513), _cache[1] || (_cache[1] = vue.createTextVNode()), vue.withDirectives(vue.createElementVNode("input", {
|
|
3137
|
+
ref: "input",
|
|
3138
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => model.value = $event),
|
|
3139
|
+
class: vue.normalizeClass(inputClasses.value),
|
|
3140
|
+
type: "text",
|
|
3141
|
+
maxlength: "40",
|
|
3142
|
+
tabindex: "-1",
|
|
3143
|
+
onBlur,
|
|
3144
|
+
onValidity
|
|
3145
|
+
}, null, 34), [[vue.vModelText, model.value]]), _cache[2] || (_cache[2] = vue.createTextVNode()), hasError.value ? (vue.openBlock(), vue.createBlock(vue.unref(vue$1.FIcon), {
|
|
3146
|
+
key: 0,
|
|
3147
|
+
name: "error",
|
|
3148
|
+
class: "table-ng__editable__icon"
|
|
3149
|
+
})) : (vue.openBlock(), vue.createBlock(vue.unref(vue$1.FIcon), {
|
|
3150
|
+
key: 1,
|
|
3151
|
+
name: "pen",
|
|
3152
|
+
class: "table-ng__editable__icon"
|
|
3153
|
+
}))])], 34)) : (vue.openBlock(), vue.createElementBlock("td", {
|
|
3154
|
+
key: 1,
|
|
3155
|
+
ref: "td",
|
|
3156
|
+
tabindex: "-1",
|
|
3157
|
+
class: "table-ng__cell table-ng__cell--static",
|
|
3158
|
+
onTableActivateCell: onActivateCell
|
|
3159
|
+
}, vue.toDisplayString(_ctx.column.value(_ctx.row)), 545));
|
|
3160
|
+
};
|
|
3161
|
+
}
|
|
3162
|
+
});
|
|
3163
|
+
const _hoisted_1$2 = {
|
|
3164
|
+
class: "table-ng__editable"
|
|
3165
|
+
};
|
|
3166
|
+
const _hoisted_2$2 = {
|
|
3167
|
+
class: "table-ng__editable__text"
|
|
3168
|
+
};
|
|
3169
|
+
const _hoisted_3$1 = ["aria-controls"];
|
|
3170
|
+
const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
|
|
3171
|
+
__name: "ITableSelect",
|
|
3172
|
+
props: {
|
|
3173
|
+
row: {},
|
|
3174
|
+
column: {}
|
|
3175
|
+
},
|
|
3176
|
+
setup(__props) {
|
|
3177
|
+
const editing = vue.ref(false);
|
|
3178
|
+
const editRef = vue.useTemplateRef("edit");
|
|
3179
|
+
const {
|
|
3180
|
+
stopEdit: stopEdit2
|
|
3181
|
+
} = useStartStopEdit();
|
|
3182
|
+
const viewValue = vue.ref(__props.column.value(__props.row));
|
|
3183
|
+
const tdRef = vue.useTemplateRef("td");
|
|
3184
|
+
function onActivateCell(e) {
|
|
3185
|
+
logic.assertRef(tdRef);
|
|
3186
|
+
tdRef.value.tabIndex = 0;
|
|
3187
|
+
if (e.detail.focus) {
|
|
3188
|
+
tdRef.value.focus();
|
|
3189
|
+
}
|
|
3190
|
+
}
|
|
3191
|
+
async function onCellKeyDown(e) {
|
|
3192
|
+
if (e.code === "Enter" || e.code === "NumpadEnter") {
|
|
3193
|
+
startEditing(e);
|
|
3194
|
+
}
|
|
3195
|
+
}
|
|
3196
|
+
async function onCellClick(e) {
|
|
3197
|
+
if (editing.value) {
|
|
3198
|
+
return;
|
|
3199
|
+
}
|
|
3200
|
+
startEditing(e);
|
|
3201
|
+
}
|
|
3202
|
+
async function startEditing(e) {
|
|
3203
|
+
logic.assertRef(editRef);
|
|
3204
|
+
e.preventDefault();
|
|
3205
|
+
editing.value = true;
|
|
3206
|
+
await vue.nextTick();
|
|
3207
|
+
editRef.value.tabIndex = 0;
|
|
3208
|
+
editRef.value.focus();
|
|
3209
|
+
openSelected("first");
|
|
3210
|
+
}
|
|
3211
|
+
async function onDropdownSelect(value) {
|
|
3212
|
+
logic.assertRef(editRef);
|
|
3213
|
+
logic.assertSet(stopEdit2);
|
|
3214
|
+
close();
|
|
3215
|
+
submit();
|
|
3216
|
+
viewValue.value = value;
|
|
3217
|
+
stopEdit2(editRef.value, "enter");
|
|
3218
|
+
}
|
|
3219
|
+
function onDropdownClose() {
|
|
3220
|
+
logic.assertRef(editRef);
|
|
3221
|
+
logic.assertSet(stopEdit2);
|
|
3222
|
+
stopEdit2(editRef.value, "escape");
|
|
3223
|
+
}
|
|
3224
|
+
const dropdownId = logic.ElementIdService.generateElementId();
|
|
3225
|
+
const dropdownIsOpen = vue.ref(false);
|
|
3226
|
+
const activeOptionId = logic.ElementIdService.generateElementId();
|
|
3227
|
+
const activeOption = vue.ref(null);
|
|
3228
|
+
vue.watchEffect(async () => {
|
|
3229
|
+
if (!editRef.value) {
|
|
3230
|
+
return;
|
|
3231
|
+
}
|
|
3232
|
+
if (activeOption.value) {
|
|
3233
|
+
editRef.value.setAttribute("aria-activedescendant", activeOptionId);
|
|
3234
|
+
} else {
|
|
3235
|
+
editRef.value.removeAttribute("aria-activedescendant");
|
|
3236
|
+
}
|
|
3237
|
+
});
|
|
3238
|
+
async function openSelected(fallback = null) {
|
|
3239
|
+
dropdownIsOpen.value = true;
|
|
3240
|
+
await vue.nextTick();
|
|
3241
|
+
if (viewValue.value) {
|
|
3242
|
+
activeOption.value = viewValue.value;
|
|
3243
|
+
} else if (fallback === "first") {
|
|
3244
|
+
activeOption.value = __props.column.options[0];
|
|
3245
|
+
} else if (fallback === "last") {
|
|
3246
|
+
activeOption.value = __props.column.options[__props.column.options.length - 1];
|
|
3247
|
+
} else {
|
|
3248
|
+
activeOption.value = null;
|
|
3249
|
+
}
|
|
3250
|
+
editRef.value?.focus();
|
|
3251
|
+
}
|
|
3252
|
+
function close() {
|
|
3253
|
+
dropdownIsOpen.value = false;
|
|
3254
|
+
activeOption.value = null;
|
|
3255
|
+
}
|
|
3256
|
+
function setNextOption() {
|
|
3257
|
+
if (activeOption.value) {
|
|
3258
|
+
const index = __props.column.options.indexOf(activeOption.value);
|
|
3259
|
+
if (index === __props.column.options.length - 1) {
|
|
3260
|
+
activeOption.value = __props.column.options[0];
|
|
3261
|
+
} else {
|
|
3262
|
+
activeOption.value = __props.column.options[index + 1];
|
|
3263
|
+
}
|
|
3264
|
+
} else {
|
|
3265
|
+
activeOption.value = __props.column.options[0];
|
|
3266
|
+
}
|
|
3267
|
+
}
|
|
3268
|
+
function setPreviousOption() {
|
|
3269
|
+
if (activeOption.value) {
|
|
3270
|
+
const index = __props.column.options.indexOf(activeOption.value);
|
|
3271
|
+
if (index === 0) {
|
|
3272
|
+
activeOption.value = __props.column.options[__props.column.options.length - 1];
|
|
3273
|
+
} else {
|
|
3274
|
+
activeOption.value = __props.column.options[index - 1];
|
|
3275
|
+
}
|
|
3276
|
+
} else {
|
|
3277
|
+
activeOption.value = __props.column.options[__props.column.options.length - 1];
|
|
3278
|
+
}
|
|
3279
|
+
}
|
|
3280
|
+
async function onEditKeyDown(e) {
|
|
3281
|
+
logic.assertRef(editRef);
|
|
3282
|
+
logic.assertSet(stopEdit2);
|
|
3283
|
+
switch (e.code) {
|
|
3284
|
+
case "Escape":
|
|
3285
|
+
e.preventDefault();
|
|
3286
|
+
cancel();
|
|
3287
|
+
stopEdit2(editRef.value, "escape");
|
|
3288
|
+
break;
|
|
3289
|
+
case "Enter":
|
|
3290
|
+
case "NumpadEnter":
|
|
3291
|
+
e.preventDefault();
|
|
3292
|
+
submit();
|
|
3293
|
+
if (activeOption.value) {
|
|
3294
|
+
viewValue.value = activeOption.value;
|
|
3295
|
+
}
|
|
3296
|
+
close();
|
|
3297
|
+
stopEdit2(editRef.value, "enter");
|
|
3298
|
+
break;
|
|
3299
|
+
case "Tab":
|
|
3300
|
+
e.preventDefault();
|
|
3301
|
+
cancel();
|
|
3302
|
+
stopEdit2(editRef.value, e.shiftKey ? "shift-tab" : "tab");
|
|
3303
|
+
break;
|
|
3304
|
+
case "ArrowDown":
|
|
3305
|
+
e.preventDefault();
|
|
3306
|
+
if (dropdownIsOpen.value) {
|
|
3307
|
+
setNextOption();
|
|
3308
|
+
} else {
|
|
3309
|
+
openSelected("first");
|
|
3310
|
+
}
|
|
3311
|
+
break;
|
|
3312
|
+
case "ArrowUp":
|
|
3313
|
+
e.preventDefault();
|
|
3314
|
+
if (dropdownIsOpen.value) {
|
|
3315
|
+
setPreviousOption();
|
|
3316
|
+
} else {
|
|
3317
|
+
openSelected("last");
|
|
3318
|
+
}
|
|
3319
|
+
break;
|
|
3441
3320
|
}
|
|
3442
3321
|
}
|
|
3443
|
-
function
|
|
3444
|
-
|
|
3445
|
-
|
|
3446
|
-
|
|
3447
|
-
|
|
3448
|
-
|
|
3449
|
-
|
|
3450
|
-
|
|
3322
|
+
async function onEditBlur() {
|
|
3323
|
+
if (editing.value) {
|
|
3324
|
+
logic.assertSet(stopEdit2);
|
|
3325
|
+
logic.assertRef(editRef);
|
|
3326
|
+
dropdownIsOpen.value = false;
|
|
3327
|
+
editing.value = false;
|
|
3328
|
+
await vue.nextTick();
|
|
3329
|
+
stopEdit2(editRef.value, "blur");
|
|
3451
3330
|
}
|
|
3452
3331
|
}
|
|
3453
|
-
function
|
|
3454
|
-
|
|
3455
|
-
|
|
3456
|
-
|
|
3457
|
-
|
|
3458
|
-
|
|
3459
|
-
|
|
3460
|
-
|
|
3461
|
-
validationMessage,
|
|
3462
|
-
validityMode
|
|
3463
|
-
};
|
|
3332
|
+
async function submit() {
|
|
3333
|
+
editing.value = false;
|
|
3334
|
+
await vue.nextTick();
|
|
3335
|
+
}
|
|
3336
|
+
function cancel() {
|
|
3337
|
+
logic.assertSet(stopEdit2);
|
|
3338
|
+
logic.assertRef(editRef);
|
|
3339
|
+
stopEdit2(editRef.value, "escape");
|
|
3464
3340
|
}
|
|
3465
3341
|
return (_ctx, _cache) => {
|
|
3466
3342
|
return _ctx.column.editable(_ctx.row) ? (vue.openBlock(), vue.createElementBlock("td", {
|
|
3467
3343
|
key: 0,
|
|
3468
3344
|
ref: "td",
|
|
3345
|
+
class: "table-ng__cell table-ng__cell--select",
|
|
3469
3346
|
tabindex: "-1",
|
|
3470
|
-
|
|
3471
|
-
onClick: vue.withModifiers(
|
|
3472
|
-
onKeydown,
|
|
3347
|
+
onKeydown: onCellKeyDown,
|
|
3348
|
+
onClick: vue.withModifiers(onCellClick, ["stop"]),
|
|
3473
3349
|
onTableActivateCell: onActivateCell
|
|
3474
|
-
}, [vue.createElementVNode("div", _hoisted_1$2, [vue.createElementVNode("span", {
|
|
3475
|
-
ref: "view",
|
|
3476
|
-
class: "table-ng__editable__text"
|
|
3477
|
-
}, vue.toDisplayString(_ctx.column.value(_ctx.row)), 513), _cache[1] || (_cache[1] = vue.createTextVNode()), vue.withDirectives(vue.createElementVNode("input", {
|
|
3478
|
-
ref: "input",
|
|
3479
|
-
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => model.value = $event),
|
|
3480
|
-
class: vue.normalizeClass(inputClasses.value),
|
|
3481
|
-
type: "text",
|
|
3482
|
-
maxlength: "40",
|
|
3483
|
-
tabindex: "-1",
|
|
3484
|
-
onBlur,
|
|
3485
|
-
onValidity
|
|
3486
|
-
}, null, 34), [[vue.vModelText, model.value]]), _cache[2] || (_cache[2] = vue.createTextVNode()), hasError.value ? (vue.openBlock(), vue.createBlock(vue.unref(vue$1.FIcon), {
|
|
3487
|
-
key: 0,
|
|
3488
|
-
name: "error",
|
|
3489
|
-
class: "table-ng__editable__icon"
|
|
3490
|
-
})) : (vue.openBlock(), vue.createBlock(vue.unref(vue$1.FIcon), {
|
|
3491
|
-
key: 1,
|
|
3350
|
+
}, [vue.withDirectives(vue.createElementVNode("div", _hoisted_1$2, [vue.createElementVNode("span", _hoisted_2$2, vue.toDisplayString(viewValue.value), 1), _cache[2] || (_cache[2] = vue.createTextVNode()), vue.createVNode(vue.unref(vue$1.FIcon), {
|
|
3492
3351
|
name: "pen",
|
|
3493
3352
|
class: "table-ng__editable__icon"
|
|
3494
|
-
})
|
|
3353
|
+
})], 512), [[vue.vShow, !editing.value]]), _cache[3] || (_cache[3] = vue.createTextVNode()), vue.withDirectives(vue.createElementVNode("div", {
|
|
3354
|
+
ref: "edit",
|
|
3355
|
+
role: "combobox",
|
|
3356
|
+
tabindex: "-1",
|
|
3357
|
+
"aria-expanded": "",
|
|
3358
|
+
"aria-controls": vue.unref(dropdownId),
|
|
3359
|
+
"aria-autocomplete": "list",
|
|
3360
|
+
class: "table-ng__editable",
|
|
3361
|
+
onClick: _cache[0] || (_cache[0] = vue.withModifiers(() => {
|
|
3362
|
+
}, ["stop"])),
|
|
3363
|
+
onDblclick: _cache[1] || (_cache[1] = vue.withModifiers(() => {
|
|
3364
|
+
}, ["prevent"])),
|
|
3365
|
+
onKeydown: vue.withModifiers(onEditKeyDown, ["stop"]),
|
|
3366
|
+
onFocusout: onEditBlur
|
|
3367
|
+
}, vue.toDisplayString(viewValue.value), 41, _hoisted_3$1), [[vue.vShow, editing.value]]), _cache[4] || (_cache[4] = vue.createTextVNode()), vue.withDirectives(vue.createVNode(vue.unref(vue$1.IComboboxDropdown), {
|
|
3368
|
+
id: "dropdownId",
|
|
3369
|
+
"is-open": dropdownIsOpen.value,
|
|
3370
|
+
options: _ctx.column.options,
|
|
3371
|
+
"active-option": activeOption.value,
|
|
3372
|
+
"active-option-id": vue.unref(activeOptionId),
|
|
3373
|
+
"input-node": editRef.value,
|
|
3374
|
+
onSelect: onDropdownSelect,
|
|
3375
|
+
onClose: onDropdownClose
|
|
3376
|
+
}, null, 8, ["is-open", "options", "active-option", "active-option-id", "input-node"]), [[vue.vShow, editing.value]])], 544)) : (vue.openBlock(), vue.createElementBlock("td", {
|
|
3495
3377
|
key: 1,
|
|
3496
3378
|
ref: "td",
|
|
3497
3379
|
tabindex: "-1",
|
|
@@ -3501,6 +3383,138 @@ const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
|
|
|
3501
3383
|
};
|
|
3502
3384
|
}
|
|
3503
3385
|
});
|
|
3386
|
+
function getValueFn(fn, key, coerce, defaultValue) {
|
|
3387
|
+
if (fn) {
|
|
3388
|
+
return fn;
|
|
3389
|
+
}
|
|
3390
|
+
if (key) {
|
|
3391
|
+
return (row) => {
|
|
3392
|
+
return coerce(row[key]);
|
|
3393
|
+
};
|
|
3394
|
+
}
|
|
3395
|
+
return () => defaultValue;
|
|
3396
|
+
}
|
|
3397
|
+
function getUpdateFn(fn, key) {
|
|
3398
|
+
if (fn) {
|
|
3399
|
+
return fn;
|
|
3400
|
+
}
|
|
3401
|
+
if (key) {
|
|
3402
|
+
return (row, value) => {
|
|
3403
|
+
row[key] = value;
|
|
3404
|
+
};
|
|
3405
|
+
}
|
|
3406
|
+
return () => void 0;
|
|
3407
|
+
}
|
|
3408
|
+
function normalizeTableColumn(column) {
|
|
3409
|
+
var _column$key, _column$key2, _column$validation, _column$key3, _column$key4, _column$icon, _column$key5, _column$key6, _column$key7;
|
|
3410
|
+
if ("render" in column) {
|
|
3411
|
+
return {
|
|
3412
|
+
type: void 0,
|
|
3413
|
+
header: column.header,
|
|
3414
|
+
render: column.render,
|
|
3415
|
+
sortable: null
|
|
3416
|
+
};
|
|
3417
|
+
}
|
|
3418
|
+
switch (column.type) {
|
|
3419
|
+
case "checkbox":
|
|
3420
|
+
return {
|
|
3421
|
+
type: "checkbox",
|
|
3422
|
+
header: column.header,
|
|
3423
|
+
value: getValueFn(column.value, column.key, Boolean, false),
|
|
3424
|
+
update: getUpdateFn(column.update, column.key),
|
|
3425
|
+
editable: typeof column.editable === "function" ? column.editable : () => {
|
|
3426
|
+
var _column$editable;
|
|
3427
|
+
return Boolean((_column$editable = column.editable) !== null && _column$editable !== void 0 ? _column$editable : false);
|
|
3428
|
+
},
|
|
3429
|
+
sortable: (_column$key = column.key) !== null && _column$key !== void 0 ? _column$key : null,
|
|
3430
|
+
component: _sfc_main$8
|
|
3431
|
+
};
|
|
3432
|
+
case "radio":
|
|
3433
|
+
return {
|
|
3434
|
+
type: "radio",
|
|
3435
|
+
header: column.header,
|
|
3436
|
+
value: getValueFn(column.value, column.key, Boolean, false),
|
|
3437
|
+
update: getUpdateFn(column.update, column.key),
|
|
3438
|
+
sortable: (_column$key2 = column.key) !== null && _column$key2 !== void 0 ? _column$key2 : null,
|
|
3439
|
+
component: _sfc_main$7
|
|
3440
|
+
};
|
|
3441
|
+
case "text":
|
|
3442
|
+
return {
|
|
3443
|
+
type: "text",
|
|
3444
|
+
header: column.header,
|
|
3445
|
+
value: getValueFn(column.value, column.key, String, ""),
|
|
3446
|
+
update: getUpdateFn(column.update, column.key),
|
|
3447
|
+
editable: typeof column.editable === "function" ? column.editable : () => {
|
|
3448
|
+
var _column$editable2;
|
|
3449
|
+
return Boolean((_column$editable2 = column.editable) !== null && _column$editable2 !== void 0 ? _column$editable2 : false);
|
|
3450
|
+
},
|
|
3451
|
+
validation: (_column$validation = column.validation) !== null && _column$validation !== void 0 ? _column$validation : {},
|
|
3452
|
+
sortable: (_column$key3 = column.key) !== null && _column$key3 !== void 0 ? _column$key3 : null,
|
|
3453
|
+
component: _sfc_main$4
|
|
3454
|
+
};
|
|
3455
|
+
case "anchor":
|
|
3456
|
+
return {
|
|
3457
|
+
type: "anchor",
|
|
3458
|
+
header: column.header,
|
|
3459
|
+
value: column.value,
|
|
3460
|
+
href: column.href,
|
|
3461
|
+
enabled: typeof column.enabled === "function" ? column.enabled : () => {
|
|
3462
|
+
var _column$enabled;
|
|
3463
|
+
return Boolean((_column$enabled = column.enabled) !== null && _column$enabled !== void 0 ? _column$enabled : true);
|
|
3464
|
+
},
|
|
3465
|
+
sortable: (_column$key4 = column.key) !== null && _column$key4 !== void 0 ? _column$key4 : null,
|
|
3466
|
+
component: _sfc_main$6
|
|
3467
|
+
};
|
|
3468
|
+
case "button":
|
|
3469
|
+
return {
|
|
3470
|
+
type: "button",
|
|
3471
|
+
header: column.header,
|
|
3472
|
+
value: column.value,
|
|
3473
|
+
onClick: column.onClick,
|
|
3474
|
+
enabled: typeof column.enabled === "function" ? column.enabled : () => {
|
|
3475
|
+
var _column$enabled2;
|
|
3476
|
+
return Boolean((_column$enabled2 = column.enabled) !== null && _column$enabled2 !== void 0 ? _column$enabled2 : true);
|
|
3477
|
+
},
|
|
3478
|
+
icon: (_column$icon = column.icon) !== null && _column$icon !== void 0 ? _column$icon : null,
|
|
3479
|
+
sortable: (_column$key5 = column.key) !== null && _column$key5 !== void 0 ? _column$key5 : null,
|
|
3480
|
+
component: _sfc_main$5
|
|
3481
|
+
};
|
|
3482
|
+
case "select":
|
|
3483
|
+
return {
|
|
3484
|
+
type: "select",
|
|
3485
|
+
header: column.header,
|
|
3486
|
+
value: getValueFn(column.value, column.key, String, ""),
|
|
3487
|
+
update: getUpdateFn(column.update, column.key),
|
|
3488
|
+
editable: typeof column.editable === "function" ? column.editable : () => {
|
|
3489
|
+
var _column$editable3;
|
|
3490
|
+
return Boolean((_column$editable3 = column.editable) !== null && _column$editable3 !== void 0 ? _column$editable3 : false);
|
|
3491
|
+
},
|
|
3492
|
+
options: column.options,
|
|
3493
|
+
sortable: (_column$key6 = column.key) !== null && _column$key6 !== void 0 ? _column$key6 : null,
|
|
3494
|
+
component: _sfc_main$3
|
|
3495
|
+
};
|
|
3496
|
+
case void 0:
|
|
3497
|
+
return {
|
|
3498
|
+
type: "text",
|
|
3499
|
+
header: column.header,
|
|
3500
|
+
value: getValueFn(column.value, column.key, String, ""),
|
|
3501
|
+
update() {
|
|
3502
|
+
},
|
|
3503
|
+
editable: () => false,
|
|
3504
|
+
sortable: (_column$key7 = column.key) !== null && _column$key7 !== void 0 ? _column$key7 : null,
|
|
3505
|
+
validation: {},
|
|
3506
|
+
component: _sfc_main$4
|
|
3507
|
+
};
|
|
3508
|
+
}
|
|
3509
|
+
}
|
|
3510
|
+
function defineTableColumns(columns) {
|
|
3511
|
+
return columns;
|
|
3512
|
+
}
|
|
3513
|
+
function normalizeTableColumns(columns) {
|
|
3514
|
+
return columns.map((column) => {
|
|
3515
|
+
return normalizeTableColumn(column);
|
|
3516
|
+
});
|
|
3517
|
+
}
|
|
3504
3518
|
const _hoisted_1$1 = {
|
|
3505
3519
|
key: 0,
|
|
3506
3520
|
class: "pager"
|
|
@@ -3696,8 +3710,13 @@ const _hoisted_5 = {
|
|
|
3696
3710
|
tabindex: "-1",
|
|
3697
3711
|
class: "table-ng__column"
|
|
3698
3712
|
};
|
|
3699
|
-
const _hoisted_6 =
|
|
3700
|
-
|
|
3713
|
+
const _hoisted_6 = {
|
|
3714
|
+
key: 0,
|
|
3715
|
+
class: "table-ng__row--empty"
|
|
3716
|
+
};
|
|
3717
|
+
const _hoisted_7 = ["colspan"];
|
|
3718
|
+
const _hoisted_8 = ["colspan"];
|
|
3719
|
+
const _hoisted_9 = {
|
|
3701
3720
|
key: 0
|
|
3702
3721
|
};
|
|
3703
3722
|
const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
@@ -3723,14 +3742,14 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
3723
3742
|
default: false
|
|
3724
3743
|
}
|
|
3725
3744
|
}, {
|
|
3726
|
-
"
|
|
3745
|
+
"selectedRows": {
|
|
3727
3746
|
default: []
|
|
3728
3747
|
},
|
|
3729
|
-
"
|
|
3748
|
+
"selectedRowsModifiers": {}
|
|
3730
3749
|
}),
|
|
3731
|
-
emits: ["update:
|
|
3750
|
+
emits: ["update:selectedRows"],
|
|
3732
3751
|
setup(__props) {
|
|
3733
|
-
const
|
|
3752
|
+
const selectedRows = vue.useModel(__props, "selectedRows");
|
|
3734
3753
|
const tableRef = vue.useTemplateRef("table");
|
|
3735
3754
|
const selectAllRef = vue.useTemplateRef("selectAll");
|
|
3736
3755
|
const expandedKeys = vue.ref([]);
|
|
@@ -3742,14 +3761,23 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
3742
3761
|
const viewRows = vue.computed(() => {
|
|
3743
3762
|
return __props.paginerated ? rowsFromPaginator.value : metaRows.value;
|
|
3744
3763
|
});
|
|
3764
|
+
const isEmpty = vue.computed(() => {
|
|
3765
|
+
return viewRows.value.length === 0;
|
|
3766
|
+
});
|
|
3767
|
+
const columnCount = vue.computed(() => {
|
|
3768
|
+
const selectableCol = __props.selectable ? 1 : 0;
|
|
3769
|
+
return columns.value.length + selectableCol;
|
|
3770
|
+
});
|
|
3745
3771
|
const multiSelectColumn = {
|
|
3746
3772
|
type: "checkbox",
|
|
3747
3773
|
header: "selectable",
|
|
3774
|
+
sortable: null,
|
|
3775
|
+
component: _sfc_main$8,
|
|
3748
3776
|
value(row) {
|
|
3749
3777
|
if (!__props.keyAttribute) {
|
|
3750
3778
|
return false;
|
|
3751
3779
|
}
|
|
3752
|
-
return
|
|
3780
|
+
return selectedRows.value.some((it) => {
|
|
3753
3781
|
return row[__props.keyAttribute] === it[__props.keyAttribute];
|
|
3754
3782
|
});
|
|
3755
3783
|
},
|
|
@@ -3757,36 +3785,38 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
3757
3785
|
return true;
|
|
3758
3786
|
},
|
|
3759
3787
|
update(row, _newValue, _oldValue) {
|
|
3760
|
-
logic.assertRef(
|
|
3761
|
-
const index =
|
|
3788
|
+
logic.assertRef(selectedRows);
|
|
3789
|
+
const index = selectedRows.value.indexOf(row);
|
|
3762
3790
|
if (index < 0) {
|
|
3763
|
-
|
|
3791
|
+
selectedRows.value.push(row);
|
|
3764
3792
|
} else {
|
|
3765
|
-
|
|
3793
|
+
selectedRows.value.splice(index, 1);
|
|
3766
3794
|
}
|
|
3767
3795
|
}
|
|
3768
3796
|
};
|
|
3769
3797
|
const singleSelectColumn = {
|
|
3770
3798
|
type: "radio",
|
|
3771
3799
|
header: "Välj en rad",
|
|
3800
|
+
sortable: null,
|
|
3801
|
+
component: _sfc_main$7,
|
|
3772
3802
|
value(row) {
|
|
3773
3803
|
if (!__props.keyAttribute) {
|
|
3774
3804
|
return false;
|
|
3775
3805
|
}
|
|
3776
|
-
return
|
|
3806
|
+
return selectedRows.value.some((it) => {
|
|
3777
3807
|
return row[__props.keyAttribute] === it[__props.keyAttribute];
|
|
3778
3808
|
});
|
|
3779
3809
|
},
|
|
3780
3810
|
update(row, _newValue, _oldValue) {
|
|
3781
|
-
logic.assertRef(
|
|
3782
|
-
|
|
3811
|
+
logic.assertRef(selectedRows);
|
|
3812
|
+
selectedRows.value = [row];
|
|
3783
3813
|
}
|
|
3784
3814
|
};
|
|
3785
3815
|
const isIndeterminate = vue.computed(() => {
|
|
3786
|
-
return
|
|
3816
|
+
return selectedRows.value.length > 0 && selectedRows.value.length < __props.rows.length;
|
|
3787
3817
|
});
|
|
3788
3818
|
const isAllRowsSelected = vue.computed(() => {
|
|
3789
|
-
return
|
|
3819
|
+
return selectedRows.value.length > 0 && selectedRows.value.length === __props.rows.length;
|
|
3790
3820
|
});
|
|
3791
3821
|
const isSingleSelect = vue.computed(() => {
|
|
3792
3822
|
return __props.selectable === "single";
|
|
@@ -3802,9 +3832,9 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
3802
3832
|
});
|
|
3803
3833
|
function onSelectAllChange() {
|
|
3804
3834
|
if (selectAllRef.value?.checked) {
|
|
3805
|
-
|
|
3835
|
+
selectedRows.value = [...__props.rows];
|
|
3806
3836
|
} else {
|
|
3807
|
-
|
|
3837
|
+
selectedRows.value = [];
|
|
3808
3838
|
}
|
|
3809
3839
|
}
|
|
3810
3840
|
const columns = vue.computed(() => normalizeTableColumns(__props.columns));
|
|
@@ -3813,7 +3843,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
3813
3843
|
});
|
|
3814
3844
|
const slots = vue.useSlots();
|
|
3815
3845
|
const hasExpandableSlot = vue.computed(() => {
|
|
3816
|
-
return Boolean(slots
|
|
3846
|
+
return Boolean(slots.expandable);
|
|
3817
3847
|
});
|
|
3818
3848
|
async function stopEditHandler(element, reason) {
|
|
3819
3849
|
stopEdit(element, reason);
|
|
@@ -3925,7 +3955,12 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
3925
3955
|
class: "table-ng__column",
|
|
3926
3956
|
onToggleSortOrder
|
|
3927
3957
|
}, null, 8, ["column", "sort-enabled", "sort-order"]);
|
|
3928
|
-
}), 128))])]), _cache[
|
|
3958
|
+
}), 128))])]), _cache[6] || (_cache[6] = vue.createTextVNode()), vue.createElementVNode("tbody", null, [isEmpty.value ? (vue.openBlock(), vue.createElementBlock("tr", _hoisted_6, [vue.createElementVNode("td", {
|
|
3959
|
+
colspan: columnCount.value,
|
|
3960
|
+
class: "table-ng__cell"
|
|
3961
|
+
}, [vue.renderSlot(_ctx.$slots, "empty", {}, () => [_cache[3] || (_cache[3] = vue.createTextVNode(" Tabellen är tom ", -1))])], 8, _hoisted_7)])) : (vue.openBlock(true), vue.createElementBlock(vue.Fragment, {
|
|
3962
|
+
key: 1
|
|
3963
|
+
}, vue.renderList(viewRows.value, ({
|
|
3929
3964
|
key,
|
|
3930
3965
|
row,
|
|
3931
3966
|
rowIndex,
|
|
@@ -3954,50 +3989,34 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
3954
3989
|
ref_for: true
|
|
3955
3990
|
}, {
|
|
3956
3991
|
row
|
|
3957
|
-
}))], 8,
|
|
3992
|
+
}))], 8, _hoisted_8)) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, {
|
|
3958
3993
|
key: 1
|
|
3959
|
-
}, [isMultiSelect.value ? (vue.openBlock(), vue.createBlock(_sfc_main$
|
|
3994
|
+
}, [isMultiSelect.value ? (vue.openBlock(), vue.createBlock(_sfc_main$8, {
|
|
3960
3995
|
key: 0,
|
|
3961
3996
|
row,
|
|
3962
3997
|
column: multiSelectColumn
|
|
3963
|
-
}, null, 8, ["row"])) : vue.createCommentVNode("", true), _cache[
|
|
3998
|
+
}, null, 8, ["row"])) : vue.createCommentVNode("", true), _cache[4] || (_cache[4] = vue.createTextVNode()), isSingleSelect.value ? (vue.openBlock(), vue.createBlock(_sfc_main$7, {
|
|
3964
3999
|
key: 1,
|
|
3965
4000
|
row,
|
|
3966
4001
|
column: singleSelectColumn
|
|
3967
|
-
}, null, 8, ["row"])) : vue.createCommentVNode("", true), _cache[
|
|
4002
|
+
}, null, 8, ["row"])) : vue.createCommentVNode("", true), _cache[5] || (_cache[5] = vue.createTextVNode()), (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(columns.value, (column) => {
|
|
3968
4003
|
return vue.openBlock(), vue.createElementBlock(vue.Fragment, {
|
|
3969
4004
|
key: column.header
|
|
3970
|
-
}, [
|
|
4005
|
+
}, ["component" in column ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(column.component), {
|
|
3971
4006
|
key: 0,
|
|
3972
4007
|
row,
|
|
3973
4008
|
column
|
|
3974
|
-
}, null, 8, ["row", "column"])) : column.type === "text" ? (vue.openBlock(), vue.createBlock(_sfc_main$3, {
|
|
3975
|
-
key: 1,
|
|
3976
|
-
row,
|
|
3977
|
-
column
|
|
3978
|
-
}, null, 8, ["row", "column"])) : column.type === "anchor" ? (vue.openBlock(), vue.createBlock(_sfc_main$5, {
|
|
3979
|
-
key: 2,
|
|
3980
|
-
row,
|
|
3981
|
-
column
|
|
3982
|
-
}, null, 8, ["row", "column"])) : column.type === "button" ? (vue.openBlock(), vue.createBlock(_sfc_main$4, {
|
|
3983
|
-
key: 3,
|
|
3984
|
-
row,
|
|
3985
|
-
column
|
|
3986
|
-
}, null, 8, ["row", "column"])) : column.type === "select" ? (vue.openBlock(), vue.createBlock(_sfc_main$8, {
|
|
3987
|
-
key: 4,
|
|
3988
|
-
row,
|
|
3989
|
-
column
|
|
3990
4009
|
}, null, 8, ["row", "column"])) : "render" in column ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(column.render(row)), {
|
|
3991
|
-
key:
|
|
4010
|
+
key: 1,
|
|
3992
4011
|
row
|
|
3993
4012
|
}, null, 8, ["row"])) : vue.createCommentVNode("", true)], 64);
|
|
3994
4013
|
}), 128))], 64))]),
|
|
3995
4014
|
_: 2
|
|
3996
4015
|
}, 1032, ["row-key", "aria-rowindex", "aria-level", "aria-setsize", "aria-posinset", "is-treegrid", "is-expandable", "is-expanded"]);
|
|
3997
|
-
}), 128))])], 42, _hoisted_1), _cache[
|
|
4016
|
+
}), 128))])], 42, _hoisted_1), _cache[7] || (_cache[7] = vue.createTextVNode()), _ctx.paginerated ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_9, [vue.createVNode(_sfc_main$2, {
|
|
3998
4017
|
items: metaRows.value,
|
|
3999
4018
|
onItemRange: onItemRangeUpdate
|
|
4000
|
-
}, null, 8, ["items"])])) : vue.createCommentVNode("", true), _cache[
|
|
4019
|
+
}, null, 8, ["items"])])) : vue.createCommentVNode("", true), _cache[8] || (_cache[8] = vue.createTextVNode()), vue.renderSlot(_ctx.$slots, "footer")], 64);
|
|
4001
4020
|
};
|
|
4002
4021
|
}
|
|
4003
4022
|
});
|