@xanui/ui 1.1.46 → 1.1.47
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/Datatable/TableHead.cjs
CHANGED
|
@@ -9,9 +9,8 @@ var index$2 = require('../TableCell/index.cjs');
|
|
|
9
9
|
var index$3 = require('../Checkbox/index.cjs');
|
|
10
10
|
var IndeterminateCheckBoxIcon = require('@xanui/icons/IndeterminateCheckBox');
|
|
11
11
|
var index$4 = require('../Stack/index.cjs');
|
|
12
|
-
var ArrowDropDown = require('@xanui/icons/ArrowDropDown');
|
|
13
|
-
var ArrowDropUp = require('@xanui/icons/ArrowDropUp');
|
|
14
12
|
var index$5 = require('../Text/index.cjs');
|
|
13
|
+
var SwitchRight = require('@xanui/icons/SwitchRight');
|
|
15
14
|
|
|
16
15
|
const TableHeadRender = ({ columns, rows, disableRow, rowAction, hideCheckbox, compact, skeleton, state, update }) => {
|
|
17
16
|
var _a;
|
|
@@ -46,14 +45,26 @@ const TableHeadRender = ({ columns, rows, disableRow, rowAction, hideCheckbox, c
|
|
|
46
45
|
}
|
|
47
46
|
} }) }), columns.map((_a, idx) => {
|
|
48
47
|
var { label, field: _f, sortable } = _a, rest = tslib.__rest(_a, ["label", "field", "sortable"]);
|
|
49
|
-
return jsxRuntime.jsx(index$2, Object.assign({ th: true, textAlign: "left" }, rest, { children: jsxRuntime.jsxs(index$4, { disabled: skeleton ? true : false, flexRow: true, alignItems: "center", cursor: sortable ? "pointer" : "default", userSelect: "none", onClick: () => {
|
|
48
|
+
return jsxRuntime.jsx(index$2, Object.assign({ th: true, textAlign: "left" }, rest, { children: jsxRuntime.jsxs(index$4, { disabled: skeleton ? true : false, flexRow: true, alignItems: "center", cursor: sortable ? "pointer" : "default", userSelect: "none", gap: .5, onClick: () => {
|
|
50
49
|
if (sortable) {
|
|
51
|
-
|
|
50
|
+
let v = sortables[_f];
|
|
51
|
+
if (!v) {
|
|
52
|
+
sortables[_f] = 'asc';
|
|
53
|
+
}
|
|
54
|
+
else if (v === 'asc') {
|
|
55
|
+
sortables[_f] = 'desc';
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
delete sortables[_f];
|
|
59
|
+
}
|
|
52
60
|
update({
|
|
53
61
|
sortable: sortables
|
|
54
62
|
});
|
|
55
63
|
}
|
|
56
|
-
}, children: [jsxRuntime.jsx(index$5, { color: "text.secondary", children: label }), sortable && jsxRuntime.jsx(jsxRuntime.Fragment, { children:
|
|
64
|
+
}, children: [jsxRuntime.jsx(index$5, { color: "text.secondary", fontWeight: 600, children: label }), sortable && jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsx(SwitchRight, { opacity: sortables[_f] ? 1 : .3, color: sortables[_f] ? 'brand' : 'text.secondary', sx: {
|
|
65
|
+
fontSize: 23,
|
|
66
|
+
transform: sortables[_f] === 'desc' ? 'rotate(-90deg)' : 'rotate(90deg)',
|
|
67
|
+
} }) })] }) }), idx);
|
|
57
68
|
}), !!(rows.length && rowAction && ((_a = rowAction(rows[0])) === null || _a === void 0 ? void 0 : _a.length)) && jsxRuntime.jsx(index$2, { th: true, width: 30 })] }) }));
|
|
58
69
|
};
|
|
59
70
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableHead.cjs","sources":["../../src/Datatable/TableHead.tsx"],"sourcesContent":["\"use client\";\nimport TableHead from '../TableHead'\nimport TableRow from '../TableRow'\nimport TableCell from '../TableCell'\nimport Checkbox from '../Checkbox'\nimport IntermidiatIcon from '@xanui/icons/IndeterminateCheckBox'\nimport { DatatablePropsWithState } from './types';\nimport Stack from '../Stack';\nimport
|
|
1
|
+
{"version":3,"file":"TableHead.cjs","sources":["../../src/Datatable/TableHead.tsx"],"sourcesContent":["\"use client\";\nimport TableHead from '../TableHead'\nimport TableRow from '../TableRow'\nimport TableCell from '../TableCell'\nimport Checkbox from '../Checkbox'\nimport IntermidiatIcon from '@xanui/icons/IndeterminateCheckBox'\nimport { DatatablePropsWithState } from './types';\nimport Stack from '../Stack';\nimport Text from '../Text';\nimport SwitchRight from '@xanui/icons/SwitchRight';\n\nconst TableHeadRender = ({ columns, rows, disableRow, rowAction, hideCheckbox, compact, skeleton, state, update }: DatatablePropsWithState) => {\n if (!columns.length) return <></>\n let checked = state.selectAll || !!state.selected.length\n let sortables = state.sortable || {}\n\n return (\n <TableHead position=\"relative\">\n <TableRow bgcolor=\"default\" borderBottom={1} >\n {!hideCheckbox && <TableCell th width={40}>\n <Checkbox\n size={compact ? \"small\" : \"medium\"}\n checkIcon={state.selected.length && !state.selectAll ? <IntermidiatIcon /> : undefined}\n checked={checked}\n onChange={() => {\n let ids: any = []\n let undefinedCount = 0\n for (let i = 0; i < rows.length; i++) {\n const row = rows[i]\n const isDisable = (disableRow ? disableRow(row, state) : false) || false\n if (!isDisable && row.id) {\n ids.push(row.id)\n } else {\n undefinedCount += 1\n }\n }\n\n if (undefinedCount) {\n update({\n selected: state.selected.length ? [] : ids,\n selectAll: !state.selected.length\n })\n } else {\n update({\n selected: state.selectAll ? [] : ids,\n selectAll: !state.selectAll\n })\n }\n }}\n />\n </TableCell>}\n {\n columns.map(({ label, field: _f, sortable, ...rest }, idx) => <TableCell\n key={idx}\n th\n textAlign=\"left\"\n {...rest}\n >\n <Stack\n disabled={skeleton ? true : false}\n flexRow\n alignItems=\"center\"\n cursor={sortable ? \"pointer\" : \"default\"}\n userSelect={\"none\"}\n gap={.5}\n onClick={() => {\n if (sortable) {\n let v = sortables[_f as any]\n if (!v) {\n sortables[_f as any] = 'asc'\n } else if (v === 'asc') {\n sortables[_f as any] = 'desc'\n } else {\n delete sortables[_f as any]\n }\n update({\n sortable: sortables\n })\n }\n }}\n >\n <Text color=\"text.secondary\" fontWeight={600}>{label}</Text>\n {sortable && <>\n <SwitchRight\n opacity={sortables[_f as any] ? 1 : .3}\n color={sortables[_f as any] ? 'brand' : 'text.secondary'}\n sx={{\n fontSize: 23,\n transform: sortables[_f as any] === 'desc' ? 'rotate(-90deg)' : 'rotate(90deg)',\n }}\n />\n </>}\n </Stack>\n </TableCell>)\n }\n {\n !!(rows.length && rowAction && rowAction((rows as any)[0])?.length) && <TableCell th width={30} />\n }\n </TableRow>\n </TableHead>\n )\n}\n\nexport default TableHeadRender\n"],"names":[],"mappings":";;;;;;;;;;;;;;AAWA;;;AACyB;AACrB;AACA;AAEA;;;AAWwB;AACI;;AAEA;AACI;;;;;;;AAOJ;AACI;AACA;AACH;;;AAED;;AAEI;AACH;;AAET;AAIS;;;AAeG;;AAEI;;AACG;AACH;;;AAEA;;AAEJ;AACI;AACH;;;AAUG;AACA;AACH;AAIL;AAQhC;;"}
|
package/Datatable/TableHead.js
CHANGED
|
@@ -7,9 +7,8 @@ import TableCell from '../TableCell/index.js';
|
|
|
7
7
|
import Checkbox from '../Checkbox/index.js';
|
|
8
8
|
import IndeterminateCheckBoxIcon from '@xanui/icons/IndeterminateCheckBox';
|
|
9
9
|
import Stack from '../Stack/index.js';
|
|
10
|
-
import ArrowDropDown from '@xanui/icons/ArrowDropDown';
|
|
11
|
-
import ArrowDropUp from '@xanui/icons/ArrowDropUp';
|
|
12
10
|
import Text from '../Text/index.js';
|
|
11
|
+
import SwitchRight from '@xanui/icons/SwitchRight';
|
|
13
12
|
|
|
14
13
|
const TableHeadRender = ({ columns, rows, disableRow, rowAction, hideCheckbox, compact, skeleton, state, update }) => {
|
|
15
14
|
var _a;
|
|
@@ -44,14 +43,26 @@ const TableHeadRender = ({ columns, rows, disableRow, rowAction, hideCheckbox, c
|
|
|
44
43
|
}
|
|
45
44
|
} }) }), columns.map((_a, idx) => {
|
|
46
45
|
var { label, field: _f, sortable } = _a, rest = __rest(_a, ["label", "field", "sortable"]);
|
|
47
|
-
return jsx(TableCell, Object.assign({ th: true, textAlign: "left" }, rest, { children: jsxs(Stack, { disabled: skeleton ? true : false, flexRow: true, alignItems: "center", cursor: sortable ? "pointer" : "default", userSelect: "none", onClick: () => {
|
|
46
|
+
return jsx(TableCell, Object.assign({ th: true, textAlign: "left" }, rest, { children: jsxs(Stack, { disabled: skeleton ? true : false, flexRow: true, alignItems: "center", cursor: sortable ? "pointer" : "default", userSelect: "none", gap: .5, onClick: () => {
|
|
48
47
|
if (sortable) {
|
|
49
|
-
|
|
48
|
+
let v = sortables[_f];
|
|
49
|
+
if (!v) {
|
|
50
|
+
sortables[_f] = 'asc';
|
|
51
|
+
}
|
|
52
|
+
else if (v === 'asc') {
|
|
53
|
+
sortables[_f] = 'desc';
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
delete sortables[_f];
|
|
57
|
+
}
|
|
50
58
|
update({
|
|
51
59
|
sortable: sortables
|
|
52
60
|
});
|
|
53
61
|
}
|
|
54
|
-
}, children: [jsx(Text, { color: "text.secondary", children: label }), sortable && jsx(Fragment, { children: sortables[_f]
|
|
62
|
+
}, children: [jsx(Text, { color: "text.secondary", fontWeight: 600, children: label }), sortable && jsx(Fragment, { children: jsx(SwitchRight, { opacity: sortables[_f] ? 1 : .3, color: sortables[_f] ? 'brand' : 'text.secondary', sx: {
|
|
63
|
+
fontSize: 23,
|
|
64
|
+
transform: sortables[_f] === 'desc' ? 'rotate(-90deg)' : 'rotate(90deg)',
|
|
65
|
+
} }) })] }) }), idx);
|
|
55
66
|
}), !!(rows.length && rowAction && ((_a = rowAction(rows[0])) === null || _a === void 0 ? void 0 : _a.length)) && jsx(TableCell, { th: true, width: 30 })] }) }));
|
|
56
67
|
};
|
|
57
68
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableHead.js","sources":["../../src/Datatable/TableHead.tsx"],"sourcesContent":["\"use client\";\nimport TableHead from '../TableHead'\nimport TableRow from '../TableRow'\nimport TableCell from '../TableCell'\nimport Checkbox from '../Checkbox'\nimport IntermidiatIcon from '@xanui/icons/IndeterminateCheckBox'\nimport { DatatablePropsWithState } from './types';\nimport Stack from '../Stack';\nimport
|
|
1
|
+
{"version":3,"file":"TableHead.js","sources":["../../src/Datatable/TableHead.tsx"],"sourcesContent":["\"use client\";\nimport TableHead from '../TableHead'\nimport TableRow from '../TableRow'\nimport TableCell from '../TableCell'\nimport Checkbox from '../Checkbox'\nimport IntermidiatIcon from '@xanui/icons/IndeterminateCheckBox'\nimport { DatatablePropsWithState } from './types';\nimport Stack from '../Stack';\nimport Text from '../Text';\nimport SwitchRight from '@xanui/icons/SwitchRight';\n\nconst TableHeadRender = ({ columns, rows, disableRow, rowAction, hideCheckbox, compact, skeleton, state, update }: DatatablePropsWithState) => {\n if (!columns.length) return <></>\n let checked = state.selectAll || !!state.selected.length\n let sortables = state.sortable || {}\n\n return (\n <TableHead position=\"relative\">\n <TableRow bgcolor=\"default\" borderBottom={1} >\n {!hideCheckbox && <TableCell th width={40}>\n <Checkbox\n size={compact ? \"small\" : \"medium\"}\n checkIcon={state.selected.length && !state.selectAll ? <IntermidiatIcon /> : undefined}\n checked={checked}\n onChange={() => {\n let ids: any = []\n let undefinedCount = 0\n for (let i = 0; i < rows.length; i++) {\n const row = rows[i]\n const isDisable = (disableRow ? disableRow(row, state) : false) || false\n if (!isDisable && row.id) {\n ids.push(row.id)\n } else {\n undefinedCount += 1\n }\n }\n\n if (undefinedCount) {\n update({\n selected: state.selected.length ? [] : ids,\n selectAll: !state.selected.length\n })\n } else {\n update({\n selected: state.selectAll ? [] : ids,\n selectAll: !state.selectAll\n })\n }\n }}\n />\n </TableCell>}\n {\n columns.map(({ label, field: _f, sortable, ...rest }, idx) => <TableCell\n key={idx}\n th\n textAlign=\"left\"\n {...rest}\n >\n <Stack\n disabled={skeleton ? true : false}\n flexRow\n alignItems=\"center\"\n cursor={sortable ? \"pointer\" : \"default\"}\n userSelect={\"none\"}\n gap={.5}\n onClick={() => {\n if (sortable) {\n let v = sortables[_f as any]\n if (!v) {\n sortables[_f as any] = 'asc'\n } else if (v === 'asc') {\n sortables[_f as any] = 'desc'\n } else {\n delete sortables[_f as any]\n }\n update({\n sortable: sortables\n })\n }\n }}\n >\n <Text color=\"text.secondary\" fontWeight={600}>{label}</Text>\n {sortable && <>\n <SwitchRight\n opacity={sortables[_f as any] ? 1 : .3}\n color={sortables[_f as any] ? 'brand' : 'text.secondary'}\n sx={{\n fontSize: 23,\n transform: sortables[_f as any] === 'desc' ? 'rotate(-90deg)' : 'rotate(90deg)',\n }}\n />\n </>}\n </Stack>\n </TableCell>)\n }\n {\n !!(rows.length && rowAction && rowAction((rows as any)[0])?.length) && <TableCell th width={30} />\n }\n </TableRow>\n </TableHead>\n )\n}\n\nexport default TableHeadRender\n"],"names":[],"mappings":";;;;;;;;;;;;AAWA;;;AACyB;AACrB;AACA;AAEA;;;AAWwB;AACI;;AAEA;AACI;;;;;;;AAOJ;AACI;AACA;AACH;;;AAED;;AAEI;AACH;;AAET;AAIS;;;AAeG;;AAEI;;AACG;AACH;;;AAEA;;AAEJ;AACI;AACH;;;AAUG;AACA;AACH;AAIL;AAQhC;;"}
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xanui/ui",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.47",
|
|
4
4
|
"description": "Xanui - A React Component Library",
|
|
5
5
|
"private": false,
|
|
6
6
|
"dependencies": {
|
|
7
7
|
"@xanui/core": "^1.2.39",
|
|
8
|
-
"@xanui/icons": "^1.1.
|
|
8
|
+
"@xanui/icons": "^1.1.12",
|
|
9
9
|
"pretty-class": "^1.0.8",
|
|
10
10
|
"react-state-bucket": "^1.2.6"
|
|
11
11
|
},
|