@operato/data-grist 2.0.0-alpha.7 → 2.0.0-alpha.80

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (267) hide show
  1. package/CHANGELOG.md +297 -0
  2. package/demo/data-grist-test.html +25 -14
  3. package/demo/index.html +25 -14
  4. package/demo/report-test.html +13 -2
  5. package/dist/src/accumulator/accumulator.js +4 -4
  6. package/dist/src/accumulator/accumulator.js.map +1 -1
  7. package/dist/src/configure/rows-option-builder.js +2 -1
  8. package/dist/src/configure/rows-option-builder.js.map +1 -1
  9. package/dist/src/configure/zero-config.js +1 -0
  10. package/dist/src/configure/zero-config.js.map +1 -1
  11. package/dist/src/data-card/data-card-gutter-menu.d.ts +1 -1
  12. package/dist/src/data-card/data-card-gutter-menu.js +5 -5
  13. package/dist/src/data-card/data-card-gutter-menu.js.map +1 -1
  14. package/dist/src/data-card/data-card.d.ts +2 -2
  15. package/dist/src/data-card/data-card.js +3 -3
  16. package/dist/src/data-card/data-card.js.map +1 -1
  17. package/dist/src/data-card/event-handlers/record-card-click-handler.js +1 -1
  18. package/dist/src/data-card/event-handlers/record-card-click-handler.js.map +1 -1
  19. package/dist/src/data-card/record-card.d.ts +2 -2
  20. package/dist/src/data-card/record-card.js +26 -26
  21. package/dist/src/data-card/record-card.js.map +1 -1
  22. package/dist/src/data-grid/data-grid-accum-field.js +8 -3
  23. package/dist/src/data-grid/data-grid-accum-field.js.map +1 -1
  24. package/dist/src/data-grid/data-grid-body.d.ts +3 -3
  25. package/dist/src/data-grid/data-grid-body.js +9 -4
  26. package/dist/src/data-grid/data-grid-body.js.map +1 -1
  27. package/dist/src/data-grid/data-grid-field.d.ts +1 -1
  28. package/dist/src/data-grid/data-grid-field.js +2 -2
  29. package/dist/src/data-grid/data-grid-field.js.map +1 -1
  30. package/dist/src/data-grid/data-grid-footer.d.ts +2 -2
  31. package/dist/src/data-grid/data-grid-footer.js +17 -9
  32. package/dist/src/data-grid/data-grid-footer.js.map +1 -1
  33. package/dist/src/data-grid/data-grid-header.d.ts +1 -1
  34. package/dist/src/data-grid/data-grid-header.js +37 -37
  35. package/dist/src/data-grid/data-grid-header.js.map +1 -1
  36. package/dist/src/data-grid/data-grid.d.ts +1 -1
  37. package/dist/src/data-grid/data-grid.js +1 -1
  38. package/dist/src/data-grid/data-grid.js.map +1 -1
  39. package/dist/src/data-grist.d.ts +226 -4
  40. package/dist/src/data-grist.js +217 -25
  41. package/dist/src/data-grist.js.map +1 -1
  42. package/dist/src/data-list/data-list-gutter.js +12 -0
  43. package/dist/src/data-list/data-list-gutter.js.map +1 -1
  44. package/dist/src/data-list/data-list.d.ts +2 -2
  45. package/dist/src/data-list/data-list.js +3 -3
  46. package/dist/src/data-list/data-list.js.map +1 -1
  47. package/dist/src/data-list/event-handlers/record-partial-click-handler.js +1 -1
  48. package/dist/src/data-list/event-handlers/record-partial-click-handler.js.map +1 -1
  49. package/dist/src/data-list/record-partial.d.ts +2 -2
  50. package/dist/src/data-list/record-partial.js +20 -18
  51. package/dist/src/data-list/record-partial.js.map +1 -1
  52. package/dist/src/data-manipulator.d.ts +6 -6
  53. package/dist/src/data-manipulator.js +44 -29
  54. package/dist/src/data-manipulator.js.map +1 -1
  55. package/dist/src/data-report/data-report-body.d.ts +1 -1
  56. package/dist/src/data-report/data-report-component.d.ts +1 -1
  57. package/dist/src/data-report.d.ts +1 -1
  58. package/dist/src/editors/ox-grist-editor-checkbox.d.ts +3 -2
  59. package/dist/src/editors/ox-grist-editor-checkbox.js +9 -2
  60. package/dist/src/editors/ox-grist-editor-checkbox.js.map +1 -1
  61. package/dist/src/editors/ox-grist-editor-color.d.ts +1 -1
  62. package/dist/src/editors/ox-grist-editor-date.d.ts +1 -1
  63. package/dist/src/editors/ox-grist-editor-datetime.d.ts +2 -2
  64. package/dist/src/editors/ox-grist-editor-datetime.js +1 -2
  65. package/dist/src/editors/ox-grist-editor-datetime.js.map +1 -1
  66. package/dist/src/editors/ox-grist-editor-email.d.ts +1 -1
  67. package/dist/src/editors/ox-grist-editor-file.d.ts +3 -2
  68. package/dist/src/editors/ox-grist-editor-file.js +8 -2
  69. package/dist/src/editors/ox-grist-editor-file.js.map +1 -1
  70. package/dist/src/editors/ox-grist-editor-image.d.ts +2 -2
  71. package/dist/src/editors/ox-grist-editor-image.js +8 -8
  72. package/dist/src/editors/ox-grist-editor-image.js.map +1 -1
  73. package/dist/src/editors/ox-grist-editor-month.d.ts +1 -1
  74. package/dist/src/editors/ox-grist-editor-multiple-select.d.ts +1 -1
  75. package/dist/src/editors/ox-grist-editor-number.d.ts +3 -2
  76. package/dist/src/editors/ox-grist-editor-number.js +10 -9
  77. package/dist/src/editors/ox-grist-editor-number.js.map +1 -1
  78. package/dist/src/editors/ox-grist-editor-password.d.ts +1 -1
  79. package/dist/src/editors/ox-grist-editor-select.d.ts +1 -1
  80. package/dist/src/editors/ox-grist-editor-tel.d.ts +1 -1
  81. package/dist/src/editors/ox-grist-editor-text.d.ts +2 -1
  82. package/dist/src/editors/ox-grist-editor-text.js +3 -0
  83. package/dist/src/editors/ox-grist-editor-text.js.map +1 -1
  84. package/dist/src/editors/ox-grist-editor-textarea.d.ts +2 -1
  85. package/dist/src/editors/ox-grist-editor-textarea.js +3 -0
  86. package/dist/src/editors/ox-grist-editor-textarea.js.map +1 -1
  87. package/dist/src/editors/ox-grist-editor-time.d.ts +1 -1
  88. package/dist/src/editors/ox-grist-editor-tree.d.ts +1 -1
  89. package/dist/src/editors/ox-grist-editor-week.d.ts +1 -1
  90. package/dist/src/editors/ox-grist-editor.d.ts +4 -4
  91. package/dist/src/editors/ox-grist-editor.js +14 -12
  92. package/dist/src/editors/ox-grist-editor.js.map +1 -1
  93. package/dist/src/editors/ox-input-tree.d.ts +1 -1
  94. package/dist/src/empty-note.d.ts +2 -2
  95. package/dist/src/empty-note.js +3 -3
  96. package/dist/src/empty-note.js.map +1 -1
  97. package/dist/src/filters/filter-range-date.js +12 -1
  98. package/dist/src/filters/filter-range-date.js.map +1 -1
  99. package/dist/src/filters/filters-form.d.ts +1 -0
  100. package/dist/src/filters/filters-form.js +41 -23
  101. package/dist/src/filters/filters-form.js.map +1 -1
  102. package/dist/src/gutters/gutter-button.d.ts +1 -1
  103. package/dist/src/gutters/gutter-button.js +3 -3
  104. package/dist/src/gutters/gutter-button.js.map +1 -1
  105. package/dist/src/gutters/gutter-dirty.d.ts +1 -1
  106. package/dist/src/gutters/gutter-dirty.js +5 -5
  107. package/dist/src/gutters/gutter-dirty.js.map +1 -1
  108. package/dist/src/handlers/contextmenu-tree-mutation.js +5 -23
  109. package/dist/src/handlers/contextmenu-tree-mutation.js.map +1 -1
  110. package/dist/src/index.d.ts +0 -1
  111. package/dist/src/index.js +0 -1
  112. package/dist/src/index.js.map +1 -1
  113. package/dist/src/record-view/record-creator.d.ts +2 -2
  114. package/dist/src/record-view/record-creator.js +1 -1
  115. package/dist/src/record-view/record-creator.js.map +1 -1
  116. package/dist/src/record-view/record-view-body.d.ts +3 -3
  117. package/dist/src/record-view/record-view-body.js +4 -4
  118. package/dist/src/record-view/record-view-body.js.map +1 -1
  119. package/dist/src/record-view/record-view.d.ts +2 -2
  120. package/dist/src/record-view/record-view.js +5 -5
  121. package/dist/src/record-view/record-view.js.map +1 -1
  122. package/dist/src/renderers/ox-grist-renderer-progress.d.ts +1 -1
  123. package/dist/src/renderers/ox-grist-renderer-tree.d.ts +1 -1
  124. package/dist/src/renderers/ox-grist-renderer.d.ts +2 -2
  125. package/dist/src/sorters/sorters-control.js +3 -3
  126. package/dist/src/sorters/sorters-control.js.map +1 -1
  127. package/dist/src/types.d.ts +1 -8
  128. package/dist/src/types.js.map +1 -1
  129. package/dist/stories/accumulator.stories.d.ts +1 -1
  130. package/dist/stories/accumulator.stories.js +126 -112
  131. package/dist/stories/accumulator.stories.js.map +1 -1
  132. package/dist/stories/barcode-input-filter.stories.d.ts +1 -1
  133. package/dist/stories/barcode-input-filter.stories.js +80 -72
  134. package/dist/stories/barcode-input-filter.stories.js.map +1 -1
  135. package/dist/stories/default-filters.stories.d.ts +1 -1
  136. package/dist/stories/default-filters.stories.js +80 -72
  137. package/dist/stories/default-filters.stories.js.map +1 -1
  138. package/dist/stories/dynamic-editable.stories.d.ts +1 -1
  139. package/dist/stories/dynamic-editable.stories.js +100 -79
  140. package/dist/stories/dynamic-editable.stories.js.map +1 -1
  141. package/dist/stories/empty-sorters.stories.d.ts +1 -1
  142. package/dist/stories/empty-sorters.stories.js +80 -71
  143. package/dist/stories/empty-sorters.stories.js.map +1 -1
  144. package/dist/stories/explicit-fetch.stories.d.ts +1 -1
  145. package/dist/stories/explicit-fetch.stories.js +81 -72
  146. package/dist/stories/explicit-fetch.stories.js.map +1 -1
  147. package/dist/stories/fixed-column.stories.d.ts +1 -1
  148. package/dist/stories/fixed-column.stories.js +122 -113
  149. package/dist/stories/fixed-column.stories.js.map +1 -1
  150. package/dist/stories/grist-modes.stories.d.ts +1 -1
  151. package/dist/stories/grist-modes.stories.js +155 -125
  152. package/dist/stories/grist-modes.stories.js.map +1 -1
  153. package/dist/stories/group-header.stories.d.ts +1 -1
  154. package/dist/stories/group-header.stories.js +122 -113
  155. package/dist/stories/group-header.stories.js.map +1 -1
  156. package/dist/stories/textarea.stories.d.ts +1 -1
  157. package/dist/stories/textarea.stories.js +113 -104
  158. package/dist/stories/textarea.stories.js.map +1 -1
  159. package/dist/stories/tree-column-with-checkbox.stories.d.ts +1 -1
  160. package/dist/stories/tree-column-with-checkbox.stories.js +126 -117
  161. package/dist/stories/tree-column-with-checkbox.stories.js.map +1 -1
  162. package/dist/stories/tree-column.stories.d.ts +1 -1
  163. package/dist/stories/tree-column.stories.js +126 -117
  164. package/dist/stories/tree-column.stories.js.map +1 -1
  165. package/dist/tsconfig.tsbuildinfo +1 -1
  166. package/docs/default-value/default-value.md +1 -1
  167. package/docs/default-value/value-generator/date-generator.md +2 -2
  168. package/docs/default-value/value-generator/month-date-generator.md +2 -2
  169. package/docs/default-value/value-generator/week-date-generator.md +2 -2
  170. package/docs/default-value/value-generator/year-date-generator.md +2 -2
  171. package/package.json +21 -20
  172. package/src/accumulator/accumulator.ts +4 -4
  173. package/src/configure/rows-option-builder.ts +11 -1
  174. package/src/configure/zero-config.ts +1 -0
  175. package/src/data-card/data-card-gutter-menu.ts +5 -5
  176. package/src/data-card/data-card.ts +3 -3
  177. package/src/data-card/event-handlers/record-card-click-handler.ts +1 -1
  178. package/src/data-card/record-card.ts +30 -32
  179. package/src/data-grid/data-grid-accum-field.ts +8 -3
  180. package/src/data-grid/data-grid-body.ts +10 -5
  181. package/src/data-grid/data-grid-field.ts +1 -1
  182. package/src/data-grid/data-grid-footer.ts +18 -11
  183. package/src/data-grid/data-grid-header.ts +67 -68
  184. package/src/data-grid/data-grid.ts +3 -3
  185. package/src/data-grist.ts +274 -27
  186. package/src/data-list/data-list-gutter.ts +12 -0
  187. package/src/data-list/data-list.ts +3 -3
  188. package/src/data-list/event-handlers/record-partial-click-handler.ts +1 -1
  189. package/src/data-list/record-partial.ts +22 -22
  190. package/src/data-manipulator.ts +52 -31
  191. package/src/editors/ox-grist-editor-checkbox.ts +12 -2
  192. package/src/editors/ox-grist-editor-datetime.ts +1 -2
  193. package/src/editors/ox-grist-editor-file.ts +12 -2
  194. package/src/editors/ox-grist-editor-image.ts +10 -7
  195. package/src/editors/ox-grist-editor-number.ts +11 -9
  196. package/src/editors/ox-grist-editor-text.ts +4 -0
  197. package/src/editors/ox-grist-editor-textarea.ts +4 -0
  198. package/src/editors/ox-grist-editor.ts +14 -10
  199. package/src/empty-note.ts +3 -3
  200. package/src/filters/filter-range-date.ts +16 -1
  201. package/src/filters/filters-form.ts +69 -46
  202. package/src/gutters/gutter-button.ts +3 -3
  203. package/src/gutters/gutter-dirty.ts +5 -5
  204. package/src/handlers/contextmenu-tree-mutation.ts +5 -23
  205. package/src/index.ts +0 -1
  206. package/src/record-view/record-creator.ts +1 -1
  207. package/src/record-view/record-view-body.ts +4 -4
  208. package/src/record-view/record-view.ts +5 -5
  209. package/src/sorters/sorters-control.ts +3 -3
  210. package/src/types.ts +1 -9
  211. package/stories/accumulator.stories.ts +128 -118
  212. package/stories/barcode-input-filter.stories.ts +91 -82
  213. package/stories/default-filters.stories.ts +91 -82
  214. package/stories/dynamic-editable.stories.ts +108 -86
  215. package/stories/empty-sorters.stories.ts +92 -82
  216. package/stories/explicit-fetch.stories.ts +93 -83
  217. package/stories/fixed-column.stories.ts +134 -124
  218. package/stories/grist-modes.stories.ts +167 -141
  219. package/stories/group-header.stories.ts +134 -124
  220. package/stories/textarea.stories.ts +115 -110
  221. package/stories/tree-column-with-checkbox.stories.ts +134 -124
  222. package/stories/tree-column.stories.ts +134 -124
  223. package/themes/grist-theme.css +1 -1
  224. package/dist/src/value-generator/date-generator.d.ts +0 -6
  225. package/dist/src/value-generator/date-generator.js +0 -30
  226. package/dist/src/value-generator/date-generator.js.map +0 -1
  227. package/dist/src/value-generator/hour-time-generator.d.ts +0 -7
  228. package/dist/src/value-generator/hour-time-generator.js +0 -29
  229. package/dist/src/value-generator/hour-time-generator.js.map +0 -1
  230. package/dist/src/value-generator/index.d.ts +0 -1
  231. package/dist/src/value-generator/index.js +0 -2
  232. package/dist/src/value-generator/index.js.map +0 -1
  233. package/dist/src/value-generator/minute-time-generator.d.ts +0 -7
  234. package/dist/src/value-generator/minute-time-generator.js +0 -29
  235. package/dist/src/value-generator/minute-time-generator.js.map +0 -1
  236. package/dist/src/value-generator/month-date-generator.d.ts +0 -7
  237. package/dist/src/value-generator/month-date-generator.js +0 -31
  238. package/dist/src/value-generator/month-date-generator.js.map +0 -1
  239. package/dist/src/value-generator/now-generator.d.ts +0 -4
  240. package/dist/src/value-generator/now-generator.js +0 -8
  241. package/dist/src/value-generator/now-generator.js.map +0 -1
  242. package/dist/src/value-generator/registry.d.ts +0 -11
  243. package/dist/src/value-generator/registry.js +0 -50
  244. package/dist/src/value-generator/registry.js.map +0 -1
  245. package/dist/src/value-generator/time-generator.d.ts +0 -6
  246. package/dist/src/value-generator/time-generator.js +0 -28
  247. package/dist/src/value-generator/time-generator.js.map +0 -1
  248. package/dist/src/value-generator/today-generator.d.ts +0 -4
  249. package/dist/src/value-generator/today-generator.js +0 -8
  250. package/dist/src/value-generator/today-generator.js.map +0 -1
  251. package/dist/src/value-generator/week-date-generator.d.ts +0 -7
  252. package/dist/src/value-generator/week-date-generator.js +0 -29
  253. package/dist/src/value-generator/week-date-generator.js.map +0 -1
  254. package/dist/src/value-generator/year-date-generator.d.ts +0 -7
  255. package/dist/src/value-generator/year-date-generator.js +0 -29
  256. package/dist/src/value-generator/year-date-generator.js.map +0 -1
  257. package/src/value-generator/date-generator.ts +0 -35
  258. package/src/value-generator/hour-time-generator.ts +0 -43
  259. package/src/value-generator/index.ts +0 -1
  260. package/src/value-generator/minute-time-generator.ts +0 -43
  261. package/src/value-generator/month-date-generator.ts +0 -38
  262. package/src/value-generator/now-generator.ts +0 -10
  263. package/src/value-generator/registry.ts +0 -58
  264. package/src/value-generator/time-generator.ts +0 -33
  265. package/src/value-generator/today-generator.ts +0 -10
  266. package/src/value-generator/week-date-generator.ts +0 -40
  267. package/src/value-generator/year-date-generator.ts +0 -36
@@ -14,11 +14,33 @@ import { buildConfig } from './configure/config-builder';
14
14
  import { ZERO_CONFIG, ZERO_DATA, ZERO_PAGES, ZERO_PAGINATION } from './configure/zero-config';
15
15
  import { DataProvider } from './data-provider';
16
16
  import { convertListParamToSearchString, convertSearchStringToListParam } from './utils';
17
+ /**
18
+ * A custom element for rendering data in a grid, list, or card format.
19
+ *
20
+ * @element ox-grist
21
+ */
17
22
  let DataGrist = class DataGrist extends LitElement {
18
23
  constructor() {
19
24
  super(...arguments);
25
+ /**
26
+ * The rendering mode of the component, which can be 'GRID', 'LIST', or 'CARD'.
27
+ * Default is 'GRID'.
28
+ *
29
+ * @property {string}
30
+ */
20
31
  this.mode = 'GRID';
32
+ /**
33
+ * The data to be displayed in the data grist.
34
+ *
35
+ * @property {GristData}
36
+ */
21
37
  this.data = ZERO_DATA;
38
+ /**
39
+ * Indicates whether explicit fetching of data is enabled. If true, data will be fetched
40
+ * only when `fetch` method is called. Default is false.
41
+ *
42
+ * @property {boolean}
43
+ */
22
44
  this.explicitFetch = false;
23
45
  this._data = ZERO_DATA;
24
46
  this._config = ZERO_CONFIG;
@@ -196,27 +218,27 @@ let DataGrist = class DataGrist extends LitElement {
196
218
  `
197
219
  : this.mode == 'CARD'
198
220
  ? html `
199
- <ox-card
200
- id="grist"
201
- .config=${this.compiledConfig}
202
- .data=${this._data}
203
- .sorters=${this.sorters || []}
204
- .filters=${this.filters || []}
205
- ?empty=${empty}
206
- >
207
- </ox-card>
208
- `
221
+ <ox-card
222
+ id="grist"
223
+ .config=${this.compiledConfig}
224
+ .data=${this._data}
225
+ .sorters=${this.sorters || []}
226
+ .filters=${this.filters || []}
227
+ ?empty=${empty}
228
+ >
229
+ </ox-card>
230
+ `
209
231
  : html `
210
- <ox-list
211
- id="grist"
212
- .config=${this.compiledConfig}
213
- .data=${this._data}
214
- .sorters=${this.sorters || []}
215
- .filters=${this.filters || []}
216
- ?empty=${empty}
217
- >
218
- </ox-list>
219
- `}
232
+ <ox-list
233
+ id="grist"
234
+ .config=${this.compiledConfig}
235
+ .data=${this._data}
236
+ .sorters=${this.sorters || []}
237
+ .filters=${this.filters || []}
238
+ ?empty=${empty}
239
+ >
240
+ </ox-list>
241
+ `}
220
242
  </div>
221
243
 
222
244
  <div id="spinner" ?show=${this._showSpinner}></div>
@@ -235,9 +257,21 @@ let DataGrist = class DataGrist extends LitElement {
235
257
  }
236
258
  }
237
259
  }
260
+ /**
261
+ * Gets the current state of the component. The state includes information about the
262
+ * dirty records and their changes.
263
+ *
264
+ * @getter
265
+ * @public
266
+ * @type {string}
267
+ */
238
268
  get state() {
239
269
  return JSON.stringify(this.dirtyData);
240
270
  }
271
+ /**
272
+ * Undoes the previous change in the component's data by restoring it to the previous state.
273
+ * This method is part of the TimeCapsule feature, allowing users to revert changes.
274
+ */
241
275
  undo() {
242
276
  var _a, _b;
243
277
  if (!((_a = this.timeCapsule) === null || _a === void 0 ? void 0 : _a.backwardable)) {
@@ -245,6 +279,10 @@ let DataGrist = class DataGrist extends LitElement {
245
279
  }
246
280
  this._data = JSON.parse((_b = this.timeCapsule) === null || _b === void 0 ? void 0 : _b.backward());
247
281
  }
282
+ /**
283
+ * Redoes the previously undone change in the component's data by restoring it to the next state.
284
+ * This method is part of the TimeCapsule feature, allowing users to reapply changes.
285
+ */
248
286
  redo() {
249
287
  var _a, _b;
250
288
  if (!((_a = this.timeCapsule) === null || _a === void 0 ? void 0 : _a.forwardable)) {
@@ -252,6 +290,13 @@ let DataGrist = class DataGrist extends LitElement {
252
290
  }
253
291
  this._data = JSON.parse((_b = this.timeCapsule) === null || _b === void 0 ? void 0 : _b.forward());
254
292
  }
293
+ /**
294
+ * Fetches data from a data source and updates the component's data. This method is used to retrieve
295
+ * new data or refresh the existing data in the component.
296
+ *
297
+ * @method
298
+ * @param {boolean} reset - If true, the method resets the scroll position to the top.
299
+ */
255
300
  async fetch(reset = true) {
256
301
  var _a, _b;
257
302
  if (!this.compiledConfig) {
@@ -343,17 +388,56 @@ let DataGrist = class DataGrist extends LitElement {
343
388
  await this.setPullToRefresh();
344
389
  }
345
390
  }
391
+ /**
392
+ * Represents the compiled configuration of the component, which includes various settings and
393
+ * column configurations. You can access this property to get information about how the component
394
+ * is configured.
395
+ *
396
+ * @getter
397
+ * @public
398
+ * @type {GristConfig}
399
+ */
346
400
  get compiledConfig() {
347
401
  return this._config;
348
402
  }
403
+ /**
404
+ * Returns the dirty data in the component, which includes the records that have been added,
405
+ * modified, or deleted but have not been committed to the main data yet.
406
+ *
407
+ * @getter
408
+ * @public
409
+ * @type {GristData} - An object representing the dirty data.
410
+ */
349
411
  get dirtyData() {
350
412
  var _a;
351
413
  return ((_a = this.grist) === null || _a === void 0 ? void 0 : _a.data) || {};
352
414
  }
415
+ /**
416
+ * Returns an array of GristRecord objects representing the records in the dirty state. These are
417
+ * the records that have been added, modified, or deleted but have not been committed to the main
418
+ * data yet.
419
+ *
420
+ * @getter
421
+ * @public
422
+ * @type {GristRecord[]} - An array of GristRecord objects representing the dirty records.
423
+ */
353
424
  get dirtyRecords() {
354
425
  var { records = [] } = this.dirtyData;
355
426
  return records.filter(record => record['__dirty__']);
356
427
  }
428
+ /**
429
+ * Exports a list of patches representing the changes in the dirty state of records. Each patch
430
+ * contains information about whether a record was added, modified, or deleted, along with the
431
+ * record's unique identifier and the changed field values.
432
+ *
433
+ * @param {Object} options - Export options that control the format of the patch list.
434
+ * @param {string} options.flagName - The name of the flag field in the patch indicating the change type (default: 'patchFlag').
435
+ * @param {string} options.addedFlag - The flag value for added records (default: '+').
436
+ * @param {string} options.deletedFlag - The flag value for deleted records (default: '-').
437
+ * @param {string} options.modifiedFlag - The flag value for modified records (default: 'M').
438
+ * @param {string} options.idField - The name of the unique identifier field (default: 'id').
439
+ * @returns {Object[]} - An array of objects representing the patches.
440
+ */
357
441
  exportPatchList({ flagName = 'patchFlag', addedFlag = '+', deletedFlag = '-', modifiedFlag = 'M', idField = 'id' }) {
358
442
  let dirtyRecords = this.dirtyRecords;
359
443
  if (!dirtyRecords || dirtyRecords.length == 0) {
@@ -373,6 +457,15 @@ let DataGrist = class DataGrist extends LitElement {
373
457
  return patch;
374
458
  });
375
459
  }
460
+ /**
461
+ * Exports the selected records or all records in the component, depending on the specified options.
462
+ * You can use this method to export data from the component in various formats or for different purposes.
463
+ *
464
+ * @param {Object} options - Export options that control the behavior of the export.
465
+ * @param {boolean} options.ifSelectedOnly - If true, exports only the selected records. If false, exports all records.
466
+ * @param {boolean} options.includeHiddenField - If true, includes hidden fields in the exported data.
467
+ * @returns {Object[]} - An array of objects representing the exported records.
468
+ */
376
469
  exportRecords({ ifSelectedOnly = true, includeHiddenField = true } = {}) {
377
470
  let records = ifSelectedOnly ? this.selected : this.data.records;
378
471
  if (ifSelectedOnly && (!records || records.length == 0)) {
@@ -390,11 +483,27 @@ let DataGrist = class DataGrist extends LitElement {
390
483
  }, {});
391
484
  });
392
485
  }
486
+ /**
487
+ * Gets the currently selected records in the component. It returns an array of GristRecord objects
488
+ * that are currently selected. You can access this getter to retrieve the selected records.
489
+ *
490
+ * @getter
491
+ * @public
492
+ * @type {GristRecord[]}
493
+ */
393
494
  get selected() {
394
495
  var _a;
395
496
  var { records = [] } = (_a = this.grist) === null || _a === void 0 ? void 0 : _a.data;
396
497
  return records.filter(record => record['__selected__']);
397
498
  }
499
+ /**
500
+ * Sets the currently selected records in the component. You can use this setter to programmatically
501
+ * select specific records by providing an array of GristRecord objects to be selected.
502
+ *
503
+ * @setter
504
+ * @public
505
+ * @type {GristRecord[]}
506
+ */
398
507
  set selected(selected) {
399
508
  if (!this.grist) {
400
509
  console.warn('grist not ready');
@@ -403,6 +512,15 @@ let DataGrist = class DataGrist extends LitElement {
403
512
  selected.forEach(record => (record.__selected__ = true));
404
513
  this.refresh();
405
514
  }
515
+ /**
516
+ * Selects records in the component based on the provided selector function. You can use this method
517
+ * to programmatically select specific records in the component.
518
+ *
519
+ * @method
520
+ * @param {GristSelectFunction} selector - A function that determines which records to select.
521
+ * @param {boolean} reset - If true, clears the previous selection before applying the new one.
522
+ * If false, adds to the existing selection.
523
+ */
406
524
  select(selector, reset = false) {
407
525
  var _a;
408
526
  var { records = [] } = (_a = this.grist) === null || _a === void 0 ? void 0 : _a.data;
@@ -412,16 +530,32 @@ let DataGrist = class DataGrist extends LitElement {
412
530
  records.filter(record => selector(record)).forEach(record => (record.__selected__ = true));
413
531
  this.refresh();
414
532
  }
533
+ /**
534
+ * Shows the loading spinner in the component's UI to indicate ongoing data loading or processing.
535
+ * You can call this method to display the spinner when necessary.
536
+ */
415
537
  showSpinner() {
416
538
  this._showSpinner = true;
417
539
  }
540
+ /**
541
+ * Hides the loading spinner in the component's UI to indicate that data loading or processing has completed.
542
+ * You can call this method to hide the spinner when loading or processing is finished.
543
+ */
418
544
  hideSpinner() {
419
545
  this._showSpinner = false;
420
546
  }
547
+ /**
548
+ * Focuses on the component, making it the active element in the document. This method is useful
549
+ * when you want to programmatically set focus to the component.
550
+ */
421
551
  focus() {
422
552
  super.focus();
423
553
  this.grist.focus();
424
554
  }
555
+ /**
556
+ * Commits the changes made in the dirty state to the component's data. This method updates the
557
+ * component's data with the changes made in the dirty state and clears the dirty state.
558
+ */
425
559
  commit() {
426
560
  var { page, total, limit, records } = this.grist.data;
427
561
  this.data = {
@@ -447,18 +581,30 @@ let DataGrist = class DataGrist extends LitElement {
447
581
  })
448
582
  };
449
583
  }
584
+ /**
585
+ * Shows the headroom element in the component. The headroom element is typically used for
586
+ * displaying additional information or controls at the top of the component.
587
+ */
450
588
  showHeadroom() {
451
589
  if (this.head) {
452
590
  this.head.style.display = 'block';
453
591
  this.setHeadroom();
454
592
  }
455
593
  }
594
+ /**
595
+ * Hides the headroom element in the component. This method hides the additional information
596
+ * or controls displayed at the top of the component.
597
+ */
456
598
  hideHeadroom() {
457
599
  if (this.head) {
458
600
  this.head.style.display = 'none';
459
601
  this.setHeadroom();
460
602
  }
461
603
  }
604
+ /**
605
+ * Toggles the visibility of the headroom element in the component. If the headroom element is
606
+ * currently visible, this method hides it. If it's hidden, this method shows it.
607
+ */
462
608
  toggleHeadroom() {
463
609
  if (this.head) {
464
610
  const display = this.head.style.display;
@@ -476,14 +622,15 @@ let DataGrist = class DataGrist extends LitElement {
476
622
  this.grist.refresh();
477
623
  }
478
624
  /**
479
- * This method cancels all changes in the dirty state before being reflected in the data.
625
+ * Resets the component's data to its original state before any changes were made.
626
+ * This method discards all unsaved changes and restores the data to its initial state.
480
627
  *
481
628
  * @method
482
- *
483
- * TODO tree 형태의 데이타로 _data를 만들 때, children, collapsed 등을 감안한다.
629
+ * @public
484
630
  */
485
631
  reset() {
486
632
  var _a, _b;
633
+ // TODO tree 형태의 데이타로 _data를 만들 때, children, collapsed 등을 감안한다.
487
634
  var { limit = ZERO_PAGINATION.limit, page = ZERO_PAGINATION.page, total = ZERO_PAGINATION.total, records = [] } = this.data || ZERO_PAGINATION;
488
635
  const { childrenProperty, expanded } = this.compiledConfig.tree;
489
636
  /* 원본 데이타를 남기고, 복사본(_data)을 사용한다. */
@@ -523,6 +670,10 @@ let DataGrist = class DataGrist extends LitElement {
523
670
  return [record];
524
671
  }
525
672
  }
673
+ /**
674
+ * Checks for dirty records in the component's data and marks them as dirty.
675
+ * Dirty records are those that have unsaved changes.
676
+ */
526
677
  checkDirties() {
527
678
  var _a;
528
679
  const records = this.dirtyRecords;
@@ -546,6 +697,10 @@ let DataGrist = class DataGrist extends LitElement {
546
697
  this._data = { ...this.dirtyData };
547
698
  (_a = this.snapshotTaker) === null || _a === void 0 ? void 0 : _a.touch();
548
699
  }
700
+ /**
701
+ * Clones the selected records in the component's data. It creates a copy of the selected records
702
+ * and marks them as new (added) records.
703
+ */
549
704
  cloneSelectedRecords() {
550
705
  const records = this.selected || [];
551
706
  records.forEach(record => {
@@ -562,6 +717,33 @@ let DataGrist = class DataGrist extends LitElement {
562
717
  });
563
718
  this.checkDirties();
564
719
  }
720
+ /**
721
+ * Adds child nodes to selected records in the component's tree data. It allows users to add child nodes
722
+ * to the selected parent records.
723
+ */
724
+ addChildNodes() {
725
+ const records = this.selected || [];
726
+ records.forEach(record => {
727
+ this.grist.addChildNode(record);
728
+ });
729
+ }
730
+ /**
731
+ * Adds sibling nodes to selected records in the component's tree data. It allows users to add sibling nodes
732
+ * to the selected records.
733
+ */
734
+ addSiblingNodes() {
735
+ const records = this.selected || [];
736
+ records.forEach(record => {
737
+ this.grist.addSiblingNode(record);
738
+ });
739
+ }
740
+ /**
741
+ * Deletes the selected records in the component's data. It removes the selected records from the data,
742
+ * optionally marking them as deleted.
743
+ *
744
+ * @method
745
+ * @param {boolean} dirty - If true, the method marks the records as deleted.
746
+ */
565
747
  deleteSelectedRecords(dirty = true) {
566
748
  const records = this.selected || [];
567
749
  records.forEach(record => {
@@ -573,10 +755,20 @@ let DataGrist = class DataGrist extends LitElement {
573
755
  });
574
756
  this.checkDirties();
575
757
  }
758
+ /**
759
+ * Retrieves the search text used for filtering records.
760
+ *
761
+ * @property {string}
762
+ */
576
763
  get searchText() {
577
764
  var _a, _b, _c, _d;
578
765
  return ((_d = (_c = (_b = (_a = this.filters) === null || _a === void 0 ? void 0 : _a.find(filter => filter.operator === 'search')) === null || _b === void 0 ? void 0 : _b.value) === null || _c === void 0 ? void 0 : _c.match(/^\%(.*)\%$/)) === null || _d === void 0 ? void 0 : _d[1]) || '';
579
766
  }
767
+ /**
768
+ * Sets the search text for filtering records.
769
+ *
770
+ * @property {string}
771
+ */
580
772
  set searchText(searchText) {
581
773
  var filters = (this.filters || []).filter((filter) => filter.operator !== 'search');
582
774
  if (searchText) {
@@ -625,7 +817,7 @@ DataGrist.styles = [
625
817
 
626
818
  padding: var(--ox-grist-padding);
627
819
 
628
- --mdc-icon-size: var(--grid-record-wide-fontsize);
820
+ --md-icon-size: var(--grid-record-wide-fontsize);
629
821
  }
630
822
 
631
823
  #wrap {
@@ -651,7 +843,7 @@ DataGrist.styles = [
651
843
  box-sizing: border-box;
652
844
  background-color: var(--grist-background-color);
653
845
 
654
- z-index: 1;
846
+ z-index: 2;
655
847
  }
656
848
  `
657
849
  ];