@dolusoft/query-table 3.19.0 → 3.20.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.
- package/dist/cells.js +218 -0
- package/dist/cells.js.map +1 -0
- package/dist/data-table.js +1 -1
- package/dist/query-table.js +1 -1
- package/dist/{src-BTIXBmwM.js → src-Cam4kRTd.js} +5 -14
- package/dist/src-Cam4kRTd.js.map +1 -0
- package/dist/table-context-Duuqp9Jq.js +28 -0
- package/dist/table-context-Duuqp9Jq.js.map +1 -0
- package/dist/types/cells/cell-action.vue.d.ts +16 -0
- package/dist/types/cells/cell-actions.vue.d.ts +13 -0
- package/dist/types/cells/cell-badge.vue.d.ts +17 -0
- package/dist/types/cells/cell-copy.vue.d.ts +8 -0
- package/dist/types/cells/cell-preview.vue.d.ts +8 -0
- package/dist/types/cells/cell-stack.vue.d.ts +16 -0
- package/dist/types/cells/cell-value.vue.d.ts +4 -0
- package/dist/types/cells/contract.d.ts +44 -0
- package/dist/types/cells/index.d.ts +8 -0
- package/dist/types/contract.d.ts +16 -0
- package/dist/types/core/cell-labels.d.ts +10 -0
- package/dist/types/core/table-context.d.ts +2 -0
- package/dist/types/core/table-labels.d.ts +9 -0
- package/package.json +7 -3
- package/dist/src-BTIXBmwM.js.map +0 -1
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { inject, provide } from "vue";
|
|
2
|
+
//#region src/core/cell-labels.ts
|
|
3
|
+
/**
|
|
4
|
+
* English defaults of the cell labels. This module imports nothing but
|
|
5
|
+
* types, so the `/cells` entry carries these three and not the defaults of
|
|
6
|
+
* the table, whose condition labels come from the protocol (ADR 0022,
|
|
7
|
+
* K320-6).
|
|
8
|
+
*/
|
|
9
|
+
var cellLabelDefaults = {
|
|
10
|
+
copyValue: (value) => `Copy ${value}`,
|
|
11
|
+
previewValue: (text) => `Preview ${text}`,
|
|
12
|
+
emptyValue: "-"
|
|
13
|
+
};
|
|
14
|
+
//#endregion
|
|
15
|
+
//#region src/core/table-context.ts
|
|
16
|
+
var tableContextKey = Symbol("query-table");
|
|
17
|
+
var provideTableContext = (context) => {
|
|
18
|
+
provide(tableContextKey, context);
|
|
19
|
+
};
|
|
20
|
+
var useTableContext = () => {
|
|
21
|
+
const context = inject(tableContextKey);
|
|
22
|
+
if (!context) throw new Error("Header parts must be rendered inside a QueryTable");
|
|
23
|
+
return context;
|
|
24
|
+
};
|
|
25
|
+
//#endregion
|
|
26
|
+
export { cellLabelDefaults as i, tableContextKey as n, useTableContext as r, provideTableContext as t };
|
|
27
|
+
|
|
28
|
+
//# sourceMappingURL=table-context-Duuqp9Jq.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table-context-Duuqp9Jq.js","names":[],"sources":["../src/core/cell-labels.ts","../src/core/table-context.ts"],"sourcesContent":["import type { TableLabels } from '../contract'\n\n/** The texts the cell components write (C-129), every one filled. */\nexport type CellLabels = Required<\n Pick<TableLabels, 'copyValue' | 'previewValue' | 'emptyValue'>\n>\n\n/**\n * English defaults of the cell labels. This module imports nothing but\n * types, so the `/cells` entry carries these three and not the defaults of\n * the table, whose condition labels come from the protocol (ADR 0022,\n * K320-6).\n */\nexport const cellLabelDefaults: CellLabels = {\n copyValue: value => `Copy ${value}`,\n previewValue: text => `Preview ${text}`,\n emptyValue: '-'\n}\n","import { inject, provide, type InjectionKey } from 'vue'\n\nimport type { ResolvedLabels } from './labels'\nimport type { ColumnReorder } from '../reorder/use-column-reorder'\nimport type { ColumnResize } from '../resize/use-column-resize'\nimport type {\n QueryTableFilters,\n QueryTableLayout,\n QueryTableSelection,\n QueryTableSort\n} from '../use-query-table'\n\n/**\n * What the header parts call: the filter inputs, the sort gate and the\n * layout actions of the composable, the resize and reorder actions and the\n * labels. Only actions and getters travel here; data (`columns`, `query`)\n * comes down as props.\n */\nexport interface TableContext {\n filters: QueryTableFilters\n sort: QueryTableSort\n /** The `control` of the header and filter-menu slots (C-70). */\n layout: QueryTableLayout\n resize: ColumnResize\n /** The reorder handles: drag, keys and the drag preview (C-73). */\n reorder: ColumnReorder\n /** The select-all checkbox of the selection column (C-59). */\n selection: Pick<\n QueryTableSelection<object>,\n 'allSelected' | 'someSelected' | 'toggleAll'\n >\n labels: () => ResolvedLabels\n}\n\nexport const tableContextKey: InjectionKey<TableContext> = Symbol('query-table')\n\nexport const provideTableContext = (context: TableContext) => {\n provide(tableContextKey, context)\n}\n\nexport const useTableContext = (): TableContext => {\n const context = inject(tableContextKey)\n if (!context) {\n throw new Error('Header parts must be rendered inside a QueryTable')\n }\n return context\n}\n"],"mappings":";;;;;;;;AAaA,IAAa,oBAAgC;CAC3C,YAAW,UAAS,QAAQ;CAC5B,eAAc,SAAQ,WAAW;CACjC,YAAY;AACd;;;ACiBA,IAAa,kBAA8C,OAAO,aAAa;AAE/E,IAAa,uBAAuB,YAA0B;CAC5D,QAAQ,iBAAiB,OAAO;AAClC;AAEA,IAAa,wBAAsC;CACjD,MAAM,UAAU,OAAO,eAAe;CACtC,IAAI,CAAC,SACH,MAAM,IAAI,MAAM,mDAAmD;CAErE,OAAO;AACT"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { CellActionProps } from './contract.js';
|
|
2
|
+
type __VLS_Slots = {
|
|
3
|
+
/** The button's text, the consumer's content (C-129). */
|
|
4
|
+
default?(): unknown;
|
|
5
|
+
};
|
|
6
|
+
declare const __VLS_base: import("vue").DefineComponent<CellActionProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<CellActionProps> & Readonly<{}>, {
|
|
7
|
+
kind: import("./contract.js").CellActionKind;
|
|
8
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
9
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
10
|
+
declare const _default: typeof __VLS_export;
|
|
11
|
+
export default _default;
|
|
12
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
13
|
+
new (): {
|
|
14
|
+
$slots: S;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
type __VLS_Slots = {
|
|
2
|
+
/** The `CellAction` buttons. */
|
|
3
|
+
default?(): unknown;
|
|
4
|
+
};
|
|
5
|
+
declare const __VLS_base: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
6
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
7
|
+
declare const _default: typeof __VLS_export;
|
|
8
|
+
export default _default;
|
|
9
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
10
|
+
new (): {
|
|
11
|
+
$slots: S;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { CellBadgeProps } from './contract.js';
|
|
2
|
+
type __VLS_Slots = {
|
|
3
|
+
/** Replaces `text`. */
|
|
4
|
+
default?(): unknown;
|
|
5
|
+
};
|
|
6
|
+
declare const __VLS_base: import("vue").DefineComponent<CellBadgeProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<CellBadgeProps> & Readonly<{}>, {
|
|
7
|
+
text: string | number;
|
|
8
|
+
tone: import("./contract.js").CellBadgeTone;
|
|
9
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
10
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
11
|
+
declare const _default: typeof __VLS_export;
|
|
12
|
+
export default _default;
|
|
13
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
14
|
+
new (): {
|
|
15
|
+
$slots: S;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { CellCopyProps } from './contract.js';
|
|
2
|
+
declare const __VLS_export: import("vue").DefineComponent<CellCopyProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
3
|
+
copy: (value: string) => any;
|
|
4
|
+
}, string, import("vue").PublicProps, Readonly<CellCopyProps> & Readonly<{
|
|
5
|
+
onCopy?: ((value: string) => any) | undefined;
|
|
6
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
7
|
+
declare const _default: typeof __VLS_export;
|
|
8
|
+
export default _default;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { CellPreviewProps } from './contract.js';
|
|
2
|
+
declare const __VLS_export: import("vue").DefineComponent<CellPreviewProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
3
|
+
preview: (text: string) => any;
|
|
4
|
+
}, string, import("vue").PublicProps, Readonly<CellPreviewProps> & Readonly<{
|
|
5
|
+
onPreview?: ((text: string) => any) | undefined;
|
|
6
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
7
|
+
declare const _default: typeof __VLS_export;
|
|
8
|
+
export default _default;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { CellStackProps } from './contract.js';
|
|
2
|
+
type __VLS_Slots = {
|
|
3
|
+
/** Replaces `primary`. */
|
|
4
|
+
primary?(): unknown;
|
|
5
|
+
/** Replaces `secondary`. */
|
|
6
|
+
secondary?(): unknown;
|
|
7
|
+
};
|
|
8
|
+
declare const __VLS_base: import("vue").DefineComponent<CellStackProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<CellStackProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
9
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
10
|
+
declare const _default: typeof __VLS_export;
|
|
11
|
+
export default _default;
|
|
12
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
13
|
+
new (): {
|
|
14
|
+
$slots: S;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { CellValueProps } from './contract.js';
|
|
2
|
+
declare const __VLS_export: import("vue").DefineComponent<CellValueProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<CellValueProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
3
|
+
declare const _default: typeof __VLS_export;
|
|
4
|
+
export default _default;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public contract of the cell components (`@dolusoft/query-table/cells`,
|
|
3
|
+
* ADR 0022). Unstyled markup for what the product's cells draw; each
|
|
4
|
+
* component's hooks are in `contract/dom.ts` (C-128) and its texts come from
|
|
5
|
+
* the `labels` of the table it sits in (C-129).
|
|
6
|
+
*/
|
|
7
|
+
/** What a `CellBadge` says, not how it looks (C-128). */
|
|
8
|
+
export type CellBadgeTone = 'neutral' | 'info' | 'success' | 'warning' | 'danger';
|
|
9
|
+
/** What a `CellAction` does, not how it looks (C-128). */
|
|
10
|
+
export type CellActionKind = 'default' | 'primary' | 'danger';
|
|
11
|
+
/** Props of `CellStack`: two lines, a primary over a secondary. */
|
|
12
|
+
export interface CellStackProps {
|
|
13
|
+
/** The first line. The `primary` slot replaces it. */
|
|
14
|
+
primary?: string | number | null;
|
|
15
|
+
/** The second line, drawn only when given. The `secondary` slot replaces it. */
|
|
16
|
+
secondary?: string | number | null;
|
|
17
|
+
}
|
|
18
|
+
/** Props of `CellCopy`: a value with a button that asks to copy it. */
|
|
19
|
+
export interface CellCopyProps {
|
|
20
|
+
/** The value shown and emitted with `copy`. */
|
|
21
|
+
value: string | number;
|
|
22
|
+
}
|
|
23
|
+
/** Props of `CellPreview`: a text with a button that asks to preview it. */
|
|
24
|
+
export interface CellPreviewProps {
|
|
25
|
+
/** The text shown and emitted with `preview`. */
|
|
26
|
+
text: string | number;
|
|
27
|
+
}
|
|
28
|
+
/** Props of `CellBadge`: a short status. */
|
|
29
|
+
export interface CellBadgeProps {
|
|
30
|
+
/** The text. The default slot replaces it. */
|
|
31
|
+
text?: string | number;
|
|
32
|
+
/** Defaults to `'neutral'`. */
|
|
33
|
+
tone?: CellBadgeTone;
|
|
34
|
+
}
|
|
35
|
+
/** Props of `CellValue`: a value, or the empty-value label when there is none. */
|
|
36
|
+
export interface CellValueProps {
|
|
37
|
+
/** `null`, `undefined` and `''` draw `labels.emptyValue` (C-129). */
|
|
38
|
+
value?: unknown;
|
|
39
|
+
}
|
|
40
|
+
/** Props of `CellAction`: one button of a `CellActions` group. */
|
|
41
|
+
export interface CellActionProps {
|
|
42
|
+
/** Defaults to `'default'`. */
|
|
43
|
+
kind?: CellActionKind;
|
|
44
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { default as CellAction } from './cell-action.vue.js';
|
|
2
|
+
export { default as CellActions } from './cell-actions.vue.js';
|
|
3
|
+
export { default as CellBadge } from './cell-badge.vue.js';
|
|
4
|
+
export { default as CellCopy } from './cell-copy.vue.js';
|
|
5
|
+
export { default as CellPreview } from './cell-preview.vue.js';
|
|
6
|
+
export { default as CellStack } from './cell-stack.vue.js';
|
|
7
|
+
export { default as CellValue } from './cell-value.vue.js';
|
|
8
|
+
export type { CellActionKind, CellActionProps, CellBadgeProps, CellBadgeTone, CellCopyProps, CellPreviewProps, CellStackProps, CellValueProps } from './contract.js';
|
package/dist/types/contract.d.ts
CHANGED
|
@@ -479,6 +479,22 @@ export interface TableLabels {
|
|
|
479
479
|
selectRow: string;
|
|
480
480
|
/** Name of the checkbox that selects every row of the page. Default `'Select all rows'`. */
|
|
481
481
|
selectAllRows: string;
|
|
482
|
+
/**
|
|
483
|
+
* Name of the copy button of `CellCopy` (`/cells`, C-129). Default
|
|
484
|
+
* `` value => `Copy ${value}` ``. Optional (3.20), so a complete
|
|
485
|
+
* `TableLabels` of 3.19 still type-checks.
|
|
486
|
+
*/
|
|
487
|
+
copyValue?: (value: string) => string;
|
|
488
|
+
/**
|
|
489
|
+
* Name of the preview button of `CellPreview` (`/cells`, C-129). Default
|
|
490
|
+
* `` text => `Preview ${text}` ``. Optional (3.20), like `copyValue`.
|
|
491
|
+
*/
|
|
492
|
+
previewValue?: (text: string) => string;
|
|
493
|
+
/**
|
|
494
|
+
* The text `CellValue` (`/cells`, C-129) draws for an empty value. Default
|
|
495
|
+
* `'-'`. Optional (3.20), like `copyValue`.
|
|
496
|
+
*/
|
|
497
|
+
emptyValue?: string;
|
|
482
498
|
}
|
|
483
499
|
/** Payload of the `cellContextMenu` event. */
|
|
484
500
|
export interface CellContextMenuPayload<T> {
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { TableLabels } from '../contract.js';
|
|
2
|
+
/** The texts the cell components write (C-129), every one filled. */
|
|
3
|
+
export type CellLabels = Required<Pick<TableLabels, 'copyValue' | 'previewValue' | 'emptyValue'>>;
|
|
4
|
+
/**
|
|
5
|
+
* English defaults of the cell labels. This module imports nothing but
|
|
6
|
+
* types, so the `/cells` entry carries these three and not the defaults of
|
|
7
|
+
* the table, whose condition labels come from the protocol (ADR 0022,
|
|
8
|
+
* K320-6).
|
|
9
|
+
*/
|
|
10
|
+
export declare const cellLabelDefaults: CellLabels;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type InjectionKey } from 'vue';
|
|
1
2
|
import type { ResolvedLabels } from './labels.js';
|
|
2
3
|
import type { ColumnReorder } from '../reorder/use-column-reorder.js';
|
|
3
4
|
import type { ColumnResize } from '../resize/use-column-resize.js';
|
|
@@ -20,5 +21,6 @@ export interface TableContext {
|
|
|
20
21
|
selection: Pick<QueryTableSelection<object>, 'allSelected' | 'someSelected' | 'toggleAll'>;
|
|
21
22
|
labels: () => ResolvedLabels;
|
|
22
23
|
}
|
|
24
|
+
export declare const tableContextKey: InjectionKey<TableContext>;
|
|
23
25
|
export declare const provideTableContext: (context: TableContext) => void;
|
|
24
26
|
export declare const useTableContext: () => TableContext;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type CellLabels } from './cell-labels.js';
|
|
2
|
+
/**
|
|
3
|
+
* The cell labels of the table a component sits in, read again on every
|
|
4
|
+
* call so they follow the table's `labels` prop. An entry the table leaves
|
|
5
|
+
* out, or gives as `undefined`, is the English default; outside a table
|
|
6
|
+
* every entry is (C-129). The one module of the main part the cell
|
|
7
|
+
* components import (ADR 0022, K320-6).
|
|
8
|
+
*/
|
|
9
|
+
export declare const useCellLabels: () => (() => CellLabels);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dolusoft/query-table",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.20.0",
|
|
4
4
|
"description": "A thin Vue 3 table for server-side data: it renders rows and emits sort, filter, search and paging changes. Built on TanStack Table.",
|
|
5
5
|
"private": false,
|
|
6
6
|
"type": "module",
|
|
@@ -22,6 +22,10 @@
|
|
|
22
22
|
"./data-table": {
|
|
23
23
|
"types": "./dist/types/data-table/index.d.ts",
|
|
24
24
|
"default": "./dist/data-table.js"
|
|
25
|
+
},
|
|
26
|
+
"./cells": {
|
|
27
|
+
"types": "./dist/types/cells/index.d.ts",
|
|
28
|
+
"default": "./dist/cells.js"
|
|
25
29
|
}
|
|
26
30
|
},
|
|
27
31
|
"engines": {
|
|
@@ -49,8 +53,8 @@
|
|
|
49
53
|
],
|
|
50
54
|
"license": "MIT",
|
|
51
55
|
"dependencies": {
|
|
52
|
-
"@dolusoft/query-protocol": "3.
|
|
53
|
-
"@dolusoft/query-table-core": "3.
|
|
56
|
+
"@dolusoft/query-protocol": "3.20.0",
|
|
57
|
+
"@dolusoft/query-table-core": "3.20.0",
|
|
54
58
|
"@tanstack/vue-table": "9.2.6"
|
|
55
59
|
},
|
|
56
60
|
"devDependencies": {
|