@neovici/cosmoz-omnitable 12.29.0 → 13.1.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,4 +1,4 @@
1
- import { component } from 'haunted';
1
+ import { component } from '@pionjs/pion';
2
2
  import { nothing } from 'lit-html';
3
3
 
4
4
  const GroupRow = ({ column, item, selected, folded, group }) => {
@@ -1,4 +1,4 @@
1
- import { html, component } from 'haunted';
1
+ import { html, component } from '@pionjs/pion';
2
2
  import { repeat } from 'lit-html/directives/repeat.js';
3
3
  import './lib/cosmoz-omnitable-resize-nub';
4
4
  import { render } from './lib/settings/cosmoz-omnitable-sort-group';
@@ -1,4 +1,4 @@
1
- import { component, html } from 'haunted';
1
+ import { component, html } from '@pionjs/pion';
2
2
 
3
3
  const OmnitableItemExpandLine = ({ column }) => html`
4
4
  <style>
@@ -1,5 +1,5 @@
1
1
  /* eslint-disable object-curly-newline */
2
- import { component, useEffect } from 'haunted';
2
+ import { component, useEffect } from '@pionjs/pion';
3
3
  import { html, nothing } from 'lit-html';
4
4
  import './cosmoz-omnitable-item-expand-line';
5
5
  import { notifyResize } from './lib/utils';
@@ -1,4 +1,4 @@
1
- import { component, html } from 'haunted';
1
+ import { component, html } from '@pionjs/pion';
2
2
  import { repeat } from 'lit-html/directives/repeat.js';
3
3
 
4
4
  const
@@ -21,7 +21,7 @@ import { html } from 'lit-html';
21
21
  import { guard } from 'lit-html/directives/guard.js';
22
22
 
23
23
  import { useOmnitable } from './lib/use-omnitable';
24
- import { component } from 'haunted';
24
+ import { component } from '@pionjs/pion';
25
25
  import { renderHeader } from './lib/render-header';
26
26
  import { renderFooter } from './lib/render-footer';
27
27
  import { renderList } from './lib/render-list';
@@ -1,4 +1,4 @@
1
- import { html } from 'haunted';
1
+ import { html } from '@pionjs/pion';
2
2
  import { layout } from './layout';
3
3
 
4
4
  const
@@ -1,4 +1,4 @@
1
- import { useEffect, component } from 'haunted';
1
+ import { useEffect, component } from '@pionjs/pion';
2
2
  import { nothing } from 'lit-html';
3
3
 
4
4
  const
@@ -1,4 +1,4 @@
1
- import { html, component } from 'haunted';
1
+ import { html, component } from '@pionjs/pion';
2
2
  import { _ } from '@neovici/cosmoz-i18next';
3
3
  import { isEmpty } from '@neovici/cosmoz-utils/template';
4
4
  import { defaultPlacement } from '@neovici/cosmoz-dropdown';
@@ -1,4 +1,4 @@
1
- import { html } from 'haunted';
1
+ import { html } from '@pionjs/pion';
2
2
  import { ifDefined } from 'lit-html/directives/if-defined.js';
3
3
  import { triangle } from '../icons';
4
4
 
@@ -1,4 +1,4 @@
1
- import { createContext, useContext, useMemo } from 'haunted';
1
+ import { createContext, useContext, useMemo } from '@pionjs/pion';
2
2
  import local from './local';
3
3
 
4
4
  export const DriverContext = createContext(local),
@@ -1,4 +1,4 @@
1
- import { useCallback, useEffect, useState } from 'haunted';
1
+ import { useCallback, useEffect, useState } from '@pionjs/pion';
2
2
  import { normalizeStore } from './normalize';
3
3
  import { useDriver } from './drivers';
4
4
 
@@ -1,4 +1,4 @@
1
- import { useCallback } from 'haunted';
1
+ import { useCallback } from '@pionjs/pion';
2
2
  import { useMeta } from '@neovici/cosmoz-utils/hooks/use-meta';
3
3
 
4
4
  const parseIndex = (str) => {
@@ -1,4 +1,4 @@
1
- import { useMemo, useState, useRef, useCallback } from 'haunted';
1
+ import { useMemo, useState, useRef, useCallback } from '@pionjs/pion';
2
2
 
3
3
  import useSavedSettings from './use-saved-settings';
4
4
  import normalize, { sgProps } from './normalize';
@@ -1,4 +1,4 @@
1
- import { useState } from 'haunted';
1
+ import { useState } from '@pionjs/pion';
2
2
  import { useTrackSize } from './use-track-size';
3
3
 
4
4
  export const useCanvasWidth = host => {
@@ -1,4 +1,4 @@
1
- import { useEffect, useLayoutEffect, useState } from 'haunted';
1
+ import { useEffect, useLayoutEffect, useState } from '@pionjs/pion';
2
2
  import { memooize } from '@neovici/cosmoz-utils/memoize';
3
3
 
4
4
  const columnSymbol = Symbol('column'),
@@ -1,4 +1,4 @@
1
- import { useLayoutEffect, useMemo } from 'haunted';
1
+ import { useLayoutEffect, useMemo } from '@pionjs/pion';
2
2
  import { toCss } from './compute-layout';
3
3
  import { useResizableColumns } from './use-resizable-columns';
4
4
  import { useCanvasWidth } from './use-canvas-width';
@@ -1,4 +1,4 @@
1
- import { useCallback, useState } from 'haunted';
1
+ import { useCallback, useState } from '@pionjs/pion';
2
2
  import { navigate } from '@neovici/cosmoz-router';
3
3
  import { identity, invoke } from '@neovici/cosmoz-utils/function';
4
4
 
package/lib/use-header.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /* eslint-disable max-lines-per-function */
2
- import { useEffect, useMemo } from 'haunted';
2
+ import { useEffect, useMemo } from '@pionjs/pion';
3
3
 
4
4
  export const useHeader = ({
5
5
  host,
package/lib/use-layout.js CHANGED
@@ -1,4 +1,4 @@
1
- import { useMemo } from 'haunted';
1
+ import { useMemo } from '@pionjs/pion';
2
2
  import { computeLayout } from './compute-layout';
3
3
 
4
4
  export const useLayout = ({ canvasWidth, groupOnColumn, config }) => useMemo(() => {
package/lib/use-list.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /* eslint-disable max-lines-per-function */
2
- import { html, useCallback, useEffect, useMemo, useRef } from 'haunted';
2
+ import { html, useCallback, useEffect, useMemo, useRef } from '@pionjs/pion';
3
3
  import { indexSymbol } from './utils';
4
4
  import { isEmpty } from '@neovici/cosmoz-utils/template';
5
5
  import { onItemChange as _onItemChange } from './utils-data';
@@ -7,20 +7,24 @@ import { onItemChange as _onItemChange } from './utils-data';
7
7
  const _getGroupRowClasses = (folded) =>
8
8
  folded ? 'groupRow groupRow-folded' : 'groupRow',
9
9
  _getFoldIcon = (expanded) => (expanded ? 'expand-less' : 'expand-more'),
10
- renderItem = ({
11
- columns,
12
- collapsedColumns,
13
- onItemClick,
14
- onCheckboxChange,
15
- dataIsValid,
16
- groupOnColumn,
17
- onItemChange,
18
- }) => {
19
- return (item, index, { selected, expanded, toggleCollapse }) => {
20
- return html` <div class="item-row-wrapper">
10
+ renderItem =
11
+ ({
12
+ columns,
13
+ collapsedColumns,
14
+ onItemClick,
15
+ onCheckboxChange,
16
+ dataIsValid,
17
+ groupOnColumn,
18
+ onItemChange,
19
+ rowPartFn,
20
+ }) =>
21
+ (item, index, { selected, expanded, toggleCollapse }) =>
22
+ html` <div class="item-row-wrapper">
21
23
  <div
22
24
  ?selected=${selected}
23
- part="itemRow itemRow-${item[indexSymbol]}"
25
+ part="${['itemRow', `itemRow-${item[indexSymbol]}`, rowPartFn?.(item, index)]
26
+ .filter(Boolean)
27
+ .join(' ')}"
24
28
  .dataIndex=${item[indexSymbol]}
25
29
  .dataItem=${item}
26
30
  class="itemRow"
@@ -62,9 +66,7 @@ const _getGroupRowClasses = (folded) =>
62
66
  part="item-expand"
63
67
  >
64
68
  </cosmoz-omnitable-item-expand>
65
- </div>`;
66
- };
67
- },
69
+ </div>`,
68
70
  renderGroup = ({ onCheckboxChange, dataIsValid, groupOnColumn }) => {
69
71
  return (item, index, { selected, folded, toggleFold }) =>
70
72
  html` <div
@@ -106,6 +108,7 @@ export const useList = ({
106
108
  columns,
107
109
  collapsedColumns,
108
110
  sortAndGroupOptions,
111
+ rowPartFn,
109
112
  ...rest
110
113
  }) => {
111
114
  const { loading = false, displayEmptyGroups = false, compareItemsFn } = host,
@@ -193,6 +196,7 @@ export const useList = ({
193
196
  dataIsValid,
194
197
  groupOnColumn,
195
198
  onItemChange,
199
+ rowPartFn,
196
200
  }),
197
201
  [
198
202
  columns,
@@ -202,6 +206,7 @@ export const useList = ({
202
206
  dataIsValid,
203
207
  groupOnColumn,
204
208
  onItemChange,
209
+ rowPartFn,
205
210
  ],
206
211
  ),
207
212
  renderGroup: useMemo(
@@ -1,4 +1,4 @@
1
- import { useState } from 'haunted';
1
+ import { useState } from '@pionjs/pion';
2
2
  import { useProcessedItems } from './use-processed-items';
3
3
  import { useFastLayout } from './use-fast-layout';
4
4
  import { useSettings } from './settings';
@@ -18,7 +18,8 @@ export const useOmnitable = (host) => {
18
18
  noLocal,
19
19
  noLocalSort = noLocal,
20
20
  noLocalFilter = noLocal,
21
- error
21
+ error,
22
+ rowPartFn
22
23
  } = host,
23
24
  settingS = useSettings({ settingsId, host }),
24
25
  { settings, setSettings, columns, resetRef } = settingS,
@@ -86,6 +87,7 @@ export const useOmnitable = (host) => {
86
87
  columns,
87
88
  collapsedColumns,
88
89
  sortAndGroupOptions,
90
+ rowPartFn
89
91
  }),
90
92
  footer: useFooter({
91
93
  host,
@@ -1,4 +1,4 @@
1
- import { useCallback, useEffect, useMemo } from 'haunted';
1
+ import { useCallback, useEffect, useMemo } from '@pionjs/pion';
2
2
  import { invoke } from '@neovici/cosmoz-utils/function';
3
3
  import { genericSorter } from './generic-sorter';
4
4
  import { columnSymbol } from './use-dom-columns';
@@ -1,6 +1,6 @@
1
1
  /* eslint-disable max-lines-per-function */
2
2
  import { useImperativeApi } from '@neovici/cosmoz-utils/hooks/use-imperative-api';
3
- import { useEffect, useMemo } from 'haunted';
3
+ import { useEffect, useMemo } from '@pionjs/pion';
4
4
  import { useNotifyProperty } from '@neovici/cosmoz-utils/hooks/use-notify-property';
5
5
 
6
6
  const mkNapi = (host) => {
@@ -1,4 +1,4 @@
1
- import { useEffect, useRef } from 'haunted';
1
+ import { useEffect, useRef } from '@pionjs/pion';
2
2
 
3
3
  export const useResizableColumns = ({
4
4
  host,
@@ -5,7 +5,7 @@ import {
5
5
  useContext,
6
6
  useCallback,
7
7
  useEffect,
8
- } from 'haunted';
8
+ } from '@pionjs/pion';
9
9
  import { useHashState } from './use-hash-state';
10
10
 
11
11
  const parseBool = (bool) => [true, 'true', 1, 'yes', 'on'].includes(bool),
@@ -16,7 +16,7 @@ const parseBool = (bool) => [true, 'true', 1, 'yes', 'on'].includes(bool),
16
16
  setter(value);
17
17
  setSettings((s) => ({ ...s, [name]: value }));
18
18
  },
19
- [setter, name, setSettings]
19
+ [setter, name, setSettings],
20
20
  );
21
21
 
22
22
  // eslint-disable-next-line max-lines-per-function
@@ -25,7 +25,7 @@ export const useSortAndGroupOptions = (
25
25
  hashParam,
26
26
  settings,
27
27
  setSettings,
28
- resetRef
28
+ resetRef,
29
29
  ) => {
30
30
  const [sortOn, setSortOn] = useHashState(settings.sortOn, hashParam, {
31
31
  suffix: '-sortOn',
@@ -36,7 +36,7 @@ export const useSortAndGroupOptions = (
36
36
  {
37
37
  suffix: '-descending',
38
38
  read: boolParam,
39
- }
39
+ },
40
40
  ),
41
41
  [groupOn, setGroupOn] = useHashState(settings.groupOn, hashParam, {
42
42
  suffix: '-groupOn',
@@ -44,15 +44,15 @@ export const useSortAndGroupOptions = (
44
44
  [groupOnDescending, setGroupOnDescending] = useHashState(
45
45
  settings.groupOnDescending,
46
46
  hashParam,
47
- { suffix: '-groupOnDescending', read: boolParam }
47
+ { suffix: '-groupOnDescending', read: boolParam },
48
48
  ),
49
49
  sortOnColumn = useMemo(
50
50
  () => columns.find((column) => column.name === sortOn),
51
- [columns, sortOn]
51
+ [columns, sortOn],
52
52
  ),
53
53
  groupOnColumn = useMemo(
54
54
  () => columns.find((column) => column.name === groupOn),
55
- [columns, groupOn]
55
+ [columns, groupOn],
56
56
  ),
57
57
  sortAndGroup_ = {
58
58
  groupOn,
@@ -61,7 +61,7 @@ export const useSortAndGroupOptions = (
61
61
  setGroupOnDescending: useSettingsState(
62
62
  setGroupOnDescending,
63
63
  'groupOnDescending',
64
- setSettings
64
+ setSettings,
65
65
  ),
66
66
 
67
67
  sortOn,
@@ -70,7 +70,7 @@ export const useSortAndGroupOptions = (
70
70
  setDescending: useSettingsState(
71
71
  setDescending,
72
72
  'descending',
73
- setSettings
73
+ setSettings,
74
74
  ),
75
75
 
76
76
  columns,
@@ -100,5 +100,5 @@ customElements.define(
100
100
  'sort-and-group-consumer',
101
101
  component(({ render }) => render(useContext(SortAndGroupContext)), {
102
102
  useShadowDOM: false,
103
- })
103
+ }),
104
104
  );
@@ -1,4 +1,4 @@
1
- import { useEffect } from 'haunted';
1
+ import { useEffect } from '@pionjs/pion';
2
2
 
3
3
  export const useTrackSize = (host, setCanvasWidth) =>
4
4
  useEffect(() => {
@@ -1,4 +1,4 @@
1
- import { useCallback, useEffect, useRef, useState } from 'haunted';
1
+ import { useCallback, useEffect, useRef, useState } from '@pionjs/pion';
2
2
 
3
3
  export const isCloseEnough = (a = 0, b = 0) => Math.abs(a - b) < 0.1,
4
4
  // eslint-disable-next-line max-lines-per-function
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neovici/cosmoz-omnitable",
3
- "version": "12.29.0",
3
+ "version": "13.1.0",
4
4
  "description": "[![Build Status](https://travis-ci.org/Neovici/cosmoz-omnitable.svg?branch=master)](https://travis-ci.org/Neovici/cosmoz-omnitable)",
5
5
  "keywords": [
6
6
  "web-components"
@@ -59,17 +59,18 @@
59
59
  }
60
60
  },
61
61
  "dependencies": {
62
- "@neovici/cosmoz-autocomplete": "^6.0.0 || ^7.0.0",
63
- "@neovici/cosmoz-bottom-bar": "^6.0.0",
62
+ "@neovici/cosmoz-autocomplete": "^8.0.0",
63
+ "@neovici/cosmoz-bottom-bar": "^7.0.0",
64
64
  "@neovici/cosmoz-collapse": "^1.1.0",
65
- "@neovici/cosmoz-datetime-input": "^3.0.3",
66
- "@neovici/cosmoz-dropdown": "^3.0.0",
67
- "@neovici/cosmoz-grouped-list": "^6.0.0",
65
+ "@neovici/cosmoz-datetime-input": "^4.0.0",
66
+ "@neovici/cosmoz-dropdown": "^4.0.0",
67
+ "@neovici/cosmoz-grouped-list": "^7.0.0",
68
68
  "@neovici/cosmoz-i18next": "^3.1.1",
69
- "@neovici/cosmoz-input": "^3.15.0",
70
- "@neovici/cosmoz-router": "^10.0.0",
71
- "@neovici/cosmoz-utils": "^5.16.0",
69
+ "@neovici/cosmoz-input": "^4.0.0",
70
+ "@neovici/cosmoz-router": "^11.0.0",
71
+ "@neovici/cosmoz-utils": "^6.0.0",
72
72
  "@neovici/nullxlsx": "^3.0.0",
73
+ "@pionjs/pion": "^2.0.0",
73
74
  "@polymer/iron-icon": "^3.0.0",
74
75
  "@polymer/iron-icons": "^3.0.0",
75
76
  "@polymer/paper-dropdown-menu": "^3.2.0",
@@ -77,15 +78,14 @@
77
78
  "@polymer/paper-spinner": "^3.0.0",
78
79
  "@polymer/polymer": "^3.3.0",
79
80
  "file-saver-es": "^2.0.0",
80
- "haunted": "^5.0.0",
81
- "lit-html": "^2.0.0"
81
+ "lit-html": "^2.0.0 || ^3.0.0"
82
82
  },
83
83
  "devDependencies": {
84
84
  "@commitlint/cli": "^18.0.0",
85
85
  "@commitlint/config-conventional": "^18.0.0",
86
86
  "@neovici/cfg": "^1.18.0",
87
- "@neovici/cosmoz-viewinfo": "^3.1.0",
88
- "@open-wc/testing": "^3.0.0",
87
+ "@neovici/cosmoz-viewinfo": "^4.0.0",
88
+ "@open-wc/testing": "^4.0.0",
89
89
  "@polymer/iron-test-helpers": "^3.0.0",
90
90
  "@polymer/paper-button": "^3.0.0",
91
91
  "@polymer/paper-item": "^3.0.0",
@@ -1,5 +1,5 @@
1
1
  import { tagged as css } from '@neovici/cosmoz-utils';
2
- import { html, component } from 'haunted';
2
+ import { html, component } from '@pionjs/pion';
3
3
 
4
4
  const styles = css`
5
5
  :host {