@operato/data-grist 10.29.73 → 10.29.76
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 +24 -0
- package/dist/src/data-card/record-card.js +1 -1
- package/dist/src/data-card/record-card.js.map +1 -1
- package/dist/src/data-grid/data-grid-field.js +18 -0
- package/dist/src/data-grid/data-grid-field.js.map +1 -1
- package/dist/src/data-list/data-list-field.js +4 -1
- package/dist/src/data-list/data-list-field.js.map +1 -1
- package/dist/src/data-list/record-partial.js +15 -1
- package/dist/src/data-list/record-partial.js.map +1 -1
- package/dist/src/filters/filter-checkbox.js +1 -1
- package/dist/src/filters/filter-checkbox.js.map +1 -1
- package/dist/src/filters/filter-input-barcode.js +1 -1
- package/dist/src/filters/filter-input-barcode.js.map +1 -1
- package/dist/src/filters/filter-input.js +1 -1
- package/dist/src/filters/filter-input.js.map +1 -1
- package/dist/src/filters/filter-range-date.js +1 -1
- package/dist/src/filters/filter-range-date.js.map +1 -1
- package/dist/src/filters/filter-range-number.js +1 -1
- package/dist/src/filters/filter-range-number.js.map +1 -1
- package/dist/src/filters/filter-select-buttons.js +1 -1
- package/dist/src/filters/filter-select-buttons.js.map +1 -1
- package/dist/src/gutters/gutter-button.js +6 -1
- package/dist/src/gutters/gutter-button.js.map +1 -1
- package/dist/src/types.d.ts +1 -1
- package/dist/src/types.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +9 -9
- package/test/cell-button-row-height.test.ts +63 -0
- package/test/group-heading.test.ts +23 -0
- package/test/office-density.test.ts +57 -0
- package/dist/test/accessible-name.test.d.ts +0 -2
- package/dist/test/accessible-name.test.js +0 -324
- package/dist/test/accessible-name.test.js.map +0 -1
- package/dist/test/accumulator-labels.test.d.ts +0 -1
- package/dist/test/accumulator-labels.test.js +0 -32
- package/dist/test/accumulator-labels.test.js.map +0 -1
- package/dist/test/address-intents.test.d.ts +0 -1
- package/dist/test/address-intents.test.js +0 -201
- package/dist/test/address-intents.test.js.map +0 -1
- package/dist/test/card-selector.test.d.ts +0 -1
- package/dist/test/card-selector.test.js +0 -58
- package/dist/test/card-selector.test.js.map +0 -1
- package/dist/test/card-thumb.test.d.ts +0 -1
- package/dist/test/card-thumb.test.js +0 -44
- package/dist/test/card-thumb.test.js.map +0 -1
- package/dist/test/card-totals-narrow.test.d.ts +0 -1
- package/dist/test/card-totals-narrow.test.js +0 -103
- package/dist/test/card-totals-narrow.test.js.map +0 -1
- package/dist/test/column-resize.test.d.ts +0 -1
- package/dist/test/column-resize.test.js +0 -153
- package/dist/test/column-resize.test.js.map +0 -1
- package/dist/test/control-heights.test.d.ts +0 -1
- package/dist/test/control-heights.test.js +0 -25
- package/dist/test/control-heights.test.js.map +0 -1
- package/dist/test/count-handler.test.d.ts +0 -1
- package/dist/test/count-handler.test.js +0 -56
- package/dist/test/count-handler.test.js.map +0 -1
- package/dist/test/create-paste-policy.test.d.ts +0 -1
- package/dist/test/create-paste-policy.test.js +0 -159
- package/dist/test/create-paste-policy.test.js.map +0 -1
- package/dist/test/data-integrity.test.d.ts +0 -1
- package/dist/test/data-integrity.test.js +0 -145
- package/dist/test/data-integrity.test.js.map +0 -1
- package/dist/test/destructive-actions.test.d.ts +0 -11
- package/dist/test/destructive-actions.test.js +0 -147
- package/dist/test/destructive-actions.test.js.map +0 -1
- package/dist/test/edit-lifecycle.test.d.ts +0 -2
- package/dist/test/edit-lifecycle.test.js +0 -270
- package/dist/test/edit-lifecycle.test.js.map +0 -1
- package/dist/test/edit-rebase.test.d.ts +0 -1
- package/dist/test/edit-rebase.test.js +0 -185
- package/dist/test/edit-rebase.test.js.map +0 -1
- package/dist/test/editor-commit.test.d.ts +0 -2
- package/dist/test/editor-commit.test.js +0 -68
- package/dist/test/editor-commit.test.js.map +0 -1
- package/dist/test/fetch-failure-state.test.d.ts +0 -1
- package/dist/test/fetch-failure-state.test.js +0 -129
- package/dist/test/fetch-failure-state.test.js.map +0 -1
- package/dist/test/field-contains-content.test.d.ts +0 -1
- package/dist/test/field-contains-content.test.js +0 -101
- package/dist/test/field-contains-content.test.js.map +0 -1
- package/dist/test/field-hint.test.d.ts +0 -2
- package/dist/test/field-hint.test.js +0 -54
- package/dist/test/field-hint.test.js.map +0 -1
- package/dist/test/filter-labels.test.d.ts +0 -2
- package/dist/test/filter-labels.test.js +0 -140
- package/dist/test/filter-labels.test.js.map +0 -1
- package/dist/test/filter-ownership.test.d.ts +0 -1
- package/dist/test/filter-ownership.test.js +0 -83
- package/dist/test/filter-ownership.test.js.map +0 -1
- package/dist/test/filter-select-buttons-count.test.d.ts +0 -1
- package/dist/test/filter-select-buttons-count.test.js +0 -35
- package/dist/test/filter-select-buttons-count.test.js.map +0 -1
- package/dist/test/filter-typing.test.d.ts +0 -2
- package/dist/test/filter-typing.test.js +0 -66
- package/dist/test/filter-typing.test.js.map +0 -1
- package/dist/test/filters-phone-wrap.test.d.ts +0 -1
- package/dist/test/filters-phone-wrap.test.js +0 -17
- package/dist/test/filters-phone-wrap.test.js.map +0 -1
- package/dist/test/first-click-stays.test.d.ts +0 -1
- package/dist/test/first-click-stays.test.js +0 -77
- package/dist/test/first-click-stays.test.js.map +0 -1
- package/dist/test/fixed-column-opaque.test.d.ts +0 -1
- package/dist/test/fixed-column-opaque.test.js +0 -134
- package/dist/test/fixed-column-opaque.test.js.map +0 -1
- package/dist/test/flexible-columns.test.d.ts +0 -1
- package/dist/test/flexible-columns.test.js +0 -134
- package/dist/test/flexible-columns.test.js.map +0 -1
- package/dist/test/grid-single-scroller.test.d.ts +0 -1
- package/dist/test/grid-single-scroller.test.js +0 -107
- package/dist/test/grid-single-scroller.test.js.map +0 -1
- package/dist/test/group-heading.test.d.ts +0 -1
- package/dist/test/group-heading.test.js +0 -187
- package/dist/test/group-heading.test.js.map +0 -1
- package/dist/test/latest-fetch-wins.test.d.ts +0 -1
- package/dist/test/latest-fetch-wins.test.js +0 -91
- package/dist/test/latest-fetch-wins.test.js.map +0 -1
- package/dist/test/list-defaults.test.d.ts +0 -2
- package/dist/test/list-defaults.test.js +0 -145
- package/dist/test/list-defaults.test.js.map +0 -1
- package/dist/test/list-records.test.d.ts +0 -1
- package/dist/test/list-records.test.js +0 -46
- package/dist/test/list-records.test.js.map +0 -1
- package/dist/test/page-errors.d.ts +0 -1
- package/dist/test/page-errors.js +0 -44
- package/dist/test/page-errors.js.map +0 -1
- package/dist/test/paste-integrity.test.d.ts +0 -1
- package/dist/test/paste-integrity.test.js +0 -163
- package/dist/test/paste-integrity.test.js.map +0 -1
- package/dist/test/record-card-height.test.d.ts +0 -1
- package/dist/test/record-card-height.test.js +0 -15
- package/dist/test/record-card-height.test.js.map +0 -1
- package/dist/test/record-view-popup-editor.test.d.ts +0 -1
- package/dist/test/record-view-popup-editor.test.js +0 -71
- package/dist/test/record-view-popup-editor.test.js.map +0 -1
- package/dist/test/renderer-date-calendar-day.test.d.ts +0 -1
- package/dist/test/renderer-date-calendar-day.test.js +0 -48
- package/dist/test/renderer-date-calendar-day.test.js.map +0 -1
- package/dist/test/request-generation.test.d.ts +0 -1
- package/dist/test/request-generation.test.js +0 -153
- package/dist/test/request-generation.test.js.map +0 -1
- package/dist/test/resubmit.test.d.ts +0 -1
- package/dist/test/resubmit.test.js +0 -83
- package/dist/test/resubmit.test.js.map +0 -1
- package/dist/test/row-hover-visible.test.d.ts +0 -1
- package/dist/test/row-hover-visible.test.js +0 -139
- package/dist/test/row-hover-visible.test.js.map +0 -1
- package/dist/test/search-term.test.d.ts +0 -1
- package/dist/test/search-term.test.js +0 -108
- package/dist/test/search-term.test.js.map +0 -1
- package/dist/test/searchable-select.test.d.ts +0 -1
- package/dist/test/searchable-select.test.js +0 -65
- package/dist/test/searchable-select.test.js.map +0 -1
- package/dist/test/select-empty-value.test.d.ts +0 -1
- package/dist/test/select-empty-value.test.js +0 -61
- package/dist/test/select-empty-value.test.js.map +0 -1
- package/dist/test/shift-range-select.test.d.ts +0 -1
- package/dist/test/shift-range-select.test.js +0 -100
- package/dist/test/shift-range-select.test.js.map +0 -1
- package/dist/test/sparkline-renderer.test.d.ts +0 -1
- package/dist/test/sparkline-renderer.test.js +0 -36
- package/dist/test/sparkline-renderer.test.js.map +0 -1
- package/dist/test/wheel-one-scroller.test.d.ts +0 -2
- package/dist/test/wheel-one-scroller.test.js +0 -275
- package/dist/test/wheel-one-scroller.test.js.map +0 -1
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
/* Elements are compared by presence, not by value: a failing element comparison makes chai render the DOM and hang the runner. */
|
|
2
|
-
import { expect, fixture } from '@open-wc/testing';
|
|
3
|
-
import { executeServerCommand, sendMouse } from '@web/test-runner-commands';
|
|
4
|
-
import { html } from 'lit';
|
|
5
|
-
import '../src/data-grist.js';
|
|
6
|
-
const settle = (ms = 150) => new Promise(resolve => setTimeout(resolve, ms));
|
|
7
|
-
const LONG = 'A long counterparty name that does not fit its column';
|
|
8
|
-
async function grid({ editable = false, nameWidth = 120 } = {}) {
|
|
9
|
-
const columns = [
|
|
10
|
-
{ type: 'string', name: 'id', hidden: true },
|
|
11
|
-
{ type: 'string', name: 'name', header: 'name', width: nameWidth, record: { editable } },
|
|
12
|
-
{ type: 'string', name: 'code', header: 'code', width: 100, record: { editable } },
|
|
13
|
-
/* Text and a mark side by side, as the cash list's counterparty and its 「미등록」: long text pushes the mark out. */
|
|
14
|
-
{
|
|
15
|
-
type: 'string',
|
|
16
|
-
name: 'memo',
|
|
17
|
-
header: 'memo',
|
|
18
|
-
width: 120,
|
|
19
|
-
record: {
|
|
20
|
-
editable,
|
|
21
|
-
renderer: (value) => html `${value} <span style="font-size: 11px; font-weight: 600">unregistered</span>`
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
];
|
|
25
|
-
const records = Array.from({ length: 5 }, (_, r) => ({ id: String(r), name: r === 3 ? LONG : 'short', code: 'C-' + r, memo: r === 2 ? LONG : 'note' }));
|
|
26
|
-
const el = (await fixture(html `
|
|
27
|
-
<ox-grist
|
|
28
|
-
style="width: 900px; height: 300px"
|
|
29
|
-
mode="GRID"
|
|
30
|
-
.config=${{ columns, pagination: { infinite: true }, rows: { appendable: false, selectable: false } }}
|
|
31
|
-
.data=${{ records }}
|
|
32
|
-
></ox-grist>
|
|
33
|
-
`));
|
|
34
|
-
await settle();
|
|
35
|
-
await el.updateComplete;
|
|
36
|
-
const ox = el.renderRoot.querySelector('#grist');
|
|
37
|
-
await ox.updateComplete;
|
|
38
|
-
const header = ox.renderRoot.querySelector('ox-grid-header');
|
|
39
|
-
const body = ox.renderRoot.querySelector('ox-grid-body');
|
|
40
|
-
await body.updateComplete;
|
|
41
|
-
await settle(50);
|
|
42
|
-
return { ox, header, body };
|
|
43
|
-
}
|
|
44
|
-
const heads = (header) => Array.from(header.renderRoot.querySelectorAll('[role=columnheader]'));
|
|
45
|
-
const width = (element) => Math.round(element.getBoundingClientRect().width);
|
|
46
|
-
const handle = (head) => head.querySelector('span[splitter]');
|
|
47
|
-
function centre(element) {
|
|
48
|
-
const r = element.getBoundingClientRect();
|
|
49
|
-
return [Math.round(r.left + r.width / 2), Math.round(r.top + r.height / 2)];
|
|
50
|
-
}
|
|
51
|
-
/** Whether the text of any cell of the column under this header is cut - the cell itself, or text it ends with "…". */
|
|
52
|
-
function cut(head, body) {
|
|
53
|
-
const left = head.getBoundingClientRect().left;
|
|
54
|
-
return Array.from(body.renderRoot.querySelectorAll('ox-grid-field'))
|
|
55
|
-
.filter(cell => Math.abs(cell.getBoundingClientRect().left - left) < 1)
|
|
56
|
-
.some(cell => [cell, ...Array.from(cell.renderRoot.querySelectorAll('*'))]
|
|
57
|
-
.filter(e => e === cell || getComputedStyle(e).textOverflow === 'ellipsis')
|
|
58
|
-
.some(e => e.scrollWidth > e.clientWidth + 1));
|
|
59
|
-
}
|
|
60
|
-
async function drag(from, by) {
|
|
61
|
-
await sendMouse({ type: 'move', position: from });
|
|
62
|
-
await sendMouse({ type: 'down' });
|
|
63
|
-
await sendMouse({ type: 'move', position: [from[0] + by, from[1]] });
|
|
64
|
-
await sendMouse({ type: 'up' });
|
|
65
|
-
await settle(300);
|
|
66
|
-
}
|
|
67
|
-
async function doubleClick([x, y]) {
|
|
68
|
-
await executeServerCommand('send-double-click', { x, y });
|
|
69
|
-
await settle(300);
|
|
70
|
-
}
|
|
71
|
-
describe('a column edge', () => {
|
|
72
|
-
/* Resizing the grid body inside a fixture trips Chrome's benign "ResizeObserver loop" error. */
|
|
73
|
-
const ignoreResizeLoop = (e) => {
|
|
74
|
-
if (String(e.message).includes('ResizeObserver loop')) {
|
|
75
|
-
e.stopImmediatePropagation();
|
|
76
|
-
e.preventDefault();
|
|
77
|
-
}
|
|
78
|
-
};
|
|
79
|
-
let previousOnError = null;
|
|
80
|
-
before(() => {
|
|
81
|
-
window.addEventListener('error', ignoreResizeLoop, true);
|
|
82
|
-
previousOnError = window.onerror;
|
|
83
|
-
window.onerror = (message, ...rest) => String(message).includes('ResizeObserver loop') ? true : previousOnError === null || previousOnError === void 0 ? void 0 : previousOnError.call(window, message, ...rest);
|
|
84
|
-
});
|
|
85
|
-
afterEach(async () => {
|
|
86
|
-
await sendMouse({ type: 'move', position: [0, 0] });
|
|
87
|
-
});
|
|
88
|
-
after(() => {
|
|
89
|
-
window.removeEventListener('error', ignoreResizeLoop, true);
|
|
90
|
-
window.onerror = previousOnError;
|
|
91
|
-
});
|
|
92
|
-
describe('on a read-only grid', () => {
|
|
93
|
-
it('has a handle that draws no line and leaves the header as it was', async () => {
|
|
94
|
-
const { header } = await grid();
|
|
95
|
-
const name = heads(header)[0];
|
|
96
|
-
const splitter = handle(name);
|
|
97
|
-
expect(!!splitter, 'the handle is there').to.equal(true);
|
|
98
|
-
expect(getComputedStyle(splitter).borderRightColor, 'no line').to.equal('rgba(0, 0, 0, 0)');
|
|
99
|
-
expect(parseFloat(getComputedStyle(name).paddingRight), 'the right padding stays').to.be.greaterThan(0);
|
|
100
|
-
expect(width(splitter), 'the handle is narrow').to.be.at.most(8);
|
|
101
|
-
});
|
|
102
|
-
it('draws its line while the pointer is on it', async () => {
|
|
103
|
-
const { header } = await grid();
|
|
104
|
-
const splitter = handle(heads(header)[0]);
|
|
105
|
-
await sendMouse({ type: 'move', position: centre(splitter) });
|
|
106
|
-
await settle(100);
|
|
107
|
-
expect(getComputedStyle(splitter).borderRightColor).not.to.equal('rgba(0, 0, 0, 0)');
|
|
108
|
-
});
|
|
109
|
-
it('can be dragged to widen the column', async () => {
|
|
110
|
-
const { header } = await grid();
|
|
111
|
-
const name = heads(header)[0];
|
|
112
|
-
const before = width(name);
|
|
113
|
-
await drag(centre(handle(name)), 40);
|
|
114
|
-
expect(width(heads(header)[0])).to.be.within(before + 35, before + 45);
|
|
115
|
-
});
|
|
116
|
-
});
|
|
117
|
-
for (const editable of [false, true]) {
|
|
118
|
-
describe(`on ${editable ? 'an editable' : 'a read-only'} grid, a double-click`, () => {
|
|
119
|
-
it('widens the column until no cell in it is cut', async () => {
|
|
120
|
-
const { header, body } = await grid({ editable });
|
|
121
|
-
const name = heads(header)[0];
|
|
122
|
-
expect(cut(name, body), 'the long name is cut to begin with').to.equal(true);
|
|
123
|
-
const before = width(name);
|
|
124
|
-
await doubleClick(centre(handle(name)));
|
|
125
|
-
const after = heads(header)[0];
|
|
126
|
-
expect(width(after)).to.be.greaterThan(before);
|
|
127
|
-
expect(cut(after, body)).to.equal(false);
|
|
128
|
-
});
|
|
129
|
-
it('leaves a column whose cells all fit as it is', async () => {
|
|
130
|
-
const { header } = await grid({ editable });
|
|
131
|
-
const code = heads(header)[1];
|
|
132
|
-
const before = width(code);
|
|
133
|
-
await doubleClick(centre(handle(code)));
|
|
134
|
-
expect(width(heads(header)[1])).to.equal(before);
|
|
135
|
-
});
|
|
136
|
-
it('widens a column of text and a mark until the mark is back', async () => {
|
|
137
|
-
const { header, body } = await grid({ editable });
|
|
138
|
-
const memo = heads(header)[2];
|
|
139
|
-
expect(cut(memo, body), 'the long text pushes the mark out to begin with').to.equal(true);
|
|
140
|
-
await doubleClick(centre(handle(memo)));
|
|
141
|
-
expect(cut(heads(header)[2], body)).to.equal(false);
|
|
142
|
-
});
|
|
143
|
-
});
|
|
144
|
-
}
|
|
145
|
-
it('does nothing on a click that does not drag (an fr column stays flexible)', async () => {
|
|
146
|
-
const { ox, header } = await grid({ editable: true, nameWidth: 'minmax(120px, 1fr)' });
|
|
147
|
-
const before = ox.style.getPropertyValue('--grid-template-columns');
|
|
148
|
-
await sendMouse({ type: 'click', position: centre(handle(heads(header)[0])) });
|
|
149
|
-
await settle(300);
|
|
150
|
-
expect(ox.style.getPropertyValue('--grid-template-columns')).to.equal(before);
|
|
151
|
-
});
|
|
152
|
-
});
|
|
153
|
-
//# sourceMappingURL=column-resize.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"column-resize.test.js","sourceRoot":"","sources":["../../test/column-resize.test.ts"],"names":[],"mappings":"AAAA,kIAAkI;AAClI,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAClD,OAAO,EAAE,oBAAoB,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAA;AAC3E,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAE1B,OAAO,sBAAsB,CAAA;AAoB7B,MAAM,MAAM,GAAG,CAAC,EAAE,GAAG,GAAG,EAAE,EAAE,CAAC,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAA;AAE5E,MAAM,IAAI,GAAG,uDAAuD,CAAA;AAEpE,KAAK,UAAU,IAAI,CAAC,EAAE,QAAQ,GAAG,KAAK,EAAE,SAAS,GAAG,GAAsB,KAAK,EAAE;IAC/E,MAAM,OAAO,GAAU;QACrB,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE;QAC5C,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EA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AC,KAAK,CAAC,IAAI,CAAC,CAAA;gBACzF,MAAM,WAAW,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAE,CAAC,CAAC,CAAA;gBAExC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;YACrD,CAAC,CAAC,CAAA;QACJ,CAAC,CAAC,CAAA;IACJ,CAAC;IAED,EAAE,CAAC,0EAA0E,EAAE,KAAK,IAAI,EAAE;QACxF,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,GAAG,MAAM,IAAI,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,oBAAoB,EAAE,CAAC,CAAA;QAEtF,MAAM,MAAM,GAAG,EAAE,CAAC,KAAK,CAAC,gBAAgB,CAAC,yBAAyB,CAAC,CAAA;QACnE,MAAM,SAAS,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAE,CAAC,EAAE,CAAC,CAAA;QAC/E,MAAM,MAAM,CAAC,GAAG,CAAC,CAAA;QAEjB,MAAM,CAAC,EAAE,CAAC,KAAK,CAAC,gBAAgB,CAAC,yBAAyB,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,CAAA;IAC/E,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA","sourcesContent":["/* Elements are compared by presence, not by value: a failing element comparison makes chai render the DOM and hang the runner. */\nimport { expect, fixture } from '@open-wc/testing'\nimport { executeServerCommand, sendMouse } from '@web/test-runner-commands'\nimport { html } from 'lit'\n\nimport '../src/data-grist.js'\n\n/**\n * A column's edge can be dragged and double-clicked on every grid.\n *\n * The handle on a column's edge also draws the grid's vertical line, and a grid with nothing to edit\n * hides its lines (--grid-header-splitter-display: none) - which took the handle with them. A read\n * list then had no way to widen a column whose text was cut, though reading is what it is for.\n *\n * ```\n * read-only the handle stays and draws no line until the pointer is on it or drags it; the header\n * keeps the look it had without one (its right padding, its name not pushed)\n * drag dragging the edge sets the width, on a read-only grid as on an editable one\n * fit double-clicking the edge widens the column until no cell in it is cut, header included\n * click a click that does not drag changes nothing (an fr column stays flexible)\n * ```\n */\n\ntype Root = HTMLElement & { renderRoot: ShadowRoot; updateComplete: Promise<unknown> }\n\nconst settle = (ms = 150) => new Promise(resolve => setTimeout(resolve, ms))\n\nconst LONG = 'A long counterparty name that does not fit its column'\n\nasync function grid({ editable = false, nameWidth = 120 as number | string } = {}) {\n const columns: any[] = [\n { type: 'string', name: 'id', hidden: true },\n { type: 'string', name: 'name', header: 'name', width: nameWidth, record: { editable } },\n { type: 'string', name: 'code', header: 'code', width: 100, record: { editable } },\n /* Text and a mark side by side, as the cash list's counterparty and its 「미등록」: long text pushes the mark out. */\n {\n type: 'string',\n name: 'memo',\n header: 'memo',\n width: 120,\n record: {\n editable,\n renderer: (value: string) => html`${value} <span style=\"font-size: 11px; font-weight: 600\">unregistered</span>`\n }\n }\n ]\n const records = Array.from({ length: 5 }, (_, r) => ({ id: String(r), name: r === 3 ? LONG : 'short', code: 'C-' + r, memo: r === 2 ? LONG : 'note' }))\n\n const el = (await fixture(html`\n <ox-grist\n style=\"width: 900px; height: 300px\"\n mode=\"GRID\"\n .config=${{ columns, pagination: { infinite: true }, rows: { appendable: false, selectable: false } }}\n .data=${{ records }}\n ></ox-grist>\n `)) as Root\n\n await settle()\n await el.updateComplete\n const ox = el.renderRoot.querySelector('#grist') as Root\n await ox.updateComplete\n const header = ox.renderRoot.querySelector('ox-grid-header') as Root\n const body = ox.renderRoot.querySelector('ox-grid-body') as Root\n await body.updateComplete\n await settle(50)\n\n return { ox, header, body }\n}\n\nconst heads = (header: Root) => Array.from(header.renderRoot.querySelectorAll('[role=columnheader]')) as HTMLElement[]\nconst width = (element: Element) => Math.round(element.getBoundingClientRect().width)\nconst handle = (head: HTMLElement) => head.querySelector('span[splitter]') as HTMLElement | null\n\nfunction centre(element: Element): [number, number] {\n const r = element.getBoundingClientRect()\n return [Math.round(r.left + r.width / 2), Math.round(r.top + r.height / 2)]\n}\n\n/** Whether the text of any cell of the column under this header is cut - the cell itself, or text it ends with \"…\". */\nfunction cut(head: HTMLElement, body: Root) {\n const left = head.getBoundingClientRect().left\n return (Array.from(body.renderRoot.querySelectorAll('ox-grid-field')) as Root[])\n .filter(cell => Math.abs(cell.getBoundingClientRect().left - left) < 1)\n .some(cell =>\n [cell, ...Array.from(cell.renderRoot.querySelectorAll('*'))]\n .filter(e => e === cell || getComputedStyle(e).textOverflow === 'ellipsis')\n .some(e => e.scrollWidth > e.clientWidth + 1)\n )\n}\n\nasync function drag(from: [number, number], by: number) {\n await sendMouse({ type: 'move', position: from })\n await sendMouse({ type: 'down' })\n await sendMouse({ type: 'move', position: [from[0] + by, from[1]] })\n await sendMouse({ type: 'up' })\n await settle(300)\n}\n\nasync function doubleClick([x, y]: [number, number]) {\n await executeServerCommand('send-double-click', { x, y })\n await settle(300)\n}\n\ndescribe('a column edge', () => {\n /* Resizing the grid body inside a fixture trips Chrome's benign \"ResizeObserver loop\" error. */\n const ignoreResizeLoop = (e: ErrorEvent) => {\n if (String(e.message).includes('ResizeObserver loop')) {\n e.stopImmediatePropagation()\n e.preventDefault()\n }\n }\n let previousOnError: OnErrorEventHandler = null\n before(() => {\n window.addEventListener('error', ignoreResizeLoop, true)\n previousOnError = window.onerror\n window.onerror = (message, ...rest) =>\n String(message).includes('ResizeObserver loop') ? true : previousOnError?.call(window, message, ...rest)\n })\n afterEach(async () => {\n await sendMouse({ type: 'move', position: [0, 0] })\n })\n after(() => {\n window.removeEventListener('error', ignoreResizeLoop, true)\n window.onerror = previousOnError\n })\n\n describe('on a read-only grid', () => {\n it('has a handle that draws no line and leaves the header as it was', async () => {\n const { header } = await grid()\n\n const name = heads(header)[0]\n const splitter = handle(name)\n expect(!!splitter, 'the handle is there').to.equal(true)\n expect(getComputedStyle(splitter!).borderRightColor, 'no line').to.equal('rgba(0, 0, 0, 0)')\n expect(parseFloat(getComputedStyle(name).paddingRight), 'the right padding stays').to.be.greaterThan(0)\n expect(width(splitter!), 'the handle is narrow').to.be.at.most(8)\n })\n\n it('draws its line while the pointer is on it', async () => {\n const { header } = await grid()\n\n const splitter = handle(heads(header)[0])!\n await sendMouse({ type: 'move', position: centre(splitter) })\n await settle(100)\n\n expect(getComputedStyle(splitter).borderRightColor).not.to.equal('rgba(0, 0, 0, 0)')\n })\n\n it('can be dragged to widen the column', async () => {\n const { header } = await grid()\n\n const name = heads(header)[0]\n const before = width(name)\n await drag(centre(handle(name)!), 40)\n\n expect(width(heads(header)[0])).to.be.within(before + 35, before + 45)\n })\n })\n\n for (const editable of [false, true]) {\n describe(`on ${editable ? 'an editable' : 'a read-only'} grid, a double-click`, () => {\n it('widens the column until no cell in it is cut', async () => {\n const { header, body } = await grid({ editable })\n\n const name = heads(header)[0]\n expect(cut(name, body), 'the long name is cut to begin with').to.equal(true)\n const before = width(name)\n await doubleClick(centre(handle(name)!))\n\n const after = heads(header)[0]\n expect(width(after)).to.be.greaterThan(before)\n expect(cut(after, body)).to.equal(false)\n })\n\n it('leaves a column whose cells all fit as it is', async () => {\n const { header } = await grid({ editable })\n\n const code = heads(header)[1]\n const before = width(code)\n await doubleClick(centre(handle(code)!))\n\n expect(width(heads(header)[1])).to.equal(before)\n })\n\n it('widens a column of text and a mark until the mark is back', async () => {\n const { header, body } = await grid({ editable })\n\n const memo = heads(header)[2]\n expect(cut(memo, body), 'the long text pushes the mark out to begin with').to.equal(true)\n await doubleClick(centre(handle(memo)!))\n\n expect(cut(heads(header)[2], body)).to.equal(false)\n })\n })\n }\n\n it('does nothing on a click that does not drag (an fr column stays flexible)', async () => {\n const { ox, header } = await grid({ editable: true, nameWidth: 'minmax(120px, 1fr)' })\n\n const before = ox.style.getPropertyValue('--grid-template-columns')\n await sendMouse({ type: 'click', position: centre(handle(heads(header)[0])!) })\n await settle(300)\n\n expect(ox.style.getPropertyValue('--grid-template-columns')).to.equal(before)\n })\n})\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { expect } from '@open-wc/testing';
|
|
2
|
-
import { DataGridField } from '../src/data-grid/data-grid-field.js';
|
|
3
|
-
import { FilterStyles } from '../src/filters/filter-styles.js';
|
|
4
|
-
/**
|
|
5
|
-
* A button inside a grid cell is --cell-action-height (26px by default, ADR-0060 decision 6), for its
|
|
6
|
-
* width as well: a second token for the width could say a different number. It still takes no more
|
|
7
|
-
* than a line of text in the row, so one cell with a button does not make every row taller.
|
|
8
|
-
*/
|
|
9
|
-
const text = (styles) => (Array.isArray(styles) ? styles : [styles]).map(s => { var _a; return String((_a = s.cssText) !== null && _a !== void 0 ? _a : s); }).join('\n');
|
|
10
|
-
describe('cell action height', () => {
|
|
11
|
-
it('the icon button in a cell reads the cell token for height and width', () => {
|
|
12
|
-
const css = text(DataGridField.styles);
|
|
13
|
-
const rule = css.slice(css.indexOf(':host > button.icon {'));
|
|
14
|
-
expect(rule).to.match(/^:host > button\.icon \{[^}]*width: var\(--cell-action-height, 26px\);/);
|
|
15
|
-
expect(rule).to.match(/^:host > button\.icon \{[^}]*height: var\(--cell-action-height, 26px\);/);
|
|
16
|
-
expect(rule).to.contain('margin-top: calc((20px - var(--cell-action-height, 26px)) / 2)');
|
|
17
|
-
});
|
|
18
|
-
});
|
|
19
|
-
describe('filter bar input height', () => {
|
|
20
|
-
it('a grid filter bar: the suite small height in the operato products, natural height elsewhere', () => {
|
|
21
|
-
const css = text(FilterStyles);
|
|
22
|
-
expect(css).to.match(/box-sizing: border-box;\s*height: var\(--suite-form-element-height-small, auto\);/);
|
|
23
|
-
});
|
|
24
|
-
});
|
|
25
|
-
//# sourceMappingURL=control-heights.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
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,CAAC,YAAY,CAAC,CAAA;QAC9B,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,mFAAmF,CAAC,CAAA;IAC3G,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA","sourcesContent":["import { expect } from '@open-wc/testing'\n\nimport { DataGridField } from '../src/data-grid/data-grid-field.js'\nimport { FilterStyles } from '../src/filters/filter-styles.js'\n\n/**\n * A button inside a grid cell is --cell-action-height (26px by default, ADR-0060 decision 6), for its\n * width as well: a second token for the width could say a different number. It still takes no more\n * than a line of text in the row, so one cell with a button does not make every row taller.\n */\n\nconst text = (styles: unknown) =>\n (Array.isArray(styles) ? styles : [styles]).map(s => String((s as { cssText?: string }).cssText ?? s)).join('\\n')\n\ndescribe('cell action height', () => {\n it('the icon button in a cell reads the cell token for height and width', () => {\n const css = text(DataGridField.styles)\n const rule = css.slice(css.indexOf(':host > button.icon {'))\n\n expect(rule).to.match(/^:host > button\\.icon \\{[^}]*width: var\\(--cell-action-height, 26px\\);/)\n expect(rule).to.match(/^:host > button\\.icon \\{[^}]*height: var\\(--cell-action-height, 26px\\);/)\n expect(rule).to.contain('margin-top: calc((20px - var(--cell-action-height, 26px)) / 2)')\n })\n})\n\ndescribe('filter bar input height', () => {\n it('a grid filter bar: the suite small height in the operato products, natural height elsewhere', () => {\n const css = text(FilterStyles)\n expect(css).to.match(/box-sizing: border-box;\\s*height: var\\(--suite-form-element-height-small, auto\\);/)\n })\n})\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { expect, fixture } from '@open-wc/testing';
|
|
2
|
-
import { html, render } from 'lit';
|
|
3
|
-
import { DataProvider } from '../src/data-provider.js';
|
|
4
|
-
import { FilterSelectButtons } from '../src/filters/filter-select-buttons.js';
|
|
5
|
-
/**
|
|
6
|
-
* The counts beside a list's filter choices (ADR-0190): read with the conditions of each fetch that replaces the rows,
|
|
7
|
-
* under its signal - only the counts of the current read land, and a chip shows them when its option has none.
|
|
8
|
-
*/
|
|
9
|
-
function deferred() {
|
|
10
|
-
let resolve;
|
|
11
|
-
const promise = new Promise(yes => (resolve = yes));
|
|
12
|
-
return { promise, resolve };
|
|
13
|
-
}
|
|
14
|
-
function setup() {
|
|
15
|
-
const counted = [];
|
|
16
|
-
const consumer = Object.assign(new EventTarget(), {
|
|
17
|
-
shownMode: 'GRID',
|
|
18
|
-
data: { records: [] },
|
|
19
|
-
_data: { records: [] },
|
|
20
|
-
checkDirties() { },
|
|
21
|
-
showSpinner() { },
|
|
22
|
-
hideSpinner() { },
|
|
23
|
-
fetchHandler: async () => ({ total: 0, records: [] }),
|
|
24
|
-
countHandler(options) {
|
|
25
|
-
const answer = deferred();
|
|
26
|
-
counted.push({ options, answer });
|
|
27
|
-
return answer.promise;
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
return { provider: new DataProvider(consumer), consumer, counted };
|
|
31
|
-
}
|
|
32
|
-
describe('countHandler', () => {
|
|
33
|
-
it("is read with the fetch's conditions and signal; a count of a read replaced never lands", async () => {
|
|
34
|
-
var _a;
|
|
35
|
-
const { provider, consumer, counted } = setup();
|
|
36
|
-
provider.filters = [{ name: 'state', operator: 'in', value: ['draft'] }];
|
|
37
|
-
void provider.fetch();
|
|
38
|
-
void provider.fetch();
|
|
39
|
-
expect(counted.length).to.equal(2);
|
|
40
|
-
expect(counted[0].options.filters).to.deep.equal([{ name: 'state', operator: 'in', value: ['draft'] }]);
|
|
41
|
-
expect((_a = counted[0].options.signal) === null || _a === void 0 ? void 0 : _a.aborted).to.equal(true);
|
|
42
|
-
counted[1].answer.resolve({ state: { draft: 2 } });
|
|
43
|
-
await Promise.resolve();
|
|
44
|
-
counted[0].answer.resolve({ state: { draft: 99 } });
|
|
45
|
-
await Promise.resolve();
|
|
46
|
-
expect(consumer.counts).to.deep.equal({ state: { draft: 2 } });
|
|
47
|
-
});
|
|
48
|
-
it('a chip shows the grid count for its column and value, unless the option gives its own', async () => {
|
|
49
|
-
const column = { name: 'state', filter: { operator: 'in', options: [{ display: 'Draft', value: 'draft' }, { display: 'Released', value: 'released', count: 7 }] }, record: {} };
|
|
50
|
-
const host = await fixture(html `<div></div>`);
|
|
51
|
-
render(FilterSelectButtons(column, [], { counts: { state: { draft: 3, released: 1 } } }), host);
|
|
52
|
-
const buttons = host.querySelector('ox-input-select-buttons');
|
|
53
|
-
expect(buttons.options.map((one) => one.count)).to.deep.equal([3, 7]);
|
|
54
|
-
});
|
|
55
|
-
});
|
|
56
|
-
//# sourceMappingURL=count-handler.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"count-handler.test.js","sourceRoot":"","sources":["../../test/count-handler.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAClD,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,KAAK,CAAA;AAElC,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AAEtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,yCAAyC,CAAA;AAG7E;;;GAGG;AACH,SAAS,QAAQ;IACf,IAAI,OAA4B,CAAA;IAChC,MAAM,OAAO,GAAG,IAAI,OAAO,CAAI,GAAG,CAAC,EAAE,CAAC,CAAC,OAAO,GAAG,GAAG,CAAC,CAAC,CAAA;IACtD,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,CAAA;AAC7B,CAAC;AAED,SAAS,KAAK;IACZ,MAAM,OAAO,GAA4G,EAAE,CAAA;IAC3H,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,WAAW,EAAE,EAAE;QAChD,SAAS,EAAE,MAAe;QAC1B,IAAI,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;QACrB,KAAK,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;QACtB,YAAY,KAAI,CAAC;QACjB,WAAW,KAAI,CAAC;Q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AAO,GAAG,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAQ,CAAA;QACpE,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,GAAQ,EAAE,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA;IAC5E,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA","sourcesContent":["import { expect, fixture } from '@open-wc/testing'\nimport { html, render } from 'lit'\n\nimport { DataProvider } from '../src/data-provider.js'\nimport type { DataConsumer } from '../src/data-consumer.js'\nimport { FilterSelectButtons } from '../src/filters/filter-select-buttons.js'\nimport type { FetchOption, FetchResult } from '../src/types.js'\n\n/**\n * The counts beside a list's filter choices (ADR-0190): read with the conditions of each fetch that replaces the rows,\n * under its signal - only the counts of the current read land, and a chip shows them when its option has none.\n */\nfunction deferred<T>() {\n let resolve!: (value: T) => void\n const promise = new Promise<T>(yes => (resolve = yes))\n return { promise, resolve }\n}\n\nfunction setup() {\n const counted: { options: FetchOption; answer: ReturnType<typeof deferred<Record<string, Record<string, number>>>> }[] = []\n const consumer = Object.assign(new EventTarget(), {\n shownMode: 'GRID' as const,\n data: { records: [] },\n _data: { records: [] },\n checkDirties() {},\n showSpinner() {},\n hideSpinner() {},\n fetchHandler: async (): Promise<FetchResult> => ({ total: 0, records: [] }),\n countHandler(options: FetchOption) {\n const answer = deferred<Record<string, Record<string, number>>>()\n counted.push({ options, answer })\n return answer.promise\n }\n }) as unknown as DataConsumer\n return { provider: new DataProvider(consumer), consumer, counted }\n}\n\ndescribe('countHandler', () => {\n it(\"is read with the fetch's conditions and signal; a count of a read replaced never lands\", async () => {\n const { provider, consumer, counted } = setup()\n provider.filters = [{ name: 'state', operator: 'in', value: ['draft'] }] as any\n void provider.fetch()\n void provider.fetch()\n expect(counted.length).to.equal(2)\n expect(counted[0].options.filters).to.deep.equal([{ name: 'state', operator: 'in', value: ['draft'] }])\n expect(counted[0].options.signal?.aborted).to.equal(true)\n counted[1].answer.resolve({ state: { draft: 2 } })\n await Promise.resolve()\n counted[0].answer.resolve({ state: { draft: 99 } })\n await Promise.resolve()\n expect(consumer.counts).to.deep.equal({ state: { draft: 2 } })\n })\n\n it('a chip shows the grid count for its column and value, unless the option gives its own', async () => {\n const column = { name: 'state', filter: { operator: 'in', options: [{ display: 'Draft', value: 'draft' }, { display: 'Released', value: 'released', count: 7 }] }, record: {} } as any\n const host = await fixture<HTMLElement>(html`<div></div>`)\n render(FilterSelectButtons(column, [], { counts: { state: { draft: 3, released: 1 } } } as any), host)\n const buttons = host.querySelector('ox-input-select-buttons') as any\n expect(buttons.options.map((one: any) => one.count)).to.deep.equal([3, 7])\n })\n})\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import '../src/data-grist.js';
|
|
@@ -1,159 +0,0 @@
|
|
|
1
|
-
import { expect, fixture } from '@open-wc/testing';
|
|
2
|
-
import { html } from 'lit';
|
|
3
|
-
import '../src/data-grist.js';
|
|
4
|
-
/**
|
|
5
|
-
* FOOTER-BUTTON-REVIEW G04 G05 G07 G03: showing the empty row, adding rows by a paste and starting a row are apart; a
|
|
6
|
-
* row the grid adds starts from the screen's draft; a paste that cannot add its rows says so; a fixed column stays first.
|
|
7
|
-
*/
|
|
8
|
-
async function withClipboard(text, run) {
|
|
9
|
-
const previous = Object.getOwnPropertyDescriptor(navigator, 'clipboard');
|
|
10
|
-
Object.defineProperty(navigator, 'clipboard', {
|
|
11
|
-
configurable: true,
|
|
12
|
-
value: { read: async () => [{ getType: async (mime) => { if (mime !== 'text/plain')
|
|
13
|
-
throw Error('no type'); return new Blob([text], { type: mime }); } }] }
|
|
14
|
-
});
|
|
15
|
-
try {
|
|
16
|
-
return await run();
|
|
17
|
-
}
|
|
18
|
-
finally {
|
|
19
|
-
if (previous)
|
|
20
|
-
Object.defineProperty(navigator, 'clipboard', previous);
|
|
21
|
-
else
|
|
22
|
-
delete navigator.clipboard;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
const until = async (check, ms = 2000) => {
|
|
26
|
-
const end = Date.now() + ms;
|
|
27
|
-
while (!check()) {
|
|
28
|
-
if (Date.now() > end)
|
|
29
|
-
throw Error('timed out');
|
|
30
|
-
await new Promise(resolve => setTimeout(resolve, 20));
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
async function gristOf(rows, records = [{ id: 'a', name: 'A', kind: 'X' }]) {
|
|
34
|
-
const grist = await fixture(html `<ox-grist
|
|
35
|
-
style="display:block;width:800px;height:400px"
|
|
36
|
-
mode="GRID"
|
|
37
|
-
.config=${{
|
|
38
|
-
columns: [
|
|
39
|
-
{ type: 'gutter', gutterName: 'dirty' },
|
|
40
|
-
{ type: 'string', name: 'name', header: 'name', record: { editable: true } },
|
|
41
|
-
{ type: 'string', name: 'kind', header: 'kind', record: { editable: true } }
|
|
42
|
-
],
|
|
43
|
-
rows
|
|
44
|
-
}}
|
|
45
|
-
.data=${{ records, total: records.length }}
|
|
46
|
-
></ox-grist>`);
|
|
47
|
-
await until(() => !!body(grist));
|
|
48
|
-
await grist.updateComplete;
|
|
49
|
-
return grist;
|
|
50
|
-
}
|
|
51
|
-
const body = (grist) => { var _a, _b; return (_b = (_a = grist.renderRoot.querySelector('ox-grid')) === null || _a === void 0 ? void 0 : _a.renderRoot) === null || _b === void 0 ? void 0 : _b.querySelector('ox-grid-body'); };
|
|
52
|
-
const shownRows = (grist) => body(grist).renderRoot.querySelectorAll('ox-grid-field[data-column="name"], ox-grid-field').length;
|
|
53
|
-
async function pasteAt(grist, row, text) {
|
|
54
|
-
const grid = body(grist);
|
|
55
|
-
grid.focused = { row, column: 1 };
|
|
56
|
-
await withClipboard(text, () => grid.paste());
|
|
57
|
-
await new Promise(resolve => setTimeout(resolve, 50));
|
|
58
|
-
await grist.updateComplete;
|
|
59
|
-
}
|
|
60
|
-
describe('행 추가·붙여넣기 정책 (G04 G05 G07)', () => {
|
|
61
|
-
it('빈 행을 보이지 않아도 붙여넣기는 행을 늘린다 — 늘어난 행은 화면의 초안 값으로 시작한다', async () => {
|
|
62
|
-
const grist = await gristOf({ appendable: false, pasteAppendable: true, newRecord: () => ({ kind: 'DRAFT' }) });
|
|
63
|
-
expect(body(grist).config.rows.appendable).to.equal(false);
|
|
64
|
-
await pasteAt(grist, 0, 'one\ntwo\nthree');
|
|
65
|
-
const records = grist.dirtyData.records;
|
|
66
|
-
expect(records.map((one) => one.name)).to.eql(['one', 'two', 'three']);
|
|
67
|
-
expect(records.slice(1).map((one) => [one.kind, one.__dirty__])).to.eql([['DRAFT', '+'], ['DRAFT', '+']]);
|
|
68
|
-
});
|
|
69
|
-
it('행을 늘릴 수 없으면 잘린 행 수를 알린다 — 조용히 버리지 않는다', async () => {
|
|
70
|
-
const grist = await gristOf({ appendable: false, pasteAppendable: false });
|
|
71
|
-
let detail;
|
|
72
|
-
grist.addEventListener('paste-rows-dropped', (e) => (detail = e.detail));
|
|
73
|
-
await pasteAt(grist, 0, 'one\ntwo\nthree');
|
|
74
|
-
expect(grist.dirtyData.records.map((one) => one.name)).to.eql(['one']);
|
|
75
|
-
expect(detail).to.eql({ rows: 3, applied: 1, dropped: 2 });
|
|
76
|
-
});
|
|
77
|
-
it('pasteAppendable 을 말하지 않은 화면은 예전처럼 appendable 하나로 정한다', async () => {
|
|
78
|
-
const grist = await gristOf({ appendable: true });
|
|
79
|
-
expect(grist.compiledConfig.rows.pasteAppendable).to.equal(true);
|
|
80
|
-
await pasteAt(grist, 0, 'one\ntwo');
|
|
81
|
-
expect(grist.dirtyData.records.length).to.equal(2);
|
|
82
|
-
});
|
|
83
|
-
it('행 추가는 맨 위에 초안 값으로 만들고 첫 입력 칸에 초점을 둔다', async () => {
|
|
84
|
-
const grist = await gristOf({ appendable: false, newRecord: () => ({ kind: 'DRAFT' }) });
|
|
85
|
-
const added = grist.addNewRecord({ name: '' });
|
|
86
|
-
await new Promise(resolve => setTimeout(resolve, 50));
|
|
87
|
-
await grist.updateComplete;
|
|
88
|
-
expect(grist.dirtyData.records[0]).to.equal(added);
|
|
89
|
-
expect([added.kind, added.__dirty__]).to.eql(['DRAFT', '+']);
|
|
90
|
-
const focused = body(grist).focused;
|
|
91
|
-
expect(focused.row).to.equal(0);
|
|
92
|
-
expect(grist.compiledConfig.columns[focused.column].name).to.equal('name');
|
|
93
|
-
});
|
|
94
|
-
it('저장 전 새 행은 표시를 눌러 제거한다', async () => {
|
|
95
|
-
const grist = await gristOf({ appendable: false });
|
|
96
|
-
const added = grist.addNewRecord({ name: 'temp' });
|
|
97
|
-
await new Promise(resolve => setTimeout(resolve, 50));
|
|
98
|
-
const grid = body(grist);
|
|
99
|
-
grid.dispatchEvent(new CustomEvent('remove-new-record', { bubbles: true, composed: true, detail: { record: added, row: 0 } }));
|
|
100
|
-
await grist.updateComplete;
|
|
101
|
-
expect(grist.dirtyData.records.map((one) => one.id)).to.eql(['a']);
|
|
102
|
-
/* A saved row is never removed this way. */
|
|
103
|
-
const saved = grist.dirtyData.records[0];
|
|
104
|
-
grid.dispatchEvent(new CustomEvent('remove-new-record', { bubbles: true, composed: true, detail: { record: saved, row: 0 } }));
|
|
105
|
-
expect(grist.dirtyData.records.length).to.equal(1);
|
|
106
|
-
expect(shownRows(grist)).to.be.greaterThan(0);
|
|
107
|
-
});
|
|
108
|
-
});
|
|
109
|
-
describe('개인 컬럼 설정과 고정 열 (G03)', () => {
|
|
110
|
-
const columns = () => [
|
|
111
|
-
{ type: 'gutter', gutterName: 'sequence', fixed: true },
|
|
112
|
-
{ type: 'string', name: 'name', header: 'name', fixed: true, width: 100 },
|
|
113
|
-
{ type: 'string', name: 'amount', header: 'amount', width: 100 },
|
|
114
|
-
{ type: 'string', name: 'memo', header: 'memo', width: 100 }
|
|
115
|
-
];
|
|
116
|
-
async function withPersonal(config, personal) {
|
|
117
|
-
const grist = await fixture(html `<ox-grist style="display:block;width:800px;height:300px" mode="GRID" .config=${config} .data=${{ records: [], total: 0 }}></ox-grist>`);
|
|
118
|
-
grist.personalConfig = personal;
|
|
119
|
-
await grist.updateComplete;
|
|
120
|
-
await new Promise(resolve => setTimeout(resolve, 20));
|
|
121
|
-
return grist.compiledConfig.columns.map(one => { var _a; return `${(_a = one.name) !== null && _a !== void 0 ? _a : one.gutterName}${one.fixed ? '*' : ''}${one.hidden ? '(h)' : ''}:${one.width}`; });
|
|
122
|
-
}
|
|
123
|
-
it('같은 배치에서는 개인 순서를 따르되 화면이 고정한 열은 앞에 남는다', async () => {
|
|
124
|
-
const shown = await withPersonal({ columns: columns(), columnsVersion: 'v2' }, { columnsVersion: 'v2', columns: [{ name: 'memo', width: 150 }, { name: 'amount' }, { name: 'name' }] });
|
|
125
|
-
expect(shown.slice(1)).to.eql(['name*:100', 'memo:150', 'amount:100']);
|
|
126
|
-
expect(shown[0].startsWith('__seq__*')).to.equal(true);
|
|
127
|
-
});
|
|
128
|
-
it('배치가 바뀐 화면에서는 폭과 숨김만 이어받고 옛 순서는 버린다', async () => {
|
|
129
|
-
const shown = await withPersonal({ columns: columns(), columnsVersion: 'v2' }, { columns: [{ name: 'memo', width: 150, hidden: true }, { name: 'amount' }, { name: 'name' }] });
|
|
130
|
-
expect(shown.slice(1)).to.eql(['name*:100', 'amount:100', 'memo(h):150']);
|
|
131
|
-
});
|
|
132
|
-
});
|
|
133
|
-
describe('편집을 지키며 다시 읽기 — 이어 읽는 목록 (G06)', () => {
|
|
134
|
-
it('무한 스크롤 목록은 처음부터 다시 읽어 행이 겹치지 않고, 편집은 다시 읽은 행에 남는다', async () => {
|
|
135
|
-
let reads = 0;
|
|
136
|
-
const grist = await fixture(html `<ox-grist
|
|
137
|
-
style="display:block;width:800px;height:400px"
|
|
138
|
-
mode="GRID"
|
|
139
|
-
.config=${{ columns: [{ type: 'gutter', gutterName: 'dirty' }, { type: 'string', name: 'name', header: 'name', record: { editable: true } }], rows: { appendable: false }, pagination: { infinite: true } }}
|
|
140
|
-
.fetchHandler=${async () => {
|
|
141
|
-
reads++;
|
|
142
|
-
return { records: [{ id: 'a', name: 'A' }, { id: 'b', name: 'B' }], total: 2 };
|
|
143
|
-
}}
|
|
144
|
-
></ox-grist>`);
|
|
145
|
-
await until(() => { var _a; return ((_a = grist.dirtyData.records) === null || _a === void 0 ? void 0 : _a.length) === 2; });
|
|
146
|
-
const record = grist.dirtyData.records[0];
|
|
147
|
-
const column = grist.compiledConfig.columns.find(one => one.name === 'name');
|
|
148
|
-
body(grist).dispatchEvent(new CustomEvent('field-change', { bubbles: true, composed: true, detail: { before: 'A', after: 'A2', column, record, row: 0 } }));
|
|
149
|
-
await until(() => grist.dirtyRecords.length === 1);
|
|
150
|
-
const { editsOf } = await import('../src/edit-rebase.js');
|
|
151
|
-
const unplaced = await grist.fetchKeepingEdits(editsOf(grist.dirtyRecords));
|
|
152
|
-
expect(unplaced).to.eql([]);
|
|
153
|
-
expect(grist.dirtyData.records.map((one) => one.id)).to.eql(['a', 'b']);
|
|
154
|
-
expect(grist.dirtyData.records[0].name).to.equal('A2');
|
|
155
|
-
expect(grist.dirtyRecords.length).to.equal(1);
|
|
156
|
-
expect(reads).to.be.greaterThan(1);
|
|
157
|
-
});
|
|
158
|
-
});
|
|
159
|
-
//# sourceMappingURL=create-paste-policy.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create-paste-policy.test.js","sourceRoot":"","sources":["../../test/create-paste-policy.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAClD,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAE1B,OAAO,sBAAsB,CAAA;AAG7B;;;GAGG;AAEH,KAAK,UAAU,aAAa,CAAI,IAAY,EAAE,GAAqB;IACjE,MAAM,QAAQ,GAAG,MAAM,CAAC,wBAAwB,CAAC,SAAS,EAAE,WAAW,CAAC,CAAA;IACxE,MAAM,CAAC,cAAc,CAAC,SAA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AE,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAA;QAC3J,MAAM,KAAK,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,YAAY,CAAC,MAAM,KAAK,CAAC,CAAC,CAAA;QAClD,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,MAAM,CAAC,uBAAuB,CAAC,CAAA;QACzD,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,iBAAiB,CAAC,OAAO,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,CAAA;QAC3E,MAAM,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA;QAC3B,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,GAAQ,EAAE,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAA;QAC5E,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;QACtD,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;QAC7C,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC,CAAA;IACpC,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA","sourcesContent":["import { expect, fixture } from '@open-wc/testing'\nimport { html } from 'lit'\n\nimport '../src/data-grist.js'\nimport { DataGrist } from '../src/data-grist.js'\n\n/**\n * FOOTER-BUTTON-REVIEW G04 G05 G07 G03: showing the empty row, adding rows by a paste and starting a row are apart; a\n * row the grid adds starts from the screen's draft; a paste that cannot add its rows says so; a fixed column stays first.\n */\n\nasync function withClipboard<T>(text: string, run: () => Promise<T>): Promise<T> {\n const previous = Object.getOwnPropertyDescriptor(navigator, 'clipboard')\n Object.defineProperty(navigator, 'clipboard', {\n configurable: true,\n value: { read: async () => [{ getType: async (mime: string) => { if (mime !== 'text/plain') throw Error('no type'); return new Blob([text], { type: mime }) } }] }\n })\n try {\n return await run()\n } finally {\n if (previous) Object.defineProperty(navigator, 'clipboard', previous)\n else delete (navigator as any).clipboard\n }\n}\n\nconst until = async (check: () => boolean, ms = 2000) => {\n const end = Date.now() + ms\n while (!check()) {\n if (Date.now() > end) throw Error('timed out')\n await new Promise(resolve => setTimeout(resolve, 20))\n }\n}\n\nasync function gristOf(rows: Record<string, any>, records = [{ id: 'a', name: 'A', kind: 'X' }]) {\n const grist = await fixture<DataGrist>(html`<ox-grist\n style=\"display:block;width:800px;height:400px\"\n mode=\"GRID\"\n .config=${{\n columns: [\n { type: 'gutter', gutterName: 'dirty' },\n { type: 'string', name: 'name', header: 'name', record: { editable: true } },\n { type: 'string', name: 'kind', header: 'kind', record: { editable: true } }\n ],\n rows\n }}\n .data=${{ records, total: records.length }}\n ></ox-grist>`)\n await until(() => !!body(grist))\n await grist.updateComplete\n return grist\n}\n\nconst body = (grist: DataGrist) => (grist.renderRoot.querySelector('ox-grid') as any)?.renderRoot?.querySelector('ox-grid-body') as any\nconst shownRows = (grist: DataGrist) => body(grist).renderRoot.querySelectorAll('ox-grid-field[data-column=\"name\"], ox-grid-field').length\n\nasync function pasteAt(grist: DataGrist, row: number, text: string) {\n const grid = body(grist)\n grid.focused = { row, column: 1 }\n await withClipboard(text, () => grid.paste())\n await new Promise(resolve => setTimeout(resolve, 50))\n await grist.updateComplete\n}\n\ndescribe('행 추가·붙여넣기 정책 (G04 G05 G07)', () => {\n it('빈 행을 보이지 않아도 붙여넣기는 행을 늘린다 — 늘어난 행은 화면의 초안 값으로 시작한다', async () => {\n const grist = await gristOf({ appendable: false, pasteAppendable: true, newRecord: () => ({ kind: 'DRAFT' }) })\n expect(body(grist).config.rows.appendable).to.equal(false)\n await pasteAt(grist, 0, 'one\\ntwo\\nthree')\n const records = grist.dirtyData.records\n expect(records.map((one: any) => one.name)).to.eql(['one', 'two', 'three'])\n expect(records.slice(1).map((one: any) => [one.kind, one.__dirty__])).to.eql([['DRAFT', '+'], ['DRAFT', '+']])\n })\n\n it('행을 늘릴 수 없으면 잘린 행 수를 알린다 — 조용히 버리지 않는다', async () => {\n const grist = await gristOf({ appendable: false, pasteAppendable: false })\n let detail: any\n grist.addEventListener('paste-rows-dropped', (e: Event) => (detail = (e as CustomEvent).detail))\n await pasteAt(grist, 0, 'one\\ntwo\\nthree')\n expect(grist.dirtyData.records.map((one: any) => one.name)).to.eql(['one'])\n expect(detail).to.eql({ rows: 3, applied: 1, dropped: 2 })\n })\n\n it('pasteAppendable 을 말하지 않은 화면은 예전처럼 appendable 하나로 정한다', async () => {\n const grist = await gristOf({ appendable: true })\n expect(grist.compiledConfig.rows.pasteAppendable).to.equal(true)\n await pasteAt(grist, 0, 'one\\ntwo')\n expect(grist.dirtyData.records.length).to.equal(2)\n })\n\n it('행 추가는 맨 위에 초안 값으로 만들고 첫 입력 칸에 초점을 둔다', async () => {\n const grist = await gristOf({ appendable: false, newRecord: () => ({ kind: 'DRAFT' }) })\n const added = grist.addNewRecord({ name: '' })\n await new Promise(resolve => setTimeout(resolve, 50))\n await grist.updateComplete\n expect(grist.dirtyData.records[0]).to.equal(added)\n expect([added.kind, added.__dirty__]).to.eql(['DRAFT', '+'])\n const focused = body(grist).focused\n expect(focused.row).to.equal(0)\n expect(grist.compiledConfig.columns[focused.column].name).to.equal('name')\n })\n\n it('저장 전 새 행은 표시를 눌러 제거한다', async () => {\n const grist = await gristOf({ appendable: false })\n const added = grist.addNewRecord({ name: 'temp' })\n await new Promise(resolve => setTimeout(resolve, 50))\n const grid = body(grist)\n grid.dispatchEvent(new CustomEvent('remove-new-record', { bubbles: true, composed: true, detail: { record: added, row: 0 } }))\n await grist.updateComplete\n expect(grist.dirtyData.records.map((one: any) => one.id)).to.eql(['a'])\n /* A saved row is never removed this way. */\n const saved = grist.dirtyData.records[0]\n grid.dispatchEvent(new CustomEvent('remove-new-record', { bubbles: true, composed: true, detail: { record: saved, row: 0 } }))\n expect(grist.dirtyData.records.length).to.equal(1)\n expect(shownRows(grist)).to.be.greaterThan(0)\n })\n})\n\ndescribe('개인 컬럼 설정과 고정 열 (G03)', () => {\n const columns = () => [\n { type: 'gutter', gutterName: 'sequence', fixed: true },\n { type: 'string', name: 'name', header: 'name', fixed: true, width: 100 },\n { type: 'string', name: 'amount', header: 'amount', width: 100 },\n { type: 'string', name: 'memo', header: 'memo', width: 100 }\n ]\n\n async function withPersonal(config: Record<string, any>, personal: Record<string, any>) {\n const grist = await fixture<DataGrist>(html`<ox-grist style=\"display:block;width:800px;height:300px\" mode=\"GRID\" .config=${config} .data=${{ records: [], total: 0 }}></ox-grist>`)\n grist.personalConfig = personal\n await grist.updateComplete\n await new Promise(resolve => setTimeout(resolve, 20))\n return grist.compiledConfig.columns.map(one => `${one.name ?? one.gutterName}${one.fixed ? '*' : ''}${one.hidden ? '(h)' : ''}:${one.width}`)\n }\n\n it('같은 배치에서는 개인 순서를 따르되 화면이 고정한 열은 앞에 남는다', async () => {\n const shown = await withPersonal(\n { columns: columns(), columnsVersion: 'v2' },\n { columnsVersion: 'v2', columns: [{ name: 'memo', width: 150 }, { name: 'amount' }, { name: 'name' }] }\n )\n expect(shown.slice(1)).to.eql(['name*:100', 'memo:150', 'amount:100'])\n expect(shown[0].startsWith('__seq__*')).to.equal(true)\n })\n\n it('배치가 바뀐 화면에서는 폭과 숨김만 이어받고 옛 순서는 버린다', async () => {\n const shown = await withPersonal(\n { columns: columns(), columnsVersion: 'v2' },\n { columns: [{ name: 'memo', width: 150, hidden: true }, { name: 'amount' }, { name: 'name' }] }\n )\n expect(shown.slice(1)).to.eql(['name*:100', 'amount:100', 'memo(h):150'])\n })\n})\n\ndescribe('편집을 지키며 다시 읽기 — 이어 읽는 목록 (G06)', () => {\n it('무한 스크롤 목록은 처음부터 다시 읽어 행이 겹치지 않고, 편집은 다시 읽은 행에 남는다', async () => {\n let reads = 0\n const grist = await fixture<DataGrist>(html`<ox-grist\n style=\"display:block;width:800px;height:400px\"\n mode=\"GRID\"\n .config=${{ columns: [{ type: 'gutter', gutterName: 'dirty' }, { type: 'string', name: 'name', header: 'name', record: { editable: true } }], rows: { appendable: false }, pagination: { infinite: true } }}\n .fetchHandler=${async () => {\n reads++\n return { records: [{ id: 'a', name: 'A' }, { id: 'b', name: 'B' }], total: 2 }\n }}\n ></ox-grist>`)\n await until(() => grist.dirtyData.records?.length === 2)\n const record = grist.dirtyData.records[0]\n const column = grist.compiledConfig.columns.find(one => one.name === 'name')!\n body(grist).dispatchEvent(new CustomEvent('field-change', { bubbles: true, composed: true, detail: { before: 'A', after: 'A2', column, record, row: 0 } }))\n await until(() => grist.dirtyRecords.length === 1)\n const { editsOf } = await import('../src/edit-rebase.js')\n const unplaced = await grist.fetchKeepingEdits(editsOf(grist.dirtyRecords))\n expect(unplaced).to.eql([])\n expect(grist.dirtyData.records.map((one: any) => one.id)).to.eql(['a', 'b'])\n expect(grist.dirtyData.records[0].name).to.equal('A2')\n expect(grist.dirtyRecords.length).to.equal(1)\n expect(reads).to.be.greaterThan(1)\n })\n})\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|