@expcat/tigercat-vue 1.2.37 → 1.2.41
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/{chunk-MD7S2A55.js → chunk-5TJI4HOT.js} +2 -2
- package/dist/{chunk-FKCZSBM6.js → chunk-7IVLFDZI.js} +17 -3
- package/dist/{chunk-W54LFA7A.mjs → chunk-CHDKJDZQ.mjs} +306 -94
- package/dist/{chunk-2HT6YGRY.js → chunk-EWQJGR7E.js} +185 -18
- package/dist/{chunk-U2PPTMQX.mjs → chunk-FI2EIJIF.mjs} +1 -1
- package/dist/{chunk-HSMN5FWL.js → chunk-GD2WAN62.js} +2 -2
- package/dist/{chunk-ILTIUESE.mjs → chunk-GFQDHFAX.mjs} +178 -11
- package/dist/{chunk-3EVCDIZE.js → chunk-KGDRA475.js} +2 -2
- package/dist/{chunk-WT3LV7OQ.mjs → chunk-KJ6VISRW.mjs} +1 -1
- package/dist/{chunk-6DYGPOYH.js → chunk-LUAI6VXV.js} +2 -2
- package/dist/{chunk-UJZPEXF5.mjs → chunk-M4EP4OVR.mjs} +19 -4
- package/dist/{chunk-RRI3F52B.js → chunk-OFTAQ2A4.js} +305 -93
- package/dist/{chunk-PC2FNA4J.mjs → chunk-PT4Q7C2A.mjs} +1 -1
- package/dist/{chunk-S3KTGULC.js → chunk-QOMWROWE.js} +22 -7
- package/dist/{chunk-FATIMV7O.mjs → chunk-ROMVD7LS.mjs} +1 -1
- package/dist/{chunk-NYH6GSP7.mjs → chunk-VKW2O36D.mjs} +17 -3
- package/dist/components/ActivityFeed.d.mts +6 -6
- package/dist/components/ActivityFeed.d.ts +6 -6
- package/dist/components/Alert.d.mts +3 -3
- package/dist/components/Alert.d.ts +3 -3
- package/dist/components/Anchor.d.mts +1 -1
- package/dist/components/Anchor.d.ts +1 -1
- package/dist/components/AreaChart.d.mts +2 -2
- package/dist/components/AreaChart.d.ts +2 -2
- package/dist/components/AutoComplete.d.mts +2 -2
- package/dist/components/AutoComplete.d.ts +2 -2
- package/dist/components/Avatar.d.mts +1 -1
- package/dist/components/Avatar.d.ts +1 -1
- package/dist/components/Badge.d.mts +3 -3
- package/dist/components/Badge.d.ts +3 -3
- package/dist/components/BarChart.d.mts +1 -1
- package/dist/components/BarChart.d.ts +1 -1
- package/dist/components/Breadcrumb.d.mts +2 -2
- package/dist/components/Breadcrumb.d.ts +2 -2
- package/dist/components/Button.d.mts +3 -3
- package/dist/components/Button.d.ts +3 -3
- package/dist/components/ButtonGroup.d.mts +1 -1
- package/dist/components/ButtonGroup.d.ts +1 -1
- package/dist/components/Calendar.d.mts +1 -1
- package/dist/components/Calendar.d.ts +1 -1
- package/dist/components/Card.d.mts +2 -2
- package/dist/components/Card.d.ts +2 -2
- package/dist/components/ChartGrid.d.mts +1 -1
- package/dist/components/ChartGrid.d.ts +1 -1
- package/dist/components/ChatWindow.d.mts +3 -3
- package/dist/components/ChatWindow.d.ts +3 -3
- package/dist/components/ChatWindow.js +3 -3
- package/dist/components/ChatWindow.mjs +2 -2
- package/dist/components/CodeEditor.d.mts +2 -2
- package/dist/components/CodeEditor.d.ts +2 -2
- package/dist/components/Collapse.d.mts +1 -1
- package/dist/components/Collapse.d.ts +1 -1
- package/dist/components/CollapsePanel.d.mts +1 -1
- package/dist/components/CollapsePanel.d.ts +1 -1
- package/dist/components/ColorSwatch.d.mts +1 -1
- package/dist/components/ColorSwatch.d.ts +1 -1
- package/dist/components/CommentThread.d.mts +2 -2
- package/dist/components/CommentThread.d.ts +2 -2
- package/dist/components/ConfigProvider.d.mts +1 -1
- package/dist/components/ConfigProvider.d.ts +1 -1
- package/dist/components/DataTableWithToolbar.d.mts +55 -11
- package/dist/components/DataTableWithToolbar.d.ts +55 -11
- package/dist/components/DataTableWithToolbar.js +11 -3
- package/dist/components/DataTableWithToolbar.mjs +10 -2
- package/dist/components/DatePicker.d.mts +2 -2
- package/dist/components/DatePicker.d.ts +2 -2
- package/dist/components/Descriptions.d.mts +2 -2
- package/dist/components/Descriptions.d.ts +2 -2
- package/dist/components/DonutChart.d.mts +2 -2
- package/dist/components/DonutChart.d.ts +2 -2
- package/dist/components/Drawer.d.mts +5 -5
- package/dist/components/Drawer.d.ts +5 -5
- package/dist/components/Dropdown.d.mts +19 -0
- package/dist/components/Dropdown.d.ts +19 -0
- package/dist/components/Dropdown.js +2 -2
- package/dist/components/Dropdown.mjs +1 -1
- package/dist/components/DropdownItem.js +3 -3
- package/dist/components/DropdownItem.mjs +2 -2
- package/dist/components/DropdownMenu.js +3 -3
- package/dist/components/DropdownMenu.mjs +1 -1
- package/dist/components/Empty.d.mts +1 -1
- package/dist/components/Empty.d.ts +1 -1
- package/dist/components/FileManager.d.mts +1 -1
- package/dist/components/FileManager.d.ts +1 -1
- package/dist/components/FloatButton.d.mts +3 -3
- package/dist/components/FloatButton.d.ts +3 -3
- package/dist/components/Form.d.mts +1 -1
- package/dist/components/Form.d.ts +1 -1
- package/dist/components/FormWizard.d.mts +6 -6
- package/dist/components/FormWizard.d.ts +6 -6
- package/dist/components/FunnelChart.d.mts +1 -1
- package/dist/components/FunnelChart.d.ts +1 -1
- package/dist/components/Gantt.d.mts +1 -1
- package/dist/components/Gantt.d.ts +1 -1
- package/dist/components/GaugeChart.d.mts +1 -1
- package/dist/components/GaugeChart.d.ts +1 -1
- package/dist/components/HeatmapChart.d.mts +2 -2
- package/dist/components/HeatmapChart.d.ts +2 -2
- package/dist/components/Image.d.mts +2 -2
- package/dist/components/Image.d.ts +2 -2
- package/dist/components/ImageAnnotation.d.mts +4 -4
- package/dist/components/ImageAnnotation.d.ts +4 -4
- package/dist/components/InfiniteScroll.d.mts +2 -2
- package/dist/components/InfiniteScroll.d.ts +2 -2
- package/dist/components/Input.d.mts +4 -4
- package/dist/components/Input.d.ts +4 -4
- package/dist/components/InputGroup.d.mts +1 -1
- package/dist/components/InputGroup.d.ts +1 -1
- package/dist/components/InputNumber.d.mts +1 -1
- package/dist/components/InputNumber.d.ts +1 -1
- package/dist/components/Kanban.d.mts +1 -1
- package/dist/components/Kanban.d.ts +1 -1
- package/dist/components/LineChart.d.mts +2 -2
- package/dist/components/LineChart.d.ts +2 -2
- package/dist/components/Link.d.mts +1 -1
- package/dist/components/Link.d.ts +1 -1
- package/dist/components/List.d.mts +6 -6
- package/dist/components/List.d.ts +6 -6
- package/dist/components/Loading.d.mts +5 -5
- package/dist/components/Loading.d.ts +5 -5
- package/dist/components/MarkdownEditor.d.mts +2 -2
- package/dist/components/MarkdownEditor.d.ts +2 -2
- package/dist/components/Mentions.d.mts +2 -2
- package/dist/components/Mentions.d.ts +2 -2
- package/dist/components/Menu.d.mts +5 -5
- package/dist/components/Menu.d.ts +5 -5
- package/dist/components/Modal.d.mts +8 -8
- package/dist/components/Modal.d.ts +8 -8
- package/dist/components/NotificationCenter.d.mts +5 -5
- package/dist/components/NotificationCenter.d.ts +5 -5
- package/dist/components/NumberKeyboard.d.mts +2 -2
- package/dist/components/NumberKeyboard.d.ts +2 -2
- package/dist/components/OrgChart.d.mts +1 -1
- package/dist/components/OrgChart.d.ts +1 -1
- package/dist/components/Pagination.d.mts +5 -5
- package/dist/components/Pagination.d.ts +5 -5
- package/dist/components/PieChart.d.mts +2 -2
- package/dist/components/PieChart.d.ts +2 -2
- package/dist/components/Popconfirm.d.mts +3 -3
- package/dist/components/Popconfirm.d.ts +3 -3
- package/dist/components/Popconfirm.js +3 -3
- package/dist/components/Popconfirm.mjs +2 -2
- package/dist/components/Popover.d.mts +1 -1
- package/dist/components/Popover.d.ts +1 -1
- package/dist/components/Popover.js +3 -3
- package/dist/components/Popover.mjs +2 -2
- package/dist/components/Progress.d.mts +3 -3
- package/dist/components/Progress.d.ts +3 -3
- package/dist/components/QRCode.d.mts +1 -1
- package/dist/components/QRCode.d.ts +1 -1
- package/dist/components/RadarChart.d.mts +2 -2
- package/dist/components/RadarChart.d.ts +2 -2
- package/dist/components/RichTextEditor.d.mts +1 -1
- package/dist/components/RichTextEditor.d.ts +1 -1
- package/dist/components/Row.d.mts +1 -1
- package/dist/components/Row.d.ts +1 -1
- package/dist/components/ScatterChart.d.mts +1 -1
- package/dist/components/ScatterChart.d.ts +1 -1
- package/dist/components/ScrollSpy.d.mts +2 -2
- package/dist/components/ScrollSpy.d.ts +2 -2
- package/dist/components/Select.d.mts +1 -1
- package/dist/components/Select.d.ts +1 -1
- package/dist/components/Signature.d.mts +2 -2
- package/dist/components/Signature.d.ts +2 -2
- package/dist/components/Skeleton.d.mts +1 -1
- package/dist/components/Skeleton.d.ts +1 -1
- package/dist/components/Space.d.mts +2 -2
- package/dist/components/Space.d.ts +2 -2
- package/dist/components/Splitter.d.mts +1 -1
- package/dist/components/Splitter.d.ts +1 -1
- package/dist/components/Spotlight.d.mts +4 -4
- package/dist/components/Spotlight.d.ts +4 -4
- package/dist/components/Steps.d.mts +3 -3
- package/dist/components/Steps.d.ts +3 -3
- package/dist/components/SunburstChart.d.mts +1 -1
- package/dist/components/SunburstChart.d.ts +1 -1
- package/dist/components/Table.d.mts +56 -8
- package/dist/components/Table.d.ts +56 -8
- package/dist/components/Table.js +8 -2
- package/dist/components/Table.mjs +7 -1
- package/dist/components/Tabs.d.mts +2 -2
- package/dist/components/Tabs.d.ts +2 -2
- package/dist/components/Tag.d.mts +1 -1
- package/dist/components/Tag.d.ts +1 -1
- package/dist/components/TaskBoard.d.mts +2 -2
- package/dist/components/TaskBoard.d.ts +2 -2
- package/dist/components/Text.d.mts +3 -3
- package/dist/components/Text.d.ts +3 -3
- package/dist/components/Textarea.d.mts +1 -1
- package/dist/components/Textarea.d.ts +1 -1
- package/dist/components/TimePicker.d.mts +3 -3
- package/dist/components/TimePicker.d.ts +3 -3
- package/dist/components/Timeline.d.mts +3 -3
- package/dist/components/Timeline.d.ts +3 -3
- package/dist/components/Tooltip.d.mts +1 -1
- package/dist/components/Tooltip.d.ts +1 -1
- package/dist/components/Tooltip.js +3 -3
- package/dist/components/Tooltip.mjs +2 -2
- package/dist/components/Tour.d.mts +2 -2
- package/dist/components/Tour.d.ts +2 -2
- package/dist/components/Tree.d.mts +2 -2
- package/dist/components/Tree.d.ts +2 -2
- package/dist/components/TreeMapChart.d.mts +1 -1
- package/dist/components/TreeMapChart.d.ts +1 -1
- package/dist/components/Upload.d.mts +4 -4
- package/dist/components/Upload.d.ts +4 -4
- package/dist/components/VirtualTable.d.mts +2 -2
- package/dist/components/VirtualTable.d.ts +2 -2
- package/dist/components/Watermark.d.mts +1 -1
- package/dist/components/Watermark.d.ts +1 -1
- package/dist/index.js +20 -20
- package/dist/index.mjs +20 -20
- package/package.json +2 -2
- package/dist/{chunk-S45NWVQS.mjs → chunk-6GPX4ONB.mjs} +3 -3
- package/dist/{chunk-VES3OJOP.js → chunk-YS6FW775.js} +2 -2
|
@@ -1,7 +1,19 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
|
+
var _chunkBGMAWKWVjs = require('./chunk-BGMAWKWV.js');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
var _chunk3QV2D54Hjs = require('./chunk-3QV2D54H.js');
|
|
7
|
+
|
|
8
|
+
|
|
3
9
|
var _chunk25EYT2CBjs = require('./chunk-25EYT2CB.js');
|
|
4
10
|
|
|
11
|
+
|
|
12
|
+
var _chunkNOZ65AMOjs = require('./chunk-NOZ65AMO.js');
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
var _chunk2YFXJUBTjs = require('./chunk-2YFXJUBT.js');
|
|
16
|
+
|
|
5
17
|
// src/components/Table.ts
|
|
6
18
|
|
|
7
19
|
|
|
@@ -29,6 +41,9 @@ var _vue = require('vue');
|
|
|
29
41
|
|
|
30
42
|
|
|
31
43
|
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
32
47
|
|
|
33
48
|
|
|
34
49
|
var _tigercatcore = require('@expcat/tigercat-core');
|
|
@@ -48,6 +63,14 @@ var tableProps = {
|
|
|
48
63
|
type: Array,
|
|
49
64
|
default: () => []
|
|
50
65
|
},
|
|
66
|
+
hiddenColumnKeys: {
|
|
67
|
+
type: Array,
|
|
68
|
+
default: void 0
|
|
69
|
+
},
|
|
70
|
+
defaultHiddenColumnKeys: {
|
|
71
|
+
type: Array,
|
|
72
|
+
default: void 0
|
|
73
|
+
},
|
|
51
74
|
sort: {
|
|
52
75
|
type: Object
|
|
53
76
|
},
|
|
@@ -85,9 +108,15 @@ var tableProps = {
|
|
|
85
108
|
type: Boolean,
|
|
86
109
|
default: false
|
|
87
110
|
},
|
|
111
|
+
locale: {
|
|
112
|
+
type: [Object, Function]
|
|
113
|
+
},
|
|
114
|
+
labels: {
|
|
115
|
+
type: Object
|
|
116
|
+
},
|
|
88
117
|
emptyText: {
|
|
89
118
|
type: String,
|
|
90
|
-
default:
|
|
119
|
+
default: void 0
|
|
91
120
|
},
|
|
92
121
|
pagination: {
|
|
93
122
|
type: [Object, Boolean],
|
|
@@ -132,6 +161,12 @@ var tableProps = {
|
|
|
132
161
|
type: String,
|
|
133
162
|
default: "sm"
|
|
134
163
|
},
|
|
164
|
+
cardClassName: {
|
|
165
|
+
type: [String, Function]
|
|
166
|
+
},
|
|
167
|
+
renderCard: {
|
|
168
|
+
type: Function
|
|
169
|
+
},
|
|
135
170
|
// --- v0.6.0 props ---
|
|
136
171
|
virtual: { type: Boolean, default: false },
|
|
137
172
|
autoVirtual: { type: Boolean, default: true },
|
|
@@ -157,6 +192,8 @@ var tableEmits = [
|
|
|
157
192
|
"selection-change",
|
|
158
193
|
"sort-change",
|
|
159
194
|
"filter-change",
|
|
195
|
+
"update:hiddenColumnKeys",
|
|
196
|
+
"hidden-columns-change",
|
|
160
197
|
"page-change",
|
|
161
198
|
"expand-change",
|
|
162
199
|
"cell-change",
|
|
@@ -179,15 +216,20 @@ var tableEmits = [
|
|
|
179
216
|
|
|
180
217
|
|
|
181
218
|
|
|
219
|
+
|
|
182
220
|
function useTableState(props, emit, measuredColumnWidths) {
|
|
183
221
|
const paginationConfig = _vue.computed.call(void 0, () => {
|
|
184
222
|
return props.pagination !== false && typeof props.pagination === "object" ? props.pagination : null;
|
|
185
223
|
});
|
|
186
224
|
const isSortControlled = _vue.computed.call(void 0, () => props.sort !== void 0);
|
|
225
|
+
const isHiddenColumnsControlled = _vue.computed.call(void 0, () => props.hiddenColumnKeys !== void 0);
|
|
187
226
|
const isFiltersControlled = _vue.computed.call(void 0, () => props.filters !== void 0);
|
|
188
227
|
const isSelectionControlled = _vue.computed.call(void 0, () => _optionalChain([props, 'access', _ => _.rowSelection, 'optionalAccess', _2 => _2.selectedRowKeys]) !== void 0);
|
|
189
228
|
const isExpandControlled = _vue.computed.call(void 0, () => _optionalChain([props, 'access', _3 => _3.expandable, 'optionalAccess', _4 => _4.expandedRowKeys]) !== void 0);
|
|
190
229
|
const uncontrolledSortState = _vue.ref.call(void 0, _nullishCoalesce(props.defaultSort, () => ( { key: null, direction: null })));
|
|
230
|
+
const uncontrolledHiddenColumnKeys = _vue.ref.call(void 0,
|
|
231
|
+
_nullishCoalesce(_nullishCoalesce(props.defaultHiddenColumnKeys, () => ( props.hiddenColumnKeys)), () => ( []))
|
|
232
|
+
);
|
|
191
233
|
const uncontrolledFilterState = _vue.ref.call(void 0, _nullishCoalesce(props.defaultFilters, () => ( {})));
|
|
192
234
|
const uncontrolledCurrentPage = _vue.ref.call(void 0,
|
|
193
235
|
_nullishCoalesce(_nullishCoalesce(_optionalChain([paginationConfig, 'access', _5 => _5.value, 'optionalAccess', _6 => _6.defaultCurrent]), () => ( _optionalChain([paginationConfig, 'access', _7 => _7.value, 'optionalAccess', _8 => _8.current]))), () => ( 1))
|
|
@@ -202,6 +244,9 @@ function useTableState(props, emit, measuredColumnWidths) {
|
|
|
202
244
|
_nullishCoalesce(_nullishCoalesce(_optionalChain([props, 'access', _17 => _17.expandable, 'optionalAccess', _18 => _18.defaultExpandedRowKeys]), () => ( _optionalChain([props, 'access', _19 => _19.expandable, 'optionalAccess', _20 => _20.expandedRowKeys]))), () => ( []))
|
|
203
245
|
);
|
|
204
246
|
const sortState = _vue.computed.call(void 0, () => _nullishCoalesce(props.sort, () => ( uncontrolledSortState.value)));
|
|
247
|
+
const hiddenColumnKeys = _vue.computed.call(void 0,
|
|
248
|
+
() => _nullishCoalesce(props.hiddenColumnKeys, () => ( uncontrolledHiddenColumnKeys.value))
|
|
249
|
+
);
|
|
205
250
|
const filterState = _vue.computed.call(void 0, () => _nullishCoalesce(props.filters, () => ( uncontrolledFilterState.value)));
|
|
206
251
|
const currentPage = _vue.computed.call(void 0, () => {
|
|
207
252
|
return _nullishCoalesce(_optionalChain([paginationConfig, 'access', _21 => _21.value, 'optionalAccess', _22 => _22.current]), () => ( uncontrolledCurrentPage.value));
|
|
@@ -231,6 +276,14 @@ function useTableState(props, emit, measuredColumnWidths) {
|
|
|
231
276
|
}
|
|
232
277
|
}
|
|
233
278
|
);
|
|
279
|
+
_vue.watch.call(void 0,
|
|
280
|
+
() => props.hiddenColumnKeys,
|
|
281
|
+
(next) => {
|
|
282
|
+
if (next !== void 0) {
|
|
283
|
+
uncontrolledHiddenColumnKeys.value = next;
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
);
|
|
234
287
|
_vue.watch.call(void 0,
|
|
235
288
|
() => _optionalChain([paginationConfig, 'access', _29 => _29.value, 'optionalAccess', _30 => _30.current]),
|
|
236
289
|
(next) => {
|
|
@@ -265,13 +318,14 @@ function useTableState(props, emit, measuredColumnWidths) {
|
|
|
265
318
|
);
|
|
266
319
|
const fixedOverrides = _vue.ref.call(void 0, {});
|
|
267
320
|
const displayColumns = _vue.computed.call(void 0, () => {
|
|
268
|
-
|
|
321
|
+
const mapped = props.columns.map((column) => {
|
|
269
322
|
const hasOverride = column.key in fixedOverrides.value;
|
|
270
323
|
return {
|
|
271
324
|
...column,
|
|
272
325
|
fixed: hasOverride ? fixedOverrides.value[column.key] : column.fixed
|
|
273
326
|
};
|
|
274
327
|
});
|
|
328
|
+
return _tigercatcore.filterHiddenColumns.call(void 0, mapped, hiddenColumnKeys.value);
|
|
275
329
|
});
|
|
276
330
|
const fixedColumnsInfo = _vue.computed.call(void 0, () => {
|
|
277
331
|
return _tigercatcore.getFixedColumnOffsets.call(void 0, displayColumns.value, measuredColumnWidths.value);
|
|
@@ -283,6 +337,13 @@ function useTableState(props, emit, measuredColumnWidths) {
|
|
|
283
337
|
}
|
|
284
338
|
return map;
|
|
285
339
|
});
|
|
340
|
+
function handleSetHiddenColumns(hiddenKeys) {
|
|
341
|
+
if (!isHiddenColumnsControlled.value) {
|
|
342
|
+
uncontrolledHiddenColumnKeys.value = hiddenKeys;
|
|
343
|
+
}
|
|
344
|
+
emit("update:hiddenColumnKeys", hiddenKeys);
|
|
345
|
+
emit("hidden-columns-change", hiddenKeys);
|
|
346
|
+
}
|
|
286
347
|
function toggleColumnLock(columnKey) {
|
|
287
348
|
const original = _optionalChain([props, 'access', _37 => _37.columns, 'access', _38 => _38.find, 'call', _39 => _39((c) => c.key === columnKey), 'optionalAccess', _40 => _40.fixed]);
|
|
288
349
|
const hasOverride = columnKey in fixedOverrides.value;
|
|
@@ -333,6 +394,20 @@ function useTableState(props, emit, measuredColumnWidths) {
|
|
|
333
394
|
const total = _optionalChain([paginationConfig, 'access', _44 => _44.value, 'optionalAccess', _45 => _45.total]) !== void 0 && paginationConfig.value.total > 0 ? paginationConfig.value.total : processedData.value.length;
|
|
334
395
|
return _tigercatcore.calculatePagination.call(void 0, total, currentPage.value, currentPageSize.value);
|
|
335
396
|
});
|
|
397
|
+
function handleSetSort(nextSortState) {
|
|
398
|
+
if (!isSortControlled.value) {
|
|
399
|
+
uncontrolledSortState.value = nextSortState;
|
|
400
|
+
}
|
|
401
|
+
emit("sort-change", nextSortState);
|
|
402
|
+
emit("change", {
|
|
403
|
+
sort: nextSortState,
|
|
404
|
+
filters: filterState.value,
|
|
405
|
+
pagination: props.pagination !== false ? {
|
|
406
|
+
current: currentPage.value,
|
|
407
|
+
pageSize: currentPageSize.value
|
|
408
|
+
} : null
|
|
409
|
+
});
|
|
410
|
+
}
|
|
336
411
|
function handleSort(columnKey) {
|
|
337
412
|
const column = displayColumns.value.find((col) => col.key === columnKey);
|
|
338
413
|
if (!column || !column.sortable) {
|
|
@@ -346,21 +421,9 @@ function useTableState(props, emit, measuredColumnWidths) {
|
|
|
346
421
|
newDirection = null;
|
|
347
422
|
}
|
|
348
423
|
}
|
|
349
|
-
|
|
424
|
+
handleSetSort({
|
|
350
425
|
key: newDirection ? columnKey : null,
|
|
351
426
|
direction: newDirection
|
|
352
|
-
};
|
|
353
|
-
if (!isSortControlled.value) {
|
|
354
|
-
uncontrolledSortState.value = nextSortState;
|
|
355
|
-
}
|
|
356
|
-
emit("sort-change", nextSortState);
|
|
357
|
-
emit("change", {
|
|
358
|
-
sort: nextSortState,
|
|
359
|
-
filters: filterState.value,
|
|
360
|
-
pagination: props.pagination !== false ? {
|
|
361
|
-
current: currentPage.value,
|
|
362
|
-
pageSize: currentPageSize.value
|
|
363
|
-
} : null
|
|
364
427
|
});
|
|
365
428
|
}
|
|
366
429
|
function handleFilter(columnKey, value) {
|
|
@@ -550,12 +613,15 @@ function useTableState(props, emit, measuredColumnWidths) {
|
|
|
550
613
|
filterState,
|
|
551
614
|
currentPage,
|
|
552
615
|
currentPageSize,
|
|
616
|
+
hiddenColumnKeys,
|
|
553
617
|
selectedRowKeys,
|
|
554
618
|
expandedRowKeys,
|
|
555
619
|
editingCell,
|
|
556
620
|
editingValue,
|
|
557
621
|
virtualScrollTop,
|
|
558
622
|
toggleColumnLock,
|
|
623
|
+
handleSetHiddenColumns,
|
|
624
|
+
handleSetSort,
|
|
559
625
|
handleSort,
|
|
560
626
|
handleFilter,
|
|
561
627
|
handlePageChange,
|
|
@@ -1191,11 +1257,14 @@ var Table = _vue.defineComponent.call(void 0, {
|
|
|
1191
1257
|
const measuredRowHeights = _vue.ref.call(void 0, []);
|
|
1192
1258
|
const ctx = useTableState(props, emit, measuredColumnWidths);
|
|
1193
1259
|
const resolvedPaginationLocale = _vue.ref.call(void 0, );
|
|
1260
|
+
const resolvedTableLocale = _vue.ref.call(void 0, );
|
|
1194
1261
|
let paginationLocaleResolveId = 0;
|
|
1262
|
+
let tableLocaleResolveId = 0;
|
|
1195
1263
|
const paginationLocaleInput = _vue.computed.call(void 0,
|
|
1196
1264
|
() => props.pagination !== false && typeof props.pagination === "object" ? props.pagination.locale : void 0
|
|
1197
1265
|
);
|
|
1198
1266
|
const isPaginationI18nDisabled = _vue.computed.call(void 0, () => paginationLocaleInput.value === false);
|
|
1267
|
+
const tableLocaleInput = _vue.computed.call(void 0, () => props.locale);
|
|
1199
1268
|
_vue.watch.call(void 0,
|
|
1200
1269
|
paginationLocaleInput,
|
|
1201
1270
|
(locale) => {
|
|
@@ -1222,6 +1291,36 @@ var Table = _vue.defineComponent.call(void 0, {
|
|
|
1222
1291
|
const paginationLocale = _vue.computed.call(void 0,
|
|
1223
1292
|
() => isPaginationI18nDisabled.value ? void 0 : _tigercatcore.mergeTigerLocale.call(void 0, config.value.locale, resolvedPaginationLocale.value)
|
|
1224
1293
|
);
|
|
1294
|
+
_vue.watch.call(void 0,
|
|
1295
|
+
tableLocaleInput,
|
|
1296
|
+
(locale) => {
|
|
1297
|
+
const resolveId = ++tableLocaleResolveId;
|
|
1298
|
+
if (!locale) {
|
|
1299
|
+
resolvedTableLocale.value = void 0;
|
|
1300
|
+
return;
|
|
1301
|
+
}
|
|
1302
|
+
const immediateLocale = _tigercatcore.getImmediateTigerLocale.call(void 0, locale);
|
|
1303
|
+
resolvedTableLocale.value = immediateLocale;
|
|
1304
|
+
if (!_tigercatcore.isLazyTigerLocale.call(void 0, locale)) return;
|
|
1305
|
+
_tigercatcore.resolveTigerLocale.call(void 0, locale).then((nextLocale) => {
|
|
1306
|
+
if (resolveId === tableLocaleResolveId) {
|
|
1307
|
+
resolvedTableLocale.value = nextLocale;
|
|
1308
|
+
}
|
|
1309
|
+
}).catch(() => {
|
|
1310
|
+
if (resolveId === tableLocaleResolveId) {
|
|
1311
|
+
resolvedTableLocale.value = immediateLocale;
|
|
1312
|
+
}
|
|
1313
|
+
});
|
|
1314
|
+
},
|
|
1315
|
+
{ immediate: true }
|
|
1316
|
+
);
|
|
1317
|
+
const tableLocale = _vue.computed.call(void 0,
|
|
1318
|
+
() => _tigercatcore.mergeTigerLocale.call(void 0, config.value.locale, resolvedTableLocale.value)
|
|
1319
|
+
);
|
|
1320
|
+
const tableLabels = _vue.computed.call(void 0, () => {
|
|
1321
|
+
const overrides = props.emptyText === void 0 ? props.labels : { ...props.labels, emptyText: props.emptyText };
|
|
1322
|
+
return _tigercatcore.getTableLabels.call(void 0, tableLocale.value, overrides);
|
|
1323
|
+
});
|
|
1225
1324
|
const resizeController = _tigercatcore.createTableResizeObserverController.call(void 0, {
|
|
1226
1325
|
onResize: (snapshot) => {
|
|
1227
1326
|
if (!areNumberRecordsEqual(measuredColumnWidths.value, snapshot.columnWidths)) {
|
|
@@ -1251,10 +1350,14 @@ var Table = _vue.defineComponent.call(void 0, {
|
|
|
1251
1350
|
const wrapperStyle = resolvedProps.maxHeight ? {
|
|
1252
1351
|
maxHeight: typeof resolvedProps.maxHeight === "number" ? `${resolvedProps.maxHeight}px` : resolvedProps.maxHeight
|
|
1253
1352
|
} : void 0;
|
|
1353
|
+
const renderProps = {
|
|
1354
|
+
...resolvedProps,
|
|
1355
|
+
emptyText: tableLabels.value.emptyText
|
|
1356
|
+
};
|
|
1254
1357
|
const tableChildren = [
|
|
1255
|
-
renderTableHeader(ctx,
|
|
1256
|
-
renderTableBody(ctx,
|
|
1257
|
-
renderSummaryRow(ctx,
|
|
1358
|
+
renderTableHeader(ctx, renderProps, slots),
|
|
1359
|
+
renderTableBody(ctx, renderProps, slots),
|
|
1360
|
+
renderSummaryRow(ctx, renderProps)
|
|
1258
1361
|
];
|
|
1259
1362
|
const tableInner = _vue.h.call(void 0,
|
|
1260
1363
|
"table",
|
|
@@ -1282,83 +1385,192 @@ var Table = _vue.defineComponent.call(void 0, {
|
|
|
1282
1385
|
},
|
|
1283
1386
|
[tableInner]
|
|
1284
1387
|
) : tableInner;
|
|
1285
|
-
const cardContent =
|
|
1286
|
-
"
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
])
|
|
1388
|
+
const cardContent = (() => {
|
|
1389
|
+
if (resolvedProps.responsiveMode !== "card") return null;
|
|
1390
|
+
const cardChildren = [];
|
|
1391
|
+
const sortableColumns = ctx.displayColumns.value.filter((column) => column.sortable);
|
|
1392
|
+
if (resolvedProps.rowSelection && resolvedProps.rowSelection.type !== "radio" && resolvedProps.rowSelection.showCheckbox !== false && ctx.paginatedData.value.length > 0) {
|
|
1393
|
+
cardChildren.push(
|
|
1394
|
+
_vue.h.call(void 0,
|
|
1395
|
+
"div",
|
|
1396
|
+
{
|
|
1397
|
+
class: "flex items-center justify-between rounded-[var(--tiger-radius-md,0.5rem)] border border-[var(--tiger-border,#e5e7eb)] bg-[var(--tiger-surface,#ffffff)] px-3 py-2"
|
|
1398
|
+
},
|
|
1399
|
+
[
|
|
1400
|
+
_vue.h.call(void 0,
|
|
1401
|
+
_chunk2YFXJUBTjs.Checkbox,
|
|
1402
|
+
{
|
|
1403
|
+
size: "sm",
|
|
1404
|
+
modelValue: ctx.allSelected.value,
|
|
1405
|
+
indeterminate: ctx.someSelected.value,
|
|
1406
|
+
onChange: (checked) => ctx.handleSelectAll(checked)
|
|
1407
|
+
},
|
|
1408
|
+
{ default: () => tableLabels.value.selectAllText }
|
|
1409
|
+
)
|
|
1410
|
+
]
|
|
1411
|
+
)
|
|
1310
1412
|
);
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1413
|
+
}
|
|
1414
|
+
if (sortableColumns.length > 0) {
|
|
1415
|
+
cardChildren.push(
|
|
1416
|
+
_vue.h.call(void 0, "div", {
|
|
1417
|
+
class: "rounded-[var(--tiger-radius-md,0.5rem)] border border-[var(--tiger-border,#e5e7eb)] bg-[var(--tiger-surface,#ffffff)] px-3 py-2"
|
|
1418
|
+
}, [
|
|
1419
|
+
_vue.h.call(void 0, _chunkBGMAWKWVjs.Select, {
|
|
1420
|
+
size: "sm",
|
|
1421
|
+
modelValue: ctx.sortState.value.key && ctx.sortState.value.direction ? `${ctx.sortState.value.key}:${ctx.sortState.value.direction}` : "",
|
|
1422
|
+
options: [
|
|
1423
|
+
{ label: tableLabels.value.clearSortText, value: "" },
|
|
1424
|
+
...sortableColumns.flatMap((column) => [
|
|
1425
|
+
{
|
|
1426
|
+
label: `${_tigercatcore.formatTableSortByText.call(void 0, tableLabels.value.sortByText, column.title)} \u2191`,
|
|
1427
|
+
value: `${column.key}:asc`
|
|
1428
|
+
},
|
|
1429
|
+
{
|
|
1430
|
+
label: `${_tigercatcore.formatTableSortByText.call(void 0, tableLabels.value.sortByText, column.title)} \u2193`,
|
|
1431
|
+
value: `${column.key}:desc`
|
|
1432
|
+
}
|
|
1433
|
+
])
|
|
1434
|
+
],
|
|
1435
|
+
clearable: false,
|
|
1436
|
+
"onUpdate:modelValue": (value) => {
|
|
1437
|
+
const nextValue = String(_nullishCoalesce(value, () => ( "")));
|
|
1438
|
+
if (!nextValue) {
|
|
1439
|
+
ctx.handleSetSort({ key: null, direction: null });
|
|
1440
|
+
return;
|
|
1441
|
+
}
|
|
1442
|
+
const separatorIndex = nextValue.lastIndexOf(":");
|
|
1443
|
+
const key = nextValue.slice(0, separatorIndex);
|
|
1444
|
+
const direction = nextValue.slice(separatorIndex + 1);
|
|
1445
|
+
ctx.handleSetSort({ key, direction });
|
|
1446
|
+
}
|
|
1321
1447
|
})
|
|
1322
|
-
)
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1448
|
+
])
|
|
1449
|
+
);
|
|
1450
|
+
}
|
|
1451
|
+
if (ctx.paginatedData.value.length === 0) {
|
|
1452
|
+
cardChildren.push(
|
|
1453
|
+
_vue.h.call(void 0, "div", { class: _tigercatcore.tableResponsiveCardClasses }, [
|
|
1454
|
+
_vue.h.call(void 0, _chunkNOZ65AMOjs.Empty, { showImage: false, description: tableLabels.value.emptyText })
|
|
1455
|
+
])
|
|
1456
|
+
);
|
|
1457
|
+
} else {
|
|
1458
|
+
cardChildren.push(
|
|
1459
|
+
...ctx.paginatedData.value.map((record, index) => {
|
|
1460
|
+
const key = ctx.paginatedRowKeys.value[index];
|
|
1461
|
+
const isExpanded = ctx.expandedRowKeySet.value.has(key);
|
|
1462
|
+
const isSelected = ctx.selectedRowKeySet.value.has(key);
|
|
1463
|
+
const isRowExpandable = resolvedProps.expandable ? resolvedProps.expandable.rowExpandable ? resolvedProps.expandable.rowExpandable(record) : true : false;
|
|
1464
|
+
const { titleColumn, bodyColumns } = _tigercatcore.getCardColumns.call(void 0, ctx.displayColumns.value);
|
|
1465
|
+
const renderCardCellContent = (column) => {
|
|
1466
|
+
const dataKey = column.dataKey || column.key;
|
|
1467
|
+
return _nullishCoalesce(_optionalChain([slots, 'access', _86 => _86[`cell-${column.key}`], 'optionalCall', _87 => _87({ record, index })]), () => ( (column.render ? column.render(record, index) : record[dataKey])));
|
|
1468
|
+
};
|
|
1469
|
+
const titleNode = titleColumn ? _vue.h.call(void 0, "div", { class: _tigercatcore.tableResponsiveCardTitleClasses }, [
|
|
1470
|
+
renderCardCellContent(titleColumn)
|
|
1471
|
+
]) : null;
|
|
1472
|
+
const rows = bodyColumns.map(
|
|
1473
|
+
(column) => _vue.h.call(void 0, "div", { key: column.key, class: _tigercatcore.tableResponsiveCardRowClasses }, [
|
|
1474
|
+
_vue.h.call(void 0, "div", { class: _tigercatcore.tableResponsiveCardLabelClasses }, column.title),
|
|
1475
|
+
_vue.h.call(void 0, "div", { class: _tigercatcore.tableResponsiveCardValueClasses }, [
|
|
1476
|
+
renderCardCellContent(column)
|
|
1477
|
+
])
|
|
1478
|
+
])
|
|
1479
|
+
);
|
|
1480
|
+
const controls = [];
|
|
1481
|
+
if (resolvedProps.rowSelection && resolvedProps.rowSelection.showCheckbox !== false) {
|
|
1482
|
+
const checkboxProps = _optionalChain([resolvedProps, 'access', _88 => _88.rowSelection, 'access', _89 => _89.getCheckboxProps, 'optionalCall', _90 => _90(record)]) || {};
|
|
1483
|
+
controls.push(
|
|
1484
|
+
_vue.h.call(void 0,
|
|
1485
|
+
"span",
|
|
1486
|
+
{ onClick: (event) => event.stopPropagation() },
|
|
1487
|
+
[
|
|
1488
|
+
resolvedProps.rowSelection.type === "radio" ? _vue.h.call(void 0, _chunk3QV2D54Hjs.Radio, {
|
|
1489
|
+
value: key,
|
|
1490
|
+
checked: isSelected,
|
|
1491
|
+
disabled: checkboxProps.disabled,
|
|
1492
|
+
"aria-label": _tigercatcore.formatTableSelectRowAriaLabel.call(void 0,
|
|
1493
|
+
tableLabels.value.selectRowAriaLabel,
|
|
1494
|
+
index + 1,
|
|
1495
|
+
_optionalChain([tableLocale, 'access', _91 => _91.value, 'optionalAccess', _92 => _92.locale])
|
|
1496
|
+
),
|
|
1497
|
+
onChange: () => ctx.handleSelectRow(key, true)
|
|
1498
|
+
}) : _vue.h.call(void 0, _chunk2YFXJUBTjs.Checkbox, {
|
|
1499
|
+
size: "sm",
|
|
1500
|
+
modelValue: isSelected,
|
|
1501
|
+
disabled: checkboxProps.disabled,
|
|
1502
|
+
"aria-label": _tigercatcore.formatTableSelectRowAriaLabel.call(void 0,
|
|
1503
|
+
tableLabels.value.selectRowAriaLabel,
|
|
1504
|
+
index + 1,
|
|
1505
|
+
_optionalChain([tableLocale, 'access', _93 => _93.value, 'optionalAccess', _94 => _94.locale])
|
|
1506
|
+
),
|
|
1507
|
+
onChange: (checked) => ctx.handleSelectRow(key, checked)
|
|
1508
|
+
})
|
|
1509
|
+
]
|
|
1510
|
+
)
|
|
1511
|
+
);
|
|
1512
|
+
}
|
|
1513
|
+
if (resolvedProps.expandable && isRowExpandable) {
|
|
1514
|
+
controls.push(
|
|
1515
|
+
_vue.h.call(void 0,
|
|
1516
|
+
"button",
|
|
1517
|
+
{
|
|
1518
|
+
type: "button",
|
|
1519
|
+
class: "text-sm text-[var(--tiger-primary,#2563eb)]",
|
|
1520
|
+
"aria-expanded": isExpanded,
|
|
1521
|
+
onClick: (event) => {
|
|
1522
|
+
event.stopPropagation();
|
|
1523
|
+
ctx.handleToggleExpand(key, record);
|
|
1524
|
+
}
|
|
1525
|
+
},
|
|
1526
|
+
isExpanded ? tableLabels.value.collapseText : tableLabels.value.expandText
|
|
1527
|
+
)
|
|
1528
|
+
);
|
|
1529
|
+
}
|
|
1530
|
+
const expandedContent = resolvedProps.expandable && isExpanded && isRowExpandable ? _nullishCoalesce(_optionalChain([slots, 'access', _95 => _95["expanded-row"], 'optionalCall', _96 => _96({ record, index })]), () => ( _optionalChain([resolvedProps, 'access', _97 => _97.expandable, 'access', _98 => _98.expandedRowRender, 'optionalCall', _99 => _99(record, index)]))) : null;
|
|
1531
|
+
const cardContext = {
|
|
1532
|
+
record,
|
|
1533
|
+
index,
|
|
1534
|
+
columns: ctx.displayColumns.value,
|
|
1535
|
+
selected: isSelected,
|
|
1536
|
+
expanded: isExpanded,
|
|
1537
|
+
toggleExpand: () => ctx.handleToggleExpand(key, record),
|
|
1538
|
+
selectRow: (checked) => ctx.handleSelectRow(key, checked)
|
|
1539
|
+
};
|
|
1540
|
+
const customCard = _nullishCoalesce(_optionalChain([slots, 'access', _100 => _100.card, 'optionalCall', _101 => _101(cardContext)]), () => ( _optionalChain([resolvedProps, 'access', _102 => _102.renderCard, 'optionalCall', _103 => _103(cardContext)])));
|
|
1541
|
+
const resolvedCardClassName = typeof resolvedProps.cardClassName === "function" ? resolvedProps.cardClassName(record, index) : resolvedProps.cardClassName;
|
|
1542
|
+
return _vue.h.call(void 0,
|
|
1543
|
+
"div",
|
|
1328
1544
|
{
|
|
1329
|
-
|
|
1330
|
-
class:
|
|
1331
|
-
|
|
1332
|
-
onClick: (event) => {
|
|
1333
|
-
event.stopPropagation();
|
|
1334
|
-
ctx.handleToggleExpand(key, record);
|
|
1335
|
-
}
|
|
1545
|
+
key,
|
|
1546
|
+
class: _tigercatcore.classNames.call(void 0, _tigercatcore.tableResponsiveCardClasses, resolvedCardClassName),
|
|
1547
|
+
onClick: () => ctx.handleRowClick(record, index, key)
|
|
1336
1548
|
},
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
titleNode,
|
|
1352
|
-
...rows,
|
|
1353
|
-
expandedContent ? _vue.h.call(void 0,
|
|
1354
|
-
"div",
|
|
1355
|
-
{ class: "mt-3 border-t border-[var(--tiger-border,#e5e7eb)] pt-3" },
|
|
1356
|
-
[expandedContent]
|
|
1357
|
-
) : null
|
|
1358
|
-
]
|
|
1549
|
+
customCard !== void 0 && customCard !== null ? [customCard] : [
|
|
1550
|
+
controls.length ? _vue.h.call(void 0, "div", { class: "mb-2 flex items-center gap-3" }, controls) : null,
|
|
1551
|
+
titleNode,
|
|
1552
|
+
...rows,
|
|
1553
|
+
expandedContent ? _vue.h.call(void 0,
|
|
1554
|
+
"div",
|
|
1555
|
+
{
|
|
1556
|
+
class: "mt-3 border-t border-[var(--tiger-border,#e5e7eb)] pt-3"
|
|
1557
|
+
},
|
|
1558
|
+
[expandedContent]
|
|
1559
|
+
) : null
|
|
1560
|
+
]
|
|
1561
|
+
);
|
|
1562
|
+
})
|
|
1359
1563
|
);
|
|
1360
|
-
}
|
|
1361
|
-
|
|
1564
|
+
}
|
|
1565
|
+
return _vue.h.call(void 0,
|
|
1566
|
+
"div",
|
|
1567
|
+
{
|
|
1568
|
+
class: _tigercatcore.getTableResponsiveCardListClasses.call(void 0, resolvedProps.cardBreakpoint),
|
|
1569
|
+
"data-tiger-table-mobile": "card"
|
|
1570
|
+
},
|
|
1571
|
+
cardChildren
|
|
1572
|
+
);
|
|
1573
|
+
})();
|
|
1362
1574
|
return _vue.h.call(void 0,
|
|
1363
1575
|
"div",
|
|
1364
1576
|
{
|
|
@@ -1393,11 +1605,11 @@ var Table = _vue.defineComponent.call(void 0, {
|
|
|
1393
1605
|
class: _tigercatcore.tableLoadingOverlayClasses,
|
|
1394
1606
|
role: "status",
|
|
1395
1607
|
"aria-live": "polite",
|
|
1396
|
-
"aria-label":
|
|
1608
|
+
"aria-label": tableLabels.value.loadingText
|
|
1397
1609
|
},
|
|
1398
|
-
[LoadingSpinner(), _vue.h.call(void 0, "span", { class: "sr-only" },
|
|
1610
|
+
[LoadingSpinner(), _vue.h.call(void 0, "span", { class: "sr-only" }, tableLabels.value.loadingText)]
|
|
1399
1611
|
),
|
|
1400
|
-
renderPagination(ctx,
|
|
1612
|
+
renderPagination(ctx, renderProps, {
|
|
1401
1613
|
locale: paginationLocale.value,
|
|
1402
1614
|
disableI18n: isPaginationI18nDisabled.value
|
|
1403
1615
|
})
|
|
@@ -9,6 +9,8 @@ var _vue = require('vue');
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
|
+
|
|
13
|
+
|
|
12
14
|
var _tigercatcore = require('@expcat/tigercat-core');
|
|
13
15
|
function useFloatingPopup(options) {
|
|
14
16
|
const { props, emit, multiTrigger = true } = options;
|
|
@@ -32,6 +34,19 @@ function useFloatingPopup(options) {
|
|
|
32
34
|
const containerRef = _vue.ref.call(void 0, null);
|
|
33
35
|
const triggerRef = _vue.ref.call(void 0, null);
|
|
34
36
|
const floatingRef = _vue.ref.call(void 0, null);
|
|
37
|
+
const restoreTriggerFocus = () => {
|
|
38
|
+
const trigger = triggerRef.value;
|
|
39
|
+
const target = _nullishCoalesce(_optionalChain([trigger, 'optionalAccess', _ => _.querySelector, 'call', _2 => _2(
|
|
40
|
+
'button,[href],input,select,textarea,[tabindex]:not([tabindex="-1"])'
|
|
41
|
+
)]), () => ( trigger));
|
|
42
|
+
window.setTimeout(() => {
|
|
43
|
+
_tigercatcore.restoreFocus.call(void 0, target, { preventScroll: true });
|
|
44
|
+
}, 0);
|
|
45
|
+
};
|
|
46
|
+
const closeAndRestoreFocus = () => {
|
|
47
|
+
setVisible(false);
|
|
48
|
+
restoreTriggerFocus();
|
|
49
|
+
};
|
|
35
50
|
const {
|
|
36
51
|
x,
|
|
37
52
|
y,
|
|
@@ -51,37 +66,37 @@ function useFloatingPopup(options) {
|
|
|
51
66
|
_vue.watch.call(void 0,
|
|
52
67
|
[currentVisible, effectiveTrigger],
|
|
53
68
|
([visible, trigger]) => {
|
|
54
|
-
_optionalChain([outsideClickCleanup, 'optionalCall',
|
|
55
|
-
_optionalChain([escapeKeyCleanup, 'optionalCall',
|
|
69
|
+
_optionalChain([outsideClickCleanup, 'optionalCall', _3 => _3()]);
|
|
70
|
+
_optionalChain([escapeKeyCleanup, 'optionalCall', _4 => _4()]);
|
|
56
71
|
outsideClickCleanup = void 0;
|
|
57
72
|
escapeKeyCleanup = void 0;
|
|
58
73
|
if (visible && trigger === "click") {
|
|
59
74
|
outsideClickCleanup = _chunkEQW6IUHGjs.useVueClickOutside.call(void 0, {
|
|
60
75
|
enabled: currentVisible,
|
|
61
76
|
refs: [containerRef, floatingRef],
|
|
62
|
-
onOutsideClick:
|
|
77
|
+
onOutsideClick: closeAndRestoreFocus,
|
|
63
78
|
defer: true
|
|
64
79
|
});
|
|
65
80
|
}
|
|
66
81
|
if (visible && trigger !== "manual") {
|
|
67
82
|
escapeKeyCleanup = _chunkEQW6IUHGjs.useVueEscapeKey.call(void 0, {
|
|
68
83
|
enabled: currentVisible,
|
|
69
|
-
onEscape:
|
|
84
|
+
onEscape: closeAndRestoreFocus
|
|
70
85
|
});
|
|
71
86
|
}
|
|
72
87
|
},
|
|
73
88
|
{ immediate: true }
|
|
74
89
|
);
|
|
75
90
|
_vue.onBeforeUnmount.call(void 0, () => {
|
|
76
|
-
_optionalChain([outsideClickCleanup, 'optionalCall',
|
|
77
|
-
_optionalChain([escapeKeyCleanup, 'optionalCall',
|
|
91
|
+
_optionalChain([outsideClickCleanup, 'optionalCall', _5 => _5()]);
|
|
92
|
+
_optionalChain([escapeKeyCleanup, 'optionalCall', _6 => _6()]);
|
|
78
93
|
});
|
|
79
94
|
const floatingStyles = _vue.computed.call(void 0, () => ({
|
|
80
95
|
position: "absolute",
|
|
81
96
|
left: `${x.value}px`,
|
|
82
97
|
top: `${y.value}px`,
|
|
83
98
|
transformOrigin: _tigercatcore.getTransformOrigin.call(void 0, actualPlacement.value),
|
|
84
|
-
zIndex:
|
|
99
|
+
zIndex: _tigercatcore.FLOATING_OVERLAY_Z_INDEX
|
|
85
100
|
}));
|
|
86
101
|
const handleToggle = () => {
|
|
87
102
|
if (!props.disabled) setVisible(!currentVisible.value);
|