@operato/data-grist 10.29.63 → 10.29.64
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 +9 -0
- package/dist/src/filters/filters-form.js +4 -2
- package/dist/src/filters/filters-form.js.map +1 -1
- package/dist/test/list-defaults.test.d.ts +1 -0
- package/dist/test/list-defaults.test.js +31 -0
- package/dist/test/list-defaults.test.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/test/list-defaults.test.ts +33 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@operato/data-grist",
|
|
3
|
-
"version": "10.29.
|
|
3
|
+
"version": "10.29.64",
|
|
4
4
|
"description": "User interface for grid (desktop) and list (mobile)",
|
|
5
5
|
"author": "heartyoh",
|
|
6
6
|
"type": "module",
|
|
@@ -124,5 +124,5 @@
|
|
|
124
124
|
"prettier --write"
|
|
125
125
|
]
|
|
126
126
|
},
|
|
127
|
-
"gitHead": "
|
|
127
|
+
"gitHead": "4f468d8549d2caf1af6fc663d95825834cb81818"
|
|
128
128
|
}
|
|
@@ -3,6 +3,7 @@ import { html } from 'lit'
|
|
|
3
3
|
import { addressController, writeAddress } from '@operato/utils/address.js'
|
|
4
4
|
import type { DataGrist } from '../src/data-grist.js'
|
|
5
5
|
import '../src/data-grist.js'
|
|
6
|
+
import '../src/filters/filters-form.js'
|
|
6
7
|
|
|
7
8
|
/*
|
|
8
9
|
* An address without `filters` means the list's configured defaults, applied and written into the address; an
|
|
@@ -121,6 +122,38 @@ describe('list defaults and the shape of list operators', () => {
|
|
|
121
122
|
await until(() => reads[reads.length - 1]?.length === 0, 'read with none')
|
|
122
123
|
})
|
|
123
124
|
|
|
125
|
+
/*
|
|
126
|
+
* The form draws the conditions the list is read with. A select whose default was chosen away (filters=[]) shows no
|
|
127
|
+
* choice - it once drew its default again, so 「진행」 sat above a list of every item.
|
|
128
|
+
*/
|
|
129
|
+
it('a filter chosen away shows no choice in the form, its default neither', async () => {
|
|
130
|
+
const stateColumn = { name: 'state', header: 'state', type: 'select', filter: { operator: 'eq', value: 'GOING', options: ['GOING', 'ENDED'] } }
|
|
131
|
+
const shown = async (address: string) => {
|
|
132
|
+
await writeAddress(address)
|
|
133
|
+
addressController().registerQuery()
|
|
134
|
+
reads = []
|
|
135
|
+
const grist = await fixture<DataGrist>(
|
|
136
|
+
html`<ox-grist
|
|
137
|
+
style="display:block;width:800px;height:400px"
|
|
138
|
+
.urlParamsSensitive=${true}
|
|
139
|
+
.config=${{ columns: [stateColumn], pagination: { limit: 20 } }}
|
|
140
|
+
.fetchHandler=${async ({ filters }: any) => {
|
|
141
|
+
reads.push(filters)
|
|
142
|
+
return { records: [], total: 0 }
|
|
143
|
+
}}
|
|
144
|
+
><div slot="headroom"><ox-filters-form without-search></ox-filters-form></div
|
|
145
|
+
></ox-grist>`
|
|
146
|
+
)
|
|
147
|
+
await until(() => reads.length > 0, 'first read')
|
|
148
|
+
const form = grist.querySelector('ox-filters-form') as any
|
|
149
|
+
await form.updateComplete
|
|
150
|
+
return (form.renderRoot as ShadowRoot).querySelector('ox-select[name="state"]') as any
|
|
151
|
+
}
|
|
152
|
+
expect((await shown('?defaults=select'))?.value).to.equal('GOING')
|
|
153
|
+
expect((await shown('?filters=[]'))?.value ?? '').to.equal('')
|
|
154
|
+
expect(reads[reads.length - 1]).to.deep.equal([])
|
|
155
|
+
})
|
|
156
|
+
|
|
124
157
|
it('a single choice given as a scalar is read as a one-element array', async () => {
|
|
125
158
|
await writeAddress("?filters=[{name:'type',operator:'in',value:'sub'}]")
|
|
126
159
|
await mount()
|