@varlet/ui 3.17.1 → 3.18.0-alpha.1781192892883
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/es/action-sheet/style/index.mjs +1 -1
- package/es/app-bar/AppBar.mjs +2 -0
- package/es/app-bar/appBar.css +1 -1
- package/es/app-bar/props.mjs +8 -0
- package/es/badge/badge.css +1 -1
- package/es/bottom-navigation-item/BottomNavigationItem.mjs +1 -1
- package/es/bottom-navigation-item/bottomNavigationItem.css +1 -1
- package/es/button/Button.mjs +13 -6
- package/es/button/button.css +1 -1
- package/es/button/props.mjs +2 -0
- package/es/collapse-transition/useCollapseTransition.mjs +27 -8
- package/es/data-table/DataTable.mjs +655 -0
- package/es/data-table/DataTableBodyCell.mjs +210 -0
- package/es/data-table/DataTableHeaderCell.mjs +237 -0
- package/es/data-table/DataTableSfc.css +0 -0
- package/es/data-table/dataTable.css +1 -0
- package/es/data-table/index.mjs +12 -0
- package/es/data-table/props.mjs +94 -0
- package/es/data-table/span.mjs +29 -0
- package/es/data-table/style/index.mjs +17 -0
- package/es/data-table/useBodyRows.mjs +141 -0
- package/es/data-table/useColumnSizes.mjs +175 -0
- package/es/data-table/useColumnsFixedOffsets.mjs +90 -0
- package/es/data-table/useContainerScroll.mjs +35 -0
- package/es/data-table/useExpandRow.mjs +46 -0
- package/es/data-table/useFootRows.mjs +49 -0
- package/es/data-table/useHeaderRows.mjs +113 -0
- package/es/data-table/usePagination.mjs +101 -0
- package/es/data-table/useSelectionColumn.mjs +242 -0
- package/es/data-table/useSorter.mjs +70 -0
- package/es/data-table/useTreeExpand.mjs +69 -0
- package/es/icon/icon.css +1 -1
- package/es/index.bundle.mjs +25 -1
- package/es/index.mjs +21 -1
- package/es/locale/en-US.mjs +3 -1
- package/es/locale/fa-IR.mjs +3 -1
- package/es/locale/ja-JP.mjs +3 -1
- package/es/locale/zh-CN.mjs +3 -1
- package/es/locale/zh-TW.mjs +3 -1
- package/es/menu/Menu.mjs +1 -0
- package/es/menu/menu.css +1 -1
- package/es/menu-select/MenuSelect.mjs +1 -1
- package/es/menu-select/menuSelect.css +1 -1
- package/es/otp-input/OtpInput.mjs +39 -12
- package/es/pagination/pagination.css +1 -1
- package/es/rail-navigation/RailNavigation.mjs +87 -0
- package/es/rail-navigation/RailNavigationSfc.css +0 -0
- package/es/rail-navigation/index.mjs +12 -0
- package/es/rail-navigation/props.mjs +21 -0
- package/es/rail-navigation/provide.mjs +12 -0
- package/es/rail-navigation/railNavigation.css +1 -0
- package/es/rail-navigation/style/index.mjs +3 -0
- package/es/rail-navigation-item/RailNavigationItem.mjs +177 -0
- package/es/rail-navigation-item/RailNavigationItemSfc.css +0 -0
- package/es/rail-navigation-item/index.mjs +12 -0
- package/es/rail-navigation-item/props.mjs +19 -0
- package/es/rail-navigation-item/provide.mjs +17 -0
- package/es/rail-navigation-item/railNavigationItem.css +1 -0
- package/es/rail-navigation-item/style/index.mjs +6 -0
- package/es/select/Select.mjs +1 -1
- package/es/select/select.css +1 -1
- package/es/snackbar/style/index.mjs +1 -1
- package/es/style.mjs +4 -0
- package/es/styles/common.css +1 -1
- package/es/table/Table.mjs +22 -9
- package/es/table/props.mjs +3 -1
- package/es/table/table.css +1 -1
- package/es/themes/dark/appBar.mjs +3 -0
- package/es/themes/dark/bottomNavigationItem.mjs +1 -0
- package/es/themes/dark/button.mjs +3 -0
- package/es/themes/dark/dataTable.mjs +32 -0
- package/es/themes/dark/index.mjs +6 -2
- package/es/themes/dark/railNavigation.mjs +12 -0
- package/es/themes/dark/railNavigationItem.mjs +18 -0
- package/es/themes/dark/table.mjs +7 -3
- package/es/themes/dark/treeMenu.mjs +32 -0
- package/es/themes/md3-dark/appBar.mjs +3 -0
- package/es/themes/md3-dark/bottomNavigationItem.mjs +1 -0
- package/es/themes/md3-dark/button.mjs +3 -0
- package/es/themes/md3-dark/dataTable.mjs +32 -0
- package/es/themes/md3-dark/index.mjs +6 -2
- package/es/themes/md3-dark/railNavigation.mjs +12 -0
- package/es/themes/md3-dark/railNavigationItem.mjs +18 -0
- package/es/themes/md3-dark/table.mjs +7 -3
- package/es/themes/md3-dark/treeMenu.mjs +32 -0
- package/es/themes/md3-light/appBar.mjs +3 -0
- package/es/themes/md3-light/bottomNavigationItem.mjs +1 -0
- package/es/themes/md3-light/button.mjs +3 -0
- package/es/themes/md3-light/dataTable.mjs +32 -0
- package/es/themes/md3-light/index.mjs +6 -2
- package/es/themes/md3-light/pagination.mjs +1 -1
- package/es/themes/md3-light/railNavigation.mjs +12 -0
- package/es/themes/md3-light/railNavigationItem.mjs +18 -0
- package/es/themes/md3-light/table.mjs +7 -3
- package/es/themes/md3-light/treeMenu.mjs +32 -0
- package/es/tree-menu/TreeMenu.mjs +223 -0
- package/es/tree-menu/TreeMenuOption.mjs +206 -0
- package/es/tree-menu/TreeMenuSfc.css +0 -0
- package/es/tree-menu/index.mjs +12 -0
- package/es/tree-menu/props.mjs +40 -0
- package/es/tree-menu/style/index.mjs +6 -0
- package/es/tree-menu/treeMenu.css +1 -0
- package/es/varlet.css +1 -1
- package/es/varlet.esm.js +11274 -8961
- package/highlight/web-types.en-US.json +414 -1
- package/highlight/web-types.zh-CN.json +148 -1
- package/lib/varlet.cjs.js +10850 -8024
- package/lib/varlet.css +1 -1
- package/package.json +7 -7
- package/types/appBar.d.ts +6 -0
- package/types/button.d.ts +2 -0
- package/types/buttonGroup.d.ts +1 -1
- package/types/dataTable.d.ts +173 -0
- package/types/index.d.ts +8 -0
- package/types/railNavigation.d.ts +27 -0
- package/types/railNavigationItem.d.ts +38 -0
- package/types/styleVars.d.ts +86 -0
- package/types/table.d.ts +2 -0
- package/types/treeMenu.d.ts +80 -0
- package/umd/varlet.js +7 -7
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
import { computed, defineComponent } from "vue";
|
|
2
|
+
import VarCheckbox from "../checkbox/index.mjs";
|
|
3
|
+
import VarIcon from "../icon/index.mjs";
|
|
4
|
+
import VarRadio from "../radio/index.mjs";
|
|
5
|
+
import { createNamespace, MaybeVNode } from "../utils/components.mjs";
|
|
6
|
+
const { n, classes } = createNamespace("data-table");
|
|
7
|
+
import { resolveComponent as _resolveComponent, openBlock as _openBlock, createBlock as _createBlock, createVNode as _createVNode, normalizeClass as _normalizeClass, createElementBlock as _createElementBlock, normalizeStyle as _normalizeStyle, mergeProps as _mergeProps } from "vue";
|
|
8
|
+
const _hoisted_1 = ["colspan", "rowspan"];
|
|
9
|
+
const _hoisted_2 = ["disabled"];
|
|
10
|
+
function __render__(_ctx, _cache) {
|
|
11
|
+
const _component_var_checkbox = _resolveComponent("var-checkbox");
|
|
12
|
+
const _component_var_radio = _resolveComponent("var-radio");
|
|
13
|
+
const _component_var_icon = _resolveComponent("var-icon");
|
|
14
|
+
const _component_maybe_v_node = _resolveComponent("maybe-v-node");
|
|
15
|
+
return _openBlock(), _createElementBlock("td", _mergeProps({
|
|
16
|
+
class: _ctx.classes(
|
|
17
|
+
_ctx.n("cell"),
|
|
18
|
+
_ctx.n("body-cell"),
|
|
19
|
+
[_ctx.isSelectionColumn(_ctx.cell.column), _ctx.n("selection-cell")],
|
|
20
|
+
[_ctx.isExpandColumn(_ctx.cell.column), _ctx.n("expand-cell")],
|
|
21
|
+
[_ctx.cell.column.fixed, _ctx.n("fixed-cell")],
|
|
22
|
+
[_ctx.shouldRenderLeftFixedShadow(_ctx.cell.columnIndex), _ctx.n("fixed-cell--shadow-right")],
|
|
23
|
+
[_ctx.shouldRenderRightFixedShadow(_ctx.cell.columnIndex), _ctx.n("fixed-cell--shadow-left")]
|
|
24
|
+
),
|
|
25
|
+
style: _ctx.style
|
|
26
|
+
}, _ctx.getCellProps(_ctx.bodyRow, _ctx.cell.column), {
|
|
27
|
+
colspan: _ctx.cell.colSpan,
|
|
28
|
+
rowspan: _ctx.cell.rowSpan
|
|
29
|
+
}), [
|
|
30
|
+
_ctx.isSelectionColumn(_ctx.cell.column) && _ctx.isMultipleSelectionColumn(_ctx.cell.column) ? (_openBlock(), _createBlock(_component_var_checkbox, {
|
|
31
|
+
key: 0,
|
|
32
|
+
"var-data-table-cover": "",
|
|
33
|
+
"model-value": _ctx.isRowKeySelected(_ctx.bodyRow.key),
|
|
34
|
+
indeterminate: _ctx.isRowKeyIndeterminate(_ctx.bodyRow.key),
|
|
35
|
+
disabled: !_ctx.isSelectionColumnSelectable(_ctx.cell.column) || !_ctx.isRowSelectable(_ctx.bodyRow.row, _ctx.bodyRow.rowIndex, _ctx.cell.column),
|
|
36
|
+
tabindex: "-1",
|
|
37
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.toggleRowSelection(_ctx.bodyRow, $event))
|
|
38
|
+
}, null, 8, ["model-value", "indeterminate", "disabled"])) : _ctx.isSelectionColumn(_ctx.cell.column) ? (_openBlock(), _createBlock(_component_var_radio, {
|
|
39
|
+
key: 1,
|
|
40
|
+
"var-data-table-cover": "",
|
|
41
|
+
"model-value": _ctx.isRowKeySelected(_ctx.bodyRow.key),
|
|
42
|
+
disabled: !_ctx.isSelectionColumnSelectable(_ctx.cell.column) || !_ctx.isRowSelectable(_ctx.bodyRow.row, _ctx.bodyRow.rowIndex, _ctx.cell.column),
|
|
43
|
+
tabindex: "-1",
|
|
44
|
+
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => _ctx.toggleRowSelection(_ctx.bodyRow, $event))
|
|
45
|
+
}, null, 8, ["model-value", "disabled"])) : _ctx.isExpandColumn(_ctx.cell.column) ? (_openBlock(), _createElementBlock("button", {
|
|
46
|
+
key: 2,
|
|
47
|
+
type: "button",
|
|
48
|
+
tabindex: "-1",
|
|
49
|
+
class: _normalizeClass(_ctx.classes(_ctx.n("expand-trigger"), [_ctx.bodyRow.expanded, _ctx.n("expand-trigger--expanded")])),
|
|
50
|
+
disabled: !_ctx.isRowExpandable(_ctx.bodyRow, _ctx.cell.column),
|
|
51
|
+
onClick: _cache[2] || (_cache[2] = ($event) => _ctx.toggleRowExpanded(_ctx.bodyRow))
|
|
52
|
+
}, [
|
|
53
|
+
_createVNode(_component_var_icon, {
|
|
54
|
+
"var-data-table-cover": "",
|
|
55
|
+
name: _ctx.bodyRow.expanded ? "chevron-down" : "chevron-right"
|
|
56
|
+
}, null, 8, ["name"])
|
|
57
|
+
], 10, _hoisted_2)) : _ctx.tree && _ctx.cell.treeLevel != null ? (_openBlock(), _createElementBlock(
|
|
58
|
+
"div",
|
|
59
|
+
{
|
|
60
|
+
key: 3,
|
|
61
|
+
class: _normalizeClass(_ctx.n("tree-cell")),
|
|
62
|
+
style: _normalizeStyle(_ctx.treeStyle)
|
|
63
|
+
},
|
|
64
|
+
[
|
|
65
|
+
_ctx.cell.treeExpandable ? (_openBlock(), _createElementBlock(
|
|
66
|
+
"button",
|
|
67
|
+
{
|
|
68
|
+
key: 0,
|
|
69
|
+
type: "button",
|
|
70
|
+
tabindex: "-1",
|
|
71
|
+
class: _normalizeClass(_ctx.classes(_ctx.n("tree-trigger"), [_ctx.cell.treeExpanded, _ctx.n("tree-trigger--expanded")])),
|
|
72
|
+
onClick: _cache[3] || (_cache[3] = ($event) => _ctx.toggleTreeRowExpanded(_ctx.bodyRow))
|
|
73
|
+
},
|
|
74
|
+
[
|
|
75
|
+
_createVNode(_component_var_icon, {
|
|
76
|
+
"var-data-table-cover": "",
|
|
77
|
+
name: _ctx.cell.treeExpanded ? "chevron-down" : "chevron-right"
|
|
78
|
+
}, null, 8, ["name"])
|
|
79
|
+
],
|
|
80
|
+
2
|
|
81
|
+
/* CLASS */
|
|
82
|
+
)) : (_openBlock(), _createElementBlock(
|
|
83
|
+
"span",
|
|
84
|
+
{
|
|
85
|
+
key: 1,
|
|
86
|
+
class: _normalizeClass(_ctx.n("tree-indent"))
|
|
87
|
+
},
|
|
88
|
+
null,
|
|
89
|
+
2
|
|
90
|
+
/* CLASS */
|
|
91
|
+
)),
|
|
92
|
+
_createVNode(_component_maybe_v_node, {
|
|
93
|
+
is: _ctx.renderCell(_ctx.bodyRow, _ctx.cell.column),
|
|
94
|
+
tag: "div"
|
|
95
|
+
}, null, 8, ["is"])
|
|
96
|
+
],
|
|
97
|
+
6
|
|
98
|
+
/* CLASS, STYLE */
|
|
99
|
+
)) : (_openBlock(), _createBlock(_component_maybe_v_node, {
|
|
100
|
+
key: 4,
|
|
101
|
+
is: _ctx.renderCell(_ctx.bodyRow, _ctx.cell.column),
|
|
102
|
+
tag: "div"
|
|
103
|
+
}, null, 8, ["is"]))
|
|
104
|
+
], 16, _hoisted_1);
|
|
105
|
+
}
|
|
106
|
+
const __sfc__ = defineComponent({
|
|
107
|
+
name: "DataTableBodyCell",
|
|
108
|
+
components: {
|
|
109
|
+
MaybeVNode,
|
|
110
|
+
VarCheckbox,
|
|
111
|
+
VarIcon,
|
|
112
|
+
VarRadio
|
|
113
|
+
},
|
|
114
|
+
props: {
|
|
115
|
+
bodyRow: {
|
|
116
|
+
type: Object,
|
|
117
|
+
required: true
|
|
118
|
+
},
|
|
119
|
+
cell: {
|
|
120
|
+
type: Object,
|
|
121
|
+
required: true
|
|
122
|
+
},
|
|
123
|
+
style: {
|
|
124
|
+
type: Object,
|
|
125
|
+
required: true
|
|
126
|
+
},
|
|
127
|
+
tree: {
|
|
128
|
+
type: Boolean,
|
|
129
|
+
required: true
|
|
130
|
+
},
|
|
131
|
+
isSelectionColumn: {
|
|
132
|
+
type: Function,
|
|
133
|
+
required: true
|
|
134
|
+
},
|
|
135
|
+
isExpandColumn: {
|
|
136
|
+
type: Function,
|
|
137
|
+
required: true
|
|
138
|
+
},
|
|
139
|
+
isMultipleSelectionColumn: {
|
|
140
|
+
type: Function,
|
|
141
|
+
required: true
|
|
142
|
+
},
|
|
143
|
+
isSelectionColumnSelectable: {
|
|
144
|
+
type: Function,
|
|
145
|
+
required: true
|
|
146
|
+
},
|
|
147
|
+
isRowSelectable: {
|
|
148
|
+
type: Function,
|
|
149
|
+
required: true
|
|
150
|
+
},
|
|
151
|
+
isRowKeySelected: {
|
|
152
|
+
type: Function,
|
|
153
|
+
required: true
|
|
154
|
+
},
|
|
155
|
+
isRowKeyIndeterminate: {
|
|
156
|
+
type: Function,
|
|
157
|
+
required: true
|
|
158
|
+
},
|
|
159
|
+
isRowExpandable: {
|
|
160
|
+
type: Function,
|
|
161
|
+
required: true
|
|
162
|
+
},
|
|
163
|
+
shouldRenderLeftFixedShadow: {
|
|
164
|
+
type: Function,
|
|
165
|
+
required: true
|
|
166
|
+
},
|
|
167
|
+
shouldRenderRightFixedShadow: {
|
|
168
|
+
type: Function,
|
|
169
|
+
required: true
|
|
170
|
+
},
|
|
171
|
+
toggleRowSelection: {
|
|
172
|
+
type: Function,
|
|
173
|
+
required: true
|
|
174
|
+
},
|
|
175
|
+
toggleRowExpanded: {
|
|
176
|
+
type: Function,
|
|
177
|
+
required: true
|
|
178
|
+
},
|
|
179
|
+
toggleTreeRowExpanded: {
|
|
180
|
+
type: Function,
|
|
181
|
+
required: true
|
|
182
|
+
},
|
|
183
|
+
renderCell: {
|
|
184
|
+
type: Function,
|
|
185
|
+
required: true
|
|
186
|
+
},
|
|
187
|
+
getCellProps: {
|
|
188
|
+
type: Function,
|
|
189
|
+
required: true
|
|
190
|
+
}
|
|
191
|
+
},
|
|
192
|
+
setup(props) {
|
|
193
|
+
const treeStyle = computed(() => {
|
|
194
|
+
var _a;
|
|
195
|
+
return {
|
|
196
|
+
paddingInlineStart: `${((_a = props.cell.treeLevel) != null ? _a : 0) * 20}px`
|
|
197
|
+
};
|
|
198
|
+
});
|
|
199
|
+
return {
|
|
200
|
+
n,
|
|
201
|
+
classes,
|
|
202
|
+
treeStyle
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
});
|
|
206
|
+
__sfc__.render = __render__;
|
|
207
|
+
var stdin_default = __sfc__;
|
|
208
|
+
export {
|
|
209
|
+
stdin_default as default
|
|
210
|
+
};
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
import { callOrReturn } from "@varlet/shared";
|
|
2
|
+
import { computed, defineComponent } from "vue";
|
|
3
|
+
import VarCheckbox from "../checkbox/index.mjs";
|
|
4
|
+
import VarIcon from "../icon/index.mjs";
|
|
5
|
+
import { createNamespace, MaybeVNode } from "../utils/components.mjs";
|
|
6
|
+
const { n, classes } = createNamespace("data-table");
|
|
7
|
+
import { resolveComponent as _resolveComponent, openBlock as _openBlock, createBlock as _createBlock, createCommentVNode as _createCommentVNode, createVNode as _createVNode, normalizeClass as _normalizeClass, createElementVNode as _createElementVNode, normalizeStyle as _normalizeStyle, createElementBlock as _createElementBlock, withModifiers as _withModifiers } from "vue";
|
|
8
|
+
const _hoisted_1 = ["colspan", "rowspan"];
|
|
9
|
+
function __render__(_ctx, _cache) {
|
|
10
|
+
const _component_var_checkbox = _resolveComponent("var-checkbox");
|
|
11
|
+
const _component_maybe_v_node = _resolveComponent("maybe-v-node");
|
|
12
|
+
const _component_var_icon = _resolveComponent("var-icon");
|
|
13
|
+
return _openBlock(), _createElementBlock("th", {
|
|
14
|
+
class: _normalizeClass(
|
|
15
|
+
_ctx.classes(
|
|
16
|
+
_ctx.n("cell"),
|
|
17
|
+
_ctx.n("header-cell"),
|
|
18
|
+
[_ctx.isSelectionColumn(_ctx.headerCell.column), _ctx.n("selection-cell")],
|
|
19
|
+
[_ctx.isExpandColumn(_ctx.headerCell.column), _ctx.n("expand-cell")],
|
|
20
|
+
[_ctx.headerCell.fixed, _ctx.n("fixed-cell")],
|
|
21
|
+
[_ctx.shouldRenderLeftFixedShadow(_ctx.headerCell.endLeafColumnIndex), _ctx.n("fixed-cell--shadow-right")],
|
|
22
|
+
[_ctx.shouldRenderRightFixedShadow(_ctx.headerCell.startLeafColumnIndex), _ctx.n("fixed-cell--shadow-left")]
|
|
23
|
+
)
|
|
24
|
+
),
|
|
25
|
+
style: _normalizeStyle(_ctx.style),
|
|
26
|
+
colspan: _ctx.headerCell.colSpan,
|
|
27
|
+
rowspan: _ctx.headerCell.rowSpan
|
|
28
|
+
}, [
|
|
29
|
+
_ctx.isSelectionColumn(_ctx.headerCell.column) && _ctx.isMultipleSelectionColumn(_ctx.headerCell.column) ? (_openBlock(), _createBlock(_component_var_checkbox, {
|
|
30
|
+
key: 0,
|
|
31
|
+
"var-data-table-cover": "",
|
|
32
|
+
"model-value": _ctx.allCurrentRowsSelected,
|
|
33
|
+
indeterminate: _ctx.someCurrentRowsSelected,
|
|
34
|
+
disabled: !_ctx.isSelectionColumnSelectable(_ctx.headerCell.column) || !_ctx.hasSelectableRows,
|
|
35
|
+
tabindex: "-1",
|
|
36
|
+
"onUpdate:modelValue": _ctx.toggleCurrentSelectableRows
|
|
37
|
+
}, null, 8, ["model-value", "indeterminate", "disabled", "onUpdate:modelValue"])) : _ctx.isColumnSortable(_ctx.headerCell.column) ? (_openBlock(), _createElementBlock(
|
|
38
|
+
"button",
|
|
39
|
+
{
|
|
40
|
+
key: 1,
|
|
41
|
+
type: "button",
|
|
42
|
+
class: _normalizeClass(
|
|
43
|
+
_ctx.classes(_ctx.n("sort-trigger"), _ctx.n(`sort-trigger--align-${_ctx.headerAlign}`), [
|
|
44
|
+
_ctx.columnSorterOrder,
|
|
45
|
+
_ctx.n("sort-trigger--active")
|
|
46
|
+
])
|
|
47
|
+
),
|
|
48
|
+
style: _normalizeStyle(_ctx.sortTriggerStyle),
|
|
49
|
+
onClick: _cache[0] || (_cache[0] = ($event) => _ctx.toggleColumnSorter(_ctx.headerCell.column.key))
|
|
50
|
+
},
|
|
51
|
+
[
|
|
52
|
+
_createElementVNode(
|
|
53
|
+
"span",
|
|
54
|
+
{
|
|
55
|
+
class: _normalizeClass(_ctx.n("sort-trigger-text"))
|
|
56
|
+
},
|
|
57
|
+
[
|
|
58
|
+
_createVNode(_component_maybe_v_node, {
|
|
59
|
+
is: _ctx.renderHeaderTitle()
|
|
60
|
+
}, null, 8, ["is"])
|
|
61
|
+
],
|
|
62
|
+
2
|
|
63
|
+
/* CLASS */
|
|
64
|
+
),
|
|
65
|
+
_createElementVNode(
|
|
66
|
+
"span",
|
|
67
|
+
{
|
|
68
|
+
class: _normalizeClass(_ctx.n("sort-trigger-icon")),
|
|
69
|
+
"aria-hidden": "true"
|
|
70
|
+
},
|
|
71
|
+
[
|
|
72
|
+
_createVNode(_component_var_icon, {
|
|
73
|
+
name: "chevron-up",
|
|
74
|
+
size: 18,
|
|
75
|
+
"var-data-table-cover": "",
|
|
76
|
+
class: _normalizeClass(_ctx.classes(_ctx.n("sort-trigger-icon-up"), [_ctx.columnSorterOrder === "asc", _ctx.n("sort-trigger-icon--active")]))
|
|
77
|
+
}, null, 8, ["class"]),
|
|
78
|
+
_createVNode(_component_var_icon, {
|
|
79
|
+
name: "chevron-down",
|
|
80
|
+
size: 18,
|
|
81
|
+
"var-data-table-cover": "",
|
|
82
|
+
class: _normalizeClass(_ctx.classes(_ctx.n("sort-trigger-icon-down"), [_ctx.columnSorterOrder === "desc", _ctx.n("sort-trigger-icon--active")]))
|
|
83
|
+
}, null, 8, ["class"])
|
|
84
|
+
],
|
|
85
|
+
2
|
|
86
|
+
/* CLASS */
|
|
87
|
+
)
|
|
88
|
+
],
|
|
89
|
+
6
|
|
90
|
+
/* CLASS, STYLE */
|
|
91
|
+
)) : (_openBlock(), _createBlock(_component_maybe_v_node, {
|
|
92
|
+
key: 2,
|
|
93
|
+
is: _ctx.renderHeaderTitle()
|
|
94
|
+
}, null, 8, ["is"])),
|
|
95
|
+
_ctx.isColumnResizable(_ctx.headerCell.column) && _ctx.headerCell.colSpan == null && !_ctx.isLastHeaderColumn(_ctx.headerCell.startLeafColumnIndex) ? (_openBlock(), _createElementBlock(
|
|
96
|
+
"button",
|
|
97
|
+
{
|
|
98
|
+
key: 3,
|
|
99
|
+
type: "button",
|
|
100
|
+
tabindex: "-1",
|
|
101
|
+
class: _normalizeClass(_ctx.n("resize-trigger")),
|
|
102
|
+
onClick: _cache[1] || (_cache[1] = _withModifiers(() => {
|
|
103
|
+
}, ["stop"])),
|
|
104
|
+
onMousedown: _cache[2] || (_cache[2] = ($event) => _ctx.startColumnResize($event, _ctx.headerCell))
|
|
105
|
+
},
|
|
106
|
+
null,
|
|
107
|
+
34
|
|
108
|
+
/* CLASS, NEED_HYDRATION */
|
|
109
|
+
)) : _createCommentVNode("v-if", true)
|
|
110
|
+
], 14, _hoisted_1);
|
|
111
|
+
}
|
|
112
|
+
const __sfc__ = defineComponent({
|
|
113
|
+
name: "DataTableHeaderCell",
|
|
114
|
+
components: {
|
|
115
|
+
MaybeVNode,
|
|
116
|
+
VarCheckbox,
|
|
117
|
+
VarIcon
|
|
118
|
+
},
|
|
119
|
+
props: {
|
|
120
|
+
headerCell: {
|
|
121
|
+
type: Object,
|
|
122
|
+
required: true
|
|
123
|
+
},
|
|
124
|
+
style: {
|
|
125
|
+
type: Object,
|
|
126
|
+
required: true
|
|
127
|
+
},
|
|
128
|
+
allCurrentRowsSelected: {
|
|
129
|
+
type: Boolean,
|
|
130
|
+
required: true
|
|
131
|
+
},
|
|
132
|
+
someCurrentRowsSelected: {
|
|
133
|
+
type: Boolean,
|
|
134
|
+
required: true
|
|
135
|
+
},
|
|
136
|
+
hasSelectableRows: {
|
|
137
|
+
type: Boolean,
|
|
138
|
+
required: true
|
|
139
|
+
},
|
|
140
|
+
isSelectionColumn: {
|
|
141
|
+
type: Function,
|
|
142
|
+
required: true
|
|
143
|
+
},
|
|
144
|
+
isExpandColumn: {
|
|
145
|
+
type: Function,
|
|
146
|
+
required: true
|
|
147
|
+
},
|
|
148
|
+
isMultipleSelectionColumn: {
|
|
149
|
+
type: Function,
|
|
150
|
+
required: true
|
|
151
|
+
},
|
|
152
|
+
isSelectionColumnSelectable: {
|
|
153
|
+
type: Function,
|
|
154
|
+
required: true
|
|
155
|
+
},
|
|
156
|
+
isColumnSortable: {
|
|
157
|
+
type: Function,
|
|
158
|
+
required: true
|
|
159
|
+
},
|
|
160
|
+
getColumnSorterOrder: {
|
|
161
|
+
type: Function,
|
|
162
|
+
required: true
|
|
163
|
+
},
|
|
164
|
+
toggleColumnSorter: {
|
|
165
|
+
type: Function,
|
|
166
|
+
required: true
|
|
167
|
+
},
|
|
168
|
+
isColumnResizable: {
|
|
169
|
+
type: Function,
|
|
170
|
+
required: true
|
|
171
|
+
},
|
|
172
|
+
isLastHeaderColumn: {
|
|
173
|
+
type: Function,
|
|
174
|
+
required: true
|
|
175
|
+
},
|
|
176
|
+
shouldRenderLeftFixedShadow: {
|
|
177
|
+
type: Function,
|
|
178
|
+
required: true
|
|
179
|
+
},
|
|
180
|
+
shouldRenderRightFixedShadow: {
|
|
181
|
+
type: Function,
|
|
182
|
+
required: true
|
|
183
|
+
},
|
|
184
|
+
toggleCurrentSelectableRows: {
|
|
185
|
+
type: Function,
|
|
186
|
+
required: true
|
|
187
|
+
},
|
|
188
|
+
startColumnResize: {
|
|
189
|
+
type: Function,
|
|
190
|
+
required: true
|
|
191
|
+
}
|
|
192
|
+
},
|
|
193
|
+
setup(props) {
|
|
194
|
+
const columnSorterOrder = computed(() => {
|
|
195
|
+
if (!props.isColumnSortable(props.headerCell.column)) {
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
return props.getColumnSorterOrder(props.headerCell.column.key);
|
|
199
|
+
});
|
|
200
|
+
const headerAlign = computed(() => {
|
|
201
|
+
var _a, _b;
|
|
202
|
+
return (_b = (_a = props.headerCell.column.titleAlign) != null ? _a : props.headerCell.column.align) != null ? _b : "left";
|
|
203
|
+
});
|
|
204
|
+
const sortTriggerStyle = computed(() => {
|
|
205
|
+
if (props.headerCell.colSpan != null && props.headerCell.colSpan > 1) {
|
|
206
|
+
return {};
|
|
207
|
+
}
|
|
208
|
+
return {
|
|
209
|
+
position: "absolute",
|
|
210
|
+
top: 0,
|
|
211
|
+
right: 0,
|
|
212
|
+
bottom: 0,
|
|
213
|
+
left: 0
|
|
214
|
+
};
|
|
215
|
+
});
|
|
216
|
+
function renderHeaderTitle() {
|
|
217
|
+
const { column } = props.headerCell;
|
|
218
|
+
if (props.isSelectionColumn(column) || props.isExpandColumn(column)) {
|
|
219
|
+
return "";
|
|
220
|
+
}
|
|
221
|
+
return callOrReturn(column.title);
|
|
222
|
+
}
|
|
223
|
+
return {
|
|
224
|
+
n,
|
|
225
|
+
classes,
|
|
226
|
+
columnSorterOrder,
|
|
227
|
+
renderHeaderTitle,
|
|
228
|
+
headerAlign,
|
|
229
|
+
sortTriggerStyle
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
});
|
|
233
|
+
__sfc__.render = __render__;
|
|
234
|
+
var stdin_default = __sfc__;
|
|
235
|
+
export {
|
|
236
|
+
stdin_default as default
|
|
237
|
+
};
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
:root { --data-table-background: #fff; --data-table-surface-low-background: var(--color-surface-container-highest); --data-table-header-cell-background: #fff; --data-table-header-cell-text-color: rgba(0, 0, 0, 0.6); --data-table-body-cell-text-color: #555; --data-table-border-color: var(--color-outline); --data-table-row-hover-background: #f5f5f5; --data-table-surface-low-row-hover-background: var(--color-surface-container-highest); --data-table-plain-row-hover-background: hsla(var(--hsl-on-surface), 0.04); --data-table-sort-trigger-color: hsla(var(--hsl-on-surface), 0.42); --data-table-sort-trigger-active-color: var(--color-primary); --data-table-sort-trigger-hover-background: hsla(var(--hsl-primary), 0.08); --data-table-empty-text-color: var(--color-text-disabled); --data-table-resize-trigger-color: hsla(var(--hsl-on-surface-variant), 0.36); --data-table-fixed-shadow-color: rgba(0, 0, 0, 0.04); --data-table-border-radius: 2px; --data-table-cell-padding: 8px 16px; --data-table-selection-cell-padding: 8px 8px; --data-table-expand-cell-padding: 8px 8px; --data-table-cell-font-size: 14px; --data-table-header-font-size: 14px; --data-table-header-font-weight: 500; --data-table-row-height: 46px; --data-table-row-small-height: 40px; --data-table-row-large-height: 52px; --data-table-footer-padding: 12px 16px; --data-table-empty-padding: 48px 16px;}.var-data-table { --scrollbar-track-background: var(--data-table-background); width: 100%; border-radius: var(--data-table-border-radius); background: var(--data-table-background);}.var-data-table * { box-sizing: border-box;}.var-data-table__container { position: relative; width: 100%; max-width: 100%;}.var-data-table__table { min-width: 100%; border-spacing: 0; border-collapse: collapse; line-height: normal; table-layout: fixed;}.var-data-table__header-row { background: var(--data-table-header-cell-background);}.var-data-table__row { background: var(--data-table-background); border-bottom: 1px solid var(--data-table-border-color); transition: background-color 0.25s;}.var-data-table__row:hover { background: var(--data-table-row-hover-background);}.var-data-table__row:last-child { border-bottom: 0;}.var-data-table--surface-low { --data-table-background: var(--data-table-surface-low-background); --data-table-header-cell-background: var(--data-table-surface-low-background); --data-table-row-hover-background: var(--data-table-surface-low-row-hover-background);}.var-data-table--plain { --data-table-background: transparent; --data-table-header-cell-background: transparent; --data-table-row-hover-background: var(--data-table-plain-row-hover-background); border-radius: 0;}.var-data-table__cell { height: var(--data-table-row-height); padding: var(--data-table-cell-padding); font-size: var(--data-table-cell-font-size); vertical-align: middle;}.var-data-table--cell-bordered .var-data-table__cell:not(:last-child) { border-right: 1px solid var(--data-table-border-color);}.var-data-table__header-cell { color: var(--data-table-header-cell-text-color); font-size: var(--data-table-header-font-size); font-weight: var(--data-table-header-font-weight); background: var(--data-table-header-cell-background); box-shadow: inset 0 -1px 0 var(--data-table-border-color); position: sticky; top: 0;}.var-data-table__sort-trigger { display: flex; align-items: center; width: auto; height: auto; padding: var(--data-table-cell-padding); border: 0; border-radius: 0; background: transparent; color: var(--data-table-sort-trigger-color); cursor: pointer; text-align: inherit; transition: color 0.2s ease, background-color 0.2s ease;}.var-data-table__sort-trigger:hover,.var-data-table__sort-trigger:focus-visible { background: var(--data-table-sort-trigger-hover-background);}.var-data-table__sort-trigger:focus-visible { outline: none;}.var-data-table__sort-trigger--align-left { justify-content: flex-start;}.var-data-table__sort-trigger--align-center { justify-content: center;}.var-data-table__sort-trigger--align-right { justify-content: flex-end;}.var-data-table__sort-trigger--active { color: var(--data-table-sort-trigger-active-color);}.var-data-table__sort-trigger-text { display: inline-flex; align-items: center; min-width: 0;}.var-data-table__sort-trigger-icon { display: inline-flex; flex-direction: column; justify-content: center; gap: 0; margin-inline-start: 8px; vertical-align: middle; color: inherit; opacity: 0.72;}.var-data-table__sort-trigger-icon-up[var-data-table-cover],.var-data-table__sort-trigger-icon-down[var-data-table-cover] { display: block; line-height: 1; opacity: 0.45; transition: opacity 0.2s ease;}.var-data-table__sort-trigger-icon-up[var-data-table-cover] { margin-bottom: -5px;}.var-data-table__sort-trigger-icon-down[var-data-table-cover] { margin-top: -5px;}.var-data-table__sort-trigger-icon--active[var-data-table-cover] { opacity: 1;}.var-data-table__resize-trigger { position: absolute; top: 0; right: -5px; z-index: 1; width: 10px; height: 100%; padding: 0; border: 0; background: transparent; cursor: col-resize; touch-action: none;}.var-data-table__resize-trigger::before { content: ''; position: absolute; top: 10px; left: 50%; bottom: 10px; width: 2px; transform: translateX(-50%); background: var(--data-table-resize-trigger-color);}.var-data-table__body-cell { color: var(--data-table-body-cell-text-color); background: inherit; background-clip: padding-box;}.var-data-table__summary-row { background: var(--data-table-background); border-top: 1px solid var(--data-table-border-color);}.var-data-table__summary-cell { color: var(--data-table-body-cell-text-color); background: inherit; background-clip: padding-box; font-weight: 500;}.var-data-table__fixed-cell { background: inherit; background-clip: padding-box;}.var-data-table__fixed-cell--shadow-right::after { content: ''; position: absolute; top: 0; right: -14px; bottom: 0; width: 14px; pointer-events: none; background: linear-gradient(to right, var(--data-table-fixed-shadow-color), transparent);}.var-data-table__fixed-cell--shadow-left::before { content: ''; position: absolute; top: 0; left: -14px; bottom: 0; width: 14px; pointer-events: none; background: linear-gradient(to left, var(--data-table-fixed-shadow-color), transparent);}.var-data-table__selection-cell,.var-data-table__expand-cell { text-align: center; min-width: 52px;}.var-data-table__selection-cell { padding: var(--data-table-selection-cell-padding);}.var-data-table__expand-cell { padding: var(--data-table-expand-cell-padding);}.var-data-table__selection-cell .var-checkbox[var-data-table-cover],.var-data-table__selection-cell .var-radio[var-data-table-cover] { transform: none;}.var-data-table__selection-cell .var-checkbox[var-data-table-cover] .var-checkbox__wrap,.var-data-table__selection-cell .var-radio[var-data-table-cover] .var-radio__wrap { display: flex; align-items: center; justify-content: center; width: 100%;}.var-data-table__expand-trigger { display: inline-flex; align-items: center; justify-content: center; width: 100%; padding: 0; border: 0; background: transparent; color: inherit; cursor: pointer;}.var-data-table__expand-trigger:disabled { opacity: 0.4; cursor: not-allowed;}.var-data-table__tree-cell { display: flex; align-items: center; min-width: 0;}.var-data-table__tree-trigger,.var-data-table__tree-indent { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; flex: none; margin-right: 4px;}.var-data-table__tree-trigger { padding: 0; border: 0; background: transparent; color: inherit; cursor: pointer;}.var-data-table__expanded-row { background: var(--data-table-background); border-bottom: 1px solid var(--data-table-border-color);}.var-data-table__expanded-cell { padding-top: 12px; padding-bottom: 12px;}.var-data-table__empty { display: flex; align-items: center; justify-content: center; width: 100%; color: var(--data-table-empty-text-color); padding: var(--data-table-empty-padding);}.var-data-table__footer { display: flex; align-items: center; justify-content: space-between; padding: var(--data-table-footer-padding); border-top: 1px solid var(--data-table-border-color); background: var(--data-table-background); overflow: auto;}.var-data-table__footer .var-pagination[var-data-table-cover] { margin-left: auto;}.var-data-table--small .var-data-table__cell { height: var(--data-table-row-small-height);}.var-data-table--large .var-data-table__cell { height: var(--data-table-row-large-height);}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { withInstall, withPropsDefaultsSetter } from "../utils/components.mjs";
|
|
2
|
+
import DataTable from "./DataTable.mjs";
|
|
3
|
+
import { props as dataTableProps } from "./props.mjs";
|
|
4
|
+
withInstall(DataTable);
|
|
5
|
+
withPropsDefaultsSetter(DataTable, dataTableProps);
|
|
6
|
+
const _DataTableComponent = DataTable;
|
|
7
|
+
var stdin_default = DataTable;
|
|
8
|
+
export {
|
|
9
|
+
_DataTableComponent,
|
|
10
|
+
dataTableProps,
|
|
11
|
+
stdin_default as default
|
|
12
|
+
};
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { defineListenerProp } from "../utils/components.mjs";
|
|
2
|
+
const props = {
|
|
3
|
+
data: {
|
|
4
|
+
type: Array,
|
|
5
|
+
default: () => []
|
|
6
|
+
},
|
|
7
|
+
columns: {
|
|
8
|
+
type: Array,
|
|
9
|
+
default: () => []
|
|
10
|
+
},
|
|
11
|
+
rowKey: {
|
|
12
|
+
type: [String, Number, Function],
|
|
13
|
+
default: "id"
|
|
14
|
+
},
|
|
15
|
+
rowProps: {
|
|
16
|
+
type: [Object, Function]
|
|
17
|
+
},
|
|
18
|
+
rowClass: {
|
|
19
|
+
type: [String, Array, Object, Function]
|
|
20
|
+
},
|
|
21
|
+
summary: {
|
|
22
|
+
type: Function
|
|
23
|
+
},
|
|
24
|
+
loading: Boolean,
|
|
25
|
+
pagination: {
|
|
26
|
+
type: [Boolean, Object],
|
|
27
|
+
default: true
|
|
28
|
+
},
|
|
29
|
+
remote: Boolean,
|
|
30
|
+
page: {
|
|
31
|
+
type: Number,
|
|
32
|
+
default: 1
|
|
33
|
+
},
|
|
34
|
+
pageSize: {
|
|
35
|
+
type: Number,
|
|
36
|
+
default: 10
|
|
37
|
+
},
|
|
38
|
+
total: Number,
|
|
39
|
+
maxHeight: [Number, String],
|
|
40
|
+
scrollX: [Number, String],
|
|
41
|
+
sorters: {
|
|
42
|
+
type: Array,
|
|
43
|
+
default: () => []
|
|
44
|
+
},
|
|
45
|
+
sortMode: {
|
|
46
|
+
type: String,
|
|
47
|
+
default: "single"
|
|
48
|
+
},
|
|
49
|
+
tree: Boolean,
|
|
50
|
+
surface: String,
|
|
51
|
+
cascade: {
|
|
52
|
+
type: Boolean,
|
|
53
|
+
default: true
|
|
54
|
+
},
|
|
55
|
+
childrenKey: {
|
|
56
|
+
type: String,
|
|
57
|
+
default: "children"
|
|
58
|
+
},
|
|
59
|
+
plain: Boolean,
|
|
60
|
+
checkedRowKeys: {
|
|
61
|
+
type: Array,
|
|
62
|
+
default: () => []
|
|
63
|
+
},
|
|
64
|
+
expandedRowKeys: {
|
|
65
|
+
type: Array,
|
|
66
|
+
default: () => []
|
|
67
|
+
},
|
|
68
|
+
expandedTreeRowKeys: {
|
|
69
|
+
type: Array,
|
|
70
|
+
default: () => []
|
|
71
|
+
},
|
|
72
|
+
elevation: {
|
|
73
|
+
type: [Boolean, Number, String],
|
|
74
|
+
default: true
|
|
75
|
+
},
|
|
76
|
+
cellBordered: Boolean,
|
|
77
|
+
tableLayout: {
|
|
78
|
+
type: String,
|
|
79
|
+
default: "auto"
|
|
80
|
+
},
|
|
81
|
+
size: {
|
|
82
|
+
type: String,
|
|
83
|
+
default: "normal"
|
|
84
|
+
},
|
|
85
|
+
"onUpdate:checkedRowKeys": defineListenerProp(),
|
|
86
|
+
"onUpdate:expandedRowKeys": defineListenerProp(),
|
|
87
|
+
"onUpdate:expandedTreeRowKeys": defineListenerProp(),
|
|
88
|
+
"onUpdate:page": defineListenerProp(),
|
|
89
|
+
"onUpdate:pageSize": defineListenerProp(),
|
|
90
|
+
"onUpdate:sorters": defineListenerProp()
|
|
91
|
+
};
|
|
92
|
+
export {
|
|
93
|
+
props
|
|
94
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { callOrReturn, clamp, floor, times } from "@varlet/shared";
|
|
2
|
+
function createCellSpanMatrix(rowCount, columnCount) {
|
|
3
|
+
const rawMatrix = times(rowCount, () => Array(columnCount).fill(false));
|
|
4
|
+
return {
|
|
5
|
+
rawMatrix,
|
|
6
|
+
isCovered: (rowIndex, columnIndex) => rawMatrix[rowIndex][columnIndex],
|
|
7
|
+
cover: (rowIndex, columnIndex, rowSpan, colSpan) => {
|
|
8
|
+
times(rowSpan, (rowOffset) => {
|
|
9
|
+
times(colSpan, (columnOffset) => {
|
|
10
|
+
if (rowOffset === 0 && columnOffset === 0) {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
rawMatrix[rowIndex + rowOffset][columnIndex + columnOffset] = true;
|
|
14
|
+
});
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
function resolveSpan(span, maxSpan, context) {
|
|
20
|
+
const resolvedSpan = span == null ? 1 : floor(callOrReturn(span, context));
|
|
21
|
+
if (resolvedSpan <= 0) {
|
|
22
|
+
return 0;
|
|
23
|
+
}
|
|
24
|
+
return clamp(resolvedSpan, 1, maxSpan);
|
|
25
|
+
}
|
|
26
|
+
export {
|
|
27
|
+
createCellSpanMatrix,
|
|
28
|
+
resolveSpan
|
|
29
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import '../../styles/common.css'
|
|
2
|
+
import '../../styles/elevation.css'
|
|
3
|
+
import '../../ripple/ripple.css'
|
|
4
|
+
import '../../form-details/formDetails.css'
|
|
5
|
+
import '../../icon/icon.css'
|
|
6
|
+
import '../../hover-overlay/hoverOverlay.css'
|
|
7
|
+
import '../../checkbox/checkbox.css'
|
|
8
|
+
import '../../loading/loading.css'
|
|
9
|
+
import '../../menu/menu.css'
|
|
10
|
+
import '../../menu-select/menuSelect.css'
|
|
11
|
+
import '../../menu-option/menuOption.css'
|
|
12
|
+
import '../../radio/radio.css'
|
|
13
|
+
import '../../field-decorator/fieldDecorator.css'
|
|
14
|
+
import '../../input/input.css'
|
|
15
|
+
import '../../pagination/pagination.css'
|
|
16
|
+
import '../dataTable.css'
|
|
17
|
+
import '../DataTableSfc.css'
|