@rokkit/data 1.0.0-next.94 → 1.0.0-next.96
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 +13 -13
- package/src/index.js +1 -1
- package/src/model.js +3 -3
- package/src/types.js +9 -44
- package/src/view.js +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rokkit/data",
|
|
3
|
-
"version": "1.0.0-next.
|
|
3
|
+
"version": "1.0.0-next.96",
|
|
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",
|
|
@@ -12,15 +12,15 @@
|
|
|
12
12
|
"access": "public"
|
|
13
13
|
},
|
|
14
14
|
"devDependencies": {
|
|
15
|
-
"@sveltejs/vite-plugin-svelte": "^3.
|
|
16
|
-
"@testing-library/svelte": "^
|
|
17
|
-
"@types/ramda": "^0.
|
|
18
|
-
"@vitest/coverage-v8": "^1.
|
|
19
|
-
"@vitest/ui": "~1.
|
|
20
|
-
"typescript": "^5.4.
|
|
21
|
-
"vite": "^5.2.
|
|
22
|
-
"vitest": "~1.
|
|
23
|
-
"shared-config": "1.0.0-next.
|
|
15
|
+
"@sveltejs/vite-plugin-svelte": "^3.1.1",
|
|
16
|
+
"@testing-library/svelte": "^5.1.0",
|
|
17
|
+
"@types/ramda": "^0.30.0",
|
|
18
|
+
"@vitest/coverage-v8": "^1.6.0",
|
|
19
|
+
"@vitest/ui": "~1.6.0",
|
|
20
|
+
"typescript": "^5.4.5",
|
|
21
|
+
"vite": "^5.2.12",
|
|
22
|
+
"vitest": "~1.6.0",
|
|
23
|
+
"shared-config": "1.0.0-next.96"
|
|
24
24
|
},
|
|
25
25
|
"files": [
|
|
26
26
|
"src/**/*.js",
|
|
@@ -39,9 +39,9 @@
|
|
|
39
39
|
"@lukeed/uuid": "^2.0.1",
|
|
40
40
|
"d3-array": "^3.2.4",
|
|
41
41
|
"d3-collection": "^1.0.7",
|
|
42
|
-
"ramda": "^0.
|
|
43
|
-
"svelte": "^4.2.
|
|
44
|
-
"@rokkit/core": "1.0.0-next.
|
|
42
|
+
"ramda": "^0.30.1",
|
|
43
|
+
"svelte": "^4.2.17",
|
|
44
|
+
"@rokkit/core": "1.0.0-next.96"
|
|
45
45
|
},
|
|
46
46
|
"scripts": {
|
|
47
47
|
"format": "prettier --write .",
|
package/src/index.js
CHANGED
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
|
|
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
|
-
|
|
73
|
+
result.push({
|
|
74
74
|
name: key,
|
|
75
75
|
type: getType(value)
|
|
76
76
|
})
|
|
77
77
|
})
|
|
78
|
-
return
|
|
78
|
+
return result
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
/**
|
package/src/types.js
CHANGED
|
@@ -1,31 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* @typedef {'
|
|
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
|
-
|
|
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
|