@operato/data-grist 10.29.78 → 10.29.80
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 +25 -0
- package/dist/src/editors/ox-grist-editor-date.d.ts +2 -0
- package/dist/src/editors/ox-grist-editor-date.js +3 -8
- package/dist/src/editors/ox-grist-editor-date.js.map +1 -1
- package/dist/src/editors/ox-grist-editor-month.d.ts +2 -0
- package/dist/src/editors/ox-grist-editor-month.js +3 -1
- package/dist/src/editors/ox-grist-editor-month.js.map +1 -1
- package/dist/src/editors/ox-grist-editor-week.d.ts +2 -0
- package/dist/src/editors/ox-grist-editor-week.js +3 -1
- package/dist/src/editors/ox-grist-editor-week.js.map +1 -1
- package/dist/src/editors/ox-grist-editor.js +2 -1
- package/dist/src/editors/ox-grist-editor.js.map +1 -1
- package/dist/src/filters/filter-input.d.ts +1 -0
- package/dist/src/filters/filter-input.js +20 -0
- package/dist/src/filters/filter-input.js.map +1 -1
- package/dist/src/filters/filter-range-date.d.ts +7 -0
- package/dist/src/filters/filter-range-date.js +53 -0
- package/dist/src/filters/filter-range-date.js.map +1 -1
- package/dist/src/filters/filter-select-buttons.js +7 -0
- package/dist/src/filters/filter-select-buttons.js.map +1 -1
- package/dist/src/filters/filter-styles.js +8 -2
- package/dist/src/filters/filter-styles.js.map +1 -1
- package/dist/src/filters/filters-form.js +38 -14
- package/dist/src/filters/filters-form.js.map +1 -1
- package/dist/src/filters/pill-choice.d.ts +24 -0
- package/dist/src/filters/pill-choice.js +63 -0
- package/dist/src/filters/pill-choice.js.map +1 -0
- package/dist/test/date-fields.test.d.ts +2 -0
- package/dist/test/date-fields.test.js +138 -0
- package/dist/test/date-fields.test.js.map +1 -0
- package/dist/test/filter-select-buttons-count.test.js +2 -1
- package/dist/test/filter-select-buttons-count.test.js.map +1 -1
- package/dist/test/filters-phone-width.test.d.ts +1 -0
- package/dist/test/filters-phone-width.test.js +33 -0
- package/dist/test/filters-phone-width.test.js.map +1 -0
- package/dist/test/filters-pills.test.d.ts +2 -0
- package/dist/test/filters-pills.test.js +149 -0
- package/dist/test/filters-pills.test.js.map +1 -0
- package/dist/test/list-defaults.test.js +2 -1
- package/dist/test/list-defaults.test.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +7 -7
- package/test/date-fields.test.ts +163 -0
- package/test/filter-select-buttons-count.test.ts +2 -1
- package/test/filters-phone-width.test.ts +35 -0
- package/test/filters-pills.test.ts +162 -0
- package/test/list-defaults.test.ts +2 -1
- package/translations/en.json +8 -1
- package/translations/es.json +8 -1
- package/translations/ja.json +8 -1
- package/translations/ko.json +8 -1
- package/translations/ms.json +8 -1
- package/translations/zh.json +8 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,31 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
### [10.29.80](https://github.com/hatiolab/operato/compare/v10.29.79...v10.29.80) (2026-11-11)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @operato/data-grist
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### [10.29.79](https://github.com/hatiolab/operato/compare/v10.29.78...v10.29.79) (2026-11-10)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### :bug: Bug Fix
|
|
18
|
+
|
|
19
|
+
* **data-grist,styles:** a date range filter fits a phone's width ([398caee](https://github.com/hatiolab/operato/commit/398caeefe281cf067a625727397edc9cdf9f985d))
|
|
20
|
+
* **input,data-grist:** an empty date field does not look like a value ([b38e268](https://github.com/hatiolab/operato/commit/b38e26807df72fdc53e504d8df4ece2df7382d24))
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
### :rocket: New Features
|
|
24
|
+
|
|
25
|
+
* **data-grist:** day, week and month filters and editors are ox-input-date ([a1d3d73](https://github.com/hatiolab/operato/commit/a1d3d730eeace9108077d1ed70d08a5271a27890))
|
|
26
|
+
* **data-grist:** few fixed choices filter by chips, with an all chip ([f9c72c4](https://github.com/hatiolab/operato/commit/f9c72c479499b5ecdc24e7ba7d059d3ab7012e71))
|
|
27
|
+
* **dataset,attribute:** date items and attributes are ox-input-date ([b1cb75a](https://github.com/hatiolab/operato/commit/b1cb75abd125261ec0d8d603b1a1d3d16e723fb1))
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
6
31
|
### [10.29.78](https://github.com/hatiolab/operato/compare/v10.29.77...v10.29.78) (2026-11-10)
|
|
7
32
|
|
|
8
33
|
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import '@operato/input/ox-input-date.js';
|
|
1
2
|
import { OxGristEditor } from './ox-grist-editor.js';
|
|
3
|
+
/** A date cell is edited in the one date field: typed at a desk, the phone's own picker on touch (ox-input-date). */
|
|
2
4
|
export declare class OxGristEditorDate extends OxGristEditor {
|
|
3
5
|
get editorTemplate(): import("lit-html").TemplateResult<1>;
|
|
4
6
|
}
|
|
@@ -1,17 +1,12 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
|
+
import '@operato/input/ox-input-date.js';
|
|
2
3
|
import { OxGristEditor } from './ox-grist-editor.js';
|
|
3
4
|
import { customElement } from 'lit/decorators.js';
|
|
4
5
|
import { html } from 'lit';
|
|
6
|
+
/** A date cell is edited in the one date field: typed at a desk, the phone's own picker on touch (ox-input-date). */
|
|
5
7
|
let OxGristEditorDate = class OxGristEditorDate extends OxGristEditor {
|
|
6
8
|
get editorTemplate() {
|
|
7
|
-
return html
|
|
8
|
-
<input
|
|
9
|
-
type="date"
|
|
10
|
-
.value=${this.value}
|
|
11
|
-
max="9999-12-31"
|
|
12
|
-
@click=${(e) => e.currentTarget.showPicker()}
|
|
13
|
-
/>
|
|
14
|
-
`;
|
|
9
|
+
return html `<ox-input-date type="date" .value=${this.value}></ox-input-date>`;
|
|
15
10
|
}
|
|
16
11
|
};
|
|
17
12
|
OxGristEditorDate = __decorate([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ox-grist-editor-date.js","sourceRoot":"","sources":["../../../src/editors/ox-grist-editor-date.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;
|
|
1
|
+
{"version":3,"file":"ox-grist-editor-date.js","sourceRoot":"","sources":["../../../src/editors/ox-grist-editor-date.ts"],"names":[],"mappings":";AAAA,OAAO,iCAAiC,CAAA;AAExC,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAE1B,qHAAqH;AAE9G,IAAM,iBAAiB,GAAvB,MAAM,iBAAkB,SAAQ,aAAa;IAClD,IAAI,cAAc;QAChB,OAAO,IAAI,CAAA,qCAAqC,IAAI,CAAC,KAAK,mBAAmB,CAAA;IAC/E,CAAC;CACF,CAAA;AAJY,iBAAiB;IAD7B,aAAa,CAAC,sBAAsB,CAAC;GACzB,iBAAiB,CAI7B","sourcesContent":["import '@operato/input/ox-input-date.js'\n\nimport { OxGristEditor } from './ox-grist-editor.js'\nimport { customElement } from 'lit/decorators.js'\nimport { html } from 'lit'\n\n/** A date cell is edited in the one date field: typed at a desk, the phone's own picker on touch (ox-input-date). */\n@customElement('ox-grist-editor-date')\nexport class OxGristEditorDate extends OxGristEditor {\n get editorTemplate() {\n return html`<ox-input-date type=\"date\" .value=${this.value}></ox-input-date>`\n }\n}\n"]}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import '@operato/input/ox-input-date.js';
|
|
1
2
|
import { OxGristEditor } from './ox-grist-editor.js';
|
|
3
|
+
/** A month cell is edited in the one month field: typed at a desk, the phone's own picker on touch (ox-input-date). */
|
|
2
4
|
export declare class OxGristEditorMonth extends OxGristEditor {
|
|
3
5
|
get editorTemplate(): import("lit-html").TemplateResult<1>;
|
|
4
6
|
}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
|
+
import '@operato/input/ox-input-date.js';
|
|
2
3
|
import { OxGristEditor } from './ox-grist-editor.js';
|
|
3
4
|
import { customElement } from 'lit/decorators.js';
|
|
4
5
|
import { html } from 'lit';
|
|
6
|
+
/** A month cell is edited in the one month field: typed at a desk, the phone's own picker on touch (ox-input-date). */
|
|
5
7
|
let OxGristEditorMonth = class OxGristEditorMonth extends OxGristEditor {
|
|
6
8
|
get editorTemplate() {
|
|
7
|
-
return html
|
|
9
|
+
return html `<ox-input-date type="month" .value=${this.value}></ox-input-date>`;
|
|
8
10
|
}
|
|
9
11
|
};
|
|
10
12
|
OxGristEditorMonth = __decorate([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ox-grist-editor-month.js","sourceRoot":"","sources":["../../../src/editors/ox-grist-editor-month.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;
|
|
1
|
+
{"version":3,"file":"ox-grist-editor-month.js","sourceRoot":"","sources":["../../../src/editors/ox-grist-editor-month.ts"],"names":[],"mappings":";AAAA,OAAO,iCAAiC,CAAA;AAExC,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAE1B,uHAAuH;AAEhH,IAAM,kBAAkB,GAAxB,MAAM,kBAAmB,SAAQ,aAAa;IACnD,IAAI,cAAc;QAChB,OAAO,IAAI,CAAA,sCAAsC,IAAI,CAAC,KAAK,mBAAmB,CAAA;IAChF,CAAC;CACF,CAAA;AAJY,kBAAkB;IAD9B,aAAa,CAAC,uBAAuB,CAAC;GAC1B,kBAAkB,CAI9B","sourcesContent":["import '@operato/input/ox-input-date.js'\n\nimport { OxGristEditor } from './ox-grist-editor.js'\nimport { customElement } from 'lit/decorators.js'\nimport { html } from 'lit'\n\n/** A month cell is edited in the one month field: typed at a desk, the phone's own picker on touch (ox-input-date). */\n@customElement('ox-grist-editor-month')\nexport class OxGristEditorMonth extends OxGristEditor {\n get editorTemplate() {\n return html`<ox-input-date type=\"month\" .value=${this.value}></ox-input-date>`\n }\n}\n"]}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import '@operato/input/ox-input-date.js';
|
|
1
2
|
import { OxGristEditor } from './ox-grist-editor.js';
|
|
3
|
+
/** A week cell is edited in the one week field: typed at a desk, the phone's own picker on touch (ox-input-date). */
|
|
2
4
|
export declare class OxGristEditorWeek extends OxGristEditor {
|
|
3
5
|
get editorTemplate(): import("lit-html").TemplateResult<1>;
|
|
4
6
|
}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
|
+
import '@operato/input/ox-input-date.js';
|
|
2
3
|
import { OxGristEditor } from './ox-grist-editor.js';
|
|
3
4
|
import { customElement } from 'lit/decorators.js';
|
|
4
5
|
import { html } from 'lit';
|
|
6
|
+
/** A week cell is edited in the one week field: typed at a desk, the phone's own picker on touch (ox-input-date). */
|
|
5
7
|
let OxGristEditorWeek = class OxGristEditorWeek extends OxGristEditor {
|
|
6
8
|
get editorTemplate() {
|
|
7
|
-
return html
|
|
9
|
+
return html `<ox-input-date type="week" .value=${this.value}></ox-input-date>`;
|
|
8
10
|
}
|
|
9
11
|
};
|
|
10
12
|
OxGristEditorWeek = __decorate([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ox-grist-editor-week.js","sourceRoot":"","sources":["../../../src/editors/ox-grist-editor-week.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;
|
|
1
|
+
{"version":3,"file":"ox-grist-editor-week.js","sourceRoot":"","sources":["../../../src/editors/ox-grist-editor-week.ts"],"names":[],"mappings":";AAAA,OAAO,iCAAiC,CAAA;AAExC,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAE1B,qHAAqH;AAE9G,IAAM,iBAAiB,GAAvB,MAAM,iBAAkB,SAAQ,aAAa;IAClD,IAAI,cAAc;QAChB,OAAO,IAAI,CAAA,qCAAqC,IAAI,CAAC,KAAK,mBAAmB,CAAA;IAC/E,CAAC;CACF,CAAA;AAJY,iBAAiB;IAD7B,aAAa,CAAC,sBAAsB,CAAC;GACzB,iBAAiB,CAI7B","sourcesContent":["import '@operato/input/ox-input-date.js'\n\nimport { OxGristEditor } from './ox-grist-editor.js'\nimport { customElement } from 'lit/decorators.js'\nimport { html } from 'lit'\n\n/** A week cell is edited in the one week field: typed at a desk, the phone's own picker on touch (ox-input-date). */\n@customElement('ox-grist-editor-week')\nexport class OxGristEditorWeek extends OxGristEditor {\n get editorTemplate() {\n return html`<ox-input-date type=\"week\" .value=${this.value}></ox-input-date>`\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ox-grist-editor.js","sourceRoot":"","sources":["../../../src/editors/ox-grist-editor.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAkB,MAAM,KAAK,CAAA;AAC3D,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,m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ement, PropertyValues } from 'lit'\nimport { customElement, property } from 'lit/decorators.js'\n\nimport { ZERO_COLUMN, ZERO_RECORD } from '../configure/zero-config.js'\nimport { columnText } from '../utils/column-text.js'\nimport { DataGridField } from '../data-grid/data-grid-field.js'\nimport { ColumnConfig, GristRecord } from '../types.js'\nimport { getDefaultValue } from '@operato/time-calculator'\n\nconst STYLE = css`\n :host {\n display: flex;\n\n align-items: center;\n\n width: 100%;\n height: 100%;\n\n border: 0;\n background-color: transparent;\n\n overflow: hidden;\n justify-content: var(--data-grid-field-justify-content, flex-start);\n }\n\n :host > * {\n display: flex;\n\n width: 100%;\n height: 100%;\n\n border: 0;\n background-color: transparent;\n\n box-sizing: border-box;\n\n align-items: center;\n }\n\n :host > style {\n display: none;\n }\n\n :host > input {\n color: var(--md-sys-color-on-background);\n }\n\n /*\n * ── 편집기도 칸과 같은 쪽으로 붙는다 (2026-09-05) ──────────────────────────\n *\n * 정렬은 host 에 놓인다(firstUpdated 의 this.style.textAlign). 그런데 입력 요소는 그것을\n * 물려받지 못한다 — 브라우저 기본 스타일시트가 text-align: start 를 **직접 선언**해 두고,\n * 직접 선언은 상속값을 이긴다.\n *\n * [확인함] 2026-09-05 · 검사 명세의 「하한」 칸\n * host text-align: right\n * input text-align: start\n *\n * 그래서 숫자 칸은 읽을 때 오른쪽 끝에 있다가 고치려고 들어가면 왼쪽으로 튀었고, 값이 없는\n * 칸에서는 캐럿이 왼쪽 끝에서 깜박였다 — 숫자가 설 자리와 어긋난다.\n *\n * inherit 라고 적어 두면 그 선언이 기본 선언을 밀어내고 host 의 값을 그대로 받는다.\n */\n :host > input,\n :host > select,\n :host > textarea {\n text-align: inherit;\n }\n\n :host > input[type='checkbox'] {\n width: initial;\n margin: 0;\n }\n *:focus {\n outline: none;\n }\n\n input[type='file'] {\n opacity: 0%;\n }\n\n @media screen and (max-width: 460px) {\n :host > * {\n border: initial;\n background-color: initial;\n }\n\n *:focus {\n outline: none;\n }\n\n input,\n select,\n textarea {\n background-color: var(--input-field-background, var(--md-sys-color-surface-container-highest));\n color: var(--input-field-color, var(--md-sys-color-on-surface));\n font-size: 16px;\n }\n }\n`\n\n@customElement('ox-grist-editor')\nexport class OxGristEditor extends LitElement {\n static styles = [STYLE]\n\n /**\n * 이 편집기가 **팝업을 여나.**\n *\n * ── 왜 필요한가 (2026-09-05) ────────────────────────────────────────────\n * 팝업으로 고치는 칸은 글자 칸과 똑같이 생겼다. 열어 보기 전에는 고칠 수 있는지도, 어떻게\n * 고치는지도 모른다. 사용자의 말 그대로 — 「실제 더블클릭을 하기 전에는 모르는 막막함」.\n *\n * 그래서 그런 칸에는 표식을 둔다. 어느 칸이 그런지는 **편집기가 스스로 밝힌다** — 칸이\n * 목록을 두고 판단하면 팝업 편집기가 새로 생길 때마다 그 목록을 고쳐야 하고, 그러면\n * 반드시 빠뜨린다.\n *\n * 팝업을 여는 편집기가 이 값을 참으로 둔다. 표식만 뜻한다 — 무엇을 커밋하는지는 `_entered` 가 정한다.\n */\n static opensPopup: boolean = false\n\n @property({ type: Object }) value?: any\n @property({ type: Object }) column: ColumnConfig = ZERO_COLUMN\n @property({ type: Object }) record: GristRecord = ZERO_RECORD\n @property({ type: Number }) rowIndex?: number\n @property({ type: Object }) field?: DataGridField\n @property({ type: Number }) row?: number\n\n protected _dirtyValue?: any\n\n /**\n * The control the user entered something into since the editor opened, or none. Only that is ever committed:\n * an editor's initial value is not an edit, and a control it cannot read (a popup editor's <div>) has nothing\n * to commit - its popup's confirmation does (address-centralization-problem-2026-10-19 §7 D6).\n */\n private _entered?: EventTarget\n\n render() {\n return this.editorTemplate\n }\n\n get editor(): HTMLElement | null {\n return this.renderRoot.firstElementChild as HTMLElement\n }\n\n get inlineEditable() {\n return false\n }\n\n async firstUpdated() {\n const enter = (e: Event) => (this._entered = e.composedPath()[0])\n this.renderRoot.addEventListener('input', enter)\n this.renderRoot.addEventListener('change', enter)\n this.renderRoot.addEventListener('change', this._onchange.bind(this))\n this.renderRoot.addEventListener('focusout', this._onfocusout.bind(this))\n this.addEventListener('click', this._onclick.bind(this))\n this.addEventListener('dblclick', this._ondblclick.bind(this))\n this.addEventListener('keydown', this._onkeydown.bind(this))\n\n /* editor mode 인 경우의 마우스 움직임이, grist-body의 이벤트 처리에 의해서 에디터를 리셋시킬 수 있으므로, 이벤트 전파를 막는다. */\n this.addEventListener('pointerdown', (e: Event) => e.stopPropagation())\n this.addEventListener('pointermove', (e: Event) => e.stopPropagation())\n this.addEventListener('pointerup', (e: Event) => e.stopPropagation())\n\n const { name = '' } = this.column\n const { align, defaultValue } = this.column.record\n\n if (align) {\n this.style.textAlign = align\n this.style.textAlignLast = align /* for select */\n }\n\n var currentValue = this.record[name]\n\n if (typeof currentValue == 'undefined' && defaultValue) {\n currentValue = getDefaultValue(defaultValue, this.record)\n }\n\n this.value = this._dirtyValue = this.formatForEditor(currentValue)\n\n // 입력 키로 편집 모드에 들어갈 때는 그 키가 처음에 입력되도록 하고, enter 로 편집 모드가 되면 현재 값을 그대로 둔다\n const valueWith = this.inlineEditable && this.field?.valueWith\n this.value = this._dirtyValue = valueWith ? this.formatFromEditor(valueWith) : this.formatForEditor(currentValue)\n /* The key that opened the editor is the user's first entry. */\n if (valueWith) this._entered = this.editor ?? this\n\n this.nameEditor()\n\n requestAnimationFrame(() => {\n this.focus()\n !valueWith && this.select()\n })\n }\n\n /**\n * Name the editor. Every editor passes through this one place.\n *\n * With role=gridcell on the cell, a value being read is announced together with its column\n * header. Opening an editor puts a real input in that spot and moves focus into it, and what\n * assistive tech then reads is the input, not the cell — the column header does not carry over.\n * All that is left is \"edit text, blank\".\n *\n * The name comes from the column definition (columnText). There are more than fifteen editors;\n * leaving each to name itself means the next one added will miss it. So it is done once here, in\n * the common ancestor.\n *\n * A name the caller already set is left alone.\n */\n protected nameEditor() {\n const editor = this.editor\n\n if (!editor || editor.hasAttribute('aria-label') || editor.hasAttribute('aria-labelledby')) {\n return\n }\n\n const name = columnText(this.column)\n\n if (name) {\n editor.setAttribute('aria-label', name)\n }\n }\n\n select() {\n const editor = this.editor\n if ((editor as HTMLInputElement)?.select) {\n return (editor as HTMLInputElement).select()\n }\n }\n\n focus() {\n const editor = this.editor\n if (editor) {\n editor.focus()\n }\n }\n\n formatForEditor(value: any): any {\n return value == null ? '' : value\n }\n\n formatFromEditor(value: any): any {\n return value\n }\n\n _onfocusout() {\n // Nothing entered, nothing to commit. Re-emitting the initial value on a later blur erased a reference a\n // popup had confirmed meanwhile, when an unsaved-changes question opened.\n if (!this._entered) return\n // paste시 field-change는 Body에서 하므로 X\n if (this.field?.isWorking === true) return\n\n const { name = '' } = this.column\n var currentValue = this.record[name] ?? ''\n\n /*\n * An entry equal to the shown value is still sent. The shown value can be behind an edit of this field that is\n * still being validated, and entering the shown value again is what supersedes that edit (`onFieldChange`).\n */\n this.dispatchEvent(\n new CustomEvent('field-change', {\n bubbles: true,\n composed: true,\n detail: {\n before: currentValue,\n after: this._dirtyValue,\n column: this.column,\n record: this.record,\n row: this.row\n }\n })\n )\n }\n\n /** Commit the active control's buffer before checking whether navigation would discard an edit. */\n flush() {\n if (!this._entered) return\n // Read the control the user entered into, not the editor's first child.\n if (this._entered !== this) this._entered.dispatchEvent(new Event('change', { bubbles: true, composed: true }))\n this._onfocusout()\n }\n\n _onchange(e: Event): void {\n e.stopPropagation()\n\n const value = (e.target as any)?.value\n\n this._dirtyValue = this.formatFromEditor(value)\n }\n\n _onkeydown(e: Event): void {}\n\n _onclick(e: Event): void {\n e.stopPropagation()\n }\n\n _ondblclick(e: Event): void {\n e.stopPropagation()\n }\n\n get editorTemplate() {\n return html``\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ox-grist-editor.js","sourceRoot":"","sources":["../../../src/editors/ox-grist-editor.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAkB,MAAM,KAAK,CAAA;AAC3D,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAE3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'\nimport { customElement, property } from 'lit/decorators.js'\n\nimport { ZERO_COLUMN, ZERO_RECORD } from '../configure/zero-config.js'\nimport { columnText } from '../utils/column-text.js'\nimport { DataGridField } from '../data-grid/data-grid-field.js'\nimport { ColumnConfig, GristRecord } from '../types.js'\nimport { getDefaultValue } from '@operato/time-calculator'\n\nconst STYLE = css`\n :host {\n display: flex;\n\n align-items: center;\n\n width: 100%;\n height: 100%;\n\n border: 0;\n background-color: transparent;\n\n overflow: hidden;\n justify-content: var(--data-grid-field-justify-content, flex-start);\n }\n\n :host > * {\n display: flex;\n\n width: 100%;\n height: 100%;\n\n border: 0;\n background-color: transparent;\n\n box-sizing: border-box;\n\n align-items: center;\n }\n\n :host > style {\n display: none;\n }\n\n :host > input,\n :host > ox-input-date {\n color: var(--md-sys-color-on-background);\n }\n\n /*\n * ── 편집기도 칸과 같은 쪽으로 붙는다 (2026-09-05) ──────────────────────────\n *\n * 정렬은 host 에 놓인다(firstUpdated 의 this.style.textAlign). 그런데 입력 요소는 그것을\n * 물려받지 못한다 — 브라우저 기본 스타일시트가 text-align: start 를 **직접 선언**해 두고,\n * 직접 선언은 상속값을 이긴다.\n *\n * [확인함] 2026-09-05 · 검사 명세의 「하한」 칸\n * host text-align: right\n * input text-align: start\n *\n * 그래서 숫자 칸은 읽을 때 오른쪽 끝에 있다가 고치려고 들어가면 왼쪽으로 튀었고, 값이 없는\n * 칸에서는 캐럿이 왼쪽 끝에서 깜박였다 — 숫자가 설 자리와 어긋난다.\n *\n * inherit 라고 적어 두면 그 선언이 기본 선언을 밀어내고 host 의 값을 그대로 받는다.\n */\n :host > input,\n :host > select,\n :host > textarea {\n text-align: inherit;\n }\n\n :host > input[type='checkbox'] {\n width: initial;\n margin: 0;\n }\n *:focus {\n outline: none;\n }\n\n input[type='file'] {\n opacity: 0%;\n }\n\n @media screen and (max-width: 460px) {\n :host > * {\n border: initial;\n background-color: initial;\n }\n\n *:focus {\n outline: none;\n }\n\n input,\n select,\n textarea {\n background-color: var(--input-field-background, var(--md-sys-color-surface-container-highest));\n color: var(--input-field-color, var(--md-sys-color-on-surface));\n font-size: 16px;\n }\n }\n`\n\n@customElement('ox-grist-editor')\nexport class OxGristEditor extends LitElement {\n static styles = [STYLE]\n\n /**\n * 이 편집기가 **팝업을 여나.**\n *\n * ── 왜 필요한가 (2026-09-05) ────────────────────────────────────────────\n * 팝업으로 고치는 칸은 글자 칸과 똑같이 생겼다. 열어 보기 전에는 고칠 수 있는지도, 어떻게\n * 고치는지도 모른다. 사용자의 말 그대로 — 「실제 더블클릭을 하기 전에는 모르는 막막함」.\n *\n * 그래서 그런 칸에는 표식을 둔다. 어느 칸이 그런지는 **편집기가 스스로 밝힌다** — 칸이\n * 목록을 두고 판단하면 팝업 편집기가 새로 생길 때마다 그 목록을 고쳐야 하고, 그러면\n * 반드시 빠뜨린다.\n *\n * 팝업을 여는 편집기가 이 값을 참으로 둔다. 표식만 뜻한다 — 무엇을 커밋하는지는 `_entered` 가 정한다.\n */\n static opensPopup: boolean = false\n\n @property({ type: Object }) value?: any\n @property({ type: Object }) column: ColumnConfig = ZERO_COLUMN\n @property({ type: Object }) record: GristRecord = ZERO_RECORD\n @property({ type: Number }) rowIndex?: number\n @property({ type: Object }) field?: DataGridField\n @property({ type: Number }) row?: number\n\n protected _dirtyValue?: any\n\n /**\n * The control the user entered something into since the editor opened, or none. Only that is ever committed:\n * an editor's initial value is not an edit, and a control it cannot read (a popup editor's <div>) has nothing\n * to commit - its popup's confirmation does (address-centralization-problem-2026-10-19 §7 D6).\n */\n private _entered?: EventTarget\n\n render() {\n return this.editorTemplate\n }\n\n get editor(): HTMLElement | null {\n return this.renderRoot.firstElementChild as HTMLElement\n }\n\n get inlineEditable() {\n return false\n }\n\n async firstUpdated() {\n const enter = (e: Event) => (this._entered = e.composedPath()[0])\n this.renderRoot.addEventListener('input', enter)\n this.renderRoot.addEventListener('change', enter)\n this.renderRoot.addEventListener('change', this._onchange.bind(this))\n this.renderRoot.addEventListener('focusout', this._onfocusout.bind(this))\n this.addEventListener('click', this._onclick.bind(this))\n this.addEventListener('dblclick', this._ondblclick.bind(this))\n this.addEventListener('keydown', this._onkeydown.bind(this))\n\n /* editor mode 인 경우의 마우스 움직임이, grist-body의 이벤트 처리에 의해서 에디터를 리셋시킬 수 있으므로, 이벤트 전파를 막는다. */\n this.addEventListener('pointerdown', (e: Event) => e.stopPropagation())\n this.addEventListener('pointermove', (e: Event) => e.stopPropagation())\n this.addEventListener('pointerup', (e: Event) => e.stopPropagation())\n\n const { name = '' } = this.column\n const { align, defaultValue } = this.column.record\n\n if (align) {\n this.style.textAlign = align\n this.style.textAlignLast = align /* for select */\n }\n\n var currentValue = this.record[name]\n\n if (typeof currentValue == 'undefined' && defaultValue) {\n currentValue = getDefaultValue(defaultValue, this.record)\n }\n\n this.value = this._dirtyValue = this.formatForEditor(currentValue)\n\n // 입력 키로 편집 모드에 들어갈 때는 그 키가 처음에 입력되도록 하고, enter 로 편집 모드가 되면 현재 값을 그대로 둔다\n const valueWith = this.inlineEditable && this.field?.valueWith\n this.value = this._dirtyValue = valueWith ? this.formatFromEditor(valueWith) : this.formatForEditor(currentValue)\n /* The key that opened the editor is the user's first entry. */\n if (valueWith) this._entered = this.editor ?? this\n\n this.nameEditor()\n\n requestAnimationFrame(() => {\n this.focus()\n !valueWith && this.select()\n })\n }\n\n /**\n * Name the editor. Every editor passes through this one place.\n *\n * With role=gridcell on the cell, a value being read is announced together with its column\n * header. Opening an editor puts a real input in that spot and moves focus into it, and what\n * assistive tech then reads is the input, not the cell — the column header does not carry over.\n * All that is left is \"edit text, blank\".\n *\n * The name comes from the column definition (columnText). There are more than fifteen editors;\n * leaving each to name itself means the next one added will miss it. So it is done once here, in\n * the common ancestor.\n *\n * A name the caller already set is left alone.\n */\n protected nameEditor() {\n const editor = this.editor\n\n if (!editor || editor.hasAttribute('aria-label') || editor.hasAttribute('aria-labelledby')) {\n return\n }\n\n const name = columnText(this.column)\n\n if (name) {\n editor.setAttribute('aria-label', name)\n }\n }\n\n select() {\n const editor = this.editor\n if ((editor as HTMLInputElement)?.select) {\n return (editor as HTMLInputElement).select()\n }\n }\n\n focus() {\n const editor = this.editor\n if (editor) {\n editor.focus()\n }\n }\n\n formatForEditor(value: any): any {\n return value == null ? '' : value\n }\n\n formatFromEditor(value: any): any {\n return value\n }\n\n _onfocusout() {\n // Nothing entered, nothing to commit. Re-emitting the initial value on a later blur erased a reference a\n // popup had confirmed meanwhile, when an unsaved-changes question opened.\n if (!this._entered) return\n // paste시 field-change는 Body에서 하므로 X\n if (this.field?.isWorking === true) return\n\n const { name = '' } = this.column\n var currentValue = this.record[name] ?? ''\n\n /*\n * An entry equal to the shown value is still sent. The shown value can be behind an edit of this field that is\n * still being validated, and entering the shown value again is what supersedes that edit (`onFieldChange`).\n */\n this.dispatchEvent(\n new CustomEvent('field-change', {\n bubbles: true,\n composed: true,\n detail: {\n before: currentValue,\n after: this._dirtyValue,\n column: this.column,\n record: this.record,\n row: this.row\n }\n })\n )\n }\n\n /** Commit the active control's buffer before checking whether navigation would discard an edit. */\n flush() {\n if (!this._entered) return\n // Read the control the user entered into, not the editor's first child.\n if (this._entered !== this) this._entered.dispatchEvent(new Event('change', { bubbles: true, composed: true }))\n this._onfocusout()\n }\n\n _onchange(e: Event): void {\n e.stopPropagation()\n\n const value = (e.target as any)?.value\n\n this._dirtyValue = this.formatFromEditor(value)\n }\n\n _onkeydown(e: Event): void {}\n\n _onclick(e: Event): void {\n e.stopPropagation()\n }\n\n _ondblclick(e: Event): void {\n e.stopPropagation()\n }\n\n get editorTemplate() {\n return html``\n }\n}\n"]}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import '@operato/input/ox-input-date.js';
|
|
1
2
|
import { html } from 'lit';
|
|
2
3
|
import { i18next } from '@operato/i18n';
|
|
3
4
|
import { columnText } from '../utils/column-text.js';
|
|
@@ -14,6 +15,25 @@ import { columnText } from '../utils/column-text.js';
|
|
|
14
15
|
export const FilterInput = (column, value, owner) => {
|
|
15
16
|
const filter = column.filter;
|
|
16
17
|
const type = (filter === null || filter === void 0 ? void 0 : filter.type) || column.type;
|
|
18
|
+
if (type === 'date' || type === 'week' || type === 'month') {
|
|
19
|
+
/* A day, a week or a month: the one field for them (ox-input-date). */
|
|
20
|
+
return html `
|
|
21
|
+
<ox-input-date
|
|
22
|
+
type=${type}
|
|
23
|
+
name=${column.name}
|
|
24
|
+
aria-label=${i18next.t('text.grid-filter-of', { name: columnText(column), defaultValue: columnText(column) })}
|
|
25
|
+
.value=${value == null ? '' : String(value)}
|
|
26
|
+
@change=${(e) => {
|
|
27
|
+
const field = e.currentTarget;
|
|
28
|
+
field.dispatchEvent(new CustomEvent('filter-change', {
|
|
29
|
+
bubbles: true,
|
|
30
|
+
composed: true,
|
|
31
|
+
detail: { name: column.name, operator: filter.operator, value: field.value }
|
|
32
|
+
}));
|
|
33
|
+
}}
|
|
34
|
+
></ox-input-date>
|
|
35
|
+
`;
|
|
36
|
+
}
|
|
17
37
|
return html `
|
|
18
38
|
<input
|
|
19
39
|
type=${type}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filter-input.js","sourceRoot":"","sources":["../../../src/filters/filter-input.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAE1B,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAGvC,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AAEpD;;;;;;;;;GASG;AAEH,MAAM,CAAC,MAAM,WAAW,GAAyB,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE;IACxE,MAAM,MAAM,GAAG,MAAM,CAAC,MAA4B,CAAA;IAClD,MAAM,IAAI,GAAG,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,IAAI,KAAI,MAAM,CAAC,IAAI,CAAA;IAExC,OAAO,IAAI,CAAA;;aAEA,IAAW;aACX,MAAM,CAAC,IAAI;mBACL,OAAO,CAAC,CAAC,CAAC,qBAAqB,EAAE;QAC5C,IAAI,EAAE,UAAU,CAAC,MAAM,CAAC;QACxB,YAAY,EAAE,UAAU,CAAC,MAAM,CAAC;KACjC,CAAC;eACO,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK;gBACzB,CAAC,CAAc,EAAE,EAAE;QAC3B,MAAM,KAAK,GAAG,CAAC,CAAC,MAA0B,CAAA;QAC1C,KAAK,CAAC,aAAa,CACjB,IAAI,WAAW,CAAC,eAAe,EAAE;YAC/B,OAAO,EAAE,IAAI;YACb,QAAQ,EAAE,IAAI;YACd,MAAM,EAAE;gBACN,IAAI,EAAE,MAAM,CAAC,IAAI;gBACjB,QAAQ,EAAE,MAAM,CAAC,QAAQ;gBACzB,KAAK,EAAE,KAAK,CAAC,KAAK;aACnB;SACF,CAAC,CACH,CAAA;IACH,CAAC;;GAEJ,CAAA;AACH,CAAC,CAAA","sourcesContent":["import { html } from 'lit'\n\nimport { i18next } from '@operato/i18n'\n\nimport { FilterConfigObject, FilterSelectRenderer } from '../types.js'\nimport { columnText } from '../utils/column-text.js'\n\n/*\n * Name the filter inputs in the header row.\n *\n * These boxes sit directly under the column name, so which column they narrow is obvious from\n * position alone — to a sighted reader. That relationship is a picture and reaches no one else: a\n * screen reader finds as many unnamed inputs as there are columns.\n *\n * The name comes from columnText(). Spelling it out here instead would leave the old name behind\n * whenever `header` changes.\n */\n\nexport const FilterInput: FilterSelectRenderer = (column, value, owner) => {\n const filter = column.filter as FilterConfigObject\n const type = filter?.type || column.type\n\n return html`\n <input\n type=${type as any}\n name=${column.name}\n aria-label=${i18next.t('text.grid-filter-of', {\n name: columnText(column),\n defaultValue: columnText(column)\n })}\n .value=${value == null ? '' : value}\n @change=${(e: CustomEvent) => {\n const input = e.target as HTMLInputElement\n input.dispatchEvent(\n new CustomEvent('filter-change', {\n bubbles: true,\n composed: true,\n detail: {\n name: column.name,\n operator: filter.operator,\n value: input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QAAQ,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE;aAC7E,CAAC,CACH,CAAA;QACH,CAAC;;KAEJ,CAAA;IACH,CAAC;IAED,OAAO,IAAI,CAAA;;aAEA,IAAW;aACX,MAAM,CAAC,IAAI;mBACL,OAAO,CAAC,CAAC,CAAC,qBAAqB,EAAE;QAC5C,IAAI,EAAE,UAAU,CAAC,MAAM,CAAC;QACxB,YAAY,EAAE,UAAU,CAAC,MAAM,CAAC;KACjC,CAAC;eACO,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK;gBACzB,CAAC,CAAc,EAAE,EAAE;QAC3B,MAAM,KAAK,GAAG,CAAC,CAAC,MAA0B,CAAA;QAC1C,KAAK,CAAC,aAAa,CACjB,IAAI,WAAW,CAAC,eAAe,EAAE;YAC/B,OAAO,EAAE,IAAI;YACb,QAAQ,EAAE,IAAI;YACd,MAAM,EAAE;gBACN,IAAI,EAAE,MAAM,CAAC,IAAI;gBACjB,QAAQ,EAAE,MAAM,CAAC,QAAQ;gBACzB,KAAK,EAAE,KAAK,CAAC,KAAK;aACnB;SACF,CAAC,CACH,CAAA;IACH,CAAC;;GAEJ,CAAA;AACH,CAAC,CAAA","sourcesContent":["import '@operato/input/ox-input-date.js'\n\nimport { html } from 'lit'\n\nimport { i18next } from '@operato/i18n'\n\nimport { FilterConfigObject, FilterSelectRenderer } from '../types.js'\nimport { columnText } from '../utils/column-text.js'\n\n/*\n * Name the filter inputs in the header row.\n *\n * These boxes sit directly under the column name, so which column they narrow is obvious from\n * position alone — to a sighted reader. That relationship is a picture and reaches no one else: a\n * screen reader finds as many unnamed inputs as there are columns.\n *\n * The name comes from columnText(). Spelling it out here instead would leave the old name behind\n * whenever `header` changes.\n */\n\nexport const FilterInput: FilterSelectRenderer = (column, value, owner) => {\n const filter = column.filter as FilterConfigObject\n const type = filter?.type || column.type\n\n if (type === 'date' || type === 'week' || type === 'month') {\n /* A day, a week or a month: the one field for them (ox-input-date). */\n return html`\n <ox-input-date\n type=${type}\n name=${column.name}\n aria-label=${i18next.t('text.grid-filter-of', { name: columnText(column), defaultValue: columnText(column) })}\n .value=${value == null ? '' : String(value)}\n @change=${(e: Event) => {\n const field = e.currentTarget as HTMLInputElement\n field.dispatchEvent(\n new CustomEvent('filter-change', {\n bubbles: true,\n composed: true,\n detail: { name: column.name, operator: filter.operator, value: field.value }\n })\n )\n }}\n ></ox-input-date>\n `\n }\n\n return html`\n <input\n type=${type as any}\n name=${column.name}\n aria-label=${i18next.t('text.grid-filter-of', {\n name: columnText(column),\n defaultValue: columnText(column)\n })}\n .value=${value == null ? '' : value}\n @change=${(e: CustomEvent) => {\n const input = e.target as HTMLInputElement\n input.dispatchEvent(\n new CustomEvent('filter-change', {\n bubbles: true,\n composed: true,\n detail: {\n name: column.name,\n operator: filter.operator,\n value: input.value\n }\n })\n )\n }}\n />\n `\n}\n"]}
|
|
@@ -1,2 +1,9 @@
|
|
|
1
|
+
import '@operato/input/ox-input-date.js';
|
|
2
|
+
import { DateUnit } from '@operato/input/date-text.js';
|
|
1
3
|
import { FilterSelectRenderer } from '../types.js';
|
|
4
|
+
/**
|
|
5
|
+
* A bound as a value of its unit: a day, a week or a month as the browser's input writes it. A default bound can come
|
|
6
|
+
* as a time or a Date; a value of the unit is kept as it is.
|
|
7
|
+
*/
|
|
8
|
+
export declare function boundOfUnit(unit: DateUnit, bound: unknown): string;
|
|
2
9
|
export declare const FilterRangeDate: FilterSelectRenderer;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import '@operato/input/ox-input-date.js';
|
|
1
2
|
import { html } from 'lit';
|
|
2
3
|
import { i18next } from '@operato/i18n';
|
|
4
|
+
import { normalizeValue, valueOfDay } from '@operato/input/date-text.js';
|
|
3
5
|
import { columnText } from '../utils/column-text.js';
|
|
4
6
|
/*
|
|
5
7
|
* Two inputs bounding a range: from and to. Without names a screen reader cannot tell them apart —
|
|
@@ -15,10 +17,61 @@ function formatDate(type, date) {
|
|
|
15
17
|
var formatDate = year + '-' + month + '-' + day;
|
|
16
18
|
return type == 'date' ? formatDate : formatDate + 'T' + hours + ':' + minutes;
|
|
17
19
|
}
|
|
20
|
+
const DATE_UNITS = ['date', 'week', 'month'];
|
|
21
|
+
/**
|
|
22
|
+
* A bound as a value of its unit: a day, a week or a month as the browser's input writes it. A default bound can come
|
|
23
|
+
* as a time or a Date; a value of the unit is kept as it is.
|
|
24
|
+
*/
|
|
25
|
+
export function boundOfUnit(unit, bound) {
|
|
26
|
+
if (bound == null || bound === '')
|
|
27
|
+
return '';
|
|
28
|
+
if (typeof bound === 'string' && normalizeValue(unit, bound))
|
|
29
|
+
return bound;
|
|
30
|
+
const date = new Date(bound);
|
|
31
|
+
if (isNaN(date.getTime()))
|
|
32
|
+
return '';
|
|
33
|
+
return valueOfDay(unit, { y: date.getFullYear(), m: date.getMonth() + 1, d: date.getDate() });
|
|
34
|
+
}
|
|
18
35
|
export const FilterRangeDate = (column, value, owner) => {
|
|
19
36
|
const filter = column.filter;
|
|
20
37
|
var [from, to] = value instanceof Array ? value : [];
|
|
21
38
|
var type = (filter === null || filter === void 0 ? void 0 : filter.type) || column.type;
|
|
39
|
+
if (DATE_UNITS.includes(type)) {
|
|
40
|
+
/* A day, a week or a month: the one field for them. Either bound changed narrows the column by both. */
|
|
41
|
+
const changed = (e) => {
|
|
42
|
+
const field = e.currentTarget;
|
|
43
|
+
field.dispatchEvent(new CustomEvent('filter-change', {
|
|
44
|
+
bubbles: true,
|
|
45
|
+
composed: true,
|
|
46
|
+
detail: {
|
|
47
|
+
name: column.name,
|
|
48
|
+
operator: filter.operator,
|
|
49
|
+
value: Array.from(field.parentElement.querySelectorAll('ox-input-date[from], ox-input-date[to]')).map(field => field.value)
|
|
50
|
+
}
|
|
51
|
+
}));
|
|
52
|
+
};
|
|
53
|
+
return html `
|
|
54
|
+
<ox-input-date
|
|
55
|
+
name=${column.name}
|
|
56
|
+
type=${type}
|
|
57
|
+
.value=${boundOfUnit(type, from)}
|
|
58
|
+
from
|
|
59
|
+
placeholder=${i18next.t(`text.grid-range-from-${type}`, { defaultValue: 'start' })}
|
|
60
|
+
aria-label=${i18next.t('text.grid-filter-from', { name: columnText(column), defaultValue: columnText(column) })}
|
|
61
|
+
@change=${changed}
|
|
62
|
+
></ox-input-date>
|
|
63
|
+
~
|
|
64
|
+
<ox-input-date
|
|
65
|
+
name=${column.name}
|
|
66
|
+
type=${type}
|
|
67
|
+
.value=${boundOfUnit(type, to)}
|
|
68
|
+
to
|
|
69
|
+
placeholder=${i18next.t(`text.grid-range-to-${type}`, { defaultValue: 'end' })}
|
|
70
|
+
aria-label=${i18next.t('text.grid-filter-to', { name: columnText(column), defaultValue: columnText(column) })}
|
|
71
|
+
@change=${changed}
|
|
72
|
+
></ox-input-date>
|
|
73
|
+
`;
|
|
74
|
+
}
|
|
22
75
|
if (type === 'datetime') {
|
|
23
76
|
type = 'datetime-local';
|
|
24
77
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filter-range-date.js","sourceRoot":"","sources":["../../../src/filters/filter-range-date.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAE1B,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"filter-range-date.js","sourceRoot":"","sources":["../../../src/filters/filter-range-date.ts"],"names":[],"mappings":"AAAA,OAAO,iCAAiC,CAAA;AAExC,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAE1B,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC,OAAO,EAAY,cAAc,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAA;AAGlF,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AAEpD;;;;GAIG;AAEH,SAAS,UAAU,CAAC,IAAY,EAAE,IAAU;IAC1C,IAAI,IAAI,GAAG,IAAI,CAAC,WAAW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next } from '@operato/i18n'\nimport { DateUnit, normalizeValue, valueOfDay } from '@operato/input/date-text.js'\n\nimport { FilterConfigObject, FilterSelectRenderer } from '../types.js'\nimport { columnText } from '../utils/column-text.js'\n\n/*\n * Two inputs bounding a range: from and to. Without names a screen reader cannot tell them apart —\n * two identical boxes in the same place read as \"edit, edit\". The ~ between them says which is\n * which to the eye, but that is a drawn character, not a relationship.\n */\n\nfunction formatDate(type: string, date: Date) {\n var year = date.getFullYear()\n var month = ('0' + (date.getMonth() + 1)).slice(-2)\n var day = ('0' + date.getDate()).slice(-2)\n var hours = ('0' + date.getHours()).slice(-2)\n var minutes = ('0' + date.getMinutes()).slice(-2)\n\n var formatDate = year + '-' + month + '-' + day\n\n return type == 'date' ? formatDate : formatDate + 'T' + hours + ':' + minutes\n}\n\nconst DATE_UNITS = ['date', 'week', 'month']\n\n/**\n * A bound as a value of its unit: a day, a week or a month as the browser's input writes it. A default bound can come\n * as a time or a Date; a value of the unit is kept as it is.\n */\nexport function boundOfUnit(unit: DateUnit, bound: unknown): string {\n if (bound == null || bound === '') return ''\n if (typeof bound === 'string' && normalizeValue(unit, bound)) return bound\n const date = new Date(bound as any)\n if (isNaN(date.getTime())) return ''\n return valueOfDay(unit, { y: date.getFullYear(), m: date.getMonth() + 1, d: date.getDate() })\n}\n\nexport const FilterRangeDate: FilterSelectRenderer = (column, value, owner) => {\n const filter = column.filter as FilterConfigObject\n\n var [from, to] = value instanceof Array ? value : []\n\n var type: any = filter?.type || column.type\n\n if (DATE_UNITS.includes(type)) {\n /* A day, a week or a month: the one field for them. Either bound changed narrows the column by both. */\n const changed = (e: Event) => {\n const field = e.currentTarget as HTMLElement\n field.dispatchEvent(\n new CustomEvent('filter-change', {\n bubbles: true,\n composed: true,\n detail: {\n name: column.name,\n operator: filter.operator,\n value: Array.from(field.parentElement!.querySelectorAll('ox-input-date[from], ox-input-date[to]')).map(\n field => (field as HTMLInputElement).value\n )\n }\n })\n )\n }\n\n return html`\n <ox-input-date\n name=${column.name}\n type=${type}\n .value=${boundOfUnit(type, from)}\n from\n placeholder=${i18next.t(`text.grid-range-from-${type}`, { defaultValue: 'start' })}\n aria-label=${i18next.t('text.grid-filter-from', { name: columnText(column), defaultValue: columnText(column) })}\n @change=${changed}\n ></ox-input-date>\n ~\n <ox-input-date\n name=${column.name}\n type=${type}\n .value=${boundOfUnit(type, to)}\n to\n placeholder=${i18next.t(`text.grid-range-to-${type}`, { defaultValue: 'end' })}\n aria-label=${i18next.t('text.grid-filter-to', { name: columnText(column), defaultValue: columnText(column) })}\n @change=${changed}\n ></ox-input-date>\n `\n }\n if (type === 'datetime') {\n type = 'datetime-local'\n }\n\n from = formatDate(type, new Date(from))\n to = formatDate(type, new Date(to))\n\n return html`\n <input\n name=${column.name}\n type=${type}\n .value=${from}\n from\n aria-label=${i18next.t('text.grid-filter-from', { name: columnText(column), defaultValue: columnText(column) })}\n @keyup=${(e: KeyboardEvent) => {\n if (e.key !== 'Enter') {\n return\n }\n ;(e.target as HTMLElement).dispatchEvent(\n new CustomEvent('filter-change', {\n bubbles: true,\n composed: true,\n detail: {\n name: column.name,\n operator: filter.operator,\n value: Array.from(\n (e.target as HTMLElement).parentElement!.querySelectorAll('input[from], input[to]')\n ).map(input => (input as HTMLInputElement).value)\n }\n })\n )\n }}\n />\n ~\n <input\n name=${column.name}\n type=${type}\n .value=${to}\n to\n aria-label=${i18next.t('text.grid-filter-to', { name: columnText(column), defaultValue: columnText(column) })}\n @keyup=${(e: KeyboardEvent) => {\n if (e.key !== 'Enter') {\n return\n }\n ;(e.target as HTMLElement).dispatchEvent(\n new CustomEvent('filter-change', {\n bubbles: true,\n composed: true,\n detail: {\n name: column.name,\n operator: filter.operator,\n value: Array.from(\n (e.target as HTMLElement).parentElement!.querySelectorAll('input[from], input[to]')\n ).map(input => (input as HTMLInputElement).value)\n }\n })\n )\n }}\n />\n `\n}\n"]}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import '@operato/input/ox-input-select-buttons.js';
|
|
2
2
|
import { html } from 'lit';
|
|
3
|
+
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
4
|
+
import { i18next } from '@operato/i18n';
|
|
5
|
+
import { hasAllChip } from './pill-choice.js';
|
|
3
6
|
export const FilterSelectButtons = (column, value, owner) => {
|
|
4
7
|
const filter = column.filter;
|
|
5
8
|
const operator = filter === null || filter === void 0 ? void 0 : filter.operator;
|
|
@@ -10,6 +13,8 @@ export const FilterSelectButtons = (column, value, owner) => {
|
|
|
10
13
|
}
|
|
11
14
|
options = options.call(column, owner);
|
|
12
15
|
}
|
|
16
|
+
/* A first 「전체」 chip when nothing may be chosen; otherwise a single choice stays chosen on a second press. */
|
|
17
|
+
const withAll = hasAllChip(filter, options);
|
|
13
18
|
options = options.map((option) => {
|
|
14
19
|
var _a, _b, _c;
|
|
15
20
|
switch (typeof option) {
|
|
@@ -37,6 +42,8 @@ export const FilterSelectButtons = (column, value, owner) => {
|
|
|
37
42
|
.value=${value}
|
|
38
43
|
.options=${options}
|
|
39
44
|
?multiple=${operator === 'in'}
|
|
45
|
+
all-label=${ifDefined(withAll ? i18next.t('label.all') : undefined)}
|
|
46
|
+
?required=${!withAll && operator !== 'in' && options.filter((option) => !!(option === null || option === void 0 ? void 0 : option.value)).length > 1}
|
|
40
47
|
@change=${(e) => {
|
|
41
48
|
;
|
|
42
49
|
e.target.dispatchEvent(new CustomEvent('filter-change', {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filter-select-buttons.js","sourceRoot":"","sources":["../../../src/filters/filter-select-buttons.ts"],"names":[],"mappings":"AAAA,OAAO,2CAA2C,CAAA;AAElD,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;
|
|
1
|
+
{"version":3,"file":"filter-select-buttons.js","sourceRoot":"","sources":["../../../src/filters/filter-select-buttons.ts"],"names":[],"mappings":"AAAA,OAAO,2CAA2C,CAAA;AAElD,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC1B,O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AE,MAAA,MAAM,CAAC,KAAK,mCAAI,MAAA,MAAC,KAAa,aAAb,KAAK,uBAAL,KAAK,CAAU,MAAM,0CAAG,MAAM,CAAC,IAAI,CAAC,0CAAG,MAAM,CAAC,KAAK,CAAC;iBAC7E,CAAA;YACH;gBACE,OAAO,MAAM,CAAA;QACjB,CAAC;IACH,CAAC,CAAC,CAAA;IAEF,OAAO,IAAI,CAAA;;aAEA,MAAM,CAAC,IAAI;eACT,KAAK;iBACH,OAAO;kBACN,QAAQ,KAAK,IAAI;kBACjB,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;kBACvD,CAAC,OAAO,IAAI,QAAQ,KAAK,IAAI,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC,MAAW,EAAE,EAAE,CAAC,CAAC,CAAC,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,KAAK,CAAA,CAAC,CAAC,MAAM,GAAG,CAAC;gBAC9F,CAAC,CAAc,EAAE,EAAE;QAC3B,CAAC;QAAC,CAAC,CAAC,MAAsB,CAAC,aAAa,CACtC,IAAI,WAAW,CAAC,eAAe,EAAE;YAC/B,OAAO,EAAE,IAAI;YACb,QAAQ,EAAE,IAAI;YACd,MAAM,EAAE;gBACN,IAAI,EAAE,MAAM,CAAC,IAAI;gBACjB,QAAQ,EAAE,MAAM,CAAC,QAAQ;gBACzB,KAAK,EAAG,CAAC,CAAC,MAA2B,CAAC,KAAK;aAC5C;SACF,CAAC,CACH,CAAA;IACH,CAAC;;GAEJ,CAAA;AACH,CAAC,CAAA","sourcesContent":["import '@operato/input/ox-input-select-buttons.js'\n\nimport { html } from 'lit'\nimport { ifDefined } from 'lit/directives/if-defined.js'\nimport { i18next } from '@operato/i18n'\n\nimport { FilterConfigObject, FilterSelectRenderer } from '../types.js'\nimport { hasAllChip } from './pill-choice.js'\n\nexport const FilterSelectButtons: FilterSelectRenderer = (column, value, owner) => {\n const filter = column.filter as FilterConfigObject\n const operator = filter?.operator\n\n var options = filter?.options || column.record.options || []\n\n if (typeof options === 'function') {\n if (!filter?.options) {\n console.warn(\n 'ox-grist의 column.filter 속성에서는 column.record.options의 함수형 options을 사용할 수 없으므로, filter 속성에서 재지정해야한다.'\n )\n }\n options = options.call(column, owner)\n }\n\n /* A first 「전체」 chip when nothing may be chosen; otherwise a single choice stays chosen on a second press. */\n const withAll = hasAllChip(filter, options)\n\n options = options.map((option: any) => {\n switch (typeof option) {\n case 'string':\n return {\n display: option,\n value: option\n }\n case 'object':\n /* The meaning on hover and the count after the name pass through to the chip as given. */\n return {\n display: option.display,\n value: option.value,\n hint: option.hint,\n /* The option's own count, else what the grid's countHandler read for this column and value. */\n count: option.count ?? (owner as any)?.counts?.[column.name]?.[option.value]\n }\n default:\n return option\n }\n })\n\n return html`\n <ox-input-select-buttons\n name=${column.name}\n .value=${value}\n .options=${options}\n ?multiple=${operator === 'in'}\n all-label=${ifDefined(withAll ? i18next.t('label.all') : undefined)}\n ?required=${!withAll && operator !== 'in' && options.filter((option: any) => !!option?.value).length > 1}\n @change=${(e: CustomEvent) => {\n ;(e.target as HTMLElement).dispatchEvent(\n new CustomEvent('filter-change', {\n bubbles: true,\n composed: true,\n detail: {\n name: column.name,\n operator: filter.operator,\n value: (e.target as HTMLInputElement).value\n }\n })\n )\n }}\n ></ox-input-select-buttons>\n `\n}\n"]}
|
|
@@ -36,6 +36,7 @@ export const FilterStyles = css `
|
|
|
36
36
|
|
|
37
37
|
input,
|
|
38
38
|
ox-input-search,
|
|
39
|
+
ox-input-date,
|
|
39
40
|
[filter-input] {
|
|
40
41
|
padding: var(--ox-filters-input-padding);
|
|
41
42
|
}
|
|
@@ -44,6 +45,7 @@ export const FilterStyles = css `
|
|
|
44
45
|
* platform keeps their natural height. */
|
|
45
46
|
ox-select,
|
|
46
47
|
ox-input-search,
|
|
48
|
+
ox-input-date,
|
|
47
49
|
input:not([type='checkbox']):not([type='radio']),
|
|
48
50
|
[filter-input] {
|
|
49
51
|
box-sizing: border-box;
|
|
@@ -52,6 +54,7 @@ export const FilterStyles = css `
|
|
|
52
54
|
|
|
53
55
|
ox-select,
|
|
54
56
|
ox-input-search,
|
|
57
|
+
ox-input-date,
|
|
55
58
|
input,
|
|
56
59
|
[filter-input] {
|
|
57
60
|
border: none;
|
|
@@ -63,6 +66,7 @@ export const FilterStyles = css `
|
|
|
63
66
|
}
|
|
64
67
|
|
|
65
68
|
ox-select:focus,
|
|
69
|
+
ox-input-date:focus-within,
|
|
66
70
|
input:focus,
|
|
67
71
|
[filter-input]:focus {
|
|
68
72
|
outline: none;
|
|
@@ -86,7 +90,8 @@ export const FilterStyles = css `
|
|
|
86
90
|
input[type*='date'],
|
|
87
91
|
input[type*='time'],
|
|
88
92
|
input[type='week'],
|
|
89
|
-
input[type='month']
|
|
93
|
+
input[type='month'],
|
|
94
|
+
ox-input-date {
|
|
90
95
|
max-width: 170px;
|
|
91
96
|
}
|
|
92
97
|
|
|
@@ -122,7 +127,8 @@ export const FilterStyles = css `
|
|
|
122
127
|
max-width: unset;
|
|
123
128
|
}
|
|
124
129
|
|
|
125
|
-
input
|
|
130
|
+
input,
|
|
131
|
+
ox-input-date {
|
|
126
132
|
background-color: var(--input-field-background, var(--md-sys-color-surface-container-highest));
|
|
127
133
|
color: var(--input-field-color, var(--md-sys-color-on-surface));
|
|
128
134
|
flex: 1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filter-styles.js","sourceRoot":"","sources":["../../../src/filters/filter-styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAEzB,OAAO,EAAE,sBAAsB,EAAE,MAAM,yCAAyC,CAAA;AAEhF,MAAM,CAAC,MAAM,YAAY,GAAG,GAAG,CAAA
|
|
1
|
+
{"version":3,"file":"filter-styles.js","sourceRoot":"","sources":["../../../src/filters/filter-styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAEzB,OAAO,EAAE,sBAAsB,EAAE,MAAM,yCAAyC,CAAA;AAEhF,MAAM,CAAC,MAAM,YAAY,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAiDjB,sBAAsB,CAAC,6BAA6B,EAAE,MAAM,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqF1E,CAAA","sourcesContent":["import { css } from 'lit'\n\nimport { suiteFormElementHeight } from '@operato/styles/form-element-heights.js'\n\nexport const FilterStyles = css`\n :host {\n --ox-filters-input-placeholder-color: var(--input-placeholder-color, var(--md-sys-color-on-surface));\n\n --ox-filters-input-border: var(--input-border, 1px solid rgba(0, 0, 0, 0.2));\n --ox-filters-input-focus-border: var(--input-focus-border, 1px solid var(--md-sys-color-outline-variant));\n --ox-filters-input-font: var(--input-font, normal 14px var(--theme-font));\n --ox-filters-input-color: var(--input-color, var(--md-sys-color-on-surface));\n --ox-filters-input-focus-color: var(--input-focus-color, var(--md-sys-color-on-surface-variant));\n --ox-filters-label-font: var(--label-font, normal 14px var(--theme-font));\n --ox-filters-label-color: var(--label-color, var(--md-sys-color-on-surface));\n --ox-filters-input-background-color: transparent;\n\n --ox-filters-form-gap: var(--input-gap-vertical, 8px) var(--input-gap-horizontal, 16px);\n --ox-filters-input-padding: var(--spacing-small, 4px);\n\n --ox-select-padding: var(--ox-filters-input-padding);\n --ox-checkbox-background-color: var(--ox-filters-input-background-color, transparent);\n }\n\n label {\n color: var(--ox-filters-label-color, var(--md-sys-color-on-primary-container));\n }\n\n span {\n font-weight: var(--md-sys-typescale-label-medium-weight, var(--md-ref-typeface-weight-medium, 500));\n text-transform: capitalize;\n }\n\n input::placeholder {\n color: var(--ox-filters-input-placeholder-color, var(--md-sys-color-surface-dim));\n opacity: 0.6;\n }\n\n input,\n ox-input-search,\n ox-input-date,\n [filter-input] {\n padding: var(--ox-filters-input-padding);\n }\n\n /* A grid filter bar is a dense row: the operato products give its inputs the small input height; the\n * platform keeps their natural height. */\n ox-select,\n ox-input-search,\n ox-input-date,\n input:not([type='checkbox']):not([type='radio']),\n [filter-input] {\n box-sizing: border-box;\n height: ${suiteFormElementHeight('--form-element-height-small', 'auto')};\n }\n\n ox-select,\n ox-input-search,\n ox-input-date,\n input,\n [filter-input] {\n border: none;\n border-bottom: var(--ox-filters-input-border, var(--md-sys-color-outline));\n font: var(--ox-filters-input-font);\n color: var(--ox-filters-input-color, var(--md-sys-color-on-surface));\n background-color: var(--ox-filters-input-background-color, transparent);\n vertical-align: middle;\n }\n\n ox-select:focus,\n ox-input-date:focus-within,\n input:focus,\n [filter-input]:focus {\n outline: none;\n border-bottom: var(--ox-filters-input-focus-border, var(--md-sys-color-outline-variant));\n color: var(--ox-filters-input-focus-color, var(--md-sys-color-on-surface-variant));\n }\n\n ox-select {\n min-width: 90px;\n max-width: 170px;\n }\n\n ox-input-search {\n max-width: 150px;\n }\n\n input[type='number'] {\n max-width: 90px;\n }\n\n input[type*='date'],\n input[type*='time'],\n input[type='week'],\n input[type='month'],\n ox-input-date {\n max-width: 170px;\n }\n\n [filter-input] {\n min-width: 140px;\n max-width: 170px;\n }\n\n @media only screen and (max-width: 460px) {\n :host {\n --ox-filters-form-label-font: bold 13px var(--theme-font);\n --ox-filters-input-font: normal 16px var(--theme-font);\n }\n\n ox-input-barcode {\n max-width: unset;\n flex: 1;\n }\n\n ox-input-search {\n max-width: unset;\n }\n\n ox-select {\n max-width: unset;\n }\n\n ox-checkbox {\n max-width: unset;\n }\n\n input[type='number'] {\n max-width: unset;\n }\n\n input,\n ox-input-date {\n background-color: var(--input-field-background, var(--md-sys-color-surface-container-highest));\n color: var(--input-field-color, var(--md-sys-color-on-surface));\n flex: 1;\n }\n }\n`\n"]}
|