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