@operato/data-grist 2.0.0-alpha.8 → 2.0.0-alpha.81
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 +295 -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 +37 -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 +1 -1
- 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 +217 -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-range-date.js +12 -1
- package/dist/src/filters/filter-range-date.js.map +1 -1
- package/dist/src/filters/filters-form.d.ts +1 -0
- package/dist/src/filters/filters-form.js +41 -23
- 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 +126 -112
- 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 +80 -72
- 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 +80 -72
- 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 +100 -79
- 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 +80 -71
- 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 +81 -72
- 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 +122 -113
- package/dist/stories/fixed-column.stories.js.map +1 -1
- package/dist/stories/grist-modes.stories.d.ts +1 -1
- package/dist/stories/grist-modes.stories.js +155 -125
- 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 +122 -113
- 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 +113 -104
- 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 +126 -117
- 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 +126 -117
- 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 +67 -65
- package/src/data-grid/data-grid.ts +3 -3
- package/src/data-grist.ts +274 -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-range-date.ts +16 -1
- package/src/filters/filters-form.ts +69 -46
- 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 +128 -118
- package/stories/barcode-input-filter.stories.ts +91 -82
- package/stories/default-filters.stories.ts +91 -82
- package/stories/dynamic-editable.stories.ts +108 -86
- package/stories/empty-sorters.stories.ts +92 -82
- package/stories/explicit-fetch.stories.ts +93 -83
- package/stories/fixed-column.stories.ts +134 -124
- package/stories/grist-modes.stories.ts +167 -141
- package/stories/group-header.stories.ts +134 -124
- package/stories/textarea.stories.ts +115 -110
- package/stories/tree-column-with-checkbox.stories.ts +134 -124
- package/stories/tree-column.stories.ts +134 -124
- 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/src/data-grist.ts
CHANGED
@@ -33,6 +33,11 @@ import {
|
|
33
33
|
} from './types'
|
34
34
|
import { convertListParamToSearchString, convertSearchStringToListParam } from './utils'
|
35
35
|
|
36
|
+
/**
|
37
|
+
* A custom element for rendering data in a grid, list, or card format.
|
38
|
+
*
|
39
|
+
* @element ox-grist
|
40
|
+
*/
|
36
41
|
@customElement('ox-grist')
|
37
42
|
export class DataGrist extends LitElement implements DataConsumer {
|
38
43
|
static styles = [
|
@@ -54,7 +59,7 @@ export class DataGrist extends LitElement implements DataConsumer {
|
|
54
59
|
|
55
60
|
padding: var(--ox-grist-padding);
|
56
61
|
|
57
|
-
--
|
62
|
+
--md-icon-size: var(--grid-record-wide-fontsize);
|
58
63
|
}
|
59
64
|
|
60
65
|
#wrap {
|
@@ -80,21 +85,89 @@ export class DataGrist extends LitElement implements DataConsumer {
|
|
80
85
|
box-sizing: border-box;
|
81
86
|
background-color: var(--grist-background-color);
|
82
87
|
|
83
|
-
z-index:
|
88
|
+
z-index: 2;
|
84
89
|
}
|
85
90
|
`
|
86
91
|
]
|
87
92
|
|
93
|
+
/**
|
94
|
+
* The rendering mode of the component, which can be 'GRID', 'LIST', or 'CARD'.
|
95
|
+
* Default is 'GRID'.
|
96
|
+
*
|
97
|
+
* @property {string}
|
98
|
+
*/
|
88
99
|
@property() mode: 'GRID' | 'LIST' | 'CARD' = 'GRID'
|
100
|
+
|
101
|
+
/**
|
102
|
+
* The configuration object for the data grist.
|
103
|
+
*
|
104
|
+
* @property {Object}
|
105
|
+
*/
|
89
106
|
@property() config: any
|
107
|
+
|
108
|
+
/**
|
109
|
+
* The data to be displayed in the data grist.
|
110
|
+
*
|
111
|
+
* @property {GristData}
|
112
|
+
*/
|
90
113
|
@property({ type: Object }) data: GristData = ZERO_DATA
|
114
|
+
|
115
|
+
/**
|
116
|
+
* An array of selected records in the data grist.
|
117
|
+
*
|
118
|
+
* @property {GristRecord[]}
|
119
|
+
*/
|
91
120
|
@property({ type: Array }) selectedRecords?: GristRecord[]
|
121
|
+
|
122
|
+
/**
|
123
|
+
* Indicates whether explicit fetching of data is enabled. If true, data will be fetched
|
124
|
+
* only when `fetch` method is called. Default is false.
|
125
|
+
*
|
126
|
+
* @property {boolean}
|
127
|
+
*/
|
92
128
|
@property({ type: Boolean, attribute: 'explicit-fetch' }) explicitFetch: boolean = false
|
129
|
+
|
130
|
+
/**
|
131
|
+
* The fetch handler function used to retrieve data from a remote source.
|
132
|
+
*
|
133
|
+
* @property {FetchHandler}
|
134
|
+
*/
|
93
135
|
@property() fetchHandler?: FetchHandler
|
136
|
+
|
137
|
+
/**
|
138
|
+
* Additional fetch options to be passed to the fetch handler.
|
139
|
+
*
|
140
|
+
* @property {Object}
|
141
|
+
*/
|
94
142
|
@property() fetchOptions: any
|
143
|
+
|
144
|
+
/**
|
145
|
+
* An array of filter values to be applied to the data grist.
|
146
|
+
*
|
147
|
+
* @property {FilterValue[]}
|
148
|
+
*/
|
95
149
|
@property({ type: Array }) filters?: FilterValue[]
|
150
|
+
|
151
|
+
/**
|
152
|
+
* An array of sorters to determine the order of records in the data grist.
|
153
|
+
*
|
154
|
+
* @property {SortersConfig}
|
155
|
+
*/
|
96
156
|
@property({ type: Array }) sorters?: SortersConfig
|
157
|
+
|
158
|
+
/**
|
159
|
+
* The pagination configuration for the data grist.
|
160
|
+
*
|
161
|
+
* @property {PaginationConfig}
|
162
|
+
*/
|
97
163
|
@property({ type: Object }) pagination?: PaginationConfig
|
164
|
+
|
165
|
+
/**
|
166
|
+
* Indicates whether URL parameters are sensitive to changes. If true, changes in URL
|
167
|
+
* parameters will trigger data fetching. Default is undefined.
|
168
|
+
*
|
169
|
+
* @property {boolean}
|
170
|
+
*/
|
98
171
|
@property({ type: Boolean, attribute: 'url-params-sensitive' }) urlParamsSensitive?: boolean
|
99
172
|
|
100
173
|
@state() _data: GristData = ZERO_DATA
|
@@ -331,28 +404,28 @@ export class DataGrist extends LitElement implements DataConsumer {
|
|
331
404
|
</ox-grid>
|
332
405
|
`
|
333
406
|
: this.mode == 'CARD'
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
407
|
+
? html`
|
408
|
+
<ox-card
|
409
|
+
id="grist"
|
410
|
+
.config=${this.compiledConfig}
|
411
|
+
.data=${this._data}
|
412
|
+
.sorters=${this.sorters || []}
|
413
|
+
.filters=${this.filters || []}
|
414
|
+
?empty=${empty}
|
415
|
+
>
|
416
|
+
</ox-card>
|
417
|
+
`
|
418
|
+
: html`
|
419
|
+
<ox-list
|
420
|
+
id="grist"
|
421
|
+
.config=${this.compiledConfig}
|
422
|
+
.data=${this._data}
|
423
|
+
.sorters=${this.sorters || []}
|
424
|
+
.filters=${this.filters || []}
|
425
|
+
?empty=${empty}
|
426
|
+
>
|
427
|
+
</ox-list>
|
428
|
+
`}
|
356
429
|
</div>
|
357
430
|
|
358
431
|
<div id="spinner" ?show=${this._showSpinner}></div>
|
@@ -372,10 +445,22 @@ export class DataGrist extends LitElement implements DataConsumer {
|
|
372
445
|
}
|
373
446
|
}
|
374
447
|
|
448
|
+
/**
|
449
|
+
* Gets the current state of the component. The state includes information about the
|
450
|
+
* dirty records and their changes.
|
451
|
+
*
|
452
|
+
* @getter
|
453
|
+
* @public
|
454
|
+
* @type {string}
|
455
|
+
*/
|
375
456
|
get state() {
|
376
457
|
return JSON.stringify(this.dirtyData)
|
377
458
|
}
|
378
459
|
|
460
|
+
/**
|
461
|
+
* Undoes the previous change in the component's data by restoring it to the previous state.
|
462
|
+
* This method is part of the TimeCapsule feature, allowing users to revert changes.
|
463
|
+
*/
|
379
464
|
undo() {
|
380
465
|
if (!this.timeCapsule?.backwardable) {
|
381
466
|
return
|
@@ -384,6 +469,10 @@ export class DataGrist extends LitElement implements DataConsumer {
|
|
384
469
|
this._data = JSON.parse(this.timeCapsule?.backward())
|
385
470
|
}
|
386
471
|
|
472
|
+
/**
|
473
|
+
* Redoes the previously undone change in the component's data by restoring it to the next state.
|
474
|
+
* This method is part of the TimeCapsule feature, allowing users to reapply changes.
|
475
|
+
*/
|
387
476
|
redo() {
|
388
477
|
if (!this.timeCapsule?.forwardable) {
|
389
478
|
return
|
@@ -392,6 +481,13 @@ export class DataGrist extends LitElement implements DataConsumer {
|
|
392
481
|
this._data = JSON.parse(this.timeCapsule?.forward())
|
393
482
|
}
|
394
483
|
|
484
|
+
/**
|
485
|
+
* Fetches data from a data source and updates the component's data. This method is used to retrieve
|
486
|
+
* new data or refresh the existing data in the component.
|
487
|
+
*
|
488
|
+
* @method
|
489
|
+
* @param {boolean} reset - If true, the method resets the scroll position to the top.
|
490
|
+
*/
|
395
491
|
async fetch(reset = true) {
|
396
492
|
if (!this.compiledConfig) {
|
397
493
|
/* avoid to be here */
|
@@ -499,19 +595,58 @@ export class DataGrist extends LitElement implements DataConsumer {
|
|
499
595
|
}
|
500
596
|
}
|
501
597
|
|
598
|
+
/**
|
599
|
+
* Represents the compiled configuration of the component, which includes various settings and
|
600
|
+
* column configurations. You can access this property to get information about how the component
|
601
|
+
* is configured.
|
602
|
+
*
|
603
|
+
* @getter
|
604
|
+
* @public
|
605
|
+
* @type {GristConfig}
|
606
|
+
*/
|
502
607
|
get compiledConfig(): GristConfig {
|
503
608
|
return this._config
|
504
609
|
}
|
505
610
|
|
611
|
+
/**
|
612
|
+
* Returns the dirty data in the component, which includes the records that have been added,
|
613
|
+
* modified, or deleted but have not been committed to the main data yet.
|
614
|
+
*
|
615
|
+
* @getter
|
616
|
+
* @public
|
617
|
+
* @type {GristData} - An object representing the dirty data.
|
618
|
+
*/
|
506
619
|
get dirtyData(): GristData {
|
507
620
|
return (this.grist as any)?.data || {}
|
508
621
|
}
|
509
622
|
|
623
|
+
/**
|
624
|
+
* Returns an array of GristRecord objects representing the records in the dirty state. These are
|
625
|
+
* the records that have been added, modified, or deleted but have not been committed to the main
|
626
|
+
* data yet.
|
627
|
+
*
|
628
|
+
* @getter
|
629
|
+
* @public
|
630
|
+
* @type {GristRecord[]} - An array of GristRecord objects representing the dirty records.
|
631
|
+
*/
|
510
632
|
get dirtyRecords() {
|
511
633
|
var { records = [] } = this.dirtyData
|
512
634
|
return records.filter(record => record['__dirty__'])
|
513
635
|
}
|
514
636
|
|
637
|
+
/**
|
638
|
+
* Exports a list of patches representing the changes in the dirty state of records. Each patch
|
639
|
+
* contains information about whether a record was added, modified, or deleted, along with the
|
640
|
+
* record's unique identifier and the changed field values.
|
641
|
+
*
|
642
|
+
* @param {Object} options - Export options that control the format of the patch list.
|
643
|
+
* @param {string} options.flagName - The name of the flag field in the patch indicating the change type (default: 'patchFlag').
|
644
|
+
* @param {string} options.addedFlag - The flag value for added records (default: '+').
|
645
|
+
* @param {string} options.deletedFlag - The flag value for deleted records (default: '-').
|
646
|
+
* @param {string} options.modifiedFlag - The flag value for modified records (default: 'M').
|
647
|
+
* @param {string} options.idField - The name of the unique identifier field (default: 'id').
|
648
|
+
* @returns {Object[]} - An array of objects representing the patches.
|
649
|
+
*/
|
515
650
|
exportPatchList({ flagName = 'patchFlag', addedFlag = '+', deletedFlag = '-', modifiedFlag = 'M', idField = 'id' }) {
|
516
651
|
let dirtyRecords = this.dirtyRecords
|
517
652
|
if (!dirtyRecords || dirtyRecords.length == 0) {
|
@@ -536,6 +671,15 @@ export class DataGrist extends LitElement implements DataConsumer {
|
|
536
671
|
})
|
537
672
|
}
|
538
673
|
|
674
|
+
/**
|
675
|
+
* Exports the selected records or all records in the component, depending on the specified options.
|
676
|
+
* You can use this method to export data from the component in various formats or for different purposes.
|
677
|
+
*
|
678
|
+
* @param {Object} options - Export options that control the behavior of the export.
|
679
|
+
* @param {boolean} options.ifSelectedOnly - If true, exports only the selected records. If false, exports all records.
|
680
|
+
* @param {boolean} options.includeHiddenField - If true, includes hidden fields in the exported data.
|
681
|
+
* @returns {Object[]} - An array of objects representing the exported records.
|
682
|
+
*/
|
539
683
|
exportRecords({ ifSelectedOnly = true, includeHiddenField = true } = {}) {
|
540
684
|
let records = ifSelectedOnly ? this.selected : this.data.records
|
541
685
|
|
@@ -557,11 +701,27 @@ export class DataGrist extends LitElement implements DataConsumer {
|
|
557
701
|
})
|
558
702
|
}
|
559
703
|
|
704
|
+
/**
|
705
|
+
* Gets the currently selected records in the component. It returns an array of GristRecord objects
|
706
|
+
* that are currently selected. You can access this getter to retrieve the selected records.
|
707
|
+
*
|
708
|
+
* @getter
|
709
|
+
* @public
|
710
|
+
* @type {GristRecord[]}
|
711
|
+
*/
|
560
712
|
get selected() {
|
561
713
|
var { records = [] } = this.grist?.data
|
562
714
|
return records.filter(record => record['__selected__'])
|
563
715
|
}
|
564
716
|
|
717
|
+
/**
|
718
|
+
* Sets the currently selected records in the component. You can use this setter to programmatically
|
719
|
+
* select specific records by providing an array of GristRecord objects to be selected.
|
720
|
+
*
|
721
|
+
* @setter
|
722
|
+
* @public
|
723
|
+
* @type {GristRecord[]}
|
724
|
+
*/
|
565
725
|
set selected(selected: GristRecord[]) {
|
566
726
|
if (!this.grist) {
|
567
727
|
console.warn('grist not ready')
|
@@ -572,6 +732,15 @@ export class DataGrist extends LitElement implements DataConsumer {
|
|
572
732
|
this.refresh()
|
573
733
|
}
|
574
734
|
|
735
|
+
/**
|
736
|
+
* Selects records in the component based on the provided selector function. You can use this method
|
737
|
+
* to programmatically select specific records in the component.
|
738
|
+
*
|
739
|
+
* @method
|
740
|
+
* @param {GristSelectFunction} selector - A function that determines which records to select.
|
741
|
+
* @param {boolean} reset - If true, clears the previous selection before applying the new one.
|
742
|
+
* If false, adds to the existing selection.
|
743
|
+
*/
|
575
744
|
select(selector: GristSelectFunction, reset: boolean = false) {
|
576
745
|
var { records = [] } = this.grist?.data
|
577
746
|
|
@@ -583,20 +752,36 @@ export class DataGrist extends LitElement implements DataConsumer {
|
|
583
752
|
this.refresh()
|
584
753
|
}
|
585
754
|
|
755
|
+
/**
|
756
|
+
* Shows the loading spinner in the component's UI to indicate ongoing data loading or processing.
|
757
|
+
* You can call this method to display the spinner when necessary.
|
758
|
+
*/
|
586
759
|
showSpinner() {
|
587
760
|
this._showSpinner = true
|
588
761
|
}
|
589
762
|
|
763
|
+
/**
|
764
|
+
* Hides the loading spinner in the component's UI to indicate that data loading or processing has completed.
|
765
|
+
* You can call this method to hide the spinner when loading or processing is finished.
|
766
|
+
*/
|
590
767
|
hideSpinner() {
|
591
768
|
this._showSpinner = false
|
592
769
|
}
|
593
770
|
|
771
|
+
/**
|
772
|
+
* Focuses on the component, making it the active element in the document. This method is useful
|
773
|
+
* when you want to programmatically set focus to the component.
|
774
|
+
*/
|
594
775
|
focus() {
|
595
776
|
super.focus()
|
596
777
|
|
597
778
|
this.grist.focus()
|
598
779
|
}
|
599
780
|
|
781
|
+
/**
|
782
|
+
* Commits the changes made in the dirty state to the component's data. This method updates the
|
783
|
+
* component's data with the changes made in the dirty state and clears the dirty state.
|
784
|
+
*/
|
600
785
|
commit() {
|
601
786
|
var { page, total, limit, records } = this.grist.data
|
602
787
|
|
@@ -626,6 +811,10 @@ export class DataGrist extends LitElement implements DataConsumer {
|
|
626
811
|
}
|
627
812
|
}
|
628
813
|
|
814
|
+
/**
|
815
|
+
* Shows the headroom element in the component. The headroom element is typically used for
|
816
|
+
* displaying additional information or controls at the top of the component.
|
817
|
+
*/
|
629
818
|
showHeadroom() {
|
630
819
|
if (this.head) {
|
631
820
|
this.head.style.display = 'block'
|
@@ -633,6 +822,10 @@ export class DataGrist extends LitElement implements DataConsumer {
|
|
633
822
|
}
|
634
823
|
}
|
635
824
|
|
825
|
+
/**
|
826
|
+
* Hides the headroom element in the component. This method hides the additional information
|
827
|
+
* or controls displayed at the top of the component.
|
828
|
+
*/
|
636
829
|
hideHeadroom() {
|
637
830
|
if (this.head) {
|
638
831
|
this.head.style.display = 'none'
|
@@ -640,6 +833,10 @@ export class DataGrist extends LitElement implements DataConsumer {
|
|
640
833
|
}
|
641
834
|
}
|
642
835
|
|
836
|
+
/**
|
837
|
+
* Toggles the visibility of the headroom element in the component. If the headroom element is
|
838
|
+
* currently visible, this method hides it. If it's hidden, this method shows it.
|
839
|
+
*/
|
643
840
|
toggleHeadroom() {
|
644
841
|
if (this.head) {
|
645
842
|
const display = this.head.style.display
|
@@ -660,13 +857,14 @@ export class DataGrist extends LitElement implements DataConsumer {
|
|
660
857
|
}
|
661
858
|
|
662
859
|
/**
|
663
|
-
*
|
860
|
+
* Resets the component's data to its original state before any changes were made.
|
861
|
+
* This method discards all unsaved changes and restores the data to its initial state.
|
664
862
|
*
|
665
863
|
* @method
|
666
|
-
*
|
667
|
-
* TODO tree 형태의 데이타로 _data를 만들 때, children, collapsed 등을 감안한다.
|
864
|
+
* @public
|
668
865
|
*/
|
669
866
|
reset() {
|
867
|
+
// TODO tree 형태의 데이타로 _data를 만들 때, children, collapsed 등을 감안한다.
|
670
868
|
var {
|
671
869
|
limit = ZERO_PAGINATION.limit,
|
672
870
|
page = ZERO_PAGINATION.page,
|
@@ -741,6 +939,10 @@ export class DataGrist extends LitElement implements DataConsumer {
|
|
741
939
|
}
|
742
940
|
}
|
743
941
|
|
942
|
+
/**
|
943
|
+
* Checks for dirty records in the component's data and marks them as dirty.
|
944
|
+
* Dirty records are those that have unsaved changes.
|
945
|
+
*/
|
744
946
|
checkDirties() {
|
745
947
|
const records = this.dirtyRecords
|
746
948
|
const { columns = [] } = this.compiledConfig || {}
|
@@ -771,6 +973,10 @@ export class DataGrist extends LitElement implements DataConsumer {
|
|
771
973
|
this.snapshotTaker?.touch()
|
772
974
|
}
|
773
975
|
|
976
|
+
/**
|
977
|
+
* Clones the selected records in the component's data. It creates a copy of the selected records
|
978
|
+
* and marks them as new (added) records.
|
979
|
+
*/
|
774
980
|
cloneSelectedRecords() {
|
775
981
|
const records = this.selected || ([] as GristRecord[])
|
776
982
|
|
@@ -792,6 +998,37 @@ export class DataGrist extends LitElement implements DataConsumer {
|
|
792
998
|
this.checkDirties()
|
793
999
|
}
|
794
1000
|
|
1001
|
+
/**
|
1002
|
+
* Adds child nodes to selected records in the component's tree data. It allows users to add child nodes
|
1003
|
+
* to the selected parent records.
|
1004
|
+
*/
|
1005
|
+
addChildNodes() {
|
1006
|
+
const records = this.selected || ([] as GristRecord[])
|
1007
|
+
|
1008
|
+
records.forEach(record => {
|
1009
|
+
this.grist.addChildNode(record)
|
1010
|
+
})
|
1011
|
+
}
|
1012
|
+
|
1013
|
+
/**
|
1014
|
+
* Adds sibling nodes to selected records in the component's tree data. It allows users to add sibling nodes
|
1015
|
+
* to the selected records.
|
1016
|
+
*/
|
1017
|
+
addSiblingNodes() {
|
1018
|
+
const records = this.selected || ([] as GristRecord[])
|
1019
|
+
|
1020
|
+
records.forEach(record => {
|
1021
|
+
this.grist.addSiblingNode(record)
|
1022
|
+
})
|
1023
|
+
}
|
1024
|
+
|
1025
|
+
/**
|
1026
|
+
* Deletes the selected records in the component's data. It removes the selected records from the data,
|
1027
|
+
* optionally marking them as deleted.
|
1028
|
+
*
|
1029
|
+
* @method
|
1030
|
+
* @param {boolean} dirty - If true, the method marks the records as deleted.
|
1031
|
+
*/
|
795
1032
|
deleteSelectedRecords(dirty = true) {
|
796
1033
|
const records = this.selected || ([] as GristRecord[])
|
797
1034
|
|
@@ -807,10 +1044,20 @@ export class DataGrist extends LitElement implements DataConsumer {
|
|
807
1044
|
this.checkDirties()
|
808
1045
|
}
|
809
1046
|
|
1047
|
+
/**
|
1048
|
+
* Retrieves the search text used for filtering records.
|
1049
|
+
*
|
1050
|
+
* @property {string}
|
1051
|
+
*/
|
810
1052
|
get searchText() {
|
811
1053
|
return (this.filters?.find(filter => filter.operator === 'search')?.value as string)?.match(/^\%(.*)\%$/)?.[1] || ''
|
812
1054
|
}
|
813
1055
|
|
1056
|
+
/**
|
1057
|
+
* Sets the search text for filtering records.
|
1058
|
+
*
|
1059
|
+
* @property {string}
|
1060
|
+
*/
|
814
1061
|
set searchText(searchText: string) {
|
815
1062
|
var filters = (this.filters || []).filter((filter: FilterValue) => filter.operator !== 'search')
|
816
1063
|
|
@@ -22,6 +22,18 @@ export class DataListGutter extends LitElement {
|
|
22
22
|
font-size: var(--grid-record-wide-fontsize);
|
23
23
|
text-overflow: ellipsis;
|
24
24
|
color: var(--grid-record-color);
|
25
|
+
|
26
|
+
padding-right: 10px;
|
27
|
+
}
|
28
|
+
|
29
|
+
:host-context(.expand)::after {
|
30
|
+
content: '';
|
31
|
+
position: absolute;
|
32
|
+
left: 50%;
|
33
|
+
top: 50%;
|
34
|
+
transform: translate(-50%, -50%);
|
35
|
+
width: 150%;
|
36
|
+
height: 220%;
|
25
37
|
}
|
26
38
|
|
27
39
|
* {
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import '@material/
|
1
|
+
import '@material/web/icon/icon.js'
|
2
2
|
import './record-partial'
|
3
3
|
|
4
4
|
import { css, html, PropertyValues } from 'lit'
|
@@ -25,7 +25,7 @@ export class DataList extends DataManipulator {
|
|
25
25
|
}
|
26
26
|
|
27
27
|
#upward {
|
28
|
-
--
|
28
|
+
--md-icon-size: 26px;
|
29
29
|
position: absolute;
|
30
30
|
top: var(--data-list-fab-position-vertical);
|
31
31
|
right: var(--data-list-fab-position-horizontal);
|
@@ -118,7 +118,7 @@ export class DataList extends DataManipulator {
|
|
118
118
|
${this.empty ? html` <ox-empty-note title="NO RECORDS"></ox-empty-note> ` : html``}
|
119
119
|
${this.isTop
|
120
120
|
? html``
|
121
|
-
: html` <
|
121
|
+
: html` <md-icon id="upward" @click=${(e: Event) => this.gotoTop(e)}>arrow_upward</md-icon> `}
|
122
122
|
`
|
123
123
|
}
|
124
124
|
|
@@ -29,6 +29,6 @@ export function recordPartialClickHandler(this: RecordPartial, e: MouseEvent): v
|
|
29
29
|
rowsClick(this.config.columns, this.data, column, this.record, rowIndex, target)
|
30
30
|
} else {
|
31
31
|
/* content 가 클릭된 경우 - 레코드뷰 팝업을 실행한다. */
|
32
|
-
this.popupRecordView()
|
32
|
+
this.config.rows.editable && this.popupRecordView()
|
33
33
|
}
|
34
34
|
}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import '@material/
|
1
|
+
import '@material/web/icon/icon.js'
|
2
2
|
import './data-list-gutter'
|
3
3
|
import './data-list-field'
|
4
4
|
import '../record-view'
|
@@ -39,6 +39,7 @@ export class RecordPartial extends LitElement {
|
|
39
39
|
border-bottom: var(--data-list-item-border-bottom);
|
40
40
|
position: relative;
|
41
41
|
min-height: 42px;
|
42
|
+
padding-left: 7px;
|
42
43
|
}
|
43
44
|
|
44
45
|
:host([dirty])::before {
|
@@ -168,32 +169,31 @@ export class RecordPartial extends LitElement {
|
|
168
169
|
}
|
169
170
|
|
170
171
|
return html`
|
171
|
-
${dirtyIcon ? html` <
|
172
|
+
${dirtyIcon ? html` <md-icon dirty>${dirtyIcon}</md-icon> ` : html``}
|
172
173
|
${gutters.map(
|
173
|
-
gutter =>
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
174
|
+
gutter => html`
|
175
|
+
<ox-list-gutter
|
176
|
+
class=${gutter.name === 'detail' ? 'expand' : ''}
|
177
|
+
.rowIndex=${rowIndex}
|
178
|
+
.column=${gutter}
|
179
|
+
.record=${record}
|
180
|
+
.value=${record[gutter.name]}
|
181
|
+
></ox-list-gutter>
|
182
|
+
`
|
182
183
|
)}
|
183
184
|
|
184
185
|
<div content>
|
185
186
|
${displayColumns.map(
|
186
|
-
(column, idx) =>
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
`
|
187
|
+
(column, idx) => html`
|
188
|
+
<ox-list-field
|
189
|
+
.rowIndex=${rowIndex}
|
190
|
+
.column=${column}
|
191
|
+
.record=${record}
|
192
|
+
.value=${record[column?.name || '']}
|
193
|
+
?name=${idx == 0}
|
194
|
+
?desc=${idx == 1}
|
195
|
+
></ox-list-field>
|
196
|
+
`
|
197
197
|
)}
|
198
198
|
</div>
|
199
199
|
${thumbnail
|