coles-solid-library 0.3.2 → 0.3.5
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/components/Form/formGroup.d.ts +7 -0
- package/dist/components/TableV2/row.d.ts +2 -1
- package/dist/components/TableV2/table.d.ts +8 -0
- package/dist/components/TableV2/tableProvider.d.ts +25 -18
- package/dist/index.esm.js +470 -323
- package/package.json +13 -3
- package/dist/components/TableV2/droprow.d.ts +0 -9
- package/dist/components/TableV2/formArrayTable.d.ts +0 -18
- package/dist/components/popup/popup.component.d.ts +0 -24
package/dist/index.esm.js
CHANGED
|
@@ -516,8 +516,8 @@ function styleInject(css, ref) {
|
|
|
516
516
|
}
|
|
517
517
|
}
|
|
518
518
|
|
|
519
|
-
var css_248z$j = ".
|
|
520
|
-
var style$8 = {"customButtonStyle":"
|
|
519
|
+
var css_248z$j = ".Button-module_customButtonStyle__RCNcn {\n border-radius: 8px;\n font-family: \"Roboto, sans-serif\";\n padding: 8px 8px;\n border: none;\n outline: none;\n transition: transform 0.2s ease, background 0.2s ease;\n}\n.Button-module_customButtonStyle__RCNcn:active {\n transform: scale(0.9);\n box-shadow: 0px 3px 6px rgba(0, 0, 0, 0.3);\n}\n.Button-module_customButtonStyle__RCNcn:not(:disabled):hover {\n cursor: pointer;\n box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.15);\n}\n.Button-module_customButtonStyle__RCNcn:disabled:hover {\n cursor: not-allowed;\n}\n\n.Button-module_primary__st6yY {\n background-color: var(--primary-color, #4CAF50);\n color: var(--on-primary-color, #fff);\n}\n\n.Button-module_primaryVariant__ObiQc {\n background-color: var(--primary-color-varient, #43A047);\n color: var(--on-primary-color, #fff);\n}\n\n.Button-module_secondary__j-3rj {\n background-color: var(--secondary-color, #14b9c3);\n color: var(--on-secondary-color, #000000);\n}\n\n.Button-module_secondaryVariant__xFdCV {\n background-color: var(--secondary-color-varient, #0b969f);\n color: var(--on-secondary-color, #000000);\n}\n\n.Button-module_background__ebjke {\n background-color: var(--background-color, #ffffff);\n color: var(--on-background-color, #000000);\n}\n\n.Button-module_surface__wzdJD {\n background-color: var(--surface-color, #EEEEEE);\n color: var(--on-surface-color, #000000);\n}\n\n.Button-module_surfaceVariant__SkL3X {\n background-color: var(--surface-color-variant, #ccc);\n color: var(--on-surface-color, #000000);\n}\n\n.Button-module_container__0j8md {\n background-color: var(--container-color, #ffffff);\n color: var(--on-container-color, #000);\n}\n\n.Button-module_error__1zBsf {\n background-color: var(--error-color, #B00020);\n color: var(--on-error-color, #ffffff);\n}\n\n.Button-module_borderPrimary__k5fYt {\n border: 1px solid var(--primary-color, #4CAF50);\n}\n\n.Button-module_borderPrimaryVariant__-uFUm {\n border: 1px solid var(--primary-color-varient, #43A047);\n}\n\n.Button-module_borderSecondary__hzoGk {\n border: 1px solid var(--secondary-color, #14b9c3);\n}\n\n.Button-module_borderSecondaryVariant__-75Li {\n border: 1px solid var(--secondary-color-varient, #0b969f);\n}\n\n.Button-module_borderBackground__Uyf-G {\n border: 1px solid var(--background-color, #ffffff);\n}\n\n.Button-module_borderSurface__q9bRE {\n border: 1px solid var(--surface-color, #EEEEEE);\n}\n\n.Button-module_borderSurfaceVariant__ZHVd0 {\n border: 1px solid var(--surface-color-variant, #ccc);\n}\n\n.Button-module_borderContainer__mXwj- {\n border: 1px solid var(--container-color, #ffffff);\n}\n\n.Button-module_borderError__IChtd {\n border: 1px solid var(--error-color, #B00020);\n}\n\n.Button-module_none__YrUD1 {\n border: none;\n}\n\n.Button-module_transparent__6v0QA {\n background-color: transparent !important;\n border: none;\n outline: none;\n padding: 0px;\n margin: 0px;\n}";
|
|
520
|
+
var style$8 = {"customButtonStyle":"Button-module_customButtonStyle__RCNcn","primary":"Button-module_primary__st6yY","primaryVariant":"Button-module_primaryVariant__ObiQc","secondary":"Button-module_secondary__j-3rj","secondaryVariant":"Button-module_secondaryVariant__xFdCV","background":"Button-module_background__ebjke","surface":"Button-module_surface__wzdJD","surfaceVariant":"Button-module_surfaceVariant__SkL3X","container":"Button-module_container__0j8md","error":"Button-module_error__1zBsf","borderPrimary":"Button-module_borderPrimary__k5fYt","borderPrimaryVariant":"Button-module_borderPrimaryVariant__-uFUm","borderSecondary":"Button-module_borderSecondary__hzoGk","borderSecondaryVariant":"Button-module_borderSecondaryVariant__-75Li","borderBackground":"Button-module_borderBackground__Uyf-G","borderSurface":"Button-module_borderSurface__q9bRE","borderSurfaceVariant":"Button-module_borderSurfaceVariant__ZHVd0","borderContainer":"Button-module_borderContainer__mXwj-","borderError":"Button-module_borderError__IChtd","none":"Button-module_none__YrUD1","transparent":"Button-module_transparent__6v0QA"};
|
|
521
521
|
styleInject(css_248z$j);
|
|
522
522
|
|
|
523
523
|
var _tmpl$$o = /*#__PURE__*/template(`<button>`);
|
|
@@ -564,7 +564,7 @@ const Button = props => {
|
|
|
564
564
|
}, _el$);
|
|
565
565
|
spread(_el$, mergeProps(others, {
|
|
566
566
|
get ["class"]() {
|
|
567
|
-
return `${style$8[local?.theme ?? "container"]} ${style$8[getBorderThemeName(local?.borderTheme ?? 'none')]} ${style$8
|
|
567
|
+
return `${style$8?.[local?.theme ?? "container"] ?? ''} ${style$8?.[getBorderThemeName(local?.borderTheme ?? 'none')] ?? ''} ${style$8?.customButtonStyle} ${transparent()} ${props?.class ?? ""}`;
|
|
568
568
|
}
|
|
569
569
|
}), false, true);
|
|
570
570
|
insert(_el$, () => props.children);
|
|
@@ -1015,167 +1015,6 @@ function useFormProvider() {
|
|
|
1015
1015
|
return context;
|
|
1016
1016
|
}
|
|
1017
1017
|
|
|
1018
|
-
/**
|
|
1019
|
-
* Sets the theme attribute on the document body.
|
|
1020
|
-
* - 'dark' or 'light'
|
|
1021
|
-
* @param theme - The theme to set. Defaults to 'dark'.
|
|
1022
|
-
*/
|
|
1023
|
-
function addTheme(theme = 'dark') {
|
|
1024
|
-
document.body.setAttribute('data-theme', theme);
|
|
1025
|
-
}
|
|
1026
|
-
function isNullish(params) {
|
|
1027
|
-
return params === null || params === undefined;
|
|
1028
|
-
}
|
|
1029
|
-
// doesn't give mobile by resolution, but by user agent
|
|
1030
|
-
function isMobile() {
|
|
1031
|
-
let check = false;
|
|
1032
|
-
(function (a) {
|
|
1033
|
-
if (/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw-(n|u)|c55\/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do(c|p)o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(-|_)|g1 u|g560|gene|gf-5|g-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd-(m|p|t)|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c(-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac( |-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk\/|se(c(-|0|1)|47|mc|nd|ri)|sgh-|shar|sie(-|m)|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel(i|m)|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-/i.test(a.substr(0, 4))) check = true;
|
|
1034
|
-
})(navigator.userAgent || navigator.vendor);
|
|
1035
|
-
return check;
|
|
1036
|
-
}
|
|
1037
|
-
function Clone(obj, maintainFunctions, seen = new WeakMap()) {
|
|
1038
|
-
// Return non-objects or null directly.
|
|
1039
|
-
if (obj === null || typeof obj !== 'object') {
|
|
1040
|
-
return obj;
|
|
1041
|
-
}
|
|
1042
|
-
// Handle Date objects.
|
|
1043
|
-
if (obj instanceof Date) {
|
|
1044
|
-
return new Date(obj.getTime());
|
|
1045
|
-
}
|
|
1046
|
-
// Handle RegExp objects.
|
|
1047
|
-
if (obj instanceof RegExp) {
|
|
1048
|
-
return new RegExp(obj);
|
|
1049
|
-
}
|
|
1050
|
-
// Handle circular references.
|
|
1051
|
-
if (seen.has(obj)) {
|
|
1052
|
-
return seen.get(obj);
|
|
1053
|
-
}
|
|
1054
|
-
// Handle arrays.
|
|
1055
|
-
if (Array.isArray(obj)) {
|
|
1056
|
-
const arr = [];
|
|
1057
|
-
seen.set(obj, arr);
|
|
1058
|
-
obj.forEach((item, index) => {
|
|
1059
|
-
arr[index] = Clone(item, maintainFunctions, seen);
|
|
1060
|
-
});
|
|
1061
|
-
return arr;
|
|
1062
|
-
}
|
|
1063
|
-
// Handle functions.
|
|
1064
|
-
if (typeof obj === 'function') {
|
|
1065
|
-
// If maintainFunctions is true, copy the function reference.
|
|
1066
|
-
return maintainFunctions ? obj : undefined;
|
|
1067
|
-
}
|
|
1068
|
-
// Handle generic objects.
|
|
1069
|
-
const clonedObj = {};
|
|
1070
|
-
seen.set(obj, clonedObj);
|
|
1071
|
-
for (const key in obj) {
|
|
1072
|
-
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
1073
|
-
const value = obj[key];
|
|
1074
|
-
if (typeof value === 'function') {
|
|
1075
|
-
// Optionally include function properties.
|
|
1076
|
-
clonedObj[key] = undefined;
|
|
1077
|
-
} else {
|
|
1078
|
-
clonedObj[key] = Clone(value, maintainFunctions, seen);
|
|
1079
|
-
}
|
|
1080
|
-
}
|
|
1081
|
-
}
|
|
1082
|
-
return clonedObj;
|
|
1083
|
-
}
|
|
1084
|
-
|
|
1085
|
-
// export function useClickOutside(
|
|
1086
|
-
// ref: Accessor<AllHTMLElements | undefined | null>,
|
|
1087
|
-
// handler: (e: MouseEvent) => void
|
|
1088
|
-
// ) {
|
|
1089
|
-
// const mouse: Accessor<{x:number;y:number;}> = useEventSignal("mousemove", {x: 0, y: 0}, (e, set) => {
|
|
1090
|
-
// set({x: (e as MouseEvent).clientX, y: (e as MouseEvent).clientY});
|
|
1091
|
-
// });
|
|
1092
|
-
// const listener = (e: MouseEvent) => {
|
|
1093
|
-
// if (isNullish(ref())) return;
|
|
1094
|
-
// const mousePos = mouse();
|
|
1095
|
-
// const {top, bottom, left, right} = ref()!.getBoundingClientRect();
|
|
1096
|
-
// const conditions = [
|
|
1097
|
-
// mousePos.x < left,
|
|
1098
|
-
// mousePos.x > right,
|
|
1099
|
-
// mousePos.y < top,export function useClickOutside(
|
|
1100
|
-
// ref: Accessor<AllHTMLElements | undefined | null>,
|
|
1101
|
-
// handler: (e: MouseEvent) => void
|
|
1102
|
-
// ) {
|
|
1103
|
-
// const mouse: Accessor<{x:number;y:number;}> = useEventSignal("mousemove", {x: 0, y: 0}, (e, set) => {
|
|
1104
|
-
// set({x: (e as MouseEvent).clientX, y: (e as MouseEvent).clientY});
|
|
1105
|
-
// });
|
|
1106
|
-
// const listener = (e: MouseEvent) => {
|
|
1107
|
-
// if (isNullish(ref())) return;
|
|
1108
|
-
// const mousePos = mouse();
|
|
1109
|
-
// const {top, bottom, left, right} = ref()!.getBoundingClientRect();
|
|
1110
|
-
// const conditions = [
|
|
1111
|
-
// mousePos.x < left,
|
|
1112
|
-
// mousePos.x > right,
|
|
1113
|
-
// mousePos.y < top,
|
|
1114
|
-
// mousePos.y > bottom
|
|
1115
|
-
// ]
|
|
1116
|
-
// if (conditions.includes(true)) {
|
|
1117
|
-
// handler(e)
|
|
1118
|
-
// };
|
|
1119
|
-
// };
|
|
1120
|
-
// (ref() as HTMLElement)?.addEventListener("click", listener);
|
|
1121
|
-
// onCleanup(() => {
|
|
1122
|
-
// (ref() as HTMLElement)?.removeEventListener("click", listener);
|
|
1123
|
-
// });
|
|
1124
|
-
// };
|
|
1125
|
-
// mousePos.y > bottom
|
|
1126
|
-
// ]
|
|
1127
|
-
// if (conditions.includes(true)) {
|
|
1128
|
-
// handler(e)
|
|
1129
|
-
// };
|
|
1130
|
-
// };
|
|
1131
|
-
// (ref() as HTMLElement)?.addEventListener("click", listener);
|
|
1132
|
-
// onCleanup(() => {
|
|
1133
|
-
// (ref() as HTMLElement)?.removeEventListener("click", listener);
|
|
1134
|
-
// });
|
|
1135
|
-
// };
|
|
1136
|
-
/**
|
|
1137
|
-
* A hook that executes a callback when clicking outside of all specified elements.
|
|
1138
|
-
*
|
|
1139
|
-
* @param elementRefs - An array of signals (accessors) returning target HTMLElements (or undefined initially).
|
|
1140
|
-
* @param callback - The function to execute when a click occurs outside all the target elements.
|
|
1141
|
-
*/
|
|
1142
|
-
function useClickOutside(elementRefs, callback) {
|
|
1143
|
-
// Handler that checks if the click is outside all the elements.
|
|
1144
|
-
const handleClick = event => {
|
|
1145
|
-
// Loop through each element reference.
|
|
1146
|
-
for (const ref of elementRefs) {
|
|
1147
|
-
const el = ref();
|
|
1148
|
-
// If the element exists and the click occurred inside it, do nothing.
|
|
1149
|
-
if (el && el.contains(event.target)) {
|
|
1150
|
-
return;
|
|
1151
|
-
}
|
|
1152
|
-
}
|
|
1153
|
-
// If the click was not inside any of the referenced elements, execute the callback.
|
|
1154
|
-
callback();
|
|
1155
|
-
};
|
|
1156
|
-
// Set up the event listener when the component mounts.
|
|
1157
|
-
onMount(() => {
|
|
1158
|
-
const handleClick = event => {
|
|
1159
|
-
const path = event.composedPath();
|
|
1160
|
-
// If click is inside ANY ref’ed element, do nothing
|
|
1161
|
-
if (elementRefs.some(ref => {
|
|
1162
|
-
const el = ref();
|
|
1163
|
-
return el && path.includes(el);
|
|
1164
|
-
})) return;
|
|
1165
|
-
callback();
|
|
1166
|
-
};
|
|
1167
|
-
document.addEventListener('pointerdown', handleClick); // capture phase
|
|
1168
|
-
});
|
|
1169
|
-
// Clean up the event listener when the component unmounts.
|
|
1170
|
-
onCleanup(() => {
|
|
1171
|
-
document.removeEventListener('pointerdown', handleClick);
|
|
1172
|
-
});
|
|
1173
|
-
}
|
|
1174
|
-
|
|
1175
|
-
var css_248z$e = "@charset \"UTF-8\";\n.input-module_input__-LMoi {\n width: 100%;\n max-width: 400px;\n border-radius: var(--border-radius-lg, 16px);\n font-size: var(--font-size-base, 16px);\n transition: border 0.7s ease, padding 0.7s ease;\n}\n@media screen and (max-width: 768px) {\n .input-module_input__-LMoi {\n width: 100%;\n max-width: 100%;\n }\n}\n.input-module_input__-LMoi[type=checkbox] {\n width: -moz-min-content;\n width: min-content;\n -webkit-appearance: none;\n border: 1px solid #cacece;\n box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05), inset 0px -15px 10px -12px rgba(0, 0, 0, 0.05);\n padding: var(--spacing-1, 8px);\n border-radius: var(--border-radius-sm);\n display: inline-block;\n position: relative;\n}\n.input-module_input__-LMoi[type=checkbox]:checked {\n background-color: inherit;\n border: 1px solid #adb8c0;\n box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05), inset 0px -15px 10px -12px rgba(0, 0, 0, 0.05), inset 15px 10px -12px rgba(255, 255, 255, 0.1);\n color: inherit;\n}\n.input-module_input__-LMoi[type=checkbox]:checked:after {\n content: \"✔\";\n position: absolute;\n top: -15%;\n left: 15%;\n width: 10px;\n height: 10px;\n border-radius: 10%;\n}\n.input-module_input__-LMoi:not([type=checkbox])::-moz-placeholder {\n opacity: 0;\n}\n.input-module_input__-LMoi:not([type=checkbox])::placeholder {\n opacity: 0;\n}\n.input-module_input__-LMoi:focus {\n outline: none;\n}\n.input-module_input__-LMoi.input-module_error__vs2kz {\n border: 1px solid var(--warn-color);\n}\n.input-module_input__-LMoi.input-module_success__beiu5 {\n border: 1px solid green;\n}\n.input-module_input__-LMoi.input-module_warning__b6S5s {\n border: 1px solid orange;\n}\n.input-module_input__-LMoi.input-module_info__pWO0n {\n border: 1px solid blue;\n}\n.input-module_input__-LMoi.input-module_disabled__40ZHw {\n border: 1px solid gray;\n}\n\n.input-module_inFormField__kk-PD {\n border: none;\n outline: none;\n transition: padding 0.7s ease;\n}\n\n.input-module_checkbox__Yu-9M {\n cursor: pointer;\n}\n\n.input-module_transparent__aXcGX {\n background-color: inherit !important;\n opacity: 1;\n color: inherit !important;\n border: none;\n}\n.input-module_transparent__aXcGX :focus {\n outline: none;\n}";
|
|
1176
|
-
var styles$9 = {"input":"input-module_input__-LMoi","inFormField":"input-module_inFormField__kk-PD","transparent":"input-module_transparent__aXcGX"};
|
|
1177
|
-
styleInject(css_248z$e);
|
|
1178
|
-
|
|
1179
1018
|
const $RAW = Symbol("store-raw"),
|
|
1180
1019
|
$NODE = Symbol("store-node"),
|
|
1181
1020
|
$HAS = Symbol("store-has"),
|
|
@@ -1390,6 +1229,170 @@ function createStore(...[store, options]) {
|
|
|
1390
1229
|
return [wrappedStore, setStore];
|
|
1391
1230
|
}
|
|
1392
1231
|
|
|
1232
|
+
/**
|
|
1233
|
+
* Sets the theme attribute on the document body.
|
|
1234
|
+
* - 'dark' or 'light'
|
|
1235
|
+
* @param theme - The theme to set. Defaults to 'dark'.
|
|
1236
|
+
*/
|
|
1237
|
+
function addTheme(theme = 'dark') {
|
|
1238
|
+
document.body.setAttribute('data-theme', theme);
|
|
1239
|
+
}
|
|
1240
|
+
function isNullish(params) {
|
|
1241
|
+
return params === null || params === undefined;
|
|
1242
|
+
}
|
|
1243
|
+
// doesn't give mobile by resolution, but by user agent
|
|
1244
|
+
function isMobile() {
|
|
1245
|
+
let check = false;
|
|
1246
|
+
(function (a) {
|
|
1247
|
+
if (/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw-(n|u)|c55\/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do(c|p)o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(-|_)|g1 u|g560|gene|gf-5|g-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd-(m|p|t)|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c(-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac( |-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk\/|se(c(-|0|1)|47|mc|nd|ri)|sgh-|shar|sie(-|m)|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel(i|m)|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-/i.test(a.substr(0, 4))) check = true;
|
|
1248
|
+
})(navigator.userAgent || navigator.vendor);
|
|
1249
|
+
return check;
|
|
1250
|
+
}
|
|
1251
|
+
function CloneStore(value) {
|
|
1252
|
+
return structuredClone(unwrap(value));
|
|
1253
|
+
}
|
|
1254
|
+
function Clone(obj, maintainFunctions, seen = new WeakMap()) {
|
|
1255
|
+
// Return non-objects or null directly.
|
|
1256
|
+
if (obj === null || typeof obj !== 'object') {
|
|
1257
|
+
return obj;
|
|
1258
|
+
}
|
|
1259
|
+
// Handle Date objects.
|
|
1260
|
+
if (obj instanceof Date) {
|
|
1261
|
+
return new Date(obj.getTime());
|
|
1262
|
+
}
|
|
1263
|
+
// Handle RegExp objects.
|
|
1264
|
+
if (obj instanceof RegExp) {
|
|
1265
|
+
return new RegExp(obj);
|
|
1266
|
+
}
|
|
1267
|
+
// Handle circular references.
|
|
1268
|
+
if (seen.has(obj)) {
|
|
1269
|
+
return seen.get(obj);
|
|
1270
|
+
}
|
|
1271
|
+
// Handle arrays.
|
|
1272
|
+
if (Array.isArray(obj)) {
|
|
1273
|
+
const arr = [];
|
|
1274
|
+
seen.set(obj, arr);
|
|
1275
|
+
obj.forEach((item, index) => {
|
|
1276
|
+
arr[index] = Clone(item, maintainFunctions, seen);
|
|
1277
|
+
});
|
|
1278
|
+
return arr;
|
|
1279
|
+
}
|
|
1280
|
+
// Handle functions.
|
|
1281
|
+
if (typeof obj === 'function') {
|
|
1282
|
+
// If maintainFunctions is true, copy the function reference.
|
|
1283
|
+
return maintainFunctions ? obj : undefined;
|
|
1284
|
+
}
|
|
1285
|
+
// Handle generic objects.
|
|
1286
|
+
const clonedObj = {};
|
|
1287
|
+
seen.set(obj, clonedObj);
|
|
1288
|
+
for (const key in obj) {
|
|
1289
|
+
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
1290
|
+
const value = obj[key];
|
|
1291
|
+
if (typeof value === 'function') {
|
|
1292
|
+
// Optionally include function properties.
|
|
1293
|
+
clonedObj[key] = undefined;
|
|
1294
|
+
} else {
|
|
1295
|
+
clonedObj[key] = Clone(value, maintainFunctions, seen);
|
|
1296
|
+
}
|
|
1297
|
+
}
|
|
1298
|
+
}
|
|
1299
|
+
return clonedObj;
|
|
1300
|
+
}
|
|
1301
|
+
|
|
1302
|
+
// export function useClickOutside(
|
|
1303
|
+
// ref: Accessor<AllHTMLElements | undefined | null>,
|
|
1304
|
+
// handler: (e: MouseEvent) => void
|
|
1305
|
+
// ) {
|
|
1306
|
+
// const mouse: Accessor<{x:number;y:number;}> = useEventSignal("mousemove", {x: 0, y: 0}, (e, set) => {
|
|
1307
|
+
// set({x: (e as MouseEvent).clientX, y: (e as MouseEvent).clientY});
|
|
1308
|
+
// });
|
|
1309
|
+
// const listener = (e: MouseEvent) => {
|
|
1310
|
+
// if (isNullish(ref())) return;
|
|
1311
|
+
// const mousePos = mouse();
|
|
1312
|
+
// const {top, bottom, left, right} = ref()!.getBoundingClientRect();
|
|
1313
|
+
// const conditions = [
|
|
1314
|
+
// mousePos.x < left,
|
|
1315
|
+
// mousePos.x > right,
|
|
1316
|
+
// mousePos.y < top,export function useClickOutside(
|
|
1317
|
+
// ref: Accessor<AllHTMLElements | undefined | null>,
|
|
1318
|
+
// handler: (e: MouseEvent) => void
|
|
1319
|
+
// ) {
|
|
1320
|
+
// const mouse: Accessor<{x:number;y:number;}> = useEventSignal("mousemove", {x: 0, y: 0}, (e, set) => {
|
|
1321
|
+
// set({x: (e as MouseEvent).clientX, y: (e as MouseEvent).clientY});
|
|
1322
|
+
// });
|
|
1323
|
+
// const listener = (e: MouseEvent) => {
|
|
1324
|
+
// if (isNullish(ref())) return;
|
|
1325
|
+
// const mousePos = mouse();
|
|
1326
|
+
// const {top, bottom, left, right} = ref()!.getBoundingClientRect();
|
|
1327
|
+
// const conditions = [
|
|
1328
|
+
// mousePos.x < left,
|
|
1329
|
+
// mousePos.x > right,
|
|
1330
|
+
// mousePos.y < top,
|
|
1331
|
+
// mousePos.y > bottom
|
|
1332
|
+
// ]
|
|
1333
|
+
// if (conditions.includes(true)) {
|
|
1334
|
+
// handler(e)
|
|
1335
|
+
// };
|
|
1336
|
+
// };
|
|
1337
|
+
// (ref() as HTMLElement)?.addEventListener("click", listener);
|
|
1338
|
+
// onCleanup(() => {
|
|
1339
|
+
// (ref() as HTMLElement)?.removeEventListener("click", listener);
|
|
1340
|
+
// });
|
|
1341
|
+
// };
|
|
1342
|
+
// mousePos.y > bottom
|
|
1343
|
+
// ]
|
|
1344
|
+
// if (conditions.includes(true)) {
|
|
1345
|
+
// handler(e)
|
|
1346
|
+
// };
|
|
1347
|
+
// };
|
|
1348
|
+
// (ref() as HTMLElement)?.addEventListener("click", listener);
|
|
1349
|
+
// onCleanup(() => {
|
|
1350
|
+
// (ref() as HTMLElement)?.removeEventListener("click", listener);
|
|
1351
|
+
// });
|
|
1352
|
+
// };
|
|
1353
|
+
/**
|
|
1354
|
+
* A hook that executes a callback when clicking outside of all specified elements.
|
|
1355
|
+
*
|
|
1356
|
+
* @param elementRefs - An array of signals (accessors) returning target HTMLElements (or undefined initially).
|
|
1357
|
+
* @param callback - The function to execute when a click occurs outside all the target elements.
|
|
1358
|
+
*/
|
|
1359
|
+
function useClickOutside(elementRefs, callback) {
|
|
1360
|
+
// Handler that checks if the click is outside all the elements.
|
|
1361
|
+
const handleClick = event => {
|
|
1362
|
+
// Loop through each element reference.
|
|
1363
|
+
for (const ref of elementRefs) {
|
|
1364
|
+
const el = ref();
|
|
1365
|
+
// If the element exists and the click occurred inside it, do nothing.
|
|
1366
|
+
if (el && el.contains(event.target)) {
|
|
1367
|
+
return;
|
|
1368
|
+
}
|
|
1369
|
+
}
|
|
1370
|
+
// If the click was not inside any of the referenced elements, execute the callback.
|
|
1371
|
+
callback();
|
|
1372
|
+
};
|
|
1373
|
+
// Set up the event listener when the component mounts.
|
|
1374
|
+
onMount(() => {
|
|
1375
|
+
const handleClick = event => {
|
|
1376
|
+
const path = event.composedPath();
|
|
1377
|
+
// If click is inside ANY ref’ed element, do nothing
|
|
1378
|
+
if (elementRefs.some(ref => {
|
|
1379
|
+
const el = ref();
|
|
1380
|
+
return el && path.includes(el);
|
|
1381
|
+
})) return;
|
|
1382
|
+
callback();
|
|
1383
|
+
};
|
|
1384
|
+
document.addEventListener('pointerdown', handleClick); // capture phase
|
|
1385
|
+
});
|
|
1386
|
+
// Clean up the event listener when the component unmounts.
|
|
1387
|
+
onCleanup(() => {
|
|
1388
|
+
document.removeEventListener('pointerdown', handleClick);
|
|
1389
|
+
});
|
|
1390
|
+
}
|
|
1391
|
+
|
|
1392
|
+
var css_248z$e = "@charset \"UTF-8\";\n.input-module_input__-LMoi {\n width: 100%;\n max-width: 400px;\n border-radius: var(--border-radius-lg, 16px);\n font-size: var(--font-size-base, 16px);\n transition: border 0.7s ease, padding 0.7s ease;\n}\n@media screen and (max-width: 768px) {\n .input-module_input__-LMoi {\n width: 100%;\n max-width: 100%;\n }\n}\n.input-module_input__-LMoi[type=checkbox] {\n width: -moz-min-content;\n width: min-content;\n -webkit-appearance: none;\n border: 1px solid #cacece;\n box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05), inset 0px -15px 10px -12px rgba(0, 0, 0, 0.05);\n padding: var(--spacing-1, 8px);\n border-radius: var(--border-radius-sm);\n display: inline-block;\n position: relative;\n}\n.input-module_input__-LMoi[type=checkbox]:checked {\n background-color: inherit;\n border: 1px solid #adb8c0;\n box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05), inset 0px -15px 10px -12px rgba(0, 0, 0, 0.05), inset 15px 10px -12px rgba(255, 255, 255, 0.1);\n color: inherit;\n}\n.input-module_input__-LMoi[type=checkbox]:checked:after {\n content: \"✔\";\n position: absolute;\n top: -15%;\n left: 15%;\n width: 10px;\n height: 10px;\n border-radius: 10%;\n}\n.input-module_input__-LMoi:not([type=checkbox])::-moz-placeholder {\n opacity: 0;\n}\n.input-module_input__-LMoi:not([type=checkbox])::placeholder {\n opacity: 0;\n}\n.input-module_input__-LMoi:focus {\n outline: none;\n}\n.input-module_input__-LMoi.input-module_error__vs2kz {\n border: 1px solid var(--warn-color);\n}\n.input-module_input__-LMoi.input-module_success__beiu5 {\n border: 1px solid green;\n}\n.input-module_input__-LMoi.input-module_warning__b6S5s {\n border: 1px solid orange;\n}\n.input-module_input__-LMoi.input-module_info__pWO0n {\n border: 1px solid blue;\n}\n.input-module_input__-LMoi.input-module_disabled__40ZHw {\n border: 1px solid gray;\n}\n\n.input-module_inFormField__kk-PD {\n border: none;\n outline: none;\n transition: padding 0.7s ease;\n}\n\n.input-module_checkbox__Yu-9M {\n cursor: pointer;\n}\n\n.input-module_transparent__aXcGX {\n background-color: inherit !important;\n opacity: 1;\n color: inherit !important;\n border: none;\n}\n.input-module_transparent__aXcGX :focus {\n outline: none;\n}";
|
|
1393
|
+
var styles$9 = {"input":"input-module_input__-LMoi","inFormField":"input-module_inFormField__kk-PD","transparent":"input-module_transparent__aXcGX"};
|
|
1394
|
+
styleInject(css_248z$e);
|
|
1395
|
+
|
|
1393
1396
|
var _tmpl$$j = /*#__PURE__*/template(`<form>`);
|
|
1394
1397
|
const FormContext = createContext();
|
|
1395
1398
|
const useFormContext = () => {
|
|
@@ -1399,7 +1402,7 @@ const Form = props => {
|
|
|
1399
1402
|
const startData = props.data.get() ?? {};
|
|
1400
1403
|
return createComponent(Provider, {
|
|
1401
1404
|
get value() {
|
|
1402
|
-
return
|
|
1405
|
+
return CloneStore(startData);
|
|
1403
1406
|
},
|
|
1404
1407
|
get formGroup() {
|
|
1405
1408
|
return props.data;
|
|
@@ -1413,7 +1416,7 @@ const FormInner = props => {
|
|
|
1413
1416
|
const [formRef, setFormRef] = createSignal();
|
|
1414
1417
|
const formData = useFormContext();
|
|
1415
1418
|
const submitFunction = e => {
|
|
1416
|
-
const submitData =
|
|
1419
|
+
const submitData = CloneStore(formData?.data ?? {});
|
|
1417
1420
|
e.preventDefault();
|
|
1418
1421
|
if (formData.formGroup.validate()) {
|
|
1419
1422
|
props?.onSubmit?.(submitData);
|
|
@@ -1590,14 +1593,32 @@ function Checkbox(props) {
|
|
|
1590
1593
|
const newChecked = target.checked;
|
|
1591
1594
|
if (props.checked === undefined) {
|
|
1592
1595
|
setInternalChecked(newChecked);
|
|
1596
|
+
props.onChange?.(newChecked);
|
|
1597
|
+
} else {
|
|
1598
|
+
// Controlled: prevent native state flip from persisting
|
|
1599
|
+
e.preventDefault();
|
|
1600
|
+
// Re-sync DOM to prop (in case browser already toggled visually before preventDefault took effect)
|
|
1601
|
+
queueMicrotask(() => {
|
|
1602
|
+
target.checked = !!props.checked;
|
|
1603
|
+
});
|
|
1604
|
+
props.onChange?.(newChecked);
|
|
1605
|
+
}
|
|
1606
|
+
};
|
|
1607
|
+
const handleClick = e => {
|
|
1608
|
+
if (props.checked !== undefined) {
|
|
1609
|
+
e.preventDefault();
|
|
1610
|
+
const target = e.currentTarget;
|
|
1611
|
+
queueMicrotask(() => {
|
|
1612
|
+
target.checked = !!props.checked;
|
|
1613
|
+
});
|
|
1593
1614
|
}
|
|
1594
|
-
props.onChange?.(newChecked);
|
|
1595
1615
|
};
|
|
1596
1616
|
return (() => {
|
|
1597
1617
|
var _el$ = _tmpl$$h(),
|
|
1598
1618
|
_el$2 = _el$.firstChild,
|
|
1599
1619
|
_el$3 = _el$2.nextSibling;
|
|
1600
1620
|
_el$2.addEventListener("change", handleChange);
|
|
1621
|
+
_el$2.$$click = handleClick;
|
|
1601
1622
|
insert(_el$, (() => {
|
|
1602
1623
|
var _c$ = createMemo(() => !!props.label);
|
|
1603
1624
|
return () => _c$() && (() => {
|
|
@@ -1636,6 +1657,7 @@ function Checkbox(props) {
|
|
|
1636
1657
|
return _el$;
|
|
1637
1658
|
})();
|
|
1638
1659
|
}
|
|
1660
|
+
delegateEvents(["click"]);
|
|
1639
1661
|
|
|
1640
1662
|
var css_248z$c = ".selectStyles-module_solid_select__placeholder__VO5-- {\n opacity: var(--text-emphasis-medium, 87%);\n transition: all 0.7s ease;\n}\n\n.selectStyles-module_solid_select__transparent__nOpvm {\n background-color: transparent;\n}\n\n.selectStyles-module_solid_select__3plh1 {\n display: inline-block;\n position: relative;\n background-color: var(--container-color, #ffffff);\n color: var(--on-container-color, #000);\n text-align: left;\n border-radius: 8px;\n width: 100%;\n margin: 0px 6px;\n}\n\n.selectStyles-module_solid_select__control__Wmmpg {\n display: flex;\n align-items: center;\n width: 100%;\n max-height: 48px;\n border-radius: 8px;\n background-color: var(--container-color, #ffffff);\n color: var(--on-container-color, #000);\n cursor: pointer;\n transition: border 0.7s ease, padding 0.7s ease;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n.selectStyles-module_solid_select__control__Wmmpg:first-child {\n flex-grow: 1;\n}\n.selectStyles-module_solid_select__control__Wmmpg:last-child {\n padding: 0px 6px;\n margin: 0px;\n}\n\n.selectStyles-module_solid_select__control_no_form__Cq9Sc {\n display: flex;\n align-items: center;\n width: 100%;\n height: 48px;\n border-radius: 8px;\n width: 200px;\n margin-top: 2px;\n cursor: pointer;\n}\n.selectStyles-module_solid_select__control_no_form__Cq9Sc:first-child {\n flex-grow: 1;\n}\n.selectStyles-module_solid_select__control_no_form__Cq9Sc:last-child {\n padding: 0px 6px;\n margin: 0px;\n}\n\n.selectStyles-module_solid_select__arrow__OPCZo {\n font-size: 0.7em;\n}\n\n.selectStyles-module_solid_select__value__rNtqF {\n flex-grow: 1;\n transition: all 0.3s ease;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n display: block;\n}\n\n.selectStyles-module_multiselect-value__UUhhP {\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n max-width: 100%;\n}\n\n.selectStyles-module_solid_select__dropdown__UCt-N {\n position: absolute;\n background-color: var(--surface-color, #EEEEEE);\n top: 100%;\n left: 0;\n z-index: 999999999999999;\n max-height: 200px;\n border-radius: 8px;\n overflow-x: hidden;\n overflow-y: auto;\n box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);\n transform-origin: top;\n transform: scaleY(0);\n transition: transform 0.3s ease-out, opacity 0.3s ease-out;\n opacity: 0;\n}\n\n.selectStyles-module_dropTop__IVz9p {\n transform-origin: bottom;\n}\n\n.selectStyles-module_dropBottom__cYJF0 {\n transform-origin: top;\n}\n\n.selectStyles-module_open__f8zLA {\n transform: scaleY(1);\n opacity: 1;\n}\n\n.selectStyles-module_solid_select__option__47WMY {\n padding: 8px;\n cursor: pointer;\n display: flex;\n align-items: center;\n min-height: 32px;\n background-color: var(--container-color, #ffffff);\n color: var(--on-container-color, #000);\n border-radius: 8px;\n}\n.selectStyles-module_solid_select__option__47WMY:hover {\n border: 2px inset var(--primary-color-varient, #43A047);\n}\n.selectStyles-module_solid_select__option__47WMY:has(.selectStyles-module_selected__1-CKm) {\n font-weight: bold;\n}\n\n.selectStyles-module_checkmark__UWcbd {\n display: inline-block;\n width: 1.2em;\n margin-right: 4px;\n text-align: center;\n}\n\n.selectStyles-module_option-label__bBFSW {\n width: -moz-max-content;\n width: max-content;\n height: -moz-max-content;\n height: max-content;\n}";
|
|
1641
1663
|
var styles$7 = {"solid_select__placeholder":"selectStyles-module_solid_select__placeholder__VO5--","solid_select__transparent":"selectStyles-module_solid_select__transparent__nOpvm","solid_select":"selectStyles-module_solid_select__3plh1","solid_select__control":"selectStyles-module_solid_select__control__Wmmpg","solid_select__control_no_form":"selectStyles-module_solid_select__control_no_form__Cq9Sc","solid_select__arrow":"selectStyles-module_solid_select__arrow__OPCZo","solid_select__value":"selectStyles-module_solid_select__value__rNtqF","multiselect-value":"selectStyles-module_multiselect-value__UUhhP","solid_select__dropdown":"selectStyles-module_solid_select__dropdown__UCt-N","dropTop":"selectStyles-module_dropTop__IVz9p","dropBottom":"selectStyles-module_dropBottom__cYJF0","open":"selectStyles-module_open__f8zLA","solid_select__option":"selectStyles-module_solid_select__option__47WMY","selected":"selectStyles-module_selected__1-CKm","checkmark":"selectStyles-module_checkmark__UWcbd","option-label":"selectStyles-module_option-label__bBFSW"};
|
|
@@ -1878,11 +1900,29 @@ function Select(props) {
|
|
|
1878
1900
|
}
|
|
1879
1901
|
}
|
|
1880
1902
|
});
|
|
1903
|
+
const VIEWPORT_MARGIN = 4; // minimal gap from screen edges
|
|
1904
|
+
const getDropdownMetrics = () => {
|
|
1905
|
+
const dr = dropdownRef();
|
|
1906
|
+
if (!dr) return {
|
|
1907
|
+
height: 0,
|
|
1908
|
+
width: 0
|
|
1909
|
+
};
|
|
1910
|
+
const rect = dr.getBoundingClientRect();
|
|
1911
|
+
// When scaled closed, height can be 0; fallback to scrollHeight
|
|
1912
|
+
const height = rect.height === 0 ? dr.scrollHeight || rect.height : rect.height;
|
|
1913
|
+
return {
|
|
1914
|
+
height,
|
|
1915
|
+
width: rect.width
|
|
1916
|
+
};
|
|
1917
|
+
};
|
|
1881
1918
|
const dropdownBelowScreen = () => {
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
const
|
|
1885
|
-
|
|
1919
|
+
const menuLoc = menuLocRef();
|
|
1920
|
+
if (menuLoc && dropdownRef()) {
|
|
1921
|
+
const selectRect = menuLoc.getBoundingClientRect();
|
|
1922
|
+
const {
|
|
1923
|
+
height
|
|
1924
|
+
} = getDropdownMetrics();
|
|
1925
|
+
return selectRect.bottom + height + VIEWPORT_MARGIN > window.innerHeight && selectRect.top - height - VIEWPORT_MARGIN >= 0 ? true : selectRect.bottom + height + VIEWPORT_MARGIN > window.innerHeight;
|
|
1886
1926
|
}
|
|
1887
1927
|
return false;
|
|
1888
1928
|
};
|
|
@@ -1941,20 +1981,49 @@ function Select(props) {
|
|
|
1941
1981
|
}
|
|
1942
1982
|
});
|
|
1943
1983
|
const updatePosition = () => {
|
|
1944
|
-
const
|
|
1984
|
+
const dropdown = dropdownRef();
|
|
1945
1985
|
const select = selectRef();
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1986
|
+
const anchor = menuLocRef();
|
|
1987
|
+
if (!dropdown || !(select || anchor)) return;
|
|
1988
|
+
const baseRect = (anchor ?? select).getBoundingClientRect();
|
|
1989
|
+
const {
|
|
1990
|
+
height: ddHeight
|
|
1991
|
+
} = getDropdownMetrics();
|
|
1992
|
+
const spaceBelow = window.innerHeight - baseRect.bottom;
|
|
1993
|
+
const spaceAbove = baseRect.top;
|
|
1994
|
+
// Decide orientation: prefer below if it fits fully else choose the side with more space.
|
|
1995
|
+
let placeAbove = false;
|
|
1996
|
+
if (ddHeight + VIEWPORT_MARGIN <= spaceBelow) {
|
|
1997
|
+
placeAbove = false;
|
|
1998
|
+
} else if (ddHeight + VIEWPORT_MARGIN <= spaceAbove) {
|
|
1999
|
+
placeAbove = true;
|
|
2000
|
+
} else {
|
|
2001
|
+
// Neither fits: pick side with more space
|
|
2002
|
+
placeAbove = spaceAbove > spaceBelow;
|
|
2003
|
+
}
|
|
2004
|
+
// store orientation for class assignment
|
|
2005
|
+
setDropTop(placeAbove);
|
|
2006
|
+
let newY;
|
|
2007
|
+
if (!placeAbove) {
|
|
2008
|
+
newY = baseRect.bottom + window.scrollY; // default below
|
|
2009
|
+
// Clamp if overflow
|
|
2010
|
+
if (newY + ddHeight + VIEWPORT_MARGIN > window.scrollY + window.innerHeight) {
|
|
2011
|
+
newY = window.scrollY + window.innerHeight - ddHeight - VIEWPORT_MARGIN;
|
|
2012
|
+
}
|
|
2013
|
+
} else {
|
|
2014
|
+
newY = baseRect.top + window.scrollY - ddHeight; // above
|
|
2015
|
+
if (newY < window.scrollY + VIEWPORT_MARGIN) {
|
|
2016
|
+
newY = window.scrollY + VIEWPORT_MARGIN;
|
|
1953
2017
|
}
|
|
1954
|
-
menuLoc.style.left = `${newX}px`;
|
|
1955
|
-
menuLoc.style.top = `${newY}px`;
|
|
1956
|
-
menuLoc.style.width = `${selectRect.width}px`;
|
|
1957
2018
|
}
|
|
2019
|
+
// Final guard: ensure dropdown not negative even for huge heights
|
|
2020
|
+
if (newY < window.scrollY + VIEWPORT_MARGIN) {
|
|
2021
|
+
newY = window.scrollY + VIEWPORT_MARGIN;
|
|
2022
|
+
}
|
|
2023
|
+
const newX = baseRect.left + window.scrollX;
|
|
2024
|
+
dropdown.style.left = `${newX}px`;
|
|
2025
|
+
dropdown.style.top = `${newY}px`;
|
|
2026
|
+
dropdown.style.width = `${baseRect.width}px`;
|
|
1958
2027
|
};
|
|
1959
2028
|
// Update width of select to match option text width
|
|
1960
2029
|
createEffect(() => {
|
|
@@ -2038,6 +2107,12 @@ function Select(props) {
|
|
|
2038
2107
|
children(() => props.children);
|
|
2039
2108
|
const selectDropX = createMemo(() => `${selectLocation().x}px`);
|
|
2040
2109
|
const selectDropY = createMemo(() => `${selectLocation().y}px`);
|
|
2110
|
+
createEffect(() => {
|
|
2111
|
+
if (open()) {
|
|
2112
|
+
// Wait a tick so dropdown renders before measuring
|
|
2113
|
+
queueMicrotask(() => updatePosition());
|
|
2114
|
+
}
|
|
2115
|
+
});
|
|
2041
2116
|
const providerValue = createMemo(() => ({
|
|
2042
2117
|
isSelected,
|
|
2043
2118
|
selectValue,
|
|
@@ -2046,6 +2121,8 @@ function Select(props) {
|
|
|
2046
2121
|
selectRef,
|
|
2047
2122
|
selectStyle: currStyle
|
|
2048
2123
|
}));
|
|
2124
|
+
const [dropTop, setDropTop] = createSignal(false);
|
|
2125
|
+
console.log("Select rendered with options:", options);
|
|
2049
2126
|
return (() => {
|
|
2050
2127
|
var _el$7 = _tmpl$5$1(),
|
|
2051
2128
|
_el$8 = _el$7.firstChild,
|
|
@@ -2099,9 +2176,10 @@ function Select(props) {
|
|
|
2099
2176
|
get children() {
|
|
2100
2177
|
var _el$12 = _tmpl$4$1();
|
|
2101
2178
|
use(setDropdownRef, _el$12);
|
|
2179
|
+
_el$12.style.setProperty("max-height", "calc(100vh - 8px)");
|
|
2102
2180
|
insert(_el$12, () => props.children);
|
|
2103
2181
|
createRenderEffect(_p$ => {
|
|
2104
|
-
var _v$ = `${styles$7['solid_select__dropdown']} ${
|
|
2182
|
+
var _v$ = `${styles$7['solid_select__dropdown']} ${dropTop() ? styles$7.dropTop : styles$7.dropBottom} ${open() ? styles$7.open : ''} ${props.dropdownClass || ""}`,
|
|
2105
2183
|
_v$2 = selectDropY(),
|
|
2106
2184
|
_v$3 = selectDropX(),
|
|
2107
2185
|
_v$4 = `${menuLocRef()?.getBoundingClientRect().width ?? 100}px !important`;
|
|
@@ -2282,7 +2360,7 @@ const TextArea = props => {
|
|
|
2282
2360
|
// sets the field type on mount and sets the height of the textarea
|
|
2283
2361
|
onMount(() => {
|
|
2284
2362
|
OnInput();
|
|
2285
|
-
context
|
|
2363
|
+
context?.setFieldType("textarea");
|
|
2286
2364
|
});
|
|
2287
2365
|
// updates height of textarea when text is changed
|
|
2288
2366
|
createRenderEffect(() => {
|
|
@@ -2291,9 +2369,9 @@ const TextArea = props => {
|
|
|
2291
2369
|
});
|
|
2292
2370
|
createEffect(() => {
|
|
2293
2371
|
if (Object.keys(props).includes("required") || props?.required === true) {
|
|
2294
|
-
context
|
|
2372
|
+
context?.setName(old => `${old} *`);
|
|
2295
2373
|
} else {
|
|
2296
|
-
context
|
|
2374
|
+
context?.setName(old => old);
|
|
2297
2375
|
}
|
|
2298
2376
|
});
|
|
2299
2377
|
return (() => {
|
|
@@ -2304,17 +2382,17 @@ const TextArea = props => {
|
|
|
2304
2382
|
}, _el$);
|
|
2305
2383
|
spread(_el$, mergeProps(normalProps, {
|
|
2306
2384
|
"onFocus": e => {
|
|
2307
|
-
if (!isNullish(context
|
|
2308
|
-
context
|
|
2385
|
+
if (!isNullish(context?.getName)) {
|
|
2386
|
+
context?.setFocused(true);
|
|
2309
2387
|
}
|
|
2310
2388
|
},
|
|
2311
2389
|
"onBlur": e => {
|
|
2312
|
-
if (context
|
|
2313
|
-
context
|
|
2390
|
+
if (context?.setFocused) {
|
|
2391
|
+
context?.setFocused(false);
|
|
2314
2392
|
}
|
|
2315
2393
|
},
|
|
2316
2394
|
get placeholder() {
|
|
2317
|
-
return !!context
|
|
2395
|
+
return !!context?.getName && context?.getTextInside() && !context?.getFocused() ? "" : props.placeholder;
|
|
2318
2396
|
},
|
|
2319
2397
|
get ["class"]() {
|
|
2320
2398
|
return `${style$4.areaStyle} ${customProps.class ?? ""} ${customProps.transparent ? customProps.transparent : ""}`;
|
|
@@ -2325,12 +2403,12 @@ const TextArea = props => {
|
|
|
2325
2403
|
"onInput": e => {
|
|
2326
2404
|
customProps.setText(e.currentTarget.value);
|
|
2327
2405
|
OnInput();
|
|
2328
|
-
if (!!context
|
|
2329
|
-
context
|
|
2330
|
-
context
|
|
2406
|
+
if (!!context?.getName && !!e.currentTarget.value.trim()) {
|
|
2407
|
+
context?.setValue(e.currentTarget.value);
|
|
2408
|
+
context?.setTextInside(true);
|
|
2331
2409
|
} else if (!!context.getName && !e.currentTarget.value.trim()) {
|
|
2332
|
-
context
|
|
2333
|
-
context
|
|
2410
|
+
context?.setValue("");
|
|
2411
|
+
context?.setTextInside(false);
|
|
2334
2412
|
}
|
|
2335
2413
|
},
|
|
2336
2414
|
get title() {
|
|
@@ -3195,7 +3273,7 @@ class FormArray {
|
|
|
3195
3273
|
if (index < 0 || index >= this.internalValues.length) {
|
|
3196
3274
|
return undefined;
|
|
3197
3275
|
}
|
|
3198
|
-
return
|
|
3276
|
+
return CloneStore(this.internalValues[index]);
|
|
3199
3277
|
}
|
|
3200
3278
|
/**
|
|
3201
3279
|
* Gets a property value from an object at the specified index.
|
|
@@ -3727,13 +3805,27 @@ class FormGroup {
|
|
|
3727
3805
|
this.errors = createSignal(newErrors);
|
|
3728
3806
|
}
|
|
3729
3807
|
get(key) {
|
|
3730
|
-
if (!key) return
|
|
3808
|
+
if (!key) return CloneStore(this.internalDataSignal[0]);
|
|
3731
3809
|
// If the control is a FormArray, use its get method
|
|
3732
3810
|
if (this.internalDataSignal[0][key] instanceof FormArray) {
|
|
3733
3811
|
// Return the array from FormArray.get() as the expected type T[K]
|
|
3734
3812
|
return this.internalDataSignal[0][key].get();
|
|
3735
3813
|
}
|
|
3736
|
-
return
|
|
3814
|
+
return CloneStore(this.internalDataSignal[0][key]);
|
|
3815
|
+
}
|
|
3816
|
+
/**
|
|
3817
|
+
* Gets the current value of a specific control.
|
|
3818
|
+
* without cloning the value
|
|
3819
|
+
* @param key - The key of the control to retrieve.
|
|
3820
|
+
* @returns The value of the specified control.
|
|
3821
|
+
*/
|
|
3822
|
+
getR(key) {
|
|
3823
|
+
// If the control is a FormArray, use its get method
|
|
3824
|
+
if (this.internalDataSignal[0][key] instanceof FormArray) {
|
|
3825
|
+
// Return the array from FormArray.get() as the expected type T[K]
|
|
3826
|
+
return this.internalDataSignal[0][key].get();
|
|
3827
|
+
}
|
|
3828
|
+
return this.internalDataSignal[0][key];
|
|
3737
3829
|
}
|
|
3738
3830
|
/**
|
|
3739
3831
|
* Gets a specific item from a FormArray at the given index
|
|
@@ -3919,16 +4011,17 @@ const useColumnContext = () => {
|
|
|
3919
4011
|
return useContext(ColumnContext);
|
|
3920
4012
|
};
|
|
3921
4013
|
|
|
3922
|
-
var css_248z$1 = ".table-module_table__um-mK {\n border-collapse: collapse;\n text-align: center;\n}\n.table-module_table__um-mK thead tr th {\n padding: 0.5rem;\n}\n.table-module_table__um-mK tr[isdropheader=true] {\n cursor: pointer;\n}\n.table-module_table__um-mK tr[isdropheader=true]:hover {\n background-color: rgba(0, 0, 0, 0.05);\n}\n.table-module_table__um-mK tr td {\n padding: 0.5rem;\n width: -moz-max-content;\n width: max-content;\n}\n\n.table-module_dropRow__BugV9 {\n transform-origin: top;\n animation: table-module_rowDropping__zE5Uz 0.5s reverse forwards;\n display: none;\n}\n\n.table-module_openDropRow__rjfjd {\n animation: table-module_rowDropping__zE5Uz 0.5s forwards;\n display: table-row;\n}\n\n@keyframes table-module_rowDropping__zE5Uz {\n 0% {\n max-height: 0;\n opacity: 0;\n }\n 1% {\n max-height: 0;\n opacity: 0;\n }\n 100% {\n max-height: 2000px;\n opacity: 1;\n }\n}";
|
|
3923
|
-
var styles$1 = {"table":"table-module_table__um-mK","dropRow":"table-module_dropRow__BugV9","openDropRow":"table-module_openDropRow__rjfjd"};
|
|
4014
|
+
var css_248z$1 = ".table-module_table__um-mK {\n border-collapse: collapse;\n text-align: center;\n}\n.table-module_table__um-mK thead tr th {\n padding: 0.5rem;\n}\n.table-module_table__um-mK tr[isdropheader=true] {\n cursor: pointer;\n}\n.table-module_table__um-mK tr[isdropheader=true]:hover {\n background-color: rgba(0, 0, 0, 0.05);\n}\n.table-module_table__um-mK tr[isdropheader=true]:focus-visible {\n outline: 2px solid var(--focus-outline, #2684ff);\n outline-offset: -2px;\n}\n.table-module_table__um-mK tr td {\n padding: 0.5rem;\n width: -moz-max-content;\n width: max-content;\n}\n\n.table-module_dropRow__BugV9 {\n transform-origin: top;\n animation: table-module_rowDropping__zE5Uz 0.5s reverse forwards;\n display: none;\n}\n\n.table-module_openDropRow__rjfjd {\n animation: table-module_rowDropping__zE5Uz 0.5s forwards;\n display: table-row;\n}\n\n@keyframes table-module_rowDropping__zE5Uz {\n 0% {\n max-height: 0;\n opacity: 0;\n }\n 1% {\n max-height: 0;\n opacity: 0;\n }\n 100% {\n max-height: 2000px;\n opacity: 1;\n }\n}\n.table-module_errorCell__-SAJu {\n color: #b00020;\n font-style: italic;\n}";
|
|
4015
|
+
var styles$1 = {"table":"table-module_table__um-mK","dropRow":"table-module_dropRow__BugV9","openDropRow":"table-module_openDropRow__rjfjd","errorCell":"table-module_errorCell__-SAJu"};
|
|
3924
4016
|
styleInject(css_248z$1);
|
|
3925
4017
|
|
|
3926
|
-
var _tmpl$$1 = /*#__PURE__*/template(`<span>Error`),
|
|
4018
|
+
var _tmpl$$1 = /*#__PURE__*/template(`<span role=alert aria-label="Cell render error">Error`),
|
|
3927
4019
|
_tmpl$2$1 = /*#__PURE__*/template(`<table><colgroup></colgroup><thead></thead><tbody></tbody><tfoot>`),
|
|
3928
4020
|
_tmpl$3$1 = /*#__PURE__*/template(`<col>`),
|
|
3929
4021
|
_tmpl$4 = /*#__PURE__*/template(`<tr>`),
|
|
3930
4022
|
_tmpl$5 = /*#__PURE__*/template(`<th>`),
|
|
3931
|
-
_tmpl$6 = /*#__PURE__*/template(`<td>`)
|
|
4023
|
+
_tmpl$6 = /*#__PURE__*/template(`<td role=region aria-label="Dropdown row content">`),
|
|
4024
|
+
_tmpl$7 = /*#__PURE__*/template(`<td>`);
|
|
3932
4025
|
const Table = props => {
|
|
3933
4026
|
const [redrawRows, setRedrawRows] = createSignal(false);
|
|
3934
4027
|
const [mounted, setMounted] = createSignal(false);
|
|
@@ -3973,9 +4066,6 @@ const Table = props => {
|
|
|
3973
4066
|
mounted();
|
|
3974
4067
|
return rowData;
|
|
3975
4068
|
};
|
|
3976
|
-
const rowKeys = createMemo(() => {
|
|
3977
|
-
return Object.keys(rows()).map(key => parseInt(key)).sort((a, b) => a - b);
|
|
3978
|
-
});
|
|
3979
4069
|
tableContext.addRowCell = (index, name, cell, isDropDown) => {
|
|
3980
4070
|
setRows(old => {
|
|
3981
4071
|
const newRows = {
|
|
@@ -3988,7 +4078,8 @@ const Table = props => {
|
|
|
3988
4078
|
const existingData = old[index]?.[name];
|
|
3989
4079
|
newRows[index][name] = {
|
|
3990
4080
|
element: cell,
|
|
3991
|
-
|
|
4081
|
+
// Preserve previously established dropdown semantics (set via addRowStyle)
|
|
4082
|
+
dropRow: existingData?.dropRow || !!isDropDown,
|
|
3992
4083
|
dropHeader: existingData?.dropHeader || false
|
|
3993
4084
|
};
|
|
3994
4085
|
return newRows;
|
|
@@ -4152,35 +4243,28 @@ const Table = props => {
|
|
|
4152
4243
|
return newStyles;
|
|
4153
4244
|
});
|
|
4154
4245
|
};
|
|
4155
|
-
const [refresh, setRefresh] = createSignal(false);
|
|
4156
|
-
let firstRun = false;
|
|
4157
|
-
tableContext.refresh = refresh;
|
|
4158
|
-
createEffect(() => {
|
|
4159
|
-
if (firstRun) {
|
|
4160
|
-
setRefresh(old => !old);
|
|
4161
|
-
} else {
|
|
4162
|
-
firstRun = true;
|
|
4163
|
-
}
|
|
4164
|
-
tableData();
|
|
4165
|
-
});
|
|
4166
4246
|
const headerFactory = (index, column) => {
|
|
4167
4247
|
return headers()?.[index]?.[column];
|
|
4168
4248
|
};
|
|
4169
4249
|
const rowStyleFactory = rowNum => {
|
|
4170
4250
|
return rowStyle()?.[rowNum] ?? {};
|
|
4171
4251
|
};
|
|
4172
|
-
|
|
4252
|
+
// Store open state keyed first by resolved row key (or dataIndex fallback) then by data index
|
|
4253
|
+
const [dropOpenStore, setDropOpenStore] = createStore({});
|
|
4173
4254
|
// Enhanced renderCell with better type safety and error handling
|
|
4174
|
-
const renderCell = (cell, item, index) => {
|
|
4255
|
+
const renderCell = (cell, item, index, column, row) => {
|
|
4175
4256
|
if (typeof cell === 'function') {
|
|
4176
4257
|
try {
|
|
4177
4258
|
return cell(item, index);
|
|
4178
4259
|
} catch (error) {
|
|
4179
|
-
|
|
4180
|
-
|
|
4181
|
-
|
|
4182
|
-
index
|
|
4183
|
-
}
|
|
4260
|
+
const ctx = {
|
|
4261
|
+
column,
|
|
4262
|
+
row: row ?? -1,
|
|
4263
|
+
dataIndex: index
|
|
4264
|
+
};
|
|
4265
|
+
console.error('[TableV2] Error rendering cell', error, ctx);
|
|
4266
|
+
const custom = props.onCellError?.(error, ctx);
|
|
4267
|
+
if (custom) return custom;
|
|
4184
4268
|
return (() => {
|
|
4185
4269
|
var _el$ = _tmpl$$1();
|
|
4186
4270
|
createRenderEffect(() => className(_el$, styles$1.errorCell));
|
|
@@ -4197,19 +4281,28 @@ const Table = props => {
|
|
|
4197
4281
|
onMount(() => {
|
|
4198
4282
|
setMounted(true);
|
|
4199
4283
|
});
|
|
4200
|
-
const
|
|
4284
|
+
const resolveRowKey = (dataItem, dataIndex) => {
|
|
4285
|
+
return props.getRowKey?.(dataItem, dataIndex) ?? dataIndex;
|
|
4286
|
+
};
|
|
4287
|
+
const getIsDropOpen = (rowNum, dataIndex, dataItem) => {
|
|
4201
4288
|
// Check if this row should be displayed based on its position
|
|
4202
4289
|
const firstColumn = reactiveColumns()?.[0];
|
|
4203
4290
|
const rowData = rows()?.[rowNum]?.[firstColumn];
|
|
4204
|
-
//
|
|
4205
|
-
if (
|
|
4206
|
-
|
|
4291
|
+
// Only treat rows explicitly marked as dropdown content
|
|
4292
|
+
if (rowData?.dropRow) {
|
|
4293
|
+
const key = resolveRowKey(dataItem, dataIndex);
|
|
4294
|
+
return dropOpenStore[key] ?? false;
|
|
4207
4295
|
}
|
|
4208
|
-
//
|
|
4209
|
-
return dropOpenStore[index] ?? false;
|
|
4296
|
+
return true; // Non-dropdown rows always visible
|
|
4210
4297
|
};
|
|
4211
|
-
const dropRowStyle = (rowNum,
|
|
4212
|
-
|
|
4298
|
+
const dropRowStyle = (rowNum, dataIndex, dataItem) => {
|
|
4299
|
+
// Only apply dropRow/openDropRow classes to rows that are dropdown content
|
|
4300
|
+
const firstColumn = reactiveColumns()?.[0];
|
|
4301
|
+
const rowMeta = rows()?.[rowNum]?.[firstColumn ?? ''];
|
|
4302
|
+
if (rowMeta?.dropRow) {
|
|
4303
|
+
return getIsDropOpen(rowNum, dataIndex, dataItem) ? styles$1.openDropRow : styles$1.dropRow;
|
|
4304
|
+
}
|
|
4305
|
+
return '';
|
|
4213
4306
|
};
|
|
4214
4307
|
return createComponent(TableProvider, mergeProps(tableContext, {
|
|
4215
4308
|
get children() {
|
|
@@ -4259,6 +4352,14 @@ const Table = props => {
|
|
|
4259
4352
|
children: rowNum => {
|
|
4260
4353
|
return (() => {
|
|
4261
4354
|
var _el$8 = _tmpl$4();
|
|
4355
|
+
spread(_el$8, mergeProps(() => headerRowStyle()[rowNum]?.all, {
|
|
4356
|
+
get style() {
|
|
4357
|
+
return headerRowStyle()[rowNum]?.style;
|
|
4358
|
+
},
|
|
4359
|
+
get ["class"]() {
|
|
4360
|
+
return headerRowStyle()[rowNum]?.class;
|
|
4361
|
+
}
|
|
4362
|
+
}), false, true);
|
|
4262
4363
|
insert(_el$8, createComponent(For, {
|
|
4263
4364
|
get each() {
|
|
4264
4365
|
return reactiveColumns();
|
|
@@ -4280,16 +4381,6 @@ const Table = props => {
|
|
|
4280
4381
|
})() : [];
|
|
4281
4382
|
}
|
|
4282
4383
|
}));
|
|
4283
|
-
createRenderEffect(_p$ => {
|
|
4284
|
-
var _v$4 = headerRowStyle()[rowNum]?.style,
|
|
4285
|
-
_v$5 = headerRowStyle()[rowNum]?.class;
|
|
4286
|
-
_p$.e = style$9(_el$8, _v$4, _p$.e);
|
|
4287
|
-
_v$5 !== _p$.t && className(_el$8, _p$.t = _v$5);
|
|
4288
|
-
return _p$;
|
|
4289
|
-
}, {
|
|
4290
|
-
e: undefined,
|
|
4291
|
-
t: undefined
|
|
4292
|
-
});
|
|
4293
4384
|
return _el$8;
|
|
4294
4385
|
})();
|
|
4295
4386
|
}
|
|
@@ -4308,48 +4399,128 @@ const Table = props => {
|
|
|
4308
4399
|
},
|
|
4309
4400
|
children: (item, index) => createComponent(For, {
|
|
4310
4401
|
get each() {
|
|
4311
|
-
return
|
|
4402
|
+
return Object.keys(rows()).map(key => parseInt(key)).sort((a, b) => a - b);
|
|
4312
4403
|
},
|
|
4313
4404
|
children: rowNum => {
|
|
4405
|
+
const dataIndex = index();
|
|
4406
|
+
const resolvedRowKey = resolveRowKey(item, dataIndex);
|
|
4407
|
+
const firstColumn = reactiveColumns()?.[0];
|
|
4408
|
+
const headerCellMeta = rows()?.[rowNum]?.[firstColumn ?? ''];
|
|
4409
|
+
const resolvedKey = resolveRowKey(item, dataIndex);
|
|
4410
|
+
// Initialize dropdown state for header if not yet
|
|
4411
|
+
if (headerCellMeta?.dropHeader && dropOpenStore[resolvedKey] === undefined) {
|
|
4412
|
+
setDropOpenStore(resolvedKey, false);
|
|
4413
|
+
}
|
|
4414
|
+
const firstColumnMeta = rows()?.[rowNum]?.[firstColumn ?? ''];
|
|
4415
|
+
const isContentRow = firstColumnMeta?.dropRow === true;
|
|
4416
|
+
const isOpen = getIsDropOpen(rowNum, dataIndex, item);
|
|
4417
|
+
const computedClass = (() => {
|
|
4418
|
+
const base = dropRowStyle(rowNum, dataIndex, item);
|
|
4419
|
+
return base;
|
|
4420
|
+
})();
|
|
4314
4421
|
return (() => {
|
|
4315
4422
|
var _el$10 = _tmpl$4();
|
|
4316
4423
|
spread(_el$10, mergeProps(() => rowStyleFactory?.(rowNum)?.all, {
|
|
4424
|
+
"data-drop-row": isContentRow ? 'true' : undefined,
|
|
4425
|
+
"data-drop-open": isContentRow ? isOpen ? 'true' : 'false' : undefined,
|
|
4317
4426
|
get style() {
|
|
4318
4427
|
return rowStyleFactory?.(rowNum)?.style;
|
|
4319
4428
|
},
|
|
4429
|
+
"data-row-key": resolvedRowKey,
|
|
4320
4430
|
"onClick": e => {
|
|
4321
|
-
|
|
4322
|
-
const rowData = rows()?.[rowNum]?.[firstColumn];
|
|
4323
|
-
// Only toggle dropdown state if this is a header row
|
|
4324
|
-
if (rowData?.dropHeader === true) {
|
|
4431
|
+
if (headerCellMeta?.dropHeader === true) {
|
|
4325
4432
|
e.preventDefault();
|
|
4326
|
-
setDropOpenStore(
|
|
4433
|
+
setDropOpenStore(resolvedRowKey, !dropOpenStore[resolvedRowKey]);
|
|
4434
|
+
setRedrawRows(r => !r);
|
|
4327
4435
|
}
|
|
4328
|
-
//
|
|
4436
|
+
// Invoke row-level handler stored by Row component. If original handler declared 2+ params pass data item.
|
|
4329
4437
|
if (rowStyleFactory !== undefined) {
|
|
4330
|
-
const
|
|
4331
|
-
|
|
4332
|
-
|
|
4438
|
+
const styleAll = rowStyleFactory(rowNum).all;
|
|
4439
|
+
const original = styleAll?.__origOnClick ?? styleAll?.onClick;
|
|
4440
|
+
if (typeof original === 'function') {
|
|
4441
|
+
try {
|
|
4442
|
+
if (original.length >= 2) {
|
|
4443
|
+
original(e, item);
|
|
4444
|
+
} else {
|
|
4445
|
+
original(e);
|
|
4446
|
+
}
|
|
4447
|
+
} catch (err) {
|
|
4448
|
+
console.error('[TableV2] Row onClick handler error', err);
|
|
4449
|
+
}
|
|
4333
4450
|
}
|
|
4334
4451
|
}
|
|
4335
4452
|
},
|
|
4336
4453
|
get ["class"]() {
|
|
4337
|
-
return `${
|
|
4454
|
+
return `${computedClass} ${rowStyleFactory?.(rowNum)?.all?.class ?? ''}`;
|
|
4455
|
+
},
|
|
4456
|
+
get role() {
|
|
4457
|
+
return headerCellMeta?.dropHeader ? 'button' : undefined;
|
|
4458
|
+
},
|
|
4459
|
+
get ["aria-expanded"]() {
|
|
4460
|
+
return headerCellMeta?.dropHeader ? dropOpenStore[resolvedRowKey] ? 'true' : 'false' : undefined;
|
|
4461
|
+
},
|
|
4462
|
+
get tabIndex() {
|
|
4463
|
+
return headerCellMeta?.dropHeader ? 0 : undefined;
|
|
4464
|
+
},
|
|
4465
|
+
"onKeyDown": e => {
|
|
4466
|
+
const isActivator = e.key === 'Enter' || e.key === ' ';
|
|
4467
|
+
if (isActivator && headerCellMeta?.dropHeader) {
|
|
4468
|
+
e.preventDefault();
|
|
4469
|
+
setDropOpenStore(resolvedRowKey, !dropOpenStore[resolvedRowKey]);
|
|
4470
|
+
setRedrawRows(r => !r);
|
|
4471
|
+
}
|
|
4338
4472
|
}
|
|
4339
4473
|
}), false, true);
|
|
4340
|
-
insert(_el$10,
|
|
4341
|
-
|
|
4342
|
-
|
|
4343
|
-
|
|
4344
|
-
|
|
4345
|
-
|
|
4346
|
-
|
|
4347
|
-
|
|
4348
|
-
|
|
4349
|
-
|
|
4350
|
-
|
|
4351
|
-
|
|
4352
|
-
|
|
4474
|
+
insert(_el$10, () => {
|
|
4475
|
+
let renderedDropContent = false;
|
|
4476
|
+
return createComponent(For, {
|
|
4477
|
+
get each() {
|
|
4478
|
+
return reactiveColumns();
|
|
4479
|
+
},
|
|
4480
|
+
children: column => {
|
|
4481
|
+
const tableSpot = rows()[rowNum]?.[column];
|
|
4482
|
+
const cell = tableSpot?.element;
|
|
4483
|
+
// Dropdown content row: render only once (first occurrence) spanning all columns
|
|
4484
|
+
if (tableSpot?.dropRow && !renderedDropContent) {
|
|
4485
|
+
renderedDropContent = true;
|
|
4486
|
+
return (() => {
|
|
4487
|
+
var _el$11 = _tmpl$6();
|
|
4488
|
+
insert(_el$11, () => renderCell(cell, item, index(), column, rowNum));
|
|
4489
|
+
createRenderEffect(_p$ => {
|
|
4490
|
+
var _v$4 = reactiveColumns().length,
|
|
4491
|
+
_v$5 = getIsDropOpen(rowNum, dataIndex, item) ? 'false' : 'true',
|
|
4492
|
+
_v$6 = getIsDropOpen(rowNum, dataIndex, item) ? 'open' : 'closed';
|
|
4493
|
+
_v$4 !== _p$.e && setAttribute(_el$11, "colspan", _p$.e = _v$4);
|
|
4494
|
+
_v$5 !== _p$.t && setAttribute(_el$11, "aria-hidden", _p$.t = _v$5);
|
|
4495
|
+
_v$6 !== _p$.a && setAttribute(_el$11, "data-drop-state", _p$.a = _v$6);
|
|
4496
|
+
return _p$;
|
|
4497
|
+
}, {
|
|
4498
|
+
e: undefined,
|
|
4499
|
+
t: undefined,
|
|
4500
|
+
a: undefined
|
|
4501
|
+
});
|
|
4502
|
+
return _el$11;
|
|
4503
|
+
})();
|
|
4504
|
+
}
|
|
4505
|
+
if (tableSpot?.dropRow) {
|
|
4506
|
+
return []; // Skip duplicate columns within same dropdown row
|
|
4507
|
+
}
|
|
4508
|
+
return !isNullish(cell) ? (() => {
|
|
4509
|
+
var _el$12 = _tmpl$7();
|
|
4510
|
+
spread(_el$12, mergeProps(() => cellStyle?.()?.[rowNum]?.[column]?.all, {
|
|
4511
|
+
get style() {
|
|
4512
|
+
return cellStyle()[rowNum]?.[column]?.style;
|
|
4513
|
+
},
|
|
4514
|
+
get ["class"]() {
|
|
4515
|
+
return cellStyle()[rowNum]?.[column]?.class;
|
|
4516
|
+
}
|
|
4517
|
+
}), false, true);
|
|
4518
|
+
insert(_el$12, () => renderCell(cell, item, index(), column, rowNum));
|
|
4519
|
+
return _el$12;
|
|
4520
|
+
})() : [];
|
|
4521
|
+
}
|
|
4522
|
+
});
|
|
4523
|
+
});
|
|
4353
4524
|
return _el$10;
|
|
4354
4525
|
})();
|
|
4355
4526
|
}
|
|
@@ -4369,8 +4540,8 @@ const Table = props => {
|
|
|
4369
4540
|
},
|
|
4370
4541
|
children: rowNum => {
|
|
4371
4542
|
return (() => {
|
|
4372
|
-
var _el$
|
|
4373
|
-
spread(_el$
|
|
4543
|
+
var _el$13 = _tmpl$4();
|
|
4544
|
+
spread(_el$13, mergeProps(() => footerStyle()[rowNum]?.all, {
|
|
4374
4545
|
get style() {
|
|
4375
4546
|
return footerStyle()[rowNum]?.style;
|
|
4376
4547
|
},
|
|
@@ -4378,15 +4549,15 @@ const Table = props => {
|
|
|
4378
4549
|
return footerStyle()[rowNum]?.class;
|
|
4379
4550
|
}
|
|
4380
4551
|
}), false, true);
|
|
4381
|
-
insert(_el$
|
|
4552
|
+
insert(_el$13, createComponent(For, {
|
|
4382
4553
|
get each() {
|
|
4383
4554
|
return reactiveColumns();
|
|
4384
4555
|
},
|
|
4385
4556
|
children: column => {
|
|
4386
4557
|
const footCell = footerCell()[rowNum]?.[column];
|
|
4387
4558
|
return !!footCell ? (() => {
|
|
4388
|
-
var _el$
|
|
4389
|
-
spread(_el$
|
|
4559
|
+
var _el$14 = _tmpl$7();
|
|
4560
|
+
spread(_el$14, mergeProps(() => footCellStyle()?.[rowNum]?.[column]?.all, {
|
|
4390
4561
|
get style() {
|
|
4391
4562
|
return footCellStyle()[rowNum]?.[column]?.style;
|
|
4392
4563
|
},
|
|
@@ -4394,12 +4565,12 @@ const Table = props => {
|
|
|
4394
4565
|
return footCellStyle()[rowNum]?.[column]?.class;
|
|
4395
4566
|
}
|
|
4396
4567
|
}), false, true);
|
|
4397
|
-
insert(_el$
|
|
4398
|
-
return _el$
|
|
4568
|
+
insert(_el$14, footCell);
|
|
4569
|
+
return _el$14;
|
|
4399
4570
|
})() : [];
|
|
4400
4571
|
}
|
|
4401
4572
|
}));
|
|
4402
|
-
return _el$
|
|
4573
|
+
return _el$13;
|
|
4403
4574
|
})();
|
|
4404
4575
|
}
|
|
4405
4576
|
}));
|
|
@@ -4421,43 +4592,6 @@ const Table = props => {
|
|
|
4421
4592
|
}
|
|
4422
4593
|
}));
|
|
4423
4594
|
};
|
|
4424
|
-
const TableRowColumns = props => {
|
|
4425
|
-
return createComponent(For, {
|
|
4426
|
-
get each() {
|
|
4427
|
-
return props.reactiveColumns();
|
|
4428
|
-
},
|
|
4429
|
-
children: column => {
|
|
4430
|
-
// Initialize dropdown state for this row if dropdown capabilities exist
|
|
4431
|
-
if (props.rows()[props.rowNum]?.[column]?.dropRow === true || props.rows()[props.rowNum]?.[column]?.dropHeader === true) {
|
|
4432
|
-
// Initialize with closed state if not already set
|
|
4433
|
-
if (props.dropOpenStore[props.index] === undefined) {
|
|
4434
|
-
props.setDropOpenStore(props.index, false);
|
|
4435
|
-
}
|
|
4436
|
-
}
|
|
4437
|
-
if (Object.keys(props.rows()[props.rowNum]?.[column] ?? {}).includes('dropRow') && props.rows()[props.rowNum]?.[column]?.dropRow !== false) {
|
|
4438
|
-
return (() => {
|
|
4439
|
-
var _el$13 = _tmpl$6();
|
|
4440
|
-
insert(_el$13, () => props.renderCell(props.rows()[props.rowNum]?.[column]?.element, props.item, props.index));
|
|
4441
|
-
createRenderEffect(() => setAttribute(_el$13, "colspan", props.reactiveColumns().length));
|
|
4442
|
-
return _el$13;
|
|
4443
|
-
})();
|
|
4444
|
-
}
|
|
4445
|
-
return !isNullish(props.rows()[props.rowNum]?.[column]?.element) ? (() => {
|
|
4446
|
-
var _el$14 = _tmpl$6();
|
|
4447
|
-
spread(_el$14, mergeProps(() => props.cellStyle?.()?.[props.rowNum]?.[column]?.all, {
|
|
4448
|
-
get style() {
|
|
4449
|
-
return props.cellStyle()[props.rowNum]?.[column]?.style;
|
|
4450
|
-
},
|
|
4451
|
-
get ["class"]() {
|
|
4452
|
-
return props.cellStyle()[props.rowNum]?.[column]?.class;
|
|
4453
|
-
}
|
|
4454
|
-
}), false, true);
|
|
4455
|
-
insert(_el$14, () => props.renderCell(props.rows()[props.rowNum]?.[column]?.element, props.item, props.index));
|
|
4456
|
-
return _el$14;
|
|
4457
|
-
})() : [];
|
|
4458
|
-
}
|
|
4459
|
-
});
|
|
4460
|
-
};
|
|
4461
4595
|
|
|
4462
4596
|
const Row = props => {
|
|
4463
4597
|
const [local, others] = splitProps(props, ["rowNumber", "children", "class", "style", "header", "footer"]);
|
|
@@ -4472,14 +4606,20 @@ const Row = props => {
|
|
|
4472
4606
|
tableContext?.addHeaderRowStyle?.(rowNumber, {
|
|
4473
4607
|
class: local.class,
|
|
4474
4608
|
style: local.style,
|
|
4475
|
-
all:
|
|
4609
|
+
all: {
|
|
4610
|
+
...others,
|
|
4611
|
+
onClick: others.onClick
|
|
4612
|
+
}
|
|
4476
4613
|
});
|
|
4477
4614
|
break;
|
|
4478
4615
|
case props.footer === true || Object.keys(props).includes('footer') && props.footer !== false:
|
|
4479
4616
|
tableContext?.addFooterRowStyle?.(rowNumber, {
|
|
4480
4617
|
class: local.class,
|
|
4481
4618
|
style: local.style,
|
|
4482
|
-
all:
|
|
4619
|
+
all: {
|
|
4620
|
+
...others,
|
|
4621
|
+
onClick: others.onClick
|
|
4622
|
+
}
|
|
4483
4623
|
});
|
|
4484
4624
|
break;
|
|
4485
4625
|
default:
|
|
@@ -4487,10 +4627,19 @@ const Row = props => {
|
|
|
4487
4627
|
const isDropHeader = Object.keys(props).includes('isDropHeader') && props.isDropHeader !== false;
|
|
4488
4628
|
// @ts-ignore
|
|
4489
4629
|
const isDropRow = Object.keys(props).includes('isDropRow') && props.isDropRow !== false;
|
|
4630
|
+
// Wrap multi-arity handler into single-param form for storage
|
|
4631
|
+
const storedAll = {
|
|
4632
|
+
...others
|
|
4633
|
+
};
|
|
4634
|
+
if (typeof others.onClick === 'function') {
|
|
4635
|
+
// Store original; table will decide whether to pass data item based on length
|
|
4636
|
+
storedAll.__origOnClick = others.onClick;
|
|
4637
|
+
storedAll.onClick = e => others.onClick(e); // legacy single param fallback
|
|
4638
|
+
}
|
|
4490
4639
|
tableContext?.addRowStyle?.(rowNumber, {
|
|
4491
4640
|
class: local.class,
|
|
4492
4641
|
style: local.style,
|
|
4493
|
-
all:
|
|
4642
|
+
all: storedAll
|
|
4494
4643
|
}, isDropRow, isDropHeader);
|
|
4495
4644
|
break;
|
|
4496
4645
|
}
|
|
@@ -4501,8 +4650,7 @@ const Row = props => {
|
|
|
4501
4650
|
const Column = props => {
|
|
4502
4651
|
const {
|
|
4503
4652
|
addColumnStyle,
|
|
4504
|
-
removeColumnStyle
|
|
4505
|
-
refresh
|
|
4653
|
+
removeColumnStyle
|
|
4506
4654
|
} = useTableContext();
|
|
4507
4655
|
const [local, others] = splitProps(props, ["name", "rowNumber", "children", "class", "style"]);
|
|
4508
4656
|
// Track the name to handle changes
|
|
@@ -4510,7 +4658,6 @@ const Column = props => {
|
|
|
4510
4658
|
// Create a reactive effect to update styles
|
|
4511
4659
|
createEffect(() => {
|
|
4512
4660
|
const newName = local.name;
|
|
4513
|
-
refresh();
|
|
4514
4661
|
// If the name has changed, remove the old style
|
|
4515
4662
|
if (currentName !== newName && currentName && removeColumnStyle) {
|
|
4516
4663
|
removeColumnStyle(currentName);
|
|
@@ -4548,8 +4695,7 @@ const Cell = props => {
|
|
|
4548
4695
|
removeFooterCell,
|
|
4549
4696
|
addRowCell,
|
|
4550
4697
|
addCellStyle,
|
|
4551
|
-
removeRowCell
|
|
4552
|
-
refresh
|
|
4698
|
+
removeRowCell
|
|
4553
4699
|
} = useTableContext();
|
|
4554
4700
|
const [local, others] = splitProps(props, ["children", "class", "style", "footer", "rowNumber", "header"]);
|
|
4555
4701
|
// Get the column name from context or props
|
|
@@ -4560,7 +4706,6 @@ const Cell = props => {
|
|
|
4560
4706
|
let registeredAsFooter = false;
|
|
4561
4707
|
let registeredAsRow = false;
|
|
4562
4708
|
createEffect(() => {
|
|
4563
|
-
refresh();
|
|
4564
4709
|
const name = cellName();
|
|
4565
4710
|
const row = rowNumber();
|
|
4566
4711
|
props.children;
|
|
@@ -4643,12 +4788,14 @@ const Header = props => {
|
|
|
4643
4788
|
}
|
|
4644
4789
|
const [local, others] = splitProps(props, ["children", "class", "style", "rowNumber"]);
|
|
4645
4790
|
createEffect(() => {
|
|
4646
|
-
tableContext.refresh();
|
|
4647
4791
|
tableContext?.addHeaderCell?.(columnInfo.name, (props?.rowNumber ?? 1) - 1, local.children);
|
|
4648
4792
|
tableContext?.addHeaderStyle?.(columnInfo.name, (props?.rowNumber ?? 1) - 1, {
|
|
4649
4793
|
class: local.class,
|
|
4650
4794
|
style: local.style,
|
|
4651
|
-
all:
|
|
4795
|
+
all: {
|
|
4796
|
+
scope: 'col',
|
|
4797
|
+
...others
|
|
4798
|
+
}
|
|
4652
4799
|
});
|
|
4653
4800
|
});
|
|
4654
4801
|
return [];
|