@omegagrid/grid 0.11.32 → 0.11.34

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.
Files changed (46) hide show
  1. package/dist/editors/baseEditor.d.ts.map +1 -1
  2. package/dist/editors/baseEditor.js +6 -3
  3. package/dist/editors/baseEditor.js.map +1 -1
  4. package/dist/editors/calendarEditor.d.ts +10 -1
  5. package/dist/editors/calendarEditor.d.ts.map +1 -1
  6. package/dist/editors/calendarEditor.js +113 -19
  7. package/dist/editors/calendarEditor.js.map +1 -1
  8. package/dist/editors/dateEditor.d.ts +3 -1
  9. package/dist/editors/dateEditor.d.ts.map +1 -1
  10. package/dist/editors/dateEditor.js +22 -3
  11. package/dist/editors/dateEditor.js.map +1 -1
  12. package/dist/editors/index.d.ts.map +1 -1
  13. package/dist/editors/index.js +2 -0
  14. package/dist/editors/index.js.map +1 -1
  15. package/dist/filters/dateFilter.d.ts +54 -0
  16. package/dist/filters/dateFilter.d.ts.map +1 -0
  17. package/dist/filters/dateFilter.js +179 -0
  18. package/dist/filters/dateFilter.js.map +1 -0
  19. package/dist/filters/filterFactory.js +3 -3
  20. package/dist/filters/filterFactory.js.map +1 -1
  21. package/dist/filters/index.d.ts +1 -2
  22. package/dist/filters/index.d.ts.map +1 -1
  23. package/dist/filters/index.js +1 -2
  24. package/dist/filters/index.js.map +1 -1
  25. package/dist/renderers/DateTimeRenderer.d.ts.map +1 -1
  26. package/dist/renderers/DateTimeRenderer.js +3 -1
  27. package/dist/renderers/DateTimeRenderer.js.map +1 -1
  28. package/dist/ui/filterLabel.d.ts.map +1 -1
  29. package/dist/ui/filterLabel.js +0 -27
  30. package/dist/ui/filterLabel.js.map +1 -1
  31. package/dist/ui/grid.d.ts +15 -0
  32. package/dist/ui/grid.d.ts.map +1 -1
  33. package/dist/ui/grid.editing.d.ts.map +1 -1
  34. package/dist/ui/grid.editing.js +5 -4
  35. package/dist/ui/grid.editing.js.map +1 -1
  36. package/dist/ui/grid.js +39 -4
  37. package/dist/ui/grid.js.map +1 -1
  38. package/package.json +7 -7
  39. package/dist/filters/rangeFilter.d.ts +0 -15
  40. package/dist/filters/rangeFilter.d.ts.map +0 -1
  41. package/dist/filters/rangeFilter.js +0 -130
  42. package/dist/filters/rangeFilter.js.map +0 -1
  43. package/dist/filters/rangeFilterPopup.d.ts +0 -30
  44. package/dist/filters/rangeFilterPopup.d.ts.map +0 -1
  45. package/dist/filters/rangeFilterPopup.js +0 -137
  46. package/dist/filters/rangeFilterPopup.js.map +0 -1
@@ -0,0 +1,179 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ import constants from "../constants";
8
+ import { customElement } from 'lit/decorators.js';
9
+ import { BaseFilter } from "./baseFilter";
10
+ import { html, css } from 'lit';
11
+ import { createRef, ref } from 'lit/directives/ref.js';
12
+ import { msg } from '@omegagrid/localize';
13
+ import { dates } from '@omegagrid/core';
14
+ import { parseDateExpression } from '@omegagrid/grid-core';
15
+ import { isSameDay, startOfDay, subMilliseconds } from 'date-fns';
16
+ /**
17
+ * Text filter of the date (d), date and time (dt) and time (tm) columns. The user types a date expression such as
18
+ * `6.11.2026` (the whole day), `6.11.2026..20.11.2026`, `> 6.11.2026`, `11.2026` (the month), `2026` (the year),
19
+ * `6.11.2026 14:00` (the minute), `9:00..17:00` (a time column), `<= 6.11.2026 or 9.11.2026`; see grid-core's
20
+ * `parseDateExpression`. A date column has a calendar button too: a day or a range of days picked in the calendar
21
+ * with two clicks is written into the input and applied. The expression is applied by Enter: the calendar button takes
22
+ * the place of the filter button of the other text filters.
23
+ */
24
+ let DateFilter = class DateFilter extends BaseFilter {
25
+ constructor() {
26
+ super(...arguments);
27
+ this.inputRef = createRef();
28
+ this.clearButtonRef = createRef();
29
+ this.dropdownRef = createRef();
30
+ this.calendarRef = createRef();
31
+ // the calendar shows the days of the typed expression picked, when it is a single day or a range of days: when it
32
+ // opens, and as the text is edited while it is open
33
+ this._onCalendarOpen = () => this._syncCalendar();
34
+ this._onInput = () => {
35
+ if (this.calendarDropdown?.isOpen)
36
+ this._syncCalendar();
37
+ };
38
+ // the second click completes the range: it is written into the input and applied
39
+ this._onRangeChange = (e) => {
40
+ if (!e.to || !this.input)
41
+ return;
42
+ this.input.value = isSameDay(e.from, e.to) ? this.formatDay(e.from) : `${this.formatDay(e.from)}..${this.formatDay(e.to)}`;
43
+ this.calendarDropdown?.close();
44
+ this._apply();
45
+ this.deactivate();
46
+ };
47
+ this.render = () => html `
48
+ <div class="filter-inner">
49
+ <input ${ref(this.inputRef)}
50
+ type="text"
51
+ title="${msg('Examples:')} ${this.examples}"
52
+ @keydown="${this._onInputKeyDown}"
53
+ @input="${this._onInput}"
54
+ .value="${this.termText(this.currentValue)}">
55
+ ${this.hasCalendar ? html `
56
+ <og-dropdown ${ref(this.dropdownRef)} icon="calendar-days" color="accent" alignment="right" noCaret
57
+ title="${msg('Pick a day or a range of days: the first click starts it, the second ends it')}"
58
+ @dropdown.open="${this._onCalendarOpen}">
59
+ <og-calendar ${ref(this.calendarRef)} slot="content" range @rangechange="${this._onRangeChange}"></og-calendar>
60
+ </og-dropdown>
61
+ ` : ''}
62
+ <og-button icon="xmark" color="red" ${ref(this.clearButtonRef)} @mousedown="${this._onClearClick}"></og-button>
63
+ </div>
64
+ `;
65
+ }
66
+ get input() { return this.inputRef.value; }
67
+ get clearButton() { return this.clearButtonRef.value; }
68
+ get calendarDropdown() { return this.dropdownRef.value; }
69
+ get calendar() { return this.calendarRef.value; }
70
+ get type() {
71
+ const t = this.columnModel?.type;
72
+ return (t === 'dt' || t === 'tm') ? t : 'd';
73
+ }
74
+ /** a time column has no calendar */
75
+ get hasCalendar() { return this.type !== 'tm'; }
76
+ // the format the calendar writes a day in: the date format of the locale, read back by the parser
77
+ get dayFormat() { return dates.getDateFormat(); }
78
+ formatDay(day) { return dates.format(day, this.dayFormat); }
79
+ /** The text of a term: the expression as typed */
80
+ termText(term) {
81
+ return term == null ? '' : term.toString();
82
+ }
83
+ _apply() {
84
+ const value = (this.input?.value ?? '').trim();
85
+ if (value === '') {
86
+ this.clearFilter();
87
+ }
88
+ else {
89
+ this.filter(value);
90
+ }
91
+ }
92
+ _onClearClick() {
93
+ if (this.input)
94
+ this.input.value = '';
95
+ this.clearFilter();
96
+ }
97
+ _onInputKeyDown(e) {
98
+ if (e.key == 'Enter') {
99
+ this._apply();
100
+ this.deactivate();
101
+ }
102
+ }
103
+ _syncCalendar() {
104
+ const calendar = this.calendar;
105
+ if (!calendar)
106
+ return;
107
+ const groups = parseDateExpression(this.input?.value ?? '', this.type);
108
+ const bounds = groups?.length === 1 ? groups[0] : null;
109
+ const from = bounds?.find(b => b.op === '>=')?.value ?? null;
110
+ const before = bounds?.find(b => b.op === '<')?.value ?? null;
111
+ calendar.rangeStart = from;
112
+ calendar.rangeEnd = from && before ? startOfDay(subMilliseconds(before, 1)) : null; // the last day of the range
113
+ // the calendar shows the month of the start, of today without one
114
+ calendar.date = startOfDay(from ?? new Date());
115
+ }
116
+ get examples() {
117
+ if (this.type === 'tm')
118
+ return '9:00, 9:00..17:00, >= 12:00, < 8:00 or > 16:00';
119
+ const day = this.formatDay(new Date(2026, 10, 6));
120
+ const other = this.formatDay(new Date(2026, 10, 20));
121
+ const time = this.type === 'dt' ? `, ${day} 14:00` : '';
122
+ return `${day}, ${day}..${other}, > ${day}, 11.2026, 2026, != 2026${time}`;
123
+ }
124
+ activate() {
125
+ super.activate();
126
+ if (this.input) {
127
+ this.input.value = this.termText(this.currentValue);
128
+ }
129
+ setTimeout(() => this.input?.select(), 100);
130
+ }
131
+ deactivate() {
132
+ this.calendarDropdown?.close();
133
+ super.deactivate();
134
+ }
135
+ };
136
+ DateFilter.styles = [...BaseFilter.styles, css `
137
+ .filter-inner {
138
+ height: 100%;
139
+ display: flex;
140
+ flex-direction: row;
141
+ overflow: hidden;
142
+ }
143
+
144
+ input {
145
+ border-width: 0;
146
+ outline: none;
147
+ height: 100%;
148
+ flex: 1;
149
+ width: 100%;
150
+ min-width: 0;
151
+ background-color: var(--og-background-color);
152
+ color: var(--og-text-color);
153
+ }
154
+
155
+ og-button, og-dropdown {
156
+ flex: 0;
157
+ min-width: 18px;
158
+ max-width: 18px;
159
+ padding: 0;
160
+ text-align: center;
161
+ border-width: 0;
162
+ border-radius: 0;
163
+ height: 100%;
164
+ }
165
+
166
+ og-dropdown {
167
+ display: flex;
168
+ }
169
+
170
+ og-calendar {
171
+ width: 300px;
172
+ height: 260px;
173
+ }
174
+ `];
175
+ DateFilter = __decorate([
176
+ customElement(`${constants.PREFIX}-filter-date`)
177
+ ], DateFilter);
178
+ export { DateFilter };
179
+ //# sourceMappingURL=dateFilter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dateFilter.js","sourceRoot":"","sources":["../../src/filters/dateFilter.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,SAAS,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAChC,OAAO,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,GAAG,EAAE,MAAM,qBAAqB,CAAC;AAC1C,OAAO,EAAY,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAkB,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC3E,OAAO,E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GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QACrD,CAAC;QACD,UAAU,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,GAAG,CAAC,CAAC;IAC7C,CAAC;IAED,UAAU;QACT,IAAI,CAAC,gBAAgB,EAAE,KAAK,EAAE,CAAC;QAC/B,KAAK,CAAC,UAAU,EAAE,CAAC;IACpB,CAAC;;AA/JM,iBAAM,GAAG,CAAC,GAAG,UAAU,CAAC,MAAM,EAAE,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAsCzC,CAAC,AAtCW,CAsCV;AAxCS,UAAU;IADtB,aAAa,CAAC,GAAG,SAAS,CAAC,MAAM,cAAc,CAAC;GACpC,UAAU,CAmKtB","sourcesContent":["import constants from \"../constants\";\nimport { customElement } from 'lit/decorators.js';\nimport { BaseFilter } from \"./baseFilter\";\nimport { html, css } from 'lit';\nimport { createRef, ref } from 'lit/directives/ref.js';\nimport { msg } from '@omegagrid/localize';\nimport { Dropdown, dates } from '@omegagrid/core';\nimport { DateFilterType, parseDateExpression } from '@omegagrid/grid-core';\nimport { isSameDay, startOfDay, subMilliseconds } from 'date-fns';\n\n/** The `rangechange` event of og-calendar in the range mode (omega-grid does not depend on omega-calendar) */\ntype RangeChangeEvent = Event & { from: Date, to: Date|null };\n\n/** og-calendar in the range mode, as far as the filter uses it */\ntype RangeCalendar = HTMLElement & { range: boolean, rangeStart: Date|null, rangeEnd: Date|null, date: Date };\n\n/**\n * Text filter of the date (d), date and time (dt) and time (tm) columns. The user types a date expression such as\n * `6.11.2026` (the whole day), `6.11.2026..20.11.2026`, `> 6.11.2026`, `11.2026` (the month), `2026` (the year),\n * `6.11.2026 14:00` (the minute), `9:00..17:00` (a time column), `<= 6.11.2026 or 9.11.2026`; see grid-core's\n * `parseDateExpression`. A date column has a calendar button too: a day or a range of days picked in the calendar\n * with two clicks is written into the input and applied. The expression is applied by Enter: the calendar button takes\n * the place of the filter button of the other text filters.\n */\n@customElement(`${constants.PREFIX}-filter-date`)\nexport class DateFilter extends BaseFilter {\n\n\tstatic styles = [...BaseFilter.styles, css`\n\t\t.filter-inner {\n\t\t\theight: 100%;\n\t\t\tdisplay: flex;\n\t\t\tflex-direction: row;\n\t\t\toverflow: hidden;\n\t\t}\n\n\t\tinput {\n\t\t\tborder-width: 0;\n\t\t\toutline: none;\n\t\t\theight: 100%;\n\t\t\tflex: 1;\n\t\t\twidth: 100%;\n\t\t\tmin-width: 0;\n\t\t\tbackground-color: var(--og-background-color);\n\t\t\tcolor: var(--og-text-color);\n\t\t}\n\n\t\tog-button, og-dropdown {\n\t\t\tflex: 0;\n\t\t\tmin-width: 18px;\n\t\t\tmax-width: 18px;\n\t\t\tpadding: 0;\n\t\t\ttext-align: center;\n\t\t\tborder-width: 0;\n\t\t\tborder-radius: 0;\n\t\t\theight: 100%;\n\t\t}\n\n\t\tog-dropdown {\n\t\t\tdisplay: flex;\n\t\t}\n\n\t\tog-calendar {\n\t\t\twidth: 300px;\n\t\t\theight: 260px;\n\t\t}\n\t`];\n\n\tprivate inputRef = createRef<HTMLInputElement>();\n\tget input() { return this.inputRef.value }\n\n\tprivate clearButtonRef = createRef<HTMLButtonElement>();\n\tget clearButton() { return this.clearButtonRef.value }\n\n\tprivate dropdownRef = createRef<Dropdown>();\n\tget calendarDropdown() { return this.dropdownRef.value }\n\n\tprivate calendarRef = createRef<RangeCalendar>();\n\tget calendar() { return this.calendarRef.value }\n\n\tget type(): DateFilterType {\n\t\tconst t = this.columnModel?.type;\n\t\treturn (t === 'dt' || t === 'tm') ? t : 'd';\n\t}\n\n\t/** a time column has no calendar */\n\tget hasCalendar() { return this.type !== 'tm' }\n\n\t// the format the calendar writes a day in: the date format of the locale, read back by the parser\n\tprivate get dayFormat() { return dates.getDateFormat() }\n\n\tprivate formatDay(day: Date) { return dates.format(day, this.dayFormat) }\n\n\t/** The text of a term: the expression as typed */\n\tprivate termText(term: unknown): string {\n\t\treturn term == null ? '' : term.toString();\n\t}\n\n\tprivate _apply() {\n\t\tconst value = (this.input?.value ?? '').trim();\n\t\tif (value === '') {\n\t\t\tthis.clearFilter();\n\t\t} else {\n\t\t\tthis.filter(value);\n\t\t}\n\t}\n\n\t_onClearClick() {\n\t\tif (this.input) this.input.value = '';\n\t\tthis.clearFilter();\n\t}\n\n\t_onInputKeyDown(e: KeyboardEvent) {\n\t\tif (e.key == 'Enter') {\n\t\t\tthis._apply();\n\t\t\tthis.deactivate();\n\t\t}\n\t}\n\n\t// the calendar shows the days of the typed expression picked, when it is a single day or a range of days: when it\n\t// opens, and as the text is edited while it is open\n\t_onCalendarOpen = () => this._syncCalendar();\n\n\t_onInput = () => {\n\t\tif (this.calendarDropdown?.isOpen) this._syncCalendar();\n\t}\n\n\tprivate _syncCalendar() {\n\t\tconst calendar = this.calendar;\n\t\tif (!calendar) return;\n\t\tconst groups = parseDateExpression(this.input?.value ?? '', this.type);\n\t\tconst bounds = groups?.length === 1 ? groups[0] : null;\n\t\tconst from = bounds?.find(b => b.op === '>=')?.value ?? null;\n\t\tconst before = bounds?.find(b => b.op === '<')?.value ?? null;\n\t\tcalendar.rangeStart = from;\n\t\tcalendar.rangeEnd = from && before ? startOfDay(subMilliseconds(before, 1)) : null; // the last day of the range\n\t\t// the calendar shows the month of the start, of today without one\n\t\tcalendar.date = startOfDay(from ?? new Date());\n\t}\n\n\t// the second click completes the range: it is written into the input and applied\n\t_onRangeChange = (e: RangeChangeEvent) => {\n\t\tif (!e.to || !this.input) return;\n\t\tthis.input.value = isSameDay(e.from, e.to) ? this.formatDay(e.from) : `${this.formatDay(e.from)}..${this.formatDay(e.to)}`;\n\t\tthis.calendarDropdown?.close();\n\t\tthis._apply();\n\t\tthis.deactivate();\n\t}\n\n\tprivate get examples() {\n\t\tif (this.type === 'tm') return '9:00, 9:00..17:00, >= 12:00, < 8:00 or > 16:00';\n\t\tconst day = this.formatDay(new Date(2026, 10, 6));\n\t\tconst other = this.formatDay(new Date(2026, 10, 20));\n\t\tconst time = this.type === 'dt' ? `, ${day} 14:00` : '';\n\t\treturn `${day}, ${day}..${other}, > ${day}, 11.2026, 2026, != 2026${time}`;\n\t}\n\n\trender = () => html`\n\t\t<div class=\"filter-inner\">\n\t\t\t<input ${ref(this.inputRef)}\n\t\t\t\ttype=\"text\"\n\t\t\t\ttitle=\"${msg('Examples:')} ${this.examples}\"\n\t\t\t\t@keydown=\"${this._onInputKeyDown}\"\n\t\t\t\t@input=\"${this._onInput}\"\n\t\t\t\t.value=\"${this.termText(this.currentValue)}\">\n\t\t\t${this.hasCalendar ? html`\n\t\t\t\t<og-dropdown ${ref(this.dropdownRef)} icon=\"calendar-days\" color=\"accent\" alignment=\"right\" noCaret\n\t\t\t\t\ttitle=\"${msg('Pick a day or a range of days: the first click starts it, the second ends it')}\"\n\t\t\t\t\t@dropdown.open=\"${this._onCalendarOpen}\">\n\t\t\t\t\t<og-calendar ${ref(this.calendarRef)} slot=\"content\" range @rangechange=\"${this._onRangeChange}\"></og-calendar>\n\t\t\t\t</og-dropdown>\n\t\t\t` : ''}\n\t\t\t<og-button icon=\"xmark\" color=\"red\" ${ref(this.clearButtonRef)} @mousedown=\"${this._onClearClick}\"></og-button>\n\t\t</div>\n\t`;\n\n\tactivate() {\n\t\tsuper.activate();\n\t\tif (this.input) {\n\t\t\tthis.input.value = this.termText(this.currentValue);\n\t\t}\n\t\tsetTimeout(() => this.input?.select(), 100);\n\t}\n\n\tdeactivate() {\n\t\tthis.calendarDropdown?.close();\n\t\tsuper.deactivate();\n\t}\n\n}\n"]}
@@ -25,9 +25,9 @@ const createDropdownFilter = (column) => {
25
25
  const filterMap = new Map([
26
26
  ['t', () => dom.createElement('og-filter-text')],
27
27
  ['n', () => dom.createElement('og-filter-number')],
28
- ['d', () => dom.createElement('og-filter-range')],
29
- ['dt', () => dom.createElement('og-filter-range')],
30
- ['tm', () => dom.createElement('og-filter-range')],
28
+ ['d', () => dom.createElement('og-filter-date')],
29
+ ['dt', () => dom.createElement('og-filter-date')],
30
+ ['tm', () => dom.createElement('og-filter-date')],
31
31
  ['b', () => dom.createElement('og-filter-checkbox')],
32
32
  ['s', (column) => createDropdownFilter(column)],
33
33
  ['m', (column) => createDropdownFilter(column)]
@@ -1 +1 @@
1
- {"version":3,"file":"filterFactory.js","sourceRoot":"","sources":["../../src/filters/filterFactory.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAItC,SAAS,oBAAoB,CAAC,MAAmB;IAChD,MAAM,MAAM,GAAG,IAAI,GAAG,EAAkB,CAAC;IAEzC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACnD,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAC5B,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,KAAe,EAAE,CAAC,IAAI,CAAC,YAAY,IAAI,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC;IACtF,CAAC;IAED,MAAM,KAAK,GAAe,EAAE,CAAC;IAC7B,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,EAAC,CAAC,EAAE,CAAC,EAAC,CAAC,CAAC,CAAC;IAC7C,OAAO,KAAK,CAAC;AACd,CAAC;AAED,MAAM,oBAAoB,GAAG,CAAC,MAAmB,EAAE,EAAE;IACpD,MAAM,SAAS,GAAG,GAAG,CAAC,aAAa,CAAiB,oBAAoB,CAAC,CAAC;IAC1E,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;QACpB,SAAS,CAAC,OAAO,GAAG,MAAM,CAAC,OAAsB,CAAC;IACnD,CAAC;SAAM,IAAI,MAAM,C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AAC;IAC9F,SAAS,CAAC,WAAW,GAAG,MAAM,CAAC;IAC/B,SAAS,CAAC,WAAW,GAAG,UAAU,CAAC;IACnC,OAAO,SAAS,CAAC;AAClB,CAAC","sourcesContent":["import { CellType, ColumnModel, FilterModel } from \"@omegagrid/grid-core\";\nimport { BaseFilter } from \"./baseFilter\";\nimport { dom } from \"@omegagrid/core\";\nimport { DropdownFilter } from \"./dropdownFilter\";\nimport { TreeAdapter, TreeSource } from \"@omegagrid/tree\";\n\nfunction collectDropdownItems(column: ColumnModel) : TreeSource {\n\tconst values = new Map<string, string>();\n\t\n\tfor (let r = 0; r < column.model.rows.length; r++) {\n\t\tconst cell = column.cell(r);\n\t\tvalues.set(cell.value as string, (cell.displayValue ?? cell.value ?? \"\").toString());\n\t}\n\n\tconst items: TreeSource = [];\n\tvalues.forEach((v, k) => items.push({k, v}));\n\treturn items;\n}\n\nconst createDropdownFilter = (column: ColumnModel) => {\n\tconst component = dom.createElement<DropdownFilter>('og-filter-dropdown');\n\tif (column.adapter) {\n\t\tcomponent.adapter = column.adapter as TreeAdapter;\n\t} else if (column.editorContent) {\n\t\tcomponent.items = column.editorContent as TreeSource;\n\t} else {\n\t\tcomponent.items = collectDropdownItems(column);\n\t}\n\treturn component;\n}\n\nconst filterMap = new Map<CellType, (column: ColumnModel) => BaseFilter>([\n\t['t', () => dom.createElement('og-filter-text')],\n\t['n', () => dom.createElement('og-filter-number')],\n\t['d', () => dom.createElement('og-filter-range')],\n\t['dt', () => dom.createElement('og-filter-range')],\n\t['tm', () => dom.createElement('og-filter-range')],\n\t['b', () => dom.createElement('og-filter-checkbox')],\n\t['s', (column) => createDropdownFilter(column)],\n\t['m', (column) => createDropdownFilter(column)]\n]);\n\nexport function createFilter(column: ColumnModel, filteModel: FilterModel): BaseFilter {\n\tconst factory = filterMap.get(column.type);\n\tconst component: BaseFilter = factory ? factory(column) : dom.createElement('og-filter-text');\n\tcomponent.columnModel = column;\n\tcomponent.filterModel = filteModel;\n\treturn component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BaseFilter } from \"./baseFilter\";\nimport { dom } from \"@omegagrid/core\";\nimport { DropdownFilter } from \"./dropdownFilter\";\nimport { TreeAdapter, TreeSource } from \"@omegagrid/tree\";\n\nfunction collectDropdownItems(column: ColumnModel) : TreeSource {\n\tconst values = new Map<string, string>();\n\t\n\tfor (let r = 0; r < column.model.rows.length; r++) {\n\t\tconst cell = column.cell(r);\n\t\tvalues.set(cell.value as string, (cell.displayValue ?? cell.value ?? \"\").toString());\n\t}\n\n\tconst items: TreeSource = [];\n\tvalues.forEach((v, k) => items.push({k, v}));\n\treturn items;\n}\n\nconst createDropdownFilter = (column: ColumnModel) => {\n\tconst component = dom.createElement<DropdownFilter>('og-filter-dropdown');\n\tif (column.adapter) {\n\t\tcomponent.adapter = column.adapter as TreeAdapter;\n\t} else if (column.editorContent) {\n\t\tcomponent.items = column.editorContent as TreeSource;\n\t} else {\n\t\tcomponent.items = collectDropdownItems(column);\n\t}\n\treturn component;\n}\n\nconst filterMap = new Map<CellType, (column: ColumnModel) => BaseFilter>([\n\t['t', () => dom.createElement('og-filter-text')],\n\t['n', () => dom.createElement('og-filter-number')],\n\t['d', () => dom.createElement('og-filter-date')],\n\t['dt', () => dom.createElement('og-filter-date')],\n\t['tm', () => dom.createElement('og-filter-date')],\n\t['b', () => dom.createElement('og-filter-checkbox')],\n\t['s', (column) => createDropdownFilter(column)],\n\t['m', (column) => createDropdownFilter(column)]\n]);\n\nexport function createFilter(column: ColumnModel, filteModel: FilterModel): BaseFilter {\n\tconst factory = filterMap.get(column.type);\n\tconst component: BaseFilter = factory ? factory(column) : dom.createElement('og-filter-text');\n\tcomponent.columnModel = column;\n\tcomponent.filterModel = filteModel;\n\treturn component;\n}\n"]}
@@ -2,7 +2,6 @@ export * from "./textFilter";
2
2
  export * from "./checkboxFilter";
3
3
  export * from "./dropdownFilter";
4
4
  export * from "./numberFilter";
5
- export * from "./rangeFilter";
6
- export * from "./rangeFilterPopup";
5
+ export * from "./dateFilter";
7
6
  export * from "./filterFactory";
8
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/filters/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/filters/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC"}
@@ -2,7 +2,6 @@ export * from "./textFilter";
2
2
  export * from "./checkboxFilter";
3
3
  export * from "./dropdownFilter";
4
4
  export * from "./numberFilter";
5
- export * from "./rangeFilter";
6
- export * from "./rangeFilterPopup";
5
+ export * from "./dateFilter";
7
6
  export * from "./filterFactory";
8
7
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/filters/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC","sourcesContent":["export * from \"./textFilter\";\nexport * from \"./checkboxFilter\";\nexport * from \"./dropdownFilter\";\nexport * from \"./numberFilter\";\nexport * from \"./rangeFilter\";\nexport * from \"./rangeFilterPopup\";\nexport * from \"./filterFactory\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/filters/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC","sourcesContent":["export * from \"./textFilter\";\nexport * from \"./checkboxFilter\";\nexport * from \"./dropdownFilter\";\nexport * from \"./numberFilter\";\nexport * from \"./dateFilter\";\nexport * from \"./filterFactory\";\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"DateTimeRenderer.d.ts","sourceRoot":"","sources":["../../src/renderers/DateTimeRenderer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAG/C,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,cAAc,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,mBAAmB,GAAI,cAAc,CAkBrH"}
1
+ {"version":3,"file":"DateTimeRenderer.d.ts","sourceRoot":"","sources":["../../src/renderers/DateTimeRenderer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAG/C,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,cAAc,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,mBAAmB,GAAI,cAAc,CAoBrH"}
@@ -3,8 +3,10 @@ import { dom } from "@omegagrid/core";
3
3
  export function DateTimeRenderer(div, cell, options) {
4
4
  const opts = cell.model.options;
5
5
  try {
6
+ // a date and time cell (type dt) or a time cell (type tm) without a format of its own shows the format of its type
7
+ const formatter = cell.type == 'dt' ? opts.dateTimeFormatter : (cell.type == 'tm' ? opts.timeFormatter : opts.dateFormatter);
6
8
  div.textContent = cell.value
7
- ? opts.dateFormatter(cell.value, cell.format)
9
+ ? formatter(cell.value, cell.format)
8
10
  : '';
9
11
  }
10
12
  catch (_err) {
@@ -1 +1 @@
1
- {"version":3,"file":"DateTimeRenderer.js","sourceRoot":"","sources":["../../src/renderers/DateTimeRenderer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAEtC,MAAM,UAAU,gBAAgB,CAAC,GAAmB,EAAE,IAAe,EAAE,OAA6B;IACnG,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC;IAChC,IAAI,CAAC;QACJ,GAAG,CAAC,WAAW,GAAG,IAAI,CAAC,KAAK;YAC3B,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,KAAoB,EAAE,IAAI,CAAC,MAAM,CAAC;YAC5D,CAAC,CAAC,EAAE,CAAC;IACP,CAAC;IAAC,OAAO,IAAI,EAAE,CAAC;QACf,GAAG,CAAC,WAAW,GAAG,iBAAiB,CAAC;IACrC,CAAC;IAED,IAAI,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,OAAO,EAAE,kBAAkB,EAAE,CAAC;QACvD,MAAM,QAAQ,GAAG,GAAG,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;QAC1C,QAAQ,CAAC,SAAS,GAAG,eAAe,CAAC;QACrC,GAAG,CAAC,WAAW,CAAC,QAAQ,EAAE,EAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAC,CAAC,CAAC;QACxC,GAAG,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;IAC3B,CAAC;IAED,OAAO,YAAY,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;AACpD,CAAC","sourcesContent":["import { CellModel } from \"@omegagrid/grid-core\";\nimport { BaseRenderer } from \"./BaseRenderer\";\nimport { CellRendererOptions } from \"../types\";\nimport { dom } from \"@omegagrid/core\";\n\nexport function DateTimeRenderer(div: HTMLDivElement, cell: CellModel, options?: CellRendererOptions) : HTMLDivElement {\n\tconst opts = cell.model.options;\n\ttry {\n\t\tdiv.textContent = cell.value \n\t\t\t? opts.dateFormatter(cell.value as Date|string, cell.format)\n\t\t\t: '';\t\n\t} catch (_err) {\n\t\tdiv.textContent = '!invalid format';\n\t}\n\t\n\tif (cell.editable && opts.editing?.dateCalendarEditor) {\n\t\tconst triangle = dom.createElement('div');\n\t\ttriangle.className = 'triangle-down';\n\t\tdom.setPosition(triangle, {t: 8, r: 8});\n\t\tdiv.appendChild(triangle);\n\t}\n\n\treturn BaseRenderer.call(this, div, cell, options);\n}"]}
1
+ {"version":3,"file":"DateTimeRenderer.js","sourceRoot":"","sources":["../../src/renderers/DateTimeRenderer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAEtC,MAAM,UAAU,gBAAgB,CAAC,GAAmB,EAAE,IAAe,EAAE,OAA6B;IACnG,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC;IAChC,IAAI,CAAC;QACJ,mHAAmH;QACnH,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QAC7H,GAAG,CAAC,WAAW,GAAG,IAAI,CAAC,KAAK;YAC3B,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,KAAoB,EAAE,IAAI,CAAC,MAAM,CAAC;YACnD,CAAC,CAAC,EAAE,CAAC;IACP,CAAC;IAAC,OAAO,IAAI,EAAE,CAAC;QACf,GAAG,CAAC,WAAW,GAAG,iBAAiB,CAAC;IACrC,CAAC;IAED,IAAI,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,OAAO,EAAE,kBAAkB,EAAE,CAAC;QACvD,MAAM,QAAQ,GAAG,GAAG,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;QAC1C,QAAQ,CAAC,SAAS,GAAG,eAAe,CAAC;QACrC,GAAG,CAAC,WAAW,CAAC,QAAQ,EAAE,EAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAC,CAAC,CAAC;QACxC,GAAG,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;IAC3B,CAAC;IAED,OAAO,YAAY,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;AACpD,CAAC","sourcesContent":["import { CellModel } from \"@omegagrid/grid-core\";\nimport { BaseRenderer } from \"./BaseRenderer\";\nimport { CellRendererOptions } from \"../types\";\nimport { dom } from \"@omegagrid/core\";\n\nexport function DateTimeRenderer(div: HTMLDivElement, cell: CellModel, options?: CellRendererOptions) : HTMLDivElement {\n\tconst opts = cell.model.options;\n\ttry {\n\t\t// a date and time cell (type dt) or a time cell (type tm) without a format of its own shows the format of its type\n\t\tconst formatter = cell.type == 'dt' ? opts.dateTimeFormatter : (cell.type == 'tm' ? opts.timeFormatter : opts.dateFormatter);\n\t\tdiv.textContent = cell.value\n\t\t\t? formatter(cell.value as Date|string, cell.format)\n\t\t\t: '';\n\t} catch (_err) {\n\t\tdiv.textContent = '!invalid format';\n\t}\n\t\n\tif (cell.editable && opts.editing?.dateCalendarEditor) {\n\t\tconst triangle = dom.createElement('div');\n\t\ttriangle.className = 'triangle-down';\n\t\tdom.setPosition(triangle, {t: 8, r: 8});\n\t\tdiv.appendChild(triangle);\n\t}\n\n\treturn BaseRenderer.call(this, div, cell, options);\n}"]}
@@ -1 +1 @@
1
- {"version":3,"file":"filterLabel.d.ts","sourceRoot":"","sources":["../../src/ui/filterLabel.ts"],"names":[],"mappings":"AACA,OAAO,EAAe,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAChE,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AA2B5C,qBACa,WAAY,SAAQ,UAAU;IAE1C,MAAM,CAAC,MAAM,0BA4CX;IAGF,KAAK,EAAE,WAAW,CAAC;;IAMnB,iBAAiB;IAIjB,WAAW;IAUX,MAAM,6CAGJ;CAEF"}
1
+ {"version":3,"file":"filterLabel.d.ts","sourceRoot":"","sources":["../../src/ui/filterLabel.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAG5C,qBACa,WAAY,SAAQ,UAAU;IAE1C,MAAM,CAAC,MAAM,0BA4CX;IAGF,KAAK,EAAE,WAAW,CAAC;;IAMnB,iBAAiB;IAIjB,WAAW;IASX,MAAM,6CAGJ;CAEF"}
@@ -7,31 +7,6 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
7
7
  import { utils } from '@omegagrid/core';
8
8
  import { LitElement, html, css } from 'lit';
9
9
  import { customElement, property } from 'lit/decorators.js';
10
- const isRangeTerm = (v) => !!v && typeof v === 'object' && !Array.isArray(v) && v.kind === 'range';
11
- const formatRangePart = (v) => {
12
- if (v == null || v === '')
13
- return '';
14
- if (v instanceof Date)
15
- return v.toLocaleDateString();
16
- if (typeof v === 'string') {
17
- const d = new Date(v);
18
- if (!Number.isNaN(d.getTime()))
19
- return d.toLocaleDateString();
20
- return v;
21
- }
22
- return String(v);
23
- };
24
- const formatRange = (r) => {
25
- const from = formatRangePart(r.from);
26
- const to = formatRangePart(r.to);
27
- if (from && to)
28
- return `${from} – ${to}`;
29
- if (from)
30
- return `≥ ${from}`;
31
- if (to)
32
- return `≤ ${to}`;
33
- return '';
34
- };
35
10
  let FilterLabel = class FilterLabel extends LitElement {
36
11
  constructor() {
37
12
  super();
@@ -49,8 +24,6 @@ let FilterLabel = class FilterLabel extends LitElement {
49
24
  if (utils.isBool(this.value)) {
50
25
  return html `<og-icon .icon="${this.value ? 'square-check' : 'square'}"></og-icon>`;
51
26
  }
52
- if (isRangeTerm(this.value))
53
- return formatRange(this.value);
54
27
  if (typeof this.value === 'object')
55
28
  return '';
56
29
  return this.value;
@@ -1 +1 @@
1
- {"version":3,"file":"filterLabel.js","sourceRoot":"","sources":["../../src/ui/filterLabel.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAExC,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE5D,MAAM,WAAW,GAAG,CAAC,CAAU,EAAoB,EAAE,CACpD,CAAC,CAAC,CAAC,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,IAAK,CAAiB,CAAC,IAAI,KAAK,OAAO,CAAC;AAE1F,MAAM,eAAe,GAAG,CAAC,CAAU,EAAU,EAAE;IAC9C,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,KAAK,EAAE;QAAE,OAAO,EAAE,CAAC;IACrC,IAAI,CAAC,YAAY,IAAI;QAAE,OAAO,CAAC,CAAC,kBAAkB,EAAE,CAAC;IACrD,IAAI,OAAO,CAAC,KAAK,QAAQ,EAAE,CAAC;QAC3B,MAAM,CAAC,GAAG,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC;QACtB,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;YAAE,OAAO,CAAC,CAAC,kBAAkB,EAAE,CAAC;QAC9D,OAAO,CAAC,CAAC;IACV,CAAC;IACD,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC;AAEF,MAAM,WAAW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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4ClB,AA5CY,CA4CX;AAGF;IADC,QAAQ,EAAE;0CACQ;AAjDP,WAAW;IADvB,aAAa,CAAC,iBAAiB,CAAC;GACpB,WAAW,CA0EvB","sourcesContent":["import { utils } from '@omegagrid/core';\nimport { FilterRange, FilterValue } from '@omegagrid/grid-core';\nimport { LitElement, html, css } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\n\nconst isRangeTerm = (v: unknown): v is FilterRange =>\n\t!!v && typeof v === 'object' && !Array.isArray(v) && (v as FilterRange).kind === 'range';\n\nconst formatRangePart = (v: unknown): string => {\n\tif (v == null || v === '') return '';\n\tif (v instanceof Date) return v.toLocaleDateString();\n\tif (typeof v === 'string') {\n\t\tconst d = new Date(v);\n\t\tif (!Number.isNaN(d.getTime())) return d.toLocaleDateString();\n\t\treturn v;\n\t}\n\treturn String(v);\n};\n\nconst formatRange = (r: FilterRange): string => {\n\tconst from = formatRangePart(r.from);\n\tconst to = formatRangePart(r.to);\n\tif (from && to) return `${from} – ${to}`;\n\tif (from) return `≥ ${from}`;\n\tif (to) return `≤ ${to}`;\n\treturn '';\n};\n\n\n@customElement('og-filter-label')\nexport class FilterLabel extends LitElement {\n\n\tstatic styles = css`\n\t\t:host {\n\t\t\tpadding: 0;\n\t\t\tdisplay: block;\n\t\t\talign-items: center;\n\t\t\tcursor: pointer;\n\t\t\theight: 100%;\n\t\t\tline-height: 21px;\n\t\t}\n\n\t\t:host(:hover og-icon) {\n\t\t\tbackground-color: var(--og-accent-color-highlight);\n\t\t}\n\n\t\tinput {\n\t\t\tcolor: var(--og-text-color);\n\t\t}\n\n\t\tog-icon {\n\t\t\tcolor: var(--og-accent-color);\n\t\t\tflex: 0;\n\t\t\tmin-width: 20px;\n\t\t\tpadding-top: 1px;\n\t\t\tpadding-left: 0px;\n\t\t}\n\n\t\t#filterIcon {\n\t\t\tposition: absolute;\n\t\t\tleft: 0px;\n\t\t\ttop: 0px;\n\t\t}\n\n\t\t.text {\n\t\t\tflex: 1;\n\t\t\theight: 100%;\n\t\t\tfont-style: italic;\n\t\t\tfont-weight: normal;\n\t\t}\n\n\t\t.text:empty {\n\t\t\tbackground-image: repeating-linear-gradient(45deg, var(--og-accent-color-alpha) 0, var(--og-accent-color-alpha) 2px, transparent 0, transparent 50%);\n\t\t\tbackground-size: 10px 10px;\n\t\t\tbackground-color: transparent;\n\t\t}\n\t`;\n\n\t@property()\n\tvalue: FilterValue;\n\n\tconstructor() {\n\t\tsuper();\n\t}\n\n\tconnectedCallback() {\n\t\tsuper.connectedCallback();\n\t}\n\n\trenderValue() {\n\t\tif (this.value == null) return '';\n\t\tif (utils.isBool(this.value)) {\n\t\t\treturn html`<og-icon .icon=\"${this.value ? 'square-check' : 'square'}\"></og-icon>`;\n\t\t}\n\t\tif (isRangeTerm(this.value)) return formatRange(this.value);\n\t\tif (typeof this.value === 'object') return '';\n\t\treturn this.value as string;\n\t}\n\n\trender = () =>html`\n\t\t<og-icon id=\"filterIcon\" .icon=\"${{icon: \"filter\"}}\"></og-icon>\n\t\t<div class=\"text\">${this.renderValue()}</div>\n\t`;\n\t\n}"]}
1
+ {"version":3,"file":"filterLabel.js","sourceRoot":"","sources":["../../src/ui/filterLabel.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAExC,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAGrD,IAAM,WAAW,GAAjB,MAAM,WAAY,SAAQ,UAAU;IAmD1C;QACC,KAAK,EAAE,CAAC;QAgBT,WAAM,GAAG,GAAG,EAAE,CAAA,IAAI,CAAA;oCACiB,EAAC,IAAI,EAAE,QAAQ,EAAC;sBAC9B,IAAI,CAAC,WAAW,EAAE;EACtC,CAAC;IAlBF,CAAC;IAED,iBAAiB;QAChB,KAAK,CAAC,iBAAiB,EAAE,CAAC;IAC3B,CAAC;IAED,WAAW;QACV,IAAI,IAAI,CAAC,KAAK,IAAI,IAAI;YAAE,OAAO,EAAE,CAAC;QAClC,IAAI,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;YAC9B,OAAO,IAAI,CAAA,mBAAmB,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,QAAQ,cAAc,CAAC;QACpF,CAAC;QACD,IAAI,OAAO,IAAI,CAAC,KAAK,KAAK,QAAQ;YAAE,OAAO,EAAE,CAAC;QAC9C,OAAO,IAAI,CAAC,KAAe,CAAC;IAC7B,CAAC;;AAhEM,kBAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4ClB,AA5CY,CA4CX;AAGF;IADC,QAAQ,EAAE;0CACQ;AAjDP,WAAW;IADvB,aAAa,CAAC,iBAAiB,CAAC;GACpB,WAAW,CAyEvB","sourcesContent":["import { utils } from '@omegagrid/core';\nimport { FilterValue } from '@omegagrid/grid-core';\nimport { LitElement, html, css } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\n\n@customElement('og-filter-label')\nexport class FilterLabel extends LitElement {\n\n\tstatic styles = css`\n\t\t:host {\n\t\t\tpadding: 0;\n\t\t\tdisplay: block;\n\t\t\talign-items: center;\n\t\t\tcursor: pointer;\n\t\t\theight: 100%;\n\t\t\tline-height: 21px;\n\t\t}\n\n\t\t:host(:hover og-icon) {\n\t\t\tbackground-color: var(--og-accent-color-highlight);\n\t\t}\n\n\t\tinput {\n\t\t\tcolor: var(--og-text-color);\n\t\t}\n\n\t\tog-icon {\n\t\t\tcolor: var(--og-accent-color);\n\t\t\tflex: 0;\n\t\t\tmin-width: 20px;\n\t\t\tpadding-top: 1px;\n\t\t\tpadding-left: 0px;\n\t\t}\n\n\t\t#filterIcon {\n\t\t\tposition: absolute;\n\t\t\tleft: 0px;\n\t\t\ttop: 0px;\n\t\t}\n\n\t\t.text {\n\t\t\tflex: 1;\n\t\t\theight: 100%;\n\t\t\tfont-style: italic;\n\t\t\tfont-weight: normal;\n\t\t}\n\n\t\t.text:empty {\n\t\t\tbackground-image: repeating-linear-gradient(45deg, var(--og-accent-color-alpha) 0, var(--og-accent-color-alpha) 2px, transparent 0, transparent 50%);\n\t\t\tbackground-size: 10px 10px;\n\t\t\tbackground-color: transparent;\n\t\t}\n\t`;\n\n\t@property()\n\tvalue: FilterValue;\n\n\tconstructor() {\n\t\tsuper();\n\t}\n\n\tconnectedCallback() {\n\t\tsuper.connectedCallback();\n\t}\n\n\trenderValue() {\n\t\tif (this.value == null) return '';\n\t\tif (utils.isBool(this.value)) {\n\t\t\treturn html`<og-icon .icon=\"${this.value ? 'square-check' : 'square'}\"></og-icon>`;\n\t\t}\n\t\tif (typeof this.value === 'object') return '';\n\t\treturn this.value as string;\n\t}\n\n\trender = () =>html`\n\t\t<og-icon id=\"filterIcon\" .icon=\"${{icon: \"filter\"}}\"></og-icon>\n\t\t<div class=\"text\">${this.renderValue()}</div>\n\t`;\n\t\n}"]}
package/dist/ui/grid.d.ts CHANGED
@@ -45,6 +45,12 @@ export declare class Grid extends LitElement implements Layout {
45
45
  model: GridModel;
46
46
  adapter: GridAdapter;
47
47
  selection: SelectionModel;
48
+ /**
49
+ * The options objects this grid made with initOptions(): a `.options` binding or an assignment from outside
50
+ * brings a partial object instead, which willUpdate() completes before the model gets it
51
+ * (a model holding partial options has no `selecting`, `scrolling`... and the rendering falls over).
52
+ */
53
+ private _initializedOptions;
48
54
  options: Options;
49
55
  logger: log.Logger;
50
56
  zoom: number;
@@ -76,6 +82,15 @@ export declare class Grid extends LitElement implements Layout {
76
82
  destroy(): void;
77
83
  initAdapter(): Promise<void>;
78
84
  updateOptions(options: Partial<Options>): void;
85
+ /**
86
+ * Options started over from the defaults: only the state the grid holds itself (the zoom) is carried over
87
+ * from the previous ones. Used when the adapter is replaced - the options of the previous adapter must not
88
+ * leak into the next one (a refresh of the same adapter merges its options over the current ones instead,
89
+ * see initAdapter()).
90
+ */
91
+ resetOptions(previous?: Options): Options;
92
+ /** initOptions() whose result the grid recognizes as complete (see `_initializedOptions`) */
93
+ private _initOptions;
79
94
  private _debounceVerticalSlide;
80
95
  private _debounceHorizontalSlide;
81
96
  render: () => import("lit-html").TemplateResult<1>;
@@ -1 +1 @@
1
- {"version":3,"file":"grid.d.ts","sourceRoot":"","sources":["../../src/ui/grid.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,cAAc,EAAU,MAAM,iBAAiB,CAAC;AACzG,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,cAAc,EAAE,OAAO,EAAe,OAAO,EAAa,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACnI,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAQ,MAAM,KAAK,CAAC;AAGvC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,WAAW,IAAI,OAAO,EAAE,MAAM,WAAW,CAAC;AAEnD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAkB,SAAS,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AACtE,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM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Aa;IAY/B,WAAW,CAAC,OAAO,EAAE,aAAa;IAYlC,cAAc,CAAC,aAAa,UAAO;IAMnC,SAAS,CAAC,IAAI,EAAE,SAAS;IAoBzB,gBAAgB;IAUhB,mGAAmG;IACnG,oBAAoB;IAMpB;;;OAGG;IACH,aAAa;YA2BC,WAAW;IA4FzB;;;OAGG;YACW,qBAAqB;YAiBrB,SAAS;IAIjB,KAAK;IAoBX,YAAY,CAAC,IAAI,EAAE,SAAS;IAM5B,IAAI;IA6BJ,IAAI;IA6BJ,iBAAiB,CAAC,EAAE,EAAE,MAAM;IAI5B,KAAK,CAAC,KAAK,CAAC,EAAE,WAAW;IASzB,OAAO,CAAC,KAAK,CAAC,EAAE,WAAW;CAW3B"}
@@ -1,7 +1,7 @@
1
1
  import { csv, utils } from "@omegagrid/core";
2
2
  import { FormulaEditor, getEditorFactory } from "../editors";
3
3
  import { getDropdownListSource, loadDropdownList } from "../editors/dropdownList";
4
- import { isFormula, hasQuotePrefix, stripQuotePrefix, CellRange, decodeColumn, decodeRow } from "@omegagrid/grid-core";
4
+ import { isFormula, hasQuotePrefix, stripQuotePrefix, CellRange, decodeColumn, decodeRow, isCellSource } from "@omegagrid/grid-core";
5
5
  import { GridEditEvent, GridEvent } from "./grid.events";
6
6
  import constants from "../constants";
7
7
  export class GridEditing {
@@ -36,7 +36,8 @@ export class GridEditing {
36
36
  const oldValue = cell.value;
37
37
  let newValue;
38
38
  let newProps;
39
- if (utils.isObject(values[i])) {
39
+ // a Date (the value of a date and time cell put back by redo) is a value, not the properties of the cell
40
+ if (isCellSource(values[i])) {
40
41
  newProps = values[i];
41
42
  newValue = ('v' in newProps) ? newProps.v : undefined;
42
43
  if (cell.quotePrefixable && hasQuotePrefix(newValue)) {
@@ -324,7 +325,7 @@ export class GridEditing {
324
325
  if (!cell.editable)
325
326
  continue;
326
327
  const j = (c - range.c1) % data[i].length;
327
- if (pasteProps && utils.isObject(data[i][j])) {
328
+ if (pasteProps && isCellSource(data[i][j])) {
328
329
  // filter unwanted properties
329
330
  const updateProps = {};
330
331
  pasteProps.forEach((key) => {
@@ -355,7 +356,7 @@ export class GridEditing {
355
356
  const source = getDropdownListSource(cell);
356
357
  // a pasted formula stays a formula, its result is not an item of the list
357
358
  const formula = this.model.formulasEnabled
358
- && (utils.isObject(values[i]) ? !!values[i].f : isFormula(values[i]));
359
+ && (isCellSource(values[i]) ? !!values[i].f : isFormula(values[i]));
359
360
  if (!source || formula)
360
361
  return;
361
362
  if (!lists.has(source))