@neovici/cosmoz-queue 3.4.1 → 3.5.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/README.md +1 -1
- package/dist/queue/icons.d.ts +1 -1
- package/dist/queue/icons.d.ts.map +1 -1
- package/dist/queue/icons.js +5 -61
- package/dist/queue/queue.d.ts +1 -11
- package/dist/queue/queue.d.ts.map +1 -1
- package/dist/queue/queue.js +2 -8
- package/dist/queue/render.d.ts.map +1 -1
- package/dist/queue/render.js +4 -0
- package/dist/queue/split.d.ts +29 -0
- package/dist/queue/split.d.ts.map +1 -0
- package/dist/queue/split.js +15 -0
- package/dist/queue/style.js +1 -1
- package/dist/queue/use-queue.d.ts +6 -1
- package/dist/queue/use-queue.d.ts.map +1 -1
- package/dist/queue/use-queue.js +4 -2
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -80,7 +80,7 @@ customElements.define('order-list-queue', component(OrderListQueue));
|
|
|
80
80
|
| `loader` | `(thru, props) => TemplateResult` | -- | Renders the loading skeleton |
|
|
81
81
|
| `pagination` | `Pagination?` | -- | Server-side pagination config |
|
|
82
82
|
| `fallback` | `string?` | -- | Default tab when none is set in URL hash |
|
|
83
|
-
| `split` | `SplitOpts?` | -- | Split.js configuration (sizes
|
|
83
|
+
| `split` | `SplitOpts?` | -- | Split.js configuration (sizes; `minSize`: minimum width per pane) |
|
|
84
84
|
| `afterHeading` | `unknown?` | -- | Extra content rendered after the heading |
|
|
85
85
|
|
|
86
86
|
Use **`details`** when you control the fetch (most common). Use **`api`** when you want the queue to handle fetching via URL.
|
package/dist/queue/icons.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export declare const list: import("lit-html").TemplateResult<1>;
|
|
2
|
-
export declare const queue: import("lit-html").TemplateResult<1>;
|
|
3
2
|
export declare const split: import("lit-html").TemplateResult<1>;
|
|
3
|
+
export declare const queue: import("lit-html").TemplateResult<1>;
|
|
4
4
|
//# sourceMappingURL=icons.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"icons.d.ts","sourceRoot":"","sources":["../../src/queue/icons.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"icons.d.ts","sourceRoot":"","sources":["../../src/queue/icons.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,IAAI,sCAAiB,CAAC;AACnC,eAAO,MAAM,KAAK,sCAAsB,CAAC;AACzC,eAAO,MAAM,KAAK,sCAAmB,CAAC"}
|
package/dist/queue/icons.js
CHANGED
|
@@ -1,61 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
fill="none"
|
|
7
|
-
stroke="currentColor"
|
|
8
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
9
|
-
>
|
|
10
|
-
<path
|
|
11
|
-
d="M1 2C1 1.44772 1.44772 1 2 1H16C16.5523 1 17 1.44772 17 2V4.57143C17 5.12371 16.5523 5.57143 16 5.57143H2C1.44772 5.57143 1 5.12371 1 4.57143V2Z"
|
|
12
|
-
stroke-width="1.5"
|
|
13
|
-
/>
|
|
14
|
-
<line x1="1" y1="9.39288" x2="17" y2="9.39288" stroke-width="1.5" />
|
|
15
|
-
<line x1="1" y1="12.8214" x2="17" y2="12.8214" stroke-width="1.5" />
|
|
16
|
-
</svg>`;
|
|
17
|
-
export const queue = html `
|
|
18
|
-
<svg
|
|
19
|
-
width="22"
|
|
20
|
-
height="16"
|
|
21
|
-
viewBox="0 0 22 16"
|
|
22
|
-
fill="none"
|
|
23
|
-
stroke="currentColor"
|
|
24
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
25
|
-
>
|
|
26
|
-
<rect x="5.44409" y="1" width="11.1111" height="14" stroke-width="1.5" />
|
|
27
|
-
<path d="M18.7776 3.3335H20.9998V12.6668H18.7776" stroke-width="1.5" />
|
|
28
|
-
<path
|
|
29
|
-
d="M3.22217 12.6665L0.999946 12.6665L0.999947 3.33317L3.22217 3.33317"
|
|
30
|
-
stroke-width="1.5"
|
|
31
|
-
/>
|
|
32
|
-
</svg>
|
|
33
|
-
`;
|
|
34
|
-
export const split = html `
|
|
35
|
-
<svg
|
|
36
|
-
width="19"
|
|
37
|
-
height="14"
|
|
38
|
-
viewBox="0 0 19 14"
|
|
39
|
-
fill="none"
|
|
40
|
-
stroke="currentColor"
|
|
41
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
42
|
-
>
|
|
43
|
-
<rect x="10" y="1" width="8" height="12" stroke-width="1.5" />
|
|
44
|
-
<line
|
|
45
|
-
x1="7"
|
|
46
|
-
y1="12.1787"
|
|
47
|
-
x2="4.15643e-07"
|
|
48
|
-
y2="12.1787"
|
|
49
|
-
stroke-width="1.5"
|
|
50
|
-
/>
|
|
51
|
-
<line x1="7" y1="8.75" x2="4.15643e-07" y2="8.75" stroke-width="1.5" />
|
|
52
|
-
<line
|
|
53
|
-
x1="7"
|
|
54
|
-
y1="5.17871"
|
|
55
|
-
x2="4.15643e-07"
|
|
56
|
-
y2="5.17871"
|
|
57
|
-
stroke-width="1.5"
|
|
58
|
-
/>
|
|
59
|
-
<line x1="7" y1="1.75" x2="4.15643e-07" y2="1.75" stroke-width="1.5" />
|
|
60
|
-
</svg>
|
|
61
|
-
`;
|
|
1
|
+
import { columns02Icon, listIcon, squareIcon, } from '@neovici/cosmoz-icons/untitled';
|
|
2
|
+
const size = { width: '18', height: '18' };
|
|
3
|
+
export const list = listIcon(size);
|
|
4
|
+
export const split = columns02Icon(size);
|
|
5
|
+
export const queue = squareIcon(size);
|
package/dist/queue/queue.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { TemplateResult } from 'lit-html';
|
|
2
2
|
import { RenderQueue } from './render';
|
|
3
|
+
import { SplitConfig } from './split';
|
|
3
4
|
import { Pagination } from './types';
|
|
4
5
|
import useQueue, { UseQueue } from './use-queue';
|
|
5
6
|
type QueueProps<I> = ReturnType<typeof useQueue<I>>;
|
|
@@ -7,17 +8,6 @@ type ViewProps<I> = Omit<QueueProps<I>, 'nav'> & {
|
|
|
7
8
|
nav: TemplateResult;
|
|
8
9
|
item: I;
|
|
9
10
|
};
|
|
10
|
-
/**
|
|
11
|
-
* @deprecated Use `initial-size` and `min-size` attributes on
|
|
12
|
-
* `<cosmoz-resizable-view>` instead (mapped automatically from this prop).
|
|
13
|
-
* `expandToMin` and `snapOffset` have no equivalent and are silently ignored.
|
|
14
|
-
*/
|
|
15
|
-
export interface SplitConfig {
|
|
16
|
-
sizes?: [number, number];
|
|
17
|
-
minSize?: [number] | number;
|
|
18
|
-
expandToMin?: boolean;
|
|
19
|
-
snapOffset?: number;
|
|
20
|
-
}
|
|
21
11
|
interface Props<I, D> extends Pick<UseQueue<I>, 'id' | 'api' | 'fallback'>, Pick<RenderQueue<I, D>, 'details' | 'afterHeading' | 'header'> {
|
|
22
12
|
list: (thru: Record<string, any>, props: QueueProps<I> & {
|
|
23
13
|
onRef: (el?: Element) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queue.d.ts","sourceRoot":"","sources":["../../src/queue/queue.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE/C,OAAO,EAAe,WAAW,EAAE,MAAM,UAAU,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAErC,OAAO,QAAQ,EAAE,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEjD,KAAK,UAAU,CAAC,CAAC,IAAI,UAAU,CAAC,OAAO,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;AACpD,KAAK,SAAS,CAAC,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,GAAG;IAChD,GAAG,EAAE,cAAc,CAAC;IACpB,IAAI,EAAE,CAAC,CAAC;CACR,CAAC;AAEF
|
|
1
|
+
{"version":3,"file":"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AAK,EAAE,SAAS,CAAC,CAAC,CAAC,KAAK,cAAc,CAAC;IAC3E,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,mGAAmG;IACnG,KAAK,CAAC,EAAE,WAAW,CAAC;CACpB;AAMD,eAAO,MAAM,KAAK,GAAI,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,OAAO,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,sBAuGjD,CAAC"}
|
package/dist/queue/queue.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { updateWith } from '../util/polymer-property-changed-event.js';
|
|
2
2
|
import { renderQueue } from './render';
|
|
3
|
+
import { computeSplitAttrs } from './split';
|
|
3
4
|
import useAsyncAction from './use-async-action';
|
|
4
5
|
import useQueue from './use-queue';
|
|
5
6
|
export const queue = (props) => {
|
|
@@ -17,14 +18,7 @@ export const queue = (props) => {
|
|
|
17
18
|
...queueProps,
|
|
18
19
|
onAsyncSimpleAction,
|
|
19
20
|
};
|
|
20
|
-
const splitAttrs = split
|
|
21
|
-
? {
|
|
22
|
-
initialSize: split.sizes?.[0] != null ? `${split.sizes[0]}%` : '50%',
|
|
23
|
-
minSize: split.minSize != null
|
|
24
|
-
? `${Array.isArray(split.minSize) ? split.minSize[0] : split.minSize}`
|
|
25
|
-
: undefined,
|
|
26
|
-
}
|
|
27
|
-
: { initialSize: '50%', minSize: '100' };
|
|
21
|
+
const splitAttrs = computeSplitAttrs(split);
|
|
28
22
|
return renderQueue({
|
|
29
23
|
details,
|
|
30
24
|
heading,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../src/queue/render.ts"],"names":[],"mappings":"AAAA,OAAO,wBAAwB,CAAC;AAChC,OAAO,2BA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,7 @@ const _emptySlide = {
|
|
|
18
18
|
const emptySlide = () => _emptySlide;
|
|
19
19
|
export const renderNav = ({ next, prev, }) => html ` <cosmoz-button
|
|
20
20
|
variant="secondary"
|
|
21
|
+
icon-only
|
|
21
22
|
class="button-nav prev"
|
|
22
23
|
title="${t('Previous item')}"
|
|
23
24
|
?disabled=${!prev}
|
|
@@ -28,6 +29,7 @@ export const renderNav = ({ next, prev, }) => html ` <cosmoz-button
|
|
|
28
29
|
</cosmoz-button>
|
|
29
30
|
<cosmoz-button
|
|
30
31
|
variant="secondary"
|
|
32
|
+
icon-only
|
|
31
33
|
title="${t('Next item')}"
|
|
32
34
|
class="button-nav next"
|
|
33
35
|
?disabled=${!next}
|
|
@@ -48,6 +50,7 @@ export const renderPagination = (pagination) => {
|
|
|
48
50
|
class="button-page page-prev"
|
|
49
51
|
size="sm"
|
|
50
52
|
variant="secondary"
|
|
53
|
+
icon-only
|
|
51
54
|
?disabled=${!(pageNumber > 1)}
|
|
52
55
|
@click=${(e) => onPage(e.ctrlKey ? 1 : pageNumber - 1)}
|
|
53
56
|
>
|
|
@@ -56,6 +59,7 @@ export const renderPagination = (pagination) => {
|
|
|
56
59
|
<cosmoz-button
|
|
57
60
|
title="${t('Next page')}"
|
|
58
61
|
variant="secondary"
|
|
62
|
+
icon-only
|
|
59
63
|
class="button-page page-next"
|
|
60
64
|
size="sm"
|
|
61
65
|
?disabled=${!(pageNumber < totalPages)}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Split-view sizing options for `queue()` and `useQueue()`.
|
|
3
|
+
*
|
|
4
|
+
* Mapped to the `initial-size` / `min-size` attributes of
|
|
5
|
+
* `<cosmoz-resizable-view>` by both `queue()` and `useQueue()`.
|
|
6
|
+
*/
|
|
7
|
+
export interface SplitConfig {
|
|
8
|
+
/** Initial widths of the two panes in percent. */
|
|
9
|
+
sizes?: [number, number];
|
|
10
|
+
/** Minimum widths per pane, forwarded to the `min-size` attribute. */
|
|
11
|
+
minSize?: number[] | number;
|
|
12
|
+
/** @deprecated Split.js leftovers, ignored. */
|
|
13
|
+
expandToMin?: boolean;
|
|
14
|
+
/** @deprecated Split.js leftovers, ignored. */
|
|
15
|
+
snapOffset?: number;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* `initial-size` / `min-size` attribute values for `<cosmoz-resizable-view>`.
|
|
19
|
+
*/
|
|
20
|
+
export interface SplitAttrs {
|
|
21
|
+
initialSize: string;
|
|
22
|
+
minSize?: string;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Maps the `split` option to `initial-size` / `min-size` attribute values.
|
|
26
|
+
* Shared by `queue()` and `useQueue()`, consumed via `renderQueue`.
|
|
27
|
+
*/
|
|
28
|
+
export declare const computeSplitAttrs: (split?: SplitConfig) => SplitAttrs;
|
|
29
|
+
//# sourceMappingURL=split.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"split.d.ts","sourceRoot":"","sources":["../../src/queue/split.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,MAAM,WAAW,WAAW;IAC3B,kDAAkD;IAClD,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACzB,sEAAsE;IACtE,OAAO,CAAC,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC;IAC5B,+CAA+C;IAC/C,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,+CAA+C;IAC/C,UAAU,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IAC1B,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;GAGG;AACH,eAAO,MAAM,iBAAiB,GAAI,QAAQ,WAAW,KAAG,UAWd,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { array } from '@neovici/cosmoz-utils/array';
|
|
2
|
+
/**
|
|
3
|
+
* Maps the `split` option to `initial-size` / `min-size` attribute values.
|
|
4
|
+
* Shared by `queue()` and `useQueue()`, consumed via `renderQueue`.
|
|
5
|
+
*/
|
|
6
|
+
export const computeSplitAttrs = (split) => split
|
|
7
|
+
? {
|
|
8
|
+
initialSize: split.sizes?.[0] != null ? `${split.sizes[0]}%` : '50%',
|
|
9
|
+
// `''` must never reach renderQueue: it would bypass its `?? '100'`
|
|
10
|
+
// fallback and render an empty `min-size` (no pane minimums).
|
|
11
|
+
minSize: split.minSize != null
|
|
12
|
+
? array(split.minSize).join(' ') || undefined
|
|
13
|
+
: undefined,
|
|
14
|
+
}
|
|
15
|
+
: { initialSize: '50%', minSize: '100' };
|
package/dist/queue/style.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { SplitConfig } from './split';
|
|
1
2
|
import { useListState } from './use-list';
|
|
2
3
|
import { Options as UseTabsOptions } from './use-tabs';
|
|
3
4
|
/**
|
|
@@ -34,8 +35,10 @@ interface Opts<I> extends ReturnType<typeof useListState<I>>, Pick<UseTabsOption
|
|
|
34
35
|
*/
|
|
35
36
|
api?: (id: string, item: I) => string;
|
|
36
37
|
id?: (i: I) => string;
|
|
38
|
+
/** @deprecated Use `initial-size` / `min-size` attributes on `<cosmoz-resizable-view>` instead (mapped automatically to the returned `splitAttrs`). */
|
|
39
|
+
split?: SplitConfig;
|
|
37
40
|
}
|
|
38
|
-
declare const useQueue: <I>({ id, api, tabHashParam, idHashParam, fallback, onActivate, ...thru }: Opts<I>) => {
|
|
41
|
+
declare const useQueue: <I>({ id, api, tabHashParam, idHashParam, fallback, onActivate, split, ...thru }: Opts<I>) => {
|
|
39
42
|
tabnav: import("@neovici/cosmoz-tabs/next").Result<{
|
|
40
43
|
readonly name: "overview";
|
|
41
44
|
readonly title: string;
|
|
@@ -72,6 +75,7 @@ declare const useQueue: <I>({ id, api, tabHashParam, idHashParam, fallback, onAc
|
|
|
72
75
|
}>;
|
|
73
76
|
activeTab: "split" | "overview" | "queue";
|
|
74
77
|
mobile: boolean;
|
|
78
|
+
splitAttrs: import("./split").SplitAttrs;
|
|
75
79
|
hideActions: boolean;
|
|
76
80
|
index: number;
|
|
77
81
|
rowPartFn: (row: I) => string | undefined;
|
|
@@ -133,6 +137,7 @@ declare const _default: <I>(thru: UseQueue<I>) => {
|
|
|
133
137
|
}>;
|
|
134
138
|
activeTab: "split" | "overview" | "queue";
|
|
135
139
|
mobile: boolean;
|
|
140
|
+
splitAttrs: import("./split").SplitAttrs;
|
|
136
141
|
hideActions: boolean;
|
|
137
142
|
index: number;
|
|
138
143
|
rowPartFn: (row: I) => string | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-queue.d.ts","sourceRoot":"","sources":["../../src/queue/use-queue.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"use-queue.d.ts","sourceRoot":"","sources":["../../src/queue/use-queue.ts"],"names":[],"mappings":"AAMA,OAAO,EAAqB,WAAW,EAAE,MAAM,SAAS,CAAC;AAGzD,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAgB,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,YAAY,CAAC;AAMhE;;GAEG;AACH,eAAO,MAAM,eAAe,mBAAmB,CAAC;AAEhD;;;GAGG;AACH,eAAO,MAAM,YAAY,GAAI,CAAC,EAC7B,MAAM,CAAC,GAAG,SAAS,EACnB,IAAI,CAAC,CAAC,EAAE,CAAC,KAAK,MAAM,KAClB,CAAC,CAAC,GAAG,EAAE,CAAC,KAAK,MAAM,GAAG,SAAS,CAKhC,CAAC;AAqDH,UAAU,IAAI,CAAC,CAAC,CACf,SACC,UAAU,CAAC,OAAO,YAAY,CAAC,CAAC,CAAC,CAAC,EAClC,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC;IACpC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC;;;;;;;;;;;;;;;;;;OAkBG;IACH,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,KAAK,MAAM,CAAC;IACtC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,MAAM,CAAC;IACtB,uJAAuJ;IACvJ,KAAK,CAAC,EAAE,WAAW,CAAC;CACpB;AAED,QAAA,MAAM,QAAQ,GAAI,CAAC,EAAE,8EASlB,IAAI,CAAC,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2BAnGM,MAAM,GAAG,SAAS;qBAgJ3B,KAAK;oBAvBA,MAAM;;;;;;;;;;;;;;;;;;CAqDjB,CAAC;AAEF,MAAM,MAAM,QAAQ,CAAC,CAAC,IAAI,IAAI,CAC7B,UAAU,CAAC,OAAO,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EACjC,MAAM,UAAU,CAAC,OAAO,YAAY,CAAC,CAAC,CAAC,CAAC,CACxC,CAAC;yBAEc,CAAC,EAAE,MAAM,QAAQ,CAAC,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2BArLpB,MAAM,GAAG,SAAS;qBAgJ3B,KAAK;oBAvBA,MAAM;;;;;;;;;;;;;;;;;;;AA4DlB,wBACgD"}
|
package/dist/queue/use-queue.js
CHANGED
|
@@ -3,6 +3,7 @@ import { memoize } from '@neovici/cosmoz-utils/memoize';
|
|
|
3
3
|
import { useCallback, useMemo } from '@pionjs/pion';
|
|
4
4
|
import { json } from '../util/fetch/fetch';
|
|
5
5
|
import { useMobile } from './use-mobile';
|
|
6
|
+
import { computeSplitAttrs } from './split';
|
|
6
7
|
import useDataNav from './use-data-nav';
|
|
7
8
|
import useKeyNav from './use-key-nav';
|
|
8
9
|
import { useListState } from './use-list';
|
|
@@ -37,7 +38,7 @@ const useQNav = ({ id, api, items, ...thru }) => {
|
|
|
37
38
|
});
|
|
38
39
|
return { ...pass, id, details };
|
|
39
40
|
};
|
|
40
|
-
const useQueue = ({ id = _id, api, tabHashParam, idHashParam, fallback, onActivate, ...thru }) => {
|
|
41
|
+
const useQueue = ({ id = _id, api, tabHashParam, idHashParam, fallback, onActivate, split, ...thru }) => {
|
|
41
42
|
const { items: _items, selected } = thru, mobile = useMobile(), items = useMemo(() => normalizeHeaders(_items), [_items]), queueItems = useMemo(() => getItems(items, selected), [items, selected]), { tabnav, activeTab } = useTabs({
|
|
42
43
|
items: queueItems,
|
|
43
44
|
hashParam: tabHashParam,
|
|
@@ -50,7 +51,7 @@ const useQueue = ({ id = _id, api, tabHashParam, idHashParam, fallback, onActiva
|
|
|
50
51
|
items: queueItems,
|
|
51
52
|
hashParam: idHashParam,
|
|
52
53
|
maintainSelection: ['queue', 'split'].includes(activeTab),
|
|
53
|
-
}), { item, setItem } = nav, ensue = useCallback((itemId) => {
|
|
54
|
+
}), splitAttrs = useMemo(() => computeSplitAttrs(split), [split]), { item, setItem } = nav, ensue = useCallback((itemId) => {
|
|
54
55
|
if (id(item) !== itemId) {
|
|
55
56
|
return;
|
|
56
57
|
}
|
|
@@ -64,6 +65,7 @@ const useQueue = ({ id = _id, api, tabHashParam, idHashParam, fallback, onActiva
|
|
|
64
65
|
tabnav,
|
|
65
66
|
activeTab,
|
|
66
67
|
mobile,
|
|
68
|
+
splitAttrs,
|
|
67
69
|
hideActions: selected?.length > 0 && activeTab === 'split',
|
|
68
70
|
index: useMemo(() => items.indexOf(item), [item, items]),
|
|
69
71
|
rowPartFn: useRowPartFn(item, id),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@neovici/cosmoz-queue",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.5.0",
|
|
4
4
|
"description": "A reusable queue component for master-detail views with list, split, and queue modes",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"web-components",
|
|
@@ -64,6 +64,7 @@
|
|
|
64
64
|
"dependencies": {
|
|
65
65
|
"@neovici/cosmoz-button": "^1.1.0",
|
|
66
66
|
"@neovici/cosmoz-form": "^4.0.0",
|
|
67
|
+
"@neovici/cosmoz-icons": "^1.6.0",
|
|
67
68
|
"@neovici/cosmoz-omnitable": "^19.0.0",
|
|
68
69
|
"@neovici/cosmoz-resizable": "^2.0.0",
|
|
69
70
|
"@neovici/cosmoz-router": "^11.2.8",
|