aio-table 12.0.0 → 12.0.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.
- package/index.css +5 -15
- package/index.js +22 -18
- package/package.json +1 -1
package/index.css
CHANGED
|
@@ -91,6 +91,7 @@
|
|
|
91
91
|
.aio-table-row {
|
|
92
92
|
display: flex;
|
|
93
93
|
min-width: fit-content;
|
|
94
|
+
height:40px;
|
|
94
95
|
}
|
|
95
96
|
.aio-table-cell {
|
|
96
97
|
padding: 6px 12px;
|
|
@@ -181,22 +182,11 @@
|
|
|
181
182
|
align-items: center;
|
|
182
183
|
justify-content: center;
|
|
183
184
|
width: 36px;
|
|
184
|
-
border:
|
|
185
|
-
background
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
border:none;
|
|
189
|
-
background: none;
|
|
190
|
-
}
|
|
191
|
-
.aio-table-toolbar-button .aio-input{
|
|
192
|
-
border:none;
|
|
193
|
-
background: none;
|
|
194
|
-
width:100%;
|
|
195
|
-
height:100%;
|
|
196
|
-
padding:0;
|
|
185
|
+
border: 1px solid #ddd;
|
|
186
|
+
background:#fff;
|
|
187
|
+
border-radius:100%;
|
|
188
|
+
width:36px;
|
|
197
189
|
}
|
|
198
|
-
|
|
199
|
-
|
|
200
190
|
.aio-table-remove {
|
|
201
191
|
border: none;
|
|
202
192
|
width: 36px;
|
package/index.js
CHANGED
|
@@ -319,7 +319,7 @@ const TableRows = () => {
|
|
|
319
319
|
};
|
|
320
320
|
const TableToolbar = () => {
|
|
321
321
|
let { add, exportToExcel, search, rootProps, excelColumns, toggleColumns, getIcon, sortHook, getColumnOption, tableHook, filterHook } = useProvider();
|
|
322
|
-
let { toolbarAttrs, toolbar, onAdd, onSearch, value, onChangeColumns, columns = [] } = rootProps;
|
|
322
|
+
let { toolbarAttrs, toolbar, onAdd, onSearch, value, onChangeColumns, columns = [], fa } = rootProps;
|
|
323
323
|
const columnsRef = useRef(columns);
|
|
324
324
|
columnsRef.current = columns;
|
|
325
325
|
toolbarAttrs = UT.AddToAttrs(toolbarAttrs, { className: 'aio-table-toolbar' });
|
|
@@ -338,21 +338,25 @@ const TableToolbar = () => {
|
|
|
338
338
|
const column = columns.find((o) => o.id === columnId);
|
|
339
339
|
return getColumnOption(key, tableHook.getCellDetail({ column }));
|
|
340
340
|
};
|
|
341
|
-
return (_jsxs("div", Object.assign({}, toolbarAttrs, { children: [toolbar && _jsx("div", { className: 'aio-table-toolbar-content', children: typeof toolbar === 'function' ? toolbar() : toolbar }), !!rootProps.filter && filterHook.renderButton(), !!onSearch &&
|
|
342
|
-
_jsx(
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
341
|
+
return (_jsxs("div", Object.assign({}, toolbarAttrs, { children: [toolbar && _jsx("div", { className: 'aio-table-toolbar-content', children: typeof toolbar === 'function' ? toolbar() : toolbar }), !!rootProps.filter && filterHook.renderButton({ className: 'aio-table-toolbar-button' }), !!onSearch && _jsx(AIOInput, { type: 'text', className: 'aio-table-search', onChange: (value) => search(value), after: getIcon('mdiMagnify', 0.7) }), !!sortHook.sorts.length && sortHook.renderSortButton({ className: 'aio-table-toolbar-button aio-table-sort-button' }), !!excelColumns.length && _jsx("div", { className: 'aio-table-toolbar-button aio-table-excel-button', onClick: () => exportToExcel(), children: getIcon('mdiFileExcel', 0.8) }), !!toggleColumns.length &&
|
|
342
|
+
_jsx(AISelect, { popover: {
|
|
343
|
+
header: { title: fa ? 'نمایش ستون ها' : 'Show Columns', onClose: false },
|
|
344
|
+
setAttrs: (key) => { if (key === 'header') {
|
|
345
|
+
return { className: 'aio-table-dropdown-header' };
|
|
346
|
+
} },
|
|
347
|
+
limitTo: '.aio-table'
|
|
348
|
+
}, className: 'aio-table-toolbar-button aio-table-toggle-button', text: getIcon('mdiEye', 0.8), justify: true, hideTags: true, options: toggleColumns.map((o) => (Object.assign(Object.assign({}, o), { show: true }))), caret: false, option: {
|
|
349
|
+
text: (column) => getColumnOptionWrapper(column.id, 'title'),
|
|
350
|
+
checked: (column) => getColumnOptionWrapper(column.id, 'show'),
|
|
351
|
+
onClick: (column) => {
|
|
352
|
+
if (!onChangeColumns) {
|
|
353
|
+
return;
|
|
354
|
+
}
|
|
355
|
+
const columns = columnsRef.current || [];
|
|
356
|
+
onChangeColumns(columns.map((o) => column.id === o.id ? Object.assign(Object.assign({}, o), { show: !getColumnOptionWrapper(o.id, 'show') }) : o));
|
|
357
|
+
},
|
|
358
|
+
close: () => false
|
|
359
|
+
} }), !!onAdd && _jsx("div", { className: 'aio-table-toolbar-button aio-table-add-button', onClick: () => add(), children: getAddText() })] })));
|
|
356
360
|
};
|
|
357
361
|
const TableHeader = () => {
|
|
358
362
|
let { rootProps, getColumnOption, tableHook } = useProvider();
|
|
@@ -544,12 +548,12 @@ const useTable = (getProps, getPaging, getColumnOption) => {
|
|
|
544
548
|
return UT.AddToAttrs(attrs, { className, style, attrs: { title: typeof title === 'string' ? title : undefined } });
|
|
545
549
|
};
|
|
546
550
|
const getRowAttrs = (rowDetail, isOdd) => {
|
|
547
|
-
const { rowOption = {}, onSwap,
|
|
551
|
+
const { rowOption = {}, onSwap, gap = [0, 1] } = getProps();
|
|
548
552
|
const { attrs: rowAttrs } = rowOption;
|
|
549
553
|
const attrs = rowAttrs ? rowAttrs(rowDetail) : {};
|
|
550
554
|
let obj = UT.AddToAttrs(attrs, { className: ['aio-table-row', isOdd ? 'aio-table-row-odd' : 'aio-table-row-even'], style: { gap: gap[0] } });
|
|
551
555
|
if (onSwap) {
|
|
552
|
-
obj = Object.assign(Object.assign(Object.assign({}, obj), DragRows.getDragAttrs(
|
|
556
|
+
obj = Object.assign(Object.assign(Object.assign({}, obj), DragRows.getDragAttrs(rowDetail.rowIndex)), DragRows.getDropAttrs(rowDetail.rowIndex));
|
|
553
557
|
}
|
|
554
558
|
return obj;
|
|
555
559
|
};
|