@rokkit/data 1.0.0-next.94 → 1.0.0-next.95

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rokkit/data",
3
- "version": "1.0.0-next.94",
3
+ "version": "1.0.0-next.95",
4
4
  "description": "Contains generic data manipulation functions that can be used in various components.",
5
5
  "author": "Jerry Thomas <me@jerrythomas.name>",
6
6
  "license": "MIT",
@@ -20,7 +20,7 @@
20
20
  "typescript": "^5.4.4",
21
21
  "vite": "^5.2.8",
22
22
  "vitest": "~1.4.0",
23
- "shared-config": "1.0.0-next.94"
23
+ "shared-config": "1.0.0-next.95"
24
24
  },
25
25
  "files": [
26
26
  "src/**/*.js",
@@ -41,7 +41,7 @@
41
41
  "d3-collection": "^1.0.7",
42
42
  "ramda": "^0.29.1",
43
43
  "svelte": "^4.2.12",
44
- "@rokkit/core": "1.0.0-next.94"
44
+ "@rokkit/core": "1.0.0-next.95"
45
45
  },
46
46
  "scripts": {
47
47
  "format": "prettier --write .",
package/src/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import './types'
1
+ export * from './types'
2
2
  export * from './utils'
3
3
  export { renamer } from './renamer'
4
4
  export { model } from './model'
package/src/model.js CHANGED
@@ -63,19 +63,19 @@ export function model() {
63
63
  * @returns {Array} - the derived model
64
64
  */
65
65
  function deriveModel(data, sparse = false) {
66
- const model = []
66
+ const result = []
67
67
  let item = data
68
68
 
69
69
  if (Array.isArray(data)) item = sparse ? getDeepScanSample(data) : data[0]
70
70
 
71
71
  const kv = Object.entries(item)
72
72
  kv.forEach(([key, value]) => {
73
- model.push({
73
+ result.push({
74
74
  name: key,
75
75
  type: getType(value)
76
76
  })
77
77
  })
78
- return model
78
+ return result
79
79
  }
80
80
 
81
81
  /**
package/src/types.js CHANGED
@@ -1,31 +1,17 @@
1
1
  /**
2
- * Options for the sort order of the column.
3
- *
4
- * @typedef {'ascending'|'descending'|'none'} SortOptions
5
- */
6
-
7
- /**
8
- * Options for aligning text in a column.
9
- * @typedef {'left'|'center'|'right'|'justify'} HorizontalAlignOptions
10
- */
11
-
12
- /**
13
- * Options for the action type of the column.
14
- * @typedef {'edit'|'delete'|'select'} ActionTypes
15
- */
16
-
17
- /**
18
- * @typedef {'checked'|'unchecked'|'indeterminate'} SelectionState
19
- */
20
-
21
- /**
22
- * @typedef {string|[string,boolean]|ColumnSorter} SortableColumn
2
+ * @typedef {import('@rokkit/core').FieldMapping} FieldMapping
3
+ * @typedef {import('@rokkit/core').SortOptions} SortOptions
4
+ * @typedef {import('@rokkit/core').HorizontalAlignOptions} HorizontalAlignOptions
5
+ * @typedef {import('@rokkit/core').ActionTypes} ActionTypes
6
+ * @typedef {import('@rokkit/core').SelectionState} SelectionState
23
7
  */
24
8
 
25
9
  /**
26
10
  * @typedef {Object} ColumnSorter
27
11
  * @property {string} name
28
12
  * @property {function} sorter
13
+ *
14
+ * @typedef {string|[string,boolean]|ColumnSorter} SortableColumn
29
15
  */
30
16
 
31
17
  /**
@@ -44,28 +30,6 @@
44
30
  * @property {string} [separator='_'] - Separator to be used when adding prefix or suffix. defaults to _
45
31
  */
46
32
 
47
- /**
48
- * Structure to map custom fields for rendering. This is used to identofy the attributes for various purposes.
49
- *
50
- * @typedef FieldMapping
51
- * @property {string} [id='id'] Unique id for the item
52
- * @property {string} [text='text'] the text to render
53
- * @property {string} [value='value'] the value associated with the item
54
- * @property {string} [url='url'] a URL
55
- * @property {string} [icon='icon'] icon to render
56
- * @property {string} [image='image'] the image to render
57
- * @property {string} [children='children'] children of the item
58
- * @property {string} [summary='summary'] summary of the item
59
- * @property {string} [notes='notes'] notes for the item
60
- * @property {string} [props='props'] additional properties
61
- * @property {string} [isOpen='_open'] item is open or closed
62
- * @property {string} [level='level'] level of item
63
- * @property {string} [parent='parent'] item is a parent
64
- * @property {string} [currency='currency] column specifying currency to be used for the current value
65
- * @property {string} [isDeleted='_deleted'] item is deleted
66
- * @property {FieldMapping} [fields] Field mapping to be used on children in the next level
67
- */
68
-
69
33
  /**
70
34
  * Column metadata for the table.
71
35
  *
@@ -205,4 +169,5 @@
205
169
  * @property {Function} toggle - toggle expand or collapse the DataView by the specified columns.
206
170
  * @property {Function} select - select the DataView by the specified columns.
207
171
  */
208
- export {}
172
+
173
+ export default {}
package/src/view.js CHANGED
@@ -45,7 +45,7 @@ export function dataview(data, options) {
45
45
 
46
46
  return {
47
47
  ...omit(['set', 'update'], store),
48
- // filter: () => {},
48
+ // filter: noop,
49
49
  /**
50
50
  * Clears the applied sort order from the hierarchy.
51
51
  * TODO: clearing sort should clear the sort orders in columns