@operato/app 10.24.0 → 10.26.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/CHANGELOG.md +17 -0
- package/coverage/lcov-report/base.css +224 -0
- package/coverage/lcov-report/block-navigation.js +87 -0
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +416 -0
- package/coverage/lcov-report/prettify.css +1 -0
- package/coverage/lcov-report/prettify.js +2 -0
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +210 -0
- package/coverage/lcov.info +15334 -0
- package/dist/src/grist-editor/ox-grist-renderer-resource-object.js +27 -1
- package/dist/src/grist-editor/ox-grist-renderer-resource-object.js.map +1 -1
- package/dist/test/resource-object-renderer-360.test.d.ts +1 -0
- package/dist/test/resource-object-renderer-360.test.js +66 -0
- package/dist/test/resource-object-renderer-360.test.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +7 -7
- package/test/resource-object-renderer-360.test.ts +75 -0
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@operato/app",
|
|
3
3
|
"description": "WebApplication production supporting components following open-wc recommendations",
|
|
4
4
|
"author": "heartyoh",
|
|
5
|
-
"version": "10.
|
|
5
|
+
"version": "10.26.0",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "dist/src/index.js",
|
|
8
8
|
"module": "dist/src/index.js",
|
|
@@ -148,16 +148,16 @@
|
|
|
148
148
|
"@graphql-tools/delegate": "^10.0.1",
|
|
149
149
|
"@graphql-tools/wrap": "^10.0.0",
|
|
150
150
|
"@material/web": "^2.0.0",
|
|
151
|
-
"@operato/attachment": "^10.
|
|
151
|
+
"@operato/attachment": "^10.26.0",
|
|
152
152
|
"@operato/data-grist": "^10.23.0",
|
|
153
|
-
"@operato/font": "^10.
|
|
153
|
+
"@operato/font": "^10.26.0",
|
|
154
154
|
"@operato/form": "^10.24.0",
|
|
155
155
|
"@operato/graphql": "^10.22.0",
|
|
156
156
|
"@operato/i18n": "^10.16.2",
|
|
157
157
|
"@operato/input": "^10.23.0",
|
|
158
|
-
"@operato/layout": "^10.
|
|
159
|
-
"@operato/property-editor": "^10.
|
|
160
|
-
"@operato/property-panel": "^10.
|
|
158
|
+
"@operato/layout": "^10.26.0",
|
|
159
|
+
"@operato/property-editor": "^10.26.0",
|
|
160
|
+
"@operato/property-panel": "^10.26.0",
|
|
161
161
|
"@operato/shell": "^10.23.0",
|
|
162
162
|
"@operato/styles": "^10.23.0",
|
|
163
163
|
"@operato/utils": "^10.22.0",
|
|
@@ -201,5 +201,5 @@
|
|
|
201
201
|
"prettier --write"
|
|
202
202
|
]
|
|
203
203
|
},
|
|
204
|
-
"gitHead": "
|
|
204
|
+
"gitHead": "32a85efa51835f023e631d7f5c41665f33cc9527"
|
|
205
205
|
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { expect } from '@open-wc/testing'
|
|
2
|
+
import { html } from 'lit-html'
|
|
3
|
+
|
|
4
|
+
import { registerEntity360Kind } from '@operato/layout'
|
|
5
|
+
import { OxGristRendererResourceObject } from '../src/grist-editor/ox-grist-renderer-resource-object.js'
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* The resource-object cell links a value to its 360 only when its kind is registered - and otherwise
|
|
9
|
+
* returns exactly what it always did (architect ruling on the person 360: dssp and fmsim render
|
|
10
|
+
* through this cell, and their screens must not change by a byte).
|
|
11
|
+
*
|
|
12
|
+
* `original` is the renderer as it stood before, kept verbatim here as the reference.
|
|
13
|
+
*/
|
|
14
|
+
function original(value: any, column: any) {
|
|
15
|
+
if (!value) {
|
|
16
|
+
return ''
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
var { nameField = 'name', descriptionField = 'description' } = column.record.options || {}
|
|
20
|
+
var name, description
|
|
21
|
+
|
|
22
|
+
if (typeof nameField === 'function') {
|
|
23
|
+
name = nameField(value)
|
|
24
|
+
} else {
|
|
25
|
+
name = value[nameField]
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
if (typeof descriptionField === 'function') {
|
|
29
|
+
description = descriptionField(value)
|
|
30
|
+
} else {
|
|
31
|
+
description = value[descriptionField] && `(${value[descriptionField]})`
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return html`<span>${name || ''}${description || ''}</span> `
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const column = (options?: any) => ({ record: { options } }) as any
|
|
38
|
+
const render = (value: any, col = column()) => (OxGristRendererResourceObject as any)(value, col, {}, 0, {})
|
|
39
|
+
|
|
40
|
+
/** A template's identity: the same static strings and the same values. */
|
|
41
|
+
const same = (a: any, b: any) => {
|
|
42
|
+
if (typeof a === 'string' || typeof b === 'string') return a === b
|
|
43
|
+
return a.strings === b.strings || (a.strings.join('\u0000') === b.strings.join('\u0000') && JSON.stringify(a.values) === JSON.stringify(b.values))
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
describe('resource-object cell and the entity 360', () => {
|
|
47
|
+
before(() => {
|
|
48
|
+
registerEntity360Kind({ kind: 'cell-test-person', typenames: ['CellTestUser'], title: s => s.value.name })
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
const unchanged = [
|
|
52
|
+
['an unregistered type', { __typename: 'SomethingElse', id: '1', name: 'Kim', description: 'QA' }],
|
|
53
|
+
['a value without __typename', { id: '1', name: 'Kim', description: 'QA' }],
|
|
54
|
+
['a value with a name only', { __typename: 'Nobody', id: '2', name: 'Lee' }],
|
|
55
|
+
['no value at all', null]
|
|
56
|
+
] as const
|
|
57
|
+
|
|
58
|
+
for (const [what, value] of unchanged) {
|
|
59
|
+
it(`★ ${what} renders exactly as before`, () => {
|
|
60
|
+
expect(same(render(value), original(value, column()))).to.equal(true)
|
|
61
|
+
})
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
it('★ and with custom name and description fields, still exactly as before', () => {
|
|
65
|
+
const col = column({ nameField: 'title', descriptionField: (v: any) => `[${v.code}]` })
|
|
66
|
+
const value = { __typename: 'Other', title: 'T', code: 'C' }
|
|
67
|
+
expect(same(render(value, col), original(value, col))).to.equal(true)
|
|
68
|
+
})
|
|
69
|
+
|
|
70
|
+
it('★ a registered type renders the name as a link to its 360', () => {
|
|
71
|
+
const result = render({ __typename: 'CellTestUser', id: '9', name: 'Park' })
|
|
72
|
+
expect(result.strings.join('')).to.contain('data-entity360')
|
|
73
|
+
expect(result.values).to.include('Park')
|
|
74
|
+
})
|
|
75
|
+
})
|