@omegagrid/grid 0.10.0 → 0.10.2

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 (257) hide show
  1. package/package.json +7 -7
  2. package/dist/commands/editingCommands.d.ts +0 -4
  3. package/dist/commands/editingCommands.d.ts.map +0 -1
  4. package/dist/commands/editingCommands.js +0 -74
  5. package/dist/commands/editingCommands.js.map +0 -1
  6. package/dist/commands/groupCommands.d.ts +0 -8
  7. package/dist/commands/groupCommands.d.ts.map +0 -1
  8. package/dist/commands/groupCommands.js +0 -7
  9. package/dist/commands/groupCommands.js.map +0 -1
  10. package/dist/commands/index.d.ts +0 -4
  11. package/dist/commands/index.d.ts.map +0 -1
  12. package/dist/commands/index.js +0 -9
  13. package/dist/commands/index.js.map +0 -1
  14. package/dist/commands/navigationCommands.d.ts +0 -5
  15. package/dist/commands/navigationCommands.d.ts.map +0 -1
  16. package/dist/commands/navigationCommands.js +0 -117
  17. package/dist/commands/navigationCommands.js.map +0 -1
  18. package/dist/constants.d.ts +0 -65
  19. package/dist/constants.d.ts.map +0 -1
  20. package/dist/constants.js +0 -8
  21. package/dist/constants.js.map +0 -1
  22. package/dist/editors/baseEditor.d.ts +0 -31
  23. package/dist/editors/baseEditor.d.ts.map +0 -1
  24. package/dist/editors/baseEditor.js +0 -112
  25. package/dist/editors/baseEditor.js.map +0 -1
  26. package/dist/editors/calendarEditor.d.ts +0 -12
  27. package/dist/editors/calendarEditor.d.ts.map +0 -1
  28. package/dist/editors/calendarEditor.js +0 -74
  29. package/dist/editors/calendarEditor.js.map +0 -1
  30. package/dist/editors/checkboxEditor.d.ts +0 -9
  31. package/dist/editors/checkboxEditor.d.ts.map +0 -1
  32. package/dist/editors/checkboxEditor.js +0 -32
  33. package/dist/editors/checkboxEditor.js.map +0 -1
  34. package/dist/editors/dateEditor.d.ts +0 -8
  35. package/dist/editors/dateEditor.d.ts.map +0 -1
  36. package/dist/editors/dateEditor.js +0 -37
  37. package/dist/editors/dateEditor.js.map +0 -1
  38. package/dist/editors/dropdownEditor.d.ts +0 -26
  39. package/dist/editors/dropdownEditor.d.ts.map +0 -1
  40. package/dist/editors/dropdownEditor.js +0 -142
  41. package/dist/editors/dropdownEditor.js.map +0 -1
  42. package/dist/editors/formulaEditor.d.ts +0 -21
  43. package/dist/editors/formulaEditor.d.ts.map +0 -1
  44. package/dist/editors/formulaEditor.js +0 -109
  45. package/dist/editors/formulaEditor.js.map +0 -1
  46. package/dist/editors/index.d.ts +0 -8
  47. package/dist/editors/index.d.ts.map +0 -1
  48. package/dist/editors/index.js +0 -19
  49. package/dist/editors/index.js.map +0 -1
  50. package/dist/editors/numberEditor.d.ts +0 -9
  51. package/dist/editors/numberEditor.d.ts.map +0 -1
  52. package/dist/editors/numberEditor.js +0 -37
  53. package/dist/editors/numberEditor.js.map +0 -1
  54. package/dist/editors/textEditor.d.ts +0 -15
  55. package/dist/editors/textEditor.d.ts.map +0 -1
  56. package/dist/editors/textEditor.js +0 -74
  57. package/dist/editors/textEditor.js.map +0 -1
  58. package/dist/filters/NumberFilter.d.ts +0 -8
  59. package/dist/filters/NumberFilter.d.ts.map +0 -1
  60. package/dist/filters/NumberFilter.js +0 -13
  61. package/dist/filters/NumberFilter.js.map +0 -1
  62. package/dist/filters/baseFilter.d.ts +0 -20
  63. package/dist/filters/baseFilter.d.ts.map +0 -1
  64. package/dist/filters/baseFilter.js +0 -47
  65. package/dist/filters/baseFilter.js.map +0 -1
  66. package/dist/filters/checkboxFilter.d.ts +0 -12
  67. package/dist/filters/checkboxFilter.d.ts.map +0 -1
  68. package/dist/filters/checkboxFilter.js +0 -67
  69. package/dist/filters/checkboxFilter.js.map +0 -1
  70. package/dist/filters/dropdownFilter.d.ts +0 -17
  71. package/dist/filters/dropdownFilter.d.ts.map +0 -1
  72. package/dist/filters/dropdownFilter.js +0 -116
  73. package/dist/filters/dropdownFilter.js.map +0 -1
  74. package/dist/filters/filterFactory.d.ts +0 -4
  75. package/dist/filters/filterFactory.d.ts.map +0 -1
  76. package/dist/filters/filterFactory.js +0 -39
  77. package/dist/filters/filterFactory.js.map +0 -1
  78. package/dist/filters/index.d.ts +0 -5
  79. package/dist/filters/index.d.ts.map +0 -1
  80. package/dist/filters/index.js +0 -5
  81. package/dist/filters/index.js.map +0 -1
  82. package/dist/filters/textFilter.d.ts +0 -17
  83. package/dist/filters/textFilter.d.ts.map +0 -1
  84. package/dist/filters/textFilter.js +0 -89
  85. package/dist/filters/textFilter.js.map +0 -1
  86. package/dist/gridAdapter.d.ts +0 -30
  87. package/dist/gridAdapter.d.ts.map +0 -1
  88. package/dist/gridAdapter.js +0 -11
  89. package/dist/gridAdapter.js.map +0 -1
  90. package/dist/i18n/en-us.d.ts +0 -4
  91. package/dist/i18n/en-us.d.ts.map +0 -1
  92. package/dist/i18n/en-us.js +0 -5
  93. package/dist/i18n/en-us.js.map +0 -1
  94. package/dist/i18n/index.d.ts +0 -5
  95. package/dist/i18n/index.d.ts.map +0 -1
  96. package/dist/i18n/index.js +0 -8
  97. package/dist/i18n/index.js.map +0 -1
  98. package/dist/index.d.ts +0 -7
  99. package/dist/index.d.ts.map +0 -1
  100. package/dist/index.js +0 -7
  101. package/dist/index.js.map +0 -1
  102. package/dist/renderers/ActionRenderer.d.ts +0 -3
  103. package/dist/renderers/ActionRenderer.d.ts.map +0 -1
  104. package/dist/renderers/ActionRenderer.js +0 -68
  105. package/dist/renderers/ActionRenderer.js.map +0 -1
  106. package/dist/renderers/BaseRenderer.d.ts +0 -6
  107. package/dist/renderers/BaseRenderer.d.ts.map +0 -1
  108. package/dist/renderers/BaseRenderer.js +0 -56
  109. package/dist/renderers/BaseRenderer.js.map +0 -1
  110. package/dist/renderers/CheckboxRenderer.d.ts +0 -4
  111. package/dist/renderers/CheckboxRenderer.d.ts.map +0 -1
  112. package/dist/renderers/CheckboxRenderer.js +0 -22
  113. package/dist/renderers/CheckboxRenderer.js.map +0 -1
  114. package/dist/renderers/DateTimeRenderer.d.ts +0 -4
  115. package/dist/renderers/DateTimeRenderer.d.ts.map +0 -1
  116. package/dist/renderers/DateTimeRenderer.js +0 -21
  117. package/dist/renderers/DateTimeRenderer.js.map +0 -1
  118. package/dist/renderers/DropdownRenderer.d.ts +0 -4
  119. package/dist/renderers/DropdownRenderer.d.ts.map +0 -1
  120. package/dist/renderers/DropdownRenderer.js +0 -18
  121. package/dist/renderers/DropdownRenderer.js.map +0 -1
  122. package/dist/renderers/GeneralRenderer.d.ts +0 -4
  123. package/dist/renderers/GeneralRenderer.d.ts.map +0 -1
  124. package/dist/renderers/GeneralRenderer.js +0 -12
  125. package/dist/renderers/GeneralRenderer.js.map +0 -1
  126. package/dist/renderers/HtmlRenderer.d.ts +0 -4
  127. package/dist/renderers/HtmlRenderer.d.ts.map +0 -1
  128. package/dist/renderers/HtmlRenderer.js +0 -6
  129. package/dist/renderers/HtmlRenderer.js.map +0 -1
  130. package/dist/renderers/NumberRenderer.d.ts +0 -4
  131. package/dist/renderers/NumberRenderer.d.ts.map +0 -1
  132. package/dist/renderers/NumberRenderer.js +0 -14
  133. package/dist/renderers/NumberRenderer.js.map +0 -1
  134. package/dist/renderers/SparklineRenderer.d.ts +0 -3
  135. package/dist/renderers/SparklineRenderer.d.ts.map +0 -1
  136. package/dist/renderers/SparklineRenderer.js +0 -8
  137. package/dist/renderers/SparklineRenderer.js.map +0 -1
  138. package/dist/renderers/TextRenderer.d.ts +0 -4
  139. package/dist/renderers/TextRenderer.d.ts.map +0 -1
  140. package/dist/renderers/TextRenderer.js +0 -38
  141. package/dist/renderers/TextRenderer.js.map +0 -1
  142. package/dist/renderers/index.d.ts +0 -12
  143. package/dist/renderers/index.d.ts.map +0 -1
  144. package/dist/renderers/index.js +0 -32
  145. package/dist/renderers/index.js.map +0 -1
  146. package/dist/types.d.ts +0 -10
  147. package/dist/types.d.ts.map +0 -1
  148. package/dist/types.js +0 -2
  149. package/dist/types.js.map +0 -1
  150. package/dist/ui/comment.d.ts +0 -59
  151. package/dist/ui/comment.d.ts.map +0 -1
  152. package/dist/ui/comment.js +0 -284
  153. package/dist/ui/comment.js.map +0 -1
  154. package/dist/ui/comment.style.d.ts +0 -2
  155. package/dist/ui/comment.style.d.ts.map +0 -1
  156. package/dist/ui/comment.style.js +0 -108
  157. package/dist/ui/comment.style.js.map +0 -1
  158. package/dist/ui/elementCache.d.ts +0 -15
  159. package/dist/ui/elementCache.d.ts.map +0 -1
  160. package/dist/ui/elementCache.js +0 -57
  161. package/dist/ui/elementCache.js.map +0 -1
  162. package/dist/ui/filterLabel.d.ts +0 -10
  163. package/dist/ui/filterLabel.d.ts.map +0 -1
  164. package/dist/ui/filterLabel.js +0 -76
  165. package/dist/ui/filterLabel.js.map +0 -1
  166. package/dist/ui/formulaInput.d.ts +0 -56
  167. package/dist/ui/formulaInput.d.ts.map +0 -1
  168. package/dist/ui/formulaInput.js +0 -251
  169. package/dist/ui/formulaInput.js.map +0 -1
  170. package/dist/ui/formulaInput.style.d.ts +0 -2
  171. package/dist/ui/formulaInput.style.d.ts.map +0 -1
  172. package/dist/ui/formulaInput.style.js +0 -65
  173. package/dist/ui/formulaInput.style.js.map +0 -1
  174. package/dist/ui/grid.d.ts +0 -91
  175. package/dist/ui/grid.d.ts.map +0 -1
  176. package/dist/ui/grid.editing.d.ts +0 -61
  177. package/dist/ui/grid.editing.d.ts.map +0 -1
  178. package/dist/ui/grid.editing.js +0 -439
  179. package/dist/ui/grid.editing.js.map +0 -1
  180. package/dist/ui/grid.events.d.ts +0 -97
  181. package/dist/ui/grid.events.d.ts.map +0 -1
  182. package/dist/ui/grid.events.js +0 -581
  183. package/dist/ui/grid.events.js.map +0 -1
  184. package/dist/ui/grid.filtering.d.ts +0 -23
  185. package/dist/ui/grid.filtering.d.ts.map +0 -1
  186. package/dist/ui/grid.filtering.js +0 -68
  187. package/dist/ui/grid.filtering.js.map +0 -1
  188. package/dist/ui/grid.js +0 -297
  189. package/dist/ui/grid.js.map +0 -1
  190. package/dist/ui/grid.menu.d.ts +0 -43
  191. package/dist/ui/grid.menu.d.ts.map +0 -1
  192. package/dist/ui/grid.menu.js +0 -168
  193. package/dist/ui/grid.menu.js.map +0 -1
  194. package/dist/ui/grid.objects.d.ts +0 -24
  195. package/dist/ui/grid.objects.d.ts.map +0 -1
  196. package/dist/ui/grid.objects.js +0 -69
  197. package/dist/ui/grid.objects.js.map +0 -1
  198. package/dist/ui/grid.rendering.d.ts +0 -84
  199. package/dist/ui/grid.rendering.d.ts.map +0 -1
  200. package/dist/ui/grid.rendering.js +0 -471
  201. package/dist/ui/grid.rendering.js.map +0 -1
  202. package/dist/ui/grid.selecting.d.ts +0 -99
  203. package/dist/ui/grid.selecting.d.ts.map +0 -1
  204. package/dist/ui/grid.selecting.js +0 -319
  205. package/dist/ui/grid.selecting.js.map +0 -1
  206. package/dist/ui/grid.sorting.d.ts +0 -23
  207. package/dist/ui/grid.sorting.d.ts.map +0 -1
  208. package/dist/ui/grid.sorting.js +0 -47
  209. package/dist/ui/grid.sorting.js.map +0 -1
  210. package/dist/ui/grid.style.d.ts +0 -2
  211. package/dist/ui/grid.style.d.ts.map +0 -1
  212. package/dist/ui/grid.style.js +0 -39
  213. package/dist/ui/grid.style.js.map +0 -1
  214. package/dist/ui/group.d.ts +0 -71
  215. package/dist/ui/group.d.ts.map +0 -1
  216. package/dist/ui/group.js +0 -312
  217. package/dist/ui/group.js.map +0 -1
  218. package/dist/ui/index.d.ts +0 -19
  219. package/dist/ui/index.d.ts.map +0 -1
  220. package/dist/ui/index.js +0 -19
  221. package/dist/ui/index.js.map +0 -1
  222. package/dist/ui/objectHost.d.ts +0 -30
  223. package/dist/ui/objectHost.d.ts.map +0 -1
  224. package/dist/ui/objectHost.js +0 -114
  225. package/dist/ui/objectHost.js.map +0 -1
  226. package/dist/ui/objectHost.style.d.ts +0 -2
  227. package/dist/ui/objectHost.style.d.ts.map +0 -1
  228. package/dist/ui/objectHost.style.js +0 -43
  229. package/dist/ui/objectHost.style.js.map +0 -1
  230. package/dist/ui/selector.d.ts +0 -97
  231. package/dist/ui/selector.d.ts.map +0 -1
  232. package/dist/ui/selector.js +0 -489
  233. package/dist/ui/selector.js.map +0 -1
  234. package/dist/ui/selector.style.d.ts +0 -2
  235. package/dist/ui/selector.style.d.ts.map +0 -1
  236. package/dist/ui/selector.style.js +0 -106
  237. package/dist/ui/selector.style.js.map +0 -1
  238. package/dist/ui/sortingArrow.d.ts +0 -8
  239. package/dist/ui/sortingArrow.d.ts.map +0 -1
  240. package/dist/ui/sortingArrow.js +0 -42
  241. package/dist/ui/sortingArrow.js.map +0 -1
  242. package/dist/ui/sparkline.d.ts +0 -14
  243. package/dist/ui/sparkline.d.ts.map +0 -1
  244. package/dist/ui/sparkline.js +0 -111
  245. package/dist/ui/sparkline.js.map +0 -1
  246. package/dist/ui/table.d.ts +0 -122
  247. package/dist/ui/table.d.ts.map +0 -1
  248. package/dist/ui/table.js +0 -1063
  249. package/dist/ui/table.js.map +0 -1
  250. package/dist/ui/table.styles.d.ts +0 -2
  251. package/dist/ui/table.styles.d.ts.map +0 -1
  252. package/dist/ui/table.styles.js +0 -249
  253. package/dist/ui/table.styles.js.map +0 -1
  254. package/dist/ui/tooltip.d.ts +0 -9
  255. package/dist/ui/tooltip.d.ts.map +0 -1
  256. package/dist/ui/tooltip.js +0 -32
  257. package/dist/ui/tooltip.js.map +0 -1
@@ -1,74 +0,0 @@
1
- /* eslint-disable @typescript-eslint/no-explicit-any */
2
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
- 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;
6
- return c > 3 && r && Object.defineProperty(target, key, r), r;
7
- };
8
- import { customElement, query } from 'lit/decorators.js';
9
- import { dates, utils } from "@omegagrid/core";
10
- import { getLocale } from "@omegagrid/localize";
11
- import { BaseEditor } from "./baseEditor";
12
- import { html } from 'lit';
13
- import { startOfDay } from 'date-fns';
14
- let CalendarEditor = class CalendarEditor extends BaseEditor {
15
- constructor() {
16
- super(...arguments);
17
- this._onChange = () => {
18
- this.commit();
19
- this.close();
20
- };
21
- this.render = () => html `
22
- <og-calendar-dropdown
23
- buttonInput
24
- cross
25
- @change="${this._onChange}">
26
- </og-calendar-dropdown>
27
- `;
28
- }
29
- setValue(value) {
30
- if (value == null) {
31
- this.calendar.value = null;
32
- return;
33
- }
34
- if (utils.isString(value)) {
35
- const date = dates.parse(value, getLocale());
36
- if (date) {
37
- this.calendar.value = date;
38
- return;
39
- }
40
- }
41
- else if (utils.isNumber(value)) {
42
- this.calendar.value = dates.serialDateToDate(value);
43
- return;
44
- }
45
- else {
46
- this.calendar.value = value;
47
- return;
48
- }
49
- this.calendar.value = startOfDay(new Date());
50
- }
51
- getValue() {
52
- const date = this.calendar?.value;
53
- console.log(date);
54
- return date ? dates.dateToSerialDate(date) : null;
55
- }
56
- async activate(cell) {
57
- super.activate(cell);
58
- await this.calendar.updateComplete;
59
- await this.calendar.open();
60
- this.setValue(cell.value);
61
- }
62
- close() {
63
- super.close();
64
- this.calendar.close();
65
- }
66
- };
67
- __decorate([
68
- query('og-calendar-dropdown')
69
- ], CalendarEditor.prototype, "calendar", void 0);
70
- CalendarEditor = __decorate([
71
- customElement('og-grid-calendareditor')
72
- ], CalendarEditor);
73
- export { CalendarEditor };
74
- //# sourceMappingURL=calendarEditor.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"calendarEditor.js","sourceRoot":"","sources":["../../src/editors/calendarEditor.ts"],"names":[],"mappings":"AAAA,uDAAuD;;;;;;;AAEvD,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,iBAAiB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AE,CAAC,CAAC;IAC9C,CAAC;IAED,QAAQ;QACP,MAAM,IAAI,GAAG,IAAI,CAAC,QAAQ,EAAE,KAAK,CAAC;QAClC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAClB,OAAO,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IACnD,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,IAAe;QACvB,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QAC3B,MAAM,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC;QACnC,MAAM,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;QACrB,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAe,CAAC,CAAC;IACxC,CAAC;IAeJ,KAAK;QACJ,KAAK,CAAC,KAAK,EAAE,CAAC;QACd,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;IACvB,CAAC;CAED,CAAA;AAxDA;IADC,KAAK,CAAC,sBAAsB,CAAC;gDAChB;AAHF,cAAc;IAD1B,aAAa,CAAC,wBAAwB,CAAC;GAC3B,cAAc,CA2D1B","sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n\nimport { customElement, query } from 'lit/decorators.js';\nimport { dates, utils } from \"@omegagrid/core\";\nimport { getLocale } from \"@omegagrid/localize\";\nimport { BaseEditor } from \"./baseEditor\";\nimport { html } from 'lit';\nimport { startOfDay } from 'date-fns';\nimport { CellModel } from '@omegagrid/grid-core';\n\n@customElement('og-grid-calendareditor')\nexport class CalendarEditor extends BaseEditor {\n\n\t@query('og-calendar-dropdown')\n\tcalendar: any;\n\n\tsetValue(value: number|string|Date) {\n\t\tif (value == null) {\n\t\t\tthis.calendar.value = null;\n\t\t\treturn;\n\t\t}\n\n\t\tif (utils.isString(value)) {\n\t\t\tconst date = dates.parse(value as string, getLocale());\n\t\t\tif (date) {\n\t\t\t\tthis.calendar.value = date;\n\t\t\t\treturn;\n\t\t\t}\n\t\t} else if (utils.isNumber(value)) {\n\t\t\tthis.calendar.value = dates.serialDateToDate(value as number);\n\t\t\treturn;\n\t\t} else {\n\t\t\tthis.calendar.value = value as Date;\n\t\t\treturn;\n\t\t}\n\n\t\tthis.calendar.value = startOfDay(new Date());\n\t}\n\n\tgetValue() : number {\n\t\tconst date = this.calendar?.value;\n\t\tconsole.log(date);\n\t\treturn date ? dates.dateToSerialDate(date) : null;\n\t}\n\n\tasync activate(cell: CellModel) {\n super.activate(cell);\n\t\tawait this.calendar.updateComplete;\n\t\tawait this.calendar.open();\n this.setValue(cell.value as number);\n }\n\n\t_onChange = () => {\n\t\tthis.commit();\n\t\tthis.close();\n\t}\t\t\n\n\trender = () => html`\n\t\t<og-calendar-dropdown\n\t\t\tbuttonInput\n\t\t\tcross\n\t\t\t@change=\"${this._onChange}\">\n\t\t</og-calendar-dropdown>\n\t`;\n\t\n\tclose() {\n\t\tsuper.close();\n\t\tthis.calendar.close();\n\t}\n\n}"]}
@@ -1,9 +0,0 @@
1
- import { CellModel } from "@omegagrid/grid-core";
2
- import { BaseEditor } from "./baseEditor";
3
- export declare class CheckboxEditor extends BaseEditor {
4
- private value;
5
- activate(cell: CellModel): void;
6
- getValue(): boolean;
7
- setValue(value: string): void;
8
- }
9
- //# sourceMappingURL=checkboxEditor.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"checkboxEditor.d.ts","sourceRoot":"","sources":["../../src/editors/checkboxEditor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG1C,qBACa,cAAe,SAAQ,UAAU;IAE7C,OAAO,CAAC,KAAK,CAAS;IAEtB,QAAQ,CAAC,IAAI,EAAE,SAAS;IAOxB,QAAQ,IAAK,OAAO;IAIpB,QAAQ,CAAC,KAAK,EAAE,MAAM;CAKtB"}
@@ -1,32 +0,0 @@
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 { BaseEditor } from "./baseEditor";
8
- import { customElement } from 'lit/decorators.js';
9
- let CheckboxEditor = class CheckboxEditor extends BaseEditor {
10
- constructor() {
11
- super(...arguments);
12
- this.value = false;
13
- }
14
- activate(cell) {
15
- super.activate(cell);
16
- this.value = !cell.value;
17
- this.commit();
18
- this.close();
19
- }
20
- getValue() {
21
- return this.value;
22
- }
23
- setValue(value) {
24
- value = value.toLowerCase();
25
- this.value = ['0', 'false', 'no', 'n'].indexOf(value) > -1;
26
- }
27
- };
28
- CheckboxEditor = __decorate([
29
- customElement('og-grid-checkboxeditor')
30
- ], CheckboxEditor);
31
- export { CheckboxEditor };
32
- //# sourceMappingURL=checkboxEditor.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"checkboxEditor.js","sourceRoot":"","sources":["../../src/editors/checkboxEditor.ts"],"names":[],"mappings":";;;;;;AACA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAG3C,IAAM,cAAc,GAApB,MAAM,cAAe,SAAQ,UAAU;IAAvC;;QAEE,UAAK,GAAG,KAAK,CAAC;IAkBvB,CAAC;IAhBA,QAAQ,CAAC,IAAe;QACvB,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QACrB,IAAI,CAAC,KAAK,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC;QACzB,IAAI,CAAC,MAAM,EAAE,CAAC;QACd,IAAI,CAAC,KAAK,EAAE,CAAC;IACd,CAAC;IAED,QAAQ;QACP,OAAO,IAAI,CAAC,KAAK,CAAC;IACnB,CAAC;IAED,QAAQ,CAAC,KAAa;QACrB,KAAK,GAAG,KAAK,CAAC,WAAW,EAAE,CAAC;QAC5B,IAAI,CAAC,KAAK,GAAG,CAAC,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;IAC5D,CAAC;CAED,CAAA;AApBY,cAAc;IAD1B,aAAa,CAAC,wBAAwB,CAAC;GAC3B,cAAc,CAoB1B","sourcesContent":["import { CellModel } from \"@omegagrid/grid-core\";\nimport { BaseEditor } from \"./baseEditor\";\nimport { customElement } from 'lit/decorators.js';\n\n@customElement('og-grid-checkboxeditor')\nexport class CheckboxEditor extends BaseEditor {\n\n\tprivate value = false;\n\n\tactivate(cell: CellModel) {\n\t\tsuper.activate(cell);\n\t\tthis.value = !cell.value;\n\t\tthis.commit();\n\t\tthis.close();\n\t}\n\n\tgetValue() : boolean {\n\t\treturn this.value;\n\t}\n\n\tsetValue(value: string) {\n\t\tvalue = value.toLowerCase();\n\t\tthis.value = ['0', 'false', 'no', 'n'].indexOf(value) > -1;\n\t}\n\n}"]}
@@ -1,8 +0,0 @@
1
- import { TextEditor } from "./textEditor";
2
- import { CellModel } from "@omegagrid/grid-core";
3
- export declare class DateEditor extends TextEditor {
4
- setValue(value: number | string | Date): void;
5
- getValue(): number;
6
- activate(cell: CellModel): void;
7
- }
8
- //# sourceMappingURL=dateEditor.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"dateEditor.d.ts","sourceRoot":"","sources":["../../src/editors/dateEditor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAI1C,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEjD,qBACa,UAAW,SAAQ,UAAU;IAEzC,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAC,MAAM,GAAC,IAAI;IAalC,QAAQ,IAAK,MAAM;IAKnB,QAAQ,CAAC,IAAI,EAAE,SAAS;CAKxB"}
@@ -1,37 +0,0 @@
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 { TextEditor } from "./textEditor";
8
- import { customElement } from 'lit/decorators.js';
9
- import { dates } from "@omegagrid/core";
10
- import { getLocale } from "@omegagrid/localize";
11
- let DateEditor = class DateEditor extends TextEditor {
12
- setValue(value) {
13
- if (value == null) {
14
- this.input.value = '';
15
- return;
16
- }
17
- try {
18
- this.input.value = dates.getDateFormatter(getLocale(), 'yyyy-MM-dd')(value);
19
- }
20
- catch (error) {
21
- this.input.value = value ?? '';
22
- }
23
- }
24
- getValue() {
25
- const date = dates.parse(this.input.value, getLocale());
26
- return date ? dates.dateToSerialDate(date) : null;
27
- }
28
- activate(cell) {
29
- super.activate(cell);
30
- this.setValue(cell.value);
31
- }
32
- };
33
- DateEditor = __decorate([
34
- customElement('og-grid-dateeditor')
35
- ], DateEditor);
36
- export { DateEditor };
37
- //# sourceMappingURL=dateEditor.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"dateEditor.js","sourceRoot":"","sources":["../../src/editors/dateEditor.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAIzC,IAAM,UAAU,GAAhB,MAAM,UAAW,SAAQ,UAAU;IAEzC,QAAQ,CAAC,KAAyB;QACjC,IAAI,KAAK,IAAI,IAAI,EAAE,CAAC;YACnB,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,EAAE,CAAC;YACtB,OAAO;QACR,CAAC;QAED,IAAI,CAAC;YACJ,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC,gBAAgB,CAAC,SAAS,EAAE,EAAE,YAAY,CAAC,CAAC,KAAK,CAAC,CAAC;QAC7E,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAChB,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,KAAe,IAAI,EAAE,CAAC;QAC1C,CAAC;IACF,CAAC;IAED,QAAQ;QACP,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;QACxD,OAAO,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IACnD,CAAC;IAED,QAAQ,CAAC,IAAe;QACjB,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QACrB,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAe,CAAC,CAAC;IACxC,CAAC;CAEJ,CAAA;AAzBY,UAAU;IADtB,aAAa,CAAC,oBAAoB,CAAC;GACvB,UAAU,CAyBtB","sourcesContent":["import { TextEditor } from \"./textEditor\";\nimport { customElement } from 'lit/decorators.js';\nimport { dates } from \"@omegagrid/core\";\nimport { getLocale } from \"@omegagrid/localize\";\nimport { CellModel } from \"@omegagrid/grid-core\";\n\n@customElement('og-grid-dateeditor')\nexport class DateEditor extends TextEditor {\n\n\tsetValue(value: number|string|Date) {\n\t\tif (value == null) {\n\t\t\tthis.input.value = '';\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\tthis.input.value = dates.getDateFormatter(getLocale(), 'yyyy-MM-dd')(value);\n\t\t} catch (error) {\n\t\t\tthis.input.value = value as string ?? '';\t\t\n\t\t}\n\t}\n\n\tgetValue() : number {\n\t\tconst date = dates.parse(this.input.value, getLocale());\n\t\treturn date ? dates.dateToSerialDate(date) : null;\n\t}\n\n\tactivate(cell: CellModel) {\n super.activate(cell);\n this.setValue(cell.value as number);\n }\n\n}"]}
@@ -1,26 +0,0 @@
1
- import { BaseEditor } from "./baseEditor";
2
- import { CellModel } from "@omegagrid/grid-core";
3
- import { SerializedValue, TreeDropdown, TreeEvent } from '@omegagrid/tree';
4
- type DropdownValue = null | string | (string | number | SerializedValue)[];
5
- export declare class DropdownEditor extends BaseEditor {
6
- static styles: import("lit").CSSResult[];
7
- dropdown: TreeDropdown;
8
- private currentValue;
9
- private currentDisplayValue;
10
- private searchCommitted;
11
- private searchUsed;
12
- constructor();
13
- /** Use value in dropdown search field as cell value if allowInvalid is true */
14
- commitSearchValue(): void;
15
- init(): void;
16
- activate(cell: CellModel): Promise<void>;
17
- getValue(): DropdownValue;
18
- getDisplayValue(): string;
19
- setValue(value: DropdownValue): void;
20
- _onChange: (_e: TreeEvent) => void;
21
- _onBlur: () => void;
22
- render: () => import("lit-html").TemplateResult<1>;
23
- close(): void;
24
- }
25
- export {};
26
- //# sourceMappingURL=dropdownEditor.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"dropdownEditor.d.ts","sourceRoot":"","sources":["../../src/editors/dropdownEditor.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEjD,OAAO,EAAyC,eAAe,EAAe,YAAY,EAAE,SAAS,EAAc,MAAM,iBAAiB,CAAC;AAE3I,KAAK,aAAa,GAAG,IAAI,GAAC,MAAM,GAAC,CAAC,MAAM,GAAC,MAAM,GAAC,eAAe,CAAC,EAAE,CAAC;AAEnE,qBACa,cAAe,SAAQ,UAAU;IAE7C,MAAM,CAAC,MAAM,4BAKV;IAGH,QAAQ,EAAE,YAAY,CAAC;IAEvB,OAAO,CAAC,YAAY,CAAgB;IACpC,OAAO,CAAC,mBAAmB,CAAS;IACpC,OAAO,CAAC,eAAe,CAAS;IAChC,OAAO,CAAC,UAAU,CAAS;;IAM3B,+EAA+E;IAC/E,iBAAiB;IAcjB,IAAI;IASE,QAAQ,CAAC,IAAI,EAAE,SAAS;IAyB9B,QAAQ;IAIR,eAAe;IAIf,QAAQ,CAAC,KAAK,EAAE,aAAa;IAoB7B,SAAS,GAAI,IAAI,SAAS,UAoBzB;IAED,OAAO,aAAkC;IAEzC,MAAM,6CAUJ;IAEF,KAAK;CAML"}
@@ -1,142 +0,0 @@
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 { customElement, query } from 'lit/decorators.js';
8
- import { BaseEditor } from "./baseEditor";
9
- import { html, css } from 'lit';
10
- import { normalizeSerializedValues, SelectMode } from '@omegagrid/tree';
11
- let DropdownEditor = class DropdownEditor extends BaseEditor {
12
- constructor() {
13
- super();
14
- this.searchCommitted = false;
15
- this.searchUsed = false;
16
- this._onChange = (_e) => {
17
- if (this.activeCellModel.type == 's') {
18
- this.currentValue = null;
19
- this.currentDisplayValue = null;
20
- for (const [key, node] of this.dropdown.selectedItems) {
21
- this.currentValue = key;
22
- this.currentDisplayValue = node.value;
23
- break;
24
- }
25
- }
26
- else {
27
- this.currentValue = this.dropdown.selection.serialize();
28
- this.currentDisplayValue = this.dropdown.getSelectionText();
29
- }
30
- this.commit();
31
- if (this.activeCellModel.type == 's') {
32
- this.dropdown.close();
33
- this.close();
34
- }
35
- };
36
- this._onBlur = () => this.commitSearchValue();
37
- this.render = () => html `
38
- <og-tree-dropdown
39
- cross
40
- buttonInput
41
- dynamicWidth
42
- alignment="left"
43
- @change="${this._onChange}"
44
- @tree.filter="${() => this.searchUsed = true}"
45
- @blur="${this._onBlur}">
46
- </og-tree-dropdown>
47
- `;
48
- }
49
- /** Use value in dropdown search field as cell value if allowInvalid is true */
50
- commitSearchValue() {
51
- if (this.searchCommitted)
52
- return;
53
- if (!this.searchUsed)
54
- return;
55
- if (this.dropdown?.searchTerm == null)
56
- return;
57
- // if (!this.dropdown?.selection.count) return;
58
- if (!this.activeCellModel?.validation?.allowInvalid)
59
- return;
60
- this.currentValue = this.dropdown.searchTerm;
61
- this.currentDisplayValue = this.currentValue;
62
- this.activeCellModel.displayValue = this.currentDisplayValue;
63
- this.commit();
64
- this.searchCommitted = true;
65
- }
66
- init() {
67
- this.addEventListener('keydown', (e) => {
68
- // handle (invalid) value in search field
69
- if (e.key == 'Enter')
70
- this.commitSearchValue();
71
- });
72
- super.init();
73
- }
74
- async activate(cell) {
75
- super.activate(cell);
76
- this.currentValue = null;
77
- this.searchCommitted = false;
78
- this.searchUsed = false;
79
- await this.dropdown.updateComplete;
80
- this.dropdown.updateOptions({ selectMode: cell.type == 's' ? SelectMode.Single : SelectMode.Multiple });
81
- if (cell.editorContent) {
82
- let sourceData = cell.editorContent;
83
- if (!sourceData || sourceData.length == 0) {
84
- sourceData = cell.hasValue ? [{ k: cell.value, v: cell.value }] : [];
85
- }
86
- this.dropdown.value = null;
87
- this.dropdown.adapter = null;
88
- this.dropdown.setSourceData(sourceData);
89
- }
90
- else if (cell.adapter) {
91
- this.dropdown.adapter = cell.adapter;
92
- }
93
- await this.dropdown.open();
94
- this.setValue(this.currentValue ?? cell.value);
95
- }
96
- getValue() {
97
- return this.currentValue;
98
- }
99
- getDisplayValue() {
100
- return this.currentDisplayValue;
101
- }
102
- setValue(value) {
103
- this.currentValue = value;
104
- if (value == null) {
105
- this.dropdown.value = null;
106
- }
107
- else if (this.activeCellModel.type == 's') {
108
- this.dropdown.value = this.activeCellModel.value == value && this.activeCellModel.displayValue != null
109
- // pass display value if cell value and current value match
110
- ? [[value, null, null, { value: this.activeCellModel.displayValue }]]
111
- : [[value]];
112
- }
113
- else if (Array.isArray(value)) {
114
- this.dropdown.value = normalizeSerializedValues(value);
115
- }
116
- else {
117
- this.dropdown.value = null;
118
- }
119
- // initialValue is set when editor is open by direct typing or pasting
120
- if (this.initialValue != null)
121
- this.dropdown.filter(value.toString());
122
- }
123
- close() {
124
- this.currentValue = null;
125
- super.close();
126
- this.dropdown.close();
127
- }
128
- };
129
- DropdownEditor.styles = [BaseEditor.baseStyles, css `
130
- og-tree-dropdown {
131
- width: 100%;
132
- height: 100%;
133
- }
134
- `];
135
- __decorate([
136
- query('og-tree-dropdown')
137
- ], DropdownEditor.prototype, "dropdown", void 0);
138
- DropdownEditor = __decorate([
139
- customElement('og-grid-dropdowneditor')
140
- ], DropdownEditor);
141
- export { DropdownEditor };
142
- //# sourceMappingURL=dropdownEditor.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"dropdownEditor.js","sourceRoot":"","sources":["../../src/editors/dropdownEditor.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAChC,OAAO,EAAE,yBAAyB,EAAE,UAAU,EAAqE,MAAM,iBAAiB,CAAC;AAKpI,IAAM,cAAc,GAApB,MAAM,cAAe,SAAQ,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Ae,CAAC,KAAK,IAAI,KAAK,IAAI,IAAI,CAAC,eAAe,CAAC,YAAY,IAAI,IAAI;gBACrG,2DAA2D;gBAC3D,CAAC,CAAC,CAAC,CAAC,KAAe,EAAE,IAAI,EAAE,IAAI,EAAE,EAAC,KAAK,EAAE,IAAI,CAAC,eAAe,CAAC,YAAY,EAAC,CAAC,CAAC;gBAC7E,CAAC,CAAC,CAAC,CAAC,KAAe,CAAC,CAAC,CAAC;QACxB,CAAC;aAAM,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;YACjC,IAAI,CAAC,QAAQ,CAAC,KAAK,GAAG,yBAAyB,CAAC,KAA0C,CAAC,CAAC;QAC7F,CAAC;aAAM,CAAC;YACP,IAAI,CAAC,QAAQ,CAAC,KAAK,GAAG,IAAI,CAAC;QAC5B,CAAC;QAED,sEAAsE;QACtE,IAAI,IAAI,CAAC,YAAY,IAAI,IAAI;YAAE,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC;IACvE,CAAC;IAsCD,KAAK;QACJ,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;QACzB,KAAK,CAAC,KAAK,EAAE,CAAC;QACd,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;IACvB,CAAC;;AAxIM,qBAAM,GAAG,CAAC,UAAU,CAAC,UAAU,EAAE,GAAG,CAAA;;;;;EAK1C,CAAC,AALW,CAKV;AAGH;IADC,KAAK,CAAC,kBAAkB,CAAC;gDACH;AAVX,cAAc;IAD1B,aAAa,CAAC,wBAAwB,CAAC;GAC3B,cAAc,CA4I1B","sourcesContent":["import { customElement, query } from 'lit/decorators.js';\nimport { BaseEditor } from \"./baseEditor\";\nimport { CellModel } from \"@omegagrid/grid-core\";\nimport { html, css } from 'lit';\nimport { normalizeSerializedValues, SelectMode, SerializedValue, TreeAdapter, TreeDropdown, TreeEvent, TreeSource } from '@omegagrid/tree';\n\ntype DropdownValue = null|string|(string|number|SerializedValue)[];\n\n@customElement('og-grid-dropdowneditor')\nexport class DropdownEditor extends BaseEditor {\n\n\tstatic styles = [BaseEditor.baseStyles, css`\n\t\tog-tree-dropdown {\n\t\t\twidth: 100%;\n\t\t\theight: 100%;\n\t\t}\n\t`];\n\n\t@query('og-tree-dropdown')\n\tdropdown: TreeDropdown;\n\n\tprivate currentValue: DropdownValue;\n\tprivate currentDisplayValue: string;\n\tprivate searchCommitted = false;\n\tprivate searchUsed = false;\n\n\tconstructor() {\n\t\tsuper();\n\t}\n\n\t/** Use value in dropdown search field as cell value if allowInvalid is true */\n\tcommitSearchValue() {\n\t\tif (this.searchCommitted) return;\n\t\tif (!this.searchUsed) return;\n\t\tif (this.dropdown?.searchTerm == null) return;\n\t\t// if (!this.dropdown?.selection.count) return;\n\t\tif (!this.activeCellModel?.validation?.allowInvalid) return;\n\n\t\tthis.currentValue = this.dropdown.searchTerm;\n\t\tthis.currentDisplayValue = this.currentValue;\n\t\tthis.activeCellModel.displayValue = this.currentDisplayValue;\n\t\tthis.commit();\n\t\tthis.searchCommitted = true;\n\t}\n\n\tinit() {\n\t\tthis.addEventListener('keydown', (e: KeyboardEvent) => {\n\t\t\t// handle (invalid) value in search field\n\t\t\tif (e.key == 'Enter') this.commitSearchValue();\n\t\t});\n\n\t\tsuper.init();\n\t}\n\n\tasync activate(cell: CellModel) {\n\t\tsuper.activate(cell);\n\t\tthis.currentValue = null;\n\t\tthis.searchCommitted = false;\n\t\tthis.searchUsed = false;\n\t\t\n\t\tawait this.dropdown.updateComplete;\n\t\tthis.dropdown.updateOptions({selectMode: cell.type == 's' ? SelectMode.Single : SelectMode.Multiple});\n\t\t\n\t\tif (cell.editorContent) {\n\t\t\tlet sourceData = cell.editorContent as TreeSource;\n\t\t\tif (!sourceData || sourceData.length == 0) {\n\t\t\t\tsourceData = cell.hasValue ? [{k: cell.value as string, v: cell.value as string}] : [];\n\t\t\t}\n\t\t\tthis.dropdown.value = null;\n\t\t\tthis.dropdown.adapter = null;\n\t\t\tthis.dropdown.setSourceData(sourceData);\n\t\t} else if (cell.adapter) {\n\t\t\tthis.dropdown.adapter = cell.adapter as TreeAdapter;\n\t\t}\n\n\t\tawait this.dropdown.open();\n\t\tthis.setValue(this.currentValue ?? cell.value as DropdownValue);\n\t}\n\n\tgetValue() {\n\t\treturn this.currentValue;\n\t}\n\n\tgetDisplayValue() {\n\t\treturn this.currentDisplayValue;\n\t}\n\n\tsetValue(value: DropdownValue) {\n\t\tthis.currentValue = value;\n\n\t\tif (value == null) {\n\t\t\tthis.dropdown.value = null;\n\t\t} else if (this.activeCellModel.type == 's') {\n\t\t\tthis.dropdown.value = this.activeCellModel.value == value && this.activeCellModel.displayValue != null\n\t\t\t\t// pass display value if cell value and current value match\n\t\t\t\t? [[value as string, null, null, {value: this.activeCellModel.displayValue}]]\n\t\t\t\t: [[value as string]];\n\t\t} else if (Array.isArray(value)) {\n\t\t\tthis.dropdown.value = normalizeSerializedValues(value as (string|number|SerializedValue)[]);\n\t\t} else {\n\t\t\tthis.dropdown.value = null;\n\t\t}\n\n\t\t// initialValue is set when editor is open by direct typing or pasting\n\t\tif (this.initialValue != null) this.dropdown.filter(value.toString());\n\t}\n\n\t_onChange = (_e: TreeEvent) => {\n\t\tif (this.activeCellModel.type == 's') {\n\t\t\tthis.currentValue = null;\n\t\t\tthis.currentDisplayValue = null;\n\t\t\tfor (const [key, node] of this.dropdown.selectedItems) {\n\t\t\t\tthis.currentValue = key;\n\t\t\t\tthis.currentDisplayValue = node.value;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t} else {\n\t\t\tthis.currentValue = this.dropdown.selection.serialize();\n\t\t\tthis.currentDisplayValue = this.dropdown.getSelectionText();\n\t\t}\n\n\t\tthis.commit();\n\n\t\tif (this.activeCellModel.type == 's') {\n\t\t\tthis.dropdown.close();\n\t\t\tthis.close();\n\t\t}\n\t}\n\n\t_onBlur = () => this.commitSearchValue();\n\n\trender = () => html`\n\t\t<og-tree-dropdown \n\t\t\tcross\n\t\t\tbuttonInput\n\t\t\tdynamicWidth\n\t\t\talignment=\"left\"\n\t\t\t@change=\"${this._onChange}\"\n\t\t\t@tree.filter=\"${() => this.searchUsed = true}\"\n\t\t\t@blur=\"${this._onBlur}\">\n\t\t</og-tree-dropdown>\n\t`;\n\t\n\tclose() {\n\t\tthis.currentValue = null;\n\t\tsuper.close();\n\t\tthis.dropdown.close();\n\t}\n\n}"]}
@@ -1,21 +0,0 @@
1
- import { CellModel } from "@omegagrid/grid-core";
2
- import { BaseEditor } from "./baseEditor";
3
- import { FormulaInput, FormulaInputEvent, GridEvent, SelectorEvent } from "../ui";
4
- export declare class FormulaEditor extends BaseEditor {
5
- static styles: import("lit").CSSResult[];
6
- input: FormulaInput;
7
- commit(): void;
8
- close(): void;
9
- _onGridSelectorUpdate: (e: SelectorEvent) => void;
10
- _onGridSelect: (e: GridEvent) => void;
11
- activate(cell: CellModel): void;
12
- deactivate(): void;
13
- getValue(): string;
14
- setValue(value: string): void;
15
- _onPreview: (e: FormulaInputEvent) => void;
16
- _onInputCommit: () => void;
17
- _onInputDiscard: () => void;
18
- focus(): void;
19
- render: () => import("lit-html").TemplateResult<1>;
20
- }
21
- //# sourceMappingURL=formulaEditor.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"formulaEditor.d.ts","sourceRoot":"","sources":["../../src/editors/formulaEditor.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAGlF,qBACa,aAAc,SAAQ,UAAU;IAE5C,MAAM,CAAC,MAAM,4BASV;IAGH,KAAK,EAAE,YAAY,CAAC;IAEpB,MAAM;IASN,KAAK;IAML,qBAAqB,GAAI,GAAG,aAAa,UAKxC;IAED,aAAa,GAAI,GAAG,SAAS,UAK5B;IAED,QAAQ,CAAC,IAAI,EAAE,SAAS;IAWxB,UAAU;IASV,QAAQ;IAIR,QAAQ,CAAC,KAAK,EAAE,MAAM;IAKtB,UAAU,GAAI,GAAG,iBAAiB,UAGjC;IAED,cAAc,aAEb;IAED,eAAe,aAEd;IAED,KAAK;IAIL,MAAM,6CAMJ;CAEF"}
@@ -1,109 +0,0 @@
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 { customElement, query } from 'lit/decorators.js';
8
- import { css, html, unsafeCSS } from "lit";
9
- import { BaseEditor } from "./baseEditor";
10
- import constants from "../constants";
11
- import { dom } from '@omegagrid/core';
12
- let FormulaEditor = class FormulaEditor extends BaseEditor {
13
- constructor() {
14
- super(...arguments);
15
- this._onGridSelectorUpdate = (e) => {
16
- if (e.selector?.index == null)
17
- return;
18
- const range = e.selector.selection.clone();
19
- if (e.selector.grid != this.grid)
20
- range.sheet = e.selector.grid.model.name;
21
- this.input.setRange(range, e.selector.index);
22
- };
23
- this._onGridSelect = (e) => {
24
- if (!this.grid.editing.isFormulaMode)
25
- return;
26
- const range = e.selection.range.clone();
27
- if (e.grid != this.grid)
28
- range.sheet = e.grid.model.name;
29
- this.input.setRange(range);
30
- };
31
- this._onPreview = (e) => {
32
- this.grid.selecting.removeFormulaHighlight();
33
- if (e.formula)
34
- this.grid.selecting.highlightFormula(e.formula);
35
- };
36
- this._onInputCommit = () => {
37
- this.commit();
38
- };
39
- this._onInputDiscard = () => {
40
- this.close();
41
- };
42
- this.render = () => html `
43
- <og-grid-formula
44
- @formula.preview="${this._onPreview}"
45
- @formula.commit="${this._onInputCommit}"
46
- @formula.discard="${this._onInputDiscard}">
47
- </og-grid-formula>
48
- `;
49
- }
50
- commit() {
51
- if (this._open && !this.cancel && this.activeCellModel) {
52
- this.grid.editing.updateCells([this.activeCellModel], [this.getValue()], true);
53
- this.grid.rendering.updateCells([this.activeCellModel], true);
54
- }
55
- this.cancel = false;
56
- this.close();
57
- }
58
- close() {
59
- this.grid.selecting.removeFormulaHighlight();
60
- this.grid.selecting.updateFormulaSelector();
61
- super.close();
62
- }
63
- activate(cell) {
64
- this.grid.editing.startFormulaMode();
65
- super.activate(cell);
66
- this.input.tokenizer = cell.model.calculations.tokenizer;
67
- this.setValue(cell.hasOwnFormula ? cell.formula : '');
68
- const eventTarget = this.grid.group ? this.grid.group : this.grid;
69
- eventTarget.addEventListener('grid.selector.resize', this._onGridSelectorUpdate);
70
- eventTarget.addEventListener('grid.selector.move', this._onGridSelectorUpdate);
71
- eventTarget.addEventListener('grid.select', this._onGridSelect);
72
- }
73
- deactivate() {
74
- const eventTarget = this.grid.group ? this.grid.group : this.grid;
75
- eventTarget.removeEventListener('grid.selector.resize', this._onGridSelectorUpdate);
76
- eventTarget.removeEventListener('grid.selector.move', this._onGridSelectorUpdate);
77
- eventTarget.removeEventListener('grid.select', this._onGridSelect);
78
- this.grid.editing.endFormulaMode();
79
- super.deactivate();
80
- }
81
- getValue() {
82
- return this.input.value;
83
- }
84
- setValue(value) {
85
- dom.setSize(this.input, { w: this.clientWidth });
86
- this.input.activate((value || '=').charAt(0) != '=' ? ('=' + value) : value);
87
- }
88
- focus() {
89
- this.input.focus();
90
- }
91
- };
92
- FormulaEditor.styles = [BaseEditor.baseStyles, css `
93
- og-grid-formula {
94
- display: block;
95
- border: 1px solid var(--og-accent-color, ${unsafeCSS(constants.DEFAULT_ACCENT_COLOR)});
96
- background: var(--og-cell-background);
97
- width: 100%;
98
- height: 100%;
99
- padding: 0;
100
- }
101
- `];
102
- __decorate([
103
- query('og-grid-formula')
104
- ], FormulaEditor.prototype, "input", void 0);
105
- FormulaEditor = __decorate([
106
- customElement('og-grid-formulaeditor')
107
- ], FormulaEditor);
108
- export { FormulaEditor };
109
- //# sourceMappingURL=formulaEditor.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"formulaEditor.js","sourceRoot":"","sources":["../../src/editors/formulaEditor.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,KAAK,CAAC;AAE3C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,SAAS,MAAM,cAAc,CAAC;AAErC,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAG/B,IAAM,aAAa,GAAnB,MAAM,aAAc,SAAQ,UAAU;IAAtC;;QA+BN,0BAAqB,GAAG,CAAC,CAAgB,EAAE,EAAE;YAC5C,IAAI,CAAC,CAAC,QAAQ,EAAE,KAAK,IAAI,IAAI;gBAAE,OAAO;YACtC,MAAM,KAAK,GAAG,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC;YAC3C,IAAI,CAAC,CAAC,QAAQ,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI;gBAAE,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC;YAC3E,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QAC9C,CAAC,CAAA;QAED,kBAAa,GAAG,CAAC,CAAY,EAAE,EAAE;YAChC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,aAAa;gBAAE,OAAO;YAC7C,MAAM,KAAK,GAAG,CAAC,C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,CAAC,mBAAmB,CAAC,oBAAoB,EAAE,IAAI,CAAC,qBAAqB,CAAC,CAAC;QAClF,WAAW,CAAC,mBAAmB,CAAC,aAAa,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;QACnE,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,cAAc,EAAE,CAAC;QACnC,KAAK,CAAC,UAAU,EAAE,CAAC;IACpB,CAAC;IAED,QAAQ;QACP,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC;IACzB,CAAC;IAED,QAAQ,CAAC,KAAa;QACrB,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,EAAE,EAAC,CAAC,EAAE,IAAI,CAAC,WAAW,EAAC,CAAC,CAAC;QAC/C,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,KAAK,IAAI,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;IAC9E,CAAC;IAeD,KAAK;QACJ,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;IACpB,CAAC;;AAvFM,oBAAM,GAAG,CAAC,UAAU,CAAC,UAAU,EAAE,GAAG,CAAA;;;8CAGE,SAAS,CAAC,SAAS,CAAC,oBAAoB,CAAC;;;;;;EAMrF,CAAC,AATW,CASV;AAGH;IADC,KAAK,CAAC,iBAAiB,CAAC;4CACL;AAdR,aAAa;IADzB,aAAa,CAAC,uBAAuB,CAAC;GAC1B,aAAa,CAmGzB","sourcesContent":["import { customElement, query } from 'lit/decorators.js';\nimport { css, html, unsafeCSS } from \"lit\";\nimport { CellModel } from \"@omegagrid/grid-core\";\nimport { BaseEditor } from \"./baseEditor\";\nimport constants from \"../constants\";\nimport { FormulaInput, FormulaInputEvent, GridEvent, SelectorEvent } from \"../ui\";\nimport { dom } from '@omegagrid/core';\n\n@customElement('og-grid-formulaeditor')\nexport class FormulaEditor extends BaseEditor {\n\n\tstatic styles = [BaseEditor.baseStyles, css`\n\t\tog-grid-formula {\n\t\t\tdisplay: block;\n\t\t\tborder: 1px solid var(--og-accent-color, ${unsafeCSS(constants.DEFAULT_ACCENT_COLOR)});\n\t\t\tbackground: var(--og-cell-background);\n\t\t\twidth: 100%;\n\t\t\theight: 100%;\n\t\t\tpadding: 0;\n\t\t}\n\t`];\n\n\t@query('og-grid-formula')\n\tinput: FormulaInput;\n\n\tcommit() {\n\t\tif (this._open && !this.cancel && this.activeCellModel) {\n\t\t\tthis.grid.editing.updateCells([this.activeCellModel], [this.getValue()], true);\n\t\t\tthis.grid.rendering.updateCells([this.activeCellModel], true);\n\t\t}\n\t\tthis.cancel = false;\n\t\tthis.close();\n\t}\n\n\tclose() {\n\t\tthis.grid.selecting.removeFormulaHighlight();\n\t\tthis.grid.selecting.updateFormulaSelector();\n\t\tsuper.close();\n\t}\n\n\t_onGridSelectorUpdate = (e: SelectorEvent) => {\n\t\tif (e.selector?.index == null) return;\n\t\tconst range = e.selector.selection.clone();\n\t\tif (e.selector.grid != this.grid) range.sheet = e.selector.grid.model.name;\n\t\tthis.input.setRange(range, e.selector.index);\n\t}\n\n\t_onGridSelect = (e: GridEvent) => {\n\t\tif (!this.grid.editing.isFormulaMode) return;\n\t\tconst range = e.selection.range.clone();\n\t\tif (e.grid != this.grid) range.sheet = e.grid.model.name;\n\t\tthis.input.setRange(range);\n\t}\n\n\tactivate(cell: CellModel) {\n\t\tthis.grid.editing.startFormulaMode();\n\t\tsuper.activate(cell);\n\t\tthis.input.tokenizer = cell.model.calculations.tokenizer;\n\t\tthis.setValue(cell.hasOwnFormula ? cell.formula : '');\n\t\tconst eventTarget = this.grid.group ? this.grid.group : this.grid;\n\t\teventTarget.addEventListener('grid.selector.resize', this._onGridSelectorUpdate);\n\t\teventTarget.addEventListener('grid.selector.move', this._onGridSelectorUpdate);\n\t\teventTarget.addEventListener('grid.select', this._onGridSelect);\n\t}\n\n\tdeactivate() {\n\t\tconst eventTarget = this.grid.group ? this.grid.group : this.grid;\n\t\teventTarget.removeEventListener('grid.selector.resize', this._onGridSelectorUpdate);\n\t\teventTarget.removeEventListener('grid.selector.move', this._onGridSelectorUpdate);\n\t\teventTarget.removeEventListener('grid.select', this._onGridSelect);\n\t\tthis.grid.editing.endFormulaMode();\n\t\tsuper.deactivate();\n\t}\n\n\tgetValue() {\n\t\treturn this.input.value;\n\t}\n\n\tsetValue(value: string) {\n\t\tdom.setSize(this.input, {w: this.clientWidth});\n\t\tthis.input.activate((value || '=').charAt(0) != '=' ? ('=' + value) : value);\n\t}\n\n\t_onPreview = (e: FormulaInputEvent) => {\n\t\tthis.grid.selecting.removeFormulaHighlight();\n\t\tif (e.formula) this.grid.selecting.highlightFormula(e.formula);\n\t}\n\n\t_onInputCommit = () => {\n\t\tthis.commit();\n\t}\n\n\t_onInputDiscard = () => {\n\t\tthis.close();\n\t}\n\n\tfocus() {\n\t\tthis.input.focus();\n\t}\n\n\trender = () => html`\n\t\t<og-grid-formula\n\t\t\t@formula.preview=\"${this._onPreview}\"\n\t\t\t@formula.commit=\"${this._onInputCommit}\"\n\t\t\t@formula.discard=\"${this._onInputDiscard}\">\n\t\t</og-grid-formula>\n\t`;\n\n}"]}
@@ -1,8 +0,0 @@
1
- import { BaseEditor } from "./baseEditor";
2
- import { CellType, EditingOptions } from "@omegagrid/grid-core";
3
- export * from "./formulaEditor";
4
- export type EditorFactory = {
5
- createComponent: (options?: EditingOptions) => BaseEditor;
6
- };
7
- export declare function getEditorFactory(type: CellType): EditorFactory;
8
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/editors/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAO1C,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEhE,cAAc,iBAAiB,CAAC;AAEhC,MAAM,MAAM,aAAa,GAAG;IAC3B,eAAe,EAAE,CAAC,OAAO,CAAC,EAAE,cAAc,KAAK,UAAU,CAAA;CACzD,CAAC;AAWF,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,QAAQ,GAAI,aAAa,CAE/D"}
@@ -1,19 +0,0 @@
1
- import { CheckboxEditor } from "./checkboxEditor";
2
- import { NumberEditor } from "./numberEditor";
3
- import { TextEditor } from "./textEditor";
4
- import { DropdownEditor } from "./dropdownEditor";
5
- import { DateEditor } from "./dateEditor";
6
- import { CalendarEditor } from "./calendarEditor";
7
- export * from "./formulaEditor";
8
- const editorMap = new Map([
9
- ['t', { createComponent: () => new TextEditor() }],
10
- ['n', { createComponent: () => new NumberEditor() }],
11
- ['b', { createComponent: () => new CheckboxEditor() }],
12
- ['s', { createComponent: () => new DropdownEditor() }],
13
- ['m', { createComponent: () => new DropdownEditor() }],
14
- ['d', { createComponent: (options) => options?.dateCalendarEditor ? new CalendarEditor() : new DateEditor() }],
15
- ]);
16
- export function getEditorFactory(type) {
17
- return editorMap.get(editorMap.has(type) ? type : 't');
18
- }
19
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/editors/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAGlD,cAAc,iBAAiB,CAAC;AAMhC,MAAM,SAAS,GAAG,IAAI,GAAG,CAA0B;IAClD,CAAC,GAAG,EAAE,EAAC,eAAe,EAAE,GAAG,EAAE,CAAC,IAAI,UAAU,EAAE,EAAC,CAAC;IAChD,CAAC,GAAG,EAAE,EAAC,eAAe,EAAE,GAAG,EAAE,CAAC,IAAI,YAAY,EAAE,EAAC,CAAC;IAClD,CAAC,GAAG,EAAE,EAAC,eAAe,EAAE,GAAG,EAAE,CAAC,IAAI,cAAc,EAAE,EAAC,CAAC;IACpD,CAAC,GAAG,EAAE,EAAC,eAAe,EAAE,GAAG,EAAE,CAAC,IAAI,cAAc,EAAE,EAAC,CAAC;IACpD,CAAC,GAAG,EAAE,EAAC,eAAe,EAAE,GAAG,EAAE,CAAC,IAAI,cAAc,EAAE,EAAC,CAAC;IACpD,CAAC,GAAG,EAAE,EAAC,eAAe,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,EAAE,kBAAkB,CAAC,CAAC,CAAC,IAAI,cAAc,EAAE,CAAC,CAAC,CAAC,IAAI,UAAU,EAAE,EAAC,CAAC;CAC5G,CAAC,CAAC;AAEH,MAAM,UAAU,gBAAgB,CAAC,IAAc;IAC9C,OAAO,SAAS,CAAC,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;AACxD,CAAC","sourcesContent":["import { BaseEditor } from \"./baseEditor\";\nimport { CheckboxEditor } from \"./checkboxEditor\";\nimport { NumberEditor } from \"./numberEditor\";\nimport { TextEditor } from \"./textEditor\";\nimport { DropdownEditor } from \"./dropdownEditor\";\nimport { DateEditor } from \"./dateEditor\";\nimport { CalendarEditor } from \"./calendarEditor\";\nimport { CellType, EditingOptions } from \"@omegagrid/grid-core\";\n\nexport * from \"./formulaEditor\";\n\nexport type EditorFactory = {\n\tcreateComponent: (options?: EditingOptions) => BaseEditor\n};\n\nconst editorMap = new Map<CellType, EditorFactory>([\n\t['t', {createComponent: () => new TextEditor()}],\n\t['n', {createComponent: () => new NumberEditor()}],\n\t['b', {createComponent: () => new CheckboxEditor()}],\n\t['s', {createComponent: () => new DropdownEditor()}],\n\t['m', {createComponent: () => new DropdownEditor()}],\n\t['d', {createComponent: (options) => options?.dateCalendarEditor ? new CalendarEditor() : new DateEditor()}],\n]);\n\nexport function getEditorFactory(type: CellType) : EditorFactory {\n\treturn editorMap.get(editorMap.has(type) ? type : 't');\n}"]}
@@ -1,9 +0,0 @@
1
- import { TextEditor } from "./textEditor";
2
- export declare class NumberEditor extends TextEditor {
3
- private validateNumber;
4
- _onKey(e: KeyboardEvent): void;
5
- setValue(value: string): void;
6
- firstUpdated(): void;
7
- getValue(): string;
8
- }
9
- //# sourceMappingURL=numberEditor.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"numberEditor.d.ts","sourceRoot":"","sources":["../../src/editors/numberEditor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAI1C,qBACa,YAAa,SAAQ,UAAU;IAE3C,OAAO,CAAC,cAAc;IAKtB,MAAM,CAAC,CAAC,EAAE,aAAa;IAQvB,QAAQ,CAAC,KAAK,EAAE,MAAM;IAItB,YAAY;IAKZ,QAAQ;CAIR"}
@@ -1,37 +0,0 @@
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 { TextEditor } from "./textEditor";
8
- import { customElement } from 'lit/decorators.js';
9
- import { isFormula } from "@omegagrid/grid-core";
10
- let NumberEditor = class NumberEditor extends TextEditor {
11
- validateNumber(value) {
12
- value = value.replace(',', '.');
13
- return isFormula(value) || !isNaN(Number(value)) || value == '-';
14
- }
15
- _onKey(e) {
16
- if (e.key.length === 1) {
17
- if (!this.validateNumber(this.input.value + e.key)) {
18
- e.preventDefault();
19
- }
20
- }
21
- }
22
- setValue(value) {
23
- this.input.value = this.validateNumber(value) ? value : '';
24
- }
25
- firstUpdated() {
26
- this.input.addEventListener('keydown', e => this._onKey(e));
27
- this.input.addEventListener('keypress', e => this._onKey(e));
28
- }
29
- getValue() {
30
- return this.input.value === '' ? null : this.input.value.replace(',', '.');
31
- }
32
- };
33
- NumberEditor = __decorate([
34
- customElement('og-grid-numbereditor')
35
- ], NumberEditor);
36
- export { NumberEditor };
37
- //# sourceMappingURL=numberEditor.js.map