coles-solid-library 0.3.0 → 0.3.2
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { JSX } from "solid-js";
|
|
1
|
+
import { Accessor, JSX } from "solid-js";
|
|
2
2
|
export interface StyleContainer<T> {
|
|
3
3
|
class?: string;
|
|
4
4
|
style?: JSX.CSSProperties | string;
|
|
@@ -53,6 +53,7 @@ export interface ColumnGroupStyle {
|
|
|
53
53
|
[colName: string]: StyleContainer<JSX.ColgroupHTMLAttributes<HTMLTableColElement>>;
|
|
54
54
|
}
|
|
55
55
|
export interface TableContext<T = any> {
|
|
56
|
+
refresh: Accessor<boolean>;
|
|
56
57
|
getDataSource: () => T[];
|
|
57
58
|
setDataSource: (data: T[]) => any;
|
|
58
59
|
addHeaderCell: (name: string, index: number, header: JSX.Element) => void;
|
package/dist/index.esm.js
CHANGED
|
@@ -1637,8 +1637,8 @@ function Checkbox(props) {
|
|
|
1637
1637
|
})();
|
|
1638
1638
|
}
|
|
1639
1639
|
|
|
1640
|
-
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}\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
|
-
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","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"};
|
|
1640
|
+
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
|
+
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"};
|
|
1642
1642
|
styleInject(css_248z$c);
|
|
1643
1643
|
|
|
1644
1644
|
const manager = new class WinManager {
|
|
@@ -1762,13 +1762,31 @@ function Select(props) {
|
|
|
1762
1762
|
}
|
|
1763
1763
|
return selectRef();
|
|
1764
1764
|
});
|
|
1765
|
-
|
|
1766
|
-
|
|
1765
|
+
const [options, setOptions] = createStore({});
|
|
1766
|
+
// Register and unregister functions using the store
|
|
1767
1767
|
const registerOption = (val, label) => {
|
|
1768
|
-
|
|
1768
|
+
const stringVal = JSON.stringify(val);
|
|
1769
|
+
setOptions(store => ({
|
|
1770
|
+
...store,
|
|
1771
|
+
[stringVal]: {
|
|
1772
|
+
value: stringVal,
|
|
1773
|
+
label
|
|
1774
|
+
}
|
|
1775
|
+
}));
|
|
1769
1776
|
};
|
|
1770
1777
|
const unregisterOption = val => {
|
|
1771
|
-
|
|
1778
|
+
const stringVal = JSON.stringify(val);
|
|
1779
|
+
setOptions(store => {
|
|
1780
|
+
const newStore = {
|
|
1781
|
+
...store
|
|
1782
|
+
};
|
|
1783
|
+
delete newStore[stringVal];
|
|
1784
|
+
return newStore;
|
|
1785
|
+
});
|
|
1786
|
+
};
|
|
1787
|
+
const getLabel = val => {
|
|
1788
|
+
const stringVal = JSON.stringify(val);
|
|
1789
|
+
return options[stringVal]?.label || String(val);
|
|
1772
1790
|
};
|
|
1773
1791
|
// Helper to check if a value is selected (for Option highlighting)
|
|
1774
1792
|
const isSelected = val => {
|
|
@@ -1778,7 +1796,6 @@ function Select(props) {
|
|
|
1778
1796
|
// Function to handle selecting/toggling an option for single or multi-select
|
|
1779
1797
|
// When not using a form or greater FormContext
|
|
1780
1798
|
const selectValue = val => {
|
|
1781
|
-
console.log("selectValue", val);
|
|
1782
1799
|
if (isMultiple) {
|
|
1783
1800
|
// For multi-select, toggle the value in the array
|
|
1784
1801
|
const current = props?.value ?? [];
|
|
@@ -1822,11 +1839,13 @@ function Select(props) {
|
|
|
1822
1839
|
if (props.renderValue) {
|
|
1823
1840
|
return props.renderValue(selectedArray);
|
|
1824
1841
|
} else {
|
|
1825
|
-
const labels = selectedArray.map(val =>
|
|
1842
|
+
const labels = selectedArray.map(val => options[JSON.stringify(val)]?.label || String(val));
|
|
1826
1843
|
return (() => {
|
|
1827
1844
|
var _el$3 = _tmpl$$g();
|
|
1828
|
-
|
|
1829
|
-
|
|
1845
|
+
_el$3.style.setProperty("width", "100%");
|
|
1846
|
+
_el$3.style.setProperty("height", "100%");
|
|
1847
|
+
insert(_el$3, () => labels.join(', '));
|
|
1848
|
+
createRenderEffect(() => className(_el$3, `${styles$7["solid_select__value"]} ${styles$7["multiselect-value"]}`));
|
|
1830
1849
|
return _el$3;
|
|
1831
1850
|
})();
|
|
1832
1851
|
}
|
|
@@ -1850,10 +1869,9 @@ function Select(props) {
|
|
|
1850
1869
|
} else if (props.renderValue) {
|
|
1851
1870
|
return props.renderValue(singleVal);
|
|
1852
1871
|
} else {
|
|
1853
|
-
const label = optionsMap.get(singleVal) || String(singleVal);
|
|
1854
1872
|
return (() => {
|
|
1855
1873
|
var _el$6 = _tmpl$$g();
|
|
1856
|
-
insert(_el$6,
|
|
1874
|
+
insert(_el$6, () => getLabel(singleVal));
|
|
1857
1875
|
createRenderEffect(() => className(_el$6, `${styles$7["solid_select__value"]}`));
|
|
1858
1876
|
return _el$6;
|
|
1859
1877
|
})();
|
|
@@ -1903,6 +1921,25 @@ function Select(props) {
|
|
|
1903
1921
|
y: 0
|
|
1904
1922
|
};
|
|
1905
1923
|
});
|
|
1924
|
+
const selectWidth = () => {
|
|
1925
|
+
if (menuLocRef()) {
|
|
1926
|
+
return menuLocRef().getBoundingClientRect().width;
|
|
1927
|
+
}
|
|
1928
|
+
return 0;
|
|
1929
|
+
};
|
|
1930
|
+
createMemo(() => {
|
|
1931
|
+
const value = currentValue();
|
|
1932
|
+
if (isMultiple) {
|
|
1933
|
+
const selectedArray = Array.isArray(value) ? value : [];
|
|
1934
|
+
if (selectedArray.length === 0) {
|
|
1935
|
+
return 0;
|
|
1936
|
+
}
|
|
1937
|
+
const labels = selectedArray.map(val => options[JSON.stringify(val)]?.label || String(val));
|
|
1938
|
+
return labels.join(", ").length * 8; // Approximate width based on character count
|
|
1939
|
+
} else {
|
|
1940
|
+
return selectWidth();
|
|
1941
|
+
}
|
|
1942
|
+
});
|
|
1906
1943
|
const updatePosition = () => {
|
|
1907
1944
|
const menuLoc = dropdownRef();
|
|
1908
1945
|
const select = selectRef();
|
|
@@ -1966,7 +2003,7 @@ function Select(props) {
|
|
|
1966
2003
|
const formValue = currentValue() ?? isMultiple ? [] : undefined;
|
|
1967
2004
|
const typedFormValue = isMultiple ? formValue : formValue;
|
|
1968
2005
|
if (isMultiple) {
|
|
1969
|
-
const isAvailableOptions = typedFormValue.every(val =>
|
|
2006
|
+
const isAvailableOptions = typedFormValue.every(val => !!options[JSON.stringify(val)]);
|
|
1970
2007
|
if (!!formValue && formValue.length > 0 && isAvailableOptions) {
|
|
1971
2008
|
form.setTextInside(true);
|
|
1972
2009
|
setSelected?.(old => [...(old ?? []), ...typedFormValue]);
|
|
@@ -1975,7 +2012,7 @@ function Select(props) {
|
|
|
1975
2012
|
}
|
|
1976
2013
|
} else {
|
|
1977
2014
|
if (typedFormValue) {
|
|
1978
|
-
if (
|
|
2015
|
+
if (!!options[JSON.stringify(typedFormValue)]) {
|
|
1979
2016
|
form.setTextInside(true);
|
|
1980
2017
|
setSelected?.(formValue);
|
|
1981
2018
|
} else {
|
|
@@ -3936,6 +3973,9 @@ const Table = props => {
|
|
|
3936
3973
|
mounted();
|
|
3937
3974
|
return rowData;
|
|
3938
3975
|
};
|
|
3976
|
+
const rowKeys = createMemo(() => {
|
|
3977
|
+
return Object.keys(rows()).map(key => parseInt(key)).sort((a, b) => a - b);
|
|
3978
|
+
});
|
|
3939
3979
|
tableContext.addRowCell = (index, name, cell, isDropDown) => {
|
|
3940
3980
|
setRows(old => {
|
|
3941
3981
|
const newRows = {
|
|
@@ -4112,6 +4152,17 @@ const Table = props => {
|
|
|
4112
4152
|
return newStyles;
|
|
4113
4153
|
});
|
|
4114
4154
|
};
|
|
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
|
+
});
|
|
4115
4166
|
const headerFactory = (index, column) => {
|
|
4116
4167
|
return headers()?.[index]?.[column];
|
|
4117
4168
|
};
|
|
@@ -4257,7 +4308,7 @@ const Table = props => {
|
|
|
4257
4308
|
},
|
|
4258
4309
|
children: (item, index) => createComponent(For, {
|
|
4259
4310
|
get each() {
|
|
4260
|
-
return
|
|
4311
|
+
return rowKeys();
|
|
4261
4312
|
},
|
|
4262
4313
|
children: rowNum => {
|
|
4263
4314
|
return (() => {
|
|
@@ -4286,42 +4337,18 @@ const Table = props => {
|
|
|
4286
4337
|
return `${dropRowStyle(rowNum, index())} ${rowStyleFactory?.(rowNum)?.all?.class ?? ''}`;
|
|
4287
4338
|
}
|
|
4288
4339
|
}), false, true);
|
|
4289
|
-
insert(_el$10, createComponent(
|
|
4290
|
-
|
|
4291
|
-
|
|
4340
|
+
insert(_el$10, createComponent(TableRowColumns, {
|
|
4341
|
+
reactiveColumns: reactiveColumns,
|
|
4342
|
+
rows: rows,
|
|
4343
|
+
rowNum: rowNum,
|
|
4344
|
+
get index() {
|
|
4345
|
+
return index();
|
|
4292
4346
|
},
|
|
4293
|
-
|
|
4294
|
-
|
|
4295
|
-
|
|
4296
|
-
|
|
4297
|
-
|
|
4298
|
-
// Initialize with closed state if not already set
|
|
4299
|
-
if (dropOpenStore[index()] === undefined) {
|
|
4300
|
-
setDropOpenStore(index(), false);
|
|
4301
|
-
}
|
|
4302
|
-
}
|
|
4303
|
-
if (Object.keys(tableSpot ?? {}).includes('dropRow') && tableSpot?.dropRow !== false) {
|
|
4304
|
-
return (() => {
|
|
4305
|
-
var _el$11 = _tmpl$6();
|
|
4306
|
-
insert(_el$11, () => renderCell(cell, item, index()));
|
|
4307
|
-
createRenderEffect(() => setAttribute(_el$11, "colspan", reactiveColumns().length));
|
|
4308
|
-
return _el$11;
|
|
4309
|
-
})();
|
|
4310
|
-
}
|
|
4311
|
-
return !isNullish(cell) ? (() => {
|
|
4312
|
-
var _el$12 = _tmpl$6();
|
|
4313
|
-
spread(_el$12, mergeProps(() => cellStyle?.()?.[rowNum]?.[column]?.all, {
|
|
4314
|
-
get style() {
|
|
4315
|
-
return cellStyle()[rowNum]?.[column]?.style;
|
|
4316
|
-
},
|
|
4317
|
-
get ["class"]() {
|
|
4318
|
-
return cellStyle()[rowNum]?.[column]?.class;
|
|
4319
|
-
}
|
|
4320
|
-
}), false, true);
|
|
4321
|
-
insert(_el$12, () => renderCell(cell, item, index()));
|
|
4322
|
-
return _el$12;
|
|
4323
|
-
})() : [];
|
|
4324
|
-
}
|
|
4347
|
+
setDropOpenStore: setDropOpenStore,
|
|
4348
|
+
renderCell: renderCell,
|
|
4349
|
+
item: item,
|
|
4350
|
+
dropOpenStore: dropOpenStore,
|
|
4351
|
+
cellStyle: cellStyle
|
|
4325
4352
|
}));
|
|
4326
4353
|
return _el$10;
|
|
4327
4354
|
})();
|
|
@@ -4342,8 +4369,8 @@ const Table = props => {
|
|
|
4342
4369
|
},
|
|
4343
4370
|
children: rowNum => {
|
|
4344
4371
|
return (() => {
|
|
4345
|
-
var _el$
|
|
4346
|
-
spread(_el$
|
|
4372
|
+
var _el$11 = _tmpl$4();
|
|
4373
|
+
spread(_el$11, mergeProps(() => footerStyle()[rowNum]?.all, {
|
|
4347
4374
|
get style() {
|
|
4348
4375
|
return footerStyle()[rowNum]?.style;
|
|
4349
4376
|
},
|
|
@@ -4351,15 +4378,15 @@ const Table = props => {
|
|
|
4351
4378
|
return footerStyle()[rowNum]?.class;
|
|
4352
4379
|
}
|
|
4353
4380
|
}), false, true);
|
|
4354
|
-
insert(_el$
|
|
4381
|
+
insert(_el$11, createComponent(For, {
|
|
4355
4382
|
get each() {
|
|
4356
4383
|
return reactiveColumns();
|
|
4357
4384
|
},
|
|
4358
4385
|
children: column => {
|
|
4359
4386
|
const footCell = footerCell()[rowNum]?.[column];
|
|
4360
4387
|
return !!footCell ? (() => {
|
|
4361
|
-
var _el$
|
|
4362
|
-
spread(_el$
|
|
4388
|
+
var _el$12 = _tmpl$6();
|
|
4389
|
+
spread(_el$12, mergeProps(() => footCellStyle()?.[rowNum]?.[column]?.all, {
|
|
4363
4390
|
get style() {
|
|
4364
4391
|
return footCellStyle()[rowNum]?.[column]?.style;
|
|
4365
4392
|
},
|
|
@@ -4367,12 +4394,12 @@ const Table = props => {
|
|
|
4367
4394
|
return footCellStyle()[rowNum]?.[column]?.class;
|
|
4368
4395
|
}
|
|
4369
4396
|
}), false, true);
|
|
4370
|
-
insert(_el$
|
|
4371
|
-
return _el$
|
|
4397
|
+
insert(_el$12, footCell);
|
|
4398
|
+
return _el$12;
|
|
4372
4399
|
})() : [];
|
|
4373
4400
|
}
|
|
4374
4401
|
}));
|
|
4375
|
-
return _el$
|
|
4402
|
+
return _el$11;
|
|
4376
4403
|
})();
|
|
4377
4404
|
}
|
|
4378
4405
|
}));
|
|
@@ -4394,6 +4421,43 @@ const Table = props => {
|
|
|
4394
4421
|
}
|
|
4395
4422
|
}));
|
|
4396
4423
|
};
|
|
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
|
+
};
|
|
4397
4461
|
|
|
4398
4462
|
const Row = props => {
|
|
4399
4463
|
const [local, others] = splitProps(props, ["rowNumber", "children", "class", "style", "header", "footer"]);
|
|
@@ -4437,7 +4501,8 @@ const Row = props => {
|
|
|
4437
4501
|
const Column = props => {
|
|
4438
4502
|
const {
|
|
4439
4503
|
addColumnStyle,
|
|
4440
|
-
removeColumnStyle
|
|
4504
|
+
removeColumnStyle,
|
|
4505
|
+
refresh
|
|
4441
4506
|
} = useTableContext();
|
|
4442
4507
|
const [local, others] = splitProps(props, ["name", "rowNumber", "children", "class", "style"]);
|
|
4443
4508
|
// Track the name to handle changes
|
|
@@ -4445,6 +4510,7 @@ const Column = props => {
|
|
|
4445
4510
|
// Create a reactive effect to update styles
|
|
4446
4511
|
createEffect(() => {
|
|
4447
4512
|
const newName = local.name;
|
|
4513
|
+
refresh();
|
|
4448
4514
|
// If the name has changed, remove the old style
|
|
4449
4515
|
if (currentName !== newName && currentName && removeColumnStyle) {
|
|
4450
4516
|
removeColumnStyle(currentName);
|
|
@@ -4482,7 +4548,8 @@ const Cell = props => {
|
|
|
4482
4548
|
removeFooterCell,
|
|
4483
4549
|
addRowCell,
|
|
4484
4550
|
addCellStyle,
|
|
4485
|
-
removeRowCell
|
|
4551
|
+
removeRowCell,
|
|
4552
|
+
refresh
|
|
4486
4553
|
} = useTableContext();
|
|
4487
4554
|
const [local, others] = splitProps(props, ["children", "class", "style", "footer", "rowNumber", "header"]);
|
|
4488
4555
|
// Get the column name from context or props
|
|
@@ -4493,6 +4560,7 @@ const Cell = props => {
|
|
|
4493
4560
|
let registeredAsFooter = false;
|
|
4494
4561
|
let registeredAsRow = false;
|
|
4495
4562
|
createEffect(() => {
|
|
4563
|
+
refresh();
|
|
4496
4564
|
const name = cellName();
|
|
4497
4565
|
const row = rowNumber();
|
|
4498
4566
|
props.children;
|
|
@@ -4575,6 +4643,7 @@ const Header = props => {
|
|
|
4575
4643
|
}
|
|
4576
4644
|
const [local, others] = splitProps(props, ["children", "class", "style", "rowNumber"]);
|
|
4577
4645
|
createEffect(() => {
|
|
4646
|
+
tableContext.refresh();
|
|
4578
4647
|
tableContext?.addHeaderCell?.(columnInfo.name, (props?.rowNumber ?? 1) - 1, local.children);
|
|
4579
4648
|
tableContext?.addHeaderStyle?.(columnInfo.name, (props?.rowNumber ?? 1) - 1, {
|
|
4580
4649
|
class: local.class,
|