@onereach/ui-components 20.3.1 → 20.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { PropType } from 'vue';
|
|
2
|
-
import { Id } from '@onereach/ui-components-common/types';
|
|
3
|
-
import { DataGridColumn, DataGridFeatures, DataGridModelValue, DataGridVariant } from './types';
|
|
2
|
+
import { DataModel, Id } from '@onereach/ui-components-common/types';
|
|
3
|
+
import { DataGridColumn, DataGridFeatures, DataGridItem, DataGridModelValue, DataGridVariant } from './types';
|
|
4
|
+
type T = DataModel<{
|
|
5
|
+
id: Id;
|
|
6
|
+
[key: string]: any;
|
|
7
|
+
}>;
|
|
4
8
|
declare const _default: import("vue").DefineComponent<{
|
|
5
9
|
modelValue: {
|
|
6
10
|
type: PropType<DataGridModelValue>;
|
|
@@ -33,6 +37,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
33
37
|
type: PropType<any>;
|
|
34
38
|
default: undefined;
|
|
35
39
|
};
|
|
40
|
+
interactiveRows: {
|
|
41
|
+
type: BooleanConstructor;
|
|
42
|
+
default: boolean;
|
|
43
|
+
};
|
|
36
44
|
}, {
|
|
37
45
|
root: import("vue").Ref<HTMLElement | undefined>;
|
|
38
46
|
rootStyles: import("vue").ComputedRef<string[]>;
|
|
@@ -43,6 +51,11 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
43
51
|
selectingIndicator: import("vue").WritableComputedRef<boolean>;
|
|
44
52
|
showSelectingCouter: import("vue").ComputedRef<boolean | undefined>;
|
|
45
53
|
selectingDisabled: import("vue").ComputedRef<boolean | undefined>;
|
|
54
|
+
handleMouseEnterRow: (item: DataGridItem<T>) => void;
|
|
55
|
+
handleMouseLeaveRow: (item: DataGridItem<T>) => void;
|
|
56
|
+
handleMouseEnterCell: (item: DataGridItem<T>, columnName: string, value: any) => void;
|
|
57
|
+
handleMouseLeaveCell: (item: DataGridItem<T>, columnName: string, value: any) => void;
|
|
58
|
+
handleRowClick: (item: DataGridItem<T>) => void;
|
|
46
59
|
selectingModel: import("vue").WritableComputedRef<Id[]>;
|
|
47
60
|
filteringModel: import("vue").WritableComputedRef<undefined>;
|
|
48
61
|
searchingModel: import("vue").WritableComputedRef<import("@onereach/ui-components-common/types").ModelValue<string>>;
|
|
@@ -55,7 +68,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
55
68
|
removeScrollOffset: (header: HTMLElement) => void;
|
|
56
69
|
updateSearchingModel: (value: string) => void;
|
|
57
70
|
scrollTo: (event: FocusEvent) => void;
|
|
58
|
-
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:modelValue" | "update:item" | "close-notification")[], "update:modelValue" | "update:item" | "close-notification", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
71
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("update:modelValue" | "update:item" | "close-notification" | "hover:row" | "blur:row" | "hover:cell" | "blur:cell" | "click:row")[], "update:modelValue" | "update:item" | "close-notification" | "hover:row" | "blur:row" | "hover:cell" | "blur:cell" | "click:row", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
59
72
|
modelValue: {
|
|
60
73
|
type: PropType<DataGridModelValue>;
|
|
61
74
|
default: undefined;
|
|
@@ -87,10 +100,19 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
87
100
|
type: PropType<any>;
|
|
88
101
|
default: undefined;
|
|
89
102
|
};
|
|
103
|
+
interactiveRows: {
|
|
104
|
+
type: BooleanConstructor;
|
|
105
|
+
default: boolean;
|
|
106
|
+
};
|
|
90
107
|
}>> & {
|
|
91
108
|
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
92
109
|
"onUpdate:item"?: ((...args: any[]) => any) | undefined;
|
|
93
110
|
"onClose-notification"?: ((...args: any[]) => any) | undefined;
|
|
111
|
+
"onHover:row"?: ((...args: any[]) => any) | undefined;
|
|
112
|
+
"onBlur:row"?: ((...args: any[]) => any) | undefined;
|
|
113
|
+
"onHover:cell"?: ((...args: any[]) => any) | undefined;
|
|
114
|
+
"onBlur:cell"?: ((...args: any[]) => any) | undefined;
|
|
115
|
+
"onClick:row"?: ((...args: any[]) => any) | undefined;
|
|
94
116
|
}, {
|
|
95
117
|
modelValue: DataGridModelValue;
|
|
96
118
|
items: {
|
|
@@ -101,5 +123,6 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
101
123
|
features: DataGridFeatures;
|
|
102
124
|
loading: boolean;
|
|
103
125
|
notification: any;
|
|
126
|
+
interactiveRows: boolean;
|
|
104
127
|
}, {}>;
|
|
105
128
|
export default _default;
|
|
@@ -369,13 +369,17 @@ var script$c = defineComponent({
|
|
|
369
369
|
selected: {
|
|
370
370
|
type: Boolean,
|
|
371
371
|
default: false
|
|
372
|
+
},
|
|
373
|
+
interactive: {
|
|
374
|
+
type: Boolean,
|
|
375
|
+
default: false
|
|
372
376
|
}
|
|
373
377
|
},
|
|
374
378
|
expose: ['root'],
|
|
375
379
|
setup(props) {
|
|
376
380
|
// Refs & Styles
|
|
377
381
|
const root = ref();
|
|
378
|
-
const rootStyles = computed(() => ['or-data-grid-table-content-row-v3', ...DataGridTableContentRow, ...DataGridTableContentRowVariants[props.variant]]);
|
|
382
|
+
const rootStyles = computed(() => ['or-data-grid-table-content-row-v3', ...DataGridTableContentRow, ...DataGridTableContentRowVariants[props.variant], ...(props.interactive ? ['cursor-pointer'] : [])]);
|
|
379
383
|
return {
|
|
380
384
|
root,
|
|
381
385
|
rootStyles
|
|
@@ -1021,9 +1025,13 @@ var script = defineComponent({
|
|
|
1021
1025
|
notification: {
|
|
1022
1026
|
type: Object,
|
|
1023
1027
|
default: undefined
|
|
1028
|
+
},
|
|
1029
|
+
interactiveRows: {
|
|
1030
|
+
type: Boolean,
|
|
1031
|
+
default: false
|
|
1024
1032
|
}
|
|
1025
1033
|
},
|
|
1026
|
-
emits: ['update:modelValue', 'update:item', 'close-notification'],
|
|
1034
|
+
emits: ['update:modelValue', 'update:item', 'close-notification', 'hover:row', 'blur:row', 'hover:cell', 'blur:cell', 'click:row'],
|
|
1027
1035
|
expose: ['root'],
|
|
1028
1036
|
setup(props, context) {
|
|
1029
1037
|
// Refs & Styles
|
|
@@ -1161,6 +1169,38 @@ var script = defineComponent({
|
|
|
1161
1169
|
break;
|
|
1162
1170
|
}
|
|
1163
1171
|
}
|
|
1172
|
+
function handleMouseEnterRow(item) {
|
|
1173
|
+
if (!props.interactiveRows) return;
|
|
1174
|
+
context.emit('hover:row', item);
|
|
1175
|
+
}
|
|
1176
|
+
function handleMouseLeaveRow(item) {
|
|
1177
|
+
if (!props.interactiveRows) return;
|
|
1178
|
+
context.emit('blur:row', item);
|
|
1179
|
+
}
|
|
1180
|
+
function handleMouseEnterCell(item, columnName, value) {
|
|
1181
|
+
if (!props.interactiveRows) return;
|
|
1182
|
+
context.emit('hover:cell', {
|
|
1183
|
+
item,
|
|
1184
|
+
columnName,
|
|
1185
|
+
value
|
|
1186
|
+
});
|
|
1187
|
+
}
|
|
1188
|
+
function handleMouseLeaveCell(item, columnName, value) {
|
|
1189
|
+
if (!props.interactiveRows) return;
|
|
1190
|
+
context.emit('blur:cell', {
|
|
1191
|
+
item,
|
|
1192
|
+
columnName,
|
|
1193
|
+
value
|
|
1194
|
+
});
|
|
1195
|
+
}
|
|
1196
|
+
function handleRowClick(item) {
|
|
1197
|
+
if (!props.interactiveRows) return;
|
|
1198
|
+
context.emit('click:row', item);
|
|
1199
|
+
}
|
|
1200
|
+
// function handleCellClick(item: DataGridItem<T>, columnName: string, value: any): void {
|
|
1201
|
+
// if (!props.interactiveRows) return;
|
|
1202
|
+
// context.emit('click:cell', { item, columnName, value });
|
|
1203
|
+
// }
|
|
1164
1204
|
function removeScrollOffset(header) {
|
|
1165
1205
|
scrollOffsetStart.value.delete(header);
|
|
1166
1206
|
scrollOffsetStart.value = new Map(scrollOffsetStart.value);
|
|
@@ -1180,6 +1220,11 @@ var script = defineComponent({
|
|
|
1180
1220
|
selectingIndicator,
|
|
1181
1221
|
showSelectingCouter,
|
|
1182
1222
|
selectingDisabled,
|
|
1223
|
+
handleMouseEnterRow,
|
|
1224
|
+
handleMouseLeaveRow,
|
|
1225
|
+
handleMouseEnterCell,
|
|
1226
|
+
handleMouseLeaveCell,
|
|
1227
|
+
handleRowClick,
|
|
1183
1228
|
selectingModel,
|
|
1184
1229
|
filteringModel,
|
|
1185
1230
|
searchingModel,
|
|
@@ -1303,7 +1348,8 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
1303
1348
|
}, renderList(10, n => {
|
|
1304
1349
|
return createVNode(_component_OrDataGridTableContentRow, {
|
|
1305
1350
|
key: n,
|
|
1306
|
-
variant: _ctx.variant
|
|
1351
|
+
variant: _ctx.variant,
|
|
1352
|
+
interactive: _ctx.interactiveRows
|
|
1307
1353
|
}, {
|
|
1308
1354
|
default: withCtx(() => [_ctx.features.selecting ? (openBlock(), createBlock(_component_OrDataGridTableContentCell, {
|
|
1309
1355
|
key: 0,
|
|
@@ -1326,14 +1372,18 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
1326
1372
|
}, 1032 /* PROPS, DYNAMIC_SLOTS */, ["column", "features"]);
|
|
1327
1373
|
}), 128 /* KEYED_FRAGMENT */))]),
|
|
1328
1374
|
_: 2 /* DYNAMIC */
|
|
1329
|
-
}, 1032 /* PROPS, DYNAMIC_SLOTS */, ["variant"]);
|
|
1375
|
+
}, 1032 /* PROPS, DYNAMIC_SLOTS */, ["variant", "interactive"]);
|
|
1330
1376
|
}), 64 /* STABLE_FRAGMENT */)) : _ctx.items.length > 0 ? (openBlock(true), createElementBlock(Fragment, {
|
|
1331
1377
|
key: 1
|
|
1332
1378
|
}, renderList(_ctx.items, item => {
|
|
1333
1379
|
return openBlock(), createBlock(_component_OrDataGridTableContentRow, {
|
|
1334
1380
|
key: item.id,
|
|
1335
1381
|
variant: _ctx.variant,
|
|
1336
|
-
selected: _ctx.selectingModel.includes(item.id)
|
|
1382
|
+
selected: _ctx.selectingModel.includes(item.id),
|
|
1383
|
+
interactive: _ctx.interactiveRows,
|
|
1384
|
+
onMouseenter: () => _ctx.handleMouseEnterRow(item),
|
|
1385
|
+
onMouseleave: () => _ctx.handleMouseLeaveRow(item),
|
|
1386
|
+
onClick: () => _ctx.handleRowClick(item)
|
|
1337
1387
|
}, {
|
|
1338
1388
|
default: withCtx(() => [_ctx.features.selecting ? (openBlock(), createBlock(_component_OrDataGridTableContentCell, {
|
|
1339
1389
|
key: 0,
|
|
@@ -1341,7 +1391,9 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
1341
1391
|
stickiness: 'start'
|
|
1342
1392
|
},
|
|
1343
1393
|
"force-state": 'none',
|
|
1344
|
-
class: "!py-xs !px-xs md:!py-none md:!px-sm+"
|
|
1394
|
+
class: "!py-xs !px-xs md:!py-none md:!px-sm+",
|
|
1395
|
+
onMouseenter: () => _ctx.handleMouseEnterCell(item, 'selecting', _ctx.selectingModel.includes(item.id)),
|
|
1396
|
+
onMouseleave: () => _ctx.handleMouseLeaveCell(item, 'selecting', _ctx.selectingModel.includes(item.id))
|
|
1345
1397
|
}, {
|
|
1346
1398
|
default: withCtx(() => [createVNode(_component_OrCheckbox, {
|
|
1347
1399
|
modelValue: _ctx.selectingModel,
|
|
@@ -1350,7 +1402,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
1350
1402
|
disabled: _ctx.selectingDisabled
|
|
1351
1403
|
}, null, 8 /* PROPS */, ["modelValue", "value", "disabled"])]),
|
|
1352
1404
|
_: 2 /* DYNAMIC */
|
|
1353
|
-
},
|
|
1405
|
+
}, 1032 /* PROPS, DYNAMIC_SLOTS */, ["onMouseenter", "onMouseleave"])) : createCommentVNode("v-if", true), (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.columns, column => {
|
|
1354
1406
|
return openBlock(), createBlock(_component_OrDataGridTableContentCell, {
|
|
1355
1407
|
key: column.name,
|
|
1356
1408
|
"model-value": item[column.name],
|
|
@@ -1360,17 +1412,19 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
1360
1412
|
item[column.name] = value;
|
|
1361
1413
|
_ctx.$emit('update:item', item);
|
|
1362
1414
|
},
|
|
1363
|
-
onFocusin: _cache[5] || (_cache[5] = $event => _ctx.scrollTo($event))
|
|
1415
|
+
onFocusin: _cache[5] || (_cache[5] = $event => _ctx.scrollTo($event)),
|
|
1416
|
+
onMouseenter: () => _ctx.handleMouseEnterCell(item, column.name, item[column.name]),
|
|
1417
|
+
onMouseleave: () => _ctx.handleMouseLeaveCell(item, column.name, item[column.name])
|
|
1364
1418
|
}, {
|
|
1365
1419
|
default: withCtx(() => [renderSlot(_ctx.$slots, column.name, {
|
|
1366
1420
|
column: column,
|
|
1367
1421
|
item: item
|
|
1368
1422
|
}, () => [createTextVNode(toDisplayString(item[column.name]), 1 /* TEXT */)])]),
|
|
1369
1423
|
_: 2 /* DYNAMIC */
|
|
1370
|
-
}, 1032 /* PROPS, DYNAMIC_SLOTS */, ["model-value", "column", "features", "onInput"]);
|
|
1424
|
+
}, 1032 /* PROPS, DYNAMIC_SLOTS */, ["model-value", "column", "features", "onInput", "onMouseenter", "onMouseleave"]);
|
|
1371
1425
|
}), 128 /* KEYED_FRAGMENT */))]),
|
|
1372
1426
|
_: 2 /* DYNAMIC */
|
|
1373
|
-
}, 1032 /* PROPS, DYNAMIC_SLOTS */, ["variant", "selected"]);
|
|
1427
|
+
}, 1032 /* PROPS, DYNAMIC_SLOTS */, ["variant", "selected", "interactive", "onMouseenter", "onMouseleave", "onClick"]);
|
|
1374
1428
|
}), 128 /* KEYED_FRAGMENT */)) : _ctx.$slots['noSearchResults'] && (_ctx.features.filtering && _ctx.filteringModel || _ctx.features.searching && _ctx.searchingModel) ? (openBlock(), createBlock(_component_OrDataGridTablePlaceholder, {
|
|
1375
1429
|
key: 2,
|
|
1376
1430
|
class: normalizeClass(['col-span-full']),
|
|
@@ -9,6 +9,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
9
9
|
type: BooleanConstructor;
|
|
10
10
|
default: boolean;
|
|
11
11
|
};
|
|
12
|
+
interactive: {
|
|
13
|
+
type: BooleanConstructor;
|
|
14
|
+
default: boolean;
|
|
15
|
+
};
|
|
12
16
|
}, {
|
|
13
17
|
root: import("vue").Ref<HTMLElement | undefined>;
|
|
14
18
|
rootStyles: import("vue").ComputedRef<string[]>;
|
|
@@ -21,7 +25,12 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
21
25
|
type: BooleanConstructor;
|
|
22
26
|
default: boolean;
|
|
23
27
|
};
|
|
28
|
+
interactive: {
|
|
29
|
+
type: BooleanConstructor;
|
|
30
|
+
default: boolean;
|
|
31
|
+
};
|
|
24
32
|
}>>, {
|
|
25
33
|
selected: boolean;
|
|
34
|
+
interactive: boolean;
|
|
26
35
|
}, {}>;
|
|
27
36
|
export default _default;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onereach/ui-components",
|
|
3
|
-
"version": "20.
|
|
3
|
+
"version": "20.4.0",
|
|
4
4
|
"description": "Vue components library for v3",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"exports": {
|
|
@@ -44,8 +44,8 @@
|
|
|
44
44
|
"@codemirror/view": "^6",
|
|
45
45
|
"@floating-ui/dom": "1.5.3",
|
|
46
46
|
"@lezer/highlight": "*",
|
|
47
|
-
"@onereach/styles": "^20.
|
|
48
|
-
"@onereach/ui-components-common": "^20.
|
|
47
|
+
"@onereach/styles": "^20.4.0",
|
|
48
|
+
"@onereach/ui-components-common": "^20.4.0",
|
|
49
49
|
"@splidejs/splide": "4.0.6",
|
|
50
50
|
"@tiptap/core": "2.0.3",
|
|
51
51
|
"@tiptap/extension-blockquote": "2.0.3",
|
|
@@ -105,5 +105,5 @@
|
|
|
105
105
|
"access": "public"
|
|
106
106
|
},
|
|
107
107
|
"npmUnpacked": "4.15.2",
|
|
108
|
-
"gitHead": "
|
|
108
|
+
"gitHead": "4739e1eb32ed19459b84bf21e1c5b7bfe548332e"
|
|
109
109
|
}
|